// CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE /** * @license RequireJS text 2.0.5 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved. * Available via the MIT or new BSD license. * see: http://github.com/requirejs/text for details */ (function(e){if(typeof exports=="object"&&typeof module=="object")module.exports=e();else{if(typeof define=="function"&&define.amd)return define("libs/codemirror-4.8/lib/codemirror",[],e);this.CodeMirror=e()}})(function(){"use strict";function S(e,t){if(!(this instanceof S))return new S(e,t);this.options=t=t?zo(t):{},zo(fi,t,!1),H(t);var n=t.value;typeof n=="string"&&(n=new js(n,t.mode)),this.doc=n;var s=this.display=new x(e,n);s.wrapper.CodeMirror=this,M(this),A(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),t.autofocus&&!d&&er(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,draggingText:!1,highlight:new Do,keySeq:null},r&&i<11&&setTimeout(Wo(Zn,this,!0),20),rr(this),fu(),kn(this),this.curOp.forceUpdate=!0,Rs(this,n),t.autofocus&&!d||nu()==s.input?setTimeout(Wo(Pr,this),20):Hr(this);for(var o in li)li.hasOwnProperty(o)&&li[o](this,t[o],hi);R(this);for(var u=0;ut.maxLineLength&&(t.maxLineLength=n,t.maxLine=e)})}function H(e){var t=qo(e.gutters,"CodeMirror-linenumbers");t==-1&&e.lineNumbers?e.gutters=e.gutters.concat(["CodeMirror-linenumbers"]):t>-1&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}function B(e){return e.display.scroller.clientHeight-e.display.wrapper.clientHeightt.clientWidth;s&&t.scrollWidth<=t.clientWidth+1&&r>0&&!t.hScrollbarTakesSpace&&(s=!1);var o=i>t.clientHeight;o?(n.scrollbarV.style.display="block",n.scrollbarV.style.bottom=s?r+"px":"0",n.scrollbarV.firstChild.style.height=Math.max(0,i-t.clientHeight+(t.barHeight||n.scrollbarV.clientHeight))+"px"):(n.scrollbarV.style.display="",n.scrollbarV.firstChild.style.height="0"),s?(n.scrollbarH.style.display="block",n.scrollbarH.style.right=o?r+"px":"0",n.scrollbarH.firstChild.style.width=t.scrollWidth-t.clientWidth+(t.barWidth||n.scrollbarH.clientWidth)+"px"):(n.scrollbarH.style.display="",n.scrollbarH.firstChild.style.width="0"),s&&o?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=n.scrollbarFiller.style.width=r+"px"):n.scrollbarFiller.style.display="",s&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r+"px",n.gutterFiller.style.width=n.gutters.offsetWidth+"px"):n.gutterFiller.style.display="";if(!e.state.checkedOverlayScrollbar&&t.clientHeight>0){if(r===0){var u=v&&!c?"12px":"18px";n.scrollbarV.style.minWidth=n.scrollbarH.style.minHeight=u;var a=function(t){mo(t)!=n.scrollbarV&&mo(t)!=n.scrollbarH&&jn(e,ur)(t)};yo(n.scrollbarV,"mousedown",a),yo(n.scrollbarH,"mousedown",a)}e.state.checkedOverlayScrollbar=!0}}function I(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Kt(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,s=$s(t,r),o=$s(t,i);if(n&&n.ensure){var u=n.ensure.from.line,a=n.ensure.to.line;if(u=o)return{from:$s(t,Js(Us(t,a))-e.wrapper.clientHeight),to:a}}return{from:s,to:Math.max(o,s+1)}}function q(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;var r=z(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,s=r+"px";for(var o=0;o=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&Jn(e)==0)return!1;R(e)&&(Wn(e),t.dims=Y(e));var i=r.first+r.size,s=Math.max(t.visible.from-e.options.viewportMargin,r.first),o=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFromo&&n.viewTo-o<20&&(o=Math.min(i,n.viewTo)),E&&(s=rs(e.doc,s),o=is(e.doc,o));var u=s!=n.viewFrom||o!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;$n(e,s,o),n.viewOffset=Js(Us(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var a=Jn(e);if(!u&&a==0&&!t.force&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var f=nu();return a>4&&(n.lineDiv.style.display="none"),Z(e,n.updateLineNumbers,t.dims),a>4&&(n.lineDiv.style.display=""),f&&nu()!=f&&f.offsetHeight&&f.focus(),Zo(n.cursorDiv),Zo(n.selectionDiv),u&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,Xt(e,400)),n.updateLineNumbers=null,!0}function V(e,t){var n=t.force,r=t.viewport;for(var i=!0;;i=!1){if(i&&e.options.lineWrapping&&t.oldScrollerWidth!=e.display.scroller.clientWidth)n=!0;else{n=!1,r&&r.top!=null&&(r={top:Math.min(e.doc.height+Qt(e.display)-Lo-e.display.scroller.clientHeight,r.top)}),t.visible=I(e.display,e.doc,r);if(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}if(!X(e,t))break;Q(e);var s=j(e);Rt(e),J(e,s),F(e,s)}So(e,"update",e),(e.display.viewFrom!=t.oldViewFrom||e.display.viewTo!=t.oldViewTo)&&So(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo)}function $(e,t){var n=new W(e,t);if(X(e,n)){Q(e),V(e,n);var r=j(e);Rt(e),J(e,r),F(e,r)}}function J(e,t){e.display.sizer.style.minHeight=e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=Math.max(t.docHeight,t.clientHeight-Lo)+"px"}function K(e,t){e.display.sizer.offsetWidth+e.display.gutters.offsetWidth.001||l<-0.001){Xs(o.line,u),G(o.line);if(o.rest)for(var c=0;c-1&&(d=!1),et(e,h,l,n)),d&&(Zo(h.lineNumber),h.lineNumber.appendChild(document.createTextNode(U(e.options,l)))),u=h.node.nextSibling}l+=h.size}while(u)u=a(u)}function et(e,t,n,r){for(var i=0;i=0){var o=mt(s.from(),i.from()),u=vt(s.to(),i.to()),a=s.empty()?i.from()==i.head:s.from()==s.head;r<=t&&--t,e.splice(--r,2,new yt(a?u:o,a?o:u))}}return new gt(e,t)}function wt(e,t){return new gt([new yt(e,t||e)],0)}function Et(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function St(e,t){if(t.linen?ht(n,Us(e,n).text.length):xt(t,Us(e,t.line).text.length)}function xt(e,t){var n=e.ch;return n==null||n>t?ht(e.line,t):n<0?ht(e.line,0):e}function Tt(e,t){return t>=e.first&&t=s.ch:f.to>s.ch))){if(r){wo(l,"beforeCursorEnter");if(l.explicitlyCleared){if(!u.markedSpans)break;--a;continue}}if(!l.atomic)continue;var c=l.find(o<0?-1:1);if(pt(c,s)==0){c.ch+=o,c.ch<0?c.line>e.first?c=St(e,ht(c.line-1)):c=null:c.ch>u.text.length&&(c.line3&&(f(d,s.top,null,s.bottom),d=u,s.bottomc.bottom||p.bottom==c.bottom&&p.right>c.right)c=p;d0?t.blinker=setInterval(function(){t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function Xt(e,t){e.doc.mode.startState&&e.doc.frontier=e.display.viewTo)return;var n=+(new Date)+e.options.workTime,r=yi(t.mode,Jt(e,t.frontier)),i=[];t.iter(t.frontier,Math.min(t.first+t.size,e.display.viewTo+500),function(s){if(t.frontier>=e.display.viewFrom){var o=s.styles,u=bs(e,s,r,!0);s.styles=u.styles;var a=s.styleClasses,f=u.classes;f?s.styleClasses=f:a&&(s.styleClasses=null);var l=!o||o.length!=s.styles.length||a!=f&&(!a||!f||a.bgClass!=f.bgClass||a.textClass!=f.textClass);for(var c=0;!l&&cn)return Xt(e,e.options.workDelay),!0}),i.length&&Bn(e,function(){for(var t=0;to;--u){if(u<=s.first)return s.first;var a=Us(s,u-1);if(a.stateAfter&&(!n||u<=s.frontier))return u;var f=Po(a.text,null,e.options.tabSize);if(i==null||r>f)i=u-1,r=f}return i}function Jt(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return!0;var s=$t(e,t,n),o=s>r.first&&Us(r,s-1).stateAfter;return o?o=yi(r.mode,o):o=bi(r.mode),r.iter(s,t,function(n){Es(e,n.text,o);var u=s==t-1||s%5==0||s>=i.viewFrom&&s2&&s.push((a.bottom+f.top)/2-n.top)}}s.push(n.bottom-n.top)}}function Zt(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;rn)return{map:e.measure.maps[r],cache:e.measure.caches[r],before:!0}}function en(e,t){t=ts(t);var n=Vs(t),r=e.display.externalMeasured=new qn(e.doc,t,n);r.lineN=n;var i=r.built=Ns(e,r);return r.text=i.pre,eu(e.display.lineMeasure,i.pre),r}function tn(e,t,n,r){return sn(e,rn(e,t),n,r)}function nn(e,t){if(t>=e.display.viewFrom&&t=n.lineN&&tn)f=p-h,a=f-1,n>=p&&(l="right");if(a!=null){u=o[c+2],h==p&&s==(u.insertLeft?"left":"right")&&(l=s);if(s=="left"&&a==0)while(c&&o[c-2]==o[c-3]&&o[c-1].insertLeft)u=o[(c-=3)+2],l="left";if(s=="right"&&a==p-h)while(c0&&(l=s="right");var v;e.options.lineWrapping&&(v=u.getClientRects()).length>1?d=v[s=="right"?v.length-1:0]:d=u.getBoundingClientRect()}if(r&&i<9&&!a&&(!d||!d.left&&!d.right)){var m=u.parentNode.getClientRects()[0];m?d={left:m.left,right:m.left+Tn(e.display),top:m.top,bottom:m.bottom}:d=on}var g=d.top-t.rect.top,y=d.bottom-t.rect.top,b=(g+y)/2,w=t.view.measure.heights;for(var c=0;cn.from?o(e-1):o(e,r)}r=r||Us(e.doc,t.line),i||(i=rn(e,r));var a=Ks(r),f=t.ch;if(!a)return o(f);var l=Pu(a,f),c=u(f,l);return Du!=null&&(c.other=u(f,Du)),c}function yn(e,t){var n=0,t=St(e.doc,t);e.options.lineWrapping||(n=Tn(e.display)*t.ch);var r=Us(e.doc,t.line),i=Js(r)+Kt(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function bn(e,t,n,r){var i=ht(e,t);return i.xRel=r,n&&(i.outside=!0),i}function wn(e,t,n){var r=e.doc;n+=e.display.viewOffset;if(n<0)return bn(r.first,0,!0,-1);var i=$s(r,n),s=r.first+r.size-1;if(i>s)return bn(r.first+r.size-1,Us(r,s).text.length,!0,1);t<0&&(t=0);var o=Us(r,i);for(;;){var u=En(e,o,i,t,n),a=Zi(o),f=a&&a.find(0,!0);if(!a||!(u.ch>f.from.ch||u.ch==f.from.ch&&u.xRel>0))return u;i=Vs(o=f.to.line)}}function En(e,t,n,r,i){function f(r){var i=gn(e,ht(n,r),"line",t,a);return o=!0,s>i.bottom?i.left-u:sm)return bn(n,p,g,1);for(;;){if(l?p==h||p==Bu(t,h,1):p-h<=1){var y=r1?1:0);return w}var E=Math.ceil(c/2),S=h+E;if(l){S=h;for(var x=0;xr){p=S,m=T;if(g=o)m+=1e3;c=E}else h=S,d=T,v=o,c-=E}}function xn(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Sn==null){Sn=Go("pre");for(var t=0;t<49;++t)Sn.appendChild(document.createTextNode("x")),Sn.appendChild(Go("br"));Sn.appendChild(document.createTextNode("x"))}eu(e.measure,Sn);var n=Sn.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),Zo(e.measure),n||1}function Tn(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=Go("span","xxxxxxxxxx"),n=Go("pre",[t]);eu(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function kn(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,id:++Cn},Nn?Nn.ops.push(e.curOp):e.curOp.ownsGroup=Nn={ops:[e.curOp],delayedCallbacks:[]}}function Ln(e){var t=e.delayedCallbacks,n=0;do{for(;n=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new W(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function _n(e){e.updatedDisplay=e.mustUpdate&&X(e.cm,e.update)}function Dn(e){var t=e.cm,n=t.display;e.updatedDisplay&&Q(t),e.barMeasure=j(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=tn(t,n.maxLine,n.maxLine.text.length).left+3,e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo+Lo-n.scroller.clientWidth));if(e.updatedDisplay||e.selectionChanged)e.newSelectionNodes=It(t)}function Pn(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft1&&F(t),e.updatedDisplay&&V(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null);if(e.scrollTop!=null&&(n.scroller.scrollTop!=e.scrollTop||e.forceScroll)){var i=Math.max(0,Math.min(n.scroller.scrollHeight-n.scroller.clientHeight,e.scrollTop));n.scroller.scrollTop=n.scrollbarV.scrollTop=r.scrollTop=i}if(e.scrollLeft!=null&&(n.scroller.scrollLeft!=e.scrollLeft||e.forceScroll)){var o=Math.max(0,Math.min(n.scroller.scrollWidth-n.scroller.clientWidth,e.scrollLeft));n.scroller.scrollLeft=n.scrollbarH.scrollLeft=r.scrollLeft=o,q(t)}if(e.scrollToPos){var u=Yr(t,St(r,e.scrollToPos.from),St(r,e.scrollToPos.to),e.scrollToPos.margin);e.scrollToPos.isCursor&&t.state.focused&&Gr(t,u)}var a=e.maybeHiddenMarkers,f=e.maybeUnhiddenMarkers;if(a)for(var l=0;le.barMeasure.clientWidth&&e.barMeasure.scrollWidtht)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0;if(t>=i.viewTo)E&&rs(e.doc,t)i.viewFrom?Wn(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)Wn(e);else if(t<=i.viewFrom){var s=Vn(e,n,n+r,1);s?(i.view=i.view.slice(s.index),i.viewFrom=s.lineN,i.viewTo+=r):Wn(e)}else if(n>=i.viewTo){var s=Vn(e,t,t,-1);s?(i.view=i.view.slice(0,s.index),i.viewTo=s.lineN):Wn(e)}else{var o=Vn(e,t,t,-1),u=Vn(e,n,n+r,1);o&&u?(i.view=i.view.slice(0,o.index).concat(Rn(e,o.lineN,u.lineN)).concat(i.view.slice(u.index)),i.viewTo+=r):Wn(e)}var a=i.externalMeasured;a&&(n=i.lineN&&t=r.viewTo)return;var s=r.view[Xn(e,t)];if(s.node==null)return;var o=s.changes||(s.changes=[]);qo(o,n)==-1&&o.push(n)}function Wn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Xn(e,t){if(t>=e.display.viewTo)return null;t-=e.display.viewFrom;if(t<0)return null;var n=e.display.view;for(var r=0;r0){if(i==o.length-1)return null;s=a+o[i].size-t,i++}else s=a-t;t+=s,n+=s}while(rs(e.doc,n)!=n){if(i==(r<0?0:o.length-1))return null;n+=r*o[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function $n(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=Rn(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=Rn(e,t,r.viewFrom).concat(r.view):r.viewFromn&&(r.view=r.view.slice(0,Xn(e,n)))),r.viewTo=n}function Jn(e){var t=e.display.view,n=0;for(var r=0;r=9&&e.display.inputHasSelection===o||v&&/[\uf700-\uf7ff]/.test(o))return Zn(e),!1;var u=!e.curOp;u&&kn(e),e.display.shift=!1,o.charCodeAt(0)==8203&&s.sel==e.display.selForContextMenu&&!n&&(n="​");var a=0,f=Math.min(n.length,o.length);while(a1&&(Gn&&Gn.join("\n")==l?h=s.sel.ranges.length%Gn.length==0&&Ro(Gn,yu):c.length==s.sel.ranges.length&&(h=Ro(c,function(e){return[e]})));for(var p=s.sel.ranges.length-1;p>=0;p--){var d=s.sel.ranges[p],m=d.from(),g=d.to();a-1){ii(e,E.line,"smart");break}}else w.electricInput&&w.electricInput.test(Us(s,E.line).text.slice(0,E.ch))&&ii(e,E.line,"smart")}}return ni(e),e.curOp.updateInput=y,e.curOp.typing=!0,o.length>1e3||o.indexOf("\n")>-1?t.value=e.display.prevInput="":e.display.prevInput=o,u&&An(e),e.state.pasteIncoming=e.state.cutIncoming=!1,!0}function Zn(e,t){var n,s,o=e.doc;if(e.somethingSelected()){e.display.prevInput="";var u=o.sel.primary();n=wu&&(u.to().line-u.from().line>100||(s=e.getSelection()).length>1e3);var a=n?"-":s||e.getSelection();e.display.input.value=a,e.state.focused&&Io(e.display.input),r&&i>=9&&(e.display.inputHasSelection=a)}else t||(e.display.prevInput=e.display.input.value="",r&&i>=9&&(e.display.inputHasSelection=null));e.display.inaccurateSelection=n}function er(e){e.options.readOnly!="nocursor"&&(!d||nu()!=e.display.input)&&e.display.input.focus()}function tr(e){e.state.focused||(er(e),Pr(e))}function nr(e){return e.options.readOnly||e.doc.cantEdit}function rr(e){function n(){e.state.focused&&setTimeout(Wo(er,e),0)}function o(t){To(e,t)||vo(t)}function u(n){if(e.somethingSelected())Gn=e.getSelections(),t.inaccurateSelection&&(t.prevInput="",t.inaccurateSelection=!1,t.input.value=Gn.join("\n"),Io(t.input));else{var r=[],i=[];for(var s=0;s=9&&e.display.inputHasSelection&&(e.display.inputHasSelection=null),Qn(e)}),yo(t.input,"keydown",jn(e,Or)),yo(t.input,"keypress",jn(e,Dr)),yo(t.input,"focus",Wo(Pr,e)),yo(t.input,"blur",Wo(Hr,e)),e.options.dragDrop&&(yo(t.scroller,"dragstart",function(t){gr(e,t)}),yo(t.scroller,"dragenter",o),yo(t.scroller,"dragover",o),yo(t.scroller,"drop",jn(e,mr))),yo(t.scroller,"paste",function(n){if(sr(t,n))return;e.state.pasteIncoming=!0,er(e),Qn(e)}),yo(t.input,"paste",function(){if(s&&!e.state.fakedLastChar&&!(new Date-e.state.lastMiddleDown<200)){var n=t.input.selectionStart,r=t.input.selectionEnd;t.input.value+="$",t.input.selectionEnd=r,t.input.selectionStart=n,e.state.fakedLastChar=!0}e.state.pasteIncoming=!0,Qn(e)}),yo(t.input,"cut",u),yo(t.input,"copy",u),l&&yo(t.sizer,"mouseup",function(){nu()==t.input&&t.input.blur(),er(e)})}function ir(e){var t=e.display;if(t.lastWrapHeight==t.wrapper.clientHeight&&t.lastWrapWidth==t.wrapper.clientWidth)return;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,e.setSize()}function sr(e,t){for(var n=mo(t);n!=e.wrapper;n=n.parentNode)if(!n||n.ignoreEvents||n.parentNode==e.sizer&&n!=e.mover)return!0}function or(e,t,n,r){var i=e.display;if(!n){var s=mo(t);if(s==i.scrollbarH||s==i.scrollbarV||s==i.scrollbarFiller||s==i.gutterFiller)return null}var o,u,a=i.lineSpace.getBoundingClientRect();try{o=t.clientX-a.left,u=t.clientY-a.top}catch(t){return null}var f=wn(e,o,u),l;if(r&&f.xRel==1&&(l=Us(e.doc,f.line).text).length==f.ch){var c=Po(l,l.length,e.options.tabSize)-l.length;f=ht(f.line,Math.max(0,Math.round((o-Gt(e.display).left)/Tn(e.display))-c))}return f}function ur(e){if(To(this,e))return;var t=this,n=t.display;n.shift=e.shiftKey;if(sr(n,e)){s||(n.scroller.draggable=!1,setTimeout(function(){n.scroller.draggable=!0},100));return}if(dr(t,e))return;var r=or(t,e);window.focus();switch(go(e)){case 1:r?lr(t,e,r):mo(e)==n.scroller&&co(e);break;case 2:s&&(t.state.lastMiddleDown=+(new Date)),r&&kt(t.doc,r),setTimeout(Wo(er,t),20),co(e);break;case 3:b&&Br(t,e)}}function lr(e,t,n){setTimeout(Wo(tr,e),0);var r=+(new Date),i;fr&&fr.time>r-400&&pt(fr.pos,n)==0?i="triple":ar&&ar.time>r-400&&pt(ar.pos,n)==0?(i="double",fr={time:r,pos:n}):(i="single",ar={time:r,pos:n});var s=e.doc.sel,o=v?t.metaKey:t.ctrlKey;e.options.dragDrop&&cu&&!nr(e)&&i=="single"&&s.contains(n)>-1&&s.somethingSelected()?cr(e,t,n,o):hr(e,t,n,i,o)}function cr(e,t,n,o){var u=e.display,a=jn(e,function(f){s&&(u.scroller.draggable=!1),e.state.draggingText=!1,bo(document,"mouseup",a),bo(u.scroller,"drop",a),Math.abs(t.clientX-f.clientX)+Math.abs(t.clientY-f.clientY)<10&&(co(f),o||kt(e.doc,n),er(e),r&&i==9&&setTimeout(function(){document.body.focus(),er(e)},20))});s&&(u.scroller.draggable=!0),e.state.draggingText=a,u.scroller.dragDrop&&u.scroller.dragDrop(),yo(document,"mouseup",a),yo(u.scroller,"drop",a)}function hr(e,t,n,r,i){function p(t){if(pt(h,t)==0)return;h=t;if(r=="rect"){var i=[],s=e.options.tabSize,l=Po(Us(o,n.line).text,n.ch,s),c=Po(Us(o,t.line).text,t.ch,s),p=Math.min(l,c),d=Math.max(l,c);for(var v=Math.min(n.line,t.line),m=Math.min(e.lastLine(),Math.max(n.line,t.line));v<=m;v++){var g=Us(o,v).text,y=Ho(g,p,s);p==d?i.push(new yt(ht(v,y),ht(v,y))):g.length>y&&i.push(new yt(ht(v,y),ht(v,Ho(g,d,s))))}i.length||i.push(new yt(n,n)),Dt(o,bt(f.ranges.slice(0,a).concat(i),a),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var b=u,w=b.anchor,E=t;if(r!="single"){if(r=="double")var S=e.findWordAt(t);else var S=new yt(ht(t.line,0),St(o,ht(t.line+1,0)));pt(S.anchor,w)>0?(E=S.head,w=mt(b.from(),S.anchor)):(E=S.anchor,w=vt(b.to(),S.head))}var i=f.ranges.slice(0);i[a]=new yt(St(o,w),E),Dt(o,bt(i,a),Mo)}}function m(t){var n=++v,i=or(e,t,!0,r=="rect");if(!i)return;if(pt(i,h)!=0){tr(e),p(i);var u=I(s,o);(i.line>=u.to||i.lined.bottom?20:0;a&&setTimeout(jn(e,function(){if(v!=n)return;s.scroller.scrollTop+=a,m(t)}),50)}}function g(t){v=Infinity,co(t),er(e),bo(document,"mousemove",y),bo(document,"mouseup",b),o.history.lastSelOrigin=null}var s=e.display,o=e.doc;co(t);var u,a,f=o.sel;i&&!t.shiftKey?(a=o.sel.contains(n),a>-1?u=o.sel.ranges[a]:u=new yt(n,n)):u=o.sel.primary();if(t.altKey)r="rect",i||(u=new yt(n,n)),n=or(e,t,!0,!0),a=-1;else if(r=="double"){var l=e.findWordAt(n);e.display.shift||o.extend?u=Ct(o,u,l.anchor,l.head):u=l}else if(r=="triple"){var c=new yt(ht(n.line,0),St(o,ht(n.line+1,0)));e.display.shift||o.extend?u=Ct(o,u,c.anchor,c.head):u=c}else u=Ct(o,u,n);i?a>-1?At(o,a,u,Mo):(a=o.sel.ranges.length,Dt(o,bt(o.sel.ranges.concat([u]),a),{scroll:!1,origin:"*mouse"})):(a=0,Dt(o,new gt([u],0),Mo),f=o.sel);var h=n,d=s.wrapper.getBoundingClientRect(),v=0,y=jn(e,function(e){go(e)?m(e):g(e)}),b=jn(e,g);yo(document,"mousemove",y),yo(document,"mouseup",b)}function pr(e,t,n,r,i){try{var s=t.clientX,o=t.clientY}catch(t){return!1}if(s>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&co(t);var u=e.display,a=u.lineDiv.getBoundingClientRect();if(o>a.bottom||!Co(e,n))return po(t);o-=a.top-u.viewOffset;for(var f=0;f=s){var c=$s(e.doc,o),h=e.options.gutters[f];return i(e,n,e,c,h,t),po(t)}}}function dr(e,t){return pr(e,t,"gutterClick",!0,So)}function mr(e){var t=this;if(To(t,e)||sr(t.display,e))return;co(e),r&&(vr=+(new Date));var n=or(t,e,!0),i=e.dataTransfer.files;if(!n||nr(t))return;if(i&&i.length&&window.FileReader&&window.File){var s=i.length,o=Array(s),u=0,a=function(e,r){var i=new FileReader;i.onload=jn(t,function(){o[r]=i.result;if(++u==s){n=St(t.doc,n);var e={from:n,to:n,text:yu(o.join("\n")),origin:"paste"};Wr(t.doc,e),_t(t.doc,wt(n,Fr(e)))}}),i.readAsText(e)};for(var f=0;f-1){t.state.draggingText(e),setTimeout(Wo(er,t),20);return}try{var o=e.dataTransfer.getData("Text");if(o){if(t.state.draggingText&&(v?!e.metaKey:!e.ctrlKey))var l=t.listSelections();Pt(t.doc,wt(n,n));if(l)for(var f=0;fu.clientWidth||i&&u.scrollHeight>u.clientHeight))return;if(i&&v&&s)e:for(var f=n.target,l=o.view;f!=u;f=f.parentNode)for(var c=0;c=9&&(t.display.inputHasSelection=null),Qn(t)}function Pr(e){if(e.options.readOnly=="nocursor")return;e.state.focused||(wo(e,"focus",e),e.state.focused=!0,su(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(Zn(e),s&&setTimeout(Wo(Zn,e,!0),0))),Kn(e),Wt(e)}function Hr(e){e.state.focused&&(wo(e,"blur",e),e.state.focused=!1,iu(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Br(e,t){function h(){if(n.input.selectionStart!=null){var t=e.somethingSelected(),r=n.input.value="​"+(t?n.input.value:"");n.prevInput=t?"":"​",n.input.selectionStart=1,n.input.selectionEnd=r.length,n.selForContextMenu=e.doc.sel}}function p(){n.inputDiv.style.position="relative",n.input.style.cssText=l,r&&i<9&&(n.scrollbarV.scrollTop=n.scroller.scrollTop=u),Kn(e);if(n.input.selectionStart!=null){(!r||r&&i<9)&&h();var t=0,s=function(){n.selForContextMenu==e.doc.sel&&n.input.selectionStart==0?jn(e,wi.selectAll)(e):t++<10?n.detectingSelectAll=setTimeout(s,500):Zn(e)};n.detectingSelectAll=setTimeout(s,200)}}if(To(e,t,"contextmenu"))return;var n=e.display;if(sr(n,t)||jr(e,t))return;var o=or(e,t),u=n.scroller.scrollTop;if(!o||a)return;var f=e.options.resetSelectionOnContextMenu;f&&e.doc.sel.contains(o)==-1&&jn(e,Dt)(e.doc,wt(o),Oo);var l=n.input.style.cssText;n.inputDiv.style.position="absolute",n.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(t.clientY-5)+"px; left: "+(t.clientX-5)+"px; z-index: 1000; background: "+(r?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";if(s)var c=window.scrollY;er(e),s&&window.scrollTo(null,c),Zn(e),e.somethingSelected()||(n.input.value=n.prevInput=" "),n.selForContextMenu=e.doc.sel,clearTimeout(n.detectingSelectAll),r&&i>=9&&h();if(b){vo(t);var d=function(){bo(window,"mouseup",d),setTimeout(p,20)};yo(window,"mouseup",d)}else setTimeout(p,50)}function jr(e,t){return Co(e,"gutterContextMenu")?pr(e,t,"gutterContextMenu",!1,wo):!1}function Ir(e,t){if(pt(e,t.from)<0)return e;if(pt(e,t.to)<=0)return Fr(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+=Fr(t).ch-t.to.ch),ht(n,r)}function qr(e,t){var n=[];for(var r=0;r=0;--i)Xr(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text});else Xr(e,t)}function Xr(e,t){if(t.text.length==1&&t.text[0]==""&&pt(t.from,t.to)==0)return;var n=qr(e,t);eo(e,t,n,e.cm?e.cm.curOp.id:NaN),Jr(e,t,n,Ui(e,t));var r=[];qs(e,function(e,n){!n&&qo(r,e.history)==-1&&(lo(e.history,t),r.push(e.history)),Jr(e,t,null,Ui(e,t))})}function Vr(e,t,n){if(e.cm&&e.cm.state.suppressEdits)return;var r=e.history,i,s=e.sel,o=t=="undo"?r.done:r.undone,u=t=="undo"?r.undone:r.done;for(var a=0;a=0;--a){var c=i.changes[a];c.origin=t;if(l&&!zr(e,c,!1)){o.length=0;return}f.push(Gs(e,c));var h=a?qr(e,c):Fo(o);Jr(e,c,h,Wi(e,c)),!a&&e.cm&&e.cm.scrollIntoView({from:c.from,to:Fr(c)});var p=[];qs(e,function(e,t){!t&&qo(p,e.history)==-1&&(lo(e.history,c),p.push(e.history)),Jr(e,c,null,Wi(e,c))})}}function $r(e,t){if(t==0)return;e.first+=t,e.sel=new gt(Ro(e.sel.ranges,function(e){return new yt(ht(e.anchor.line+t,e.anchor.ch),ht(e.head.line+t,e.head.ch))}),e.sel.primIndex);if(e.cm){Un(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;re.lastLine())return;if(t.from.lines&&(t={from:t.from,to:ht(s,Us(e,s).text.length),text:[t.text[0]],origin:t.origin}),t.removed=zs(e,t.from,t.to),n||(n=qr(e,t)),e.cm?Kr(e.cm,t,r):Ds(e,t,r),Pt(e,n,Oo)}function Kr(e,t,n){var r=e.doc,i=e.display,s=t.from,o=t.to,u=!1,a=s.line;e.options.lineWrapping||(a=Vs(ts(Us(r,s.line))),r.iter(a,o.line+1,function(e){if(e==i.maxLine)return u=!0,!0})),r.sel.contains(t.from,t.to)>-1&&No(e),Ds(r,t,n,k(e)),e.options.lineWrapping||(r.iter(a,s.line+t.text.length,function(e){var t=D(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,u=!1)}),u&&(e.curOp.updateMaxLine=!0)),r.frontier=Math.min(r.frontier,s.line),Xt(e,400);var f=t.text.length-(o.line-s.line)-1;s.line==o.line&&t.text.length==1&&!_s(e.doc,t)?zn(e,s.line,"text"):Un(e,s.line,o.line+1,f);var l=Co(e,"changes"),c=Co(e,"change");if(c||l){var h={from:s,to:o,text:t.text,removed:t.removed,origin:t.origin};c&&So(e,"change",e,h),l&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(h)}e.display.selForContextMenu=null}function Qr(e,t,n,r,i){r||(r=n);if(pt(r,n)<0){var s=r;r=n,n=s}typeof t=="string"&&(t=yu(t)),Wr(e,{from:n,to:r,text:t,origin:i})}function Gr(e,t){if(To(e,"scrollCursorIntoView"))return;var n=e.display,r=n.sizer.getBoundingClientRect(),i=null;t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1);if(i!=null&&!h){var s=Go("div","​",null,"position: absolute; top: "+(t.top-n.viewOffset-Kt(e.display))+"px; height: "+(t.bottom-t.top+Lo)+"px; left: "+t.left+"px; width: 2px;");e.display.lineSpace.appendChild(s),s.scrollIntoView(i),e.display.lineSpace.removeChild(s)}}function Yr(e,t,n,r){r==null&&(r=0);for(var i=0;i<5;i++){var s=!1,o=gn(e,t),u=!n||n==t?o:gn(e,n),a=ei(e,Math.min(o.left,u.left),Math.min(o.top,u.top)-r,Math.max(o.left,u.left),Math.max(o.bottom,u.bottom)+r),f=e.doc.scrollTop,l=e.doc.scrollLeft;a.scrollTop!=null&&(yr(e,a.scrollTop),Math.abs(e.doc.scrollTop-f)>1&&(s=!0)),a.scrollLeft!=null&&(br(e,a.scrollLeft),Math.abs(e.doc.scrollLeft-l)>1&&(s=!0));if(!s)return o}}function Zr(e,t,n,r,i){var s=ei(e,t,n,r,i);s.scrollTop!=null&&yr(e,s.scrollTop),s.scrollLeft!=null&&br(e,s.scrollLeft)}function ei(e,t,n,r,i){var s=e.display,o=xn(e.display);n<0&&(n=0);var u=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:s.scroller.scrollTop,a=s.scroller.clientHeight-Lo,f={};i-n>a&&(i=n+a);var l=e.doc.height+Qt(s),c=nl-o;if(nu+a){var p=Math.min(n,(h?l:i)-a);p!=u&&(f.scrollTop=p)}var d=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:s.scroller.scrollLeft,v=s.scroller.clientWidth-Lo-s.gutters.offsetWidth,m=r-t>v;return m&&(r=t+v),t<10?f.scrollLeft=0:tv+d-3&&(f.scrollLeft=r+(m?0:10)-v),f}function ti(e,t,n){(t!=null||n!=null)&&ri(e),t!=null&&(e.curOp.scrollLeft=(e.curOp.scrollLeft==null?e.doc.scrollLeft:e.curOp.scrollLeft)+t),n!=null&&(e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+n)}function ni(e){ri(e);var t=e.getCursor(),n=t,r=t;e.options.lineWrapping||(n=t.ch?ht(t.line,t.ch-1):t,r=ht(t.line,t.ch+1)),e.curOp.scrollToPos={from:n,to:r,margin:e.options.cursorScrollMargin,isCursor:!0}}function ri(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=yn(e,t.from),r=yn(e,t.to),i=ei(e,Math.min(n.left,r.left),Math.min(n.top,r.top)-t.margin,Math.max(n.right,r.right),Math.max(n.bottom,r.bottom)+t.margin);e.scrollTo(i.scrollLeft,i.scrollTop)}}function ii(e,t,n,r){var i=e.doc,s;n==null&&(n="add"),n=="smart"&&(i.mode.indent?s=Jt(e,t):n="prev");var o=e.options.tabSize,u=Us(i,t),a=Po(u.text,null,o);u.stateAfter&&(u.stateAfter=null);var f=u.text.match(/^\s*/)[0],l;if(!r&&!/\S/.test(u.text))l=0,n="not";else if(n=="smart"){l=i.mode.indent(s,u.text.slice(f.length),u.text);if(l==Ao||l>150){if(!r)return;n="prev"}}n=="prev"?t>i.first?l=Po(Us(i,t-1).text,null,o):l=0:n=="add"?l=a+e.options.indentUnit:n=="subtract"?l=a-e.options.indentUnit:typeof n=="number"&&(l=a+n),l=Math.max(0,l);var c="",h=0;if(e.options.indentWithTabs)for(var p=Math.floor(l/o);p;--p)h+=o,c+=" ";h=0;t--)Qr(e.doc,"",r[t].from,r[t].to,"+delete");ni(e)})}function ui(e,t,n,r,i){function l(){var t=s+n;return t=e.first+e.size?f=!1:(s=t,a=Us(e,t))}function c(e){var t=(i?Bu:ju)(a,o,n,!0);if(t==null){if(!!e||!l())return f=!1;i?o=(n<0?Lu:ku)(a):o=n<0?a.text.length:0}else o=t;return!0}var s=t.line,o=t.ch,u=n,a=Us(e,s),f=!0;if(r=="char")c();else if(r=="column")c(!0);else if(r=="word"||r=="group"){var h=null,p=r=="group",d=e.cm&&e.cm.getHelper(t,"wordChars");for(var v=!0;;v=!1){if(n<0&&!c(!v))break;var m=a.text.charAt(o)||"\n",g=$o(m,d)?"w":p&&m=="\n"?"n":!p||/\s/.test(m)?null:"p";p&&!v&&!g&&(g="s");if(h&&h!=g){n<0&&(n=1,c());break}g&&(h=g);if(n>0&&!c(!v))break}}var y=Ft(e,ht(s,o),u,!0);return f||(y.hitSide=!0),y}function ai(e,t,n,r){var i=e.doc,s=t.left,o;if(r=="page"){var u=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);o=t.top+n*(u-(n<0?1.5:.5)*xn(e.display))}else r=="line"&&(o=n>0?t.bottom+3:t.top-3);for(;;){var a=wn(e,s,o);if(!a.outside)break;if(n<0?o<=0:o>=i.height){a.hitSide=!0;break}o+=n*5}return a}function ci(e,t,n,r){S.defaults[e]=t,n&&(li[e]=r?function(e,t,r){r!=hi&&n(e,t,r)}:n)}function Si(e){var t=e.split(/-(?!$)/),e=t[t.length-1],n,r,i,s;for(var o=0;o0||o==0&&s.clearWhenEmpty!==!1)return s;s.replacedWith&&(s.collapsed=!0,s.widgetNode=Go("span",[s.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||(s.widgetNode.ignoreEvents=!0),r.insertLeft&&(s.widgetNode.insertLeft=!0));if(s.collapsed){if(es(e,t.line,t,n,s)||t.line!=n.line&&es(e,n.line,t,n,s))throw new Error("Inserting collapsed marker partially overlapping an existing one");E=!0}s.addToHistory&&eo(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var u=t.line,a=e.cm,f;e.iter(u,n.line+1,function(e){a&&s.collapsed&&!a.options.lineWrapping&&ts(e)==a.display.maxLine&&(f=!0),s.collapsed&&u!=t.line&&Xs(e,0),Ii(e,new Bi(s,u==t.line?t.ch:null,u==n.line?n.ch:null)),++u}),s.collapsed&&e.iter(t.line,n.line+1,function(t){ss(e,t)&&Xs(t,0)}),s.clearOnEnter&&yo(s,"beforeCursorEnter",function(){s.clear()}),s.readOnly&&(w=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),s.collapsed&&(s.id=++Ai,s.atomic=!0);if(a){f&&(a.curOp.updateMaxLine=!0);if(s.collapsed)Un(a,t.line,n.line+1);else if(s.className||s.title||s.startStyle||s.endStyle)for(var l=t.line;l<=n.line;l++)zn(a,l,"text");s.atomic&&Bt(a.doc),So(a,"markerAdded",a,s)}return s}function _i(e,t,n,r,i){r=zo(r),r.shared=!1;var s=[Oi(e,t,n,r,i)],o=s[0],u=r.widgetNode;return qs(e,function(e){u&&(r.widgetNode=u.cloneNode(!0)),s.push(Oi(e,St(e,t),St(e,n),r,i));for(var a=0;a=t:s.to>t);(i||(i=[])).push(new Bi(o,s.from,a?null:s.to))}}return i}function Ri(e,t,n){if(e)for(var r=0,i;r=t:s.to>t);if(u||s.from==t&&o.type=="bookmark"&&(!n||s.marker.insertLeft)){var a=s.from==null||(o.inclusiveLeft?s.from<=t:s.from0&&u)for(var c=0;c0)continue;var l=[a,1],c=pt(f.from,u.from),h=pt(f.to,u.to);(c<0||!o.inclusiveLeft&&!c)&&l.push({from:f.from,to:u.from}),(h>0||!o.inclusiveRight&&!h)&&l.push({from:u.to,to:f.to}),i.splice.apply(i,l),a+=l.length-1}}return i}function Vi(e){var t=e.markedSpans;if(!t)return;for(var n=0;n=0&&c<=0||l<=0&&c>=0)continue;if(l<=0&&(pt(f.to,n)>0||a.marker.inclusiveRight&&i.inclusiveLeft)||l>=0&&(pt(f.from,r)<0||a.marker.inclusiveLeft&&i.inclusiveRight))return!0}}function ts(e){var t;while(t=Yi(e))e=t.find(-1,!0).line;return e}function ns(e){var t,n;while(t=Zi(e))e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function rs(e,t){var n=Us(e,t),r=ts(n);return n==r?t:Vs(r)}function is(e,t){if(t>e.lastLine())return t;var n=Us(e,t),r;if(!ss(e,n))return t;while(r=Zi(n))n=r.find(1,!0).line;return Vs(n)+1}function ss(e,t){var n=E&&t.markedSpans;if(n)for(var r,i=0;it.start)return s}throw new Error("Mode "+e.name+" failed to advance stream.")}function gs(e,t,n,r){function i(e){return{start:l.start,end:l.pos,string:l.current(),type:u||null,state:e?yi(s.mode,f):f}}var s=e.doc,o=s.mode,u;t=St(s,t);var a=Us(s,t.line),f=Jt(e,t.line,n),l=new ki(a.text,e.options.tabSize),c;r&&(c=[]);while((r||l.pose.options.maxHighlightLength?(u=!1,o&&Es(e,t,r,l.pos),l.pos=t.length,c=null):c=ds(ms(n,l,r,h),s);if(h){var p=h[0].name;p&&(c="m-"+(c?p+" "+c:p))}if(!u||f!=c)ae&&i.splice(a,1,e,i[a+1],r),a+=2,f=Math.min(e,r)}if(!t)return;if(u.opaque)i.splice(n,a-n,e,"cm-overlay "+t),a=n+2;else for(;na&&c.from<=a)break}if(c.to>=f)return e(n,r,i,s,o,u);e(n,r.slice(0,c.to-a),i,s,null,u),s=null,r=r.slice(c.to-a),a=c.to}}}function Os(e,t,n,r){var i=!r&&n.widgetNode;i&&(e.map.push(e.pos,e.pos+t,i),e.content.appendChild(i)),e.pos+=t}function Ms(e,t,n){var r=e.markedSpans,i=e.text,s=0;if(!r){for(var o=1;oa)?(b.to!=null&&c>b.to&&(c=b.to,p=""),w.className&&(h+=" "+w.className),w.startStyle&&b.from==a&&(d+=" "+w.startStyle),w.endStyle&&b.to==c&&(p+=" "+w.endStyle),w.title&&!v&&(v=w.title),w.collapsed&&(!m||Qi(m.marker,w)<0)&&(m=b)):b.from>a&&c>b.from&&(c=b.from),w.type=="bookmark"&&b.from==a&&w.widgetNode&&g.push(w)}if(m&&(m.from||0)==a){Os(t,(m.to==null?u+1:m.to)-a,m.marker,m.from==null);if(m.to==null)return}if(!m&&g.length)for(var y=0;y=u)break;var E=Math.min(u,c);for(;;){if(f){var S=a+f.length;if(!m){var x=S>E?f.slice(0,E-a):f;t.addToken(t,x,l?l+h:h,d,a+x.length==c?p:"",v)}if(S>=E){f=f.slice(E-a),a=E;break}a=S,d=""}f=i.slice(s,s=n[o++]),l=Ts(n[o++],t.cm.options)}}}function _s(e,t){return t.from.ch==0&&t.to.ch==0&&Fo(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Ds(e,t,n,r){function i(e){return n?n[e]:null}function s(e,n,i){hs(e,n,i,r),So(e,"change",e,t)}var o=t.from,u=t.to,a=t.text,f=Us(e,o.line),l=Us(e,u.line),c=Fo(a),h=i(a.length-1),p=u.line-o.line;if(_s(e,t)){for(var d=0,v=[];d1&&e.remove(o.line+1,p-1),e.insert(o.line+1,v)}So(e,"change",e,t)}function Ps(e){this.lines=e,this.parent=null;for(var t=0,n=0;t=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],s=i.chunkSize();if(t1&&!e.done[e.done.length-2].ranges)return e.done.pop(),Fo(e.done)}function eo(e,t,n,r){var i=e.history;i.undone.length=0;var s=+(new Date),o;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&e.cm&&i.lastModTime>s-e.cm.options.historyEventDelay||t.origin.charAt(0)=="*"))&&(o=Zs(i,i.lastOp==r))){var u=Fo(o.changes);pt(t.from,t.to)==0&&pt(t.from,u.to)==0?u.to=Fr(t):o.changes.push(Gs(e,t))}else{var a=Fo(i.done);(!a||!a.ranges)&&ro(e.sel,i.done),o={changes:[Gs(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=s,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,u||wo(e,"historyAdded")}function to(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 no(e,t,n,r){var i=e.history,s=r&&r.origin;n==i.lastSelOp||s&&i.lastSelOrigin==s&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==s||to(e,s,Fo(i.done),t))?i.done[i.done.length-1]=t:ro(t,i.done),i.lastSelTime=+(new Date),i.lastSelOrigin=s,i.lastSelOp=n,r&&r.clearRedo!==!1&&Ys(i.undone)}function ro(e,t){var n=Fo(t);n&&n.ranges&&n.equals(e)||t.push(e)}function io(e,t,n,r){var i=t["spans_"+e.id],s=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]={}))[s]=n.markedSpans),++s})}function so(e){if(!e)return null;for(var t=0,n;t-1&&(Fo(u)[c]=f[c],delete f[c])}}return i}function ao(e,t,n,r){n0}function ko(e){e.prototype.on=function(e,t){yo(this,e,t)},e.prototype.off=function(e,t){bo(this,e,t)}}function Do(){this.id=null}function Ho(e,t,n){for(var r=0,i=0;;){var s=e.indexOf(" ",r);s==-1&&(s=e.length);var o=s-r;if(s==e.length||i+o>=t)return r+Math.min(o,t-i);i+=s-r,i+=n-i%n,r=s+1;if(i>=t)return r}}function jo(e){while(Bo.length<=e)Bo.push(Fo(Bo)+" ");return Bo[e]}function Fo(e){return e[e.length-1]}function qo(e,t){for(var n=0;n-1&&Vo(e)?!0:t.test(e):Vo(e)}function Jo(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function Qo(e){return e.charCodeAt(0)>=768&&Ko.test(e)}function Go(e,t,n,r){var i=document.createElement(e);n&&(i.className=n),r&&(i.style.cssText=r);if(typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var s=0;s0;--t)e.removeChild(e.firstChild);return e}function eu(e,t){return Zo(e).appendChild(t)}function tu(e,t){if(e.contains)return e.contains(t);while(t=t.parentNode)if(t==e)return!0}function nu(){return document.activeElement}function ru(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}function ou(e,t){var n=e.split(" ");for(var r=0;r2&&!(r&&i<8))}return du?Go("span","​"):Go("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px")}function gu(e){if(mu!=null)return mu;var t=eu(e,document.createTextNode("AخA")),n=Yo(t,0,1).getBoundingClientRect();if(!n||n.left==n.right)return!1;var r=Yo(t,1,2).getBoundingClientRect();return mu=r.right-n.right<3}function Su(e){if(Eu!=null)return Eu;var t=eu(e,Go("span","x")),n=t.getBoundingClientRect(),r=Yo(t,0,1).getBoundingClientRect();return Eu=Math.abs(n.left-r.left)>1}function Tu(e,t,n,r){if(!e)return r(t,n,"ltr");var i=!1;for(var s=0;st||t==n&&o.to==t)r(Math.max(o.from,t),Math.min(o.to,n),o.level==1?"rtl":"ltr"),i=!0}i||r(t,n,"ltr")}function Nu(e){return e.level%2?e.to:e.from}function Cu(e){return e.level%2?e.from:e.to}function ku(e){var t=Ks(e);return t?Nu(t[0]):0}function Lu(e){var t=Ks(e);return t?Cu(Fo(t)):e.text.length}function Au(e,t){var n=Us(e.doc,t),r=ts(n);r!=n&&(t=Vs(r));var i=Ks(r),s=i?i[0].level%2?Lu(r):ku(r):0;return ht(t,s)}function Ou(e,t){var n,r=Us(e.doc,t);while(n=Zi(r))r=n.find(1,!0).line,t=null;var i=Ks(r),s=i?i[0].level%2?ku(r):Lu(r):r.text.length;return ht(t==null?Vs(r):t,s)}function Mu(e,t){var n=Au(e,t.line),r=Us(e.doc,n.line),i=Ks(r);if(!i||i[0].level==0){var s=Math.max(0,r.text.search(/\S/)),o=t.line==n.line&&t.ch<=s&&t.ch;return ht(n.line,o?0:s)}return n}function _u(e,t,n){var r=e[0].level;return t==r?!0:n==r?!1:tt)return n;if(i.from==t||i.to==t){if(r!=null)return _u(e,i.level,e[r].level)?(i.from!=i.to&&(Du=r),n):(i.from!=i.to&&(Du=n),r);r=n}}return r}function Hu(e,t,n,r){if(!r)return t+n;do t+=n;while(t>0&&Qo(e.text.charAt(t)));return t}function Bu(e,t,n,r){var i=Ks(e);if(!i)return ju(e,t,n,r);var s=Pu(i,t),o=i[s],u=Hu(e,t,o.level%2?-n:n,r);for(;;){if(u>o.from&&u0==o.level%2?o.to:o.from);o=i[s+=n];if(!o)return null;n>0==o.level%2?u=Hu(e,o.to,-1,r):u=Hu(e,o.from,1,r)}}function ju(e,t,n,r){var i=t+n;if(r)while(i>0&&Qo(e.text.charAt(i)))i+=n;return i<0||i>e.text.length?null:i}var e=/gecko\/\d/i.test(navigator.userAgent),t=/MSIE \d/.test(navigator.userAgent),n=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),r=t||n,i=r&&(t?document.documentMode||6:n[1]),s=/WebKit\//.test(navigator.userAgent),o=s&&/Qt\/\d+\.\d+/.test(navigator.userAgent),u=/Chrome\//.test(navigator.userAgent),a=/Opera\//.test(navigator.userAgent),f=/Apple Computer/.test(navigator.vendor),l=/KHTML\//.test(navigator.userAgent),c=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),h=/PhantomJS/.test(navigator.userAgent),p=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),d=p||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),v=p||/Mac/.test(navigator.platform),m=/win/i.test(navigator.platform),g=a&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);g&&(g=Number(g[1])),g&&g>=15&&(a=!1,s=!0);var y=v&&(o||a&&(g==null||g<12.11)),b=e||r&&i>=9,w=!1,E=!1,ht=S.Pos=function(e,t){if(!(this instanceof ht))return new ht(e,t);this.line=e,this.ch=t},pt=S.cmpPos=function(e,t){return e.line-t.line||e.ch-t.ch};gt.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t=0&&pt(e,r.to())<=0)return n}return-1}},yt.prototype={from:function(){return mt(this.anchor,this.head)},to:function(){return vt(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var on={left:0,right:0,top:0,bottom:0},Sn,Nn=null,Cn=0,Gn=null,ar,fr,vr=0,wr=0,Er=null;r?Er=-0.53:e?Er=15:u?Er=-0.7:f&&(Er=-1/3);var Nr=new Do,Ar=null,Fr=S.changeEnd=function(e){return e.text?ht(e.from.line+e.text.length-1,Fo(e.text).length+(e.text.length==1?e.from.ch:0)):e.to};S.prototype={constructor:S,focus:function(){window.focus(),er(this),Qn(this)},setOption:function(e,t){var n=this.options,r=n[e];if(n[e]==t&&e!="mode")return;n[e]=t,li.hasOwnProperty(e)&&jn(this,li[e])(this,t,r)},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](Ci(e))},removeKeyMap:function(e){var t=this.state.keyMaps;for(var n=0;n0&&At(this.doc,r,new yt(s,f[r].to()),Oo)}else i.head.line>n&&(ii(this,i.head.line,e,!0),n=i.head.line,r==this.doc.sel.primIndex&&ni(this))}}),getTokenAt:function(e,t){return gs(this,e,t)},getLineTokens:function(e,t){return gs(this,ht(e),t,!0)},getTokenTypeAt:function(e){e=St(this.doc,e);var t=ws(this,Us(this.doc,e.line)),n=0,r=(t.length-1)/2,i=e.ch,s;if(i==0)s=t[2];else for(;;){var o=n+r>>1;if((o?t[o*2-1]:0)>=i)r=o;else{if(!(t[o*2+1]r&&(e=r,n=!0);var i=Us(this.doc,e);return dn(this,i,{top:0,left:0},t||"page").top+(n?this.doc.height-Js(i):0)},defaultTextHeight:function(){return xn(this.display)},defaultCharWidth:function(){return Tn(this.display)},setGutterMarker:Fn(function(e,t,n){return si(this.doc,e,"gutter",function(e){var r=e.gutterMarkers||(e.gutterMarkers={});return r[t]=n,!n&&Jo(r)&&(e.gutterMarkers=null),!0})}),clearGutter:Fn(function(e){var t=this,n=t.doc,r=n.first;n.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&(n.gutterMarkers[e]=null,zn(t,r,"gutter"),Jo(n.gutterMarkers)&&(n.gutterMarkers=null)),++r})}),addLineWidget:Fn(function(e,t,n){return ls(this,e,t,n)}),removeLineWidget:function(e){e.clear()},lineInfo:function(e){if(typeof e=="number"){if(!Tt(this.doc,e))return null;var t=e;e=Us(this.doc,e);if(!e)return null}else{var t=Vs(e);if(t==null)return null}return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,n,r,i){var s=this.display;e=gn(this,St(this.doc,e));var o=e.bottom,u=e.left;t.style.position="absolute",s.sizer.appendChild(t);if(r=="over")o=e.top;else if(r=="above"||r=="near"){var a=Math.max(s.wrapper.clientHeight,this.doc.height),f=Math.max(s.sizer.clientWidth,s.lineSpace.clientWidth);(r=="above"||e.bottom+t.offsetHeight>a)&&e.top>t.offsetHeight?o=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=a&&(o=e.bottom),u+t.offsetWidth>f&&(u=f-t.offsetWidth)}t.style.top=o+"px",t.style.left=t.style.right="",i=="right"?(u=s.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):(i=="left"?u=0:i=="middle"&&(u=(s.sizer.clientWidth-t.offsetWidth)/2),t.style.left=u+"px"),n&&Zr(this,u,o,u+t.offsetWidth,o+t.offsetHeight)},triggerOnKeyDown:Fn(Or),triggerOnKeyPress:Fn(Dr),triggerOnKeyUp:_r,execCommand:function(e){if(wi.hasOwnProperty(e))return wi[e](this)},findPosH:function(e,t,n,r){var i=1;t<0&&(i=-1,t=-t);for(var s=0,o=St(this.doc,e);s0&&u(n.charAt(r-1)))--r;while(i.5)&&L(this),wo(this,"refresh",this)}),swapDoc:Fn(function(e){var t=this.doc;return t.cm=null,Rs(this,e),cn(this),Zn(this),this.scrollTo(e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,So(this,"swapDoc",this,t),t}),getInputField:function(){return this.display.input},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},ko(S);var fi=S.defaults={},li=S.optionHandlers={},hi=S.Init={toString:function(){return"CodeMirror.Init"}};ci("value","",function(e,t){e.setValue(t)},!0),ci("mode",null,function(e,t){e.doc.modeOption=t,T(e)},!0),ci("indentUnit",2,T,!0),ci("indentWithTabs",!1),ci("smartIndent",!0),ci("tabSize",4,function(e){N(e),cn(e),Un(e)},!0),ci("specialChars",/[\t\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,function(e,t){e.options.specialChars=new RegExp(t.source+(t.test(" ")?"":"| "),"g"),e.refresh()},!0),ci("specialCharPlaceholder",Cs,function(e){e.refresh()},!0),ci("electricChars",!0),ci("rtlMoveVisually",!m),ci("wholeLineUpdateBefore",!0),ci("theme","default",function(e){A(e),O(e)},!0),ci("keyMap","default",function(e,t,n){var r=Ci(t),i=n!=S.Init&&Ci(n);i&&i.detach&&i.detach(e,r),r.attach&&r.attach(e,i||null)}),ci("extraKeys",null),ci("lineWrapping",!1,C,!0),ci("gutters",[],function(e){H(e.options),O(e)},!0),ci("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?z(e.display)+"px":"0",e.refresh()},!0),ci("coverGutterNextToScrollbar",!1,F,!0),ci("lineNumbers",!1,function(e){H(e.options),O(e)},!0),ci("firstLineNumber",1,O,!0),ci("lineNumberFormatter",function(e){return e},O,!0),ci("showCursorWhenSelecting",!1,Rt,!0),ci("resetSelectionOnContextMenu",!0),ci("readOnly",!1,function(e,t){t=="nocursor"?(Hr(e),e.display.input.blur(),e.display.disabled=!0):(e.display.disabled=!1,t||Zn(e))}),ci("disableInput",!1,function(e,t){t||Zn(e)},!0),ci("dragDrop",!0),ci("cursorBlinkRate",530),ci("cursorScrollMargin",0),ci("cursorHeight",1,Rt,!0),ci("singleCursorHeightPerLine",!0,Rt,!0),ci("workTime",100),ci("workDelay",100),ci("flattenSpans",!0,N,!0),ci("addModeClass",!1,N,!0),ci("pollInterval",100),ci("undoDepth",200,function(e,t){e.doc.history.undoDepth=t}),ci("historyEventDelay",1250),ci("viewportMargin",10,function(e){e.refresh()},!0),ci("maxHighlightLength",1e4,N,!0),ci("moveInputWithCursor",!0,function(e,t){t||(e.display.inputDiv.style.top=e.display.inputDiv.style.left=0)}),ci("tabindex",null,function(e,t){e.display.input.tabIndex=t||""}),ci("autofocus",null);var pi=S.modes={},di=S.mimeModes={};S.defineMode=function(e,t){!S.defaults.mode&&e!="null"&&(S.defaults.mode=e),arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),pi[e]=t},S.defineMIME=function(e,t){di[e]=t},S.resolveMode=function(e){if(typeof e=="string"&&di.hasOwnProperty(e))e=di[e];else if(e&&typeof e.name=="string"&&di.hasOwnProperty(e.name)){var t=di[e.name];typeof t=="string"&&(t={name:t}),e=Uo(t,e),e.name=t.name}else if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return S.resolveMode("application/xml");return typeof e=="string"?{name:e}:e||{name:"null"}},S.getMode=function(e,t){var t=S.resolveMode(t),n=pi[t.name];if(!n)return S.getMode(e,"text/plain");var r=n(e,t);if(vi.hasOwnProperty(t.name)){var i=vi[t.name];for(var s in i){if(!i.hasOwnProperty(s))continue;r.hasOwnProperty(s)&&(r["_"+s]=r[s]),r[s]=i[s]}}r.name=t.name,t.helperType&&(r.helperType=t.helperType);if(t.modeProps)for(var s in t.modeProps)r[s]=t.modeProps[s];return r},S.defineMode("null",function(){return{token:function(e){e.skipToEnd()}}}),S.defineMIME("text/plain","null");var vi=S.modeExtensions={};S.extendMode=function(e,t){var n=vi.hasOwnProperty(e)?vi[e]:vi[e]={};zo(t,n)},S.defineExtension=function(e,t){S.prototype[e]=t},S.defineDocExtension=function(e,t){js.prototype[e]=t},S.defineOption=ci;var mi=[];S.defineInitHook=function(e){mi.push(e)};var gi=S.helpers={};S.registerHelper=function(e,t,n){gi.hasOwnProperty(e)||(gi[e]=S[e]={_global:[]}),gi[e][t]=n},S.registerGlobalHelper=function(e,t,n,r){S.registerHelper(e,t,r),gi[e]._global.push({pred:n,val:r})};var yi=S.copyState=function(e,t){if(t===!0)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},bi=S.startState=function(e,t,n){return e.startState?e.startState(t,n):!0};S.innerMode=function(e,t){while(e.innerMode){var n=e.innerMode(t);if(!n||n.mode==e)break;t=n.state,e=n.mode}return n||{mode:e,state:t}};var wi=S.commands={selectAll:function(e){e.setSelection(ht(e.firstLine(),0),ht(e.lastLine()),Oo)},singleSelection:function(e){e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Oo)},killLine:function(e){oi(e,function(t){if(t.empty()){var n=Us(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line0)i=new ht(i.line,i.ch+1),e.replaceRange(s.charAt(i.ch-1)+s.charAt(i.ch-2),ht(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var o=Us(e.doc,i.line-1).text;o&&e.replaceRange(s.charAt(0)+"\n"+o.charAt(o.length-1),ht(i.line-1,o.length-1),ht(i.line,1),"+transpose")}}n.push(new yt(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){Bn(e,function(){var t=e.listSelections().length;for(var n=0;n=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||undefined},next:function(){if(this.post},eatSpace:function(){var e=this.pos;while(/[\s\u00a0]/.test(this.string.charAt(this.pos)))++this.pos;return this.pos>e},skipToEnd:function(){this.pos=this.string.length},skipTo:function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},backUp:function(e){this.pos-=e},column:function(){return this.lastColumnPos0?null:(s&&t!==!1&&(this.pos+=s[0].length),s)}var r=function(e){return n?e.toLowerCase():e},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}}};var Li=S.TextMarker=function(e,t){this.lines=[],this.type=t,this.doc=e};ko(Li),Li.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;t&&kn(e);if(Co(this,"clear")){var n=this.find();n&&So(this,"clear",n.from,n.to)}var r=null,i=null;for(var s=0;se.display.maxLineLength&&(e.display.maxLine=a,e.display.maxLineLength=f,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&Un(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Bt(e.doc)),e&&So(e,"markerCleared",e,this),t&&An(e),this.parent&&this.parent.clear()},Li.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);var n,r;for(var i=0;i1||!(this.children[0]instanceof Ps))){var u=[];this.collapse(u),this.children=[new Ps(u)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){while(i.lines.length>50){var o=i.lines.splice(i.lines.length-25,25),u=new Ps(o);i.height-=u.height,this.children.splice(r+1,0,u),u.parent=this}this.maybeSpill()}break}e-=s}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new Hs(t);if(!e.parent){var r=new Hs(e.children);r.parent=e,e.children=[r,n],e=r}else{e.size-=n.size,e.height-=n.height;var i=qo(e.parent.children,e);e.parent.children.splice(i+1,0,n)}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var r=0;r=0;s--)Wr(this,r[s]);u?_t(this,u):this.cm&&ni(this.cm)}),undo:In(function(){Vr(this,"undo")}),redo:In(function(){Vr(this,"redo")}),undoSelection:In(function(){Vr(this,"undo",!0)}),redoSelection:In(function(){Vr(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){var e=this.history,t=0,n=0;for(var r=0;r=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=St(this,e),t=St(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(s){var o=s.markedSpans;if(o)for(var u=0;ua.to||a.from==null&&i!=e.line||i==t.line&&a.from>t.ch)&&(!n||n(a.marker))&&r.push(a.marker.parent||a.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-=i,++n}),St(this,ht(n,t))},indexFromPos:function(e){e=St(this,e);var t=e.ch;return e.linet&&(t=e.from),e.to!=null&&e.to=t)return o+(t-s);o+=u-s,o+=n-o%n,s=u+1}},Bo=[""],Io=function(e){e.select()};p?Io=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:r&&(Io=function(e){try{e.select()}catch(t){}}),[].indexOf&&(qo=function(e,t){return e.indexOf(t)}),[].map&&(Ro=function(e,t){return e.map(t)});var Xo=/[\u00df\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Vo=S.isWordChar=function(e){return/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||Xo.test(e))},Ko=/[\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]/,Yo;document.createRange?Yo=function(e,t,n){var r=document.createRange();return r.setEnd(e,n),r.setStart(e,t),r}:Yo=function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(i){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r},r&&i<11&&(nu=function(){try{return document.activeElement}catch(e){return document.body}});var iu=S.rmClass=function(e,t){var n=e.className,r=ru(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:"")}},su=S.addClass=function(e,t){var n=e.className;ru(t).test(n)||(e.className+=(n?" ":"")+t)},au=!1,cu=function(){if(r&&i<9)return!1;var e=Go("div");return"draggable"in e||"dragDrop"in e}(),hu,du,mu,yu=S.splitLines="\n\nb".split(/\n/).length!=3?function(e){var t=0,n=[],r=e.length;while(t<=r){var i=e.indexOf("\n",t);i==-1&&(i=e.length);var s=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),o=s.indexOf("\r");o!=-1?(n.push(s.slice(0,o)),t+=o+1):(n.push(s),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},bu=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){try{var t=e.ownerDocument.selection.createRange()}catch(n){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},wu=function(){var e=Go("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Eu=null,xu={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",107:"=",109:"-",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};S.keyNames=xu,function(){for(var e=0;e<10;e++)xu[e+48]=xu[e+96]=String(e);for(var e=65;e<=90;e++)xu[e]=String.fromCharCode(e);for(var e=1;e<=12;e++)xu[e+111]=xu[e+63235]="F"+e}();var Du,Fu=function(){function n(n){return n<=247?e.charAt(n):1424<=n&&n<=1524?"R":1536<=n&&n<=1773?t.charAt(n-1536):1774<=n&&n<=2220?"r":8192<=n&&n<=8203?"w":n==8204?"b":"L"}function f(e,t,n){this.level=e,this.from=t,this.to=n}var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,s=/[LRr]/,o=/[Lb1n]/,u=/[1n]/,a="L";return function(e){if(!r.test(e))return!1;var t=e.length,l=[];for(var c=0,h;c"))return v("=>","operator");if(n=="0"&&e.eat(/x/i))return e.eatWhile(/[\da-f]/i),v("number","number");if(/\d/.test(n))return e.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),v("number","number");if(n=="/")return e.eat("*")?(t.tokenize=y,y(e,t)):e.eat("/")?(e.skipToEnd(),v("comment","comment")):t.lastType=="operator"||t.lastType=="keyword c"||t.lastType=="sof"||/^[\[{}\(,;:]$/.test(t.lastType)?(h(e),e.eatWhile(/[gimy]/),v("regexp","string-2")):(e.eatWhile(l),v("operator","operator",e.current()));if(n=="`")return t.tokenize=b,b(e,t);if(n=="#")return e.skipToEnd(),v("error","error");if(l.test(n))return e.eatWhile(l),v("operator","operator",e.current());if(a.test(n)){e.eatWhile(a);var r=e.current(),i=f.propertyIsEnumerable(r)&&f[r];return i&&t.lastType!="."?v(i.type,i.style,r):v("variable","variable",r)}}function g(e){return function(t,n){var r=!1,i;if(s&&t.peek()=="@"&&t.match(c))return n.tokenize=m,v("jsonld-keyword","meta");while((i=t.next())!=null){if(i==e&&!r)break;r=!r&&i=="\\"}return r||(n.tokenize=m),v("string","string")}}function y(e,t){var n=!1,r;while(r=e.next()){if(r=="/"&&n){t.tokenize=m;break}n=r=="*"}return v("comment","comment")}function b(e,t){var n=!1,r;while((r=e.next())!=null){if(!n&&(r=="`"||r=="$"&&e.eat("{"))){t.tokenize=m;break}n=!n&&r=="\\"}return v("quasi","string-2",e.current())}function E(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var n=e.string.indexOf("=>",e.start);if(n<0)return;var r=0,i=!1;for(var s=n-1;s>=0;--s){var o=e.string.charAt(s),u=w.indexOf(o);if(u>=0&&u<3){if(!r){++s;break}if(--r==0)break}else if(u>=3&&u<6)++r;else if(a.test(o))i=!0;else if(i&&!r){++s;break}}i&&!r&&(t.fatArrowAt=s)}function x(e,t,n,r,i,s){this.indented=e,this.column=t,this.type=n,this.prev=i,this.info=s,r!=null&&(this.align=r)}function T(e,t){for(var n=e.localVars;n;n=n.next)if(n.name==t)return!0;for(var r=e.context;r;r=r.prev)for(var n=r.vars;n;n=n.next)if(n.name==t)return!0}function N(e,t,n,r,i){var s=e.cc;C.state=e,C.stream=i,C.marked=null,C.cc=s,C.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);for(;;){var u=s.length?s.pop():o?j:B;if(u(n,r)){while(s.length&&s[s.length-1].lex)s.pop()();return C.marked?C.marked:n=="variable"&&T(e,r)?"variable-2":t}}}function k(){for(var e=arguments.length-1;e>=0;e--)C.cc.push(arguments[e])}function L(){return k.apply(null,arguments),!0}function A(e){function t(t){for(var n=t;n;n=n.next)if(n.name==e)return!0;return!1}var r=C.state;if(r.context){C.marked="def";if(t(r.localVars))return;r.localVars={name:e,next:r.localVars}}else{if(t(r.globalVars))return;n.globalVars&&(r.globalVars={name:e,next:r.globalVars})}}function M(){C.state.context={prev:C.state.context,vars:C.state.localVars},C.state.localVars=O}function _(){C.state.localVars=C.state.context.vars,C.state.context=C.state.context.prev}function D(e,t){var n=function(){var n=C.state,r=n.indented;if(n.lexical.type=="stat")r=n.lexical.indented;else for(var i=n.lexical;i&&i.type==")"&&i.align;i=i.prev)r=i.indented;n.lexical=new x(r,C.stream.column(),e,null,n.lexical,t)};return n.lex=!0,n}function P(){var e=C.state;e.lexical.prev&&(e.lexical.type==")"&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function H(e){function t(n){return n==e?L():e==";"?k():L(t)}return t}function B(e,t){return e=="var"?L(D("vardef",t.length),it,H(";"),P):e=="keyword a"?L(D("form"),j,B,P):e=="keyword b"?L(D("form"),B,P):e=="{"?L(D("}"),tt,P):e==";"?L():e=="if"?(C.state.lexical.info=="else"&&C.state.cc[C.state.cc.length-1]==P&&C.state.cc.pop()(),L(D("form"),j,B,P,ft)):e=="function"?L(vt):e=="for"?L(D("form"),lt,B,P):e=="variable"?L(D("stat"),J):e=="switch"?L(D("form"),j,D("}","switch"),H("{"),tt,P,P):e=="case"?L(j,H(":")):e=="default"?L(H(":")):e=="catch"?L(D("form"),M,H("("),mt,H(")"),B,P,_):e=="module"?L(D("form"),M,Et,_,P):e=="class"?L(D("form"),gt,P):e=="export"?L(D("form"),St,P):e=="import"?L(D("form"),xt,P):k(D("stat"),j,H(";"),P)}function j(e){return I(e,!1)}function F(e){return I(e,!0)}function I(e,t){if(C.state.fatArrowAt==C.stream.start){var n=t?$:V;if(e=="(")return L(M,D(")"),Z(st,")"),P,H("=>"),n,_);if(e=="variable")return k(M,st,H("=>"),n,_)}var r=t?z:U;return S.hasOwnProperty(e)?L(r):e=="function"?L(vt,r):e=="keyword c"?L(t?R:q):e=="("?L(D(")"),q,Lt,H(")"),P,r):e=="operator"||e=="spread"?L(t?F:j):e=="["?L(D("]"),Ct,P,r):e=="{"?et(Q,"}",null,r):e=="quasi"?k(W,r):L()}function q(e){return e.match(/[;\}\)\],]/)?k():k(j)}function R(e){return e.match(/[;\}\)\],]/)?k():k(F)}function U(e,t){return e==","?L(j):z(e,t,!1)}function z(e,t,n){var r=n==0?U:z,i=n==0?j:F;if(e=="=>")return L(M,n?$:V,_);if(e=="operator")return/\+\+|--/.test(t)?L(r):t=="?"?L(j,H(":"),i):L(i);if(e=="quasi")return k(W,r);if(e==";")return;if(e=="(")return et(F,")","call",r);if(e==".")return L(K,r);if(e=="[")return L(D("]"),q,H("]"),P,r)}function W(e,t){return e!="quasi"?k():t.slice(t.length-2)!="${"?L(W):L(j,X)}function X(e){if(e=="}")return C.marked="string-2",C.state.tokenize=b,L(W)}function V(e){return E(C.stream,C.state),k(e=="{"?B:j)}function $(e){return E(C.stream,C.state),k(e=="{"?B:F)}function J(e){return e==":"?L(P,B):k(U,H(";"),P)}function K(e){if(e=="variable")return C.marked="property",L()}function Q(e,t){if(e=="variable"||C.style=="keyword")return C.marked="property",t=="get"||t=="set"?L(G):L(Y);if(e=="number"||e=="string")return C.marked=s?"property":C.style+" property",L(Y);if(e=="jsonld-keyword")return L(Y);if(e=="[")return L(j,H("]"),Y)}function G(e){return e!="variable"?k(Y):(C.marked="property",L(vt))}function Y(e){if(e==":")return L(F);if(e=="(")return k(vt)}function Z(e,t){function n(r){if(r==","){var i=C.state.lexical;return i.info=="call"&&(i.pos=(i.pos||0)+1),L(e,n)}return r==t?L():L(H(t))}return function(r){return r==t?L():k(e,n)}}function et(e,t,n){for(var r=3;r!?|~^]/,c=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,p,d,w="([{}])",S={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0,"jsonld-keyword":!0},C={state:null,column:null,marked:null,cc:null},O={name:"this",next:{name:"arguments"}};return P.lex=!0,{startState:function(e){var t={tokenize:m,lastType:"sof",cc:[],lexical:new x((e||0)-r,0,"block",!1),localVars:n.localVars,context:n.localVars&&{vars:n.localVars},indented:0};return n.globalVars&&typeof n.globalVars=="object"&&(t.globalVars=n.globalVars),t},token:function(e,t){e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),E(e,t));if(t.tokenize!=y&&e.eatSpace())return null;var n=t.tokenize(e,t);return p=="comment"?n:(t.lastType=p!="operator"||d!="++"&&d!="--"?p:"incdec",N(t,n,p,d,e))},indent:function(t,s){if(t.tokenize==y)return e.Pass;if(t.tokenize!=m)return 0;var o=s&&s.charAt(0),u=t.lexical;if(!/^\s*else\b/.test(s))for(var a=t.cc.length-1;a>=0;--a){var f=t.cc[a];if(f==P)u=u.prev;else if(f!=ft)break}u.type=="stat"&&o=="}"&&(u=u.prev),i&&u.type==")"&&u.prev.type=="stat"&&(u=u.prev);var l=u.type,c=o==l;return l=="vardef"?u.indented+(t.lastType=="operator"||t.lastType==","?u.info+1:0):l=="form"&&o=="{"?u.indented:l=="form"?u.indented+r:l=="stat"?u.indented+(t.lastType=="operator"||t.lastType==","?i||r:0):u.info=="switch"&&!c&&n.doubleIndentSwitch!=0?u.indented+(/^(?:case|default)\b/.test(s)?r:2*r):u.align?u.column+(c?0:1):u.indented+(c?0:r)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:o?null:"/*",blockCommentEnd:o?null:"*/",lineComment:o?null:"//",fold:"brace",helperType:o?"json":"javascript",jsonldMode:s,jsonMode:o}}),e.registerHelper("wordChars","javascript",/[\w$]/),e.defineMIME("text/javascript","javascript"),e.defineMIME("text/ecmascript","javascript"),e.defineMIME("application/javascript","javascript"),e.defineMIME("application/x-javascript","javascript"),e.defineMIME("application/ecmascript","javascript"),e.defineMIME("application/json",{name:"javascript",json:!0}),e.defineMIME("application/x-json",{name:"javascript",json:!0}),e.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),e.defineMIME("text/typescript",{name:"javascript",typescript:!0}),e.defineMIME("application/typescript",{name:"javascript",typescript:!0})}),function(e){typeof exports=="object"&&typeof module=="object"?e(require("../../lib/codemirror")):typeof define=="function"&&define.amd?define("libs/codemirror-4.8/addon/hint/xml-hint",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function n(n,r){var i=r&&r.schemaInfo,s=r&&r.quoteChar||'"';if(!i)return;var o=n.getCursor(),u=n.getTokenAt(o);if(/^<\/?$/.test(u.string)&&u.end==o.ch){var a=n.getTokenAt(t(o.line,o.ch+1));a.start==o.ch&&/\btag\b/.test(a.type)&&(u=a)}var f=e.innerMode(n.getMode(),u.state);if(f.mode.name!="xml")return;var l=[],c=!1,h,p=/\btag\b/.test(u.type)&&!/>$/.test(u.string),d=p&&/^\w/.test(u.string),v;if(d){var m=n.getLine(o.line).slice(Math.max(0,u.start-2),u.start),g=/<\/$/.test(m)?"close":/<$/.test(m)?"open":null;g&&(v=u.start-(g=="close"?2:1))}else p&&u.string=="<"?g="open":p&&u.string=="")}else{var b=i[f.state.tagName],x=b&&b.attrs,T=i["!attrs"];if(!x&&!T)return;if(!x)x=T;else if(T){var N={};for(var C in T)T.hasOwnProperty(C)&&(N[C]=T[C]);for(var C in x)x.hasOwnProperty(C)&&(N[C]=x[C]);x=N}if(u.type=="string"||u.string=="="){var m=n.getRange(t(o.line,Math.max(0,o.ch-60)),t(o.line,u.type=="string"?u.start:u.end)),k=m.match(/([^\s\u00a0=<>\"\']+)=$/),L;if(!k||!x.hasOwnProperty(k[1])||!(L=x[k[1]]))return;typeof L=="function"&&(L=L.call(this,n));if(u.type=="string"){h=u.string;var A=0;/['"]/.test(u.string.charAt(0))&&(s=u.string.charAt(0),h=u.string.slice(1),A++);var O=u.string.length;/['"]/.test(u.string.charAt(O-1))&&(s=u.string.charAt(O-1),h=u.string.substr(A,O-2)),c=!0}for(var E=0;E][<][=] [X]","device-aspect-ratio: X/Y","orientation:portrait","orientation:landscape","device-height: [X]","device-width: [X]"],u={attrs:{}},a={a:{attrs:{href:null,ping:null,type:null,media:o,target:n,hreflang:t}},abbr:u,acronym:u,address:u,applet:u,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:o,hreflang:t,type:null,shape:["default","rect","circle","poly"]}},article:u,aside:u,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["","autoplay"],loop:["","loop"],controls:["","controls"]}},b:u,base:{attrs:{href:null,target:n}},basefont:u,bdi:u,bdo:u,big:u,blockquote:{attrs:{cite:null}},body:u,br:u,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["","autofocus"],disabled:["","autofocus"],formenctype:s,formmethod:i,formnovalidate:["","novalidate"],formtarget:n,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:u,center:u,cite:u,code:u,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["","disabled"],checked:["","checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["","disabled"],multiple:["","multiple"]}},datalist:{attrs:{data:null}},dd:u,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["","open"]}},dfn:u,dir:u,div:u,dl:u,dt:u,em:u,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["","disabled"],form:null,name:null}},figcaption:u,figure:u,font:u,footer:u,form:{attrs:{action:null,name:null,"accept-charset":r,autocomplete:["on","off"],enctype:s,method:i,novalidate:["","novalidate"],target:n}},frame:u,frameset:u,h1:u,h2:u,h3:u,h4:u,h5:u,h6:u,head:{attrs:{},children:["title","base","link","style","meta","script","noscript","command"]},header:u,hgroup:u,hr:u,html:{attrs:{manifest:null},children:["head","body"]},i:u,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["","seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["","autofocus"],checked:["","checked"],disabled:["","disabled"],formenctype:s,formmethod:i,formnovalidate:["","novalidate"],formtarget:n,multiple:["","multiple"],readonly:["","readonly"],required:["","required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:u,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["","autofocus"],disabled:["","disabled"],keytype:["RSA"]}},label:{attrs:{"for":null,form:null}},legend:u,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:t,media:o,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:u,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:r,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:u,noframes:u,noscript:u,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["","typemustmatch"]}},ol:{attrs:{reversed:["","reversed"],start:null,type:["1","a","A","i","I"]}},optgroup:{attrs:{disabled:["","disabled"],label:null}},option:{attrs:{disabled:["","disabled"],label:null,selected:["","selected"],value:null}},output:{attrs:{"for":null,form:null,name:null}},p:u,param:{attrs:{name:null,value:null}},pre:u,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:u,rt:u,ruby:u,s:u,samp:u,script:{attrs:{type:["text/javascript"],src:null,async:["","async"],defer:["","defer"],charset:r}},section:u,select:{attrs:{form:null,name:null,size:null,autofocus:["","autofocus"],disabled:["","disabled"],multiple:["","multiple"]}},small:u,source:{attrs:{src:null,type:null,media:null}},span:u,strike:u,strong:u,style:{attrs:{type:["text/css"],media:o,scoped:null}},sub:u,summary:u,sup:u,table:u,tbody:u,td:{attrs:{colspan:null,rowspan:null,headers:null}},textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["","autofocus"],disabled:["","disabled"],readonly:["","readonly"],required:["","required"],wrap:["soft","hard"]}},tfoot:u,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:u,time:{attrs:{datetime:null}},title:u,tr:u,track:{attrs:{src:null,label:null,"default":null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:t}},tt:u,u:u,ul:u,"var":u,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["","autoplay"],mediagroup:["movie"],muted:["","muted"],controls:["","controls"]}},wbr:u},f={accesskey:["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9"],"class":null,contenteditable:["true","false"],contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["en","es"],spellcheck:["true","false"],style:null,tabindex:["1","2","3","4","5","6","7","8","9"],title:null,translate:["yes","no"],onclick:null,rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"]};l(u);for(var c in a)a.hasOwnProperty(c)&&a[c]!=u&&l(a[c]);e.htmlSchema=a,e.registerHelper("hint","html",h)}),function(e){typeof exports=="object"&&typeof module=="object"?e(require("../../lib/codemirror")):typeof define=="function"&&define.amd?define("libs/codemirror-4.8/addon/hint/show-hint",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function r(e,t){this.cm=e,this.options=this.buildOptions(t),this.widget=this.onClose=null}function i(e){return typeof e=="string"?e:e.text}function s(e,t){function s(e,r){var s;typeof r!="string"?s=function(e){return r(e,t)}:n.hasOwnProperty(r)?s=n[r]:s=r,i[e]=s}var n={Up:function(){t.moveFocus(-1)},Down:function(){t.moveFocus(1)},PageUp:function(){t.moveFocus(-t.menuSize()+1,!0)},PageDown:function(){t.moveFocus(t.menuSize()-1,!0)},Home:function(){t.setFocus(0)},End:function(){t.setFocus(t.length-1)},Enter:t.pick,Tab:t.pick,Esc:t.close},r=e.options.customKeys,i=r?{}:n;if(r)for(var o in r)r.hasOwnProperty(o)&&s(o,r[o]);var u=e.options.extraKeys;if(u)for(var o in u)u.hasOwnProperty(o)&&s(o,u[o]);return i}function o(e,t){while(t&&t!=e){if(t.nodeName.toUpperCase()==="LI"&&t.parentNode==e)return t;t=t.parentNode}}function u(r,u){this.completion=r,this.data=u;var a=this,f=r.cm,l=this.hints=document.createElement("ul");l.className="CodeMirror-hints",this.selectedHint=u.selectedHint||0;var c=u.list;for(var h=0;h0){var T=S.bottom-S.top,N=m.top-(m.bottom-S.top);if(N-T>0)l.style.top=(y=m.top-T)+"px",b=!1;else if(T>E){l.style.height=E-5+"px",l.style.top=(y=m.bottom-S.top)+"px";var C=f.getCursor();u.from.ch!=C.ch&&(m=f.cursorCoords(C),l.style.left=(g=m.left)+"px",S=l.getBoundingClientRect())}}var k=S.left-w;k>0&&(S.right-S.left>w&&(l.style.width=w-5+"px",k-=S.right-S.left-w),l.style.left=(g=m.left-k)+"px"),f.addKeyMap(this.keyMap=s(r,{moveFocus:function(e,t){a.changeActive(a.selectedHint+e,t)},setFocus:function(e){a.changeActive(e)},menuSize:function(){return a.screenAmount()},length:c.length,close:function(){r.close()},pick:function(){a.pick()},data:u}));if(r.options.closeOnUnfocus){var L;f.on("blur",this.onBlur=function(){L=setTimeout(function(){r.close()},100)}),f.on("focus",this.onFocus=function(){clearTimeout(L)})}var A=f.getScrollInfo();return f.on("scroll",this.onScroll=function(){var e=f.getScrollInfo(),t=f.getWrapperElement().getBoundingClientRect(),n=y+A.top-e.top,i=n-(window.pageYOffset||(document.documentElement||document.body).scrollTop);b||(i+=l.offsetHeight);if(i<=t.top||i>=t.bottom)return r.close();l.style.top=n+"px",l.style.left=g+A.left-e.left+"px"}),e.on(l,"dblclick",function(e){var t=o(l,e.target||e.srcElement);t&&t.hintId!=null&&(a.changeActive(t.hintId),a.pick())}),e.on(l,"click",function(e){var t=o(l,e.target||e.srcElement);t&&t.hintId!=null&&(a.changeActive(t.hintId),r.options.completeOnSingleClick&&a.pick())}),e.on(l,"mousedown",function(){setTimeout(function(){f.focus()},20)}),e.signal(u,"select",c[0],l.firstChild),!0}var t="CodeMirror-hint",n="CodeMirror-hint-active";e.showHint=function(e,t,n){if(!t)return e.showHint(n);n&&n.async&&(t.async=!0);var r={hint:t};if(n)for(var i in n)r[i]=n[i];return e.showHint(r)},e.defineExtension("showHint",function(t){if(this.listSelections().length>1||this.somethingSelected())return;this.state.completionActive&&this.state.completionActive.close();var n=this.state.completionActive=new r(this,t),i=n.options.hint;if(!i)return;e.signal(this,"startCompletion",this);if(!i.async)return n.showHints(i(this,n.options));i(this,function(e){n.showHints(e)},n.options)}),r.prototype={close:function(){if(!this.active())return;this.cm.state.completionActive=null,this.widget&&this.widget.close(),this.onClose&&this.onClose(),e.signal(this.cm,"endCompletion",this.cm)},active:function(){return this.cm.state.completionActive==this},pick:function(t,n){var r=t.list[n];r.hint?r.hint(this.cm,t,r):this.cm.replaceRange(i(r),r.from||t.from,r.to||t.to,"complete"),e.signal(t,"pick",r),this.close()},showHints:function(e){if(!e||!e.list.length||!this.active())return this.close();this.options.completeSingle&&e.list.length==1?this.pick(e,0):this.showWidget(e)},showWidget:function(t){function c(){if(i)return;i=!0,r.close(),r.cm.off("cursorActivity",v),t&&e.signal(t,"close")}function h(){if(i)return;e.signal(t,"update");var n=r.options.hint;n.async?n(r.cm,p,r.options):p(n(r.cm,r.options))}function p(e){t=e;if(i)return;if(!t||!t.list.length)return c();r.widget&&r.widget.close(),r.widget=new u(r,t)}function d(){n&&(l(n),n=0)}function v(){d();var e=r.cm.getCursor(),t=r.cm.getLine(e.line);e.line!=o.line||t.length-e.ch!=a-o.ch||e.ch=this.data.list.length?t=r?this.data.list.length-1:0:t<0&&(t=r?0:this.data.list.length-1);if(this.selectedHint==t)return;var i=this.hints.childNodes[this.selectedHint];i.className=i.className.replace(" "+n,""),i=this.hints.childNodes[this.selectedHint=t],i.className+=" "+n,i.offsetTopthis.hints.scrollTop+this.hints.clientHeight&&(this.hints.scrollTop=i.offsetTop+i.offsetHeight-this.hints.clientHeight+3),e.signal(this.data,"select",this.data.list[this.selectedHint],i)},screenAmount:function(){return Math.floor(this.hints.clientHeight/this.hints.firstChild.offsetHeight)||1}},e.registerHelper("hint","auto",function(t,n){var r=t.getHelpers(t.getCursor(),"hint"),i;if(r.length)for(var s=0;s,]/,closeOnUnfocus:!0,completeOnSingleClick:!1,container:null,customKeys:null,extraKeys:null};e.defineOption("hintOptions",null)}),function(e){typeof exports=="object"&&typeof module=="object"?e(require("../../lib/codemirror")):typeof define=="function"&&define.amd?define("libs/codemirror-4.8/mode/xml/xml",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("xml",function(t,n){function l(e,t){function n(n){return t.tokenize=n,n(e,t)}var r=e.next();if(r=="<")return e.eat("!")?e.eat("[")?e.match("CDATA[")?n(p("atom","]]>")):null:e.match("--")?n(p("comment","-->")):e.match("DOCTYPE",!0,!0)?(e.eatWhile(/[\w\._\-]/),n(d(1))):null:e.eat("?")?(e.eatWhile(/[\w\._\-]/),t.tokenize=p("meta","?>"),"meta"):(a=e.eat("/")?"closeTag":"openTag",t.tokenize=c,"tag bracket");if(r=="&"){var i;return e.eat("#")?e.eat("x")?i=e.eatWhile(/[a-fA-F\d]/)&&e.eat(";"):i=e.eatWhile(/[\d]/)&&e.eat(";"):i=e.eatWhile(/[\w\.\-:]/)&&e.eat(";"),i?"atom":"error"}return e.eatWhile(/[^&<]/),null}function c(e,t){var n=e.next();if(n==">"||n=="/"&&e.eat(">"))return t.tokenize=l,a=n==">"?"endTag":"selfcloseTag","tag bracket";if(n=="=")return a="equals",null;if(n=="<"){t.tokenize=l,t.state=y,t.tagName=t.tagStart=null;var r=t.tokenize(e,t);return r?r+" tag error":"tag error"}return/[\'\"]/.test(n)?(t.tokenize=h(n),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function h(e){var t=function(t,n){while(!t.eol())if(t.next()==e){n.tokenize=c;break}return"string"};return t.isInAttribute=!0,t}function p(e,t){return function(n,r){while(!n.eol()){if(n.match(t)){r.tokenize=l;break}n.next()}return e}}function d(e){return function(t,n){var r;while((r=t.next())!=null){if(r=="<")return n.tokenize=d(e+1),n.tokenize(t,n);if(r==">"){if(e==1){n.tokenize=l;break}return n.tokenize=d(e-1),n.tokenize(t,n)}}return"meta"}}function v(e,t,n){this.prev=e.context,this.tagName=t,this.indent=e.indented,this.startOfLine=n;if(o.doNotIndent.hasOwnProperty(t)||e.context&&e.context.noIndent)this.noIndent=!0}function m(e){e.context&&(e.context=e.context.prev)}function g(e,t){var n;for(;;){if(!e.context)return;n=e.context.tagName;if(!o.contextGrabbers.hasOwnProperty(n)||!o.contextGrabbers[n].hasOwnProperty(t))return;m(e)}}function y(e,t,n){return e=="openTag"?(n.tagStart=t.column(),b):e=="closeTag"?w:y}function b(e,t,n){return e=="word"?(n.tagName=t.current(),f="tag",x):(f="error",b)}function w(e,t,n){if(e=="word"){var r=t.current();return n.context&&n.context.tagName!=r&&o.implicitlyClosed.hasOwnProperty(n.context.tagName)&&m(n),n.context&&n.context.tagName==r?(f="tag",E):(f="tag error",S)}return f="error",S}function E(e,t,n){return e!="endTag"?(f="error",E):(m(n),y)}function S(e,t,n){return f="error",E(e,t,n)}function x(e,t,n){if(e=="word")return f="attribute",T;if(e=="endTag"||e=="selfcloseTag"){var r=n.tagName,i=n.tagStart;return n.tagName=n.tagStart=null,e=="selfcloseTag"||o.autoSelfClosers.hasOwnProperty(r)?g(n,r):(g(n,r),n.context=new v(n,r,i==n.indented)),y}return f="error",x}function T(e,t,n){return e=="equals"?N:(o.allowMissing||(f="error"),x(e,t,n))}function N(e,t,n){return e=="string"?C:e=="word"&&o.allowUnquoted?(f="string",x):(f="error",x(e,t,n))}function C(e,t,n){return e=="string"?C:x(e,t,n)}var r=t.indentUnit,i=n.multilineTagIndentFactor||1,s=n.multilineTagIndentPastTag;s==null&&(s=!0);var o=n.htmlMode?{autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0}:{autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,caseFold:!1},u=n.alignCDATA,a,f;return{startState:function(){return{tokenize:l,state:y,indented:0,tagName:null,tagStart:null,context:null}},token:function(e,t){!t.tagName&&e.sol()&&(t.indented=e.indentation());if(e.eatSpace())return null;a=null;var n=t.tokenize(e,t);return(n||a)&&n!="comment"&&(f=null,t.state=t.state(a||n,e,t),f&&(n=f=="error"?n+" error":f)),n},indent:function(t,n,a){var f=t.context;if(t.tokenize.isInAttribute)return t.tagStart==t.indented?t.stringStartCol+1:t.indented+r;if(f&&f.noIndent)return e.Pass;if(t.tokenize!=c&&t.tokenize!=l)return a?a.match(/^(\s*)/)[0].length:0;if(t.tagName)return s?t.tagStart+t.tagName.length+2:t.tagStart+r*i;if(u&&/$/,blockCommentStart:"",configuration:n.htmlMode?"html":"xml",helperType:n.htmlMode?"html":"xml"}}),e.defineMIME("text/xml","xml"),e.defineMIME("application/xml","xml"),e.mimeModes.hasOwnProperty("text/html")||e.defineMIME("text/html",{name:"xml",htmlMode:!0})}),function(e){typeof exports=="object"&&typeof module=="object"?e(require("../../lib/codemirror")):typeof define=="function"&&define.amd?define("libs/codemirror-4.8/addon/runmode/runmode",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.runMode=function(t,n,r,i){var s=e.getMode(e.defaults,n),o=/MSIE \d/.test(navigator.userAgent),u=o&&(document.documentMode==null||document.documentMode<9);if(r.nodeType==1){var a=i&&i.tabSize||e.defaults.tabSize,f=r,l=0;f.innerHTML="",r=function(e,t){if(e=="\n"){f.appendChild(document.createTextNode(u?"\r":e)),l=0;return}var n="";for(var r=0;;){var i=e.indexOf(" ",r);if(i==-1){n+=e.slice(r),l+=e.length-r;break}l+=i-r,n+=e.slice(r,i);var s=a-l%a;l+=s;for(var o=0;o/im,s=/]*>\s*([\s\S]+)\s*<\/body>/im,o=typeof location!="undefined"&&location.href,u=o&&location.protocol&&location.protocol.replace(/\:/,""),a=o&&location.hostname,f=o&&(location.port||undefined),l=[],c=e.config&&e.config()||{};t={version:"2.0.5",strip:function(e){if(e){e=e.replace(i,"");var t=e.match(s);t&&(e=t[1])}else e="";return e},jsEscape:function(e){return e.replace(/(['\\])/g,"\\$1").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r").replace(/[\u2028]/g,"\\u2028").replace(/[\u2029]/g,"\\u2029")},createXhr:c.createXhr||function(){var e,t,n;if(typeof XMLHttpRequest!="undefined")return new XMLHttpRequest;if(typeof ActiveXObject!="undefined")for(t=0;t<3;t+=1){n=r[t];try{e=new ActiveXObject(n)}catch(i){}if(e){r=[n];break}}return e},parseName:function(e){var t,n,r,i=!1,s=e.indexOf("."),o=e.indexOf("./")===0||e.indexOf("../")===0;return s!==-1&&(!o||s>1)?(t=e.substring(0,s),n=e.substring(s+1,e.length)):t=e,r=n||t,s=r.indexOf("!"),s!==-1&&(i=r.substring(s+1)==="strip",r=r.substring(0,s),n?n=r:t=r),{moduleName:t,ext:n,strip:i}},xdRegExp:/^((\w+)\:)?\/\/([^\/\\]+)/,useXhr:function(e,n,r,i){var s,o,u,a=t.xdRegExp.exec(e);return a?(s=a[2],o=a[3],o=o.split(":"),u=o[1],o=o[0],(!s||s===n)&&(!o||o.toLowerCase()===r.toLowerCase())&&(!u&&!o||u===i)):!0},finishLoad:function(e,n,r,i){r=n?t.strip(r):r,c.isBuild&&(l[e]=r),i(r)},load:function(e,n,r,i){if(i.isBuild&&!i.inlineText){r();return}c.isBuild=i.isBuild;var s=t.parseName(e),l=s.moduleName+(s.ext?"."+s.ext:""),h=n.toUrl(l),p=c.useXhr||t.useXhr;!o||p(h,u,a,f)?t.get(h,function(n){t.finishLoad(e,s.strip,n,r)},function(e){r.error&&r.error(e)}):n([l],function(e){t.finishLoad(s.moduleName+"."+s.ext,s.strip,e,r)})},write:function(e,n,r,i){if(l.hasOwnProperty(n)){var s=t.jsEscape(l[n]);r.asModule(e+"!"+n,"define(function () { return '"+s+"';});\n")}},writeFile:function(e,n,r,i,s){var o=t.parseName(n),u=o.ext?"."+o.ext:"",a=o.moduleName+u,f=r.toUrl(o.moduleName+u)+".js";t.load(a,r,function(n){var r=function(e){return i(f,e)};r.asModule=function(e,t){return i.asModule(e,f,t)},t.write(e,a,r,s)},s)}};if(c.env==="node"||!c.env&&typeof process!="undefined"&&process.versions&&!!process.versions.node)n=require.nodeRequire("fs"),t.get=function(e,t){var r=n.readFileSync(e,"utf8");r.indexOf("")===0&&(r=r.substring(1)),t(r)};else if(c.env==="xhr"||!c.env&&t.createXhr())t.get=function(e,n,r,i){var s=t.createXhr(),o;s.open("GET",e,!0);if(i)for(o in i)i.hasOwnProperty(o)&&s.setRequestHeader(o.toLowerCase(),i[o]);c.onXhr&&c.onXhr(s,e),s.onreadystatechange=function(t){var i,o;s.readyState===4&&(i=s.status,i>399&&i<600?(o=new Error(e+" HTTP status: "+i),o.xhr=s,r(o)):n(s.responseText))},s.send(null)};else if(c.env==="rhino"||!c.env&&typeof Packages!="undefined"&&typeof java!="undefined")t.get=function(e,t){var n,r,i="utf-8",s=new java.io.File(e),o=java.lang.System.getProperty("line.separator"),u=new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(s),i)),a="";try{n=new java.lang.StringBuffer,r=u.readLine(),r&&r.length()&&r.charAt(0)===65279&&(r=r.substring(1)),n.append(r);while((r=u.readLine())!==null)n.append(o),n.append(r);a=String(n.toString())}finally{u.close()}t(a)};return t}),define("text!samples/hello.code",[],function(){return"var <%= name %> = React.createClass({\n render: <%= name %>RT\n});"}),define("text!samples/hello.rt",[],function(){return"

