From b1f469ee2fbeb64ef9ad42ad7a2fce85647d7e7d Mon Sep 17 00:00:00 2001 From: Giuseppe Criscione Date: Mon, 6 Apr 2020 11:47:56 +0200 Subject: [PATCH] Update npm packages --- admin/assets/js/app.min.js | 2 +- admin/package-lock.json | 854 ++++++++++++++++++------------------- admin/package.json | 6 +- 3 files changed, 424 insertions(+), 438 deletions(-) diff --git a/admin/assets/js/app.min.js b/admin/assets/js/app.min.js index a617037b..754d2717 100644 --- a/admin/assets/js/app.min.js +++ b/admin/assets/js/app.min.js @@ -1 +1 @@ -var Formwork=function(){"use strict";var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function e(e,t){return e(t={exports:{}},t.exports),t.exports}var r=e(function(e){var t,n;t=i,n=function(){var e,m,u,p,g,o,a,s,l,c,n,d,r,f,h,v,y,x,C,k,M,T,t={version:"0.11.4"};function b(e,t,n,i,r,o){var a=l.extend({command:r?e.toLowerCase():e.toUpperCase()},t,o?{data:o}:{});n.splice(i,0,a)}function w(r,o){r.forEach(function(n,i){c[n.command.toLowerCase()].forEach(function(e,t){o(n,e,i,t,r)})})}function D(e,t,n){var i=t.x>e.x;return i&&"explode"===n||!i&&"implode"===n?"start":i&&"implode"===n||!i&&"explode"===n?"end":"middle"}return u=(e=this||i).window,p=e.document,(m=t).namespaces={svg:"http://www.w3.org/2000/svg",xmlns:"http://www.w3.org/2000/xmlns/",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",ct:"http://gionkunz.github.com/chartist-js/ct"},m.noop=function(e){return e},m.alphaNumerate=function(e){return String.fromCharCode(97+e%26)},m.extend=function(e){var t,n,i;for(e=e||{},t=1;t":">",'"':""","'":"'"},m.serialize=function(e){return null==e?e:("number"==typeof e?e=""+e:"object"==typeof e&&(e=JSON.stringify({data:e})),Object.keys(m.escapingMap).reduce(function(e,t){return m.replaceAll(e,t,m.escapingMap[t])},e))},m.deserialize=function(e){if("string"!=typeof e)return e;e=Object.keys(m.escapingMap).reduce(function(e,t){return m.replaceAll(e,m.escapingMap[t],t)},e);try{e=void 0!==(e=JSON.parse(e)).data?e.data:e}catch(e){}return e},m.createSvg=function(t,e,n,i){var r;return e=e||"100%",n=n||"100%",Array.prototype.slice.call(t.querySelectorAll("svg")).filter(function(e){return e.getAttributeNS(m.namespaces.xmlns,"ct")}).forEach(function(e){t.removeChild(e)}),(r=new m.Svg("svg").attr({width:e,height:n}).addClass(i))._node.style.width=e,r._node.style.height=n,t.appendChild(r._node),r},m.normalizeData=function(e,t,n){var i,r={raw:e,normalized:{}};return r.normalized.series=m.getDataArray({series:e.series||[]},t,n),i=r.normalized.series.every(function(e){return e instanceof Array})?Math.max.apply(null,r.normalized.series.map(function(e){return e.length})):r.normalized.series.length,r.normalized.labels=(e.labels||[]).slice(),Array.prototype.push.apply(r.normalized.labels,m.times(Math.max(0,i-r.normalized.labels.length)).map(function(){return""})),t&&m.reverseData(r.normalized),r},m.safeHasProperty=function(e,t){return null!==e&&"object"==typeof e&&e.hasOwnProperty(t)},m.isDataHoleValue=function(e){return null==e||"number"==typeof e&&isNaN(e)},m.reverseData=function(e){e.labels.reverse(),e.series.reverse();for(var t=0;to.high&&(o.high=i),s&&i=n)l.step=1;else if(i&&c=n)l.step=c;else for(;;){if(u&&m.projectLength(e,l.step,l)<=n)l.step*=2;else{if(u||!(m.projectLength(e,l.step/2,l)>=n))break;if(l.step/=2,i&&l.step%1!=0){l.step*=2;break}}if(1e3=l.high;)a=d(a,-l.step);l.min=o,l.max=a,l.range=l.max-l.min;var h=[];for(r=l.min;r<=l.max;r=d(r,l.step)){var p=m.roundWithPrecision(r);p!==h[h.length-1]&&h.push(p)}return l.values=h,l},m.polarToCartesian=function(e,t,n,i){var r=(i-90)*Math.PI/180;return{x:e+n*Math.cos(r),y:t+n*Math.sin(r)}},m.createChartRect=function(e,t,n){var i=!(!t.axisX&&!t.axisY),r=i?t.axisY.offset:0,o=i?t.axisX.offset:0,a=e.width()||m.quantity(t.width).value||0,s=e.height()||m.quantity(t.height).value||0,l=m.normalizePadding(t.chartPadding,n);a=Math.max(a,r+l.left+l.right),s=Math.max(s,o+l.top+l.bottom);var u={padding:l,width:function(){return this.x2-this.x1},height:function(){return this.y1-this.y2}};return i?("start"===t.axisX.position?(u.y2=l.top+o,u.y1=Math.max(s-l.bottom,u.y2+1)):(u.y2=l.top,u.y1=Math.max(s-l.bottom-o,u.y2+1)),"start"===t.axisY.position?(u.x1=l.left+r,u.x2=Math.max(a-l.right,u.x1+1)):(u.x1=l.left,u.x2=Math.max(a-l.right-r,u.x1+1))):(u.x1=l.left,u.x2=Math.max(a-l.right,u.x1+1),u.y2=l.top,u.y1=Math.max(s-l.bottom,u.y2+1)),u},m.createGrid=function(e,t,n,i,r,o,a,s){var l={};l[n.units.pos+"1"]=e,l[n.units.pos+"2"]=e,l[n.counterUnits.pos+"1"]=i,l[n.counterUnits.pos+"2"]=i+r;var u=o.elem("line",l,a.join(" "));s.emit("draw",m.extend({type:"grid",axis:n,index:t,group:o,element:u},l))},m.createGridBackground=function(e,t,n,i){var r=e.elem("rect",{x:t.x1,y:t.y2,width:t.width(),height:t.height()},n,!0);i.emit("draw",{type:"gridBackground",group:e,element:r})},m.createLabel=function(e,t,n,i,r,o,a,s,l,u,c){var f,d={};if(d[r.units.pos]=e+a[r.units.pos],d[r.counterUnits.pos]=a[r.counterUnits.pos],d[r.units.len]=t,d[r.counterUnits.len]=Math.max(0,o-10),u){var h=p.createElement("span");h.className=l.join(" "),h.setAttribute("xmlns",m.namespaces.xhtml),h.innerText=i[n],h.style[r.units.len]=Math.round(d[r.units.len])+"px",h.style[r.counterUnits.len]=Math.round(d[r.counterUnits.len])+"px",f=s.foreignObject(h,m.extend({style:"overflow: visible;"},d))}else f=s.elem("text",d,l.join(" ")).text(i[n]);c.emit("draw",m.extend({type:"label",axis:r,index:n,group:s,element:f,text:i[n]},d))},m.getSeriesOption=function(e,t,n){if(e.name&&t.series&&t.series[e.name]){var i=t.series[e.name];return i.hasOwnProperty(n)?i[n]:t[n]}return t[n]},m.optionsProvider=function(e,n,i){var r,o,a=m.extend({},e),t=[];function s(e){var t=r;if(r=m.extend({},a),n)for(o=0;o":"","?":"","@":"","[":"","]":"","^":"","`":"","{":"","|":"","}":"","¡":"","£":"","¤":"","¥":"","¦":"","§":"","«":"","°":"","»":"","‘":"","’":"","“":"","”":"","\n":"-"," ":"-","-":"-","–":"-","—":"-","/":"-","\\":"-",_:"-","~":"-","À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","Æ":"Ae","Ç":"C","Ð":"D","È":"E","É":"E","Ê":"E","Ë":"E","Ì":"I","Í":"I","Î":"I","Ï":"I","Ñ":"N","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","Œ":"Oe","Š":"S","Þ":"Th","Ù":"U","Ú":"U","Û":"U","Ü":"U","Ý":"Y","à":"a","á":"a","â":"a","ã":"a","ä":"ae","å":"a","æ":"ae","¢":"c","ç":"c","ð":"d","è":"e","é":"e","ê":"e","ë":"e","ì":"i","í":"i","î":"i","ï":"i","ñ":"n","ò":"o","ó":"o","ô":"o","õ":"o","ö":"oe","ø":"o","œ":"oe","š":"s","ß":"ss","þ":"th","ù":"u","ú":"u","û":"u","ü":"ue","ý":"y","ÿ":"y","Ÿ":"y"};for(t in e=e.toLowerCase(),n)n.hasOwnProperty(t)&&(e=e.split(t).join(n[t]));return e.replace(/[^a-z0-9-]/g,"").replace(/^-+|-+$/g,"").replace(/-+/g,"-")},validateSlug:function(e){return e.toLowerCase().replace(" ","-").replace(/[^a-z0-9-]/g,"")},debounce:function(e,t,n){var i,r,o,a=null;return function(){return i=this,r=arguments,a&&clearTimeout(a),n&&!a&&(o=e.apply(i,r)),a=setTimeout(function(){n||(o=e.apply(i,r)),a=null},t),o}},throttle:function(n,i){var r,o,a,s=0,l=null;return function(){var e,t=Date.now();return 0===s&&(s=t),r=this,o=arguments,(e=s+i-t)<=0||i"===t[0]&&(t=t.substring(1)),e))try{if(e.matches)return e.matches(t);if(e.msMatchesSelector)return e.msMatchesSelector(t);if(e.webkitMatchesSelector)return e.webkitMatchesSelector(t)}catch(e){return}}function q(e,t,n,i){if(e){n=n||document;do{if(null!=t&&(">"!==t[0]||e.parentNode===n)&&C(e,t)||i&&e===n)return e;if(e===n)break}while(e=(r=e).host&&r!==document&&r.host.nodeType?r.host:r.parentNode)}var r;return null}var k,S=/\s+/g;function G(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var i=(" "+e.className+" ").replace(S," ").replace(" "+t+" "," ");e.className=(i+(n?" "+t:"")).replace(S," ")}}function X(e,t,n){var i=e&&e.style;if(i){if(void 0===n)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(e,""):e.currentStyle&&(n=e.currentStyle),void 0===t?n:n[t];t in i||-1!==t.indexOf("webkit")||(t="-webkit-"+t),i[t]=n+("string"==typeof n?"":"px")}}function L(e,t){var n="";if("string"==typeof e)n=e;else do{var i=X(e,"transform");i&&"none"!==i&&(n=i+" "+n)}while(!t&&(e=e.parentNode));var r=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return r&&new r(n)}function E(e,t,n){if(e){var i=e.getElementsByTagName(t),r=0,o=i.length;if(n)for(;r=t.left-n&&o<=t.right+n,r=a>=t.top-n&&a<=t.bottom+n;return n&&i&&r?s=e:void 0}}),s);if(t){var n={};for(var i in e)e.hasOwnProperty(i)&&(n[i]=e[i]);n.target=n.rootEl=t,n.preventDefault=void 0,n.stopPropagation=void 0,t[ee]._onDragOver(n)}}var o,a,s}function We(e){ie&&ie.parentNode[ee]._isOutsideThisEl(e.target)}function _e(e,t){if(!e||!e.nodeType||1!==e.nodeType)throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(e));this.el=e,this.options=t=s({},t),e[ee]=this;var n={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(e.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Pe(e,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(e,t){e.setData("Text",t.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==_e.supportPointer&&"PointerEvent"in window,emptyInsertThreshold:5};for(var i in B.initializePlugins(this,e,n),n)i in t||(t[i]=n[i]);for(var r in ze(t),this)"_"===r.charAt(0)&&"function"==typeof this[r]&&(this[r]=this[r].bind(this));this.nativeDraggable=!t.forceFallback&&Fe,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?v(e,"pointerdown",this._onTapStart):(v(e,"mousedown",this._onTapStart),v(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(v(e,"dragover",this),v(e,"dragenter",this)),Se.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),s(this,I())}function Re(e,t,n,i,r,o,a,s){var l,u,c=e[ee],f=c.options.onMove;return!window.CustomEvent||b||w?(l=document.createEvent("Event")).initEvent("move",!0,!0):l=new CustomEvent("move",{bubbles:!0,cancelable:!0}),l.to=t,l.from=e,l.dragged=n,l.draggedRect=i,l.related=r||t,l.relatedRect=o||V(t),l.willInsertAfter=s,l.originalEvent=a,e.dispatchEvent(l),f&&(u=f.call(c,l,a)),u}function je(e){e.draggable=!1}function Ue(){Te=!1}function Ye(e){for(var t=e.tagName+e.className+e.src+e.href+e.textContent,n=t.length,i=0;n--;)i+=t.charCodeAt(n);return i.toString(36)}function qe(e){return setTimeout(e,0)}function Ge(e){return clearTimeout(e)}_e.prototype={constructor:_e,_isOutsideThisEl:function(e){this.el.contains(e)||e===this.el||(ye=null)},_getDirection:function(e,t){return"function"==typeof this.options.direction?this.options.direction.call(this,e,t,ie):this.options.direction},_onTapStart:function(t){if(t.cancelable){var n=this,i=this.el,e=this.options,r=e.preventOnFilter,o=t.type,a=t.touches&&t.touches[0]||t.pointerType&&"touch"===t.pointerType&&t,s=(a||t).target,l=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||s,u=e.filter;if(!function(e){De.length=0;var t=e.getElementsByTagName("input"),n=t.length;for(;n--;){var i=t[n];i.checked&&De.push(i)}}(i),!ie&&!(/mousedown|pointerdown/.test(o)&&0!==t.button||e.disabled||l.isContentEditable||(s=q(s,e.draggable,i,!1))&&s.animated||H===s)){if(R=Z(s),j=Z(s,e.draggable),"function"==typeof u){if(u.call(this,t,s,this))return ne({sortable:n,rootEl:l,name:"filter",targetEl:s,toEl:i,fromEl:i}),te("filter",n,{evt:t}),void(r&&t.cancelable&&t.preventDefault())}else if(u=u&&u.split(",").some(function(e){if(e=q(l,e.trim(),i,!1))return ne({sortable:n,rootEl:e,name:"filter",targetEl:s,fromEl:i,toEl:i}),te("filter",n,{evt:t}),!0}))return void(r&&t.cancelable&&t.preventDefault());e.handle&&!q(l,e.handle,i,!1)||this._prepareDragStart(t,a,s)}}},_prepareDragStart:function(e,t,n){var i,r=this,o=r.el,a=r.options,s=o.ownerDocument;if(n&&!ie&&n.parentNode===o){var l=V(n);if(ae=o,re=(ie=n).parentNode,se=ie.nextSibling,H=n,ce=a.group,U={target:_e.dragged=ie,clientX:(t||e).clientX,clientY:(t||e).clientY},me=U.clientX-l.left,ge=U.clientY-l.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,ie.style["will-change"]="all",i=function(){te("delayEnded",r,{evt:e}),_e.eventCanceled?r._onDrop():(r._disableDelayedDragEvents(),!d&&r.nativeDraggable&&(ie.draggable=!0),r._triggerDragStart(e,t),ne({sortable:r,name:"choose",originalEvent:e}),G(ie,a.chosenClass,!0))},a.ignore.split(",").forEach(function(e){E(ie,e.trim(),je)}),v(s,"dragover",He),v(s,"mousemove",He),v(s,"touchmove",He),v(s,"mouseup",r._onDrop),v(s,"touchend",r._onDrop),v(s,"touchcancel",r._onDrop),d&&this.nativeDraggable&&(this.options.touchStartThreshold=4,ie.draggable=!0),te("delayStart",this,{evt:e}),!a.delay||a.delayOnTouchOnly&&!t||this.nativeDraggable&&(w||b))i();else{if(_e.eventCanceled)return void this._onDrop();v(s,"mouseup",r._disableDelayedDrag),v(s,"touchend",r._disableDelayedDrag),v(s,"touchcancel",r._disableDelayedDrag),v(s,"mousemove",r._delayedDragTouchMoveHandler),v(s,"touchmove",r._delayedDragTouchMoveHandler),a.supportPointer&&v(s,"pointermove",r._delayedDragTouchMoveHandler),r._dragStartTimer=setTimeout(i,a.delay)}}},_delayedDragTouchMoveHandler:function(e){var t=e.touches?e.touches[0]:e;Math.max(Math.abs(t.clientX-this._lastX),Math.abs(t.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){ie&&je(ie),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;y(e,"mouseup",this._disableDelayedDrag),y(e,"touchend",this._disableDelayedDrag),y(e,"touchcancel",this._disableDelayedDrag),y(e,"mousemove",this._delayedDragTouchMoveHandler),y(e,"touchmove",this._delayedDragTouchMoveHandler),y(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?this.options.supportPointer?v(document,"pointermove",this._onTouchMove):v(document,t?"touchmove":"mousemove",this._onTouchMove):(v(ie,"dragend",this),v(ae,"dragstart",this._onDragStart));try{document.selection?qe(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){if(Ce=!1,ae&&ie){te("dragStarted",this,{evt:t}),this.nativeDraggable&&v(document,"dragover",We);var n=this.options;e||G(ie,n.dragClass,!1),G(ie,n.ghostClass,!0),_e.active=this,e&&this._appendGhost(),ne({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(de){this._lastX=de.clientX,this._lastY=de.clientY,Be();for(var e=document.elementFromPoint(de.clientX,de.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(de.clientX,de.clientY))!==t;)t=e;if(ie.parentNode[ee]._isOutsideThisEl(e),t)do{if(t[ee]){if(t[ee]._onDragOver({clientX:de.clientX,clientY:de.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break}e=t}while(t=t.parentNode);$e()}},_onTouchMove:function(e){if(U){var t=this.options,n=t.fallbackTolerance,i=t.fallbackOffset,r=e.touches?e.touches[0]:e,o=oe&&L(oe,!0),a=oe&&o&&o.a,s=oe&&o&&o.d,l=Ne&&we&&T(we),u=(r.clientX-U.clientX+i.x)/(a||1)+(l?l[0]-Me[0]:0)/(a||1),c=(r.clientY-U.clientY+i.y)/(s||1)+(l?l[1]-Me[1]:0)/(s||1);if(!_e.active&&!Ce){if(n&&Math.max(Math.abs(r.clientX-this._lastX),Math.abs(r.clientY-this._lastY))W.right+10||B.clientX<=W.right&&B.clientY>W.bottom&&B.clientX>=W.left:B.clientX>W.right&&B.clientY>W.top||B.clientX<=W.right&&B.clientY>W.bottom+10)||m.animated)){if(l.parentNode===s){r=V(l);var g,v,y,x=ie.parentNode!==s,b=(T=ie.animated&&ie.toRect||i,D=l.animated&&l.toRect||r,N=(A=a)?T.left:T.top,O=A?T.right:T.bottom,F=A?T.width:T.height,I=A?D.left:D.top,P=A?D.right:D.bottom,z=A?D.width:D.height,!(N===I||O===P||N+F/2===I+z/2)),w=a?"top":"left",C=K(l,"top","top")||K(ie,"top","top"),k=C?C.scrollTop:void 0;if(ye!==l&&(v=r[w],Le=!1,Ee=!b&&t.invertSwap||x),0!==(g=function(e,t,n,i,r,o,a,s){var l=i?e.clientY:e.clientX,u=i?n.height:n.width,c=i?n.top:n.left,f=i?n.bottom:n.right,d=!1;if(!a)if(s&&be',c+=l+" "+e,c+="",c+="",i=0;i<7;i++)c+='',c+=f.dayLabels[h.mod(i+f.weekStarts,7)],c+="";for(c+="",i=0;i<6;i++){for(r=0;r<7;r++)o<=s&&(0':'',c+=o++):1===o?(c+='',c+=h.daysInMonth(h.mod(t-1,12),e)-u+r+1):(c+='',c+=o++-s),c+="";c+=""}c+="",$(".calendar-table",p).innerHTML=c,$$(".calendar-day",p).forEach(function(e){e.addEventListener("mousedown",function(e){e.stopPropagation(),e.preventDefault()}),e.addEventListener("click",function(){var e=m(),t=new Date(d.year,d.month,parseInt(this.textContent));e.setAttribute("data-date",t),e.value=h.formatDateTime(t),e.blur()})})}function t(){var e,t,n,i,r,o,a,s,l,u;(c=m())&&"block"===p.style.display&&(t=(e=c.getBoundingClientRect()).top+window.pageYOffset,n=e.left+window.pageXOffset,p.style.top=t+c.offsetHeight+"px",p.style.left=n+c.offsetLeft+"px",r=(i=p.getBoundingClientRect()).top+window.pageYOffset,o=i.left+window.pageXOffset,a=x.outerWidth(p),s=x.outerHeight(p),l=document.documentElement.clientWidth,u=document.documentElement.clientHeight,lh.daysInMonth(this.month,this.year)&&this.lastDay()},nextMonth:function(){this.month=h.mod(this.month+1,12),0===this.month&&this.nextYear(),this.day>h.daysInMonth(this.month,this.year)&&this.lastDay()},prevWeek:function(){this.day-=7,this.day<1&&(this.prevMonth(),this.day+=h.daysInMonth(this.month,this.year))},nextWeek:function(){this.day+=7,this.day>h.daysInMonth(this.month,this.year)&&(this.day-=h.daysInMonth(this.month,this.year),this.nextMonth())},prevDay:function(){this.day--,this.day<1&&(this.prevMonth(),this.lastDay())},nextDay:function(){this.day++,this.day>h.daysInMonth(this.month,this.year)&&(this.nextMonth(),this.day=1)}},h={_daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],mod:function(e,t){return(e%t+t)%t},pad:function(e){return 1===e.toString().length?"0"+e:e},isValidDate:function(e){return e&&!isNaN(Date.parse(e))},isLeapYear:function(e){return e%4==0&&e%100!=0||e%400==0},daysInMonth:function(e,t){return 1===e&&this.isLeapYear(t)?29:this._daysInMonth[e]},formatDateTime:function(e){var t=f.format,n=e.getFullYear(),i=e.getMonth()+1,r=e.getDate(),o=e.getHours(),a=e.getMinutes(),s=e.getSeconds(),l=o<12;return-1
',document.body.appendChild(p),$(".currentMonth",p).addEventListener("mousedown",function(e){var t=m(),n=new Date;d.setDate(n),i(t),t.blur(),e.preventDefault()}),x.longClick($(".prevMonth",p),function(e){d.prevMonth(),n(d.year,d.month),e.preventDefault()},750,500),x.longClick($(".nextMonth",p),function(e){d.nextMonth(),n(d.year,d.month),e.preventDefault()},750,500),window.addEventListener("mousedown",function(e){"none"!==p.style.display&&e.target.closest(".calendar")&&e.preventDefault()}),window.addEventListener("resize",x.throttle(t,100)),p),function(){var e=c.value;c.readOnly=!0,c.size=f.format.length,h.isValidDate(e)&&(e=new Date(e),c.setAttribute("data-date",e),c.value=h.formatDateTime(e));c.addEventListener("change",function(){""===this.value?this.setAttribute("data-date",""):this.value=h.formatDateTime(this.getAttribute("data-date"))}),c.addEventListener("keydown",function(e){var t=this.getAttribute("data-date");switch(d.setDate(h.isValidDate(t)?new Date(t):new Date),e.which){case 13:$(".calendar-day.selected",p).click(),p.style.display="none";break;case 8:this.value="",this.blur(),p.style.display="none";break;case 27:this.blur(),p.style.display="none";break;case 37:e.ctrlKey||e.metaKey?e.shiftKey?d.prevYear():d.prevMonth():d.prevDay(),i(this);break;case 38:d.prevWeek(),i(this);break;case 39:e.ctrlKey||e.metaKey?e.shiftKey?d.nextYear():d.nextMonth():d.nextDay(),i(this);break;case 40:d.nextWeek(),i(this);break;case 48:(e.ctrlKey||e.metaKey)&&d.setDate(new Date),i(this);break;default:return}e.stopPropagation(),e.preventDefault()}),c.addEventListener("focus",function(){var e=h.isValidDate(this.getAttribute("data-date"))?new Date(this.getAttribute("data-date")):new Date;d.setDate(e),n(d.year,d.month,d.day),p.style.display="block",t()}),c.addEventListener("blur",function(){p.style.display="none"})}()}at.prototype={startIndex:null,dragStart:function(e){var t=e.oldDraggableIndex;this.startIndex=t},onSpill:function(e){var t=e.dragEl,n=e.putSortable;this.sortable.captureAnimationState(),n&&n.captureAnimationState();var i=M(this.sortable.el,this.startIndex,this.options);i?this.sortable.el.insertBefore(t,i):this.sortable.el.appendChild(t),this.sortable.animateAll(),n&&n.animateAll()},drop:rt},s(at,{pluginName:"revertOnSpill"}),st.prototype={onSpill:function(e){var t=e.dragEl,n=e.putSortable||this.sortable;n.captureAnimationState(),t.parentNode&&t.parentNode.removeChild(t),n.animateAll()},drop:rt},s(st,{pluginName:"removeOnSpill"}),_e.mount(new function(){function e(){for(var e in this.defaults={scroll:!0,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0},this)"_"===e.charAt(0)&&"function"==typeof this[e]&&(this[e]=this[e].bind(this))}return e.prototype={dragStarted:function(e){var t=e.originalEvent;this.sortable.nativeDraggable?v(document,"dragover",this._handleAutoScroll):this.options.supportPointer?v(document,"pointermove",this._handleFallbackAutoScroll):t.touches?v(document,"touchmove",this._handleFallbackAutoScroll):v(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(e){var t=e.originalEvent;this.options.dragOverBubble||t.rootEl||this._handleAutoScroll(t)},drop:function(){this.sortable.nativeDraggable?y(document,"dragover",this._handleAutoScroll):(y(document,"pointermove",this._handleFallbackAutoScroll),y(document,"touchmove",this._handleFallbackAutoScroll),y(document,"mousemove",this._handleFallbackAutoScroll)),it(),nt(),clearTimeout(k),k=void 0},nulling:function(){Ze=Ve=Xe=tt=Je=Ke=Qe=null,et.length=0},_handleFallbackAutoScroll:function(e){this._handleAutoScroll(e,!0)},_handleAutoScroll:function(t,n){var i=this,r=(t.touches?t.touches[0]:t).clientX,o=(t.touches?t.touches[0]:t).clientY,e=document.elementFromPoint(r,o);if(Ze=t,n||w||b||h){ot(t,this.options,e,n);var a=O(e,!0);!tt||Je&&r===Ke&&o===Qe||(Je&&it(),Je=setInterval(function(){var e=O(document.elementFromPoint(r,o),!0);e!==a&&(a=e,nt()),ot(t,i.options,e,n)},10),Ke=r,Qe=o)}else{if(!this.options.bubbleScroll||O(e,!0)===N())return void nt();ot(t,this.options,O(e,!1),!1)}}},s(e,{pluginName:"scroll",initializeByDefault:!0})}),_e.mount(st,at);var ct,ft=e(function(e,t){e.exports=function(){var e=navigator.userAgent,t=navigator.platform,m=/gecko\/\d/i.test(e),n=/MSIE \d/.test(e),i=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),r=/Edge\/(\d+)/.exec(e),w=n||i||r,C=w&&(n?document.documentMode||6:+(r||i)[1]),g=!r&&/WebKit\//.test(e),o=g&&/Qt\/\d+\.\d+/.test(e),a=!r&&/Chrome\//.test(e),v=/Opera\//.test(e),s=/Apple Computer/.test(navigator.vendor),l=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),u=/PhantomJS/.test(e),c=!r&&/AppleWebKit/.test(e)&&/Mobile\/\w+/.test(e),f=/Android/.test(e),d=c||f||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),y=c||/Mac/.test(t),h=/\bCrOS\b/.test(e),p=/win/i.test(t),x=v&&e.match(/Version\/(\d*\.\d*)/);if(x){x=Number(x[1])}if(x&&x>=15){v=false;g=true}var b=y&&(o||v&&(x==null||x<12.11)),k=m||w&&C>=9;function S(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var L=function(e,t){var n=e.className;var i=S(t).exec(n);if(i){var r=n.slice(i.index+i[0].length);e.className=n.slice(0,i.index)+(r?i[1]+r:"")}},E;function M(e){for(var t=e.childNodes.length;t>0;--t){e.removeChild(e.firstChild)}return e}function T(e,t){return M(e).appendChild(t)}function N(e,t,n,i){var r=document.createElement(e);if(n){r.className=n}if(i){r.style.cssText=i}if(typeof t=="string"){r.appendChild(document.createTextNode(t))}else if(t){for(var o=0;o=t){return a+(t-o)}a+=s-o;a+=n-a%n;o=s+1}}var H=function(){this.id=null;this.f=null;this.time=0;this.handler=z(this.onTimeout,this)};function W(e,t){for(var n=0;n=t){return i+Math.min(a,t-r)}r+=o-i;r+=n-r%n;i=o+1;if(r>=t){return i}}}var G=[""];function X(e){while(G.length<=e){G.push(V(G)+" ")}return G[e]}function V(e){return e[e.length-1]}function K(e,t){var n=[];for(var i=0;i"€"&&(e.toUpperCase()!=e.toLowerCase()||ee.test(e))}function ne(e,t){if(!t){return te(e)}if(t.source.indexOf("\\w")>-1&&te(e)){return true}return t.test(e)}function ie(e){for(var t in e){if(e.hasOwnProperty(t)&&e[t]){return false}}return true}var re=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function oe(e){return e.charCodeAt(0)>=768&&re.test(e)}function ae(e,t,n){while((n<0?t>0:tn?-1:1;for(;;){if(t==n){return t}var r=(t+n)/2,o=i<0?Math.ceil(r):Math.floor(r);if(o==t){return e(o)?t:n}if(e(o)){n=o}else{t=o+i}}}function le(e,t,n,i){if(!e){return i(t,n,"ltr",0)}var r=false;for(var o=0;ot||t==n&&a.to==t){i(Math.max(a.from,t),Math.min(a.to,n),a.level==1?"rtl":"ltr",o);r=true}}if(!r){i(t,n,"ltr")}}var ue=null;function ce(e,t,n){var i;ue=null;for(var r=0;rt){return r}if(o.to==t){if(o.from!=o.to&&n=="before"){i=r}else{ue=r}}if(o.from==t){if(o.from!=o.to&&n!="before"){i=r}else{ue=r}}}return i!=null?i:ue}var fe=function(){var t="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN";var n="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function $(e){if(e<=247){return t.charAt(e)}else if(1424<=e&&e<=1524){return"R"}else if(1536<=e&&e<=1785){return n.charAt(e-1536)}else if(1774<=e&&e<=2220){return"r"}else if(8192<=e&&e<=8203){return"w"}else if(e==8204){return"b"}else{return"L"}}var H=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;var W=/[stwN]/,_=/[LRr]/,R=/[Lb1n]/,j=/[1n]/;function U(e,t,n){this.level=e;this.from=t;this.to=n}return function(e,t){var n=t=="ltr"?"L":"R";if(e.length==0||t=="ltr"&&!H.test(e)){return false}var i=e.length,r=[];for(var o=0;o-1){i[t]=r.slice(0,o).concat(r.slice(o+1))}}}}function ve(e,t){var n=me(e,t);if(!n.length){return}var i=Array.prototype.slice.call(arguments,2);for(var r=0;r0}function we(e){e.prototype.on=function(e,t){pe(this,e,t)};e.prototype.off=function(e,t){ge(this,e,t)}}function Ce(e){if(e.preventDefault){e.preventDefault()}else{e.returnValue=false}}function ke(e){if(e.stopPropagation){e.stopPropagation()}else{e.cancelBubble=true}}function Se(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==false}function Le(e){Ce(e);ke(e)}function Ee(e){return e.target||e.srcElement}function Me(e){var t=e.which;if(t==null){if(e.button&1){t=1}else if(e.button&2){t=3}else if(e.button&4){t=2}}if(y&&e.ctrlKey&&t==1){t=3}return t}var Te=function(){if(w&&C<9){return false}var e=N("div");return"draggable"in e||"dragDrop"in e}(),De,Ae;function Ne(e){if(De==null){var t=N("span","​");T(e,N("span",[t,document.createTextNode("x")]));if(e.firstChild.offsetHeight!=0){De=t.offsetWidth<=1&&t.offsetHeight>2&&!(w&&C<8)}}var n=De?N("span","​"):N("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");n.setAttribute("cm-text","");return n}function Oe(e){if(Ae!=null){return Ae}var t=T(e,document.createTextNode("AخA"));var n=E(t,0,1).getBoundingClientRect();var i=E(t,1,2).getBoundingClientRect();M(e);if(!n||n.left==n.right){return false}return Ae=i.right-n.right<3}var Fe="\n\nb".split(/\n/).length!=3?function(e){var t=0,n=[],i=e.length;while(t<=i){var r=e.indexOf("\n",t);if(r==-1){r=e.length}var o=e.slice(t,e.charAt(r-1)=="\r"?r-1:r);var a=o.indexOf("\r");if(a!=-1){n.push(o.slice(0,a));t+=a+1}else{n.push(o);t=r+1}}return n}:function(e){return e.split(/\r\n?|\n/)},Ie=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(e){return false}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(e){}if(!t||t.parentElement()!=e){return false}return t.compareEndPoints("StartToEnd",t)!=0},Pe=function(){var e=N("div");if("oncopy"in e){return true}e.setAttribute("oncopy","return;");return typeof e.oncopy=="function"}(),ze=null;function Be(e){if(ze!=null){return ze}var t=T(e,N("span","x"));var n=t.getBoundingClientRect();var i=E(t,0,1).getBoundingClientRect();return ze=Math.abs(n.left-i.left)>1}var $e={},He={};function We(e,t){if(2=e.size){throw new Error("There is no line "+(t+e.first)+" in the document.")}var n=e;while(!n.lines){for(var i=0;;++i){var r=n.children[i],o=r.chunkSize();if(t=e.first&&tn){return rt(n,Ke(e,n).text.length)}return dt(t,Ke(e,t.line).text.length)}function dt(e,t){var n=e.ch;if(n==null||n>t){return rt(e.line,t)}else if(n<0){return rt(e.line,0)}else{return e}}function ht(e,t){var n=[];for(var i=0;i=this.string.length},Ve.prototype.sol=function(){return this.pos==this.lineStart},Ve.prototype.peek=function(){return this.string.charAt(this.pos)||undefined},Ve.prototype.next=function(){if(this.post},Ve.prototype.eatSpace=function(){var e=this.pos;while(/[\s\u00a0]/.test(this.string.charAt(this.pos))){++this.pos}return this.pos>e},Ve.prototype.skipToEnd=function(){this.pos=this.string.length},Ve.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1){this.pos=t;return true}},Ve.prototype.backUp=function(e){this.pos-=e},Ve.prototype.column=function(){if(this.lastColumnPos0){return null}if(o&&t!==false){this.pos+=o[0].length}return o}},Ve.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ve.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ve.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ve.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var pt=function(e,t){this.state=e;this.lookAhead=t},mt=function(e,t,n,i){this.state=t;this.doc=e;this.line=n;this.maxLookAhead=i||0;this.baseTokens=null;this.baseTokenPos=1};function gt(t,n,i,e){var l=[t.state.modeGen],r={};Lt(t,n.text,t.doc.mode,i,function(e,t){return l.push(e,t)},r,e);var u=i.state;var o=function(e){i.baseTokens=l;var o=t.state.overlays[e],a=1,s=0;i.state=true;Lt(t,n.text,o.mode,i,function(e,t){var n=a;while(se){l.splice(a,1,e,l[a+1],i)}a+=2;s=Math.min(e,i)}if(!t){return}if(o.opaque){l.splice(n,a-n,e,"overlay "+t);a=n+2}else{for(;ne.options.maxHighlightLength&&qe(e.doc.mode,i.state);var o=gt(e,t,i);if(r){i.state=r}t.stateAfter=i.save(!r);t.styles=o.styles;if(o.classes){t.styleClasses=o.classes}else if(t.styleClasses){t.styleClasses=null}if(n===e.doc.highlightFrontier){e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier)}}return t.styles}function yt(n,i,e){var t=n.doc,r=n.display;if(!t.mode.startState){return new mt(t,true,i)}var o=Et(n,i,e);var a=o>t.first&&Ke(t,o-1).stateAfter;var s=a?mt.fromSaved(t,a,o):new mt(t,Xe(t.mode),o);t.iter(o,i,function(e){xt(n,e.text,s);var t=s.line;e.stateAfter=t==i-1||t%5==0||t>=r.viewFrom&&tt.start){return o}}throw new Error("Mode "+e.name+" failed to advance stream.")}mt.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);if(t!=null&&e>this.maxLookAhead){this.maxLookAhead=e}return t},mt.prototype.baseToken=function(e){if(!this.baseTokens){return null}while(this.baseTokens[this.baseTokenPos]<=e){this.baseTokenPos+=2}var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},mt.prototype.nextLine=function(){this.line++;if(this.maxLookAhead>0){this.maxLookAhead--}},mt.fromSaved=function(e,t,n){if(t instanceof pt){return new mt(e,qe(e.mode,t.state),n,t.lookAhead)}else{return new mt(e,qe(e.mode,t),n)}},mt.prototype.save=function(e){var t=e!==false?qe(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new pt(t,this.maxLookAhead):t};var Ct=function(e,t,n){this.start=e.start;this.end=e.pos;this.string=e.current();this.type=t||null;this.state=n};function kt(e,t,n,i){var r=e.doc,o=r.mode,a;t=ft(r,t);var s=Ke(r,t.line),l=yt(e,t.line,n);var u=new Ve(s.text,e.options.tabSize,l),c;if(i){c=[]}while((i||u.pose.options.maxHighlightLength){s=false;if(a){xt(e,t,i,c.pos)}c.pos=t.length;f=null}else{f=St(wt(n,c,i.state,d),o)}if(d){var h=d[0].name;if(h){f="m-"+(f?h+" "+f:h)}}if(!s||u!=f){while(la;--s){if(s<=o.first){return o.first}var l=Ke(o,s-1),u=l.stateAfter;if(u&&(!n||s+(u instanceof pt?u.lookAhead:0)<=o.modeFrontier)){return s}var c=$(l.text,null,e.options.tabSize);if(r==null||i>c){r=s-1;i=c}}return r}function Mt(e,t){e.modeFrontier=Math.min(e.modeFrontier,t);if(e.highlightFrontiern;i--){var r=Ke(e,i).stateAfter;if(r&&(!(r instanceof pt)||i+r.lookAhead=t:o.to>t);(i||(i=[])).push(new Ot(a,o.from,l?null:o.to))}}}return i}function Bt(e,t,n){var i;if(e){for(var r=0;r=t:o.to>t);if(s||o.from==t&&a.type=="bookmark"&&(!n||o.marker.insertLeft)){var l=o.from==null||(a.inclusiveLeft?o.from<=t:o.from0&&s){for(var b=0;b0){continue}var c=[l,1],f=ot(u.from,s.from),d=ot(u.to,s.to);if(f<0||!a.inclusiveLeft&&!f){c.push({from:u.from,to:s.from})}if(d>0||!a.inclusiveRight&&!d){c.push({from:s.to,to:u.to})}r.splice.apply(r,c);l+=c.length-3}}return r}function _t(e){var t=e.markedSpans;if(!t){return}for(var n=0;nt)&&(!i||Yt(i,o.marker)<0)){i=o.marker}}}return i}function Kt(e,t,n,i,r){var o=Ke(e,t);var a=Dt&&o.markedSpans;if(a){for(var s=0;s=0&&f<=0||c<=0&&f>=0){continue}if(c<=0&&(l.marker.inclusiveRight&&r.inclusiveLeft?ot(u.to,n)>=0:ot(u.to,n)>0)||c>=0&&(l.marker.inclusiveRight&&r.inclusiveLeft?ot(u.from,i)<=0:ot(u.from,i)<0)){return true}}}}function Qt(e){var t;while(t=Gt(e)){e=t.find(-1,true).line}return e}function Zt(e){var t;while(t=Xt(e)){e=t.find(1,true).line}return e}function Jt(e){var t,n;while(t=Xt(e)){e=t.find(1,true).line;(n||(n=[])).push(e)}return n}function en(e,t){var n=Ke(e,t),i=Qt(n);if(n==i){return t}return et(i)}function tn(e,t){if(t>e.lastLine()){return t}var n=Ke(e,t),i;if(!nn(e,n)){return t}while(i=Xt(n)){n=i.find(1,true).line}return et(n)+1}function nn(e,t){var n=Dt&&t.markedSpans;if(n){for(var i=void 0,r=0;rn.maxLineLength){n.maxLineLength=t;n.maxLine=e}})}var ln=function(e,t,n){this.text=e;Rt(this,t);this.height=n?n(this):1};function un(e,t,n,i){e.text=t;if(e.stateAfter){e.stateAfter=null}if(e.styles){e.styles=null}if(e.order!=null){e.order=null}_t(e);Rt(e,n);var r=i?i(e):1;if(r!=e.height){Je(e,r)}}function cn(e){e.parent=null;_t(e)}ln.prototype.lineNo=function(){return et(this)},we(ln);var fn={},dn={};function hn(e,t){if(!e||/^\s*$/.test(e)){return null}var n=t.addModeClass?dn:fn;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function pn(e,t){var n=D("span",null,null,g?"padding-right: .1px":null);var i={pre:D("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:false,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var r=0;r<=(t.rest?t.rest.length:0);r++){var o=r?t.rest[r-1]:t.line,a=void 0;i.pos=0;i.addToken=gn;if(Oe(e.display.measure)&&(a=de(o,e.doc.direction))){i.addToken=yn(i.addToken,a)}i.map=[];var s=t!=e.display.externalMeasured&&et(o);bn(o,i,vt(e,o,s));if(o.styleClasses){if(o.styleClasses.bgClass){i.bgClass=I(o.styleClasses.bgClass,i.bgClass||"")}if(o.styleClasses.textClass){i.textClass=I(o.styleClasses.textClass,i.textClass||"")}}if(i.map.length==0){i.map.push(0,0,i.content.appendChild(Ne(e.display.measure)))}if(r==0){t.measure.map=i.map;t.measure.cache={}}else{(t.measure.maps||(t.measure.maps=[])).push(i.map);(t.measure.caches||(t.measure.caches=[])).push({})}}if(g){var l=i.content.lastChild;if(/\bcm-tab\b/.test(l.className)||l.querySelector&&l.querySelector(".cm-tab")){i.content.className="cm-tab-wrap-hack"}}ve(e,"renderLine",e,t.line,i.pre);if(i.pre.className){i.textClass=I(i.pre.className,i.textClass||"")}return i}function mn(e){var t=N("span","•","cm-invalidchar");t.title="\\u"+e.charCodeAt(0).toString(16);t.setAttribute("aria-label",t.title);return t}function gn(e,t,n,i,r,o,a){if(!t){return}var s=e.splitSpaces?vn(t,e.trailingSpace):t;var l=e.cm.state.specialChars,u=false;var c;if(!l.test(t)){e.col+=t.length;c=document.createTextNode(s);e.map.push(e.pos,e.pos+t.length,c);if(w&&C<9){u=true}e.pos+=t.length}else{c=document.createDocumentFragment();var f=0;while(true){l.lastIndex=f;var d=l.exec(t);var h=d?d.index-f:t.length-f;if(h){var p=document.createTextNode(s.slice(f,f+h));if(w&&C<9){c.appendChild(N("span",[p]))}else{c.appendChild(p)}e.map.push(e.pos,e.pos+h,p);e.col+=h;e.pos+=h}if(!d){break}f+=h+1;var m=void 0;if(d[0]=="\t"){var g=e.cm.options.tabSize,v=g-e.col%g;m=c.appendChild(N("span",X(v),"cm-tab"));m.setAttribute("role","presentation");m.setAttribute("cm-text","\t");e.col+=v}else if(d[0]=="\r"||d[0]=="\n"){m=c.appendChild(N("span",d[0]=="\r"?"␍":"␤","cm-invalidchar"));m.setAttribute("cm-text",d[0]);e.col+=1}else{m=e.cm.options.specialCharPlaceholder(d[0]);m.setAttribute("cm-text",d[0]);if(w&&C<9){c.appendChild(N("span",[m]))}else{c.appendChild(m)}e.col+=1}e.map.push(e.pos,e.pos+1,m);e.pos++}}e.trailingSpace=s.charCodeAt(t.length-1)==32;if(n||i||r||u||o){var y=n||"";if(i){y+=i}if(r){y+=r}var x=N("span",[c],y,o);if(a){for(var b in a){if(a.hasOwnProperty(b)&&b!="style"&&b!="class"){x.setAttribute(b,a[b])}}}return e.content.appendChild(x)}e.content.appendChild(c)}function vn(e,t){if(e.length>1&&!/ /.test(e)){return e}var n=t,i="";for(var r=0;rs&&u.from<=s){break}}if(u.to>=l){return f(e,t,n,i,r,o,a)}f(e,t.slice(0,u.to-s),n,i,null,o,a);i=null;t=t.slice(u.to-s);s=u.to}}}function xn(e,t,n,i){var r=!i&&n.widgetNode;if(r){e.map.push(e.pos,e.pos+t,r)}if(!i&&e.cm.display.input.needsContentAttribute){if(!r){r=e.content.appendChild(document.createElement("span"))}r.setAttribute("cm-marker",n.id)}if(r){e.cm.display.input.setUneditable(r);e.content.appendChild(r)}e.pos+=t;e.trailingSpace=false}function bn(e,t,n){var i=e.markedSpans,r=e.text,o=0;if(!i){for(var a=1;al||k.collapsed&&C.to==l&&C.from==l)){if(C.to!=null&&C.to!=l&&h>C.to){h=C.to;m=""}if(k.className){p+=" "+k.className}if(k.css){d=(d?d+";":"")+k.css}if(k.startStyle&&C.from==l){g+=" "+k.startStyle}if(k.endStyle&&C.to==h){(b||(b=[])).push(k.endStyle,C.to)}if(k.title){(y||(y={})).title=k.title}if(k.attributes){for(var S in k.attributes){(y||(y={}))[S]=k.attributes[S]}}if(k.collapsed&&(!v||Yt(v.marker,k)<0)){v=C}}else if(C.from>l&&h>C.from){h=C.from}}if(b){for(var L=0;L=s){break}var M=Math.min(s,h);while(true){if(c){var T=l+c.length;if(!v){var D=T>M?c.slice(0,M-l):c;t.addToken(t,D,f?f+p:p,g,l+D.length==h?m:"",d,y)}if(T>=M){c=c.slice(M-l);l=M;break}l=T;g=""}c=r.slice(o,o=n[u++]);f=hn(n[u++],t.cm.options)}}}function wn(e,t,n){this.line=t;this.rest=Jt(t);this.size=this.rest?et(V(this.rest))-n+1:1;this.node=this.text=null;this.hidden=nn(e,t)}function Cn(e,t,n){var i=[],r;for(var o=t;o2){o.push((l.bottom+u.top)/2-n.top)}}}o.push(n.bottom-n.top)}}function Qn(e,t,n){if(e.line==t){return{map:e.measure.map,cache:e.measure.cache}}for(var i=0;in){return{map:e.measure.maps[r],cache:e.measure.caches[r],before:true}}}}function Zn(e,t){t=Qt(t);var n=et(t);var i=e.display.externalMeasured=new wn(e.doc,t,n);i.lineN=n;var r=i.built=pn(e,i);i.text=r.pre;T(e.display.lineMeasure,r.pre);return i}function Jn(e,t,n,i){return ni(e,ti(e,t),n,i)}function ei(e,t){if(t>=e.display.viewFrom&&t=n.lineN&&tt){o=l-s;r=o-1;if(t>=l){a="right"}}if(r!=null){i=e[u+2];if(s==l&&n==(i.insertLeft?"left":"right")){a=n}if(n=="left"&&r==0){while(u&&e[u-2]==e[u-3]&&e[u-1].insertLeft){i=e[(u-=3)+2];a="left"}}if(n=="right"&&r==l-s){while(u=0;r--){if((n=e[r]).left!=n.right){break}}}return n}function si(e,t,n,i){var r=oi(t.map,n,i);var o=r.node,a=r.start,s=r.end,l=r.collapse;var u;if(o.nodeType==3){for(var c=0;c<4;c++){while(a&&oe(t.line.text.charAt(r.coverStart+a))){--a}while(r.coverStart+s0){l=i="right"}var f;if(e.options.lineWrapping&&(f=o.getClientRects()).length>1){u=f[i=="right"?f.length-1:0]}else{u=o.getBoundingClientRect()}}if(w&&C<9&&!a&&(!u||!u.left&&!u.right)){var d=o.parentNode.getClientRects()[0];if(d){u={left:d.left,right:d.left+Di(e.display),top:d.top,bottom:d.bottom}}else{u=ii}}var h=u.top-t.rect.top,p=u.bottom-t.rect.top;var m=(h+p)/2;var g=t.view.measure.heights;var v=0;for(;v=o.text.length){t=o.text.length;n="before"}else if(t<=0){t=0;n="after"}if(!u){return l(n=="before"?t-1:t,n=="before")}function c(e,t,n){var i=u[t],r=i.level==1;return l(n?e-1:e,r!=n)}var f=ce(u,t,n);var d=ue;var h=c(t,f,n=="before");if(d!=null){h.other=c(t,d,n!="before")}return h}function xi(e,t){var n=0;t=ft(e.doc,t);if(!e.options.lineWrapping){n=Di(e.display)*t.ch}var i=Ke(e.doc,t.line);var r=on(i)+Un(e.display);return{left:n,right:n,top:r,bottom:r+i.height}}function bi(e,t,n,i,r){var o=rt(e,t,n);o.xRel=r;if(i){o.outside=i}return o}function wi(e,t,n){var i=e.doc;n+=e.display.viewOffset;if(n<0){return bi(i.first,0,null,-1,-1)}var r=tt(i,n),o=i.first+i.size-1;if(r>o){return bi(i.first+i.size-1,Ke(i,o).text.length,null,1,1)}if(t<0){t=0}var a=Ke(i,r);for(;;){var s=Li(e,a,r,t,n);var l=Vt(a,s.ch+(s.xRel>0||s.outside>0?1:0));if(!l){return s}var u=l.find(1);if(u.line==r){return u}a=Ke(i,r=u.line)}}function Ci(t,e,n,i){i-=pi(e);var r=e.text.length;var o=se(function(e){return ni(t,n,e-1).bottom<=i},r,0);r=se(function(e){return ni(t,n,e).top>i},o,r);return{begin:o,end:r}}function ki(e,t,n,i){if(!n){n=ti(e,t)}var r=mi(e,t,ni(e,n,i),"line").top;return Ci(e,t,n,r)}function Si(e,t,n,i){return e.bottom<=n?false:e.top>n?true:(i?e.left:e.right)>t}function Li(n,e,t,i,r){r-=on(e);var o=ti(n,e);var a=pi(e);var s=0,l=e.text.length,u=true;var c=de(e,n.doc.direction);if(c){var f=(n.options.lineWrapping?Mi:Ei)(n,e,t,o,c,i,r);u=f.level!=1;s=u?f.from:f.to-1;l=u?f.to:f.from-1}var d=null,h=null;var p=se(function(e){var t=ni(n,o,e);t.top+=a;t.bottom+=a;if(!Si(t,i,r,false)){return false}if(t.top<=r&&t.left<=i){d=e;h=t}return true},s,l);var m,g,v=false;if(h){var y=i-h.left=b.bottom?1:0}p=ae(e.text,p,1);return bi(t,p,g,v,i-m)}function Ei(i,r,o,a,s,l,u){var e=se(function(e){var t=s[e],n=t.level!=1;return Si(yi(i,rt(o,n?t.to:t.from,n?"before":"after"),"line",r,a),l,u,true)},0,s.length-1);var t=s[e];if(e>0){var n=t.level!=1;var c=yi(i,rt(o,n?t.from:t.to,n?"after":"before"),"line",r,a);if(Si(c,l,u,true)&&c.top>u){t=s[e-1]}}return t}function Mi(e,t,n,i,r,o,a){var s=Ci(e,t,i,a);var l=s.begin;var u=s.end;if(/\s/.test(t.text.charAt(u-1))){u--}var c=null,f=null;for(var d=0;d=u||h.to<=l){continue}var p=h.level!=1;var m=ni(e,i,p?Math.min(u,h.to)-1:Math.max(l,h.from)).right;var g=mg){c=h;f=g}}if(!c){c=r[r.length-1]}if(c.fromu){c={from:c.from,to:u,level:c.level}}return c}function Ti(e){if(e.cachedTextHeight!=null){return e.cachedTextHeight}if(ri==null){ri=N("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t){ri.appendChild(document.createTextNode("x"));ri.appendChild(N("br"))}ri.appendChild(document.createTextNode("x"))}T(e.measure,ri);var n=ri.offsetHeight/50;if(n>3){e.cachedTextHeight=n}M(e.measure);return n||1}function Di(e){if(e.cachedCharWidth!=null){return e.cachedCharWidth}var t=N("span","xxxxxxxxxx");var n=N("pre",[t],"CodeMirror-line-like");T(e.measure,n);var i=t.getBoundingClientRect(),r=(i.right-i.left)/10;if(r>2){e.cachedCharWidth=r}return r||10}function Ai(e){var t=e.display,n={},i={};var r=t.gutters.clientLeft;for(var o=t.gutters.firstChild,a=0;o;o=o.nextSibling,++a){var s=e.display.gutterSpecs[a].className;n[s]=o.offsetLeft+o.clientLeft+r;i[s]=o.clientWidth}return{fixedPos:Ni(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:i,wrapperWidth:t.wrapper.clientWidth}}function Ni(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Oi(i){var r=Ti(i.display),o=i.options.lineWrapping;var a=o&&Math.max(5,i.display.scroller.clientWidth/Di(i.display)-3);return function(e){if(nn(i.doc,e)){return 0}var t=0;if(e.widgets){for(var n=0;n0&&(u=Ke(e.doc,l.line).text).length==l.ch){var c=$(u,u.length,e.options.tabSize)-u.length;l=rt(l.line,Math.max(0,Math.round((o-qn(e.display).left)/Di(e.display))-c))}return l}function Pi(e,t){if(t>=e.display.viewTo){return null}t-=e.display.viewFrom;if(t<0){return null}var n=e.display.view;for(var i=0;it)){r.updateLineNumbers=t}e.curOp.viewChanged=true;if(t>=r.viewTo){if(Dt&&en(e.doc,t)r.viewFrom){$i(e)}else{r.viewFrom+=i;r.viewTo+=i}}else if(t<=r.viewFrom&&n>=r.viewTo){$i(e)}else if(t<=r.viewFrom){var o=Hi(e,n,n+i,1);if(o){r.view=r.view.slice(o.index);r.viewFrom=o.lineN;r.viewTo+=i}else{$i(e)}}else if(n>=r.viewTo){var a=Hi(e,t,t,-1);if(a){r.view=r.view.slice(0,a.index);r.viewTo=a.lineN}else{$i(e)}}else{var s=Hi(e,t,t,-1);var l=Hi(e,n,n+i,1);if(s&&l){r.view=r.view.slice(0,s.index).concat(Cn(e,s.lineN,l.lineN)).concat(r.view.slice(l.index));r.viewTo+=i}else{$i(e)}}var u=r.externalMeasured;if(u){if(n=r.lineN&&t=i.viewTo){return}var o=i.view[Pi(e,t)];if(o.node==null){return}var a=o.changes||(o.changes=[]);if(W(a,n)==-1){a.push(n)}}function $i(e){e.display.viewFrom=e.display.viewTo=e.doc.first;e.display.view=[];e.display.viewOffset=0}function Hi(e,t,n,i){var r=Pi(e,t),o,a=e.display.view;if(!Dt||n==e.doc.first+e.doc.size){return{index:r,lineN:n}}var s=e.display.viewFrom;for(var l=0;l0){if(r==a.length-1){return null}o=s+a[r].size-t;r++}else{o=s-t}t+=o;n+=o}while(en(e.doc,n)!=n){if(r==(i<0?0:a.length-1)){return null}n+=i*a[r-(i<0?1:0)].size;r+=i}return{index:r,lineN:n}}function Wi(e,t,n){var i=e.display,r=i.view;if(r.length==0||t>=i.viewTo||n<=i.viewFrom){i.view=Cn(e,t,n);i.viewFrom=t}else{if(i.viewFrom>t){i.view=Cn(e,t,i.viewFrom).concat(i.view)}else if(i.viewFromn){i.view=i.view.slice(0,Pi(e,n))}}i.viewTo=n}function _i(e){var t=e.display.view,n=0;for(var i=0;i=e.display.viewTo||s.to().line0){t.blinker=setInterval(function(){return t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate)}else if(e.options.cursorBlinkRate<0){t.cursorDiv.style.visibility="hidden"}}function Xi(e){if(!e.state.focused){e.display.input.focus();Ki(e)}}function Vi(e){e.state.delayingBlurEvent=true;setTimeout(function(){if(e.state.delayingBlurEvent){e.state.delayingBlurEvent=false;Qi(e)}},100)}function Ki(e,t){if(e.state.delayingBlurEvent){e.state.delayingBlurEvent=false}if(e.options.readOnly=="nocursor"){return}if(!e.state.focused){ve(e,"focus",e,t);e.state.focused=true;F(e.display.wrapper,"CodeMirror-focused");if(!e.curOp&&e.display.selForContextMenu!=e.doc.sel){e.display.input.reset();if(g){setTimeout(function(){return e.display.input.reset(true)},20)}}e.display.input.receivedFocus()}Gi(e)}function Qi(e,t){if(e.state.delayingBlurEvent){return}if(e.state.focused){ve(e,"blur",e,t);e.state.focused=false;L(e.display.wrapper,"CodeMirror-focused")}clearInterval(e.display.blinker);setTimeout(function(){if(!e.state.focused){e.display.shift=false}},150)}function Zi(e){var t=e.display;var n=t.lineDiv.offsetTop;for(var i=0;i.005||c<-.005){Je(r.line,a);Ji(r.line);if(r.rest){for(var f=0;fe.display.sizerWidth){var d=Math.ceil(s/Di(e.display));if(d>e.display.maxLineLength){e.display.maxLineLength=d;e.display.maxLine=r.line;e.display.maxLineChanged=true}}}}function Ji(e){if(e.widgets){for(var t=0;t=a){o=tt(t,on(Ke(t,l))-e.wrapper.clientHeight);a=l}}return{from:o,to:Math.max(a,o+1)}}function tr(e,t){if(ye(e,"scrollCursorIntoView")){return}var n=e.display,i=n.sizer.getBoundingClientRect(),r=null;if(t.top+i.top<0){r=true}else if(t.bottom+i.top>(window.innerHeight||document.documentElement.clientHeight)){r=false}if(r!=null&&!u){var o=N("div","​",null,"position: absolute;\n top: "+(t.top-n.viewOffset-Un(e.display))+"px;\n height: "+(t.bottom-t.top+Gn(e)+n.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(o);o.scrollIntoView(r);e.display.lineSpace.removeChild(o)}}function nr(e,t,n,i){if(i==null){i=0}var r;if(!e.options.lineWrapping&&t==n){t=t.ch?rt(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t;n=t.sticky=="before"?rt(t.line,t.ch+1,"before"):t}for(var o=0;o<5;o++){var a=false;var s=yi(e,t);var l=!n||n==t?s:yi(e,n);r={left:Math.min(s.left,l.left),top:Math.min(s.top,l.top)-i,right:Math.max(s.left,l.left),bottom:Math.max(s.bottom,l.bottom)+i};var u=rr(e,r);var c=e.doc.scrollTop,f=e.doc.scrollLeft;if(u.scrollTop!=null){fr(e,u.scrollTop);if(Math.abs(e.doc.scrollTop-c)>1){a=true}}if(u.scrollLeft!=null){hr(e,u.scrollLeft);if(Math.abs(e.doc.scrollLeft-f)>1){a=true}}if(!a){break}}return r}function ir(e,t){var n=rr(e,t);if(n.scrollTop!=null){fr(e,n.scrollTop)}if(n.scrollLeft!=null){hr(e,n.scrollLeft)}}function rr(e,t){var n=e.display,i=Ti(e.display);if(t.top<0){t.top=0}var r=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop;var o=Vn(e),a={};if(t.bottom-t.top>o){t.bottom=t.top+o}var s=e.doc.height+Yn(n);var l=t.tops-i;if(t.topr+o){var c=Math.min(t.top,(u?s:t.bottom)-o);if(c!=r){a.scrollTop=c}}var f=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft;var d=Xn(e)-(e.options.fixedGutter?n.gutters.offsetWidth:0);var h=t.right-t.left>d;if(h){t.right=t.left+d}if(t.left<10){a.scrollLeft=0}else if(t.leftd+f-3){a.scrollLeft=t.right+(h?0:10)-d}return a}function or(e,t){if(t==null){return}ur(e);e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function ar(e){ur(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function sr(e,t,n){if(t!=null||n!=null){ur(e)}if(t!=null){e.curOp.scrollLeft=t}if(n!=null){e.curOp.scrollTop=n}}function lr(e,t){ur(e);e.curOp.scrollToPos=t}function ur(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=xi(e,t.from),i=xi(e,t.to);cr(e,n,i,t.margin)}}function cr(e,t,n,i){var r=rr(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-i,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+i});sr(e,r.scrollLeft,r.scrollTop)}function fr(e,t){if(Math.abs(e.doc.scrollTop-t)<2){return}if(!m){Rr(e,{top:t})}dr(e,t,true);if(m){Rr(e)}Ir(e,100)}function dr(e,t,n){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t));if(e.display.scroller.scrollTop==t&&!n){return}e.doc.scrollTop=t;e.display.scrollbars.setScrollTop(t);if(e.display.scroller.scrollTop!=t){e.display.scroller.scrollTop=t}}function hr(e,t,n,i){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth));if((n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!i){return}e.doc.scrollLeft=t;qr(e);if(e.display.scroller.scrollLeft!=t){e.display.scroller.scrollLeft=t}e.display.scrollbars.setScrollLeft(t)}function pr(e){var t=e.display,n=t.gutters.offsetWidth;var i=Math.round(e.doc.height+Yn(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:i,scrollHeight:i+Gn(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var mr=function(e,t,n){this.cm=n;var i=this.vert=N("div",[N("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar");var r=this.horiz=N("div",[N("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");i.tabIndex=r.tabIndex=-1;e(i);e(r);pe(i,"scroll",function(){if(i.clientHeight){t(i.scrollTop,"vertical")}});pe(r,"scroll",function(){if(r.clientWidth){t(r.scrollLeft,"horizontal")}});this.checkedZeroWidth=false;if(w&&C<8){this.horiz.style.minHeight=this.vert.style.minWidth="18px"}};mr.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1;var n=e.scrollHeight>e.clientHeight+1;var i=e.nativeBarWidth;if(n){this.vert.style.display="block";this.vert.style.bottom=t?i+"px":"0";var r=e.viewHeight-(t?i:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+r)+"px"}else{this.vert.style.display="";this.vert.firstChild.style.height="0"}if(t){this.horiz.style.display="block";this.horiz.style.right=n?i+"px":"0";this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(n?i:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+o)+"px"}else{this.horiz.style.display="";this.horiz.firstChild.style.width="0"}if(!this.checkedZeroWidth&&e.clientHeight>0){if(i==0){this.zeroWidthHack()}this.checkedZeroWidth=true}return{right:n?i:0,bottom:t?i:0}},mr.prototype.setScrollLeft=function(e){if(this.horiz.scrollLeft!=e){this.horiz.scrollLeft=e}if(this.disableHoriz){this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")}},mr.prototype.setScrollTop=function(e){if(this.vert.scrollTop!=e){this.vert.scrollTop=e}if(this.disableVert){this.enableZeroWidthBar(this.vert,this.disableVert,"vert")}},mr.prototype.zeroWidthHack=function(){var e=y&&!l?"12px":"18px";this.horiz.style.height=this.vert.style.width=e;this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none";this.disableHoriz=new H;this.disableVert=new H},mr.prototype.enableZeroWidthBar=function(n,i,r){n.style.pointerEvents="auto";function o(){var e=n.getBoundingClientRect();var t=r=="vert"?document.elementFromPoint(e.right-1,(e.top+e.bottom)/2):document.elementFromPoint((e.right+e.left)/2,e.bottom-1);if(t!=n){n.style.pointerEvents="none"}else{i.set(1e3,o)}}i.set(1e3,o)},mr.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz);e.removeChild(this.vert)};var gr=function(){};function vr(e,t){if(!t){t=pr(e)}var n=e.display.barWidth,i=e.display.barHeight;yr(e,t);for(var r=0;r<4&&n!=e.display.barWidth||i!=e.display.barHeight;r++){if(n!=e.display.barWidth&&e.options.lineWrapping){Zi(e)}yr(e,pr(e));n=e.display.barWidth;i=e.display.barHeight}}function yr(e,t){var n=e.display;var i=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=i.right)+"px";n.sizer.style.paddingBottom=(n.barHeight=i.bottom)+"px";n.heightForcer.style.borderBottom=i.bottom+"px solid transparent";if(i.right&&i.bottom){n.scrollbarFiller.style.display="block";n.scrollbarFiller.style.height=i.bottom+"px";n.scrollbarFiller.style.width=i.right+"px"}else{n.scrollbarFiller.style.display=""}if(i.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter){n.gutterFiller.style.display="block";n.gutterFiller.style.height=i.bottom+"px";n.gutterFiller.style.width=t.gutterWidth+"px"}else{n.gutterFiller.style.display=""}}gr.prototype.update=function(){return{bottom:0,right:0}},gr.prototype.setScrollLeft=function(){},gr.prototype.setScrollTop=function(){},gr.prototype.clear=function(){};var xr={native:mr,null:gr};function br(n){if(n.display.scrollbars){n.display.scrollbars.clear();if(n.display.scrollbars.addClass){L(n.display.wrapper,n.display.scrollbars.addClass)}}n.display.scrollbars=new xr[n.options.scrollbarStyle](function(e){n.display.wrapper.insertBefore(e,n.display.scrollbarFiller);pe(e,"mousedown",function(){if(n.state.focused){setTimeout(function(){return n.display.input.focus()},0)}});e.setAttribute("cm-not-content","true")},function(e,t){if(t=="horizontal"){hr(n,e)}else{fr(n,e)}},n);if(n.display.scrollbars.addClass){F(n.display.wrapper,n.display.scrollbars.addClass)}}var wr=0;function Cr(e){e.curOp={cm:e,viewChanged:false,startHeight:e.doc.height,forceUpdate:false,updateInput:0,typing:false,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:false,updateMaxLine:false,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:false,id:++wr};Sn(e.curOp)}function kr(e){var t=e.curOp;if(t){En(t,function(e){for(var t=0;t=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping;e.update=e.mustUpdate&&new zr(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Er(e){e.updatedDisplay=e.mustUpdate&&Wr(e.cm,e.update)}function Mr(e){var t=e.cm,n=t.display;if(e.updatedDisplay){Zi(t)}e.barMeasure=pr(t);if(n.maxLineChanged&&!t.options.lineWrapping){e.adjustWidthTo=Jn(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+Gn(t)+t.display.barWidth);e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Xn(t))}if(e.updatedDisplay||e.selectionChanged){e.preparedSelection=n.input.prepareSelection()}}function Tr(e){var t=e.cm;if(e.adjustWidthTo!=null){t.display.sizer.style.minWidth=e.adjustWidthTo+"px";if(e.maxScrollLeft=l.display.viewTo){return}var c=+new Date+l.options.workTime;var f=yt(l,u.highlightFrontier);var d=[];u.iter(f.line,Math.min(u.first+u.size,l.display.viewTo+500),function(e){if(f.line>=l.display.viewFrom){var t=e.styles;var n=e.text.length>l.options.maxHighlightLength?qe(u.mode,f.state):null;var i=gt(l,e,f,true);if(n){f.state=n}e.styles=i.styles;var r=e.styleClasses,o=i.classes;if(o){e.styleClasses=o}else if(r){e.styleClasses=null}var a=!t||t.length!=e.styles.length||r!=o&&(!r||!o||r.bgClass!=o.bgClass||r.textClass!=o.textClass);for(var s=0;!a&&sc){Ir(l,l.options.workDelay);return true}});u.highlightFrontier=f.line;u.modeFrontier=Math.max(u.modeFrontier,f.line);if(d.length){Ar(l,function(){for(var e=0;e=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&_i(e)==0){return false}if(Gr(e)){$i(e);t.dims=Ai(e)}var r=i.first+i.size;var o=Math.max(t.visible.from-e.options.viewportMargin,i.first);var a=Math.min(r,t.visible.to+e.options.viewportMargin);if(n.viewFroma&&n.viewTo-a<20){a=Math.min(r,n.viewTo)}if(Dt){o=en(e.doc,o);a=tn(e.doc,a)}var s=o!=n.viewFrom||a!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Wi(e,o,a);n.viewOffset=on(Ke(e.doc,n.viewFrom));e.display.mover.style.top=n.viewOffset+"px";var l=_i(e);if(!s&&l==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)){return false}var u=$r(e);if(l>4){n.lineDiv.style.display="none"}jr(e,n.updateLineNumbers,t.dims);if(l>4){n.lineDiv.style.display=""}n.renderedView=n.view;Hr(u);M(n.cursorDiv);M(n.selectionDiv);n.gutters.style.height=n.sizer.style.minHeight=0;if(s){n.lastWrapHeight=t.wrapperHeight;n.lastWrapWidth=t.wrapperWidth;Ir(e,400)}n.updateLineNumbers=null;return true}function _r(e,t){var n=t.viewport;for(var i=true;;i=false){if(!i||!e.options.lineWrapping||t.oldDisplayWidth==Xn(e)){if(n&&n.top!=null){n={top:Math.min(e.doc.height+Yn(e.display)-Vn(e),n.top)}}t.visible=er(e.display,e.doc,n);if(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo){break}}if(!Wr(e,t)){break}Zi(e);var r=pr(e);Ri(e);vr(e,r);Yr(e,r);t.force=false}t.signal(e,"update",e);if(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 Rr(e,t){var n=new zr(e,t);if(Wr(e,n)){Zi(e);_r(e,n);var i=pr(e);Ri(e);vr(e,i);Yr(e,i);n.finish()}}function jr(n,e,t){var i=n.display,r=n.options.lineNumbers;var o=i.lineDiv,a=o.firstChild;function s(e){var t=e.nextSibling;if(g&&y&&n.display.currentWheelTarget==e){e.style.display="none"}else{e.parentNode.removeChild(e)}return t}var l=i.view,u=i.viewFrom;for(var c=0;c-1){h=false}An(n,f,u,t)}if(h){M(f.lineNumber);f.lineNumber.appendChild(document.createTextNode(it(n.options,u)))}a=f.node.nextSibling}u+=f.size}while(a){a=s(a)}}function Ur(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Yr(e,t){e.display.sizer.style.minHeight=t.docHeight+"px";e.display.heightForcer.style.top=t.docHeight+"px";e.display.gutters.style.height=t.docHeight+e.display.barHeight+Gn(e)+"px"}function qr(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter)){return}var i=Ni(t)-t.scroller.scrollLeft+e.doc.scrollLeft;var r=t.gutters.offsetWidth,o=i+"px";for(var a=0;aa.clientWidth;var l=a.scrollHeight>a.clientHeight;if(!(i&&s||r&&l)){return}if(r&&y&&g){e:for(var u=t.target,c=o.view;u!=a;u=u.parentNode){for(var f=0;f=0&&ot(e,i.to())<=0){return n}}return-1};var ro=function(e,t){this.anchor=e;this.head=t};function oo(e,t,n){var i=e&&e.options.selectionsMayTouch;var r=t[n];t.sort(function(e,t){return ot(e.from(),t.from())});n=W(t,r);for(var o=1;o0:l>=0){var u=ut(s.from(),a.from()),c=lt(s.to(),a.to());var f=s.empty()?a.from()==a.head:s.from()==s.head;if(o<=n){--n}t.splice(--o,2,new ro(f?c:u,f?u:c))}}return new io(t,n)}function ao(e,t){return new io([new ro(e,t||e)],0)}function so(e){if(!e.text){return e.to}return rt(e.from.line+e.text.length-1,V(e.text).length+(e.text.length==1?e.from.ch:0))}function lo(e,t){if(ot(e,t.from)<0){return e}if(ot(e,t.to)<=0){return so(t)}var n=e.line+t.text.length-(t.to.line-t.from.line)-1,i=e.ch;if(e.line==t.to.line){i+=so(t).ch-t.to.ch}return rt(n,i)}function uo(e,t){var n=[];for(var i=0;i1){e.remove(s.line+1,p-1)}e.insert(s.line+1,v)}Tn(e,"change",e,i)}function vo(e,a,s){function l(e,t,n){if(e.linked){for(var i=0;i1&&!e.done[e.done.length-2].ranges){e.done.pop();return V(e.done)}}function Lo(e,t,n,i){var r=e.history;r.undone.length=0;var o=+new Date,a;var s;if((r.lastOp==i||r.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&r.lastModTime>o-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(a=So(r,r.lastOp==i))){s=V(a.changes);if(ot(t.from,t.to)==0&&ot(t.from,s.to)==0){s.to=so(t)}else{a.changes.push(Co(e,t))}}else{var l=V(r.done);if(!l||!l.ranges){To(e.sel,r.done)}a={changes:[Co(e,t)],generation:r.generation};r.done.push(a);while(r.done.length>r.undoDepth){r.done.shift();if(!r.done[0].ranges){r.done.shift()}}}r.done.push(n);r.generation=++r.maxGeneration;r.lastModTime=r.lastSelTime=o;r.lastOp=r.lastSelOp=i;r.lastOrigin=r.lastSelOrigin=t.origin;if(!s){ve(e,"historyAdded")}}function Eo(e,t,n,i){var r=t.charAt(0);return r=="*"||r=="+"&&n.ranges.length==i.ranges.length&&n.somethingSelected()==i.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function Mo(e,t,n,i){var r=e.history,o=i&&i.origin;if(n==r.lastSelOp||o&&r.lastSelOrigin==o&&(r.lastModTime==r.lastSelTime&&r.lastOrigin==o||Eo(e,o,V(r.done),t))){r.done[r.done.length-1]=t}else{To(t,r.done)}r.lastSelTime=+new Date;r.lastSelOrigin=o;r.lastSelOp=n;if(i&&i.clearRedo!==false){ko(r.undone)}}function To(e,t){var n=V(t);if(!(n&&n.ranges&&n.equals(e))){t.push(e)}}function Do(t,n,e,i){var r=n["spans_"+t.id],o=0;t.iter(Math.max(t.first,e),Math.min(t.first+t.size,i),function(e){if(e.markedSpans){(r||(r=n["spans_"+t.id]={}))[o]=e.markedSpans}++o})}function Ao(e){if(!e){return null}var t;for(var n=0;n-1){V(s)[f]=u[f];delete u[f]}}}}}}return i}function Io(e,t,n,i){if(i){var r=e.anchor;if(n){var o=ot(t,r)<0;if(o!=ot(n,r)<0){r=t;t=n}else if(o!=ot(t,n)<0){t=n}}return new ro(r,t)}else{return new ro(n||t,t)}}function Po(e,t,n,i,r){if(r==null){r=e.cm&&(e.cm.display.shift||e.extend)}_o(e,new io([Io(e.sel.primary(),t,n,r)],0),i)}function zo(e,t,n){var i=[];var r=e.cm&&(e.cm.display.shift||e.extend);for(var o=0;o=t.ch:s.to>t.ch))){if(r){ve(l,"beforeCursorEnter");if(l.explicitlyCleared){if(!o.markedSpans){break}else{--a;continue}}}if(!l.atomic){continue}if(n){var f=l.find(i<0?1:-1),d=void 0;if(i<0?c:u){f=Xo(e,f,-i,f&&f.line==t.line?o:null)}if(f&&f.line==t.line&&(d=ot(f,n))&&(i<0?d<0:d>0)){return qo(e,f,t,i,r)}}var h=l.find(i<0?-1:1);if(i<0?u:c){h=Xo(e,h,i,h.line==t.line?o:null)}return h?qo(e,h,t,i,r):null}}}return t}function Go(e,t,n,i,r){var o=i||1;var a=qo(e,t,n,o,r)||!r&&qo(e,t,n,o,true)||qo(e,t,n,-o,r)||!r&&qo(e,t,n,-o,true);if(!a){e.cantEdit=true;return rt(e.first,0)}return a}function Xo(e,t,n,i){if(n<0&&t.ch==0){if(t.line>e.first){return ft(e,rt(t.line-1))}else{return null}}else if(n>0&&t.ch==(i||Ke(e,t.line)).text.length){if(t.line=0;--r){Zo(e,{from:i[r].from,to:i[r].to,text:r?[""]:t.text,origin:t.origin})}}else{Zo(e,t)}}function Zo(e,n){if(n.text.length==1&&n.text[0]==""&&ot(n.from,n.to)==0){return}var t=uo(e,n);Lo(e,n,t,e.cm?e.cm.curOp.id:NaN);ta(e,n,t,$t(e,n));var i=[];vo(e,function(e,t){if(!t&&W(i,e.history)==-1){aa(e.history,n);i.push(e.history)}ta(e,n,null,$t(e,n))})}function Jo(r,o,e){var t=r.cm&&r.cm.state.suppressEdits;if(t&&!e){return}var n=r.history,a,i=r.sel;var s=o=="undo"?n.done:n.undone,l=o=="undo"?n.undone:n.done;var u=0;for(;u=0;--h){var p=d(h);if(p)return p.v}}function ea(e,t){if(t==0){return}e.first+=t;e.sel=new io(K(e.sel.ranges,function(e){return new ro(rt(e.anchor.line+t,e.anchor.ch),rt(e.head.line+t,e.head.ch))}),e.sel.primIndex);if(e.cm){zi(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,i=n.viewFrom;ie.lastLine()){return}if(t.from.lineo){t={from:t.from,to:rt(o,Ke(e,o).text.length),text:[t.text[0]],origin:t.origin}}t.removed=Qe(e,t.from,t.to);if(!n){n=uo(e,t)}if(e.cm){na(e.cm,t,i)}else{go(e,t,i)}Ro(e,n,j);if(e.cantEdit&&Go(e,rt(e.firstLine(),0))){e.cantEdit=false}}function na(e,t,n){var i=e.doc,r=e.display,o=t.from,a=t.to;var s=false,l=o.line;if(!e.options.lineWrapping){l=et(Qt(Ke(i,o.line)));i.iter(l,a.line+1,function(e){if(e==r.maxLine){s=true;return true}})}if(i.sel.contains(t.from,t.to)>-1){xe(e)}go(i,t,n,Oi(e));if(!e.options.lineWrapping){i.iter(l,o.line+t.text.length,function(e){var t=an(e);if(t>r.maxLineLength){r.maxLine=e;r.maxLineLength=t;r.maxLineChanged=true;s=false}});if(s){e.curOp.updateMaxLine=true}}Mt(i,o.line);Ir(e,400);var u=t.text.length-(a.line-o.line)-1;if(t.full){zi(e)}else if(o.line==a.line&&t.text.length==1&&!mo(e.doc,t)){Bi(e,o.line,"text")}else{zi(e,o.line,a.line+1,u)}var c=be(e,"changes"),f=be(e,"change");if(f||c){var d={from:o,to:a,text:t.text,removed:t.removed,origin:t.origin};if(f){Tn(e,"change",e,d)}if(c){(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(d)}}e.display.selForContextMenu=null}function ia(e,t,n,i,r){var o;if(!i){i=n}if(ot(i,n)<0){o=[i,n],n=o[0],i=o[1]}if(typeof t=="string"){t=e.splitLines(t)}Qo(e,{from:n,to:i,text:t,origin:r})}function ra(e,t,n,i){if(n1||!(this.children[0]instanceof la))){var s=[];this.collapse(s);this.children=[new la(s)];this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){var a=r.lines.length%25+25;for(var s=a;s10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var i=0;i0||a==0&&o.clearWhenEmpty!==false){return o}if(o.replacedWith){o.collapsed=true;o.widgetNode=D("span",[o.replacedWith],"CodeMirror-widget");if(!e.handleMouseEvents){o.widgetNode.setAttribute("cm-ignore-events","true")}if(e.insertLeft){o.widgetNode.insertLeft=true}}if(o.collapsed){if(Kt(t,n.line,n,i,o)||n.line!=i.line&&Kt(t,i.line,n,i,o)){throw new Error("Inserting collapsed marker partially overlapping an existing one")}Nt()}if(o.addToHistory){Lo(t,{from:n,to:i,origin:"markText"},t.sel,NaN)}var s=n.line,l=t.cm,u;t.iter(s,i.line+1,function(e){if(l&&o.collapsed&&!l.options.lineWrapping&&Qt(e)==l.display.maxLine){u=true}if(o.collapsed&&s!=n.line){Je(e,0)}Pt(e,new Ot(o,s==n.line?n.ch:null,s==i.line?i.ch:null));++s});if(o.collapsed){t.iter(n.line,i.line+1,function(e){if(nn(t,e)){Je(e,0)}})}if(o.clearOnEnter){pe(o,"beforeCursorEnter",function(){return o.clear()})}if(o.readOnly){At();if(t.history.done.length||t.history.undone.length){t.clearHistory()}}if(o.collapsed){o.id=++ha;o.atomic=true}if(l){if(u){l.curOp.updateMaxLine=true}if(o.collapsed){zi(l,n.line,i.line+1)}else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title){for(var c=n.line;c<=i.line;c++){Bi(l,c,"text")}}if(o.atomic){Uo(l.doc)}Tn(l,"markerAdded",l,o)}return o}pa.prototype.clear=function(){if(this.explicitlyCleared){return}var e=this.doc.cm,t=e&&!e.curOp;if(t){Cr(e)}if(be(this,"clear")){var n=this.find();if(n){Tn(this,"clear",n.from,n.to)}}var i=null,r=null;for(var o=0;oe.display.maxLineLength){e.display.maxLine=u;e.display.maxLineLength=c;e.display.maxLineChanged=true}}}if(i!=null&&e&&this.collapsed){zi(e,i,r+1)}this.lines.length=0;this.explicitlyCleared=true;if(this.atomic&&this.doc.cantEdit){this.doc.cantEdit=false;if(e){Uo(e.doc)}}if(e){Tn(e,"markerCleared",e,this,i,r)}if(t){kr(e)}if(this.parent){this.parent.clear()}},pa.prototype.find=function(e,t){if(e==null&&this.type=="bookmark"){e=1}var n,i;for(var r=0;r=0;l--){Qo(this,i[l])}if(s){Wo(this,s)}else if(this.cm){ar(this.cm)}}),undo:Fr(function(){Jo(this,"undo")}),redo:Fr(function(){Jo(this,"redo")}),undoSelection:Fr(function(){Jo(this,"undo",true)}),redoSelection:Fr(function(){Jo(this,"redo",true)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){var e=this.history,t=0,n=0;for(var i=0;i=e.ch)){t.push(r.marker.parent||r.marker)}}}return t},findMarks:function(r,o,a){r=ft(this,r);o=ft(this,o);var s=[],l=r.line;this.iter(r.line,o.line+1,function(e){var t=e.markedSpans;if(t){for(var n=0;n=i.to||i.from==null&&l!=r.line||i.from!=null&&l==o.line&&i.from>=o.ch)&&(!a||a(i.marker))){s.push(i.marker.parent||i.marker)}}}++l});return s},getAllMarks:function(){var i=[];this.iter(function(e){var t=e.markedSpans;if(t){for(var n=0;nn){i=n;return true}n-=t;++r});return ft(this,rt(r,i))},indexFromPos:function(e){e=ft(this,e);var t=e.ch;if(e.linet){t=e.from}if(e.to!=null&&e.to-1){i.state.draggingText(e);setTimeout(function(){return i.display.input.focus()},20);return}try{var c=e.dataTransfer.getData("Text");if(c){var f;if(i.state.draggingText&&!i.state.draggingText.copy){f=i.listSelections()}Ro(i.doc,ao(t,t));if(f){for(var d=0;d=0;e--){ia(t.doc,"",i[e].from,i[e].to,"+delete")}ar(t)})}function qa(e,t,n){var i=ae(e.text,t+n,n);return i<0||i>e.text.length?null:i}function Ga(e,t,n){var i=qa(e,t.ch,n);return i==null?null:new rt(t.line,i,n<0?"after":"before")}function Xa(e,t,n,i,r){if(e){if(t.doc.direction=="rtl"){r=-r}var o=de(n,t.doc.direction);if(o){var a=r<0?V(o):o[0];var s=r<0==(a.level==1);var l=s?"after":"before";var u;if(a.level>0||t.doc.direction=="rtl"){var c=ti(t,n);u=r<0?n.text.length-1:0;var f=ni(t,c,u).top;u=se(function(e){return ni(t,c,e).top==f},r<0==(a.level==1)?a.from:a.to-1,u);if(l=="before"){u=qa(n,u,1)}}else{u=r<0?a.to:a.from}return new rt(i,u,l)}}return new rt(i,r<0?n.text.length:0,r<0?"before":"after")}function Va(t,n,s,e){var l=de(n,t.doc.direction);if(!l){return Ga(n,s,e)}if(s.ch>=n.text.length){s.ch=n.text.length;s.sticky="before"}else if(s.ch<=0){s.ch=0;s.sticky="after"}var i=ce(l,s.ch,s.sticky),r=l[i];if(t.doc.direction=="ltr"&&r.level%2==0&&(e>0?r.to>s.ch:r.from=r.from&&d>=c.begin:d<=r.to&&d<=c.end)){var h=f?"before":"after";return new rt(s.line,d,h)}}var p=function(e,t,n){var i=function(e,t){return t?new rt(s.line,u(e,1),"before"):new rt(s.line,e,"after")};for(;e>=0&&e0==(r.level!=1);var a=o?n.begin:u(n.end,-1);if(r.from<=a&&a0?c.end:u(c.begin,-1);if(g!=null&&!(e>0&&g==n.text.length)){m=p(e>0?0:l.length-1,e,a(g));if(m){return m}}return null}Ba.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},Ba.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},Ba.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},Ba.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},Ba["default"]=y?Ba.macDefault:Ba.pcDefault;var Ka={selectAll:Vo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),j)},killLine:function(n){return Ya(n,function(e){if(e.empty()){var t=Ke(n.doc,e.head.line).text.length;if(e.head.ch==t&&e.head.line0){i=new rt(i.line,i.ch+1);a.replaceRange(r.charAt(i.ch-1)+r.charAt(i.ch-2),rt(i.line,i.ch-2),i,"+transpose")}else if(i.line>a.doc.first){var o=Ke(a.doc,i.line-1).text;if(o){i=new rt(i.line,1);a.replaceRange(r.charAt(0)+a.doc.lineSeparator()+o.charAt(o.length-1),rt(i.line-1,o.length-1),i,"+transpose")}}}t.push(new ro(i,i))}a.setSelections(t)})},newlineAndIndent:function(i){return Ar(i,function(){var e=i.listSelections();for(var t=e.length-1;t>=0;t--){i.replaceRange(i.doc.lineSeparator(),e[t].anchor,e[t].head,"+input")}e=i.listSelections();for(var n=0;n-1&&(ot((a=o.ranges[a]).from(),t)<0||t.xRel>0)&&(ot(a.to(),t)>0||t.xRel<0)){ws(e,i,t,r)}else{ks(e,i,t,r)}}function ws(t,n,i,r){var o=t.display,a=false;var s=Nr(t,function(e){if(g){o.scroller.draggable=false}t.state.draggingText=false;ge(o.wrapper.ownerDocument,"mouseup",s);ge(o.wrapper.ownerDocument,"mousemove",l);ge(o.scroller,"dragstart",u);ge(o.scroller,"drop",s);if(!a){Ce(e);if(!r.addNew){Po(t.doc,i,null,null,r.extend)}if(g||w&&C==9){setTimeout(function(){o.wrapper.ownerDocument.body.focus();o.input.focus()},20)}else{o.input.focus()}}});var l=function(e){a=a||Math.abs(n.clientX-e.clientX)+Math.abs(n.clientY-e.clientY)>=10};var u=function(){return a=true};if(g){o.scroller.draggable=true}t.state.draggingText=s;s.copy=!r.moveOnDrag;if(o.scroller.dragDrop){o.scroller.dragDrop()}pe(o.wrapper.ownerDocument,"mouseup",s);pe(o.wrapper.ownerDocument,"mousemove",l);pe(o.scroller,"dragstart",u);pe(o.scroller,"drop",s);Vi(t);setTimeout(function(){return o.input.focus()},20)}function Cs(e,t,n){if(n=="char"){return new ro(t,t)}if(n=="word"){return e.findWordAt(t)}if(n=="line"){return new ro(rt(t.line,0),ft(e.doc,rt(t.line+1,0)))}var i=n(e,t);return new ro(i.from,i.to)}function ks(g,e,v,y){var o=g.display,x=g.doc;Ce(e);var b,w,C=x.sel,t=C.ranges;if(y.addNew&&!y.extend){w=x.sel.contains(v);if(w>-1){b=t[w]}else{b=new ro(v,v)}}else{b=x.sel.primary();w=x.sel.primIndex}if(y.unit=="rectangle"){if(!y.addNew){b=new ro(v,v)}v=Ii(g,e,true,true);w=-1}else{var n=Cs(g,v,y.unit);if(y.extend){b=Io(b,n.anchor,n.head,y.extend)}else{b=n}}if(!y.addNew){w=0;_o(x,new io([b],0),U);C=x.sel}else if(w==-1){w=t.length;_o(x,oo(g,t.concat([b]),w),{scroll:false,origin:"*mouse"})}else if(t.length>1&&t[w].empty()&&y.unit=="char"&&!y.extend){_o(x,oo(g,t.slice(0,w).concat(t.slice(w+1)),0),{scroll:false,origin:"*mouse"});C=x.sel}else{Bo(x,w,b,U)}var k=v;function a(e){if(ot(k,e)==0){return}k=e;if(y.unit=="rectangle"){var t=[],n=g.options.tabSize;var i=$(Ke(x,v.line).text,v.ch,n);var r=$(Ke(x,e.line).text,e.ch,n);var o=Math.min(i,r),a=Math.max(i,r);for(var s=Math.min(v.line,e.line),l=Math.min(g.lastLine(),Math.max(v.line,e.line));s<=l;s++){var u=Ke(x,s).text,c=q(u,o,n);if(o==a){t.push(new ro(rt(s,c),rt(s,c)))}else if(u.length>c){t.push(new ro(rt(s,c),rt(s,q(u,a,n))))}}if(!t.length){t.push(new ro(v,v))}_o(x,oo(g,C.ranges.slice(0,w).concat(t),w),{origin:"*mouse",scroll:false});g.scrollIntoView(e)}else{var f=b;var d=Cs(g,e,y.unit);var h=f.anchor,p;if(ot(d.anchor,h)>0){p=d.head;h=ut(f.from(),d.anchor)}else{p=d.anchor;h=lt(f.to(),d.head)}var m=C.ranges.slice(0);m[w]=Ss(g,new ro(ft(x,h),p));_o(x,oo(g,m,w),U)}}var s=o.wrapper.getBoundingClientRect();var l=0;function u(e){var t=++l;var n=Ii(g,e,true,y.unit=="rectangle");if(!n){return}if(ot(n,k)!=0){g.curOp.focus=O();a(n);var i=er(o,x);if(n.line>=i.to||n.lines.bottom?20:0;if(r){setTimeout(Nr(g,function(){if(l!=t){return}o.scroller.scrollTop+=r;u(e)}),50)}}}function i(e){g.state.selectingText=false;l=Infinity;if(e){Ce(e);o.input.focus()}ge(o.wrapper.ownerDocument,"mousemove",r);ge(o.wrapper.ownerDocument,"mouseup",c);x.history.lastSelOrigin=null}var r=Nr(g,function(e){if(e.buttons===0||!Me(e)){i(e)}else{u(e)}});var c=Nr(g,i);g.state.selectingText=c;pe(o.wrapper.ownerDocument,"mousemove",r);pe(o.wrapper.ownerDocument,"mouseup",c)}function Ss(e,t){var n=t.anchor;var i=t.head;var r=Ke(e.doc,n.line);if(ot(n,i)==0&&n.sticky==i.sticky){return t}var o=de(r);if(!o){return t}var a=ce(o,n.ch,n.sticky),s=o[a];if(s.from!=n.ch&&s.to!=n.ch){return t}var l=a+(s.from==n.ch==(s.level!=1)?0:1);if(l==0||l==o.length){return t}var u;if(i.line!=n.line){u=(i.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0}else{var c=ce(o,i.ch,i.sticky);var f=c-a||(i.ch-n.ch)*(s.level==1?-1:1);if(c==l-1||c==l){u=f<0}else{u=f>0}}var d=o[l+(u?-1:0)];var h=u==(d.level==1);var p=h?d.from:d.to,m=h?"after":"before";return n.ch==p&&n.sticky==m?t:new ro(new rt(n.line,p,m),i)}function Ls(e,t,n,i){var r,o;if(t.touches){r=t.touches[0].clientX;o=t.touches[0].clientY}else{try{r=t.clientX;o=t.clientY}catch(t){return false}}if(r>=Math.floor(e.display.gutters.getBoundingClientRect().right)){return false}if(i){Ce(t)}var a=e.display;var s=a.lineDiv.getBoundingClientRect();if(o>s.bottom||!be(e,n)){return Se(t)}o-=s.top-a.viewOffset;for(var l=0;l=r){var c=tt(e.doc,o);var f=e.display.gutterSpecs[l];ve(e,n,e,c,f.className,t);return Se(t)}}}function Es(e,t){return Ls(e,t,"gutterClick",true)}function Ms(e,t){if(jn(e.display,t)||Ts(e,t)){return}if(ye(e,t,"contextmenu")){return}if(!k){e.display.input.onContextMenu(t)}}function Ts(e,t){if(!be(e,"gutterContextMenu")){return false}return Ls(e,t,"gutterContextMenu",false)}function Ds(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-");fi(e)}hs.prototype.compare=function(e,t,n){return this.time+ds>e&&ot(t,this.pos)==0&&n==this.button};var As={toString:function(){return"CodeMirror.Init"}},Ns={},Os={};function Fs(r){var o=r.optionHandlers;function e(e,t,i,n){r.defaults[e]=t;if(i){o[e]=n?function(e,t,n){if(n!=As){i(e,t,n)}}:i}}r.defineOption=e;r.Init=As;e("value","",function(e,t){return e.setValue(t)},true);e("mode",null,function(e,t){e.doc.modeOption=t;ho(e)},true);e("indentUnit",2,ho,true);e("indentWithTabs",false);e("smartIndent",true);e("tabSize",4,function(e){po(e);fi(e);zi(e)},true);e("lineSeparator",null,function(e,i){e.doc.lineSep=i;if(!i){return}var r=[],o=e.doc.first;e.doc.iter(function(e){for(var t=0;;){var n=e.text.indexOf(i,t);if(n==-1){break}t=n+i.length;r.push(rt(o,n))}o++});for(var t=r.length-1;t>=0;t--){ia(e.doc,i,r[t],rt(r[t].line,r[t].ch+i.length))}});e("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(e,t,n){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g");if(n!=As){e.refresh()}});e("specialCharPlaceholder",mn,function(e){return e.refresh()},true);e("electricChars",true);e("inputStyle",d?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},true);e("spellcheck",false,function(e,t){return e.getInputField().spellcheck=t},true);e("autocorrect",false,function(e,t){return e.getInputField().autocorrect=t},true);e("autocapitalize",false,function(e,t){return e.getInputField().autocapitalize=t},true);e("rtlMoveVisually",!p);e("wholeLineUpdateBefore",true);e("theme","default",function(e){Ds(e);Kr(e)},true);e("keyMap","default",function(e,t,n){var i=Ua(t);var r=n!=As&&Ua(n);if(r&&r.detach){r.detach(e,i)}if(i.attach){i.attach(e,r||null)}});e("extraKeys",null);e("configureMouse",null);e("lineWrapping",false,Ps,true);e("gutters",[],function(e,t){e.display.gutterSpecs=Xr(t,e.options.lineNumbers);Kr(e)},true);e("fixedGutter",true,function(e,t){e.display.gutters.style.left=t?Ni(e.display)+"px":"0";e.refresh()},true);e("coverGutterNextToScrollbar",false,function(e){return vr(e)},true);e("scrollbarStyle","native",function(e){br(e);vr(e);e.display.scrollbars.setScrollTop(e.doc.scrollTop);e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},true);e("lineNumbers",false,function(e,t){e.display.gutterSpecs=Xr(e.options.gutters,t);Kr(e)},true);e("firstLineNumber",1,Kr,true);e("lineNumberFormatter",function(e){return e},Kr,true);e("showCursorWhenSelecting",false,Ri,true);e("resetSelectionOnContextMenu",true);e("lineWiseCopyCut",true);e("pasteLinesPerSelection",true);e("selectionsMayTouch",false);e("readOnly",false,function(e,t){if(t=="nocursor"){Qi(e);e.display.input.blur()}e.display.input.readOnlyChanged(t)});e("disableInput",false,function(e,t){if(!t){e.display.input.reset()}},true);e("dragDrop",true,Is);e("allowDropFileTypes",null);e("cursorBlinkRate",530);e("cursorScrollMargin",0);e("cursorHeight",1,Ri,true);e("singleCursorHeightPerLine",true,Ri,true);e("workTime",100);e("workDelay",100);e("flattenSpans",true,po,true);e("addModeClass",false,po,true);e("pollInterval",100);e("undoDepth",200,function(e,t){return e.doc.history.undoDepth=t});e("historyEventDelay",1250);e("viewportMargin",10,function(e){return e.refresh()},true);e("maxHighlightLength",1e4,po,true);e("moveInputWithCursor",true,function(e,t){if(!t){e.display.input.resetPosition()}});e("tabindex",null,function(e,t){return e.display.input.getField().tabIndex=t||""});e("autofocus",null);e("direction","ltr",function(e,t){return e.doc.setDirection(t)},true);e("phrases",null)}function Is(e,t,n){var i=n&&n!=As;if(!t!=!i){var r=e.display.dragFunctions;var o=t?pe:ge;o(e.display.scroller,"dragstart",r.start);o(e.display.scroller,"dragenter",r.enter);o(e.display.scroller,"dragover",r.over);o(e.display.scroller,"dragleave",r.leave);o(e.display.scroller,"drop",r.drop)}}function Ps(e){if(e.options.lineWrapping){F(e.display.wrapper,"CodeMirror-wrap");e.display.sizer.style.minWidth="";e.display.sizerWidth=null}else{L(e.display.wrapper,"CodeMirror-wrap");sn(e)}Fi(e);zi(e);fi(e);setTimeout(function(){return vr(e)},100)}function zs(e,t){var n=this;if(!(this instanceof zs)){return new zs(e,t)}this.options=t=t?B(t):{};B(Ns,t,false);var i=t.value;if(typeof i=="string"){i=new Ca(i,t.mode,null,t.lineSeparator,t.direction)}else if(t.mode){i.modeOption=t.mode}this.doc=i;var r=new zs.inputStyles[t.inputStyle](this);var o=this.display=new Qr(e,i,r,t);o.wrapper.CodeMirror=this;Ds(this);if(t.lineWrapping){this.display.wrapper.className+=" CodeMirror-wrap"}br(this);this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:false,delayingBlurEvent:false,focused:false,suppressEdits:false,pasteIncoming:-1,cutIncoming:-1,selectingText:false,draggingText:false,highlight:new H,keySeq:null,specialChars:null};if(t.autofocus&&!d){o.input.focus()}if(w&&C<11){setTimeout(function(){return n.display.input.reset(true)},20)}Bs(this);Aa();Cr(this);this.curOp.forceUpdate=true;yo(this,i);if(t.autofocus&&!d||this.hasFocus()){setTimeout(z(Ki,this),20)}else{Qi(this)}for(var a in Os){if(Os.hasOwnProperty(a)){Os[a](this,t[a],As)}}Gr(this);if(t.finishInit){t.finishInit(this)}for(var s=0;s<$s.length;++s){$s[s](this)}kr(this);if(g&&t.lineWrapping&&getComputedStyle(o.lineDiv).textRendering=="optimizelegibility"){o.lineDiv.style.textRendering="auto"}}function Bs(r){var o=r.display;pe(o.scroller,"mousedown",Nr(r,vs));if(w&&C<11){pe(o.scroller,"dblclick",Nr(r,function(e){if(ye(r,e)){return}var t=Ii(r,e);if(!t||Es(r,e)||jn(r.display,e)){return}Ce(e);var n=r.findWordAt(t);Po(r.doc,n.anchor,n.head)}))}else{pe(o.scroller,"dblclick",function(e){return ye(r,e)||Ce(e)})}pe(o.scroller,"contextmenu",function(e){return Ms(r,e)});pe(o.input.getField(),"contextmenu",function(e){if(!o.scroller.contains(e.target)){Ms(r,e)}});var n,i={end:0};function a(){if(o.activeTouch){n=setTimeout(function(){return o.activeTouch=null},1e3);i=o.activeTouch;i.end=+new Date}}function s(e){if(e.touches.length!=1){return false}var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}function l(e,t){if(t.left==null){return true}var n=t.left-e.left,i=t.top-e.top;return n*n+i*i>20*20}pe(o.scroller,"touchstart",function(e){if(!ye(r,e)&&!s(e)&&!Es(r,e)){o.input.ensurePolled();clearTimeout(n);var t=+new Date;o.activeTouch={start:t,moved:false,prev:t-i.end<=300?i:null};if(e.touches.length==1){o.activeTouch.left=e.touches[0].pageX;o.activeTouch.top=e.touches[0].pageY}}});pe(o.scroller,"touchmove",function(){if(o.activeTouch){o.activeTouch.moved=true}});pe(o.scroller,"touchend",function(e){var t=o.activeTouch;if(t&&!jn(o,e)&&t.left!=null&&!t.moved&&new Date-t.start<300){var n=r.coordsChar(o.activeTouch,"page"),i;if(!t.prev||l(t,t.prev)){i=new ro(n,n)}else if(!t.prev.prev||l(t,t.prev.prev)){i=r.findWordAt(n)}else{i=new ro(rt(n.line,0),ft(r.doc,rt(n.line+1,0)))}r.setSelection(i.anchor,i.head);r.focus();Ce(e)}a()});pe(o.scroller,"touchcancel",a);pe(o.scroller,"scroll",function(){if(o.scroller.clientHeight){fr(r,o.scroller.scrollTop);hr(r,o.scroller.scrollLeft,true);ve(r,"scroll",r)}});pe(o.scroller,"mousewheel",function(e){return no(r,e)});pe(o.scroller,"DOMMouseScroll",function(e){return no(r,e)});pe(o.wrapper,"scroll",function(){return o.wrapper.scrollTop=o.wrapper.scrollLeft=0});o.dragFunctions={enter:function(e){if(!ye(r,e)){Le(e)}},over:function(e){if(!ye(r,e)){Ea(r,e);Le(e)}},start:function(e){return La(r,e)},drop:Nr(r,Sa),leave:function(e){if(!ye(r,e)){Ma(r)}}};var e=o.input.getField();pe(e,"keyup",function(e){return cs.call(r,e)});pe(e,"keydown",Nr(r,ls));pe(e,"keypress",Nr(r,fs));pe(e,"focus",function(e){return Ki(r,e)});pe(e,"blur",function(e){return Qi(r,e)})}zs.defaults=Ns,zs.optionHandlers=Os;var $s=[];function Hs(e,t,n,i){var r=e.doc,o;if(n==null){n="add"}if(n=="smart"){if(!r.mode.indent){n="prev"}else{o=yt(e,t).state}}var a=e.options.tabSize;var s=Ke(r,t),l=$(s.text,null,a);if(s.stateAfter){s.stateAfter=null}var u=s.text.match(/^\s*/)[0],c;if(!i&&!/\S/.test(s.text)){c=0;n="not"}else if(n=="smart"){c=r.mode.indent(o,s.text.slice(u.length),s.text);if(c==R||c>150){if(!i){return}n="prev"}}if(n=="prev"){if(t>r.first){c=$(Ke(r,t-1).text,null,a)}else{c=0}}else if(n=="add"){c=l+e.options.indentUnit}else if(n=="subtract"){c=l-e.options.indentUnit}else if(typeof n=="number"){c=l+n}c=Math.max(0,c);var f="",d=0;if(e.options.indentWithTabs){for(var h=Math.floor(c/a);h;--h){d+=a;f+="\t"}}if(da;var l=Fe(t),u=null;if(s&&i.ranges.length>1){if(Ws&&Ws.text.join("\n")==t){if(i.ranges.length%Ws.text.length==0){u=[];for(var c=0;c=0;d--){var h=i.ranges[d];var p=h.from(),m=h.to();if(h.empty()){if(n&&n>0){p=rt(p.line,p.ch-n)}else if(e.state.overwrite&&!s){m=rt(m.line,Math.min(Ke(o,m.line).text.length,m.ch+V(l).length))}else if(s&&Ws&&Ws.lineWise&&Ws.text.join("\n")==t){p=m=rt(p.line,0)}}var g={from:p,to:m,text:u?u[d%u.length]:l,origin:r||(s?"paste":e.state.cutIncoming>a?"cut":"+input")};Qo(e.doc,g);Tn(e,"inputRead",e,g)}if(t&&!s){Us(e,t)}ar(e);if(e.curOp.updateInput<2){e.curOp.updateInput=f}e.curOp.typing=true;e.state.pasteIncoming=e.state.cutIncoming=-1}function js(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n){e.preventDefault();if(!t.isReadOnly()&&!t.options.disableInput){Ar(t,function(){return Rs(t,n,0,null,"paste")})}return true}}function Us(e,t){if(!e.options.electricChars||!e.options.smartIndent){return}var n=e.doc.sel;for(var i=n.ranges.length-1;i>=0;i--){var r=n.ranges[i];if(r.head.ch>100||i&&n.ranges[i-1].head.line==r.head.line){continue}var o=e.getModeAt(r.head);var a=false;if(o.electricChars){for(var s=0;s-1){a=Hs(e,r.head.line,"smart");break}}}else if(o.electricInput){if(o.electricInput.test(Ke(e.doc,r.head.line).text.slice(0,r.head.ch))){a=Hs(e,r.head.line,"smart")}}if(a){Tn(e,"electricInput",e,r.head.line)}}}function Ys(e){var t=[],n=[];for(var i=0;i0){Bo(this.doc,i,new ro(o,u[i].to()),j)}}else if(r.head.line>n){Hs(this,r.head.line,e,true);n=r.head.line;if(i==this.doc.sel.primIndex){ar(this)}}}}),getTokenAt:function(e,t){return kt(this,e,t)},getLineTokens:function(e,t){return kt(this,rt(e),t,true)},getTokenTypeAt:function(e){e=ft(this.doc,e);var t=vt(this,Ke(this.doc,e.line));var n=0,i=(t.length-1)/2,r=e.ch;var o;if(r==0){o=t[2]}else{for(;;){var a=n+i>>1;if((a?t[a*2-1]:0)>=r){i=a}else if(t[a*2+1]o){e=o;i=true}r=Ke(this.doc,e)}else{r=e}return mi(this,r,{top:0,left:0},t||"page",n||i).top+(i?this.doc.height-on(r):0)},defaultTextHeight:function(){return Ti(this.display)},defaultCharWidth:function(){return Di(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,n,i,r){var o=this.display;e=yi(this,ft(this.doc,e));var a=e.bottom,s=e.left;t.style.position="absolute";t.setAttribute("cm-ignore-events","true");this.display.input.setUneditable(t);o.sizer.appendChild(t);if(i=="over"){a=e.top}else if(i=="above"||i=="near"){var l=Math.max(o.wrapper.clientHeight,this.doc.height),u=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);if((i=="above"||e.bottom+t.offsetHeight>l)&&e.top>t.offsetHeight){a=e.top-t.offsetHeight}else if(e.bottom+t.offsetHeight<=l){a=e.bottom}if(s+t.offsetWidth>u){s=u-t.offsetWidth}}t.style.top=a+"px";t.style.left=t.style.right="";if(r=="right"){s=o.sizer.clientWidth-t.offsetWidth;t.style.right="0px"}else{if(r=="left"){s=0}else if(r=="middle"){s=(o.sizer.clientWidth-t.offsetWidth)/2}t.style.left=s+"px"}if(n){ir(this,{left:s,top:a,right:s+t.offsetWidth,bottom:a+t.offsetHeight})}},triggerOnKeyDown:Or(ls),triggerOnKeyPress:Or(fs),triggerOnKeyUp:cs,triggerOnMouseDown:Or(vs),execCommand:function(e){if(Ka.hasOwnProperty(e)){return Ka[e].call(null,this)}},triggerElectric:Or(function(e){Us(this,e)}),findPosH:function(e,t,n,i){var r=1;if(t<0){r=-1;t=-t}var o=ft(this.doc,e);for(var a=0;a0&&s(n.charAt(i-1))){--i}while(r.5){Fi(this)}ve(this,"refresh",this)}),swapDoc:Or(function(e){var t=this.doc;t.cm=null;if(this.state.selectingText){this.state.selectingText()}yo(this,e);fi(this);this.display.input.reset();sr(this,e.scrollLeft,e.scrollTop);this.curOp.forceScroll=true;Tn(this,"swapDoc",this,t);return t}),phrase:function(e){var t=this.options.phrases;return t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:e},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}};we(r);r.registerHelper=function(e,t,n){if(!u.hasOwnProperty(e)){u[e]=r[e]={_global:[]}}u[e][t]=n};r.registerGlobalHelper=function(e,t,n,i){r.registerHelper(e,t,i);u[e]._global.push({pred:n,val:i})}}function Vs(n,i,r,e,o){var t=i;var a=r;var s=Ke(n,i.line);var l=o&&n.direction=="rtl"?-r:r;function u(){var e=i.line+l;if(e=n.first+n.size){return false}i=new rt(e,i.ch,i.sticky);return s=Ke(n,e)}function c(e){var t;if(o){t=Va(n.cm,s,i,r)}else{t=Ga(s,i,r)}if(t==null){if(!e&&u()){i=Xa(o,n.cm,s,i.line,l)}else{return false}}else{i=t}return true}if(e=="char"){c()}else if(e=="column"){c(true)}else if(e=="word"||e=="group"){var f=null,d=e=="group";var h=n.cm&&n.cm.getHelper(i,"wordChars");for(var p=true;;p=false){if(r<0&&!c(!p)){break}var m=s.text.charAt(i.ch)||"\n";var g=ne(m,h)?"w":d&&m=="\n"?"n":!d||/\s/.test(m)?null:"p";if(d&&!p&&!g){g="s"}if(f&&f!=g){if(r<0){r=1;c();i.sticky="after"}break}if(g){f=g}if(r>0&&!c(!p)){break}}}var v=Go(n,i,t,a,true);if(at(t,v)){v.hitSide=true}return v}function Ks(e,t,n,i){var r=e.doc,o=t.left,a;if(i=="page"){var s=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);var l=Math.max(s-.5*Ti(e.display),3);a=(n>0?t.bottom:t.top)+n*l}else if(i=="line"){a=n>0?t.bottom+3:t.top-3}var u;for(;;){u=wi(e,o,a);if(!u.outside){break}if(n<0?a<=0:a>=r.height){u.hitSide=true;break}a+=n*5}return u}var Qs=function(e){this.cm=e;this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null;this.polling=new H;this.composing=null;this.gracePeriod=false;this.readDOMTimeout=null};function Zs(e,t){var n=ei(e,t.line);if(!n||n.hidden){return null}var i=Ke(e.doc,t.line);var r=Qn(n,i,t.line);var o=de(i,e.doc.direction),a="left";if(o){var s=ce(o,t.ch);a=s%2?"right":"left"}var l=oi(r.map,t.ch,a);l.offset=l.collapse=="right"?l.end:l.start;return l}function Js(e){for(var t=e;t;t=t.parentNode){if(/CodeMirror-gutter-wrapper/.test(t.className)){return true}}return false}function el(e,t){if(t){e.bad=true}return e}function tl(s,e,t,l,u){var n="",c=false,f=s.doc.lineSeparator(),d=false;function h(t){return function(e){return e.id==t}}function p(){if(c){n+=f;if(d){n+=f}c=d=false}}function m(e){if(e){p();n+=e}}function g(e){if(e.nodeType==1){var t=e.getAttribute("cm-text");if(t){m(t);return}var n=e.getAttribute("cm-marker"),i;if(n){var r=s.findMarks(rt(l,0),rt(u+1,0),h(+n));if(r.length&&(i=r[0].find(0))){m(Qe(s.doc,i.from,i.to).join(f))}return}if(e.getAttribute("contenteditable")=="false"){return}var o=/^(pre|div|p|li|table|br)$/i.test(e.nodeName);if(!/^br$/i.test(e.nodeName)&&e.textContent.length==0){return}if(o){p()}for(var a=0;a=t.display.viewTo||r.line=t.display.viewFrom&&Zs(t,i)||{node:s[0].measure.map[2],offset:0};var u=r.linee.firstLine()){i=rt(i.line-1,Ke(e.doc,i.line-1).length)}if(r.ch==Ke(e.doc,r.line).text.length&&r.linet.viewTo-1){return false}var o,a,s;if(i.line==t.viewFrom||(o=Pi(e,i.line))==0){a=et(t.view[0].line);s=t.view[0].node}else{a=et(t.view[o].line);s=t.view[o-1].node.nextSibling}var l=Pi(e,r.line);var u,c;if(l==t.view.length-1){u=t.viewTo-1;c=t.lineDiv.lastChild}else{u=et(t.view[l+1].line)-1;c=t.view[l+1].node.previousSibling}if(!s){return false}var f=e.doc.splitLines(tl(e,s,c,a,u));var d=Qe(e.doc,rt(a,0),rt(u,Ke(e.doc,u).text.length));while(f.length>1&&d.length>1){if(V(f)==V(d)){f.pop();d.pop();u--}else if(f[0]==d[0]){f.shift();d.shift();a++}else{break}}var h=0,p=0;var m=f[0],g=d[0],v=Math.min(m.length,g.length);while(hi.ch&&y.charCodeAt(y.length-p-1)==x.charCodeAt(x.length-p-1)){h--;p++}}f[f.length-1]=y.slice(0,y.length-p).replace(/^\u200b+/,"");f[0]=f[0].slice(h).replace(/\u200b+$/,"");var w=rt(a,h);var C=rt(u,d.length?V(d).length-p:0);if(f.length>1||f[0]||ot(w,C)){ia(e.doc,f,w,C,"+input");return true}},Qs.prototype.ensurePolled=function(){this.forceCompositionEnd()},Qs.prototype.reset=function(){this.forceCompositionEnd()},Qs.prototype.forceCompositionEnd=function(){if(!this.composing){return}clearTimeout(this.readDOMTimeout);this.composing=null;this.updateFromDOM();this.div.blur();this.div.focus()},Qs.prototype.readFromDOMSoon=function(){var e=this;if(this.readDOMTimeout!=null){return}this.readDOMTimeout=setTimeout(function(){e.readDOMTimeout=null;if(e.composing){if(e.composing.done){e.composing=null}else{return}}e.updateFromDOM()},80)},Qs.prototype.updateFromDOM=function(){var e=this;if(this.cm.isReadOnly()||!this.pollContent()){Ar(this.cm,function(){return zi(e.cm)})}},Qs.prototype.setUneditable=function(e){e.contentEditable="false"},Qs.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing){return}e.preventDefault();if(!this.cm.isReadOnly()){Nr(this.cm,Rs)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)}},Qs.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Qs.prototype.onContextMenu=function(){},Qs.prototype.resetPosition=function(){},Qs.prototype.needsContentAttribute=true;var rl=function(e){this.cm=e;this.prevInput="";this.pollingFast=false;this.polling=new H;this.hasSelection=false;this.composing=null};function ol(t,n){if((n=n?B(n):{}).value=t.value,!n.tabindex&&t.tabIndex)n.tabindex=t.tabIndex;if(!n.placeholder&&t.placeholder)n.placeholder=t.placeholder;if(null==n.autofocus){var e=O();n.autofocus=e==t||null!=t.getAttribute("autofocus")&&e==document.body}function i(){t.value=s.getValue()}var r;if(t.form)if(pe(t.form,"submit",i),!n.leaveSubmitMethodAlone){var o=t.form;r=o.submit;try{var a=o.submit=function(){i(),o.submit=r,o.submit(),o.submit=a}}catch(e){}}n.finishInit=function(e){e.save=i,e.getTextArea=function(){return t},e.toTextArea=function(){e.toTextArea=isNaN,i(),t.parentNode.removeChild(e.getWrapperElement()),t.style.display="",t.form&&(ge(t.form,"submit",i),n.leaveSubmitMethodAlone||"function"!=typeof t.form.submit||(t.form.submit=r))}},t.style.display="none";var s=zs(function(e){return t.parentNode.insertBefore(e,t.nextSibling)},n);return s}function al(e){e.off=ge,e.on=pe,e.wheelEventPixels=to,e.Doc=Ca,e.splitLines=Fe,e.countColumn=$,e.findColumn=q,e.isWordChar=te,e.Pass=R,e.signal=ve,e.Line=ln,e.changeEnd=so,e.scrollbarModel=xr,e.Pos=rt,e.cmpPos=ot,e.modes=$e,e.mimeModes=He,e.resolveMode=Re,e.getMode=je,e.modeExtensions=Ue,e.extendMode=Ye,e.copyState=qe,e.startState=Xe,e.innerMode=Ge,e.commands=Ka,e.keyMap=Ba,e.keyName=ja,e.isModifierKey=_a,e.lookupKey=Wa,e.normalizeKeyMap=Ha,e.StringStream=Ve,e.SharedTextMarker=ga,e.TextMarker=pa,e.LineWidget=ca,e.e_preventDefault=Ce,e.e_stopPropagation=ke,e.e_stop=Le,e.addClass=F,e.contains=A,e.rmClass=L,e.keyNames=Fa}rl.prototype.init=function(n){var e=this;var i=this,r=this.cm;this.createField(n);var o=this.textarea;n.wrapper.insertBefore(this.wrapper,n.wrapper.firstChild);if(c){o.style.width="0px"}pe(o,"input",function(){if(w&&C>=9&&e.hasSelection){e.hasSelection=null}i.poll()});pe(o,"paste",function(e){if(ye(r,e)||js(e,r)){return}r.state.pasteIncoming=+new Date;i.fastPoll()});function t(e){if(ye(r,e)){return}if(r.somethingSelected()){_s({lineWise:false,text:r.getSelections()})}else if(!r.options.lineWiseCopyCut){return}else{var t=Ys(r);_s({lineWise:true,text:t.text});if(e.type=="cut"){r.setSelections(t.ranges,null,j)}else{i.prevInput="";o.value=t.text.join("\n");P(o)}}if(e.type=="cut"){r.state.cutIncoming=+new Date}}pe(o,"cut",t);pe(o,"copy",t);pe(n.scroller,"paste",function(e){if(jn(n,e)||ye(r,e)){return}if(!o.dispatchEvent){r.state.pasteIncoming=+new Date;i.focus();return}var t=new Event("paste");t.clipboardData=e.clipboardData;o.dispatchEvent(t)});pe(n.lineSpace,"selectstart",function(e){if(!jn(n,e)){Ce(e)}});pe(o,"compositionstart",function(){var e=r.getCursor("from");if(i.composing){i.composing.range.clear()}i.composing={start:e,range:r.markText(e,r.getCursor("to"),{className:"CodeMirror-composing"})}});pe(o,"compositionend",function(){if(i.composing){i.poll();i.composing.range.clear();i.composing=null}})},rl.prototype.createField=function(e){this.wrapper=Gs();this.textarea=this.wrapper.firstChild},rl.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc;var i=ji(e);if(e.options.moveInputWithCursor){var r=yi(e,n.sel.primary().head,"div");var o=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect();i.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,r.top+a.top-o.top));i.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,r.left+a.left-o.left))}return i},rl.prototype.showSelection=function(e){var t=this.cm,n=t.display;T(n.cursorDiv,e.cursors);T(n.selectionDiv,e.selection);if(e.teTop!=null){this.wrapper.style.top=e.teTop+"px";this.wrapper.style.left=e.teLeft+"px"}},rl.prototype.reset=function(e){if(this.contextMenuPending||this.composing){return}var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n;if(t.state.focused){P(this.textarea)}if(w&&C>=9){this.hasSelection=n}}else if(!e){this.prevInput=this.textarea.value="";if(w&&C>=9){this.hasSelection=null}}},rl.prototype.getField=function(){return this.textarea},rl.prototype.supportsTouch=function(){return false},rl.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!d||O()!=this.textarea)){try{this.textarea.focus()}catch(e){}}},rl.prototype.blur=function(){this.textarea.blur()},rl.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},rl.prototype.receivedFocus=function(){this.slowPoll()},rl.prototype.slowPoll=function(){var e=this;if(this.pollingFast){return}this.polling.set(this.cm.options.pollInterval,function(){e.poll();if(e.cm.state.focused){e.slowPoll()}})},rl.prototype.fastPoll=function(){var t=false,n=this;n.pollingFast=true;function i(){var e=n.poll();if(!e&&!t){t=true;n.polling.set(60,i)}else{n.pollingFast=false;n.slowPoll()}}n.polling.set(20,i)},rl.prototype.poll=function(){var e=this;var t=this.cm,n=this.textarea,i=this.prevInput;if(this.contextMenuPending||!t.state.focused||Ie(n)&&!i&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq){return false}var r=n.value;if(r==i&&!t.somethingSelected()){return false}if(w&&C>=9&&this.hasSelection===r||y&&/[\uf700-\uf7ff]/.test(r)){t.display.input.reset();return false}if(t.doc.sel==t.display.selForContextMenu){var o=r.charCodeAt(0);if(o==8203&&!i){i="​"}if(o==8666){this.reset();return this.cm.execCommand("undo")}}var a=0,s=Math.min(i.length,r.length);while(a1e3||r.indexOf("\n")>-1){n.value=e.prevInput=""}else{e.prevInput=r}if(e.composing){e.composing.range.clear();e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"})}});return true},rl.prototype.ensurePolled=function(){if(this.pollingFast&&this.poll()){this.pollingFast=false}},rl.prototype.onKeyPress=function(){if(w&&C>=9){this.hasSelection=null}this.fastPoll()},rl.prototype.onContextMenu=function(e){var n=this,i=n.cm,r=i.display,o=n.textarea;if(n.contextMenuPending){n.contextMenuPending()}var t=Ii(i,e),a=r.scroller.scrollTop;if(!t||v){return}var s=i.options.resetSelectionOnContextMenu;if(s&&i.doc.sel.contains(t)==-1){Nr(i,_o)(i.doc,ao(t),j)}var l=o.style.cssText,u=n.wrapper.style.cssText;var c=n.wrapper.offsetParent.getBoundingClientRect();n.wrapper.style.cssText="position: static";o.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-c.top-5)+"px; left: "+(e.clientX-c.left-5)+"px;\n z-index: 1000; background: "+(w?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";var f;if(g){f=window.scrollY}r.input.focus();if(g){window.scrollTo(null,f)}r.input.reset();if(!i.somethingSelected()){o.value=n.prevInput=" "}n.contextMenuPending=h;r.selForContextMenu=i.doc.sel;clearTimeout(r.detectingSelectAll);function d(){if(o.selectionStart!=null){var e=i.somethingSelected();var t="​"+(e?o.value:"");o.value="⇚";o.value=t;n.prevInput=e?"":"​";o.selectionStart=1;o.selectionEnd=t.length;r.selForContextMenu=i.doc.sel}}function h(){if(n.contextMenuPending!=h){return}n.contextMenuPending=false;n.wrapper.style.cssText=u;o.style.cssText=l;if(w&&C<9){r.scrollbars.setScrollTop(r.scroller.scrollTop=a)}if(o.selectionStart!=null){if(!w||w&&C<9){d()}var e=0,t=function(){if(r.selForContextMenu==i.doc.sel&&o.selectionStart==0&&o.selectionEnd>0&&n.prevInput=="​"){Nr(i,Vo)(i)}else if(e++<10){r.detectingSelectAll=setTimeout(t,500)}else{r.selForContextMenu=null;r.input.reset()}};r.detectingSelectAll=setTimeout(t,200)}}if(w&&C>=9){d()}if(k){Le(e);var p=function(){ge(window,"mouseup",p);setTimeout(h,20)};pe(window,"mouseup",p)}else{setTimeout(h,50)}},rl.prototype.readOnlyChanged=function(e){if(!e){this.reset()}this.textarea.disabled=e=="nocursor"},rl.prototype.setUneditable=function(){},rl.prototype.needsContentAttribute=false,Fs(zs),Xs(zs);var sl="iter insert remove copy getEditor constructor".split(" ");for(var ll in Ca.prototype){if(Ca.prototype.hasOwnProperty(ll)&&W(sl,ll)<0){zs.prototype[ll]=function(e){return function(){return e.apply(this.doc,arguments)}}(Ca.prototype[ll])}}return we(Ca),zs.inputStyles={textarea:rl,contenteditable:Qs},zs.defineMode=function(e){zs.defaults.mode||"null"==e||(zs.defaults.mode=e),function(e,t){2"));else return null}else if(t.match("--")){return e(f("comment","--\x3e"))}else if(t.match("DOCTYPE",true,true)){t.eatWhile(/[\w\._\-]/);return e(d(1))}else{return null}}else if(t.eat("?")){t.eatWhile(/[\w\._\-]/);n.tokenize=f("meta","?>");return"meta"}else{o=t.eat("/")?"closeTag":"openTag";n.tokenize=c;return"tag bracket"}}else if(i=="&"){var r;if(t.eat("#")){if(t.eat("x")){r=t.eatWhile(/[a-fA-F\d]/)&&t.eat(";")}else{r=t.eatWhile(/[\d]/)&&t.eat(";")}}else{r=t.eatWhile(/[\w\.\-:]/)&&t.eat(";")}return r?"atom":"error"}else{t.eatWhile(/[^&<]/);return null}}u.isInText=true;function c(e,t){var n=e.next();if(n==">"||n=="/"&&e.eat(">")){t.tokenize=u;o=n==">"?"endTag":"selfcloseTag";return"tag bracket"}else if(n=="="){o="equals";return null}else if(n=="<"){t.tokenize=u;t.state=g;t.tagName=t.tagStart=null;var i=t.tokenize(e,t);return i?i+" tag error":"tag error"}else if(/[\'\"]/.test(n)){t.tokenize=r(n);t.stringStartCol=e.column();return t.tokenize(e,t)}else{e.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/);return"word"}}function r(n){var e=function(e,t){while(!e.eol()){if(e.next()==n){t.tokenize=c;break}}return"string"};e.isInAttribute=true;return e}function f(n,i){return function(e,t){while(!e.eol()){if(e.match(i)){t.tokenize=u;break}e.next()}return n}}function d(i){return function(e,t){var n;while((n=e.next())!=null){if(n=="<"){t.tokenize=d(i+1);return t.tokenize(e,t)}else if(n==">"){if(i==1){t.tokenize=u;break}else{t.tokenize=d(i-1);return t.tokenize(e,t)}}}return"meta"}}function h(e,t,n){this.prev=e.context;this.tagName=t;this.indent=e.indented;this.startOfLine=n;if(s.doNotIndent.hasOwnProperty(t)||e.context&&e.context.noIndent)this.noIndent=true}function p(e){if(e.context)e.context=e.context.prev}function m(e,t){var n;while(true){if(!e.context){return}n=e.context.tagName;if(!s.contextGrabbers.hasOwnProperty(n)||!s.contextGrabbers[n].hasOwnProperty(t)){return}p(e)}}function g(e,t,n){if(e=="openTag"){n.tagStart=t.column();return v}else if(e=="closeTag"){return y}else{return g}}function v(e,t,n){if(e=="word"){n.tagName=t.current();l="tag";return w}else if(s.allowMissingTagName&&e=="endTag"){l="tag bracket";return w(e,t,n)}else{l="error";return v}}function y(e,t,n){if(e=="word"){var i=t.current();if(n.context&&n.context.tagName!=i&&s.implicitlyClosed.hasOwnProperty(n.context.tagName))p(n);if(n.context&&n.context.tagName==i||s.matchClosing===false){l="tag";return x}else{l="tag error";return b}}else if(s.allowMissingTagName&&e=="endTag"){l="tag bracket";return x(e,t,n)}else{l="error";return b}}function x(e,t,n){if(e!="endTag"){l="error";return x}p(n);return g}function b(e,t,n){l="error";return x(e,t,n)}function w(e,t,n){if(e=="word"){l="attribute";return C}else if(e=="endTag"||e=="selfcloseTag"){var i=n.tagName,r=n.tagStart;n.tagName=n.tagStart=null;if(e=="selfcloseTag"||s.autoSelfClosers.hasOwnProperty(i)){m(n,i)}else{m(n,i);n.context=new h(n,i,r==n.indented)}return g}l="error";return w}function C(e,t,n){if(e=="equals")return k;if(!s.allowMissing)l="error";return w(e,t,n)}function k(e,t,n){if(e=="string")return S;if(e=="word"&&s.allowUnquoted){l="string";return w}l="error";return w(e,t,n)}function S(e,t,n){if(e=="string")return S;return w(e,t,n)}return{startState:function(e){var t={tokenize:u,state:g,indented:e||0,tagName:null,tagStart:null,context:null};if(e!=null)t.baseIndent=e;return t},token:function(e,t){if(!t.tagName&&e.sol())t.indented=e.indentation();if(e.eatSpace())return null;o=null;var n=t.tokenize(e,t);if((n||o)&&n!="comment"){l=null;t.state=t.state(o||n,e,t);if(l)n=l=="error"?n+" error":l}return n},indent:function(e,t,n){var i=e.context;if(e.tokenize.isInAttribute){if(e.tagStart==e.indented)return e.stringStartCol+1;else return e.indented+a}if(i&&i.noIndent)return L.Pass;if(e.tokenize!=c&&e.tokenize!=u)return n?n.match(/^(\s*)/)[0].length:0;if(e.tagName){if(s.multilineTagIndentPastTag!==false)return e.tagStart+e.tagName.length+2;else return e.tagStart+a*(s.multilineTagIndentFactor||1)}if(s.alignCDATA&&/$/,blockCommentStart:"\x3c!--",blockCommentEnd:"--\x3e",configuration:s.htmlMode?"html":"xml",helperType:s.htmlMode?"html":"xml",skipAttribute:function(e){if(e.state==k)e.state=w},xmlCurrentTag:function(e){return e.tagName?{name:e.tagName,close:e.type=="closeTag"}:null},xmlCurrentContext:function(e){var t=[];for(var n=e.context;n;n=n.prev)if(n.tagName)t.push(n.tagName);return t.reverse()}}}),L.defineMIME("text/xml","xml"),L.defineMIME("application/xml","xml"),!L.mimeModes.hasOwnProperty("text/html"))L.defineMIME("text/html",{name:"xml",htmlMode:true})}(ft)}),e(function(e,t){!function(o){o.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history).md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki ",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]}];for(var e=0;e-1&&e.substring(i+1,e.length);if(r)return o.findModeByExtension(r)},o.findModeByName=function(e){e=e.toLowerCase();for(var t=0;t` "'(~:]+/,x=/^(~~~+|```+)[ \t]*([\w+#-]*)[^\n`]*$/,b=/^\s*\[[^\]]+?\]:.*$/,L=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/;function E(e,t,n){return t.f=t.inline=n,n(e,t)}function M(e,t,n){return t.f=t.block=n,n(e,t)}function i(e){if(e.linkTitle=!1,e.linkHref=!1,e.linkText=!1,e.em=!1,e.strong=!1,e.strikethrough=!1,e.quote=0,e.indentedCode=!1,e.f==T){var t=r;if(!t){var n=P.innerMode(C,e.htmlState);t="xml"==n.mode.name&&null===n.state.tagStart&&!n.state.context&&n.state.tokenize.isInText}t&&(e.f=N,e.block=a,e.htmlState=null)}return e.trailingSpace=0,e.trailingSpaceNewLine=!1,e.prevLine=e.thisLine,e.thisLine={stream:null},null}function a(e,t){var n,i=e.column()===t.indentation,r=!(n=t.prevLine.stream)||!/\S/.test(n.string),o=t.indentedCode,a=t.prevLine.hr,s=!1!==t.list,l=(t.listStack[t.listStack.length-1]||0)+3;t.indentedCode=!1;var u=t.indentation;if(null===t.indentationDiff&&(t.indentationDiff=t.indentation,s)){for(t.list=null;u"))return t.quote=i?1:t.quote+1,w.highlightFormatting&&(t.formatting="quote"),e.eatSpace(),A(t);if(!f&&!t.setext&&i&&t.indentation<=l&&(d=e.match(g))){var h=d[1]?"ol":"ul";return t.indentation=u+e.current().length,t.list=!0,t.quote=0,t.listStack.push(t.indentation),t.em=!1,t.strong=!1,t.code=!1,t.strikethrough=!1,w.taskLists&&e.match(S,!1)&&(t.taskList=!0),t.f=t.inline,w.highlightFormatting&&(t.formatting=["list","list-"+h]),A(t)}return i&&t.indentation<=l&&(d=e.match(x,!0))?(t.quote=0,t.fencedEndRE=new RegExp(d[1]+"+ *$"),t.localMode=w.fencedCodeBlockHighlighting&&function(e){if(P.findModeByName){var t=P.findModeByName(e);t&&(e=t.mime||t.mimes[0])}var n=P.getMode(p,e);return"null"==n.name?null:n}(d[2]),t.localMode&&(t.localState=P.startState(t.localMode)),t.f=t.block=D,w.highlightFormatting&&(t.formatting="code-block"),t.code=-1,A(t)):t.setext||!(c&&s||t.quote||!1!==t.list||t.code||f||b.test(e.string))&&(d=e.lookAhead(1))&&(d=d.match(y))?(t.setext?(t.header=t.setext,t.setext=0,e.skipToEnd(),w.highlightFormatting&&(t.formatting="header")):(t.header="="==d[0].charAt(0)?1:2,t.setext=t.header),t.thisLine.header=!0,t.f=t.inline,A(t)):f?(e.skipToEnd(),t.hr=!0,t.thisLine.hr=!0,k.hr):"["===e.peek()?E(e,t,I):E(e,t,t.inline)}function T(e,t){var n=C.token(e,t.htmlState);if(!r){var i=P.innerMode(C,t.htmlState);("xml"==i.mode.name&&null===i.state.tagStart&&!i.state.context&&i.state.tokenize.isInText||t.md_inside&&-1"))&&(t.f=N,t.block=a,t.htmlState=null)}return n}function D(e,t){var n,i=t.listStack[t.listStack.length-1]||0,r=t.indentation=e.quote?t.push(k.formatting+"-"+e.formatting[n]+"-"+e.quote):t.push("error"))}if(e.taskOpen)return t.push("meta"),t.length?t.join(" "):null;if(e.taskClosed)return t.push("property"),t.length?t.join(" "):null;if(e.linkHref?t.push(k.linkHref,"url"):(e.strong&&t.push(k.strong),e.em&&t.push(k.em),e.strikethrough&&t.push(k.strikethrough),e.emoji&&t.push(k.emoji),e.linkText&&t.push(k.linkText),e.code&&t.push(k.code),e.image&&t.push(k.image),e.imageAltText&&t.push(k.imageAltText,"link"),e.imageMarker&&t.push(k.imageMarker)),e.header&&t.push(k.header,k.header+"-"+e.header),e.quote&&(t.push(k.quote),!w.maxBlockquoteDepth||w.maxBlockquoteDepth>=e.quote?t.push(k.quote+"-"+e.quote):t.push(k.quote+"-"+w.maxBlockquoteDepth)),!1!==e.list){var i=(e.listStack.length-1)%3;i?1==i?t.push(k.list2):t.push(k.list3):t.push(k.list1)}return e.trailingSpaceNewLine?t.push("trailing-space-new-line"):e.trailingSpace&&t.push("trailing-space-"+(e.trailingSpace%2?"a":"b")),t.length?t.join(" "):null}function t(e,t){if(e.match(n,!0))return A(t)}function N(e,t){var n=t.text(e,t);if(void 0!==n)return n;if(t.list)return t.list=null,A(t);if(t.taskList)return" "===e.match(S,!0)[1]?t.taskOpen=!0:t.taskClosed=!0,w.highlightFormatting&&(t.formatting="task"),t.taskList=!1,A(t);if(t.taskOpen=!1,t.taskClosed=!1,t.header&&e.match(/^#+$/,!0))return w.highlightFormatting&&(t.formatting="header"),A(t);var i=e.next();if(t.linkTitle){t.linkTitle=!1;var r=i;"("===i&&(r=")");var o="^\\s*(?:[^"+(r=(r+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1"))+"\\\\]+|\\\\\\\\|\\\\.)"+r;if(e.match(new RegExp(o),!0))return k.linkHref}if("`"===i){var a=t.formatting;w.highlightFormatting&&(t.formatting="code"),e.eatWhile("`");var s=e.current().length;if(0!=t.code||t.quote&&1!=s){if(s!=t.code)return t.formatting=a,A(t);var l=A(t);return t.code=0,l}return t.code=s,A(t)}if(t.code)return A(t);if("\\"===i&&(e.next(),w.highlightFormatting)){var u=A(t),c=k.formatting+"-escape";return u?u+" "+c:c}if("!"===i&&e.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return t.imageMarker=!0,t.image=!0,w.highlightFormatting&&(t.formatting="image"),A(t);if("["===i&&t.imageMarker&&e.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return t.imageMarker=!1,t.imageAltText=!0,w.highlightFormatting&&(t.formatting="image"),A(t);if("]"===i&&t.imageAltText){w.highlightFormatting&&(t.formatting="image");var u=A(t);return t.imageAltText=!1,t.image=!1,t.inline=t.f=F,u}if("["===i&&!t.image)return t.linkText&&e.match(/^.*?\]/)||(t.linkText=!0,w.highlightFormatting&&(t.formatting="link")),A(t);if("]"===i&&t.linkText){w.highlightFormatting&&(t.formatting="link");var u=A(t);return t.linkText=!1,t.inline=t.f=e.match(/\(.*?\)| ?\[.*?\]/,!1)?F:N,u}if("<"===i&&e.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1))return t.f=t.inline=O,w.highlightFormatting&&(t.formatting="link"),(u=A(t))?u+=" ":u="",u+k.linkInline;if("<"===i&&e.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1))return t.f=t.inline=O,w.highlightFormatting&&(t.formatting="link"),(u=A(t))?u+=" ":u="",u+k.linkEmail;if(w.xml&&"<"===i&&e.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var f=e.string.indexOf(">",e.pos);if(-1!=f){var d=e.string.substring(e.start,f);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(d)&&(t.md_inside=!0)}return e.backUp(1),t.htmlState=P.startState(C),M(e,t,T)}if(w.xml&&"<"===i&&e.match(/^\/\w*?>/))return t.md_inside=!1,"tag";if("*"===i||"_"===i){for(var h=1,p=1==e.pos?" ":e.string.charAt(e.pos-2);h<3&&e.eat(i);)h++;var m=e.peek()||" ",g=!/\s/.test(m)&&(!L.test(m)||/\s/.test(p)||L.test(p)),v=!/\s/.test(p)&&(!L.test(p)||/\s/.test(m)||L.test(m)),y=null,x=null;if(h%2&&(t.em||!g||"*"!==i&&v&&!L.test(p)?t.em!=i||!v||"*"!==i&&g&&!L.test(m)||(y=!1):y=!0),1"!==e.next())return e.match(/^[^>]+/,!0),k.linkInline;t.f=t.inline=N,w.highlightFormatting&&(t.formatting="link");var n=A(t);return n?n+=" ":n="",n+k.linkInline}function F(e,t){if(e.eatSpace())return null;var i,n=e.next();return"("===n||"["===n?(t.f=t.inline=(i="("===n?")":"]",function(e,t){if(e.next()!==i)return e.match(o[i]),t.linkHref=!0,A(t);t.f=t.inline=N,w.highlightFormatting&&(t.formatting="link-string");var n=A(t);return t.linkHref=!1,n}),w.highlightFormatting&&(t.formatting="link-string"),t.linkHref=!0,A(t)):"error"}var o={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function I(e,t){return e.match(/^([^\]\\]|\\.)*\]:/,!1)?(t.f=s,e.next(),w.highlightFormatting&&(t.formatting="link"),t.linkText=!0,A(t)):E(e,t,N)}function s(e,t){if(e.match(/^\]:/,!0)){t.f=t.inline=l,w.highlightFormatting&&(t.formatting="link");var n=A(t);return t.linkText=!1,n}return e.match(/^([^\]\\]|\\.)+/,!0),k.linkText}function l(e,t){return e.eatSpace()?null:(e.match(/^[^\s]+/,!0),void 0===e.peek()?t.linkTitle=!0:e.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),t.f=t.inline=N,k.linkHref+" url")}var u={startState:function(){return{f:a,prevLine:{stream:null},thisLine:{stream:null},block:a,htmlState:null,indentation:0,inline:N,text:t,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(e){return{f:e.f,prevLine:e.prevLine,thisLine:e.thisLine,block:e.block,htmlState:e.htmlState&&P.copyState(C,e.htmlState),indentation:e.indentation,localMode:e.localMode,localState:e.localMode?P.copyState(e.localMode,e.localState):null,inline:e.inline,text:e.text,formatting:!1,linkText:e.linkText,linkTitle:e.linkTitle,linkHref:e.linkHref,code:e.code,em:e.em,strong:e.strong,strikethrough:e.strikethrough,emoji:e.emoji,header:e.header,setext:e.setext,hr:e.hr,taskList:e.taskList,list:e.list,listStack:e.listStack.slice(0),quote:e.quote,indentedCode:e.indentedCode,trailingSpace:e.trailingSpace,trailingSpaceNewLine:e.trailingSpaceNewLine,md_inside:e.md_inside,fencedEndRE:e.fencedEndRE}},token:function(e,t){if(t.formatting=!1,e!=t.thisLine.stream){if(t.header=0,t.hr=!1,e.match(/^\s*$/,!0))return i(t),null;if(t.prevLine=t.thisLine,t.thisLine={stream:e},t.taskList=!1,t.trailingSpace=0,t.trailingSpaceNewLine=!1,!t.localState&&(t.f=t.block,t.f!=T)){var n=e.match(/^\s*/,!0)[0].replace(/\t/g," ").length;if(t.indentation=n,t.indentationDiff=null,0 ","")}),$("[data-command=link]",t).addEventListener("click",function(){var e=a.getSelection();/^(https?:\/\/|mailto:)/i.test(e)?s("[","]("+e+")",!0):""!==e?s("["+e+"](http://",")",!0):s("[","](http://)")}),$("[data-command=image]",t).addEventListener("click",function(){dt.show("imagesModal",null,function(e){var t=$(".image-picker-thumbnail.selected",e);t&&t.classList.remove("selected"),$(".image-picker-confirm",e).addEventListener("click",function e(){var t=$(".image-picker-thumbnail.selected",$("#imagesModal")).getAttribute("data-filename");void 0!==t?s(o()+"![","]("+t+")"):s(o()+"![](",")"),this.removeEventListener("click",e)})})}),$("[data-command=summary]",t).addEventListener("click",function(){var e;n()||(s((void 0===(e=r())||"\n"===e?"":"\n")+"\n===\n\n",""),this.setAttribute("disabled",""))}),$("[data-command=undo]",t).addEventListener("click",function(){a.undo(),a.focus()}),$("[data-command=redo]",t).addEventListener("click",function(){a.redo(),a.focus()}),i(),a.on("changes",x.debounce(function(){e.value=a.getValue(),i(),a.historySize().undo<1?$("[data-command=undo]").setAttribute("disabled",""):$("[data-command=undo]").removeAttribute("disabled"),a.historySize().redo<1?$("[data-command=redo]").setAttribute("disabled",""):$("[data-command=redo]").removeAttribute("disabled")},500)),document.addEventListener("keydown",function(e){if(!e.altKey&&(e.ctrlKey||e.metaKey))switch(e.which){case 66:$("[data-command=bold]",t).click(),e.preventDefault();break;case 73:$("[data-command=italic]",t).click(),e.preventDefault();break;case 75:$("[data-command=link]",t).click(),e.preventDefault()}})}function pt(t){var e=$('label[for="'+t.id+'"]');function n(){var e=$('label[for="'+this.id+'"] span');0$&"),t.style.display=""):t.style.display="none"}))}function s(){this.value=x.validateSlug(this.value)}$$(".pages-list").forEach(function(e){var n,i,r;"true"===e.getAttribute("data-sortable-children")&&(i=[],i=(r=_e.create(n=e,{handle:".sort-handle",filter:"[data-sortable=false]",forceFallback:!0,onClone:function(e){e.item.closest(".pages-list").classList.add("dragging"),$$(".pages-children",e.item).forEach(function(e){e.style.display="none"}),$$(".page-children-toggle").forEach(function(e){e.classList.remove("toggle-expanded"),e.classList.add("toggle-collapsed"),e.style.opacity="0.5"})},onMove:function(e){if("false"===e.related.getAttribute("data-sortable"))return!1;$$(".pages-children",e.related).forEach(function(e){e.style.display="none"})},onEnd:function(e){var t;e.item.closest(".pages-list").classList.remove("dragging"),$$(".page-children-toggle").forEach(function(e){e.style.opacity=""}),e.newIndex!==e.oldIndex&&(r.option("disabled",!0),t={"csrf-token":$("meta[name=csrf-token]").getAttribute("content"),parent:n.getAttribute("data-parent"),from:e.oldIndex,to:e.newIndex},u({method:"POST",url:Formwork.config.baseUri+"pages/reorder/",data:t},function(e){e.status&&new l(e.message,e.status,5e3).show(),e.status&&"error"!==e.status||r.sort(i),r.option("disabled",!1),i=r.toArray()}))}})).toArray())}),$$(".page-details").forEach(function(e){var t=$(".page-children-toggle",e);t&&e.addEventListener("click",function(){t.click()})}),$$(".page-details a").forEach(function(e){e.addEventListener("click",function(e){e.stopPropagation()})}),$$(".page-children-toggle").forEach(function(e){e.addEventListener("click",function(e){var t;t=this,$$(".pages-list",t.closest("li")).forEach(function(e){x.toggleElement(e)}),t.classList.toggle("toggle-expanded"),t.classList.toggle("toggle-collapsed"),e.stopPropagation()})}),e&&e.addEventListener("click",function(){$$(".pages-children").forEach(function(e){e.style.display="block"}),$$(".pages-list .page-children-toggle").forEach(function(e){e.classList.remove("toggle-collapsed"),e.classList.add("toggle-expanded")}),this.blur()}),t&&t.addEventListener("click",function(){$$(".pages-children").forEach(function(e){e.style.display="none"}),$$(".pages-list .page-children-toggle").forEach(function(e){e.classList.remove("toggle-expanded"),e.classList.add("toggle-collapsed")}),this.blur()}),n&&n.addEventListener("click",function(){this.classList.toggle("active"),$$(".pages-list .sort-handle").forEach(function(e){x.toggleElement(e,"inline")}),this.blur()}),i&&(i.addEventListener("focus",function(){$$(".pages-children").forEach(function(e){e.setAttribute("data-display",getComputedStyle(e).display)})}),i.addEventListener("keyup",x.debounce(a,100)),i.addEventListener("search",a),document.addEventListener("keydown",function(e){(e.ctrlKey||e.metaKey)&&70===e.which&&document.activeElement!==i&&(i.focus(),e.preventDefault())})),r&&($("#page-title",r).addEventListener("keyup",function(){$("#page-slug",r).value=x.slug(this.value)}),$("#page-slug",r).addEventListener("keyup",s),$("#page-slug",r).addEventListener("blur",s),$("#page-parent",r).addEventListener("change",function(){var e=this.options[this.selectedIndex],t=$("#page-template",r),n=e.getAttribute("data-allowed-templates"),i=0;if(null!==n)for(n=n.split(", "),t.setAttribute("data-previous-value",t.value),t.value=n[0],i=0;ie.x;return i&&"explode"===n||!i&&"implode"===n?"start":i&&"implode"===n||!i&&"explode"===n?"end":"middle"}return u=(e=this||i).window,p=e.document,(m=t).namespaces={svg:"http://www.w3.org/2000/svg",xmlns:"http://www.w3.org/2000/xmlns/",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",ct:"http://gionkunz.github.com/chartist-js/ct"},m.noop=function(e){return e},m.alphaNumerate=function(e){return String.fromCharCode(97+e%26)},m.extend=function(e){var t,n,i;for(e=e||{},t=1;t":">",'"':""","'":"'"},m.serialize=function(e){return null==e?e:("number"==typeof e?e=""+e:"object"==typeof e&&(e=JSON.stringify({data:e})),Object.keys(m.escapingMap).reduce(function(e,t){return m.replaceAll(e,t,m.escapingMap[t])},e))},m.deserialize=function(e){if("string"!=typeof e)return e;e=Object.keys(m.escapingMap).reduce(function(e,t){return m.replaceAll(e,m.escapingMap[t],t)},e);try{e=void 0!==(e=JSON.parse(e)).data?e.data:e}catch(e){}return e},m.createSvg=function(t,e,n,i){var r;return e=e||"100%",n=n||"100%",Array.prototype.slice.call(t.querySelectorAll("svg")).filter(function(e){return e.getAttributeNS(m.namespaces.xmlns,"ct")}).forEach(function(e){t.removeChild(e)}),(r=new m.Svg("svg").attr({width:e,height:n}).addClass(i))._node.style.width=e,r._node.style.height=n,t.appendChild(r._node),r},m.normalizeData=function(e,t,n){var i,r={raw:e,normalized:{}};return r.normalized.series=m.getDataArray({series:e.series||[]},t,n),i=r.normalized.series.every(function(e){return e instanceof Array})?Math.max.apply(null,r.normalized.series.map(function(e){return e.length})):r.normalized.series.length,r.normalized.labels=(e.labels||[]).slice(),Array.prototype.push.apply(r.normalized.labels,m.times(Math.max(0,i-r.normalized.labels.length)).map(function(){return""})),t&&m.reverseData(r.normalized),r},m.safeHasProperty=function(e,t){return null!==e&&"object"==typeof e&&e.hasOwnProperty(t)},m.isDataHoleValue=function(e){return null==e||"number"==typeof e&&isNaN(e)},m.reverseData=function(e){e.labels.reverse(),e.series.reverse();for(var t=0;to.high&&(o.high=i),s&&i=n)l.step=1;else if(i&&c=n)l.step=c;else for(;;){if(u&&m.projectLength(e,l.step,l)<=n)l.step*=2;else{if(u||!(m.projectLength(e,l.step/2,l)>=n))break;if(l.step/=2,i&&l.step%1!=0){l.step*=2;break}}if(1e3=l.high;)a=d(a,-l.step);l.min=o,l.max=a,l.range=l.max-l.min;var h=[];for(r=l.min;r<=l.max;r=d(r,l.step)){var p=m.roundWithPrecision(r);p!==h[h.length-1]&&h.push(p)}return l.values=h,l},m.polarToCartesian=function(e,t,n,i){var r=(i-90)*Math.PI/180;return{x:e+n*Math.cos(r),y:t+n*Math.sin(r)}},m.createChartRect=function(e,t,n){var i=!(!t.axisX&&!t.axisY),r=i?t.axisY.offset:0,o=i?t.axisX.offset:0,a=e.width()||m.quantity(t.width).value||0,s=e.height()||m.quantity(t.height).value||0,l=m.normalizePadding(t.chartPadding,n);a=Math.max(a,r+l.left+l.right),s=Math.max(s,o+l.top+l.bottom);var u={padding:l,width:function(){return this.x2-this.x1},height:function(){return this.y1-this.y2}};return i?("start"===t.axisX.position?(u.y2=l.top+o,u.y1=Math.max(s-l.bottom,u.y2+1)):(u.y2=l.top,u.y1=Math.max(s-l.bottom-o,u.y2+1)),"start"===t.axisY.position?(u.x1=l.left+r,u.x2=Math.max(a-l.right,u.x1+1)):(u.x1=l.left,u.x2=Math.max(a-l.right-r,u.x1+1))):(u.x1=l.left,u.x2=Math.max(a-l.right,u.x1+1),u.y2=l.top,u.y1=Math.max(s-l.bottom,u.y2+1)),u},m.createGrid=function(e,t,n,i,r,o,a,s){var l={};l[n.units.pos+"1"]=e,l[n.units.pos+"2"]=e,l[n.counterUnits.pos+"1"]=i,l[n.counterUnits.pos+"2"]=i+r;var u=o.elem("line",l,a.join(" "));s.emit("draw",m.extend({type:"grid",axis:n,index:t,group:o,element:u},l))},m.createGridBackground=function(e,t,n,i){var r=e.elem("rect",{x:t.x1,y:t.y2,width:t.width(),height:t.height()},n,!0);i.emit("draw",{type:"gridBackground",group:e,element:r})},m.createLabel=function(e,t,n,i,r,o,a,s,l,u,c){var f,d={};if(d[r.units.pos]=e+a[r.units.pos],d[r.counterUnits.pos]=a[r.counterUnits.pos],d[r.units.len]=t,d[r.counterUnits.len]=Math.max(0,o-10),u){var h=p.createElement("span");h.className=l.join(" "),h.setAttribute("xmlns",m.namespaces.xhtml),h.innerText=i[n],h.style[r.units.len]=Math.round(d[r.units.len])+"px",h.style[r.counterUnits.len]=Math.round(d[r.counterUnits.len])+"px",f=s.foreignObject(h,m.extend({style:"overflow: visible;"},d))}else f=s.elem("text",d,l.join(" ")).text(i[n]);c.emit("draw",m.extend({type:"label",axis:r,index:n,group:s,element:f,text:i[n]},d))},m.getSeriesOption=function(e,t,n){if(e.name&&t.series&&t.series[e.name]){var i=t.series[e.name];return i.hasOwnProperty(n)?i[n]:t[n]}return t[n]},m.optionsProvider=function(e,n,i){var r,o,a=m.extend({},e),t=[];function s(e){var t=r;if(r=m.extend({},a),n)for(o=0;o":"","?":"","@":"","[":"","]":"","^":"","`":"","{":"","|":"","}":"","¡":"","£":"","¤":"","¥":"","¦":"","§":"","«":"","°":"","»":"","‘":"","’":"","“":"","”":"","\n":"-"," ":"-","-":"-","–":"-","—":"-","/":"-","\\":"-",_:"-","~":"-","À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","Æ":"Ae","Ç":"C","Ð":"D","È":"E","É":"E","Ê":"E","Ë":"E","Ì":"I","Í":"I","Î":"I","Ï":"I","Ñ":"N","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","Œ":"Oe","Š":"S","Þ":"Th","Ù":"U","Ú":"U","Û":"U","Ü":"U","Ý":"Y","à":"a","á":"a","â":"a","ã":"a","ä":"ae","å":"a","æ":"ae","¢":"c","ç":"c","ð":"d","è":"e","é":"e","ê":"e","ë":"e","ì":"i","í":"i","î":"i","ï":"i","ñ":"n","ò":"o","ó":"o","ô":"o","õ":"o","ö":"oe","ø":"o","œ":"oe","š":"s","ß":"ss","þ":"th","ù":"u","ú":"u","û":"u","ü":"ue","ý":"y","ÿ":"y","Ÿ":"y"};for(t in e=e.toLowerCase(),n)n.hasOwnProperty(t)&&(e=e.split(t).join(n[t]));return e.replace(/[^a-z0-9-]/g,"").replace(/^-+|-+$/g,"").replace(/-+/g,"-")},validateSlug:function(e){return e.toLowerCase().replace(" ","-").replace(/[^a-z0-9-]/g,"")},debounce:function(e,t,n){var i,r,o,a=null;return function(){return i=this,r=arguments,a&&clearTimeout(a),n&&!a&&(o=e.apply(i,r)),a=setTimeout(function(){n||(o=e.apply(i,r)),a=null},t),o}},throttle:function(n,i){var r,o,a,s=0,l=null;return function(){var e,t=Date.now();return 0===s&&(s=t),r=this,o=arguments,(e=s+i-t)<=0||i"===t[0]&&(t=t.substring(1)),e))try{if(e.matches)return e.matches(t);if(e.msMatchesSelector)return e.msMatchesSelector(t);if(e.webkitMatchesSelector)return e.webkitMatchesSelector(t)}catch(e){return}}function q(e,t,n,i){if(e){n=n||document;do{if(null!=t&&(">"!==t[0]||e.parentNode===n)&&C(e,t)||i&&e===n)return e;if(e===n)break}while(e=(r=e).host&&r!==document&&r.host.nodeType?r.host:r.parentNode)}var r;return null}var k,S=/\s+/g;function G(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var i=(" "+e.className+" ").replace(S," ").replace(" "+t+" "," ");e.className=(i+(n?" "+t:"")).replace(S," ")}}function X(e,t,n){var i=e&&e.style;if(i){if(void 0===n)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(e,""):e.currentStyle&&(n=e.currentStyle),void 0===t?n:n[t];t in i||-1!==t.indexOf("webkit")||(t="-webkit-"+t),i[t]=n+("string"==typeof n?"":"px")}}function L(e,t){var n="";if("string"==typeof e)n=e;else do{var i=X(e,"transform");i&&"none"!==i&&(n=i+" "+n)}while(!t&&(e=e.parentNode));var r=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return r&&new r(n)}function E(e,t,n){if(e){var i=e.getElementsByTagName(t),r=0,o=i.length;if(n)for(;r=t.left-n&&o<=t.right+n,r=a>=t.top-n&&a<=t.bottom+n;return n&&i&&r?s=e:void 0}}),s);if(t){var n={};for(var i in e)e.hasOwnProperty(i)&&(n[i]=e[i]);n.target=n.rootEl=t,n.preventDefault=void 0,n.stopPropagation=void 0,t[ee]._onDragOver(n)}}var o,a,s}function We(e){ie&&ie.parentNode[ee]._isOutsideThisEl(e.target)}function _e(e,t){if(!e||!e.nodeType||1!==e.nodeType)throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(e));this.el=e,this.options=t=s({},t),e[ee]=this;var n={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(e.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Pe(e,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(e,t){e.setData("Text",t.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==_e.supportPointer&&"PointerEvent"in window,emptyInsertThreshold:5};for(var i in B.initializePlugins(this,e,n),n)i in t||(t[i]=n[i]);for(var r in ze(t),this)"_"===r.charAt(0)&&"function"==typeof this[r]&&(this[r]=this[r].bind(this));this.nativeDraggable=!t.forceFallback&&Fe,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?v(e,"pointerdown",this._onTapStart):(v(e,"mousedown",this._onTapStart),v(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(v(e,"dragover",this),v(e,"dragenter",this)),Se.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),s(this,I())}function Re(e,t,n,i,r,o,a,s){var l,u,c=e[ee],f=c.options.onMove;return!window.CustomEvent||b||w?(l=document.createEvent("Event")).initEvent("move",!0,!0):l=new CustomEvent("move",{bubbles:!0,cancelable:!0}),l.to=t,l.from=e,l.dragged=n,l.draggedRect=i,l.related=r||t,l.relatedRect=o||V(t),l.willInsertAfter=s,l.originalEvent=a,e.dispatchEvent(l),f&&(u=f.call(c,l,a)),u}function je(e){e.draggable=!1}function Ue(){Te=!1}function Ye(e){for(var t=e.tagName+e.className+e.src+e.href+e.textContent,n=t.length,i=0;n--;)i+=t.charCodeAt(n);return i.toString(36)}function qe(e){return setTimeout(e,0)}function Ge(e){return clearTimeout(e)}_e.prototype={constructor:_e,_isOutsideThisEl:function(e){this.el.contains(e)||e===this.el||(ye=null)},_getDirection:function(e,t){return"function"==typeof this.options.direction?this.options.direction.call(this,e,t,ie):this.options.direction},_onTapStart:function(t){if(t.cancelable){var n=this,i=this.el,e=this.options,r=e.preventOnFilter,o=t.type,a=t.touches&&t.touches[0]||t.pointerType&&"touch"===t.pointerType&&t,s=(a||t).target,l=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||s,u=e.filter;if(!function(e){De.length=0;var t=e.getElementsByTagName("input"),n=t.length;for(;n--;){var i=t[n];i.checked&&De.push(i)}}(i),!ie&&!(/mousedown|pointerdown/.test(o)&&0!==t.button||e.disabled||l.isContentEditable||(s=q(s,e.draggable,i,!1))&&s.animated||H===s)){if(R=Z(s),j=Z(s,e.draggable),"function"==typeof u){if(u.call(this,t,s,this))return ne({sortable:n,rootEl:l,name:"filter",targetEl:s,toEl:i,fromEl:i}),te("filter",n,{evt:t}),void(r&&t.cancelable&&t.preventDefault())}else if(u=u&&u.split(",").some(function(e){if(e=q(l,e.trim(),i,!1))return ne({sortable:n,rootEl:e,name:"filter",targetEl:s,fromEl:i,toEl:i}),te("filter",n,{evt:t}),!0}))return void(r&&t.cancelable&&t.preventDefault());e.handle&&!q(l,e.handle,i,!1)||this._prepareDragStart(t,a,s)}}},_prepareDragStart:function(e,t,n){var i,r=this,o=r.el,a=r.options,s=o.ownerDocument;if(n&&!ie&&n.parentNode===o){var l=V(n);if(ae=o,re=(ie=n).parentNode,se=ie.nextSibling,H=n,ce=a.group,U={target:_e.dragged=ie,clientX:(t||e).clientX,clientY:(t||e).clientY},me=U.clientX-l.left,ge=U.clientY-l.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,ie.style["will-change"]="all",i=function(){te("delayEnded",r,{evt:e}),_e.eventCanceled?r._onDrop():(r._disableDelayedDragEvents(),!d&&r.nativeDraggable&&(ie.draggable=!0),r._triggerDragStart(e,t),ne({sortable:r,name:"choose",originalEvent:e}),G(ie,a.chosenClass,!0))},a.ignore.split(",").forEach(function(e){E(ie,e.trim(),je)}),v(s,"dragover",He),v(s,"mousemove",He),v(s,"touchmove",He),v(s,"mouseup",r._onDrop),v(s,"touchend",r._onDrop),v(s,"touchcancel",r._onDrop),d&&this.nativeDraggable&&(this.options.touchStartThreshold=4,ie.draggable=!0),te("delayStart",this,{evt:e}),!a.delay||a.delayOnTouchOnly&&!t||this.nativeDraggable&&(w||b))i();else{if(_e.eventCanceled)return void this._onDrop();v(s,"mouseup",r._disableDelayedDrag),v(s,"touchend",r._disableDelayedDrag),v(s,"touchcancel",r._disableDelayedDrag),v(s,"mousemove",r._delayedDragTouchMoveHandler),v(s,"touchmove",r._delayedDragTouchMoveHandler),a.supportPointer&&v(s,"pointermove",r._delayedDragTouchMoveHandler),r._dragStartTimer=setTimeout(i,a.delay)}}},_delayedDragTouchMoveHandler:function(e){var t=e.touches?e.touches[0]:e;Math.max(Math.abs(t.clientX-this._lastX),Math.abs(t.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){ie&&je(ie),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;y(e,"mouseup",this._disableDelayedDrag),y(e,"touchend",this._disableDelayedDrag),y(e,"touchcancel",this._disableDelayedDrag),y(e,"mousemove",this._delayedDragTouchMoveHandler),y(e,"touchmove",this._delayedDragTouchMoveHandler),y(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?this.options.supportPointer?v(document,"pointermove",this._onTouchMove):v(document,t?"touchmove":"mousemove",this._onTouchMove):(v(ie,"dragend",this),v(ae,"dragstart",this._onDragStart));try{document.selection?qe(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){if(Ce=!1,ae&&ie){te("dragStarted",this,{evt:t}),this.nativeDraggable&&v(document,"dragover",We);var n=this.options;e||G(ie,n.dragClass,!1),G(ie,n.ghostClass,!0),_e.active=this,e&&this._appendGhost(),ne({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(de){this._lastX=de.clientX,this._lastY=de.clientY,Be();for(var e=document.elementFromPoint(de.clientX,de.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(de.clientX,de.clientY))!==t;)t=e;if(ie.parentNode[ee]._isOutsideThisEl(e),t)do{if(t[ee]){if(t[ee]._onDragOver({clientX:de.clientX,clientY:de.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break}e=t}while(t=t.parentNode);$e()}},_onTouchMove:function(e){if(U){var t=this.options,n=t.fallbackTolerance,i=t.fallbackOffset,r=e.touches?e.touches[0]:e,o=oe&&L(oe,!0),a=oe&&o&&o.a,s=oe&&o&&o.d,l=Ne&&we&&T(we),u=(r.clientX-U.clientX+i.x)/(a||1)+(l?l[0]-Me[0]:0)/(a||1),c=(r.clientY-U.clientY+i.y)/(s||1)+(l?l[1]-Me[1]:0)/(s||1);if(!_e.active&&!Ce){if(n&&Math.max(Math.abs(r.clientX-this._lastX),Math.abs(r.clientY-this._lastY))W.right+10||B.clientX<=W.right&&B.clientY>W.bottom&&B.clientX>=W.left:B.clientX>W.right&&B.clientY>W.top||B.clientX<=W.right&&B.clientY>W.bottom+10)||m.animated)){if(l.parentNode===s){r=V(l);var g,v,y,x=ie.parentNode!==s,b=(T=ie.animated&&ie.toRect||i,D=l.animated&&l.toRect||r,N=(A=a)?T.left:T.top,O=A?T.right:T.bottom,F=A?T.width:T.height,I=A?D.left:D.top,P=A?D.right:D.bottom,z=A?D.width:D.height,!(N===I||O===P||N+F/2===I+z/2)),w=a?"top":"left",C=K(l,"top","top")||K(ie,"top","top"),k=C?C.scrollTop:void 0;if(ye!==l&&(v=r[w],Le=!1,Ee=!b&&t.invertSwap||x),0!==(g=function(e,t,n,i,r,o,a,s){var l=i?e.clientY:e.clientX,u=i?n.height:n.width,c=i?n.top:n.left,f=i?n.bottom:n.right,d=!1;if(!a)if(s&&be',c+=l+" "+e,c+="",c+="",i=0;i<7;i++)c+='',c+=f.dayLabels[h.mod(i+f.weekStarts,7)],c+="";for(c+="",i=0;i<6;i++){for(r=0;r<7;r++)o<=s&&(0':'',c+=o++):1===o?(c+='',c+=h.daysInMonth(h.mod(t-1,12),e)-u+r+1):(c+='',c+=o++-s),c+="";c+=""}c+="",$(".calendar-table",p).innerHTML=c,$$(".calendar-day",p).forEach(function(e){e.addEventListener("mousedown",function(e){e.stopPropagation(),e.preventDefault()}),e.addEventListener("click",function(){var e=m(),t=new Date(d.year,d.month,parseInt(this.textContent));e.setAttribute("data-date",t),e.value=h.formatDateTime(t),e.blur()})})}function t(){var e,t,n,i,r,o,a,s,l,u;(c=m())&&"block"===p.style.display&&(t=(e=c.getBoundingClientRect()).top+window.pageYOffset,n=e.left+window.pageXOffset,p.style.top=t+c.offsetHeight+"px",p.style.left=n+c.offsetLeft+"px",r=(i=p.getBoundingClientRect()).top+window.pageYOffset,o=i.left+window.pageXOffset,a=x.outerWidth(p),s=x.outerHeight(p),l=document.documentElement.clientWidth,u=document.documentElement.clientHeight,lh.daysInMonth(this.month,this.year)&&this.lastDay()},nextMonth:function(){this.month=h.mod(this.month+1,12),0===this.month&&this.nextYear(),this.day>h.daysInMonth(this.month,this.year)&&this.lastDay()},prevWeek:function(){this.day-=7,this.day<1&&(this.prevMonth(),this.day+=h.daysInMonth(this.month,this.year))},nextWeek:function(){this.day+=7,this.day>h.daysInMonth(this.month,this.year)&&(this.day-=h.daysInMonth(this.month,this.year),this.nextMonth())},prevDay:function(){this.day--,this.day<1&&(this.prevMonth(),this.lastDay())},nextDay:function(){this.day++,this.day>h.daysInMonth(this.month,this.year)&&(this.nextMonth(),this.day=1)}},h={_daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],mod:function(e,t){return(e%t+t)%t},pad:function(e){return 1===e.toString().length?"0"+e:e},isValidDate:function(e){return e&&!isNaN(Date.parse(e))},isLeapYear:function(e){return e%4==0&&e%100!=0||e%400==0},daysInMonth:function(e,t){return 1===e&&this.isLeapYear(t)?29:this._daysInMonth[e]},formatDateTime:function(e){var t=f.format,n=e.getFullYear(),i=e.getMonth()+1,r=e.getDate(),o=e.getHours(),a=e.getMinutes(),s=e.getSeconds(),l=o<12;return-1
',document.body.appendChild(p),$(".currentMonth",p).addEventListener("mousedown",function(e){var t=m(),n=new Date;d.setDate(n),i(t),t.blur(),e.preventDefault()}),x.longClick($(".prevMonth",p),function(e){d.prevMonth(),n(d.year,d.month),e.preventDefault()},750,500),x.longClick($(".nextMonth",p),function(e){d.nextMonth(),n(d.year,d.month),e.preventDefault()},750,500),window.addEventListener("mousedown",function(e){"none"!==p.style.display&&e.target.closest(".calendar")&&e.preventDefault()}),window.addEventListener("resize",x.throttle(t,100)),p),function(){var e=c.value;c.readOnly=!0,c.size=f.format.length,h.isValidDate(e)&&(e=new Date(e),c.setAttribute("data-date",e),c.value=h.formatDateTime(e));c.addEventListener("change",function(){""===this.value?this.setAttribute("data-date",""):this.value=h.formatDateTime(this.getAttribute("data-date"))}),c.addEventListener("keydown",function(e){var t=this.getAttribute("data-date");switch(d.setDate(h.isValidDate(t)?new Date(t):new Date),e.which){case 13:$(".calendar-day.selected",p).click(),p.style.display="none";break;case 8:this.value="",this.blur(),p.style.display="none";break;case 27:this.blur(),p.style.display="none";break;case 37:e.ctrlKey||e.metaKey?e.shiftKey?d.prevYear():d.prevMonth():d.prevDay(),i(this);break;case 38:d.prevWeek(),i(this);break;case 39:e.ctrlKey||e.metaKey?e.shiftKey?d.nextYear():d.nextMonth():d.nextDay(),i(this);break;case 40:d.nextWeek(),i(this);break;case 48:(e.ctrlKey||e.metaKey)&&d.setDate(new Date),i(this);break;default:return}e.stopPropagation(),e.preventDefault()}),c.addEventListener("focus",function(){var e=h.isValidDate(this.getAttribute("data-date"))?new Date(this.getAttribute("data-date")):new Date;d.setDate(e),n(d.year,d.month,d.day),p.style.display="block",t()}),c.addEventListener("blur",function(){p.style.display="none"})}()}at.prototype={startIndex:null,dragStart:function(e){var t=e.oldDraggableIndex;this.startIndex=t},onSpill:function(e){var t=e.dragEl,n=e.putSortable;this.sortable.captureAnimationState(),n&&n.captureAnimationState();var i=M(this.sortable.el,this.startIndex,this.options);i?this.sortable.el.insertBefore(t,i):this.sortable.el.appendChild(t),this.sortable.animateAll(),n&&n.animateAll()},drop:rt},s(at,{pluginName:"revertOnSpill"}),st.prototype={onSpill:function(e){var t=e.dragEl,n=e.putSortable||this.sortable;n.captureAnimationState(),t.parentNode&&t.parentNode.removeChild(t),n.animateAll()},drop:rt},s(st,{pluginName:"removeOnSpill"}),_e.mount(new function(){function e(){for(var e in this.defaults={scroll:!0,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0},this)"_"===e.charAt(0)&&"function"==typeof this[e]&&(this[e]=this[e].bind(this))}return e.prototype={dragStarted:function(e){var t=e.originalEvent;this.sortable.nativeDraggable?v(document,"dragover",this._handleAutoScroll):this.options.supportPointer?v(document,"pointermove",this._handleFallbackAutoScroll):t.touches?v(document,"touchmove",this._handleFallbackAutoScroll):v(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(e){var t=e.originalEvent;this.options.dragOverBubble||t.rootEl||this._handleAutoScroll(t)},drop:function(){this.sortable.nativeDraggable?y(document,"dragover",this._handleAutoScroll):(y(document,"pointermove",this._handleFallbackAutoScroll),y(document,"touchmove",this._handleFallbackAutoScroll),y(document,"mousemove",this._handleFallbackAutoScroll)),it(),nt(),clearTimeout(k),k=void 0},nulling:function(){Ze=Ve=Xe=tt=Je=Ke=Qe=null,et.length=0},_handleFallbackAutoScroll:function(e){this._handleAutoScroll(e,!0)},_handleAutoScroll:function(t,n){var i=this,r=(t.touches?t.touches[0]:t).clientX,o=(t.touches?t.touches[0]:t).clientY,e=document.elementFromPoint(r,o);if(Ze=t,n||w||b||h){ot(t,this.options,e,n);var a=O(e,!0);!tt||Je&&r===Ke&&o===Qe||(Je&&it(),Je=setInterval(function(){var e=O(document.elementFromPoint(r,o),!0);e!==a&&(a=e,nt()),ot(t,i.options,e,n)},10),Ke=r,Qe=o)}else{if(!this.options.bubbleScroll||O(e,!0)===N())return void nt();ot(t,this.options,O(e,!1),!1)}}},s(e,{pluginName:"scroll",initializeByDefault:!0})}),_e.mount(st,at);var ct,ft=e(function(e,t){e.exports=function(){var e=navigator.userAgent,t=navigator.platform,m=/gecko\/\d/i.test(e),n=/MSIE \d/.test(e),i=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),r=/Edge\/(\d+)/.exec(e),w=n||i||r,C=w&&(n?document.documentMode||6:+(r||i)[1]),g=!r&&/WebKit\//.test(e),o=g&&/Qt\/\d+\.\d+/.test(e),a=!r&&/Chrome\//.test(e),v=/Opera\//.test(e),s=/Apple Computer/.test(navigator.vendor),l=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),u=/PhantomJS/.test(e),c=!r&&/AppleWebKit/.test(e)&&/Mobile\/\w+/.test(e),f=/Android/.test(e),d=c||f||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),y=c||/Mac/.test(t),h=/\bCrOS\b/.test(e),p=/win/i.test(t),x=v&&e.match(/Version\/(\d*\.\d*)/);if(x){x=Number(x[1])}if(x&&x>=15){v=false;g=true}var b=y&&(o||v&&(x==null||x<12.11)),k=m||w&&C>=9;function S(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var L=function(e,t){var n=e.className;var i=S(t).exec(n);if(i){var r=n.slice(i.index+i[0].length);e.className=n.slice(0,i.index)+(r?i[1]+r:"")}},E;function M(e){for(var t=e.childNodes.length;t>0;--t){e.removeChild(e.firstChild)}return e}function T(e,t){return M(e).appendChild(t)}function N(e,t,n,i){var r=document.createElement(e);if(n){r.className=n}if(i){r.style.cssText=i}if(typeof t=="string"){r.appendChild(document.createTextNode(t))}else if(t){for(var o=0;o=t){return a+(t-o)}a+=s-o;a+=n-a%n;o=s+1}}var H=function(){this.id=null;this.f=null;this.time=0;this.handler=z(this.onTimeout,this)};function W(e,t){for(var n=0;n=t){return i+Math.min(a,t-r)}r+=o-i;r+=n-r%n;i=o+1;if(r>=t){return i}}}var G=[""];function X(e){while(G.length<=e){G.push(V(G)+" ")}return G[e]}function V(e){return e[e.length-1]}function K(e,t){var n=[];for(var i=0;i"€"&&(e.toUpperCase()!=e.toLowerCase()||ee.test(e))}function ne(e,t){if(!t){return te(e)}if(t.source.indexOf("\\w")>-1&&te(e)){return true}return t.test(e)}function ie(e){for(var t in e){if(e.hasOwnProperty(t)&&e[t]){return false}}return true}var re=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function oe(e){return e.charCodeAt(0)>=768&&re.test(e)}function ae(e,t,n){while((n<0?t>0:tn?-1:1;for(;;){if(t==n){return t}var r=(t+n)/2,o=i<0?Math.ceil(r):Math.floor(r);if(o==t){return e(o)?t:n}if(e(o)){n=o}else{t=o+i}}}function le(e,t,n,i){if(!e){return i(t,n,"ltr",0)}var r=false;for(var o=0;ot||t==n&&a.to==t){i(Math.max(a.from,t),Math.min(a.to,n),a.level==1?"rtl":"ltr",o);r=true}}if(!r){i(t,n,"ltr")}}var ue=null;function ce(e,t,n){var i;ue=null;for(var r=0;rt){return r}if(o.to==t){if(o.from!=o.to&&n=="before"){i=r}else{ue=r}}if(o.from==t){if(o.from!=o.to&&n!="before"){i=r}else{ue=r}}}return i!=null?i:ue}var fe=function(){var t="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN";var n="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function $(e){if(e<=247){return t.charAt(e)}else if(1424<=e&&e<=1524){return"R"}else if(1536<=e&&e<=1785){return n.charAt(e-1536)}else if(1774<=e&&e<=2220){return"r"}else if(8192<=e&&e<=8203){return"w"}else if(e==8204){return"b"}else{return"L"}}var H=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;var W=/[stwN]/,_=/[LRr]/,R=/[Lb1n]/,j=/[1n]/;function U(e,t,n){this.level=e;this.from=t;this.to=n}return function(e,t){var n=t=="ltr"?"L":"R";if(e.length==0||t=="ltr"&&!H.test(e)){return false}var i=e.length,r=[];for(var o=0;o-1){i[t]=r.slice(0,o).concat(r.slice(o+1))}}}}function ve(e,t){var n=me(e,t);if(!n.length){return}var i=Array.prototype.slice.call(arguments,2);for(var r=0;r0}function we(e){e.prototype.on=function(e,t){pe(this,e,t)};e.prototype.off=function(e,t){ge(this,e,t)}}function Ce(e){if(e.preventDefault){e.preventDefault()}else{e.returnValue=false}}function ke(e){if(e.stopPropagation){e.stopPropagation()}else{e.cancelBubble=true}}function Se(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==false}function Le(e){Ce(e);ke(e)}function Ee(e){return e.target||e.srcElement}function Me(e){var t=e.which;if(t==null){if(e.button&1){t=1}else if(e.button&2){t=3}else if(e.button&4){t=2}}if(y&&e.ctrlKey&&t==1){t=3}return t}var Te=function(){if(w&&C<9){return false}var e=N("div");return"draggable"in e||"dragDrop"in e}(),De,Ae;function Ne(e){if(De==null){var t=N("span","​");T(e,N("span",[t,document.createTextNode("x")]));if(e.firstChild.offsetHeight!=0){De=t.offsetWidth<=1&&t.offsetHeight>2&&!(w&&C<8)}}var n=De?N("span","​"):N("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");n.setAttribute("cm-text","");return n}function Oe(e){if(Ae!=null){return Ae}var t=T(e,document.createTextNode("AخA"));var n=E(t,0,1).getBoundingClientRect();var i=E(t,1,2).getBoundingClientRect();M(e);if(!n||n.left==n.right){return false}return Ae=i.right-n.right<3}var Fe="\n\nb".split(/\n/).length!=3?function(e){var t=0,n=[],i=e.length;while(t<=i){var r=e.indexOf("\n",t);if(r==-1){r=e.length}var o=e.slice(t,e.charAt(r-1)=="\r"?r-1:r);var a=o.indexOf("\r");if(a!=-1){n.push(o.slice(0,a));t+=a+1}else{n.push(o);t=r+1}}return n}:function(e){return e.split(/\r\n?|\n/)},Ie=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(e){return false}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(e){}if(!t||t.parentElement()!=e){return false}return t.compareEndPoints("StartToEnd",t)!=0},Pe=function(){var e=N("div");if("oncopy"in e){return true}e.setAttribute("oncopy","return;");return typeof e.oncopy=="function"}(),ze=null;function Be(e){if(ze!=null){return ze}var t=T(e,N("span","x"));var n=t.getBoundingClientRect();var i=E(t,0,1).getBoundingClientRect();return ze=Math.abs(n.left-i.left)>1}var $e={},He={};function We(e,t){if(2=e.size){throw new Error("There is no line "+(t+e.first)+" in the document.")}var n=e;while(!n.lines){for(var i=0;;++i){var r=n.children[i],o=r.chunkSize();if(t=e.first&&tn){return rt(n,Ke(e,n).text.length)}return dt(t,Ke(e,t.line).text.length)}function dt(e,t){var n=e.ch;if(n==null||n>t){return rt(e.line,t)}else if(n<0){return rt(e.line,0)}else{return e}}function ht(e,t){var n=[];for(var i=0;i=this.string.length},Ve.prototype.sol=function(){return this.pos==this.lineStart},Ve.prototype.peek=function(){return this.string.charAt(this.pos)||undefined},Ve.prototype.next=function(){if(this.post},Ve.prototype.eatSpace=function(){var e=this.pos;while(/[\s\u00a0]/.test(this.string.charAt(this.pos))){++this.pos}return this.pos>e},Ve.prototype.skipToEnd=function(){this.pos=this.string.length},Ve.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1){this.pos=t;return true}},Ve.prototype.backUp=function(e){this.pos-=e},Ve.prototype.column=function(){if(this.lastColumnPos0){return null}if(o&&t!==false){this.pos+=o[0].length}return o}},Ve.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ve.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ve.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ve.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var pt=function(e,t){this.state=e;this.lookAhead=t},mt=function(e,t,n,i){this.state=t;this.doc=e;this.line=n;this.maxLookAhead=i||0;this.baseTokens=null;this.baseTokenPos=1};function gt(t,n,i,e){var l=[t.state.modeGen],r={};Lt(t,n.text,t.doc.mode,i,function(e,t){return l.push(e,t)},r,e);var u=i.state;var o=function(e){i.baseTokens=l;var o=t.state.overlays[e],a=1,s=0;i.state=true;Lt(t,n.text,o.mode,i,function(e,t){var n=a;while(se){l.splice(a,1,e,l[a+1],i)}a+=2;s=Math.min(e,i)}if(!t){return}if(o.opaque){l.splice(n,a-n,e,"overlay "+t);a=n+2}else{for(;ne.options.maxHighlightLength&&qe(e.doc.mode,i.state);var o=gt(e,t,i);if(r){i.state=r}t.stateAfter=i.save(!r);t.styles=o.styles;if(o.classes){t.styleClasses=o.classes}else if(t.styleClasses){t.styleClasses=null}if(n===e.doc.highlightFrontier){e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier)}}return t.styles}function yt(n,i,e){var t=n.doc,r=n.display;if(!t.mode.startState){return new mt(t,true,i)}var o=Et(n,i,e);var a=o>t.first&&Ke(t,o-1).stateAfter;var s=a?mt.fromSaved(t,a,o):new mt(t,Xe(t.mode),o);t.iter(o,i,function(e){xt(n,e.text,s);var t=s.line;e.stateAfter=t==i-1||t%5==0||t>=r.viewFrom&&tt.start){return o}}throw new Error("Mode "+e.name+" failed to advance stream.")}mt.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);if(t!=null&&e>this.maxLookAhead){this.maxLookAhead=e}return t},mt.prototype.baseToken=function(e){if(!this.baseTokens){return null}while(this.baseTokens[this.baseTokenPos]<=e){this.baseTokenPos+=2}var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},mt.prototype.nextLine=function(){this.line++;if(this.maxLookAhead>0){this.maxLookAhead--}},mt.fromSaved=function(e,t,n){if(t instanceof pt){return new mt(e,qe(e.mode,t.state),n,t.lookAhead)}else{return new mt(e,qe(e.mode,t),n)}},mt.prototype.save=function(e){var t=e!==false?qe(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new pt(t,this.maxLookAhead):t};var Ct=function(e,t,n){this.start=e.start;this.end=e.pos;this.string=e.current();this.type=t||null;this.state=n};function kt(e,t,n,i){var r=e.doc,o=r.mode,a;t=ft(r,t);var s=Ke(r,t.line),l=yt(e,t.line,n);var u=new Ve(s.text,e.options.tabSize,l),c;if(i){c=[]}while((i||u.pose.options.maxHighlightLength){s=false;if(a){xt(e,t,i,c.pos)}c.pos=t.length;f=null}else{f=St(wt(n,c,i.state,d),o)}if(d){var h=d[0].name;if(h){f="m-"+(f?h+" "+f:h)}}if(!s||u!=f){while(la;--s){if(s<=o.first){return o.first}var l=Ke(o,s-1),u=l.stateAfter;if(u&&(!n||s+(u instanceof pt?u.lookAhead:0)<=o.modeFrontier)){return s}var c=$(l.text,null,e.options.tabSize);if(r==null||i>c){r=s-1;i=c}}return r}function Mt(e,t){e.modeFrontier=Math.min(e.modeFrontier,t);if(e.highlightFrontiern;i--){var r=Ke(e,i).stateAfter;if(r&&(!(r instanceof pt)||i+r.lookAhead=t:o.to>t);(i||(i=[])).push(new Ot(a,o.from,l?null:o.to))}}}return i}function Bt(e,t,n){var i;if(e){for(var r=0;r=t:o.to>t);if(s||o.from==t&&a.type=="bookmark"&&(!n||o.marker.insertLeft)){var l=o.from==null||(a.inclusiveLeft?o.from<=t:o.from0&&s){for(var b=0;b0){continue}var c=[l,1],f=ot(u.from,s.from),d=ot(u.to,s.to);if(f<0||!a.inclusiveLeft&&!f){c.push({from:u.from,to:s.from})}if(d>0||!a.inclusiveRight&&!d){c.push({from:s.to,to:u.to})}r.splice.apply(r,c);l+=c.length-3}}return r}function _t(e){var t=e.markedSpans;if(!t){return}for(var n=0;nt)&&(!i||Yt(i,o.marker)<0)){i=o.marker}}}return i}function Kt(e,t,n,i,r){var o=Ke(e,t);var a=Dt&&o.markedSpans;if(a){for(var s=0;s=0&&f<=0||c<=0&&f>=0){continue}if(c<=0&&(l.marker.inclusiveRight&&r.inclusiveLeft?ot(u.to,n)>=0:ot(u.to,n)>0)||c>=0&&(l.marker.inclusiveRight&&r.inclusiveLeft?ot(u.from,i)<=0:ot(u.from,i)<0)){return true}}}}function Qt(e){var t;while(t=Gt(e)){e=t.find(-1,true).line}return e}function Zt(e){var t;while(t=Xt(e)){e=t.find(1,true).line}return e}function Jt(e){var t,n;while(t=Xt(e)){e=t.find(1,true).line;(n||(n=[])).push(e)}return n}function en(e,t){var n=Ke(e,t),i=Qt(n);if(n==i){return t}return et(i)}function tn(e,t){if(t>e.lastLine()){return t}var n=Ke(e,t),i;if(!nn(e,n)){return t}while(i=Xt(n)){n=i.find(1,true).line}return et(n)+1}function nn(e,t){var n=Dt&&t.markedSpans;if(n){for(var i=void 0,r=0;rn.maxLineLength){n.maxLineLength=t;n.maxLine=e}})}var ln=function(e,t,n){this.text=e;Rt(this,t);this.height=n?n(this):1};function un(e,t,n,i){e.text=t;if(e.stateAfter){e.stateAfter=null}if(e.styles){e.styles=null}if(e.order!=null){e.order=null}_t(e);Rt(e,n);var r=i?i(e):1;if(r!=e.height){Je(e,r)}}function cn(e){e.parent=null;_t(e)}ln.prototype.lineNo=function(){return et(this)},we(ln);var fn={},dn={};function hn(e,t){if(!e||/^\s*$/.test(e)){return null}var n=t.addModeClass?dn:fn;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function pn(e,t){var n=D("span",null,null,g?"padding-right: .1px":null);var i={pre:D("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:false,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var r=0;r<=(t.rest?t.rest.length:0);r++){var o=r?t.rest[r-1]:t.line,a=void 0;i.pos=0;i.addToken=gn;if(Oe(e.display.measure)&&(a=de(o,e.doc.direction))){i.addToken=yn(i.addToken,a)}i.map=[];var s=t!=e.display.externalMeasured&&et(o);bn(o,i,vt(e,o,s));if(o.styleClasses){if(o.styleClasses.bgClass){i.bgClass=I(o.styleClasses.bgClass,i.bgClass||"")}if(o.styleClasses.textClass){i.textClass=I(o.styleClasses.textClass,i.textClass||"")}}if(i.map.length==0){i.map.push(0,0,i.content.appendChild(Ne(e.display.measure)))}if(r==0){t.measure.map=i.map;t.measure.cache={}}else{(t.measure.maps||(t.measure.maps=[])).push(i.map);(t.measure.caches||(t.measure.caches=[])).push({})}}if(g){var l=i.content.lastChild;if(/\bcm-tab\b/.test(l.className)||l.querySelector&&l.querySelector(".cm-tab")){i.content.className="cm-tab-wrap-hack"}}ve(e,"renderLine",e,t.line,i.pre);if(i.pre.className){i.textClass=I(i.pre.className,i.textClass||"")}return i}function mn(e){var t=N("span","•","cm-invalidchar");t.title="\\u"+e.charCodeAt(0).toString(16);t.setAttribute("aria-label",t.title);return t}function gn(e,t,n,i,r,o,a){if(!t){return}var s=e.splitSpaces?vn(t,e.trailingSpace):t;var l=e.cm.state.specialChars,u=false;var c;if(!l.test(t)){e.col+=t.length;c=document.createTextNode(s);e.map.push(e.pos,e.pos+t.length,c);if(w&&C<9){u=true}e.pos+=t.length}else{c=document.createDocumentFragment();var f=0;while(true){l.lastIndex=f;var d=l.exec(t);var h=d?d.index-f:t.length-f;if(h){var p=document.createTextNode(s.slice(f,f+h));if(w&&C<9){c.appendChild(N("span",[p]))}else{c.appendChild(p)}e.map.push(e.pos,e.pos+h,p);e.col+=h;e.pos+=h}if(!d){break}f+=h+1;var m=void 0;if(d[0]=="\t"){var g=e.cm.options.tabSize,v=g-e.col%g;m=c.appendChild(N("span",X(v),"cm-tab"));m.setAttribute("role","presentation");m.setAttribute("cm-text","\t");e.col+=v}else if(d[0]=="\r"||d[0]=="\n"){m=c.appendChild(N("span",d[0]=="\r"?"␍":"␤","cm-invalidchar"));m.setAttribute("cm-text",d[0]);e.col+=1}else{m=e.cm.options.specialCharPlaceholder(d[0]);m.setAttribute("cm-text",d[0]);if(w&&C<9){c.appendChild(N("span",[m]))}else{c.appendChild(m)}e.col+=1}e.map.push(e.pos,e.pos+1,m);e.pos++}}e.trailingSpace=s.charCodeAt(t.length-1)==32;if(n||i||r||u||o){var y=n||"";if(i){y+=i}if(r){y+=r}var x=N("span",[c],y,o);if(a){for(var b in a){if(a.hasOwnProperty(b)&&b!="style"&&b!="class"){x.setAttribute(b,a[b])}}}return e.content.appendChild(x)}e.content.appendChild(c)}function vn(e,t){if(e.length>1&&!/ /.test(e)){return e}var n=t,i="";for(var r=0;rs&&u.from<=s){break}}if(u.to>=l){return f(e,t,n,i,r,o,a)}f(e,t.slice(0,u.to-s),n,i,null,o,a);i=null;t=t.slice(u.to-s);s=u.to}}}function xn(e,t,n,i){var r=!i&&n.widgetNode;if(r){e.map.push(e.pos,e.pos+t,r)}if(!i&&e.cm.display.input.needsContentAttribute){if(!r){r=e.content.appendChild(document.createElement("span"))}r.setAttribute("cm-marker",n.id)}if(r){e.cm.display.input.setUneditable(r);e.content.appendChild(r)}e.pos+=t;e.trailingSpace=false}function bn(e,t,n){var i=e.markedSpans,r=e.text,o=0;if(!i){for(var a=1;al||k.collapsed&&C.to==l&&C.from==l)){if(C.to!=null&&C.to!=l&&h>C.to){h=C.to;m=""}if(k.className){p+=" "+k.className}if(k.css){d=(d?d+";":"")+k.css}if(k.startStyle&&C.from==l){g+=" "+k.startStyle}if(k.endStyle&&C.to==h){(b||(b=[])).push(k.endStyle,C.to)}if(k.title){(y||(y={})).title=k.title}if(k.attributes){for(var S in k.attributes){(y||(y={}))[S]=k.attributes[S]}}if(k.collapsed&&(!v||Yt(v.marker,k)<0)){v=C}}else if(C.from>l&&h>C.from){h=C.from}}if(b){for(var L=0;L=s){break}var M=Math.min(s,h);while(true){if(c){var T=l+c.length;if(!v){var D=T>M?c.slice(0,M-l):c;t.addToken(t,D,f?f+p:p,g,l+D.length==h?m:"",d,y)}if(T>=M){c=c.slice(M-l);l=M;break}l=T;g=""}c=r.slice(o,o=n[u++]);f=hn(n[u++],t.cm.options)}}}function wn(e,t,n){this.line=t;this.rest=Jt(t);this.size=this.rest?et(V(this.rest))-n+1:1;this.node=this.text=null;this.hidden=nn(e,t)}function Cn(e,t,n){var i=[],r;for(var o=t;o2){o.push((l.bottom+u.top)/2-n.top)}}}o.push(n.bottom-n.top)}}function Qn(e,t,n){if(e.line==t){return{map:e.measure.map,cache:e.measure.cache}}for(var i=0;in){return{map:e.measure.maps[r],cache:e.measure.caches[r],before:true}}}}function Zn(e,t){t=Qt(t);var n=et(t);var i=e.display.externalMeasured=new wn(e.doc,t,n);i.lineN=n;var r=i.built=pn(e,i);i.text=r.pre;T(e.display.lineMeasure,r.pre);return i}function Jn(e,t,n,i){return ni(e,ti(e,t),n,i)}function ei(e,t){if(t>=e.display.viewFrom&&t=n.lineN&&tt){o=l-s;r=o-1;if(t>=l){a="right"}}if(r!=null){i=e[u+2];if(s==l&&n==(i.insertLeft?"left":"right")){a=n}if(n=="left"&&r==0){while(u&&e[u-2]==e[u-3]&&e[u-1].insertLeft){i=e[(u-=3)+2];a="left"}}if(n=="right"&&r==l-s){while(u=0;r--){if((n=e[r]).left!=n.right){break}}}return n}function si(e,t,n,i){var r=oi(t.map,n,i);var o=r.node,a=r.start,s=r.end,l=r.collapse;var u;if(o.nodeType==3){for(var c=0;c<4;c++){while(a&&oe(t.line.text.charAt(r.coverStart+a))){--a}while(r.coverStart+s0){l=i="right"}var f;if(e.options.lineWrapping&&(f=o.getClientRects()).length>1){u=f[i=="right"?f.length-1:0]}else{u=o.getBoundingClientRect()}}if(w&&C<9&&!a&&(!u||!u.left&&!u.right)){var d=o.parentNode.getClientRects()[0];if(d){u={left:d.left,right:d.left+Di(e.display),top:d.top,bottom:d.bottom}}else{u=ii}}var h=u.top-t.rect.top,p=u.bottom-t.rect.top;var m=(h+p)/2;var g=t.view.measure.heights;var v=0;for(;v=o.text.length){t=o.text.length;n="before"}else if(t<=0){t=0;n="after"}if(!u){return l(n=="before"?t-1:t,n=="before")}function c(e,t,n){var i=u[t],r=i.level==1;return l(n?e-1:e,r!=n)}var f=ce(u,t,n);var d=ue;var h=c(t,f,n=="before");if(d!=null){h.other=c(t,d,n!="before")}return h}function xi(e,t){var n=0;t=ft(e.doc,t);if(!e.options.lineWrapping){n=Di(e.display)*t.ch}var i=Ke(e.doc,t.line);var r=on(i)+Un(e.display);return{left:n,right:n,top:r,bottom:r+i.height}}function bi(e,t,n,i,r){var o=rt(e,t,n);o.xRel=r;if(i){o.outside=i}return o}function wi(e,t,n){var i=e.doc;n+=e.display.viewOffset;if(n<0){return bi(i.first,0,null,-1,-1)}var r=tt(i,n),o=i.first+i.size-1;if(r>o){return bi(i.first+i.size-1,Ke(i,o).text.length,null,1,1)}if(t<0){t=0}var a=Ke(i,r);for(;;){var s=Li(e,a,r,t,n);var l=Vt(a,s.ch+(s.xRel>0||s.outside>0?1:0));if(!l){return s}var u=l.find(1);if(u.line==r){return u}a=Ke(i,r=u.line)}}function Ci(t,e,n,i){i-=pi(e);var r=e.text.length;var o=se(function(e){return ni(t,n,e-1).bottom<=i},r,0);r=se(function(e){return ni(t,n,e).top>i},o,r);return{begin:o,end:r}}function ki(e,t,n,i){if(!n){n=ti(e,t)}var r=mi(e,t,ni(e,n,i),"line").top;return Ci(e,t,n,r)}function Si(e,t,n,i){return e.bottom<=n?false:e.top>n?true:(i?e.left:e.right)>t}function Li(n,e,t,i,r){r-=on(e);var o=ti(n,e);var a=pi(e);var s=0,l=e.text.length,u=true;var c=de(e,n.doc.direction);if(c){var f=(n.options.lineWrapping?Mi:Ei)(n,e,t,o,c,i,r);u=f.level!=1;s=u?f.from:f.to-1;l=u?f.to:f.from-1}var d=null,h=null;var p=se(function(e){var t=ni(n,o,e);t.top+=a;t.bottom+=a;if(!Si(t,i,r,false)){return false}if(t.top<=r&&t.left<=i){d=e;h=t}return true},s,l);var m,g,v=false;if(h){var y=i-h.left=b.bottom?1:0}p=ae(e.text,p,1);return bi(t,p,g,v,i-m)}function Ei(i,r,o,a,s,l,u){var e=se(function(e){var t=s[e],n=t.level!=1;return Si(yi(i,rt(o,n?t.to:t.from,n?"before":"after"),"line",r,a),l,u,true)},0,s.length-1);var t=s[e];if(e>0){var n=t.level!=1;var c=yi(i,rt(o,n?t.from:t.to,n?"after":"before"),"line",r,a);if(Si(c,l,u,true)&&c.top>u){t=s[e-1]}}return t}function Mi(e,t,n,i,r,o,a){var s=Ci(e,t,i,a);var l=s.begin;var u=s.end;if(/\s/.test(t.text.charAt(u-1))){u--}var c=null,f=null;for(var d=0;d=u||h.to<=l){continue}var p=h.level!=1;var m=ni(e,i,p?Math.min(u,h.to)-1:Math.max(l,h.from)).right;var g=mg){c=h;f=g}}if(!c){c=r[r.length-1]}if(c.fromu){c={from:c.from,to:u,level:c.level}}return c}function Ti(e){if(e.cachedTextHeight!=null){return e.cachedTextHeight}if(ri==null){ri=N("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t){ri.appendChild(document.createTextNode("x"));ri.appendChild(N("br"))}ri.appendChild(document.createTextNode("x"))}T(e.measure,ri);var n=ri.offsetHeight/50;if(n>3){e.cachedTextHeight=n}M(e.measure);return n||1}function Di(e){if(e.cachedCharWidth!=null){return e.cachedCharWidth}var t=N("span","xxxxxxxxxx");var n=N("pre",[t],"CodeMirror-line-like");T(e.measure,n);var i=t.getBoundingClientRect(),r=(i.right-i.left)/10;if(r>2){e.cachedCharWidth=r}return r||10}function Ai(e){var t=e.display,n={},i={};var r=t.gutters.clientLeft;for(var o=t.gutters.firstChild,a=0;o;o=o.nextSibling,++a){var s=e.display.gutterSpecs[a].className;n[s]=o.offsetLeft+o.clientLeft+r;i[s]=o.clientWidth}return{fixedPos:Ni(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:i,wrapperWidth:t.wrapper.clientWidth}}function Ni(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Oi(i){var r=Ti(i.display),o=i.options.lineWrapping;var a=o&&Math.max(5,i.display.scroller.clientWidth/Di(i.display)-3);return function(e){if(nn(i.doc,e)){return 0}var t=0;if(e.widgets){for(var n=0;n0&&(u=Ke(e.doc,l.line).text).length==l.ch){var c=$(u,u.length,e.options.tabSize)-u.length;l=rt(l.line,Math.max(0,Math.round((o-qn(e.display).left)/Di(e.display))-c))}return l}function Pi(e,t){if(t>=e.display.viewTo){return null}t-=e.display.viewFrom;if(t<0){return null}var n=e.display.view;for(var i=0;it)){r.updateLineNumbers=t}e.curOp.viewChanged=true;if(t>=r.viewTo){if(Dt&&en(e.doc,t)r.viewFrom){$i(e)}else{r.viewFrom+=i;r.viewTo+=i}}else if(t<=r.viewFrom&&n>=r.viewTo){$i(e)}else if(t<=r.viewFrom){var o=Hi(e,n,n+i,1);if(o){r.view=r.view.slice(o.index);r.viewFrom=o.lineN;r.viewTo+=i}else{$i(e)}}else if(n>=r.viewTo){var a=Hi(e,t,t,-1);if(a){r.view=r.view.slice(0,a.index);r.viewTo=a.lineN}else{$i(e)}}else{var s=Hi(e,t,t,-1);var l=Hi(e,n,n+i,1);if(s&&l){r.view=r.view.slice(0,s.index).concat(Cn(e,s.lineN,l.lineN)).concat(r.view.slice(l.index));r.viewTo+=i}else{$i(e)}}var u=r.externalMeasured;if(u){if(n=r.lineN&&t=i.viewTo){return}var o=i.view[Pi(e,t)];if(o.node==null){return}var a=o.changes||(o.changes=[]);if(W(a,n)==-1){a.push(n)}}function $i(e){e.display.viewFrom=e.display.viewTo=e.doc.first;e.display.view=[];e.display.viewOffset=0}function Hi(e,t,n,i){var r=Pi(e,t),o,a=e.display.view;if(!Dt||n==e.doc.first+e.doc.size){return{index:r,lineN:n}}var s=e.display.viewFrom;for(var l=0;l0){if(r==a.length-1){return null}o=s+a[r].size-t;r++}else{o=s-t}t+=o;n+=o}while(en(e.doc,n)!=n){if(r==(i<0?0:a.length-1)){return null}n+=i*a[r-(i<0?1:0)].size;r+=i}return{index:r,lineN:n}}function Wi(e,t,n){var i=e.display,r=i.view;if(r.length==0||t>=i.viewTo||n<=i.viewFrom){i.view=Cn(e,t,n);i.viewFrom=t}else{if(i.viewFrom>t){i.view=Cn(e,t,i.viewFrom).concat(i.view)}else if(i.viewFromn){i.view=i.view.slice(0,Pi(e,n))}}i.viewTo=n}function _i(e){var t=e.display.view,n=0;for(var i=0;i=e.display.viewTo||s.to().line0){t.blinker=setInterval(function(){return t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate)}else if(e.options.cursorBlinkRate<0){t.cursorDiv.style.visibility="hidden"}}function Xi(e){if(!e.state.focused){e.display.input.focus();Ki(e)}}function Vi(e){e.state.delayingBlurEvent=true;setTimeout(function(){if(e.state.delayingBlurEvent){e.state.delayingBlurEvent=false;Qi(e)}},100)}function Ki(e,t){if(e.state.delayingBlurEvent){e.state.delayingBlurEvent=false}if(e.options.readOnly=="nocursor"){return}if(!e.state.focused){ve(e,"focus",e,t);e.state.focused=true;F(e.display.wrapper,"CodeMirror-focused");if(!e.curOp&&e.display.selForContextMenu!=e.doc.sel){e.display.input.reset();if(g){setTimeout(function(){return e.display.input.reset(true)},20)}}e.display.input.receivedFocus()}Gi(e)}function Qi(e,t){if(e.state.delayingBlurEvent){return}if(e.state.focused){ve(e,"blur",e,t);e.state.focused=false;L(e.display.wrapper,"CodeMirror-focused")}clearInterval(e.display.blinker);setTimeout(function(){if(!e.state.focused){e.display.shift=false}},150)}function Zi(e){var t=e.display;var n=t.lineDiv.offsetTop;for(var i=0;i.005||c<-.005){Je(r.line,a);Ji(r.line);if(r.rest){for(var f=0;fe.display.sizerWidth){var d=Math.ceil(s/Di(e.display));if(d>e.display.maxLineLength){e.display.maxLineLength=d;e.display.maxLine=r.line;e.display.maxLineChanged=true}}}}function Ji(e){if(e.widgets){for(var t=0;t=a){o=tt(t,on(Ke(t,l))-e.wrapper.clientHeight);a=l}}return{from:o,to:Math.max(a,o+1)}}function tr(e,t){if(ye(e,"scrollCursorIntoView")){return}var n=e.display,i=n.sizer.getBoundingClientRect(),r=null;if(t.top+i.top<0){r=true}else if(t.bottom+i.top>(window.innerHeight||document.documentElement.clientHeight)){r=false}if(r!=null&&!u){var o=N("div","​",null,"position: absolute;\n top: "+(t.top-n.viewOffset-Un(e.display))+"px;\n height: "+(t.bottom-t.top+Gn(e)+n.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(o);o.scrollIntoView(r);e.display.lineSpace.removeChild(o)}}function nr(e,t,n,i){if(i==null){i=0}var r;if(!e.options.lineWrapping&&t==n){t=t.ch?rt(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t;n=t.sticky=="before"?rt(t.line,t.ch+1,"before"):t}for(var o=0;o<5;o++){var a=false;var s=yi(e,t);var l=!n||n==t?s:yi(e,n);r={left:Math.min(s.left,l.left),top:Math.min(s.top,l.top)-i,right:Math.max(s.left,l.left),bottom:Math.max(s.bottom,l.bottom)+i};var u=rr(e,r);var c=e.doc.scrollTop,f=e.doc.scrollLeft;if(u.scrollTop!=null){fr(e,u.scrollTop);if(Math.abs(e.doc.scrollTop-c)>1){a=true}}if(u.scrollLeft!=null){hr(e,u.scrollLeft);if(Math.abs(e.doc.scrollLeft-f)>1){a=true}}if(!a){break}}return r}function ir(e,t){var n=rr(e,t);if(n.scrollTop!=null){fr(e,n.scrollTop)}if(n.scrollLeft!=null){hr(e,n.scrollLeft)}}function rr(e,t){var n=e.display,i=Ti(e.display);if(t.top<0){t.top=0}var r=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop;var o=Vn(e),a={};if(t.bottom-t.top>o){t.bottom=t.top+o}var s=e.doc.height+Yn(n);var l=t.tops-i;if(t.topr+o){var c=Math.min(t.top,(u?s:t.bottom)-o);if(c!=r){a.scrollTop=c}}var f=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft;var d=Xn(e)-(e.options.fixedGutter?n.gutters.offsetWidth:0);var h=t.right-t.left>d;if(h){t.right=t.left+d}if(t.left<10){a.scrollLeft=0}else if(t.leftd+f-3){a.scrollLeft=t.right+(h?0:10)-d}return a}function or(e,t){if(t==null){return}ur(e);e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function ar(e){ur(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function sr(e,t,n){if(t!=null||n!=null){ur(e)}if(t!=null){e.curOp.scrollLeft=t}if(n!=null){e.curOp.scrollTop=n}}function lr(e,t){ur(e);e.curOp.scrollToPos=t}function ur(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=xi(e,t.from),i=xi(e,t.to);cr(e,n,i,t.margin)}}function cr(e,t,n,i){var r=rr(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-i,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+i});sr(e,r.scrollLeft,r.scrollTop)}function fr(e,t){if(Math.abs(e.doc.scrollTop-t)<2){return}if(!m){Rr(e,{top:t})}dr(e,t,true);if(m){Rr(e)}Ir(e,100)}function dr(e,t,n){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t));if(e.display.scroller.scrollTop==t&&!n){return}e.doc.scrollTop=t;e.display.scrollbars.setScrollTop(t);if(e.display.scroller.scrollTop!=t){e.display.scroller.scrollTop=t}}function hr(e,t,n,i){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth));if((n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!i){return}e.doc.scrollLeft=t;qr(e);if(e.display.scroller.scrollLeft!=t){e.display.scroller.scrollLeft=t}e.display.scrollbars.setScrollLeft(t)}function pr(e){var t=e.display,n=t.gutters.offsetWidth;var i=Math.round(e.doc.height+Yn(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:i,scrollHeight:i+Gn(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var mr=function(e,t,n){this.cm=n;var i=this.vert=N("div",[N("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar");var r=this.horiz=N("div",[N("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");i.tabIndex=r.tabIndex=-1;e(i);e(r);pe(i,"scroll",function(){if(i.clientHeight){t(i.scrollTop,"vertical")}});pe(r,"scroll",function(){if(r.clientWidth){t(r.scrollLeft,"horizontal")}});this.checkedZeroWidth=false;if(w&&C<8){this.horiz.style.minHeight=this.vert.style.minWidth="18px"}};mr.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1;var n=e.scrollHeight>e.clientHeight+1;var i=e.nativeBarWidth;if(n){this.vert.style.display="block";this.vert.style.bottom=t?i+"px":"0";var r=e.viewHeight-(t?i:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+r)+"px"}else{this.vert.style.display="";this.vert.firstChild.style.height="0"}if(t){this.horiz.style.display="block";this.horiz.style.right=n?i+"px":"0";this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(n?i:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+o)+"px"}else{this.horiz.style.display="";this.horiz.firstChild.style.width="0"}if(!this.checkedZeroWidth&&e.clientHeight>0){if(i==0){this.zeroWidthHack()}this.checkedZeroWidth=true}return{right:n?i:0,bottom:t?i:0}},mr.prototype.setScrollLeft=function(e){if(this.horiz.scrollLeft!=e){this.horiz.scrollLeft=e}if(this.disableHoriz){this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")}},mr.prototype.setScrollTop=function(e){if(this.vert.scrollTop!=e){this.vert.scrollTop=e}if(this.disableVert){this.enableZeroWidthBar(this.vert,this.disableVert,"vert")}},mr.prototype.zeroWidthHack=function(){var e=y&&!l?"12px":"18px";this.horiz.style.height=this.vert.style.width=e;this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none";this.disableHoriz=new H;this.disableVert=new H},mr.prototype.enableZeroWidthBar=function(n,i,r){n.style.pointerEvents="auto";function o(){var e=n.getBoundingClientRect();var t=r=="vert"?document.elementFromPoint(e.right-1,(e.top+e.bottom)/2):document.elementFromPoint((e.right+e.left)/2,e.bottom-1);if(t!=n){n.style.pointerEvents="none"}else{i.set(1e3,o)}}i.set(1e3,o)},mr.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz);e.removeChild(this.vert)};var gr=function(){};function vr(e,t){if(!t){t=pr(e)}var n=e.display.barWidth,i=e.display.barHeight;yr(e,t);for(var r=0;r<4&&n!=e.display.barWidth||i!=e.display.barHeight;r++){if(n!=e.display.barWidth&&e.options.lineWrapping){Zi(e)}yr(e,pr(e));n=e.display.barWidth;i=e.display.barHeight}}function yr(e,t){var n=e.display;var i=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=i.right)+"px";n.sizer.style.paddingBottom=(n.barHeight=i.bottom)+"px";n.heightForcer.style.borderBottom=i.bottom+"px solid transparent";if(i.right&&i.bottom){n.scrollbarFiller.style.display="block";n.scrollbarFiller.style.height=i.bottom+"px";n.scrollbarFiller.style.width=i.right+"px"}else{n.scrollbarFiller.style.display=""}if(i.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter){n.gutterFiller.style.display="block";n.gutterFiller.style.height=i.bottom+"px";n.gutterFiller.style.width=t.gutterWidth+"px"}else{n.gutterFiller.style.display=""}}gr.prototype.update=function(){return{bottom:0,right:0}},gr.prototype.setScrollLeft=function(){},gr.prototype.setScrollTop=function(){},gr.prototype.clear=function(){};var xr={native:mr,null:gr};function br(n){if(n.display.scrollbars){n.display.scrollbars.clear();if(n.display.scrollbars.addClass){L(n.display.wrapper,n.display.scrollbars.addClass)}}n.display.scrollbars=new xr[n.options.scrollbarStyle](function(e){n.display.wrapper.insertBefore(e,n.display.scrollbarFiller);pe(e,"mousedown",function(){if(n.state.focused){setTimeout(function(){return n.display.input.focus()},0)}});e.setAttribute("cm-not-content","true")},function(e,t){if(t=="horizontal"){hr(n,e)}else{fr(n,e)}},n);if(n.display.scrollbars.addClass){F(n.display.wrapper,n.display.scrollbars.addClass)}}var wr=0;function Cr(e){e.curOp={cm:e,viewChanged:false,startHeight:e.doc.height,forceUpdate:false,updateInput:0,typing:false,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:false,updateMaxLine:false,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:false,id:++wr};Sn(e.curOp)}function kr(e){var t=e.curOp;if(t){En(t,function(e){for(var t=0;t=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping;e.update=e.mustUpdate&&new zr(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Er(e){e.updatedDisplay=e.mustUpdate&&Wr(e.cm,e.update)}function Mr(e){var t=e.cm,n=t.display;if(e.updatedDisplay){Zi(t)}e.barMeasure=pr(t);if(n.maxLineChanged&&!t.options.lineWrapping){e.adjustWidthTo=Jn(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+Gn(t)+t.display.barWidth);e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Xn(t))}if(e.updatedDisplay||e.selectionChanged){e.preparedSelection=n.input.prepareSelection()}}function Tr(e){var t=e.cm;if(e.adjustWidthTo!=null){t.display.sizer.style.minWidth=e.adjustWidthTo+"px";if(e.maxScrollLeft=l.display.viewTo){return}var c=+new Date+l.options.workTime;var f=yt(l,u.highlightFrontier);var d=[];u.iter(f.line,Math.min(u.first+u.size,l.display.viewTo+500),function(e){if(f.line>=l.display.viewFrom){var t=e.styles;var n=e.text.length>l.options.maxHighlightLength?qe(u.mode,f.state):null;var i=gt(l,e,f,true);if(n){f.state=n}e.styles=i.styles;var r=e.styleClasses,o=i.classes;if(o){e.styleClasses=o}else if(r){e.styleClasses=null}var a=!t||t.length!=e.styles.length||r!=o&&(!r||!o||r.bgClass!=o.bgClass||r.textClass!=o.textClass);for(var s=0;!a&&sc){Ir(l,l.options.workDelay);return true}});u.highlightFrontier=f.line;u.modeFrontier=Math.max(u.modeFrontier,f.line);if(d.length){Ar(l,function(){for(var e=0;e=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&_i(e)==0){return false}if(Gr(e)){$i(e);t.dims=Ai(e)}var r=i.first+i.size;var o=Math.max(t.visible.from-e.options.viewportMargin,i.first);var a=Math.min(r,t.visible.to+e.options.viewportMargin);if(n.viewFroma&&n.viewTo-a<20){a=Math.min(r,n.viewTo)}if(Dt){o=en(e.doc,o);a=tn(e.doc,a)}var s=o!=n.viewFrom||a!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Wi(e,o,a);n.viewOffset=on(Ke(e.doc,n.viewFrom));e.display.mover.style.top=n.viewOffset+"px";var l=_i(e);if(!s&&l==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)){return false}var u=$r(e);if(l>4){n.lineDiv.style.display="none"}jr(e,n.updateLineNumbers,t.dims);if(l>4){n.lineDiv.style.display=""}n.renderedView=n.view;Hr(u);M(n.cursorDiv);M(n.selectionDiv);n.gutters.style.height=n.sizer.style.minHeight=0;if(s){n.lastWrapHeight=t.wrapperHeight;n.lastWrapWidth=t.wrapperWidth;Ir(e,400)}n.updateLineNumbers=null;return true}function _r(e,t){var n=t.viewport;for(var i=true;;i=false){if(!i||!e.options.lineWrapping||t.oldDisplayWidth==Xn(e)){if(n&&n.top!=null){n={top:Math.min(e.doc.height+Yn(e.display)-Vn(e),n.top)}}t.visible=er(e.display,e.doc,n);if(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo){break}}else if(i){t.visible=er(e.display,e.doc,n)}if(!Wr(e,t)){break}Zi(e);var r=pr(e);Ri(e);vr(e,r);Yr(e,r);t.force=false}t.signal(e,"update",e);if(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 Rr(e,t){var n=new zr(e,t);if(Wr(e,n)){Zi(e);_r(e,n);var i=pr(e);Ri(e);vr(e,i);Yr(e,i);n.finish()}}function jr(n,e,t){var i=n.display,r=n.options.lineNumbers;var o=i.lineDiv,a=o.firstChild;function s(e){var t=e.nextSibling;if(g&&y&&n.display.currentWheelTarget==e){e.style.display="none"}else{e.parentNode.removeChild(e)}return t}var l=i.view,u=i.viewFrom;for(var c=0;c-1){h=false}An(n,f,u,t)}if(h){M(f.lineNumber);f.lineNumber.appendChild(document.createTextNode(it(n.options,u)))}a=f.node.nextSibling}u+=f.size}while(a){a=s(a)}}function Ur(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Yr(e,t){e.display.sizer.style.minHeight=t.docHeight+"px";e.display.heightForcer.style.top=t.docHeight+"px";e.display.gutters.style.height=t.docHeight+e.display.barHeight+Gn(e)+"px"}function qr(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter)){return}var i=Ni(t)-t.scroller.scrollLeft+e.doc.scrollLeft;var r=t.gutters.offsetWidth,o=i+"px";for(var a=0;aa.clientWidth;var l=a.scrollHeight>a.clientHeight;if(!(i&&s||r&&l)){return}if(r&&y&&g){e:for(var u=t.target,c=o.view;u!=a;u=u.parentNode){for(var f=0;f=0&&ot(e,i.to())<=0){return n}}return-1};var ro=function(e,t){this.anchor=e;this.head=t};function oo(e,t,n){var i=e&&e.options.selectionsMayTouch;var r=t[n];t.sort(function(e,t){return ot(e.from(),t.from())});n=W(t,r);for(var o=1;o0:l>=0){var u=ut(s.from(),a.from()),c=lt(s.to(),a.to());var f=s.empty()?a.from()==a.head:s.from()==s.head;if(o<=n){--n}t.splice(--o,2,new ro(f?c:u,f?u:c))}}return new io(t,n)}function ao(e,t){return new io([new ro(e,t||e)],0)}function so(e){if(!e.text){return e.to}return rt(e.from.line+e.text.length-1,V(e.text).length+(e.text.length==1?e.from.ch:0))}function lo(e,t){if(ot(e,t.from)<0){return e}if(ot(e,t.to)<=0){return so(t)}var n=e.line+t.text.length-(t.to.line-t.from.line)-1,i=e.ch;if(e.line==t.to.line){i+=so(t).ch-t.to.ch}return rt(n,i)}function uo(e,t){var n=[];for(var i=0;i1){e.remove(s.line+1,p-1)}e.insert(s.line+1,v)}Tn(e,"change",e,i)}function vo(e,a,s){function l(e,t,n){if(e.linked){for(var i=0;i1&&!e.done[e.done.length-2].ranges){e.done.pop();return V(e.done)}}function Lo(e,t,n,i){var r=e.history;r.undone.length=0;var o=+new Date,a;var s;if((r.lastOp==i||r.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&r.lastModTime>o-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(a=So(r,r.lastOp==i))){s=V(a.changes);if(ot(t.from,t.to)==0&&ot(t.from,s.to)==0){s.to=so(t)}else{a.changes.push(Co(e,t))}}else{var l=V(r.done);if(!l||!l.ranges){To(e.sel,r.done)}a={changes:[Co(e,t)],generation:r.generation};r.done.push(a);while(r.done.length>r.undoDepth){r.done.shift();if(!r.done[0].ranges){r.done.shift()}}}r.done.push(n);r.generation=++r.maxGeneration;r.lastModTime=r.lastSelTime=o;r.lastOp=r.lastSelOp=i;r.lastOrigin=r.lastSelOrigin=t.origin;if(!s){ve(e,"historyAdded")}}function Eo(e,t,n,i){var r=t.charAt(0);return r=="*"||r=="+"&&n.ranges.length==i.ranges.length&&n.somethingSelected()==i.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function Mo(e,t,n,i){var r=e.history,o=i&&i.origin;if(n==r.lastSelOp||o&&r.lastSelOrigin==o&&(r.lastModTime==r.lastSelTime&&r.lastOrigin==o||Eo(e,o,V(r.done),t))){r.done[r.done.length-1]=t}else{To(t,r.done)}r.lastSelTime=+new Date;r.lastSelOrigin=o;r.lastSelOp=n;if(i&&i.clearRedo!==false){ko(r.undone)}}function To(e,t){var n=V(t);if(!(n&&n.ranges&&n.equals(e))){t.push(e)}}function Do(t,n,e,i){var r=n["spans_"+t.id],o=0;t.iter(Math.max(t.first,e),Math.min(t.first+t.size,i),function(e){if(e.markedSpans){(r||(r=n["spans_"+t.id]={}))[o]=e.markedSpans}++o})}function Ao(e){if(!e){return null}var t;for(var n=0;n-1){V(s)[f]=u[f];delete u[f]}}}}}}return i}function Io(e,t,n,i){if(i){var r=e.anchor;if(n){var o=ot(t,r)<0;if(o!=ot(n,r)<0){r=t;t=n}else if(o!=ot(t,n)<0){t=n}}return new ro(r,t)}else{return new ro(n||t,t)}}function Po(e,t,n,i,r){if(r==null){r=e.cm&&(e.cm.display.shift||e.extend)}_o(e,new io([Io(e.sel.primary(),t,n,r)],0),i)}function zo(e,t,n){var i=[];var r=e.cm&&(e.cm.display.shift||e.extend);for(var o=0;o=t.ch:s.to>t.ch))){if(r){ve(l,"beforeCursorEnter");if(l.explicitlyCleared){if(!o.markedSpans){break}else{--a;continue}}}if(!l.atomic){continue}if(n){var f=l.find(i<0?1:-1),d=void 0;if(i<0?c:u){f=Xo(e,f,-i,f&&f.line==t.line?o:null)}if(f&&f.line==t.line&&(d=ot(f,n))&&(i<0?d<0:d>0)){return qo(e,f,t,i,r)}}var h=l.find(i<0?-1:1);if(i<0?u:c){h=Xo(e,h,i,h.line==t.line?o:null)}return h?qo(e,h,t,i,r):null}}}return t}function Go(e,t,n,i,r){var o=i||1;var a=qo(e,t,n,o,r)||!r&&qo(e,t,n,o,true)||qo(e,t,n,-o,r)||!r&&qo(e,t,n,-o,true);if(!a){e.cantEdit=true;return rt(e.first,0)}return a}function Xo(e,t,n,i){if(n<0&&t.ch==0){if(t.line>e.first){return ft(e,rt(t.line-1))}else{return null}}else if(n>0&&t.ch==(i||Ke(e,t.line)).text.length){if(t.line=0;--r){Zo(e,{from:i[r].from,to:i[r].to,text:r?[""]:t.text,origin:t.origin})}}else{Zo(e,t)}}function Zo(e,n){if(n.text.length==1&&n.text[0]==""&&ot(n.from,n.to)==0){return}var t=uo(e,n);Lo(e,n,t,e.cm?e.cm.curOp.id:NaN);ta(e,n,t,$t(e,n));var i=[];vo(e,function(e,t){if(!t&&W(i,e.history)==-1){aa(e.history,n);i.push(e.history)}ta(e,n,null,$t(e,n))})}function Jo(r,o,e){var t=r.cm&&r.cm.state.suppressEdits;if(t&&!e){return}var n=r.history,a,i=r.sel;var s=o=="undo"?n.done:n.undone,l=o=="undo"?n.undone:n.done;var u=0;for(;u=0;--h){var p=d(h);if(p)return p.v}}function ea(e,t){if(t==0){return}e.first+=t;e.sel=new io(K(e.sel.ranges,function(e){return new ro(rt(e.anchor.line+t,e.anchor.ch),rt(e.head.line+t,e.head.ch))}),e.sel.primIndex);if(e.cm){zi(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,i=n.viewFrom;ie.lastLine()){return}if(t.from.lineo){t={from:t.from,to:rt(o,Ke(e,o).text.length),text:[t.text[0]],origin:t.origin}}t.removed=Qe(e,t.from,t.to);if(!n){n=uo(e,t)}if(e.cm){na(e.cm,t,i)}else{go(e,t,i)}Ro(e,n,j);if(e.cantEdit&&Go(e,rt(e.firstLine(),0))){e.cantEdit=false}}function na(e,t,n){var i=e.doc,r=e.display,o=t.from,a=t.to;var s=false,l=o.line;if(!e.options.lineWrapping){l=et(Qt(Ke(i,o.line)));i.iter(l,a.line+1,function(e){if(e==r.maxLine){s=true;return true}})}if(i.sel.contains(t.from,t.to)>-1){xe(e)}go(i,t,n,Oi(e));if(!e.options.lineWrapping){i.iter(l,o.line+t.text.length,function(e){var t=an(e);if(t>r.maxLineLength){r.maxLine=e;r.maxLineLength=t;r.maxLineChanged=true;s=false}});if(s){e.curOp.updateMaxLine=true}}Mt(i,o.line);Ir(e,400);var u=t.text.length-(a.line-o.line)-1;if(t.full){zi(e)}else if(o.line==a.line&&t.text.length==1&&!mo(e.doc,t)){Bi(e,o.line,"text")}else{zi(e,o.line,a.line+1,u)}var c=be(e,"changes"),f=be(e,"change");if(f||c){var d={from:o,to:a,text:t.text,removed:t.removed,origin:t.origin};if(f){Tn(e,"change",e,d)}if(c){(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(d)}}e.display.selForContextMenu=null}function ia(e,t,n,i,r){var o;if(!i){i=n}if(ot(i,n)<0){o=[i,n],n=o[0],i=o[1]}if(typeof t=="string"){t=e.splitLines(t)}Qo(e,{from:n,to:i,text:t,origin:r})}function ra(e,t,n,i){if(n1||!(this.children[0]instanceof la))){var s=[];this.collapse(s);this.children=[new la(s)];this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){var a=r.lines.length%25+25;for(var s=a;s10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var i=0;i0||a==0&&o.clearWhenEmpty!==false){return o}if(o.replacedWith){o.collapsed=true;o.widgetNode=D("span",[o.replacedWith],"CodeMirror-widget");if(!e.handleMouseEvents){o.widgetNode.setAttribute("cm-ignore-events","true")}if(e.insertLeft){o.widgetNode.insertLeft=true}}if(o.collapsed){if(Kt(t,n.line,n,i,o)||n.line!=i.line&&Kt(t,i.line,n,i,o)){throw new Error("Inserting collapsed marker partially overlapping an existing one")}Nt()}if(o.addToHistory){Lo(t,{from:n,to:i,origin:"markText"},t.sel,NaN)}var s=n.line,l=t.cm,u;t.iter(s,i.line+1,function(e){if(l&&o.collapsed&&!l.options.lineWrapping&&Qt(e)==l.display.maxLine){u=true}if(o.collapsed&&s!=n.line){Je(e,0)}Pt(e,new Ot(o,s==n.line?n.ch:null,s==i.line?i.ch:null));++s});if(o.collapsed){t.iter(n.line,i.line+1,function(e){if(nn(t,e)){Je(e,0)}})}if(o.clearOnEnter){pe(o,"beforeCursorEnter",function(){return o.clear()})}if(o.readOnly){At();if(t.history.done.length||t.history.undone.length){t.clearHistory()}}if(o.collapsed){o.id=++ha;o.atomic=true}if(l){if(u){l.curOp.updateMaxLine=true}if(o.collapsed){zi(l,n.line,i.line+1)}else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title){for(var c=n.line;c<=i.line;c++){Bi(l,c,"text")}}if(o.atomic){Uo(l.doc)}Tn(l,"markerAdded",l,o)}return o}pa.prototype.clear=function(){if(this.explicitlyCleared){return}var e=this.doc.cm,t=e&&!e.curOp;if(t){Cr(e)}if(be(this,"clear")){var n=this.find();if(n){Tn(this,"clear",n.from,n.to)}}var i=null,r=null;for(var o=0;oe.display.maxLineLength){e.display.maxLine=u;e.display.maxLineLength=c;e.display.maxLineChanged=true}}}if(i!=null&&e&&this.collapsed){zi(e,i,r+1)}this.lines.length=0;this.explicitlyCleared=true;if(this.atomic&&this.doc.cantEdit){this.doc.cantEdit=false;if(e){Uo(e.doc)}}if(e){Tn(e,"markerCleared",e,this,i,r)}if(t){kr(e)}if(this.parent){this.parent.clear()}},pa.prototype.find=function(e,t){if(e==null&&this.type=="bookmark"){e=1}var n,i;for(var r=0;r=0;l--){Qo(this,i[l])}if(s){Wo(this,s)}else if(this.cm){ar(this.cm)}}),undo:Fr(function(){Jo(this,"undo")}),redo:Fr(function(){Jo(this,"redo")}),undoSelection:Fr(function(){Jo(this,"undo",true)}),redoSelection:Fr(function(){Jo(this,"redo",true)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){var e=this.history,t=0,n=0;for(var i=0;i=e.ch)){t.push(r.marker.parent||r.marker)}}}return t},findMarks:function(r,o,a){r=ft(this,r);o=ft(this,o);var s=[],l=r.line;this.iter(r.line,o.line+1,function(e){var t=e.markedSpans;if(t){for(var n=0;n=i.to||i.from==null&&l!=r.line||i.from!=null&&l==o.line&&i.from>=o.ch)&&(!a||a(i.marker))){s.push(i.marker.parent||i.marker)}}}++l});return s},getAllMarks:function(){var i=[];this.iter(function(e){var t=e.markedSpans;if(t){for(var n=0;nn){i=n;return true}n-=t;++r});return ft(this,rt(r,i))},indexFromPos:function(e){e=ft(this,e);var t=e.ch;if(e.linet){t=e.from}if(e.to!=null&&e.to-1){i.state.draggingText(e);setTimeout(function(){return i.display.input.focus()},20);return}try{var c=e.dataTransfer.getData("Text");if(c){var f;if(i.state.draggingText&&!i.state.draggingText.copy){f=i.listSelections()}Ro(i.doc,ao(t,t));if(f){for(var d=0;d=0;e--){ia(t.doc,"",i[e].from,i[e].to,"+delete")}ar(t)})}function qa(e,t,n){var i=ae(e.text,t+n,n);return i<0||i>e.text.length?null:i}function Ga(e,t,n){var i=qa(e,t.ch,n);return i==null?null:new rt(t.line,i,n<0?"after":"before")}function Xa(e,t,n,i,r){if(e){if(t.doc.direction=="rtl"){r=-r}var o=de(n,t.doc.direction);if(o){var a=r<0?V(o):o[0];var s=r<0==(a.level==1);var l=s?"after":"before";var u;if(a.level>0||t.doc.direction=="rtl"){var c=ti(t,n);u=r<0?n.text.length-1:0;var f=ni(t,c,u).top;u=se(function(e){return ni(t,c,e).top==f},r<0==(a.level==1)?a.from:a.to-1,u);if(l=="before"){u=qa(n,u,1)}}else{u=r<0?a.to:a.from}return new rt(i,u,l)}}return new rt(i,r<0?n.text.length:0,r<0?"before":"after")}function Va(t,n,s,e){var l=de(n,t.doc.direction);if(!l){return Ga(n,s,e)}if(s.ch>=n.text.length){s.ch=n.text.length;s.sticky="before"}else if(s.ch<=0){s.ch=0;s.sticky="after"}var i=ce(l,s.ch,s.sticky),r=l[i];if(t.doc.direction=="ltr"&&r.level%2==0&&(e>0?r.to>s.ch:r.from=r.from&&d>=c.begin:d<=r.to&&d<=c.end)){var h=f?"before":"after";return new rt(s.line,d,h)}}var p=function(e,t,n){var i=function(e,t){return t?new rt(s.line,u(e,1),"before"):new rt(s.line,e,"after")};for(;e>=0&&e0==(r.level!=1);var a=o?n.begin:u(n.end,-1);if(r.from<=a&&a0?c.end:u(c.begin,-1);if(g!=null&&!(e>0&&g==n.text.length)){m=p(e>0?0:l.length-1,e,a(g));if(m){return m}}return null}Ba.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},Ba.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},Ba.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},Ba.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},Ba["default"]=y?Ba.macDefault:Ba.pcDefault;var Ka={selectAll:Vo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),j)},killLine:function(n){return Ya(n,function(e){if(e.empty()){var t=Ke(n.doc,e.head.line).text.length;if(e.head.ch==t&&e.head.line0){i=new rt(i.line,i.ch+1);a.replaceRange(r.charAt(i.ch-1)+r.charAt(i.ch-2),rt(i.line,i.ch-2),i,"+transpose")}else if(i.line>a.doc.first){var o=Ke(a.doc,i.line-1).text;if(o){i=new rt(i.line,1);a.replaceRange(r.charAt(0)+a.doc.lineSeparator()+o.charAt(o.length-1),rt(i.line-1,o.length-1),i,"+transpose")}}}t.push(new ro(i,i))}a.setSelections(t)})},newlineAndIndent:function(i){return Ar(i,function(){var e=i.listSelections();for(var t=e.length-1;t>=0;t--){i.replaceRange(i.doc.lineSeparator(),e[t].anchor,e[t].head,"+input")}e=i.listSelections();for(var n=0;n-1&&(ot((a=o.ranges[a]).from(),t)<0||t.xRel>0)&&(ot(a.to(),t)>0||t.xRel<0)){ws(e,i,t,r)}else{ks(e,i,t,r)}}function ws(t,n,i,r){var o=t.display,a=false;var s=Nr(t,function(e){if(g){o.scroller.draggable=false}t.state.draggingText=false;ge(o.wrapper.ownerDocument,"mouseup",s);ge(o.wrapper.ownerDocument,"mousemove",l);ge(o.scroller,"dragstart",u);ge(o.scroller,"drop",s);if(!a){Ce(e);if(!r.addNew){Po(t.doc,i,null,null,r.extend)}if(g||w&&C==9){setTimeout(function(){o.wrapper.ownerDocument.body.focus();o.input.focus()},20)}else{o.input.focus()}}});var l=function(e){a=a||Math.abs(n.clientX-e.clientX)+Math.abs(n.clientY-e.clientY)>=10};var u=function(){return a=true};if(g){o.scroller.draggable=true}t.state.draggingText=s;s.copy=!r.moveOnDrag;if(o.scroller.dragDrop){o.scroller.dragDrop()}pe(o.wrapper.ownerDocument,"mouseup",s);pe(o.wrapper.ownerDocument,"mousemove",l);pe(o.scroller,"dragstart",u);pe(o.scroller,"drop",s);Vi(t);setTimeout(function(){return o.input.focus()},20)}function Cs(e,t,n){if(n=="char"){return new ro(t,t)}if(n=="word"){return e.findWordAt(t)}if(n=="line"){return new ro(rt(t.line,0),ft(e.doc,rt(t.line+1,0)))}var i=n(e,t);return new ro(i.from,i.to)}function ks(g,e,v,y){var o=g.display,x=g.doc;Ce(e);var b,w,C=x.sel,t=C.ranges;if(y.addNew&&!y.extend){w=x.sel.contains(v);if(w>-1){b=t[w]}else{b=new ro(v,v)}}else{b=x.sel.primary();w=x.sel.primIndex}if(y.unit=="rectangle"){if(!y.addNew){b=new ro(v,v)}v=Ii(g,e,true,true);w=-1}else{var n=Cs(g,v,y.unit);if(y.extend){b=Io(b,n.anchor,n.head,y.extend)}else{b=n}}if(!y.addNew){w=0;_o(x,new io([b],0),U);C=x.sel}else if(w==-1){w=t.length;_o(x,oo(g,t.concat([b]),w),{scroll:false,origin:"*mouse"})}else if(t.length>1&&t[w].empty()&&y.unit=="char"&&!y.extend){_o(x,oo(g,t.slice(0,w).concat(t.slice(w+1)),0),{scroll:false,origin:"*mouse"});C=x.sel}else{Bo(x,w,b,U)}var k=v;function a(e){if(ot(k,e)==0){return}k=e;if(y.unit=="rectangle"){var t=[],n=g.options.tabSize;var i=$(Ke(x,v.line).text,v.ch,n);var r=$(Ke(x,e.line).text,e.ch,n);var o=Math.min(i,r),a=Math.max(i,r);for(var s=Math.min(v.line,e.line),l=Math.min(g.lastLine(),Math.max(v.line,e.line));s<=l;s++){var u=Ke(x,s).text,c=q(u,o,n);if(o==a){t.push(new ro(rt(s,c),rt(s,c)))}else if(u.length>c){t.push(new ro(rt(s,c),rt(s,q(u,a,n))))}}if(!t.length){t.push(new ro(v,v))}_o(x,oo(g,C.ranges.slice(0,w).concat(t),w),{origin:"*mouse",scroll:false});g.scrollIntoView(e)}else{var f=b;var d=Cs(g,e,y.unit);var h=f.anchor,p;if(ot(d.anchor,h)>0){p=d.head;h=ut(f.from(),d.anchor)}else{p=d.anchor;h=lt(f.to(),d.head)}var m=C.ranges.slice(0);m[w]=Ss(g,new ro(ft(x,h),p));_o(x,oo(g,m,w),U)}}var s=o.wrapper.getBoundingClientRect();var l=0;function u(e){var t=++l;var n=Ii(g,e,true,y.unit=="rectangle");if(!n){return}if(ot(n,k)!=0){g.curOp.focus=O();a(n);var i=er(o,x);if(n.line>=i.to||n.lines.bottom?20:0;if(r){setTimeout(Nr(g,function(){if(l!=t){return}o.scroller.scrollTop+=r;u(e)}),50)}}}function i(e){g.state.selectingText=false;l=Infinity;if(e){Ce(e);o.input.focus()}ge(o.wrapper.ownerDocument,"mousemove",r);ge(o.wrapper.ownerDocument,"mouseup",c);x.history.lastSelOrigin=null}var r=Nr(g,function(e){if(e.buttons===0||!Me(e)){i(e)}else{u(e)}});var c=Nr(g,i);g.state.selectingText=c;pe(o.wrapper.ownerDocument,"mousemove",r);pe(o.wrapper.ownerDocument,"mouseup",c)}function Ss(e,t){var n=t.anchor;var i=t.head;var r=Ke(e.doc,n.line);if(ot(n,i)==0&&n.sticky==i.sticky){return t}var o=de(r);if(!o){return t}var a=ce(o,n.ch,n.sticky),s=o[a];if(s.from!=n.ch&&s.to!=n.ch){return t}var l=a+(s.from==n.ch==(s.level!=1)?0:1);if(l==0||l==o.length){return t}var u;if(i.line!=n.line){u=(i.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0}else{var c=ce(o,i.ch,i.sticky);var f=c-a||(i.ch-n.ch)*(s.level==1?-1:1);if(c==l-1||c==l){u=f<0}else{u=f>0}}var d=o[l+(u?-1:0)];var h=u==(d.level==1);var p=h?d.from:d.to,m=h?"after":"before";return n.ch==p&&n.sticky==m?t:new ro(new rt(n.line,p,m),i)}function Ls(e,t,n,i){var r,o;if(t.touches){r=t.touches[0].clientX;o=t.touches[0].clientY}else{try{r=t.clientX;o=t.clientY}catch(t){return false}}if(r>=Math.floor(e.display.gutters.getBoundingClientRect().right)){return false}if(i){Ce(t)}var a=e.display;var s=a.lineDiv.getBoundingClientRect();if(o>s.bottom||!be(e,n)){return Se(t)}o-=s.top-a.viewOffset;for(var l=0;l=r){var c=tt(e.doc,o);var f=e.display.gutterSpecs[l];ve(e,n,e,c,f.className,t);return Se(t)}}}function Es(e,t){return Ls(e,t,"gutterClick",true)}function Ms(e,t){if(jn(e.display,t)||Ts(e,t)){return}if(ye(e,t,"contextmenu")){return}if(!k){e.display.input.onContextMenu(t)}}function Ts(e,t){if(!be(e,"gutterContextMenu")){return false}return Ls(e,t,"gutterContextMenu",false)}function Ds(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-");fi(e)}hs.prototype.compare=function(e,t,n){return this.time+ds>e&&ot(t,this.pos)==0&&n==this.button};var As={toString:function(){return"CodeMirror.Init"}},Ns={},Os={};function Fs(r){var o=r.optionHandlers;function e(e,t,i,n){r.defaults[e]=t;if(i){o[e]=n?function(e,t,n){if(n!=As){i(e,t,n)}}:i}}r.defineOption=e;r.Init=As;e("value","",function(e,t){return e.setValue(t)},true);e("mode",null,function(e,t){e.doc.modeOption=t;ho(e)},true);e("indentUnit",2,ho,true);e("indentWithTabs",false);e("smartIndent",true);e("tabSize",4,function(e){po(e);fi(e);zi(e)},true);e("lineSeparator",null,function(e,i){e.doc.lineSep=i;if(!i){return}var r=[],o=e.doc.first;e.doc.iter(function(e){for(var t=0;;){var n=e.text.indexOf(i,t);if(n==-1){break}t=n+i.length;r.push(rt(o,n))}o++});for(var t=r.length-1;t>=0;t--){ia(e.doc,i,r[t],rt(r[t].line,r[t].ch+i.length))}});e("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(e,t,n){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g");if(n!=As){e.refresh()}});e("specialCharPlaceholder",mn,function(e){return e.refresh()},true);e("electricChars",true);e("inputStyle",d?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},true);e("spellcheck",false,function(e,t){return e.getInputField().spellcheck=t},true);e("autocorrect",false,function(e,t){return e.getInputField().autocorrect=t},true);e("autocapitalize",false,function(e,t){return e.getInputField().autocapitalize=t},true);e("rtlMoveVisually",!p);e("wholeLineUpdateBefore",true);e("theme","default",function(e){Ds(e);Kr(e)},true);e("keyMap","default",function(e,t,n){var i=Ua(t);var r=n!=As&&Ua(n);if(r&&r.detach){r.detach(e,i)}if(i.attach){i.attach(e,r||null)}});e("extraKeys",null);e("configureMouse",null);e("lineWrapping",false,Ps,true);e("gutters",[],function(e,t){e.display.gutterSpecs=Xr(t,e.options.lineNumbers);Kr(e)},true);e("fixedGutter",true,function(e,t){e.display.gutters.style.left=t?Ni(e.display)+"px":"0";e.refresh()},true);e("coverGutterNextToScrollbar",false,function(e){return vr(e)},true);e("scrollbarStyle","native",function(e){br(e);vr(e);e.display.scrollbars.setScrollTop(e.doc.scrollTop);e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},true);e("lineNumbers",false,function(e,t){e.display.gutterSpecs=Xr(e.options.gutters,t);Kr(e)},true);e("firstLineNumber",1,Kr,true);e("lineNumberFormatter",function(e){return e},Kr,true);e("showCursorWhenSelecting",false,Ri,true);e("resetSelectionOnContextMenu",true);e("lineWiseCopyCut",true);e("pasteLinesPerSelection",true);e("selectionsMayTouch",false);e("readOnly",false,function(e,t){if(t=="nocursor"){Qi(e);e.display.input.blur()}e.display.input.readOnlyChanged(t)});e("disableInput",false,function(e,t){if(!t){e.display.input.reset()}},true);e("dragDrop",true,Is);e("allowDropFileTypes",null);e("cursorBlinkRate",530);e("cursorScrollMargin",0);e("cursorHeight",1,Ri,true);e("singleCursorHeightPerLine",true,Ri,true);e("workTime",100);e("workDelay",100);e("flattenSpans",true,po,true);e("addModeClass",false,po,true);e("pollInterval",100);e("undoDepth",200,function(e,t){return e.doc.history.undoDepth=t});e("historyEventDelay",1250);e("viewportMargin",10,function(e){return e.refresh()},true);e("maxHighlightLength",1e4,po,true);e("moveInputWithCursor",true,function(e,t){if(!t){e.display.input.resetPosition()}});e("tabindex",null,function(e,t){return e.display.input.getField().tabIndex=t||""});e("autofocus",null);e("direction","ltr",function(e,t){return e.doc.setDirection(t)},true);e("phrases",null)}function Is(e,t,n){var i=n&&n!=As;if(!t!=!i){var r=e.display.dragFunctions;var o=t?pe:ge;o(e.display.scroller,"dragstart",r.start);o(e.display.scroller,"dragenter",r.enter);o(e.display.scroller,"dragover",r.over);o(e.display.scroller,"dragleave",r.leave);o(e.display.scroller,"drop",r.drop)}}function Ps(e){if(e.options.lineWrapping){F(e.display.wrapper,"CodeMirror-wrap");e.display.sizer.style.minWidth="";e.display.sizerWidth=null}else{L(e.display.wrapper,"CodeMirror-wrap");sn(e)}Fi(e);zi(e);fi(e);setTimeout(function(){return vr(e)},100)}function zs(e,t){var n=this;if(!(this instanceof zs)){return new zs(e,t)}this.options=t=t?B(t):{};B(Ns,t,false);var i=t.value;if(typeof i=="string"){i=new Ca(i,t.mode,null,t.lineSeparator,t.direction)}else if(t.mode){i.modeOption=t.mode}this.doc=i;var r=new zs.inputStyles[t.inputStyle](this);var o=this.display=new Qr(e,i,r,t);o.wrapper.CodeMirror=this;Ds(this);if(t.lineWrapping){this.display.wrapper.className+=" CodeMirror-wrap"}br(this);this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:false,delayingBlurEvent:false,focused:false,suppressEdits:false,pasteIncoming:-1,cutIncoming:-1,selectingText:false,draggingText:false,highlight:new H,keySeq:null,specialChars:null};if(t.autofocus&&!d){o.input.focus()}if(w&&C<11){setTimeout(function(){return n.display.input.reset(true)},20)}Bs(this);Aa();Cr(this);this.curOp.forceUpdate=true;yo(this,i);if(t.autofocus&&!d||this.hasFocus()){setTimeout(z(Ki,this),20)}else{Qi(this)}for(var a in Os){if(Os.hasOwnProperty(a)){Os[a](this,t[a],As)}}Gr(this);if(t.finishInit){t.finishInit(this)}for(var s=0;s<$s.length;++s){$s[s](this)}kr(this);if(g&&t.lineWrapping&&getComputedStyle(o.lineDiv).textRendering=="optimizelegibility"){o.lineDiv.style.textRendering="auto"}}function Bs(r){var o=r.display;pe(o.scroller,"mousedown",Nr(r,vs));if(w&&C<11){pe(o.scroller,"dblclick",Nr(r,function(e){if(ye(r,e)){return}var t=Ii(r,e);if(!t||Es(r,e)||jn(r.display,e)){return}Ce(e);var n=r.findWordAt(t);Po(r.doc,n.anchor,n.head)}))}else{pe(o.scroller,"dblclick",function(e){return ye(r,e)||Ce(e)})}pe(o.scroller,"contextmenu",function(e){return Ms(r,e)});pe(o.input.getField(),"contextmenu",function(e){if(!o.scroller.contains(e.target)){Ms(r,e)}});var n,i={end:0};function a(){if(o.activeTouch){n=setTimeout(function(){return o.activeTouch=null},1e3);i=o.activeTouch;i.end=+new Date}}function s(e){if(e.touches.length!=1){return false}var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}function l(e,t){if(t.left==null){return true}var n=t.left-e.left,i=t.top-e.top;return n*n+i*i>20*20}pe(o.scroller,"touchstart",function(e){if(!ye(r,e)&&!s(e)&&!Es(r,e)){o.input.ensurePolled();clearTimeout(n);var t=+new Date;o.activeTouch={start:t,moved:false,prev:t-i.end<=300?i:null};if(e.touches.length==1){o.activeTouch.left=e.touches[0].pageX;o.activeTouch.top=e.touches[0].pageY}}});pe(o.scroller,"touchmove",function(){if(o.activeTouch){o.activeTouch.moved=true}});pe(o.scroller,"touchend",function(e){var t=o.activeTouch;if(t&&!jn(o,e)&&t.left!=null&&!t.moved&&new Date-t.start<300){var n=r.coordsChar(o.activeTouch,"page"),i;if(!t.prev||l(t,t.prev)){i=new ro(n,n)}else if(!t.prev.prev||l(t,t.prev.prev)){i=r.findWordAt(n)}else{i=new ro(rt(n.line,0),ft(r.doc,rt(n.line+1,0)))}r.setSelection(i.anchor,i.head);r.focus();Ce(e)}a()});pe(o.scroller,"touchcancel",a);pe(o.scroller,"scroll",function(){if(o.scroller.clientHeight){fr(r,o.scroller.scrollTop);hr(r,o.scroller.scrollLeft,true);ve(r,"scroll",r)}});pe(o.scroller,"mousewheel",function(e){return no(r,e)});pe(o.scroller,"DOMMouseScroll",function(e){return no(r,e)});pe(o.wrapper,"scroll",function(){return o.wrapper.scrollTop=o.wrapper.scrollLeft=0});o.dragFunctions={enter:function(e){if(!ye(r,e)){Le(e)}},over:function(e){if(!ye(r,e)){Ea(r,e);Le(e)}},start:function(e){return La(r,e)},drop:Nr(r,Sa),leave:function(e){if(!ye(r,e)){Ma(r)}}};var e=o.input.getField();pe(e,"keyup",function(e){return cs.call(r,e)});pe(e,"keydown",Nr(r,ls));pe(e,"keypress",Nr(r,fs));pe(e,"focus",function(e){return Ki(r,e)});pe(e,"blur",function(e){return Qi(r,e)})}zs.defaults=Ns,zs.optionHandlers=Os;var $s=[];function Hs(e,t,n,i){var r=e.doc,o;if(n==null){n="add"}if(n=="smart"){if(!r.mode.indent){n="prev"}else{o=yt(e,t).state}}var a=e.options.tabSize;var s=Ke(r,t),l=$(s.text,null,a);if(s.stateAfter){s.stateAfter=null}var u=s.text.match(/^\s*/)[0],c;if(!i&&!/\S/.test(s.text)){c=0;n="not"}else if(n=="smart"){c=r.mode.indent(o,s.text.slice(u.length),s.text);if(c==R||c>150){if(!i){return}n="prev"}}if(n=="prev"){if(t>r.first){c=$(Ke(r,t-1).text,null,a)}else{c=0}}else if(n=="add"){c=l+e.options.indentUnit}else if(n=="subtract"){c=l-e.options.indentUnit}else if(typeof n=="number"){c=l+n}c=Math.max(0,c);var f="",d=0;if(e.options.indentWithTabs){for(var h=Math.floor(c/a);h;--h){d+=a;f+="\t"}}if(da;var l=Fe(t),u=null;if(s&&i.ranges.length>1){if(Ws&&Ws.text.join("\n")==t){if(i.ranges.length%Ws.text.length==0){u=[];for(var c=0;c=0;d--){var h=i.ranges[d];var p=h.from(),m=h.to();if(h.empty()){if(n&&n>0){p=rt(p.line,p.ch-n)}else if(e.state.overwrite&&!s){m=rt(m.line,Math.min(Ke(o,m.line).text.length,m.ch+V(l).length))}else if(s&&Ws&&Ws.lineWise&&Ws.text.join("\n")==t){p=m=rt(p.line,0)}}var g={from:p,to:m,text:u?u[d%u.length]:l,origin:r||(s?"paste":e.state.cutIncoming>a?"cut":"+input")};Qo(e.doc,g);Tn(e,"inputRead",e,g)}if(t&&!s){Us(e,t)}ar(e);if(e.curOp.updateInput<2){e.curOp.updateInput=f}e.curOp.typing=true;e.state.pasteIncoming=e.state.cutIncoming=-1}function js(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n){e.preventDefault();if(!t.isReadOnly()&&!t.options.disableInput){Ar(t,function(){return Rs(t,n,0,null,"paste")})}return true}}function Us(e,t){if(!e.options.electricChars||!e.options.smartIndent){return}var n=e.doc.sel;for(var i=n.ranges.length-1;i>=0;i--){var r=n.ranges[i];if(r.head.ch>100||i&&n.ranges[i-1].head.line==r.head.line){continue}var o=e.getModeAt(r.head);var a=false;if(o.electricChars){for(var s=0;s-1){a=Hs(e,r.head.line,"smart");break}}}else if(o.electricInput){if(o.electricInput.test(Ke(e.doc,r.head.line).text.slice(0,r.head.ch))){a=Hs(e,r.head.line,"smart")}}if(a){Tn(e,"electricInput",e,r.head.line)}}}function Ys(e){var t=[],n=[];for(var i=0;i0){Bo(this.doc,i,new ro(o,u[i].to()),j)}}else if(r.head.line>n){Hs(this,r.head.line,e,true);n=r.head.line;if(i==this.doc.sel.primIndex){ar(this)}}}}),getTokenAt:function(e,t){return kt(this,e,t)},getLineTokens:function(e,t){return kt(this,rt(e),t,true)},getTokenTypeAt:function(e){e=ft(this.doc,e);var t=vt(this,Ke(this.doc,e.line));var n=0,i=(t.length-1)/2,r=e.ch;var o;if(r==0){o=t[2]}else{for(;;){var a=n+i>>1;if((a?t[a*2-1]:0)>=r){i=a}else if(t[a*2+1]o){e=o;i=true}r=Ke(this.doc,e)}else{r=e}return mi(this,r,{top:0,left:0},t||"page",n||i).top+(i?this.doc.height-on(r):0)},defaultTextHeight:function(){return Ti(this.display)},defaultCharWidth:function(){return Di(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,n,i,r){var o=this.display;e=yi(this,ft(this.doc,e));var a=e.bottom,s=e.left;t.style.position="absolute";t.setAttribute("cm-ignore-events","true");this.display.input.setUneditable(t);o.sizer.appendChild(t);if(i=="over"){a=e.top}else if(i=="above"||i=="near"){var l=Math.max(o.wrapper.clientHeight,this.doc.height),u=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);if((i=="above"||e.bottom+t.offsetHeight>l)&&e.top>t.offsetHeight){a=e.top-t.offsetHeight}else if(e.bottom+t.offsetHeight<=l){a=e.bottom}if(s+t.offsetWidth>u){s=u-t.offsetWidth}}t.style.top=a+"px";t.style.left=t.style.right="";if(r=="right"){s=o.sizer.clientWidth-t.offsetWidth;t.style.right="0px"}else{if(r=="left"){s=0}else if(r=="middle"){s=(o.sizer.clientWidth-t.offsetWidth)/2}t.style.left=s+"px"}if(n){ir(this,{left:s,top:a,right:s+t.offsetWidth,bottom:a+t.offsetHeight})}},triggerOnKeyDown:Or(ls),triggerOnKeyPress:Or(fs),triggerOnKeyUp:cs,triggerOnMouseDown:Or(vs),execCommand:function(e){if(Ka.hasOwnProperty(e)){return Ka[e].call(null,this)}},triggerElectric:Or(function(e){Us(this,e)}),findPosH:function(e,t,n,i){var r=1;if(t<0){r=-1;t=-t}var o=ft(this.doc,e);for(var a=0;a0&&s(n.charAt(i-1))){--i}while(r.5){Fi(this)}ve(this,"refresh",this)}),swapDoc:Or(function(e){var t=this.doc;t.cm=null;if(this.state.selectingText){this.state.selectingText()}yo(this,e);fi(this);this.display.input.reset();sr(this,e.scrollLeft,e.scrollTop);this.curOp.forceScroll=true;Tn(this,"swapDoc",this,t);return t}),phrase:function(e){var t=this.options.phrases;return t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:e},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}};we(r);r.registerHelper=function(e,t,n){if(!u.hasOwnProperty(e)){u[e]=r[e]={_global:[]}}u[e][t]=n};r.registerGlobalHelper=function(e,t,n,i){r.registerHelper(e,t,i);u[e]._global.push({pred:n,val:i})}}function Vs(n,i,r,e,o){var t=i;var a=r;var s=Ke(n,i.line);var l=o&&n.direction=="rtl"?-r:r;function u(){var e=i.line+l;if(e=n.first+n.size){return false}i=new rt(e,i.ch,i.sticky);return s=Ke(n,e)}function c(e){var t;if(o){t=Va(n.cm,s,i,r)}else{t=Ga(s,i,r)}if(t==null){if(!e&&u()){i=Xa(o,n.cm,s,i.line,l)}else{return false}}else{i=t}return true}if(e=="char"){c()}else if(e=="column"){c(true)}else if(e=="word"||e=="group"){var f=null,d=e=="group";var h=n.cm&&n.cm.getHelper(i,"wordChars");for(var p=true;;p=false){if(r<0&&!c(!p)){break}var m=s.text.charAt(i.ch)||"\n";var g=ne(m,h)?"w":d&&m=="\n"?"n":!d||/\s/.test(m)?null:"p";if(d&&!p&&!g){g="s"}if(f&&f!=g){if(r<0){r=1;c();i.sticky="after"}break}if(g){f=g}if(r>0&&!c(!p)){break}}}var v=Go(n,i,t,a,true);if(at(t,v)){v.hitSide=true}return v}function Ks(e,t,n,i){var r=e.doc,o=t.left,a;if(i=="page"){var s=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);var l=Math.max(s-.5*Ti(e.display),3);a=(n>0?t.bottom:t.top)+n*l}else if(i=="line"){a=n>0?t.bottom+3:t.top-3}var u;for(;;){u=wi(e,o,a);if(!u.outside){break}if(n<0?a<=0:a>=r.height){u.hitSide=true;break}a+=n*5}return u}var Qs=function(e){this.cm=e;this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null;this.polling=new H;this.composing=null;this.gracePeriod=false;this.readDOMTimeout=null};function Zs(e,t){var n=ei(e,t.line);if(!n||n.hidden){return null}var i=Ke(e.doc,t.line);var r=Qn(n,i,t.line);var o=de(i,e.doc.direction),a="left";if(o){var s=ce(o,t.ch);a=s%2?"right":"left"}var l=oi(r.map,t.ch,a);l.offset=l.collapse=="right"?l.end:l.start;return l}function Js(e){for(var t=e;t;t=t.parentNode){if(/CodeMirror-gutter-wrapper/.test(t.className)){return true}}return false}function el(e,t){if(t){e.bad=true}return e}function tl(s,e,t,l,u){var n="",c=false,f=s.doc.lineSeparator(),d=false;function h(t){return function(e){return e.id==t}}function p(){if(c){n+=f;if(d){n+=f}c=d=false}}function m(e){if(e){p();n+=e}}function g(e){if(e.nodeType==1){var t=e.getAttribute("cm-text");if(t){m(t);return}var n=e.getAttribute("cm-marker"),i;if(n){var r=s.findMarks(rt(l,0),rt(u+1,0),h(+n));if(r.length&&(i=r[0].find(0))){m(Qe(s.doc,i.from,i.to).join(f))}return}if(e.getAttribute("contenteditable")=="false"){return}var o=/^(pre|div|p|li|table|br)$/i.test(e.nodeName);if(!/^br$/i.test(e.nodeName)&&e.textContent.length==0){return}if(o){p()}for(var a=0;a=t.display.viewTo||r.line=t.display.viewFrom&&Zs(t,i)||{node:s[0].measure.map[2],offset:0};var u=r.linee.firstLine()){i=rt(i.line-1,Ke(e.doc,i.line-1).length)}if(r.ch==Ke(e.doc,r.line).text.length&&r.linet.viewTo-1){return false}var o,a,s;if(i.line==t.viewFrom||(o=Pi(e,i.line))==0){a=et(t.view[0].line);s=t.view[0].node}else{a=et(t.view[o].line);s=t.view[o-1].node.nextSibling}var l=Pi(e,r.line);var u,c;if(l==t.view.length-1){u=t.viewTo-1;c=t.lineDiv.lastChild}else{u=et(t.view[l+1].line)-1;c=t.view[l+1].node.previousSibling}if(!s){return false}var f=e.doc.splitLines(tl(e,s,c,a,u));var d=Qe(e.doc,rt(a,0),rt(u,Ke(e.doc,u).text.length));while(f.length>1&&d.length>1){if(V(f)==V(d)){f.pop();d.pop();u--}else if(f[0]==d[0]){f.shift();d.shift();a++}else{break}}var h=0,p=0;var m=f[0],g=d[0],v=Math.min(m.length,g.length);while(hi.ch&&y.charCodeAt(y.length-p-1)==x.charCodeAt(x.length-p-1)){h--;p++}}f[f.length-1]=y.slice(0,y.length-p).replace(/^\u200b+/,"");f[0]=f[0].slice(h).replace(/\u200b+$/,"");var w=rt(a,h);var C=rt(u,d.length?V(d).length-p:0);if(f.length>1||f[0]||ot(w,C)){ia(e.doc,f,w,C,"+input");return true}},Qs.prototype.ensurePolled=function(){this.forceCompositionEnd()},Qs.prototype.reset=function(){this.forceCompositionEnd()},Qs.prototype.forceCompositionEnd=function(){if(!this.composing){return}clearTimeout(this.readDOMTimeout);this.composing=null;this.updateFromDOM();this.div.blur();this.div.focus()},Qs.prototype.readFromDOMSoon=function(){var e=this;if(this.readDOMTimeout!=null){return}this.readDOMTimeout=setTimeout(function(){e.readDOMTimeout=null;if(e.composing){if(e.composing.done){e.composing=null}else{return}}e.updateFromDOM()},80)},Qs.prototype.updateFromDOM=function(){var e=this;if(this.cm.isReadOnly()||!this.pollContent()){Ar(this.cm,function(){return zi(e.cm)})}},Qs.prototype.setUneditable=function(e){e.contentEditable="false"},Qs.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing){return}e.preventDefault();if(!this.cm.isReadOnly()){Nr(this.cm,Rs)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)}},Qs.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Qs.prototype.onContextMenu=function(){},Qs.prototype.resetPosition=function(){},Qs.prototype.needsContentAttribute=true;var rl=function(e){this.cm=e;this.prevInput="";this.pollingFast=false;this.polling=new H;this.hasSelection=false;this.composing=null};function ol(t,n){if((n=n?B(n):{}).value=t.value,!n.tabindex&&t.tabIndex)n.tabindex=t.tabIndex;if(!n.placeholder&&t.placeholder)n.placeholder=t.placeholder;if(null==n.autofocus){var e=O();n.autofocus=e==t||null!=t.getAttribute("autofocus")&&e==document.body}function i(){t.value=s.getValue()}var r;if(t.form)if(pe(t.form,"submit",i),!n.leaveSubmitMethodAlone){var o=t.form;r=o.submit;try{var a=o.submit=function(){i(),o.submit=r,o.submit(),o.submit=a}}catch(e){}}n.finishInit=function(e){e.save=i,e.getTextArea=function(){return t},e.toTextArea=function(){e.toTextArea=isNaN,i(),t.parentNode.removeChild(e.getWrapperElement()),t.style.display="",t.form&&(ge(t.form,"submit",i),n.leaveSubmitMethodAlone||"function"!=typeof t.form.submit||(t.form.submit=r))}},t.style.display="none";var s=zs(function(e){return t.parentNode.insertBefore(e,t.nextSibling)},n);return s}function al(e){e.off=ge,e.on=pe,e.wheelEventPixels=to,e.Doc=Ca,e.splitLines=Fe,e.countColumn=$,e.findColumn=q,e.isWordChar=te,e.Pass=R,e.signal=ve,e.Line=ln,e.changeEnd=so,e.scrollbarModel=xr,e.Pos=rt,e.cmpPos=ot,e.modes=$e,e.mimeModes=He,e.resolveMode=Re,e.getMode=je,e.modeExtensions=Ue,e.extendMode=Ye,e.copyState=qe,e.startState=Xe,e.innerMode=Ge,e.commands=Ka,e.keyMap=Ba,e.keyName=ja,e.isModifierKey=_a,e.lookupKey=Wa,e.normalizeKeyMap=Ha,e.StringStream=Ve,e.SharedTextMarker=ga,e.TextMarker=pa,e.LineWidget=ca,e.e_preventDefault=Ce,e.e_stopPropagation=ke,e.e_stop=Le,e.addClass=F,e.contains=A,e.rmClass=L,e.keyNames=Fa}rl.prototype.init=function(n){var e=this;var i=this,r=this.cm;this.createField(n);var o=this.textarea;n.wrapper.insertBefore(this.wrapper,n.wrapper.firstChild);if(c){o.style.width="0px"}pe(o,"input",function(){if(w&&C>=9&&e.hasSelection){e.hasSelection=null}i.poll()});pe(o,"paste",function(e){if(ye(r,e)||js(e,r)){return}r.state.pasteIncoming=+new Date;i.fastPoll()});function t(e){if(ye(r,e)){return}if(r.somethingSelected()){_s({lineWise:false,text:r.getSelections()})}else if(!r.options.lineWiseCopyCut){return}else{var t=Ys(r);_s({lineWise:true,text:t.text});if(e.type=="cut"){r.setSelections(t.ranges,null,j)}else{i.prevInput="";o.value=t.text.join("\n");P(o)}}if(e.type=="cut"){r.state.cutIncoming=+new Date}}pe(o,"cut",t);pe(o,"copy",t);pe(n.scroller,"paste",function(e){if(jn(n,e)||ye(r,e)){return}if(!o.dispatchEvent){r.state.pasteIncoming=+new Date;i.focus();return}var t=new Event("paste");t.clipboardData=e.clipboardData;o.dispatchEvent(t)});pe(n.lineSpace,"selectstart",function(e){if(!jn(n,e)){Ce(e)}});pe(o,"compositionstart",function(){var e=r.getCursor("from");if(i.composing){i.composing.range.clear()}i.composing={start:e,range:r.markText(e,r.getCursor("to"),{className:"CodeMirror-composing"})}});pe(o,"compositionend",function(){if(i.composing){i.poll();i.composing.range.clear();i.composing=null}})},rl.prototype.createField=function(e){this.wrapper=Gs();this.textarea=this.wrapper.firstChild},rl.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc;var i=ji(e);if(e.options.moveInputWithCursor){var r=yi(e,n.sel.primary().head,"div");var o=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect();i.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,r.top+a.top-o.top));i.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,r.left+a.left-o.left))}return i},rl.prototype.showSelection=function(e){var t=this.cm,n=t.display;T(n.cursorDiv,e.cursors);T(n.selectionDiv,e.selection);if(e.teTop!=null){this.wrapper.style.top=e.teTop+"px";this.wrapper.style.left=e.teLeft+"px"}},rl.prototype.reset=function(e){if(this.contextMenuPending||this.composing){return}var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n;if(t.state.focused){P(this.textarea)}if(w&&C>=9){this.hasSelection=n}}else if(!e){this.prevInput=this.textarea.value="";if(w&&C>=9){this.hasSelection=null}}},rl.prototype.getField=function(){return this.textarea},rl.prototype.supportsTouch=function(){return false},rl.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!d||O()!=this.textarea)){try{this.textarea.focus()}catch(e){}}},rl.prototype.blur=function(){this.textarea.blur()},rl.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},rl.prototype.receivedFocus=function(){this.slowPoll()},rl.prototype.slowPoll=function(){var e=this;if(this.pollingFast){return}this.polling.set(this.cm.options.pollInterval,function(){e.poll();if(e.cm.state.focused){e.slowPoll()}})},rl.prototype.fastPoll=function(){var t=false,n=this;n.pollingFast=true;function i(){var e=n.poll();if(!e&&!t){t=true;n.polling.set(60,i)}else{n.pollingFast=false;n.slowPoll()}}n.polling.set(20,i)},rl.prototype.poll=function(){var e=this;var t=this.cm,n=this.textarea,i=this.prevInput;if(this.contextMenuPending||!t.state.focused||Ie(n)&&!i&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq){return false}var r=n.value;if(r==i&&!t.somethingSelected()){return false}if(w&&C>=9&&this.hasSelection===r||y&&/[\uf700-\uf7ff]/.test(r)){t.display.input.reset();return false}if(t.doc.sel==t.display.selForContextMenu){var o=r.charCodeAt(0);if(o==8203&&!i){i="​"}if(o==8666){this.reset();return this.cm.execCommand("undo")}}var a=0,s=Math.min(i.length,r.length);while(a1e3||r.indexOf("\n")>-1){n.value=e.prevInput=""}else{e.prevInput=r}if(e.composing){e.composing.range.clear();e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"})}});return true},rl.prototype.ensurePolled=function(){if(this.pollingFast&&this.poll()){this.pollingFast=false}},rl.prototype.onKeyPress=function(){if(w&&C>=9){this.hasSelection=null}this.fastPoll()},rl.prototype.onContextMenu=function(e){var n=this,i=n.cm,r=i.display,o=n.textarea;if(n.contextMenuPending){n.contextMenuPending()}var t=Ii(i,e),a=r.scroller.scrollTop;if(!t||v){return}var s=i.options.resetSelectionOnContextMenu;if(s&&i.doc.sel.contains(t)==-1){Nr(i,_o)(i.doc,ao(t),j)}var l=o.style.cssText,u=n.wrapper.style.cssText;var c=n.wrapper.offsetParent.getBoundingClientRect();n.wrapper.style.cssText="position: static";o.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-c.top-5)+"px; left: "+(e.clientX-c.left-5)+"px;\n z-index: 1000; background: "+(w?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";var f;if(g){f=window.scrollY}r.input.focus();if(g){window.scrollTo(null,f)}r.input.reset();if(!i.somethingSelected()){o.value=n.prevInput=" "}n.contextMenuPending=h;r.selForContextMenu=i.doc.sel;clearTimeout(r.detectingSelectAll);function d(){if(o.selectionStart!=null){var e=i.somethingSelected();var t="​"+(e?o.value:"");o.value="⇚";o.value=t;n.prevInput=e?"":"​";o.selectionStart=1;o.selectionEnd=t.length;r.selForContextMenu=i.doc.sel}}function h(){if(n.contextMenuPending!=h){return}n.contextMenuPending=false;n.wrapper.style.cssText=u;o.style.cssText=l;if(w&&C<9){r.scrollbars.setScrollTop(r.scroller.scrollTop=a)}if(o.selectionStart!=null){if(!w||w&&C<9){d()}var e=0,t=function(){if(r.selForContextMenu==i.doc.sel&&o.selectionStart==0&&o.selectionEnd>0&&n.prevInput=="​"){Nr(i,Vo)(i)}else if(e++<10){r.detectingSelectAll=setTimeout(t,500)}else{r.selForContextMenu=null;r.input.reset()}};r.detectingSelectAll=setTimeout(t,200)}}if(w&&C>=9){d()}if(k){Le(e);var p=function(){ge(window,"mouseup",p);setTimeout(h,20)};pe(window,"mouseup",p)}else{setTimeout(h,50)}},rl.prototype.readOnlyChanged=function(e){if(!e){this.reset()}this.textarea.disabled=e=="nocursor"},rl.prototype.setUneditable=function(){},rl.prototype.needsContentAttribute=false,Fs(zs),Xs(zs);var sl="iter insert remove copy getEditor constructor".split(" ");for(var ll in Ca.prototype){if(Ca.prototype.hasOwnProperty(ll)&&W(sl,ll)<0){zs.prototype[ll]=function(e){return function(){return e.apply(this.doc,arguments)}}(Ca.prototype[ll])}}return we(Ca),zs.inputStyles={textarea:rl,contenteditable:Qs},zs.defineMode=function(e){zs.defaults.mode||"null"==e||(zs.defaults.mode=e),function(e,t){2"));else return null}else if(t.match("--")){return e(f("comment","--\x3e"))}else if(t.match("DOCTYPE",true,true)){t.eatWhile(/[\w\._\-]/);return e(d(1))}else{return null}}else if(t.eat("?")){t.eatWhile(/[\w\._\-]/);n.tokenize=f("meta","?>");return"meta"}else{o=t.eat("/")?"closeTag":"openTag";n.tokenize=c;return"tag bracket"}}else if(i=="&"){var r;if(t.eat("#")){if(t.eat("x")){r=t.eatWhile(/[a-fA-F\d]/)&&t.eat(";")}else{r=t.eatWhile(/[\d]/)&&t.eat(";")}}else{r=t.eatWhile(/[\w\.\-:]/)&&t.eat(";")}return r?"atom":"error"}else{t.eatWhile(/[^&<]/);return null}}u.isInText=true;function c(e,t){var n=e.next();if(n==">"||n=="/"&&e.eat(">")){t.tokenize=u;o=n==">"?"endTag":"selfcloseTag";return"tag bracket"}else if(n=="="){o="equals";return null}else if(n=="<"){t.tokenize=u;t.state=g;t.tagName=t.tagStart=null;var i=t.tokenize(e,t);return i?i+" tag error":"tag error"}else if(/[\'\"]/.test(n)){t.tokenize=r(n);t.stringStartCol=e.column();return t.tokenize(e,t)}else{e.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/);return"word"}}function r(n){var e=function(e,t){while(!e.eol()){if(e.next()==n){t.tokenize=c;break}}return"string"};e.isInAttribute=true;return e}function f(n,i){return function(e,t){while(!e.eol()){if(e.match(i)){t.tokenize=u;break}e.next()}return n}}function d(i){return function(e,t){var n;while((n=e.next())!=null){if(n=="<"){t.tokenize=d(i+1);return t.tokenize(e,t)}else if(n==">"){if(i==1){t.tokenize=u;break}else{t.tokenize=d(i-1);return t.tokenize(e,t)}}}return"meta"}}function h(e,t,n){this.prev=e.context;this.tagName=t;this.indent=e.indented;this.startOfLine=n;if(s.doNotIndent.hasOwnProperty(t)||e.context&&e.context.noIndent)this.noIndent=true}function p(e){if(e.context)e.context=e.context.prev}function m(e,t){var n;while(true){if(!e.context){return}n=e.context.tagName;if(!s.contextGrabbers.hasOwnProperty(n)||!s.contextGrabbers[n].hasOwnProperty(t)){return}p(e)}}function g(e,t,n){if(e=="openTag"){n.tagStart=t.column();return v}else if(e=="closeTag"){return y}else{return g}}function v(e,t,n){if(e=="word"){n.tagName=t.current();l="tag";return w}else if(s.allowMissingTagName&&e=="endTag"){l="tag bracket";return w(e,t,n)}else{l="error";return v}}function y(e,t,n){if(e=="word"){var i=t.current();if(n.context&&n.context.tagName!=i&&s.implicitlyClosed.hasOwnProperty(n.context.tagName))p(n);if(n.context&&n.context.tagName==i||s.matchClosing===false){l="tag";return x}else{l="tag error";return b}}else if(s.allowMissingTagName&&e=="endTag"){l="tag bracket";return x(e,t,n)}else{l="error";return b}}function x(e,t,n){if(e!="endTag"){l="error";return x}p(n);return g}function b(e,t,n){l="error";return x(e,t,n)}function w(e,t,n){if(e=="word"){l="attribute";return C}else if(e=="endTag"||e=="selfcloseTag"){var i=n.tagName,r=n.tagStart;n.tagName=n.tagStart=null;if(e=="selfcloseTag"||s.autoSelfClosers.hasOwnProperty(i)){m(n,i)}else{m(n,i);n.context=new h(n,i,r==n.indented)}return g}l="error";return w}function C(e,t,n){if(e=="equals")return k;if(!s.allowMissing)l="error";return w(e,t,n)}function k(e,t,n){if(e=="string")return S;if(e=="word"&&s.allowUnquoted){l="string";return w}l="error";return w(e,t,n)}function S(e,t,n){if(e=="string")return S;return w(e,t,n)}return{startState:function(e){var t={tokenize:u,state:g,indented:e||0,tagName:null,tagStart:null,context:null};if(e!=null)t.baseIndent=e;return t},token:function(e,t){if(!t.tagName&&e.sol())t.indented=e.indentation();if(e.eatSpace())return null;o=null;var n=t.tokenize(e,t);if((n||o)&&n!="comment"){l=null;t.state=t.state(o||n,e,t);if(l)n=l=="error"?n+" error":l}return n},indent:function(e,t,n){var i=e.context;if(e.tokenize.isInAttribute){if(e.tagStart==e.indented)return e.stringStartCol+1;else return e.indented+a}if(i&&i.noIndent)return L.Pass;if(e.tokenize!=c&&e.tokenize!=u)return n?n.match(/^(\s*)/)[0].length:0;if(e.tagName){if(s.multilineTagIndentPastTag!==false)return e.tagStart+e.tagName.length+2;else return e.tagStart+a*(s.multilineTagIndentFactor||1)}if(s.alignCDATA&&/$/,blockCommentStart:"\x3c!--",blockCommentEnd:"--\x3e",configuration:s.htmlMode?"html":"xml",helperType:s.htmlMode?"html":"xml",skipAttribute:function(e){if(e.state==k)e.state=w},xmlCurrentTag:function(e){return e.tagName?{name:e.tagName,close:e.type=="closeTag"}:null},xmlCurrentContext:function(e){var t=[];for(var n=e.context;n;n=n.prev)if(n.tagName)t.push(n.tagName);return t.reverse()}}}),L.defineMIME("text/xml","xml"),L.defineMIME("application/xml","xml"),!L.mimeModes.hasOwnProperty("text/html"))L.defineMIME("text/html",{name:"xml",htmlMode:true})}(ft)}),e(function(e,t){!function(o){o.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history).md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki ",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]}];for(var e=0;e-1&&e.substring(i+1,e.length);if(r)return o.findModeByExtension(r)},o.findModeByName=function(e){e=e.toLowerCase();for(var t=0;t` "'(~:]+/,x=/^(~~~+|```+)[ \t]*([\w+#-]*)[^\n`]*$/,b=/^\s*\[[^\]]+?\]:.*$/,L=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/;function E(e,t,n){return t.f=t.inline=n,n(e,t)}function M(e,t,n){return t.f=t.block=n,n(e,t)}function i(e){if(e.linkTitle=!1,e.linkHref=!1,e.linkText=!1,e.em=!1,e.strong=!1,e.strikethrough=!1,e.quote=0,e.indentedCode=!1,e.f==T){var t=r;if(!t){var n=P.innerMode(C,e.htmlState);t="xml"==n.mode.name&&null===n.state.tagStart&&!n.state.context&&n.state.tokenize.isInText}t&&(e.f=N,e.block=a,e.htmlState=null)}return e.trailingSpace=0,e.trailingSpaceNewLine=!1,e.prevLine=e.thisLine,e.thisLine={stream:null},null}function a(e,t){var n,i=e.column()===t.indentation,r=!(n=t.prevLine.stream)||!/\S/.test(n.string),o=t.indentedCode,a=t.prevLine.hr,s=!1!==t.list,l=(t.listStack[t.listStack.length-1]||0)+3;t.indentedCode=!1;var u=t.indentation;if(null===t.indentationDiff&&(t.indentationDiff=t.indentation,s)){for(t.list=null;u"))return t.quote=i?1:t.quote+1,w.highlightFormatting&&(t.formatting="quote"),e.eatSpace(),A(t);if(!f&&!t.setext&&i&&t.indentation<=l&&(d=e.match(g))){var h=d[1]?"ol":"ul";return t.indentation=u+e.current().length,t.list=!0,t.quote=0,t.listStack.push(t.indentation),t.em=!1,t.strong=!1,t.code=!1,t.strikethrough=!1,w.taskLists&&e.match(S,!1)&&(t.taskList=!0),t.f=t.inline,w.highlightFormatting&&(t.formatting=["list","list-"+h]),A(t)}return i&&t.indentation<=l&&(d=e.match(x,!0))?(t.quote=0,t.fencedEndRE=new RegExp(d[1]+"+ *$"),t.localMode=w.fencedCodeBlockHighlighting&&function(e){if(P.findModeByName){var t=P.findModeByName(e);t&&(e=t.mime||t.mimes[0])}var n=P.getMode(p,e);return"null"==n.name?null:n}(d[2]),t.localMode&&(t.localState=P.startState(t.localMode)),t.f=t.block=D,w.highlightFormatting&&(t.formatting="code-block"),t.code=-1,A(t)):t.setext||!(c&&s||t.quote||!1!==t.list||t.code||f||b.test(e.string))&&(d=e.lookAhead(1))&&(d=d.match(y))?(t.setext?(t.header=t.setext,t.setext=0,e.skipToEnd(),w.highlightFormatting&&(t.formatting="header")):(t.header="="==d[0].charAt(0)?1:2,t.setext=t.header),t.thisLine.header=!0,t.f=t.inline,A(t)):f?(e.skipToEnd(),t.hr=!0,t.thisLine.hr=!0,k.hr):"["===e.peek()?E(e,t,I):E(e,t,t.inline)}function T(e,t){var n=C.token(e,t.htmlState);if(!r){var i=P.innerMode(C,t.htmlState);("xml"==i.mode.name&&null===i.state.tagStart&&!i.state.context&&i.state.tokenize.isInText||t.md_inside&&-1"))&&(t.f=N,t.block=a,t.htmlState=null)}return n}function D(e,t){var n,i=t.listStack[t.listStack.length-1]||0,r=t.indentation=e.quote?t.push(k.formatting+"-"+e.formatting[n]+"-"+e.quote):t.push("error"))}if(e.taskOpen)return t.push("meta"),t.length?t.join(" "):null;if(e.taskClosed)return t.push("property"),t.length?t.join(" "):null;if(e.linkHref?t.push(k.linkHref,"url"):(e.strong&&t.push(k.strong),e.em&&t.push(k.em),e.strikethrough&&t.push(k.strikethrough),e.emoji&&t.push(k.emoji),e.linkText&&t.push(k.linkText),e.code&&t.push(k.code),e.image&&t.push(k.image),e.imageAltText&&t.push(k.imageAltText,"link"),e.imageMarker&&t.push(k.imageMarker)),e.header&&t.push(k.header,k.header+"-"+e.header),e.quote&&(t.push(k.quote),!w.maxBlockquoteDepth||w.maxBlockquoteDepth>=e.quote?t.push(k.quote+"-"+e.quote):t.push(k.quote+"-"+w.maxBlockquoteDepth)),!1!==e.list){var i=(e.listStack.length-1)%3;i?1==i?t.push(k.list2):t.push(k.list3):t.push(k.list1)}return e.trailingSpaceNewLine?t.push("trailing-space-new-line"):e.trailingSpace&&t.push("trailing-space-"+(e.trailingSpace%2?"a":"b")),t.length?t.join(" "):null}function t(e,t){if(e.match(n,!0))return A(t)}function N(e,t){var n=t.text(e,t);if(void 0!==n)return n;if(t.list)return t.list=null,A(t);if(t.taskList)return" "===e.match(S,!0)[1]?t.taskOpen=!0:t.taskClosed=!0,w.highlightFormatting&&(t.formatting="task"),t.taskList=!1,A(t);if(t.taskOpen=!1,t.taskClosed=!1,t.header&&e.match(/^#+$/,!0))return w.highlightFormatting&&(t.formatting="header"),A(t);var i=e.next();if(t.linkTitle){t.linkTitle=!1;var r=i;"("===i&&(r=")");var o="^\\s*(?:[^"+(r=(r+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1"))+"\\\\]+|\\\\\\\\|\\\\.)"+r;if(e.match(new RegExp(o),!0))return k.linkHref}if("`"===i){var a=t.formatting;w.highlightFormatting&&(t.formatting="code"),e.eatWhile("`");var s=e.current().length;if(0!=t.code||t.quote&&1!=s){if(s!=t.code)return t.formatting=a,A(t);var l=A(t);return t.code=0,l}return t.code=s,A(t)}if(t.code)return A(t);if("\\"===i&&(e.next(),w.highlightFormatting)){var u=A(t),c=k.formatting+"-escape";return u?u+" "+c:c}if("!"===i&&e.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return t.imageMarker=!0,t.image=!0,w.highlightFormatting&&(t.formatting="image"),A(t);if("["===i&&t.imageMarker&&e.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return t.imageMarker=!1,t.imageAltText=!0,w.highlightFormatting&&(t.formatting="image"),A(t);if("]"===i&&t.imageAltText){w.highlightFormatting&&(t.formatting="image");var u=A(t);return t.imageAltText=!1,t.image=!1,t.inline=t.f=F,u}if("["===i&&!t.image)return t.linkText&&e.match(/^.*?\]/)||(t.linkText=!0,w.highlightFormatting&&(t.formatting="link")),A(t);if("]"===i&&t.linkText){w.highlightFormatting&&(t.formatting="link");var u=A(t);return t.linkText=!1,t.inline=t.f=e.match(/\(.*?\)| ?\[.*?\]/,!1)?F:N,u}if("<"===i&&e.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1))return t.f=t.inline=O,w.highlightFormatting&&(t.formatting="link"),(u=A(t))?u+=" ":u="",u+k.linkInline;if("<"===i&&e.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1))return t.f=t.inline=O,w.highlightFormatting&&(t.formatting="link"),(u=A(t))?u+=" ":u="",u+k.linkEmail;if(w.xml&&"<"===i&&e.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var f=e.string.indexOf(">",e.pos);if(-1!=f){var d=e.string.substring(e.start,f);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(d)&&(t.md_inside=!0)}return e.backUp(1),t.htmlState=P.startState(C),M(e,t,T)}if(w.xml&&"<"===i&&e.match(/^\/\w*?>/))return t.md_inside=!1,"tag";if("*"===i||"_"===i){for(var h=1,p=1==e.pos?" ":e.string.charAt(e.pos-2);h<3&&e.eat(i);)h++;var m=e.peek()||" ",g=!/\s/.test(m)&&(!L.test(m)||/\s/.test(p)||L.test(p)),v=!/\s/.test(p)&&(!L.test(p)||/\s/.test(m)||L.test(m)),y=null,x=null;if(h%2&&(t.em||!g||"*"!==i&&v&&!L.test(p)?t.em!=i||!v||"*"!==i&&g&&!L.test(m)||(y=!1):y=!0),1"!==e.next())return e.match(/^[^>]+/,!0),k.linkInline;t.f=t.inline=N,w.highlightFormatting&&(t.formatting="link");var n=A(t);return n?n+=" ":n="",n+k.linkInline}function F(e,t){if(e.eatSpace())return null;var i,n=e.next();return"("===n||"["===n?(t.f=t.inline=(i="("===n?")":"]",function(e,t){if(e.next()!==i)return e.match(o[i]),t.linkHref=!0,A(t);t.f=t.inline=N,w.highlightFormatting&&(t.formatting="link-string");var n=A(t);return t.linkHref=!1,n}),w.highlightFormatting&&(t.formatting="link-string"),t.linkHref=!0,A(t)):"error"}var o={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function I(e,t){return e.match(/^([^\]\\]|\\.)*\]:/,!1)?(t.f=s,e.next(),w.highlightFormatting&&(t.formatting="link"),t.linkText=!0,A(t)):E(e,t,N)}function s(e,t){if(e.match(/^\]:/,!0)){t.f=t.inline=l,w.highlightFormatting&&(t.formatting="link");var n=A(t);return t.linkText=!1,n}return e.match(/^([^\]\\]|\\.)+/,!0),k.linkText}function l(e,t){return e.eatSpace()?null:(e.match(/^[^\s]+/,!0),void 0===e.peek()?t.linkTitle=!0:e.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),t.f=t.inline=N,k.linkHref+" url")}var u={startState:function(){return{f:a,prevLine:{stream:null},thisLine:{stream:null},block:a,htmlState:null,indentation:0,inline:N,text:t,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(e){return{f:e.f,prevLine:e.prevLine,thisLine:e.thisLine,block:e.block,htmlState:e.htmlState&&P.copyState(C,e.htmlState),indentation:e.indentation,localMode:e.localMode,localState:e.localMode?P.copyState(e.localMode,e.localState):null,inline:e.inline,text:e.text,formatting:!1,linkText:e.linkText,linkTitle:e.linkTitle,linkHref:e.linkHref,code:e.code,em:e.em,strong:e.strong,strikethrough:e.strikethrough,emoji:e.emoji,header:e.header,setext:e.setext,hr:e.hr,taskList:e.taskList,list:e.list,listStack:e.listStack.slice(0),quote:e.quote,indentedCode:e.indentedCode,trailingSpace:e.trailingSpace,trailingSpaceNewLine:e.trailingSpaceNewLine,md_inside:e.md_inside,fencedEndRE:e.fencedEndRE}},token:function(e,t){if(t.formatting=!1,e!=t.thisLine.stream){if(t.header=0,t.hr=!1,e.match(/^\s*$/,!0))return i(t),null;if(t.prevLine=t.thisLine,t.thisLine={stream:e},t.taskList=!1,t.trailingSpace=0,t.trailingSpaceNewLine=!1,!t.localState&&(t.f=t.block,t.f!=T)){var n=e.match(/^\s*/,!0)[0].replace(/\t/g," ").length;if(t.indentation=n,t.indentationDiff=null,0 ","")}),$("[data-command=link]",t).addEventListener("click",function(){var e=a.getSelection();/^(https?:\/\/|mailto:)/i.test(e)?s("[","]("+e+")",!0):""!==e?s("["+e+"](http://",")",!0):s("[","](http://)")}),$("[data-command=image]",t).addEventListener("click",function(){dt.show("imagesModal",null,function(e){var t=$(".image-picker-thumbnail.selected",e);t&&t.classList.remove("selected"),$(".image-picker-confirm",e).addEventListener("click",function e(){var t=$(".image-picker-thumbnail.selected",$("#imagesModal")).getAttribute("data-filename");void 0!==t?s(o()+"![","]("+t+")"):s(o()+"![](",")"),this.removeEventListener("click",e)})})}),$("[data-command=summary]",t).addEventListener("click",function(){var e;n()||(s((void 0===(e=r())||"\n"===e?"":"\n")+"\n===\n\n",""),this.setAttribute("disabled",""))}),$("[data-command=undo]",t).addEventListener("click",function(){a.undo(),a.focus()}),$("[data-command=redo]",t).addEventListener("click",function(){a.redo(),a.focus()}),i(),a.on("changes",x.debounce(function(){e.value=a.getValue(),i(),a.historySize().undo<1?$("[data-command=undo]").setAttribute("disabled",""):$("[data-command=undo]").removeAttribute("disabled"),a.historySize().redo<1?$("[data-command=redo]").setAttribute("disabled",""):$("[data-command=redo]").removeAttribute("disabled")},500)),document.addEventListener("keydown",function(e){if(!e.altKey&&(e.ctrlKey||e.metaKey))switch(e.which){case 66:$("[data-command=bold]",t).click(),e.preventDefault();break;case 73:$("[data-command=italic]",t).click(),e.preventDefault();break;case 75:$("[data-command=link]",t).click(),e.preventDefault()}})}function pt(t){var e=$('label[for="'+t.id+'"]');function n(){var e=$('label[for="'+this.id+'"] span');0$&"),t.style.display=""):t.style.display="none"}))}function s(){this.value=x.validateSlug(this.value)}$$(".pages-list").forEach(function(e){var n,i,r;"true"===e.getAttribute("data-sortable-children")&&(i=[],i=(r=_e.create(n=e,{handle:".sort-handle",filter:"[data-sortable=false]",forceFallback:!0,onClone:function(e){e.item.closest(".pages-list").classList.add("dragging"),$$(".pages-children",e.item).forEach(function(e){e.style.display="none"}),$$(".page-children-toggle").forEach(function(e){e.classList.remove("toggle-expanded"),e.classList.add("toggle-collapsed"),e.style.opacity="0.5"})},onMove:function(e){if("false"===e.related.getAttribute("data-sortable"))return!1;$$(".pages-children",e.related).forEach(function(e){e.style.display="none"})},onEnd:function(e){var t;e.item.closest(".pages-list").classList.remove("dragging"),$$(".page-children-toggle").forEach(function(e){e.style.opacity=""}),e.newIndex!==e.oldIndex&&(r.option("disabled",!0),t={"csrf-token":$("meta[name=csrf-token]").getAttribute("content"),parent:n.getAttribute("data-parent"),from:e.oldIndex,to:e.newIndex},u({method:"POST",url:Formwork.config.baseUri+"pages/reorder/",data:t},function(e){e.status&&new l(e.message,e.status,5e3).show(),e.status&&"error"!==e.status||r.sort(i),r.option("disabled",!1),i=r.toArray()}))}})).toArray())}),$$(".page-details").forEach(function(e){var t=$(".page-children-toggle",e);t&&e.addEventListener("click",function(){t.click()})}),$$(".page-details a").forEach(function(e){e.addEventListener("click",function(e){e.stopPropagation()})}),$$(".page-children-toggle").forEach(function(e){e.addEventListener("click",function(e){var t;t=this,$$(".pages-list",t.closest("li")).forEach(function(e){x.toggleElement(e)}),t.classList.toggle("toggle-expanded"),t.classList.toggle("toggle-collapsed"),e.stopPropagation()})}),e&&e.addEventListener("click",function(){$$(".pages-children").forEach(function(e){e.style.display="block"}),$$(".pages-list .page-children-toggle").forEach(function(e){e.classList.remove("toggle-collapsed"),e.classList.add("toggle-expanded")}),this.blur()}),t&&t.addEventListener("click",function(){$$(".pages-children").forEach(function(e){e.style.display="none"}),$$(".pages-list .page-children-toggle").forEach(function(e){e.classList.remove("toggle-expanded"),e.classList.add("toggle-collapsed")}),this.blur()}),n&&n.addEventListener("click",function(){this.classList.toggle("active"),$$(".pages-list .sort-handle").forEach(function(e){x.toggleElement(e,"inline")}),this.blur()}),i&&(i.addEventListener("focus",function(){$$(".pages-children").forEach(function(e){e.setAttribute("data-display",getComputedStyle(e).display)})}),i.addEventListener("keyup",x.debounce(a,100)),i.addEventListener("search",a),document.addEventListener("keydown",function(e){(e.ctrlKey||e.metaKey)&&70===e.which&&document.activeElement!==i&&(i.focus(),e.preventDefault())})),r&&($("#page-title",r).addEventListener("keyup",function(){$("#page-slug",r).value=x.slug(this.value)}),$("#page-slug",r).addEventListener("keyup",s),$("#page-slug",r).addEventListener("blur",s),$("#page-parent",r).addEventListener("change",function(){var e=this.options[this.selectedIndex],t=$("#page-template",r),n=e.getAttribute("data-allowed-templates"),i=0;if(null!==n)for(n=n.split(", "),t.setAttribute("data-previous-value",t.value),t.value=n[0],i=0;i