(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-fb153a9a"],{"00ee":function(e,t,n){"use strict";var r=n("b622"),i=r("toStringTag"),o={};o[i]="z",e.exports="[object z]"===String(o)},"0366":function(e,t,n){"use strict";var r=n("4625"),i=n("59ed"),o=n("40d5"),l=r(r.bind);e.exports=function(e,t){return i(e),void 0===t?e:o?l(e,t):function(){return e.apply(t,arguments)}}},"0dd0":function(e,t,n){},"10b2":function(e,t,n){(function(e){e(n("56b3"))})((function(e){var t={pairs:"()[]{}''\"\"",closeBefore:")]}'\":;>",triples:"",explode:"[]{}"},n=e.Pos;function r(e,n){return"pairs"==n&&"string"==typeof e?e:"object"==typeof e&&null!=e[n]?e[n]:t[n]}e.defineOption("autoCloseBrackets",!1,(function(t,n,l){l&&l!=e.Init&&(t.removeKeyMap(i),t.state.closeBrackets=null),n&&(o(r(n,"pairs")),t.state.closeBrackets=n,t.addKeyMap(i))}));var i={Backspace:s,Enter:u};function o(e){for(var t=0;t=0;s--){var c=l[s].head;t.replaceRange("",n(c.line,c.ch-1),n(c.line,c.ch+1),"+delete")}}function u(t){var n=a(t),i=n&&r(n,"explode");if(!i||t.getOption("disableInput"))return e.Pass;for(var o=t.listSelections(),l=0;l0?{line:l.head.line,ch:l.head.ch+t}:{line:l.head.line-1};n.push({anchor:a,head:a})}e.setSelections(n,i)}function f(t){var r=e.cmpPos(t.anchor,t.head)>0;return{anchor:new n(t.anchor.line,t.anchor.ch+(r?-1:1)),head:new n(t.head.line,t.head.ch+(r?1:-1))}}function h(t,i){var o=a(t);if(!o||t.getOption("disableInput"))return e.Pass;var l=r(o,"pairs"),s=l.indexOf(i);if(-1==s)return e.Pass;for(var u,h=r(o,"closeBefore"),d=r(o,"triples"),g=l.charAt(s+1)==i,v=t.listSelections(),m=s%2==0,y=0;y1&&d.indexOf(i)>=0&&t.getRange(n(x.line,x.ch-2),x)==i+i){if(x.ch>2&&/\bstring/.test(t.getTokenTypeAt(n(x.line,x.ch-2))))return e.Pass;b="addFour"}else if(g){var S=0==x.ch?" ":t.getRange(n(x.line,x.ch-1),x);if(e.isWordChar(C)||S==i||e.isWordChar(S))return e.Pass;b="both"}else{if(!m||!(0===C.length||/\s/.test(C)||h.indexOf(C)>-1))return e.Pass;b="both"}else b=g&&p(t,x)?"both":d.indexOf(i)>=0&&t.getRange(x,n(x.line,x.ch+3))==i+i+i?"skipThree":"skip";if(u){if(u!=b)return e.Pass}else u=b}var k=s%2?l.charAt(s-1):i,L=s%2?i:l.charAt(s+1);t.operation((function(){if("skip"==u)c(t,1);else if("skipThree"==u)c(t,3);else if("surround"==u){for(var e=t.getSelections(),n=0;ny;y++)if(w=A(e[y]),w&&u(g,w))return w;return new p(!1)}v=c(e,m)}x=L?e.next:v.next;while(!(C=i(x,v)).done){try{w=A(C.value)}catch(D){h(v,"throw",D)}if("object"==typeof w&&w&&u(g,w))return w}return new p(!1)}},"35a1":function(e,t,n){"use strict";var r=n("f5df"),i=n("dc4a"),o=n("7234"),l=n("3f8c"),a=n("b622"),s=a("iterator");e.exports=function(e){if(!o(e))return i(e,s)||i(e,"@@iterator")||l[r(e)]}},"3f8c":function(e,t,n){"use strict";e.exports={}},4625:function(e,t,n){"use strict";var r=n("c6b6"),i=n("e330");e.exports=function(e){if("Function"===r(e))return i(e)}},4895:function(e,t,n){(function(e){e(n("56b3"))})((function(e){"use strict";function t(t,r,o,l){if(o&&o.call){var a=o;o=null}else a=i(t,o,"rangeFinder");"number"==typeof r&&(r=e.Pos(r,0));var s=i(t,o,"minFoldSize");function u(e){var n=a(t,r);if(!n||n.to.line-n.from.linet.firstLine())r=e.Pos(r.line-1,0),c=u(!1);if(c&&!c.cleared&&"unfold"!==l){var f=n(t,o,c);e.on(f,"mousedown",(function(t){h.clear(),e.e_preventDefault(t)}));var h=t.markText(c.from,c.to,{replacedWith:f,clearOnEnter:i(t,o,"clearOnEnter"),__isFold:!0});h.on("clear",(function(n,r){e.signal(t,"unfold",t,n,r)})),e.signal(t,"fold",t,c.from,c.to)}}function n(e,t,n){var r=i(e,t,"widget");if("function"==typeof r&&(r=r(n.from,n.to)),"string"==typeof r){var o=document.createTextNode(r);r=document.createElement("span"),r.appendChild(o),r.className="CodeMirror-foldmarker"}else r&&(r=r.cloneNode(!0));return r}e.newFoldFunction=function(e,n){return function(r,i){t(r,i,{rangeFinder:e,widget:n})}},e.defineExtension("foldCode",(function(e,n,r){t(this,e,n,r)})),e.defineExtension("isFolded",(function(e){for(var t=this.findMarksAt(e),n=0;n2),m=/Android/.test(e),y=v||m||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),b=v||/Mac/.test(t),w=/\bCrOS\b/.test(e),x=/win/i.test(t),C=h&&e.match(/Version\/(\d*\.\d*)/);C&&(C=Number(C[1])),C&&C>=15&&(h=!1,s=!0);var S=b&&(u||h&&(null==C||C<12.11)),k=n||l&&a>=9;function L(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var T,M=function(e,t){var n=e.className,r=L(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function O(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function N(e,t){return O(e).appendChild(t)}function A(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o=t)return l+(t-o);l+=a-o,l+=n-l%n,o=a+1}}v?P=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:l&&(P=function(e){try{e.select()}catch(t){}});var V=function(){this.id=null,this.f=null,this.time=0,this.handler=G(this.onTimeout,this)};function j(e,t){for(var n=0;n=t)return r+Math.min(l,t-i);if(i+=o-r,i+=n-i%n,r=o+1,i>=t)return r}}var J=[""];function Q(e){while(J.length<=e)J.push(ee(J)+" ");return J[e]}function ee(e){return e[e.length-1]}function te(e,t){for(var n=[],r=0;r"€"&&(e.toUpperCase()!=e.toLowerCase()||oe.test(e))}function ae(e,t){return t?!!(t.source.indexOf("\\w")>-1&&le(e))||t.test(e):le(e)}function se(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ue=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function ce(e){return e.charCodeAt(0)>=768&&ue.test(e)}function fe(e,t,n){while((n<0?t>0:tn?-1:1;;){if(t==n)return t;var i=(t+n)/2,o=r<0?Math.ceil(i):Math.floor(i);if(o==t)return e(o)?t:n;e(o)?n=o:t=o+r}}function de(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,o=0;ot||t==n&&l.to==t)&&(r(Math.max(l.from,t),Math.min(l.to,n),1==l.level?"rtl":"ltr",o),i=!0)}i||r(t,n,"ltr")}var pe=null;function ge(e,t,n){var r;pe=null;for(var i=0;it)return i;o.to==t&&(o.from!=o.to&&"before"==n?r=i:pe=i),o.from==t&&(o.from!=o.to&&"before"!=n?r=i:pe=i)}return null!=r?r:pe}var ve=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(n){return n<=247?e.charAt(n):1424<=n&&n<=1524?"R":1536<=n&&n<=1785?t.charAt(n-1536):1774<=n&&n<=2220?"r":8192<=n&&n<=8203?"w":8204==n?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,o=/[LRr]/,l=/[Lb1n]/,a=/[1n]/;function s(e,t,n){this.level=e,this.from=t,this.to=n}return function(e,t){var u="ltr"==t?"L":"R";if(0==e.length||"ltr"==t&&!r.test(e))return!1;for(var c=e.length,f=[],h=0;h-1&&(r[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function Ce(e,t){var n=we(e,t);if(n.length)for(var r=Array.prototype.slice.call(arguments,2),i=0;i0}function Te(e){e.prototype.on=function(e,t){be(this,e,t)},e.prototype.off=function(e,t){xe(this,e,t)}}function Me(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Oe(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Ne(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function Ae(e){Me(e),Oe(e)}function De(e){return e.target||e.srcElement}function We(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),b&&e.ctrlKey&&1==t&&(t=3),t}var Fe,Ee,He=function(){if(l&&a<9)return!1;var e=A("div");return"draggable"in e||"dragDrop"in e}();function Pe(e){if(null==Fe){var t=A("span","​");N(e,A("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(Fe=t.offsetWidth<=1&&t.offsetHeight>2&&!(l&&a<8))}var n=Fe?A("span","​"):A("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}function Re(e){if(null!=Ee)return Ee;var t=N(e,document.createTextNode("AخA")),n=T(t,0,1).getBoundingClientRect(),r=T(t,1,2).getBoundingClientRect();return O(e),!(!n||n.left==n.right)&&(Ee=r.right-n.right<3)}var Ie=3!="\n\nb".split(/\n/).length?function(e){var t=0,n=[],r=e.length;while(t<=r){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),l=o.indexOf("\r");-1!=l?(n.push(o.slice(0,l)),t+=l+1):(n.push(o),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},ze=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(n){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},Be=function(){var e=A("div");return"oncopy"in e||(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy)}(),Ge=null;function Ue(e){if(null!=Ge)return Ge;var t=N(e,A("span","x")),n=t.getBoundingClientRect(),r=T(t,0,1).getBoundingClientRect();return Ge=Math.abs(n.left-r.left)>1}var _e={},Ve={};function je(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),_e[e]=t}function Ke(e,t){Ve[e]=t}function Xe(e){if("string"==typeof e&&Ve.hasOwnProperty(e))e=Ve[e];else if(e&&"string"==typeof e.name&&Ve.hasOwnProperty(e.name)){var t=Ve[e.name];"string"==typeof t&&(t={name:t}),e=ie(t,e),e.name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Xe("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Xe("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function $e(e,t){t=Xe(t);var n=_e[t.name];if(!n)return $e(e,"text/plain");var r=n(e,t);if(Ye.hasOwnProperty(t.name)){var i=Ye[t.name];for(var o in i)i.hasOwnProperty(o)&&(r.hasOwnProperty(o)&&(r["_"+o]=r[o]),r[o]=i[o])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var l in t.modeProps)r[l]=t.modeProps[l];return r}var Ye={};function qe(e,t){var n=Ye.hasOwnProperty(e)?Ye[e]:Ye[e]={};U(t,n)}function Ze(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function Je(e,t){var n;while(e.innerMode){if(n=e.innerMode(t),!n||n.mode==e)break;t=n.state,e=n.mode}return n||{mode:e,state:t}}function Qe(e,t,n){return!e.startState||e.startState(t,n)}var et=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};function tt(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");var n=e;while(!n.lines)for(var r=0;;++r){var i=n.children[r],o=i.chunkSize();if(t=e.first&&tn?ut(n,tt(e,n).text.length):mt(t,tt(e,t.line).text.length)}function mt(e,t){var n=e.ch;return null==n||n>t?ut(e.line,t):n<0?ut(e.line,0):e}function yt(e,t){for(var n=[],r=0;r=this.string.length},et.prototype.sol=function(){return this.pos==this.lineStart},et.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},et.prototype.next=function(){if(this.post},et.prototype.eatSpace=function(){var e=this.pos;while(/[\s\u00a0]/.test(this.string.charAt(this.pos)))++this.pos;return this.pos>e},et.prototype.skipToEnd=function(){this.pos=this.string.length},et.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},et.prototype.backUp=function(e){this.pos-=e},et.prototype.column=function(){return this.lastColumnPos0?null:(r&&!1!==t&&(this.pos+=r[0].length),r)}var i=function(e){return n?e.toLowerCase():e},o=this.string.substr(this.pos,e.length);if(i(o)==i(e))return!1!==t&&(this.pos+=e.length),!0},et.prototype.current=function(){return this.string.slice(this.start,this.pos)},et.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},et.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},et.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var bt=function(e,t){this.state=e,this.lookAhead=t},wt=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};function xt(e,t,n,r){var i=[e.state.modeGen],o={};At(e,t.text,e.doc.mode,n,(function(e,t){return i.push(e,t)}),o,r);for(var l=n.state,a=function(r){n.baseTokens=i;var a=e.state.overlays[r],s=1,u=0;n.state=!0,At(e,t.text,a.mode,n,(function(e,t){var n=s;while(ue&&i.splice(s,1,e,i[s+1],r),s+=2,u=Math.min(e,r)}if(t)if(a.opaque)i.splice(n,s-n,e,"overlay "+t),s=n+2;else for(;ne.options.maxHighlightLength&&Ze(e.doc.mode,r.state),o=xt(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function St(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new wt(r,!0,t);var o=Dt(e,t,n),l=o>r.first&&tt(r,o-1).stateAfter,a=l?wt.fromSaved(r,l,o):new wt(r,Qe(r.mode),o);return r.iter(o,t,(function(n){kt(e,n.text,a);var r=a.line;n.stateAfter=r==t-1||r%5==0||r>=i.viewFrom&&rt.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}wt.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},wt.prototype.baseToken=function(e){if(!this.baseTokens)return null;while(this.baseTokens[this.baseTokenPos]<=e)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},wt.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},wt.fromSaved=function(e,t,n){return t instanceof bt?new wt(e,Ze(e.mode,t.state),n,t.lookAhead):new wt(e,Ze(e.mode,t),n)},wt.prototype.save=function(e){var t=!1!==e?Ze(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new bt(t,this.maxLookAhead):t};var Mt=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Ot(e,t,n,r){var i,o=e.doc,l=o.mode;t=vt(o,t);var a,s=tt(o,t.line),u=St(e,t.line,n),c=new et(s.text,e.options.tabSize,u);r&&(a=[]);while((r||c.pose.options.maxHighlightLength?(a=!1,l&&kt(e,t,r,f.pos),f.pos=t.length,s=null):s=Nt(Tt(n,f,r.state,h),o),h){var d=h[0].name;d&&(s="m-"+(s?d+" "+s:d))}if(!a||c!=s){while(ul;--a){if(a<=o.first)return o.first;var s=tt(o,a-1),u=s.stateAfter;if(u&&(!n||a+(u instanceof bt?u.lookAhead:0)<=o.modeFrontier))return a;var c=_(s.text,null,e.options.tabSize);(null==i||r>c)&&(i=a-1,r=c)}return i}function Wt(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontiern;r--){var i=tt(e,r).stateAfter;if(i&&(!(i instanceof bt)||r+i.lookAhead=t:o.to>t);(r||(r=[])).push(new Rt(l,o.from,s?null:o.to))}}return r}function Ut(e,t,n){var r;if(e)for(var i=0;i=t:o.to>t);if(a||o.from==t&&"bookmark"==l.type&&(!n||o.marker.insertLeft)){var s=null==o.from||(l.inclusiveLeft?o.from<=t:o.from0&&a)for(var w=0;w0)){var c=[s,1],f=ct(u.from,a.from),h=ct(u.to,a.to);(f<0||!l.inclusiveLeft&&!f)&&c.push({from:u.from,to:a.from}),(h>0||!l.inclusiveRight&&!h)&&c.push({from:a.to,to:u.to}),i.splice.apply(i,c),s+=c.length-3}}return i}function Kt(e){var t=e.markedSpans;if(t){for(var n=0;nt)&&(!n||qt(n,o.marker)<0)&&(n=o.marker)}return n}function tn(e,t,n,r,i){var o=tt(e,t),l=Et&&o.markedSpans;if(l)for(var a=0;a=0&&f<=0||c<=0&&f>=0)&&(c<=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?ct(u.to,n)>=0:ct(u.to,n)>0)||c>=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?ct(u.from,r)<=0:ct(u.from,r)<0)))return!0}}}function nn(e){var t;while(t=Jt(e))e=t.find(-1,!0).line;return e}function rn(e){var t;while(t=Qt(e))e=t.find(1,!0).line;return e}function on(e){var t,n;while(t=Qt(e))e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function ln(e,t){var n=tt(e,t),r=nn(n);return n==r?t:ot(r)}function an(e,t){if(t>e.lastLine())return t;var n,r=tt(e,t);if(!sn(e,r))return t;while(n=Qt(r))r=n.find(1,!0).line;return ot(r)+1}function sn(e,t){var n=Et&&t.markedSpans;if(n)for(var r=void 0,i=0;it.maxLineLength&&(t.maxLineLength=n,t.maxLine=e)}))}var dn=function(e,t,n){this.text=e,Xt(this,t),this.height=n?n(this):1};function pn(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),Kt(e),Xt(e,n);var i=r?r(e):1;i!=e.height&&it(e,i)}function gn(e){e.parent=null,Kt(e)}dn.prototype.lineNo=function(){return ot(this)},Te(dn);var vn={},mn={};function yn(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?mn:vn;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function bn(e,t){var n=D("span",null,null,s?"padding-right: .1px":null),r={pre:D("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o=i?t.rest[i-1]:t.line,l=void 0;r.pos=0,r.addToken=xn,Re(e.display.measure)&&(l=me(o,e.doc.direction))&&(r.addToken=Sn(r.addToken,l)),r.map=[];var a=t!=e.display.externalMeasured&&ot(o);Ln(o,r,Ct(e,o,a)),o.styleClasses&&(o.styleClasses.bgClass&&(r.bgClass=H(o.styleClasses.bgClass,r.bgClass||"")),o.styleClasses.textClass&&(r.textClass=H(o.styleClasses.textClass,r.textClass||""))),0==r.map.length&&r.map.push(0,0,r.content.appendChild(Pe(e.display.measure))),0==i?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(s){var u=r.content.lastChild;(/\bcm-tab\b/.test(u.className)||u.querySelector&&u.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Ce(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=H(r.pre.className,r.textClass||"")),r}function wn(e){var t=A("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function xn(e,t,n,r,i,o,s){if(t){var u,c=e.splitSpaces?Cn(t,e.trailingSpace):t,f=e.cm.state.specialChars,h=!1;if(f.test(t)){u=document.createDocumentFragment();var d=0;while(1){f.lastIndex=d;var p=f.exec(t),g=p?p.index-d:t.length-d;if(g){var v=document.createTextNode(c.slice(d,d+g));l&&a<9?u.appendChild(A("span",[v])):u.appendChild(v),e.map.push(e.pos,e.pos+g,v),e.col+=g,e.pos+=g}if(!p)break;d+=g+1;var m=void 0;if("\t"==p[0]){var y=e.cm.options.tabSize,b=y-e.col%y;m=u.appendChild(A("span",Q(b),"cm-tab")),m.setAttribute("role","presentation"),m.setAttribute("cm-text","\t"),e.col+=b}else"\r"==p[0]||"\n"==p[0]?(m=u.appendChild(A("span","\r"==p[0]?"␍":"␤","cm-invalidchar")),m.setAttribute("cm-text",p[0]),e.col+=1):(m=e.cm.options.specialCharPlaceholder(p[0]),m.setAttribute("cm-text",p[0]),l&&a<9?u.appendChild(A("span",[m])):u.appendChild(m),e.col+=1);e.map.push(e.pos,e.pos+1,m),e.pos++}}else e.col+=t.length,u=document.createTextNode(c),e.map.push(e.pos,e.pos+t.length,u),l&&a<9&&(h=!0),e.pos+=t.length;if(e.trailingSpace=32==c.charCodeAt(t.length-1),n||r||i||h||o||s){var w=n||"";r&&(w+=r),i&&(w+=i);var x=A("span",[u],w,o);if(s)for(var C in s)s.hasOwnProperty(C)&&"style"!=C&&"class"!=C&&x.setAttribute(C,s[C]);return e.content.appendChild(x)}e.content.appendChild(u)}}function Cn(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;iu&&f.from<=u)break;if(f.to>=c)return e(n,r,i,o,l,a,s);e(n,r.slice(0,f.to-u),i,o,null,a,s),o=null,r=r.slice(f.to-u),u=f.to}}}function kn(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function Ln(e,t,n){var r=e.markedSpans,i=e.text,o=0;if(r)for(var l,a,s,u,c,f,h,d=i.length,p=0,g=1,v="",m=0;;){if(m==p){s=u=c=a="",h=null,f=null,m=1/0;for(var y=[],b=void 0,w=0;wp||C.collapsed&&x.to==p&&x.from==p)){if(null!=x.to&&x.to!=p&&m>x.to&&(m=x.to,u=""),C.className&&(s+=" "+C.className),C.css&&(a=(a?a+";":"")+C.css),C.startStyle&&x.from==p&&(c+=" "+C.startStyle),C.endStyle&&x.to==m&&(b||(b=[])).push(C.endStyle,x.to),C.title&&((h||(h={})).title=C.title),C.attributes)for(var S in C.attributes)(h||(h={}))[S]=C.attributes[S];C.collapsed&&(!f||qt(f.marker,C)<0)&&(f=x)}else x.from>p&&m>x.from&&(m=x.from)}if(b)for(var k=0;k=d)break;var T=Math.min(d,m);while(1){if(v){var M=p+v.length;if(!f){var O=M>T?v.slice(0,T-p):v;t.addToken(t,O,l?l+s:s,c,p+O.length==m?u:"",a,h)}if(M>=T){v=v.slice(T-p),p=T;break}p=M,c=""}v=i.slice(o,o=n[g++]),l=yn(n[g++],t.cm.options)}}else for(var N=1;N2&&o.push((s.bottom+u.top)/2-n.top)}}o.push(n.bottom-n.top)}}function nr(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};if(e.rest){for(var r=0;rn)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}}function rr(e,t){t=nn(t);var n=ot(t),r=e.display.externalMeasured=new Tn(e.doc,t,n);r.lineN=n;var i=r.built=bn(e,r);return r.text=i.pre,N(e.display.lineMeasure,i.pre),r}function ir(e,t,n,r){return ar(e,lr(e,t),n,r)}function or(e,t){if(t>=e.display.viewFrom&&t=n.lineN&&tt)&&(o=s-a,i=o-1,t>=s&&(l="right")),null!=i){if(r=e[u+2],a==s&&n==(r.insertLeft?"left":"right")&&(l=n),"left"==n&&0==i)while(u&&e[u-2]==e[u-3]&&e[u-1].insertLeft)r=e[2+(u-=3)],l="left";if("right"==n&&i==s-a)while(u=0;i--)if((n=e[i]).left!=n.right)break;return n}function hr(e,t,n,r){var i,o=cr(t.map,n,r),s=o.node,u=o.start,c=o.end,f=o.collapse;if(3==s.nodeType){for(var h=0;h<4;h++){while(u&&ce(t.line.text.charAt(o.coverStart+u)))--u;while(o.coverStart+c0&&(f=r="right"),i=e.options.lineWrapping&&(d=s.getClientRects()).length>1?d["right"==r?d.length-1:0]:s.getBoundingClientRect()}if(l&&a<9&&!u&&(!i||!i.left&&!i.right)){var p=s.parentNode.getClientRects()[0];i=p?{left:p.left,right:p.left+Er(e.display),top:p.top,bottom:p.bottom}:ur}for(var g=i.top-t.rect.top,v=i.bottom-t.rect.top,m=(g+v)/2,y=t.view.measure.heights,b=0;b=r.text.length?(s=r.text.length,u="before"):s<=0&&(s=0,u="after"),!a)return l("before"==u?s-1:s,"before"==u);function c(e,t,n){var r=a[t],i=1==r.level;return l(n?e-1:e,i!=n)}var f=ge(a,s,u),h=pe,d=c(s,f,"before"==u);return null!=h&&(d.other=c(s,h,"before"!=u)),d}function kr(e,t){var n=0;t=vt(e.doc,t),e.options.lineWrapping||(n=Er(e.display)*t.ch);var r=tt(e.doc,t.line),i=cn(r)+Yn(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function Lr(e,t,n,r,i){var o=ut(e,t,n);return o.xRel=i,r&&(o.outside=r),o}function Tr(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return Lr(r.first,0,null,-1,-1);var i=lt(r,n),o=r.first+r.size-1;if(i>o)return Lr(r.first+r.size-1,tt(r,o).text.length,null,1,1);t<0&&(t=0);for(var l=tt(r,i);;){var a=Ar(e,l,i,t,n),s=en(l,a.ch+(a.xRel>0||a.outside>0?1:0));if(!s)return a;var u=s.find(1);if(u.line==i)return u;l=tt(r,i=u.line)}}function Mr(e,t,n,r){r-=br(t);var i=t.text.length,o=he((function(t){return ar(e,n,t-1).bottom<=r}),i,0);return i=he((function(t){return ar(e,n,t).top>r}),o,i),{begin:o,end:i}}function Or(e,t,n,r){n||(n=lr(e,t));var i=wr(e,t,ar(e,n,r),"line").top;return Mr(e,t,n,i)}function Nr(e,t,n,r){return!(e.bottom<=n)&&(e.top>n||(r?e.left:e.right)>t)}function Ar(e,t,n,r,i){i-=cn(t);var o=lr(e,t),l=br(t),a=0,s=t.text.length,u=!0,c=me(t,e.doc.direction);if(c){var f=(e.options.lineWrapping?Wr:Dr)(e,t,n,o,c,r,i);u=1!=f.level,a=u?f.from:f.to-1,s=u?f.to:f.from-1}var h,d,p=null,g=null,v=he((function(t){var n=ar(e,o,t);return n.top+=l,n.bottom+=l,!!Nr(n,r,i,!1)&&(n.top<=i&&n.left<=r&&(p=t,g=n),!0)}),a,s),m=!1;if(g){var y=r-g.left=w.bottom?1:0}return v=fe(t.text,v,1),Lr(n,v,d,m,r-h)}function Dr(e,t,n,r,i,o,l){var a=he((function(a){var s=i[a],u=1!=s.level;return Nr(Sr(e,ut(n,u?s.to:s.from,u?"before":"after"),"line",t,r),o,l,!0)}),0,i.length-1),s=i[a];if(a>0){var u=1!=s.level,c=Sr(e,ut(n,u?s.from:s.to,u?"after":"before"),"line",t,r);Nr(c,o,l,!0)&&c.top>l&&(s=i[a-1])}return s}function Wr(e,t,n,r,i,o,l){var a=Mr(e,t,r,l),s=a.begin,u=a.end;/\s/.test(t.text.charAt(u-1))&&u--;for(var c=null,f=null,h=0;h=u||d.to<=s)){var p=1!=d.level,g=ar(e,r,p?Math.min(u,d.to)-1:Math.max(s,d.from)).right,v=gv)&&(c=d,f=v)}}return c||(c=i[i.length-1]),c.fromu&&(c={from:c.from,to:u,level:c.level}),c}function Fr(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==sr){sr=A("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)sr.appendChild(document.createTextNode("x")),sr.appendChild(A("br"));sr.appendChild(document.createTextNode("x"))}N(e.measure,sr);var n=sr.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),O(e.measure),n||1}function Er(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=A("span","xxxxxxxxxx"),n=A("pre",[t],"CodeMirror-line-like");N(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function Hr(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,o=t.gutters.firstChild,l=0;o;o=o.nextSibling,++l){var a=e.display.gutterSpecs[l].className;n[a]=o.offsetLeft+o.clientLeft+i,r[a]=o.clientWidth}return{fixedPos:Pr(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Pr(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Rr(e){var t=Fr(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Er(e.display)-3);return function(i){if(sn(e.doc,i))return 0;var o=0;if(i.widgets)for(var l=0;l0&&(s=tt(e.doc,u.line).text).length==u.ch){var c=_(s,s.length,e.options.tabSize)-s.length;u=ut(u.line,Math.max(0,Math.round((o-Zn(e.display).left)/Er(e.display))-c))}return u}function Br(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,r=0;rt)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Et&&ln(e.doc,t)i.viewFrom?_r(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)_r(e);else if(t<=i.viewFrom){var o=Vr(e,n,n+r,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=r):_r(e)}else if(n>=i.viewTo){var l=Vr(e,t,t,-1);l?(i.view=i.view.slice(0,l.index),i.viewTo=l.lineN):_r(e)}else{var a=Vr(e,t,t,-1),s=Vr(e,n,n+r,1);a&&s?(i.view=i.view.slice(0,a.index).concat(Mn(e,a.lineN,s.lineN)).concat(i.view.slice(s.index)),i.viewTo+=r):_r(e)}var u=i.externalMeasured;u&&(n=i.lineN&&t=r.viewTo)){var o=r.view[Br(e,t)];if(null!=o.node){var l=o.changes||(o.changes=[]);-1==j(l,n)&&l.push(n)}}}function _r(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Vr(e,t,n,r){var i,o=Br(e,t),l=e.display.view;if(!Et||n==e.doc.first+e.doc.size)return{index:o,lineN:n};for(var a=e.display.viewFrom,s=0;s0){if(o==l.length-1)return null;i=a+l[o].size-t,o++}else i=a-t;t+=i,n+=i}while(ln(e.doc,n)!=n){if(o==(r<0?0:l.length-1))return null;n+=r*l[o-(r<0?1:0)].size,o+=r}return{index:o,lineN:n}}function jr(e,t,n){var r=e.display,i=r.view;0==i.length||t>=r.viewTo||n<=r.viewFrom?(r.view=Mn(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=Mn(e,t,r.viewFrom).concat(r.view):r.viewFromn&&(r.view=r.view.slice(0,Br(e,n)))),r.viewTo=n}function Kr(e){for(var t=e.display.view,n=0,r=0;r=e.display.viewTo||s.to().line0?l:e.defaultCharWidth())+"px"}if(r.other){var a=n.appendChild(A("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));a.style.display="",a.style.left=r.other.left+"px",a.style.top=r.other.top+"px",a.style.height=.85*(r.other.bottom-r.other.top)+"px"}}function qr(e,t){return e.top-t.top||e.left-t.left}function Zr(e,t,n){var r=e.display,i=e.doc,o=document.createDocumentFragment(),l=Zn(e.display),a=l.left,s=Math.max(r.sizerWidth,Qn(e)-r.sizer.offsetLeft)-l.right,u="ltr"==i.direction;function c(e,t,n,r){t<0&&(t=0),t=Math.round(t),r=Math.round(r),o.appendChild(A("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n top: "+t+"px; width: "+(null==n?s-e:n)+"px;\n height: "+(r-t)+"px"))}function f(t,n,r){var o,l,f=tt(i,t),h=f.text.length;function d(n,r){return Cr(e,ut(t,n),"div",f,r)}function p(t,n,r){var i=Or(e,f,null,t),o="ltr"==n==("after"==r)?"left":"right",l="after"==r?i.begin:i.end-(/\s/.test(f.text.charAt(i.end-1))?2:1);return d(l,o)[o]}var g=me(f,i.direction);return de(g,n||0,null==r?h:r,(function(e,t,i,f){var v="ltr"==i,m=d(e,v?"left":"right"),y=d(t-1,v?"right":"left"),b=null==n&&0==e,w=null==r&&t==h,x=0==f,C=!g||f==g.length-1;if(y.top-m.top<=3){var S=(u?b:w)&&x,k=(u?w:b)&&C,L=S?a:(v?m:y).left,T=k?s:(v?y:m).right;c(L,m.top,T-L,m.bottom)}else{var M,O,N,A;v?(M=u&&b&&x?a:m.left,O=u?s:p(e,i,"before"),N=u?a:p(t,i,"after"),A=u&&w&&C?s:y.right):(M=u?p(e,i,"before"):a,O=!u&&b&&x?s:m.right,N=!u&&w&&C?a:y.left,A=u?p(t,i,"after"):s),c(M,m.top,O-M,m.bottom),m.bottom0?t.blinker=setInterval((function(){e.hasFocus()||ni(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"}),e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Qr(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||ti(e))}function ei(e){e.state.delayingBlurEvent=!0,setTimeout((function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&ni(e))}),100)}function ti(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(Ce(e,"focus",e,t),e.state.focused=!0,E(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),s&&setTimeout((function(){return e.display.input.reset(!0)}),20)),e.display.input.receivedFocus()),Jr(e))}function ni(e,t){e.state.delayingBlurEvent||(e.state.focused&&(Ce(e,"blur",e,t),e.state.focused=!1,M(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout((function(){e.state.focused||(e.display.shift=!1)}),150))}function ri(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=Math.max(0,t.scroller.getBoundingClientRect().top),i=t.lineDiv.getBoundingClientRect().top,o=0,s=0;s.005||g<-.005)&&(ie.display.sizerWidth){var m=Math.ceil(h/Er(e.display));m>e.display.maxLineLength&&(e.display.maxLineLength=m,e.display.maxLine=u.line,e.display.maxLineChanged=!0)}}}Math.abs(o)>2&&(t.scroller.scrollTop+=o)}function ii(e){if(e.widgets)for(var t=0;t=l&&(o=lt(t,cn(tt(t,s))-e.wrapper.clientHeight),l=s)}return{from:o,to:Math.max(l,o+1)}}function li(e,t){if(!Se(e,"scrollCursorIntoView")){var n=e.display,r=n.sizer.getBoundingClientRect(),i=null,o=n.wrapper.ownerDocument;if(t.top+r.top<0?i=!0:t.bottom+r.top>(o.defaultView.innerHeight||o.documentElement.clientHeight)&&(i=!1),null!=i&&!g){var l=A("div","​",null,"position: absolute;\n top: "+(t.top-n.viewOffset-Yn(e.display))+"px;\n height: "+(t.bottom-t.top+Jn(e)+n.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(l),l.scrollIntoView(i),e.display.lineSpace.removeChild(l)}}}function ai(e,t,n,r){var i;null==r&&(r=0),e.options.lineWrapping||t!=n||(n="before"==t.sticky?ut(t.line,t.ch+1,"before"):t,t=t.ch?ut(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t);for(var o=0;o<5;o++){var l=!1,a=Sr(e,t),s=n&&n!=t?Sr(e,n):a;i={left:Math.min(a.left,s.left),top:Math.min(a.top,s.top)-r,right:Math.max(a.left,s.left),bottom:Math.max(a.bottom,s.bottom)+r};var u=ui(e,i),c=e.doc.scrollTop,f=e.doc.scrollLeft;if(null!=u.scrollTop&&(vi(e,u.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(l=!0)),null!=u.scrollLeft&&(yi(e,u.scrollLeft),Math.abs(e.doc.scrollLeft-f)>1&&(l=!0)),!l)break}return i}function si(e,t){var n=ui(e,t);null!=n.scrollTop&&vi(e,n.scrollTop),null!=n.scrollLeft&&yi(e,n.scrollLeft)}function ui(e,t){var n=e.display,r=Fr(e.display);t.top<0&&(t.top=0);var i=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:n.scroller.scrollTop,o=er(e),l={};t.bottom-t.top>o&&(t.bottom=t.top+o);var a=e.doc.height+qn(n),s=t.topa-r;if(t.topi+o){var c=Math.min(t.top,(u?a:t.bottom)-o);c!=i&&(l.scrollTop=c)}var f=e.options.fixedGutter?0:n.gutters.offsetWidth,h=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:n.scroller.scrollLeft-f,d=Qn(e)-n.gutters.offsetWidth,p=t.right-t.left>d;return p&&(t.right=t.left+d),t.left<10?l.scrollLeft=0:t.leftd+h-3&&(l.scrollLeft=t.right+(p?0:10)-d),l}function ci(e,t){null!=t&&(pi(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function fi(e){pi(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function hi(e,t,n){null==t&&null==n||pi(e),null!=t&&(e.curOp.scrollLeft=t),null!=n&&(e.curOp.scrollTop=n)}function di(e,t){pi(e),e.curOp.scrollToPos=t}function pi(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=kr(e,t.from),r=kr(e,t.to);gi(e,n,r,t.margin)}}function gi(e,t,n,r){var i=ui(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});hi(e,i.scrollLeft,i.scrollTop)}function vi(e,t){Math.abs(e.doc.scrollTop-t)<2||(n||Xi(e,{top:t}),mi(e,t,!0),n&&Xi(e),zi(e,100))}function mi(e,t,n){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),(e.display.scroller.scrollTop!=t||n)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function yi(e,t,n,r){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r||(e.doc.scrollLeft=t,Zi(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function bi(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+qn(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+Jn(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var wi=function(e,t,n){this.cm=n;var r=this.vert=A("div",[A("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=A("div",[A("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),be(r,"scroll",(function(){r.clientHeight&&t(r.scrollTop,"vertical")})),be(i,"scroll",(function(){i.clientWidth&&t(i.scrollLeft,"horizontal")})),this.checkedZeroWidth=!1,l&&a<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};wi.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.scrollTop=0,this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(0==r&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},wi.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},wi.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},wi.prototype.zeroWidthHack=function(){var e=b&&!p?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new V,this.disableVert=new V},wi.prototype.enableZeroWidthBar=function(e,t,n){function r(){var i=e.getBoundingClientRect(),o="vert"==n?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);o!=e?e.style.visibility="hidden":t.set(1e3,r)}e.style.visibility="",t.set(1e3,r)},wi.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var xi=function(){};function Ci(e,t){t||(t=bi(e));var n=e.display.barWidth,r=e.display.barHeight;Si(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&ri(e),Si(e,bi(e)),n=e.display.barWidth,r=e.display.barHeight}function Si(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}xi.prototype.update=function(){return{bottom:0,right:0}},xi.prototype.setScrollLeft=function(){},xi.prototype.setScrollTop=function(){},xi.prototype.clear=function(){};var ki={native:wi,null:xi};function Li(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&M(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new ki[e.options.scrollbarStyle]((function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),be(t,"mousedown",(function(){e.state.focused&&setTimeout((function(){return e.display.input.focus()}),0)})),t.setAttribute("cm-not-content","true")}),(function(t,n){"horizontal"==n?yi(e,t):vi(e,t)}),e),e.display.scrollbars.addClass&&E(e.display.wrapper,e.display.scrollbars.addClass)}var Ti=0;function Mi(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Ti,markArrays:null},Nn(e.curOp)}function Oi(e){var t=e.curOp;t&&Dn(t,(function(e){for(var t=0;t=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Gi(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Di(e){e.updatedDisplay=e.mustUpdate&&ji(e.cm,e.update)}function Wi(e){var t=e.cm,n=t.display;e.updatedDisplay&&ri(t),e.barMeasure=bi(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=ir(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Jn(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Qn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function Fi(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft=e.display.viewTo)){var n=+new Date+e.options.workTime,r=St(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),(function(o){if(r.line>=e.display.viewFrom){var l=o.styles,a=o.text.length>e.options.maxHighlightLength?Ze(t.mode,r.state):null,s=xt(e,o,r,!0);a&&(r.state=a),o.styles=s.styles;var u=o.styleClasses,c=s.classes;c?o.styleClasses=c:u&&(o.styleClasses=null);for(var f=!l||l.length!=o.styles.length||u!=c&&(!u||!c||u.bgClass!=c.bgClass||u.textClass!=c.textClass),h=0;!f&&hn)return zi(e,e.options.workDelay),!0})),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&Hi(e,(function(){for(var t=0;t=n.viewFrom&&t.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==Kr(e))return!1;Ji(e)&&(_r(e),t.dims=Hr(e));var i=r.first+r.size,o=Math.max(t.visible.from-e.options.viewportMargin,r.first),l=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFroml&&n.viewTo-l<20&&(l=Math.min(i,n.viewTo)),Et&&(o=ln(e.doc,o),l=an(e.doc,l));var a=o!=n.viewFrom||l!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;jr(e,o,l),n.viewOffset=cn(tt(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var s=Kr(e);if(!a&&0==s&&!t.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var u=_i(e);return s>4&&(n.lineDiv.style.display="none"),$i(e,n.updateLineNumbers,t.dims),s>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,Vi(u),O(n.cursorDiv),O(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,a&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,zi(e,400)),n.updateLineNumbers=null,!0}function Ki(e,t){for(var n=t.viewport,r=!0;;r=!1){if(r&&e.options.lineWrapping&&t.oldDisplayWidth!=Qn(e))r&&(t.visible=oi(e.display,e.doc,n));else if(n&&null!=n.top&&(n={top:Math.min(e.doc.height+qn(e.display)-er(e),n.top)}),t.visible=oi(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break;if(!ji(e,t))break;ri(e);var i=bi(e);Xr(e),Ci(e,i),qi(e,i),t.force=!1}t.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Xi(e,t){var n=new Gi(e,t);if(ji(e,n)){ri(e),Ki(e,n);var r=bi(e);Xr(e),Ci(e,r),qi(e,r),n.finish()}}function $i(e,t,n){var r=e.display,i=e.options.lineNumbers,o=r.lineDiv,l=o.firstChild;function a(t){var n=t.nextSibling;return s&&b&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),n}for(var u=r.view,c=r.viewFrom,f=0;f-1&&(d=!1),Hn(e,h,c,n)),d&&(O(h.lineNumber),h.lineNumber.appendChild(document.createTextNode(st(e.options,c)))),l=h.node.nextSibling}else{var p=_n(e,h,c,n);o.insertBefore(p,l)}c+=h.size}while(l)l=a(l)}function Yi(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",Fn(e,"gutterChanged",e)}function qi(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Jn(e)+"px"}function Zi(e){var t=e.display,n=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var r=Pr(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=r+"px",l=0;lu.clientWidth,p=u.scrollHeight>u.clientHeight;if(i&&d||o&&p){if(o&&b&&s)e:for(var g=t.target,v=a.view;g!=u;g=g.parentNode)for(var m=0;m=0&&ct(e,r.to())<=0)return n}return-1};var uo=function(e,t){this.anchor=e,this.head=t};function co(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort((function(e,t){return ct(e.from(),t.from())})),n=j(t,i);for(var o=1;o0:s>=0){var u=pt(a.from(),l.from()),c=dt(a.to(),l.to()),f=a.empty()?l.from()==l.head:a.from()==a.head;o<=n&&--n,t.splice(--o,2,new uo(f?c:u,f?u:c))}}return new so(t,n)}function fo(e,t){return new so([new uo(e,t||e)],0)}function ho(e){return e.text?ut(e.from.line+e.text.length-1,ee(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function po(e,t){if(ct(e,t.from)<0)return e;if(ct(e,t.to)<=0)return ho(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=ho(t).ch-t.to.ch),ut(n,r)}function go(e,t){for(var n=[],r=0;r1&&e.remove(a.line+1,p-1),e.insert(a.line+1,m)}Fn(e,"change",e,t)}function Co(e,t,n){function r(e,i,o){if(e.linked)for(var l=0;l1&&!e.done[e.done.length-2].ranges?(e.done.pop(),ee(e.done)):void 0}function Ao(e,t,n,r){var i=e.history;i.undone.length=0;var o,l,a=+new Date;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&i.lastModTime>a-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(o=No(i,i.lastOp==r)))l=ee(o.changes),0==ct(t.from,t.to)&&0==ct(t.from,l.to)?l.to=ho(t):o.changes.push(Mo(e,t));else{var s=ee(i.done);s&&s.ranges||Fo(e.sel,i.done),o={changes:[Mo(e,t)],generation:i.generation},i.done.push(o);while(i.done.length>i.undoDepth)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=a,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,l||Ce(e,"historyAdded")}function Do(e,t,n,r){var i=t.charAt(0);return"*"==i||"+"==i&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function Wo(e,t,n,r){var i=e.history,o=r&&r.origin;n==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||Do(e,o,ee(i.done),t))?i.done[i.done.length-1]=t:Fo(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=n,r&&!1!==r.clearRedo&&Oo(i.undone)}function Fo(e,t){var n=ee(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Eo(e,t,n,r){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),(function(n){n.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=n.markedSpans),++o}))}function Ho(e){if(!e)return null;for(var t,n=0;n-1&&(ee(a)[f]=u[f],delete u[f])}}}return r}function zo(e,t,n,r){if(r){var i=e.anchor;if(n){var o=ct(t,i)<0;o!=ct(n,i)<0?(i=t,t=n):o!=ct(t,n)<0&&(t=n)}return new uo(i,t)}return new uo(n||t,t)}function Bo(e,t,n,r,i){null==i&&(i=e.cm&&(e.cm.display.shift||e.extend)),Ko(e,new so([zo(e.sel.primary(),t,n,i)],0),r)}function Go(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),o=0;o=t.ch:a.to>t.ch))){if(i&&(Ce(s,"beforeCursorEnter"),s.explicitlyCleared)){if(o.markedSpans){--l;continue}break}if(!s.atomic)continue;if(n){var f=s.find(r<0?1:-1),h=void 0;if((r<0?c:u)&&(f=Qo(e,f,-r,f&&f.line==t.line?o:null)),f&&f.line==t.line&&(h=ct(f,n))&&(r<0?h<0:h>0))return Zo(e,f,t,r,i)}var d=s.find(r<0?-1:1);return(r<0?u:c)&&(d=Qo(e,d,r,d.line==t.line?o:null)),d?Zo(e,d,t,r,i):null}}return t}function Jo(e,t,n,r,i){var o=r||1,l=Zo(e,t,n,o,i)||!i&&Zo(e,t,n,o,!0)||Zo(e,t,n,-o,i)||!i&&Zo(e,t,n,-o,!0);return l||(e.cantEdit=!0,ut(e.first,0))}function Qo(e,t,n,r){return n<0&&0==t.ch?t.line>e.first?vt(e,ut(t.line-1)):null:n>0&&t.ch==(r||tt(e,t.line)).text.length?t.line=0;--i)rl(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else rl(e,t)}}function rl(e,t){if(1!=t.text.length||""!=t.text[0]||0!=ct(t.from,t.to)){var n=go(e,t);Ao(e,t,n,e.cm?e.cm.curOp.id:NaN),ll(e,t,n,_t(e,t));var r=[];Co(e,(function(e,n){n||-1!=j(r,e.history)||(fl(e.history,t),r.push(e.history)),ll(e,t,null,_t(e,t))}))}}function il(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(!r||n){for(var i,o=e.history,l=e.sel,a="undo"==t?o.done:o.undone,s="undo"==t?o.undone:o.done,u=0;u=0;--d){var p=h(d);if(p)return p.v}}}}function ol(e,t){if(0!=t&&(e.first+=t,e.sel=new so(te(e.sel.ranges,(function(e){return new uo(ut(e.anchor.line+t,e.anchor.ch),ut(e.head.line+t,e.head.ch))})),e.sel.primIndex),e.cm)){Gr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;re.lastLine())){if(t.from.lineo&&(t={from:t.from,to:ut(o,tt(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=nt(e,t.from,t.to),n||(n=go(e,t)),e.cm?al(e.cm,t,r):xo(e,t,r),Xo(e,n,$),e.cantEdit&&Jo(e,ut(e.firstLine(),0))&&(e.cantEdit=!1)}}function al(e,t,n){var r=e.doc,i=e.display,o=t.from,l=t.to,a=!1,s=o.line;e.options.lineWrapping||(s=ot(nn(tt(r,o.line))),r.iter(s,l.line+1,(function(e){if(e==i.maxLine)return a=!0,!0}))),r.sel.contains(t.from,t.to)>-1&&ke(e),xo(r,t,n,Rr(e)),e.options.lineWrapping||(r.iter(s,o.line+t.text.length,(function(e){var t=fn(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,a=!1)})),a&&(e.curOp.updateMaxLine=!0)),Wt(r,o.line),zi(e,400);var u=t.text.length-(l.line-o.line)-1;t.full?Gr(e):o.line!=l.line||1!=t.text.length||wo(e.doc,t)?Gr(e,o.line,l.line+1,u):Ur(e,o.line,"text");var c=Le(e,"changes"),f=Le(e,"change");if(f||c){var h={from:o,to:l,text:t.text,removed:t.removed,origin:t.origin};f&&Fn(e,"change",e,h),c&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(h)}e.display.selForContextMenu=null}function sl(e,t,n,r,i){var o;r||(r=n),ct(r,n)<0&&(o=[r,n],n=o[0],r=o[1]),"string"==typeof t&&(t=e.splitLines(t)),nl(e,{from:n,to:r,text:t,origin:i})}function ul(e,t,n,r){n1||!(this.children[0]instanceof dl))){var a=[];this.collapse(a),this.children=[new dl(a)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var l=i.lines.length%25+25,a=l;a10);e.parent.maybeSpill()}},iterN:function(e,t,n){for(var r=0;r0||0==l&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=D("span",[o.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(tn(e,t.line,t,n,o)||t.line!=n.line&&tn(e,n.line,t,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Pt()}o.addToHistory&&Ao(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var a,s=t.line,u=e.cm;if(e.iter(s,n.line+1,(function(r){u&&o.collapsed&&!u.options.lineWrapping&&nn(r)==u.display.maxLine&&(a=!0),o.collapsed&&s!=t.line&&it(r,0),Bt(r,new Rt(o,s==t.line?t.ch:null,s==n.line?n.ch:null),e.cm&&e.cm.curOp),++s})),o.collapsed&&e.iter(t.line,n.line+1,(function(t){sn(e,t)&&it(t,0)})),o.clearOnEnter&&be(o,"beforeCursorEnter",(function(){return o.clear()})),o.readOnly&&(Ht(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++yl,o.atomic=!0),u){if(a&&(u.curOp.updateMaxLine=!0),o.collapsed)Gr(u,t.line,n.line+1);else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var c=t.line;c<=n.line;c++)Ur(u,c,"text");o.atomic&&Yo(u.doc),Fn(u,"markerAdded",u,o)}return o}bl.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&Mi(e),Le(this,"clear")){var n=this.find();n&&Fn(this,"clear",n.from,n.to)}for(var r=null,i=null,o=0;oe.display.maxLineLength&&(e.display.maxLine=u,e.display.maxLineLength=c,e.display.maxLineChanged=!0)}null!=r&&e&&this.collapsed&&Gr(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Yo(e.doc)),e&&Fn(e,"markerCleared",e,this,r,i),t&&Oi(e),this.parent&&this.parent.clear()}},bl.prototype.find=function(e,t){var n,r;null==e&&"bookmark"==this.type&&(e=1);for(var i=0;i=0;s--)nl(this,r[s]);a?jo(this,a):this.cm&&fi(this.cm)})),undo:Ii((function(){il(this,"undo")})),redo:Ii((function(){il(this,"redo")})),undoSelection:Ii((function(){il(this,"undo",!0)})),redoSelection:Ii((function(){il(this,"redo",!0)})),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=vt(this,e),t=vt(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,(function(o){var l=o.markedSpans;if(l)for(var a=0;a=s.to||null==s.from&&i!=e.line||null!=s.from&&i==t.line&&s.from>=t.ch||n&&!n(s.marker)||r.push(s.marker.parent||s.marker)}++i})),r},getAllMarks:function(){var e=[];return this.iter((function(t){var n=t.markedSpans;if(n)for(var r=0;re)return t=e,!0;e-=o,++n})),vt(this,ut(n,t))},indexFromPos:function(e){e=vt(this,e);var t=e.ch;if(e.linet&&(t=e.from),null!=e.to&&e.to-1)return t.state.draggingText(e),void setTimeout((function(){return t.display.input.focus()}),20);try{var f=e.dataTransfer.getData("Text");if(f){var h;if(t.state.draggingText&&!t.state.draggingText.copy&&(h=t.listSelections()),Xo(t.doc,fo(n,n)),h)for(var d=0;d=0;t--)sl(e.doc,"",r[t].from,r[t].to,"+delete");fi(e)}))}function Zl(e,t,n){var r=fe(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Jl(e,t,n){var r=Zl(e,t.ch,n);return null==r?null:new ut(t.line,r,n<0?"after":"before")}function Ql(e,t,n,r,i){if(e){"rtl"==t.doc.direction&&(i=-i);var o=me(n,t.doc.direction);if(o){var l,a=i<0?ee(o):o[0],s=i<0==(1==a.level),u=s?"after":"before";if(a.level>0||"rtl"==t.doc.direction){var c=lr(t,n);l=i<0?n.text.length-1:0;var f=ar(t,c,l).top;l=he((function(e){return ar(t,c,e).top==f}),i<0==(1==a.level)?a.from:a.to-1,l),"before"==u&&(l=Zl(n,l,1))}else l=i<0?a.to:a.from;return new ut(r,l,u)}}return new ut(r,i<0?n.text.length:0,i<0?"before":"after")}function ea(e,t,n,r){var i=me(t,e.doc.direction);if(!i)return Jl(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var o=ge(i,n.ch,n.sticky),l=i[o];if("ltr"==e.doc.direction&&l.level%2==0&&(r>0?l.to>n.ch:l.from=l.from&&h>=c.begin)){var d=f?"before":"after";return new ut(n.line,h,d)}}var p=function(e,t,r){for(var o=function(e,t){return t?new ut(n.line,s(e,1),"before"):new ut(n.line,e,"after")};e>=0&&e0==(1!=l.level),u=a?r.begin:s(r.end,-1);if(l.from<=u&&u0?c.end:s(c.begin,-1);return null==v||r>0&&v==t.text.length||(g=p(r>0?0:i.length-1,r,u(v)),!g)?null:g}Ul.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"},Ul.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"},Ul.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},Ul.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"]},Ul["default"]=b?Ul.macDefault:Ul.pcDefault;var ta={selectAll:el,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),$)},killLine:function(e){return ql(e,(function(t){if(t.empty()){var n=tt(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line0)i=new ut(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),ut(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var l=tt(e.doc,i.line-1).text;l&&(i=new ut(i.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+l.charAt(l.length-1),ut(i.line-1,l.length-1),i,"+transpose"))}n.push(new uo(i,i))}e.setSelections(n)}))},newlineAndIndent:function(e){return Hi(e,(function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;r-1&&(ct((i=a.ranges[i]).from(),t)<0||t.xRel>0)&&(ct(i.to(),t)>0||t.xRel<0)?Ta(e,r,t,o):Oa(e,r,t,o)}function Ta(e,t,n,r){var i=e.display,o=!1,u=Pi(e,(function(t){s&&(i.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:ei(e)),xe(i.wrapper.ownerDocument,"mouseup",u),xe(i.wrapper.ownerDocument,"mousemove",c),xe(i.scroller,"dragstart",f),xe(i.scroller,"drop",u),o||(Me(t),r.addNew||Bo(e.doc,n,null,null,r.extend),s&&!d||l&&9==a?setTimeout((function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()}),20):i.input.focus())})),c=function(e){o=o||Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)>=10},f=function(){return o=!0};s&&(i.scroller.draggable=!0),e.state.draggingText=u,u.copy=!r.moveOnDrag,be(i.wrapper.ownerDocument,"mouseup",u),be(i.wrapper.ownerDocument,"mousemove",c),be(i.scroller,"dragstart",f),be(i.scroller,"drop",u),e.state.delayingBlurEvent=!0,setTimeout((function(){return i.input.focus()}),20),i.scroller.dragDrop&&i.scroller.dragDrop()}function Ma(e,t,n){if("char"==n)return new uo(t,t);if("word"==n)return e.findWordAt(t);if("line"==n)return new uo(ut(t.line,0),vt(e.doc,ut(t.line+1,0)));var r=n(e,t);return new uo(r.from,r.to)}function Oa(e,t,n,r){l&&ei(e);var i=e.display,o=e.doc;Me(t);var a,s,u=o.sel,c=u.ranges;if(r.addNew&&!r.extend?(s=o.sel.contains(n),a=s>-1?c[s]:new uo(n,n)):(a=o.sel.primary(),s=o.sel.primIndex),"rectangle"==r.unit)r.addNew||(a=new uo(n,n)),n=zr(e,t,!0,!0),s=-1;else{var f=Ma(e,n,r.unit);a=r.extend?zo(a,f.anchor,f.head,r.extend):f}r.addNew?-1==s?(s=c.length,Ko(o,co(e,c.concat([a]),s),{scroll:!1,origin:"*mouse"})):c.length>1&&c[s].empty()&&"char"==r.unit&&!r.extend?(Ko(o,co(e,c.slice(0,s).concat(c.slice(s+1)),0),{scroll:!1,origin:"*mouse"}),u=o.sel):Uo(o,s,a,Y):(s=0,Ko(o,new so([a],0),Y),u=o.sel);var h=n;function d(t){if(0!=ct(h,t))if(h=t,"rectangle"==r.unit){for(var i=[],l=e.options.tabSize,c=_(tt(o,n.line).text,n.ch,l),f=_(tt(o,t.line).text,t.ch,l),d=Math.min(c,f),p=Math.max(c,f),g=Math.min(n.line,t.line),v=Math.min(e.lastLine(),Math.max(n.line,t.line));g<=v;g++){var m=tt(o,g).text,y=Z(m,d,l);d==p?i.push(new uo(ut(g,y),ut(g,y))):m.length>y&&i.push(new uo(ut(g,y),ut(g,Z(m,p,l))))}i.length||i.push(new uo(n,n)),Ko(o,co(e,u.ranges.slice(0,s).concat(i),s),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var b,w=a,x=Ma(e,t,r.unit),C=w.anchor;ct(x.anchor,C)>0?(b=x.head,C=pt(w.from(),x.anchor)):(b=x.anchor,C=dt(w.to(),x.head));var S=u.ranges.slice(0);S[s]=Na(e,new uo(vt(o,C),b)),Ko(o,co(e,S,s),Y)}}var p=i.wrapper.getBoundingClientRect(),g=0;function v(t){var n=++g,l=zr(e,t,!0,"rectangle"==r.unit);if(l)if(0!=ct(l,h)){e.curOp.focus=F(I(e)),d(l);var a=oi(i,o);(l.line>=a.to||l.linep.bottom?20:0;s&&setTimeout(Pi(e,(function(){g==n&&(i.scroller.scrollTop+=s,v(t))})),50)}}function m(t){e.state.selectingText=!1,g=1/0,t&&(Me(t),i.input.focus()),xe(i.wrapper.ownerDocument,"mousemove",y),xe(i.wrapper.ownerDocument,"mouseup",b),o.history.lastSelOrigin=null}var y=Pi(e,(function(e){0!==e.buttons&&We(e)?v(e):m(e)})),b=Pi(e,m);e.state.selectingText=b,be(i.wrapper.ownerDocument,"mousemove",y),be(i.wrapper.ownerDocument,"mouseup",b)}function Na(e,t){var n=t.anchor,r=t.head,i=tt(e.doc,n.line);if(0==ct(n,r)&&n.sticky==r.sticky)return t;var o=me(i);if(!o)return t;var l=ge(o,n.ch,n.sticky),a=o[l];if(a.from!=n.ch&&a.to!=n.ch)return t;var s,u=l+(a.from==n.ch==(1!=a.level)?0:1);if(0==u||u==o.length)return t;if(r.line!=n.line)s=(r.line-n.line)*("ltr"==e.doc.direction?1:-1)>0;else{var c=ge(o,r.ch,r.sticky),f=c-l||(r.ch-n.ch)*(1==a.level?-1:1);s=c==u-1||c==u?f<0:f>0}var h=o[u+(s?-1:0)],d=s==(1==h.level),p=d?h.from:h.to,g=d?"after":"before";return n.ch==p&&n.sticky==g?t:new uo(new ut(n.line,p,g),r)}function Aa(e,t,n,r){var i,o;if(t.touches)i=t.touches[0].clientX,o=t.touches[0].clientY;else try{i=t.clientX,o=t.clientY}catch(h){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&Me(t);var l=e.display,a=l.lineDiv.getBoundingClientRect();if(o>a.bottom||!Le(e,n))return Ne(t);o-=a.top-l.viewOffset;for(var s=0;s=i){var c=lt(e.doc,o),f=e.display.gutterSpecs[s];return Ce(e,n,e,c,f.className,t),Ne(t)}}}function Da(e,t){return Aa(e,t,"gutterClick",!0)}function Wa(e,t){$n(e.display,t)||Fa(e,t)||Se(e,t,"contextmenu")||k||e.display.input.onContextMenu(t)}function Fa(e,t){return!!Le(e,"gutterContextMenu")&&Aa(e,t,"gutterContextMenu",!1)}function Ea(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),vr(e)}wa.prototype.compare=function(e,t,n){return this.time+ba>e&&0==ct(t,this.pos)&&n==this.button};var Ha={toString:function(){return"CodeMirror.Init"}},Pa={},Ra={};function Ia(e){var t=e.optionHandlers;function n(n,r,i,o){e.defaults[n]=r,i&&(t[n]=o?function(e,t,n){n!=Ha&&i(e,t,n)}:i)}e.defineOption=n,e.Init=Ha,n("value","",(function(e,t){return e.setValue(t)}),!0),n("mode",null,(function(e,t){e.doc.modeOption=t,yo(e)}),!0),n("indentUnit",2,yo,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,(function(e){bo(e),vr(e),Gr(e)}),!0),n("lineSeparator",null,(function(e,t){if(e.doc.lineSep=t,t){var n=[],r=e.doc.first;e.doc.iter((function(e){for(var i=0;;){var o=e.text.indexOf(t,i);if(-1==o)break;i=o+t.length,n.push(ut(r,o))}r++}));for(var i=n.length-1;i>=0;i--)sl(e.doc,t,n[i],ut(n[i].line,n[i].ch+t.length))}})),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,(function(e,t,n){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),n!=Ha&&e.refresh()})),n("specialCharPlaceholder",wn,(function(e){return e.refresh()}),!0),n("electricChars",!0),n("inputStyle",y?"contenteditable":"textarea",(function(){throw new Error("inputStyle can not (yet) be changed in a running editor")}),!0),n("spellcheck",!1,(function(e,t){return e.getInputField().spellcheck=t}),!0),n("autocorrect",!1,(function(e,t){return e.getInputField().autocorrect=t}),!0),n("autocapitalize",!1,(function(e,t){return e.getInputField().autocapitalize=t}),!0),n("rtlMoveVisually",!x),n("wholeLineUpdateBefore",!0),n("theme","default",(function(e){Ea(e),to(e)}),!0),n("keyMap","default",(function(e,t,n){var r=Yl(t),i=n!=Ha&&Yl(n);i&&i.detach&&i.detach(e,r),r.attach&&r.attach(e,i||null)})),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Ba,!0),n("gutters",[],(function(e,t){e.display.gutterSpecs=Qi(t,e.options.lineNumbers),to(e)}),!0),n("fixedGutter",!0,(function(e,t){e.display.gutters.style.left=t?Pr(e.display)+"px":"0",e.refresh()}),!0),n("coverGutterNextToScrollbar",!1,(function(e){return Ci(e)}),!0),n("scrollbarStyle","native",(function(e){Li(e),Ci(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)}),!0),n("lineNumbers",!1,(function(e,t){e.display.gutterSpecs=Qi(e.options.gutters,t),to(e)}),!0),n("firstLineNumber",1,to,!0),n("lineNumberFormatter",(function(e){return e}),to,!0),n("showCursorWhenSelecting",!1,Xr,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,(function(e,t){"nocursor"==t&&(ni(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)})),n("screenReaderLabel",null,(function(e,t){t=""===t?null:t,e.display.input.screenReaderLabelChanged(t)})),n("disableInput",!1,(function(e,t){t||e.display.input.reset()}),!0),n("dragDrop",!0,za),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,Xr,!0),n("singleCursorHeightPerLine",!0,Xr,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,bo,!0),n("addModeClass",!1,bo,!0),n("pollInterval",100),n("undoDepth",200,(function(e,t){return e.doc.history.undoDepth=t})),n("historyEventDelay",1250),n("viewportMargin",10,(function(e){return e.refresh()}),!0),n("maxHighlightLength",1e4,bo,!0),n("moveInputWithCursor",!0,(function(e,t){t||e.display.input.resetPosition()})),n("tabindex",null,(function(e,t){return e.display.input.getField().tabIndex=t||""})),n("autofocus",null),n("direction","ltr",(function(e,t){return e.doc.setDirection(t)}),!0),n("phrases",null)}function za(e,t,n){var r=n&&n!=Ha;if(!t!=!r){var i=e.display.dragFunctions,o=t?be:xe;o(e.display.scroller,"dragstart",i.start),o(e.display.scroller,"dragenter",i.enter),o(e.display.scroller,"dragover",i.over),o(e.display.scroller,"dragleave",i.leave),o(e.display.scroller,"drop",i.drop)}}function Ba(e){e.options.lineWrapping?(E(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(M(e.display.wrapper,"CodeMirror-wrap"),hn(e)),Ir(e),Gr(e),vr(e),setTimeout((function(){return Ci(e)}),100)}function Ga(e,t){var n=this;if(!(this instanceof Ga))return new Ga(e,t);this.options=t=t?U(t):{},U(Pa,t,!1);var r=t.value;"string"==typeof r?r=new Ml(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new Ga.inputStyles[t.inputStyle](this),o=this.display=new no(e,r,i,t);for(var u in o.wrapper.CodeMirror=this,Ea(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Li(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 V,keySeq:null,specialChars:null},t.autofocus&&!y&&o.input.focus(),l&&a<11&&setTimeout((function(){return n.display.input.reset(!0)}),20),Ua(this),Hl(),Mi(this),this.curOp.forceUpdate=!0,So(this,r),t.autofocus&&!y||this.hasFocus()?setTimeout((function(){n.hasFocus()&&!n.state.focused&&ti(n)}),20):ni(this),Ra)Ra.hasOwnProperty(u)&&Ra[u](this,t[u],Ha);Ji(this),t.finishInit&&t.finishInit(this);for(var c=0;c<_a.length;++c)_a[c](this);Oi(this),s&&t.lineWrapping&&"optimizelegibility"==getComputedStyle(o.lineDiv).textRendering&&(o.lineDiv.style.textRendering="auto")}function Ua(e){var t=e.display;be(t.scroller,"mousedown",Pi(e,Ca)),be(t.scroller,"dblclick",l&&a<11?Pi(e,(function(t){if(!Se(e,t)){var n=zr(e,t);if(n&&!Da(e,t)&&!$n(e.display,t)){Me(t);var r=e.findWordAt(n);Bo(e.doc,r.anchor,r.head)}}})):function(t){return Se(e,t)||Me(t)}),be(t.scroller,"contextmenu",(function(t){return Wa(e,t)})),be(t.input.getField(),"contextmenu",(function(n){t.scroller.contains(n.target)||Wa(e,n)}));var n,r={end:0};function i(){t.activeTouch&&(n=setTimeout((function(){return t.activeTouch=null}),1e3),r=t.activeTouch,r.end=+new Date)}function o(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}function s(e,t){if(null==t.left)return!0;var n=t.left-e.left,r=t.top-e.top;return n*n+r*r>400}be(t.scroller,"touchstart",(function(i){if(!Se(e,i)&&!o(i)&&!Da(e,i)){t.input.ensurePolled(),clearTimeout(n);var l=+new Date;t.activeTouch={start:l,moved:!1,prev:l-r.end<=300?r:null},1==i.touches.length&&(t.activeTouch.left=i.touches[0].pageX,t.activeTouch.top=i.touches[0].pageY)}})),be(t.scroller,"touchmove",(function(){t.activeTouch&&(t.activeTouch.moved=!0)})),be(t.scroller,"touchend",(function(n){var r=t.activeTouch;if(r&&!$n(t,n)&&null!=r.left&&!r.moved&&new Date-r.start<300){var o,l=e.coordsChar(t.activeTouch,"page");o=!r.prev||s(r,r.prev)?new uo(l,l):!r.prev.prev||s(r,r.prev.prev)?e.findWordAt(l):new uo(ut(l.line,0),vt(e.doc,ut(l.line+1,0))),e.setSelection(o.anchor,o.head),e.focus(),Me(n)}i()})),be(t.scroller,"touchcancel",i),be(t.scroller,"scroll",(function(){t.scroller.clientHeight&&(vi(e,t.scroller.scrollTop),yi(e,t.scroller.scrollLeft,!0),Ce(e,"scroll",e))})),be(t.scroller,"mousewheel",(function(t){return ao(e,t)})),be(t.scroller,"DOMMouseScroll",(function(t){return ao(e,t)})),be(t.wrapper,"scroll",(function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0})),t.dragFunctions={enter:function(t){Se(e,t)||Ae(t)},over:function(t){Se(e,t)||(Dl(e,t),Ae(t))},start:function(t){return Al(e,t)},drop:Pi(e,Nl),leave:function(t){Se(e,t)||Wl(e)}};var u=t.input.getField();be(u,"keyup",(function(t){return ga.call(e,t)})),be(u,"keydown",Pi(e,da)),be(u,"keypress",Pi(e,va)),be(u,"focus",(function(t){return ti(e,t)})),be(u,"blur",(function(t){return ni(e,t)}))}Ga.defaults=Pa,Ga.optionHandlers=Ra;var _a=[];function Va(e,t,n,r){var i,o=e.doc;null==n&&(n="add"),"smart"==n&&(o.mode.indent?i=St(e,t).state:n="prev");var l=e.options.tabSize,a=tt(o,t),s=_(a.text,null,l);a.stateAfter&&(a.stateAfter=null);var u,c=a.text.match(/^\s*/)[0];if(r||/\S/.test(a.text)){if("smart"==n&&(u=o.mode.indent(i,a.text.slice(c.length),a.text),u==X||u>150)){if(!r)return;n="prev"}}else u=0,n="not";"prev"==n?u=t>o.first?_(tt(o,t-1).text,null,l):0:"add"==n?u=s+e.options.indentUnit:"subtract"==n?u=s-e.options.indentUnit:"number"==typeof n&&(u=s+n),u=Math.max(0,u);var f="",h=0;if(e.options.indentWithTabs)for(var d=Math.floor(u/l);d;--d)h+=l,f+="\t";if(hl,s=Ie(t),u=null;if(a&&r.ranges.length>1)if(ja&&ja.text.join("\n")==t){if(r.ranges.length%ja.text.length==0){u=[];for(var c=0;c=0;h--){var d=r.ranges[h],p=d.from(),g=d.to();d.empty()&&(n&&n>0?p=ut(p.line,p.ch-n):e.state.overwrite&&!a?g=ut(g.line,Math.min(tt(o,g.line).text.length,g.ch+ee(s).length)):a&&ja&&ja.lineWise&&ja.text.join("\n")==s.join("\n")&&(p=g=ut(p.line,0)));var v={from:p,to:g,text:u?u[h%u.length]:s,origin:i||(a?"paste":e.state.cutIncoming>l?"cut":"+input")};nl(e.doc,v),Fn(e,"inputRead",e,v)}t&&!a&&Ya(e,t),fi(e),e.curOp.updateInput<2&&(e.curOp.updateInput=f),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function $a(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||!t.hasFocus()||Hi(t,(function(){return Xa(t,n,0,null,"paste")})),!0}function Ya(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(!(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)){var o=e.getModeAt(i.head),l=!1;if(o.electricChars){for(var a=0;a-1){l=Va(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(tt(e.doc,i.head.line).text.slice(0,i.head.ch))&&(l=Va(e,i.head.line,"smart"));l&&Fn(e,"electricInput",e,i.head.line)}}}function qa(e){for(var t=[],n=[],r=0;rn&&(Va(this,i.head.line,e,!0),n=i.head.line,r==this.doc.sel.primIndex&&fi(this));else{var o=i.from(),l=i.to(),a=Math.max(n,o.line);n=Math.min(this.lastLine(),l.line-(l.ch?0:1))+1;for(var s=a;s0&&Uo(this.doc,r,new uo(o,u[r].to()),$)}}})),getTokenAt:function(e,t){return Ot(this,e,t)},getLineTokens:function(e,t){return Ot(this,ut(e),t,!0)},getTokenTypeAt:function(e){e=vt(this.doc,e);var t,n=Ct(this,tt(this.doc,e.line)),r=0,i=(n.length-1)/2,o=e.ch;if(0==o)t=n[2];else for(;;){var l=r+i>>1;if((l?n[2*l-1]:0)>=o)i=l;else{if(!(n[2*l+1]o&&(e=o,i=!0),r=tt(this.doc,e)}else r=e;return wr(this,r,{top:0,left:0},t||"page",n||i).top+(i?this.doc.height-cn(r):0)},defaultTextHeight:function(){return Fr(this.display)},defaultCharWidth:function(){return Er(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,n,r,i){var o=this.display;e=Sr(this,vt(this.doc,e));var l=e.bottom,a=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),o.sizer.appendChild(t),"over"==r)l=e.top;else if("above"==r||"near"==r){var s=Math.max(o.wrapper.clientHeight,this.doc.height),u=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==r||e.bottom+t.offsetHeight>s)&&e.top>t.offsetHeight?l=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=s&&(l=e.bottom),a+t.offsetWidth>u&&(a=u-t.offsetWidth)}t.style.top=l+"px",t.style.left=t.style.right="","right"==i?(a=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?a=0:"middle"==i&&(a=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=a+"px"),n&&si(this,{left:a,top:l,right:a+t.offsetWidth,bottom:l+t.offsetHeight})},triggerOnKeyDown:Ri(da),triggerOnKeyPress:Ri(va),triggerOnKeyUp:ga,triggerOnMouseDown:Ri(Ca),execCommand:function(e){if(ta.hasOwnProperty(e))return ta[e].call(null,this)},triggerElectric:Ri((function(e){Ya(this,e)})),findPosH:function(e,t,n,r){var i=1;t<0&&(i=-1,t=-t);for(var o=vt(this.doc,e),l=0;l0&&a(n.charAt(r-1)))--r;while(i.5||this.options.lineWrapping)&&Ir(this),Ce(this,"refresh",this)})),swapDoc:Ri((function(e){var t=this.doc;return t.cm=null,this.state.selectingText&&this.state.selectingText(),So(this,e),vr(this),this.display.input.reset(),hi(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,Fn(this,"swapDoc",this,t),t})),phrase:function(e){var t=this.options.phrases;return t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:e},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}},Te(e),e.registerHelper=function(t,r,i){n.hasOwnProperty(t)||(n[t]=e[t]={_global:[]}),n[t][r]=i},e.registerGlobalHelper=function(t,r,i,o){e.registerHelper(t,r,o),n[t]._global.push({pred:i,val:o})}}function es(e,t,n,r,i){var o=t,l=n,a=tt(e,t.line),s=i&&"rtl"==e.direction?-n:n;function u(){var n=t.line+s;return!(n=e.first+e.size)&&(t=new ut(n,t.ch,t.sticky),a=tt(e,n))}function c(o){var l;if("codepoint"==r){var c=a.text.charCodeAt(t.ch+(n>0?0:-1));if(isNaN(c))l=null;else{var f=n>0?c>=55296&&c<56320:c>=56320&&c<57343;l=new ut(t.line,Math.max(0,Math.min(a.text.length,t.ch+n*(f?2:1))),-n)}}else l=i?ea(e.cm,a,t,n):Jl(a,t,n);if(null==l){if(o||!u())return!1;t=Ql(i,e.cm,a,t.line,s)}else t=l;return!0}if("char"==r||"codepoint"==r)c();else if("column"==r)c(!0);else if("word"==r||"group"==r)for(var f=null,h="group"==r,d=e.cm&&e.cm.getHelper(t,"wordChars"),p=!0;;p=!1){if(n<0&&!c(!p))break;var g=a.text.charAt(t.ch)||"\n",v=ae(g,d)?"w":h&&"\n"==g?"n":!h||/\s/.test(g)?null:"p";if(!h||p||v||(v="s"),f&&f!=v){n<0&&(n=1,c(),t.sticky="after");break}if(v&&(f=v),n>0&&!c(!p))break}var m=Jo(e,t,o,l,!0);return ft(o,m)&&(m.hitSide=!0),m}function ts(e,t,n,r){var i,o,l=e.doc,a=t.left;if("page"==r){var s=Math.min(e.display.wrapper.clientHeight,B(e).innerHeight||l(e).documentElement.clientHeight),u=Math.max(s-.5*Fr(e.display),3);i=(n>0?t.bottom:t.top)+n*u}else"line"==r&&(i=n>0?t.bottom+3:t.top-3);for(;;){if(o=Tr(e,a,i),!o.outside)break;if(n<0?i<=0:i>=l.height){o.hitSide=!0;break}i+=5*n}return o}var ns=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new V,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function rs(e,t){var n=or(e,t.line);if(!n||n.hidden)return null;var r=tt(e.doc,t.line),i=nr(n,r,t.line),o=me(r,e.doc.direction),l="left";if(o){var a=ge(o,t.ch);l=a%2?"right":"left"}var s=cr(i.map,t.ch,l);return s.offset="right"==s.collapse?s.end:s.start,s}function is(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function os(e,t){return t&&(e.bad=!0),e}function ls(e,t,n,r,i){var o="",l=!1,a=e.doc.lineSeparator(),s=!1;function u(e){return function(t){return t.id==e}}function c(){l&&(o+=a,s&&(o+=a),l=s=!1)}function f(e){e&&(c(),o+=e)}function h(t){if(1==t.nodeType){var n=t.getAttribute("cm-text");if(n)return void f(n);var o,d=t.getAttribute("cm-marker");if(d){var p=e.findMarks(ut(r,0),ut(i+1,0),u(+d));return void(p.length&&(o=p[0].find(0))&&f(nt(e.doc,o.from,o.to).join(a)))}if("false"==t.getAttribute("contenteditable"))return;var g=/^(pre|div|p|li|table|br)$/i.test(t.nodeName);if(!/^br$/i.test(t.nodeName)&&0==t.textContent.length)return;g&&c();for(var v=0;v=t.display.viewTo||o.line=t.display.viewFrom&&rs(t,i)||{node:s[0].measure.map[2],offset:0},c=o.liner.firstLine()&&(l=ut(l.line-1,tt(r.doc,l.line-1).length)),a.ch==tt(r.doc,a.line).text.length&&a.linei.viewTo-1)return!1;l.line==i.viewFrom||0==(e=Br(r,l.line))?(t=ot(i.view[0].line),n=i.view[0].node):(t=ot(i.view[e].line),n=i.view[e-1].node.nextSibling);var s,u,c=Br(r,a.line);if(c==i.view.length-1?(s=i.viewTo-1,u=i.lineDiv.lastChild):(s=ot(i.view[c+1].line)-1,u=i.view[c+1].node.previousSibling),!n)return!1;var f=r.doc.splitLines(ls(r,n,u,t,s)),h=nt(r.doc,ut(t,0),ut(s,tt(r.doc,s).text.length));while(f.length>1&&h.length>1)if(ee(f)==ee(h))f.pop(),h.pop(),s--;else{if(f[0]!=h[0])break;f.shift(),h.shift(),t++}var d=0,p=0,g=f[0],v=h[0],m=Math.min(g.length,v.length);while(dl.ch&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1))d--,p++;f[f.length-1]=y.slice(0,y.length-p).replace(/^\u200b+/,""),f[0]=f[0].slice(d).replace(/\u200b+$/,"");var x=ut(t,d),C=ut(s,h.length?ee(h).length-p:0);return f.length>1||f[0]||ct(x,C)?(sl(r.doc,f,x,C,"+input"),!0):void 0},ns.prototype.ensurePolled=function(){this.forceCompositionEnd()},ns.prototype.reset=function(){this.forceCompositionEnd()},ns.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},ns.prototype.readFromDOMSoon=function(){var e=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout((function(){if(e.readDOMTimeout=null,e.composing){if(!e.composing.done)return;e.composing=null}e.updateFromDOM()}),80))},ns.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||Hi(this.cm,(function(){return Gr(e.cm)}))},ns.prototype.setUneditable=function(e){e.contentEditable="false"},ns.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||Pi(this.cm,Xa)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},ns.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},ns.prototype.onContextMenu=function(){},ns.prototype.resetPosition=function(){},ns.prototype.needsContentAttribute=!0;var us=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new V,this.hasSelection=!1,this.composing=null,this.resetting=!1};function cs(e,t){if(t=t?U(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),null==t.autofocus){var n=F(z(e));t.autofocus=n==e||null!=e.getAttribute("autofocus")&&n==document.body}function r(){e.value=a.getValue()}var i;if(e.form&&(be(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var o=e.form;i=o.submit;try{var l=o.submit=function(){r(),o.submit=i,o.submit(),o.submit=l}}catch(s){}}t.finishInit=function(n){n.save=r,n.getTextArea=function(){return e},n.toTextArea=function(){n.toTextArea=isNaN,r(),e.parentNode.removeChild(n.getWrapperElement()),e.style.display="",e.form&&(xe(e.form,"submit",r),t.leaveSubmitMethodAlone||"function"!=typeof e.form.submit||(e.form.submit=i))}},e.style.display="none";var a=Ga((function(t){return e.parentNode.insertBefore(t,e.nextSibling)}),t);return a}function fs(e){e.off=xe,e.on=be,e.wheelEventPixels=lo,e.Doc=Ml,e.splitLines=Ie,e.countColumn=_,e.findColumn=Z,e.isWordChar=le,e.Pass=X,e.signal=Ce,e.Line=dn,e.changeEnd=ho,e.scrollbarModel=ki,e.Pos=ut,e.cmpPos=ct,e.modes=_e,e.mimeModes=Ve,e.resolveMode=Xe,e.getMode=$e,e.modeExtensions=Ye,e.extendMode=qe,e.copyState=Ze,e.startState=Qe,e.innerMode=Je,e.commands=ta,e.keyMap=Ul,e.keyName=$l,e.isModifierKey=Kl,e.lookupKey=jl,e.normalizeKeyMap=Vl,e.StringStream=et,e.SharedTextMarker=xl,e.TextMarker=bl,e.LineWidget=gl,e.e_preventDefault=Me,e.e_stopPropagation=Oe,e.e_stop=Ae,e.addClass=E,e.contains=W,e.rmClass=M,e.keyNames=Il}us.prototype.init=function(e){var t=this,n=this,r=this.cm;this.createField(e);var i=this.textarea;function o(e){if(!Se(r,e)){if(r.somethingSelected())Ka({lineWise:!1,text:r.getSelections()});else{if(!r.options.lineWiseCopyCut)return;var t=qa(r);Ka({lineWise:!0,text:t.text}),"cut"==e.type?r.setSelections(t.ranges,null,$):(n.prevInput="",i.value=t.text.join("\n"),P(i))}"cut"==e.type&&(r.state.cutIncoming=+new Date)}}e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),v&&(i.style.width="0px"),be(i,"input",(function(){l&&a>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()})),be(i,"paste",(function(e){Se(r,e)||$a(e,r)||(r.state.pasteIncoming=+new Date,n.fastPoll())})),be(i,"cut",o),be(i,"copy",o),be(e.scroller,"paste",(function(t){if(!$n(e,t)&&!Se(r,t)){if(!i.dispatchEvent)return r.state.pasteIncoming=+new Date,void n.focus();var o=new Event("paste");o.clipboardData=t.clipboardData,i.dispatchEvent(o)}})),be(e.lineSpace,"selectstart",(function(t){$n(e,t)||Me(t)})),be(i,"compositionstart",(function(){var e=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:e,range:r.markText(e,r.getCursor("to"),{className:"CodeMirror-composing"})}})),be(i,"compositionend",(function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)}))},us.prototype.createField=function(e){this.wrapper=Ja(),this.textarea=this.wrapper.firstChild;var t=this.cm.options;Za(this.textarea,t.spellcheck,t.autocorrect,t.autocapitalize)},us.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},us.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=$r(e);if(e.options.moveInputWithCursor){var i=Sr(e,n.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),l=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+l.top-o.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+l.left-o.left))}return r},us.prototype.showSelection=function(e){var t=this.cm,n=t.display;N(n.cursorDiv,e.cursors),N(n.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},us.prototype.reset=function(e){if(!(this.contextMenuPending||this.composing&&e)){var t=this.cm;if(this.resetting=!0,t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&P(this.textarea),l&&a>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",l&&a>=9&&(this.hasSelection=null));this.resetting=!1}},us.prototype.getField=function(){return this.textarea},us.prototype.supportsTouch=function(){return!1},us.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!y||F(z(this.textarea))!=this.textarea))try{this.textarea.focus()}catch(e){}},us.prototype.blur=function(){this.textarea.blur()},us.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},us.prototype.receivedFocus=function(){this.slowPoll()},us.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,(function(){e.poll(),e.cm.state.focused&&e.slowPoll()}))},us.prototype.fastPoll=function(){var e=!1,t=this;function n(){var r=t.poll();r||e?(t.pollingFast=!1,t.slowPoll()):(e=!0,t.polling.set(60,n))}t.pollingFast=!0,t.polling.set(20,n)},us.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||this.resetting||!t.state.focused||ze(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(l&&a>=9&&this.hasSelection===i||b&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var o=i.charCodeAt(0);if(8203!=o||r||(r="​"),8666==o)return this.reset(),this.cm.execCommand("undo")}var s=0,u=Math.min(r.length,i.length);while(s1e3||i.indexOf("\n")>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))})),!0},us.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},us.prototype.onKeyPress=function(){l&&a>=9&&(this.hasSelection=null),this.fastPoll()},us.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var o=zr(n,e),u=r.scroller.scrollTop;if(o&&!h){var c=n.options.resetSelectionOnContextMenu;c&&-1==n.doc.sel.contains(o)&&Pi(n,Ko)(n.doc,fo(o),$);var f,d=i.style.cssText,p=t.wrapper.style.cssText,g=t.wrapper.offsetParent.getBoundingClientRect();if(t.wrapper.style.cssText="position: static",i.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-g.top-5)+"px; left: "+(e.clientX-g.left-5)+"px;\n z-index: 1000; background: "+(l?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",s&&(f=i.ownerDocument.defaultView.scrollY),r.input.focus(),s&&i.ownerDocument.defaultView.scrollTo(null,f),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=y,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll),l&&a>=9&&m(),k){Ae(e);var v=function(){xe(window,"mouseup",v),setTimeout(y,20)};be(window,"mouseup",v)}else setTimeout(y,50)}function m(){if(null!=i.selectionStart){var e=n.somethingSelected(),o="​"+(e?i.value:"");i.value="⇚",i.value=o,t.prevInput=e?"":"​",i.selectionStart=1,i.selectionEnd=o.length,r.selForContextMenu=n.doc.sel}}function y(){if(t.contextMenuPending==y&&(t.contextMenuPending=!1,t.wrapper.style.cssText=p,i.style.cssText=d,l&&a<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=u),null!=i.selectionStart)){(!l||l&&a<9)&&m();var e=0,o=function(){r.selForContextMenu==n.doc.sel&&0==i.selectionStart&&i.selectionEnd>0&&"​"==t.prevInput?Pi(n,el)(n):e++<10?r.detectingSelectAll=setTimeout(o,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(o,200)}}},us.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e,this.textarea.readOnly=!!e},us.prototype.setUneditable=function(){},us.prototype.needsContentAttribute=!1,Ia(Ga),Qa(Ga);var hs="iter insert remove copy getEditor constructor".split(" ");for(var ds in Ml.prototype)Ml.prototype.hasOwnProperty(ds)&&j(hs,ds)<0&&(Ga.prototype[ds]=function(e){return function(){return e.apply(this.doc,arguments)}}(Ml.prototype[ds]));return Te(Ml),Ga.inputStyles={textarea:us,contenteditable:ns},Ga.defineMode=function(e){Ga.defaults.mode||"null"==e||(Ga.defaults.mode=e),je.apply(this,arguments)},Ga.defineMIME=Ke,Ga.defineMode("null",(function(){return{token:function(e){return e.skipToEnd()}}})),Ga.defineMIME("text/plain","null"),Ga.defineExtension=function(e,t){Ga.prototype[e]=t},Ga.defineDocExtension=function(e,t){Ml.prototype[e]=t},Ga.fromTextArea=cs,fs(Ga),Ga.version="5.65.20",Ga}))},"577e":function(e,t,n){"use strict";var r=n("f5df"),i=String;e.exports=function(e){if("Symbol"===r(e))throw new TypeError("Cannot convert a Symbol value to a string");return i(e)}},"697e":function(e,t,n){},8822:function(e,t,n){(function(e){e(n("56b3"))})((function(e){"use strict";var t="CodeMirror-lint-markers",n="CodeMirror-lint-line-";function r(t,n,r){var i=document.createElement("div");function o(t){if(!i.parentNode)return e.off(document,"mousemove",o);var n=Math.max(0,t.clientY-i.offsetHeight-5),r=Math.max(0,Math.min(t.clientX+5,i.ownerDocument.defaultView.innerWidth-i.offsetWidth));i.style.top=n+"px",i.style.left=r+"px"}return i.className="CodeMirror-lint-tooltip cm-s-"+t.options.theme,i.appendChild(r.cloneNode(!0)),t.state.lint.options.selfContain?t.getWrapperElement().appendChild(i):document.body.appendChild(i),e.on(document,"mousemove",o),o(n),null!=i.style.opacity&&(i.style.opacity=1),i}function i(e){e.parentNode&&e.parentNode.removeChild(e)}function o(e){e.parentNode&&(null==e.style.opacity&&i(e),e.style.opacity=0,setTimeout((function(){i(e)}),600))}function l(t,n,i,l){var a=r(t,n,i);function s(){e.off(l,"mouseout",s),a&&(o(a),a=null)}var u=setInterval((function(){if(a)for(var e=l;;e=e.parentNode){if(e&&11==e.nodeType&&(e=e.host),e==document.body)return;if(!e){s();break}}if(!a)return clearInterval(u)}),400);e.on(l,"mouseout",s)}function a(e,t,n){for(var r in this.marked=[],t instanceof Function&&(t={getAnnotations:t}),t&&!0!==t||(t={}),this.options={},this.linterOptions=t.options||{},s)this.options[r]=s[r];for(var r in t)s.hasOwnProperty(r)?null!=t[r]&&(this.options[r]=t[r]):t.options||(this.linterOptions[r]=t[r]);this.timeout=null,this.hasGutter=n,this.onMouseOver=function(t){w(e,t)},this.waitingFor=0}var s={highlightLines:!1,tooltips:!0,delay:500,lintOnChange:!0,getAnnotations:null,async:!1,selfContain:null,formatAnnotation:null,onUpdateLinting:null};function u(e){var n=e.state.lint;n.hasGutter&&e.clearGutter(t),n.options.highlightLines&&c(e);for(var r=0;r1,o.tooltips)),o.highlightLines&&e.addLineClass(a,"wrap",n+c)}}o.onUpdateLinting&&o.onUpdateLinting(r,l,e)}}function y(e){var t=e.state.lint;t&&(clearTimeout(t.timeout),t.timeout=setTimeout((function(){v(e)}),t.options.delay))}function b(e,t,n){for(var r=n.target||n.srcElement,i=document.createDocumentFragment(),o=0;o=u){if(h&&a&&h.test(a.className))return;r=o(l.indicatorOpen)}}(r||a)&&e.setGutterMarker(n,l.gutter,r)}))}function a(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}function s(e){var t=e.getViewport(),n=e.state.foldGutter;n&&(e.operation((function(){l(e,t.from,t.to)})),n.from=t.from,n.to=t.to)}function u(e,n,r){var o=e.state.foldGutter;if(o){var l=o.options;if(r==l.gutter){var a=i(e,n);a?a.clear():e.foldCode(t(n,0),l)}}}function c(e,t){"mode"==t&&f(e)}function f(e){var t=e.state.foldGutter;if(t){var n=t.options;t.from=t.to=0,clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout((function(){s(e)}),n.foldOnChangeTimeSpan||600)}}function h(e){var t=e.state.foldGutter;if(t){var n=t.options;clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout((function(){var n=e.getViewport();t.from==t.to||n.from-t.to>20||t.from-n.to>20?s(e):e.operation((function(){n.fromt.to&&(l(e,t.to,n.to),t.to=n.to)}))}),n.updateViewportTimeSpan||400)}}function d(e,t){var n=e.state.foldGutter;if(n){var r=t.line;r>=n.from&&r(e.headers["hadLoading"],"get"==e.method&&(e.params?e.params["_t"]=(new Date).getTime():e.params={}),e.headers.sessionId=sessionStorage.getItem("access_token")||"",e),e=>Promise.reject(e)),s.interceptors.response.use(e=>{const t=e.data;return t instanceof Blob?e:-1==t.code?(localStorage.removeItem("access_token"),o["Message"].closeAll(),Object(o["Message"])({message:t.msg||t.message||"系统出错",type:"error",duration:1e3,onClose:function(){a["a"].push("/")}}),t):-5==t.code||-25==t.code?(o["Message"].closeAll(),o["Message"].error({message:t.msg})):t},e=>(o["Message"].closeAll(),Object(o["Message"])({message:"网络超时,请稍后重试",type:"error"}),Promise.reject(e))),t["a"]=s},e95a:function(e,t,n){"use strict";var r=n("b622"),i=n("3f8c"),o=r("iterator"),l=Array.prototype;e.exports=function(e){return void 0!==e&&(i.Array===e||l[o]===e)}},f5df:function(e,t,n){"use strict";var r=n("00ee"),i=n("1626"),o=n("c6b6"),l=n("b622"),a=l("toStringTag"),s=Object,u="Arguments"===o(function(){return arguments}()),c=function(e,t){try{return e[t]}catch(n){}};e.exports=r?o:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=c(t=s(e),a))?n:u?o(t):"Object"===(r=o(t))&&i(t.callee)?"Arguments":r}}}]); //# sourceMappingURL=chunk-fb153a9a.260d4091.js.map