Hello world

\n"}),define("text!samples/todo.code",[],function(){return"var <%= name %> = React.createClass({\n mixins: [React.addons.LinkedStateMixin],\n getInitialState: function () {\n return {edited: '', todos: [], counter: 0};\n },\n add: function () {\n if (this.state.edited.trim().length === 0) {\n return;\n }\n var newTodo = {value: this.state.edited, done: false, key: this.state.counter};\n this.setState({todos: this.state.todos.concat(newTodo), edited: '', counter: this.state.counter + 1});\n },\n remove: function (todo) {\n this.setState({todos: _.reject(this.state.todos, todo)});\n },\n toggleChecked: function (index) {\n var todos = _.cloneDeep(this.state.todos);\n todos[index].done = !todos[index].done;\n this.setState({todos: todos});\n },\n clearDone: function () {\n this.setState({todos: this.getPending()});\n },\n getDone: function () {\n return _.filter(this.state.todos, {done: true});\n },\n getPending: function () {\n return _.filter(this.state.todos, {done: false});\n },\n render: <%= name %>RT\n});"}),define("text!samples/todo.rt",[],function(){return'
\n {this.getDone().length}\n done,\n {this.getPending().length}\n pending\n
\n
\n \n \n {todo.value}\n
\n \n
\n \n
'}),define("text!samples/rt-if.code",[],function(){return"var <%= name %> = React.createClass({\n getInitialState: function () {\n return {open: false};\n },\n toggle: function() {\n this.setState({open: !this.state.open});\n },\n render: <%= name %>RT\n});"}),define("text!samples/rt-if.rt",[],function(){return'
\n

