'use strict';var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(w,H,F){w instanceof String&&(w=String(w));for(var t=w.length,U=0;Uf||f>=b)return e+(b- d);e+=f-d;e+=c-e%c;d=f+1}}function Q(a,b){for(var c=0;c=b)return d+Math.min(g,b-e);e+=f-d;e+=c-e%c;d=f+1;if(e>=b)return d}}function Mc(a){for(;dc.length<=a;)dc.push(y(dc)+" ");return dc[a]}function y(a){return a[a.length-1]}function ec(a,b){for(var c=[],d=0;dc?0=Math.abs(b-c))return a(b)?b:c;var d=Math.floor((b+c)/2);a(d)?c=d:b=d}}function dg(a,b,c){this.input=c;this.scrollbarFiller=t("div",null,"CodeMirror-scrollbar-filler");this.scrollbarFiller.setAttribute("cm-not-content","true");this.gutterFiller=t("div",null,"CodeMirror-gutter-filler");this.gutterFiller.setAttribute("cm-not-content","true");this.lineDiv=U("div",null,"CodeMirror-code");this.selectionDiv=t("div",null,null,"position: relative; z-index: 1");this.cursorDiv= t("div",null,"CodeMirror-cursors");this.measure=t("div",null,"CodeMirror-measure");this.lineMeasure=t("div",null,"CodeMirror-measure");this.lineSpace=U("div",[this.measure,this.lineMeasure,this.selectionDiv,this.cursorDiv,this.lineDiv],null,"position: relative; outline: none");var d=U("div",[this.lineSpace],"CodeMirror-lines");this.mover=t("div",[d],null,"position: relative");this.sizer=t("div",[this.mover],"CodeMirror-sizer");this.sizerWidth=null;this.heightForcer=t("div",null,null,"position: absolute; height: 30px; width: 1px;"); this.gutters=t("div",null,"CodeMirror-gutters");this.lineGutter=null;this.scroller=t("div",[this.sizer,this.heightForcer,this.gutters],"CodeMirror-scroll");this.scroller.setAttribute("tabIndex","-1");this.wrapper=t("div",[this.scrollbarFiller,this.gutterFiller,this.scroller],"CodeMirror");D&&8>B&&(this.gutters.style.zIndex=-1,this.scroller.style.paddingRight=0);T||xa&&qb||(this.scroller.draggable=!0);a&&(a.appendChild?a.appendChild(this.wrapper):a(this.wrapper));this.reportedViewFrom=this.reportedViewTo= this.viewFrom=this.viewTo=b.first;this.view=[];this.externalMeasured=this.renderedView=null;this.lastWrapHeight=this.lastWrapWidth=this.viewOffset=0;this.updateLineNumbers=null;this.nativeBarWidth=this.barHeight=this.barWidth=0;this.scrollbarsClipped=!1;this.lineNumWidth=this.lineNumInnerWidth=this.lineNumChars=null;this.alignWidgets=!1;this.maxLine=this.cachedCharWidth=this.cachedTextHeight=this.cachedPaddingH=null;this.maxLineLength=0;this.maxLineChanged=!1;this.wheelDX=this.wheelDY=this.wheelStartX= this.wheelStartY=null;this.shift=!1;this.activeTouch=this.selForContextMenu=null;c.init(this)}function u(a,b){b-=a.first;if(0>b||b>=a.size)throw Error("There is no line "+(b+a.first)+" in the document.");for(;!a.lines;)for(var c=0;;++c){var d=a.children[c],e=d.chunkSize();if(b=a.first&&bA(a,b)?b:a}function ic(a,b){return 0>A(a,b)? a:b}function x(a,b){if(b.linec)return r(c,u(a,c).text.length);a=u(a,b.line).text.length;c=b.ch;b=null==c||c>a?r(b.line,a):0>c?r(b.line,0):b;return b}function Ud(a,b){for(var c=[],d=0;d=a:k.to>a);(g||(g=[])).push(new jc(l,k.from,m?null:k.to))}}var c=g,p;if(d)for(g=0;g=e:h.to>e)||h.from==e&& "bookmark"==k.type&&(!f||h.marker.insertLeft))l=null==h.from||(k.inclusiveLeft?h.from<=e:h.fromA(g.to,e.from)||0k||!c.inclusiveLeft&&!k)&&h.push({from:g.from,to:e.from});(0Yd(e,c.marker)))var e= c.marker;return e}function Zd(a,b,c,d,e){a=u(a,b);if(a=ya&&a.markedSpans)for(b=0;b=k||0>=h&&0<=k)&&(0>=h&&(f.marker.inclusiveRight&&e.inclusiveLeft?0<=A(g.to,c):0=A(g.from,d):0>A(g.from,d))))return!0}}}function na(a){for(var b;b= Ja(a,!0);)a=b.find(-1,!0).line;return a}function Uc(a,b){a=u(a,b);var c=na(a);return a==c?b:E(c)}function $d(a,b){if(b>a.lastLine())return b;var c=u(a,b);if(!Ka(a,c))return b;for(;a=Ja(c,!1);)c=a.find(1,!0).line;return E(c)+1}function Ka(a,b){var c=ya&&b.markedSpans;if(c)for(var d,e=0;eb.maxLineLength&&(b.maxLineLength=d,b.maxLine=a)})}function fg(a,b,c,d){if(!a)return d(b,c,"ltr");for(var e= !1,f=0;fb||b==c&&g.to==b)d(Math.max(g.from,b),Math.min(g.to,c),1==g.level?"rtl":"ltr"),e=!0}e||d(b,c,"ltr")}function Xc(a,b,c){var d;tb=null;for(var e=0;eb)return e;f.to==b&&(f.from!=f.to&&"before"==c?d=e:tb=e);f.from==b&&(f.from!=f.to&&"before"!=c?d=e:tb=e)}return null!=d?d:tb}function za(a,b){var c=a.order;null==c&&(c=a.order=gg(a.text,b));return c}function Yc(a,b,c){b=Td(a.text,b+c,c);return 0>b||b>a.text.length? null:b}function Zc(a,b,c){a=Yc(a,b.ch,c);return null==a?null:new r(b.line,a,0>c?"after":"before")}function $c(a,b,c,d,e){if(a&&(a=za(c,b.doc.direction))){a=0>e?y(a):a[0];var f=0>e==(1==a.level)?"after":"before";if(0e?c.text.length-1:0;var k=sa(b,g,h).top;h=gc(function(a){return sa(b,g,a).top==k},0>e==(1==a.level)?a.from:a.to-1,h);"before"==f&&(h=Yc(c,h,1))}else h=0>e?a.to:a.from;return new r(d,h,f)}return new r(d,0>e?c.text.length:0,0>e?"before":"after")}function ae(a, b,c,d){var e=za(b,a.doc.direction);if(!e)return Zc(b,c,d);c.ch>=b.text.length?(c.ch=b.text.length,c.sticky="before"):0>=c.ch&&(c.ch=0,c.sticky="after");var f=Xc(e,c.ch,c.sticky),g=e[f];if("ltr"==a.doc.direction&&0==g.level%2&&(0c.ch:g.fromd,n=h(c,p?1:-1);if(null!=n&&(p?n<=g.to&&n<=m.end:n>=g.from&&n>=m.begin))return new r(c.line,n,p?"before":"after")}g=function(a,b,d){for(var f=function(a,b){return b?new r(c.line,h(a,1),"before"):new r(c.line,a,"after")};0<=a&&a=b.offsetWidth&&2B))}a=bd?t("span","\u200b"):t("span","\u00a0",null,"display: inline-block; width: 1px; margin-right: -1px"); a.setAttribute("cm-text","");return a}function ig(a,b){2a&&e.splice(h,1,a,e[h+1],c);h+=2;k=Math.min(a,c)}if(b)if(g.opaque)e.splice(d,h-d,a,"overlay "+b),h=d+2;else for(;da.options.maxHighlightLength&&Ma(a.doc.mode,d.state),f=ge(a,b,d);e&&(d.state=e);b.stateAfter=d.save(!e);b.styles= f.styles;f.classes?b.styleClasses=f.classes:b.styleClasses&&(b.styleClasses=null);c===a.doc.highlightFrontier&&(a.doc.modeFrontier=Math.max(a.doc.modeFrontier,++a.doc.highlightFrontier))}return b.styles}function vb(a,b,c){var d=a.doc,e=a.display;if(!d.mode.startState)return new ta(d,!0,b);var f=kg(a,b,c),g=f>d.first&&u(d,f-1).stateAfter,h=g?ta.fromSaved(d,g,f):new ta(d,fe(d.mode),f);d.iter(f,b,function(d){fd(a,d.text,h);var c=h.line;d.stateAfter=c==b-1||0==c%5||c>=e.viewFrom&&ce;e++){d&&(d[0]=ed(a,c).mode);var f=a.token(b,c);if(b.pos>b.start)return f}throw Error("Mode "+a.name+" failed to advance stream."); }function ke(a,b,c,d){var e=a.doc,f=e.mode;b=x(e,b);var g=u(e,b.line);c=vb(a,b.line,c);a=new L(g.text,a.options.tabSize,c);var h;for(d&&(h=[]);(d||a.posa.options.maxHighlightLength){h=!1;g&&fd(a,b,d,m.pos);m.pos=b.length;var n=null}else n=me(gd(c,m,d.state,p),f);if(p){var q=p[0].name;q&&(n="m-"+(n?q+" "+n:q))}if(!h||l!=n){for(;kg;--b){if(b<=f.first)return f.first;var h=u(f,b-1),k=h.stateAfter;if(k&&(!c||b+(k instanceof nc?k.lookAhead:0)<=f.modeFrontier))return b;h=fa(h.text,null,a.options.tabSize);if(null==e||d>h)e=b-1,d=h}return e}function lg(a,b){a.modeFrontier=Math.min(a.modeFrontier,b);if(!(a.highlightFrontierc;d--){var e=u(a,d).stateAfter;if(e&&(!(e instanceof nc)|| d+e.lookAheadh.right-k.right:!1}g&&(f=za(e,a.doc.direction))&&(c.addToken=pg(c.addToken,f));c.map=[];var l=b!=a.display.externalMeasured&&E(e);a:{var m=h=k=g=void 0,p=void 0,n=void 0,q=void 0,f=c,l=ie(a,e,l),r=e.markedSpans,t=e.text,u=0;if(r)for(var v=t.length,K=0,A=1,x="",w=0;;){if(w==K){p=m=h= k=n="";g=null;for(var w=Infinity,ua=[],y=void 0,C=0;CK||B.collapsed&&z.to==K&&z.from==K)?(null!=z.to&&z.to!=K&&w>z.to&&(w=z.to,m=""),B.className&&(p+=" "+B.className),B.css&&(n=(n?n+";":"")+B.css),B.startStyle&&z.from==K&&(h+=" "+B.startStyle),B.endStyle&&z.to==w&&(y||(y=[])).push(B.endStyle,z.to),B.title&&!k&&(k=B.title),B.collapsed&&(!g||0>Yd(g.marker,B))&&(g=z)):z.from>K&&w> z.from&&(w=z.from)}if(y)for(C=0;C=v)break;for(ua=Math.min(v,w);;){if(x){y=K+x.length;g||(C=y>ua?x.slice(0,ua-K):x,f.addToken(f,C,q?q+p:p,h,K+C.length==w?m:"",k,n));if(y>=ua){x=x.slice(ua-K);K=ua;break}K=y;h=""}x=t.slice(u,u=l[A++]);q=ne(l[A++],f.cm.options)}}else for(g=1;gB?h.appendChild(t("span",[r])):h.appendChild(r);a.map.push(a.pos,a.pos+q,r);a.col+=q;a.pos+=q}if(!n)break;p+=q+1;"\t"==n[0]?(n=a.cm.options.tabSize,n-=a.col%n,q=h.appendChild(t("span",Mc(n),"cm-tab")), q.setAttribute("role","presentation"),q.setAttribute("cm-text","\t"),a.col+=n):("\r"==n[0]||"\n"==n[0]?(q=h.appendChild(t("span","\r"==n[0]?"\u240d":"\u2424","cm-invalidchar")),q.setAttribute("cm-text",n[0])):(q=a.cm.options.specialCharPlaceholder(n[0]),q.setAttribute("cm-text",n[0]),D&&9>B?h.appendChild(t("span",[q])):h.appendChild(q)),a.col+=1);a.map.push(a.pos,a.pos+1,q);a.pos++}}else a.col+=b.length,h=document.createTextNode(k),a.map.push(a.pos,a.pos+b.length,h),D&&9>B&&(m=!0),a.pos+=b.length; a.trailingSpace=32==k.charCodeAt(b.length-1);if(c||d||e||m||g)return b=c||"",d&&(b+=d),e&&(b+=e),d=t("span",[h],b,g),f&&(d.title=f),a.content.appendChild(d);a.content.appendChild(h)}}function pg(a,b){return function(c,d,e,f,g,h,k){e=e?e+" cm-force-border":"cm-force-border";for(var l=c.pos,m=l+d.length;;){for(var p=void 0,n=0;nl&&p.from<=l);n++);if(p.to>=m)return a(c,d,e,f,g,h,k);a(c,d.slice(0,p.to-l),e,f,null,h,k);f=null;d=d.slice(p.to-l);l=p.to}}}function pe(a,b,c,d){var e= !d&&c.widgetNode;e&&a.map.push(a.pos,a.pos+b,e);!d&&a.cm.display.input.needsContentAttribute&&(e||(e=a.content.appendChild(document.createElement("span"))),e.setAttribute("cm-marker",c.id));e&&(a.cm.display.input.setUneditable(e),a.content.appendChild(e));a.pos+=b;a.trailingSpace=!1}function qe(a,b,c){for(var d=this.line=b,e;d=Ja(d,!1);)d=d.find(1,!0).line,(e||(e=[])).push(d);this.size=(this.rest=e)?E(y(this.rest))-c+1:1;this.node=this.text=null;this.hidden=Ka(a,b)}function oc(a,b,c){var d=[],e;for(e= b;eB&&(a.node.style.zIndex=2));return a.node}function se(a,b){var c=a.display.externalMeasured;return c&&c.line==b.line?(a.display.externalMeasured=null,b.measure=c.measure,c.built):oe(a,b)}function id(a,b){var c=b.bgClass?b.bgClass+" "+(b.line.bgClass||""):b.line.bgClass;c&&(c+=" CodeMirror-linebackground");if(b.background)c?b.background.className=c:(b.background.parentNode.removeChild(b.background),b.background=null);else if(c){var d=yb(b);b.background=d.insertBefore(t("div",null,c),d.firstChild); a.display.input.setUneditable(b.background)}b.line.wrapClass?yb(b).className=b.line.wrapClass:b.node!=b.text&&(b.node.className="");b.text.className=(b.textClass?b.textClass+" "+(b.line.textClass||""):b.line.textClass)||""}function te(a,b,c,d){b.gutter&&(b.node.removeChild(b.gutter),b.gutter=null);b.gutterBackground&&(b.node.removeChild(b.gutterBackground),b.gutterBackground=null);if(b.line.gutterClass){var e=yb(b);b.gutterBackground=t("div",null,"CodeMirror-gutter-background "+b.line.gutterClass, "left: "+(a.options.fixedGutter?d.fixedPos:-d.gutterTotalWidth)+"px; width: "+d.gutterTotalWidth+"px");a.display.input.setUneditable(b.gutterBackground);e.insertBefore(b.gutterBackground,b.text)}e=b.line.gutterMarkers;if(a.options.lineNumbers||e){var f=yb(b),g=b.gutter=t("div",null,"CodeMirror-gutter-wrapper","left: "+(a.options.fixedGutter?d.fixedPos:-d.gutterTotalWidth)+"px");a.display.input.setUneditable(g);f.insertBefore(g,b.text);b.line.gutterClass&&(g.className+=" "+b.line.gutterClass);!a.options.lineNumbers|| e&&e["CodeMirror-linenumbers"]||(b.lineNumber=g.appendChild(t("div",Qc(a.options,c),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+d.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+a.display.lineNumInnerWidth+"px")));if(e)for(b=0;bc)return{map:a.measure.maps[b],cache:a.measure.caches[b],before:!0}}function ld(a,b){if(b>=a.display.viewFrom&&b=a.lineN&&bn;n++){for(;h&&Oc(b.line.text.charAt(g.coverStart+h));)--h;for(;g.coverStart+kB&&0==h&&k==g.coverEnd-g.coverStart)var q= d.parentNode.getBoundingClientRect();else{q=wb(d,h,k).getClientRects();k=ze;if("left"==m)for(l=0;lB&&((n=!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI)||(null!=nd?n=nd:(m=F(a.display.measure,t("span","x")),n=m.getBoundingClientRect(),m=wb(m,0,1).getBoundingClientRect(),n=nd=1B)||h||q&&(q.left||q.right)||(q=(q=d.parentNode.getClientRects()[0])?{left:q.left,right:q.left+Ab(a.display),top:q.top,bottom:q.bottom}:ze);d=q.top-b.rect.top;h=q.bottom-b.rect.top;n=(d+h)/2;m=b.view.measure.heights;for(g= 0;gb)f=k-h,e=f-1,b>=k&&(g="right");if(null!=e){d=a[l+2];h==k&&c==(d.insertLeft?"left":"right")&&(g=c);if("left"==c&&0==e)for(;l&&a[l-2]==a[l-3]&&a[l-1].insertLeft;)d=a[(l-=3)+2],g="left";if("right"==c&&e==k-h)for(;l=d.text.length?(l=d.text.length,b="before"):0>=l&&(l=0,b="after");if(!k)return g("before"==b?l-1:l,"before"==b);var m=Xc(k,l,b),p=tb,m=h(l,m,"before"==b);null!=p&&(m.other=h(l,p,"before"!=b));return m}function Fe(a,b){var c=0;b=x(a.doc,b);a.options.lineWrapping||(c=Ab(a.display)*b.ch); b=u(a.doc,b.line);a=oa(b)+a.display.lineSpace.offsetTop;return{left:c,right:c,top:a,bottom:a+b.height}}function od(a,b,c){var d=a.doc;c+=a.display.viewOffset;if(0>c)return a=r(d.first,0,null),a.xRel=-1,a.outside=!0,a;var e=Ia(d,c),f=d.first+d.size-1;if(e>f)return a=u(d,f).text.length,a=r(d.first+d.size-1,a,null),a.xRel=1,a.outside=!0,a;0>b&&(b=0);for(f=u(d,e);;)if(d=ug(a,f,e,b,c),f=(e=Ja(f,!1))&&e.find(0,!0),e&&(d.ch>f.from.ch||d.ch==f.from.ch&&0d},f,e);return{begin:f,end:e}}function ug(a,b,c,d,e){e-=oa(b);var f=0,g=b.text.length,h=$a(a,b);if(za(b,a.doc.direction)){if(a.options.lineWrapping){var k=be(a,b,h,e);f=k.begin;g=k.end}c=new r(c,Math.floor(f+(g-f)/2));var l=ja(a,c,"line",b,h).left;k=lm?1:-1)}while(0!=m&&(1k!=0>m&&Math.abs(m)<=Math.abs(l)));if(Math.abs(m)>Math.abs(l)){if(0>m==0>l)throw Error("Broke out of infinite loop in coordsCharInner");c=n}}else f=gc(function(c){var f=La(a,b,sa(a,h,c),"line");return f.top>e?(g=Math.min(c,g),!0):f.bottom<=e?!1:f.left>d?!0:f.rightf.right?1:0;return c}function Pa(a){if(null!=a.cachedTextHeight)return a.cachedTextHeight;if(null==Qa){Qa=t("pre");for(var b=0;49>b;++b)Qa.appendChild(document.createTextNode("x")),Qa.appendChild(t("br"));Qa.appendChild(document.createTextNode("x"))}F(a.measure,Qa);b=Qa.offsetHeight/50;3=a.display.viewTo)return null;b-=a.display.viewFrom;if(0>b)return null;a=a.display.view;for(var c=0;cb)return c}function Cb(a){a.display.input.showSelection(a.display.input.prepareSelection())}function He(a,b){for(var c=a.doc,d={},e=d.cursors=document.createDocumentFragment(),f=d.selection=document.createDocumentFragment(),g=0;g=a.display.viewTo||h.to().line b&&(b=0);b=Math.round(b);c=Math.round(c);h.appendChild(t("div",null,"CodeMirror-selected","position: absolute; left: "+a+"px;\n top: "+b+"px; width: "+(null==d?m-a:d)+"px;\n height: "+(c-b)+"px"))}function e(b,c,e){var f=u(g,b),h=f.text.length,k,n;fg(za(f,g.direction),c||0,null==e?h:e,function(g,p,q){var I=rc(a,r(b,g),"div",f,"left"),t;if(g==p){var u=I;q=t=I.left}else u=rc(a,r(b,p-1),"div",f,"right"),"rtl"==q&&(q=I,I=u,u=q),q=I.left,t=u.right; null==c&&0==g&&(q=l);3n.bottom||u.bottom==n.bottom&&u.right>n.right)n=u;qa.options.cursorBlinkRate&&(b.cursorDiv.style.visibility="hidden")}}function Je(a){a.state.focused||(a.display.input.focus(),sd(a))}function Ke(a){a.state.delayingBlurEvent=!0;setTimeout(function(){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1,Db(a))},100)}function sd(a,b){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1);"nocursor"!=a.options.readOnly&&(a.state.focused||(J(a,"focus",a,b),a.state.focused=!0,Fa(a.display.wrapper,"CodeMirror-focused"), a.curOp||a.display.selForContextMenu==a.doc.sel||(a.display.input.reset(),T&&setTimeout(function(){return a.display.input.reset(!0)},20)),a.display.input.receivedFocus()),rd(a))}function Db(a,b){a.state.delayingBlurEvent||(a.state.focused&&(J(a,"blur",a,b),a.state.focused=!1,Sa(a.display.wrapper,"CodeMirror-focused")),clearInterval(a.display.blinker),setTimeout(function(){a.state.focused||(a.display.shift=!1)},150))}function sc(a){a=a.display;for(var b=a.lineDiv.offsetTop,c=0;cB){var e=d.node.offsetTop+d.node.offsetHeight;var f=e-b;b=e}else f=d.node.getBoundingClientRect(),f=f.bottom-f.top;e=d.line.height-f;2>f&&(f=Pa(a));if(.005e)if(ma(d.line,f),Le(d.line),d.rest)for(f=0;f=e&&(d=Ia(b,oa(u(b,c))-a.wrapper.clientHeight),e=c)}return{from:d,to:Math.max(e,d+1)}}function Me(a){var b=a.display,c=b.view;if(b.alignWidgets||b.gutters.firstChild&&a.options.fixedGutter){for(var d=pd(b)-b.scroller.scrollLeft+a.doc.scrollLeft,e=b.gutters.offsetWidth,f=d+"px",g=0;gb.top&&(b.top=0);var e=a.curOp&&null!=a.curOp.scrollTop?a.curOp.scrollTop:c.scroller.scrollTop,f=kd(a),g={};b.bottom-b.top>f&&(b.bottom=b.top+f);var h=a.doc.height+jd(c),k=b.toph-d;b.tope+f&&(f=Math.min(b.top,(d?h:b.bottom)-f),f!=e&&(g.scrollTop=f));e=a.curOp&&null!=a.curOp.scrollLeft?a.curOp.scrollLeft:c.scroller.scrollLeft;a=Na(a)-(a.options.fixedGutter?c.gutters.offsetWidth:0);if(c=b.right-b.left>a)b.right=b.left+a;10>b.left?g.scrollLeft=0:b.lefta+e-3&&(g.scrollLeft=b.right+(c?0:10)-a);return g}function tc(a,b){null!=b&&(uc(a),a.curOp.scrollTop=(null==a.curOp.scrollTop?a.doc.scrollTop:a.curOp.scrollTop)+b)} function eb(a){uc(a);var b=a.getCursor();a.curOp.scrollToPos={from:b,to:b,margin:a.options.cursorScrollMargin}}function Eb(a,b,c){null==b&&null==c||uc(a);null!=b&&(a.curOp.scrollLeft=b);null!=c&&(a.curOp.scrollTop=c)}function uc(a){var b=a.curOp.scrollToPos;if(b){a.curOp.scrollToPos=null;var c=Fe(a,b.from),d=Fe(a,b.to);Oe(a,c,d,b.margin)}}function Oe(a,b,c,d){b=vd(a,{left:Math.min(b.left,c.left),top:Math.min(b.top,c.top)-d,right:Math.max(b.right,c.right),bottom:Math.max(b.bottom,c.bottom)+d});Eb(a, b.scrollLeft,b.scrollTop)}function Fb(a,b){2>Math.abs(a.doc.scrollTop-b)||(xa||wd(a,{top:b}),Pe(a,b,!0),xa&&wd(a),Gb(a,100))}function Pe(a,b,c){b=Math.min(a.display.scroller.scrollHeight-a.display.scroller.clientHeight,b);if(a.display.scroller.scrollTop!=b||c)a.doc.scrollTop=b,a.display.scrollbars.setScrollTop(b),a.display.scroller.scrollTop!=b&&(a.display.scroller.scrollTop=b)}function Ta(a,b,c,d){b=Math.min(b,a.display.scroller.scrollWidth-a.display.scroller.clientWidth);(c?b==a.doc.scrollLeft: 2>Math.abs(a.doc.scrollLeft-b))&&!d||(a.doc.scrollLeft=b,Me(a),a.display.scroller.scrollLeft!=b&&(a.display.scroller.scrollLeft=b),a.display.scrollbars.setScrollLeft(b))}function Hb(a){var b=a.display,c=b.gutters.offsetWidth,d=Math.round(a.doc.height+jd(a.display));return{clientHeight:b.scroller.clientHeight,viewHeight:b.wrapper.clientHeight,scrollWidth:b.scroller.scrollWidth,clientWidth:b.scroller.clientWidth,viewWidth:b.wrapper.clientWidth,barLeft:a.options.fixedGutter?c:0,docHeight:d,scrollHeight:d+ pa(a)+b.barHeight,nativeBarWidth:b.nativeBarWidth,gutterWidth:c}}function fb(a,b){b||(b=Hb(a));var c=a.display.barWidth,d=a.display.barHeight;Qe(a,b);for(b=0;4>b&&c!=a.display.barWidth||d!=a.display.barHeight;b++)c!=a.display.barWidth&&a.options.lineWrapping&&sc(a),Qe(a,Hb(a)),c=a.display.barWidth,d=a.display.barHeight}function Qe(a,b){var c=a.display,d=c.scrollbars.update(b);c.sizer.style.paddingRight=(c.barWidth=d.right)+"px";c.sizer.style.paddingBottom=(c.barHeight=d.bottom)+"px";c.heightForcer.style.borderBottom= d.bottom+"px solid transparent";d.right&&d.bottom?(c.scrollbarFiller.style.display="block",c.scrollbarFiller.style.height=d.bottom+"px",c.scrollbarFiller.style.width=d.right+"px"):c.scrollbarFiller.style.display="";d.bottom&&a.options.coverGutterNextToScrollbar&&a.options.fixedGutter?(c.gutterFiller.style.display="block",c.gutterFiller.style.height=d.bottom+"px",c.gutterFiller.style.width=b.gutterWidth+"px"):c.gutterFiller.style.display=""}function Re(a){a.display.scrollbars&&(a.display.scrollbars.clear(), a.display.scrollbars.addClass&&Sa(a.display.wrapper,a.display.scrollbars.addClass));a.display.scrollbars=new Se[a.options.scrollbarStyle](function(b){a.display.wrapper.insertBefore(b,a.display.scrollbarFiller);v(b,"mousedown",function(){a.state.focused&&setTimeout(function(){return a.display.input.focus()},0)});b.setAttribute("cm-not-content","true")},function(b,c){"horizontal"==c?Ta(a,b):Fb(a,b)},a);a.display.scrollbars.addClass&&Fa(a.display.wrapper,a.display.scrollbars.addClass)}function Ua(a){a.curOp= {cm:a,viewChanged:!1,startHeight:a.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++wg};a=a.curOp;db?db.ops.push(a):a.ownsGroup=db={ops:[a],delayedCallbacks:[]}}function Va(a){rg(a.curOp,function(a){for(var b=0;b=f.viewTo)||f.maxLineChanged&&e.options.lineWrapping;d.update=d.mustUpdate&&new vc(e,d.mustUpdate&& {top:d.scrollTop,ensure:d.scrollToPos},d.forceUpdate)}for(b=0;bp;p++){var n=!1,h=ja(e,k),q=l&&l!=k?ja(e,l):h,h={left:Math.min(h.left,q.left),top:Math.min(h.top,q.top)-m,right:Math.max(h.left,q.left),bottom:Math.max(h.bottom,q.bottom)+m},q=vd(e,h),I=e.doc.scrollTop,u=e.doc.scrollLeft; null!=q.scrollTop&&(Fb(e,q.scrollTop),1l.top+p.top?k=!0:l.bottom+p.top>(window.innerHeight||document.documentElement.clientHeight)&&(k=!1),null==k||xg||(l=t("div","\u200b",null,"position: absolute;\n top: "+(l.top-m.viewOffset-e.display.lineSpace.offsetTop)+ "px;\n height: "+(l.bottom-l.top+pa(e)+m.barHeight)+"px;\n left: "+l.left+"px; width: "+Math.max(2,l.right-l.left)+"px;"),e.display.lineSpace.appendChild(l),l.scrollIntoView(k),e.display.lineSpace.removeChild(l)))}l=d.maybeHiddenMarkers;k=d.maybeUnhiddenMarkers;if(l)for(m=0;mb)&&(e.updateLineNumbers=b);a.curOp.viewChanged=!0;if(b>=e.viewTo)ya&&Uc(a.doc,b)e.viewFrom?Aa(a):(e.viewFrom+=d,e.viewTo+=d);else if(b<=e.viewFrom&&c>=e.viewTo)Aa(a);else if(b<=e.viewFrom){var f=wc(a,c,c+d,1);f?(e.view= e.view.slice(f.index),e.viewFrom=f.lineN,e.viewTo+=d):Aa(a)}else if(c>=e.viewTo)(f=wc(a,b,b,-1))?(e.view=e.view.slice(0,f.index),e.viewTo=f.lineN):Aa(a);else{var f=wc(a,b,b,-1),g=wc(a,c,c+d,1);f&&g?(e.view=e.view.slice(0,f.index).concat(oc(a,f.lineN,g.lineN)).concat(e.view.slice(g.index)),e.viewTo+=d):Aa(a)}if(a=e.externalMeasured)c=e.lineN&&b< e.lineN+e.size&&(d.externalMeasured=null);b=d.viewTo||(a=d.view[Oa(a,b)],null!=a.node&&(a=a.changes||(a.changes=[]),-1==Q(a,c)&&a.push(c)))}function Aa(a){a.display.viewFrom=a.display.viewTo=a.doc.first;a.display.view=[];a.display.viewOffset=0}function wc(a,b,c,d){var e=Oa(a,b),f=a.display.view;if(!ya||c==a.doc.first+a.doc.size)return{index:e,lineN:c};for(var g=a.display.viewFrom,h=0;hd?0:f.length-1))return null;c+=d*f[e-(0>d?1:0)].size;e+=d}return{index:e,lineN:c}}function Ue(a){a=a.display.view;for(var b=0,c=0;c=a.display.viewTo)){var c=+new Date+a.options.workTime,d=vb(a,b.highlightFrontier),e=[];b.iter(d.line,Math.min(b.first+b.size, a.display.viewTo+500),function(f){if(d.line>=a.display.viewFrom){var g=f.styles,h=f.text.length>a.options.maxHighlightLength?Ma(b.mode,d.state):null,k=ge(a,f,d,!0);h&&(d.state=h);f.styles=k.styles;h=f.styleClasses;(k=k.classes)?f.styleClasses=k:h&&(f.styleClasses=null);k=!g||g.length!=f.styles.length||h!=k&&(!h||!k||h.bgClass!=k.bgClass||h.textClass!=k.textClass);for(h=0;!k&&hc)return Gb(a,a.options.workDelay),!0});b.highlightFrontier=d.line;b.modeFrontier=Math.max(b.modeFrontier,d.line);e.length&&aa(a,function(){for(var b=0;b=c.viewFrom&&b.visible.to<=c.viewTo&&(null==c.updateLineNumbers||c.updateLineNumbers>=c.viewTo)&&c.renderedView==c.view&&0==Ue(a))return!1; Ne(a)&&(Aa(a),b.dims=md(a));var e=d.first+d.size,f=Math.max(b.visible.from-a.options.viewportMargin,d.first),g=Math.min(e,b.visible.to+a.options.viewportMargin);c.viewFromf-c.viewFrom&&(f=Math.max(d.first,c.viewFrom));c.viewTo>g&&20>c.viewTo-g&&(g=Math.min(e,c.viewTo));ya&&(f=Uc(a.doc,f),g=$d(a.doc,g));d=f!=c.viewFrom||g!=c.viewTo||c.lastWrapHeight!=b.wrapperHeight||c.lastWrapWidth!=b.wrapperWidth;e=a.display;0==e.view.length||f>=e.viewTo||g<=e.viewFrom?(e.view=oc(a,f,g),e.viewFrom=f):(e.viewFrom> f?e.view=oc(a,f,e.viewFrom).concat(e.view):e.viewFromg&&(e.view=e.view.slice(0,Oa(a,g))));e.viewTo=g;c.viewOffset=oa(u(a.doc,c.viewFrom));a.display.mover.style.top=c.viewOffset+"px";g=Ue(a);if(!d&&0==g&&!b.force&&c.renderedView==c.view&&(null==c.updateLineNumbers||c.updateLineNumbers>=c.viewTo))return!1;a.hasFocus()?f=null:(f=ra())&&ha(a.display.lineDiv,f)?(f={activeElt:f},window.getSelection&& (e=window.getSelection(),e.anchorNode&&e.extend&&ha(a.display.lineDiv,e.anchorNode)&&(f.anchorNode=e.anchorNode,f.anchorOffset=e.anchorOffset,f.focusNode=e.focusNode,f.focusOffset=e.focusOffset))):f=null;4=a.display.viewFrom&&b.visible.to<=a.display.viewTo)break;if(!xd(a,b))break;sc(a);d=Hb(a);Cb(a);fb(a,d);yd(a,d);b.force=!1}b.signal(a,"update",a);if(a.display.viewFrom!=a.display.reportedViewFrom||a.display.viewTo!=a.display.reportedViewTo)b.signal(a,"viewportChange",a,a.display.viewFrom,a.display.viewTo),a.display.reportedViewFrom=a.display.viewFrom,a.display.reportedViewTo=a.display.viewTo}function wd(a,b){b=new vc(a,b);if(xd(a,b)){sc(a);Te(a,b);var c= Hb(a);Cb(a);fb(a,c);yd(a,c);b.finish()}}function zg(a,b,c){function d(b){var d=b.nextSibling;T&&ia&&a.display.currentWheelTarget==b?b.style.display="none":b.parentNode.removeChild(b);return d}for(var e=a.display,f=a.options.lineNumbers,g=e.lineDiv,h=g.firstChild,k=e.view,e=e.viewFrom,l=0;lf.clientWidth,h=f.scrollHeight>f.clientHeight;if(d&&g||c&&h){if(c&&ia&&T){var g=b.target,k=e.view;a:for(;g!=f;g=g.parentNode)for(var l=0;lb?h=Math.max(0,h+b- 50):g=Math.min(a.doc.height,g+b+50),wd(a,{top:h,bottom:g})),20>xc&&(null==e.wheelStartX?(e.wheelStartX=f.scrollLeft,e.wheelStartY=f.scrollTop,e.wheelDX=d,e.wheelDY=c,setTimeout(function(){if(null!=e.wheelStartX){var a=f.scrollLeft-e.wheelStartX,b=f.scrollTop-e.wheelStartY,a=b&&e.wheelDY&&b/e.wheelDY||a&&e.wheelDX&&a/e.wheelDX;e.wheelStartX=e.wheelStartY=null;a&&(da=(da*xc+a)/(xc+1),++xc)}},200)):(e.wheelDX+=d,e.wheelDY+=c))):(c&&h&&Fb(a,Math.max(0,f.scrollTop+c*da)),Ta(a,Math.max(0,f.scrollLeft+d* da)),(!c||c&&h)&&V(b),e.wheelStartX=null)}}function la(a,b){b=a[b];a.sort(function(a,b){return A(a.from(),b.from())});b=Q(a,b);for(var c=1;cA(a,b.from))return a;if(0>=A(a,b.to))return Ca(b);var c=a.line+b.text.length-(b.to.line-b.from.line)-1,d=a.ch;a.line==b.to.line&&(d+=Ca(b).ch-b.to.ch);return r(c,d)}function Ad(a,b){for(var c=[],d=0;df-a.cm.options.historyEventDelay||"*"==b.origin.charAt(0))){if(e.lastOp==d){df(e.done);var h=y(e.done)}else e.done.length&&!y(e.done).ranges?h=y(e.done):1e.undoDepth;)e.done.shift(),e.done[0].ranges||e.done.shift();e.done.push(c);e.generation=++e.maxGeneration;e.lastModTime=e.lastSelTime=f;e.lastOp=e.lastSelOp=d;e.lastOrigin=e.lastSelOrigin=b.origin;k||J(a,"historyAdded")} function zc(a,b){var c=y(b);c&&c.ranges&&c.equals(a)||b.push(a)}function cf(a,b,c,d){var e=b["spans_"+a.id],f=0;a.iter(Math.max(a.first,c),Math.min(a.first+a.size,d),function(d){d.markedSpans&&((e||(e=b["spans_"+a.id]={}))[f]=d.markedSpans);++f})}function Cg(a){if(!a)return null;for(var b,c=0;cA(b,a),d!=0>A(c,a)?(a=b,b=c):d!=0>A(b,c)&&(b=c)),new C(a,b)):new C(c||b,b)}function Ac(a,b,c,d,e){null==e&&(e=a.cm&&(a.cm.display.shift||a.extend));S(a,new ea([Ed(a.sel.primary(),b,c,e)],0),d)}function gf(a,b,c){for(var d=[],e=a.cm&&(a.cm.display.shift||a.extend),f=0;fA(b.primary().head,a.sel.primary().head)?-1:1);jf(a,kf(a,b,d,!0));c&&!1===c.scroll||!a.cm||eb(a.cm)}function jf(a,b){b.equals(a.sel)||(a.sel=b,a.cm&&(a.cm.curOp.updateInput=a.cm.curOp.selectionChanged=!0,ce(a.cm)),R(a,"cursorActivity",a))}function lf(a){jf(a,kf(a,a.sel,null,!1))}function kf(a,b,c,d){for(var e,f=0;f=b.ch:h.to>b.ch))){if(e&&(J(k,"beforeCursorEnter"),k.explicitlyCleared))if(f.markedSpans){--g; continue}else break;if(k.atomic){if(c){g=k.find(0>d?1:-1);h=void 0;if(0>d?k.inclusiveRight:k.inclusiveLeft)g=mf(a,g,-d,g&&g.line==b.line?f:null);if(g&&g.line==b.line&&(h=A(g,c))&&(0>d?0>h:0d?-1:1);if(0>d?k.inclusiveLeft:k.inclusiveRight)c=mf(a,c,d,c.line==b.line?f:null);return c?ib(a,c,b,d,e):null}}}return b}function Gd(a,b,c,d,e){d=d||1;b=ib(a,b,c,d,e)||!e&&ib(a,b,c,d,!0)||ib(a,b,c,-d,e)||!e&&ib(a,b,c,-d,!0);return b?b:(a.cantEdit=!0,r(a.first,0))}function mf(a, b,c,d){return 0>c&&0==b.ch?b.line>a.first?x(a,r(b.line-1)):null:0a.lastLine())){if(b.from.linee&&(b={from:b.from,to:r(e,u(a,e).text.length),text:[b.text[0]],origin:b.origin});b.removed=Ha(a,b.from,b.to);c||(c=Ad(a,b));a.cm?Eg(a.cm,b,d):Cd(a,b,d);Bc(a,c,qa)}}function Eg(a,b,c){var d=a.doc,e=a.display,f=b.from,g=b.to,h=!1,k=f.line;a.options.lineWrapping||(k=E(na(u(d,f.line))),d.iter(k,g.line+1,function(a){if(a==e.maxLine)return h=!0}));-1e.maxLineLength&&(e.maxLine=a,e.maxLineLength=b,e.maxLineChanged=!0,h=!1)}),h&&(a.curOp.updateMaxLine=!0));lg(d,f.line);Gb(a,400);c=b.text.length-(g.line-f.line)-1;b.full?Y(a):f.line!=g.line||1!=b.text.length||$e(a.doc,b)?Y(a,f.line,g.line+1,c):Ba(a,f.line,"text");c=ga(a,"changes");if((d=ga(a,"change"))||c)b={from:f,to:g,text:b.text,removed:b.removed,origin:b.origin},d&&R(a,"change",a,b), c&&(a.curOp.changeObjs||(a.curOp.changeObjs=[])).push(b);a.display.selForContextMenu=null}function kb(a,b,c,d,e){d||(d=c);if(0>A(d,c)){var f=d;d=c;c=f}"string"==typeof b&&(b=a.splitLines(b));jb(a,{from:c,to:d,text:b,origin:e})}function tf(a,b,c,d){c=A(f.from,y(d).to);){var g=d.pop(); if(0>A(g.from,f.from)){f.from=g.from;break}}d.push(f)}aa(a,function(){for(var b=d.length-1;0<=b;b--)kb(a.doc,"",d[b].from,d[b].to,"+delete");eb(a)})}function Ef(a,b){var c=u(a.doc,b),d=na(c);d!=c&&(b=E(d));return $c(!0,a,d,b,1)}function Ff(a,b){var c=Ef(a,b.line),d=u(a.doc,c.line);a=za(d,a.doc.direction);return a&&0!=a[0].level?c:(d=Math.max(0,d.text.search(/\S/)),r(c.line,b.line==c.line&&b.ch<=d&&b.ch?0:d,c.sticky))}function Ec(a,b,c){if("string"==typeof b&&(b=Qb[b],!b))return!1;a.display.input.ensurePolled(); var d=a.display.shift,e=!1;try{a.isReadOnly()&&(a.state.suppressEdits=!0),c&&(a.display.shift=!1),e=b(a)!=Fc}finally{a.display.shift=d,a.state.suppressEdits=!1}return e}function Ng(a,b,c){for(var d=0;dB&&27==a.keyCode&&(a.returnValue=!1);var b=a.keyCode;this.display.shift=16==b||a.shiftKey;var c=Gf(this,a);ka&&(Hd=c?b:null,!c&&88==b&&!Qg&&(ia?a.metaKey:a.ctrlKey)&&this.replaceSelection("",null,"cut"));18!=b||/\bCodeMirror-crosshair\b/.test(this.display.lineDiv.className)||Rg(this)}}function Rg(a){function b(a){18!=a.keyCode&&a.altKey||(Sa(c,"CodeMirror-crosshair"),ca(document,"keyup",b),ca(document,"mouseover",b))}var c=a.display.lineDiv;Fa(c,"CodeMirror-crosshair");v(document, "keyup",b);v(document,"mouseover",b)}function If(a){16==a.keyCode&&(this.doc.sel.shift=!1);N(this,a)}function Jf(a){if(!(va(this.display,a)||N(this,a)||a.ctrlKey&&!a.altKey||ia&&a.metaKey)){var b=a.keyCode,c=a.charCode;if(ka&&b==Hd)Hd=null,V(a);else if(!ka||a.which&&!(10>a.which)||!Gf(this,a))if(b=String.fromCharCode(null==c?b:c),"\b"!=b&&!Pg(this,a,b))this.display.input.onKeyPress(a)}}function Sg(a,b){var c=+new Date;if(Sb&&Sb.compare(c,a,b))return Tb=Sb=null,"triple";if(Tb&&Tb.compare(c,a,b))return Sb= new Id(c,a,b),Tb=null,"double";Tb=new Id(c,a,b);Sb=null;return"single"}function Kf(a){var b=this.display;if(!(N(this,a)||b.activeTouch&&b.input.supportsTouch()))if(b.input.ensurePolled(),b.shift=a.shiftKey,va(b,a))T||(b.scroller.draggable=!1,setTimeout(function(){return b.scroller.draggable=!0},100));else if(!Jd(this,a,"gutterClick",!0)){var c=Ra(this,a),d=ee(a),e=c?Sg(c,d):"single";window.focus();1==d&&this.state.selectingText&&this.state.selectingText(a);c&&Tg(this,d,c,e,a)||(1==d?c?Ug(this,c,e, a):(a.target||a.srcElement)==b.scroller&&V(a):2==d?(c&&Ac(this.doc,c),setTimeout(function(){return b.input.focus()},20)):3==d&&(Kd?Lf(this,a):Ke(this)))}}function Tg(a,b,c,d,e){var f="Click";"double"==d?f="Double"+f:"triple"==d&&(f="Triple"+f);return Rb(a,Bf((1==b?"Left":2==b?"Middle":"Right")+f,e),e,function(b){"string"==typeof b&&(b=Qb[b]);if(!b)return!1;var d=!1;try{a.isReadOnly()&&(a.state.suppressEdits=!0),d=b(a,c)!=Fc}finally{a.state.suppressEdits=!1}return d})}function Ug(a,b,c,d){D?setTimeout(Kc(Je, a),0):a.curOp.focus=ra();var e=a.getOption("configureMouse"),e=e?e(a,c,d):{};null==e.unit&&(e.unit=(Vg?d.shiftKey&&d.metaKey:d.altKey)?"rectangle":"single"==c?"char":"double"==c?"word":"line");if(null==e.extend||a.doc.extend)e.extend=a.doc.extend||d.shiftKey;null==e.addNew&&(e.addNew=ia?d.metaKey:d.ctrlKey);null==e.moveOnDrag&&(e.moveOnDrag=!(ia?d.altKey:d.ctrlKey));var f=a.doc.sel,g;a.options.dragDrop&&Wg&&!a.isReadOnly()&&"single"==c&&-1<(g=f.contains(b))&&(0>A((g=f.ranges[g]).from(),b)||0b.xRel)?Xg(a,d,b,e):Yg(a,d,b,e)}function Xg(a,b,c,d){var e=a.display,f=!1,g=O(a,function(b){T&&(e.scroller.draggable=!1);a.state.draggingText=!1;ca(document,"mouseup",g);ca(document,"mousemove",h);ca(e.scroller,"dragstart",k);ca(e.scroller,"drop",g);f||(V(b),d.addNew||Ac(a.doc,c,null,null,d.extend),T||D&&9==B?setTimeout(function(){document.body.focus();e.input.focus()},20):e.input.focus())}),h=function(a){f=f||10<=Math.abs(b.clientX-a.clientX)+Math.abs(b.clientY-a.clientY)},k=function(){return f= !0};T&&(e.scroller.draggable=!0);a.state.draggingText=g;g.copy=!d.moveOnDrag;e.scroller.dragDrop&&e.scroller.dragDrop();v(document,"mouseup",g);v(document,"mousemove",h);v(e.scroller,"dragstart",k);v(e.scroller,"drop",g);Ke(a);setTimeout(function(){return e.input.focus()},20)}function Mf(a,b,c){if("char"==c)return new C(b,b);if("word"==c)return a.findWordAt(b);if("line"==c)return new C(r(b.line,0),x(a.doc,r(b.line+1,0)));a=c(a,b);return new C(a.from,a.to)}function Yg(a,b,c,d){function e(b){if(0!= A(q,b))if(q=b,"rectangle"==d.unit){for(var e=[],f=a.options.tabSize,g=fa(u(k,c.line).text,c.ch,f),h=fa(u(k,b.line).text,b.ch,f),m=Math.min(g,h),g=Math.max(g,h),h=Math.min(c.line,b.line),t=Math.min(a.lastLine(),Math.max(c.line,b.line));h<=t;h++){var I=u(k,h).text,v=Lc(I,m,f);m==g?e.push(new C(r(h,v),r(h,v))):I.length>v&&e.push(new C(r(h,v),r(h,Lc(I,g,f))))}e.length||e.push(new C(c,c));S(k,la(l.ranges.slice(0,p).concat(e),p),{origin:"*mouse",scroll:!1});a.scrollIntoView(b)}else e=n,m=Mf(a,b,d.unit), b=e.anchor,0=l.to||g.linet.bottom?20:0;m&&setTimeout(O(a,function(){w==c&&(h.scroller.scrollTop+=m,f(b))}),50)}}function g(b){a.state.selectingText= !1;w=Infinity;V(b);h.input.focus();ca(document,"mousemove",z);ca(document,"mouseup",y);k.history.lastSelOrigin=null}var h=a.display,k=a.doc;V(b);var l=k.sel,m=l.ranges;if(d.addNew&&!d.extend){var p=k.sel.contains(c);var n=-1=Math.floor(a.display.gutters.getBoundingClientRect().right))return!1;d&&V(b);d=a.display; var g=d.lineDiv.getBoundingClientRect();if(f>g.bottom||!ga(a,c))return ad(b);f-=g.top-d.viewOffset;for(g=0;g=e)return e=Ia(a.doc,f),J(a,c,a,e,a.options.gutters[g],b),ad(b)}}function Lf(a,b){var c;(c=va(a.display,b))||(c=ga(a,"gutterContextMenu")?Jd(a,b,"gutterContextMenu",!1):!1);if(!c&&!N(a,b,"contextmenu"))a.display.input.onContextMenu(b)}function Nf(a){a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-s-\S+/g, "")+a.options.theme.replace(/(^|\s)\s*/g," cm-s-");Bb(a)}function Ub(a){Ve(a);Y(a);Me(a)}function Zg(a,b,c){!b!=!(c&&c!=ob)&&(c=a.display.dragFunctions,b=b?v:ca,b(a.display.scroller,"dragstart",c.start),b(a.display.scroller,"dragenter",c.enter),b(a.display.scroller,"dragover",c.over),b(a.display.scroller,"dragleave",c.leave),b(a.display.scroller,"drop",c.drop))}function $g(a){a.options.lineWrapping?(Fa(a.display.wrapper,"CodeMirror-wrap"),a.display.sizer.style.minWidth="",a.display.sizerWidth=null): (Sa(a.display.wrapper,"CodeMirror-wrap"),Wc(a));qd(a);Y(a);Bb(a);setTimeout(function(){return fb(a)},100)}function G(a,b){var c=this;if(!(this instanceof G))return new G(a,b);this.options=b=b?Ga(b):{};Ga(Of,b,!1);zd(b);var d=b.value;"string"==typeof d&&(d=new Z(d,b.mode,null,b.lineSeparator,b.direction));this.doc=d;var e=new G.inputStyles[b.inputStyle](this);a=this.display=new dg(a,d,e);a.wrapper.CodeMirror=this;Ve(this);Nf(this);b.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"); Re(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 Xa,keySeq:null,specialChars:null};b.autofocus&&!qb&&a.input.focus();D&&11>B&&setTimeout(function(){return c.display.input.reset(!0)},20);ah(this);Pf||(Jg(),Pf=!0);Ua(this);this.curOp.forceUpdate=!0;af(this,d);b.autofocus&&!qb||this.hasFocus()?setTimeout(Kc(sd,this),20):Db(this);for(var f in Gc)if(Gc.hasOwnProperty(f))Gc[f](c, b[f],ob);Ne(this);b.finishInit&&b.finishInit(this);for(d=0;dB? v(d.scroller,"dblclick",O(a,function(b){if(!N(a,b)){var d=Ra(a,b);!d||Jd(a,b,"gutterClick",!0)||va(a.display,b)||(V(b),b=a.findWordAt(d),Ac(a.doc,b.anchor,b.head))}})):v(d.scroller,"dblclick",function(b){return N(a,b)||V(b)});Kd||v(d.scroller,"contextmenu",function(b){return Lf(a,b)});var e,f={end:0};v(d.scroller,"touchstart",function(b){var c;if(c=!N(a,b))1!=b.touches.length?c=!1:(c=b.touches[0],c=1>=c.radiusX&&1>=c.radiusY),c=!c;c&&(d.input.ensurePolled(),clearTimeout(e),c=+new Date,d.activeTouch= {start:c,moved:!1,prev:300>=c-f.end?f:null},1==b.touches.length&&(d.activeTouch.left=b.touches[0].pageX,d.activeTouch.top=b.touches[0].pageY))});v(d.scroller,"touchmove",function(){d.activeTouch&&(d.activeTouch.moved=!0)});v(d.scroller,"touchend",function(e){var f=d.activeTouch;if(f&&!va(d,e)&&null!=f.left&&!f.moved&&300>new Date-f.start){var g=a.coordsChar(d.activeTouch,"page"),f=!f.prev||c(f,f.prev)?new C(g,g):!f.prev.prev||c(f,f.prev.prev)?a.findWordAt(g):new C(r(g.line,0),x(a.doc,r(g.line+1,0))); a.setSelection(f.anchor,f.head);a.focus();V(e)}b()});v(d.scroller,"touchcancel",b);v(d.scroller,"scroll",function(){d.scroller.clientHeight&&(Fb(a,d.scroller.scrollTop),Ta(a,d.scroller.scrollLeft,!0),J(a,"scroll",a))});v(d.scroller,"mousewheel",function(b){return Xe(a,b)});v(d.scroller,"DOMMouseScroll",function(b){return Xe(a,b)});v(d.wrapper,"scroll",function(){return d.wrapper.scrollTop=d.wrapper.scrollLeft=0});d.dragFunctions={enter:function(b){N(a,b)||ub(b)},over:function(b){if(!N(a,b)){var d= Ra(a,b);if(d){var c=document.createDocumentFragment();Ie(a,d,c);a.display.dragCursor||(a.display.dragCursor=t("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),a.display.lineSpace.insertBefore(a.display.dragCursor,a.display.cursorDiv));F(a.display.dragCursor,c)}ub(b)}},start:function(b){if(D&&(!a.state.draggingText||100>+new Date-yf))ub(b);else if(!N(a,b)&&!va(a.display,b)&&(b.dataTransfer.setData("Text",a.getSelection()),b.dataTransfer.effectAllowed="copyMove",b.dataTransfer.setDragImage&& !Qf)){var d=t("img",null,null,"position: fixed; left: 0; top: 0;");d.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";ka&&(d.width=d.height=1,a.display.wrapper.appendChild(d),d._top=d.offsetTop);b.dataTransfer.setDragImage(d,0,0);ka&&d.parentNode.removeChild(d)}},drop:O(a,Ig),leave:function(b){N(a,b)||xf(a)}};var g=d.input.getField();v(g,"keyup",function(b){return If.call(a,b)});v(g,"keydown",O(a,Hf));v(g,"keypress",O(a,Jf));v(g,"focus",function(b){return sd(a,b)}); v(g,"blur",function(b){return Db(a,b)})}function Vb(a,b,c,d){var e=a.doc,f;null==c&&(c="add");"smart"==c&&(e.mode.indent?f=vb(a,b).state:c="prev");var g=a.options.tabSize,h=u(e,b),k=fa(h.text,null,g);h.stateAfter&&(h.stateAfter=null);var l=h.text.match(/^\s*/)[0];if(!d&&!/\S/.test(h.text)){var m=0;c="not"}else if("smart"==c&&(m=e.mode.indent(f,h.text.slice(l.length),h.text),m==Fc||150e.first?fa(u(e,b-1).text,null,g):0:"add"==c?m=k+a.options.indentUnit:"subtract"== c?m=k-a.options.indentUnit:"number"==typeof c&&(m=k+c);m=Math.max(0,m);c="";d=0;if(a.options.indentWithTabs)for(a=Math.floor(m/g);a;--a)d+=g,c+="\t";d=a.first+a.size?d=!1:(b=new r(d,b.ch,b.sticky),d=k=u(a,d));if(d)b=$c(e,a.cm,k,b.line,c);else return!1}else b=f;return!0}var g=b,h=c,k=u(a,b.line);if("char"==d)f();else if("column"==d)f(!0);else if("word"==d||"group"==d){var l=null;d="group"==d;for(var m=a.cm&&a.cm.getHelper(b,"wordChars"), p=!0;!(0>c)||f(!p);p=!1){var n=k.text.charAt(b.ch)||"\n",n=fc(n,m)?"w":d&&"\n"==n?"n":!d||/\s/.test(n)?null:"p";!d||p||n||(n="s");if(l&&l!=n){0>c&&(c=1,f(),b.sticky="after");break}n&&(l=n);if(0c?0>=g:g>=e.height){b.hitSide=!0;break}g+=5*c}return b}function Xf(a,b){var c=ld(a,b.line);if(!c||c.hidden)return null;var d=u(a.doc,b.line),c=xe(c,d,b.line);a=za(d,a.doc.direction);d="left";a&&(d=Xc(a,b.ch)%2?"right":"left");b=ye(c.map,b.ch,d);b.offset="right"==b.collapse?b.end:b.start;return b}function bh(a){for(;a;a=a.parentNode)if(/CodeMirror-gutter-wrapper/.test(a.className))return!0;return!1}function pb(a,b){b&&(a.bad=!0);return a}function ch(a, b,c,d,e){function f(a){return function(b){return b.id==a}}function g(a){a&&(l&&(k+=m,l=!1),k+=a)}function h(b){if(1==b.nodeType){var c=b.getAttribute("cm-text");if(null!=c)g(c||b.textContent.replace(/\u200b/g,""));else{var c=b.getAttribute("cm-marker"),q;if(c)b=a.findMarks(r(d,0),r(e+1,0),f(+c)),b.length&&(q=b[0].find())&&g(Ha(a.doc,q.from,q.to).join(m));else if("false"!=b.getAttribute("contenteditable")){(q=/^(pre|div|p)$/i.test(b.nodeName))&&l&&(k+=m,l=!1);for(c=0;ce?k.map:l[e],g=0;ge?a.line:a.rest[e]);e=f[g]+c;if(0>c||h!=b)e=f[g+(c?1:0)];return r(d,e)}}}var e=a.text.firstChild,f=!1;if(!b||!ha(e,b))return pb(r(E(a.line),0),!0);if(b==e&&(f=!0,b=e.childNodes[c],c=0,!b))return c=a.rest?y(a.rest):a.line,pb(r(E(c),c.text.length),f);var g=3==b.nodeType?b:null,h=b;g||1!=b.childNodes.length||3!=b.firstChild.nodeType||(g=b.firstChild,c&& (c=g.nodeValue.length));for(;h.parentNode!=e;)h=h.parentNode;var k=a.measure,l=k.maps;if(b=d(g,h,c))return pb(b,f);e=h.nextSibling;for(g=g?g.nodeValue.length-c:0;e;e=e.nextSibling){if(b=d(e,e.firstChild,0))return pb(r(b.line,b.ch-g),f);g+=e.textContent.length}for(h=h.previousSibling;h;h=h.previousSibling){if(b=d(h,h.firstChild,-1))return pb(r(b.line,b.ch+c),f);c+=h.textContent.length}}var X=navigator.userAgent,Yf=navigator.platform,xa=/gecko\/\d/i.test(X),Zf=/MSIE \d/.test(X),$f=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(X), Xb=/Edge\/(\d+)/.exec(X),D=Zf||$f||Xb,B=D&&(Zf?document.documentMode||6:+(Xb||$f)[1]),T=!Xb&&/WebKit\//.test(X),eh=T&&/Qt\/\d+\.\d+/.test(X),pc=!Xb&&/Chrome\//.test(X),ka=/Opera\//.test(X),Qf=/Apple Computer/.test(navigator.vendor),fh=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(X),xg=/PhantomJS/.test(X),Wb=!Xb&&/AppleWebKit/.test(X)&&/Mobile\/\w+/.test(X),qc=/Android/.test(X),qb=Wb||qc||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(X),ia=Wb||/Mac/.test(Yf),Vg=/\bCrOS\b/.test(X),gh=/win/i.test(Yf), Ya=ka&&X.match(/Version\/(\d*\.\d*)/);Ya&&(Ya=Number(Ya[1]));Ya&&15<=Ya&&(ka=!1,T=!0);var Cf=ia&&(eh||ka&&(null==Ya||12.11>Ya)),Kd=xa||D&&9<=B,Sa=function(a,b){var c=a.className;if(b=w(b).exec(c)){var d=c.slice(b.index+b[0].length);a.className=c.slice(0,b.index)+(d?b[1]+d:"")}};var wb=document.createRange?function(a,b,c,d){var e=document.createRange();e.setEnd(d||a,c);e.setStart(a,b);return e}:function(a,b,c){var d=document.body.createTextRange();try{d.moveToElementText(a.parentNode)}catch(e){return d}d.collapse(!0); d.moveEnd("character",c);d.moveStart("character",b);return d};var Yb=function(a){a.select()};Wb?Yb=function(a){a.selectionStart=0;a.selectionEnd=a.value.length}:D&&(Yb=function(a){try{a.select()}catch(b){}});var Xa=function(){this.id=null};Xa.prototype.set=function(a,b){clearTimeout(this.id);this.id=setTimeout(b,a)};var Fc={toString:function(){return"CodeMirror.Pass"}},qa={scroll:!1},Ld={origin:"*mouse"},Zb={origin:"+move"},dc=[""],bg=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/, cg=/[\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]/, pf=!1,ya=!1,tb=null,gg=function(){function a(a){return 247>=a?"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN".charAt(a):1424<=a&&1524>=a?"R":1536<=a&&1785>=a?"nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111".charAt(a- 1536):1774<=a&&2220>=a?"r":8192<=a&&8203>=a?"w":8204==a?"b":"L"}function b(a,b,d){this.level=a;this.from=b;this.to=d}var c=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,d=/[stwN]/,e=/[LRr]/,f=/[Lb1n]/,g=/[1n]/;return function(h,k){var l="ltr"==k?"L":"R";if(0==h.length||"ltr"==k&&!c.test(h))return!1;for(var m=h.length,p=[],n=0;nB)return!1;var a=t("div");return"draggable"in a||"dragDrop"in a}(),bd,hd,Od=3!="\n\nb".split(/\n/).length?function(a){for(var b=0,c=[],d=a.length;b<=d;){var e=a.indexOf("\n",b);-1==e&&(e=a.length);var f=a.slice(b,"\r"==a.charAt(e-1)?e-1:e),g=f.indexOf("\r");-1!=g?(c.push(f.slice(0,g)),b+=g+ 1):(c.push(f),b=e+1)}return c}:function(a){return a.split(/\r\n?|\n/)},hh=window.getSelection?function(a){try{return a.selectionStart!=a.selectionEnd}catch(b){return!1}}:function(a){try{var b=a.ownerDocument.selection.createRange()}catch(c){}return b&&b.parentElement()==a?0!=b.compareEndPoints("StartToEnd",b):!1},Qg=function(){var a=t("div");if("oncopy"in a)return!0;a.setAttribute("oncopy","return;");return"function"==typeof a.oncopy}(),nd=null,cd={},bb={},cb={},L=function(a,b,c){this.pos=this.start= 0;this.string=a;this.tabSize=b||8;this.lineStart=this.lastColumnPos=this.lastColumnValue=0;this.lineOracle=c};L.prototype.eol=function(){return this.pos>=this.string.length};L.prototype.sol=function(){return this.pos==this.lineStart};L.prototype.peek=function(){return this.string.charAt(this.pos)||void 0};L.prototype.next=function(){if(this.posb};L.prototype.eatSpace=function(){for(var a=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>a};L.prototype.skipToEnd=function(){this.pos=this.string.length};L.prototype.skipTo=function(a){a=this.string.indexOf(a,this.pos);if(-1this.maxLookAhead&&(this.maxLookAhead=a);return b};ta.prototype.nextLine=function(){this.line++;0B&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Za.prototype.update=function(a){var b=a.scrollWidth>a.clientWidth+1,c=a.scrollHeight>a.clientHeight+1,d=a.nativeBarWidth;c?(this.vert.style.display="block",this.vert.style.bottom=b?d+"px":"0",this.vert.firstChild.style.height=Math.max(0, a.scrollHeight-a.clientHeight+(a.viewHeight-(b?d:0)))+"px"):(this.vert.style.display="",this.vert.firstChild.style.height="0");b?(this.horiz.style.display="block",this.horiz.style.right=c?d+"px":"0",this.horiz.style.left=a.barLeft+"px",this.horiz.firstChild.style.width=Math.max(0,a.scrollWidth-a.clientWidth+(a.viewWidth-a.barLeft-(c?d:0)))+"px"):(this.horiz.style.display="",this.horiz.firstChild.style.width="0");!this.checkedZeroWidth&&0=A(a,d.to()))return c}return-1};var C=function(a,b){this.anchor=a;this.head=b};C.prototype.from=function(){return ic(this.anchor,this.head)};C.prototype.to=function(){return hc(this.anchor,this.head)};C.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};Lb.prototype={chunkSize:function(){return this.lines.length},removeInner:function(a,b){for(var c=a,d=a+b;cthis.size-b&&(1=this.children.length)){var a=this;do{var b=a.children.splice(a.children.length-5,5),b=new Mb(b);if(a.parent){a.size-=b.size;a.height-=b.height;var c=Q(a.parent.children,a);a.parent.children.splice(c+ 1,0,b)}else c=new Mb(a.children),c.parent=a,a.children=[c,b],a=c;b.parent=a.parent}while(10a.display.maxLineLength&&(a.display.maxLine=f,a.display.maxLineLength=g,a.display.maxLineChanged=!0);null!=c&&a&&this.collapsed&&Y(a,c,d+1);this.lines.length=0;this.explicitlyCleared=!0;this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit= !1,a&&lf(a.doc));a&&R(a,"markerCleared",a,this,c,d);b&&Va(a);this.parent&&this.parent.clear()}};Da.prototype.find=function(a,b){null==a&&"bookmark"==this.type&&(a=1);for(var c,d,e=0;eA(h.head,h.anchor),a[f]=new C(h?k:g,h?g:k)):a[f]=new C(g,g)}a=new ea(a,this.sel.primIndex)}b=a;for(a=d.length-1;0<=a;a--)jb(this, d[a]);b?hf(this,b):this.cm&&eb(this.cm)}),undo:P(function(){Cc(this,"undo")}),redo:P(function(){Cc(this,"redo")}),undoSelection:P(function(){Cc(this,"undo",!0)}),redoSelection:P(function(){Cc(this,"redo",!0)}),setExtending:function(a){this.extend=a},getExtending:function(){return this.extend},historySize:function(){for(var a=this.history,b=0,c=0,d=0;d=a.ch)&&b.push(e.marker.parent||e.marker)}return b},findMarks:function(a,b,c){a=x(this,a);b=x(this, b);var d=[],e=a.line;this.iter(a.line,b.line+1,function(f){if(f=f.markedSpans)for(var g=0;g=h.to||null==h.from&&e!=a.line||null!=h.from&&e==b.line&&h.from>=b.ch||c&&!c(h.marker)||d.push(h.marker.parent||h.marker)}++e});return d},getAllMarks:function(){var a=[];this.iter(function(b){if(b=b.markedSpans)for(var c=0;ca)return b=a,!0;a-=e;++c});return x(this,r(c,b))},indexFromPos:function(a){a=x(this,a);var b=a.ch;if(a.linea.ch)return 0;var c=this.lineSeparator().length;this.iter(this.first,a.line,function(a){b+=a.text.length+c});return b},copy:function(a){var b=new Z(Pc(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);b.scrollTop=this.scrollTop;b.scrollLeft=this.scrollLeft;b.sel=this.sel;b.extend=!1;a&&(b.history.undoDepth= this.history.undoDepth,b.setHistory(this.getHistory()));return b},linkedDoc:function(a){a||(a={});var b=this.first,c=this.first+this.size;null!=a.from&&a.from>b&&(b=a.from);null!=a.to&&a.toac;ac++)Ea[ac+48]=Ea[ac+96]=String(ac);for(var Ic=65;90>=Ic;Ic++)Ea[Ic]=String.fromCharCode(Ic);for(var bc=1;12>=bc;bc++)Ea[bc+111]=Ea[bc+63235]="F"+bc;var Pb={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"},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"},emacsy:{"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars", "Ctrl-O":"openLine"},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"]}};Pb["default"]=ia?Pb.macDefault:Pb.pcDefault;var Qb={selectAll:nf,singleSelection:function(a){return a.setSelection(a.getCursor("anchor"),a.getCursor("head"),qa)},killLine:function(a){return nb(a,function(b){if(b.empty()){var c= u(a.doc,b.head.line).text.length;return b.head.ch==c&&b.head.linea.doc.first){var g=u(a.doc,e.line-1).text;g&&(e=new r(e.line,1),a.replaceRange(f.charAt(0)+a.doc.lineSeparator()+g.charAt(g.length-1),r(e.line-1,g.length-1),e,"+transpose"))}c.push(new C(e,e))}a.setSelections(c)})},newlineAndIndent:function(a){return aa(a,function(){for(var b=a.listSelections(), c=b.length-1;0<=c;c--)a.replaceRange(a.doc.lineSeparator(),b[c].anchor,b[c].head,"+input");b=a.listSelections();for(c=0;ca&&0==A(b,this.pos)&&c==this.button};var Tb,Sb,ob={toString:function(){return"CodeMirror.Init"}}, Of={},Gc={};G.defaults=Of;G.optionHandlers=Gc;var Md=[];G.defineInitHook=function(a){return Md.push(a)};var ba=null,z=function(a){this.cm=a;this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null;this.polling=new Xa;this.composing=null;this.gracePeriod=!1;this.readDOMTimeout=null};z.prototype.init=function(a){function b(a){if(!N(e,a)){if(e.somethingSelected())ba={lineWise:!1,text:e.getSelections()},"cut"==a.type&&e.replaceSelection("",null,"cut");else if(e.options.lineWiseCopyCut){var b= Tf(e);ba={lineWise:!0,text:b.text};"cut"==a.type&&e.operation(function(){e.setSelections(b.ranges,0,qa);e.replaceSelection("",null,"cut")})}else return;if(a.clipboardData){a.clipboardData.clearData();var c=ba.text.join("\n");a.clipboardData.setData("Text",c);if(a.clipboardData.getData("Text")==c){a.preventDefault();return}}var g=Vf();a=g.firstChild;e.display.lineSpace.insertBefore(g,e.display.lineSpace.firstChild);a.value=ba.text.join("\n");var m=document.activeElement;Yb(a);setTimeout(function(){e.display.lineSpace.removeChild(g); m.focus();m==f&&d.showPrimarySelection()},50)}}var c=this,d=this,e=d.cm,f=d.div=a.lineDiv;Uf(f,e.options.spellcheck);v(f,"paste",function(a){N(e,a)||Sf(a,e)||11>=B&&setTimeout(O(e,function(){return c.updateFromDOM()}),20)});v(f,"compositionstart",function(a){c.composing={data:a.data,done:!1}});v(f,"compositionupdate",function(a){c.composing||(c.composing={data:a.data,done:!1})});v(f,"compositionend",function(a){c.composing&&(a.data!=c.composing.data&&c.readFromDOMSoon(),c.composing.done=!0)});v(f, "touchstart",function(){return d.forceCompositionEnd()});v(f,"input",function(){c.composing||c.readFromDOMSoon()});v(f,"copy",b);v(f,"cut",b)};z.prototype.prepareSelection=function(){var a=He(this.cm,!1);a.focus=this.cm.state.focused;return a};z.prototype.showSelection=function(a,b){a&&this.cm.display.view.length&&((a.focus||b)&&this.showPrimarySelection(),this.showMultipleSelections(a))};z.prototype.showPrimarySelection=function(){var a=window.getSelection(),b=this.cm,c=b.doc.sel.primary(),d=c.from(), c=c.to();if(b.display.viewTo==b.display.viewFrom||d.line>=b.display.viewTo||c.line=b.display.viewFrom&&Xf(b,d)||{node:e[0].measure.map[2],offset:0},c=c.linea.firstLine()&&(d=r(d.line-1,u(a.doc,d.line-1).length));e.ch==u(a.doc,e.line).text.length&&e.lineb.viewTo-1)return!1;var f;d.line==b.viewFrom||0==(f=Oa(a,d.line))?(c=E(b.view[0].line),f=b.view[0].node):(c=E(b.view[f].line),f=b.view[f-1].node.nextSibling);var g=Oa(a,e.line);g==b.view.length-1?(e=b.viewTo-1,b=b.lineDiv.lastChild):(e=E(b.view[g+1].line)- 1,b=b.view[g+1].node.previousSibling);if(!f)return!1;b=a.doc.splitLines(ch(a,f,b,c,e));for(f=Ha(a.doc,r(c,0),r(e,u(a.doc,e).text.length));1d.ch&&k.charCodeAt(k.length-g-1)==l.charCodeAt(l.length-g-1);)h--,g++;b[b.length-1]=k.slice(0,k.length-g).replace(/^\u200b+/,"");b[0]=b[0].slice(h).replace(/\u200b+$/,"");d=r(c,h);c=r(e,f.length?y(f).length-g:0);if(1B&&f.scrollbars.setScrollTop(f.scroller.scrollTop=k);if(null!=g.selectionStart){(!D||D&&9>B)&&b();var a=0,c=function(){f.selForContextMenu==e.doc.sel&&0==g.selectionStart&&0a++?f.detectingSelectAll=setTimeout(c,500):(f.selForContextMenu=null,f.input.reset())};f.detectingSelectAll=setTimeout(c,200)}}var d=this,e=d.cm,f=e.display, g=d.textarea,h=Ra(e,a),k=f.scroller.scrollTop;if(h&&!ka){e.options.resetSelectionOnContextMenu&&-1==e.doc.sel.contains(h)&&O(e,S)(e.doc,wa(h),qa);var l=g.style.cssText,m=d.wrapper.style.cssText;d.wrapper.style.cssText="position: absolute";h=d.wrapper.getBoundingClientRect();g.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(a.clientY-h.top-5)+"px; left: "+(a.clientX-h.left-5)+"px;\n z-index: 1000; background: "+(D?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);"; if(T)var p=window.scrollY;f.input.focus();T&&window.scrollTo(null,p);f.input.reset();e.somethingSelected()||(g.value=d.prevInput=" ");d.contextMenuPending=!0;f.selForContextMenu=e.doc.sel;clearTimeout(f.detectingSelectAll);D&&9<=B&&b();if(Kd){ub(a);var n=function(){ca(window,"mouseup",n);setTimeout(c,20)};v(window,"mouseup",n)}else setTimeout(c,50)}};M.prototype.readOnlyChanged=function(a){a||this.reset();this.textarea.disabled="nocursor"==a};M.prototype.setUneditable=function(){};M.prototype.needsContentAttribute= !1;(function(a){function b(b,e,f,g){a.defaults[b]=e;f&&(c[b]=g?function(a,b,d){d!=ob&&f(a,b,d)}:f)}var c=a.optionHandlers;a.defineOption=b;a.Init=ob;b("value","",function(a,b){return a.setValue(b)},!0);b("mode",null,function(a,b){a.doc.modeOption=b;Bd(a)},!0);b("indentUnit",2,Bd,!0);b("indentWithTabs",!1);b("smartIndent",!0);b("tabSize",4,function(a){Ib(a);Bb(a);Y(a)},!0);b("lineSeparator",null,function(a,b){if(a.doc.lineSep=b){var d=[],c=a.doc.first;a.doc.iter(function(a){for(var e=0;;){var f=a.text.indexOf(b, e);if(-1==f)break;e=f+b.length;d.push(r(c,f))}c++});for(var e=d.length-1;0<=e;e--)kb(a.doc,b,d[e],r(d[e].line,d[e].ch+b.length))}});b("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(a,b,c){a.state.specialChars=new RegExp(b.source+(b.test("\t")?"":"|\t"),"g");c!=ob&&a.refresh()});b("specialCharPlaceholder",qg,function(a){return a.refresh()},!0);b("electricChars",!0);b("inputStyle",qb?"contenteditable":"textarea",function(){throw Error("inputStyle can not (yet) be changed in a running editor"); },!0);b("spellcheck",!1,function(a,b){return a.getInputField().spellcheck=b},!0);b("rtlMoveVisually",!gh);b("wholeLineUpdateBefore",!0);b("theme","default",function(a){Nf(a);Ub(a)},!0);b("keyMap","default",function(a,b,c){b=Dc(b);(c=c!=ob&&Dc(c))&&c.detach&&c.detach(a,b);b.attach&&b.attach(a,c||null)});b("extraKeys",null);b("configureMouse",null);b("lineWrapping",!1,$g,!0);b("gutters",[],function(a){zd(a.options);Ub(a)},!0);b("fixedGutter",!0,function(a,b){a.display.gutters.style.left=b?pd(a.display)+ "px":"0";a.refresh()},!0);b("coverGutterNextToScrollbar",!1,function(a){return fb(a)},!0);b("scrollbarStyle","native",function(a){Re(a);fb(a);a.display.scrollbars.setScrollTop(a.doc.scrollTop);a.display.scrollbars.setScrollLeft(a.doc.scrollLeft)},!0);b("lineNumbers",!1,function(a){zd(a.options);Ub(a)},!0);b("firstLineNumber",1,Ub,!0);b("lineNumberFormatter",function(a){return a},Ub,!0);b("showCursorWhenSelecting",!1,Cb,!0);b("resetSelectionOnContextMenu",!0);b("lineWiseCopyCut",!0);b("pasteLinesPerSelection", !0);b("readOnly",!1,function(a,b){"nocursor"==b&&(Db(a),a.display.input.blur());a.display.input.readOnlyChanged(b)});b("disableInput",!1,function(a,b){b||a.display.input.reset()},!0);b("dragDrop",!0,Zg);b("allowDropFileTypes",null);b("cursorBlinkRate",530);b("cursorScrollMargin",0);b("cursorHeight",1,Cb,!0);b("singleCursorHeightPerLine",!0,Cb,!0);b("workTime",100);b("workDelay",100);b("flattenSpans",!0,Ib,!0);b("addModeClass",!1,Ib,!0);b("pollInterval",100);b("undoDepth",200,function(a,b){return a.doc.history.undoDepth= b});b("historyEventDelay",1250);b("viewportMargin",10,function(a){return a.refresh()},!0);b("maxHighlightLength",1E4,Ib,!0);b("moveInputWithCursor",!0,function(a,b){b||a.display.input.resetPosition()});b("tabindex",null,function(a,b){return a.display.input.getField().tabIndex=b||""});b("autofocus",null);b("direction","ltr",function(a,b){return a.doc.setDirection(b)},!0)})(G);(function(a){var b=a.optionHandlers,c=a.helpers={};a.prototype={constructor:a,focus:function(){window.focus();this.display.input.focus()}, setOption:function(a,c){var d=this.options,e=d[a];if(d[a]!=c||"mode"==a)d[a]=c,b.hasOwnProperty(a)&&O(this,b[a])(this,c,e),J(this,"optionChange",this,a)},getOption:function(a){return this.options[a]},getDoc:function(){return this.doc},addKeyMap:function(a,b){this.state.keyMaps[b?"push":"unshift"](Dc(a))},removeKeyMap:function(a){for(var b=this.state.keyMaps,c=0;cc&&(Vb(this,h.head.line,a,!0),c=h.head.line,d==this.doc.sel.primIndex&&eb(this));else{for(var k=h.from(),h=h.to(),l=Math.max(c,k.line),c=Math.min(this.lastLine(),h.line-(h.ch?0:1))+1,h=l;h>1;if((h?b[2*h-1]:0)>=a)d=h;else if(b[2*h+1]c?b:0==c?null:b.slice(0,c-1)},getModeAt:function(b){var c=this.doc.mode;return c.innerMode?a.innerMode(c,this.getTokenAt(b).state).mode:c},getHelper:function(a,b){return this.getHelpers(a,b)[0]},getHelpers:function(a, b){var d=[];if(!c.hasOwnProperty(b))return d;var e=c[b];a=this.getModeAt(a);if("string"==typeof a[b])e[a[b]]&&d.push(e[a[b]]);else if(a[b])for(var h=0;he&&(a=e,d=!0);a=u(this.doc,a)}return La(this,a,{top:0,left:0},b||"page",c||d).top+(d?this.doc.height-oa(a):0)},defaultTextHeight:function(){return Pa(this.display)},defaultCharWidth:function(){return Ab(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(a,b,c,g,h){var d=this.display;a=ja(this,x(this.doc,a));var e=a.bottom,f=a.left;b.style.position="absolute";b.setAttribute("cm-ignore-events", "true");this.display.input.setUneditable(b);d.sizer.appendChild(b);if("over"==g)e=a.top;else if("above"==g||"near"==g){var p=Math.max(d.wrapper.clientHeight,this.doc.height),n=Math.max(d.sizer.clientWidth,d.lineSpace.clientWidth);("above"==g||a.bottom+b.offsetHeight>p)&&a.top>b.offsetHeight?e=a.top-b.offsetHeight:a.bottom+b.offsetHeight<=p&&(e=a.bottom);f+b.offsetWidth>n&&(f=n-b.offsetWidth)}b.style.top=e+"px";b.style.left=b.style.right="";"right"==h?(f=d.sizer.clientWidth-b.offsetWidth,b.style.right= "0px"):("left"==h?f=0:"middle"==h&&(f=(d.sizer.clientWidth-b.offsetWidth)/2),b.style.left=f+"px");c&&(a=vd(this,{left:f,top:e,right:f+b.offsetWidth,bottom:e+b.offsetHeight}),null!=a.scrollTop&&Fb(this,a.scrollTop),null!=a.scrollLeft&&Ta(this,a.scrollLeft))},triggerOnKeyDown:W(Hf),triggerOnKeyPress:W(Jf),triggerOnKeyUp:If,triggerOnMouseDown:W(Kf),execCommand:function(a){if(Qb.hasOwnProperty(a))return Qb[a].call(null,this)},triggerElectric:W(function(a){Rf(this,a)}),findPosH:function(a,b,c,g){var d= 1;0>b&&(d=-1,b=-b);a=x(this.doc,a);for(var e=0;ea?d.from():d.to()},Zb)}),deleteH:W(function(a,b){var c=this.doc;this.doc.sel.somethingSelected()?c.replaceSelection("",null,"+delete"):nb(this,function(d){var e=Pd(c,d.head,a,b,!1);return 0>a?{from:e,to:d.head}:{from:d.head,to:e}})}), findPosV:function(a,b,c,g){var d=1;0>b&&(d=-1,b=-b);var e=x(this.doc,a);for(a=0;aa?f.from():f.to();var g=ja(c,f.head,"div");null!=f.goalColumn&&(g.left=f.goalColumn);e.push(g.left);var h=Wf(c,g,a,b);"page"==b&&f==d.sel.primary()&&tc(c,rc(c,h,"div").top- g.top);return h},Zb);if(e.length)for(var l=0;l Q(jh,cc)&&(G.prototype[cc]=function(a){return function(){return a.apply(this.doc,arguments)}}(Z.prototype[cc]));ab(Z);G.inputStyles={textarea:M,contenteditable:z};G.defineMode=function(a){G.defaults.mode||"null"==a||(G.defaults.mode=a);ig.apply(this,arguments)};G.defineMIME=function(a,b){bb[a]=b};G.defineMode("null",function(){return{token:function(a){return a.skipToEnd()}}});G.defineMIME("text/plain","null");G.defineExtension=function(a,b){G.prototype[a]=b};G.defineDocExtension=function(a,b){Z.prototype[a]= b};G.fromTextArea=function(a,b){function c(){a.value=h.getValue()}b=b?Ga(b):{};b.value=a.value;!b.tabindex&&a.tabIndex&&(b.tabindex=a.tabIndex);!b.placeholder&&a.placeholder&&(b.placeholder=a.placeholder);if(null==b.autofocus){var d=ra();b.autofocus=d==a||null!=a.getAttribute("autofocus")&&d==document.body}if(a.form&&(v(a.form,"submit",c),!b.leaveSubmitMethodAlone)){var e=a.form;var f=e.submit;try{var g=e.submit=function(){c();e.submit=f;e.submit();e.submit=g}}catch(k){}}b.finishInit=function(b){b.save= c;b.getTextArea=function(){return a};b.toTextArea=function(){b.toTextArea=isNaN;c();a.parentNode.removeChild(b.getWrapperElement());a.style.display="";a.form&&(ca(a.form,"submit",c),"function"==typeof a.form.submit&&(a.form.submit=f))}};a.style.display="none";var h=G(function(b){return a.parentNode.insertBefore(b,a.nextSibling)},b);return h};(function(a){a.off=ca;a.on=v;a.wheelEventPixels=Ag;a.Doc=Z;a.splitLines=Od;a.countColumn=fa;a.findColumn=Lc;a.isWordChar=Nc;a.Pass=Fc;a.signal=J;a.Line=gb;a.changeEnd= Ca;a.scrollbarModel=Se;a.Pos=r;a.cmpPos=A;a.modes=cd;a.mimeModes=bb;a.resolveMode=mc;a.getMode=dd;a.modeExtensions=cb;a.extendMode=jg;a.copyState=Ma;a.startState=fe;a.innerMode=ed;a.commands=Qb;a.keyMap=Pb;a.keyName=Df;a.isModifierKey=Af;a.lookupKey=mb;a.normalizeKeyMap=Mg;a.StringStream=L;a.SharedTextMarker=Ob;a.TextMarker=Da;a.LineWidget=Nb;a.e_preventDefault=V;a.e_stopPropagation=de;a.e_stop=ub;a.addClass=Fa;a.contains=ha;a.rmClass=Sa;a.keyNames=Ea})(G);G.version="5.28.0";return G}); import { oneOf } from '../../utils/assist'; import { checkConditions } from '../../mixins/check-conditions'; const SelectPlain = { name: 'cx-vui-select', template: '#cx-vui-select', mixins: [ checkConditions ], props: { value: { type: [String, Number, Array], default: '' }, size: { validator (value) { return oneOf( value, [ 'small', 'large', 'default', 'fullwidth' ] ); }, default: 'default' }, placeholder: { type: String, default: '' }, optionsList: { type: Array, default: function() { return []; } }, groupsList: { type: Array, default: function() { return []; } }, disabled: { type: Boolean, default: false }, readonly: { type: Boolean, default: false }, name: { type: String }, multiple: { type: Boolean, default: false }, elementId: { type: String }, conditions: { type: Array, default: function() { return []; } }, remote: { type: Boolean, default: false }, remoteCallback: { type: Function }, // Wrapper related props (should be passed into wrapper component) preventWrap: { type: Boolean, default: false }, label: { type: String }, description: { type: String }, wrapperCss: { type: Array, default: function() { return []; } }, }, data() { return { options: this.optionsList, currentValue: this.value, currentId: this.elementId, groups: this.groupsList, }; }, watch: { value( val ) { this.storeCurrentValue( val ); }, optionsList( options ) { this.setOptions( options ); }, }, created() { if ( this.multiple ) { if ( this.currentValue && 'object' !== typeof this.currentValue ) { this.currentValue = [ this.currentValue ]; } } else { if ( this.currentValue && 'object' === typeof this.currentValue ) { this.currentValue = this.currentValue[0]; } } }, mounted() { if ( ! this.currentId && this.name ) { this.currentId = 'cx_' + this.name; } if ( this.remote && this.remoteCallback ) { const promise = this.remoteCallback(); if ( promise && promise.then ) { promise.then( options => { if ( options ) { this.options = options; } } ); } } }, methods: { controlClasses() { var classesList = [ 'cx-vui-select' ] classesList.push( 'size-' + this.size ); return classesList; }, handleFocus ( event ) { this.$emit( 'on-focus', event ); }, handleBlur ( event ) { this.$emit( 'on-blur', event ); }, handleInput() { this.$emit( 'input', this.currentValue ); this.$emit( 'on-input', this.currentValue ); this.$emit( 'on-change', event ); }, storeCurrentValue( value ) { if ( this.multiple ) { if ( oneOf( value, this.currentValue ) ) { return; } if ( 'object' === typeof value ) { if ( '[object Array]' === Object.prototype.toString.call( value ) ) { this.currentValues.concat( value ); } else { this.currentValues.push( value ); } } else { this.currentValue.push( value ); } } else { if ( value === this.currentValue ) { return; } this.currentValue = value; } }, setOptions( options ) { this.options = options; }, isOptionSelected( option ) { if ( ! this.currentValue ) { return false; } if ( this.multiple ) { return oneOf( option.value, this.currentValue ); } else { return option.value === this.currentValue; } }, }, }; export default SelectPlain; Home - MEPSCOPE

MEP Design

Our team of experienced MEP engineers is committed to delivering high-quality MEP engineering design solutions for projects of all sizes. Let us help bring your project to life with our expertise and innovative solutions.

MEP Consulting

At MEPSCOPE, we offer comprehensive MEP consulting services to help you plan, design, and execute your projects with maximum efficiency and cost-effectiveness. From feasibility studies to project management, we've got you covered.

Customized PPE

Protect your workforce with our customizable personal protective equipment (PPE) solutions. We offer a range of PPE products to suit your specific needs and can customize them with your company logo or branding for a professional look.

Who We Are

We are a skilled MEP engineering design firm with real-world expertise.

MEP Systems are considered as the building’s central nervous system because they are in charge of making the structure suitable and comfortable for human occupancy.

Clients
0
Projects
0
Designs
0 +

Mepscope is revolutionary

Discover more about our services with our CEO’s introduction.

About Mepscope:
Mepscope is at the forefront of Engineering Services, delivering sustainable services/products to our customers. With a commitment to quality and a passion for innovation, we’re here to light up the path to progress.

Mepscope New Partnership

Our Partnership with Detect Asia, bringing efficient water management solutions to the Northern Province of Sri Lanka

Testimonials

Clients Testimonials

When it comes to building connections, we value transparency and a dedication to continuous improvement. Read what our customers have to say about us.

Murrey Engineering Consultancy CEO

I've had the pleasure of working with MEPSCOPE on a number of projects. They are competent, trustworthy, and a reliable partner. I would gladly suggest their services to everyone.

Smart Construction Management CEO

I've always been impressed by the professional delivery, the excellent communication, and the dedication of everyone involved. I'm looking forward to the next MEPSCOPE project!