HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux WebLive 5.15.0-79-generic #86-Ubuntu SMP Mon Jul 10 16:07:21 UTC 2023 x86_64
User: ubuntu (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/html/wpwisesolutions/wp-content/plugins/ninja-forms/assets/js/min/front-end--rte.min.js
window.CodeMirror=function(){"use strict";function t(r,n){if(!(this instanceof t))return new t(r,n);this.options=n=n||{};for(var i in ai)!n.hasOwnProperty(i)&&ai.hasOwnProperty(i)&&(n[i]=ai[i]);h(n);var o="string"==typeof n.value?0:n.value.first,l=this.display=e(r,o);l.wrapper.CodeMirror=this,u(this),n.autofocus&&!Vn&&pt(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,draggingText:!1,highlight:new jr},s(this),n.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap");var a=n.value;"string"==typeof a&&(a=new Ci(n.value,n.mode)),lt(this,dr)(this,a),An&&setTimeout(nn(dt,this,!0),20),mt(this);var c;try{c=document.activeElement==l.input}catch(f){}c||n.autofocus&&!Vn?setTimeout(nn(Et,this),20):zt(this),lt(this,function(){for(var t in si)si.propertyIsEnumerable(t)&&si[t](this,n[t],ui);for(var e=0;e<di.length;++e)di[e](this)})()}function e(t,e){var r={},n=r.input=sn("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none; font-size: 4px;");return Wn?n.style.width="1000px":n.setAttribute("wrap","off"),Gn&&(n.style.border="1px solid black"),n.setAttribute("autocorrect","off"),n.setAttribute("autocapitalize","off"),n.setAttribute("spellcheck","false"),r.inputDiv=sn("div",[n],null,"overflow: hidden; position: relative; width: 3px; height: 0px;"),r.scrollbarH=sn("div",[sn("div",null,null,"height: 1px")],"CodeMirror-hscrollbar"),r.scrollbarV=sn("div",[sn("div",null,null,"width: 1px")],"CodeMirror-vscrollbar"),r.scrollbarFiller=sn("div",null,"CodeMirror-scrollbar-filler"),r.gutterFiller=sn("div",null,"CodeMirror-gutter-filler"),r.lineDiv=sn("div",null,"CodeMirror-code"),r.selectionDiv=sn("div",null,null,"position: relative; z-index: 1"),r.cursor=sn("div"," ","CodeMirror-cursor"),r.otherCursor=sn("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"),r.measure=sn("div",null,"CodeMirror-measure"),r.lineSpace=sn("div",[r.measure,r.selectionDiv,r.lineDiv,r.cursor,r.otherCursor],null,"position: relative; outline: none"),r.mover=sn("div",[sn("div",[r.lineSpace],"CodeMirror-lines")],null,"position: relative"),r.sizer=sn("div",[r.mover],"CodeMirror-sizer"),r.heightForcer=sn("div",null,null,"position: absolute; height: "+Mi+"px; width: 1px;"),r.gutters=sn("div",null,"CodeMirror-gutters"),r.lineGutter=null,r.scroller=sn("div",[r.sizer,r.heightForcer,r.gutters],"CodeMirror-scroll"),r.scroller.setAttribute("tabIndex","-1"),r.wrapper=sn("div",[r.inputDiv,r.scrollbarH,r.scrollbarV,r.scrollbarFiller,r.gutterFiller,r.scroller],"CodeMirror"),Nn&&(r.gutters.style.zIndex=-1,r.scroller.style.paddingRight=0),t.appendChild?t.appendChild(r.wrapper):t(r.wrapper),Gn&&(n.style.width="0px"),Wn||(r.scroller.draggable=!0),Fn?(r.inputDiv.style.height="1px",r.inputDiv.style.position="absolute"):Nn&&(r.scrollbarH.style.minWidth=r.scrollbarV.style.minWidth="18px"),r.viewOffset=r.lastSizeC=0,r.showingFrom=r.showingTo=e,r.lineNumWidth=r.lineNumInnerWidth=r.lineNumChars=null,r.prevInput="",r.alignWidgets=!1,r.pollingFast=!1,r.poll=new jr,r.cachedCharWidth=r.cachedTextHeight=null,r.measureLineCache=[],r.measureLineCachePos=0,r.inaccurateSelection=!1,r.maxLine=null,r.maxLineLength=0,r.maxLineChanged=!1,r.wheelDX=r.wheelDY=r.wheelStartX=r.wheelStartY=null,r}function r(e){e.doc.mode=t.getMode(e.options,e.doc.modeOption),e.doc.iter(function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)}),e.doc.frontier=e.doc.first,W(e,100),e.state.modeGen++,e.curOp&&ut(e)}function n(t){t.options.lineWrapping?(t.display.wrapper.className+=" CodeMirror-wrap",t.display.sizer.style.minWidth=""):(t.display.wrapper.className=t.display.wrapper.className.replace(" CodeMirror-wrap",""),f(t)),o(t),ut(t),_(t),setTimeout(function(){d(t)},100)}function i(t){var e=rt(t.display),r=t.options.lineWrapping,n=r&&Math.max(5,t.display.scroller.clientWidth/nt(t.display)-3);return function(i){return Ve(t.doc,i)?0:r?(Math.ceil(i.text.length/n)||1)*e:e}}function o(t){var e=t.doc,r=i(t);e.iter(function(t){var e=r(t);e!=t.height&&vr(t,e)})}function l(t){var e=mi[t.options.keyMap],r=e.style;t.display.wrapper.className=t.display.wrapper.className.replace(/\s*cm-keymap-\S+/g,"")+(r?" cm-keymap-"+r:""),t.state.disableInput=e.disableInput}function s(t){t.display.wrapper.className=t.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+t.options.theme.replace(/(^|\s)\s*/g," cm-s-"),_(t)}function a(t){u(t),ut(t),setTimeout(function(){g(t)},20)}function u(t){var e=t.display.gutters,r=t.options.gutters;an(e);for(var n=0;n<r.length;++n){var i=r[n],o=e.appendChild(sn("div",null,"CodeMirror-gutter "+i));"CodeMirror-linenumbers"==i&&(t.display.lineGutter=o,o.style.width=(t.display.lineNumWidth||1)+"px")}e.style.display=n?"":"none"}function c(t,e){if(0==e.height)return 0;for(var r,n=e.text.length,i=e;r=Re(i);){var o=r.find();i=pr(t,o.from.line),n+=o.from.ch-o.to.ch}for(i=e;r=Be(i);){var o=r.find();n-=i.text.length-o.from.ch,i=pr(t,o.to.line),n+=i.text.length-o.to.ch}return n}function f(t){var e=t.display,r=t.doc;e.maxLine=pr(r,r.first),e.maxLineLength=c(r,e.maxLine),e.maxLineChanged=!0,r.iter(function(t){var n=c(r,t);n>e.maxLineLength&&(e.maxLineLength=n,e.maxLine=t)})}function h(t){var e=Jr(t.gutters,"CodeMirror-linenumbers");-1==e&&t.lineNumbers?t.gutters=t.gutters.concat(["CodeMirror-linenumbers"]):e>-1&&!t.lineNumbers&&(t.gutters=t.gutters.slice(0),t.gutters.splice(e,1))}function d(t){var e=t.display,r=t.doc.height,n=r+F(e);e.sizer.style.minHeight=e.heightForcer.style.top=n+"px",e.gutters.style.height=Math.max(n,e.scroller.clientHeight-Mi)+"px";var i=Math.max(n,e.scroller.scrollHeight),o=e.scroller.scrollWidth>e.scroller.clientWidth+1,l=i>e.scroller.clientHeight+1;l?(e.scrollbarV.style.display="block",e.scrollbarV.style.bottom=o?dn(e.measure)+"px":"0",e.scrollbarV.firstChild.style.height=i-e.scroller.clientHeight+e.scrollbarV.clientHeight+"px"):(e.scrollbarV.style.display="",e.scrollbarV.firstChild.style.height="0"),o?(e.scrollbarH.style.display="block",e.scrollbarH.style.right=l?dn(e.measure)+"px":"0",e.scrollbarH.firstChild.style.width=e.scroller.scrollWidth-e.scroller.clientWidth+e.scrollbarH.clientWidth+"px"):(e.scrollbarH.style.display="",e.scrollbarH.firstChild.style.width="0"),o&&l?(e.scrollbarFiller.style.display="block",e.scrollbarFiller.style.height=e.scrollbarFiller.style.width=dn(e.measure)+"px"):e.scrollbarFiller.style.display="",o&&t.options.coverGutterNextToScrollbar&&t.options.fixedGutter?(e.gutterFiller.style.display="block",e.gutterFiller.style.height=dn(e.measure)+"px",e.gutterFiller.style.width=e.gutters.offsetWidth+"px"):e.gutterFiller.style.display="",Pn&&0===dn(e.measure)&&(e.scrollbarV.style.minWidth=e.scrollbarH.style.minHeight=Rn?"18px":"12px",e.scrollbarV.style.pointerEvents=e.scrollbarH.style.pointerEvents="none")}function p(t,e,r){var n=t.scroller.scrollTop,i=t.wrapper.clientHeight;"number"==typeof r?n=r:r&&(n=r.top,i=r.bottom-r.top),n=Math.floor(n-I(t));var o=Math.ceil(n+i);return{from:br(e,n),to:br(e,o)}}function g(t){var e=t.display;if(e.alignWidgets||e.gutters.firstChild&&t.options.fixedGutter){for(var r=y(e)-e.scroller.scrollLeft+t.doc.scrollLeft,n=e.gutters.offsetWidth,i=r+"px",o=e.lineDiv.firstChild;o;o=o.nextSibling)if(o.alignable)for(var l=0,s=o.alignable;l<s.length;++l)s[l].style.left=i;t.options.fixedGutter&&(e.gutters.style.left=r+n+"px")}}function m(t){if(!t.options.lineNumbers)return!1;var e=t.doc,r=v(t.options,e.first+e.size-1),n=t.display;if(r.length!=n.lineNumChars){var i=n.measure.appendChild(sn("div",[sn("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=i.firstChild.offsetWidth,l=i.offsetWidth-o;return n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(o,n.lineGutter.offsetWidth-l),n.lineNumWidth=n.lineNumInnerWidth+l,n.lineNumChars=n.lineNumInnerWidth?r.length:-1,n.lineGutter.style.width=n.lineNumWidth+"px",!0}return!1}function v(t,e){return String(t.lineNumberFormatter(e+t.firstLineNumber))}function y(t){return fn(t.scroller).left-fn(t.sizer).left}function b(t,e,r,n){for(var i,o=t.display.showingFrom,l=t.display.showingTo,s=p(t.display,t.doc,r),a=!0;;a=!1){var u=t.display.scroller.clientWidth;if(!x(t,e,s,n))break;if(i=!0,e=[],A(t),d(t),a&&t.options.lineWrapping&&u!=t.display.scroller.clientWidth)n=!0;else if(n=!1,r&&(r=Math.min(t.display.scroller.scrollHeight-t.display.scroller.clientHeight,"number"==typeof r?r:r.top)),s=p(t.display,t.doc,r),s.from>=t.display.showingFrom&&s.to<=t.display.showingTo)break}return i&&(Kr(t,"update",t),(t.display.showingFrom!=o||t.display.showingTo!=l)&&Kr(t,"viewportChange",t,t.display.showingFrom,t.display.showingTo)),i}function x(t,e,r,n){var i=t.display,o=t.doc;if(!i.wrapper.clientWidth)return i.showingFrom=i.showingTo=o.first,void(i.viewOffset=0);if(!(!n&&0==e.length&&r.from>i.showingFrom&&r.to<i.showingTo)){m(t)&&(e=[{from:o.first,to:o.first+o.size}]);var l=i.sizer.style.marginLeft=i.gutters.offsetWidth+"px";i.scrollbarH.style.left=t.options.fixedGutter?l:"0";var s=1/0;if(t.options.lineNumbers)for(var a=0;a<e.length;++a)e[a].diff&&e[a].from<s&&(s=e[a].from);var u=o.first+o.size,c=Math.max(r.from-t.options.viewportMargin,o.first),f=Math.min(u,r.to+t.options.viewportMargin);if(i.showingFrom<c&&c-i.showingFrom<20&&(c=Math.max(o.first,i.showingFrom)),i.showingTo>f&&i.showingTo-f<20&&(f=Math.min(u,i.showingTo)),Qn)for(c=yr(Ge(o,pr(o,c)));u>f&&Ve(o,pr(o,f));)++f;var h=[{from:Math.max(i.showingFrom,o.first),to:Math.min(i.showingTo,u)}];if(h=h[0].from>=h[0].to?[]:L(h,e),Qn)for(var a=0;a<h.length;++a)for(var d,p=h[a];d=Be(pr(o,p.to-1));){var g=d.find().from.line;if(!(g>p.from)){h.splice(a--,1);break}p.to=g}for(var v=0,a=0;a<h.length;++a){var p=h[a];p.from<c&&(p.from=c),p.to>f&&(p.to=f),p.from>=p.to?h.splice(a--,1):v+=p.to-p.from}if(!n&&v==f-c&&c==i.showingFrom&&f==i.showingTo)return void w(t);h.sort(function(t,e){return t.from-e.from});try{var y=document.activeElement}catch(b){}.7*(f-c)>v&&(i.lineDiv.style.display="none"),S(t,c,f,h,s),i.lineDiv.style.display="",y&&document.activeElement!=y&&y.offsetHeight&&y.focus();var x=c!=i.showingFrom||f!=i.showingTo||i.lastSizeC!=i.wrapper.clientHeight;return x&&(i.lastSizeC=i.wrapper.clientHeight,W(t,400)),i.showingFrom=c,i.showingTo=f,C(t),w(t),!0}}function C(t){for(var e,r=t.display,n=r.lineDiv.offsetTop,i=r.lineDiv.firstChild;i;i=i.nextSibling)if(i.lineObj){if(Nn){var o=i.offsetTop+i.offsetHeight;e=o-n,n=o}else{var l=fn(i);e=l.bottom-l.top}var s=i.lineObj.height-e;if(2>e&&(e=rt(r)),s>.001||-.001>s){vr(i.lineObj,e);var a=i.lineObj.widgets;if(a)for(var u=0;u<a.length;++u)a[u].height=a[u].node.offsetHeight}}}function w(t){var e=t.display.viewOffset=xr(t,pr(t.doc,t.display.showingFrom));t.display.mover.style.top=e+"px"}function L(t,e){for(var r=0,n=e.length||0;n>r;++r){for(var i=e[r],o=[],l=i.diff||0,s=0,a=t.length;a>s;++s){var u=t[s];i.to<=u.from&&i.diff?o.push({from:u.from+l,to:u.to+l}):i.to<=u.from||i.from>=u.to?o.push(u):(i.from>u.from&&o.push({from:u.from,to:i.from}),i.to<u.to&&o.push({from:i.to+l,to:u.to+l}))}t=o}return t}function k(t){for(var e=t.display,r={},n={},i=e.gutters.firstChild,o=0;i;i=i.nextSibling,++o)r[t.options.gutters[o]]=i.offsetLeft,n[t.options.gutters[o]]=i.offsetWidth;return{fixedPos:y(e),gutterTotalWidth:e.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:e.wrapper.clientWidth}}function S(t,e,r,n,i){function o(e){var r=e.nextSibling;return Wn&&Kn&&t.display.currentWheelTarget==e?(e.style.display="none",e.lineObj=null):e.parentNode.removeChild(e),r}var l=k(t),s=t.display,a=t.options.lineNumbers;n.length||Wn&&t.display.currentWheelTarget||an(s.lineDiv);var u=s.lineDiv,c=u.firstChild,f=n.shift(),h=e;for(t.doc.iter(e,r,function(e){if(f&&f.to==h&&(f=n.shift()),Ve(t.doc,e)){if(0!=e.height&&vr(e,0),e.widgets&&c&&c.previousSibling)for(var r=0;r<e.widgets.length;++r){var s=e.widgets[r];if(s.showIfHidden){var d=c.previousSibling;if(/pre/i.test(d.nodeName)){var p=sn("div",null,null,"position: relative");d.parentNode.replaceChild(p,d),p.appendChild(d),d=p}var g=d.appendChild(sn("div",[s.node],"CodeMirror-linewidget"));s.handleMouseEvents||(g.ignoreEvents=!0),T(s,g,d,l)}}}else if(f&&f.from<=h&&f.to>h){for(;c.lineObj!=e;)c=o(c);a&&h>=i&&c.lineNumber&&cn(c.lineNumber,v(t.options,h)),c=c.nextSibling}else{if(e.widgets)for(var m,y=0,b=c;b&&20>y;++y,b=b.nextSibling)if(b.lineObj==e&&/div/i.test(b.nodeName)){m=b;break}var x=M(t,e,h,l,m);if(x!=m)u.insertBefore(x,c);else{for(;c!=m;)c=o(c);c=c.nextSibling}x.lineObj=e}++h});c;)c=o(c)}function M(t,e,r,n,i){var o,l=rr(t,e),s=l.pre,a=e.gutterMarkers,u=t.display,c=l.bgClass?l.bgClass+" "+(e.bgClass||""):e.bgClass;if(!(t.options.lineNumbers||a||c||e.wrapClass||e.widgets))return s;if(i){i.alignable=null;for(var f,h=!0,d=0,p=null,g=i.firstChild;g;g=f)if(f=g.nextSibling,/\bCodeMirror-linewidget\b/.test(g.className)){for(var m=0;m<e.widgets.length;++m){var y=e.widgets[m];if(y.node==g.firstChild){y.above||p||(p=g),T(y,g,i,n),++d;break}}if(m==e.widgets.length){h=!1;break}}else i.removeChild(g);i.insertBefore(s,p),h&&d==e.widgets.length&&(o=i,i.className=e.wrapClass||"")}if(o||(o=sn("div",null,e.wrapClass,"position: relative"),o.appendChild(s)),c&&o.insertBefore(sn("div",null,c+" CodeMirror-linebackground"),o.firstChild),t.options.lineNumbers||a){var b=o.insertBefore(sn("div",null,null,"position: absolute; left: "+(t.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px"),o.firstChild);if(t.options.fixedGutter&&(o.alignable||(o.alignable=[])).push(b),!t.options.lineNumbers||a&&a["CodeMirror-linenumbers"]||(o.lineNumber=b.appendChild(sn("div",v(t.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+u.lineNumInnerWidth+"px"))),a)for(var x=0;x<t.options.gutters.length;++x){var C=t.options.gutters[x],w=a.hasOwnProperty(C)&&a[C];w&&b.appendChild(sn("div",[w],"CodeMirror-gutter-elt","left: "+n.gutterLeft[C]+"px; width: "+n.gutterWidth[C]+"px"))}}if(Nn&&(o.style.zIndex=2),e.widgets&&o!=i)for(var m=0,L=e.widgets;m<L.length;++m){var y=L[m],k=sn("div",[y.node],"CodeMirror-linewidget");y.handleMouseEvents||(k.ignoreEvents=!0),T(y,k,o,n),y.above?o.insertBefore(k,t.options.lineNumbers&&0!=e.height?b:s):o.appendChild(k),Kr(y,"redraw")}return o}function T(t,e,r,n){if(t.noHScroll){(r.alignable||(r.alignable=[])).push(e);var i=n.wrapperWidth;e.style.left=n.fixedPos+"px",t.coverGutter||(i-=n.gutterTotalWidth,e.style.paddingLeft=n.gutterTotalWidth+"px"),e.style.width=i+"px"}t.coverGutter&&(e.style.zIndex=5,e.style.position="relative",t.noHScroll||(e.style.marginLeft=-n.gutterTotalWidth+"px"))}function A(t){var e=t.display,r=jt(t.doc.sel.from,t.doc.sel.to);if(r||t.options.showCursorWhenSelecting?N(t):e.cursor.style.display=e.otherCursor.style.display="none",r?e.selectionDiv.style.display="none":H(t),t.options.moveInputWithCursor){var n=Q(t,t.doc.sel.head,"div"),i=fn(e.wrapper),o=fn(e.lineDiv);e.inputDiv.style.top=Math.max(0,Math.min(e.wrapper.clientHeight-10,n.top+o.top-i.top))+"px",e.inputDiv.style.left=Math.max(0,Math.min(e.wrapper.clientWidth-10,n.left+o.left-i.left))+"px"}}function N(t){var e=t.display,r=Q(t,t.doc.sel.head,"div");e.cursor.style.left=r.left+"px",e.cursor.style.top=r.top+"px",e.cursor.style.height=Math.max(0,r.bottom-r.top)*t.options.cursorHeight+"px",e.cursor.style.display="",r.other?(e.otherCursor.style.display="",e.otherCursor.style.left=r.other.left+"px",e.otherCursor.style.top=r.other.top+"px",e.otherCursor.style.height=.85*(r.other.bottom-r.other.top)+"px"):e.otherCursor.style.display="none"}function H(t){function e(t,e,r,n){0>e&&(e=0),l.appendChild(sn("div",null,"CodeMirror-selected","position: absolute; left: "+t+"px; top: "+e+"px; width: "+(null==r?s-t:r)+"px; height: "+(n-e)+"px"))}function r(r,n,o){function l(e,n){return q(t,Yt(r,e),"div",f,n)}var u,c,f=pr(i,r),h=f.text.length;return gn(Cr(f),n||0,null==o?h:o,function(t,r,i){var f,d,p,g=l(t,"left");if(t==r)f=g,d=p=g.left;else{if(f=l(r-1,"right"),"rtl"==i){var m=g;g=f,f=m}d=g.left,p=f.right}null==n&&0==t&&(d=a),f.top-g.top>3&&(e(d,g.top,null,g.bottom),d=a,g.bottom<f.top&&e(d,g.bottom,null,f.top)),null==o&&r==h&&(p=s),(!u||g.top<u.top||g.top==u.top&&g.left<u.left)&&(u=g),(!c||f.bottom>c.bottom||f.bottom==c.bottom&&f.right>c.right)&&(c=f),a+1>d&&(d=a),e(d,f.top,p-d,f.bottom)}),{start:u,end:c}}var n=t.display,i=t.doc,o=t.doc.sel,l=document.createDocumentFragment(),s=n.lineSpace.offsetWidth,a=P(t.display);if(o.from.line==o.to.line)r(o.from.line,o.from.ch,o.to.ch);else{var u=pr(i,o.from.line),c=pr(i,o.to.line),f=Ge(i,u)==Ge(i,c),h=r(o.from.line,o.from.ch,f?u.text.length:null).end,d=r(o.to.line,f?0:null,o.to.ch).start;f&&(h.top<d.top-2?(e(h.right,h.top,null,h.bottom),e(a,d.top,d.left,d.bottom)):e(h.right,h.top,d.left-h.right,h.bottom)),h.bottom<d.top&&e(a,h.bottom,null,d.top)}un(n.selectionDiv,l),n.selectionDiv.style.display=""}function D(t){if(t.state.focused){var e=t.display;clearInterval(e.blinker);var r=!0;e.cursor.style.visibility=e.otherCursor.style.visibility="",t.options.cursorBlinkRate>0&&(e.blinker=setInterval(function(){e.cursor.style.visibility=e.otherCursor.style.visibility=(r=!r)?"":"hidden"},t.options.cursorBlinkRate))}}function W(t,e){t.doc.mode.startState&&t.doc.frontier<t.display.showingTo&&t.state.highlight.set(e,nn(O,t))}function O(t){var e=t.doc;if(e.frontier<e.first&&(e.frontier=e.first),!(e.frontier>=t.display.showingTo)){var r,n=+new Date+t.options.workTime,i=be(e.mode,z(t,e.frontier)),o=[];e.iter(e.frontier,Math.min(e.first+e.size,t.display.showingTo+500),function(l){if(e.frontier>=t.display.showingFrom){var s=l.styles;l.styles=Qe(t,l,i,!0);for(var a=!s||s.length!=l.styles.length,u=0;!a&&u<s.length;++u)a=s[u]!=l.styles[u];a&&(r&&r.end==e.frontier?r.end++:o.push(r={start:e.frontier,end:e.frontier+1})),l.stateAfter=be(e.mode,i)}else tr(t,l.text,i),l.stateAfter=e.frontier%5==0?be(e.mode,i):null;return++e.frontier,+new Date>n?(W(t,t.options.workDelay),!0):void 0}),o.length&&lt(t,function(){for(var t=0;t<o.length;++t)ut(this,o[t].start,o[t].end)})()}}function E(t,e,r){for(var n,i,o=t.doc,l=r?-1:e-(t.doc.mode.innerMode?1e3:100),s=e;s>l;--s){if(s<=o.first)return o.first;var a=pr(o,s-1);if(a.stateAfter&&(!r||s<=o.frontier))return s;var u=$r(a.text,null,t.options.tabSize);(null==i||n>u)&&(i=s-1,n=u)}return i}function z(t,e,r){var n=t.doc,i=t.display;if(!n.mode.startState)return!0;var o=E(t,e,r),l=o>n.first&&pr(n,o-1).stateAfter;return l=l?be(n.mode,l):xe(n.mode),n.iter(o,e,function(r){tr(t,r.text,l);var s=o==e-1||o%5==0||o>=i.showingFrom&&o<i.showingTo;r.stateAfter=s?be(n.mode,l):null,++o}),r&&(n.frontier=o),l}function I(t){return t.lineSpace.offsetTop}function F(t){return t.mover.offsetHeight-t.lineSpace.offsetHeight}function P(t){var e=un(t.measure,sn("pre",null,null,"text-align: left")).appendChild(sn("span","x"));return e.offsetLeft}function R(t,e,r,n,i){var o=-1;if(n=n||V(t,e),n.crude){var l=n.left+r*n.width;return{left:l,right:l+n.width,top:n.top,bottom:n.bottom}}for(var s=r;;s+=o){var a=n[s];if(a)break;0>o&&0==s&&(o=1)}return i=s>r?"left":r>s?"right":i,"left"==i&&a.leftSide?a=a.leftSide:"right"==i&&a.rightSide&&(a=a.rightSide),{left:r>s?a.right:a.left,right:s>r?a.left:a.right,top:a.top,bottom:a.bottom}}function B(t,e){for(var r=t.display.measureLineCache,n=0;n<r.length;++n){var i=r[n];if(i.text==e.text&&i.markedSpans==e.markedSpans&&t.display.scroller.clientWidth==i.width&&i.classes==e.textClass+"|"+e.wrapClass)return i}}function G(t,e){var r=B(t,e);r&&(r.text=r.measure=r.markedSpans=null)}function V(t,e){var r=B(t,e);if(r)return r.measure;var n=K(t,e),i=t.display.measureLineCache,o={text:e.text,width:t.display.scroller.clientWidth,markedSpans:e.markedSpans,measure:n,classes:e.textClass+"|"+e.wrapClass};return 16==i.length?i[++t.display.measureLineCachePos%16]=o:i.push(o),n}function K(t,e){function r(t){var e=t.top-p.top,r=t.bottom-p.top;r>v&&(r=v),0>e&&(e=0);for(var n=g.length-2;n>=0;n-=2){var i=g[n],o=g[n+1];if(!(i>r||e>o)&&(e>=i&&o>=r||i>=e&&r>=o||Math.min(r,o)-Math.max(e,i)>=r-e>>1)){g[n]=Math.min(e,i),g[n+1]=Math.max(r,o);break}}return 0>n&&(n=g.length,g.push(e,r)),{left:t.left-p.left,right:t.right-p.left,top:n,bottom:null}}function n(t){t.bottom=g[t.top+1],t.top=g[t.top]}if(!t.options.lineWrapping&&e.text.length>=t.options.crudeMeasuringFrom)return U(t,e);var i=t.display,o=rn(e.text.length),l=rr(t,e,o,!0).pre;if(An&&!Nn&&!t.options.lineWrapping&&l.childNodes.length>100){for(var s=document.createDocumentFragment(),a=10,u=l.childNodes.length,c=0,f=Math.ceil(u/a);f>c;++c){for(var h=sn("div",null,null,"display: inline-block"),d=0;a>d&&u;++d)h.appendChild(l.firstChild),--u;s.appendChild(h)}l.appendChild(s)}un(i.measure,l);var p=fn(i.lineDiv),g=[],m=rn(e.text.length),v=l.offsetHeight;Hn&&i.measure.first!=l&&un(i.measure,l);for(var y,c=0;c<o.length;++c)if(y=o[c]){var b=y,x=null;if(/\bCodeMirror-widget\b/.test(y.className)&&y.getClientRects){1==y.firstChild.nodeType&&(b=y.firstChild);var C=b.getClientRects();C.length>1&&(x=m[c]=r(C[0]),x.rightSide=r(C[C.length-1]))}x||(x=m[c]=r(fn(b))),y.measureRight&&(x.right=fn(y.measureRight).left),y.leftSide&&(x.leftSide=r(fn(y.leftSide)))}an(t.display.measure);for(var y,c=0;c<m.length;++c)(y=m[c])&&(n(y),y.leftSide&&n(y.leftSide),y.rightSide&&n(y.rightSide));return m}function U(t,e){var r=new yi(e.text.slice(0,100),null);e.textClass&&(r.textClass=e.textClass);var n=K(t,r),i=R(t,r,0,n,"left"),o=R(t,r,99,n,"right");return{crude:!0,top:i.top,left:i.left,bottom:i.bottom,width:(o.right-i.left)/100}}function X(t,e){var r=!1;if(e.markedSpans)for(var n=0;n<e.markedSpans;++n){var i=e.markedSpans[n];!i.collapsed||null!=i.to&&i.to!=e.text.length||(r=!0)}var o=!r&&B(t,e);if(o||e.text.length>=t.options.crudeMeasuringFrom)return R(t,e,e.text.length,o&&o.measure,"right").right;var l=rr(t,e,null,!0).pre,s=l.appendChild(pn(t.display.measure));return un(t.display.measure,l),fn(s).right-fn(t.display.lineDiv).left}function _(t){t.display.measureLineCache.length=t.display.measureLineCachePos=0,t.display.cachedCharWidth=t.display.cachedTextHeight=null,t.options.lineWrapping||(t.display.maxLineChanged=!0),t.display.lineNumChars=null}function Y(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function j(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function $(t,e,r,n){if(e.widgets)for(var i=0;i<e.widgets.length;++i)if(e.widgets[i].above){var o=Ye(e.widgets[i]);r.top+=o,r.bottom+=o}if("line"==n)return r;n||(n="local");var l=xr(t,e);if("local"==n?l+=I(t.display):l-=t.display.viewOffset,"page"==n||"window"==n){var s=fn(t.display.lineSpace);l+=s.top+("window"==n?0:j());var a=s.left+("window"==n?0:Y());r.left+=a,r.right+=a}return r.top+=l,r.bottom+=l,r}function Z(t,e,r){if("div"==r)return e;var n=e.left,i=e.top;if("page"==r)n-=Y(),i-=j();else if("local"==r||!r){var o=fn(t.display.sizer);n+=o.left,i+=o.top}var l=fn(t.display.lineSpace);return{left:n-l.left,top:i-l.top}}function q(t,e,r,n,i){return n||(n=pr(t.doc,e.line)),$(t,n,R(t,n,e.ch,null,i),r)}function Q(t,e,r,n,i){function o(e,o){var l=R(t,n,e,i,o?"right":"left");return o?l.left=l.right:l.right=l.left,$(t,n,l,r)}function l(t,e){var r=s[e],n=r.level%2;return t==mn(r)&&e&&r.level<s[e-1].level?(r=s[--e],t=vn(r)-(r.level%2?0:1),n=!0):t==vn(r)&&e<s.length-1&&r.level<s[e+1].level&&(r=s[++e],t=mn(r)-r.level%2,n=!1),n&&t==r.to&&t>r.from?o(t-1):o(t,n)}n=n||pr(t.doc,e.line),i||(i=V(t,n));var s=Cr(n),a=e.ch;if(!s)return o(a);var u=Ln(s,a),c=l(a,u);return null!=Pi&&(c.other=l(a,Pi)),c}function J(t,e,r,n){var i=new Yt(t,e);return i.xRel=n,r&&(i.outside=!0),i}function tt(t,e,r){var n=t.doc;if(r+=t.display.viewOffset,0>r)return J(n.first,0,!0,-1);var i=br(n,r),o=n.first+n.size-1;if(i>o)return J(n.first+n.size-1,pr(n,o).text.length,!0,1);for(0>e&&(e=0);;){var l=pr(n,i),s=et(t,l,i,e,r),a=Be(l),u=a&&a.find();if(!a||!(s.ch>u.from.ch||s.ch==u.from.ch&&s.xRel>0))return s;i=u.to.line}}function et(t,e,r,n,i){function o(n){var i=Q(t,Yt(r,n),"line",e,u);return s=!0,l>i.bottom?i.left-a:l<i.top?i.left+a:(s=!1,i.left)}var l=i-xr(t,e),s=!1,a=2*t.display.wrapper.clientWidth,u=V(t,e),c=Cr(e),f=e.text.length,h=yn(e),d=bn(e),p=o(h),g=s,m=o(d),v=s;if(n>m)return J(r,d,v,1);for(;;){if(c?d==h||d==Sn(e,h,1):1>=d-h){for(var y=p>n||m-n>=n-p?h:d,b=n-(y==h?p:m);Hi.test(e.text.charAt(y));)++y;var x=J(r,y,y==h?g:v,0>b?-1:b?1:0);return x}var C=Math.ceil(f/2),w=h+C;if(c){w=h;for(var L=0;C>L;++L)w=Sn(e,w,1)}var k=o(w);k>n?(d=w,m=k,(v=s)&&(m+=1e3),f=C):(h=w,p=k,g=s,f-=C)}}function rt(t){if(null!=t.cachedTextHeight)return t.cachedTextHeight;if(null==_n){_n=sn("pre");for(var e=0;49>e;++e)_n.appendChild(document.createTextNode("x")),_n.appendChild(sn("br"));_n.appendChild(document.createTextNode("x"))}un(t.measure,_n);var r=_n.offsetHeight/50;return r>3&&(t.cachedTextHeight=r),an(t.measure),r||1}function nt(t){if(null!=t.cachedCharWidth)return t.cachedCharWidth;var e=sn("span","x"),r=sn("pre",[e]);un(t.measure,r);var n=e.offsetWidth;return n>2&&(t.cachedCharWidth=n),n||10}function it(t){t.curOp={changes:[],forceUpdate:!1,updateInput:null,userSelChange:null,textChanged:null,selectionChanged:!1,cursorActivity:!1,updateMaxLine:!1,updateScrollPos:!1,id:++Jn},Si++||(ki=[])}function ot(t){var e=t.curOp,r=t.doc,n=t.display;if(t.curOp=null,e.updateMaxLine&&f(t),n.maxLineChanged&&!t.options.lineWrapping&&n.maxLine){var i=X(t,n.maxLine);n.sizer.style.minWidth=Math.max(0,i+3+Mi)+"px",n.maxLineChanged=!1;var o=Math.max(0,n.sizer.offsetLeft+n.sizer.offsetWidth-n.scroller.clientWidth);o<r.scrollLeft&&!e.updateScrollPos&&Mt(t,Math.min(n.scroller.scrollLeft,o),!0)}var l,s;if(e.updateScrollPos)l=e.updateScrollPos;else if(e.selectionChanged&&n.scroller.clientHeight){var a=Q(t,r.sel.head);l=ue(t,a.left,a.top,a.left,a.bottom)}if((e.changes.length||e.forceUpdate||l&&null!=l.scrollTop)&&(s=b(t,e.changes,l&&l.scrollTop,e.forceUpdate),t.display.scroller.offsetHeight&&(t.doc.scrollTop=t.display.scroller.scrollTop)),!s&&e.selectionChanged&&A(t),e.updateScrollPos){var u=Math.max(0,Math.min(n.scroller.scrollHeight-n.scroller.clientHeight,l.scrollTop)),c=Math.max(0,Math.min(n.scroller.scrollWidth-n.scroller.clientWidth,l.scrollLeft));n.scroller.scrollTop=n.scrollbarV.scrollTop=r.scrollTop=u,n.scroller.scrollLeft=n.scrollbarH.scrollLeft=r.scrollLeft=c,g(t),e.scrollToPos&&se(t,Qt(t.doc,e.scrollToPos.from),Qt(t.doc,e.scrollToPos.to),e.scrollToPos.margin)}else l&&le(t);e.selectionChanged&&D(t),t.state.focused&&e.updateInput&&dt(t,e.userSelChange);var h=e.maybeHiddenMarkers,d=e.maybeUnhiddenMarkers;if(h)for(var p=0;p<h.length;++p)h[p].lines.length||Vr(h[p],"hide");if(d)for(var p=0;p<d.length;++p)d[p].lines.length&&Vr(d[p],"unhide");var m;if(--Si||(m=ki,ki=null),e.textChanged&&Vr(t,"change",t,e.textChanged),e.cursorActivity&&Vr(t,"cursorActivity",t),m)for(var p=0;p<m.length;++p)m[p]()}function lt(t,e){return function(){var r=t||this,n=!r.curOp;n&&it(r);try{var i=e.apply(r,arguments)}finally{n&&ot(r)}return i}}function st(t){return function(){var e,r=this.cm&&!this.cm.curOp;r&&it(this.cm);try{e=t.apply(this,arguments)}finally{r&&ot(this.cm)}return e}}function at(t,e){var r,n=!t.curOp;n&&it(t);try{r=e()}finally{n&&ot(t)}return r}function ut(t,e,r,n){null==e&&(e=t.doc.first),null==r&&(r=t.doc.first+t.doc.size),t.curOp.changes.push({from:e,to:r,diff:n})}function ct(t){t.display.pollingFast||t.display.poll.set(t.options.pollInterval,function(){ht(t),t.state.focused&&ct(t)})}function ft(t){function e(){var n=ht(t);n||r?(t.display.pollingFast=!1,ct(t)):(r=!0,t.display.poll.set(60,e))}var r=!1;t.display.pollingFast=!0,t.display.poll.set(20,e)}function ht(t){var e=t.display.input,r=t.display.prevInput,n=t.doc,i=n.sel;if(!t.state.focused||zi(e)||gt(t)||t.state.disableInput)return!1;t.state.pasteIncoming&&t.state.fakedLastChar&&(e.value=e.value.substring(0,e.value.length-1),t.state.fakedLastChar=!1);var o=e.value;if(o==r&&jt(i.from,i.to))return!1;if(An&&!Hn&&t.display.inputHasSelection===o)return dt(t,!0),!1;var l=!t.curOp;l&&it(t),i.shift=!1;for(var s=0,a=Math.min(r.length,o.length);a>s&&r.charCodeAt(s)==o.charCodeAt(s);)++s;var u=i.from,c=i.to;s<r.length?u=Yt(u.line,u.ch-(r.length-s)):t.state.overwrite&&jt(u,c)&&!t.state.pasteIncoming&&(c=Yt(c.line,Math.min(pr(n,c.line).text.length,c.ch+(o.length-s))));var f=t.curOp.updateInput,h={from:u,to:c,text:Ei(o.slice(s)),origin:t.state.pasteIncoming?"paste":"+input"};return Bt(t.doc,h,"end"),t.curOp.updateInput=f,Kr(t,"inputRead",t,h),o.length>1e3||o.indexOf("\n")>-1?e.value=t.display.prevInput="":t.display.prevInput=o,l&&ot(t),t.state.pasteIncoming=!1,!0}function dt(t,e){var r,n,i=t.doc;if(jt(i.sel.from,i.sel.to))e&&(t.display.prevInput=t.display.input.value="",An&&!Hn&&(t.display.inputHasSelection=null));else{t.display.prevInput="",r=Ii&&(i.sel.to.line-i.sel.from.line>100||(n=t.getSelection()).length>1e3);var o=r?"-":n||t.getSelection();t.display.input.value=o,t.state.focused&&Qr(t.display.input),An&&!Hn&&(t.display.inputHasSelection=o)}t.display.inaccurateSelection=r}function pt(t){"nocursor"==t.options.readOnly||Vn&&document.activeElement==t.display.input||t.display.input.focus()}function gt(t){return t.options.readOnly||t.doc.cantEdit}function mt(t){function e(){t.state.focused&&setTimeout(nn(pt,t),0)}function r(){null==s&&(s=setTimeout(function(){s=null,l.cachedCharWidth=l.cachedTextHeight=Wi=null,_(t),at(t,nn(ut,t))},100))}function n(){for(var t=l.wrapper.parentNode;t&&t!=document.body;t=t.parentNode);t?setTimeout(n,5e3):Gr(window,"resize",r)}function i(e){Ur(t,e)||t.options.onDragEvent&&t.options.onDragEvent(t,Or(e))||Fr(e)}function o(){l.inaccurateSelection&&(l.prevInput="",l.inaccurateSelection=!1,l.input.value=t.getSelection(),Qr(l.input))}var l=t.display;Br(l.scroller,"mousedown",lt(t,bt)),An?Br(l.scroller,"dblclick",lt(t,function(e){if(!Ur(t,e)){var r=yt(t,e);if(r&&!wt(t,e)&&!vt(t.display,e)){Er(e);var n=me(pr(t.doc,r.line).text,r);ee(t.doc,n.from,n.to)}}})):Br(l.scroller,"dblclick",function(e){Ur(t,e)||Er(e)}),Br(l.lineSpace,"selectstart",function(t){vt(l,t)||Er(t)}),Zn||Br(l.scroller,"contextmenu",function(e){It(t,e)}),Br(l.scroller,"scroll",function(){l.scroller.clientHeight&&(St(t,l.scroller.scrollTop),Mt(t,l.scroller.scrollLeft,!0),Vr(t,"scroll",t))}),Br(l.scrollbarV,"scroll",function(){l.scroller.clientHeight&&St(t,l.scrollbarV.scrollTop)}),Br(l.scrollbarH,"scroll",function(){l.scroller.clientHeight&&Mt(t,l.scrollbarH.scrollLeft)}),Br(l.scroller,"mousewheel",function(e){Tt(t,e)}),Br(l.scroller,"DOMMouseScroll",function(e){Tt(t,e)}),Br(l.scrollbarH,"mousedown",e),Br(l.scrollbarV,"mousedown",e),Br(l.wrapper,"scroll",function(){l.wrapper.scrollTop=l.wrapper.scrollLeft=0});var s;Br(window,"resize",r),setTimeout(n,5e3),Br(l.input,"keyup",lt(t,function(e){Ur(t,e)||t.options.onKeyEvent&&t.options.onKeyEvent(t,Or(e))||16==e.keyCode&&(t.doc.sel.shift=!1)})),Br(l.input,"input",function(){An&&!Hn&&t.display.inputHasSelection&&(t.display.inputHasSelection=null),ft(t)}),Br(l.input,"keydown",lt(t,Wt)),Br(l.input,"keypress",lt(t,Ot)),Br(l.input,"focus",nn(Et,t)),Br(l.input,"blur",nn(zt,t)),t.options.dragDrop&&(Br(l.scroller,"dragstart",function(e){kt(t,e)}),Br(l.scroller,"dragenter",i),Br(l.scroller,"dragover",i),Br(l.scroller,"drop",lt(t,Lt))),Br(l.scroller,"paste",function(e){vt(l,e)||(pt(t),ft(t))}),Br(l.input,"paste",function(){if(Wn&&!t.state.fakedLastChar&&!(new Date-t.state.lastMiddleDown<200)){var e=l.input.selectionStart,r=l.input.selectionEnd;l.input.value+="$",l.input.selectionStart=e,l.input.selectionEnd=r,t.state.fakedLastChar=!0}t.state.pasteIncoming=!0,ft(t)}),Br(l.input,"cut",o),Br(l.input,"copy",o),Fn&&Br(l.sizer,"mouseup",function(){document.activeElement==l.input&&l.input.blur(),pt(t)})}function vt(t,e){for(var r=Pr(e);r!=t.wrapper;r=r.parentNode)if(!r||r.ignoreEvents||r.parentNode==t.sizer&&r!=t.mover)return!0}function yt(t,e,r){var n=t.display;if(!r){var i=Pr(e);if(i==n.scrollbarH||i==n.scrollbarH.firstChild||i==n.scrollbarV||i==n.scrollbarV.firstChild||i==n.scrollbarFiller||i==n.gutterFiller)return null}var o,l,s=fn(n.lineSpace);try{o=e.clientX,l=e.clientY}catch(e){return null}return tt(t,o-s.left,l-s.top)}function bt(t){function e(t){if(!jt(v,t)){
if(v=t,"single"==c)return void ee(i.doc,Qt(l,a),t);if(g=Qt(l,g),m=Qt(l,m),"double"==c){var e=me(pr(l,t.line).text,t);$t(t,g)?ee(i.doc,e.from,m):ee(i.doc,g,e.to)}else"triple"==c&&($t(t,g)?ee(i.doc,m,Qt(l,Yt(t.line,0))):ee(i.doc,g,Qt(l,Yt(t.line+1,0))))}}function r(t){var n=++b,s=yt(i,t,!0);if(s)if(jt(s,h)){var a=t.clientY<y.top?-20:t.clientY>y.bottom?20:0;a&&setTimeout(lt(i,function(){b==n&&(o.scroller.scrollTop+=a,r(t))}),50)}else{i.state.focused||Et(i),h=s,e(s);var u=p(o,l);(s.line>=u.to||s.line<u.from)&&setTimeout(lt(i,function(){b==n&&r(t)}),150)}}function n(t){b=1/0,Er(t),pt(i),Gr(document,"mousemove",x),Gr(document,"mouseup",C)}if(!Ur(this,t)){var i=this,o=i.display,l=i.doc,s=l.sel;if(s.shift=t.shiftKey,vt(o,t))return void(Wn||(o.scroller.draggable=!1,setTimeout(function(){o.scroller.draggable=!0},100)));if(!wt(i,t)){var a=yt(i,t);switch(Rr(t)){case 3:return void(Zn&&It.call(i,i,t));case 2:return Wn&&(i.state.lastMiddleDown=+new Date),a&&ee(i.doc,a),setTimeout(nn(pt,i),20),void Er(t)}if(!a)return void(Pr(t)==o.scroller&&Er(t));i.state.focused||Et(i);var u=+new Date,c="single";if(jn&&jn.time>u-400&&jt(jn.pos,a))c="triple",Er(t),setTimeout(nn(pt,i),20),ve(i,a.line);else if(Yn&&Yn.time>u-400&&jt(Yn.pos,a)){c="double",jn={time:u,pos:a},Er(t);var f=me(pr(l,a.line).text,a);ee(i.doc,f.from,f.to)}else Yn={time:u,pos:a};var h=a;if(i.options.dragDrop&&Di&&!gt(i)&&!jt(s.from,s.to)&&!$t(a,s.from)&&!$t(s.to,a)&&"single"==c){var d=lt(i,function(e){Wn&&(o.scroller.draggable=!1),i.state.draggingText=!1,Gr(document,"mouseup",d),Gr(o.scroller,"drop",d),Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)<10&&(Er(e),ee(i.doc,a),pt(i))});return Wn&&(o.scroller.draggable=!0),i.state.draggingText=d,o.scroller.dragDrop&&o.scroller.dragDrop(),Br(document,"mouseup",d),void Br(o.scroller,"drop",d)}Er(t),"single"==c&&ee(i.doc,Qt(l,a));var g=s.from,m=s.to,v=a,y=fn(o.wrapper),b=0,x=lt(i,function(t){An||Rr(t)?r(t):n(t)}),C=lt(i,n);Br(document,"mousemove",x),Br(document,"mouseup",C)}}}function xt(t,e,r,n,i){try{var o=e.clientX,l=e.clientY}catch(e){return!1}if(o>=Math.floor(fn(t.display.gutters).right))return!1;n&&Er(e);var s=t.display,a=fn(s.lineDiv);if(l>a.bottom||!_r(t,r))return Ir(e);l-=a.top-s.viewOffset;for(var u=0;u<t.options.gutters.length;++u){var c=s.gutters.childNodes[u];if(c&&fn(c).right>=o){var f=br(t.doc,l),h=t.options.gutters[u];return i(t,r,t,f,h,e),Ir(e)}}}function Ct(t,e){return _r(t,"gutterContextMenu")?xt(t,e,"gutterContextMenu",!1,Vr):!1}function wt(t,e){return xt(t,e,"gutterClick",!0,Kr)}function Lt(t){var e=this;if(!(Ur(e,t)||vt(e.display,t)||e.options.onDragEvent&&e.options.onDragEvent(e,Or(t)))){Er(t),An&&(ti=+new Date);var r=yt(e,t,!0),n=t.dataTransfer.files;if(r&&!gt(e))if(n&&n.length&&window.FileReader&&window.File)for(var i=n.length,o=Array(i),l=0,s=function(t,n){var s=new FileReader;s.onload=function(){o[n]=s.result,++l==i&&(r=Qt(e.doc,r),Bt(e.doc,{from:r,to:r,text:Ei(o.join("\n")),origin:"paste"},"around"))},s.readAsText(t)},a=0;i>a;++a)s(n[a],a);else{if(e.state.draggingText&&!$t(r,e.doc.sel.from)&&!$t(e.doc.sel.to,r))return e.state.draggingText(t),void setTimeout(nn(pt,e),20);try{var o=t.dataTransfer.getData("Text");if(o){var u=e.doc.sel.from,c=e.doc.sel.to;ne(e.doc,r,r),e.state.draggingText&&_t(e.doc,"",u,c,"paste"),e.replaceSelection(o,null,"paste"),pt(e)}}catch(t){}}}}function kt(t,e){if(An&&(!t.state.draggingText||+new Date-ti<100))return void Fr(e);if(!Ur(t,e)&&!vt(t.display,e)){var r=t.getSelection();if(e.dataTransfer.setData("Text",r),e.dataTransfer.setDragImage&&!In){var n=sn("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",zn&&(n.width=n.height=1,t.display.wrapper.appendChild(n),n._top=n.offsetTop),e.dataTransfer.setDragImage(n,0,0),zn&&n.parentNode.removeChild(n)}}}function St(t,e){Math.abs(t.doc.scrollTop-e)<2||(t.doc.scrollTop=e,Tn||b(t,[],e),t.display.scroller.scrollTop!=e&&(t.display.scroller.scrollTop=e),t.display.scrollbarV.scrollTop!=e&&(t.display.scrollbarV.scrollTop=e),Tn&&b(t,[]),W(t,100))}function Mt(t,e,r){(r?e==t.doc.scrollLeft:Math.abs(t.doc.scrollLeft-e)<2)||(e=Math.min(e,t.display.scroller.scrollWidth-t.display.scroller.clientWidth),t.doc.scrollLeft=e,g(t),t.display.scroller.scrollLeft!=e&&(t.display.scroller.scrollLeft=e),t.display.scrollbarH.scrollLeft!=e&&(t.display.scrollbarH.scrollLeft=e))}function Tt(t,e){var r=e.wheelDeltaX,n=e.wheelDeltaY;null==r&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(r=e.detail),null==n&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:null==n&&(n=e.wheelDelta);var i=t.display,o=i.scroller;if(r&&o.scrollWidth>o.clientWidth||n&&o.scrollHeight>o.clientHeight){if(n&&Kn&&Wn)for(var l=e.target;l!=o;l=l.parentNode)if(l.lineObj){t.display.currentWheelTarget=l;break}if(r&&!Tn&&!zn&&null!=ri)return n&&St(t,Math.max(0,Math.min(o.scrollTop+n*ri,o.scrollHeight-o.clientHeight))),Mt(t,Math.max(0,Math.min(o.scrollLeft+r*ri,o.scrollWidth-o.clientWidth))),Er(e),void(i.wheelStartX=null);if(n&&null!=ri){var s=n*ri,a=t.doc.scrollTop,u=a+i.wrapper.clientHeight;0>s?a=Math.max(0,a+s-50):u=Math.min(t.doc.height,u+s+50),b(t,[],{top:a,bottom:u})}20>ei&&(null==i.wheelStartX?(i.wheelStartX=o.scrollLeft,i.wheelStartY=o.scrollTop,i.wheelDX=r,i.wheelDY=n,setTimeout(function(){if(null!=i.wheelStartX){var t=o.scrollLeft-i.wheelStartX,e=o.scrollTop-i.wheelStartY,r=e&&i.wheelDY&&e/i.wheelDY||t&&i.wheelDX&&t/i.wheelDX;i.wheelStartX=i.wheelStartY=null,r&&(ri=(ri*ei+r)/(ei+1),++ei)}},200)):(i.wheelDX+=r,i.wheelDY+=n))}}function At(t,e,r){if("string"==typeof e&&(e=gi[e],!e))return!1;t.display.pollingFast&&ht(t)&&(t.display.pollingFast=!1);var n=t.doc,i=n.sel.shift,o=!1;try{gt(t)&&(t.state.suppressEdits=!0),r&&(n.sel.shift=!1),o=e(t)!=Ti}finally{n.sel.shift=i,t.state.suppressEdits=!1}return o}function Nt(t){var e=t.state.keyMaps.slice(0);return t.options.extraKeys&&e.push(t.options.extraKeys),e.push(t.options.keyMap),e}function Ht(t,e){var r=Ce(t.options.keyMap),n=r.auto;clearTimeout(ni),n&&!Le(e)&&(ni=setTimeout(function(){Ce(t.options.keyMap)==r&&(t.options.keyMap=n.call?n.call(null,t):n,l(t))},50));var i=ke(e,!0),o=!1;if(!i)return!1;var s=Nt(t);return o=e.shiftKey?we("Shift-"+i,s,function(e){return At(t,e,!0)})||we(i,s,function(e){return("string"==typeof e?/^go[A-Z]/.test(e):e.motion)?At(t,e):void 0}):we(i,s,function(e){return At(t,e)}),o&&(Er(e),D(t),Hn&&(e.oldKeyCode=e.keyCode,e.keyCode=0),Kr(t,"keyHandled",t,i,e)),o}function Dt(t,e,r){var n=we("'"+r+"'",Nt(t),function(e){return At(t,e,!0)});return n&&(Er(e),D(t),Kr(t,"keyHandled",t,"'"+r+"'",e)),n}function Wt(t){var e=this;if(e.state.focused||Et(e),!(Ur(e,t)||e.options.onKeyEvent&&e.options.onKeyEvent(e,Or(t)))){An&&27==t.keyCode&&(t.returnValue=!1);var r=t.keyCode;e.doc.sel.shift=16==r||t.shiftKey;var n=Ht(e,t);zn&&(oi=n?r:null,!n&&88==r&&!Ii&&(Kn?t.metaKey:t.ctrlKey)&&e.replaceSelection(""))}}function Ot(t){var e=this;if(!(Ur(e,t)||e.options.onKeyEvent&&e.options.onKeyEvent(e,Or(t)))){var r=t.keyCode,n=t.charCode;if(zn&&r==oi)return oi=null,void Er(t);if(!(zn&&(!t.which||t.which<10)||Fn)||!Ht(e,t)){var i=String.fromCharCode(null==n?r:n);this.options.electricChars&&this.doc.mode.electricChars&&this.options.smartIndent&&!gt(this)&&this.doc.mode.electricChars.indexOf(i)>-1&&setTimeout(lt(e,function(){he(e,e.doc.sel.to.line,"smart")}),75),Dt(e,t,i)||(An&&!Hn&&(e.display.inputHasSelection=null),ft(e))}}}function Et(t){"nocursor"!=t.options.readOnly&&(t.state.focused||(Vr(t,"focus",t),t.state.focused=!0,-1==t.display.wrapper.className.search(/\bCodeMirror-focused\b/)&&(t.display.wrapper.className+=" CodeMirror-focused"),t.curOp||(dt(t,!0),Wn&&setTimeout(nn(dt,t,!0),0))),ct(t),D(t))}function zt(t){t.state.focused&&(Vr(t,"blur",t),t.state.focused=!1,t.display.wrapper.className=t.display.wrapper.className.replace(" CodeMirror-focused","")),clearInterval(t.display.blinker),setTimeout(function(){t.state.focused||(t.doc.sel.shift=!1)},150)}function It(t,e){function r(){if(null!=i.input.selectionStart){var t=i.input.value="​"+(jt(o.from,o.to)?"":i.input.value);i.prevInput="​",i.input.selectionStart=1,i.input.selectionEnd=t.length}}function n(){if(i.inputDiv.style.position="relative",i.input.style.cssText=u,Hn&&(i.scrollbarV.scrollTop=i.scroller.scrollTop=s),ct(t),null!=i.input.selectionStart){(!An||Hn)&&r(),clearTimeout(ii);var e=0,n=function(){" "==i.prevInput&&0==i.input.selectionStart?lt(t,gi.selectAll)(t):e++<10?ii=setTimeout(n,500):dt(t)};ii=setTimeout(n,200)}}if(!Ur(t,e,"contextmenu")){var i=t.display,o=t.doc.sel;if(!vt(i,e)&&!Ct(t,e)){var l=yt(t,e),s=i.scroller.scrollTop;if(l&&!zn){var a=t.options.resetSelectionOnContextMenu;a&&(jt(o.from,o.to)||$t(l,o.from)||!$t(l,o.to))&&lt(t,ne)(t.doc,l,l);var u=i.input.style.cssText;if(i.inputDiv.style.position="absolute",i.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(e.clientY-5)+"px; left: "+(e.clientX-5)+"px; z-index: 1000; background: white; outline: none;border-width: 0; outline: none; overflow: hidden; opacity: .05; -ms-opacity: .05; filter: alpha(opacity=5);",pt(t),dt(t,!0),jt(o.from,o.to)&&(i.input.value=i.prevInput=" "),An&&!Hn&&r(),Zn){Fr(e);var c=function(){Gr(window,"mouseup",c),setTimeout(n,20)};Br(window,"mouseup",c)}else setTimeout(n,50)}}}}function Ft(t,e,r){if(!$t(e.from,r))return Qt(t,r);var n=e.text.length-1-(e.to.line-e.from.line);if(r.line>e.to.line+n){var i=r.line-n,o=t.first+t.size-1;return i>o?Yt(o,pr(t,o).text.length):Jt(r,pr(t,i).text.length)}if(r.line==e.to.line+n)return Jt(r,qr(e.text).length+(1==e.text.length?e.from.ch:0)+pr(t,e.to.line).text.length-e.to.ch);var l=r.line-e.from.line;return Jt(r,e.text[l].length+(l?0:e.from.ch))}function Pt(t,e,r){if(r&&"object"==typeof r)return{anchor:Ft(t,e,r.anchor),head:Ft(t,e,r.head)};if("start"==r)return{anchor:e.from,head:e.from};var n=li(e);if("around"==r)return{anchor:e.from,head:n};if("end"==r)return{anchor:n,head:n};var i=function(t){if($t(t,e.from))return t;if(!$t(e.to,t))return n;var r=t.line+e.text.length-(e.to.line-e.from.line)-1,i=t.ch;return t.line==e.to.line&&(i+=n.ch-e.to.ch),Yt(r,i)};return{anchor:i(t.sel.anchor),head:i(t.sel.head)}}function Rt(t,e,r){var n={canceled:!1,from:e.from,to:e.to,text:e.text,origin:e.origin,cancel:function(){this.canceled=!0}};return r&&(n.update=function(e,r,n,i){e&&(this.from=Qt(t,e)),r&&(this.to=Qt(t,r)),n&&(this.text=n),void 0!==i&&(this.origin=i)}),Vr(t,"beforeChange",t,n),t.cm&&Vr(t.cm,"beforeChange",t.cm,n),n.canceled?null:{from:n.from,to:n.to,text:n.text,origin:n.origin}}function Bt(t,e,r,n){if(t.cm){if(!t.cm.curOp)return lt(t.cm,Bt)(t,e,r,n);if(t.cm.state.suppressEdits)return}if(!(_r(t,"beforeChange")||t.cm&&_r(t.cm,"beforeChange"))||(e=Rt(t,e,!0))){var i=qn&&!n&&Fe(t,e.from,e.to);if(i){for(var o=i.length-1;o>=1;--o)Gt(t,{from:i[o].from,to:i[o].to,text:[""]});i.length&&Gt(t,{from:i[0].from,to:i[0].to,text:e.text},r)}else Gt(t,e,r)}}function Gt(t,e,r){if(1!=e.text.length||""!=e.text[0]||!jt(e.from,e.to)){var n=Pt(t,e,r);Sr(t,e,n,t.cm?t.cm.curOp.id:NaN),Ut(t,e,n,ze(t,e));var i=[];hr(t,function(t,r){r||-1!=Jr(i,t.history)||(Dr(t.history,e),i.push(t.history)),Ut(t,e,null,ze(t,e))})}}function Vt(t,e){if(!t.cm||!t.cm.state.suppressEdits){var r=t.history,n=("undo"==e?r.done:r.undone).pop();if(n){var i={changes:[],anchorBefore:n.anchorAfter,headBefore:n.headAfter,anchorAfter:n.anchorBefore,headAfter:n.headBefore,generation:r.generation};("undo"==e?r.undone:r.done).push(i),r.generation=n.generation||++r.maxGeneration;for(var o=_r(t,"beforeChange")||t.cm&&_r(t.cm,"beforeChange"),l=n.changes.length-1;l>=0;--l){var s=n.changes[l];if(s.origin=e,o&&!Rt(t,s,!1))return void(("undo"==e?r.done:r.undone).length=0);i.changes.push(kr(t,s));var a=l?Pt(t,s,null):{anchor:n.anchorBefore,head:n.headBefore};Ut(t,s,a,Ie(t,s));var u=[];hr(t,function(t,e){e||-1!=Jr(u,t.history)||(Dr(t.history,s),u.push(t.history)),Ut(t,s,null,Ie(t,s))})}}}}function Kt(t,e){function r(t){return Yt(t.line+e,t.ch)}t.first+=e,t.cm&&ut(t.cm,t.first,t.first,e),t.sel.head=r(t.sel.head),t.sel.anchor=r(t.sel.anchor),t.sel.from=r(t.sel.from),t.sel.to=r(t.sel.to)}function Ut(t,e,r,n){if(t.cm&&!t.cm.curOp)return lt(t.cm,Ut)(t,e,r,n);if(e.to.line<t.first)return void Kt(t,e.text.length-1-(e.to.line-e.from.line));if(!(e.from.line>t.lastLine())){if(e.from.line<t.first){var i=e.text.length-1-(t.first-e.from.line);Kt(t,i),e={from:Yt(t.first,0),to:Yt(e.to.line+i,e.to.ch),text:[qr(e.text)],origin:e.origin}}var o=t.lastLine();e.to.line>o&&(e={from:e.from,to:Yt(o,pr(t,o).text.length),text:[e.text[0]],origin:e.origin}),e.removed=gr(t,e.from,e.to),r||(r=Pt(t,e,null)),t.cm?Xt(t.cm,e,n,r):ur(t,e,n,r)}}function Xt(t,e,r,n){var o=t.doc,l=t.display,s=e.from,a=e.to,u=!1,f=s.line;t.options.lineWrapping||(f=yr(Ge(o,pr(o,s.line))),o.iter(f,a.line+1,function(t){return t==l.maxLine?(u=!0,!0):void 0})),$t(o.sel.head,e.from)||$t(e.to,o.sel.head)||(t.curOp.cursorActivity=!0),ur(o,e,r,n,i(t)),t.options.lineWrapping||(o.iter(f,s.line+e.text.length,function(t){var e=c(o,t);e>l.maxLineLength&&(l.maxLine=t,l.maxLineLength=e,l.maxLineChanged=!0,u=!1)}),u&&(t.curOp.updateMaxLine=!0)),o.frontier=Math.min(o.frontier,s.line),W(t,400);var h=e.text.length-(a.line-s.line)-1;if(ut(t,s.line,a.line+1,h),_r(t,"change")){var d={from:s,to:a,text:e.text,removed:e.removed,origin:e.origin};if(t.curOp.textChanged){for(var p=t.curOp.textChanged;p.next;p=p.next);p.next=d}else t.curOp.textChanged=d}}function _t(t,e,r,n,i){if(n||(n=r),$t(n,r)){var o=n;n=r,r=o}"string"==typeof e&&(e=Ei(e)),Bt(t,{from:r,to:n,text:e,origin:i},null)}function Yt(t,e){return this instanceof Yt?(this.line=t,void(this.ch=e)):new Yt(t,e)}function jt(t,e){return t.line==e.line&&t.ch==e.ch}function $t(t,e){return t.line<e.line||t.line==e.line&&t.ch<e.ch}function Zt(t){return Yt(t.line,t.ch)}function qt(t,e){return Math.max(t.first,Math.min(e,t.first+t.size-1))}function Qt(t,e){if(e.line<t.first)return Yt(t.first,0);var r=t.first+t.size-1;return e.line>r?Yt(r,pr(t,r).text.length):Jt(e,pr(t,e.line).text.length)}function Jt(t,e){var r=t.ch;return null==r||r>e?Yt(t.line,e):0>r?Yt(t.line,0):t}function te(t,e){return e>=t.first&&e<t.first+t.size}function ee(t,e,r,n){if(t.sel.shift||t.sel.extend){var i=t.sel.anchor;if(r){var o=$t(e,i);o!=$t(r,i)?(i=e,e=r):o!=$t(e,r)&&(e=r)}ne(t,i,e,n)}else ne(t,e,r||e,n);t.cm&&(t.cm.curOp.userSelChange=!0)}function re(t,e,r){var n={anchor:e,head:r};return Vr(t,"beforeSelectionChange",t,n),t.cm&&Vr(t.cm,"beforeSelectionChange",t.cm,n),n.anchor=Qt(t,n.anchor),n.head=Qt(t,n.head),n}function ne(t,e,r,n,i){if(!i&&_r(t,"beforeSelectionChange")||t.cm&&_r(t.cm,"beforeSelectionChange")){var o=re(t,e,r);r=o.head,e=o.anchor}var l=t.sel;if(l.goalColumn=null,null==n&&(n=$t(r,l.head)?-1:1),(i||!jt(e,l.anchor))&&(e=oe(t,e,n,"push"!=i)),(i||!jt(r,l.head))&&(r=oe(t,r,n,"push"!=i)),!jt(l.anchor,e)||!jt(l.head,r)){l.anchor=e,l.head=r;var s=$t(r,e);l.from=s?r:e,l.to=s?e:r,t.cm&&(t.cm.curOp.updateInput=t.cm.curOp.selectionChanged=t.cm.curOp.cursorActivity=!0),Kr(t,"cursorActivity",t)}}function ie(t){ne(t.doc,t.doc.sel.from,t.doc.sel.to,null,"push")}function oe(t,e,r,n){var i=!1,o=e,l=r||1;t.cantEdit=!1;t:for(;;){var s=pr(t,o.line);if(s.markedSpans)for(var a=0;a<s.markedSpans.length;++a){var u=s.markedSpans[a],c=u.marker;if((null==u.from||(c.inclusiveLeft?u.from<=o.ch:u.from<o.ch))&&(null==u.to||(c.inclusiveRight?u.to>=o.ch:u.to>o.ch))){if(n&&(Vr(c,"beforeCursorEnter"),c.explicitlyCleared)){if(s.markedSpans){--a;continue}break}if(!c.atomic)continue;var f=c.find()[0>l?"from":"to"];if(jt(f,o)&&(f.ch+=l,f.ch<0?f=f.line>t.first?Qt(t,Yt(f.line-1)):null:f.ch>s.text.length&&(f=f.line<t.first+t.size-1?Yt(f.line+1,0):null),!f)){if(i)return n?(t.cantEdit=!0,Yt(t.first,0)):oe(t,e,r,!0);i=!0,f=e,l=-l}o=f;continue t}}return o}}function le(t){var e=se(t,t.doc.sel.head,null,t.options.cursorScrollMargin);if(t.state.focused){var r=t.display,n=fn(r.sizer),i=null;if(e.top+n.top<0?i=!0:e.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!Bn){var o="none"==r.cursor.style.display;o&&(r.cursor.style.display="",r.cursor.style.left=e.left+"px",r.cursor.style.top=e.top-r.viewOffset+"px"),r.cursor.scrollIntoView(i),o&&(r.cursor.style.display="none")}}}function se(t,e,r,n){for(null==n&&(n=0);;){var i=!1,o=Q(t,e),l=r&&r!=e?Q(t,r):o,s=ue(t,Math.min(o.left,l.left),Math.min(o.top,l.top)-n,Math.max(o.left,l.left),Math.max(o.bottom,l.bottom)+n),a=t.doc.scrollTop,u=t.doc.scrollLeft;if(null!=s.scrollTop&&(St(t,s.scrollTop),Math.abs(t.doc.scrollTop-a)>1&&(i=!0)),null!=s.scrollLeft&&(Mt(t,s.scrollLeft),Math.abs(t.doc.scrollLeft-u)>1&&(i=!0)),!i)return o}}function ae(t,e,r,n,i){var o=ue(t,e,r,n,i);null!=o.scrollTop&&St(t,o.scrollTop),null!=o.scrollLeft&&Mt(t,o.scrollLeft)}function ue(t,e,r,n,i){var o=t.display,l=rt(t.display);0>r&&(r=0);var s=o.scroller.clientHeight-Mi,a=o.scroller.scrollTop,u={},c=t.doc.height+F(o),f=l>r,h=i>c-l;if(a>r)u.scrollTop=f?0:r;else if(i>a+s){var d=Math.min(r,(h?c:i)-s);d!=a&&(u.scrollTop=d)}var p=o.scroller.clientWidth-Mi,g=o.scroller.scrollLeft;e+=o.gutters.offsetWidth,n+=o.gutters.offsetWidth;var m=o.gutters.offsetWidth,v=m+10>e;return g+m>e||v?(v&&(e=0),u.scrollLeft=Math.max(0,e-10-m)):n>p+g-3&&(u.scrollLeft=n+10-p),u}function ce(t,e,r){t.curOp.updateScrollPos={scrollLeft:null==e?t.doc.scrollLeft:e,scrollTop:null==r?t.doc.scrollTop:r}}function fe(t,e,r){var n=t.curOp.updateScrollPos||(t.curOp.updateScrollPos={scrollLeft:t.doc.scrollLeft,scrollTop:t.doc.scrollTop}),i=t.display.scroller;n.scrollTop=Math.max(0,Math.min(i.scrollHeight-i.clientHeight,n.scrollTop+r)),n.scrollLeft=Math.max(0,Math.min(i.scrollWidth-i.clientWidth,n.scrollLeft+e))}function he(t,e,r,n){var i=t.doc;if(null==r&&(r="add"),"smart"==r)if(t.doc.mode.indent)var o=z(t,e);else r="prev";var l,s=t.options.tabSize,a=pr(i,e),u=$r(a.text,null,s),c=a.text.match(/^\s*/)[0];if("smart"==r&&(l=t.doc.mode.indent(o,a.text.slice(c.length),a.text),l==Ti)){if(!n)return;r="prev"}"prev"==r?l=e>i.first?$r(pr(i,e-1).text,null,s):0:"add"==r?l=u+t.options.indentUnit:"subtract"==r?l=u-t.options.indentUnit:"number"==typeof r&&(l=u+r),l=Math.max(0,l);var f="",h=0;if(t.options.indentWithTabs)for(var d=Math.floor(l/s);d;--d)h+=s,f+="	";l>h&&(f+=Zr(l-h)),f!=c?_t(t.doc,f,Yt(e,0),Yt(e,c.length),"+input"):i.sel.head.line==e&&i.sel.head.ch<c.length&&ne(i,Yt(e,c.length),Yt(e,c.length),1),a.stateAfter=null}function de(t,e,r){var n=e,i=e,o=t.doc;return"number"==typeof e?i=pr(o,qt(o,e)):n=yr(e),null==n?null:r(i,n)?(ut(t,n,n+1),i):null}function pe(t,e,r,n,i){function o(){var e=s+r;return e<t.first||e>=t.first+t.size?f=!1:(s=e,c=pr(t,e))}function l(t){var e=(i?Sn:Mn)(c,a,r,!0);if(null==e){if(t||!o())return f=!1;a=i?(0>r?bn:yn)(c):0>r?c.text.length:0}else a=e;return!0}var s=e.line,a=e.ch,u=r,c=pr(t,s),f=!0;if("char"==n)l();else if("column"==n)l(!0);else if("word"==n||"group"==n)for(var h=null,d="group"==n,p=!0;!(0>r)||l(!p);p=!1){var g=c.text.charAt(a)||"\n",m=on(g)?"w":d?/\s/.test(g)?null:"p":null;if(h&&h!=m){0>r&&(r=1,l());break}if(m&&(h=m),r>0&&!l(!p))break}var v=oe(t,Yt(s,a),u,!0);return f||(v.hitSide=!0),v}function ge(t,e,r,n){var i,o=t.doc,l=e.left;if("page"==n){var s=Math.min(t.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);i=e.top+r*(s-(0>r?1.5:.5)*rt(t.display))}else"line"==n&&(i=r>0?e.bottom+3:e.top-3);for(;;){var a=tt(t,l,i);if(!a.outside)break;if(0>r?0>=i:i>=o.height){a.hitSide=!0;break}i+=5*r}return a}function me(t,e){var r=e.ch,n=e.ch;if(t){(e.xRel<0||n==t.length)&&r?--r:++n;for(var i=t.charAt(r),o=on(i)?on:/\s/.test(i)?function(t){return/\s/.test(t)}:function(t){return!/\s/.test(t)&&!on(t)};r>0&&o(t.charAt(r-1));)--r;for(;n<t.length&&o(t.charAt(n));)++n}return{from:Yt(e.line,r),to:Yt(e.line,n)}}function ve(t,e){ee(t.doc,Yt(e,0),Qt(t.doc,Yt(e+1,0)))}function ye(e,r,n,i){t.defaults[e]=r,n&&(si[e]=i?function(t,e,r){r!=ui&&n(t,e,r)}:n)}function be(t,e){if(e===!0)return e;if(t.copyState)return t.copyState(e);var r={};for(var n in e){var i=e[n];i instanceof Array&&(i=i.concat([])),r[n]=i}return r}function xe(t,e,r){return t.startState?t.startState(e,r):!0}function Ce(t){return"string"==typeof t?mi[t]:t}function we(t,e,r){function n(e){e=Ce(e);var i=e[t];if(i===!1)return"stop";if(null!=i&&r(i))return!0;if(e.nofallthrough)return"stop";var o=e.fallthrough;if(null==o)return!1;if("[object Array]"!=Object.prototype.toString.call(o))return n(o);for(var l=0,s=o.length;s>l;++l){var a=n(o[l]);if(a)return a}return!1}for(var i=0;i<e.length;++i){var o=n(e[i]);if(o)return"stop"!=o}}function Le(t){var e=Fi[t.keyCode];return"Ctrl"==e||"Alt"==e||"Shift"==e||"Mod"==e}function ke(t,e){if(zn&&34==t.keyCode&&t["char"])return!1;var r=Fi[t.keyCode];return null==r||t.altGraphKey?!1:(t.altKey&&(r="Alt-"+r),($n?t.metaKey:t.ctrlKey)&&(r="Ctrl-"+r),($n?t.ctrlKey:t.metaKey)&&(r="Cmd-"+r),!e&&t.shiftKey&&(r="Shift-"+r),r)}function Se(t,e){this.pos=this.start=0,this.string=t,this.tabSize=e||8,this.lastColumnPos=this.lastColumnValue=0}function Me(t,e){this.lines=[],this.type=e,this.doc=t}function Te(t,e,r,n,i){if(n&&n.shared)return Ne(t,e,r,n,i);if(t.cm&&!t.cm.curOp)return lt(t.cm,Te)(t,e,r,n,i);var o=new Me(t,i);if($t(r,e)||jt(e,r)&&"range"==i&&(!n.inclusiveLeft||!n.inclusiveRight))return o;n&&en(n,o),o.replacedWith&&(o.collapsed=!0,o.replacedWith=sn("span",[o.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||(o.replacedWith.ignoreEvents=!0)),o.collapsed&&(Qn=!0),o.addToHistory&&Sr(t,{from:e,to:r,origin:"markText"},{head:t.sel.head,anchor:t.sel.anchor},NaN);var l,s,a,u=e.line,c=0,f=t.cm;if(t.iter(u,r.line+1,function(n){f&&o.collapsed&&!f.options.lineWrapping&&Ge(t,n)==f.display.maxLine&&(a=!0);var i={from:null,to:null,marker:o};c+=n.text.length,u==e.line&&(i.from=e.ch,c-=e.ch),u==r.line&&(i.to=r.ch,c-=n.text.length-r.ch),o.collapsed&&(u==r.line&&(s=Pe(n,r.ch)),u==e.line?l=Pe(n,e.ch):vr(n,0)),We(n,i),++u}),o.collapsed&&t.iter(e.line,r.line+1,function(e){Ve(t,e)&&vr(e,0)}),o.clearOnEnter&&Br(o,"beforeCursorEnter",function(){o.clear()}),o.readOnly&&(qn=!0,(t.history.done.length||t.history.undone.length)&&t.clearHistory()),o.collapsed){if(l!=s)throw new Error("Inserting collapsed marker overlapping an existing one");o.size=c,o.atomic=!0}return f&&(a&&(f.curOp.updateMaxLine=!0),(o.className||o.title||o.startStyle||o.endStyle||o.collapsed)&&ut(f,e.line,r.line+1),o.atomic&&ie(f)),o}function Ae(t,e){this.markers=t,this.primary=e;for(var r=0,n=this;r<t.length;++r)t[r].parent=this,Br(t[r],"clear",function(){n.clear()})}function Ne(t,e,r,n,i){n=en(n),n.shared=!1;var o=[Te(t,e,r,n,i)],l=o[0],s=n.replacedWith;return hr(t,function(t){s&&(n.replacedWith=s.cloneNode(!0)),o.push(Te(t,Qt(t,e),Qt(t,r),n,i));for(var a=0;a<t.linked.length;++a)if(t.linked[a].isParent)return;l=qr(o)}),new Ae(o,l)}function He(t,e){if(t)for(var r=0;r<t.length;++r){var n=t[r];if(n.marker==e)return n}}function De(t,e){for(var r,n=0;n<t.length;++n)t[n]!=e&&(r||(r=[])).push(t[n]);return r}function We(t,e){t.markedSpans=t.markedSpans?t.markedSpans.concat([e]):[e],e.marker.attachLine(t)}function Oe(t,e,r){if(t)for(var n,i=0;i<t.length;++i){var o=t[i],l=o.marker,s=null==o.from||(l.inclusiveLeft?o.from<=e:o.from<e);if(s||(l.inclusiveLeft&&l.inclusiveRight||"bookmark"==l.type)&&o.from==e&&(!r||!o.marker.insertLeft)){var a=null==o.to||(l.inclusiveRight?o.to>=e:o.to>e);(n||(n=[])).push({from:o.from,to:a?null:o.to,marker:l})}}return n}function Ee(t,e,r){if(t)for(var n,i=0;i<t.length;++i){var o=t[i],l=o.marker,s=null==o.to||(l.inclusiveRight?o.to>=e:o.to>e);if(s||"bookmark"==l.type&&o.from==e&&(!r||o.marker.insertLeft)){var a=null==o.from||(l.inclusiveLeft?o.from<=e:o.from<e);(n||(n=[])).push({from:a?null:o.from-e,to:null==o.to?null:o.to-e,marker:l})}}return n}function ze(t,e){var r=te(t,e.from.line)&&pr(t,e.from.line).markedSpans,n=te(t,e.to.line)&&pr(t,e.to.line).markedSpans;if(!r&&!n)return null;var i=e.from.ch,o=e.to.ch,l=jt(e.from,e.to),s=Oe(r,i,l),a=Ee(n,o,l),u=1==e.text.length,c=qr(e.text).length+(u?i:0);if(s)for(var f=0;f<s.length;++f){var h=s[f];if(null==h.to){var d=He(a,h.marker);d?u&&(h.to=null==d.to?null:d.to+c):h.to=i}}if(a)for(var f=0;f<a.length;++f){var h=a[f];if(null!=h.to&&(h.to+=c),null==h.from){var d=He(s,h.marker);d||(h.from=c,u&&(s||(s=[])).push(h))}else h.from+=c,u&&(s||(s=[])).push(h)}if(u&&s){for(var f=0;f<s.length;++f)null!=s[f].from&&s[f].from==s[f].to&&"bookmark"!=s[f].marker.type&&s.splice(f--,1);s.length||(s=null)}var p=[s];if(!u){var g,m=e.text.length-2;if(m>0&&s)for(var f=0;f<s.length;++f)null==s[f].to&&(g||(g=[])).push({from:null,to:null,marker:s[f].marker});for(var f=0;m>f;++f)p.push(g);p.push(a)}return p}function Ie(t,e){var r=Tr(t,e),n=ze(t,e);if(!r)return n;if(!n)return r;for(var i=0;i<r.length;++i){var o=r[i],l=n[i];if(o&&l)t:for(var s=0;s<l.length;++s){for(var a=l[s],u=0;u<o.length;++u)if(o[u].marker==a.marker)continue t;o.push(a)}else l&&(r[i]=l)}return r}function Fe(t,e,r){var n=null;if(t.iter(e.line,r.line+1,function(t){if(t.markedSpans)for(var e=0;e<t.markedSpans.length;++e){var r=t.markedSpans[e].marker;!r.readOnly||n&&-1!=Jr(n,r)||(n||(n=[])).push(r)}}),!n)return null;for(var i=[{from:e,to:r}],o=0;o<n.length;++o)for(var l=n[o],s=l.find(),a=0;a<i.length;++a){var u=i[a];if(!$t(u.to,s.from)&&!$t(s.to,u.from)){var c=[a,1];($t(u.from,s.from)||!l.inclusiveLeft&&jt(u.from,s.from))&&c.push({from:u.from,to:s.from}),($t(s.to,u.to)||!l.inclusiveRight&&jt(u.to,s.to))&&c.push({from:s.to,to:u.to}),i.splice.apply(i,c),a+=c.length-1}}return i}function Pe(t,e){var r,n=Qn&&t.markedSpans;if(n)for(var i,o=0;o<n.length;++o)i=n[o],i.marker.collapsed&&(null==i.from||i.from<e)&&(null==i.to||i.to>e)&&(!r||r.width<i.marker.width)&&(r=i.marker);return r}function Re(t){return Pe(t,-1)}function Be(t){return Pe(t,t.text.length+1)}function Ge(t,e){for(var r;r=Re(e);)e=pr(t,r.find().from.line);return e}function Ve(t,e){var r=Qn&&e.markedSpans;if(r)for(var n,i=0;i<r.length;++i)if(n=r[i],n.marker.collapsed){if(null==n.from)return!0;if(!n.marker.replacedWith&&0==n.from&&n.marker.inclusiveLeft&&Ke(t,e,n))return!0}}function Ke(t,e,r){if(null==r.to){var n=r.marker.find().to,i=pr(t,n.line);return Ke(t,i,He(i.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==e.text.length)return!0;for(var o,l=0;l<e.markedSpans.length;++l)if(o=e.markedSpans[l],o.marker.collapsed&&!o.marker.replacedWith&&o.from==r.to&&(o.marker.inclusiveLeft||r.marker.inclusiveRight)&&Ke(t,e,o))return!0}function Ue(t){var e=t.markedSpans;if(e){for(var r=0;r<e.length;++r)e[r].marker.detachLine(t);t.markedSpans=null}}function Xe(t,e){if(e){for(var r=0;r<e.length;++r)e[r].marker.attachLine(t);t.markedSpans=e}}function _e(t){return function(){var e=!this.cm.curOp;e&&it(this.cm);try{var r=t.apply(this,arguments)}finally{e&&ot(this.cm)}return r}}function Ye(t){return null!=t.height?t.height:(t.node.parentNode&&1==t.node.parentNode.nodeType||un(t.cm.display.measure,sn("div",[t.node],null,"position: relative")),t.height=t.node.offsetHeight)}function je(t,e,r,n){var i=new vi(t,r,n);return i.noHScroll&&(t.display.alignWidgets=!0),de(t,e,function(e){var r=e.widgets||(e.widgets=[]);if(null==i.insertAt?r.push(i):r.splice(Math.min(r.length-1,Math.max(0,i.insertAt)),0,i),i.line=e,!Ve(t.doc,e)||i.showIfHidden){var n=xr(t,e)<t.doc.scrollTop;vr(e,e.height+Ye(i)),n&&fe(t,0,i.height)}return!0}),i}function $e(t,e,r,n){t.text=e,t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null),null!=t.order&&(t.order=null),Ue(t),Xe(t,r);var i=n?n(t):1;i!=t.height&&vr(t,i)}function Ze(t){t.parent=null,Ue(t)}function qe(t,e,r,n,i,o){var l=r.flattenSpans;null==l&&(l=t.options.flattenSpans);var s,a=0,u=null,c=new Se(e,t.options.tabSize);for(""==e&&r.blankLine&&r.blankLine(n);!c.eol();)c.pos>t.options.maxHighlightLength?(l=!1,o&&tr(t,e,n,c.pos),c.pos=e.length,s=null):s=r.token(c,n),l&&u==s||(a<c.start&&i(c.start,u),a=c.start,u=s),c.start=c.pos;for(;a<c.pos;){var f=Math.min(c.pos,a+5e4);i(f,u),a=f}}function Qe(t,e,r,n){var i=[t.state.modeGen];qe(t,e.text,t.doc.mode,r,function(t,e){i.push(t,e)},n);for(var o=0;o<t.state.overlays.length;++o){var l=t.state.overlays[o],s=1,a=0;qe(t,e.text,l.mode,!0,function(t,e){for(var r=s;t>a;){var n=i[s];n>t&&i.splice(s,1,t,i[s+1],n),s+=2,a=Math.min(t,n)}if(e)if(l.opaque)i.splice(r,s-r,t,e),s=r+2;else for(;s>r;r+=2){var o=i[r+1];i[r+1]=o?o+" "+e:e}})}return i}function Je(t,e){return e.styles&&e.styles[0]==t.state.modeGen||(e.styles=Qe(t,e,e.stateAfter=z(t,yr(e)))),e.styles}function tr(t,e,r,n){var i=t.doc.mode,o=new Se(e,t.options.tabSize);for(o.start=o.pos=n||0,""==e&&i.blankLine&&i.blankLine(r);!o.eol()&&o.pos<=t.options.maxHighlightLength;)i.token(o,r),o.start=o.pos}function er(t,e){if(!t)return null;for(;;){var r=t.match(/(?:^|\s)line-(background-)?(\S+)/);if(!r)break;t=t.slice(0,r.index)+t.slice(r.index+r[0].length);var n=r[1]?"bgClass":"textClass";null==e[n]?e[n]=r[2]:new RegExp("(?:^|s)"+r[2]+"(?:$|s)").test(e[n])||(e[n]+=" "+r[2])}return bi[t]||(bi[t]="cm-"+t.replace(/ +/g," cm-"))}function rr(t,e,r,n){for(var i,o=e,l=!0;i=Re(o);)o=pr(t.doc,i.find().from.line);var s={pre:sn("pre"),col:0,pos:0,measure:null,measuredSomething:!1,cm:t,copyWidgets:n};do{o.text&&(l=!1),s.measure=o==e&&r,s.pos=0,s.addToken=s.measure?or:ir,(An||Wn)&&t.getOption("lineWrapping")&&(s.addToken=lr(s.addToken));var a=ar(o,s,Je(t,o));r&&o==e&&!s.measuredSomething&&(r[0]=s.pre.appendChild(pn(t.display.measure)),s.measuredSomething=!0),a&&(o=pr(t.doc,a.to.line))}while(a);!r||s.measuredSomething||r[0]||(r[0]=s.pre.appendChild(l?sn("span"," "):pn(t.display.measure))),s.pre.firstChild||Ve(t.doc,e)||s.pre.appendChild(document.createTextNode(" "));var u;if(r&&(An||Dn)&&(u=Cr(o))){var c=u.length-1;u[c].from==u[c].to&&--c;var f=u[c],h=u[c-1];if(f.from+1==f.to&&h&&f.level<h.level){var d=r[s.pos-1];d&&d.parentNode.insertBefore(d.measureRight=pn(t.display.measure),d.nextSibling)}}var p=s.textClass?s.textClass+" "+(e.textClass||""):e.textClass;return p&&(s.pre.className=p),Vr(t,"renderLine",t,e,s.pre),s}function nr(t){var e=sn("span","•","cm-invalidchar");return e.title="\\u"+t.charCodeAt(0).toString(16),e}function ir(t,e,r,n,i,o){if(e){var l=t.cm.options.specialChars;if(l.test(e))for(var s=document.createDocumentFragment(),a=0;;){l.lastIndex=a;var u=l.exec(e),c=u?u.index-a:e.length-a;if(c&&(s.appendChild(document.createTextNode(e.slice(a,a+c))),t.col+=c),!u)break;if(a+=c+1,"	"==u[0]){var f=t.cm.options.tabSize,h=f-t.col%f;s.appendChild(sn("span",Zr(h),"cm-tab")),t.col+=h}else{var d=t.cm.options.specialCharPlaceholder(u[0]);s.appendChild(d),t.col+=1}}else{t.col+=e.length;var s=document.createTextNode(e)}if(r||n||i||t.measure){var p=r||"";n&&(p+=n),i&&(p+=i);var d=sn("span",[s],p);return o&&(d.title=o),t.pre.appendChild(d)}t.pre.appendChild(s)}}function or(t,e,r,n,i){for(var o=t.cm.options.lineWrapping,l=0;l<e.length;++l){var s=e.charAt(l),a=0==l;s>="�"&&"�">s&&l<e.length-1?(s=e.slice(l,l+2),++l):l&&o&&hn(e,l)&&t.pre.appendChild(sn("wbr"));var u=t.measure[t.pos],c=t.measure[t.pos]=ir(t,s,r,a&&n,l==e.length-1&&i);u&&(c.leftSide=u.leftSide||u),An&&o&&" "==s&&l&&!/\s/.test(e.charAt(l-1))&&l<e.length-1&&!/\s/.test(e.charAt(l+1))&&(c.style.whiteSpace="normal"),t.pos+=s.length}e.length&&(t.measuredSomething=!0)}function lr(t){function e(t){for(var e=" ",r=0;r<t.length-2;++r)e+=r%2?" ":" ";return e+=" "}return function(r,n,i,o,l,s){return t(r,n.replace(/ {3,}/g,e),i,o,l,s)}}function sr(t,e,r,n){var i=!n&&r.replacedWith;if(i&&(t.copyWidgets&&(i=i.cloneNode(!0)),t.pre.appendChild(i),t.measure)){if(e)t.measure[t.pos]=i;else{var o=pn(t.cm.display.measure);if("bookmark"!=r.type||r.insertLeft){if(t.measure[t.pos])return;t.measure[t.pos]=t.pre.insertBefore(o,i)}else t.measure[t.pos]=t.pre.appendChild(o)}t.measuredSomething=!0}t.pos+=e}function ar(t,e,r){var n=t.markedSpans,i=t.text,o=0;if(n)for(var l,s,a,u,c,f,h=i.length,d=0,p=1,g="",m=0;;){if(m==d){s=a=u=c="",f=null,m=1/0;for(var v=[],y=0;y<n.length;++y){var b=n[y],x=b.marker;b.from<=d&&(null==b.to||b.to>d)?(null!=b.to&&m>b.to&&(m=b.to,a=""),x.className&&(s+=" "+x.className),x.startStyle&&b.from==d&&(u+=" "+x.startStyle),x.endStyle&&b.to==m&&(a+=" "+x.endStyle),x.title&&!c&&(c=x.title),
x.collapsed&&(!f||f.marker.size<x.size)&&(f=b)):b.from>d&&m>b.from&&(m=b.from),"bookmark"==x.type&&b.from==d&&x.replacedWith&&v.push(x)}if(f&&(f.from||0)==d&&(sr(e,(null==f.to?h:f.to)-d,f.marker,null==f.from),null==f.to))return f.marker.find();if(!f&&v.length)for(var y=0;y<v.length;++y)sr(e,0,v[y])}if(d>=h)break;for(var C=Math.min(h,m);;){if(g){var w=d+g.length;if(!f){var L=w>C?g.slice(0,C-d):g;e.addToken(e,L,l?l+s:s,u,d+L.length==m?a:"",c)}if(w>=C){g=g.slice(C-d),d=C;break}d=w,u=""}g=i.slice(o,o=r[p++]),l=er(r[p++],e)}}else for(var p=1;p<r.length;p+=2)e.addToken(e,i.slice(o,o=r[p]),er(r[p+1],e))}function ur(t,e,r,n,i){function o(t){return r?r[t]:null}function l(t,r,n){$e(t,r,n,i),Kr(t,"change",t,e)}var s=e.from,a=e.to,u=e.text,c=pr(t,s.line),f=pr(t,a.line),h=qr(u),d=o(u.length-1),p=a.line-s.line;if(0!=s.ch||0!=a.ch||""!=h||t.cm&&!t.cm.options.wholeLineUpdateBefore)if(c==f)if(1==u.length)l(c,c.text.slice(0,s.ch)+h+c.text.slice(a.ch),d);else{for(var g=[],m=1,v=u.length-1;v>m;++m)g.push(new yi(u[m],o(m),i));g.push(new yi(h+c.text.slice(a.ch),d,i)),l(c,c.text.slice(0,s.ch)+u[0],o(0)),t.insert(s.line+1,g)}else if(1==u.length)l(c,c.text.slice(0,s.ch)+u[0]+f.text.slice(a.ch),o(0)),t.remove(s.line+1,p);else{l(c,c.text.slice(0,s.ch)+u[0],o(0)),l(f,h+f.text.slice(a.ch),d);for(var m=1,v=u.length-1,g=[];v>m;++m)g.push(new yi(u[m],o(m),i));p>1&&t.remove(s.line+1,p-1),t.insert(s.line+1,g)}else{for(var m=0,v=u.length-1,g=[];v>m;++m)g.push(new yi(u[m],o(m),i));l(f,f.text,d),p&&t.remove(s.line,p),g.length&&t.insert(s.line,g)}Kr(t,"change",t,e),ne(t,n.anchor,n.head,null,!0)}function cr(t){this.lines=t,this.parent=null;for(var e=0,r=t.length,n=0;r>e;++e)t[e].parent=this,n+=t[e].height;this.height=n}function fr(t){this.children=t;for(var e=0,r=0,n=0,i=t.length;i>n;++n){var o=t[n];e+=o.chunkSize(),r+=o.height,o.parent=this}this.size=e,this.height=r,this.parent=null}function hr(t,e,r){function n(t,i,o){if(t.linked)for(var l=0;l<t.linked.length;++l){var s=t.linked[l];if(s.doc!=i){var a=o&&s.sharedHist;(!r||a)&&(e(s.doc,a),n(s.doc,t,a))}}}n(t,null,!0)}function dr(t,e){if(e.cm)throw new Error("This document is already in use.");t.doc=e,e.cm=t,o(t),r(t),t.options.lineWrapping||f(t),t.options.mode=e.modeOption,ut(t)}function pr(t,e){for(e-=t.first;!t.lines;)for(var r=0;;++r){var n=t.children[r],i=n.chunkSize();if(i>e){t=n;break}e-=i}return t.lines[e]}function gr(t,e,r){var n=[],i=e.line;return t.iter(e.line,r.line+1,function(t){var o=t.text;i==r.line&&(o=o.slice(0,r.ch)),i==e.line&&(o=o.slice(e.ch)),n.push(o),++i}),n}function mr(t,e,r){var n=[];return t.iter(e,r,function(t){n.push(t.text)}),n}function vr(t,e){for(var r=e-t.height,n=t;n;n=n.parent)n.height+=r}function yr(t){if(null==t.parent)return null;for(var e=t.parent,r=Jr(e.lines,t),n=e.parent;n;e=n,n=n.parent)for(var i=0;n.children[i]!=e;++i)r+=n.children[i].chunkSize();return r+e.first}function br(t,e){var r=t.first;t:do{for(var n=0,i=t.children.length;i>n;++n){var o=t.children[n],l=o.height;if(l>e){t=o;continue t}e-=l,r+=o.chunkSize()}return r}while(!t.lines);for(var n=0,i=t.lines.length;i>n;++n){var s=t.lines[n],a=s.height;if(a>e)break;e-=a}return r+n}function xr(t,e){e=Ge(t.doc,e);for(var r=0,n=e.parent,i=0;i<n.lines.length;++i){var o=n.lines[i];if(o==e)break;r+=o.height}for(var l=n.parent;l;n=l,l=n.parent)for(var i=0;i<l.children.length;++i){var s=l.children[i];if(s==n)break;r+=s.height}return r}function Cr(t){var e=t.order;return null==e&&(e=t.order=Ri(t.text)),e}function wr(t){return{done:[],undone:[],undoDepth:1/0,lastTime:0,lastOp:null,lastOrigin:null,generation:t||1,maxGeneration:t||1}}function Lr(t,e,r,n){var i=e["spans_"+t.id],o=0;t.iter(Math.max(t.first,r),Math.min(t.first+t.size,n),function(r){r.markedSpans&&((i||(i=e["spans_"+t.id]={}))[o]=r.markedSpans),++o})}function kr(t,e){var r={line:e.from.line,ch:e.from.ch},n={from:r,to:li(e),text:gr(t,e.from,e.to)};return Lr(t,n,e.from.line,e.to.line+1),hr(t,function(t){Lr(t,n,e.from.line,e.to.line+1)},!0),n}function Sr(t,e,r,n){var i=t.history;i.undone.length=0;var o=+new Date,l=qr(i.done);if(l&&(i.lastOp==n||i.lastOrigin==e.origin&&e.origin&&("+"==e.origin.charAt(0)&&t.cm&&i.lastTime>o-t.cm.options.historyEventDelay||"*"==e.origin.charAt(0)))){var s=qr(l.changes);jt(e.from,e.to)&&jt(e.from,s.to)?s.to=li(e):l.changes.push(kr(t,e)),l.anchorAfter=r.anchor,l.headAfter=r.head}else for(l={changes:[kr(t,e)],generation:i.generation,anchorBefore:t.sel.anchor,headBefore:t.sel.head,anchorAfter:r.anchor,headAfter:r.head},i.done.push(l),i.generation=++i.maxGeneration;i.done.length>i.undoDepth;)i.done.shift();i.lastTime=o,i.lastOp=n,i.lastOrigin=e.origin}function Mr(t){if(!t)return null;for(var e,r=0;r<t.length;++r)t[r].marker.explicitlyCleared?e||(e=t.slice(0,r)):e&&e.push(t[r]);return e?e.length?e:null:t}function Tr(t,e){var r=e["spans_"+t.id];if(!r)return null;for(var n=0,i=[];n<e.text.length;++n)i.push(Mr(r[n]));return i}function Ar(t,e){for(var r=0,n=[];r<t.length;++r){var i=t[r],o=i.changes,l=[];n.push({changes:l,anchorBefore:i.anchorBefore,headBefore:i.headBefore,anchorAfter:i.anchorAfter,headAfter:i.headAfter});for(var s=0;s<o.length;++s){var a,u=o[s];if(l.push({from:u.from,to:u.to,text:u.text}),e)for(var c in u)(a=c.match(/^spans_(\d+)$/))&&Jr(e,Number(a[1]))>-1&&(qr(l)[c]=u[c],delete u[c])}}return n}function Nr(t,e,r,n){r<t.line?t.line+=n:e<t.line&&(t.line=e,t.ch=0)}function Hr(t,e,r,n){for(var i=0;i<t.length;++i){for(var o=t[i],l=!0,s=0;s<o.changes.length;++s){var a=o.changes[s];if(o.copied||(a.from=Zt(a.from),a.to=Zt(a.to)),r<a.from.line)a.from.line+=n,a.to.line+=n;else if(e<=a.to.line){l=!1;break}}o.copied||(o.anchorBefore=Zt(o.anchorBefore),o.headBefore=Zt(o.headBefore),o.anchorAfter=Zt(o.anchorAfter),o.readAfter=Zt(o.headAfter),o.copied=!0),l?(Nr(o.anchorBefore),Nr(o.headBefore),Nr(o.anchorAfter),Nr(o.headAfter)):(t.splice(0,i+1),i=0)}}function Dr(t,e){var r=e.from.line,n=e.to.line,i=e.text.length-(n-r)-1;Hr(t.done,r,n,i),Hr(t.undone,r,n,i)}function Wr(){Fr(this)}function Or(t){return t.stop||(t.stop=Wr),t}function Er(t){t.preventDefault?t.preventDefault():t.returnValue=!1}function zr(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0}function Ir(t){return null!=t.defaultPrevented?t.defaultPrevented:0==t.returnValue}function Fr(t){Er(t),zr(t)}function Pr(t){return t.target||t.srcElement}function Rr(t){var e=t.which;return null==e&&(1&t.button?e=1:2&t.button?e=3:4&t.button&&(e=2)),Kn&&t.ctrlKey&&1==e&&(e=3),e}function Br(t,e,r){if(t.addEventListener)t.addEventListener(e,r,!1);else if(t.attachEvent)t.attachEvent("on"+e,r);else{var n=t._handlers||(t._handlers={}),i=n[e]||(n[e]=[]);i.push(r)}}function Gr(t,e,r){if(t.removeEventListener)t.removeEventListener(e,r,!1);else if(t.detachEvent)t.detachEvent("on"+e,r);else{var n=t._handlers&&t._handlers[e];if(!n)return;for(var i=0;i<n.length;++i)if(n[i]==r){n.splice(i,1);break}}}function Vr(t,e){var r=t._handlers&&t._handlers[e];if(r)for(var n=Array.prototype.slice.call(arguments,2),i=0;i<r.length;++i)r[i].apply(null,n)}function Kr(t,e){function r(t){return function(){t.apply(null,i)}}var n=t._handlers&&t._handlers[e];if(n){var i=Array.prototype.slice.call(arguments,2);ki||(++Si,ki=[],setTimeout(Xr,0));for(var o=0;o<n.length;++o)ki.push(r(n[o]))}}function Ur(t,e,r){return Vr(t,r||e.type,t,e),Ir(e)||e.codemirrorIgnore}function Xr(){--Si;var t=ki;ki=null;for(var e=0;e<t.length;++e)t[e]()}function _r(t,e){var r=t._handlers&&t._handlers[e];return r&&r.length>0}function Yr(t){t.prototype.on=function(t,e){Br(this,t,e)},t.prototype.off=function(t,e){Gr(this,t,e)}}function jr(){this.id=null}function $r(t,e,r,n,i){null==e&&(e=t.search(/[^\s\u00a0]/),-1==e&&(e=t.length));for(var o=n||0,l=i||0;e>o;++o)"	"==t.charAt(o)?l+=r-l%r:++l;return l}function Zr(t){for(;Ai.length<=t;)Ai.push(qr(Ai)+" ");return Ai[t]}function qr(t){return t[t.length-1]}function Qr(t){if(Gn)t.selectionStart=0,t.selectionEnd=t.value.length;else try{t.select()}catch(e){}}function Jr(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;n>r;++r)if(t[r]==e)return r;return-1}function tn(t,e){function r(){}r.prototype=t;var n=new r;return e&&en(e,n),n}function en(t,e){e||(e={});for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}function rn(t){for(var e=[],r=0;t>r;++r)e.push(void 0);return e}function nn(t){var e=Array.prototype.slice.call(arguments,1);return function(){return t.apply(null,e)}}function on(t){return/\w/.test(t)||t>"€"&&(t.toUpperCase()!=t.toLowerCase()||Ni.test(t))}function ln(t){for(var e in t)if(t.hasOwnProperty(e)&&t[e])return!1;return!0}function sn(t,e,r,n){var i=document.createElement(t);if(r&&(i.className=r),n&&(i.style.cssText=n),"string"==typeof e)cn(i,e);else if(e)for(var o=0;o<e.length;++o)i.appendChild(e[o]);return i}function an(t){for(var e=t.childNodes.length;e>0;--e)t.removeChild(t.firstChild);return t}function un(t,e){return an(t).appendChild(e)}function cn(t,e){Hn?(t.innerHTML="",t.appendChild(document.createTextNode(e))):t.textContent=e}function fn(t){return t.getBoundingClientRect()}function hn(){return!1}function dn(t){if(null!=Wi)return Wi;var e=sn("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");return un(t,e),e.offsetWidth&&(Wi=e.offsetHeight-e.clientHeight),Wi||0}function pn(t){if(null==Oi){var e=sn("span","​");un(t,sn("span",[e,document.createTextNode("x")])),0!=t.firstChild.offsetHeight&&(Oi=e.offsetWidth<=1&&e.offsetHeight>2&&!Nn)}return Oi?sn("span","​"):sn("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px")}function gn(t,e,r,n){if(!t)return n(e,r,"ltr");for(var i=!1,o=0;o<t.length;++o){var l=t[o];(l.from<r&&l.to>e||e==r&&l.to==e)&&(n(Math.max(l.from,e),Math.min(l.to,r),1==l.level?"rtl":"ltr"),i=!0)}i||n(e,r,"ltr")}function mn(t){return t.level%2?t.to:t.from}function vn(t){return t.level%2?t.from:t.to}function yn(t){var e=Cr(t);return e?mn(e[0]):0}function bn(t){var e=Cr(t);return e?vn(qr(e)):t.text.length}function xn(t,e){var r=pr(t.doc,e),n=Ge(t.doc,r);n!=r&&(e=yr(n));var i=Cr(n),o=i?i[0].level%2?bn(n):yn(n):0;return Yt(e,o)}function Cn(t,e){for(var r,n;r=Be(n=pr(t.doc,e));)e=r.find().to.line;var i=Cr(n),o=i?i[0].level%2?yn(n):bn(n):n.text.length;return Yt(e,o)}function wn(t,e,r){var n=t[0].level;return e==n?!0:r==n?!1:r>e}function Ln(t,e){for(var r,n=0;n<t.length;++n){var i=t[n];if(i.from<e&&i.to>e)return Pi=null,n;if(i.from==e||i.to==e){if(null!=r)return wn(t,i.level,t[r].level)?(Pi=r,n):(Pi=n,r);r=n}}return Pi=null,r}function kn(t,e,r,n){if(!n)return e+r;do e+=r;while(e>0&&Hi.test(t.text.charAt(e)));return e}function Sn(t,e,r,n){var i=Cr(t);if(!i)return Mn(t,e,r,n);for(var o=Ln(i,e),l=i[o],s=kn(t,e,l.level%2?-r:r,n);;){if(s>l.from&&s<l.to)return s;if(s==l.from||s==l.to)return Ln(i,s)==o?s:(l=i[o+=r],r>0==l.level%2?l.to:l.from);if(l=i[o+=r],!l)return null;s=r>0==l.level%2?kn(t,l.to,-1,n):kn(t,l.from,1,n)}}function Mn(t,e,r,n){var i=e+r;if(n)for(;i>0&&Hi.test(t.text.charAt(i));)i+=r;return 0>i||i>t.text.length?null:i}var Tn=/gecko\/\d/i.test(navigator.userAgent),An=/MSIE \d/.test(navigator.userAgent),Nn=An&&(null==document.documentMode||document.documentMode<8),Hn=An&&(null==document.documentMode||document.documentMode<9),Dn=/Trident\/([7-9]|\d{2,})\./.test(navigator.userAgent),Wn=/WebKit\//.test(navigator.userAgent),On=Wn&&/Qt\/\d+\.\d+/.test(navigator.userAgent),En=/Chrome\//.test(navigator.userAgent),zn=/Opera\//.test(navigator.userAgent),In=/Apple Computer/.test(navigator.vendor),Fn=/KHTML\//.test(navigator.userAgent),Pn=/Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent),Rn=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),Bn=/PhantomJS/.test(navigator.userAgent),Gn=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),Vn=Gn||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),Kn=Gn||/Mac/.test(navigator.platform),Un=/win/i.test(navigator.platform),Xn=zn&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);Xn&&(Xn=Number(Xn[1])),Xn&&Xn>=15&&(zn=!1,Wn=!0);var _n,Yn,jn,$n=Kn&&(On||zn&&(null==Xn||12.11>Xn)),Zn=Tn||An&&!Hn,qn=!1,Qn=!1,Jn=0,ti=0,ei=0,ri=null;An?ri=-.53:Tn?ri=15:En?ri=-.7:In&&(ri=-1/3);var ni,ii,oi=null,li=t.changeEnd=function(t){return t.text?Yt(t.from.line+t.text.length-1,qr(t.text).length+(1==t.text.length?t.from.ch:0)):t.to};t.Pos=Yt,t.prototype={constructor:t,focus:function(){window.focus(),pt(this),ft(this)},setOption:function(t,e){var r=this.options,n=r[t];(r[t]!=e||"mode"==t)&&(r[t]=e,si.hasOwnProperty(t)&&lt(this,si[t])(this,e,n))},getOption:function(t){return this.options[t]},getDoc:function(){return this.doc},addKeyMap:function(t,e){this.state.keyMaps[e?"push":"unshift"](t)},removeKeyMap:function(t){for(var e=this.state.keyMaps,r=0;r<e.length;++r)if(e[r]==t||"string"!=typeof e[r]&&e[r].name==t)return e.splice(r,1),!0},addOverlay:lt(null,function(e,r){var n=e.token?e:t.getMode(this.options,e);if(n.startState)throw new Error("Overlays may not be stateful.");this.state.overlays.push({mode:n,modeSpec:e,opaque:r&&r.opaque}),this.state.modeGen++,ut(this)}),removeOverlay:lt(null,function(t){for(var e=this.state.overlays,r=0;r<e.length;++r){var n=e[r].modeSpec;if(n==t||"string"==typeof t&&n.name==t)return e.splice(r,1),this.state.modeGen++,void ut(this)}}),indentLine:lt(null,function(t,e,r){"string"!=typeof e&&"number"!=typeof e&&(e=null==e?this.options.smartIndent?"smart":"prev":e?"add":"subtract"),te(this.doc,t)&&he(this,t,e,r)}),indentSelection:lt(null,function(t){var e=this.doc.sel;if(jt(e.from,e.to))return he(this,e.from.line,t);for(var r=e.to.line-(e.to.ch?0:1),n=e.from.line;r>=n;++n)he(this,n,t)}),getTokenAt:function(t,e){var r=this.doc;t=Qt(r,t);for(var n=z(this,t.line,e),i=this.doc.mode,o=pr(r,t.line),l=new Se(o.text,this.options.tabSize);l.pos<t.ch&&!l.eol();){l.start=l.pos;var s=i.token(l,n)}return{start:l.start,end:l.pos,string:l.current(),className:s||null,type:s||null,state:n}},getTokenTypeAt:function(t){t=Qt(this.doc,t);var e=Je(this,pr(this.doc,t.line)),r=0,n=(e.length-1)/2,i=t.ch;if(0==i)return e[2];for(;;){var o=r+n>>1;if((o?e[2*o-1]:0)>=i)n=o;else{if(!(e[2*o+1]<i))return e[2*o+2];r=o+1}}},getModeAt:function(e){var r=this.doc.mode;return r.innerMode?t.innerMode(r,this.getTokenAt(e).state).mode:r},getHelper:function(t,e){if(pi.hasOwnProperty(e)){var r=pi[e],n=this.getModeAt(t);return n[e]&&r[n[e]]||n.helperType&&r[n.helperType]||r[n.name]}},getStateAfter:function(t,e){var r=this.doc;return t=qt(r,null==t?r.first+r.size-1:t),z(this,t+1,e)},cursorCoords:function(t,e){var r,n=this.doc.sel;return r=null==t?n.head:"object"==typeof t?Qt(this.doc,t):t?n.from:n.to,Q(this,r,e||"page")},charCoords:function(t,e){return q(this,Qt(this.doc,t),e||"page")},coordsChar:function(t,e){return t=Z(this,t,e||"page"),tt(this,t.left,t.top)},lineAtHeight:function(t,e){return t=Z(this,{top:t,left:0},e||"page").top,br(this.doc,t+this.display.viewOffset)},heightAtLine:function(t,e){var r=!1,n=this.doc.first+this.doc.size-1;t<this.doc.first?t=this.doc.first:t>n&&(t=n,r=!0);var i=pr(this.doc,t);return $(this,pr(this.doc,t),{top:0,left:0},e||"page").top+(r?i.height:0)},defaultTextHeight:function(){return rt(this.display)},defaultCharWidth:function(){return nt(this.display)},setGutterMarker:lt(null,function(t,e,r){return de(this,t,function(t){var n=t.gutterMarkers||(t.gutterMarkers={});return n[e]=r,!r&&ln(n)&&(t.gutterMarkers=null),!0})}),clearGutter:lt(null,function(t){var e=this,r=e.doc,n=r.first;r.iter(function(r){r.gutterMarkers&&r.gutterMarkers[t]&&(r.gutterMarkers[t]=null,ut(e,n,n+1),ln(r.gutterMarkers)&&(r.gutterMarkers=null)),++n})}),addLineClass:lt(null,function(t,e,r){return de(this,t,function(t){var n="text"==e?"textClass":"background"==e?"bgClass":"wrapClass";if(t[n]){if(new RegExp("(?:^|\\s)"+r+"(?:$|\\s)").test(t[n]))return!1;t[n]+=" "+r}else t[n]=r;return!0})}),removeLineClass:lt(null,function(t,e,r){return de(this,t,function(t){var n="text"==e?"textClass":"background"==e?"bgClass":"wrapClass",i=t[n];if(!i)return!1;if(null==r)t[n]=null;else{var o=i.match(new RegExp("(?:^|\\s+)"+r+"(?:$|\\s+)"));if(!o)return!1;var l=o.index+o[0].length;t[n]=i.slice(0,o.index)+(o.index&&l!=i.length?" ":"")+i.slice(l)||null}return!0})}),addLineWidget:lt(null,function(t,e,r){return je(this,t,e,r)}),removeLineWidget:function(t){t.clear()},lineInfo:function(t){if("number"==typeof t){if(!te(this.doc,t))return null;var e=t;if(t=pr(this.doc,t),!t)return null}else{var e=yr(t);if(null==e)return null}return{line:e,handle:t,text:t.text,gutterMarkers:t.gutterMarkers,textClass:t.textClass,bgClass:t.bgClass,wrapClass:t.wrapClass,widgets:t.widgets}},getViewport:function(){return{from:this.display.showingFrom,to:this.display.showingTo}},addWidget:function(t,e,r,n,i){var o=this.display;t=Q(this,Qt(this.doc,t));var l=t.bottom,s=t.left;if(e.style.position="absolute",o.sizer.appendChild(e),"over"==n)l=t.top;else if("above"==n||"near"==n){var a=Math.max(o.wrapper.clientHeight,this.doc.height),u=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==n||t.bottom+e.offsetHeight>a)&&t.top>e.offsetHeight?l=t.top-e.offsetHeight:t.bottom+e.offsetHeight<=a&&(l=t.bottom),s+e.offsetWidth>u&&(s=u-e.offsetWidth)}e.style.top=l+"px",e.style.left=e.style.right="","right"==i?(s=o.sizer.clientWidth-e.offsetWidth,e.style.right="0px"):("left"==i?s=0:"middle"==i&&(s=(o.sizer.clientWidth-e.offsetWidth)/2),e.style.left=s+"px"),r&&ae(this,s,l,s+e.offsetWidth,l+e.offsetHeight)},triggerOnKeyDown:lt(null,Wt),execCommand:function(t){return gi[t](this)},findPosH:function(t,e,r,n){var i=1;0>e&&(i=-1,e=-e);for(var o=0,l=Qt(this.doc,t);e>o&&(l=pe(this.doc,l,i,r,n),!l.hitSide);++o);return l},moveH:lt(null,function(t,e){var r,n=this.doc.sel;r=n.shift||n.extend||jt(n.from,n.to)?pe(this.doc,n.head,t,e,this.options.rtlMoveVisually):0>t?n.from:n.to,ee(this.doc,r,r,t)}),deleteH:lt(null,function(t,e){var r=this.doc.sel;jt(r.from,r.to)?_t(this.doc,"",r.from,pe(this.doc,r.head,t,e,!1),"+delete"):_t(this.doc,"",r.from,r.to,"+delete"),this.curOp.userSelChange=!0}),findPosV:function(t,e,r,n){var i=1,o=n;0>e&&(i=-1,e=-e);for(var l=0,s=Qt(this.doc,t);e>l;++l){var a=Q(this,s,"div");if(null==o?o=a.left:a.left=o,s=ge(this,a,i,r),s.hitSide)break}return s},moveV:lt(null,function(t,e){var r=this.doc.sel,n=Q(this,r.head,"div");null!=r.goalColumn&&(n.left=r.goalColumn);var i=ge(this,n,t,e);"page"==e&&fe(this,0,q(this,i,"div").top-n.top),ee(this.doc,i,i,t),r.goalColumn=n.left}),toggleOverwrite:function(t){(null==t||t!=this.state.overwrite)&&((this.state.overwrite=!this.state.overwrite)?this.display.cursor.className+=" CodeMirror-overwrite":this.display.cursor.className=this.display.cursor.className.replace(" CodeMirror-overwrite",""))},hasFocus:function(){return this.state.focused},scrollTo:lt(null,function(t,e){ce(this,t,e)}),getScrollInfo:function(){var t=this.display.scroller,e=Mi;return{left:t.scrollLeft,top:t.scrollTop,height:t.scrollHeight-e,width:t.scrollWidth-e,clientHeight:t.clientHeight-e,clientWidth:t.clientWidth-e}},scrollIntoView:lt(null,function(t,e){null==t?t={from:this.doc.sel.head,to:null}:"number"==typeof t?t={from:Yt(t,0),to:null}:null==t.from&&(t={from:t,to:null}),t.to||(t.to=t.from),e||(e=0);var r=t;null!=t.from.line&&(this.curOp.scrollToPos={from:t.from,to:t.to,margin:e},r={from:Q(this,t.from),to:Q(this,t.to)});var n=ue(this,Math.min(r.from.left,r.to.left),Math.min(r.from.top,r.to.top)-e,Math.max(r.from.right,r.to.right),Math.max(r.from.bottom,r.to.bottom)+e);ce(this,n.scrollLeft,n.scrollTop)}),setSize:lt(null,function(t,e){function r(t){return"number"==typeof t||/^\d+$/.test(String(t))?t+"px":t}null!=t&&(this.display.wrapper.style.width=r(t)),null!=e&&(this.display.wrapper.style.height=r(e)),this.options.lineWrapping&&(this.display.measureLineCache.length=this.display.measureLineCachePos=0),this.curOp.forceUpdate=!0}),operation:function(t){return at(this,t)},refresh:lt(null,function(){var t=null==this.display.cachedTextHeight;_(this),ce(this,this.doc.scrollLeft,this.doc.scrollTop),ut(this),t&&o(this)}),swapDoc:lt(null,function(t){var e=this.doc;return e.cm=null,dr(this,t),_(this),dt(this,!0),ce(this,t.scrollLeft,t.scrollTop),Kr(this,"swapDoc",this,e),e}),getInputField:function(){return this.display.input},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Yr(t);var si=t.optionHandlers={},ai=t.defaults={},ui=t.Init={toString:function(){return"CodeMirror.Init"}};ye("value","",function(t,e){t.setValue(e)},!0),ye("mode",null,function(t,e){t.doc.modeOption=e,r(t)},!0),ye("indentUnit",2,r,!0),ye("indentWithTabs",!1),ye("smartIndent",!0),ye("tabSize",4,function(t){r(t),_(t),ut(t)},!0),ye("specialChars",/[\t\u0000-\u0019\u00ad\u200b\u2028\u2029\ufeff]/g,function(t,e){t.options.specialChars=new RegExp(e.source+(e.test("	")?"":"|	"),"g"),t.refresh()},!0),ye("specialCharPlaceholder",nr,function(t){t.refresh()},!0),ye("electricChars",!0),ye("rtlMoveVisually",!Un),ye("wholeLineUpdateBefore",!0),ye("theme","default",function(t){s(t),a(t)},!0),ye("keyMap","default",l),ye("extraKeys",null),ye("onKeyEvent",null),ye("onDragEvent",null),ye("lineWrapping",!1,n,!0),ye("gutters",[],function(t){h(t.options),a(t)},!0),ye("fixedGutter",!0,function(t,e){t.display.gutters.style.left=e?y(t.display)+"px":"0",t.refresh()},!0),ye("coverGutterNextToScrollbar",!1,d,!0),ye("lineNumbers",!1,function(t){h(t.options),a(t)},!0),ye("firstLineNumber",1,a,!0),ye("lineNumberFormatter",function(t){return t},a,!0),ye("showCursorWhenSelecting",!1,A,!0),ye("resetSelectionOnContextMenu",!0),ye("readOnly",!1,function(t,e){"nocursor"==e?(zt(t),t.display.input.blur(),t.display.disabled=!0):(t.display.disabled=!1,e||dt(t,!0))}),ye("dragDrop",!0),ye("cursorBlinkRate",530),ye("cursorScrollMargin",0),ye("cursorHeight",1),ye("workTime",100),ye("workDelay",100),ye("flattenSpans",!0),ye("pollInterval",100),ye("undoDepth",40,function(t,e){t.doc.history.undoDepth=e}),ye("historyEventDelay",500),ye("viewportMargin",10,function(t){t.refresh()},!0),ye("maxHighlightLength",1e4,function(t){r(t),t.refresh()},!0),ye("crudeMeasuringFrom",1e4),ye("moveInputWithCursor",!0,function(t,e){e||(t.display.inputDiv.style.top=t.display.inputDiv.style.left=0)}),ye("tabindex",null,function(t,e){t.display.input.tabIndex=e||""}),ye("autofocus",null);var ci=t.modes={},fi=t.mimeModes={};t.defineMode=function(e,r){if(t.defaults.mode||"null"==e||(t.defaults.mode=e),arguments.length>2){r.dependencies=[];for(var n=2;n<arguments.length;++n)r.dependencies.push(arguments[n])}ci[e]=r},t.defineMIME=function(t,e){fi[t]=e},t.resolveMode=function(e){if("string"==typeof e&&fi.hasOwnProperty(e))e=fi[e];else if(e&&"string"==typeof e.name&&fi.hasOwnProperty(e.name)){var r=fi[e.name];e=tn(r,e),e.name=r.name}else if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return t.resolveMode("application/xml");return"string"==typeof e?{name:e}:e||{name:"null"}},t.getMode=function(e,r){var r=t.resolveMode(r),n=ci[r.name];if(!n)return t.getMode(e,"text/plain");var i=n(e,r);if(hi.hasOwnProperty(r.name)){var o=hi[r.name];for(var l in o)o.hasOwnProperty(l)&&(i.hasOwnProperty(l)&&(i["_"+l]=i[l]),i[l]=o[l])}return i.name=r.name,i},t.defineMode("null",function(){return{token:function(t){t.skipToEnd()}}}),t.defineMIME("text/plain","null");var hi=t.modeExtensions={};t.extendMode=function(t,e){var r=hi.hasOwnProperty(t)?hi[t]:hi[t]={};en(e,r)},t.defineExtension=function(e,r){t.prototype[e]=r},t.defineDocExtension=function(t,e){Ci.prototype[t]=e},t.defineOption=ye;var di=[];t.defineInitHook=function(t){di.push(t)};var pi=t.helpers={};t.registerHelper=function(e,r,n){pi.hasOwnProperty(e)||(pi[e]=t[e]={}),pi[e][r]=n},t.isWordChar=on,t.copyState=be,t.startState=xe,t.innerMode=function(t,e){for(;t.innerMode;){var r=t.innerMode(e);if(!r||r.mode==t)break;e=r.state,t=r.mode}return r||{mode:t,state:e}};var gi=t.commands={selectAll:function(t){t.setSelection(Yt(t.firstLine(),0),Yt(t.lastLine()))},killLine:function(t){var e=t.getCursor(!0),r=t.getCursor(!1),n=!jt(e,r);n||t.getLine(e.line).length!=e.ch?t.replaceRange("",e,n?r:Yt(e.line),"+delete"):t.replaceRange("",e,Yt(e.line+1,0),"+delete")},deleteLine:function(t){var e=t.getCursor().line;t.replaceRange("",Yt(e,0),Yt(e),"+delete")},delLineLeft:function(t){var e=t.getCursor();t.replaceRange("",Yt(e.line,0),e,"+delete")},undo:function(t){t.undo()},redo:function(t){t.redo()},goDocStart:function(t){t.extendSelection(Yt(t.firstLine(),0))},goDocEnd:function(t){t.extendSelection(Yt(t.lastLine()))},goLineStart:function(t){t.extendSelection(xn(t,t.getCursor().line))},goLineStartSmart:function(t){var e=t.getCursor(),r=xn(t,e.line),n=t.getLineHandle(r.line),i=Cr(n);if(i&&0!=i[0].level)t.extendSelection(r);else{var o=Math.max(0,n.text.search(/\S/)),l=e.line==r.line&&e.ch<=o&&e.ch;t.extendSelection(Yt(r.line,l?0:o))}},goLineEnd:function(t){t.extendSelection(Cn(t,t.getCursor().line))},goLineRight:function(t){var e=t.charCoords(t.getCursor(),"div").top+5;t.extendSelection(t.coordsChar({left:t.display.lineDiv.offsetWidth+100,top:e},"div"))},goLineLeft:function(t){var e=t.charCoords(t.getCursor(),"div").top+5;t.extendSelection(t.coordsChar({left:0,top:e},"div"))},goLineUp:function(t){t.moveV(-1,"line")},goLineDown:function(t){t.moveV(1,"line")},goPageUp:function(t){t.moveV(-1,"page")},goPageDown:function(t){t.moveV(1,"page")},goCharLeft:function(t){t.moveH(-1,"char")},goCharRight:function(t){t.moveH(1,"char")},goColumnLeft:function(t){t.moveH(-1,"column")},goColumnRight:function(t){t.moveH(1,"column")},goWordLeft:function(t){t.moveH(-1,"word")},goGroupRight:function(t){t.moveH(1,"group")},goGroupLeft:function(t){t.moveH(-1,"group")},goWordRight:function(t){t.moveH(1,"word")},delCharBefore:function(t){t.deleteH(-1,"char")},delCharAfter:function(t){t.deleteH(1,"char")},delWordBefore:function(t){t.deleteH(-1,"word")},delWordAfter:function(t){t.deleteH(1,"word")},delGroupBefore:function(t){t.deleteH(-1,"group")},delGroupAfter:function(t){t.deleteH(1,"group")},indentAuto:function(t){t.indentSelection("smart")},indentMore:function(t){t.indentSelection("add")},indentLess:function(t){t.indentSelection("subtract")},insertTab:function(t){t.replaceSelection("	","end","+input")},defaultTab:function(t){t.somethingSelected()?t.indentSelection("add"):t.replaceSelection("	","end","+input")},transposeChars:function(t){var e=t.getCursor(),r=t.getLine(e.line);e.ch>0&&e.ch<r.length-1&&t.replaceRange(r.charAt(e.ch)+r.charAt(e.ch-1),Yt(e.line,e.ch-1),Yt(e.line,e.ch+1))},newlineAndIndent:function(t){lt(t,function(){t.replaceSelection("\n","end","+input"),t.indentLine(t.getCursor().line,null,!0)})()},toggleOverwrite:function(t){t.toggleOverwrite()}},mi=t.keyMap={};mi.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"},mi.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Alt-Up":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Down":"goDocEnd","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",fallthrough:"basic"},mi.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineStart","Cmd-Right":"goLineEnd","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":"delLineLeft",fallthrough:["basic","emacsy"]},mi["default"]=Kn?mi.macDefault:mi.pcDefault,mi.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"},t.lookupKey=we,t.isModifierKey=Le,t.keyName=ke,t.fromTextArea=function(e,r){function n(){e.value=u.getValue()}if(r||(r={}),r.value=e.value,!r.tabindex&&e.tabindex&&(r.tabindex=e.tabindex),!r.placeholder&&e.placeholder&&(r.placeholder=e.placeholder),null==r.autofocus){var i=document.body;try{i=document.activeElement}catch(o){}r.autofocus=i==e||null!=e.getAttribute("autofocus")&&i==document.body}if(e.form&&(Br(e.form,"submit",n),!r.leaveSubmitMethodAlone)){var l=e.form,s=l.submit;try{var a=l.submit=function(){n(),l.submit=s,l.submit(),l.submit=a}}catch(o){}}e.style.display="none";var u=t(function(t){e.parentNode.insertBefore(t,e.nextSibling)},r);return u.save=n,u.getTextArea=function(){return e},u.toTextArea=function(){n(),e.parentNode.removeChild(u.getWrapperElement()),e.style.display="",e.form&&(Gr(e.form,"submit",n),"function"==typeof e.form.submit&&(e.form.submit=s))},u},Se.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return 0==this.pos},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){return this.pos<this.string.length?this.string.charAt(this.pos++):void 0},eat:function(t){var e=this.string.charAt(this.pos);if("string"==typeof t)var r=e==t;else var r=e&&(t.test?t.test(e):t(e));return r?(++this.pos,e):void 0},eatWhile:function(t){for(var e=this.pos;this.eat(t););return this.pos>e},eatSpace:function(){for(var t=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>t},skipToEnd:function(){this.pos=this.string.length},skipTo:function(t){var e=this.string.indexOf(t,this.pos);return e>-1?(this.pos=e,!0):void 0},backUp:function(t){this.pos-=t},column:function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=$r(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue},indentation:function(){return $r(this.string,null,this.tabSize)},match:function(t,e,r){if("string"!=typeof t){var n=this.string.slice(this.pos).match(t);return n&&n.index>0?null:(n&&e!==!1&&(this.pos+=n[0].length),n)}var i=function(t){return r?t.toLowerCase():t},o=this.string.substr(this.pos,t.length);return i(o)==i(t)?(e!==!1&&(this.pos+=t.length),!0):void 0},current:function(){return this.string.slice(this.start,this.pos)}},t.StringStream=Se,t.TextMarker=Me,Yr(Me),Me.prototype.clear=function(){if(!this.explicitlyCleared){var t=this.doc.cm,e=t&&!t.curOp;if(e&&it(t),_r(this,"clear")){var r=this.find();r&&Kr(this,"clear",r.from,r.to)}for(var n=null,i=null,o=0;o<this.lines.length;++o){var l=this.lines[o],s=He(l.markedSpans,this);null!=s.to&&(i=yr(l)),l.markedSpans=De(l.markedSpans,s),null!=s.from?n=yr(l):this.collapsed&&!Ve(this.doc,l)&&t&&vr(l,rt(t.display))}if(t&&this.collapsed&&!t.options.lineWrapping)for(var o=0;o<this.lines.length;++o){var a=Ge(t.doc,this.lines[o]),u=c(t.doc,a);u>t.display.maxLineLength&&(t.display.maxLine=a,t.display.maxLineLength=u,t.display.maxLineChanged=!0)}null!=n&&t&&ut(t,n,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,t&&ie(t)),e&&ot(t)}},Me.prototype.find=function(){for(var t,e,r=0;r<this.lines.length;++r){var n=this.lines[r],i=He(n.markedSpans,this);if(null!=i.from||null!=i.to){var o=yr(n);null!=i.from&&(t=Yt(o,i.from)),null!=i.to&&(e=Yt(o,i.to))}}return"bookmark"==this.type?t:t&&{from:t,to:e}},Me.prototype.changed=function(){var t=this.find(),e=this.doc.cm;if(t&&e){"bookmark"!=this.type&&(t=t.from);
var r=pr(this.doc,t.line);if(G(e,r),t.line>=e.display.showingFrom&&t.line<e.display.showingTo){for(var n=e.display.lineDiv.firstChild;n;n=n.nextSibling)if(n.lineObj==r){n.offsetHeight!=r.height&&vr(r,n.offsetHeight);break}at(e,function(){e.curOp.selectionChanged=e.curOp.forceUpdate=e.curOp.updateMaxLine=!0})}}},Me.prototype.attachLine=function(t){if(!this.lines.length&&this.doc.cm){var e=this.doc.cm.curOp;e.maybeHiddenMarkers&&-1!=Jr(e.maybeHiddenMarkers,this)||(e.maybeUnhiddenMarkers||(e.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(t)},Me.prototype.detachLine=function(t){if(this.lines.splice(Jr(this.lines,t),1),!this.lines.length&&this.doc.cm){var e=this.doc.cm.curOp;(e.maybeHiddenMarkers||(e.maybeHiddenMarkers=[])).push(this)}},t.SharedTextMarker=Ae,Yr(Ae),Ae.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var t=0;t<this.markers.length;++t)this.markers[t].clear();Kr(this,"clear")}},Ae.prototype.find=function(){return this.primary.find()};var vi=t.LineWidget=function(t,e,r){if(r)for(var n in r)r.hasOwnProperty(n)&&(this[n]=r[n]);this.cm=t,this.node=e};Yr(vi),vi.prototype.clear=_e(function(){var t=this.line.widgets,e=yr(this.line);if(null!=e&&t){for(var r=0;r<t.length;++r)t[r]==this&&t.splice(r--,1);t.length||(this.line.widgets=null);var n=xr(this.cm,this.line)<this.cm.doc.scrollTop;vr(this.line,Math.max(0,this.line.height-Ye(this))),n&&fe(this.cm,0,-this.height),ut(this.cm,e,e+1)}}),vi.prototype.changed=_e(function(){var t=this.height;this.height=null;var e=Ye(this)-t;if(e){vr(this.line,this.line.height+e);var r=yr(this.line);ut(this.cm,r,r+1)}});var yi=t.Line=function(t,e,r){this.text=t,Xe(this,e),this.height=r?r(this):1};Yr(yi),yi.prototype.lineNo=function(){return yr(this)};var bi={};cr.prototype={chunkSize:function(){return this.lines.length},removeInner:function(t,e){for(var r=t,n=t+e;n>r;++r){var i=this.lines[r];this.height-=i.height,Ze(i),Kr(i,"delete")}this.lines.splice(t,e)},collapse:function(t){t.splice.apply(t,[t.length,0].concat(this.lines))},insertInner:function(t,e,r){this.height+=r,this.lines=this.lines.slice(0,t).concat(e).concat(this.lines.slice(t));for(var n=0,i=e.length;i>n;++n)e[n].parent=this},iterN:function(t,e,r){for(var n=t+e;n>t;++t)if(r(this.lines[t]))return!0}},fr.prototype={chunkSize:function(){return this.size},removeInner:function(t,e){this.size-=e;for(var r=0;r<this.children.length;++r){var n=this.children[r],i=n.chunkSize();if(i>t){var o=Math.min(e,i-t),l=n.height;if(n.removeInner(t,o),this.height-=l-n.height,i==o&&(this.children.splice(r--,1),n.parent=null),0==(e-=o))break;t=0}else t-=i}if(this.size-e<25){var s=[];this.collapse(s),this.children=[new cr(s)],this.children[0].parent=this}},collapse:function(t){for(var e=0,r=this.children.length;r>e;++e)this.children[e].collapse(t)},insertInner:function(t,e,r){this.size+=e.length,this.height+=r;for(var n=0,i=this.children.length;i>n;++n){var o=this.children[n],l=o.chunkSize();if(l>=t){if(o.insertInner(t,e,r),o.lines&&o.lines.length>50){for(;o.lines.length>50;){var s=o.lines.splice(o.lines.length-25,25),a=new cr(s);o.height-=a.height,this.children.splice(n+1,0,a),a.parent=this}this.maybeSpill()}break}t-=l}},maybeSpill:function(){if(!(this.children.length<=10)){var t=this;do{var e=t.children.splice(t.children.length-5,5),r=new fr(e);if(t.parent){t.size-=r.size,t.height-=r.height;var n=Jr(t.parent.children,t);t.parent.children.splice(n+1,0,r)}else{var i=new fr(t.children);i.parent=t,t.children=[i,r],t=i}r.parent=t.parent}while(t.children.length>10);t.parent.maybeSpill()}},iterN:function(t,e,r){for(var n=0,i=this.children.length;i>n;++n){var o=this.children[n],l=o.chunkSize();if(l>t){var s=Math.min(e,l-t);if(o.iterN(t,s,r))return!0;if(0==(e-=s))break;t=0}else t-=l}}};var xi=0,Ci=t.Doc=function(t,e,r){if(!(this instanceof Ci))return new Ci(t,e,r);null==r&&(r=0),fr.call(this,[new cr([new yi("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.history=wr(),this.cleanGeneration=1,this.frontier=r;var n=Yt(r,0);this.sel={from:n,to:n,head:n,anchor:n,shift:!1,extend:!1,goalColumn:null},this.id=++xi,this.modeOption=e,"string"==typeof t&&(t=Ei(t)),ur(this,{from:n,to:n,text:t},null,{head:n,anchor:n})};Ci.prototype=tn(fr.prototype,{constructor:Ci,iter:function(t,e,r){r?this.iterN(t-this.first,e-t,r):this.iterN(this.first,this.first+this.size,t)},insert:function(t,e){for(var r=0,n=0,i=e.length;i>n;++n)r+=e[n].height;this.insertInner(t-this.first,e,r)},remove:function(t,e){this.removeInner(t-this.first,e)},getValue:function(t){var e=mr(this,this.first,this.first+this.size);return t===!1?e:e.join(t||"\n")},setValue:function(t){var e=Yt(this.first,0),r=this.first+this.size-1;Bt(this,{from:e,to:Yt(r,pr(this,r).text.length),text:Ei(t),origin:"setValue"},{head:e,anchor:e},!0)},replaceRange:function(t,e,r,n){e=Qt(this,e),r=r?Qt(this,r):e,_t(this,t,e,r,n)},getRange:function(t,e,r){var n=gr(this,Qt(this,t),Qt(this,e));return r===!1?n:n.join(r||"\n")},getLine:function(t){var e=this.getLineHandle(t);return e&&e.text},setLine:function(t,e){te(this,t)&&_t(this,e,Yt(t,0),Qt(this,Yt(t)))},removeLine:function(t){t?_t(this,"",Qt(this,Yt(t-1)),Qt(this,Yt(t))):_t(this,"",Yt(0,0),Qt(this,Yt(1,0)))},getLineHandle:function(t){return te(this,t)?pr(this,t):void 0},getLineNumber:function(t){return yr(t)},getLineHandleVisualStart:function(t){return"number"==typeof t&&(t=pr(this,t)),Ge(this,t)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(t){return Qt(this,t)},getCursor:function(t){var e,r=this.sel;return e=null==t||"head"==t?r.head:"anchor"==t?r.anchor:"end"==t||t===!1?r.to:r.from,Zt(e)},somethingSelected:function(){return!jt(this.sel.head,this.sel.anchor)},setCursor:st(function(t,e,r){var n=Qt(this,"number"==typeof t?Yt(t,e||0):t);r?ee(this,n):ne(this,n,n)}),setSelection:st(function(t,e,r){ne(this,Qt(this,t),Qt(this,e||t),r)}),extendSelection:st(function(t,e,r){ee(this,Qt(this,t),e&&Qt(this,e),r)}),getSelection:function(t){return this.getRange(this.sel.from,this.sel.to,t)},replaceSelection:function(t,e,r){Bt(this,{from:this.sel.from,to:this.sel.to,text:Ei(t),origin:r},e||"around")},undo:st(function(){Vt(this,"undo")}),redo:st(function(){Vt(this,"redo")}),setExtending:function(t){this.sel.extend=t},historySize:function(){var t=this.history;return{undo:t.done.length,redo:t.undone.length}},clearHistory:function(){this.history=wr(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration()},changeGeneration:function(){return this.history.lastOp=this.history.lastOrigin=null,this.history.generation},isClean:function(t){return this.history.generation==(t||this.cleanGeneration)},getHistory:function(){return{done:Ar(this.history.done),undone:Ar(this.history.undone)}},setHistory:function(t){var e=this.history=wr(this.history.maxGeneration);e.done=t.done.slice(0),e.undone=t.undone.slice(0)},markText:function(t,e,r){return Te(this,Qt(this,t),Qt(this,e),r,"range")},setBookmark:function(t,e){var r={replacedWith:e&&(null==e.nodeType?e.widget:e),insertLeft:e&&e.insertLeft};return t=Qt(this,t),Te(this,t,t,r,"bookmark")},findMarksAt:function(t){t=Qt(this,t);var e=[],r=pr(this,t.line).markedSpans;if(r)for(var n=0;n<r.length;++n){var i=r[n];(null==i.from||i.from<=t.ch)&&(null==i.to||i.to>=t.ch)&&e.push(i.marker.parent||i.marker)}return e},getAllMarks:function(){var t=[];return this.iter(function(e){var r=e.markedSpans;if(r)for(var n=0;n<r.length;++n)null!=r[n].from&&t.push(r[n].marker)}),t},posFromIndex:function(t){var e,r=this.first;return this.iter(function(n){var i=n.text.length+1;return i>t?(e=t,!0):(t-=i,void++r)}),Qt(this,Yt(r,e))},indexFromPos:function(t){t=Qt(this,t);var e=t.ch;return t.line<this.first||t.ch<0?0:(this.iter(this.first,t.line,function(t){e+=t.text.length+1}),e)},copy:function(t){var e=new Ci(mr(this,this.first,this.first+this.size),this.modeOption,this.first);return e.scrollTop=this.scrollTop,e.scrollLeft=this.scrollLeft,e.sel={from:this.sel.from,to:this.sel.to,head:this.sel.head,anchor:this.sel.anchor,shift:this.sel.shift,extend:!1,goalColumn:this.sel.goalColumn},t&&(e.history.undoDepth=this.history.undoDepth,e.setHistory(this.getHistory())),e},linkedDoc:function(t){t||(t={});var e=this.first,r=this.first+this.size;null!=t.from&&t.from>e&&(e=t.from),null!=t.to&&t.to<r&&(r=t.to);var n=new Ci(mr(this,e,r),t.mode||this.modeOption,e);return t.sharedHist&&(n.history=this.history),(this.linked||(this.linked=[])).push({doc:n,sharedHist:t.sharedHist}),n.linked=[{doc:this,isParent:!0,sharedHist:t.sharedHist}],n},unlinkDoc:function(e){if(e instanceof t&&(e=e.doc),this.linked)for(var r=0;r<this.linked.length;++r){var n=this.linked[r];if(n.doc==e){this.linked.splice(r,1),e.unlinkDoc(this);break}}if(e.history==this.history){var i=[e.id];hr(e,function(t){i.push(t.id)},!0),e.history=wr(),e.history.done=Ar(this.history.done,i),e.history.undone=Ar(this.history.undone,i)}},iterLinkedDocs:function(t){hr(this,t)},getMode:function(){return this.mode},getEditor:function(){return this.cm}}),Ci.prototype.eachLine=Ci.prototype.iter;var wi="iter insert remove copy getEditor".split(" ");for(var Li in Ci.prototype)Ci.prototype.hasOwnProperty(Li)&&Jr(wi,Li)<0&&(t.prototype[Li]=function(t){return function(){return t.apply(this.doc,arguments)}}(Ci.prototype[Li]));Yr(Ci),t.e_stop=Fr,t.e_preventDefault=Er,t.e_stopPropagation=zr;var ki,Si=0;t.on=Br,t.off=Gr,t.signal=Vr;var Mi=30,Ti=t.Pass={toString:function(){return"CodeMirror.Pass"}};jr.prototype={set:function(t,e){clearTimeout(this.id),this.id=setTimeout(e,t)}},t.countColumn=$r;var Ai=[""],Ni=/[\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Hi=/[\u0300-\u036F\u0483-\u0487\u0488-\u0489\u0591-\u05BD\u05BF\u05C1-\u05C2\u05C4-\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7-\u06E8\u06EA-\u06ED\uA66F\u1DC0–\u1DFF\u20D0–\u20FF\uA670-\uA672\uA674-\uA67D\uA69F\udc00-\udfff\uFE20–\uFE2F]/;t.replaceGetRect=function(t){fn=t};var Di=function(){if(Hn)return!1;var t=sn("div");return"draggable"in t||"dragDrop"in t}();Tn?hn=function(t,e){return 36==t.charCodeAt(e-1)&&39==t.charCodeAt(e)}:In&&!/Version\/([6-9]|\d\d)\b/.test(navigator.userAgent)?hn=function(t,e){return/\-[^ \-?]|\?[^ !\'\"\),.\-\/:;\?\]\}]/.test(t.slice(e-1,e+1))}:Wn&&/Chrome\/(?:29|[3-9]\d|\d\d\d)\./.test(navigator.userAgent)?hn=function(t,e){var r=t.charCodeAt(e-1);return r>=8208&&8212>=r}:Wn&&(hn=function(t,e){if(e>1&&45==t.charCodeAt(e-1)){if(/\w/.test(t.charAt(e-2))&&/[^\-?\.]/.test(t.charAt(e)))return!0;if(e>2&&/[\d\.,]/.test(t.charAt(e-2))&&/[\d\.,]/.test(t.charAt(e)))return!1}return/[~!#%&*)=+}\]\\|\"\.>,:;][({[<]|-[^\-?\.\u2010-\u201f\u2026]|\?[\w~`@#$%\^&*(_=+{[|><]|…[\w~`@#$%\^&*(_=+{[><]/.test(t.slice(e-1,e+1))});var Wi,Oi,Ei=3!="\n\nb".split(/\n/).length?function(t){for(var e=0,r=[],n=t.length;n>=e;){var i=t.indexOf("\n",e);-1==i&&(i=t.length);var o=t.slice(e,"\r"==t.charAt(i-1)?i-1:i),l=o.indexOf("\r");-1!=l?(r.push(o.slice(0,l)),e+=l+1):(r.push(o),e=i+1)}return r}:function(t){return t.split(/\r\n?|\n/)};t.splitLines=Ei;var zi=window.getSelection?function(t){try{return t.selectionStart!=t.selectionEnd}catch(e){return!1}}:function(t){try{var e=t.ownerDocument.selection.createRange()}catch(r){}return e&&e.parentElement()==t?0!=e.compareEndPoints("StartToEnd",e):!1},Ii=function(){var t=sn("div");return"oncopy"in t?!0:(t.setAttribute("oncopy","return;"),"function"==typeof t.oncopy)}(),Fi={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",91:"Mod",92:"Mod",93:"Mod",109:"-",107:"=",127:"Delete",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63276:"PageUp",63277:"PageDown",63275:"End",63273:"Home",63234:"Left",63232:"Up",63235:"Right",63233:"Down",63302:"Insert",63272:"Delete"};t.keyNames=Fi,function(){for(var t=0;10>t;t++)Fi[t+48]=String(t);for(var t=65;90>=t;t++)Fi[t]=String.fromCharCode(t);for(var t=1;12>=t;t++)Fi[t+111]=Fi[t+63235]="F"+t}();var Pi,Ri=function(){function t(t){return 255>=t?e.charAt(t):t>=1424&&1524>=t?"R":t>=1536&&1791>=t?r.charAt(t-1536):t>=1792&&2220>=t?"r":"L"}var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLL",r="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmmrrrrrrrrrrrrrrrrrr",n=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,o=/[LRr]/,l=/[Lb1n]/,s=/[1n]/,a="L";return function(e){if(!n.test(e))return!1;for(var r,u=e.length,c=[],f=0;u>f;++f)c.push(r=t(e.charCodeAt(f)));for(var f=0,h=a;u>f;++f){var r=c[f];"m"==r?c[f]=h:h=r}for(var f=0,d=a;u>f;++f){var r=c[f];"1"==r&&"r"==d?c[f]="n":o.test(r)&&(d=r,"r"==r&&(c[f]="R"))}for(var f=1,h=c[0];u-1>f;++f){var r=c[f];"+"==r&&"1"==h&&"1"==c[f+1]?c[f]="1":","!=r||h!=c[f+1]||"1"!=h&&"n"!=h||(c[f]=h),h=r}for(var f=0;u>f;++f){var r=c[f];if(","==r)c[f]="N";else if("%"==r){for(var p=f+1;u>p&&"%"==c[p];++p);for(var g=f&&"!"==c[f-1]||u-1>p&&"1"==c[p]?"1":"N",m=f;p>m;++m)c[m]=g;f=p-1}}for(var f=0,d=a;u>f;++f){var r=c[f];"L"==d&&"1"==r?c[f]="L":o.test(r)&&(d=r)}for(var f=0;u>f;++f)if(i.test(c[f])){for(var p=f+1;u>p&&i.test(c[p]);++p);for(var v="L"==(f?c[f-1]:a),y="L"==(u-1>p?c[p]:a),g=v||y?"L":"R",m=f;p>m;++m)c[m]=g;f=p-1}for(var b,x=[],f=0;u>f;)if(l.test(c[f])){var C=f;for(++f;u>f&&l.test(c[f]);++f);x.push({from:C,to:f,level:0})}else{var w=f,L=x.length;for(++f;u>f&&"L"!=c[f];++f);for(var m=w;f>m;)if(s.test(c[m])){m>w&&x.splice(L,0,{from:w,to:m,level:1});var k=m;for(++m;f>m&&s.test(c[m]);++m);x.splice(L,0,{from:k,to:m,level:2}),w=m}else++m;f>w&&x.splice(L,0,{from:w,to:f,level:1})}return 1==x[0].level&&(b=e.match(/^\s+/))&&(x[0].from=b[0].length,x.unshift({from:0,to:b[0].length,level:0})),1==qr(x).level&&(b=e.match(/\s+$/))&&(qr(x).to-=b[0].length,x.push({from:u-b[0].length,to:u,level:0})),x[0].level!=qr(x).level&&x.push({from:u,to:u,level:x[0].level}),x}}();return t.version="3.20.0",t}();
CodeMirror.defineMode("xml",function(t,e){function r(t,e){function r(r){return e.tokenize=r,r(t,e)}var o=t.next();if("<"==o){if(t.eat("!"))return t.eat("[")?t.match("CDATA[")?r(a("atom","]]>")):null:t.match("--")?r(a("comment","-->")):t.match("DOCTYPE",!0,!0)?(t.eatWhile(/[\w\._\-]/),r(i(1))):null;if(t.eat("?"))return t.eatWhile(/[\w\._\-]/),e.tokenize=a("meta","?>"),"meta";var l=t.eat("/");b="";for(var u;u=t.eat(/[^\s\u00a0=<>\"\'\/?]/);)b+=u;return b?(C=l?"closeTag":"openTag",e.tokenize=n,"tag"):"tag error"}if("&"==o){var f;return f=t.eat("#")?t.eat("x")?t.eatWhile(/[a-fA-F\d]/)&&t.eat(";"):t.eatWhile(/[\d]/)&&t.eat(";"):t.eatWhile(/[\w\.\-:]/)&&t.eat(";"),f?"atom":"error"}return t.eatWhile(/[^&<]/),null}function n(t,e){var n=t.next();if(">"==n||"/"==n&&t.eat(">"))return e.tokenize=r,C=">"==n?"endTag":"selfcloseTag","tag";if("="==n)return C="equals",null;if("<"==n){e.tokenize=r;var a=e.tokenize(t,e);return a?a+" error":"error"}return/[\'\"]/.test(n)?(e.tokenize=o(n),e.stringStartCol=t.column(),e.tokenize(t,e)):(t.eatWhile(/[^\s\u00a0=<>\"\']/),"word")}function o(t){var e=function(e,r){for(;!e.eol();)if(e.next()==t){r.tokenize=n;break}return"string"};return e.isInAttribute=!0,e}function a(t,e){return function(n,o){for(;!n.eol();){if(n.match(e)){o.tokenize=r;break}n.next()}return t}}function i(t){return function(e,n){for(var o;null!=(o=e.next());){if("<"==o)return n.tokenize=i(t+1),n.tokenize(e,n);if(">"==o){if(1==t){n.tokenize=r;break}return n.tokenize=i(t-1),n.tokenize(e,n)}}return"meta"}}function l(){for(var t=arguments.length-1;t>=0;t--)w.cc.push(arguments[t])}function u(){return l.apply(null,arguments),!0}function f(t,e){var r=N.doNotIndent.hasOwnProperty(t)||w.context&&w.context.noIndent;w.context={prev:w.context,tagName:t,indent:w.indented,startOfLine:e,noIndent:r}}function d(){w.context&&(w.context=w.context.prev)}function c(t){if("openTag"==t)return w.tagName=b,w.tagStart=T.column(),u(p,s(w.startOfLine));if("closeTag"==t){var e=!1;return w.context?w.context.tagName!=b&&(N.implicitlyClosed.hasOwnProperty(w.context.tagName.toLowerCase())&&d(),e=!w.context||w.context.tagName!=b):e=!0,e&&(v="error"),u(m(e))}return u()}function s(t){return function(e){var r=w.tagName;return w.tagName=w.tagStart=null,"selfcloseTag"==e||"endTag"==e&&N.autoSelfClosers.hasOwnProperty(r.toLowerCase())?(g(r.toLowerCase()),u()):"endTag"==e?(g(r.toLowerCase()),f(r,t),u()):u()}}function m(t){return function(e){return t&&(v="error"),"endTag"==e?(d(),u()):(v="error",u(arguments.callee))}}function g(t){for(var e;;){if(!w.context)return;if(e=w.context.tagName.toLowerCase(),!N.contextGrabbers.hasOwnProperty(e)||!N.contextGrabbers[e].hasOwnProperty(t))return;d()}}function p(t){return"word"==t?(v="attribute",u(h,p)):"endTag"==t||"selfcloseTag"==t?l():(v="error",u(p))}function h(t){if("equals"==t)return u(x,p);if(N.allowMissing){if("word"==t)return v="attribute",u(h,p)}else v="error";return"endTag"==t||"selfcloseTag"==t?l():u()}function x(t){return"string"==t?u(k):"word"==t&&N.allowUnquoted?(v="string",u()):(v="error","endTag"==t||"selfCloseTag"==t?l():u())}function k(t){return"string"==t?u(k):l()}var b,C,w,T,v,z=t.indentUnit,M=e.multilineTagIndentFactor||1,y=e.multilineTagIndentPastTag||!0,N=e.htmlMode?{autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0}:{autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1},I=e.alignCDATA;return{startState:function(){return{tokenize:r,cc:[],indented:0,startOfLine:!0,tagName:null,tagStart:null,context:null}},token:function(t,e){if(!e.tagName&&t.sol()&&(e.startOfLine=!0,e.indented=t.indentation()),t.eatSpace())return null;v=C=b=null;var r=e.tokenize(t,e);if(e.type=C,(r||C)&&"comment"!=r)for(w=e,T=t;;){var n=e.cc.pop()||c;if(n(C||r))break}return e.startOfLine=!1,v&&(r="error"==v?r+" error":v),r},indent:function(t,e,o){var a=t.context;if(t.tokenize.isInAttribute)return t.stringStartCol+1;if(t.tokenize!=n&&t.tokenize!=r||a&&a.noIndent)return o?o.match(/^(\s*)/)[0].length:0;if(t.tagName)return y?t.tagStart+t.tagName.length+2:t.tagStart+z*M;if(I&&/<!\[CDATA\[/.test(e))return 0;for(a&&/^<\//.test(e)&&(a=a.prev);a&&!a.startOfLine;)a=a.prev;return a?a.indent+z:0},electricChars:"/",blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:e.htmlMode?"html":"xml",helperType:e.htmlMode?"html":"xml"}}),CodeMirror.defineMIME("text/xml","xml"),CodeMirror.defineMIME("application/xml","xml"),CodeMirror.mimeModes.hasOwnProperty("text/html")||CodeMirror.defineMIME("text/html",{name:"xml",htmlMode:!0});
!function(){function e(e){for(var n=[/for\s*?\((.*?)\)/,/\"(.*?)(\"|$)/,/\'(.*?)(\'|$)/,/\/\*(.*?)(\*\/|$)/,/\/\/.*/],r=[],t=0;t<n.length;t++)for(var o=0;o<e.length;){var a=e.substr(o).match(n[t]);if(null==a)break;r.push({start:o+a.index,end:o+a.index+a[0].length}),o+=a.index+Math.max(1,a[0].length)}return r.sort(function(e,n){return e.start-n.start}),r}function n(e,n){return CodeMirror.innerMode(e.getMode(),e.getTokenAt(n).state).mode}function r(e,n,r,t){var o=e.getMode(),a=e.getLine(n);if(null==t&&(t=a.length),!o.innerMode)return[{from:r,to:t,mode:o}];var i=e.getTokenAt({line:n,ch:r}).state,s=CodeMirror.innerMode(o,i).mode,c=[],d=new CodeMirror.StringStream(a);for(d.pos=d.start=r;;){o.token(d,i);var l=CodeMirror.innerMode(o,i).mode;if(l!=s){var m=d.start;"xml"==s.name&&">"==a.charAt(d.pos-1)&&(m=d.pos),c.push({from:r,to:m,mode:s}),r=m,s=l}if(d.pos>=t)break;d.start=d.pos}return t>r&&c.push({from:r,to:t,mode:s}),c}CodeMirror.extendMode("css",{commentStart:"/*",commentEnd:"*/",wordWrapChars:[";","\\{","\\}"],autoFormatLineBreaks:function(e){return e.replace(new RegExp("(;|\\{|\\})([^\r\n])","g"),"$1\n$2")}}),CodeMirror.extendMode("javascript",{commentStart:"/*",commentEnd:"*/",wordWrapChars:[";","\\{","\\}"],autoFormatLineBreaks:function(n){var r=0,t=this.jsonMode?function(e){return e.replace(/([,{])/g,"$1\n").replace(/}/g,"\n}")}:function(e){return e.replace(/(;|\{|\})([^\r\n;])/g,"$1\n$2")},o=e(n),a="";if(null!=o){for(var i=0;i<o.length;i++)o[i].start>r&&(a+=t(n.substring(r,o[i].start)),r=o[i].start),o[i].start<=r&&o[i].end>=r&&(a+=n.substring(r,o[i].end),r=o[i].end);r<n.length&&(a+=t(n.substr(r)))}else a=t(n);return a.replace(/^\n*|\n*$/,"")}}),CodeMirror.extendMode("xml",{commentStart:"<!--",commentEnd:"-->",wordWrapChars:[">"],autoFormatLineBreaks:function(e){for(var n=e.split("\n"),r=new RegExp("(^\\s*?<|^[^<]*?)(.+)(>\\s*?$|[^>]*?$)"),t=new RegExp("<","g"),o=new RegExp("(>)([^\r\n])","g"),a=0;a<n.length;a++){var i=n[a].match(r);null!=i&&i.length>3&&(n[a]=i[1]+i[2].replace(t,"\n$&").replace(o,"$1\n$2")+i[3])}return n.join("\n")}}),CodeMirror.defineExtension("commentRange",function(e,r,t){var o=n(this,r),a=this;this.operation(function(){if(e)a.replaceRange(o.commentEnd,t),a.replaceRange(o.commentStart,r),r.line==t.line&&r.ch==t.ch&&a.setCursor(r.line,r.ch+o.commentStart.length);else{var n=a.getRange(r,t),i=n.indexOf(o.commentStart),s=n.lastIndexOf(o.commentEnd);i>-1&&s>-1&&s>i&&(n=n.substr(0,i)+n.substring(i+o.commentStart.length,s)+n.substr(s+o.commentEnd.length)),a.replaceRange(n,r,t)}})}),CodeMirror.defineExtension("autoIndentRange",function(e,n){var r=this;this.operation(function(){for(var t=e.line;t<=n.line;t++)r.indentLine(t,"smart")})}),CodeMirror.defineExtension("autoFormatRange",function(e,n){var t=this;t.operation(function(){for(var o=e.line,a=n.line;a>=o;++o){for(var i={line:o,ch:o==e.line?e.ch:0},s={line:o,ch:o==a?n.ch:null},c=r(t,o,i.ch,s.ch),d="",l=t.getRange(i,s),m=0;m<c.length;++m){var u=c.length>1?l.slice(c[m].from,c[m].to):l;d&&(d+="\n"),d+=c[m].mode.autoFormatLineBreaks?c[m].mode.autoFormatLineBreaks(u):l}if(d!=l){for(var f=0,g=d.indexOf("\n");-1!=g;g=d.indexOf("\n",g+1),++f);t.replaceRange(d,i,s),o+=f,a+=f}}for(var o=e.line+1;a>=o;++o)t.indentLine(o,"smart");t.setSelection(e,t.getCursor(!1))})})}();
/*! For license information please see summernote-lite.min.js.LICENSE.txt */
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("jquery"));else if("function"==typeof define&&define.amd)define(["jquery"],e);else{var n="object"==typeof exports?e(require("jquery")):e(t.jQuery);for(var o in n)("object"==typeof exports?exports:t)[o]=n[o]}}(window,(function(t){return function(t){var e={};function n(o){if(e[o])return e[o].exports;var i=e[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(o,i,function(e){return t[e]}.bind(null,i));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=51)}({0:function(e,n){e.exports=t},1:function(t,e,n){"use strict";var o=n(0),i=n.n(o);function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function a(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}var s=function(){function t(e,n,o,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.markup=e,this.children=n,this.options=o,this.callback=i}var e,n,o;return e=t,(n=[{key:"render",value:function(t){var e=i()(this.markup);if(this.options&&this.options.contents&&e.html(this.options.contents),this.options&&this.options.className&&e.addClass(this.options.className),this.options&&this.options.data&&i.a.each(this.options.data,(function(t,n){e.attr("data-"+t,n)})),this.options&&this.options.click&&e.on("click",this.options.click),this.children){var n=e.find(".note-children-container");this.children.forEach((function(t){t.render(n.length?n:e)}))}return this.callback&&this.callback(e,this.options),this.options&&this.options.callback&&this.options.callback(e),t&&t.append(e),e}}])&&a(e.prototype,n),o&&a(e,o),t}();e.a={create:function(t,e){return function(){var n="object"===r(arguments[1])?arguments[1]:arguments[0],o=Array.isArray(arguments[0])?arguments[0]:[];return n&&n.children&&(o=n.children),new s(t,o,n,e)}}}},2:function(t,e){(function(e){t.exports=e}).call(this,{})},3:function(t,e,n){"use strict";var o=n(0),i=n.n(o);i.a.summernote=i.a.summernote||{lang:{}},i.a.extend(i.a.summernote.lang,{"en-US":{font:{bold:"Bold",italic:"Italic",underline:"Underline",clear:"Remove Font Style",height:"Line Height",name:"Font Family",strikethrough:"Strikethrough",subscript:"Subscript",superscript:"Superscript",size:"Font Size",sizeunit:"Font Size Unit"},image:{image:"Picture",insert:"Insert Image",resizeFull:"Resize full",resizeHalf:"Resize half",resizeQuarter:"Resize quarter",resizeNone:"Original size",floatLeft:"Float Left",floatRight:"Float Right",floatNone:"Remove float",shapeRounded:"Shape: Rounded",shapeCircle:"Shape: Circle",shapeThumbnail:"Shape: Thumbnail",shapeNone:"Shape: None",dragImageHere:"Drag image or text here",dropImage:"Drop image or Text",selectFromFiles:"Select from files",maximumFileSize:"Maximum file size",maximumFileSizeError:"Maximum file size exceeded.",url:"Image URL",remove:"Remove Image",original:"Original"},video:{video:"Video",videoLink:"Video Link",insert:"Insert Video",url:"Video URL",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion or Youku)"},link:{link:"Link",insert:"Insert Link",unlink:"Unlink",edit:"Edit",textToDisplay:"Text to display",url:"To what URL should this link go?",openInNewWindow:"Open in new window",useProtocol:"Use default protocol"},table:{table:"Table",addRowAbove:"Add row above",addRowBelow:"Add row below",addColLeft:"Add column left",addColRight:"Add column right",delRow:"Delete row",delCol:"Delete column",delTable:"Delete table"},hr:{insert:"Insert Horizontal Rule"},style:{style:"Style",p:"Normal",blockquote:"Quote",pre:"Code",h1:"Header 1",h2:"Header 2",h3:"Header 3",h4:"Header 4",h5:"Header 5",h6:"Header 6"},lists:{unordered:"Unordered list",ordered:"Ordered list"},options:{help:"Help",fullscreen:"Full Screen",codeview:"Code View"},paragraph:{paragraph:"Paragraph",outdent:"Outdent",indent:"Indent",left:"Align left",center:"Align center",right:"Align right",justify:"Justify full"},color:{recent:"Recent Color",more:"More Color",background:"Background Color",foreground:"Text Color",transparent:"Transparent",setTransparent:"Set transparent",reset:"Reset",resetToDefault:"Reset to default",cpSelect:"Select"},shortcut:{shortcuts:"Keyboard shortcuts",close:"Close",textFormatting:"Text formatting",action:"Action",paragraphFormatting:"Paragraph formatting",documentStyle:"Document Style",extraKeys:"Extra keys"},help:{escape:"Escape",insertParagraph:"Insert Paragraph",undo:"Undo the last command",redo:"Redo the last command",tab:"Tab",untab:"Untab",bold:"Set a bold style",italic:"Set a italic style",underline:"Set a underline style",strikethrough:"Set a strikethrough style",removeFormat:"Clean a style",justifyLeft:"Set left align",justifyCenter:"Set center align",justifyRight:"Set right align",justifyFull:"Set full align",insertUnorderedList:"Toggle unordered list",insertOrderedList:"Toggle ordered list",outdent:"Outdent on current paragraph",indent:"Indent on current paragraph",formatPara:"Change current block's format as a paragraph(P tag)",formatH1:"Change current block's format as H1",formatH2:"Change current block's format as H2",formatH3:"Change current block's format as H3",formatH4:"Change current block's format as H4",formatH5:"Change current block's format as H5",formatH6:"Change current block's format as H6",insertHorizontalRule:"Insert horizontal rule","linkDialog.show":"Show Link Dialog"},history:{undo:"Undo",redo:"Redo"},specialChar:{specialChar:"SPECIAL CHARACTERS",select:"Select Special characters"},output:{noSelection:"No Selection Made!"}}});var r="function"==typeof define&&n(2),a=["sans-serif","serif","monospace","cursive","fantasy"];function s(t){return-1===i.a.inArray(t.toLowerCase(),a)?"'".concat(t,"'"):t}var l,c=navigator.userAgent,u=/MSIE|Trident/i.test(c);if(u){var d=/MSIE (\d+[.]\d+)/.exec(c);d&&(l=parseFloat(d[1])),(d=/Trident\/.*rv:([0-9]{1,}[.0-9]{0,})/.exec(c))&&(l=parseFloat(d[1]))}var h=/Edge\/\d+/.test(c),f="ontouchstart"in window||navigator.MaxTouchPoints>0||navigator.msMaxTouchPoints>0,p=u?"DOMCharacterDataModified DOMSubtreeModified DOMNodeInserted":"input",m={isMac:navigator.appVersion.indexOf("Mac")>-1,isMSIE:u,isEdge:h,isFF:!h&&/firefox/i.test(c),isPhantom:/PhantomJS/i.test(c),isWebkit:!h&&/webkit/i.test(c),isChrome:!h&&/chrome/i.test(c),isSafari:!h&&/safari/i.test(c)&&!/chrome/i.test(c),browserVersion:l,jqueryVersion:parseFloat(i.a.fn.jquery),isSupportAmd:r,isSupportTouch:f,isFontInstalled:function(t){var e="Comic Sans MS"===t?"Courier New":"Comic Sans MS",n=document.createElement("canvas").getContext("2d");n.font="200px '"+e+"'";var o=n.measureText("mmmmmmmmmmwwwww").width;return n.font="200px "+s(t)+', "'+e+'"',o!==n.measureText("mmmmmmmmmmwwwww").width},isW3CRangeSupport:!!document.createRange,inputEventName:p,genericFontFamilies:a,validFontName:s};var v=0;var g={eq:function(t){return function(e){return t===e}},eq2:function(t,e){return t===e},peq2:function(t){return function(e,n){return e[t]===n[t]}},ok:function(){return!0},fail:function(){return!1},self:function(t){return t},not:function(t){return function(){return!t.apply(t,arguments)}},and:function(t,e){return function(n){return t(n)&&e(n)}},invoke:function(t,e){return function(){return t[e].apply(t,arguments)}},resetUniqueId:function(){v=0},uniqueId:function(t){var e=++v+"";return t?t+e:e},rect2bnd:function(t){var e=i()(document);return{top:t.top+e.scrollTop(),left:t.left+e.scrollLeft(),width:t.right-t.left,height:t.bottom-t.top}},invertObject:function(t){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[t[n]]=n);return e},namespaceToCamel:function(t,e){return(e=e||"")+t.split(".").map((function(t){return t.substring(0,1).toUpperCase()+t.substring(1)})).join("")},debounce:function(t,e,n){var o;return function(){var i=this,r=arguments,a=function(){o=null,n||t.apply(i,r)},s=n&&!o;clearTimeout(o),o=setTimeout(a,e),s&&t.apply(i,r)}},isValidUrl:function(t){return/[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/gi.test(t)}};function b(t){return t[0]}function k(t){return t[t.length-1]}function y(t){return t.slice(1)}function w(t,e){if(t&&t.length&&e){if(t.indexOf)return-1!==t.indexOf(e);if(t.contains)return t.contains(e)}return!1}var C={head:b,last:k,initial:function(t){return t.slice(0,t.length-1)},tail:y,prev:function(t,e){if(t&&t.length&&e){var n=t.indexOf(e);return-1===n?null:t[n-1]}return null},next:function(t,e){if(t&&t.length&&e){var n=t.indexOf(e);return-1===n?null:t[n+1]}return null},find:function(t,e){for(var n=0,o=t.length;n<o;n++){var i=t[n];if(e(i))return i}},contains:w,all:function(t,e){for(var n=0,o=t.length;n<o;n++)if(!e(t[n]))return!1;return!0},sum:function(t,e){return e=e||g.self,t.reduce((function(t,n){return t+e(n)}),0)},from:function(t){for(var e=[],n=t.length,o=-1;++o<n;)e[o]=t[o];return e},isEmpty:function(t){return!t||!t.length},clusterBy:function(t,e){return t.length?y(t).reduce((function(t,n){var o=k(t);return e(k(o),n)?o[o.length]=n:t[t.length]=[n],t}),[[b(t)]]):[]},compact:function(t){for(var e=[],n=0,o=t.length;n<o;n++)t[n]&&e.push(t[n]);return e},unique:function(t){for(var e=[],n=0,o=t.length;n<o;n++)w(e,t[n])||e.push(t[n]);return e}},x=String.fromCharCode(160);function S(t){return t&&i()(t).hasClass("note-editable")}function T(t){return t=t.toUpperCase(),function(e){return e&&e.nodeName.toUpperCase()===t}}function E(t){return t&&3===t.nodeType}function $(t){return t&&/^BR|^IMG|^HR|^IFRAME|^BUTTON|^INPUT|^AUDIO|^VIDEO|^EMBED/.test(t.nodeName.toUpperCase())}function N(t){return!S(t)&&(t&&/^DIV|^P|^LI|^H[1-7]/.test(t.nodeName.toUpperCase()))}var I=T("PRE"),P=T("LI");var R=T("TABLE"),L=T("DATA");function A(t){return!(z(t)||F(t)||D(t)||N(t)||R(t)||B(t)||L(t))}function F(t){return t&&/^UL|^OL/.test(t.nodeName.toUpperCase())}var D=T("HR");function H(t){return t&&/^TD|^TH/.test(t.nodeName.toUpperCase())}var B=T("BLOCKQUOTE");function z(t){return H(t)||B(t)||S(t)}var M=T("A");var O=T("BODY");var j=m.isMSIE&&m.browserVersion<11?"&nbsp;":"<br>";function U(t){return E(t)?t.nodeValue.length:t?t.childNodes.length:0}function W(t){var e=U(t);return 0===e||(!E(t)&&1===e&&t.innerHTML===j||!(!C.all(t.childNodes,E)||""!==t.innerHTML))}function K(t){$(t)||U(t)||(t.innerHTML=j)}function V(t,e){for(;t;){if(e(t))return t;if(S(t))break;t=t.parentNode}return null}function q(t,e){e=e||g.fail;var n=[];return V(t,(function(t){return S(t)||n.push(t),e(t)})),n}function _(t,e){e=e||g.fail;for(var n=[];t&&!e(t);)n.push(t),t=t.nextSibling;return n}function G(t,e){var n=e.nextSibling,o=e.parentNode;return n?o.insertBefore(t,n):o.appendChild(t),t}function Y(t,e){return i.a.each(e,(function(e,n){t.appendChild(n)})),t}function Z(t){return 0===t.offset}function X(t){return t.offset===U(t.node)}function Q(t){return Z(t)||X(t)}function J(t,e){for(;t&&t!==e;){if(0!==et(t))return!1;t=t.parentNode}return!0}function tt(t,e){if(!e)return!1;for(;t&&t!==e;){if(et(t)!==U(t.parentNode)-1)return!1;t=t.parentNode}return!0}function et(t){for(var e=0;t=t.previousSibling;)e+=1;return e}function nt(t){return!!(t&&t.childNodes&&t.childNodes.length)}function ot(t,e){var n,o;if(0===t.offset){if(S(t.node))return null;n=t.node.parentNode,o=et(t.node)}else nt(t.node)?o=U(n=t.node.childNodes[t.offset-1]):(n=t.node,o=e?0:t.offset-1);return{node:n,offset:o}}function it(t,e){var n,o;if(U(t.node)===t.offset){if(S(t.node))return null;var i=at(t.node);i?(n=i,o=0):(n=t.node.parentNode,o=et(t.node)+1)}else nt(t.node)?(n=t.node.childNodes[t.offset],o=0):(n=t.node,o=e?U(t.node):t.offset+1);return{node:n,offset:o}}function rt(t,e){var n,o;if(W(t.node))return{node:n=t.node.nextSibling,offset:o=0};if(U(t.node)===t.offset){if(S(t.node))return null;var i=at(t.node);i?(n=i,o=0):(n=t.node.parentNode,o=et(t.node)+1),S(n)&&(n=t.node.nextSibling,o=0)}else if(nt(t.node)){if(o=0,W(n=t.node.childNodes[t.offset]))return null}else if(n=t.node,o=e?U(t.node):t.offset+1,W(n))return null;return{node:n,offset:o}}function at(t){if(t.nextSibling&&t.parent===t.nextSibling.parent)return E(t.nextSibling)?t.nextSibling:at(t.nextSibling)}function st(t,e){return t.node===e.node&&t.offset===e.offset}function lt(t,e){var n=e&&e.isSkipPaddingBlankHTML,o=e&&e.isNotSplitEdgePoint,i=e&&e.isDiscardEmptySplits;if(i&&(n=!0),Q(t)&&(E(t.node)||o)){if(Z(t))return t.node;if(X(t))return t.node.nextSibling}if(E(t.node))return t.node.splitText(t.offset);var r=t.node.childNodes[t.offset],a=G(t.node.cloneNode(!1),t.node);return Y(a,_(r)),n||(K(t.node),K(a)),i&&(W(t.node)&&dt(t.node),W(a))?(dt(a),t.node.nextSibling):a}function ct(t,e,n){var o=q(e.node,g.eq(t));return o.length?1===o.length?lt(e,n):o.reduce((function(t,o){return t===e.node&&(t=lt(e,n)),lt({node:o,offset:t?et(t):U(o)},n)})):null}function ut(t){return document.createElement(t)}function dt(t,e){if(t&&t.parentNode){if(t.removeNode)return t.removeNode(e);var n=t.parentNode;if(!e){for(var o=[],i=0,r=t.childNodes.length;i<r;i++)o.push(t.childNodes[i]);for(var a=0,s=o.length;a<s;a++)n.insertBefore(o[a],t)}n.removeChild(t)}}var ht=T("TEXTAREA");function ft(t,e){var n=ht(t[0])?t.val():t.html();return e?n.replace(/[\n\r]/g,""):n}var pt={NBSP_CHAR:x,ZERO_WIDTH_NBSP_CHAR:"\ufeff",blank:j,emptyPara:"<p>".concat(j,"</p>"),makePredByNodeName:T,isEditable:S,isControlSizing:function(t){return t&&i()(t).hasClass("note-control-sizing")},isText:E,isElement:function(t){return t&&1===t.nodeType},isVoid:$,isPara:N,isPurePara:function(t){return N(t)&&!P(t)},isHeading:function(t){return t&&/^H[1-7]/.test(t.nodeName.toUpperCase())},isInline:A,isBlock:g.not(A),isBodyInline:function(t){return A(t)&&!V(t,N)},isBody:O,isParaInline:function(t){return A(t)&&!!V(t,N)},isPre:I,isList:F,isTable:R,isData:L,isCell:H,isBlockquote:B,isBodyContainer:z,isAnchor:M,isDiv:T("DIV"),isLi:P,isBR:T("BR"),isSpan:T("SPAN"),isB:T("B"),isU:T("U"),isS:T("S"),isI:T("I"),isImg:T("IMG"),isTextarea:ht,deepestChildIsEmpty:function(t){do{if(null===t.firstElementChild||""===t.firstElementChild.innerHTML)break}while(t=t.firstElementChild);return W(t)},isEmpty:W,isEmptyAnchor:g.and(M,W),isClosestSibling:function(t,e){return t.nextSibling===e||t.previousSibling===e},withClosestSiblings:function(t,e){e=e||g.ok;var n=[];return t.previousSibling&&e(t.previousSibling)&&n.push(t.previousSibling),n.push(t),t.nextSibling&&e(t.nextSibling)&&n.push(t.nextSibling),n},nodeLength:U,isLeftEdgePoint:Z,isRightEdgePoint:X,isEdgePoint:Q,isLeftEdgeOf:J,isRightEdgeOf:tt,isLeftEdgePointOf:function(t,e){return Z(t)&&J(t.node,e)},isRightEdgePointOf:function(t,e){return X(t)&&tt(t.node,e)},prevPoint:ot,nextPoint:it,nextPointWithEmptyNode:rt,isSamePoint:st,isVisiblePoint:function(t){if(E(t.node)||!nt(t.node)||W(t.node))return!0;var e=t.node.childNodes[t.offset-1],n=t.node.childNodes[t.offset];return!(e&&!$(e)||n&&!$(n))},prevPointUntil:function(t,e){for(;t;){if(e(t))return t;t=ot(t)}return null},nextPointUntil:function(t,e){for(;t;){if(e(t))return t;t=it(t)}return null},isCharPoint:function(t){if(!E(t.node))return!1;var e=t.node.nodeValue.charAt(t.offset-1);return e&&" "!==e&&e!==x},isSpacePoint:function(t){if(!E(t.node))return!1;var e=t.node.nodeValue.charAt(t.offset-1);return" "===e||e===x},walkPoint:function(t,e,n,o){for(var i=t;i&&(n(i),!st(i,e));){i=rt(i,o&&t.node!==i.node&&e.node!==i.node)}},ancestor:V,singleChildAncestor:function(t,e){for(t=t.parentNode;t&&1===U(t);){if(e(t))return t;if(S(t))break;t=t.parentNode}return null},listAncestor:q,lastAncestor:function(t,e){var n=q(t);return C.last(n.filter(e))},listNext:_,listPrev:function(t,e){e=e||g.fail;for(var n=[];t&&!e(t);)n.push(t),t=t.previousSibling;return n},listDescendant:function(t,e){var n=[];return e=e||g.ok,function o(i){t!==i&&e(i)&&n.push(i);for(var r=0,a=i.childNodes.length;r<a;r++)o(i.childNodes[r])}(t),n},commonAncestor:function(t,e){for(var n=q(t),o=e;o;o=o.parentNode)if(n.indexOf(o)>-1)return o;return null},wrap:function(t,e){var n=t.parentNode,o=i()("<"+e+">")[0];return n.insertBefore(o,t),o.appendChild(t),o},insertAfter:G,appendChildNodes:Y,position:et,hasChildren:nt,makeOffsetPath:function(t,e){return q(e,g.eq(t)).map(et).reverse()},fromOffsetPath:function(t,e){for(var n=t,o=0,i=e.length;o<i;o++)n=n.childNodes.length<=e[o]?n.childNodes[n.childNodes.length-1]:n.childNodes[e[o]];return n},splitTree:ct,splitPoint:function(t,e){var n,o,i=e?N:z,r=q(t.node,i),a=C.last(r)||t.node;i(a)?(n=r[r.length-2],o=a):o=(n=a).parentNode;var s=n&&ct(n,t,{isSkipPaddingBlankHTML:e,isNotSplitEdgePoint:e});return s||o!==t.node||(s=t.node.childNodes[t.offset]),{rightNode:s,container:o}},create:ut,createText:function(t){return document.createTextNode(t)},remove:dt,removeWhile:function(t,e){for(;t&&!S(t)&&e(t);){var n=t.parentNode;dt(t),t=n}},replace:function(t,e){if(t.nodeName.toUpperCase()===e.toUpperCase())return t;var n=ut(e);return t.style.cssText&&(n.style.cssText=t.style.cssText),Y(n,C.from(t.childNodes)),G(n,t),dt(t),n},html:function(t,e){var n=ft(t);if(e){n=(n=n.replace(/<(\/?)(\b(?!!)[^>\s]*)(.*?)(\s*\/?>)/g,(function(t,e,n){n=n.toUpperCase();var o=/^DIV|^TD|^TH|^P|^LI|^H[1-7]/.test(n)&&!!e,i=/^BLOCKQUOTE|^TABLE|^TBODY|^TR|^HR|^UL|^OL/.test(n);return t+(o||i?"\n":"")}))).trim()}return n},value:ft,posFromPlaceholder:function(t){var e=i()(t),n=e.offset(),o=e.outerHeight(!0);return{left:n.left,top:n.top+o}},attachEvents:function(t,e){Object.keys(e).forEach((function(n){t.on(n,e[n])}))},detachEvents:function(t,e){Object.keys(e).forEach((function(n){t.off(n,e[n])}))},isCustomStyleTag:function(t){return t&&!E(t)&&C.contains(t.classList,"note-styletag")}};function mt(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}var vt=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.$note=e,this.memos={},this.modules={},this.layoutInfo={},this.options=i.a.extend(!0,{},n),i.a.summernote.ui=i.a.summernote.ui_template(this.options),this.ui=i.a.summernote.ui,this.initialize()}var e,n,o;return e=t,(n=[{key:"initialize",value:function(){return this.layoutInfo=this.ui.createLayout(this.$note),this._initialize(),this.$note.hide(),this}},{key:"destroy",value:function(){this._destroy(),this.$note.removeData("summernote"),this.ui.removeLayout(this.$note,this.layoutInfo)}},{key:"reset",value:function(){var t=this.isDisabled();this.code(pt.emptyPara),this._destroy(),this._initialize(),t&&this.disable()}},{key:"_initialize",value:function(){var t=this;this.options.id=g.uniqueId(i.a.now()),this.options.container=this.options.container||this.layoutInfo.editor;var e=i.a.extend({},this.options.buttons);Object.keys(e).forEach((function(n){t.memo("button."+n,e[n])}));var n=i.a.extend({},this.options.modules,i.a.summernote.plugins||{});Object.keys(n).forEach((function(e){t.module(e,n[e],!0)})),Object.keys(this.modules).forEach((function(e){t.initializeModule(e)}))}},{key:"_destroy",value:function(){var t=this;Object.keys(this.modules).reverse().forEach((function(e){t.removeModule(e)})),Object.keys(this.memos).forEach((function(e){t.removeMemo(e)})),this.triggerEvent("destroy",this)}},{key:"code",value:function(t){var e=this.invoke("codeview.isActivated");if(void 0===t)return this.invoke("codeview.sync"),e?this.layoutInfo.codable.val():this.layoutInfo.editable.html();e?this.invoke("codeview.sync",t):this.layoutInfo.editable.html(t),this.$note.val(t),this.triggerEvent("change",t,this.layoutInfo.editable)}},{key:"isDisabled",value:function(){return"false"===this.layoutInfo.editable.attr("contenteditable")}},{key:"enable",value:function(){this.layoutInfo.editable.attr("contenteditable",!0),this.invoke("toolbar.activate",!0),this.triggerEvent("disable",!1),this.options.editing=!0}},{key:"disable",value:function(){this.invoke("codeview.isActivated")&&this.invoke("codeview.deactivate"),this.layoutInfo.editable.attr("contenteditable",!1),this.options.editing=!1,this.invoke("toolbar.deactivate",!0),this.triggerEvent("disable",!0)}},{key:"triggerEvent",value:function(){var t=C.head(arguments),e=C.tail(C.from(arguments)),n=this.options.callbacks[g.namespaceToCamel(t,"on")];n&&n.apply(this.$note[0],e),this.$note.trigger("summernote."+t,e)}},{key:"initializeModule",value:function(t){var e=this.modules[t];e.shouldInitialize=e.shouldInitialize||g.ok,e.shouldInitialize()&&(e.initialize&&e.initialize(),e.events&&pt.attachEvents(this.$note,e.events))}},{key:"module",value:function(t,e,n){if(1===arguments.length)return this.modules[t];this.modules[t]=new e(this),n||this.initializeModule(t)}},{key:"removeModule",value:function(t){var e=this.modules[t];e.shouldInitialize()&&(e.events&&pt.detachEvents(this.$note,e.events),e.destroy&&e.destroy()),delete this.modules[t]}},{key:"memo",value:function(t,e){if(1===arguments.length)return this.memos[t];this.memos[t]=e}},{key:"removeMemo",value:function(t){this.memos[t]&&this.memos[t].destroy&&this.memos[t].destroy(),delete this.memos[t]}},{key:"createInvokeHandlerAndUpdateState",value:function(t,e){var n=this;return function(o){n.createInvokeHandler(t,e)(o),n.invoke("buttons.updateCurrentStyle")}}},{key:"createInvokeHandler",value:function(t,e){var n=this;return function(o){o.preventDefault();var r=i()(o.target);n.invoke(t,e||r.closest("[data-value]").data("value"),r)}}},{key:"invoke",value:function(){var t=C.head(arguments),e=C.tail(C.from(arguments)),n=t.split("."),o=n.length>1,i=o&&C.head(n),r=o?C.last(n):C.head(n),a=this.modules[i||"editor"];return!i&&this[r]?this[r].apply(this,e):a&&a[r]&&a.shouldInitialize()?a[r].apply(a,e):void 0}}])&&mt(e.prototype,n),o&&mt(e,o),t}();function gt(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function bt(t,e){var n,o,i=t.parentElement(),r=document.body.createTextRange(),a=C.from(i.childNodes);for(n=0;n<a.length;n++)if(!pt.isText(a[n])){if(r.moveToElementText(a[n]),r.compareEndPoints("StartToStart",t)>=0)break;o=a[n]}if(0!==n&&pt.isText(a[n-1])){var s=document.body.createTextRange(),l=null;s.moveToElementText(o||i),s.collapse(!o),l=o?o.nextSibling:i.firstChild;var c=t.duplicate();c.setEndPoint("StartToStart",s);for(var u=c.text.replace(/[\r\n]/g,"").length;u>l.nodeValue.length&&l.nextSibling;)u-=l.nodeValue.length,l=l.nextSibling;l.nodeValue;e&&l.nextSibling&&pt.isText(l.nextSibling)&&u===l.nodeValue.length&&(u-=l.nodeValue.length,l=l.nextSibling),i=l,n=u}return{cont:i,offset:n}}function kt(t){var e=document.body.createTextRange(),n=function t(e,n){var o,i;if(pt.isText(e)){var r=pt.listPrev(e,g.not(pt.isText)),a=C.last(r).previousSibling;o=a||e.parentNode,n+=C.sum(C.tail(r),pt.nodeLength),i=!a}else{if(o=e.childNodes[n]||e,pt.isText(o))return t(o,0);n=0,i=!1}return{node:o,collapseToStart:i,offset:n}}(t.node,t.offset);return e.moveToElementText(n.node),e.collapse(n.collapseToStart),e.moveStart("character",n.offset),e}i.a.fn.extend({summernote:function(){var t=i.a.type(C.head(arguments)),e="string"===t,n="object"===t,o=i.a.extend({},i.a.summernote.options,n?C.head(arguments):{});o.langInfo=i.a.extend(!0,{},i.a.summernote.lang["en-US"],i.a.summernote.lang[o.lang]),o.icons=i.a.extend(!0,{},i.a.summernote.options.icons,o.icons),o.tooltip="auto"===o.tooltip?!m.isSupportTouch:o.tooltip,this.each((function(t,e){var n=i()(e);if(!n.data("summernote")){var r=new vt(n,o);n.data("summernote",r),n.data("summernote").triggerEvent("init",r.layoutInfo)}}));var r=this.first();if(r.length){var a=r.data("summernote");if(e)return a.invoke.apply(a,C.from(arguments));o.focus&&a.invoke("editor.focus")}return this}});var yt=function(){function t(e,n,o,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.sc=e,this.so=n,this.ec=o,this.eo=i,this.isOnEditable=this.makeIsOn(pt.isEditable),this.isOnList=this.makeIsOn(pt.isList),this.isOnAnchor=this.makeIsOn(pt.isAnchor),this.isOnCell=this.makeIsOn(pt.isCell),this.isOnData=this.makeIsOn(pt.isData)}var e,n,o;return e=t,(n=[{key:"nativeRange",value:function(){if(m.isW3CRangeSupport){var t=document.createRange();return t.setStart(this.sc,this.so),t.setEnd(this.ec,this.eo),t}var e=kt({node:this.sc,offset:this.so});return e.setEndPoint("EndToEnd",kt({node:this.ec,offset:this.eo})),e}},{key:"getPoints",value:function(){return{sc:this.sc,so:this.so,ec:this.ec,eo:this.eo}}},{key:"getStartPoint",value:function(){return{node:this.sc,offset:this.so}}},{key:"getEndPoint",value:function(){return{node:this.ec,offset:this.eo}}},{key:"select",value:function(){var t=this.nativeRange();if(m.isW3CRangeSupport){var e=document.getSelection();e.rangeCount>0&&e.removeAllRanges(),e.addRange(t)}else t.select();return this}},{key:"scrollIntoView",value:function(t){var e=i()(t).height();return t.scrollTop+e<this.sc.offsetTop&&(t.scrollTop+=Math.abs(t.scrollTop+e-this.sc.offsetTop)),this}},{key:"normalize",value:function(){var e=function(t,e){if(!t)return t;if(pt.isVisiblePoint(t)&&(!pt.isEdgePoint(t)||pt.isRightEdgePoint(t)&&!e||pt.isLeftEdgePoint(t)&&e||pt.isRightEdgePoint(t)&&e&&pt.isVoid(t.node.nextSibling)||pt.isLeftEdgePoint(t)&&!e&&pt.isVoid(t.node.previousSibling)||pt.isBlock(t.node)&&pt.isEmpty(t.node)))return t;var n=pt.ancestor(t.node,pt.isBlock),o=!1;if(!o){var i=pt.prevPoint(t)||{node:null};o=(pt.isLeftEdgePointOf(t,n)||pt.isVoid(i.node))&&!e}var r=!1;if(!r){var a=pt.nextPoint(t)||{node:null};r=(pt.isRightEdgePointOf(t,n)||pt.isVoid(a.node))&&e}if(o||r){if(pt.isVisiblePoint(t))return t;e=!e}return(e?pt.nextPointUntil(pt.nextPoint(t),pt.isVisiblePoint):pt.prevPointUntil(pt.prevPoint(t),pt.isVisiblePoint))||t},n=e(this.getEndPoint(),!1),o=this.isCollapsed()?n:e(this.getStartPoint(),!0);return new t(o.node,o.offset,n.node,n.offset)}},{key:"nodes",value:function(t,e){t=t||g.ok;var n=e&&e.includeAncestor,o=e&&e.fullyContains,i=this.getStartPoint(),r=this.getEndPoint(),a=[],s=[];return pt.walkPoint(i,r,(function(e){var i;pt.isEditable(e.node)||(o?(pt.isLeftEdgePoint(e)&&s.push(e.node),pt.isRightEdgePoint(e)&&C.contains(s,e.node)&&(i=e.node)):i=n?pt.ancestor(e.node,t):e.node,i&&t(i)&&a.push(i))}),!0),C.unique(a)}},{key:"commonAncestor",value:function(){return pt.commonAncestor(this.sc,this.ec)}},{key:"expand",value:function(e){var n=pt.ancestor(this.sc,e),o=pt.ancestor(this.ec,e);if(!n&&!o)return new t(this.sc,this.so,this.ec,this.eo);var i=this.getPoints();return n&&(i.sc=n,i.so=0),o&&(i.ec=o,i.eo=pt.nodeLength(o)),new t(i.sc,i.so,i.ec,i.eo)}},{key:"collapse",value:function(e){return e?new t(this.sc,this.so,this.sc,this.so):new t(this.ec,this.eo,this.ec,this.eo)}},{key:"splitText",value:function(){var e=this.sc===this.ec,n=this.getPoints();return pt.isText(this.ec)&&!pt.isEdgePoint(this.getEndPoint())&&this.ec.splitText(this.eo),pt.isText(this.sc)&&!pt.isEdgePoint(this.getStartPoint())&&(n.sc=this.sc.splitText(this.so),n.so=0,e&&(n.ec=n.sc,n.eo=this.eo-this.so)),new t(n.sc,n.so,n.ec,n.eo)}},{key:"deleteContents",value:function(){if(this.isCollapsed())return this;var e=this.splitText(),n=e.nodes(null,{fullyContains:!0}),o=pt.prevPointUntil(e.getStartPoint(),(function(t){return!C.contains(n,t.node)})),r=[];return i.a.each(n,(function(t,e){var n=e.parentNode;o.node!==n&&1===pt.nodeLength(n)&&r.push(n),pt.remove(e,!1)})),i.a.each(r,(function(t,e){pt.remove(e,!1)})),new t(o.node,o.offset,o.node,o.offset).normalize()}},{key:"makeIsOn",value:function(t){return function(){var e=pt.ancestor(this.sc,t);return!!e&&e===pt.ancestor(this.ec,t)}}},{key:"isLeftEdgeOf",value:function(t){if(!pt.isLeftEdgePoint(this.getStartPoint()))return!1;var e=pt.ancestor(this.sc,t);return e&&pt.isLeftEdgeOf(this.sc,e)}},{key:"isCollapsed",value:function(){return this.sc===this.ec&&this.so===this.eo}},{key:"wrapBodyInlineWithPara",value:function(){if(pt.isBodyContainer(this.sc)&&pt.isEmpty(this.sc))return this.sc.innerHTML=pt.emptyPara,new t(this.sc.firstChild,0,this.sc.firstChild,0);var e,n=this.normalize();if(pt.isParaInline(this.sc)||pt.isPara(this.sc))return n;if(pt.isInline(n.sc)){var o=pt.listAncestor(n.sc,g.not(pt.isInline));e=C.last(o),pt.isInline(e)||(e=o[o.length-2]||n.sc.childNodes[n.so])}else e=n.sc.childNodes[n.so>0?n.so-1:0];if(e){var i=pt.listPrev(e,pt.isParaInline).reverse();if((i=i.concat(pt.listNext(e.nextSibling,pt.isParaInline))).length){var r=pt.wrap(C.head(i),"p");pt.appendChildNodes(r,C.tail(i))}}return this.normalize()}},{key:"insertNode",value:function(t){var e=this;(pt.isText(t)||pt.isInline(t))&&(e=this.wrapBodyInlineWithPara().deleteContents());var n=pt.splitPoint(e.getStartPoint(),pt.isInline(t));return n.rightNode?(n.rightNode.parentNode.insertBefore(t,n.rightNode),pt.isEmpty(n.rightNode)&&pt.isPara(t)&&n.rightNode.parentNode.removeChild(n.rightNode)):n.container.appendChild(t),t}},{key:"pasteHTML",value:function(t){t=i.a.trim(t);var e=i()("<div></div>").html(t)[0],n=C.from(e.childNodes),o=this,r=!1;return o.so>=0&&(n=n.reverse(),r=!0),n=n.map((function(t){return o.insertNode(t)})),r&&(n=n.reverse()),n}},{key:"toString",value:function(){var t=this.nativeRange();return m.isW3CRangeSupport?t.toString():t.text}},{key:"getWordRange",value:function(e){var n=this.getEndPoint();if(!pt.isCharPoint(n))return this;var o=pt.prevPointUntil(n,(function(t){return!pt.isCharPoint(t)}));return e&&(n=pt.nextPointUntil(n,(function(t){return!pt.isCharPoint(t)}))),new t(o.node,o.offset,n.node,n.offset)}},{key:"getWordsRange",value:function(e){var n=this.getEndPoint(),o=function(t){return!pt.isCharPoint(t)&&!pt.isSpacePoint(t)};if(o(n))return this;var i=pt.prevPointUntil(n,o);return e&&(n=pt.nextPointUntil(n,o)),new t(i.node,i.offset,n.node,n.offset)}},{key:"getWordsMatchRange",value:function(e){var n=this.getEndPoint(),o=pt.prevPointUntil(n,(function(o){if(!pt.isCharPoint(o)&&!pt.isSpacePoint(o))return!0;var i=new t(o.node,o.offset,n.node,n.offset),r=e.exec(i.toString());return r&&0===r.index})),i=new t(o.node,o.offset,n.node,n.offset),r=i.toString(),a=e.exec(r);return a&&a[0].length===r.length?i:null}},{key:"bookmark",value:function(t){return{s:{path:pt.makeOffsetPath(t,this.sc),offset:this.so},e:{path:pt.makeOffsetPath(t,this.ec),offset:this.eo}}}},{key:"paraBookmark",value:function(t){return{s:{path:C.tail(pt.makeOffsetPath(C.head(t),this.sc)),offset:this.so},e:{path:C.tail(pt.makeOffsetPath(C.last(t),this.ec)),offset:this.eo}}}},{key:"getClientRects",value:function(){return this.nativeRange().getClientRects()}}])&&gt(e.prototype,n),o&&gt(e,o),t}(),wt={create:function(t,e,n,o){if(4===arguments.length)return new yt(t,e,n,o);if(2===arguments.length)return new yt(t,e,n=t,o=e);var i=this.createFromSelection();if(!i&&1===arguments.length){var r=arguments[0];return pt.isEditable(r)&&(r=r.lastChild),this.createFromBodyElement(r,pt.emptyPara===arguments[0].innerHTML)}return i},createFromBodyElement:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.createFromNode(t);return n.collapse(e)},createFromSelection:function(){var t,e,n,o;if(m.isW3CRangeSupport){var i=document.getSelection();if(!i||0===i.rangeCount)return null;if(pt.isBody(i.anchorNode))return null;var r=i.getRangeAt(0);t=r.startContainer,e=r.startOffset,n=r.endContainer,o=r.endOffset}else{var a=document.selection.createRange(),s=a.duplicate();s.collapse(!1);var l=a;l.collapse(!0);var c=bt(l,!0),u=bt(s,!1);pt.isText(c.node)&&pt.isLeftEdgePoint(c)&&pt.isTextNode(u.node)&&pt.isRightEdgePoint(u)&&u.node.nextSibling===c.node&&(c=u),t=c.cont,e=c.offset,n=u.cont,o=u.offset}return new yt(t,e,n,o)},createFromNode:function(t){var e=t,n=0,o=t,i=pt.nodeLength(o);return pt.isVoid(e)&&(n=pt.listPrev(e).length-1,e=e.parentNode),pt.isBR(o)?(i=pt.listPrev(o).length-1,o=o.parentNode):pt.isVoid(o)&&(i=pt.listPrev(o).length,o=o.parentNode),this.create(e,n,o,i)},createFromNodeBefore:function(t){return this.createFromNode(t).collapse(!0)},createFromNodeAfter:function(t){return this.createFromNode(t).collapse()},createFromBookmark:function(t,e){var n=pt.fromOffsetPath(t,e.s.path),o=e.s.offset,i=pt.fromOffsetPath(t,e.e.path),r=e.e.offset;return new yt(n,o,i,r)},createFromParaBookmark:function(t,e){var n=t.s.offset,o=t.e.offset,i=pt.fromOffsetPath(C.head(e),t.s.path),r=pt.fromOffsetPath(C.last(e),t.e.path);return new yt(i,n,r,o)}},Ct={BACKSPACE:8,TAB:9,ENTER:13,ESCAPE:27,SPACE:32,DELETE:46,LEFT:37,UP:38,RIGHT:39,DOWN:40,NUM0:48,NUM1:49,NUM2:50,NUM3:51,NUM4:52,NUM5:53,NUM6:54,NUM7:55,NUM8:56,B:66,E:69,I:73,J:74,K:75,L:76,R:82,S:83,U:85,V:86,Y:89,Z:90,SLASH:191,LEFTBRACKET:219,BACKSLASH:220,RIGHTBRACKET:221,HOME:36,END:35,PAGEUP:33,PAGEDOWN:34},xt={isEdit:function(t){return C.contains([Ct.BACKSPACE,Ct.TAB,Ct.ENTER,Ct.SPACE,Ct.DELETE],t)},isMove:function(t){return C.contains([Ct.LEFT,Ct.UP,Ct.RIGHT,Ct.DOWN],t)},isNavigation:function(t){return C.contains([Ct.HOME,Ct.END,Ct.PAGEUP,Ct.PAGEDOWN],t)},nameFromCode:g.invertObject(Ct),code:Ct};function St(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}var Tt=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.stack=[],this.stackOffset=-1,this.context=e,this.$editable=e.layoutInfo.editable,this.editable=this.$editable[0]}var e,n,o;return e=t,(n=[{key:"makeSnapshot",value:function(){var t=wt.create(this.editable);return{contents:this.$editable.html(),bookmark:t&&t.isOnEditable()?t.bookmark(this.editable):{s:{path:[],offset:0},e:{path:[],offset:0}}}}},{key:"applySnapshot",value:function(t){null!==t.contents&&this.$editable.html(t.contents),null!==t.bookmark&&wt.createFromBookmark(this.editable,t.bookmark).select()}},{key:"rewind",value:function(){this.$editable.html()!==this.stack[this.stackOffset].contents&&this.recordUndo(),this.stackOffset=0,this.applySnapshot(this.stack[this.stackOffset])}},{key:"commit",value:function(){this.stack=[],this.stackOffset=-1,this.recordUndo()}},{key:"reset",value:function(){this.stack=[],this.stackOffset=-1,this.$editable.html(""),this.recordUndo()}},{key:"undo",value:function(){this.$editable.html()!==this.stack[this.stackOffset].contents&&this.recordUndo(),this.stackOffset>0&&(this.stackOffset--,this.applySnapshot(this.stack[this.stackOffset]))}},{key:"redo",value:function(){this.stack.length-1>this.stackOffset&&(this.stackOffset++,this.applySnapshot(this.stack[this.stackOffset]))}},{key:"recordUndo",value:function(){this.stackOffset++,this.stack.length>this.stackOffset&&(this.stack=this.stack.slice(0,this.stackOffset)),this.stack.push(this.makeSnapshot()),this.stack.length>this.context.options.historyLimit&&(this.stack.shift(),this.stackOffset-=1)}}])&&St(e.prototype,n),o&&St(e,o),t}();function Et(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}var $t=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,n,o;return e=t,(n=[{key:"jQueryCSS",value:function(t,e){if(m.jqueryVersion<1.9){var n={};return i.a.each(e,(function(e,o){n[o]=t.css(o)})),n}return t.css(e)}},{key:"fromNode",value:function(t){var e=this.jQueryCSS(t,["font-family","font-size","text-align","list-style-type","line-height"])||{},n=t[0].style.fontSize||e["font-size"];return e["font-size"]=parseInt(n,10),e["font-size-unit"]=n.match(/[a-z%]+$/),e}},{key:"stylePara",value:function(t,e){i.a.each(t.nodes(pt.isPara,{includeAncestor:!0}),(function(t,n){i()(n).css(e)}))}},{key:"styleNodes",value:function(t,e){t=t.splitText();var n=e&&e.nodeName||"SPAN",o=!(!e||!e.expandClosestSibling),r=!(!e||!e.onlyPartialContains);if(t.isCollapsed())return[t.insertNode(pt.create(n))];var a=pt.makePredByNodeName(n),s=t.nodes(pt.isText,{fullyContains:!0}).map((function(t){return pt.singleChildAncestor(t,a)||pt.wrap(t,n)}));if(o){if(r){var l=t.nodes();a=g.and(a,(function(t){return C.contains(l,t)}))}return s.map((function(t){var e=pt.withClosestSiblings(t,a),n=C.head(e),o=C.tail(e);return i.a.each(o,(function(t,e){pt.appendChildNodes(n,e.childNodes),pt.remove(e)})),C.head(e)}))}return s}},{key:"current",value:function(t){var e=i()(pt.isElement(t.sc)?t.sc:t.sc.parentNode),n=this.fromNode(e);try{n=i.a.extend(n,{"font-bold":document.queryCommandState("bold")?"bold":"normal","font-italic":document.queryCommandState("italic")?"italic":"normal","font-underline":document.queryCommandState("underline")?"underline":"normal","font-subscript":document.queryCommandState("subscript")?"subscript":"normal","font-superscript":document.queryCommandState("superscript")?"superscript":"normal","font-strikethrough":document.queryCommandState("strikethrough")?"strikethrough":"normal","font-family":document.queryCommandValue("fontname")||n["font-family"]})}catch(t){}if(t.isOnList()){var o=["circle","disc","disc-leading-zero","square"].indexOf(n["list-style-type"])>-1;n["list-style"]=o?"unordered":"ordered"}else n["list-style"]="none";var r=pt.ancestor(t.sc,pt.isPara);if(r&&r.style["line-height"])n["line-height"]=r.style.lineHeight;else{var a=parseInt(n["line-height"],10)/parseInt(n["font-size"],10);n["line-height"]=a.toFixed(1)}return n.anchor=t.isOnAnchor()&&pt.ancestor(t.sc,pt.isAnchor),n.ancestors=pt.listAncestor(t.sc,pt.isEditable),n.range=t,n}}])&&Et(e.prototype,n),o&&Et(e,o),t}();function Nt(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}var It=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,n,o;return e=t,(n=[{key:"insertOrderedList",value:function(t){this.toggleList("OL",t)}},{key:"insertUnorderedList",value:function(t){this.toggleList("UL",t)}},{key:"indent",value:function(t){var e=this,n=wt.create(t).wrapBodyInlineWithPara(),o=n.nodes(pt.isPara,{includeAncestor:!0}),r=C.clusterBy(o,g.peq2("parentNode"));i.a.each(r,(function(t,n){var o=C.head(n);if(pt.isLi(o)){var r=e.findList(o.previousSibling);r?n.map((function(t){return r.appendChild(t)})):(e.wrapList(n,o.parentNode.nodeName),n.map((function(t){return t.parentNode})).map((function(t){return e.appendToPrevious(t)})))}else i.a.each(n,(function(t,e){i()(e).css("marginLeft",(function(t,e){return(parseInt(e,10)||0)+25}))}))})),n.select()}},{key:"outdent",value:function(t){var e=this,n=wt.create(t).wrapBodyInlineWithPara(),o=n.nodes(pt.isPara,{includeAncestor:!0}),r=C.clusterBy(o,g.peq2("parentNode"));i.a.each(r,(function(t,n){var o=C.head(n);pt.isLi(o)?e.releaseList([n]):i.a.each(n,(function(t,e){i()(e).css("marginLeft",(function(t,e){return(e=parseInt(e,10)||0)>25?e-25:""}))}))})),n.select()}},{key:"toggleList",value:function(t,e){var n=this,o=wt.create(e).wrapBodyInlineWithPara(),r=o.nodes(pt.isPara,{includeAncestor:!0}),a=o.paraBookmark(r),s=C.clusterBy(r,g.peq2("parentNode"));if(C.find(r,pt.isPurePara)){var l=[];i.a.each(s,(function(e,o){l=l.concat(n.wrapList(o,t))})),r=l}else{var c=o.nodes(pt.isList,{includeAncestor:!0}).filter((function(e){return!i.a.nodeName(e,t)}));c.length?i.a.each(c,(function(e,n){pt.replace(n,t)})):r=this.releaseList(s,!0)}wt.createFromParaBookmark(a,r).select()}},{key:"wrapList",value:function(t,e){var n=C.head(t),o=C.last(t),i=pt.isList(n.previousSibling)&&n.previousSibling,r=pt.isList(o.nextSibling)&&o.nextSibling,a=i||pt.insertAfter(pt.create(e||"UL"),o);return t=t.map((function(t){return pt.isPurePara(t)?pt.replace(t,"LI"):t})),pt.appendChildNodes(a,t),r&&(pt.appendChildNodes(a,C.from(r.childNodes)),pt.remove(r)),t}},{key:"releaseList",value:function(t,e){var n=this,o=[];return i.a.each(t,(function(t,r){var a=C.head(r),s=C.last(r),l=e?pt.lastAncestor(a,pt.isList):a.parentNode,c=l.parentNode;if("LI"===l.parentNode.nodeName)r.map((function(t){var e=n.findNextSiblings(t);c.nextSibling?c.parentNode.insertBefore(t,c.nextSibling):c.parentNode.appendChild(t),e.length&&(n.wrapList(e,l.nodeName),t.appendChild(e[0].parentNode))})),0===l.children.length&&c.removeChild(l),0===c.childNodes.length&&c.parentNode.removeChild(c);else{var u=l.childNodes.length>1?pt.splitTree(l,{node:s.parentNode,offset:pt.position(s)+1},{isSkipPaddingBlankHTML:!0}):null,d=pt.splitTree(l,{node:a.parentNode,offset:pt.position(a)},{isSkipPaddingBlankHTML:!0});r=e?pt.listDescendant(d,pt.isLi):C.from(d.childNodes).filter(pt.isLi),!e&&pt.isList(l.parentNode)||(r=r.map((function(t){return pt.replace(t,"P")}))),i.a.each(C.from(r).reverse(),(function(t,e){pt.insertAfter(e,l)}));var h=C.compact([l,d,u]);i.a.each(h,(function(t,e){var n=[e].concat(pt.listDescendant(e,pt.isList));i.a.each(n.reverse(),(function(t,e){pt.nodeLength(e)||pt.remove(e,!0)}))}))}o=o.concat(r)})),o}},{key:"appendToPrevious",value:function(t){return t.previousSibling?pt.appendChildNodes(t.previousSibling,[t]):this.wrapList([t],"LI")}},{key:"findList",value:function(t){return t?C.find(t.children,(function(t){return["OL","UL"].indexOf(t.nodeName)>-1})):null}},{key:"findNextSiblings",value:function(t){for(var e=[];t.nextSibling;)e.push(t.nextSibling),t=t.nextSibling;return e}}])&&Nt(e.prototype,n),o&&Nt(e,o),t}();function Pt(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}var Rt=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.bullet=new It,this.options=e.options}var e,n,o;return e=t,(n=[{key:"insertTab",value:function(t,e){var n=pt.createText(new Array(e+1).join(pt.NBSP_CHAR));(t=t.deleteContents()).insertNode(n,!0),(t=wt.create(n,e)).select()}},{key:"insertParagraph",value:function(t,e){e=(e=(e=e||wt.create(t)).deleteContents()).wrapBodyInlineWithPara();var n,o=pt.ancestor(e.sc,pt.isPara);if(o){if(pt.isLi(o)&&(pt.isEmpty(o)||pt.deepestChildIsEmpty(o)))return void this.bullet.toggleList(o.parentNode.nodeName);var r=null;if(1===this.options.blockquoteBreakingLevel?r=pt.ancestor(o,pt.isBlockquote):2===this.options.blockquoteBreakingLevel&&(r=pt.lastAncestor(o,pt.isBlockquote)),r){n=i()(pt.emptyPara)[0],pt.isRightEdgePoint(e.getStartPoint())&&pt.isBR(e.sc.nextSibling)&&i()(e.sc.nextSibling).remove();var a=pt.splitTree(r,e.getStartPoint(),{isDiscardEmptySplits:!0});a?a.parentNode.insertBefore(n,a):pt.insertAfter(n,r)}else{n=pt.splitTree(o,e.getStartPoint());var s=pt.listDescendant(o,pt.isEmptyAnchor);s=s.concat(pt.listDescendant(n,pt.isEmptyAnchor)),i.a.each(s,(function(t,e){pt.remove(e)})),(pt.isHeading(n)||pt.isPre(n)||pt.isCustomStyleTag(n))&&pt.isEmpty(n)&&(n=pt.replace(n,"p"))}}else{var l=e.sc.childNodes[e.so];n=i()(pt.emptyPara)[0],l?e.sc.insertBefore(n,l):e.sc.appendChild(n)}wt.create(n,0).normalize().select().scrollIntoView(t)}}])&&Pt(e.prototype,n),o&&Pt(e,o),t}();function Lt(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}var At=function t(e,n,o,i){var r={colPos:0,rowPos:0},a=[],s=[];function l(t,e,n,o,i,r,s){var l={baseRow:n,baseCell:o,isRowSpan:i,isColSpan:r,isVirtual:s};a[t]||(a[t]=[]),a[t][e]=l}function c(t,e,n,o){return{baseCell:t.baseCell,action:e,virtualTable:{rowIndex:n,cellIndex:o}}}function u(t,e){if(!a[t])return e;if(!a[t][e])return e;for(var n=e;a[t][n];)if(n++,!a[t][n])return n}function d(t,e){var n=u(t.rowIndex,e.cellIndex),o=e.colSpan>1,i=e.rowSpan>1,a=t.rowIndex===r.rowPos&&e.cellIndex===r.colPos;l(t.rowIndex,n,t,e,i,o,!1);var s=e.attributes.rowSpan?parseInt(e.attributes.rowSpan.value,10):0;if(s>1)for(var c=1;c<s;c++){var d=t.rowIndex+c;h(d,n,e,a),l(d,n,t,e,!0,o,!0)}var f=e.attributes.colSpan?parseInt(e.attributes.colSpan.value,10):0;if(f>1)for(var p=1;p<f;p++){var m=u(t.rowIndex,n+p);h(t.rowIndex,m,e,a),l(t.rowIndex,m,t,e,i,!0,!0)}}function h(t,e,n,o){t===r.rowPos&&r.colPos>=n.cellIndex&&n.cellIndex<=e&&!o&&r.colPos++}function f(e){switch(n){case t.where.Column:if(e.isColSpan)return t.resultAction.SubtractSpanCount;break;case t.where.Row:if(!e.isVirtual&&e.isRowSpan)return t.resultAction.AddCell;if(e.isRowSpan)return t.resultAction.SubtractSpanCount}return t.resultAction.RemoveCell}function p(e){switch(n){case t.where.Column:if(e.isColSpan)return t.resultAction.SumSpanCount;if(e.isRowSpan&&e.isVirtual)return t.resultAction.Ignore;break;case t.where.Row:if(e.isRowSpan)return t.resultAction.SumSpanCount;if(e.isColSpan&&e.isVirtual)return t.resultAction.Ignore}return t.resultAction.AddCell}this.getActionList=function(){for(var e=n===t.where.Row?r.rowPos:-1,i=n===t.where.Column?r.colPos:-1,l=0,u=!0;u;){var d=e>=0?e:l,h=i>=0?i:l,m=a[d];if(!m)return u=!1,s;var v=m[h];if(!v)return u=!1,s;var g=t.resultAction.Ignore;switch(o){case t.requestAction.Add:g=p(v);break;case t.requestAction.Delete:g=f(v)}s.push(c(v,g,d,h)),l++}return s},e&&e.tagName&&("td"===e.tagName.toLowerCase()||"th"===e.tagName.toLowerCase())&&(r.colPos=e.cellIndex,e.parentElement&&e.parentElement.tagName&&"tr"===e.parentElement.tagName.toLowerCase()&&(r.rowPos=e.parentElement.rowIndex)),function(){for(var t=i.rows,e=0;e<t.length;e++)for(var n=t[e].cells,o=0;o<n.length;o++)d(t[e],n[o])}()};At.where={Row:0,Column:1},At.requestAction={Add:0,Delete:1},At.resultAction={Ignore:0,SubtractSpanCount:1,RemoveCell:2,AddCell:3,SumSpanCount:4};var Ft=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,n,o;return e=t,(n=[{key:"tab",value:function(t,e){var n=pt.ancestor(t.commonAncestor(),pt.isCell),o=pt.ancestor(n,pt.isTable),i=pt.listDescendant(o,pt.isCell),r=C[e?"prev":"next"](i,n);r&&wt.create(r,0).select()}},{key:"addRow",value:function(t,e){for(var n=pt.ancestor(t.commonAncestor(),pt.isCell),o=i()(n).closest("tr"),r=this.recoverAttributes(o),a=i()("<tr"+r+"></tr>"),s=new At(n,At.where.Row,At.requestAction.Add,i()(o).closest("table")[0]).getActionList(),l=0;l<s.length;l++){var c=s[l],u=this.recoverAttributes(c.baseCell);switch(c.action){case At.resultAction.AddCell:a.append("<td"+u+">"+pt.blank+"</td>");break;case At.resultAction.SumSpanCount:if("top"===e&&(c.baseCell.parent?c.baseCell.closest("tr").rowIndex:0)<=o[0].rowIndex){var d=i()("<div></div>").append(i()("<td"+u+">"+pt.blank+"</td>").removeAttr("rowspan")).html();a.append(d);break}var h=parseInt(c.baseCell.rowSpan,10);h++,c.baseCell.setAttribute("rowSpan",h)}}if("top"===e)o.before(a);else{if(n.rowSpan>1){var f=o[0].rowIndex+(n.rowSpan-2);return void i()(i()(o).parent().find("tr")[f]).after(i()(a))}o.after(a)}}},{key:"addCol",value:function(t,e){var n=pt.ancestor(t.commonAncestor(),pt.isCell),o=i()(n).closest("tr");i()(o).siblings().push(o);for(var r=new At(n,At.where.Column,At.requestAction.Add,i()(o).closest("table")[0]).getActionList(),a=0;a<r.length;a++){var s=r[a],l=this.recoverAttributes(s.baseCell);switch(s.action){case At.resultAction.AddCell:"right"===e?i()(s.baseCell).after("<td"+l+">"+pt.blank+"</td>"):i()(s.baseCell).before("<td"+l+">"+pt.blank+"</td>");break;case At.resultAction.SumSpanCount:if("right"===e){var c=parseInt(s.baseCell.colSpan,10);c++,s.baseCell.setAttribute("colSpan",c)}else i()(s.baseCell).before("<td"+l+">"+pt.blank+"</td>")}}}},{key:"recoverAttributes",value:function(t){var e="";if(!t)return e;for(var n=t.attributes||[],o=0;o<n.length;o++)"id"!==n[o].name.toLowerCase()&&n[o].specified&&(e+=" "+n[o].name+"='"+n[o].value+"'");return e}},{key:"deleteRow",value:function(t){for(var e=pt.ancestor(t.commonAncestor(),pt.isCell),n=i()(e).closest("tr"),o=n.children("td, th").index(i()(e)),r=n[0].rowIndex,a=new At(e,At.where.Row,At.requestAction.Delete,i()(n).closest("table")[0]).getActionList(),s=0;s<a.length;s++)if(a[s]){var l=a[s].baseCell,c=a[s].virtualTable,u=l.rowSpan&&l.rowSpan>1,d=u?parseInt(l.rowSpan,10):0;switch(a[s].action){case At.resultAction.Ignore:continue;case At.resultAction.AddCell:var h=n.next("tr")[0];if(!h)continue;var f=n[0].cells[o];u&&(d>2?(d--,h.insertBefore(f,h.cells[o]),h.cells[o].setAttribute("rowSpan",d),h.cells[o].innerHTML=""):2===d&&(h.insertBefore(f,h.cells[o]),h.cells[o].removeAttribute("rowSpan"),h.cells[o].innerHTML=""));continue;case At.resultAction.SubtractSpanCount:u&&(d>2?(d--,l.setAttribute("rowSpan",d),c.rowIndex!==r&&l.cellIndex===o&&(l.innerHTML="")):2===d&&(l.removeAttribute("rowSpan"),c.rowIndex!==r&&l.cellIndex===o&&(l.innerHTML="")));continue;case At.resultAction.RemoveCell:continue}}n.remove()}},{key:"deleteCol",value:function(t){for(var e=pt.ancestor(t.commonAncestor(),pt.isCell),n=i()(e).closest("tr"),o=n.children("td, th").index(i()(e)),r=new At(e,At.where.Column,At.requestAction.Delete,i()(n).closest("table")[0]).getActionList(),a=0;a<r.length;a++)if(r[a])switch(r[a].action){case At.resultAction.Ignore:continue;case At.resultAction.SubtractSpanCount:var s=r[a].baseCell;if(s.colSpan&&s.colSpan>1){var l=s.colSpan?parseInt(s.colSpan,10):0;l>2?(l--,s.setAttribute("colSpan",l),s.cellIndex===o&&(s.innerHTML="")):2===l&&(s.removeAttribute("colSpan"),s.cellIndex===o&&(s.innerHTML=""))}continue;case At.resultAction.RemoveCell:pt.remove(r[a].baseCell,!0);continue}}},{key:"createTable",value:function(t,e,n){for(var o,r=[],a=0;a<t;a++)r.push("<td>"+pt.blank+"</td>");o=r.join("");for(var s,l=[],c=0;c<e;c++)l.push("<tr>"+o+"</tr>");s=l.join("");var u=i()("<table>"+s+"</table>");return n&&n.tableClassName&&u.addClass(n.tableClassName),u[0]}},{key:"deleteTable",value:function(t){var e=pt.ancestor(t.commonAncestor(),pt.isCell);i()(e).closest("table").remove()}}])&&Lt(e.prototype,n),o&&Lt(e,o),t}();function Dt(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}var Ht=function(){function t(e){var n=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.context=e,this.$note=e.layoutInfo.note,this.$editor=e.layoutInfo.editor,this.$editable=e.layoutInfo.editable,this.options=e.options,this.lang=this.options.langInfo,this.editable=this.$editable[0],this.lastRange=null,this.snapshot=null,this.style=new $t,this.table=new Ft,this.typing=new Rt(e),this.bullet=new It,this.history=new Tt(e),this.context.memo("help.escape",this.lang.help.escape),this.context.memo("help.undo",this.lang.help.undo),this.context.memo("help.redo",this.lang.help.redo),this.context.memo("help.tab",this.lang.help.tab),this.context.memo("help.untab",this.lang.help.untab),this.context.memo("help.insertParagraph",this.lang.help.insertParagraph),this.context.memo("help.insertOrderedList",this.lang.help.insertOrderedList),this.context.memo("help.insertUnorderedList",this.lang.help.insertUnorderedList),this.context.memo("help.indent",this.lang.help.indent),this.context.memo("help.outdent",this.lang.help.outdent),this.context.memo("help.formatPara",this.lang.help.formatPara),this.context.memo("help.insertHorizontalRule",this.lang.help.insertHorizontalRule),this.context.memo("help.fontName",this.lang.help.fontName);for(var o=["bold","italic","underline","strikethrough","superscript","subscript","justifyLeft","justifyCenter","justifyRight","justifyFull","formatBlock","removeFormat","backColor"],r=0,a=o.length;r<a;r++)this[o[r]]=function(t){return function(e){n.beforeCommand(),document.execCommand(t,!1,e),n.afterCommand(!0)}}(o[r]),this.context.memo("help."+o[r],this.lang.help[o[r]]);this.fontName=this.wrapCommand((function(t){return n.fontStyling("font-family",m.validFontName(t))})),this.fontSize=this.wrapCommand((function(t){var e=n.currentStyle()["font-size-unit"];return n.fontStyling("font-size",t+e)})),this.fontSizeUnit=this.wrapCommand((function(t){var e=n.currentStyle()["font-size"];return n.fontStyling("font-size",e+t)}));for(var s=1;s<=6;s++)this["formatH"+s]=function(t){return function(){n.formatBlock("H"+t)}}(s),this.context.memo("help.formatH"+s,this.lang.help["formatH"+s]);this.insertParagraph=this.wrapCommand((function(){n.typing.insertParagraph(n.editable)})),this.insertOrderedList=this.wrapCommand((function(){n.bullet.insertOrderedList(n.editable)})),this.insertUnorderedList=this.wrapCommand((function(){n.bullet.insertUnorderedList(n.editable)})),this.indent=this.wrapCommand((function(){n.bullet.indent(n.editable)})),this.outdent=this.wrapCommand((function(){n.bullet.outdent(n.editable)})),this.insertNode=this.wrapCommand((function(t){n.isLimited(i()(t).text().length)||(n.getLastRange().insertNode(t),n.setLastRange(wt.createFromNodeAfter(t).select()))})),this.insertText=this.wrapCommand((function(t){if(!n.isLimited(t.length)){var e=n.getLastRange().insertNode(pt.createText(t));n.setLastRange(wt.create(e,pt.nodeLength(e)).select())}})),this.pasteHTML=this.wrapCommand((function(t){if(!n.isLimited(t.length)){t=n.context.invoke("codeview.purify",t);var e=n.getLastRange().pasteHTML(t);n.setLastRange(wt.createFromNodeAfter(C.last(e)).select())}})),this.formatBlock=this.wrapCommand((function(t,e){var o=n.options.callbacks.onApplyCustomStyle;o?o.call(n,e,n.context,n.onFormatBlock):n.onFormatBlock(t,e)})),this.insertHorizontalRule=this.wrapCommand((function(){var t=n.getLastRange().insertNode(pt.create("HR"));t.nextSibling&&n.setLastRange(wt.create(t.nextSibling,0).normalize().select())})),this.lineHeight=this.wrapCommand((function(t){n.style.stylePara(n.getLastRange(),{lineHeight:t})})),this.createLink=this.wrapCommand((function(t){var e=t.url,o=t.text,r=t.isNewWindow,a=t.checkProtocol,s=t.range||n.getLastRange(),l=o.length-s.toString().length;if(!(l>0&&n.isLimited(l))){var c=s.toString()!==o;"string"==typeof e&&(e=e.trim()),n.options.onCreateLink?e=n.options.onCreateLink(e):a&&(e=/^([A-Za-z][A-Za-z0-9+-.]*\:|#|\/)/.test(e)?e:n.options.defaultProtocol+e);var u=[];if(c){var d=(s=s.deleteContents()).insertNode(i()("<A>"+o+"</A>")[0]);u.push(d)}else u=n.style.styleNodes(s,{nodeName:"A",expandClosestSibling:!0,onlyPartialContains:!0});i.a.each(u,(function(t,n){i()(n).attr("href",e),r?i()(n).attr("target","_blank"):i()(n).removeAttr("target")})),n.setLastRange(n.createRangeFromList(u).select())}})),this.color=this.wrapCommand((function(t){var e=t.foreColor,n=t.backColor;e&&document.execCommand("foreColor",!1,e),n&&document.execCommand("backColor",!1,n)})),this.foreColor=this.wrapCommand((function(t){document.execCommand("foreColor",!1,t)})),this.insertTable=this.wrapCommand((function(t){var e=t.split("x");n.getLastRange().deleteContents().insertNode(n.table.createTable(e[0],e[1],n.options))})),this.removeMedia=this.wrapCommand((function(){var t=i()(n.restoreTarget()).parent();t.closest("figure").length?t.closest("figure").remove():t=i()(n.restoreTarget()).detach(),n.context.triggerEvent("media.delete",t,n.$editable)})),this.floatMe=this.wrapCommand((function(t){var e=i()(n.restoreTarget());e.toggleClass("note-float-left","left"===t),e.toggleClass("note-float-right","right"===t),e.css("float","none"===t?"":t)})),this.resize=this.wrapCommand((function(t){var e=i()(n.restoreTarget());0===(t=parseFloat(t))?e.css("width",""):e.css({width:100*t+"%",height:""})}))}var e,n,o;return e=t,(n=[{key:"initialize",value:function(){var t=this;this.$editable.on("keydown",(function(e){if(e.keyCode===xt.code.ENTER&&t.context.triggerEvent("enter",e),t.context.triggerEvent("keydown",e),t.snapshot=t.history.makeSnapshot(),t.hasKeyShortCut=!1,e.isDefaultPrevented()||(t.options.shortcuts?t.hasKeyShortCut=t.handleKeyMap(e):t.preventDefaultEditableShortCuts(e)),t.isLimited(1,e)){var n=t.getLastRange();if(n.eo-n.so==0)return!1}t.setLastRange(),t.options.recordEveryKeystroke&&!1===t.hasKeyShortCut&&t.history.recordUndo()})).on("keyup",(function(e){t.setLastRange(),t.context.triggerEvent("keyup",e)})).on("focus",(function(e){t.setLastRange(),t.context.triggerEvent("focus",e)})).on("blur",(function(e){t.context.triggerEvent("blur",e)})).on("mousedown",(function(e){t.context.triggerEvent("mousedown",e)})).on("mouseup",(function(e){t.setLastRange(),t.history.recordUndo(),t.context.triggerEvent("mouseup",e)})).on("scroll",(function(e){t.context.triggerEvent("scroll",e)})).on("paste",(function(e){t.setLastRange(),t.context.triggerEvent("paste",e)})).on("input",(function(){t.isLimited(0)&&t.snapshot&&t.history.applySnapshot(t.snapshot)})),this.$editable.attr("spellcheck",this.options.spellCheck),this.$editable.attr("autocorrect",this.options.spellCheck),this.options.disableGrammar&&this.$editable.attr("data-gramm",!1),this.$editable.html(pt.html(this.$note)||pt.emptyPara),this.$editable.on(m.inputEventName,g.debounce((function(){t.context.triggerEvent("change",t.$editable.html(),t.$editable)}),10)),this.$editable.on("focusin",(function(e){t.context.triggerEvent("focusin",e)})).on("focusout",(function(e){t.context.triggerEvent("focusout",e)})),this.options.airMode?this.options.overrideContextMenu&&this.$editor.on("contextmenu",(function(e){return t.context.triggerEvent("contextmenu",e),!1})):(this.options.width&&this.$editor.outerWidth(this.options.width),this.options.height&&this.$editable.outerHeight(this.options.height),this.options.maxHeight&&this.$editable.css("max-height",this.options.maxHeight),this.options.minHeight&&this.$editable.css("min-height",this.options.minHeight)),this.history.recordUndo(),this.setLastRange()}},{key:"destroy",value:function(){this.$editable.off()}},{key:"handleKeyMap",value:function(t){var e=this.options.keyMap[m.isMac?"mac":"pc"],n=[];t.metaKey&&n.push("CMD"),t.ctrlKey&&!t.altKey&&n.push("CTRL"),t.shiftKey&&n.push("SHIFT");var o=xt.nameFromCode[t.keyCode];o&&n.push(o);var i=e[n.join("+")];if("TAB"!==o||this.options.tabDisable)if(i){if(!1!==this.context.invoke(i))return t.preventDefault(),!0}else xt.isEdit(t.keyCode)&&this.afterCommand();else this.afterCommand();return!1}},{key:"preventDefaultEditableShortCuts",value:function(t){(t.ctrlKey||t.metaKey)&&C.contains([66,73,85],t.keyCode)&&t.preventDefault()}},{key:"isLimited",value:function(t,e){return t=t||0,(void 0===e||!(xt.isMove(e.keyCode)||xt.isNavigation(e.keyCode)||e.ctrlKey||e.metaKey||C.contains([xt.code.BACKSPACE,xt.code.DELETE],e.keyCode)))&&this.options.maxTextLength>0&&this.$editable.text().length+t>this.options.maxTextLength}},{key:"createRange",value:function(){return this.focus(),this.setLastRange(),this.getLastRange()}},{key:"createRangeFromList",value:function(t){var e=wt.createFromNodeBefore(C.head(t)).getStartPoint(),n=wt.createFromNodeAfter(C.last(t)).getEndPoint();return wt.create(e.node,e.offset,n.node,n.offset)}},{key:"setLastRange",value:function(t){t?this.lastRange=t:(this.lastRange=wt.create(this.editable),0===i()(this.lastRange.sc).closest(".note-editable").length&&(this.lastRange=wt.createFromBodyElement(this.editable)))}},{key:"getLastRange",value:function(){return this.lastRange||this.setLastRange(),this.lastRange}},{key:"saveRange",value:function(t){t&&this.getLastRange().collapse().select()}},{key:"restoreRange",value:function(){this.lastRange&&(this.lastRange.select(),this.focus())}},{key:"saveTarget",value:function(t){this.$editable.data("target",t)}},{key:"clearTarget",value:function(){this.$editable.removeData("target")}},{key:"restoreTarget",value:function(){return this.$editable.data("target")}},{key:"currentStyle",value:function(){var t=wt.create();return t&&(t=t.normalize()),t?this.style.current(t):this.style.fromNode(this.$editable)}},{key:"styleFromNode",value:function(t){return this.style.fromNode(t)}},{key:"undo",value:function(){this.context.triggerEvent("before.command",this.$editable.html()),this.history.undo(),this.context.triggerEvent("change",this.$editable.html(),this.$editable)}},{key:"commit",value:function(){this.context.triggerEvent("before.command",this.$editable.html()),this.history.commit(),this.context.triggerEvent("change",this.$editable.html(),this.$editable)}},{key:"redo",value:function(){this.context.triggerEvent("before.command",this.$editable.html()),this.history.redo(),this.context.triggerEvent("change",this.$editable.html(),this.$editable)}},{key:"beforeCommand",value:function(){this.context.triggerEvent("before.command",this.$editable.html()),document.execCommand("styleWithCSS",!1,this.options.styleWithCSS),this.focus()}},{key:"afterCommand",value:function(t){this.normalizeContent(),this.history.recordUndo(),t||this.context.triggerEvent("change",this.$editable.html(),this.$editable)}},{key:"tab",value:function(){var t=this.getLastRange();if(t.isCollapsed()&&t.isOnCell())this.table.tab(t);else{if(0===this.options.tabSize)return!1;this.isLimited(this.options.tabSize)||(this.beforeCommand(),this.typing.insertTab(t,this.options.tabSize),this.afterCommand())}}},{key:"untab",value:function(){var t=this.getLastRange();if(t.isCollapsed()&&t.isOnCell())this.table.tab(t,!0);else if(0===this.options.tabSize)return!1}},{key:"wrapCommand",value:function(t){return function(){this.beforeCommand(),t.apply(this,arguments),this.afterCommand()}}},{key:"insertImage",value:function(t,e){var n,o=this;return(n=t,i.a.Deferred((function(t){var e=i()("<img>");e.one("load",(function(){e.off("error abort"),t.resolve(e)})).one("error abort",(function(){e.off("load").detach(),t.reject(e)})).css({display:"none"}).appendTo(document.body).attr("src",n)})).promise()).then((function(t){o.beforeCommand(),"function"==typeof e?e(t):("string"==typeof e&&t.attr("data-filename",e),t.css("width",Math.min(o.$editable.width(),t.width()))),t.show(),o.getLastRange().insertNode(t[0]),o.setLastRange(wt.createFromNodeAfter(t[0]).select()),o.afterCommand()})).fail((function(t){o.context.triggerEvent("image.upload.error",t)}))}},{key:"insertImagesAsDataURL",value:function(t){var e=this;i.a.each(t,(function(t,n){var o=n.name;e.options.maximumImageFileSize&&e.options.maximumImageFileSize<n.size?e.context.triggerEvent("image.upload.error",e.lang.image.maximumFileSizeError):function(t){return i.a.Deferred((function(e){i.a.extend(new FileReader,{onload:function(t){var n=t.target.result;e.resolve(n)},onerror:function(t){e.reject(t)}}).readAsDataURL(t)})).promise()}(n).then((function(t){return e.insertImage(t,o)})).fail((function(){e.context.triggerEvent("image.upload.error")}))}))}},{key:"insertImagesOrCallback",value:function(t){this.options.callbacks.onImageUpload?this.context.triggerEvent("image.upload",t):this.insertImagesAsDataURL(t)}},{key:"getSelectedText",value:function(){var t=this.getLastRange();return t.isOnAnchor()&&(t=wt.createFromNode(pt.ancestor(t.sc,pt.isAnchor))),t.toString()}},{key:"onFormatBlock",value:function(t,e){if(document.execCommand("FormatBlock",!1,m.isMSIE?"<"+t+">":t),e&&e.length&&(e[0].tagName.toUpperCase()!==t.toUpperCase()&&(e=e.find(t)),e&&e.length)){var n=e[0].className||"";if(n){var o=this.createRange();i()([o.sc,o.ec]).closest(t).addClass(n)}}}},{key:"formatPara",value:function(){this.formatBlock("P")}},{key:"fontStyling",value:function(t,e){var n=this.getLastRange();if(""!==n){var o=this.style.styleNodes(n);if(this.$editor.find(".note-status-output").html(""),i()(o).css(t,e),n.isCollapsed()){var r=C.head(o);r&&!pt.nodeLength(r)&&(r.innerHTML=pt.ZERO_WIDTH_NBSP_CHAR,wt.createFromNode(r.firstChild).select(),this.setLastRange(),this.$editable.data("bogus",r))}else this.setLastRange(this.createRangeFromList(o).select())}else{var a=i.a.now();this.$editor.find(".note-status-output").html('<div id="note-status-output-'+a+'" class="alert alert-info">'+this.lang.output.noSelection+"</div>"),setTimeout((function(){i()("#note-status-output-"+a).remove()}),5e3)}}},{key:"unlink",value:function(){var t=this.getLastRange();if(t.isOnAnchor()){var e=pt.ancestor(t.sc,pt.isAnchor);(t=wt.createFromNode(e)).select(),this.setLastRange(),this.beforeCommand(),document.execCommand("unlink"),this.afterCommand()}}},{key:"getLinkInfo",value:function(){var t=this.getLastRange().expand(pt.isAnchor),e=i()(C.head(t.nodes(pt.isAnchor))),n={range:t,text:t.toString(),url:e.length?e.attr("href"):""};return e.length&&(n.isNewWindow="_blank"===e.attr("target")),n}},{key:"addRow",value:function(t){var e=this.getLastRange(this.$editable);e.isCollapsed()&&e.isOnCell()&&(this.beforeCommand(),this.table.addRow(e,t),this.afterCommand())}},{key:"addCol",value:function(t){var e=this.getLastRange(this.$editable);e.isCollapsed()&&e.isOnCell()&&(this.beforeCommand(),this.table.addCol(e,t),this.afterCommand())}},{key:"deleteRow",value:function(){var t=this.getLastRange(this.$editable);t.isCollapsed()&&t.isOnCell()&&(this.beforeCommand(),this.table.deleteRow(t),this.afterCommand())}},{key:"deleteCol",value:function(){var t=this.getLastRange(this.$editable);t.isCollapsed()&&t.isOnCell()&&(this.beforeCommand(),this.table.deleteCol(t),this.afterCommand())}},{key:"deleteTable",value:function(){var t=this.getLastRange(this.$editable);t.isCollapsed()&&t.isOnCell()&&(this.beforeCommand(),this.table.deleteTable(t),this.afterCommand())}},{key:"resizeTo",value:function(t,e,n){var o;if(n){var i=t.y/t.x,r=e.data("ratio");o={width:r>i?t.x:t.y/r,height:r>i?t.x*r:t.y}}else o={width:t.x,height:t.y};e.css(o)}},{key:"hasFocus",value:function(){return this.$editable.is(":focus")}},{key:"focus",value:function(){this.hasFocus()||this.$editable.focus()}},{key:"isEmpty",value:function(){return pt.isEmpty(this.$editable[0])||pt.emptyPara===this.$editable.html()}},{key:"empty",value:function(){this.context.invoke("code",pt.emptyPara)}},{key:"normalizeContent",value:function(){this.$editable[0].normalize()}}])&&Dt(e.prototype,n),o&&Dt(e,o),t}();function Bt(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}var zt=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.context=e,this.$editable=e.layoutInfo.editable}var e,n,o;return e=t,(n=[{key:"initialize",value:function(){this.$editable.on("paste",this.pasteByEvent.bind(this))}},{key:"pasteByEvent",value:function(t){var e=this,n=t.originalEvent.clipboardData;if(n&&n.items&&n.items.length){var o=n.items.length>1?n.items[1]:C.head(n.items);"file"===o.kind&&-1!==o.type.indexOf("image/")?(this.context.invoke("editor.insertImagesOrCallback",[o.getAsFile()]),t.preventDefault()):"string"===o.kind&&this.context.invoke("editor.isLimited",n.getData("Text").length)&&t.preventDefault()}else if(window.clipboardData){var i=window.clipboardData.getData("text");this.context.invoke("editor.isLimited",i.length)&&t.preventDefault()}setTimeout((function(){e.context.invoke("editor.afterCommand")}),10)}}])&&Bt(e.prototype,n),o&&Bt(e,o),t}();function Mt(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}var Ot=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.context=e,this.$eventListener=i()(document),this.$editor=e.layoutInfo.editor,this.$editable=e.layoutInfo.editable,this.options=e.options,this.lang=this.options.langInfo,this.documentEventHandlers={},this.$dropzone=i()(['<div class="note-dropzone">','<div class="note-dropzone-message"></div>',"</div>"].join("")).prependTo(this.$editor)}var e,n,o;return e=t,(n=[{key:"initialize",value:function(){this.options.disableDragAndDrop?(this.documentEventHandlers.onDrop=function(t){t.preventDefault()},this.$eventListener=this.$dropzone,this.$eventListener.on("drop",this.documentEventHandlers.onDrop)):this.attachDragAndDropEvent()}},{key:"attachDragAndDropEvent",value:function(){var t=this,e=i()(),n=this.$dropzone.find(".note-dropzone-message");this.documentEventHandlers.onDragenter=function(o){var i=t.context.invoke("codeview.isActivated"),r=t.$editor.width()>0&&t.$editor.height()>0;i||e.length||!r||(t.$editor.addClass("dragover"),t.$dropzone.width(t.$editor.width()),t.$dropzone.height(t.$editor.height()),n.text(t.lang.image.dragImageHere)),e=e.add(o.target)},this.documentEventHandlers.onDragleave=function(n){(e=e.not(n.target)).length&&"BODY"!==n.target.nodeName||(e=i()(),t.$editor.removeClass("dragover"))},this.documentEventHandlers.onDrop=function(){e=i()(),t.$editor.removeClass("dragover")},this.$eventListener.on("dragenter",this.documentEventHandlers.onDragenter).on("dragleave",this.documentEventHandlers.onDragleave).on("drop",this.documentEventHandlers.onDrop),this.$dropzone.on("dragenter",(function(){t.$dropzone.addClass("hover"),n.text(t.lang.image.dropImage)})).on("dragleave",(function(){t.$dropzone.removeClass("hover"),n.text(t.lang.image.dragImageHere)})),this.$dropzone.on("drop",(function(e){var n=e.originalEvent.dataTransfer;e.preventDefault(),n&&n.files&&n.files.length?(t.$editable.focus(),t.context.invoke("editor.insertImagesOrCallback",n.files)):i.a.each(n.types,(function(e,o){if(!(o.toLowerCase().indexOf("_moz_")>-1)){var r=n.getData(o);o.toLowerCase().indexOf("text")>-1?t.context.invoke("editor.pasteHTML",r):i()(r).each((function(e,n){t.context.invoke("editor.insertNode",n)}))}}))})).on("dragover",!1)}},{key:"destroy",value:function(){var t=this;Object.keys(this.documentEventHandlers).forEach((function(e){t.$eventListener.off(e.substr(2).toLowerCase(),t.documentEventHandlers[e])})),this.documentEventHandlers={}}}])&&Mt(e.prototype,n),o&&Mt(e,o),t}();function jt(t){if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(t=function(t,e){if(!t)return;if("string"==typeof t)return Ut(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ut(t,e)}(t))){var e=0,n=function(){};return{s:n,n:function(){return e>=t.length?{done:!0}:{done:!1,value:t[e++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i,r=!0,a=!1;return{s:function(){o=t[Symbol.iterator]()},n:function(){var t=o.next();return r=t.done,t},e:function(t){a=!0,i=t},f:function(){try{r||null==o.return||o.return()}finally{if(a)throw i}}}}function Ut(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n<e;n++)o[n]=t[n];return o}function Wt(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}var Kt=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.context=e,this.$editor=e.layoutInfo.editor,this.$editable=e.layoutInfo.editable,this.$codable=e.layoutInfo.codable,this.options=e.options,this.CodeMirrorConstructor=window.CodeMirror,this.options.codemirror.CodeMirrorConstructor&&(this.CodeMirrorConstructor=this.options.codemirror.CodeMirrorConstructor)}var e,n,o;return e=t,(n=[{key:"sync",value:function(t){var e=this.isActivated(),n=this.CodeMirrorConstructor;e&&(t?n?this.$codable.data("cmEditor").getDoc().setValue(t):this.$codable.val(t):n&&this.$codable.data("cmEditor").save())}},{key:"initialize",value:function(){var t=this;this.$codable.on("keyup",(function(e){e.keyCode===xt.code.ESCAPE&&t.deactivate()}))}},{key:"isActivated",value:function(){return this.$editor.hasClass("codeview")}},{key:"toggle",value:function(){this.isActivated()?this.deactivate():this.activate(),this.context.triggerEvent("codeview.toggled")}},{key:"purify",value:function(t){if(this.options.codeviewFilter&&(t=t.replace(this.options.codeviewFilterRegex,""),this.options.codeviewIframeFilter)){var e=this.options.codeviewIframeWhitelistSrc.concat(this.options.codeviewIframeWhitelistSrcBase);t=t.replace(/(<iframe.*?>.*?(?:<\/iframe>)?)/gi,(function(t){if(/<.+src(?==?('|"|\s)?)[\s\S]+src(?=('|"|\s)?)[^>]*?>/i.test(t))return"";var n,o=jt(e);try{for(o.s();!(n=o.n()).done;){var i=n.value;if(new RegExp('src="(https?:)?//'+i.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")+'/(.+)"').test(t))return t}}catch(t){o.e(t)}finally{o.f()}return""}))}return t}},{key:"activate",value:function(){var t=this,e=this.CodeMirrorConstructor;if(this.$codable.val(pt.html(this.$editable,this.options.prettifyHtml)),this.$codable.height(this.$editable.height()),this.context.invoke("toolbar.updateCodeview",!0),this.context.invoke("airPopover.updateCodeview",!0),this.$editor.addClass("codeview"),this.$codable.focus(),e){var n=e.fromTextArea(this.$codable[0],this.options.codemirror);if(this.options.codemirror.tern){var o=new e.TernServer(this.options.codemirror.tern);n.ternServer=o,n.on("cursorActivity",(function(t){o.updateArgHints(t)}))}n.on("blur",(function(e){t.context.triggerEvent("blur.codeview",n.getValue(),e)})),n.on("change",(function(){t.context.triggerEvent("change.codeview",n.getValue(),n)})),n.setSize(null,this.$editable.outerHeight()),this.$codable.data("cmEditor",n)}else this.$codable.on("blur",(function(e){t.context.triggerEvent("blur.codeview",t.$codable.val(),e)})),this.$codable.on("input",(function(){t.context.triggerEvent("change.codeview",t.$codable.val(),t.$codable)}))}},{key:"deactivate",value:function(){if(this.CodeMirrorConstructor){var t=this.$codable.data("cmEditor");this.$codable.val(t.getValue()),t.toTextArea()}var e=this.purify(pt.value(this.$codable,this.options.prettifyHtml)||pt.emptyPara),n=this.$editable.html()!==e;this.$editable.html(e),this.$editable.height(this.options.height?this.$codable.height():"auto"),this.$editor.removeClass("codeview"),n&&this.context.triggerEvent("change",this.$editable.html(),this.$editable),this.$editable.focus(),this.context.invoke("toolbar.updateCodeview",!1),this.context.invoke("airPopover.updateCodeview",!1)}},{key:"destroy",value:function(){this.isActivated()&&this.deactivate()}}])&&Wt(e.prototype,n),o&&Wt(e,o),t}();function Vt(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}var qt=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.$document=i()(document),this.$statusbar=e.layoutInfo.statusbar,this.$editable=e.layoutInfo.editable,this.options=e.options}var e,n,o;return e=t,(n=[{key:"initialize",value:function(){var t=this;this.options.airMode||this.options.disableResizeEditor?this.destroy():this.$statusbar.on("mousedown",(function(e){e.preventDefault(),e.stopPropagation();var n=t.$editable.offset().top-t.$document.scrollTop(),o=function(e){var o=e.clientY-(n+24);o=t.options.minheight>0?Math.max(o,t.options.minheight):o,o=t.options.maxHeight>0?Math.min(o,t.options.maxHeight):o,t.$editable.height(o)};t.$document.on("mousemove",o).one("mouseup",(function(){t.$document.off("mousemove",o)}))}))}},{key:"destroy",value:function(){this.$statusbar.off(),this.$statusbar.addClass("locked")}}])&&Vt(e.prototype,n),o&&Vt(e,o),t}();function _t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}var Gt=function(){function t(e){var n=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.context=e,this.$editor=e.layoutInfo.editor,this.$toolbar=e.layoutInfo.toolbar,this.$editable=e.layoutInfo.editable,this.$codable=e.layoutInfo.codable,this.$window=i()(window),this.$scrollbar=i()("html, body"),this.onResize=function(){n.resizeTo({h:n.$window.height()-n.$toolbar.outerHeight()})}}var e,n,o;return e=t,(n=[{key:"resizeTo",value:function(t){this.$editable.css("height",t.h),this.$codable.css("height",t.h),this.$codable.data("cmeditor")&&this.$codable.data("cmeditor").setsize(null,t.h)}},{key:"toggle",value:function(){this.$editor.toggleClass("fullscreen"),this.isFullscreen()?(this.$editable.data("orgHeight",this.$editable.css("height")),this.$editable.data("orgMaxHeight",this.$editable.css("maxHeight")),this.$editable.css("maxHeight",""),this.$window.on("resize",this.onResize).trigger("resize"),this.$scrollbar.css("overflow","hidden")):(this.$window.off("resize",this.onResize),this.resizeTo({h:this.$editable.data("orgHeight")}),this.$editable.css("maxHeight",this.$editable.css("orgMaxHeight")),this.$scrollbar.css("overflow","visible")),this.context.invoke("toolbar.updateFullscreen",this.isFullscreen())}},{key:"isFullscreen",value:function(){return this.$editor.hasClass("fullscreen")}}])&&_t(e.prototype,n),o&&_t(e,o),t}();function Yt(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}var Zt=function(){function t(e){var n=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.context=e,this.$document=i()(document),this.$editingArea=e.layoutInfo.editingArea,this.options=e.options,this.lang=this.options.langInfo,this.events={"summernote.mousedown":function(t,e){n.update(e.target,e)&&e.preventDefault()},"summernote.keyup summernote.scroll summernote.change summernote.dialog.shown":function(){n.update()},"summernote.disable summernote.blur":function(){n.hide()},"summernote.codeview.toggled":function(){n.update()}}}var e,n,o;return e=t,(n=[{key:"initialize",value:function(){var t=this;this.$handle=i()(['<div class="note-handle">','<div class="note-control-selection">','<div class="note-control-selection-bg"></div>','<div class="note-control-holder note-control-nw"></div>','<div class="note-control-holder note-control-ne"></div>','<div class="note-control-holder note-control-sw"></div>','<div class="',this.options.disableResizeImage?"note-control-holder":"note-control-sizing",' note-control-se"></div>',this.options.disableResizeImage?"":'<div class="note-control-selection-info"></div>',"</div>","</div>"].join("")).prependTo(this.$editingArea),this.$handle.on("mousedown",(function(e){if(pt.isControlSizing(e.target)){e.preventDefault(),e.stopPropagation();var n=t.$handle.find(".note-control-selection").data("target"),o=n.offset(),i=t.$document.scrollTop(),r=function(e){t.context.invoke("editor.resizeTo",{x:e.clientX-o.left,y:e.clientY-(o.top-i)},n,!e.shiftKey),t.update(n[0],e)};t.$document.on("mousemove",r).one("mouseup",(function(e){e.preventDefault(),t.$document.off("mousemove",r),t.context.invoke("editor.afterCommand")})),n.data("ratio")||n.data("ratio",n.height()/n.width())}})),this.$handle.on("wheel",(function(e){e.preventDefault(),t.update()}))}},{key:"destroy",value:function(){this.$handle.remove()}},{key:"update",value:function(t,e){if(this.context.isDisabled())return!1;var n=pt.isImg(t),o=this.$handle.find(".note-control-selection");if(this.context.invoke("imagePopover.update",t,e),n){var r=i()(t),a=r.position(),s={left:a.left+parseInt(r.css("marginLeft"),10),top:a.top+parseInt(r.css("marginTop"),10)},l={w:r.outerWidth(!1),h:r.outerHeight(!1)};o.css({display:"block",left:s.left,top:s.top,width:l.w,height:l.h}).data("target",r);var c=new Image;c.src=r.attr("src");var u=l.w+"x"+l.h+" ("+this.lang.image.original+": "+c.width+"x"+c.height+")";o.find(".note-control-selection-info").text(u),this.context.invoke("editor.saveTarget",t)}else this.hide();return n}},{key:"hide",value:function(){this.context.invoke("editor.clearTarget"),this.$handle.children().hide()}}])&&Yt(e.prototype,n),o&&Yt(e,o),t}();function Xt(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}var Qt=/^([A-Za-z][A-Za-z0-9+-.]*\:[\/]{2}|tel:|mailto:[A-Z0-9._%+-]+@)?(www\.)?(.+)$/i,Jt=function(){function t(e){var n=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.context=e,this.options=e.options,this.events={"summernote.keyup":function(t,e){e.isDefaultPrevented()||n.handleKeyup(e)},"summernote.keydown":function(t,e){n.handleKeydown(e)}}}var e,n,o;return e=t,(n=[{key:"initialize",value:function(){this.lastWordRange=null}},{key:"destroy",value:function(){this.lastWordRange=null}},{key:"replace",value:function(){if(this.lastWordRange){var t=this.lastWordRange.toString(),e=t.match(Qt);if(e&&(e[1]||e[2])){var n=e[1]?t:"http://"+t,o=this.options.showDomainOnlyForAutolink?t.replace(/^(?:https?:\/\/)?(?:tel?:?)?(?:mailto?:?)?(?:www\.)?/i,"").split("/")[0]:t,r=i()("<a />").html(o).attr("href",n)[0];this.context.options.linkTargetBlank&&i()(r).attr("target","_blank"),this.lastWordRange.insertNode(r),this.lastWordRange=null,this.context.invoke("editor.focus")}}}},{key:"handleKeydown",value:function(t){if(C.contains([xt.code.ENTER,xt.code.SPACE],t.keyCode)){var e=this.context.invoke("editor.createRange").getWordRange();this.lastWordRange=e}}},{key:"handleKeyup",value:function(t){C.contains([xt.code.ENTER,xt.code.SPACE],t.keyCode)&&this.replace()}}])&&Xt(e.prototype,n),o&&Xt(e,o),t}();function te(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}var ee=function(){function t(e){var n=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.$note=e.layoutInfo.note,this.events={"summernote.change":function(){n.$note.val(e.invoke("code"))}}}var e,n,o;return e=t,(n=[{key:"shouldInitialize",value:function(){return pt.isTextarea(this.$note[0])}}])&&te(e.prototype,n),o&&te(e,o),t}();function ne(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}var oe=function(){function t(e){var n=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.context=e,this.options=e.options.replace||{},this.keys=[xt.code.ENTER,xt.code.SPACE,xt.code.PERIOD,xt.code.COMMA,xt.code.SEMICOLON,xt.code.SLASH],this.previousKeydownCode=null,this.events={"summernote.keyup":function(t,e){e.isDefaultPrevented()||n.handleKeyup(e)},"summernote.keydown":function(t,e){n.handleKeydown(e)}}}var e,n,o;return e=t,(n=[{key:"shouldInitialize",value:function(){return!!this.options.match}},{key:"initialize",value:function(){this.lastWord=null}},{key:"destroy",value:function(){this.lastWord=null}},{key:"replace",value:function(){if(this.lastWord){var t=this,e=this.lastWord.toString();this.options.match(e,(function(e){if(e){var n="";if("string"==typeof e?n=pt.createText(e):e instanceof jQuery?n=e[0]:e instanceof Node&&(n=e),!n)return;t.lastWord.insertNode(n),t.lastWord=null,t.context.invoke("editor.focus")}}))}}},{key:"handleKeydown",value:function(t){if(this.previousKeydownCode&&C.contains(this.keys,this.previousKeydownCode))this.previousKeydownCode=t.keyCode;else{if(C.contains(this.keys,t.keyCode)){var e=this.context.invoke("editor.createRange").getWordRange();this.lastWord=e}this.previousKeydownCode=t.keyCode}}},{key:"handleKeyup",value:function(t){C.contains(this.keys,t.keyCode)&&this.replace()}}])&&ne(e.prototype,n),o&&ne(e,o),t}();function ie(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}var re=function(){function t(e){var n=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.context=e,this.$editingArea=e.layoutInfo.editingArea,this.options=e.options,!0===this.options.inheritPlaceholder&&(this.options.placeholder=this.context.$note.attr("placeholder")||this.options.placeholder),this.events={"summernote.init summernote.change":function(){n.update()},"summernote.codeview.toggled":function(){n.update()}}}var e,n,o;return e=t,(n=[{key:"shouldInitialize",value:function(){return!!this.options.placeholder}},{key:"initialize",value:function(){var t=this;this.$placeholder=i()('<div class="note-placeholder">'),this.$placeholder.on("click",(function(){t.context.invoke("focus")})).html(this.options.placeholder).prependTo(this.$editingArea),this.update()}},{key:"destroy",value:function(){this.$placeholder.remove()}},{key:"update",value:function(){var t=!this.context.invoke("codeview.isActivated")&&this.context.invoke("editor.isEmpty");this.$placeholder.toggle(t)}}])&&ie(e.prototype,n),o&&ie(e,o),t}();function ae(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}var se=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.ui=i.a.summernote.ui,this.context=e,this.$toolbar=e.layoutInfo.toolbar,this.options=e.options,this.lang=this.options.langInfo,this.invertedKeyMap=g.invertObject(this.options.keyMap[m.isMac?"mac":"pc"])}var e,n,o;return e=t,(n=[{key:"representShortcut",value:function(t){var e=this.invertedKeyMap[t];return this.options.shortcuts&&e?(m.isMac&&(e=e.replace("CMD","⌘").replace("SHIFT","⇧"))," ("+(e=e.replace("BACKSLASH","\\").replace("SLASH","/").replace("LEFTBRACKET","[").replace("RIGHTBRACKET","]"))+")"):""}},{key:"button",value:function(t){return!this.options.tooltip&&t.tooltip&&delete t.tooltip,t.container=this.options.container,this.ui.button(t)}},{key:"initialize",value:function(){this.addToolbarButtons(),this.addImagePopoverButtons(),this.addLinkPopoverButtons(),this.addTablePopoverButtons(),this.fontInstalledMap={}}},{key:"destroy",value:function(){delete this.fontInstalledMap}},{key:"isFontInstalled",value:function(t){return Object.prototype.hasOwnProperty.call(this.fontInstalledMap,t)||(this.fontInstalledMap[t]=m.isFontInstalled(t)||C.contains(this.options.fontNamesIgnoreCheck,t)),this.fontInstalledMap[t]}},{key:"isFontDeservedToAdd",value:function(t){return""!==(t=t.toLowerCase())&&this.isFontInstalled(t)&&-1===m.genericFontFamilies.indexOf(t)}},{key:"colorPalette",value:function(t,e,n,o){var r=this;return this.ui.buttonGroup({className:"note-color "+t,children:[this.button({className:"note-current-color-button",contents:this.ui.icon(this.options.icons.font+" note-recent-color"),tooltip:e,click:function(t){var e=i()(t.currentTarget);n&&o?r.context.invoke("editor.color",{backColor:e.attr("data-backColor"),foreColor:e.attr("data-foreColor")}):n?r.context.invoke("editor.color",{backColor:e.attr("data-backColor")}):o&&r.context.invoke("editor.color",{foreColor:e.attr("data-foreColor")})},callback:function(t){var e=t.find(".note-recent-color");n&&(e.css("background-color",r.options.colorButton.backColor),t.attr("data-backColor",r.options.colorButton.backColor)),o?(e.css("color",r.options.colorButton.foreColor),t.attr("data-foreColor",r.options.colorButton.foreColor)):e.css("color","transparent")}}),this.button({className:"dropdown-toggle",contents:this.ui.dropdownButtonContents("",this.options),tooltip:this.lang.color.more,data:{toggle:"dropdown"}}),this.ui.dropdown({items:(n?['<div class="note-palette">','<div class="note-palette-title">'+this.lang.color.background+"</div>","<div>",'<button type="button" class="note-color-reset btn btn-light btn-default" data-event="backColor" data-value="transparent">',this.lang.color.transparent,"</button>","</div>",'<div class="note-holder" data-event="backColor">\x3c!-- back colors --\x3e</div>',"<div>",'<button type="button" class="note-color-select btn btn-light btn-default" data-event="openPalette" data-value="backColorPicker">',this.lang.color.cpSelect,"</button>",'<input type="color" id="backColorPicker" class="note-btn note-color-select-btn" value="'+this.options.colorButton.backColor+'" data-event="backColorPalette">',"</div>",'<div class="note-holder-custom" id="backColorPalette" data-event="backColor"></div>',"</div>"].join(""):"")+(o?['<div class="note-palette">','<div class="note-palette-title">'+this.lang.color.foreground+"</div>","<div>",'<button type="button" class="note-color-reset btn btn-light btn-default" data-event="removeFormat" data-value="foreColor">',this.lang.color.resetToDefault,"</button>","</div>",'<div class="note-holder" data-event="foreColor">\x3c!-- fore colors --\x3e</div>',"<div>",'<button type="button" class="note-color-select btn btn-light btn-default" data-event="openPalette" data-value="foreColorPicker">',this.lang.color.cpSelect,"</button>",'<input type="color" id="foreColorPicker" class="note-btn note-color-select-btn" value="'+this.options.colorButton.foreColor+'" data-event="foreColorPalette">',"</div>",'<div class="note-holder-custom" id="foreColorPalette" data-event="foreColor"></div>',"</div>"].join(""):""),callback:function(t){t.find(".note-holder").each((function(t,e){var n=i()(e);n.append(r.ui.palette({colors:r.options.colors,colorsName:r.options.colorsName,eventName:n.data("event"),container:r.options.container,tooltip:r.options.tooltip}).render())}));var e=[["#FFFFFF","#FFFFFF","#FFFFFF","#FFFFFF","#FFFFFF","#FFFFFF","#FFFFFF","#FFFFFF"]];t.find(".note-holder-custom").each((function(t,n){var o=i()(n);o.append(r.ui.palette({colors:e,colorsName:e,eventName:o.data("event"),container:r.options.container,tooltip:r.options.tooltip}).render())})),t.find("input[type=color]").each((function(e,n){i()(n).change((function(){var e=t.find("#"+i()(this).data("event")).find(".note-color-btn").first(),n=this.value.toUpperCase();e.css("background-color",n).attr("aria-label",n).attr("data-value",n).attr("data-original-title",n),e.click()}))}))},click:function(e){e.stopPropagation();var n=i()("."+t).find(".note-dropdown-menu"),o=i()(e.target),a=o.data("event"),s=o.attr("data-value");if("openPalette"===a){var l=n.find("#"+s),c=i()(n.find("#"+l.data("event")).find(".note-color-row")[0]),u=c.find(".note-color-btn").last().detach(),d=l.val();u.css("background-color",d).attr("aria-label",d).attr("data-value",d).attr("data-original-title",d),c.prepend(u),l.click()}else{if(C.contains(["backColor","foreColor"],a)){var h="backColor"===a?"background-color":"color",f=o.closest(".note-color").find(".note-recent-color"),p=o.closest(".note-color").find(".note-current-color-button");f.css(h,s),p.attr("data-"+a,s)}r.context.invoke("editor."+a,s)}}})]}).render()}},{key:"addToolbarButtons",value:function(){var t=this;this.context.memo("button.style",(function(){return t.ui.buttonGroup([t.button({className:"dropdown-toggle",contents:t.ui.dropdownButtonContents(t.ui.icon(t.options.icons.magic),t.options),tooltip:t.lang.style.style,data:{toggle:"dropdown"}}),t.ui.dropdown({className:"dropdown-style",items:t.options.styleTags,title:t.lang.style.style,template:function(e){"string"==typeof e&&(e={tag:e,title:Object.prototype.hasOwnProperty.call(t.lang.style,e)?t.lang.style[e]:e});var n=e.tag,o=e.title;return"<"+n+(e.style?' style="'+e.style+'" ':"")+(e.className?' class="'+e.className+'"':"")+">"+o+"</"+n+">"},click:t.context.createInvokeHandler("editor.formatBlock")})]).render()}));for(var e=function(e,n){var o=t.options.styleTags[e];t.context.memo("button.style."+o,(function(){return t.button({className:"note-btn-style-"+o,contents:'<div data-value="'+o+'">'+o.toUpperCase()+"</div>",tooltip:t.lang.style[o],click:t.context.createInvokeHandler("editor.formatBlock")}).render()}))},n=0,o=this.options.styleTags.length;n<o;n++)e(n);this.context.memo("button.bold",(function(){return t.button({className:"note-btn-bold",contents:t.ui.icon(t.options.icons.bold),tooltip:t.lang.font.bold+t.representShortcut("bold"),click:t.context.createInvokeHandlerAndUpdateState("editor.bold")}).render()})),this.context.memo("button.italic",(function(){return t.button({className:"note-btn-italic",contents:t.ui.icon(t.options.icons.italic),tooltip:t.lang.font.italic+t.representShortcut("italic"),click:t.context.createInvokeHandlerAndUpdateState("editor.italic")}).render()})),this.context.memo("button.underline",(function(){return t.button({className:"note-btn-underline",contents:t.ui.icon(t.options.icons.underline),tooltip:t.lang.font.underline+t.representShortcut("underline"),click:t.context.createInvokeHandlerAndUpdateState("editor.underline")}).render()})),this.context.memo("button.clear",(function(){return t.button({contents:t.ui.icon(t.options.icons.eraser),tooltip:t.lang.font.clear+t.representShortcut("removeFormat"),click:t.context.createInvokeHandler("editor.removeFormat")}).render()})),this.context.memo("button.strikethrough",(function(){return t.button({className:"note-btn-strikethrough",contents:t.ui.icon(t.options.icons.strikethrough),tooltip:t.lang.font.strikethrough+t.representShortcut("strikethrough"),click:t.context.createInvokeHandlerAndUpdateState("editor.strikethrough")}).render()})),this.context.memo("button.superscript",(function(){return t.button({className:"note-btn-superscript",contents:t.ui.icon(t.options.icons.superscript),tooltip:t.lang.font.superscript,click:t.context.createInvokeHandlerAndUpdateState("editor.superscript")}).render()})),this.context.memo("button.subscript",(function(){return t.button({className:"note-btn-subscript",contents:t.ui.icon(t.options.icons.subscript),tooltip:t.lang.font.subscript,click:t.context.createInvokeHandlerAndUpdateState("editor.subscript")}).render()})),this.context.memo("button.fontname",(function(){var e=t.context.invoke("editor.currentStyle");return t.options.addDefaultFonts&&i.a.each(e["font-family"].split(","),(function(e,n){n=n.trim().replace(/['"]+/g,""),t.isFontDeservedToAdd(n)&&-1===t.options.fontNames.indexOf(n)&&t.options.fontNames.push(n)})),t.ui.buttonGroup([t.button({className:"dropdown-toggle",contents:t.ui.dropdownButtonContents('<span class="note-current-fontname"></span>',t.options),tooltip:t.lang.font.name,data:{toggle:"dropdown"}}),t.ui.dropdownCheck({className:"dropdown-fontname",checkClassName:t.options.icons.menuCheck,items:t.options.fontNames.filter(t.isFontInstalled.bind(t)),title:t.lang.font.name,template:function(t){return'<span style="font-family: '+m.validFontName(t)+'">'+t+"</span>"},click:t.context.createInvokeHandlerAndUpdateState("editor.fontName")})]).render()})),this.context.memo("button.fontsize",(function(){return t.ui.buttonGroup([t.button({className:"dropdown-toggle",contents:t.ui.dropdownButtonContents('<span class="note-current-fontsize"></span>',t.options),tooltip:t.lang.font.size,data:{toggle:"dropdown"}}),t.ui.dropdownCheck({className:"dropdown-fontsize",checkClassName:t.options.icons.menuCheck,items:t.options.fontSizes,title:t.lang.font.size,click:t.context.createInvokeHandlerAndUpdateState("editor.fontSize")})]).render()})),this.context.memo("button.fontsizeunit",(function(){return t.ui.buttonGroup([t.button({className:"dropdown-toggle",contents:t.ui.dropdownButtonContents('<span class="note-current-fontsizeunit"></span>',t.options),tooltip:t.lang.font.sizeunit,data:{toggle:"dropdown"}}),t.ui.dropdownCheck({className:"dropdown-fontsizeunit",checkClassName:t.options.icons.menuCheck,items:t.options.fontSizeUnits,title:t.lang.font.sizeunit,click:t.context.createInvokeHandlerAndUpdateState("editor.fontSizeUnit")})]).render()})),this.context.memo("button.color",(function(){return t.colorPalette("note-color-all",t.lang.color.recent,!0,!0)})),this.context.memo("button.forecolor",(function(){return t.colorPalette("note-color-fore",t.lang.color.foreground,!1,!0)})),this.context.memo("button.backcolor",(function(){return t.colorPalette("note-color-back",t.lang.color.background,!0,!1)})),this.context.memo("button.ul",(function(){return t.button({contents:t.ui.icon(t.options.icons.unorderedlist),tooltip:t.lang.lists.unordered+t.representShortcut("insertUnorderedList"),click:t.context.createInvokeHandler("editor.insertUnorderedList")}).render()})),this.context.memo("button.ol",(function(){return t.button({contents:t.ui.icon(t.options.icons.orderedlist),tooltip:t.lang.lists.ordered+t.representShortcut("insertOrderedList"),click:t.context.createInvokeHandler("editor.insertOrderedList")}).render()}));var r=this.button({contents:this.ui.icon(this.options.icons.alignLeft),tooltip:this.lang.paragraph.left+this.representShortcut("justifyLeft"),click:this.context.createInvokeHandler("editor.justifyLeft")}),a=this.button({contents:this.ui.icon(this.options.icons.alignCenter),tooltip:this.lang.paragraph.center+this.representShortcut("justifyCenter"),click:this.context.createInvokeHandler("editor.justifyCenter")}),s=this.button({contents:this.ui.icon(this.options.icons.alignRight),tooltip:this.lang.paragraph.right+this.representShortcut("justifyRight"),click:this.context.createInvokeHandler("editor.justifyRight")}),l=this.button({contents:this.ui.icon(this.options.icons.alignJustify),tooltip:this.lang.paragraph.justify+this.representShortcut("justifyFull"),click:this.context.createInvokeHandler("editor.justifyFull")}),c=this.button({contents:this.ui.icon(this.options.icons.outdent),tooltip:this.lang.paragraph.outdent+this.representShortcut("outdent"),click:this.context.createInvokeHandler("editor.outdent")}),u=this.button({contents:this.ui.icon(this.options.icons.indent),tooltip:this.lang.paragraph.indent+this.representShortcut("indent"),click:this.context.createInvokeHandler("editor.indent")});this.context.memo("button.justifyLeft",g.invoke(r,"render")),this.context.memo("button.justifyCenter",g.invoke(a,"render")),this.context.memo("button.justifyRight",g.invoke(s,"render")),this.context.memo("button.justifyFull",g.invoke(l,"render")),this.context.memo("button.outdent",g.invoke(c,"render")),this.context.memo("button.indent",g.invoke(u,"render")),this.context.memo("button.paragraph",(function(){return t.ui.buttonGroup([t.button({className:"dropdown-toggle",contents:t.ui.dropdownButtonContents(t.ui.icon(t.options.icons.alignLeft),t.options),tooltip:t.lang.paragraph.paragraph,data:{toggle:"dropdown"}}),t.ui.dropdown([t.ui.buttonGroup({className:"note-align",children:[r,a,s,l]}),t.ui.buttonGroup({className:"note-list",children:[c,u]})])]).render()})),this.context.memo("button.height",(function(){return t.ui.buttonGroup([t.button({className:"dropdown-toggle",contents:t.ui.dropdownButtonContents(t.ui.icon(t.options.icons.textHeight),t.options),tooltip:t.lang.font.height,data:{toggle:"dropdown"}}),t.ui.dropdownCheck({items:t.options.lineHeights,checkClassName:t.options.icons.menuCheck,className:"dropdown-line-height",title:t.lang.font.height,click:t.context.createInvokeHandler("editor.lineHeight")})]).render()})),this.context.memo("button.table",(function(){return t.ui.buttonGroup([t.button({className:"dropdown-toggle",contents:t.ui.dropdownButtonContents(t.ui.icon(t.options.icons.table),t.options),tooltip:t.lang.table.table,data:{toggle:"dropdown"}}),t.ui.dropdown({title:t.lang.table.table,className:"note-table",items:['<div class="note-dimension-picker">','<div class="note-dimension-picker-mousecatcher" data-event="insertTable" data-value="1x1"></div>','<div class="note-dimension-picker-highlighted"></div>','<div class="note-dimension-picker-unhighlighted"></div>',"</div>",'<div class="note-dimension-display">1 x 1</div>'].join("")})],{callback:function(e){e.find(".note-dimension-picker-mousecatcher").css({width:t.options.insertTableMaxSize.col+"em",height:t.options.insertTableMaxSize.row+"em"}).mousedown(t.context.createInvokeHandler("editor.insertTable")).on("mousemove",t.tableMoveHandler.bind(t))}}).render()})),this.context.memo("button.link",(function(){return t.button({contents:t.ui.icon(t.options.icons.link),tooltip:t.lang.link.link+t.representShortcut("linkDialog.show"),click:t.context.createInvokeHandler("linkDialog.show")}).render()})),this.context.memo("button.picture",(function(){return t.button({contents:t.ui.icon(t.options.icons.picture),tooltip:t.lang.image.image,click:t.context.createInvokeHandler("imageDialog.show")}).render()})),this.context.memo("button.video",(function(){return t.button({contents:t.ui.icon(t.options.icons.video),tooltip:t.lang.video.video,click:t.context.createInvokeHandler("videoDialog.show")}).render()})),this.context.memo("button.hr",(function(){return t.button({contents:t.ui.icon(t.options.icons.minus),tooltip:t.lang.hr.insert+t.representShortcut("insertHorizontalRule"),click:t.context.createInvokeHandler("editor.insertHorizontalRule")}).render()})),this.context.memo("button.fullscreen",(function(){return t.button({className:"btn-fullscreen note-codeview-keep",contents:t.ui.icon(t.options.icons.arrowsAlt),tooltip:t.lang.options.fullscreen,click:t.context.createInvokeHandler("fullscreen.toggle")}).render()})),this.context.memo("button.codeview",(function(){return t.button({className:"btn-codeview note-codeview-keep",contents:t.ui.icon(t.options.icons.code),tooltip:t.lang.options.codeview,click:t.context.createInvokeHandler("codeview.toggle")}).render()})),this.context.memo("button.redo",(function(){return t.button({contents:t.ui.icon(t.options.icons.redo),tooltip:t.lang.history.redo+t.representShortcut("redo"),click:t.context.createInvokeHandler("editor.redo")}).render()})),this.context.memo("button.undo",(function(){return t.button({contents:t.ui.icon(t.options.icons.undo),tooltip:t.lang.history.undo+t.representShortcut("undo"),click:t.context.createInvokeHandler("editor.undo")}).render()})),this.context.memo("button.help",(function(){return t.button({contents:t.ui.icon(t.options.icons.question),tooltip:t.lang.options.help,click:t.context.createInvokeHandler("helpDialog.show")}).render()}))}},{key:"addImagePopoverButtons",value:function(){var t=this;this.context.memo("button.resizeFull",(function(){return t.button({contents:'<span class="note-fontsize-10">100%</span>',tooltip:t.lang.image.resizeFull,click:t.context.createInvokeHandler("editor.resize","1")}).render()})),this.context.memo("button.resizeHalf",(function(){return t.button({contents:'<span class="note-fontsize-10">50%</span>',tooltip:t.lang.image.resizeHalf,click:t.context.createInvokeHandler("editor.resize","0.5")}).render()})),this.context.memo("button.resizeQuarter",(function(){return t.button({contents:'<span class="note-fontsize-10">25%</span>',tooltip:t.lang.image.resizeQuarter,click:t.context.createInvokeHandler("editor.resize","0.25")}).render()})),this.context.memo("button.resizeNone",(function(){return t.button({contents:t.ui.icon(t.options.icons.rollback),tooltip:t.lang.image.resizeNone,click:t.context.createInvokeHandler("editor.resize","0")}).render()})),this.context.memo("button.floatLeft",(function(){return t.button({contents:t.ui.icon(t.options.icons.floatLeft),tooltip:t.lang.image.floatLeft,click:t.context.createInvokeHandler("editor.floatMe","left")}).render()})),this.context.memo("button.floatRight",(function(){return t.button({contents:t.ui.icon(t.options.icons.floatRight),tooltip:t.lang.image.floatRight,click:t.context.createInvokeHandler("editor.floatMe","right")}).render()})),this.context.memo("button.floatNone",(function(){return t.button({contents:t.ui.icon(t.options.icons.rollback),tooltip:t.lang.image.floatNone,click:t.context.createInvokeHandler("editor.floatMe","none")}).render()})),this.context.memo("button.removeMedia",(function(){return t.button({contents:t.ui.icon(t.options.icons.trash),tooltip:t.lang.image.remove,click:t.context.createInvokeHandler("editor.removeMedia")}).render()}))}},{key:"addLinkPopoverButtons",value:function(){var t=this;this.context.memo("button.linkDialogShow",(function(){return t.button({contents:t.ui.icon(t.options.icons.link),tooltip:t.lang.link.edit,click:t.context.createInvokeHandler("linkDialog.show")}).render()})),this.context.memo("button.unlink",(function(){return t.button({contents:t.ui.icon(t.options.icons.unlink),tooltip:t.lang.link.unlink,click:t.context.createInvokeHandler("editor.unlink")}).render()}))}},{key:"addTablePopoverButtons",value:function(){var t=this;this.context.memo("button.addRowUp",(function(){return t.button({className:"btn-md",contents:t.ui.icon(t.options.icons.rowAbove),tooltip:t.lang.table.addRowAbove,click:t.context.createInvokeHandler("editor.addRow","top")}).render()})),this.context.memo("button.addRowDown",(function(){return t.button({className:"btn-md",contents:t.ui.icon(t.options.icons.rowBelow),tooltip:t.lang.table.addRowBelow,click:t.context.createInvokeHandler("editor.addRow","bottom")}).render()})),this.context.memo("button.addColLeft",(function(){return t.button({className:"btn-md",contents:t.ui.icon(t.options.icons.colBefore),tooltip:t.lang.table.addColLeft,click:t.context.createInvokeHandler("editor.addCol","left")}).render()})),this.context.memo("button.addColRight",(function(){return t.button({className:"btn-md",contents:t.ui.icon(t.options.icons.colAfter),tooltip:t.lang.table.addColRight,click:t.context.createInvokeHandler("editor.addCol","right")}).render()})),this.context.memo("button.deleteRow",(function(){return t.button({className:"btn-md",contents:t.ui.icon(t.options.icons.rowRemove),tooltip:t.lang.table.delRow,click:t.context.createInvokeHandler("editor.deleteRow")}).render()})),this.context.memo("button.deleteCol",(function(){return t.button({className:"btn-md",contents:t.ui.icon(t.options.icons.colRemove),tooltip:t.lang.table.delCol,click:t.context.createInvokeHandler("editor.deleteCol")}).render()})),this.context.memo("button.deleteTable",(function(){return t.button({className:"btn-md",contents:t.ui.icon(t.options.icons.trash),tooltip:t.lang.table.delTable,click:t.context.createInvokeHandler("editor.deleteTable")}).render()}))}},{key:"build",value:function(t,e){for(var n=0,o=e.length;n<o;n++){for(var i=e[n],r=Array.isArray(i)?i[0]:i,a=Array.isArray(i)?1===i.length?[i[0]]:i[1]:[i],s=this.ui.buttonGroup({className:"note-"+r}).render(),l=0,c=a.length;l<c;l++){var u=this.context.memo("button."+a[l]);u&&s.append("function"==typeof u?u(this.context):u)}s.appendTo(t)}}},{key:"updateCurrentStyle",value:function(t){var e=this,n=t||this.$toolbar,o=this.context.invoke("editor.currentStyle");if(this.updateBtnStates(n,{".note-btn-bold":function(){return"bold"===o["font-bold"]},".note-btn-italic":function(){return"italic"===o["font-italic"]},".note-btn-underline":function(){return"underline"===o["font-underline"]},".note-btn-subscript":function(){return"subscript"===o["font-subscript"]},".note-btn-superscript":function(){return"superscript"===o["font-superscript"]},".note-btn-strikethrough":function(){return"strikethrough"===o["font-strikethrough"]}}),o["font-family"]){var r=o["font-family"].split(",").map((function(t){return t.replace(/[\'\"]/g,"").replace(/\s+$/,"").replace(/^\s+/,"")})),a=C.find(r,this.isFontInstalled.bind(this));n.find(".dropdown-fontname a").each((function(t,e){var n=i()(e),o=n.data("value")+""==a+"";n.toggleClass("checked",o)})),n.find(".note-current-fontname").text(a).css("font-family",a)}if(o["font-size"]){var s=o["font-size"];n.find(".dropdown-fontsize a").each((function(t,e){var n=i()(e),o=n.data("value")+""==s+"";n.toggleClass("checked",o)})),n.find(".note-current-fontsize").text(s);var l=o["font-size-unit"];n.find(".dropdown-fontsizeunit a").each((function(t,e){var n=i()(e),o=n.data("value")+""==l+"";n.toggleClass("checked",o)})),n.find(".note-current-fontsizeunit").text(l)}if(o["line-height"]){var c=o["line-height"];n.find(".dropdown-line-height li a").each((function(t,n){var o=i()(n).data("value")+""==c+"";e.className=o?"checked":""}))}}},{key:"updateBtnStates",value:function(t,e){var n=this;i.a.each(e,(function(e,o){n.ui.toggleBtnActive(t.find(e),o())}))}},{key:"tableMoveHandler",value:function(t){var e,n=i()(t.target.parentNode),o=n.next(),r=n.find(".note-dimension-picker-mousecatcher"),a=n.find(".note-dimension-picker-highlighted"),s=n.find(".note-dimension-picker-unhighlighted");if(void 0===t.offsetX){var l=i()(t.target).offset();e={x:t.pageX-l.left,y:t.pageY-l.top}}else e={x:t.offsetX,y:t.offsetY};var c=Math.ceil(e.x/18)||1,u=Math.ceil(e.y/18)||1;a.css({width:c+"em",height:u+"em"}),r.data("value",c+"x"+u),c>3&&c<this.options.insertTableMaxSize.col&&s.css({width:c+1+"em"}),u>3&&u<this.options.insertTableMaxSize.row&&s.css({height:u+1+"em"}),o.html(c+" x "+u)}}])&&ae(e.prototype,n),o&&ae(e,o),t}();function le(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}var ce=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.context=e,this.$window=i()(window),this.$document=i()(document),this.ui=i.a.summernote.ui,this.$note=e.layoutInfo.note,this.$editor=e.layoutInfo.editor,this.$toolbar=e.layoutInfo.toolbar,this.$editable=e.layoutInfo.editable,this.$statusbar=e.layoutInfo.statusbar,this.options=e.options,this.isFollowing=!1,this.followScroll=this.followScroll.bind(this)}var e,n,o;return e=t,(n=[{key:"shouldInitialize",value:function(){return!this.options.airMode}},{key:"initialize",value:function(){var t=this;this.options.toolbar=this.options.toolbar||[],this.options.toolbar.length?this.context.invoke("buttons.build",this.$toolbar,this.options.toolbar):this.$toolbar.hide(),this.options.toolbarContainer&&this.$toolbar.appendTo(this.options.toolbarContainer),this.changeContainer(!1),this.$note.on("summernote.keyup summernote.mouseup summernote.change",(function(){t.context.invoke("buttons.updateCurrentStyle")})),this.context.invoke("buttons.updateCurrentStyle"),this.options.followingToolbar&&this.$window.on("scroll resize",this.followScroll)}},{key:"destroy",value:function(){this.$toolbar.children().remove(),this.options.followingToolbar&&this.$window.off("scroll resize",this.followScroll)}},{key:"followScroll",value:function(){if(this.$editor.hasClass("fullscreen"))return!1;var t=this.$editor.outerHeight(),e=this.$editor.width(),n=this.$toolbar.height(),o=this.$statusbar.height(),r=0;this.options.otherStaticBar&&(r=i()(this.options.otherStaticBar).outerHeight());var a=this.$document.scrollTop(),s=this.$editor.offset().top,l=s-r,c=s+t-r-n-o;!this.isFollowing&&a>l&&a<c-n?(this.isFollowing=!0,this.$editable.css({marginTop:this.$toolbar.outerHeight()}),this.$toolbar.css({position:"fixed",top:r,width:e,zIndex:1e3})):this.isFollowing&&(a<l||a>c)&&(this.isFollowing=!1,this.$toolbar.css({position:"relative",top:0,width:"100%",zIndex:"auto"}),this.$editable.css({marginTop:""}))}},{key:"changeContainer",value:function(t){t?this.$toolbar.prependTo(this.$editor):this.options.toolbarContainer&&this.$toolbar.appendTo(this.options.toolbarContainer),this.options.followingToolbar&&this.followScroll()}},{key:"updateFullscreen",value:function(t){this.ui.toggleBtnActive(this.$toolbar.find(".btn-fullscreen"),t),this.changeContainer(t)}},{key:"updateCodeview",value:function(t){this.ui.toggleBtnActive(this.$toolbar.find(".btn-codeview"),t),t?this.deactivate():this.activate()}},{key:"activate",value:function(t){var e=this.$toolbar.find("button");t||(e=e.not(".note-codeview-keep")),this.ui.toggleBtn(e,!0)}},{key:"deactivate",value:function(t){var e=this.$toolbar.find("button");t||(e=e.not(".note-codeview-keep")),this.ui.toggleBtn(e,!1)}}])&&le(e.prototype,n),o&&le(e,o),t}();function ue(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}var de=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.context=e,this.ui=i.a.summernote.ui,this.$body=i()(document.body),this.$editor=e.layoutInfo.editor,this.options=e.options,this.lang=this.options.langInfo,e.memo("help.linkDialog.show",this.options.langInfo.help["linkDialog.show"])}var e,n,o;return e=t,(n=[{key:"initialize",value:function(){var t=this.options.dialogsInBody?this.$body:this.options.container,e=['<div class="form-group note-form-group">','<label for="note-dialog-link-txt-'.concat(this.options.id,'" class="note-form-label">').concat(this.lang.link.textToDisplay,"</label>"),'<input id="note-dialog-link-txt-'.concat(this.options.id,'" class="note-link-text form-control note-form-control note-input" type="text"/>'),"</div>",'<div class="form-group note-form-group">','<label for="note-dialog-link-url-'.concat(this.options.id,'" class="note-form-label">').concat(this.lang.link.url,"</label>"),'<input id="note-dialog-link-url-'.concat(this.options.id,'" class="note-link-url form-control note-form-control note-input" type="text" value="http://"/>'),"</div>",this.options.disableLinkTarget?"":i()("<div/>").append(this.ui.checkbox({className:"sn-checkbox-open-in-new-window",text:this.lang.link.openInNewWindow,checked:!0}).render()).html(),i()("<div/>").append(this.ui.checkbox({className:"sn-checkbox-use-protocol",text:this.lang.link.useProtocol,checked:!0}).render()).html()].join(""),n='<input type="button" href="#" class="'.concat("btn btn-primary note-btn note-btn-primary note-link-btn",'" value="').concat(this.lang.link.insert,'" disabled>');this.$dialog=this.ui.dialog({className:"link-dialog",title:this.lang.link.insert,fade:this.options.dialogsFade,body:e,footer:n}).render().appendTo(t)}},{key:"destroy",value:function(){this.ui.hideDialog(this.$dialog),this.$dialog.remove()}},{key:"bindEnterKey",value:function(t,e){t.on("keypress",(function(t){t.keyCode===xt.code.ENTER&&(t.preventDefault(),e.trigger("click"))}))}},{key:"toggleLinkBtn",value:function(t,e,n){this.ui.toggleBtn(t,e.val()&&n.val())}},{key:"showLinkDialog",value:function(t){var e=this;return i.a.Deferred((function(n){var o=e.$dialog.find(".note-link-text"),i=e.$dialog.find(".note-link-url"),r=e.$dialog.find(".note-link-btn"),a=e.$dialog.find(".sn-checkbox-open-in-new-window input[type=checkbox]"),s=e.$dialog.find(".sn-checkbox-use-protocol input[type=checkbox]");e.ui.onDialogShown(e.$dialog,(function(){e.context.triggerEvent("dialog.shown"),!t.url&&g.isValidUrl(t.text)&&(t.url=t.text),o.on("input paste propertychange",(function(){t.text=o.val(),e.toggleLinkBtn(r,o,i)})).val(t.text),i.on("input paste propertychange",(function(){t.text||o.val(i.val()),e.toggleLinkBtn(r,o,i)})).val(t.url),m.isSupportTouch||i.trigger("focus"),e.toggleLinkBtn(r,o,i),e.bindEnterKey(i,r),e.bindEnterKey(o,r);var l=void 0!==t.isNewWindow?t.isNewWindow:e.context.options.linkTargetBlank;a.prop("checked",l);var c=!t.url&&e.context.options.useProtocol;s.prop("checked",c),r.one("click",(function(r){r.preventDefault(),n.resolve({range:t.range,url:i.val(),text:o.val(),isNewWindow:a.is(":checked"),checkProtocol:s.is(":checked")}),e.ui.hideDialog(e.$dialog)}))})),e.ui.onDialogHidden(e.$dialog,(function(){o.off(),i.off(),r.off(),"pending"===n.state()&&n.reject()})),e.ui.showDialog(e.$dialog)})).promise()}},{key:"show",value:function(){var t=this,e=this.context.invoke("editor.getLinkInfo");this.context.invoke("editor.saveRange"),this.showLinkDialog(e).then((function(e){t.context.invoke("editor.restoreRange"),t.context.invoke("editor.createLink",e)})).fail((function(){t.context.invoke("editor.restoreRange")}))}}])&&ue(e.prototype,n),o&&ue(e,o),t}();function he(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}var fe=function(){function t(e){var n=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.context=e,this.ui=i.a.summernote.ui,this.options=e.options,this.events={"summernote.keyup summernote.mouseup summernote.change summernote.scroll":function(){n.update()},"summernote.disable summernote.dialog.shown summernote.blur":function(){n.hide()}}}var e,n,o;return e=t,(n=[{key:"shouldInitialize",value:function(){return!C.isEmpty(this.options.popover.link)}},{key:"initialize",value:function(){this.$popover=this.ui.popover({className:"note-link-popover",callback:function(t){t.find(".popover-content,.note-popover-content").prepend('<span><a target="_blank"></a>&nbsp;</span>')}}).render().appendTo(this.options.container);var t=this.$popover.find(".popover-content,.note-popover-content");this.context.invoke("buttons.build",t,this.options.popover.link),this.$popover.on("mousedown",(function(t){t.preventDefault()}))}},{key:"destroy",value:function(){this.$popover.remove()}},{key:"update",value:function(){if(this.context.invoke("editor.hasFocus")){var t=this.context.invoke("editor.getLastRange");if(t.isCollapsed()&&t.isOnAnchor()){var e=pt.ancestor(t.sc,pt.isAnchor),n=i()(e).attr("href");this.$popover.find("a").attr("href",n).text(n);var o=pt.posFromPlaceholder(e),r=i()(this.options.container).offset();o.top-=r.top,o.left-=r.left,this.$popover.css({display:"block",left:o.left,top:o.top})}else this.hide()}else this.hide()}},{key:"hide",value:function(){this.$popover.hide()}}])&&he(e.prototype,n),o&&he(e,o),t}();function pe(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}var me=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.context=e,this.ui=i.a.summernote.ui,this.$body=i()(document.body),this.$editor=e.layoutInfo.editor,this.options=e.options,this.lang=this.options.langInfo}var e,n,o;return e=t,(n=[{key:"initialize",value:function(){var t="";if(this.options.maximumImageFileSize){var e=Math.floor(Math.log(this.options.maximumImageFileSize)/Math.log(1024)),n=1*(this.options.maximumImageFileSize/Math.pow(1024,e)).toFixed(2)+" "+" KMGTP"[e]+"B";t="<small>".concat(this.lang.image.maximumFileSize+" : "+n,"</small>")}var o=this.options.dialogsInBody?this.$body:this.options.container,i=['<div class="form-group note-form-group note-group-select-from-files">','<label for="note-dialog-image-file-'+this.options.id+'" class="note-form-label">'+this.lang.image.selectFromFiles+"</label>",'<input id="note-dialog-image-file-'+this.options.id+'" class="note-image-input form-control-file note-form-control note-input" ',' type="file" name="files" accept="image/*" multiple="multiple"/>',t,"</div>",'<div class="form-group note-group-image-url">','<label for="note-dialog-image-url-'+this.options.id+'" class="note-form-label">'+this.lang.image.url+"</label>",'<input id="note-dialog-image-url-'+this.options.id+'" class="note-image-url form-control note-form-control note-input" type="text"/>',"</div>"].join(""),r='<input type="button" href="#" class="'.concat("btn btn-primary note-btn note-btn-primary note-image-btn",'" value="').concat(this.lang.image.insert,'" disabled>');this.$dialog=this.ui.dialog({title:this.lang.image.insert,fade:this.options.dialogsFade,body:i,footer:r}).render().appendTo(o)}},{key:"destroy",value:function(){this.ui.hideDialog(this.$dialog),this.$dialog.remove()}},{key:"bindEnterKey",value:function(t,e){t.on("keypress",(function(t){t.keyCode===xt.code.ENTER&&(t.preventDefault(),e.trigger("click"))}))}},{key:"show",value:function(){var t=this;this.context.invoke("editor.saveRange"),this.showImageDialog().then((function(e){t.ui.hideDialog(t.$dialog),t.context.invoke("editor.restoreRange"),"string"==typeof e?t.options.callbacks.onImageLinkInsert?t.context.triggerEvent("image.link.insert",e):t.context.invoke("editor.insertImage",e):t.context.invoke("editor.insertImagesOrCallback",e)})).fail((function(){t.context.invoke("editor.restoreRange")}))}},{key:"showImageDialog",value:function(){var t=this;return i.a.Deferred((function(e){var n=t.$dialog.find(".note-image-input"),o=t.$dialog.find(".note-image-url"),i=t.$dialog.find(".note-image-btn");t.ui.onDialogShown(t.$dialog,(function(){t.context.triggerEvent("dialog.shown"),n.replaceWith(n.clone().on("change",(function(t){e.resolve(t.target.files||t.target.value)})).val("")),o.on("input paste propertychange",(function(){t.ui.toggleBtn(i,o.val())})).val(""),m.isSupportTouch||o.trigger("focus"),i.click((function(t){t.preventDefault(),e.resolve(o.val())})),t.bindEnterKey(o,i)})),t.ui.onDialogHidden(t.$dialog,(function(){n.off(),o.off(),i.off(),"pending"===e.state()&&e.reject()})),t.ui.showDialog(t.$dialog)}))}}])&&pe(e.prototype,n),o&&pe(e,o),t}();function ve(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}var ge=function(){function t(e){var n=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.context=e,this.ui=i.a.summernote.ui,this.editable=e.layoutInfo.editable[0],this.options=e.options,this.events={"summernote.disable summernote.blur":function(){n.hide()}}}var e,n,o;return e=t,(n=[{key:"shouldInitialize",value:function(){return!C.isEmpty(this.options.popover.image)}},{key:"initialize",value:function(){this.$popover=this.ui.popover({className:"note-image-popover"}).render().appendTo(this.options.container);var t=this.$popover.find(".popover-content,.note-popover-content");this.context.invoke("buttons.build",t,this.options.popover.image),this.$popover.on("mousedown",(function(t){t.preventDefault()}))}},{key:"destroy",value:function(){this.$popover.remove()}},{key:"update",value:function(t,e){if(pt.isImg(t)){var n=i()(t).offset(),o=i()(this.options.container).offset(),r={};this.options.popatmouse?(r.left=e.pageX-20,r.top=e.pageY):r=n,r.top-=o.top,r.left-=o.left,this.$popover.css({display:"block",left:r.left,top:r.top})}else this.hide()}},{key:"hide",value:function(){this.$popover.hide()}}])&&ve(e.prototype,n),o&&ve(e,o),t}();function be(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}var ke=function(){function t(e){var n=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.context=e,this.ui=i.a.summernote.ui,this.options=e.options,this.events={"summernote.mousedown":function(t,e){n.update(e.target)},"summernote.keyup summernote.scroll summernote.change":function(){n.update()},"summernote.disable summernote.blur":function(){n.hide()}}}var e,n,o;return e=t,(n=[{key:"shouldInitialize",value:function(){return!C.isEmpty(this.options.popover.table)}},{key:"initialize",value:function(){this.$popover=this.ui.popover({className:"note-table-popover"}).render().appendTo(this.options.container);var t=this.$popover.find(".popover-content,.note-popover-content");this.context.invoke("buttons.build",t,this.options.popover.table),m.isFF&&document.execCommand("enableInlineTableEditing",!1,!1),this.$popover.on("mousedown",(function(t){t.preventDefault()}))}},{key:"destroy",value:function(){this.$popover.remove()}},{key:"update",value:function(t){if(this.context.isDisabled())return!1;var e=pt.isCell(t);if(e){var n=pt.posFromPlaceholder(t),o=i()(this.options.container).offset();n.top-=o.top,n.left-=o.left,this.$popover.css({display:"block",left:n.left,top:n.top})}else this.hide();return e}},{key:"hide",value:function(){this.$popover.hide()}}])&&be(e.prototype,n),o&&be(e,o),t}();function ye(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}var we=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.context=e,this.ui=i.a.summernote.ui,this.$body=i()(document.body),this.$editor=e.layoutInfo.editor,this.options=e.options,this.lang=this.options.langInfo}var e,n,o;return e=t,(n=[{key:"initialize",value:function(){var t=this.options.dialogsInBody?this.$body:this.options.container,e=['<div class="form-group note-form-group row-fluid">','<label for="note-dialog-video-url-'.concat(this.options.id,'" class="note-form-label">').concat(this.lang.video.url,' <small class="text-muted">').concat(this.lang.video.providers,"</small></label>"),'<input id="note-dialog-video-url-'.concat(this.options.id,'" class="note-video-url form-control note-form-control note-input" type="text"/>'),"</div>"].join(""),n='<input type="button" href="#" class="'.concat("btn btn-primary note-btn note-btn-primary note-video-btn",'" value="').concat(this.lang.video.insert,'" disabled>');this.$dialog=this.ui.dialog({title:this.lang.video.insert,fade:this.options.dialogsFade,body:e,footer:n}).render().appendTo(t)}},{key:"destroy",value:function(){this.ui.hideDialog(this.$dialog),this.$dialog.remove()}},{key:"bindEnterKey",value:function(t,e){t.on("keypress",(function(t){t.keyCode===xt.code.ENTER&&(t.preventDefault(),e.trigger("click"))}))}},{key:"createVideoNode",value:function(t){var e,n=t.match(/\/\/(?:(?:www|m)\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))([\w|-]{11})(?:(?:[\?&]t=)(\S+))?$/),o=t.match(/(?:www\.|\/\/)instagram\.com\/p\/(.[a-zA-Z0-9_-]*)/),r=t.match(/\/\/vine\.co\/v\/([a-zA-Z0-9]+)/),a=t.match(/\/\/(player\.)?vimeo\.com\/([a-z]*\/)*(\d+)[?]?.*/),s=t.match(/.+dailymotion.com\/(video|hub)\/([^_]+)[^#]*(#video=([^_&]+))?/),l=t.match(/\/\/v\.youku\.com\/v_show\/id_(\w+)=*\.html/),c=t.match(/\/\/v\.qq\.com.*?vid=(.+)/),u=t.match(/\/\/v\.qq\.com\/x?\/?(page|cover).*?\/([^\/]+)\.html\??.*/),d=t.match(/^.+.(mp4|m4v)$/),h=t.match(/^.+.(ogg|ogv)$/),f=t.match(/^.+.(webm)$/),p=t.match(/(?:www\.|\/\/)facebook\.com\/([^\/]+)\/videos\/([0-9]+)/);if(n&&11===n[1].length){var m=n[1],v=0;if(void 0!==n[2]){var g=n[2].match(/^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?$/);if(g)for(var b=[3600,60,1],k=0,y=b.length;k<y;k++)v+=void 0!==g[k+1]?b[k]*parseInt(g[k+1],10):0}e=i()("<iframe>").attr("frameborder",0).attr("src","//www.youtube.com/embed/"+m+(v>0?"?start="+v:"")).attr("width","640").attr("height","360")}else if(o&&o[0].length)e=i()("<iframe>").attr("frameborder",0).attr("src","https://instagram.com/p/"+o[1]+"/embed/").attr("width","612").attr("height","710").attr("scrolling","no").attr("allowtransparency","true");else if(r&&r[0].length)e=i()("<iframe>").attr("frameborder",0).attr("src",r[0]+"/embed/simple").attr("width","600").attr("height","600").attr("class","vine-embed");else if(a&&a[3].length)e=i()("<iframe webkitallowfullscreen mozallowfullscreen allowfullscreen>").attr("frameborder",0).attr("src","//player.vimeo.com/video/"+a[3]).attr("width","640").attr("height","360");else if(s&&s[2].length)e=i()("<iframe>").attr("frameborder",0).attr("src","//www.dailymotion.com/embed/video/"+s[2]).attr("width","640").attr("height","360");else if(l&&l[1].length)e=i()("<iframe webkitallowfullscreen mozallowfullscreen allowfullscreen>").attr("frameborder",0).attr("height","498").attr("width","510").attr("src","//player.youku.com/embed/"+l[1]);else if(c&&c[1].length||u&&u[2].length){var w=c&&c[1].length?c[1]:u[2];e=i()("<iframe webkitallowfullscreen mozallowfullscreen allowfullscreen>").attr("frameborder",0).attr("height","310").attr("width","500").attr("src","https://v.qq.com/txp/iframe/player.html?vid="+w+"&amp;auto=0")}else if(d||h||f)e=i()("<video controls>").attr("src",t).attr("width","640").attr("height","360");else{if(!p||!p[0].length)return!1;e=i()("<iframe>").attr("frameborder",0).attr("src","https://www.facebook.com/plugins/video.php?href="+encodeURIComponent(p[0])+"&show_text=0&width=560").attr("width","560").attr("height","301").attr("scrolling","no").attr("allowtransparency","true")}return e.addClass("note-video-clip"),e[0]}},{key:"show",value:function(){var t=this,e=this.context.invoke("editor.getSelectedText");this.context.invoke("editor.saveRange"),this.showVideoDialog(e).then((function(e){t.ui.hideDialog(t.$dialog),t.context.invoke("editor.restoreRange");var n=t.createVideoNode(e);n&&t.context.invoke("editor.insertNode",n)})).fail((function(){t.context.invoke("editor.restoreRange")}))}},{key:"showVideoDialog",value:function(){var t=this;return i.a.Deferred((function(e){var n=t.$dialog.find(".note-video-url"),o=t.$dialog.find(".note-video-btn");t.ui.onDialogShown(t.$dialog,(function(){t.context.triggerEvent("dialog.shown"),n.on("input paste propertychange",(function(){t.ui.toggleBtn(o,n.val())})),m.isSupportTouch||n.trigger("focus"),o.click((function(t){t.preventDefault(),e.resolve(n.val())})),t.bindEnterKey(n,o)})),t.ui.onDialogHidden(t.$dialog,(function(){n.off(),o.off(),"pending"===e.state()&&e.reject()})),t.ui.showDialog(t.$dialog)}))}}])&&ye(e.prototype,n),o&&ye(e,o),t}();function Ce(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}var xe=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.context=e,this.ui=i.a.summernote.ui,this.$body=i()(document.body),this.$editor=e.layoutInfo.editor,this.options=e.options,this.lang=this.options.langInfo}var e,n,o;return e=t,(n=[{key:"initialize",value:function(){var t=this.options.dialogsInBody?this.$body:this.options.container,e=['<p class="text-center">','<a href="http://summernote.org/" target="_blank">Summernote 0.8.18</a> · ','<a href="https://github.com/summernote/summernote" target="_blank">Project</a> · ','<a href="https://github.com/summernote/summernote/issues" target="_blank">Issues</a>',"</p>"].join("");this.$dialog=this.ui.dialog({title:this.lang.options.help,fade:this.options.dialogsFade,body:this.createShortcutList(),footer:e,callback:function(t){t.find(".modal-body,.note-modal-body").css({"max-height":300,overflow:"scroll"})}}).render().appendTo(t)}},{key:"destroy",value:function(){this.ui.hideDialog(this.$dialog),this.$dialog.remove()}},{key:"createShortcutList",value:function(){var t=this,e=this.options.keyMap[m.isMac?"mac":"pc"];return Object.keys(e).map((function(n){var o=e[n],r=i()('<div><div class="help-list-item"></div></div>');return r.append(i()("<label><kbd>"+n+"</kdb></label>").css({width:180,"margin-right":10})).append(i()("<span/>").html(t.context.memo("help."+o)||o)),r.html()})).join("")}},{key:"showHelpDialog",value:function(){var t=this;return i.a.Deferred((function(e){t.ui.onDialogShown(t.$dialog,(function(){t.context.triggerEvent("dialog.shown"),e.resolve()})),t.ui.showDialog(t.$dialog)})).promise()}},{key:"show",value:function(){var t=this;this.context.invoke("editor.saveRange"),this.showHelpDialog().then((function(){t.context.invoke("editor.restoreRange")}))}}])&&Ce(e.prototype,n),o&&Ce(e,o),t}();function Se(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}var Te=function(){function t(e){var n=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.context=e,this.ui=i.a.summernote.ui,this.options=e.options,this.hidable=!0,this.onContextmenu=!1,this.pageX=null,this.pageY=null,this.events={"summernote.contextmenu":function(t){n.options.editing&&(t.preventDefault(),t.stopPropagation(),n.onContextmenu=!0,n.update(!0))},"summernote.mousedown":function(t,e){n.pageX=e.pageX,n.pageY=e.pageY},"summernote.keyup summernote.mouseup summernote.scroll":function(t,e){n.options.editing&&!n.onContextmenu&&(n.pageX=e.pageX,n.pageY=e.pageY,n.update()),n.onContextmenu=!1},"summernote.disable summernote.change summernote.dialog.shown summernote.blur":function(){n.hide()},"summernote.focusout":function(){n.$popover.is(":active,:focus")||n.hide()}}}var e,n,o;return e=t,(n=[{key:"shouldInitialize",value:function(){return this.options.airMode&&!C.isEmpty(this.options.popover.air)}},{key:"initialize",value:function(){var t=this;this.$popover=this.ui.popover({className:"note-air-popover"}).render().appendTo(this.options.container);var e=this.$popover.find(".popover-content");this.context.invoke("buttons.build",e,this.options.popover.air),this.$popover.on("mousedown",(function(){t.hidable=!1})),this.$popover.on("mouseup",(function(){t.hidable=!0}))}},{key:"destroy",value:function(){this.$popover.remove()}},{key:"update",value:function(t){var e=this.context.invoke("editor.currentStyle");if(!e.range||e.range.isCollapsed()&&!t)this.hide();else{var n={left:this.pageX,top:this.pageY},o=i()(this.options.container).offset();n.top-=o.top,n.left-=o.left,this.$popover.css({display:"block",left:Math.max(n.left,0)+-5,top:n.top+5}),this.context.invoke("buttons.updateCurrentStyle",this.$popover)}}},{key:"updateCodeview",value:function(t){this.ui.toggleBtnActive(this.$popover.find(".btn-codeview"),t),t&&this.hide()}},{key:"hide",value:function(){this.hidable&&this.$popover.hide()}}])&&Se(e.prototype,n),o&&Se(e,o),t}();function Ee(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}var $e=function(){function t(e){var n=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.context=e,this.ui=i.a.summernote.ui,this.$editable=e.layoutInfo.editable,this.options=e.options,this.hint=this.options.hint||[],this.direction=this.options.hintDirection||"bottom",this.hints=Array.isArray(this.hint)?this.hint:[this.hint],this.events={"summernote.keyup":function(t,e){e.isDefaultPrevented()||n.handleKeyup(e)},"summernote.keydown":function(t,e){n.handleKeydown(e)},"summernote.disable summernote.dialog.shown summernote.blur":function(){n.hide()}}}var e,n,o;return e=t,(n=[{key:"shouldInitialize",value:function(){return this.hints.length>0}},{key:"initialize",value:function(){var t=this;this.lastWordRange=null,this.matchingWord=null,this.$popover=this.ui.popover({className:"note-hint-popover",hideArrow:!0,direction:""}).render().appendTo(this.options.container),this.$popover.hide(),this.$content=this.$popover.find(".popover-content,.note-popover-content"),this.$content.on("click",".note-hint-item",(function(e){t.$content.find(".active").removeClass("active"),i()(e.currentTarget).addClass("active"),t.replace()})),this.$popover.on("mousedown",(function(t){t.preventDefault()}))}},{key:"destroy",value:function(){this.$popover.remove()}},{key:"selectItem",value:function(t){this.$content.find(".active").removeClass("active"),t.addClass("active"),this.$content[0].scrollTop=t[0].offsetTop-this.$content.innerHeight()/2}},{key:"moveDown",value:function(){var t=this.$content.find(".note-hint-item.active"),e=t.next();if(e.length)this.selectItem(e);else{var n=t.parent().next();n.length||(n=this.$content.find(".note-hint-group").first()),this.selectItem(n.find(".note-hint-item").first())}}},{key:"moveUp",value:function(){var t=this.$content.find(".note-hint-item.active"),e=t.prev();if(e.length)this.selectItem(e);else{var n=t.parent().prev();n.length||(n=this.$content.find(".note-hint-group").last()),this.selectItem(n.find(".note-hint-item").last())}}},{key:"replace",value:function(){var t=this.$content.find(".note-hint-item.active");if(t.length){var e=this.nodeFromItem(t);if(null!==this.matchingWord&&0===this.matchingWord.length)this.lastWordRange.so=this.lastWordRange.eo;else if(null!==this.matchingWord&&this.matchingWord.length>0&&!this.lastWordRange.isCollapsed()){var n=this.lastWordRange.eo-this.lastWordRange.so-this.matchingWord.length;n>0&&(this.lastWordRange.so+=n)}if(this.lastWordRange.insertNode(e),"next"===this.options.hintSelect){var o=document.createTextNode("");i()(e).after(o),wt.createFromNodeBefore(o).select()}else wt.createFromNodeAfter(e).select();this.lastWordRange=null,this.hide(),this.context.invoke("editor.focus")}}},{key:"nodeFromItem",value:function(t){var e=this.hints[t.data("index")],n=t.data("item"),o=e.content?e.content(n):n;return"string"==typeof o&&(o=pt.createText(o)),o}},{key:"createItemTemplates",value:function(t,e){var n=this.hints[t];return e.map((function(e){var o=i()('<div class="note-hint-item"/>');return o.append(n.template?n.template(e):e+""),o.data({index:t,item:e}),o}))}},{key:"handleKeydown",value:function(t){this.$popover.is(":visible")&&(t.keyCode===xt.code.ENTER?(t.preventDefault(),this.replace()):t.keyCode===xt.code.UP?(t.preventDefault(),this.moveUp()):t.keyCode===xt.code.DOWN&&(t.preventDefault(),this.moveDown()))}},{key:"searchKeyword",value:function(t,e,n){var o=this.hints[t];if(o&&o.match.test(e)&&o.search){var i=o.match.exec(e);this.matchingWord=i[0],o.search(i[1],n)}else n()}},{key:"createGroup",value:function(t,e){var n=this,o=i()('<div class="note-hint-group note-hint-group-'+t+'"></div>');return this.searchKeyword(t,e,(function(e){(e=e||[]).length&&(o.html(n.createItemTemplates(t,e)),n.show())})),o}},{key:"handleKeyup",value:function(t){var e=this;if(!C.contains([xt.code.ENTER,xt.code.UP,xt.code.DOWN],t.keyCode)){var n,o,r=this.context.invoke("editor.getLastRange");if("words"===this.options.hintMode){if(n=r.getWordsRange(r),o=n.toString(),this.hints.forEach((function(t){if(t.match.test(o))return n=r.getWordsMatchRange(t.match),!1})),!n)return void this.hide();o=n.toString()}else n=r.getWordRange(),o=n.toString();if(this.hints.length&&o){this.$content.empty();var a=g.rect2bnd(C.last(n.getClientRects())),s=i()(this.options.container).offset();a&&(a.top-=s.top,a.left-=s.left,this.$popover.hide(),this.lastWordRange=n,this.hints.forEach((function(t,n){t.match.test(o)&&e.createGroup(n,o).appendTo(e.$content)})),this.$content.find(".note-hint-item:first").addClass("active"),"top"===this.direction?this.$popover.css({left:a.left,top:a.top-this.$popover.outerHeight()-5}):this.$popover.css({left:a.left,top:a.top+a.height+5}))}else this.hide()}}},{key:"show",value:function(){this.$popover.show()}},{key:"hide",value:function(){this.$popover.hide()}}])&&Ee(e.prototype,n),o&&Ee(e,o),t}();i.a.summernote=i.a.extend(i.a.summernote,{version:"0.8.18",plugins:{},dom:pt,range:wt,lists:C,options:{langInfo:i.a.summernote.lang["en-US"],editing:!0,modules:{editor:Ht,clipboard:zt,dropzone:Ot,codeview:Kt,statusbar:qt,fullscreen:Gt,handle:Zt,hintPopover:$e,autoLink:Jt,autoSync:ee,autoReplace:oe,placeholder:re,buttons:se,toolbar:ce,linkDialog:de,linkPopover:fe,imageDialog:me,imagePopover:ge,tablePopover:ke,videoDialog:we,helpDialog:xe,airPopover:Te},buttons:{},lang:"en-US",followingToolbar:!1,toolbarPosition:"top",otherStaticBar:"",codeviewKeepButton:!1,toolbar:[["style",["style"]],["font",["bold","underline","clear"]],["fontname",["fontname"]],["color",["color"]],["para",["ul","ol","paragraph"]],["table",["table"]],["insert",["link","picture","video"]],["view",["fullscreen","codeview","help"]]],popatmouse:!0,popover:{image:[["resize",["resizeFull","resizeHalf","resizeQuarter","resizeNone"]],["float",["floatLeft","floatRight","floatNone"]],["remove",["removeMedia"]]],link:[["link",["linkDialogShow","unlink"]]],table:[["add",["addRowDown","addRowUp","addColLeft","addColRight"]],["delete",["deleteRow","deleteCol","deleteTable"]]],air:[["color",["color"]],["font",["bold","underline","clear"]],["para",["ul","paragraph"]],["table",["table"]],["insert",["link","picture"]],["view",["fullscreen","codeview"]]]},airMode:!1,overrideContextMenu:!1,width:null,height:null,linkTargetBlank:!0,useProtocol:!0,defaultProtocol:"http://",focus:!1,tabDisabled:!1,tabSize:4,styleWithCSS:!1,shortcuts:!0,textareaAutoSync:!0,tooltip:"auto",container:null,maxTextLength:0,blockquoteBreakingLevel:2,spellCheck:!0,disableGrammar:!1,placeholder:null,inheritPlaceholder:!1,recordEveryKeystroke:!1,historyLimit:200,showDomainOnlyForAutolink:!1,hintMode:"word",hintSelect:"after",hintDirection:"bottom",styleTags:["p","blockquote","pre","h1","h2","h3","h4","h5","h6"],fontNames:["Arial","Arial Black","Comic Sans MS","Courier New","Helvetica Neue","Helvetica","Impact","Lucida Grande","Tahoma","Times New Roman","Verdana"],fontNamesIgnoreCheck:[],addDefaultFonts:!0,fontSizes:["8","9","10","11","12","14","18","24","36"],fontSizeUnits:["px","pt"],colors:[["#000000","#424242","#636363","#9C9C94","#CEC6CE","#EFEFEF","#F7F7F7","#FFFFFF"],["#FF0000","#FF9C00","#FFFF00","#00FF00","#00FFFF","#0000FF","#9C00FF","#FF00FF"],["#F7C6CE","#FFE7CE","#FFEFC6","#D6EFD6","#CEDEE7","#CEE7F7","#D6D6E7","#E7D6DE"],["#E79C9C","#FFC69C","#FFE79C","#B5D6A5","#A5C6CE","#9CC6EF","#B5A5D6","#D6A5BD"],["#E76363","#F7AD6B","#FFD663","#94BD7B","#73A5AD","#6BADDE","#8C7BC6","#C67BA5"],["#CE0000","#E79439","#EFC631","#6BA54A","#4A7B8C","#3984C6","#634AA5","#A54A7B"],["#9C0000","#B56308","#BD9400","#397B21","#104A5A","#085294","#311873","#731842"],["#630000","#7B3900","#846300","#295218","#083139","#003163","#21104A","#4A1031"]],colorsName:[["Black","Tundora","Dove Gray","Star Dust","Pale Slate","Gallery","Alabaster","White"],["Red","Orange Peel","Yellow","Green","Cyan","Blue","Electric Violet","Magenta"],["Azalea","Karry","Egg White","Zanah","Botticelli","Tropical Blue","Mischka","Twilight"],["Tonys Pink","Peach Orange","Cream Brulee","Sprout","Casper","Perano","Cold Purple","Careys Pink"],["Mandy","Rajah","Dandelion","Olivine","Gulf Stream","Viking","Blue Marguerite","Puce"],["Guardsman Red","Fire Bush","Golden Dream","Chelsea Cucumber","Smalt Blue","Boston Blue","Butterfly Bush","Cadillac"],["Sangria","Mai Tai","Buddha Gold","Forest Green","Eden","Venice Blue","Meteorite","Claret"],["Rosewood","Cinnamon","Olive","Parsley","Tiber","Midnight Blue","Valentino","Loulou"]],colorButton:{foreColor:"#000000",backColor:"#FFFF00"},lineHeights:["1.0","1.2","1.4","1.5","1.6","1.8","2.0","3.0"],tableClassName:"table table-bordered",insertTableMaxSize:{col:10,row:10},dialogsInBody:!1,dialogsFade:!1,maximumImageFileSize:null,callbacks:{onBeforeCommand:null,onBlur:null,onBlurCodeview:null,onChange:null,onChangeCodeview:null,onDialogShown:null,onEnter:null,onFocus:null,onImageLinkInsert:null,onImageUpload:null,onImageUploadError:null,onInit:null,onKeydown:null,onKeyup:null,onMousedown:null,onMouseup:null,onPaste:null,onScroll:null},codemirror:{mode:"text/html",htmlMode:!0,lineNumbers:!0},codeviewFilter:!1,codeviewFilterRegex:/<\/*(?:applet|b(?:ase|gsound|link)|embed|frame(?:set)?|ilayer|l(?:ayer|ink)|meta|object|s(?:cript|tyle)|t(?:itle|extarea)|xml)[^>]*?>/gi,codeviewIframeFilter:!0,codeviewIframeWhitelistSrc:[],codeviewIframeWhitelistSrcBase:["www.youtube.com","www.youtube-nocookie.com","www.facebook.com","vine.co","instagram.com","player.vimeo.com","www.dailymotion.com","player.youku.com","v.qq.com"],keyMap:{pc:{ESC:"escape",ENTER:"insertParagraph","CTRL+Z":"undo","CTRL+Y":"redo",TAB:"tab","SHIFT+TAB":"untab","CTRL+B":"bold","CTRL+I":"italic","CTRL+U":"underline","CTRL+SHIFT+S":"strikethrough","CTRL+BACKSLASH":"removeFormat","CTRL+SHIFT+L":"justifyLeft","CTRL+SHIFT+E":"justifyCenter","CTRL+SHIFT+R":"justifyRight","CTRL+SHIFT+J":"justifyFull","CTRL+SHIFT+NUM7":"insertUnorderedList","CTRL+SHIFT+NUM8":"insertOrderedList","CTRL+LEFTBRACKET":"outdent","CTRL+RIGHTBRACKET":"indent","CTRL+NUM0":"formatPara","CTRL+NUM1":"formatH1","CTRL+NUM2":"formatH2","CTRL+NUM3":"formatH3","CTRL+NUM4":"formatH4","CTRL+NUM5":"formatH5","CTRL+NUM6":"formatH6","CTRL+ENTER":"insertHorizontalRule","CTRL+K":"linkDialog.show"},mac:{ESC:"escape",ENTER:"insertParagraph","CMD+Z":"undo","CMD+SHIFT+Z":"redo",TAB:"tab","SHIFT+TAB":"untab","CMD+B":"bold","CMD+I":"italic","CMD+U":"underline","CMD+SHIFT+S":"strikethrough","CMD+BACKSLASH":"removeFormat","CMD+SHIFT+L":"justifyLeft","CMD+SHIFT+E":"justifyCenter","CMD+SHIFT+R":"justifyRight","CMD+SHIFT+J":"justifyFull","CMD+SHIFT+NUM7":"insertUnorderedList","CMD+SHIFT+NUM8":"insertOrderedList","CMD+LEFTBRACKET":"outdent","CMD+RIGHTBRACKET":"indent","CMD+NUM0":"formatPara","CMD+NUM1":"formatH1","CMD+NUM2":"formatH2","CMD+NUM3":"formatH3","CMD+NUM4":"formatH4","CMD+NUM5":"formatH5","CMD+NUM6":"formatH6","CMD+ENTER":"insertHorizontalRule","CMD+K":"linkDialog.show"}},icons:{align:"note-icon-align",alignCenter:"note-icon-align-center",alignJustify:"note-icon-align-justify",alignLeft:"note-icon-align-left",alignRight:"note-icon-align-right",rowBelow:"note-icon-row-below",colBefore:"note-icon-col-before",colAfter:"note-icon-col-after",rowAbove:"note-icon-row-above",rowRemove:"note-icon-row-remove",colRemove:"note-icon-col-remove",indent:"note-icon-align-indent",outdent:"note-icon-align-outdent",arrowsAlt:"note-icon-arrows-alt",bold:"note-icon-bold",caret:"note-icon-caret",circle:"note-icon-circle",close:"note-icon-close",code:"note-icon-code",eraser:"note-icon-eraser",floatLeft:"note-icon-float-left",floatRight:"note-icon-float-right",font:"note-icon-font",frame:"note-icon-frame",italic:"note-icon-italic",link:"note-icon-link",unlink:"note-icon-chain-broken",magic:"note-icon-magic",menuCheck:"note-icon-menu-check",minus:"note-icon-minus",orderedlist:"note-icon-orderedlist",pencil:"note-icon-pencil",picture:"note-icon-picture",question:"note-icon-question",redo:"note-icon-redo",rollback:"note-icon-rollback",square:"note-icon-square",strikethrough:"note-icon-strikethrough",subscript:"note-icon-subscript",superscript:"note-icon-superscript",table:"note-icon-table",textHeight:"note-icon-text-height",trash:"note-icon-trash",underline:"note-icon-underline",undo:"note-icon-undo",unorderedlist:"note-icon-unorderedlist",video:"note-icon-video"}}})},51:function(t,e,n){"use strict";n.r(e);var o=n(0),i=n.n(o),r=n(1);function a(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}var s=function(){function t(e,n){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.$node=e,this.options=i.a.extend({},{title:"",target:n.container,trigger:"hover focus",placement:"bottom"},n),this.$tooltip=i()(['<div class="note-tooltip">','<div class="note-tooltip-arrow"></div>','<div class="note-tooltip-content"></div>',"</div>"].join("")),"manual"!==this.options.trigger){var o=this.show.bind(this),r=this.hide.bind(this),a=this.toggle.bind(this);this.options.trigger.split(" ").forEach((function(t){"hover"===t?(e.off("mouseenter mouseleave"),e.on("mouseenter",o).on("mouseleave",r)):"click"===t?e.on("click",a):"focus"===t&&e.on("focus",o).on("blur",r)}))}}var e,n,o;return e=t,(n=[{key:"show",value:function(){var t=this.$node,e=t.offset(),n=i()(this.options.target).offset();e.top-=n.top,e.left-=n.left;var o=this.$tooltip,r=this.options.title||t.attr("title")||t.data("title"),a=this.options.placement||t.data("placement");o.addClass(a),o.find(".note-tooltip-content").text(r),o.appendTo(this.options.target);var s=t.outerWidth(),l=t.outerHeight(),c=o.outerWidth(),u=o.outerHeight();"bottom"===a?o.css({top:e.top+l,left:e.left+(s/2-c/2)}):"top"===a?o.css({top:e.top-u,left:e.left+(s/2-c/2)}):"left"===a?o.css({top:e.top+(l/2-u/2),left:e.left-c}):"right"===a&&o.css({top:e.top+(l/2-u/2),left:e.left+s}),o.addClass("in")}},{key:"hide",value:function(){var t=this;this.$tooltip.removeClass("in"),setTimeout((function(){t.$tooltip.remove()}),200)}},{key:"toggle",value:function(){this.$tooltip.hasClass("in")?this.hide():this.show()}}])&&a(e.prototype,n),o&&a(e,o),t}();function l(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}var c=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.$button=e,this.options=i.a.extend({},{target:n.container},n),this.setEvent()}var e,n,o;return e=t,(n=[{key:"setEvent",value:function(){var t=this;this.$button.on("click",(function(e){t.toggle(),e.stopImmediatePropagation()}))}},{key:"clear",value:function(){var t=i()(".note-btn-group.open");t.find(".note-btn.active").removeClass("active"),t.removeClass("open")}},{key:"show",value:function(){this.$button.addClass("active"),this.$button.parent().addClass("open");var t=this.$button.next(),e=t.offset(),n=t.outerWidth(),o=i()(window).width(),r=parseFloat(i()(this.options.target).css("margin-right"));e.left+n>o-r?t.css("margin-left",o-r-(e.left+n)):t.css("margin-left","")}},{key:"hide",value:function(){this.$button.removeClass("active"),this.$button.parent().removeClass("open")}},{key:"toggle",value:function(){var t=this.$button.parent().hasClass("open");this.clear(),t?this.hide():this.show()}}])&&l(e.prototype,n),o&&l(e,o),t}();i()(document).on("click",(function(t){i()(t.target).closest(".note-btn-group").length||(i()(".note-btn-group.open").removeClass("open"),i()(".note-btn-group .note-btn.active").removeClass("active"))})),i()(document).on("click.note-dropdown-menu",(function(t){i()(t.target).closest(".note-dropdown-menu").parent().removeClass("open"),i()(t.target).closest(".note-dropdown-menu").parent().find(".note-btn.active").removeClass("active")}));var u=c;function d(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}var h=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.$modal=e,this.$backdrop=i()('<div class="note-modal-backdrop"/>')}var e,n,o;return e=t,(n=[{key:"show",value:function(){var t=this;this.$backdrop.appendTo(document.body).show(),this.$modal.addClass("open").show(),this.$modal.trigger("note.modal.show"),this.$modal.off("click",".close").on("click",".close",this.hide.bind(this)),this.$modal.on("keydown",(function(e){27===e.which&&(e.preventDefault(),t.hide())}))}},{key:"hide",value:function(){this.$modal.removeClass("open").hide(),this.$backdrop.hide(),this.$modal.trigger("note.modal.hide"),this.$modal.off("keydown")}}])&&d(e.prototype,n),o&&d(e,o),t}(),f=r.a.create('<div class="note-editor note-frame"/>'),p=r.a.create('<div class="note-toolbar" role="toolbar"/>'),m=r.a.create('<div class="note-editing-area"/>'),v=r.a.create('<textarea class="note-codable" aria-multiline="true"/>'),g=r.a.create('<div class="note-editable" contentEditable="true" role="textbox" aria-multiline="true"/>'),b=r.a.create(['<output class="note-status-output" role="status" aria-live="polite"></output>','<div class="note-statusbar" role="status">','<div class="note-resizebar" aria-label="resize">','<div class="note-icon-bar"></div>','<div class="note-icon-bar"></div>','<div class="note-icon-bar"></div>',"</div>","</div>"].join("")),k=r.a.create('<div class="note-editor note-airframe"/>'),y=r.a.create(['<div class="note-editable" contentEditable="true" role="textbox" aria-multiline="true"></div>','<output class="note-status-output" role="status" aria-live="polite"></output>'].join("")),w=r.a.create('<div class="note-btn-group">'),C=r.a.create('<button type="button" class="note-btn" tabindex="-1">',(function(t,e){e&&e.tooltip&&(t.attr({"aria-label":e.tooltip}),t.data("_lite_tooltip",new s(t,{title:e.tooltip,container:e.container})).on("click",(function(t){i()(t.currentTarget).data("_lite_tooltip").hide()}))),e.contents&&t.html(e.contents),e&&e.data&&"dropdown"===e.data.toggle&&t.data("_lite_dropdown",new u(t,{container:e.container})),e&&e.codeviewKeepButton&&t.addClass("note-codeview-keep")})),x=r.a.create('<div class="note-dropdown-menu" role="list">',(function(t,e){var n=Array.isArray(e.items)?e.items.map((function(t){var n="string"==typeof t?t:t.value||"",o=e.template?e.template(t):t,r=i()('<a class="note-dropdown-item" href="#" data-value="'+n+'" role="listitem" aria-label="'+n+'"></a>');return r.html(o).data("item",t),r})):e.items;t.html(n).attr({"aria-label":e.title}),t.on("click","> .note-dropdown-item",(function(t){var n=i()(this),o=n.data("item"),r=n.data("value");o.click?o.click(n):e.itemClick&&e.itemClick(t,o,r)})),e&&e.codeviewKeepButton&&t.addClass("note-codeview-keep")})),S=r.a.create('<div class="note-dropdown-menu note-check" role="list">',(function(t,e){var n=Array.isArray(e.items)?e.items.map((function(t){var n="string"==typeof t?t:t.value||"",o=e.template?e.template(t):t,r=i()('<a class="note-dropdown-item" href="#" data-value="'+n+'" role="listitem" aria-label="'+t+'"></a>');return r.html([z(e.checkClassName)," ",o]).data("item",t),r})):e.items;t.html(n).attr({"aria-label":e.title}),t.on("click","> .note-dropdown-item",(function(t){var n=i()(this),o=n.data("item"),r=n.data("value");o.click?o.click(n):e.itemClick&&e.itemClick(t,o,r)})),e&&e.codeviewKeepButton&&t.addClass("note-codeview-keep")})),T=function(t,e){return t+" "+z(e.icons.caret,"span")},E=function(t,e){return w([C({className:"dropdown-toggle",contents:t.title+" "+z("note-icon-caret"),tooltip:t.tooltip,data:{toggle:"dropdown"}}),x({className:t.className,items:t.items,template:t.template,itemClick:t.itemClick})],{callback:e}).render()},$=function(t,e){return w([C({className:"dropdown-toggle",contents:t.title+" "+z("note-icon-caret"),tooltip:t.tooltip,data:{toggle:"dropdown"}}),S({className:t.className,checkClassName:t.checkClassName,items:t.items,template:t.template,itemClick:t.itemClick})],{callback:e}).render()},N=function(t){return w([C({className:"dropdown-toggle",contents:t.title+" "+z("note-icon-caret"),tooltip:t.tooltip,data:{toggle:"dropdown"}}),x([w({className:"note-align",children:t.items[0]}),w({className:"note-list",children:t.items[1]})])]).render()},I=function(t){return w([C({className:"dropdown-toggle",contents:t.title+" "+z("note-icon-caret"),tooltip:t.tooltip,data:{toggle:"dropdown"}}),x({className:"note-table",items:['<div class="note-dimension-picker">','<div class="note-dimension-picker-mousecatcher" data-event="insertTable" data-value="1x1"></div>','<div class="note-dimension-picker-highlighted"></div>','<div class="note-dimension-picker-unhighlighted"></div>',"</div>",'<div class="note-dimension-display">1 x 1</div>'].join("")})],{callback:function(e){e.find(".note-dimension-picker-mousecatcher").css({width:t.col+"em",height:t.row+"em"}).mousedown(t.itemClick).mousemove((function(e){!function(t,e,n){var o,r=i()(t.target.parentNode),a=r.next(),s=r.find(".note-dimension-picker-mousecatcher"),l=r.find(".note-dimension-picker-highlighted"),c=r.find(".note-dimension-picker-unhighlighted");if(void 0===t.offsetX){var u=i()(t.target).offset();o={x:t.pageX-u.left,y:t.pageY-u.top}}else o={x:t.offsetX,y:t.offsetY};var d=Math.ceil(o.x/18)||1,h=Math.ceil(o.y/18)||1;l.css({width:d+"em",height:h+"em"}),s.data("value",d+"x"+h),d>3&&d<e&&c.css({width:d+1+"em"}),h>3&&h<n&&c.css({height:h+1+"em"}),a.html(d+" x "+h)}(e,t.col,t.row)}))}}).render()},P=r.a.create('<div class="note-color-palette"/>',(function(t,e){for(var n=[],o=0,r=e.colors.length;o<r;o++){for(var a=e.eventName,l=e.colors[o],c=e.colorsName[o],u=[],d=0,h=l.length;d<h;d++){var f=l[d],p=c[d];u.push(['<button type="button" class="note-btn note-color-btn"','style="background-color:',f,'" ','data-event="',a,'" ','data-value="',f,'" ','data-title="',p,'" ','aria-label="',p,'" ','data-toggle="button" tabindex="-1"></button>'].join(""))}n.push('<div class="note-color-row">'+u.join("")+"</div>")}t.html(n.join("")),t.find(".note-color-btn").each((function(){i()(this).data("_lite_tooltip",new s(i()(this),{container:e.container}))}))})),R=function(t,e){return w({className:"note-color",children:[C({className:"note-current-color-button",contents:t.title,tooltip:t.lang.color.recent,click:t.currentClick,callback:function(t){var n=t.find(".note-recent-color");"foreColor"!==e&&(n.css("background-color","#FFFF00"),t.attr("data-backColor","#FFFF00"))}}),C({className:"dropdown-toggle",contents:z("note-icon-caret"),tooltip:t.lang.color.more,data:{toggle:"dropdown"}}),x({items:["<div>",'<div class="note-btn-group btn-background-color">','<div class="note-palette-title">'+t.lang.color.background+"</div>","<div>",'<button type="button" class="note-color-reset note-btn note-btn-block" data-event="backColor" data-value="transparent">',t.lang.color.transparent,"</button>","</div>",'<div class="note-holder" data-event="backColor"></div>','<div class="btn-sm">','<input type="color" id="html5bcp" class="note-btn btn-default" value="#21104A" style="width:100%;" data-value="cp">','<button type="button" class="note-color-reset btn" data-event="backColor" data-value="cpbackColor">',t.lang.color.cpSelect,"</button>","</div>","</div>",'<div class="note-btn-group btn-foreground-color">','<div class="note-palette-title">'+t.lang.color.foreground+"</div>","<div>",'<button type="button" class="note-color-reset note-btn note-btn-block" data-event="removeFormat" data-value="foreColor">',t.lang.color.resetToDefault,"</button>","</div>",'<div class="note-holder" data-event="foreColor"></div>','<div class="btn-sm">','<input type="color" id="html5fcp" class="note-btn btn-default" value="#21104A" style="width:100%;" data-value="cp">','<button type="button" class="note-color-reset btn" data-event="foreColor" data-value="cpforeColor">',t.lang.color.cpSelect,"</button>","</div>","</div>","</div>"].join(""),callback:function(n){n.find(".note-holder").each((function(){var e=i()(this);e.append(P({colors:t.colors,eventName:e.data("event")}).render())})),"fore"===e?(n.find(".btn-background-color").hide(),n.css({"min-width":"210px"})):"back"===e&&(n.find(".btn-foreground-color").hide(),n.css({"min-width":"210px"}))},click:function(n){var o=i()(n.target),r=o.data("event"),a=o.data("value"),s=document.getElementById("html5fcp").value,l=document.getElementById("html5bcp").value;if("cp"===a?n.stopPropagation():"cpbackColor"===a?a=l:"cpforeColor"===a&&(a=s),r&&a){var c="backColor"===r?"background-color":"color",u=o.closest(".note-color").find(".note-recent-color"),d=o.closest(".note-color").find(".note-current-color-button");u.css(c,a),d.attr("data-"+r,a),"fore"===e?t.itemClick("foreColor",a):"back"===e?t.itemClick("backColor",a):t.itemClick(r,a)}}})]}).render()},L=r.a.create('<div class="note-modal" aria-hidden="false" tabindex="-1" role="dialog"/>',(function(t,e){e.fade&&t.addClass("fade"),t.attr({"aria-label":e.title}),t.html(['<div class="note-modal-content">',e.title?'<div class="note-modal-header"><button type="button" class="close" aria-label="Close" aria-hidden="true"><i class="note-icon-close"></i></button><h4 class="note-modal-title">'+e.title+"</h4></div>":"",'<div class="note-modal-body">'+e.body+"</div>",e.footer?'<div class="note-modal-footer">'+e.footer+"</div>":"","</div>"].join("")),t.data("modal",new h(t,e))})),A=function(t){var e='<div class="note-form-group"><label for="note-dialog-video-url-'+t.id+'" class="note-form-label">'+t.lang.video.url+' <small class="text-muted">'+t.lang.video.providers+'</small></label><input id="note-dialog-video-url-'+t.id+'" class="note-video-url note-input" type="text"/></div>',n=['<button type="button" href="#" class="note-btn note-btn-primary note-video-btn disabled" disabled>',t.lang.video.insert,"</button>"].join("");return L({title:t.lang.video.insert,fade:t.fade,body:e,footer:n}).render()},F=function(t){var e='<div class="note-form-group note-group-select-from-files"><label for="note-dialog-image-file-'+t.id+'" class="note-form-label">'+t.lang.image.selectFromFiles+'</label><input id="note-dialog-image-file-'+t.id+'" class="note-note-image-input note-input" type="file" name="files" accept="image/*" multiple="multiple"/>'+t.imageLimitation+'</div><div class="note-form-group"><label for="note-dialog-image-url-'+t.id+'" class="note-form-label">'+t.lang.image.url+'</label><input id="note-dialog-image-url-'+t.id+'" class="note-image-url note-input" type="text"/></div>',n=['<button href="#" type="button" class="note-btn note-btn-primary note-btn-large note-image-btn disabled" disabled>',t.lang.image.insert,"</button>"].join("");return L({title:t.lang.image.insert,fade:t.fade,body:e,footer:n}).render()},D=function(t){var e='<div class="note-form-group"><label for="note-dialog-link-txt-'+t.id+'" class="note-form-label">'+t.lang.link.textToDisplay+'</label><input id="note-dialog-link-txt-'+t.id+'" class="note-link-text note-input" type="text"/></div><div class="note-form-group"><label for="note-dialog-link-url-'+t.id+'" class="note-form-label">'+t.lang.link.url+'</label><input id="note-dialog-link-url-'+t.id+'" class="note-link-url note-input" type="text" value="http://"/></div>'+(t.disableLinkTarget?"":'<div class="checkbox"><label for="note-dialog-link-nw-'+t.id+'"><input id="note-dialog-link-nw-'+t.id+'" type="checkbox" checked> '+t.lang.link.openInNewWindow+"</label></div>")+'<div class="checkbox"><label for="note-dialog-link-up-'+t.id+'"><input id="note-dialog-link-up-'+t.id+'" type="checkbox" checked> '+t.lang.link.useProtocol+"</label></div>",n=['<button href="#" type="button" class="note-btn note-btn-primary note-link-btn disabled" disabled>',t.lang.link.insert,"</button>"].join("");return L({className:"link-dialog",title:t.lang.link.insert,fade:t.fade,body:e,footer:n}).render()},H=r.a.create(['<div class="note-popover bottom">','<div class="note-popover-arrow"></div>','<div class="popover-content note-children-container"></div>',"</div>"].join(""),(function(t,e){var n=void 0!==e.direction?e.direction:"bottom";t.addClass(n).hide(),e.hideArrow&&t.find(".note-popover-arrow").hide()})),B=r.a.create('<div class="checkbox"></div>',(function(t,e){t.html(["<label"+(e.id?' for="note-'+e.id+'"':"")+">",'<input role="checkbox" type="checkbox"'+(e.id?' id="note-'+e.id+'"':""),e.checked?" checked":"",' aria-checked="'+(e.checked?"true":"false")+'"/>',e.text?e.text:"","</label>"].join(""))})),z=function(t,e){return"<"+(e=e||"i")+' class="'+t+'"/>'},M=function(t){return{editor:f,toolbar:p,editingArea:m,codable:v,editable:g,statusbar:b,airEditor:k,airEditable:y,buttonGroup:w,button:C,dropdown:x,dropdownCheck:S,dropdownButton:E,dropdownButtonContents:T,dropdownCheckButton:$,paragraphDropdownButton:N,tableDropdownButton:I,colorDropdownButton:R,palette:P,dialog:L,videoDialog:A,imageDialog:F,linkDialog:D,popover:H,checkbox:B,icon:z,options:t,toggleBtn:function(t,e){t.toggleClass("disabled",!e),t.attr("disabled",!e)},toggleBtnActive:function(t,e){t.toggleClass("active",e)},check:function(t,e){t.find(".checked").removeClass("checked"),t.find('[data-value="'+e+'"]').addClass("checked")},onDialogShown:function(t,e){t.one("note.modal.show",e)},onDialogHidden:function(t,e){t.one("note.modal.hide",e)},showDialog:function(t){t.data("modal").show()},hideDialog:function(t){t.data("modal").hide()},getPopoverContent:function(t){return t.find(".note-popover-content")},getDialogBody:function(t){return t.find(".note-modal-body")},createLayout:function(e){var n=(t.airMode?k([m([v(),y()])]):"bottom"===t.toolbarPosition?f([m([v(),g()]),p(),b()]):f([p(),m([v(),g()]),b()])).render();return n.insertAfter(e),{note:e,editor:n,toolbar:n.find(".note-toolbar"),editingArea:n.find(".note-editing-area"),editable:n.find(".note-editable"),codable:n.find(".note-codable"),statusbar:n.find(".note-statusbar")}},removeLayout:function(t,e){t.html(e.editable.html()),e.editor.remove(),t.off("summernote"),t.show()}}};n(3),n(6);i.a.summernote=i.a.extend(i.a.summernote,{ui_template:M,interface:"lite"})},6:function(t,e,n){}})}));
//# sourceMappingURL=summernote-lite.min.js.map