\n Click to {this.state.open ? \'close\' : \'open\'}\n

\n

This is my paragraph. It opens and\n closes

\n
'}),define("text!samples/rt-props.code",[],function(){return"var <%= name %> = React.createClass({\n mixins: [React.addons.LinkedStateMixin],\n getInitialState: function() {\n return { key: 'color', val: 'blue' };\n },\n getProps: function() {\n var ret = { style: {\n color: 'black',\n backgroundColor: 'white',\n borderColor: 'black'\n }};\n ret.style[this.state.key] = this.state.val;\n return ret;\n },\n render: <%= name %>RT\n});"}),define("text!samples/rt-props.rt",[],function(){return'
\n Style:\n
\n Value:\n

\n
Sample
\n
'}),define("text!samples/rt-repeat.code",[],function(){return"var <%= name %> = React.createClass({\n getInitialState: function () {\n return {\n items: ['One', 'Two', 'Three']\n };\n },\n render: <%= name %>RT\n});"}),define("text!samples/rt-repeat.rt",[],function(){return'
\n
    \n
  • {item}
  • \n
\n
'}),define("text!samples/weather.code",[],function(){return"var <%= name %> = React.createClass({\n mixins: [React.addons.LinkedStateMixin],\n getInitialState: function() {\n this.cityIds = [5391959,293397,2643743];\n this.fetchWeather();\n return { loading: true, cityToAdd: '', info: [] };\n },\n addCity: function() {\n if (this.state.cityToAdd.trim() == '') {\n return;\n }\n this.setState({ loading: true, cityToAdd: '' });\n $.get('http://api.openweathermap.org/data/2.5/weather?q=' + this.state.cityToAdd, this.findCityCallback);\n },\n findCityCallback: function(result) {\n if (result.id && !_.contains(this.cityIds, result.id)) {\n this.cityIds.unshift(result.id);\n this.fetchWeather();\n } else {\n this.setState({ loading: false });\n }\n },\n refresh: function() {\n this.setState({ loading:true });\n this.fetchWeather();\n },\n fetchWeather: function() {\n $.get('http://api.openweathermap.org/data/2.5/group?id=' + this.cityIds.join(',') + '&units=metric', this.fetchWeatherCallback);\n },\n fetchWeatherCallback: function(result) {\n this.setState({ loading:false, info: result.list });\n },\n render: <%= name %>RT\n});"}),define("text!samples/weather.rt",[],function(){return'
\n

Cities weather report

\n \n \n
\n -- Loading --\n
\n
\n {cityIndex+1})\n \n {city.name}, {city.sys.country}\n
\n \n
'}),define("text!samples/rt-import.rt",[],function(){return'\n\n
\n myComp is just a regular tag\n
\n'}),define("examples",["lodash","react","./examples.rt","text!./samples/hello.code","text!./samples/hello.rt","text!./samples/todo.code","text!./samples/todo.rt","text!./samples/rt-if.code","text!./samples/rt-if.rt","text!./samples/rt-props.code","text!./samples/rt-props.rt","text!./samples/rt-repeat.code","text!./samples/rt-repeat.rt","text!./samples/weather.code","text!./samples/weather.rt","text!./samples/rt-import.rt"],function(e,t,n,r,i,s,o,u,a,f,l,c,h,p,d,v){"use strict";var m={hello:[r,i],todo:[s,o],props:[f,l],rtIf:[u,a],repeat:[c,h],weather:[p,d]};return m=e.mapValues(m,function(t,n){return{name:n,templateProps:e.template(t[0])({name:n}),templateHTML:t[1]}}),t.createClass({displayName:"Examples",mixins:[t.addons.LinkedStateMixin],getInitialState:function(){var e=window.reactTemplates.convertTemplateToReact(v,{modules:"amd",name:"template"}),t=window.reactTemplates.convertTemplateToReact(v,{modules:"commonjs",name:"template"}),n=window.reactTemplates.convertTemplateToReact(v,{modules:"es6",name:"template"});return{rtImport:{value:v},amd:{value:e},cjs:{value:t},es6:{value:n},samples:m}},render:n})}),requirejs.config({baseUrl:"./playground",paths:{lodash:"//cdnjs.cloudflare.com/ajax/libs/lodash.js/3.10.0/lodash.min",jquery:"//code.jquery.com/jquery-2.1.4.min",firebase:"https://cdn.firebase.com/js/client/2.0.5/firebase",react:"//cdnjs.cloudflare.com/ajax/libs/react/0.13.3/react-with-addons",text:"libs/requirejs-plugins/text",json:"libs/requirejs-plugins/json"},shim:{lodash:{exports:"_"},firebase:{exports:"Firebase"},jquery:{exports:"$"},react:{exports:"React"}},map:{"*":{"react/addons":"react"}}}),requirejs(["./examples","react","jquery"],function(e,t){"use strict";var n=t.createElement(e);t.render(n,document.getElementById("home-section"))}),define("home-main.js",function(){});