Skip to content

Instantly share code, notes, and snippets.

@acao
Created April 9, 2019 16:01
Show Gist options
  • Save acao/d89cf4e130648e106a86f7e98020584c to your computer and use it in GitHub Desktop.
Save acao/d89cf4e130648e106a86f7e98020584c to your computer and use it in GitHub Desktop.
graphiql - inputUnion branch
This file has been truncated, but you can view the full file.
!function(f){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=f();else if("function"==typeof define&&define.amd)define([],f);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).GraphiQL=f()}}(function(){return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n||e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){"use strict";var _codemirror2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(require("codemirror")),_graphqlLanguageServiceInterface=require("graphql-language-service-interface");_codemirror2.default.registerHelper("hint","graphql",function(editor,options){var schema=options.schema;if(schema){var cur=editor.getCursor(),token=editor.getTokenAt(cur),rawResults=(0,_graphqlLanguageServiceInterface.getAutocompleteSuggestions)(schema,editor.getValue(),cur,token),tokenStart=null!==token.type&&/"|\w/.test(token.string[0])?token.start:token.end,results={list:rawResults.map(function(item){return{text:item.label,type:schema.getType(item.detail),description:item.documentation,isDeprecated:item.isDeprecated,deprecationReason:item.deprecationReason}}),from:{line:cur.line,column:tokenStart},to:{line:cur.line,column:token.end}};return results&&results.list&&results.list.length>0&&(results.from=_codemirror2.default.Pos(results.from.line,results.from.column),results.to=_codemirror2.default.Pos(results.to.line,results.to.column),_codemirror2.default.signal(editor,"hasCompletion",editor,results,token)),results}})},{codemirror:6,"graphql-language-service-interface":25}],2:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function renderField(into,typeInfo,options){renderQualifiedField(into,typeInfo,options),renderTypeAnnotation(into,typeInfo,options,typeInfo.type)}function renderQualifiedField(into,typeInfo,options){var fieldName=typeInfo.fieldDef.name;"__"!==fieldName.slice(0,2)&&(renderType(into,typeInfo,options,typeInfo.parentType),text(into,".")),text(into,fieldName,"field-name",options,(0,_SchemaReference.getFieldReference)(typeInfo))}function renderDirective(into,typeInfo,options){text(into,"@"+typeInfo.directiveDef.name,"directive-name",options,(0,_SchemaReference.getDirectiveReference)(typeInfo))}function renderArg(into,typeInfo,options){typeInfo.directiveDef?renderDirective(into,typeInfo,options):typeInfo.fieldDef&&renderQualifiedField(into,typeInfo,options);var name=typeInfo.argDef.name;text(into,"("),text(into,name,"arg-name",options,(0,_SchemaReference.getArgumentReference)(typeInfo)),renderTypeAnnotation(into,typeInfo,options,typeInfo.inputType),text(into,")")}function renderTypeAnnotation(into,typeInfo,options,t){text(into,": "),renderType(into,typeInfo,options,t)}function renderEnumValue(into,typeInfo,options){var name=typeInfo.enumValue.name;renderType(into,typeInfo,options,typeInfo.inputType),text(into,"."),text(into,name,"enum-value",options,(0,_SchemaReference.getEnumValueReference)(typeInfo))}function renderType(into,typeInfo,options,t){t instanceof _graphql.GraphQLNonNull?(renderType(into,typeInfo,options,t.ofType),text(into,"!")):t instanceof _graphql.GraphQLList?(text(into,"["),renderType(into,typeInfo,options,t.ofType),text(into,"]")):text(into,t.name,"type-name",options,(0,_SchemaReference.getTypeReference)(typeInfo,t))}function renderDescription(into,options,def){var description=def.description;if(description){var descriptionDiv=document.createElement("div");descriptionDiv.className="info-description",options.renderDescription?descriptionDiv.innerHTML=options.renderDescription(description):descriptionDiv.appendChild(document.createTextNode(description)),into.appendChild(descriptionDiv)}renderDeprecation(into,options,def)}function renderDeprecation(into,options,def){var reason=def.deprecationReason;if(reason){var deprecationDiv=document.createElement("div");deprecationDiv.className="info-deprecation",options.renderDescription?deprecationDiv.innerHTML=options.renderDescription(reason):deprecationDiv.appendChild(document.createTextNode(reason));var label=document.createElement("span");label.className="info-deprecation-label",label.appendChild(document.createTextNode("Deprecated: ")),deprecationDiv.insertBefore(label,deprecationDiv.firstChild),into.appendChild(deprecationDiv)}}function text(into,content,className,options,ref){if(className){var onClick=options.onClick,node=document.createElement(onClick?"a":"span");onClick&&(node.href="javascript:void 0",node.addEventListener("click",function(e){onClick(ref,e)})),node.className=className,node.appendChild(document.createTextNode(content)),into.appendChild(node)}else into.appendChild(document.createTextNode(content))}var _graphql=require("graphql"),_codemirror2=_interopRequireDefault(require("codemirror")),_getTypeInfo2=_interopRequireDefault(require("./utils/getTypeInfo")),_SchemaReference=require("./utils/SchemaReference");require("./utils/info-addon"),_codemirror2.default.registerHelper("info","graphql",function(token,options){if(options.schema&&token.state){var state=token.state,kind=state.kind,step=state.step,typeInfo=(0,_getTypeInfo2.default)(options.schema,token.state);if("Field"===kind&&0===step&&typeInfo.fieldDef||"AliasedField"===kind&&2===step&&typeInfo.fieldDef){var into=document.createElement("div");return renderField(into,typeInfo,options),renderDescription(into,options,typeInfo.fieldDef),into}if("Directive"===kind&&1===step&&typeInfo.directiveDef){var _into=document.createElement("div");return renderDirective(_into,typeInfo,options),renderDescription(_into,options,typeInfo.directiveDef),_into}if("Argument"===kind&&0===step&&typeInfo.argDef){var _into2=document.createElement("div");return renderArg(_into2,typeInfo,options),renderDescription(_into2,options,typeInfo.argDef),_into2}if("EnumValue"===kind&&typeInfo.enumValue&&typeInfo.enumValue.description){var _into3=document.createElement("div");return renderEnumValue(_into3,typeInfo,options),renderDescription(_into3,options,typeInfo.enumValue),_into3}if("NamedType"===kind&&typeInfo.type&&typeInfo.type.description){var _into4=document.createElement("div");return renderType(_into4,typeInfo,options,typeInfo.type),renderDescription(_into4,options,typeInfo.type),_into4}}})},{"./utils/SchemaReference":8,"./utils/getTypeInfo":10,"./utils/info-addon":12,codemirror:6,graphql:174}],3:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var _codemirror2=_interopRequireDefault(require("codemirror")),_getTypeInfo2=_interopRequireDefault(require("./utils/getTypeInfo")),_SchemaReference=require("./utils/SchemaReference");require("./utils/jump-addon"),_codemirror2.default.registerHelper("jump","graphql",function(token,options){if(options.schema&&options.onClick&&token.state){var state=token.state,kind=state.kind,step=state.step,typeInfo=(0,_getTypeInfo2.default)(options.schema,state);return"Field"===kind&&0===step&&typeInfo.fieldDef||"AliasedField"===kind&&2===step&&typeInfo.fieldDef?(0,_SchemaReference.getFieldReference)(typeInfo):"Directive"===kind&&1===step&&typeInfo.directiveDef?(0,_SchemaReference.getDirectiveReference)(typeInfo):"Argument"===kind&&0===step&&typeInfo.argDef?(0,_SchemaReference.getArgumentReference)(typeInfo):"EnumValue"===kind&&typeInfo.enumValue?(0,_SchemaReference.getEnumValueReference)(typeInfo):"NamedType"===kind&&typeInfo.type?(0,_SchemaReference.getTypeReference)(typeInfo):void 0}})},{"./utils/SchemaReference":8,"./utils/getTypeInfo":10,"./utils/jump-addon":14,codemirror:6}],4:[function(require,module,exports){"use strict";var _codemirror2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(require("codemirror")),_graphqlLanguageServiceInterface=require("graphql-language-service-interface"),SEVERITY=["error","warning","information","hint"],TYPE={"GraphQL: Validation":"validation","GraphQL: Deprecation":"deprecation","GraphQL: Syntax":"syntax"};_codemirror2.default.registerHelper("lint","graphql",function(text,options){var schema=options.schema;return(0,_graphqlLanguageServiceInterface.getDiagnostics)(text,schema).map(function(error){return{message:error.message,severity:SEVERITY[error.severity-1],type:TYPE[error.source],from:_codemirror2.default.Pos(error.range.start.line,error.range.start.character),to:_codemirror2.default.Pos(error.range.end.line,error.range.end.character)}})})},{codemirror:6,"graphql-language-service-interface":25}],5:[function(require,module,exports){"use strict";function indent(state,textAfter){var levels=state.levels;return(levels&&0!==levels.length?levels[levels.length-1]-(this.electricInput.test(textAfter)?1:0):state.indentLevel)*this.config.indentUnit}var _codemirror2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(require("codemirror")),_graphqlLanguageServiceParser=require("graphql-language-service-parser");_codemirror2.default.defineMode("graphql",function(config){var parser=(0,_graphqlLanguageServiceParser.onlineParser)({eatWhitespace:function(stream){return stream.eatWhile(_graphqlLanguageServiceParser.isIgnored)},lexRules:_graphqlLanguageServiceParser.LexRules,parseRules:_graphqlLanguageServiceParser.ParseRules,editorConfig:{tabSize:config.tabSize}});return{config:config,startState:parser.startState,token:parser.token,indent:indent,electricInput:/^\s*[})\]]/,fold:"brace",lineComment:"#",closeBrackets:{pairs:'()[]{}""',explode:"()[]{}"}}})},{codemirror:6,"graphql-language-service-parser":29}],6:[function(require,module,exports){!function(global,factory){"object"==typeof exports&&void 0!==module?module.exports=factory():global.CodeMirror=factory()}(this,function(){"use strict";function classTest(cls){return new RegExp("(^|\\s)"+cls+"(?:$|\\s)\\s*")}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),style&&(e.style.cssText=style),"string"==typeof content)e.appendChild(document.createTextNode(content));else if(content)for(var i=0;i<content.length;++i)e.appendChild(content[i]);return e}function eltP(tag,content,className,style){var e=elt(tag,content,className,style);return e.setAttribute("role","presentation"),e}function contains(parent,child){if(3==child.nodeType&&(child=child.parentNode),parent.contains)return parent.contains(child);do{if(11==child.nodeType&&(child=child.host),child==parent)return!0}while(child=child.parentNode)}function activeElt(){var activeElement;try{activeElement=document.activeElement}catch(e){activeElement=document.body||null}for(;activeElement&&activeElement.shadowRoot&&activeElement.shadowRoot.activeElement;)activeElement=activeElement.shadowRoot.activeElement;return activeElement}function addClass(node,cls){var current=node.className;classTest(cls).test(current)||(node.className+=(current?" ":"")+cls)}function joinClasses(a,b){for(var as=a.split(" "),i=0;i<as.length;i++)as[i]&&!classTest(as[i]).test(b)&&(b+=" "+as[i]);return b}function bind(f){var args=Array.prototype.slice.call(arguments,1);return function(){return f.apply(null,args)}}function copyObj(obj,target,overwrite){target||(target={});for(var prop in obj)!obj.hasOwnProperty(prop)||!1===overwrite&&target.hasOwnProperty(prop)||(target[prop]=obj[prop]);return target}function countColumn(string,end,tabSize,startIndex,startValue){null==end&&-1==(end=string.search(/[^\s\u00a0]/))&&(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 indexOf(array,elt){for(var i=0;i<array.length;++i)if(array[i]==elt)return i;return-1}function findColumn(string,goal,tabSize){for(var pos=0,col=0;;){var nextTab=string.indexOf("\t",pos);-1==nextTab&&(nextTab=string.length);var skipped=nextTab-pos;if(nextTab==string.length||col+skipped>=goal)return pos+Math.min(skipped,goal-col);if(col+=nextTab-pos,col+=tabSize-col%tabSize,pos=nextTab+1,col>=goal)return pos}}function spaceStr(n){for(;spaceStrs.length<=n;)spaceStrs.push(lst(spaceStrs)+" ");return spaceStrs[n]}function lst(arr){return arr[arr.length-1]}function map(array,f){for(var out=[],i=0;i<array.length;i++)out[i]=f(array[i],i);return out}function insertSorted(array,value,score){for(var pos=0,priority=score(value);pos<array.length&&score(array[pos])<=priority;)pos++;array.splice(pos,0,value)}function nothing(){}function createObj(base,props){var inst;return Object.create?inst=Object.create(base):(nothing.prototype=base,inst=new nothing),props&&copyObj(props,inst),inst}function isWordCharBasic(ch){return/\w/.test(ch)||ch>"€"&&(ch.toUpperCase()!=ch.toLowerCase()||nonASCIISingleCaseWordChar.test(ch))}function isWordChar(ch,helper){return helper?!!(helper.source.indexOf("\\w")>-1&&isWordCharBasic(ch))||helper.test(ch):isWordCharBasic(ch)}function isEmpty(obj){for(var n in obj)if(obj.hasOwnProperty(n)&&obj[n])return!1;return!0}function isExtendingChar(ch){return ch.charCodeAt(0)>=768&&extendingChars.test(ch)}function skipExtendingChars(str,pos,dir){for(;(dir<0?pos>0:pos<str.length)&&isExtendingChar(str.charAt(pos));)pos+=dir;return pos}function findFirst(pred,from,to){for(var dir=from>to?-1:1;;){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;pred(mid)?to=mid:from=mid+dir}}function Display(place,doc,input){var d=this;this.input=input,d.scrollbarFiller=elt("div",null,"CodeMirror-scrollbar-filler"),d.scrollbarFiller.setAttribute("cm-not-content","true"),d.gutterFiller=elt("div",null,"CodeMirror-gutter-filler"),d.gutterFiller.setAttribute("cm-not-content","true"),d.lineDiv=eltP("div",null,"CodeMirror-code"),d.selectionDiv=elt("div",null,null,"position: relative; z-index: 1"),d.cursorDiv=elt("div",null,"CodeMirror-cursors"),d.measure=elt("div",null,"CodeMirror-measure"),d.lineMeasure=elt("div",null,"CodeMirror-measure"),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");d.mover=elt("div",[lines],null,"position: relative"),d.sizer=elt("div",[d.mover],"CodeMirror-sizer"),d.sizerWidth=null,d.heightForcer=elt("div",null,null,"position: absolute; height: "+scrollerGap+"px; width: 1px;"),d.gutters=elt("div",null,"CodeMirror-gutters"),d.lineGutter=null,d.scroller=elt("div",[d.sizer,d.heightForcer,d.gutters],"CodeMirror-scroll"),d.scroller.setAttribute("tabIndex","-1"),d.wrapper=elt("div",[d.scrollbarFiller,d.gutterFiller,d.scroller],"CodeMirror"),ie&&ie_version<8&&(d.gutters.style.zIndex=-1,d.scroller.style.paddingRight=0),webkit||gecko&&mobile||(d.scroller.draggable=!0),place&&(place.appendChild?place.appendChild(d.wrapper):place(d.wrapper)),d.viewFrom=d.viewTo=doc.first,d.reportedViewFrom=d.reportedViewTo=doc.first,d.view=[],d.renderedView=null,d.externalMeasured=null,d.viewOffset=0,d.lastWrapHeight=d.lastWrapWidth=0,d.updateLineNumbers=null,d.nativeBarWidth=d.barHeight=d.barWidth=0,d.scrollbarsClipped=!1,d.lineNumWidth=d.lineNumInnerWidth=d.lineNumChars=null,d.alignWidgets=!1,d.cachedCharWidth=d.cachedTextHeight=d.cachedPaddingH=null,d.maxLine=null,d.maxLineLength=0,d.maxLineChanged=!1,d.wheelDX=d.wheelDY=d.wheelStartX=d.wheelStartY=null,d.shift=!1,d.selForContextMenu=null,d.activeTouch=null,input.init(d)}function getLine(doc,n){if((n-=doc.first)<0||n>=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<sz){chunk=child;break}n-=sz}return chunk.lines[n]}function getBetween(doc,start,end){var out=[],n=start.line;return doc.iter(start.line,end.line+1,function(line){var text=line.text;n==end.line&&(text=text.slice(0,end.ch)),n==start.line&&(text=text.slice(start.ch)),out.push(text),++n}),out}function getLines(doc,from,to){var out=[];return doc.iter(from,to,function(line){out.push(line.text)}),out}function updateLineHeight(line,height){var diff=height-line.height;if(diff)for(var n=line;n;n=n.parent)n.height+=diff}function lineNo(line){if(null==line.parent)return null;for(var cur=line.parent,no=indexOf(cur.lines,line),chunk=cur.parent;chunk;cur=chunk,chunk=chunk.parent)for(var i=0;chunk.children[i]!=cur;++i)no+=chunk.children[i].chunkSize();return no+cur.first}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);for(var i=0;i<chunk.lines.length;++i){var lh=chunk.lines[i].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))}function Pos(line,ch,sticky){if(void 0===sticky&&(sticky=null),!(this instanceof Pos))return new Pos(line,ch,sticky);this.line=line,this.ch=ch,this.sticky=sticky}function cmp(a,b){return a.line-b.line||a.ch-b.ch}function equalCursorPos(a,b){return a.sticky==b.sticky&&0==cmp(a,b)}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}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;return pos.line>last?Pos(last,getLine(doc,last).text.length):clipToLen(pos,getLine(doc,pos.line).text.length)}function clipToLen(pos,linelen){var ch=pos.ch;return null==ch||ch>linelen?Pos(pos.line,linelen):ch<0?Pos(pos.line,0):pos}function clipPosArray(doc,array){for(var out=[],i=0;i<array.length;i++)out[i]=clipPos(doc,array[i]);return out}function seeReadOnlySpans(){sawReadOnlySpans=!0}function seeCollapsedSpans(){sawCollapsedSpans=!0}function MarkedSpan(marker,from,to){this.marker=marker,this.from=from,this.to=to}function getMarkedSpanFor(spans,marker){if(spans)for(var i=0;i<spans.length;++i){var span=spans[i];if(span.marker==marker)return span}}function removeMarkedSpan(spans,span){for(var r,i=0;i<spans.length;++i)spans[i]!=span&&(r||(r=[])).push(spans[i]);return r}function addMarkedSpan(line,span){line.markedSpans=line.markedSpans?line.markedSpans.concat([span]):[span],span.marker.attachLine(line)}function markedSpansBefore(old,startCh,isInsert){var nw;if(old)for(var i=0;i<old.length;++i){var span=old[i],marker=span.marker;if(null==span.from||(marker.inclusiveLeft?span.from<=startCh:span.from<startCh)||span.from==startCh&&"bookmark"==marker.type&&(!isInsert||!span.marker.insertLeft)){var endsAfter=null==span.to||(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;if(null==span.to||(marker.inclusiveRight?span.to>=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.from<endCh);(nw||(nw=[])).push(new MarkedSpan(marker,startsBefore?null:span.from-endCh,null==span.to?null:span.to-endCh))}}return nw}function stretchSpansOverChange(doc,change){if(change.full)return null;var oldFirst=isLine(doc,change.from.line)&&getLine(doc,change.from.line).markedSpans,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=0==cmp(change.from,change.to),first=markedSpansBefore(oldFirst,startCh,isInsert),last=markedSpansAfter(oldLast,endCh,isInsert),sameLine=1==change.text.length,offset=lst(change.text).length+(sameLine?startCh:0);if(first)for(var i=0;i<first.length;++i){var span=first[i];if(null==span.to){var found=getMarkedSpanFor(last,span.marker);found?sameLine&&(span.to=null==found.to?null:found.to+offset):span.to=startCh}}if(last)for(var i$1=0;i$1<last.length;++i$1){var span$1=last[i$1];null!=span$1.to&&(span$1.to+=offset),null==span$1.from?getMarkedSpanFor(first,span$1.marker)||(span$1.from=offset,sameLine&&(first||(first=[])).push(span$1)):(span$1.from+=offset,sameLine&&(first||(first=[])).push(span$1))}first&&(first=clearEmptySpans(first)),last&&last!=first&&(last=clearEmptySpans(last));var newMarkers=[first];if(!sameLine){var gapMarkers,gap=change.text.length-2;if(gap>0&&first)for(var i$2=0;i$2<first.length;++i$2)null==first[i$2].to&&(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}function clearEmptySpans(spans){for(var i=0;i<spans.length;++i){var span=spans[i];null!=span.from&&span.from==span.to&&!1!==span.marker.clearWhenEmpty&&spans.splice(i--,1)}return spans.length?spans:null}function removeReadOnlyRanges(doc,from,to){var markers=null;if(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;!mark.readOnly||markers&&-1!=indexOf(markers,mark)||(markers||(markers=[])).push(mark)}}),!markers)return null;for(var parts=[{from:from,to:to}],i=0;i<markers.length;++i)for(var mk=markers[i],m=mk.find(0),j=0;j<parts.length;++j){var p=parts[j];if(!(cmp(p.to,m.from)<0||cmp(p.from,m.to)>0)){var newParts=[j,1],dfrom=cmp(p.from,m.from),dto=cmp(p.to,m.to);(dfrom<0||!mk.inclusiveLeft&&!dfrom)&&newParts.push({from:p.from,to:m.from}),(dto>0||!mk.inclusiveRight&&!dto)&&newParts.push({from:m.to,to:p.to}),parts.splice.apply(parts,newParts),j+=newParts.length-3}}return parts}function detachMarkedSpans(line){var spans=line.markedSpans;if(spans){for(var i=0;i<spans.length;++i)spans[i].marker.detachLine(line);line.markedSpans=null}}function attachMarkedSpans(line,spans){if(spans){for(var i=0;i<spans.length;++i)spans[i].marker.attachLine(line);line.markedSpans=spans}}function extraLeft(marker){return marker.inclusiveLeft?-1:0}function extraRight(marker){return marker.inclusiveRight?1:0}function compareCollapsedMarkers(a,b){var lenDiff=a.lines.length-b.lines.length;if(0!=lenDiff)return lenDiff;var aPos=a.find(),bPos=b.find(),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);return toCmp||b.id-a.id}function collapsedSpanAtSide(line,start){var found,sps=sawCollapsedSpans&&line.markedSpans;if(sps)for(var sp=void 0,i=0;i<sps.length;++i)(sp=sps[i]).marker.collapsed&&null==(start?sp.from:sp.to)&&(!found||compareCollapsedMarkers(found,sp.marker)<0)&&(found=sp.marker);return found}function collapsedSpanAtStart(line){return collapsedSpanAtSide(line,!0)}function collapsedSpanAtEnd(line){return collapsedSpanAtSide(line,!1)}function conflictingCollapsedRange(doc,lineNo$$1,from,to,marker){var line=getLine(doc,lineNo$$1),sps=sawCollapsedSpans&&line.markedSpans;if(sps)for(var i=0;i<sps.length;++i){var sp=sps[i];if(sp.marker.collapsed){var found=sp.marker.find(0),fromCmp=cmp(found.from,from)||extraLeft(sp.marker)-extraLeft(marker),toCmp=cmp(found.to,to)||extraRight(sp.marker)-extraRight(marker);if(!(fromCmp>=0&&toCmp<=0||fromCmp<=0&&toCmp>=0)&&(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!0}}}function visualLine(line){for(var merged;merged=collapsedSpanAtStart(line);)line=merged.find(-1,!0).line;return line}function visualLineEnd(line){for(var merged;merged=collapsedSpanAtEnd(line);)line=merged.find(1,!0).line;return line}function visualLineContinued(line){for(var merged,lines;merged=collapsedSpanAtEnd(line);)line=merged.find(1,!0).line,(lines||(lines=[])).push(line);return lines}function visualLineNo(doc,lineN){var line=getLine(doc,lineN),vis=visualLine(line);return line==vis?lineN:lineNo(vis)}function visualLineEndNo(doc,lineN){if(lineN>doc.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;i<sps.length;++i)if((sp=sps[i]).marker.collapsed){if(null==sp.from)return!0;if(!sp.marker.widgetNode&&0==sp.from&&sp.marker.inclusiveLeft&&lineIsHiddenInner(doc,line,sp))return!0}}function lineIsHiddenInner(doc,line,span){if(null==span.to){var end=span.marker.find(1,!0);return lineIsHiddenInner(doc,end.line,getMarkedSpanFor(end.line.markedSpans,span.marker))}if(span.marker.inclusiveRight&&span.to==line.text.length)return!0;for(var sp=void 0,i=0;i<line.markedSpans.length;++i)if((sp=line.markedSpans[i]).marker.collapsed&&!sp.marker.widgetNode&&sp.from==span.to&&(null==sp.to||sp.to!=span.from)&&(sp.marker.inclusiveLeft||span.marker.inclusiveRight)&&lineIsHiddenInner(doc,line,sp))return!0}function heightAtLine(lineObj){for(var h=0,chunk=(lineObj=visualLine(lineObj)).parent,i=0;i<chunk.lines.length;++i){var line=chunk.lines[i];if(line==lineObj)break;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;h+=cur.height}return h}function lineLength(line){if(0==line.height)return 0;for(var merged,len=line.text.length,cur=line;merged=collapsedSpanAtStart(cur);){var found=merged.find(0,!0);cur=found.from.line,len+=found.from.ch-found.to.ch}for(cur=line;merged=collapsedSpanAtEnd(cur);){var found$1=merged.find(0,!0);len-=cur.text.length-found$1.from.ch,len+=(cur=found$1.to.line).text.length-found$1.to.ch}return len}function findMaxLine(cm){var d=cm.display,doc=cm.doc;d.maxLine=getLine(doc,doc.first),d.maxLineLength=lineLength(d.maxLine),d.maxLineChanged=!0,doc.iter(function(line){var len=lineLength(line);len>d.maxLineLength&&(d.maxLineLength=len,d.maxLine=line)})}function iterateBidiSections(order,from,to,f){if(!order)return f(from,to,"ltr",0);for(var found=!1,i=0;i<order.length;++i){var part=order[i];(part.from<to&&part.to>from||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")}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;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}function getOrder(line,direction){var order=line.order;return null==order&&(order=line.order=bidiOrdering(line.text,direction)),order}function getHandlers(emitter,type){return emitter._handlers&&emitter._handlers[type]||noHandlers}function off(emitter,type,f){if(emitter.removeEventListener)emitter.removeEventListener(type,f,!1);else if(emitter.detachEvent)emitter.detachEvent("on"+type,f);else{var map$$1=emitter._handlers,arr=map$$1&&map$$1[type];if(arr){var index=indexOf(arr,f);index>-1&&(map$$1[type]=arr.slice(0,index).concat(arr.slice(index+1)))}}}function signal(emitter,type){var handlers=getHandlers(emitter,type);if(handlers.length)for(var args=Array.prototype.slice.call(arguments,2),i=0;i<handlers.length;++i)handlers[i].apply(null,args)}function signalDOMEvent(cm,e,override){return"string"==typeof e&&(e={type:e,preventDefault:function(){this.defaultPrevented=!0}}),signal(cm,override||e.type,cm,e),e_defaultPrevented(e)||e.codemirrorIgnore}function signalCursorActivity(cm){var arr=cm._handlers&&cm._handlers.cursorActivity;if(arr)for(var set=cm.curOp.cursorActivityHandlers||(cm.curOp.cursorActivityHandlers=[]),i=0;i<arr.length;++i)-1==indexOf(set,arr[i])&&set.push(arr[i])}function hasHandler(emitter,type){return getHandlers(emitter,type).length>0}function eventMixin(ctor){ctor.prototype.on=function(type,f){on(this,type,f)},ctor.prototype.off=function(type,f){off(this,type,f)}}function e_preventDefault(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function e_stopPropagation(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function e_defaultPrevented(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}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;return null==b&&(1&e.button?b=1:2&e.button?b=3:4&e.button&&(b=2)),mac&&e.ctrlKey&&1==b&&(b=3),b}function zeroWidthElement(measure){if(null==zwspSupported){var test=elt("span","​");removeChildrenAndAdd(measure,elt("span",[test,document.createTextNode("x")])),0!=measure.firstChild.offsetHeight&&(zwspSupported=test.offsetWidth<=1&&test.offsetHeight>2&&!(ie&&ie_version<8))}var node=zwspSupported?elt("span","​"):elt("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return node.setAttribute("cm-text",""),node}function hasBadBidiRects(measure){if(null!=badBidiRects)return badBidiRects;var txt=removeChildrenAndAdd(measure,document.createTextNode("AخA")),r0=range(txt,0,1).getBoundingClientRect(),r1=range(txt,1,2).getBoundingClientRect();return removeChildren(measure),!(!r0||r0.left==r0.right)&&(badBidiRects=r1.right-r0.right<3)}function hasBadZoomedRects(measure){if(null!=badZoomedRects)return badZoomedRects;var node=removeChildrenAndAdd(measure,elt("span","x")),normal=node.getBoundingClientRect(),fromRange=range(node,0,1).getBoundingClientRect();return badZoomedRects=Math.abs(normal.left-fromRange.left)>1}function defineMode(name,mode){arguments.length>2&&(mode.dependencies=Array.prototype.slice.call(arguments,2)),modes[name]=mode}function resolveMode(spec){if("string"==typeof spec&&mimeModes.hasOwnProperty(spec))spec=mimeModes[spec];else if(spec&&"string"==typeof spec.name&&mimeModes.hasOwnProperty(spec.name)){var found=mimeModes[spec.name];"string"==typeof found&&(found={name:found}),(spec=createObj(found,spec)).name=found.name}else{if("string"==typeof spec&&/^[\w\-]+\/[\w\-]+\+xml$/.test(spec))return resolveMode("application/xml");if("string"==typeof spec&&/^[\w\-]+\/[\w\-]+\+json$/.test(spec))return resolveMode("application/json")}return"string"==typeof spec?{name:spec}:spec||{name:"null"}}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)exts.hasOwnProperty(prop)&&(modeObj.hasOwnProperty(prop)&&(modeObj["_"+prop]=modeObj[prop]),modeObj[prop]=exts[prop])}if(modeObj.name=spec.name,spec.helperType&&(modeObj.helperType=spec.helperType),spec.modeProps)for(var prop$1 in spec.modeProps)modeObj[prop$1]=spec.modeProps[prop$1];return modeObj}function extendMode(mode,properties){copyObj(properties,modeExtensions.hasOwnProperty(mode)?modeExtensions[mode]:modeExtensions[mode]={})}function copyState(mode,state){if(!0===state)return state;if(mode.copyState)return mode.copyState(state);var nstate={};for(var n in state){var val=state[n];val instanceof Array&&(val=val.concat([])),nstate[n]=val}return nstate}function innerMode(mode,state){for(var info;mode.innerMode&&(info=mode.innerMode(state))&&info.mode!=mode;)state=info.state,mode=info.mode;return info||{mode:mode,state:state}}function startState(mode,a1,a2){return!mode.startState||mode.startState(a1,a2)}function highlightLine(cm,line,context,forceToEnd){var st=[cm.state.modeGen],lineClasses={};runMode(cm,line.text,cm.doc.mode,context,function(end,style){return st.push(end,style)},lineClasses,forceToEnd);for(var state=context.state,o=0;o<cm.state.overlays.length;++o)!function(o){context.baseTokens=st;var overlay=cm.state.overlays[o],i=1,at=0;context.state=!0,runMode(cm,line.text,overlay.mode,context,function(end,style){for(var start=i;at<end;){var i_end=st[i];i_end>end&&st.splice(i,1,end,st[i+1],i_end),i+=2,at=Math.min(end,i_end)}if(style)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}(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)),resetState=line.text.length>cm.options.maxHighlightLength&&copyState(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=findStartLine(cm,n,precise),saved=start>doc.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&&pos<display.viewTo?context.save():null,context.nextLine()}),precise&&(doc.modeFrontier=context.line),context}function processLine(cm,text,context,startAt){var mode=cm.doc.mode,stream=new StringStream(text,cm.options.tabSize,context);for(stream.start=stream.pos=startAt||0,""==text&&callBlankLine(mode,context.state);!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){var inner=innerMode(mode,state);return inner.mode.blankLine?inner.mode.blankLine(inner.state):void 0}}function readToken(mode,stream,state,inner){for(var i=0;i<10;i++){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.")}function takeToken(cm,pos,precise,asArray){var style,tokens,doc=cm.doc,mode=doc.mode,line=getLine(doc,(pos=clipPos(doc,pos)).line),context=getContextBefore(cm,pos.line,precise),stream=new StringStream(line.text,cm.options.tabSize,context);for(asArray&&(tokens=[]);(asArray||stream.pos<pos.ch)&&!stream.eol();)stream.start=stream.pos,style=readToken(mode,stream,context.state),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";null==output[prop]?output[prop]=lineClass[2]:new RegExp("(?:^|s)"+lineClass[2]+"(?:$|s)").test(output[prop])||(output[prop]+=" "+lineClass[2])}return type}function runMode(cm,text,mode,context,f,lineClasses,forceToEnd){var flattenSpans=mode.flattenSpans;null==flattenSpans&&(flattenSpans=cm.options.flattenSpans);var style,curStart=0,curStyle=null,stream=new StringStream(text,cm.options.tabSize,context),inner=cm.options.addModeClass&&[null];for(""==text&&extractLineClasses(callBlankLine(mode,context.state),lineClasses);!stream.eol();){if(stream.pos>cm.options.maxHighlightLength?(flattenSpans=!1,forceToEnd&&processLine(cm,text,context,stream.pos),stream.pos=text.length,style=null):style=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<stream.start;)f(curStart=Math.min(stream.start,curStart+5e3),curStyle);curStyle=style}stream.start=stream.pos}for(;curStart<stream.pos;){var pos=Math.min(stream.pos,curStart+5e3);f(pos,curStyle),curStart=pos}}function findStartLine(cm,n,precise){for(var minindent,minline,doc=cm.doc,lim=precise?-1:n-(cm.doc.mode.innerMode?1e3:100),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);(null==minline||minindent>indented)&&(minline=search-1,minindent=indented)}return minline}function retreatFrontier(doc,n){if(doc.modeFrontier=Math.min(doc.modeFrontier,n),!(doc.highlightFrontier<n-10)){for(var start=doc.first,line=n-1;line>start;line--){var saved=getLine(doc,line).stateAfter;if(saved&&(!(saved instanceof SavedContext)||line+saved.lookAhead<n)){start=line+1;break}}doc.highlightFrontier=Math.min(doc.highlightFrontier,start)}}function updateLine(line,text,markedSpans,estimateHeight){line.text=text,line.stateAfter&&(line.stateAfter=null),line.styles&&(line.styles=null),null!=line.order&&(line.order=null),detachMarkedSpans(line),attachMarkedSpans(line,markedSpans);var estHeight=estimateHeight?estimateHeight(line):1;estHeight!=line.height&&updateLineHeight(line,estHeight)}function cleanUpLine(line){line.parent=null,detachMarkedSpans(line)}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:(ie||webkit)&&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,title,css){if(text){var content,displayText=builder.splitSpaces?splitSpaces(text,builder.trailingSpace):text,special=builder.cm.state.specialChars,mustWrap=!1;if(special.test(text)){content=document.createDocumentFragment();for(var pos=0;;){special.lastIndex=pos;var m=special.exec(text),skipped=m?m.index-pos:text.length-pos;if(skipped){var txt=document.createTextNode(displayText.slice(pos,pos+skipped));ie&&ie_version<9?content.appendChild(elt("span",[txt])):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("\t"==m[0]){var tabSize=builder.cm.options.tabSize,tabWidth=tabSize-builder.col%tabSize;(txt$1=content.appendChild(elt("span",spaceStr(tabWidth),"cm-tab"))).setAttribute("role","presentation"),txt$1.setAttribute("cm-text","\t"),builder.col+=tabWidth}else"\r"==m[0]||"\n"==m[0]?((txt$1=content.appendChild(elt("span","\r"==m[0]?"␍":"␤","cm-invalidchar"))).setAttribute("cm-text",m[0]),builder.col+=1):((txt$1=builder.cm.options.specialCharPlaceholder(m[0])).setAttribute("cm-text",m[0]),ie&&ie_version<9?content.appendChild(elt("span",[txt$1])):content.appendChild(txt$1),builder.col+=1);builder.map.push(builder.pos,builder.pos+1,txt$1),builder.pos++}}else builder.col+=text.length,content=document.createTextNode(displayText),builder.map.push(builder.pos,builder.pos+text.length,content),ie&&ie_version<9&&(mustWrap=!0),builder.pos+=text.length;if(builder.trailingSpace=32==displayText.charCodeAt(text.length-1),style||startStyle||endStyle||mustWrap||css){var fullStyle=style||"";startStyle&&(fullStyle+=startStyle),endStyle&&(fullStyle+=endStyle);var token=elt("span",[content],fullStyle,css);return title&&(token.title=title),builder.content.appendChild(token)}builder.content.appendChild(content)}}function splitSpaces(text,trailingBefore){if(text.length>1&&!/ /.test(text))return text;for(var spaceBefore=trailingBefore,result="",i=0;i<text.length;i++){var ch=text.charAt(i);" "!=ch||!spaceBefore||i!=text.length-1&&32!=text.charCodeAt(i+1)||(ch=" "),result+=ch,spaceBefore=" "==ch}return result}function buildTokenBadBidi(inner,order){return function(builder,text,style,startStyle,endStyle,title,css){style=style?style+" cm-force-border":"cm-force-border";for(var start=builder.pos,end=start+text.length;;){for(var part=void 0,i=0;i<order.length&&!((part=order[i]).to>start&&part.from<=start);i++);if(part.to>=end)return inner(builder,text,style,startStyle,endStyle,title,css);inner(builder,text.slice(0,part.to-start),style,startStyle,null,title,css),startStyle=null,text=text.slice(part.to-start),start=part.to}}}function buildCollapsedSpan(builder,size,marker,ignoreWidget){var widget=!ignoreWidget&&marker.widgetNode;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,title,collapsed,len=allText.length,pos=0,i=1,text="",nextChange=0;;){if(nextChange==pos){spanStyle=spanEndStyle=spanStartStyle=title=css="",collapsed=null,nextChange=1/0;for(var foundBookmarks=[],endStyles=void 0,j=0;j<spans.length;++j){var sp=spans[j],m=sp.marker;"bookmark"==m.type&&sp.from==pos&&m.widgetNode?foundBookmarks.push(m):sp.from<=pos&&(null==sp.to||sp.to>pos||m.collapsed&&sp.to==pos&&sp.from==pos)?(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&&!title&&(title=m.title),m.collapsed&&(!collapsed||compareCollapsedMarkers(collapsed.marker,m)<0)&&(collapsed=sp)):sp.from>pos&&nextChange>sp.from&&(nextChange=sp.from)}if(endStyles)for(var j$1=0;j$1<endStyles.length;j$1+=2)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){if(buildCollapsedSpan(builder,(null==collapsed.to?len+1:collapsed.to)-pos,collapsed.marker,null==collapsed.from),null==collapsed.to)return;collapsed.to==pos&&(collapsed=!1)}}if(pos>=len)break;for(var upto=Math.min(len,nextChange);;){if(text){var end=pos+text.length;if(!collapsed){var tokenText=end>upto?text.slice(0,upto-pos):text;builder.addToken(builder,tokenText,style?style+spanStyle:spanStyle,spanStartStyle,pos+tokenText.length==nextChange?spanEndStyle:"",title,css)}if(end>=upto){text=text.slice(upto-pos),pos=upto;break}pos=end,spanStartStyle=""}text=allText.slice(at,at=styles[i++]),style=interpretTokenStyle(styles[i++],builder.cm.options)}}else 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))}function LineView(doc,line,lineN){this.line=line,this.rest=visualLineContinued(line),this.size=this.rest?lineNo(lst(this.rest))-lineN+1:1,this.node=this.text=null,this.hidden=lineIsHidden(doc,line)}function buildViewArray(cm,from,to){for(var nextPos,array=[],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}function pushOperation(op){operationGroup?operationGroup.ops.push(op):op.ownsGroup=operationGroup={ops:[op],delayedCallbacks:[]}}function fireCallbacksForOps(group){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)for(;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)try{fireCallbacksForOps(group)}finally{operationGroup=null,endCb(group)}}function signalLater(emitter,type){var arr=getHandlers(emitter,type);if(arr.length){var list,args=Array.prototype.slice.call(arguments,2);operationGroup?list=operationGroup.delayedCallbacks:orphanDelayedCallbacks?list=orphanDelayedCallbacks:(list=orphanDelayedCallbacks=[],setTimeout(fireOrphanDelayed,0));for(var i=0;i<arr.length;++i)!function(i){list.push(function(){return arr[i].apply(null,args)})}(i)}}function fireOrphanDelayed(){var delayed=orphanDelayedCallbacks;orphanDelayedCallbacks=null;for(var i=0;i<delayed.length;++i)delayed[i]()}function updateLineForChanges(cm,lineView,lineN,dims){for(var j=0;j<lineView.changes.length;j++){var type=lineView.changes[j];"text"==type?updateLineText(cm,lineView):"gutter"==type?updateLineGutter(cm,lineView,lineN,dims):"class"==type?updateLineClasses(cm,lineView):"widget"==type&&updateLineWidgets(cm,lineView,dims)}lineView.changes=null}function ensureLineWrapped(lineView){return lineView.node==lineView.text&&(lineView.node=elt("div",null,null,"position: relative"),lineView.text.parentNode&&lineView.text.parentNode.replaceChild(lineView.node,lineView.text),lineView.node.appendChild(lineView.text),ie&&ie_version<8&&(lineView.node.style.zIndex=2)),lineView.node}function updateLineBackground(cm,lineView){var cls=lineView.bgClass?lineView.bgClass+" "+(lineView.line.bgClass||""):lineView.line.bgClass;if(cls&&(cls+=" CodeMirror-linebackground"),lineView.background)cls?lineView.background.className=cls:(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)}}function getLineContent(cm,lineView){var ext=cm.display.externalMeasured;return ext&&ext.line==lineView.line?(cm.display.externalMeasured=null,lineView.measure=ext.measure,ext.built):buildLineContent(cm,lineView)}function updateLineText(cm,lineView){var cls=lineView.text.className,built=getLineContent(cm,lineView);lineView.text==lineView.node&&(lineView.node=built.pre),lineView.text.parentNode.replaceChild(built.pre,lineView.text),lineView.text=built.pre,built.bgClass!=lineView.bgClass||built.textClass!=lineView.textClass?(lineView.bgClass=built.bgClass,lineView.textClass=built.textClass,updateLineClasses(cm,lineView)):cls&&(lineView.text.className=cls)}function updateLineClasses(cm,lineView){updateLineBackground(cm,lineView),lineView.line.wrapClass?ensureLineWrapped(lineView).className=lineView.line.wrapClass: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),lineView.gutterBackground&&(lineView.node.removeChild(lineView.gutterBackground),lineView.gutterBackground=null),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),gutterWrap=lineView.gutter=elt("div",null,"CodeMirror-gutter-wrapper","left: "+(cm.options.fixedGutter?dims.fixedPos:-dims.gutterTotalWidth)+"px");if(cm.display.input.setUneditable(gutterWrap),wrap$1.insertBefore(gutterWrap,lineView.text),lineView.line.gutterClass&&(gutterWrap.className+=" "+lineView.line.gutterClass),!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"))),markers)for(var k=0;k<cm.options.gutters.length;++k){var id=cm.options.gutters[k],found=markers.hasOwnProperty(id)&&markers[id];found&&gutterWrap.appendChild(elt("div",[found],"CodeMirror-gutter-elt","left: "+dims.gutterLeft[id]+"px; width: "+dims.gutterWidth[id]+"px"))}}}function updateLineWidgets(cm,lineView,dims){lineView.alignable&&(lineView.alignable=null);for(var node=lineView.node.firstChild,next=void 0;node;node=next)next=node.nextSibling,"CodeMirror-linewidget"==node.className&&lineView.node.removeChild(node);insertLineWidgets(cm,lineView,dims)}function buildLineElement(cm,lineView,lineN,dims){var built=getLineContent(cm,lineView);return lineView.text=lineView.node=built.pre,built.bgClass&&(lineView.bgClass=built.bgClass),built.textClass&&(lineView.textClass=built.textClass),updateLineClasses(cm,lineView),updateLineGutter(cm,lineView,lineN,dims),insertLineWidgets(cm,lineView,dims),lineView.node}function insertLineWidgets(cm,lineView,dims){if(insertLineWidgetsFor(cm,lineView.line,lineView,dims,!0),lineView.rest)for(var i=0;i<lineView.rest.length;i++)insertLineWidgetsFor(cm,lineView.rest[i],lineView,dims,!1)}function insertLineWidgetsFor(cm,line,lineView,dims,allowAbove){if(line.widgets)for(var wrap=ensureLineWrapped(lineView),i=0,ws=line.widgets;i<ws.length;++i){var widget=ws[i],node=elt("div",[widget.node],"CodeMirror-linewidget");widget.handleMouseEvents||node.setAttribute("cm-ignore-events","true"),positionLineWidget(widget,node,lineView,dims),cm.display.input.setUneditable(node),allowAbove&&widget.above?wrap.insertBefore(node,lineView.gutter||lineView.text):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",widget.coverGutter||(width-=dims.gutterTotalWidth,node.style.paddingLeft=dims.gutterTotalWidth+"px"),node.style.width=width+"px"}widget.coverGutter&&(node.style.zIndex=5,node.style.position="relative",widget.noHScroll||(node.style.marginLeft=-dims.gutterTotalWidth+"px"))}function widgetHeight(widget){if(null!=widget.height)return widget.height;var cm=widget.doc.cm;if(!cm)return 0;if(!contains(document.body,widget.node)){var parentStyle="position: relative;";widget.coverGutter&&(parentStyle+="margin-left: -"+cm.display.gutters.offsetWidth+"px;"),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}function eventInWidget(display,e){for(var n=e_target(e);n!=display.wrapper;n=n.parentNode)if(!n||1==n.nodeType&&"true"==n.getAttribute("cm-ignore-events")||n.parentNode==display.sizer&&n!=display.mover)return!0}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")),style=window.getComputedStyle?window.getComputedStyle(e):e.currentStyle,data={left:parseInt(style.paddingLeft),right:parseInt(style.paddingRight)};return isNaN(data.left)||isNaN(data.right)||(display.cachedPaddingH=data),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}function ensureLineHeights(cm,lineView,rect){var wrapping=cm.options.lineWrapping,curWidth=wrapping&&displayWidth(cm);if(!lineView.measure.heights||wrapping&&lineView.measure.width!=curWidth){var heights=lineView.measure.heights=[];if(wrapping){lineView.measure.width=curWidth;for(var rects=lineView.text.firstChild.getClientRects(),i=0;i<rects.length-1;i++){var cur=rects[i],next=rects[i+1];Math.abs(cur.bottom-next.bottom)>2&&heights.push((cur.bottom+next.top)/2-rect.top)}}heights.push(rect.bottom-rect.top)}}function mapFromLineView(lineView,line,lineN){if(lineView.line==line)return{map:lineView.measure.map,cache:lineView.measure.cache};for(var i=0;i<lineView.rest.length;i++)if(lineView.rest[i]==line)return{map:lineView.measure.maps[i],cache:lineView.measure.caches[i]};for(var i$1=0;i$1<lineView.rest.length;i$1++)if(lineNo(lineView.rest[i$1])>lineN)return{map:lineView.measure.maps[i$1],cache:lineView.measure.caches[i$1],before:!0}}function updateExternalMeasurement(cm,line){var lineN=lineNo(line=visualLine(line)),view=cm.display.externalMeasured=new LineView(cm.doc,line,lineN);view.lineN=lineN;var built=view.built=buildLineContent(cm,view);return view.text=built.pre,removeChildrenAndAdd(cm.display.lineMeasure,built.pre),view}function measureChar(cm,line,ch,bias){return measureCharPrepared(cm,prepareMeasureForLine(cm,line),ch,bias)}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;return ext&&lineN>=ext.lineN&&lineN<ext.lineN+ext.size?ext:void 0}function prepareMeasureForLine(cm,line){var lineN=lineNo(line),view=findViewForLine(cm,lineN);view&&!view.text?view=null:view&&view.changes&&(updateLineForChanges(cm,view,lineN,getDimensions(cm)),cm.curOp.forceUpdate=!0),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:!1}}function measureCharPrepared(cm,prepared,ch,bias,varHeight){prepared.before&&(ch=-1);var found,key=ch+(bias||"");return prepared.cache.hasOwnProperty(key)?found=prepared.cache[key]:(prepared.rect||(prepared.rect=prepared.view.text.getBoundingClientRect()),prepared.hasHeights||(ensureLineHeights(cm,prepared.view,prepared.rect),prepared.hasHeights=!0),(found=measureCharInner(cm,prepared,ch,bias)).bogus||(prepared.cache[key]=found)),{left:found.left,right:found.right,top:varHeight?found.rtop:found.top,bottom:varHeight?found.rbottom:found.bottom}}function nodeAndOffsetInLineMap(map$$1,ch,bias){for(var node,start,end,collapse,mStart,mEnd,i=0;i<map$$1.length;i+=3)if(mStart=map$$1[i],mEnd=map$$1[i+1],ch<mStart?(start=0,end=1,collapse="left"):ch<mEnd?end=(start=ch-mStart)+1:(i==map$$1.length-3||ch==mEnd&&map$$1[i+3]>ch)&&(start=(end=mEnd-mStart)-1,ch>=mEnd&&(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<map$$1.length-3&&map$$1[i+3]==map$$1[i+4]&&!map$$1[i+5].insertLeft;)node=map$$1[(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("left"==bias)for(var i=0;i<rects.length&&(rect=rects[i]).left==rect.right;i++);else for(var i$1=rects.length-1;i$1>=0&&(rect=rects[i$1]).left==rect.right;i$1--);return rect}function measureCharInner(cm,prepared,ch,bias){var rect,place=nodeAndOffsetInLineMap(prepared.map,ch,bias),node=place.node,start=place.start,end=place.end,collapse=place.collapse;if(3==node.nodeType){for(var i$1=0;i$1<4;i$1++){for(;start&&isExtendingChar(prepared.line.text.charAt(place.coverStart+start));)--start;for(;place.coverStart+end<place.coverEnd&&isExtendingChar(prepared.line.text.charAt(place.coverStart+end));)++end;if((rect=ie&&ie_version<9&&0==start&&end==place.coverEnd-place.coverStart?node.parentNode.getBoundingClientRect():getUsefulRect(range(node,start,end).getClientRects(),bias)).left||rect.right||0==start)break;end=start,start-=1,collapse="right"}ie&&ie_version<11&&(rect=maybeUpdateRectForZooming(cm.display.measure,rect))}else{start>0&&(collapse=bias="right");var rects;rect=cm.options.lineWrapping&&(rects=node.getClientRects()).length>1?rects["right"==bias?rects.length-1:0]:node.getBoundingClientRect()}if(ie&&ie_version<9&&!start&&(!rect||!rect.left&&!rect.right)){var rSpan=node.parentNode.getClientRects()[0];rect=rSpan?{left:rSpan.left,right:rSpan.left+charWidth(cm.display),top:rSpan.top,bottom:rSpan.bottom}:nullRect}for(var rtop=rect.top-prepared.rect.top,rbot=rect.bottom-prepared.rect.top,mid=(rtop+rbot)/2,heights=prepared.view.measure.heights,i=0;i<heights.length-1&&!(mid<heights[i]);i++);var top=i?heights[i-1]:0,bot=heights[i],result={left:("right"==collapse?rect.right:rect.left)-prepared.rect.left,right:("left"==collapse?rect.left:rect.right)-prepared.rect.left,top:top,bottom:bot};return rect.left||rect.right||(result.bogus=!0),cm.options.singleCursorHeightPerLine||(result.rtop=rtop,result.rbottom=rbot),result}function maybeUpdateRectForZooming(measure,rect){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!hasBadZoomedRects(measure))return rect;var scaleX=screen.logicalXDPI/screen.deviceXDPI,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,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,cm.options.lineWrapping||(cm.display.maxLineChanged=!0),cm.display.lineNumChars=null}function pageScrollX(){return chrome&&android?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function pageScrollY(){return chrome&&android?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function widgetTopHeight(lineObj){var height=0;if(lineObj.widgets)for(var i=0;i<lineObj.widgets.length;++i)lineObj.widgets[i].above&&(height+=widgetHeight(lineObj.widgets[i]));return height}function intoCoordSystem(cm,lineObj,rect,context,includeWidgets){if(!includeWidgets){var height=widgetTopHeight(lineObj);rect.top+=height,rect.bottom+=height}if("line"==context)return rect;context||(context="local");var yOff=heightAtLine(lineObj);if("local"==context?yOff+=paddingTop(cm.display):yOff-=cm.display.viewOffset,"page"==context||"window"==context){var lOff=cm.display.lineSpace.getBoundingClientRect();yOff+=lOff.top+("window"==context?0:pageScrollY());var xOff=lOff.left+("window"==context?0:pageScrollX());rect.left+=xOff,rect.right+=xOff}return rect.top+=yOff,rect.bottom+=yOff,rect}function fromCoordSystem(cm,coords,context){if("div"==context)return coords;var left=coords.left,top=coords.top;if("page"==context)left-=pageScrollX(),top-=pageScrollY();else if("local"==context||!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){return lineObj||(lineObj=getLine(cm.doc,pos.line)),intoCoordSystem(cm,lineObj,measureChar(cm,lineObj,pos.ch,bias),context)}function cursorCoords(cm,pos,context,lineObj,preparedMeasure,varHeight){function get(ch,right){var m=measureCharPrepared(cm,preparedMeasure,ch,right?"right":"left",varHeight);return right?m.left=m.right:m.right=m.left,intoCoordSystem(cm,lineObj,m,context)}function getBidi(ch,partPos,invert){var right=1==order[partPos].level;return get(invert?ch-1:ch,right!=invert)}lineObj=lineObj||getLine(cm.doc,pos.line),preparedMeasure||(preparedMeasure=prepareMeasureForLine(cm,lineObj));var order=getOrder(lineObj,cm.doc.direction),ch=pos.ch,sticky=pos.sticky;if(ch>=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);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(lineN>last)return PosWithInfo(doc.first+doc.size-1,getLine(doc,last).text.length,null,!0,1);x<0&&(x=0);for(var lineObj=getLine(doc,lineN);;){var found=coordsCharInner(cm,lineObj,lineN,x,y),merged=collapsedSpanAtEnd(lineObj),mergedPos=merged&&merged.find(0,!0);if(!merged||!(found.ch>mergedPos.from.ch||found.ch==mergedPos.from.ch&&found.xRel>0))return found;lineN=lineNo(lineObj=mergedPos.to.line)}}function wrappedLineExtent(cm,lineObj,preparedMeasure,y){y-=widgetTopHeight(lineObj);var end=lineObj.text.length,begin=findFirst(function(ch){return measureCharPrepared(cm,preparedMeasure,ch-1).bottom<=y},end,0);return end=findFirst(function(ch){return measureCharPrepared(cm,preparedMeasure,ch).top>y},begin,end),{begin:begin,end: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?coordsBidiPartWrapped:coordsBidiPart)(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<boxAround.right-x,atStart=atLeft==ltr;ch=chAround+(atStart?0:1),sticky=atStart?"after":"before",baseX=atLeft?boxAround.left:boxAround.right}else{ltr||ch!=end&&ch!=begin||ch++,sticky=0==ch?"after":ch==lineObj.text.length?"before":measureCharPrepared(cm,preparedMeasure,ch-(ltr?1:0)).bottom+widgetHeight$$1<=y==ltr?"after":"before";var coords=cursorCoords(cm,Pos(lineNo$$1,ch,sticky),"line",lineObj,preparedMeasure);baseX=coords.left,outside=y<coords.top||y>=coords.bottom}return ch=skipExtendingChars(lineObj.text,ch,1),PosWithInfo(lineNo$$1,ch,sticky,outside,x-baseX)}function coordsBidiPart(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(index>0){var ltr=1!=part.level,start=cursorCoords(cm,Pos(lineNo$$1,ltr?part.from:part.to,ltr?"after":"before"),"line",lineObj,preparedMeasure);boxIsAfter(start,x,y,!0)&&start.top>y&&(part=order[index-1])}return part}function coordsBidiPartWrapped(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<order.length;i++){var p=order[i];if(!(p.from>=end||p.to<=begin)){var endX=measureCharPrepared(cm,preparedMeasure,1!=p.level?Math.min(end,p.to)-1:Math.max(begin,p.from)).right,dist=endX<x?x-endX+1e9:endX-x;(!part||closestDist>dist)&&(part=p,closestDist=dist)}}return part||(part=order[order.length-1]),part.from<begin&&(part={from:begin,to:part.to,level:part.level}),part.to>end&&(part={from:part.from,to:end,level:part.level}),part}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 height>3&&(display.cachedTextHeight=height),removeChildren(display.measure),height||1}function charWidth(display){if(null!=display.cachedCharWidth)return display.cachedCharWidth;var anchor=elt("span","xxxxxxxxxx"),pre=elt("pre",[anchor]);removeChildrenAndAdd(display.measure,pre);var rect=anchor.getBoundingClientRect(),width=(rect.right-rect.left)/10;return width>2&&(display.cachedCharWidth=width),width||10}function getDimensions(cm){for(var d=cm.display,left={},width={},gutterLeft=d.gutters.clientLeft,n=d.gutters.firstChild,i=0;n;n=n.nextSibling,++i)left[cm.options.gutters[i]]=n.offsetLeft+n.clientLeft+gutterLeft,width[cm.options.gutters[i]]=n.clientWidth;return{fixedPos:compensateForHScroll(d),gutterTotalWidth:d.gutters.offsetWidth,gutterLeft:left,gutterWidth:width,wrapperWidth:d.wrapper.clientWidth}}function compensateForHScroll(display){return display.scroller.getBoundingClientRect().left-display.sizer.getBoundingClientRect().left}function estimateHeight(cm){var th=textHeight(cm.display),wrapping=cm.options.lineWrapping,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++)line.widgets[i].height&&(widgetsHeight+=line.widgets[i].height);return wrapping?widgetsHeight+(Math.ceil(line.text.length/perLine)||1)*th:widgetsHeight+th}}function estimateLineHeights(cm){var doc=cm.doc,est=estimateHeight(cm);doc.iter(function(line){var estHeight=est(line);estHeight!=line.height&&updateLineHeight(line,estHeight)})}function posFromMouse(cm,e,liberal,forRect){var display=cm.display;if(!liberal&&"true"==e_target(e).getAttribute("cm-not-content"))return null;var x,y,space=display.lineSpace.getBoundingClientRect();try{x=e.clientX-space.left,y=e.clientY-space.top}catch(e){return null}var line,coords=coordsChar(cm,x,y);if(forRect&&1==coords.xRel&&(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}function findViewIndex(cm,n){if(n>=cm.display.viewTo)return null;if((n-=cm.display.viewFrom)<0)return null;for(var view=cm.display.view,i=0;i<view.length;i++)if((n-=view[i].size)<0)return i}function updateSelection(cm){cm.display.input.showSelection(cm.display.input.prepareSelection())}function prepareSelection(cm,primary){void 0===primary&&(primary=!0);for(var doc=cm.doc,result={},curFragment=result.cursors=document.createDocumentFragment(),selFragment=result.selection=document.createDocumentFragment(),i=0;i<doc.sel.ranges.length;i++)if(primary||i!=doc.sel.primIndex){var range$$1=doc.sel.ranges[i];if(!(range$$1.from().line>=cm.display.viewTo||range$$1.to().line<cm.display.viewFrom)){var collapsed=range$$1.empty();(collapsed||cm.options.showCursorWhenSelecting)&&drawSelectionCursor(cm,range$$1.head,curFragment),collapsed||drawSelectionRange(cm,range$$1,selFragment)}}return result}function drawSelectionCursor(cm,head,output){var pos=cursorCoords(cm,head,"div",null,null,!cm.options.singleCursorHeightPerLine),cursor=output.appendChild(elt("div"," ","CodeMirror-cursor"));if(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",pos.other){var otherCursor=output.appendChild(elt("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));otherCursor.style.display="",otherCursor.style.left=pos.other.left+"px",otherCursor.style.top=pos.other.top+"px",otherCursor.style.height=.85*(pos.other.bottom-pos.other.top)+"px"}}function cmpCoords(a,b){return a.top-b.top||a.left-b.left}function drawSelectionRange(cm,range$$1,output){function add(left,top,width,bottom){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: "+(null==width?rightSide-left:width)+"px;\n height: "+(bottom-top)+"px"))}function drawForLine(line,fromArg,toArg){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),prop="ltr"==dir==("after"==side)?"left":"right";return coords("after"==side?extent.begin:extent.end-(/\s/.test(lineObj.text.charAt(extent.end-1))?2:1),prop)[prop]}var start,end,lineObj=getLine(doc,line),lineLen=lineObj.text.length,order=getOrder(lineObj,doc.direction);return iterateBidiSections(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 openLeft=(docLTR?openStart:openEnd)&&first,openRight=(docLTR?openEnd:openStart)&&last,left=openLeft?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;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):(topLeft=docLTR?wrapX(from,dir,"before"):leftSide,topRight=!docLTR&&openStart&&first?rightSide:fromPos.right,botLeft=!docLTR&&openEnd&&last?leftSide:toPos.left,botRight=docLTR?wrapX(to,dir,"after"):rightSide),add(topLeft,fromPos.top,topRight-topLeft,fromPos.bottom),fromPos.bottom<toPos.top&&add(leftSide,fromPos.bottom,null,toPos.top),add(botLeft,toPos.top,botRight-botLeft,toPos.bottom)}(!start||cmpCoords(fromPos,start)<0)&&(start=fromPos),cmpCoords(toPos,start)<0&&(start=toPos),(!end||cmpCoords(fromPos,end)<0)&&(end=fromPos),cmpCoords(toPos,end)<0&&(end=toPos)}),{start:start,end:end}}var display=cm.display,doc=cm.doc,fragment=document.createDocumentFragment(),padding=paddingH(cm.display),leftSide=padding.left,rightSide=Math.max(display.sizerWidth,displayWidth(cm)-display.sizer.offsetLeft)-padding.right,docLTR="ltr"==doc.direction,sFrom=range$$1.from(),sTo=range$$1.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),singleVLine=visualLine(fromLine)==visualLine(toLine),leftEnd=drawForLine(sFrom.line,sFrom.ch,singleVLine?fromLine.text.length+1:null).end,rightStart=drawForLine(sTo.line,singleVLine?0:null,sTo.ch).start;singleVLine&&(leftEnd.top<rightStart.top-2?(add(leftEnd.right,leftEnd.top,null,leftEnd.bottom),add(leftSide,rightStart.top,rightStart.left,rightStart.bottom)):add(leftEnd.right,leftEnd.top,rightStart.left-leftEnd.right,leftEnd.bottom)),leftEnd.bottom<rightStart.top&&add(leftSide,leftEnd.bottom,null,rightStart.top)}output.appendChild(fragment)}function restartBlink(cm){if(cm.state.focused){var display=cm.display;clearInterval(display.blinker);var on=!0;display.cursorDiv.style.visibility="",cm.options.cursorBlinkRate>0?display.blinker=setInterval(function(){return display.cursorDiv.style.visibility=(on=!on)?"":"hidden"},cm.options.cursorBlinkRate):cm.options.cursorBlinkRate<0&&(display.cursorDiv.style.visibility="hidden")}}function ensureFocus(cm){cm.state.focused||(cm.display.input.focus(),onFocus(cm))}function delayBlurEvent(cm){cm.state.delayingBlurEvent=!0,setTimeout(function(){cm.state.delayingBlurEvent&&(cm.state.delayingBlurEvent=!1,onBlur(cm))},100)}function onFocus(cm,e){cm.state.delayingBlurEvent&&(cm.state.delayingBlurEvent=!1),"nocursor"!=cm.options.readOnly&&(cm.state.focused||(signal(cm,"focus",cm,e),cm.state.focused=!0,addClass(cm.display.wrapper,"CodeMirror-focused"),cm.curOp||cm.display.selForContextMenu==cm.doc.sel||(cm.display.input.reset(),webkit&&setTimeout(function(){return cm.display.input.reset(!0)},20)),cm.display.input.receivedFocus()),restartBlink(cm))}function onBlur(cm,e){cm.state.delayingBlurEvent||(cm.state.focused&&(signal(cm,"blur",cm,e),cm.state.focused=!1,rmClass(cm.display.wrapper,"CodeMirror-focused")),clearInterval(cm.display.blinker),setTimeout(function(){cm.state.focused||(cm.display.shift=!1)},150))}function updateHeightsInViewport(cm){for(var display=cm.display,prevBottom=display.lineDiv.offsetTop,i=0;i<display.view.length;i++){var cur=display.view[i],height=void 0;if(!cur.hidden){if(ie&&ie_version<8){var bot=cur.node.offsetTop+cur.node.offsetHeight;height=bot-prevBottom,prevBottom=bot}else{var box=cur.node.getBoundingClientRect();height=box.bottom-box.top}var diff=cur.line.height-height;if(height<2&&(height=textHeight(display)),(diff>.005||diff<-.005)&&(updateLineHeight(cur.line,height),updateWidgetHeight(cur.line),cur.rest))for(var j=0;j<cur.rest.length;j++)updateWidgetHeight(cur.rest[j])}}}function updateWidgetHeight(line){if(line.widgets)for(var i=0;i<line.widgets.length;++i){var w=line.widgets[i],parent=w.node.parentNode;parent&&(w.height=parent.offsetHeight)}}function visibleLines(display,doc,viewport){var top=viewport&&null!=viewport.top?Math.max(0,viewport.top):display.scroller.scrollTop;top=Math.floor(top-paddingTop(display));var bottom=viewport&&null!=viewport.bottom?viewport.bottom:top+display.wrapper.clientHeight,from=lineAtHeight(doc,top),to=lineAtHeight(doc,bottom);if(viewport&&viewport.ensure){var ensureFrom=viewport.ensure.from.line,ensureTo=viewport.ensure.to.line;ensureFrom<from?(from=ensureFrom,to=lineAtHeight(doc,heightAtLine(getLine(doc,ensureFrom))+display.wrapper.clientHeight)):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)}}function alignHorizontally(cm){var display=cm.display,view=display.view;if(display.alignWidgets||display.gutters.firstChild&&cm.options.fixedGutter){for(var comp=compensateForHScroll(display)-display.scroller.scrollLeft+cm.doc.scrollLeft,gutterW=display.gutters.offsetWidth,left=comp+"px",i=0;i<view.length;i++)if(!view[i].hidden){cm.options.fixedGutter&&(view[i].gutter&&(view[i].gutter.style.left=left),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}cm.options.fixedGutter&&(display.gutters.style.left=comp+gutterW+"px")}}function maybeUpdateLineNumberWidth(cm){if(!cm.options.lineNumbers)return!1;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")),innerW=test.firstChild.offsetWidth,padding=test.offsetWidth-innerW;return 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),!0}return!1}function maybeScrollWindow(cm,rect){if(!signalDOMEvent(cm,"scrollCursorIntoView")){var display=cm.display,box=display.sizer.getBoundingClientRect(),doScroll=null;if(rect.top+box.top<0?doScroll=!0:rect.bottom+box.top>(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)}}}function scrollPosIntoView(cm,pos,end,margin){null==margin&&(margin=0);var rect;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),Math.abs(cm.doc.scrollTop-startTop)>1&&(changed=!0)),null!=scrollPos.scrollLeft&&(setScrollLeft(cm,scrollPos.scrollLeft),Math.abs(cm.doc.scrollLeft-startLeft)>1&&(changed=!0)),!changed)break}return rect}function scrollIntoView(cm,rect){var scrollPos=calculateScrollPos(cm,rect);null!=scrollPos.scrollTop&&updateScrollTop(cm,scrollPos.scrollTop),null!=scrollPos.scrollLeft&&setScrollLeft(cm,scrollPos.scrollLeft)}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.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);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.left<screenleft?result.scrollLeft=Math.max(0,rect.left-(tooWide?0:10)):rect.right>screenw+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 scrollToRange(cm,range$$1){resolveScrollToPos(cm),cm.curOp.scrollToPos=range$$1}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 updateScrollbars(cm,measure){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++)startWidth!=cm.display.barWidth&&cm.options.lineWrapping&&updateHeightsInViewport(cm),updateScrollbarsInner(cm,measureForScrollbars(cm)),startWidth=cm.display.barWidth,startHeight=cm.display.barHeight}function updateScrollbarsInner(cm,measure){var d=cm.display,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",sizes.right&&sizes.bottom?(d.scrollbarFiller.style.display="block",d.scrollbarFiller.style.height=sizes.bottom+"px",d.scrollbarFiller.style.width=sizes.right+"px"):d.scrollbarFiller.style.display="",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"):d.gutterFiller.style.display=""}function initScrollbars(cm){cm.display.scrollbars&&(cm.display.scrollbars.clear(),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),on(node,"mousedown",function(){cm.state.focused&&setTimeout(function(){return cm.display.input.focus()},0)}),node.setAttribute("cm-not-content","true")},function(pos,axis){"horizontal"==axis?setScrollLeft(cm,pos):updateScrollTop(cm,pos)},cm),cm.display.scrollbars.addClass&&addClass(cm.display.wrapper,cm.display.scrollbars.addClass)}function startOperation(cm){cm.curOp={cm:cm,viewChanged:!1,startHeight:cm.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++nextOpId},pushOperation(cm.curOp)}function endOperation(cm){finishOperation(cm.curOp,function(group){for(var i=0;i<group.ops.length;i++)group.ops[i].cm.curOp=null;endOperations(group)})}function endOperations(group){for(var ops=group.ops,i=0;i<ops.length;i++)endOperation_R1(ops[i]);for(var i$1=0;i$1<ops.length;i$1++)endOperation_W1(ops[i$1]);for(var i$2=0;i$2<ops.length;i$2++)endOperation_R2(ops[i$2]);for(var i$3=0;i$3<ops.length;i$3++)endOperation_W2(ops[i$3]);for(var i$4=0;i$4<ops.length;i$4++)endOperation_finish(ops[i$4])}function endOperation_R1(op){var cm=op.cm,display=cm.display;maybeClipScrollbars(cm),op.updateMaxLine&&findMaxLine(cm),op.mustUpdate=op.viewChanged||op.forceUpdate||null!=op.scrollTop||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;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<cm.doc.scrollLeft&&setScrollLeft(cm,Math.min(cm.display.scroller.scrollLeft,op.maxScrollLeft),!0),cm.display.maxLineChanged=!1);var takeFocus=op.focus&&op.focus==activeElt();op.preparedSelection&&cm.display.input.showSelection(op.preparedSelection,takeFocus),(op.updatedDisplay||op.startHeight!=cm.doc.height)&&updateScrollbars(cm,op.barMeasure),op.updatedDisplay&&setDocumentHeight(cm,op.barMeasure),op.selectionChanged&&restartBlink(cm),cm.state.focused&&op.updateInput&&cm.display.input.reset(op.typing),takeFocus&&ensureFocus(op.cm)}function endOperation_finish(op){var cm=op.cm,display=cm.display,doc=cm.doc;op.updatedDisplay&&postUpdateDisplay(cm,op.update),null==display.wheelStartX||null==op.scrollTop&&null==op.scrollLeft&&!op.scrollToPos||(display.wheelStartX=display.wheelStartY=null),null!=op.scrollTop&&setScrollTop(cm,op.scrollTop,op.forceScroll),null!=op.scrollLeft&&setScrollLeft(cm,op.scrollLeft,!0,!0),op.scrollToPos&&maybeScrollWindow(cm,scrollPosIntoView(cm,clipPos(doc,op.scrollToPos.from),clipPos(doc,op.scrollToPos.to),op.scrollToPos.margin));var hidden=op.maybeHiddenMarkers,unhidden=op.maybeUnhiddenMarkers;if(hidden)for(var i=0;i<hidden.length;++i)hidden[i].lines.length||signal(hidden[i],"hide");if(unhidden)for(var i$1=0;i$1<unhidden.length;++i$1)unhidden[i$1].lines.length&&signal(unhidden[i$1],"unhide");display.wrapper.offsetHeight&&(doc.scrollTop=cm.display.scroller.scrollTop),op.changeObjs&&signal(cm,"changes",cm,op.changeObjs),op.update&&op.update.finish()}function runInOp(cm,f){if(cm.curOp)return f();startOperation(cm);try{return f()}finally{endOperation(cm)}}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)}}}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)}}}function regChange(cm,from,to,lendiff){null==from&&(from=cm.doc.first),null==to&&(to=cm.doc.first+cm.doc.size),lendiff||(lendiff=0);var display=cm.display;if(lendiff&&to<display.viewTo&&(null==display.updateLineNumbers||display.updateLineNumbers>from)&&(display.updateLineNumbers=from),cm.curOp.viewChanged=!0,from>=display.viewTo)sawCollapsedSpans&&visualLineNo(cm.doc,from)<display.viewTo&&resetView(cm);else if(to<=display.viewFrom)sawCollapsedSpans&&visualLineEndNo(cm.doc,to+lendiff)>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?ext.lineN+=lendiff:from<ext.lineN+ext.size&&(display.externalMeasured=null))}function regLineChange(cm,line,type){cm.curOp.viewChanged=!0;var display=cm.display,ext=cm.display.externalMeasured;if(ext&&line>=ext.lineN&&line<ext.lineN+ext.size&&(display.externalMeasured=null),!(line<display.viewFrom||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<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}for(;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}}function adjustView(cm,from,to){var display=cm.display;0==display.view.length||from>=display.viewTo||to<=display.viewFrom?(display.view=buildViewArray(cm,from,to),display.viewFrom=from):(display.viewFrom>from?display.view=buildViewArray(cm,from,display.viewFrom).concat(display.view):display.viewFrom<from&&(display.view=display.view.slice(findViewIndex(cm,from))),display.viewFrom=from,display.viewTo<to?display.view=display.view.concat(buildViewArray(cm,display.viewTo,to)):display.viewTo>to&&(display.view=display.view.slice(0,findViewIndex(cm,to)))),display.viewTo=to}function countDirtyView(cm){for(var view=cm.display.view,dirty=0,i=0;i<view.length;i++){var lineView=view[i];lineView.hidden||lineView.node&&!lineView.changes||++dirty}return dirty}function startWorker(cm,time){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)){var end=+new Date+cm.options.workTime,context=getContextBefore(cm,doc.highlightFrontier),changedLines=[];doc.iter(context.line,Math.min(doc.first+doc.size,cm.display.viewTo+500),function(line){if(context.line>=cm.display.viewFrom){var oldStyles=line.styles,resetState=line.text.length>cm.options.maxHighlightLength?copyState(doc.mode,context.state):null,highlighted=highlightLine(cm,line,context,!0);resetState&&(context.state=resetState),line.styles=highlighted.styles;var oldCls=line.styleClasses,newCls=highlighted.classes;newCls?line.styleClasses=newCls:oldCls&&(line.styleClasses=null);for(var ischange=!oldStyles||oldStyles.length!=line.styles.length||oldCls!=newCls&&(!oldCls||!newCls||oldCls.bgClass!=newCls.bgClass||oldCls.textClass!=newCls.textClass),i=0;!ischange&&i<oldStyles.length;++i)ischange=oldStyles[i]!=line.styles[i];ischange&&changedLines.push(context.line),line.stateAfter=context.save(),context.nextLine()}else 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)return startWorker(cm,cm.options.workDelay),!0}),doc.highlightFrontier=context.line,doc.modeFrontier=Math.max(doc.modeFrontier,context.line),changedLines.length&&runInOp(cm,function(){for(var i=0;i<changedLines.length;i++)regLineChange(cm,changedLines[i],"text")})}}function maybeClipScrollbars(cm){var display=cm.display;!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=!0)}function selectionSnapshot(cm){if(cm.hasFocus())return null;var active=activeElt();if(!active||!contains(cm.display.lineDiv,active))return null;var result={activeElt:active};if(window.getSelection){var sel=window.getSelection();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()&&(snapshot.activeElt.focus(),snapshot.anchorNode&&contains(document.body,snapshot.anchorNode)&&contains(document.body,snapshot.focusNode))){var sel=window.getSelection(),range$$1=document.createRange();range$$1.setEnd(snapshot.anchorNode,snapshot.anchorOffset),range$$1.collapse(!1),sel.removeAllRanges(),sel.addRange(range$$1),sel.extend(snapshot.focusNode,snapshot.focusOffset)}}function updateDisplayIfNeeded(cm,update){var display=cm.display,doc=cm.doc;if(update.editorIsHidden)return resetView(cm),!1;if(!update.force&&update.visible.from>=display.viewFrom&&update.visible.to<=display.viewTo&&(null==display.updateLineNumbers||display.updateLineNumbers>=display.viewTo)&&display.renderedView==display.view&&0==countDirtyView(cm))return!1;maybeUpdateLineNumberWidth(cm)&&(resetView(cm),update.dims=getDimensions(cm));var end=doc.first+doc.size,from=Math.max(update.visible.from-cm.options.viewportMargin,doc.first),to=Math.min(end,update.visible.to+cm.options.viewportMargin);display.viewFrom<from&&from-display.viewFrom<20&&(from=Math.max(doc.first,display.viewFrom)),display.viewTo>to&&display.viewTo-to<20&&(to=Math.min(end,display.viewTo)),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)),cm.display.mover.style.top=display.viewOffset+"px";var toUpdate=countDirtyView(cm);if(!different&&0==toUpdate&&!update.force&&display.renderedView==display.view&&(null==display.updateLineNumbers||display.updateLineNumbers>=display.viewTo))return!1;var selSnapshot=selectionSnapshot(cm);return toUpdate>4&&(display.lineDiv.style.display="none"),patchDisplay(cm,display.updateLineNumbers,update.dims),toUpdate>4&&(display.lineDiv.style.display=""),display.renderedView=display.view,restoreSelection(selSnapshot),removeChildren(display.cursorDiv),removeChildren(display.selectionDiv),display.gutters.style.height=display.sizer.style.minHeight=0,different&&(display.lastWrapHeight=update.wrapperHeight,display.lastWrapWidth=update.wrapperWidth,startWorker(cm,400)),display.updateLineNumbers=null,!0}function postUpdateDisplay(cm,update){for(var viewport=update.viewport,first=!0;(first&&cm.options.lineWrapping&&update.oldDisplayWidth!=displayWidth(cm)||(viewport&&null!=viewport.top&&(viewport={top:Math.min(cm.doc.height+paddingVert(cm.display)-displayHeight(cm),viewport.top)}),update.visible=visibleLines(cm.display,cm.doc,viewport),!(update.visible.from>=cm.display.viewFrom&&update.visible.to<=cm.display.viewTo)))&&updateDisplayIfNeeded(cm,update);first=!1){updateHeightsInViewport(cm);var barMeasure=measureForScrollbars(cm);updateSelection(cm),updateScrollbars(cm,barMeasure),setDocumentHeight(cm,barMeasure),update.force=!1}update.signal(cm,"update",cm),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()}}function patchDisplay(cm,updateNumbersFrom,dims){function rm(node){var next=node.nextSibling;return webkit&&mac&&cm.display.currentWheelTarget==node?node.style.display="none":node.parentNode.removeChild(node),next}for(var display=cm.display,lineNumbers=cm.options.lineNumbers,container=display.lineDiv,cur=container.firstChild,view=display.view,lineN=display.viewFrom,i=0;i<view.length;i++){var lineView=view[i];if(lineView.hidden);else if(lineView.node&&lineView.node.parentNode==container){for(;cur!=lineView.node;)cur=rm(cur);var updateNumber=lineNumbers&&null!=updateNumbersFrom&&updateNumbersFrom<=lineN&&lineView.lineNumber;lineView.changes&&(indexOf(lineView.changes,"gutter")>-1&&(updateNumber=!1),updateLineForChanges(cm,lineView,lineN,dims)),updateNumber&&(removeChildren(lineView.lineNumber),lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options,lineN)))),cur=lineView.node.nextSibling}else{var node=buildLineElement(cm,lineView,lineN,dims);container.insertBefore(node,cur)}lineN+=lineView.size}for(;cur;)cur=rm(cur)}function updateGutterSpace(cm){var width=cm.display.gutters.offsetWidth;cm.display.sizer.style.marginLeft=width+"px"}function setDocumentHeight(cm,measure){cm.display.sizer.style.minHeight=measure.docHeight+"px",cm.display.heightForcer.style.top=measure.docHeight+"px",cm.display.gutters.style.height=measure.docHeight+cm.display.barHeight+scrollGap(cm)+"px"}function updateGutters(cm){var gutters=cm.display.gutters,specs=cm.options.gutters;removeChildren(gutters);for(var i=0;i<specs.length;++i){var gutterClass=specs[i],gElt=gutters.appendChild(elt("div",null,"CodeMirror-gutter "+gutterClass));"CodeMirror-linenumbers"==gutterClass&&(cm.display.lineGutter=gElt,gElt.style.width=(cm.display.lineNumWidth||1)+"px")}gutters.style.display=i?"":"none",updateGutterSpace(cm)}function setGuttersForLineNumbers(options){var found=indexOf(options.gutters,"CodeMirror-linenumbers");-1==found&&options.lineNumbers?options.gutters=options.gutters.concat(["CodeMirror-linenumbers"]):found>-1&&!options.lineNumbers&&(options.gutters=options.gutters.slice(0),options.gutters.splice(found,1))}function wheelEventDelta(e){var dx=e.wheelDeltaX,dy=e.wheelDeltaY;return null==dx&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(dx=e.detail),null==dy&&e.detail&&e.axis==e.VERTICAL_AXIS?dy=e.detail:null==dy&&(dy=e.wheelDelta),{x:dx,y:dy}}function wheelEventPixels(e){var delta=wheelEventDelta(e);return delta.x*=wheelPixelsPerUnit,delta.y*=wheelPixelsPerUnit,delta}function onScrollWheel(cm,e){var delta=wheelEventDelta(e),dx=delta.x,dy=delta.y,display=cm.display,scroll=display.scroller,canScrollX=scroll.scrollWidth>scroll.clientWidth,canScrollY=scroll.scrollHeight>scroll.clientHeight;if(dx&&canScrollX||dy&&canScrollY){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}if(dx&&!gecko&&!presto&&null!=wheelPixelsPerUnit)return dy&&canScrollY&&updateScrollTop(cm,Math.max(0,scroll.scrollTop+dy*wheelPixelsPerUnit)),setScrollLeft(cm,Math.max(0,scroll.scrollLeft+dx*wheelPixelsPerUnit)),(!dy||dy&&canScrollY)&&e_preventDefault(e),void(display.wheelStartX=null);if(dy&&null!=wheelPixelsPerUnit){var pixels=dy*wheelPixelsPerUnit,top=cm.doc.scrollTop,bot=top+display.wrapper.clientHeight;pixels<0?top=Math.max(0,top+pixels-50):bot=Math.min(cm.doc.height,bot+pixels+50),updateDisplaySimple(cm,{top:top,bottom:bot})}wheelSamples<20&&(null==display.wheelStartX?(display.wheelStartX=scroll.scrollLeft,display.wheelStartY=scroll.scrollTop,display.wheelDX=dx,display.wheelDY=dy,setTimeout(function(){if(null!=display.wheelStartX){var movedX=scroll.scrollLeft-display.wheelStartX,movedY=scroll.scrollTop-display.wheelStartY,sample=movedY&&display.wheelDY&&movedY/display.wheelDY||movedX&&display.wheelDX&&movedX/display.wheelDX;display.wheelStartX=display.wheelStartY=null,sample&&(wheelPixelsPerUnit=(wheelPixelsPerUnit*wheelSamples+sample)/(wheelSamples+1),++wheelSamples)}},200)):(display.wheelDX+=dx,display.wheelDY+=dy))}}function normalizeSelection(ranges,primIndex){var prim=ranges[primIndex];ranges.sort(function(a,b){return cmp(a.from(),b.from())}),primIndex=indexOf(ranges,prim);for(var i=1;i<ranges.length;i++){var cur=ranges[i],prev=ranges[i-1];if(cmp(prev.to(),cur.from())>=0){var from=minPos(prev.from(),cur.from()),to=maxPos(prev.to(),cur.to()),inv=prev.empty()?cur.from()==cur.head:prev.from()==prev.head;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)}function changeEnd(change){return change.text?Pos(change.from.line+change.text.length-1,lst(change.text).length+(1==change.text.length?change.from.ch:0)):change.to}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;return pos.line==change.to.line&&(ch+=changeEnd(change).ch-change.to.ch),Pos(line,ch)}function computeSelAfterChange(doc,change){for(var out=[],i=0;i<doc.sel.ranges.length;i++){var range=doc.sel.ranges[i];out.push(new Range(adjustForChange(range.anchor,change),adjustForChange(range.head,change)))}return normalizeSelection(out,doc.sel.primIndex)}function offsetPos(pos,old,nw){return pos.line==old.line?Pos(nw.line,pos.ch-old.ch+nw.ch):Pos(nw.line+(pos.line-old.line),pos.ch)}function computeReplacedSel(doc,changes,hint){for(var out=[],oldPrev=Pos(doc.first,0),newPrev=oldPrev,i=0;i<changes.length;i++){var change=changes[i],from=offsetPos(change.from,oldPrev,newPrev),to=offsetPos(changeEnd(change),oldPrev,newPrev);if(oldPrev=change.to,newPrev=to,"around"==hint){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)}function loadMode(cm){cm.doc.mode=getMode(cm.options,cm.doc.modeOption),resetModeState(cm)}function resetModeState(cm){cm.doc.iter(function(line){line.stateAfter&&(line.stateAfter=null),line.styles&&(line.styles=null)}),cm.doc.modeFrontier=cm.doc.highlightFrontier=cm.doc.first,startWorker(cm,100),cm.state.modeGen++,cm.curOp&&regChange(cm)}function isWholeLineUpdate(doc,change){return 0==change.from.ch&&0==change.to.ch&&""==lst(change.text)&&(!doc.cm||doc.cm.options.wholeLineUpdateBefore)}function updateDoc(doc,change,markedSpans,estimateHeight$$1){function spansFor(n){return markedSpans?markedSpans[n]:null}function update(line,text,spans){updateLine(line,text,spans,estimateHeight$$1),signalLater(line,"change",line,change)}function linesFor(start,end){for(var result=[],i=start;i<end;++i)result.push(new Line(text[i],spansFor(i),estimateHeight$$1));return result}var from=change.from,to=change.to,text=change.text,firstLine=getLine(doc,from.line),lastLine=getLine(doc,to.line),lastText=lst(text),lastSpans=spansFor(text.length-1),nlines=to.line-from.line;if(change.full)doc.insert(0,linesFor(0,text.length)),doc.remove(text.length,doc.size-text.length);else if(isWholeLineUpdate(doc,change)){var added=linesFor(0,text.length-1);update(lastLine,lastLine.text,lastSpans),nlines&&doc.remove(from.line,nlines),added.length&&doc.insert(from.line,added)}else if(firstLine==lastLine)if(1==text.length)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$$1)),update(firstLine,firstLine.text.slice(0,from.ch)+text[0],spansFor(0)),doc.insert(from.line+1,added$1)}else if(1==text.length)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);nlines>1&&doc.remove(from.line+1,nlines-1),doc.insert(from.line+1,added$2)}signalLater(doc,"change",doc,change)}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){var shared=sharedHist&&rel.sharedHist;sharedHistOnly&&!shared||(f(rel.doc,shared),propagate(rel.doc,doc,shared))}}}propagate(doc,null,!0)}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.lineWrapping||findMaxLine(cm),cm.options.mode=doc.modeOption,regChange(cm)}function setDirectionClass(cm){("rtl"==cm.doc.direction?addClass:rmClass)(cm.display.lineDiv,"CodeMirror-rtl")}function directionChanged(cm){runInOp(cm,function(){setDirectionClass(cm),regChange(cm)})}function History(startGen){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=startGen||1}function historyChangeFromChange(doc,change){var histChange={from:copyPos(change.from),to:changeEnd(change),text:getBetween(doc,change.from,change.to)};return 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)},!0),histChange}function clearSelectionEvents(array){for(;array.length&&lst(array).ranges;)array.pop()}function lastChangeEvent(hist,force){return force?(clearSelectionEvents(hist.done),lst(hist.done)):hist.done.length&&!lst(hist.done).ranges?lst(hist.done):hist.done.length>1&&!hist.done[hist.done.length-2].ranges?(hist.done.pop(),lst(hist.done)):void 0}function addChangeToHistory(doc,change,selAfter,opId){var hist=doc.history;hist.undone.length=0;var cur,last,time=+new Date;if((hist.lastOp==opId||hist.lastOrigin==change.origin&&change.origin&&("+"==change.origin.charAt(0)&&doc.cm&&hist.lastModTime>time-doc.cm.options.historyEventDelay||"*"==change.origin.charAt(0)))&&(cur=lastChangeEvent(hist,hist.lastOp==opId)))last=lst(cur.changes),0==cmp(change.from,change.to)&&0==cmp(change.from,last.to)?last.to=changeEnd(change):cur.changes.push(historyChangeFromChange(doc,change));else{var before=lst(hist.done);for(before&&before.ranges||pushSelectionToHistory(doc.sel,hist.done),cur={changes:[historyChangeFromChange(doc,change)],generation:hist.generation},hist.done.push(cur);hist.done.length>hist.undoDepth;)hist.done.shift(),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,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)}function addSelectionToHistory(doc,sel,opId,options){var hist=doc.history,origin=options&&options.origin;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:pushSelectionToHistory(sel,hist.done),hist.lastSelTime=+new Date,hist.lastSelOrigin=origin,hist.lastSelOp=opId,options&&!1!==options.clearRedo&&clearSelectionEvents(hist.undone)}function pushSelectionToHistory(sel,dest){var top=lst(dest);top&&top.ranges&&top.equals(sel)||dest.push(sel)}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){line.markedSpans&&((existing||(existing=change["spans_"+doc.id]={}))[n]=line.markedSpans),++n})}function removeClearedSpans(spans){if(!spans)return null;for(var out,i=0;i<spans.length;++i)spans[i].marker.explicitlyCleared?out||(out=spans.slice(0,i)):out&&out.push(spans[i]);return out?out.length?out:null:spans}function getOldSpans(doc,change){var found=change["spans_"+doc.id];if(!found)return null;for(var nw=[],i=0;i<change.text.length;++i)nw.push(removeClearedSpans(found[i]));return nw}function mergeOldSpans(doc,change){var old=getOldSpans(doc,change),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){for(var span=stretchCur[j],k=0;k<oldCur.length;++k)if(oldCur[k].marker==span.marker)continue spans;oldCur.push(span)}else stretchCur&&(old[i]=stretchCur)}return old}function copyHistoryArray(events,newGroup,instantiateSel){for(var copy=[],i=0;i<events.length;++i){var event=events[i];if(event.ranges)copy.push(instantiateSel?Selection.prototype.deepCopy.call(event):event);else{var changes=event.changes,newChanges=[];copy.push({changes:newChanges});for(var j=0;j<changes.length;++j){var change=changes[j],m=void 0;if(newChanges.push({from:change.from,to:change.to,text:change.text}),newGroup)for(var prop in change)(m=prop.match(/^spans_(\d+)$/))&&indexOf(newGroup,Number(m[1]))>-1&&(lst(newChanges)[prop]=change[prop],delete change[prop])}}}return copy}function extendRange(range,head,other,extend){if(extend){var anchor=range.anchor;if(other){var posBefore=cmp(head,anchor)<0;posBefore!=cmp(other,anchor)<0?(anchor=head,head=other):posBefore!=cmp(head,other)<0&&(head=other)}return new Range(anchor,head)}return new Range(other||head,head)}function extendSelection(doc,head,other,options,extend){null==extend&&(extend=doc.cm&&(doc.cm.display.shift||doc.extend)),setSelection(doc,new Selection([extendRange(doc.sel.primary(),head,other,extend)],0),options)}function extendSelections(doc,heads,options){for(var out=[],extend=doc.cm&&(doc.cm.display.shift||doc.extend),i=0;i<doc.sel.ranges.length;i++)out[i]=extendRange(doc.sel.ranges[i],heads[i],null,extend);setSelection(doc,normalizeSelection(out,doc.sel.primIndex),options)}function replaceOneSelection(doc,i,range,options){var ranges=doc.sel.ranges.slice(0);ranges[i]=range,setSelection(doc,normalizeSelection(ranges,doc.sel.primIndex),options)}function setSimpleSelection(doc,anchor,head,options){setSelection(doc,simpleSelection(anchor,head),options)}function filterSelectionChange(doc,sel,options){var obj={ranges:sel.ranges,update:function(ranges){var this$1=this;this.ranges=[];for(var i=0;i<ranges.length;i++)this$1.ranges[i]=new Range(clipPos(doc,ranges[i].anchor),clipPos(doc,ranges[i].head))},origin:options&&options.origin};return signal(doc,"beforeSelectionChange",doc,obj),doc.cm&&signal(doc.cm,"beforeSelectionChange",doc.cm,obj),obj.ranges!=sel.ranges?normalizeSelection(obj.ranges,obj.ranges.length-1):sel}function setSelectionReplaceHistory(doc,sel,options){var done=doc.history.done,last=lst(done);last&&last.ranges?(done[done.length-1]=sel,setSelectionNoUndo(doc,sel,options)):setSelection(doc,sel,options)}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){(hasHandler(doc,"beforeSelectionChange")||doc.cm&&hasHandler(doc.cm,"beforeSelectionChange"))&&(sel=filterSelectionChange(doc,sel,options)),setSelectionInner(doc,skipAtomicInSelection(doc,sel,options&&options.bias||(cmp(sel.primary().head,doc.sel.primary().head)<0?-1:1),!0)),options&&!1===options.scroll||!doc.cm||ensureCursorVisible(doc.cm)}function setSelectionInner(doc,sel){sel.equals(doc.sel)||(doc.sel=sel,doc.cm&&(doc.cm.curOp.updateInput=doc.cm.curOp.selectionChanged=!0,signalCursorActivity(doc.cm)),signalLater(doc,"cursorActivity",doc))}function reCheckSelection(doc){setSelectionInner(doc,skipAtomicInSelection(doc,doc.sel,null,!1))}function skipAtomicInSelection(doc,sel,bias,mayClear){for(var out,i=0;i<sel.ranges.length;i++){var range=sel.ranges[i],old=sel.ranges.length==doc.sel.ranges.length&&doc.sel.ranges[i],newAnchor=skipAtomic(doc,range.anchor,old&&old.anchor,bias,mayClear),newHead=skipAtomic(doc,range.head,old&&old.head,bias,mayClear);(out||newAnchor!=range.anchor||newHead!=range.head)&&(out||(out=sel.ranges.slice(0,i)),out[i]=new Range(newAnchor,newHead))}return out?normalizeSelection(out,sel.primIndex):sel}function skipAtomicInner(doc,pos,oldPos,dir,mayClear){var line=getLine(doc,pos.line);if(line.markedSpans)for(var i=0;i<line.markedSpans.length;++i){var sp=line.markedSpans[i],m=sp.marker;if((null==sp.from||(m.inclusiveLeft?sp.from<=pos.ch:sp.from<pos.ch))&&(null==sp.to||(m.inclusiveRight?sp.to>=pos.ch:sp.to>pos.ch))){if(mayClear&&(signal(m,"beforeCursorEnter"),m.explicitlyCleared)){if(line.markedSpans){--i;continue}break}if(!m.atomic)continue;if(oldPos){var near=m.find(dir<0?1:-1),diff=void 0;if((dir<0?m.inclusiveRight:m.inclusiveLeft)&&(near=movePos(doc,near,-dir,near&&near.line==pos.line?line:null)),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);return(dir<0?m.inclusiveLeft:m.inclusiveRight)&&(far=movePos(doc,far,dir,far.line==pos.line?line:null)),far?skipAtomicInner(doc,far,pos,dir,mayClear):null}}return pos}function skipAtomic(doc,pos,oldPos,bias,mayClear){var dir=bias||1,found=skipAtomicInner(doc,pos,oldPos,dir,mayClear)||!mayClear&&skipAtomicInner(doc,pos,oldPos,dir,!0)||skipAtomicInner(doc,pos,oldPos,-dir,mayClear)||!mayClear&&skipAtomicInner(doc,pos,oldPos,-dir,!0);return found||(doc.cantEdit=!0,Pos(doc.first,0))}function movePos(doc,pos,dir,line){return dir<0&&0==pos.ch?pos.line>doc.first?clipPos(doc,Pos(pos.line-1)):null:dir>0&&pos.ch==(line||getLine(doc,pos.line)).text.length?pos.line<doc.first+doc.size-1?Pos(pos.line+1,0):null:new Pos(pos.line,pos.ch+dir)}function selectAll(cm){cm.setSelection(Pos(cm.firstLine(),0),Pos(cm.lastLine()),sel_dontScroll)}function filterChange(doc,change,update){var obj={canceled:!1,from:change.from,to:change.to,text:change.text,origin:change.origin,cancel:function(){return obj.canceled=!0}};return update&&(obj.update=function(from,to,text,origin){from&&(obj.from=clipPos(doc,from)),to&&(obj.to=clipPos(doc,to)),text&&(obj.text=text),void 0!==origin&&(obj.origin=origin)}),signal(doc,"beforeChange",doc,obj),doc.cm&&signal(doc.cm,"beforeChange",doc.cm,obj),obj.canceled?null:{from:obj.from,to:obj.to,text:obj.text,origin:obj.origin}}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,!0))){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(1!=change.text.length||""!=change.text[0]||0!=cmp(change.from,change.to)){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){sharedHist||-1!=indexOf(rebased,doc.history)||(rebaseHist(doc.history,change),rebased.push(doc.history)),makeChangeSingleDoc(doc,change,null,stretchSpansOverChange(doc,change))})}}function makeChangeFromHistory(doc,type,allowSelectionOnly){var suppress=doc.cm&&doc.cm.state.suppressEdits;if(!suppress||allowSelectionOnly){for(var event,hist=doc.history,selAfter=doc.sel,source="undo"==type?hist.done:hist.undone,dest="undo"==type?hist.undone:hist.done,i=0;i<source.length&&(event=source[i],allowSelectionOnly?!event.ranges||event.equals(doc.sel):event.ranges);i++);if(i!=source.length){for(hist.lastOrigin=hist.lastSelOrigin=null;;){if(!(event=source.pop()).ranges){if(suppress)return void source.push(event);break}if(pushSelectionToHistory(event,dest),allowSelectionOnly&&!event.equals(doc.sel))return void setSelection(doc,event,{clearRedo:!1});selAfter=event}var antiChanges=[];pushSelectionToHistory(selAfter,dest),dest.push({changes:antiChanges,generation:hist.generation}),hist.generation=event.generation||++hist.maxGeneration;for(var filter=hasHandler(doc,"beforeChange")||doc.cm&&hasHandler(doc.cm,"beforeChange"),i$1=event.changes.length-1;i$1>=0;--i$1){var returned=function(i){var change=event.changes[i];if(change.origin=type,filter&&!filterChange(doc,change,!1))return source.length=0,{};antiChanges.push(historyChangeFromChange(doc,change));var after=i?computeSelAfterChange(doc,change):lst(source);makeChangeSingleDoc(doc,change,after,mergeOldSpans(doc,change)),!i&&doc.cm&&doc.cm.scrollIntoView({from:change.from,to:changeEnd(change)});var rebased=[];linkedDocs(doc,function(doc,sharedHist){sharedHist||-1!=indexOf(rebased,doc.history)||(rebaseHist(doc.history,change),rebased.push(doc.history)),makeChangeSingleDoc(doc,change,null,mergeOldSpans(doc,change))})}(i$1);if(returned)return returned.v}}}}function shiftDoc(doc,distance){if(0!=distance&&(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),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")}}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));else if(!(change.from.line>doc.lastLine())){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();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),selAfter||(selAfter=computeSelAfterChange(doc,change)),doc.cm?makeChangeSingleDocInEditor(doc.cm,change,spans):updateDoc(doc,change,spans),setSelectionNoUndo(doc,selAfter,sel_dontScroll)}}function makeChangeSingleDocInEditor(cm,change,spans){var doc=cm.doc,display=cm.display,from=change.from,to=change.to,recomputeMaxLength=!1,checkWidthStart=from.line;cm.options.lineWrapping||(checkWidthStart=lineNo(visualLine(getLine(doc,from.line))),doc.iter(checkWidthStart,to.line+1,function(line){if(line==display.maxLine)return recomputeMaxLength=!0,!0})),doc.sel.contains(change.from,change.to)>-1&&signalCursorActivity(cm),updateDoc(doc,change,spans,estimateHeight(cm)),cm.options.lineWrapping||(doc.iter(checkWidthStart,from.line+change.text.length,function(line){var len=lineLength(line);len>display.maxLineLength&&(display.maxLine=line,display.maxLineLength=len,display.maxLineChanged=!0,recomputeMaxLength=!1)}),recomputeMaxLength&&(cm.curOp.updateMaxLine=!0)),retreatFrontier(doc,from.line),startWorker(cm,400);var lendiff=change.text.length-(to.line-from.line)-1;change.full?regChange(cm):from.line!=to.line||1!=change.text.length||isWholeLineUpdate(cm.doc,change)?regChange(cm,from.line,to.line+1,lendiff):regLineChange(cm,from.line,"text");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};changeHandler&&signalLater(cm,"change",cm,obj),changesHandler&&(cm.curOp.changeObjs||(cm.curOp.changeObjs=[])).push(obj)}cm.display.selForContextMenu=null}function replaceRange(doc,code,from,to,origin){if(to||(to=from),cmp(to,from)<0){var assign;from=(assign=[to,from])[0],to=assign[1]}"string"==typeof code&&(code=doc.splitLines(code)),makeChange(doc,{from:from,to:to,text:code,origin:origin})}function rebaseHistSelSingle(pos,from,to,diff){to<pos.line?pos.line+=diff:from<pos.line&&(pos.line=from,pos.ch=0)}function rebaseHistArray(array,from,to,diff){for(var i=0;i<array.length;++i){var sub=array[i],ok=!0;if(sub.ranges){sub.copied||((sub=array[i]=sub.deepCopy()).copied=!0);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)}else{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=!1;break}}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)}function changeLine(doc,handle,changeType,op){var no=handle,line=handle;return"number"==typeof handle?line=getLine(doc,clipLine(doc,handle)):no=lineNo(handle),null==no?null:(op(line,no)&&doc.cm&&regLineChange(doc.cm,no,changeType),line)}function LeafChunk(lines){var this$1=this;this.lines=lines,this.parent=null;for(var height=0,i=0;i<lines.length;++i)lines[i].parent=this$1,height+=lines[i].height;this.height=height}function BranchChunk(children){var this$1=this;this.children=children;for(var size=0,height=0,i=0;i<children.length;++i){var ch=children[i];size+=ch.chunkSize(),height+=ch.height,ch.parent=this$1}this.size=size,this.height=height,this.parent=null}function adjustScrollWhenAboveVisible(cm,line,diff){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),cm=doc.cm;return cm&&widget.noHScroll&&(cm.display.alignWidgets=!0),changeLine(doc,handle,"widget",function(line){var widgets=line.widgets||(line.widgets=[]);if(null==widget.insertAt?widgets.push(widget):widgets.splice(Math.min(widgets.length-1,Math.max(0,widget.insertAt)),0,widget),widget.line=line,cm&&!lineIsHidden(doc,line)){var aboveVisible=heightAtLine(line)<doc.scrollTop;updateLineHeight(line,line.height+widgetHeight(widget)),aboveVisible&&addToScrollTop(cm,widget.height),cm.curOp.forceUpdate=!0}return!0}),cm&&signalLater(cm,"lineWidgetAdded",cm,widget,"number"==typeof handle?handle:lineNo(handle)),widget}function markText(doc,from,to,options,type){if(options&&options.shared)return markTextShared(doc,from,to,options,type);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,!1),diff>0||0==diff&&!1!==marker.clearWhenEmpty)return marker;if(marker.replacedWith&&(marker.collapsed=!0,marker.widgetNode=eltP("span",[marker.replacedWith],"CodeMirror-widget"),options.handleMouseEvents||marker.widgetNode.setAttribute("cm-ignore-events","true"),options.insertLeft&&(marker.widgetNode.insertLeft=!0)),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()}marker.addToHistory&&addChangeToHistory(doc,{from:from,to:to,origin:"markText"},doc.sel,NaN);var updateMaxLine,curLine=from.line,cm=doc.cm;if(doc.iter(curLine,to.line+1,function(line){cm&&marker.collapsed&&!cm.options.lineWrapping&&visualLine(line)==cm.display.maxLine&&(updateMaxLine=!0),marker.collapsed&&curLine!=from.line&&updateLineHeight(line,0),addMarkedSpan(line,new MarkedSpan(marker,curLine==from.line?from.ch:null,curLine==to.line?to.ch:null)),++curLine}),marker.collapsed&&doc.iter(from.line,to.line+1,function(line){lineIsHidden(doc,line)&&updateLineHeight(line,0)}),marker.clearOnEnter&&on(marker,"beforeCursorEnter",function(){return marker.clear()}),marker.readOnly&&(seeReadOnlySpans(),(doc.history.done.length||doc.history.undone.length)&&doc.clearHistory()),marker.collapsed&&(marker.id=++nextMarkerId,marker.atomic=!0),cm){if(updateMaxLine&&(cm.curOp.updateMaxLine=!0),marker.collapsed)regChange(cm,from.line,to.line+1);else if(marker.className||marker.title||marker.startStyle||marker.endStyle||marker.css)for(var i=from.line;i<=to.line;i++)regLineChange(cm,i,"text");marker.atomic&&reCheckSelection(cm.doc),signalLater(cm,"markerAdded",cm,marker)}return marker}function markTextShared(doc,from,to,options,type){(options=copyObj(options)).shared=!1;var markers=[markText(doc,from,to,options,type)],primary=markers[0],widget=options.widgetNode;return linkedDocs(doc,function(doc){widget&&(options.widgetNode=widget.cloneNode(!0)),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)}),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(),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){for(var i=0;i<markers.length;i++)!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];-1==indexOf(linked,subMarker.doc)&&(subMarker.parent=null,marker.markers.splice(j--,1))}}(i)}function onDrop(e){var cm=this;if(clearDragCursor(cm),!signalDOMEvent(cm,e)&&!eventInWidget(cm.display,e)){e_preventDefault(e),ie&&(lastDrop=+new Date);var pos=posFromMouse(cm,e,!0),files=e.dataTransfer.files;if(pos&&!cm.isReadOnly())if(files&&files.length&&window.FileReader&&window.File)for(var n=files.length,text=Array(n),read=0,i=0;i<n;++i)!function(file,i){if(!cm.options.allowDropFileTypes||-1!=indexOf(cm.options.allowDropFileTypes,file.type)){var reader=new FileReader;reader.onload=operation(cm,function(){var content=reader.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(content)&&(content=""),text[i]=content,++read==n){var change={from:pos=clipPos(cm.doc,pos),to:pos,text:cm.doc.splitLines(text.join(cm.doc.lineSeparator())),origin:"paste"};makeChange(cm.doc,change),setSelectionReplaceHistory(cm.doc,simpleSelection(pos,changeEnd(change)))}}),reader.readAsText(file)}}(files[i],i);else{if(cm.state.draggingText&&cm.doc.sel.contains(pos)>-1)return cm.state.draggingText(e),void setTimeout(function(){return cm.display.input.focus()},20);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)),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){}}}}function onDragStart(cm,e){if(ie&&(!cm.state.draggingText||+new Date-lastDrop<100))e_stop(e);else if(!signalDOMEvent(cm,e)&&!eventInWidget(cm.display,e)&&(e.dataTransfer.setData("Text",cm.getSelection()),e.dataTransfer.effectAllowed="copyMove",e.dataTransfer.setDragImage&&!safari)){var img=elt("img",null,null,"position: fixed; left: 0; top: 0;");img.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",presto&&(img.width=img.height=1,cm.display.wrapper.appendChild(img),img._top=img.offsetTop),e.dataTransfer.setDragImage(img,0,0),presto&&img.parentNode.removeChild(img)}}function onDragOver(cm,e){var pos=posFromMouse(cm,e);if(pos){var frag=document.createDocumentFragment();drawSelectionCursor(cm,pos,frag),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){cm.display.dragCursor&&(cm.display.lineSpace.removeChild(cm.display.dragCursor),cm.display.dragCursor=null)}function forEachCodeMirror(f){if(document.getElementsByClassName)for(var byClass=document.getElementsByClassName("CodeMirror"),i=0;i<byClass.length;i++){var cm=byClass[i].CodeMirror;cm&&f(cm)}}function ensureGlobalHandlers(){globalsRegistered||(registerGlobalHandlers(),globalsRegistered=!0)}function registerGlobalHandlers(){var resizeTimer;on(window,"resize",function(){null==resizeTimer&&(resizeTimer=setTimeout(function(){resizeTimer=null,forEachCodeMirror(onResize)},100))}),on(window,"blur",function(){return forEachCodeMirror(onBlur)})}function onResize(cm){var d=cm.display;d.lastWrapHeight==d.wrapper.clientHeight&&d.lastWrapWidth==d.wrapper.clientWidth||(d.cachedCharWidth=d.cachedTextHeight=d.cachedPaddingH=null,d.scrollbarsClipped=!1,cm.setSize())}function normalizeKeyName(name){var parts=name.split(/-(?!$)/);name=parts[parts.length-1];for(var alt,ctrl,shift,cmd,i=0;i<parts.length-1;i++){var mod=parts[i];if(/^(cmd|meta|m)$/i.test(mod))cmd=!0;else if(/^a(lt)?$/i.test(mod))alt=!0;else if(/^(c|ctrl|control)$/i.test(mod))ctrl=!0;else{if(!/^s(hift)?$/i.test(mod))throw new Error("Unrecognized modifier name: "+mod);shift=!0}}return alt&&(name="Alt-"+name),ctrl&&(name="Ctrl-"+name),cmd&&(name="Cmd-"+name),shift&&(name="Shift-"+name),name}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}for(var keys=map(keyname.split(" "),normalizeKeyName),i=0;i<keys.length;i++){var val=void 0,name=void 0;i==keys.length-1?(name=keys.join(" "),val=value):(name=keys.slice(0,i+1).join(" "),val="...");var prev=copy[name];if(prev){if(prev!=val)throw new Error("Inconsistent bindings for "+name)}else copy[name]=val}delete keymap[keyname]}for(var prop in copy)keymap[prop]=copy[prop];return keymap}function lookupKey(key,map$$1,handle,context){var found=(map$$1=getKeyMap(map$$1)).call?map$$1.call(key,context):map$$1[key];if(!1===found)return"nothing";if("..."===found)return"multi";if(null!=found&&handle(found))return"handled";if(map$$1.fallthrough){if("[object Array]"!=Object.prototype.toString.call(map$$1.fallthrough))return lookupKey(key,map$$1.fallthrough,handle,context);for(var i=0;i<map$$1.fallthrough.length;i++){var result=lookupKey(key,map$$1.fallthrough[i],handle,context);if(result)return result}}}function isModifierKey(value){var name="string"==typeof value?value:keyNames[value.keyCode];return"Ctrl"==name||"Alt"==name||"Shift"==name||"Mod"==name}function addModifierNames(name,event,noShift){var base=name;return event.altKey&&"Alt"!=base&&(name="Alt-"+name),(flipCtrlCmd?event.metaKey:event.ctrlKey)&&"Ctrl"!=base&&(name="Ctrl-"+name),(flipCtrlCmd?event.ctrlKey:event.metaKey)&&"Cmd"!=base&&(name="Cmd-"+name),!noShift&&event.shiftKey&&"Shift"!=base&&(name="Shift-"+name),name}function keyName(event,noShift){if(presto&&34==event.keyCode&&event.char)return!1;var name=keyNames[event.keyCode];return null!=name&&!event.altGraphKey&&(3==event.keyCode&&event.code&&(name=event.code),addModifierNames(name,event,noShift))}function getKeyMap(val){return"string"==typeof val?keyMap[val]:val}function deleteNearSelection(cm,compute){for(var ranges=cm.doc.sel.ranges,kill=[],i=0;i<ranges.length;i++){for(var toKill=compute(ranges[i]);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)}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 null==ch?null:new Pos(start.line,ch,dir<0?"after":"before")}function endOfLine(visually,cm,lineObj,lineNo,dir){if(visually){var order=getOrder(lineObj,cm.doc.direction);if(order){var ch,part=dir<0?lst(order):order[0],sticky=dir<0==(1==part.level)?"after":"before";if(part.level>0||"rtl"==cm.doc.direction){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==(1==part.level)?part.from:part.to-1,ch),"before"==sticky&&(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);start.ch>=line.text.length?(start.ch=line.text.length,start.sticky="before"):start.ch<=0&&(start.ch=0,start.sticky="after");var partPos=getBidiPartAt(bidi,start.ch,start.sticky),part=bidi[partPos];if("ltr"==cm.doc.direction&&part.level%2==0&&(dir>0?part.to>start.ch:part.from<start.ch))return moveLogically(line,start,dir);var prep,mv=function(pos,dir){return moveCharLogically(line,pos instanceof Pos?pos.ch:pos,dir)},getWrappedLineExtent=function(ch){return cm.options.lineWrapping?(prep=prep||prepareMeasureForLine(cm,line),wrappedLineExtentChar(cm,line,prep,ch)):{begin:0,end:line.text.length}},wrappedLineExtent=getWrappedLineExtent("before"==start.sticky?mv(start,-1):start.ch);if("rtl"==cm.doc.direction||1==part.level){var moveInStorageOrder=1==part.level==dir<0,ch=mv(start,moveInStorageOrder?1:-1);if(null!=ch&&(moveInStorageOrder?ch<=part.to&&ch<=wrappedLineExtent.end:ch>=part.from&&ch>=wrappedLineExtent.begin)){var sticky=moveInStorageOrder?"before":"after";return new Pos(start.line,ch,sticky)}}var searchInVisualLine=function(partPos,dir,wrappedLineExtent){for(var getRes=function(ch,moveInStorageOrder){return moveInStorageOrder?new Pos(start.line,mv(ch,1),"before"):new Pos(start.line,ch,"after")};partPos>=0&&partPos<bidi.length;partPos+=dir){var part=bidi[partPos],moveInStorageOrder=dir>0==(1!=part.level),ch=moveInStorageOrder?wrappedLineExtent.begin:mv(wrappedLineExtent.end,-1);if(part.from<=ch&&ch<part.to)return getRes(ch,moveInStorageOrder);if(ch=moveInStorageOrder?part.from:mv(part.to,-1),wrappedLineExtent.begin<=ch&&ch<wrappedLineExtent.end)return getRes(ch,moveInStorageOrder)}},res=searchInVisualLine(partPos+dir,dir,wrappedLineExtent);if(res)return res;var nextCh=dir>0?wrappedLineExtent.end:mv(wrappedLineExtent.begin,-1);return null==nextCh||dir>0&&nextCh==line.text.length||!(res=searchInVisualLine(dir>0?0:bidi.length-1,dir,getWrappedLineExtent(nextCh)))?null:res}function lineStart(cm,lineN){var line=getLine(cm.doc,lineN),visual=visualLine(line);return visual!=line&&(lineN=lineNo(visual)),endOfLine(!0,cm,visual,lineN,1)}function lineEnd(cm,lineN){var line=getLine(cm.doc,lineN),visual=visualLineEnd(line);return visual!=line&&(lineN=lineNo(visual)),endOfLine(!0,cm,line,lineN,-1)}function lineStartSmart(cm,pos){var start=lineStart(cm,pos.line),line=getLine(cm.doc,start.line),order=getOrder(line,cm.doc.direction);if(!order||0==order[0].level){var firstNonWS=Math.max(0,line.text.search(/\S/)),inWS=pos.line==start.line&&pos.ch<=firstNonWS&&pos.ch;return Pos(start.line,inWS?0:firstNonWS,start.sticky)}return start}function doHandleBinding(cm,bound,dropShift){if("string"==typeof bound&&!(bound=commands[bound]))return!1;cm.display.input.ensurePolled();var prevShift=cm.display.shift,done=!1;try{cm.isReadOnly()&&(cm.state.suppressEdits=!0),dropShift&&(cm.display.shift=!1),done=bound(cm)!=Pass}finally{cm.display.shift=prevShift,cm.state.suppressEdits=!1}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)}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:stopSeq.set(50,function(){cm.state.keySeq==seq&&(cm.state.keySeq=null,cm.display.input.reset())}),dispatchKeyInner(cm,seq+" "+name,e,handle))return!0}return dispatchKeyInner(cm,name,e,handle)}function dispatchKeyInner(cm,name,e,handle){var result=lookupKeyForEditor(cm,name,handle);return"multi"==result&&(cm.state.keySeq=name),"handled"==result&&signalLater(cm,"keyHandled",cm,name,e),"handled"!=result&&"multi"!=result||(e_preventDefault(e),restartBlink(cm)),!!result}function handleKeyBinding(cm,e){var name=keyName(e,!0);return!!name&&(e.shiftKey&&!cm.state.keySeq?dispatchKey(cm,"Shift-"+name,e,function(b){return doHandleBinding(cm,b,!0)})||dispatchKey(cm,name,e,function(b){if("string"==typeof b?/^go[A-Z]/.test(b):b.motion)return doHandleBinding(cm,b)}):dispatchKey(cm,name,e,function(b){return doHandleBinding(cm,b)}))}function handleCharBinding(cm,e,ch){return dispatchKey(cm,"'"+ch+"'",e,function(b){return doHandleBinding(cm,b,!0)})}function onKeyDown(e){var cm=this;if(cm.curOp.focus=activeElt(),!signalDOMEvent(cm,e)){ie&&ie_version<11&&27==e.keyCode&&(e.returnValue=!1);var code=e.keyCode;cm.display.shift=16==code||e.shiftKey;var handled=handleKeyBinding(cm,e);presto&&(lastStoppedKey=handled?code:null,!handled&&88==code&&!hasCopyEvent&&(mac?e.metaKey:e.ctrlKey)&&cm.replaceSelection("",null,"cut")),18!=code||/\bCodeMirror-crosshair\b/.test(cm.display.lineDiv.className)||showCrossHair(cm)}}function showCrossHair(cm){function up(e){18!=e.keyCode&&e.altKey||(rmClass(lineDiv,"CodeMirror-crosshair"),off(document,"keyup",up),off(document,"mouseover",up))}var lineDiv=cm.display.lineDiv;addClass(lineDiv,"CodeMirror-crosshair"),on(document,"keyup",up),on(document,"mouseover",up)}function onKeyUp(e){16==e.keyCode&&(this.doc.sel.shift=!1),signalDOMEvent(this,e)}function onKeyPress(e){var cm=this;if(!(eventInWidget(cm.display,e)||signalDOMEvent(cm,e)||e.ctrlKey&&!e.altKey||mac&&e.metaKey)){var keyCode=e.keyCode,charCode=e.charCode;if(presto&&keyCode==lastStoppedKey)return lastStoppedKey=null,void e_preventDefault(e);if(!presto||e.which&&!(e.which<10)||!handleKeyBinding(cm,e)){var ch=String.fromCharCode(null==charCode?keyCode:charCode);"\b"!=ch&&(handleCharBinding(cm,e,ch)||cm.display.input.onKeyPress(e))}}}function clickRepeat(pos,button){var now=+new Date;return lastDoubleClick&&lastDoubleClick.compare(now,pos,button)?(lastClick=lastDoubleClick=null,"triple"):lastClick&&lastClick.compare(now,pos,button)?(lastDoubleClick=new PastClick(now,pos,button),lastClick=null,"double"):(lastClick=new PastClick(now,pos,button),lastDoubleClick=null,"single")}function onMouseDown(e){var cm=this,display=cm.display;if(!(signalDOMEvent(cm,e)||display.activeTouch&&display.input.supportsTouch()))if(display.input.ensurePolled(),display.shift=e.shiftKey,eventInWidget(display,e))webkit||(display.scroller.draggable=!1,setTimeout(function(){return display.scroller.draggable=!0},100));else if(!clickInGutter(cm,e)){var pos=posFromMouse(cm,e),button=e_button(e),repeat=pos?clickRepeat(pos,button):"single";window.focus(),1==button&&cm.state.selectingText&&cm.state.selectingText(e),pos&&handleMappedButton(cm,button,pos,repeat,e)||(1==button?pos?leftButtonDown(cm,pos,repeat,e):e_target(e)==display.scroller&&e_preventDefault(e):2==button?(pos&&extendSelection(cm.doc,pos),setTimeout(function(){return display.input.focus()},20)):3==button&&(captureRightClick?onContextMenu(cm,e):delayBlurEvent(cm)))}}function handleMappedButton(cm,button,pos,repeat,event){var name="Click";return"double"==repeat?name="Double"+name:"triple"==repeat&&(name="Triple"+name),name=(1==button?"Left":2==button?"Middle":"Right")+name,dispatchKey(cm,addModifierNames(name,event),event,function(bound){if("string"==typeof bound&&(bound=commands[bound]),!bound)return!1;var done=!1;try{cm.isReadOnly()&&(cm.state.suppressEdits=!0),done=bound(cm,pos)!=Pass}finally{cm.state.suppressEdits=!1}return done})}function configureMouse(cm,repeat,event){var option=cm.getOption("configureMouse"),value=option?option(cm,repeat,event):{};if(null==value.unit){var rect=chromeOS?event.shiftKey&&event.metaKey:event.altKey;value.unit=rect?"rectangle":"single"==repeat?"char":"double"==repeat?"word":"line"}return(null==value.extend||cm.doc.extend)&&(value.extend=cm.doc.extend||event.shiftKey),null==value.addNew&&(value.addNew=mac?event.metaKey:event.ctrlKey),null==value.moveOnDrag&&(value.moveOnDrag=!(mac?event.altKey:event.ctrlKey)),value}function leftButtonDown(cm,pos,repeat,event){ie?setTimeout(bind(ensureFocus,cm),0):cm.curOp.focus=activeElt();var contained,behavior=configureMouse(cm,repeat,event),sel=cm.doc.sel;cm.options.dragDrop&&dragAndDrop&&!cm.isReadOnly()&&"single"==repeat&&(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):leftButtonSelect(cm,event,pos,behavior)}function leftButtonStartDrag(cm,event,pos,behavior){var display=cm.display,moved=!1,dragEnd=operation(cm,function(e){webkit&&(display.scroller.draggable=!1),cm.state.draggingText=!1,off(document,"mouseup",dragEnd),off(document,"mousemove",mouseMove),off(display.scroller,"dragstart",dragStart),off(display.scroller,"drop",dragEnd),moved||(e_preventDefault(e),behavior.addNew||extendSelection(cm.doc,pos,null,null,behavior.extend),webkit||ie&&9==ie_version?setTimeout(function(){document.body.focus(),display.input.focus()},20):display.input.focus())}),mouseMove=function(e2){moved=moved||Math.abs(event.clientX-e2.clientX)+Math.abs(event.clientY-e2.clientY)>=10},dragStart=function(){return moved=!0};webkit&&(display.scroller.draggable=!0),cm.state.draggingText=dragEnd,dragEnd.copy=!behavior.moveOnDrag,display.scroller.dragDrop&&display.scroller.dragDrop(),on(document,"mouseup",dragEnd),on(document,"mousemove",mouseMove),on(display.scroller,"dragstart",dragStart),on(display.scroller,"drop",dragEnd),delayBlurEvent(cm),setTimeout(function(){return display.input.focus()},20)}function rangeForUnit(cm,pos,unit){if("char"==unit)return new Range(pos,pos);if("word"==unit)return cm.findWordAt(pos);if("line"==unit)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)}function leftButtonSelect(cm,event,start,behavior){function extendTo(pos){if(0!=cmp(lastPos,pos))if(lastPos=pos,"rectangle"==behavior.unit){for(var ranges=[],tabSize=cm.options.tabSize,startCol=countColumn(getLine(doc,start.line).text,start.ch,tabSize),posCol=countColumn(getLine(doc,pos.line).text,pos.ch,tabSize),left=Math.min(startCol,posCol),right=Math.max(startCol,posCol),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);left==right?ranges.push(new Range(Pos(line,leftPos),Pos(line,leftPos))):text.length>leftPos&&ranges.push(new Range(Pos(line,leftPos),Pos(line,findColumn(text,right,tabSize))))}ranges.length||ranges.push(new Range(start,start)),setSelection(doc,normalizeSelection(startSel.ranges.slice(0,ourIndex).concat(ranges),ourIndex),{origin:"*mouse",scroll:!1}),cm.scrollIntoView(pos)}else{var head,oldRange=ourRange,range$$1=rangeForUnit(cm,pos,behavior.unit),anchor=oldRange.anchor;cmp(range$$1.anchor,anchor)>0?(head=range$$1.head,anchor=minPos(oldRange.from(),range$$1.anchor)):(head=range$$1.anchor,anchor=maxPos(oldRange.to(),range$$1.head));var ranges$1=startSel.ranges.slice(0);ranges$1[ourIndex]=bidiSimplify(cm,new Range(clipPos(doc,anchor),head)),setSelection(doc,normalizeSelection(ranges$1,ourIndex),sel_mouse)}}function extend(e){var curCount=++counter,cur=posFromMouse(cm,e,!0,"rectangle"==behavior.unit);if(cur)if(0!=cmp(cur,lastPos)){cm.curOp.focus=activeElt(),extendTo(cur);var visible=visibleLines(display,doc);(cur.line>=visible.to||cur.line<visible.from)&&setTimeout(operation(cm,function(){counter==curCount&&extend(e)}),150)}else{var outside=e.clientY<editorSize.top?-20:e.clientY>editorSize.bottom?20:0;outside&&setTimeout(operation(cm,function(){counter==curCount&&(display.scroller.scrollTop+=outside,extend(e))}),50)}}function done(e){cm.state.selectingText=!1,counter=1/0,e_preventDefault(e),display.input.focus(),off(document,"mousemove",move),off(document,"mouseup",up),doc.history.lastSelOrigin=null}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),ourRange=ourIndex>-1?ranges[ourIndex]:new Range(start,start)):(ourRange=doc.sel.primary(),ourIndex=doc.sel.primIndex),"rectangle"==behavior.unit)behavior.addNew||(ourRange=new Range(start,start)),start=posFromMouse(cm,event,!0,!0),ourIndex=-1;else{var range$$1=rangeForUnit(cm,start,behavior.unit);ourRange=behavior.extend?extendRange(ourRange,range$$1.anchor,range$$1.head,behavior.extend):range$$1}behavior.addNew?-1==ourIndex?(ourIndex=ranges.length,setSelection(doc,normalizeSelection(ranges.concat([ourRange]),ourIndex),{scroll:!1,origin:"*mouse"})):ranges.length>1&&ranges[ourIndex].empty()&&"char"==behavior.unit&&!behavior.extend?(setSelection(doc,normalizeSelection(ranges.slice(0,ourIndex).concat(ranges.slice(ourIndex+1)),0),{scroll:!1,origin:"*mouse"}),startSel=doc.sel):replaceOneSelection(doc,ourIndex,ourRange,sel_mouse):(ourIndex=0,setSelection(doc,new Selection([ourRange],0),sel_mouse),startSel=doc.sel);var lastPos=start,editorSize=display.wrapper.getBoundingClientRect(),counter=0,move=operation(cm,function(e){e_button(e)?extend(e):done(e)}),up=operation(cm,done);cm.state.selectingText=up,on(document,"mousemove",move),on(document,"mouseup",up)}function bidiSimplify(cm,range$$1){var anchor=range$$1.anchor,head=range$$1.head,anchorLine=getLine(cm.doc,anchor.line);if(0==cmp(anchor,head)&&anchor.sticky==head.sticky)return range$$1;var order=getOrder(anchorLine);if(!order)return range$$1;var index=getBidiPartAt(order,anchor.ch,anchor.sticky),part=order[index];if(part.from!=anchor.ch&&part.to!=anchor.ch)return range$$1;var boundary=index+(part.from==anchor.ch==(1!=part.level)?0:1);if(0==boundary||boundary==order.length)return range$$1;var leftSide;if(head.line!=anchor.line)leftSide=(head.line-anchor.line)*("ltr"==cm.doc.direction?1:-1)>0;else{var headIndex=getBidiPartAt(order,head.ch,head.sticky),dir=headIndex-index||(head.ch-anchor.ch)*(1==part.level?-1:1);leftSide=headIndex==boundary-1||headIndex==boundary?dir<0:dir>0}var usePart=order[boundary+(leftSide?-1:0)],from=leftSide==(1==usePart.level),ch=from?usePart.from:usePart.to,sticky=from?"after":"before";return anchor.ch==ch&&anchor.sticky==sticky?range$$1:new Range(new Pos(anchor.line,ch,sticky),head)}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){return!1}if(mX>=Math.floor(cm.display.gutters.getBoundingClientRect().right))return!1;prevent&&e_preventDefault(e);var display=cm.display,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.options.gutters.length;++i){var g=display.gutters.childNodes[i];if(g&&g.getBoundingClientRect().right>=mX)return signal(cm,type,cm,lineAtHeight(cm.doc,mY),cm.options.gutters[i],e),e_defaultPrevented(e)}}function clickInGutter(cm,e){return gutterEvent(cm,e,"gutterClick",!0)}function onContextMenu(cm,e){eventInWidget(cm.display,e)||contextMenuInGutter(cm,e)||signalDOMEvent(cm,e,"contextmenu")||cm.display.input.onContextMenu(e)}function contextMenuInGutter(cm,e){return!!hasHandler(cm,"gutterContextMenu")&&gutterEvent(cm,e,"gutterContextMenu",!1)}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)}function guttersChanged(cm){updateGutters(cm),regChange(cm),alignHorizontally(cm)}function dragDropChanged(cm,value,old){if(!value!=!(old&&old!=Init)){var funcs=cm.display.dragFunctions,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){cm.options.lineWrapping?(addClass(cm.display.wrapper,"CodeMirror-wrap"),cm.display.sizer.style.minWidth="",cm.display.sizerWidth=null):(rmClass(cm.display.wrapper,"CodeMirror-wrap"),findMaxLine(cm)),estimateLineHeights(cm),regChange(cm),clearCaches(cm),setTimeout(function(){return updateScrollbars(cm)},100)}function CodeMirror$1(place,options){var this$1=this;if(!(this instanceof CodeMirror$1))return new CodeMirror$1(place,options);this.options=options=options?copyObj(options):{},copyObj(defaults,options,!1),setGuttersForLineNumbers(options);var doc=options.value;"string"==typeof doc&&(doc=new Doc(doc,options.mode,null,options.lineSeparator,options.direction)),this.doc=doc;var input=new CodeMirror$1.inputStyles[options.inputStyle](this),display=this.display=new Display(place,doc,input);display.wrapper.CodeMirror=this,updateGutters(this),themeChanged(this),options.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),initScrollbars(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,selectingText:!1,draggingText:!1,highlight:new Delayed,keySeq:null,specialChars:null},options.autofocus&&!mobile&&display.input.focus(),ie&&ie_version<11&&setTimeout(function(){return this$1.display.input.reset(!0)},20),registerEventHandlers(this),ensureGlobalHandlers(),startOperation(this),this.curOp.forceUpdate=!0,attachDoc(this,doc),options.autofocus&&!mobile||this.hasFocus()?setTimeout(bind(onFocus,this),20):onBlur(this);for(var opt in optionHandlers)optionHandlers.hasOwnProperty(opt)&&optionHandlers[opt](this$1,options[opt],Init);maybeUpdateLineNumberWidth(this),options.finishInit&&options.finishInit(this);for(var i=0;i<initHooks.length;++i)initHooks[i](this$1);endOperation(this),webkit&&options.lineWrapping&&"optimizelegibility"==getComputedStyle(display.lineDiv).textRendering&&(display.lineDiv.style.textRendering="auto")}function registerEventHandlers(cm){function finishTouch(){d.activeTouch&&(touchFinished=setTimeout(function(){return d.activeTouch=null},1e3),(prevTouch=d.activeTouch).end=+new Date)}function isMouseLikeTouchEvent(e){if(1!=e.touches.length)return!1;var touch=e.touches[0];return touch.radiusX<=1&&touch.radiusY<=1}function farAway(touch,other){if(null==other.left)return!0;var dx=other.left-touch.left,dy=other.top-touch.top;return dx*dx+dy*dy>400}var d=cm.display;on(d.scroller,"mousedown",operation(cm,onMouseDown)),ie&&ie_version<11?on(d.scroller,"dblclick",operation(cm,function(e){if(!signalDOMEvent(cm,e)){var pos=posFromMouse(cm,e);if(pos&&!clickInGutter(cm,e)&&!eventInWidget(cm.display,e)){e_preventDefault(e);var word=cm.findWordAt(pos);extendSelection(cm.doc,word.anchor,word.head)}}})):on(d.scroller,"dblclick",function(e){return signalDOMEvent(cm,e)||e_preventDefault(e)}),captureRightClick||on(d.scroller,"contextmenu",function(e){return onContextMenu(cm,e)});var touchFinished,prevTouch={end:0};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:!1,prev:now-prevTouch.end<=300?prevTouch:null},1==e.touches.length&&(d.activeTouch.left=e.touches[0].pageX,d.activeTouch.top=e.touches[0].pageY)}}),on(d.scroller,"touchmove",function(){d.activeTouch&&(d.activeTouch.moved=!0)}),on(d.scroller,"touchend",function(e){var touch=d.activeTouch;if(touch&&!eventInWidget(d,e)&&null!=touch.left&&!touch.moved&&new Date-touch.start<300){var range,pos=cm.coordsChar(d.activeTouch,"page");range=!touch.prev||farAway(touch,touch.prev)?new Range(pos,pos):!touch.prev.prev||farAway(touch,touch.prev.prev)?cm.findWordAt(pos):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),on(d.scroller,"scroll",function(){d.scroller.clientHeight&&(updateScrollTop(cm,d.scroller.scrollTop),setScrollLeft(cm,d.scroller.scrollLeft,!0),signal(cm,"scroll",cm))}),on(d.scroller,"mousewheel",function(e){return onScrollWheel(cm,e)}),on(d.scroller,"DOMMouseScroll",function(e){return onScrollWheel(cm,e)}),on(d.wrapper,"scroll",function(){return d.wrapper.scrollTop=d.wrapper.scrollLeft=0}),d.dragFunctions={enter:function(e){signalDOMEvent(cm,e)||e_stop(e)},over:function(e){signalDOMEvent(cm,e)||(onDragOver(cm,e),e_stop(e))},start:function(e){return onDragStart(cm,e)},drop:operation(cm,onDrop),leave:function(e){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)})}function indentLine(cm,n,how,aggressive){var state,doc=cm.doc;null==how&&(how="add"),"smart"==how&&(doc.mode.indent?state=getContextBefore(cm,n).state:how="prev");var tabSize=cm.options.tabSize,line=getLine(doc,n),curSpace=countColumn(line.text,null,tabSize);line.stateAfter&&(line.stateAfter=null);var indentation,curSpaceString=line.text.match(/^\s*/)[0];if(aggressive||/\S/.test(line.text)){if("smart"==how&&((indentation=doc.mode.indent(state,line.text.slice(curSpaceString.length),line.text))==Pass||indentation>150)){if(!aggressive)return;how="prev"}}else indentation=0,how="not";"prev"==how?indentation=n>doc.first?countColumn(getLine(doc,n-1).text,null,tabSize):0:"add"==how?indentation=curSpace+cm.options.indentUnit:"subtract"==how?indentation=curSpace-cm.options.indentUnit:"number"==typeof how&&(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)),indentString!=curSpaceString)return replaceRange(doc,indentString,Pos(n,0),Pos(n,curSpaceString.length),"+input"),line.stateAfter=null,!0;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}}}function setLastCopied(newLastCopied){lastCopied=newLastCopied}function applyTextInput(cm,inserted,deleted,sel,origin){var doc=cm.doc;cm.display.shift=!1,sel||(sel=doc.sel);var paste=cm.state.pasteIncoming||"paste"==origin,textLines=splitLinesAuto(inserted),multiPaste=null;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 textLines.length==sel.ranges.length&&cm.options.pasteLinesPerSelection&&(multiPaste=map(textLines,function(l){return[l]}));for(var updateInput,i$1=sel.ranges.length-1;i$1>=0;i$1--){var range$$1=sel.ranges[i$1],from=range$$1.from(),to=range$$1.to();range$$1.empty()&&(deleted&&deleted>0?from=Pos(from.line,from.ch-deleted):cm.state.overwrite&&!paste?to=Pos(to.line,Math.min(getLine(doc,to.line).text.length,to.ch+lst(textLines).length)):lastCopied&&lastCopied.lineWise&&lastCopied.text.join("\n")==inserted&&(from=to=Pos(from.line,0))),updateInput=cm.curOp.updateInput;var changeEvent={from:from,to:to,text:multiPaste?multiPaste[i$1%multiPaste.length]:textLines,origin:origin||(paste?"paste":cm.state.cutIncoming?"cut":"+input")};makeChange(cm.doc,changeEvent),signalLater(cm,"inputRead",cm,changeEvent)}inserted&&!paste&&triggerElectric(cm,inserted),ensureCursorVisible(cm),cm.curOp.updateInput=updateInput,cm.curOp.typing=!0,cm.state.pasteIncoming=cm.state.cutIncoming=!1}function handlePaste(e,cm){var pasted=e.clipboardData&&e.clipboardData.getData("Text");if(pasted)return e.preventDefault(),cm.isReadOnly()||cm.options.disableInput||runInOp(cm,function(){return applyTextInput(cm,pasted,0,null,"paste")}),!0}function triggerElectric(cm,inserted){if(cm.options.electricChars&&cm.options.smartIndent)for(var sel=cm.doc.sel,i=sel.ranges.length-1;i>=0;i--){var range$$1=sel.ranges[i];if(!(range$$1.head.ch>100||i&&sel.ranges[i-1].head.line==range$$1.head.line)){var mode=cm.getModeAt(range$$1.head),indented=!1;if(mode.electricChars){for(var j=0;j<mode.electricChars.length;j++)if(inserted.indexOf(mode.electricChars.charAt(j))>-1){indented=indentLine(cm,range$$1.head.line,"smart");break}}else mode.electricInput&&mode.electricInput.test(getLine(cm.doc,range$$1.head.line).text.slice(0,range$$1.head.ch))&&(indented=indentLine(cm,range$$1.head.line,"smart"));indented&&signalLater(cm,"electricInput",cm,range$$1.head.line)}}}function copyableRanges(cm){for(var text=[],ranges=[],i=0;i<cm.doc.sel.ranges.length;i++){var line=cm.doc.sel.ranges[i].head.line,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){field.setAttribute("autocorrect","off"),field.setAttribute("autocapitalize","off"),field.setAttribute("spellcheck",!!spellcheck)}function hiddenTextarea(){var te=elt("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),div=elt("div",[te],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return webkit?te.style.width="1000px":te.setAttribute("wrap","off"),ios&&(te.style.border="1px solid black"),disableBrowserMagic(te),div}function findPosH(doc,pos,dir,unit,visually){function findNextLine(){var l=pos.line+dir;return!(l<doc.first||l>=doc.first+doc.size)&&(pos=new Pos(l,pos.ch,pos.sticky),lineObj=getLine(doc,l))}function moveOnce(boundToLine){var next;if(null==(next=visually?moveVisually(doc.cm,lineObj,pos,dir):moveLogically(lineObj,pos,dir))){if(boundToLine||!findNextLine())return!1;pos=endOfLine(visually,doc.cm,lineObj,pos.line,dir)}else pos=next;return!0}var oldPos=pos,origDir=dir,lineObj=getLine(doc,pos.line);if("char"==unit)moveOnce();else if("column"==unit)moveOnce(!0);else if("word"==unit||"group"==unit)for(var sawType=null,group="group"==unit,helper=doc.cm&&doc.cm.getHelper(pos,"wordChars"),first=!0;!(dir<0)||moveOnce(!first);first=!1){var cur=lineObj.text.charAt(pos.ch)||"\n",type=isWordChar(cur,helper)?"w":group&&"\n"==cur?"n":!group||/\s/.test(cur)?null:"p";if(!group||first||type||(type="s"),sawType&&sawType!=type){dir<0&&(dir=1,moveOnce(),pos.sticky="after");break}if(type&&(sawType=type),dir>0&&!moveOnce(!first))break}var result=skipAtomic(doc,pos,oldPos,origDir,!0);return equalCursorPos(oldPos,result)&&(result.hitSide=!0),result}function findPosV(cm,pos,dir,unit){var y,doc=cm.doc,x=pos.left;if("page"==unit){var pageSize=Math.min(cm.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),moveAmount=Math.max(pageSize-.5*textHeight(cm.display),3);y=(dir>0?pos.bottom:pos.top)+dir*moveAmount}else"line"==unit&&(y=dir>0?pos.bottom+3:pos.top-3);for(var target;(target=coordsChar(cm,x,y)).outside;){if(dir<0?y<=0:y>=doc.height){target.hitSide=!0;break}y+=5*dir}return target}function posToDOM(cm,pos){var view=findViewForLine(cm,pos.line);if(!view||view.hidden)return null;var line=getLine(cm.doc,pos.line),info=mapFromLineView(view,line,pos.line),order=getOrder(line,cm.doc.direction),side="left";order&&(side=getBidiPartAt(order,pos.ch)%2?"right":"left");var result=nodeAndOffsetInLineMap(info.map,pos.ch,side);return result.offset="right"==result.collapse?result.end:result.start,result}function isInGutter(node){for(var scan=node;scan;scan=scan.parentNode)if(/CodeMirror-gutter-wrapper/.test(scan.className))return!0;return!1}function badPos(pos,bad){return bad&&(pos.bad=!0),pos}function domTextBetween(cm,from,to,fromLine,toLine){function recognizeMarker(id){return function(marker){return marker.id==id}}function close(){closing&&(text+=lineSep,closing=!1)}function addText(str){str&&(close(),text+=str)}function walk(node){if(1==node.nodeType){var cmText=node.getAttribute("cm-text");if(null!=cmText)return void addText(cmText||node.textContent.replace(/\u200b/g,""));var range$$1,markerID=node.getAttribute("cm-marker");if(markerID){var found=cm.findMarks(Pos(fromLine,0),Pos(toLine+1,0),recognizeMarker(+markerID));return void(found.length&&(range$$1=found[0].find(0))&&addText(getBetween(cm.doc,range$$1.from,range$$1.to).join(lineSep)))}if("false"==node.getAttribute("contenteditable"))return;var isBlock=/^(pre|div|p)$/i.test(node.nodeName);isBlock&&close();for(var i=0;i<node.childNodes.length;i++)walk(node.childNodes[i]);isBlock&&(closing=!0)}else 3==node.nodeType&&addText(node.nodeValue)}for(var text="",closing=!1,lineSep=cm.doc.lineSeparator();walk(from),from!=to;)from=from.nextSibling;return text}function domToPos(cm,node,offset){var lineNode;if(node==cm.display.lineDiv){if(!(lineNode=cm.display.lineDiv.childNodes[offset]))return badPos(cm.clipPos(Pos(cm.display.viewTo-1)),!0);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){function find(textNode,topNode,offset){for(var i=-1;i<(maps?maps.length:0);i++)for(var map$$1=i<0?measure.map:maps[i],j=0;j<map$$1.length;j+=3){var curNode=map$$1[j+2];if(curNode==textNode||curNode==topNode){var line=lineNo(i<0?lineView.line:lineView.rest[i]),ch=map$$1[j]+offset;return(offset<0||curNode!=textNode)&&(ch=map$$1[j+(offset?1:0)]),Pos(line,ch)}}}var wrapper=lineView.text.firstChild,bad=!1;if(!node||!contains(wrapper,node))return badPos(Pos(lineNo(lineView.line),0),!0);if(node==wrapper&&(bad=!0,node=wrapper.childNodes[offset],offset=0,!node)){var line=lineView.rest?lst(lineView.rest):lineView.line;return badPos(Pos(lineNo(line),line.text.length),bad)}var textNode=3==node.nodeType?node:null,topNode=node;for(textNode||1!=node.childNodes.length||3!=node.firstChild.nodeType||(textNode=node.firstChild,offset&&(offset=textNode.nodeValue.length));topNode.parentNode!=wrapper;)topNode=topNode.parentNode;var measure=lineView.measure,maps=measure.maps,found=find(textNode,topNode,offset);if(found)return badPos(found,bad);for(var after=topNode.nextSibling,dist=textNode?textNode.nodeValue.length-offset:0;after;after=after.nextSibling){if(found=find(after,after.firstChild,0))return badPos(Pos(found.line,found.ch-dist),bad);dist+=after.textContent.length}for(var before=topNode.previousSibling,dist$1=offset;before;before=before.previousSibling){if(found=find(before,before.firstChild,-1))return badPos(Pos(found.line,found.ch+dist$1),bad);dist$1+=before.textContent.length}}var userAgent=navigator.userAgent,platform=navigator.platform,gecko=/gecko\/\d/i.test(userAgent),ie_upto10=/MSIE \d/.test(userAgent),ie_11up=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(userAgent),edge=/Edge\/(\d+)/.exec(userAgent),ie=ie_upto10||ie_11up||edge,ie_version=ie&&(ie_upto10?document.documentMode||6:+(edge||ie_11up)[1]),webkit=!edge&&/WebKit\//.test(userAgent),qtwebkit=webkit&&/Qt\/\d+\.\d+/.test(userAgent),chrome=!edge&&/Chrome\//.test(userAgent),presto=/Opera\//.test(userAgent),safari=/Apple Computer/.test(navigator.vendor),mac_geMountainLion=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent),phantom=/PhantomJS/.test(userAgent),ios=!edge&&/AppleWebKit/.test(userAgent)&&/Mobile\/\w+/.test(userAgent),android=/Android/.test(userAgent),mobile=ios||android||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent),mac=ios||/Mac/.test(platform),chromeOS=/\bCrOS\b/.test(userAgent),windows=/win/i.test(platform),presto_version=presto&&userAgent.match(/Version\/(\d*\.\d*)/);presto_version&&(presto_version=Number(presto_version[1])),presto_version&&presto_version>=15&&(presto=!1,webkit=!0);var range,flipCtrlCmd=mac&&(qtwebkit||presto&&(null==presto_version||presto_version<12.11)),captureRightClick=gecko||ie&&ie_version>=9,rmClass=function(node,cls){var current=node.className,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:"")}};range=document.createRange?function(node,start,end,endNode){var r=document.createRange();return r.setEnd(endNode||node,end),r.setStart(node,start),r}:function(node,start,end){var r=document.body.createTextRange();try{r.moveToElementText(node.parentNode)}catch(e){return r}return r.collapse(!0),r.moveEnd("character",end),r.moveStart("character",start),r};var selectInput=function(node){node.select()};ios?selectInput=function(node){node.selectionStart=0,node.selectionEnd=node.value.length}:ie&&(selectInput=function(node){try{node.select()}catch(_e){}});var Delayed=function(){this.id=null};Delayed.prototype.set=function(ms,f){clearTimeout(this.id),this.id=setTimeout(f,ms)};var zwspSupported,badBidiRects,scrollerGap=30,Pass={toString:function(){return"CodeMirror.Pass"}},sel_dontScroll={scroll:!1},sel_mouse={origin:"*mouse"},sel_move={origin:"+move"},spaceStrs=[""],nonASCIISingleCaseWordChar=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,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]/,sawReadOnlySpans=!1,sawCollapsedSpans=!1,bidiOther=null,bidiOrdering=function(){function charType(code){return code<=247?lowTypes.charAt(code):1424<=code&&code<=1524?"R":1536<=code&&code<=1785?arabicTypes.charAt(code-1536):1774<=code&&code<=2220?"r":8192<=code&&code<=8203?"w":8204==code?"b":"L"}function BidiSpan(level,from,to){this.level=level,this.from=from,this.to=to}var 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]/;return function(str,direction){var outerType="ltr"==direction?"L":"R";if(0==str.length||"ltr"==direction&&!bidiRE.test(str))return!1;for(var len=str.length,types=[],i=0;i<len;++i)types.push(charType(str.charCodeAt(i)));for(var i$1=0,prev=outerType;i$1<len;++i$1){var type=types[i$1];"m"==type?types[i$1]=prev:prev=type}for(var i$2=0,cur=outerType;i$2<len;++i$2){var type$1=types[i$2];"1"==type$1&&"r"==cur?types[i$2]="n":isStrong.test(type$1)&&(cur=type$1,"r"==type$1&&(types[i$2]="R"))}for(var i$3=1,prev$1=types[0];i$3<len-1;++i$3){var type$2=types[i$3];"+"==type$2&&"1"==prev$1&&"1"==types[i$3+1]?types[i$3]="1":","!=type$2||prev$1!=types[i$3+1]||"1"!=prev$1&&"n"!=prev$1||(types[i$3]=prev$1),prev$1=type$2}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);for(var replace=i$4&&"!"==types[i$4-1]||end<len&&"1"==types[end]?"1":"N",j=i$4;j<end;++j)types[j]=replace;i$4=end-1}}for(var i$5=0,cur$1=outerType;i$5<len;++i$5){var type$4=types[i$5];"L"==cur$1&&"1"==type$4?types[i$5]="L":isStrong.test(type$4)&&(cur$1=type$4)}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);for(var before="L"==(i$6?types[i$6-1]:outerType),replace$1=before==("L"==(end$1<len?types[end$1]:outerType))?before?"L":"R":outerType,j$1=i$6;j$1<end$1;++j$1)types[j$1]=replace$1;i$6=end$1-1}for(var m,order=[],i$7=0;i$7<len;)if(countsAsLeft.test(types[i$7])){var start=i$7;for(++i$7;i$7<len&&countsAsLeft.test(types[i$7]);++i$7);order.push(new BidiSpan(0,start,i$7))}else{var pos=i$7,at=order.length;for(++i$7;i$7<len&&"L"!=types[i$7];++i$7);for(var j$2=pos;j$2<i$7;)if(countsAsNum.test(types[j$2])){pos<j$2&&order.splice(at,0,new BidiSpan(1,pos,j$2));var nstart=j$2;for(++j$2;j$2<i$7&&countsAsNum.test(types[j$2]);++j$2);order.splice(at,0,new BidiSpan(2,nstart,j$2)),pos=j$2}else++j$2;pos<i$7&&order.splice(at,0,new BidiSpan(1,pos,i$7))}return"ltr"==direction&&(1==order[0].level&&(m=str.match(/^\s+/))&&(order[0].from=m[0].length,order.unshift(new BidiSpan(0,0,m[0].length))),1==lst(order).level&&(m=str.match(/\s+$/))&&(lst(order).to-=m[0].length,order.push(new BidiSpan(0,len-m[0].length,len)))),"rtl"==direction?order.reverse():order}}(),noHandlers=[],on=function(emitter,type,f){if(emitter.addEventListener)emitter.addEventListener(type,f,!1);else if(emitter.attachEvent)emitter.attachEvent("on"+type,f);else{var map$$1=emitter._handlers||(emitter._handlers={});map$$1[type]=(map$$1[type]||noHandlers).concat(f)}},dragAndDrop=function(){if(ie&&ie_version<9)return!1;var div=elt("div");return"draggable"in div||"dragDrop"in div}(),splitLinesAuto=3!="\n\nb".split(/\n/).length?function(string){for(var pos=0,result=[],l=string.length;pos<=l;){var nl=string.indexOf("\n",pos);-1==nl&&(nl=string.length);var line=string.slice(pos,"\r"==string.charAt(nl-1)?nl-1:nl),rt=line.indexOf("\r");-1!=rt?(result.push(line.slice(0,rt)),pos+=rt+1):(result.push(line),pos=nl+1)}return result}:function(string){return string.split(/\r\n?|\n/)},hasSelection=window.getSelection?function(te){try{return te.selectionStart!=te.selectionEnd}catch(e){return!1}}:function(te){var range$$1;try{range$$1=te.ownerDocument.selection.createRange()}catch(e){}return!(!range$$1||range$$1.parentElement()!=te)&&0!=range$$1.compareEndPoints("StartToEnd",range$$1)},hasCopyEvent=function(){var e=elt("div");return"oncopy"in e||(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy)}(),badZoomedRects=null,modes={},mimeModes={},modeExtensions={},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)||void 0},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);if("string"==typeof match?ch==match:ch&&(match.test?match.test(ch):match(ch)))return++this.pos,ch},StringStream.prototype.eatWhile=function(match){for(var start=this.pos;this.eat(match););return this.pos>start},StringStream.prototype.eatSpace=function(){for(var this$1=this,start=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this$1.pos;return this.pos>start},StringStream.prototype.skipToEnd=function(){this.pos=this.string.length},StringStream.prototype.skipTo=function(ch){var found=this.string.indexOf(ch,this.pos);if(found>-1)return this.pos=found,!0},StringStream.prototype.backUp=function(n){this.pos-=n},StringStream.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=countColumn(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),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("string"!=typeof pattern){var match=this.string.slice(this.pos).match(pattern);return match&&match.index>0?null:(match&&!1!==consume&&(this.pos+=match[0].length),match)}var cased=function(str){return caseInsensitive?str.toLowerCase():str};if(cased(this.string.substr(this.pos,pattern.length))==cased(pattern))return!1!==consume&&(this.pos+=pattern.length),!0},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)};var SavedContext=function(state,lookAhead){this.state=state,this.lookAhead=lookAhead},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);return null!=line&&n>this.maxLookAhead&&(this.maxLookAhead=n),line},Context.prototype.baseToken=function(n){var this$1=this;if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=n;)this$1.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++,this.maxLookAhead>0&&this.maxLookAhead--},Context.fromSaved=function(doc,saved,line){return saved instanceof SavedContext?new Context(doc,copyState(doc.mode,saved.state),line,saved.lookAhead):new Context(doc,copyState(doc.mode,saved),line)},Context.prototype.save=function(copy){var state=!1!==copy?copyState(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new SavedContext(state,this.maxLookAhead):state};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},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);var measureText,styleToClassCache={},styleToClassCacheWithMode={},operationGroup=null,orphanDelayedCallbacks=null,nullRect={left:0,right:0,top:0,bottom:0},NativeScrollbars=function(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");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&&measure.clientHeight>0&&(0==sWidth&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:needsV?sWidth:0,bottom:needsH?sWidth:0}},NativeScrollbars.prototype.setScrollLeft=function(pos){this.horiz.scrollLeft!=pos&&(this.horiz.scrollLeft=pos),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},NativeScrollbars.prototype.setScrollTop=function(pos){this.vert.scrollTop!=pos&&(this.vert.scrollTop=pos),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},NativeScrollbars.prototype.zeroWidthHack=function(){var w=mac&&!mac_geMountainLion?"12px":"18px";this.horiz.style.height=this.vert.style.width=w,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Delayed,this.disableVert=new Delayed},NativeScrollbars.prototype.enableZeroWidthBar=function(bar,delay,type){function maybeDisable(){var box=bar.getBoundingClientRect();("vert"==type?document.elementFromPoint(box.right-1,(box.top+box.bottom)/2):document.elementFromPoint((box.right+box.left)/2,box.bottom-1))!=bar?bar.style.pointerEvents="none":delay.set(1e3,maybeDisable)}bar.style.pointerEvents="auto",delay.set(1e3,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(){};var scrollbarModel={native:NativeScrollbars,null:NullScrollbars},nextOpId=0,DisplayUpdate=function(cm,viewport,force){var display=cm.display;this.viewport=viewport,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){hasHandler(emitter,type)&&this.events.push(arguments)},DisplayUpdate.prototype.finish=function(){for(var this$1=this,i=0;i<this.events.length;i++)signal.apply(null,this$1.events[i])};var wheelSamples=0,wheelPixelsPerUnit=null;ie?wheelPixelsPerUnit=-.53:gecko?wheelPixelsPerUnit=15:chrome?wheelPixelsPerUnit=-.7:safari&&(wheelPixelsPerUnit=-1/3);var Selection=function(ranges,primIndex){this.ranges=ranges,this.primIndex=primIndex};Selection.prototype.primary=function(){return this.ranges[this.primIndex]},Selection.prototype.equals=function(other){var this$1=this;if(other==this)return!0;if(other.primIndex!=this.primIndex||other.ranges.length!=this.ranges.length)return!1;for(var i=0;i<this.ranges.length;i++){var here=this$1.ranges[i],there=other.ranges[i];if(!equalCursorPos(here.anchor,there.anchor)||!equalCursorPos(here.head,there.head))return!1}return!0},Selection.prototype.deepCopy=function(){for(var this$1=this,out=[],i=0;i<this.ranges.length;i++)out[i]=new Range(copyPos(this$1.ranges[i].anchor),copyPos(this$1.ranges[i].head));return new Selection(out,this.primIndex)},Selection.prototype.somethingSelected=function(){for(var this$1=this,i=0;i<this.ranges.length;i++)if(!this$1.ranges[i].empty())return!0;return!1},Selection.prototype.contains=function(pos,end){var this$1=this;end||(end=pos);for(var i=0;i<this.ranges.length;i++){var range=this$1.ranges[i];if(cmp(end,range.from())>=0&&cmp(pos,range.to())<=0)return i}return-1};var Range=function(anchor,head){this.anchor=anchor,this.head=head};Range.prototype.from=function(){return minPos(this.anchor,this.head)},Range.prototype.to=function(){return maxPos(this.anchor,this.head)},Range.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},LeafChunk.prototype={chunkSize:function(){return this.lines.length},removeInner:function(at,n){for(var this$1=this,i=at,e=at+n;i<e;++i){var line=this$1.lines[i];this$1.height-=line.height,cleanUpLine(line),signalLater(line,"delete")}this.lines.splice(at,n)},collapse:function(lines){lines.push.apply(lines,this.lines)},insertInner:function(at,lines,height){var this$1=this;this.height+=height,this.lines=this.lines.slice(0,at).concat(lines).concat(this.lines.slice(at));for(var i=0;i<lines.length;++i)lines[i].parent=this$1},iterN:function(at,n,op){for(var this$1=this,e=at+n;at<e;++at)if(op(this$1.lines[at]))return!0}},BranchChunk.prototype={chunkSize:function(){return this.size},removeInner:function(at,n){var this$1=this;this.size-=n;for(var i=0;i<this.children.length;++i){var child=this$1.children[i],sz=child.chunkSize();if(at<sz){var rm=Math.min(n,sz-at),oldHeight=child.height;if(child.removeInner(at,rm),this$1.height-=oldHeight-child.height,sz==rm&&(this$1.children.splice(i--,1),child.parent=null),0==(n-=rm))break;at=0}else at-=sz}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 this$1=this,i=0;i<this.children.length;++i)this$1.children[i].collapse(lines)},insertInner:function(at,lines,height){var this$1=this;this.size+=lines.length,this.height+=height;for(var i=0;i<this.children.length;++i){var child=this$1.children[i],sz=child.chunkSize();if(at<=sz){if(child.insertInner(at,lines,height),child.lines&&child.lines.length>50){for(var remaining=child.lines.length%25+25,pos=remaining;pos<child.lines.length;){var leaf=new LeafChunk(child.lines.slice(pos,pos+=25));child.height-=leaf.height,this$1.children.splice(++i,0,leaf),leaf.parent=this$1}child.lines=child.lines.slice(0,remaining),this$1.maybeSpill()}break}at-=sz}},maybeSpill:function(){if(!(this.children.length<=10)){var me=this;do{var sibling=new BranchChunk(me.children.splice(me.children.length-5,5));if(me.parent){me.size-=sibling.size,me.height-=sibling.height;var myIndex=indexOf(me.parent.children,me);me.parent.children.splice(myIndex+1,0,sibling)}else{var copy=new BranchChunk(me.children);copy.parent=me,me.children=[copy,sibling],me=copy}sibling.parent=me.parent}while(me.children.length>10);me.parent.maybeSpill()}},iterN:function(at,n,op){for(var this$1=this,i=0;i<this.children.length;++i){var child=this$1.children[i],sz=child.chunkSize();if(at<sz){var used=Math.min(n,sz-at);if(child.iterN(at,used,op))return!0;if(0==(n-=used))break;at=0}else at-=sz}}};var LineWidget=function(doc,node,options){var this$1=this;if(options)for(var opt in options)options.hasOwnProperty(opt)&&(this$1[opt]=options[opt]);this.doc=doc,this.node=node};LineWidget.prototype.clear=function(){var this$1=this,cm=this.doc.cm,ws=this.line.widgets,line=this.line,no=lineNo(line);if(null!=no&&ws){for(var i=0;i<ws.length;++i)ws[i]==this$1&&ws.splice(i--,1);ws.length||(line.widgets=null);var height=widgetHeight(this);updateLineHeight(line,Math.max(0,line.height-height)),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,oldH=this.height,cm=this.doc.cm,line=this.line;this.height=null;var diff=widgetHeight(this)-oldH;diff&&(updateLineHeight(line,line.height+diff),cm&&runInOp(cm,function(){cm.curOp.forceUpdate=!0,adjustScrollWhenAboveVisible(cm,line,diff),signalLater(cm,"lineWidgetChanged",cm,this$1,lineNo(line))}))},eventMixin(LineWidget);var nextMarkerId=0,TextMarker=function(doc,type){this.lines=[],this.type=type,this.doc=doc,this.id=++nextMarkerId};TextMarker.prototype.clear=function(){var this$1=this;if(!this.explicitlyCleared){var cm=this.doc.cm,withOp=cm&&!cm.curOp;if(withOp&&startOperation(cm),hasHandler(this,"clear")){var found=this.find();found&&signalLater(this,"clear",found.from,found.to)}for(var min=null,max=null,i=0;i<this.lines.length;++i){var line=this$1.lines[i],span=getMarkedSpanFor(line.markedSpans,this$1);cm&&!this$1.collapsed?regLineChange(cm,lineNo(line),"text"):cm&&(null!=span.to&&(max=lineNo(line)),null!=span.from&&(min=lineNo(line))),line.markedSpans=removeMarkedSpan(line.markedSpans,span),null==span.from&&this$1.collapsed&&!lineIsHidden(this$1.doc,line)&&cm&&updateLineHeight(line,textHeight(cm.display))}if(cm&&this.collapsed&&!cm.options.lineWrapping)for(var i$1=0;i$1<this.lines.length;++i$1){var visual=visualLine(this$1.lines[i$1]),len=lineLength(visual);len>cm.display.maxLineLength&&(cm.display.maxLine=visual,cm.display.maxLineLength=len,cm.display.maxLineChanged=!0)}null!=min&&cm&&this.collapsed&&regChange(cm,min,max+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,cm&&reCheckSelection(cm.doc)),cm&&signalLater(cm,"markerCleared",cm,this,min,max),withOp&&endOperation(cm),this.parent&&this.parent.clear()}},TextMarker.prototype.find=function(side,lineObj){var this$1=this;null==side&&"bookmark"==this.type&&(side=1);for(var from,to,i=0;i<this.lines.length;++i){var line=this$1.lines[i],span=getMarkedSpanFor(line.markedSpans,this$1);if(null!=span.from&&(from=Pos(lineObj?line:lineNo(line),span.from),-1==side))return from;if(null!=span.to&&(to=Pos(lineObj?line:lineNo(line),span.to),1==side))return to}return from&&{from:from,to:to}},TextMarker.prototype.changed=function(){var this$1=this,pos=this.find(-1,!0),widget=this,cm=this.doc.cm;pos&&cm&&runInOp(cm,function(){var line=pos.line,lineN=lineNo(pos.line),view=findViewForLine(cm,lineN);if(view&&(clearLineMeasurementCacheFor(view),cm.curOp.selectionChanged=cm.curOp.forceUpdate=!0),cm.curOp.updateMaxLine=!0,!lineIsHidden(widget.doc,line)&&null!=widget.height){var oldHeight=widget.height;widget.height=null;var dHeight=widgetHeight(widget)-oldHeight;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;op.maybeHiddenMarkers&&-1!=indexOf(op.maybeHiddenMarkers,this)||(op.maybeUnhiddenMarkers||(op.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(line)},TextMarker.prototype.detachLine=function(line){if(this.lines.splice(indexOf(this.lines,line),1),!this.lines.length&&this.doc.cm){var op=this.doc.cm.curOp;(op.maybeHiddenMarkers||(op.maybeHiddenMarkers=[])).push(this)}},eventMixin(TextMarker);var SharedTextMarker=function(markers,primary){var this$1=this;this.markers=markers,this.primary=primary;for(var i=0;i<markers.length;++i)markers[i].parent=this$1};SharedTextMarker.prototype.clear=function(){var this$1=this;if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var i=0;i<this.markers.length;++i)this$1.markers[i].clear();signalLater(this,"clear")}},SharedTextMarker.prototype.find=function(side,lineObj){return this.primary.find(side,lineObj)},eventMixin(SharedTextMarker);var nextDocId=0,Doc=function(text,mode,firstLine,lineSep,direction){if(!(this instanceof Doc))return new Doc(text,mode,firstLine,lineSep,direction);null==firstLine&&(firstLine=0),BranchChunk.call(this,[new LeafChunk([new Line("",null)])]),this.first=firstLine,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,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="rtl"==direction?"rtl":"ltr",this.extend=!1,"string"==typeof text&&(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,iter:function(from,to,op){op?this.iterN(from-this.first,to-from,op):this.iterN(this.first,this.first+this.size,from)},insert:function(at,lines){for(var height=0,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)},getValue:function(lineSep){var lines=getLines(this,this.first,this.first+this.size);return!1===lineSep?lines: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:!0},!0),this.cm&&scrollToCoords(this.cm,0,0),setSelection(this,simpleSelection(top),sel_dontScroll)}),replaceRange:function(code,from,to,origin){replaceRange(this,code,from=clipPos(this,from),to=to?clipPos(this,to):from,origin)},getRange:function(from,to,lineSep){var lines=getBetween(this,clipPos(this,from),clipPos(this,to));return!1===lineSep?lines: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){return"number"==typeof line&&(line=getLine(this,line)),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$$1=this.sel.primary();return null==start||"head"==start?range$$1.head:"anchor"==start?range$$1.anchor:"end"==start||"to"==start||!1===start?range$$1.to():range$$1.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:docMethodOp(function(line,ch,options){setSimpleSelection(this,clipPos(this,"number"==typeof line?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){extendSelections(this,clipPosArray(this,map(this.sel.ranges,f)),options)}),setSelections:docMethodOp(function(ranges,primary,options){var this$1=this;if(ranges.length){for(var out=[],i=0;i<ranges.length;i++)out[i]=new Range(clipPos(this$1,ranges[i].anchor),clipPos(this$1,ranges[i].head));null==primary&&(primary=Math.min(ranges.length-1,this.sel.primIndex)),setSelection(this,normalizeSelection(out,primary),options)}}),addSelection:docMethodOp(function(anchor,head,options){var ranges=this.sel.ranges.slice(0);ranges.push(new Range(clipPos(this,anchor),clipPos(this,head||anchor))),setSelection(this,normalizeSelection(ranges,ranges.length-1),options)}),getSelection:function(lineSep){for(var lines,this$1=this,ranges=this.sel.ranges,i=0;i<ranges.length;i++){var sel=getBetween(this$1,ranges[i].from(),ranges[i].to());lines=lines?lines.concat(sel):sel}return!1===lineSep?lines:lines.join(lineSep||this.lineSeparator())},getSelections:function(lineSep){for(var this$1=this,parts=[],ranges=this.sel.ranges,i=0;i<ranges.length;i++){var sel=getBetween(this$1,ranges[i].from(),ranges[i].to());!1!==lineSep&&(sel=sel.join(lineSep||this$1.lineSeparator())),parts[i]=sel}return parts},replaceSelection:function(code,collapse,origin){for(var dup=[],i=0;i<this.sel.ranges.length;i++)dup[i]=code;this.replaceSelections(dup,collapse,origin||"+input")},replaceSelections:docMethodOp(function(code,collapse,origin){for(var this$1=this,changes=[],sel=this.sel,i=0;i<sel.ranges.length;i++){var range$$1=sel.ranges[i];changes[i]={from:range$$1.from(),to:range$$1.to(),text:this$1.splitLines(code[i]),origin:origin}}for(var newSel=collapse&&"end"!=collapse&&computeReplacedSel(this,changes,collapse),i$1=changes.length-1;i$1>=0;i$1--)makeChange(this$1,changes[i$1]);newSel?setSelectionReplaceHistory(this,newSel):this.cm&&ensureCursorVisible(this.cm)}),undo:docMethodOp(function(){makeChangeFromHistory(this,"undo")}),redo:docMethodOp(function(){makeChangeFromHistory(this,"redo")}),undoSelection:docMethodOp(function(){makeChangeFromHistory(this,"undo",!0)}),redoSelection:docMethodOp(function(){makeChangeFromHistory(this,"redo",!0)}),setExtending:function(val){this.extend=val},getExtending:function(){return this.extend},historySize:function(){for(var hist=this.history,done=0,undone=0,i=0;i<hist.done.length;i++)hist.done[i].ranges||++done;for(var i$1=0;i$1<hist.undone.length;i$1++)hist.undone[i$1].ranges||++undone;return{undo:done,redo:undone}},clearHistory:function(){this.history=new History(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(forceSplit){return forceSplit&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(gen){return this.history.generation==(gen||this.cleanGeneration)},getHistory:function(){return{done:copyHistoryArray(this.history.done),undone:copyHistoryArray(this.history.undone)}},setHistory:function(histData){var hist=this.history=new History(this.history.maxGeneration);hist.done=copyHistoryArray(histData.done.slice(0),null,!0),hist.undone=copyHistoryArray(histData.undone.slice(0),null,!0)},setGutterMarker:docMethodOp(function(line,gutterID,value){return changeLine(this,line,"gutter",function(line){var markers=line.gutterMarkers||(line.gutterMarkers={});return markers[gutterID]=value,!value&&isEmpty(markers)&&(line.gutterMarkers=null),!0})}),clearGutter:docMethodOp(function(gutterID){var this$1=this;this.iter(function(line){line.gutterMarkers&&line.gutterMarkers[gutterID]&&changeLine(this$1,line,"gutter",function(){return line.gutterMarkers[gutterID]=null,isEmpty(line.gutterMarkers)&&(line.gutterMarkers=null),!0})})}),lineInfo:function(line){var n;if("number"==typeof line){if(!isLine(this,line))return null;if(n=line,!(line=getLine(this,line)))return null}else if(null==(n=lineNo(line)))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,"gutter"==where?"gutter":"class",function(line){var prop="text"==where?"textClass":"background"==where?"bgClass":"gutter"==where?"gutterClass":"wrapClass";if(line[prop]){if(classTest(cls).test(line[prop]))return!1;line[prop]+=" "+cls}else line[prop]=cls;return!0})}),removeLineClass:docMethodOp(function(handle,where,cls){return changeLine(this,handle,"gutter"==where?"gutter":"class",function(line){var prop="text"==where?"textClass":"background"==where?"bgClass":"gutter"==where?"gutterClass":"wrapClass",cur=line[prop];if(!cur)return!1;if(null==cls)line[prop]=null;else{var found=cur.match(classTest(cls));if(!found)return!1;var end=found.index+found[0].length;line[prop]=cur.slice(0,found.index)+(found.index&&end!=cur.length?" ":"")+cur.slice(end)||null}return!0})}),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&&(null==options.nodeType?options.widget:options),insertLeft:options&&options.insertLeft,clearWhenEmpty:!1,shared:options&&options.shared,handleMouseEvents:options&&options.handleMouseEvents};return pos=clipPos(this,pos),markText(this,pos,pos,realOpts,"bookmark")},findMarksAt:function(pos){var markers=[],spans=getLine(this,(pos=clipPos(this,pos)).line).markedSpans;if(spans)for(var i=0;i<spans.length;++i){var span=spans[i];(null==span.from||span.from<=pos.ch)&&(null==span.to||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$$1=from.line;return 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];null!=span.to&&lineNo$$1==from.line&&from.ch>=span.to||null==span.from&&lineNo$$1!=from.line||null!=span.from&&lineNo$$1==to.line&&span.from>=to.ch||filter&&!filter(span.marker)||found.push(span.marker.parent||span.marker)}++lineNo$$1}),found},getAllMarks:function(){var markers=[];return this.iter(function(line){var sps=line.markedSpans;if(sps)for(var i=0;i<sps.length;++i)null!=sps[i].from&&markers.push(sps[i].marker)}),markers},posFromIndex:function(off){var ch,lineNo$$1=this.first,sepSize=this.lineSeparator().length;return this.iter(function(line){var sz=line.text.length+sepSize;if(sz>off)return ch=off,!0;off-=sz,++lineNo$$1}),clipPos(this,Pos(lineNo$$1,ch))},indexFromPos:function(coords){var index=(coords=clipPos(this,coords)).ch;if(coords.line<this.first||coords.ch<0)return 0;var sepSize=this.lineSeparator().length;return this.iter(this.first,coords.line,function(line){index+=line.text.length+sepSize}),index},copy:function(copyHistory){var doc=new Doc(getLines(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return doc.scrollTop=this.scrollTop,doc.scrollLeft=this.scrollLeft,doc.sel=this.sel,doc.extend=!1,copyHistory&&(doc.history.undoDepth=this.history.undoDepth,doc.setHistory(this.getHistory())),doc},linkedDoc:function(options){options||(options={});var from=this.first,to=this.first+this.size;null!=options.from&&options.from>from&&(from=options.from),null!=options.to&&options.to<to&&(to=options.to);var copy=new Doc(getLines(this,from,to),options.mode||this.modeOption,from,this.lineSep,this.direction);return options.sharedHist&&(copy.history=this.history),(this.linked||(this.linked=[])).push({doc:copy,sharedHist:options.sharedHist}),copy.linked=[{doc:this,isParent:!0,sharedHist:options.sharedHist}],copySharedMarkers(copy,findSharedMarkers(this)),copy},unlinkDoc:function(other){var this$1=this;if(other instanceof CodeMirror$1&&(other=other.doc),this.linked)for(var i=0;i<this.linked.length;++i)if(this$1.linked[i].doc==other){this$1.linked.splice(i,1),other.unlinkDoc(this$1),detachSharedMarkers(findSharedMarkers(this$1));break}if(other.history==this.history){var splitIds=[other.id];linkedDocs(other,function(doc){return splitIds.push(doc.id)},!0),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){return this.lineSep?str.split(this.lineSep):splitLinesAuto(str)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:docMethodOp(function(dir){"rtl"!=dir&&(dir="ltr"),dir!=this.direction&&(this.direction=dir,this.iter(function(line){return line.order=null}),this.cm&&directionChanged(this.cm))})}),Doc.prototype.eachLine=Doc.prototype.iter;for(var lastDrop=0,globalsRegistered=!1,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:"/",127:"Delete",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},i=0;i<10;i++)keyNames[i+48]=keyNames[i+96]=String(i);for(var i$1=65;i$1<=90;i$1++)keyNames[i$1]=String.fromCharCode(i$1);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"},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"},keyMap.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","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;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;return range.head.ch==len&&range.head.line<cm.lastLine()?{from:range.head,to:Pos(range.head.line+1,0)}:{from:range.head,to:Pos(range.head.line,len)}}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;return{from:cm.coordsChar({left:0,top:top},"div"),to:range.from()}})},delWrappedLineRight:function(cm){return deleteNearSelection(cm,function(range){var top=cm.charCoords(range.head,"div").top+5,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,pos=cm.coordsChar({left:0,top:top},"div");return pos.ch<cm.getLine(pos.line).search(/\S/)?lineStartSmart(cm,range.head):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,"char")},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){for(var spaces=[],ranges=cm.listSelections(),tabSize=cm.options.tabSize,i=0;i<ranges.length;i++){var pos=ranges[i].from(),col=countColumn(cm.getLine(pos.line),pos.ch,tabSize);spaces.push(spaceStr(tabSize-col%tabSize))}cm.replaceSelections(spaces)},defaultTab:function(cm){cm.somethingSelected()?cm.indentSelection("add"):cm.execCommand("insertTab")},transposeChars:function(cm){return runInOp(cm,function(){for(var ranges=cm.listSelections(),newSel=[],i=0;i<ranges.length;i++)if(ranges[i].empty()){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)),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;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(){for(var sels=cm.listSelections(),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,!0);ensureCursorVisible(cm)})},openLine:function(cm){return cm.replaceSelection("\n","start")},toggleOverwrite:function(cm){return cm.toggleOverwrite()}},stopSeq=new Delayed,lastStoppedKey=null,PastClick=function(time,pos,button){this.time=time,this.pos=pos,this.button=button};PastClick.prototype.compare=function(time,pos,button){return this.time+400>time&&0==cmp(pos,this.pos)&&button==this.button};var lastClick,lastDoubleClick,Init={toString:function(){return"CodeMirror.Init"}},defaults={},optionHandlers={};CodeMirror$1.defaults=defaults,CodeMirror$1.optionHandlers=optionHandlers;var initHooks=[];CodeMirror$1.defineInitHook=function(f){return initHooks.push(f)};var lastCopied=null,ContentEditableInput=function(cm){this.cm=cm,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Delayed,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};ContentEditableInput.prototype.init=function(display){function onCopyCut(e){if(!signalDOMEvent(cm,e)){if(cm.somethingSelected())setLastCopied({lineWise:!1,text:cm.getSelections()}),"cut"==e.type&&cm.replaceSelection("",null,"cut");else{if(!cm.options.lineWiseCopyCut)return;var ranges=copyableRanges(cm);setLastCopied({lineWise:!0,text:ranges.text}),"cut"==e.type&&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");if(e.clipboardData.setData("Text",content),e.clipboardData.getData("Text")==content)return void e.preventDefault()}var kludge=hiddenTextarea(),te=kludge.firstChild;cm.display.lineSpace.insertBefore(kludge,cm.display.lineSpace.firstChild),te.value=lastCopied.text.join("\n");var hadFocus=document.activeElement;selectInput(te),setTimeout(function(){cm.display.lineSpace.removeChild(kludge),hadFocus.focus(),hadFocus==div&&input.showPrimarySelection()},50)}}var this$1=this,input=this,cm=input.cm,div=input.div=display.lineDiv;disableBrowserMagic(div,cm.options.spellcheck),on(div,"paste",function(e){signalDOMEvent(cm,e)||handlePaste(e,cm)||ie_version<=11&&setTimeout(operation(cm,function(){return this$1.updateFromDOM()}),20)}),on(div,"compositionstart",function(e){this$1.composing={data:e.data,done:!1}}),on(div,"compositionupdate",function(e){this$1.composing||(this$1.composing={data:e.data,done:!1})}),on(div,"compositionend",function(e){this$1.composing&&(e.data!=this$1.composing.data&&this$1.readFromDOMSoon(),this$1.composing.done=!0)}),on(div,"touchstart",function(){return input.forceCompositionEnd()}),on(div,"input",function(){this$1.composing||this$1.readFromDOMSoon()}),on(div,"copy",onCopyCut),on(div,"cut",onCopyCut)},ContentEditableInput.prototype.prepareSelection=function(){var result=prepareSelection(this.cm,!1);return result.focus=this.cm.state.focused,result},ContentEditableInput.prototype.showSelection=function(info,takeFocus){info&&this.cm.display.view.length&&((info.focus||takeFocus)&&this.showPrimarySelection(),this.showMultipleSelections(info))},ContentEditableInput.prototype.showPrimarySelection=function(){var sel=window.getSelection(),cm=this.cm,prim=cm.doc.sel.primary(),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();else{var curAnchor=domToPos(cm,sel.anchorNode,sel.anchorOffset),curFocus=domToPos(cm,sel.focusNode,sel.focusOffset);if(!curAnchor||curAnchor.bad||!curFocus||curFocus.bad||0!=cmp(minPos(curAnchor,curFocus),from)||0!=cmp(maxPos(curAnchor,curFocus),to)){var view=cm.display.view,start=from.line>=cm.display.viewFrom&&posToDOM(cm,from)||{node:view[0].measure.map[2],offset:0},end=to.line<cm.display.viewTo&&posToDOM(cm,to);if(!end){var measure=view[view.length-1].measure,map$$1=measure.maps?measure.maps[measure.maps.length-1]:measure.map;end={node:map$$1[map$$1.length-1],offset:map$$1[map$$1.length-2]-map$$1[map$$1.length-3]}}if(start&&end){var rng,old=sel.rangeCount&&sel.getRangeAt(0);try{rng=range(start.node,start.offset,end.offset,end.node)}catch(e){}rng&&(!gecko&&cm.state.focused?(sel.collapse(start.node,start.offset),rng.collapsed||(sel.removeAllRanges(),sel.addRange(rng))):(sel.removeAllRanges(),sel.addRange(rng)),old&&null==sel.anchorNode?sel.addRange(old):gecko&&this.startGracePeriod()),this.rememberSelection()}else sel.removeAllRanges()}}},ContentEditableInput.prototype.startGracePeriod=function(){var this$1=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){this$1.gracePeriod=!1,this$1.selectionChanged()&&this$1.cm.operation(function(){return this$1.cm.curOp.selectionChanged=!0})},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=window.getSelection();this.lastAnchorNode=sel.anchorNode,this.lastAnchorOffset=sel.anchorOffset,this.lastFocusNode=sel.focusNode,this.lastFocusOffset=sel.focusOffset},ContentEditableInput.prototype.selectionInEditor=function(){var sel=window.getSelection();if(!sel.rangeCount)return!1;var node=sel.getRangeAt(0).commonAncestorContainer;return contains(this.div,node)},ContentEditableInput.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()||this.showSelection(this.prepareSelection(),!0),this.div.focus())},ContentEditableInput.prototype.blur=function(){this.div.blur()},ContentEditableInput.prototype.getField=function(){return this.div},ContentEditableInput.prototype.supportsTouch=function(){return!0},ContentEditableInput.prototype.receivedFocus=function(){function poll(){input.cm.state.focused&&(input.pollSelection(),input.polling.set(input.cm.options.pollInterval,poll))}var input=this;this.selectionInEditor()?this.pollSelection():runInOp(this.cm,function(){return input.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,poll)},ContentEditableInput.prototype.selectionChanged=function(){var sel=window.getSelection();return sel.anchorNode!=this.lastAnchorNode||sel.anchorOffset!=this.lastAnchorOffset||sel.focusNode!=this.lastFocusNode||sel.focusOffset!=this.lastFocusOffset},ContentEditableInput.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var sel=window.getSelection(),cm=this.cm;if(android&&chrome&&this.cm.options.gutters.length&&isInGutter(sel.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();if(!this.composing){this.rememberSelection();var anchor=domToPos(cm,sel.anchorNode,sel.anchorOffset),head=domToPos(cm,sel.focusNode,sel.focusOffset);anchor&&head&&runInOp(cm,function(){setSelection(cm.doc,simpleSelection(anchor,head),sel_dontScroll),(anchor.bad||head.bad)&&(cm.curOp.selectionChanged=!0)})}}},ContentEditableInput.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var cm=this.cm,display=cm.display,sel=cm.doc.sel.primary(),from=sel.from(),to=sel.to();if(0==from.ch&&from.line>cm.firstLine()&&(from=Pos(from.line-1,getLine(cm.doc,from.line-1).length)),to.ch==getLine(cm.doc,to.line).text.length&&to.line<cm.lastLine()&&(to=Pos(to.line+1,0)),from.line<display.viewFrom||to.line>display.viewTo-1)return!1;var fromIndex,fromLine,fromNode;from.line==display.viewFrom||0==(fromIndex=findViewIndex(cm,from.line))?(fromLine=lineNo(display.view[0].line),fromNode=display.view[0].node):(fromLine=lineNo(display.view[fromIndex].line),fromNode=display.view[fromIndex-1].node.nextSibling);var toLine,toNode,toIndex=findViewIndex(cm,to.line);if(toIndex==display.view.length-1?(toLine=display.viewTo-1,toNode=display.lineDiv.lastChild):(toLine=lineNo(display.view[toIndex+1].line)-1,toNode=display.view[toIndex+1].node.previousSibling),!fromNode)return!1;for(var newText=cm.doc.splitLines(domTextBetween(cm,fromNode,toNode,fromLine,toLine)),oldText=getBetween(cm.doc,Pos(fromLine,0),Pos(toLine,getLine(cm.doc,toLine).text.length));newText.length>1&&oldText.length>1;)if(lst(newText)==lst(oldText))newText.pop(),oldText.pop(),toLine--;else{if(newText[0]!=oldText[0])break;newText.shift(),oldText.shift(),fromLine++}for(var cutFront=0,cutEnd=0,newTop=newText[0],oldTop=oldText[0],maxCutFront=Math.min(newTop.length,oldTop.length);cutFront<maxCutFront&&newTop.charCodeAt(cutFront)==oldTop.charCodeAt(cutFront);)++cutFront;for(var newBot=lst(newText),oldBot=lst(oldText),maxCutEnd=Math.min(newBot.length-(1==newText.length?cutFront:0),oldBot.length-(1==oldText.length?cutFront:0));cutEnd<maxCutEnd&&newBot.charCodeAt(newBot.length-cutEnd-1)==oldBot.charCodeAt(oldBot.length-cutEnd-1);)++cutEnd;if(1==newText.length&&1==oldText.length&&fromLine==from.line)for(;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),chTo=Pos(toLine,oldText.length?lst(oldText).length-cutEnd:0);return newText.length>1||newText[0]||cmp(chFrom,chTo)?(replaceRange(cm.doc,newText,chFrom,chTo,"+input"),!0):void 0},ContentEditableInput.prototype.ensurePolled=function(){this.forceCompositionEnd()},ContentEditableInput.prototype.reset=function(){this.forceCompositionEnd()},ContentEditableInput.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},ContentEditableInput.prototype.readFromDOMSoon=function(){var this$1=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout(function(){if(this$1.readDOMTimeout=null,this$1.composing){if(!this$1.composing.done)return;this$1.composing=null}this$1.updateFromDOM()},80))},ContentEditableInput.prototype.updateFromDOM=function(){var this$1=this;!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){0!=e.charCode&&(e.preventDefault(),this.cm.isReadOnly()||operation(this.cm,applyTextInput)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},ContentEditableInput.prototype.readOnlyChanged=function(val){this.div.contentEditable=String("nocursor"!=val)},ContentEditableInput.prototype.onContextMenu=function(){},ContentEditableInput.prototype.resetPosition=function(){},ContentEditableInput.prototype.needsContentAttribute=!0;var TextareaInput=function(cm){this.cm=cm,this.prevInput="",this.pollingFast=!1,this.polling=new Delayed,this.hasSelection=!1,this.composing=null};TextareaInput.prototype.init=function(display){function prepareCopyCut(e){if(!signalDOMEvent(cm,e)){if(cm.somethingSelected())setLastCopied({lineWise:!1,text:cm.getSelections()});else{if(!cm.options.lineWiseCopyCut)return;var ranges=copyableRanges(cm);setLastCopied({lineWise:!0,text:ranges.text}),"cut"==e.type?cm.setSelections(ranges.ranges,null,sel_dontScroll):(input.prevInput="",te.value=ranges.text.join("\n"),selectInput(te))}"cut"==e.type&&(cm.state.cutIncoming=!0)}}var this$1=this,input=this,cm=this.cm,div=this.wrapper=hiddenTextarea(),te=this.textarea=div.firstChild;display.wrapper.insertBefore(div,display.wrapper.firstChild),ios&&(te.style.width="0px"),on(te,"input",function(){ie&&ie_version>=9&&this$1.hasSelection&&(this$1.hasSelection=null),input.poll()}),on(te,"paste",function(e){signalDOMEvent(cm,e)||handlePaste(e,cm)||(cm.state.pasteIncoming=!0,input.fastPoll())}),on(te,"cut",prepareCopyCut),on(te,"copy",prepareCopyCut),on(display.scroller,"paste",function(e){eventInWidget(display,e)||signalDOMEvent(cm,e)||(cm.state.pasteIncoming=!0,input.focus())}),on(display.lineSpace,"selectstart",function(e){eventInWidget(display,e)||e_preventDefault(e)}),on(te,"compositionstart",function(){var start=cm.getCursor("from");input.composing&&input.composing.range.clear(),input.composing={start:start,range:cm.markText(start,cm.getCursor("to"),{className:"CodeMirror-composing"})}}),on(te,"compositionend",function(){input.composing&&(input.poll(),input.composing.range.clear(),input.composing=null)})},TextareaInput.prototype.prepareSelection=function(){var cm=this.cm,display=cm.display,doc=cm.doc,result=prepareSelection(cm);if(cm.options.moveInputWithCursor){var headPos=cursorCoords(cm,doc.sel.primary().head,"div"),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 display=this.cm.display;removeChildrenAndAdd(display.cursorDiv,drawn.cursors),removeChildrenAndAdd(display.selectionDiv,drawn.selection),null!=drawn.teTop&&(this.wrapper.style.top=drawn.teTop+"px",this.wrapper.style.left=drawn.teLeft+"px")},TextareaInput.prototype.reset=function(typing){if(!this.contextMenuPending&&!this.composing){var cm=this.cm;if(cm.somethingSelected()){this.prevInput="";var content=cm.getSelection();this.textarea.value=content,cm.state.focused&&selectInput(this.textarea),ie&&ie_version>=9&&(this.hasSelection=content)}else typing||(this.prevInput=this.textarea.value="",ie&&ie_version>=9&&(this.hasSelection=null))}},TextareaInput.prototype.getField=function(){return this.textarea},TextareaInput.prototype.supportsTouch=function(){return!1},TextareaInput.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!mobile||activeElt()!=this.textarea))try{this.textarea.focus()}catch(e){}},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()},TextareaInput.prototype.slowPoll=function(){var this$1=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){this$1.poll(),this$1.cm.state.focused&&this$1.slowPoll()})},TextareaInput.prototype.fastPoll=function(){function p(){input.poll()||missed?(input.pollingFast=!1,input.slowPoll()):(missed=!0,input.polling.set(60,p))}var missed=!1,input=this;input.pollingFast=!0,input.polling.set(20,p)},TextareaInput.prototype.poll=function(){var this$1=this,cm=this.cm,input=this.textarea,prevInput=this.prevInput;if(this.contextMenuPending||!cm.state.focused||hasSelection(input)&&!prevInput&&!this.composing||cm.isReadOnly()||cm.options.disableInput||cm.state.keySeq)return!1;var text=input.value;if(text==prevInput&&!cm.somethingSelected())return!1;if(ie&&ie_version>=9&&this.hasSelection===text||mac&&/[\uf700-\uf7ff]/.test(text))return cm.display.input.reset(),!1;if(cm.doc.sel==cm.display.selForContextMenu){var first=text.charCodeAt(0);if(8203!=first||prevInput||(prevInput="​"),8666==first)return this.reset(),this.cm.execCommand("undo")}for(var same=0,l=Math.min(prevInput.length,text.length);same<l&&prevInput.charCodeAt(same)==text.charCodeAt(same);)++same;return runInOp(cm,function(){applyTextInput(cm,text.slice(same),prevInput.length-same,null,this$1.composing?"*compose":null),text.length>1e3||text.indexOf("\n")>-1?input.value=this$1.prevInput="":this$1.prevInput=text,this$1.composing&&(this$1.composing.range.clear(),this$1.composing.range=cm.markText(this$1.composing.start,cm.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},TextareaInput.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},TextareaInput.prototype.onKeyPress=function(){ie&&ie_version>=9&&(this.hasSelection=null),this.fastPoll()},TextareaInput.prototype.onContextMenu=function(e){function prepareSelectAllHack(){if(null!=te.selectionStart){var selected=cm.somethingSelected(),extval="​"+(selected?te.value:"");te.value="⇚",te.value=extval,input.prevInput=selected?"":"​",te.selectionStart=1,te.selectionEnd=extval.length,display.selForContextMenu=cm.doc.sel}}function rehide(){if(input.contextMenuPending=!1,input.wrapper.style.cssText=oldWrapperCSS,te.style.cssText=oldCSS,ie&&ie_version<9&&display.scrollbars.setScrollTop(display.scroller.scrollTop=scrollPos),null!=te.selectionStart){(!ie||ie&&ie_version<9)&&prepareSelectAllHack();var i=0,poll=function(){display.selForContextMenu==cm.doc.sel&&0==te.selectionStart&&te.selectionEnd>0&&"​"==input.prevInput?operation(cm,selectAll)(cm):i++<10?display.detectingSelectAll=setTimeout(poll,500):(display.selForContextMenu=null,display.input.reset())};display.detectingSelectAll=setTimeout(poll,200)}}var input=this,cm=input.cm,display=cm.display,te=input.textarea,pos=posFromMouse(cm,e),scrollPos=display.scroller.scrollTop;if(pos&&!presto){cm.options.resetSelectionOnContextMenu&&-1==cm.doc.sel.contains(pos)&&operation(cm,setSelection)(cm.doc,simpleSelection(pos),sel_dontScroll);var oldCSS=te.style.cssText,oldWrapperCSS=input.wrapper.style.cssText;input.wrapper.style.cssText="position: absolute";var wrapperBox=input.wrapper.getBoundingClientRect();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=window.scrollY),display.input.focus(),webkit&&window.scrollTo(null,oldScrollY),display.input.reset(),cm.somethingSelected()||(te.value=input.prevInput=" "),input.contextMenuPending=!0,display.selForContextMenu=cm.doc.sel,clearTimeout(display.detectingSelectAll),ie&&ie_version>=9&&prepareSelectAllHack(),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){val||this.reset(),this.textarea.disabled="nocursor"==val},TextareaInput.prototype.setUneditable=function(){},TextareaInput.prototype.needsContentAttribute=!1,function(CodeMirror){function option(name,deflt,handle,notOnInit){CodeMirror.defaults[name]=deflt,handle&&(optionHandlers[name]=notOnInit?function(cm,val,old){old!=Init&&handle(cm,val,old)}:handle)}var optionHandlers=CodeMirror.optionHandlers;CodeMirror.defineOption=option,CodeMirror.Init=Init,option("value","",function(cm,val){return cm.setValue(val)},!0),option("mode",null,function(cm,val){cm.doc.modeOption=val,loadMode(cm)},!0),option("indentUnit",2,loadMode,!0),option("indentWithTabs",!1),option("smartIndent",!0),option("tabSize",4,function(cm){resetModeState(cm),clearCaches(cm),regChange(cm)},!0),option("lineSeparator",null,function(cm,val){if(cm.doc.lineSep=val,val){var newBreaks=[],lineNo=cm.doc.first;cm.doc.iter(function(line){for(var pos=0;;){var found=line.text.indexOf(val,pos);if(-1==found)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-\u200f\u2028\u2029\ufeff]/g,function(cm,val,old){cm.state.specialChars=new RegExp(val.source+(val.test("\t")?"":"|\t"),"g"),old!=Init&&cm.refresh()}),option("specialCharPlaceholder",defaultSpecialCharPlaceholder,function(cm){return cm.refresh()},!0),option("electricChars",!0),option("inputStyle",mobile?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),option("spellcheck",!1,function(cm,val){return cm.getInputField().spellcheck=val},!0),option("rtlMoveVisually",!windows),option("wholeLineUpdateBefore",!0),option("theme","default",function(cm){themeChanged(cm),guttersChanged(cm)},!0),option("keyMap","default",function(cm,val,old){var next=getKeyMap(val),prev=old!=Init&&getKeyMap(old);prev&&prev.detach&&prev.detach(cm,next),next.attach&&next.attach(cm,prev||null)}),option("extraKeys",null),option("configureMouse",null),option("lineWrapping",!1,wrappingChanged,!0),option("gutters",[],function(cm){setGuttersForLineNumbers(cm.options),guttersChanged(cm)},!0),option("fixedGutter",!0,function(cm,val){cm.display.gutters.style.left=val?compensateForHScroll(cm.display)+"px":"0",cm.refresh()},!0),option("coverGutterNextToScrollbar",!1,function(cm){return updateScrollbars(cm)},!0),option("scrollbarStyle","native",function(cm){initScrollbars(cm),updateScrollbars(cm),cm.display.scrollbars.setScrollTop(cm.doc.scrollTop),cm.display.scrollbars.setScrollLeft(cm.doc.scrollLeft)},!0),option("lineNumbers",!1,function(cm){setGuttersForLineNumbers(cm.options),guttersChanged(cm)},!0),option("firstLineNumber",1,guttersChanged,!0),option("lineNumberFormatter",function(integer){return integer},guttersChanged,!0),option("showCursorWhenSelecting",!1,updateSelection,!0),option("resetSelectionOnContextMenu",!0),option("lineWiseCopyCut",!0),option("pasteLinesPerSelection",!0),option("readOnly",!1,function(cm,val){"nocursor"==val&&(onBlur(cm),cm.display.input.blur()),cm.display.input.readOnlyChanged(val)}),option("disableInput",!1,function(cm,val){val||cm.display.input.reset()},!0),option("dragDrop",!0,dragDropChanged),option("allowDropFileTypes",null),option("cursorBlinkRate",530),option("cursorScrollMargin",0),option("cursorHeight",1,updateSelection,!0),option("singleCursorHeightPerLine",!0,updateSelection,!0),option("workTime",100),option("workDelay",100),option("flattenSpans",!0,resetModeState,!0),option("addModeClass",!1,resetModeState,!0),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()},!0),option("maxHighlightLength",1e4,resetModeState,!0),option("moveInputWithCursor",!0,function(cm,val){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)},!0)}(CodeMirror$1),function(CodeMirror){var optionHandlers=CodeMirror.optionHandlers,helpers=CodeMirror.helpers={};CodeMirror.prototype={constructor:CodeMirror,focus:function(){window.focus(),this.display.input.focus()},setOption:function(option,value){var options=this.options,old=options[option];options[option]==value&&"mode"!=option||(options[option]=value,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$$1,bottom){this.state.keyMaps[bottom?"push":"unshift"](getKeyMap(map$$1))},removeKeyMap:function(map$$1){for(var maps=this.state.keyMaps,i=0;i<maps.length;++i)if(maps[i]==map$$1||maps[i].name==map$$1)return maps.splice(i,1),!0},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){for(var this$1=this,overlays=this.state.overlays,i=0;i<overlays.length;++i){var cur=overlays[i].modeSpec;if(cur==spec||"string"==typeof spec&&cur.name==spec)return overlays.splice(i,1),this$1.state.modeGen++,void regChange(this$1)}}),indentLine:methodOp(function(n,dir,aggressive){"string"!=typeof dir&&"number"!=typeof dir&&(dir=null==dir?this.options.smartIndent?"smart":"prev":dir?"add":"subtract"),isLine(this.doc,n)&&indentLine(this,n,dir,aggressive)}),indentSelection:methodOp(function(how){for(var this$1=this,ranges=this.doc.sel.ranges,end=-1,i=0;i<ranges.length;i++){var range$$1=ranges[i];if(range$$1.empty())range$$1.head.line>end&&(indentLine(this$1,range$$1.head.line,how,!0),end=range$$1.head.line,i==this$1.doc.sel.primIndex&&ensureCursorVisible(this$1));else{var from=range$$1.from(),to=range$$1.to(),start=Math.max(end,from.line);end=Math.min(this$1.lastLine(),to.line-(to.ch?0:1))+1;for(var j=start;j<end;++j)indentLine(this$1,j,how);var newRanges=this$1.doc.sel.ranges;0==from.ch&&ranges.length==newRanges.length&&newRanges[i].from().ch>0&&replaceOneSelection(this$1.doc,i,new Range(from,newRanges[i].to()),sel_dontScroll)}}}),getTokenAt:function(pos,precise){return takeToken(this,pos,precise)},getLineTokens:function(line,precise){return takeToken(this,Pos(line),precise,!0)},getTokenTypeAt:function(pos){pos=clipPos(this.doc,pos);var type,styles=getLineStyles(this,getLine(this.doc,pos.line)),before=0,after=(styles.length-1)/2,ch=pos.ch;if(0==ch)type=styles[2];else for(;;){var mid=before+after>>1;if((mid?styles[2*mid-1]:0)>=ch)after=mid;else{if(!(styles[2*mid+1]<ch)){type=styles[2*mid+2];break}before=mid+1}}var cut=type?type.indexOf("overlay "):-1;return cut<0?type:0==cut?null:type.slice(0,cut-1)},getModeAt:function(pos){var mode=this.doc.mode;return mode.innerMode?CodeMirror.innerMode(mode,this.getTokenAt(pos).state).mode:mode},getHelper:function(pos,type){return this.getHelpers(pos,type)[0]},getHelpers:function(pos,type){var this$1=this,found=[];if(!helpers.hasOwnProperty(type))return found;var help=helpers[type],mode=this.getModeAt(pos);if("string"==typeof mode[type])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]];val&&found.push(val)}else mode.helperType&&help[mode.helperType]?found.push(help[mode.helperType]):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];cur.pred(mode,this$1)&&-1==indexOf(found,cur.val)&&found.push(cur.val)}return found},getStateAfter:function(line,precise){var doc=this.doc;return line=clipLine(doc,null==line?doc.first+doc.size-1:line),getContextBefore(this,line+1,precise).state},cursorCoords:function(start,mode){var pos,range$$1=this.doc.sel.primary();return pos=null==start?range$$1.head:"object"==typeof start?clipPos(this.doc,start):start?range$$1.from():range$$1.to(),cursorCoords(this,pos,mode||"page")},charCoords:function(pos,mode){return charCoords(this,clipPos(this.doc,pos),mode||"page")},coordsChar:function(coords,mode){return coords=fromCoordSystem(this,coords,mode||"page"),coordsChar(this,coords.left,coords.top)},lineAtHeight:function(height,mode){return height=fromCoordSystem(this,{top:height,left:0},mode||"page").top,lineAtHeight(this.doc,height+this.display.viewOffset)},heightAtLine:function(line,mode,includeWidgets){var lineObj,end=!1;if("number"==typeof line){var last=this.doc.first+this.doc.size-1;line<this.doc.first?line=this.doc.first:line>last&&(line=last,end=!0),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,top=(pos=cursorCoords(this,clipPos(this.doc,pos))).bottom,left=pos.left;if(node.style.position="absolute",node.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(node),display.sizer.appendChild(node),"over"==vert)top=pos.top;else if("above"==vert||"near"==vert){var vspace=Math.max(display.wrapper.clientHeight,this.doc.height),hspace=Math.max(display.sizer.clientWidth,display.lineSpace.clientWidth);("above"==vert||pos.bottom+node.offsetHeight>vspace)&&pos.top>node.offsetHeight?top=pos.top-node.offsetHeight:pos.bottom+node.offsetHeight<=vspace&&(top=pos.bottom),left+node.offsetWidth>hspace&&(left=hspace-node.offsetWidth)}node.style.top=top+"px",node.style.left=node.style.right="","right"==horiz?(left=display.sizer.clientWidth-node.offsetWidth,node.style.right="0px"):("left"==horiz?left=0:"middle"==horiz&&(left=(display.sizer.clientWidth-node.offsetWidth)/2),node.style.left=left+"px"),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 this$1=this,dir=1;amount<0&&(dir=-1,amount=-amount);for(var cur=clipPos(this.doc,from),i=0;i<amount&&!(cur=findPosH(this$1.doc,cur,dir,unit,visually)).hitSide;++i);return cur},moveH:methodOp(function(dir,unit){var this$1=this;this.extendSelectionsBy(function(range$$1){return this$1.display.shift||this$1.doc.extend||range$$1.empty()?findPosH(this$1.doc,range$$1.head,dir,unit,this$1.options.rtlMoveVisually):dir<0?range$$1.from():range$$1.to()},sel_move)}),deleteH:methodOp(function(dir,unit){var sel=this.doc.sel,doc=this.doc;sel.somethingSelected()?doc.replaceSelection("",null,"+delete"):deleteNearSelection(this,function(range$$1){var other=findPosH(doc,range$$1.head,dir,unit,!1);return dir<0?{from:other,to:range$$1.head}:{from:range$$1.head,to:other}})}),findPosV:function(from,amount,unit,goalColumn){var this$1=this,dir=1,x=goalColumn;amount<0&&(dir=-1,amount=-amount);for(var cur=clipPos(this.doc,from),i=0;i<amount;++i){var coords=cursorCoords(this$1,cur,"div");if(null==x?x=coords.left:coords.left=x,(cur=findPosV(this$1,coords,dir,unit)).hitSide)break}return cur},moveV:methodOp(function(dir,unit){var this$1=this,doc=this.doc,goals=[],collapse=!this.display.shift&&!doc.extend&&doc.sel.somethingSelected();if(doc.extendSelectionsBy(function(range$$1){if(collapse)return dir<0?range$$1.from():range$$1.to();var headPos=cursorCoords(this$1,range$$1.head,"div");null!=range$$1.goalColumn&&(headPos.left=range$$1.goalColumn),goals.push(headPos.left);var pos=findPosV(this$1,headPos,dir,unit);return"page"==unit&&range$$1==doc.sel.primary()&&addToScrollTop(this$1,charCoords(this$1,pos,"div").top-headPos.top),pos},sel_move),goals.length)for(var i=0;i<doc.sel.ranges.length;i++)doc.sel.ranges[i].goalColumn=goals[i]}),findWordAt:function(pos){var line=getLine(this.doc,pos.line).text,start=pos.ch,end=pos.ch;if(line){var helper=this.getHelper(pos,"wordChars");"before"!=pos.sticky&&end!=line.length||!start?++end:--start;for(var startChar=line.charAt(start),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)};start>0&&check(line.charAt(start-1));)--start;for(;end<line.length&&check(line.charAt(end));)++end}return new Range(Pos(pos.line,start),Pos(pos.line,end))},toggleOverwrite:function(value){null!=value&&value==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?addClass(this.display.cursorDiv,"CodeMirror-overwrite"):rmClass(this.display.cursorDiv,"CodeMirror-overwrite"),signal(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==activeElt()},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$$1,margin){null==range$$1?(range$$1={from:this.doc.sel.primary().head,to:null},null==margin&&(margin=this.options.cursorScrollMargin)):"number"==typeof range$$1?range$$1={from:Pos(range$$1,0),to:null}:null==range$$1.from&&(range$$1={from:range$$1,to:null}),range$$1.to||(range$$1.to=range$$1.from),range$$1.margin=margin||0,null!=range$$1.from.line?scrollToRange(this,range$$1):scrollToCoordsRange(this,range$$1.from,range$$1.to,range$$1.margin)}),setSize:methodOp(function(width,height){var this$1=this,interpret=function(val){return"number"==typeof val||/^\d+$/.test(String(val))?val+"px":val};null!=width&&(this.display.wrapper.style.width=interpret(width)),null!=height&&(this.display.wrapper.style.height=interpret(height)),this.options.lineWrapping&&clearLineMeasurementCache(this);var lineNo$$1=this.display.viewFrom;this.doc.iter(lineNo$$1,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$$1,"widget");break}++lineNo$$1}),this.curOp.forceUpdate=!0,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=!0,clearCaches(this),scrollToCoords(this,this.doc.scrollLeft,this.doc.scrollTop),updateGutterSpace(this),(null==oldHeight||Math.abs(oldHeight-textHeight(this.display))>.5)&&estimateLineHeights(this),signal(this,"refresh",this)}),swapDoc:methodOp(function(doc){var old=this.doc;return old.cm=null,attachDoc(this,doc),clearCaches(this),this.display.input.reset(),scrollToCoords(this,doc.scrollLeft,doc.scrollTop),this.curOp.forceScroll=!0,signalLater(this,"swapDoc",this,old),old}),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){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})}}(CodeMirror$1);var dontDelegate="iter insert remove copy getEditor constructor".split(" ");for(var prop in Doc.prototype)Doc.prototype.hasOwnProperty(prop)&&indexOf(dontDelegate,prop)<0&&(CodeMirror$1.prototype[prop]=function(method){return function(){return method.apply(this.doc,arguments)}}(Doc.prototype[prop]));return eventMixin(Doc),CodeMirror$1.inputStyles={textarea:TextareaInput,contenteditable:ContentEditableInput},CodeMirror$1.defineMode=function(name){CodeMirror$1.defaults.mode||"null"==name||(CodeMirror$1.defaults.mode=name),defineMode.apply(this,arguments)},CodeMirror$1.defineMIME=function(mime,spec){mimeModes[mime]=spec},CodeMirror$1.defineMode("null",function(){return{token:function(stream){return stream.skipToEnd()}}}),CodeMirror$1.defineMIME("text/plain","null"),CodeMirror$1.defineExtension=function(name,func){CodeMirror$1.prototype[name]=func},CodeMirror$1.defineDocExtension=function(name,func){Doc.prototype[name]=func},CodeMirror$1.fromTextArea=function(textarea,options){function save(){textarea.value=cm.getValue()}if(options=options?copyObj(options):{},options.value=textarea.value,!options.tabindex&&textarea.tabIndex&&(options.tabindex=textarea.tabIndex),!options.placeholder&&textarea.placeholder&&(options.placeholder=textarea.placeholder),null==options.autofocus){var hasFocus=activeElt();options.autofocus=hasFocus==textarea||null!=textarea.getAttribute("autofocus")&&hasFocus==document.body}var realSubmit;if(textarea.form&&(on(textarea.form,"submit",save),!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,save(),textarea.parentNode.removeChild(cm.getWrapperElement()),textarea.style.display="",textarea.form&&(off(textarea.form,"submit",save),"function"==typeof textarea.form.submit&&(textarea.form.submit=realSubmit))}},textarea.style.display="none";var cm=CodeMirror$1(function(node){return textarea.parentNode.insertBefore(node,textarea.nextSibling)},options);return cm},function(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}(CodeMirror$1),CodeMirror$1.version="5.35.0",CodeMirror$1})},{}],7:[function(require,module,exports){"use strict";function indent(state,textAfter){var levels=state.levels;return(levels&&0!==levels.length?levels[levels.length-1]-(this.electricInput.test(textAfter)?1:0):state.indentLevel)*this.config.indentUnit}var _codemirror2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(require("codemirror")),_graphqlLanguageServiceParser=require("graphql-language-service-parser");_codemirror2.default.defineMode("graphql-results",function(config){var parser=(0,_graphqlLanguageServiceParser.onlineParser)({eatWhitespace:function(stream){return stream.eatSpace()},lexRules:LexRules,parseRules:ParseRules,editorConfig:{tabSize:config.tabSize}});return{config:config,startState:parser.startState,token:parser.token,indent:indent,electricInput:/^\s*[}\]]/,fold:"brace",closeBrackets:{pairs:'[]{}""',explode:"[]{}"}}});var LexRules={Punctuation:/^\[|]|\{|\}|:|,/,Number:/^-?(?:0|(?:[1-9][0-9]*))(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?/,String:/^"(?:[^"\\]|\\(?:"|\/|\\|b|f|n|r|t|u[0-9a-fA-F]{4}))*"?/,Keyword:/^true|false|null/},ParseRules={Document:[(0,_graphqlLanguageServiceParser.p)("{"),(0,_graphqlLanguageServiceParser.list)("Entry",(0,_graphqlLanguageServiceParser.p)(",")),(0,_graphqlLanguageServiceParser.p)("}")],Entry:[(0,_graphqlLanguageServiceParser.t)("String","def"),(0,_graphqlLanguageServiceParser.p)(":"),"Value"],Value:function(token){switch(token.kind){case"Number":return"NumberValue";case"String":return"StringValue";case"Punctuation":switch(token.value){case"[":return"ListValue";case"{":return"ObjectValue"}return null;case"Keyword":switch(token.value){case"true":case"false":return"BooleanValue";case"null":return"NullValue"}return null}},NumberValue:[(0,_graphqlLanguageServiceParser.t)("Number","number")],StringValue:[(0,_graphqlLanguageServiceParser.t)("String","string")],BooleanValue:[(0,_graphqlLanguageServiceParser.t)("Keyword","builtin")],NullValue:[(0,_graphqlLanguageServiceParser.t)("Keyword","keyword")],ListValue:[(0,_graphqlLanguageServiceParser.p)("["),(0,_graphqlLanguageServiceParser.list)("Value",(0,_graphqlLanguageServiceParser.p)(",")),(0,_graphqlLanguageServiceParser.p)("]")],ObjectValue:[(0,_graphqlLanguageServiceParser.p)("{"),(0,_graphqlLanguageServiceParser.list)("ObjectField",(0,_graphqlLanguageServiceParser.p)(",")),(0,_graphqlLanguageServiceParser.p)("}")],ObjectField:[(0,_graphqlLanguageServiceParser.t)("String","property"),(0,_graphqlLanguageServiceParser.p)(":"),"Value"]}},{codemirror:6,"graphql-language-service-parser":29}],8:[function(require,module,exports){"use strict";function isMetaField(fieldDef){return"__"===fieldDef.name.slice(0,2)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.getFieldReference=function(typeInfo){return{kind:"Field",schema:typeInfo.schema,field:typeInfo.fieldDef,type:isMetaField(typeInfo.fieldDef)?null:typeInfo.parentType}},exports.getDirectiveReference=function(typeInfo){return{kind:"Directive",schema:typeInfo.schema,directive:typeInfo.directiveDef}},exports.getArgumentReference=function(typeInfo){return typeInfo.directiveDef?{kind:"Argument",schema:typeInfo.schema,argument:typeInfo.argDef,directive:typeInfo.directiveDef}:{kind:"Argument",schema:typeInfo.schema,argument:typeInfo.argDef,field:typeInfo.fieldDef,type:isMetaField(typeInfo.fieldDef)?null:typeInfo.parentType}},exports.getEnumValueReference=function(typeInfo){return{kind:"EnumValue",value:typeInfo.enumValue,type:(0,_graphql.getNamedType)(typeInfo.inputType)}},exports.getTypeReference=function(typeInfo,type){return{kind:"Type",schema:typeInfo.schema,type:type||typeInfo.type}};var _graphql=require("graphql")},{graphql:174}],9:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(stack,fn){for(var reverseStateStack=[],state=stack;state&&state.kind;)reverseStateStack.push(state),state=state.prevState;for(var i=reverseStateStack.length-1;i>=0;i--)fn(reverseStateStack[i])}},{}],10:[function(require,module,exports){"use strict";function getFieldDef(schema,type,fieldName){return fieldName===_introspection.SchemaMetaFieldDef.name&&schema.getQueryType()===type?_introspection.SchemaMetaFieldDef:fieldName===_introspection.TypeMetaFieldDef.name&&schema.getQueryType()===type?_introspection.TypeMetaFieldDef:fieldName===_introspection.TypeNameMetaFieldDef.name&&(0,_graphql.isCompositeType)(type)?_introspection.TypeNameMetaFieldDef:type.getFields?type.getFields()[fieldName]:void 0}function find(array,predicate){for(var i=0;i<array.length;i++)if(predicate(array[i]))return array[i]}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(schema,tokenState){var info={schema:schema,type:null,parentType:null,inputType:null,directiveDef:null,fieldDef:null,argDef:null,argDefs:null,objectFieldDefs:null};return(0,_forEachState2.default)(tokenState,function(state){switch(state.kind){case"Query":case"ShortQuery":info.type=schema.getQueryType();break;case"Mutation":info.type=schema.getMutationType();break;case"Subscription":info.type=schema.getSubscriptionType();break;case"InlineFragment":case"FragmentDefinition":state.type&&(info.type=schema.getType(state.type));break;case"Field":case"AliasedField":info.fieldDef=info.type&&state.name?getFieldDef(schema,info.parentType,state.name):null,info.type=info.fieldDef&&info.fieldDef.type;break;case"SelectionSet":info.parentType=(0,_graphql.getNamedType)(info.type);break;case"Directive":info.directiveDef=state.name&&schema.getDirective(state.name);break;case"Arguments":var parentDef="Field"===state.prevState.kind?info.fieldDef:"Directive"===state.prevState.kind?info.directiveDef:"AliasedField"===state.prevState.kind?state.prevState.name&&getFieldDef(schema,info.parentType,state.prevState.name):null;info.argDefs=parentDef&&parentDef.args;break;case"Argument":if(info.argDef=null,info.argDefs)for(var i=0;i<info.argDefs.length;i++)if(info.argDefs[i].name===state.name){info.argDef=info.argDefs[i];break}info.inputType=info.argDef&&info.argDef.type;break;case"EnumValue":var enumType=(0,_graphql.getNamedType)(info.inputType);info.enumValue=enumType instanceof _graphql.GraphQLEnumType?find(enumType.getValues(),function(val){return val.value===state.name}):null;break;case"ListValue":var nullableType=(0,_graphql.getNullableType)(info.inputType);info.inputType=nullableType instanceof _graphql.GraphQLList?nullableType.ofType:null;break;case"ObjectValue":var objectType=(0,_graphql.getNamedType)(info.inputType);info.objectFieldDefs=objectType instanceof _graphql.GraphQLInputObjectType?objectType.getFields():null;break;case"ObjectField":var objectField=state.name&&info.objectFieldDefs?info.objectFieldDefs[state.name]:null;info.inputType=objectField&&objectField.type;break;case"NamedType":info.type=schema.getType(state.name)}}),info};var _graphql=require("graphql"),_introspection=require("graphql/type/introspection"),_forEachState2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(require("./forEachState"))},{"./forEachState":9,graphql:174,"graphql/type/introspection":201}],11:[function(require,module,exports){"use strict";function filterAndSortList(list,text){return text?filterNonEmpty(filterNonEmpty(list.map(function(entry){return{proximity:getProximity(normalizeText(entry.text),text),entry:entry}}),function(pair){return pair.proximity<=2}),function(pair){return!pair.entry.isDeprecated}).sort(function(a,b){return(a.entry.isDeprecated?1:0)-(b.entry.isDeprecated?1:0)||a.proximity-b.proximity||a.entry.text.length-b.entry.text.length}).map(function(pair){return pair.entry}):filterNonEmpty(list,function(entry){return!entry.isDeprecated})}function filterNonEmpty(array,predicate){var filtered=array.filter(predicate);return 0===filtered.length?array:filtered}function normalizeText(text){return text.toLowerCase().replace(/\W/g,"")}function getProximity(suggestion,text){var proximity=lexicalDistance(text,suggestion);return suggestion.length>text.length&&(proximity-=suggestion.length-text.length-1,proximity+=0===suggestion.indexOf(text)?0:.5),proximity}function lexicalDistance(a,b){var i=void 0,j=void 0,d=[],aLength=a.length,bLength=b.length;for(i=0;i<=aLength;i++)d[i]=[i];for(j=1;j<=bLength;j++)d[0][j]=j;for(i=1;i<=aLength;i++)for(j=1;j<=bLength;j++){var cost=a[i-1]===b[j-1]?0:1;d[i][j]=Math.min(d[i-1][j]+1,d[i][j-1]+1,d[i-1][j-1]+cost),i>1&&j>1&&a[i-1]===b[j-2]&&a[i-2]===b[j-1]&&(d[i][j]=Math.min(d[i][j],d[i-2][j-2]+cost))}return d[aLength][bLength]}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(cursor,token,list){var hints=filterAndSortList(list,normalizeText(token.string));if(hints){var tokenStart=null!==token.type&&/"|\w/.test(token.string[0])?token.start:token.end;return{list:hints,from:{line:cursor.line,column:tokenStart},to:{line:cursor.line,column:token.end}}}}},{}],12:[function(require,module,exports){"use strict";function createState(options){return{options:options instanceof Function?{render:options}:!0===options?{}:options}}function getHoverTime(cm){var options=cm.state.info.options;return options&&options.hoverTime||500}function onMouseOver(cm,e){var state=cm.state.info,target=e.target||e.srcElement;if("SPAN"===target.nodeName&&void 0===state.hoverTimeout){var box=target.getBoundingClientRect(),hoverTime=getHoverTime(cm);state.hoverTimeout=setTimeout(onHover,hoverTime);var onMouseMove=function(){clearTimeout(state.hoverTimeout),state.hoverTimeout=setTimeout(onHover,hoverTime)},onMouseOut=function onMouseOut(){_codemirror2.default.off(document,"mousemove",onMouseMove),_codemirror2.default.off(cm.getWrapperElement(),"mouseout",onMouseOut),clearTimeout(state.hoverTimeout),state.hoverTimeout=void 0},onHover=function(){_codemirror2.default.off(document,"mousemove",onMouseMove),_codemirror2.default.off(cm.getWrapperElement(),"mouseout",onMouseOut),state.hoverTimeout=void 0,onMouseHover(cm,box)};_codemirror2.default.on(document,"mousemove",onMouseMove),_codemirror2.default.on(cm.getWrapperElement(),"mouseout",onMouseOut)}}function onMouseHover(cm,box){var pos=cm.coordsChar({left:(box.left+box.right)/2,top:(box.top+box.bottom)/2}),options=cm.state.info.options,render=options.render||cm.getHelper(pos,"info");if(render){var token=cm.getTokenAt(pos,!0);if(token){var info=render(token,options,cm,pos);info&&showPopup(cm,box,info)}}}function showPopup(cm,box,info){var popup=document.createElement("div");popup.className="CodeMirror-info",popup.appendChild(info),document.body.appendChild(popup);var popupBox=popup.getBoundingClientRect(),popupStyle=popup.currentStyle||window.getComputedStyle(popup),popupWidth=popupBox.right-popupBox.left+parseFloat(popupStyle.marginLeft)+parseFloat(popupStyle.marginRight),popupHeight=popupBox.bottom-popupBox.top+parseFloat(popupStyle.marginTop)+parseFloat(popupStyle.marginBottom),topPos=box.bottom;popupHeight>window.innerHeight-box.bottom-15&&box.top>window.innerHeight-box.bottom&&(topPos=box.top-popupHeight),topPos<0&&(topPos=box.bottom);var leftPos=Math.max(0,window.innerWidth-popupWidth-15);leftPos>box.left&&(leftPos=box.left),popup.style.opacity=1,popup.style.top=topPos+"px",popup.style.left=leftPos+"px";var popupTimeout=void 0,onMouseOverPopup=function(){clearTimeout(popupTimeout)},onMouseOut=function(){clearTimeout(popupTimeout),popupTimeout=setTimeout(hidePopup,200)},hidePopup=function(){_codemirror2.default.off(popup,"mouseover",onMouseOverPopup),_codemirror2.default.off(popup,"mouseout",onMouseOut),_codemirror2.default.off(cm.getWrapperElement(),"mouseout",onMouseOut),popup.style.opacity?(popup.style.opacity=0,setTimeout(function(){popup.parentNode&&popup.parentNode.removeChild(popup)},600)):popup.parentNode&&popup.parentNode.removeChild(popup)};_codemirror2.default.on(popup,"mouseover",onMouseOverPopup),_codemirror2.default.on(popup,"mouseout",onMouseOut),_codemirror2.default.on(cm.getWrapperElement(),"mouseout",onMouseOut)}var _codemirror2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(require("codemirror"));_codemirror2.default.defineOption("info",!1,function(cm,options,old){if(old&&old!==_codemirror2.default.Init){var oldOnMouseOver=cm.state.info.onMouseOver;_codemirror2.default.off(cm.getWrapperElement(),"mouseover",oldOnMouseOver),clearTimeout(cm.state.info.hoverTimeout),delete cm.state.info}if(options){var state=cm.state.info=createState(options);state.onMouseOver=onMouseOver.bind(null,cm),_codemirror2.default.on(cm.getWrapperElement(),"mouseover",state.onMouseOver)}})},{codemirror:6}],13:[function(require,module,exports){"use strict";function parseObj(){var nodeStart=start,members=[];if(expect("{"),!skip("}")){do{members.push(parseMember())}while(skip(","));expect("}")}return{kind:"Object",start:nodeStart,end:lastEnd,members:members}}function parseMember(){var nodeStart=start,key="String"===kind?curToken():null;expect("String"),expect(":");var value=parseVal();return{kind:"Member",start:nodeStart,end:lastEnd,key:key,value:value}}function parseArr(){var nodeStart=start,values=[];if(expect("["),!skip("]")){do{values.push(parseVal())}while(skip(","));expect("]")}return{kind:"Array",start:nodeStart,end:lastEnd,values:values}}function parseVal(){switch(kind){case"[":return parseArr();case"{":return parseObj();case"String":case"Number":case"Boolean":case"Null":var token=curToken();return lex(),token}return expect("Value")}function curToken(){return{kind:kind,start:start,end:end,value:JSON.parse(string.slice(start,end))}}function expect(str){if(kind!==str){var found=void 0;if("EOF"===kind)found="[end of file]";else if(end-start>1)found="`"+string.slice(start,end)+"`";else{var match=string.slice(start).match(/^.+?\b/);found="`"+(match?match[0]:string[start])+"`"}throw syntaxError("Expected "+str+" but found "+found+".")}lex()}function syntaxError(message){return{message:message,start:start,end:end}}function skip(k){if(kind===k)return lex(),!0}function ch(){end<strLen&&(code=++end===strLen?0:string.charCodeAt(end))}function lex(){for(lastEnd=end;9===code||10===code||13===code||32===code;)ch();if(0!==code){switch(start=end,code){case 34:return kind="String",readString();case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return kind="Number",readNumber();case 102:if("false"!==string.slice(start,start+5))break;return end+=4,ch(),void(kind="Boolean");case 110:if("null"!==string.slice(start,start+4))break;return end+=3,ch(),void(kind="Null");case 116:if("true"!==string.slice(start,start+4))break;return end+=3,ch(),void(kind="Boolean")}kind=string[start],ch()}else kind="EOF"}function readString(){for(ch();34!==code&&code>31;)if(92===code)switch(ch(),code){case 34:case 47:case 92:case 98:case 102:case 110:case 114:case 116:ch();break;case 117:ch(),readHex(),readHex(),readHex(),readHex();break;default:throw syntaxError("Bad character escape sequence.")}else{if(end===strLen)throw syntaxError("Unterminated string.");ch()}if(34!==code)throw syntaxError("Unterminated string.");ch()}function readHex(){if(code>=48&&code<=57||code>=65&&code<=70||code>=97&&code<=102)return ch();throw syntaxError("Expected hexadecimal digit.")}function readNumber(){45===code&&ch(),48===code?ch():readDigits(),46===code&&(ch(),readDigits()),69!==code&&101!==code||(ch(),43!==code&&45!==code||ch(),readDigits())}function readDigits(){if(code<48||code>57)throw syntaxError("Expected decimal digit.");do{ch()}while(code>=48&&code<=57)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(str){string=str,strLen=str.length,start=end=lastEnd=-1,ch(),lex();var ast=parseObj();return expect("EOF"),ast};var string=void 0,strLen=void 0,start=void 0,end=void 0,lastEnd=void 0,code=void 0,kind=void 0},{}],14:[function(require,module,exports){"use strict";function onMouseOver(cm,event){var target=event.target||event.srcElement;if("SPAN"===target.nodeName){var box=target.getBoundingClientRect(),cursor={left:(box.left+box.right)/2,top:(box.top+box.bottom)/2};cm.state.jump.cursor=cursor,cm.state.jump.isHoldingModifier&&enableJumpMode(cm)}}function onMouseOut(cm){cm.state.jump.isHoldingModifier||!cm.state.jump.cursor?cm.state.jump.isHoldingModifier&&cm.state.jump.marker&&disableJumpMode(cm):cm.state.jump.cursor=null}function onKeyDown(cm,event){if(!cm.state.jump.isHoldingModifier&&isJumpModifier(event.key)){cm.state.jump.isHoldingModifier=!0,cm.state.jump.cursor&&enableJumpMode(cm);var onClick=function(clickEvent){var destination=cm.state.jump.destination;destination&&cm.state.jump.options.onClick(destination,clickEvent)},onMouseDown=function(_,downEvent){cm.state.jump.destination&&(downEvent.codemirrorIgnore=!0)};_codemirror2.default.on(document,"keyup",function onKeyUp(upEvent){upEvent.code===event.code&&(cm.state.jump.isHoldingModifier=!1,cm.state.jump.marker&&disableJumpMode(cm),_codemirror2.default.off(document,"keyup",onKeyUp),_codemirror2.default.off(document,"click",onClick),cm.off("mousedown",onMouseDown))}),_codemirror2.default.on(document,"click",onClick),cm.on("mousedown",onMouseDown)}}function isJumpModifier(key){return key===(isMac?"Meta":"Control")}function enableJumpMode(cm){if(!cm.state.jump.marker){var cursor=cm.state.jump.cursor,pos=cm.coordsChar(cursor),token=cm.getTokenAt(pos,!0),options=cm.state.jump.options,getDestination=options.getDestination||cm.getHelper(pos,"jump");if(getDestination){var destination=getDestination(token,options,cm);if(destination){var marker=cm.markText({line:pos.line,ch:token.start},{line:pos.line,ch:token.end},{className:"CodeMirror-jump-token"});cm.state.jump.marker=marker,cm.state.jump.destination=destination}}}}function disableJumpMode(cm){var marker=cm.state.jump.marker;cm.state.jump.marker=null,cm.state.jump.destination=null,marker.clear()}var _codemirror2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(require("codemirror"));_codemirror2.default.defineOption("jump",!1,function(cm,options,old){if(old&&old!==_codemirror2.default.Init){var oldOnMouseOver=cm.state.jump.onMouseOver;_codemirror2.default.off(cm.getWrapperElement(),"mouseover",oldOnMouseOver);var oldOnMouseOut=cm.state.jump.onMouseOut;_codemirror2.default.off(cm.getWrapperElement(),"mouseout",oldOnMouseOut),_codemirror2.default.off(document,"keydown",cm.state.jump.onKeyDown),delete cm.state.jump}if(options){var state=cm.state.jump={options:options,onMouseOver:onMouseOver.bind(null,cm),onMouseOut:onMouseOut.bind(null,cm),onKeyDown:onKeyDown.bind(null,cm)};_codemirror2.default.on(cm.getWrapperElement(),"mouseover",state.onMouseOver),_codemirror2.default.on(cm.getWrapperElement(),"mouseout",state.onMouseOut),_codemirror2.default.on(document,"keydown",state.onKeyDown)}});var isMac=navigator&&-1!==navigator.appVersion.indexOf("Mac")},{codemirror:6}],15:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function getVariablesHint(cur,token,options){var state="Invalid"===token.state.kind?token.state.prevState:token.state,kind=state.kind,step=state.step;if("Document"===kind&&0===step)return(0,_hintList2.default)(cur,token,[{text:"{"}]);var variableToType=options.variableToType;if(variableToType){var typeInfo=getTypeInfo(variableToType,token.state);if("Document"===kind||"Variable"===kind&&0===step){var variableNames=Object.keys(variableToType);return(0,_hintList2.default)(cur,token,variableNames.map(function(name){return{text:'"'+name+'": ',type:variableToType[name]}}))}if(("ObjectValue"===kind||"ObjectField"===kind&&0===step)&&typeInfo.fields){var inputFields=Object.keys(typeInfo.fields).map(function(fieldName){return typeInfo.fields[fieldName]});return(0,_hintList2.default)(cur,token,inputFields.map(function(field){return{text:'"'+field.name+'": ',type:field.type,description:field.description}}))}if(console.log(kind),"StringValue"===kind||"NumberValue"===kind||"BooleanValue"===kind||"NullValue"===kind||"ListValue"===kind&&1===step||"ObjectField"===kind&&2===step||"Variable"===kind&&2===step){var namedInputType=(0,_graphql.getNamedType)(typeInfo.type);if(namedInputType instanceof _graphql.GraphQLInputObjectType)return(0,_hintList2.default)(cur,token,[{text:"{"}]);if(namedInputType instanceof _graphql.GraphQLEnumType){var valueMap=namedInputType.getValues(),values=Object.keys(valueMap).map(function(name){return valueMap[name]});return(0,_hintList2.default)(cur,token,values.map(function(value){return{text:'"'+value.name+'"',type:namedInputType,description:value.description}}))}if(namedInputType===_graphql.GraphQLBoolean)return(0,_hintList2.default)(cur,token,[{text:"true",type:_graphql.GraphQLBoolean,description:"Not false."},{text:"false",type:_graphql.GraphQLBoolean,description:"Not true."}])}}}function getTypeInfo(variableToType,tokenState){var info={type:null,fields:null};return(0,_forEachState2.default)(tokenState,function(state){if("Variable"===state.kind)info.type=variableToType[state.name];else if("ListValue"===state.kind){var nullableType=(0,_graphql.getNullableType)(info.type);info.type=nullableType instanceof _graphql.GraphQLList?nullableType.ofType:null}else if("ObjectValue"===state.kind){var objectType=(0,_graphql.getNamedType)(info.type);info.fields=objectType instanceof _graphql.GraphQLInputObjectType?objectType.getFields():null}else if("ObjectField"===state.kind){var objectField=state.name&&info.fields?info.fields[state.name]:null;info.type=objectField&&objectField.type}}),info}var _codemirror2=_interopRequireDefault(require("codemirror")),_graphql=require("graphql"),_forEachState2=_interopRequireDefault(require("../utils/forEachState")),_hintList2=_interopRequireDefault(require("../utils/hintList"));_codemirror2.default.registerHelper("hint","graphql-variables",function(editor,options){var cur=editor.getCursor(),token=editor.getTokenAt(cur),results=getVariablesHint(cur,token,options);return results&&results.list&&results.list.length>0&&(results.from=_codemirror2.default.Pos(results.from.line,results.from.column),results.to=_codemirror2.default.Pos(results.to.line,results.to.column),_codemirror2.default.signal(editor,"hasCompletion",editor,results,token)),results})},{"../utils/forEachState":9,"../utils/hintList":11,codemirror:6,graphql:174}],16:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function validateVariables(editor,variableToType,variablesAST){var errors=[];return variablesAST.members.forEach(function(member){var variableName=member.key.value,type=variableToType[variableName];type?validateValue(type,member.value).forEach(function(_ref){var node=_ref[0],message=_ref[1];errors.push(lintError(editor,node,message))}):errors.push(lintError(editor,member.key,'Variable "$'+variableName+'" does not appear in any GraphQL query.'))}),errors}function validateInputObjectValue(type,valueAST){var providedFields=Object.create(null),fieldErrors=mapCat(valueAST.members,function(member){var fieldName=member.key.value;providedFields[fieldName]=!0;var inputField=type.getFields()[fieldName];return inputField?validateValue(inputField?inputField.type:void 0,member.value):[[member.key,'Type "'+type+'" does not have a field "'+fieldName+'".']]});return Object.keys(type.getFields()).forEach(function(fieldName){providedFields[fieldName]||type.getFields()[fieldName].type instanceof _graphql.GraphQLNonNull&&fieldErrors.push([valueAST,'Object of type "'+type+'" is missing required field "'+fieldName+'".'])}),fieldErrors}function validateValue(type,valueAST){if(type instanceof _graphql.GraphQLNonNull)return"Null"===valueAST.kind?[[valueAST,'Type "'+type+'" is non-nullable and cannot be null.']]:validateValue(type.ofType,valueAST);if("Null"===valueAST.kind)return[];if(type instanceof _graphql.GraphQLList){var itemType=type.ofType;return"Array"===valueAST.kind?mapCat(valueAST.values,function(item){return validateValue(itemType,item)}):validateValue(itemType,valueAST)}return type instanceof _graphql.GraphQLInputObjectType?"Object"!==valueAST.kind?[[valueAST,'Type "'+type+'" must be an Object.']]:validateInputObjectValue(type,valueAST):(type instanceof _graphql.GraphQLInputUnionType&&Object.entries(type.getTypes()).forEach(function(_ref2){var typeName=_ref2[0],possibleType=_ref2[1];if(console.log(typeName,possibleType),possibleType.name===typeName)return validateInputObjectValue(possibleType,valueAST)}),"Boolean"===type.name&&"Boolean"!==valueAST.kind||"String"===type.name&&"String"!==valueAST.kind||"ID"===type.name&&"Number"!==valueAST.kind&&"String"!==valueAST.kind||"Float"===type.name&&"Number"!==valueAST.kind||"Int"===type.name&&("Number"!==valueAST.kind||(0|valueAST.value)!==valueAST.value)?[[valueAST,'Expected value of type "'+type+'".']]:(type instanceof _graphql.GraphQLEnumType||type instanceof _graphql.GraphQLScalarType)&&("String"!==valueAST.kind&&"Number"!==valueAST.kind&&"Boolean"!==valueAST.kind&&"Null"!==valueAST.kind||isNullish(type.parseValue(valueAST.value)))?[[valueAST,'Expected value of type "'+type+'".']]:[])}function lintError(editor,node,message){return{message:message,severity:"error",type:"validation",from:editor.posFromIndex(node.start),to:editor.posFromIndex(node.end)}}function isNullish(value){return null===value||void 0===value||value!==value}function mapCat(array,mapper){return Array.prototype.concat.apply([],array.map(mapper))}var _codemirror2=_interopRequireDefault(require("codemirror")),_graphql=require("graphql"),_jsonParse2=_interopRequireDefault(require("../utils/jsonParse"));_codemirror2.default.registerHelper("lint","graphql-variables",function(text,options,editor){if(!text)return[];var ast=void 0;try{ast=(0,_jsonParse2.default)(text)}catch(syntaxError){if(syntaxError.stack)throw syntaxError;return[lintError(editor,syntaxError,syntaxError.message)]}var variableToType=options.variableToType;return variableToType?validateVariables(editor,variableToType,ast):[]})},{"../utils/jsonParse":13,codemirror:6,graphql:174}],17:[function(require,module,exports){"use strict";function indent(state,textAfter){var levels=state.levels;return(levels&&0!==levels.length?levels[levels.length-1]-(this.electricInput.test(textAfter)?1:0):state.indentLevel)*this.config.indentUnit}function namedKey(style){return{style:style,match:function(token){return"String"===token.kind},update:function(state,token){state.name=token.value.slice(1,-1)}}}var _codemirror2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(require("codemirror")),_graphqlLanguageServiceParser=require("graphql-language-service-parser");_codemirror2.default.defineMode("graphql-variables",function(config){var parser=(0,_graphqlLanguageServiceParser.onlineParser)({eatWhitespace:function(stream){return stream.eatSpace()},lexRules:LexRules,parseRules:ParseRules,editorConfig:{tabSize:config.tabSize}});return{config:config,startState:parser.startState,token:parser.token,indent:indent,electricInput:/^\s*[}\]]/,fold:"brace",closeBrackets:{pairs:'[]{}""',explode:"[]{}"}}});var LexRules={Punctuation:/^\[|]|\{|\}|:|,/,Number:/^-?(?:0|(?:[1-9][0-9]*))(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?/,String:/^"(?:[^"\\]|\\(?:"|\/|\\|b|f|n|r|t|u[0-9a-fA-F]{4}))*"?/,Keyword:/^true|false|null/},ParseRules={Document:[(0,_graphqlLanguageServiceParser.p)("{"),(0,_graphqlLanguageServiceParser.list)("Variable",(0,_graphqlLanguageServiceParser.opt)((0,_graphqlLanguageServiceParser.p)(","))),(0,_graphqlLanguageServiceParser.p)("}")],Variable:[namedKey("variable"),(0,_graphqlLanguageServiceParser.p)(":"),"Value"],Value:function(token){switch(token.kind){case"Number":return"NumberValue";case"String":return"StringValue";case"Punctuation":switch(token.value){case"[":return"ListValue";case"{":return"ObjectValue"}return null;case"Keyword":switch(token.value){case"true":case"false":return"BooleanValue";case"null":return"NullValue"}return null}},NumberValue:[(0,_graphqlLanguageServiceParser.t)("Number","number")],StringValue:[(0,_graphqlLanguageServiceParser.t)("String","string")],BooleanValue:[(0,_graphqlLanguageServiceParser.t)("Keyword","builtin")],NullValue:[(0,_graphqlLanguageServiceParser.t)("Keyword","keyword")],ListValue:[(0,_graphqlLanguageServiceParser.p)("["),(0,_graphqlLanguageServiceParser.list)("Value",(0,_graphqlLanguageServiceParser.opt)((0,_graphqlLanguageServiceParser.p)(","))),(0,_graphqlLanguageServiceParser.p)("]")],ObjectValue:[(0,_graphqlLanguageServiceParser.p)("{"),(0,_graphqlLanguageServiceParser.list)("ObjectField",(0,_graphqlLanguageServiceParser.opt)((0,_graphqlLanguageServiceParser.p)(","))),(0,_graphqlLanguageServiceParser.p)("}")],ObjectField:[namedKey("attribute"),(0,_graphqlLanguageServiceParser.p)(":"),"Value"]}},{codemirror:6,"graphql-language-service-parser":29}],18:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0}),exports.GraphQLLanguageService=void 0;var _graphql=require("graphql"),_getAutocompleteSuggestions2=require("./getAutocompleteSuggestions"),_getHoverInformation2=require("./getHoverInformation"),_getDiagnostics=require("./getDiagnostics"),_getDefinition=require("./getDefinition"),_graphqlLanguageServiceUtils=require("graphql-language-service-utils"),FRAGMENT_DEFINITION=_graphql.Kind.FRAGMENT_DEFINITION,OBJECT_TYPE_DEFINITION=_graphql.Kind.OBJECT_TYPE_DEFINITION,INTERFACE_TYPE_DEFINITION=_graphql.Kind.INTERFACE_TYPE_DEFINITION,ENUM_TYPE_DEFINITION=_graphql.Kind.ENUM_TYPE_DEFINITION,UNION_TYPE_DEFINITION=_graphql.Kind.UNION_TYPE_DEFINITION,SCALAR_TYPE_DEFINITION=_graphql.Kind.SCALAR_TYPE_DEFINITION,INPUT_OBJECT_TYPE_DEFINITION=_graphql.Kind.INPUT_OBJECT_TYPE_DEFINITION,INPUT_UNION_TYPE_DEFINITION=_graphql.Kind.INPUT_UNION_TYPE_DEFINITION,SCALAR_TYPE_EXTENSION=_graphql.Kind.SCALAR_TYPE_EXTENSION,OBJECT_TYPE_EXTENSION=_graphql.Kind.OBJECT_TYPE_EXTENSION,INTERFACE_TYPE_EXTENSION=_graphql.Kind.INTERFACE_TYPE_EXTENSION,UNION_TYPE_EXTENSION=_graphql.Kind.UNION_TYPE_EXTENSION,ENUM_TYPE_EXTENSION=_graphql.Kind.ENUM_TYPE_EXTENSION,INPUT_OBJECT_TYPE_EXTENSION=_graphql.Kind.INPUT_OBJECT_TYPE_EXTENSION,INPUT_UNION_TYPE_EXTENSION=_graphql.Kind.INPUT_UNION_TYPE_EXTENSION,DIRECTIVE_DEFINITION=_graphql.Kind.DIRECTIVE_DEFINITION,FRAGMENT_SPREAD=_graphql.Kind.FRAGMENT_SPREAD,OPERATION_DEFINITION=_graphql.Kind.OPERATION_DEFINITION,NAMED_TYPE=_graphql.Kind.NAMED_TYPE;exports.GraphQLLanguageService=function(){function GraphQLLanguageService(cache){_classCallCheck(this,GraphQLLanguageService),this._graphQLCache=cache,this._graphQLConfig=cache.getGraphQLConfig()}return GraphQLLanguageService.prototype.getDiagnostics=function(query,uri,isRelayCompatMode){var queryHasExtensions,projectConfig,schemaPath,queryAST,range,source,fragmentDefinitions,fragmentDependencies,dependenciesSource,validationAst,customRules,customRulesModulePath,rulesPath,schema;return regeneratorRuntime.async(function(_context){for(;;)switch(_context.prev=_context.next){case 0:queryHasExtensions=!1,projectConfig=this._graphQLConfig.getConfigForFile(uri),schemaPath=projectConfig.schemaPath,_context.prev=3,queryAST=(0,_graphql.parse)(query),schemaPath&&uri===schemaPath||(queryHasExtensions=queryAST.definitions.some(function(definition){switch(definition.kind){case OBJECT_TYPE_DEFINITION:case INTERFACE_TYPE_DEFINITION:case ENUM_TYPE_DEFINITION:case UNION_TYPE_DEFINITION:case SCALAR_TYPE_DEFINITION:case INPUT_OBJECT_TYPE_DEFINITION:case INPUT_UNION_TYPE_EXTENSION:case SCALAR_TYPE_EXTENSION:case OBJECT_TYPE_EXTENSION:case INTERFACE_TYPE_EXTENSION:case UNION_TYPE_EXTENSION:case ENUM_TYPE_EXTENSION:case INPUT_OBJECT_TYPE_EXTENSION:case INPUT_UNION_TYPE_DEFINITION:case DIRECTIVE_DEFINITION:return!0}return!1})),_context.next=12;break;case 8:return _context.prev=8,_context.t0=_context.catch(3),range=(0,_getDiagnostics.getRange)(_context.t0.locations[0],query),_context.abrupt("return",[{severity:_getDiagnostics.SEVERITY.ERROR,message:_context.t0.message,source:"GraphQL: Syntax",range:range}]);case 12:return source=query,_context.next=15,regeneratorRuntime.awrap(this._graphQLCache.getFragmentDefinitions(projectConfig));case 15:return fragmentDefinitions=_context.sent,_context.next=18,regeneratorRuntime.awrap(this._graphQLCache.getFragmentDependencies(query,fragmentDefinitions));case 18:fragmentDependencies=_context.sent,dependenciesSource=fragmentDependencies.reduce(function(prev,cur){return prev+" "+(0,_graphql.print)(cur.definition)},""),source=source+" "+dependenciesSource,validationAst=null,_context.prev=22,validationAst=(0,_graphql.parse)(source),_context.next=29;break;case 26:return _context.prev=26,_context.t1=_context.catch(22),_context.abrupt("return",[]);case 29:return customRules=void 0,(customRulesModulePath=projectConfig.extensions.customValidationRules)&&(rulesPath=require.resolve(""+customRulesModulePath))&&(customRules=require(""+rulesPath)(this._graphQLConfig)),_context.next=34,regeneratorRuntime.awrap(this._graphQLCache.getSchema(projectConfig.projectName,queryHasExtensions).catch(function(){return null}));case 34:if(schema=_context.sent){_context.next=37;break}return _context.abrupt("return",[]);case 37:return _context.abrupt("return",(0,_getDiagnostics.validateQuery)(validationAst,schema,customRules,isRelayCompatMode));case 38:case"end":return _context.stop()}},null,this,[[3,8],[22,26]])},GraphQLLanguageService.prototype.getAutocompleteSuggestions=function(query,position,filePath){var projectConfig,schema;return regeneratorRuntime.async(function(_context2){for(;;)switch(_context2.prev=_context2.next){case 0:return projectConfig=this._graphQLConfig.getConfigForFile(filePath),_context2.next=3,regeneratorRuntime.awrap(this._graphQLCache.getSchema(projectConfig.projectName).catch(function(){return null}));case 3:if(!(schema=_context2.sent)){_context2.next=6;break}return _context2.abrupt("return",(0,_getAutocompleteSuggestions2.getAutocompleteSuggestions)(schema,query,position));case 6:return _context2.abrupt("return",[]);case 7:case"end":return _context2.stop()}},null,this)},GraphQLLanguageService.prototype.getHoverInformation=function(query,position,filePath){var projectConfig,schema;return regeneratorRuntime.async(function(_context3){for(;;)switch(_context3.prev=_context3.next){case 0:return projectConfig=this._graphQLConfig.getConfigForFile(filePath),_context3.next=3,regeneratorRuntime.awrap(this._graphQLCache.getSchema(projectConfig.projectName).catch(function(){return null}));case 3:if(!(schema=_context3.sent)){_context3.next=6;break}return _context3.abrupt("return",(0,_getHoverInformation2.getHoverInformation)(schema,query,position));case 6:return _context3.abrupt("return","");case 7:case"end":return _context3.stop()}},null,this)},GraphQLLanguageService.prototype.getDefinition=function(query,position,filePath){var projectConfig,ast,node;return regeneratorRuntime.async(function(_context4){for(;;)switch(_context4.prev=_context4.next){case 0:projectConfig=this._graphQLConfig.getConfigForFile(filePath),ast=void 0,_context4.prev=2,ast=(0,_graphql.parse)(query),_context4.next=9;break;case 6:return _context4.prev=6,_context4.t0=_context4.catch(2),_context4.abrupt("return",null);case 9:if(!(node=(0,_graphqlLanguageServiceUtils.getASTNodeAtPosition)(query,ast,position))){_context4.next=17;break}_context4.t1=node.kind,_context4.next=_context4.t1===FRAGMENT_SPREAD?14:_context4.t1===FRAGMENT_DEFINITION?15:_context4.t1===OPERATION_DEFINITION?15:_context4.t1===NAMED_TYPE?16:17;break;case 14:return _context4.abrupt("return",this._getDefinitionForFragmentSpread(query,ast,node,filePath,projectConfig));case 15:return _context4.abrupt("return",(0,_getDefinition.getDefinitionQueryResultForDefinitionNode)(filePath,query,node));case 16:return _context4.abrupt("return",this._getDefinitionForNamedType(query,ast,node,filePath,projectConfig));case 17:return _context4.abrupt("return",null);case 18:case"end":return _context4.stop()}},null,this,[[2,6]])},GraphQLLanguageService.prototype._getDefinitionForNamedType=function(query,ast,node,filePath,projectConfig){var objectTypeDefinitions,dependencies,localObjectTypeDefinitions,typeCastedDefs,localOperationDefinationInfos,result;return regeneratorRuntime.async(function(_context5){for(;;)switch(_context5.prev=_context5.next){case 0:return _context5.next=2,regeneratorRuntime.awrap(this._graphQLCache.getObjectTypeDefinitions(projectConfig));case 2:return objectTypeDefinitions=_context5.sent,_context5.next=5,regeneratorRuntime.awrap(this._graphQLCache.getObjectTypeDependenciesForAST(ast,objectTypeDefinitions));case 5:return dependencies=_context5.sent,localObjectTypeDefinitions=ast.definitions.filter(function(definition){return definition.kind===OBJECT_TYPE_DEFINITION||definition.kind===INPUT_OBJECT_TYPE_DEFINITION||definition.kind===INPUT_UNION_TYPE_DEFINITION||definition.kind===ENUM_TYPE_DEFINITION}),typeCastedDefs=localObjectTypeDefinitions,localOperationDefinationInfos=typeCastedDefs.map(function(definition){return{filePath:filePath,content:query,definition:definition}}),_context5.next=11,regeneratorRuntime.awrap((0,_getDefinition.getDefinitionQueryResultForNamedType)(query,node,dependencies.concat(localOperationDefinationInfos)));case 11:return result=_context5.sent,_context5.abrupt("return",result);case 13:case"end":return _context5.stop()}},null,this)},GraphQLLanguageService.prototype._getDefinitionForFragmentSpread=function(query,ast,node,filePath,projectConfig){var fragmentDefinitions,dependencies,localFragDefinitions,typeCastedDefs,localFragInfos,result;return regeneratorRuntime.async(function(_context6){for(;;)switch(_context6.prev=_context6.next){case 0:return _context6.next=2,regeneratorRuntime.awrap(this._graphQLCache.getFragmentDefinitions(projectConfig));case 2:return fragmentDefinitions=_context6.sent,_context6.next=5,regeneratorRuntime.awrap(this._graphQLCache.getFragmentDependenciesForAST(ast,fragmentDefinitions));case 5:return dependencies=_context6.sent,localFragDefinitions=ast.definitions.filter(function(definition){return definition.kind===FRAGMENT_DEFINITION}),typeCastedDefs=localFragDefinitions,localFragInfos=typeCastedDefs.map(function(definition){return{filePath:filePath,content:query,definition:definition}}),_context6.next=11,regeneratorRuntime.awrap((0,_getDefinition.getDefinitionQueryResultForFragmentSpread)(query,node,dependencies.concat(localFragInfos)));case 11:return result=_context6.sent,_context6.abrupt("return",result);case 13:case"end":return _context6.stop()}},null,this)},GraphQLLanguageService}()},{"./getAutocompleteSuggestions":20,"./getDefinition":21,"./getDiagnostics":22,"./getHoverInformation":23,graphql:174,"graphql-language-service-utils":33}],19:[function(require,module,exports){"use strict";function forEachState(stack,fn){for(var reverseStateStack=[],state=stack;state&&state.kind;)reverseStateStack.push(state),state=state.prevState;for(var i=reverseStateStack.length-1;i>=0;i--)fn(reverseStateStack[i])}function filterAndSortList(list,text){return text?filterNonEmpty(filterNonEmpty(list.map(function(entry){return{proximity:getProximity(normalizeText(entry.label),text),entry:entry}}),function(pair){return pair.proximity<=2}),function(pair){return!pair.entry.isDeprecated}).sort(function(a,b){return(a.entry.isDeprecated?1:0)-(b.entry.isDeprecated?1:0)||a.proximity-b.proximity||a.entry.label.length-b.entry.label.length}).map(function(pair){return pair.entry}):filterNonEmpty(list,function(entry){return!entry.isDeprecated})}function filterNonEmpty(array,predicate){var filtered=array.filter(predicate);return 0===filtered.length?array:filtered}function normalizeText(text){return text.toLowerCase().replace(/\W/g,"")}function getProximity(suggestion,text){var proximity=lexicalDistance(text,suggestion);return suggestion.length>text.length&&(proximity-=suggestion.length-text.length-1,proximity+=0===suggestion.indexOf(text)?0:.5),proximity}function lexicalDistance(a,b){var i=void 0,j=void 0,d=[],aLength=a.length,bLength=b.length;for(i=0;i<=aLength;i++)d[i]=[i];for(j=1;j<=bLength;j++)d[0][j]=j;for(i=1;i<=aLength;i++)for(j=1;j<=bLength;j++){var cost=a[i-1]===b[j-1]?0:1;d[i][j]=Math.min(d[i-1][j]+1,d[i][j-1]+1,d[i-1][j-1]+cost),i>1&&j>1&&a[i-1]===b[j-2]&&a[i-2]===b[j-1]&&(d[i][j]=Math.min(d[i][j],d[i-2][j-2]+cost))}return d[aLength][bLength]}Object.defineProperty(exports,"__esModule",{value:!0}),exports.getDefinitionState=function(tokenState){var definitionState=void 0;return forEachState(tokenState,function(state){switch(state.kind){case"Query":case"ShortQuery":case"Mutation":case"Subscription":case"FragmentDefinition":definitionState=state}}),definitionState},exports.getFieldDef=function(schema,type,fieldName){return fieldName===_introspection.SchemaMetaFieldDef.name&&schema.getQueryType()===type?_introspection.SchemaMetaFieldDef:fieldName===_introspection.TypeMetaFieldDef.name&&schema.getQueryType()===type?_introspection.TypeMetaFieldDef:fieldName===_introspection.TypeNameMetaFieldDef.name&&(0,_graphql.isCompositeType)(type)?_introspection.TypeNameMetaFieldDef:type.getFields&&"function"==typeof type.getFields?type.getFields()[fieldName]:null},exports.forEachState=forEachState,exports.objectValues=function(object){for(var keys=Object.keys(object),len=keys.length,values=new Array(len),i=0;i<len;++i)values[i]=object[keys[i]];return values},exports.hintList=function(token,list){return filterAndSortList(list,normalizeText(token.string))};var _graphql=require("graphql"),_introspection=require("graphql/type/introspection")},{graphql:174,"graphql/type/introspection":201}],20:[function(require,module,exports){"use strict";function getSuggestionsForFieldNames(token,typeInfo,schema){if(typeInfo.parentType){var parentType=typeInfo.parentType,fields=parentType.getFields instanceof Function?(0,_autocompleteUtils.objectValues)(parentType.getFields()):[];return(0,_graphql.isAbstractType)(parentType)&&fields.push(_graphql.TypeNameMetaFieldDef),parentType===schema.getQueryType()&&fields.push(_graphql.SchemaMetaFieldDef,_graphql.TypeMetaFieldDef),(0,_autocompleteUtils.hintList)(token,fields.map(function(field){return{label:field.name,detail:String(field.type),documentation:field.description,isDeprecated:field.isDeprecated,deprecationReason:field.deprecationReason}}))}return[]}function getSuggestionsForInputValues(token,typeInfo){var namedInputType=(0,_graphql.getNamedType)(typeInfo.inputType);if(namedInputType instanceof _graphql.GraphQLEnumType){var values=namedInputType.getValues();return(0,_autocompleteUtils.hintList)(token,values.map(function(value){return{label:value.name,detail:String(namedInputType),documentation:value.description,isDeprecated:value.isDeprecated,deprecationReason:value.deprecationReason}}))}return namedInputType===_graphql.GraphQLBoolean?(0,_autocompleteUtils.hintList)(token,[{label:"true",detail:String(_graphql.GraphQLBoolean),documentation:"Not false."},{label:"false",detail:String(_graphql.GraphQLBoolean),documentation:"Not true."}]):[]}function getSuggestionsForFragmentTypeConditions(token,typeInfo,schema){var possibleTypes=void 0;if(typeInfo.parentType)if((0,_graphql.isAbstractType)(typeInfo.parentType)){var abstractType=(0,_graphql.assertAbstractType)(typeInfo.parentType),possibleObjTypes=schema.getPossibleTypes(abstractType),possibleIfaceMap=Object.create(null);possibleObjTypes.forEach(function(type){type.getInterfaces().forEach(function(iface){possibleIfaceMap[iface.name]=iface})}),possibleTypes=possibleObjTypes.concat((0,_autocompleteUtils.objectValues)(possibleIfaceMap))}else possibleTypes=[typeInfo.parentType];else{var typeMap=schema.getTypeMap();possibleTypes=(0,_autocompleteUtils.objectValues)(typeMap).filter(_graphql.isCompositeType)}return(0,_autocompleteUtils.hintList)(token,possibleTypes.map(function(type){var namedType=(0,_graphql.getNamedType)(type);return{label:String(type),documentation:namedType&&namedType.description||""}}))}function getSuggestionsForFragmentSpread(token,typeInfo,schema,queryText){var typeMap=schema.getTypeMap(),defState=(0,_autocompleteUtils.getDefinitionState)(token.state),relevantFrags=getFragmentDefinitions(queryText).filter(function(frag){return typeMap[frag.typeCondition.name.value]&&!(defState&&"FragmentDefinition"===defState.kind&&defState.name===frag.name.value)&&(0,_graphql.isCompositeType)(typeInfo.parentType)&&(0,_graphql.isCompositeType)(typeMap[frag.typeCondition.name.value])&&(0,_graphql.doTypesOverlap)(schema,typeInfo.parentType,typeMap[frag.typeCondition.name.value])});return(0,_autocompleteUtils.hintList)(token,relevantFrags.map(function(frag){return{label:frag.name.value,detail:String(typeMap[frag.typeCondition.name.value]),documentation:"fragment "+frag.name.value+" on "+frag.typeCondition.name.value}}))}function getFragmentDefinitions(queryText){var fragmentDefs=[];return runOnlineParser(queryText,function(_,state){"FragmentDefinition"===state.kind&&state.name&&state.type&&fragmentDefs.push({kind:"FragmentDefinition",name:{kind:"Name",value:state.name},selectionSet:{kind:"SelectionSet",selections:[]},typeCondition:{kind:"NamedType",name:{kind:"Name",value:state.type}}})}),fragmentDefs}function getSuggestionsForVariableDefinition(token,schema){var inputTypeMap=schema.getTypeMap(),inputTypes=(0,_autocompleteUtils.objectValues)(inputTypeMap).filter(_graphql.isInputType);return(0,_autocompleteUtils.hintList)(token,inputTypes.map(function(type){return{label:type.name,documentation:type.description}}))}function getSuggestionsForDirective(token,state,schema){if(state.prevState&&state.prevState.kind){var directives=schema.getDirectives().filter(function(directive){return canUseDirective(state.prevState,directive)});return(0,_autocompleteUtils.hintList)(token,directives.map(function(directive){return{label:directive.name,documentation:directive.description||""}}))}return[]}function getTokenAtPosition(queryText,cursor){var styleAtCursor=null,stateAtCursor=null,stringAtCursor=null,token=runOnlineParser(queryText,function(stream,state,style,index){if(index===cursor.line&&stream.getCurrentPosition()>=cursor.character)return styleAtCursor=style,stateAtCursor=_extends({},state),stringAtCursor=stream.current(),"BREAK"});return{start:token.start,end:token.end,string:stringAtCursor||token.string,state:stateAtCursor||token.state,style:styleAtCursor||token.style}}function runOnlineParser(queryText,callback){for(var lines=queryText.split("\n"),parser=(0,_graphqlLanguageServiceParser.onlineParser)(),state=parser.startState(),style="",stream=new _graphqlLanguageServiceParser.CharacterStream(""),i=0;i<lines.length;i++){for(stream=new _graphqlLanguageServiceParser.CharacterStream(lines[i]);!stream.eol()&&"BREAK"!==callback(stream,state,style=parser.token(stream,state),i););callback(stream,state,style,i),state.kind||(state=parser.startState())}return{start:stream.getStartOfToken(),end:stream.getCurrentPosition(),string:stream.current(),state:state,style:style}}function canUseDirective(state,directive){if(!state||!state.kind)return!1;var kind=state.kind,locations=directive.locations;switch(kind){case"Query":return-1!==locations.indexOf("QUERY");case"Mutation":return-1!==locations.indexOf("MUTATION");case"Subscription":return-1!==locations.indexOf("SUBSCRIPTION");case"Field":case"AliasedField":return-1!==locations.indexOf("FIELD");case"FragmentDefinition":return-1!==locations.indexOf("FRAGMENT_DEFINITION");case"FragmentSpread":return-1!==locations.indexOf("FRAGMENT_SPREAD");case"InlineFragment":return-1!==locations.indexOf("INLINE_FRAGMENT");case"SchemaDef":return-1!==locations.indexOf("SCHEMA");case"ScalarDef":return-1!==locations.indexOf("SCALAR");case"ObjectTypeDef":return-1!==locations.indexOf("OBJECT");case"FieldDef":return-1!==locations.indexOf("FIELD_DEFINITION");case"InterfaceDef":return-1!==locations.indexOf("INTERFACE");case"UnionDef":return-1!==locations.indexOf("UNION");case"EnumDef":return-1!==locations.indexOf("ENUM");case"EnumValue":return-1!==locations.indexOf("ENUM_VALUE");case"InputDef":return-1!==locations.indexOf("INPUT_OBJECT");case"InputUnionDef":return-1!==locations.indexOf("INPUT_UNION");case"InputValueDef":switch(state.prevState&&state.prevState.kind){case"ArgumentsDef":return-1!==locations.indexOf("ARGUMENT_DEFINITION");case"InputDef":return-1!==locations.indexOf("INPUT_FIELD_DEFINITION")}}return!1}function getTypeInfo(schema,tokenState){var argDef=void 0,argDefs=void 0,directiveDef=void 0,enumValue=void 0,fieldDef=void 0,inputType=void 0,objectFieldDefs=void 0,parentType=void 0,type=void 0;return(0,_autocompleteUtils.forEachState)(tokenState,function(state){switch(state.kind){case"Query":case"ShortQuery":type=schema.getQueryType();break;case"Mutation":type=schema.getMutationType();break;case"Subscription":type=schema.getSubscriptionType();break;case"InlineFragment":case"FragmentDefinition":state.type&&(type=schema.getType(state.type));break;case"Field":case"AliasedField":type&&state.name?(fieldDef=parentType?(0,_autocompleteUtils.getFieldDef)(schema,parentType,state.name):null,type=fieldDef?fieldDef.type:null):fieldDef=null;break;case"SelectionSet":parentType=(0,_graphql.getNamedType)(type);break;case"Directive":directiveDef=state.name?schema.getDirective(state.name):null;break;case"Arguments":if(state.prevState)switch(state.prevState.kind){case"Field":argDefs=fieldDef&&fieldDef.args;break;case"Directive":argDefs=directiveDef&&directiveDef.args;break;case"AliasedField":var name=state.prevState&&state.prevState.name;if(!name){argDefs=null;break}var field=parentType?(0,_autocompleteUtils.getFieldDef)(schema,parentType,name):null;if(!field){argDefs=null;break}argDefs=field.args;break;default:argDefs=null}else argDefs=null;break;case"Argument":if(argDefs)for(var i=0;i<argDefs.length;i++)if(argDefs[i].name===state.name){argDef=argDefs[i];break}inputType=argDef&&argDef.type;break;case"EnumValue":var enumType=(0,_graphql.getNamedType)(inputType);enumValue=enumType instanceof _graphql.GraphQLEnumType?find(enumType.getValues(),function(val){return val.value===state.name}):null;break;case"ListValue":var nullableType=(0,_graphql.getNullableType)(inputType);inputType=nullableType instanceof _graphql.GraphQLList?nullableType.ofType:null;break;case"ObjectValue":var objectType=(0,_graphql.getNamedType)(inputType);objectFieldDefs=objectType instanceof _graphql.GraphQLInputObjectType?objectType.getFields():null;break;case"InputUnionValue":var inputUnionType=(0,_graphql.getNamedType)(inputType);objectFieldDefs=inputUnionType instanceof _graphql.GraphQLInputUnionType?inputUnionType.getFields():null;break;case"ObjectField":var objectField=state.name&&objectFieldDefs?objectFieldDefs[state.name]:null;inputType=objectField&&objectField.type;break;case"NamedType":state.name&&(type=schema.getType(state.name))}}),{argDef:argDef,argDefs:argDefs,directiveDef:directiveDef,enumValue:enumValue,fieldDef:fieldDef,inputType:inputType,objectFieldDefs:objectFieldDefs,parentType:parentType,type:type}}function find(array,predicate){for(var i=0;i<array.length;i++)if(predicate(array[i]))return array[i];return null}Object.defineProperty(exports,"__esModule",{value:!0});var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key])}return target};exports.getAutocompleteSuggestions=function(schema,queryText,cursor,contextToken){var token=contextToken||getTokenAtPosition(queryText,cursor),state="Invalid"===token.state.kind?token.state.prevState:token.state;if(!state)return[];var kind=state.kind,step=state.step,typeInfo=getTypeInfo(schema,token.state);if("Document"===kind)return(0,_autocompleteUtils.hintList)(token,[{label:"query"},{label:"mutation"},{label:"subscription"},{label:"fragment"},{label:"{"}]);if("SelectionSet"===kind||"Field"===kind||"AliasedField"===kind)return getSuggestionsForFieldNames(token,typeInfo,schema);if("Arguments"===kind||"Argument"===kind&&0===step){var argDefs=typeInfo.argDefs;if(argDefs)return(0,_autocompleteUtils.hintList)(token,argDefs.map(function(argDef){return{label:argDef.name,detail:String(argDef.type),documentation:argDef.description}}))}if(("ObjectValue"===kind||"ObjectField"===kind&&0===step)&&typeInfo.objectFieldDefs){var objectFields=(0,_autocompleteUtils.objectValues)(typeInfo.objectFieldDefs);return(0,_autocompleteUtils.hintList)(token,objectFields.map(function(field){return{label:field.name,detail:String(field.type),documentation:field.description}}))}return"EnumValue"===kind||"ListValue"===kind&&1===step||"ObjectField"===kind&&2===step||"InputUnion"===kind&&2===step||"Argument"===kind&&2===step?getSuggestionsForInputValues(token,typeInfo):"TypeCondition"===kind&&1===step||"NamedType"===kind&&null!=state.prevState&&"TypeCondition"===state.prevState.kind?getSuggestionsForFragmentTypeConditions(token,typeInfo,schema):"FragmentSpread"===kind&&1===step?getSuggestionsForFragmentSpread(token,typeInfo,schema,queryText):"VariableDefinition"===kind&&2===step||"ListType"===kind&&1===step||"NamedType"===kind&&state.prevState&&("VariableDefinition"===state.prevState.kind||"ListType"===state.prevState.kind)?getSuggestionsForVariableDefinition(token,schema):"Directive"===kind?getSuggestionsForDirective(token,state,schema):[]},exports.getTokenAtPosition=getTokenAtPosition,exports.getTypeInfo=getTypeInfo;var _graphql=require("graphql"),_graphqlLanguageServiceParser=require("graphql-language-service-parser"),_autocompleteUtils=require("./autocompleteUtils")},{"./autocompleteUtils":19,graphql:174,"graphql-language-service-parser":29}],21:[function(require,module,exports){(function(process){"use strict";function getRange(text,node){var location=node.loc;return(0,_assert2.default)(location,"Expected ASTNode to have a location."),(0,_graphqlLanguageServiceUtils.locToRange)(text,location)}function getPosition(text,node){var location=node.loc;return(0,_assert2.default)(location,"Expected ASTNode to have a location."),(0,_graphqlLanguageServiceUtils.offsetToPosition)(text,location.start)}function getDefinitionForFragmentDefinition(path,text,definition){var name=definition.name;return(0,_assert2.default)(name,"Expected ASTNode to have a Name."),{path:path,position:getPosition(text,definition),range:getRange(text,definition),name:name.value||"",language:LANGUAGE,projectRoot:path}}function getDefinitionForNodeDefinition(path,text,definition){var name=definition.name;return(0,_assert2.default)(name,"Expected ASTNode to have a Name."),{path:path,position:getPosition(text,definition),range:getRange(text,definition),name:name.value||"",language:LANGUAGE,projectRoot:path}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.LANGUAGE=void 0,exports.getDefinitionQueryResultForNamedType=function(text,node,dependencies){var name,defNodes,definitions;return regeneratorRuntime.async(function(_context){for(;;)switch(_context.prev=_context.next){case 0:if(name=node.name.value,0!==(defNodes=dependencies.filter(function(_ref){var definition=_ref.definition;return definition.name&&definition.name.value===name})).length){_context.next=5;break}return process.stderr.write("Definition not found for GraphQL type "+name),_context.abrupt("return",{queryRange:[],definitions:[]});case 5:return definitions=defNodes.map(function(_ref2){var filePath=_ref2.filePath,content=_ref2.content,definition=_ref2.definition;return getDefinitionForNodeDefinition(filePath||"",content,definition)}),_context.abrupt("return",{definitions:definitions,queryRange:definitions.map(function(_){return getRange(text,node)})});case 7:case"end":return _context.stop()}},null,this)},exports.getDefinitionQueryResultForFragmentSpread=function(text,fragment,dependencies){var name,defNodes,definitions;return regeneratorRuntime.async(function(_context2){for(;;)switch(_context2.prev=_context2.next){case 0:if(name=fragment.name.value,0!==(defNodes=dependencies.filter(function(_ref3){return _ref3.definition.name.value===name})).length){_context2.next=5;break}return process.stderr.write("Definition not found for GraphQL fragment "+name),_context2.abrupt("return",{queryRange:[],definitions:[]});case 5:return definitions=defNodes.map(function(_ref4){var filePath=_ref4.filePath,content=_ref4.content,definition=_ref4.definition;return getDefinitionForFragmentDefinition(filePath||"",content,definition)}),_context2.abrupt("return",{definitions:definitions,queryRange:definitions.map(function(_){return getRange(text,fragment)})});case 7:case"end":return _context2.stop()}},null,this)},exports.getDefinitionQueryResultForDefinitionNode=function(path,text,definition){return{definitions:[getDefinitionForFragmentDefinition(path,text,definition)],queryRange:definition.name?[getRange(text,definition.name)]:[]}};var _graphqlLanguageServiceUtils=require("graphql-language-service-utils"),_assert2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(require("assert")),LANGUAGE=exports.LANGUAGE="GraphQL"}).call(this,require("_process"))},{_process:148,assert:70,"graphql-language-service-utils":33}],22:[function(require,module,exports){"use strict";function validateQuery(ast){var schema=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,customRules=arguments[2],isRelayCompatMode=arguments[3];if(!schema)return[];var validationErrorAnnotations=mapCat((0,_graphqlLanguageServiceUtils.validateWithCustomRules)(schema,ast,customRules,isRelayCompatMode),function(error){return annotations(error,SEVERITY.ERROR,"Validation")}),deprecationWarningAnnotations=_graphql.findDeprecatedUsages?mapCat((0,_graphql.findDeprecatedUsages)(schema,ast),function(error){return annotations(error,SEVERITY.WARNING,"Deprecation")}):[];return validationErrorAnnotations.concat(deprecationWarningAnnotations)}function mapCat(array,mapper){return Array.prototype.concat.apply([],array.map(mapper))}function annotations(error,severity,type){return error.nodes?error.nodes.map(function(node){var highlightNode="Variable"!==node.kind&&node.name?node.name:node.variable?node.variable:node;(0,_assert2.default)(error.locations,"GraphQL validation error requires locations.");var loc=error.locations[0],highlightLoc=getLocation(highlightNode),end=loc.column+(highlightLoc.end-highlightLoc.start);return{source:"GraphQL: "+type,message:error.message,severity:severity,range:new _graphqlLanguageServiceUtils.Range(new _graphqlLanguageServiceUtils.Position(loc.line-1,loc.column-1),new _graphqlLanguageServiceUtils.Position(loc.line-1,end))}}):[]}function getRange(location,queryText){var parser=(0,_graphqlLanguageServiceParser.onlineParser)(),state=parser.startState(),lines=queryText.split("\n");(0,_assert2.default)(lines.length>=location.line,"Query text must have more lines than where the error happened");for(var stream=null,i=0;i<location.line;i++)for(stream=new _graphqlLanguageServiceParser.CharacterStream(lines[i]);!stream.eol()&&"invalidchar"!==parser.token(stream,state););(0,_assert2.default)(stream,"Expected Parser stream to be available.");var line=location.line-1,start=stream.getStartOfToken(),end=stream.getCurrentPosition();return new _graphqlLanguageServiceUtils.Range(new _graphqlLanguageServiceUtils.Position(line,start),new _graphqlLanguageServiceUtils.Position(line,end))}function getLocation(node){var location=node.loc;return(0,_assert2.default)(location,"Expected ASTNode to have a location."),location}Object.defineProperty(exports,"__esModule",{value:!0}),exports.SEVERITY=void 0,exports.getDiagnostics=function(query){var schema=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,customRules=arguments[2],isRelayCompatMode=arguments[3],ast=null;try{ast=(0,_graphql.parse)(query)}catch(error){var range=getRange(error.locations[0],query);return[{severity:SEVERITY.ERROR,message:error.message,source:"GraphQL: Syntax",range:range}]}return validateQuery(ast,schema,customRules,isRelayCompatMode)},exports.validateQuery=validateQuery,exports.getRange=getRange;var _assert2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(require("assert")),_graphql=require("graphql"),_graphqlLanguageServiceParser=require("graphql-language-service-parser"),_graphqlLanguageServiceUtils=require("graphql-language-service-utils"),SEVERITY=exports.SEVERITY={ERROR:1,WARNING:2,INFORMATION:3,HINT:4}},{assert:70,graphql:174,"graphql-language-service-parser":29,"graphql-language-service-utils":33}],23:[function(require,module,exports){"use strict";function renderField(into,typeInfo,options){renderQualifiedField(into,typeInfo,options),renderTypeAnnotation(into,typeInfo,options,typeInfo.type)}function renderQualifiedField(into,typeInfo,options){if(typeInfo.fieldDef){var fieldName=typeInfo.fieldDef.name;"__"!==fieldName.slice(0,2)&&(renderType(into,typeInfo,options,typeInfo.parentType),text(into,".")),text(into,fieldName)}}function renderDirective(into,typeInfo,options){typeInfo.directiveDef&&text(into,"@"+typeInfo.directiveDef.name)}function renderArg(into,typeInfo,options){if(typeInfo.directiveDef?renderDirective(into,typeInfo,options):typeInfo.fieldDef&&renderQualifiedField(into,typeInfo,options),typeInfo.argDef){var name=typeInfo.argDef.name;text(into,"("),text(into,name),renderTypeAnnotation(into,typeInfo,options,typeInfo.inputType),text(into,")")}}function renderTypeAnnotation(into,typeInfo,options,t){text(into,": "),renderType(into,typeInfo,options,t)}function renderEnumValue(into,typeInfo,options){if(typeInfo.enumValue){var name=typeInfo.enumValue.name;renderType(into,typeInfo,options,typeInfo.inputType),text(into,"."),text(into,name)}}function renderType(into,typeInfo,options,t){t&&(t instanceof _graphql.GraphQLNonNull?(renderType(into,typeInfo,options,t.ofType),text(into,"!")):t instanceof _graphql.GraphQLList?(text(into,"["),renderType(into,typeInfo,options,t.ofType),text(into,"]")):text(into,t.name))}function renderDescription(into,options,def){if(def){var description="string"==typeof def.description?def.description:null;description&&(text(into,"\n\n"),text(into,description)),renderDeprecation(into,options,def)}}function renderDeprecation(into,options,def){if(def){var reason="string"==typeof def.deprecationReason?def.deprecationReason:null;reason&&(text(into,"\n\n"),text(into,"Deprecated: "),text(into,reason))}}function text(into,content){into.push(content)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.getHoverInformation=function(schema,queryText,cursor,contextToken){var token=contextToken||(0,_getAutocompleteSuggestions.getTokenAtPosition)(queryText,cursor);if(!schema||!token||!token.state)return[];var state=token.state,kind=state.kind,step=state.step,typeInfo=(0,_getAutocompleteSuggestions.getTypeInfo)(schema,token.state),options={schema:schema};if("Field"===kind&&0===step&&typeInfo.fieldDef||"AliasedField"===kind&&2===step&&typeInfo.fieldDef){var into=[];return renderField(into,typeInfo,options),renderDescription(into,options,typeInfo.fieldDef),into.join("").trim()}if("Directive"===kind&&1===step&&typeInfo.directiveDef){var _into=[];return renderDirective(_into,typeInfo,options),renderDescription(_into,options,typeInfo.directiveDef),_into.join("").trim()}if("Argument"===kind&&0===step&&typeInfo.argDef){var _into2=[];return renderArg(_into2,typeInfo,options),renderDescription(_into2,options,typeInfo.argDef),_into2.join("").trim()}if("EnumValue"===kind&&typeInfo.enumValue&&typeInfo.enumValue.description){var _into3=[];return renderEnumValue(_into3,typeInfo,options),renderDescription(_into3,options,typeInfo.enumValue),_into3.join("").trim()}if("NamedType"===kind&&typeInfo.type&&typeInfo.type.description){var _into4=[];return renderType(_into4,typeInfo,options,typeInfo.type),renderDescription(_into4,options,typeInfo.type),_into4.join("").trim()}};var _getAutocompleteSuggestions=require("./getAutocompleteSuggestions"),_graphql=require("graphql")},{"./getAutocompleteSuggestions":20,graphql:174}],24:[function(require,module,exports){"use strict";function outlineTreeConverter(docText){var meta=function(node){return{representativeName:node.name,startPosition:(0,_graphqlLanguageServiceUtils.offsetToPosition)(docText,node.loc.start),endPosition:(0,_graphqlLanguageServiceUtils.offsetToPosition)(docText,node.loc.end),children:node.selectionSet||[]}};return{Field:function(node){var tokenizedText=node.alias?[buildToken("plain",node.alias),buildToken("plain",": ")]:[];return tokenizedText.push(buildToken("plain",node.name)),_extends({tokenizedText:tokenizedText},meta(node))},OperationDefinition:function(node){return _extends({tokenizedText:[buildToken("keyword",node.operation),buildToken("whitespace"," "),buildToken("class-name",node.name)]},meta(node))},Document:function(node){return node.definitions},SelectionSet:function(node){return concatMap(node.selections,function(child){return child.kind===INLINE_FRAGMENT?child.selectionSet:child})},Name:function(node){return node.value},FragmentDefinition:function(node){return _extends({tokenizedText:[buildToken("keyword","fragment"),buildToken("whitespace"," "),buildToken("class-name",node.name)]},meta(node))},FragmentSpread:function(node){return _extends({tokenizedText:[buildToken("plain","..."),buildToken("class-name",node.name)]},meta(node))},InlineFragment:function(node){return node.selectionSet}}}function buildToken(kind,value){return{kind:kind,value:value}}function concatMap(arr,fn){for(var res=[],i=0;i<arr.length;i++){var x=fn(arr[i],i);Array.isArray(x)?res.push.apply(res,x):res.push(x)}return res}Object.defineProperty(exports,"__esModule",{value:!0});var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key])}return target};exports.getOutline=function(queryText){var ast=void 0;try{ast=(0,_graphql.parse)(queryText)}catch(error){return null}var visitorFns=outlineTreeConverter(queryText);return{outlineTrees:(0,_graphql.visit)(ast,{leave:function(node){return OUTLINEABLE_KINDS.hasOwnProperty(node.kind)&&visitorFns[node.kind]?visitorFns[node.kind](node):null}})}};var _graphql=require("graphql"),_graphqlLanguageServiceUtils=require("graphql-language-service-utils"),INLINE_FRAGMENT=_graphql.Kind.INLINE_FRAGMENT,OUTLINEABLE_KINDS={Field:!0,OperationDefinition:!0,Document:!0,SelectionSet:!0,Name:!0,FragmentDefinition:!0,FragmentSpread:!0,InlineFragment:!0}},{graphql:174,"graphql-language-service-utils":33}],25:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _autocompleteUtils=require("./autocompleteUtils");Object.defineProperty(exports,"getDefinitionState",{enumerable:!0,get:function(){return _autocompleteUtils.getDefinitionState}}),Object.defineProperty(exports,"getFieldDef",{enumerable:!0,get:function(){return _autocompleteUtils.getFieldDef}}),Object.defineProperty(exports,"forEachState",{enumerable:!0,get:function(){return _autocompleteUtils.forEachState}}),Object.defineProperty(exports,"objectValues",{enumerable:!0,get:function(){return _autocompleteUtils.objectValues}}),Object.defineProperty(exports,"hintList",{enumerable:!0,get:function(){return _autocompleteUtils.hintList}});var _getAutocompleteSuggestions=require("./getAutocompleteSuggestions");Object.defineProperty(exports,"getAutocompleteSuggestions",{enumerable:!0,get:function(){return _getAutocompleteSuggestions.getAutocompleteSuggestions}});var _getDefinition=require("./getDefinition");Object.defineProperty(exports,"LANGUAGE",{enumerable:!0,get:function(){return _getDefinition.LANGUAGE}}),Object.defineProperty(exports,"getDefinitionQueryResultForFragmentSpread",{enumerable:!0,get:function(){return _getDefinition.getDefinitionQueryResultForFragmentSpread}}),Object.defineProperty(exports,"getDefinitionQueryResultForDefinitionNode",{enumerable:!0,get:function(){return _getDefinition.getDefinitionQueryResultForDefinitionNode}});var _getDiagnostics=require("./getDiagnostics");Object.defineProperty(exports,"getDiagnostics",{enumerable:!0,get:function(){return _getDiagnostics.getDiagnostics}}),Object.defineProperty(exports,"validateQuery",{enumerable:!0,get:function(){return _getDiagnostics.validateQuery}});var _getOutline=require("./getOutline");Object.defineProperty(exports,"getOutline",{enumerable:!0,get:function(){return _getOutline.getOutline}});var _getHoverInformation=require("./getHoverInformation");Object.defineProperty(exports,"getHoverInformation",{enumerable:!0,get:function(){return _getHoverInformation.getHoverInformation}});var _GraphQLLanguageService=require("./GraphQLLanguageService");Object.defineProperty(exports,"GraphQLLanguageService",{enumerable:!0,get:function(){return _GraphQLLanguageService.GraphQLLanguageService}})},{"./GraphQLLanguageService":18,"./autocompleteUtils":19,"./getAutocompleteSuggestions":20,"./getDefinition":21,"./getDiagnostics":22,"./getHoverInformation":23,"./getOutline":24}],26:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0});var CharacterStream=function(){function CharacterStream(sourceText){var _this=this;_classCallCheck(this,CharacterStream),this.getStartOfToken=function(){return _this._start},this.getCurrentPosition=function(){return _this._pos},this.eol=function(){return _this._sourceText.length===_this._pos},this.sol=function(){return 0===_this._pos},this.peek=function(){return _this._sourceText.charAt(_this._pos)?_this._sourceText.charAt(_this._pos):null},this.next=function(){var char=_this._sourceText.charAt(_this._pos);return _this._pos++,char},this.eat=function(pattern){if(_this._testNextCharacter(pattern))return _this._start=_this._pos,_this._pos++,_this._sourceText.charAt(_this._pos-1)},this.eatWhile=function(match){var isMatched=_this._testNextCharacter(match),didEat=!1;for(isMatched&&(didEat=isMatched,_this._start=_this._pos);isMatched;)_this._pos++,isMatched=_this._testNextCharacter(match),didEat=!0;return didEat},this.eatSpace=function(){return _this.eatWhile(/[\s\u00a0]/)},this.skipToEnd=function(){_this._pos=_this._sourceText.length},this.skipTo=function(position){_this._pos=position},this.match=function(pattern){var consume=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],caseFold=arguments.length>2&&void 0!==arguments[2]&&arguments[2],token=null,match=null;return"string"==typeof pattern?(match=new RegExp(pattern,caseFold?"i":"g").test(_this._sourceText.substr(_this._pos,pattern.length)),token=pattern):pattern instanceof RegExp&&(token=(match=_this._sourceText.slice(_this._pos).match(pattern))&&match[0]),!(null==match||!("string"==typeof pattern||match instanceof Array&&_this._sourceText.startsWith(match[0],_this._pos)))&&(consume&&(_this._start=_this._pos,token&&token.length&&(_this._pos+=token.length)),match)},this.backUp=function(num){_this._pos-=num},this.column=function(){return _this._pos},this.indentation=function(){var match=_this._sourceText.match(/\s*/),indent=0;if(match&&0===match.length)for(var whitespaces=match[0],pos=0;whitespaces.length>pos;)9===whitespaces.charCodeAt(pos)?indent+=2:indent++,pos++;return indent},this.current=function(){return _this._sourceText.slice(_this._start,_this._pos)},this._start=0,this._pos=0,this._sourceText=sourceText}return CharacterStream.prototype._testNextCharacter=function(pattern){var character=this._sourceText.charAt(this._pos);return"string"==typeof pattern?character===pattern:pattern instanceof RegExp?pattern.test(character):pattern(character)},CharacterStream}();exports.default=CharacterStream},{}],27:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.opt=function(ofRule){return{ofRule:ofRule}},exports.list=function(ofRule,separator){return{ofRule:ofRule,isList:!0,separator:separator}},exports.butNot=function(rule,exclusions){var ruleMatch=rule.match;return rule.match=function(token){var check=!1;return ruleMatch&&(check=ruleMatch(token)),check&&exclusions.every(function(exclusion){return exclusion.match&&!exclusion.match(token)})},rule},exports.t=function(kind,style){return{style:style,match:function(token){return token.kind===kind}}},exports.p=function(value,style){return{style:style||"punctuation",match:function(token){return"Punctuation"===token.kind&&token.value===value}}}},{}],28:[function(require,module,exports){"use strict";function word(value){return{style:"keyword",match:function(token){return"Name"===token.kind&&token.value===value}}}function name(style){return{style:style,match:function(token){return"Name"===token.kind},update:function(state,token){state.name=token.value}}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.ParseRules=exports.LexRules=exports.isIgnored=void 0;var _RuleHelpers=require("./RuleHelpers");exports.isIgnored=function(ch){return" "===ch||"\t"===ch||","===ch||"\n"===ch||"\r"===ch||"\ufeff"===ch},exports.LexRules={Name:/^[_A-Za-z][_0-9A-Za-z]*/,Punctuation:/^(?:!|\$|\(|\)|\.\.\.|:|=|@|\[|]|\{|\||\})/,Number:/^-?(?:0|(?:[1-9][0-9]*))(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?/,String:/^(?:"""(?:\\"""|[^"]|"[^"]|""[^"])*(?:""")?|"(?:[^"\\]|\\(?:"|\/|\\|b|f|n|r|t|u[0-9a-fA-F]{4}))*"?)/,Comment:/^#.*/},exports.ParseRules={Document:[(0,_RuleHelpers.list)("Definition")],Definition:function(token){switch(token.value){case"{":return"ShortQuery";case"query":return"Query";case"mutation":return"Mutation";case"subscription":return"Subscription";case"fragment":return"FragmentDefinition";case"schema":return"SchemaDef";case"scalar":return"ScalarDef";case"type":return"ObjectTypeDef";case"interface":return"InterfaceDef";case"union":return"UnionDef";case"enum":return"EnumDef";case"input":return"InputDef";case"inputUnion":return"InputUnionDef";case"extend":return"ExtendDef";case"directive":return"DirectiveDef"}},ShortQuery:["SelectionSet"],Query:[word("query"),(0,_RuleHelpers.opt)(name("def")),(0,_RuleHelpers.opt)("VariableDefinitions"),(0,_RuleHelpers.list)("Directive"),"SelectionSet"],Mutation:[word("mutation"),(0,_RuleHelpers.opt)(name("def")),(0,_RuleHelpers.opt)("VariableDefinitions"),(0,_RuleHelpers.list)("Directive"),"SelectionSet"],Subscription:[word("subscription"),(0,_RuleHelpers.opt)(name("def")),(0,_RuleHelpers.opt)("VariableDefinitions"),(0,_RuleHelpers.list)("Directive"),"SelectionSet"],VariableDefinitions:[(0,_RuleHelpers.p)("("),(0,_RuleHelpers.list)("VariableDefinition"),(0,_RuleHelpers.p)(")")],VariableDefinition:["Variable",(0,_RuleHelpers.p)(":"),"Type",(0,_RuleHelpers.opt)("DefaultValue")],Variable:[(0,_RuleHelpers.p)("$","variable"),name("variable")],DefaultValue:[(0,_RuleHelpers.p)("="),"Value"],SelectionSet:[(0,_RuleHelpers.p)("{"),(0,_RuleHelpers.list)("Selection"),(0,_RuleHelpers.p)("}")],Selection:function(token,stream){return"..."===token.value?stream.match(/[\s\u00a0,]*(on\b|@|{)/,!1)?"InlineFragment":"FragmentSpread":stream.match(/[\s\u00a0,]*:/,!1)?"AliasedField":"Field"},AliasedField:[name("property"),(0,_RuleHelpers.p)(":"),name("qualifier"),(0,_RuleHelpers.opt)("Arguments"),(0,_RuleHelpers.list)("Directive"),(0,_RuleHelpers.opt)("SelectionSet")],Field:[name("property"),(0,_RuleHelpers.opt)("Arguments"),(0,_RuleHelpers.list)("Directive"),(0,_RuleHelpers.opt)("SelectionSet")],Arguments:[(0,_RuleHelpers.p)("("),(0,_RuleHelpers.list)("Argument"),(0,_RuleHelpers.p)(")")],Argument:[name("attribute"),(0,_RuleHelpers.p)(":"),"Value"],FragmentSpread:[(0,_RuleHelpers.p)("..."),name("def"),(0,_RuleHelpers.list)("Directive")],InlineFragment:[(0,_RuleHelpers.p)("..."),(0,_RuleHelpers.opt)("TypeCondition"),(0,_RuleHelpers.list)("Directive"),"SelectionSet"],FragmentDefinition:[word("fragment"),(0,_RuleHelpers.opt)((0,_RuleHelpers.butNot)(name("def"),[word("on")])),"TypeCondition",(0,_RuleHelpers.list)("Directive"),"SelectionSet"],TypeCondition:[word("on"),"NamedType"],Value:function(token){switch(token.kind){case"Number":return"NumberValue";case"String":return"StringValue";case"Punctuation":switch(token.value){case"[":return"ListValue";case"{":return"ObjectValue";case"$":return"Variable"}return null;case"Name":switch(token.value){case"true":case"false":return"BooleanValue"}return"null"===token.value?"NullValue":"EnumValue"}},NumberValue:[(0,_RuleHelpers.t)("Number","number")],StringValue:[(0,_RuleHelpers.t)("String","string")],BooleanValue:[(0,_RuleHelpers.t)("Name","builtin")],NullValue:[(0,_RuleHelpers.t)("Name","keyword")],EnumValue:[name("string-2")],ListValue:[(0,_RuleHelpers.p)("["),(0,_RuleHelpers.list)("Value"),(0,_RuleHelpers.p)("]")],ObjectValue:[(0,_RuleHelpers.p)("{"),(0,_RuleHelpers.list)("ObjectField"),(0,_RuleHelpers.p)("}")],ObjectField:[name("attribute"),(0,_RuleHelpers.p)(":"),"Value"],Type:function(token){return"["===token.value?"ListType":"NonNullType"},InputUnionValue:[(0,_RuleHelpers.p)("{"),(0,_RuleHelpers.list)("ObjectField"),(0,_RuleHelpers.p)("}")],ListType:[(0,_RuleHelpers.p)("["),"Type",(0,_RuleHelpers.p)("]"),(0,_RuleHelpers.opt)((0,_RuleHelpers.p)("!"))],NonNullType:["NamedType",(0,_RuleHelpers.opt)((0,_RuleHelpers.p)("!"))],NamedType:[{style:"atom",match:function(token){return"Name"===token.kind},update:function(state,token){state.prevState&&state.prevState.prevState&&(state.name=token.value,state.prevState.prevState.type=token.value)}}],Directive:[(0,_RuleHelpers.p)("@","meta"),name("meta"),(0,_RuleHelpers.opt)("Arguments")],SchemaDef:[word("schema"),(0,_RuleHelpers.list)("Directive"),(0,_RuleHelpers.p)("{"),(0,_RuleHelpers.list)("OperationTypeDef"),(0,_RuleHelpers.p)("}")],OperationTypeDef:[name("keyword"),(0,_RuleHelpers.p)(":"),name("atom")],ScalarDef:[word("scalar"),name("atom"),(0,_RuleHelpers.list)("Directive")],ObjectTypeDef:[word("type"),name("atom"),(0,_RuleHelpers.opt)("Implements"),(0,_RuleHelpers.list)("Directive"),(0,_RuleHelpers.p)("{"),(0,_RuleHelpers.list)("FieldDef"),(0,_RuleHelpers.p)("}")],Implements:[word("implements"),(0,_RuleHelpers.list)("NamedType")],FieldDef:[name("property"),(0,_RuleHelpers.opt)("ArgumentsDef"),(0,_RuleHelpers.p)(":"),"Type",(0,_RuleHelpers.list)("Directive")],ArgumentsDef:[(0,_RuleHelpers.p)("("),(0,_RuleHelpers.list)("InputValueDef"),(0,_RuleHelpers.p)(")")],InputValueDef:[name("attribute"),(0,_RuleHelpers.p)(":"),"Type",(0,_RuleHelpers.opt)("DefaultValue"),(0,_RuleHelpers.list)("Directive")],InterfaceDef:[word("interface"),name("atom"),(0,_RuleHelpers.list)("Directive"),(0,_RuleHelpers.p)("{"),(0,_RuleHelpers.list)("FieldDef"),(0,_RuleHelpers.p)("}")],UnionDef:[word("union"),name("atom"),(0,_RuleHelpers.list)("Directive"),(0,_RuleHelpers.p)("="),(0,_RuleHelpers.list)("UnionMember",(0,_RuleHelpers.p)("|"))],UnionMember:["NamedType"],InputUnionDef:[word("inputUnion"),name("atom"),(0,_RuleHelpers.list)("Directive"),(0,_RuleHelpers.p)("="),(0,_RuleHelpers.list)("InputUnionMember",(0,_RuleHelpers.p)("|"))],InputUnionMember:["InputDef"],EnumDef:[word("enum"),name("atom"),(0,_RuleHelpers.list)("Directive"),(0,_RuleHelpers.p)("{"),(0,_RuleHelpers.list)("EnumValueDef"),(0,_RuleHelpers.p)("}")],EnumValueDef:[name("string-2"),(0,_RuleHelpers.list)("Directive")],InputDef:[word("input"),name("atom"),(0,_RuleHelpers.list)("Directive"),(0,_RuleHelpers.p)("{"),(0,_RuleHelpers.list)("InputValueDef"),(0,_RuleHelpers.p)("}")],ExtendDef:[word("extend"),"ObjectTypeDef"],DirectiveDef:[word("directive"),(0,_RuleHelpers.p)("@","meta"),name("meta"),(0,_RuleHelpers.opt)("ArgumentsDef"),word("on"),(0,_RuleHelpers.list)("DirectiveLocation",(0,_RuleHelpers.p)("|"))],DirectiveLocation:[name("string-2")]}},{"./RuleHelpers":27}],29:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}Object.defineProperty(exports,"__esModule",{value:!0});var _CharacterStream=require("./CharacterStream");Object.defineProperty(exports,"CharacterStream",{enumerable:!0,get:function(){return _interopRequireDefault(_CharacterStream).default}});var _Rules=require("./Rules");Object.defineProperty(exports,"LexRules",{enumerable:!0,get:function(){return _Rules.LexRules}}),Object.defineProperty(exports,"ParseRules",{enumerable:!0,get:function(){return _Rules.ParseRules}}),Object.defineProperty(exports,"isIgnored",{enumerable:!0,get:function(){return _Rules.isIgnored}});var _RuleHelpers=require("./RuleHelpers");Object.defineProperty(exports,"butNot",{enumerable:!0,get:function(){return _RuleHelpers.butNot}}),Object.defineProperty(exports,"list",{enumerable:!0,get:function(){return _RuleHelpers.list}}),Object.defineProperty(exports,"opt",{enumerable:!0,get:function(){return _RuleHelpers.opt}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return _RuleHelpers.p}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return _RuleHelpers.t}});var _onlineParser=require("./onlineParser");Object.defineProperty(exports,"onlineParser",{enumerable:!0,get:function(){return _interopRequireDefault(_onlineParser).default}})},{"./CharacterStream":26,"./RuleHelpers":27,"./Rules":28,"./onlineParser":30}],30:[function(require,module,exports){"use strict";function getToken(stream,state,options){var lexRules=options.lexRules,parseRules=options.parseRules,eatWhitespace=options.eatWhitespace,editorConfig=options.editorConfig;if(state.rule&&0===state.rule.length?popRule(state):state.needsAdvance&&(state.needsAdvance=!1,advanceRule(state,!0)),stream.sol()){var tabSize=editorConfig&&editorConfig.tabSize||2;state.indentLevel=Math.floor(stream.indentation()/tabSize)}if(eatWhitespace(stream))return"ws";var token=lex(lexRules,stream);if(!token)return stream.match(/\S+/),pushRule(SpecialParseRules,state,"Invalid"),"invalidchar";if("Comment"===token.kind)return pushRule(SpecialParseRules,state,"Comment"),"comment";var backupState=assign({},state);if("Punctuation"===token.kind)if(/^[{([]/.test(token.value))state.levels=(state.levels||[]).concat(state.indentLevel+1);else if(/^[})\]]/.test(token.value)){var levels=state.levels=(state.levels||[]).slice(0,-1);state.indentLevel&&levels.length>0&&levels[levels.length-1]<state.indentLevel&&(state.indentLevel=levels[levels.length-1])}for(;state.rule;){var expected="function"==typeof state.rule?0===state.step?state.rule(token,stream):null:state.rule[state.step];if(state.needsSeperator&&(expected=expected&&expected.separator),expected){if(expected.ofRule&&(expected=expected.ofRule),"string"==typeof expected){pushRule(parseRules,state,expected);continue}if(expected.match&&expected.match(token))return expected.update&&expected.update(state,token),"Punctuation"===token.kind?advanceRule(state,!0):state.needsAdvance=!0,expected.style}unsuccessful(state)}return assign(state,backupState),pushRule(SpecialParseRules,state,"Invalid"),"invalidchar"}function assign(to,from){for(var keys=Object.keys(from),i=0;i<keys.length;i++)to[keys[i]]=from[keys[i]];return to}function pushRule(rules,state,ruleKind){if(!rules[ruleKind])throw new TypeError("Unknown rule: "+ruleKind);state.prevState=_extends({},state),state.kind=ruleKind,state.name=null,state.type=null,state.rule=rules[ruleKind],state.step=0,state.needsSeperator=!1}function popRule(state){state.prevState&&(state.kind=state.prevState.kind,state.name=state.prevState.name,state.type=state.prevState.type,state.rule=state.prevState.rule,state.step=state.prevState.step,state.needsSeperator=state.prevState.needsSeperator,state.prevState=state.prevState.prevState)}function advanceRule(state,successful){if(isList(state)){if(state.rule&&state.rule[state.step].separator){var separator=state.rule[state.step].separator;if(state.needsSeperator=!state.needsSeperator,!state.needsSeperator&&separator.ofRule)return}if(successful)return}for(state.needsSeperator=!1,state.step++;state.rule&&!(Array.isArray(state.rule)&&state.step<state.rule.length);)popRule(state),state.rule&&(isList(state)?state.rule&&state.rule[state.step].separator&&(state.needsSeperator=!state.needsSeperator):(state.needsSeperator=!1,state.step++))}function isList(state){return Array.isArray(state.rule)&&"string"!=typeof state.rule[state.step]&&state.rule[state.step].isList}function unsuccessful(state){for(;state.rule&&(!Array.isArray(state.rule)||!state.rule[state.step].ofRule);)popRule(state);state.rule&&advanceRule(state,!1)}function lex(lexRules,stream){for(var kinds=Object.keys(lexRules),i=0;i<kinds.length;i++){var match=stream.match(lexRules[kinds[i]]);if(match&&match instanceof Array)return{kind:kinds[i],value:match[0]}}}Object.defineProperty(exports,"__esModule",{value:!0});var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key])}return target};exports.default=function(){var options=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{eatWhitespace:function(stream){return stream.eatWhile(_Rules.isIgnored)},lexRules:_Rules.LexRules,parseRules:_Rules.ParseRules,editorConfig:{}};return{startState:function(){var initialState={level:0,step:0,name:null,kind:null,type:null,rule:null,needsSeperator:!1,prevState:null};return pushRule(options.parseRules,initialState,"Document"),initialState},token:function(stream,state){return getToken(stream,state,options)}}};var _Rules=require("./Rules"),SpecialParseRules={Invalid:[],Comment:[]}},{"./Rules":28}],31:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function offsetToPosition(text,loc){var buf=text.slice(0,loc),lines=buf.split("\n").length-1,lastLineIndex=buf.lastIndexOf("\n");return new Position(lines,loc-lastLineIndex-1)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.offsetToPosition=offsetToPosition,exports.locToRange=function(text,loc){var start=offsetToPosition(text,loc.start),end=offsetToPosition(text,loc.end);return new Range(start,end)};var Range=exports.Range=function(){function Range(start,end){var _this=this;_classCallCheck(this,Range),this.containsPosition=function(position){return _this.start.line===position.line?_this.start.character<=position.character:_this.end.line===position.line?_this.end.character>=position.character:_this.start.line<=position.line&&_this.end.line>=position.line},this.start=start,this.end=end}return Range.prototype.setStart=function(line,character){this.start=new Position(line,character)},Range.prototype.setEnd=function(line,character){this.end=new Position(line,character)},Range}(),Position=exports.Position=function(){function Position(line,character){var _this2=this;_classCallCheck(this,Position),this.lessThanOrEqualTo=function(position){return _this2.line<position.line||_this2.line===position.line&&_this2.character<=position.character},this.line=line,this.character=character}return Position.prototype.setLine=function(line){this.line=line},Position.prototype.setCharacter=function(character){this.character=character},Position}()},{}],32:[function(require,module,exports){"use strict";function pointToOffset(text,point){var linesUntilPosition=text.split("\n").slice(0,point.line);return point.character+linesUntilPosition.map(function(line){return line.length+1}).reduce(function(a,b){return a+b},0)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.getASTNodeAtPosition=function(query,ast,point){var offset=pointToOffset(query,point),nodeContainingPosition=void 0;return(0,_graphql.visit)(ast,{enter:function(node){if(!("Name"!==node.kind&&node.loc&&node.loc.start<=offset&&offset<=node.loc.end))return!1;nodeContainingPosition=node},leave:function(node){if(node.loc&&node.loc.start<=offset&&offset<=node.loc.end)return!1}}),nodeContainingPosition},exports.pointToOffset=pointToOffset;require("./Range");var _graphql=require("graphql")},{"./Range":31,graphql:174}],33:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _getASTNodeAtPosition=require("./getASTNodeAtPosition");Object.defineProperty(exports,"getASTNodeAtPosition",{enumerable:!0,get:function(){return _getASTNodeAtPosition.getASTNodeAtPosition}}),Object.defineProperty(exports,"pointToOffset",{enumerable:!0,get:function(){return _getASTNodeAtPosition.pointToOffset}});var _Range=require("./Range");Object.defineProperty(exports,"Position",{enumerable:!0,get:function(){return _Range.Position}}),Object.defineProperty(exports,"Range",{enumerable:!0,get:function(){return _Range.Range}}),Object.defineProperty(exports,"locToRange",{enumerable:!0,get:function(){return _Range.locToRange}}),Object.defineProperty(exports,"offsetToPosition",{enumerable:!0,get:function(){return _Range.offsetToPosition}});var _validateWithCustomRules=require("./validateWithCustomRules");Object.defineProperty(exports,"validateWithCustomRules",{enumerable:!0,get:function(){return _validateWithCustomRules.validateWithCustomRules}})},{"./Range":31,"./getASTNodeAtPosition":32,"./validateWithCustomRules":34}],34:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.validateWithCustomRules=function(schema,ast,customRules,isRelayCompatMode){var rulesToSkip=[require("graphql/validation/rules/NoUnusedFragments").NoUnusedFragments,require("graphql/validation/rules/ExecutableDefinitions").ExecutableDefinitions];if(isRelayCompatMode){var KnownFragmentNames=require("graphql/validation/rules/KnownFragmentNames").KnownFragmentNames;rulesToSkip.push(KnownFragmentNames)}var rules=_graphql.specifiedRules.filter(function(rule){return!rulesToSkip.some(function(r){return r===rule})}),typeInfo=new _graphql.TypeInfo(schema);customRules&&Array.prototype.push.apply(rules,customRules);var errors=(0,_graphql.validate)(schema,ast,rules,typeInfo);return errors.length>0?errors.filter(function(error){return-1===error.message.indexOf("Unknown directive")||!(error.nodes&&error.nodes[0]&&error.nodes[0].name&&"arguments"===error.nodes[0].name.value||error.nodes&&error.nodes[0]&&error.nodes[0].name&&error.nodes[0].name.value&&"argumentDefinitions"===error.nodes[0].name.value)}):[]};var _graphql=require("graphql")},{graphql:174,"graphql/validation/rules/ExecutableDefinitions":229,"graphql/validation/rules/KnownFragmentNames":234,"graphql/validation/rules/NoUnusedFragments":239}],35:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.DocExplorer=void 0;var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},_createClass=function(){function e(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,a,r){return a&&e(t.prototype,a),r&&e(t,r),t}}(),_react2=_interopRequireDefault("undefined"!=typeof window?window.React:void 0!==global?global.React:null),_propTypes2=_interopRequireDefault(require("prop-types")),_graphql=require("graphql"),_FieldDoc2=_interopRequireDefault(require("./DocExplorer/FieldDoc")),_SchemaDoc2=_interopRequireDefault(require("./DocExplorer/SchemaDoc")),_SearchBox2=_interopRequireDefault(require("./DocExplorer/SearchBox")),_SearchResults2=_interopRequireDefault(require("./DocExplorer/SearchResults")),_TypeDoc2=_interopRequireDefault(require("./DocExplorer/TypeDoc")),initialNav={name:"Schema",title:"Documentation Explorer"};(exports.DocExplorer=function(e){function t(){_classCallCheck(this,t);var e=_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.handleNavBackClick=function(){e.state.navStack.length>1&&e.setState({navStack:e.state.navStack.slice(0,-1)})},e.handleClickTypeOrField=function(t){e.showDoc(t)},e.handleSearch=function(t){e.showSearch(t)},e.state={navStack:[initialNav]},e}return _inherits(t,e),_createClass(t,[{key:"shouldComponentUpdate",value:function(e,t){return this.props.schema!==e.schema||this.state.navStack!==t.navStack}},{key:"render",value:function(){var e=this.props.schema,t=this.state.navStack,a=t[t.length-1],r=void 0;r=void 0===e?_react2.default.createElement("div",{className:"spinner-container"},_react2.default.createElement("div",{className:"spinner"})):e?a.search?_react2.default.createElement(_SearchResults2.default,{searchValue:a.search,withinType:a.def,schema:e,onClickType:this.handleClickTypeOrField,onClickField:this.handleClickTypeOrField}):1===t.length?_react2.default.createElement(_SchemaDoc2.default,{schema:e,onClickType:this.handleClickTypeOrField}):(0,_graphql.isType)(a.def)?_react2.default.createElement(_TypeDoc2.default,{schema:e,type:a.def,onClickType:this.handleClickTypeOrField,onClickField:this.handleClickTypeOrField}):_react2.default.createElement(_FieldDoc2.default,{field:a.def,onClickType:this.handleClickTypeOrField}):_react2.default.createElement("div",{className:"error-container"},"No Schema Available");var c=1===t.length||(0,_graphql.isType)(a.def)&&a.def.getFields,l=void 0;return t.length>1&&(l=t[t.length-2].name),_react2.default.createElement("div",{className:"doc-explorer",key:a.name},_react2.default.createElement("div",{className:"doc-explorer-title-bar"},l&&_react2.default.createElement("div",{className:"doc-explorer-back",onClick:this.handleNavBackClick},l),_react2.default.createElement("div",{className:"doc-explorer-title"},a.title||a.name),_react2.default.createElement("div",{className:"doc-explorer-rhs"},this.props.children)),_react2.default.createElement("div",{className:"doc-explorer-contents"},c&&_react2.default.createElement(_SearchBox2.default,{value:a.search,placeholder:"Search "+a.name+"...",onSearch:this.handleSearch}),r))}},{key:"showDoc",value:function(e){var t=this.state.navStack;t[t.length-1].def!==e&&this.setState({navStack:t.concat([{name:e.name,def:e}])})}},{key:"showDocForReference",value:function(e){"Type"===e.kind?this.showDoc(e.type):"Field"===e.kind?this.showDoc(e.field):"Argument"===e.kind&&e.field?this.showDoc(e.field):"EnumValue"===e.kind&&e.type&&this.showDoc(e.type)}},{key:"showSearch",value:function(e){var t=this.state.navStack.slice(),a=t[t.length-1];t[t.length-1]=_extends({},a,{search:e}),this.setState({navStack:t})}},{key:"reset",value:function(){this.setState({navStack:[initialNav]})}}]),t}(_react2.default.Component)).propTypes={schema:_propTypes2.default.instanceOf(_graphql.GraphQLSchema)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./DocExplorer/FieldDoc":38,"./DocExplorer/SchemaDoc":40,"./DocExplorer/SearchBox":41,"./DocExplorer/SearchResults":42,"./DocExplorer/TypeDoc":43,graphql:174,"prop-types":152}],36:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function Argument(e){var t=e.arg,r=e.onClickType,a=e.showDefaultValue;return _react2.default.createElement("span",{className:"arg"},_react2.default.createElement("span",{className:"arg-name"},t.name),": ",_react2.default.createElement(_TypeLink2.default,{type:t.type,onClick:r}),!1!==a&&_react2.default.createElement(_DefaultValue2.default,{field:t}))}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=Argument;var _react2=_interopRequireDefault("undefined"!=typeof window?window.React:void 0!==global?global.React:null),_propTypes2=_interopRequireDefault(require("prop-types")),_TypeLink2=_interopRequireDefault(require("./TypeLink")),_DefaultValue2=_interopRequireDefault(require("./DefaultValue"));Argument.propTypes={arg:_propTypes2.default.object.isRequired,onClickType:_propTypes2.default.func.isRequired,showDefaultValue:_propTypes2.default.bool}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./DefaultValue":37,"./TypeLink":44,"prop-types":152}],37:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function DefaultValue(e){var r=e.field,t=r.type,a=r.defaultValue;return void 0!==a?_react2.default.createElement("span",null," = ",_react2.default.createElement("span",{className:"arg-default-value"},(0,_graphql.print)((0,_graphql.astFromValue)(a,t)))):null}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=DefaultValue;var _react2=_interopRequireDefault("undefined"!=typeof window?window.React:void 0!==global?global.React:null),_propTypes2=_interopRequireDefault(require("prop-types")),_graphql=require("graphql");DefaultValue.propTypes={field:_propTypes2.default.object.isRequired}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{graphql:174,"prop-types":152}],38:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),_react2=_interopRequireDefault("undefined"!=typeof window?window.React:void 0!==global?global.React:null),_propTypes2=_interopRequireDefault(require("prop-types")),_Argument2=_interopRequireDefault(require("./Argument")),_MarkdownContent2=_interopRequireDefault(require("./MarkdownContent")),_TypeLink2=_interopRequireDefault(require("./TypeLink")),FieldDoc=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return _inherits(t,e),_createClass(t,[{key:"shouldComponentUpdate",value:function(e){return this.props.field!==e.field}},{key:"render",value:function(){var e=this,t=this.props.field,r=void 0;return t.args&&t.args.length>0&&(r=_react2.default.createElement("div",{className:"doc-category"},_react2.default.createElement("div",{className:"doc-category-title"},"arguments"),t.args.map(function(t){return _react2.default.createElement("div",{key:t.name,className:"doc-category-item"},_react2.default.createElement("div",null,_react2.default.createElement(_Argument2.default,{arg:t,onClickType:e.props.onClickType})),_react2.default.createElement(_MarkdownContent2.default,{className:"doc-value-description",markdown:t.description}))}))),_react2.default.createElement("div",null,_react2.default.createElement(_MarkdownContent2.default,{className:"doc-type-description",markdown:t.description||"No Description"}),t.deprecationReason&&_react2.default.createElement(_MarkdownContent2.default,{className:"doc-deprecation",markdown:t.deprecationReason}),_react2.default.createElement("div",{className:"doc-category"},_react2.default.createElement("div",{className:"doc-category-title"},"type"),_react2.default.createElement(_TypeLink2.default,{type:t.type,onClick:this.props.onClickType})),r)}}]),t}(_react2.default.Component);FieldDoc.propTypes={field:_propTypes2.default.object,onClickType:_propTypes2.default.func},exports.default=FieldDoc}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./Argument":36,"./MarkdownContent":39,"./TypeLink":44,"prop-types":152}],39:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),_react2=_interopRequireDefault("undefined"!=typeof window?window.React:void 0!==global?global.React:null),_propTypes2=_interopRequireDefault(require("prop-types")),md=new(_interopRequireDefault(require("markdown-it")).default),MarkdownContent=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return _inherits(t,e),_createClass(t,[{key:"shouldComponentUpdate",value:function(e){return this.props.markdown!==e.markdown}},{key:"render",value:function(){var e=this.props.markdown;return e?_react2.default.createElement("div",{className:this.props.className,dangerouslySetInnerHTML:{__html:md.render(e)}}):_react2.default.createElement("div",null)}}]),t}(_react2.default.Component);MarkdownContent.propTypes={markdown:_propTypes2.default.string,className:_propTypes2.default.string},exports.default=MarkdownContent}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"markdown-it":91,"prop-types":152}],40:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),_react2=_interopRequireDefault("undefined"!=typeof window?window.React:void 0!==global?global.React:null),_propTypes2=_interopRequireDefault(require("prop-types")),_TypeLink2=_interopRequireDefault(require("./TypeLink")),_MarkdownContent2=_interopRequireDefault(require("./MarkdownContent")),SchemaDoc=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return _inherits(t,e),_createClass(t,[{key:"shouldComponentUpdate",value:function(e){return this.props.schema!==e.schema}},{key:"render",value:function(){var e=this.props.schema,t=e.getQueryType(),r=e.getMutationType&&e.getMutationType(),a=e.getSubscriptionType&&e.getSubscriptionType();return _react2.default.createElement("div",null,_react2.default.createElement(_MarkdownContent2.default,{className:"doc-type-description",markdown:"A GraphQL schema provides a root type for each kind of operation."}),_react2.default.createElement("div",{className:"doc-category"},_react2.default.createElement("div",{className:"doc-category-title"},"root types"),_react2.default.createElement("div",{className:"doc-category-item"},_react2.default.createElement("span",{className:"keyword"},"query"),": ",_react2.default.createElement(_TypeLink2.default,{type:t,onClick:this.props.onClickType})),r&&_react2.default.createElement("div",{className:"doc-category-item"},_react2.default.createElement("span",{className:"keyword"},"mutation"),": ",_react2.default.createElement(_TypeLink2.default,{type:r,onClick:this.props.onClickType})),a&&_react2.default.createElement("div",{className:"doc-category-item"},_react2.default.createElement("span",{className:"keyword"},"subscription"),": ",_react2.default.createElement(_TypeLink2.default,{type:a,onClick:this.props.onClickType}))))}}]),t}(_react2.default.Component);SchemaDoc.propTypes={schema:_propTypes2.default.object,onClickType:_propTypes2.default.func},exports.default=SchemaDoc}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./MarkdownContent":39,"./TypeLink":44,"prop-types":152}],41:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),_react2=_interopRequireDefault("undefined"!=typeof window?window.React:void 0!==global?global.React:null),_propTypes2=_interopRequireDefault(require("prop-types")),_debounce2=_interopRequireDefault(require("../../utility/debounce")),SearchBox=function(e){function t(e){_classCallCheck(this,t);var r=_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.handleChange=function(e){var t=e.target.value;r.setState({value:t}),r.debouncedOnSearch(t)},r.handleClear=function(){r.setState({value:""}),r.props.onSearch("")},r.state={value:e.value||""},r.debouncedOnSearch=(0,_debounce2.default)(200,r.props.onSearch),r}return _inherits(t,e),_createClass(t,[{key:"render",value:function(){return _react2.default.createElement("label",{className:"search-box"},_react2.default.createElement("input",{value:this.state.value,onChange:this.handleChange,type:"text",placeholder:this.props.placeholder}),this.state.value&&_react2.default.createElement("div",{className:"search-box-clear",onClick:this.handleClear},"✕"))}}]),t}(_react2.default.Component);SearchBox.propTypes={value:_propTypes2.default.string,placeholder:_propTypes2.default.string,onSearch:_propTypes2.default.func},exports.default=SearchBox}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utility/debounce":60,"prop-types":152}],42:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function isMatch(e,t){try{var r=t.replace(/[^_0-9A-Za-z]/g,function(e){return"\\"+e});return-1!==e.search(new RegExp(r,"i"))}catch(r){return-1!==e.toLowerCase().indexOf(t.toLowerCase())}}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),_react2=_interopRequireDefault("undefined"!=typeof window?window.React:void 0!==global?global.React:null),_propTypes2=_interopRequireDefault(require("prop-types")),_Argument2=_interopRequireDefault(require("./Argument")),_TypeLink2=_interopRequireDefault(require("./TypeLink")),SearchResults=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return _inherits(t,e),_createClass(t,[{key:"shouldComponentUpdate",value:function(e){return this.props.schema!==e.schema||this.props.searchValue!==e.searchValue}},{key:"render",value:function(){var e=this.props.searchValue,t=this.props.withinType,r=this.props.schema,n=this.props.onClickType,a=this.props.onClickField,o=[],l=[],u=[],c=r.getTypeMap(),i=Object.keys(c);t&&(i=i.filter(function(e){return e!==t.name})).unshift(t.name);var s=!0,p=!1,f=void 0;try{for(var h,_=i[Symbol.iterator]();!(s=(h=_.next()).done)&&"break"!==function(){var r=h.value;if(o.length+l.length+u.length>=100)return"break";var i=c[r];if(t!==i&&isMatch(r,e)&&l.push(_react2.default.createElement("div",{className:"doc-category-item",key:r},_react2.default.createElement(_TypeLink2.default,{type:i,onClick:n}))),i.getFields){var s=i.getFields();Object.keys(s).forEach(function(l){var c=s[l],p=void 0;if(!isMatch(l,e)){if(!c.args||!c.args.length)return;if(0===(p=c.args.filter(function(t){return isMatch(t.name,e)})).length)return}var f=_react2.default.createElement("div",{className:"doc-category-item",key:r+"."+l},t!==i&&[_react2.default.createElement(_TypeLink2.default,{key:"type",type:i,onClick:n}),"."],_react2.default.createElement("a",{className:"field-name",onClick:function(e){return a(c,i,e)}},c.name),p&&["(",_react2.default.createElement("span",{key:"args"},p.map(function(e){return _react2.default.createElement(_Argument2.default,{key:e.name,arg:e,onClickType:n,showDefaultValue:!1})})),")"]);t===i?o.push(f):u.push(f)})}}();s=!0);}catch(e){p=!0,f=e}finally{try{!s&&_.return&&_.return()}finally{if(p)throw f}}return o.length+l.length+u.length===0?_react2.default.createElement("span",{className:"doc-alert-text"},"No results found."):t&&l.length+u.length>0?_react2.default.createElement("div",null,o,_react2.default.createElement("div",{className:"doc-category"},_react2.default.createElement("div",{className:"doc-category-title"},"other results"),l,u)):_react2.default.createElement("div",null,o,l,u)}}]),t}(_react2.default.Component);SearchResults.propTypes={schema:_propTypes2.default.object,withinType:_propTypes2.default.object,searchValue:_propTypes2.default.string,onClickType:_propTypes2.default.func,onClickField:_propTypes2.default.func},exports.default=SearchResults}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./Argument":36,"./TypeLink":44,"prop-types":152}],43:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function Field(e){var t=e.type,a=e.field,r=e.onClickType,n=e.onClickField;return _react2.default.createElement("div",{className:"doc-category-item"},_react2.default.createElement("a",{className:"field-name",onClick:function(e){return n(a,t,e)}},a.name),a.args&&a.args.length>0&&["(",_react2.default.createElement("span",{key:"args"},a.args.map(function(e){return _react2.default.createElement(_Argument2.default,{key:e.name,arg:e,onClickType:r})})),")"],": ",_react2.default.createElement(_TypeLink2.default,{type:a.type,onClick:r}),_react2.default.createElement(_DefaultValue2.default,{field:a}),a.description&&_react2.default.createElement(_MarkdownContent2.default,{className:"field-short-description",markdown:a.description}),a.deprecationReason&&_react2.default.createElement(_MarkdownContent2.default,{className:"doc-deprecation",markdown:a.deprecationReason}))}function EnumValue(e){var t=e.value;return _react2.default.createElement("div",{className:"doc-category-item"},_react2.default.createElement("div",{className:"enum-value"},t.name),_react2.default.createElement(_MarkdownContent2.default,{className:"doc-value-description",markdown:t.description}),t.deprecationReason&&_react2.default.createElement(_MarkdownContent2.default,{className:"doc-deprecation",markdown:t.deprecationReason}))}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,a,r){return a&&e(t.prototype,a),r&&e(t,r),t}}(),_react2=_interopRequireDefault("undefined"!=typeof window?window.React:void 0!==global?global.React:null),_propTypes2=_interopRequireDefault(require("prop-types")),_graphql=require("graphql"),_Argument2=_interopRequireDefault(require("./Argument")),_MarkdownContent2=_interopRequireDefault(require("./MarkdownContent")),_TypeLink2=_interopRequireDefault(require("./TypeLink")),_DefaultValue2=_interopRequireDefault(require("./DefaultValue")),TypeDoc=function(e){function t(e){_classCallCheck(this,t);var a=_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return a.handleShowDeprecated=function(){return a.setState({showDeprecated:!0})},a.state={showDeprecated:!1},a}return _inherits(t,e),_createClass(t,[{key:"shouldComponentUpdate",value:function(e,t){return this.props.type!==e.type||this.props.schema!==e.schema||this.state.showDeprecated!==t.showDeprecated}},{key:"render",value:function(){var e=this.props.schema,t=this.props.type,a=this.props.onClickType,r=this.props.onClickField,n=void 0,c=void 0;t instanceof _graphql.GraphQLUnionType?(n="possible types",c=e.getPossibleTypes(t)):t instanceof _graphql.GraphQLInputUnionType?(n="possible input types",c=e.getPossibleTypes(t)):t instanceof _graphql.GraphQLInterfaceType?(n="implementations",c=e.getPossibleTypes(t)):t instanceof _graphql.GraphQLObjectType&&(n="implements",c=t.getInterfaces());var l=void 0;c&&c.length>0&&(l=_react2.default.createElement("div",{className:"doc-category"},_react2.default.createElement("div",{className:"doc-category-title"},n),c.map(function(e){return _react2.default.createElement("div",{key:e.name,className:"doc-category-item"},_react2.default.createElement(_TypeLink2.default,{type:e,onClick:a}))})));var o=void 0,i=void 0;if(t.getFields){var p=t.getFields(),u=Object.keys(p).map(function(e){return p[e]});o=_react2.default.createElement("div",{className:"doc-category"},_react2.default.createElement("div",{className:"doc-category-title"},"fields"),u.filter(function(e){return!e.isDeprecated}).map(function(e){return _react2.default.createElement(Field,{key:e.name,type:t,field:e,onClickType:a,onClickField:r})}));var s=u.filter(function(e){return e.isDeprecated});s.length>0&&(i=_react2.default.createElement("div",{className:"doc-category"},_react2.default.createElement("div",{className:"doc-category-title"},"deprecated fields"),this.state.showDeprecated?s.map(function(e){return _react2.default.createElement(Field,{key:e.name,type:t,field:e,onClickType:a,onClickField:r})}):_react2.default.createElement("button",{className:"show-btn",onClick:this.handleShowDeprecated},"Show deprecated fields...")))}var d=void 0,f=void 0;if(t instanceof _graphql.GraphQLEnumType){var _=t.getValues();d=_react2.default.createElement("div",{className:"doc-category"},_react2.default.createElement("div",{className:"doc-category-title"},"values"),_.filter(function(e){return!e.isDeprecated}).map(function(e){return _react2.default.createElement(EnumValue,{key:e.name,value:e})}));var m=_.filter(function(e){return e.isDeprecated});m.length>0&&(f=_react2.default.createElement("div",{className:"doc-category"},_react2.default.createElement("div",{className:"doc-category-title"},"deprecated values"),this.state.showDeprecated?m.map(function(e){return _react2.default.createElement(EnumValue,{key:e.name,value:e})}):_react2.default.createElement("button",{className:"show-btn",onClick:this.handleShowDeprecated},"Show deprecated values...")))}return _react2.default.createElement("div",null,_react2.default.createElement(_MarkdownContent2.default,{className:"doc-type-description",markdown:t.description||"No Description"}),t instanceof _graphql.GraphQLObjectType&&l,o,i,d,f,!(t instanceof _graphql.GraphQLObjectType)&&l)}}]),t}(_react2.default.Component);TypeDoc.propTypes={schema:_propTypes2.default.instanceOf(_graphql.GraphQLSchema),type:_propTypes2.default.object,onClickType:_propTypes2.default.func,onClickField:_propTypes2.default.func},exports.default=TypeDoc,Field.propTypes={type:_propTypes2.default.object,field:_propTypes2.default.object,onClickType:_propTypes2.default.func,onClickField:_propTypes2.default.func},EnumValue.propTypes={value:_propTypes2.default.object}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./Argument":36,"./DefaultValue":37,"./MarkdownContent":39,"./TypeLink":44,graphql:174,"prop-types":152}],44:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function renderType(e,t){return e instanceof _graphql.GraphQLNonNull?_react2.default.createElement("span",null,renderType(e.ofType,t),"!"):e instanceof _graphql.GraphQLList?_react2.default.createElement("span",null,"[",renderType(e.ofType,t),"]"):_react2.default.createElement("a",{className:"type-name",onClick:function(r){return t(e,r)}},e.name)}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),_react2=_interopRequireDefault("undefined"!=typeof window?window.React:void 0!==global?global.React:null),_propTypes2=_interopRequireDefault(require("prop-types")),_graphql=require("graphql"),TypeLink=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return _inherits(t,e),_createClass(t,[{key:"shouldComponentUpdate",value:function(e){return this.props.type!==e.type}},{key:"render",value:function(){return renderType(this.props.type,this.props.onClick)}}]),t}(_react2.default.Component);TypeLink.propTypes={type:_propTypes2.default.object,onClick:_propTypes2.default.func},exports.default=TypeLink}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{graphql:174,"prop-types":152}],45:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.ExecuteButton=void 0;var _createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),_react2=_interopRequireDefault("undefined"!=typeof window?window.React:void 0!==global?global.React:null),_propTypes2=_interopRequireDefault(require("prop-types"));(exports.ExecuteButton=function(e){function t(e){_classCallCheck(this,t);var n=_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n._onClick=function(){n.props.isRunning?n.props.onStop():n.props.onRun()},n._onOptionSelected=function(e){n.setState({optionsOpen:!1}),n.props.onRun(e.name&&e.name.value)},n._onOptionsOpen=function(e){var t=!0,o=e.target;n.setState({highlight:null,optionsOpen:!0});var r=function(e){t&&e.target===o?t=!1:(document.removeEventListener("mouseup",r),r=null,o.parentNode.compareDocumentPosition(e.target)&Node.DOCUMENT_POSITION_CONTAINED_BY||n.setState({optionsOpen:!1}))};document.addEventListener("mouseup",r)},n.state={optionsOpen:!1,highlight:null},n}return _inherits(t,e),_createClass(t,[{key:"render",value:function(){var e=this,t=this.props.operations,n=this.state.optionsOpen,o=t&&t.length>1,r=null;if(o&&n){var u=this.state.highlight;r=_react2.default.createElement("ul",{className:"execute-options"},t.map(function(t){return _react2.default.createElement("li",{key:t.name?t.name.value:"*",className:t===u?"selected":void 0,onMouseOver:function(){return e.setState({highlight:t})},onMouseOut:function(){return e.setState({highlight:null})},onMouseUp:function(){return e._onOptionSelected(t)}},t.name?t.name.value:"<Unnamed>")}))}var a=void 0;!this.props.isRunning&&o||(a=this._onClick);var i=void 0;this.props.isRunning||!o||n||(i=this._onOptionsOpen);var s=this.props.isRunning?_react2.default.createElement("path",{d:"M 10 10 L 23 10 L 23 23 L 10 23 z"}):_react2.default.createElement("path",{d:"M 11 9 L 24 16 L 11 23 z"});return _react2.default.createElement("div",{className:"execute-button-wrap"},_react2.default.createElement("button",{type:"button",className:"execute-button",onMouseDown:i,onClick:a,title:"Execute Query (Ctrl-Enter)"},_react2.default.createElement("svg",{width:"34",height:"34"},s)),r)}}]),t}(_react2.default.Component)).propTypes={onRun:_propTypes2.default.func,onStop:_propTypes2.default.func,isRunning:_propTypes2.default.bool,operations:_propTypes2.default.array}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"prop-types":152}],46:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function isPromise(e){return"object"===(void 0===e?"undefined":_typeof(e))&&"function"==typeof e.then}function observableToPromise(e){return isObservable(e)?new Promise(function(t,r){var o=e.subscribe(function(e){t(e),o.unsubscribe()},r,function(){r(new Error("no value resolved"))})}):e}function isObservable(e){return"object"===(void 0===e?"undefined":_typeof(e))&&"function"==typeof e.subscribe}Object.defineProperty(exports,"__esModule",{value:!0}),exports.GraphiQL=void 0;var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},_createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),_react2=_interopRequireDefault("undefined"!=typeof window?window.React:void 0!==global?global.React:null),_propTypes2=_interopRequireDefault(require("prop-types")),_reactDom2=_interopRequireDefault("undefined"!=typeof window?window.ReactDOM:void 0!==global?global.ReactDOM:null),_graphql=require("graphql"),_ExecuteButton=require("./ExecuteButton"),_ToolbarButton=require("./ToolbarButton"),_ToolbarGroup=require("./ToolbarGroup"),_ToolbarMenu=require("./ToolbarMenu"),_ToolbarSelect=require("./ToolbarSelect"),_QueryEditor=require("./QueryEditor"),_VariableEditor=require("./VariableEditor"),_ResultViewer=require("./ResultViewer"),_DocExplorer=require("./DocExplorer"),_QueryHistory=require("./QueryHistory"),_CodeMirrorSizer2=_interopRequireDefault(require("../utility/CodeMirrorSizer")),_StorageAPI2=_interopRequireDefault(require("../utility/StorageAPI")),_getQueryFacts2=_interopRequireDefault(require("../utility/getQueryFacts")),_getSelectedOperationName2=_interopRequireDefault(require("../utility/getSelectedOperationName")),_debounce2=_interopRequireDefault(require("../utility/debounce")),_find2=_interopRequireDefault(require("../utility/find")),_fillLeafs2=require("../utility/fillLeafs"),_elementPosition=require("../utility/elementPosition"),_mergeAst=require("../utility/mergeAst"),_introspectionQueries=require("../utility/introspectionQueries"),DEFAULT_DOC_EXPLORER_WIDTH=350,GraphiQL=exports.GraphiQL=function(e){function t(e){_classCallCheck(this,t);var r=_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));if(_initialiseProps.call(r),"function"!=typeof e.fetcher)throw new TypeError("GraphiQL requires a fetcher function.");r._storage=new _StorageAPI2.default(e.storage);var o=void 0!==e.query?e.query:null!==r._storage.get("query")?r._storage.get("query"):void 0!==e.defaultQuery?e.defaultQuery:defaultQuery,i=(0,_getQueryFacts2.default)(e.schema,o),n=void 0!==e.variables?e.variables:r._storage.get("variables"),a=void 0!==e.operationName?e.operationName:(0,_getSelectedOperationName2.default)(null,r._storage.get("operationName"),i&&i.operations);return r.state=_extends({schema:e.schema,query:o,variables:n,operationName:a,response:e.response,editorFlex:Number(r._storage.get("editorFlex"))||1,variableEditorOpen:Boolean(n),variableEditorHeight:Number(r._storage.get("variableEditorHeight"))||200,docExplorerOpen:"true"===r._storage.get("docExplorerOpen")||!1,historyPaneOpen:"true"===r._storage.get("historyPaneOpen")||!1,docExplorerWidth:Number(r._storage.get("docExplorerWidth"))||DEFAULT_DOC_EXPLORER_WIDTH,isWaitingForResponse:!1,subscription:null},i),r._editorQueryID=0,"object"===("undefined"==typeof window?"undefined":_typeof(window))&&window.addEventListener("beforeunload",function(){return r.componentWillUnmount()}),r}return _inherits(t,e),_createClass(t,[{key:"componentDidMount",value:function(){void 0===this.state.schema&&this._fetchSchema(),this.codeMirrorSizer=new _CodeMirrorSizer2.default,global.g=this}},{key:"componentWillReceiveProps",value:function(e){var t=this,r=this.state.schema,o=this.state.query,i=this.state.variables,n=this.state.operationName,a=this.state.response;if(void 0!==e.schema&&(r=e.schema),void 0!==e.query&&(o=e.query),void 0!==e.variables&&(i=e.variables),void 0!==e.operationName&&(n=e.operationName),void 0!==e.response&&(a=e.response),r!==this.state.schema||o!==this.state.query||n!==this.state.operationName){var s=this._updateQueryFacts(o,n,this.state.operations,r);void 0!==s&&(n=s.operationName,this.setState(s))}void 0===e.schema&&e.fetcher!==this.props.fetcher&&(r=void 0),this.setState({schema:r,query:o,variables:i,operationName:n,response:a},function(){void 0===t.state.schema&&(t.docExplorerComponent.reset(),t._fetchSchema())})}},{key:"componentDidUpdate",value:function(){this.codeMirrorSizer.updateSizes([this.queryEditorComponent,this.variableEditorComponent,this.resultComponent])}},{key:"componentWillUnmount",value:function(){this._storage.set("query",this.state.query),this._storage.set("variables",this.state.variables),this._storage.set("operationName",this.state.operationName),this._storage.set("editorFlex",this.state.editorFlex),this._storage.set("variableEditorHeight",this.state.variableEditorHeight),this._storage.set("docExplorerWidth",this.state.docExplorerWidth),this._storage.set("docExplorerOpen",this.state.docExplorerOpen),this._storage.set("historyPaneOpen",this.state.historyPaneOpen)}},{key:"render",value:function(){var e=this,r=_react2.default.Children.toArray(this.props.children),o=(0,_find2.default)(r,function(e){return e.type===t.Logo})||_react2.default.createElement(t.Logo,null),i=(0,_find2.default)(r,function(e){return e.type===t.Toolbar})||_react2.default.createElement(t.Toolbar,null,_react2.default.createElement(_ToolbarButton.ToolbarButton,{onClick:this.handlePrettifyQuery,title:"Prettify Query (Shift-Ctrl-P)",label:"Prettify"}),_react2.default.createElement(_ToolbarButton.ToolbarButton,{onClick:this.handleMergeQuery,title:"Merge Query (Shift-Ctrl-M)",label:"Merge"}),_react2.default.createElement(_ToolbarButton.ToolbarButton,{onClick:this.handleToggleHistory,title:"Show History",label:"History"})),n=(0,_find2.default)(r,function(e){return e.type===t.Footer}),a={WebkitFlex:this.state.editorFlex,flex:this.state.editorFlex},s={display:this.state.docExplorerOpen?"block":"none",width:this.state.docExplorerWidth},l="docExplorerWrap"+(this.state.docExplorerWidth<200?" doc-explorer-narrow":""),u={display:this.state.historyPaneOpen?"block":"none",width:"230px",zIndex:"7"},c=this.state.variableEditorOpen,d={height:c?this.state.variableEditorHeight:null};return _react2.default.createElement("div",{className:"graphiql-container"},_react2.default.createElement("div",{className:"historyPaneWrap",style:u},_react2.default.createElement(_QueryHistory.QueryHistory,{operationName:this.state.operationName,query:this.state.query,variables:this.state.variables,onSelectQuery:this.handleSelectHistoryQuery,storage:this._storage,queryID:this._editorQueryID},_react2.default.createElement("div",{className:"docExplorerHide",onClick:this.handleToggleHistory},"✕"))),_react2.default.createElement("div",{className:"editorWrap"},_react2.default.createElement("div",{className:"topBarWrap"},_react2.default.createElement("div",{className:"topBar"},o,_react2.default.createElement(_ExecuteButton.ExecuteButton,{isRunning:Boolean(this.state.subscription),onRun:this.handleRunQuery,onStop:this.handleStopQuery,operations:this.state.operations}),i),!this.state.docExplorerOpen&&_react2.default.createElement("button",{className:"docExplorerShow",onClick:this.handleToggleDocs},"Docs")),_react2.default.createElement("div",{ref:function(t){e.editorBarComponent=t},className:"editorBar",onDoubleClick:this.handleResetResize,onMouseDown:this.handleResizeStart},_react2.default.createElement("div",{className:"queryWrap",style:a},_react2.default.createElement(_QueryEditor.QueryEditor,{ref:function(t){e.queryEditorComponent=t},schema:this.state.schema,value:this.state.query,onEdit:this.handleEditQuery,onHintInformationRender:this.handleHintInformationRender,onClickReference:this.handleClickReference,onPrettifyQuery:this.handlePrettifyQuery,onMergeQuery:this.handleMergeQuery,onRunQuery:this.handleEditorRunQuery,editorTheme:this.props.editorTheme}),_react2.default.createElement("div",{className:"variable-editor",style:d},_react2.default.createElement("div",{className:"variable-editor-title",style:{cursor:c?"row-resize":"n-resize"},onMouseDown:this.handleVariableResizeStart},"Query Variables"),_react2.default.createElement(_VariableEditor.VariableEditor,{ref:function(t){e.variableEditorComponent=t},value:this.state.variables,variableToType:this.state.variableToType,onEdit:this.handleEditVariables,onHintInformationRender:this.handleHintInformationRender,onPrettifyQuery:this.handlePrettifyQuery,onMergeQuery:this.handleMergeQuery,onRunQuery:this.handleEditorRunQuery,editorTheme:this.props.editorTheme}))),_react2.default.createElement("div",{className:"resultWrap"},this.state.isWaitingForResponse&&_react2.default.createElement("div",{className:"spinner-container"},_react2.default.createElement("div",{className:"spinner"})),_react2.default.createElement(_ResultViewer.ResultViewer,{ref:function(t){e.resultComponent=t},value:this.state.response,editorTheme:this.props.editorTheme,ResultsTooltip:this.props.ResultsTooltip}),n))),_react2.default.createElement("div",{className:l,style:s},_react2.default.createElement("div",{className:"docExplorerResizer",onDoubleClick:this.handleDocsResetResize,onMouseDown:this.handleDocsResizeStart}),_react2.default.createElement(_DocExplorer.DocExplorer,{ref:function(t){e.docExplorerComponent=t},schema:this.state.schema},_react2.default.createElement("div",{className:"docExplorerHide",onClick:this.handleToggleDocs},"✕"))))}},{key:"getQueryEditor",value:function(){return this.queryEditorComponent.getCodeMirror()}},{key:"getVariableEditor",value:function(){return this.variableEditorComponent.getCodeMirror()}},{key:"refresh",value:function(){this.queryEditorComponent.getCodeMirror().refresh(),this.variableEditorComponent.getCodeMirror().refresh(),this.resultComponent.getCodeMirror().refresh()}},{key:"autoCompleteLeafs",value:function(){var e=(0,_fillLeafs2.fillLeafs)(this.state.schema,this.state.query,this.props.getDefaultFieldNames),t=e.insertions,r=e.result;if(t&&t.length>0){var o=this.getQueryEditor();o.operation(function(){var e=o.getCursor(),i=o.indexFromPos(e);o.setValue(r);var n=0,a=t.map(function(e){var t=e.index,r=e.string;return o.markText(o.posFromIndex(t+n),o.posFromIndex(t+(n+=r.length)),{className:"autoInsertedLeaf",clearOnEnter:!0,title:"Automatically added leaf fields"})});setTimeout(function(){return a.forEach(function(e){return e.clear()})},7e3);var s=i;t.forEach(function(e){var t=e.index,r=e.string;t<i&&(s+=r.length)}),o.setCursor(o.posFromIndex(s))})}return r}},{key:"_fetchSchema",value:function(){var e=this,t=this.props.fetcher,r=observableToPromise(t({query:_introspectionQueries.introspectionQuery}));isPromise(r)?r.then(function(e){if(e.data)return console.log(e.data),e;var o=observableToPromise(t({query:_introspectionQueries.introspectionQuerySansSubscriptions}));if(!isPromise(r))throw new Error("Fetcher did not return a Promise for introspection.");return o}).then(function(t){if(void 0===e.state.schema)if(t&&t.data){var r=(0,_graphql.buildClientSchema)(t.data),o=(0,_getQueryFacts2.default)(r,e.state.query);e.setState(_extends({schema:r},o))}else{var i="string"==typeof t?t:JSON.stringify(t,null,2);e.setState({schema:null,response:i})}}).catch(function(t){e.setState({schema:null,response:t&&String(t.stack||t)})}):this.setState({response:"Fetcher did not return a Promise for introspection."})}},{key:"_fetchQuery",value:function(e,t,r,o){var i=this,n=this.props.fetcher,a=null;try{a=t&&""!==t.trim()?JSON.parse(t):null}catch(e){throw new Error("Variables are invalid JSON: "+e.message+".")}if("object"!==(void 0===a?"undefined":_typeof(a)))throw new Error("Variables are not a JSON object.");var s=n({query:e,variables:a,operationName:r});if(!isPromise(s)){if(isObservable(s))return s.subscribe({next:o,error:function(e){i.setState({isWaitingForResponse:!1,response:e&&String(e.stack||e),subscription:null})},complete:function(){i.setState({isWaitingForResponse:!1,subscription:null})}});throw new Error("Fetcher did not return Promise or Observable.")}s.then(o).catch(function(e){i.setState({isWaitingForResponse:!1,response:e&&String(e.stack||e)})})}},{key:"_runQueryAtCursor",value:function(){if(this.state.subscription)this.handleStopQuery();else{var e=void 0,t=this.state.operations;if(t){var r=this.getQueryEditor();if(r.hasFocus())for(var o=r.getCursor(),i=r.indexFromPos(o),n=0;n<t.length;n++){var a=t[n];if(a.loc.start<=i&&a.loc.end>=i){e=a.name&&a.name.value;break}}}this.handleRunQuery(e)}}},{key:"_didClickDragBar",value:function(e){if(0!==e.button||e.ctrlKey)return!1;var t=e.target;if(0!==t.className.indexOf("CodeMirror-gutter"))return!1;for(var r=_reactDom2.default.findDOMNode(this.resultComponent);t;){if(t===r)return!0;t=t.parentNode}return!1}}]),t}(_react2.default.Component);GraphiQL.propTypes={fetcher:_propTypes2.default.func.isRequired,schema:_propTypes2.default.instanceOf(_graphql.GraphQLSchema),query:_propTypes2.default.string,variables:_propTypes2.default.string,operationName:_propTypes2.default.string,response:_propTypes2.default.string,storage:_propTypes2.default.shape({getItem:_propTypes2.default.func,setItem:_propTypes2.default.func,removeItem:_propTypes2.default.func}),defaultQuery:_propTypes2.default.string,onEditQuery:_propTypes2.default.func,onEditVariables:_propTypes2.default.func,onEditOperationName:_propTypes2.default.func,onToggleDocs:_propTypes2.default.func,getDefaultFieldNames:_propTypes2.default.func,editorTheme:_propTypes2.default.string,onToggleHistory:_propTypes2.default.func,ResultsTooltip:_propTypes2.default.any};var _initialiseProps=function(){var e=this;this.handleClickReference=function(t){e.setState({docExplorerOpen:!0},function(){e.docExplorerComponent.showDocForReference(t)})},this.handleRunQuery=function(t){var r=++e._editorQueryID,o=e.autoCompleteLeafs()||e.state.query,i=e.state.variables,n=e.state.operationName;t&&t!==n&&(n=t,e.handleEditOperationName(n));try{e.setState({isWaitingForResponse:!0,response:null,operationName:n});var a=e._fetchQuery(o,i,n,function(t){r===e._editorQueryID&&e.setState({isWaitingForResponse:!1,response:JSON.stringify(t,null,2)})});e.setState({subscription:a})}catch(t){e.setState({isWaitingForResponse:!1,response:t.message})}},this.handleStopQuery=function(){var t=e.state.subscription;e.setState({isWaitingForResponse:!1,subscription:null}),t&&t.unsubscribe()},this.handlePrettifyQuery=function(){var t=e.getQueryEditor();t.setValue((0,_graphql.print)((0,_graphql.parse)(t.getValue())))},this.handleMergeQuery=function(){var t=e.getQueryEditor(),r=t.getValue();if(r){var o=(0,_graphql.parse)(r);t.setValue((0,_graphql.print)((0,_mergeAst.mergeAst)(o)))}},this.handleEditQuery=(0,_debounce2.default)(100,function(t){var r=e._updateQueryFacts(t,e.state.operationName,e.state.operations,e.state.schema);if(e.setState(_extends({query:t},r)),e.props.onEditQuery)return e.props.onEditQuery(t)}),this._updateQueryFacts=function(t,r,o,i){var n=(0,_getQueryFacts2.default)(i,t);if(n){var a=(0,_getSelectedOperationName2.default)(o,r,n.operations),s=e.props.onEditOperationName;return s&&r!==a&&s(a),_extends({operationName:a},n)}},this.handleEditVariables=function(t){e.setState({variables:t}),e.props.onEditVariables&&e.props.onEditVariables(t)},this.handleEditOperationName=function(t){var r=e.props.onEditOperationName;r&&r(t)},this.handleHintInformationRender=function(t){t.addEventListener("click",e._onClickHintInformation);var r=void 0;t.addEventListener("DOMNodeRemoved",r=function(){t.removeEventListener("DOMNodeRemoved",r),t.removeEventListener("click",e._onClickHintInformation)})},this.handleEditorRunQuery=function(){e._runQueryAtCursor()},this._onClickHintInformation=function(t){if("typeName"===t.target.className){var r=t.target.innerHTML,o=e.state.schema;if(o){var i=o.getType(r);i&&e.setState({docExplorerOpen:!0},function(){e.docExplorerComponent.showDoc(i)})}}},this.handleToggleDocs=function(){"function"==typeof e.props.onToggleDocs&&e.props.onToggleDocs(!e.state.docExplorerOpen),e.setState({docExplorerOpen:!e.state.docExplorerOpen})},this.handleToggleHistory=function(){"function"==typeof e.props.onToggleHistory&&e.props.onToggleHistory(!e.state.historyPaneOpen),e.setState({historyPaneOpen:!e.state.historyPaneOpen})},this.handleSelectHistoryQuery=function(t,r,o){e.handleEditQuery(t),e.handleEditVariables(r),e.handleEditOperationName(o)},this.handleResizeStart=function(t){if(e._didClickDragBar(t)){t.preventDefault();var r=t.clientX-(0,_elementPosition.getLeft)(t.target),o=function(t){if(0===t.buttons)return i();var o=_reactDom2.default.findDOMNode(e.editorBarComponent),n=t.clientX-(0,_elementPosition.getLeft)(o)-r,a=o.clientWidth-n;e.setState({editorFlex:n/a})},i=function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(){document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",i),o=null,i=null});document.addEventListener("mousemove",o),document.addEventListener("mouseup",i)}},this.handleResetResize=function(){e.setState({editorFlex:1})},this.handleDocsResizeStart=function(t){t.preventDefault();var r=e.state.docExplorerWidth,o=t.clientX-(0,_elementPosition.getLeft)(t.target),i=function(t){if(0===t.buttons)return n();var r=_reactDom2.default.findDOMNode(e),i=t.clientX-(0,_elementPosition.getLeft)(r)-o,a=r.clientWidth-i;a<100?e.setState({docExplorerOpen:!1}):e.setState({docExplorerOpen:!0,docExplorerWidth:Math.min(a,650)})},n=function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(){e.state.docExplorerOpen||e.setState({docExplorerWidth:r}),document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",n),i=null,n=null});document.addEventListener("mousemove",i),document.addEventListener("mouseup",n)},this.handleDocsResetResize=function(){e.setState({docExplorerWidth:DEFAULT_DOC_EXPLORER_WIDTH})},this.handleVariableResizeStart=function(t){t.preventDefault();var r=!1,o=e.state.variableEditorOpen,i=e.state.variableEditorHeight,n=t.clientY-(0,_elementPosition.getTop)(t.target),a=function(t){if(0===t.buttons)return s();r=!0;var o=_reactDom2.default.findDOMNode(e.editorBarComponent),a=t.clientY-(0,_elementPosition.getTop)(o)-n,l=o.clientHeight-a;l<60?e.setState({variableEditorOpen:!1,variableEditorHeight:i}):e.setState({variableEditorOpen:!0,variableEditorHeight:l})},s=function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(){r||e.setState({variableEditorOpen:!o}),document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",s),a=null,s=null});document.addEventListener("mousemove",a),document.addEventListener("mouseup",s)}};GraphiQL.Logo=function(e){return _react2.default.createElement("div",{className:"title"},e.children||_react2.default.createElement("span",null,"Graph",_react2.default.createElement("em",null,"i"),"QL"))},GraphiQL.Toolbar=function(e){return _react2.default.createElement("div",{className:"toolbar"},e.children)},GraphiQL.QueryEditor=_QueryEditor.QueryEditor,GraphiQL.VariableEditor=_VariableEditor.VariableEditor,GraphiQL.ResultViewer=_ResultViewer.ResultViewer,GraphiQL.Button=_ToolbarButton.ToolbarButton,GraphiQL.ToolbarButton=_ToolbarButton.ToolbarButton,GraphiQL.Group=_ToolbarGroup.ToolbarGroup,GraphiQL.Menu=_ToolbarMenu.ToolbarMenu,GraphiQL.MenuItem=_ToolbarMenu.ToolbarMenuItem,GraphiQL.Select=_ToolbarSelect.ToolbarSelect,GraphiQL.SelectOption=_ToolbarSelect.ToolbarSelectOption,GraphiQL.Footer=function(e){return _react2.default.createElement("div",{className:"footer"},e.children)};var defaultQuery='# Welcome to GraphiQL\n#\n# GraphiQL is an in-browser tool for writing, validating, and\n# testing GraphQL queries.\n#\n# Type queries into this side of the screen, and you will see intelligent\n# typeaheads aware of the current GraphQL type schema and live syntax and\n# validation errors highlighted within the text.\n#\n# GraphQL queries typically start with a "{" character. Lines that starts\n# with a # are ignored.\n#\n# An example GraphQL query might look like:\n#\n# {\n# field(arg: "value") {\n# subField\n# }\n# }\n#\n# Keyboard shortcuts:\n#\n# Prettify Query: Shift-Ctrl-P (or press the prettify button above)\n#\n# Merge Query: Shift-Ctrl-M (or press the merge button above)\n#\n# Run Query: Ctrl-Enter (or press the play button above)\n#\n# Auto Complete: Ctrl-Space (or just start typing)\n#\n\n'}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utility/CodeMirrorSizer":57,"../utility/StorageAPI":59,"../utility/debounce":60,"../utility/elementPosition":61,"../utility/fillLeafs":62,"../utility/find":63,"../utility/getQueryFacts":64,"../utility/getSelectedOperationName":65,"../utility/introspectionQueries":66,"../utility/mergeAst":67,"./DocExplorer":35,"./ExecuteButton":45,"./QueryEditor":48,"./QueryHistory":49,"./ResultViewer":50,"./ToolbarButton":51,"./ToolbarGroup":52,"./ToolbarMenu":53,"./ToolbarSelect":54,"./VariableEditor":55,graphql:174,"prop-types":152}],47:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),_react2=_interopRequireDefault("undefined"!=typeof window?window.React:void 0!==global?global.React:null),_propTypes2=_interopRequireDefault(require("prop-types")),HistoryQuery=function(e){function t(e){_classCallCheck(this,t);var r=_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.editField=null,r.state={showButtons:!1,editable:!1},r}return _inherits(t,e),_createClass(t,[{key:"render",value:function(){var e=this,t={display:this.state.showButtons?"":"none",marginLeft:"10px"},r={display:this.props.favorite||this.state.showButtons?"":"none",marginLeft:"10px"},i=this.props.label||this.props.operationName||this.props.query.split("\n").filter(function(e){return 0!==e.indexOf("#")}).join(""),o=this.props.favorite?"★":"☆";return _react2.default.createElement("p",{className:this.state.editable?"editable":void 0,onClick:this.handleClick.bind(this),onMouseEnter:this.handleMouseEnter.bind(this),onMouseLeave:this.handleMouseLeave.bind(this)},this.state.editable?_react2.default.createElement("input",{type:"text",defaultValue:this.props.label,ref:function(t){return e.editField=t},onBlur:this.handleFieldBlur.bind(this),onKeyDown:this.handleFieldKeyDown.bind(this),placeholder:"Type a label"}):_react2.default.createElement("span",{className:"history-label"},i),_react2.default.createElement("span",{onClick:this.handleEditClick.bind(this),style:t},"✎"),_react2.default.createElement("span",{onClick:this.handleStarClick.bind(this),style:r},o))}},{key:"handleMouseEnter",value:function(){this.setState({showButtons:!0})}},{key:"handleMouseLeave",value:function(){this.setState({showButtons:!1})}},{key:"handleClick",value:function(){this.props.onSelect(this.props.query,this.props.variables,this.props.operationName,this.props.label)}},{key:"handleStarClick",value:function(e){e.stopPropagation(),this.props.handleToggleFavorite(this.props.query,this.props.variables,this.props.operationName,this.props.label,this.props.favorite)}},{key:"handleFieldBlur",value:function(e){e.stopPropagation(),this.setState({editable:!1}),this.props.handleEditLabel(this.props.query,this.props.variables,this.props.operationName,e.target.value,this.props.favorite)}},{key:"handleFieldKeyDown",value:function(e){13===e.keyCode&&(e.stopPropagation(),this.setState({editable:!1}),this.props.handleEditLabel(this.props.query,this.props.variables,this.props.operationName,e.target.value,this.props.favorite))}},{key:"handleEditClick",value:function(e){var t=this;e.stopPropagation(),this.setState({editable:!0},function(){t.editField&&t.editField.focus()})}}]),t}(_react2.default.Component);HistoryQuery.propTypes={favorite:_propTypes2.default.bool,favoriteSize:_propTypes2.default.number,handleEditLabel:_propTypes2.default.func,handleToggleFavorite:_propTypes2.default.func,operationName:_propTypes2.default.string,onSelect:_propTypes2.default.func,query:_propTypes2.default.string,variables:_propTypes2.default.string,label:_propTypes2.default.string},exports.default=HistoryQuery}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"prop-types":152}],48:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,r){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!r||"object"!=typeof r&&"function"!=typeof r?e:r}function _inherits(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(e,r):e.__proto__=r)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.QueryEditor=void 0;var _createClass=function(){function e(e,r){for(var o=0;o<r.length;o++){var t=r[o];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(e,t.key,t)}}return function(r,o,t){return o&&e(r.prototype,o),t&&e(r,t),r}}(),_react2=_interopRequireDefault("undefined"!=typeof window?window.React:void 0!==global?global.React:null),_propTypes2=_interopRequireDefault(require("prop-types")),_graphql=require("graphql"),_markdownIt2=_interopRequireDefault(require("markdown-it")),_normalizeWhitespace=require("../utility/normalizeWhitespace"),_onHasCompletion2=_interopRequireDefault(require("../utility/onHasCompletion")),md=new _markdownIt2.default,AUTO_COMPLETE_AFTER_KEY=/^[a-zA-Z0-9_@(]$/;(exports.QueryEditor=function(e){function r(e){_classCallCheck(this,r);var o=_possibleConstructorReturn(this,(r.__proto__||Object.getPrototypeOf(r)).call(this));return o._onKeyUp=function(e,r){AUTO_COMPLETE_AFTER_KEY.test(r.key)&&o.editor.execCommand("autocomplete")},o._onEdit=function(){o.ignoreChangeEvent||(o.cachedValue=o.editor.getValue(),o.props.onEdit&&o.props.onEdit(o.cachedValue))},o._onHasCompletion=function(e,r){(0,_onHasCompletion2.default)(e,r,o.props.onHintInformationRender)},o.cachedValue=e.value||"",o}return _inherits(r,e),_createClass(r,[{key:"componentDidMount",value:function(){var e=this,r=require("codemirror");require("codemirror/addon/hint/show-hint"),require("codemirror/addon/comment/comment"),require("codemirror/addon/edit/matchbrackets"),require("codemirror/addon/edit/closebrackets"),require("codemirror/addon/fold/foldgutter"),require("codemirror/addon/fold/brace-fold"),require("codemirror/addon/search/search"),require("codemirror/addon/search/searchcursor"),require("codemirror/addon/search/jump-to-line"),require("codemirror/addon/dialog/dialog"),require("codemirror/addon/lint/lint"),require("codemirror/keymap/sublime"),require("codemirror-graphql/hint"),require("codemirror-graphql/lint"),require("codemirror-graphql/info"),require("codemirror-graphql/jump"),require("codemirror-graphql/mode"),this.editor=r(this._node,{value:this.props.value||"",lineNumbers:!0,tabSize:2,mode:"graphql",theme:this.props.editorTheme||"graphiql",keyMap:"sublime",autoCloseBrackets:!0,matchBrackets:!0,showCursorWhenSelecting:!0,readOnly:!!this.props.readOnly&&"nocursor",foldGutter:{minFoldSize:4},lint:{schema:this.props.schema},hintOptions:{schema:this.props.schema,closeOnUnfocus:!1,completeSingle:!1},info:{schema:this.props.schema,renderDescription:function(e){return md.render(e)},onClick:function(r){return e.props.onClickReference(r)}},jump:{schema:this.props.schema,onClick:function(r){return e.props.onClickReference(r)}},gutters:["CodeMirror-linenumbers","CodeMirror-foldgutter"],extraKeys:{"Cmd-Space":function(){return e.editor.showHint({completeSingle:!0})},"Ctrl-Space":function(){return e.editor.showHint({completeSingle:!0})},"Alt-Space":function(){return e.editor.showHint({completeSingle:!0})},"Shift-Space":function(){return e.editor.showHint({completeSingle:!0})},"Cmd-Enter":function(){e.props.onRunQuery&&e.props.onRunQuery()},"Ctrl-Enter":function(){e.props.onRunQuery&&e.props.onRunQuery()},"Shift-Ctrl-P":function(){e.props.onPrettifyQuery&&e.props.onPrettifyQuery()},"Shift-Ctrl-M":function(){e.props.onMergeQuery&&e.props.onMergeQuery()},"Cmd-F":"findPersistent","Ctrl-F":"findPersistent","Cmd-G":"findPersistent","Ctrl-G":"findPersistent","Ctrl-Left":"goSubwordLeft","Ctrl-Right":"goSubwordRight","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight"}}),this.editor.on("change",this._onEdit),this.editor.on("keyup",this._onKeyUp),this.editor.on("hasCompletion",this._onHasCompletion),this.editor.on("beforeChange",this._onBeforeChange)}},{key:"componentDidUpdate",value:function(e){var r=require("codemirror");this.ignoreChangeEvent=!0,this.props.schema!==e.schema&&(this.editor.options.lint.schema=this.props.schema,this.editor.options.hintOptions.schema=this.props.schema,this.editor.options.info.schema=this.props.schema,this.editor.options.jump.schema=this.props.schema,r.signal(this.editor,"change",this.editor)),this.props.value!==e.value&&this.props.value!==this.cachedValue&&(this.cachedValue=this.props.value,this.editor.setValue(this.props.value)),this.ignoreChangeEvent=!1}},{key:"componentWillUnmount",value:function(){this.editor.off("change",this._onEdit),this.editor.off("keyup",this._onKeyUp),this.editor.off("hasCompletion",this._onHasCompletion),this.editor=null}},{key:"render",value:function(){var e=this;return _react2.default.createElement("div",{className:"query-editor",ref:function(r){e._node=r}})}},{key:"getCodeMirror",value:function(){return this.editor}},{key:"getClientHeight",value:function(){return this._node&&this._node.clientHeight}},{key:"_onBeforeChange",value:function(e,r){if("paste"===r.origin){var o=r.text.map(_normalizeWhitespace.normalizeWhitespace);r.update(r.from,r.to,o)}}}]),r}(_react2.default.Component)).propTypes={schema:_propTypes2.default.instanceOf(_graphql.GraphQLSchema),value:_propTypes2.default.string,onEdit:_propTypes2.default.func,readOnly:_propTypes2.default.bool,onHintInformationRender:_propTypes2.default.func,onClickReference:_propTypes2.default.func,onPrettifyQuery:_propTypes2.default.func,onMergeQuery:_propTypes2.default.func,onRunQuery:_propTypes2.default.func,editorTheme:_propTypes2.default.string}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utility/normalizeWhitespace":68,"../utility/onHasCompletion":69,codemirror:84,"codemirror-graphql/hint":1,"codemirror-graphql/info":2,"codemirror-graphql/jump":3,"codemirror-graphql/lint":4,"codemirror-graphql/mode":5,"codemirror/addon/comment/comment":71,"codemirror/addon/dialog/dialog":72,"codemirror/addon/edit/closebrackets":73,"codemirror/addon/edit/matchbrackets":74,"codemirror/addon/fold/brace-fold":75,"codemirror/addon/fold/foldgutter":77,"codemirror/addon/hint/show-hint":78,"codemirror/addon/lint/lint":79,"codemirror/addon/search/jump-to-line":80,"codemirror/addon/search/search":81,"codemirror/addon/search/searchcursor":82,"codemirror/keymap/sublime":83,graphql:174,"markdown-it":91,"prop-types":152}],49:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.QueryHistory=void 0;var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},_createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),_graphql=require("graphql"),_react2=_interopRequireDefault("undefined"!=typeof window?window.React:void 0!==global?global.React:null),_propTypes2=_interopRequireDefault(require("prop-types")),_QueryStore2=_interopRequireDefault(require("../utility/QueryStore")),_HistoryQuery2=_interopRequireDefault(require("./HistoryQuery")),shouldSaveQuery=function(e,t,r){if(e.queryID===t.queryID)return!1;try{(0,_graphql.parse)(e.query)}catch(e){return!1}if(!r)return!0;if(JSON.stringify(e.query)===JSON.stringify(r.query)){if(JSON.stringify(e.variables)===JSON.stringify(r.variables))return!1;if(!e.variables&&!r.variables)return!1}return!0};(exports.QueryHistory=function(e){function t(e){_classCallCheck(this,t);var r=_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));r.toggleFavorite=function(e,t,o,i,a){var s={query:e,variables:t,operationName:o,label:i};r.favoriteStore.contains(s)?a&&(s.favorite=!1,r.favoriteStore.delete(s)):(s.favorite=!0,r.favoriteStore.push(s)),r.setState(_extends({},r.historyStore.items,r.favoriteStore.items))},r.editLabel=function(e,t,o,i,a){var s={query:e,variables:t,operationName:o,label:i};a?r.favoriteStore.edit(_extends({},s,{favorite:a})):r.historyStore.edit(s),r.setState(_extends({},r.historyStore.items,r.favoriteStore.items))},r.historyStore=new _QueryStore2.default("queries",e.storage),r.favoriteStore=new _QueryStore2.default("favorites",e.storage);var o=r.historyStore.fetchAll(),i=r.favoriteStore.fetchAll(),a=o.concat(i);return r.state={queries:a},r}return _inherits(t,e),_createClass(t,[{key:"componentWillReceiveProps",value:function(e){if(shouldSaveQuery(e,this.props,this.historyStore.fetchRecent())){var t={query:e.query,variables:e.variables,operationName:e.operationName};this.historyStore.push(t),this.historyStore.length>20&&this.historyStore.shift();var r=this.historyStore.items,o=this.favoriteStore.items,i=r.concat(o);this.setState({queries:i})}}},{key:"render",value:function(){var e=this,t=this.state.queries.slice().reverse().map(function(t,r){return _react2.default.createElement(_HistoryQuery2.default,_extends({handleEditLabel:e.editLabel,handleToggleFavorite:e.toggleFavorite,key:r,onSelect:e.props.onSelectQuery},t))});return _react2.default.createElement("div",null,_react2.default.createElement("div",{className:"history-title-bar"},_react2.default.createElement("div",{className:"history-title"},"History"),_react2.default.createElement("div",{className:"doc-explorer-rhs"},this.props.children)),_react2.default.createElement("div",{className:"history-contents"},t))}}]),t}(_react2.default.Component)).propTypes={query:_propTypes2.default.string,variables:_propTypes2.default.string,operationName:_propTypes2.default.string,queryID:_propTypes2.default.number,onSelectQuery:_propTypes2.default.func,storage:_propTypes2.default.object}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utility/QueryStore":58,"./HistoryQuery":47,graphql:174,"prop-types":152}],50:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,r){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!r||"object"!=typeof r&&"function"!=typeof r?e:r}function _inherits(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(e,r):e.__proto__=r)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.ResultViewer=void 0;var _createClass=function(){function e(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(r,t,o){return t&&e(r.prototype,t),o&&e(r,o),r}}(),_react2=_interopRequireDefault("undefined"!=typeof window?window.React:void 0!==global?global.React:null),_reactDom2=_interopRequireDefault("undefined"!=typeof window?window.ReactDOM:void 0!==global?global.ReactDOM:null),_propTypes2=_interopRequireDefault(require("prop-types"));(exports.ResultViewer=function(e){function r(){return _classCallCheck(this,r),_possibleConstructorReturn(this,(r.__proto__||Object.getPrototypeOf(r)).call(this))}return _inherits(r,e),_createClass(r,[{key:"componentDidMount",value:function(){var e=this,r=require("codemirror");if(require("codemirror/addon/fold/foldgutter"),require("codemirror/addon/fold/brace-fold"),require("codemirror/addon/dialog/dialog"),require("codemirror/addon/search/search"),require("codemirror/addon/search/searchcursor"),require("codemirror/addon/search/jump-to-line"),require("codemirror/keymap/sublime"),require("codemirror-graphql/results/mode"),this.props.ResultsTooltip){require("codemirror-graphql/utils/info-addon");var t=document.createElement("div");r.registerHelper("info","graphql-results",function(r,o,i,n){var u=e.props.ResultsTooltip;return _reactDom2.default.render(_react2.default.createElement(u,{pos:n}),t),t})}this.viewer=r(this._node,{lineWrapping:!0,value:this.props.value||"",readOnly:!0,theme:this.props.editorTheme||"graphiql",mode:"graphql-results",keyMap:"sublime",foldGutter:{minFoldSize:4},gutters:["CodeMirror-foldgutter"],info:Boolean(this.props.ResultsTooltip),extraKeys:{"Cmd-F":"findPersistent","Ctrl-F":"findPersistent","Cmd-G":"findPersistent","Ctrl-G":"findPersistent","Ctrl-Left":"goSubwordLeft","Ctrl-Right":"goSubwordRight","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight"}})}},{key:"shouldComponentUpdate",value:function(e){return this.props.value!==e.value}},{key:"componentDidUpdate",value:function(){this.viewer.setValue(this.props.value||"")}},{key:"componentWillUnmount",value:function(){this.viewer=null}},{key:"render",value:function(){var e=this;return _react2.default.createElement("div",{className:"result-window",ref:function(r){e._node=r}})}},{key:"getCodeMirror",value:function(){return this.viewer}},{key:"getClientHeight",value:function(){return this._node&&this._node.clientHeight}}]),r}(_react2.default.Component)).propTypes={value:_propTypes2.default.string,editorTheme:_propTypes2.default.string,ResultsTooltip:_propTypes2.default.any}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{codemirror:84,"codemirror-graphql/results/mode":7,"codemirror-graphql/utils/info-addon":12,"codemirror/addon/dialog/dialog":72,"codemirror/addon/fold/brace-fold":75,"codemirror/addon/fold/foldgutter":77,"codemirror/addon/search/jump-to-line":80,"codemirror/addon/search/search":81,"codemirror/addon/search/searchcursor":82,"codemirror/keymap/sublime":83,"prop-types":152}],51:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function preventDefault(e){e.preventDefault()}Object.defineProperty(exports,"__esModule",{value:!0}),exports.ToolbarButton=void 0;var _createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),_react2=_interopRequireDefault("undefined"!=typeof window?window.React:void 0!==global?global.React:null),_propTypes2=_interopRequireDefault(require("prop-types"));(exports.ToolbarButton=function(e){function t(e){_classCallCheck(this,t);var r=_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.handleClick=function(e){e.preventDefault();try{r.props.onClick(),r.setState({error:null})}catch(e){r.setState({error:e})}},r.state={error:null},r}return _inherits(t,e),_createClass(t,[{key:"render",value:function(){var e=this.state.error;return _react2.default.createElement("a",{className:"toolbar-button"+(e?" error":""),onMouseDown:preventDefault,onClick:this.handleClick,title:e?e.message:this.props.title},this.props.label)}}]),t}(_react2.default.Component)).propTypes={onClick:_propTypes2.default.func,title:_propTypes2.default.string,label:_propTypes2.default.string}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"prop-types":152}],52:[function(require,module,exports){(function(global){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ToolbarGroup=function(e){var r=e.children;return _react2.default.createElement("div",{className:"toolbar-button-group"},r)};var _react2=function(e){return e&&e.__esModule?e:{default:e}}("undefined"!=typeof window?window.React:void 0!==global?global.React:null)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],53:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function ToolbarMenuItem(e){var t=e.onSelect,n=e.title,r=e.label;return _react2.default.createElement("li",{onMouseOver:function(e){e.target.className="hover"},onMouseOut:function(e){e.target.className=null},onMouseDown:preventDefault,onMouseUp:t,title:n},r)}function preventDefault(e){e.preventDefault()}Object.defineProperty(exports,"__esModule",{value:!0}),exports.ToolbarMenu=void 0;var _createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();exports.ToolbarMenuItem=ToolbarMenuItem;var _react2=_interopRequireDefault("undefined"!=typeof window?window.React:void 0!==global?global.React:null),_propTypes2=_interopRequireDefault(require("prop-types"));(exports.ToolbarMenu=function(e){function t(e){_classCallCheck(this,t);var n=_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.handleOpen=function(e){preventDefault(e),n.setState({visible:!0}),n._subscribe()},n.state={visible:!1},n}return _inherits(t,e),_createClass(t,[{key:"componentWillUnmount",value:function(){this._release()}},{key:"render",value:function(){var e=this,t=this.state.visible;return _react2.default.createElement("a",{className:"toolbar-menu toolbar-button",onClick:this.handleOpen.bind(this),onMouseDown:preventDefault,ref:function(t){e._node=t},title:this.props.title},this.props.label,_react2.default.createElement("svg",{width:"14",height:"8"},_react2.default.createElement("path",{fill:"#666",d:"M 5 1.5 L 14 1.5 L 9.5 7 z"})),_react2.default.createElement("ul",{className:"toolbar-menu-items"+(t?" open":"")},this.props.children))}},{key:"_subscribe",value:function(){this._listener||(this._listener=this.handleClick.bind(this),document.addEventListener("click",this._listener))}},{key:"_release",value:function(){this._listener&&(document.removeEventListener("click",this._listener),this._listener=null)}},{key:"handleClick",value:function(e){this._node!==e.target&&(preventDefault(e),this.setState({visible:!1}),this._release())}}]),t}(_react2.default.Component)).propTypes={title:_propTypes2.default.string,label:_propTypes2.default.string},ToolbarMenuItem.propTypes={onSelect:_propTypes2.default.func,title:_propTypes2.default.string,label:_propTypes2.default.string}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"prop-types":152}],54:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function ToolbarSelectOption(e){var t=e.onSelect,r=e.label,n=e.selected;return _react2.default.createElement("li",{onMouseOver:function(e){e.target.className="hover"},onMouseOut:function(e){e.target.className=null},onMouseDown:preventDefault,onMouseUp:t},r,n&&_react2.default.createElement("svg",{width:"13",height:"13"},_react2.default.createElement("polygon",{points:"4.851,10.462 0,5.611 2.314,3.297 4.851,5.835 10.686,0 13,2.314 4.851,10.462"})))}function preventDefault(e){e.preventDefault()}Object.defineProperty(exports,"__esModule",{value:!0}),exports.ToolbarSelect=void 0;var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},_createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();exports.ToolbarSelectOption=ToolbarSelectOption;var _react2=_interopRequireDefault("undefined"!=typeof window?window.React:void 0!==global?global.React:null),_propTypes2=_interopRequireDefault(require("prop-types"));(exports.ToolbarSelect=function(e){function t(e){_classCallCheck(this,t);var r=_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.handleOpen=function(e){preventDefault(e),r.setState({visible:!0}),r._subscribe()},r.state={visible:!1},r}return _inherits(t,e),_createClass(t,[{key:"componentWillUnmount",value:function(){this._release()}},{key:"render",value:function(){var e=this,t=void 0,r=this.state.visible,n=_react2.default.Children.map(this.props.children,function(r,n){t&&!r.props.selected||(t=r);var o=r.props.onSelect||e.props.onSelect&&e.props.onSelect.bind(null,r.props.value,n);return _react2.default.createElement(ToolbarSelectOption,_extends({},r.props,{onSelect:o}))});return _react2.default.createElement("a",{className:"toolbar-select toolbar-button",onClick:this.handleOpen.bind(this),onMouseDown:preventDefault,ref:function(t){e._node=t},title:this.props.title},t.props.label,_react2.default.createElement("svg",{width:"13",height:"10"},_react2.default.createElement("path",{fill:"#666",d:"M 5 5 L 13 5 L 9 1 z"}),_react2.default.createElement("path",{fill:"#666",d:"M 5 6 L 13 6 L 9 10 z"})),_react2.default.createElement("ul",{className:"toolbar-select-options"+(r?" open":"")},n))}},{key:"_subscribe",value:function(){this._listener||(this._listener=this.handleClick.bind(this),document.addEventListener("click",this._listener))}},{key:"_release",value:function(){this._listener&&(document.removeEventListener("click",this._listener),this._listener=null)}},{key:"handleClick",value:function(e){this._node!==e.target&&(preventDefault(e),this.setState({visible:!1}),this._release())}}]),t}(_react2.default.Component)).propTypes={title:_propTypes2.default.string,label:_propTypes2.default.string,onSelect:_propTypes2.default.func},ToolbarSelectOption.propTypes={onSelect:_propTypes2.default.func,selected:_propTypes2.default.bool,label:_propTypes2.default.string,value:_propTypes2.default.any}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"prop-types":152}],55:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,r){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!r||"object"!=typeof r&&"function"!=typeof r?e:r}function _inherits(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(e,r):e.__proto__=r)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.VariableEditor=void 0;var _createClass=function(){function e(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(r,t,o){return t&&e(r.prototype,t),o&&e(r,o),r}}(),_react2=_interopRequireDefault("undefined"!=typeof window?window.React:void 0!==global?global.React:null),_propTypes2=_interopRequireDefault(require("prop-types")),_onHasCompletion2=_interopRequireDefault(require("../utility/onHasCompletion"));(exports.VariableEditor=function(e){function r(e){_classCallCheck(this,r);var t=_possibleConstructorReturn(this,(r.__proto__||Object.getPrototypeOf(r)).call(this));return t._onKeyUp=function(e,r){var o=r.keyCode;(o>=65&&o<=90||!r.shiftKey&&o>=48&&o<=57||r.shiftKey&&189===o||r.shiftKey&&222===o)&&t.editor.execCommand("autocomplete")},t._onEdit=function(){t.ignoreChangeEvent||(t.cachedValue=t.editor.getValue(),t.props.onEdit&&t.props.onEdit(t.cachedValue))},t._onHasCompletion=function(e,r){(0,_onHasCompletion2.default)(e,r,t.props.onHintInformationRender)},t.cachedValue=e.value||"",t}return _inherits(r,e),_createClass(r,[{key:"componentDidMount",value:function(){var e=this,r=require("codemirror");require("codemirror/addon/hint/show-hint"),require("codemirror/addon/edit/matchbrackets"),require("codemirror/addon/edit/closebrackets"),require("codemirror/addon/fold/brace-fold"),require("codemirror/addon/fold/foldgutter"),require("codemirror/addon/lint/lint"),require("codemirror/addon/search/searchcursor"),require("codemirror/addon/search/jump-to-line"),require("codemirror/addon/dialog/dialog"),require("codemirror/keymap/sublime"),require("codemirror-graphql/variables/hint"),require("codemirror-graphql/variables/lint"),require("codemirror-graphql/variables/mode"),this.editor=r(this._node,{value:this.props.value||"",lineNumbers:!0,tabSize:2,mode:"graphql-variables",theme:this.props.editorTheme||"graphiql",keyMap:"sublime",autoCloseBrackets:!0,matchBrackets:!0,showCursorWhenSelecting:!0,readOnly:!!this.props.readOnly&&"nocursor",foldGutter:{minFoldSize:4},lint:{variableToType:this.props.variableToType},hintOptions:{variableToType:this.props.variableToType,closeOnUnfocus:!1,completeSingle:!1},gutters:["CodeMirror-linenumbers","CodeMirror-foldgutter"],extraKeys:{"Cmd-Space":function(){return e.editor.showHint({completeSingle:!1})},"Ctrl-Space":function(){return e.editor.showHint({completeSingle:!1})},"Alt-Space":function(){return e.editor.showHint({completeSingle:!1})},"Shift-Space":function(){return e.editor.showHint({completeSingle:!1})},"Cmd-Enter":function(){e.props.onRunQuery&&e.props.onRunQuery()},"Ctrl-Enter":function(){e.props.onRunQuery&&e.props.onRunQuery()},"Shift-Ctrl-P":function(){e.props.onPrettifyQuery&&e.props.onPrettifyQuery()},"Shift-Ctrl-M":function(){e.props.onMergeQuery&&e.props.onMergeQuery()},"Cmd-F":"findPersistent","Ctrl-F":"findPersistent","Cmd-G":"findPersistent","Ctrl-G":"findPersistent","Ctrl-Left":"goSubwordLeft","Ctrl-Right":"goSubwordRight","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight"}}),this.editor.on("change",this._onEdit),this.editor.on("keyup",this._onKeyUp),this.editor.on("hasCompletion",this._onHasCompletion)}},{key:"componentDidUpdate",value:function(e){var r=require("codemirror");if(this.ignoreChangeEvent=!0,this.props.variableToType!==e.variableToType&&(this.editor.options.lint.variableToType=this.props.variableToType,this.editor.options.hintOptions.variableToType=this.props.variableToType,r.signal(this.editor,"change",this.editor)),this.props.value!==e.value&&this.props.value!==this.cachedValue){var t=this.props.value||"";this.cachedValue=t,this.editor.setValue(t)}this.ignoreChangeEvent=!1}},{key:"componentWillUnmount",value:function(){this.editor.off("change",this._onEdit),this.editor.off("keyup",this._onKeyUp),this.editor.off("hasCompletion",this._onHasCompletion),this.editor=null}},{key:"render",value:function(){var e=this;return _react2.default.createElement("div",{className:"codemirrorWrap",ref:function(r){e._node=r}})}},{key:"getCodeMirror",value:function(){return this.editor}},{key:"getClientHeight",value:function(){return this._node&&this._node.clientHeight}}]),r}(_react2.default.Component)).propTypes={variableToType:_propTypes2.default.object,value:_propTypes2.default.string,onEdit:_propTypes2.default.func,readOnly:_propTypes2.default.bool,onHintInformationRender:_propTypes2.default.func,onPrettifyQuery:_propTypes2.default.func,onMergeQuery:_propTypes2.default.func,onRunQuery:_propTypes2.default.func,editorTheme:_propTypes2.default.string}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utility/onHasCompletion":69,codemirror:84,"codemirror-graphql/variables/hint":15,"codemirror-graphql/variables/lint":16,"codemirror-graphql/variables/mode":17,"codemirror/addon/dialog/dialog":72,"codemirror/addon/edit/closebrackets":73,"codemirror/addon/edit/matchbrackets":74,"codemirror/addon/fold/brace-fold":75,"codemirror/addon/fold/foldgutter":77,"codemirror/addon/hint/show-hint":78,"codemirror/addon/lint/lint":79,"codemirror/addon/search/jump-to-line":80,"codemirror/addon/search/searchcursor":82,"codemirror/keymap/sublime":83,"prop-types":152}],56:[function(require,module,exports){"use strict";module.exports=require("./components/GraphiQL").GraphiQL},{"./components/GraphiQL":46}],57:[function(require,module,exports){"use strict";function _classCallCheck(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),CodeMirrorSizer=function(){function e(){_classCallCheck(this,e),this.sizes=[]}return _createClass(e,[{key:"updateSizes",value:function(e){var r=this;e.forEach(function(e,t){var n=e.getClientHeight();t<=r.sizes.length&&n!==r.sizes[t]&&e.getCodeMirror().setSize(),r.sizes[t]=n})}}]),e}();exports.default=CodeMirrorSizer},{}],58:[function(require,module,exports){"use strict";function _defineProperty(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),QueryStore=function(){function e(t,i){_classCallCheck(this,e),this.key=t,this.storage=i,this.items=this.fetchAll()}return _createClass(e,[{key:"contains",value:function(e){return this.items.some(function(t){return t.query===e.query&&t.variables===e.variables&&t.operationName===e.operationName})}},{key:"edit",value:function(e){var t=this.items.findIndex(function(t){return t.query===e.query&&t.variables===e.variables&&t.operationName===e.operationName});-1!==t&&(this.items.splice(t,1,e),this.save())}},{key:"delete",value:function(e){var t=this.items.findIndex(function(t){return t.query===e.query&&t.variables===e.variables&&t.operationName===e.operationName});-1!==t&&(this.items.splice(t,1),this.save())}},{key:"fetchRecent",value:function(){return this.items[this.items.length-1]}},{key:"fetchAll",value:function(){var e=this.storage.get(this.key);return e?JSON.parse(e)[this.key]:[]}},{key:"push",value:function(e){this.items.push(e),this.save()}},{key:"shift",value:function(){this.items.shift(),this.save()}},{key:"save",value:function(){this.storage.set(this.key,JSON.stringify(_defineProperty({},this.key,this.items)))}},{key:"length",get:function(){return this.items.length}}]),e}();exports.default=QueryStore},{}],59:[function(require,module,exports){"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function isStorageAvailable(e,t,r){try{return e.setItem(t,r),!0}catch(t){return t instanceof DOMException&&(22===t.code||1014===t.code||"QuotaExceededError"===t.name||"NS_ERROR_DOM_QUOTA_REACHED"===t.name)&&0!==e.length}}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),StorageAPI=function(){function e(t){_classCallCheck(this,e),this.storage=t||window.localStorage}return _createClass(e,[{key:"get",value:function(e){if(this.storage){var t=this.storage.getItem("graphiql:"+e);if("null"!==t&&"undefined"!==t)return t;this.storage.removeItem("graphiql:"+e)}}},{key:"set",value:function(e,t){if(this.storage){var r="graphiql:"+e;t?isStorageAvailable(this.storage,r,t)&&this.storage.setItem(r,t):this.storage.removeItem(r)}}}]),e}();exports.default=StorageAPI},{}],60:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(e,t){var u=void 0;return function(){var o=this,n=arguments;clearTimeout(u),u=setTimeout(function(){u=null,t.apply(o,n)},e)}}},{}],61:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getLeft=function(e){for(var t=0,f=e;f.offsetParent;)t+=f.offsetLeft,f=f.offsetParent;return t},exports.getTop=function(e){for(var t=0,f=e;f.offsetParent;)t+=f.offsetTop,f=f.offsetParent;return t}},{}],62:[function(require,module,exports){"use strict";function defaultGetDefaultFieldNames(e){if(!e.getFields)return[];var t=e.getFields();if(t.id)return["id"];if(t.edges)return["edges"];if(t.node)return["node"];var r=[];return Object.keys(t).forEach(function(e){(0,_graphql.isLeafType)(t[e].type)&&r.push(e)}),r}function buildSelectionSet(e,t){var r=(0,_graphql.getNamedType)(e);if(e&&!(0,_graphql.isLeafType)(e)){var n=t(r);if(Array.isArray(n)&&0!==n.length)return{kind:"SelectionSet",selections:n.map(function(e){var n=r.getFields()[e];return{kind:"Field",name:{kind:"Name",value:e},selectionSet:buildSelectionSet(n?n.type:null,t)}})}}}function withInsertions(e,t){if(0===t.length)return e;var r="",n=0;return t.forEach(function(t){var i=t.index,a=t.string;r+=e.slice(n,i)+a,n=i}),r+=e.slice(n)}function getIndentation(e,t){for(var r=t,n=t;r;){var i=e.charCodeAt(r-1);if(10===i||13===i||8232===i||8233===i)break;r--,9!==i&&11!==i&&12!==i&&32!==i&&160!==i&&(n=r)}return e.substring(r,n)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.fillLeafs=function(e,t,r){var n=[];if(!e)return{insertions:n,result:t};var i=void 0;try{i=(0,_graphql.parse)(t)}catch(e){return{insertions:n,result:t}}var a=r||defaultGetDefaultFieldNames,l=new _graphql.TypeInfo(e);return(0,_graphql.visit)(i,{leave:function(e){l.leave(e)},enter:function(e){if(l.enter(e),"Field"===e.kind&&!e.selectionSet){var r=buildSelectionSet(l.getType(),a);if(r){var i=getIndentation(t,e.loc.start);n.push({index:e.loc.end,string:" "+(0,_graphql.print)(r).replace(/\n/g,"\n"+i)})}}}}),{insertions:n,result:withInsertions(t,n)}};var _graphql=require("graphql")},{graphql:174}],63:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(e,t){for(var r=0;r<e.length;r++)if(t(e[r]))return e[r]}},{}],64:[function(require,module,exports){"use strict";function collectVariables(e,r){var a=Object.create(null);return r.definitions.forEach(function(r){if("OperationDefinition"===r.kind){var i=r.variableDefinitions;i&&i.forEach(function(r){var i=r.variable,t=r.type,n=(0,_graphql.typeFromAST)(e,t);n&&(a[i.name.value]=n)})}}),a}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(e,r){if(r){var a=void 0;try{a=(0,_graphql.parse)(r)}catch(e){return}var i=e?collectVariables(e,a):null,t=[];return a.definitions.forEach(function(e){"OperationDefinition"===e.kind&&t.push(e)}),{variableToType:i,operations:t}}},exports.collectVariables=collectVariables;var _graphql=require("graphql")},{graphql:174}],65:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(e,t,n){if(n&&!(n.length<1)){var r=n.map(function(e){return e.name&&e.name.value});if(t&&-1!==r.indexOf(t))return t;if(t&&e){var a=e.map(function(e){return e.name&&e.name.value}).indexOf(t);if(-1!==a&&a<r.length)return r[a]}return r[0]}}},{}],66:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _graphql=require("graphql");Object.defineProperty(exports,"introspectionQuery",{enumerable:!0,get:function(){return _graphql.introspectionQuery}});exports.introspectionQuerySansSubscriptions="\n query IntrospectionQuery {\n __schema {\n queryType { name }\n mutationType { name }\n types {\n ...FullType\n }\n directives {\n name\n description\n locations\n args {\n ...InputValue\n }\n }\n }\n }\n\n fragment FullType on __Type {\n kind\n name\n description\n fields(includeDeprecated: true) {\n name\n description\n args {\n ...InputValue\n }\n type {\n ...TypeRef\n }\n isDeprecated\n deprecationReason\n }\n inputFields {\n ...InputValue\n }\n interfaces {\n ...TypeRef\n }\n enumValues(includeDeprecated: true) {\n name\n description\n isDeprecated\n deprecationReason\n }\n possibleTypes {\n ...TypeRef\n }\n }\n\n fragment InputValue on __InputValue {\n name\n description\n type { ...TypeRef }\n defaultValues\n }\n\n fragment TypeRef on __Type {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n }\n }\n }\n }\n }\n }\n }\n }\n"},{graphql:174}],67:[function(require,module,exports){"use strict";function resolveDefinition(n,e){var i=e;return i.kind===_kinds.Kind.FRAGMENT_SPREAD&&(i=n[i.name.value]),i.selectionSet&&(i.selectionSet.selections=i.selectionSet.selections.filter(function(n,e,i){return n.kind!==_kinds.Kind.FRAGMENT_SPREAD||e===i.findIndex(function(e){return e.kind===_kinds.Kind.FRAGMENT_SPREAD&&n.name.value===e.name.value})}).map(function(e){return resolveDefinition(n,e)})),i}Object.defineProperty(exports,"__esModule",{value:!0}),exports.mergeAst=function(n){var e={};n.definitions.filter(function(n){return n.kind===_kinds.Kind.FRAGMENT_DEFINITION}).forEach(function(n){var i=Object.assign({},n);i.kind=_kinds.Kind.INLINE_FRAGMENT,e[n.name.value]=i});var i=Object.assign({},n);return i.definitions=n.definitions.filter(function(n){return n.kind!==_kinds.Kind.FRAGMENT_DEFINITION}).map(function(n){return resolveDefinition(e,n)}),i};var _kinds=require("graphql/language/kinds")},{"graphql/language/kinds":188}],68:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.normalizeWhitespace=function(e){return e.replace(sanitizeRegex," ")};var invalidCharacters=exports.invalidCharacters=Array.from({length:11},function(e,r){return String.fromCharCode(8192+r)}).concat(["\u2028","\u2029"," "]),sanitizeRegex=new RegExp("["+invalidCharacters.join("")+"]","g")},{}],69:[function(require,module,exports){"use strict";function renderType(e){return e instanceof _graphql.GraphQLNonNull?renderType(e.ofType)+"!":e instanceof _graphql.GraphQLList?"["+renderType(e.ofType)+"]":'<a class="typeName">'+e.name+"</a>"}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(e,n,r){var t=void 0,a=void 0;require("codemirror").on(n,"select",function(e,n){if(!t){var o=n.parentNode;(t=document.createElement("div")).className="CodeMirror-hint-information",o.appendChild(t),(a=document.createElement("div")).className="CodeMirror-hint-deprecation",o.appendChild(a);var i=void 0;o.addEventListener("DOMNodeRemoved",i=function(e){e.target===o&&(o.removeEventListener("DOMNodeRemoved",i),t=null,a=null,i=null)})}var d=e.description?md.render(e.description):"Self descriptive.",p=e.type?'<span class="infoType">'+renderType(e.type)+"</span>":"";if(t.innerHTML='<div class="content">'+("<p>"===d.slice(0,3)?"<p>"+p+d.slice(3):p+d)+"</div>",e.isDeprecated){var l=e.deprecationReason?md.render(e.deprecationReason):"";a.innerHTML='<span class="deprecation-label">Deprecated</span>'+l,a.style.display="block"}else a.style.display="none";r&&r(t)})};var _graphql=require("graphql"),md=new(function(e){return e&&e.__esModule?e:{default:e}}(require("markdown-it")).default)},{codemirror:84,graphql:174,"markdown-it":91}],70:[function(require,module,exports){(function(global){"use strict";function compare(a,b){if(a===b)return 0;for(var x=a.length,y=b.length,i=0,len=Math.min(x,y);i<len;++i)if(a[i]!==b[i]){x=a[i],y=b[i];break}return x<y?-1:y<x?1:0}function isBuffer(b){return global.Buffer&&"function"==typeof global.Buffer.isBuffer?global.Buffer.isBuffer(b):!(null==b||!b._isBuffer)}function pToString(obj){return Object.prototype.toString.call(obj)}function isView(arrbuf){return!isBuffer(arrbuf)&&("function"==typeof global.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(arrbuf):!!arrbuf&&(arrbuf instanceof DataView||!!(arrbuf.buffer&&arrbuf.buffer instanceof ArrayBuffer))))}function getName(func){if(util.isFunction(func)){if(functionsHaveNames)return func.name;var match=func.toString().match(regex);return match&&match[1]}}function truncate(s,n){return"string"==typeof s?s.length<n?s:s.slice(0,n):s}function inspect(something){if(functionsHaveNames||!util.isFunction(something))return util.inspect(something);var rawname=getName(something);return"[Function"+(rawname?": "+rawname:"")+"]"}function getMessage(self){return truncate(inspect(self.actual),128)+" "+self.operator+" "+truncate(inspect(self.expected),128)}function fail(actual,expected,message,operator,stackStartFunction){throw new assert.AssertionError({message:message,actual:actual,expected:expected,operator:operator,stackStartFunction:stackStartFunction})}function ok(value,message){value||fail(value,!0,message,"==",assert.ok)}function _deepEqual(actual,expected,strict,memos){if(actual===expected)return!0;if(isBuffer(actual)&&isBuffer(expected))return 0===compare(actual,expected);if(util.isDate(actual)&&util.isDate(expected))return actual.getTime()===expected.getTime();if(util.isRegExp(actual)&&util.isRegExp(expected))return actual.source===expected.source&&actual.global===expected.global&&actual.multiline===expected.multiline&&actual.lastIndex===expected.lastIndex&&actual.ignoreCase===expected.ignoreCase;if(null!==actual&&"object"==typeof actual||null!==expected&&"object"==typeof expected){if(isView(actual)&&isView(expected)&&pToString(actual)===pToString(expected)&&!(actual instanceof Float32Array||actual instanceof Float64Array))return 0===compare(new Uint8Array(actual.buffer),new Uint8Array(expected.buffer));if(isBuffer(actual)!==isBuffer(expected))return!1;var actualIndex=(memos=memos||{actual:[],expected:[]}).actual.indexOf(actual);return-1!==actualIndex&&actualIndex===memos.expected.indexOf(expected)||(memos.actual.push(actual),memos.expected.push(expected),objEquiv(actual,expected,strict,memos))}return strict?actual===expected:actual==expected}function isArguments(object){return"[object Arguments]"==Object.prototype.toString.call(object)}function objEquiv(a,b,strict,actualVisitedObjects){if(null===a||void 0===a||null===b||void 0===b)return!1;if(util.isPrimitive(a)||util.isPrimitive(b))return a===b;if(strict&&Object.getPrototypeOf(a)!==Object.getPrototypeOf(b))return!1;var aIsArgs=isArguments(a),bIsArgs=isArguments(b);if(aIsArgs&&!bIsArgs||!aIsArgs&&bIsArgs)return!1;if(aIsArgs)return a=pSlice.call(a),b=pSlice.call(b),_deepEqual(a,b,strict);var key,i,ka=objectKeys(a),kb=objectKeys(b);if(ka.length!==kb.length)return!1;for(ka.sort(),kb.sort(),i=ka.length-1;i>=0;i--)if(ka[i]!==kb[i])return!1;for(i=ka.length-1;i>=0;i--)if(key=ka[i],!_deepEqual(a[key],b[key],strict,actualVisitedObjects))return!1;return!0}function notDeepStrictEqual(actual,expected,message){_deepEqual(actual,expected,!0)&&fail(actual,expected,message,"notDeepStrictEqual",notDeepStrictEqual)}function expectedException(actual,expected){if(!actual||!expected)return!1;if("[object RegExp]"==Object.prototype.toString.call(expected))return expected.test(actual);try{if(actual instanceof expected)return!0}catch(e){}return!Error.isPrototypeOf(expected)&&!0===expected.call({},actual)}function _tryBlock(block){var error;try{block()}catch(e){error=e}return error}function _throws(shouldThrow,block,expected,message){var actual;if("function"!=typeof block)throw new TypeError('"block" argument must be a function');"string"==typeof expected&&(message=expected,expected=null),actual=_tryBlock(block),message=(expected&&expected.name?" ("+expected.name+").":".")+(message?" "+message:"."),shouldThrow&&!actual&&fail(actual,expected,"Missing expected exception"+message);var userProvidedMessage="string"==typeof message,isUnwantedException=!shouldThrow&&util.isError(actual),isUnexpectedException=!shouldThrow&&actual&&!expected;if((isUnwantedException&&userProvidedMessage&&expectedException(actual,expected)||isUnexpectedException)&&fail(actual,expected,"Got unwanted exception"+message),shouldThrow&&actual&&expected&&!expectedException(actual,expected)||!shouldThrow&&actual)throw actual}var util=require("util/"),hasOwn=Object.prototype.hasOwnProperty,pSlice=Array.prototype.slice,functionsHaveNames="foo"===function(){}.name,assert=module.exports=ok,regex=/\s*function\s+([^\(\s]*)\s*/;assert.AssertionError=function(options){this.name="AssertionError",this.actual=options.actual,this.expected=options.expected,this.operator=options.operator,options.message?(this.message=options.message,this.generatedMessage=!1):(this.message=getMessage(this),this.generatedMessage=!0);var stackStartFunction=options.stackStartFunction||fail;if(Error.captureStackTrace)Error.captureStackTrace(this,stackStartFunction);else{var err=new Error;if(err.stack){var out=err.stack,fn_name=getName(stackStartFunction),idx=out.indexOf("\n"+fn_name);if(idx>=0){var next_line=out.indexOf("\n",idx+1);out=out.substring(next_line+1)}this.stack=out}}},util.inherits(assert.AssertionError,Error),assert.fail=fail,assert.ok=ok,assert.equal=function(actual,expected,message){actual!=expected&&fail(actual,expected,message,"==",assert.equal)},assert.notEqual=function(actual,expected,message){actual==expected&&fail(actual,expected,message,"!=",assert.notEqual)},assert.deepEqual=function(actual,expected,message){_deepEqual(actual,expected,!1)||fail(actual,expected,message,"deepEqual",assert.deepEqual)},assert.deepStrictEqual=function(actual,expected,message){_deepEqual(actual,expected,!0)||fail(actual,expected,message,"deepStrictEqual",assert.deepStrictEqual)},assert.notDeepEqual=function(actual,expected,message){_deepEqual(actual,expected,!1)&&fail(actual,expected,message,"notDeepEqual",assert.notDeepEqual)},assert.notDeepStrictEqual=notDeepStrictEqual,assert.strictEqual=function(actual,expected,message){actual!==expected&&fail(actual,expected,message,"===",assert.strictEqual)},assert.notStrictEqual=function(actual,expected,message){actual===expected&&fail(actual,expected,message,"!==",assert.notStrictEqual)},assert.throws=function(block,error,message){_throws(!0,block,error,message)},assert.doesNotThrow=function(block,error,message){_throws(!1,block,error,message)},assert.ifError=function(err){if(err)throw err};var objectKeys=Object.keys||function(obj){var keys=[];for(var key in obj)hasOwn.call(obj,key)&&keys.push(key);return keys}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"util/":163}],71:[function(require,module,exports){!function(mod){mod("object"==typeof exports&&"object"==typeof module?require("../../lib/codemirror"):CodeMirror)}(function(CodeMirror){"use strict";function firstNonWS(str){var found=str.search(nonWS);return-1==found?0:found}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!1!==mode.useInnerComments&&mode.innerMode?cm.getModeAt(pos):mode}var noOptions={},nonWS=/[^\s\u00a0]/,Pos=CodeMirror.Pos;CodeMirror.commands.toggleComment=function(cm){cm.toggleComment()},CodeMirror.defineExtension("toggleComment",function(options){options||(options=noOptions);for(var cm=this,minLine=1/0,ranges=this.listSelections(),mode=null,i=ranges.length-1;i>=0;i--){var from=ranges[i].from(),to=ranges[i].to();from.line>=minLine||(to.line>=minLine&&(to=Pos(minLine,0)),minLine=from.line,null==mode?cm.uncomment(from,to,options)?mode="un":(cm.lineComment(from,to,options),mode="line"):"un"==mode?cm.uncomment(from,to,options):cm.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&&!probablyInsideString(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;i<end;++i){var whitespace=(line=self.getLine(i)).slice(0,firstNonWS(line));(null==baseString||baseString.length>whitespace.length)&&(baseString=whitespace)}for(i=from.line;i<end;++i){var line=self.getLine(i),cut=baseString.length;(blankLines||nonWS.test(line))&&(line.slice(0,cut)!=baseString&&(cut=firstNonWS(line)),self.replaceRange(baseString+commentString+pad,Pos(i,0),Pos(i,cut)))}}else for(i=from.line;i<end;++i)(blankLines||nonWS.test(self.getLine(i)))&&self.replaceRange(commentString+pad,Pos(i,0))})}else(options.blockCommentStart||mode.blockCommentStart)&&(options.fullLines=!0,self.blockComment(from,to,options))}}),CodeMirror.defineExtension("blockComment",function(from,to,options){options||(options=noOptions);var self=this,mode=getMode(self,from),startString=options.blockCommentStart||mode.blockCommentStart,endString=options.blockCommentEnd||mode.blockCommentEnd;if(startString&&endString){if(!/\bcomment\b/.test(self.getTokenTypeAt(Pos(from.line,0)))){var end=Math.min(to.line,self.lastLine());end!=from.line&&0==to.ch&&nonWS.test(self.getLine(end))&&--end;var pad=null==options.padding?" ":options.padding;from.line>end||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(found>-1&&!/comment/.test(self.getTokenTypeAt(Pos(i,found+1)))&&(found=-1),-1==found&&nonWS.test(line))break lineComment;if(found>-1&&nonWS.test(line.slice(0,found)))break lineComment;lines.push(line)}if(self.operation(function(){for(var i=start;i<=end;++i){var line=lines[i-start],pos=line.indexOf(lineString),endPos=pos+lineString.length;pos<0||(line.slice(endPos,endPos+pad.length)==pad&&(endPos+=pad.length),didSomething=!0,self.replaceRange("",Pos(i,pos),Pos(i,endPos)))}}),didSomething)return!0}var startString=options.blockCommentStart||mode.blockCommentStart,endString=options.blockCommentEnd||mode.blockCommentEnd;if(!startString||!endString)return!1;var lead=options.blockCommentLead||mode.blockCommentLead,startLine=self.getLine(start),open=startLine.indexOf(startString);if(-1==open)return!1;var endLine=end==start?startLine:self.getLine(end),close=endLine.indexOf(endString,end==start?open+startString.length:0);-1==close&&start!=end&&(endLine=self.getLine(--end),close=endLine.indexOf(endString));var insideStart=Pos(start,open+1),insideEnd=Pos(end,close+1);if(-1==close||!/comment/.test(self.getTokenTypeAt(insideStart))||!/comment/.test(self.getTokenTypeAt(insideEnd))||self.getRange(insideStart,insideEnd,"\n").indexOf(endString)>-1)return!1;var lastStart=startLine.lastIndexOf(startString,from.ch),firstEnd=-1==lastStart?-1:startLine.slice(0,from.ch).indexOf(endString,lastStart+startString.length);if(-1!=lastStart&&-1!=firstEnd&&firstEnd+endString.length!=from.ch)return!1;firstEnd=endLine.indexOf(endString,to.ch);var almostLastStart=endLine.slice(to.ch).lastIndexOf(startString,firstEnd-to.ch);return lastStart=-1==firstEnd||-1==almostLastStart?-1:to.ch+almostLastStart,(-1==firstEnd||-1==lastStart||lastStart==to.ch)&&(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)),lead)for(var i=start+1;i<=end;++i){var line=self.getLine(i),found=line.indexOf(lead);if(-1!=found&&!nonWS.test(line.slice(0,found))){var foundEnd=found+lead.length;pad&&line.slice(foundEnd,foundEnd+pad.length)==pad&&(foundEnd+=pad.length),self.replaceRange("",Pos(i,found),Pos(i,foundEnd))}}}),!0)})})},{"../../lib/codemirror":84}],72:[function(require,module,exports){!function(mod){mod("object"==typeof exports&&"object"==typeof module?require("../../lib/codemirror"):CodeMirror)}(function(CodeMirror){function dialogDiv(cm,template,bottom){var dialog;return dialog=cm.getWrapperElement().appendChild(document.createElement("div")),dialog.className=bottom?"CodeMirror-dialog CodeMirror-dialog-bottom":"CodeMirror-dialog CodeMirror-dialog-top","string"==typeof template?dialog.innerHTML=template:dialog.appendChild(template),dialog}function closeNotification(cm,newVal){cm.state.currentNotificationClose&&cm.state.currentNotificationClose(),cm.state.currentNotificationClose=newVal}CodeMirror.defineExtension("openDialog",function(template,callback,options){function close(newVal){if("string"==typeof newVal)inp.value=newVal;else{if(closed)return;closed=!0,dialog.parentNode.removeChild(dialog),me.focus(),options.onClose&&options.onClose(dialog)}}options||(options={}),closeNotification(this,null);var button,dialog=dialogDiv(this,template,options.bottom),closed=!1,me=this,inp=dialog.getElementsByTagName("input")[0];return inp?(inp.focus(),options.value&&(inp.value=options.value,!1!==options.selectValueOnOpen&&inp.select()),options.onInput&&CodeMirror.on(inp,"input",function(e){options.onInput(e,inp.value,close)}),options.onKeyUp&&CodeMirror.on(inp,"keyup",function(e){options.onKeyUp(e,inp.value,close)}),CodeMirror.on(inp,"keydown",function(e){options&&options.onKeyDown&&options.onKeyDown(e,inp.value,close)||((27==e.keyCode||!1!==options.closeOnEnter&&13==e.keyCode)&&(inp.blur(),CodeMirror.e_stop(e),close()),13==e.keyCode&&callback(inp.value,e))}),!1!==options.closeOnBlur&&CodeMirror.on(inp,"blur",close)):(button=dialog.getElementsByTagName("button")[0])&&(CodeMirror.on(button,"click",function(){close(),me.focus()}),!1!==options.closeOnBlur&&CodeMirror.on(button,"blur",close),button.focus()),close}),CodeMirror.defineExtension("openConfirm",function(template,callbacks,options){function close(){closed||(closed=!0,dialog.parentNode.removeChild(dialog),me.focus())}closeNotification(this,null);var dialog=dialogDiv(this,template,options&&options.bottom),buttons=dialog.getElementsByTagName("button"),closed=!1,me=this,blurring=1;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(),callback&&callback(me)})}(callbacks[i]),CodeMirror.on(b,"blur",function(){--blurring,setTimeout(function(){blurring<=0&&close()},200)}),CodeMirror.on(b,"focus",function(){++blurring})}}),CodeMirror.defineExtension("openNotification",function(template,options){function close(){closed||(closed=!0,clearTimeout(doneTimer),dialog.parentNode.removeChild(dialog))}closeNotification(this,close);var doneTimer,dialog=dialogDiv(this,template,options&&options.bottom),closed=!1,duration=options&&void 0!==options.duration?options.duration:5e3;return CodeMirror.on(dialog,"click",function(e){CodeMirror.e_preventDefault(e),close()}),duration&&(doneTimer=setTimeout(close,duration)),close})})},{"../../lib/codemirror":84}],73:[function(require,module,exports){!function(mod){mod("object"==typeof exports&&"object"==typeof module?require("../../lib/codemirror"):CodeMirror)}(function(CodeMirror){function getOption(conf,name){return"pairs"==name&&"string"==typeof conf?conf:"object"==typeof conf&&null!=conf[name]?conf[name]:defaults[name]}function getConfig(cm){var deflt=cm.state.closeBrackets;return!deflt||deflt.override?deflt:cm.getModeAt(cm.getCursor()).closeBrackets||deflt}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"),pos=pairs.indexOf(ch);if(-1==pos)return CodeMirror.Pass;for(var type,triples=getOption(conf,"triples"),identical=pairs.charAt(pos+1)==ch,ranges=cm.listSelections(),opening=pos%2==0,i=0;i<ranges.length;i++){var curType,range=ranges[i],cur=range.head,next=cm.getRange(cur,Pos(cur.line,cur.ch+1));if(opening&&!range.empty())curType="surround";else if(!identical&&opening||next!=ch)if(identical&&cur.ch>1&&triples.indexOf(ch)>=0&&cm.getRange(Pos(cur.line,cur.ch-2),cur)==ch+ch&&(cur.ch<=2||cm.getRange(Pos(cur.line,cur.ch-3),Pos(cur.line,cur.ch-2))!=ch))curType="addFour";else if(identical){if(CodeMirror.isWordChar(next)||!enteringString(cm,cur,ch))return CodeMirror.Pass;curType="both"}else{if(!opening||cm.getLine(cur.line).length!=cur.ch&&!isClosingBracket(next,pairs)&&!/\s/.test(next))return CodeMirror.Pass;curType="both"}else curType=identical&&stringStartsAfter(cm,cur)?"both":triples.indexOf(ch)>=0&&cm.getRange(cur,Pos(cur.line,cur.ch+3))==ch+ch+ch?"skipThree":"skip";if(type){if(type!=curType)return CodeMirror.Pass}else type=curType}var left=pos%2?pairs.charAt(pos-1):ch,right=pos%2?ch:pairs.charAt(pos+1);cm.operation(function(){if("skip"==type)cm.execCommand("goCharRight");else if("skipThree"==type)for(i=0;i<3;i++)cm.execCommand("goCharRight");else if("surround"==type){for(var sels=cm.getSelections(),i=0;i<sels.length;i++)sels[i]=left+sels[i]+right;cm.replaceSelections(sels,"around"),sels=cm.listSelections().slice();for(i=0;i<sels.length;i++)sels[i]=contractSelection(sels[i]);cm.setSelections(sels)}else"both"==type?(cm.replaceSelection(left+right,null),cm.triggerElectric(left+right),cm.execCommand("goCharLeft")):"addFour"==type&&(cm.replaceSelection(left+left+left+left,"before"),cm.execCommand("goCharRight"))})}function isClosingBracket(ch,pairs){var pos=pairs.lastIndexOf(ch);return pos>-1&&pos%2==1}function charsAround(cm,pos){var str=cm.getRange(Pos(pos.line,pos.ch-1),Pos(pos.line,pos.ch+1));return 2==str.length?str:null}function enteringString(cm,pos,ch){var line=cm.getLine(pos.line),token=cm.getTokenAt(pos);if(/\bstring2?\b/.test(token.type)||stringStartsAfter(cm,pos))return!1;var stream=new CodeMirror.StringStream(line.slice(0,pos.ch)+ch+line.slice(pos.ch),4);for(stream.pos=stream.start=token.start;;){var type1=cm.getMode().token(stream,token.state);if(stream.pos>=pos.ch+1)return/\bstring2?\b/.test(type1);stream.start=stream.pos}}function stringStartsAfter(cm,pos){var token=cm.getTokenAt(Pos(pos.line,pos.ch+1));return/\bstring/.test(token.type)&&token.start==pos.ch}var defaults={pairs:"()[]{}''\"\"",triples:"",explode:"[]{}"},Pos=CodeMirror.Pos;CodeMirror.defineOption("autoCloseBrackets",!1,function(cm,val,old){old&&old!=CodeMirror.Init&&(cm.removeKeyMap(keyMap),cm.state.closeBrackets=null),val&&(cm.state.closeBrackets=val,cm.addKeyMap(keyMap))});for(var bind=defaults.pairs+"`",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<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(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")}},Enter:function(cm){var conf=getConfig(cm),explode=conf&&getOption(conf,"explode");if(!explode||cm.getOption("disableInput"))return CodeMirror.Pass;for(var ranges=cm.listSelections(),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(){cm.replaceSelection("\n\n",null),cm.execCommand("goCharLeft"),ranges=cm.listSelections();for(var i=0;i<ranges.length;i++){var line=ranges[i].head.line;cm.indentLine(line,null,!0),cm.indentLine(line+1,null,!0)}})}},i=0;i<bind.length;i++)keyMap["'"+bind.charAt(i)+"'"]=function(ch){return function(cm){return handleChar(cm,ch)}}(bind.charAt(i))})},{"../../lib/codemirror":84}],74:[function(require,module,exports){!function(mod){mod("object"==typeof exports&&"object"==typeof module?require("../../lib/codemirror"):CodeMirror)}(function(CodeMirror){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 match=!afterCursor&&pos>=0&&matching[line.text.charAt(pos)]||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)),found=scanForBracket(cm,Pos(where.line,pos+(dir>0?1:0)),dir,style||null,config);return null==found?null:{from:Pos(where.line,pos),to:found&&found.pos,match:found&&found.ch==match.charAt(0),forward:dir>0}}function scanForBracket(cm,where,dir,style,config){for(var maxScanLen=config&&config.maxScanLineLength||1e4,maxScanLines=config&&config.maxScanLines||1e3,stack=[],re=config&&config.bracketRegex?config.bracketRegex:/[(){}[\]]/,lineEnd=dir>0?Math.min(where.line+maxScanLines,cm.lastLine()+1):Math.max(cm.firstLine()-1,where.line-maxScanLines),lineNo=where.line;lineNo!=lineEnd;lineNo+=dir){var line=cm.getLine(lineNo);if(line){var pos=dir>0?0:line.length-1,end=dir>0?line.length:-1;if(!(line.length>maxScanLen))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))if(">"==matching[ch].charAt(1)==dir>0)stack.push(ch);else{if(!stack.length)return{pos:Pos(lineNo,pos),ch:ch};stack.pop()}}}}return lineNo-dir!=(dir>0?cm.lastLine():cm.firstLine())&&null}function matchBrackets(cm,autoclear,config){for(var maxHighlightLen=cm.state.matchBrackets.maxHighlightLineLength||1e3,marks=[],ranges=cm.listSelections(),i=0;i<ranges.length;i++){var match=ranges[i].empty()&&findMatchingBracket(cm,ranges[i].head,config);if(match&&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})),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){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)return clear;setTimeout(clear,800)}}function doMatchBrackets(cm){cm.operation(function(){currentlyHighlighted&&(currentlyHighlighted(),currentlyHighlighted=null),currentlyHighlighted=matchBrackets(cm,!1,cm.state.matchBrackets)})}var ie_lt8=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),Pos=CodeMirror.Pos,matching={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},currentlyHighlighted=null;CodeMirror.defineOption("matchBrackets",!1,function(cm,val,old){old&&old!=CodeMirror.Init&&(cm.off("cursorActivity",doMatchBrackets),currentlyHighlighted&&(currentlyHighlighted(),currentlyHighlighted=null)),val&&(cm.state.matchBrackets="object"==typeof val?val:{},cm.on("cursorActivity",doMatchBrackets))}),CodeMirror.defineExtension("matchBrackets",function(){matchBrackets(this,!0)}),CodeMirror.defineExtension("findMatchingBracket",function(pos,config,oldConfig){return(oldConfig||"boolean"==typeof config)&&(oldConfig?(oldConfig.strict=config,config=oldConfig):config=config?{strict:!0}:null),findMatchingBracket(this,pos,config)}),CodeMirror.defineExtension("scanForBracket",function(pos,dir,style,config){return scanForBracket(this,pos,dir,style,config)})})},{"../../lib/codemirror":84}],75:[function(require,module,exports){!function(mod){mod("object"==typeof exports&&"object"==typeof module?require("../../lib/codemirror"):CodeMirror)}(function(CodeMirror){"use strict";CodeMirror.registerHelper("fold","brace",function(cm,start){function findOpening(openCh){for(var at=start.ch,pass=0;;){var found=at<=0?-1:lineText.lastIndexOf(openCh,at-1);if(-1!=found){if(1==pass&&found<start.ch)break;if(tokenType=cm.getTokenTypeAt(CodeMirror.Pos(line,found+1)),!/^(comment|string)/.test(tokenType))return found+1;at=found-1}else{if(1==pass)break;pass=1,at=lineText.length}}}var tokenType,line=start.line,lineText=cm.getLine(line),startToken="{",endToken="}",startCh=findOpening("{");if(null==startCh&&(startToken="[",endToken="]",startCh=findOpening("[")),null!=startCh){var end,endCh,count=1,lastLine=cm.lastLine();outer:for(var i=line;i<=lastLine;++i)for(var text=cm.getLine(i),pos=i==line?startCh:0;;){var nextOpen=text.indexOf(startToken,pos),nextClose=text.indexOf(endToken,pos);if(nextOpen<0&&(nextOpen=text.length),nextClose<0&&(nextClose=text.length),(pos=Math.min(nextOpen,nextClose))==text.length)break;if(cm.getTokenTypeAt(CodeMirror.Pos(i,pos+1))==tokenType)if(pos==nextOpen)++count;else if(!--count){end=i,endCh=pos;break outer}++pos}if(null!=end&&(line!=end||endCh!=startCh))return{from:CodeMirror.Pos(line,startCh),to:CodeMirror.Pos(end,endCh)}}}),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))),"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(line<cm.firstLine()||line>cm.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;null!=hasInclude(end+1);)++end;return{from:CodeMirror.Pos(startLine,has+1),to:cm.clipPos(CodeMirror.Pos(end))}})})},{"../../lib/codemirror":84}],76:[function(require,module,exports){!function(mod){mod("object"==typeof exports&&"object"==typeof module?require("../../lib/codemirror"):CodeMirror)}(function(CodeMirror){"use strict";function doFold(cm,pos,options,force){function getRange(allowFolded){var range=finder(cm,pos);if(!range||range.to.line-range.from.line<minSize)return null;for(var marks=cm.findMarksAt(range.from),i=0;i<marks.length;++i)if(marks[i].__isFold&&"fold"!==force){if(!allowFolded)return null;range.cleared=!0,marks[i].clear()}return range}if(options&&options.call){finder=options;options=null}else var finder=getOption(cm,options,"rangeFinder");"number"==typeof pos&&(pos=CodeMirror.Pos(pos,0));var minSize=getOption(cm,options,"minFoldSize"),range=getRange(!0);if(getOption(cm,options,"scanUp"))for(;!range&&pos.line>cm.firstLine();)pos=CodeMirror.Pos(pos.line-1,0),range=getRange(!1);if(range&&!range.cleared&&"unfold"!==force){var myWidget=makeWidget(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)}}function makeWidget(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"}return widget}function getOption(cm,options,name){if(options&&void 0!==options[name])return options[name];var editorOptions=cm.options.foldOptions;return editorOptions&&void 0!==editorOptions[name]?editorOptions[name]:defaultOptions[name]}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<marks.length;++i)if(marks[i].__isFold)return!0}),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(),null,"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),null,"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),null,"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){for(var helpers=cm.getHelpers(start,"fold"),i=0;i<helpers.length;i++){var cur=helpers[i](cm,start);if(cur)return cur}});var defaultOptions={rangeFinder:CodeMirror.fold.auto,widget:"↔",minFoldSize:0,scanUp:!1,clearOnEnter:!0};CodeMirror.defineOption("foldOptions",null),CodeMirror.defineExtension("foldOption",function(options,name){return getOption(this,options,name)})})},{"../../lib/codemirror":84}],77:[function(require,module,exports){!function(mod){"object"==typeof exports&&"object"==typeof module?mod(require("../../lib/codemirror"),require("./foldcode")):mod(CodeMirror)}(function(CodeMirror){"use strict";function State(options){this.options=options,this.from=this.to=0}function parseOptions(opts){return!0===opts&&(opts={}),null==opts.gutter&&(opts.gutter="CodeMirror-foldgutter"),null==opts.indicatorOpen&&(opts.indicatorOpen="CodeMirror-foldgutter-open"),null==opts.indicatorFolded&&(opts.indicatorFolded="CodeMirror-foldgutter-folded"),opts}function isFolded(cm,line){for(var marks=cm.findMarks(Pos(line,0),Pos(line+1,0)),i=0;i<marks.length;++i)if(marks[i].__isFold&&marks[i].find().from.line==line)return marks[i]}function marker(spec){if("string"==typeof spec){var elt=document.createElement("div");return elt.className=spec+" CodeMirror-guttermarker-subtle",elt}return spec.cloneNode(!0)}function updateFoldInfo(cm,from,to){var opts=cm.state.foldGutter.options,cur=from,minSize=cm.foldOption(opts,"minFoldSize"),func=cm.foldOption(opts,"rangeFinder");cm.eachLine(from,to,function(line){var mark=null;if(isFolded(cm,cur))mark=marker(opts.indicatorFolded);else{var pos=Pos(cur,0),range=func&&func(cm,pos);range&&range.to.line-range.from.line>=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||vp.from-state.to>20||state.from-vp.to>20?updateInViewport(cm):cm.operation(function(){vp.from<state.from&&(updateFoldInfo(cm,vp.from,state.from),state.from=vp.from),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){var line=from.line;line>=state.from&&line<state.to&&updateFoldInfo(cm,line,line+1)}}CodeMirror.defineOption("foldGutter",!1,function(cm,val,old){old&&old!=CodeMirror.Init&&(cm.clearGutter(cm.state.foldGutter.options.gutter),cm.state.foldGutter=null,cm.off("gutterClick",onGutterClick),cm.off("change",onChange),cm.off("viewportChange",onViewportChange),cm.off("fold",onFold),cm.off("unfold",onFold),cm.off("swapDoc",onChange)),val&&(cm.state.foldGutter=new State(parseOptions(val)),updateInViewport(cm),cm.on("gutterClick",onGutterClick),cm.on("change",onChange),cm.on("viewportChange",onViewportChange),cm.on("fold",onFold),cm.on("unfold",onFold),cm.on("swapDoc",onChange))});var Pos=CodeMirror.Pos})},{"../../lib/codemirror":84,"./foldcode":76}],78:[function(require,module,exports){!function(mod){mod("object"==typeof exports&&"object"==typeof module?require("../../lib/codemirror"):CodeMirror)}(function(CodeMirror){"use strict";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;var self=this;cm.on("cursorActivity",this.activityFunc=function(){self.cursorActivity()})}function isNewCompletion(old,nw){return CodeMirror.cmpPos(nw.from,old.from)>0&&old.to.ch-old.from.ch!=nw.to.ch-nw.from.ch}function parseOptions(cm,pos,options){var editor=cm.options.hintOptions,out={};for(var prop in defaultOptions)out[prop]=defaultOptions[prop];if(editor)for(var prop in editor)void 0!==editor[prop]&&(out[prop]=editor[prop]);if(options)for(var prop in options)void 0!==options[prop]&&(out[prop]=options[prop]);return out.hint.resolve&&(out.hint=out.hint.resolve(cm,pos)),out}function getText(completion){return"string"==typeof completion?completion:completion.text}function buildKeyMap(completion,handle){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}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},custom=completion.options.customKeys,ourMap=custom?{}:baseMap;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}function getHintElement(hintsElement,el){for(;el&&el!=hintsElement;){if("LI"===el.nodeName.toUpperCase()&&el.parentNode==hintsElement)return el;el=el.parentNode}}function Widget(completion,data){this.completion=completion,this.data=data,this.picked=!1;var widget=this,cm=completion.cm,hints=this.hints=document.createElement("ul");hints.className="CodeMirror-hints",this.selectedHint=data.selectedHint||0;for(var completions=data.list,i=0;i<completions.length;++i){var elt=hints.appendChild(document.createElement("li")),cur=completions[i],className=HINT_ELEMENT_CLASS+(i!=this.selectedHint?"":" "+ACTIVE_HINT_ELEMENT_CLASS);null!=cur.className&&(className=cur.className+" "+className),elt.className=className,cur.render?cur.render(elt,data,cur):elt.appendChild(document.createTextNode(cur.displayText||getText(cur))),elt.hintId=i}var pos=cm.cursorCoords(completion.options.alignWithWord?data.from:null),left=pos.left,top=pos.bottom,below=!0;hints.style.left=left+"px",hints.style.top=top+"px";var winW=window.innerWidth||Math.max(document.body.offsetWidth,document.documentElement.offsetWidth),winH=window.innerHeight||Math.max(document.body.offsetHeight,document.documentElement.offsetHeight);(completion.options.container||document.body).appendChild(hints);var box=hints.getBoundingClientRect(),overlapY=box.bottom-winH,scrolls=hints.scrollHeight>hints.clientHeight+1,startScroll=cm.getScrollInfo();if(overlapY>0){var height=box.bottom-box.top;if(pos.top-(pos.bottom-box.top)-height>0)hints.style.top=(top=pos.top-height)+"px",below=!1;else if(height>winH){hints.style.height=winH-5+"px",hints.style.top=(top=pos.bottom-box.top)+"px";var cursor=cm.getCursor();data.from.ch!=cursor.ch&&(pos=cm.cursorCoords(cursor),hints.style.left=(left=pos.left)+"px",box=hints.getBoundingClientRect())}}var overlapX=box.right-winW;if(overlapX>0&&(box.right-box.left>winW&&(hints.style.width=winW-5+"px",overlapX-=box.right-box.left-winW),hints.style.left=(left=pos.left-overlapX)+"px"),scrolls)for(var node=hints.firstChild;node;node=node.nextSibling)node.style.paddingRight=cm.display.nativeBarWidth+"px";if(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})),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)})}return cm.on("scroll",this.onScroll=function(){var curScroll=cm.getScrollInfo(),editor=cm.getWrapperElement().getBoundingClientRect(),newTop=top+startScroll.top-curScroll.top,point=newTop-(window.pageYOffset||(document.documentElement||document.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[0],hints.firstChild),!0}function applicableHelpers(cm,helpers){if(!cm.somethingSelected())return helpers;for(var result=[],i=0;i<helpers.length;i++)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);result&&result.then?result.then(callback):callback(result)}}var HINT_ELEMENT_CLASS="CodeMirror-hint",ACTIVE_HINT_ELEMENT_CLASS="CodeMirror-hint-active";CodeMirror.showHint=function(cm,getHints,options){if(!getHints)return cm.showHint(options);options&&options.async&&(getHints.async=!0);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)){if(this.somethingSelected()){if(!options.hint.supportsSelection)return;for(var i=0;i<selections.length;i++)if(selections[i].head.line!=selections[i].anchor.line)return}this.state.completionActive&&this.state.completionActive.close();var completion=this.state.completionActive=new Completion(this,options);completion.options.hint&&(CodeMirror.signal(this,"startCompletion",this),completion.update(!0))}});var requestAnimationFrame=window.requestAnimationFrame||function(fn){return setTimeout(fn,1e3/60)},cancelAnimationFrame=window.cancelAnimationFrame||clearTimeout;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.startPos.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()}),this.widget&&this.widget.disable()}},update:function(first){if(null!=this.tick){var self=this,myTick=++this.tick;fetchHints(this.options.hint,this.cm,this.options,function(data){self.tick==myTick&&self.finishUpdate(data,first)})}},finishUpdate:function(data,first){this.data&&CodeMirror.signal(this.data,"update");var picked=this.widget&&this.widget.picked||first&&this.options.completeSingle;this.widget&&this.widget.close(),data&&this.data&&isNewCompletion(this.data,data)||(this.data=data,data&&data.list.length&&(picked&&1==data.list.length?this.pick(data,0):(this.widget=new Widget(this,data),CodeMirror.signal(data,"shown"))))}},Widget.prototype={close:function(){if(this.completion.widget==this){this.completion.widget=null,this.hints.parentNode.removeChild(this.hints),this.completion.cm.removeKeyMap(this.keyMap);var cm=this.completion.cm;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=!0}},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:i<0&&(i=avoidWrap?0:this.data.list.length-1),this.selectedHint!=i){var node=this.hints.childNodes[this.selectedHint];node.className=node.className.replace(" "+ACTIVE_HINT_ELEMENT_CLASS,""),(node=this.hints.childNodes[this.selectedHint=i]).className+=" "+ACTIVE_HINT_ELEMENT_CLASS,node.offsetTop<this.hints.scrollTop?this.hints.scrollTop=node.offsetTop-3:node.offsetTop+node.offsetHeight>this.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){function run(i){if(i==app.length)return callback(null);fetchHints(app[i],cm,options,function(result){result&&result.list.length>0?callback(result):run(i+1)})}var app=applicableHelpers(cm,helpers);run(0)};return resolved.async=!0,resolved.supportsSelection=!0,resolved}return(words=cm.getHelper(cm.getCursor(),"hintWords"))?function(cm){return CodeMirror.hint.fromList(cm,{words:words})}:CodeMirror.hint.anyword?function(cm,options){return CodeMirror.hint.anyword(cm,options)}:function(){}}}),CodeMirror.registerHelper("hint","fromList",function(cm,options){var cur=cm.getCursor(),token=cm.getTokenAt(cur),to=CodeMirror.Pos(cur.line,token.end);if(token.string&&/\w/.test(token.string[token.string.length-1]))var term=token.string,from=CodeMirror.Pos(cur.line,token.start);else var term="",from=to;for(var found=[],i=0;i<options.words.length;i++){var word=options.words[i];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:!0,alignWithWord:!0,closeCharacters:/[\s()\[\]{};:>,]/,closeOnUnfocus:!0,completeOnSingleClick:!0,container:null,customKeys:null,extraKeys:null};CodeMirror.defineOption("hintOptions",null)})},{"../../lib/codemirror":84}],79:[function(require,module,exports){!function(mod){mod("object"==typeof exports&&"object"==typeof module?require("../../lib/codemirror"):CodeMirror)}(function(CodeMirror){"use strict";function showTooltip(e,content){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"}var tt=document.createElement("div");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}function rm(elt){elt.parentNode&&elt.parentNode.removeChild(elt)}function hideTooltip(tt){tt.parentNode&&(null==tt.style.opacity&&rm(tt),tt.style.opacity=0,setTimeout(function(){rm(tt)},600))}function showTooltipFor(e,content,node){function hide(){CodeMirror.off(node,"mouseout",hide),tooltip&&(hideTooltip(tooltip),tooltip=null)}var tooltip=showTooltip(e,content),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){onMouseOver(cm,e)},this.waitingFor=0}function parseOptions(_cm,options){return options instanceof Function?{getAnnotations:options}:(options&&!0!==options||(options={}),options)}function clearMarks(cm){var state=cm.state.lint;state.hasGutter&&cm.clearGutter(GUTTER_ID);for(var i=0;i<state.marked.length;++i)state.marked[i].clear();state.marked.length=0}function makeMarker(labels,severity,multiple,tooltips){var marker=document.createElement("div"),inner=marker;return marker.className="CodeMirror-lint-marker-"+severity,multiple&&((inner=marker.appendChild(document.createElement("div"))).className="CodeMirror-lint-marker-multiple"),0!=tooltips&&CodeMirror.on(inner,"mouseover",function(e){showTooltipFor(e,labels,inner)}),marker}function getMaxSeverity(a,b){return"error"==a?a:b}function groupByLine(annotations){for(var lines=[],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;severity||(severity="error");var tip=document.createElement("div");return tip.className="CodeMirror-lint-message-"+severity,tip.appendChild(document.createTextNode(ann.message)),tip}function lintAsync(cm,getAnnotations,passOptions){function abort(){id=-1,cm.off("change",abort)}var state=cm.state.lint,id=++state.waitingFor;cm.on("change",abort),getAnnotations(cm.getValue(),function(annotations,arg2){cm.off("change",abort),state.waitingFor==id&&(arg2&&annotations instanceof CodeMirror&&(annotations=arg2),updateLinting(cm,annotations))},passOptions,cm)}function startLinting(cm){var options=cm.state.lint.options,passOptions=options.options||options,getAnnotations=options.getAnnotations||cm.getHelper(CodeMirror.Pos(0,0),"lint");if(getAnnotations)if(options.async||getAnnotations.async)lintAsync(cm,getAnnotations,passOptions);else{var annotations=getAnnotations(cm.getValue(),passOptions,cm);if(!annotations)return;annotations.then?annotations.then(function(issues){updateLinting(cm,issues)}):updateLinting(cm,annotations)}}function updateLinting(cm,annotationsNotSorted){clearMarks(cm);for(var state=cm.state.lint,options=state.options,annotations=groupByLine(annotationsNotSorted),line=0;line<annotations.length;++line){var anns=annotations[line];if(anns){for(var maxSeverity=null,tipLabel=state.hasGutter&&document.createDocumentFragment(),i=0;i<anns.length;++i){var ann=anns[i],severity=ann.severity;severity||(severity="error"),maxSeverity=getMaxSeverity(maxSeverity,severity),options.formatAnnotation&&(ann=options.formatAnnotation(ann)),state.hasGutter&&tipLabel.appendChild(annotationTooltip(ann)),ann.to&&state.marked.push(cm.markText(ann.from,ann.to,{className:"CodeMirror-lint-mark-"+severity,__annotation:ann}))}state.hasGutter&&cm.setGutterMarker(line,GUTTER_ID,makeMarker(tipLabel,maxSeverity,anns.length>1,state.options.tooltips))}}options.onUpdateLinting&&options.onUpdateLinting(annotationsNotSorted,annotations,cm)}function onChange(cm){var state=cm.state.lint;state&&(clearTimeout(state.timeout),state.timeout=setTimeout(function(){startLinting(cm)},state.options.delay||500))}function popupTooltips(annotations,e){for(var target=e.target||e.srcElement,tooltip=document.createDocumentFragment(),i=0;i<annotations.length;i++){var ann=annotations[i];tooltip.appendChild(annotationTooltip(ann))}showTooltipFor(e,tooltip,target)}function onMouseOver(cm,e){var target=e.target||e.srcElement;if(/\bCodeMirror-lint-mark-/.test(target.className)){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<spans.length;++i){var ann=spans[i].__annotation;ann&&annotations.push(ann)}annotations.length&&popupTooltips(annotations,e)}}var GUTTER_ID="CodeMirror-lint-markers";CodeMirror.defineOption("lint",!1,function(cm,val,old){if(old&&old!=CodeMirror.Init&&(clearMarks(cm),!1!==cm.state.lint.options.lintOnChange&&cm.off("change",onChange),CodeMirror.off(cm.getWrapperElement(),"mouseover",cm.state.lint.onMouseOver),clearTimeout(cm.state.lint.timeout),delete cm.state.lint),val){for(var gutters=cm.getOption("gutters"),hasLintGutter=!1,i=0;i<gutters.length;++i)gutters[i]==GUTTER_ID&&(hasLintGutter=!0);var state=cm.state.lint=new LintState(cm,parseOptions(0,val),hasLintGutter);!1!==state.options.lintOnChange&&cm.on("change",onChange),0!=state.options.tooltips&&"gutter"!=state.options.tooltips&&CodeMirror.on(cm.getWrapperElement(),"mouseover",state.onMouseOver),startLinting(cm)}}),CodeMirror.defineExtension("performLint",function(){this.state.lint&&startLinting(this)})})},{"../../lib/codemirror":84}],80:[function(require,module,exports){!function(mod){"object"==typeof exports&&"object"==typeof module?mod(require("../../lib/codemirror"),require("../dialog/dialog")):mod(CodeMirror)}(function(CodeMirror){"use strict";function dialog(cm,text,shortText,deflt,f){cm.openDialog?cm.openDialog(text,f,{value:deflt,selectValueOnOpen:!0}):f(prompt(shortText,deflt))}function interpretLine(cm,string){var num=Number(string);return/^[-+]/.test(string)?cm.getCursor().line+num:num-1}CodeMirror.commands.jumpToLine=function(cm){var cur=cm.getCursor();dialog(cm,'Jump to line: <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">(Use line:column or scroll% syntax)</span>',"Jump to line:",cur.line+1+":"+cur.ch,function(posStr){if(posStr){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);/^[-+]/.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"})},{"../../lib/codemirror":84,"../dialog/dialog":72}],81:[function(require,module,exports){!function(mod){"object"==typeof exports&&"object"==typeof module?mod(require("../../lib/codemirror"),require("./searchcursor"),require("../dialog/dialog")):mod(CodeMirror)}(function(CodeMirror){"use strict";function searchOverlay(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()}}}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 persistentDialog(cm,text,deflt,onEnter,onKeyDown){cm.openDialog(text,onEnter,{value:deflt,selectValueOnOpen:!0,closeOnEnter:!1,onClose:function(){clearSearch(cm)},onKeyDown:onKeyDown})}function dialog(cm,text,shortText,deflt,f){cm.openDialog?cm.openDialog(text,f,{value:deflt,selectValueOnOpen:!0}):f(prompt(shortText,deflt))}function confirmDialog(cm,text,shortText,fs){cm.openConfirm?cm.openConfirm(text,fs):confirm(shortText)&&fs[0]()}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=searchOverlay(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(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)}))};persistentDialog(cm,queryDialog,q,searchNext,function(event,query){var keyName=CodeMirror.keyName(event),cmd=CodeMirror.keyMap[cm.getOption("keyMap")][keyName];cmd||(cmd=cm.getOption("extraKeys")[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,queryDialog,"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 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='<span class="CodeMirror-search-label">'+(all?"Replace all:":"Replace:")+"</span>";dialog(cm,dialogText+replaceQueryDialog,dialogText,query,function(query){query&&(query=parseQuery(query),dialog(cm,replacementQueryDialog,"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()}),confirmDialog(cm,doReplaceConfirm,"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()}}))})}}var queryDialog='<span class="CodeMirror-search-label">Search:</span> <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">(Use /re/ syntax for regexp search)</span>',replaceQueryDialog=' <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">(Use /re/ syntax for regexp search)</span>',replacementQueryDialog='<span class="CodeMirror-search-label">With:</span> <input type="text" style="width: 10em" class="CodeMirror-search-field"/>',doReplaceConfirm='<span class="CodeMirror-search-label">Replace?</span> <button>Yes</button> <button>No</button> <button>All</button> <button>Stop</button>';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)}})},{"../../lib/codemirror":84,"../dialog/dialog":72,"./searchcursor":82}],82:[function(require,module,exports){!function(mod){mod("object"==typeof exports&&"object"==typeof module?require("../../lib/codemirror"):CodeMirror)}(function(CodeMirror){"use strict";function regexpFlags(regexp){var flags=regexp.flags;return null!=flags?flags:(regexp.ignoreCase?"i":"")+(regexp.global?"g":"")+(regexp.multiline?"m":"")}function ensureGlobal(regexp){return regexp.global?regexp:new RegExp(regexp.source,regexpFlags(regexp)+"g")}function maybeMultiline(regexp){return/\\s|\\n|\n|\\W|\\D|\[\^/.test(regexp.source)}function searchRegexpForward(doc,regexp,start){regexp=ensureGlobal(regexp);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=ensureGlobal(regexp);for(var string,chunk=1,line=start.line,last=doc.lastLine();line<=last;){for(var i=0;i<chunk;i++){var curLine=doc.getLine(line++);string=null==string?curLine:string+"\n"+curLine}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"),startLine=start.line+before.length-1,startCh=before[before.length-1].length;return{from:Pos(startLine,startCh),to:Pos(startLine+inside.length-1,1==inside.length?startCh+inside[0].length:inside[inside.length-1].length),match:match}}}}function lastMatchIn(string,regexp){for(var match,cutOff=0;;){regexp.lastIndex=cutOff;var newMatch=regexp.exec(string);if(!newMatch)return match;if(match=newMatch,(cutOff=match.index+(match[0].length||1))==string.length)return match}}function searchRegexpBackward(doc,regexp,start){regexp=ensureGlobal(regexp);for(var line=start.line,ch=start.ch,first=doc.firstLine();line>=first;line--,ch=-1){var string=doc.getLine(line);ch>-1&&(string=string.slice(0,ch));var match=lastMatchIn(string,regexp);if(match)return{from:Pos(line,match.index),to:Pos(line,match.index+match[0].length),match:match}}}function searchRegexpBackwardMultiline(doc,regexp,start){regexp=ensureGlobal(regexp);for(var string,chunk=1,line=start.line,first=doc.firstLine();line>=first;){for(var i=0;i<chunk;i++){var curLine=doc.getLine(line--);string=null==string?curLine.slice(0,start.ch):curLine+"\n"+string}chunk*=2;var match=lastMatchIn(string,regexp);if(match){var before=string.slice(0,match.index).split("\n"),inside=match[0].split("\n"),startLine=line+before.length,startCh=before[before.length-1].length;return{from:Pos(startLine,startCh),to:Pos(startLine+inside.length-1,1==inside.length?startCh+inside[0].length:inside[inside.length-1].length),match:match}}}}function adjustPos(orig,folded,pos){if(orig.length==folded.length)return pos;for(var pos1=Math.min(pos,orig.length);;){var len1=orig.slice(0,pos1).toLowerCase().length;if(len1<pos)++pos1;else{if(!(len1>pos))return pos1;--pos1}}}function searchStringForward(doc,query,start,caseFold){if(!query.length)return null;var fold=caseFold?doFold:noFold,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(1==lines.length){var found=string.indexOf(lines[0]);if(-1==found)continue search;var start=adjustPos(orig,string,found)+ch;return{from:Pos(line,adjustPos(orig,string,found)+ch),to:Pos(line,adjustPos(orig,string,found+lines[0].length)+ch)}}var cutFrom=string.length-lines[0].length;if(string.slice(cutFrom)==lines[0]){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(end.slice(0,lastLine.length)==lastLine)return{from:Pos(line,adjustPos(orig,string,cutFrom)+ch),to:Pos(line+lines.length-1,adjustPos(end,endString,lastLine.length))}}}}function searchStringBackward(doc,query,start,caseFold){if(!query.length)return null;var fold=caseFold?doFold:noFold,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);ch>-1&&(orig=orig.slice(0,ch));var string=fold(orig);if(1==lines.length){var found=string.lastIndexOf(lines[0]);if(-1==found)continue search;return{from:Pos(line,adjustPos(orig,string,found)),to:Pos(line,adjustPos(orig,string,found+lines[0].length))}}var lastLine=lines[lines.length-1];if(string.slice(0,lastLine.length)==lastLine){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])return{from:Pos(line+1-lines.length,adjustPos(top,topString,top.length-lines[0].length)),to:Pos(line,adjustPos(orig,string,lastLine.length))}}}}function SearchCursor(doc,query,pos,options){this.atOccurrence=!1,this.doc=doc,pos=pos?doc.clipPos(pos):Pos(0,0),this.pos={from:pos,to:pos};var caseFold;"object"==typeof options?caseFold=options.caseFold:(caseFold=options,options=null),"string"==typeof query?(null==caseFold&&(caseFold=!1),this.matches=function(reverse,pos){return(reverse?searchStringBackward:searchStringForward)(doc,query,pos,caseFold)}):(query=ensureGlobal(query),options&&!1===options.multiline?this.matches=function(reverse,pos){return(reverse?searchRegexpBackward:searchRegexpForward)(doc,query,pos)}:this.matches=function(reverse,pos){return(reverse?searchRegexpBackwardMultiline:searchRegexpForwardMultiline)(doc,query,pos)})}var doFold,noFold,Pos=CodeMirror.Pos;String.prototype.normalize?(doFold=function(str){return str.normalize("NFD").toLowerCase()},noFold=function(str){return str.normalize("NFD")}):(doFold=function(str){return str.toLowerCase()},noFold=function(str){return str}),SearchCursor.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(reverse){for(var result=this.matches(reverse,this.doc.clipPos(reverse?this.pos.from:this.pos.to));result&&0==CodeMirror.cmpPos(result.from,result.to);)reverse?result.from.ch?result.from=Pos(result.from.line,result.from.ch-1):result=result.from.line==this.doc.firstLine()?null:this.matches(reverse,this.doc.clipPos(Pos(result.from.line-1))):result.to.ch<this.doc.getLine(result.to.line).length?result.to=Pos(result.to.line,result.to.ch+1):result=result.to.line==this.doc.lastLine()?null:this.matches(reverse,Pos(result.to.line+1,0));if(result)return this.pos=result,this.atOccurrence=!0,this.pos.match||!0;var end=Pos(reverse?this.doc.firstLine():this.doc.lastLine()+1,0);return this.pos={from:end,to:end},this.atOccurrence=!1},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){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+(1==lines.length?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){for(var ranges=[],cur=this.getSearchCursor(query,this.getCursor("from"),caseFold);cur.findNext()&&!(CodeMirror.cmpPos(cur.to(),this.getCursor("to"))>0);)ranges.push({anchor:cur.from(),head:cur.to()});ranges.length&&this.setSelections(ranges,0)})})},{"../../lib/codemirror":84}],83:[function(require,module,exports){!function(mod){"object"==typeof exports&&"object"==typeof module?mod(require("../lib/codemirror"),require("../addon/search/searchcursor"),require("../addon/edit/matchbrackets")):mod(CodeMirror)}(function(CodeMirror){"use strict";function findPosSubword(doc,start,dir){if(dir<0&&0==start.ch)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));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&&dir>0){type="w";continue}break}}return Pos(start.line,pos)}function moveSubword(cm,dir){cm.extendSelectionsBy(function(range){return cm.display.shift||cm.doc.extend||range.empty()?findPosSubword(cm.doc,range.head,dir):dir<0?range.from():range.to()})}function insertLine(cm,above){if(cm.isReadOnly())return CodeMirror.Pass;cm.operation(function(){for(var len=cm.listSelections().length,newSelection=[],last=-1,i=0;i<len;i++){var head=cm.listSelections()[i].head;if(!(head.line<=last)){var at=Pos(head.line+(above?0:1),0);cm.replaceRange("\n",at,null,"+insertLine"),cm.indentLine(at.line,null,!0),newSelection.push({head:at,anchor:at}),last=head.line+1}}cm.setSelections(newSelection)}),cm.execCommand("indentAuto")}function wordAt(cm,pos){for(var start=pos.ch,end=start,line=cm.getLine(pos.line);start&&CodeMirror.isWordChar(line.charAt(start-1));)--start;for(;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)}}function isSelectedRange(ranges,from,to){for(var i=0;i<ranges.length;i++)if(ranges[i].from()==from&&ranges[i].to()==to)return!0;return!1}function selectBetweenBrackets(cm){for(var ranges=cm.listSelections(),newRanges=[],i=0;i<ranges.length;i++){var pos=ranges[i].head,opening=cm.scanForBracket(pos,-1);if(!opening)return!1;for(;;){var closing=cm.scanForBracket(pos,1);if(!closing)return!1;if(closing.ch==mirror.charAt(mirror.indexOf(opening.ch)+1)){newRanges.push({anchor:Pos(opening.pos.line,opening.pos.ch+1),head:closing.pos});break}pos=Pos(closing.pos.line,closing.pos.ch+1)}}return cm.setSelections(newRanges),!0}function sortLines(cm,caseSensitive){if(cm.isReadOnly())return CodeMirror.Pass;for(var selected,ranges=cm.listSelections(),toSort=[],i=0;i<ranges.length;i++){var range=ranges[i];if(!range.empty()){for(var from=range.from().line,to=range.to().line;i<ranges.length-1&&ranges[i+1].from().line==to;)to=ranges[++i].to().line;ranges[i].to().ch||to--,toSort.push(from,to)}}toSort.length?selected=!0:toSort.push(cm.firstLine(),cm.lastLine()),cm.operation(function(){for(var ranges=[],i=0;i<toSort.length;i+=2){var from=toSort[i],to=toSort[i+1],start=Pos(from,0),end=Pos(to),lines=cm.getRange(start,end,!1);caseSensitive?lines.sort():lines.sort(function(a,b){var au=a.toUpperCase(),bu=b.toUpperCase();return au!=bu&&(a=au,b=bu),a<b?-1:a==b?0:1}),cm.replaceRange(lines,start,end),selected&&ranges.push({anchor:start,head:Pos(to+1,0)})}selected&&cm.setSelections(ranges,0)})}function modifyWordOrSelection(cm,mod){cm.operation(function(){for(var ranges=cm.listSelections(),indices=[],replacements=[],i=0;i<ranges.length;i++)(range=ranges[i]).empty()?(indices.push(i),replacements.push("")):replacements.push(mod(cm.getRange(range.from(),range.to())));cm.replaceSelections(replacements,"around","case");for(var at,i=indices.length-1;i>=0;i--){var range=ranges[indices[i]];if(!(at&&CodeMirror.cmpPos(range.head,at)>0)){var word=wordAt(cm,range.head);at=word.from,cm.replaceRange(mod(word.word),word.from,word.to)}}})}function getTarget(cm){var from=cm.getCursor("from"),to=cm.getCursor("to");if(0==CodeMirror.cmpPos(from,to)){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){var query=target.query,cur=cm.getSearchCursor(query,forward?target.to:target.from);(forward?cur.findNext():cur.findPrevious())?cm.setSelection(cur.from(),cur.to()):(cur=cm.getSearchCursor(query,forward?Pos(cm.firstLine(),0):cm.clipPos(Pos(cm.lastLine()))),(forward?cur.findNext():cur.findPrevious())?cm.setSelection(cur.from(),cur.to()):target.word&&cm.setSelection(target.from,target.to))}}var map=CodeMirror.keyMap.sublime={fallthrough:"default"},cmds=CodeMirror.commands,Pos=CodeMirror.Pos,mac=CodeMirror.keyMap.default==CodeMirror.keyMap.macDefault,ctrl=mac?"Cmd-":"Ctrl-",goSubwordCombo=mac?"Ctrl-":"Alt-";cmds[map[goSubwordCombo+"Left"]="goSubwordLeft"]=function(cm){moveSubword(cm,-1)},cmds[map[goSubwordCombo+"Right"]="goSubwordRight"]=function(cm){moveSubword(cm,1)},mac&&(map["Cmd-Left"]="goLineStartSmart");var scrollLineCombo=mac?"Ctrl-Alt-":"Ctrl-";cmds[map[scrollLineCombo+"Up"]="scrollLineUp"]=function(cm){var info=cm.getScrollInfo();if(!cm.somethingSelected()){var visibleBottomLine=cm.lineAtHeight(info.top+info.clientHeight,"local");cm.getCursor().line>=visibleBottomLine&&cm.execCommand("goLineUp")}cm.scrollTo(null,info.top-cm.defaultTextHeight())},cmds[map[scrollLineCombo+"Down"]="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[map["Shift-"+ctrl+"L"]="splitSelectionByLine"]=function(cm){for(var ranges=cm.listSelections(),lineRanges=[],i=0;i<ranges.length;i++)for(var from=ranges[i].from(),to=ranges[i].to(),line=from.line;line<=to.line;++line)to.line>from.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)},map["Shift-Tab"]="indentLess",cmds[map.Esc="singleSelectionTop"]=function(cm){var range=cm.listSelections()[0];cm.setSelection(range.anchor,range.head,{scroll:!1})},cmds[map[ctrl+"L"]="selectLine"]=function(cm){for(var ranges=cm.listSelections(),extended=[],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)},map["Shift-Ctrl-K"]="deleteLine",cmds[map[ctrl+"Enter"]="insertLineAfter"]=function(cm){return insertLine(cm,!1)},cmds[map["Shift-"+ctrl+"Enter"]="insertLineBefore"]=function(cm){return insertLine(cm,!0)},cmds[map[ctrl+"D"]="selectNextOccurrence"]=function(cm){var from=cm.getCursor("from"),to=cm.getCursor("to"),fullWord=cm.state.sublimeFindFullWord==cm.doc.sel;if(0==CodeMirror.cmpPos(from,to)){var word=wordAt(cm,from);if(!word.word)return;cm.setSelection(word.from,word.to),fullWord=!0}else{var text=cm.getRange(from,to),query=fullWord?new RegExp("\\b"+text+"\\b"):text,cur=cm.getSearchCursor(query,to),found=cur.findNext();if(found||(found=(cur=cm.getSearchCursor(query,Pos(cm.firstLine(),0))).findNext()),!found||isSelectedRange(cm.listSelections(),cur.from(),cur.to()))return CodeMirror.Pass;cm.addSelection(cur.from(),cur.to())}fullWord&&(cm.state.sublimeFindFullWord=cm.doc.sel)};var mirror="(){}[]";cmds[map["Shift-"+ctrl+"Space"]="selectScope"]=function(cm){selectBetweenBrackets(cm)||cm.execCommand("selectAll")},cmds[map["Shift-"+ctrl+"M"]="selectBetweenBrackets"]=function(cm){if(!selectBetweenBrackets(cm))return CodeMirror.Pass},cmds[map[ctrl+"M"]="goToBracket"]=function(cm){cm.extendSelectionsBy(function(range){var next=cm.scanForBracket(range.head,1);if(next&&0!=CodeMirror.cmpPos(next.pos,range.head))return next.pos;var prev=cm.scanForBracket(range.head,-1);return prev&&Pos(prev.pos.line,prev.pos.ch+1)||range.head})};var swapLineCombo=mac?"Cmd-Ctrl-":"Shift-Ctrl-";cmds[map[swapLineCombo+"Up"]="swapLineUp"]=function(cm){if(cm.isReadOnly())return CodeMirror.Pass;for(var ranges=cm.listSelections(),linesToMove=[],at=cm.firstLine()-1,newSels=[],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)}),0!=range.to().ch||range.empty()||--to,from>at?linesToMove.push(from,to):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],line=cm.getLine(from);cm.replaceRange("",Pos(from,0),Pos(from+1,0),"+swapLine"),to>cm.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[map[swapLineCombo+"Down"]="swapLineDown"]=function(cm){if(cm.isReadOnly())return CodeMirror.Pass;for(var ranges=cm.listSelections(),linesToMove=[],at=cm.lastLine()+1,i=ranges.length-1;i>=0;i--){var range=ranges[i],from=range.to().line+1,to=range.from().line;0!=range.to().ch||range.empty()||from--,from<at?linesToMove.push(from,to):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],line=cm.getLine(from);from==cm.lastLine()?cm.replaceRange("",Pos(from-1),Pos(from),"+swapLine"):cm.replaceRange("",Pos(from,0),Pos(from+1,0),"+swapLine"),cm.replaceRange(line+"\n",Pos(to,0),null,"+swapLine")}cm.scrollIntoView()})},cmds[map[ctrl+"/"]="toggleCommentIndented"]=function(cm){cm.toggleComment({indent:!0})},cmds[map[ctrl+"J"]="joinLines"]=function(cm){for(var ranges=cm.listSelections(),joined=[],i=0;i<ranges.length;i++){for(var range=ranges[i],from=range.from(),start=from.line,end=range.to().line;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(){for(var offset=0,ranges=[],i=0;i<joined.length;i++){for(var head,obj=joined[i],anchor=obj.anchor&&Pos(obj.anchor.line-offset,obj.anchor.ch),line=obj.start;line<=obj.end;line++){var actual=line-offset;line==obj.end&&(head=Pos(actual,cm.getLine(actual).length+1)),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[map["Shift-"+ctrl+"D"]="duplicateLine"]=function(cm){cm.operation(function(){for(var rangeCount=cm.listSelections().length,i=0;i<rangeCount;i++){var range=cm.listSelections()[i];range.empty()?cm.replaceRange(cm.getLine(range.head.line)+"\n",Pos(range.head.line,0)):cm.replaceRange(cm.getRange(range.from(),range.to()),range.from())}cm.scrollIntoView()})},mac||(map[ctrl+"T"]="transposeChars"),cmds[map.F9="sortLines"]=function(cm){sortLines(cm,!0)},cmds[map[ctrl+"F9"]="sortLinesInsensitive"]=function(cm){sortLines(cm,!1)},cmds[map.F2="nextBookmark"]=function(cm){var marks=cm.state.sublimeBookmarks;if(marks)for(;marks.length;){var current=marks.shift(),found=current.find();if(found)return marks.push(current),cm.setSelection(found.from,found.to)}},cmds[map["Shift-F2"]="prevBookmark"]=function(cm){var marks=cm.state.sublimeBookmarks;if(marks)for(;marks.length;){marks.unshift(marks.pop());var found=marks[marks.length-1].find();if(found)return cm.setSelection(found.from,found.to);marks.pop()}},cmds[map[ctrl+"F2"]="toggleBookmark"]=function(cm){for(var ranges=cm.listSelections(),marks=cm.state.sublimeBookmarks||(cm.state.sublimeBookmarks=[]),i=0;i<ranges.length;i++){for(var from=ranges[i].from(),to=ranges[i].to(),found=cm.findMarks(from,to),j=0;j<found.length;j++)if(found[j].sublimeBookmark){found[j].clear();for(var k=0;k<marks.length;k++)marks[k]==found[j]&&marks.splice(k--,1);break}j==found.length&&marks.push(cm.markText(from,to,{sublimeBookmark:!0,clearWhenEmpty:!1}))}},cmds[map["Shift-"+ctrl+"F2"]="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[map["Alt-F2"]="selectBookmarks"]=function(cm){var marks=cm.state.sublimeBookmarks,ranges=[];if(marks)for(var i=0;i<marks.length;i++){var found=marks[i].find();found?ranges.push({anchor:found.from,head:found.to}):marks.splice(i--,0)}ranges.length&&cm.setSelections(ranges,0)},map["Alt-Q"]="wrapLines";var cK=ctrl+"K ";map[cK+ctrl+"Backspace"]="delLineLeft",cmds[map.Backspace="smartBackspace"]=function(cm){if(cm.somethingSelected())return CodeMirror.Pass;cm.operation(function(){for(var cursors=cm.listSelections(),indentUnit=cm.getOption("indentUnit"),i=cursors.length-1;i>=0;i--){var cursor=cursors[i].head,toStartOfLine=cm.getRange({line:cursor.line,ch:0},cursor),column=CodeMirror.countColumn(toStartOfLine,null,cm.getOption("tabSize")),deletePos=cm.findPosH(cursor,-1,"char",!1);if(toStartOfLine&&!/\S/.test(toStartOfLine)&&column%indentUnit==0){var prevIndent=new Pos(cursor.line,CodeMirror.findColumn(toStartOfLine,column-indentUnit,indentUnit));prevIndent.ch!=cursor.ch&&(deletePos=prevIndent)}cm.replaceRange("",deletePos,cursor,"+delete")}})},cmds[map[cK+ctrl+"K"]="delLineRight"]=function(cm){cm.operation(function(){for(var ranges=cm.listSelections(),i=ranges.length-1;i>=0;i--)cm.replaceRange("",ranges[i].anchor,Pos(ranges[i].to().line),"+delete");cm.scrollIntoView()})},cmds[map[cK+ctrl+"U"]="upcaseAtCursor"]=function(cm){modifyWordOrSelection(cm,function(str){return str.toUpperCase()})},cmds[map[cK+ctrl+"L"]="downcaseAtCursor"]=function(cm){modifyWordOrSelection(cm,function(str){return str.toLowerCase()})},cmds[map[cK+ctrl+"Space"]="setSublimeMark"]=function(cm){cm.state.sublimeMark&&cm.state.sublimeMark.clear(),cm.state.sublimeMark=cm.setBookmark(cm.getCursor())},cmds[map[cK+ctrl+"A"]="selectToSublimeMark"]=function(cm){var found=cm.state.sublimeMark&&cm.state.sublimeMark.find();found&&cm.setSelection(cm.getCursor(),found)},cmds[map[cK+ctrl+"W"]="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[map[cK+ctrl+"X"]="swapWithSublimeMark"]=function(cm){var found=cm.state.sublimeMark&&cm.state.sublimeMark.find();found&&(cm.state.sublimeMark.clear(),cm.state.sublimeMark=cm.setBookmark(cm.getCursor()),cm.setCursor(found))},cmds[map[cK+ctrl+"Y"]="sublimeYank"]=function(cm){null!=cm.state.sublimeKilled&&cm.replaceSelection(cm.state.sublimeKilled,null,"paste")},map[cK+ctrl+"G"]="clearBookmarks",cmds[map[cK+ctrl+"C"]="showInCenter"]=function(cm){var pos=cm.cursorCoords(null,"local");cm.scrollTo(null,(pos.top+pos.bottom)/2-cm.getScrollInfo().clientHeight/2)};var selectLinesCombo=mac?"Ctrl-Shift-":"Ctrl-Alt-";cmds[map[selectLinesCombo+"Up"]="selectLinesUpward"]=function(cm){cm.operation(function(){for(var ranges=cm.listSelections(),i=0;i<ranges.length;i++){var range=ranges[i];range.head.line>cm.firstLine()&&cm.addSelection(Pos(range.head.line-1,range.head.ch))}})},cmds[map[selectLinesCombo+"Down"]="selectLinesDownward"]=function(cm){cm.operation(function(){for(var ranges=cm.listSelections(),i=0;i<ranges.length;i++){var range=ranges[i];range.head.line<cm.lastLine()&&cm.addSelection(Pos(range.head.line+1,range.head.ch))}})},cmds[map[ctrl+"F3"]="findUnder"]=function(cm){findAndGoTo(cm,!0)},cmds[map["Shift-"+ctrl+"F3"]="findUnderPrevious"]=function(cm){findAndGoTo(cm,!1)},cmds[map["Alt-F3"]="findAllUnder"]=function(cm){var target=getTarget(cm);if(target){for(var cur=cm.getSearchCursor(target.query),matches=[],primaryIndex=-1;cur.findNext();)matches.push({anchor:cur.from(),head:cur.to()}),cur.from().line<=target.from.line&&cur.from().ch<=target.from.ch&&primaryIndex++;cm.setSelections(matches,primaryIndex)}},map["Shift-"+ctrl+"["]="fold",map["Shift-"+ctrl+"]"]="unfold",map[cK+ctrl+"0"]=map[cK+ctrl+"J"]="unfoldAll",map[ctrl+"I"]="findIncremental",map["Shift-"+ctrl+"I"]="findIncrementalReverse",map[ctrl+"H"]="replace",map.F3="findNext",map["Shift-F3"]="findPrev",CodeMirror.normalizeKeyMap(map)})},{"../addon/edit/matchbrackets":74,"../addon/search/searchcursor":82,"../lib/codemirror":84}],84:[function(require,module,exports){!function(global,factory){"object"==typeof exports&&void 0!==module?module.exports=factory():global.CodeMirror=factory()}(this,function(){"use strict";function classTest(cls){return new RegExp("(^|\\s)"+cls+"(?:$|\\s)\\s*")}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),style&&(e.style.cssText=style),"string"==typeof content)e.appendChild(document.createTextNode(content));else if(content)for(var i=0;i<content.length;++i)e.appendChild(content[i]);return e}function eltP(tag,content,className,style){var e=elt(tag,content,className,style);return e.setAttribute("role","presentation"),e}function contains(parent,child){if(3==child.nodeType&&(child=child.parentNode),parent.contains)return parent.contains(child);do{if(11==child.nodeType&&(child=child.host),child==parent)return!0}while(child=child.parentNode)}function activeElt(){var activeElement;try{activeElement=document.activeElement}catch(e){activeElement=document.body||null}for(;activeElement&&activeElement.shadowRoot&&activeElement.shadowRoot.activeElement;)activeElement=activeElement.shadowRoot.activeElement;return activeElement}function addClass(node,cls){var current=node.className;classTest(cls).test(current)||(node.className+=(current?" ":"")+cls)}function joinClasses(a,b){for(var as=a.split(" "),i=0;i<as.length;i++)as[i]&&!classTest(as[i]).test(b)&&(b+=" "+as[i]);return b}function bind(f){var args=Array.prototype.slice.call(arguments,1);return function(){return f.apply(null,args)}}function copyObj(obj,target,overwrite){target||(target={});for(var prop in obj)!obj.hasOwnProperty(prop)||!1===overwrite&&target.hasOwnProperty(prop)||(target[prop]=obj[prop]);return target}function countColumn(string,end,tabSize,startIndex,startValue){null==end&&-1==(end=string.search(/[^\s\u00a0]/))&&(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 indexOf(array,elt){for(var i=0;i<array.length;++i)if(array[i]==elt)return i;return-1}function findColumn(string,goal,tabSize){for(var pos=0,col=0;;){var nextTab=string.indexOf("\t",pos);-1==nextTab&&(nextTab=string.length);var skipped=nextTab-pos;if(nextTab==string.length||col+skipped>=goal)return pos+Math.min(skipped,goal-col);if(col+=nextTab-pos,col+=tabSize-col%tabSize,pos=nextTab+1,col>=goal)return pos}}function spaceStr(n){for(;spaceStrs.length<=n;)spaceStrs.push(lst(spaceStrs)+" ");return spaceStrs[n]}function lst(arr){return arr[arr.length-1]}function map(array,f){for(var out=[],i=0;i<array.length;i++)out[i]=f(array[i],i);return out}function insertSorted(array,value,score){for(var pos=0,priority=score(value);pos<array.length&&score(array[pos])<=priority;)pos++;array.splice(pos,0,value)}function nothing(){}function createObj(base,props){var inst;return Object.create?inst=Object.create(base):(nothing.prototype=base,inst=new nothing),props&&copyObj(props,inst),inst}function isWordCharBasic(ch){return/\w/.test(ch)||ch>"€"&&(ch.toUpperCase()!=ch.toLowerCase()||nonASCIISingleCaseWordChar.test(ch))}function isWordChar(ch,helper){return helper?!!(helper.source.indexOf("\\w")>-1&&isWordCharBasic(ch))||helper.test(ch):isWordCharBasic(ch)}function isEmpty(obj){for(var n in obj)if(obj.hasOwnProperty(n)&&obj[n])return!1;return!0}function isExtendingChar(ch){return ch.charCodeAt(0)>=768&&extendingChars.test(ch)}function skipExtendingChars(str,pos,dir){for(;(dir<0?pos>0:pos<str.length)&&isExtendingChar(str.charAt(pos));)pos+=dir;return pos}function findFirst(pred,from,to){for(;;){if(Math.abs(from-to)<=1)return pred(from)?from:to;var mid=Math.floor((from+to)/2);pred(mid)?to=mid:from=mid}}function Display(place,doc,input){var d=this;this.input=input,d.scrollbarFiller=elt("div",null,"CodeMirror-scrollbar-filler"),d.scrollbarFiller.setAttribute("cm-not-content","true"),d.gutterFiller=elt("div",null,"CodeMirror-gutter-filler"),d.gutterFiller.setAttribute("cm-not-content","true"),d.lineDiv=eltP("div",null,"CodeMirror-code"),d.selectionDiv=elt("div",null,null,"position: relative; z-index: 1"),d.cursorDiv=elt("div",null,"CodeMirror-cursors"),d.measure=elt("div",null,"CodeMirror-measure"),d.lineMeasure=elt("div",null,"CodeMirror-measure"),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");d.mover=elt("div",[lines],null,"position: relative"),d.sizer=elt("div",[d.mover],"CodeMirror-sizer"),d.sizerWidth=null,d.heightForcer=elt("div",null,null,"position: absolute; height: "+scrollerGap+"px; width: 1px;"),d.gutters=elt("div",null,"CodeMirror-gutters"),d.lineGutter=null,d.scroller=elt("div",[d.sizer,d.heightForcer,d.gutters],"CodeMirror-scroll"),d.scroller.setAttribute("tabIndex","-1"),d.wrapper=elt("div",[d.scrollbarFiller,d.gutterFiller,d.scroller],"CodeMirror"),ie&&ie_version<8&&(d.gutters.style.zIndex=-1,d.scroller.style.paddingRight=0),webkit||gecko&&mobile||(d.scroller.draggable=!0),place&&(place.appendChild?place.appendChild(d.wrapper):place(d.wrapper)),d.viewFrom=d.viewTo=doc.first,d.reportedViewFrom=d.reportedViewTo=doc.first,d.view=[],d.renderedView=null,d.externalMeasured=null,d.viewOffset=0,d.lastWrapHeight=d.lastWrapWidth=0,d.updateLineNumbers=null,d.nativeBarWidth=d.barHeight=d.barWidth=0,d.scrollbarsClipped=!1,d.lineNumWidth=d.lineNumInnerWidth=d.lineNumChars=null,d.alignWidgets=!1,d.cachedCharWidth=d.cachedTextHeight=d.cachedPaddingH=null,d.maxLine=null,d.maxLineLength=0,d.maxLineChanged=!1,d.wheelDX=d.wheelDY=d.wheelStartX=d.wheelStartY=null,d.shift=!1,d.selForContextMenu=null,d.activeTouch=null,input.init(d)}function getLine(doc,n){if((n-=doc.first)<0||n>=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<sz){chunk=child;break}n-=sz}return chunk.lines[n]}function getBetween(doc,start,end){var out=[],n=start.line;return doc.iter(start.line,end.line+1,function(line){var text=line.text;n==end.line&&(text=text.slice(0,end.ch)),n==start.line&&(text=text.slice(start.ch)),out.push(text),++n}),out}function getLines(doc,from,to){var out=[];return doc.iter(from,to,function(line){out.push(line.text)}),out}function updateLineHeight(line,height){var diff=height-line.height;if(diff)for(var n=line;n;n=n.parent)n.height+=diff}function lineNo(line){if(null==line.parent)return null;for(var cur=line.parent,no=indexOf(cur.lines,line),chunk=cur.parent;chunk;cur=chunk,chunk=chunk.parent)for(var i=0;chunk.children[i]!=cur;++i)no+=chunk.children[i].chunkSize();return no+cur.first}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);for(var i=0;i<chunk.lines.length;++i){var lh=chunk.lines[i].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))}function Pos(line,ch,sticky){if(void 0===sticky&&(sticky=null),!(this instanceof Pos))return new Pos(line,ch,sticky);this.line=line,this.ch=ch,this.sticky=sticky}function cmp(a,b){return a.line-b.line||a.ch-b.ch}function equalCursorPos(a,b){return a.sticky==b.sticky&&0==cmp(a,b)}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}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;return pos.line>last?Pos(last,getLine(doc,last).text.length):clipToLen(pos,getLine(doc,pos.line).text.length)}function clipToLen(pos,linelen){var ch=pos.ch;return null==ch||ch>linelen?Pos(pos.line,linelen):ch<0?Pos(pos.line,0):pos}function clipPosArray(doc,array){for(var out=[],i=0;i<array.length;i++)out[i]=clipPos(doc,array[i]);return out}function seeReadOnlySpans(){sawReadOnlySpans=!0}function seeCollapsedSpans(){sawCollapsedSpans=!0}function MarkedSpan(marker,from,to){this.marker=marker,this.from=from,this.to=to}function getMarkedSpanFor(spans,marker){if(spans)for(var i=0;i<spans.length;++i){var span=spans[i];if(span.marker==marker)return span}}function removeMarkedSpan(spans,span){for(var r,i=0;i<spans.length;++i)spans[i]!=span&&(r||(r=[])).push(spans[i]);return r}function addMarkedSpan(line,span){line.markedSpans=line.markedSpans?line.markedSpans.concat([span]):[span],span.marker.attachLine(line)}function markedSpansBefore(old,startCh,isInsert){var nw;if(old)for(var i=0;i<old.length;++i){var span=old[i],marker=span.marker;if(null==span.from||(marker.inclusiveLeft?span.from<=startCh:span.from<startCh)||span.from==startCh&&"bookmark"==marker.type&&(!isInsert||!span.marker.insertLeft)){var endsAfter=null==span.to||(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;if(null==span.to||(marker.inclusiveRight?span.to>=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.from<endCh);(nw||(nw=[])).push(new MarkedSpan(marker,startsBefore?null:span.from-endCh,null==span.to?null:span.to-endCh))}}return nw}function stretchSpansOverChange(doc,change){if(change.full)return null;var oldFirst=isLine(doc,change.from.line)&&getLine(doc,change.from.line).markedSpans,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=0==cmp(change.from,change.to),first=markedSpansBefore(oldFirst,startCh,isInsert),last=markedSpansAfter(oldLast,endCh,isInsert),sameLine=1==change.text.length,offset=lst(change.text).length+(sameLine?startCh:0);if(first)for(var i=0;i<first.length;++i){var span=first[i];if(null==span.to){var found=getMarkedSpanFor(last,span.marker);found?sameLine&&(span.to=null==found.to?null:found.to+offset):span.to=startCh}}if(last)for(var i$1=0;i$1<last.length;++i$1){var span$1=last[i$1];null!=span$1.to&&(span$1.to+=offset),null==span$1.from?getMarkedSpanFor(first,span$1.marker)||(span$1.from=offset,sameLine&&(first||(first=[])).push(span$1)):(span$1.from+=offset,sameLine&&(first||(first=[])).push(span$1))}first&&(first=clearEmptySpans(first)),last&&last!=first&&(last=clearEmptySpans(last));var newMarkers=[first];if(!sameLine){var gapMarkers,gap=change.text.length-2;if(gap>0&&first)for(var i$2=0;i$2<first.length;++i$2)null==first[i$2].to&&(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}function clearEmptySpans(spans){for(var i=0;i<spans.length;++i){var span=spans[i];null!=span.from&&span.from==span.to&&!1!==span.marker.clearWhenEmpty&&spans.splice(i--,1)}return spans.length?spans:null}function removeReadOnlyRanges(doc,from,to){var markers=null;if(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;!mark.readOnly||markers&&-1!=indexOf(markers,mark)||(markers||(markers=[])).push(mark)}}),!markers)return null;for(var parts=[{from:from,to:to}],i=0;i<markers.length;++i)for(var mk=markers[i],m=mk.find(0),j=0;j<parts.length;++j){var p=parts[j];if(!(cmp(p.to,m.from)<0||cmp(p.from,m.to)>0)){var newParts=[j,1],dfrom=cmp(p.from,m.from),dto=cmp(p.to,m.to);(dfrom<0||!mk.inclusiveLeft&&!dfrom)&&newParts.push({from:p.from,to:m.from}),(dto>0||!mk.inclusiveRight&&!dto)&&newParts.push({from:m.to,to:p.to}),parts.splice.apply(parts,newParts),j+=newParts.length-3}}return parts}function detachMarkedSpans(line){var spans=line.markedSpans;if(spans){for(var i=0;i<spans.length;++i)spans[i].marker.detachLine(line);line.markedSpans=null}}function attachMarkedSpans(line,spans){if(spans){for(var i=0;i<spans.length;++i)spans[i].marker.attachLine(line);line.markedSpans=spans}}function extraLeft(marker){return marker.inclusiveLeft?-1:0}function extraRight(marker){return marker.inclusiveRight?1:0}function compareCollapsedMarkers(a,b){var lenDiff=a.lines.length-b.lines.length;if(0!=lenDiff)return lenDiff;var aPos=a.find(),bPos=b.find(),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);return toCmp||b.id-a.id}function collapsedSpanAtSide(line,start){var found,sps=sawCollapsedSpans&&line.markedSpans;if(sps)for(var sp=void 0,i=0;i<sps.length;++i)(sp=sps[i]).marker.collapsed&&null==(start?sp.from:sp.to)&&(!found||compareCollapsedMarkers(found,sp.marker)<0)&&(found=sp.marker);return found}function collapsedSpanAtStart(line){return collapsedSpanAtSide(line,!0)}function collapsedSpanAtEnd(line){return collapsedSpanAtSide(line,!1)}function conflictingCollapsedRange(doc,lineNo$$1,from,to,marker){var line=getLine(doc,lineNo$$1),sps=sawCollapsedSpans&&line.markedSpans;if(sps)for(var i=0;i<sps.length;++i){var sp=sps[i];if(sp.marker.collapsed){var found=sp.marker.find(0),fromCmp=cmp(found.from,from)||extraLeft(sp.marker)-extraLeft(marker),toCmp=cmp(found.to,to)||extraRight(sp.marker)-extraRight(marker);if(!(fromCmp>=0&&toCmp<=0||fromCmp<=0&&toCmp>=0)&&(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!0}}}function visualLine(line){for(var merged;merged=collapsedSpanAtStart(line);)line=merged.find(-1,!0).line;return line}function visualLineEnd(line){for(var merged;merged=collapsedSpanAtEnd(line);)line=merged.find(1,!0).line;return line}function visualLineContinued(line){for(var merged,lines;merged=collapsedSpanAtEnd(line);)line=merged.find(1,!0).line,(lines||(lines=[])).push(line);return lines}function visualLineNo(doc,lineN){var line=getLine(doc,lineN),vis=visualLine(line);return line==vis?lineN:lineNo(vis)}function visualLineEndNo(doc,lineN){if(lineN>doc.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;i<sps.length;++i)if((sp=sps[i]).marker.collapsed){if(null==sp.from)return!0;if(!sp.marker.widgetNode&&0==sp.from&&sp.marker.inclusiveLeft&&lineIsHiddenInner(doc,line,sp))return!0}}function lineIsHiddenInner(doc,line,span){if(null==span.to){var end=span.marker.find(1,!0);return lineIsHiddenInner(doc,end.line,getMarkedSpanFor(end.line.markedSpans,span.marker))}if(span.marker.inclusiveRight&&span.to==line.text.length)return!0;for(var sp=void 0,i=0;i<line.markedSpans.length;++i)if((sp=line.markedSpans[i]).marker.collapsed&&!sp.marker.widgetNode&&sp.from==span.to&&(null==sp.to||sp.to!=span.from)&&(sp.marker.inclusiveLeft||span.marker.inclusiveRight)&&lineIsHiddenInner(doc,line,sp))return!0}function heightAtLine(lineObj){for(var h=0,chunk=(lineObj=visualLine(lineObj)).parent,i=0;i<chunk.lines.length;++i){var line=chunk.lines[i];if(line==lineObj)break;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;h+=cur.height}return h}function lineLength(line){if(0==line.height)return 0;for(var merged,len=line.text.length,cur=line;merged=collapsedSpanAtStart(cur);){var found=merged.find(0,!0);cur=found.from.line,len+=found.from.ch-found.to.ch}for(cur=line;merged=collapsedSpanAtEnd(cur);){var found$1=merged.find(0,!0);len-=cur.text.length-found$1.from.ch,len+=(cur=found$1.to.line).text.length-found$1.to.ch}return len}function findMaxLine(cm){var d=cm.display,doc=cm.doc;d.maxLine=getLine(doc,doc.first),d.maxLineLength=lineLength(d.maxLine),d.maxLineChanged=!0,doc.iter(function(line){var len=lineLength(line);len>d.maxLineLength&&(d.maxLineLength=len,d.maxLine=line)})}function iterateBidiSections(order,from,to,f){if(!order)return f(from,to,"ltr");for(var found=!1,i=0;i<order.length;++i){var part=order[i];(part.from<to&&part.to>from||from==to&&part.to==from)&&(f(Math.max(part.from,from),Math.min(part.to,to),1==part.level?"rtl":"ltr"),found=!0)}found||f(from,to,"ltr")}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;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}function getOrder(line,direction){var order=line.order;return null==order&&(order=line.order=bidiOrdering(line.text,direction)),order}function moveCharLogically(line,ch,dir){var target=skipExtendingChars(line.text,ch+dir,dir);return target<0||target>line.text.length?null:target}function moveLogically(line,start,dir){var ch=moveCharLogically(line,start.ch,dir);return null==ch?null:new Pos(start.line,ch,dir<0?"after":"before")}function endOfLine(visually,cm,lineObj,lineNo,dir){if(visually){var order=getOrder(lineObj,cm.doc.direction);if(order){var ch,part=dir<0?lst(order):order[0],sticky=dir<0==(1==part.level)?"after":"before";if(part.level>0){var prep=prepareMeasureForLine(cm,lineObj);ch=dir<0?lineObj.text.length-1:0;var targetTop=measureCharPrepared(cm,prep,ch).top;ch=findFirst(function(ch){return measureCharPrepared(cm,prep,ch).top==targetTop},dir<0==(1==part.level)?part.from:part.to-1,ch),"before"==sticky&&(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);start.ch>=line.text.length?(start.ch=line.text.length,start.sticky="before"):start.ch<=0&&(start.ch=0,start.sticky="after");var partPos=getBidiPartAt(bidi,start.ch,start.sticky),part=bidi[partPos];if("ltr"==cm.doc.direction&&part.level%2==0&&(dir>0?part.to>start.ch:part.from<start.ch))return moveLogically(line,start,dir);var prep,mv=function(pos,dir){return moveCharLogically(line,pos instanceof Pos?pos.ch:pos,dir)},getWrappedLineExtent=function(ch){return cm.options.lineWrapping?(prep=prep||prepareMeasureForLine(cm,line),wrappedLineExtentChar(cm,line,prep,ch)):{begin:0,end:line.text.length}},wrappedLineExtent=getWrappedLineExtent("before"==start.sticky?mv(start,-1):start.ch);if("rtl"==cm.doc.direction||1==part.level){var moveInStorageOrder=1==part.level==dir<0,ch=mv(start,moveInStorageOrder?1:-1);if(null!=ch&&(moveInStorageOrder?ch<=part.to&&ch<=wrappedLineExtent.end:ch>=part.from&&ch>=wrappedLineExtent.begin)){var sticky=moveInStorageOrder?"before":"after";return new Pos(start.line,ch,sticky)}}var searchInVisualLine=function(partPos,dir,wrappedLineExtent){for(var getRes=function(ch,moveInStorageOrder){return moveInStorageOrder?new Pos(start.line,mv(ch,1),"before"):new Pos(start.line,ch,"after")};partPos>=0&&partPos<bidi.length;partPos+=dir){var part=bidi[partPos],moveInStorageOrder=dir>0==(1!=part.level),ch=moveInStorageOrder?wrappedLineExtent.begin:mv(wrappedLineExtent.end,-1);if(part.from<=ch&&ch<part.to)return getRes(ch,moveInStorageOrder);if(ch=moveInStorageOrder?part.from:mv(part.to,-1),wrappedLineExtent.begin<=ch&&ch<wrappedLineExtent.end)return getRes(ch,moveInStorageOrder)}},res=searchInVisualLine(partPos+dir,dir,wrappedLineExtent);if(res)return res;var nextCh=dir>0?wrappedLineExtent.end:mv(wrappedLineExtent.begin,-1);return null==nextCh||dir>0&&nextCh==line.text.length||!(res=searchInVisualLine(dir>0?0:bidi.length-1,dir,getWrappedLineExtent(nextCh)))?null:res}function getHandlers(emitter,type){return emitter._handlers&&emitter._handlers[type]||noHandlers}function off(emitter,type,f){if(emitter.removeEventListener)emitter.removeEventListener(type,f,!1);else if(emitter.detachEvent)emitter.detachEvent("on"+type,f);else{var map$$1=emitter._handlers,arr=map$$1&&map$$1[type];if(arr){var index=indexOf(arr,f);index>-1&&(map$$1[type]=arr.slice(0,index).concat(arr.slice(index+1)))}}}function signal(emitter,type){var handlers=getHandlers(emitter,type);if(handlers.length)for(var args=Array.prototype.slice.call(arguments,2),i=0;i<handlers.length;++i)handlers[i].apply(null,args)}function signalDOMEvent(cm,e,override){return"string"==typeof e&&(e={type:e,preventDefault:function(){this.defaultPrevented=!0}}),signal(cm,override||e.type,cm,e),e_defaultPrevented(e)||e.codemirrorIgnore}function signalCursorActivity(cm){var arr=cm._handlers&&cm._handlers.cursorActivity;if(arr)for(var set=cm.curOp.cursorActivityHandlers||(cm.curOp.cursorActivityHandlers=[]),i=0;i<arr.length;++i)-1==indexOf(set,arr[i])&&set.push(arr[i])}function hasHandler(emitter,type){return getHandlers(emitter,type).length>0}function eventMixin(ctor){ctor.prototype.on=function(type,f){on(this,type,f)},ctor.prototype.off=function(type,f){off(this,type,f)}}function e_preventDefault(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function e_stopPropagation(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function e_defaultPrevented(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}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;return null==b&&(1&e.button?b=1:2&e.button?b=3:4&e.button&&(b=2)),mac&&e.ctrlKey&&1==b&&(b=3),b}function zeroWidthElement(measure){if(null==zwspSupported){var test=elt("span","​");removeChildrenAndAdd(measure,elt("span",[test,document.createTextNode("x")])),0!=measure.firstChild.offsetHeight&&(zwspSupported=test.offsetWidth<=1&&test.offsetHeight>2&&!(ie&&ie_version<8))}var node=zwspSupported?elt("span","​"):elt("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return node.setAttribute("cm-text",""),node}function hasBadBidiRects(measure){if(null!=badBidiRects)return badBidiRects;var txt=removeChildrenAndAdd(measure,document.createTextNode("AخA")),r0=range(txt,0,1).getBoundingClientRect(),r1=range(txt,1,2).getBoundingClientRect();return removeChildren(measure),!(!r0||r0.left==r0.right)&&(badBidiRects=r1.right-r0.right<3)}function hasBadZoomedRects(measure){if(null!=badZoomedRects)return badZoomedRects;var node=removeChildrenAndAdd(measure,elt("span","x")),normal=node.getBoundingClientRect(),fromRange=range(node,0,1).getBoundingClientRect();return badZoomedRects=Math.abs(normal.left-fromRange.left)>1}function defineMode(name,mode){arguments.length>2&&(mode.dependencies=Array.prototype.slice.call(arguments,2)),modes[name]=mode}function resolveMode(spec){if("string"==typeof spec&&mimeModes.hasOwnProperty(spec))spec=mimeModes[spec];else if(spec&&"string"==typeof spec.name&&mimeModes.hasOwnProperty(spec.name)){var found=mimeModes[spec.name];"string"==typeof found&&(found={name:found}),(spec=createObj(found,spec)).name=found.name}else{if("string"==typeof spec&&/^[\w\-]+\/[\w\-]+\+xml$/.test(spec))return resolveMode("application/xml");if("string"==typeof spec&&/^[\w\-]+\/[\w\-]+\+json$/.test(spec))return resolveMode("application/json")}return"string"==typeof spec?{name:spec}:spec||{name:"null"}}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)exts.hasOwnProperty(prop)&&(modeObj.hasOwnProperty(prop)&&(modeObj["_"+prop]=modeObj[prop]),modeObj[prop]=exts[prop])}if(modeObj.name=spec.name,spec.helperType&&(modeObj.helperType=spec.helperType),spec.modeProps)for(var prop$1 in spec.modeProps)modeObj[prop$1]=spec.modeProps[prop$1];return modeObj}function extendMode(mode,properties){copyObj(properties,modeExtensions.hasOwnProperty(mode)?modeExtensions[mode]:modeExtensions[mode]={})}function copyState(mode,state){if(!0===state)return state;if(mode.copyState)return mode.copyState(state);var nstate={};for(var n in state){var val=state[n];val instanceof Array&&(val=val.concat([])),nstate[n]=val}return nstate}function innerMode(mode,state){for(var info;mode.innerMode&&(info=mode.innerMode(state))&&info.mode!=mode;)state=info.state,mode=info.mode;return info||{mode:mode,state:state}}function startState(mode,a1,a2){return!mode.startState||mode.startState(a1,a2)}function highlightLine(cm,line,context,forceToEnd){var st=[cm.state.modeGen],lineClasses={};runMode(cm,line.text,cm.doc.mode,context,function(end,style){return st.push(end,style)},lineClasses,forceToEnd);for(var state=context.state,o=0;o<cm.state.overlays.length;++o)!function(o){var overlay=cm.state.overlays[o],i=1,at=0;context.state=!0,runMode(cm,line.text,overlay.mode,context,function(end,style){for(var start=i;at<end;){var i_end=st[i];i_end>end&&st.splice(i,1,end,st[i+1],i_end),i+=2,at=Math.min(end,i_end)}if(style)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)}(o);return context.state=state,{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)),resetState=line.text.length>cm.options.maxHighlightLength&&copyState(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=findStartLine(cm,n,precise),saved=start>doc.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&&pos<display.viewTo?context.save():null,context.nextLine()}),precise&&(doc.modeFrontier=context.line),context}function processLine(cm,text,context,startAt){var mode=cm.doc.mode,stream=new StringStream(text,cm.options.tabSize,context);for(stream.start=stream.pos=startAt||0,""==text&&callBlankLine(mode,context.state);!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){var inner=innerMode(mode,state);return inner.mode.blankLine?inner.mode.blankLine(inner.state):void 0}}function readToken(mode,stream,state,inner){for(var i=0;i<10;i++){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.")}function takeToken(cm,pos,precise,asArray){var style,tokens,doc=cm.doc,mode=doc.mode,line=getLine(doc,(pos=clipPos(doc,pos)).line),context=getContextBefore(cm,pos.line,precise),stream=new StringStream(line.text,cm.options.tabSize,context);for(asArray&&(tokens=[]);(asArray||stream.pos<pos.ch)&&!stream.eol();)stream.start=stream.pos,style=readToken(mode,stream,context.state),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";null==output[prop]?output[prop]=lineClass[2]:new RegExp("(?:^|s)"+lineClass[2]+"(?:$|s)").test(output[prop])||(output[prop]+=" "+lineClass[2])}return type}function runMode(cm,text,mode,context,f,lineClasses,forceToEnd){var flattenSpans=mode.flattenSpans;null==flattenSpans&&(flattenSpans=cm.options.flattenSpans);var style,curStart=0,curStyle=null,stream=new StringStream(text,cm.options.tabSize,context),inner=cm.options.addModeClass&&[null];for(""==text&&extractLineClasses(callBlankLine(mode,context.state),lineClasses);!stream.eol();){if(stream.pos>cm.options.maxHighlightLength?(flattenSpans=!1,forceToEnd&&processLine(cm,text,context,stream.pos),stream.pos=text.length,style=null):style=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<stream.start;)f(curStart=Math.min(stream.start,curStart+5e3),curStyle);curStyle=style}stream.start=stream.pos}for(;curStart<stream.pos;){var pos=Math.min(stream.pos,curStart+5e3);f(pos,curStyle),curStart=pos}}function findStartLine(cm,n,precise){for(var minindent,minline,doc=cm.doc,lim=precise?-1:n-(cm.doc.mode.innerMode?1e3:100),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);(null==minline||minindent>indented)&&(minline=search-1,minindent=indented)}return minline}function retreatFrontier(doc,n){if(doc.modeFrontier=Math.min(doc.modeFrontier,n),!(doc.highlightFrontier<n-10)){for(var start=doc.first,line=n-1;line>start;line--){var saved=getLine(doc,line).stateAfter;if(saved&&(!(saved instanceof SavedContext)||line+saved.lookAhead<n)){start=line+1;break}}doc.highlightFrontier=Math.min(doc.highlightFrontier,start)}}function updateLine(line,text,markedSpans,estimateHeight){line.text=text,line.stateAfter&&(line.stateAfter=null),line.styles&&(line.styles=null),null!=line.order&&(line.order=null),detachMarkedSpans(line),attachMarkedSpans(line,markedSpans);var estHeight=estimateHeight?estimateHeight(line):1;estHeight!=line.height&&updateLineHeight(line,estHeight)}function cleanUpLine(line){line.parent=null,detachMarkedSpans(line)}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:(ie||webkit)&&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,title,css){if(text){var content,displayText=builder.splitSpaces?splitSpaces(text,builder.trailingSpace):text,special=builder.cm.state.specialChars,mustWrap=!1;if(special.test(text)){content=document.createDocumentFragment();for(var pos=0;;){special.lastIndex=pos;var m=special.exec(text),skipped=m?m.index-pos:text.length-pos;if(skipped){var txt=document.createTextNode(displayText.slice(pos,pos+skipped));ie&&ie_version<9?content.appendChild(elt("span",[txt])):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("\t"==m[0]){var tabSize=builder.cm.options.tabSize,tabWidth=tabSize-builder.col%tabSize;(txt$1=content.appendChild(elt("span",spaceStr(tabWidth),"cm-tab"))).setAttribute("role","presentation"),txt$1.setAttribute("cm-text","\t"),builder.col+=tabWidth}else"\r"==m[0]||"\n"==m[0]?((txt$1=content.appendChild(elt("span","\r"==m[0]?"␍":"␤","cm-invalidchar"))).setAttribute("cm-text",m[0]),builder.col+=1):((txt$1=builder.cm.options.specialCharPlaceholder(m[0])).setAttribute("cm-text",m[0]),ie&&ie_version<9?content.appendChild(elt("span",[txt$1])):content.appendChild(txt$1),builder.col+=1);builder.map.push(builder.pos,builder.pos+1,txt$1),builder.pos++}}else builder.col+=text.length,content=document.createTextNode(displayText),builder.map.push(builder.pos,builder.pos+text.length,content),ie&&ie_version<9&&(mustWrap=!0),builder.pos+=text.length;if(builder.trailingSpace=32==displayText.charCodeAt(text.length-1),style||startStyle||endStyle||mustWrap||css){var fullStyle=style||"";startStyle&&(fullStyle+=startStyle),endStyle&&(fullStyle+=endStyle);var token=elt("span",[content],fullStyle,css);return title&&(token.title=title),builder.content.appendChild(token)}builder.content.appendChild(content)}}function splitSpaces(text,trailingBefore){if(text.length>1&&!/ /.test(text))return text;for(var spaceBefore=trailingBefore,result="",i=0;i<text.length;i++){var ch=text.charAt(i);" "!=ch||!spaceBefore||i!=text.length-1&&32!=text.charCodeAt(i+1)||(ch=" "),result+=ch,spaceBefore=" "==ch}return result}function buildTokenBadBidi(inner,order){return function(builder,text,style,startStyle,endStyle,title,css){style=style?style+" cm-force-border":"cm-force-border";for(var start=builder.pos,end=start+text.length;;){for(var part=void 0,i=0;i<order.length&&!((part=order[i]).to>start&&part.from<=start);i++);if(part.to>=end)return inner(builder,text,style,startStyle,endStyle,title,css);inner(builder,text.slice(0,part.to-start),style,startStyle,null,title,css),startStyle=null,text=text.slice(part.to-start),start=part.to}}}function buildCollapsedSpan(builder,size,marker,ignoreWidget){var widget=!ignoreWidget&&marker.widgetNode;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,title,collapsed,len=allText.length,pos=0,i=1,text="",nextChange=0;;){if(nextChange==pos){spanStyle=spanEndStyle=spanStartStyle=title=css="",collapsed=null,nextChange=1/0;for(var foundBookmarks=[],endStyles=void 0,j=0;j<spans.length;++j){var sp=spans[j],m=sp.marker;"bookmark"==m.type&&sp.from==pos&&m.widgetNode?foundBookmarks.push(m):sp.from<=pos&&(null==sp.to||sp.to>pos||m.collapsed&&sp.to==pos&&sp.from==pos)?(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&&!title&&(title=m.title),m.collapsed&&(!collapsed||compareCollapsedMarkers(collapsed.marker,m)<0)&&(collapsed=sp)):sp.from>pos&&nextChange>sp.from&&(nextChange=sp.from)}if(endStyles)for(var j$1=0;j$1<endStyles.length;j$1+=2)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){if(buildCollapsedSpan(builder,(null==collapsed.to?len+1:collapsed.to)-pos,collapsed.marker,null==collapsed.from),null==collapsed.to)return;collapsed.to==pos&&(collapsed=!1)}}if(pos>=len)break;for(var upto=Math.min(len,nextChange);;){if(text){var end=pos+text.length;if(!collapsed){var tokenText=end>upto?text.slice(0,upto-pos):text;builder.addToken(builder,tokenText,style?style+spanStyle:spanStyle,spanStartStyle,pos+tokenText.length==nextChange?spanEndStyle:"",title,css)}if(end>=upto){text=text.slice(upto-pos),pos=upto;break}pos=end,spanStartStyle=""}text=allText.slice(at,at=styles[i++]),style=interpretTokenStyle(styles[i++],builder.cm.options)}}else 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))}function LineView(doc,line,lineN){this.line=line,this.rest=visualLineContinued(line),this.size=this.rest?lineNo(lst(this.rest))-lineN+1:1,this.node=this.text=null,this.hidden=lineIsHidden(doc,line)}function buildViewArray(cm,from,to){for(var nextPos,array=[],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}function pushOperation(op){operationGroup?operationGroup.ops.push(op):op.ownsGroup=operationGroup={ops:[op],delayedCallbacks:[]}}function fireCallbacksForOps(group){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)for(;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)try{fireCallbacksForOps(group)}finally{operationGroup=null,endCb(group)}}function signalLater(emitter,type){var arr=getHandlers(emitter,type);if(arr.length){var list,args=Array.prototype.slice.call(arguments,2);operationGroup?list=operationGroup.delayedCallbacks:orphanDelayedCallbacks?list=orphanDelayedCallbacks:(list=orphanDelayedCallbacks=[],setTimeout(fireOrphanDelayed,0));for(var i=0;i<arr.length;++i)!function(i){list.push(function(){return arr[i].apply(null,args)})}(i)}}function fireOrphanDelayed(){var delayed=orphanDelayedCallbacks;orphanDelayedCallbacks=null;for(var i=0;i<delayed.length;++i)delayed[i]()}function updateLineForChanges(cm,lineView,lineN,dims){for(var j=0;j<lineView.changes.length;j++){var type=lineView.changes[j];"text"==type?updateLineText(cm,lineView):"gutter"==type?updateLineGutter(cm,lineView,lineN,dims):"class"==type?updateLineClasses(cm,lineView):"widget"==type&&updateLineWidgets(cm,lineView,dims)}lineView.changes=null}function ensureLineWrapped(lineView){return lineView.node==lineView.text&&(lineView.node=elt("div",null,null,"position: relative"),lineView.text.parentNode&&lineView.text.parentNode.replaceChild(lineView.node,lineView.text),lineView.node.appendChild(lineView.text),ie&&ie_version<8&&(lineView.node.style.zIndex=2)),lineView.node}function updateLineBackground(cm,lineView){var cls=lineView.bgClass?lineView.bgClass+" "+(lineView.line.bgClass||""):lineView.line.bgClass;if(cls&&(cls+=" CodeMirror-linebackground"),lineView.background)cls?lineView.background.className=cls:(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)}}function getLineContent(cm,lineView){var ext=cm.display.externalMeasured;return ext&&ext.line==lineView.line?(cm.display.externalMeasured=null,lineView.measure=ext.measure,ext.built):buildLineContent(cm,lineView)}function updateLineText(cm,lineView){var cls=lineView.text.className,built=getLineContent(cm,lineView);lineView.text==lineView.node&&(lineView.node=built.pre),lineView.text.parentNode.replaceChild(built.pre,lineView.text),lineView.text=built.pre,built.bgClass!=lineView.bgClass||built.textClass!=lineView.textClass?(lineView.bgClass=built.bgClass,lineView.textClass=built.textClass,updateLineClasses(cm,lineView)):cls&&(lineView.text.className=cls)}function updateLineClasses(cm,lineView){updateLineBackground(cm,lineView),lineView.line.wrapClass?ensureLineWrapped(lineView).className=lineView.line.wrapClass: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),lineView.gutterBackground&&(lineView.node.removeChild(lineView.gutterBackground),lineView.gutterBackground=null),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),gutterWrap=lineView.gutter=elt("div",null,"CodeMirror-gutter-wrapper","left: "+(cm.options.fixedGutter?dims.fixedPos:-dims.gutterTotalWidth)+"px");if(cm.display.input.setUneditable(gutterWrap),wrap$1.insertBefore(gutterWrap,lineView.text),lineView.line.gutterClass&&(gutterWrap.className+=" "+lineView.line.gutterClass),!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"))),markers)for(var k=0;k<cm.options.gutters.length;++k){var id=cm.options.gutters[k],found=markers.hasOwnProperty(id)&&markers[id];found&&gutterWrap.appendChild(elt("div",[found],"CodeMirror-gutter-elt","left: "+dims.gutterLeft[id]+"px; width: "+dims.gutterWidth[id]+"px"))}}}function updateLineWidgets(cm,lineView,dims){lineView.alignable&&(lineView.alignable=null);for(var node=lineView.node.firstChild,next=void 0;node;node=next)next=node.nextSibling,"CodeMirror-linewidget"==node.className&&lineView.node.removeChild(node);insertLineWidgets(cm,lineView,dims)}function buildLineElement(cm,lineView,lineN,dims){var built=getLineContent(cm,lineView);return lineView.text=lineView.node=built.pre,built.bgClass&&(lineView.bgClass=built.bgClass),built.textClass&&(lineView.textClass=built.textClass),updateLineClasses(cm,lineView),updateLineGutter(cm,lineView,lineN,dims),insertLineWidgets(cm,lineView,dims),lineView.node}function insertLineWidgets(cm,lineView,dims){if(insertLineWidgetsFor(cm,lineView.line,lineView,dims,!0),lineView.rest)for(var i=0;i<lineView.rest.length;i++)insertLineWidgetsFor(cm,lineView.rest[i],lineView,dims,!1)}function insertLineWidgetsFor(cm,line,lineView,dims,allowAbove){if(line.widgets)for(var wrap=ensureLineWrapped(lineView),i=0,ws=line.widgets;i<ws.length;++i){var widget=ws[i],node=elt("div",[widget.node],"CodeMirror-linewidget");widget.handleMouseEvents||node.setAttribute("cm-ignore-events","true"),positionLineWidget(widget,node,lineView,dims),cm.display.input.setUneditable(node),allowAbove&&widget.above?wrap.insertBefore(node,lineView.gutter||lineView.text):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",widget.coverGutter||(width-=dims.gutterTotalWidth,node.style.paddingLeft=dims.gutterTotalWidth+"px"),node.style.width=width+"px"}widget.coverGutter&&(node.style.zIndex=5,node.style.position="relative",widget.noHScroll||(node.style.marginLeft=-dims.gutterTotalWidth+"px"))}function widgetHeight(widget){if(null!=widget.height)return widget.height;var cm=widget.doc.cm;if(!cm)return 0;if(!contains(document.body,widget.node)){var parentStyle="position: relative;";widget.coverGutter&&(parentStyle+="margin-left: -"+cm.display.gutters.offsetWidth+"px;"),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}function eventInWidget(display,e){for(var n=e_target(e);n!=display.wrapper;n=n.parentNode)if(!n||1==n.nodeType&&"true"==n.getAttribute("cm-ignore-events")||n.parentNode==display.sizer&&n!=display.mover)return!0}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")),style=window.getComputedStyle?window.getComputedStyle(e):e.currentStyle,data={left:parseInt(style.paddingLeft),right:parseInt(style.paddingRight)};return isNaN(data.left)||isNaN(data.right)||(display.cachedPaddingH=data),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}function ensureLineHeights(cm,lineView,rect){var wrapping=cm.options.lineWrapping,curWidth=wrapping&&displayWidth(cm);if(!lineView.measure.heights||wrapping&&lineView.measure.width!=curWidth){var heights=lineView.measure.heights=[];if(wrapping){lineView.measure.width=curWidth;for(var rects=lineView.text.firstChild.getClientRects(),i=0;i<rects.length-1;i++){var cur=rects[i],next=rects[i+1];Math.abs(cur.bottom-next.bottom)>2&&heights.push((cur.bottom+next.top)/2-rect.top)}}heights.push(rect.bottom-rect.top)}}function mapFromLineView(lineView,line,lineN){if(lineView.line==line)return{map:lineView.measure.map,cache:lineView.measure.cache};for(var i=0;i<lineView.rest.length;i++)if(lineView.rest[i]==line)return{map:lineView.measure.maps[i],cache:lineView.measure.caches[i]};for(var i$1=0;i$1<lineView.rest.length;i$1++)if(lineNo(lineView.rest[i$1])>lineN)return{map:lineView.measure.maps[i$1],cache:lineView.measure.caches[i$1],before:!0}}function updateExternalMeasurement(cm,line){var lineN=lineNo(line=visualLine(line)),view=cm.display.externalMeasured=new LineView(cm.doc,line,lineN);view.lineN=lineN;var built=view.built=buildLineContent(cm,view);return view.text=built.pre,removeChildrenAndAdd(cm.display.lineMeasure,built.pre),view}function measureChar(cm,line,ch,bias){return measureCharPrepared(cm,prepareMeasureForLine(cm,line),ch,bias)}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;return ext&&lineN>=ext.lineN&&lineN<ext.lineN+ext.size?ext:void 0}function prepareMeasureForLine(cm,line){var lineN=lineNo(line),view=findViewForLine(cm,lineN);view&&!view.text?view=null:view&&view.changes&&(updateLineForChanges(cm,view,lineN,getDimensions(cm)),cm.curOp.forceUpdate=!0),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:!1}}function measureCharPrepared(cm,prepared,ch,bias,varHeight){prepared.before&&(ch=-1);var found,key=ch+(bias||"");return prepared.cache.hasOwnProperty(key)?found=prepared.cache[key]:(prepared.rect||(prepared.rect=prepared.view.text.getBoundingClientRect()),prepared.hasHeights||(ensureLineHeights(cm,prepared.view,prepared.rect),prepared.hasHeights=!0),(found=measureCharInner(cm,prepared,ch,bias)).bogus||(prepared.cache[key]=found)),{left:found.left,right:found.right,top:varHeight?found.rtop:found.top,bottom:varHeight?found.rbottom:found.bottom}}function nodeAndOffsetInLineMap(map$$1,ch,bias){for(var node,start,end,collapse,mStart,mEnd,i=0;i<map$$1.length;i+=3)if(mStart=map$$1[i],mEnd=map$$1[i+1],ch<mStart?(start=0,end=1,collapse="left"):ch<mEnd?end=(start=ch-mStart)+1:(i==map$$1.length-3||ch==mEnd&&map$$1[i+3]>ch)&&(start=(end=mEnd-mStart)-1,ch>=mEnd&&(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<map$$1.length-3&&map$$1[i+3]==map$$1[i+4]&&!map$$1[i+5].insertLeft;)node=map$$1[(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("left"==bias)for(var i=0;i<rects.length&&(rect=rects[i]).left==rect.right;i++);else for(var i$1=rects.length-1;i$1>=0&&(rect=rects[i$1]).left==rect.right;i$1--);return rect}function measureCharInner(cm,prepared,ch,bias){var rect,place=nodeAndOffsetInLineMap(prepared.map,ch,bias),node=place.node,start=place.start,end=place.end,collapse=place.collapse;if(3==node.nodeType){for(var i$1=0;i$1<4;i$1++){for(;start&&isExtendingChar(prepared.line.text.charAt(place.coverStart+start));)--start;for(;place.coverStart+end<place.coverEnd&&isExtendingChar(prepared.line.text.charAt(place.coverStart+end));)++end;if((rect=ie&&ie_version<9&&0==start&&end==place.coverEnd-place.coverStart?node.parentNode.getBoundingClientRect():getUsefulRect(range(node,start,end).getClientRects(),bias)).left||rect.right||0==start)break;end=start,start-=1,collapse="right"}ie&&ie_version<11&&(rect=maybeUpdateRectForZooming(cm.display.measure,rect))}else{start>0&&(collapse=bias="right");var rects;rect=cm.options.lineWrapping&&(rects=node.getClientRects()).length>1?rects["right"==bias?rects.length-1:0]:node.getBoundingClientRect()}if(ie&&ie_version<9&&!start&&(!rect||!rect.left&&!rect.right)){var rSpan=node.parentNode.getClientRects()[0];rect=rSpan?{left:rSpan.left,right:rSpan.left+charWidth(cm.display),top:rSpan.top,bottom:rSpan.bottom}:nullRect}for(var rtop=rect.top-prepared.rect.top,rbot=rect.bottom-prepared.rect.top,mid=(rtop+rbot)/2,heights=prepared.view.measure.heights,i=0;i<heights.length-1&&!(mid<heights[i]);i++);var top=i?heights[i-1]:0,bot=heights[i],result={left:("right"==collapse?rect.right:rect.left)-prepared.rect.left,right:("left"==collapse?rect.left:rect.right)-prepared.rect.left,top:top,bottom:bot};return rect.left||rect.right||(result.bogus=!0),cm.options.singleCursorHeightPerLine||(result.rtop=rtop,result.rbottom=rbot),result}function maybeUpdateRectForZooming(measure,rect){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!hasBadZoomedRects(measure))return rect;var scaleX=screen.logicalXDPI/screen.deviceXDPI,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,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,cm.options.lineWrapping||(cm.display.maxLineChanged=!0),cm.display.lineNumChars=null}function pageScrollX(){return chrome&&android?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function pageScrollY(){return chrome&&android?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function intoCoordSystem(cm,lineObj,rect,context,includeWidgets){if(!includeWidgets&&lineObj.widgets)for(var i=0;i<lineObj.widgets.length;++i)if(lineObj.widgets[i].above){var size=widgetHeight(lineObj.widgets[i]);rect.top+=size,rect.bottom+=size}if("line"==context)return rect;context||(context="local");var yOff=heightAtLine(lineObj);if("local"==context?yOff+=paddingTop(cm.display):yOff-=cm.display.viewOffset,"page"==context||"window"==context){var lOff=cm.display.lineSpace.getBoundingClientRect();yOff+=lOff.top+("window"==context?0:pageScrollY());var xOff=lOff.left+("window"==context?0:pageScrollX());rect.left+=xOff,rect.right+=xOff}return rect.top+=yOff,rect.bottom+=yOff,rect}function fromCoordSystem(cm,coords,context){if("div"==context)return coords;var left=coords.left,top=coords.top;if("page"==context)left-=pageScrollX(),top-=pageScrollY();else if("local"==context||!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){return lineObj||(lineObj=getLine(cm.doc,pos.line)),intoCoordSystem(cm,lineObj,measureChar(cm,lineObj,pos.ch,bias),context)}function cursorCoords(cm,pos,context,lineObj,preparedMeasure,varHeight){function get(ch,right){var m=measureCharPrepared(cm,preparedMeasure,ch,right?"right":"left",varHeight);return right?m.left=m.right:m.right=m.left,intoCoordSystem(cm,lineObj,m,context)}function getBidi(ch,partPos,invert){var right=order[partPos].level%2!=0;return get(invert?ch-1:ch,right!=invert)}lineObj=lineObj||getLine(cm.doc,pos.line),preparedMeasure||(preparedMeasure=prepareMeasureForLine(cm,lineObj));var order=getOrder(lineObj,cm.doc.direction),ch=pos.ch,sticky=pos.sticky;if(ch>=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);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(lineN>last)return PosWithInfo(doc.first+doc.size-1,getLine(doc,last).text.length,null,!0,1);x<0&&(x=0);for(var lineObj=getLine(doc,lineN);;){var found=coordsCharInner(cm,lineObj,lineN,x,y),merged=collapsedSpanAtEnd(lineObj),mergedPos=merged&&merged.find(0,!0);if(!merged||!(found.ch>mergedPos.from.ch||found.ch==mergedPos.from.ch&&found.xRel>0))return found;lineN=lineNo(lineObj=mergedPos.to.line)}}function wrappedLineExtent(cm,lineObj,preparedMeasure,y){var measure=function(ch){return intoCoordSystem(cm,lineObj,measureCharPrepared(cm,preparedMeasure,ch),"line")},end=lineObj.text.length,begin=findFirst(function(ch){return measure(ch-1).bottom<=y},end,0);return end=findFirst(function(ch){return measure(ch).top>y},begin,end),{begin:begin,end:end}}function wrappedLineExtentChar(cm,lineObj,preparedMeasure,target){return wrappedLineExtent(cm,lineObj,preparedMeasure,intoCoordSystem(cm,lineObj,measureCharPrepared(cm,preparedMeasure,target),"line").top)}function coordsCharInner(cm,lineObj,lineNo$$1,x,y){y-=heightAtLine(lineObj);var pos,begin=0,end=lineObj.text.length,preparedMeasure=prepareMeasureForLine(cm,lineObj);if(getOrder(lineObj,cm.doc.direction)){if(cm.options.lineWrapping){var assign;begin=(assign=wrappedLineExtent(cm,lineObj,preparedMeasure,y)).begin,end=assign.end}pos=new Pos(lineNo$$1,Math.floor(begin+(end-begin)/2));var prevDiff,prevPos,beginLeft=cursorCoords(cm,pos,"line",lineObj,preparedMeasure).left,dir=beginLeft<x?1:-1,diff=beginLeft-x,steps=Math.ceil((end-begin)/4);outer:do{prevDiff=diff,prevPos=pos;for(var i=0;i<steps;++i){var prevPos$1=pos;if(null==(pos=moveVisually(cm,lineObj,pos,dir))||pos.ch<begin||end<=("before"==pos.sticky?pos.ch-1:pos.ch)){pos=prevPos$1;break outer}}if(diff=cursorCoords(cm,pos,"line",lineObj,preparedMeasure).left-x,steps>1){var diff_change_per_step=Math.abs(diff-prevDiff)/steps;steps=Math.min(steps,Math.ceil(Math.abs(diff)/diff_change_per_step)),dir=diff<0?1:-1}}while(0!=diff&&(steps>1||dir<0!=diff<0&&Math.abs(diff)<=Math.abs(prevDiff)));if(Math.abs(diff)>Math.abs(prevDiff)){if(diff<0==prevDiff<0)throw new Error("Broke out of infinite loop in coordsCharInner");pos=prevPos}}else{var ch=findFirst(function(ch){var box=intoCoordSystem(cm,lineObj,measureCharPrepared(cm,preparedMeasure,ch),"line");return box.top>y?(end=Math.min(ch,end),!0):!(box.bottom<=y)&&(box.left>x||!(box.right<x)&&x-box.left<box.right-x)},begin,end);pos=new Pos(lineNo$$1,ch=skipExtendingChars(lineObj.text,ch,1),ch==end?"before":"after")}var coords=cursorCoords(cm,pos,"line",lineObj,preparedMeasure);return(y<coords.top||coords.bottom<y)&&(pos.outside=!0),pos.xRel=x<coords.left?-1:x>coords.right?1:0,pos}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 height>3&&(display.cachedTextHeight=height),removeChildren(display.measure),height||1}function charWidth(display){if(null!=display.cachedCharWidth)return display.cachedCharWidth;var anchor=elt("span","xxxxxxxxxx"),pre=elt("pre",[anchor]);removeChildrenAndAdd(display.measure,pre);var rect=anchor.getBoundingClientRect(),width=(rect.right-rect.left)/10;return width>2&&(display.cachedCharWidth=width),width||10}function getDimensions(cm){for(var d=cm.display,left={},width={},gutterLeft=d.gutters.clientLeft,n=d.gutters.firstChild,i=0;n;n=n.nextSibling,++i)left[cm.options.gutters[i]]=n.offsetLeft+n.clientLeft+gutterLeft,width[cm.options.gutters[i]]=n.clientWidth;return{fixedPos:compensateForHScroll(d),gutterTotalWidth:d.gutters.offsetWidth,gutterLeft:left,gutterWidth:width,wrapperWidth:d.wrapper.clientWidth}}function compensateForHScroll(display){return display.scroller.getBoundingClientRect().left-display.sizer.getBoundingClientRect().left}function estimateHeight(cm){var th=textHeight(cm.display),wrapping=cm.options.lineWrapping,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++)line.widgets[i].height&&(widgetsHeight+=line.widgets[i].height);return wrapping?widgetsHeight+(Math.ceil(line.text.length/perLine)||1)*th:widgetsHeight+th}}function estimateLineHeights(cm){var doc=cm.doc,est=estimateHeight(cm);doc.iter(function(line){var estHeight=est(line);estHeight!=line.height&&updateLineHeight(line,estHeight)})}function posFromMouse(cm,e,liberal,forRect){var display=cm.display;if(!liberal&&"true"==e_target(e).getAttribute("cm-not-content"))return null;var x,y,space=display.lineSpace.getBoundingClientRect();try{x=e.clientX-space.left,y=e.clientY-space.top}catch(e){return null}var line,coords=coordsChar(cm,x,y);if(forRect&&1==coords.xRel&&(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}function findViewIndex(cm,n){if(n>=cm.display.viewTo)return null;if((n-=cm.display.viewFrom)<0)return null;for(var view=cm.display.view,i=0;i<view.length;i++)if((n-=view[i].size)<0)return i}function updateSelection(cm){cm.display.input.showSelection(cm.display.input.prepareSelection())}function prepareSelection(cm,primary){for(var doc=cm.doc,result={},curFragment=result.cursors=document.createDocumentFragment(),selFragment=result.selection=document.createDocumentFragment(),i=0;i<doc.sel.ranges.length;i++)if(!1!==primary||i!=doc.sel.primIndex){var range$$1=doc.sel.ranges[i];if(!(range$$1.from().line>=cm.display.viewTo||range$$1.to().line<cm.display.viewFrom)){var collapsed=range$$1.empty();(collapsed||cm.options.showCursorWhenSelecting)&&drawSelectionCursor(cm,range$$1.head,curFragment),collapsed||drawSelectionRange(cm,range$$1,selFragment)}}return result}function drawSelectionCursor(cm,head,output){var pos=cursorCoords(cm,head,"div",null,null,!cm.options.singleCursorHeightPerLine),cursor=output.appendChild(elt("div"," ","CodeMirror-cursor"));if(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",pos.other){var otherCursor=output.appendChild(elt("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));otherCursor.style.display="",otherCursor.style.left=pos.other.left+"px",otherCursor.style.top=pos.other.top+"px",otherCursor.style.height=.85*(pos.other.bottom-pos.other.top)+"px"}}function drawSelectionRange(cm,range$$1,output){function add(left,top,width,bottom){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: "+(null==width?rightSide-left:width)+"px;\n height: "+(bottom-top)+"px"))}function drawForLine(line,fromArg,toArg){function coords(ch,bias){return charCoords(cm,Pos(line,ch),"div",lineObj,bias)}var start,end,lineObj=getLine(doc,line),lineLen=lineObj.text.length;return iterateBidiSections(getOrder(lineObj,doc.direction),fromArg||0,null==toArg?lineLen:toArg,function(from,to,dir){var rightPos,left,right,leftPos=coords(from,"left");if(from==to)rightPos=leftPos,left=right=leftPos.left;else{if(rightPos=coords(to-1,"right"),"rtl"==dir){var tmp=leftPos;leftPos=rightPos,rightPos=tmp}left=leftPos.left,right=rightPos.right}null==fromArg&&0==from&&(left=leftSide),rightPos.top-leftPos.top>3&&(add(left,leftPos.top,null,leftPos.bottom),left=leftSide,leftPos.bottom<rightPos.top&&add(left,leftPos.bottom,null,rightPos.top)),null==toArg&&to==lineLen&&(right=rightSide),(!start||leftPos.top<start.top||leftPos.top==start.top&&leftPos.left<start.left)&&(start=leftPos),(!end||rightPos.bottom>end.bottom||rightPos.bottom==end.bottom&&rightPos.right>end.right)&&(end=rightPos),left<leftSide+1&&(left=leftSide),add(left,rightPos.top,right-left,rightPos.bottom)}),{start:start,end:end}}var display=cm.display,doc=cm.doc,fragment=document.createDocumentFragment(),padding=paddingH(cm.display),leftSide=padding.left,rightSide=Math.max(display.sizerWidth,displayWidth(cm)-display.sizer.offsetLeft)-padding.right,sFrom=range$$1.from(),sTo=range$$1.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),singleVLine=visualLine(fromLine)==visualLine(toLine),leftEnd=drawForLine(sFrom.line,sFrom.ch,singleVLine?fromLine.text.length+1:null).end,rightStart=drawForLine(sTo.line,singleVLine?0:null,sTo.ch).start;singleVLine&&(leftEnd.top<rightStart.top-2?(add(leftEnd.right,leftEnd.top,null,leftEnd.bottom),add(leftSide,rightStart.top,rightStart.left,rightStart.bottom)):add(leftEnd.right,leftEnd.top,rightStart.left-leftEnd.right,leftEnd.bottom)),leftEnd.bottom<rightStart.top&&add(leftSide,leftEnd.bottom,null,rightStart.top)}output.appendChild(fragment)}function restartBlink(cm){if(cm.state.focused){var display=cm.display;clearInterval(display.blinker);var on=!0;display.cursorDiv.style.visibility="",cm.options.cursorBlinkRate>0?display.blinker=setInterval(function(){return display.cursorDiv.style.visibility=(on=!on)?"":"hidden"},cm.options.cursorBlinkRate):cm.options.cursorBlinkRate<0&&(display.cursorDiv.style.visibility="hidden")}}function ensureFocus(cm){cm.state.focused||(cm.display.input.focus(),onFocus(cm))}function delayBlurEvent(cm){cm.state.delayingBlurEvent=!0,setTimeout(function(){cm.state.delayingBlurEvent&&(cm.state.delayingBlurEvent=!1,onBlur(cm))},100)}function onFocus(cm,e){cm.state.delayingBlurEvent&&(cm.state.delayingBlurEvent=!1),"nocursor"!=cm.options.readOnly&&(cm.state.focused||(signal(cm,"focus",cm,e),cm.state.focused=!0,addClass(cm.display.wrapper,"CodeMirror-focused"),cm.curOp||cm.display.selForContextMenu==cm.doc.sel||(cm.display.input.reset(),webkit&&setTimeout(function(){return cm.display.input.reset(!0)},20)),cm.display.input.receivedFocus()),restartBlink(cm))}function onBlur(cm,e){cm.state.delayingBlurEvent||(cm.state.focused&&(signal(cm,"blur",cm,e),cm.state.focused=!1,rmClass(cm.display.wrapper,"CodeMirror-focused")),clearInterval(cm.display.blinker),setTimeout(function(){cm.state.focused||(cm.display.shift=!1)},150))}function updateHeightsInViewport(cm){for(var display=cm.display,prevBottom=display.lineDiv.offsetTop,i=0;i<display.view.length;i++){var cur=display.view[i],height=void 0;if(!cur.hidden){if(ie&&ie_version<8){var bot=cur.node.offsetTop+cur.node.offsetHeight;height=bot-prevBottom,prevBottom=bot}else{var box=cur.node.getBoundingClientRect();height=box.bottom-box.top}var diff=cur.line.height-height;if(height<2&&(height=textHeight(display)),(diff>.001||diff<-.001)&&(updateLineHeight(cur.line,height),updateWidgetHeight(cur.line),cur.rest))for(var j=0;j<cur.rest.length;j++)updateWidgetHeight(cur.rest[j])}}}function updateWidgetHeight(line){if(line.widgets)for(var i=0;i<line.widgets.length;++i)line.widgets[i].height=line.widgets[i].node.parentNode.offsetHeight}function visibleLines(display,doc,viewport){var top=viewport&&null!=viewport.top?Math.max(0,viewport.top):display.scroller.scrollTop;top=Math.floor(top-paddingTop(display));var bottom=viewport&&null!=viewport.bottom?viewport.bottom:top+display.wrapper.clientHeight,from=lineAtHeight(doc,top),to=lineAtHeight(doc,bottom);if(viewport&&viewport.ensure){var ensureFrom=viewport.ensure.from.line,ensureTo=viewport.ensure.to.line;ensureFrom<from?(from=ensureFrom,to=lineAtHeight(doc,heightAtLine(getLine(doc,ensureFrom))+display.wrapper.clientHeight)):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)}}function alignHorizontally(cm){var display=cm.display,view=display.view;if(display.alignWidgets||display.gutters.firstChild&&cm.options.fixedGutter){for(var comp=compensateForHScroll(display)-display.scroller.scrollLeft+cm.doc.scrollLeft,gutterW=display.gutters.offsetWidth,left=comp+"px",i=0;i<view.length;i++)if(!view[i].hidden){cm.options.fixedGutter&&(view[i].gutter&&(view[i].gutter.style.left=left),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}cm.options.fixedGutter&&(display.gutters.style.left=comp+gutterW+"px")}}function maybeUpdateLineNumberWidth(cm){if(!cm.options.lineNumbers)return!1;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")),innerW=test.firstChild.offsetWidth,padding=test.offsetWidth-innerW;return 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),!0}return!1}function maybeScrollWindow(cm,rect){if(!signalDOMEvent(cm,"scrollCursorIntoView")){var display=cm.display,box=display.sizer.getBoundingClientRect(),doScroll=null;if(rect.top+box.top<0?doScroll=!0:rect.bottom+box.top>(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)}}}function scrollPosIntoView(cm,pos,end,margin){null==margin&&(margin=0);for(var rect,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),Math.abs(cm.doc.scrollTop-startTop)>1&&(changed=!0)),null!=scrollPos.scrollLeft&&(setScrollLeft(cm,scrollPos.scrollLeft),Math.abs(cm.doc.scrollLeft-startLeft)>1&&(changed=!0)),!changed)break}return rect}function scrollIntoView(cm,rect){var scrollPos=calculateScrollPos(cm,rect);null!=scrollPos.scrollTop&&updateScrollTop(cm,scrollPos.scrollTop),null!=scrollPos.scrollLeft&&setScrollLeft(cm,scrollPos.scrollLeft)}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.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);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.left<screenleft?result.scrollLeft=Math.max(0,rect.left-(tooWide?0:10)):rect.right>screenw+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(),from=cur,to=cur;cm.options.lineWrapping||(from=cur.ch?Pos(cur.line,cur.ch-1):cur,to=Pos(cur.line,cur.ch+1)),cm.curOp.scrollToPos={from:from,to:to,margin:cm.options.cursorScrollMargin}}function scrollToCoords(cm,x,y){null==x&&null==y||resolveScrollToPos(cm),null!=x&&(cm.curOp.scrollLeft=x),null!=y&&(cm.curOp.scrollTop=y)}function scrollToRange(cm,range$$1){resolveScrollToPos(cm),cm.curOp.scrollToPos=range$$1}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 updateScrollbars(cm,measure){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++)startWidth!=cm.display.barWidth&&cm.options.lineWrapping&&updateHeightsInViewport(cm),updateScrollbarsInner(cm,measureForScrollbars(cm)),startWidth=cm.display.barWidth,startHeight=cm.display.barHeight}function updateScrollbarsInner(cm,measure){var d=cm.display,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",sizes.right&&sizes.bottom?(d.scrollbarFiller.style.display="block",d.scrollbarFiller.style.height=sizes.bottom+"px",d.scrollbarFiller.style.width=sizes.right+"px"):d.scrollbarFiller.style.display="",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"):d.gutterFiller.style.display=""}function initScrollbars(cm){cm.display.scrollbars&&(cm.display.scrollbars.clear(),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),on(node,"mousedown",function(){cm.state.focused&&setTimeout(function(){return cm.display.input.focus()},0)}),node.setAttribute("cm-not-content","true")},function(pos,axis){"horizontal"==axis?setScrollLeft(cm,pos):updateScrollTop(cm,pos)},cm),cm.display.scrollbars.addClass&&addClass(cm.display.wrapper,cm.display.scrollbars.addClass)}function startOperation(cm){cm.curOp={cm:cm,viewChanged:!1,startHeight:cm.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++nextOpId},pushOperation(cm.curOp)}function endOperation(cm){finishOperation(cm.curOp,function(group){for(var i=0;i<group.ops.length;i++)group.ops[i].cm.curOp=null;endOperations(group)})}function endOperations(group){for(var ops=group.ops,i=0;i<ops.length;i++)endOperation_R1(ops[i]);for(var i$1=0;i$1<ops.length;i$1++)endOperation_W1(ops[i$1]);for(var i$2=0;i$2<ops.length;i$2++)endOperation_R2(ops[i$2]);for(var i$3=0;i$3<ops.length;i$3++)endOperation_W2(ops[i$3]);for(var i$4=0;i$4<ops.length;i$4++)endOperation_finish(ops[i$4])}function endOperation_R1(op){var cm=op.cm,display=cm.display;maybeClipScrollbars(cm),op.updateMaxLine&&findMaxLine(cm),op.mustUpdate=op.viewChanged||op.forceUpdate||null!=op.scrollTop||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;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(op.focus))}function endOperation_W2(op){var cm=op.cm;null!=op.adjustWidthTo&&(cm.display.sizer.style.minWidth=op.adjustWidthTo+"px",op.maxScrollLeft<cm.doc.scrollLeft&&setScrollLeft(cm,Math.min(cm.display.scroller.scrollLeft,op.maxScrollLeft),!0),cm.display.maxLineChanged=!1);var takeFocus=op.focus&&op.focus==activeElt()&&(!document.hasFocus||document.hasFocus());op.preparedSelection&&cm.display.input.showSelection(op.preparedSelection,takeFocus),(op.updatedDisplay||op.startHeight!=cm.doc.height)&&updateScrollbars(cm,op.barMeasure),op.updatedDisplay&&setDocumentHeight(cm,op.barMeasure),op.selectionChanged&&restartBlink(cm),cm.state.focused&&op.updateInput&&cm.display.input.reset(op.typing),takeFocus&&ensureFocus(op.cm)}function endOperation_finish(op){var cm=op.cm,display=cm.display,doc=cm.doc;op.updatedDisplay&&postUpdateDisplay(cm,op.update),null==display.wheelStartX||null==op.scrollTop&&null==op.scrollLeft&&!op.scrollToPos||(display.wheelStartX=display.wheelStartY=null),null!=op.scrollTop&&setScrollTop(cm,op.scrollTop,op.forceScroll),null!=op.scrollLeft&&setScrollLeft(cm,op.scrollLeft,!0,!0),op.scrollToPos&&maybeScrollWindow(cm,scrollPosIntoView(cm,clipPos(doc,op.scrollToPos.from),clipPos(doc,op.scrollToPos.to),op.scrollToPos.margin));var hidden=op.maybeHiddenMarkers,unhidden=op.maybeUnhiddenMarkers;if(hidden)for(var i=0;i<hidden.length;++i)hidden[i].lines.length||signal(hidden[i],"hide");if(unhidden)for(var i$1=0;i$1<unhidden.length;++i$1)unhidden[i$1].lines.length&&signal(unhidden[i$1],"unhide");display.wrapper.offsetHeight&&(doc.scrollTop=cm.display.scroller.scrollTop),op.changeObjs&&signal(cm,"changes",cm,op.changeObjs),op.update&&op.update.finish()}function runInOp(cm,f){if(cm.curOp)return f();startOperation(cm);try{return f()}finally{endOperation(cm)}}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)}}}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)}}}function regChange(cm,from,to,lendiff){null==from&&(from=cm.doc.first),null==to&&(to=cm.doc.first+cm.doc.size),lendiff||(lendiff=0);var display=cm.display;if(lendiff&&to<display.viewTo&&(null==display.updateLineNumbers||display.updateLineNumbers>from)&&(display.updateLineNumbers=from),cm.curOp.viewChanged=!0,from>=display.viewTo)sawCollapsedSpans&&visualLineNo(cm.doc,from)<display.viewTo&&resetView(cm);else if(to<=display.viewFrom)sawCollapsedSpans&&visualLineEndNo(cm.doc,to+lendiff)>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?ext.lineN+=lendiff:from<ext.lineN+ext.size&&(display.externalMeasured=null))}function regLineChange(cm,line,type){cm.curOp.viewChanged=!0;var display=cm.display,ext=cm.display.externalMeasured;if(ext&&line>=ext.lineN&&line<ext.lineN+ext.size&&(display.externalMeasured=null),!(line<display.viewFrom||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<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}for(;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}}function adjustView(cm,from,to){var display=cm.display;0==display.view.length||from>=display.viewTo||to<=display.viewFrom?(display.view=buildViewArray(cm,from,to),display.viewFrom=from):(display.viewFrom>from?display.view=buildViewArray(cm,from,display.viewFrom).concat(display.view):display.viewFrom<from&&(display.view=display.view.slice(findViewIndex(cm,from))),display.viewFrom=from,display.viewTo<to?display.view=display.view.concat(buildViewArray(cm,display.viewTo,to)):display.viewTo>to&&(display.view=display.view.slice(0,findViewIndex(cm,to)))),display.viewTo=to}function countDirtyView(cm){for(var view=cm.display.view,dirty=0,i=0;i<view.length;i++){var lineView=view[i];lineView.hidden||lineView.node&&!lineView.changes||++dirty}return dirty}function startWorker(cm,time){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)){var end=+new Date+cm.options.workTime,context=getContextBefore(cm,doc.highlightFrontier),changedLines=[];doc.iter(context.line,Math.min(doc.first+doc.size,cm.display.viewTo+500),function(line){if(context.line>=cm.display.viewFrom){var oldStyles=line.styles,resetState=line.text.length>cm.options.maxHighlightLength?copyState(doc.mode,context.state):null,highlighted=highlightLine(cm,line,context,!0);resetState&&(context.state=resetState),line.styles=highlighted.styles;var oldCls=line.styleClasses,newCls=highlighted.classes;newCls?line.styleClasses=newCls:oldCls&&(line.styleClasses=null);for(var ischange=!oldStyles||oldStyles.length!=line.styles.length||oldCls!=newCls&&(!oldCls||!newCls||oldCls.bgClass!=newCls.bgClass||oldCls.textClass!=newCls.textClass),i=0;!ischange&&i<oldStyles.length;++i)ischange=oldStyles[i]!=line.styles[i];ischange&&changedLines.push(context.line),line.stateAfter=context.save(),context.nextLine()}else 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)return startWorker(cm,cm.options.workDelay),!0}),doc.highlightFrontier=context.line,doc.modeFrontier=Math.max(doc.modeFrontier,context.line),changedLines.length&&runInOp(cm,function(){for(var i=0;i<changedLines.length;i++)regLineChange(cm,changedLines[i],"text")})}}function maybeClipScrollbars(cm){var display=cm.display;!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=!0)}function selectionSnapshot(cm){if(cm.hasFocus())return null;var active=activeElt();if(!active||!contains(cm.display.lineDiv,active))return null;var result={activeElt:active};if(window.getSelection){var sel=window.getSelection();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()&&(snapshot.activeElt.focus(),snapshot.anchorNode&&contains(document.body,snapshot.anchorNode)&&contains(document.body,snapshot.focusNode))){var sel=window.getSelection(),range$$1=document.createRange();range$$1.setEnd(snapshot.anchorNode,snapshot.anchorOffset),range$$1.collapse(!1),sel.removeAllRanges(),sel.addRange(range$$1),sel.extend(snapshot.focusNode,snapshot.focusOffset)}}function updateDisplayIfNeeded(cm,update){var display=cm.display,doc=cm.doc;if(update.editorIsHidden)return resetView(cm),!1;if(!update.force&&update.visible.from>=display.viewFrom&&update.visible.to<=display.viewTo&&(null==display.updateLineNumbers||display.updateLineNumbers>=display.viewTo)&&display.renderedView==display.view&&0==countDirtyView(cm))return!1;maybeUpdateLineNumberWidth(cm)&&(resetView(cm),update.dims=getDimensions(cm));var end=doc.first+doc.size,from=Math.max(update.visible.from-cm.options.viewportMargin,doc.first),to=Math.min(end,update.visible.to+cm.options.viewportMargin);display.viewFrom<from&&from-display.viewFrom<20&&(from=Math.max(doc.first,display.viewFrom)),display.viewTo>to&&display.viewTo-to<20&&(to=Math.min(end,display.viewTo)),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)),cm.display.mover.style.top=display.viewOffset+"px";var toUpdate=countDirtyView(cm);if(!different&&0==toUpdate&&!update.force&&display.renderedView==display.view&&(null==display.updateLineNumbers||display.updateLineNumbers>=display.viewTo))return!1;var selSnapshot=selectionSnapshot(cm);return toUpdate>4&&(display.lineDiv.style.display="none"),patchDisplay(cm,display.updateLineNumbers,update.dims),toUpdate>4&&(display.lineDiv.style.display=""),display.renderedView=display.view,restoreSelection(selSnapshot),removeChildren(display.cursorDiv),removeChildren(display.selectionDiv),display.gutters.style.height=display.sizer.style.minHeight=0,different&&(display.lastWrapHeight=update.wrapperHeight,display.lastWrapWidth=update.wrapperWidth,startWorker(cm,400)),display.updateLineNumbers=null,!0}function postUpdateDisplay(cm,update){for(var viewport=update.viewport,first=!0;(first&&cm.options.lineWrapping&&update.oldDisplayWidth!=displayWidth(cm)||(viewport&&null!=viewport.top&&(viewport={top:Math.min(cm.doc.height+paddingVert(cm.display)-displayHeight(cm),viewport.top)}),update.visible=visibleLines(cm.display,cm.doc,viewport),!(update.visible.from>=cm.display.viewFrom&&update.visible.to<=cm.display.viewTo)))&&updateDisplayIfNeeded(cm,update);first=!1){updateHeightsInViewport(cm);var barMeasure=measureForScrollbars(cm);updateSelection(cm),updateScrollbars(cm,barMeasure),setDocumentHeight(cm,barMeasure),update.force=!1}update.signal(cm,"update",cm),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()}}function patchDisplay(cm,updateNumbersFrom,dims){function rm(node){var next=node.nextSibling;return webkit&&mac&&cm.display.currentWheelTarget==node?node.style.display="none":node.parentNode.removeChild(node),next}for(var display=cm.display,lineNumbers=cm.options.lineNumbers,container=display.lineDiv,cur=container.firstChild,view=display.view,lineN=display.viewFrom,i=0;i<view.length;i++){var lineView=view[i];if(lineView.hidden);else if(lineView.node&&lineView.node.parentNode==container){for(;cur!=lineView.node;)cur=rm(cur);var updateNumber=lineNumbers&&null!=updateNumbersFrom&&updateNumbersFrom<=lineN&&lineView.lineNumber;lineView.changes&&(indexOf(lineView.changes,"gutter")>-1&&(updateNumber=!1),updateLineForChanges(cm,lineView,lineN,dims)),updateNumber&&(removeChildren(lineView.lineNumber),lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options,lineN)))),cur=lineView.node.nextSibling}else{var node=buildLineElement(cm,lineView,lineN,dims);container.insertBefore(node,cur)}lineN+=lineView.size}for(;cur;)cur=rm(cur)}function updateGutterSpace(cm){var width=cm.display.gutters.offsetWidth;cm.display.sizer.style.marginLeft=width+"px"}function setDocumentHeight(cm,measure){cm.display.sizer.style.minHeight=measure.docHeight+"px",cm.display.heightForcer.style.top=measure.docHeight+"px",cm.display.gutters.style.height=measure.docHeight+cm.display.barHeight+scrollGap(cm)+"px"}function updateGutters(cm){var gutters=cm.display.gutters,specs=cm.options.gutters;removeChildren(gutters);for(var i=0;i<specs.length;++i){var gutterClass=specs[i],gElt=gutters.appendChild(elt("div",null,"CodeMirror-gutter "+gutterClass));"CodeMirror-linenumbers"==gutterClass&&(cm.display.lineGutter=gElt,gElt.style.width=(cm.display.lineNumWidth||1)+"px")}gutters.style.display=i?"":"none",updateGutterSpace(cm)}function setGuttersForLineNumbers(options){var found=indexOf(options.gutters,"CodeMirror-linenumbers");-1==found&&options.lineNumbers?options.gutters=options.gutters.concat(["CodeMirror-linenumbers"]):found>-1&&!options.lineNumbers&&(options.gutters=options.gutters.slice(0),options.gutters.splice(found,1))}function wheelEventDelta(e){var dx=e.wheelDeltaX,dy=e.wheelDeltaY;return null==dx&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(dx=e.detail),null==dy&&e.detail&&e.axis==e.VERTICAL_AXIS?dy=e.detail:null==dy&&(dy=e.wheelDelta),{x:dx,y:dy}}function wheelEventPixels(e){var delta=wheelEventDelta(e);return delta.x*=wheelPixelsPerUnit,delta.y*=wheelPixelsPerUnit,delta}function onScrollWheel(cm,e){var delta=wheelEventDelta(e),dx=delta.x,dy=delta.y,display=cm.display,scroll=display.scroller,canScrollX=scroll.scrollWidth>scroll.clientWidth,canScrollY=scroll.scrollHeight>scroll.clientHeight;if(dx&&canScrollX||dy&&canScrollY){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}if(dx&&!gecko&&!presto&&null!=wheelPixelsPerUnit)return dy&&canScrollY&&updateScrollTop(cm,Math.max(0,scroll.scrollTop+dy*wheelPixelsPerUnit)),setScrollLeft(cm,Math.max(0,scroll.scrollLeft+dx*wheelPixelsPerUnit)),(!dy||dy&&canScrollY)&&e_preventDefault(e),void(display.wheelStartX=null);if(dy&&null!=wheelPixelsPerUnit){var pixels=dy*wheelPixelsPerUnit,top=cm.doc.scrollTop,bot=top+display.wrapper.clientHeight;pixels<0?top=Math.max(0,top+pixels-50):bot=Math.min(cm.doc.height,bot+pixels+50),updateDisplaySimple(cm,{top:top,bottom:bot})}wheelSamples<20&&(null==display.wheelStartX?(display.wheelStartX=scroll.scrollLeft,display.wheelStartY=scroll.scrollTop,display.wheelDX=dx,display.wheelDY=dy,setTimeout(function(){if(null!=display.wheelStartX){var movedX=scroll.scrollLeft-display.wheelStartX,movedY=scroll.scrollTop-display.wheelStartY,sample=movedY&&display.wheelDY&&movedY/display.wheelDY||movedX&&display.wheelDX&&movedX/display.wheelDX;display.wheelStartX=display.wheelStartY=null,sample&&(wheelPixelsPerUnit=(wheelPixelsPerUnit*wheelSamples+sample)/(wheelSamples+1),++wheelSamples)}},200)):(display.wheelDX+=dx,display.wheelDY+=dy))}}function normalizeSelection(ranges,primIndex){var prim=ranges[primIndex];ranges.sort(function(a,b){return cmp(a.from(),b.from())}),primIndex=indexOf(ranges,prim);for(var i=1;i<ranges.length;i++){var cur=ranges[i],prev=ranges[i-1];if(cmp(prev.to(),cur.from())>=0){var from=minPos(prev.from(),cur.from()),to=maxPos(prev.to(),cur.to()),inv=prev.empty()?cur.from()==cur.head:prev.from()==prev.head;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)}function changeEnd(change){return change.text?Pos(change.from.line+change.text.length-1,lst(change.text).length+(1==change.text.length?change.from.ch:0)):change.to}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;return pos.line==change.to.line&&(ch+=changeEnd(change).ch-change.to.ch),Pos(line,ch)}function computeSelAfterChange(doc,change){for(var out=[],i=0;i<doc.sel.ranges.length;i++){var range=doc.sel.ranges[i];out.push(new Range(adjustForChange(range.anchor,change),adjustForChange(range.head,change)))}return normalizeSelection(out,doc.sel.primIndex)}function offsetPos(pos,old,nw){return pos.line==old.line?Pos(nw.line,pos.ch-old.ch+nw.ch):Pos(nw.line+(pos.line-old.line),pos.ch)}function computeReplacedSel(doc,changes,hint){for(var out=[],oldPrev=Pos(doc.first,0),newPrev=oldPrev,i=0;i<changes.length;i++){var change=changes[i],from=offsetPos(change.from,oldPrev,newPrev),to=offsetPos(changeEnd(change),oldPrev,newPrev);if(oldPrev=change.to,newPrev=to,"around"==hint){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)}function loadMode(cm){cm.doc.mode=getMode(cm.options,cm.doc.modeOption),resetModeState(cm)}function resetModeState(cm){cm.doc.iter(function(line){line.stateAfter&&(line.stateAfter=null),line.styles&&(line.styles=null)}),cm.doc.modeFrontier=cm.doc.highlightFrontier=cm.doc.first,startWorker(cm,100),cm.state.modeGen++,cm.curOp&&regChange(cm)}function isWholeLineUpdate(doc,change){return 0==change.from.ch&&0==change.to.ch&&""==lst(change.text)&&(!doc.cm||doc.cm.options.wholeLineUpdateBefore)}function updateDoc(doc,change,markedSpans,estimateHeight$$1){function spansFor(n){return markedSpans?markedSpans[n]:null}function update(line,text,spans){updateLine(line,text,spans,estimateHeight$$1),signalLater(line,"change",line,change)}function linesFor(start,end){for(var result=[],i=start;i<end;++i)result.push(new Line(text[i],spansFor(i),estimateHeight$$1));return result}var from=change.from,to=change.to,text=change.text,firstLine=getLine(doc,from.line),lastLine=getLine(doc,to.line),lastText=lst(text),lastSpans=spansFor(text.length-1),nlines=to.line-from.line;if(change.full)doc.insert(0,linesFor(0,text.length)),doc.remove(text.length,doc.size-text.length);else if(isWholeLineUpdate(doc,change)){var added=linesFor(0,text.length-1);update(lastLine,lastLine.text,lastSpans),nlines&&doc.remove(from.line,nlines),added.length&&doc.insert(from.line,added)}else if(firstLine==lastLine)if(1==text.length)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$$1)),update(firstLine,firstLine.text.slice(0,from.ch)+text[0],spansFor(0)),doc.insert(from.line+1,added$1)}else if(1==text.length)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);nlines>1&&doc.remove(from.line+1,nlines-1),doc.insert(from.line+1,added$2)}signalLater(doc,"change",doc,change)}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){var shared=sharedHist&&rel.sharedHist;sharedHistOnly&&!shared||(f(rel.doc,shared),propagate(rel.doc,doc,shared))}}}propagate(doc,null,!0)}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.lineWrapping||findMaxLine(cm),cm.options.mode=doc.modeOption,regChange(cm)}function setDirectionClass(cm){("rtl"==cm.doc.direction?addClass:rmClass)(cm.display.lineDiv,"CodeMirror-rtl")}function directionChanged(cm){runInOp(cm,function(){setDirectionClass(cm),regChange(cm)})}function History(startGen){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=startGen||1}function historyChangeFromChange(doc,change){var histChange={from:copyPos(change.from),to:changeEnd(change),text:getBetween(doc,change.from,change.to)};return 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)},!0),histChange}function clearSelectionEvents(array){for(;array.length&&lst(array).ranges;)array.pop()}function lastChangeEvent(hist,force){return force?(clearSelectionEvents(hist.done),lst(hist.done)):hist.done.length&&!lst(hist.done).ranges?lst(hist.done):hist.done.length>1&&!hist.done[hist.done.length-2].ranges?(hist.done.pop(),lst(hist.done)):void 0}function addChangeToHistory(doc,change,selAfter,opId){var hist=doc.history;hist.undone.length=0;var cur,last,time=+new Date;if((hist.lastOp==opId||hist.lastOrigin==change.origin&&change.origin&&("+"==change.origin.charAt(0)&&doc.cm&&hist.lastModTime>time-doc.cm.options.historyEventDelay||"*"==change.origin.charAt(0)))&&(cur=lastChangeEvent(hist,hist.lastOp==opId)))last=lst(cur.changes),0==cmp(change.from,change.to)&&0==cmp(change.from,last.to)?last.to=changeEnd(change):cur.changes.push(historyChangeFromChange(doc,change));else{var before=lst(hist.done);for(before&&before.ranges||pushSelectionToHistory(doc.sel,hist.done),cur={changes:[historyChangeFromChange(doc,change)],generation:hist.generation},hist.done.push(cur);hist.done.length>hist.undoDepth;)hist.done.shift(),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,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)}function addSelectionToHistory(doc,sel,opId,options){var hist=doc.history,origin=options&&options.origin;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:pushSelectionToHistory(sel,hist.done),hist.lastSelTime=+new Date,hist.lastSelOrigin=origin,hist.lastSelOp=opId,options&&!1!==options.clearRedo&&clearSelectionEvents(hist.undone)}function pushSelectionToHistory(sel,dest){var top=lst(dest);top&&top.ranges&&top.equals(sel)||dest.push(sel)}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){line.markedSpans&&((existing||(existing=change["spans_"+doc.id]={}))[n]=line.markedSpans),++n})}function removeClearedSpans(spans){if(!spans)return null;for(var out,i=0;i<spans.length;++i)spans[i].marker.explicitlyCleared?out||(out=spans.slice(0,i)):out&&out.push(spans[i]);return out?out.length?out:null:spans}function getOldSpans(doc,change){var found=change["spans_"+doc.id];if(!found)return null;for(var nw=[],i=0;i<change.text.length;++i)nw.push(removeClearedSpans(found[i]));return nw}function mergeOldSpans(doc,change){var old=getOldSpans(doc,change),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){for(var span=stretchCur[j],k=0;k<oldCur.length;++k)if(oldCur[k].marker==span.marker)continue spans;oldCur.push(span)}else stretchCur&&(old[i]=stretchCur)}return old}function copyHistoryArray(events,newGroup,instantiateSel){for(var copy=[],i=0;i<events.length;++i){var event=events[i];if(event.ranges)copy.push(instantiateSel?Selection.prototype.deepCopy.call(event):event);else{var changes=event.changes,newChanges=[];copy.push({changes:newChanges});for(var j=0;j<changes.length;++j){var change=changes[j],m=void 0;if(newChanges.push({from:change.from,to:change.to,text:change.text}),newGroup)for(var prop in change)(m=prop.match(/^spans_(\d+)$/))&&indexOf(newGroup,Number(m[1]))>-1&&(lst(newChanges)[prop]=change[prop],delete change[prop])}}}return copy}function extendRange(range,head,other,extend){if(extend){var anchor=range.anchor;if(other){var posBefore=cmp(head,anchor)<0;posBefore!=cmp(other,anchor)<0?(anchor=head,head=other):posBefore!=cmp(head,other)<0&&(head=other)}return new Range(anchor,head)}return new Range(other||head,head)}function extendSelection(doc,head,other,options,extend){null==extend&&(extend=doc.cm&&(doc.cm.display.shift||doc.extend)),setSelection(doc,new Selection([extendRange(doc.sel.primary(),head,other,extend)],0),options)}function extendSelections(doc,heads,options){for(var out=[],extend=doc.cm&&(doc.cm.display.shift||doc.extend),i=0;i<doc.sel.ranges.length;i++)out[i]=extendRange(doc.sel.ranges[i],heads[i],null,extend);setSelection(doc,normalizeSelection(out,doc.sel.primIndex),options)}function replaceOneSelection(doc,i,range,options){var ranges=doc.sel.ranges.slice(0);ranges[i]=range,setSelection(doc,normalizeSelection(ranges,doc.sel.primIndex),options)}function setSimpleSelection(doc,anchor,head,options){setSelection(doc,simpleSelection(anchor,head),options)}function filterSelectionChange(doc,sel,options){var obj={ranges:sel.ranges,update:function(ranges){var this$1=this;this.ranges=[];for(var i=0;i<ranges.length;i++)this$1.ranges[i]=new Range(clipPos(doc,ranges[i].anchor),clipPos(doc,ranges[i].head))},origin:options&&options.origin};return signal(doc,"beforeSelectionChange",doc,obj),doc.cm&&signal(doc.cm,"beforeSelectionChange",doc.cm,obj),obj.ranges!=sel.ranges?normalizeSelection(obj.ranges,obj.ranges.length-1):sel}function setSelectionReplaceHistory(doc,sel,options){var done=doc.history.done,last=lst(done);last&&last.ranges?(done[done.length-1]=sel,setSelectionNoUndo(doc,sel,options)):setSelection(doc,sel,options)}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){(hasHandler(doc,"beforeSelectionChange")||doc.cm&&hasHandler(doc.cm,"beforeSelectionChange"))&&(sel=filterSelectionChange(doc,sel,options)),setSelectionInner(doc,skipAtomicInSelection(doc,sel,options&&options.bias||(cmp(sel.primary().head,doc.sel.primary().head)<0?-1:1),!0)),options&&!1===options.scroll||!doc.cm||ensureCursorVisible(doc.cm)}function setSelectionInner(doc,sel){sel.equals(doc.sel)||(doc.sel=sel,doc.cm&&(doc.cm.curOp.updateInput=doc.cm.curOp.selectionChanged=!0,signalCursorActivity(doc.cm)),signalLater(doc,"cursorActivity",doc))}function reCheckSelection(doc){setSelectionInner(doc,skipAtomicInSelection(doc,doc.sel,null,!1))}function skipAtomicInSelection(doc,sel,bias,mayClear){for(var out,i=0;i<sel.ranges.length;i++){var range=sel.ranges[i],old=sel.ranges.length==doc.sel.ranges.length&&doc.sel.ranges[i],newAnchor=skipAtomic(doc,range.anchor,old&&old.anchor,bias,mayClear),newHead=skipAtomic(doc,range.head,old&&old.head,bias,mayClear);(out||newAnchor!=range.anchor||newHead!=range.head)&&(out||(out=sel.ranges.slice(0,i)),out[i]=new Range(newAnchor,newHead))}return out?normalizeSelection(out,sel.primIndex):sel}function skipAtomicInner(doc,pos,oldPos,dir,mayClear){var line=getLine(doc,pos.line);if(line.markedSpans)for(var i=0;i<line.markedSpans.length;++i){var sp=line.markedSpans[i],m=sp.marker;if((null==sp.from||(m.inclusiveLeft?sp.from<=pos.ch:sp.from<pos.ch))&&(null==sp.to||(m.inclusiveRight?sp.to>=pos.ch:sp.to>pos.ch))){if(mayClear&&(signal(m,"beforeCursorEnter"),m.explicitlyCleared)){if(line.markedSpans){--i;continue}break}if(!m.atomic)continue;if(oldPos){var near=m.find(dir<0?1:-1),diff=void 0;if((dir<0?m.inclusiveRight:m.inclusiveLeft)&&(near=movePos(doc,near,-dir,near&&near.line==pos.line?line:null)),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);return(dir<0?m.inclusiveLeft:m.inclusiveRight)&&(far=movePos(doc,far,dir,far.line==pos.line?line:null)),far?skipAtomicInner(doc,far,pos,dir,mayClear):null}}return pos}function skipAtomic(doc,pos,oldPos,bias,mayClear){var dir=bias||1,found=skipAtomicInner(doc,pos,oldPos,dir,mayClear)||!mayClear&&skipAtomicInner(doc,pos,oldPos,dir,!0)||skipAtomicInner(doc,pos,oldPos,-dir,mayClear)||!mayClear&&skipAtomicInner(doc,pos,oldPos,-dir,!0);return found||(doc.cantEdit=!0,Pos(doc.first,0))}function movePos(doc,pos,dir,line){return dir<0&&0==pos.ch?pos.line>doc.first?clipPos(doc,Pos(pos.line-1)):null:dir>0&&pos.ch==(line||getLine(doc,pos.line)).text.length?pos.line<doc.first+doc.size-1?Pos(pos.line+1,0):null:new Pos(pos.line,pos.ch+dir)}function selectAll(cm){cm.setSelection(Pos(cm.firstLine(),0),Pos(cm.lastLine()),sel_dontScroll)}function filterChange(doc,change,update){var obj={canceled:!1,from:change.from,to:change.to,text:change.text,origin:change.origin,cancel:function(){return obj.canceled=!0}};return update&&(obj.update=function(from,to,text,origin){from&&(obj.from=clipPos(doc,from)),to&&(obj.to=clipPos(doc,to)),text&&(obj.text=text),void 0!==origin&&(obj.origin=origin)}),signal(doc,"beforeChange",doc,obj),doc.cm&&signal(doc.cm,"beforeChange",doc.cm,obj),obj.canceled?null:{from:obj.from,to:obj.to,text:obj.text,origin:obj.origin}}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,!0))){var split=sawReadOnlySpans&&!ignoreReadOnly&&removeReadOnlyRanges(doc,change.from,change.to);if(split)for(var i=split.length-1;i>=0;--i)makeChangeInner(doc,{from:split[i].from,to:split[i].to,text:i?[""]:change.text});else makeChangeInner(doc,change)}}function makeChangeInner(doc,change){if(1!=change.text.length||""!=change.text[0]||0!=cmp(change.from,change.to)){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){sharedHist||-1!=indexOf(rebased,doc.history)||(rebaseHist(doc.history,change),rebased.push(doc.history)),makeChangeSingleDoc(doc,change,null,stretchSpansOverChange(doc,change))})}}function makeChangeFromHistory(doc,type,allowSelectionOnly){if(!doc.cm||!doc.cm.state.suppressEdits||allowSelectionOnly){for(var event,hist=doc.history,selAfter=doc.sel,source="undo"==type?hist.done:hist.undone,dest="undo"==type?hist.undone:hist.done,i=0;i<source.length&&(event=source[i],allowSelectionOnly?!event.ranges||event.equals(doc.sel):event.ranges);i++);if(i!=source.length){for(hist.lastOrigin=hist.lastSelOrigin=null;(event=source.pop()).ranges;){if(pushSelectionToHistory(event,dest),allowSelectionOnly&&!event.equals(doc.sel))return void setSelection(doc,event,{clearRedo:!1});selAfter=event}var antiChanges=[];pushSelectionToHistory(selAfter,dest),dest.push({changes:antiChanges,generation:hist.generation}),hist.generation=event.generation||++hist.maxGeneration;for(var filter=hasHandler(doc,"beforeChange")||doc.cm&&hasHandler(doc.cm,"beforeChange"),i$1=event.changes.length-1;i$1>=0;--i$1){var returned=function(i){var change=event.changes[i];if(change.origin=type,filter&&!filterChange(doc,change,!1))return source.length=0,{};antiChanges.push(historyChangeFromChange(doc,change));var after=i?computeSelAfterChange(doc,change):lst(source);makeChangeSingleDoc(doc,change,after,mergeOldSpans(doc,change)),!i&&doc.cm&&doc.cm.scrollIntoView({from:change.from,to:changeEnd(change)});var rebased=[];linkedDocs(doc,function(doc,sharedHist){sharedHist||-1!=indexOf(rebased,doc.history)||(rebaseHist(doc.history,change),rebased.push(doc.history)),makeChangeSingleDoc(doc,change,null,mergeOldSpans(doc,change))})}(i$1);if(returned)return returned.v}}}}function shiftDoc(doc,distance){if(0!=distance&&(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),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")}}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));else if(!(change.from.line>doc.lastLine())){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();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),selAfter||(selAfter=computeSelAfterChange(doc,change)),doc.cm?makeChangeSingleDocInEditor(doc.cm,change,spans):updateDoc(doc,change,spans),setSelectionNoUndo(doc,selAfter,sel_dontScroll)}}function makeChangeSingleDocInEditor(cm,change,spans){var doc=cm.doc,display=cm.display,from=change.from,to=change.to,recomputeMaxLength=!1,checkWidthStart=from.line;cm.options.lineWrapping||(checkWidthStart=lineNo(visualLine(getLine(doc,from.line))),doc.iter(checkWidthStart,to.line+1,function(line){if(line==display.maxLine)return recomputeMaxLength=!0,!0})),doc.sel.contains(change.from,change.to)>-1&&signalCursorActivity(cm),updateDoc(doc,change,spans,estimateHeight(cm)),cm.options.lineWrapping||(doc.iter(checkWidthStart,from.line+change.text.length,function(line){var len=lineLength(line);len>display.maxLineLength&&(display.maxLine=line,display.maxLineLength=len,display.maxLineChanged=!0,recomputeMaxLength=!1)}),recomputeMaxLength&&(cm.curOp.updateMaxLine=!0)),retreatFrontier(doc,from.line),startWorker(cm,400);var lendiff=change.text.length-(to.line-from.line)-1;change.full?regChange(cm):from.line!=to.line||1!=change.text.length||isWholeLineUpdate(cm.doc,change)?regChange(cm,from.line,to.line+1,lendiff):regLineChange(cm,from.line,"text");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};changeHandler&&signalLater(cm,"change",cm,obj),changesHandler&&(cm.curOp.changeObjs||(cm.curOp.changeObjs=[])).push(obj)}cm.display.selForContextMenu=null}function replaceRange(doc,code,from,to,origin){if(to||(to=from),cmp(to,from)<0){var tmp=to;to=from,from=tmp}"string"==typeof code&&(code=doc.splitLines(code)),makeChange(doc,{from:from,to:to,text:code,origin:origin})}function rebaseHistSelSingle(pos,from,to,diff){to<pos.line?pos.line+=diff:from<pos.line&&(pos.line=from,pos.ch=0)}function rebaseHistArray(array,from,to,diff){for(var i=0;i<array.length;++i){var sub=array[i],ok=!0;if(sub.ranges){sub.copied||((sub=array[i]=sub.deepCopy()).copied=!0);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)}else{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=!1;break}}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)}function changeLine(doc,handle,changeType,op){var no=handle,line=handle;return"number"==typeof handle?line=getLine(doc,clipLine(doc,handle)):no=lineNo(handle),null==no?null:(op(line,no)&&doc.cm&&regLineChange(doc.cm,no,changeType),line)}function LeafChunk(lines){var this$1=this;this.lines=lines,this.parent=null;for(var height=0,i=0;i<lines.length;++i)lines[i].parent=this$1,height+=lines[i].height;this.height=height}function BranchChunk(children){var this$1=this;this.children=children;for(var size=0,height=0,i=0;i<children.length;++i){var ch=children[i];size+=ch.chunkSize(),height+=ch.height,ch.parent=this$1}this.size=size,this.height=height,this.parent=null}function adjustScrollWhenAboveVisible(cm,line,diff){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),cm=doc.cm;return cm&&widget.noHScroll&&(cm.display.alignWidgets=!0),changeLine(doc,handle,"widget",function(line){var widgets=line.widgets||(line.widgets=[]);if(null==widget.insertAt?widgets.push(widget):widgets.splice(Math.min(widgets.length-1,Math.max(0,widget.insertAt)),0,widget),widget.line=line,cm&&!lineIsHidden(doc,line)){var aboveVisible=heightAtLine(line)<doc.scrollTop;updateLineHeight(line,line.height+widgetHeight(widget)),aboveVisible&&addToScrollTop(cm,widget.height),cm.curOp.forceUpdate=!0}return!0}),signalLater(cm,"lineWidgetAdded",cm,widget,"number"==typeof handle?handle:lineNo(handle)),widget}function markText(doc,from,to,options,type){if(options&&options.shared)return markTextShared(doc,from,to,options,type);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,!1),diff>0||0==diff&&!1!==marker.clearWhenEmpty)return marker;if(marker.replacedWith&&(marker.collapsed=!0,marker.widgetNode=eltP("span",[marker.replacedWith],"CodeMirror-widget"),options.handleMouseEvents||marker.widgetNode.setAttribute("cm-ignore-events","true"),options.insertLeft&&(marker.widgetNode.insertLeft=!0)),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()}marker.addToHistory&&addChangeToHistory(doc,{from:from,to:to,origin:"markText"},doc.sel,NaN);var updateMaxLine,curLine=from.line,cm=doc.cm;if(doc.iter(curLine,to.line+1,function(line){cm&&marker.collapsed&&!cm.options.lineWrapping&&visualLine(line)==cm.display.maxLine&&(updateMaxLine=!0),marker.collapsed&&curLine!=from.line&&updateLineHeight(line,0),addMarkedSpan(line,new MarkedSpan(marker,curLine==from.line?from.ch:null,curLine==to.line?to.ch:null)),++curLine}),marker.collapsed&&doc.iter(from.line,to.line+1,function(line){lineIsHidden(doc,line)&&updateLineHeight(line,0)}),marker.clearOnEnter&&on(marker,"beforeCursorEnter",function(){return marker.clear()}),marker.readOnly&&(seeReadOnlySpans(),(doc.history.done.length||doc.history.undone.length)&&doc.clearHistory()),marker.collapsed&&(marker.id=++nextMarkerId,marker.atomic=!0),cm){if(updateMaxLine&&(cm.curOp.updateMaxLine=!0),marker.collapsed)regChange(cm,from.line,to.line+1);else if(marker.className||marker.title||marker.startStyle||marker.endStyle||marker.css)for(var i=from.line;i<=to.line;i++)regLineChange(cm,i,"text");marker.atomic&&reCheckSelection(cm.doc),signalLater(cm,"markerAdded",cm,marker)}return marker}function markTextShared(doc,from,to,options,type){(options=copyObj(options)).shared=!1;var markers=[markText(doc,from,to,options,type)],primary=markers[0],widget=options.widgetNode;return linkedDocs(doc,function(doc){widget&&(options.widgetNode=widget.cloneNode(!0)),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)}),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(),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){for(var i=0;i<markers.length;i++)!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];-1==indexOf(linked,subMarker.doc)&&(subMarker.parent=null,marker.markers.splice(j--,1))}}(i)}function onDrop(e){var cm=this;if(clearDragCursor(cm),!signalDOMEvent(cm,e)&&!eventInWidget(cm.display,e)){e_preventDefault(e),ie&&(lastDrop=+new Date);var pos=posFromMouse(cm,e,!0),files=e.dataTransfer.files;if(pos&&!cm.isReadOnly())if(files&&files.length&&window.FileReader&&window.File)for(var n=files.length,text=Array(n),read=0,i=0;i<n;++i)!function(file,i){if(!cm.options.allowDropFileTypes||-1!=indexOf(cm.options.allowDropFileTypes,file.type)){var reader=new FileReader;reader.onload=operation(cm,function(){var content=reader.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(content)&&(content=""),text[i]=content,++read==n){var change={from:pos=clipPos(cm.doc,pos),to:pos,text:cm.doc.splitLines(text.join(cm.doc.lineSeparator())),origin:"paste"};makeChange(cm.doc,change),setSelectionReplaceHistory(cm.doc,simpleSelection(pos,changeEnd(change)))}}),reader.readAsText(file)}}(files[i],i);else{if(cm.state.draggingText&&cm.doc.sel.contains(pos)>-1)return cm.state.draggingText(e),void setTimeout(function(){return cm.display.input.focus()},20);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)),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){}}}}function onDragStart(cm,e){if(ie&&(!cm.state.draggingText||+new Date-lastDrop<100))e_stop(e);else if(!signalDOMEvent(cm,e)&&!eventInWidget(cm.display,e)&&(e.dataTransfer.setData("Text",cm.getSelection()),e.dataTransfer.effectAllowed="copyMove",e.dataTransfer.setDragImage&&!safari)){var img=elt("img",null,null,"position: fixed; left: 0; top: 0;");img.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",presto&&(img.width=img.height=1,cm.display.wrapper.appendChild(img),img._top=img.offsetTop),e.dataTransfer.setDragImage(img,0,0),presto&&img.parentNode.removeChild(img)}}function onDragOver(cm,e){var pos=posFromMouse(cm,e);if(pos){var frag=document.createDocumentFragment();drawSelectionCursor(cm,pos,frag),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){cm.display.dragCursor&&(cm.display.lineSpace.removeChild(cm.display.dragCursor),cm.display.dragCursor=null)}function forEachCodeMirror(f){if(document.getElementsByClassName)for(var byClass=document.getElementsByClassName("CodeMirror"),i=0;i<byClass.length;i++){var cm=byClass[i].CodeMirror;cm&&f(cm)}}function ensureGlobalHandlers(){globalsRegistered||(registerGlobalHandlers(),globalsRegistered=!0)}function registerGlobalHandlers(){var resizeTimer;on(window,"resize",function(){null==resizeTimer&&(resizeTimer=setTimeout(function(){resizeTimer=null,forEachCodeMirror(onResize)},100))}),on(window,"blur",function(){return forEachCodeMirror(onBlur)})}function onResize(cm){var d=cm.display;d.lastWrapHeight==d.wrapper.clientHeight&&d.lastWrapWidth==d.wrapper.clientWidth||(d.cachedCharWidth=d.cachedTextHeight=d.cachedPaddingH=null,d.scrollbarsClipped=!1,cm.setSize())}function normalizeKeyName(name){var parts=name.split(/-(?!$)/);name=parts[parts.length-1];for(var alt,ctrl,shift,cmd,i=0;i<parts.length-1;i++){var mod=parts[i];if(/^(cmd|meta|m)$/i.test(mod))cmd=!0;else if(/^a(lt)?$/i.test(mod))alt=!0;else if(/^(c|ctrl|control)$/i.test(mod))ctrl=!0;else{if(!/^s(hift)?$/i.test(mod))throw new Error("Unrecognized modifier name: "+mod);shift=!0}}return alt&&(name="Alt-"+name),ctrl&&(name="Ctrl-"+name),cmd&&(name="Cmd-"+name),shift&&(name="Shift-"+name),name}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}for(var keys=map(keyname.split(" "),normalizeKeyName),i=0;i<keys.length;i++){var val=void 0,name=void 0;i==keys.length-1?(name=keys.join(" "),val=value):(name=keys.slice(0,i+1).join(" "),val="...");var prev=copy[name];if(prev){if(prev!=val)throw new Error("Inconsistent bindings for "+name)}else copy[name]=val}delete keymap[keyname]}for(var prop in copy)keymap[prop]=copy[prop];return keymap}function lookupKey(key,map$$1,handle,context){var found=(map$$1=getKeyMap(map$$1)).call?map$$1.call(key,context):map$$1[key];if(!1===found)return"nothing";if("..."===found)return"multi";if(null!=found&&handle(found))return"handled";if(map$$1.fallthrough){if("[object Array]"!=Object.prototype.toString.call(map$$1.fallthrough))return lookupKey(key,map$$1.fallthrough,handle,context);for(var i=0;i<map$$1.fallthrough.length;i++){var result=lookupKey(key,map$$1.fallthrough[i],handle,context);if(result)return result}}}function isModifierKey(value){var name="string"==typeof value?value:keyNames[value.keyCode];return"Ctrl"==name||"Alt"==name||"Shift"==name||"Mod"==name}function addModifierNames(name,event,noShift){var base=name;return event.altKey&&"Alt"!=base&&(name="Alt-"+name),(flipCtrlCmd?event.metaKey:event.ctrlKey)&&"Ctrl"!=base&&(name="Ctrl-"+name),(flipCtrlCmd?event.ctrlKey:event.metaKey)&&"Cmd"!=base&&(name="Cmd-"+name),!noShift&&event.shiftKey&&"Shift"!=base&&(name="Shift-"+name),name}function keyName(event,noShift){if(presto&&34==event.keyCode&&event.char)return!1;var name=keyNames[event.keyCode];return null!=name&&!event.altGraphKey&&addModifierNames(name,event,noShift)}function getKeyMap(val){return"string"==typeof val?keyMap[val]:val}function deleteNearSelection(cm,compute){for(var ranges=cm.doc.sel.ranges,kill=[],i=0;i<ranges.length;i++){for(var toKill=compute(ranges[i]);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)}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 lineStart(cm,lineN){var line=getLine(cm.doc,lineN),visual=visualLine(line);return visual!=line&&(lineN=lineNo(visual)),endOfLine(!0,cm,visual,lineN,1)}function lineEnd(cm,lineN){var line=getLine(cm.doc,lineN),visual=visualLineEnd(line);return visual!=line&&(lineN=lineNo(visual)),endOfLine(!0,cm,line,lineN,-1)}function lineStartSmart(cm,pos){var start=lineStart(cm,pos.line),line=getLine(cm.doc,start.line),order=getOrder(line,cm.doc.direction);if(!order||0==order[0].level){var firstNonWS=Math.max(0,line.text.search(/\S/)),inWS=pos.line==start.line&&pos.ch<=firstNonWS&&pos.ch;return Pos(start.line,inWS?0:firstNonWS,start.sticky)}return start}function doHandleBinding(cm,bound,dropShift){if("string"==typeof bound&&!(bound=commands[bound]))return!1;cm.display.input.ensurePolled();var prevShift=cm.display.shift,done=!1;try{cm.isReadOnly()&&(cm.state.suppressEdits=!0),dropShift&&(cm.display.shift=!1),done=bound(cm)!=Pass}finally{cm.display.shift=prevShift,cm.state.suppressEdits=!1}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)}function dispatchKey(cm,name,e,handle){var seq=cm.state.keySeq;if(seq){if(isModifierKey(name))return"handled";stopSeq.set(50,function(){cm.state.keySeq==seq&&(cm.state.keySeq=null,cm.display.input.reset())}),name=seq+" "+name}var result=lookupKeyForEditor(cm,name,handle);return"multi"==result&&(cm.state.keySeq=name),"handled"==result&&signalLater(cm,"keyHandled",cm,name,e),"handled"!=result&&"multi"!=result||(e_preventDefault(e),restartBlink(cm)),seq&&!result&&/\'$/.test(name)?(e_preventDefault(e),!0):!!result}function handleKeyBinding(cm,e){var name=keyName(e,!0);return!!name&&(e.shiftKey&&!cm.state.keySeq?dispatchKey(cm,"Shift-"+name,e,function(b){return doHandleBinding(cm,b,!0)})||dispatchKey(cm,name,e,function(b){if("string"==typeof b?/^go[A-Z]/.test(b):b.motion)return doHandleBinding(cm,b)}):dispatchKey(cm,name,e,function(b){return doHandleBinding(cm,b)}))}function handleCharBinding(cm,e,ch){return dispatchKey(cm,"'"+ch+"'",e,function(b){return doHandleBinding(cm,b,!0)})}function onKeyDown(e){var cm=this;if(cm.curOp.focus=activeElt(),!signalDOMEvent(cm,e)){ie&&ie_version<11&&27==e.keyCode&&(e.returnValue=!1);var code=e.keyCode;cm.display.shift=16==code||e.shiftKey;var handled=handleKeyBinding(cm,e);presto&&(lastStoppedKey=handled?code:null,!handled&&88==code&&!hasCopyEvent&&(mac?e.metaKey:e.ctrlKey)&&cm.replaceSelection("",null,"cut")),18!=code||/\bCodeMirror-crosshair\b/.test(cm.display.lineDiv.className)||showCrossHair(cm)}}function showCrossHair(cm){function up(e){18!=e.keyCode&&e.altKey||(rmClass(lineDiv,"CodeMirror-crosshair"),off(document,"keyup",up),off(document,"mouseover",up))}var lineDiv=cm.display.lineDiv;addClass(lineDiv,"CodeMirror-crosshair"),on(document,"keyup",up),on(document,"mouseover",up)}function onKeyUp(e){16==e.keyCode&&(this.doc.sel.shift=!1),signalDOMEvent(this,e)}function onKeyPress(e){var cm=this;if(!(eventInWidget(cm.display,e)||signalDOMEvent(cm,e)||e.ctrlKey&&!e.altKey||mac&&e.metaKey)){var keyCode=e.keyCode,charCode=e.charCode;if(presto&&keyCode==lastStoppedKey)return lastStoppedKey=null,void e_preventDefault(e);if(!presto||e.which&&!(e.which<10)||!handleKeyBinding(cm,e)){var ch=String.fromCharCode(null==charCode?keyCode:charCode);"\b"!=ch&&(handleCharBinding(cm,e,ch)||cm.display.input.onKeyPress(e))}}}function clickRepeat(pos,button){var now=+new Date;return lastDoubleClick&&lastDoubleClick.compare(now,pos,button)?(lastClick=lastDoubleClick=null,"triple"):lastClick&&lastClick.compare(now,pos,button)?(lastDoubleClick=new PastClick(now,pos,button),lastClick=null,"double"):(lastClick=new PastClick(now,pos,button),lastDoubleClick=null,"single")}function onMouseDown(e){var cm=this,display=cm.display;if(!(signalDOMEvent(cm,e)||display.activeTouch&&display.input.supportsTouch()))if(display.input.ensurePolled(),display.shift=e.shiftKey,eventInWidget(display,e))webkit||(display.scroller.draggable=!1,setTimeout(function(){return display.scroller.draggable=!0},100));else if(!clickInGutter(cm,e)){var pos=posFromMouse(cm,e),button=e_button(e),repeat=pos?clickRepeat(pos,button):"single";window.focus(),1==button&&cm.state.selectingText&&cm.state.selectingText(e),pos&&handleMappedButton(cm,button,pos,repeat,e)||(1==button?pos?leftButtonDown(cm,pos,repeat,e):e_target(e)==display.scroller&&e_preventDefault(e):2==button?(pos&&extendSelection(cm.doc,pos),setTimeout(function(){return display.input.focus()},20)):3==button&&(captureRightClick?onContextMenu(cm,e):delayBlurEvent(cm)))}}function handleMappedButton(cm,button,pos,repeat,event){var name="Click";return"double"==repeat?name="Double"+name:"triple"==repeat&&(name="Triple"+name),name=(1==button?"Left":2==button?"Middle":"Right")+name,dispatchKey(cm,addModifierNames(name,event),event,function(bound){if("string"==typeof bound&&(bound=commands[bound]),!bound)return!1;var done=!1;try{cm.isReadOnly()&&(cm.state.suppressEdits=!0),done=bound(cm,pos)!=Pass}finally{cm.state.suppressEdits=!1}return done})}function configureMouse(cm,repeat,event){var option=cm.getOption("configureMouse"),value=option?option(cm,repeat,event):{};if(null==value.unit){var rect=chromeOS?event.shiftKey&&event.metaKey:event.altKey;value.unit=rect?"rectangle":"single"==repeat?"char":"double"==repeat?"word":"line"}return(null==value.extend||cm.doc.extend)&&(value.extend=cm.doc.extend||event.shiftKey),null==value.addNew&&(value.addNew=mac?event.metaKey:event.ctrlKey),null==value.moveOnDrag&&(value.moveOnDrag=!(mac?event.altKey:event.ctrlKey)),value}function leftButtonDown(cm,pos,repeat,event){ie?setTimeout(bind(ensureFocus,cm),0):cm.curOp.focus=activeElt();var contained,behavior=configureMouse(cm,repeat,event),sel=cm.doc.sel;cm.options.dragDrop&&dragAndDrop&&!cm.isReadOnly()&&"single"==repeat&&(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):leftButtonSelect(cm,event,pos,behavior)}function leftButtonStartDrag(cm,event,pos,behavior){var display=cm.display,moved=!1,dragEnd=operation(cm,function(e){webkit&&(display.scroller.draggable=!1),cm.state.draggingText=!1,off(document,"mouseup",dragEnd),off(document,"mousemove",mouseMove),off(display.scroller,"dragstart",dragStart),off(display.scroller,"drop",dragEnd),moved||(e_preventDefault(e),behavior.addNew||extendSelection(cm.doc,pos,null,null,behavior.extend),webkit||ie&&9==ie_version?setTimeout(function(){document.body.focus(),display.input.focus()},20):display.input.focus())}),mouseMove=function(e2){moved=moved||Math.abs(event.clientX-e2.clientX)+Math.abs(event.clientY-e2.clientY)>=10},dragStart=function(){return moved=!0};webkit&&(display.scroller.draggable=!0),cm.state.draggingText=dragEnd,dragEnd.copy=!behavior.moveOnDrag,display.scroller.dragDrop&&display.scroller.dragDrop(),on(document,"mouseup",dragEnd),on(document,"mousemove",mouseMove),on(display.scroller,"dragstart",dragStart),on(display.scroller,"drop",dragEnd),delayBlurEvent(cm),setTimeout(function(){return display.input.focus()},20)}function rangeForUnit(cm,pos,unit){if("char"==unit)return new Range(pos,pos);if("word"==unit)return cm.findWordAt(pos);if("line"==unit)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)}function leftButtonSelect(cm,event,start,behavior){function extendTo(pos){if(0!=cmp(lastPos,pos))if(lastPos=pos,"rectangle"==behavior.unit){for(var ranges=[],tabSize=cm.options.tabSize,startCol=countColumn(getLine(doc,start.line).text,start.ch,tabSize),posCol=countColumn(getLine(doc,pos.line).text,pos.ch,tabSize),left=Math.min(startCol,posCol),right=Math.max(startCol,posCol),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);left==right?ranges.push(new Range(Pos(line,leftPos),Pos(line,leftPos))):text.length>leftPos&&ranges.push(new Range(Pos(line,leftPos),Pos(line,findColumn(text,right,tabSize))))}ranges.length||ranges.push(new Range(start,start)),setSelection(doc,normalizeSelection(startSel.ranges.slice(0,ourIndex).concat(ranges),ourIndex),{origin:"*mouse",scroll:!1}),cm.scrollIntoView(pos)}else{var head,oldRange=ourRange,range$$1=rangeForUnit(cm,pos,behavior.unit),anchor=oldRange.anchor;cmp(range$$1.anchor,anchor)>0?(head=range$$1.head,anchor=minPos(oldRange.from(),range$$1.anchor)):(head=range$$1.anchor,anchor=maxPos(oldRange.to(),range$$1.head));var ranges$1=startSel.ranges.slice(0);ranges$1[ourIndex]=new Range(clipPos(doc,anchor),head),setSelection(doc,normalizeSelection(ranges$1,ourIndex),sel_mouse)}}function extend(e){var curCount=++counter,cur=posFromMouse(cm,e,!0,"rectangle"==behavior.unit);if(cur)if(0!=cmp(cur,lastPos)){cm.curOp.focus=activeElt(),extendTo(cur);var visible=visibleLines(display,doc);(cur.line>=visible.to||cur.line<visible.from)&&setTimeout(operation(cm,function(){counter==curCount&&extend(e)}),150)}else{var outside=e.clientY<editorSize.top?-20:e.clientY>editorSize.bottom?20:0;outside&&setTimeout(operation(cm,function(){counter==curCount&&(display.scroller.scrollTop+=outside,extend(e))}),50)}}function done(e){cm.state.selectingText=!1,counter=1/0,e_preventDefault(e),display.input.focus(),off(document,"mousemove",move),off(document,"mouseup",up),doc.history.lastSelOrigin=null}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),ourRange=ourIndex>-1?ranges[ourIndex]:new Range(start,start)):(ourRange=doc.sel.primary(),ourIndex=doc.sel.primIndex),"rectangle"==behavior.unit)behavior.addNew||(ourRange=new Range(start,start)),start=posFromMouse(cm,event,!0,!0),ourIndex=-1;else{var range$$1=rangeForUnit(cm,start,behavior.unit);ourRange=behavior.extend?extendRange(ourRange,range$$1.anchor,range$$1.head,behavior.extend):range$$1}behavior.addNew?-1==ourIndex?(ourIndex=ranges.length,setSelection(doc,normalizeSelection(ranges.concat([ourRange]),ourIndex),{scroll:!1,origin:"*mouse"})):ranges.length>1&&ranges[ourIndex].empty()&&"char"==behavior.unit&&!behavior.extend?(setSelection(doc,normalizeSelection(ranges.slice(0,ourIndex).concat(ranges.slice(ourIndex+1)),0),{scroll:!1,origin:"*mouse"}),startSel=doc.sel):replaceOneSelection(doc,ourIndex,ourRange,sel_mouse):(ourIndex=0,setSelection(doc,new Selection([ourRange],0),sel_mouse),startSel=doc.sel);var lastPos=start,editorSize=display.wrapper.getBoundingClientRect(),counter=0,move=operation(cm,function(e){e_button(e)?extend(e):done(e)}),up=operation(cm,done);cm.state.selectingText=up,on(document,"mousemove",move),on(document,"mouseup",up)}function gutterEvent(cm,e,type,prevent){var mX,mY;try{mX=e.clientX,mY=e.clientY}catch(e){return!1}if(mX>=Math.floor(cm.display.gutters.getBoundingClientRect().right))return!1;prevent&&e_preventDefault(e);var display=cm.display,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.options.gutters.length;++i){var g=display.gutters.childNodes[i];if(g&&g.getBoundingClientRect().right>=mX)return signal(cm,type,cm,lineAtHeight(cm.doc,mY),cm.options.gutters[i],e),e_defaultPrevented(e)}}function clickInGutter(cm,e){return gutterEvent(cm,e,"gutterClick",!0)}function onContextMenu(cm,e){eventInWidget(cm.display,e)||contextMenuInGutter(cm,e)||signalDOMEvent(cm,e,"contextmenu")||cm.display.input.onContextMenu(e)}function contextMenuInGutter(cm,e){return!!hasHandler(cm,"gutterContextMenu")&&gutterEvent(cm,e,"gutterContextMenu",!1)}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)}function guttersChanged(cm){updateGutters(cm),regChange(cm),alignHorizontally(cm)}function dragDropChanged(cm,value,old){if(!value!=!(old&&old!=Init)){var funcs=cm.display.dragFunctions,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){cm.options.lineWrapping?(addClass(cm.display.wrapper,"CodeMirror-wrap"),cm.display.sizer.style.minWidth="",cm.display.sizerWidth=null):(rmClass(cm.display.wrapper,"CodeMirror-wrap"),findMaxLine(cm)),estimateLineHeights(cm),regChange(cm),clearCaches(cm),setTimeout(function(){return updateScrollbars(cm)},100)}function CodeMirror$1(place,options){var this$1=this;if(!(this instanceof CodeMirror$1))return new CodeMirror$1(place,options);this.options=options=options?copyObj(options):{},copyObj(defaults,options,!1),setGuttersForLineNumbers(options);var doc=options.value;"string"==typeof doc&&(doc=new Doc(doc,options.mode,null,options.lineSeparator,options.direction)),this.doc=doc;var input=new CodeMirror$1.inputStyles[options.inputStyle](this),display=this.display=new Display(place,doc,input);display.wrapper.CodeMirror=this,updateGutters(this),themeChanged(this),options.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),initScrollbars(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,selectingText:!1,draggingText:!1,highlight:new Delayed,keySeq:null,specialChars:null},options.autofocus&&!mobile&&display.input.focus(),ie&&ie_version<11&&setTimeout(function(){return this$1.display.input.reset(!0)},20),registerEventHandlers(this),ensureGlobalHandlers(),startOperation(this),this.curOp.forceUpdate=!0,attachDoc(this,doc),options.autofocus&&!mobile||this.hasFocus()?setTimeout(bind(onFocus,this),20):onBlur(this);for(var opt in optionHandlers)optionHandlers.hasOwnProperty(opt)&&optionHandlers[opt](this$1,options[opt],Init);maybeUpdateLineNumberWidth(this),options.finishInit&&options.finishInit(this);for(var i=0;i<initHooks.length;++i)initHooks[i](this$1);endOperation(this),webkit&&options.lineWrapping&&"optimizelegibility"==getComputedStyle(display.lineDiv).textRendering&&(display.lineDiv.style.textRendering="auto")}function registerEventHandlers(cm){function finishTouch(){d.activeTouch&&(touchFinished=setTimeout(function(){return d.activeTouch=null},1e3),(prevTouch=d.activeTouch).end=+new Date)}function isMouseLikeTouchEvent(e){if(1!=e.touches.length)return!1;var touch=e.touches[0];return touch.radiusX<=1&&touch.radiusY<=1}function farAway(touch,other){if(null==other.left)return!0;var dx=other.left-touch.left,dy=other.top-touch.top;return dx*dx+dy*dy>400}var d=cm.display;on(d.scroller,"mousedown",operation(cm,onMouseDown)),ie&&ie_version<11?on(d.scroller,"dblclick",operation(cm,function(e){if(!signalDOMEvent(cm,e)){var pos=posFromMouse(cm,e);if(pos&&!clickInGutter(cm,e)&&!eventInWidget(cm.display,e)){e_preventDefault(e);var word=cm.findWordAt(pos);extendSelection(cm.doc,word.anchor,word.head)}}})):on(d.scroller,"dblclick",function(e){return signalDOMEvent(cm,e)||e_preventDefault(e)}),captureRightClick||on(d.scroller,"contextmenu",function(e){return onContextMenu(cm,e)});var touchFinished,prevTouch={end:0};on(d.scroller,"touchstart",function(e){if(!signalDOMEvent(cm,e)&&!isMouseLikeTouchEvent(e)){d.input.ensurePolled(),clearTimeout(touchFinished);var now=+new Date;d.activeTouch={start:now,moved:!1,prev:now-prevTouch.end<=300?prevTouch:null},1==e.touches.length&&(d.activeTouch.left=e.touches[0].pageX,d.activeTouch.top=e.touches[0].pageY)}}),on(d.scroller,"touchmove",function(){d.activeTouch&&(d.activeTouch.moved=!0)}),on(d.scroller,"touchend",function(e){var touch=d.activeTouch;if(touch&&!eventInWidget(d,e)&&null!=touch.left&&!touch.moved&&new Date-touch.start<300){var range,pos=cm.coordsChar(d.activeTouch,"page");range=!touch.prev||farAway(touch,touch.prev)?new Range(pos,pos):!touch.prev.prev||farAway(touch,touch.prev.prev)?cm.findWordAt(pos):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),on(d.scroller,"scroll",function(){d.scroller.clientHeight&&(updateScrollTop(cm,d.scroller.scrollTop),setScrollLeft(cm,d.scroller.scrollLeft,!0),signal(cm,"scroll",cm))}),on(d.scroller,"mousewheel",function(e){return onScrollWheel(cm,e)}),on(d.scroller,"DOMMouseScroll",function(e){return onScrollWheel(cm,e)}),on(d.wrapper,"scroll",function(){return d.wrapper.scrollTop=d.wrapper.scrollLeft=0}),d.dragFunctions={enter:function(e){signalDOMEvent(cm,e)||e_stop(e)},over:function(e){signalDOMEvent(cm,e)||(onDragOver(cm,e),e_stop(e))},start:function(e){return onDragStart(cm,e)},drop:operation(cm,onDrop),leave:function(e){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)})}function indentLine(cm,n,how,aggressive){var state,doc=cm.doc;null==how&&(how="add"),"smart"==how&&(doc.mode.indent?state=getContextBefore(cm,n).state:how="prev");var tabSize=cm.options.tabSize,line=getLine(doc,n),curSpace=countColumn(line.text,null,tabSize);line.stateAfter&&(line.stateAfter=null);var indentation,curSpaceString=line.text.match(/^\s*/)[0];if(aggressive||/\S/.test(line.text)){if("smart"==how&&((indentation=doc.mode.indent(state,line.text.slice(curSpaceString.length),line.text))==Pass||indentation>150)){if(!aggressive)return;how="prev"}}else indentation=0,how="not";"prev"==how?indentation=n>doc.first?countColumn(getLine(doc,n-1).text,null,tabSize):0:"add"==how?indentation=curSpace+cm.options.indentUnit:"subtract"==how?indentation=curSpace-cm.options.indentUnit:"number"==typeof how&&(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)),indentString!=curSpaceString)return replaceRange(doc,indentString,Pos(n,0),Pos(n,curSpaceString.length),"+input"),line.stateAfter=null,!0;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}}}function setLastCopied(newLastCopied){lastCopied=newLastCopied}function applyTextInput(cm,inserted,deleted,sel,origin){var doc=cm.doc;cm.display.shift=!1,sel||(sel=doc.sel);var paste=cm.state.pasteIncoming||"paste"==origin,textLines=splitLinesAuto(inserted),multiPaste=null;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 textLines.length==sel.ranges.length&&cm.options.pasteLinesPerSelection&&(multiPaste=map(textLines,function(l){return[l]}));for(var updateInput,i$1=sel.ranges.length-1;i$1>=0;i$1--){var range$$1=sel.ranges[i$1],from=range$$1.from(),to=range$$1.to();range$$1.empty()&&(deleted&&deleted>0?from=Pos(from.line,from.ch-deleted):cm.state.overwrite&&!paste?to=Pos(to.line,Math.min(getLine(doc,to.line).text.length,to.ch+lst(textLines).length)):lastCopied&&lastCopied.lineWise&&lastCopied.text.join("\n")==inserted&&(from=to=Pos(from.line,0))),updateInput=cm.curOp.updateInput;var changeEvent={from:from,to:to,text:multiPaste?multiPaste[i$1%multiPaste.length]:textLines,origin:origin||(paste?"paste":cm.state.cutIncoming?"cut":"+input")};makeChange(cm.doc,changeEvent),signalLater(cm,"inputRead",cm,changeEvent)}inserted&&!paste&&triggerElectric(cm,inserted),ensureCursorVisible(cm),cm.curOp.updateInput=updateInput,cm.curOp.typing=!0,cm.state.pasteIncoming=cm.state.cutIncoming=!1}function handlePaste(e,cm){var pasted=e.clipboardData&&e.clipboardData.getData("Text");if(pasted)return e.preventDefault(),cm.isReadOnly()||cm.options.disableInput||runInOp(cm,function(){return applyTextInput(cm,pasted,0,null,"paste")}),!0}function triggerElectric(cm,inserted){if(cm.options.electricChars&&cm.options.smartIndent)for(var sel=cm.doc.sel,i=sel.ranges.length-1;i>=0;i--){var range$$1=sel.ranges[i];if(!(range$$1.head.ch>100||i&&sel.ranges[i-1].head.line==range$$1.head.line)){var mode=cm.getModeAt(range$$1.head),indented=!1;if(mode.electricChars){for(var j=0;j<mode.electricChars.length;j++)if(inserted.indexOf(mode.electricChars.charAt(j))>-1){indented=indentLine(cm,range$$1.head.line,"smart");break}}else mode.electricInput&&mode.electricInput.test(getLine(cm.doc,range$$1.head.line).text.slice(0,range$$1.head.ch))&&(indented=indentLine(cm,range$$1.head.line,"smart"));indented&&signalLater(cm,"electricInput",cm,range$$1.head.line)}}}function copyableRanges(cm){for(var text=[],ranges=[],i=0;i<cm.doc.sel.ranges.length;i++){var line=cm.doc.sel.ranges[i].head.line,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){field.setAttribute("autocorrect","off"),field.setAttribute("autocapitalize","off"),field.setAttribute("spellcheck",!!spellcheck)}function hiddenTextarea(){var te=elt("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),div=elt("div",[te],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return webkit?te.style.width="1000px":te.setAttribute("wrap","off"),ios&&(te.style.border="1px solid black"),disableBrowserMagic(te),div}function findPosH(doc,pos,dir,unit,visually){function findNextLine(){var l=pos.line+dir;return!(l<doc.first||l>=doc.first+doc.size)&&(pos=new Pos(l,pos.ch,pos.sticky),lineObj=getLine(doc,l))}function moveOnce(boundToLine){var next;if(null==(next=visually?moveVisually(doc.cm,lineObj,pos,dir):moveLogically(lineObj,pos,dir))){if(boundToLine||!findNextLine())return!1;pos=endOfLine(visually,doc.cm,lineObj,pos.line,dir)}else pos=next;return!0}var oldPos=pos,origDir=dir,lineObj=getLine(doc,pos.line);if("char"==unit)moveOnce();else if("column"==unit)moveOnce(!0);else if("word"==unit||"group"==unit)for(var sawType=null,group="group"==unit,helper=doc.cm&&doc.cm.getHelper(pos,"wordChars"),first=!0;!(dir<0)||moveOnce(!first);first=!1){var cur=lineObj.text.charAt(pos.ch)||"\n",type=isWordChar(cur,helper)?"w":group&&"\n"==cur?"n":!group||/\s/.test(cur)?null:"p";if(!group||first||type||(type="s"),sawType&&sawType!=type){dir<0&&(dir=1,moveOnce(),pos.sticky="after");break}if(type&&(sawType=type),dir>0&&!moveOnce(!first))break}var result=skipAtomic(doc,pos,oldPos,origDir,!0);return equalCursorPos(oldPos,result)&&(result.hitSide=!0),result}function findPosV(cm,pos,dir,unit){var y,doc=cm.doc,x=pos.left;if("page"==unit){var pageSize=Math.min(cm.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),moveAmount=Math.max(pageSize-.5*textHeight(cm.display),3);y=(dir>0?pos.bottom:pos.top)+dir*moveAmount}else"line"==unit&&(y=dir>0?pos.bottom+3:pos.top-3);for(var target;(target=coordsChar(cm,x,y)).outside;){if(dir<0?y<=0:y>=doc.height){target.hitSide=!0;break}y+=5*dir}return target}function posToDOM(cm,pos){var view=findViewForLine(cm,pos.line);if(!view||view.hidden)return null;var line=getLine(cm.doc,pos.line),info=mapFromLineView(view,line,pos.line),order=getOrder(line,cm.doc.direction),side="left";order&&(side=getBidiPartAt(order,pos.ch)%2?"right":"left");var result=nodeAndOffsetInLineMap(info.map,pos.ch,side);return result.offset="right"==result.collapse?result.end:result.start,result}function isInGutter(node){for(var scan=node;scan;scan=scan.parentNode)if(/CodeMirror-gutter-wrapper/.test(scan.className))return!0;return!1}function badPos(pos,bad){return bad&&(pos.bad=!0),pos}function domTextBetween(cm,from,to,fromLine,toLine){function recognizeMarker(id){return function(marker){return marker.id==id}}function close(){closing&&(text+=lineSep,closing=!1)}function addText(str){str&&(close(),text+=str)}function walk(node){if(1==node.nodeType){var cmText=node.getAttribute("cm-text");if(null!=cmText)return void addText(cmText||node.textContent.replace(/\u200b/g,""));var range$$1,markerID=node.getAttribute("cm-marker");if(markerID){var found=cm.findMarks(Pos(fromLine,0),Pos(toLine+1,0),recognizeMarker(+markerID));return void(found.length&&(range$$1=found[0].find())&&addText(getBetween(cm.doc,range$$1.from,range$$1.to).join(lineSep)))}if("false"==node.getAttribute("contenteditable"))return;var isBlock=/^(pre|div|p)$/i.test(node.nodeName);isBlock&&close();for(var i=0;i<node.childNodes.length;i++)walk(node.childNodes[i]);isBlock&&(closing=!0)}else 3==node.nodeType&&addText(node.nodeValue)}for(var text="",closing=!1,lineSep=cm.doc.lineSeparator();walk(from),from!=to;)from=from.nextSibling;return text}function domToPos(cm,node,offset){var lineNode;if(node==cm.display.lineDiv){if(!(lineNode=cm.display.lineDiv.childNodes[offset]))return badPos(cm.clipPos(Pos(cm.display.viewTo-1)),!0);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){function find(textNode,topNode,offset){for(var i=-1;i<(maps?maps.length:0);i++)for(var map$$1=i<0?measure.map:maps[i],j=0;j<map$$1.length;j+=3){var curNode=map$$1[j+2];if(curNode==textNode||curNode==topNode){var line=lineNo(i<0?lineView.line:lineView.rest[i]),ch=map$$1[j]+offset;return(offset<0||curNode!=textNode)&&(ch=map$$1[j+(offset?1:0)]),Pos(line,ch)}}}var wrapper=lineView.text.firstChild,bad=!1;if(!node||!contains(wrapper,node))return badPos(Pos(lineNo(lineView.line),0),!0);if(node==wrapper&&(bad=!0,node=wrapper.childNodes[offset],offset=0,!node)){var line=lineView.rest?lst(lineView.rest):lineView.line;return badPos(Pos(lineNo(line),line.text.length),bad)}var textNode=3==node.nodeType?node:null,topNode=node;for(textNode||1!=node.childNodes.length||3!=node.firstChild.nodeType||(textNode=node.firstChild,offset&&(offset=textNode.nodeValue.length));topNode.parentNode!=wrapper;)topNode=topNode.parentNode;var measure=lineView.measure,maps=measure.maps,found=find(textNode,topNode,offset);if(found)return badPos(found,bad);for(var after=topNode.nextSibling,dist=textNode?textNode.nodeValue.length-offset:0;after;after=after.nextSibling){if(found=find(after,after.firstChild,0))return badPos(Pos(found.line,found.ch-dist),bad);dist+=after.textContent.length}for(var before=topNode.previousSibling,dist$1=offset;before;before=before.previousSibling){if(found=find(before,before.firstChild,-1))return badPos(Pos(found.line,found.ch+dist$1),bad);dist$1+=before.textContent.length}}var userAgent=navigator.userAgent,platform=navigator.platform,gecko=/gecko\/\d/i.test(userAgent),ie_upto10=/MSIE \d/.test(userAgent),ie_11up=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(userAgent),edge=/Edge\/(\d+)/.exec(userAgent),ie=ie_upto10||ie_11up||edge,ie_version=ie&&(ie_upto10?document.documentMode||6:+(edge||ie_11up)[1]),webkit=!edge&&/WebKit\//.test(userAgent),qtwebkit=webkit&&/Qt\/\d+\.\d+/.test(userAgent),chrome=!edge&&/Chrome\//.test(userAgent),presto=/Opera\//.test(userAgent),safari=/Apple Computer/.test(navigator.vendor),mac_geMountainLion=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent),phantom=/PhantomJS/.test(userAgent),ios=!edge&&/AppleWebKit/.test(userAgent)&&/Mobile\/\w+/.test(userAgent),android=/Android/.test(userAgent),mobile=ios||android||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent),mac=ios||/Mac/.test(platform),chromeOS=/\bCrOS\b/.test(userAgent),windows=/win/i.test(platform),presto_version=presto&&userAgent.match(/Version\/(\d*\.\d*)/);presto_version&&(presto_version=Number(presto_version[1])),presto_version&&presto_version>=15&&(presto=!1,webkit=!0);var range,flipCtrlCmd=mac&&(qtwebkit||presto&&(null==presto_version||presto_version<12.11)),captureRightClick=gecko||ie&&ie_version>=9,rmClass=function(node,cls){var current=node.className,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:"")}};range=document.createRange?function(node,start,end,endNode){var r=document.createRange();return r.setEnd(endNode||node,end),r.setStart(node,start),r}:function(node,start,end){var r=document.body.createTextRange();try{r.moveToElementText(node.parentNode)}catch(e){return r}return r.collapse(!0),r.moveEnd("character",end),r.moveStart("character",start),r};var selectInput=function(node){node.select()};ios?selectInput=function(node){node.selectionStart=0,node.selectionEnd=node.value.length}:ie&&(selectInput=function(node){try{node.select()}catch(_e){}});var Delayed=function(){this.id=null};Delayed.prototype.set=function(ms,f){clearTimeout(this.id),this.id=setTimeout(f,ms)};var zwspSupported,badBidiRects,scrollerGap=30,Pass={toString:function(){return"CodeMirror.Pass"}},sel_dontScroll={scroll:!1},sel_mouse={origin:"*mouse"},sel_move={origin:"+move"},spaceStrs=[""],nonASCIISingleCaseWordChar=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,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]/,sawReadOnlySpans=!1,sawCollapsedSpans=!1,bidiOther=null,bidiOrdering=function(){function charType(code){return code<=247?lowTypes.charAt(code):1424<=code&&code<=1524?"R":1536<=code&&code<=1785?arabicTypes.charAt(code-1536):1774<=code&&code<=2220?"r":8192<=code&&code<=8203?"w":8204==code?"b":"L"}function BidiSpan(level,from,to){this.level=level,this.from=from,this.to=to}var 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]/;return function(str,direction){var outerType="ltr"==direction?"L":"R";if(0==str.length||"ltr"==direction&&!bidiRE.test(str))return!1;for(var len=str.length,types=[],i=0;i<len;++i)types.push(charType(str.charCodeAt(i)));for(var i$1=0,prev=outerType;i$1<len;++i$1){var type=types[i$1];"m"==type?types[i$1]=prev:prev=type}for(var i$2=0,cur=outerType;i$2<len;++i$2){var type$1=types[i$2];"1"==type$1&&"r"==cur?types[i$2]="n":isStrong.test(type$1)&&(cur=type$1,"r"==type$1&&(types[i$2]="R"))}for(var i$3=1,prev$1=types[0];i$3<len-1;++i$3){var type$2=types[i$3];"+"==type$2&&"1"==prev$1&&"1"==types[i$3+1]?types[i$3]="1":","!=type$2||prev$1!=types[i$3+1]||"1"!=prev$1&&"n"!=prev$1||(types[i$3]=prev$1),prev$1=type$2}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);for(var replace=i$4&&"!"==types[i$4-1]||end<len&&"1"==types[end]?"1":"N",j=i$4;j<end;++j)types[j]=replace;i$4=end-1}}for(var i$5=0,cur$1=outerType;i$5<len;++i$5){var type$4=types[i$5];"L"==cur$1&&"1"==type$4?types[i$5]="L":isStrong.test(type$4)&&(cur$1=type$4)}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);for(var before="L"==(i$6?types[i$6-1]:outerType),replace$1=before==("L"==(end$1<len?types[end$1]:outerType))?before?"L":"R":outerType,j$1=i$6;j$1<end$1;++j$1)types[j$1]=replace$1;i$6=end$1-1}for(var m,order=[],i$7=0;i$7<len;)if(countsAsLeft.test(types[i$7])){var start=i$7;for(++i$7;i$7<len&&countsAsLeft.test(types[i$7]);++i$7);order.push(new BidiSpan(0,start,i$7))}else{var pos=i$7,at=order.length;for(++i$7;i$7<len&&"L"!=types[i$7];++i$7);for(var j$2=pos;j$2<i$7;)if(countsAsNum.test(types[j$2])){pos<j$2&&order.splice(at,0,new BidiSpan(1,pos,j$2));var nstart=j$2;for(++j$2;j$2<i$7&&countsAsNum.test(types[j$2]);++j$2);order.splice(at,0,new BidiSpan(2,nstart,j$2)),pos=j$2}else++j$2;pos<i$7&&order.splice(at,0,new BidiSpan(1,pos,i$7))}return 1==order[0].level&&(m=str.match(/^\s+/))&&(order[0].from=m[0].length,order.unshift(new BidiSpan(0,0,m[0].length))),1==lst(order).level&&(m=str.match(/\s+$/))&&(lst(order).to-=m[0].length,order.push(new BidiSpan(0,len-m[0].length,len))),"rtl"==direction?order.reverse():order}}(),noHandlers=[],on=function(emitter,type,f){if(emitter.addEventListener)emitter.addEventListener(type,f,!1);else if(emitter.attachEvent)emitter.attachEvent("on"+type,f);else{var map$$1=emitter._handlers||(emitter._handlers={});map$$1[type]=(map$$1[type]||noHandlers).concat(f)}},dragAndDrop=function(){if(ie&&ie_version<9)return!1;var div=elt("div");return"draggable"in div||"dragDrop"in div}(),splitLinesAuto=3!="\n\nb".split(/\n/).length?function(string){for(var pos=0,result=[],l=string.length;pos<=l;){var nl=string.indexOf("\n",pos);-1==nl&&(nl=string.length);var line=string.slice(pos,"\r"==string.charAt(nl-1)?nl-1:nl),rt=line.indexOf("\r");-1!=rt?(result.push(line.slice(0,rt)),pos+=rt+1):(result.push(line),pos=nl+1)}return result}:function(string){return string.split(/\r\n?|\n/)},hasSelection=window.getSelection?function(te){try{return te.selectionStart!=te.selectionEnd}catch(e){return!1}}:function(te){var range$$1;try{range$$1=te.ownerDocument.selection.createRange()}catch(e){}return!(!range$$1||range$$1.parentElement()!=te)&&0!=range$$1.compareEndPoints("StartToEnd",range$$1)},hasCopyEvent=function(){var e=elt("div");return"oncopy"in e||(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy)}(),badZoomedRects=null,modes={},mimeModes={},modeExtensions={},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)||void 0},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);if("string"==typeof match?ch==match:ch&&(match.test?match.test(ch):match(ch)))return++this.pos,ch},StringStream.prototype.eatWhile=function(match){for(var start=this.pos;this.eat(match););return this.pos>start},StringStream.prototype.eatSpace=function(){for(var this$1=this,start=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this$1.pos;return this.pos>start},StringStream.prototype.skipToEnd=function(){this.pos=this.string.length},StringStream.prototype.skipTo=function(ch){var found=this.string.indexOf(ch,this.pos);if(found>-1)return this.pos=found,!0},StringStream.prototype.backUp=function(n){this.pos-=n},StringStream.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=countColumn(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),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("string"!=typeof pattern){var match=this.string.slice(this.pos).match(pattern);return match&&match.index>0?null:(match&&!1!==consume&&(this.pos+=match[0].length),match)}var cased=function(str){return caseInsensitive?str.toLowerCase():str};if(cased(this.string.substr(this.pos,pattern.length))==cased(pattern))return!1!==consume&&(this.pos+=pattern.length),!0},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)};var SavedContext=function(state,lookAhead){this.state=state,this.lookAhead=lookAhead},Context=function(doc,state,line,lookAhead){this.state=state,this.doc=doc,this.line=line,this.maxLookAhead=lookAhead||0};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.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Context.fromSaved=function(doc,saved,line){return saved instanceof SavedContext?new Context(doc,copyState(doc.mode,saved.saved),line,saved.lookAhead):new Context(doc,copyState(doc.mode,saved),line)},Context.prototype.save=function(copy){var state=!1!==copy?copyState(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new SavedContext(state,this.maxLookAhead):state};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},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);var measureText,styleToClassCache={},styleToClassCacheWithMode={},operationGroup=null,orphanDelayedCallbacks=null,nullRect={left:0,right:0,top:0,bottom:0},NativeScrollbars=function(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");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&&measure.clientHeight>0&&(0==sWidth&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:needsV?sWidth:0,bottom:needsH?sWidth:0}},NativeScrollbars.prototype.setScrollLeft=function(pos){this.horiz.scrollLeft!=pos&&(this.horiz.scrollLeft=pos),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},NativeScrollbars.prototype.setScrollTop=function(pos){this.vert.scrollTop!=pos&&(this.vert.scrollTop=pos),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},NativeScrollbars.prototype.zeroWidthHack=function(){var w=mac&&!mac_geMountainLion?"12px":"18px";this.horiz.style.height=this.vert.style.width=w,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Delayed,this.disableVert=new Delayed},NativeScrollbars.prototype.enableZeroWidthBar=function(bar,delay,type){function maybeDisable(){var box=bar.getBoundingClientRect();("vert"==type?document.elementFromPoint(box.right-1,(box.top+box.bottom)/2):document.elementFromPoint((box.right+box.left)/2,box.bottom-1))!=bar?bar.style.pointerEvents="none":delay.set(1e3,maybeDisable)}bar.style.pointerEvents="auto",delay.set(1e3,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(){};var scrollbarModel={native:NativeScrollbars,null:NullScrollbars},nextOpId=0,DisplayUpdate=function(cm,viewport,force){var display=cm.display;this.viewport=viewport,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){hasHandler(emitter,type)&&this.events.push(arguments)},DisplayUpdate.prototype.finish=function(){for(var this$1=this,i=0;i<this.events.length;i++)signal.apply(null,this$1.events[i])};var wheelSamples=0,wheelPixelsPerUnit=null;ie?wheelPixelsPerUnit=-.53:gecko?wheelPixelsPerUnit=15:chrome?wheelPixelsPerUnit=-.7:safari&&(wheelPixelsPerUnit=-1/3);var Selection=function(ranges,primIndex){this.ranges=ranges,this.primIndex=primIndex};Selection.prototype.primary=function(){return this.ranges[this.primIndex]},Selection.prototype.equals=function(other){var this$1=this;if(other==this)return!0;if(other.primIndex!=this.primIndex||other.ranges.length!=this.ranges.length)return!1;for(var i=0;i<this.ranges.length;i++){var here=this$1.ranges[i],there=other.ranges[i];if(!equalCursorPos(here.anchor,there.anchor)||!equalCursorPos(here.head,there.head))return!1}return!0},Selection.prototype.deepCopy=function(){for(var this$1=this,out=[],i=0;i<this.ranges.length;i++)out[i]=new Range(copyPos(this$1.ranges[i].anchor),copyPos(this$1.ranges[i].head));return new Selection(out,this.primIndex)},Selection.prototype.somethingSelected=function(){for(var this$1=this,i=0;i<this.ranges.length;i++)if(!this$1.ranges[i].empty())return!0;return!1},Selection.prototype.contains=function(pos,end){var this$1=this;end||(end=pos);for(var i=0;i<this.ranges.length;i++){var range=this$1.ranges[i];if(cmp(end,range.from())>=0&&cmp(pos,range.to())<=0)return i}return-1};var Range=function(anchor,head){this.anchor=anchor,this.head=head};Range.prototype.from=function(){return minPos(this.anchor,this.head)},Range.prototype.to=function(){return maxPos(this.anchor,this.head)},Range.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},LeafChunk.prototype={chunkSize:function(){return this.lines.length},removeInner:function(at,n){for(var this$1=this,i=at,e=at+n;i<e;++i){var line=this$1.lines[i];this$1.height-=line.height,cleanUpLine(line),signalLater(line,"delete")}this.lines.splice(at,n)},collapse:function(lines){lines.push.apply(lines,this.lines)},insertInner:function(at,lines,height){var this$1=this;this.height+=height,this.lines=this.lines.slice(0,at).concat(lines).concat(this.lines.slice(at));for(var i=0;i<lines.length;++i)lines[i].parent=this$1},iterN:function(at,n,op){for(var this$1=this,e=at+n;at<e;++at)if(op(this$1.lines[at]))return!0}},BranchChunk.prototype={chunkSize:function(){return this.size},removeInner:function(at,n){var this$1=this;this.size-=n;for(var i=0;i<this.children.length;++i){var child=this$1.children[i],sz=child.chunkSize();if(at<sz){var rm=Math.min(n,sz-at),oldHeight=child.height;if(child.removeInner(at,rm),this$1.height-=oldHeight-child.height,sz==rm&&(this$1.children.splice(i--,1),child.parent=null),0==(n-=rm))break;at=0}else at-=sz}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 this$1=this,i=0;i<this.children.length;++i)this$1.children[i].collapse(lines)},insertInner:function(at,lines,height){var this$1=this;this.size+=lines.length,this.height+=height;for(var i=0;i<this.children.length;++i){var child=this$1.children[i],sz=child.chunkSize();if(at<=sz){if(child.insertInner(at,lines,height),child.lines&&child.lines.length>50){for(var remaining=child.lines.length%25+25,pos=remaining;pos<child.lines.length;){var leaf=new LeafChunk(child.lines.slice(pos,pos+=25));child.height-=leaf.height,this$1.children.splice(++i,0,leaf),leaf.parent=this$1}child.lines=child.lines.slice(0,remaining),this$1.maybeSpill()}break}at-=sz}},maybeSpill:function(){if(!(this.children.length<=10)){var me=this;do{var sibling=new BranchChunk(me.children.splice(me.children.length-5,5));if(me.parent){me.size-=sibling.size,me.height-=sibling.height;var myIndex=indexOf(me.parent.children,me);me.parent.children.splice(myIndex+1,0,sibling)}else{var copy=new BranchChunk(me.children);copy.parent=me,me.children=[copy,sibling],me=copy}sibling.parent=me.parent}while(me.children.length>10);me.parent.maybeSpill()}},iterN:function(at,n,op){for(var this$1=this,i=0;i<this.children.length;++i){var child=this$1.children[i],sz=child.chunkSize();if(at<sz){var used=Math.min(n,sz-at);if(child.iterN(at,used,op))return!0;if(0==(n-=used))break;at=0}else at-=sz}}};var LineWidget=function(doc,node,options){var this$1=this;if(options)for(var opt in options)options.hasOwnProperty(opt)&&(this$1[opt]=options[opt]);this.doc=doc,this.node=node};LineWidget.prototype.clear=function(){var this$1=this,cm=this.doc.cm,ws=this.line.widgets,line=this.line,no=lineNo(line);if(null!=no&&ws){for(var i=0;i<ws.length;++i)ws[i]==this$1&&ws.splice(i--,1);ws.length||(line.widgets=null);var height=widgetHeight(this);updateLineHeight(line,Math.max(0,line.height-height)),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,oldH=this.height,cm=this.doc.cm,line=this.line;this.height=null;var diff=widgetHeight(this)-oldH;diff&&(updateLineHeight(line,line.height+diff),cm&&runInOp(cm,function(){cm.curOp.forceUpdate=!0,adjustScrollWhenAboveVisible(cm,line,diff),signalLater(cm,"lineWidgetChanged",cm,this$1,lineNo(line))}))},eventMixin(LineWidget);var nextMarkerId=0,TextMarker=function(doc,type){this.lines=[],this.type=type,this.doc=doc,this.id=++nextMarkerId};TextMarker.prototype.clear=function(){var this$1=this;if(!this.explicitlyCleared){var cm=this.doc.cm,withOp=cm&&!cm.curOp;if(withOp&&startOperation(cm),hasHandler(this,"clear")){var found=this.find();found&&signalLater(this,"clear",found.from,found.to)}for(var min=null,max=null,i=0;i<this.lines.length;++i){var line=this$1.lines[i],span=getMarkedSpanFor(line.markedSpans,this$1);cm&&!this$1.collapsed?regLineChange(cm,lineNo(line),"text"):cm&&(null!=span.to&&(max=lineNo(line)),null!=span.from&&(min=lineNo(line))),line.markedSpans=removeMarkedSpan(line.markedSpans,span),null==span.from&&this$1.collapsed&&!lineIsHidden(this$1.doc,line)&&cm&&updateLineHeight(line,textHeight(cm.display))}if(cm&&this.collapsed&&!cm.options.lineWrapping)for(var i$1=0;i$1<this.lines.length;++i$1){var visual=visualLine(this$1.lines[i$1]),len=lineLength(visual);len>cm.display.maxLineLength&&(cm.display.maxLine=visual,cm.display.maxLineLength=len,cm.display.maxLineChanged=!0)}null!=min&&cm&&this.collapsed&&regChange(cm,min,max+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,cm&&reCheckSelection(cm.doc)),cm&&signalLater(cm,"markerCleared",cm,this,min,max),withOp&&endOperation(cm),this.parent&&this.parent.clear()}},TextMarker.prototype.find=function(side,lineObj){var this$1=this;null==side&&"bookmark"==this.type&&(side=1);for(var from,to,i=0;i<this.lines.length;++i){var line=this$1.lines[i],span=getMarkedSpanFor(line.markedSpans,this$1);if(null!=span.from&&(from=Pos(lineObj?line:lineNo(line),span.from),-1==side))return from;if(null!=span.to&&(to=Pos(lineObj?line:lineNo(line),span.to),1==side))return to}return from&&{from:from,to:to}},TextMarker.prototype.changed=function(){var this$1=this,pos=this.find(-1,!0),widget=this,cm=this.doc.cm;pos&&cm&&runInOp(cm,function(){var line=pos.line,lineN=lineNo(pos.line),view=findViewForLine(cm,lineN);if(view&&(clearLineMeasurementCacheFor(view),cm.curOp.selectionChanged=cm.curOp.forceUpdate=!0),cm.curOp.updateMaxLine=!0,!lineIsHidden(widget.doc,line)&&null!=widget.height){var oldHeight=widget.height;widget.height=null;var dHeight=widgetHeight(widget)-oldHeight;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;op.maybeHiddenMarkers&&-1!=indexOf(op.maybeHiddenMarkers,this)||(op.maybeUnhiddenMarkers||(op.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(line)},TextMarker.prototype.detachLine=function(line){if(this.lines.splice(indexOf(this.lines,line),1),!this.lines.length&&this.doc.cm){var op=this.doc.cm.curOp;(op.maybeHiddenMarkers||(op.maybeHiddenMarkers=[])).push(this)}},eventMixin(TextMarker);var SharedTextMarker=function(markers,primary){var this$1=this;this.markers=markers,this.primary=primary;for(var i=0;i<markers.length;++i)markers[i].parent=this$1};SharedTextMarker.prototype.clear=function(){var this$1=this;if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var i=0;i<this.markers.length;++i)this$1.markers[i].clear();signalLater(this,"clear")}},SharedTextMarker.prototype.find=function(side,lineObj){return this.primary.find(side,lineObj)},eventMixin(SharedTextMarker);var nextDocId=0,Doc=function(text,mode,firstLine,lineSep,direction){if(!(this instanceof Doc))return new Doc(text,mode,firstLine,lineSep,direction);null==firstLine&&(firstLine=0),BranchChunk.call(this,[new LeafChunk([new Line("",null)])]),this.first=firstLine,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,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="rtl"==direction?"rtl":"ltr",this.extend=!1,"string"==typeof text&&(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,iter:function(from,to,op){op?this.iterN(from-this.first,to-from,op):this.iterN(this.first,this.first+this.size,from)},insert:function(at,lines){for(var height=0,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)},getValue:function(lineSep){var lines=getLines(this,this.first,this.first+this.size);return!1===lineSep?lines: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:!0},!0),this.cm&&scrollToCoords(this.cm,0,0),setSelection(this,simpleSelection(top),sel_dontScroll)}),replaceRange:function(code,from,to,origin){replaceRange(this,code,from=clipPos(this,from),to=to?clipPos(this,to):from,origin)},getRange:function(from,to,lineSep){var lines=getBetween(this,clipPos(this,from),clipPos(this,to));return!1===lineSep?lines: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){return"number"==typeof line&&(line=getLine(this,line)),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$$1=this.sel.primary();return null==start||"head"==start?range$$1.head:"anchor"==start?range$$1.anchor:"end"==start||"to"==start||!1===start?range$$1.to():range$$1.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:docMethodOp(function(line,ch,options){setSimpleSelection(this,clipPos(this,"number"==typeof line?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){extendSelections(this,clipPosArray(this,map(this.sel.ranges,f)),options)}),setSelections:docMethodOp(function(ranges,primary,options){var this$1=this;if(ranges.length){for(var out=[],i=0;i<ranges.length;i++)out[i]=new Range(clipPos(this$1,ranges[i].anchor),clipPos(this$1,ranges[i].head));null==primary&&(primary=Math.min(ranges.length-1,this.sel.primIndex)),setSelection(this,normalizeSelection(out,primary),options)}}),addSelection:docMethodOp(function(anchor,head,options){var ranges=this.sel.ranges.slice(0);ranges.push(new Range(clipPos(this,anchor),clipPos(this,head||anchor))),setSelection(this,normalizeSelection(ranges,ranges.length-1),options)}),getSelection:function(lineSep){for(var lines,this$1=this,ranges=this.sel.ranges,i=0;i<ranges.length;i++){var sel=getBetween(this$1,ranges[i].from(),ranges[i].to());lines=lines?lines.concat(sel):sel}return!1===lineSep?lines:lines.join(lineSep||this.lineSeparator())},getSelections:function(lineSep){for(var this$1=this,parts=[],ranges=this.sel.ranges,i=0;i<ranges.length;i++){var sel=getBetween(this$1,ranges[i].from(),ranges[i].to());!1!==lineSep&&(sel=sel.join(lineSep||this$1.lineSeparator())),parts[i]=sel}return parts},replaceSelection:function(code,collapse,origin){for(var dup=[],i=0;i<this.sel.ranges.length;i++)dup[i]=code;this.replaceSelections(dup,collapse,origin||"+input")},replaceSelections:docMethodOp(function(code,collapse,origin){for(var this$1=this,changes=[],sel=this.sel,i=0;i<sel.ranges.length;i++){var range$$1=sel.ranges[i];changes[i]={from:range$$1.from(),to:range$$1.to(),text:this$1.splitLines(code[i]),origin:origin}}for(var newSel=collapse&&"end"!=collapse&&computeReplacedSel(this,changes,collapse),i$1=changes.length-1;i$1>=0;i$1--)makeChange(this$1,changes[i$1]);newSel?setSelectionReplaceHistory(this,newSel):this.cm&&ensureCursorVisible(this.cm)}),undo:docMethodOp(function(){makeChangeFromHistory(this,"undo")}),redo:docMethodOp(function(){makeChangeFromHistory(this,"redo")}),undoSelection:docMethodOp(function(){makeChangeFromHistory(this,"undo",!0)}),redoSelection:docMethodOp(function(){makeChangeFromHistory(this,"redo",!0)}),setExtending:function(val){this.extend=val},getExtending:function(){return this.extend},historySize:function(){for(var hist=this.history,done=0,undone=0,i=0;i<hist.done.length;i++)hist.done[i].ranges||++done;for(var i$1=0;i$1<hist.undone.length;i$1++)hist.undone[i$1].ranges||++undone;return{undo:done,redo:undone}},clearHistory:function(){this.history=new History(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(forceSplit){return forceSplit&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(gen){return this.history.generation==(gen||this.cleanGeneration)},getHistory:function(){return{done:copyHistoryArray(this.history.done),undone:copyHistoryArray(this.history.undone)}},setHistory:function(histData){var hist=this.history=new History(this.history.maxGeneration);hist.done=copyHistoryArray(histData.done.slice(0),null,!0),hist.undone=copyHistoryArray(histData.undone.slice(0),null,!0)},setGutterMarker:docMethodOp(function(line,gutterID,value){return changeLine(this,line,"gutter",function(line){var markers=line.gutterMarkers||(line.gutterMarkers={});return markers[gutterID]=value,!value&&isEmpty(markers)&&(line.gutterMarkers=null),!0})}),clearGutter:docMethodOp(function(gutterID){var this$1=this;this.iter(function(line){line.gutterMarkers&&line.gutterMarkers[gutterID]&&changeLine(this$1,line,"gutter",function(){return line.gutterMarkers[gutterID]=null,isEmpty(line.gutterMarkers)&&(line.gutterMarkers=null),!0})})}),lineInfo:function(line){var n;if("number"==typeof line){if(!isLine(this,line))return null;if(n=line,!(line=getLine(this,line)))return null}else if(null==(n=lineNo(line)))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,"gutter"==where?"gutter":"class",function(line){var prop="text"==where?"textClass":"background"==where?"bgClass":"gutter"==where?"gutterClass":"wrapClass";if(line[prop]){if(classTest(cls).test(line[prop]))return!1;line[prop]+=" "+cls}else line[prop]=cls;return!0})}),removeLineClass:docMethodOp(function(handle,where,cls){return changeLine(this,handle,"gutter"==where?"gutter":"class",function(line){var prop="text"==where?"textClass":"background"==where?"bgClass":"gutter"==where?"gutterClass":"wrapClass",cur=line[prop];if(!cur)return!1;if(null==cls)line[prop]=null;else{var found=cur.match(classTest(cls));if(!found)return!1;var end=found.index+found[0].length;line[prop]=cur.slice(0,found.index)+(found.index&&end!=cur.length?" ":"")+cur.slice(end)||null}return!0})}),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&&(null==options.nodeType?options.widget:options),insertLeft:options&&options.insertLeft,clearWhenEmpty:!1,shared:options&&options.shared,handleMouseEvents:options&&options.handleMouseEvents};return pos=clipPos(this,pos),markText(this,pos,pos,realOpts,"bookmark")},findMarksAt:function(pos){var markers=[],spans=getLine(this,(pos=clipPos(this,pos)).line).markedSpans;if(spans)for(var i=0;i<spans.length;++i){var span=spans[i];(null==span.from||span.from<=pos.ch)&&(null==span.to||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$$1=from.line;return 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];null!=span.to&&lineNo$$1==from.line&&from.ch>=span.to||null==span.from&&lineNo$$1!=from.line||null!=span.from&&lineNo$$1==to.line&&span.from>=to.ch||filter&&!filter(span.marker)||found.push(span.marker.parent||span.marker)}++lineNo$$1}),found},getAllMarks:function(){var markers=[];return this.iter(function(line){var sps=line.markedSpans;if(sps)for(var i=0;i<sps.length;++i)null!=sps[i].from&&markers.push(sps[i].marker)}),markers},posFromIndex:function(off){var ch,lineNo$$1=this.first,sepSize=this.lineSeparator().length;return this.iter(function(line){var sz=line.text.length+sepSize;if(sz>off)return ch=off,!0;off-=sz,++lineNo$$1}),clipPos(this,Pos(lineNo$$1,ch))},indexFromPos:function(coords){var index=(coords=clipPos(this,coords)).ch;if(coords.line<this.first||coords.ch<0)return 0;var sepSize=this.lineSeparator().length;return this.iter(this.first,coords.line,function(line){index+=line.text.length+sepSize}),index},copy:function(copyHistory){var doc=new Doc(getLines(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return doc.scrollTop=this.scrollTop,doc.scrollLeft=this.scrollLeft,doc.sel=this.sel,doc.extend=!1,copyHistory&&(doc.history.undoDepth=this.history.undoDepth,doc.setHistory(this.getHistory())),doc},linkedDoc:function(options){options||(options={});var from=this.first,to=this.first+this.size;null!=options.from&&options.from>from&&(from=options.from),null!=options.to&&options.to<to&&(to=options.to);var copy=new Doc(getLines(this,from,to),options.mode||this.modeOption,from,this.lineSep,this.direction);return options.sharedHist&&(copy.history=this.history),(this.linked||(this.linked=[])).push({doc:copy,sharedHist:options.sharedHist}),copy.linked=[{doc:this,isParent:!0,sharedHist:options.sharedHist}],copySharedMarkers(copy,findSharedMarkers(this)),copy},unlinkDoc:function(other){var this$1=this;if(other instanceof CodeMirror$1&&(other=other.doc),this.linked)for(var i=0;i<this.linked.length;++i)if(this$1.linked[i].doc==other){this$1.linked.splice(i,1),other.unlinkDoc(this$1),detachSharedMarkers(findSharedMarkers(this$1));break}if(other.history==this.history){var splitIds=[other.id];linkedDocs(other,function(doc){return splitIds.push(doc.id)},!0),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){return this.lineSep?str.split(this.lineSep):splitLinesAuto(str)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:docMethodOp(function(dir){"rtl"!=dir&&(dir="ltr"),dir!=this.direction&&(this.direction=dir,this.iter(function(line){return line.order=null}),this.cm&&directionChanged(this.cm))})}),Doc.prototype.eachLine=Doc.prototype.iter;for(var lastDrop=0,globalsRegistered=!1,keyNames={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},i=0;i<10;i++)keyNames[i+48]=keyNames[i+96]=String(i);for(var i$1=65;i$1<=90;i$1++)keyNames[i$1]=String.fromCharCode(i$1);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"},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"},keyMap.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","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;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;return range.head.ch==len&&range.head.line<cm.lastLine()?{from:range.head,to:Pos(range.head.line+1,0)}:{from:range.head,to:Pos(range.head.line,len)}}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;return{from:cm.coordsChar({left:0,top:top},"div"),to:range.from()}})},delWrappedLineRight:function(cm){return deleteNearSelection(cm,function(range){var top=cm.charCoords(range.head,"div").top+5,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.charCoords(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.charCoords(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.charCoords(range.head,"div").top+5,pos=cm.coordsChar({left:0,top:top},"div");return pos.ch<cm.getLine(pos.line).search(/\S/)?lineStartSmart(cm,range.head):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,"char")},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){for(var spaces=[],ranges=cm.listSelections(),tabSize=cm.options.tabSize,i=0;i<ranges.length;i++){var pos=ranges[i].from(),col=countColumn(cm.getLine(pos.line),pos.ch,tabSize);spaces.push(spaceStr(tabSize-col%tabSize))}cm.replaceSelections(spaces)},defaultTab:function(cm){cm.somethingSelected()?cm.indentSelection("add"):cm.execCommand("insertTab")},transposeChars:function(cm){return runInOp(cm,function(){for(var ranges=cm.listSelections(),newSel=[],i=0;i<ranges.length;i++)if(ranges[i].empty()){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)),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;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(){for(var sels=cm.listSelections(),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,!0);ensureCursorVisible(cm)})},openLine:function(cm){return cm.replaceSelection("\n","start")},toggleOverwrite:function(cm){return cm.toggleOverwrite()}},stopSeq=new Delayed,lastStoppedKey=null,PastClick=function(time,pos,button){this.time=time,this.pos=pos,this.button=button};PastClick.prototype.compare=function(time,pos,button){return this.time+400>time&&0==cmp(pos,this.pos)&&button==this.button};var lastClick,lastDoubleClick,Init={toString:function(){return"CodeMirror.Init"}},defaults={},optionHandlers={};CodeMirror$1.defaults=defaults,CodeMirror$1.optionHandlers=optionHandlers;var initHooks=[];CodeMirror$1.defineInitHook=function(f){return initHooks.push(f)};var lastCopied=null,ContentEditableInput=function(cm){this.cm=cm,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Delayed,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};ContentEditableInput.prototype.init=function(display){function onCopyCut(e){if(!signalDOMEvent(cm,e)){if(cm.somethingSelected())setLastCopied({lineWise:!1,text:cm.getSelections()}),"cut"==e.type&&cm.replaceSelection("",null,"cut");else{if(!cm.options.lineWiseCopyCut)return;var ranges=copyableRanges(cm);setLastCopied({lineWise:!0,text:ranges.text}),"cut"==e.type&&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");if(e.clipboardData.setData("Text",content),e.clipboardData.getData("Text")==content)return void e.preventDefault()}var kludge=hiddenTextarea(),te=kludge.firstChild;cm.display.lineSpace.insertBefore(kludge,cm.display.lineSpace.firstChild),te.value=lastCopied.text.join("\n");var hadFocus=document.activeElement;selectInput(te),setTimeout(function(){cm.display.lineSpace.removeChild(kludge),hadFocus.focus(),hadFocus==div&&input.showPrimarySelection()},50)}}var this$1=this,input=this,cm=input.cm,div=input.div=display.lineDiv;disableBrowserMagic(div,cm.options.spellcheck),on(div,"paste",function(e){signalDOMEvent(cm,e)||handlePaste(e,cm)||ie_version<=11&&setTimeout(operation(cm,function(){return this$1.updateFromDOM()}),20)}),on(div,"compositionstart",function(e){this$1.composing={data:e.data,done:!1}}),on(div,"compositionupdate",function(e){this$1.composing||(this$1.composing={data:e.data,done:!1})}),on(div,"compositionend",function(e){this$1.composing&&(e.data!=this$1.composing.data&&this$1.readFromDOMSoon(),this$1.composing.done=!0)}),on(div,"touchstart",function(){return input.forceCompositionEnd()}),on(div,"input",function(){this$1.composing||this$1.readFromDOMSoon()}),on(div,"copy",onCopyCut),on(div,"cut",onCopyCut)},ContentEditableInput.prototype.prepareSelection=function(){var result=prepareSelection(this.cm,!1);return result.focus=this.cm.state.focused,result},ContentEditableInput.prototype.showSelection=function(info,takeFocus){info&&this.cm.display.view.length&&((info.focus||takeFocus)&&this.showPrimarySelection(),this.showMultipleSelections(info))},ContentEditableInput.prototype.showPrimarySelection=function(){var sel=window.getSelection(),cm=this.cm,prim=cm.doc.sel.primary(),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();else{var curAnchor=domToPos(cm,sel.anchorNode,sel.anchorOffset),curFocus=domToPos(cm,sel.focusNode,sel.focusOffset);if(!curAnchor||curAnchor.bad||!curFocus||curFocus.bad||0!=cmp(minPos(curAnchor,curFocus),from)||0!=cmp(maxPos(curAnchor,curFocus),to)){var view=cm.display.view,start=from.line>=cm.display.viewFrom&&posToDOM(cm,from)||{node:view[0].measure.map[2],offset:0},end=to.line<cm.display.viewTo&&posToDOM(cm,to);if(!end){var measure=view[view.length-1].measure,map$$1=measure.maps?measure.maps[measure.maps.length-1]:measure.map;end={node:map$$1[map$$1.length-1],offset:map$$1[map$$1.length-2]-map$$1[map$$1.length-3]}}if(start&&end){var rng,old=sel.rangeCount&&sel.getRangeAt(0);try{rng=range(start.node,start.offset,end.offset,end.node)}catch(e){}rng&&(!gecko&&cm.state.focused?(sel.collapse(start.node,start.offset),rng.collapsed||(sel.removeAllRanges(),sel.addRange(rng))):(sel.removeAllRanges(),sel.addRange(rng)),old&&null==sel.anchorNode?sel.addRange(old):gecko&&this.startGracePeriod()),this.rememberSelection()}else sel.removeAllRanges()}}},ContentEditableInput.prototype.startGracePeriod=function(){var this$1=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){this$1.gracePeriod=!1,this$1.selectionChanged()&&this$1.cm.operation(function(){return this$1.cm.curOp.selectionChanged=!0})},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=window.getSelection();this.lastAnchorNode=sel.anchorNode,this.lastAnchorOffset=sel.anchorOffset,this.lastFocusNode=sel.focusNode,this.lastFocusOffset=sel.focusOffset},ContentEditableInput.prototype.selectionInEditor=function(){var sel=window.getSelection();if(!sel.rangeCount)return!1;var node=sel.getRangeAt(0).commonAncestorContainer;return contains(this.div,node)},ContentEditableInput.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()||this.showSelection(this.prepareSelection(),!0),this.div.focus())},ContentEditableInput.prototype.blur=function(){this.div.blur()},ContentEditableInput.prototype.getField=function(){return this.div},ContentEditableInput.prototype.supportsTouch=function(){return!0},ContentEditableInput.prototype.receivedFocus=function(){function poll(){input.cm.state.focused&&(input.pollSelection(),input.polling.set(input.cm.options.pollInterval,poll))}var input=this;this.selectionInEditor()?this.pollSelection():runInOp(this.cm,function(){return input.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,poll)},ContentEditableInput.prototype.selectionChanged=function(){var sel=window.getSelection();return sel.anchorNode!=this.lastAnchorNode||sel.anchorOffset!=this.lastAnchorOffset||sel.focusNode!=this.lastFocusNode||sel.focusOffset!=this.lastFocusOffset},ContentEditableInput.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var sel=window.getSelection(),cm=this.cm;if(android&&chrome&&this.cm.options.gutters.length&&isInGutter(sel.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();if(!this.composing){this.rememberSelection();var anchor=domToPos(cm,sel.anchorNode,sel.anchorOffset),head=domToPos(cm,sel.focusNode,sel.focusOffset);anchor&&head&&runInOp(cm,function(){setSelection(cm.doc,simpleSelection(anchor,head),sel_dontScroll),(anchor.bad||head.bad)&&(cm.curOp.selectionChanged=!0)})}}},ContentEditableInput.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var cm=this.cm,display=cm.display,sel=cm.doc.sel.primary(),from=sel.from(),to=sel.to();if(0==from.ch&&from.line>cm.firstLine()&&(from=Pos(from.line-1,getLine(cm.doc,from.line-1).length)),to.ch==getLine(cm.doc,to.line).text.length&&to.line<cm.lastLine()&&(to=Pos(to.line+1,0)),from.line<display.viewFrom||to.line>display.viewTo-1)return!1;var fromIndex,fromLine,fromNode;from.line==display.viewFrom||0==(fromIndex=findViewIndex(cm,from.line))?(fromLine=lineNo(display.view[0].line),fromNode=display.view[0].node):(fromLine=lineNo(display.view[fromIndex].line),fromNode=display.view[fromIndex-1].node.nextSibling);var toLine,toNode,toIndex=findViewIndex(cm,to.line);if(toIndex==display.view.length-1?(toLine=display.viewTo-1,toNode=display.lineDiv.lastChild):(toLine=lineNo(display.view[toIndex+1].line)-1,toNode=display.view[toIndex+1].node.previousSibling),!fromNode)return!1;for(var newText=cm.doc.splitLines(domTextBetween(cm,fromNode,toNode,fromLine,toLine)),oldText=getBetween(cm.doc,Pos(fromLine,0),Pos(toLine,getLine(cm.doc,toLine).text.length));newText.length>1&&oldText.length>1;)if(lst(newText)==lst(oldText))newText.pop(),oldText.pop(),toLine--;else{if(newText[0]!=oldText[0])break;newText.shift(),oldText.shift(),fromLine++}for(var cutFront=0,cutEnd=0,newTop=newText[0],oldTop=oldText[0],maxCutFront=Math.min(newTop.length,oldTop.length);cutFront<maxCutFront&&newTop.charCodeAt(cutFront)==oldTop.charCodeAt(cutFront);)++cutFront;for(var newBot=lst(newText),oldBot=lst(oldText),maxCutEnd=Math.min(newBot.length-(1==newText.length?cutFront:0),oldBot.length-(1==oldText.length?cutFront:0));cutEnd<maxCutEnd&&newBot.charCodeAt(newBot.length-cutEnd-1)==oldBot.charCodeAt(oldBot.length-cutEnd-1);)++cutEnd;if(1==newText.length&&1==oldText.length&&fromLine==from.line)for(;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),chTo=Pos(toLine,oldText.length?lst(oldText).length-cutEnd:0);return newText.length>1||newText[0]||cmp(chFrom,chTo)?(replaceRange(cm.doc,newText,chFrom,chTo,"+input"),!0):void 0},ContentEditableInput.prototype.ensurePolled=function(){this.forceCompositionEnd()},ContentEditableInput.prototype.reset=function(){this.forceCompositionEnd()},ContentEditableInput.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},ContentEditableInput.prototype.readFromDOMSoon=function(){var this$1=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout(function(){if(this$1.readDOMTimeout=null,this$1.composing){if(!this$1.composing.done)return;this$1.composing=null}this$1.updateFromDOM()},80))},ContentEditableInput.prototype.updateFromDOM=function(){var this$1=this;!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){0!=e.charCode&&(e.preventDefault(),this.cm.isReadOnly()||operation(this.cm,applyTextInput)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},ContentEditableInput.prototype.readOnlyChanged=function(val){this.div.contentEditable=String("nocursor"!=val)},ContentEditableInput.prototype.onContextMenu=function(){},ContentEditableInput.prototype.resetPosition=function(){},ContentEditableInput.prototype.needsContentAttribute=!0;var TextareaInput=function(cm){this.cm=cm,this.prevInput="",this.pollingFast=!1,this.polling=new Delayed,this.inaccurateSelection=!1,this.hasSelection=!1,this.composing=null};TextareaInput.prototype.init=function(display){function prepareCopyCut(e){if(!signalDOMEvent(cm,e)){if(cm.somethingSelected())setLastCopied({lineWise:!1,text:cm.getSelections()}),input.inaccurateSelection&&(input.prevInput="",input.inaccurateSelection=!1,te.value=lastCopied.text.join("\n"),selectInput(te));else{if(!cm.options.lineWiseCopyCut)return;var ranges=copyableRanges(cm);setLastCopied({lineWise:!0,text:ranges.text}),"cut"==e.type?cm.setSelections(ranges.ranges,null,sel_dontScroll):(input.prevInput="",te.value=ranges.text.join("\n"),selectInput(te))}"cut"==e.type&&(cm.state.cutIncoming=!0)}}var this$1=this,input=this,cm=this.cm,div=this.wrapper=hiddenTextarea(),te=this.textarea=div.firstChild;display.wrapper.insertBefore(div,display.wrapper.firstChild),ios&&(te.style.width="0px"),on(te,"input",function(){ie&&ie_version>=9&&this$1.hasSelection&&(this$1.hasSelection=null),input.poll()}),on(te,"paste",function(e){signalDOMEvent(cm,e)||handlePaste(e,cm)||(cm.state.pasteIncoming=!0,input.fastPoll())}),on(te,"cut",prepareCopyCut),on(te,"copy",prepareCopyCut),on(display.scroller,"paste",function(e){eventInWidget(display,e)||signalDOMEvent(cm,e)||(cm.state.pasteIncoming=!0,input.focus())}),on(display.lineSpace,"selectstart",function(e){eventInWidget(display,e)||e_preventDefault(e)}),on(te,"compositionstart",function(){var start=cm.getCursor("from");input.composing&&input.composing.range.clear(),input.composing={start:start,range:cm.markText(start,cm.getCursor("to"),{className:"CodeMirror-composing"})}}),on(te,"compositionend",function(){input.composing&&(input.poll(),input.composing.range.clear(),input.composing=null)})},TextareaInput.prototype.prepareSelection=function(){var cm=this.cm,display=cm.display,doc=cm.doc,result=prepareSelection(cm);if(cm.options.moveInputWithCursor){var headPos=cursorCoords(cm,doc.sel.primary().head,"div"),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 display=this.cm.display;removeChildrenAndAdd(display.cursorDiv,drawn.cursors),removeChildrenAndAdd(display.selectionDiv,drawn.selection),null!=drawn.teTop&&(this.wrapper.style.top=drawn.teTop+"px",this.wrapper.style.left=drawn.teLeft+"px")},TextareaInput.prototype.reset=function(typing){if(!this.contextMenuPending&&!this.composing){var minimal,selected,cm=this.cm,doc=cm.doc;if(cm.somethingSelected()){this.prevInput="";var range$$1=doc.sel.primary(),content=(minimal=hasCopyEvent&&(range$$1.to().line-range$$1.from().line>100||(selected=cm.getSelection()).length>1e3))?"-":selected||cm.getSelection();this.textarea.value=content,cm.state.focused&&selectInput(this.textarea),ie&&ie_version>=9&&(this.hasSelection=content)}else typing||(this.prevInput=this.textarea.value="",ie&&ie_version>=9&&(this.hasSelection=null));this.inaccurateSelection=minimal}},TextareaInput.prototype.getField=function(){return this.textarea},TextareaInput.prototype.supportsTouch=function(){return!1},TextareaInput.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!mobile||activeElt()!=this.textarea))try{this.textarea.focus()}catch(e){}},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()},TextareaInput.prototype.slowPoll=function(){var this$1=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){this$1.poll(),this$1.cm.state.focused&&this$1.slowPoll()})},TextareaInput.prototype.fastPoll=function(){function p(){input.poll()||missed?(input.pollingFast=!1,input.slowPoll()):(missed=!0,input.polling.set(60,p))}var missed=!1,input=this;input.pollingFast=!0,input.polling.set(20,p)},TextareaInput.prototype.poll=function(){var this$1=this,cm=this.cm,input=this.textarea,prevInput=this.prevInput;if(this.contextMenuPending||!cm.state.focused||hasSelection(input)&&!prevInput&&!this.composing||cm.isReadOnly()||cm.options.disableInput||cm.state.keySeq)return!1;var text=input.value;if(text==prevInput&&!cm.somethingSelected())return!1;if(ie&&ie_version>=9&&this.hasSelection===text||mac&&/[\uf700-\uf7ff]/.test(text))return cm.display.input.reset(),!1;if(cm.doc.sel==cm.display.selForContextMenu){var first=text.charCodeAt(0);if(8203!=first||prevInput||(prevInput="​"),8666==first)return this.reset(),this.cm.execCommand("undo")}for(var same=0,l=Math.min(prevInput.length,text.length);same<l&&prevInput.charCodeAt(same)==text.charCodeAt(same);)++same;return runInOp(cm,function(){applyTextInput(cm,text.slice(same),prevInput.length-same,null,this$1.composing?"*compose":null),text.length>1e3||text.indexOf("\n")>-1?input.value=this$1.prevInput="":this$1.prevInput=text,this$1.composing&&(this$1.composing.range.clear(),this$1.composing.range=cm.markText(this$1.composing.start,cm.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},TextareaInput.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},TextareaInput.prototype.onKeyPress=function(){ie&&ie_version>=9&&(this.hasSelection=null),this.fastPoll()},TextareaInput.prototype.onContextMenu=function(e){function prepareSelectAllHack(){if(null!=te.selectionStart){var selected=cm.somethingSelected(),extval="​"+(selected?te.value:"");te.value="⇚",te.value=extval,input.prevInput=selected?"":"​",te.selectionStart=1,te.selectionEnd=extval.length,display.selForContextMenu=cm.doc.sel}}function rehide(){if(input.contextMenuPending=!1,input.wrapper.style.cssText=oldWrapperCSS,te.style.cssText=oldCSS,ie&&ie_version<9&&display.scrollbars.setScrollTop(display.scroller.scrollTop=scrollPos),null!=te.selectionStart){(!ie||ie&&ie_version<9)&&prepareSelectAllHack();var i=0,poll=function(){display.selForContextMenu==cm.doc.sel&&0==te.selectionStart&&te.selectionEnd>0&&"​"==input.prevInput?operation(cm,selectAll)(cm):i++<10?display.detectingSelectAll=setTimeout(poll,500):(display.selForContextMenu=null,display.input.reset())};display.detectingSelectAll=setTimeout(poll,200)}}var input=this,cm=input.cm,display=cm.display,te=input.textarea,pos=posFromMouse(cm,e),scrollPos=display.scroller.scrollTop;if(pos&&!presto){cm.options.resetSelectionOnContextMenu&&-1==cm.doc.sel.contains(pos)&&operation(cm,setSelection)(cm.doc,simpleSelection(pos),sel_dontScroll);var oldCSS=te.style.cssText,oldWrapperCSS=input.wrapper.style.cssText;input.wrapper.style.cssText="position: absolute";var wrapperBox=input.wrapper.getBoundingClientRect();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=window.scrollY),display.input.focus(),webkit&&window.scrollTo(null,oldScrollY),display.input.reset(),cm.somethingSelected()||(te.value=input.prevInput=" "),input.contextMenuPending=!0,display.selForContextMenu=cm.doc.sel,clearTimeout(display.detectingSelectAll),ie&&ie_version>=9&&prepareSelectAllHack(),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){val||this.reset(),this.textarea.disabled="nocursor"==val},TextareaInput.prototype.setUneditable=function(){},TextareaInput.prototype.needsContentAttribute=!1,function(CodeMirror){function option(name,deflt,handle,notOnInit){CodeMirror.defaults[name]=deflt,handle&&(optionHandlers[name]=notOnInit?function(cm,val,old){old!=Init&&handle(cm,val,old)}:handle)}var optionHandlers=CodeMirror.optionHandlers;CodeMirror.defineOption=option,CodeMirror.Init=Init,option("value","",function(cm,val){return cm.setValue(val)},!0),option("mode",null,function(cm,val){cm.doc.modeOption=val,loadMode(cm)},!0),option("indentUnit",2,loadMode,!0),option("indentWithTabs",!1),option("smartIndent",!0),option("tabSize",4,function(cm){resetModeState(cm),clearCaches(cm),regChange(cm)},!0),option("lineSeparator",null,function(cm,val){if(cm.doc.lineSep=val,val){var newBreaks=[],lineNo=cm.doc.first;cm.doc.iter(function(line){for(var pos=0;;){var found=line.text.indexOf(val,pos);if(-1==found)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-\u200f\u2028\u2029\ufeff]/g,function(cm,val,old){cm.state.specialChars=new RegExp(val.source+(val.test("\t")?"":"|\t"),"g"),old!=Init&&cm.refresh()}),option("specialCharPlaceholder",defaultSpecialCharPlaceholder,function(cm){return cm.refresh()},!0),option("electricChars",!0),option("inputStyle",mobile?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),option("spellcheck",!1,function(cm,val){return cm.getInputField().spellcheck=val},!0),option("rtlMoveVisually",!windows),option("wholeLineUpdateBefore",!0),option("theme","default",function(cm){themeChanged(cm),guttersChanged(cm)},!0),option("keyMap","default",function(cm,val,old){var next=getKeyMap(val),prev=old!=Init&&getKeyMap(old);prev&&prev.detach&&prev.detach(cm,next),next.attach&&next.attach(cm,prev||null)}),option("extraKeys",null),option("configureMouse",null),option("lineWrapping",!1,wrappingChanged,!0),option("gutters",[],function(cm){setGuttersForLineNumbers(cm.options),guttersChanged(cm)},!0),option("fixedGutter",!0,function(cm,val){cm.display.gutters.style.left=val?compensateForHScroll(cm.display)+"px":"0",cm.refresh()},!0),option("coverGutterNextToScrollbar",!1,function(cm){return updateScrollbars(cm)},!0),option("scrollbarStyle","native",function(cm){initScrollbars(cm),updateScrollbars(cm),cm.display.scrollbars.setScrollTop(cm.doc.scrollTop),cm.display.scrollbars.setScrollLeft(cm.doc.scrollLeft)},!0),option("lineNumbers",!1,function(cm){setGuttersForLineNumbers(cm.options),guttersChanged(cm)},!0),option("firstLineNumber",1,guttersChanged,!0),option("lineNumberFormatter",function(integer){return integer},guttersChanged,!0),option("showCursorWhenSelecting",!1,updateSelection,!0),option("resetSelectionOnContextMenu",!0),option("lineWiseCopyCut",!0),option("pasteLinesPerSelection",!0),option("readOnly",!1,function(cm,val){"nocursor"==val&&(onBlur(cm),cm.display.input.blur()),cm.display.input.readOnlyChanged(val)}),option("disableInput",!1,function(cm,val){val||cm.display.input.reset()},!0),option("dragDrop",!0,dragDropChanged),option("allowDropFileTypes",null),option("cursorBlinkRate",530),option("cursorScrollMargin",0),option("cursorHeight",1,updateSelection,!0),option("singleCursorHeightPerLine",!0,updateSelection,!0),option("workTime",100),option("workDelay",100),option("flattenSpans",!0,resetModeState,!0),option("addModeClass",!1,resetModeState,!0),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()},!0),option("maxHighlightLength",1e4,resetModeState,!0),option("moveInputWithCursor",!0,function(cm,val){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)},!0)}(CodeMirror$1),function(CodeMirror){var optionHandlers=CodeMirror.optionHandlers,helpers=CodeMirror.helpers={};CodeMirror.prototype={constructor:CodeMirror,focus:function(){window.focus(),this.display.input.focus()},setOption:function(option,value){var options=this.options,old=options[option];options[option]==value&&"mode"!=option||(options[option]=value,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$$1,bottom){this.state.keyMaps[bottom?"push":"unshift"](getKeyMap(map$$1))},removeKeyMap:function(map$$1){for(var maps=this.state.keyMaps,i=0;i<maps.length;++i)if(maps[i]==map$$1||maps[i].name==map$$1)return maps.splice(i,1),!0},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){for(var this$1=this,overlays=this.state.overlays,i=0;i<overlays.length;++i){var cur=overlays[i].modeSpec;if(cur==spec||"string"==typeof spec&&cur.name==spec)return overlays.splice(i,1),this$1.state.modeGen++,void regChange(this$1)}}),indentLine:methodOp(function(n,dir,aggressive){"string"!=typeof dir&&"number"!=typeof dir&&(dir=null==dir?this.options.smartIndent?"smart":"prev":dir?"add":"subtract"),isLine(this.doc,n)&&indentLine(this,n,dir,aggressive)}),indentSelection:methodOp(function(how){for(var this$1=this,ranges=this.doc.sel.ranges,end=-1,i=0;i<ranges.length;i++){var range$$1=ranges[i];if(range$$1.empty())range$$1.head.line>end&&(indentLine(this$1,range$$1.head.line,how,!0),end=range$$1.head.line,i==this$1.doc.sel.primIndex&&ensureCursorVisible(this$1));else{var from=range$$1.from(),to=range$$1.to(),start=Math.max(end,from.line);end=Math.min(this$1.lastLine(),to.line-(to.ch?0:1))+1;for(var j=start;j<end;++j)indentLine(this$1,j,how);var newRanges=this$1.doc.sel.ranges;0==from.ch&&ranges.length==newRanges.length&&newRanges[i].from().ch>0&&replaceOneSelection(this$1.doc,i,new Range(from,newRanges[i].to()),sel_dontScroll)}}}),getTokenAt:function(pos,precise){return takeToken(this,pos,precise)},getLineTokens:function(line,precise){return takeToken(this,Pos(line),precise,!0)},getTokenTypeAt:function(pos){pos=clipPos(this.doc,pos);var type,styles=getLineStyles(this,getLine(this.doc,pos.line)),before=0,after=(styles.length-1)/2,ch=pos.ch;if(0==ch)type=styles[2];else for(;;){var mid=before+after>>1;if((mid?styles[2*mid-1]:0)>=ch)after=mid;else{if(!(styles[2*mid+1]<ch)){type=styles[2*mid+2];break}before=mid+1}}var cut=type?type.indexOf("overlay "):-1;return cut<0?type:0==cut?null:type.slice(0,cut-1)},getModeAt:function(pos){var mode=this.doc.mode;return mode.innerMode?CodeMirror.innerMode(mode,this.getTokenAt(pos).state).mode:mode},getHelper:function(pos,type){return this.getHelpers(pos,type)[0]},getHelpers:function(pos,type){var this$1=this,found=[];if(!helpers.hasOwnProperty(type))return found;var help=helpers[type],mode=this.getModeAt(pos);if("string"==typeof mode[type])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]];val&&found.push(val)}else mode.helperType&&help[mode.helperType]?found.push(help[mode.helperType]):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];cur.pred(mode,this$1)&&-1==indexOf(found,cur.val)&&found.push(cur.val)}return found},getStateAfter:function(line,precise){var doc=this.doc;return line=clipLine(doc,null==line?doc.first+doc.size-1:line),getContextBefore(this,line+1,precise).state},cursorCoords:function(start,mode){var pos,range$$1=this.doc.sel.primary();return pos=null==start?range$$1.head:"object"==typeof start?clipPos(this.doc,start):start?range$$1.from():range$$1.to(),cursorCoords(this,pos,mode||"page")},charCoords:function(pos,mode){return charCoords(this,clipPos(this.doc,pos),mode||"page")},coordsChar:function(coords,mode){return coords=fromCoordSystem(this,coords,mode||"page"),coordsChar(this,coords.left,coords.top)},lineAtHeight:function(height,mode){return height=fromCoordSystem(this,{top:height,left:0},mode||"page").top,lineAtHeight(this.doc,height+this.display.viewOffset)},heightAtLine:function(line,mode,includeWidgets){var lineObj,end=!1;if("number"==typeof line){var last=this.doc.first+this.doc.size-1;line<this.doc.first?line=this.doc.first:line>last&&(line=last,end=!0),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,top=(pos=cursorCoords(this,clipPos(this.doc,pos))).bottom,left=pos.left;if(node.style.position="absolute",node.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(node),display.sizer.appendChild(node),"over"==vert)top=pos.top;else if("above"==vert||"near"==vert){var vspace=Math.max(display.wrapper.clientHeight,this.doc.height),hspace=Math.max(display.sizer.clientWidth,display.lineSpace.clientWidth);("above"==vert||pos.bottom+node.offsetHeight>vspace)&&pos.top>node.offsetHeight?top=pos.top-node.offsetHeight:pos.bottom+node.offsetHeight<=vspace&&(top=pos.bottom),left+node.offsetWidth>hspace&&(left=hspace-node.offsetWidth)}node.style.top=top+"px",node.style.left=node.style.right="","right"==horiz?(left=display.sizer.clientWidth-node.offsetWidth,node.style.right="0px"):("left"==horiz?left=0:"middle"==horiz&&(left=(display.sizer.clientWidth-node.offsetWidth)/2),node.style.left=left+"px"),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 this$1=this,dir=1;amount<0&&(dir=-1,amount=-amount);for(var cur=clipPos(this.doc,from),i=0;i<amount&&!(cur=findPosH(this$1.doc,cur,dir,unit,visually)).hitSide;++i);return cur},moveH:methodOp(function(dir,unit){var this$1=this;this.extendSelectionsBy(function(range$$1){return this$1.display.shift||this$1.doc.extend||range$$1.empty()?findPosH(this$1.doc,range$$1.head,dir,unit,this$1.options.rtlMoveVisually):dir<0?range$$1.from():range$$1.to()},sel_move)}),deleteH:methodOp(function(dir,unit){var sel=this.doc.sel,doc=this.doc;sel.somethingSelected()?doc.replaceSelection("",null,"+delete"):deleteNearSelection(this,function(range$$1){var other=findPosH(doc,range$$1.head,dir,unit,!1);return dir<0?{from:other,to:range$$1.head}:{from:range$$1.head,to:other}})}),findPosV:function(from,amount,unit,goalColumn){var this$1=this,dir=1,x=goalColumn;amount<0&&(dir=-1,amount=-amount);for(var cur=clipPos(this.doc,from),i=0;i<amount;++i){var coords=cursorCoords(this$1,cur,"div");if(null==x?x=coords.left:coords.left=x,(cur=findPosV(this$1,coords,dir,unit)).hitSide)break}return cur},moveV:methodOp(function(dir,unit){var this$1=this,doc=this.doc,goals=[],collapse=!this.display.shift&&!doc.extend&&doc.sel.somethingSelected();if(doc.extendSelectionsBy(function(range$$1){if(collapse)return dir<0?range$$1.from():range$$1.to();var headPos=cursorCoords(this$1,range$$1.head,"div");null!=range$$1.goalColumn&&(headPos.left=range$$1.goalColumn),goals.push(headPos.left);var pos=findPosV(this$1,headPos,dir,unit);return"page"==unit&&range$$1==doc.sel.primary()&&addToScrollTop(this$1,charCoords(this$1,pos,"div").top-headPos.top),pos},sel_move),goals.length)for(var i=0;i<doc.sel.ranges.length;i++)doc.sel.ranges[i].goalColumn=goals[i]}),findWordAt:function(pos){var line=getLine(this.doc,pos.line).text,start=pos.ch,end=pos.ch;if(line){var helper=this.getHelper(pos,"wordChars");"before"!=pos.sticky&&end!=line.length||!start?++end:--start;for(var startChar=line.charAt(start),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)};start>0&&check(line.charAt(start-1));)--start;for(;end<line.length&&check(line.charAt(end));)++end}return new Range(Pos(pos.line,start),Pos(pos.line,end))},toggleOverwrite:function(value){null!=value&&value==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?addClass(this.display.cursorDiv,"CodeMirror-overwrite"):rmClass(this.display.cursorDiv,"CodeMirror-overwrite"),signal(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==activeElt()},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$$1,margin){null==range$$1?(range$$1={from:this.doc.sel.primary().head,to:null},null==margin&&(margin=this.options.cursorScrollMargin)):"number"==typeof range$$1?range$$1={from:Pos(range$$1,0),to:null}:null==range$$1.from&&(range$$1={from:range$$1,to:null}),range$$1.to||(range$$1.to=range$$1.from),range$$1.margin=margin||0,null!=range$$1.from.line?scrollToRange(this,range$$1):scrollToCoordsRange(this,range$$1.from,range$$1.to,range$$1.margin)}),setSize:methodOp(function(width,height){var this$1=this,interpret=function(val){return"number"==typeof val||/^\d+$/.test(String(val))?val+"px":val};null!=width&&(this.display.wrapper.style.width=interpret(width)),null!=height&&(this.display.wrapper.style.height=interpret(height)),this.options.lineWrapping&&clearLineMeasurementCache(this);var lineNo$$1=this.display.viewFrom;this.doc.iter(lineNo$$1,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$$1,"widget");break}++lineNo$$1}),this.curOp.forceUpdate=!0,signal(this,"refresh",this)}),operation:function(f){return runInOp(this,f)},refresh:methodOp(function(){var oldHeight=this.display.cachedTextHeight;regChange(this),this.curOp.forceUpdate=!0,clearCaches(this),scrollToCoords(this,this.doc.scrollLeft,this.doc.scrollTop),updateGutterSpace(this),(null==oldHeight||Math.abs(oldHeight-textHeight(this.display))>.5)&&estimateLineHeights(this),signal(this,"refresh",this)}),swapDoc:methodOp(function(doc){var old=this.doc;return old.cm=null,attachDoc(this,doc),clearCaches(this),this.display.input.reset(),scrollToCoords(this,doc.scrollLeft,doc.scrollTop),this.curOp.forceScroll=!0,signalLater(this,"swapDoc",this,old),old}),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){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})}}(CodeMirror$1);var dontDelegate="iter insert remove copy getEditor constructor".split(" ");for(var prop in Doc.prototype)Doc.prototype.hasOwnProperty(prop)&&indexOf(dontDelegate,prop)<0&&(CodeMirror$1.prototype[prop]=function(method){return function(){return method.apply(this.doc,arguments)}}(Doc.prototype[prop]));return eventMixin(Doc),CodeMirror$1.inputStyles={textarea:TextareaInput,contenteditable:ContentEditableInput},CodeMirror$1.defineMode=function(name){CodeMirror$1.defaults.mode||"null"==name||(CodeMirror$1.defaults.mode=name),defineMode.apply(this,arguments)},CodeMirror$1.defineMIME=function(mime,spec){mimeModes[mime]=spec},CodeMirror$1.defineMode("null",function(){return{token:function(stream){return stream.skipToEnd()}}}),CodeMirror$1.defineMIME("text/plain","null"),CodeMirror$1.defineExtension=function(name,func){CodeMirror$1.prototype[name]=func},CodeMirror$1.defineDocExtension=function(name,func){Doc.prototype[name]=func},CodeMirror$1.fromTextArea=function(textarea,options){function save(){textarea.value=cm.getValue()}if(options=options?copyObj(options):{},options.value=textarea.value,!options.tabindex&&textarea.tabIndex&&(options.tabindex=textarea.tabIndex),!options.placeholder&&textarea.placeholder&&(options.placeholder=textarea.placeholder),null==options.autofocus){var hasFocus=activeElt();options.autofocus=hasFocus==textarea||null!=textarea.getAttribute("autofocus")&&hasFocus==document.body}var realSubmit;if(textarea.form&&(on(textarea.form,"submit",save),!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,save(),textarea.parentNode.removeChild(cm.getWrapperElement()),textarea.style.display="",textarea.form&&(off(textarea.form,"submit",save),"function"==typeof textarea.form.submit&&(textarea.form.submit=realSubmit))}},textarea.style.display="none";var cm=CodeMirror$1(function(node){return textarea.parentNode.insertBefore(node,textarea.nextSibling)},options);return cm},function(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}(CodeMirror$1),CodeMirror$1.version="5.27.2",CodeMirror$1})},{}],85:[function(require,module,exports){module.exports={Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"⁡",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",amp:"&",AMP:"&",andand:"⩕",And:"⩓",and:"∧",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angmsd:"∡",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",apacir:"⩯",ap:"≈",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",barwed:"⌅",Barwed:"⌆",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",because:"∵",Because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxdl:"┐",boxdL:"╕",boxDl:"╖",boxDL:"╗",boxdr:"┌",boxdR:"╒",boxDr:"╓",boxDR:"╔",boxh:"─",boxH:"═",boxhd:"┬",boxHd:"╤",boxhD:"╥",boxHD:"╦",boxhu:"┴",boxHu:"╧",boxhU:"╨",boxHU:"╩",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxul:"┘",boxuL:"╛",boxUl:"╜",boxUL:"╝",boxur:"└",boxuR:"╘",boxUr:"╙",boxUR:"╚",boxv:"│",boxV:"║",boxvh:"┼",boxvH:"╪",boxVh:"╫",boxVH:"╬",boxvl:"┤",boxvL:"╡",boxVl:"╢",boxVL:"╣",boxvr:"├",boxvR:"╞",boxVr:"╟",boxVR:"╠",bprime:"‵",breve:"˘",Breve:"˘",brvbar:"¦",bscr:"𝒷",Bscr:"ℬ",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsolb:"⧅",bsol:"\\",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",capand:"⩄",capbrcup:"⩉",capcap:"⩋",cap:"∩",Cap:"⋒",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",centerdot:"·",CenterDot:"·",cfr:"𝔠",Cfr:"ℭ",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cir:"○",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",colon:":",Colon:"∷",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",conint:"∮",Conint:"∯",ContourIntegral:"∮",copf:"𝕔",Copf:"ℂ",coprod:"∐",Coproduct:"∐",copy:"©",COPY:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",cross:"✗",Cross:"⨯",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",cupbrcap:"⩈",cupcap:"⩆",CupCap:"≍",cup:"∪",Cup:"⋓",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",dagger:"†",Dagger:"‡",daleth:"ℸ",darr:"↓",Darr:"↡",dArr:"⇓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",ddagger:"‡",ddarr:"⇊",DD:"ⅅ",dd:"ⅆ",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",diamond:"⋄",Diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrowBar:"⤓",downarrow:"↓",DownArrow:"↓",Downarrow:"⇓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVectorBar:"⥖",DownLeftVector:"↽",DownRightTeeVector:"⥟",DownRightVectorBar:"⥗",DownRightVector:"⇁",DownTeeArrow:"↧",DownTee:"⊤",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",Ecirc:"Ê",ecirc:"ê",ecir:"≖",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",edot:"ė",eDot:"≑",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp13:" ",emsp14:" ",emsp:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",escr:"ℯ",Escr:"ℰ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",exponentiale:"ⅇ",ExponentialE:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",forall:"∀",ForAll:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",fscr:"𝒻",Fscr:"ℱ",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",ge:"≥",gE:"≧",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",gescc:"⪩",ges:"⩾",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",gg:"≫",Gg:"⋙",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gla:"⪥",gl:"≷",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gne:"⪈",gnE:"≩",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",gtcc:"⪧",gtcir:"⩺",gt:">",GT:">",Gt:"≫",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",harrcir:"⥈",harr:"↔",hArr:"⇔",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",hfr:"𝔥",Hfr:"ℌ",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",hopf:"𝕙",Hopf:"ℍ",horbar:"―",HorizontalLine:"─",hscr:"𝒽",Hscr:"ℋ",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"⁣",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",ifr:"𝔦",Ifr:"ℑ",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",Im:"ℑ",imof:"⊷",imped:"Ƶ",Implies:"⇒",incare:"℅",in:"∈",infin:"∞",infintie:"⧝",inodot:"ı",intcal:"⊺",int:"∫",Int:"∬",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"⁣",InvisibleTimes:"⁢",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",iscr:"𝒾",Iscr:"ℐ",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",lang:"⟨",Lang:"⟪",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",larrb:"⇤",larrbfs:"⤟",larr:"←",Larr:"↞",lArr:"⇐",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",latail:"⤙",lAtail:"⤛",lat:"⪫",late:"⪭",lates:"⪭︀",lbarr:"⤌",lBarr:"⤎",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",le:"≤",lE:"≦",LeftAngleBracket:"⟨",LeftArrowBar:"⇤",leftarrow:"←",LeftArrow:"←",Leftarrow:"⇐",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVectorBar:"⥙",LeftDownVector:"⇃",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",leftrightarrow:"↔",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTeeArrow:"↤",LeftTee:"⊣",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangleBar:"⧏",LeftTriangle:"⊲",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVectorBar:"⥘",LeftUpVector:"↿",LeftVectorBar:"⥒",LeftVector:"↼",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",lescc:"⪨",les:"⩽",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",llarr:"⇇",ll:"≪",Ll:"⋘",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoustache:"⎰",lmoust:"⎰",lnap:"⪉",lnapprox:"⪉",lne:"⪇",lnE:"≨",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",longleftarrow:"⟵",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftrightarrow:"⟷",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longmapsto:"⟼",longrightarrow:"⟶",LongRightArrow:"⟶",Longrightarrow:"⟹",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",lscr:"𝓁",Lscr:"ℒ",lsh:"↰",Lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",ltcc:"⪦",ltcir:"⩹",lt:"<",LT:"<",Lt:"≪",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",midast:"*",midcir:"⫰",mid:"∣",middot:"·",minusb:"⊟",minus:"−",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",mscr:"𝓂",Mscr:"ℳ",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natural:"♮",naturals:"ℕ",natur:"♮",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",nearhk:"⤤",nearr:"↗",neArr:"⇗",nearrow:"↗",ne:"≠",nedot:"≐̸",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:"\n",nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nharr:"↮",nhArr:"⇎",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlarr:"↚",nlArr:"⇍",nldr:"‥",nlE:"≦̸",nle:"≰",nleftarrow:"↚",nLeftarrow:"⇍",nleftrightarrow:"↮",nLeftrightarrow:"⇎",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",nopf:"𝕟",Nopf:"ℕ",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangleBar:"⧏̸",NotLeftTriangle:"⋪",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangleBar:"⧐̸",NotRightTriangle:"⋫",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",nparallel:"∦",npar:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",nprec:"⊀",npreceq:"⪯̸",npre:"⪯̸",nrarrc:"⤳̸",nrarr:"↛",nrArr:"⇏",nrarrw:"↝̸",nrightarrow:"↛",nRightarrow:"⇏",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nvdash:"⊬",nvDash:"⊭",nVdash:"⊮",nVDash:"⊯",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwarr:"↖",nwArr:"⇖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",Ocirc:"Ô",ocirc:"ô",ocir:"⊚",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",orarr:"↻",Or:"⩔",or:"∨",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",otimesas:"⨶",Otimes:"⨷",otimes:"⊗",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",para:"¶",parallel:"∥",par:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plus:"+",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",popf:"𝕡",Popf:"ℙ",pound:"£",prap:"⪷",Pr:"⪻",pr:"≺",prcue:"≼",precapprox:"⪷",prec:"≺",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",pre:"⪯",prE:"⪳",precsim:"≾",prime:"′",Prime:"″",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportional:"∝",Proportion:"∷",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",qopf:"𝕢",Qopf:"ℚ",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",quot:'"',QUOT:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",rang:"⟩",Rang:"⟫",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarr:"→",Rarr:"↠",rArr:"⇒",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",ratail:"⤚",rAtail:"⤜",ratio:"∶",rationals:"ℚ",rbarr:"⤍",rBarr:"⤏",RBarr:"⤐",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",Re:"ℜ",rect:"▭",reg:"®",REG:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",rfr:"𝔯",Rfr:"ℜ",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrowBar:"⇥",rightarrow:"→",RightArrow:"→",Rightarrow:"⇒",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVectorBar:"⥕",RightDownVector:"⇂",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTeeArrow:"↦",RightTee:"⊢",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangleBar:"⧐",RightTriangle:"⊳",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVectorBar:"⥔",RightUpVector:"↾",RightVectorBar:"⥓",RightVector:"⇀",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoustache:"⎱",rmoust:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",ropf:"𝕣",Ropf:"ℝ",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",rscr:"𝓇",Rscr:"ℛ",rsh:"↱",Rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",scap:"⪸",Scaron:"Š",scaron:"š",Sc:"⪼",sc:"≻",sccue:"≽",sce:"⪰",scE:"⪴",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdotb:"⊡",sdot:"⋅",sdote:"⩦",searhk:"⤥",searr:"↘",seArr:"⇘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",solbar:"⌿",solb:"⧄",sol:"/",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",square:"□",Square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squ:"□",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",sub:"⊂",Sub:"⋐",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",subset:"⊂",Subset:"⋐",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succapprox:"⪸",succ:"≻",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",sum:"∑",Sum:"∑",sung:"♪",sup1:"¹",sup2:"²",sup3:"³",sup:"⊃",Sup:"⋑",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",supset:"⊃",Supset:"⋑",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swarr:"↙",swArr:"⇙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:"\t",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",therefore:"∴",Therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",ThinSpace:" ",thinsp:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",tilde:"˜",Tilde:"∼",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",timesbar:"⨱",timesb:"⊠",times:"×",timesd:"⨰",tint:"∭",toea:"⤨",topbot:"⌶",topcir:"⫱",top:"⊤",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",trade:"™",TRADE:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",uarr:"↑",Uarr:"↟",uArr:"⇑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrowBar:"⤒",uparrow:"↑",UpArrow:"↑",Uparrow:"⇑",UpArrowDownArrow:"⇅",updownarrow:"↕",UpDownArrow:"↕",Updownarrow:"⇕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",upsi:"υ",Upsi:"ϒ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTeeArrow:"↥",UpTee:"⊥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",varr:"↕",vArr:"⇕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",vBar:"⫨",Vbar:"⫫",vBarv:"⫩",Vcy:"В",vcy:"в",vdash:"⊢",vDash:"⊨",Vdash:"⊩",VDash:"⊫",Vdashl:"⫦",veebar:"⊻",vee:"∨",Vee:"⋁",veeeq:"≚",vellip:"⋮",verbar:"|",Verbar:"‖",vert:"|",Vert:"‖",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",wedge:"∧",Wedge:"⋀",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xharr:"⟷",xhArr:"⟺",Xi:"Ξ",xi:"ξ",xlarr:"⟵",xlArr:"⟸",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrarr:"⟶",xrArr:"⟹",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",yuml:"ÿ",Yuml:"Ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",zfr:"𝔷",Zfr:"ℨ",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",zopf:"𝕫",Zopf:"ℤ",Zscr:"𝒵",zscr:"𝓏",zwj:"‍",zwnj:"‌"}},{}],86:[function(require,module,exports){"use strict";function makeEmptyFunction(arg){return function(){return arg}}var emptyFunction=function(){};emptyFunction.thatReturns=makeEmptyFunction,emptyFunction.thatReturnsFalse=makeEmptyFunction(!1),emptyFunction.thatReturnsTrue=makeEmptyFunction(!0),emptyFunction.thatReturnsNull=makeEmptyFunction(null),emptyFunction.thatReturnsThis=function(){return this},emptyFunction.thatReturnsArgument=function(arg){return arg},module.exports=emptyFunction},{}],87:[function(require,module,exports){(function(process){"use strict";var validateFormat=function(format){};"production"!==process.env.NODE_ENV&&(validateFormat=function(format){if(void 0===format)throw new Error("invariant requires an error message argument")}),module.exports=function(condition,format,a,b,c,d,e,f){if(validateFormat(format),!condition){var error;if(void 0===format)error=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var args=[a,b,c,d,e,f],argIndex=0;(error=new Error(format.replace(/%s/g,function(){return args[argIndex++]}))).name="Invariant Violation"}throw error.framesToPop=1,error}}}).call(this,require("_process"))},{_process:148}],88:[function(require,module,exports){(function(process){"use strict";var warning=require("./emptyFunction");"production"!==process.env.NODE_ENV&&function(){var printWarning=function(format){for(var _len=arguments.length,args=Array(_len>1?_len-1:0),_key=1;_key<_len;_key++)args[_key-1]=arguments[_key];var argIndex=0,message="Warning: "+format.replace(/%s/g,function(){return args[argIndex++]});"undefined"!=typeof console&&console.error(message);try{throw new Error(message)}catch(x){}};warning=function(condition,format){if(void 0===format)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");if(0!==format.indexOf("Failed Composite propType: ")&&!condition){for(var _len2=arguments.length,args=Array(_len2>2?_len2-2:0),_key2=2;_key2<_len2;_key2++)args[_key2-2]=arguments[_key2];printWarning.apply(void 0,[format].concat(args))}}}(),module.exports=warning}).call(this,require("_process"))},{"./emptyFunction":86,_process:148}],89:[function(require,module,exports){"use strict";function assign(obj){return Array.prototype.slice.call(arguments,1).forEach(function(source){source&&Object.keys(source).forEach(function(key){obj[key]=source[key]})}),obj}function _class(obj){return Object.prototype.toString.call(obj)}function isString(obj){return"[object String]"===_class(obj)}function isObject(obj){return"[object Object]"===_class(obj)}function isRegExp(obj){return"[object RegExp]"===_class(obj)}function isFunction(obj){return"[object Function]"===_class(obj)}function escapeRE(str){return str.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function isOptionsObj(obj){return Object.keys(obj||{}).reduce(function(acc,k){return acc||defaultOptions.hasOwnProperty(k)},!1)}function resetScanCache(self){self.__index__=-1,self.__text_cache__=""}function createValidator(re){return function(text,pos){var tail=text.slice(pos);return re.test(tail)?tail.match(re)[0].length:0}}function createNormalizer(){return function(match,self){self.normalize(match)}}function compile(self){function untpl(tpl){return tpl.replace("%TLDS%",re.src_tlds)}function schemaError(name,val){throw new Error('(LinkifyIt) Invalid schema "'+name+'": '+val)}var re=self.re=require("./lib/re")(self.__opts__),tlds=self.__tlds__.slice();self.onCompile(),self.__tlds_replaced__||tlds.push(tlds_2ch_src_re),tlds.push(re.src_xn),re.src_tlds=tlds.join("|"),re.email_fuzzy=RegExp(untpl(re.tpl_email_fuzzy),"i"),re.link_fuzzy=RegExp(untpl(re.tpl_link_fuzzy),"i"),re.link_no_ip_fuzzy=RegExp(untpl(re.tpl_link_no_ip_fuzzy),"i"),re.host_fuzzy_test=RegExp(untpl(re.tpl_host_fuzzy_test),"i");var aliases=[];self.__compiled__={},Object.keys(self.__schemas__).forEach(function(name){var val=self.__schemas__[name];if(null!==val){var compiled={validate:null,link:null};if(self.__compiled__[name]=compiled,isObject(val))return isRegExp(val.validate)?compiled.validate=createValidator(val.validate):isFunction(val.validate)?compiled.validate=val.validate:schemaError(name,val),void(isFunction(val.normalize)?compiled.normalize=val.normalize:val.normalize?schemaError(name,val):compiled.normalize=createNormalizer());isString(val)?aliases.push(name):schemaError(name,val)}}),aliases.forEach(function(alias){self.__compiled__[self.__schemas__[alias]]&&(self.__compiled__[alias].validate=self.__compiled__[self.__schemas__[alias]].validate,self.__compiled__[alias].normalize=self.__compiled__[self.__schemas__[alias]].normalize)}),self.__compiled__[""]={validate:null,normalize:createNormalizer()};var slist=Object.keys(self.__compiled__).filter(function(name){return name.length>0&&self.__compiled__[name]}).map(escapeRE).join("|");self.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+re.src_ZPCc+"))("+slist+")","i"),self.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+re.src_ZPCc+"))("+slist+")","ig"),self.re.pretest=RegExp("("+self.re.schema_test.source+")|("+self.re.host_fuzzy_test.source+")|@","i"),resetScanCache(self)}function Match(self,shift){var start=self.__index__,end=self.__last_index__,text=self.__text_cache__.slice(start,end);this.schema=self.__schema__.toLowerCase(),this.index=start+shift,this.lastIndex=end+shift,this.raw=text,this.text=text,this.url=text}function createMatch(self,shift){var match=new Match(self,shift);return self.__compiled__[match.schema].normalize(match,self),match}function LinkifyIt(schemas,options){if(!(this instanceof LinkifyIt))return new LinkifyIt(schemas,options);options||isOptionsObj(schemas)&&(options=schemas,schemas={}),this.__opts__=assign({},defaultOptions,options),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=assign({},defaultSchemas,schemas),this.__compiled__={},this.__tlds__=tlds_default,this.__tlds_replaced__=!1,this.re={},compile(this)}var defaultOptions={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1},defaultSchemas={"http:":{validate:function(text,pos,self){var tail=text.slice(pos);return self.re.http||(self.re.http=new RegExp("^\\/\\/"+self.re.src_auth+self.re.src_host_port_strict+self.re.src_path,"i")),self.re.http.test(tail)?tail.match(self.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(text,pos,self){var tail=text.slice(pos);return self.re.no_http||(self.re.no_http=new RegExp("^"+self.re.src_auth+"(?:localhost|(?:(?:"+self.re.src_domain+")\\.)+"+self.re.src_domain_root+")"+self.re.src_port+self.re.src_host_terminator+self.re.src_path,"i")),self.re.no_http.test(tail)?pos>=3&&":"===text[pos-3]?0:pos>=3&&"/"===text[pos-3]?0:tail.match(self.re.no_http)[0].length:0}},"mailto:":{validate:function(text,pos,self){var tail=text.slice(pos);return self.re.mailto||(self.re.mailto=new RegExp("^"+self.re.src_email_name+"@"+self.re.src_host_strict,"i")),self.re.mailto.test(tail)?tail.match(self.re.mailto)[0].length:0}}},tlds_2ch_src_re="a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]",tlds_default="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");LinkifyIt.prototype.add=function(schema,definition){return this.__schemas__[schema]=definition,compile(this),this},LinkifyIt.prototype.set=function(options){return this.__opts__=assign(this.__opts__,options),this},LinkifyIt.prototype.test=function(text){if(this.__text_cache__=text,this.__index__=-1,!text.length)return!1;var m,ml,me,len,shift,next,re,tld_pos;if(this.re.schema_test.test(text))for((re=this.re.schema_search).lastIndex=0;null!==(m=re.exec(text));)if(len=this.testSchemaAt(text,m[2],re.lastIndex)){this.__schema__=m[2],this.__index__=m.index+m[1].length,this.__last_index__=m.index+m[0].length+len;break}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(tld_pos=text.search(this.re.host_fuzzy_test))>=0&&(this.__index__<0||tld_pos<this.__index__)&&null!==(ml=text.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))&&(shift=ml.index+ml[1].length,(this.__index__<0||shift<this.__index__)&&(this.__schema__="",this.__index__=shift,this.__last_index__=ml.index+ml[0].length)),this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"]&&text.indexOf("@")>=0&&null!==(me=text.match(this.re.email_fuzzy))&&(shift=me.index+me[1].length,next=me.index+me[0].length,(this.__index__<0||shift<this.__index__||shift===this.__index__&&next>this.__last_index__)&&(this.__schema__="mailto:",this.__index__=shift,this.__last_index__=next)),this.__index__>=0},LinkifyIt.prototype.pretest=function(text){return this.re.pretest.test(text)},LinkifyIt.prototype.testSchemaAt=function(text,schema,pos){return this.__compiled__[schema.toLowerCase()]?this.__compiled__[schema.toLowerCase()].validate(text,pos,this):0},LinkifyIt.prototype.match=function(text){var shift=0,result=[];this.__index__>=0&&this.__text_cache__===text&&(result.push(createMatch(this,shift)),shift=this.__last_index__);for(var tail=shift?text.slice(shift):text;this.test(tail);)result.push(createMatch(this,shift)),tail=tail.slice(this.__last_index__),shift+=this.__last_index__;return result.length?result:null},LinkifyIt.prototype.tlds=function(list,keepOld){return list=Array.isArray(list)?list:[list],keepOld?(this.__tlds__=this.__tlds__.concat(list).sort().filter(function(el,idx,arr){return el!==arr[idx-1]}).reverse(),compile(this),this):(this.__tlds__=list.slice(),this.__tlds_replaced__=!0,compile(this),this)},LinkifyIt.prototype.normalize=function(match){match.schema||(match.url="http://"+match.url),"mailto:"!==match.schema||/^mailto:/i.test(match.url)||(match.url="mailto:"+match.url)},LinkifyIt.prototype.onCompile=function(){},module.exports=LinkifyIt},{"./lib/re":90}],90:[function(require,module,exports){"use strict";module.exports=function(opts){var re={};re.src_Any=require("uc.micro/properties/Any/regex").source,re.src_Cc=require("uc.micro/categories/Cc/regex").source,re.src_Z=require("uc.micro/categories/Z/regex").source,re.src_P=require("uc.micro/categories/P/regex").source,re.src_ZPCc=[re.src_Z,re.src_P,re.src_Cc].join("|"),re.src_ZCc=[re.src_Z,re.src_Cc].join("|");return re.src_pseudo_letter="(?:(?![><|]|"+re.src_ZPCc+")"+re.src_Any+")",re.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",re.src_auth="(?:(?:(?!"+re.src_ZCc+"|[@/\\[\\]()]).)+@)?",re.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",re.src_host_terminator="(?=$|[><|]|"+re.src_ZPCc+")(?!-|_|:\\d|\\.-|\\.(?!$|"+re.src_ZPCc+"))",re.src_path="(?:[/?#](?:(?!"+re.src_ZCc+"|[><|]|[()[\\]{}.,\"'?!\\-]).|\\[(?:(?!"+re.src_ZCc+"|\\]).)*\\]|\\((?:(?!"+re.src_ZCc+"|[)]).)*\\)|\\{(?:(?!"+re.src_ZCc+'|[}]).)*\\}|\\"(?:(?!'+re.src_ZCc+'|["]).)+\\"|\\\'(?:(?!'+re.src_ZCc+"|[']).)+\\'|\\'(?="+re.src_pseudo_letter+"|[-]).|\\.{2,3}[a-zA-Z0-9%/]|\\.(?!"+re.src_ZCc+"|[.]).|"+(opts&&opts["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+"\\,(?!"+re.src_ZCc+").|\\!(?!"+re.src_ZCc+"|[!]).|\\?(?!"+re.src_ZCc+"|[?]).)+|\\/)?",re.src_email_name='[\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]+',re.src_xn="xn--[a-z0-9\\-]{1,59}",re.src_domain_root="(?:"+re.src_xn+"|"+re.src_pseudo_letter+"{1,63})",re.src_domain="(?:"+re.src_xn+"|(?:"+re.src_pseudo_letter+")|(?:"+re.src_pseudo_letter+"(?:-(?!-)|"+re.src_pseudo_letter+"){0,61}"+re.src_pseudo_letter+"))",re.src_host="(?:(?:(?:(?:"+re.src_domain+")\\.)*"+re.src_domain+"))",re.tpl_host_fuzzy="(?:"+re.src_ip4+"|(?:(?:(?:"+re.src_domain+")\\.)+(?:%TLDS%)))",re.tpl_host_no_ip_fuzzy="(?:(?:(?:"+re.src_domain+")\\.)+(?:%TLDS%))",re.src_host_strict=re.src_host+re.src_host_terminator,re.tpl_host_fuzzy_strict=re.tpl_host_fuzzy+re.src_host_terminator,re.src_host_port_strict=re.src_host+re.src_port+re.src_host_terminator,re.tpl_host_port_fuzzy_strict=re.tpl_host_fuzzy+re.src_port+re.src_host_terminator,re.tpl_host_port_no_ip_fuzzy_strict=re.tpl_host_no_ip_fuzzy+re.src_port+re.src_host_terminator,re.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+re.src_ZPCc+"|>|$))",re.tpl_email_fuzzy="(^|[><|]|\\(|"+re.src_ZCc+")("+re.src_email_name+"@"+re.tpl_host_fuzzy_strict+")",re.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+re.src_ZPCc+"))((?![$+<=>^`||])"+re.tpl_host_port_fuzzy_strict+re.src_path+")",re.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+re.src_ZPCc+"))((?![$+<=>^`||])"+re.tpl_host_port_no_ip_fuzzy_strict+re.src_path+")",re}},{"uc.micro/categories/Cc/regex":155,"uc.micro/categories/P/regex":157,"uc.micro/categories/Z/regex":158,"uc.micro/properties/Any/regex":160}],91:[function(require,module,exports){"use strict";module.exports=require("./lib/")},{"./lib/":100}],92:[function(require,module,exports){"use strict";module.exports=require("entities/maps/entities.json")},{"entities/maps/entities.json":85}],93:[function(require,module,exports){"use strict";module.exports=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","meta","nav","noframes","ol","optgroup","option","p","param","section","source","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"]},{}],94:[function(require,module,exports){"use strict";var open_tag="<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*\\/?>",close_tag="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",HTML_TAG_RE=new RegExp("^(?:"+open_tag+"|"+close_tag+"|\x3c!----\x3e|\x3c!--(?:-?[^>-])(?:-?[^-])*--\x3e|<[?].*?[?]>|<![A-Z]+\\s+[^>]*>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>)"),HTML_OPEN_CLOSE_TAG_RE=new RegExp("^(?:"+open_tag+"|"+close_tag+")");module.exports.HTML_TAG_RE=HTML_TAG_RE,module.exports.HTML_OPEN_CLOSE_TAG_RE=HTML_OPEN_CLOSE_TAG_RE},{}],95:[function(require,module,exports){"use strict";function _class(obj){return Object.prototype.toString.call(obj)}function has(object,key){return _hasOwnProperty.call(object,key)}function isValidEntityCode(c){return!(c>=55296&&c<=57343)&&(!(c>=64976&&c<=65007)&&(65535!=(65535&c)&&65534!=(65535&c)&&(!(c>=0&&c<=8)&&(11!==c&&(!(c>=14&&c<=31)&&(!(c>=127&&c<=159)&&!(c>1114111)))))))}function fromCodePoint(c){if(c>65535){var surrogate1=55296+((c-=65536)>>10),surrogate2=56320+(1023&c);return String.fromCharCode(surrogate1,surrogate2)}return String.fromCharCode(c)}function replaceEntityPattern(match,name){var code=0;return has(entities,name)?entities[name]:35===name.charCodeAt(0)&&DIGITAL_ENTITY_TEST_RE.test(name)&&(code="x"===name[1].toLowerCase()?parseInt(name.slice(2),16):parseInt(name.slice(1),10),isValidEntityCode(code))?fromCodePoint(code):match}function replaceUnsafeChar(ch){return HTML_REPLACEMENTS[ch]}var _hasOwnProperty=Object.prototype.hasOwnProperty,UNESCAPE_MD_RE=/\\([!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~])/g,ENTITY_RE=/&([a-z#][a-z0-9]{1,31});/gi,UNESCAPE_ALL_RE=new RegExp(UNESCAPE_MD_RE.source+"|"+ENTITY_RE.source,"gi"),DIGITAL_ENTITY_TEST_RE=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))/i,entities=require("./entities"),HTML_ESCAPE_TEST_RE=/[&<>"]/,HTML_ESCAPE_REPLACE_RE=/[&<>"]/g,HTML_REPLACEMENTS={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"},REGEXP_ESCAPE_RE=/[.?*+^$[\]\\(){}|-]/g,UNICODE_PUNCT_RE=require("uc.micro/categories/P/regex");exports.lib={},exports.lib.mdurl=require("mdurl"),exports.lib.ucmicro=require("uc.micro"),exports.assign=function(obj){return Array.prototype.slice.call(arguments,1).forEach(function(source){if(source){if("object"!=typeof source)throw new TypeError(source+"must be object");Object.keys(source).forEach(function(key){obj[key]=source[key]})}}),obj},exports.isString=function(obj){return"[object String]"===_class(obj)},exports.has=has,exports.unescapeMd=function(str){return str.indexOf("\\")<0?str:str.replace(UNESCAPE_MD_RE,"$1")},exports.unescapeAll=function(str){return str.indexOf("\\")<0&&str.indexOf("&")<0?str:str.replace(UNESCAPE_ALL_RE,function(match,escaped,entity){return escaped||replaceEntityPattern(match,entity)})},exports.isValidEntityCode=isValidEntityCode,exports.fromCodePoint=fromCodePoint,exports.escapeHtml=function(str){return HTML_ESCAPE_TEST_RE.test(str)?str.replace(HTML_ESCAPE_REPLACE_RE,replaceUnsafeChar):str},exports.arrayReplaceAt=function(src,pos,newElements){return[].concat(src.slice(0,pos),newElements,src.slice(pos+1))},exports.isSpace=function(code){switch(code){case 9:case 32:return!0}return!1},exports.isWhiteSpace=function(code){if(code>=8192&&code<=8202)return!0;switch(code){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1},exports.isMdAsciiPunct=function(ch){switch(ch){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}},exports.isPunctChar=function(ch){return UNICODE_PUNCT_RE.test(ch)},exports.escapeRE=function(str){return str.replace(REGEXP_ESCAPE_RE,"\\$&")},exports.normalizeReference=function(str){return str.trim().replace(/\s+/g," ").toUpperCase()}},{"./entities":92,mdurl:146,"uc.micro":159,"uc.micro/categories/P/regex":157}],96:[function(require,module,exports){"use strict";exports.parseLinkLabel=require("./parse_link_label"),exports.parseLinkDestination=require("./parse_link_destination"),exports.parseLinkTitle=require("./parse_link_title")},{"./parse_link_destination":97,"./parse_link_label":98,"./parse_link_title":99}],97:[function(require,module,exports){"use strict";var isSpace=require("../common/utils").isSpace,unescapeAll=require("../common/utils").unescapeAll;module.exports=function(str,pos,max){var code,level,start=pos,result={ok:!1,pos:0,lines:0,str:""};if(60===str.charCodeAt(pos)){for(pos++;pos<max;){if(10===(code=str.charCodeAt(pos))||isSpace(code))return result;if(62===code)return result.pos=pos+1,result.str=unescapeAll(str.slice(start+1,pos)),result.ok=!0,result;92===code&&pos+1<max?pos+=2:pos++}return result}for(level=0;pos<max&&32!==(code=str.charCodeAt(pos))&&!(code<32||127===code);)if(92===code&&pos+1<max)pos+=2;else{if(40===code&&level++,41===code){if(0===level)break;level--}pos++}return start===pos?result:0!==level?result:(result.str=unescapeAll(str.slice(start,pos)),result.lines=0,result.pos=pos,result.ok=!0,result)}},{"../common/utils":95}],98:[function(require,module,exports){"use strict";module.exports=function(state,start,disableNested){var level,found,marker,prevPos,labelEnd=-1,max=state.posMax,oldPos=state.pos;for(state.pos=start+1,level=1;state.pos<max;){if(93===(marker=state.src.charCodeAt(state.pos))&&0==--level){found=!0;break}if(prevPos=state.pos,state.md.inline.skipToken(state),91===marker)if(prevPos===state.pos-1)level++;else if(disableNested)return state.pos=oldPos,-1}return found&&(labelEnd=state.pos),state.pos=oldPos,labelEnd}},{}],99:[function(require,module,exports){"use strict";var unescapeAll=require("../common/utils").unescapeAll;module.exports=function(str,pos,max){var code,marker,lines=0,start=pos,result={ok:!1,pos:0,lines:0,str:""};if(pos>=max)return result;if(34!==(marker=str.charCodeAt(pos))&&39!==marker&&40!==marker)return result;for(pos++,40===marker&&(marker=41);pos<max;){if((code=str.charCodeAt(pos))===marker)return result.pos=pos+1,result.lines=lines,result.str=unescapeAll(str.slice(start+1,pos)),result.ok=!0,result;10===code?lines++:92===code&&pos+1<max&&(pos++,10===str.charCodeAt(pos)&&lines++),pos++}return result}},{"../common/utils":95}],100:[function(require,module,exports){"use strict";function validateLink(url){var str=url.trim().toLowerCase();return!BAD_PROTO_RE.test(str)||!!GOOD_DATA_RE.test(str)}function normalizeLink(url){var parsed=mdurl.parse(url,!0);if(parsed.hostname&&(!parsed.protocol||RECODE_HOSTNAME_FOR.indexOf(parsed.protocol)>=0))try{parsed.hostname=punycode.toASCII(parsed.hostname)}catch(er){}return mdurl.encode(mdurl.format(parsed))}function normalizeLinkText(url){var parsed=mdurl.parse(url,!0);if(parsed.hostname&&(!parsed.protocol||RECODE_HOSTNAME_FOR.indexOf(parsed.protocol)>=0))try{parsed.hostname=punycode.toUnicode(parsed.hostname)}catch(er){}return mdurl.decode(mdurl.format(parsed))}function MarkdownIt(presetName,options){if(!(this instanceof MarkdownIt))return new MarkdownIt(presetName,options);options||utils.isString(presetName)||(options=presetName||{},presetName="default"),this.inline=new ParserInline,this.block=new ParserBlock,this.core=new ParserCore,this.renderer=new Renderer,this.linkify=new LinkifyIt,this.validateLink=validateLink,this.normalizeLink=normalizeLink,this.normalizeLinkText=normalizeLinkText,this.utils=utils,this.helpers=utils.assign({},helpers),this.options={},this.configure(presetName),options&&this.set(options)}var utils=require("./common/utils"),helpers=require("./helpers"),Renderer=require("./renderer"),ParserCore=require("./parser_core"),ParserBlock=require("./parser_block"),ParserInline=require("./parser_inline"),LinkifyIt=require("linkify-it"),mdurl=require("mdurl"),punycode=require("punycode"),config={default:require("./presets/default"),zero:require("./presets/zero"),commonmark:require("./presets/commonmark")},BAD_PROTO_RE=/^(vbscript|javascript|file|data):/,GOOD_DATA_RE=/^data:image\/(gif|png|jpeg|webp);/,RECODE_HOSTNAME_FOR=["http:","https:","mailto:"];MarkdownIt.prototype.set=function(options){return utils.assign(this.options,options),this},MarkdownIt.prototype.configure=function(presets){var presetName,self=this;if(utils.isString(presets)&&(presetName=presets,!(presets=config[presetName])))throw new Error('Wrong `markdown-it` preset "'+presetName+'", check name');if(!presets)throw new Error("Wrong `markdown-it` preset, can't be empty");return presets.options&&self.set(presets.options),presets.components&&Object.keys(presets.components).forEach(function(name){presets.components[name].rules&&self[name].ruler.enableOnly(presets.components[name].rules),presets.components[name].rules2&&self[name].ruler2.enableOnly(presets.components[name].rules2)}),this},MarkdownIt.prototype.enable=function(list,ignoreInvalid){var result=[];Array.isArray(list)||(list=[list]),["core","block","inline"].forEach(function(chain){result=result.concat(this[chain].ruler.enable(list,!0))},this),result=result.concat(this.inline.ruler2.enable(list,!0));var missed=list.filter(function(name){return result.indexOf(name)<0});if(missed.length&&!ignoreInvalid)throw new Error("MarkdownIt. Failed to enable unknown rule(s): "+missed);return this},MarkdownIt.prototype.disable=function(list,ignoreInvalid){var result=[];Array.isArray(list)||(list=[list]),["core","block","inline"].forEach(function(chain){result=result.concat(this[chain].ruler.disable(list,!0))},this),result=result.concat(this.inline.ruler2.disable(list,!0));var missed=list.filter(function(name){return result.indexOf(name)<0});if(missed.length&&!ignoreInvalid)throw new Error("MarkdownIt. Failed to disable unknown rule(s): "+missed);return this},MarkdownIt.prototype.use=function(plugin){var args=[this].concat(Array.prototype.slice.call(arguments,1));return plugin.apply(plugin,args),this},MarkdownIt.prototype.parse=function(src,env){if("string"!=typeof src)throw new Error("Input data should be a String");var state=new this.core.State(src,this,env);return this.core.process(state),state.tokens},MarkdownIt.prototype.render=function(src,env){return env=env||{},this.renderer.render(this.parse(src,env),this.options,env)},MarkdownIt.prototype.parseInline=function(src,env){var state=new this.core.State(src,this,env);return state.inlineMode=!0,this.core.process(state),state.tokens},MarkdownIt.prototype.renderInline=function(src,env){return env=env||{},this.renderer.render(this.parseInline(src,env),this.options,env)},module.exports=MarkdownIt},{"./common/utils":95,"./helpers":96,"./parser_block":101,"./parser_core":102,"./parser_inline":103,"./presets/commonmark":104,"./presets/default":105,"./presets/zero":106,"./renderer":107,"linkify-it":89,mdurl:146,punycode:154}],101:[function(require,module,exports){"use strict";function ParserBlock(){this.ruler=new Ruler;for(var i=0;i<_rules.length;i++)this.ruler.push(_rules[i][0],_rules[i][1],{alt:(_rules[i][2]||[]).slice()})}var Ruler=require("./ruler"),_rules=[["table",require("./rules_block/table"),["paragraph","reference"]],["code",require("./rules_block/code")],["fence",require("./rules_block/fence"),["paragraph","reference","blockquote","list"]],["blockquote",require("./rules_block/blockquote"),["paragraph","reference","blockquote","list"]],["hr",require("./rules_block/hr"),["paragraph","reference","blockquote","list"]],["list",require("./rules_block/list"),["paragraph","reference","blockquote"]],["reference",require("./rules_block/reference")],["heading",require("./rules_block/heading"),["paragraph","reference","blockquote"]],["lheading",require("./rules_block/lheading")],["html_block",require("./rules_block/html_block"),["paragraph","reference","blockquote"]],["paragraph",require("./rules_block/paragraph")]];ParserBlock.prototype.tokenize=function(state,startLine,endLine){for(var i,rules=this.ruler.getRules(""),len=rules.length,line=startLine,hasEmptyLines=!1,maxNesting=state.md.options.maxNesting;line<endLine&&(state.line=line=state.skipEmptyLines(line),!(line>=endLine))&&!(state.sCount[line]<state.blkIndent);){if(state.level>=maxNesting){state.line=endLine;break}for(i=0;i<len&&!rules[i](state,line,endLine,!1);i++);state.tight=!hasEmptyLines,state.isEmpty(state.line-1)&&(hasEmptyLines=!0),(line=state.line)<endLine&&state.isEmpty(line)&&(hasEmptyLines=!0,line++,state.line=line)}},ParserBlock.prototype.parse=function(src,md,env,outTokens){var state;src&&(state=new this.State(src,md,env,outTokens),this.tokenize(state,state.line,state.lineMax))},ParserBlock.prototype.State=require("./rules_block/state_block"),module.exports=ParserBlock},{"./ruler":108,"./rules_block/blockquote":109,"./rules_block/code":110,"./rules_block/fence":111,"./rules_block/heading":112,"./rules_block/hr":113,"./rules_block/html_block":114,"./rules_block/lheading":115,"./rules_block/list":116,"./rules_block/paragraph":117,"./rules_block/reference":118,"./rules_block/state_block":119,"./rules_block/table":120}],102:[function(require,module,exports){"use strict";function Core(){this.ruler=new Ruler;for(var i=0;i<_rules.length;i++)this.ruler.push(_rules[i][0],_rules[i][1])}var Ruler=require("./ruler"),_rules=[["normalize",require("./rules_core/normalize")],["block",require("./rules_core/block")],["inline",require("./rules_core/inline")],["linkify",require("./rules_core/linkify")],["replacements",require("./rules_core/replacements")],["smartquotes",require("./rules_core/smartquotes")]];Core.prototype.process=function(state){var i,l,rules;for(i=0,l=(rules=this.ruler.getRules("")).length;i<l;i++)rules[i](state)},Core.prototype.State=require("./rules_core/state_core"),module.exports=Core},{"./ruler":108,"./rules_core/block":121,"./rules_core/inline":122,"./rules_core/linkify":123,"./rules_core/normalize":124,"./rules_core/replacements":125,"./rules_core/smartquotes":126,"./rules_core/state_core":127}],103:[function(require,module,exports){"use strict";function ParserInline(){var i;for(this.ruler=new Ruler,i=0;i<_rules.length;i++)this.ruler.push(_rules[i][0],_rules[i][1]);for(this.ruler2=new Ruler,i=0;i<_rules2.length;i++)this.ruler2.push(_rules2[i][0],_rules2[i][1])}var Ruler=require("./ruler"),_rules=[["text",require("./rules_inline/text")],["newline",require("./rules_inline/newline")],["escape",require("./rules_inline/escape")],["backticks",require("./rules_inline/backticks")],["strikethrough",require("./rules_inline/strikethrough").tokenize],["emphasis",require("./rules_inline/emphasis").tokenize],["link",require("./rules_inline/link")],["image",require("./rules_inline/image")],["autolink",require("./rules_inline/autolink")],["html_inline",require("./rules_inline/html_inline")],["entity",require("./rules_inline/entity")]],_rules2=[["balance_pairs",require("./rules_inline/balance_pairs")],["strikethrough",require("./rules_inline/strikethrough").postProcess],["emphasis",require("./rules_inline/emphasis").postProcess],["text_collapse",require("./rules_inline/text_collapse")]];ParserInline.prototype.skipToken=function(state){var ok,i,pos=state.pos,rules=this.ruler.getRules(""),len=rules.length,maxNesting=state.md.options.maxNesting,cache=state.cache;if(void 0===cache[pos]){if(state.level<maxNesting)for(i=0;i<len&&(state.level++,ok=rules[i](state,!0),state.level--,!ok);i++);else state.pos=state.posMax;ok||state.pos++,cache[pos]=state.pos}else state.pos=cache[pos]},ParserInline.prototype.tokenize=function(state){for(var ok,i,rules=this.ruler.getRules(""),len=rules.length,end=state.posMax,maxNesting=state.md.options.maxNesting;state.pos<end;){if(state.level<maxNesting)for(i=0;i<len&&!(ok=rules[i](state,!1));i++);if(ok){if(state.pos>=end)break}else state.pending+=state.src[state.pos++]}state.pending&&state.pushPending()},ParserInline.prototype.parse=function(str,md,env,outTokens){var i,rules,len,state=new this.State(str,md,env,outTokens);for(this.tokenize(state),len=(rules=this.ruler2.getRules("")).length,i=0;i<len;i++)rules[i](state)},ParserInline.prototype.State=require("./rules_inline/state_inline"),module.exports=ParserInline},{"./ruler":108,"./rules_inline/autolink":128,"./rules_inline/backticks":129,"./rules_inline/balance_pairs":130,"./rules_inline/emphasis":131,"./rules_inline/entity":132,"./rules_inline/escape":133,"./rules_inline/html_inline":134,"./rules_inline/image":135,"./rules_inline/link":136,"./rules_inline/newline":137,"./rules_inline/state_inline":138,"./rules_inline/strikethrough":139,"./rules_inline/text":140,"./rules_inline/text_collapse":141}],104:[function(require,module,exports){"use strict";module.exports={options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline"]},block:{rules:["blockquote","code","fence","heading","hr","html_block","lheading","list","reference","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","html_inline","image","link","newline","text"],rules2:["balance_pairs","emphasis","text_collapse"]}}}},{}],105:[function(require,module,exports){"use strict";module.exports={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}}},{}],106:[function(require,module,exports){"use strict";module.exports={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","text_collapse"]}}}},{}],107:[function(require,module,exports){"use strict";function Renderer(){this.rules=assign({},default_rules)}var assign=require("./common/utils").assign,unescapeAll=require("./common/utils").unescapeAll,escapeHtml=require("./common/utils").escapeHtml,default_rules={};default_rules.code_inline=function(tokens,idx,options,env,slf){var token=tokens[idx];return"<code"+slf.renderAttrs(token)+">"+escapeHtml(tokens[idx].content)+"</code>"},default_rules.code_block=function(tokens,idx,options,env,slf){var token=tokens[idx];return"<pre"+slf.renderAttrs(token)+"><code>"+escapeHtml(tokens[idx].content)+"</code></pre>\n"},default_rules.fence=function(tokens,idx,options,env,slf){var highlighted,i,tmpAttrs,tmpToken,token=tokens[idx],info=token.info?unescapeAll(token.info).trim():"",langName="";return info&&(langName=info.split(/\s+/g)[0]),0===(highlighted=options.highlight?options.highlight(token.content,langName)||escapeHtml(token.content):escapeHtml(token.content)).indexOf("<pre")?highlighted+"\n":info?(i=token.attrIndex("class"),tmpAttrs=token.attrs?token.attrs.slice():[],i<0?tmpAttrs.push(["class",options.langPrefix+langName]):tmpAttrs[i][1]+=" "+options.langPrefix+langName,tmpToken={attrs:tmpAttrs},"<pre><code"+slf.renderAttrs(tmpToken)+">"+highlighted+"</code></pre>\n"):"<pre><code"+slf.renderAttrs(token)+">"+highlighted+"</code></pre>\n"},default_rules.image=function(tokens,idx,options,env,slf){var token=tokens[idx];return token.attrs[token.attrIndex("alt")][1]=slf.renderInlineAsText(token.children,options,env),slf.renderToken(tokens,idx,options)},default_rules.hardbreak=function(tokens,idx,options){return options.xhtmlOut?"<br />\n":"<br>\n"},default_rules.softbreak=function(tokens,idx,options){return options.breaks?options.xhtmlOut?"<br />\n":"<br>\n":"\n"},default_rules.text=function(tokens,idx){return escapeHtml(tokens[idx].content)},default_rules.html_block=function(tokens,idx){return tokens[idx].content},default_rules.html_inline=function(tokens,idx){return tokens[idx].content},Renderer.prototype.renderAttrs=function(token){var i,l,result;if(!token.attrs)return"";for(result="",i=0,l=token.attrs.length;i<l;i++)result+=" "+escapeHtml(token.attrs[i][0])+'="'+escapeHtml(token.attrs[i][1])+'"';return result},Renderer.prototype.renderToken=function(tokens,idx,options){var nextToken,result="",needLf=!1,token=tokens[idx];return token.hidden?"":(token.block&&-1!==token.nesting&&idx&&tokens[idx-1].hidden&&(result+="\n"),result+=(-1===token.nesting?"</":"<")+token.tag,result+=this.renderAttrs(token),0===token.nesting&&options.xhtmlOut&&(result+=" /"),token.block&&(needLf=!0,1===token.nesting&&idx+1<tokens.length&&("inline"===(nextToken=tokens[idx+1]).type||nextToken.hidden?needLf=!1:-1===nextToken.nesting&&nextToken.tag===token.tag&&(needLf=!1))),result+=needLf?">\n":">")},Renderer.prototype.renderInline=function(tokens,options,env){for(var type,result="",rules=this.rules,i=0,len=tokens.length;i<len;i++)void 0!==rules[type=tokens[i].type]?result+=rules[type](tokens,i,options,env,this):result+=this.renderToken(tokens,i,options);return result},Renderer.prototype.renderInlineAsText=function(tokens,options,env){for(var result="",i=0,len=tokens.length;i<len;i++)"text"===tokens[i].type?result+=tokens[i].content:"image"===tokens[i].type&&(result+=this.renderInlineAsText(tokens[i].children,options,env));return result},Renderer.prototype.render=function(tokens,options,env){var i,len,type,result="",rules=this.rules;for(i=0,len=tokens.length;i<len;i++)"inline"===(type=tokens[i].type)?result+=this.renderInline(tokens[i].children,options,env):void 0!==rules[type]?result+=rules[tokens[i].type](tokens,i,options,env,this):result+=this.renderToken(tokens,i,options,env);return result},module.exports=Renderer},{"./common/utils":95}],108:[function(require,module,exports){"use strict";function Ruler(){this.__rules__=[],this.__cache__=null}Ruler.prototype.__find__=function(name){for(var i=0;i<this.__rules__.length;i++)if(this.__rules__[i].name===name)return i;return-1},Ruler.prototype.__compile__=function(){var self=this,chains=[""];self.__rules__.forEach(function(rule){rule.enabled&&rule.alt.forEach(function(altName){chains.indexOf(altName)<0&&chains.push(altName)})}),self.__cache__={},chains.forEach(function(chain){self.__cache__[chain]=[],self.__rules__.forEach(function(rule){rule.enabled&&(chain&&rule.alt.indexOf(chain)<0||self.__cache__[chain].push(rule.fn))})})},Ruler.prototype.at=function(name,fn,options){var index=this.__find__(name),opt=options||{};if(-1===index)throw new Error("Parser rule not found: "+name);this.__rules__[index].fn=fn,this.__rules__[index].alt=opt.alt||[],this.__cache__=null},Ruler.prototype.before=function(beforeName,ruleName,fn,options){var index=this.__find__(beforeName),opt=options||{};if(-1===index)throw new Error("Parser rule not found: "+beforeName);this.__rules__.splice(index,0,{name:ruleName,enabled:!0,fn:fn,alt:opt.alt||[]}),this.__cache__=null},Ruler.prototype.after=function(afterName,ruleName,fn,options){var index=this.__find__(afterName),opt=options||{};if(-1===index)throw new Error("Parser rule not found: "+afterName);this.__rules__.splice(index+1,0,{name:ruleName,enabled:!0,fn:fn,alt:opt.alt||[]}),this.__cache__=null},Ruler.prototype.push=function(ruleName,fn,options){var opt=options||{};this.__rules__.push({name:ruleName,enabled:!0,fn:fn,alt:opt.alt||[]}),this.__cache__=null},Ruler.prototype.enable=function(list,ignoreInvalid){Array.isArray(list)||(list=[list]);var result=[];return list.forEach(function(name){var idx=this.__find__(name);if(idx<0){if(ignoreInvalid)return;throw new Error("Rules manager: invalid rule name "+name)}this.__rules__[idx].enabled=!0,result.push(name)},this),this.__cache__=null,result},Ruler.prototype.enableOnly=function(list,ignoreInvalid){Array.isArray(list)||(list=[list]),this.__rules__.forEach(function(rule){rule.enabled=!1}),this.enable(list,ignoreInvalid)},Ruler.prototype.disable=function(list,ignoreInvalid){Array.isArray(list)||(list=[list]);var result=[];return list.forEach(function(name){var idx=this.__find__(name);if(idx<0){if(ignoreInvalid)return;throw new Error("Rules manager: invalid rule name "+name)}this.__rules__[idx].enabled=!1,result.push(name)},this),this.__cache__=null,result},Ruler.prototype.getRules=function(chainName){return null===this.__cache__&&this.__compile__(),this.__cache__[chainName]||[]},module.exports=Ruler},{}],109:[function(require,module,exports){"use strict";var isSpace=require("../common/utils").isSpace;module.exports=function(state,startLine,endLine,silent){var adjustTab,ch,i,initial,l,lastLineEmpty,lines,nextLine,offset,oldBMarks,oldBSCount,oldIndent,oldParentType,oldSCount,oldTShift,spaceAfterMarker,terminate,terminatorRules,token,wasOutdented,oldLineMax=state.lineMax,pos=state.bMarks[startLine]+state.tShift[startLine],max=state.eMarks[startLine];if(state.sCount[startLine]-state.blkIndent>=4)return!1;if(62!==state.src.charCodeAt(pos++))return!1;if(silent)return!0;for(initial=offset=state.sCount[startLine]+pos-(state.bMarks[startLine]+state.tShift[startLine]),32===state.src.charCodeAt(pos)?(pos++,initial++,offset++,adjustTab=!1,spaceAfterMarker=!0):9===state.src.charCodeAt(pos)?(spaceAfterMarker=!0,(state.bsCount[startLine]+offset)%4==3?(pos++,initial++,offset++,adjustTab=!1):adjustTab=!0):spaceAfterMarker=!1,oldBMarks=[state.bMarks[startLine]],state.bMarks[startLine]=pos;pos<max&&(ch=state.src.charCodeAt(pos),isSpace(ch));)9===ch?offset+=4-(offset+state.bsCount[startLine]+(adjustTab?1:0))%4:offset++,pos++;for(oldBSCount=[state.bsCount[startLine]],state.bsCount[startLine]=state.sCount[startLine]+1+(spaceAfterMarker?1:0),lastLineEmpty=pos>=max,oldSCount=[state.sCount[startLine]],state.sCount[startLine]=offset-initial,oldTShift=[state.tShift[startLine]],state.tShift[startLine]=pos-state.bMarks[startLine],terminatorRules=state.md.block.ruler.getRules("blockquote"),oldParentType=state.parentType,state.parentType="blockquote",wasOutdented=!1,nextLine=startLine+1;nextLine<endLine&&(state.sCount[nextLine]<state.blkIndent&&(wasOutdented=!0),pos=state.bMarks[nextLine]+state.tShift[nextLine],max=state.eMarks[nextLine],!(pos>=max));nextLine++)if(62!==state.src.charCodeAt(pos++)||wasOutdented){if(lastLineEmpty)break;for(terminate=!1,i=0,l=terminatorRules.length;i<l;i++)if(terminatorRules[i](state,nextLine,endLine,!0)){terminate=!0;break}if(terminate){state.lineMax=nextLine,0!==state.blkIndent&&(oldBMarks.push(state.bMarks[nextLine]),oldBSCount.push(state.bsCount[nextLine]),oldTShift.push(state.tShift[nextLine]),oldSCount.push(state.sCount[nextLine]),state.sCount[nextLine]-=state.blkIndent);break}oldBMarks.push(state.bMarks[nextLine]),oldBSCount.push(state.bsCount[nextLine]),oldTShift.push(state.tShift[nextLine]),oldSCount.push(state.sCount[nextLine]),state.sCount[nextLine]=-1}else{for(initial=offset=state.sCount[nextLine]+pos-(state.bMarks[nextLine]+state.tShift[nextLine]),32===state.src.charCodeAt(pos)?(pos++,initial++,offset++,adjustTab=!1,spaceAfterMarker=!0):9===state.src.charCodeAt(pos)?(spaceAfterMarker=!0,(state.bsCount[nextLine]+offset)%4==3?(pos++,initial++,offset++,adjustTab=!1):adjustTab=!0):spaceAfterMarker=!1,oldBMarks.push(state.bMarks[nextLine]),state.bMarks[nextLine]=pos;pos<max&&(ch=state.src.charCodeAt(pos),isSpace(ch));)9===ch?offset+=4-(offset+state.bsCount[nextLine]+(adjustTab?1:0))%4:offset++,pos++;lastLineEmpty=pos>=max,oldBSCount.push(state.bsCount[nextLine]),state.bsCount[nextLine]=state.sCount[nextLine]+1+(spaceAfterMarker?1:0),oldSCount.push(state.sCount[nextLine]),state.sCount[nextLine]=offset-initial,oldTShift.push(state.tShift[nextLine]),state.tShift[nextLine]=pos-state.bMarks[nextLine]}for(oldIndent=state.blkIndent,state.blkIndent=0,(token=state.push("blockquote_open","blockquote",1)).markup=">",token.map=lines=[startLine,0],state.md.block.tokenize(state,startLine,nextLine),(token=state.push("blockquote_close","blockquote",-1)).markup=">",state.lineMax=oldLineMax,state.parentType=oldParentType,lines[1]=state.line,i=0;i<oldTShift.length;i++)state.bMarks[i+startLine]=oldBMarks[i],state.tShift[i+startLine]=oldTShift[i],state.sCount[i+startLine]=oldSCount[i],state.bsCount[i+startLine]=oldBSCount[i];return state.blkIndent=oldIndent,!0}},{"../common/utils":95}],110:[function(require,module,exports){"use strict";module.exports=function(state,startLine,endLine){var nextLine,last,token;if(state.sCount[startLine]-state.blkIndent<4)return!1;for(last=nextLine=startLine+1;nextLine<endLine;)if(state.isEmpty(nextLine))nextLine++;else{if(!(state.sCount[nextLine]-state.blkIndent>=4))break;last=++nextLine}return state.line=last,token=state.push("code_block","code",0),token.content=state.getLines(startLine,last,4+state.blkIndent,!0),token.map=[startLine,state.line],!0}},{}],111:[function(require,module,exports){"use strict";module.exports=function(state,startLine,endLine,silent){var marker,len,params,nextLine,mem,token,markup,haveEndMarker=!1,pos=state.bMarks[startLine]+state.tShift[startLine],max=state.eMarks[startLine];if(state.sCount[startLine]-state.blkIndent>=4)return!1;if(pos+3>max)return!1;if(126!==(marker=state.src.charCodeAt(pos))&&96!==marker)return!1;if(mem=pos,pos=state.skipChars(pos,marker),(len=pos-mem)<3)return!1;if(markup=state.src.slice(mem,pos),(params=state.src.slice(pos,max)).indexOf(String.fromCharCode(marker))>=0)return!1;if(silent)return!0;for(nextLine=startLine;!(++nextLine>=endLine)&&(pos=mem=state.bMarks[nextLine]+state.tShift[nextLine],max=state.eMarks[nextLine],!(pos<max&&state.sCount[nextLine]<state.blkIndent));)if(state.src.charCodeAt(pos)===marker&&!(state.sCount[nextLine]-state.blkIndent>=4||(pos=state.skipChars(pos,marker))-mem<len||(pos=state.skipSpaces(pos))<max)){haveEndMarker=!0;break}return len=state.sCount[startLine],state.line=nextLine+(haveEndMarker?1:0),token=state.push("fence","code",0),token.info=params,token.content=state.getLines(startLine+1,nextLine,len,!0),token.markup=markup,token.map=[startLine,state.line],!0}},{}],112:[function(require,module,exports){"use strict";var isSpace=require("../common/utils").isSpace;module.exports=function(state,startLine,endLine,silent){var ch,level,tmp,token,pos=state.bMarks[startLine]+state.tShift[startLine],max=state.eMarks[startLine];if(state.sCount[startLine]-state.blkIndent>=4)return!1;if(35!==(ch=state.src.charCodeAt(pos))||pos>=max)return!1;for(level=1,ch=state.src.charCodeAt(++pos);35===ch&&pos<max&&level<=6;)level++,ch=state.src.charCodeAt(++pos);return!(level>6||pos<max&&!isSpace(ch))&&(!!silent||(max=state.skipSpacesBack(max,pos),(tmp=state.skipCharsBack(max,35,pos))>pos&&isSpace(state.src.charCodeAt(tmp-1))&&(max=tmp),state.line=startLine+1,token=state.push("heading_open","h"+String(level),1),token.markup="########".slice(0,level),token.map=[startLine,state.line],token=state.push("inline","",0),token.content=state.src.slice(pos,max).trim(),token.map=[startLine,state.line],token.children=[],token=state.push("heading_close","h"+String(level),-1),token.markup="########".slice(0,level),!0))}},{"../common/utils":95}],113:[function(require,module,exports){"use strict";var isSpace=require("../common/utils").isSpace;module.exports=function(state,startLine,endLine,silent){var marker,cnt,ch,token,pos=state.bMarks[startLine]+state.tShift[startLine],max=state.eMarks[startLine];if(state.sCount[startLine]-state.blkIndent>=4)return!1;if(42!==(marker=state.src.charCodeAt(pos++))&&45!==marker&&95!==marker)return!1;for(cnt=1;pos<max;){if((ch=state.src.charCodeAt(pos++))!==marker&&!isSpace(ch))return!1;ch===marker&&cnt++}return!(cnt<3)&&(!!silent||(state.line=startLine+1,token=state.push("hr","hr",0),token.map=[startLine,state.line],token.markup=Array(cnt+1).join(String.fromCharCode(marker)),!0))}},{"../common/utils":95}],114:[function(require,module,exports){"use strict";var block_names=require("../common/html_blocks"),HTML_OPEN_CLOSE_TAG_RE=require("../common/html_re").HTML_OPEN_CLOSE_TAG_RE,HTML_SEQUENCES=[[/^<(script|pre|style)(?=(\s|>|$))/i,/<\/(script|pre|style)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[new RegExp("^</?("+block_names.join("|")+")(?=(\\s|/?>|$))","i"),/^$/,!0],[new RegExp(HTML_OPEN_CLOSE_TAG_RE.source+"\\s*$"),/^$/,!1]];module.exports=function(state,startLine,endLine,silent){var i,nextLine,token,lineText,pos=state.bMarks[startLine]+state.tShift[startLine],max=state.eMarks[startLine];if(state.sCount[startLine]-state.blkIndent>=4)return!1;if(!state.md.options.html)return!1;if(60!==state.src.charCodeAt(pos))return!1;for(lineText=state.src.slice(pos,max),i=0;i<HTML_SEQUENCES.length&&!HTML_SEQUENCES[i][0].test(lineText);i++);if(i===HTML_SEQUENCES.length)return!1;if(silent)return HTML_SEQUENCES[i][2];if(nextLine=startLine+1,!HTML_SEQUENCES[i][1].test(lineText))for(;nextLine<endLine&&!(state.sCount[nextLine]<state.blkIndent);nextLine++)if(pos=state.bMarks[nextLine]+state.tShift[nextLine],max=state.eMarks[nextLine],lineText=state.src.slice(pos,max),HTML_SEQUENCES[i][1].test(lineText)){0!==lineText.length&&nextLine++;break}return state.line=nextLine,token=state.push("html_block","",0),token.map=[startLine,nextLine],token.content=state.getLines(startLine,nextLine,state.blkIndent,!0),!0}},{"../common/html_blocks":93,"../common/html_re":94}],115:[function(require,module,exports){"use strict";module.exports=function(state,startLine,endLine){var content,terminate,i,l,token,pos,max,level,marker,oldParentType,nextLine=startLine+1,terminatorRules=state.md.block.ruler.getRules("paragraph");if(state.sCount[startLine]-state.blkIndent>=4)return!1;for(oldParentType=state.parentType,state.parentType="paragraph";nextLine<endLine&&!state.isEmpty(nextLine);nextLine++)if(!(state.sCount[nextLine]-state.blkIndent>3)){if(state.sCount[nextLine]>=state.blkIndent&&(pos=state.bMarks[nextLine]+state.tShift[nextLine],max=state.eMarks[nextLine],pos<max&&(45===(marker=state.src.charCodeAt(pos))||61===marker)&&(pos=state.skipChars(pos,marker),(pos=state.skipSpaces(pos))>=max))){level=61===marker?1:2;break}if(!(state.sCount[nextLine]<0)){for(terminate=!1,i=0,l=terminatorRules.length;i<l;i++)if(terminatorRules[i](state,nextLine,endLine,!0)){terminate=!0;break}if(terminate)break}}return!!level&&(content=state.getLines(startLine,nextLine,state.blkIndent,!1).trim(),state.line=nextLine+1,token=state.push("heading_open","h"+String(level),1),token.markup=String.fromCharCode(marker),token.map=[startLine,state.line],token=state.push("inline","",0),token.content=content,token.map=[startLine,state.line-1],token.children=[],token=state.push("heading_close","h"+String(level),-1),token.markup=String.fromCharCode(marker),state.parentType=oldParentType,!0)}},{}],116:[function(require,module,exports){"use strict";function skipBulletListMarker(state,startLine){var marker,pos,max,ch;return pos=state.bMarks[startLine]+state.tShift[startLine],max=state.eMarks[startLine],42!==(marker=state.src.charCodeAt(pos++))&&45!==marker&&43!==marker?-1:pos<max&&(ch=state.src.charCodeAt(pos),!isSpace(ch))?-1:pos}function skipOrderedListMarker(state,startLine){var ch,start=state.bMarks[startLine]+state.tShift[startLine],pos=start,max=state.eMarks[startLine];if(pos+1>=max)return-1;if((ch=state.src.charCodeAt(pos++))<48||ch>57)return-1;for(;;){if(pos>=max)return-1;if(!((ch=state.src.charCodeAt(pos++))>=48&&ch<=57)){if(41===ch||46===ch)break;return-1}if(pos-start>=10)return-1}return pos<max&&(ch=state.src.charCodeAt(pos),!isSpace(ch))?-1:pos}function markTightParagraphs(state,idx){var i,l,level=state.level+2;for(i=idx+2,l=state.tokens.length-2;i<l;i++)state.tokens[i].level===level&&"paragraph_open"===state.tokens[i].type&&(state.tokens[i+2].hidden=!0,state.tokens[i].hidden=!0,i+=2)}var isSpace=require("../common/utils").isSpace;module.exports=function(state,startLine,endLine,silent){var ch,contentStart,i,indent,indentAfterMarker,initial,isOrdered,itemLines,l,listLines,listTokIdx,markerCharCode,markerValue,max,nextLine,offset,oldIndent,oldLIndent,oldParentType,oldTShift,oldTight,pos,posAfterMarker,prevEmptyEnd,start,terminate,terminatorRules,token,isTerminatingParagraph=!1,tight=!0;if(state.sCount[startLine]-state.blkIndent>=4)return!1;if(silent&&"paragraph"===state.parentType&&state.tShift[startLine]>=state.blkIndent&&(isTerminatingParagraph=!0),(posAfterMarker=skipOrderedListMarker(state,startLine))>=0){if(isOrdered=!0,start=state.bMarks[startLine]+state.tShift[startLine],markerValue=Number(state.src.substr(start,posAfterMarker-start-1)),isTerminatingParagraph&&1!==markerValue)return!1}else{if(!((posAfterMarker=skipBulletListMarker(state,startLine))>=0))return!1;isOrdered=!1}if(isTerminatingParagraph&&state.skipSpaces(posAfterMarker)>=state.eMarks[startLine])return!1;if(markerCharCode=state.src.charCodeAt(posAfterMarker-1),silent)return!0;for(listTokIdx=state.tokens.length,isOrdered?(token=state.push("ordered_list_open","ol",1),1!==markerValue&&(token.attrs=[["start",markerValue]])):token=state.push("bullet_list_open","ul",1),token.map=listLines=[startLine,0],token.markup=String.fromCharCode(markerCharCode),nextLine=startLine,prevEmptyEnd=!1,terminatorRules=state.md.block.ruler.getRules("list"),oldParentType=state.parentType,state.parentType="list";nextLine<endLine;){for(pos=posAfterMarker,max=state.eMarks[nextLine],initial=offset=state.sCount[nextLine]+posAfterMarker-(state.bMarks[startLine]+state.tShift[startLine]);pos<max;){if(9===(ch=state.src.charCodeAt(pos)))offset+=4-(offset+state.bsCount[nextLine])%4;else{if(32!==ch)break;offset++}pos++}if(contentStart=pos,(indentAfterMarker=contentStart>=max?1:offset-initial)>4&&(indentAfterMarker=1),indent=initial+indentAfterMarker,token=state.push("list_item_open","li",1),token.markup=String.fromCharCode(markerCharCode),token.map=itemLines=[startLine,0],oldIndent=state.blkIndent,oldTight=state.tight,oldTShift=state.tShift[startLine],oldLIndent=state.sCount[startLine],state.blkIndent=indent,state.tight=!0,state.tShift[startLine]=contentStart-state.bMarks[startLine],state.sCount[startLine]=offset,contentStart>=max&&state.isEmpty(startLine+1)?state.line=Math.min(state.line+2,endLine):state.md.block.tokenize(state,startLine,endLine,!0),state.tight&&!prevEmptyEnd||(tight=!1),prevEmptyEnd=state.line-startLine>1&&state.isEmpty(state.line-1),state.blkIndent=oldIndent,state.tShift[startLine]=oldTShift,state.sCount[startLine]=oldLIndent,state.tight=oldTight,token=state.push("list_item_close","li",-1),token.markup=String.fromCharCode(markerCharCode),nextLine=startLine=state.line,itemLines[1]=nextLine,contentStart=state.bMarks[startLine],nextLine>=endLine)break;if(state.sCount[nextLine]<state.blkIndent)break;for(terminate=!1,i=0,l=terminatorRules.length;i<l;i++)if(terminatorRules[i](state,nextLine,endLine,!0)){terminate=!0;break}if(terminate)break;if(isOrdered){if((posAfterMarker=skipOrderedListMarker(state,nextLine))<0)break}else if((posAfterMarker=skipBulletListMarker(state,nextLine))<0)break;if(markerCharCode!==state.src.charCodeAt(posAfterMarker-1))break}return token=isOrdered?state.push("ordered_list_close","ol",-1):state.push("bullet_list_close","ul",-1),token.markup=String.fromCharCode(markerCharCode),listLines[1]=nextLine,state.line=nextLine,state.parentType=oldParentType,tight&&markTightParagraphs(state,listTokIdx),!0}},{"../common/utils":95}],117:[function(require,module,exports){"use strict";module.exports=function(state,startLine){var content,terminate,i,l,token,oldParentType,nextLine=startLine+1,terminatorRules=state.md.block.ruler.getRules("paragraph"),endLine=state.lineMax;for(oldParentType=state.parentType,state.parentType="paragraph";nextLine<endLine&&!state.isEmpty(nextLine);nextLine++)if(!(state.sCount[nextLine]-state.blkIndent>3||state.sCount[nextLine]<0)){for(terminate=!1,i=0,l=terminatorRules.length;i<l;i++)if(terminatorRules[i](state,nextLine,endLine,!0)){terminate=!0;break}if(terminate)break}return content=state.getLines(startLine,nextLine,state.blkIndent,!1).trim(),state.line=nextLine,token=state.push("paragraph_open","p",1),token.map=[startLine,state.line],token=state.push("inline","",0),token.content=content,token.map=[startLine,state.line],token.children=[],token=state.push("paragraph_close","p",-1),state.parentType=oldParentType,!0}},{}],118:[function(require,module,exports){"use strict";var normalizeReference=require("../common/utils").normalizeReference,isSpace=require("../common/utils").isSpace;module.exports=function(state,startLine,_endLine,silent){var ch,destEndPos,destEndLineNo,endLine,href,i,l,label,labelEnd,oldParentType,res,start,str,terminate,terminatorRules,title,lines=0,pos=state.bMarks[startLine]+state.tShift[startLine],max=state.eMarks[startLine],nextLine=startLine+1;if(state.sCount[startLine]-state.blkIndent>=4)return!1;if(91!==state.src.charCodeAt(pos))return!1;for(;++pos<max;)if(93===state.src.charCodeAt(pos)&&92!==state.src.charCodeAt(pos-1)){if(pos+1===max)return!1;if(58!==state.src.charCodeAt(pos+1))return!1;break}for(endLine=state.lineMax,terminatorRules=state.md.block.ruler.getRules("reference"),oldParentType=state.parentType,state.parentType="reference";nextLine<endLine&&!state.isEmpty(nextLine);nextLine++)if(!(state.sCount[nextLine]-state.blkIndent>3||state.sCount[nextLine]<0)){for(terminate=!1,i=0,l=terminatorRules.length;i<l;i++)if(terminatorRules[i](state,nextLine,endLine,!0)){terminate=!0;break}if(terminate)break}for(max=(str=state.getLines(startLine,nextLine,state.blkIndent,!1).trim()).length,pos=1;pos<max;pos++){if(91===(ch=str.charCodeAt(pos)))return!1;if(93===ch){labelEnd=pos;break}10===ch?lines++:92===ch&&++pos<max&&10===str.charCodeAt(pos)&&lines++}if(labelEnd<0||58!==str.charCodeAt(labelEnd+1))return!1;for(pos=labelEnd+2;pos<max;pos++)if(10===(ch=str.charCodeAt(pos)))lines++;else if(!isSpace(ch))break;if(!(res=state.md.helpers.parseLinkDestination(str,pos,max)).ok)return!1;if(href=state.md.normalizeLink(res.str),!state.md.validateLink(href))return!1;for(destEndPos=pos=res.pos,destEndLineNo=lines+=res.lines,start=pos;pos<max;pos++)if(10===(ch=str.charCodeAt(pos)))lines++;else if(!isSpace(ch))break;for(res=state.md.helpers.parseLinkTitle(str,pos,max),pos<max&&start!==pos&&res.ok?(title=res.str,pos=res.pos,lines+=res.lines):(title="",pos=destEndPos,lines=destEndLineNo);pos<max&&(ch=str.charCodeAt(pos),isSpace(ch));)pos++;if(pos<max&&10!==str.charCodeAt(pos)&&title)for(title="",pos=destEndPos,lines=destEndLineNo;pos<max&&(ch=str.charCodeAt(pos),isSpace(ch));)pos++;return!(pos<max&&10!==str.charCodeAt(pos))&&(!!(label=normalizeReference(str.slice(1,labelEnd)))&&(!!silent||(void 0===state.env.references&&(state.env.references={}),void 0===state.env.references[label]&&(state.env.references[label]={title:title,href:href}),state.parentType=oldParentType,state.line=startLine+lines+1,!0)))}},{"../common/utils":95}],119:[function(require,module,exports){"use strict";function StateBlock(src,md,env,tokens){var ch,s,start,pos,len,indent,offset,indent_found;for(this.src=src,this.md=md,this.env=env,this.tokens=tokens,this.bMarks=[],this.eMarks=[],this.tShift=[],this.sCount=[],this.bsCount=[],this.blkIndent=0,this.line=0,this.lineMax=0,this.tight=!1,this.ddIndent=-1,this.parentType="root",this.level=0,this.result="",indent_found=!1,start=pos=indent=offset=0,len=(s=this.src).length;pos<len;pos++){if(ch=s.charCodeAt(pos),!indent_found){if(isSpace(ch)){indent++,9===ch?offset+=4-offset%4:offset++;continue}indent_found=!0}10!==ch&&pos!==len-1||(10!==ch&&pos++,this.bMarks.push(start),this.eMarks.push(pos),this.tShift.push(indent),this.sCount.push(offset),this.bsCount.push(0),indent_found=!1,indent=0,offset=0,start=pos+1)}this.bMarks.push(s.length),this.eMarks.push(s.length),this.tShift.push(0),this.sCount.push(0),this.bsCount.push(0),this.lineMax=this.bMarks.length-1}var Token=require("../token"),isSpace=require("../common/utils").isSpace;StateBlock.prototype.push=function(type,tag,nesting){var token=new Token(type,tag,nesting);return token.block=!0,nesting<0&&this.level--,token.level=this.level,nesting>0&&this.level++,this.tokens.push(token),token},StateBlock.prototype.isEmpty=function(line){return this.bMarks[line]+this.tShift[line]>=this.eMarks[line]},StateBlock.prototype.skipEmptyLines=function(from){for(var max=this.lineMax;from<max&&!(this.bMarks[from]+this.tShift[from]<this.eMarks[from]);from++);return from},StateBlock.prototype.skipSpaces=function(pos){for(var ch,max=this.src.length;pos<max&&(ch=this.src.charCodeAt(pos),isSpace(ch));pos++);return pos},StateBlock.prototype.skipSpacesBack=function(pos,min){if(pos<=min)return pos;for(;pos>min;)if(!isSpace(this.src.charCodeAt(--pos)))return pos+1;return pos},StateBlock.prototype.skipChars=function(pos,code){for(var max=this.src.length;pos<max&&this.src.charCodeAt(pos)===code;pos++);return pos},StateBlock.prototype.skipCharsBack=function(pos,code,min){if(pos<=min)return pos;for(;pos>min;)if(code!==this.src.charCodeAt(--pos))return pos+1;return pos},StateBlock.prototype.getLines=function(begin,end,indent,keepLastLF){var i,lineIndent,ch,first,last,queue,lineStart,line=begin;if(begin>=end)return"";for(queue=new Array(end-begin),i=0;line<end;line++,i++){for(lineIndent=0,lineStart=first=this.bMarks[line],last=line+1<end||keepLastLF?this.eMarks[line]+1:this.eMarks[line];first<last&&lineIndent<indent;){if(ch=this.src.charCodeAt(first),isSpace(ch))9===ch?lineIndent+=4-(lineIndent+this.bsCount[line])%4:lineIndent++;else{if(!(first-lineStart<this.tShift[line]))break;lineIndent++}first++}queue[i]=lineIndent>indent?new Array(lineIndent-indent+1).join(" ")+this.src.slice(first,last):this.src.slice(first,last)}return queue.join("")},StateBlock.prototype.Token=Token,module.exports=StateBlock},{"../common/utils":95,"../token":142}],120:[function(require,module,exports){"use strict";function getLine(state,line){var pos=state.bMarks[line]+state.blkIndent,max=state.eMarks[line];return state.src.substr(pos,max-pos)}function escapedSplit(str){var ch,result=[],pos=0,max=str.length,escapes=0,lastPos=0,backTicked=!1,lastBackTick=0;for(ch=str.charCodeAt(pos);pos<max;)96===ch?backTicked?(backTicked=!1,lastBackTick=pos):escapes%2==0&&(backTicked=!0,lastBackTick=pos):124!==ch||escapes%2!=0||backTicked||(result.push(str.substring(lastPos,pos)),lastPos=pos+1),92===ch?escapes++:escapes=0,++pos===max&&backTicked&&(backTicked=!1,pos=lastBackTick+1),ch=str.charCodeAt(pos);return result.push(str.substring(lastPos)),result}var isSpace=require("../common/utils").isSpace;module.exports=function(state,startLine,endLine,silent){var ch,lineText,pos,i,nextLine,columns,columnCount,token,aligns,t,tableLines,tbodyLines;if(startLine+2>endLine)return!1;if(nextLine=startLine+1,state.sCount[nextLine]<state.blkIndent)return!1;if(state.sCount[nextLine]-state.blkIndent>=4)return!1;if((pos=state.bMarks[nextLine]+state.tShift[nextLine])>=state.eMarks[nextLine])return!1;if(124!==(ch=state.src.charCodeAt(pos++))&&45!==ch&&58!==ch)return!1;for(;pos<state.eMarks[nextLine];){if(124!==(ch=state.src.charCodeAt(pos))&&45!==ch&&58!==ch&&!isSpace(ch))return!1;pos++}for(columns=(lineText=getLine(state,startLine+1)).split("|"),aligns=[],i=0;i<columns.length;i++){if(!(t=columns[i].trim())){if(0===i||i===columns.length-1)continue;return!1}if(!/^:?-+:?$/.test(t))return!1;58===t.charCodeAt(t.length-1)?aligns.push(58===t.charCodeAt(0)?"center":"right"):58===t.charCodeAt(0)?aligns.push("left"):aligns.push("")}if(-1===(lineText=getLine(state,startLine).trim()).indexOf("|"))return!1;if(state.sCount[startLine]-state.blkIndent>=4)return!1;if(columns=escapedSplit(lineText.replace(/^\||\|$/g,"")),(columnCount=columns.length)>aligns.length)return!1;if(silent)return!0;for((token=state.push("table_open","table",1)).map=tableLines=[startLine,0],(token=state.push("thead_open","thead",1)).map=[startLine,startLine+1],(token=state.push("tr_open","tr",1)).map=[startLine,startLine+1],i=0;i<columns.length;i++)(token=state.push("th_open","th",1)).map=[startLine,startLine+1],aligns[i]&&(token.attrs=[["style","text-align:"+aligns[i]]]),(token=state.push("inline","",0)).content=columns[i].trim(),token.map=[startLine,startLine+1],token.children=[],token=state.push("th_close","th",-1);for(token=state.push("tr_close","tr",-1),token=state.push("thead_close","thead",-1),(token=state.push("tbody_open","tbody",1)).map=tbodyLines=[startLine+2,0],nextLine=startLine+2;nextLine<endLine&&!(state.sCount[nextLine]<state.blkIndent)&&-1!==(lineText=getLine(state,nextLine).trim()).indexOf("|")&&!(state.sCount[nextLine]-state.blkIndent>=4);nextLine++){for(columns=escapedSplit(lineText.replace(/^\||\|$/g,"")),token=state.push("tr_open","tr",1),i=0;i<columnCount;i++)token=state.push("td_open","td",1),aligns[i]&&(token.attrs=[["style","text-align:"+aligns[i]]]),(token=state.push("inline","",0)).content=columns[i]?columns[i].trim():"",token.children=[],token=state.push("td_close","td",-1);token=state.push("tr_close","tr",-1)}return token=state.push("tbody_close","tbody",-1),token=state.push("table_close","table",-1),tableLines[1]=tbodyLines[1]=nextLine,state.line=nextLine,!0}},{"../common/utils":95}],121:[function(require,module,exports){"use strict";module.exports=function(state){var token;state.inlineMode?((token=new state.Token("inline","",0)).content=state.src,token.map=[0,1],token.children=[],state.tokens.push(token)):state.md.block.parse(state.src,state.md,state.env,state.tokens)}},{}],122:[function(require,module,exports){"use strict";module.exports=function(state){var tok,i,l,tokens=state.tokens;for(i=0,l=tokens.length;i<l;i++)"inline"===(tok=tokens[i]).type&&state.md.inline.parse(tok.content,state.md,state.env,tok.children)}},{}],123:[function(require,module,exports){"use strict";function isLinkOpen(str){return/^<a[>\s]/i.test(str)}function isLinkClose(str){return/^<\/a\s*>/i.test(str)}var arrayReplaceAt=require("../common/utils").arrayReplaceAt;module.exports=function(state){var i,j,l,tokens,token,currentToken,nodes,ln,text,pos,lastPos,level,htmlLinkLevel,url,fullUrl,urlText,links,blockTokens=state.tokens;if(state.md.options.linkify)for(j=0,l=blockTokens.length;j<l;j++)if("inline"===blockTokens[j].type&&state.md.linkify.pretest(blockTokens[j].content))for(htmlLinkLevel=0,i=(tokens=blockTokens[j].children).length-1;i>=0;i--)if("link_close"!==(currentToken=tokens[i]).type){if("html_inline"===currentToken.type&&(isLinkOpen(currentToken.content)&&htmlLinkLevel>0&&htmlLinkLevel--,isLinkClose(currentToken.content)&&htmlLinkLevel++),!(htmlLinkLevel>0)&&"text"===currentToken.type&&state.md.linkify.test(currentToken.content)){for(text=currentToken.content,links=state.md.linkify.match(text),nodes=[],level=currentToken.level,lastPos=0,ln=0;ln<links.length;ln++)url=links[ln].url,fullUrl=state.md.normalizeLink(url),state.md.validateLink(fullUrl)&&(urlText=links[ln].text,urlText=links[ln].schema?"mailto:"!==links[ln].schema||/^mailto:/i.test(urlText)?state.md.normalizeLinkText(urlText):state.md.normalizeLinkText("mailto:"+urlText).replace(/^mailto:/,""):state.md.normalizeLinkText("http://"+urlText).replace(/^http:\/\//,""),(pos=links[ln].index)>lastPos&&((token=new state.Token("text","",0)).content=text.slice(lastPos,pos),token.level=level,nodes.push(token)),(token=new state.Token("link_open","a",1)).attrs=[["href",fullUrl]],token.level=level++,token.markup="linkify",token.info="auto",nodes.push(token),(token=new state.Token("text","",0)).content=urlText,token.level=level,nodes.push(token),(token=new state.Token("link_close","a",-1)).level=--level,token.markup="linkify",token.info="auto",nodes.push(token),lastPos=links[ln].lastIndex);lastPos<text.length&&((token=new state.Token("text","",0)).content=text.slice(lastPos),token.level=level,nodes.push(token)),blockTokens[j].children=tokens=arrayReplaceAt(tokens,i,nodes)}}else for(i--;tokens[i].level!==currentToken.level&&"link_open"!==tokens[i].type;)i--}},{"../common/utils":95}],124:[function(require,module,exports){"use strict";var NEWLINES_RE=/\r[\n\u0085]?|[\u2424\u2028\u0085]/g,NULL_RE=/\u0000/g;module.exports=function(state){var str;str=(str=state.src.replace(NEWLINES_RE,"\n")).replace(NULL_RE,"�"),state.src=str}},{}],125:[function(require,module,exports){"use strict";function replaceFn(match,name){return SCOPED_ABBR[name.toLowerCase()]}function replace_scoped(inlineTokens){var i,token,inside_autolink=0;for(i=inlineTokens.length-1;i>=0;i--)"text"!==(token=inlineTokens[i]).type||inside_autolink||(token.content=token.content.replace(SCOPED_ABBR_RE,replaceFn)),"link_open"===token.type&&"auto"===token.info&&inside_autolink--,"link_close"===token.type&&"auto"===token.info&&inside_autolink++}function replace_rare(inlineTokens){var i,token,inside_autolink=0;for(i=inlineTokens.length-1;i>=0;i--)"text"!==(token=inlineTokens[i]).type||inside_autolink||RARE_RE.test(token.content)&&(token.content=token.content.replace(/\+-/g,"±").replace(/\.{2,}/g,"…").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---([^-]|$)/gm,"$1—$2").replace(/(^|\s)--(\s|$)/gm,"$1–$2").replace(/(^|[^-\s])--([^-\s]|$)/gm,"$1–$2")),"link_open"===token.type&&"auto"===token.info&&inside_autolink--,"link_close"===token.type&&"auto"===token.info&&inside_autolink++}var RARE_RE=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,SCOPED_ABBR_TEST_RE=/\((c|tm|r|p)\)/i,SCOPED_ABBR_RE=/\((c|tm|r|p)\)/gi,SCOPED_ABBR={c:"©",r:"®",p:"§",tm:"™"};module.exports=function(state){var blkIdx;if(state.md.options.typographer)for(blkIdx=state.tokens.length-1;blkIdx>=0;blkIdx--)"inline"===state.tokens[blkIdx].type&&(SCOPED_ABBR_TEST_RE.test(state.tokens[blkIdx].content)&&replace_scoped(state.tokens[blkIdx].children),RARE_RE.test(state.tokens[blkIdx].content)&&replace_rare(state.tokens[blkIdx].children))}},{}],126:[function(require,module,exports){"use strict";function replaceAt(str,index,ch){return str.substr(0,index)+ch+str.substr(index+1)}function process_inlines(tokens,state){var i,token,text,t,pos,max,thisLevel,item,lastChar,nextChar,isLastPunctChar,isNextPunctChar,isLastWhiteSpace,isNextWhiteSpace,canOpen,canClose,j,isSingle,stack,openQuote,closeQuote;for(stack=[],i=0;i<tokens.length;i++){for(token=tokens[i],thisLevel=tokens[i].level,j=stack.length-1;j>=0&&!(stack[j].level<=thisLevel);j--);if(stack.length=j+1,"text"===token.type){pos=0,max=(text=token.content).length;OUTER:for(;pos<max&&(QUOTE_RE.lastIndex=pos,t=QUOTE_RE.exec(text));){if(canOpen=canClose=!0,pos=t.index+1,isSingle="'"===t[0],lastChar=32,t.index-1>=0)lastChar=text.charCodeAt(t.index-1);else for(j=i-1;j>=0;j--)if("text"===tokens[j].type){lastChar=tokens[j].content.charCodeAt(tokens[j].content.length-1);break}if(nextChar=32,pos<max)nextChar=text.charCodeAt(pos);else for(j=i+1;j<tokens.length;j++)if("text"===tokens[j].type){nextChar=tokens[j].content.charCodeAt(0);break}if(isLastPunctChar=isMdAsciiPunct(lastChar)||isPunctChar(String.fromCharCode(lastChar)),isNextPunctChar=isMdAsciiPunct(nextChar)||isPunctChar(String.fromCharCode(nextChar)),isLastWhiteSpace=isWhiteSpace(lastChar),(isNextWhiteSpace=isWhiteSpace(nextChar))?canOpen=!1:isNextPunctChar&&(isLastWhiteSpace||isLastPunctChar||(canOpen=!1)),isLastWhiteSpace?canClose=!1:isLastPunctChar&&(isNextWhiteSpace||isNextPunctChar||(canClose=!1)),34===nextChar&&'"'===t[0]&&lastChar>=48&&lastChar<=57&&(canClose=canOpen=!1),canOpen&&canClose&&(canOpen=!1,canClose=isNextPunctChar),canOpen||canClose){if(canClose)for(j=stack.length-1;j>=0&&(item=stack[j],!(stack[j].level<thisLevel));j--)if(item.single===isSingle&&stack[j].level===thisLevel){item=stack[j],isSingle?(openQuote=state.md.options.quotes[2],closeQuote=state.md.options.quotes[3]):(openQuote=state.md.options.quotes[0],closeQuote=state.md.options.quotes[1]),token.content=replaceAt(token.content,t.index,closeQuote),tokens[item.token].content=replaceAt(tokens[item.token].content,item.pos,openQuote),pos+=closeQuote.length-1,item.token===i&&(pos+=openQuote.length-1),max=(text=token.content).length,stack.length=j;continue OUTER}canOpen?stack.push({token:i,pos:t.index,single:isSingle,level:thisLevel}):canClose&&isSingle&&(token.content=replaceAt(token.content,t.index,APOSTROPHE))}else isSingle&&(token.content=replaceAt(token.content,t.index,APOSTROPHE))}}}}var isWhiteSpace=require("../common/utils").isWhiteSpace,isPunctChar=require("../common/utils").isPunctChar,isMdAsciiPunct=require("../common/utils").isMdAsciiPunct,QUOTE_TEST_RE=/['"]/,QUOTE_RE=/['"]/g,APOSTROPHE="’";module.exports=function(state){var blkIdx;if(state.md.options.typographer)for(blkIdx=state.tokens.length-1;blkIdx>=0;blkIdx--)"inline"===state.tokens[blkIdx].type&&QUOTE_TEST_RE.test(state.tokens[blkIdx].content)&&process_inlines(state.tokens[blkIdx].children,state)}},{"../common/utils":95}],127:[function(require,module,exports){"use strict";function StateCore(src,md,env){this.src=src,this.env=env,this.tokens=[],this.inlineMode=!1,this.md=md}var Token=require("../token");StateCore.prototype.Token=Token,module.exports=StateCore},{"../token":142}],128:[function(require,module,exports){"use strict";var EMAIL_RE=/^<([a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)>/,AUTOLINK_RE=/^<([a-zA-Z][a-zA-Z0-9+.\-]{1,31}):([^<>\x00-\x20]*)>/;module.exports=function(state,silent){var tail,linkMatch,emailMatch,url,fullUrl,token,pos=state.pos;return 60===state.src.charCodeAt(pos)&&!((tail=state.src.slice(pos)).indexOf(">")<0||(AUTOLINK_RE.test(tail)?(linkMatch=tail.match(AUTOLINK_RE),url=linkMatch[0].slice(1,-1),fullUrl=state.md.normalizeLink(url),!state.md.validateLink(fullUrl)||(silent||((token=state.push("link_open","a",1)).attrs=[["href",fullUrl]],token.markup="autolink",token.info="auto",(token=state.push("text","",0)).content=state.md.normalizeLinkText(url),(token=state.push("link_close","a",-1)).markup="autolink",token.info="auto"),state.pos+=linkMatch[0].length,0)):!EMAIL_RE.test(tail)||(emailMatch=tail.match(EMAIL_RE),url=emailMatch[0].slice(1,-1),fullUrl=state.md.normalizeLink("mailto:"+url),!state.md.validateLink(fullUrl)||(silent||((token=state.push("link_open","a",1)).attrs=[["href",fullUrl]],token.markup="autolink",token.info="auto",(token=state.push("text","",0)).content=state.md.normalizeLinkText(url),(token=state.push("link_close","a",-1)).markup="autolink",token.info="auto"),state.pos+=emailMatch[0].length,0))))}},{}],129:[function(require,module,exports){"use strict";module.exports=function(state,silent){var start,max,marker,matchStart,matchEnd,token,pos=state.pos;if(96!==state.src.charCodeAt(pos))return!1;for(start=pos,pos++,max=state.posMax;pos<max&&96===state.src.charCodeAt(pos);)pos++;for(marker=state.src.slice(start,pos),matchStart=matchEnd=pos;-1!==(matchStart=state.src.indexOf("`",matchEnd));){for(matchEnd=matchStart+1;matchEnd<max&&96===state.src.charCodeAt(matchEnd);)matchEnd++;if(matchEnd-matchStart===marker.length)return silent||((token=state.push("code_inline","code",0)).markup=marker,token.content=state.src.slice(pos,matchStart).replace(/[ \n]+/g," ").trim()),state.pos=matchEnd,!0}return silent||(state.pending+=marker),state.pos+=marker.length,!0}},{}],130:[function(require,module,exports){"use strict";module.exports=function(state){var i,j,lastDelim,currDelim,delimiters=state.delimiters,max=state.delimiters.length;for(i=0;i<max;i++)if((lastDelim=delimiters[i]).close)for(j=i-lastDelim.jump-1;j>=0;){if((currDelim=delimiters[j]).open&&currDelim.marker===lastDelim.marker&&currDelim.end<0&&currDelim.level===lastDelim.level&&!((currDelim.close||lastDelim.open)&&void 0!==currDelim.length&&void 0!==lastDelim.length&&(currDelim.length+lastDelim.length)%3==0)){lastDelim.jump=i-j,lastDelim.open=!1,currDelim.end=i,currDelim.jump=0;break}j-=currDelim.jump+1}}},{}],131:[function(require,module,exports){"use strict";module.exports.tokenize=function(state,silent){var i,scanned,start=state.pos,marker=state.src.charCodeAt(start);if(silent)return!1;if(95!==marker&&42!==marker)return!1;for(scanned=state.scanDelims(state.pos,42===marker),i=0;i<scanned.length;i++)state.push("text","",0).content=String.fromCharCode(marker),state.delimiters.push({marker:marker,length:scanned.length,jump:i,token:state.tokens.length-1,level:state.level,end:-1,open:scanned.can_open,close:scanned.can_close});return state.pos+=scanned.length,!0},module.exports.postProcess=function(state){var i,startDelim,endDelim,token,ch,isStrong,delimiters=state.delimiters;for(i=state.delimiters.length-1;i>=0;i--)95!==(startDelim=delimiters[i]).marker&&42!==startDelim.marker||-1!==startDelim.end&&(endDelim=delimiters[startDelim.end],isStrong=i>0&&delimiters[i-1].end===startDelim.end+1&&delimiters[i-1].token===startDelim.token-1&&delimiters[startDelim.end+1].token===endDelim.token+1&&delimiters[i-1].marker===startDelim.marker,ch=String.fromCharCode(startDelim.marker),(token=state.tokens[startDelim.token]).type=isStrong?"strong_open":"em_open",token.tag=isStrong?"strong":"em",token.nesting=1,token.markup=isStrong?ch+ch:ch,token.content="",(token=state.tokens[endDelim.token]).type=isStrong?"strong_close":"em_close",token.tag=isStrong?"strong":"em",token.nesting=-1,token.markup=isStrong?ch+ch:ch,token.content="",isStrong&&(state.tokens[delimiters[i-1].token].content="",state.tokens[delimiters[startDelim.end+1].token].content="",i--))}},{}],132:[function(require,module,exports){"use strict";var entities=require("../common/entities"),has=require("../common/utils").has,isValidEntityCode=require("../common/utils").isValidEntityCode,fromCodePoint=require("../common/utils").fromCodePoint,DIGITAL_RE=/^&#((?:x[a-f0-9]{1,8}|[0-9]{1,8}));/i,NAMED_RE=/^&([a-z][a-z0-9]{1,31});/i;module.exports=function(state,silent){var code,match,pos=state.pos,max=state.posMax;if(38!==state.src.charCodeAt(pos))return!1;if(pos+1<max)if(35===state.src.charCodeAt(pos+1)){if(match=state.src.slice(pos).match(DIGITAL_RE))return silent||(code="x"===match[1][0].toLowerCase()?parseInt(match[1].slice(1),16):parseInt(match[1],10),state.pending+=fromCodePoint(isValidEntityCode(code)?code:65533)),state.pos+=match[0].length,!0}else if((match=state.src.slice(pos).match(NAMED_RE))&&has(entities,match[1]))return silent||(state.pending+=entities[match[1]]),state.pos+=match[0].length,!0;return silent||(state.pending+="&"),state.pos++,!0}},{"../common/entities":92,"../common/utils":95}],133:[function(require,module,exports){"use strict";for(var isSpace=require("../common/utils").isSpace,ESCAPED=[],i=0;i<256;i++)ESCAPED.push(0);"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(ch){ESCAPED[ch.charCodeAt(0)]=1}),module.exports=function(state,silent){var ch,pos=state.pos,max=state.posMax;if(92!==state.src.charCodeAt(pos))return!1;if(++pos<max){if((ch=state.src.charCodeAt(pos))<256&&0!==ESCAPED[ch])return silent||(state.pending+=state.src[pos]),state.pos+=2,!0;if(10===ch){for(silent||state.push("hardbreak","br",0),pos++;pos<max&&(ch=state.src.charCodeAt(pos),isSpace(ch));)pos++;return state.pos=pos,!0}}return silent||(state.pending+="\\"),state.pos++,!0}},{"../common/utils":95}],134:[function(require,module,exports){"use strict";function isLetter(ch){var lc=32|ch;return lc>=97&&lc<=122}var HTML_TAG_RE=require("../common/html_re").HTML_TAG_RE;module.exports=function(state,silent){var ch,match,max,pos=state.pos;return!!state.md.options.html&&(max=state.posMax,!(60!==state.src.charCodeAt(pos)||pos+2>=max)&&(!(33!==(ch=state.src.charCodeAt(pos+1))&&63!==ch&&47!==ch&&!isLetter(ch))&&(!!(match=state.src.slice(pos).match(HTML_TAG_RE))&&(silent||(state.push("html_inline","",0).content=state.src.slice(pos,pos+match[0].length)),state.pos+=match[0].length,!0))))}},{"../common/html_re":94}],135:[function(require,module,exports){"use strict";var normalizeReference=require("../common/utils").normalizeReference,isSpace=require("../common/utils").isSpace;module.exports=function(state,silent){var attrs,code,content,label,labelEnd,labelStart,pos,ref,res,title,token,tokens,start,href="",oldPos=state.pos,max=state.posMax;if(33!==state.src.charCodeAt(state.pos))return!1;if(91!==state.src.charCodeAt(state.pos+1))return!1;if(labelStart=state.pos+2,(labelEnd=state.md.helpers.parseLinkLabel(state,state.pos+1,!1))<0)return!1;if((pos=labelEnd+1)<max&&40===state.src.charCodeAt(pos)){for(pos++;pos<max&&(code=state.src.charCodeAt(pos),isSpace(code)||10===code);pos++);if(pos>=max)return!1;for(start=pos,(res=state.md.helpers.parseLinkDestination(state.src,pos,state.posMax)).ok&&(href=state.md.normalizeLink(res.str),state.md.validateLink(href)?pos=res.pos:href=""),start=pos;pos<max&&(code=state.src.charCodeAt(pos),isSpace(code)||10===code);pos++);if(res=state.md.helpers.parseLinkTitle(state.src,pos,state.posMax),pos<max&&start!==pos&&res.ok)for(title=res.str,pos=res.pos;pos<max&&(code=state.src.charCodeAt(pos),isSpace(code)||10===code);pos++);else title="";if(pos>=max||41!==state.src.charCodeAt(pos))return state.pos=oldPos,!1;pos++}else{if(void 0===state.env.references)return!1;if(pos<max&&91===state.src.charCodeAt(pos)?(start=pos+1,(pos=state.md.helpers.parseLinkLabel(state,pos))>=0?label=state.src.slice(start,pos++):pos=labelEnd+1):pos=labelEnd+1,label||(label=state.src.slice(labelStart,labelEnd)),!(ref=state.env.references[normalizeReference(label)]))return state.pos=oldPos,!1;href=ref.href,title=ref.title}return silent||(content=state.src.slice(labelStart,labelEnd),state.md.inline.parse(content,state.md,state.env,tokens=[]),(token=state.push("image","img",0)).attrs=attrs=[["src",href],["alt",""]],token.children=tokens,token.content=content,title&&attrs.push(["title",title])),state.pos=pos,state.posMax=max,!0}},{"../common/utils":95}],136:[function(require,module,exports){"use strict";var normalizeReference=require("../common/utils").normalizeReference,isSpace=require("../common/utils").isSpace;module.exports=function(state,silent){var attrs,code,label,labelEnd,labelStart,pos,res,ref,title,href="",oldPos=state.pos,max=state.posMax,start=state.pos,parseReference=!0;if(91!==state.src.charCodeAt(state.pos))return!1;if(labelStart=state.pos+1,(labelEnd=state.md.helpers.parseLinkLabel(state,state.pos,!0))<0)return!1;if((pos=labelEnd+1)<max&&40===state.src.charCodeAt(pos)){for(parseReference=!1,pos++;pos<max&&(code=state.src.charCodeAt(pos),isSpace(code)||10===code);pos++);if(pos>=max)return!1;for(start=pos,(res=state.md.helpers.parseLinkDestination(state.src,pos,state.posMax)).ok&&(href=state.md.normalizeLink(res.str),state.md.validateLink(href)?pos=res.pos:href=""),start=pos;pos<max&&(code=state.src.charCodeAt(pos),isSpace(code)||10===code);pos++);if(res=state.md.helpers.parseLinkTitle(state.src,pos,state.posMax),pos<max&&start!==pos&&res.ok)for(title=res.str,pos=res.pos;pos<max&&(code=state.src.charCodeAt(pos),isSpace(code)||10===code);pos++);else title="";(pos>=max||41!==state.src.charCodeAt(pos))&&(parseReference=!0),pos++}if(parseReference){if(void 0===state.env.references)return!1;if(pos<max&&91===state.src.charCodeAt(pos)?(start=pos+1,(pos=state.md.helpers.parseLinkLabel(state,pos))>=0?label=state.src.slice(start,pos++):pos=labelEnd+1):pos=labelEnd+1,label||(label=state.src.slice(labelStart,labelEnd)),!(ref=state.env.references[normalizeReference(label)]))return state.pos=oldPos,!1;href=ref.href,title=ref.title}return silent||(state.pos=labelStart,state.posMax=labelEnd,state.push("link_open","a",1).attrs=attrs=[["href",href]],title&&attrs.push(["title",title]),state.md.inline.tokenize(state),state.push("link_close","a",-1)),state.pos=pos,state.posMax=max,!0}},{"../common/utils":95}],137:[function(require,module,exports){"use strict";var isSpace=require("../common/utils").isSpace;module.exports=function(state,silent){var pmax,max,pos=state.pos;if(10!==state.src.charCodeAt(pos))return!1;for(pmax=state.pending.length-1,max=state.posMax,silent||(pmax>=0&&32===state.pending.charCodeAt(pmax)?pmax>=1&&32===state.pending.charCodeAt(pmax-1)?(state.pending=state.pending.replace(/ +$/,""),state.push("hardbreak","br",0)):(state.pending=state.pending.slice(0,-1),state.push("softbreak","br",0)):state.push("softbreak","br",0)),pos++;pos<max&&isSpace(state.src.charCodeAt(pos));)pos++;return state.pos=pos,!0}},{"../common/utils":95}],138:[function(require,module,exports){"use strict";function StateInline(src,md,env,outTokens){this.src=src,this.env=env,this.md=md,this.tokens=outTokens,this.pos=0,this.posMax=this.src.length,this.level=0,this.pending="",this.pendingLevel=0,this.cache={},this.delimiters=[]}var Token=require("../token"),isWhiteSpace=require("../common/utils").isWhiteSpace,isPunctChar=require("../common/utils").isPunctChar,isMdAsciiPunct=require("../common/utils").isMdAsciiPunct;StateInline.prototype.pushPending=function(){var token=new Token("text","",0);return token.content=this.pending,token.level=this.pendingLevel,this.tokens.push(token),this.pending="",token},StateInline.prototype.push=function(type,tag,nesting){this.pending&&this.pushPending();var token=new Token(type,tag,nesting);return nesting<0&&this.level--,token.level=this.level,nesting>0&&this.level++,this.pendingLevel=this.level,this.tokens.push(token),token},StateInline.prototype.scanDelims=function(start,canSplitWord){var lastChar,nextChar,count,can_open,can_close,isLastWhiteSpace,isLastPunctChar,isNextWhiteSpace,isNextPunctChar,pos=start,left_flanking=!0,right_flanking=!0,max=this.posMax,marker=this.src.charCodeAt(start);for(lastChar=start>0?this.src.charCodeAt(start-1):32;pos<max&&this.src.charCodeAt(pos)===marker;)pos++;return count=pos-start,nextChar=pos<max?this.src.charCodeAt(pos):32,isLastPunctChar=isMdAsciiPunct(lastChar)||isPunctChar(String.fromCharCode(lastChar)),isNextPunctChar=isMdAsciiPunct(nextChar)||isPunctChar(String.fromCharCode(nextChar)),isLastWhiteSpace=isWhiteSpace(lastChar),(isNextWhiteSpace=isWhiteSpace(nextChar))?left_flanking=!1:isNextPunctChar&&(isLastWhiteSpace||isLastPunctChar||(left_flanking=!1)),isLastWhiteSpace?right_flanking=!1:isLastPunctChar&&(isNextWhiteSpace||isNextPunctChar||(right_flanking=!1)),canSplitWord?(can_open=left_flanking,can_close=right_flanking):(can_open=left_flanking&&(!right_flanking||isLastPunctChar),can_close=right_flanking&&(!left_flanking||isNextPunctChar)),{can_open:can_open,can_close:can_close,length:count}},StateInline.prototype.Token=Token,module.exports=StateInline},{"../common/utils":95,"../token":142}],139:[function(require,module,exports){"use strict";module.exports.tokenize=function(state,silent){var i,scanned,len,ch,start=state.pos,marker=state.src.charCodeAt(start);if(silent)return!1;if(126!==marker)return!1;if(scanned=state.scanDelims(state.pos,!0),len=scanned.length,ch=String.fromCharCode(marker),len<2)return!1;for(len%2&&(state.push("text","",0).content=ch,len--),i=0;i<len;i+=2)state.push("text","",0).content=ch+ch,state.delimiters.push({marker:marker,jump:i,token:state.tokens.length-1,level:state.level,end:-1,open:scanned.can_open,close:scanned.can_close});return state.pos+=scanned.length,!0},module.exports.postProcess=function(state){var i,j,startDelim,endDelim,token,loneMarkers=[],delimiters=state.delimiters,max=state.delimiters.length;for(i=0;i<max;i++)126===(startDelim=delimiters[i]).marker&&-1!==startDelim.end&&(endDelim=delimiters[startDelim.end],(token=state.tokens[startDelim.token]).type="s_open",token.tag="s",token.nesting=1,token.markup="~~",token.content="",(token=state.tokens[endDelim.token]).type="s_close",token.tag="s",token.nesting=-1,token.markup="~~",token.content="","text"===state.tokens[endDelim.token-1].type&&"~"===state.tokens[endDelim.token-1].content&&loneMarkers.push(endDelim.token-1));for(;loneMarkers.length;){for(j=(i=loneMarkers.pop())+1;j<state.tokens.length&&"s_close"===state.tokens[j].type;)j++;i!==--j&&(token=state.tokens[j],state.tokens[j]=state.tokens[i],state.tokens[i]=token)}}},{}],140:[function(require,module,exports){"use strict";function isTerminatorChar(ch){switch(ch){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!0;default:return!1}}module.exports=function(state,silent){for(var pos=state.pos;pos<state.posMax&&!isTerminatorChar(state.src.charCodeAt(pos));)pos++;return pos!==state.pos&&(silent||(state.pending+=state.src.slice(state.pos,pos)),state.pos=pos,!0)}},{}],141:[function(require,module,exports){"use strict";module.exports=function(state){var curr,last,level=0,tokens=state.tokens,max=state.tokens.length;for(curr=last=0;curr<max;curr++)level+=tokens[curr].nesting,tokens[curr].level=level,"text"===tokens[curr].type&&curr+1<max&&"text"===tokens[curr+1].type?tokens[curr+1].content=tokens[curr].content+tokens[curr+1].content:(curr!==last&&(tokens[last]=tokens[curr]),last++);curr!==last&&(tokens.length=last)}},{}],142:[function(require,module,exports){"use strict";function Token(type,tag,nesting){this.type=type,this.tag=tag,this.attrs=null,this.map=null,this.nesting=nesting,this.level=0,this.children=null,this.content="",this.markup="",this.info="",this.meta=null,this.block=!1,this.hidden=!1}Token.prototype.attrIndex=function(name){var attrs,i,len;if(!this.attrs)return-1;for(i=0,len=(attrs=this.attrs).length;i<len;i++)if(attrs[i][0]===name)return i;return-1},Token.prototype.attrPush=function(attrData){this.attrs?this.attrs.push(attrData):this.attrs=[attrData]},Token.prototype.attrSet=function(name,value){var idx=this.attrIndex(name),attrData=[name,value];idx<0?this.attrPush(attrData):this.attrs[idx]=attrData},Token.prototype.attrGet=function(name){var idx=this.attrIndex(name),value=null;return idx>=0&&(value=this.attrs[idx][1]),value},Token.prototype.attrJoin=function(name,value){var idx=this.attrIndex(name);idx<0?this.attrPush([name,value]):this.attrs[idx][1]=this.attrs[idx][1]+" "+value},module.exports=Token},{}],143:[function(require,module,exports){"use strict";function getDecodeCache(exclude){var i,ch,cache=decodeCache[exclude];if(cache)return cache;for(cache=decodeCache[exclude]=[],i=0;i<128;i++)ch=String.fromCharCode(i),cache.push(ch);for(i=0;i<exclude.length;i++)cache[ch=exclude.charCodeAt(i)]="%"+("0"+ch.toString(16).toUpperCase()).slice(-2);return cache}function decode(string,exclude){var cache;return"string"!=typeof exclude&&(exclude=decode.defaultChars),cache=getDecodeCache(exclude),string.replace(/(%[a-f0-9]{2})+/gi,function(seq){var i,l,b1,b2,b3,b4,chr,result="";for(i=0,l=seq.length;i<l;i+=3)(b1=parseInt(seq.slice(i+1,i+3),16))<128?result+=cache[b1]:192==(224&b1)&&i+3<l&&128==(192&(b2=parseInt(seq.slice(i+4,i+6),16)))?(result+=(chr=b1<<6&1984|63&b2)<128?"��":String.fromCharCode(chr),i+=3):224==(240&b1)&&i+6<l&&(b2=parseInt(seq.slice(i+4,i+6),16),b3=parseInt(seq.slice(i+7,i+9),16),128==(192&b2)&&128==(192&b3))?(result+=(chr=b1<<12&61440|b2<<6&4032|63&b3)<2048||chr>=55296&&chr<=57343?"���":String.fromCharCode(chr),i+=6):240==(248&b1)&&i+9<l&&(b2=parseInt(seq.slice(i+4,i+6),16),b3=parseInt(seq.slice(i+7,i+9),16),b4=parseInt(seq.slice(i+10,i+12),16),128==(192&b2)&&128==(192&b3)&&128==(192&b4))?((chr=b1<<18&1835008|b2<<12&258048|b3<<6&4032|63&b4)<65536||chr>1114111?result+="����":(chr-=65536,result+=String.fromCharCode(55296+(chr>>10),56320+(1023&chr))),i+=9):result+="�";return result})}var decodeCache={};decode.defaultChars=";/?:@&=+$,#",decode.componentChars="",module.exports=decode},{}],144:[function(require,module,exports){"use strict";function getEncodeCache(exclude){var i,ch,cache=encodeCache[exclude];if(cache)return cache;for(cache=encodeCache[exclude]=[],i=0;i<128;i++)ch=String.fromCharCode(i),/^[0-9a-z]$/i.test(ch)?cache.push(ch):cache.push("%"+("0"+i.toString(16).toUpperCase()).slice(-2));for(i=0;i<exclude.length;i++)cache[exclude.charCodeAt(i)]=exclude[i];return cache}function encode(string,exclude,keepEscaped){var i,l,code,nextCode,cache,result="";for("string"!=typeof exclude&&(keepEscaped=exclude,exclude=encode.defaultChars),void 0===keepEscaped&&(keepEscaped=!0),cache=getEncodeCache(exclude),i=0,l=string.length;i<l;i++)if(code=string.charCodeAt(i),keepEscaped&&37===code&&i+2<l&&/^[0-9a-f]{2}$/i.test(string.slice(i+1,i+3)))result+=string.slice(i,i+3),i+=2;else if(code<128)result+=cache[code];else if(code>=55296&&code<=57343){if(code>=55296&&code<=56319&&i+1<l&&(nextCode=string.charCodeAt(i+1))>=56320&&nextCode<=57343){result+=encodeURIComponent(string[i]+string[i+1]),i++;continue}result+="%EF%BF%BD"}else result+=encodeURIComponent(string[i]);return result}var encodeCache={};encode.defaultChars=";/?:@&=+$,-_.!~*'()#",encode.componentChars="-_.!~*'()",module.exports=encode},{}],145:[function(require,module,exports){"use strict";module.exports=function(url){var result="";return result+=url.protocol||"",result+=url.slashes?"//":"",result+=url.auth?url.auth+"@":"",url.hostname&&-1!==url.hostname.indexOf(":")?result+="["+url.hostname+"]":result+=url.hostname||"",result+=url.port?":"+url.port:"",result+=url.pathname||"",result+=url.search||"",result+=url.hash||""}},{}],146:[function(require,module,exports){"use strict";module.exports.encode=require("./encode"),module.exports.decode=require("./decode"),module.exports.format=require("./format"),module.exports.parse=require("./parse")},{"./decode":143,"./encode":144,"./format":145,"./parse":147}],147:[function(require,module,exports){"use strict";function Url(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}var protocolPattern=/^([a-z0-9.+-]+:)/i,portPattern=/:[0-9]*$/,simplePathPattern=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,delims=["<",">",'"',"`"," ","\r","\n","\t"],unwise=["{","}","|","\\","^","`"].concat(delims),autoEscape=["'"].concat(unwise),nonHostChars=["%","/","?",";","#"].concat(autoEscape),hostEndingChars=["/","?","#"],hostnamePartPattern=/^[+a-z0-9A-Z_-]{0,63}$/,hostnamePartStart=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,hostlessProtocol={javascript:!0,"javascript:":!0},slashedProtocol={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};Url.prototype.parse=function(url,slashesDenoteHost){var i,l,lowerProto,hec,slashes,rest=url;if(rest=rest.trim(),!slashesDenoteHost&&1===url.split("#").length){var simplePath=simplePathPattern.exec(rest);if(simplePath)return this.pathname=simplePath[1],simplePath[2]&&(this.search=simplePath[2]),this}var proto=protocolPattern.exec(rest);if(proto&&(lowerProto=(proto=proto[0]).toLowerCase(),this.protocol=proto,rest=rest.substr(proto.length)),(slashesDenoteHost||proto||rest.match(/^\/\/[^@\/]+@[^@\/]+/))&&(!(slashes="//"===rest.substr(0,2))||proto&&hostlessProtocol[proto]||(rest=rest.substr(2),this.slashes=!0)),!hostlessProtocol[proto]&&(slashes||proto&&!slashedProtocol[proto])){var hostEnd=-1;for(i=0;i<hostEndingChars.length;i++)-1!==(hec=rest.indexOf(hostEndingChars[i]))&&(-1===hostEnd||hec<hostEnd)&&(hostEnd=hec);var auth,atSign;for(-1!==(atSign=-1===hostEnd?rest.lastIndexOf("@"):rest.lastIndexOf("@",hostEnd))&&(auth=rest.slice(0,atSign),rest=rest.slice(atSign+1),this.auth=auth),hostEnd=-1,i=0;i<nonHostChars.length;i++)-1!==(hec=rest.indexOf(nonHostChars[i]))&&(-1===hostEnd||hec<hostEnd)&&(hostEnd=hec);-1===hostEnd&&(hostEnd=rest.length),":"===rest[hostEnd-1]&&hostEnd--;var host=rest.slice(0,hostEnd);rest=rest.slice(hostEnd),this.parseHost(host),this.hostname=this.hostname||"";var ipv6Hostname="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!ipv6Hostname){var hostparts=this.hostname.split(/\./);for(i=0,l=hostparts.length;i<l;i++){var part=hostparts[i];if(part&&!part.match(hostnamePartPattern)){for(var newpart="",j=0,k=part.length;j<k;j++)part.charCodeAt(j)>127?newpart+="x":newpart+=part[j];if(!newpart.match(hostnamePartPattern)){var validParts=hostparts.slice(0,i),notHost=hostparts.slice(i+1),bit=part.match(hostnamePartStart);bit&&(validParts.push(bit[1]),notHost.unshift(bit[2])),notHost.length&&(rest=notHost.join(".")+rest),this.hostname=validParts.join(".");break}}}}this.hostname.length>255&&(this.hostname=""),ipv6Hostname&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}var hash=rest.indexOf("#");-1!==hash&&(this.hash=rest.substr(hash),rest=rest.slice(0,hash));var qm=rest.indexOf("?");return-1!==qm&&(this.search=rest.substr(qm),rest=rest.slice(0,qm)),rest&&(this.pathname=rest),slashedProtocol[lowerProto]&&this.hostname&&!this.pathname&&(this.pathname=""),this},Url.prototype.parseHost=function(host){var port=portPattern.exec(host);port&&(":"!==(port=port[0])&&(this.port=port.substr(1)),host=host.substr(0,host.length-port.length)),host&&(this.hostname=host)},module.exports=function(url,slashesDenoteHost){if(url&&url instanceof Url)return url;var u=new Url;return u.parse(url,slashesDenoteHost),u}},{}],148:[function(require,module,exports){function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}function runTimeout(fun){if(cachedSetTimeout===setTimeout)return setTimeout(fun,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(fun,0);try{return cachedSetTimeout(fun,0)}catch(e){try{return cachedSetTimeout.call(null,fun,0)}catch(e){return cachedSetTimeout.call(this,fun,0)}}}function runClearTimeout(marker){if(cachedClearTimeout===clearTimeout)return clearTimeout(marker);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(marker);try{return cachedClearTimeout(marker)}catch(e){try{return cachedClearTimeout.call(null,marker)}catch(e){return cachedClearTimeout.call(this,marker)}}}function cleanUpNextTick(){draining&&currentQueue&&(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var timeout=runTimeout(cleanUpNextTick);draining=!0;for(var len=queue.length;len;){for(currentQueue=queue,queue=[];++queueIndex<len;)currentQueue&&currentQueue[queueIndex].run();queueIndex=-1,len=queue.length}currentQueue=null,draining=!1,runClearTimeout(timeout)}}function Item(fun,array){this.fun=fun,this.array=array}function noop(){}var cachedSetTimeout,cachedClearTimeout,process=module.exports={};!function(){try{cachedSetTimeout="function"==typeof setTimeout?setTimeout:defaultSetTimout}catch(e){cachedSetTimeout=defaultSetTimout}try{cachedClearTimeout="function"==typeof clearTimeout?clearTimeout:defaultClearTimeout}catch(e){cachedClearTimeout=defaultClearTimeout}}();var currentQueue,queue=[],draining=!1,queueIndex=-1;process.nextTick=function(fun){var args=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)args[i-1]=arguments[i];queue.push(new Item(fun,args)),1!==queue.length||draining||runTimeout(drainQueue)},Item.prototype.run=function(){this.fun.apply(null,this.array)},process.title="browser",process.browser=!0,process.env={},process.argv=[],process.version="",process.versions={},process.on=noop,process.addListener=noop,process.once=noop,process.off=noop,process.removeListener=noop,process.removeAllListeners=noop,process.emit=noop,process.prependListener=noop,process.prependOnceListener=noop,process.listeners=function(name){return[]},process.binding=function(name){throw new Error("process.binding is not supported")},process.cwd=function(){return"/"},process.chdir=function(dir){throw new Error("process.chdir is not supported")},process.umask=function(){return 0}},{}],149:[function(require,module,exports){(function(process){"use strict";if("production"!==process.env.NODE_ENV)var invariant=require("fbjs/lib/invariant"),warning=require("fbjs/lib/warning"),ReactPropTypesSecret=require("./lib/ReactPropTypesSecret"),loggedTypeFailures={};module.exports=function(typeSpecs,values,location,componentName,getStack){if("production"!==process.env.NODE_ENV)for(var typeSpecName in typeSpecs)if(typeSpecs.hasOwnProperty(typeSpecName)){var error;try{invariant("function"==typeof typeSpecs[typeSpecName],"%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.",componentName||"React class",location,typeSpecName),error=typeSpecs[typeSpecName](values,typeSpecName,componentName,location,null,ReactPropTypesSecret)}catch(ex){error=ex}if(warning(!error||error instanceof Error,"%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",componentName||"React class",location,typeSpecName,typeof error),error instanceof Error&&!(error.message in loggedTypeFailures)){loggedTypeFailures[error.message]=!0;var stack=getStack?getStack():"";warning(!1,"Failed %s type: %s%s",location,error.message,null!=stack?stack:"")}}}}).call(this,require("_process"))},{"./lib/ReactPropTypesSecret":153,_process:148,"fbjs/lib/invariant":87,"fbjs/lib/warning":88}],150:[function(require,module,exports){"use strict";var emptyFunction=require("fbjs/lib/emptyFunction"),invariant=require("fbjs/lib/invariant");module.exports=function(){function shim(){invariant(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function getShim(){return shim}shim.isRequired=shim;var ReactPropTypes={array:shim,bool:shim,func:shim,number:shim,object:shim,string:shim,symbol:shim,any:shim,arrayOf:getShim,element:shim,instanceOf:getShim,node:shim,objectOf:getShim,oneOf:getShim,oneOfType:getShim,shape:getShim};return ReactPropTypes.checkPropTypes=emptyFunction,ReactPropTypes.PropTypes=ReactPropTypes,ReactPropTypes}},{"fbjs/lib/emptyFunction":86,"fbjs/lib/invariant":87}],151:[function(require,module,exports){(function(process){"use strict";var emptyFunction=require("fbjs/lib/emptyFunction"),invariant=require("fbjs/lib/invariant"),warning=require("fbjs/lib/warning"),ReactPropTypesSecret=require("./lib/ReactPropTypesSecret"),checkPropTypes=require("./checkPropTypes");module.exports=function(isValidElement,throwOnDirectAccess){function getIteratorFn(maybeIterable){var iteratorFn=maybeIterable&&(ITERATOR_SYMBOL&&maybeIterable[ITERATOR_SYMBOL]||maybeIterable[FAUX_ITERATOR_SYMBOL]);if("function"==typeof iteratorFn)return iteratorFn}function is(x,y){return x===y?0!==x||1/x==1/y:x!==x&&y!==y}function PropTypeError(message){this.message=message,this.stack=""}function createChainableTypeChecker(validate){function checkType(isRequired,props,propName,componentName,location,propFullName,secret){if(componentName=componentName||ANONYMOUS,propFullName=propFullName||propName,secret!==ReactPropTypesSecret)if(throwOnDirectAccess)invariant(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");else if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var cacheKey=componentName+":"+propName;!manualPropTypeCallCache[cacheKey]&&manualPropTypeWarningCount<3&&(warning(!1,"You are manually calling a React.PropTypes validation function for the `%s` prop on `%s`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details.",propFullName,componentName),manualPropTypeCallCache[cacheKey]=!0,manualPropTypeWarningCount++)}return null==props[propName]?isRequired?new PropTypeError(null===props[propName]?"The "+location+" `"+propFullName+"` is marked as required in `"+componentName+"`, but its value is `null`.":"The "+location+" `"+propFullName+"` is marked as required in `"+componentName+"`, but its value is `undefined`."):null:validate(props,propName,componentName,location,propFullName)}if("production"!==process.env.NODE_ENV)var manualPropTypeCallCache={},manualPropTypeWarningCount=0;var chainedCheckType=checkType.bind(null,!1);return chainedCheckType.isRequired=checkType.bind(null,!0),chainedCheckType}function createPrimitiveTypeChecker(expectedType){return createChainableTypeChecker(function(props,propName,componentName,location,propFullName,secret){var propValue=props[propName];return getPropType(propValue)!==expectedType?new PropTypeError("Invalid "+location+" `"+propFullName+"` of type `"+getPreciseType(propValue)+"` supplied to `"+componentName+"`, expected `"+expectedType+"`."):null})}function isNode(propValue){switch(typeof propValue){case"number":case"string":case"undefined":return!0;case"boolean":return!propValue;case"object":if(Array.isArray(propValue))return propValue.every(isNode);if(null===propValue||isValidElement(propValue))return!0;var iteratorFn=getIteratorFn(propValue);if(!iteratorFn)return!1;var step,iterator=iteratorFn.call(propValue);if(iteratorFn!==propValue.entries){for(;!(step=iterator.next()).done;)if(!isNode(step.value))return!1}else for(;!(step=iterator.next()).done;){var entry=step.value;if(entry&&!isNode(entry[1]))return!1}return!0;default:return!1}}function isSymbol(propType,propValue){return"symbol"===propType||("Symbol"===propValue["@@toStringTag"]||"function"==typeof Symbol&&propValue instanceof Symbol)}function getPropType(propValue){var propType=typeof propValue;return Array.isArray(propValue)?"array":propValue instanceof RegExp?"object":isSymbol(propType,propValue)?"symbol":propType}function getPreciseType(propValue){var propType=getPropType(propValue);if("object"===propType){if(propValue instanceof Date)return"date";if(propValue instanceof RegExp)return"regexp"}return propType}function getClassName(propValue){return propValue.constructor&&propValue.constructor.name?propValue.constructor.name:ANONYMOUS}var ITERATOR_SYMBOL="function"==typeof Symbol&&Symbol.iterator,FAUX_ITERATOR_SYMBOL="@@iterator",ANONYMOUS="<<anonymous>>",ReactPropTypes={array:createPrimitiveTypeChecker("array"),bool:createPrimitiveTypeChecker("boolean"),func:createPrimitiveTypeChecker("function"),number:createPrimitiveTypeChecker("number"),object:createPrimitiveTypeChecker("object"),string:createPrimitiveTypeChecker("string"),symbol:createPrimitiveTypeChecker("symbol"),any:createChainableTypeChecker(emptyFunction.thatReturnsNull),arrayOf:function(typeChecker){return createChainableTypeChecker(function(props,propName,componentName,location,propFullName){if("function"!=typeof typeChecker)return new PropTypeError("Property `"+propFullName+"` of component `"+componentName+"` has invalid PropType notation inside arrayOf.");var propValue=props[propName];if(!Array.isArray(propValue))return new PropTypeError("Invalid "+location+" `"+propFullName+"` of type `"+getPropType(propValue)+"` supplied to `"+componentName+"`, expected an array.");for(var i=0;i<propValue.length;i++){var error=typeChecker(propValue,i,componentName,location,propFullName+"["+i+"]",ReactPropTypesSecret);if(error instanceof Error)return error}return null})},element:function(){return createChainableTypeChecker(function(props,propName,componentName,location,propFullName){var propValue=props[propName];return isValidElement(propValue)?null:new PropTypeError("Invalid "+location+" `"+propFullName+"` of type `"+getPropType(propValue)+"` supplied to `"+componentName+"`, expected a single ReactElement.")})}(),instanceOf:function(expectedClass){return createChainableTypeChecker(function(props,propName,componentName,location,propFullName){if(!(props[propName]instanceof expectedClass)){var expectedClassName=expectedClass.name||ANONYMOUS;return new PropTypeError("Invalid "+location+" `"+propFullName+"` of type `"+getClassName(props[propName])+"` supplied to `"+componentName+"`, expected instance of `"+expectedClassName+"`.")}return null})},node:function(){return createChainableTypeChecker(function(props,propName,componentName,location,propFullName){return isNode(props[propName])?null:new PropTypeError("Invalid "+location+" `"+propFullName+"` supplied to `"+componentName+"`, expected a ReactNode.")})}(),objectOf:function(typeChecker){return createChainableTypeChecker(function(props,propName,componentName,location,propFullName){if("function"!=typeof typeChecker)return new PropTypeError("Property `"+propFullName+"` of component `"+componentName+"` has invalid PropType notation inside objectOf.");var propValue=props[propName],propType=getPropType(propValue);if("object"!==propType)return new PropTypeError("Invalid "+location+" `"+propFullName+"` of type `"+propType+"` supplied to `"+componentName+"`, expected an object.");for(var key in propValue)if(propValue.hasOwnProperty(key)){var error=typeChecker(propValue,key,componentName,location,propFullName+"."+key,ReactPropTypesSecret);if(error instanceof Error)return error}return null})},oneOf:function(expectedValues){return Array.isArray(expectedValues)?createChainableTypeChecker(function(props,propName,componentName,location,propFullName){for(var propValue=props[propName],i=0;i<expectedValues.length;i++)if(is(propValue,expectedValues[i]))return null;return new PropTypeError("Invalid "+location+" `"+propFullName+"` of value `"+propValue+"` supplied to `"+componentName+"`, expected one of "+JSON.stringify(expectedValues)+".")}):("production"!==process.env.NODE_ENV&&warning(!1,"Invalid argument supplied to oneOf, expected an instance of array."),emptyFunction.thatReturnsNull)},oneOfType:function(arrayOfTypeCheckers){return Array.isArray(arrayOfTypeCheckers)?createChainableTypeChecker(function(props,propName,componentName,location,propFullName){for(var i=0;i<arrayOfTypeCheckers.length;i++)if(null==(0,arrayOfTypeCheckers[i])(props,propName,componentName,location,propFullName,ReactPropTypesSecret))return null;return new PropTypeError("Invalid "+location+" `"+propFullName+"` supplied to `"+componentName+"`.")}):("production"!==process.env.NODE_ENV&&warning(!1,"Invalid argument supplied to oneOfType, expected an instance of array."),emptyFunction.thatReturnsNull)},shape:function(shapeTypes){return createChainableTypeChecker(function(props,propName,componentName,location,propFullName){var propValue=props[propName],propType=getPropType(propValue);if("object"!==propType)return new PropTypeError("Invalid "+location+" `"+propFullName+"` of type `"+propType+"` supplied to `"+componentName+"`, expected `object`.");for(var key in shapeTypes){var checker=shapeTypes[key];if(checker){var error=checker(propValue,key,componentName,location,propFullName+"."+key,ReactPropTypesSecret);if(error)return error}}return null})}};return PropTypeError.prototype=Error.prototype,ReactPropTypes.checkPropTypes=checkPropTypes,ReactPropTypes.PropTypes=ReactPropTypes,ReactPropTypes}}).call(this,require("_process"))},{"./checkPropTypes":149,"./lib/ReactPropTypesSecret":153,_process:148,"fbjs/lib/emptyFunction":86,"fbjs/lib/invariant":87,"fbjs/lib/warning":88}],152:[function(require,module,exports){(function(process){if("production"!==process.env.NODE_ENV){var REACT_ELEMENT_TYPE="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103;module.exports=require("./factoryWithTypeCheckers")(function(object){return"object"==typeof object&&null!==object&&object.$$typeof===REACT_ELEMENT_TYPE},!0)}else module.exports=require("./factoryWithThrowingShims")()}).call(this,require("_process"))},{"./factoryWithThrowingShims":150,"./factoryWithTypeCheckers":151,_process:148}],153:[function(require,module,exports){"use strict";module.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},{}],154:[function(require,module,exports){(function(global){!function(root){function error(type){throw new RangeError(errors[type])}function map(array,fn){for(var length=array.length,result=[];length--;)result[length]=fn(array[length]);return result}function mapDomain(string,fn){var parts=string.split("@"),result="";return parts.length>1&&(result=parts[0]+"@",string=parts[1]),result+map((string=string.replace(regexSeparators,".")).split("."),fn).join(".")}function ucs2decode(string){for(var value,extra,output=[],counter=0,length=string.length;counter<length;)(value=string.charCodeAt(counter++))>=55296&&value<=56319&&counter<length?56320==(64512&(extra=string.charCodeAt(counter++)))?output.push(((1023&value)<<10)+(1023&extra)+65536):(output.push(value),counter--):output.push(value);return output}function ucs2encode(array){return map(array,function(value){var output="";return value>65535&&(output+=stringFromCharCode((value-=65536)>>>10&1023|55296),value=56320|1023&value),output+=stringFromCharCode(value)}).join("")}function basicToDigit(codePoint){return codePoint-48<10?codePoint-22:codePoint-65<26?codePoint-65:codePoint-97<26?codePoint-97:base}function digitToBasic(digit,flag){return digit+22+75*(digit<26)-((0!=flag)<<5)}function adapt(delta,numPoints,firstTime){var k=0;for(delta=firstTime?floor(delta/damp):delta>>1,delta+=floor(delta/numPoints);delta>baseMinusTMin*tMax>>1;k+=base)delta=floor(delta/baseMinusTMin);return floor(k+(baseMinusTMin+1)*delta/(delta+skew))}function decode(input){var out,basic,j,index,oldi,w,k,digit,t,baseMinusT,output=[],inputLength=input.length,i=0,n=initialN,bias=initialBias;for((basic=input.lastIndexOf(delimiter))<0&&(basic=0),j=0;j<basic;++j)input.charCodeAt(j)>=128&&error("not-basic"),output.push(input.charCodeAt(j));for(index=basic>0?basic+1:0;index<inputLength;){for(oldi=i,w=1,k=base;index>=inputLength&&error("invalid-input"),((digit=basicToDigit(input.charCodeAt(index++)))>=base||digit>floor((maxInt-i)/w))&&error("overflow"),i+=digit*w,t=k<=bias?tMin:k>=bias+tMax?tMax:k-bias,!(digit<t);k+=base)w>floor(maxInt/(baseMinusT=base-t))&&error("overflow"),w*=baseMinusT;bias=adapt(i-oldi,out=output.length+1,0==oldi),floor(i/out)>maxInt-n&&error("overflow"),n+=floor(i/out),i%=out,output.splice(i++,0,n)}return ucs2encode(output)}function encode(input){var n,delta,handledCPCount,basicLength,bias,j,m,q,k,t,currentValue,inputLength,handledCPCountPlusOne,baseMinusT,qMinusT,output=[];for(inputLength=(input=ucs2decode(input)).length,n=initialN,delta=0,bias=initialBias,j=0;j<inputLength;++j)(currentValue=input[j])<128&&output.push(stringFromCharCode(currentValue));for(handledCPCount=basicLength=output.length,basicLength&&output.push(delimiter);handledCPCount<inputLength;){for(m=maxInt,j=0;j<inputLength;++j)(currentValue=input[j])>=n&&currentValue<m&&(m=currentValue);for(m-n>floor((maxInt-delta)/(handledCPCountPlusOne=handledCPCount+1))&&error("overflow"),delta+=(m-n)*handledCPCountPlusOne,n=m,j=0;j<inputLength;++j)if((currentValue=input[j])<n&&++delta>maxInt&&error("overflow"),currentValue==n){for(q=delta,k=base;t=k<=bias?tMin:k>=bias+tMax?tMax:k-bias,!(q<t);k+=base)qMinusT=q-t,baseMinusT=base-t,output.push(stringFromCharCode(digitToBasic(t+qMinusT%baseMinusT,0))),q=floor(qMinusT/baseMinusT);output.push(stringFromCharCode(digitToBasic(q,0))),bias=adapt(delta,handledCPCountPlusOne,handledCPCount==basicLength),delta=0,++handledCPCount}++delta,++n}return output.join("")}var freeExports="object"==typeof exports&&exports&&!exports.nodeType&&exports,freeModule="object"==typeof module&&module&&!module.nodeType&&module,freeGlobal="object"==typeof global&&global;freeGlobal.global!==freeGlobal&&freeGlobal.window!==freeGlobal&&freeGlobal.self!==freeGlobal||(root=freeGlobal);var punycode,key,maxInt=2147483647,base=36,tMin=1,tMax=26,skew=38,damp=700,initialBias=72,initialN=128,delimiter="-",regexPunycode=/^xn--/,regexNonASCII=/[^\x20-\x7E]/,regexSeparators=/[\x2E\u3002\uFF0E\uFF61]/g,errors={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},baseMinusTMin=base-tMin,floor=Math.floor,stringFromCharCode=String.fromCharCode;if(punycode={version:"1.4.1",ucs2:{decode:ucs2decode,encode:ucs2encode},decode:decode,encode:encode,toASCII:function(input){return mapDomain(input,function(string){return regexNonASCII.test(string)?"xn--"+encode(string):string})},toUnicode:function(input){return mapDomain(input,function(string){return regexPunycode.test(string)?decode(string.slice(4).toLowerCase()):string})}},freeExports&&freeModule)if(module.exports==freeExports)freeModule.exports=punycode;else for(key in punycode)punycode.hasOwnProperty(key)&&(freeExports[key]=punycode[key]);else root.punycode=punycode}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],155:[function(require,module,exports){module.exports=/[\0-\x1F\x7F-\x9F]/},{}],156:[function(require,module,exports){module.exports=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804\uDCBD|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/},{}],157:[function(require,module,exports){module.exports=/[!-#%-\*,-/:;\?@\[-\]_\{\}\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-\u2E44\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[\uDC4B-\uDC4F\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDF3C-\uDF3E]|\uD807[\uDC41-\uDC45\uDC70\uDC71]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/},{}],158:[function(require,module,exports){module.exports=/[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/},{}],159:[function(require,module,exports){"use strict";exports.Any=require("./properties/Any/regex"),exports.Cc=require("./categories/Cc/regex"),exports.Cf=require("./categories/Cf/regex"),exports.P=require("./categories/P/regex"),exports.Z=require("./categories/Z/regex")},{"./categories/Cc/regex":155,"./categories/Cf/regex":156,"./categories/P/regex":157,"./categories/Z/regex":158,"./properties/Any/regex":160}],160:[function(require,module,exports){module.exports=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/},{}],161:[function(require,module,exports){"function"==typeof Object.create?module.exports=function(ctor,superCtor){ctor.super_=superCtor,ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:!1,writable:!0,configurable:!0}})}:module.exports=function(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype,ctor.prototype=new TempCtor,ctor.prototype.constructor=ctor}},{}],162:[function(require,module,exports){module.exports=function(arg){return arg&&"object"==typeof arg&&"function"==typeof arg.copy&&"function"==typeof arg.fill&&"function"==typeof arg.readUInt8}},{}],163:[function(require,module,exports){(function(process,global){function inspect(obj,opts){var ctx={seen:[],stylize:stylizeNoColor};return arguments.length>=3&&(ctx.depth=arguments[2]),arguments.length>=4&&(ctx.colors=arguments[3]),isBoolean(opts)?ctx.showHidden=opts:opts&&exports._extend(ctx,opts),isUndefined(ctx.showHidden)&&(ctx.showHidden=!1),isUndefined(ctx.depth)&&(ctx.depth=2),isUndefined(ctx.colors)&&(ctx.colors=!1),isUndefined(ctx.customInspect)&&(ctx.customInspect=!0),ctx.colors&&(ctx.stylize=stylizeWithColor),formatValue(ctx,obj,ctx.depth)}function stylizeWithColor(str,styleType){var style=inspect.styles[styleType];return style?"["+inspect.colors[style][0]+"m"+str+"["+inspect.colors[style][1]+"m":str}function stylizeNoColor(str,styleType){return str}function arrayToHash(array){var hash={};return array.forEach(function(val,idx){hash[val]=!0}),hash}function formatValue(ctx,value,recurseTimes){if(ctx.customInspect&&value&&isFunction(value.inspect)&&value.inspect!==exports.inspect&&(!value.constructor||value.constructor.prototype!==value)){var ret=value.inspect(recurseTimes,ctx);return isString(ret)||(ret=formatValue(ctx,ret,recurseTimes)),ret}var primitive=formatPrimitive(ctx,value);if(primitive)return primitive;var keys=Object.keys(value),visibleKeys=arrayToHash(keys);if(ctx.showHidden&&(keys=Object.getOwnPropertyNames(value)),isError(value)&&(keys.indexOf("message")>=0||keys.indexOf("description")>=0))return formatError(value);if(0===keys.length){if(isFunction(value)){var name=value.name?": "+value.name:"";return ctx.stylize("[Function"+name+"]","special")}if(isRegExp(value))return ctx.stylize(RegExp.prototype.toString.call(value),"regexp");if(isDate(value))return ctx.stylize(Date.prototype.toString.call(value),"date");if(isError(value))return formatError(value)}var base="",array=!1,braces=["{","}"];if(isArray(value)&&(array=!0,braces=["[","]"]),isFunction(value)&&(base=" [Function"+(value.name?": "+value.name:"")+"]"),isRegExp(value)&&(base=" "+RegExp.prototype.toString.call(value)),isDate(value)&&(base=" "+Date.prototype.toUTCString.call(value)),isError(value)&&(base=" "+formatError(value)),0===keys.length&&(!array||0==value.length))return braces[0]+base+braces[1];if(recurseTimes<0)return isRegExp(value)?ctx.stylize(RegExp.prototype.toString.call(value),"regexp"):ctx.stylize("[Object]","special");ctx.seen.push(value);var output;return output=array?formatArray(ctx,value,recurseTimes,visibleKeys,keys):keys.map(function(key){return formatProperty(ctx,value,recurseTimes,visibleKeys,key,array)}),ctx.seen.pop(),reduceToSingleString(output,base,braces)}function formatPrimitive(ctx,value){if(isUndefined(value))return ctx.stylize("undefined","undefined");if(isString(value)){var simple="'"+JSON.stringify(value).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return ctx.stylize(simple,"string")}return isNumber(value)?ctx.stylize(""+value,"number"):isBoolean(value)?ctx.stylize(""+value,"boolean"):isNull(value)?ctx.stylize("null","null"):void 0}function formatError(value){return"["+Error.prototype.toString.call(value)+"]"}function formatArray(ctx,value,recurseTimes,visibleKeys,keys){for(var output=[],i=0,l=value.length;i<l;++i)hasOwnProperty(value,String(i))?output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,String(i),!0)):output.push("");return keys.forEach(function(key){key.match(/^\d+$/)||output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,key,!0))}),output}function formatProperty(ctx,value,recurseTimes,visibleKeys,key,array){var name,str,desc;if((desc=Object.getOwnPropertyDescriptor(value,key)||{value:value[key]}).get?str=desc.set?ctx.stylize("[Getter/Setter]","special"):ctx.stylize("[Getter]","special"):desc.set&&(str=ctx.stylize("[Setter]","special")),hasOwnProperty(visibleKeys,key)||(name="["+key+"]"),str||(ctx.seen.indexOf(desc.value)<0?(str=isNull(recurseTimes)?formatValue(ctx,desc.value,null):formatValue(ctx,desc.value,recurseTimes-1)).indexOf("\n")>-1&&(str=array?str.split("\n").map(function(line){return" "+line}).join("\n").substr(2):"\n"+str.split("\n").map(function(line){return" "+line}).join("\n")):str=ctx.stylize("[Circular]","special")),isUndefined(name)){if(array&&key.match(/^\d+$/))return str;(name=JSON.stringify(""+key)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(name=name.substr(1,name.length-2),name=ctx.stylize(name,"name")):(name=name.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),name=ctx.stylize(name,"string"))}return name+": "+str}function reduceToSingleString(output,base,braces){var numLinesEst=0;return output.reduce(function(prev,cur){return numLinesEst++,cur.indexOf("\n")>=0&&numLinesEst++,prev+cur.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?braces[0]+(""===base?"":base+"\n ")+" "+output.join(",\n ")+" "+brac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment