!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.GlslEditor=e()}}(function(){var e;return function t(e,n,r){function i(s,a){if(!n[s]){if(!e[s]){var l="function"==typeof require&&require;if(!a&&l)return l(s,!0);if(o)return o(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var u=n[s]={exports:{}};e[s][0].call(u.exports,function(t){var n=e[s][1][t];return i(n?n:t)},u,u.exports,t,e,n,r)}return n[s].exports}for(var o="function"==typeof require&&require,s=0;s=0;a--){var l=o[a].from(),c=o[a].to();l.line>=r||(c.line>=r&&(c=i(r,0)),r=l.line,null==s?t.uncomment(l,c,e)?s="un":(t.lineComment(l,c,e),s="line"):"un"==s?t.uncomment(l,c,e):t.lineComment(l,c,e))}}),e.defineExtension("lineComment",function(e,o,s){s||(s=n);var a=this,l=a.getModeAt(e),c=s.lineComment||l.lineComment;if(!c)return void((s.blockCommentStart||l.blockCommentStart)&&(s.fullLines=!0,a.blockComment(e,o,s)));var u=a.getLine(e.line);if(null!=u){var h=Math.min(0!=o.ch||o.line==e.line?o.line+1:o.line,a.lastLine()+1),f=null==s.padding?" ":s.padding,d=s.commentBlankLines||e.line==o.line;a.operation(function(){if(s.indent){for(var n=null,o=e.line;ou.length)&&(n=u)}for(var o=e.line;ou||s.operation(function(){if(0!=o.fullLines){var n=r.test(s.getLine(u));s.replaceRange(h+c,i(u)),s.replaceRange(l+h,i(e.line,0));var f=o.blockCommentLead||a.blockCommentLead;if(null!=f)for(var d=e.line+1;d<=u;++d)(d!=u||n)&&s.replaceRange(f+h,i(d,0))}else s.replaceRange(c,t),s.replaceRange(l,e)})}),e.defineExtension("uncomment",function(e,t,o){o||(o=n);var s,a=this,l=a.getModeAt(e),c=Math.min(0!=t.ch||t.line==e.line?t.line:t.line-1,a.lastLine()),u=Math.min(e.line,c),h=o.lineComment||l.lineComment,f=[],d=null==o.padding?" ":o.padding;e:if(h){for(var p=u;p<=c;++p){var g=a.getLine(p),m=g.indexOf(h);if(m>-1&&!/comment/.test(a.getTokenTypeAt(i(p,m+1)))&&(m=-1),m==-1&&(p!=c||p==u)&&r.test(g))break e;if(m>-1&&r.test(g.slice(0,m)))break e;f.push(g)}if(a.operation(function(){for(var e=u;e<=c;++e){var t=f[e-u],n=t.indexOf(h),r=n+h.length;n<0||(t.slice(r,r+d.length)==d&&(r+=d.length),s=!0,a.replaceRange("",i(e,n),i(e,r)))}}),s)return!0}var v=o.blockCommentStart||l.blockCommentStart,y=o.blockCommentEnd||l.blockCommentEnd;if(!v||!y)return!1;var b=o.blockCommentLead||l.blockCommentLead,w=a.getLine(u),x=c==u?w:a.getLine(c),C=w.indexOf(v),k=x.lastIndexOf(y);if(k==-1&&u!=c&&(x=a.getLine(--c),k=x.lastIndexOf(y)),C==-1||k==-1||!/comment/.test(a.getTokenTypeAt(i(u,C+1)))||!/comment/.test(a.getTokenTypeAt(i(c,k+1))))return!1;var S=w.lastIndexOf(v,e.ch),T=S==-1?-1:w.slice(0,e.ch).indexOf(y,S+v.length);if(S!=-1&&T!=-1&&T+y.length!=e.ch)return!1;T=x.indexOf(y,t.ch);var L=x.slice(t.ch).lastIndexOf(v,T-t.ch);return S=T==-1||L==-1?-1:t.ch+L,(T==-1||S==-1||S==t.ch)&&(a.operation(function(){a.replaceRange("",i(c,k-(d&&x.slice(k-d.length,k)==d?d.length:0)),i(c,k+y.length));var e=C+v.length;if(d&&w.slice(e,e+d.length)==d&&(e+=d.length),a.replaceRange("",i(u,C),i(u,e)),b)for(var t=u+1;t<=c;++t){var n=a.getLine(t),o=n.indexOf(b);if(o!=-1&&!r.test(n.slice(0,o))){var s=o+b.length;d&&n.slice(s,s+d.length)==d&&(s+=d.length),a.replaceRange("",i(t,o),i(t,s))}}}),!0)})})},{"../../lib/codemirror":30}],16:[function(t,n,r){!function(i){"object"==typeof r&&"object"==typeof n?i(t("../../lib/codemirror")):"function"==typeof e&&e.amd?e(["../../lib/codemirror"],i):i(CodeMirror)}(function(e){function t(e,t,n){var r,i=e.getWrapperElement();return r=i.appendChild(document.createElement("div")),n?r.className="CodeMirror-dialog CodeMirror-dialog-bottom":r.className="CodeMirror-dialog CodeMirror-dialog-top","string"==typeof t?r.innerHTML=t:r.appendChild(t),r}function n(e,t){e.state.currentNotificationClose&&e.state.currentNotificationClose(),e.state.currentNotificationClose=t}e.defineExtension("openDialog",function(r,i,o){function s(e){if("string"==typeof e)h.value=e;else{if(c)return;c=!0,l.parentNode.removeChild(l),u.focus(),o.onClose&&o.onClose(l)}}o||(o={}),n(this,null);var a,l=t(this,r,o.bottom),c=!1,u=this,h=l.getElementsByTagName("input")[0];return h?(o.value&&(h.value=o.value,o.selectValueOnOpen!==!1&&h.select()),o.onInput&&e.on(h,"input",function(e){o.onInput(e,h.value,s)}),o.onKeyUp&&e.on(h,"keyup",function(e){o.onKeyUp(e,h.value,s)}),e.on(h,"keydown",function(t){o&&o.onKeyDown&&o.onKeyDown(t,h.value,s)||((27==t.keyCode||o.closeOnEnter!==!1&&13==t.keyCode)&&(h.blur(),e.e_stop(t),s()),13==t.keyCode&&i(h.value,t))}),o.closeOnBlur!==!1&&e.on(h,"blur",s),h.focus()):(a=l.getElementsByTagName("button")[0])&&(e.on(a,"click",function(){s(),u.focus()}),o.closeOnBlur!==!1&&e.on(a,"blur",s),a.focus()),s}),e.defineExtension("openConfirm",function(r,i,o){function s(){c||(c=!0,a.parentNode.removeChild(a),u.focus())}n(this,null);var a=t(this,r,o&&o.bottom),l=a.getElementsByTagName("button"),c=!1,u=this,h=1;l[0].focus();for(var f=0;f=0;t--){var n=e.display.lineSpace.childNodes[t];/(^|\s)CodeMirror-ruler($|\s)/.test(n.className)&&n.parentNode.removeChild(n)}}function n(t){for(var n=t.getOption("rulers"),r=t.defaultCharWidth(),i=t.charCoords(e.Pos(t.firstLine(),0),"div").left,o=t.display.scroller.offsetHeight+30,s=0;s=0;a--){var u=s[a].head;n.replaceRange("",f(u.line,u.ch-1),f(u.line,u.ch+1))}}function o(n){var i=r(n),o=i&&t(i,"explode");if(!o||n.getOption("disableInput"))return e.Pass;for(var s=n.listSelections(),a=0;a0;return{anchor:new f(t.anchor.line,t.anchor.ch+(n?-1:1)),head:new f(t.head.line,t.head.ch+(n?1:-1))}}function a(n,i){var o=r(n);if(!o||n.getOption("disableInput"))return e.Pass;var a=t(o,"pairs"),c=a.indexOf(i);if(c==-1)return e.Pass;for(var h,d,p=t(o,"triples"),g=a.charAt(c+1)==i,m=n.listSelections(),v=c%2==0,y=0;y1&&p.indexOf(i)>=0&&n.getRange(f(x.line,x.ch-2),x)==i+i&&(x.ch<=2||n.getRange(f(x.line,x.ch-3),f(x.line,x.ch-2))!=i))b="addFour";else if(g){if(e.isWordChar(d)||!u(n,x,i))return e.Pass;b="both"}else{if(!v||n.getLine(x.line).length!=x.ch&&!l(d,a)&&!/\s/.test(d))return e.Pass;b="both"}else b=p.indexOf(i)>=0&&n.getRange(x,f(x.line,x.ch+3))==i+i+i?"skipThree":"skip";if(h){if(h!=b)return e.Pass}else h=b}var C=c%2?a.charAt(c-1):i,k=c%2?i:a.charAt(c+1);n.operation(function(){if("skip"==h)n.execCommand("goCharRight");else if("skipThree"==h)for(var e=0;e<3;e++)n.execCommand("goCharRight");else if("surround"==h){for(var t=n.getSelections(),e=0;e-1&&n%2==1}function c(e,t){var n=e.getRange(f(t.line,t.ch-1),f(t.line,t.ch+1));return 2==n.length?n:null}function u(t,n,r){var i=t.getLine(n.line),o=t.getTokenAt(n);if(/\bstring2?\b/.test(o.type))return!1;var s=new e.StringStream(i.slice(0,n.ch)+r+i.slice(n.ch),4);for(s.pos=s.start=o.start;;){var a=t.getMode().token(s,o.state);if(s.pos>=n.ch+1)return/\bstring2?\b/.test(a);s.start=s.pos}}var h={pairs:"()[]{}''\"\"",triples:"",explode:"[]{}"},f=e.Pos;e.defineOption("autoCloseBrackets",!1,function(t,n,r){r&&r!=e.Init&&(t.removeKeyMap(p),t.state.closeBrackets=null),n&&(t.state.closeBrackets=n,t.addKeyMap(p))});for(var d=h.pairs+"`",p={Backspace:i,Enter:o},g=0;g=0&&a[o.text.charAt(l)]||a[o.text.charAt(++l)];if(!c)return null;var u=">"==c.charAt(1)?1:-1;if(r&&u>0!=(l==t.ch))return null;var h=e.getTokenTypeAt(s(t.line,l+1)),f=n(e,s(t.line,l+(u>0?1:0)),u,h||null,i);return null==f?null:{from:s(t.line,l),to:f&&f.pos,match:f&&f.ch==c.charAt(0),forward:u>0}}function n(e,t,n,r,i){for(var o=i&&i.maxScanLineLength||1e4,l=i&&i.maxScanLines||1e3,c=[],u=i&&i.bracketRegex?i.bracketRegex:/[(){}[\]]/,h=n>0?Math.min(t.line+l,e.lastLine()+1):Math.max(e.firstLine()-1,t.line-l),f=t.line;f!=h;f+=n){var d=e.getLine(f);if(d){var p=n>0?0:d.length-1,g=n>0?d.length:-1;if(!(d.length>o))for(f==t.line&&(p=t.ch-(n<0?1:0));p!=g;p+=n){var m=d.charAt(p);if(u.test(m)&&(void 0===r||e.getTokenTypeAt(s(f,p+1))==r)){var v=a[m];if(">"==v.charAt(1)==n>0)c.push(m);else{if(!c.length)return{pos:s(f,p),ch:m};c.pop()}}}}}return f-n!=(n>0?e.lastLine():e.firstLine())&&null}function r(e,n,r){for(var i=e.state.matchBrackets.maxHighlightLineLength||1e3,a=[],l=e.listSelections(),c=0;c",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},l=null;e.defineOption("matchBrackets",!1,function(t,n,r){r&&r!=e.Init&&t.off("cursorActivity",i),n&&(t.state.matchBrackets="object"==typeof n?n:{},t.on("cursorActivity",i))}),e.defineExtension("matchBrackets",function(){r(this,!0)}),e.defineExtension("findMatchingBracket",function(e,n,r){return t(this,e,n,r)}),e.defineExtension("scanForBracket",function(e,t,r,i){return n(this,e,t,r,i)})})},{"../../lib/codemirror":30}],21:[function(t,n,r){!function(i){"object"==typeof r&&"object"==typeof n?i(t("../../lib/codemirror")):"function"==typeof e&&e.amd?e(["../../lib/codemirror"],i):i(CodeMirror)}(function(e){"use strict";function t(t,i,o,s){function a(e){var n=l(t,i);if(!n||n.to.line-n.from.linet.firstLine();)i=e.Pos(i.line-1,0),u=a(!1);if(u&&!u.cleared&&"unfold"!==s){var h=n(t,o);e.on(h,"mousedown",function(t){f.clear(),e.e_preventDefault(t)});var f=t.markText(u.from,u.to,{replacedWith:h,clearOnEnter:!0,__isFold:!0});f.on("clear",function(n,r){e.signal(t,"unfold",t,n,r)}),e.signal(t,"fold",t,u.from,u.to)}}function n(e,t){var n=r(e,t,"widget");if("string"==typeof n){var i=document.createTextNode(n);n=document.createElement("span"),n.appendChild(i),n.className="CodeMirror-foldmarker"}return n}function r(e,t,n){if(t&&void 0!==t[n])return t[n];var r=e.options.foldOptions;return r&&void 0!==r[n]?r[n]:i[n]}e.newFoldFunction=function(e,n){return function(r,i){t(r,i,{rangeFinder:e,widget:n})}},e.defineExtension("foldCode",function(e,n,r){t(this,e,n,r)}),e.defineExtension("isFolded",function(e){for(var t=this.findMarksAt(e),n=0;n=a&&(n=i(o.indicatorOpen))}e.setGutterMarker(t,o.gutter,n),++s})}function s(e){var t=e.getViewport(),n=e.state.foldGutter;n&&(e.operation(function(){o(e,t.from,t.to)}),n.from=t.from,n.to=t.to)}function a(e,t,n){var i=e.state.foldGutter;if(i){var o=i.options;if(n==o.gutter){var s=r(e,t);s?s.clear():e.foldCode(h(t,0),o.rangeFinder)}}}function l(e){var t=e.state.foldGutter;if(t){var n=t.options;t.from=t.to=0,clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout(function(){s(e)},n.foldOnChangeTimeSpan||600)}}function c(e){var t=e.state.foldGutter;if(t){var n=t.options;clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout(function(){var n=e.getViewport();t.from==t.to||n.from-t.to>20||t.from-n.to>20?s(e):e.operation(function(){n.fromt.to&&(o(e,t.to,n.to),t.to=n.to)})},n.updateViewportTimeSpan||400)}}function u(e,t){var n=e.state.foldGutter;if(n){var r=t.line;r>=n.from&&rs)a=l;else if(/\S/.test(u))break}return a?{from:e.Pos(n.line,i.length),to:e.Pos(a,t.getLine(a).length)}:void 0}})})},{"../../lib/codemirror":30}],24:[function(t,n,r){!function(i){"object"==typeof r&&"object"==typeof n?i(t("../../lib/codemirror")):"function"==typeof e&&e.amd?e(["../../lib/codemirror"],i):i(CodeMirror)}(function(e){function t(e,t){for(var n=0,r=e.length;no.ch&&(s.end=o.ch,s.string=s.string.slice(0,o.ch-s.start)):s={start:o.ch,end:o.ch,string:"",state:s.state,type:"."==s.string?"property":null};for(var c=s;"property"==c.type;){if(c=r(t,l(o.line,c.start)),"."!=c.string)return;if(c=r(t,l(o.line,c.start)),!u)var u=[];u.push(c)}return{list:a(s,u,n,i),from:l(o.line,s.start),to:l(o.line,s.end)}}}function i(e,t){return r(e,f,function(e,t){return e.getTokenAt(t)},t)}function o(e,t){var n=e.getTokenAt(t);return t.ch==n.start+1&&"."==n.string.charAt(0)?(n.end=n.start,n.string=".",n.type="property"):/^\.[\w$_]*$/.test(n.string)&&(n.type="property",n.start++,n.string=n.string.replace(/\./,"")),n}function s(e,t){return r(e,d,o,t)}function a(e,r,i,o){function s(e){0!=e.lastIndexOf(f,0)||n(l,e)||l.push(e)}function a(e){"string"==typeof e?t(c,s):e instanceof Array?t(u,s):e instanceof Function&&t(h,s);for(var n in e)s(n)}var l=[],f=e.string,d=o&&o.globalScope||window;if(r&&r.length){var p,g=r.pop();for(g.type&&0===g.type.indexOf("variable")?(o&&o.additionalContext&&(p=o.additionalContext[g.string]),o&&o.useGlobalScope===!1||(p=p||d[g.string])):"string"==g.type?p="":"atom"==g.type?p=1:"function"==g.type&&(null==d.jQuery||"$"!=g.string&&"jQuery"!=g.string||"function"!=typeof d.jQuery?null!=d._&&"_"==g.string&&"function"==typeof d._&&(p=d._()):p=d.jQuery());null!=p&&r.length;)p=p[r.pop().string];null!=p&&a(p)}else{for(var m=e.state.localVars;m;m=m.next)s(m.name);for(var m=e.state.globalVars;m;m=m.next)s(m.name);o&&o.useGlobalScope===!1||a(d),t(i,s)}return l}var l=e.Pos;e.registerHelper("hint","javascript",i),e.registerHelper("hint","coffeescript",s);var c="charAt charCodeAt indexOf lastIndexOf substring substr slice trim trimLeft trimRight toUpperCase toLowerCase split concat match replace search".split(" "),u="length concat join splice push pop shift unshift slice reverse sort indexOf lastIndexOf every some filter forEach map reduce reduceRight ".split(" "),h="prototype apply call bind".split(" "),f="break case catch continue debugger default delete do else false finally for function if in instanceof new null return switch throw true try typeof var void while with".split(" "),d="and break catch class continue delete do else extends false finally for if in instanceof isnt new no not null of off on or return switch then throw true try typeof until void while with yes".split(" ")})},{"../../lib/codemirror":30}],25:[function(t,n,r){!function(i){"object"==typeof r&&"object"==typeof n?i(t("../../lib/codemirror")):"function"==typeof e&&e.amd?e(["../../lib/codemirror"],i):i(CodeMirror)}(function(e){"use strict";function t(e,t){this.cm=e,this.options=t,this.widget=null,this.debounce=0,this.tick=0,this.startPos=this.cm.getCursor("start"),this.startLen=this.cm.getLine(this.startPos.line).length-this.cm.getSelection().length;var n=this;e.on("cursorActivity",this.activityFunc=function(){n.cursorActivity()})}function n(e,t,n){var r=e.options.hintOptions,i={};for(var o in d)i[o]=d[o];if(r)for(var o in r)void 0!==r[o]&&(i[o]=r[o]);if(n)for(var o in n)void 0!==n[o]&&(i[o]=n[o]);return i.hint.resolve&&(i.hint=i.hint.resolve(e,t)),i}function r(e){return"string"==typeof e?e:e.text}function i(e,t){function n(e,n){var i;i="string"!=typeof n?function(e){return n(e,t)}:r.hasOwnProperty(n)?r[n]:n,o[e]=i}var r={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},i=e.options.customKeys,o=i?{}:r;if(i)for(var s in i)i.hasOwnProperty(s)&&n(s,i[s]);var a=e.options.extraKeys;if(a)for(var s in a)a.hasOwnProperty(s)&&n(s,a[s]);return o}function o(e,t){for(;t&&t!=e;){if("LI"===t.nodeName.toUpperCase()&&t.parentNode==e)return t;t=t.parentNode}}function s(t,n){this.completion=t,this.data=n,this.picked=!1;var s=this,a=t.cm,l=this.hints=document.createElement("ul");l.className="CodeMirror-hints",this.selectedHint=n.selectedHint||0;for(var h=n.list,f=0;f0){var S=C.bottom-C.top,T=m.top-(m.bottom-C.top);if(T-S>0)l.style.top=(y=m.top-S)+"px",b=!1;else if(S>x){l.style.height=x-5+"px",l.style.top=(y=m.bottom-C.top)+"px";var L=a.getCursor();n.from.ch!=L.ch&&(m=a.cursorCoords(L),l.style.left=(v=m.left)+"px",C=l.getBoundingClientRect())}}var M=C.right-w;if(M>0&&(C.right-C.left>w&&(l.style.width=w-5+"px",M-=C.right-C.left-w),l.style.left=(v=m.left-M)+"px"),a.addKeyMap(this.keyMap=i(t,{moveFocus:function(e,t){s.changeActive(s.selectedHint+e,t)},setFocus:function(e){s.changeActive(e)},menuSize:function(){return s.screenAmount()},length:h.length,close:function(){t.close()},pick:function(){s.pick()},data:n})),t.options.closeOnUnfocus){var E;a.on("blur",this.onBlur=function(){E=setTimeout(function(){t.close()},100)}),a.on("focus",this.onFocus=function(){clearTimeout(E)})}var _=a.getScrollInfo();return a.on("scroll",this.onScroll=function(){var e=a.getScrollInfo(),n=a.getWrapperElement().getBoundingClientRect(),r=y+_.top-e.top,i=r-(window.pageYOffset||(document.documentElement||document.body).scrollTop);return b||(i+=l.offsetHeight),i<=n.top||i>=n.bottom?t.close():(l.style.top=r+"px",void(l.style.left=v+_.left-e.left+"px"))}),e.on(l,"dblclick",function(e){var t=o(l,e.target||e.srcElement);t&&null!=t.hintId&&(s.changeActive(t.hintId),s.pick())}),e.on(l,"click",function(e){var n=o(l,e.target||e.srcElement);n&&null!=n.hintId&&(s.changeActive(n.hintId),t.options.completeOnSingleClick&&s.pick())}),e.on(l,"mousedown",function(){setTimeout(function(){a.focus()},20)}),e.signal(n,"select",h[0],l.firstChild),!0}function a(e,t){if(!e.somethingSelected())return t;for(var n=[],r=0;r1)){if(this.somethingSelected()){if(!r.hint.supportsSelection)return;for(var o=0;o=this.data.list.length?t=n?this.data.list.length-1:0:t<0&&(t=n?0:this.data.list.length-1),this.selectedHint!=t){var r=this.hints.childNodes[this.selectedHint];r.className=r.className.replace(" "+u,""),r=this.hints.childNodes[this.selectedHint=t],r.className+=" "+u,r.offsetTopthis.hints.scrollTop+this.hints.clientHeight&&(this.hints.scrollTop=r.offsetTop+r.offsetHeight-this.hints.clientHeight+3),e.signal(this.data,"select",this.data.list[this.selectedHint],r)}},screenAmount:function(){return Math.floor(this.hints.clientHeight/this.hints.firstChild.offsetHeight)||1}},e.registerHelper("hint","auto",{resolve:l}),e.registerHelper("hint","fromList",function(t,n){var r=t.getCursor(),i=t.getTokenAt(r),o=e.Pos(r.line,i.end);if(i.string&&/\w/.test(i.string[i.string.length-1]))var s=i.string,a=e.Pos(r.line,i.start);else var s="",a=o;for(var l=[],c=0;c,]/,closeOnUnfocus:!0,completeOnSingleClick:!1,container:null,customKeys:null,extraKeys:null};e.defineOption("hintOptions",null)})},{"../../lib/codemirror":30}],26:[function(t,n,r){!function(i){"object"==typeof r&&"object"==typeof n?i(t("../../lib/codemirror"),t("./searchcursor"),t("../dialog/dialog")):"function"==typeof e&&e.amd?e(["../../lib/codemirror","./searchcursor","../dialog/dialog"],i):i(CodeMirror)}(function(e){"use strict";function t(e,t){return"string"==typeof e?e=new RegExp(e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),t?"gi":"g"):e.global||(e=new RegExp(e.source,e.ignoreCase?"gi":"g")),{token:function(t){e.lastIndex=t.pos;var n=e.exec(t.string);return n&&n.index==t.pos?(t.pos+=n[0].length,"searching"):void(n?t.pos=n.index:t.skipToEnd())}}}function n(){this.posFrom=this.posTo=this.lastQuery=this.query=null,this.overlay=null}function r(e){return e.state.search||(e.state.search=new n)}function i(e){return"string"==typeof e&&e==e.toLowerCase()}function o(e,t,n){return e.getSearchCursor(t,n,i(t))}function s(e,t,n,r){e.openDialog(t,r,{value:n,selectValueOnOpen:!0,closeOnEnter:!1,onClose:function(){p(e)}})}function a(e,t,n,r,i){e.openDialog?e.openDialog(t,i,{value:r,selectValueOnOpen:!0}):i(prompt(n,r))}function l(e,t,n,r){e.openConfirm?e.openConfirm(t,r):confirm(n)&&r[0]()}function c(e){return e.replace(/\\(.)/g,function(e,t){return"n"==t?"\n":"r"==t?"\r":t})}function u(e){var t=e.match(/^\/(.*)\/([a-z]*)$/);if(t)try{e=new RegExp(t[1],t[2].indexOf("i")==-1?"":"i")}catch(n){}else e=c(e);return("string"==typeof e?""==e:e.test(""))&&(e=/x^/),e}function h(e,n,r){n.queryText=r,n.query=u(r),e.removeOverlay(n.overlay,i(n.query)),n.overlay=t(n.query,i(n.query)),e.addOverlay(n.overlay),e.showMatchesOnScrollbar&&(n.annotate&&(n.annotate.clear(),n.annotate=null),n.annotate=e.showMatchesOnScrollbar(n.query,i(n.query)))}function f(t,n,i){var o=r(t);if(o.query)return d(t,n);var l=t.getSelection()||o.lastQuery;if(i&&t.openDialog){var c=null;s(t,v,l,function(n,r){e.e_stop(r),n&&(n!=o.queryText&&h(t,o,n),c&&(c.style.opacity=1),d(t,r.shiftKey,function(e,n){var r;n.line<3&&document.querySelector&&(r=t.display.wrapper.querySelector(".CodeMirror-dialog"))&&r.getBoundingClientRect().bottom-4>t.cursorCoords(n,"window").top&&((c=r).style.opacity=.4)}))})}else a(t,v,"Search for:",l,function(e){e&&!o.query&&t.operation(function(){h(t,o,e),o.posFrom=o.posTo=t.getCursor(),d(t,n)})})}function d(t,n,i){t.operation(function(){var s=r(t),a=o(t,s.query,n?s.posFrom:s.posTo);(a.find(n)||(a=o(t,s.query,n?e.Pos(t.lastLine()):e.Pos(t.firstLine(),0)),a.find(n)))&&(t.setSelection(a.from(),a.to()),t.scrollIntoView({from:a.from(),to:a.to()},20),s.posFrom=a.from(),s.posTo=a.to(),i&&i(a.from(),a.to()))})}function p(e){e.operation(function(){var t=r(e);t.lastQuery=t.query,t.query&&(t.query=t.queryText=null,e.removeOverlay(t.overlay),t.annotate&&(t.annotate.clear(),t.annotate=null))})}function g(e,t,n){e.operation(function(){for(var r=o(e,t);r.findNext();)if("string"!=typeof t){var i=e.getRange(r.from(),r.to()).match(t);r.replace(n.replace(/\$(\d)/g,function(e,t){return i[t]}))}else r.replace(n)})}function m(e,t){if(!e.getOption("readOnly")){var n=e.getSelection()||r(e).lastQuery,i=t?"Replace all:":"Replace:";a(e,i+y,i,n,function(n){n&&(n=u(n),a(e,b,"Replace with:","",function(r){if(r=c(r),t)g(e,n,r);else{p(e);var i=o(e,n,e.getCursor()),s=function(){var t,c=i.from();!(t=i.findNext())&&(i=o(e,n),!(t=i.findNext())||c&&i.from().line==c.line&&i.from().ch==c.ch)||(e.setSelection(i.from(),i.to()),e.scrollIntoView({from:i.from(),to:i.to()}),l(e,w,"Replace?",[function(){a(t)},s,function(){g(e,n,r)}]))},a=function(e){i.replace("string"==typeof n?r:r.replace(/\$(\d)/g,function(t,n){return e[n]})),s()};s()}}))})}}var v='Search: (Use /re/ syntax for regexp search)',y=' (Use /re/ syntax for regexp search)',b='With: ',w="Replace? ";e.commands.find=function(e){p(e),f(e)},e.commands.findPersistent=function(e){p(e),f(e,!1,!0)},e.commands.findNext=f,e.commands.findPrev=function(e){f(e,!0)},e.commands.clearSearch=p,e.commands.replace=m,e.commands.replaceAll=function(e){m(e,!0)}})},{"../../lib/codemirror":30,"../dialog/dialog":16,"./searchcursor":27}],27:[function(t,n,r){!function(i){"object"==typeof r&&"object"==typeof n?i(t("../../lib/codemirror")):"function"==typeof e&&e.amd?e(["../../lib/codemirror"],i):i(CodeMirror)}(function(e){"use strict";function t(e,t,i,o){if(this.atOccurrence=!1,this.doc=e,null==o&&"string"==typeof t&&(o=!1),i=i?e.clipPos(i):r(0,0),this.pos={from:i,to:i},"string"!=typeof t)t.global||(t=new RegExp(t.source,t.ignoreCase?"ig":"g")),this.matches=function(n,i){if(n){t.lastIndex=0;for(var o,s,a=e.getLine(i.line).slice(0,i.ch),l=0;;){t.lastIndex=l;var c=t.exec(a);if(!c)break;if(o=c,s=o.index,l=o.index+(o[0].length||1),l==a.length)break}var u=o&&o[0].length||0;u||(0==s&&0==a.length?o=void 0:s!=e.getLine(i.line).length&&u++)}else{t.lastIndex=i.ch;var a=e.getLine(i.line),o=t.exec(a),u=o&&o[0].length||0,s=o&&o.index;s+u==a.length||u||(u=1)}if(o&&u)return{from:r(i.line,s),to:r(i.line,s+u),match:o}};else{var s=t;o&&(t=t.toLowerCase());var a=o?function(e){return e.toLowerCase()}:function(e){return e},l=t.split("\n");if(1==l.length)t.length?this.matches=function(i,o){if(i){var l=e.getLine(o.line).slice(0,o.ch),c=a(l),u=c.lastIndexOf(t);if(u>-1)return u=n(l,c,u),{from:r(o.line,u),to:r(o.line,u+s.length)}}else{var l=e.getLine(o.line).slice(o.ch),c=a(l),u=c.indexOf(t);if(u>-1)return u=n(l,c,u)+o.ch,{from:r(o.line,u),to:r(o.line,u+s.length)}}}:this.matches=function(){};else{var c=s.split("\n");this.matches=function(t,n){var i=l.length-1;if(t){if(n.line-(l.length-1)=1;--u,--s)if(l[u]!=a(e.getLine(s)))return;var h=e.getLine(s),f=h.length-c[0].length;if(a(h.slice(f))!=l[0])return;return{from:r(s,f),to:o}}if(!(n.line+(l.length-1)>e.lastLine())){var h=e.getLine(n.line),f=h.length-c[0].length;if(a(h.slice(f))==l[0]){for(var d=r(n.line,f),s=n.line+1,u=1;un))return r;--r}}}var r=e.Pos;t.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(e){function t(e){var t=r(e,0);return n.pos={from:t,to:t},n.atOccurrence=!1,!1}for(var n=this,i=this.doc.clipPos(e?this.pos.from:this.pos.to);;){if(this.pos=this.matches(e,i))return this.atOccurrence=!0,this.pos.match||!0;if(e){if(!i.line)return t(0);i=r(i.line-1,this.doc.getLine(i.line-1).length)}else{var o=this.doc.lineCount();if(i.line==o-1)return t(o);i=r(i.line+1,0)}}},from:function(){if(this.atOccurrence)return this.pos.from},to:function(){if(this.atOccurrence)return this.pos.to},replace:function(t,n){if(this.atOccurrence){var i=e.splitLines(t);this.doc.replaceRange(i,this.pos.from,this.pos.to,n),this.pos.to=r(this.pos.from.line+i.length-1,i[i.length-1].length+(1==i.length?this.pos.from.ch:0))}}},e.defineExtension("getSearchCursor",function(e,n,r){return new t(this.doc,e,n,r)}),e.defineDocExtension("getSearchCursor",function(e,n,r){return new t(this,e,n,r)}),e.defineExtension("selectMatches",function(t,n){for(var r=[],i=this.getSearchCursor(t,this.getCursor("from"),n);i.findNext()&&!(e.cmpPos(i.to(),this.getCursor("to"))>0);)r.push({anchor:i.from(),head:i.to()});r.length&&this.setSelections(r,0)})})},{"../../lib/codemirror":30}],28:[function(t,n,r){!function(i){"object"==typeof r&&"object"==typeof n?i(t("../../lib/codemirror")):"function"==typeof e&&e.amd?e(["../../lib/codemirror"],i):i(CodeMirror)}(function(e){"use strict";function t(e,t,n){for(var r=n.paragraphStart||e.getHelper(t,"paragraphStart"),i=t.line,o=e.firstLine();i>o;--i){var s=e.getLine(i);if(r&&r.test(s))break;if(!/\S/.test(s)){++i;break}}for(var a=n.paragraphEnd||e.getHelper(t,"paragraphEnd"),l=t.line+1,c=e.lastLine();l<=c;++l){var s=e.getLine(l);if(a&&a.test(s)){++l;break}if(!/\S/.test(s))break}return{from:i,to:l}}function n(e,t,n,r){for(var i=t;i>0&&!n.test(e.slice(i-1,i+1));--i);for(var o=!0;;o=!1){var s=i;if(r)for(;" "==e.charAt(s-1);)--s;if(0!=s||!o)return{from:s,to:i};i=t}}function r(t,r,o,s){r=t.clipPos(r),o=t.clipPos(o);var a=s.column||80,l=s.wrapOn||/\s\S|-[^\.\d]/,c=s.killTrailingSpace!==!1,u=[],h="",f=r.line,d=t.getRange(r,o,!1);if(!d.length)return null;for(var p=d[0].match(/^[ \t]*/)[0],g=0;ga&&p==b&&n(h,a,l,c);w&&w.from==v&&w.to==v+y?(h=p+m,++f):u.push({text:[y?" ":""],from:i(f,v),to:i(f+1,b.length)})}for(;h.length>a;){var x=n(h,a,l,c);u.push({text:["",p],from:i(f,x.from),to:i(f,x.to)}),h=p+h.slice(x.to),++f}}return u.length&&t.operation(function(){for(var n=0;n=0;s--){var a,l=n[s];if(l.empty()){var c=t(e,l.head,{});a={from:i(c.from,0),to:i(c.to-1)}}else a={from:l.from(),to:l.to()};a.to.line>=o||(o=a.from.line,r(e,a.from,a.to,{}))}})},e.defineExtension("wrapRange",function(e,t,n){return r(this,e,t,n||{})}),e.defineExtension("wrapParagraphsInRange",function(e,n,o){o=o||{};for(var s=this,a=[],l=e.line;l<=n.line;){var c=t(s,i(l,0),o);a.push(c),l=c.to}var u=!1;return a.length&&s.operation(function(){for(var e=a.length-1;e>=0;--e)u=u||r(s,i(a[e].from,0),i(a[e].to-1),o)}),u})})},{"../../lib/codemirror":30}],29:[function(t,n,r){!function(i){"object"==typeof r&&"object"==typeof n?i(t("../lib/codemirror"),t("../addon/search/searchcursor"),t("../addon/edit/matchbrackets")):"function"==typeof e&&e.amd?e(["../lib/codemirror","../addon/search/searchcursor","../addon/edit/matchbrackets"],i):i(CodeMirror)}(function(e){"use strict";function t(t,n,r){if(r<0&&0==n.ch)return t.clipPos(f(n.line-1));var i=t.getLine(n.line);if(r>0&&n.ch>=i.length)return t.clipPos(f(n.line+1,0));for(var o,s="start",a=n.ch,l=r<0?0:i.length,c=0;a!=l;a+=r,c++){var u=i.charAt(r<0?a-1:a),h="_"!=u&&e.isWordChar(u)?"w":"o";if("w"==h&&u.toUpperCase()==u&&(h="W"),"start"==s)"o"!=h&&(s="in",o=h);else if("in"==s&&o!=h){if("w"==o&&"W"==h&&r<0&&a--,"W"==o&&"w"==h&&r>0){o="w";continue}break}}return f(n.line,a)}function n(e,n){e.extendSelectionsBy(function(r){return e.display.shift||e.doc.extend||r.empty()?t(e.doc,r.head,n):n<0?r.from():r.to()})}function r(e,t){e.operation(function(){for(var n=e.listSelections().length,r=[],i=-1,o=0;o=0;a--){var l=r[o[a]];if(!(c&&e.cmpPos(l.head,c)>0)){var u=i(t,l.head);c=u.from,t.replaceRange(n(u.word),u.from,u.to)}}})}function l(t){var n=t.getCursor("from"),r=t.getCursor("to");if(0==e.cmpPos(n,r)){var o=i(t,n);if(!o.word)return;n=o.from,r=o.to}return{from:n,to:r,query:t.getRange(n,r),word:o}}function c(e,t){var n=l(e);if(n){var r=n.query,i=e.getSearchCursor(r,t?n.to:n.from);(t?i.findNext():i.findPrevious())?e.setSelection(i.from(),i.to()):(i=e.getSearchCursor(r,t?f(e.firstLine(),0):e.clipPos(f(e.lastLine()))),(t?i.findNext():i.findPrevious())?e.setSelection(i.from(),i.to()):n.word&&e.setSelection(n.from,n.to))}}var u=e.keyMap.sublime={fallthrough:"default"},h=e.commands,f=e.Pos,d=e.keyMap["default"]==e.keyMap.macDefault,p=d?"Cmd-":"Ctrl-";h[u["Alt-Left"]="goSubwordLeft"]=function(e){n(e,-1)},h[u["Alt-Right"]="goSubwordRight"]=function(e){n(e,1)};var g=d?"Ctrl-Alt-":"Ctrl-";h[u[g+"Up"]="scrollLineUp"]=function(e){var t=e.getScrollInfo();if(!e.somethingSelected()){var n=e.lineAtHeight(t.top+t.clientHeight,"local");e.getCursor().line>=n&&e.execCommand("goLineUp")}e.scrollTo(null,t.top-e.defaultTextHeight())},h[u[g+"Down"]="scrollLineDown"]=function(e){var t=e.getScrollInfo();if(!e.somethingSelected()){var n=e.lineAtHeight(t.top,"local")+1;e.getCursor().line<=n&&e.execCommand("goLineDown")}e.scrollTo(null,t.top+e.defaultTextHeight())},h[u["Shift-"+p+"L"]="splitSelectionByLine"]=function(e){for(var t=e.listSelections(),n=[],r=0;ri.line&&s==o.line&&0==o.ch||n.push({anchor:s==i.line?i:f(s,0),head:s==o.line?o:f(s)});e.setSelections(n,0)},u["Shift-Tab"]="indentLess",h[u.Esc="singleSelectionTop"]=function(e){var t=e.listSelections()[0];e.setSelection(t.anchor,t.head,{scroll:!1})},h[u[p+"L"]="selectLine"]=function(e){for(var t=e.listSelections(),n=[],r=0;rr?n.push(a,l):n.length&&(n[n.length-1]=l),r=l}e.operation(function(){for(var t=0;te.lastLine()?e.replaceRange("\n"+s,f(e.lastLine()),null,"+swapLine"):e.replaceRange(s+"\n",f(o,0),null,"+swapLine")}e.setSelections(i),e.scrollIntoView()})},h[u[v+"Down"]="swapLineDown"]=function(e){for(var t=e.listSelections(),n=[],r=e.lastLine()+1,i=t.length-1;i>=0;i--){var o=t[i],s=o.to().line+1,a=o.from().line;0!=o.to().ch||o.empty()||s--,s=0;t-=2){var r=n[t],i=n[t+1],o=e.getLine(r);r==e.lastLine()?e.replaceRange("",f(r-1),f(r),"+swapLine"):e.replaceRange("",f(r,0),f(r+1,0),"+swapLine"),e.replaceRange(o+"\n",f(i,0),null,"+swapLine")}e.scrollIntoView()})},u[p+"/"]=function(e){e.toggleComment({indent:!0})},h[u[p+"J"]="joinLines"]=function(e){for(var t=e.listSelections(),n=[],r=0;r=0;n--)e.replaceRange("",t[n].anchor,f(t[n].to().line),"+delete");e.scrollIntoView()})},h[u[y+p+"U"]="upcaseAtCursor"]=function(e){a(e,function(e){return e.toUpperCase()})},h[u[y+p+"L"]="downcaseAtCursor"]=function(e){a(e,function(e){return e.toLowerCase()})},h[u[y+p+"Space"]="setSublimeMark"]=function(e){e.state.sublimeMark&&e.state.sublimeMark.clear(),e.state.sublimeMark=e.setBookmark(e.getCursor())},h[u[y+p+"A"]="selectToSublimeMark"]=function(e){var t=e.state.sublimeMark&&e.state.sublimeMark.find();t&&e.setSelection(e.getCursor(),t)},h[u[y+p+"W"]="deleteToSublimeMark"]=function(t){var n=t.state.sublimeMark&&t.state.sublimeMark.find();if(n){var r=t.getCursor(),i=n;if(e.cmpPos(r,i)>0){var o=i;i=r,r=o}t.state.sublimeKilled=t.getRange(r,i),t.replaceRange("",r,i)}},h[u[y+p+"X"]="swapWithSublimeMark"]=function(e){var t=e.state.sublimeMark&&e.state.sublimeMark.find();t&&(e.state.sublimeMark.clear(),e.state.sublimeMark=e.setBookmark(e.getCursor()),e.setCursor(t))},h[u[y+p+"Y"]="sublimeYank"]=function(e){null!=e.state.sublimeKilled&&e.replaceSelection(e.state.sublimeKilled,null,"paste")},u[y+p+"G"]="clearBookmarks",h[u[y+p+"C"]="showInCenter"]=function(e){var t=e.cursorCoords(null,"local");e.scrollTo(null,(t.top+t.bottom)/2-e.getScrollInfo().clientHeight/2)},h[u["Shift-Alt-Up"]="selectLinesUpward"]=function(e){e.operation(function(){for(var t=e.listSelections(),n=0;ne.firstLine()&&e.addSelection(f(r.head.line-1,r.head.ch))}})},h[u["Shift-Alt-Down"]="selectLinesDownward"]=function(e){e.operation(function(){for(var t=e.listSelections(),n=0;nt.maxLineLength&&(t.maxLineLength=n,t.maxLine=e)})}function d(e){var t=Ri(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 p(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+Ue(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+Xe(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}function g(e,t,n){this.cm=n;var r=this.vert=Wi("div",[Wi("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=Wi("div",[Wi("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar"); e(r),e(i),Es(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Es(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedOverlay=!1,yo&&bo<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}function m(){}function v(t){t.display.scrollbars&&(t.display.scrollbars.clear(),t.display.scrollbars.addClass&&Ks(t.display.wrapper,t.display.scrollbars.addClass)),t.display.scrollbars=new e.scrollbarModel[t.options.scrollbarStyle](function(e){t.display.wrapper.insertBefore(e,t.display.scrollbarFiller),Es(e,"mousedown",function(){t.state.focused&&setTimeout(function(){t.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,n){"horizontal"==n?rn(t,e):nn(t,e)},t),t.display.scrollbars.addClass&&Ys(t.display.wrapper,t.display.scrollbars.addClass)}function y(e,t){t||(t=p(e));var n=e.display.barWidth,r=e.display.barHeight;b(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&P(e),b(e,p(e)),n=e.display.barWidth,r=e.display.barHeight}function b(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}function w(e,t,n){var r=n&&null!=n.top?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Be(e));var i=n&&null!=n.bottom?n.bottom:r+e.wrapper.clientHeight,o=ti(t,r),s=ti(t,i);if(n&&n.ensure){var a=n.ensure.from.line,l=n.ensure.to.line;a=s&&(o=ti(t,ni(Yr(t,l))-e.wrapper.clientHeight),s=l)}return{from:o,to:Math.max(s,o+1)}}function x(e){var t=e.display,n=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var r=S(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=r+"px",s=0;s=n.viewFrom&&t.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==$t(e))return!1;C(e)&&(Nt(e),t.dims=O(e));var i=r.first+r.size,o=Math.max(t.visible.from-e.options.viewportMargin,r.first),s=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFroms&&n.viewTo-s<20&&(s=Math.min(i,n.viewTo)),Do&&(o=br(e.doc,o),s=wr(e.doc,s));var a=o!=n.viewFrom||s!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;jt(e,o,s),n.viewOffset=ni(Yr(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var l=$t(e);if(!a&&0==l&&!t.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var c=zi();return l>4&&(n.lineDiv.style.display="none"),H(e,n.updateLineNumbers,t.dims),l>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,c&&zi()!=c&&c.offsetHeight&&c.focus(),Bi(n.cursorDiv),Bi(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,a&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,Ie(e,400)),n.updateLineNumbers=null,!0}function E(e,t){for(var n=t.viewport,r=!0;(r&&e.options.lineWrapping&&t.oldDisplayWidth!=Ve(e)||(n&&null!=n.top&&(n={top:Math.min(e.doc.height+Ue(e.display)-Ge(e),n.top)}),t.visible=w(e.display,e.doc,n),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&M(e,t);r=!1){P(e);var i=p(e);Oe(e),A(e,i),y(e,i)}t.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function _(e,t){var n=new T(e,t);if(M(e,n)){P(e),E(e,n);var r=p(e);Oe(e),A(e,r),y(e,r),n.finish()}}function A(e,t){e.display.sizer.style.minHeight=t.docHeight+"px";var n=t.docHeight+e.display.barHeight;e.display.heightForcer.style.top=n+"px",e.display.gutters.style.height=Math.max(n+Xe(e),t.clientHeight)+"px"}function P(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r.001||l<-.001)&&(Jr(o.line,i),R(o.line),o.rest))for(var c=0;c-1&&(f=!1),D(e,h,c,n)),f&&(Bi(h.lineNumber),h.lineNumber.appendChild(document.createTextNode(k(e.options,c)))),a=h.node.nextSibling}else{var d=U(e,h,c,n);s.insertBefore(d,a)}c+=h.size}for(;a;)a=r(a)}function D(e,t,n,r){for(var i=0;i1)if(Io&&Io.join("\n")==t){if(r.ranges.length%Io.length==0){l=[];for(var c=0;c=0;c--){var u=r.ranges[c],h=u.from(),f=u.to();u.empty()&&(n&&n>0?h=No(h.line,h.ch-n):e.state.overwrite&&!s&&(f=No(f.line,Math.min(Yr(o,f.line).text.length,f.ch+Pi(a).length))));var d=e.curOp.updateInput,p={from:h,to:f,text:l?l[c%l.length]:a,origin:i||(s?"paste":e.state.cutIncoming?"cut":"+input")};Tn(e.doc,p),ki(e,"inputRead",e,p)}t&&!s&&ee(e,t),Fn(e),e.curOp.updateInput=d,e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=!1}function J(e,t){var n=e.clipboardData&&e.clipboardData.getData("text/plain");if(n)return e.preventDefault(),Z(t)||t.options.disableInput||Et(t,function(){Q(t,n,0,null,"paste")}),!0}function ee(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(!(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)){var o=e.getModeAt(i.head),s=!1;if(o.electricChars){for(var a=0;a-1){s=jn(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(Yr(e.doc,i.head.line).text.slice(0,i.head.ch))&&(s=jn(e,i.head.line,"smart"));s&&ki(e,"electricInput",e,i.head.line)}}}function te(e){for(var t=[],n=[],r=0;r=0){var s=K(o.from(),i.from()),a=q(o.to(),i.to()),l=o.empty()?i.from()==i.head:o.from()==o.head;r<=t&&--t,e.splice(--r,2,new fe(l?a:s,l?s:a))}}return new he(e,t)}function pe(e,t){return new he([new fe(e,t||e)],0)}function ge(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function me(e,t){if(t.linen?No(n,Yr(e,n).text.length):ve(t,Yr(e,t.line).text.length)}function ve(e,t){var n=e.ch;return null==n||n>t?No(e.line,t):n<0?No(e.line,0):e}function ye(e,t){return t>=e.first&&t=o.ch:c.to>o.ch))){if(r&&(Ps(u,"beforeCursorEnter"),u.explicitlyCleared)){if(a.markedSpans){--l;continue}break}if(!u.atomic)continue;var h=u.find(s<0?-1:1);if(0==Fo(h,o)&&(h.ch+=s,h.ch<0?h=h.line>e.first?me(e,No(h.line-1)):null:h.ch>a.text.length&&(h=h.line3&&(r(d,g.top,null,g.bottom),d=c,g.bottoml.bottom||h.bottom==l.bottom&&h.right>l.right)&&(l=h),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 Ie(e,t){e.doc.mode.startState&&e.doc.frontier=e.display.viewTo)){var n=+new Date+e.options.workTime,r=ss(t.mode,We(e,t.frontier)),i=[];t.iter(t.frontier,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(t.frontier>=e.display.viewFrom){var s=o.styles,a=o.text.length>e.options.maxHighlightLength,l=Or(e,o,a?ss(t.mode,r):r,!0);o.styles=l.styles;var c=o.styleClasses,u=l.classes;u?o.styleClasses=u:c&&(o.styleClasses=null);for(var h=!s||s.length!=o.styles.length||c!=u&&(!c||!u||c.bgClass!=u.bgClass||c.textClass!=u.textClass),f=0;!h&&fn)return Ie(e,e.options.workDelay),!0}),i.length&&Et(e,function(){for(var t=0;ts;--a){if(a<=o.first)return o.first;var l=Yr(o,a-1);if(l.stateAfter&&(!n||a<=o.frontier))return a;var c=Is(l.text,null,e.options.tabSize);(null==i||r>c)&&(i=a-1,r=c)}return i}function We(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return!0;var o=$e(e,t,n),s=o>r.first&&Yr(r,o-1).stateAfter;return s=s?ss(r.mode,s):as(r.mode),r.iter(o,t,function(n){Dr(e,n.text,s);var a=o==t-1||o%5==0||o>=i.viewFrom&&o2&&o.push((l.bottom+c.top)/2-n.top)}}o.push(n.bottom-n.top)}}function Ke(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 Ye(e,t){t=vr(t);var n=ei(t),r=e.display.externalMeasured=new Rt(e.doc,t,n);r.lineN=n;var i=r.built=Fr(e,r);return r.text=i.pre,Ui(e.display.lineMeasure,i.pre),r}function Ze(e,t,n,r){return et(e,Je(e,t),n,r)}function Qe(e,t){if(t>=e.display.viewFrom&&t=n.lineN&&tt)&&(o=c-l,i=o-1,t>=c&&(s="right")),null!=i){if(r=e[a+2],l==c&&n==(r.insertLeft?"left":"right")&&(s=n),"left"==n&&0==i)for(;a&&e[a-2]==e[a-3]&&e[a-1].insertLeft;)r=e[(a-=3)+2],s="left";if("right"==n&&i==c-l)for(;a0&&(c=r="right");var h;i=e.options.lineWrapping&&(h=s.getClientRects()).length>1?h["right"==r?h.length-1:0]:s.getBoundingClientRect()}if(yo&&bo<9&&!a&&(!i||!i.left&&!i.right)){var f=s.parentNode.getClientRects()[0];i=f?{left:f.left,right:f.left+yt(e.display),top:f.top,bottom:f.bottom}:Bo}for(var d=i.top-t.rect.top,p=i.bottom-t.rect.top,g=(d+p)/2,m=t.view.measure.heights,u=0;un.from?s(e-1):s(e,r)}r=r||Yr(e.doc,t.line),i||(i=Je(e,r));var l=ri(r),c=t.ch;if(!l)return s(c);var u=lo(l,c),h=a(c,u);return null!=ia&&(h.other=a(c,ia)),h}function dt(e,t){var n=0,t=me(e.doc,t);e.options.lineWrapping||(n=yt(e.display)*t.ch);var r=Yr(e.doc,t.line),i=ni(r)+Be(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function pt(e,t,n,r){var i=No(e,t);return i.xRel=r,n&&(i.outside=!0),i}function gt(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return pt(r.first,0,!0,-1);var i=ti(r,n),o=r.first+r.size-1;if(i>o)return pt(r.first+r.size-1,Yr(r,o).text.length,!0,1);t<0&&(t=0);for(var s=Yr(r,i);;){var a=mt(e,s,i,t,n),l=gr(s),c=l&&l.find(0,!0);if(!l||!(a.ch>c.from.ch||a.ch==c.from.ch&&a.xRel>0))return a;i=ei(s=c.to.line)}}function mt(e,t,n,r,i){function o(r){var i=ft(e,No(n,r),"line",t,c);return a=!0,s>i.bottom?i.left-l:sm)return pt(n,d,v,1);for(;;){if(u?d==f||d==uo(t,f,1):d-f<=1){for(var y=r1?1:0);return w}var x=Math.ceil(h/2),C=f+x;if(u){C=f;for(var k=0;kr?(d=C,m=S,(v=a)&&(m+=1e3),h=x):(f=C,p=S,g=a,h-=x)}}function vt(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==jo){jo=Wi("pre");for(var t=0;t<49;++t)jo.appendChild(document.createTextNode("x")),jo.appendChild(Wi("br"));jo.appendChild(document.createTextNode("x"))}Ui(e.measure,jo);var n=jo.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),Bi(e.measure),n||1}function yt(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=Wi("span","xxxxxxxxxx"),n=Wi("pre",[t]);Ui(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function bt(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,focus:!1,id:++zo},Uo?Uo.ops.push(e.curOp):e.curOp.ownsGroup=Uo={ops:[e.curOp],delayedCallbacks:[]}}function wt(e){var t=e.delayedCallbacks,n=0;do{for(;n=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new T(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function St(e){e.updatedDisplay=e.mustUpdate&&M(e.cm,e.update)}function Tt(e){var t=e.cm,n=t.display;e.updatedDisplay&&P(t),e.barMeasure=p(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Ze(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Xe(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Ve(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function Lt(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeftt)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Do&&br(e.doc,t)i.viewFrom?Nt(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)Nt(e);else if(t<=i.viewFrom){var o=It(e,n,n+r,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=r):Nt(e)}else if(n>=i.viewTo){var o=It(e,t,t,-1);o?(i.view=i.view.slice(0,o.index),i.viewTo=o.lineN):Nt(e)}else{var s=It(e,t,t,-1),a=It(e,n,n+r,1);s&&a?(i.view=i.view.slice(0,s.index).concat(Ot(e,s.lineN,a.lineN)).concat(i.view.slice(a.index)),i.viewTo+=r):Nt(e)}var l=i.externalMeasured;l&&(n=i.lineN&&t=r.viewTo)){var o=r.view[Ft(e,t)];if(null!=o.node){var s=o.changes||(o.changes=[]);Ri(s,n)==-1&&s.push(n)}}}function Nt(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Ft(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,r=0;r0){if(o==s.length-1)return null;i=l+s[o].size-t,o++}else i=l-t;t+=i,n+=i}for(;br(e.doc,n)!=n;){if(o==(r<0?0:s.length-1))return null;n+=r*s[o-(r<0?1:0)].size,o+=r}return{index:o,lineN:n}}function jt(e,t,n){var r=e.display,i=r.view;0==i.length||t>=r.viewTo||n<=r.viewFrom?(r.view=Ot(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=Ot(e,t,r.viewFrom).concat(r.view):r.viewFromn&&(r.view=r.view.slice(0,Ft(e,n)))),r.viewTo=n}function $t(e){for(var t=e.display.view,n=0,r=0;r400}var i=e.display;Es(i.scroller,"mousedown",_t(e,Vt)),yo&&bo<11?Es(i.scroller,"dblclick",_t(e,function(t){if(!Ti(e,t)){var n=Xt(e,t);if(n&&!Zt(e,t)&&!zt(e.display,t)){Ts(t);var r=e.findWordAt(n);xe(e.doc,r.anchor,r.head)}}})):Es(i.scroller,"dblclick",function(t){Ti(e,t)||Ts(t)}),Oo||Es(i.scroller,"contextmenu",function(t){yn(e,t)});var o,s={end:0};Es(i.scroller,"touchstart",function(e){if(!n(e)){clearTimeout(o);var t=+new Date;i.activeTouch={start:t,moved:!1,prev:t-s.end<=300?s:null},1==e.touches.length&&(i.activeTouch.left=e.touches[0].pageX,i.activeTouch.top=e.touches[0].pageY)}}),Es(i.scroller,"touchmove",function(){i.activeTouch&&(i.activeTouch.moved=!0)}),Es(i.scroller,"touchend",function(n){var o=i.activeTouch;if(o&&!zt(i,n)&&null!=o.left&&!o.moved&&new Date-o.start<300){var s,a=e.coordsChar(i.activeTouch,"page");s=!o.prev||r(o,o.prev)?new fe(a,a):!o.prev.prev||r(o,o.prev.prev)?e.findWordAt(a):new fe(No(a.line,0),me(e.doc,No(a.line+1,0))),e.setSelection(s.anchor,s.head),e.focus(),Ts(n)}t()}),Es(i.scroller,"touchcancel",t),Es(i.scroller,"scroll",function(){i.scroller.clientHeight&&(nn(e,i.scroller.scrollTop),rn(e,i.scroller.scrollLeft,!0),Ps(e,"scroll",e))}),Es(i.scroller,"mousewheel",function(t){on(e,t)}),Es(i.scroller,"DOMMouseScroll",function(t){on(e,t)}),Es(i.wrapper,"scroll",function(){i.wrapper.scrollTop=i.wrapper.scrollLeft=0}),i.dragFunctions={enter:function(t){Ti(e,t)||Ms(t)},over:function(t){Ti(e,t)||(en(e,t),Ms(t))},start:function(t){Jt(e,t)},drop:_t(e,Qt),leave:function(){tn(e)}};var a=i.input.getField();Es(a,"keyup",function(t){dn.call(e,t)}),Es(a,"keydown",_t(e,hn)),Es(a,"keypress",_t(e,pn)),Es(a,"focus",Fi(mn,e)),Es(a,"blur",Fi(vn,e))}function Bt(t,n,r){var i=r&&r!=e.Init;if(!n!=!i){var o=t.display.dragFunctions,s=n?Es:As;s(t.display.scroller,"dragstart",o.start),s(t.display.scroller,"dragenter",o.enter),s(t.display.scroller,"dragover",o.over),s(t.display.scroller,"dragleave",o.leave),s(t.display.scroller,"drop",o.drop)}}function Ut(e){var t=e.display;t.lastWrapHeight==t.wrapper.clientHeight&&t.lastWrapWidth==t.wrapper.clientWidth||(t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize())}function zt(e,t){for(var n=wi(t);n!=e.wrapper;n=n.parentNode)if(!n||1==n.nodeType&&"true"==n.getAttribute("cm-ignore-events")||n.parentNode==e.sizer&&n!=e.mover)return!0}function Xt(e,t,n,r){var i=e.display;if(!n&&"true"==wi(t).getAttribute("cm-not-content"))return null;var o,s,a=i.lineSpace.getBoundingClientRect();try{o=t.clientX-a.left,s=t.clientY-a.top}catch(t){return null}var l,c=gt(e,o,s);if(r&&1==c.xRel&&(l=Yr(e.doc,c.line).text).length==c.ch){var u=Is(l,l.length,e.options.tabSize)-l.length;c=No(c.line,Math.max(0,Math.round((o-ze(e.display).left)/yt(e.display))-u))}return c}function Vt(e){var t=this,n=t.display;if(!(n.activeTouch&&n.input.supportsTouch()||Ti(t,e))){if(n.shift=e.shiftKey,zt(n,e))return void(wo||(n.scroller.draggable=!1,setTimeout(function(){n.scroller.draggable=!0},100)));if(!Zt(t,e)){var r=Xt(t,e);switch(window.focus(),xi(e)){case 1:t.state.selectingText?t.state.selectingText(e):r?Gt(t,e,r):wi(e)==n.scroller&&Ts(e);break;case 2:wo&&(t.state.lastMiddleDown=+new Date),r&&xe(t.doc,r),setTimeout(function(){n.input.focus()},20),Ts(e);break;case 3:Oo?yn(t,e):gn(t)}}}}function Gt(e,t,n){yo?setTimeout(Fi(Y,e),0):e.curOp.focus=zi();var r,i=+new Date;Wo&&Wo.time>i-400&&0==Fo(Wo.pos,n)?r="triple":$o&&$o.time>i-400&&0==Fo($o.pos,n)?(r="double",Wo={time:i,pos:n}):(r="single",$o={time:i,pos:n});var o,s=e.doc.sel,a=_o?t.metaKey:t.ctrlKey;e.options.dragDrop&&Qs&&!Z(e)&&"single"==r&&(o=s.contains(n))>-1&&(Fo((o=s.ranges[o]).from(),n)<0||n.xRel>0)&&(Fo(o.to(),n)>0||n.xRel<0)?qt(e,t,n,a):Kt(e,t,n,r,a)}function qt(e,t,n,r){var i=e.display,o=+new Date,s=_t(e,function(a){wo&&(i.scroller.draggable=!1),e.state.draggingText=!1,As(document,"mouseup",s),As(i.scroller,"drop",s),Math.abs(t.clientX-a.clientX)+Math.abs(t.clientY-a.clientY)<10&&(Ts(a),!r&&+new Date-200y&&i.push(new fe(No(p,y),No(p,js(v,d,o))))}i.length||i.push(new fe(n,n)),Me(c,de(f.ranges.slice(0,h).concat(i),h),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var b=u,w=b.anchor,x=t;if("single"!=r){if("double"==r)var C=e.findWordAt(t);else var C=new fe(No(t.line,0),me(c,No(t.line+1,0)));Fo(C.anchor,w)>0?(x=C.head,w=K(b.from(),C.anchor)):(x=C.anchor,w=q(b.to(),C.head))}var i=f.ranges.slice(0);i[h]=new fe(me(c,w),x),Me(c,de(i,h),Ns)}}function s(t){var n=++y,i=Xt(e,t,!0,"rect"==r);if(i)if(0!=Fo(i,m)){e.curOp.focus=zi(),o(i);var a=w(l,c);(i.line>=a.to||i.linev.bottom?20:0;u&&setTimeout(_t(e,function(){y==n&&(l.scroller.scrollTop+=u,s(t))}),50)}}function a(t){e.state.selectingText=!1,y=1/0,Ts(t),l.input.focus(),As(document,"mousemove",b),As(document,"mouseup",x),c.history.lastSelOrigin=null}var l=e.display,c=e.doc;Ts(t);var u,h,f=c.sel,d=f.ranges;if(i&&!t.shiftKey?(h=c.sel.contains(n),u=h>-1?d[h]:new fe(n,n)):(u=c.sel.primary(),h=c.sel.primIndex),t.altKey)r="rect",i||(u=new fe(n,n)),n=Xt(e,t,!0,!0),h=-1;else if("double"==r){var p=e.findWordAt(n);u=e.display.shift||c.extend?we(c,u,p.anchor,p.head):p}else if("triple"==r){var g=new fe(No(n.line,0),me(c,No(n.line+1,0)));u=e.display.shift||c.extend?we(c,u,g.anchor,g.head):g}else u=we(c,u,n);i?h==-1?(h=d.length,Me(c,de(d.concat([u]),h),{scroll:!1,origin:"*mouse"})):d.length>1&&d[h].empty()&&"single"==r&&!t.shiftKey?(Me(c,de(d.slice(0,h).concat(d.slice(h+1)),0),{scroll:!1,origin:"*mouse"}),f=c.sel):ke(c,h,u,Ns):(h=0,Me(c,new he([u],0),Ns),f=c.sel);var m=n,v=l.wrapper.getBoundingClientRect(),y=0,b=_t(e,function(e){xi(e)?s(e):a(e)}),x=_t(e,a);e.state.selectingText=x,Es(document,"mousemove",b),Es(document,"mouseup",x)}function Yt(e,t,n,r,i){try{var o=t.clientX,s=t.clientY}catch(t){return!1}if(o>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&Ts(t);var a=e.display,l=a.lineDiv.getBoundingClientRect();if(s>l.bottom||!Mi(e,n))return bi(t);s-=l.top-a.viewOffset;for(var c=0;c=o){var h=ti(e.doc,s),f=e.options.gutters[c];return i(e,n,e,h,f,t),bi(t)}}}function Zt(e,t){return Yt(e,t,"gutterClick",!0,ki)}function Qt(e){var t=this;if(tn(t),!Ti(t,e)&&!zt(t.display,e)){Ts(e),yo&&(Xo=+new Date);var n=Xt(t,e,!0),r=e.dataTransfer.files;if(n&&!Z(t))if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,o=Array(i),s=0,a=function(e,r){if(!t.options.allowDropFileTypes||Ri(t.options.allowDropFileTypes,e.type)!=-1){var a=new FileReader;a.onload=_t(t,function(){var e=a.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(e)&&(e=""),o[r]=e,++s==i){n=me(t.doc,n);var l={from:n,to:n,text:t.doc.splitLines(o.join(t.doc.lineSeparator())),origin:"paste"};Tn(t.doc,l),Le(t.doc,pe(n,Zo(l)))}}),a.readAsText(e)}},l=0;l-1)return t.state.draggingText(e),void setTimeout(function(){t.display.input.focus()},20);try{var o=e.dataTransfer.getData("Text");if(o){if(t.state.draggingText&&!(_o?e.altKey:e.ctrlKey))var c=t.listSelections();if(Ee(t.doc,pe(n,n)),c)for(var l=0;ls.clientWidth,l=s.scrollHeight>s.clientHeight;if(r&&a||i&&l){if(i&&_o&&wo)e:for(var c=t.target,u=o.view;c!=s;c=c.parentNode)for(var h=0;h=0;--i)Ln(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text});else Ln(e,t)}}function Ln(e,t){if(1!=t.text.length||""!=t.text[0]||0!=Fo(t.from,t.to)){var n=xn(e,t);li(e,t,n,e.cm?e.cm.curOp.id:NaN),_n(e,t,n,ir(e,t));var r=[];qr(e,function(e,n){n||Ri(r,e.history)!=-1||(yi(e.history,t),r.push(e.history)),_n(e,t,null,ir(e,t))})}}function Mn(e,t,n){if(!e.cm||!e.cm.state.suppressEdits){for(var r,i=e.history,o=e.sel,s="undo"==t?i.done:i.undone,a="undo"==t?i.undone:i.done,l=0;l=0;--l){var h=r.changes[l];if(h.origin=t,u&&!Sn(e,h,!1))return void(s.length=0);c.push(oi(e,h));var f=l?xn(e,h):Pi(s);_n(e,h,f,sr(e,h)),!l&&e.cm&&e.cm.scrollIntoView({from:h.from,to:Zo(h)});var d=[];qr(e,function(e,t){t||Ri(d,e.history)!=-1||(yi(e.history,h),d.push(e.history)),_n(e,h,null,sr(e,h))})}}}}function En(e,t){if(0!=t&&(e.first+=t,e.sel=new he(Oi(e.sel.ranges,function(e){return new fe(No(e.anchor.line+t,e.anchor.ch),No(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){Ht(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;re.lastLine())){if(t.from.lineo&&(t={from:t.from,to:No(o,Yr(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Zr(e,t.from,t.to),n||(n=xn(e,t)),e.cm?An(e.cm,t,r):Xr(e,t,r),Ee(e,n,Ds)}}function An(e,t,n){var r=e.doc,i=e.display,s=t.from,a=t.to,l=!1,c=s.line;e.options.lineWrapping||(c=ei(vr(Yr(r,s.line))),r.iter(c,a.line+1,function(e){if(e==i.maxLine)return l=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Li(e),Xr(r,t,n,o(e)),e.options.lineWrapping||(r.iter(c,s.line+t.text.length,function(e){var t=h(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,l=!1)}),l&&(e.curOp.updateMaxLine=!0)),r.frontier=Math.min(r.frontier,s.line),Ie(e,400);var u=t.text.length-(a.line-s.line)-1;t.full?Ht(e):s.line!=a.line||1!=t.text.length||zr(e.doc,t)?Ht(e,s.line,a.line+1,u):Dt(e,s.line,"text");var f=Mi(e,"changes"),d=Mi(e,"change");if(d||f){var p={from:s,to:a,text:t.text,removed:t.removed,origin:t.origin};d&&ki(e,"change",e,p),f&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(p)}e.display.selForContextMenu=null}function Pn(e,t,n,r,i){if(r||(r=n),Fo(r,n)<0){var o=r;r=n,n=o}"string"==typeof t&&(t=e.splitLines(t)),Tn(e,{from:n,to:r,text:t,origin:i})}function Rn(e,t){if(!Ti(e,"scrollCursorIntoView")){var n=e.display,r=n.sizer.getBoundingClientRect(),i=null;if(t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!Lo){var o=Wi("div","​",null,"position: absolute; top: "+(t.top-n.viewOffset-Be(e.display))+"px; height: "+(t.bottom-t.top+Xe(e)+n.barHeight)+"px; left: "+t.left+"px; width: 2px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}function On(e,t,n,r){null==r&&(r=0);for(var i=0;i<5;i++){var o=!1,s=ft(e,t),a=n&&n!=t?ft(e,n):s,l=Dn(e,Math.min(s.left,a.left),Math.min(s.top,a.top)-r,Math.max(s.left,a.left),Math.max(s.bottom,a.bottom)+r),c=e.doc.scrollTop,u=e.doc.scrollLeft;if(null!=l.scrollTop&&(nn(e,l.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(o=!0)),null!=l.scrollLeft&&(rn(e,l.scrollLeft),Math.abs(e.doc.scrollLeft-u)>1&&(o=!0)),!o)break}return s}function Hn(e,t,n,r,i){var o=Dn(e,t,n,r,i);null!=o.scrollTop&&nn(e,o.scrollTop),null!=o.scrollLeft&&rn(e,o.scrollLeft)}function Dn(e,t,n,r,i){var o=e.display,s=vt(e.display);n<0&&(n=0);var a=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:o.scroller.scrollTop,l=Ge(e),c={};i-n>l&&(i=n+l);var u=e.doc.height+Ue(o),h=nu-s;if(na+l){var d=Math.min(n,(f?u:i)-l);d!=a&&(c.scrollTop=d)}var p=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:o.scroller.scrollLeft,g=Ve(e)-(e.options.fixedGutter?o.gutters.offsetWidth:0),m=r-t>g;return m&&(r=t+g),t<10?c.scrollLeft=0:tg+p-3&&(c.scrollLeft=r+(m?0:10)-g),c}function Nn(e,t,n){null==t&&null==n||In(e),null!=t&&(e.curOp.scrollLeft=(null==e.curOp.scrollLeft?e.doc.scrollLeft:e.curOp.scrollLeft)+t),null!=n&&(e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+n)}function Fn(e){In(e);var t=e.getCursor(),n=t,r=t;e.options.lineWrapping||(n=t.ch?No(t.line,t.ch-1):t,r=No(t.line,t.ch+1)),e.curOp.scrollToPos={from:n,to:r,margin:e.options.cursorScrollMargin,isCursor:!0}}function In(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=dt(e,t.from),r=dt(e,t.to),i=Dn(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 jn(e,t,n,r){var i,o=e.doc;null==n&&(n="add"),"smart"==n&&(o.mode.indent?i=We(e,t):n="prev");var s=e.options.tabSize,a=Yr(o,t),l=Is(a.text,null,s);a.stateAfter&&(a.stateAfter=null);var c,u=a.text.match(/^\s*/)[0];if(r||/\S/.test(a.text)){if("smart"==n&&(c=o.mode.indent(i,a.text.slice(u.length),a.text),c==Hs||c>150)){if(!r)return;n="prev"}}else c=0,n="not";"prev"==n?c=t>o.first?Is(Yr(o,t-1).text,null,s):0:"add"==n?c=l+e.options.indentUnit:"subtract"==n?c=l-e.options.indentUnit:"number"==typeof n&&(c=l+n),c=Math.max(0,c);var h="",f=0;if(e.options.indentWithTabs)for(var d=Math.floor(c/s);d;--d)f+=s,h+="\t";if(f=0;t--)Pn(e.doc,"",r[t].from,r[t].to,"+delete");Fn(e)})}function Bn(e,t,n,r,i){function o(){var t=a+n;return t=e.first+e.size?h=!1:(a=t,u=Yr(e,t))}function s(e){var t=(i?uo:ho)(u,l,n,!0);if(null==t){if(e||!o())return h=!1;l=i?(n<0?ro:no)(u):n<0?u.text.length:0}else l=t;return!0}var a=t.line,l=t.ch,c=n,u=Yr(e,a),h=!0;if("char"==r)s();else if("column"==r)s(!0);else if("word"==r||"group"==r)for(var f=null,d="group"==r,p=e.cm&&e.cm.getHelper(t,"wordChars"),g=!0;!(n<0)||s(!g);g=!1){var m=u.text.charAt(l)||"\n",v=Ii(m,p)?"w":d&&"\n"==m?"n":!d||/\s/.test(m)?null:"p";if(!d||g||v||(v="s"),f&&f!=v){n<0&&(n=1,s());break}if(v&&(f=v),n>0&&!s(!g))break}var y=Re(e,No(a,l),c,!0);return h||(y.hitSide=!0),y}function Un(e,t,n,r){var i,o=e.doc,s=t.left;if("page"==r){var a=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);i=t.top+n*(a-(n<0?1.5:.5)*vt(e.display))}else"line"==r&&(i=n>0?t.bottom+3:t.top-3);for(;;){var l=gt(e,s,i);if(!l.outside)break;if(n<0?i<=0:i>=o.height){l.hitSide=!0;break}i+=5*n}return l}function zn(t,n,r,i){e.defaults[t]=n,r&&(Jo[t]=i?function(e,t,n){n!=es&&r(e,t,n)}:r)}function Xn(e){for(var t,n,r,i,o=e.split(/-(?!$)/),e=o[o.length-1],s=0;s0||0==s&&o.clearWhenEmpty!==!1)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=Wi("span",[o.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(mr(e,t.line,t,n,o)||t.line!=n.line&&mr(e,n.line,t,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Do=!0}o.addToHistory&&li(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var a,l=t.line,c=e.cm;if(e.iter(l,n.line+1,function(e){c&&o.collapsed&&!c.options.lineWrapping&&vr(e)==c.display.maxLine&&(a=!0),o.collapsed&&l!=t.line&&Jr(e,0),tr(e,new Qn(o,l==t.line?t.ch:null,l==n.line?n.ch:null)),++l}),o.collapsed&&e.iter(t.line,n.line+1,function(t){xr(e,t)&&Jr(t,0)}),o.clearOnEnter&&Es(o,"beforeCursorEnter",function(){o.clear()}),o.readOnly&&(Ho=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++ps,o.atomic=!0),c){if(a&&(c.curOp.updateMaxLine=!0),o.collapsed)Ht(c,t.line,n.line+1);else if(o.className||o.title||o.startStyle||o.endStyle||o.css)for(var u=t.line;u<=n.line;u++)Dt(c,u,"text");o.atomic&&Ae(c.doc),ki(c,"markerAdded",c,o)}return o}function qn(e,t,n,r,i){r=Ni(r),r.shared=!1;var o=[Gn(e,t,n,r,i)],s=o[0],a=r.widgetNode;return qr(e,function(e){a&&(r.widgetNode=a.cloneNode(!0)),o.push(Gn(e,me(e,t),me(e,n),r,i));for(var l=0;l=t:o.to>t);(r||(r=[])).push(new Qn(s,o.from,l?null:o.to))}}return r}function rr(e,t,n){if(e)for(var r,i=0;i=t:o.to>t);if(a||o.from==t&&"bookmark"==s.type&&(!n||o.marker.insertLeft)){var l=null==o.from||(s.inclusiveLeft?o.from<=t:o.from0&&a)for(var h=0;h0)){var u=[l,1],h=Fo(c.from,a.from),f=Fo(c.to,a.to);(h<0||!s.inclusiveLeft&&!h)&&u.push({from:c.from,to:a.from}),(f>0||!s.inclusiveRight&&!f)&&u.push({from:a.to,to:c.to}),i.splice.apply(i,u),l+=u.length-1}}return i}function lr(e){var t=e.markedSpans;if(t){for(var n=0;n=0&&h<=0||u<=0&&h>=0)&&(u<=0&&(Fo(c.to,n)>0||l.marker.inclusiveRight&&i.inclusiveLeft)||u>=0&&(Fo(c.from,r)<0||l.marker.inclusiveLeft&&i.inclusiveRight)))return!0}}}function vr(e){for(var t;t=pr(e);)e=t.find(-1,!0).line;return e}function yr(e){for(var t,n;t=gr(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function br(e,t){var n=Yr(e,t),r=vr(n);return n==r?t:ei(r)}function wr(e,t){if(t>e.lastLine())return t;var n,r=Yr(e,t);if(!xr(e,r))return t;for(;n=gr(r);)r=n.find(1,!0).line;return ei(r)+1}function xr(e,t){var n=Do&&t.markedSpans;if(n)for(var r,i=0;in.start)return s}throw new Error("Mode "+t.name+" failed to advance stream.")}function Pr(e,t,n,r){function i(e){return{start:h.start,end:h.pos,string:h.current(),type:o||null,state:e?ss(s.mode,u):u}}var o,s=e.doc,a=s.mode;t=me(s,t);var l,c=Yr(s,t.line),u=We(e,t.line,n),h=new ds(c.text,e.options.tabSize);for(r&&(l=[]);(r||h.pose.options.maxHighlightLength?(a=!1,s&&Dr(e,t,r,h.pos),h.pos=t.length,l=null):l=Er(Ar(n,h,r,f),o),f){var d=f[0].name;d&&(l="m-"+(l?d+" "+l:d))}if(!a||u!=l){for(;ce&&i.splice(l,1,e,i[l+1],r),l+=2,c=Math.min(e,r)}if(t)if(a.opaque)i.splice(n,l-n,e,"cm-overlay "+t),l=n+2;else for(;ne.options.maxHighlightLength?ss(e.doc.mode,r):r);t.stateAfter=r,t.styles=i.styles,i.classes?t.styleClasses=i.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.frontier&&e.doc.frontier++}return t.styles}function Dr(e,t,n,r){var i=e.doc.mode,o=new ds(t,e.options.tabSize);for(o.start=o.pos=r||0,""==t&&_r(i,n);!o.eol();)Ar(i,o,n),o.start=o.pos}function Nr(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?ws:bs;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Fr(e,t){var n=Wi("span",null,null,wo?"padding-right: .1px":null),r={pre:Wi("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,splitSpaces:(yo||wo)&&e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o,s=i?t.rest[i-1]:t.line;r.pos=0,r.addToken=jr,Zi(e.display.measure)&&(o=ri(s))&&(r.addToken=Wr(r.addToken,o)),r.map=[];var a=t!=e.display.externalMeasured&&ei(s);Ur(s,r,Hr(e,s,a)),s.styleClasses&&(s.styleClasses.bgClass&&(r.bgClass=Vi(s.styleClasses.bgClass,r.bgClass||"")),s.styleClasses.textClass&&(r.textClass=Vi(s.styleClasses.textClass,r.textClass||""))),0==r.map.length&&r.map.push(0,0,r.content.appendChild(Yi(e.display.measure))),0==i?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}return wo&&/\bcm-tab\b/.test(r.content.lastChild.className)&&(r.content.className="cm-tab-wrap-hack"),Ps(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=Vi(r.pre.className,r.textClass||"")),r}function Ir(e){var t=Wi("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function jr(e,t,n,r,i,o,s){if(t){var a=e.splitSpaces?t.replace(/ {3,}/g,$r):t,l=e.cm.state.specialChars,c=!1;if(l.test(t))for(var u=document.createDocumentFragment(),h=0;;){l.lastIndex=h;var f=l.exec(t),d=f?f.index-h:t.length-h;if(d){var p=document.createTextNode(a.slice(h,h+d));yo&&bo<9?u.appendChild(Wi("span",[p])):u.appendChild(p),e.map.push(e.pos,e.pos+d,p),e.col+=d,e.pos+=d}if(!f)break;if(h+=d+1,"\t"==f[0]){var g=e.cm.options.tabSize,m=g-e.col%g,p=u.appendChild(Wi("span",Ai(m),"cm-tab"));p.setAttribute("role","presentation"),p.setAttribute("cm-text","\t"),e.col+=m}else if("\r"==f[0]||"\n"==f[0]){var p=u.appendChild(Wi("span","\r"==f[0]?"␍":"␤","cm-invalidchar"));p.setAttribute("cm-text",f[0]),e.col+=1}else{var p=e.cm.options.specialCharPlaceholder(f[0]);p.setAttribute("cm-text",f[0]),yo&&bo<9?u.appendChild(Wi("span",[p])):u.appendChild(p),e.col+=1}e.map.push(e.pos,e.pos+1,p),e.pos++}else{e.col+=t.length;var u=document.createTextNode(a);e.map.push(e.pos,e.pos+t.length,u),yo&&bo<9&&(c=!0),e.pos+=t.length}if(n||r||i||c||s){var v=n||"";r&&(v+=r),i&&(v+=i);var y=Wi("span",[u],v,s);return o&&(y.title=o),e.content.appendChild(y)}e.content.appendChild(u)}}function $r(e){for(var t=" ",n=0;nc&&f.from<=c)break}if(f.to>=u)return e(n,r,i,o,s,a,l);e(n,r.slice(0,f.to-c),i,o,null,a,l),o=null,r=r.slice(f.to-c),c=f.to}}}function Br(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t}function Ur(e,t,n){var r=e.markedSpans,i=e.text,o=0;if(r)for(var s,a,l,c,u,h,f,d=i.length,p=0,g=1,m="",v=0;;){if(v==p){l=c=u=h=a="",f=null,v=1/0;for(var y=[],b=0;bp||x.collapsed&&w.to==p&&w.from==p)?(null!=w.to&&w.to!=p&&v>w.to&&(v=w.to,c=""),x.className&&(l+=" "+x.className),x.css&&(a=x.css),x.startStyle&&w.from==p&&(u+=" "+x.startStyle),x.endStyle&&w.to==v&&(c+=" "+x.endStyle),x.title&&!h&&(h=x.title),x.collapsed&&(!f||fr(f.marker,x)<0)&&(f=w)):w.from>p&&v>w.from&&(v=w.from)}if(f&&(f.from||0)==p){if(Br(t,(null==f.to?d+1:f.to)-p,f.marker,null==f.from),null==f.to)return;f.to==p&&(f=!1)}if(!f&&y.length)for(var b=0;b=d)break;for(var C=Math.min(d,v);;){if(m){var k=p+m.length;if(!f){var S=k>C?m.slice(0,C-p):m;t.addToken(t,S,s?s+l:l,u,p+S.length==v?c:"",h,a)}if(k>=C){m=m.slice(C-p),p=C;break}p=k,u=""}m=i.slice(o,o=n[g++]),s=Nr(n[g++],t.cm.options)}}else for(var g=1;g1&&e.remove(a.line+1,p-1),e.insert(a.line+1,g)}ki(e,"change",e,t)}function Vr(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],o=i.chunkSize();if(t1&&!e.done[e.done.length-2].ranges?(e.done.pop(),Pi(e.done)):void 0}function li(e,t,n,r){var i=e.history;i.undone.length=0;var o,s=+new Date;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=ai(i,i.lastOp==r))){var a=Pi(o.changes);0==Fo(t.from,t.to)&&0==Fo(t.from,a.to)?a.to=Zo(t):o.changes.push(oi(e,t))}else{var l=Pi(i.done);for(l&&l.ranges||hi(e.sel,i.done),o={changes:[oi(e,t)],generation:i.generation},i.done.push(o);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,a||Ps(e,"historyAdded")}function ci(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 ui(e,t,n,r){var i=e.history,o=r&&r.origin;n==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||ci(e,o,Pi(i.done),t))?i.done[i.done.length-1]=t:hi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=n,r&&r.clearRedo!==!1&&si(i.undone)}function hi(e,t){var n=Pi(t);n&&n.ranges&&n.equals(e)||t.push(e)}function fi(e,t,n,r){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(n){n.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=n.markedSpans),++o})}function di(e){if(!e)return null;for(var t,n=0;n-1&&(Pi(a)[h]=u[h],delete u[h])}}}return i}function mi(e,t,n,r){n0?r.slice():_s:r||_s}function ki(e,t){function n(e){return function(){e.apply(null,o)}}var r=Ci(e,t,!1);if(r.length){var i,o=Array.prototype.slice.call(arguments,2);Uo?i=Uo.delayedCallbacks:Rs?i=Rs:(i=Rs=[],setTimeout(Si,0));for(var s=0;s0}function Ei(e){e.prototype.on=function(e,t){Es(this,e,t)},e.prototype.off=function(e,t){As(this,e,t)}}function _i(){this.id=null}function Ai(e){for(;$s.length<=e;)$s.push(Pi($s)+" ");return $s[e]}function Pi(e){return e[e.length-1]}function Ri(e,t){for(var n=0;n-1&&zs(e))||t.test(e):zs(e)}function ji(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function $i(e){return e.charCodeAt(0)>=768&&Xs.test(e)}function Wi(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o0;--t)e.removeChild(e.firstChild);return e}function Ui(e,t){return Bi(e).appendChild(t)}function zi(){for(var e=document.activeElement;e&&e.root&&e.root.activeElement;)e=e.root.activeElement;return e}function Xi(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}function Vi(e,t){for(var n=e.split(" "),r=0;r2&&!(yo&&bo<8))}var n=Gs?Wi("span","​"):Wi("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}function Zi(e){if(null!=qs)return qs;var t=Ui(e,document.createTextNode("AخA")),n=Bs(t,0,1).getBoundingClientRect();if(!n||n.left==n.right)return!1;var r=Bs(t,1,2).getBoundingClientRect();return qs=r.right-n.right<3}function Qi(e){if(null!=na)return na;var t=Ui(e,Wi("span","x")),n=t.getBoundingClientRect(),r=Bs(t,0,1).getBoundingClientRect();return na=Math.abs(n.left-r.left)>1}function Ji(e,t,n,r){if(!e)return r(t,n,"ltr");for(var i=!1,o=0;ot||t==n&&s.to==t)&&(r(Math.max(s.from,t),Math.min(s.to,n),1==s.level?"rtl":"ltr"),i=!0)}i||r(t,n,"ltr")}function eo(e){return e.level%2?e.to:e.from}function to(e){return e.level%2?e.from:e.to}function no(e){var t=ri(e);return t?eo(t[0]):0}function ro(e){var t=ri(e);return t?to(Pi(t)):e.text.length}function io(e,t){var n=Yr(e.doc,t),r=vr(n);r!=n&&(t=ei(r));var i=ri(r),o=i?i[0].level%2?ro(r):no(r):0;return No(t,o)}function oo(e,t){for(var n,r=Yr(e.doc,t);n=gr(r);)r=n.find(1,!0).line,t=null;var i=ri(r),o=i?i[0].level%2?no(r):ro(r):r.text.length;return No(null==t?ei(r):t,o)}function so(e,t){var n=io(e,t.line),r=Yr(e.doc,n.line),i=ri(r);if(!i||0==i[0].level){var o=Math.max(0,r.text.search(/\S/)),s=t.line==n.line&&t.ch<=o&&t.ch;return No(n.line,s?0:o)}return n}function ao(e,t,n){var r=e[0].level;return t==r||n!=r&&tt)return r;if(i.from==t||i.to==t){if(null!=n)return ao(e,i.level,e[n].level)?(i.from!=i.to&&(ia=n),r):(i.from!=i.to&&(ia=r),n);n=r}}return n}function co(e,t,n,r){if(!r)return t+n;do t+=n;while(t>0&&$i(e.text.charAt(t)));return t}function uo(e,t,n,r){var i=ri(e);if(!i)return ho(e,t,n,r);for(var o=lo(i,t),s=i[o],a=co(e,t,s.level%2?-n:n,r);;){if(a>s.from&&a0==s.level%2?s.to:s.from);if(s=i[o+=n],!s)return null;a=n>0==s.level%2?co(e,s.to,-1,r):co(e,s.from,1,r)}}function ho(e,t,n,r){var i=t+n;if(r)for(;i>0&&$i(e.text.charAt(i));)i+=n;return i<0||i>e.text.length?null:i}var fo=navigator.userAgent,po=navigator.platform,go=/gecko\/\d/i.test(fo),mo=/MSIE \d/.test(fo),vo=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(fo),yo=mo||vo,bo=yo&&(mo?document.documentMode||6:vo[1]),wo=/WebKit\//.test(fo),xo=wo&&/Qt\/\d+\.\d+/.test(fo),Co=/Chrome\//.test(fo),ko=/Opera\//.test(fo),So=/Apple Computer/.test(navigator.vendor),To=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(fo),Lo=/PhantomJS/.test(fo),Mo=/AppleWebKit/.test(fo)&&/Mobile\/\w+/.test(fo),Eo=Mo||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(fo),_o=Mo||/Mac/.test(po),Ao=/win/i.test(po),Po=ko&&fo.match(/Version\/(\d*\.\d*)/);Po&&(Po=Number(Po[1])),Po&&Po>=15&&(ko=!1,wo=!0);var Ro=_o&&(xo||ko&&(null==Po||Po<12.11)),Oo=go||yo&&bo>=9,Ho=!1,Do=!1;g.prototype=Ni({update:function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=e.scrollWidth-e.clientWidth+o+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedOverlay&&e.clientHeight>0&&(0==r&&this.overlayHack(),this.checkedOverlay=!0),{right:n?r:0,bottom:t?r:0}},setScrollLeft:function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e)},setScrollTop:function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e)},overlayHack:function(){var e=_o&&!To?"12px":"18px";this.horiz.style.minHeight=this.vert.style.minWidth=e;var t=this,n=function(e){wi(e)!=t.vert&&wi(e)!=t.horiz&&_t(t.cm,Vt)(e)};Es(this.vert,"mousedown",n),Es(this.horiz,"mousedown",n)},clear:function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)}},g.prototype),m.prototype=Ni({update:function(){return{bottom:0,right:0}},setScrollLeft:function(){},setScrollTop:function(){},clear:function(){}},m.prototype),e.scrollbarModel={"native":g,"null":m},T.prototype.signal=function(e,t){Mi(e,t)&&this.events.push(arguments)},T.prototype.finish=function(){for(var e=0;e=9&&n.hasSelection&&(n.hasSelection=null),n.poll()}),Es(o,"paste",function(e){return!!J(e,r)||(r.state.pasteIncoming=!0,void n.fastPoll())}),Es(o,"cut",t),Es(o,"copy",t),Es(e.scroller,"paste",function(t){zt(e,t)||(r.state.pasteIncoming=!0,n.focus())}),Es(e.lineSpace,"selectstart",function(t){zt(e,t)||Ts(t)}),Es(o,"compositionstart",function(){var e=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:e,range:r.markText(e,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Es(o,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},prepareSelection:function(){var e=this.cm,t=e.display,n=e.doc,r=He(e);if(e.options.moveInputWithCursor){var i=ft(e,n.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),s=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+s.top-o.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+s.left-o.left))}return r},showSelection:function(e){var t=this.cm,n=t.display;Ui(n.cursorDiv,e.cursors),Ui(n.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},reset:function(e){if(!this.contextMenuPending){var t,n,r=this.cm,i=r.doc;if(r.somethingSelected()){this.prevInput="";var o=i.sel.primary();t=ta&&(o.to().line-o.from().line>100||(n=r.getSelection()).length>1e3);var s=t?"-":n||r.getSelection();this.textarea.value=s,r.state.focused&&Ws(this.textarea),yo&&bo>=9&&(this.hasSelection=s)}else e||(this.prevInput=this.textarea.value="",yo&&bo>=9&&(this.hasSelection=null));this.inaccurateSelection=t}},getField:function(){return this.textarea},supportsTouch:function(){return!1},focus:function(){if("nocursor"!=this.cm.options.readOnly&&(!Eo||zi()!=this.textarea))try{this.textarea.focus()}catch(e){}},blur:function(){this.textarea.blur()},resetPosition:function(){this.wrapper.style.top=this.wrapper.style.left=0},receivedFocus:function(){this.slowPoll()},slowPoll:function(){var e=this;e.pollingFast||e.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},fastPoll:function(){function e(){var r=n.poll();r||t?(n.pollingFast=!1,n.slowPoll()):(t=!0,n.polling.set(60,e))}var t=!1,n=this;n.pollingFast=!0,n.polling.set(20,e)},poll:function(){var e=this.cm,t=this.textarea,n=this.prevInput;if(this.contextMenuPending||!e.state.focused||ea(t)&&!n&&!this.composing||Z(e)||e.options.disableInput||e.state.keySeq)return!1;var r=t.value;if(r==n&&!e.somethingSelected())return!1;if(yo&&bo>=9&&this.hasSelection===r||_o&&/[\uf700-\uf7ff]/.test(r))return e.display.input.reset(),!1;if(e.doc.sel==e.display.selForContextMenu){var i=r.charCodeAt(0);if(8203!=i||n||(n="​"),8666==i)return this.reset(),this.cm.execCommand("undo")}for(var o=0,s=Math.min(n.length,r.length);o1e3||r.indexOf("\n")>-1?t.value=a.prevInput="":a.prevInput=r,a.composing&&(a.composing.range.clear(),a.composing.range=e.markText(a.composing.start,e.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},ensurePolled:function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},onKeyPress:function(){yo&&bo>=9&&(this.hasSelection=null),this.fastPoll()},onContextMenu:function(e){function t(){if(null!=s.selectionStart){var e=i.somethingSelected(),t="​"+(e?s.value:"");s.value="⇚",s.value=t,r.prevInput=e?"":"​",s.selectionStart=1,s.selectionEnd=t.length,o.selForContextMenu=i.doc.sel}}function n(){if(r.contextMenuPending=!1,r.wrapper.style.position="relative",s.style.cssText=u,yo&&bo<9&&o.scrollbars.setScrollTop(o.scroller.scrollTop=l),null!=s.selectionStart){(!yo||yo&&bo<9)&&t();var e=0,n=function(){o.selForContextMenu==i.doc.sel&&0==s.selectionStart&&s.selectionEnd>0&&"​"==r.prevInput?_t(i,ls.selectAll)(i):e++<10?o.detectingSelectAll=setTimeout(n,500):o.input.reset()};o.detectingSelectAll=setTimeout(n,200)}}var r=this,i=r.cm,o=i.display,s=r.textarea,a=Xt(i,e),l=o.scroller.scrollTop;if(a&&!ko){var c=i.options.resetSelectionOnContextMenu;c&&i.doc.sel.contains(a)==-1&&_t(i,Me)(i.doc,pe(a),Ds);var u=s.style.cssText;if(r.wrapper.style.position="absolute",s.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(e.clientY-5)+"px; left: "+(e.clientX-5)+"px; z-index: 1000; background: "+(yo?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",wo)var h=window.scrollY;if(o.input.focus(),wo&&window.scrollTo(null,h),o.input.reset(),i.somethingSelected()||(s.value=r.prevInput=" "),r.contextMenuPending=!0,o.selForContextMenu=i.doc.sel,clearTimeout(o.detectingSelectAll),yo&&bo>=9&&t(),Oo){Ms(e);var f=function(){As(window,"mouseup",f),setTimeout(n,20)};Es(window,"mouseup",f)}else setTimeout(n,50)}},readOnlyChanged:function(e){e||this.reset()},setUneditable:Hi,needsContentAttribute:!1},re.prototype),oe.prototype=Ni({init:function(e){function t(e){if(r.somethingSelected())Io=r.getSelections(),"cut"==e.type&&r.replaceSelection("",null,"cut");else{if(!r.options.lineWiseCopyCut)return;var t=te(r);Io=t.text,"cut"==e.type&&r.operation(function(){r.setSelections(t.ranges,0,Ds),r.replaceSelection("",null,"cut")})}if(e.clipboardData&&!Mo)e.preventDefault(),e.clipboardData.clearData(),e.clipboardData.setData("text/plain",Io.join("\n"));else{var n=ie(),i=n.firstChild;r.display.lineSpace.insertBefore(n,r.display.lineSpace.firstChild),i.value=Io.join("\n");var o=document.activeElement;Ws(i),setTimeout(function(){r.display.lineSpace.removeChild(n),o.focus()},50)}}var n=this,r=n.cm,i=n.div=e.lineDiv;ne(i),Es(i,"paste",function(e){J(e,r)}),Es(i,"compositionstart",function(e){var t=e.data;if(n.composing={sel:r.doc.sel,data:t,startData:t},t){var i=r.doc.sel.primary(),o=r.getLine(i.head.line),s=o.indexOf(t,Math.max(0,i.head.ch-t.length));s>-1&&s<=i.head.ch&&(n.composing.sel=pe(No(i.head.line,s),No(i.head.line,s+t.length)))}}),Es(i,"compositionupdate",function(e){n.composing.data=e.data}),Es(i,"compositionend",function(e){var t=n.composing;t&&(e.data==t.startData||/\u200b/.test(e.data)||(t.data=e.data),setTimeout(function(){t.handled||n.applyComposition(t), n.composing==t&&(n.composing=null)},50))}),Es(i,"touchstart",function(){n.forceCompositionEnd()}),Es(i,"input",function(){n.composing||!Z(r)&&n.pollContent()||Et(n.cm,function(){Ht(r)})}),Es(i,"copy",t),Es(i,"cut",t)},prepareSelection:function(){var e=He(this.cm,!1);return e.focus=this.cm.state.focused,e},showSelection:function(e){e&&this.cm.display.view.length&&(e.focus&&this.showPrimarySelection(),this.showMultipleSelections(e))},showPrimarySelection:function(){var e=window.getSelection(),t=this.cm.doc.sel.primary(),n=le(this.cm,e.anchorNode,e.anchorOffset),r=le(this.cm,e.focusNode,e.focusOffset);if(!n||n.bad||!r||r.bad||0!=Fo(K(n,r),t.from())||0!=Fo(q(n,r),t.to())){var i=se(this.cm,t.from()),o=se(this.cm,t.to());if(i||o){var s=this.cm.display.view,a=e.rangeCount&&e.getRangeAt(0);if(i){if(!o){var l=s[s.length-1].measure,c=l.maps?l.maps[l.maps.length-1]:l.map;o={node:c[c.length-1],offset:c[c.length-2]-c[c.length-3]}}}else i={node:s[0].measure.map[2],offset:0};try{var u=Bs(i.node,i.offset,o.offset,o.node)}catch(h){}u&&(e.removeAllRanges(),e.addRange(u),a&&null==e.anchorNode?e.addRange(a):go&&this.startGracePeriod()),this.rememberSelection()}}},startGracePeriod:function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){e.cm.curOp.selectionChanged=!0})},20)},showMultipleSelections:function(e){Ui(this.cm.display.cursorDiv,e.cursors),Ui(this.cm.display.selectionDiv,e.selection)},rememberSelection:function(){var e=window.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},selectionInEditor:function(){var e=window.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return Vs(this.div,t)},focus:function(){"nocursor"!=this.cm.options.readOnly&&this.div.focus()},blur:function(){this.div.blur()},getField:function(){return this.div},supportsTouch:function(){return!0},receivedFocus:function(){function e(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,e))}var t=this;this.selectionInEditor()?this.pollSelection():Et(this.cm,function(){t.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,e)},selectionChanged:function(){var e=window.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},pollSelection:function(){if(!this.composing&&!this.gracePeriod&&this.selectionChanged()){var e=window.getSelection(),t=this.cm;this.rememberSelection();var n=le(t,e.anchorNode,e.anchorOffset),r=le(t,e.focusNode,e.focusOffset);n&&r&&Et(t,function(){Me(t.doc,pe(n,r),Ds),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})}},pollContent:function(){var e=this.cm,t=e.display,n=e.doc.sel.primary(),r=n.from(),i=n.to();if(r.linet.viewTo-1)return!1;var o;if(r.line==t.viewFrom||0==(o=Ft(e,r.line)))var s=ei(t.view[0].line),a=t.view[0].node;else var s=ei(t.view[o].line),a=t.view[o-1].node.nextSibling;var l=Ft(e,i.line);if(l==t.view.length-1)var c=t.viewTo-1,u=t.lineDiv.lastChild;else var c=ei(t.view[l+1].line)-1,u=t.view[l+1].node.previousSibling;for(var h=e.doc.splitLines(ue(e,a,u,s,c)),f=Zr(e.doc,No(s,0),No(c,Yr(e.doc,c).text.length));h.length>1&&f.length>1;)if(Pi(h)==Pi(f))h.pop(),f.pop(),c--;else{if(h[0]!=f[0])break;h.shift(),f.shift(),s++}for(var d=0,p=0,g=h[0],m=f[0],v=Math.min(g.length,m.length);d1||h[0]||Fo(x,C)?(Pn(e.doc,h,x,C,"+input"),!0):void 0},ensurePolled:function(){this.forceCompositionEnd()},reset:function(){this.forceCompositionEnd()},forceCompositionEnd:function(){this.composing&&!this.composing.handled&&(this.applyComposition(this.composing),this.composing.handled=!0,this.div.blur(),this.div.focus())},applyComposition:function(e){Z(this.cm)?_t(this.cm,Ht)(this.cm):e.data&&e.data!=e.startData&&_t(this.cm,Q)(this.cm,e.data,0,e.sel)},setUneditable:function(e){e.contentEditable="false"},onKeyPress:function(e){e.preventDefault(),Z(this.cm)||_t(this.cm,Q)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0)},readOnlyChanged:function(e){this.div.contentEditable=String("nocursor"!=e)},onContextMenu:Hi,resetPosition:Hi,needsContentAttribute:!0},oe.prototype),e.inputStyles={textarea:re,contenteditable:oe},he.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&&Fo(e,r.to())<=0)return n}return-1}},fe.prototype={from:function(){return K(this.anchor,this.head)},to:function(){return q(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var jo,$o,Wo,Bo={left:0,right:0,top:0,bottom:0},Uo=null,zo=0,Xo=0,Vo=0,Go=null;yo?Go=-.53:go?Go=15:Co?Go=-.7:So&&(Go=-1/3);var qo=function(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==n&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:null==n&&(n=e.wheelDelta),{x:t,y:n}};e.wheelEventPixels=function(e){var t=qo(e);return t.x*=Go,t.y*=Go,t};var Ko=new _i,Yo=null,Zo=e.changeEnd=function(e){return e.text?No(e.from.line+e.text.length-1,Pi(e.text).length+(1==e.text.length?e.from.ch:0)):e.to};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,t){var n=this.options,r=n[e];n[e]==t&&"mode"!=e||(n[e]=t,Jo.hasOwnProperty(e)&&_t(this,Jo[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"](Vn(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,n=0;nn&&(jn(this,i.head.line,e,!0),n=i.head.line,r==this.doc.sel.primIndex&&Fn(this));else{var o=i.from(),s=i.to(),a=Math.max(n,o.line);n=Math.min(this.lastLine(),s.line-(s.ch?0:1))+1;for(var l=a;l0&&ke(this.doc,r,new fe(o,c[r].to()),Ds)}}}),getTokenAt:function(e,t){return Pr(this,e,t)},getLineTokens:function(e,t){return Pr(this,No(e),t,!0)},getTokenTypeAt:function(e){e=me(this.doc,e);var t,n=Hr(this,Yr(this.doc,e.line)),r=0,i=(n.length-1)/2,o=e.ch;if(0==o)t=n[2];else for(;;){var s=r+i>>1;if((s?n[2*s-1]:0)>=o)i=s;else{if(!(n[2*s+1]i&&(e=i,r=!0),n=Yr(this.doc,e)}else n=e;return ct(this,n,{top:0,left:0},t||"page").top+(r?this.doc.height-ni(n):0)},defaultTextHeight:function(){return vt(this.display)},defaultCharWidth:function(){return yt(this.display)},setGutterMarker:At(function(e,t,n){return $n(this.doc,e,"gutter",function(e){var r=e.gutterMarkers||(e.gutterMarkers={});return r[t]=n,!n&&ji(r)&&(e.gutterMarkers=null),!0})}),clearGutter:At(function(e){var t=this,n=t.doc,r=n.first;n.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&(n.gutterMarkers[e]=null,Dt(t,r,"gutter"),ji(n.gutterMarkers)&&(n.gutterMarkers=null)),++r})}),lineInfo:function(e){if("number"==typeof e){if(!ye(this.doc,e))return null;var t=e;if(e=Yr(this.doc,e),!e)return null}else{var t=ei(e);if(null==t)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 o=this.display;e=ft(this,me(this.doc,e));var s=e.bottom,a=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),o.sizer.appendChild(t),"over"==r)s=e.top;else if("above"==r||"near"==r){var l=Math.max(o.wrapper.clientHeight,this.doc.height),c=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==r||e.bottom+t.offsetHeight>l)&&e.top>t.offsetHeight?s=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=l&&(s=e.bottom),a+t.offsetWidth>c&&(a=c-t.offsetWidth)}t.style.top=s+"px",t.style.left=t.style.right="","right"==i?(a=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?a=0:"middle"==i&&(a=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=a+"px"),n&&Hn(this,a,s,a+t.offsetWidth,s+t.offsetHeight)},triggerOnKeyDown:At(hn),triggerOnKeyPress:At(pn),triggerOnKeyUp:dn,execCommand:function(e){if(ls.hasOwnProperty(e))return ls[e].call(null,this)},triggerElectric:At(function(e){ee(this,e)}),findPosH:function(e,t,n,r){var i=1;t<0&&(i=-1,t=-t);for(var o=0,s=me(this.doc,e);o0&&a(n.charAt(r-1));)--r;for(;i.5)&&s(this),Ps(this,"refresh",this)}),swapDoc:At(function(e){var t=this.doc;return t.cm=null,Kr(this,e),st(this),this.display.input.reset(),this.scrollTo(e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,ki(this,"swapDoc",this,t),t}),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Ei(e);var Qo=e.defaults={},Jo=e.optionHandlers={},es=e.Init={toString:function(){return"CodeMirror.Init"}};zn("value","",function(e,t){e.setValue(t)},!0),zn("mode",null,function(e,t){e.doc.modeOption=t,n(e)},!0),zn("indentUnit",2,n,!0),zn("indentWithTabs",!1),zn("smartIndent",!0),zn("tabSize",4,function(e){r(e),st(e),Ht(e)},!0),zn("lineSeparator",null,function(e,t){if(e.doc.lineSep=t,t){var n=[],r=e.doc.first;e.doc.iter(function(e){for(var i=0;;){var o=e.text.indexOf(t,i);if(o==-1)break;i=o+t.length,n.push(No(r,o))}r++});for(var i=n.length-1;i>=0;i--)Pn(e.doc,t,n[i],No(n[i].line,n[i].ch+t.length))}}),zn("specialChars",/[\t\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,function(t,n,r){t.state.specialChars=new RegExp(n.source+(n.test("\t")?"":"|\t"),"g"),r!=e.Init&&t.refresh()}),zn("specialCharPlaceholder",Ir,function(e){e.refresh()},!0),zn("electricChars",!0),zn("inputStyle",Eo?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),zn("rtlMoveVisually",!Ao),zn("wholeLineUpdateBefore",!0),zn("theme","default",function(e){a(e),l(e)},!0),zn("keyMap","default",function(t,n,r){var i=Vn(n),o=r!=e.Init&&Vn(r);o&&o.detach&&o.detach(t,i),i.attach&&i.attach(t,o||null)}),zn("extraKeys",null),zn("lineWrapping",!1,i,!0),zn("gutters",[],function(e){d(e.options),l(e)},!0),zn("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?S(e.display)+"px":"0",e.refresh()},!0),zn("coverGutterNextToScrollbar",!1,function(e){y(e)},!0),zn("scrollbarStyle","native",function(e){v(e),y(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),zn("lineNumbers",!1,function(e){d(e.options),l(e)},!0),zn("firstLineNumber",1,l,!0),zn("lineNumberFormatter",function(e){return e},l,!0),zn("showCursorWhenSelecting",!1,Oe,!0),zn("resetSelectionOnContextMenu",!0),zn("lineWiseCopyCut",!0),zn("readOnly",!1,function(e,t){"nocursor"==t?(vn(e),e.display.input.blur(),e.display.disabled=!0):e.display.disabled=!1,e.display.input.readOnlyChanged(t)}),zn("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),zn("dragDrop",!0,Bt),zn("allowDropFileTypes",null),zn("cursorBlinkRate",530),zn("cursorScrollMargin",0),zn("cursorHeight",1,Oe,!0),zn("singleCursorHeightPerLine",!0,Oe,!0),zn("workTime",100),zn("workDelay",100),zn("flattenSpans",!0,r,!0),zn("addModeClass",!1,r,!0),zn("pollInterval",100),zn("undoDepth",200,function(e,t){e.doc.history.undoDepth=t}),zn("historyEventDelay",1250),zn("viewportMargin",10,function(e){e.refresh()},!0),zn("maxHighlightLength",1e4,r,!0),zn("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),zn("tabindex",null,function(e,t){e.display.input.getField().tabIndex=t||""}),zn("autofocus",null);var ts=e.modes={},ns=e.mimeModes={};e.defineMode=function(t,n){e.defaults.mode||"null"==t||(e.defaults.mode=t),arguments.length>2&&(n.dependencies=Array.prototype.slice.call(arguments,2)),ts[t]=n},e.defineMIME=function(e,t){ns[e]=t},e.resolveMode=function(t){if("string"==typeof t&&ns.hasOwnProperty(t))t=ns[t];else if(t&&"string"==typeof t.name&&ns.hasOwnProperty(t.name)){var n=ns[t.name];"string"==typeof n&&(n={name:n}),t=Di(n,t),t.name=n.name}else if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return e.resolveMode("application/xml");return"string"==typeof t?{name:t}:t||{name:"null"}},e.getMode=function(t,n){var n=e.resolveMode(n),r=ts[n.name];if(!r)return e.getMode(t,"text/plain");var i=r(t,n);if(rs.hasOwnProperty(n.name)){var o=rs[n.name];for(var s in o)o.hasOwnProperty(s)&&(i.hasOwnProperty(s)&&(i["_"+s]=i[s]),i[s]=o[s])}if(i.name=n.name,n.helperType&&(i.helperType=n.helperType),n.modeProps)for(var s in n.modeProps)i[s]=n.modeProps[s];return i},e.defineMode("null",function(){return{token:function(e){e.skipToEnd()}}}),e.defineMIME("text/plain","null");var rs=e.modeExtensions={};e.extendMode=function(e,t){var n=rs.hasOwnProperty(e)?rs[e]:rs[e]={};Ni(t,n)},e.defineExtension=function(t,n){e.prototype[t]=n},e.defineDocExtension=function(e,t){Cs.prototype[e]=t},e.defineOption=zn;var is=[];e.defineInitHook=function(e){is.push(e)};var os=e.helpers={};e.registerHelper=function(t,n,r){os.hasOwnProperty(t)||(os[t]=e[t]={_global:[]}),os[t][n]=r},e.registerGlobalHelper=function(t,n,r,i){e.registerHelper(t,n,i),os[t]._global.push({pred:r,val:i})};var ss=e.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},as=e.startState=function(e,t,n){return!e.startState||e.startState(t,n)};e.innerMode=function(e,t){for(;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 ls=e.commands={selectAll:function(e){e.setSelection(No(e.firstLine(),0),No(e.lastLine()),Ds)},singleSelection:function(e){e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Ds)},killLine:function(e){Wn(e,function(t){if(t.empty()){var n=Yr(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line0)i=new No(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),No(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var s=Yr(e.doc,i.line-1).text;s&&e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+s.charAt(s.length-1),No(i.line-1,s.length-1),No(i.line,1),"+transpose")}n.push(new fe(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){Et(e,function(){for(var t=e.listSelections().length,n=0;n=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){if(this.post},eatSpace:function(){for(var e=this.pos;/[\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:(r&&t!==!1&&(this.pos+=r[0].length),r)}var i=function(e){return n?e.toLowerCase():e},o=this.string.substr(this.pos,e.length);if(i(o)==i(e))return 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 ps=0,gs=e.TextMarker=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ps};Ei(gs),gs.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&bt(e),Mi(this,"clear")){var n=this.find();n&&ki(this,"clear",n.from,n.to)}for(var r=null,i=null,o=0;oe.display.maxLineLength&&(e.display.maxLine=l,e.display.maxLineLength=c,e.display.maxLineChanged=!0)}null!=r&&e&&this.collapsed&&Ht(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Ae(e.doc)),e&&ki(e,"markerCleared",e,this),t&&xt(e),this.parent&&this.parent.clear()}},gs.prototype.find=function(e,t){null==e&&"bookmark"==this.type&&(e=1);for(var n,r,i=0;i1||!(this.children[0]instanceof Vr))){var a=[];this.collapse(a),this.children=[new Vr(a)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(;i.lines.length>50;){var s=i.lines.splice(i.lines.length-25,25),a=new Vr(s);i.height-=a.height,this.children.splice(r+1,0,a),a.parent=this}this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new Gr(t);if(e.parent){e.size-=n.size,e.height-=n.height;var r=Ri(e.parent.children,e);e.parent.children.splice(r+1,0,n)}else{var i=new Gr(e.children);i.parent=e,e.children=[i,n],e=i}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,n){for(var r=0;r=0;o--)Tn(this,r[o]);a?Le(this,a):this.cm&&Fn(this.cm)}),undo:Pt(function(){Mn(this,"undo")}),redo:Pt(function(){Mn(this,"redo")}),undoSelection:Pt(function(){Mn(this,"undo",!0)}),redoSelection:Pt(function(){Mn(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=me(this,e),t=me(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(o){var s=o.markedSpans;if(s)for(var a=0;al.to||null==l.from&&i!=e.line||i==t.line&&l.from>t.ch||n&&!n(l.marker)||r.push(l.marker.parent||l.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;re?(t=e,!0):(e-=i,void++n)}),me(this,No(n,t))},indexFromPos:function(e){e=me(this,e);var t=e.ch;return e.linet&&(t=e.from),null!=e.to&&e.to=t)return s+(t-o);s+=a-o,s+=n-s%n,o=a+1}},js=e.findColumn=function(e,t,n){for(var r=0,i=0;;){var o=e.indexOf("\t",r);o==-1&&(o=e.length);var s=o-r;if(o==e.length||i+s>=t)return r+Math.min(s,t-i);if(i+=o-r,i+=n-i%n,r=o+1,i>=t)return r}},$s=[""],Ws=function(e){e.select()};Mo?Ws=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:yo&&(Ws=function(e){try{e.select()}catch(t){}});var Bs,Us=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,zs=e.isWordChar=function(e){return/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||Us.test(e))},Xs=/[\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]/;Bs=document.createRange?function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}: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};var Vs=e.contains=function(e,t){if(3==t.nodeType&&(t=t.parentNode),e.contains)return e.contains(t);do if(11==t.nodeType&&(t=t.host),t==e)return!0;while(t=t.parentNode)};yo&&bo<11&&(zi=function(){try{return document.activeElement}catch(e){return document.body}});var Gs,qs,Ks=e.rmClass=function(e,t){var n=e.className,r=Xi(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:"")}},Ys=e.addClass=function(e,t){var n=e.className;Xi(t).test(n)||(e.className+=(n?" ":"")+t)},Zs=!1,Qs=function(){if(yo&&bo<9)return!1;var e=Wi("div");return"draggable"in e||"dragDrop"in e}(),Js=e.splitLines=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf("\n",t);i==-1&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),s=o.indexOf("\r");s!=-1?(n.push(o.slice(0,s)),t+=s+1):(n.push(o),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},ea=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)&&0!=t.compareEndPoints("StartToEnd",t)},ta=function(){var e=Wi("div");return"oncopy"in e||(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy)}(),na=null,ra=e.keyNames={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};!function(){for(var e=0;e<10;e++)ra[e+48]=ra[e+96]=String(e);for(var e=65;e<=90;e++)ra[e]=String.fromCharCode(e);for(var e=1;e<=12;e++)ra[e+111]=ra[e+63235]="F"+e}();var ia,oa=function(){function e(e){return e<=247?n.charAt(e):1424<=e&&e<=1524?"R":1536<=e&&e<=1773?r.charAt(e-1536):1774<=e&&e<=2220?"r":8192<=e&&e<=8203?"w":8204==e?"b":"L"}function t(e,t,n){this.level=e,this.from=t,this.to=n}var n="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",r="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,o=/[stwN]/,s=/[LRr]/,a=/[Lb1n]/,l=/[1n]/,c="L";return function(n){if(!i.test(n))return!1;for(var r,u=n.length,h=[],f=0;f|[*\]])\s*$|\*$/.test(e.string.slice(0,e.start))||void 0)}function f(e){for(;;){if(!e||"top"==e.type)return!0;if("}"==e.type&&"namespace"!=e.prev.type)return!1;e=e.prev}}var d,p,g=t.indentUnit,m=r.statementIndentUnit||g,v=r.dontAlignCalls,y=r.keywords||{},b=r.types||{},w=r.builtin||{},x=r.blockKeywords||{},C=r.defKeywords||{},k=r.atoms||{},S=r.hooks||{},T=r.multiLineStrings,L=r.indentStatements!==!1,M=r.indentSwitch!==!1,E=r.namespaceSeparator,_=r.isPunctuationChar||/[\[\]{}\(\),;\:\.]/,A=r.isNumberChar||/\d/,P=r.isOperatorChar||/[+\-*&%=<>!?|\/]/,R=r.endStatement||/^[;:,]$/;return{startState:function(e){return{tokenize:null,context:new a((e||0)-g,0,"top",(!1)),indented:0,startOfLine:!0,prevToken:null}},token:function(e,t){var n=t.context;if(e.sol()&&(null==n.align&&(n.align=!1),t.indented=e.indentation(),t.startOfLine=!0),e.eatSpace())return null;d=p=null;var o=(t.tokenize||i)(e,t);if("comment"==o||"meta"==o)return o;if(null==n.align&&(n.align=!0),R.test(d))for(;l(t.context.type);)u(t);else if("{"==d)c(t,e.column(),"}");else if("["==d)c(t,e.column(),"]");else if("("==d)c(t,e.column(),")");else if("}"==d){for(;l(n.type);)n=u(t);for("}"==n.type&&(n=u(t));l(n.type);)n=u(t)}else if(d==n.type)u(t);else if(L&&(("}"==n.type||"top"==n.type)&&";"!=d||l(n.type)&&"newstatement"==d)){var s="statement";"newstatement"==d&&M&&"switch"==e.current()?s="switchstatement":"keyword"==o&&"namespace"==e.current()&&(s="namespace"),c(t,e.column(),s)}if("variable"==o&&("def"==t.prevToken||r.typeFirstDefinitions&&h(e,t)&&f(t.context)&&e.match(/^\s*\(/,!1))&&(o="def"),S.token){var a=S.token(e,t,o);void 0!==a&&(o=a)}return"def"==o&&r.styleDefs===!1&&(o="variable"),t.startOfLine=!1,t.prevToken=p?"def":o||d,o},indent:function(t,n){if(t.tokenize!=i&&null!=t.tokenize)return e.Pass;var r=t.context,o=n&&n.charAt(0);if(l(r.type)&&"}"==o&&(r=r.prev),S.indent){var s=S.indent(t,r,n);if("number"==typeof s)return s}var a=o==r.type,c=r.prev&&"switchstatement"==r.prev.type;return l(r.type)?r.indented+("{"==o?0:m):!r.align||v&&")"==r.type?")"!=r.type||a?r.indented+(a?0:g)+(a||!c||/^(?:case|default)\b/.test(n)?0:g):r.indented+m:r.column+(a?0:1)},electricInput:M?/^\s*(?:case .*?:|default:|\{\}?|\})$/:/^\s*[{}]$/,blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",fold:"brace"}});var d="auto if break case register continue return default do sizeof static else struct switch extern typedef float union for goto while enum const volatile",p="int long char short double float unsigned signed void size_t ptrdiff_t";u(["text/x-csrc","text/x-c","text/x-chdr"],{name:"clike",keywords:t(d),types:t(p+" bool _Complex _Bool float_t double_t intptr_t intmax_t int8_t int16_t int32_t int64_t uintptr_t uintmax_t uint8_t uint16_t uint32_t uint64_t"),blockKeywords:t("case do else for if switch while struct"),defKeywords:t("struct"),typeFirstDefinitions:!0,atoms:t("null true false"),hooks:{"#":r,"*":i},modeProps:{fold:["brace","include"]}}),u(["text/x-c++src","text/x-c++hdr"],{name:"clike",keywords:t(d+" asm dynamic_cast namespace reinterpret_cast try explicit new static_cast typeid catch operator template typename class friend private this using const_cast inline public throw virtual delete mutable protected alignas alignof constexpr decltype nullptr noexcept thread_local final static_assert override"),types:t(p+" bool wchar_t"),blockKeywords:t("catch class do else finally for if struct switch try while"),defKeywords:t("class namespace struct enum union"),typeFirstDefinitions:!0,atoms:t("true false null"),hooks:{"#":r,"*":i,u:s,U:s,L:s,R:s,0:o,1:o,2:o,3:o,4:o,5:o,6:o,7:o,8:o,9:o,token:function(e,t,n){if("variable"==n&&"("==e.peek()&&(";"==t.prevToken||null==t.prevToken||"}"==t.prevToken)&&a(e.current()))return"def"}},namespaceSeparator:"::",modeProps:{fold:["brace","include"]}}),u("text/x-java",{name:"clike",keywords:t("abstract assert break case catch class const continue default do else enum extends final finally float for goto if implements import instanceof interface native new package private protected public return static strictfp super switch synchronized this throw throws transient try volatile while"),types:t("byte short int long float double boolean char void Boolean Byte Character Double Float Integer Long Number Object Short String StringBuffer StringBuilder Void"),blockKeywords:t("catch class do else finally for if switch try while"),defKeywords:t("class interface package enum"),typeFirstDefinitions:!0,atoms:t("true false null"),endStatement:/^[;:]$/,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"}},modeProps:{fold:["brace","import"]}}),u("text/x-csharp",{name:"clike",keywords:t("abstract as async await base break case catch checked class const continue default delegate do else enum event explicit extern finally fixed for foreach goto if implicit in interface internal is lock namespace new operator out override params private protected public readonly ref return sealed sizeof stackalloc static struct switch this throw try typeof unchecked unsafe using virtual void volatile while add alias ascending descending dynamic from get global group into join let orderby partial remove select set value var yield"),types:t("Action Boolean Byte Char DateTime DateTimeOffset Decimal Double Func Guid Int16 Int32 Int64 Object SByte Single String Task TimeSpan UInt16 UInt32 UInt64 bool byte char decimal double short int long object sbyte float string ushort uint ulong"),blockKeywords:t("catch class do else finally for foreach if struct switch try while"),defKeywords:t("class interface namespace struct var"),typeFirstDefinitions:!0,atoms:t("true false null"),hooks:{"@":function(e,t){return e.eat('"')?(t.tokenize=l,l(e,t)):(e.eatWhile(/[\w\$_]/),"meta")}}}),u("text/x-scala",{name:"clike",keywords:t("abstract case catch class def do else extends final finally for forSome if implicit import lazy match new null object override package private protected return sealed super this throw trait try type val var while with yield _ : = => <- <: <% >: # @ assert assume require print println printf readLine readBoolean readByte readShort readChar readInt readLong readFloat readDouble :: #:: "),types:t("AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either Enumeration Equiv Error Exception Fractional Function IndexedSeq Integral Iterable Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"),multiLineStrings:!0,blockKeywords:t("catch class do else finally for forSome if match switch try while"),defKeywords:t("class def object package trait type val var"),atoms:t("true false null"),indentStatements:!1,indentSwitch:!1,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,t){return!!e.match('""')&&(t.tokenize=h,t.tokenize(e,t))},"'":function(e){return e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"}},modeProps:{closeBrackets:{triples:'"'}}}),u("text/x-kotlin",{name:"clike",keywords:t("package as typealias class interface this super val var fun for is in This throw return break continue object if else while do try when !in !is as?file import where by get set abstract enum open inner override private public internal protected catch finally out final vararg reified dynamic companion constructor init sealed field property receiver param sparam lateinit data inline noinline tailrec external annotation crossinline"),types:t("Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"),multiLineStrings:!0,blockKeywords:t("catch class do else finally for if where try while enum"),defKeywords:t("class val var object package interface fun"),atoms:t("true false null this"),modeProps:{closeBrackets:{triples:'"'}}}),u(["x-shader/x-vertex","x-shader/x-fragment"],{name:"clike",keywords:t("sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadow const attribute uniform varying break continue discard return for while do if else struct in out inout"),types:t("float int bool void vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 mat2 mat3 mat4"),blockKeywords:t("for while do if else struct"),builtin:t("radians degrees sin cos tan asin acos atan pow exp log exp2 sqrt inversesqrt abs sign floor ceil fract mod min max clamp mix step smoothstep length distance dot cross normalize ftransform faceforward reflect refract matrixCompMult lessThan lessThanEqual greaterThan greaterThanEqual equal notEqual any all not texture1D texture1DProj texture1DLod texture1DProjLod texture2D texture2DProj texture2DLod texture2DProjLod texture3D texture3DProj texture3DLod texture3DProjLod textureCube textureCubeLod shadow1D shadow2D shadow1DProj shadow2DProj shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod dFdx dFdy fwidth noise1 noise2 noise3 noise4"), atoms:t("true false gl_FragColor gl_SecondaryColor gl_Normal gl_Vertex gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_FogCoord gl_PointCoord gl_Position gl_PointSize gl_ClipVertex gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor gl_TexCoord gl_FogFragCoord gl_FragCoord gl_FrontFacing gl_FragData gl_FragDepth gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse gl_TexureMatrixTranspose gl_ModelViewMatrixInverseTranspose gl_ProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixInverseTranspose gl_TextureMatrixInverseTranspose gl_NormalScale gl_DepthRange gl_ClipPlane gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource gl_LightModel gl_FrontLightModelProduct gl_BackLightModelProduct gl_TextureColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ gl_FogParameters gl_MaxLights gl_MaxClipPlanes gl_MaxTextureUnits gl_MaxTextureCoords gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits gl_MaxDrawBuffers"),indentSwitch:!1,hooks:{"#":r},modeProps:{fold:["brace","include"]}}),u("text/x-nesc",{name:"clike",keywords:t(d+"as atomic async call command component components configuration event generic implementation includes interface module new norace nx_struct nx_union post provides signal task uses abstract extends"),types:t(p),blockKeywords:t("case do else for if switch while struct"),atoms:t("null true false"),hooks:{"#":r},modeProps:{fold:["brace","include"]}}),u("text/x-objectivec",{name:"clike",keywords:t(d+"inline restrict _Bool _Complex _Imaginery BOOL Class bycopy byref id IMP in inout nil oneway out Protocol SEL self super atomic nonatomic retain copy readwrite readonly"),types:t(p),atoms:t("YES NO NULL NILL ON OFF true false"),hooks:{"@":function(e){return e.eatWhile(/[\w\$]/),"keyword"},"#":r,indent:function(e,t,n){if("statement"==t.type&&/^@\w/.test(n))return t.indented}},modeProps:{fold:"brace"}}),u("text/x-squirrel",{name:"clike",keywords:t("base break clone continue const default delete enum extends function in class foreach local resume return this throw typeof yield constructor instanceof static"),types:t(p),blockKeywords:t("case catch class else for foreach if switch try while"),defKeywords:t("function local class"),typeFirstDefinitions:!0,atoms:t("true false null"),hooks:{"#":r},modeProps:{fold:["brace","include"]}});var g=null;u("text/x-ceylon",{name:"clike",keywords:t("abstracts alias assembly assert assign break case catch class continue dynamic else exists extends finally for function given if import in interface is let module new nonempty object of out outer package return satisfies super switch then this throw try value void while"),types:function(e){var t=e.charAt(0);return t===t.toUpperCase()&&t!==t.toLowerCase()},blockKeywords:t("case catch class dynamic else finally for function if interface module new object switch try while"),defKeywords:t("class dynamic function interface module object package value"),builtin:t("abstract actual aliased annotation by default deprecated doc final formal late license native optional sealed see serializable shared suppressWarnings tagged throws variable"),isPunctuationChar:/[\[\]{}\(\),;\:\.`]/,isOperatorChar:/[+\-*&%=<>!?|^~:\/]/,isNumberChar:/[\d#$]/,multiLineStrings:!0,typeFirstDefinitions:!0,atoms:t("true false null larger smaller equal empty finished"),indentSwitch:!1,styleDefs:!1,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,t){return t.tokenize=f(e.match('""')?"triple":"single"),t.tokenize(e,t)},"`":function(e,t){return!(!g||!e.match("`"))&&(t.tokenize=g,g=null,t.tokenize(e,t))},"'":function(e){return e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},token:function(e,t,n){if(("variable"==n||"variable-3"==n)&&"."==t.prevToken)return"variable-2"}},modeProps:{fold:["brace","import"],closeBrackets:{triples:'"'}}})})},{"../../lib/codemirror":30}],32:[function(e,t,n){e("../modules/web.dom.iterable"),e("../modules/es6.string.iterator"),t.exports=e("../modules/core.get-iterator")},{"../modules/core.get-iterator":95,"../modules/es6.string.iterator":104,"../modules/web.dom.iterable":106}],33:[function(e,t,n){e("../../modules/es6.object.assign"),t.exports=e("../../modules/$.core").Object.assign},{"../../modules/$.core":49,"../../modules/es6.object.assign":97}],34:[function(e,t,n){var r=e("../../modules/$");t.exports=function(e,t){return r.create(e,t)}},{"../../modules/$":71}],35:[function(e,t,n){var r=e("../../modules/$");t.exports=function(e,t,n){return r.setDesc(e,t,n)}},{"../../modules/$":71}],36:[function(e,t,n){var r=e("../../modules/$");e("../../modules/es6.object.get-own-property-descriptor"),t.exports=function(e,t){return r.getDesc(e,t)}},{"../../modules/$":71,"../../modules/es6.object.get-own-property-descriptor":98}],37:[function(e,t,n){e("../../modules/es6.object.keys"),t.exports=e("../../modules/$.core").Object.keys},{"../../modules/$.core":49,"../../modules/es6.object.keys":99}],38:[function(e,t,n){e("../../modules/es6.object.set-prototype-of"),t.exports=e("../../modules/$.core").Object.setPrototypeOf},{"../../modules/$.core":49,"../../modules/es6.object.set-prototype-of":100}],39:[function(e,t,n){e("../modules/es6.object.to-string"),e("../modules/es6.string.iterator"),e("../modules/web.dom.iterable"),e("../modules/es6.promise"),t.exports=e("../modules/$.core").Promise},{"../modules/$.core":49,"../modules/es6.object.to-string":101,"../modules/es6.promise":102,"../modules/es6.string.iterator":104,"../modules/web.dom.iterable":106}],40:[function(e,t,n){e("../modules/es6.object.to-string"),e("../modules/es6.string.iterator"),e("../modules/web.dom.iterable"),e("../modules/es6.set"),e("../modules/es7.set.to-json"),t.exports=e("../modules/$.core").Set},{"../modules/$.core":49,"../modules/es6.object.to-string":101,"../modules/es6.set":103,"../modules/es6.string.iterator":104,"../modules/es7.set.to-json":105,"../modules/web.dom.iterable":106}],41:[function(e,t,n){t.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},{}],42:[function(e,t,n){t.exports=function(){}},{}],43:[function(e,t,n){var r=e("./$.is-object");t.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},{"./$.is-object":64}],44:[function(e,t,n){var r=e("./$.cof"),i=e("./$.wks")("toStringTag"),o="Arguments"==r(function(){return arguments}());t.exports=function(e){var t,n,s;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=(t=Object(e))[i])?n:o?r(t):"Object"==(s=r(t))&&"function"==typeof t.callee?"Arguments":s}},{"./$.cof":45,"./$.wks":93}],45:[function(e,t,n){var r={}.toString;t.exports=function(e){return r.call(e).slice(8,-1)}},{}],46:[function(e,t,n){"use strict";var r=e("./$"),i=e("./$.hide"),o=e("./$.redefine-all"),s=e("./$.ctx"),a=e("./$.strict-new"),l=e("./$.defined"),c=e("./$.for-of"),u=e("./$.iter-define"),h=e("./$.iter-step"),f=e("./$.uid")("id"),d=e("./$.has"),p=e("./$.is-object"),g=e("./$.set-species"),m=e("./$.descriptors"),v=Object.isExtensible||p,y=m?"_s":"size",b=0,w=function(e,t){if(!p(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!d(e,f)){if(!v(e))return"F";if(!t)return"E";i(e,f,++b)}return"O"+e[f]},x=function(e,t){var n,r=w(t);if("F"!==r)return e._i[r];for(n=e._f;n;n=n.n)if(n.k==t)return n};t.exports={getConstructor:function(e,t,n,i){var u=e(function(e,o){a(e,u,t),e._i=r.create(null),e._f=void 0,e._l=void 0,e[y]=0,void 0!=o&&c(o,n,e[i],e)});return o(u.prototype,{clear:function(){for(var e=this,t=e._i,n=e._f;n;n=n.n)n.r=!0,n.p&&(n.p=n.p.n=void 0),delete t[n.i];e._f=e._l=void 0,e[y]=0},"delete":function(e){var t=this,n=x(t,e);if(n){var r=n.n,i=n.p;delete t._i[n.i],n.r=!0,i&&(i.n=r),r&&(r.p=i),t._f==n&&(t._f=r),t._l==n&&(t._l=i),t[y]--}return!!n},forEach:function(e){for(var t,n=s(e,arguments.length>1?arguments[1]:void 0,3);t=t?t.n:this._f;)for(n(t.v,t.k,this);t&&t.r;)t=t.p},has:function(e){return!!x(this,e)}}),m&&r.setDesc(u.prototype,"size",{get:function(){return l(this[y])}}),u},def:function(e,t,n){var r,i,o=x(e,t);return o?o.v=n:(e._l=o={i:i=w(t,!0),k:t,v:n,p:r=e._l,n:void 0,r:!1},e._f||(e._f=o),r&&(r.n=o),e[y]++,"F"!==i&&(e._i[i]=o)),e},getEntry:x,setStrong:function(e,t,n){u(e,t,function(e,t){this._t=e,this._k=t,this._l=void 0},function(){for(var e=this,t=e._k,n=e._l;n&&n.r;)n=n.p;return e._t&&(e._l=n=n?n.n:e._t._f)?"keys"==t?h(0,n.k):"values"==t?h(0,n.v):h(0,[n.k,n.v]):(e._t=void 0,h(1))},n?"entries":"values",!n,!0),g(t)}}},{"./$":71,"./$.ctx":50,"./$.defined":51,"./$.descriptors":52,"./$.for-of":56,"./$.has":58,"./$.hide":59,"./$.is-object":64,"./$.iter-define":67,"./$.iter-step":69,"./$.redefine-all":77,"./$.set-species":81,"./$.strict-new":85,"./$.uid":92}],47:[function(e,t,n){var r=e("./$.for-of"),i=e("./$.classof");t.exports=function(e){return function(){if(i(this)!=e)throw TypeError(e+"#toJSON isn't generic");var t=[];return r(this,!1,t.push,t),t}}},{"./$.classof":44,"./$.for-of":56}],48:[function(e,t,n){"use strict";var r=e("./$"),i=e("./$.global"),o=e("./$.export"),s=e("./$.fails"),a=e("./$.hide"),l=e("./$.redefine-all"),c=e("./$.for-of"),u=e("./$.strict-new"),h=e("./$.is-object"),f=e("./$.set-to-string-tag"),d=e("./$.descriptors");t.exports=function(e,t,n,p,g,m){var v=i[e],y=v,b=g?"set":"add",w=y&&y.prototype,x={};return d&&"function"==typeof y&&(m||w.forEach&&!s(function(){(new y).entries().next()}))?(y=t(function(t,n){u(t,y,e),t._c=new v,void 0!=n&&c(n,g,t[b],t)}),r.each.call("add,clear,delete,forEach,get,has,set,keys,values,entries".split(","),function(e){var t="add"==e||"set"==e;e in w&&(!m||"clear"!=e)&&a(y.prototype,e,function(n,r){if(!t&&m&&!h(n))return"get"==e&&void 0;var i=this._c[e](0===n?0:n,r);return t?this:i})}),"size"in w&&r.setDesc(y.prototype,"size",{get:function(){return this._c.size}})):(y=p.getConstructor(t,e,g,b),l(y.prototype,n)),f(y,e),x[e]=y,o(o.G+o.W+o.F,x),m||p.setStrong(y,e,g),y}},{"./$":71,"./$.descriptors":52,"./$.export":54,"./$.fails":55,"./$.for-of":56,"./$.global":57,"./$.hide":59,"./$.is-object":64,"./$.redefine-all":77,"./$.set-to-string-tag":82,"./$.strict-new":85}],49:[function(e,t,n){var r=t.exports={version:"1.2.6"};"number"==typeof __e&&(__e=r)},{}],50:[function(e,t,n){var r=e("./$.a-function");t.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}}},{"./$.a-function":41}],51:[function(e,t,n){t.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},{}],52:[function(e,t,n){t.exports=!e("./$.fails")(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},{"./$.fails":55}],53:[function(e,t,n){var r=e("./$.is-object"),i=e("./$.global").document,o=r(i)&&r(i.createElement);t.exports=function(e){return o?i.createElement(e):{}}},{"./$.global":57,"./$.is-object":64}],54:[function(e,t,n){var r=e("./$.global"),i=e("./$.core"),o=e("./$.ctx"),s="prototype",a=function(e,t,n){var l,c,u,h=e&a.F,f=e&a.G,d=e&a.S,p=e&a.P,g=e&a.B,m=e&a.W,v=f?i:i[t]||(i[t]={}),y=f?r:d?r[t]:(r[t]||{})[s];f&&(n=t);for(l in n)c=!h&&y&&l in y,c&&l in v||(u=c?y[l]:n[l],v[l]=f&&"function"!=typeof y[l]?n[l]:g&&c?o(u,r):m&&y[l]==u?function(e){var t=function(t){return this instanceof e?new e(t):e(t)};return t[s]=e[s],t}(u):p&&"function"==typeof u?o(Function.call,u):u,p&&((v[s]||(v[s]={}))[l]=u))};a.F=1,a.G=2,a.S=4,a.P=8,a.B=16,a.W=32,t.exports=a},{"./$.core":49,"./$.ctx":50,"./$.global":57}],55:[function(e,t,n){t.exports=function(e){try{return!!e()}catch(t){return!0}}},{}],56:[function(e,t,n){var r=e("./$.ctx"),i=e("./$.iter-call"),o=e("./$.is-array-iter"),s=e("./$.an-object"),a=e("./$.to-length"),l=e("./core.get-iterator-method");t.exports=function(e,t,n,c){var u,h,f,d=l(e),p=r(n,c,t?2:1),g=0;if("function"!=typeof d)throw TypeError(e+" is not iterable!");if(o(d))for(u=a(e.length);u>g;g++)t?p(s(h=e[g])[0],h[1]):p(e[g]);else for(f=d.call(e);!(h=f.next()).done;)i(f,p,h.value,t)}},{"./$.an-object":43,"./$.ctx":50,"./$.is-array-iter":63,"./$.iter-call":65,"./$.to-length":90,"./core.get-iterator-method":94}],57:[function(e,t,n){var r=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=r)},{}],58:[function(e,t,n){var r={}.hasOwnProperty;t.exports=function(e,t){return r.call(e,t)}},{}],59:[function(e,t,n){var r=e("./$"),i=e("./$.property-desc");t.exports=e("./$.descriptors")?function(e,t,n){return r.setDesc(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},{"./$":71,"./$.descriptors":52,"./$.property-desc":76}],60:[function(e,t,n){t.exports=e("./$.global").document&&document.documentElement},{"./$.global":57}],61:[function(e,t,n){t.exports=function(e,t,n){var r=void 0===n;switch(t.length){case 0:return r?e():e.call(n);case 1:return r?e(t[0]):e.call(n,t[0]);case 2:return r?e(t[0],t[1]):e.call(n,t[0],t[1]);case 3:return r?e(t[0],t[1],t[2]):e.call(n,t[0],t[1],t[2]);case 4:return r?e(t[0],t[1],t[2],t[3]):e.call(n,t[0],t[1],t[2],t[3])}return e.apply(n,t)}},{}],62:[function(e,t,n){var r=e("./$.cof");t.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},{"./$.cof":45}],63:[function(e,t,n){var r=e("./$.iterators"),i=e("./$.wks")("iterator"),o=Array.prototype;t.exports=function(e){return void 0!==e&&(r.Array===e||o[i]===e)}},{"./$.iterators":70,"./$.wks":93}],64:[function(e,t,n){t.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},{}],65:[function(e,t,n){var r=e("./$.an-object");t.exports=function(e,t,n,i){try{return i?t(r(n)[0],n[1]):t(n)}catch(o){var s=e["return"];throw void 0!==s&&r(s.call(e)),o}}},{"./$.an-object":43}],66:[function(e,t,n){"use strict";var r=e("./$"),i=e("./$.property-desc"),o=e("./$.set-to-string-tag"),s={};e("./$.hide")(s,e("./$.wks")("iterator"),function(){return this}),t.exports=function(e,t,n){e.prototype=r.create(s,{next:i(1,n)}),o(e,t+" Iterator")}},{"./$":71,"./$.hide":59,"./$.property-desc":76,"./$.set-to-string-tag":82,"./$.wks":93}],67:[function(e,t,n){"use strict";var r=e("./$.library"),i=e("./$.export"),o=e("./$.redefine"),s=e("./$.hide"),a=e("./$.has"),l=e("./$.iterators"),c=e("./$.iter-create"),u=e("./$.set-to-string-tag"),h=e("./$").getProto,f=e("./$.wks")("iterator"),d=!([].keys&&"next"in[].keys()),p="@@iterator",g="keys",m="values",v=function(){return this};t.exports=function(e,t,n,y,b,w,x){c(n,t,y);var C,k,S=function(e){if(!d&&e in E)return E[e];switch(e){case g:return function(){return new n(this,e)};case m:return function(){return new n(this,e)}}return function(){return new n(this,e)}},T=t+" Iterator",L=b==m,M=!1,E=e.prototype,_=E[f]||E[p]||b&&E[b],A=_||S(b);if(_){var P=h(A.call(new e));u(P,T,!0),!r&&a(E,p)&&s(P,f,v),L&&_.name!==m&&(M=!0,A=function(){return _.call(this)})}if(r&&!x||!d&&!M&&E[f]||s(E,f,A),l[t]=A,l[T]=v,b)if(C={values:L?A:S(m),keys:w?A:S(g),entries:L?S("entries"):A},x)for(k in C)k in E||o(E,k,C[k]);else i(i.P+i.F*(d||M),t,C);return C}},{"./$":71,"./$.export":54,"./$.has":58,"./$.hide":59,"./$.iter-create":66,"./$.iterators":70,"./$.library":72,"./$.redefine":78,"./$.set-to-string-tag":82,"./$.wks":93}],68:[function(e,t,n){var r=e("./$.wks")("iterator"),i=!1;try{var o=[7][r]();o["return"]=function(){i=!0},Array.from(o,function(){throw 2})}catch(s){}t.exports=function(e,t){if(!t&&!i)return!1;var n=!1;try{var o=[7],s=o[r]();s.next=function(){return{done:n=!0}},o[r]=function(){return s},e(o)}catch(a){}return n}},{"./$.wks":93}],69:[function(e,t,n){t.exports=function(e,t){return{value:t,done:!!e}}},{}],70:[function(e,t,n){t.exports={}},{}],71:[function(e,t,n){var r=Object;t.exports={create:r.create,getProto:r.getPrototypeOf,isEnum:{}.propertyIsEnumerable,getDesc:r.getOwnPropertyDescriptor,setDesc:r.defineProperty,setDescs:r.defineProperties,getKeys:r.keys,getNames:r.getOwnPropertyNames,getSymbols:r.getOwnPropertySymbols,each:[].forEach}},{}],72:[function(e,t,n){t.exports=!0},{}],73:[function(e,t,n){var r,i,o,s=e("./$.global"),a=e("./$.task").set,l=s.MutationObserver||s.WebKitMutationObserver,c=s.process,u=s.Promise,h="process"==e("./$.cof")(c),f=function(){var e,t,n;for(h&&(e=c.domain)&&(c.domain=null,e.exit());r;)t=r.domain,n=r.fn,t&&t.enter(),n(),t&&t.exit(),r=r.next;i=void 0,e&&e.enter()};if(h)o=function(){c.nextTick(f)};else if(l){var d=1,p=document.createTextNode("");new l(f).observe(p,{characterData:!0}),o=function(){p.data=d=-d}}else o=u&&u.resolve?function(){u.resolve().then(f)}:function(){a.call(s,f)};t.exports=function(e){var t={fn:e,next:void 0,domain:h&&c.domain};i&&(i.next=t),r||(r=t,o()),i=t}},{"./$.cof":45,"./$.global":57,"./$.task":87}],74:[function(e,t,n){var r=e("./$"),i=e("./$.to-object"),o=e("./$.iobject");t.exports=e("./$.fails")(function(){var e=Object.assign,t={},n={},r=Symbol(),i="abcdefghijklmnopqrst";return t[r]=7,i.split("").forEach(function(e){n[e]=e}),7!=e({},t)[r]||Object.keys(e({},n)).join("")!=i})?function(e,t){for(var n=i(e),s=arguments,a=s.length,l=1,c=r.getKeys,u=r.getSymbols,h=r.isEnum;a>l;)for(var f,d=o(s[l++]),p=u?c(d).concat(u(d)):c(d),g=p.length,m=0;g>m;)h.call(d,f=p[m++])&&(n[f]=d[f]);return n}:Object.assign},{"./$":71,"./$.fails":55,"./$.iobject":62,"./$.to-object":91}],75:[function(e,t,n){var r=e("./$.export"),i=e("./$.core"),o=e("./$.fails");t.exports=function(e,t){var n=(i.Object||{})[e]||Object[e],s={};s[e]=t(n),r(r.S+r.F*o(function(){n(1)}),"Object",s)}},{"./$.core":49,"./$.export":54,"./$.fails":55}],76:[function(e,t,n){t.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},{}],77:[function(e,t,n){var r=e("./$.redefine");t.exports=function(e,t){for(var n in t)r(e,n,t[n]);return e}},{"./$.redefine":78}],78:[function(e,t,n){t.exports=e("./$.hide")},{"./$.hide":59}],79:[function(e,t,n){t.exports=Object.is||function(e,t){return e===t?0!==e||1/e===1/t:e!=e&&t!=t}},{}],80:[function(e,t,n){var r=e("./$").getDesc,i=e("./$.is-object"),o=e("./$.an-object"),s=function(e,t){if(o(e),!i(t)&&null!==t)throw TypeError(t+": can't set as prototype!")};t.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,n,i){try{i=e("./$.ctx")(Function.call,r(Object.prototype,"__proto__").set,2),i(t,[]),n=!(t instanceof Array)}catch(o){n=!0}return function(e,t){return s(e,t),n?e.__proto__=t:i(e,t),e}}({},!1):void 0),check:s}},{"./$":71,"./$.an-object":43,"./$.ctx":50,"./$.is-object":64}],81:[function(e,t,n){"use strict";var r=e("./$.core"),i=e("./$"),o=e("./$.descriptors"),s=e("./$.wks")("species");t.exports=function(e){var t=r[e];o&&t&&!t[s]&&i.setDesc(t,s,{configurable:!0,get:function(){return this}})}},{"./$":71,"./$.core":49,"./$.descriptors":52,"./$.wks":93}],82:[function(e,t,n){var r=e("./$").setDesc,i=e("./$.has"),o=e("./$.wks")("toStringTag");t.exports=function(e,t,n){e&&!i(e=n?e:e.prototype,o)&&r(e,o,{configurable:!0,value:t})}},{"./$":71,"./$.has":58,"./$.wks":93}],83:[function(e,t,n){var r=e("./$.global"),i="__core-js_shared__",o=r[i]||(r[i]={});t.exports=function(e){return o[e]||(o[e]={})}},{"./$.global":57}],84:[function(e,t,n){var r=e("./$.an-object"),i=e("./$.a-function"),o=e("./$.wks")("species");t.exports=function(e,t){var n,s=r(e).constructor;return void 0===s||void 0==(n=r(s)[o])?t:i(n)}},{"./$.a-function":41,"./$.an-object":43,"./$.wks":93}],85:[function(e,t,n){t.exports=function(e,t,n){if(!(e instanceof t))throw TypeError(n+": use the 'new' operator!");return e}},{}],86:[function(e,t,n){var r=e("./$.to-integer"),i=e("./$.defined");t.exports=function(e){return function(t,n){var o,s,a=String(i(t)),l=r(n),c=a.length;return l<0||l>=c?e?"":void 0:(o=a.charCodeAt(l),o<55296||o>56319||l+1===c||(s=a.charCodeAt(l+1))<56320||s>57343?e?a.charAt(l):o:e?a.slice(l,l+2):(o-55296<<10)+(s-56320)+65536)}}},{"./$.defined":51,"./$.to-integer":88}],87:[function(e,t,n){var r,i,o,s=e("./$.ctx"),a=e("./$.invoke"),l=e("./$.html"),c=e("./$.dom-create"),u=e("./$.global"),h=u.process,f=u.setImmediate,d=u.clearImmediate,p=u.MessageChannel,g=0,m={},v="onreadystatechange",y=function(){var e=+this;if(m.hasOwnProperty(e)){var t=m[e];delete m[e],t()}},b=function(e){y.call(e.data)};f&&d||(f=function(e){for(var t=[],n=1;arguments.length>n;)t.push(arguments[n++]);return m[++g]=function(){a("function"==typeof e?e:Function(e),t)},r(g),g},d=function(e){delete m[e]},"process"==e("./$.cof")(h)?r=function(e){h.nextTick(s(y,e,1))}:p?(i=new p,o=i.port2,i.port1.onmessage=b,r=s(o.postMessage,o,1)):u.addEventListener&&"function"==typeof postMessage&&!u.importScripts?(r=function(e){u.postMessage(e+"","*")},u.addEventListener("message",b,!1)):r=v in c("script")?function(e){l.appendChild(c("script"))[v]=function(){l.removeChild(this),y.call(e)}}:function(e){setTimeout(s(y,e,1),0)}),t.exports={set:f,clear:d}},{"./$.cof":45,"./$.ctx":50,"./$.dom-create":53,"./$.global":57,"./$.html":60,"./$.invoke":61}],88:[function(e,t,n){var r=Math.ceil,i=Math.floor;t.exports=function(e){return isNaN(e=+e)?0:(e>0?i:r)(e)}},{}],89:[function(e,t,n){var r=e("./$.iobject"),i=e("./$.defined");t.exports=function(e){return r(i(e))}},{"./$.defined":51,"./$.iobject":62}],90:[function(e,t,n){var r=e("./$.to-integer"),i=Math.min;t.exports=function(e){return e>0?i(r(e),9007199254740991):0}},{"./$.to-integer":88}],91:[function(e,t,n){var r=e("./$.defined");t.exports=function(e){return Object(r(e))}},{"./$.defined":51}],92:[function(e,t,n){var r=0,i=Math.random();t.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++r+i).toString(36))}},{}],93:[function(e,t,n){var r=e("./$.shared")("wks"),i=e("./$.uid"),o=e("./$.global").Symbol;t.exports=function(e){return r[e]||(r[e]=o&&o[e]||(o||i)("Symbol."+e))}},{"./$.global":57,"./$.shared":83,"./$.uid":92}],94:[function(e,t,n){var r=e("./$.classof"),i=e("./$.wks")("iterator"),o=e("./$.iterators");t.exports=e("./$.core").getIteratorMethod=function(e){if(void 0!=e)return e[i]||e["@@iterator"]||o[r(e)]}},{"./$.classof":44,"./$.core":49,"./$.iterators":70,"./$.wks":93}],95:[function(e,t,n){var r=e("./$.an-object"),i=e("./core.get-iterator-method");t.exports=e("./$.core").getIterator=function(e){var t=i(e);if("function"!=typeof t)throw TypeError(e+" is not iterable!");return r(t.call(e))}},{"./$.an-object":43,"./$.core":49,"./core.get-iterator-method":94}],96:[function(e,t,n){"use strict";var r=e("./$.add-to-unscopables"),i=e("./$.iter-step"),o=e("./$.iterators"),s=e("./$.to-iobject");t.exports=e("./$.iter-define")(Array,"Array",function(e,t){this._t=s(e),this._i=0,this._k=t},function(){var e=this._t,t=this._k,n=this._i++;return!e||n>=e.length?(this._t=void 0,i(1)):"keys"==t?i(0,n):"values"==t?i(0,e[n]):i(0,[n,e[n]])},"values"),o.Arguments=o.Array,r("keys"),r("values"),r("entries")},{"./$.add-to-unscopables":42,"./$.iter-define":67,"./$.iter-step":69,"./$.iterators":70,"./$.to-iobject":89}],97:[function(e,t,n){var r=e("./$.export");r(r.S+r.F,"Object",{assign:e("./$.object-assign")})},{"./$.export":54,"./$.object-assign":74}],98:[function(e,t,n){var r=e("./$.to-iobject");e("./$.object-sap")("getOwnPropertyDescriptor",function(e){return function(t,n){return e(r(t),n)}})},{"./$.object-sap":75,"./$.to-iobject":89}],99:[function(e,t,n){var r=e("./$.to-object");e("./$.object-sap")("keys",function(e){return function(t){return e(r(t))}})},{"./$.object-sap":75,"./$.to-object":91}],100:[function(e,t,n){var r=e("./$.export");r(r.S,"Object",{setPrototypeOf:e("./$.set-proto").set})},{"./$.export":54,"./$.set-proto":80}],101:[function(e,t,n){},{}],102:[function(e,t,n){"use strict";var r,i=e("./$"),o=e("./$.library"),s=e("./$.global"),a=e("./$.ctx"),l=e("./$.classof"),c=e("./$.export"),u=e("./$.is-object"),h=e("./$.an-object"),f=e("./$.a-function"),d=e("./$.strict-new"),p=e("./$.for-of"),g=e("./$.set-proto").set,m=e("./$.same-value"),v=e("./$.wks")("species"),y=e("./$.species-constructor"),b=e("./$.microtask"),w="Promise",x=s.process,C="process"==l(x),k=s[w],S=function(){},T=function(e){var t,n=new k(S);return e&&(n.constructor=function(e){e(S,S)}),(t=k.resolve(n))["catch"](S),t===n},L=function(){function t(e){var n=new k(e);return g(n,t.prototype),n}var n=!1;try{if(n=k&&k.resolve&&T(),g(t,k),t.prototype=i.create(k.prototype,{constructor:{value:t}}),t.resolve(5).then(function(){})instanceof t||(n=!1),n&&e("./$.descriptors")){var r=!1;k.resolve(i.setDesc({},"then",{get:function(){r=!0}})),n=r}}catch(o){n=!1}return n}(),M=function(e,t){return!(!o||e!==k||t!==r)||m(e,t)},E=function(e){var t=h(e)[v];return void 0!=t?t:e},_=function(e){var t;return!(!u(e)||"function"!=typeof(t=e.then))&&t},A=function(e){var t,n;this.promise=new e(function(e,r){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=r}),this.resolve=f(t),this.reject=f(n)},P=function(e){try{e()}catch(t){return{error:t}}},R=function(e,t){if(!e.n){e.n=!0;var n=e.c;b(function(){for(var r=e.v,i=1==e.s,o=0,a=function(t){var n,o,s=i?t.ok:t.fail,a=t.resolve,l=t.reject;try{s?(i||(e.h=!0),n=s===!0?r:s(r),n===t.promise?l(TypeError("Promise-chain cycle")):(o=_(n))?o.call(n,a,l):a(n)):l(r)}catch(c){l(c)}};n.length>o;)a(n[o++]);n.length=0,e.n=!1,t&&setTimeout(function(){var t,n,i=e.p;O(i)&&(C?x.emit("unhandledRejection",r,i):(t=s.onunhandledrejection)?t({promise:i,reason:r}):(n=s.console)&&n.error&&n.error("Unhandled promise rejection",r)),e.a=void 0},1)})}},O=function(e){var t,n=e._d,r=n.a||n.c,i=0;if(n.h)return!1;for(;r.length>i;)if(t=r[i++],t.fail||!O(t.promise))return!1;return!0},H=function(e){var t=this;t.d||(t.d=!0,t=t.r||t,t.v=e,t.s=2,t.a=t.c.slice(),R(t,!0))},D=function(e){var t,n=this;if(!n.d){n.d=!0,n=n.r||n;try{if(n.p===e)throw TypeError("Promise can't be resolved itself");(t=_(e))?b(function(){var r={r:n,d:!1};try{t.call(e,a(D,r,1),a(H,r,1))}catch(i){H.call(r,i)}}):(n.v=e,n.s=1,R(n,!1))}catch(r){H.call({r:n,d:!1},r)}}};L||(k=function(e){f(e);var t=this._d={p:d(this,k,w),c:[],a:void 0,s:0,d:!1,v:void 0,h:!1,n:!1};try{e(a(D,t,1),a(H,t,1))}catch(n){H.call(t,n)}},e("./$.redefine-all")(k.prototype,{then:function(e,t){var n=new A(y(this,k)),r=n.promise,i=this._d;return n.ok="function"!=typeof e||e,n.fail="function"==typeof t&&t,i.c.push(n),i.a&&i.a.push(n),i.s&&R(i,!1),r},"catch":function(e){return this.then(void 0,e)}})),c(c.G+c.W+c.F*!L,{Promise:k}),e("./$.set-to-string-tag")(k,w),e("./$.set-species")(w),r=e("./$.core")[w],c(c.S+c.F*!L,w,{reject:function(e){var t=new A(this),n=t.reject;return n(e),t.promise}}),c(c.S+c.F*(!L||T(!0)),w,{resolve:function(e){if(e instanceof k&&M(e.constructor,this))return e;var t=new A(this),n=t.resolve;return n(e),t.promise}}),c(c.S+c.F*!(L&&e("./$.iter-detect")(function(e){k.all(e)["catch"](function(){})})),w,{all:function(e){var t=E(this),n=new A(t),r=n.resolve,o=n.reject,s=[],a=P(function(){p(e,!1,s.push,s);var n=s.length,a=Array(n);n?i.each.call(s,function(e,i){var s=!1;t.resolve(e).then(function(e){s||(s=!0,a[i]=e,--n||r(a))},o)}):r(a)});return a&&o(a.error),n.promise},race:function(e){var t=E(this),n=new A(t),r=n.reject,i=P(function(){p(e,!1,function(e){t.resolve(e).then(n.resolve,r)})});return i&&r(i.error),n.promise}})},{"./$":71,"./$.a-function":41,"./$.an-object":43,"./$.classof":44,"./$.core":49,"./$.ctx":50,"./$.descriptors":52,"./$.export":54,"./$.for-of":56,"./$.global":57,"./$.is-object":64,"./$.iter-detect":68,"./$.library":72,"./$.microtask":73,"./$.redefine-all":77,"./$.same-value":79,"./$.set-proto":80,"./$.set-species":81,"./$.set-to-string-tag":82,"./$.species-constructor":84,"./$.strict-new":85,"./$.wks":93}],103:[function(e,t,n){"use strict";var r=e("./$.collection-strong");e("./$.collection")("Set",function(e){return function(){return e(this,arguments.length>0?arguments[0]:void 0)}},{add:function(e){return r.def(this,e=0===e?0:e,e)}},r)},{"./$.collection":48,"./$.collection-strong":46}],104:[function(e,t,n){"use strict";var r=e("./$.string-at")(!0);e("./$.iter-define")(String,"String",function(e){this._t=String(e),this._i=0},function(){var e,t=this._t,n=this._i;return n>=t.length?{value:void 0,done:!0}:(e=r(t,n),this._i+=e.length,{value:e,done:!1})})},{"./$.iter-define":67,"./$.string-at":86}],105:[function(e,t,n){var r=e("./$.export");r(r.P,"Set",{toJSON:e("./$.collection-to-json")("Set")})},{"./$.collection-to-json":47,"./$.export":54}],106:[function(e,t,n){e("./es6.array.iterator");var r=e("./$.iterators");r.NodeList=r.HTMLCollection=r.Array},{"./$.iterators":70,"./es6.array.iterator":96}],107:[function(e,t,n){(function(e){function n(e,t){"use strict";function n(){var e=M.splice(0,M.length);for(tt=0;e.length;)e.shift().call(null,e.shift())}function r(e,t){for(var n=0,r=e.length;n1)&&x(this)}}}),je(o,z,{value:function(e){-1>0,I="__"+N+F,j="addEventListener",$="attached",W="Callback",B="detached",U="extends",z="attributeChanged"+W,X=$+W,V="connected"+W,G="disconnected"+W,q="created"+W,K=B+W,Y="ADDITION",Z="MODIFICATION",Q="REMOVAL",J="DOMAttrModified",ee="DOMContentLoaded",te="DOMSubtreeModified",ne="<",re="=",ie=/^[A-Z][._A-Z0-9]*-[-._A-Z0-9]*$/,oe=["ANNOTATION-XML","COLOR-PROFILE","FONT-FACE","FONT-FACE-SRC","FONT-FACE-URI","FONT-FACE-FORMAT","FONT-FACE-NAME","MISSING-GLYPH"],se=[],ae=[],le="",ce=S.documentElement,ue=se.indexOf||function(e){for(var t=this.length;t--&&this[t]!==e;);return t},he=T.prototype,fe=he.hasOwnProperty,de=he.isPrototypeOf,pe=T.defineProperty,ge=[],me=T.getOwnPropertyDescriptor,ve=T.getOwnPropertyNames,ye=T.getPrototypeOf,be=T.setPrototypeOf,we=!!T.__proto__,xe=!1,Ce="__dreCEv1",ke=e.customElements,Se=!/^force/.test(t.type)&&!!(ke&&ke.define&&ke.get&&ke.whenDefined),Te=T.create||T,Le=e.Map||function(){var e,t=[],n=[];return{get:function(e){return n[ue.call(t,e)]},set:function(r,i){e=ue.call(t,r),e<0?n[t.push(r)-1]=i:n[e]=i}}},Me=e.Promise||function(e){function t(e){for(r=!0;n.length;)n.shift()(e)}var n=[],r=!1,i={"catch":function(){return i},then:function(e){return n.push(e),r&&setTimeout(t,1),i}};return e(t),i},Ee=!1,_e=Te(null),Ae=Te(null),Pe=new Le,Re=function(e){return e.toLowerCase()},Oe=T.create||function ut(e){return e?(ut.prototype=e,new ut):this},He=be||(we?function(e,t){return e.__proto__=t,e}:ve&&me?function(){function e(e,t){for(var n,r=ve(t),i=0,o=r.length;i
",new De(function(e,t){if(e[0]&&"childList"==e[0].type&&!e[0].removedNodes[0].childNodes.length){D=me(Fe,"innerHTML");var n=D&&D.set;n&&pe(Fe,"innerHTML",{set:function(e){for(;this.lastChild;)this.removeChild(this.lastChild);n.call(this,e)}})}t.disconnect(),D=null}).observe(D,{childList:!0,subtree:!0}),D.innerHTML=""),nt||(be||we?(O=function(e,t){de.call(t,e)||d(e,t)},H=d):(O=function(e,t){e[I]||(e[I]=T(!0),d(e,t))},H=O),Ie?(ot=!1,function(){var e=me(Fe,j),t=e.value,n=function(e){var t=new CustomEvent(J,{bubbles:!0});t.attrName=e,t.prevValue=Ve.call(this,e),t.newValue=null,t[Q]=t.attrChange=2,qe.call(this,e),Xe.call(this,t)},r=function(e,t){var n=Ge.call(this,e),r=n&&Ve.call(this,e),i=new CustomEvent(J,{bubbles:!0});Ke.call(this,e,t),i.attrName=e,i.prevValue=n?r:null,i.newValue=t,n?i[Z]=i.attrChange=1:i[Y]=i.attrChange=0,Xe.call(this,i)},i=function(e){var t,n=e.currentTarget,r=n[I],i=e.propertyName;r.hasOwnProperty(i)&&(r=r[i],t=new CustomEvent(J,{bubbles:!0}),t.attrName=r.name,t.prevValue=r.value||null,t.newValue=r.value=n[i]||null,null==t.prevValue?t[Y]=t.attrChange=0:t[Z]=t.attrChange=1,Xe.call(n,t))};e.value=function(e,o,s){e===J&&this[z]&&this.setAttribute!==r&&(this[I]={className:{name:"class",value:this.className}},this.setAttribute=r,this.removeAttribute=n,t.call(this,"propertychange",i)),t.call(this,e,o,s)},pe(Fe,j,e)}()):De||(ce[j](J,et),ce.setAttribute(I,1),ce.removeAttribute(I),ot&&(E=function(e){var t,n,r,i=this;if(i===e.target){t=i[I],i[I]=n=A(i);for(r in n){if(!(r in t))return _(0,i,r,t[r],n[r],Y);if(n[r]!==t[r])return _(1,i,r,t[r],n[r],Z)}for(r in t)if(!(r in n))return _(2,i,r,t[r],n[r],Q)}},_=function(e,t,n,r,i,o){var s={attrChange:e,currentTarget:t,attrName:n,prevValue:r,newValue:i};s[o]=e,l(s)},A=function(e){for(var t,n,r={},i=e.attributes,o=0,s=i.length;o$");if(n[U]="a",t.prototype=Oe(Ne.prototype),t.prototype.constructor=t,e.customElements.define(r,t,n),!i.test(S.createElement("a",{is:r}).outerHTML)||!i.test((new t).outerHTML))throw n}(function ht(){return Reflect.construct(Ne,[],ht)},{},"document-register-element-a"+F)}catch(lt){k()}if(!t.noBuiltIn)try{if(Ye.call(S,"a","a").outerHTML.indexOf("is")<0)throw{}}catch(ct){Re=function(e){return{is:e.toLowerCase()}}}}t.exports=n,n(e)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],108:[function(e,t,n){(function(e){var n;n="undefined"!=typeof window?window:"undefined"!=typeof e?e:"undefined"!=typeof self?self:{},t.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],109:[function(t,n,r){(function(t){!function(t,i){"object"==typeof r&&"undefined"!=typeof n?n.exports=i():"function"==typeof e&&e.amd?e(i):t.GlslCanvas=i()}(this,function(){"use strict";function e(e){if(!e)return!1;var t=M.call(e);return"[object Function]"===t||"function"==typeof e&&"[object RegExp]"!==t||"undefined"!=typeof window&&(e===window.setTimeout||e===window.alert||e===window.confirm||e===window.prompt)}function n(){for(var e={},t=0;t0&&(d=setTimeout(function(){if(!f){f=!0,u.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",r(e)}},e.timeout)),u.setRequestHeader)for(h in v)v.hasOwnProperty(h)&&u.setRequestHeader(h,v[h]);else if(e.headers&&!i(e.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in e&&(u.responseType=e.responseType),"beforeSend"in e&&"function"==typeof e.beforeSend&&e.beforeSend(u),u.send(m||null),u}function l(e){try{if("document"===e.responseType)return e.responseXML;var t=e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;if(""===e.responseType&&!t)return e.responseXML}catch(n){}return null}function c(){}function u(e){return'\n\n
\n
\n
'+e+"
\n
\n
\n"}function h(e,t,n){function r(t){var n=e.parentNode;n&&(n.innerHTML=u(t))}function i(e,t){"function"==typeof n?n(e):r(t)}if(!window.WebGLRenderingContext)return i(B,$),null;var o=f(e,t);return o?o.getExtension("OES_standard_derivatives"):i(U,W),o}function f(e,t){for(var n=["webgl","experimental-webgl"],r=null,i=0;i1&&void 0!==arguments[1]?arguments[1]:null,n=[];for(var r in e){var i=e[r],o=void 0;if(t&&(r=t+"."+r),"number"==typeof i)n.push({type:"float",method:"1f",name:r,value:i});else if(Array.isArray(i)){if("number"==typeof i[0])1===i.length?n.push({type:"float",method:"1f",name:r,value:i}):i.length>=2&&i.length<=4?n.push({type:"vec"+i.length,method:i.length+"fv",name:r,value:i}):i.length>4&&n.push({type:"float[]",method:"1fv",name:r+"[0]",value:i});else if("string"==typeof i[0])n.push({type:"sampler2D",method:"1i",name:r,value:i});else if(Array.isArray(i[0])&&"number"==typeof i[0][0]){if(i[0].length>=2&&i[0].length<=4)for(o=0;o0&&t.top<(window.innerHeight||document.documentElement.clientHeight)}function v(e){return 0===(e&e-1)}function y(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function b(e,t){return!(!e||!t)&&e.toString()!==t.toString()}function w(e){var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(),200==t.status?t.responseText:""}function x(e){var t=new Set;return Object.assign(e,{on:function(e,n){var r={};r[e]=n,t.add(r)},off:function(e,n){if(n){var r={};r[e]=n,t["delete"](r)}else{var i=!0,o=!1,s=void 0;try{for(var a,l=t[Symbol.iterator]();!(i=(a=l.next()).done);i=!0){var c=a.value,u=!0,h=!1,f=void 0;try{for(var d,p=Object.keys(c)[Symbol.iterator]();!(u=(d=p.next()).done);u=!0){var g=d.value;if(g===e)return void t["delete"](c)}}catch(m){h=!0,f=m}finally{try{!u&&p["return"]&&p["return"]()}finally{if(h)throw f}}}}catch(m){o=!0,s=m}finally{try{!i&&l["return"]&&l["return"]()}finally{if(o)throw s}}}},listSubscriptions:function(){var e=!0,n=!1,r=void 0;try{for(var i,o=t[Symbol.iterator]();!(e=(i=o.next()).done);e=!0){var s=i.value;console.log(s)}}catch(a){n=!0,r=a}finally{try{!e&&o["return"]&&o["return"]()}finally{if(n)throw r}}},subscribe:function(e){t.add(e)},unsubscribe:function(e){t["delete"](e)},unsubscribeAll:function(){t.clear()},trigger:function(e){for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i0){window.glslCanvases=[];for(var t=0;t2&&void 0!==arguments[2]?arguments[2]:{};N(this,e),x(this),this.gl=t,this.texture=t.createTexture(),this.texture&&(this.valid=!0),this.bind(),this.name=n,this.source=null,this.sourceType=null,this.loading=null,this.setData(1,1,new Uint8Array([0,0,0,255]),{filtering:"linear"}),this.setFiltering(r.filtering),this.load(r)}return F(e,[{key:"destroy",value:function(){this.valid&&(this.gl.deleteTexture(this.texture),this.texture=null,delete this.data,this.data=null,this.valid=!1)}},{key:"bind",value:function(t){this.valid&&("number"==typeof t&&e.activeUnit!==t&&(this.gl.activeTexture(this.gl.TEXTURE0+t),e.activeUnit=t),e.activeTexture!==this.texture&&(this.gl.bindTexture(this.gl.TEXTURE_2D,this.texture),e.activeTexture=this.texture))}},{key:"load",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.loading=null,"string"==typeof e.url?void 0!==this.url&&e.url===this.url||this.setUrl(e.url,e):e.element?this.setElement(e.element,e):e.data&&e.width&&e.height&&this.setData(e.width,e.height,e.data,e)}},{key:"setUrl",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.valid)return this.url=e,this.source=this.url,this.sourceType="url",this.loading=new Promise(function(r,i){var o=e.split(".").pop().toLowerCase(),s="ogv"===o||"webm"===o||"mp4"===o,a=void 0;s?(a=document.createElement("video"),a.autoplay=!0,a.muted=!0,setTimeout(function(){a.play()},1),n.filtering="nearest"):a=new Image,a.onload=function(){try{t.setElement(a,n)}catch(e){console.log("Texture '"+t.name+"': failed to load url: '"+t.source+"'",e,n)}r(t)},a.onerror=function(e){console.log("Texture '"+t.name+"': failed to load url: '"+t.source+"'",e,n),r(t)},y()&&"data:"===t.source.slice(0,5)||(a.crossOrigin="anonymous"),a.src=t.source,s&&t.setElement(a,n)}),this.loading}},{key:"setData",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.width=e,this.height=t,this.source=n,this.sourceType="data",this.update(r),this.setFiltering(r),this.loading=Promise.resolve(this),this.loading}},{key:"setElement",value:function(e,t){var n=this,r=e;if("string"==typeof e&&(e=document.querySelector(e)),e instanceof HTMLCanvasElement||e instanceof HTMLImageElement||e instanceof HTMLVideoElement)this.source=e,this.sourceType="element",e instanceof HTMLVideoElement?(this.width=this.source.videoWidth,this.height=this.source.videoHeight,e.addEventListener("canplaythrough",function(){n.intervalID=setInterval(function(){n.update(t)},15)},!0),e.addEventListener("ended",function(){e.currentTime=0,e.play()},!0)):this.update(t),this.setFiltering(t);else{var i="the 'element' parameter (`element: "+JSON.stringify(r)+"`) must be a CSS ";i+="selector string, or a , or