diff options
author | Wu Cheng-Han | 2015-05-15 12:58:13 +0800 |
---|---|---|
committer | Wu Cheng-Han | 2015-05-15 12:58:13 +0800 |
commit | 4e64583a0b6175d2c9a6729ffde1472dd55d389c (patch) | |
tree | 75253f2425f2e4f5906ed4fd30eca29a906ee47a /public/vendor | |
parent | 2d36d7ce84c636faac17cef3d3a7c22568df38fe (diff) |
Marked as 0.2.8
Diffstat (limited to '')
67 files changed, 1936 insertions, 21553 deletions
diff --git a/public/vendor/codemirror/addon/dialog/dialog.css b/public/vendor/codemirror/addon/dialog/dialog.css index 2e7c0fc9..c8c139d9 100755 --- a/public/vendor/codemirror/addon/dialog/dialog.css +++ b/public/vendor/codemirror/addon/dialog/dialog.css @@ -27,6 +27,10 @@ font-family: monospace; } +.CodeMirror-dialog input::selection { + color: white; +} + .CodeMirror-dialog button { font-size: 70%; } diff --git a/public/vendor/codemirror/addon/scroll/annotatescrollbar.js b/public/vendor/codemirror/addon/scroll/annotatescrollbar.js index e62a45ac..cf92d16d 100755 --- a/public/vendor/codemirror/addon/scroll/annotatescrollbar.js +++ b/public/vendor/codemirror/addon/scroll/annotatescrollbar.js @@ -97,7 +97,7 @@ var height = Math.max(bottom - top, 3); var elt = frag.appendChild(document.createElement("div")); - elt.style.cssText = "position: absolute; right: 0px; width: " + Math.max(cm.display.barWidth - 1, 2) + "px; top: " + elt.style.cssText = "position: absolute; right: 0px; width: " + Math.max(cm.display.barWidth * 2, 2) + "px; top: " + (top + this.buttonHeight) + "px; height: " + height + "px"; elt.className = this.options.className; } diff --git a/public/vendor/codemirror/addon/scroll/simplescrollbars.css b/public/vendor/codemirror/addon/scroll/simplescrollbars.css index 5eea7aa1..136be9ac 100755 --- a/public/vendor/codemirror/addon/scroll/simplescrollbars.css +++ b/public/vendor/codemirror/addon/scroll/simplescrollbars.css @@ -38,8 +38,9 @@ .CodeMirror-overlayscroll-horizontal div, .CodeMirror-overlayscroll-vertical div { position: absolute; - background: #bcd; + background: #ccc; border-radius: 3px; + margin: 2px; } .CodeMirror-overlayscroll-horizontal, .CodeMirror-overlayscroll-vertical { diff --git a/public/vendor/codemirror/addon/scroll/simplescrollbars.js b/public/vendor/codemirror/addon/scroll/simplescrollbars.js index f78353a1..4f0d0d0f 100755 --- a/public/vendor/codemirror/addon/scroll/simplescrollbars.js +++ b/public/vendor/codemirror/addon/scroll/simplescrollbars.js @@ -75,14 +75,13 @@ this.screen = clientSize; this.total = scrollSize; this.size = barSize; - var buttonSize = this.screen * (this.size / this.total); if (buttonSize < minButtonSize) { this.size -= minButtonSize - buttonSize; buttonSize = minButtonSize; } this.inner.style[this.orientation == "horizontal" ? "width" : "height"] = - buttonSize + "px"; + (buttonSize - 4) + "px"; this.inner.style[this.orientation == "horizontal" ? "left" : "top"] = this.pos * (this.size / this.total) + "px"; }; diff --git a/public/vendor/codemirror/addon/search/search.js b/public/vendor/codemirror/addon/search/search.js index 1c8ca3c2..afa85ebe 100755 --- a/public/vendor/codemirror/addon/search/search.js +++ b/public/vendor/codemirror/addon/search/search.js @@ -118,7 +118,7 @@ var doReplaceConfirm = "Replace? <button>Yes</button> <button>No</button> <button>Stop</button>"; function replace(cm, all) { if (cm.getOption("readOnly")) return; - var query = cm.getSelection() || getSearchState().lastQuery; + var query = cm.getSelection() || getSearchState(cm).lastQuery; dialog(cm, replaceQueryDialog, "Replace:", query, function(query) { if (!query) return; query = parseQuery(query); @@ -128,8 +128,8 @@ for (var cursor = getSearchCursor(cm, query); cursor.findNext();) { if (typeof query != "string") { var match = cm.getRange(cursor.from(), cursor.to()).match(query); - cursor.replace(text.replace(/\$(\d)/g, function(_, i) {return match[i];})); - } else cursor.replace(text); + cursor.replace(text.replace(/\$(\d)/g, function(_, i) {return match[i];}), "+input"); + } else cursor.replace(text, "+input"); } }); } else { @@ -149,7 +149,7 @@ }; var doReplace = function(match) { cursor.replace(typeof query == "string" ? text : - text.replace(/\$(\d)/g, function(_, i) {return match[i];})); + text.replace(/\$(\d)/g, function(_, i) {return match[i];}), "+input"); advance(); }; advance(); diff --git a/public/vendor/codemirror/codemirror.min.js b/public/vendor/codemirror/codemirror.min.js index 9f8f26d1..cf0f0468 100644 --- a/public/vendor/codemirror/codemirror.min.js +++ b/public/vendor/codemirror/codemirror.min.js @@ -1,12 +1,14 @@ -!function(e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else{if("function"==typeof define&&define.amd)return define([],e);this.CodeMirror=e()}}(function(){"use strict";function e(r,n){if(!(this instanceof e))return new e(r,n);this.options=n=n?Di(n):{},Di(Ko,n,!1),h(n);var i=n.value;"string"==typeof i&&(i=new va(i,n.mode)),this.doc=i;var o=new e.inputStyles[n.inputStyle](this),a=this.display=new t(r,i,o);a.wrapper.CodeMirror=this,c(this),l(this),n.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),n.autofocus&&!Co&&a.input.focus(),v(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,draggingText:!1,highlight:new Li,keySeq:null,specialChars:null};var s=this;ho&&11>po&&setTimeout(function(){s.display.input.reset(!0)},20),jt(this),Vi(),yt(this),this.curOp.forceUpdate=!0,Gn(this,i),n.autofocus&&!Co||s.hasFocus()?setTimeout(Wi(fr,this),20):hr(this);for(var u in $o)$o.hasOwnProperty(u)&&$o[u](this,n[u],Xo);k(this),n.finishInit&&n.finishInit(this);for(var d=0;d<Jo.length;++d)Jo[d](this);xt(this),mo&&n.lineWrapping&&"optimizelegibility"==getComputedStyle(a.lineDiv).textRendering&&(a.lineDiv.style.textRendering="auto")}function t(e,t,r){var n=this;this.input=r,n.scrollbarFiller=Hi("div",null,"CodeMirror-scrollbar-filler"),n.scrollbarFiller.setAttribute("cm-not-content","true"),n.gutterFiller=Hi("div",null,"CodeMirror-gutter-filler"),n.gutterFiller.setAttribute("cm-not-content","true"),n.lineDiv=Hi("div",null,"CodeMirror-code"),n.selectionDiv=Hi("div",null,null,"position: relative; z-index: 1"),n.cursorDiv=Hi("div",null,"CodeMirror-cursors"),n.measure=Hi("div",null,"CodeMirror-measure"),n.lineMeasure=Hi("div",null,"CodeMirror-measure"),n.lineSpace=Hi("div",[n.measure,n.lineMeasure,n.selectionDiv,n.cursorDiv,n.lineDiv],null,"position: relative; outline: none"),n.mover=Hi("div",[Hi("div",[n.lineSpace],"CodeMirror-lines")],null,"position: relative"),n.sizer=Hi("div",[n.mover],"CodeMirror-sizer"),n.sizerWidth=null,n.heightForcer=Hi("div",null,null,"position: absolute; height: "+Ta+"px; width: 1px;"),n.gutters=Hi("div",null,"CodeMirror-gutters"),n.lineGutter=null,n.scroller=Hi("div",[n.sizer,n.heightForcer,n.gutters],"CodeMirror-scroll"),n.scroller.setAttribute("tabIndex","-1"),n.wrapper=Hi("div",[n.scrollbarFiller,n.gutterFiller,n.scroller],"CodeMirror"),ho&&8>po&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),mo||co&&Co||(n.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(n.wrapper):e(n.wrapper)),n.viewFrom=n.viewTo=t.first,n.reportedViewFrom=n.reportedViewTo=t.first,n.view=[],n.renderedView=null,n.externalMeasured=null,n.viewOffset=0,n.lastWrapHeight=n.lastWrapWidth=0,n.updateLineNumbers=null,n.nativeBarWidth=n.barHeight=n.barWidth=0,n.scrollbarsClipped=!1,n.lineNumWidth=n.lineNumInnerWidth=n.lineNumChars=null,n.alignWidgets=!1,n.cachedCharWidth=n.cachedTextHeight=n.cachedPaddingH=null,n.maxLine=null,n.maxLineLength=0,n.maxLineChanged=!1,n.wheelDX=n.wheelDY=n.wheelStartX=n.wheelStartY=null,n.shift=!1,n.selForContextMenu=null,n.activeTouch=null,r.init(n)}function r(t){t.doc.mode=e.getMode(t.options,t.doc.modeOption),n(t)}function n(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.frontier=e.doc.first,Fe(e,100),e.state.modeGen++,e.curOp&&Dt(e)}function i(e){e.options.lineWrapping?(Ra(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(qa(e.display.wrapper,"CodeMirror-wrap"),f(e)),a(e),Dt(e),ot(e),setTimeout(function(){y(e)},100)}function o(e){var t=gt(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/vt(e.display)-3);return function(i){if(yn(e.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;a<i.widgets.length;a++)i.widgets[a].height&&(o+=i.widgets[a].height);return r?o+(Math.ceil(i.text.length/n)||1)*t:o+t}}function a(e){var t=e.doc,r=o(e);t.iter(function(e){var t=r(e);t!=e.height&&Yn(e,t)})}function l(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),ot(e)}function s(e){c(e),Dt(e),setTimeout(function(){w(e)},20)}function c(e){var t=e.display.gutters,r=e.options.gutters;_i(t);for(var n=0;n<r.length;++n){var i=r[n],o=t.appendChild(Hi("div",null,"CodeMirror-gutter "+i));"CodeMirror-linenumbers"==i&&(e.display.lineGutter=o,o.style.width=(e.display.lineNumWidth||1)+"px")}t.style.display=n?"":"none",u(e)}function u(e){var t=e.display.gutters.offsetWidth;e.display.sizer.style.marginLeft=t+"px"}function d(e){if(0==e.height)return 0;for(var t,r=e.text.length,n=e;t=dn(n);){var i=t.find(0,!0);n=i.from.line,r+=i.from.ch-i.to.ch}for(n=e;t=fn(n);){var i=t.find(0,!0);r-=n.text.length-i.from.ch,n=i.to.line,r+=n.text.length-i.to.ch}return r}function f(e){var t=e.display,r=e.doc;t.maxLine=Kn(r,r.first),t.maxLineLength=d(t.maxLine),t.maxLineChanged=!0,r.iter(function(e){var r=d(e);r>t.maxLineLength&&(t.maxLineLength=r,t.maxLine=e)})}function h(e){var t=Oi(e.gutters,"CodeMirror-linenumbers");-1==t&&e.lineNumbers?e.gutters=e.gutters.concat(["CodeMirror-linenumbers"]):t>-1&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}function p(e){var t=e.display,r=t.gutters.offsetWidth,n=Math.round(e.doc.height+qe(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?r:0,docHeight:n,scrollHeight:n+Ue(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}function m(e,t,r){this.cm=r;var n=this.vert=Hi("div",[Hi("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=Hi("div",[Hi("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");e(n),e(i),Ca(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),Ca(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedOverlay=!1,ho&&8>po&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}function g(){}function v(t){t.display.scrollbars&&(t.display.scrollbars.clear(),t.display.scrollbars.addClass&&qa(t.display.wrapper,t.display.scrollbars.addClass)),t.display.scrollbars=new e.scrollbarModel[t.options.scrollbarStyle](function(e){t.display.wrapper.insertBefore(e,t.display.scrollbarFiller),Ca(e,"mousedown",function(){t.state.focused&&setTimeout(function(){t.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,r){"horizontal"==r?er(t,e):Jt(t,e)},t),t.display.scrollbars.addClass&&Ra(t.display.wrapper,t.display.scrollbars.addClass)}function y(e,t){t||(t=p(e));var r=e.display.barWidth,n=e.display.barHeight;b(e,t);for(var i=0;4>i&&r!=e.display.barWidth||n!=e.display.barHeight;i++)r!=e.display.barWidth&&e.options.lineWrapping&&N(e),b(e,p(e)),r=e.display.barWidth,n=e.display.barHeight}function b(e,t){var r=e.display,n=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=n.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=n.bottom)+"px",n.right&&n.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=n.bottom+"px",r.scrollbarFiller.style.width=n.right+"px"):r.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=n.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}function x(e,t,r){var n=r&&null!=r.top?Math.max(0,r.top):e.scroller.scrollTop;n=Math.floor(n-Be(e));var i=r&&null!=r.bottom?r.bottom:n+e.wrapper.clientHeight,o=Qn(t,n),a=Qn(t,i);if(r&&r.ensure){var l=r.ensure.from.line,s=r.ensure.to.line;o>l?(o=l,a=Qn(t,Jn(Kn(t,l))+e.wrapper.clientHeight)):Math.min(s,t.lastLine())>=a&&(o=Qn(t,Jn(Kn(t,s))-e.wrapper.clientHeight),a=s)}return{from:o,to:Math.max(a,o+1)}}function w(e){var t=e.display,r=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=S(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=n+"px",a=0;a<r.length;a++)if(!r[a].hidden){e.options.fixedGutter&&r[a].gutter&&(r[a].gutter.style.left=o);var l=r[a].alignable;if(l)for(var s=0;s<l.length;s++)l[s].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=n+i+"px")}}function k(e){if(!e.options.lineNumbers)return!1;var t=e.doc,r=C(e.options,t.first+t.size-1),n=e.display;if(r.length!=n.lineNumChars){var i=n.measure.appendChild(Hi("div",[Hi("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=i.firstChild.offsetWidth,a=i.offsetWidth-o;return n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(o,n.lineGutter.offsetWidth-a)+1,n.lineNumWidth=n.lineNumInnerWidth+a,n.lineNumChars=n.lineNumInnerWidth?r.length:-1,n.lineGutter.style.width=n.lineNumWidth+"px",u(e),!0}return!1}function C(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function S(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function L(e,t,r){var n=e.display;this.viewport=t,this.visible=x(n,e.doc,t),this.editorIsHidden=!n.wrapper.offsetWidth,this.wrapperHeight=n.wrapper.clientHeight,this.wrapperWidth=n.wrapper.clientWidth,this.oldDisplayWidth=Ve(e),this.force=r,this.dims=D(e),this.events=[]}function M(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Ue(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Ue(e)+"px",t.scrollbarsClipped=!0)}function T(e,t){var r=e.display,n=e.doc;if(t.editorIsHidden)return It(e),!1;if(!t.force&&t.visible.from>=r.viewFrom&&t.visible.to<=r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&0==_t(e))return!1;k(e)&&(It(e),t.dims=D(e));var i=n.first+n.size,o=Math.max(t.visible.from-e.options.viewportMargin,n.first),a=Math.min(i,t.visible.to+e.options.viewportMargin);r.viewFrom<o&&o-r.viewFrom<20&&(o=Math.max(n.first,r.viewFrom)),r.viewTo>a&&r.viewTo-a<20&&(a=Math.min(i,r.viewTo)),zo&&(o=gn(e.doc,o),a=vn(e.doc,a));var l=o!=r.viewFrom||a!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;Ht(e,o,a),r.viewOffset=Jn(Kn(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var s=_t(e);if(!l&&0==s&&!t.force&&r.renderedView==r.view&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo))return!1;var c=Bi();return s>4&&(r.lineDiv.style.display="none"),W(e,r.updateLineNumbers,t.dims),s>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,c&&Bi()!=c&&c.offsetHeight&&c.focus(),_i(r.cursorDiv),_i(r.selectionDiv),r.gutters.style.height=0,l&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,Fe(e,400)),r.updateLineNumbers=null,!0}function A(e,t){for(var r=t.force,n=t.viewport,i=!0;;i=!1){if(i&&e.options.lineWrapping&&t.oldDisplayWidth!=Ve(e))r=!0;else if(r=!1,n&&null!=n.top&&(n={top:Math.min(e.doc.height+qe(e.display)-Ge(e),n.top)}),t.visible=x(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break;if(!T(e,t))break;N(e);var o=p(e);Pe(e),z(e,o),y(e,o)}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function O(e,t){var r=new L(e,t);if(T(e,r)){N(e),A(e,r);var n=p(e);Pe(e),z(e,n),y(e,n),r.finish()}}function z(e,t){e.display.sizer.style.minHeight=t.docHeight+"px";var r=t.docHeight+e.display.barHeight;e.display.heightForcer.style.top=r+"px",e.display.gutters.style.height=Math.max(r+Ue(e),t.clientHeight)+"px"}function N(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=0;n<t.view.length;n++){var i,o=t.view[n];if(!o.hidden){if(ho&&8>po){var a=o.node.offsetTop+o.node.offsetHeight;i=a-r,r=a}else{var l=o.node.getBoundingClientRect();i=l.bottom-l.top}var s=o.line.height-i;if(2>i&&(i=gt(t)),(s>.001||-.001>s)&&(Yn(o.line,i),P(o.line),o.rest))for(var c=0;c<o.rest.length;c++)P(o.rest[c])}}}function P(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t)e.widgets[t].height=e.widgets[t].node.offsetHeight}function D(e){for(var t=e.display,r={},n={},i=t.gutters.clientLeft,o=t.gutters.firstChild,a=0;o;o=o.nextSibling,++a)r[e.options.gutters[a]]=o.offsetLeft+o.clientLeft+i,n[e.options.gutters[a]]=o.clientWidth;return{fixedPos:S(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function W(e,t,r){function n(t){var r=t.nextSibling;return mo&&So&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),r}for(var i=e.display,o=e.options.lineNumbers,a=i.lineDiv,l=a.firstChild,s=i.view,c=i.viewFrom,u=0;u<s.length;u++){var d=s[u];if(d.hidden);else if(d.node&&d.node.parentNode==a){for(;l!=d.node;)l=n(l);var f=o&&null!=t&&c>=t&&d.lineNumber;d.changes&&(Oi(d.changes,"gutter")>-1&&(f=!1),I(e,d,c,r)),f&&(_i(d.lineNumber),d.lineNumber.appendChild(document.createTextNode(C(e.options,c)))),l=d.node.nextSibling}else{var h=R(e,d,c,r);a.insertBefore(h,l)}c+=d.size}for(;l;)l=n(l)}function I(e,t,r,n){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];"text"==o?_(e,t):"gutter"==o?B(e,t,r,n):"class"==o?j(t):"widget"==o&&q(e,t,n)}t.changes=null}function E(e){return e.node==e.text&&(e.node=Hi("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),ho&&8>po&&(e.node.style.zIndex=2)),e.node}function F(e){var t=e.bgClass?e.bgClass+" "+(e.line.bgClass||""):e.line.bgClass;if(t&&(t+=" CodeMirror-linebackground"),e.background)t?e.background.className=t:(e.background.parentNode.removeChild(e.background),e.background=null);else if(t){var r=E(e);e.background=r.insertBefore(Hi("div",null,t),r.firstChild)}}function H(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):Wn(e,t)}function _(e,t){var r=t.text.className,n=H(e,t);t.text==t.node&&(t.node=n.pre),t.text.parentNode.replaceChild(n.pre,t.text),t.text=n.pre,n.bgClass!=t.bgClass||n.textClass!=t.textClass?(t.bgClass=n.bgClass,t.textClass=n.textClass,j(t)):r&&(t.text.className=r)}function j(e){F(e),e.line.wrapClass?E(e).className=e.line.wrapClass:e.node!=e.text&&(e.node.className="");var t=e.textClass?e.textClass+" "+(e.line.textClass||""):e.line.textClass;e.text.className=t||""}function B(e,t,r,n){t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null);var i=t.line.gutterMarkers;if(e.options.lineNumbers||i){var o=E(t),a=t.gutter=Hi("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px; width: "+n.gutterTotalWidth+"px");if(e.display.input.setUneditable(a),o.insertBefore(a,t.text),t.line.gutterClass&&(a.className+=" "+t.line.gutterClass),!e.options.lineNumbers||i&&i["CodeMirror-linenumbers"]||(t.lineNumber=a.appendChild(Hi("div",C(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),i)for(var l=0;l<e.options.gutters.length;++l){var s=e.options.gutters[l],c=i.hasOwnProperty(s)&&i[s];c&&a.appendChild(Hi("div",[c],"CodeMirror-gutter-elt","left: "+n.gutterLeft[s]+"px; width: "+n.gutterWidth[s]+"px"))}}}function q(e,t,r){t.alignable&&(t.alignable=null);for(var n,i=t.node.firstChild;i;i=n){var n=i.nextSibling;"CodeMirror-linewidget"==i.className&&t.node.removeChild(i)}U(e,t,r)}function R(e,t,r,n){var i=H(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),j(t),B(e,t,r,n),U(e,t,n),t.node}function U(e,t,r){if(V(e,t.line,t,r,!0),t.rest)for(var n=0;n<t.rest.length;n++)V(e,t.rest[n],t,r,!1)}function V(e,t,r,n,i){if(t.widgets)for(var o=E(r),a=0,l=t.widgets;a<l.length;++a){var s=l[a],c=Hi("div",[s.node],"CodeMirror-linewidget");s.handleMouseEvents||c.setAttribute("cm-ignore-events","true"),G(s,c,r,n),e.display.input.setUneditable(c),i&&s.above?o.insertBefore(c,r.gutter||r.text):o.appendChild(c),bi(s,"redraw")}}function G(e,t,r,n){if(e.noHScroll){(r.alignable||(r.alignable=[])).push(t);var i=n.wrapperWidth;t.style.left=n.fixedPos+"px",e.coverGutter||(i-=n.gutterTotalWidth,t.style.paddingLeft=n.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-n.gutterTotalWidth+"px"))}function K(e){return No(e.line,e.ch)}function X(e,t){return Po(e,t)<0?t:e}function Y(e,t){return Po(e,t)<0?e:t}function Z(e){e.state.focused||(e.display.input.focus(),fr(e))}function Q(e){return e.options.readOnly||e.doc.cantEdit}function J(e,t,r,n,i){var o=e.doc;e.display.shift=!1,n||(n=o.sel);var a=Ga(t),l=null;e.state.pasteIncoming&&n.ranges.length>1&&(Do&&Do.join("\n")==t?l=n.ranges.length%Do.length==0&&zi(Do,Ga):a.length==n.ranges.length&&(l=zi(a,function(e){return[e]})));for(var s=n.ranges.length-1;s>=0;s--){var c=n.ranges[s],u=c.from(),d=c.to();c.empty()&&(r&&r>0?u=No(u.line,u.ch-r):e.state.overwrite&&!e.state.pasteIncoming&&(d=No(d.line,Math.min(Kn(o,d.line).text.length,d.ch+Ai(a).length))));var f=e.curOp.updateInput,h={from:u,to:d,text:l?l[s%l.length]:a,origin:i||(e.state.pasteIncoming?"paste":e.state.cutIncoming?"cut":"+input")};if(wr(e.doc,h),bi(e,"inputRead",e,h),t&&!e.state.pasteIncoming&&e.options.electricChars&&e.options.smartIndent&&c.head.ch<100&&(!s||n.ranges[s-1].head.line!=c.head.line)){var p=e.getModeAt(c.head),m=Go(h),g=!1;if(p.electricChars){for(var v=0;v<p.electricChars.length;v++)if(t.indexOf(p.electricChars.charAt(v))>-1){g=Ir(e,m.line,"smart");break}}else p.electricInput&&p.electricInput.test(Kn(o,m.line).text.slice(0,m.ch))&&(g=Ir(e,m.line,"smart"));g&&bi(e,"electricInput",e,m.line)}}Dr(e),e.curOp.updateInput=f,e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=!1}function ee(e){for(var t=[],r=[],n=0;n<e.doc.sel.ranges.length;n++){var i=e.doc.sel.ranges[n].head.line,o={anchor:No(i,0),head:No(i+1,0)};r.push(o),t.push(e.getRange(o.anchor,o.head))}return{text:t,ranges:r}}function te(e){e.setAttribute("autocorrect","off"),e.setAttribute("autocapitalize","off"),e.setAttribute("spellcheck","false")}function re(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Li,this.inaccurateSelection=!1,this.hasSelection=!1,this.composing=null}function ne(){var e=Hi("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none"),t=Hi("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return mo?e.style.width="1000px":e.setAttribute("wrap","off"),ko&&(e.style.border="1px solid black"),te(e),t}function ie(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Li,this.gracePeriod=!1}function oe(e,t){var r=Ze(e,t.line);if(!r||r.hidden)return null;var n=Kn(e.doc,t.line),i=$e(r,n,t.line),o=ei(n),a="left";if(o){var l=oo(o,t.ch);a=l%2?"right":"left"}var s=et(i.map,t.ch,"left");return s.offset="right"==s.collapse?s.end:s.start,s}function ae(e,t){return t&&(e.bad=!0),e}function le(e,t,r){var n;if(t==e.display.lineDiv){if(n=e.display.lineDiv.childNodes[r],!n)return ae(e.clipPos(No(e.display.viewTo-1)),!0);t=null,r=0}else for(n=t;;n=n.parentNode){if(!n||n==e.display.lineDiv)return null;if(n.parentNode&&n.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var o=e.display.view[i];if(o.node==n)return se(o,t,r)}}function se(e,t,r){function n(t,r,n){for(var i=-1;i<(u?u.length:0);i++)for(var o=0>i?c.map:u[i],a=0;a<o.length;a+=3){var l=o[a+2];if(l==t||l==r){var s=Zn(0>i?e.line:e.rest[i]),d=o[a]+n;return(0>n||l!=t)&&(d=o[a+(n?1:0)]),No(s,d)}}}var i=e.text.firstChild,o=!1;if(!t||!_a(i,t))return ae(No(Zn(e.line),0),!0);if(t==i&&(o=!0,t=i.childNodes[r],r=0,!t)){var a=e.rest?Ai(e.rest):e.line;return ae(No(Zn(a),a.text.length),o)}var l=3==t.nodeType?t:null,s=t;for(l||1!=t.childNodes.length||3!=t.firstChild.nodeType||(l=t.firstChild,r&&(r=l.nodeValue.length));s.parentNode!=i;)s=s.parentNode;var c=e.measure,u=c.maps,d=n(l,s,r);if(d)return ae(d,o);for(var f=s.nextSibling,h=l?l.nodeValue.length-r:0;f;f=f.nextSibling){if(d=n(f,f.firstChild,0))return ae(No(d.line,d.ch-h),o);h+=f.textContent.length}for(var p=s.previousSibling,h=r;p;p=p.previousSibling){if(d=n(p,p.firstChild,-1))return ae(No(d.line,d.ch+h),o);h+=f.textContent.length}}function ce(e,t,r,n,i){function o(e){return function(t){return t.id==e}}function a(t){if(1==t.nodeType){var r=t.getAttribute("cm-text");if(null!=r)return""==r&&(r=t.textContent.replace(/\u200b/g,"")),void(l+=r);var c,u=t.getAttribute("cm-marker");if(u){var d=e.findMarks(No(n,0),No(i+1,0),o(+u));return void(d.length&&(c=d[0].find())&&(l+=$n(e.doc,c.from,c.to).join("\n")))}if("false"==t.getAttribute("contenteditable"))return;for(var f=0;f<t.childNodes.length;f++)a(t.childNodes[f]);/^(pre|div|p)$/i.test(t.nodeName)&&(s=!0)}else if(3==t.nodeType){var h=t.nodeValue;if(!h)return;s&&(l+="\n",s=!1),l+=h}}for(var l="",s=!1;a(t),t!=r;)t=t.nextSibling;return l}function ue(e,t){this.ranges=e,this.primIndex=t}function de(e,t){this.anchor=e,this.head=t}function fe(e,t){var r=e[t];e.sort(function(e,t){return Po(e.from(),t.from())}),t=Oi(e,r);for(var n=1;n<e.length;n++){var i=e[n],o=e[n-1];if(Po(o.to(),i.from())>=0){var a=Y(o.from(),i.from()),l=X(o.to(),i.to()),s=o.empty()?i.from()==i.head:o.from()==o.head;t>=n&&--t,e.splice(--n,2,new de(s?l:a,s?a:l))}}return new ue(e,t)}function he(e,t){return new ue([new de(e,t||e)],0)}function pe(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function me(e,t){if(t.line<e.first)return No(e.first,0);var r=e.first+e.size-1;return t.line>r?No(r,Kn(e,r).text.length):ge(t,Kn(e,t.line).text.length)}function ge(e,t){var r=e.ch;return null==r||r>t?No(e.line,t):0>r?No(e.line,0):e}function ve(e,t){return t>=e.first&&t<e.first+e.size}function ye(e,t){for(var r=[],n=0;n<t.length;n++)r[n]=me(e,t[n]);return r}function be(e,t,r,n){if(e.cm&&e.cm.display.shift||e.extend){var i=t.anchor;if(n){var o=Po(r,i)<0;o!=Po(n,i)<0?(i=r,r=n):o!=Po(r,n)<0&&(r=n)}return new de(i,r)}return new de(n||r,r)}function xe(e,t,r,n){Me(e,new ue([be(e,e.sel.primary(),t,r)],0),n)}function we(e,t,r){for(var n=[],i=0;i<e.sel.ranges.length;i++)n[i]=be(e,e.sel.ranges[i],t[i],null);var o=fe(n,e.sel.primIndex);Me(e,o,r)}function ke(e,t,r,n){var i=e.sel.ranges.slice(0);i[t]=r,Me(e,fe(i,e.sel.primIndex),n)}function Ce(e,t,r,n){Me(e,he(t,r),n)}function Se(e,t){var r={ranges:t.ranges,update:function(t){this.ranges=[];for(var r=0;r<t.length;r++)this.ranges[r]=new de(me(e,t[r].anchor),me(e,t[r].head))}};return La(e,"beforeSelectionChange",e,r),e.cm&&La(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?fe(r.ranges,r.ranges.length-1):t}function Le(e,t,r){var n=e.history.done,i=Ai(n);i&&i.ranges?(n[n.length-1]=t,Te(e,t,r)):Me(e,t,r)}function Me(e,t,r){Te(e,t,r),li(e,e.sel,e.cm?e.cm.curOp.id:0/0,r)}function Te(e,t,r){(Ci(e,"beforeSelectionChange")||e.cm&&Ci(e.cm,"beforeSelectionChange"))&&(t=Se(e,t));var n=r&&r.bias||(Po(t.primary().head,e.sel.primary().head)<0?-1:1);Ae(e,ze(e,t,n,!0)),r&&r.scroll===!1||!e.cm||Dr(e.cm)}function Ae(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=e.cm.curOp.selectionChanged=!0,ki(e.cm)),bi(e,"cursorActivity",e))}function Oe(e){Ae(e,ze(e,e.sel,null,!1),Oa)}function ze(e,t,r,n){for(var i,o=0;o<t.ranges.length;o++){var a=t.ranges[o],l=Ne(e,a.anchor,r,n),s=Ne(e,a.head,r,n);(i||l!=a.anchor||s!=a.head)&&(i||(i=t.ranges.slice(0,o)),i[o]=new de(l,s))}return i?fe(i,t.primIndex):t}function Ne(e,t,r,n){var i=!1,o=t,a=r||1;e.cantEdit=!1;e:for(;;){var l=Kn(e,o.line);if(l.markedSpans)for(var s=0;s<l.markedSpans.length;++s){var c=l.markedSpans[s],u=c.marker;if((null==c.from||(u.inclusiveLeft?c.from<=o.ch:c.from<o.ch))&&(null==c.to||(u.inclusiveRight?c.to>=o.ch:c.to>o.ch))){if(n&&(La(u,"beforeCursorEnter"),u.explicitlyCleared)){if(l.markedSpans){--s;continue}break}if(!u.atomic)continue;var d=u.find(0>a?-1:1);if(0==Po(d,o)&&(d.ch+=a,d.ch<0?d=d.line>e.first?me(e,No(d.line-1)):null:d.ch>l.text.length&&(d=d.line<e.first+e.size-1?No(d.line+1,0):null),!d)){if(i)return n?(e.cantEdit=!0,No(e.first,0)):Ne(e,t,r,!0);i=!0,d=t,a=-a}o=d;continue e}}return o}}function Pe(e){e.display.input.showSelection(e.display.input.prepareSelection())}function De(e,t){for(var r=e.doc,n={},i=n.cursors=document.createDocumentFragment(),o=n.selection=document.createDocumentFragment(),a=0;a<r.sel.ranges.length;a++)if(t!==!1||a!=r.sel.primIndex){var l=r.sel.ranges[a],s=l.empty();(s||e.options.showCursorWhenSelecting)&&We(e,l,i),s||Ie(e,l,o)}return n}function We(e,t,r){var n=dt(e,t.head,"div",null,null,!e.options.singleCursorHeightPerLine),i=r.appendChild(Hi("div"," ","CodeMirror-cursor"));if(i.style.left=n.left+"px",i.style.top=n.top+"px",i.style.height=Math.max(0,n.bottom-n.top)*e.options.cursorHeight+"px",n.other){var o=r.appendChild(Hi("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));o.style.display="",o.style.left=n.other.left+"px",o.style.top=n.other.top+"px",o.style.height=.85*(n.other.bottom-n.other.top)+"px"}$(".other-cursor").each(function(t,r){var n=e.charCoords({line:$(r).attr("data-line"),ch:$(r).attr("data-ch")},"windows");$(r)[0].style.left=n.left+"px",$(r)[0].style.top=n.top+"px"})}function Ie(e,t,r){function n(e,t,r,n){0>t&&(t=0),t=Math.round(t),n=Math.round(n),l.appendChild(Hi("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px; top: "+t+"px; width: "+(null==r?u-e:r)+"px; height: "+(n-t)+"px"))}function i(t,r,i){function o(r,n){return ut(e,No(t,r),"div",d,n)}var l,s,d=Kn(a,t),f=d.text.length;return Yi(ei(d),r||0,null==i?f:i,function(e,t,a){var d,h,p,m=o(e,"left");if(e==t)d=m,h=p=m.left;else{if(d=o(t-1,"right"),"rtl"==a){var g=m;m=d,d=g}h=m.left,p=d.right}null==r&&0==e&&(h=c),d.top-m.top>3&&(n(h,m.top,null,m.bottom),h=c,m.bottom<d.top&&n(h,m.bottom,null,d.top)),null==i&&t==f&&(p=u),(!l||m.top<l.top||m.top==l.top&&m.left<l.left)&&(l=m),(!s||d.bottom>s.bottom||d.bottom==s.bottom&&d.right>s.right)&&(s=d),c+1>h&&(h=c),n(h,d.top,p-h,d.bottom)}),{start:l,end:s}}var o=e.display,a=e.doc,l=document.createDocumentFragment(),s=Re(e.display),c=s.left,u=Math.max(o.sizerWidth,Ve(e)-o.sizer.offsetLeft)-s.right,d=t.from(),f=t.to();if(d.line==f.line)i(d.line,d.ch,f.ch);else{var h=Kn(a,d.line),p=Kn(a,f.line),m=pn(h)==pn(p),g=i(d.line,d.ch,m?h.text.length+1:null).end,v=i(f.line,m?0:null,f.ch).start;m&&(g.top<v.top-2?(n(g.right,g.top,null,g.bottom),n(c,v.top,v.left,v.bottom)):n(g.right,g.top,v.left-g.right,g.bottom)),g.bottom<v.top&&n(c,g.bottom,null,v.top)}r.appendChild(l)}function Ee(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var r=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Fe(e,t){e.doc.mode.startState&&e.doc.frontier<e.display.viewTo&&e.state.highlight.set(t,Wi(He,e))}function He(e){var t=e.doc;if(t.frontier<t.first&&(t.frontier=t.first),!(t.frontier>=e.display.viewTo)){var r=+new Date+e.options.workTime,n=ta(t.mode,je(e,t.frontier)),i=[];t.iter(t.frontier,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(t.frontier>=e.display.viewFrom){var a=o.styles,l=zn(e,o,n,!0);o.styles=l.styles;var s=o.styleClasses,c=l.classes;c?o.styleClasses=c:s&&(o.styleClasses=null);for(var u=!a||a.length!=o.styles.length||s!=c&&(!s||!c||s.bgClass!=c.bgClass||s.textClass!=c.textClass),d=0;!u&&d<a.length;++d)u=a[d]!=o.styles[d];u&&i.push(t.frontier),o.stateAfter=ta(t.mode,n)}else Pn(e,o.text,n),o.stateAfter=t.frontier%5==0?ta(t.mode,n):null;return++t.frontier,+new Date>r?(Fe(e,e.options.workDelay),!0):void 0}),i.length&&Tt(e,function(){for(var t=0;t<i.length;t++)Wt(e,i[t],"text")})}}function _e(e,t,r){for(var n,i,o=e.doc,a=r?-1:t-(e.doc.mode.innerMode?1e3:100),l=t;l>a;--l){if(l<=o.first)return o.first;var s=Kn(o,l-1);if(s.stateAfter&&(!r||l<=o.frontier))return l;var c=Pa(s.text,null,e.options.tabSize);(null==i||n>c)&&(i=l-1,n=c)}return i}function je(e,t,r){var n=e.doc,i=e.display;if(!n.mode.startState)return!0;var o=_e(e,t,r),a=o>n.first&&Kn(n,o-1).stateAfter;return a=a?ta(n.mode,a):ra(n.mode),n.iter(o,t,function(r){Pn(e,r.text,a);var l=o==t-1||o%5==0||o>=i.viewFrom&&o<i.viewTo;r.stateAfter=l?ta(n.mode,a):null,++o}),r&&(n.frontier=o),a}function Be(e){return e.lineSpace.offsetTop}function qe(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Re(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=ji(e.measure,Hi("pre","x")),r=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,n={left:parseInt(r.paddingLeft),right:parseInt(r.paddingRight)};return isNaN(n.left)||isNaN(n.right)||(e.cachedPaddingH=n),n}function Ue(e){return Ta-e.display.nativeBarWidth}function Ve(e){return e.display.scroller.clientWidth-Ue(e)-e.display.barWidth}function Ge(e){return e.display.scroller.clientHeight-Ue(e)-e.display.barHeight}function Ke(e,t,r){var n=e.options.lineWrapping,i=n&&Ve(e);if(!t.measure.heights||n&&t.measure.width!=i){var o=t.measure.heights=[];if(n){t.measure.width=i;for(var a=t.text.firstChild.getClientRects(),l=0;l<a.length-1;l++){var s=a[l],c=a[l+1];Math.abs(s.bottom-c.bottom)>2&&o.push((s.bottom+c.top)/2-r.top)}}o.push(r.bottom-r.top)}}function $e(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var n=0;n<e.rest.length;n++)if(e.rest[n]==t)return{map:e.measure.maps[n],cache:e.measure.caches[n]};for(var n=0;n<e.rest.length;n++)if(Zn(e.rest[n])>r)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function Xe(e,t){t=pn(t);var r=Zn(t),n=e.display.externalMeasured=new Nt(e.doc,t,r);n.lineN=r;var i=n.built=Wn(e,n);return n.text=i.pre,ji(e.display.lineMeasure,i.pre),n}function Ye(e,t,r,n){return Je(e,Qe(e,t),r,n)}function Ze(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Et(e,t)];var r=e.display.externalMeasured;return r&&t>=r.lineN&&t<r.lineN+r.size?r:void 0}function Qe(e,t){var r=Zn(t),n=Ze(e,r);n&&!n.text?n=null:n&&n.changes&&I(e,n,r,D(e)),n||(n=Xe(e,t));var i=$e(n,t,r);return{line:t,view:n,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Je(e,t,r,n,i){t.before&&(r=-1);var o,a=r+(n||"");return t.cache.hasOwnProperty(a)?o=t.cache[a]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Ke(e,t.view,t.rect),t.hasHeights=!0),o=tt(e,t,r,n),o.bogus||(t.cache[a]=o)),{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}function et(e,t,r){for(var n,i,o,a,l=0;l<e.length;l+=3){var s=e[l],c=e[l+1];if(s>t?(i=0,o=1,a="left"):c>t?(i=t-s,o=i+1):(l==e.length-3||t==c&&e[l+3]>t)&&(o=c-s,i=o-1,t>=c&&(a="right")),null!=i){if(n=e[l+2],s==c&&r==(n.insertLeft?"left":"right")&&(a=r),"left"==r&&0==i)for(;l&&e[l-2]==e[l-3]&&e[l-1].insertLeft;)n=e[(l-=3)+2],a="left";if("right"==r&&i==c-s)for(;l<e.length-3&&e[l+3]==e[l+4]&&!e[l+5].insertLeft;)n=e[(l+=3)+2],a="right";break}}return{node:n,start:i,end:o,collapse:a,coverStart:s,coverEnd:c}}function tt(e,t,r,n){var i,o=et(t.map,r,n),a=o.node,l=o.start,s=o.end,c=o.collapse;if(3==a.nodeType){for(var u=0;4>u;u++){for(;l&&Fi(t.line.text.charAt(o.coverStart+l));)--l;for(;o.coverStart+s<o.coverEnd&&Fi(t.line.text.charAt(o.coverStart+s));)++s;if(ho&&9>po&&0==l&&s==o.coverEnd-o.coverStart)i=a.parentNode.getBoundingClientRect();else if(ho&&e.options.lineWrapping){var d=Ia(a,l,s).getClientRects();i=d.length?d["right"==n?d.length-1:0]:Fo}else i=Ia(a,l,s).getBoundingClientRect()||Fo;if(i.left||i.right||0==l)break;s=l,l-=1,c="right"}ho&&11>po&&(i=rt(e.display.measure,i))}else{l>0&&(c=n="right");var d;i=e.options.lineWrapping&&(d=a.getClientRects()).length>1?d["right"==n?d.length-1:0]:a.getBoundingClientRect()}if(ho&&9>po&&!l&&(!i||!i.left&&!i.right)){var f=a.parentNode.getClientRects()[0];i=f?{left:f.left,right:f.left+vt(e.display),top:f.top, -bottom:f.bottom}:Fo}for(var h=i.top-t.rect.top,p=i.bottom-t.rect.top,m=(h+p)/2,g=t.view.measure.heights,u=0;u<g.length-1&&!(m<g[u]);u++);var v=u?g[u-1]:0,y=g[u],b={left:("right"==c?i.right:i.left)-t.rect.left,right:("left"==c?i.left:i.right)-t.rect.left,top:v,bottom:y};return i.left||i.right||(b.bogus=!0),e.options.singleCursorHeightPerLine||(b.rtop=h,b.rbottom=p),b}function rt(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!Xi(e))return t;var r=screen.logicalXDPI/screen.deviceXDPI,n=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*r,right:t.right*r,top:t.top*n,bottom:t.bottom*n}}function nt(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function it(e){e.display.externalMeasure=null,_i(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)nt(e.display.view[t])}function ot(e){it(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function at(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function lt(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function st(e,t,r,n){if(t.widgets)for(var i=0;i<t.widgets.length;++i)if(t.widgets[i].above){var o=wn(t.widgets[i]);r.top+=o,r.bottom+=o}if("line"==n)return r;n||(n="local");var a=Jn(t);if("local"==n?a+=Be(e.display):a-=e.display.viewOffset,"page"==n||"window"==n){var l=e.display.lineSpace.getBoundingClientRect();a+=l.top+("window"==n?0:lt());var s=l.left+("window"==n?0:at());r.left+=s,r.right+=s}return r.top+=a,r.bottom+=a,r}function ct(e,t,r){if("div"==r)return t;var n=t.left,i=t.top;if("page"==r)n-=at(),i-=lt();else if("local"==r||!r){var o=e.display.sizer.getBoundingClientRect();n+=o.left,i+=o.top}var a=e.display.lineSpace.getBoundingClientRect();return{left:n-a.left,top:i-a.top}}function ut(e,t,r,n,i){return n||(n=Kn(e.doc,t.line)),st(e,n,Ye(e,n,t.ch,i),r)}function dt(e,t,r,n,i,o){function a(t,a){var l=Je(e,i,t,a?"right":"left",o);return a?l.left=l.right:l.right=l.left,st(e,n,l,r)}function l(e,t){var r=s[t],n=r.level%2;return e==Zi(r)&&t&&r.level<s[t-1].level?(r=s[--t],e=Qi(r)-(r.level%2?0:1),n=!0):e==Qi(r)&&t<s.length-1&&r.level<s[t+1].level&&(r=s[++t],e=Zi(r)-r.level%2,n=!1),n&&e==r.to&&e>r.from?a(e-1):a(e,n)}n=n||Kn(e.doc,t.line),i||(i=Qe(e,n));var s=ei(n),c=t.ch;if(!s)return a(c);var u=oo(s,c),d=l(c,u);return null!=Za&&(d.other=l(c,Za)),d}function ft(e,t){var r=0,t=me(e.doc,t);e.options.lineWrapping||(r=vt(e.display)*t.ch);var n=Kn(e.doc,t.line),i=Jn(n)+Be(e.display);return{left:r,right:r,top:i,bottom:i+n.height}}function ht(e,t,r,n){var i=No(e,t);return i.xRel=n,r&&(i.outside=!0),i}function pt(e,t,r){var n=e.doc;if(r+=e.display.viewOffset,0>r)return ht(n.first,0,!0,-1);var i=Qn(n,r),o=n.first+n.size-1;if(i>o)return ht(n.first+n.size-1,Kn(n,o).text.length,!0,1);0>t&&(t=0);for(var a=Kn(n,i);;){var l=mt(e,a,i,t,r),s=fn(a),c=s&&s.find(0,!0);if(!s||!(l.ch>c.from.ch||l.ch==c.from.ch&&l.xRel>0))return l;i=Zn(a=c.to.line)}}function mt(e,t,r,n,i){function o(n){var i=dt(e,No(r,n),"line",t,c);return l=!0,a>i.bottom?i.left-s:a<i.top?i.left+s:(l=!1,i.left)}var a=i-Jn(t),l=!1,s=2*e.display.wrapper.clientWidth,c=Qe(e,t),u=ei(t),d=t.text.length,f=Ji(t),h=eo(t),p=o(f),m=l,g=o(h),v=l;if(n>g)return ht(r,h,v,1);for(;;){if(u?h==f||h==lo(t,f,1):1>=h-f){for(var y=p>n||g-n>=n-p?f:h,b=n-(y==f?p:g);Fi(t.text.charAt(y));)++y;var x=ht(r,y,y==f?m:v,-1>b?-1:b>1?1:0);return x}var w=Math.ceil(d/2),k=f+w;if(u){k=f;for(var C=0;w>C;++C)k=lo(t,k,1)}var S=o(k);S>n?(h=k,g=S,(v=l)&&(g+=1e3),d=w):(f=k,p=S,m=l,d-=w)}}function gt(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Wo){Wo=Hi("pre");for(var t=0;49>t;++t)Wo.appendChild(document.createTextNode("x")),Wo.appendChild(Hi("br"));Wo.appendChild(document.createTextNode("x"))}ji(e.measure,Wo);var r=Wo.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),_i(e.measure),r||1}function vt(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=Hi("span","xxxxxxxxxx"),r=Hi("pre",[t]);ji(e.measure,r);var n=t.getBoundingClientRect(),i=(n.right-n.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function yt(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++_o},Ho?Ho.ops.push(e.curOp):e.curOp.ownsGroup=Ho={ops:[e.curOp],delayedCallbacks:[]}}function bt(e){var t=e.delayedCallbacks,r=0;do{for(;r<t.length;r++)t[r]();for(var n=0;n<e.ops.length;n++){var i=e.ops[n];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++](i.cm)}}while(r<t.length)}function xt(e){var t=e.curOp,r=t.ownsGroup;if(r)try{bt(r)}finally{Ho=null;for(var n=0;n<r.ops.length;n++)r.ops[n].cm.curOp=null;wt(r)}}function wt(e){for(var t=e.ops,r=0;r<t.length;r++)kt(t[r]);for(var r=0;r<t.length;r++)Ct(t[r]);for(var r=0;r<t.length;r++)St(t[r]);for(var r=0;r<t.length;r++)Lt(t[r]);for(var r=0;r<t.length;r++)Mt(t[r])}function kt(e){var t=e.cm,r=t.display;M(t),e.updateMaxLine&&f(t),e.mustUpdate=e.viewChanged||e.forceUpdate||null!=e.scrollTop||e.scrollToPos&&(e.scrollToPos.from.line<r.viewFrom||e.scrollToPos.to.line>=r.viewTo)||r.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new L(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Ct(e){e.updatedDisplay=e.mustUpdate&&T(e.cm,e.update)}function St(e){var t=e.cm,r=t.display;e.updatedDisplay&&N(t),e.barMeasure=p(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Ye(t,r.maxLine,r.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+e.adjustWidthTo+Ue(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Ve(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function Lt(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&er(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1),e.preparedSelection&&t.display.input.showSelection(e.preparedSelection),e.updatedDisplay&&z(t,e.barMeasure),(e.updatedDisplay||e.startHeight!=t.doc.height)&&y(t,e.barMeasure),e.selectionChanged&&Ee(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),e.focus&&e.focus==Bi()&&Z(e.cm)}function Mt(e){var t=e.cm,r=t.display,n=t.doc;if(e.updatedDisplay&&A(t,e.update),null==r.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(r.wheelStartX=r.wheelStartY=null),null==e.scrollTop||r.scroller.scrollTop==e.scrollTop&&!e.forceScroll||(n.scrollTop=Math.max(0,Math.min(r.scroller.scrollHeight-r.scroller.clientHeight,e.scrollTop)),r.scrollbars.setScrollTop(n.scrollTop),r.scroller.scrollTop=n.scrollTop),null==e.scrollLeft||r.scroller.scrollLeft==e.scrollLeft&&!e.forceScroll||(n.scrollLeft=Math.max(0,Math.min(r.scroller.scrollWidth-Ve(t),e.scrollLeft)),r.scrollbars.setScrollLeft(n.scrollLeft),r.scroller.scrollLeft=n.scrollLeft,w(t)),e.scrollToPos){var i=Or(t,me(n,e.scrollToPos.from),me(n,e.scrollToPos.to),e.scrollToPos.margin);e.scrollToPos.isCursor&&t.state.focused&&Ar(t,i)}var o=e.maybeHiddenMarkers,a=e.maybeUnhiddenMarkers;if(o)for(var l=0;l<o.length;++l)o[l].lines.length||La(o[l],"hide");if(a)for(var l=0;l<a.length;++l)a[l].lines.length&&La(a[l],"unhide");r.wrapper.offsetHeight&&(n.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&La(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Tt(e,t){if(e.curOp)return t();yt(e);try{return t()}finally{xt(e)}}function At(e,t){return function(){if(e.curOp)return t.apply(e,arguments);yt(e);try{return t.apply(e,arguments)}finally{xt(e)}}}function Ot(e){return function(){if(this.curOp)return e.apply(this,arguments);yt(this);try{return e.apply(this,arguments)}finally{xt(this)}}}function zt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);yt(t);try{return e.apply(this,arguments)}finally{xt(t)}}}function Nt(e,t,r){this.line=t,this.rest=mn(t),this.size=this.rest?Zn(Ai(this.rest))-r+1:1,this.node=this.text=null,this.hidden=yn(e,t)}function Pt(e,t,r){for(var n,i=[],o=t;r>o;o=n){var a=new Nt(e.doc,Kn(e.doc,o),o);n=o+a.size,i.push(a)}return i}function Dt(e,t,r,n){null==t&&(t=e.doc.first),null==r&&(r=e.doc.first+e.doc.size),n||(n=0);var i=e.display;if(n&&r<i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)zo&&gn(e.doc,t)<i.viewTo&&It(e);else if(r<=i.viewFrom)zo&&vn(e.doc,r+n)>i.viewFrom?It(e):(i.viewFrom+=n,i.viewTo+=n);else if(t<=i.viewFrom&&r>=i.viewTo)It(e);else if(t<=i.viewFrom){var o=Ft(e,r,r+n,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=n):It(e)}else if(r>=i.viewTo){var o=Ft(e,t,t,-1);o?(i.view=i.view.slice(0,o.index),i.viewTo=o.lineN):It(e)}else{var a=Ft(e,t,t,-1),l=Ft(e,r,r+n,1);a&&l?(i.view=i.view.slice(0,a.index).concat(Pt(e,a.lineN,l.lineN)).concat(i.view.slice(l.index)),i.viewTo+=n):It(e)}var s=i.externalMeasured;s&&(r<s.lineN?s.lineN+=n:t<s.lineN+s.size&&(i.externalMeasured=null))}function Wt(e,t,r){e.curOp.viewChanged=!0;var n=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(n.externalMeasured=null),!(t<n.viewFrom||t>=n.viewTo)){var o=n.view[Et(e,t)];if(null!=o.node){var a=o.changes||(o.changes=[]);-1==Oi(a,r)&&a.push(r)}}}function It(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Et(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,0>t)return null;for(var r=e.display.view,n=0;n<r.length;n++)if(t-=r[n].size,0>t)return n}function Ft(e,t,r,n){var i,o=Et(e,t),a=e.display.view;if(!zo||r==e.doc.first+e.doc.size)return{index:o,lineN:r};for(var l=0,s=e.display.viewFrom;o>l;l++)s+=a[l].size;if(s!=t){if(n>0){if(o==a.length-1)return null;i=s+a[o].size-t,o++}else i=s-t;t+=i,r+=i}for(;gn(e.doc,r)!=r;){if(o==(0>n?0:a.length-1))return null;r+=n*a[o-(0>n?1:0)].size,o+=n}return{index:o,lineN:r}}function Ht(e,t,r){var n=e.display,i=n.view;0==i.length||t>=n.viewTo||r<=n.viewFrom?(n.view=Pt(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=Pt(e,t,n.viewFrom).concat(n.view):n.viewFrom<t&&(n.view=n.view.slice(Et(e,t))),n.viewFrom=t,n.viewTo<r?n.view=n.view.concat(Pt(e,n.viewTo,r)):n.viewTo>r&&(n.view=n.view.slice(0,Et(e,r)))),n.viewTo=r}function _t(e){for(var t=e.display.view,r=0,n=0;n<t.length;n++){var i=t[n];i.hidden||i.node&&!i.changes||++r}return r}function jt(e){function t(){i.activeTouch&&(o=setTimeout(function(){i.activeTouch=null},1e3),a=i.activeTouch,a.end=+new Date)}function r(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}function n(e,t){if(null==t.left)return!0;var r=t.left-e.left,n=t.top-e.top;return r*r+n*n>400}var i=e.display;Ca(i.scroller,"mousedown",At(e,Vt)),ho&&11>po?Ca(i.scroller,"dblclick",At(e,function(t){if(!wi(e,t)){var r=Ut(e,t);if(r&&!Yt(e,t)&&!Rt(e.display,t)){xa(t);var n=e.findWordAt(r);xe(e.doc,n.anchor,n.head)}}})):Ca(i.scroller,"dblclick",function(t){wi(e,t)||xa(t)}),Ao||Ca(i.scroller,"contextmenu",function(t){pr(e,t)});var o,a={end:0};Ca(i.scroller,"touchstart",function(e){if(!r(e)){clearTimeout(o);var t=+new Date;i.activeTouch={start:t,moved:!1,prev:t-a.end<=300?a:null},1==e.touches.length&&(i.activeTouch.left=e.touches[0].pageX,i.activeTouch.top=e.touches[0].pageY)}}),Ca(i.scroller,"touchmove",function(){i.activeTouch&&(i.activeTouch.moved=!0)}),Ca(i.scroller,"touchend",function(r){var o=i.activeTouch;if(o&&!Rt(i,r)&&null!=o.left&&!o.moved&&new Date-o.start<300){var a,l=e.coordsChar(i.activeTouch,"page");a=!o.prev||n(o,o.prev)?new de(l,l):!o.prev.prev||n(o,o.prev.prev)?e.findWordAt(l):new de(No(l.line,0),me(e.doc,No(l.line+1,0))),e.setSelection(a.anchor,a.head),e.focus(),xa(r)}t()}),Ca(i.scroller,"touchcancel",t),Ca(i.scroller,"scroll",function(){i.scroller.clientHeight&&(Jt(e,i.scroller.scrollTop),er(e,i.scroller.scrollLeft,!0),La(e,"scroll",e))}),Ca(i.scroller,"mousewheel",function(t){tr(e,t)}),Ca(i.scroller,"DOMMouseScroll",function(t){tr(e,t)}),Ca(i.wrapper,"scroll",function(){i.wrapper.scrollTop=i.wrapper.scrollLeft=0}),i.dragFunctions={simple:function(t){wi(e,t)||ka(t)},start:function(t){Qt(e,t)},drop:At(e,Zt)};var l=i.input.getField();Ca(l,"keyup",function(t){cr.call(e,t)}),Ca(l,"keydown",At(e,lr)),Ca(l,"keypress",At(e,ur)),Ca(l,"focus",Wi(fr,e)),Ca(l,"blur",Wi(hr,e))}function Bt(t,r,n){var i=n&&n!=e.Init;if(!r!=!i){var o=t.display.dragFunctions,a=r?Ca:Sa;a(t.display.scroller,"dragstart",o.start),a(t.display.scroller,"dragenter",o.simple),a(t.display.scroller,"dragover",o.simple),a(t.display.scroller,"drop",o.drop)}}function qt(e){var t=e.display;(t.lastWrapHeight!=t.wrapper.clientHeight||t.lastWrapWidth!=t.wrapper.clientWidth)&&(t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize())}function Rt(e,t){for(var r=vi(t);r!=e.wrapper;r=r.parentNode)if(!r||1==r.nodeType&&"true"==r.getAttribute("cm-ignore-events")||r.parentNode==e.sizer&&r!=e.mover)return!0}function Ut(e,t,r,n){var i=e.display;if(!r&&"true"==vi(t).getAttribute("cm-not-content"))return null;var o,a,l=i.lineSpace.getBoundingClientRect();try{o=t.clientX-l.left,a=t.clientY-l.top}catch(t){return null}var s,c=pt(e,o,a);if(n&&1==c.xRel&&(s=Kn(e.doc,c.line).text).length==c.ch){var u=Pa(s,s.length,e.options.tabSize)-s.length;c=No(c.line,Math.max(0,Math.round((o-Re(e.display).left)/vt(e.display))-u))}return c}function Vt(e){var t=this,r=t.display;if(!(r.activeTouch&&r.input.supportsTouch()||wi(t,e))){if(r.shift=e.shiftKey,Rt(r,e))return void(mo||(r.scroller.draggable=!1,setTimeout(function(){r.scroller.draggable=!0},100)));if(!Yt(t,e)){var n=Ut(t,e);switch(window.focus(),yi(e)){case 1:n?Gt(t,e,n):vi(e)==r.scroller&&xa(e);break;case 2:mo&&(t.state.lastMiddleDown=+new Date),n&&xe(t.doc,n),setTimeout(function(){r.input.focus()},20),xa(e);break;case 3:Ao?pr(t,e):dr(t)}}}}function Gt(e,t,r){ho?setTimeout(Wi(Z,e),0):e.curOp.focus=Bi();var n,i=+new Date;Eo&&Eo.time>i-400&&0==Po(Eo.pos,r)?n="triple":Io&&Io.time>i-400&&0==Po(Io.pos,r)?(n="double",Eo={time:i,pos:r}):(n="single",Io={time:i,pos:r});var o,a=e.doc.sel,l=So?t.metaKey:t.ctrlKey;e.options.dragDrop&&Va&&!Q(e)&&"single"==n&&(o=a.contains(r))>-1&&!a.ranges[o].empty()?Kt(e,t,r,l):$t(e,t,r,n,l)}function Kt(e,t,r,n){var i=e.display,o=+new Date,a=At(e,function(l){mo&&(i.scroller.draggable=!1),e.state.draggingText=!1,Sa(document,"mouseup",a),Sa(i.scroller,"drop",a),Math.abs(t.clientX-l.clientX)+Math.abs(t.clientY-l.clientY)<10&&(xa(l),!n&&+new Date-200<o&&xe(e.doc,r),mo||ho&&9==po?setTimeout(function(){document.body.focus(),i.input.focus()},20):i.input.focus())});mo&&(i.scroller.draggable=!0),e.state.draggingText=a,i.scroller.dragDrop&&i.scroller.dragDrop(),Ca(document,"mouseup",a),Ca(i.scroller,"drop",a)}function $t(e,t,r,n,i){function o(t){if(0!=Po(g,t))if(g=t,"rect"==n){for(var i=[],o=e.options.tabSize,a=Pa(Kn(c,r.line).text,r.ch,o),l=Pa(Kn(c,t.line).text,t.ch,o),s=Math.min(a,l),h=Math.max(a,l),p=Math.min(r.line,t.line),m=Math.min(e.lastLine(),Math.max(r.line,t.line));m>=p;p++){var v=Kn(c,p).text,y=Mi(v,s,o);s==h?i.push(new de(No(p,y),No(p,y))):v.length>y&&i.push(new de(No(p,y),No(p,Mi(v,h,o))))}i.length||i.push(new de(r,r)),Me(c,fe(f.ranges.slice(0,d).concat(i),d),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var b=u,x=b.anchor,w=t;if("single"!=n){if("double"==n)var k=e.findWordAt(t);else var k=new de(No(t.line,0),me(c,No(t.line+1,0)));Po(k.anchor,x)>0?(w=k.head,x=Y(b.from(),k.anchor)):(w=k.anchor,x=X(b.to(),k.head))}var i=f.ranges.slice(0);i[d]=new de(me(c,x),w),Me(c,fe(i,d),za)}}function a(t){var r=++y,i=Ut(e,t,!0,"rect"==n);if(i)if(0!=Po(i,g)){e.curOp.focus=Bi(),o(i);var l=x(s,c);(i.line>=l.to||i.line<l.from)&&setTimeout(At(e,function(){y==r&&a(t)}),150)}else{var u=t.clientY<v.top?-20:t.clientY>v.bottom?20:0;u&&setTimeout(At(e,function(){y==r&&(s.scroller.scrollTop+=u,a(t))}),50)}}function l(e){y=1/0,xa(e),s.input.focus(),Sa(document,"mousemove",b),Sa(document,"mouseup",w),c.history.lastSelOrigin=null}var s=e.display,c=e.doc;xa(t);var u,d,f=c.sel,h=f.ranges;if(i&&!t.shiftKey?(d=c.sel.contains(r),u=d>-1?h[d]:new de(r,r)):(u=c.sel.primary(),d=c.sel.primIndex),t.altKey)n="rect",i||(u=new de(r,r)),r=Ut(e,t,!0,!0),d=-1;else if("double"==n){var p=e.findWordAt(r);u=e.display.shift||c.extend?be(c,u,p.anchor,p.head):p}else if("triple"==n){var m=new de(No(r.line,0),me(c,No(r.line+1,0)));u=e.display.shift||c.extend?be(c,u,m.anchor,m.head):m}else u=be(c,u,r);i?-1==d?(d=h.length,Me(c,fe(h.concat([u]),d),{scroll:!1,origin:"*mouse"})):h.length>1&&h[d].empty()&&"single"==n&&!t.shiftKey?(Me(c,fe(h.slice(0,d).concat(h.slice(d+1)),0)),f=c.sel):ke(c,d,u,za):(d=0,Me(c,new ue([u],0),za),f=c.sel);var g=r,v=s.wrapper.getBoundingClientRect(),y=0,b=At(e,function(e){yi(e)?a(e):l(e)}),w=At(e,l);Ca(document,"mousemove",b),Ca(document,"mouseup",w)}function Xt(e,t,r,n,i){try{var o=t.clientX,a=t.clientY}catch(t){return!1}if(o>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&xa(t);var l=e.display,s=l.lineDiv.getBoundingClientRect();if(a>s.bottom||!Ci(e,r))return gi(t);a-=s.top-l.viewOffset;for(var c=0;c<e.options.gutters.length;++c){var u=l.gutters.childNodes[c];if(u&&u.getBoundingClientRect().right>=o){var d=Qn(e.doc,a),f=e.options.gutters[c];return i(e,r,e,d,f,t),gi(t)}}}function Yt(e,t){return Xt(e,t,"gutterClick",!0,bi)}function Zt(e){var t=this;if(!wi(t,e)&&!Rt(t.display,e)){xa(e),ho&&(jo=+new Date);var r=Ut(t,e,!0),n=e.dataTransfer.files;if(r&&!Q(t))if(n&&n.length&&window.FileReader&&window.File)for(var i=n.length,o=Array(i),a=0,l=function(e,n){var l=new FileReader;l.onload=At(t,function(){if(o[n]=l.result,++a==i){r=me(t.doc,r);var e={from:r,to:r,text:Ga(o.join("\n")),origin:"paste"};wr(t.doc,e),Le(t.doc,he(r,Go(e)))}}),l.readAsText(e)},s=0;i>s;++s)l(n[s],s);else{if(t.state.draggingText&&t.doc.sel.contains(r)>-1)return t.state.draggingText(e),void setTimeout(function(){t.display.input.focus()},20);try{var o=e.dataTransfer.getData("Text");if(o){if(t.state.draggingText&&!(So?e.altKey:e.ctrlKey))var c=t.listSelections();if(Te(t.doc,he(r,r)),c)for(var s=0;s<c.length;++s)Tr(t.doc,"",c[s].anchor,c[s].head,"drag");t.replaceSelection(o,"around","paste"),t.display.input.focus()}}catch(e){}}}}function Qt(e,t){if(ho&&(!e.state.draggingText||+new Date-jo<100))return void ka(t);if(!wi(e,t)&&!Rt(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.setDragImage&&!bo)){var r=Hi("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",yo&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),yo&&r.parentNode.removeChild(r)}}function Jt(e,t){Math.abs(e.doc.scrollTop-t)<2||(e.doc.scrollTop=t,co||O(e,{top:t}),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t),e.display.scrollbars.setScrollTop(t),co&&O(e),Fe(e,100))}function er(e,t,r){(r?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)||(t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),e.doc.scrollLeft=t,w(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function tr(e,t){var r=Ro(t),n=r.x,i=r.y,o=e.display,a=o.scroller;if(n&&a.scrollWidth>a.clientWidth||i&&a.scrollHeight>a.clientHeight){if(i&&So&&mo)e:for(var l=t.target,s=o.view;l!=a;l=l.parentNode)for(var c=0;c<s.length;c++)if(s[c].node==l){e.display.currentWheelTarget=l;break e}if(n&&!co&&!yo&&null!=qo)return i&&Jt(e,Math.max(0,Math.min(a.scrollTop+i*qo,a.scrollHeight-a.clientHeight))),er(e,Math.max(0,Math.min(a.scrollLeft+n*qo,a.scrollWidth-a.clientWidth))),xa(t),void(o.wheelStartX=null);if(i&&null!=qo){var u=i*qo,d=e.doc.scrollTop,f=d+o.wrapper.clientHeight;0>u?d=Math.max(0,d+u-50):f=Math.min(e.doc.height,f+u+50),O(e,{top:d,bottom:f})}20>Bo&&(null==o.wheelStartX?(o.wheelStartX=a.scrollLeft,o.wheelStartY=a.scrollTop,o.wheelDX=n,o.wheelDY=i,setTimeout(function(){if(null!=o.wheelStartX){var e=a.scrollLeft-o.wheelStartX,t=a.scrollTop-o.wheelStartY,r=t&&o.wheelDY&&t/o.wheelDY||e&&o.wheelDX&&e/o.wheelDX;o.wheelStartX=o.wheelStartY=null,r&&(qo=(qo*Bo+r)/(Bo+1),++Bo)}},200)):(o.wheelDX+=n,o.wheelDY+=i))}}function rr(e,t,r){if("string"==typeof t&&(t=na[t],!t))return!1;e.display.input.ensurePolled();var n=e.display.shift,i=!1;try{Q(e)&&(e.state.suppressEdits=!0),r&&(e.display.shift=!1),i=t(e)!=Aa}finally{e.display.shift=n,e.state.suppressEdits=!1}return i}function nr(e,t,r){for(var n=0;n<e.state.keyMaps.length;n++){var i=oa(t,e.state.keyMaps[n],r,e);if(i)return i}return e.options.extraKeys&&oa(t,e.options.extraKeys,r,e)||oa(t,e.options.keyMap,r,e)}function ir(e,t,r,n){var i=e.state.keySeq;if(i){if(aa(t))return"handled";Uo.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),t=i+" "+t}var o=nr(e,t,n);return"multi"==o&&(e.state.keySeq=t),"handled"==o&&bi(e,"keyHandled",e,t,r),("handled"==o||"multi"==o)&&(xa(r),Ee(e)),i&&!o&&/\'$/.test(t)?(xa(r),!0):!!o}function or(e,t){var r=la(t,!0);return r?t.shiftKey&&!e.state.keySeq?ir(e,"Shift-"+r,t,function(t){return rr(e,t,!0)})||ir(e,r,t,function(t){return("string"==typeof t?/^go[A-Z]/.test(t):t.motion)?rr(e,t):void 0}):ir(e,r,t,function(t){return rr(e,t)}):!1}function ar(e,t,r){return ir(e,"'"+r+"'",t,function(t){return rr(e,t,!0)})}function lr(e){var t=this;if(t.curOp.focus=Bi(),!wi(t,e)){ho&&11>po&&27==e.keyCode&&(e.returnValue=!1);var r=e.keyCode;t.display.shift=16==r||e.shiftKey;var n=or(t,e);yo&&(Vo=n?r:null,!n&&88==r&&!$a&&(So?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),18!=r||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||sr(t)}}function sr(e){function t(e){18!=e.keyCode&&e.altKey||(qa(r,"CodeMirror-crosshair"),Sa(document,"keyup",t),Sa(document,"mouseover",t))}var r=e.display.lineDiv;Ra(r,"CodeMirror-crosshair"),Ca(document,"keyup",t),Ca(document,"mouseover",t)}function cr(e){16==e.keyCode&&(this.doc.sel.shift=!1),wi(this,e)}function ur(e){var t=this;if(!(Rt(t.display,e)||wi(t,e)||e.ctrlKey&&!e.altKey||So&&e.metaKey)){var r=e.keyCode,n=e.charCode;if(yo&&r==Vo)return Vo=null,void xa(e);if(!yo||e.which&&!(e.which<10)||!or(t,e)){var i=String.fromCharCode(null==n?r:n);ar(t,e,i)||t.display.input.onKeyPress(e)}}}function dr(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,hr(e))},100)}function fr(e){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(La(e,"focus",e),e.state.focused=!0,Ra(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),mo&&setTimeout(function(){e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Ee(e))}function hr(e){e.state.delayingBlurEvent||(e.state.focused&&(La(e,"blur",e),e.state.focused=!1,qa(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function pr(e,t){Rt(e.display,t)||mr(e,t)||e.display.input.onContextMenu(t)}function mr(e,t){return Ci(e,"gutterContextMenu")?Xt(e,t,"gutterContextMenu",!1,La):!1}function gr(e,t){if(Po(e,t.from)<0)return e;if(Po(e,t.to)<=0)return Go(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=Go(t).ch-t.to.ch),No(r,n)}function vr(e,t){for(var r=[],n=0;n<e.sel.ranges.length;n++){var i=e.sel.ranges[n];r.push(new de(gr(i.anchor,t),gr(i.head,t)))}return fe(r,e.sel.primIndex)}function yr(e,t,r){return e.line==t.line?No(r.line,e.ch-t.ch+r.ch):No(r.line+(e.line-t.line),e.ch)}function br(e,t,r){for(var n=[],i=No(e.first,0),o=i,a=0;a<t.length;a++){var l=t[a],s=yr(l.from,i,o),c=yr(Go(l),i,o);if(i=l.to,o=c,"around"==r){var u=e.sel.ranges[a],d=Po(u.head,u.anchor)<0;n[a]=new de(d?c:s,d?s:c)}else n[a]=new de(s,s)}return new ue(n,e.sel.primIndex)}function xr(e,t,r){var n={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){this.canceled=!0}};return r&&(n.update=function(t,r,n,i){t&&(this.from=me(e,t)),r&&(this.to=me(e,r)),n&&(this.text=n),void 0!==i&&(this.origin=i)}),La(e,"beforeChange",e,n),e.cm&&La(e.cm,"beforeChange",e.cm,n),n.canceled?null:{from:n.from,to:n.to,text:n.text,origin:n.origin}}function wr(e,t,r){if(e.cm){if(!e.cm.curOp)return At(e.cm,wr)(e,t,r);if(e.cm.state.suppressEdits)return}if(!(Ci(e,"beforeChange")||e.cm&&Ci(e.cm,"beforeChange"))||(t=xr(e,t,!0))){var n=Oo&&!r&&nn(e,t.from,t.to);if(n)for(var i=n.length-1;i>=0;--i)kr(e,{from:n[i].from,to:n[i].to,text:i?[""]:t.text});else kr(e,t)}}function kr(e,t){if(1!=t.text.length||""!=t.text[0]||0!=Po(t.from,t.to)){var r=vr(e,t);oi(e,t,r,e.cm?e.cm.curOp.id:0/0),Lr(e,t,r,en(e,t));var n=[];Vn(e,function(e,r){r||-1!=Oi(n,e.history)||(mi(e.history,t),n.push(e.history)),Lr(e,t,null,en(e,t))})}}function Cr(e,t,r){if(!e.cm||!e.cm.state.suppressEdits){for(var n,i=e.history,o=e.sel,a="undo"==t?i.done:i.undone,l="undo"==t?i.undone:i.done,s=0;s<a.length&&(n=a[s],r?!n.ranges||n.equals(e.sel):n.ranges);s++);if(s!=a.length){for(i.lastOrigin=i.lastSelOrigin=null;n=a.pop(),n.ranges;){if(si(n,l),r&&!n.equals(e.sel))return void Me(e,n,{clearRedo:!1});o=n}var c=[];si(o,l),l.push({changes:c,generation:i.generation}),i.generation=n.generation||++i.maxGeneration;for(var u=Ci(e,"beforeChange")||e.cm&&Ci(e.cm,"beforeChange"),s=n.changes.length-1;s>=0;--s){var d=n.changes[s];if(d.origin=t,u&&!xr(e,d,!1))return void(a.length=0);c.push(ri(e,d));var f=s?vr(e,d):Ai(a);Lr(e,d,f,rn(e,d)),!s&&e.cm&&e.cm.scrollIntoView({from:d.from,to:Go(d)});var h=[];Vn(e,function(e,t){t||-1!=Oi(h,e.history)||(mi(e.history,d),h.push(e.history)),Lr(e,d,null,rn(e,d))})}}}}function Sr(e,t){if(0!=t&&(e.first+=t,e.sel=new ue(zi(e.sel.ranges,function(e){return new de(No(e.anchor.line+t,e.anchor.ch),No(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){Dt(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;n<r.viewTo;n++)Wt(e.cm,n,"gutter")}}function Lr(e,t,r,n){if(e.cm&&!e.cm.curOp)return At(e.cm,Lr)(e,t,r,n);if(t.to.line<e.first)return void Sr(e,t.text.length-1-(t.to.line-t.from.line));if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);Sr(e,i),t={from:No(e.first,0),to:No(t.to.line+i,t.to.ch),text:[Ai(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:No(o,Kn(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=$n(e,t.from,t.to),r||(r=vr(e,t)),e.cm?Mr(e.cm,t,n):qn(e,t,n),Te(e,r,Oa)}}function Mr(e,t,r){var n=e.doc,i=e.display,a=t.from,l=t.to,s=!1,c=a.line;e.options.lineWrapping||(c=Zn(pn(Kn(n,a.line))),n.iter(c,l.line+1,function(e){return e==i.maxLine?(s=!0,!0):void 0})),n.sel.contains(t.from,t.to)>-1&&ki(e),qn(n,t,r,o(e)),e.options.lineWrapping||(n.iter(c,a.line+t.text.length,function(e){var t=d(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,s=!1)}),s&&(e.curOp.updateMaxLine=!0)),n.frontier=Math.min(n.frontier,a.line),Fe(e,400);var u=t.text.length-(l.line-a.line)-1;t.full?Dt(e):a.line!=l.line||1!=t.text.length||Bn(e.doc,t)?Dt(e,a.line,l.line+1,u):Wt(e,a.line,"text");var f=Ci(e,"changes"),h=Ci(e,"change");if(h||f){var p={from:a,to:l,text:t.text,removed:t.removed,origin:t.origin};h&&bi(e,"change",e,p),f&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(p)}e.display.selForContextMenu=null}function Tr(e,t,r,n,i){if(n||(n=r),Po(n,r)<0){var o=n;n=r,r=o}"string"==typeof t&&(t=Ga(t)),wr(e,{from:r,to:n,text:t,origin:i})}function Ar(e,t){if(!wi(e,"scrollCursorIntoView")){var r=e.display,n=r.sizer.getBoundingClientRect(),i=null;if(t.top+n.top<0?i=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!wo){var o=Hi("div","",null,"position: absolute; top: "+(t.top-r.viewOffset-Be(e.display))+"px; height: "+(t.bottom-t.top+Ue(e)+r.barHeight)+"px; left: "+t.left+"px; width: 2px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}function Or(e,t,r,n){null==n&&(n=0);for(var i=0;5>i;i++){var o=!1,a=dt(e,t),l=r&&r!=t?dt(e,r):a,s=Nr(e,Math.min(a.left,l.left),Math.min(a.top,l.top)-n,Math.max(a.left,l.left),Math.max(a.bottom,l.bottom)+n),c=e.doc.scrollTop,u=e.doc.scrollLeft;if(null!=s.scrollTop&&(Jt(e,s.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(o=!0)),null!=s.scrollLeft&&(er(e,s.scrollLeft),Math.abs(e.doc.scrollLeft-u)>1&&(o=!0)),!o)break}return a}function zr(e,t,r,n,i){var o=Nr(e,t,r,n,i);null!=o.scrollTop&&Jt(e,o.scrollTop),null!=o.scrollLeft&&er(e,o.scrollLeft)}function Nr(e,t,r,n,i){var o=e.display,a=gt(e.display);0>r&&(r=0);var l=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:o.scroller.scrollTop,s=Ge(e),c={};i-r>s&&(i=r+s);var u=e.doc.height+qe(o),d=a>r,f=i>u-a;if(l>r)c.scrollTop=d?0:r;else if(i>l+s){var h=Math.min(r,(f?u:i)-s);h!=l&&(c.scrollTop=h)}var p=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:o.scroller.scrollLeft,m=Ve(e)-(e.options.fixedGutter?o.gutters.offsetWidth:0),g=n-t>m;return g&&(n=t+m),10>t?c.scrollLeft=0:p>t?c.scrollLeft=Math.max(0,t-(g?0:10)):n>m+p-3&&(c.scrollLeft=n+(g?0:10)-m),c}function Pr(e,t,r){(null!=t||null!=r)&&Wr(e),null!=t&&(e.curOp.scrollLeft=(null==e.curOp.scrollLeft?e.doc.scrollLeft:e.curOp.scrollLeft)+t),null!=r&&(e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+r)}function Dr(e){Wr(e);var t=e.getCursor(),r=t,n=t;e.options.lineWrapping||(r=t.ch?No(t.line,t.ch-1):t,n=No(t.line,t.ch+1)),e.curOp.scrollToPos={from:r,to:n,margin:e.options.cursorScrollMargin,isCursor:!0}}function Wr(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var r=ft(e,t.from),n=ft(e,t.to),i=Nr(e,Math.min(r.left,n.left),Math.min(r.top,n.top)-t.margin,Math.max(r.right,n.right),Math.max(r.bottom,n.bottom)+t.margin);e.scrollTo(i.scrollLeft,i.scrollTop)}}function Ir(e,t,r,n){var i,o=e.doc;null==r&&(r="add"),"smart"==r&&(o.mode.indent?i=je(e,t):r="prev");var a=e.options.tabSize,l=Kn(o,t),s=Pa(l.text,null,a);l.stateAfter&&(l.stateAfter=null);var c,u=l.text.match(/^\s*/)[0];if(n||/\S/.test(l.text)){if("smart"==r&&(c=o.mode.indent(i,l.text.slice(u.length),l.text),c==Aa||c>150)){if(!n)return;r="prev"}}else c=0,r="not";"prev"==r?c=t>o.first?Pa(Kn(o,t-1).text,null,a):0:"add"==r?c=s+e.options.indentUnit:"subtract"==r?c=s-e.options.indentUnit:"number"==typeof r&&(c=s+r),c=Math.max(0,c);var d="",f=0;if(e.options.indentWithTabs)for(var h=Math.floor(c/a);h;--h)f+=a,d+=" ";if(c>f&&(d+=Ti(c-f)),d!=u)return Tr(o,d,No(t,0),No(t,u.length),"+input"),l.stateAfter=null,!0;for(var h=0;h<o.sel.ranges.length;h++){var p=o.sel.ranges[h];if(p.head.line==t&&p.head.ch<u.length){var f=No(t,u.length);ke(o,h,new de(f,f));break}}}function Er(e,t,r,n){var i=t,o=t;return"number"==typeof t?o=Kn(e,pe(e,t)):i=Zn(t),null==i?null:(n(o,i)&&e.cm&&Wt(e.cm,i,r),o)}function Fr(e,t){for(var r=e.doc.sel.ranges,n=[],i=0;i<r.length;i++){for(var o=t(r[i]);n.length&&Po(o.from,Ai(n).to)<=0;){var a=n.pop();if(Po(a.from,o.from)<0){o.from=a.from;break}}n.push(o)}Tt(e,function(){for(var t=n.length-1;t>=0;t--)Tr(e.doc,"",n[t].from,n[t].to,"+delete");Dr(e)})}function Hr(e,t,r,n,i){function o(){var t=l+r;return t<e.first||t>=e.first+e.size?d=!1:(l=t,u=Kn(e,t))}function a(e){var t=(i?lo:so)(u,s,r,!0);if(null==t){if(e||!o())return d=!1;s=i?(0>r?eo:Ji)(u):0>r?u.text.length:0}else s=t;return!0}var l=t.line,s=t.ch,c=r,u=Kn(e,l),d=!0;if("char"==n)a();else if("column"==n)a(!0);else if("word"==n||"group"==n)for(var f=null,h="group"==n,p=e.cm&&e.cm.getHelper(t,"wordChars"),m=!0;!(0>r)||a(!m);m=!1){var g=u.text.charAt(s)||"\n",v=Ii(g,p)?"w":h&&"\n"==g?"n":!h||/\s/.test(g)?null:"p";if(!h||m||v||(v="s"),f&&f!=v){0>r&&(r=1,a());break}if(v&&(f=v), -r>0&&!a(!m))break}var y=Ne(e,No(l,s),c,!0);return d||(y.hitSide=!0),y}function _r(e,t,r,n){var i,o=e.doc,a=t.left;if("page"==n){var l=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);i=t.top+r*(l-(0>r?1.5:.5)*gt(e.display))}else"line"==n&&(i=r>0?t.bottom+3:t.top-3);for(;;){var s=pt(e,a,i);if(!s.outside)break;if(0>r?0>=i:i>=o.height){s.hitSide=!0;break}i+=5*r}return s}function jr(t,r,n,i){e.defaults[t]=r,n&&($o[t]=i?function(e,t,r){r!=Xo&&n(e,t,r)}:n)}function Br(e){for(var t,r,n,i,o=e.split(/-(?!$)/),e=o[o.length-1],a=0;a<o.length-1;a++){var l=o[a];if(/^(cmd|meta|m)$/i.test(l))i=!0;else if(/^a(lt)?$/i.test(l))t=!0;else if(/^(c|ctrl|control)$/i.test(l))r=!0;else{if(!/^s(hift)$/i.test(l))throw new Error("Unrecognized modifier name: "+l);n=!0}}return t&&(e="Alt-"+e),r&&(e="Ctrl-"+e),i&&(e="Cmd-"+e),n&&(e="Shift-"+e),e}function qr(e){return"string"==typeof e?ia[e]:e}function Rr(e,t,r,n,i){if(n&&n.shared)return Ur(e,t,r,n,i);if(e.cm&&!e.cm.curOp)return At(e.cm,Rr)(e,t,r,n,i);var o=new ua(e,i),a=Po(t,r);if(n&&Di(n,o,!1),a>0||0==a&&o.clearWhenEmpty!==!1)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=Hi("span",[o.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(hn(e,t.line,t,r,o)||t.line!=r.line&&hn(e,r.line,t,r,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");zo=!0}o.addToHistory&&oi(e,{from:t,to:r,origin:"markText"},e.sel,0/0);var l,s=t.line,c=e.cm;if(e.iter(s,r.line+1,function(e){c&&o.collapsed&&!c.options.lineWrapping&&pn(e)==c.display.maxLine&&(l=!0),o.collapsed&&s!=t.line&&Yn(e,0),Zr(e,new $r(o,s==t.line?t.ch:null,s==r.line?r.ch:null)),++s}),o.collapsed&&e.iter(t.line,r.line+1,function(t){yn(e,t)&&Yn(t,0)}),o.clearOnEnter&&Ca(o,"beforeCursorEnter",function(){o.clear()}),o.readOnly&&(Oo=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++ca,o.atomic=!0),c){if(l&&(c.curOp.updateMaxLine=!0),o.collapsed)Dt(c,t.line,r.line+1);else if(o.className||o.title||o.startStyle||o.endStyle||o.css)for(var u=t.line;u<=r.line;u++)Wt(c,u,"text");o.atomic&&Oe(c.doc),bi(c,"markerAdded",c,o)}return o}function Ur(e,t,r,n,i){n=Di(n),n.shared=!1;var o=[Rr(e,t,r,n,i)],a=o[0],l=n.widgetNode;return Vn(e,function(e){l&&(n.widgetNode=l.cloneNode(!0)),o.push(Rr(e,me(e,t),me(e,r),n,i));for(var s=0;s<e.linked.length;++s)if(e.linked[s].isParent)return;a=Ai(o)}),new da(o,a)}function Vr(e){return e.findMarks(No(e.first,0),e.clipPos(No(e.lastLine())),function(e){return e.parent})}function Gr(e,t){for(var r=0;r<t.length;r++){var n=t[r],i=n.find(),o=e.clipPos(i.from),a=e.clipPos(i.to);if(Po(o,a)){var l=Rr(e,o,a,n.primary,n.primary.type);n.markers.push(l),l.parent=n}}}function Kr(e){for(var t=0;t<e.length;t++){var r=e[t],n=[r.primary.doc];Vn(r.primary.doc,function(e){n.push(e)});for(var i=0;i<r.markers.length;i++){var o=r.markers[i];-1==Oi(n,o.doc)&&(o.parent=null,r.markers.splice(i--,1))}}}function $r(e,t,r){this.marker=e,this.from=t,this.to=r}function Xr(e,t){if(e)for(var r=0;r<e.length;++r){var n=e[r];if(n.marker==t)return n}}function Yr(e,t){for(var r,n=0;n<e.length;++n)e[n]!=t&&(r||(r=[])).push(e[n]);return r}function Zr(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Qr(e,t,r){if(e)for(var n,i=0;i<e.length;++i){var o=e[i],a=o.marker,l=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);if(l||o.from==t&&"bookmark"==a.type&&(!r||!o.marker.insertLeft)){var s=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);(n||(n=[])).push(new $r(a,o.from,s?null:o.to))}}return n}function Jr(e,t,r){if(e)for(var n,i=0;i<e.length;++i){var o=e[i],a=o.marker,l=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);if(l||o.from==t&&"bookmark"==a.type&&(!r||o.marker.insertLeft)){var s=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);(n||(n=[])).push(new $r(a,s?null:o.from-t,null==o.to?null:o.to-t))}}return n}function en(e,t){if(t.full)return null;var r=ve(e,t.from.line)&&Kn(e,t.from.line).markedSpans,n=ve(e,t.to.line)&&Kn(e,t.to.line).markedSpans;if(!r&&!n)return null;var i=t.from.ch,o=t.to.ch,a=0==Po(t.from,t.to),l=Qr(r,i,a),s=Jr(n,o,a),c=1==t.text.length,u=Ai(t.text).length+(c?i:0);if(l)for(var d=0;d<l.length;++d){var f=l[d];if(null==f.to){var h=Xr(s,f.marker);h?c&&(f.to=null==h.to?null:h.to+u):f.to=i}}if(s)for(var d=0;d<s.length;++d){var f=s[d];if(null!=f.to&&(f.to+=u),null==f.from){var h=Xr(l,f.marker);h||(f.from=u,c&&(l||(l=[])).push(f))}else f.from+=u,c&&(l||(l=[])).push(f)}l&&(l=tn(l)),s&&s!=l&&(s=tn(s));var p=[l];if(!c){var m,g=t.text.length-2;if(g>0&&l)for(var d=0;d<l.length;++d)null==l[d].to&&(m||(m=[])).push(new $r(l[d].marker,null,null));for(var d=0;g>d;++d)p.push(m);p.push(s)}return p}function tn(e){for(var t=0;t<e.length;++t){var r=e[t];null!=r.from&&r.from==r.to&&r.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function rn(e,t){var r=di(e,t),n=en(e,t);if(!r)return n;if(!n)return r;for(var i=0;i<r.length;++i){var o=r[i],a=n[i];if(o&&a)e:for(var l=0;l<a.length;++l){for(var s=a[l],c=0;c<o.length;++c)if(o[c].marker==s.marker)continue e;o.push(s)}else a&&(r[i]=a)}return r}function nn(e,t,r){var n=null;if(e.iter(t.line,r.line+1,function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var r=e.markedSpans[t].marker;!r.readOnly||n&&-1!=Oi(n,r)||(n||(n=[])).push(r)}}),!n)return null;for(var i=[{from:t,to:r}],o=0;o<n.length;++o)for(var a=n[o],l=a.find(0),s=0;s<i.length;++s){var c=i[s];if(!(Po(c.to,l.from)<0||Po(c.from,l.to)>0)){var u=[s,1],d=Po(c.from,l.from),f=Po(c.to,l.to);(0>d||!a.inclusiveLeft&&!d)&&u.push({from:c.from,to:l.from}),(f>0||!a.inclusiveRight&&!f)&&u.push({from:l.to,to:c.to}),i.splice.apply(i,u),s+=u.length-1}}return i}function on(e){var t=e.markedSpans;if(t){for(var r=0;r<t.length;++r)t[r].marker.detachLine(e);e.markedSpans=null}}function an(e,t){if(t){for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}}function ln(e){return e.inclusiveLeft?-1:0}function sn(e){return e.inclusiveRight?1:0}function cn(e,t){var r=e.lines.length-t.lines.length;if(0!=r)return r;var n=e.find(),i=t.find(),o=Po(n.from,i.from)||ln(e)-ln(t);if(o)return-o;var a=Po(n.to,i.to)||sn(e)-sn(t);return a?a:t.id-e.id}function un(e,t){var r,n=zo&&e.markedSpans;if(n)for(var i,o=0;o<n.length;++o)i=n[o],i.marker.collapsed&&null==(t?i.from:i.to)&&(!r||cn(r,i.marker)<0)&&(r=i.marker);return r}function dn(e){return un(e,!0)}function fn(e){return un(e,!1)}function hn(e,t,r,n,i){var o=Kn(e,t),a=zo&&o.markedSpans;if(a)for(var l=0;l<a.length;++l){var s=a[l];if(s.marker.collapsed){var c=s.marker.find(0),u=Po(c.from,r)||ln(s.marker)-ln(i),d=Po(c.to,n)||sn(s.marker)-sn(i);if(!(u>=0&&0>=d||0>=u&&d>=0)&&(0>=u&&(Po(c.to,r)>0||s.marker.inclusiveRight&&i.inclusiveLeft)||u>=0&&(Po(c.from,n)<0||s.marker.inclusiveLeft&&i.inclusiveRight)))return!0}}}function pn(e){for(var t;t=dn(e);)e=t.find(-1,!0).line;return e}function mn(e){for(var t,r;t=fn(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function gn(e,t){var r=Kn(e,t),n=pn(r);return r==n?t:Zn(n)}function vn(e,t){if(t>e.lastLine())return t;var r,n=Kn(e,t);if(!yn(e,n))return t;for(;r=fn(n);)n=r.find(1,!0).line;return Zn(n)+1}function yn(e,t){var r=zo&&t.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.widgetNode&&0==n.from&&n.marker.inclusiveLeft&&bn(e,t,n))return!0}}function bn(e,t,r){if(null==r.to){var n=r.marker.find(1,!0);return bn(e,n.line,Xr(n.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==t.text.length)return!0;for(var i,o=0;o<t.markedSpans.length;++o)if(i=t.markedSpans[o],i.marker.collapsed&&!i.marker.widgetNode&&i.from==r.to&&(null==i.to||i.to!=r.from)&&(i.marker.inclusiveLeft||r.marker.inclusiveRight)&&bn(e,t,i))return!0}function xn(e,t,r){Jn(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Pr(e,null,r)}function wn(e){if(null!=e.height)return e.height;var t=e.doc.cm;if(!t)return 0;if(!_a(document.body,e.node)){var r="position: relative;";e.coverGutter&&(r+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(r+="width: "+t.display.wrapper.clientWidth+"px;"),ji(t.display.measure,Hi("div",[e.node],null,r))}return e.height=e.node.offsetHeight}function kn(e,t,r,n){var i=new fa(e,r,n),o=e.cm;return o&&i.noHScroll&&(o.display.alignWidgets=!0),Er(e,t,"widget",function(t){var r=t.widgets||(t.widgets=[]);if(null==i.insertAt?r.push(i):r.splice(Math.min(r.length-1,Math.max(0,i.insertAt)),0,i),i.line=t,o&&!yn(e,t)){var n=Jn(t)<e.scrollTop;Yn(t,t.height+wn(i)),n&&Pr(o,null,i.height),o.curOp.forceUpdate=!0}return!0}),i}function Cn(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),on(e),an(e,r);var i=n?n(e):1;i!=e.height&&Yn(e,i)}function Sn(e){e.parent=null,on(e)}function Ln(e,t){if(e)for(;;){var r=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!r)break;e=e.slice(0,r.index)+e.slice(r.index+r[0].length);var n=r[1]?"bgClass":"textClass";null==t[n]?t[n]=r[2]:new RegExp("(?:^|s)"+r[2]+"(?:$|s)").test(t[n])||(t[n]+=" "+r[2])}return e}function Mn(t,r){if(t.blankLine)return t.blankLine(r);if(t.innerMode){var n=e.innerMode(t,r);return n.mode.blankLine?n.mode.blankLine(n.state):void 0}}function Tn(t,r,n,i){for(var o=0;10>o;o++){i&&(i[0]=e.innerMode(t,n).mode);var a=t.token(r,n);if(r.pos>r.start)return a}throw new Error("Mode "+t.name+" failed to advance stream.")}function An(e,t,r,n){function i(e){return{start:d.start,end:d.pos,string:d.current(),type:o||null,state:e?ta(a.mode,u):u}}var o,a=e.doc,l=a.mode;t=me(a,t);var s,c=Kn(a,t.line),u=je(e,t.line,r),d=new sa(c.text,e.options.tabSize);for(n&&(s=[]);(n||d.pos<t.ch)&&!d.eol();)d.start=d.pos,o=Tn(l,d,u),n&&s.push(i(!0));return n?s:i()}function On(e,t,r,n,i,o,a){var l=r.flattenSpans;null==l&&(l=e.options.flattenSpans);var s,c=0,u=null,d=new sa(t,e.options.tabSize),f=e.options.addModeClass&&[null];for(""==t&&Ln(Mn(r,n),o);!d.eol();){if(d.pos>e.options.maxHighlightLength?(l=!1,a&&Pn(e,t,n,d.pos),d.pos=t.length,s=null):s=Ln(Tn(r,d,n,f),o),f){var h=f[0].name;h&&(s="m-"+(s?h+" "+s:h))}if(!l||u!=s){for(;c<d.start;)c=Math.min(d.start,c+5e4),i(c,u);u=s}d.start=d.pos}for(;c<d.pos;){var p=Math.min(d.pos,c+5e4);i(p,u),c=p}}function zn(e,t,r,n){var i=[e.state.modeGen],o={};On(e,t.text,e.doc.mode,r,function(e,t){i.push(e,t)},o,n);for(var a=0;a<e.state.overlays.length;++a){var l=e.state.overlays[a],s=1,c=0;On(e,t.text,l.mode,!0,function(e,t){for(var r=s;e>c;){var n=i[s];n>e&&i.splice(s,1,e,i[s+1],n),s+=2,c=Math.min(e,n)}if(t)if(l.opaque)i.splice(r,s-r,e,"cm-overlay "+t),s=r+2;else for(;s>r;r+=2){var o=i[r+1];i[r+1]=(o?o+" ":"")+"cm-overlay "+t}},o)}return{styles:i,classes:o.bgClass||o.textClass?o:null}}function Nn(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=zn(e,t,t.stateAfter=je(e,Zn(t)));t.styles=n.styles,n.classes?t.styleClasses=n.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.frontier&&e.doc.frontier++}return t.styles}function Pn(e,t,r,n){var i=e.doc.mode,o=new sa(t,e.options.tabSize);for(o.start=o.pos=n||0,""==t&&Mn(i,r);!o.eol()&&o.pos<=e.options.maxHighlightLength;)Tn(i,o,r),o.start=o.pos}function Dn(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?ma:pa;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function Wn(e,t){var r=Hi("span",null,null,mo?"padding-right: .1px":null),n={pre:Hi("pre",[r]),content:r,col:0,pos:0,cm:e,splitSpaces:(ho||mo)&&e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o,a=i?t.rest[i-1]:t.line;n.pos=0,n.addToken=En,$i(e.display.measure)&&(o=ei(a))&&(n.addToken=Hn(n.addToken,o)),n.map=[];var l=t!=e.display.externalMeasured&&Zn(a);jn(a,n,Nn(e,a,l)),a.styleClasses&&(a.styleClasses.bgClass&&(n.bgClass=Ri(a.styleClasses.bgClass,n.bgClass||"")),a.styleClasses.textClass&&(n.textClass=Ri(a.styleClasses.textClass,n.textClass||""))),0==n.map.length&&n.map.push(0,0,n.content.appendChild(Ki(e.display.measure))),0==i?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}return mo&&/\bcm-tab\b/.test(n.content.lastChild.className)&&(n.content.className="cm-tab-wrap-hack"),La(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=Ri(n.pre.className,n.textClass||"")),n}function In(e){var t=Hi("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function En(e,t,r,n,i,o,a){if(t){var l=e.splitSpaces?t.replace(/ {3,}/g,Fn):t,s=e.cm.state.specialChars,c=!1;if(s.test(t))for(var u=document.createDocumentFragment(),d=0;;){s.lastIndex=d;var f=s.exec(t),h=f?f.index-d:t.length-d;if(h){var p=document.createTextNode(l.slice(d,d+h));u.appendChild(ho&&9>po?Hi("span",[p]):p),e.map.push(e.pos,e.pos+h,p),e.col+=h,e.pos+=h}if(!f)break;if(d+=h+1," "==f[0]){var m=e.cm.options.tabSize,g=m-e.col%m,p=u.appendChild(Hi("span",Ti(g),"cm-tab"));p.setAttribute("role","presentation"),p.setAttribute("cm-text"," "),e.col+=g}else{var p=e.cm.options.specialCharPlaceholder(f[0]);p.setAttribute("cm-text",f[0]),u.appendChild(ho&&9>po?Hi("span",[p]):p),e.col+=1}e.map.push(e.pos,e.pos+1,p),e.pos++}else{e.col+=t.length;var u=document.createTextNode(l);e.map.push(e.pos,e.pos+t.length,u),ho&&9>po&&(c=!0),e.pos+=t.length}if(r||n||i||c||a){var v=r||"";n&&(v+=n),i&&(v+=i);var y=Hi("span",[u],v,a);return o&&(y.title=o),e.content.appendChild(y)}e.content.appendChild(u)}}function Fn(e){for(var t=" ",r=0;r<e.length-2;++r)t+=r%2?" ":" ";return t+=" "}function Hn(e,t){return function(r,n,i,o,a,l,s){i=i?i+" cm-force-border":"cm-force-border";for(var c=r.pos,u=c+n.length;;){for(var d=0;d<t.length;d++){var f=t[d];if(f.to>c&&f.from<=c)break}if(f.to>=u)return e(r,n,i,o,a,l,s);e(r,n.slice(0,f.to-c),i,o,null,l,s),o=null,n=n.slice(f.to-c),c=f.to}}}function _n(e,t,r,n){var i=!n&&r.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!n&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",r.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t}function jn(e,t,r){var n=e.markedSpans,i=e.text,o=0;if(n)for(var a,l,s,c,u,d,f,h=i.length,p=0,m=1,g="",v=0;;){if(v==p){s=c=u=d=l="",f=null,v=1/0;for(var y=[],b=0;b<n.length;++b){var x=n[b],w=x.marker;"bookmark"==w.type&&x.from==p&&w.widgetNode?y.push(w):x.from<=p&&(null==x.to||x.to>p||w.collapsed&&x.to==p&&x.from==p)?(null!=x.to&&x.to!=p&&v>x.to&&(v=x.to,c=""),w.className&&(s+=" "+w.className),w.css&&(l=w.css),w.startStyle&&x.from==p&&(u+=" "+w.startStyle),w.endStyle&&x.to==v&&(c+=" "+w.endStyle),w.title&&!d&&(d=w.title),w.collapsed&&(!f||cn(f.marker,w)<0)&&(f=x)):x.from>p&&v>x.from&&(v=x.from)}if(f&&(f.from||0)==p){if(_n(t,(null==f.to?h+1:f.to)-p,f.marker,null==f.from),null==f.to)return;f.to==p&&(f=!1)}if(!f&&y.length)for(var b=0;b<y.length;++b)_n(t,0,y[b])}if(p>=h)break;for(var k=Math.min(h,v);;){if(g){var C=p+g.length;if(!f){var S=C>k?g.slice(0,k-p):g;t.addToken(t,S,a?a+s:s,u,p+S.length==v?c:"",d,l)}if(C>=k){g=g.slice(k-p),p=k;break}p=C,u=""}g=i.slice(o,o=r[m++]),a=Dn(r[m++],t.cm.options)}}else for(var m=1;m<r.length;m+=2)t.addToken(t,i.slice(o,o=r[m]),Dn(r[m+1],t.cm.options))}function Bn(e,t){return 0==t.from.ch&&0==t.to.ch&&""==Ai(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function qn(e,t,r,n){function i(e){return r?r[e]:null}function o(e,r,i){Cn(e,r,i,n),bi(e,"change",e,t)}function a(e,t){for(var r=e,o=[];t>r;++r)o.push(new ha(c[r],i(r),n));return o}var l=t.from,s=t.to,c=t.text,u=Kn(e,l.line),d=Kn(e,s.line),f=Ai(c),h=i(c.length-1),p=s.line-l.line;if(t.full)e.insert(0,a(0,c.length)),e.remove(c.length,e.size-c.length);else if(Bn(e,t)){var m=a(0,c.length-1);o(d,d.text,h),p&&e.remove(l.line,p),m.length&&e.insert(l.line,m)}else if(u==d)if(1==c.length)o(u,u.text.slice(0,l.ch)+f+u.text.slice(s.ch),h);else{var m=a(1,c.length-1);m.push(new ha(f+u.text.slice(s.ch),h,n)),o(u,u.text.slice(0,l.ch)+c[0],i(0)),e.insert(l.line+1,m)}else if(1==c.length)o(u,u.text.slice(0,l.ch)+c[0]+d.text.slice(s.ch),i(0)),e.remove(l.line+1,p);else{o(u,u.text.slice(0,l.ch)+c[0],i(0)),o(d,f+d.text.slice(s.ch),h);var m=a(1,c.length-1);p>1&&e.remove(l.line+1,p-1),e.insert(l.line+1,m)}bi(e,"change",e,t)}function Rn(e){this.lines=e,this.parent=null;for(var t=0,r=0;t<e.length;++t)e[t].parent=this,r+=e[t].height;this.height=r}function Un(e){this.children=e;for(var t=0,r=0,n=0;n<e.length;++n){var i=e[n];t+=i.chunkSize(),r+=i.height,i.parent=this}this.size=t,this.height=r,this.parent=null}function Vn(e,t,r){function n(e,i,o){if(e.linked)for(var a=0;a<e.linked.length;++a){var l=e.linked[a];if(l.doc!=i){var s=o&&l.sharedHist;(!r||s)&&(t(l.doc,s),n(l.doc,e,s))}}}n(e,null,!0)}function Gn(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,a(e),r(e),e.options.lineWrapping||f(e),e.options.mode=t.modeOption,Dt(e)}function Kn(e,t){if(t-=e.first,0>t||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var n=0;;++n){var i=r.children[n],o=i.chunkSize();if(o>t){r=i;break}t-=o}return r.lines[t]}function $n(e,t,r){var n=[],i=t.line;return e.iter(t.line,r.line+1,function(e){var o=e.text;i==r.line&&(o=o.slice(0,r.ch)),i==t.line&&(o=o.slice(t.ch)),n.push(o),++i}),n}function Xn(e,t,r){var n=[];return e.iter(t,r,function(e){n.push(e.text)}),n}function Yn(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function Zn(e){if(null==e.parent)return null;for(var t=e.parent,r=Oi(t.lines,e),n=t.parent;n;t=n,n=n.parent)for(var i=0;n.children[i]!=t;++i)r+=n.children[i].chunkSize();return r+t.first}function Qn(e,t){var r=e.first;e:do{for(var n=0;n<e.children.length;++n){var i=e.children[n],o=i.height;if(o>t){e=i;continue e}t-=o,r+=i.chunkSize()}return r}while(!e.lines);for(var n=0;n<e.lines.length;++n){var a=e.lines[n],l=a.height;if(l>t)break;t-=l}return r+n}function Jn(e){e=pn(e);for(var t=0,r=e.parent,n=0;n<r.lines.length;++n){var i=r.lines[n];if(i==e)break;t+=i.height}for(var o=r.parent;o;r=o,o=r.parent)for(var n=0;n<o.children.length;++n){var a=o.children[n];if(a==r)break;t+=a.height}return t}function ei(e){var t=e.order;return null==t&&(t=e.order=Qa(e.text)),t}function ti(e){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function ri(e,t){var r={from:K(t.from),to:Go(t),text:$n(e,t.from,t.to)};return ci(e,r,t.from.line,t.to.line+1),Vn(e,function(e){ci(e,r,t.from.line,t.to.line+1)},!0),r}function ni(e){for(;e.length;){var t=Ai(e);if(!t.ranges)break;e.pop()}}function ii(e,t){return t?(ni(e.done),Ai(e.done)):e.done.length&&!Ai(e.done).ranges?Ai(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),Ai(e.done)):void 0}function oi(e,t,r,n){if("ignoreHistory"!=t.origin){var i=e.history;i.undone.length=0;var o,a=+new Date;if((i.lastOp==n||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&e.cm&&i.lastModTime>a-e.cm.options.historyEventDelay||"*"==t.origin.charAt(0)))&&(o=ii(i,i.lastOp==n))){var l=Ai(o.changes);0==Po(t.from,t.to)&&0==Po(t.from,l.to)?l.to=Go(t):o.changes.push(ri(e,t))}else{var s=Ai(i.done);for(s&&s.ranges||si(e.sel,i.done),o={changes:[ri(e,t)],generation:i.generation},i.done.push(o);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(r),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=a,i.lastOp=i.lastSelOp=n,i.lastOrigin=i.lastSelOrigin=t.origin,l||La(e,"historyAdded")}}function ai(e,t,r,n){var i=t.charAt(0);return"*"==i||"+"==i&&r.ranges.length==n.ranges.length&&r.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function li(e,t,r,n){var i=e.history,o=n&&n.origin;r==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||ai(e,o,Ai(i.done),t))?i.done[i.done.length-1]=t:si(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=r,n&&n.clearRedo!==!1&&ni(i.undone)}function si(e,t){var r=Ai(t);r&&r.ranges&&r.equals(e)||t.push(e)}function ci(e,t,r,n){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),function(r){r.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=r.markedSpans),++o})}function ui(e){if(!e)return null;for(var t,r=0;r<e.length;++r)e[r].marker.explicitlyCleared?t||(t=e.slice(0,r)):t&&t.push(e[r]);return t?t.length?t:null:e}function di(e,t){var r=t["spans_"+e.id];if(!r)return null;for(var n=0,i=[];n<t.text.length;++n)i.push(ui(r[n]));return i}function fi(e,t,r){for(var n=0,i=[];n<e.length;++n){var o=e[n];if(o.ranges)i.push(r?ue.prototype.deepCopy.call(o):o);else{var a=o.changes,l=[];i.push({changes:l});for(var s=0;s<a.length;++s){var c,u=a[s];if(l.push({from:u.from,to:u.to,text:u.text}),t)for(var d in u)(c=d.match(/^spans_(\d+)$/))&&Oi(t,Number(c[1]))>-1&&(Ai(l)[d]=u[d],delete u[d])}}}return i}function hi(e,t,r,n){r<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function pi(e,t,r,n){for(var i=0;i<e.length;++i){var o=e[i],a=!0;if(o.ranges){o.copied||(o=e[i]=o.deepCopy(),o.copied=!0);for(var l=0;l<o.ranges.length;l++)hi(o.ranges[l].anchor,t,r,n),hi(o.ranges[l].head,t,r,n)}else{for(var l=0;l<o.changes.length;++l){var s=o.changes[l];if(r<s.from.line)s.from=No(s.from.line+n,s.from.ch),s.to=No(s.to.line+n,s.to.ch);else if(t<=s.to.line){a=!1;break}}a||(e.splice(0,i+1),i=0)}}}function mi(e,t){var r=t.from.line,n=t.to.line,i=t.text.length-(n-r)-1;pi(e.done,r,n,i),pi(e.undone,r,n,i)}function gi(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function vi(e){return e.target||e.srcElement}function yi(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),So&&e.ctrlKey&&1==t&&(t=3),t}function bi(e,t){function r(e){return function(){e.apply(null,o)}}var n=e._handlers&&e._handlers[t];if(n){var i,o=Array.prototype.slice.call(arguments,2);Ho?i=Ho.delayedCallbacks:Ma?i=Ma:(i=Ma=[],setTimeout(xi,0));for(var a=0;a<n.length;++a)i.push(r(n[a]))}}function xi(){var e=Ma;Ma=null;for(var t=0;t<e.length;++t)e[t]()}function wi(e,t,r){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),La(e,r||t.type,e,t),gi(t)||t.codemirrorIgnore}function ki(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var r=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),n=0;n<t.length;++n)-1==Oi(r,t[n])&&r.push(t[n])}function Ci(e,t){var r=e._handlers&&e._handlers[t];return r&&r.length>0}function Si(e){e.prototype.on=function(e,t){Ca(this,e,t)},e.prototype.off=function(e,t){Sa(this,e,t)}}function Li(){this.id=null}function Mi(e,t,r){for(var n=0,i=0;;){var o=e.indexOf(" ",n);-1==o&&(o=e.length);var a=o-n;if(o==e.length||i+a>=t)return n+Math.min(a,t-i);if(i+=o-n,i+=r-i%r,n=o+1,i>=t)return n}}function Ti(e){for(;Da.length<=e;)Da.push(Ai(Da)+" ");return Da[e]}function Ai(e){return e[e.length-1]}function Oi(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}function zi(e,t){for(var r=[],n=0;n<e.length;n++)r[n]=t(e[n],n);return r}function Ni(){}function Pi(e,t){var r;return Object.create?r=Object.create(e):(Ni.prototype=e,r=new Ni),t&&Di(t,r),r}function Di(e,t,r){t||(t={});for(var n in e)!e.hasOwnProperty(n)||r===!1&&t.hasOwnProperty(n)||(t[n]=e[n]);return t}function Wi(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function Ii(e,t){return t?t.source.indexOf("\\w")>-1&&Fa(e)?!0:t.test(e):Fa(e)}function Ei(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function Fi(e){return e.charCodeAt(0)>=768&&Ha.test(e)}function Hi(e,t,r,n){var i=document.createElement(e);if(r&&(i.className=r),n&&(i.style.cssText=n),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)i.appendChild(t[o]);return i}function _i(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function ji(e,t){return _i(e).appendChild(t)}function Bi(){return document.activeElement}function qi(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}function Ri(e,t){for(var r=e.split(" "),n=0;n<r.length;n++)r[n]&&!qi(r[n]).test(t)&&(t+=" "+r[n]);return t}function Ui(e){if(document.body.getElementsByClassName)for(var t=document.body.getElementsByClassName("CodeMirror"),r=0;r<t.length;r++){var n=t[r].CodeMirror;n&&e(n)}}function Vi(){Ua||(Gi(),Ua=!0)}function Gi(){var e;Ca(window,"resize",function(){null==e&&(e=setTimeout(function(){e=null,Ui(qt)},100))}),Ca(window,"blur",function(){Ui(hr)})}function Ki(e){if(null==ja){var t=Hi("span","");ji(e,Hi("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(ja=t.offsetWidth<=1&&t.offsetHeight>2&&!(ho&&8>po))}var r=ja?Hi("span",""):Hi("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}function $i(e){if(null!=Ba)return Ba;var t=ji(e,document.createTextNode("AخA")),r=Ia(t,0,1).getBoundingClientRect();if(!r||r.left==r.right)return!1;var n=Ia(t,1,2).getBoundingClientRect();return Ba=n.right-r.right<3}function Xi(e){if(null!=Xa)return Xa;var t=ji(e,Hi("span","x")),r=t.getBoundingClientRect(),n=Ia(t,0,1).getBoundingClientRect();return Xa=Math.abs(r.left-n.left)>1}function Yi(e,t,r,n){if(!e)return n(t,r,"ltr");for(var i=!1,o=0;o<e.length;++o){var a=e[o];(a.from<r&&a.to>t||t==r&&a.to==t)&&(n(Math.max(a.from,t),Math.min(a.to,r),1==a.level?"rtl":"ltr"),i=!0)}i||n(t,r,"ltr")}function Zi(e){return e.level%2?e.to:e.from}function Qi(e){return e.level%2?e.from:e.to}function Ji(e){var t=ei(e);return t?Zi(t[0]):0}function eo(e){var t=ei(e);return t?Qi(Ai(t)):e.text.length}function to(e,t){var r=Kn(e.doc,t),n=pn(r);n!=r&&(t=Zn(n));var i=ei(n),o=i?i[0].level%2?eo(n):Ji(n):0;return No(t,o)}function ro(e,t){for(var r,n=Kn(e.doc,t);r=fn(n);)n=r.find(1,!0).line,t=null;var i=ei(n),o=i?i[0].level%2?Ji(n):eo(n):n.text.length;return No(null==t?Zn(n):t,o)}function no(e,t){var r=to(e,t.line),n=Kn(e.doc,r.line),i=ei(n);if(!i||0==i[0].level){var o=Math.max(0,n.text.search(/\S/)),a=t.line==r.line&&t.ch<=o&&t.ch;return No(r.line,a?0:o)}return r}function io(e,t,r){var n=e[0].level;return t==n?!0:r==n?!1:r>t}function oo(e,t){Za=null;for(var r,n=0;n<e.length;++n){var i=e[n];if(i.from<t&&i.to>t)return n;if(i.from==t||i.to==t){if(null!=r)return io(e,i.level,e[r].level)?(i.from!=i.to&&(Za=r),n):(i.from!=i.to&&(Za=n),r);r=n}}return r}function ao(e,t,r,n){if(!n)return t+r;do t+=r;while(t>0&&Fi(e.text.charAt(t)));return t}function lo(e,t,r,n){var i=ei(e);if(!i)return so(e,t,r,n);for(var o=oo(i,t),a=i[o],l=ao(e,t,a.level%2?-r:r,n);;){if(l>a.from&&l<a.to)return l;if(l==a.from||l==a.to)return oo(i,l)==o?l:(a=i[o+=r],r>0==a.level%2?a.to:a.from);if(a=i[o+=r],!a)return null;l=r>0==a.level%2?ao(e,a.to,-1,n):ao(e,a.from,1,n)}}function so(e,t,r,n){var i=t+r;if(n)for(;i>0&&Fi(e.text.charAt(i));)i+=r;return 0>i||i>e.text.length?null:i}var co=/gecko\/\d/i.test(navigator.userAgent),uo=/MSIE \d/.test(navigator.userAgent),fo=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),ho=uo||fo,po=ho&&(uo?document.documentMode||6:fo[1]),mo=/WebKit\//.test(navigator.userAgent),go=mo&&/Qt\/\d+\.\d+/.test(navigator.userAgent),vo=/Chrome\//.test(navigator.userAgent),yo=/Opera\//.test(navigator.userAgent),bo=/Apple Computer/.test(navigator.vendor),xo=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),wo=/PhantomJS/.test(navigator.userAgent),ko=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),Co=ko||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),So=ko||/Mac/.test(navigator.platform),Lo=/win/i.test(navigator.platform),Mo=yo&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);Mo&&(Mo=Number(Mo[1])),Mo&&Mo>=15&&(yo=!1,mo=!0);var To=So&&(go||yo&&(null==Mo||12.11>Mo)),Ao=co||ho&&po>=9,Oo=!1,zo=!1;m.prototype=Di({update:function(e){var t=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,n=e.nativeBarWidth;if(r){this.vert.style.display="block",this.vert.style.bottom=t?n+"px":"0";var i=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=r?n+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(r?n:0);this.horiz.firstChild.style.width=e.scrollWidth-e.clientWidth+o+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedOverlay&&e.clientHeight>0&&(0==n&&this.overlayHack(),this.checkedOverlay=!0),{right:r?n:0,bottom:t?n:0}},setScrollLeft:function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e)},setScrollTop:function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e)},overlayHack:function(){var e=So&&!xo?"12px":"18px";this.horiz.style.minHeight=this.vert.style.minWidth=e;var t=this,r=function(e){vi(e)!=t.vert&&vi(e)!=t.horiz&&At(t.cm,Vt)(e)};Ca(this.vert,"mousedown",r),Ca(this.horiz,"mousedown",r)},clear:function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)}},m.prototype),g.prototype=Di({update:function(){return{bottom:0,right:0}},setScrollLeft:function(){},setScrollTop:function(){},clear:function(){}},g.prototype),e.scrollbarModel={"native":m,"null":g},L.prototype.signal=function(e,t){Ci(e,t)&&this.events.push(arguments)},L.prototype.finish=function(){for(var e=0;e<this.events.length;e++)La.apply(null,this.events[e])};var No=e.Pos=function(e,t){return this instanceof No?(this.line=e,void(this.ch=t)):new No(e,t)},Po=e.cmpPos=function(e,t){return e.line-t.line||e.ch-t.ch},Do=null;re.prototype=Di({init:function(e){function t(e){if(n.somethingSelected())Do=n.getSelections(),r.inaccurateSelection&&(r.prevInput="",r.inaccurateSelection=!1,o.value=Do.join("\n"),Wa(o));else{if(!n.options.lineWiseCopyCut)return;var t=ee(n);Do=t.text,"cut"==e.type?n.setSelections(t.ranges,null,Oa):(r.prevInput="",o.value=t.text.join("\n"),Wa(o))}"cut"==e.type&&(n.state.cutIncoming=!0)}var r=this,n=this.cm,i=this.wrapper=ne(),o=this.textarea=i.firstChild;e.wrapper.insertBefore(i,e.wrapper.firstChild),ko&&(o.style.width="0px"),Ca(o,"input",function(){ho&&po>=9&&r.hasSelection&&(r.hasSelection=null),r.poll()}),Ca(o,"paste",function(){if(mo&&!n.state.fakedLastChar&&!(new Date-n.state.lastMiddleDown<200)){var e=o.selectionStart,t=o.selectionEnd;o.value+="$",o.selectionEnd=t,o.selectionStart=e,n.state.fakedLastChar=!0}n.state.pasteIncoming=!0,r.fastPoll()}),Ca(o,"cut",t),Ca(o,"copy",t),Ca(e.scroller,"paste",function(t){Rt(e,t)||(n.state.pasteIncoming=!0,r.focus())}),Ca(e.lineSpace,"selectstart",function(t){Rt(e,t)||xa(t)}),Ca(o,"compositionstart",function(){var e=n.getCursor("from");r.composing={start:e,range:n.markText(e,n.getCursor("to"),{className:"CodeMirror-composing"})}}),Ca(o,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},prepareSelection:function(){var e=this.cm,t=e.display,r=e.doc,n=De(e);if(e.options.moveInputWithCursor){var i=dt(e,r.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+a.top-o.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+a.left-o.left))}return n},showSelection:function(e){var t=this.cm,r=t.display;ji(r.cursorDiv,e.cursors),ji(r.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},reset:function(e){if(!this.contextMenuPending){var t,r,n=this.cm,i=n.doc;if(n.somethingSelected()){this.prevInput="";var o=i.sel.primary();t=$a&&(o.to().line-o.from().line>100||(r=n.getSelection()).length>1e3);var a=t?"-":r||n.getSelection();this.textarea.value=a,n.state.focused&&Wa(this.textarea),ho&&po>=9&&(this.hasSelection=a)}else e||(this.prevInput=this.textarea.value="",ho&&po>=9&&(this.hasSelection=null));this.inaccurateSelection=t; +!function(e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else{if("function"==typeof define&&define.amd)return define([],e);this.CodeMirror=e()}}(function(){"use strict";function e(n,r){if(!(this instanceof e))return new e(n,r);this.options=r=r?Di(r):{},Di(Ko,r,!1),h(r);var i=r.value;"string"==typeof i&&(i=new va(i,r.mode)),this.doc=i;var o=new e.inputStyles[r.inputStyle](this),a=this.display=new t(n,i,o);a.wrapper.CodeMirror=this,c(this),l(this),r.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),r.autofocus&&!Co&&a.input.focus(),v(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,draggingText:!1,highlight:new Li,keySeq:null,specialChars:null};var s=this;ho&&11>po&&setTimeout(function(){s.display.input.reset(!0)},20),jt(this),Vi(),yt(this),this.curOp.forceUpdate=!0,Gr(this,i),r.autofocus&&!Co||s.hasFocus()?setTimeout(Wi(hn,this),20):pn(this);for(var u in $o)$o.hasOwnProperty(u)&&$o[u](this,r[u],Xo);k(this),r.finishInit&&r.finishInit(this);for(var f=0;f<Jo.length;++f)Jo[f](this);xt(this),mo&&r.lineWrapping&&"optimizelegibility"==getComputedStyle(a.lineDiv).textRendering&&(a.lineDiv.style.textRendering="auto")}function t(e,t,n){var r=this;this.input=n,r.scrollbarFiller=Hi("div",null,"CodeMirror-scrollbar-filler"),r.scrollbarFiller.setAttribute("cm-not-content","true"),r.gutterFiller=Hi("div",null,"CodeMirror-gutter-filler"),r.gutterFiller.setAttribute("cm-not-content","true"),r.lineDiv=Hi("div",null,"CodeMirror-code"),r.selectionDiv=Hi("div",null,null,"position: relative; z-index: 1"),r.cursorDiv=Hi("div",null,"CodeMirror-cursors"),r.measure=Hi("div",null,"CodeMirror-measure"),r.lineMeasure=Hi("div",null,"CodeMirror-measure"),r.lineSpace=Hi("div",[r.measure,r.lineMeasure,r.selectionDiv,r.cursorDiv,r.lineDiv],null,"position: relative; outline: none"),r.mover=Hi("div",[Hi("div",[r.lineSpace],"CodeMirror-lines")],null,"position: relative"),r.sizer=Hi("div",[r.mover],"CodeMirror-sizer"),r.sizerWidth=null,r.heightForcer=Hi("div",null,null,"position: absolute; height: "+Ta+"px; width: 1px;"),r.gutters=Hi("div",null,"CodeMirror-gutters"),r.lineGutter=null,r.scroller=Hi("div",[r.sizer,r.heightForcer,r.gutters],"CodeMirror-scroll"),r.scroller.setAttribute("tabIndex","-1"),r.wrapper=Hi("div",[r.scrollbarFiller,r.gutterFiller,r.scroller],"CodeMirror"),ho&&8>po&&(r.gutters.style.zIndex=-1,r.scroller.style.paddingRight=0),mo||co&&Co||(r.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(r.wrapper):e(r.wrapper)),r.viewFrom=r.viewTo=t.first,r.reportedViewFrom=r.reportedViewTo=t.first,r.view=[],r.renderedView=null,r.externalMeasured=null,r.viewOffset=0,r.lastWrapHeight=r.lastWrapWidth=0,r.updateLineNumbers=null,r.nativeBarWidth=r.barHeight=r.barWidth=0,r.scrollbarsClipped=!1,r.lineNumWidth=r.lineNumInnerWidth=r.lineNumChars=null,r.alignWidgets=!1,r.cachedCharWidth=r.cachedTextHeight=r.cachedPaddingH=null,r.maxLine=null,r.maxLineLength=0,r.maxLineChanged=!1,r.wheelDX=r.wheelDY=r.wheelStartX=r.wheelStartY=null,r.shift=!1,r.selForContextMenu=null,r.activeTouch=null,n.init(r)}function n(t){t.doc.mode=e.getMode(t.options,t.doc.modeOption),r(t)}function r(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.frontier=e.doc.first,Fe(e,100),e.state.modeGen++,e.curOp&&Dt(e)}function i(e){e.options.lineWrapping?(qa(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(Ra(e.display.wrapper,"CodeMirror-wrap"),d(e)),a(e),Dt(e),ot(e),setTimeout(function(){y(e)},100)}function o(e){var t=gt(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/vt(e.display)-3);return function(i){if(yr(e.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;a<i.widgets.length;a++)i.widgets[a].height&&(o+=i.widgets[a].height);return n?o+(Math.ceil(i.text.length/r)||1)*t:o+t}}function a(e){var t=e.doc,n=o(e);t.iter(function(e){var t=n(e);t!=e.height&&Yr(e,t)})}function l(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),ot(e)}function s(e){c(e),Dt(e),setTimeout(function(){w(e)},20)}function c(e){var t=e.display.gutters,n=e.options.gutters;Bi(t);for(var r=0;r<n.length;++r){var i=n[r],o=t.appendChild(Hi("div",null,"CodeMirror-gutter "+i));"CodeMirror-linenumbers"==i&&(e.display.lineGutter=o,o.style.width=(e.display.lineNumWidth||1)+"px")}t.style.display=r?"":"none",u(e)}function u(e){var t=e.display.gutters.offsetWidth;e.display.sizer.style.marginLeft=t+"px"}function f(e){if(0==e.height)return 0;for(var t,n=e.text.length,r=e;t=fr(r);){var i=t.find(0,!0);r=i.from.line,n+=i.from.ch-i.to.ch}for(r=e;t=dr(r);){var i=t.find(0,!0);n-=r.text.length-i.from.ch,r=i.to.line,n+=r.text.length-i.to.ch}return n}function d(e){var t=e.display,n=e.doc;t.maxLine=Kr(n,n.first),t.maxLineLength=f(t.maxLine),t.maxLineChanged=!0,n.iter(function(e){var n=f(e);n>t.maxLineLength&&(t.maxLineLength=n,t.maxLine=e)})}function h(e){var t=Oi(e.gutters,"CodeMirror-linenumbers");-1==t&&e.lineNumbers?e.gutters=e.gutters.concat(["CodeMirror-linenumbers"]):t>-1&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}function p(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+Re(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+Ue(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}function m(e,t,n){this.cm=n;var r=this.vert=Hi("div",[Hi("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=Hi("div",[Hi("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");e(r),e(i),Ca(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Ca(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedOverlay=!1,ho&&8>po&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}function g(){}function v(t){t.display.scrollbars&&(t.display.scrollbars.clear(),t.display.scrollbars.addClass&&Ra(t.display.wrapper,t.display.scrollbars.addClass)),t.display.scrollbars=new e.scrollbarModel[t.options.scrollbarStyle](function(e){t.display.wrapper.insertBefore(e,t.display.scrollbarFiller),Ca(e,"mousedown",function(){t.state.focused&&setTimeout(function(){t.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,n){"horizontal"==n?en(t,e):Jt(t,e)},t),t.display.scrollbars.addClass&&qa(t.display.wrapper,t.display.scrollbars.addClass)}function y(e,t){t||(t=p(e));var n=e.display.barWidth,r=e.display.barHeight;b(e,t);for(var i=0;4>i&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&P(e),b(e,p(e)),n=e.display.barWidth,r=e.display.barHeight}function b(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}function x(e,t,n){var r=n&&null!=n.top?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-_e(e));var i=n&&null!=n.bottom?n.bottom:r+e.wrapper.clientHeight,o=Qr(t,r),a=Qr(t,i);if(n&&n.ensure){var l=n.ensure.from.line,s=n.ensure.to.line;o>l?(o=l,a=Qr(t,Jr(Kr(t,l))+e.wrapper.clientHeight)):Math.min(s,t.lastLine())>=a&&(o=Qr(t,Jr(Kr(t,s))-e.wrapper.clientHeight),a=s)}return{from:o,to:Math.max(a,o+1)}}function w(e){var t=e.display,n=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var r=S(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=r+"px",a=0;a<n.length;a++)if(!n[a].hidden){e.options.fixedGutter&&n[a].gutter&&(n[a].gutter.style.left=o);var l=n[a].alignable;if(l)for(var s=0;s<l.length;s++)l[s].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}}function k(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=C(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(Hi("div",[Hi("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=i.firstChild.offsetWidth,a=i.offsetWidth-o;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(o,r.lineGutter.offsetWidth-a)+1,r.lineNumWidth=r.lineNumInnerWidth+a,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",u(e),!0}return!1}function C(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function S(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function L(e,t,n){var r=e.display;this.viewport=t,this.visible=x(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=Ve(e),this.force=n,this.dims=D(e),this.events=[]}function M(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Ue(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Ue(e)+"px",t.scrollbarsClipped=!0)}function T(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return Et(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==Bt(e))return!1;k(e)&&(Et(e),t.dims=D(e));var i=r.first+r.size,o=Math.max(t.visible.from-e.options.viewportMargin,r.first),a=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<o&&o-n.viewFrom<20&&(o=Math.max(r.first,n.viewFrom)),n.viewTo>a&&n.viewTo-a<20&&(a=Math.min(i,n.viewTo)),No&&(o=gr(e.doc,o),a=vr(e.doc,a));var l=o!=n.viewFrom||a!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Ht(e,o,a),n.viewOffset=Jr(Kr(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var s=Bt(e);if(!l&&0==s&&!t.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var c=_i();return s>4&&(n.lineDiv.style.display="none"),W(e,n.updateLineNumbers,t.dims),s>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,c&&_i()!=c&&c.offsetHeight&&c.focus(),Bi(n.cursorDiv),Bi(n.selectionDiv),n.gutters.style.height=0,l&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,Fe(e,400)),n.updateLineNumbers=null,!0}function A(e,t){for(var n=t.force,r=t.viewport,i=!0;;i=!1){if(i&&e.options.lineWrapping&&t.oldDisplayWidth!=Ve(e))n=!0;else if(n=!1,r&&null!=r.top&&(r={top:Math.min(e.doc.height+Re(e.display)-Ge(e),r.top)}),t.visible=x(e.display,e.doc,r),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break;if(!T(e,t))break;P(e);var o=p(e);ze(e),N(e,o),y(e,o)}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function O(e,t){var n=new L(e,t);if(T(e,n)){P(e),A(e,n);var r=p(e);ze(e),N(e,r),y(e,r),n.finish()}}function N(e,t){e.display.sizer.style.minHeight=t.docHeight+"px";var n=t.docHeight+e.display.barHeight;e.display.heightForcer.style.top=n+"px",e.display.gutters.style.height=Math.max(n+Ue(e),t.clientHeight)+"px"}function P(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i,o=t.view[r];if(!o.hidden){if(ho&&8>po){var a=o.node.offsetTop+o.node.offsetHeight;i=a-n,n=a}else{var l=o.node.getBoundingClientRect();i=l.bottom-l.top}var s=o.line.height-i;if(2>i&&(i=gt(t)),(s>.001||-.001>s)&&(Yr(o.line,i),z(o.line),o.rest))for(var c=0;c<o.rest.length;c++)z(o.rest[c])}}}function z(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t)e.widgets[t].height=e.widgets[t].node.offsetHeight}function D(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,o=t.gutters.firstChild,a=0;o;o=o.nextSibling,++a)n[e.options.gutters[a]]=o.offsetLeft+o.clientLeft+i,r[e.options.gutters[a]]=o.clientWidth;return{fixedPos:S(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function W(e,t,n){function r(t){var n=t.nextSibling;return mo&&So&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),n}for(var i=e.display,o=e.options.lineNumbers,a=i.lineDiv,l=a.firstChild,s=i.view,c=i.viewFrom,u=0;u<s.length;u++){var f=s[u];if(f.hidden);else if(f.node&&f.node.parentNode==a){for(;l!=f.node;)l=r(l);var d=o&&null!=t&&c>=t&&f.lineNumber;f.changes&&(Oi(f.changes,"gutter")>-1&&(d=!1),E(e,f,c,n)),d&&(Bi(f.lineNumber),f.lineNumber.appendChild(document.createTextNode(C(e.options,c)))),l=f.node.nextSibling}else{var h=q(e,f,c,n);a.insertBefore(h,l)}c+=f.size}for(;l;)l=r(l)}function E(e,t,n,r){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];"text"==o?B(e,t):"gutter"==o?_(e,t,n,r):"class"==o?j(t):"widget"==o&&R(e,t,r)}t.changes=null}function I(e){return e.node==e.text&&(e.node=Hi("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),ho&&8>po&&(e.node.style.zIndex=2)),e.node}function F(e){var t=e.bgClass?e.bgClass+" "+(e.line.bgClass||""):e.line.bgClass;if(t&&(t+=" CodeMirror-linebackground"),e.background)t?e.background.className=t:(e.background.parentNode.removeChild(e.background),e.background=null);else if(t){var n=I(e);e.background=n.insertBefore(Hi("div",null,t),n.firstChild)}}function H(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Wr(e,t)}function B(e,t){var n=t.text.className,r=H(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,j(t)):n&&(t.text.className=n)}function j(e){F(e),e.line.wrapClass?I(e).className=e.line.wrapClass:e.node!=e.text&&(e.node.className="");var t=e.textClass?e.textClass+" "+(e.line.textClass||""):e.line.textClass;e.text.className=t||""}function _(e,t,n,r){t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null);var i=t.line.gutterMarkers;if(e.options.lineNumbers||i){var o=I(t),a=t.gutter=Hi("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px");if(e.display.input.setUneditable(a),o.insertBefore(a,t.text),t.line.gutterClass&&(a.className+=" "+t.line.gutterClass),!e.options.lineNumbers||i&&i["CodeMirror-linenumbers"]||(t.lineNumber=a.appendChild(Hi("div",C(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),i)for(var l=0;l<e.options.gutters.length;++l){var s=e.options.gutters[l],c=i.hasOwnProperty(s)&&i[s];c&&a.appendChild(Hi("div",[c],"CodeMirror-gutter-elt","left: "+r.gutterLeft[s]+"px; width: "+r.gutterWidth[s]+"px"))}}}function R(e,t,n){t.alignable&&(t.alignable=null);for(var r,i=t.node.firstChild;i;i=r){var r=i.nextSibling;"CodeMirror-linewidget"==i.className&&t.node.removeChild(i)}U(e,t,n)}function q(e,t,n,r){var i=H(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),j(t),_(e,t,n,r),U(e,t,r),t.node}function U(e,t,n){if(V(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)V(e,t.rest[r],t,n,!1)}function V(e,t,n,r,i){if(t.widgets)for(var o=I(n),a=0,l=t.widgets;a<l.length;++a){var s=l[a],c=Hi("div",[s.node],"CodeMirror-linewidget");s.handleMouseEvents||c.setAttribute("cm-ignore-events","true"),G(s,c,n,r),e.display.input.setUneditable(c),i&&s.above?o.insertBefore(c,n.gutter||n.text):o.appendChild(c),bi(s,"redraw")}}function G(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var i=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(i-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function K(e){return Po(e.line,e.ch)}function X(e,t){return zo(e,t)<0?t:e}function Y(e,t){return zo(e,t)<0?e:t}function Z(e){e.state.focused||(e.display.input.focus(),hn(e))}function Q(e){return e.options.readOnly||e.doc.cantEdit}function J(e,t,n,r,i){var o=e.doc;e.display.shift=!1,r||(r=o.sel);var a=Ga(t),l=null;e.state.pasteIncoming&&r.ranges.length>1&&(Do&&Do.join("\n")==t?l=r.ranges.length%Do.length==0&&Ni(Do,Ga):a.length==r.ranges.length&&(l=Ni(a,function(e){return[e]})));for(var s=r.ranges.length-1;s>=0;s--){var c=r.ranges[s],u=c.from(),f=c.to();c.empty()&&(n&&n>0?u=Po(u.line,u.ch-n):e.state.overwrite&&!e.state.pasteIncoming&&(f=Po(f.line,Math.min(Kr(o,f.line).text.length,f.ch+Ai(a).length))));var d=e.curOp.updateInput,h={from:u,to:f,text:l?l[s%l.length]:a,origin:i||(e.state.pasteIncoming?"paste":e.state.cutIncoming?"cut":"+input")};if(kn(e.doc,h),bi(e,"inputRead",e,h),t&&!e.state.pasteIncoming&&e.options.electricChars&&e.options.smartIndent&&c.head.ch<100&&(!s||r.ranges[s-1].head.line!=c.head.line)){var p=e.getModeAt(c.head),m=Go(h),g=!1;if(p.electricChars){for(var v=0;v<p.electricChars.length;v++)if(t.indexOf(p.electricChars.charAt(v))>-1){g=In(e,m.line,"smart");break}}else p.electricInput&&p.electricInput.test(Kr(o,m.line).text.slice(0,m.ch))&&(g=In(e,m.line,"smart"));g&&bi(e,"electricInput",e,m.line)}}Wn(e),e.curOp.updateInput=d,e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=!1}function ee(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,o={anchor:Po(i,0),head:Po(i+1,0)};n.push(o),t.push(e.getRange(o.anchor,o.head))}return{text:t,ranges:n}}function te(e){e.setAttribute("autocorrect","off"),e.setAttribute("autocapitalize","off"),e.setAttribute("spellcheck","false")}function ne(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Li,this.inaccurateSelection=!1,this.hasSelection=!1,this.composing=null}function re(){var e=Hi("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none"),t=Hi("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return mo?e.style.width="1000px":e.setAttribute("wrap","off"),ko&&(e.style.border="1px solid black"),te(e),t}function ie(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Li,this.gracePeriod=!1}function oe(e,t){var n=Ze(e,t.line);if(!n||n.hidden)return null;var r=Kr(e.doc,t.line),i=$e(n,r,t.line),o=ei(r),a="left";if(o){var l=oo(o,t.ch);a=l%2?"right":"left"}var s=et(i.map,t.ch,"left");return s.offset="right"==s.collapse?s.end:s.start,s}function ae(e,t){return t&&(e.bad=!0),e}function le(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return ae(e.clipPos(Po(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var o=e.display.view[i];if(o.node==r)return se(o,t,n)}}function se(e,t,n){function r(t,n,r){for(var i=-1;i<(u?u.length:0);i++)for(var o=0>i?c.map:u[i],a=0;a<o.length;a+=3){var l=o[a+2];if(l==t||l==n){var s=Zr(0>i?e.line:e.rest[i]),f=o[a]+r;return(0>r||l!=t)&&(f=o[a+(r?1:0)]),Po(s,f)}}}var i=e.text.firstChild,o=!1;if(!t||!Ba(i,t))return ae(Po(Zr(e.line),0),!0);if(t==i&&(o=!0,t=i.childNodes[n],n=0,!t)){var a=e.rest?Ai(e.rest):e.line;return ae(Po(Zr(a),a.text.length),o)}var l=3==t.nodeType?t:null,s=t;for(l||1!=t.childNodes.length||3!=t.firstChild.nodeType||(l=t.firstChild,n&&(n=l.nodeValue.length));s.parentNode!=i;)s=s.parentNode;var c=e.measure,u=c.maps,f=r(l,s,n);if(f)return ae(f,o);for(var d=s.nextSibling,h=l?l.nodeValue.length-n:0;d;d=d.nextSibling){if(f=r(d,d.firstChild,0))return ae(Po(f.line,f.ch-h),o);h+=d.textContent.length}for(var p=s.previousSibling,h=n;p;p=p.previousSibling){if(f=r(p,p.firstChild,-1))return ae(Po(f.line,f.ch+h),o);h+=d.textContent.length}}function ce(e,t,n,r,i){function o(e){return function(t){return t.id==e}}function a(t){if(1==t.nodeType){var n=t.getAttribute("cm-text");if(null!=n)return""==n&&(n=t.textContent.replace(/\u200b/g,"")),void(l+=n);var c,u=t.getAttribute("cm-marker");if(u){var f=e.findMarks(Po(r,0),Po(i+1,0),o(+u));return void(f.length&&(c=f[0].find())&&(l+=$r(e.doc,c.from,c.to).join("\n")))}if("false"==t.getAttribute("contenteditable"))return;for(var d=0;d<t.childNodes.length;d++)a(t.childNodes[d]);/^(pre|div|p)$/i.test(t.nodeName)&&(s=!0)}else if(3==t.nodeType){var h=t.nodeValue;if(!h)return;s&&(l+="\n",s=!1),l+=h}}for(var l="",s=!1;a(t),t!=n;)t=t.nextSibling;return l}function ue(e,t){this.ranges=e,this.primIndex=t}function fe(e,t){this.anchor=e,this.head=t}function de(e,t){var n=e[t];e.sort(function(e,t){return zo(e.from(),t.from())}),t=Oi(e,n);for(var r=1;r<e.length;r++){var i=e[r],o=e[r-1];if(zo(o.to(),i.from())>=0){var a=Y(o.from(),i.from()),l=X(o.to(),i.to()),s=o.empty()?i.from()==i.head:o.from()==o.head;t>=r&&--t,e.splice(--r,2,new fe(s?l:a,s?a:l))}}return new ue(e,t)}function he(e,t){return new ue([new fe(e,t||e)],0)}function pe(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function me(e,t){if(t.line<e.first)return Po(e.first,0);var n=e.first+e.size-1;return t.line>n?Po(n,Kr(e,n).text.length):ge(t,Kr(e,t.line).text.length)}function ge(e,t){var n=e.ch;return null==n||n>t?Po(e.line,t):0>n?Po(e.line,0):e}function ve(e,t){return t>=e.first&&t<e.first+e.size}function ye(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=me(e,t[r]);return n}function be(e,t,n,r){if(e.cm&&e.cm.display.shift||e.extend){var i=t.anchor;if(r){var o=zo(n,i)<0;o!=zo(r,i)<0?(i=n,n=r):o!=zo(n,r)<0&&(n=r)}return new fe(i,n)}return new fe(r||n,n)}function xe(e,t,n,r){Me(e,new ue([be(e,e.sel.primary(),t,n)],0),r)}function we(e,t,n){for(var r=[],i=0;i<e.sel.ranges.length;i++)r[i]=be(e,e.sel.ranges[i],t[i],null);var o=de(r,e.sel.primIndex);Me(e,o,n)}function ke(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,Me(e,de(i,e.sel.primIndex),r)}function Ce(e,t,n,r){Me(e,he(t,n),r)}function Se(e,t){var n={ranges:t.ranges,update:function(t){this.ranges=[];for(var n=0;n<t.length;n++)this.ranges[n]=new fe(me(e,t[n].anchor),me(e,t[n].head))}};return La(e,"beforeSelectionChange",e,n),e.cm&&La(e.cm,"beforeSelectionChange",e.cm,n),n.ranges!=t.ranges?de(n.ranges,n.ranges.length-1):t}function Le(e,t,n){var r=e.history.done,i=Ai(r);i&&i.ranges?(r[r.length-1]=t,Te(e,t,n)):Me(e,t,n)}function Me(e,t,n){Te(e,t,n),li(e,e.sel,e.cm?e.cm.curOp.id:0/0,n)}function Te(e,t,n){(Ci(e,"beforeSelectionChange")||e.cm&&Ci(e.cm,"beforeSelectionChange"))&&(t=Se(e,t));var r=n&&n.bias||(zo(t.primary().head,e.sel.primary().head)<0?-1:1);Ae(e,Ne(e,t,r,!0)),n&&n.scroll===!1||!e.cm||Wn(e.cm)}function Ae(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=e.cm.curOp.selectionChanged=!0,ki(e.cm)),bi(e,"cursorActivity",e))}function Oe(e){Ae(e,Ne(e,e.sel,null,!1),Oa)}function Ne(e,t,n,r){for(var i,o=0;o<t.ranges.length;o++){var a=t.ranges[o],l=Pe(e,a.anchor,n,r),s=Pe(e,a.head,n,r);(i||l!=a.anchor||s!=a.head)&&(i||(i=t.ranges.slice(0,o)),i[o]=new fe(l,s))}return i?de(i,t.primIndex):t}function Pe(e,t,n,r){var i=!1,o=t,a=n||1;e.cantEdit=!1;e:for(;;){var l=Kr(e,o.line);if(l.markedSpans)for(var s=0;s<l.markedSpans.length;++s){var c=l.markedSpans[s],u=c.marker;if((null==c.from||(u.inclusiveLeft?c.from<=o.ch:c.from<o.ch))&&(null==c.to||(u.inclusiveRight?c.to>=o.ch:c.to>o.ch))){if(r&&(La(u,"beforeCursorEnter"),u.explicitlyCleared)){if(l.markedSpans){--s;continue}break}if(!u.atomic)continue;var f=u.find(0>a?-1:1);if(0==zo(f,o)&&(f.ch+=a,f.ch<0?f=f.line>e.first?me(e,Po(f.line-1)):null:f.ch>l.text.length&&(f=f.line<e.first+e.size-1?Po(f.line+1,0):null),!f)){if(i)return r?(e.cantEdit=!0,Po(e.first,0)):Pe(e,t,n,!0);i=!0,f=t,a=-a}o=f;continue e}}return o}}function ze(e){e.display.input.showSelection(e.display.input.prepareSelection())}function De(e,t){for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),o=r.selection=document.createDocumentFragment(),a=0;a<n.sel.ranges.length;a++)if(t!==!1||a!=n.sel.primIndex){var l=n.sel.ranges[a],s=l.empty();(s||e.options.showCursorWhenSelecting)&&We(e,l,i),s||Ee(e,l,o)}return r}function We(e,t,n){var r=ft(e,t.head,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(Hi("div"," ","CodeMirror-cursor"));if(i.style.left=r.left+"px",i.style.top=r.top+"px",i.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var o=n.appendChild(Hi("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));o.style.display="",o.style.left=r.other.left+"px",o.style.top=r.other.top+"px",o.style.height=.85*(r.other.bottom-r.other.top)+"px"}$(".other-cursor").each(function(t,n){var r=e.charCoords({line:$(n).attr("data-line"),ch:$(n).attr("data-ch")},"windows");$(n)[0].style.left=r.left+"px",$(n)[0].style.top=r.top+"px"})}function Ee(e,t,n){function r(e,t,n,r){0>t&&(t=0),t=Math.round(t),r=Math.round(r),l.appendChild(Hi("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px; top: "+t+"px; width: "+(null==n?u-e:n)+"px; height: "+(r-t)+"px"))}function i(t,n,i){function o(n,r){return ut(e,Po(t,n),"div",f,r)}var l,s,f=Kr(a,t),d=f.text.length;return Yi(ei(f),n||0,null==i?d:i,function(e,t,a){var f,h,p,m=o(e,"left");if(e==t)f=m,h=p=m.left;else{if(f=o(t-1,"right"),"rtl"==a){var g=m;m=f,f=g}h=m.left,p=f.right}null==n&&0==e&&(h=c),f.top-m.top>3&&(r(h,m.top,null,m.bottom),h=c,m.bottom<f.top&&r(h,m.bottom,null,f.top)),null==i&&t==d&&(p=u),(!l||m.top<l.top||m.top==l.top&&m.left<l.left)&&(l=m),(!s||f.bottom>s.bottom||f.bottom==s.bottom&&f.right>s.right)&&(s=f),c+1>h&&(h=c),r(h,f.top,p-h,f.bottom)}),{start:l,end:s}}var o=e.display,a=e.doc,l=document.createDocumentFragment(),s=qe(e.display),c=s.left,u=Math.max(o.sizerWidth,Ve(e)-o.sizer.offsetLeft)-s.right,f=t.from(),d=t.to();if(f.line==d.line)i(f.line,f.ch,d.ch);else{var h=Kr(a,f.line),p=Kr(a,d.line),m=pr(h)==pr(p),g=i(f.line,f.ch,m?h.text.length+1:null).end,v=i(d.line,m?0:null,d.ch).start;m&&(g.top<v.top-2?(r(g.right,g.top,null,g.bottom),r(c,v.top,v.left,v.bottom)):r(g.right,g.top,v.left-g.right,g.bottom)),g.bottom<v.top&&r(c,g.bottom,null,v.top)}n.appendChild(l)}function Ie(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Fe(e,t){e.doc.mode.startState&&e.doc.frontier<e.display.viewTo&&e.state.highlight.set(t,Wi(He,e))}function He(e){var t=e.doc;if(t.frontier<t.first&&(t.frontier=t.first),!(t.frontier>=e.display.viewTo)){var n=+new Date+e.options.workTime,r=ta(t.mode,je(e,t.frontier)),i=[];t.iter(t.frontier,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(t.frontier>=e.display.viewFrom){var a=o.styles,l=Nr(e,o,r,!0);o.styles=l.styles;var s=o.styleClasses,c=l.classes;c?o.styleClasses=c:s&&(o.styleClasses=null);for(var u=!a||a.length!=o.styles.length||s!=c&&(!s||!c||s.bgClass!=c.bgClass||s.textClass!=c.textClass),f=0;!u&&f<a.length;++f)u=a[f]!=o.styles[f];u&&i.push(t.frontier),o.stateAfter=ta(t.mode,r)}else zr(e,o.text,r),o.stateAfter=t.frontier%5==0?ta(t.mode,r):null;return++t.frontier,+new Date>n?(Fe(e,e.options.workDelay),!0):void 0}),i.length&&Tt(e,function(){for(var t=0;t<i.length;t++)Wt(e,i[t],"text")})}}function Be(e,t,n){for(var r,i,o=e.doc,a=n?-1:t-(e.doc.mode.innerMode?1e3:100),l=t;l>a;--l){if(l<=o.first)return o.first;var s=Kr(o,l-1);if(s.stateAfter&&(!n||l<=o.frontier))return l;var c=za(s.text,null,e.options.tabSize);(null==i||r>c)&&(i=l-1,r=c)}return i}function je(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return!0;var o=Be(e,t,n),a=o>r.first&&Kr(r,o-1).stateAfter;return a=a?ta(r.mode,a):na(r.mode),r.iter(o,t,function(n){zr(e,n.text,a);var l=o==t-1||o%5==0||o>=i.viewFrom&&o<i.viewTo;n.stateAfter=l?ta(r.mode,a):null,++o}),n&&(r.frontier=o),a}function _e(e){return e.lineSpace.offsetTop}function Re(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function qe(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=ji(e.measure,Hi("pre","x")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return isNaN(r.left)||isNaN(r.right)||(e.cachedPaddingH=r),r}function Ue(e){return Ta-e.display.nativeBarWidth}function Ve(e){return e.display.scroller.clientWidth-Ue(e)-e.display.barWidth}function Ge(e){return e.display.scroller.clientHeight-Ue(e)-e.display.barHeight}function Ke(e,t,n){var r=e.options.lineWrapping,i=r&&Ve(e);if(!t.measure.heights||r&&t.measure.width!=i){var o=t.measure.heights=[];if(r){t.measure.width=i;for(var a=t.text.firstChild.getClientRects(),l=0;l<a.length-1;l++){var s=a[l],c=a[l+1];Math.abs(s.bottom-c.bottom)>2&&o.push((s.bottom+c.top)/2-n.top)}}o.push(n.bottom-n.top)}}function $e(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var r=0;r<e.rest.length;r++)if(Zr(e.rest[r])>n)return{map:e.measure.maps[r],cache:e.measure.caches[r],before:!0}}function Xe(e,t){t=pr(t);var n=Zr(t),r=e.display.externalMeasured=new Pt(e.doc,t,n);r.lineN=n;var i=r.built=Wr(e,r);return r.text=i.pre,ji(e.display.lineMeasure,i.pre),r}function Ye(e,t,n,r){return Je(e,Qe(e,t),n,r)}function Ze(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[It(e,t)];var n=e.display.externalMeasured;return n&&t>=n.lineN&&t<n.lineN+n.size?n:void 0}function Qe(e,t){var n=Zr(t),r=Ze(e,n);r&&!r.text?r=null:r&&r.changes&&E(e,r,n,D(e)),r||(r=Xe(e,t));var i=$e(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Je(e,t,n,r,i){t.before&&(n=-1);var o,a=n+(r||"");return t.cache.hasOwnProperty(a)?o=t.cache[a]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Ke(e,t.view,t.rect),t.hasHeights=!0),o=tt(e,t,n,r),o.bogus||(t.cache[a]=o)),{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}function et(e,t,n){for(var r,i,o,a,l=0;l<e.length;l+=3){var s=e[l],c=e[l+1];if(s>t?(i=0,o=1,a="left"):c>t?(i=t-s,o=i+1):(l==e.length-3||t==c&&e[l+3]>t)&&(o=c-s,i=o-1,t>=c&&(a="right")),null!=i){if(r=e[l+2],s==c&&n==(r.insertLeft?"left":"right")&&(a=n),"left"==n&&0==i)for(;l&&e[l-2]==e[l-3]&&e[l-1].insertLeft;)r=e[(l-=3)+2],a="left";if("right"==n&&i==c-s)for(;l<e.length-3&&e[l+3]==e[l+4]&&!e[l+5].insertLeft;)r=e[(l+=3)+2],a="right";break}}return{node:r,start:i,end:o,collapse:a,coverStart:s,coverEnd:c}}function tt(e,t,n,r){var i,o=et(t.map,n,r),a=o.node,l=o.start,s=o.end,c=o.collapse;if(3==a.nodeType){for(var u=0;4>u;u++){for(;l&&Fi(t.line.text.charAt(o.coverStart+l));)--l;for(;o.coverStart+s<o.coverEnd&&Fi(t.line.text.charAt(o.coverStart+s));)++s;if(ho&&9>po&&0==l&&s==o.coverEnd-o.coverStart)i=a.parentNode.getBoundingClientRect();else if(ho&&e.options.lineWrapping){var f=Ea(a,l,s).getClientRects();i=f.length?f["right"==r?f.length-1:0]:Fo}else i=Ea(a,l,s).getBoundingClientRect()||Fo;if(i.left||i.right||0==l)break;s=l,l-=1,c="right"}ho&&11>po&&(i=nt(e.display.measure,i))}else{l>0&&(c=r="right");var f;i=e.options.lineWrapping&&(f=a.getClientRects()).length>1?f["right"==r?f.length-1:0]:a.getBoundingClientRect()}if(ho&&9>po&&!l&&(!i||!i.left&&!i.right)){var d=a.parentNode.getClientRects()[0];i=d?{left:d.left,right:d.left+vt(e.display),top:d.top, +bottom:d.bottom}:Fo}for(var h=i.top-t.rect.top,p=i.bottom-t.rect.top,m=(h+p)/2,g=t.view.measure.heights,u=0;u<g.length-1&&!(m<g[u]);u++);var v=u?g[u-1]:0,y=g[u],b={left:("right"==c?i.right:i.left)-t.rect.left,right:("left"==c?i.left:i.right)-t.rect.left,top:v,bottom:y};return i.left||i.right||(b.bogus=!0),e.options.singleCursorHeightPerLine||(b.rtop=h,b.rbottom=p),b}function nt(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!Xi(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function rt(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function it(e){e.display.externalMeasure=null,Bi(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)rt(e.display.view[t])}function ot(e){it(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function at(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function lt(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function st(e,t,n,r){if(t.widgets)for(var i=0;i<t.widgets.length;++i)if(t.widgets[i].above){var o=wr(t.widgets[i]);n.top+=o,n.bottom+=o}if("line"==r)return n;r||(r="local");var a=Jr(t);if("local"==r?a+=_e(e.display):a-=e.display.viewOffset,"page"==r||"window"==r){var l=e.display.lineSpace.getBoundingClientRect();a+=l.top+("window"==r?0:lt());var s=l.left+("window"==r?0:at());n.left+=s,n.right+=s}return n.top+=a,n.bottom+=a,n}function ct(e,t,n){if("div"==n)return t;var r=t.left,i=t.top;if("page"==n)r-=at(),i-=lt();else if("local"==n||!n){var o=e.display.sizer.getBoundingClientRect();r+=o.left,i+=o.top}var a=e.display.lineSpace.getBoundingClientRect();return{left:r-a.left,top:i-a.top}}function ut(e,t,n,r,i){return r||(r=Kr(e.doc,t.line)),st(e,r,Ye(e,r,t.ch,i),n)}function ft(e,t,n,r,i,o){function a(t,a){var l=Je(e,i,t,a?"right":"left",o);return a?l.left=l.right:l.right=l.left,st(e,r,l,n)}function l(e,t){var n=s[t],r=n.level%2;return e==Zi(n)&&t&&n.level<s[t-1].level?(n=s[--t],e=Qi(n)-(n.level%2?0:1),r=!0):e==Qi(n)&&t<s.length-1&&n.level<s[t+1].level&&(n=s[++t],e=Zi(n)-n.level%2,r=!1),r&&e==n.to&&e>n.from?a(e-1):a(e,r)}r=r||Kr(e.doc,t.line),i||(i=Qe(e,r));var s=ei(r),c=t.ch;if(!s)return a(c);var u=oo(s,c),f=l(c,u);return null!=Za&&(f.other=l(c,Za)),f}function dt(e,t){var n=0,t=me(e.doc,t);e.options.lineWrapping||(n=vt(e.display)*t.ch);var r=Kr(e.doc,t.line),i=Jr(r)+_e(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function ht(e,t,n,r){var i=Po(e,t);return i.xRel=r,n&&(i.outside=!0),i}function pt(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,0>n)return ht(r.first,0,!0,-1);var i=Qr(r,n),o=r.first+r.size-1;if(i>o)return ht(r.first+r.size-1,Kr(r,o).text.length,!0,1);0>t&&(t=0);for(var a=Kr(r,i);;){var l=mt(e,a,i,t,n),s=dr(a),c=s&&s.find(0,!0);if(!s||!(l.ch>c.from.ch||l.ch==c.from.ch&&l.xRel>0))return l;i=Zr(a=c.to.line)}}function mt(e,t,n,r,i){function o(r){var i=ft(e,Po(n,r),"line",t,c);return l=!0,a>i.bottom?i.left-s:a<i.top?i.left+s:(l=!1,i.left)}var a=i-Jr(t),l=!1,s=2*e.display.wrapper.clientWidth,c=Qe(e,t),u=ei(t),f=t.text.length,d=Ji(t),h=eo(t),p=o(d),m=l,g=o(h),v=l;if(r>g)return ht(n,h,v,1);for(;;){if(u?h==d||h==lo(t,d,1):1>=h-d){for(var y=p>r||g-r>=r-p?d:h,b=r-(y==d?p:g);Fi(t.text.charAt(y));)++y;var x=ht(n,y,y==d?m:v,-1>b?-1:b>1?1:0);return x}var w=Math.ceil(f/2),k=d+w;if(u){k=d;for(var C=0;w>C;++C)k=lo(t,k,1)}var S=o(k);S>r?(h=k,g=S,(v=l)&&(g+=1e3),f=w):(d=k,p=S,m=l,f-=w)}}function gt(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Wo){Wo=Hi("pre");for(var t=0;49>t;++t)Wo.appendChild(document.createTextNode("x")),Wo.appendChild(Hi("br"));Wo.appendChild(document.createTextNode("x"))}ji(e.measure,Wo);var n=Wo.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),Bi(e.measure),n||1}function vt(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=Hi("span","xxxxxxxxxx"),n=Hi("pre",[t]);ji(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function yt(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Bo},Ho?Ho.ops.push(e.curOp):e.curOp.ownsGroup=Ho={ops:[e.curOp],delayedCallbacks:[]}}function bt(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n]();for(var r=0;r<e.ops.length;r++){var i=e.ops[r];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++](i.cm)}}while(n<t.length)}function xt(e){var t=e.curOp,n=t.ownsGroup;if(n)try{bt(n)}finally{Ho=null;for(var r=0;r<n.ops.length;r++)n.ops[r].cm.curOp=null;wt(n)}}function wt(e){for(var t=e.ops,n=0;n<t.length;n++)kt(t[n]);for(var n=0;n<t.length;n++)Ct(t[n]);for(var n=0;n<t.length;n++)St(t[n]);for(var n=0;n<t.length;n++)Lt(t[n]);for(var n=0;n<t.length;n++)Mt(t[n])}function kt(e){var t=e.cm,n=t.display;M(t),e.updateMaxLine&&d(t),e.mustUpdate=e.viewChanged||e.forceUpdate||null!=e.scrollTop||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new L(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Ct(e){e.updatedDisplay=e.mustUpdate&&T(e.cm,e.update)}function St(e){var t=e.cm,n=t.display;e.updatedDisplay&&P(t),e.barMeasure=p(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Ye(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Ue(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Ve(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function Lt(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&en(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1),e.preparedSelection&&t.display.input.showSelection(e.preparedSelection),e.updatedDisplay&&N(t,e.barMeasure),(e.updatedDisplay||e.startHeight!=t.doc.height)&&y(t,e.barMeasure),e.selectionChanged&&Ie(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),e.focus&&e.focus==_i()&&Z(e.cm)}function Mt(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&A(t,e.update),null==n.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(n.wheelStartX=n.wheelStartY=null),null==e.scrollTop||n.scroller.scrollTop==e.scrollTop&&!e.forceScroll||(r.scrollTop=Math.max(0,Math.min(n.scroller.scrollHeight-n.scroller.clientHeight,e.scrollTop)),n.scrollbars.setScrollTop(r.scrollTop),n.scroller.scrollTop=r.scrollTop),null==e.scrollLeft||n.scroller.scrollLeft==e.scrollLeft&&!e.forceScroll||(r.scrollLeft=Math.max(0,Math.min(n.scroller.scrollWidth-Ve(t),e.scrollLeft)),n.scrollbars.setScrollLeft(r.scrollLeft),n.scroller.scrollLeft=r.scrollLeft,w(t)),e.scrollToPos){var i=Nn(t,me(r,e.scrollToPos.from),me(r,e.scrollToPos.to),e.scrollToPos.margin);e.scrollToPos.isCursor&&t.state.focused&&On(t,i)}var o=e.maybeHiddenMarkers,a=e.maybeUnhiddenMarkers;if(o)for(var l=0;l<o.length;++l)o[l].lines.length||La(o[l],"hide");if(a)for(var l=0;l<a.length;++l)a[l].lines.length&&La(a[l],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&La(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Tt(e,t){if(e.curOp)return t();yt(e);try{return t()}finally{xt(e)}}function At(e,t){return function(){if(e.curOp)return t.apply(e,arguments);yt(e);try{return t.apply(e,arguments)}finally{xt(e)}}}function Ot(e){return function(){if(this.curOp)return e.apply(this,arguments);yt(this);try{return e.apply(this,arguments)}finally{xt(this)}}}function Nt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);yt(t);try{return e.apply(this,arguments)}finally{xt(t)}}}function Pt(e,t,n){this.line=t,this.rest=mr(t),this.size=this.rest?Zr(Ai(this.rest))-n+1:1,this.node=this.text=null,this.hidden=yr(e,t)}function zt(e,t,n){for(var r,i=[],o=t;n>o;o=r){var a=new Pt(e.doc,Kr(e.doc,o),o);r=o+a.size,i.push(a)}return i}function Dt(e,t,n,r){null==t&&(t=e.doc.first),null==n&&(n=e.doc.first+e.doc.size),r||(r=0);var i=e.display;if(r&&n<i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)No&&gr(e.doc,t)<i.viewTo&&Et(e);else if(n<=i.viewFrom)No&&vr(e.doc,n+r)>i.viewFrom?Et(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)Et(e);else if(t<=i.viewFrom){var o=Ft(e,n,n+r,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=r):Et(e)}else if(n>=i.viewTo){var o=Ft(e,t,t,-1);o?(i.view=i.view.slice(0,o.index),i.viewTo=o.lineN):Et(e)}else{var a=Ft(e,t,t,-1),l=Ft(e,n,n+r,1);a&&l?(i.view=i.view.slice(0,a.index).concat(zt(e,a.lineN,l.lineN)).concat(i.view.slice(l.index)),i.viewTo+=r):Et(e)}var s=i.externalMeasured;s&&(n<s.lineN?s.lineN+=r:t<s.lineN+s.size&&(i.externalMeasured=null))}function Wt(e,t,n){e.curOp.viewChanged=!0;var r=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(r.externalMeasured=null),!(t<r.viewFrom||t>=r.viewTo)){var o=r.view[It(e,t)];if(null!=o.node){var a=o.changes||(o.changes=[]);-1==Oi(a,n)&&a.push(n)}}}function Et(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function It(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,0>t)return null;for(var n=e.display.view,r=0;r<n.length;r++)if(t-=n[r].size,0>t)return r}function Ft(e,t,n,r){var i,o=It(e,t),a=e.display.view;if(!No||n==e.doc.first+e.doc.size)return{index:o,lineN:n};for(var l=0,s=e.display.viewFrom;o>l;l++)s+=a[l].size;if(s!=t){if(r>0){if(o==a.length-1)return null;i=s+a[o].size-t,o++}else i=s-t;t+=i,n+=i}for(;gr(e.doc,n)!=n;){if(o==(0>r?0:a.length-1))return null;n+=r*a[o-(0>r?1:0)].size,o+=r}return{index:o,lineN:n}}function Ht(e,t,n){var r=e.display,i=r.view;0==i.length||t>=r.viewTo||n<=r.viewFrom?(r.view=zt(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=zt(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(It(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(zt(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,It(e,n)))),r.viewTo=n}function Bt(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var i=t[r];i.hidden||i.node&&!i.changes||++n}return n}function jt(e){function t(){i.activeTouch&&(o=setTimeout(function(){i.activeTouch=null},1e3),a=i.activeTouch,a.end=+new Date)}function n(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}function r(e,t){if(null==t.left)return!0;var n=t.left-e.left,r=t.top-e.top;return n*n+r*r>400}var i=e.display;Ca(i.scroller,"mousedown",At(e,Vt)),ho&&11>po?Ca(i.scroller,"dblclick",At(e,function(t){if(!wi(e,t)){var n=Ut(e,t);if(n&&!Yt(e,t)&&!qt(e.display,t)){xa(t);var r=e.findWordAt(n);xe(e.doc,r.anchor,r.head)}}})):Ca(i.scroller,"dblclick",function(t){wi(e,t)||xa(t)}),Ao||Ca(i.scroller,"contextmenu",function(t){mn(e,t)});var o,a={end:0};Ca(i.scroller,"touchstart",function(e){if(!n(e)){clearTimeout(o);var t=+new Date;i.activeTouch={start:t,moved:!1,prev:t-a.end<=300?a:null},1==e.touches.length&&(i.activeTouch.left=e.touches[0].pageX,i.activeTouch.top=e.touches[0].pageY)}}),Ca(i.scroller,"touchmove",function(){i.activeTouch&&(i.activeTouch.moved=!0)}),Ca(i.scroller,"touchend",function(n){var o=i.activeTouch;if(o&&!qt(i,n)&&null!=o.left&&!o.moved&&new Date-o.start<300){var a,l=e.coordsChar(i.activeTouch,"page");a=!o.prev||r(o,o.prev)?new fe(l,l):!o.prev.prev||r(o,o.prev.prev)?e.findWordAt(l):new fe(Po(l.line,0),me(e.doc,Po(l.line+1,0))),e.setSelection(a.anchor,a.head),e.focus(),xa(n)}t()}),Ca(i.scroller,"touchcancel",t),Ca(i.scroller,"scroll",function(){i.scroller.clientHeight&&(Jt(e,i.scroller.scrollTop),en(e,i.scroller.scrollLeft,!0),La(e,"scroll",e))}),Ca(i.scroller,"mousewheel",function(t){tn(e,t)}),Ca(i.scroller,"DOMMouseScroll",function(t){tn(e,t)}),Ca(i.wrapper,"scroll",function(){i.wrapper.scrollTop=i.wrapper.scrollLeft=0}),i.dragFunctions={simple:function(t){wi(e,t)||ka(t)},start:function(t){Qt(e,t)},drop:At(e,Zt)};var l=i.input.getField();Ca(l,"keyup",function(t){un.call(e,t)}),Ca(l,"keydown",At(e,sn)),Ca(l,"keypress",At(e,fn)),Ca(l,"focus",Wi(hn,e)),Ca(l,"blur",Wi(pn,e))}function _t(t,n,r){var i=r&&r!=e.Init;if(!n!=!i){var o=t.display.dragFunctions,a=n?Ca:Sa;a(t.display.scroller,"dragstart",o.start),a(t.display.scroller,"dragenter",o.simple),a(t.display.scroller,"dragover",o.simple),a(t.display.scroller,"drop",o.drop)}}function Rt(e){var t=e.display;(t.lastWrapHeight!=t.wrapper.clientHeight||t.lastWrapWidth!=t.wrapper.clientWidth)&&(t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize())}function qt(e,t){for(var n=vi(t);n!=e.wrapper;n=n.parentNode)if(!n||1==n.nodeType&&"true"==n.getAttribute("cm-ignore-events")||n.parentNode==e.sizer&&n!=e.mover)return!0}function Ut(e,t,n,r){var i=e.display;if(!n&&"true"==vi(t).getAttribute("cm-not-content"))return null;var o,a,l=i.lineSpace.getBoundingClientRect();try{o=t.clientX-l.left,a=t.clientY-l.top}catch(t){return null}var s,c=pt(e,o,a);if(r&&1==c.xRel&&(s=Kr(e.doc,c.line).text).length==c.ch){var u=za(s,s.length,e.options.tabSize)-s.length;c=Po(c.line,Math.max(0,Math.round((o-qe(e.display).left)/vt(e.display))-u))}return c}function Vt(e){var t=this,n=t.display;if(!(n.activeTouch&&n.input.supportsTouch()||wi(t,e))){if(n.shift=e.shiftKey,qt(n,e))return void(mo||(n.scroller.draggable=!1,setTimeout(function(){n.scroller.draggable=!0},100)));if(!Yt(t,e)){var r=Ut(t,e);switch(window.focus(),yi(e)){case 1:r?Gt(t,e,r):vi(e)==n.scroller&&xa(e);break;case 2:mo&&(t.state.lastMiddleDown=+new Date),r&&xe(t.doc,r),setTimeout(function(){n.input.focus()},20),xa(e);break;case 3:Ao?mn(t,e):dn(t)}}}}function Gt(e,t,n){ho?setTimeout(Wi(Z,e),0):e.curOp.focus=_i();var r,i=+new Date;Io&&Io.time>i-400&&0==zo(Io.pos,n)?r="triple":Eo&&Eo.time>i-400&&0==zo(Eo.pos,n)?(r="double",Io={time:i,pos:n}):(r="single",Eo={time:i,pos:n});var o,a=e.doc.sel,l=So?t.metaKey:t.ctrlKey;e.options.dragDrop&&Va&&!Q(e)&&"single"==r&&(o=a.contains(n))>-1&&!a.ranges[o].empty()?Kt(e,t,n,l):$t(e,t,n,r,l)}function Kt(e,t,n,r){var i=e.display,o=+new Date,a=At(e,function(l){mo&&(i.scroller.draggable=!1),e.state.draggingText=!1,Sa(document,"mouseup",a),Sa(i.scroller,"drop",a),Math.abs(t.clientX-l.clientX)+Math.abs(t.clientY-l.clientY)<10&&(xa(l),!r&&+new Date-200<o&&xe(e.doc,n),mo||ho&&9==po?setTimeout(function(){document.body.focus(),i.input.focus()},20):i.input.focus())});mo&&(i.scroller.draggable=!0),e.state.draggingText=a,i.scroller.dragDrop&&i.scroller.dragDrop(),Ca(document,"mouseup",a),Ca(i.scroller,"drop",a)}function $t(e,t,n,r,i){function o(t){if(0!=zo(g,t))if(g=t,"rect"==r){for(var i=[],o=e.options.tabSize,a=za(Kr(c,n.line).text,n.ch,o),l=za(Kr(c,t.line).text,t.ch,o),s=Math.min(a,l),h=Math.max(a,l),p=Math.min(n.line,t.line),m=Math.min(e.lastLine(),Math.max(n.line,t.line));m>=p;p++){var v=Kr(c,p).text,y=Mi(v,s,o);s==h?i.push(new fe(Po(p,y),Po(p,y))):v.length>y&&i.push(new fe(Po(p,y),Po(p,Mi(v,h,o))))}i.length||i.push(new fe(n,n)),Me(c,de(d.ranges.slice(0,f).concat(i),f),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var b=u,x=b.anchor,w=t;if("single"!=r){if("double"==r)var k=e.findWordAt(t);else var k=new fe(Po(t.line,0),me(c,Po(t.line+1,0)));zo(k.anchor,x)>0?(w=k.head,x=Y(b.from(),k.anchor)):(w=k.anchor,x=X(b.to(),k.head))}var i=d.ranges.slice(0);i[f]=new fe(me(c,x),w),Me(c,de(i,f),Na)}}function a(t){var n=++y,i=Ut(e,t,!0,"rect"==r);if(i)if(0!=zo(i,g)){e.curOp.focus=_i(),o(i);var l=x(s,c);(i.line>=l.to||i.line<l.from)&&setTimeout(At(e,function(){y==n&&a(t)}),150)}else{var u=t.clientY<v.top?-20:t.clientY>v.bottom?20:0;u&&setTimeout(At(e,function(){y==n&&(s.scroller.scrollTop+=u,a(t))}),50)}}function l(e){y=1/0,xa(e),s.input.focus(),Sa(document,"mousemove",b),Sa(document,"mouseup",w),c.history.lastSelOrigin=null}var s=e.display,c=e.doc;xa(t);var u,f,d=c.sel,h=d.ranges;if(i&&!t.shiftKey?(f=c.sel.contains(n),u=f>-1?h[f]:new fe(n,n)):(u=c.sel.primary(),f=c.sel.primIndex),t.altKey)r="rect",i||(u=new fe(n,n)),n=Ut(e,t,!0,!0),f=-1;else if("double"==r){var p=e.findWordAt(n);u=e.display.shift||c.extend?be(c,u,p.anchor,p.head):p}else if("triple"==r){var m=new fe(Po(n.line,0),me(c,Po(n.line+1,0)));u=e.display.shift||c.extend?be(c,u,m.anchor,m.head):m}else u=be(c,u,n);i?-1==f?(f=h.length,Me(c,de(h.concat([u]),f),{scroll:!1,origin:"*mouse"})):h.length>1&&h[f].empty()&&"single"==r&&!t.shiftKey?(Me(c,de(h.slice(0,f).concat(h.slice(f+1)),0)),d=c.sel):ke(c,f,u,Na):(f=0,Me(c,new ue([u],0),Na),d=c.sel);var g=n,v=s.wrapper.getBoundingClientRect(),y=0,b=At(e,function(e){yi(e)?a(e):l(e)}),w=At(e,l);Ca(document,"mousemove",b),Ca(document,"mouseup",w)}function Xt(e,t,n,r,i){try{var o=t.clientX,a=t.clientY}catch(t){return!1}if(o>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&xa(t);var l=e.display,s=l.lineDiv.getBoundingClientRect();if(a>s.bottom||!Ci(e,n))return gi(t);a-=s.top-l.viewOffset;for(var c=0;c<e.options.gutters.length;++c){var u=l.gutters.childNodes[c];if(u&&u.getBoundingClientRect().right>=o){var f=Qr(e.doc,a),d=e.options.gutters[c];return i(e,n,e,f,d,t),gi(t)}}}function Yt(e,t){return Xt(e,t,"gutterClick",!0,bi)}function Zt(e){var t=this;if(!wi(t,e)&&!qt(t.display,e)){xa(e),ho&&(jo=+new Date);var n=Ut(t,e,!0),r=e.dataTransfer.files;if(n&&!Q(t))if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,o=Array(i),a=0,l=function(e,r){var l=new FileReader;l.onload=At(t,function(){if(o[r]=l.result,++a==i){n=me(t.doc,n);var e={from:n,to:n,text:Ga(o.join("\n")),origin:"paste"};kn(t.doc,e),Le(t.doc,he(n,Go(e)))}}),l.readAsText(e)},s=0;i>s;++s)l(r[s],s);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1)return t.state.draggingText(e),void setTimeout(function(){t.display.input.focus()},20);try{var o=e.dataTransfer.getData("Text");if(o){if(t.state.draggingText&&!(So?e.altKey:e.ctrlKey))var c=t.listSelections();if(Te(t.doc,he(n,n)),c)for(var s=0;s<c.length;++s)An(t.doc,"",c[s].anchor,c[s].head,"drag");t.replaceSelection(o,"around","paste"),t.display.input.focus()}}catch(e){}}}}function Qt(e,t){if(ho&&(!e.state.draggingText||+new Date-jo<100))return void ka(t);if(!wi(e,t)&&!qt(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.setDragImage&&!bo)){var n=Hi("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",yo&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),yo&&n.parentNode.removeChild(n)}}function Jt(e,t){Math.abs(e.doc.scrollTop-t)<2||(e.doc.scrollTop=t,co||O(e,{top:t}),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t),e.display.scrollbars.setScrollTop(t),co&&O(e),Fe(e,100))}function en(e,t,n){(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)||(t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),e.doc.scrollLeft=t,w(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function tn(e,t){var n=qo(t),r=n.x,i=n.y,o=e.display,a=o.scroller;if(r&&a.scrollWidth>a.clientWidth||i&&a.scrollHeight>a.clientHeight){if(i&&So&&mo)e:for(var l=t.target,s=o.view;l!=a;l=l.parentNode)for(var c=0;c<s.length;c++)if(s[c].node==l){e.display.currentWheelTarget=l;break e}if(r&&!co&&!yo&&null!=Ro)return i&&Jt(e,Math.max(0,Math.min(a.scrollTop+i*Ro,a.scrollHeight-a.clientHeight))),en(e,Math.max(0,Math.min(a.scrollLeft+r*Ro,a.scrollWidth-a.clientWidth))),xa(t),void(o.wheelStartX=null);if(i&&null!=Ro){var u=i*Ro,f=e.doc.scrollTop,d=f+o.wrapper.clientHeight;0>u?f=Math.max(0,f+u-50):d=Math.min(e.doc.height,d+u+50),O(e,{top:f,bottom:d})}20>_o&&(null==o.wheelStartX?(o.wheelStartX=a.scrollLeft,o.wheelStartY=a.scrollTop,o.wheelDX=r,o.wheelDY=i,setTimeout(function(){if(null!=o.wheelStartX){var e=a.scrollLeft-o.wheelStartX,t=a.scrollTop-o.wheelStartY,n=t&&o.wheelDY&&t/o.wheelDY||e&&o.wheelDX&&e/o.wheelDX;o.wheelStartX=o.wheelStartY=null,n&&(Ro=(Ro*_o+n)/(_o+1),++_o)}},200)):(o.wheelDX+=r,o.wheelDY+=i))}}function nn(e,t,n){if("string"==typeof t&&(t=ra[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{Q(e)&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=Aa}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function rn(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=oa(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&oa(t,e.options.extraKeys,n,e)||oa(t,e.options.keyMap,n,e)}function on(e,t,n,r){var i=e.state.keySeq;if(i){if(aa(t))return"handled";Uo.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),t=i+" "+t}var o=rn(e,t,r);return"multi"==o&&(e.state.keySeq=t),"handled"==o&&bi(e,"keyHandled",e,t,n),("handled"==o||"multi"==o)&&(xa(n),Ie(e)),i&&!o&&/\'$/.test(t)?(xa(n),!0):!!o}function an(e,t){var n=la(t,!0);return n?t.shiftKey&&!e.state.keySeq?on(e,"Shift-"+n,t,function(t){return nn(e,t,!0)})||on(e,n,t,function(t){return("string"==typeof t?/^go[A-Z]/.test(t):t.motion)?nn(e,t):void 0}):on(e,n,t,function(t){return nn(e,t)}):!1}function ln(e,t,n){return on(e,"'"+n+"'",t,function(t){return nn(e,t,!0)})}function sn(e){var t=this;if(t.curOp.focus=_i(),!wi(t,e)){ho&&11>po&&27==e.keyCode&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=16==n||e.shiftKey;var r=an(t,e);yo&&(Vo=r?n:null,!r&&88==n&&!$a&&(So?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),18!=n||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||cn(t)}}function cn(e){function t(e){18!=e.keyCode&&e.altKey||(Ra(n,"CodeMirror-crosshair"),Sa(document,"keyup",t),Sa(document,"mouseover",t))}var n=e.display.lineDiv;qa(n,"CodeMirror-crosshair"),Ca(document,"keyup",t),Ca(document,"mouseover",t)}function un(e){16==e.keyCode&&(this.doc.sel.shift=!1),wi(this,e)}function fn(e){var t=this;if(!(qt(t.display,e)||wi(t,e)||e.ctrlKey&&!e.altKey||So&&e.metaKey)){var n=e.keyCode,r=e.charCode;if(yo&&n==Vo)return Vo=null,void xa(e);if(!yo||e.which&&!(e.which<10)||!an(t,e)){var i=String.fromCharCode(null==r?n:r);ln(t,e,i)||t.display.input.onKeyPress(e)}}}function dn(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,pn(e))},100)}function hn(e){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(La(e,"focus",e),e.state.focused=!0,qa(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),mo&&setTimeout(function(){e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Ie(e))}function pn(e){e.state.delayingBlurEvent||(e.state.focused&&(La(e,"blur",e),e.state.focused=!1,Ra(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function mn(e,t){qt(e.display,t)||gn(e,t)||e.display.input.onContextMenu(t)}function gn(e,t){return Ci(e,"gutterContextMenu")?Xt(e,t,"gutterContextMenu",!1,La):!1}function vn(e,t){if(zo(e,t.from)<0)return e;if(zo(e,t.to)<=0)return Go(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=Go(t).ch-t.to.ch),Po(n,r)}function yn(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new fe(vn(i.anchor,t),vn(i.head,t)))}return de(n,e.sel.primIndex)}function bn(e,t,n){return e.line==t.line?Po(n.line,e.ch-t.ch+n.ch):Po(n.line+(e.line-t.line),e.ch)}function xn(e,t,n){for(var r=[],i=Po(e.first,0),o=i,a=0;a<t.length;a++){var l=t[a],s=bn(l.from,i,o),c=bn(Go(l),i,o);if(i=l.to,o=c,"around"==n){var u=e.sel.ranges[a],f=zo(u.head,u.anchor)<0;r[a]=new fe(f?c:s,f?s:c)}else r[a]=new fe(s,s)}return new ue(r,e.sel.primIndex)}function wn(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){this.canceled=!0}};return n&&(r.update=function(t,n,r,i){t&&(this.from=me(e,t)),n&&(this.to=me(e,n)),r&&(this.text=r),void 0!==i&&(this.origin=i)}),La(e,"beforeChange",e,r),e.cm&&La(e.cm,"beforeChange",e.cm,r),r.canceled?null:{from:r.from,to:r.to,text:r.text,origin:r.origin}}function kn(e,t,n){if(e.cm){if(!e.cm.curOp)return At(e.cm,kn)(e,t,n);if(e.cm.state.suppressEdits)return}if(!(Ci(e,"beforeChange")||e.cm&&Ci(e.cm,"beforeChange"))||(t=wn(e,t,!0))){var r=Oo&&!n&&ir(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)Cn(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text});else Cn(e,t)}}function Cn(e,t){if(1!=t.text.length||""!=t.text[0]||0!=zo(t.from,t.to)){var n=yn(e,t);oi(e,t,n,e.cm?e.cm.curOp.id:0/0),Mn(e,t,n,tr(e,t));var r=[];Vr(e,function(e,n){n||-1!=Oi(r,e.history)||(mi(e.history,t),r.push(e.history)),Mn(e,t,null,tr(e,t))})}}function Sn(e,t,n){if(!e.cm||!e.cm.state.suppressEdits){for(var r,i=e.history,o=e.sel,a="undo"==t?i.done:i.undone,l="undo"==t?i.undone:i.done,s=0;s<a.length&&(r=a[s],n?!r.ranges||r.equals(e.sel):r.ranges);s++);if(s!=a.length){for(i.lastOrigin=i.lastSelOrigin=null;r=a.pop(),r.ranges;){if(si(r,l),n&&!r.equals(e.sel))return void Me(e,r,{clearRedo:!1});o=r}var c=[];si(o,l),l.push({changes:c,generation:i.generation}),i.generation=r.generation||++i.maxGeneration;for(var u=Ci(e,"beforeChange")||e.cm&&Ci(e.cm,"beforeChange"),s=r.changes.length-1;s>=0;--s){var f=r.changes[s];if(f.origin=t,u&&!wn(e,f,!1))return void(a.length=0);c.push(ni(e,f));var d=s?yn(e,f):Ai(a);Mn(e,f,d,rr(e,f)),!s&&e.cm&&e.cm.scrollIntoView({from:f.from,to:Go(f)});var h=[];Vr(e,function(e,t){t||-1!=Oi(h,e.history)||(mi(e.history,f),h.push(e.history)),Mn(e,f,null,rr(e,f))})}}}}function Ln(e,t){if(0!=t&&(e.first+=t,e.sel=new ue(Ni(e.sel.ranges,function(e){return new fe(Po(e.anchor.line+t,e.anchor.ch),Po(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){Dt(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)Wt(e.cm,r,"gutter")}}function Mn(e,t,n,r){if(e.cm&&!e.cm.curOp)return At(e.cm,Mn)(e,t,n,r);if(t.to.line<e.first)return void Ln(e,t.text.length-1-(t.to.line-t.from.line));if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);Ln(e,i),t={from:Po(e.first,0),to:Po(t.to.line+i,t.to.ch),text:[Ai(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:Po(o,Kr(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=$r(e,t.from,t.to),n||(n=yn(e,t)),e.cm?Tn(e.cm,t,r):Rr(e,t,r),Te(e,n,Oa)}}function Tn(e,t,n){var r=e.doc,i=e.display,a=t.from,l=t.to,s=!1,c=a.line;e.options.lineWrapping||(c=Zr(pr(Kr(r,a.line))),r.iter(c,l.line+1,function(e){return e==i.maxLine?(s=!0,!0):void 0})),r.sel.contains(t.from,t.to)>-1&&ki(e),Rr(r,t,n,o(e)),e.options.lineWrapping||(r.iter(c,a.line+t.text.length,function(e){var t=f(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,s=!1)}),s&&(e.curOp.updateMaxLine=!0)),r.frontier=Math.min(r.frontier,a.line),Fe(e,400);var u=t.text.length-(l.line-a.line)-1;t.full?Dt(e):a.line!=l.line||1!=t.text.length||_r(e.doc,t)?Dt(e,a.line,l.line+1,u):Wt(e,a.line,"text");var d=Ci(e,"changes"),h=Ci(e,"change");if(h||d){var p={from:a,to:l,text:t.text,removed:t.removed,origin:t.origin};h&&bi(e,"change",e,p),d&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(p)}e.display.selForContextMenu=null}function An(e,t,n,r,i){if(r||(r=n),zo(r,n)<0){var o=r;r=n,n=o}"string"==typeof t&&(t=Ga(t)),kn(e,{from:n,to:r,text:t,origin:i})}function On(e,t){if(!wi(e,"scrollCursorIntoView")){var n=e.display,r=n.sizer.getBoundingClientRect(),i=null;if(t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!wo){var o=Hi("div","",null,"position: absolute; top: "+(t.top-n.viewOffset-_e(e.display))+"px; height: "+(t.bottom-t.top+Ue(e)+n.barHeight)+"px; left: "+t.left+"px; width: 2px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}function Nn(e,t,n,r){null==r&&(r=0);for(var i=0;5>i;i++){var o=!1,a=ft(e,t),l=n&&n!=t?ft(e,n):a,s=zn(e,Math.min(a.left,l.left),Math.min(a.top,l.top)-r,Math.max(a.left,l.left),Math.max(a.bottom,l.bottom)+r),c=e.doc.scrollTop,u=e.doc.scrollLeft;if(null!=s.scrollTop&&(Jt(e,s.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(o=!0)),null!=s.scrollLeft&&(en(e,s.scrollLeft),Math.abs(e.doc.scrollLeft-u)>1&&(o=!0)),!o)break}return a}function Pn(e,t,n,r,i){var o=zn(e,t,n,r,i);null!=o.scrollTop&&Jt(e,o.scrollTop),null!=o.scrollLeft&&en(e,o.scrollLeft)}function zn(e,t,n,r,i){var o=e.display,a=gt(e.display);0>n&&(n=0);var l=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:o.scroller.scrollTop,s=Ge(e),c={};i-n>s&&(i=n+s);var u=e.doc.height+Re(o),f=a>n,d=i>u-a;if(l>n)c.scrollTop=f?0:n;else if(i>l+s){var h=Math.min(n,(d?u:i)-s);h!=l&&(c.scrollTop=h)}var p=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:o.scroller.scrollLeft,m=Ve(e)-(e.options.fixedGutter?o.gutters.offsetWidth:0),g=r-t>m;return g&&(r=t+m),10>t?c.scrollLeft=0:p>t?c.scrollLeft=Math.max(0,t-(g?0:10)):r>m+p-3&&(c.scrollLeft=r+(g?0:10)-m),c}function Dn(e,t,n){(null!=t||null!=n)&&En(e),null!=t&&(e.curOp.scrollLeft=(null==e.curOp.scrollLeft?e.doc.scrollLeft:e.curOp.scrollLeft)+t),null!=n&&(e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+n)}function Wn(e){En(e);var t=e.getCursor(),n=t,r=t;e.options.lineWrapping||(n=t.ch?Po(t.line,t.ch-1):t,r=Po(t.line,t.ch+1)),e.curOp.scrollToPos={from:n,to:r,margin:e.options.cursorScrollMargin,isCursor:!0}}function En(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=dt(e,t.from),r=dt(e,t.to),i=zn(e,Math.min(n.left,r.left),Math.min(n.top,r.top)-t.margin,Math.max(n.right,r.right),Math.max(n.bottom,r.bottom)+t.margin);e.scrollTo(i.scrollLeft,i.scrollTop)}}function In(e,t,n,r){var i,o=e.doc;null==n&&(n="add"),"smart"==n&&(o.mode.indent?i=je(e,t):n="prev");var a=e.options.tabSize,l=Kr(o,t),s=za(l.text,null,a);l.stateAfter&&(l.stateAfter=null);var c,u=l.text.match(/^\s*/)[0];if(r||/\S/.test(l.text)){if("smart"==n&&(c=o.mode.indent(i,l.text.slice(u.length),l.text),c==Aa||c>150)){if(!r)return;n="prev"}}else c=0,n="not";"prev"==n?c=t>o.first?za(Kr(o,t-1).text,null,a):0:"add"==n?c=s+e.options.indentUnit:"subtract"==n?c=s-e.options.indentUnit:"number"==typeof n&&(c=s+n),c=Math.max(0,c);var f="",d=0;if(e.options.indentWithTabs)for(var h=Math.floor(c/a);h;--h)d+=a,f+=" ";if(c>d&&(f+=Ti(c-d)),f!=u)return An(o,f,Po(t,0),Po(t,u.length),"+input"),l.stateAfter=null,!0;for(var h=0;h<o.sel.ranges.length;h++){var p=o.sel.ranges[h];if(p.head.line==t&&p.head.ch<u.length){var d=Po(t,u.length);ke(o,h,new fe(d,d));break}}}function Fn(e,t,n,r){var i=t,o=t;return"number"==typeof t?o=Kr(e,pe(e,t)):i=Zr(t),null==i?null:(r(o,i)&&e.cm&&Wt(e.cm,i,n),o)}function Hn(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var o=t(n[i]);r.length&&zo(o.from,Ai(r).to)<=0;){var a=r.pop();if(zo(a.from,o.from)<0){o.from=a.from;break}}r.push(o)}Tt(e,function(){for(var t=r.length-1;t>=0;t--)An(e.doc,"",r[t].from,r[t].to,"+delete");Wn(e)})}function Bn(e,t,n,r,i){function o(){var t=l+n;return t<e.first||t>=e.first+e.size?f=!1:(l=t,u=Kr(e,t))}function a(e){var t=(i?lo:so)(u,s,n,!0);if(null==t){if(e||!o())return f=!1;s=i?(0>n?eo:Ji)(u):0>n?u.text.length:0}else s=t;return!0}var l=t.line,s=t.ch,c=n,u=Kr(e,l),f=!0;if("char"==r)a();else if("column"==r)a(!0);else if("word"==r||"group"==r)for(var d=null,h="group"==r,p=e.cm&&e.cm.getHelper(t,"wordChars"),m=!0;!(0>n)||a(!m);m=!1){var g=u.text.charAt(s)||"\n",v=Ei(g,p)?"w":h&&"\n"==g?"n":!h||/\s/.test(g)?null:"p";if(!h||m||v||(v="s"),d&&d!=v){0>n&&(n=1,a());break}if(v&&(d=v), +n>0&&!a(!m))break}var y=Pe(e,Po(l,s),c,!0);return f||(y.hitSide=!0),y}function jn(e,t,n,r){var i,o=e.doc,a=t.left;if("page"==r){var l=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);i=t.top+n*(l-(0>n?1.5:.5)*gt(e.display))}else"line"==r&&(i=n>0?t.bottom+3:t.top-3);for(;;){var s=pt(e,a,i);if(!s.outside)break;if(0>n?0>=i:i>=o.height){s.hitSide=!0;break}i+=5*n}return s}function _n(t,n,r,i){e.defaults[t]=n,r&&($o[t]=i?function(e,t,n){n!=Xo&&r(e,t,n)}:r)}function Rn(e){for(var t,n,r,i,o=e.split(/-(?!$)/),e=o[o.length-1],a=0;a<o.length-1;a++){var l=o[a];if(/^(cmd|meta|m)$/i.test(l))i=!0;else if(/^a(lt)?$/i.test(l))t=!0;else if(/^(c|ctrl|control)$/i.test(l))n=!0;else{if(!/^s(hift)$/i.test(l))throw new Error("Unrecognized modifier name: "+l);r=!0}}return t&&(e="Alt-"+e),n&&(e="Ctrl-"+e),i&&(e="Cmd-"+e),r&&(e="Shift-"+e),e}function qn(e){return"string"==typeof e?ia[e]:e}function Un(e,t,n,r,i){if(r&&r.shared)return Vn(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return At(e.cm,Un)(e,t,n,r,i);var o=new ua(e,i),a=zo(t,n);if(r&&Di(r,o,!1),a>0||0==a&&o.clearWhenEmpty!==!1)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=Hi("span",[o.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(hr(e,t.line,t,n,o)||t.line!=n.line&&hr(e,n.line,t,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");No=!0}o.addToHistory&&oi(e,{from:t,to:n,origin:"markText"},e.sel,0/0);var l,s=t.line,c=e.cm;if(e.iter(s,n.line+1,function(e){c&&o.collapsed&&!c.options.lineWrapping&&pr(e)==c.display.maxLine&&(l=!0),o.collapsed&&s!=t.line&&Yr(e,0),Qn(e,new Xn(o,s==t.line?t.ch:null,s==n.line?n.ch:null)),++s}),o.collapsed&&e.iter(t.line,n.line+1,function(t){yr(e,t)&&Yr(t,0)}),o.clearOnEnter&&Ca(o,"beforeCursorEnter",function(){o.clear()}),o.readOnly&&(Oo=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++ca,o.atomic=!0),c){if(l&&(c.curOp.updateMaxLine=!0),o.collapsed)Dt(c,t.line,n.line+1);else if(o.className||o.title||o.startStyle||o.endStyle||o.css)for(var u=t.line;u<=n.line;u++)Wt(c,u,"text");o.atomic&&Oe(c.doc),bi(c,"markerAdded",c,o)}return o}function Vn(e,t,n,r,i){r=Di(r),r.shared=!1;var o=[Un(e,t,n,r,i)],a=o[0],l=r.widgetNode;return Vr(e,function(e){l&&(r.widgetNode=l.cloneNode(!0)),o.push(Un(e,me(e,t),me(e,n),r,i));for(var s=0;s<e.linked.length;++s)if(e.linked[s].isParent)return;a=Ai(o)}),new fa(o,a)}function Gn(e){return e.findMarks(Po(e.first,0),e.clipPos(Po(e.lastLine())),function(e){return e.parent})}function Kn(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.find(),o=e.clipPos(i.from),a=e.clipPos(i.to);if(zo(o,a)){var l=Un(e,o,a,r.primary,r.primary.type);r.markers.push(l),l.parent=r}}}function $n(e){for(var t=0;t<e.length;t++){var n=e[t],r=[n.primary.doc];Vr(n.primary.doc,function(e){r.push(e)});for(var i=0;i<n.markers.length;i++){var o=n.markers[i];-1==Oi(r,o.doc)&&(o.parent=null,n.markers.splice(i--,1))}}}function Xn(e,t,n){this.marker=e,this.from=t,this.to=n}function Yn(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Zn(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function Qn(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Jn(e,t,n){if(e)for(var r,i=0;i<e.length;++i){var o=e[i],a=o.marker,l=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);if(l||o.from==t&&"bookmark"==a.type&&(!n||!o.marker.insertLeft)){var s=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);(r||(r=[])).push(new Xn(a,o.from,s?null:o.to))}}return r}function er(e,t,n){if(e)for(var r,i=0;i<e.length;++i){var o=e[i],a=o.marker,l=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);if(l||o.from==t&&"bookmark"==a.type&&(!n||o.marker.insertLeft)){var s=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);(r||(r=[])).push(new Xn(a,s?null:o.from-t,null==o.to?null:o.to-t))}}return r}function tr(e,t){if(t.full)return null;var n=ve(e,t.from.line)&&Kr(e,t.from.line).markedSpans,r=ve(e,t.to.line)&&Kr(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,o=t.to.ch,a=0==zo(t.from,t.to),l=Jn(n,i,a),s=er(r,o,a),c=1==t.text.length,u=Ai(t.text).length+(c?i:0);if(l)for(var f=0;f<l.length;++f){var d=l[f];if(null==d.to){var h=Yn(s,d.marker);h?c&&(d.to=null==h.to?null:h.to+u):d.to=i}}if(s)for(var f=0;f<s.length;++f){var d=s[f];if(null!=d.to&&(d.to+=u),null==d.from){var h=Yn(l,d.marker);h||(d.from=u,c&&(l||(l=[])).push(d))}else d.from+=u,c&&(l||(l=[])).push(d)}l&&(l=nr(l)),s&&s!=l&&(s=nr(s));var p=[l];if(!c){var m,g=t.text.length-2;if(g>0&&l)for(var f=0;f<l.length;++f)null==l[f].to&&(m||(m=[])).push(new Xn(l[f].marker,null,null));for(var f=0;g>f;++f)p.push(m);p.push(s)}return p}function nr(e){for(var t=0;t<e.length;++t){var n=e[t];null!=n.from&&n.from==n.to&&n.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function rr(e,t){var n=fi(e,t),r=tr(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var o=n[i],a=r[i];if(o&&a)e:for(var l=0;l<a.length;++l){for(var s=a[l],c=0;c<o.length;++c)if(o[c].marker==s.marker)continue e;o.push(s)}else a&&(n[i]=a)}return n}function ir(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var n=e.markedSpans[t].marker;!n.readOnly||r&&-1!=Oi(r,n)||(r||(r=[])).push(n)}}),!r)return null;for(var i=[{from:t,to:n}],o=0;o<r.length;++o)for(var a=r[o],l=a.find(0),s=0;s<i.length;++s){var c=i[s];if(!(zo(c.to,l.from)<0||zo(c.from,l.to)>0)){var u=[s,1],f=zo(c.from,l.from),d=zo(c.to,l.to);(0>f||!a.inclusiveLeft&&!f)&&u.push({from:c.from,to:l.from}),(d>0||!a.inclusiveRight&&!d)&&u.push({from:l.to,to:c.to}),i.splice.apply(i,u),s+=u.length-1}}return i}function or(e){var t=e.markedSpans;if(t){for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}}function ar(e,t){if(t){for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}}function lr(e){return e.inclusiveLeft?-1:0}function sr(e){return e.inclusiveRight?1:0}function cr(e,t){var n=e.lines.length-t.lines.length;if(0!=n)return n;var r=e.find(),i=t.find(),o=zo(r.from,i.from)||lr(e)-lr(t);if(o)return-o;var a=zo(r.to,i.to)||sr(e)-sr(t);return a?a:t.id-e.id}function ur(e,t){var n,r=No&&e.markedSpans;if(r)for(var i,o=0;o<r.length;++o)i=r[o],i.marker.collapsed&&null==(t?i.from:i.to)&&(!n||cr(n,i.marker)<0)&&(n=i.marker);return n}function fr(e){return ur(e,!0)}function dr(e){return ur(e,!1)}function hr(e,t,n,r,i){var o=Kr(e,t),a=No&&o.markedSpans;if(a)for(var l=0;l<a.length;++l){var s=a[l];if(s.marker.collapsed){var c=s.marker.find(0),u=zo(c.from,n)||lr(s.marker)-lr(i),f=zo(c.to,r)||sr(s.marker)-sr(i);if(!(u>=0&&0>=f||0>=u&&f>=0)&&(0>=u&&(zo(c.to,n)>0||s.marker.inclusiveRight&&i.inclusiveLeft)||u>=0&&(zo(c.from,r)<0||s.marker.inclusiveLeft&&i.inclusiveRight)))return!0}}}function pr(e){for(var t;t=fr(e);)e=t.find(-1,!0).line;return e}function mr(e){for(var t,n;t=dr(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function gr(e,t){var n=Kr(e,t),r=pr(n);return n==r?t:Zr(r)}function vr(e,t){if(t>e.lastLine())return t;var n,r=Kr(e,t);if(!yr(e,r))return t;for(;n=dr(r);)r=n.find(1,!0).line;return Zr(r)+1}function yr(e,t){var n=No&&t.markedSpans;if(n)for(var r,i=0;i<n.length;++i)if(r=n[i],r.marker.collapsed){if(null==r.from)return!0;if(!r.marker.widgetNode&&0==r.from&&r.marker.inclusiveLeft&&br(e,t,r))return!0}}function br(e,t,n){if(null==n.to){var r=n.marker.find(1,!0);return br(e,r.line,Yn(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i,o=0;o<t.markedSpans.length;++o)if(i=t.markedSpans[o],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(null==i.to||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&br(e,t,i))return!0}function xr(e,t,n){Jr(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Dn(e,null,n)}function wr(e){if(null!=e.height)return e.height;var t=e.doc.cm;if(!t)return 0;if(!Ba(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),ji(t.display.measure,Hi("div",[e.node],null,n))}return e.height=e.node.offsetHeight}function kr(e,t,n,r){var i=new da(e,n,r),o=e.cm;return o&&i.noHScroll&&(o.display.alignWidgets=!0),Fn(e,t,"widget",function(t){var n=t.widgets||(t.widgets=[]);if(null==i.insertAt?n.push(i):n.splice(Math.min(n.length-1,Math.max(0,i.insertAt)),0,i),i.line=t,o&&!yr(e,t)){var r=Jr(t)<e.scrollTop;Yr(t,t.height+wr(i)),r&&Dn(o,null,i.height),o.curOp.forceUpdate=!0}return!0}),i}function Cr(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),or(e),ar(e,n);var i=r?r(e):1;i!=e.height&&Yr(e,i)}function Sr(e){e.parent=null,or(e)}function Lr(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";null==t[r]?t[r]=n[2]:new RegExp("(?:^|s)"+n[2]+"(?:$|s)").test(t[r])||(t[r]+=" "+n[2])}return e}function Mr(t,n){if(t.blankLine)return t.blankLine(n);if(t.innerMode){var r=e.innerMode(t,n);return r.mode.blankLine?r.mode.blankLine(r.state):void 0}}function Tr(t,n,r,i){for(var o=0;10>o;o++){i&&(i[0]=e.innerMode(t,r).mode);var a=t.token(n,r);if(n.pos>n.start)return a}throw new Error("Mode "+t.name+" failed to advance stream.")}function Ar(e,t,n,r){function i(e){return{start:f.start,end:f.pos,string:f.current(),type:o||null,state:e?ta(a.mode,u):u}}var o,a=e.doc,l=a.mode;t=me(a,t);var s,c=Kr(a,t.line),u=je(e,t.line,n),f=new sa(c.text,e.options.tabSize);for(r&&(s=[]);(r||f.pos<t.ch)&&!f.eol();)f.start=f.pos,o=Tr(l,f,u),r&&s.push(i(!0));return r?s:i()}function Or(e,t,n,r,i,o,a){var l=n.flattenSpans;null==l&&(l=e.options.flattenSpans);var s,c=0,u=null,f=new sa(t,e.options.tabSize),d=e.options.addModeClass&&[null];for(""==t&&Lr(Mr(n,r),o);!f.eol();){if(f.pos>e.options.maxHighlightLength?(l=!1,a&&zr(e,t,r,f.pos),f.pos=t.length,s=null):s=Lr(Tr(n,f,r,d),o),d){var h=d[0].name;h&&(s="m-"+(s?h+" "+s:h))}if(!l||u!=s){for(;c<f.start;)c=Math.min(f.start,c+5e4),i(c,u);u=s}f.start=f.pos}for(;c<f.pos;){var p=Math.min(f.pos,c+5e4);i(p,u),c=p}}function Nr(e,t,n,r){var i=[e.state.modeGen],o={};Or(e,t.text,e.doc.mode,n,function(e,t){i.push(e,t)},o,r);for(var a=0;a<e.state.overlays.length;++a){var l=e.state.overlays[a],s=1,c=0;Or(e,t.text,l.mode,!0,function(e,t){for(var n=s;e>c;){var r=i[s];r>e&&i.splice(s,1,e,i[s+1],r),s+=2,c=Math.min(e,r)}if(t)if(l.opaque)i.splice(n,s-n,e,"cm-overlay "+t),s=n+2;else for(;s>n;n+=2){var o=i[n+1];i[n+1]=(o?o+" ":"")+"cm-overlay "+t}},o)}return{styles:i,classes:o.bgClass||o.textClass?o:null}}function Pr(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=Nr(e,t,t.stateAfter=je(e,Zr(t)));t.styles=r.styles,r.classes?t.styleClasses=r.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.frontier&&e.doc.frontier++}return t.styles}function zr(e,t,n,r){var i=e.doc.mode,o=new sa(t,e.options.tabSize);for(o.start=o.pos=r||0,""==t&&Mr(i,n);!o.eol()&&o.pos<=e.options.maxHighlightLength;)Tr(i,o,n),o.start=o.pos}function Dr(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?ma:pa;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Wr(e,t){var n=Hi("span",null,null,mo?"padding-right: .1px":null),r={pre:Hi("pre",[n]),content:n,col:0,pos:0,cm:e,splitSpaces:(ho||mo)&&e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o,a=i?t.rest[i-1]:t.line;r.pos=0,r.addToken=Ir,$i(e.display.measure)&&(o=ei(a))&&(r.addToken=Hr(r.addToken,o)),r.map=[];var l=t!=e.display.externalMeasured&&Zr(a);jr(a,r,Pr(e,a,l)),a.styleClasses&&(a.styleClasses.bgClass&&(r.bgClass=qi(a.styleClasses.bgClass,r.bgClass||"")),a.styleClasses.textClass&&(r.textClass=qi(a.styleClasses.textClass,r.textClass||""))),0==r.map.length&&r.map.push(0,0,r.content.appendChild(Ki(e.display.measure))),0==i?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}return mo&&/\bcm-tab\b/.test(r.content.lastChild.className)&&(r.content.className="cm-tab-wrap-hack"),La(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=qi(r.pre.className,r.textClass||"")),r}function Er(e){var t=Hi("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Ir(e,t,n,r,i,o,a){if(t){var l=e.splitSpaces?t.replace(/ {3,}/g,Fr):t,s=e.cm.state.specialChars,c=!1;if(s.test(t))for(var u=document.createDocumentFragment(),f=0;;){s.lastIndex=f;var d=s.exec(t),h=d?d.index-f:t.length-f;if(h){var p=document.createTextNode(l.slice(f,f+h));u.appendChild(ho&&9>po?Hi("span",[p]):p),e.map.push(e.pos,e.pos+h,p),e.col+=h,e.pos+=h}if(!d)break;if(f+=h+1," "==d[0]){var m=e.cm.options.tabSize,g=m-e.col%m,p=u.appendChild(Hi("span",Ti(g),"cm-tab"));p.setAttribute("role","presentation"),p.setAttribute("cm-text"," "),e.col+=g}else{var p=e.cm.options.specialCharPlaceholder(d[0]);p.setAttribute("cm-text",d[0]),u.appendChild(ho&&9>po?Hi("span",[p]):p),e.col+=1}e.map.push(e.pos,e.pos+1,p),e.pos++}else{e.col+=t.length;var u=document.createTextNode(l);e.map.push(e.pos,e.pos+t.length,u),ho&&9>po&&(c=!0),e.pos+=t.length}if(n||r||i||c||a){var v=n||"";r&&(v+=r),i&&(v+=i);var y=Hi("span",[u],v,a);return o&&(y.title=o),e.content.appendChild(y)}e.content.appendChild(u)}}function Fr(e){for(var t=" ",n=0;n<e.length-2;++n)t+=n%2?" ":" ";return t+=" "}function Hr(e,t){return function(n,r,i,o,a,l,s){i=i?i+" cm-force-border":"cm-force-border";for(var c=n.pos,u=c+r.length;;){for(var f=0;f<t.length;f++){var d=t[f];if(d.to>c&&d.from<=c)break}if(d.to>=u)return e(n,r,i,o,a,l,s);e(n,r.slice(0,d.to-c),i,o,null,l,s),o=null,r=r.slice(d.to-c),c=d.to}}}function Br(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t}function jr(e,t,n){var r=e.markedSpans,i=e.text,o=0;if(r)for(var a,l,s,c,u,f,d,h=i.length,p=0,m=1,g="",v=0;;){if(v==p){s=c=u=f=l="",d=null,v=1/0;for(var y=[],b=0;b<r.length;++b){var x=r[b],w=x.marker;"bookmark"==w.type&&x.from==p&&w.widgetNode?y.push(w):x.from<=p&&(null==x.to||x.to>p||w.collapsed&&x.to==p&&x.from==p)?(null!=x.to&&x.to!=p&&v>x.to&&(v=x.to,c=""),w.className&&(s+=" "+w.className),w.css&&(l=w.css),w.startStyle&&x.from==p&&(u+=" "+w.startStyle),w.endStyle&&x.to==v&&(c+=" "+w.endStyle),w.title&&!f&&(f=w.title),w.collapsed&&(!d||cr(d.marker,w)<0)&&(d=x)):x.from>p&&v>x.from&&(v=x.from)}if(d&&(d.from||0)==p){if(Br(t,(null==d.to?h+1:d.to)-p,d.marker,null==d.from),null==d.to)return;d.to==p&&(d=!1)}if(!d&&y.length)for(var b=0;b<y.length;++b)Br(t,0,y[b])}if(p>=h)break;for(var k=Math.min(h,v);;){if(g){var C=p+g.length;if(!d){var S=C>k?g.slice(0,k-p):g;t.addToken(t,S,a?a+s:s,u,p+S.length==v?c:"",f,l)}if(C>=k){g=g.slice(k-p),p=k;break}p=C,u=""}g=i.slice(o,o=n[m++]),a=Dr(n[m++],t.cm.options)}}else for(var m=1;m<n.length;m+=2)t.addToken(t,i.slice(o,o=n[m]),Dr(n[m+1],t.cm.options))}function _r(e,t){return 0==t.from.ch&&0==t.to.ch&&""==Ai(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Rr(e,t,n,r){function i(e){return n?n[e]:null}function o(e,n,i){Cr(e,n,i,r),bi(e,"change",e,t)}function a(e,t){for(var n=e,o=[];t>n;++n)o.push(new ha(c[n],i(n),r));return o}var l=t.from,s=t.to,c=t.text,u=Kr(e,l.line),f=Kr(e,s.line),d=Ai(c),h=i(c.length-1),p=s.line-l.line;if(t.full)e.insert(0,a(0,c.length)),e.remove(c.length,e.size-c.length);else if(_r(e,t)){var m=a(0,c.length-1);o(f,f.text,h),p&&e.remove(l.line,p),m.length&&e.insert(l.line,m)}else if(u==f)if(1==c.length)o(u,u.text.slice(0,l.ch)+d+u.text.slice(s.ch),h);else{var m=a(1,c.length-1);m.push(new ha(d+u.text.slice(s.ch),h,r)),o(u,u.text.slice(0,l.ch)+c[0],i(0)),e.insert(l.line+1,m)}else if(1==c.length)o(u,u.text.slice(0,l.ch)+c[0]+f.text.slice(s.ch),i(0)),e.remove(l.line+1,p);else{o(u,u.text.slice(0,l.ch)+c[0],i(0)),o(f,d+f.text.slice(s.ch),h);var m=a(1,c.length-1);p>1&&e.remove(l.line+1,p-1),e.insert(l.line+1,m)}bi(e,"change",e,t)}function qr(e){this.lines=e,this.parent=null;for(var t=0,n=0;t<e.length;++t)e[t].parent=this,n+=e[t].height;this.height=n}function Ur(e){this.children=e;for(var t=0,n=0,r=0;r<e.length;++r){var i=e[r];t+=i.chunkSize(),n+=i.height,i.parent=this}this.size=t,this.height=n,this.parent=null}function Vr(e,t,n){function r(e,i,o){if(e.linked)for(var a=0;a<e.linked.length;++a){var l=e.linked[a];if(l.doc!=i){var s=o&&l.sharedHist;(!n||s)&&(t(l.doc,s),r(l.doc,e,s))}}}r(e,null,!0)}function Gr(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,a(e),n(e),e.options.lineWrapping||d(e),e.options.mode=t.modeOption,Dt(e)}function Kr(e,t){if(t-=e.first,0>t||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],o=i.chunkSize();if(o>t){n=i;break}t-=o}return n.lines[t]}function $r(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(e){var o=e.text;i==n.line&&(o=o.slice(0,n.ch)),i==t.line&&(o=o.slice(t.ch)),r.push(o),++i}),r}function Xr(e,t,n){var r=[];return e.iter(t,n,function(e){r.push(e.text)}),r}function Yr(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function Zr(e){if(null==e.parent)return null;for(var t=e.parent,n=Oi(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;r.children[i]!=t;++i)n+=r.children[i].chunkSize();return n+t.first}function Qr(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],o=i.height;if(o>t){e=i;continue e}t-=o,n+=i.chunkSize()}return n}while(!e.lines);for(var r=0;r<e.lines.length;++r){var a=e.lines[r],l=a.height;if(l>t)break;t-=l}return n+r}function Jr(e){e=pr(e);for(var t=0,n=e.parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==e)break;t+=i.height}for(var o=n.parent;o;n=o,o=n.parent)for(var r=0;r<o.children.length;++r){var a=o.children[r];if(a==n)break;t+=a.height}return t}function ei(e){var t=e.order;return null==t&&(t=e.order=Qa(e.text)),t}function ti(e){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function ni(e,t){var n={from:K(t.from),to:Go(t),text:$r(e,t.from,t.to)};return ci(e,n,t.from.line,t.to.line+1),Vr(e,function(e){ci(e,n,t.from.line,t.to.line+1)},!0),n}function ri(e){for(;e.length;){var t=Ai(e);if(!t.ranges)break;e.pop()}}function ii(e,t){return t?(ri(e.done),Ai(e.done)):e.done.length&&!Ai(e.done).ranges?Ai(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),Ai(e.done)):void 0}function oi(e,t,n,r){if("ignoreHistory"!=t.origin){var i=e.history;i.undone.length=0;var o,a=+new Date;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&e.cm&&i.lastModTime>a-e.cm.options.historyEventDelay||"*"==t.origin.charAt(0)))&&(o=ii(i,i.lastOp==r))){var l=Ai(o.changes);0==zo(t.from,t.to)&&0==zo(t.from,l.to)?l.to=Go(t):o.changes.push(ni(e,t))}else{var s=Ai(i.done);for(s&&s.ranges||si(e.sel,i.done),o={changes:[ni(e,t)],generation:i.generation},i.done.push(o);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=a,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,l||La(e,"historyAdded")}}function ai(e,t,n,r){var i=t.charAt(0);return"*"==i||"+"==i&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function li(e,t,n,r){var i=e.history,o=r&&r.origin;n==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||ai(e,o,Ai(i.done),t))?i.done[i.done.length-1]=t:si(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=n,r&&r.clearRedo!==!1&&ri(i.undone)}function si(e,t){var n=Ai(t);n&&n.ranges&&n.equals(e)||t.push(e)}function ci(e,t,n,r){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(n){n.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=n.markedSpans),++o})}function ui(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t||(t=e.slice(0,n)):t&&t.push(e[n]);return t?t.length?t:null:e}function fi(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=0,i=[];r<t.text.length;++r)i.push(ui(n[r]));return i}function di(e,t,n){for(var r=0,i=[];r<e.length;++r){var o=e[r];if(o.ranges)i.push(n?ue.prototype.deepCopy.call(o):o);else{var a=o.changes,l=[];i.push({changes:l});for(var s=0;s<a.length;++s){var c,u=a[s];if(l.push({from:u.from,to:u.to,text:u.text}),t)for(var f in u)(c=f.match(/^spans_(\d+)$/))&&Oi(t,Number(c[1]))>-1&&(Ai(l)[f]=u[f],delete u[f])}}}return i}function hi(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function pi(e,t,n,r){for(var i=0;i<e.length;++i){var o=e[i],a=!0;if(o.ranges){o.copied||(o=e[i]=o.deepCopy(),o.copied=!0);for(var l=0;l<o.ranges.length;l++)hi(o.ranges[l].anchor,t,n,r),hi(o.ranges[l].head,t,n,r)}else{for(var l=0;l<o.changes.length;++l){var s=o.changes[l];if(n<s.from.line)s.from=Po(s.from.line+r,s.from.ch),s.to=Po(s.to.line+r,s.to.ch);else if(t<=s.to.line){a=!1;break}}a||(e.splice(0,i+1),i=0)}}}function mi(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;pi(e.done,n,r,i),pi(e.undone,n,r,i)}function gi(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function vi(e){return e.target||e.srcElement}function yi(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),So&&e.ctrlKey&&1==t&&(t=3),t}function bi(e,t){function n(e){return function(){e.apply(null,o)}}var r=e._handlers&&e._handlers[t];if(r){var i,o=Array.prototype.slice.call(arguments,2);Ho?i=Ho.delayedCallbacks:Ma?i=Ma:(i=Ma=[],setTimeout(xi,0));for(var a=0;a<r.length;++a)i.push(n(r[a]))}}function xi(){var e=Ma;Ma=null;for(var t=0;t<e.length;++t)e[t]()}function wi(e,t,n){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),La(e,n||t.type,e,t),gi(t)||t.codemirrorIgnore}function ki(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)-1==Oi(n,t[r])&&n.push(t[r])}function Ci(e,t){var n=e._handlers&&e._handlers[t];return n&&n.length>0}function Si(e){e.prototype.on=function(e,t){Ca(this,e,t)},e.prototype.off=function(e,t){Sa(this,e,t)}}function Li(){this.id=null}function Mi(e,t,n){for(var r=0,i=0;;){var o=e.indexOf(" ",r);-1==o&&(o=e.length);var a=o-r;if(o==e.length||i+a>=t)return r+Math.min(a,t-i);if(i+=o-r,i+=n-i%n,r=o+1,i>=t)return r}}function Ti(e){for(;Da.length<=e;)Da.push(Ai(Da)+" ");return Da[e]}function Ai(e){return e[e.length-1]}function Oi(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}function Ni(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function Pi(){}function zi(e,t){var n;return Object.create?n=Object.create(e):(Pi.prototype=e,n=new Pi),t&&Di(t,n),n}function Di(e,t,n){t||(t={});for(var r in e)!e.hasOwnProperty(r)||n===!1&&t.hasOwnProperty(r)||(t[r]=e[r]);return t}function Wi(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function Ei(e,t){return t?t.source.indexOf("\\w")>-1&&Fa(e)?!0:t.test(e):Fa(e)}function Ii(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function Fi(e){return e.charCodeAt(0)>=768&&Ha.test(e)}function Hi(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)i.appendChild(t[o]);return i}function Bi(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function ji(e,t){return Bi(e).appendChild(t)}function _i(){return document.activeElement}function Ri(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}function qi(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!Ri(n[r]).test(t)&&(t+=" "+n[r]);return t}function Ui(e){if(document.body.getElementsByClassName)for(var t=document.body.getElementsByClassName("CodeMirror"),n=0;n<t.length;n++){var r=t[n].CodeMirror;r&&e(r)}}function Vi(){Ua||(Gi(),Ua=!0)}function Gi(){var e;Ca(window,"resize",function(){null==e&&(e=setTimeout(function(){e=null,Ui(Rt)},100))}),Ca(window,"blur",function(){Ui(pn)})}function Ki(e){if(null==ja){var t=Hi("span","");ji(e,Hi("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(ja=t.offsetWidth<=1&&t.offsetHeight>2&&!(ho&&8>po))}var n=ja?Hi("span",""):Hi("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}function $i(e){if(null!=_a)return _a;var t=ji(e,document.createTextNode("AخA")),n=Ea(t,0,1).getBoundingClientRect();if(!n||n.left==n.right)return!1;var r=Ea(t,1,2).getBoundingClientRect();return _a=r.right-n.right<3}function Xi(e){if(null!=Xa)return Xa;var t=ji(e,Hi("span","x")),n=t.getBoundingClientRect(),r=Ea(t,0,1).getBoundingClientRect();return Xa=Math.abs(n.left-r.left)>1}function Yi(e,t,n,r){if(!e)return r(t,n,"ltr");for(var i=!1,o=0;o<e.length;++o){var a=e[o];(a.from<n&&a.to>t||t==n&&a.to==t)&&(r(Math.max(a.from,t),Math.min(a.to,n),1==a.level?"rtl":"ltr"),i=!0)}i||r(t,n,"ltr")}function Zi(e){return e.level%2?e.to:e.from}function Qi(e){return e.level%2?e.from:e.to}function Ji(e){var t=ei(e);return t?Zi(t[0]):0}function eo(e){var t=ei(e);return t?Qi(Ai(t)):e.text.length}function to(e,t){var n=Kr(e.doc,t),r=pr(n);r!=n&&(t=Zr(r));var i=ei(r),o=i?i[0].level%2?eo(r):Ji(r):0;return Po(t,o)}function no(e,t){for(var n,r=Kr(e.doc,t);n=dr(r);)r=n.find(1,!0).line,t=null;var i=ei(r),o=i?i[0].level%2?Ji(r):eo(r):r.text.length;return Po(null==t?Zr(r):t,o)}function ro(e,t){var n=to(e,t.line),r=Kr(e.doc,n.line),i=ei(r);if(!i||0==i[0].level){var o=Math.max(0,r.text.search(/\S/)),a=t.line==n.line&&t.ch<=o&&t.ch;return Po(n.line,a?0:o)}return n}function io(e,t,n){var r=e[0].level;return t==r?!0:n==r?!1:n>t}function oo(e,t){Za=null;for(var n,r=0;r<e.length;++r){var i=e[r];if(i.from<t&&i.to>t)return r;if(i.from==t||i.to==t){if(null!=n)return io(e,i.level,e[n].level)?(i.from!=i.to&&(Za=n),r):(i.from!=i.to&&(Za=r),n);n=r}}return n}function ao(e,t,n,r){if(!r)return t+n;do t+=n;while(t>0&&Fi(e.text.charAt(t)));return t}function lo(e,t,n,r){var i=ei(e);if(!i)return so(e,t,n,r);for(var o=oo(i,t),a=i[o],l=ao(e,t,a.level%2?-n:n,r);;){if(l>a.from&&l<a.to)return l;if(l==a.from||l==a.to)return oo(i,l)==o?l:(a=i[o+=n],n>0==a.level%2?a.to:a.from);if(a=i[o+=n],!a)return null;l=n>0==a.level%2?ao(e,a.to,-1,r):ao(e,a.from,1,r)}}function so(e,t,n,r){var i=t+n;if(r)for(;i>0&&Fi(e.text.charAt(i));)i+=n;return 0>i||i>e.text.length?null:i}var co=/gecko\/\d/i.test(navigator.userAgent),uo=/MSIE \d/.test(navigator.userAgent),fo=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),ho=uo||fo,po=ho&&(uo?document.documentMode||6:fo[1]),mo=/WebKit\//.test(navigator.userAgent),go=mo&&/Qt\/\d+\.\d+/.test(navigator.userAgent),vo=/Chrome\//.test(navigator.userAgent),yo=/Opera\//.test(navigator.userAgent),bo=/Apple Computer/.test(navigator.vendor),xo=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),wo=/PhantomJS/.test(navigator.userAgent),ko=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),Co=ko||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),So=ko||/Mac/.test(navigator.platform),Lo=/win/i.test(navigator.platform),Mo=yo&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);Mo&&(Mo=Number(Mo[1])),Mo&&Mo>=15&&(yo=!1,mo=!0);var To=So&&(go||yo&&(null==Mo||12.11>Mo)),Ao=co||ho&&po>=9,Oo=!1,No=!1;m.prototype=Di({update:function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=e.scrollWidth-e.clientWidth+o+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedOverlay&&e.clientHeight>0&&(0==r&&this.overlayHack(),this.checkedOverlay=!0),{right:n?r:0,bottom:t?r:0}},setScrollLeft:function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e)},setScrollTop:function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e)},overlayHack:function(){var e=So&&!xo?"12px":"18px";this.horiz.style.minHeight=this.vert.style.minWidth=e;var t=this,n=function(e){vi(e)!=t.vert&&vi(e)!=t.horiz&&At(t.cm,Vt)(e)};Ca(this.vert,"mousedown",n),Ca(this.horiz,"mousedown",n)},clear:function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)}},m.prototype),g.prototype=Di({update:function(){return{bottom:0,right:0}},setScrollLeft:function(){},setScrollTop:function(){},clear:function(){}},g.prototype),e.scrollbarModel={"native":m,"null":g},L.prototype.signal=function(e,t){Ci(e,t)&&this.events.push(arguments)},L.prototype.finish=function(){for(var e=0;e<this.events.length;e++)La.apply(null,this.events[e])};var Po=e.Pos=function(e,t){return this instanceof Po?(this.line=e,void(this.ch=t)):new Po(e,t)},zo=e.cmpPos=function(e,t){return e.line-t.line||e.ch-t.ch},Do=null;ne.prototype=Di({init:function(e){function t(e){if(r.somethingSelected())Do=r.getSelections(),n.inaccurateSelection&&(n.prevInput="",n.inaccurateSelection=!1,o.value=Do.join("\n"),Wa(o));else{if(!r.options.lineWiseCopyCut)return;var t=ee(r);Do=t.text,"cut"==e.type?r.setSelections(t.ranges,null,Oa):(n.prevInput="",o.value=t.text.join("\n"),Wa(o))}"cut"==e.type&&(r.state.cutIncoming=!0)}var n=this,r=this.cm,i=this.wrapper=re(),o=this.textarea=i.firstChild;e.wrapper.insertBefore(i,e.wrapper.firstChild),ko&&(o.style.width="0px"),Ca(o,"input",function(){ho&&po>=9&&n.hasSelection&&(n.hasSelection=null),n.poll()}),Ca(o,"paste",function(){if(mo&&!r.state.fakedLastChar&&!(new Date-r.state.lastMiddleDown<200)){var e=o.selectionStart,t=o.selectionEnd;o.value+="$",o.selectionEnd=t,o.selectionStart=e,r.state.fakedLastChar=!0}r.state.pasteIncoming=!0,n.fastPoll()}),Ca(o,"cut",t),Ca(o,"copy",t),Ca(e.scroller,"paste",function(t){qt(e,t)||(r.state.pasteIncoming=!0,n.focus())}),Ca(e.lineSpace,"selectstart",function(t){qt(e,t)||xa(t)}),Ca(o,"compositionstart",function(){var e=r.getCursor("from");n.composing={start:e,range:r.markText(e,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Ca(o,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},prepareSelection:function(){var e=this.cm,t=e.display,n=e.doc,r=De(e);if(e.options.moveInputWithCursor){var i=ft(e,n.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+a.top-o.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+a.left-o.left))}return r},showSelection:function(e){var t=this.cm,n=t.display;ji(n.cursorDiv,e.cursors),ji(n.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},reset:function(e){if(!this.contextMenuPending){var t,n,r=this.cm,i=r.doc;if(r.somethingSelected()){this.prevInput="";var o=i.sel.primary();t=$a&&(o.to().line-o.from().line>100||(n=r.getSelection()).length>1e3);var a=t?"-":n||r.getSelection();this.textarea.value=a,r.state.focused&&Wa(this.textarea),ho&&po>=9&&(this.hasSelection=a)}else e||(this.prevInput=this.textarea.value="",ho&&po>=9&&(this.hasSelection=null));this.inaccurateSelection=t; -}},getField:function(){return this.textarea},supportsTouch:function(){return!1},focus:function(){if("nocursor"!=this.cm.options.readOnly&&(!Co||Bi()!=this.textarea))try{this.textarea.focus()}catch(e){}},blur:function(){this.textarea.blur()},resetPosition:function(){this.wrapper.style.top=this.wrapper.style.left=0},receivedFocus:function(){this.slowPoll()},slowPoll:function(){var e=this;e.pollingFast||e.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},fastPoll:function(){function e(){var n=r.poll();n||t?(r.pollingFast=!1,r.slowPoll()):(t=!0,r.polling.set(60,e))}var t=!1,r=this;r.pollingFast=!0,r.polling.set(20,e)},poll:function(){var e=this.cm,t=this.textarea,r=this.prevInput;if(!e.state.focused||Ka(t)&&!r||Q(e)||e.options.disableInput||e.state.keySeq)return!1;e.state.pasteIncoming&&e.state.fakedLastChar&&(t.value=t.value.substring(0,t.value.length-1),e.state.fakedLastChar=!1);var n=t.value;if(n==r&&!e.somethingSelected())return!1;if(ho&&po>=9&&this.hasSelection===n||So&&/[\uf700-\uf7ff]/.test(n))return e.display.input.reset(),!1;if(e.doc.sel==e.display.selForContextMenu){var i=n.charCodeAt(0);if(8203!=i||r||(r=""),8666==i)return this.reset(),this.cm.execCommand("undo")}for(var o=0,a=Math.min(r.length,n.length);a>o&&r.charCodeAt(o)==n.charCodeAt(o);)++o;var l=this;return Tt(e,function(){J(e,n.slice(o),r.length-o,null,l.composing?"*compose":null),n.length>1e3||n.indexOf("\n")>-1?t.value=l.prevInput="":l.prevInput=n,l.composing&&(l.composing.range.clear(),l.composing.range=e.markText(l.composing.start,e.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},ensurePolled:function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},onKeyPress:function(){ho&&po>=9&&(this.hasSelection=null),this.fastPoll()},onContextMenu:function(e){function t(){if(null!=a.selectionStart){var e=i.somethingSelected(),t=""+(e?a.value:"");a.value="⇚",a.value=t,n.prevInput=e?"":"",a.selectionStart=1,a.selectionEnd=t.length,o.selForContextMenu=i.doc.sel}}function r(){if(n.contextMenuPending=!1,n.wrapper.style.position="relative",a.style.cssText=u,ho&&9>po&&o.scrollbars.setScrollTop(o.scroller.scrollTop=s),null!=a.selectionStart){(!ho||ho&&9>po)&&t();var e=0,r=function(){o.selForContextMenu==i.doc.sel&&0==a.selectionStart&&a.selectionEnd>0&&""==n.prevInput?At(i,na.selectAll)(i):e++<10?o.detectingSelectAll=setTimeout(r,500):o.input.reset()};o.detectingSelectAll=setTimeout(r,200)}}var n=this,i=n.cm,o=i.display,a=n.textarea,l=Ut(i,e),s=o.scroller.scrollTop;if(l&&!yo){var c=i.options.resetSelectionOnContextMenu;c&&-1==i.doc.sel.contains(l)&&At(i,Me)(i.doc,he(l),Oa);var u=a.style.cssText;if(n.wrapper.style.position="absolute",a.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(e.clientY-5)+"px; left: "+(e.clientX-5)+"px; z-index: 1000; background: "+(ho?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",mo)var d=window.scrollY;if(o.input.focus(),mo&&window.scrollTo(null,d),o.input.reset(),i.somethingSelected()||(a.value=n.prevInput=" "),n.contextMenuPending=!0,o.selForContextMenu=i.doc.sel,clearTimeout(o.detectingSelectAll),ho&&po>=9&&t(),Ao){ka(e);var f=function(){Sa(window,"mouseup",f),setTimeout(r,20)};Ca(window,"mouseup",f)}else setTimeout(r,50)}},setUneditable:Ni,needsContentAttribute:!1},re.prototype),ie.prototype=Di({init:function(e){function t(e){if(n.somethingSelected())Do=n.getSelections(),"cut"==e.type&&n.replaceSelection("",null,"cut");else{if(!n.options.lineWiseCopyCut)return;var t=ee(n);Do=t.text,"cut"==e.type&&n.operation(function(){n.setSelections(t.ranges,0,Oa),n.replaceSelection("",null,"cut")})}if(e.clipboardData&&!ko)e.preventDefault(),e.clipboardData.clearData(),e.clipboardData.setData("text/plain",Do.join("\n"));else{var r=ne(),i=r.firstChild;n.display.lineSpace.insertBefore(r,n.display.lineSpace.firstChild),i.value=Do.join("\n");var o=document.activeElement;Wa(i),setTimeout(function(){n.display.lineSpace.removeChild(r),o.focus()},50)}}var r=this,n=r.cm,i=r.div=e.lineDiv;i.contentEditable="true",te(i),Ca(i,"paste",function(e){var t=e.clipboardData&&e.clipboardData.getData("text/plain");t&&(e.preventDefault(),n.replaceSelection(t,null,"paste"))}),Ca(i,"compositionstart",function(e){var t=e.data;if(r.composing={sel:n.doc.sel,data:t,startData:t},t){var i=n.doc.sel.primary(),o=n.getLine(i.head.line),a=o.indexOf(t,Math.max(0,i.head.ch-t.length));a>-1&&a<=i.head.ch&&(r.composing.sel=he(No(i.head.line,a),No(i.head.line,a+t.length)))}}),Ca(i,"compositionupdate",function(e){r.composing.data=e.data}),Ca(i,"compositionend",function(e){var t=r.composing;t&&(e.data==t.startData||/\u200b/.test(e.data)||(t.data=e.data),setTimeout(function(){t.handled||r.applyComposition(t),r.composing==t&&(r.composing=null)},50))}),Ca(i,"touchstart",function(){r.forceCompositionEnd()}),Ca(i,"input",function(){r.composing||r.pollContent()||Tt(r.cm,function(){Dt(n)})}),Ca(i,"copy",t),Ca(i,"cut",t)},prepareSelection:function(){var e=De(this.cm,!1);return e.focus=this.cm.state.focused,e},showSelection:function(e){e&&this.cm.display.view.length&&(e.focus&&this.showPrimarySelection(),this.showMultipleSelections(e))},showPrimarySelection:function(){var e=window.getSelection(),t=this.cm.doc.sel.primary(),r=le(this.cm,e.anchorNode,e.anchorOffset),n=le(this.cm,e.focusNode,e.focusOffset);if(!r||r.bad||!n||n.bad||0!=Po(Y(r,n),t.from())||0!=Po(X(r,n),t.to())){var i=oe(this.cm,t.from()),o=oe(this.cm,t.to());if(i||o){var a=this.cm.display.view,l=e.rangeCount&&e.getRangeAt(0);if(i){if(!o){var s=a[a.length-1].measure,c=s.maps?s.maps[s.maps.length-1]:s.map;o={node:c[c.length-1],offset:c[c.length-2]-c[c.length-3]}}}else i={node:a[0].measure.map[2],offset:0};try{var u=Ia(i.node,i.offset,o.offset,o.node)}catch(d){}u&&(e.removeAllRanges(),e.addRange(u),l&&null==e.anchorNode?e.addRange(l):co&&this.startGracePeriod()),this.rememberSelection()}}},startGracePeriod:function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){e.cm.curOp.selectionChanged=!0})},20)},showMultipleSelections:function(e){ji(this.cm.display.cursorDiv,e.cursors),ji(this.cm.display.selectionDiv,e.selection)},rememberSelection:function(){var e=window.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},selectionInEditor:function(){var e=window.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return _a(this.div,t)},focus:function(){"nocursor"!=this.cm.options.readOnly&&this.div.focus()},blur:function(){this.div.blur()},getField:function(){return this.div},supportsTouch:function(){return!0},receivedFocus:function(){function e(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,e))}var t=this;this.selectionInEditor()?this.pollSelection():Tt(this.cm,function(){t.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,e)},selectionChanged:function(){var e=window.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},pollSelection:function(){if(!this.composing&&!this.gracePeriod&&this.selectionChanged()){var e=window.getSelection(),t=this.cm;this.rememberSelection();var r=le(t,e.anchorNode,e.anchorOffset),n=le(t,e.focusNode,e.focusOffset);r&&n&&Tt(t,function(){Me(t.doc,he(r,n),Oa),(r.bad||n.bad)&&(t.curOp.selectionChanged=!0)})}},pollContent:function(){var e=this.cm,t=e.display,r=e.doc.sel.primary(),n=r.from(),i=r.to();if(n.line<t.viewFrom||i.line>t.viewTo-1)return!1;var o;if(n.line==t.viewFrom||0==(o=Et(e,n.line)))var a=Zn(t.view[0].line),l=t.view[0].node;else var a=Zn(t.view[o].line),l=t.view[o-1].node.nextSibling;var s=Et(e,i.line);if(s==t.view.length-1)var c=t.viewTo-1,u=t.view[s].node;else var c=Zn(t.view[s+1].line)-1,u=t.view[s+1].node.previousSibling;for(var d=Ga(ce(e,l,u,a,c)),f=$n(e.doc,No(a,0),No(c,Kn(e.doc,c).text.length));d.length>1&&f.length>1;)if(Ai(d)==Ai(f))d.pop(),f.pop(),c--;else{if(d[0]!=f[0])break;d.shift(),f.shift(),a++}for(var h=0,p=0,m=d[0],g=f[0],v=Math.min(m.length,g.length);v>h&&m.charCodeAt(h)==g.charCodeAt(h);)++h;for(var y=Ai(d),b=Ai(f),x=Math.min(y.length-(1==d.length?h:0),b.length-(1==f.length?h:0));x>p&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)++p;d[d.length-1]=y.slice(0,y.length-p),d[0]=d[0].slice(h);var w=No(a,h),k=No(c,f.length?Ai(f).length-p:0);return d.length>1||d[0]||Po(w,k)?(Tr(e.doc,d,w,k,"+input"),!0):void 0},ensurePolled:function(){this.forceCompositionEnd()},reset:function(){this.forceCompositionEnd()},forceCompositionEnd:function(){this.composing&&!this.composing.handled&&(this.applyComposition(this.composing),this.composing.handled=!0,this.div.blur(),this.div.focus())},applyComposition:function(e){e.data&&e.data!=e.startData&&At(this.cm,J)(this.cm,e.data,0,e.sel)},setUneditable:function(e){e.setAttribute("contenteditable","false")},onKeyPress:function(e){e.preventDefault(),At(this.cm,J)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0)},onContextMenu:Ni,resetPosition:Ni,needsContentAttribute:!0},ie.prototype),e.inputStyles={textarea:re,contenteditable:ie},ue.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var r=this.ranges[t],n=e.ranges[t];if(0!=Po(r.anchor,n.anchor)||0!=Po(r.head,n.head))return!1}return!0},deepCopy:function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new de(K(this.ranges[t].anchor),K(this.ranges[t].head));return new ue(e,this.primIndex)},somethingSelected:function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},contains:function(e,t){t||(t=e);for(var r=0;r<this.ranges.length;r++){var n=this.ranges[r];if(Po(t,n.from())>=0&&Po(e,n.to())<=0)return r}return-1}},de.prototype={from:function(){return Y(this.anchor,this.head)},to:function(){return X(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var Wo,Io,Eo,Fo={left:0,right:0,top:0,bottom:0},Ho=null,_o=0,jo=0,Bo=0,qo=null;ho?qo=-.53:co?qo=15:vo?qo=-.7:bo&&(qo=-1/3);var Ro=function(e){var t=e.wheelDeltaX,r=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==r&&e.detail&&e.axis==e.VERTICAL_AXIS?r=e.detail:null==r&&(r=e.wheelDelta),{x:t,y:r}};e.wheelEventPixels=function(e){var t=Ro(e);return t.x*=qo,t.y*=qo,t};var Uo=new Li,Vo=null,Go=e.changeEnd=function(e){return e.text?No(e.from.line+e.text.length-1,Ai(e.text).length+(1==e.text.length?e.from.ch:0)):e.to};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,t){var r=this.options,n=r[e];(r[e]!=t||"mode"==e)&&(r[e]=t,$o.hasOwnProperty(e)&&At(this,$o[e])(this,t,n))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](qr(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,r=0;r<t.length;++r)if(t[r]==e||t[r].name==e)return t.splice(r,1),!0},addOverlay:Ot(function(t,r){var n=t.token?t:e.getMode(this.options,t);if(n.startState)throw new Error("Overlays may not be stateful.");this.state.overlays.push({mode:n,modeSpec:t,opaque:r&&r.opaque}),this.state.modeGen++,Dt(this)}),removeOverlay:Ot(function(e){for(var t=this.state.overlays,r=0;r<t.length;++r){var n=t[r].modeSpec;if(n==e||"string"==typeof e&&n.name==e)return t.splice(r,1),this.state.modeGen++,void Dt(this)}}),indentLine:Ot(function(e,t,r){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),ve(this.doc,e)&&Ir(this,e,t,r)}),indentSelection:Ot(function(e){for(var t=this.doc.sel.ranges,r=-1,n=0;n<t.length;n++){var i=t[n];if(i.empty())i.head.line>r&&(Ir(this,i.head.line,e,!0),r=i.head.line,n==this.doc.sel.primIndex&&Dr(this));else{var o=i.from(),a=i.to(),l=Math.max(r,o.line);r=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1;for(var s=l;r>s;++s)Ir(this,s,e);var c=this.doc.sel.ranges;0==o.ch&&t.length==c.length&&c[n].from().ch>0&&ke(this.doc,n,new de(o,c[n].to()),Oa)}}}),getTokenAt:function(e,t){return An(this,e,t)},getLineTokens:function(e,t){return An(this,No(e),t,!0)},getTokenTypeAt:function(e){e=me(this.doc,e);var t,r=Nn(this,Kn(this.doc,e.line)),n=0,i=(r.length-1)/2,o=e.ch;if(0==o)t=r[2];else for(;;){var a=n+i>>1;if((a?r[2*a-1]:0)>=o)i=a;else{if(!(r[2*a+1]<o)){t=r[2*a+2];break}n=a+1}}var l=t?t.indexOf("cm-overlay "):-1;return 0>l?t:0==l?null:t.slice(0,l-1)},getModeAt:function(t){var r=this.doc.mode;return r.innerMode?e.innerMode(r,this.getTokenAt(t).state).mode:r},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var r=[];if(!ea.hasOwnProperty(t))return r;var n=ea[t],i=this.getModeAt(e);if("string"==typeof i[t])n[i[t]]&&r.push(n[i[t]]);else if(i[t])for(var o=0;o<i[t].length;o++){var a=n[i[t][o]];a&&r.push(a)}else i.helperType&&n[i.helperType]?r.push(n[i.helperType]):n[i.name]&&r.push(n[i.name]);for(var o=0;o<n._global.length;o++){var l=n._global[o];l.pred(i,this)&&-1==Oi(r,l.val)&&r.push(l.val)}return r},getStateAfter:function(e,t){var r=this.doc;return e=pe(r,null==e?r.first+r.size-1:e),je(this,e+1,t)},cursorCoords:function(e,t){var r,n=this.doc.sel.primary();return r=null==e?n.head:"object"==typeof e?me(this.doc,e):e?n.from():n.to(),dt(this,r,t||"page")},charCoords:function(e,t){return ut(this,me(this.doc,e),t||"page")},coordsChar:function(e,t){return e=ct(this,e,t||"page"),pt(this,e.left,e.top)},lineAtHeight:function(e,t){return e=ct(this,{top:e,left:0},t||"page").top,Qn(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t){var r,n=!1;if("number"==typeof e){var i=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:e>i&&(e=i,n=!0),r=Kn(this.doc,e)}else r=e;return st(this,r,{top:0,left:0},t||"page").top+(n?this.doc.height-Jn(r):0)},defaultTextHeight:function(){return gt(this.display)},defaultCharWidth:function(){return vt(this.display)},setGutterMarker:Ot(function(e,t,r){return Er(this.doc,e,"gutter",function(e){var n=e.gutterMarkers||(e.gutterMarkers={});return n[t]=r,!r&&Ei(n)&&(e.gutterMarkers=null),!0})}),clearGutter:Ot(function(e){var t=this,r=t.doc,n=r.first;r.iter(function(r){r.gutterMarkers&&r.gutterMarkers[e]&&(r.gutterMarkers[e]=null,Wt(t,n,"gutter"),Ei(r.gutterMarkers)&&(r.gutterMarkers=null)),++n})}),lineInfo:function(e){if("number"==typeof e){if(!ve(this.doc,e))return null;var t=e;if(e=Kn(this.doc,e),!e)return null}else{var t=Zn(e);if(null==t)return null}return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,r,n,i){var o=this.display;e=dt(this,me(this.doc,e));var a=e.bottom,l=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),o.sizer.appendChild(t),"over"==n)a=e.top;else if("above"==n||"near"==n){var s=Math.max(o.wrapper.clientHeight,this.doc.height),c=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==n||e.bottom+t.offsetHeight>s)&&e.top>t.offsetHeight?a=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=s&&(a=e.bottom),l+t.offsetWidth>c&&(l=c-t.offsetWidth)}t.style.top=a+"px",t.style.left=t.style.right="","right"==i?(l=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?l=0:"middle"==i&&(l=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=l+"px"),r&&zr(this,l,a,l+t.offsetWidth,a+t.offsetHeight)},triggerOnKeyDown:Ot(lr),triggerOnKeyPress:Ot(ur),triggerOnKeyUp:cr,execCommand:function(e){return na.hasOwnProperty(e)?na[e](this):void 0},findPosH:function(e,t,r,n){var i=1;0>t&&(i=-1,t=-t);for(var o=0,a=me(this.doc,e);t>o&&(a=Hr(this.doc,a,i,r,n),!a.hitSide);++o);return a},moveH:Ot(function(e,t){var r=this;r.extendSelectionsBy(function(n){return r.display.shift||r.doc.extend||n.empty()?Hr(r.doc,n.head,e,t,r.options.rtlMoveVisually):0>e?n.from():n.to()},Na)}),deleteH:Ot(function(e,t){var r=this.doc.sel,n=this.doc;r.somethingSelected()?n.replaceSelection("",null,"+delete"):Fr(this,function(r){var i=Hr(n,r.head,e,t,!1);return 0>e?{from:i,to:r.head}:{from:r.head,to:i}})}),findPosV:function(e,t,r,n){var i=1,o=n;0>t&&(i=-1,t=-t);for(var a=0,l=me(this.doc,e);t>a;++a){var s=dt(this,l,"div");if(null==o?o=s.left:s.left=o,l=_r(this,s,i,r),l.hitSide)break}return l},moveV:Ot(function(e,t){var r=this,n=this.doc,i=[],o=!r.display.shift&&!n.extend&&n.sel.somethingSelected();if(n.extendSelectionsBy(function(a){if(o)return 0>e?a.from():a.to();var l=dt(r,a.head,"div");null!=a.goalColumn&&(l.left=a.goalColumn),i.push(l.left);var s=_r(r,l,e,t);return"page"==t&&a==n.sel.primary()&&Pr(r,null,ut(r,s,"div").top-l.top),s},Na),i.length)for(var a=0;a<n.sel.ranges.length;a++)n.sel.ranges[a].goalColumn=i[a]}),findWordAt:function(e){var t=this.doc,r=Kn(t,e.line).text,n=e.ch,i=e.ch;if(r){var o=this.getHelper(e,"wordChars");(e.xRel<0||i==r.length)&&n?--n:++i;for(var a=r.charAt(n),l=Ii(a,o)?function(e){return Ii(e,o)}:/\s/.test(a)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!Ii(e)};n>0&&l(r.charAt(n-1));)--n;for(;i<r.length&&l(r.charAt(i));)++i}return new de(No(e.line,n),No(e.line,i))},toggleOverwrite:function(e){(null==e||e!=this.state.overwrite)&&((this.state.overwrite=!this.state.overwrite)?Ra(this.display.cursorDiv,"CodeMirror-overwrite"):qa(this.display.cursorDiv,"CodeMirror-overwrite"),La(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==Bi()},scrollTo:Ot(function(e,t){(null!=e||null!=t)&&Wr(this),null!=e&&(this.curOp.scrollLeft=e),null!=t&&(this.curOp.scrollTop=t)}),getScrollInfo:function(){var e=this.display.scroller;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-Ue(this)-this.display.barHeight,width:e.scrollWidth-Ue(this)-this.display.barWidth,clientHeight:Ge(this),clientWidth:Ve(this)}},scrollIntoView:Ot(function(e,t){if(null==e?(e={from:this.doc.sel.primary().head,to:null},null==t&&(t=this.options.cursorScrollMargin)):"number"==typeof e?e={from:No(e,0),to:null}:null==e.from&&(e={from:e,to:null}),e.to||(e.to=e.from),e.margin=t||0,null!=e.from.line)Wr(this),this.curOp.scrollToPos=e;else{var r=Nr(this,Math.min(e.from.left,e.to.left),Math.min(e.from.top,e.to.top)-e.margin,Math.max(e.from.right,e.to.right),Math.max(e.from.bottom,e.to.bottom)+e.margin);this.scrollTo(r.scrollLeft,r.scrollTop)}}),setSize:Ot(function(e,t){function r(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e}var n=this;null!=e&&(n.display.wrapper.style.width=r(e)),null!=t&&(n.display.wrapper.style.height=r(t)),n.options.lineWrapping&&it(this);var i=n.display.viewFrom;n.doc.iter(i,n.display.viewTo,function(e){if(e.widgets)for(var t=0;t<e.widgets.length;t++)if(e.widgets[t].noHScroll){Wt(n,i,"widget");break}++i}),n.curOp.forceUpdate=!0,La(n,"refresh",this)}),operation:function(e){return Tt(this,e)},refresh:Ot(function(){var e=this.display.cachedTextHeight;Dt(this),this.curOp.forceUpdate=!0,ot(this),this.scrollTo(this.doc.scrollLeft,this.doc.scrollTop),u(this),(null==e||Math.abs(e-gt(this.display))>.5)&&a(this),La(this,"refresh",this)}),swapDoc:Ot(function(e){var t=this.doc;return t.cm=null,Gn(this,e),ot(this),this.display.input.reset(),this.scrollTo(e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,bi(this,"swapDoc",this,t),t}),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Si(e);var Ko=e.defaults={},$o=e.optionHandlers={},Xo=e.Init={toString:function(){return"CodeMirror.Init"}};jr("value","",function(e,t){e.setValue(t)},!0),jr("mode",null,function(e,t){e.doc.modeOption=t,r(e)},!0),jr("indentUnit",2,r,!0),jr("indentWithTabs",!1),jr("smartIndent",!0),jr("tabSize",4,function(e){n(e),ot(e),Dt(e)},!0),jr("specialChars",/[\t\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,function(t,r,n){t.state.specialChars=new RegExp(r.source+(r.test(" ")?"":"| "),"g"),n!=e.Init&&t.refresh()}),jr("specialCharPlaceholder",In,function(e){e.refresh()},!0),jr("electricChars",!0),jr("inputStyle",Co?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),jr("rtlMoveVisually",!Lo),jr("wholeLineUpdateBefore",!0),jr("theme","default",function(e){l(e),s(e)},!0),jr("keyMap","default",function(t,r,n){var i=qr(r),o=n!=e.Init&&qr(n);o&&o.detach&&o.detach(t,i),i.attach&&i.attach(t,o||null)}),jr("extraKeys",null),jr("lineWrapping",!1,i,!0),jr("gutters",[],function(e){h(e.options),s(e)},!0),jr("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?S(e.display)+"px":"0",e.refresh()},!0),jr("coverGutterNextToScrollbar",!1,function(e){y(e)},!0),jr("scrollbarStyle","native",function(e){v(e),y(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),jr("lineNumbers",!1,function(e){h(e.options),s(e)},!0),jr("firstLineNumber",1,s,!0),jr("lineNumberFormatter",function(e){return e},s,!0),jr("showCursorWhenSelecting",!1,Pe,!0),jr("resetSelectionOnContextMenu",!0),jr("lineWiseCopyCut",!0),jr("readOnly",!1,function(e,t){"nocursor"==t?(hr(e),e.display.input.blur(),e.display.disabled=!0):(e.display.disabled=!1,t||e.display.input.reset())}),jr("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),jr("dragDrop",!0,Bt),jr("cursorBlinkRate",530),jr("cursorScrollMargin",0),jr("cursorHeight",1,Pe,!0),jr("singleCursorHeightPerLine",!0,Pe,!0),jr("workTime",100),jr("workDelay",100),jr("flattenSpans",!0,n,!0),jr("addModeClass",!1,n,!0),jr("pollInterval",100),jr("undoDepth",200,function(e,t){e.doc.history.undoDepth=t}),jr("historyEventDelay",1250),jr("viewportMargin",10,function(e){e.refresh()},!0),jr("maxHighlightLength",1e4,n,!0),jr("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),jr("tabindex",null,function(e,t){e.display.input.getField().tabIndex=t||""}),jr("autofocus",null);var Yo=e.modes={},Zo=e.mimeModes={};e.defineMode=function(t,r){e.defaults.mode||"null"==t||(e.defaults.mode=t),arguments.length>2&&(r.dependencies=Array.prototype.slice.call(arguments,2)),Yo[t]=r},e.defineMIME=function(e,t){Zo[e]=t},e.resolveMode=function(t){if("string"==typeof t&&Zo.hasOwnProperty(t))t=Zo[t];else if(t&&"string"==typeof t.name&&Zo.hasOwnProperty(t.name)){var r=Zo[t.name];"string"==typeof r&&(r={name:r}),t=Pi(r,t),t.name=r.name}else if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return e.resolveMode("application/xml");return"string"==typeof t?{name:t}:t||{name:"null"}},e.getMode=function(t,r){var r=e.resolveMode(r),n=Yo[r.name];if(!n)return e.getMode(t,"text/plain");var i=n(t,r);if(Qo.hasOwnProperty(r.name)){var o=Qo[r.name];for(var a in o)o.hasOwnProperty(a)&&(i.hasOwnProperty(a)&&(i["_"+a]=i[a]),i[a]=o[a])}if(i.name=r.name,r.helperType&&(i.helperType=r.helperType),r.modeProps)for(var a in r.modeProps)i[a]=r.modeProps[a];return i},e.defineMode("null",function(){return{token:function(e){e.skipToEnd()}}}),e.defineMIME("text/plain","null");var Qo=e.modeExtensions={};e.extendMode=function(e,t){var r=Qo.hasOwnProperty(e)?Qo[e]:Qo[e]={};Di(t,r)},e.defineExtension=function(t,r){e.prototype[t]=r},e.defineDocExtension=function(e,t){va.prototype[e]=t},e.defineOption=jr;var Jo=[];e.defineInitHook=function(e){Jo.push(e)};var ea=e.helpers={};e.registerHelper=function(t,r,n){ea.hasOwnProperty(t)||(ea[t]=e[t]={_global:[]}),ea[t][r]=n},e.registerGlobalHelper=function(t,r,n,i){e.registerHelper(t,r,i),ea[t]._global.push({pred:n,val:i})};var ta=e.copyState=function(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var r={};for(var n in t){var i=t[n];i instanceof Array&&(i=i.concat([])),r[n]=i}return r},ra=e.startState=function(e,t,r){return e.startState?e.startState(t,r):!0};e.innerMode=function(e,t){for(;e.innerMode;){var r=e.innerMode(t);if(!r||r.mode==e)break;t=r.state,e=r.mode}return r||{mode:e,state:t}};var na=e.commands={selectAll:function(e){e.setSelection(No(e.firstLine(),0),No(e.lastLine()),Oa)},singleSelection:function(e){e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Oa)},killLine:function(e){Fr(e,function(t){if(t.empty()){var r=Kn(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line<e.lastLine()?{from:t.head,to:No(t.head.line+1,0)}:{from:t.head,to:No(t.head.line,r)}}return{from:t.from(),to:t.to()}})},deleteLine:function(e){Fr(e,function(t){return{from:No(t.from().line,0),to:me(e.doc,No(t.to().line+1,0))}})},delLineLeft:function(e){Fr(e,function(e){return{from:No(e.from().line,0),to:e.from()}})},delWrappedLineLeft:function(e){Fr(e,function(t){var r=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:0,top:r},"div");return{from:n,to:t.from()}})},delWrappedLineRight:function(e){Fr(e,function(t){var r=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div");return{from:t.from(),to:n}})},undo:function(e){e.undo()},redo:function(e){e.redo()},undoSelection:function(e){e.undoSelection()},redoSelection:function(e){e.redoSelection()},goDocStart:function(e){e.extendSelection(No(e.firstLine(),0))},goDocEnd:function(e){e.extendSelection(No(e.lastLine()))},goLineStart:function(e){e.extendSelectionsBy(function(t){return to(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){e.extendSelectionsBy(function(t){return no(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){e.extendSelectionsBy(function(t){return ro(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){e.extendSelectionsBy(function(t){var r=e.charCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div")},Na)},goLineLeft:function(e){e.extendSelectionsBy(function(t){var r=e.charCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:r},"div")},Na)},goLineLeftSmart:function(e){e.extendSelectionsBy(function(t){var r=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:0,top:r},"div");return n.ch<e.getLine(n.line).search(/\S/)?no(e,t.head):n},Na)},goLineUp:function(e){e.moveV(-1,"line")},goLineDown:function(e){e.moveV(1,"line")},goPageUp:function(e){e.moveV(-1,"page")},goPageDown:function(e){e.moveV(1,"page")},goCharLeft:function(e){e.moveH(-1,"char")},goCharRight:function(e){e.moveH(1,"char")},goColumnLeft:function(e){e.moveH(-1,"column")},goColumnRight:function(e){e.moveH(1,"column")},goWordLeft:function(e){e.moveH(-1,"word")},goGroupRight:function(e){e.moveH(1,"group")},goGroupLeft:function(e){e.moveH(-1,"group")},goWordRight:function(e){e.moveH(1,"word")},delCharBefore:function(e){e.deleteH(-1,"char")},delCharAfter:function(e){e.deleteH(1,"char")},delWordBefore:function(e){e.deleteH(-1,"word")},delWordAfter:function(e){e.deleteH(1,"word")},delGroupBefore:function(e){e.deleteH(-1,"group")},delGroupAfter:function(e){e.deleteH(1,"group")},indentAuto:function(e){e.indentSelection("smart")},indentMore:function(e){e.indentSelection("add")},indentLess:function(e){e.indentSelection("subtract")},insertTab:function(e){e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],r=e.listSelections(),n=e.options.tabSize,i=0;i<r.length;i++){var o=r[i].from(),a=Pa(e.getLine(o.line),o.ch,n);t.push(new Array(n-a%n+1).join(" "))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){Tt(e,function(){for(var t=e.listSelections(),r=[],n=0;n<t.length;n++){var i=t[n].head,o=Kn(e.doc,i.line).text;if(o)if(i.ch==o.length&&(i=new No(i.line,i.ch-1)),i.ch>0)i=new No(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),No(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var a=Kn(e.doc,i.line-1).text;a&&e.replaceRange(o.charAt(0)+"\n"+a.charAt(a.length-1),No(i.line-1,a.length-1),No(i.line,1),"+transpose")}r.push(new de(i,i))}e.setSelections(r)})},newlineAndIndent:function(e){Tt(e,function(){for(var t=e.listSelections().length,r=0;t>r;r++){var n=e.listSelections()[r];e.replaceRange("\n",n.anchor,n.head,"+input"),e.indentLine(n.from().line+1,null,!0),Dr(e)}})},toggleOverwrite:function(e){e.toggleOverwrite()}},ia=e.keyMap={};ia.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},ia.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},ia.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"},ia.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},ia["default"]=So?ia.macDefault:ia.pcDefault,e.normalizeKeyMap=function(e){var t={};for(var r in e)if(e.hasOwnProperty(r)){var n=e[r];if(/^(name|fallthrough|(de|at)tach)$/.test(r))continue;if("..."==n){delete e[r];continue}for(var i=zi(r.split(" "),Br),o=0;o<i.length;o++){var a,l;o==i.length-1?(l=r,a=n):(l=i.slice(0,o+1).join(" "),a="...");var s=t[l];if(s){if(s!=a)throw new Error("Inconsistent bindings for "+l)}else t[l]=a}delete e[r]}for(var c in t)e[c]=t[c];return e};var oa=e.lookupKey=function(e,t,r,n){t=qr(t);var i=t.call?t.call(e,n):t[e];if(i===!1)return"nothing";if("..."===i)return"multi";if(null!=i&&r(i))return"handled";if(t.fallthrough){if("[object Array]"!=Object.prototype.toString.call(t.fallthrough))return oa(e,t.fallthrough,r,n);for(var o=0;o<t.fallthrough.length;o++){var a=oa(e,t.fallthrough[o],r,n);if(a)return a}}},aa=e.isModifierKey=function(e){var t="string"==typeof e?e:Ya[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t},la=e.keyName=function(e,t){if(yo&&34==e.keyCode&&e["char"])return!1;var r=Ya[e.keyCode],n=r;return null==n||e.altGraphKey?!1:(e.altKey&&"Alt"!=r&&(n="Alt-"+n),(To?e.metaKey:e.ctrlKey)&&"Ctrl"!=r&&(n="Ctrl-"+n),(To?e.ctrlKey:e.metaKey)&&"Cmd"!=r&&(n="Cmd-"+n),!t&&e.shiftKey&&"Shift"!=r&&(n="Shift-"+n),n)};e.fromTextArea=function(t,r){ -function n(){t.value=c.getValue()}if(r=r?Di(r):{},r.value=t.value,!r.tabindex&&t.tabIndex&&(r.tabindex=t.tabIndex),!r.placeholder&&t.placeholder&&(r.placeholder=t.placeholder),null==r.autofocus){var i=Bi();r.autofocus=i==t||null!=t.getAttribute("autofocus")&&i==document.body}if(t.form&&(Ca(t.form,"submit",n),!r.leaveSubmitMethodAlone)){var o=t.form,a=o.submit;try{var l=o.submit=function(){n(),o.submit=a,o.submit(),o.submit=l}}catch(s){}}r.finishInit=function(e){e.save=n,e.getTextArea=function(){return t},e.toTextArea=function(){e.toTextArea=isNaN,n(),t.parentNode.removeChild(e.getWrapperElement()),t.style.display="",t.form&&(Sa(t.form,"submit",n),"function"==typeof t.form.submit&&(t.form.submit=a))}},t.style.display="none";var c=e(function(e){t.parentNode.insertBefore(e,t.nextSibling)},r);return c};var sa=e.StringStream=function(e,t){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0};sa.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==this.lineStart},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(e){var t=this.string.charAt(this.pos);if("string"==typeof e)var r=t==e;else var r=t&&(e.test?e.test(t):e(t));return r?(++this.pos,t):void 0},eatWhile:function(e){for(var t=this.pos;this.eat(e););return this.pos>t},eatSpace:function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},skipToEnd:function(){this.pos=this.string.length},skipTo:function(e){var t=this.string.indexOf(e,this.pos);return t>-1?(this.pos=t,!0):void 0},backUp:function(e){this.pos-=e},column:function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Pa(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?Pa(this.string,this.lineStart,this.tabSize):0)},indentation:function(){return Pa(this.string,null,this.tabSize)-(this.lineStart?Pa(this.string,this.lineStart,this.tabSize):0)},match:function(e,t,r){if("string"!=typeof e){var n=this.string.slice(this.pos).match(e);return n&&n.index>0?null:(n&&t!==!1&&(this.pos+=n[0].length),n)}var i=function(e){return r?e.toLowerCase():e},o=this.string.substr(this.pos,e.length);return i(o)==i(e)?(t!==!1&&(this.pos+=e.length),!0):void 0},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}}};var ca=0,ua=e.TextMarker=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ca};Si(ua),ua.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&yt(e),Ci(this,"clear")){var r=this.find();r&&bi(this,"clear",r.from,r.to)}for(var n=null,i=null,o=0;o<this.lines.length;++o){var a=this.lines[o],l=Xr(a.markedSpans,this);e&&!this.collapsed?Wt(e,Zn(a),"text"):e&&(null!=l.to&&(i=Zn(a)),null!=l.from&&(n=Zn(a))),a.markedSpans=Yr(a.markedSpans,l),null==l.from&&this.collapsed&&!yn(this.doc,a)&&e&&Yn(a,gt(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var o=0;o<this.lines.length;++o){var s=pn(this.lines[o]),c=d(s);c>e.display.maxLineLength&&(e.display.maxLine=s,e.display.maxLineLength=c,e.display.maxLineChanged=!0)}null!=n&&e&&this.collapsed&&Dt(e,n,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Oe(e.doc)),e&&bi(e,"markerCleared",e,this),t&&xt(e),this.parent&&this.parent.clear()}},ua.prototype.find=function(e,t){null==e&&"bookmark"==this.type&&(e=1);for(var r,n,i=0;i<this.lines.length;++i){var o=this.lines[i],a=Xr(o.markedSpans,this);if(null!=a.from&&(r=No(t?o:Zn(o),a.from),-1==e))return r;if(null!=a.to&&(n=No(t?o:Zn(o),a.to),1==e))return n}return r&&{from:r,to:n}},ua.prototype.changed=function(){var e=this.find(-1,!0),t=this,r=this.doc.cm;e&&r&&Tt(r,function(){var n=e.line,i=Zn(e.line),o=Ze(r,i);if(o&&(nt(o),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!yn(t.doc,n)&&null!=t.height){var a=t.height;t.height=null;var l=wn(t)-a;l&&Yn(n,n.height+l)}})},ua.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=Oi(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},ua.prototype.detachLine=function(e){if(this.lines.splice(Oi(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}};var ca=0,da=e.SharedTextMarker=function(e,t){this.markers=e,this.primary=t;for(var r=0;r<e.length;++r)e[r].parent=this};Si(da),da.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();bi(this,"clear")}},da.prototype.find=function(e,t){return this.primary.find(e,t)};var fa=e.LineWidget=function(e,t,r){if(r)for(var n in r)r.hasOwnProperty(n)&&(this[n]=r[n]);this.doc=e,this.node=t};Si(fa),fa.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,r=this.line,n=Zn(r);if(null!=n&&t){for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(r.widgets=null);var o=wn(this);Yn(r,Math.max(0,r.height-o)),e&&Tt(e,function(){xn(e,r,-o),Wt(e,n,"widget")})}},fa.prototype.changed=function(){var e=this.height,t=this.doc.cm,r=this.line;this.height=null;var n=wn(this)-e;n&&(Yn(r,r.height+n),t&&Tt(t,function(){t.curOp.forceUpdate=!0,xn(t,r,n)}))};var ha=e.Line=function(e,t,r){this.text=e,an(this,t),this.height=r?r(this):1};Si(ha),ha.prototype.lineNo=function(){return Zn(this)};var pa={},ma={};Rn.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var r=e,n=e+t;n>r;++r){var i=this.lines[r];this.height-=i.height,Sn(i),bi(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,r){this.height+=r,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var n=0;n<t.length;++n)t[n].parent=this},iterN:function(e,t,r){for(var n=e+t;n>e;++e)if(r(this.lines[e]))return!0}},Un.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var r=0;r<this.children.length;++r){var n=this.children[r],i=n.chunkSize();if(i>e){var o=Math.min(t,i-e),a=n.height;if(n.removeInner(e,o),this.height-=a-n.height,i==o&&(this.children.splice(r--,1),n.parent=null),0==(t-=o))break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Rn))){var l=[];this.collapse(l),this.children=[new Rn(l)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,r){this.size+=t.length,this.height+=r;for(var n=0;n<this.children.length;++n){var i=this.children[n],o=i.chunkSize();if(o>=e){if(i.insertInner(e,t,r),i.lines&&i.lines.length>50){for(;i.lines.length>50;){var a=i.lines.splice(i.lines.length-25,25),l=new Rn(a);i.height-=l.height,this.children.splice(n+1,0,l),l.parent=this}this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=e.children.splice(e.children.length-5,5),r=new Un(t);if(e.parent){e.size-=r.size,e.height-=r.height;var n=Oi(e.parent.children,e);e.parent.children.splice(n+1,0,r)}else{var i=new Un(e.children);i.parent=e,e.children=[i,r],e=i}r.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,r){for(var n=0;n<this.children.length;++n){var i=this.children[n],o=i.chunkSize();if(o>e){var a=Math.min(t,o-e);if(i.iterN(e,a,r))return!0;if(0==(t-=a))break;e=0}else e-=o}}};var ga=0,va=e.Doc=function(e,t,r){if(!(this instanceof va))return new va(e,t,r);null==r&&(r=0),Un.call(this,[new Rn([new ha("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.frontier=r;var n=No(r,0);this.sel=he(n),this.history=new ti(null),this.id=++ga,this.modeOption=t,"string"==typeof e&&(e=Ga(e)),qn(this,{from:n,to:n,text:e}),Me(this,he(n),Oa)};va.prototype=Pi(Un.prototype,{constructor:va,iter:function(e,t,r){r?this.iterN(e-this.first,t-e,r):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var r=0,n=0;n<t.length;++n)r+=t[n].height;this.insertInner(e-this.first,t,r)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=Xn(this,this.first,this.first+this.size);return e===!1?t:t.join(e||"\n")},setValue:zt(function(e){var t=No(this.first,0),r=this.first+this.size-1;wr(this,{from:t,to:No(r,Kn(this,r).text.length),text:Ga(e),origin:"setValue",full:!0},!0),Me(this,he(t))}),replaceRange:function(e,t,r,n){t=me(this,t),r=r?me(this,r):t,Tr(this,e,t,r,n)},getRange:function(e,t,r){var n=$n(this,me(this,e),me(this,t));return r===!1?n:n.join(r||"\n")},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){return ve(this,e)?Kn(this,e):void 0},getLineNumber:function(e){return Zn(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=Kn(this,e)),pn(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return me(this,e)},getCursor:function(e){var t,r=this.sel.primary();return t=null==e||"head"==e?r.head:"anchor"==e?r.anchor:"end"==e||"to"==e||e===!1?r.to():r.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:zt(function(e,t,r){Ce(this,me(this,"number"==typeof e?No(e,t||0):e),null,r)}),setSelection:zt(function(e,t,r){Ce(this,me(this,e),me(this,t||e),r)}),extendSelection:zt(function(e,t,r){xe(this,me(this,e),t&&me(this,t),r)}),extendSelections:zt(function(e,t){we(this,ye(this,e,t))}),extendSelectionsBy:zt(function(e,t){we(this,zi(this.sel.ranges,e),t)}),setSelections:zt(function(e,t,r){if(e.length){for(var n=0,i=[];n<e.length;n++)i[n]=new de(me(this,e[n].anchor),me(this,e[n].head));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),Me(this,fe(i,t),r)}}),addSelection:zt(function(e,t,r){var n=this.sel.ranges.slice(0);n.push(new de(me(this,e),me(this,t||e))),Me(this,fe(n,n.length-1),r)}),getSelection:function(e){for(var t,r=this.sel.ranges,n=0;n<r.length;n++){var i=$n(this,r[n].from(),r[n].to());t=t?t.concat(i):i}return e===!1?t:t.join(e||"\n")},getSelections:function(e){for(var t=[],r=this.sel.ranges,n=0;n<r.length;n++){var i=$n(this,r[n].from(),r[n].to());e!==!1&&(i=i.join(e||"\n")),t[n]=i}return t},replaceSelection:function(e,t,r){for(var n=[],i=0;i<this.sel.ranges.length;i++)n[i]=e;this.replaceSelections(n,t,r||"+input")},replaceSelections:zt(function(e,t,r){for(var n=[],i=this.sel,o=0;o<i.ranges.length;o++){var a=i.ranges[o];n[o]={from:a.from(),to:a.to(),text:Ga(e[o]),origin:r}}for(var l=t&&"end"!=t&&br(this,n,t),o=n.length-1;o>=0;o--)wr(this,n[o]);l?Le(this,l):this.cm&&Dr(this.cm)}),undo:zt(function(){Cr(this,"undo")}),redo:zt(function(){Cr(this,"redo")}),undoSelection:zt(function(){Cr(this,"undo",!0)}),redoSelection:zt(function(){Cr(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,r=0,n=0;n<e.done.length;n++)e.done[n].ranges||++t;for(var n=0;n<e.undone.length;n++)e.undone[n].ranges||++r;return{undo:t,redo:r}},clearHistory:function(){this.history=new ti(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:fi(this.history.done),undone:fi(this.history.undone)}},setHistory:function(e){var t=this.history=new ti(this.history.maxGeneration);t.done=fi(e.done.slice(0),null,!0),t.undone=fi(e.undone.slice(0),null,!0)},addLineClass:zt(function(e,t,r){return Er(this,e,"gutter"==t?"gutter":"class",function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass";if(e[n]){if(qi(r).test(e[n]))return!1;e[n]+=" "+r}else e[n]=r;return!0})}),removeLineClass:zt(function(e,t,r){return Er(this,e,"gutter"==t?"gutter":"class",function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass",i=e[n];if(!i)return!1;if(null==r)e[n]=null;else{var o=i.match(qi(r));if(!o)return!1;var a=o.index+o[0].length;e[n]=i.slice(0,o.index)+(o.index&&a!=i.length?" ":"")+i.slice(a)||null}return!0})}),addLineWidget:zt(function(e,t,r){return kn(this,e,t,r)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,r){return Rr(this,me(this,e),me(this,t),r,"range")},setBookmark:function(e,t){var r={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=me(this,e),Rr(this,e,e,r,"bookmark")},findMarksAt:function(e){e=me(this,e);var t=[],r=Kn(this,e.line).markedSpans;if(r)for(var n=0;n<r.length;++n){var i=r[n];(null==i.from||i.from<=e.ch)&&(null==i.to||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,r){e=me(this,e),t=me(this,t);var n=[],i=e.line;return this.iter(e.line,t.line+1,function(o){var a=o.markedSpans;if(a)for(var l=0;l<a.length;l++){var s=a[l];i==e.line&&e.ch>s.to||null==s.from&&i!=e.line||i==t.line&&s.from>t.ch||r&&!r(s.marker)||n.push(s.marker.parent||s.marker)}++i}),n},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var n=0;n<r.length;++n)null!=r[n].from&&e.push(r[n].marker)}),e},posFromIndex:function(e){var t,r=this.first;return this.iter(function(n){var i=n.text.length+1;return i>e?(t=e,!0):(e-=i,void++r)}),me(this,No(r,t))},indexFromPos:function(e){e=me(this,e);var t=e.ch;return e.line<this.first||e.ch<0?0:(this.iter(this.first,e.line,function(e){t+=e.text.length+1}),t)},copy:function(e){var t=new va(Xn(this,this.first,this.first+this.size),this.modeOption,this.first);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,r=this.first+this.size;null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&e.to<r&&(r=e.to);var n=new va(Xn(this,t,r),e.mode||this.modeOption,t);return e.sharedHist&&(n.history=this.history),(this.linked||(this.linked=[])).push({doc:n,sharedHist:e.sharedHist}),n.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Gr(n,Vr(this)),n},unlinkDoc:function(t){if(t instanceof e&&(t=t.doc),this.linked)for(var r=0;r<this.linked.length;++r){var n=this.linked[r];if(n.doc==t){this.linked.splice(r,1),t.unlinkDoc(this),Kr(Vr(this));break}}if(t.history==this.history){var i=[t.id];Vn(t,function(e){i.push(e.id)},!0),t.history=new ti(null),t.history.done=fi(this.history.done,i),t.history.undone=fi(this.history.undone,i)}},iterLinkedDocs:function(e){Vn(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm}}),va.prototype.eachLine=va.prototype.iter;var ya="iter insert remove copy getEditor".split(" ");for(var ba in va.prototype)va.prototype.hasOwnProperty(ba)&&Oi(ya,ba)<0&&(e.prototype[ba]=function(e){return function(){return e.apply(this.doc,arguments)}}(va.prototype[ba]));Si(va);var xa=e.e_preventDefault=function(e){e.preventDefault?e.preventDefault():e.returnValue=!1},wa=e.e_stopPropagation=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},ka=e.e_stop=function(e){xa(e),wa(e)},Ca=e.on=function(e,t,r){if(e.addEventListener)e.addEventListener(t,r,!1);else if(e.attachEvent)e.attachEvent("on"+t,r);else{var n=e._handlers||(e._handlers={}),i=n[t]||(n[t]=[]);i.push(r)}},Sa=e.off=function(e,t,r){if(e.removeEventListener)e.removeEventListener(t,r,!1);else if(e.detachEvent)e.detachEvent("on"+t,r);else{var n=e._handlers&&e._handlers[t];if(!n)return;for(var i=0;i<n.length;++i)if(n[i]==r){n.splice(i,1);break}}},La=e.signal=function(e,t){var r=e._handlers&&e._handlers[t];if(r)for(var n=Array.prototype.slice.call(arguments,2),i=0;i<r.length;++i)r[i].apply(null,n)},Ma=null,Ta=30,Aa=e.Pass={toString:function(){return"CodeMirror.Pass"}},Oa={scroll:!1},za={origin:"*mouse"},Na={origin:"+move"};Li.prototype.set=function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)};var Pa=e.countColumn=function(e,t,r,n,i){null==t&&(t=e.search(/[^\s\u00a0]/),-1==t&&(t=e.length));for(var o=n||0,a=i||0;;){var l=e.indexOf(" ",o);if(0>l||l>=t)return a+(t-o);a+=l-o,a+=r-a%r,o=l+1}},Da=[""],Wa=function(e){e.select()};ko?Wa=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:ho&&(Wa=function(e){try{e.select()}catch(t){}});var Ia,Ea=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Fa=e.isWordChar=function(e){return/\w/.test(e)||e>""&&(e.toUpperCase()!=e.toLowerCase()||Ea.test(e))},Ha=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;Ia=document.createRange?function(e,t,r,n){var i=document.createRange();return i.setEnd(n||e,r),i.setStart(e,t),i}:function(e,t,r){var n=document.body.createTextRange();try{n.moveToElementText(e.parentNode)}catch(i){return n}return n.collapse(!0),n.moveEnd("character",r),n.moveStart("character",t),n};var _a=e.contains=function(e,t){if(3==t.nodeType&&(t=t.parentNode),e.contains)return e.contains(t);do if(11==t.nodeType&&(t=t.host),t==e)return!0;while(t=t.parentNode)};ho&&11>po&&(Bi=function(){try{return document.activeElement}catch(e){return document.body}});var ja,Ba,qa=e.rmClass=function(e,t){var r=e.className,n=qi(t).exec(r);if(n){var i=r.slice(n.index+n[0].length);e.className=r.slice(0,n.index)+(i?n[1]+i:"")}},Ra=e.addClass=function(e,t){var r=e.className;qi(t).test(r)||(e.className+=(r?" ":"")+t)},Ua=!1,Va=function(){if(ho&&9>po)return!1;var e=Hi("div");return"draggable"in e||"dragDrop"in e}(),Ga=e.splitLines=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,r=[],n=e.length;n>=t;){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),a=o.indexOf("\r");-1!=a?(r.push(o.slice(0,a)),t+=a+1):(r.push(o),t=i+1)}return r}:function(e){return e.split(/\r\n?|\n/)},Ka=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){try{var t=e.ownerDocument.selection.createRange()}catch(r){}return t&&t.parentElement()==e?0!=t.compareEndPoints("StartToEnd",t):!1},$a=function(){var e=Hi("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy)}(),Xa=null,Ya={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",107:"=",109:"-",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};e.keyNames=Ya,function(){for(var e=0;10>e;e++)Ya[e+48]=Ya[e+96]=String(e);for(var e=65;90>=e;e++)Ya[e]=String.fromCharCode(e);for(var e=1;12>=e;e++)Ya[e+111]=Ya[e+63235]="F"+e}();var Za,Qa=function(){function e(e){return 247>=e?r.charAt(e):e>=1424&&1524>=e?"R":e>=1536&&1773>=e?n.charAt(e-1536):e>=1774&&2220>=e?"r":e>=8192&&8203>=e?"w":8204==e?"b":"L"}function t(e,t,r){this.level=e,this.from=t,this.to=r}var r="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",n="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,o=/[stwN]/,a=/[LRr]/,l=/[Lb1n]/,s=/[1n]/,c="L";return function(r){if(!i.test(r))return!1;for(var n,u=r.length,d=[],f=0;u>f;++f)d.push(n=e(r.charCodeAt(f)));for(var f=0,h=c;u>f;++f){var n=d[f];"m"==n?d[f]=h:h=n}for(var f=0,p=c;u>f;++f){var n=d[f];"1"==n&&"r"==p?d[f]="n":a.test(n)&&(p=n,"r"==n&&(d[f]="R"))}for(var f=1,h=d[0];u-1>f;++f){var n=d[f];"+"==n&&"1"==h&&"1"==d[f+1]?d[f]="1":","!=n||h!=d[f+1]||"1"!=h&&"n"!=h||(d[f]=h),h=n}for(var f=0;u>f;++f){var n=d[f];if(","==n)d[f]="N";else if("%"==n){for(var m=f+1;u>m&&"%"==d[m];++m);for(var g=f&&"!"==d[f-1]||u>m&&"1"==d[m]?"1":"N",v=f;m>v;++v)d[v]=g;f=m-1}}for(var f=0,p=c;u>f;++f){var n=d[f];"L"==p&&"1"==n?d[f]="L":a.test(n)&&(p=n)}for(var f=0;u>f;++f)if(o.test(d[f])){for(var m=f+1;u>m&&o.test(d[m]);++m);for(var y="L"==(f?d[f-1]:c),b="L"==(u>m?d[m]:c),g=y||b?"L":"R",v=f;m>v;++v)d[v]=g;f=m-1}for(var x,w=[],f=0;u>f;)if(l.test(d[f])){var k=f;for(++f;u>f&&l.test(d[f]);++f);w.push(new t(0,k,f))}else{var C=f,S=w.length;for(++f;u>f&&"L"!=d[f];++f);for(var v=C;f>v;)if(s.test(d[v])){v>C&&w.splice(S,0,new t(1,C,v));var L=v;for(++v;f>v&&s.test(d[v]);++v);w.splice(S,0,new t(2,L,v)),C=v}else++v;f>C&&w.splice(S,0,new t(1,C,f))}return 1==w[0].level&&(x=r.match(/^\s+/))&&(w[0].from=x[0].length,w.unshift(new t(0,0,x[0].length))),1==Ai(w).level&&(x=r.match(/\s+$/))&&(Ai(w).to-=x[0].length,w.push(new t(0,u-x[0].length,u))),2==w[0].level&&w.unshift(new t(1,w[0].to,w[0].to)),w[0].level!=Ai(w).level&&w.push(new t(w[0].level,u,u)),w}}();return e.version="5.2.0",e}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.overlayMode=function(t,r,n){return{startState:function(){return{base:e.startState(t),overlay:e.startState(r),basePos:0,baseCur:null,overlayPos:0,overlayCur:null,streamSeen:null}},copyState:function(n){return{base:e.copyState(t,n.base),overlay:e.copyState(r,n.overlay),basePos:n.basePos,baseCur:null,overlayPos:n.overlayPos,overlayCur:null}},token:function(e,i){return(e!=i.streamSeen||Math.min(i.basePos,i.overlayPos)<e.start)&&(i.streamSeen=e,i.basePos=i.overlayPos=e.start),e.start==i.basePos&&(i.baseCur=t.token(e,i.base),i.basePos=e.pos),e.start==i.overlayPos&&(e.pos=e.start,i.overlayCur=r.token(e,i.overlay),i.overlayPos=e.pos),e.pos=Math.min(i.basePos,i.overlayPos),null==i.overlayCur?i.baseCur:null!=i.baseCur&&i.overlay.combineTokens||n&&null==i.overlay.combineTokens?i.baseCur+" "+i.overlayCur:i.overlayCur},indent:t.indent&&function(e,r){return t.indent(e.base,r)},electricChars:t.electricChars,innerMode:function(e){return{state:e.base,mode:t}},blankLine:function(e){t.blankLine&&t.blankLine(e.base),r.blankLine&&r.blankLine(e.overlay)}}}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){for(var t=0;t<e.state.activeLines.length;t++)e.removeLineClass(e.state.activeLines[t],"wrap",o),e.removeLineClass(e.state.activeLines[t],"background",a)}function r(e,t){if(e.length!=t.length)return!1;for(var r=0;r<e.length;r++)if(e[r]!=t[r])return!1;return!0}function n(e,n){for(var i=[],l=0;l<n.length;l++){var s=n[l];if(s.empty()){var c=e.getLineHandleVisualStart(s.head.line);i[i.length-1]!=c&&i.push(c)}}r(e.state.activeLines,i)||e.operation(function(){t(e);for(var r=0;r<i.length;r++)e.addLineClass(i[r],"wrap",o),e.addLineClass(i[r],"background",a);e.state.activeLines=i})}function i(e,t){n(e,t.ranges)}var o="CodeMirror-activeline",a="CodeMirror-activeline-background";e.defineOption("styleActiveLine",!1,function(r,o,a){var l=a&&a!=e.Init;o&&!l?(r.state.activeLines=[],n(r,r.listSelections()),r.on("beforeSelectionChange",i)):!o&&l&&(r.off("beforeSelectionChange",i),t(r),delete r.state.activeLines)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e,t,n,i){var o=e.getLineHandle(t.line),s=t.ch-1,c=s>=0&&l[o.text.charAt(s)]||l[o.text.charAt(++s)];if(!c)return null;var u=">"==c.charAt(1)?1:-1;if(n&&u>0!=(s==t.ch))return null;var d=e.getTokenTypeAt(a(t.line,s+1)),f=r(e,a(t.line,s+(u>0?1:0)),u,d||null,i);return null==f?null:{from:a(t.line,s),to:f&&f.pos,match:f&&f.ch==c.charAt(0),forward:u>0}}function r(e,t,r,n,i){for(var o=i&&i.maxScanLineLength||1e4,s=i&&i.maxScanLines||1e3,c=[],u=i&&i.bracketRegex?i.bracketRegex:/[(){}[\]]/,d=r>0?Math.min(t.line+s,e.lastLine()+1):Math.max(e.firstLine()-1,t.line-s),f=t.line;f!=d;f+=r){var h=e.getLine(f);if(h){var p=r>0?0:h.length-1,m=r>0?h.length:-1;if(!(h.length>o))for(f==t.line&&(p=t.ch-(0>r?1:0));p!=m;p+=r){var g=h.charAt(p);if(u.test(g)&&(void 0===n||e.getTokenTypeAt(a(f,p+1))==n)){var v=l[g];if(">"==v.charAt(1)==r>0)c.push(g);else{if(!c.length)return{pos:a(f,p),ch:g};c.pop()}}}}}return f-r==(r>0?e.lastLine():e.firstLine())?!1:null}function n(e,r,n){for(var i=e.state.matchBrackets.maxHighlightLineLength||1e3,l=[],s=e.listSelections(),c=0;c<s.length;c++){var u=s[c].empty()&&t(e,s[c].head,!1,n);if(u&&e.getLine(u.from.line).length<=i){var d=u.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";l.push(e.markText(u.from,a(u.from.line,u.from.ch+1),{className:d})),u.to&&e.getLine(u.to.line).length<=i&&l.push(e.markText(u.to,a(u.to.line,u.to.ch+1),{className:d}))}}if(l.length){o&&e.state.focused&&e.focus();var f=function(){e.operation(function(){for(var e=0;e<l.length;e++)l[e].clear()})};if(!r)return f;setTimeout(f,800)}}function i(e){e.operation(function(){s&&(s(),s=null),s=n(e,!1,e.state.matchBrackets)})}var o=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),a=e.Pos,l={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},s=null;e.defineOption("matchBrackets",!1,function(t,r,n){n&&n!=e.Init&&t.off("cursorActivity",i),r&&(t.state.matchBrackets="object"==typeof r?r:{},t.on("cursorActivity",i))}),e.defineExtension("matchBrackets",function(){n(this,!0)}),e.defineExtension("findMatchingBracket",function(e,r,n){return t(this,e,r,n)}),e.defineExtension("scanForBracket",function(e,t,n,i){return r(this,e,t,n,i)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e,t){return"pairs"==t&&"string"==typeof e?e:"object"==typeof e&&null!=e[t]?e[t]:u[t]}function r(e){return function(t){return a(t,e)}}function n(e){var t=e.state.closeBrackets;if(!t)return null;var r=e.getModeAt(e.getCursor());return r.closeBrackets||t}function i(r){var i=n(r);if(!i||r.getOption("disableInput"))return e.Pass;for(var o=t(i,"pairs"),a=r.listSelections(),l=0;l<a.length;l++){if(!a[l].empty())return e.Pass;var c=s(r,a[l].head);if(!c||o.indexOf(c)%2!=0)return e.Pass}for(var l=a.length-1;l>=0;l--){var u=a[l].head;r.replaceRange("",d(u.line,u.ch-1),d(u.line,u.ch+1))}}function o(r){var i=n(r),o=i&&t(i,"explode");if(!o||r.getOption("disableInput"))return e.Pass;for(var a=r.listSelections(),l=0;l<a.length;l++){if(!a[l].empty())return e.Pass;var c=s(r,a[l].head);if(!c||o.indexOf(c)%2!=0)return e.Pass}r.operation(function(){r.replaceSelection("\n\n",null),r.execCommand("goCharLeft"),a=r.listSelections();for(var e=0;e<a.length;e++){var t=a[e].head.line;r.indentLine(t,null,!0),r.indentLine(t+1,null,!0)}})}function a(r,i){var o=n(r);if(!o||r.getOption("disableInput"))return e.Pass;var a=t(o,"pairs"),s=a.indexOf(i);if(-1==s)return e.Pass;for(var u,f,h=t(o,"triples"),p=a.charAt(s+1)==i,m=r.listSelections(),g=s%2==0,v=0;v<m.length;v++){var y,b=m[v],x=b.head,f=r.getRange(x,d(x.line,x.ch+1));if(g&&!b.empty())y="surround";else if(!p&&g||f!=i)if(p&&x.ch>1&&h.indexOf(i)>=0&&r.getRange(d(x.line,x.ch-2),x)==i+i&&(x.ch<=2||r.getRange(d(x.line,x.ch-3),d(x.line,x.ch-2))!=i))y="addFour";else if(p){if(e.isWordChar(f)||!c(r,x,i))return e.Pass;y="both"}else{if(!g||r.getLine(x.line).length!=x.ch&&!l(f,a)&&!/\s/.test(f))return e.Pass;y="both"}else y=h.indexOf(i)>=0&&r.getRange(x,d(x.line,x.ch+3))==i+i+i?"skipThree":"skip";if(u){if(u!=y)return e.Pass}else u=y}var w=s%2?a.charAt(s-1):i,k=s%2?i:a.charAt(s+1);r.operation(function(){if("skip"==u)r.execCommand("goCharRight");else if("skipThree"==u)for(var e=0;3>e;e++)r.execCommand("goCharRight");else if("surround"==u){for(var t=r.getSelections(),e=0;e<t.length;e++)t[e]=w+t[e]+k;r.replaceSelections(t,"around")}else"both"==u?(r.replaceSelection(w+k,null),r.execCommand("goCharLeft")):"addFour"==u&&(r.replaceSelection(w+w+w+w,"before"),r.execCommand("goCharRight"))})}function l(e,t){var r=t.lastIndexOf(e);return r>-1&&r%2==1}function s(e,t){var r=e.getRange(d(t.line,t.ch-1),d(t.line,t.ch+1));return 2==r.length?r:null}function c(t,r,n){var i=t.getLine(r.line),o=t.getTokenAt(r);if(/\bstring2?\b/.test(o.type))return!1;var a=new e.StringStream(i.slice(0,r.ch)+n+i.slice(r.ch),4);for(a.pos=a.start=o.start;;){var l=t.getMode().token(a,o.state);if(a.pos>=r.ch+1)return/\bstring2?\b/.test(l);a.start=a.pos}}var u={pairs:"()[]{}''\"\"",triples:"",explode:"[]{}"},d=e.Pos;e.defineOption("autoCloseBrackets",!1,function(t,r,n){n&&n!=e.Init&&(t.removeKeyMap(h),t.state.closeBrackets=null),r&&(t.state.closeBrackets=r,t.addKeyMap(h))});for(var f=u.pairs+"`",h={Backspace:i,Enter:o},p=0;p<f.length;p++)h["'"+f.charAt(p)+"'"]=r(f.charAt(p))}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../fold/xml-fold")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../fold/xml-fold"],e):e(CodeMirror)}(function(e){"use strict";function t(e){e.state.tagHit&&e.state.tagHit.clear(),e.state.tagOther&&e.state.tagOther.clear(),e.state.tagHit=e.state.tagOther=null; +}},getField:function(){return this.textarea},supportsTouch:function(){return!1},focus:function(){if("nocursor"!=this.cm.options.readOnly&&(!Co||_i()!=this.textarea))try{this.textarea.focus()}catch(e){}},blur:function(){this.textarea.blur()},resetPosition:function(){this.wrapper.style.top=this.wrapper.style.left=0},receivedFocus:function(){this.slowPoll()},slowPoll:function(){var e=this;e.pollingFast||e.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},fastPoll:function(){function e(){var r=n.poll();r||t?(n.pollingFast=!1,n.slowPoll()):(t=!0,n.polling.set(60,e))}var t=!1,n=this;n.pollingFast=!0,n.polling.set(20,e)},poll:function(){var e=this.cm,t=this.textarea,n=this.prevInput;if(!e.state.focused||Ka(t)&&!n||Q(e)||e.options.disableInput||e.state.keySeq)return!1;e.state.pasteIncoming&&e.state.fakedLastChar&&(t.value=t.value.substring(0,t.value.length-1),e.state.fakedLastChar=!1);var r=t.value;if(r==n&&!e.somethingSelected())return!1;if(ho&&po>=9&&this.hasSelection===r||So&&/[\uf700-\uf7ff]/.test(r))return e.display.input.reset(),!1;if(e.doc.sel==e.display.selForContextMenu){var i=r.charCodeAt(0);if(8203!=i||n||(n=""),8666==i)return this.reset(),this.cm.execCommand("undo")}for(var o=0,a=Math.min(n.length,r.length);a>o&&n.charCodeAt(o)==r.charCodeAt(o);)++o;var l=this;return Tt(e,function(){J(e,r.slice(o),n.length-o,null,l.composing?"*compose":null),r.length>1e3||r.indexOf("\n")>-1?t.value=l.prevInput="":l.prevInput=r,l.composing&&(l.composing.range.clear(),l.composing.range=e.markText(l.composing.start,e.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},ensurePolled:function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},onKeyPress:function(){ho&&po>=9&&(this.hasSelection=null),this.fastPoll()},onContextMenu:function(e){function t(){if(null!=a.selectionStart){var e=i.somethingSelected(),t=""+(e?a.value:"");a.value="⇚",a.value=t,r.prevInput=e?"":"",a.selectionStart=1,a.selectionEnd=t.length,o.selForContextMenu=i.doc.sel}}function n(){if(r.contextMenuPending=!1,r.wrapper.style.position="relative",a.style.cssText=u,ho&&9>po&&o.scrollbars.setScrollTop(o.scroller.scrollTop=s),null!=a.selectionStart){(!ho||ho&&9>po)&&t();var e=0,n=function(){o.selForContextMenu==i.doc.sel&&0==a.selectionStart&&a.selectionEnd>0&&""==r.prevInput?At(i,ra.selectAll)(i):e++<10?o.detectingSelectAll=setTimeout(n,500):o.input.reset()};o.detectingSelectAll=setTimeout(n,200)}}var r=this,i=r.cm,o=i.display,a=r.textarea,l=Ut(i,e),s=o.scroller.scrollTop;if(l&&!yo){var c=i.options.resetSelectionOnContextMenu;c&&-1==i.doc.sel.contains(l)&&At(i,Me)(i.doc,he(l),Oa);var u=a.style.cssText;if(r.wrapper.style.position="absolute",a.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(e.clientY-5)+"px; left: "+(e.clientX-5)+"px; z-index: 1000; background: "+(ho?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",mo)var f=window.scrollY;if(o.input.focus(),mo&&window.scrollTo(null,f),o.input.reset(),i.somethingSelected()||(a.value=r.prevInput=" "),r.contextMenuPending=!0,o.selForContextMenu=i.doc.sel,clearTimeout(o.detectingSelectAll),ho&&po>=9&&t(),Ao){ka(e);var d=function(){Sa(window,"mouseup",d),setTimeout(n,20)};Ca(window,"mouseup",d)}else setTimeout(n,50)}},setUneditable:Pi,needsContentAttribute:!1},ne.prototype),ie.prototype=Di({init:function(e){function t(e){if(r.somethingSelected())Do=r.getSelections(),"cut"==e.type&&r.replaceSelection("",null,"cut");else{if(!r.options.lineWiseCopyCut)return;var t=ee(r);Do=t.text,"cut"==e.type&&r.operation(function(){r.setSelections(t.ranges,0,Oa),r.replaceSelection("",null,"cut")})}if(e.clipboardData&&!ko)e.preventDefault(),e.clipboardData.clearData(),e.clipboardData.setData("text/plain",Do.join("\n"));else{var n=re(),i=n.firstChild;r.display.lineSpace.insertBefore(n,r.display.lineSpace.firstChild),i.value=Do.join("\n");var o=document.activeElement;Wa(i),setTimeout(function(){r.display.lineSpace.removeChild(n),o.focus()},50)}}var n=this,r=n.cm,i=n.div=e.lineDiv;i.contentEditable="true",te(i),Ca(i,"paste",function(e){var t=e.clipboardData&&e.clipboardData.getData("text/plain");t&&(e.preventDefault(),r.replaceSelection(t,null,"paste"))}),Ca(i,"compositionstart",function(e){var t=e.data;if(n.composing={sel:r.doc.sel,data:t,startData:t},t){var i=r.doc.sel.primary(),o=r.getLine(i.head.line),a=o.indexOf(t,Math.max(0,i.head.ch-t.length));a>-1&&a<=i.head.ch&&(n.composing.sel=he(Po(i.head.line,a),Po(i.head.line,a+t.length)))}}),Ca(i,"compositionupdate",function(e){n.composing.data=e.data}),Ca(i,"compositionend",function(e){var t=n.composing;t&&(e.data==t.startData||/\u200b/.test(e.data)||(t.data=e.data),setTimeout(function(){t.handled||n.applyComposition(t),n.composing==t&&(n.composing=null)},50))}),Ca(i,"touchstart",function(){n.forceCompositionEnd()}),Ca(i,"input",function(){n.composing||n.pollContent()||Tt(n.cm,function(){Dt(r)})}),Ca(i,"copy",t),Ca(i,"cut",t)},prepareSelection:function(){var e=De(this.cm,!1);return e.focus=this.cm.state.focused,e},showSelection:function(e){e&&this.cm.display.view.length&&(e.focus&&this.showPrimarySelection(),this.showMultipleSelections(e))},showPrimarySelection:function(){var e=window.getSelection(),t=this.cm.doc.sel.primary(),n=le(this.cm,e.anchorNode,e.anchorOffset),r=le(this.cm,e.focusNode,e.focusOffset);if(!n||n.bad||!r||r.bad||0!=zo(Y(n,r),t.from())||0!=zo(X(n,r),t.to())){var i=oe(this.cm,t.from()),o=oe(this.cm,t.to());if(i||o){var a=this.cm.display.view,l=e.rangeCount&&e.getRangeAt(0);if(i){if(!o){var s=a[a.length-1].measure,c=s.maps?s.maps[s.maps.length-1]:s.map;o={node:c[c.length-1],offset:c[c.length-2]-c[c.length-3]}}}else i={node:a[0].measure.map[2],offset:0};try{var u=Ea(i.node,i.offset,o.offset,o.node)}catch(f){}u&&(e.removeAllRanges(),e.addRange(u),l&&null==e.anchorNode?e.addRange(l):co&&this.startGracePeriod()),this.rememberSelection()}}},startGracePeriod:function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){e.cm.curOp.selectionChanged=!0})},20)},showMultipleSelections:function(e){ji(this.cm.display.cursorDiv,e.cursors),ji(this.cm.display.selectionDiv,e.selection)},rememberSelection:function(){var e=window.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},selectionInEditor:function(){var e=window.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return Ba(this.div,t)},focus:function(){"nocursor"!=this.cm.options.readOnly&&this.div.focus()},blur:function(){this.div.blur()},getField:function(){return this.div},supportsTouch:function(){return!0},receivedFocus:function(){function e(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,e))}var t=this;this.selectionInEditor()?this.pollSelection():Tt(this.cm,function(){t.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,e)},selectionChanged:function(){var e=window.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},pollSelection:function(){if(!this.composing&&!this.gracePeriod&&this.selectionChanged()){var e=window.getSelection(),t=this.cm;this.rememberSelection();var n=le(t,e.anchorNode,e.anchorOffset),r=le(t,e.focusNode,e.focusOffset);n&&r&&Tt(t,function(){Me(t.doc,he(n,r),Oa),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})}},pollContent:function(){var e=this.cm,t=e.display,n=e.doc.sel.primary(),r=n.from(),i=n.to();if(r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var o;if(r.line==t.viewFrom||0==(o=It(e,r.line)))var a=Zr(t.view[0].line),l=t.view[0].node;else var a=Zr(t.view[o].line),l=t.view[o-1].node.nextSibling;var s=It(e,i.line);if(s==t.view.length-1)var c=t.viewTo-1,u=t.view[s].node;else var c=Zr(t.view[s+1].line)-1,u=t.view[s+1].node.previousSibling;for(var f=Ga(ce(e,l,u,a,c)),d=$r(e.doc,Po(a,0),Po(c,Kr(e.doc,c).text.length));f.length>1&&d.length>1;)if(Ai(f)==Ai(d))f.pop(),d.pop(),c--;else{if(f[0]!=d[0])break;f.shift(),d.shift(),a++}for(var h=0,p=0,m=f[0],g=d[0],v=Math.min(m.length,g.length);v>h&&m.charCodeAt(h)==g.charCodeAt(h);)++h;for(var y=Ai(f),b=Ai(d),x=Math.min(y.length-(1==f.length?h:0),b.length-(1==d.length?h:0));x>p&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)++p;f[f.length-1]=y.slice(0,y.length-p),f[0]=f[0].slice(h);var w=Po(a,h),k=Po(c,d.length?Ai(d).length-p:0);return f.length>1||f[0]||zo(w,k)?(An(e.doc,f,w,k,"+input"),!0):void 0},ensurePolled:function(){this.forceCompositionEnd()},reset:function(){this.forceCompositionEnd()},forceCompositionEnd:function(){this.composing&&!this.composing.handled&&(this.applyComposition(this.composing),this.composing.handled=!0,this.div.blur(),this.div.focus())},applyComposition:function(e){e.data&&e.data!=e.startData&&At(this.cm,J)(this.cm,e.data,0,e.sel)},setUneditable:function(e){e.setAttribute("contenteditable","false")},onKeyPress:function(e){e.preventDefault(),At(this.cm,J)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0)},onContextMenu:Pi,resetPosition:Pi,needsContentAttribute:!0},ie.prototype),e.inputStyles={textarea:ne,contenteditable:ie},ue.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var n=this.ranges[t],r=e.ranges[t];if(0!=zo(n.anchor,r.anchor)||0!=zo(n.head,r.head))return!1}return!0},deepCopy:function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new fe(K(this.ranges[t].anchor),K(this.ranges[t].head));return new ue(e,this.primIndex)},somethingSelected:function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},contains:function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(zo(t,r.from())>=0&&zo(e,r.to())<=0)return n}return-1}},fe.prototype={from:function(){return Y(this.anchor,this.head)},to:function(){return X(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var Wo,Eo,Io,Fo={left:0,right:0,top:0,bottom:0},Ho=null,Bo=0,jo=0,_o=0,Ro=null;ho?Ro=-.53:co?Ro=15:vo?Ro=-.7:bo&&(Ro=-1/3);var qo=function(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==n&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:null==n&&(n=e.wheelDelta),{x:t,y:n}};e.wheelEventPixels=function(e){var t=qo(e);return t.x*=Ro,t.y*=Ro,t};var Uo=new Li,Vo=null,Go=e.changeEnd=function(e){return e.text?Po(e.from.line+e.text.length-1,Ai(e.text).length+(1==e.text.length?e.from.ch:0)):e.to};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,t){var n=this.options,r=n[e];(n[e]!=t||"mode"==e)&&(n[e]=t,$o.hasOwnProperty(e)&&At(this,$o[e])(this,t,r))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](qn(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,n=0;n<t.length;++n)if(t[n]==e||t[n].name==e)return t.splice(n,1),!0},addOverlay:Ot(function(t,n){var r=t.token?t:e.getMode(this.options,t);if(r.startState)throw new Error("Overlays may not be stateful.");this.state.overlays.push({mode:r,modeSpec:t,opaque:n&&n.opaque}),this.state.modeGen++,Dt(this)}),removeOverlay:Ot(function(e){for(var t=this.state.overlays,n=0;n<t.length;++n){var r=t[n].modeSpec;if(r==e||"string"==typeof e&&r.name==e)return t.splice(n,1),this.state.modeGen++,void Dt(this)}}),indentLine:Ot(function(e,t,n){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),ve(this.doc,e)&&In(this,e,t,n)}),indentSelection:Ot(function(e){for(var t=this.doc.sel.ranges,n=-1,r=0;r<t.length;r++){var i=t[r];if(i.empty())i.head.line>n&&(In(this,i.head.line,e,!0),n=i.head.line,r==this.doc.sel.primIndex&&Wn(this));else{var o=i.from(),a=i.to(),l=Math.max(n,o.line);n=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1;for(var s=l;n>s;++s)In(this,s,e);var c=this.doc.sel.ranges;0==o.ch&&t.length==c.length&&c[r].from().ch>0&&ke(this.doc,r,new fe(o,c[r].to()),Oa)}}}),getTokenAt:function(e,t){return Ar(this,e,t)},getLineTokens:function(e,t){return Ar(this,Po(e),t,!0)},getTokenTypeAt:function(e){e=me(this.doc,e);var t,n=Pr(this,Kr(this.doc,e.line)),r=0,i=(n.length-1)/2,o=e.ch;if(0==o)t=n[2];else for(;;){var a=r+i>>1;if((a?n[2*a-1]:0)>=o)i=a;else{if(!(n[2*a+1]<o)){t=n[2*a+2];break}r=a+1}}var l=t?t.indexOf("cm-overlay "):-1;return 0>l?t:0==l?null:t.slice(0,l-1)},getModeAt:function(t){var n=this.doc.mode;return n.innerMode?e.innerMode(n,this.getTokenAt(t).state).mode:n},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var n=[];if(!ea.hasOwnProperty(t))return n;var r=ea[t],i=this.getModeAt(e);if("string"==typeof i[t])r[i[t]]&&n.push(r[i[t]]);else if(i[t])for(var o=0;o<i[t].length;o++){var a=r[i[t][o]];a&&n.push(a)}else i.helperType&&r[i.helperType]?n.push(r[i.helperType]):r[i.name]&&n.push(r[i.name]);for(var o=0;o<r._global.length;o++){var l=r._global[o];l.pred(i,this)&&-1==Oi(n,l.val)&&n.push(l.val)}return n},getStateAfter:function(e,t){var n=this.doc;return e=pe(n,null==e?n.first+n.size-1:e),je(this,e+1,t)},cursorCoords:function(e,t){var n,r=this.doc.sel.primary();return n=null==e?r.head:"object"==typeof e?me(this.doc,e):e?r.from():r.to(),ft(this,n,t||"page")},charCoords:function(e,t){return ut(this,me(this.doc,e),t||"page")},coordsChar:function(e,t){return e=ct(this,e,t||"page"),pt(this,e.left,e.top)},lineAtHeight:function(e,t){return e=ct(this,{top:e,left:0},t||"page").top,Qr(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t){var n,r=!1;if("number"==typeof e){var i=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:e>i&&(e=i,r=!0),n=Kr(this.doc,e)}else n=e;return st(this,n,{top:0,left:0},t||"page").top+(r?this.doc.height-Jr(n):0)},defaultTextHeight:function(){return gt(this.display)},defaultCharWidth:function(){return vt(this.display)},setGutterMarker:Ot(function(e,t,n){return Fn(this.doc,e,"gutter",function(e){var r=e.gutterMarkers||(e.gutterMarkers={});return r[t]=n,!n&&Ii(r)&&(e.gutterMarkers=null),!0})}),clearGutter:Ot(function(e){var t=this,n=t.doc,r=n.first;n.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&(n.gutterMarkers[e]=null,Wt(t,r,"gutter"),Ii(n.gutterMarkers)&&(n.gutterMarkers=null)),++r})}),lineInfo:function(e){if("number"==typeof e){if(!ve(this.doc,e))return null;var t=e;if(e=Kr(this.doc,e),!e)return null}else{var t=Zr(e);if(null==t)return null}return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,n,r,i){var o=this.display;e=ft(this,me(this.doc,e));var a=e.bottom,l=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),o.sizer.appendChild(t),"over"==r)a=e.top;else if("above"==r||"near"==r){var s=Math.max(o.wrapper.clientHeight,this.doc.height),c=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==r||e.bottom+t.offsetHeight>s)&&e.top>t.offsetHeight?a=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=s&&(a=e.bottom),l+t.offsetWidth>c&&(l=c-t.offsetWidth)}t.style.top=a+"px",t.style.left=t.style.right="","right"==i?(l=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?l=0:"middle"==i&&(l=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=l+"px"),n&&Pn(this,l,a,l+t.offsetWidth,a+t.offsetHeight)},triggerOnKeyDown:Ot(sn),triggerOnKeyPress:Ot(fn),triggerOnKeyUp:un,execCommand:function(e){return ra.hasOwnProperty(e)?ra[e](this):void 0},findPosH:function(e,t,n,r){var i=1;0>t&&(i=-1,t=-t);for(var o=0,a=me(this.doc,e);t>o&&(a=Bn(this.doc,a,i,n,r),!a.hitSide);++o);return a},moveH:Ot(function(e,t){var n=this;n.extendSelectionsBy(function(r){return n.display.shift||n.doc.extend||r.empty()?Bn(n.doc,r.head,e,t,n.options.rtlMoveVisually):0>e?r.from():r.to()},Pa)}),deleteH:Ot(function(e,t){var n=this.doc.sel,r=this.doc;n.somethingSelected()?r.replaceSelection("",null,"+delete"):Hn(this,function(n){var i=Bn(r,n.head,e,t,!1);return 0>e?{from:i,to:n.head}:{from:n.head,to:i}})}),findPosV:function(e,t,n,r){var i=1,o=r;0>t&&(i=-1,t=-t);for(var a=0,l=me(this.doc,e);t>a;++a){var s=ft(this,l,"div");if(null==o?o=s.left:s.left=o,l=jn(this,s,i,n),l.hitSide)break}return l},moveV:Ot(function(e,t){var n=this,r=this.doc,i=[],o=!n.display.shift&&!r.extend&&r.sel.somethingSelected();if(r.extendSelectionsBy(function(a){if(o)return 0>e?a.from():a.to();var l=ft(n,a.head,"div");null!=a.goalColumn&&(l.left=a.goalColumn),i.push(l.left);var s=jn(n,l,e,t);return"page"==t&&a==r.sel.primary()&&Dn(n,null,ut(n,s,"div").top-l.top),s},Pa),i.length)for(var a=0;a<r.sel.ranges.length;a++)r.sel.ranges[a].goalColumn=i[a]}),findWordAt:function(e){var t=this.doc,n=Kr(t,e.line).text,r=e.ch,i=e.ch;if(n){var o=this.getHelper(e,"wordChars");(e.xRel<0||i==n.length)&&r?--r:++i;for(var a=n.charAt(r),l=Ei(a,o)?function(e){return Ei(e,o)}:/\s/.test(a)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!Ei(e)};r>0&&l(n.charAt(r-1));)--r;for(;i<n.length&&l(n.charAt(i));)++i}return new fe(Po(e.line,r),Po(e.line,i))},toggleOverwrite:function(e){(null==e||e!=this.state.overwrite)&&((this.state.overwrite=!this.state.overwrite)?qa(this.display.cursorDiv,"CodeMirror-overwrite"):Ra(this.display.cursorDiv,"CodeMirror-overwrite"),La(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==_i()},scrollTo:Ot(function(e,t){(null!=e||null!=t)&&En(this),null!=e&&(this.curOp.scrollLeft=e),null!=t&&(this.curOp.scrollTop=t)}),getScrollInfo:function(){var e=this.display.scroller;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-Ue(this)-this.display.barHeight,width:e.scrollWidth-Ue(this)-this.display.barWidth,clientHeight:Ge(this),clientWidth:Ve(this)}},scrollIntoView:Ot(function(e,t){if(null==e?(e={from:this.doc.sel.primary().head,to:null},null==t&&(t=this.options.cursorScrollMargin)):"number"==typeof e?e={from:Po(e,0),to:null}:null==e.from&&(e={from:e,to:null}),e.to||(e.to=e.from),e.margin=t||0,null!=e.from.line)En(this),this.curOp.scrollToPos=e;else{var n=zn(this,Math.min(e.from.left,e.to.left),Math.min(e.from.top,e.to.top)-e.margin,Math.max(e.from.right,e.to.right),Math.max(e.from.bottom,e.to.bottom)+e.margin);this.scrollTo(n.scrollLeft,n.scrollTop)}}),setSize:Ot(function(e,t){function n(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e}var r=this;null!=e&&(r.display.wrapper.style.width=n(e)),null!=t&&(r.display.wrapper.style.height=n(t)),r.options.lineWrapping&&it(this);var i=r.display.viewFrom;r.doc.iter(i,r.display.viewTo,function(e){if(e.widgets)for(var t=0;t<e.widgets.length;t++)if(e.widgets[t].noHScroll){Wt(r,i,"widget");break}++i}),r.curOp.forceUpdate=!0,La(r,"refresh",this)}),operation:function(e){return Tt(this,e)},refresh:Ot(function(){var e=this.display.cachedTextHeight;Dt(this),this.curOp.forceUpdate=!0,ot(this),this.scrollTo(this.doc.scrollLeft,this.doc.scrollTop),u(this),(null==e||Math.abs(e-gt(this.display))>.5)&&a(this),La(this,"refresh",this)}),swapDoc:Ot(function(e){var t=this.doc;return t.cm=null,Gr(this,e),ot(this),this.display.input.reset(),this.scrollTo(e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,bi(this,"swapDoc",this,t),t}),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Si(e);var Ko=e.defaults={},$o=e.optionHandlers={},Xo=e.Init={toString:function(){return"CodeMirror.Init"}};_n("value","",function(e,t){e.setValue(t)},!0),_n("mode",null,function(e,t){e.doc.modeOption=t,n(e)},!0),_n("indentUnit",2,n,!0),_n("indentWithTabs",!1),_n("smartIndent",!0),_n("tabSize",4,function(e){r(e),ot(e),Dt(e)},!0),_n("specialChars",/[\t\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,function(t,n,r){t.state.specialChars=new RegExp(n.source+(n.test(" ")?"":"| "),"g"),r!=e.Init&&t.refresh()}),_n("specialCharPlaceholder",Er,function(e){e.refresh()},!0),_n("electricChars",!0),_n("inputStyle",Co?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),_n("rtlMoveVisually",!Lo),_n("wholeLineUpdateBefore",!0),_n("theme","default",function(e){l(e),s(e)},!0),_n("keyMap","default",function(t,n,r){var i=qn(n),o=r!=e.Init&&qn(r);o&&o.detach&&o.detach(t,i),i.attach&&i.attach(t,o||null)}),_n("extraKeys",null),_n("lineWrapping",!1,i,!0),_n("gutters",[],function(e){h(e.options),s(e)},!0),_n("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?S(e.display)+"px":"0",e.refresh()},!0),_n("coverGutterNextToScrollbar",!1,function(e){y(e)},!0),_n("scrollbarStyle","native",function(e){v(e),y(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),_n("lineNumbers",!1,function(e){h(e.options),s(e)},!0),_n("firstLineNumber",1,s,!0),_n("lineNumberFormatter",function(e){return e},s,!0),_n("showCursorWhenSelecting",!1,ze,!0),_n("resetSelectionOnContextMenu",!0),_n("lineWiseCopyCut",!0),_n("readOnly",!1,function(e,t){"nocursor"==t?(pn(e),e.display.input.blur(),e.display.disabled=!0):(e.display.disabled=!1,t||e.display.input.reset())}),_n("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),_n("dragDrop",!0,_t),_n("cursorBlinkRate",530),_n("cursorScrollMargin",0),_n("cursorHeight",1,ze,!0),_n("singleCursorHeightPerLine",!0,ze,!0),_n("workTime",100),_n("workDelay",100),_n("flattenSpans",!0,r,!0),_n("addModeClass",!1,r,!0),_n("pollInterval",100),_n("undoDepth",200,function(e,t){e.doc.history.undoDepth=t}),_n("historyEventDelay",1250),_n("viewportMargin",10,function(e){e.refresh()},!0),_n("maxHighlightLength",1e4,r,!0),_n("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),_n("tabindex",null,function(e,t){e.display.input.getField().tabIndex=t||""}),_n("autofocus",null);var Yo=e.modes={},Zo=e.mimeModes={};e.defineMode=function(t,n){e.defaults.mode||"null"==t||(e.defaults.mode=t),arguments.length>2&&(n.dependencies=Array.prototype.slice.call(arguments,2)),Yo[t]=n},e.defineMIME=function(e,t){Zo[e]=t},e.resolveMode=function(t){if("string"==typeof t&&Zo.hasOwnProperty(t))t=Zo[t];else if(t&&"string"==typeof t.name&&Zo.hasOwnProperty(t.name)){var n=Zo[t.name];"string"==typeof n&&(n={name:n}),t=zi(n,t),t.name=n.name}else if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return e.resolveMode("application/xml");return"string"==typeof t?{name:t}:t||{name:"null"}},e.getMode=function(t,n){var n=e.resolveMode(n),r=Yo[n.name];if(!r)return e.getMode(t,"text/plain");var i=r(t,n);if(Qo.hasOwnProperty(n.name)){var o=Qo[n.name];for(var a in o)o.hasOwnProperty(a)&&(i.hasOwnProperty(a)&&(i["_"+a]=i[a]),i[a]=o[a])}if(i.name=n.name,n.helperType&&(i.helperType=n.helperType),n.modeProps)for(var a in n.modeProps)i[a]=n.modeProps[a];return i},e.defineMode("null",function(){return{token:function(e){e.skipToEnd()}}}),e.defineMIME("text/plain","null");var Qo=e.modeExtensions={};e.extendMode=function(e,t){var n=Qo.hasOwnProperty(e)?Qo[e]:Qo[e]={};Di(t,n)},e.defineExtension=function(t,n){e.prototype[t]=n},e.defineDocExtension=function(e,t){va.prototype[e]=t},e.defineOption=_n;var Jo=[];e.defineInitHook=function(e){Jo.push(e)};var ea=e.helpers={};e.registerHelper=function(t,n,r){ea.hasOwnProperty(t)||(ea[t]=e[t]={_global:[]}),ea[t][n]=r},e.registerGlobalHelper=function(t,n,r,i){e.registerHelper(t,n,i),ea[t]._global.push({pred:r,val:i})};var ta=e.copyState=function(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n},na=e.startState=function(e,t,n){return e.startState?e.startState(t,n):!0};e.innerMode=function(e,t){for(;e.innerMode;){var n=e.innerMode(t);if(!n||n.mode==e)break;t=n.state,e=n.mode}return n||{mode:e,state:t}};var ra=e.commands={selectAll:function(e){e.setSelection(Po(e.firstLine(),0),Po(e.lastLine()),Oa)},singleSelection:function(e){e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Oa)},killLine:function(e){Hn(e,function(t){if(t.empty()){var n=Kr(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:Po(t.head.line+1,0)}:{from:t.head,to:Po(t.head.line,n)}}return{from:t.from(),to:t.to()}})},deleteLine:function(e){Hn(e,function(t){return{from:Po(t.from().line,0),to:me(e.doc,Po(t.to().line+1,0))}})},delLineLeft:function(e){Hn(e,function(e){return{from:Po(e.from().line,0),to:e.from()}})},delWrappedLineLeft:function(e){Hn(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){Hn(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div");return{from:t.from(),to:r}})},undo:function(e){e.undo()},redo:function(e){e.redo()},undoSelection:function(e){e.undoSelection()},redoSelection:function(e){e.redoSelection()},goDocStart:function(e){e.extendSelection(Po(e.firstLine(),0))},goDocEnd:function(e){e.extendSelection(Po(e.lastLine()))},goLineStart:function(e){e.extendSelectionsBy(function(t){return to(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){e.extendSelectionsBy(function(t){return ro(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){e.extendSelectionsBy(function(t){return no(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){e.extendSelectionsBy(function(t){var n=e.charCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},Pa)},goLineLeft:function(e){e.extendSelectionsBy(function(t){var n=e.charCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:n},"div")},Pa)},goLineLeftSmart:function(e){e.extendSelectionsBy(function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return r.ch<e.getLine(r.line).search(/\S/)?ro(e,t.head):r},Pa)},goLineUp:function(e){e.moveV(-1,"line")},goLineDown:function(e){e.moveV(1,"line")},goPageUp:function(e){e.moveV(-1,"page")},goPageDown:function(e){e.moveV(1,"page")},goCharLeft:function(e){e.moveH(-1,"char")},goCharRight:function(e){e.moveH(1,"char")},goColumnLeft:function(e){e.moveH(-1,"column")},goColumnRight:function(e){e.moveH(1,"column")},goWordLeft:function(e){e.moveH(-1,"word")},goGroupRight:function(e){e.moveH(1,"group")},goGroupLeft:function(e){e.moveH(-1,"group")},goWordRight:function(e){e.moveH(1,"word")},delCharBefore:function(e){e.deleteH(-1,"char")},delCharAfter:function(e){e.deleteH(1,"char")},delWordBefore:function(e){e.deleteH(-1,"word")},delWordAfter:function(e){e.deleteH(1,"word")},delGroupBefore:function(e){e.deleteH(-1,"group")},delGroupAfter:function(e){e.deleteH(1,"group")},indentAuto:function(e){e.indentSelection("smart")},indentMore:function(e){e.indentSelection("add")},indentLess:function(e){e.indentSelection("subtract")},insertTab:function(e){e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],n=e.listSelections(),r=e.options.tabSize,i=0;i<n.length;i++){var o=n[i].from(),a=za(e.getLine(o.line),o.ch,r);t.push(new Array(r-a%r+1).join(" "))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){Tt(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){var i=t[r].head,o=Kr(e.doc,i.line).text;if(o)if(i.ch==o.length&&(i=new Po(i.line,i.ch-1)),i.ch>0)i=new Po(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),Po(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var a=Kr(e.doc,i.line-1).text;a&&e.replaceRange(o.charAt(0)+"\n"+a.charAt(a.length-1),Po(i.line-1,a.length-1),Po(i.line,1),"+transpose")}n.push(new fe(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){Tt(e,function(){for(var t=e.listSelections().length,n=0;t>n;n++){var r=e.listSelections()[n];e.replaceRange("\n",r.anchor,r.head,"+input"),e.indentLine(r.from().line+1,null,!0),Wn(e)}})},toggleOverwrite:function(e){e.toggleOverwrite()}},ia=e.keyMap={};ia.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},ia.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},ia.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"},ia.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},ia["default"]=So?ia.macDefault:ia.pcDefault,e.normalizeKeyMap=function(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if("..."==r){delete e[n];continue}for(var i=Ni(n.split(" "),Rn),o=0;o<i.length;o++){var a,l;o==i.length-1?(l=n,a=r):(l=i.slice(0,o+1).join(" "),a="...");var s=t[l];if(s){if(s!=a)throw new Error("Inconsistent bindings for "+l)}else t[l]=a}delete e[n]}for(var c in t)e[c]=t[c];return e};var oa=e.lookupKey=function(e,t,n,r){t=qn(t);var i=t.call?t.call(e,r):t[e];if(i===!1)return"nothing";if("..."===i)return"multi";if(null!=i&&n(i))return"handled";if(t.fallthrough){if("[object Array]"!=Object.prototype.toString.call(t.fallthrough))return oa(e,t.fallthrough,n,r);for(var o=0;o<t.fallthrough.length;o++){var a=oa(e,t.fallthrough[o],n,r);if(a)return a}}},aa=e.isModifierKey=function(e){var t="string"==typeof e?e:Ya[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t},la=e.keyName=function(e,t){if(yo&&34==e.keyCode&&e["char"])return!1;var n=Ya[e.keyCode],r=n;return null==r||e.altGraphKey?!1:(e.altKey&&"Alt"!=n&&(r="Alt-"+r),(To?e.metaKey:e.ctrlKey)&&"Ctrl"!=n&&(r="Ctrl-"+r),(To?e.ctrlKey:e.metaKey)&&"Cmd"!=n&&(r="Cmd-"+r),!t&&e.shiftKey&&"Shift"!=n&&(r="Shift-"+r),r)};e.fromTextArea=function(t,n){ +function r(){t.value=c.getValue()}if(n=n?Di(n):{},n.value=t.value,!n.tabindex&&t.tabIndex&&(n.tabindex=t.tabIndex),!n.placeholder&&t.placeholder&&(n.placeholder=t.placeholder),null==n.autofocus){var i=_i();n.autofocus=i==t||null!=t.getAttribute("autofocus")&&i==document.body}if(t.form&&(Ca(t.form,"submit",r),!n.leaveSubmitMethodAlone)){var o=t.form,a=o.submit;try{var l=o.submit=function(){r(),o.submit=a,o.submit(),o.submit=l}}catch(s){}}n.finishInit=function(e){e.save=r,e.getTextArea=function(){return t},e.toTextArea=function(){e.toTextArea=isNaN,r(),t.parentNode.removeChild(e.getWrapperElement()),t.style.display="",t.form&&(Sa(t.form,"submit",r),"function"==typeof t.form.submit&&(t.form.submit=a))}},t.style.display="none";var c=e(function(e){t.parentNode.insertBefore(e,t.nextSibling)},n);return c};var sa=e.StringStream=function(e,t){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0};sa.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==this.lineStart},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(e){var t=this.string.charAt(this.pos);if("string"==typeof e)var n=t==e;else var n=t&&(e.test?e.test(t):e(t));return n?(++this.pos,t):void 0},eatWhile:function(e){for(var t=this.pos;this.eat(e););return this.pos>t},eatSpace:function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},skipToEnd:function(){this.pos=this.string.length},skipTo:function(e){var t=this.string.indexOf(e,this.pos);return t>-1?(this.pos=t,!0):void 0},backUp:function(e){this.pos-=e},column:function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=za(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?za(this.string,this.lineStart,this.tabSize):0)},indentation:function(){return za(this.string,null,this.tabSize)-(this.lineStart?za(this.string,this.lineStart,this.tabSize):0)},match:function(e,t,n){if("string"!=typeof e){var r=this.string.slice(this.pos).match(e);return r&&r.index>0?null:(r&&t!==!1&&(this.pos+=r[0].length),r)}var i=function(e){return n?e.toLowerCase():e},o=this.string.substr(this.pos,e.length);return i(o)==i(e)?(t!==!1&&(this.pos+=e.length),!0):void 0},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}}};var ca=0,ua=e.TextMarker=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ca};Si(ua),ua.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&yt(e),Ci(this,"clear")){var n=this.find();n&&bi(this,"clear",n.from,n.to)}for(var r=null,i=null,o=0;o<this.lines.length;++o){var a=this.lines[o],l=Yn(a.markedSpans,this);e&&!this.collapsed?Wt(e,Zr(a),"text"):e&&(null!=l.to&&(i=Zr(a)),null!=l.from&&(r=Zr(a))),a.markedSpans=Zn(a.markedSpans,l),null==l.from&&this.collapsed&&!yr(this.doc,a)&&e&&Yr(a,gt(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var o=0;o<this.lines.length;++o){var s=pr(this.lines[o]),c=f(s);c>e.display.maxLineLength&&(e.display.maxLine=s,e.display.maxLineLength=c,e.display.maxLineChanged=!0)}null!=r&&e&&this.collapsed&&Dt(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Oe(e.doc)),e&&bi(e,"markerCleared",e,this),t&&xt(e),this.parent&&this.parent.clear()}},ua.prototype.find=function(e,t){null==e&&"bookmark"==this.type&&(e=1);for(var n,r,i=0;i<this.lines.length;++i){var o=this.lines[i],a=Yn(o.markedSpans,this);if(null!=a.from&&(n=Po(t?o:Zr(o),a.from),-1==e))return n;if(null!=a.to&&(r=Po(t?o:Zr(o),a.to),1==e))return r}return n&&{from:n,to:r}},ua.prototype.changed=function(){var e=this.find(-1,!0),t=this,n=this.doc.cm;e&&n&&Tt(n,function(){var r=e.line,i=Zr(e.line),o=Ze(n,i);if(o&&(rt(o),n.curOp.selectionChanged=n.curOp.forceUpdate=!0),n.curOp.updateMaxLine=!0,!yr(t.doc,r)&&null!=t.height){var a=t.height;t.height=null;var l=wr(t)-a;l&&Yr(r,r.height+l)}})},ua.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=Oi(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},ua.prototype.detachLine=function(e){if(this.lines.splice(Oi(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}};var ca=0,fa=e.SharedTextMarker=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};Si(fa),fa.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();bi(this,"clear")}},fa.prototype.find=function(e,t){return this.primary.find(e,t)};var da=e.LineWidget=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};Si(da),da.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=Zr(n);if(null!=r&&t){for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(n.widgets=null);var o=wr(this);Yr(n,Math.max(0,n.height-o)),e&&Tt(e,function(){xr(e,n,-o),Wt(e,r,"widget")})}},da.prototype.changed=function(){var e=this.height,t=this.doc.cm,n=this.line;this.height=null;var r=wr(this)-e;r&&(Yr(n,n.height+r),t&&Tt(t,function(){t.curOp.forceUpdate=!0,xr(t,n,r)}))};var ha=e.Line=function(e,t,n){this.text=e,ar(this,t),this.height=n?n(this):1};Si(ha),ha.prototype.lineNo=function(){return Zr(this)};var pa={},ma={};qr.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;r>n;++n){var i=this.lines[n];this.height-=i.height,Sr(i),bi(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,n){for(var r=e+t;r>e;++e)if(n(this.lines[e]))return!0}},Ur.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var r=this.children[n],i=r.chunkSize();if(i>e){var o=Math.min(t,i-e),a=r.height;if(r.removeInner(e,o),this.height-=a-r.height,i==o&&(this.children.splice(n--,1),r.parent=null),0==(t-=o))break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof qr))){var l=[];this.collapse(l),this.children=[new qr(l)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],o=i.chunkSize();if(o>=e){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(;i.lines.length>50;){var a=i.lines.splice(i.lines.length-25,25),l=new qr(a);i.height-=l.height,this.children.splice(r+1,0,l),l.parent=this}this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new Ur(t);if(e.parent){e.size-=n.size,e.height-=n.height;var r=Oi(e.parent.children,e);e.parent.children.splice(r+1,0,n)}else{var i=new Ur(e.children);i.parent=e,e.children=[i,n],e=i}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,n){for(var r=0;r<this.children.length;++r){var i=this.children[r],o=i.chunkSize();if(o>e){var a=Math.min(t,o-e);if(i.iterN(e,a,n))return!0;if(0==(t-=a))break;e=0}else e-=o}}};var ga=0,va=e.Doc=function(e,t,n){if(!(this instanceof va))return new va(e,t,n);null==n&&(n=0),Ur.call(this,[new qr([new ha("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.frontier=n;var r=Po(n,0);this.sel=he(r),this.history=new ti(null),this.id=++ga,this.modeOption=t,"string"==typeof e&&(e=Ga(e)),Rr(this,{from:r,to:r,text:e}),Me(this,he(r),Oa)};va.prototype=zi(Ur.prototype,{constructor:va,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,r=0;r<t.length;++r)n+=t[r].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=Xr(this,this.first,this.first+this.size);return e===!1?t:t.join(e||"\n")},setValue:Nt(function(e){var t=Po(this.first,0),n=this.first+this.size-1;kn(this,{from:t,to:Po(n,Kr(this,n).text.length),text:Ga(e),origin:"setValue",full:!0},!0),Me(this,he(t))}),replaceRange:function(e,t,n,r){t=me(this,t),n=n?me(this,n):t,An(this,e,t,n,r)},getRange:function(e,t,n){var r=$r(this,me(this,e),me(this,t));return n===!1?r:r.join(n||"\n")},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){return ve(this,e)?Kr(this,e):void 0},getLineNumber:function(e){return Zr(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=Kr(this,e)),pr(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return me(this,e)},getCursor:function(e){var t,n=this.sel.primary();return t=null==e||"head"==e?n.head:"anchor"==e?n.anchor:"end"==e||"to"==e||e===!1?n.to():n.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Nt(function(e,t,n){Ce(this,me(this,"number"==typeof e?Po(e,t||0):e),null,n)}),setSelection:Nt(function(e,t,n){Ce(this,me(this,e),me(this,t||e),n)}),extendSelection:Nt(function(e,t,n){xe(this,me(this,e),t&&me(this,t),n)}),extendSelections:Nt(function(e,t){we(this,ye(this,e,t))}),extendSelectionsBy:Nt(function(e,t){we(this,Ni(this.sel.ranges,e),t)}),setSelections:Nt(function(e,t,n){if(e.length){for(var r=0,i=[];r<e.length;r++)i[r]=new fe(me(this,e[r].anchor),me(this,e[r].head));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),Me(this,de(i,t),n)}}),addSelection:Nt(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new fe(me(this,e),me(this,t||e))),Me(this,de(r,r.length-1),n)}),getSelection:function(e){for(var t,n=this.sel.ranges,r=0;r<n.length;r++){var i=$r(this,n[r].from(),n[r].to());t=t?t.concat(i):i}return e===!1?t:t.join(e||"\n")},getSelections:function(e){for(var t=[],n=this.sel.ranges,r=0;r<n.length;r++){var i=$r(this,n[r].from(),n[r].to());e!==!1&&(i=i.join(e||"\n")),t[r]=i}return t},replaceSelection:function(e,t,n){for(var r=[],i=0;i<this.sel.ranges.length;i++)r[i]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:Nt(function(e,t,n){for(var r=[],i=this.sel,o=0;o<i.ranges.length;o++){var a=i.ranges[o];r[o]={from:a.from(),to:a.to(),text:Ga(e[o]),origin:n}}for(var l=t&&"end"!=t&&xn(this,r,t),o=r.length-1;o>=0;o--)kn(this,r[o]);l?Le(this,l):this.cm&&Wn(this.cm)}),undo:Nt(function(){Sn(this,"undo")}),redo:Nt(function(){Sn(this,"redo")}),undoSelection:Nt(function(){Sn(this,"undo",!0)}),redoSelection:Nt(function(){Sn(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var r=0;r<e.undone.length;r++)e.undone[r].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){this.history=new ti(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:di(this.history.done),undone:di(this.history.undone)}},setHistory:function(e){var t=this.history=new ti(this.history.maxGeneration);t.done=di(e.done.slice(0),null,!0),t.undone=di(e.undone.slice(0),null,!0)},addLineClass:Nt(function(e,t,n){return Fn(this,e,"gutter"==t?"gutter":"class",function(e){var r="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass";if(e[r]){if(Ri(n).test(e[r]))return!1;e[r]+=" "+n}else e[r]=n;return!0})}),removeLineClass:Nt(function(e,t,n){return Fn(this,e,"gutter"==t?"gutter":"class",function(e){var r="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass",i=e[r];if(!i)return!1;if(null==n)e[r]=null;else{var o=i.match(Ri(n));if(!o)return!1;var a=o.index+o[0].length;e[r]=i.slice(0,o.index)+(o.index&&a!=i.length?" ":"")+i.slice(a)||null}return!0})}),addLineWidget:Nt(function(e,t,n){return kr(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return Un(this,me(this,e),me(this,t),n,"range")},setBookmark:function(e,t){var n={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=me(this,e),Un(this,e,e,n,"bookmark")},findMarksAt:function(e){e=me(this,e);var t=[],n=Kr(this,e.line).markedSpans;if(n)for(var r=0;r<n.length;++r){var i=n[r];(null==i.from||i.from<=e.ch)&&(null==i.to||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=me(this,e),t=me(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(o){var a=o.markedSpans;if(a)for(var l=0;l<a.length;l++){var s=a[l];i==e.line&&e.ch>s.to||null==s.from&&i!=e.line||i==t.line&&s.from>t.ch||n&&!n(s.marker)||r.push(s.marker.parent||s.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;r<n.length;++r)null!=n[r].from&&e.push(n[r].marker)}),e},posFromIndex:function(e){var t,n=this.first;return this.iter(function(r){var i=r.text.length+1;return i>e?(t=e,!0):(e-=i,void++n)}),me(this,Po(n,t))},indexFromPos:function(e){e=me(this,e);var t=e.ch;return e.line<this.first||e.ch<0?0:(this.iter(this.first,e.line,function(e){t+=e.text.length+1}),t)},copy:function(e){var t=new va(Xr(this,this.first,this.first+this.size),this.modeOption,this.first);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,n=this.first+this.size;null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&e.to<n&&(n=e.to);var r=new va(Xr(this,t,n),e.mode||this.modeOption,t);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Kn(r,Gn(this)),r},unlinkDoc:function(t){if(t instanceof e&&(t=t.doc),this.linked)for(var n=0;n<this.linked.length;++n){var r=this.linked[n];if(r.doc==t){this.linked.splice(n,1),t.unlinkDoc(this),$n(Gn(this));break}}if(t.history==this.history){var i=[t.id];Vr(t,function(e){i.push(e.id)},!0),t.history=new ti(null),t.history.done=di(this.history.done,i),t.history.undone=di(this.history.undone,i)}},iterLinkedDocs:function(e){Vr(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm}}),va.prototype.eachLine=va.prototype.iter;var ya="iter insert remove copy getEditor".split(" ");for(var ba in va.prototype)va.prototype.hasOwnProperty(ba)&&Oi(ya,ba)<0&&(e.prototype[ba]=function(e){return function(){return e.apply(this.doc,arguments)}}(va.prototype[ba]));Si(va);var xa=e.e_preventDefault=function(e){e.preventDefault?e.preventDefault():e.returnValue=!1},wa=e.e_stopPropagation=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},ka=e.e_stop=function(e){xa(e),wa(e)},Ca=e.on=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={}),i=r[t]||(r[t]=[]);i.push(n)}},Sa=e.off=function(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers&&e._handlers[t];if(!r)return;for(var i=0;i<r.length;++i)if(r[i]==n){r.splice(i,1);break}}},La=e.signal=function(e,t){var n=e._handlers&&e._handlers[t];if(n)for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)},Ma=null,Ta=30,Aa=e.Pass={toString:function(){return"CodeMirror.Pass"}},Oa={scroll:!1},Na={origin:"*mouse"},Pa={origin:"+move"};Li.prototype.set=function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)};var za=e.countColumn=function(e,t,n,r,i){null==t&&(t=e.search(/[^\s\u00a0]/),-1==t&&(t=e.length));for(var o=r||0,a=i||0;;){var l=e.indexOf(" ",o);if(0>l||l>=t)return a+(t-o);a+=l-o,a+=n-a%n,o=l+1}},Da=[""],Wa=function(e){e.select()};ko?Wa=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:ho&&(Wa=function(e){try{e.select()}catch(t){}});var Ea,Ia=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Fa=e.isWordChar=function(e){return/\w/.test(e)||e>""&&(e.toUpperCase()!=e.toLowerCase()||Ia.test(e))},Ha=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;Ea=document.createRange?function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(i){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};var Ba=e.contains=function(e,t){if(3==t.nodeType&&(t=t.parentNode),e.contains)return e.contains(t);do if(11==t.nodeType&&(t=t.host),t==e)return!0;while(t=t.parentNode)};ho&&11>po&&(_i=function(){try{return document.activeElement}catch(e){return document.body}});var ja,_a,Ra=e.rmClass=function(e,t){var n=e.className,r=Ri(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}},qa=e.addClass=function(e,t){var n=e.className;Ri(t).test(n)||(e.className+=(n?" ":"")+t)},Ua=!1,Va=function(){if(ho&&9>po)return!1;var e=Hi("div");return"draggable"in e||"dragDrop"in e}(),Ga=e.splitLines=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,n=[],r=e.length;r>=t;){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),a=o.indexOf("\r");-1!=a?(n.push(o.slice(0,a)),t+=a+1):(n.push(o),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},Ka=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){try{var t=e.ownerDocument.selection.createRange()}catch(n){}return t&&t.parentElement()==e?0!=t.compareEndPoints("StartToEnd",t):!1},$a=function(){var e=Hi("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy)}(),Xa=null,Ya={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",107:"=",109:"-",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};e.keyNames=Ya,function(){for(var e=0;10>e;e++)Ya[e+48]=Ya[e+96]=String(e);for(var e=65;90>=e;e++)Ya[e]=String.fromCharCode(e);for(var e=1;12>=e;e++)Ya[e+111]=Ya[e+63235]="F"+e}();var Za,Qa=function(){function e(e){return 247>=e?n.charAt(e):e>=1424&&1524>=e?"R":e>=1536&&1773>=e?r.charAt(e-1536):e>=1774&&2220>=e?"r":e>=8192&&8203>=e?"w":8204==e?"b":"L"}function t(e,t,n){this.level=e,this.from=t,this.to=n}var n="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",r="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,o=/[stwN]/,a=/[LRr]/,l=/[Lb1n]/,s=/[1n]/,c="L";return function(n){if(!i.test(n))return!1;for(var r,u=n.length,f=[],d=0;u>d;++d)f.push(r=e(n.charCodeAt(d)));for(var d=0,h=c;u>d;++d){var r=f[d];"m"==r?f[d]=h:h=r}for(var d=0,p=c;u>d;++d){var r=f[d];"1"==r&&"r"==p?f[d]="n":a.test(r)&&(p=r,"r"==r&&(f[d]="R"))}for(var d=1,h=f[0];u-1>d;++d){var r=f[d];"+"==r&&"1"==h&&"1"==f[d+1]?f[d]="1":","!=r||h!=f[d+1]||"1"!=h&&"n"!=h||(f[d]=h),h=r}for(var d=0;u>d;++d){var r=f[d];if(","==r)f[d]="N";else if("%"==r){for(var m=d+1;u>m&&"%"==f[m];++m);for(var g=d&&"!"==f[d-1]||u>m&&"1"==f[m]?"1":"N",v=d;m>v;++v)f[v]=g;d=m-1}}for(var d=0,p=c;u>d;++d){var r=f[d];"L"==p&&"1"==r?f[d]="L":a.test(r)&&(p=r)}for(var d=0;u>d;++d)if(o.test(f[d])){for(var m=d+1;u>m&&o.test(f[m]);++m);for(var y="L"==(d?f[d-1]:c),b="L"==(u>m?f[m]:c),g=y||b?"L":"R",v=d;m>v;++v)f[v]=g;d=m-1}for(var x,w=[],d=0;u>d;)if(l.test(f[d])){var k=d;for(++d;u>d&&l.test(f[d]);++d);w.push(new t(0,k,d))}else{var C=d,S=w.length;for(++d;u>d&&"L"!=f[d];++d);for(var v=C;d>v;)if(s.test(f[v])){v>C&&w.splice(S,0,new t(1,C,v));var L=v;for(++v;d>v&&s.test(f[v]);++v);w.splice(S,0,new t(2,L,v)),C=v}else++v;d>C&&w.splice(S,0,new t(1,C,d))}return 1==w[0].level&&(x=n.match(/^\s+/))&&(w[0].from=x[0].length,w.unshift(new t(0,0,x[0].length))),1==Ai(w).level&&(x=n.match(/\s+$/))&&(Ai(w).to-=x[0].length,w.push(new t(0,u-x[0].length,u))),2==w[0].level&&w.unshift(new t(1,w[0].to,w[0].to)),w[0].level!=Ai(w).level&&w.push(new t(w[0].level,u,u)),w}}();return e.version="5.2.0",e}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.overlayMode=function(t,n,r){return{startState:function(){return{base:e.startState(t),overlay:e.startState(n),basePos:0,baseCur:null,overlayPos:0,overlayCur:null,streamSeen:null}},copyState:function(r){return{base:e.copyState(t,r.base),overlay:e.copyState(n,r.overlay),basePos:r.basePos,baseCur:null,overlayPos:r.overlayPos,overlayCur:null}},token:function(e,i){return(e!=i.streamSeen||Math.min(i.basePos,i.overlayPos)<e.start)&&(i.streamSeen=e,i.basePos=i.overlayPos=e.start),e.start==i.basePos&&(i.baseCur=t.token(e,i.base),i.basePos=e.pos),e.start==i.overlayPos&&(e.pos=e.start,i.overlayCur=n.token(e,i.overlay),i.overlayPos=e.pos),e.pos=Math.min(i.basePos,i.overlayPos),null==i.overlayCur?i.baseCur:null!=i.baseCur&&i.overlay.combineTokens||r&&null==i.overlay.combineTokens?i.baseCur+" "+i.overlayCur:i.overlayCur},indent:t.indent&&function(e,n){return t.indent(e.base,n)},electricChars:t.electricChars,innerMode:function(e){return{state:e.base,mode:t}},blankLine:function(e){t.blankLine&&t.blankLine(e.base),n.blankLine&&n.blankLine(e.overlay)}}}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){for(var t=0;t<e.state.activeLines.length;t++)e.removeLineClass(e.state.activeLines[t],"wrap",o),e.removeLineClass(e.state.activeLines[t],"background",a)}function n(e,t){if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function r(e,r){for(var i=[],l=0;l<r.length;l++){var s=r[l];if(s.empty()){var c=e.getLineHandleVisualStart(s.head.line);i[i.length-1]!=c&&i.push(c)}}n(e.state.activeLines,i)||e.operation(function(){t(e);for(var n=0;n<i.length;n++)e.addLineClass(i[n],"wrap",o),e.addLineClass(i[n],"background",a);e.state.activeLines=i})}function i(e,t){r(e,t.ranges)}var o="CodeMirror-activeline",a="CodeMirror-activeline-background";e.defineOption("styleActiveLine",!1,function(n,o,a){var l=a&&a!=e.Init;o&&!l?(n.state.activeLines=[],r(n,n.listSelections()),n.on("beforeSelectionChange",i)):!o&&l&&(n.off("beforeSelectionChange",i),t(n),delete n.state.activeLines)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,i,o){if(this.atOccurrence=!1,this.doc=e,null==o&&"string"==typeof t&&(o=!1),i=i?e.clipPos(i):r(0,0),this.pos={from:i,to:i},"string"!=typeof t)t.global||(t=new RegExp(t.source,t.ignoreCase?"ig":"g")),this.matches=function(n,i){if(n){t.lastIndex=0;for(var o,a,l=e.getLine(i.line).slice(0,i.ch),s=0;;){t.lastIndex=s;var c=t.exec(l);if(!c)break;if(o=c,a=o.index,s=o.index+(o[0].length||1),s==l.length)break}var u=o&&o[0].length||0;u||(0==a&&0==l.length?o=void 0:a!=e.getLine(i.line).length&&u++)}else{t.lastIndex=i.ch;var l=e.getLine(i.line),o=t.exec(l),u=o&&o[0].length||0,a=o&&o.index;a+u==l.length||u||(u=1)}return o&&u?{from:r(i.line,a),to:r(i.line,a+u),match:o}:void 0};else{var a=t;o&&(t=t.toLowerCase());var l=o?function(e){return e.toLowerCase()}:function(e){return e},s=t.split("\n");if(1==s.length)t.length?this.matches=function(i,o){if(i){var s=e.getLine(o.line).slice(0,o.ch),c=l(s),u=c.lastIndexOf(t);if(u>-1)return u=n(s,c,u),{from:r(o.line,u),to:r(o.line,u+a.length)}}else{var s=e.getLine(o.line).slice(o.ch),c=l(s),u=c.indexOf(t);if(u>-1)return u=n(s,c,u)+o.ch,{from:r(o.line,u),to:r(o.line,u+a.length)}}}:this.matches=function(){};else{var c=a.split("\n");this.matches=function(t,n){var i=s.length-1;if(t){if(n.line-(s.length-1)<e.firstLine())return;if(l(e.getLine(n.line).slice(0,c[i].length))!=s[s.length-1])return;for(var o=r(n.line,c[i].length),a=n.line-1,u=i-1;u>=1;--u,--a)if(s[u]!=l(e.getLine(a)))return;var f=e.getLine(a),d=f.length-c[0].length;if(l(f.slice(d))!=s[0])return;return{from:r(a,d),to:o}}if(!(n.line+(s.length-1)>e.lastLine())){var f=e.getLine(n.line),d=f.length-c[0].length;if(l(f.slice(d))==s[0]){for(var h=r(n.line,d),a=n.line+1,u=1;i>u;++u,++a)if(s[u]!=l(e.getLine(a)))return;if(l(e.getLine(a).slice(0,c[i].length))==s[i])return{from:h,to:r(a,c[i].length)}}}}}}}function n(e,t,n){if(e.length==t.length)return n;for(var r=Math.min(n,e.length);;){var i=e.slice(0,r).toLowerCase().length;if(n>i)++r;else{if(!(i>n))return r;--r}}}var r=e.Pos;t.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(e){function t(e){var t=r(e,0);return n.pos={from:t,to:t},n.atOccurrence=!1,!1}for(var n=this,i=this.doc.clipPos(e?this.pos.from:this.pos.to);;){if(this.pos=this.matches(e,i))return this.atOccurrence=!0,this.pos.match||!0;if(e){if(!i.line)return t(0);i=r(i.line-1,this.doc.getLine(i.line-1).length)}else{var o=this.doc.lineCount();if(i.line==o-1)return t(o);i=r(i.line+1,0)}}},from:function(){return this.atOccurrence?this.pos.from:void 0},to:function(){return this.atOccurrence?this.pos.to:void 0},replace:function(t,n){if(this.atOccurrence){var i=e.splitLines(t);this.doc.replaceRange(i,this.pos.from,this.pos.to,n),this.pos.to=r(this.pos.from.line+i.length-1,i[i.length-1].length+(1==i.length?this.pos.from.ch:0))}}},e.defineExtension("getSearchCursor",function(e,n,r){return new t(this.doc,e,n,r)}),e.defineDocExtension("getSearchCursor",function(e,n,r){return new t(this,e,n,r)}),e.defineExtension("selectMatches",function(t,n){for(var r,i=[],o=this.getSearchCursor(t,this.getCursor("from"),n);(r=o.findNext())&&!(e.cmpPos(o.to(),this.getCursor("to"))>0);)i.push({anchor:o.from(),head:o.to()});i.length&&this.setSelections(i,0)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./searchcursor"),require("../dialog/dialog")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./searchcursor","../dialog/dialog"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t){return"string"==typeof e?e=new RegExp(e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),t?"gi":"g"):e.global||(e=new RegExp(e.source,e.ignoreCase?"gi":"g")),{token:function(t){e.lastIndex=t.pos;var n=e.exec(t.string);return n&&n.index==t.pos?(t.pos+=n[0].length,"searching"):void(n?t.pos=n.index:t.skipToEnd())}}}function n(){this.posFrom=this.posTo=this.lastQuery=this.query=null,this.overlay=null}function r(e){return e.state.search||(e.state.search=new n)}function i(e){return"string"==typeof e&&e==e.toLowerCase()}function o(e,t,n){return e.getSearchCursor(t,n,i(t))}function a(e,t,n,r,i){e.openDialog?e.openDialog(t,i,{value:r,selectValueOnOpen:!0}):i(prompt(n,r))}function l(e,t,n,r){e.openConfirm?e.openConfirm(t,r):confirm(n)&&r[0]()}function s(e){var t=e.match(/^\/(.*)\/([a-z]*)$/);if(t)try{e=new RegExp(t[1],-1==t[2].indexOf("i")?"":"i")}catch(n){}return("string"==typeof e?""==e:e.test(""))&&(e=/x^/),e}function c(e,n){var o=r(e);if(o.query)return u(e,n);var l=e.getSelection()||o.lastQuery;a(e,h,"Search for:",l,function(r){e.operation(function(){r&&!o.query&&(o.query=s(r),e.removeOverlay(o.overlay,i(o.query)),o.overlay=t(o.query,i(o.query)),e.addOverlay(o.overlay),e.showMatchesOnScrollbar&&(o.annotate&&(o.annotate.clear(),o.annotate=null),o.annotate=e.showMatchesOnScrollbar(o.query,i(o.query))),o.posFrom=o.posTo=e.getCursor(),u(e,n))})})}function u(t,n){t.operation(function(){var i=r(t),a=o(t,i.query,n?i.posFrom:i.posTo);(a.find(n)||(a=o(t,i.query,n?e.Pos(t.lastLine()):e.Pos(t.firstLine(),0)),a.find(n)))&&(t.setSelection(a.from(),a.to()),t.scrollIntoView({from:a.from(),to:a.to()}),i.posFrom=a.from(),i.posTo=a.to())})}function f(e){e.operation(function(){var t=r(e);t.lastQuery=t.query,t.query&&(t.query=null,e.removeOverlay(t.overlay),t.annotate&&(t.annotate.clear(),t.annotate=null))})}function d(e,t){if(!e.getOption("readOnly")){var n=e.getSelection()||r(e).lastQuery;a(e,p,"Replace:",n,function(n){n&&(n=s(n),a(e,m,"Replace with:","",function(r){if(t)e.operation(function(){for(var t=o(e,n);t.findNext();)if("string"!=typeof n){var i=e.getRange(t.from(),t.to()).match(n);t.replace(r.replace(/\$(\d)/g,function(e,t){return i[t]}),"+input")}else t.replace(r,"+input")});else{f(e); -}function r(r){r.state.failedTagMatch=!1,r.operation(function(){if(t(r),!r.somethingSelected()){var n=r.getCursor(),i=r.getViewport();i.from=Math.min(i.from,n.line),i.to=Math.max(n.line+1,i.to);var o=e.findMatchingTag(r,n,i);if(o){if(r.state.matchBothTags){var a="open"==o.at?o.open:o.close;a&&(r.state.tagHit=r.markText(a.from,a.to,{className:"CodeMirror-matchingtag"}))}var l="close"==o.at?o.open:o.close;l?r.state.tagOther=r.markText(l.from,l.to,{className:"CodeMirror-matchingtag"}):r.state.failedTagMatch=!0}}})}function n(e){e.state.failedTagMatch&&r(e)}e.defineOption("matchTags",!1,function(i,o,a){a&&a!=e.Init&&(i.off("cursorActivity",r),i.off("viewportChange",n),t(i)),o&&(i.state.matchBothTags="object"==typeof o&&o.bothTags,i.on("cursorActivity",r),i.on("viewportChange",n),r(i))}),e.commands.toMatchingTag=function(t){var r=e.findMatchingTag(t,t.getCursor());if(r){var n="close"==r.at?r.open:r.close;n&&t.extendSelection(n.to,n.from)}}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../fold/xml-fold")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../fold/xml-fold"],e):e(CodeMirror)}(function(e){function t(t){if(t.getOption("disableInput"))return e.Pass;for(var r=t.listSelections(),n=[],s=0;s<r.length;s++){if(!r[s].empty())return e.Pass;var c=r[s].head,u=t.getTokenAt(c),d=e.innerMode(t.getMode(),u.state),f=d.state;if("xml"!=d.mode.name||!f.tagName)return e.Pass;var h=t.getOption("autoCloseTags"),p="html"==d.mode.configuration,m="object"==typeof h&&h.dontCloseTags||p&&a,g="object"==typeof h&&h.indentTags||p&&l,v=f.tagName;u.end>c.ch&&(v=v.slice(0,v.length-u.end+c.ch));var y=v.toLowerCase();if(!v||"string"==u.type&&(u.end!=c.ch||!/[\"\']/.test(u.string.charAt(u.string.length-1))||1==u.string.length)||"tag"==u.type&&"closeTag"==f.type||u.string.indexOf("/")==u.string.length-1||m&&i(m,y)>-1||o(t,v,c,f,!0))return e.Pass;var b=g&&i(g,y)>-1;n[s]={indent:b,text:">"+(b?"\n\n":"")+"</"+v+">",newPos:b?e.Pos(c.line+1,0):e.Pos(c.line,c.ch+1)}}for(var s=r.length-1;s>=0;s--){var x=n[s];t.replaceRange(x.text,r[s].head,r[s].anchor,"+input");var w=t.listSelections().slice(0);w[s]={head:x.newPos,anchor:x.newPos},t.setSelections(w),x.indent&&(t.indentLine(x.newPos.line,null,!0),t.indentLine(x.newPos.line+1,null,!0))}}function r(t,r){for(var n=t.listSelections(),i=[],a=r?"/":"</",l=0;l<n.length;l++){if(!n[l].empty())return e.Pass;var s=n[l].head,c=t.getTokenAt(s),u=e.innerMode(t.getMode(),c.state),d=u.state;if(r&&("string"==c.type||"<"!=c.string.charAt(0)||c.start!=s.ch-1))return e.Pass;if("xml"!=u.mode.name)if("htmlmixed"==t.getMode().name&&"javascript"==u.mode.name)i[l]=a+"script>";else{if("htmlmixed"!=t.getMode().name||"css"!=u.mode.name)return e.Pass;i[l]=a+"style>"}else{if(!d.context||!d.context.tagName||o(t,d.context.tagName,s,d))return e.Pass;i[l]=a+d.context.tagName+">"}}t.replaceSelections(i,null,"+input"),n=t.listSelections();for(var l=0;l<n.length;l++)(l==n.length-1||n[l].head.line<n[l+1].head.line)&&t.indentLine(n[l].head.line)}function n(t){return t.getOption("disableInput")?e.Pass:r(t,!0)}function i(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0,n=e.length;n>r;++r)if(e[r]==t)return r;return-1}function o(t,r,n,i,o){if(!e.scanForClosingTag)return!1;var a=Math.min(t.lastLine()+1,n.line+500),l=e.scanForClosingTag(t,n,null,a);if(!l||l.tag!=r)return!1;for(var s=i.context,c=o?1:0;s&&s.tagName==r;s=s.prev)++c;n=l.to;for(var u=1;c>u;u++){var d=e.scanForClosingTag(t,n,null,a);if(!d||d.tag!=r)return!1;n=d.to}return!0}e.defineOption("autoCloseTags",!1,function(r,i,o){if(o!=e.Init&&o&&r.removeKeyMap("autoCloseTags"),i){var a={name:"autoCloseTags"};("object"!=typeof i||i.whenClosing)&&(a["'/'"]=function(e){return n(e)}),("object"!=typeof i||i.whenOpening)&&(a["'>'"]=function(e){return t(e)}),r.addKeyMap(a)}});var a=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],l=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];e.commands.closeTag=function(e){return r(e)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";var t=/^(\s*)(>[> ]*|[*+-]\s|(\d+)\.)(\s*)/,r=/^(\s*)(>[> ]*|[*+-]|(\d+)\.)(\s*)$/,n=/[*+-]\s/;e.commands.newlineAndIndentContinueMarkdownList=function(i){if(i.getOption("disableInput"))return e.Pass;for(var o=i.listSelections(),a=[],l=0;l<o.length;l++){var s=o[l].head,c=i.getStateAfter(s.line),u=c.list!==!1,d=0!==c.quote,f=i.getLine(s.line),h=t.exec(f);if(!o[l].empty()||!u&&!d||!h)return void i.execCommand("newlineAndIndent");if(r.test(f))i.replaceRange("",{line:s.line,ch:0},{line:s.line,ch:s.ch+1},"+delete"),a[l]="\n";else{var p=h[1],m=h[4],g=n.test(h[2])||h[2].indexOf(">")>=0?h[2]:parseInt(h[3],10)+1+".";a[l]="\n"+p+g+m}}i.replaceSelections(a,null,"+input")}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(t,i,o,a){function l(e){var r=s(t,i);if(!r||r.to.line-r.from.line<c)return null;for(var n=t.findMarksAt(r.from),o=0;o<n.length;++o)if(n[o].__isFold&&"fold"!==a){if(!e)return null;r.cleared=!0,n[o].clear()}return r}if(o&&o.call){var s=o;o=null}else var s=n(t,o,"rangeFinder");"number"==typeof i&&(i=e.Pos(i,0));var c=n(t,o,"minFoldSize"),u=l(!0);if(n(t,o,"scanUp"))for(;!u&&i.line>t.firstLine();)i=e.Pos(i.line-1,0),u=l(!1);if(u&&!u.cleared&&"unfold"!==a){var d=r(t,o);e.on(d,"mousedown",function(t){f.clear(),e.e_preventDefault(t)});var f=t.markText(u.from,u.to,{replacedWith:d,clearOnEnter:!0,__isFold:!0});f.on("clear",function(r,n){e.signal(t,"unfold",t,r,n)}),e.signal(t,"fold",t,u.from,u.to)}}function r(e,t){var r=n(e,t,"widget");if("string"==typeof r){var i=document.createTextNode(r);r=document.createElement("span"),r.appendChild(i),r.className="CodeMirror-foldmarker"}return r}function n(e,t,r){if(t&&void 0!==t[r])return t[r];var n=e.options.foldOptions;return n&&void 0!==n[r]?n[r]:i[r]}e.newFoldFunction=function(e,r){return function(n,i){t(n,i,{rangeFinder:e,widget:r})}},e.defineExtension("foldCode",function(e,r,n){t(this,e,r,n)}),e.defineExtension("isFolded",function(e){for(var t=this.findMarksAt(e),r=0;r<t.length;++r)if(t[r].__isFold)return!0}),e.commands.toggleFold=function(e){e.foldCode(e.getCursor())},e.commands.fold=function(e){e.foldCode(e.getCursor(),null,"fold")},e.commands.unfold=function(e){e.foldCode(e.getCursor(),null,"unfold")},e.commands.foldAll=function(t){t.operation(function(){for(var r=t.firstLine(),n=t.lastLine();n>=r;r++)t.foldCode(e.Pos(r,0),null,"fold")})},e.commands.unfoldAll=function(t){t.operation(function(){for(var r=t.firstLine(),n=t.lastLine();n>=r;r++)t.foldCode(e.Pos(r,0),null,"unfold")})},e.registerHelper("fold","combine",function(){var e=Array.prototype.slice.call(arguments,0);return function(t,r){for(var n=0;n<e.length;++n){var i=e[n](t,r);if(i)return i}}}),e.registerHelper("fold","auto",function(e,t){for(var r=e.getHelpers(t,"fold"),n=0;n<r.length;n++){var i=r[n](e,t);if(i)return i}});var i={rangeFinder:e.fold.auto,widget:"↔",minFoldSize:0,scanUp:!1};e.defineOption("foldOptions",null),e.defineExtension("foldOption",function(e,t){return n(this,e,t)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./foldcode")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./foldcode"],e):e(CodeMirror)}(function(e){"use strict";function t(e){this.options=e,this.from=this.to=0}function r(e){return e===!0&&(e={}),null==e.gutter&&(e.gutter="CodeMirror-foldgutter"),null==e.indicatorOpen&&(e.indicatorOpen="CodeMirror-foldgutter-open"),null==e.indicatorFolded&&(e.indicatorFolded="CodeMirror-foldgutter-folded"),e}function n(e,t){for(var r=e.findMarksAt(d(t)),n=0;n<r.length;++n)if(r[n].__isFold&&r[n].find().from.line==t)return r[n]}function i(e){if("string"==typeof e){var t=document.createElement("div");return t.className=e+" CodeMirror-guttermarker-subtle",t}return e.cloneNode(!0)}function o(e,t,r){var o=e.state.foldGutter.options,a=t,l=e.foldOption(o,"minFoldSize"),s=e.foldOption(o,"rangeFinder");e.eachLine(t,r,function(t){var r=null;if(n(e,a))r=i(o.indicatorFolded);else{var c=d(a,0),u=s&&s(e,c);u&&u.to.line-u.from.line>=l&&(r=i(o.indicatorOpen))}e.setGutterMarker(t,o.gutter,r),++a})}function a(e){var t=e.getViewport(),r=e.state.foldGutter;r&&(e.operation(function(){o(e,t.from,t.to)}),r.from=t.from,r.to=t.to)}function l(e,t,r){var i=e.state.foldGutter;if(i){var o=i.options;if(r==o.gutter){var a=n(e,t);a?a.clear():e.foldCode(d(t,0),o.rangeFinder)}}}function s(e){var t=e.state.foldGutter;if(t){var r=t.options;t.from=t.to=0,clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout(function(){a(e)},r.foldOnChangeTimeSpan||600)}}function c(e){var t=e.state.foldGutter;if(t){var r=t.options;clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout(function(){var r=e.getViewport();t.from==t.to||r.from-t.to>20||t.from-r.to>20?a(e):e.operation(function(){r.from<t.from&&(o(e,r.from,t.from),t.from=r.from),r.to>t.to&&(o(e,t.to,r.to),t.to=r.to)})},r.updateViewportTimeSpan||400)}}function u(e,t){var r=e.state.foldGutter;if(r){var n=t.line;n>=r.from&&n<r.to&&o(e,n,n+1)}}e.defineOption("foldGutter",!1,function(n,i,o){o&&o!=e.Init&&(n.clearGutter(n.state.foldGutter.options.gutter),n.state.foldGutter=null,n.off("gutterClick",l),n.off("change",s),n.off("viewportChange",c),n.off("fold",u),n.off("unfold",u),n.off("swapDoc",a)),i&&(n.state.foldGutter=new t(r(i)),a(n),n.on("gutterClick",l),n.on("change",s),n.on("viewportChange",c),n.on("fold",u),n.on("unfold",u),n.on("swapDoc",a))});var d=e.Pos}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.registerHelper("fold","markdown",function(t,r){function n(r){var n=t.getTokenTypeAt(e.Pos(r,0));return n&&/\bheader\b/.test(n)}function i(e,t,r){var i=t&&t.match(/^#+/);return i&&n(e)?i[0].length:(i=r&&r.match(/^[=\-]+\s*$/),i&&n(e+1)?"="==r[0]?1:2:o)}var o=100,a=t.getLine(r.line),l=t.getLine(r.line+1),s=i(r.line,a,l);if(s===o)return void 0;for(var c=t.lastLine(),u=r.line,d=t.getLine(u+2);c>u&&!(i(u+1,l,d)<=s);)++u,l=d,d=t.getLine(u+2);return{from:e.Pos(r.line,a.length),to:e.Pos(u,t.getLine(u).length)}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t){return e.line-t.line||e.ch-t.ch}function r(e,t,r,n){this.line=t,this.ch=r,this.cm=e,this.text=e.getLine(t),this.min=n?n.from:e.firstLine(),this.max=n?n.to-1:e.lastLine()}function n(e,t){var r=e.cm.getTokenTypeAt(f(e.line,t));return r&&/\btag\b/.test(r)}function i(e){return e.line>=e.max?void 0:(e.ch=0,e.text=e.cm.getLine(++e.line),!0)}function o(e){return e.line<=e.min?void 0:(e.text=e.cm.getLine(--e.line),e.ch=e.text.length,!0)}function a(e){for(;;){var t=e.text.indexOf(">",e.ch);if(-1==t){if(i(e))continue;return}{if(n(e,t+1)){var r=e.text.lastIndexOf("/",t),o=r>-1&&!/\S/.test(e.text.slice(r+1,t));return e.ch=t+1,o?"selfClose":"regular"}e.ch=t+1}}}function l(e){for(;;){var t=e.ch?e.text.lastIndexOf("<",e.ch-1):-1;if(-1==t){if(o(e))continue;return}if(n(e,t+1)){m.lastIndex=t,e.ch=t;var r=m.exec(e.text);if(r&&r.index==t)return r}else e.ch=t}}function s(e){for(;;){m.lastIndex=e.ch;var t=m.exec(e.text);if(!t){if(i(e))continue;return}{if(n(e,t.index+1))return e.ch=t.index+t[0].length,t;e.ch=t.index+1}}}function c(e){for(;;){var t=e.ch?e.text.lastIndexOf(">",e.ch-1):-1;if(-1==t){if(o(e))continue;return}{if(n(e,t+1)){var r=e.text.lastIndexOf("/",t),i=r>-1&&!/\S/.test(e.text.slice(r+1,t));return e.ch=t+1,i?"selfClose":"regular"}e.ch=t}}}function u(e,t){for(var r=[];;){var n,i=s(e),o=e.line,l=e.ch-(i?i[0].length:0);if(!i||!(n=a(e)))return;if("selfClose"!=n)if(i[1]){for(var c=r.length-1;c>=0;--c)if(r[c]==i[2]){r.length=c;break}if(0>c&&(!t||t==i[2]))return{tag:i[2],from:f(o,l),to:f(e.line,e.ch)}}else r.push(i[2])}}function d(e,t){for(var r=[];;){var n=c(e);if(!n)return;if("selfClose"!=n){var i=e.line,o=e.ch,a=l(e);if(!a)return;if(a[1])r.push(a[2]);else{for(var s=r.length-1;s>=0;--s)if(r[s]==a[2]){r.length=s;break}if(0>s&&(!t||t==a[2]))return{tag:a[2],from:f(e.line,e.ch),to:f(i,o)}}}else l(e)}}var f=e.Pos,h="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",p=h+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",m=new RegExp("<(/?)(["+h+"]["+p+"]*)","g");e.registerHelper("fold","xml",function(e,t){for(var n=new r(e,t.line,0);;){var i,o=s(n);if(!o||n.line!=t.line||!(i=a(n)))return;if(!o[1]&&"selfClose"!=i){var t=f(n.line,n.ch),l=u(n,o[2]);return l&&{from:t,to:l.from}}}}),e.findMatchingTag=function(e,n,i){var o=new r(e,n.line,n.ch,i);if(-1!=o.text.indexOf(">")||-1!=o.text.indexOf("<")){var s=a(o),c=s&&f(o.line,o.ch),h=s&&l(o);if(s&&h&&!(t(o,n)>0)){var p={from:f(o.line,o.ch),to:c,tag:h[2]};return"selfClose"==s?{open:p,close:null,at:"open"}:h[1]?{open:d(o,h[2]),close:p,at:"close"}:(o=new r(e,c.line,c.ch,i),{open:p,close:u(o,h[2]),at:"open"})}}},e.findEnclosingTag=function(e,t,n){for(var i=new r(e,t.line,t.ch,n);;){var o=d(i);if(!o)break;var a=new r(e,t.line,t.ch,n),l=u(a,o.tag);if(l)return{open:o,close:l}}},e.scanForClosingTag=function(e,t,n,i){var o=new r(e,t.line,t.ch,i?{from:0,to:i}:null);return u(o,n)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("xml",function(t,r){function n(e,t){function r(r){return t.tokenize=r,r(e,t)}var n=e.next();if("<"==n)return e.eat("!")?e.eat("[")?e.match("CDATA[")?r(a("atom","]]>")):null:e.match("--")?r(a("comment","-->")):e.match("DOCTYPE",!0,!0)?(e.eatWhile(/[\w\._\-]/),r(l(1))):null:e.eat("?")?(e.eatWhile(/[\w\._\-]/),t.tokenize=a("meta","?>"),"meta"):(C=e.eat("/")?"closeTag":"openTag",t.tokenize=i,"tag bracket");if("&"==n){var o;return o=e.eat("#")?e.eat("x")?e.eatWhile(/[a-fA-F\d]/)&&e.eat(";"):e.eatWhile(/[\d]/)&&e.eat(";"):e.eatWhile(/[\w\.\-:]/)&&e.eat(";"),o?"atom":"error"}return e.eatWhile(/[^&<]/),null}function i(e,t){var r=e.next();if(">"==r||"/"==r&&e.eat(">"))return t.tokenize=n,C=">"==r?"endTag":"selfcloseTag","tag bracket";if("="==r)return C="equals",null;if("<"==r){t.tokenize=n,t.state=d,t.tagName=t.tagStart=null;var i=t.tokenize(e,t);return i?i+" tag error":"tag error"}return/[\'\"]/.test(r)?(t.tokenize=o(r),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function o(e){var t=function(t,r){for(;!t.eol();)if(t.next()==e){r.tokenize=i;break}return"string"};return t.isInAttribute=!0,t}function a(e,t){return function(r,i){for(;!r.eol();){if(r.match(t)){i.tokenize=n;break}r.next()}return e}}function l(e){return function(t,r){for(var i;null!=(i=t.next());){if("<"==i)return r.tokenize=l(e+1),r.tokenize(t,r);if(">"==i){if(1==e){r.tokenize=n;break}return r.tokenize=l(e-1),r.tokenize(t,r)}}return"meta"}}function s(e,t,r){this.prev=e.context,this.tagName=t,this.indent=e.indented,this.startOfLine=r,(L.doNotIndent.hasOwnProperty(t)||e.context&&e.context.noIndent)&&(this.noIndent=!0)}function c(e){e.context&&(e.context=e.context.prev)}function u(e,t){for(var r;;){if(!e.context)return;if(r=e.context.tagName,!L.contextGrabbers.hasOwnProperty(r)||!L.contextGrabbers[r].hasOwnProperty(t))return;c(e)}}function d(e,t,r){return"openTag"==e?(r.tagStart=t.column(),f):"closeTag"==e?h:d}function f(e,t,r){return"word"==e?(r.tagName=t.current(),S="tag",g):(S="error",f)}function h(e,t,r){if("word"==e){var n=t.current();return r.context&&r.context.tagName!=n&&L.implicitlyClosed.hasOwnProperty(r.context.tagName)&&c(r),r.context&&r.context.tagName==n?(S="tag",p):(S="tag error",m)}return S="error",m}function p(e,t,r){return"endTag"!=e?(S="error",p):(c(r),d)}function m(e,t,r){return S="error",p(e,t,r)}function g(e,t,r){if("word"==e)return S="attribute",v;if("endTag"==e||"selfcloseTag"==e){var n=r.tagName,i=r.tagStart;return r.tagName=r.tagStart=null,"selfcloseTag"==e||L.autoSelfClosers.hasOwnProperty(n)?u(r,n):(u(r,n),r.context=new s(r,n,i==r.indented)),d}return S="error",g}function v(e,t,r){return"equals"==e?y:(L.allowMissing||(S="error"),g(e,t,r))}function y(e,t,r){return"string"==e?b:"word"==e&&L.allowUnquoted?(S="string",g):(S="error",g(e,t,r))}function b(e,t,r){return"string"==e?b:g(e,t,r)}var x=t.indentUnit,w=r.multilineTagIndentFactor||1,k=r.multilineTagIndentPastTag;null==k&&(k=!0);var C,S,L=r.htmlMode?{autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0}:{autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,caseFold:!1},M=r.alignCDATA;return{startState:function(){return{tokenize:n,state:d,indented:0,tagName:null,tagStart:null,context:null}},token:function(e,t){if(!t.tagName&&e.sol()&&(t.indented=e.indentation()),e.eatSpace())return null;C=null;var r=t.tokenize(e,t);return(r||C)&&"comment"!=r&&(S=null,t.state=t.state(C||r,e,t),S&&(r="error"==S?r+" error":S)),r},indent:function(t,r,o){var a=t.context;if(t.tokenize.isInAttribute)return t.tagStart==t.indented?t.stringStartCol+1:t.indented+x;if(a&&a.noIndent)return e.Pass;if(t.tokenize!=i&&t.tokenize!=n)return o?o.match(/^(\s*)/)[0].length:0;if(t.tagName)return k?t.tagStart+t.tagName.length+2:t.tagStart+x*w;if(M&&/<!\[CDATA\[/.test(r))return 0;var l=r&&/^<(\/)?([\w_:\.-]*)/.exec(r);if(l&&l[1])for(;a;){if(a.tagName==l[2]){a=a.prev;break}if(!L.implicitlyClosed.hasOwnProperty(a.tagName))break;a=a.prev}else if(l)for(;a;){var s=L.contextGrabbers[a.tagName];if(!s||!s.hasOwnProperty(l[2]))break;a=a.prev}for(;a&&!a.startOfLine;)a=a.prev;return a?a.indent+x:0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:r.htmlMode?"html":"xml",helperType:r.htmlMode?"html":"xml"}}),e.defineMIME("text/xml","xml"),e.defineMIME("application/xml","xml"),e.mimeModes.hasOwnProperty("text/html")||e.defineMIME("text/html",{name:"xml",htmlMode:!0})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../xml/xml"),require("../meta")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../meta"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("markdown",function(t,r){function n(r){if(e.findModeByName){var n=e.findModeByName(r);n&&(r=n.mime||n.mimes[0])}var i=e.getMode(t,r);return"null"==i.name?null:i}function i(e,t,r){return t.f=t.inline=r,r(e,t)}function o(e,t,r){return t.f=t.block=r,r(e,t)}function a(e){return e.linkTitle=!1,e.em=!1,e.strong=!1,e.strikethrough=!1,e.quote=0,w||e.f!=s||(e.f=h,e.block=l),e.trailingSpace=0,e.trailingSpaceNewLine=!1,e.thisLineHasContent=!1,null}function l(e,t){var o=e.sol(),a=t.list!==!1;a&&(t.indentationDiff>=0?(t.indentationDiff<4&&(t.indentation-=t.indentationDiff),t.list=null):t.indentation>0?(t.list=null,t.listDepth=Math.floor(t.indentation/4)):(t.list=!1,t.listDepth=0));var l=null;if(t.indentationDiff>=4)return t.indentation-=4,e.skipToEnd(),L;if(e.eatSpace())return null;if(l=e.match(U))return t.header=Math.min(6,-1!==l[0].indexOf(" ")?l[0].length-1:l[0].length),r.highlightFormatting&&(t.formatting="header"),t.f=t.inline,d(t);if(t.prevLineHasContent&&(l=e.match(V)))return t.header="="==l[0].charAt(0)?1:2,r.highlightFormatting&&(t.formatting="header"),t.f=t.inline,d(t);if(e.eat(">"))return t.indentation++,t.quote=o?1:t.quote+1,r.highlightFormatting&&(t.formatting="quote"),e.eatSpace(),d(t);if("["===e.peek())return i(e,t,v);if(e.match(j,!0))return z;if((!t.prevLineHasContent||a)&&(e.match(B,!1)||e.match(q,!1))){var s=null;return e.match(B,!0)?s="ul":(e.match(q,!0),s="ol"),t.indentation+=4,t.list=!0,t.listDepth++,r.taskLists&&e.match(R,!1)&&(t.taskList=!0),t.f=t.inline,r.highlightFormatting&&(t.formatting=["list","list-"+s]),d(t)}return r.fencedCodeBlocks&&e.match(/^```[ \t]*([\w+#]*)/,!0)?(t.localMode=n(RegExp.$1),t.localMode&&(t.localState=t.localMode.startState()),t.f=t.block=c,r.highlightFormatting&&(t.formatting="code-block"),t.code=!0,d(t)):i(e,t,t.inline)}function s(e,t){var r=k.token(e,t.htmlState);return(w&&null===t.htmlState.tagStart&&!t.htmlState.context||t.md_inside&&e.current().indexOf(">")>-1)&&(t.f=h,t.block=l,t.htmlState=null),r}function c(e,t){return e.sol()&&e.match("```",!1)?(t.localMode=t.localState=null,t.f=t.block=u,null):t.localMode?t.localMode.token(e,t.localState):(e.skipToEnd(),L)}function u(e,t){e.match("```"),t.block=l,t.f=h,r.highlightFormatting&&(t.formatting="code-block"),t.code=!0;var n=d(t);return t.code=!1,n}function d(e){var t=[];if(e.formatting){t.push(P),"string"==typeof e.formatting&&(e.formatting=[e.formatting]);for(var n=0;n<e.formatting.length;n++)t.push(P+"-"+e.formatting[n]),"header"===e.formatting[n]&&t.push(P+"-"+e.formatting[n]+"-"+e.header),"quote"===e.formatting[n]&&t.push(!r.maxBlockquoteDepth||r.maxBlockquoteDepth>=e.quote?P+"-"+e.formatting[n]+"-"+e.quote:"error")}if(e.taskOpen)return t.push("meta"),t.length?t.join(" "):null;if(e.taskClosed)return t.push("property"),t.length?t.join(" "):null;if(e.linkHref)return t.push(E),t.length?t.join(" "):null;if(e.strong&&t.push(H),e.em&&t.push(F),e.strikethrough&&t.push(_),e.linkText&&t.push(I),e.code&&t.push(L),e.header&&(t.push(S),t.push(S+"-"+e.header)),e.quote&&(t.push(M),t.push(!r.maxBlockquoteDepth||r.maxBlockquoteDepth>=e.quote?M+"-"+e.quote:M+"-"+r.maxBlockquoteDepth)),e.list!==!1){var i=(e.listDepth-1)%3;t.push(i?1===i?A:O:T)}return e.trailingSpaceNewLine?t.push("trailing-space-new-line"):e.trailingSpace&&t.push("trailing-space-"+(e.trailingSpace%2?"a":"b")),t.length?t.join(" "):null}function f(e,t){return e.match(G,!0)?d(t):void 0}function h(t,n){var i=n.text(t,n);if("undefined"!=typeof i)return i;if(n.list)return n.list=null,d(n);if(n.taskList){var a="x"!==t.match(R,!0)[1];return a?n.taskOpen=!0:n.taskClosed=!0,r.highlightFormatting&&(n.formatting="task"),n.taskList=!1,d(n)}if(n.taskOpen=!1,n.taskClosed=!1,n.header&&t.match(/^#+$/,!0))return r.highlightFormatting&&(n.formatting="header"),d(n);var l=t.sol(),c=t.next();if("\\"===c&&(t.next(),r.highlightFormatting)){var u=d(n);return u?u+" formatting-escape":"formatting-escape"}if(n.linkTitle){n.linkTitle=!1;var f=c;"("===c&&(f=")"),f=(f+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1");var h="^\\s*(?:[^"+f+"\\\\]+|\\\\\\\\|\\\\.)"+f;if(t.match(new RegExp(h),!0))return E}if("`"===c){var g=n.formatting;r.highlightFormatting&&(n.formatting="code");var v=d(n),y=t.pos;t.eatWhile("`");var b=1+t.pos-y;return n.code?b===C?(n.code=!1,v):(n.formatting=g,d(n)):(C=b,n.code=!0,d(n))}if(n.code)return d(n);if("!"===c&&t.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return t.match(/\[[^\]]*\]/),n.inline=n.f=m,N;if("["===c&&t.match(/.*\](\(.*\)| ?\[.*\])/,!1))return n.linkText=!0,r.highlightFormatting&&(n.formatting="link"),d(n);if("]"===c&&n.linkText&&t.match(/\(.*\)| ?\[.*\]/,!1)){r.highlightFormatting&&(n.formatting="link");var u=d(n);return n.linkText=!1,n.inline=n.f=m,u}if("<"===c&&t.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){n.f=n.inline=p,r.highlightFormatting&&(n.formatting="link");var u=d(n);return u?u+=" ":u="",u+D}if("<"===c&&t.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){n.f=n.inline=p,r.highlightFormatting&&(n.formatting="link");var u=d(n);return u?u+=" ":u="",u+W}if("<"===c&&t.match(/^\w/,!1)){if(-1!=t.string.indexOf(">")){var x=t.string.substring(1,t.string.indexOf(">"));/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(x)&&(n.md_inside=!0)}return t.backUp(1),n.htmlState=e.startState(k),o(t,n,s)}if("<"===c&&t.match(/^\/\w*?>/))return n.md_inside=!1,"tag";var w=!1;if(!r.underscoresBreakWords&&"_"===c&&"_"!==t.peek()&&t.match(/(\w)/,!1)){var S=t.pos-2;if(S>=0){var L=t.string.charAt(S);"_"!==L&&L.match(/(\w)/,!1)&&(w=!0)}}if("*"===c||"_"===c&&!w)if(l&&" "===t.peek());else{if(n.strong===c&&t.eat(c)){r.highlightFormatting&&(n.formatting="strong");var v=d(n);return n.strong=!1,v}if(!n.strong&&t.eat(c))return n.strong=c,r.highlightFormatting&&(n.formatting="strong"),d(n);if(n.em===c){r.highlightFormatting&&(n.formatting="em");var v=d(n);return n.em=!1,v}if(!n.em)return n.em=c,r.highlightFormatting&&(n.formatting="em"),d(n)}else if(" "===c&&(t.eat("*")||t.eat("_"))){if(" "===t.peek())return d(n);t.backUp(1)}if(r.strikethrough)if("~"===c&&t.eatWhile(c)){if(n.strikethrough){r.highlightFormatting&&(n.formatting="strikethrough");var v=d(n);return n.strikethrough=!1,v}if(t.match(/^[^\s]/,!1))return n.strikethrough=!0,r.highlightFormatting&&(n.formatting="strikethrough"),d(n)}else if(" "===c&&t.match(/^~~/,!0)){if(" "===t.peek())return d(n);t.backUp(2)}return" "===c&&(t.match(/ +$/,!1)?n.trailingSpace++:n.trailingSpace&&(n.trailingSpaceNewLine=!0)),d(n)}function p(e,t){var n=e.next();if(">"===n){t.f=t.inline=h,r.highlightFormatting&&(t.formatting="link");var i=d(t);return i?i+=" ":i="",i+D}return e.match(/^[^>]+/,!0),D}function m(e,t){if(e.eatSpace())return null;var n=e.next();return"("===n||"["===n?(t.f=t.inline=g("("===n?")":"]"),r.highlightFormatting&&(t.formatting="link-string"),t.linkHref=!0,d(t)):"error"}function g(e){return function(t,n){var i=t.next();if(i===e){n.f=n.inline=h,r.highlightFormatting&&(n.formatting="link-string");var o=d(n);return n.linkHref=!1,o}return t.match(x(e),!0)&&t.backUp(1),n.linkHref=!0,d(n)}}function v(e,t){return e.match(/^[^\]]*\]:/,!1)?(t.f=y,e.next(),r.highlightFormatting&&(t.formatting="link"),t.linkText=!0,d(t)):i(e,t,h)}function y(e,t){if(e.match(/^\]:/,!0)){t.f=t.inline=b,r.highlightFormatting&&(t.formatting="link");var n=d(t);return t.linkText=!1,n}return e.match(/^[^\]]+/,!0),I}function b(e,t){return e.eatSpace()?null:(e.match(/^[^\s]+/,!0),void 0===e.peek()?t.linkTitle=!0:e.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),t.f=t.inline=h,E)}function x(e){return K[e]||(e=(e+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),K[e]=new RegExp("^(?:[^\\\\]|\\\\.)*?("+e+")")),K[e]}var w=e.modes.hasOwnProperty("xml"),k=e.getMode(t,w?{name:"xml",htmlMode:!0}:"text/plain");void 0===r.highlightFormatting&&(r.highlightFormatting=!1),void 0===r.maxBlockquoteDepth&&(r.maxBlockquoteDepth=0),void 0===r.underscoresBreakWords&&(r.underscoresBreakWords=!0),void 0===r.fencedCodeBlocks&&(r.fencedCodeBlocks=!1),void 0===r.taskLists&&(r.taskLists=!1),void 0===r.strikethrough&&(r.strikethrough=!1);var C=0,S="header",L="comment",M="quote",T="variable-2",A="variable-3",O="keyword",z="hr",N="tag",P="formatting",D="link",W="link",I="link",E="string",F="em",H="strong",_="strikethrough",j=/^([*\-=_])(?:\s*\1){2,}\s*$/,B=/^[*\-+]\s+/,q=/^[0-9]+\.\s+/,R=/^\[(x| )\](?=\s)/,U=/^#+ ?/,V=/^(?:\={1,}|-{1,})$/,G=/^[^#!\[\]*_\\<>` "'(~]+/,K=[],$={startState:function(){return{f:l,prevLineHasContent:!1,thisLineHasContent:!1,block:l,htmlState:null,indentation:0,inline:h,text:f,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,em:!1,strong:!1,header:0,taskList:!1,list:!1,listDepth:0,quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1}},copyState:function(t){return{f:t.f,prevLineHasContent:t.prevLineHasContent,thisLineHasContent:t.thisLineHasContent,block:t.block,htmlState:t.htmlState&&e.copyState(k,t.htmlState),indentation:t.indentation,localMode:t.localMode,localState:t.localMode?e.copyState(t.localMode,t.localState):null,inline:t.inline,text:t.text,formatting:!1,linkTitle:t.linkTitle,em:t.em,strong:t.strong,strikethrough:t.strikethrough,header:t.header,taskList:t.taskList,list:t.list,listDepth:t.listDepth,quote:t.quote,trailingSpace:t.trailingSpace,trailingSpaceNewLine:t.trailingSpaceNewLine,md_inside:t.md_inside}},token:function(e,t){if(t.formatting=!1,e.sol()){var r=!!t.header;if(t.header=0,e.match(/^\s*$/,!0)||r)return t.prevLineHasContent=!1,a(t),r?this.token(e,t):null;t.prevLineHasContent=t.thisLineHasContent,t.thisLineHasContent=!0,t.taskList=!1,t.code=!1,t.trailingSpace=0,t.trailingSpaceNewLine=!1,t.f=t.block;var n=e.match(/^\s*/,!0)[0].replace(/\t/g," ").length,i=4*Math.floor((n-t.indentation)/4);i>4&&(i=4);var o=t.indentation+i;if(t.indentationDiff=o-t.indentation,t.indentation=o,n>0)return null}return t.f(e,t)},innerMode:function(e){return e.block==s?{state:e.htmlState,mode:k}:e.localState?{state:e.localState,mode:e.localMode}:{state:e,mode:$}},blankLine:a,getType:d,fold:"markdown"};return $},"xml"),e.defineMIME("text/x-markdown","markdown")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../markdown/markdown"),require("../../addon/mode/overlay")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../markdown/markdown","../../addon/mode/overlay"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("gfm",function(t,r){function n(e){return e.code=!1,null}var i=0,o={startState:function(){return{code:!1,codeBlock:!1,ateSpace:!1}},copyState:function(e){return{code:e.code,codeBlock:e.codeBlock,ateSpace:e.ateSpace}},token:function(e,t){if(t.combineTokens=null,t.codeBlock)return e.match(/^```/)?(t.codeBlock=!1,null):(e.skipToEnd(),null);if(e.sol()&&(t.code=!1),e.sol()&&e.match(/^```/))return e.skipToEnd(),t.codeBlock=!0,null;if("`"===e.peek()){e.next();var r=e.pos;e.eatWhile("`");var n=1+e.pos-r;return t.code?n===i&&(t.code=!1):(i=n,t.code=!0),null}if(t.code)return e.next(),null;if(e.eatSpace())return t.ateSpace=!0,null;if(e.sol()||t.ateSpace){if(t.ateSpace=!1,e.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+@)?(?:[a-f0-9]{7,40}\b)/))return t.combineTokens=!0,"link";if(e.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+)?#[0-9]+\b/))return t.combineTokens=!0,"link"}return e.match(/^((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?«»“”‘’]))/i)&&"]("!=e.string.slice(e.start-2,e.start)?(t.combineTokens=!0,"link"):(e.next(),null)},blankLine:n},a={underscoresBreakWords:!1,taskLists:!0,fencedCodeBlocks:!0,strikethrough:!0};for(var l in r)a[l]=r[l];return a.name="markdown",e.defineMIME("gfmBase",a),e.overlayMode(e.getMode(t,"gfmBase"),o)},"markdown")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("javascript",function(t,r){function n(e){for(var t,r=!1,n=!1;null!=(t=e.next());){if(!r){if("/"==t&&!n)return;"["==t?n=!0:n&&"]"==t&&(n=!1)}r=!r&&"\\"==t}}function i(e,t,r){return ge=e,ve=r,t}function o(e,t){var r=e.next();if('"'==r||"'"==r)return t.tokenize=a(r),t.tokenize(e,t);if("."==r&&e.match(/^\d+(?:[eE][+\-]?\d+)?/))return i("number","number");if("."==r&&e.match(".."))return i("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(r))return i(r); +var i=o(e,n,e.getCursor()),a=function(){var t,r=i.from();!(t=i.findNext())&&(i=o(e,n),!(t=i.findNext())||r&&i.from().line==r.line&&i.from().ch==r.ch)||(e.setSelection(i.from(),i.to()),e.scrollIntoView({from:i.from(),to:i.to()}),l(e,g,"Replace?",[function(){s(t)},a]))},s=function(e){i.replace("string"==typeof n?r:r.replace(/\$(\d)/g,function(t,n){return e[n]}),"+input"),a()};a()}}))})}}var h='Search: <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">(Use /re/ syntax for regexp search)</span>',p='Replace: <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">(Use /re/ syntax for regexp search)</span>',m='With: <input type="text" style="width: 10em" class="CodeMirror-search-field"/>',g="Replace? <button>Yes</button> <button>No</button> <button>Stop</button>";e.commands.find=function(e){f(e),c(e)},e.commands.findNext=c,e.commands.findPrev=function(e){c(e,!0)},e.commands.clearSearch=f,e.commands.replace=d,e.commands.replaceAll=function(e){d(e,!0)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./searchcursor"),require("../scroll/annotatescrollbar")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./searchcursor","../scroll/annotatescrollbar"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,n,r){this.cm=e,this.options=r;var i={listenForChanges:!1};for(var o in r)i[o]=r[o];i.className||(i.className="CodeMirror-search-match"),this.annotation=e.annotateScrollbar(i),this.query=t,this.caseFold=n,this.gap={from:e.firstLine(),to:e.lastLine()+1},this.matches=[],this.update=null,this.findMatches(),this.annotation.update(this.matches);var a=this;e.on("change",this.changeHandler=function(e,t){a.onChange(t)})}function n(e,t,n){return t>=e?e:Math.max(t,e+n)}e.defineExtension("showMatchesOnScrollbar",function(e,n,r){return"string"==typeof r&&(r={className:r}),r||(r={}),new t(this,e,n,r)});var r=1e3;t.prototype.findMatches=function(){if(this.gap){for(var t=0;t<this.matches.length;t++){var n=this.matches[t];if(n.from.line>=this.gap.to)break;n.to.line>=this.gap.from&&this.matches.splice(t--,1)}for(var i=this.cm.getSearchCursor(this.query,e.Pos(this.gap.from,0),this.caseFold),o=this.options&&this.options.maxMatches||r;i.findNext();){var n={from:i.from(),to:i.to()};if(n.from.line>=this.gap.to)break;if(this.matches.splice(t++,0,n),this.matches.length>o)break}this.gap=null}},t.prototype.onChange=function(t){var r=t.from.line,i=e.changeEnd(t).line,o=i-t.to.line;if(this.gap?(this.gap.from=Math.min(n(this.gap.from,r,o),t.from.line),this.gap.to=Math.max(n(this.gap.to,r,o),t.from.line)):this.gap={from:t.from.line,to:i+1},o)for(var a=0;a<this.matches.length;a++){var l=this.matches[a],s=n(l.from.line,r,o);s!=l.from.line&&(l.from=e.Pos(s,l.from.ch));var c=n(l.to.line,r,o);c!=l.to.line&&(l.to=e.Pos(c,l.to.ch))}clearTimeout(this.update);var u=this;this.update=setTimeout(function(){u.updateAfterChange()},250)},t.prototype.updateAfterChange=function(){this.findMatches(),this.annotation.update(this.matches)},t.prototype.clear=function(){this.cm.off("change",this.changeHandler),this.annotation.clear()}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(t,n,r){function i(t){var n=e.wheelEventPixels(t)["horizontal"==o.orientation?"x":"y"],r=o.pos;o.moveTo(o.pos+n),o.pos!=r&&e.e_preventDefault(t)}this.orientation=n,this.scroll=r,this.screen=this.total=this.size=1,this.pos=0,this.node=document.createElement("div"),this.node.className=t+"-"+n,this.inner=this.node.appendChild(document.createElement("div"));var o=this;e.on(this.inner,"mousedown",function(t){function n(){e.off(document,"mousemove",r),e.off(document,"mouseup",n)}function r(e){return 1!=e.which?n():void o.moveTo(l+(e[i]-a)*(o.total/o.size))}if(1==t.which){e.e_preventDefault(t);var i="horizontal"==o.orientation?"pageX":"pageY",a=t[i],l=o.pos;e.on(document,"mousemove",r),e.on(document,"mouseup",n)}}),e.on(this.node,"click",function(t){e.e_preventDefault(t);var n,r=o.inner.getBoundingClientRect();n="horizontal"==o.orientation?t.clientX<r.left?-1:t.clientX>r.right?1:0:t.clientY<r.top?-1:t.clientY>r.bottom?1:0,o.moveTo(o.pos+n*o.screen)}),e.on(this.node,"mousewheel",i),e.on(this.node,"DOMMouseScroll",i)}function n(e,n,r){this.addClass=e,this.horiz=new t(e,"horizontal",r),n(this.horiz.node),this.vert=new t(e,"vertical",r),n(this.vert.node),this.width=null}t.prototype.moveTo=function(e,t){0>e&&(e=0),e>this.total-this.screen&&(e=this.total-this.screen),e!=this.pos&&(this.pos=e,this.inner.style["horizontal"==this.orientation?"left":"top"]=e*(this.size/this.total)+"px",t!==!1&&this.scroll(e,this.orientation))};var r=10;t.prototype.update=function(e,t,n){this.screen=t,this.total=e,this.size=n;var i=this.screen*(this.size/this.total);r>i&&(this.size-=r-i,i=r),this.inner.style["horizontal"==this.orientation?"width":"height"]=i-4+"px",this.inner.style["horizontal"==this.orientation?"left":"top"]=this.pos*(this.size/this.total)+"px"},n.prototype.update=function(e){if(null==this.width){var t=window.getComputedStyle?window.getComputedStyle(this.horiz.node):this.horiz.node.currentStyle;t&&(this.width=parseInt(t.height))}var n=this.width||0,r=e.scrollWidth>e.clientWidth+1,i=e.scrollHeight>e.clientHeight+1;return this.vert.node.style.display=i?"block":"none",this.horiz.node.style.display=r?"block":"none",i&&(this.vert.update(e.scrollHeight,e.clientHeight,e.viewHeight-(r?n:0)),this.vert.node.style.display="block",this.vert.node.style.bottom=r?n+"px":"0"),r&&(this.horiz.update(e.scrollWidth,e.clientWidth,e.viewWidth-(i?n:0)-e.barLeft),this.horiz.node.style.right=i?n+"px":"0",this.horiz.node.style.left=e.barLeft+"px"),{right:i?n:0,bottom:r?n:0}},n.prototype.setScrollTop=function(e){this.vert.moveTo(e,!1)},n.prototype.setScrollLeft=function(e){this.horiz.moveTo(e,!1)},n.prototype.clear=function(){var e=this.horiz.node.parentNode;e.removeChild(this.horiz.node),e.removeChild(this.vert.node)},e.scrollbarModel.simple=function(e,t){return new n("CodeMirror-simplescroll",e,t)},e.scrollbarModel.overlay=function(e,t){return new n("CodeMirror-overlayscroll",e,t)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t){function n(e){clearTimeout(r.doRedraw),r.doRedraw=setTimeout(function(){r.redraw()},e)}this.cm=e,this.options=t,this.buttonHeight=t.scrollButtonHeight||e.getOption("scrollButtonHeight"),this.annotations=[],this.doRedraw=this.doUpdate=null,this.div=e.getWrapperElement().appendChild(document.createElement("div")),this.div.style.cssText="position: absolute; right: 0; top: 0; z-index: 7; pointer-events: none",this.computeScale();var r=this;e.on("refresh",this.resizeHandler=function(){clearTimeout(r.doUpdate),r.doUpdate=setTimeout(function(){r.computeScale()&&n(20)},100)}),e.on("markerAdded",this.resizeHandler),e.on("markerCleared",this.resizeHandler),t.listenForChanges!==!1&&e.on("change",this.changeHandler=function(){n(250)})}e.defineExtension("annotateScrollbar",function(e){return"string"==typeof e&&(e={className:e}),new t(this,e)}),e.defineOption("scrollButtonHeight",0),t.prototype.computeScale=function(){var e=this.cm,t=(e.getWrapperElement().clientHeight-e.display.barHeight-2*this.buttonHeight)/e.heightAtLine(e.lastLine()+1,"local");return t!=this.hScale?(this.hScale=t,!0):void 0},t.prototype.update=function(e){this.annotations=e,this.redraw()},t.prototype.redraw=function(e){function t(e,t){if(s!=e.line&&(s=e.line,c=n.getLineHandle(s)),a&&c.height>l)return n.charCoords(e,"local")[t?"top":"bottom"];var r=n.heightAtLine(c,"local");return r+(t?0:c.height)}e!==!1&&this.computeScale();var n=this.cm,r=this.hScale,i=document.createDocumentFragment(),o=this.annotations,a=n.getOption("lineWrapping"),l=a&&1.5*n.defaultTextHeight(),s=null,c=null;if(n.display.barWidth)for(var u,f=0;f<o.length;f++){for(var d=o[f],h=u||t(d.from,!0)*r,p=t(d.to,!1)*r;f<o.length-1&&(u=t(o[f+1].from,!0)*r,!(u>p+.9));)d=o[++f],p=t(d.to,!1)*r;if(p!=h){var m=Math.max(p-h,3),g=i.appendChild(document.createElement("div"));g.style.cssText="position: absolute; right: 0px; width: "+Math.max(2*n.display.barWidth,2)+"px; top: "+(h+this.buttonHeight)+"px; height: "+m+"px",g.className=this.options.className}}this.div.textContent="",this.div.appendChild(i)},t.prototype.clear=function(){this.cm.off("refresh",this.resizeHandler),this.cm.off("markerAdded",this.resizeHandler),this.cm.off("markerCleared",this.resizeHandler),this.changeHandler&&this.cm.off("change",this.changeHandler),this.div.parentNode.removeChild(this.div)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e,t,n){var r,i=e.getWrapperElement();return r=i.appendChild(document.createElement("div")),n?r.className="CodeMirror-dialog CodeMirror-dialog-bottom":r.className="CodeMirror-dialog CodeMirror-dialog-top","string"==typeof t?r.innerHTML=t:r.appendChild(t),r}function n(e,t){e.state.currentNotificationClose&&e.state.currentNotificationClose(),e.state.currentNotificationClose=t}e.defineExtension("openDialog",function(r,i,o){function a(e){if("string"==typeof e)f.value=e;else{if(c)return;c=!0,s.parentNode.removeChild(s),u.focus(),o.onClose&&o.onClose(s)}}o||(o={}),n(this,null);var l,s=t(this,r,o.bottom),c=!1,u=this,f=s.getElementsByTagName("input")[0];return f?(o.value&&(f.value=o.value,o.selectValueOnOpen!==!1&&f.select()),o.onInput&&e.on(f,"input",function(e){o.onInput(e,f.value,a)}),o.onKeyUp&&e.on(f,"keyup",function(e){o.onKeyUp(e,f.value,a)}),e.on(f,"keydown",function(t){o&&o.onKeyDown&&o.onKeyDown(t,f.value,a)||((27==t.keyCode||o.closeOnEnter!==!1&&13==t.keyCode)&&(f.blur(),e.e_stop(t),a()),13==t.keyCode&&i(f.value,t))}),o.closeOnBlur!==!1&&e.on(f,"blur",a),f.focus()):(l=s.getElementsByTagName("button")[0])&&(e.on(l,"click",function(){a(),u.focus()}),o.closeOnBlur!==!1&&e.on(l,"blur",a),l.focus()),a}),e.defineExtension("openConfirm",function(r,i,o){function a(){c||(c=!0,l.parentNode.removeChild(l),u.focus())}n(this,null);var l=t(this,r,o&&o.bottom),s=l.getElementsByTagName("button"),c=!1,u=this,f=1;s[0].focus();for(var d=0;d<s.length;++d){var h=s[d];!function(t){e.on(h,"click",function(n){e.e_preventDefault(n),a(),t&&t(u)})}(i[d]),e.on(h,"blur",function(){--f,setTimeout(function(){0>=f&&a()},200)}),e.on(h,"focus",function(){++f})}}),e.defineExtension("openNotification",function(r,i){function o(){s||(s=!0,clearTimeout(a),l.parentNode.removeChild(l))}n(this,o);var a,l=t(this,r,i&&i.bottom),s=!1,c=i&&"undefined"!=typeof i.duration?i.duration:5e3;return e.on(l,"click",function(t){e.e_preventDefault(t),o()}),c&&(a=setTimeout(o,c)),o})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e,t,r,i){var o=e.getLineHandle(t.line),s=t.ch-1,c=s>=0&&l[o.text.charAt(s)]||l[o.text.charAt(++s)];if(!c)return null;var u=">"==c.charAt(1)?1:-1;if(r&&u>0!=(s==t.ch))return null;var f=e.getTokenTypeAt(a(t.line,s+1)),d=n(e,a(t.line,s+(u>0?1:0)),u,f||null,i);return null==d?null:{from:a(t.line,s),to:d&&d.pos,match:d&&d.ch==c.charAt(0),forward:u>0}}function n(e,t,n,r,i){for(var o=i&&i.maxScanLineLength||1e4,s=i&&i.maxScanLines||1e3,c=[],u=i&&i.bracketRegex?i.bracketRegex:/[(){}[\]]/,f=n>0?Math.min(t.line+s,e.lastLine()+1):Math.max(e.firstLine()-1,t.line-s),d=t.line;d!=f;d+=n){var h=e.getLine(d);if(h){var p=n>0?0:h.length-1,m=n>0?h.length:-1;if(!(h.length>o))for(d==t.line&&(p=t.ch-(0>n?1:0));p!=m;p+=n){var g=h.charAt(p);if(u.test(g)&&(void 0===r||e.getTokenTypeAt(a(d,p+1))==r)){var v=l[g];if(">"==v.charAt(1)==n>0)c.push(g);else{if(!c.length)return{pos:a(d,p),ch:g};c.pop()}}}}}return d-n==(n>0?e.lastLine():e.firstLine())?!1:null}function r(e,n,r){for(var i=e.state.matchBrackets.maxHighlightLineLength||1e3,l=[],s=e.listSelections(),c=0;c<s.length;c++){var u=s[c].empty()&&t(e,s[c].head,!1,r);if(u&&e.getLine(u.from.line).length<=i){var f=u.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";l.push(e.markText(u.from,a(u.from.line,u.from.ch+1),{className:f})),u.to&&e.getLine(u.to.line).length<=i&&l.push(e.markText(u.to,a(u.to.line,u.to.ch+1),{className:f}))}}if(l.length){o&&e.state.focused&&e.focus();var d=function(){e.operation(function(){for(var e=0;e<l.length;e++)l[e].clear()})};if(!n)return d;setTimeout(d,800)}}function i(e){e.operation(function(){s&&(s(),s=null),s=r(e,!1,e.state.matchBrackets)})}var o=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),a=e.Pos,l={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},s=null;e.defineOption("matchBrackets",!1,function(t,n,r){r&&r!=e.Init&&t.off("cursorActivity",i),n&&(t.state.matchBrackets="object"==typeof n?n:{},t.on("cursorActivity",i))}),e.defineExtension("matchBrackets",function(){r(this,!0)}),e.defineExtension("findMatchingBracket",function(e,n,r){return t(this,e,n,r)}),e.defineExtension("scanForBracket",function(e,t,r,i){return n(this,e,t,r,i)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e,t){return"pairs"==t&&"string"==typeof e?e:"object"==typeof e&&null!=e[t]?e[t]:u[t]}function n(e){return function(t){return a(t,e)}}function r(e){var t=e.state.closeBrackets;if(!t)return null;var n=e.getModeAt(e.getCursor());return n.closeBrackets||t}function i(n){var i=r(n);if(!i||n.getOption("disableInput"))return e.Pass;for(var o=t(i,"pairs"),a=n.listSelections(),l=0;l<a.length;l++){if(!a[l].empty())return e.Pass;var c=s(n,a[l].head);if(!c||o.indexOf(c)%2!=0)return e.Pass}for(var l=a.length-1;l>=0;l--){var u=a[l].head;n.replaceRange("",f(u.line,u.ch-1),f(u.line,u.ch+1))}}function o(n){var i=r(n),o=i&&t(i,"explode");if(!o||n.getOption("disableInput"))return e.Pass;for(var a=n.listSelections(),l=0;l<a.length;l++){if(!a[l].empty())return e.Pass;var c=s(n,a[l].head);if(!c||o.indexOf(c)%2!=0)return e.Pass}n.operation(function(){n.replaceSelection("\n\n",null),n.execCommand("goCharLeft"),a=n.listSelections();for(var e=0;e<a.length;e++){var t=a[e].head.line;n.indentLine(t,null,!0),n.indentLine(t+1,null,!0)}})}function a(n,i){var o=r(n);if(!o||n.getOption("disableInput"))return e.Pass;var a=t(o,"pairs"),s=a.indexOf(i);if(-1==s)return e.Pass;for(var u,d,h=t(o,"triples"),p=a.charAt(s+1)==i,m=n.listSelections(),g=s%2==0,v=0;v<m.length;v++){var y,b=m[v],x=b.head,d=n.getRange(x,f(x.line,x.ch+1));if(g&&!b.empty())y="surround";else if(!p&&g||d!=i)if(p&&x.ch>1&&h.indexOf(i)>=0&&n.getRange(f(x.line,x.ch-2),x)==i+i&&(x.ch<=2||n.getRange(f(x.line,x.ch-3),f(x.line,x.ch-2))!=i))y="addFour";else if(p){if(e.isWordChar(d)||!c(n,x,i))return e.Pass;y="both"}else{if(!g||n.getLine(x.line).length!=x.ch&&!l(d,a)&&!/\s/.test(d))return e.Pass;y="both"}else y=h.indexOf(i)>=0&&n.getRange(x,f(x.line,x.ch+3))==i+i+i?"skipThree":"skip";if(u){if(u!=y)return e.Pass}else u=y}var w=s%2?a.charAt(s-1):i,k=s%2?i:a.charAt(s+1);n.operation(function(){if("skip"==u)n.execCommand("goCharRight");else if("skipThree"==u)for(var e=0;3>e;e++)n.execCommand("goCharRight");else if("surround"==u){for(var t=n.getSelections(),e=0;e<t.length;e++)t[e]=w+t[e]+k;n.replaceSelections(t,"around")}else"both"==u?(n.replaceSelection(w+k,null),n.execCommand("goCharLeft")):"addFour"==u&&(n.replaceSelection(w+w+w+w,"before"),n.execCommand("goCharRight"))})}function l(e,t){var n=t.lastIndexOf(e);return n>-1&&n%2==1}function s(e,t){var n=e.getRange(f(t.line,t.ch-1),f(t.line,t.ch+1));return 2==n.length?n:null}function c(t,n,r){var i=t.getLine(n.line),o=t.getTokenAt(n);if(/\bstring2?\b/.test(o.type))return!1;var a=new e.StringStream(i.slice(0,n.ch)+r+i.slice(n.ch),4);for(a.pos=a.start=o.start;;){var l=t.getMode().token(a,o.state);if(a.pos>=n.ch+1)return/\bstring2?\b/.test(l);a.start=a.pos}}var u={pairs:"()[]{}''\"\"",triples:"",explode:"[]{}"},f=e.Pos;e.defineOption("autoCloseBrackets",!1,function(t,n,r){r&&r!=e.Init&&(t.removeKeyMap(h),t.state.closeBrackets=null),n&&(t.state.closeBrackets=n,t.addKeyMap(h))});for(var d=u.pairs+"`",h={Backspace:i,Enter:o},p=0;p<d.length;p++)h["'"+d.charAt(p)+"'"]=n(d.charAt(p))}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../fold/xml-fold")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../fold/xml-fold"],e):e(CodeMirror)}(function(e){"use strict";function t(e){e.state.tagHit&&e.state.tagHit.clear(),e.state.tagOther&&e.state.tagOther.clear(),e.state.tagHit=e.state.tagOther=null}function n(n){n.state.failedTagMatch=!1,n.operation(function(){if(t(n),!n.somethingSelected()){var r=n.getCursor(),i=n.getViewport();i.from=Math.min(i.from,r.line),i.to=Math.max(r.line+1,i.to);var o=e.findMatchingTag(n,r,i);if(o){if(n.state.matchBothTags){var a="open"==o.at?o.open:o.close;a&&(n.state.tagHit=n.markText(a.from,a.to,{className:"CodeMirror-matchingtag"}))}var l="close"==o.at?o.open:o.close;l?n.state.tagOther=n.markText(l.from,l.to,{className:"CodeMirror-matchingtag"}):n.state.failedTagMatch=!0}}})}function r(e){e.state.failedTagMatch&&n(e)}e.defineOption("matchTags",!1,function(i,o,a){a&&a!=e.Init&&(i.off("cursorActivity",n),i.off("viewportChange",r),t(i)),o&&(i.state.matchBothTags="object"==typeof o&&o.bothTags,i.on("cursorActivity",n),i.on("viewportChange",r),n(i))}),e.commands.toMatchingTag=function(t){var n=e.findMatchingTag(t,t.getCursor());if(n){var r="close"==n.at?n.open:n.close;r&&t.extendSelection(r.to,r.from)}}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../fold/xml-fold")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../fold/xml-fold"],e):e(CodeMirror)}(function(e){function t(t){if(t.getOption("disableInput"))return e.Pass;for(var n=t.listSelections(),r=[],s=0;s<n.length;s++){if(!n[s].empty())return e.Pass;var c=n[s].head,u=t.getTokenAt(c),f=e.innerMode(t.getMode(),u.state),d=f.state;if("xml"!=f.mode.name||!d.tagName)return e.Pass;var h=t.getOption("autoCloseTags"),p="html"==f.mode.configuration,m="object"==typeof h&&h.dontCloseTags||p&&a,g="object"==typeof h&&h.indentTags||p&&l,v=d.tagName;u.end>c.ch&&(v=v.slice(0,v.length-u.end+c.ch));var y=v.toLowerCase();if(!v||"string"==u.type&&(u.end!=c.ch||!/[\"\']/.test(u.string.charAt(u.string.length-1))||1==u.string.length)||"tag"==u.type&&"closeTag"==d.type||u.string.indexOf("/")==u.string.length-1||m&&i(m,y)>-1||o(t,v,c,d,!0))return e.Pass;var b=g&&i(g,y)>-1;r[s]={indent:b,text:">"+(b?"\n\n":"")+"</"+v+">",newPos:b?e.Pos(c.line+1,0):e.Pos(c.line,c.ch+1)}}for(var s=n.length-1;s>=0;s--){var x=r[s];t.replaceRange(x.text,n[s].head,n[s].anchor,"+input");var w=t.listSelections().slice(0);w[s]={head:x.newPos,anchor:x.newPos},t.setSelections(w),x.indent&&(t.indentLine(x.newPos.line,null,!0),t.indentLine(x.newPos.line+1,null,!0))}}function n(t,n){for(var r=t.listSelections(),i=[],a=n?"/":"</",l=0;l<r.length;l++){if(!r[l].empty())return e.Pass;var s=r[l].head,c=t.getTokenAt(s),u=e.innerMode(t.getMode(),c.state),f=u.state;if(n&&("string"==c.type||"<"!=c.string.charAt(0)||c.start!=s.ch-1))return e.Pass;if("xml"!=u.mode.name)if("htmlmixed"==t.getMode().name&&"javascript"==u.mode.name)i[l]=a+"script>";else{if("htmlmixed"!=t.getMode().name||"css"!=u.mode.name)return e.Pass;i[l]=a+"style>"}else{if(!f.context||!f.context.tagName||o(t,f.context.tagName,s,f))return e.Pass;i[l]=a+f.context.tagName+">"}}t.replaceSelections(i,null,"+input"),r=t.listSelections();for(var l=0;l<r.length;l++)(l==r.length-1||r[l].head.line<r[l+1].head.line)&&t.indentLine(r[l].head.line)}function r(t){return t.getOption("disableInput")?e.Pass:n(t,!0)}function i(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0,r=e.length;r>n;++n)if(e[n]==t)return n;return-1}function o(t,n,r,i,o){if(!e.scanForClosingTag)return!1;var a=Math.min(t.lastLine()+1,r.line+500),l=e.scanForClosingTag(t,r,null,a);if(!l||l.tag!=n)return!1;for(var s=i.context,c=o?1:0;s&&s.tagName==n;s=s.prev)++c;r=l.to;for(var u=1;c>u;u++){var f=e.scanForClosingTag(t,r,null,a);if(!f||f.tag!=n)return!1;r=f.to}return!0}e.defineOption("autoCloseTags",!1,function(n,i,o){if(o!=e.Init&&o&&n.removeKeyMap("autoCloseTags"),i){var a={name:"autoCloseTags"};("object"!=typeof i||i.whenClosing)&&(a["'/'"]=function(e){return r(e)}),("object"!=typeof i||i.whenOpening)&&(a["'>'"]=function(e){return t(e)}),n.addKeyMap(a)}});var a=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],l=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];e.commands.closeTag=function(e){return n(e)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";var t=/^(\s*)(>[> ]*|[*+-]\s|(\d+)\.)(\s*)/,n=/^(\s*)(>[> ]*|[*+-]|(\d+)\.)(\s*)$/,r=/[*+-]\s/;e.commands.newlineAndIndentContinueMarkdownList=function(i){if(i.getOption("disableInput"))return e.Pass;for(var o=i.listSelections(),a=[],l=0;l<o.length;l++){var s=o[l].head,c=i.getStateAfter(s.line),u=c.list!==!1,f=0!==c.quote,d=i.getLine(s.line),h=t.exec(d);if(!o[l].empty()||!u&&!f||!h)return void i.execCommand("newlineAndIndent");if(n.test(d))i.replaceRange("",{line:s.line,ch:0},{line:s.line,ch:s.ch+1},"+delete"),a[l]="\n";else{var p=h[1],m=h[4],g=r.test(h[2])||h[2].indexOf(">")>=0?h[2]:parseInt(h[3],10)+1+".";a[l]="\n"+p+g+m}}i.replaceSelections(a,null,"+input")}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){var t=e.search(r);return-1==t?0:t}var n={},r=/[^\s\u00a0]/,i=e.Pos;e.commands.toggleComment=function(e){for(var t=1/0,n=e.listSelections(),r=null,o=n.length-1;o>=0;o--){var a=n[o].from(),l=n[o].to();a.line>=t||(l.line>=t&&(l=i(t,0)),t=a.line,null==r?e.uncomment(a,l)?r="un":(e.lineComment(a,l),r="line"):"un"==r?e.uncomment(a,l):e.lineComment(a,l))}},e.defineExtension("lineComment",function(e,o,a){a||(a=n);var l=this,s=l.getModeAt(e),c=a.lineComment||s.lineComment;if(!c)return void((a.blockCommentStart||s.blockCommentStart)&&(a.fullLines=!0,l.blockComment(e,o,a)));var u=l.getLine(e.line);if(null!=u){var f=Math.min(0!=o.ch||o.line==e.line?o.line+1:o.line,l.lastLine()+1),d=null==a.padding?" ":a.padding,h=a.commentBlankLines||e.line==o.line;l.operation(function(){if(a.indent)for(var n=u.slice(0,t(u)),o=e.line;f>o;++o){var s=l.getLine(o),p=n.length;(h||r.test(s))&&(s.slice(0,p)!=n&&(p=t(s)),l.replaceRange(n+c+d,i(o,0),i(o,p)))}else for(var o=e.line;f>o;++o)(h||r.test(l.getLine(o)))&&l.replaceRange(c+d,i(o,0))})}}),e.defineExtension("blockComment",function(e,t,o){o||(o=n);var a=this,l=a.getModeAt(e),s=o.blockCommentStart||l.blockCommentStart,c=o.blockCommentEnd||l.blockCommentEnd;if(!s||!c)return void((o.lineComment||l.lineComment)&&0!=o.fullLines&&a.lineComment(e,t,o));var u=Math.min(t.line,a.lastLine());u!=e.line&&0==t.ch&&r.test(a.getLine(u))&&--u;var f=null==o.padding?" ":o.padding;e.line>u||a.operation(function(){if(0!=o.fullLines){var n=r.test(a.getLine(u));a.replaceRange(f+c,i(u)),a.replaceRange(s+f,i(e.line,0));var d=o.blockCommentLead||l.blockCommentLead;if(null!=d)for(var h=e.line+1;u>=h;++h)(h!=u||n)&&a.replaceRange(d+f,i(h,0))}else a.replaceRange(c,t),a.replaceRange(s,e)})}),e.defineExtension("uncomment",function(e,t,o){o||(o=n);var a,l=this,s=l.getModeAt(e),c=Math.min(0!=t.ch||t.line==e.line?t.line:t.line-1,l.lastLine()),u=Math.min(e.line,c),f=o.lineComment||s.lineComment,d=[],h=null==o.padding?" ":o.padding;e:if(f){for(var p=u;c>=p;++p){var m=l.getLine(p),g=m.indexOf(f);if(g>-1&&!/comment/.test(l.getTokenTypeAt(i(p,g+1)))&&(g=-1),-1==g&&(p!=c||p==u)&&r.test(m))break e;if(g>-1&&r.test(m.slice(0,g)))break e;d.push(m)}if(l.operation(function(){for(var e=u;c>=e;++e){var t=d[e-u],n=t.indexOf(f),r=n+f.length;0>n||(t.slice(r,r+h.length)==h&&(r+=h.length),a=!0,l.replaceRange("",i(e,n),i(e,r)))}}),a)return!0}var v=o.blockCommentStart||s.blockCommentStart,y=o.blockCommentEnd||s.blockCommentEnd;if(!v||!y)return!1;var b=o.blockCommentLead||s.blockCommentLead,x=l.getLine(u),w=c==u?x:l.getLine(c),k=x.indexOf(v),C=w.lastIndexOf(y);if(-1==C&&u!=c&&(w=l.getLine(--c),C=w.lastIndexOf(y)),-1==k||-1==C||!/comment/.test(l.getTokenTypeAt(i(u,k+1)))||!/comment/.test(l.getTokenTypeAt(i(c,C+1))))return!1;var S=x.lastIndexOf(v,e.ch),L=-1==S?-1:x.slice(0,e.ch).indexOf(y,S+v.length);if(-1!=S&&-1!=L&&L+y.length!=e.ch)return!1;L=w.indexOf(y,t.ch);var M=w.slice(t.ch).lastIndexOf(v,L-t.ch);return S=-1==L||-1==M?-1:t.ch+M,-1!=L&&-1!=S&&S!=t.ch?!1:(l.operation(function(){l.replaceRange("",i(c,C-(h&&w.slice(C-h.length,C)==h?h.length:0)),i(c,C+y.length));var e=k+v.length;if(h&&x.slice(e,e+h.length)==h&&(e+=h.length),l.replaceRange("",i(u,k),i(u,e)),b)for(var t=u+1;c>=t;++t){var n=l.getLine(t),o=n.indexOf(b);if(-1!=o&&!r.test(n.slice(0,o))){var a=o+b.length;h&&n.slice(a,a+h.length)==h&&(a+=h.length),l.replaceRange("",i(t,o),i(t,a))}}}),!0)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,n){for(var r=n.paragraphStart||e.getHelper(t,"paragraphStart"),i=t.line,o=e.firstLine();i>o;--i){var a=e.getLine(i);if(r&&r.test(a))break;if(!/\S/.test(a)){++i;break}}for(var l=n.paragraphEnd||e.getHelper(t,"paragraphEnd"),s=t.line+1,c=e.lastLine();c>=s;++s){var a=e.getLine(s);if(l&&l.test(a)){++s;break}if(!/\S/.test(a))break}return{from:i,to:s}}function n(e,t,n,r){for(var i=t;i>0&&!n.test(e.slice(i-1,i+1));--i);0==i&&(i=t);var o=i;if(r)for(;" "==e.charAt(o-1);)--o;return{from:o,to:i}}function r(t,r,o,a){r=t.clipPos(r),o=t.clipPos(o);var l=a.column||80,s=a.wrapOn||/\s\S|-[^\.\d]/,c=a.killTrailingSpace!==!1,u=[],f="",d=r.line,h=t.getRange(r,o,!1);if(!h.length)return null;for(var p=h[0].match(/^[ \t]*/)[0],m=0;m<h.length;++m){var g=h[m],v=f.length,y=0;f&&g&&!s.test(f.charAt(f.length-1)+g.charAt(0))&&(f+=" ",y=1);var b="";if(m&&(b=g.match(/^\s*/)[0],g=g.slice(b.length)),f+=g,m){var x=f.length>l&&p==b&&n(f,l,s,c);x&&x.from==v&&x.to==v+y?(f=p+g,++d):u.push({text:[y?" ":""],from:i(d,v),to:i(d+1,b.length)})}for(;f.length>l;){var w=n(f,l,s,c);u.push({text:["",p],from:i(d,w.from),to:i(d,w.to)}),f=p+f.slice(w.to),++d}}return u.length&&t.operation(function(){for(var e=0;e<u.length;++e){var n=u[e];t.replaceRange(n.text,n.from,n.to)}}),u.length?{from:u[0].from,to:e.changeEnd(u[u.length-1])}:null}var i=e.Pos;e.defineExtension("wrapParagraph",function(e,n){n=n||{},e||(e=this.getCursor());var o=t(this,e,n);return r(this,i(o.from,0),i(o.to-1),n)}),e.commands.wrapLines=function(e){e.operation(function(){for(var n=e.listSelections(),o=e.lastLine()+1,a=n.length-1;a>=0;a--){var l,s=n[a];if(s.empty()){var c=t(e,s.head,{});l={from:i(c.from,0),to:i(c.to-1)}}else l={from:s.from(),to:s.to()};l.to.line>=o||(o=l.from.line,r(e,l.from,l.to,{}))}})},e.defineExtension("wrapRange",function(e,t,n){return r(this,e,t,n||{})}),e.defineExtension("wrapParagraphsInRange",function(e,n,o){o=o||{};for(var a=this,l=[],s=e.line;s<=n.line;){var c=t(a,i(s,0),o);l.push(c),s=c.to}var u=!1;return l.length&&a.operation(function(){for(var e=l.length-1;e>=0;--e)u=u||r(a,i(l[e].from,0),i(l[e].to-1),o)}),u})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(t,i,o,a){function l(e){var n=s(t,i);if(!n||n.to.line-n.from.line<c)return null;for(var r=t.findMarksAt(n.from),o=0;o<r.length;++o)if(r[o].__isFold&&"fold"!==a){if(!e)return null;n.cleared=!0,r[o].clear()}return n}if(o&&o.call){var s=o;o=null}else var s=r(t,o,"rangeFinder");"number"==typeof i&&(i=e.Pos(i,0));var c=r(t,o,"minFoldSize"),u=l(!0);if(r(t,o,"scanUp"))for(;!u&&i.line>t.firstLine();)i=e.Pos(i.line-1,0),u=l(!1);if(u&&!u.cleared&&"unfold"!==a){var f=n(t,o);e.on(f,"mousedown",function(t){d.clear(),e.e_preventDefault(t)});var d=t.markText(u.from,u.to,{replacedWith:f,clearOnEnter:!0,__isFold:!0});d.on("clear",function(n,r){e.signal(t,"unfold",t,n,r)}),e.signal(t,"fold",t,u.from,u.to)}}function n(e,t){var n=r(e,t,"widget");if("string"==typeof n){var i=document.createTextNode(n);n=document.createElement("span"),n.appendChild(i),n.className="CodeMirror-foldmarker"}return n}function r(e,t,n){if(t&&void 0!==t[n])return t[n];var r=e.options.foldOptions;return r&&void 0!==r[n]?r[n]:i[n]}e.newFoldFunction=function(e,n){return function(r,i){t(r,i,{rangeFinder:e,widget:n})}},e.defineExtension("foldCode",function(e,n,r){t(this,e,n,r)}),e.defineExtension("isFolded",function(e){for(var t=this.findMarksAt(e),n=0;n<t.length;++n)if(t[n].__isFold)return!0}),e.commands.toggleFold=function(e){e.foldCode(e.getCursor())},e.commands.fold=function(e){e.foldCode(e.getCursor(),null,"fold")},e.commands.unfold=function(e){e.foldCode(e.getCursor(),null,"unfold")},e.commands.foldAll=function(t){t.operation(function(){for(var n=t.firstLine(),r=t.lastLine();r>=n;n++)t.foldCode(e.Pos(n,0),null,"fold")})},e.commands.unfoldAll=function(t){t.operation(function(){for(var n=t.firstLine(),r=t.lastLine();r>=n;n++)t.foldCode(e.Pos(n,0),null,"unfold")})},e.registerHelper("fold","combine",function(){var e=Array.prototype.slice.call(arguments,0);return function(t,n){for(var r=0;r<e.length;++r){var i=e[r](t,n);if(i)return i}}}),e.registerHelper("fold","auto",function(e,t){for(var n=e.getHelpers(t,"fold"),r=0;r<n.length;r++){var i=n[r](e,t);if(i)return i}});var i={rangeFinder:e.fold.auto,widget:"↔",minFoldSize:0,scanUp:!1};e.defineOption("foldOptions",null),e.defineExtension("foldOption",function(e,t){return r(this,e,t)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.registerHelper("fold","brace",function(t,n){function r(r){for(var i=n.ch,s=0;;){var c=0>=i?-1:l.lastIndexOf(r,i-1);if(-1!=c){if(1==s&&c<n.ch)break;if(o=t.getTokenTypeAt(e.Pos(a,c+1)),!/^(comment|string)/.test(o))return c+1;i=c-1}else{if(1==s)break;s=1,i=l.length}}}var i,o,a=n.line,l=t.getLine(a),s="{",c="}",i=r("{");if(null==i&&(s="[",c="]",i=r("[")),null!=i){var u,f,d=1,h=t.lastLine();e:for(var p=a;h>=p;++p)for(var m=t.getLine(p),g=p==a?i:0;;){var v=m.indexOf(s,g),y=m.indexOf(c,g);if(0>v&&(v=m.length),0>y&&(y=m.length),g=Math.min(v,y),g==m.length)break;if(t.getTokenTypeAt(e.Pos(p,g+1))==o)if(g==v)++d;else if(!--d){u=p,f=g;break e}++g}if(null!=u&&(a!=u||f!=i))return{from:e.Pos(a,i),to:e.Pos(u,f)}}}),e.registerHelper("fold","import",function(t,n){function r(n){if(n<t.firstLine()||n>t.lastLine())return null;var r=t.getTokenAt(e.Pos(n,1));if(/\S/.test(r.string)||(r=t.getTokenAt(e.Pos(n,r.end+1))),"keyword"!=r.type||"import"!=r.string)return null;for(var i=n,o=Math.min(t.lastLine(),n+10);o>=i;++i){var a=t.getLine(i),l=a.indexOf(";");if(-1!=l)return{startCh:r.end,end:e.Pos(i,l)}}}var i,n=n.line,o=r(n);if(!o||r(n-1)||(i=r(n-2))&&i.end.line==n-1)return null;for(var a=o.end;;){var l=r(a.line+1);if(null==l)break;a=l.end}return{from:t.clipPos(e.Pos(n,o.startCh+1)), +to:a}}),e.registerHelper("fold","include",function(t,n){function r(n){if(n<t.firstLine()||n>t.lastLine())return null;var r=t.getTokenAt(e.Pos(n,1));return/\S/.test(r.string)||(r=t.getTokenAt(e.Pos(n,r.end+1))),"meta"==r.type&&"#include"==r.string.slice(0,8)?r.start+8:void 0}var n=n.line,i=r(n);if(null==i||null!=r(n-1))return null;for(var o=n;;){var a=r(o+1);if(null==a)break;++o}return{from:e.Pos(n,i+1),to:t.clipPos(e.Pos(o))}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./foldcode")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./foldcode"],e):e(CodeMirror)}(function(e){"use strict";function t(e){this.options=e,this.from=this.to=0}function n(e){return e===!0&&(e={}),null==e.gutter&&(e.gutter="CodeMirror-foldgutter"),null==e.indicatorOpen&&(e.indicatorOpen="CodeMirror-foldgutter-open"),null==e.indicatorFolded&&(e.indicatorFolded="CodeMirror-foldgutter-folded"),e}function r(e,t){for(var n=e.findMarksAt(f(t)),r=0;r<n.length;++r)if(n[r].__isFold&&n[r].find().from.line==t)return n[r]}function i(e){if("string"==typeof e){var t=document.createElement("div");return t.className=e+" CodeMirror-guttermarker-subtle",t}return e.cloneNode(!0)}function o(e,t,n){var o=e.state.foldGutter.options,a=t,l=e.foldOption(o,"minFoldSize"),s=e.foldOption(o,"rangeFinder");e.eachLine(t,n,function(t){var n=null;if(r(e,a))n=i(o.indicatorFolded);else{var c=f(a,0),u=s&&s(e,c);u&&u.to.line-u.from.line>=l&&(n=i(o.indicatorOpen))}e.setGutterMarker(t,o.gutter,n),++a})}function a(e){var t=e.getViewport(),n=e.state.foldGutter;n&&(e.operation(function(){o(e,t.from,t.to)}),n.from=t.from,n.to=t.to)}function l(e,t,n){var i=e.state.foldGutter;if(i){var o=i.options;if(n==o.gutter){var a=r(e,t);a?a.clear():e.foldCode(f(t,0),o.rangeFinder)}}}function s(e){var t=e.state.foldGutter;if(t){var n=t.options;t.from=t.to=0,clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout(function(){a(e)},n.foldOnChangeTimeSpan||600)}}function c(e){var t=e.state.foldGutter;if(t){var n=t.options;clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout(function(){var n=e.getViewport();t.from==t.to||n.from-t.to>20||t.from-n.to>20?a(e):e.operation(function(){n.from<t.from&&(o(e,n.from,t.from),t.from=n.from),n.to>t.to&&(o(e,t.to,n.to),t.to=n.to)})},n.updateViewportTimeSpan||400)}}function u(e,t){var n=e.state.foldGutter;if(n){var r=t.line;r>=n.from&&r<n.to&&o(e,r,r+1)}}e.defineOption("foldGutter",!1,function(r,i,o){o&&o!=e.Init&&(r.clearGutter(r.state.foldGutter.options.gutter),r.state.foldGutter=null,r.off("gutterClick",l),r.off("change",s),r.off("viewportChange",c),r.off("fold",u),r.off("unfold",u),r.off("swapDoc",a)),i&&(r.state.foldGutter=new t(n(i)),a(r),r.on("gutterClick",l),r.on("change",s),r.on("viewportChange",c),r.on("fold",u),r.on("unfold",u),r.on("swapDoc",a))});var f=e.Pos}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.registerHelper("fold","markdown",function(t,n){function r(n){var r=t.getTokenTypeAt(e.Pos(n,0));return r&&/\bheader\b/.test(r)}function i(e,t,n){var i=t&&t.match(/^#+/);return i&&r(e)?i[0].length:(i=n&&n.match(/^[=\-]+\s*$/),i&&r(e+1)?"="==n[0]?1:2:o)}var o=100,a=t.getLine(n.line),l=t.getLine(n.line+1),s=i(n.line,a,l);if(s===o)return void 0;for(var c=t.lastLine(),u=n.line,f=t.getLine(u+2);c>u&&!(i(u+1,l,f)<=s);)++u,l=f,f=t.getLine(u+2);return{from:e.Pos(n.line,a.length),to:e.Pos(u,t.getLine(u).length)}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t){return e.line-t.line||e.ch-t.ch}function n(e,t,n,r){this.line=t,this.ch=n,this.cm=e,this.text=e.getLine(t),this.min=r?r.from:e.firstLine(),this.max=r?r.to-1:e.lastLine()}function r(e,t){var n=e.cm.getTokenTypeAt(d(e.line,t));return n&&/\btag\b/.test(n)}function i(e){return e.line>=e.max?void 0:(e.ch=0,e.text=e.cm.getLine(++e.line),!0)}function o(e){return e.line<=e.min?void 0:(e.text=e.cm.getLine(--e.line),e.ch=e.text.length,!0)}function a(e){for(;;){var t=e.text.indexOf(">",e.ch);if(-1==t){if(i(e))continue;return}{if(r(e,t+1)){var n=e.text.lastIndexOf("/",t),o=n>-1&&!/\S/.test(e.text.slice(n+1,t));return e.ch=t+1,o?"selfClose":"regular"}e.ch=t+1}}}function l(e){for(;;){var t=e.ch?e.text.lastIndexOf("<",e.ch-1):-1;if(-1==t){if(o(e))continue;return}if(r(e,t+1)){m.lastIndex=t,e.ch=t;var n=m.exec(e.text);if(n&&n.index==t)return n}else e.ch=t}}function s(e){for(;;){m.lastIndex=e.ch;var t=m.exec(e.text);if(!t){if(i(e))continue;return}{if(r(e,t.index+1))return e.ch=t.index+t[0].length,t;e.ch=t.index+1}}}function c(e){for(;;){var t=e.ch?e.text.lastIndexOf(">",e.ch-1):-1;if(-1==t){if(o(e))continue;return}{if(r(e,t+1)){var n=e.text.lastIndexOf("/",t),i=n>-1&&!/\S/.test(e.text.slice(n+1,t));return e.ch=t+1,i?"selfClose":"regular"}e.ch=t}}}function u(e,t){for(var n=[];;){var r,i=s(e),o=e.line,l=e.ch-(i?i[0].length:0);if(!i||!(r=a(e)))return;if("selfClose"!=r)if(i[1]){for(var c=n.length-1;c>=0;--c)if(n[c]==i[2]){n.length=c;break}if(0>c&&(!t||t==i[2]))return{tag:i[2],from:d(o,l),to:d(e.line,e.ch)}}else n.push(i[2])}}function f(e,t){for(var n=[];;){var r=c(e);if(!r)return;if("selfClose"!=r){var i=e.line,o=e.ch,a=l(e);if(!a)return;if(a[1])n.push(a[2]);else{for(var s=n.length-1;s>=0;--s)if(n[s]==a[2]){n.length=s;break}if(0>s&&(!t||t==a[2]))return{tag:a[2],from:d(e.line,e.ch),to:d(i,o)}}}else l(e)}}var d=e.Pos,h="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",p=h+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",m=new RegExp("<(/?)(["+h+"]["+p+"]*)","g");e.registerHelper("fold","xml",function(e,t){for(var r=new n(e,t.line,0);;){var i,o=s(r);if(!o||r.line!=t.line||!(i=a(r)))return;if(!o[1]&&"selfClose"!=i){var t=d(r.line,r.ch),l=u(r,o[2]);return l&&{from:t,to:l.from}}}}),e.findMatchingTag=function(e,r,i){var o=new n(e,r.line,r.ch,i);if(-1!=o.text.indexOf(">")||-1!=o.text.indexOf("<")){var s=a(o),c=s&&d(o.line,o.ch),h=s&&l(o);if(s&&h&&!(t(o,r)>0)){var p={from:d(o.line,o.ch),to:c,tag:h[2]};return"selfClose"==s?{open:p,close:null,at:"open"}:h[1]?{open:f(o,h[2]),close:p,at:"close"}:(o=new n(e,c.line,c.ch,i),{open:p,close:u(o,h[2]),at:"open"})}}},e.findEnclosingTag=function(e,t,r){for(var i=new n(e,t.line,t.ch,r);;){var o=f(i);if(!o)break;var a=new n(e,t.line,t.ch,r),l=u(a,o.tag);if(l)return{open:o,close:l}}},e.scanForClosingTag=function(e,t,r,i){var o=new n(e,t.line,t.ch,i?{from:0,to:i}:null);return u(o,r)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("xml",function(t,n){function r(e,t){function n(n){return t.tokenize=n,n(e,t)}var r=e.next();if("<"==r)return e.eat("!")?e.eat("[")?e.match("CDATA[")?n(a("atom","]]>")):null:e.match("--")?n(a("comment","-->")):e.match("DOCTYPE",!0,!0)?(e.eatWhile(/[\w\._\-]/),n(l(1))):null:e.eat("?")?(e.eatWhile(/[\w\._\-]/),t.tokenize=a("meta","?>"),"meta"):(C=e.eat("/")?"closeTag":"openTag",t.tokenize=i,"tag bracket");if("&"==r){var o;return o=e.eat("#")?e.eat("x")?e.eatWhile(/[a-fA-F\d]/)&&e.eat(";"):e.eatWhile(/[\d]/)&&e.eat(";"):e.eatWhile(/[\w\.\-:]/)&&e.eat(";"),o?"atom":"error"}return e.eatWhile(/[^&<]/),null}function i(e,t){var n=e.next();if(">"==n||"/"==n&&e.eat(">"))return t.tokenize=r,C=">"==n?"endTag":"selfcloseTag","tag bracket";if("="==n)return C="equals",null;if("<"==n){t.tokenize=r,t.state=f,t.tagName=t.tagStart=null;var i=t.tokenize(e,t);return i?i+" tag error":"tag error"}return/[\'\"]/.test(n)?(t.tokenize=o(n),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function o(e){var t=function(t,n){for(;!t.eol();)if(t.next()==e){n.tokenize=i;break}return"string"};return t.isInAttribute=!0,t}function a(e,t){return function(n,i){for(;!n.eol();){if(n.match(t)){i.tokenize=r;break}n.next()}return e}}function l(e){return function(t,n){for(var i;null!=(i=t.next());){if("<"==i)return n.tokenize=l(e+1),n.tokenize(t,n);if(">"==i){if(1==e){n.tokenize=r;break}return n.tokenize=l(e-1),n.tokenize(t,n)}}return"meta"}}function s(e,t,n){this.prev=e.context,this.tagName=t,this.indent=e.indented,this.startOfLine=n,(L.doNotIndent.hasOwnProperty(t)||e.context&&e.context.noIndent)&&(this.noIndent=!0)}function c(e){e.context&&(e.context=e.context.prev)}function u(e,t){for(var n;;){if(!e.context)return;if(n=e.context.tagName,!L.contextGrabbers.hasOwnProperty(n)||!L.contextGrabbers[n].hasOwnProperty(t))return;c(e)}}function f(e,t,n){return"openTag"==e?(n.tagStart=t.column(),d):"closeTag"==e?h:f}function d(e,t,n){return"word"==e?(n.tagName=t.current(),S="tag",g):(S="error",d)}function h(e,t,n){if("word"==e){var r=t.current();return n.context&&n.context.tagName!=r&&L.implicitlyClosed.hasOwnProperty(n.context.tagName)&&c(n),n.context&&n.context.tagName==r?(S="tag",p):(S="tag error",m)}return S="error",m}function p(e,t,n){return"endTag"!=e?(S="error",p):(c(n),f)}function m(e,t,n){return S="error",p(e,t,n)}function g(e,t,n){if("word"==e)return S="attribute",v;if("endTag"==e||"selfcloseTag"==e){var r=n.tagName,i=n.tagStart;return n.tagName=n.tagStart=null,"selfcloseTag"==e||L.autoSelfClosers.hasOwnProperty(r)?u(n,r):(u(n,r),n.context=new s(n,r,i==n.indented)),f}return S="error",g}function v(e,t,n){return"equals"==e?y:(L.allowMissing||(S="error"),g(e,t,n))}function y(e,t,n){return"string"==e?b:"word"==e&&L.allowUnquoted?(S="string",g):(S="error",g(e,t,n))}function b(e,t,n){return"string"==e?b:g(e,t,n)}var x=t.indentUnit,w=n.multilineTagIndentFactor||1,k=n.multilineTagIndentPastTag;null==k&&(k=!0);var C,S,L=n.htmlMode?{autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0}:{autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,caseFold:!1},M=n.alignCDATA;return{startState:function(){return{tokenize:r,state:f,indented:0,tagName:null,tagStart:null,context:null}},token:function(e,t){if(!t.tagName&&e.sol()&&(t.indented=e.indentation()),e.eatSpace())return null;C=null;var n=t.tokenize(e,t);return(n||C)&&"comment"!=n&&(S=null,t.state=t.state(C||n,e,t),S&&(n="error"==S?n+" error":S)),n},indent:function(t,n,o){var a=t.context;if(t.tokenize.isInAttribute)return t.tagStart==t.indented?t.stringStartCol+1:t.indented+x;if(a&&a.noIndent)return e.Pass;if(t.tokenize!=i&&t.tokenize!=r)return o?o.match(/^(\s*)/)[0].length:0;if(t.tagName)return k?t.tagStart+t.tagName.length+2:t.tagStart+x*w;if(M&&/<!\[CDATA\[/.test(n))return 0;var l=n&&/^<(\/)?([\w_:\.-]*)/.exec(n);if(l&&l[1])for(;a;){if(a.tagName==l[2]){a=a.prev;break}if(!L.implicitlyClosed.hasOwnProperty(a.tagName))break;a=a.prev}else if(l)for(;a;){var s=L.contextGrabbers[a.tagName];if(!s||!s.hasOwnProperty(l[2]))break;a=a.prev}for(;a&&!a.startOfLine;)a=a.prev;return a?a.indent+x:0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:n.htmlMode?"html":"xml",helperType:n.htmlMode?"html":"xml"}}),e.defineMIME("text/xml","xml"),e.defineMIME("application/xml","xml"),e.mimeModes.hasOwnProperty("text/html")||e.defineMIME("text/html",{name:"xml",htmlMode:!0})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../xml/xml"),require("../meta")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../meta"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("markdown",function(t,n){function r(n){if(e.findModeByName){var r=e.findModeByName(n);r&&(n=r.mime||r.mimes[0])}var i=e.getMode(t,n);return"null"==i.name?null:i}function i(e,t,n){return t.f=t.inline=n,n(e,t)}function o(e,t,n){return t.f=t.block=n,n(e,t)}function a(e){return e.linkTitle=!1,e.em=!1,e.strong=!1,e.strikethrough=!1,e.quote=0,w||e.f!=s||(e.f=h,e.block=l),e.trailingSpace=0,e.trailingSpaceNewLine=!1,e.thisLineHasContent=!1,null}function l(e,t){var o=e.sol(),a=t.list!==!1;a&&(t.indentationDiff>=0?(t.indentationDiff<4&&(t.indentation-=t.indentationDiff),t.list=null):t.indentation>0?(t.list=null,t.listDepth=Math.floor(t.indentation/4)):(t.list=!1,t.listDepth=0));var l=null;if(t.indentationDiff>=4)return t.indentation-=4,e.skipToEnd(),L;if(e.eatSpace())return null;if(l=e.match(U))return t.header=Math.min(6,-1!==l[0].indexOf(" ")?l[0].length-1:l[0].length),n.highlightFormatting&&(t.formatting="header"),t.f=t.inline,f(t);if(t.prevLineHasContent&&(l=e.match(V)))return t.header="="==l[0].charAt(0)?1:2,n.highlightFormatting&&(t.formatting="header"),t.f=t.inline,f(t);if(e.eat(">"))return t.indentation++,t.quote=o?1:t.quote+1,n.highlightFormatting&&(t.formatting="quote"),e.eatSpace(),f(t);if("["===e.peek())return i(e,t,v);if(e.match(j,!0))return N;if((!t.prevLineHasContent||a)&&(e.match(_,!1)||e.match(R,!1))){var s=null;return e.match(_,!0)?s="ul":(e.match(R,!0),s="ol"),t.indentation+=4,t.list=!0,t.listDepth++,n.taskLists&&e.match(q,!1)&&(t.taskList=!0),t.f=t.inline,n.highlightFormatting&&(t.formatting=["list","list-"+s]),f(t)}return n.fencedCodeBlocks&&e.match(/^```[ \t]*([\w+#]*)/,!0)?(t.localMode=r(RegExp.$1),t.localMode&&(t.localState=t.localMode.startState()),t.f=t.block=c,n.highlightFormatting&&(t.formatting="code-block"),t.code=!0,f(t)):i(e,t,t.inline)}function s(e,t){var n=k.token(e,t.htmlState);return(w&&null===t.htmlState.tagStart&&!t.htmlState.context||t.md_inside&&e.current().indexOf(">")>-1)&&(t.f=h,t.block=l,t.htmlState=null),n}function c(e,t){return e.sol()&&e.match("```",!1)?(t.localMode=t.localState=null,t.f=t.block=u,null):t.localMode?t.localMode.token(e,t.localState):(e.skipToEnd(),L)}function u(e,t){e.match("```"),t.block=l,t.f=h,n.highlightFormatting&&(t.formatting="code-block"),t.code=!0;var r=f(t);return t.code=!1,r}function f(e){var t=[];if(e.formatting){t.push(z),"string"==typeof e.formatting&&(e.formatting=[e.formatting]);for(var r=0;r<e.formatting.length;r++)t.push(z+"-"+e.formatting[r]),"header"===e.formatting[r]&&t.push(z+"-"+e.formatting[r]+"-"+e.header),"quote"===e.formatting[r]&&t.push(!n.maxBlockquoteDepth||n.maxBlockquoteDepth>=e.quote?z+"-"+e.formatting[r]+"-"+e.quote:"error")}if(e.taskOpen)return t.push("meta"),t.length?t.join(" "):null;if(e.taskClosed)return t.push("property"),t.length?t.join(" "):null;if(e.linkHref)return t.push(I),t.length?t.join(" "):null;if(e.strong&&t.push(H),e.em&&t.push(F),e.strikethrough&&t.push(B),e.linkText&&t.push(E),e.code&&t.push(L),e.header&&(t.push(S),t.push(S+"-"+e.header)),e.quote&&(t.push(M),t.push(!n.maxBlockquoteDepth||n.maxBlockquoteDepth>=e.quote?M+"-"+e.quote:M+"-"+n.maxBlockquoteDepth)),e.list!==!1){var i=(e.listDepth-1)%3;t.push(i?1===i?A:O:T)}return e.trailingSpaceNewLine?t.push("trailing-space-new-line"):e.trailingSpace&&t.push("trailing-space-"+(e.trailingSpace%2?"a":"b")),t.length?t.join(" "):null}function d(e,t){return e.match(G,!0)?f(t):void 0}function h(t,r){var i=r.text(t,r);if("undefined"!=typeof i)return i;if(r.list)return r.list=null,f(r);if(r.taskList){var a="x"!==t.match(q,!0)[1];return a?r.taskOpen=!0:r.taskClosed=!0,n.highlightFormatting&&(r.formatting="task"),r.taskList=!1,f(r)}if(r.taskOpen=!1,r.taskClosed=!1,r.header&&t.match(/^#+$/,!0))return n.highlightFormatting&&(r.formatting="header"),f(r);var l=t.sol(),c=t.next();if("\\"===c&&(t.next(),n.highlightFormatting)){var u=f(r);return u?u+" formatting-escape":"formatting-escape"}if(r.linkTitle){r.linkTitle=!1;var d=c;"("===c&&(d=")"),d=(d+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1");var h="^\\s*(?:[^"+d+"\\\\]+|\\\\\\\\|\\\\.)"+d;if(t.match(new RegExp(h),!0))return I}if("`"===c){var g=r.formatting;n.highlightFormatting&&(r.formatting="code");var v=f(r),y=t.pos;t.eatWhile("`");var b=1+t.pos-y;return r.code?b===C?(r.code=!1,v):(r.formatting=g,f(r)):(C=b,r.code=!0,f(r))}if(r.code)return f(r);if("!"===c&&t.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return t.match(/\[[^\]]*\]/),r.inline=r.f=m,P;if("["===c&&t.match(/.*\](\(.*\)| ?\[.*\])/,!1))return r.linkText=!0,n.highlightFormatting&&(r.formatting="link"),f(r);if("]"===c&&r.linkText&&t.match(/\(.*\)| ?\[.*\]/,!1)){n.highlightFormatting&&(r.formatting="link");var u=f(r);return r.linkText=!1,r.inline=r.f=m,u}if("<"===c&&t.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){r.f=r.inline=p,n.highlightFormatting&&(r.formatting="link");var u=f(r);return u?u+=" ":u="",u+D}if("<"===c&&t.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){r.f=r.inline=p,n.highlightFormatting&&(r.formatting="link");var u=f(r);return u?u+=" ":u="",u+W}if("<"===c&&t.match(/^\w/,!1)){if(-1!=t.string.indexOf(">")){var x=t.string.substring(1,t.string.indexOf(">"));/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(x)&&(r.md_inside=!0)}return t.backUp(1),r.htmlState=e.startState(k),o(t,r,s)}if("<"===c&&t.match(/^\/\w*?>/))return r.md_inside=!1,"tag";var w=!1;if(!n.underscoresBreakWords&&"_"===c&&"_"!==t.peek()&&t.match(/(\w)/,!1)){var S=t.pos-2;if(S>=0){var L=t.string.charAt(S);"_"!==L&&L.match(/(\w)/,!1)&&(w=!0)}}if("*"===c||"_"===c&&!w)if(l&&" "===t.peek());else{if(r.strong===c&&t.eat(c)){n.highlightFormatting&&(r.formatting="strong");var v=f(r);return r.strong=!1,v}if(!r.strong&&t.eat(c))return r.strong=c,n.highlightFormatting&&(r.formatting="strong"),f(r);if(r.em===c){n.highlightFormatting&&(r.formatting="em");var v=f(r);return r.em=!1,v}if(!r.em)return r.em=c,n.highlightFormatting&&(r.formatting="em"),f(r)}else if(" "===c&&(t.eat("*")||t.eat("_"))){if(" "===t.peek())return f(r);t.backUp(1)}if(n.strikethrough)if("~"===c&&t.eatWhile(c)){if(r.strikethrough){n.highlightFormatting&&(r.formatting="strikethrough");var v=f(r);return r.strikethrough=!1,v}if(t.match(/^[^\s]/,!1))return r.strikethrough=!0,n.highlightFormatting&&(r.formatting="strikethrough"),f(r)}else if(" "===c&&t.match(/^~~/,!0)){if(" "===t.peek())return f(r);t.backUp(2)}return" "===c&&(t.match(/ +$/,!1)?r.trailingSpace++:r.trailingSpace&&(r.trailingSpaceNewLine=!0)),f(r)}function p(e,t){var r=e.next();if(">"===r){t.f=t.inline=h,n.highlightFormatting&&(t.formatting="link");var i=f(t);return i?i+=" ":i="",i+D}return e.match(/^[^>]+/,!0),D}function m(e,t){if(e.eatSpace())return null;var r=e.next();return"("===r||"["===r?(t.f=t.inline=g("("===r?")":"]"),n.highlightFormatting&&(t.formatting="link-string"),t.linkHref=!0,f(t)):"error"}function g(e){return function(t,r){var i=t.next();if(i===e){r.f=r.inline=h,n.highlightFormatting&&(r.formatting="link-string");var o=f(r);return r.linkHref=!1,o}return t.match(x(e),!0)&&t.backUp(1),r.linkHref=!0,f(r)}}function v(e,t){return e.match(/^[^\]]*\]:/,!1)?(t.f=y,e.next(),n.highlightFormatting&&(t.formatting="link"),t.linkText=!0,f(t)):i(e,t,h)}function y(e,t){if(e.match(/^\]:/,!0)){t.f=t.inline=b,n.highlightFormatting&&(t.formatting="link");var r=f(t);return t.linkText=!1,r}return e.match(/^[^\]]+/,!0),E}function b(e,t){return e.eatSpace()?null:(e.match(/^[^\s]+/,!0),void 0===e.peek()?t.linkTitle=!0:e.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),t.f=t.inline=h,I)}function x(e){return K[e]||(e=(e+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),K[e]=new RegExp("^(?:[^\\\\]|\\\\.)*?("+e+")")),K[e]}var w=e.modes.hasOwnProperty("xml"),k=e.getMode(t,w?{name:"xml",htmlMode:!0}:"text/plain");void 0===n.highlightFormatting&&(n.highlightFormatting=!1),void 0===n.maxBlockquoteDepth&&(n.maxBlockquoteDepth=0),void 0===n.underscoresBreakWords&&(n.underscoresBreakWords=!0),void 0===n.fencedCodeBlocks&&(n.fencedCodeBlocks=!1),void 0===n.taskLists&&(n.taskLists=!1),void 0===n.strikethrough&&(n.strikethrough=!1);var C=0,S="header",L="comment",M="quote",T="variable-2",A="variable-3",O="keyword",N="hr",P="tag",z="formatting",D="link",W="link",E="link",I="string",F="em",H="strong",B="strikethrough",j=/^([*\-=_])(?:\s*\1){2,}\s*$/,_=/^[*\-+]\s+/,R=/^[0-9]+\.\s+/,q=/^\[(x| )\](?=\s)/,U=/^#+ ?/,V=/^(?:\={1,}|-{1,})$/,G=/^[^#!\[\]*_\\<>` "'(~]+/,K=[],$={startState:function(){return{f:l,prevLineHasContent:!1,thisLineHasContent:!1,block:l,htmlState:null,indentation:0,inline:h,text:d,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,em:!1,strong:!1,header:0,taskList:!1,list:!1,listDepth:0,quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1}},copyState:function(t){return{f:t.f,prevLineHasContent:t.prevLineHasContent,thisLineHasContent:t.thisLineHasContent,block:t.block,htmlState:t.htmlState&&e.copyState(k,t.htmlState),indentation:t.indentation,localMode:t.localMode,localState:t.localMode?e.copyState(t.localMode,t.localState):null,inline:t.inline,text:t.text,formatting:!1,linkTitle:t.linkTitle,em:t.em,strong:t.strong,strikethrough:t.strikethrough,header:t.header,taskList:t.taskList,list:t.list,listDepth:t.listDepth,quote:t.quote,trailingSpace:t.trailingSpace,trailingSpaceNewLine:t.trailingSpaceNewLine,md_inside:t.md_inside}},token:function(e,t){if(t.formatting=!1,e.sol()){var n=!!t.header;if(t.header=0,e.match(/^\s*$/,!0)||n)return t.prevLineHasContent=!1,a(t),n?this.token(e,t):null;t.prevLineHasContent=t.thisLineHasContent,t.thisLineHasContent=!0,t.taskList=!1,t.code=!1,t.trailingSpace=0,t.trailingSpaceNewLine=!1,t.f=t.block;var r=e.match(/^\s*/,!0)[0].replace(/\t/g," ").length,i=4*Math.floor((r-t.indentation)/4);i>4&&(i=4);var o=t.indentation+i;if(t.indentationDiff=o-t.indentation,t.indentation=o,r>0)return null}return t.f(e,t)},innerMode:function(e){return e.block==s?{state:e.htmlState,mode:k}:e.localState?{state:e.localState,mode:e.localMode}:{state:e,mode:$}},blankLine:a,getType:f,fold:"markdown"};return $},"xml"),e.defineMIME("text/x-markdown","markdown")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../markdown/markdown"),require("../../addon/mode/overlay")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../markdown/markdown","../../addon/mode/overlay"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("gfm",function(t,n){function r(e){return e.code=!1,null}var i=0,o={startState:function(){return{code:!1,codeBlock:!1,ateSpace:!1}},copyState:function(e){return{code:e.code,codeBlock:e.codeBlock,ateSpace:e.ateSpace}},token:function(e,t){if(t.combineTokens=null,t.codeBlock)return e.match(/^```/)?(t.codeBlock=!1,null):(e.skipToEnd(),null);if(e.sol()&&(t.code=!1),e.sol()&&e.match(/^```/))return e.skipToEnd(),t.codeBlock=!0,null;if("`"===e.peek()){e.next();var n=e.pos;e.eatWhile("`");var r=1+e.pos-n;return t.code?r===i&&(t.code=!1):(i=r,t.code=!0),null}if(t.code)return e.next(),null;if(e.eatSpace())return t.ateSpace=!0,null;if(e.sol()||t.ateSpace){if(t.ateSpace=!1,e.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+@)?(?:[a-f0-9]{7,40}\b)/))return t.combineTokens=!0,"link";if(e.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+)?#[0-9]+\b/))return t.combineTokens=!0,"link"}return e.match(/^((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?«»“”‘’]))/i)&&"]("!=e.string.slice(e.start-2,e.start)?(t.combineTokens=!0,"link"):(e.next(),null)},blankLine:r},a={underscoresBreakWords:!1,taskLists:!0,fencedCodeBlocks:!0,strikethrough:!0};for(var l in n)a[l]=n[l];return a.name="markdown",e.defineMIME("gfmBase",a),e.overlayMode(e.getMode(t,"gfmBase"),o)},"markdown")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("javascript",function(t,n){function r(e){for(var t,n=!1,r=!1;null!=(t=e.next());){if(!n){if("/"==t&&!r)return;"["==t?r=!0:r&&"]"==t&&(r=!1)}n=!n&&"\\"==t}}function i(e,t,n){return ge=e,ve=n,t}function o(e,t){var n=e.next();if('"'==n||"'"==n)return t.tokenize=a(n),t.tokenize(e,t);if("."==n&&e.match(/^\d+(?:[eE][+\-]?\d+)?/))return i("number","number");if("."==n&&e.match(".."))return i("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(n))return i(n);if("="==n&&e.eat(">"))return i("=>","operator");if("0"==n&&e.eat(/x/i))return e.eatWhile(/[\da-f]/i),i("number","number");if(/\d/.test(n))return e.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),i("number","number");if("/"==n)return e.eat("*")?(t.tokenize=l,l(e,t)):e.eat("/")?(e.skipToEnd(),i("comment","comment")):"operator"==t.lastType||"keyword c"==t.lastType||"sof"==t.lastType||/^[\[{}\(,;:]$/.test(t.lastType)?(r(e),e.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/),i("regexp","string-2")):(e.eatWhile(Le),i("operator","operator",e.current()));if("`"==n)return t.tokenize=s,s(e,t);if("#"==n)return e.skipToEnd(),i("error","error");if(Le.test(n))return e.eatWhile(Le),i("operator","operator",e.current());if(Ce.test(n)){e.eatWhile(Ce);var o=e.current(),c=Se.propertyIsEnumerable(o)&&Se[o];return c&&"."!=t.lastType?i(c.type,c.style,o):i("variable","variable",o)}}function a(e){return function(t,n){var r,a=!1;if(xe&&"@"==t.peek()&&t.match(Me))return n.tokenize=o,i("jsonld-keyword","meta");for(;null!=(r=t.next())&&(r!=e||a);)a=!a&&"\\"==r;return a||(n.tokenize=o),i("string","string")}}function l(e,t){for(var n,r=!1;n=e.next();){if("/"==n&&r){t.tokenize=o;break}r="*"==n}return i("comment","comment")}function s(e,t){for(var n,r=!1;null!=(n=e.next());){if(!r&&("`"==n||"$"==n&&e.eat("{"))){t.tokenize=o;break}r=!r&&"\\"==n}return i("quasi","string-2",e.current())}function c(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var n=e.string.indexOf("=>",e.start);if(!(0>n)){for(var r=0,i=!1,o=n-1;o>=0;--o){var a=e.string.charAt(o),l=Te.indexOf(a);if(l>=0&&3>l){if(!r){++o;break}if(0==--r)break}else if(l>=3&&6>l)++r;else if(Ce.test(a))i=!0;else{if(/["'\/]/.test(a))return;if(i&&!r){++o;break}}}i&&!r&&(t.fatArrowAt=o)}}function u(e,t,n,r,i,o){this.indented=e,this.column=t,this.type=n,this.prev=i,this.info=o,null!=r&&(this.align=r)}function f(e,t){for(var n=e.localVars;n;n=n.next)if(n.name==t)return!0;for(var r=e.context;r;r=r.prev)for(var n=r.vars;n;n=n.next)if(n.name==t)return!0}function d(e,t,n,r,i){var o=e.cc;for(Oe.state=e,Oe.stream=i,Oe.marked=null,Oe.cc=o,Oe.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;){var a=o.length?o.pop():we?k:w;if(a(n,r)){for(;o.length&&o[o.length-1].lex;)o.pop()();return Oe.marked?Oe.marked:"variable"==n&&f(e,r)?"variable-2":t}}}function h(){for(var e=arguments.length-1;e>=0;e--)Oe.cc.push(arguments[e])}function p(){return h.apply(null,arguments),!0}function m(e){function t(t){for(var n=t;n;n=n.next)if(n.name==e)return!0;return!1}var r=Oe.state;if(r.context){if(Oe.marked="def",t(r.localVars))return;r.localVars={name:e,next:r.localVars}}else{if(t(r.globalVars))return;n.globalVars&&(r.globalVars={name:e,next:r.globalVars})}}function g(){Oe.state.context={prev:Oe.state.context,vars:Oe.state.localVars},Oe.state.localVars=Ne}function v(){Oe.state.localVars=Oe.state.context.vars,Oe.state.context=Oe.state.context.prev}function y(e,t){var n=function(){var n=Oe.state,r=n.indented;if("stat"==n.lexical.type)r=n.lexical.indented;else for(var i=n.lexical;i&&")"==i.type&&i.align;i=i.prev)r=i.indented;n.lexical=new u(r,Oe.stream.column(),e,null,n.lexical,t)};return n.lex=!0,n}function b(){var e=Oe.state;e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function x(e){function t(n){return n==e?p():";"==e?h():p(t)}return t}function w(e,t){return"var"==e?p(y("vardef",t.length),q,x(";"),b):"keyword a"==e?p(y("form"),k,w,b):"keyword b"==e?p(y("form"),w,b):"{"==e?p(y("}"),j,b):";"==e?p():"if"==e?("else"==Oe.state.lexical.info&&Oe.state.cc[Oe.state.cc.length-1]==b&&Oe.state.cc.pop()(),p(y("form"),k,w,b,$)):"function"==e?p(ee):"for"==e?p(y("form"),X,w,b):"variable"==e?p(y("stat"),D):"switch"==e?p(y("form"),k,y("}","switch"),x("{"),j,b,b):"case"==e?p(k,x(":")):"default"==e?p(x(":")):"catch"==e?p(y("form"),g,x("("),te,x(")"),w,b,v):"module"==e?p(y("form"),g,ae,v,b):"class"==e?p(y("form"),ne,b):"export"==e?p(y("form"),le,b):"import"==e?p(y("form"),se,b):h(y("stat"),k,x(";"),b)}function k(e){return S(e,!1)}function C(e){return S(e,!0)}function S(e,t){if(Oe.state.fatArrowAt==Oe.stream.start){var n=t?z:P;if("("==e)return p(g,y(")"),H(U,")"),b,x("=>"),n,v);if("variable"==e)return h(g,U,x("=>"),n,v)}var r=t?A:T;return Ae.hasOwnProperty(e)?p(r):"function"==e?p(ee,r):"keyword c"==e?p(t?M:L):"("==e?p(y(")"),L,pe,x(")"),b,r):"operator"==e||"spread"==e?p(t?C:k):"["==e?p(y("]"),de,b,r):"{"==e?B(E,"}",null,r):"quasi"==e?h(O,r):p()}function L(e){return e.match(/[;\}\)\],]/)?h():h(k)}function M(e){return e.match(/[;\}\)\],]/)?h():h(C)}function T(e,t){return","==e?p(k):A(e,t,!1)}function A(e,t,n){var r=0==n?T:A,i=0==n?k:C;return"=>"==e?p(g,n?z:P,v):"operator"==e?/\+\+|--/.test(t)?p(r):"?"==t?p(k,x(":"),i):p(i):"quasi"==e?h(O,r):";"!=e?"("==e?B(C,")","call",r):"."==e?p(W,r):"["==e?p(y("]"),L,x("]"),b,r):void 0:void 0}function O(e,t){return"quasi"!=e?h():"${"!=t.slice(t.length-2)?p(O):p(k,N)}function N(e){return"}"==e?(Oe.marked="string-2",Oe.state.tokenize=s,p(O)):void 0}function P(e){return c(Oe.stream,Oe.state),h("{"==e?w:k)}function z(e){return c(Oe.stream,Oe.state),h("{"==e?w:C)}function D(e){return":"==e?p(b,w):h(T,x(";"),b)}function W(e){return"variable"==e?(Oe.marked="property",p()):void 0}function E(e,t){return"variable"==e||"keyword"==Oe.style?(Oe.marked="property",p("get"==t||"set"==t?I:F)):"number"==e||"string"==e?(Oe.marked=xe?"property":Oe.style+" property",p(F)):"jsonld-keyword"==e?p(F):"["==e?p(k,x("]"),F):void 0}function I(e){return"variable"!=e?h(F):(Oe.marked="property",p(ee))}function F(e){return":"==e?p(C):"("==e?h(ee):void 0}function H(e,t){function n(r){if(","==r){var i=Oe.state.lexical;return"call"==i.info&&(i.pos=(i.pos||0)+1),p(e,n)}return r==t?p():p(x(t))}return function(r){return r==t?p():h(e,n)}}function B(e,t,n){for(var r=3;r<arguments.length;r++)Oe.cc.push(arguments[r]);return p(y(t,n),H(e,t),b)}function j(e){return"}"==e?p():h(w,j)}function _(e){return ke&&":"==e?p(R):void 0}function R(e){return"variable"==e?(Oe.marked="variable-3",p()):void 0}function q(){return h(U,_,G,K)}function U(e,t){return"variable"==e?(m(t),p()):"["==e?B(U,"]"):"{"==e?B(V,"}"):void 0}function V(e,t){return"variable"!=e||Oe.stream.match(/^\s*:/,!1)?("variable"==e&&(Oe.marked="property"),p(x(":"),U,G)):(m(t),p(G))}function G(e,t){return"="==t?p(C):void 0}function K(e){return","==e?p(q):void 0}function $(e,t){return"keyword b"==e&&"else"==t?p(y("form","else"),w,b):void 0}function X(e){return"("==e?p(y(")"),Y,x(")"),b):void 0}function Y(e){return"var"==e?p(q,x(";"),Q):";"==e?p(Q):"variable"==e?p(Z):h(k,x(";"),Q)}function Z(e,t){return"in"==t||"of"==t?(Oe.marked="keyword",p(k)):p(T,Q)}function Q(e,t){return";"==e?p(J):"in"==t||"of"==t?(Oe.marked="keyword",p(k)):h(k,x(";"),J)}function J(e){")"!=e&&p(k)}function ee(e,t){return"*"==t?(Oe.marked="keyword",p(ee)):"variable"==e?(m(t),p(ee)):"("==e?p(g,y(")"),H(te,")"),b,w,v):void 0}function te(e){return"spread"==e?p(te):h(U,_)}function ne(e,t){return"variable"==e?(m(t),p(re)):void 0}function re(e,t){return"extends"==t?p(k,re):"{"==e?p(y("}"),ie,b):void 0}function ie(e,t){return"variable"==e||"keyword"==Oe.style?"static"==t?(Oe.marked="keyword", +p(ie)):(Oe.marked="property","get"==t||"set"==t?p(oe,ee,ie):p(ee,ie)):"*"==t?(Oe.marked="keyword",p(ie)):";"==e?p(ie):"}"==e?p():void 0}function oe(e){return"variable"!=e?h():(Oe.marked="property",p())}function ae(e,t){return"string"==e?p(w):"variable"==e?(m(t),p(fe)):void 0}function le(e,t){return"*"==t?(Oe.marked="keyword",p(fe,x(";"))):"default"==t?(Oe.marked="keyword",p(k,x(";"))):h(w)}function se(e){return"string"==e?p():h(ce,fe)}function ce(e,t){return"{"==e?B(ce,"}"):("variable"==e&&m(t),"*"==t&&(Oe.marked="keyword"),p(ue))}function ue(e,t){return"as"==t?(Oe.marked="keyword",p(ce)):void 0}function fe(e,t){return"from"==t?(Oe.marked="keyword",p(k)):void 0}function de(e){return"]"==e?p():h(C,he)}function he(e){return"for"==e?h(pe,x("]")):","==e?p(H(M,"]")):h(H(C,"]"))}function pe(e){return"for"==e?p(X,pe):"if"==e?p(k,pe):void 0}function me(e,t){return"operator"==e.lastType||","==e.lastType||Le.test(t.charAt(0))||/[,.]/.test(t.charAt(0))}var ge,ve,ye=t.indentUnit,be=n.statementIndent,xe=n.jsonld,we=n.json||xe,ke=n.typescript,Ce=n.wordCharacters||/[\w$\xa1-\uffff]/,Se=function(){function e(e){return{type:e,style:"keyword"}}var t=e("keyword a"),n=e("keyword b"),r=e("keyword c"),i=e("operator"),o={type:"atom",style:"atom"},a={"if":e("if"),"while":t,"with":t,"else":n,"do":n,"try":n,"finally":n,"return":r,"break":r,"continue":r,"new":r,"delete":r,"throw":r,"debugger":r,"var":e("var"),"const":e("var"),let:e("var"),"function":e("function"),"catch":e("catch"),"for":e("for"),"switch":e("switch"),"case":e("case"),"default":e("default"),"in":i,"typeof":i,"instanceof":i,"true":o,"false":o,"null":o,undefined:o,NaN:o,Infinity:o,"this":e("this"),module:e("module"),"class":e("class"),"super":e("atom"),"yield":r,"export":e("export"),"import":e("import"),"extends":r};if(ke){var l={type:"variable",style:"variable-3"},s={"interface":e("interface"),"extends":e("extends"),constructor:e("constructor"),"public":e("public"),"private":e("private"),"protected":e("protected"),"static":e("static"),string:l,number:l,bool:l,any:l};for(var c in s)a[c]=s[c]}return a}(),Le=/[+\-*&%=<>!?|~^]/,Me=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,Te="([{}])",Ae={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0,"jsonld-keyword":!0},Oe={state:null,column:null,marked:null,cc:null},Ne={name:"this",next:{name:"arguments"}};return b.lex=!0,{startState:function(e){var t={tokenize:o,lastType:"sof",cc:[],lexical:new u((e||0)-ye,0,"block",!1),localVars:n.localVars,context:n.localVars&&{vars:n.localVars},indented:0};return n.globalVars&&"object"==typeof n.globalVars&&(t.globalVars=n.globalVars),t},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),c(e,t)),t.tokenize!=l&&e.eatSpace())return null;var n=t.tokenize(e,t);return"comment"==ge?n:(t.lastType="operator"!=ge||"++"!=ve&&"--"!=ve?ge:"incdec",d(t,n,ge,ve,e))},indent:function(t,r){if(t.tokenize==l)return e.Pass;if(t.tokenize!=o)return 0;var i=r&&r.charAt(0),a=t.lexical;if(!/^\s*else\b/.test(r))for(var s=t.cc.length-1;s>=0;--s){var c=t.cc[s];if(c==b)a=a.prev;else if(c!=$)break}"stat"==a.type&&"}"==i&&(a=a.prev),be&&")"==a.type&&"stat"==a.prev.type&&(a=a.prev);var u=a.type,f=i==u;return"vardef"==u?a.indented+("operator"==t.lastType||","==t.lastType?a.info+1:0):"form"==u&&"{"==i?a.indented:"form"==u?a.indented+ye:"stat"==u?a.indented+(me(t,r)?be||ye:0):"switch"!=a.info||f||0==n.doubleIndentSwitch?a.align?a.column+(f?0:1):a.indented+(f?0:ye):a.indented+(/^(?:case|default)\b/.test(r)?ye:2*ye)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:we?null:"/*",blockCommentEnd:we?null:"*/",lineComment:we?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:we?"json":"javascript",jsonldMode:xe,jsonMode:we}}),e.registerHelper("wordChars","javascript",/[\w$]/),e.defineMIME("text/javascript","javascript"),e.defineMIME("text/ecmascript","javascript"),e.defineMIME("application/javascript","javascript"),e.defineMIME("application/x-javascript","javascript"),e.defineMIME("application/ecmascript","javascript"),e.defineMIME("application/json",{name:"javascript",json:!0}),e.defineMIME("application/x-json",{name:"javascript",json:!0}),e.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),e.defineMIME("text/typescript",{name:"javascript",typescript:!0}),e.defineMIME("application/typescript",{name:"javascript",typescript:!0})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){for(var t={},n=0;n<e.length;++n)t[e[n]]=!0;return t}function n(e,t){for(var n,r=!1;null!=(n=e.next());){if(r&&"/"==n){t.tokenize=null;break}r="*"==n}return["comment","comment"]}function r(e,t){return e.skipTo("-->")?(e.match("-->"),t.tokenize=null):e.skipToEnd(),["comment","comment"]}e.defineMode("css",function(t,n){function r(e,t){return h=t,e}function i(e,t){var n=e.next();if(g[n]){var i=g[n](e,t);if(i!==!1)return i}return"@"==n?(e.eatWhile(/[\w\\\-]/),r("def",e.current())):"="==n||("~"==n||"|"==n)&&e.eat("=")?r(null,"compare"):'"'==n||"'"==n?(t.tokenize=o(n),t.tokenize(e,t)):"#"==n?(e.eatWhile(/[\w\\\-]/),r("atom","hash")):"!"==n?(e.match(/^\s*\w*/),r("keyword","important")):/\d/.test(n)||"."==n&&e.eat(/\d/)?(e.eatWhile(/[\w.%]/),r("number","unit")):"-"!==n?/[,+>*\/]/.test(n)?r(null,"select-op"):"."==n&&e.match(/^-?[_a-z][_a-z0-9-]*/i)?r("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(n)?r(null,n):"u"==n&&e.match(/rl(-prefix)?\(/)||"d"==n&&e.match("omain(")||"r"==n&&e.match("egexp(")?(e.backUp(1),t.tokenize=a,r("property","word")):/[\w\\\-]/.test(n)?(e.eatWhile(/[\w\\\-]/),r("property","word")):r(null,null):/[\d.]/.test(e.peek())?(e.eatWhile(/[\w.%]/),r("number","unit")):e.match(/^-[\w\\\-]+/)?(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?r("variable-2","variable-definition"):r("variable-2","variable")):e.match(/^\w+-/)?r("meta","meta"):void 0}function o(e){return function(t,n){for(var i,o=!1;null!=(i=t.next());){if(i==e&&!o){")"==e&&t.backUp(1);break}o=!o&&"\\"==i}return(i==e||!o&&")"!=e)&&(n.tokenize=null),r("string","string")}}function a(e,t){return e.next(),e.match(/\s*[\"\')]/,!1)?t.tokenize=null:t.tokenize=o(")"),r(null,"(")}function l(e,t,n){this.type=e,this.indent=t,this.prev=n}function s(e,t,n){return e.context=new l(n,t.indentation()+m,e.context),n}function c(e){return e.context=e.context.prev,e.context.type}function u(e,t,n){return T[n.context.type](e,t,n)}function f(e,t,n,r){for(var i=r||1;i>0;i--)n.context=n.context.prev;return u(e,t,n)}function d(e){var t=e.current().toLowerCase();p=L.hasOwnProperty(t)?"atom":S.hasOwnProperty(t)?"keyword":"variable"}n.propertyKeywords||(n=e.resolveMode("text/css"));var h,p,m=t.indentUnit,g=n.tokenHooks,v=n.documentTypes||{},y=n.mediaTypes||{},b=n.mediaFeatures||{},x=n.propertyKeywords||{},w=n.nonStandardPropertyKeywords||{},k=n.fontProperties||{},C=n.counterDescriptors||{},S=n.colorKeywords||{},L=n.valueKeywords||{},M=n.allowNested,T={};return T.top=function(e,t,n){if("{"==e)return s(n,t,"block");if("}"==e&&n.context.prev)return c(n);if(/@(media|supports|(-moz-)?document)/.test(e))return s(n,t,"atBlock");if(/@(font-face|counter-style)/.test(e))return n.stateArg=e,"restricted_atBlock_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(e))return"keyframes";if(e&&"@"==e.charAt(0))return s(n,t,"at");if("hash"==e)p="builtin";else if("word"==e)p="tag";else{if("variable-definition"==e)return"maybeprop";if("interpolation"==e)return s(n,t,"interpolation");if(":"==e)return"pseudo";if(M&&"("==e)return s(n,t,"parens")}return n.context.type},T.block=function(e,t,n){if("word"==e){var r=t.current().toLowerCase();return x.hasOwnProperty(r)?(p="property","maybeprop"):w.hasOwnProperty(r)?(p="string-2","maybeprop"):M?(p=t.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(p+=" error","maybeprop")}return"meta"==e?"block":M||"hash"!=e&&"qualifier"!=e?T.top(e,t,n):(p="error","block")},T.maybeprop=function(e,t,n){return":"==e?s(n,t,"prop"):u(e,t,n)},T.prop=function(e,t,n){if(";"==e)return c(n);if("{"==e&&M)return s(n,t,"propBlock");if("}"==e||"{"==e)return f(e,t,n);if("("==e)return s(n,t,"parens");if("hash"!=e||/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(t.current())){if("word"==e)d(t);else if("interpolation"==e)return s(n,t,"interpolation")}else p+=" error";return"prop"},T.propBlock=function(e,t,n){return"}"==e?c(n):"word"==e?(p="property","maybeprop"):n.context.type},T.parens=function(e,t,n){return"{"==e||"}"==e?f(e,t,n):")"==e?c(n):"("==e?s(n,t,"parens"):"interpolation"==e?s(n,t,"interpolation"):("word"==e&&d(t),"parens")},T.pseudo=function(e,t,n){return"word"==e?(p="variable-3",n.context.type):u(e,t,n)},T.atBlock=function(e,t,n){if("("==e)return s(n,t,"atBlock_parens");if("}"==e)return f(e,t,n);if("{"==e)return c(n)&&s(n,t,M?"block":"top");if("word"==e){var r=t.current().toLowerCase();p="only"==r||"not"==r||"and"==r||"or"==r?"keyword":v.hasOwnProperty(r)?"tag":y.hasOwnProperty(r)?"attribute":b.hasOwnProperty(r)?"property":x.hasOwnProperty(r)?"property":w.hasOwnProperty(r)?"string-2":L.hasOwnProperty(r)?"atom":"error"}return n.context.type},T.atBlock_parens=function(e,t,n){return")"==e?c(n):"{"==e||"}"==e?f(e,t,n,2):T.atBlock(e,t,n)},T.restricted_atBlock_before=function(e,t,n){return"{"==e?s(n,t,"restricted_atBlock"):"word"==e&&"@counter-style"==n.stateArg?(p="variable","restricted_atBlock_before"):u(e,t,n)},T.restricted_atBlock=function(e,t,n){return"}"==e?(n.stateArg=null,c(n)):"word"==e?(p="@font-face"==n.stateArg&&!k.hasOwnProperty(t.current().toLowerCase())||"@counter-style"==n.stateArg&&!C.hasOwnProperty(t.current().toLowerCase())?"error":"property","maybeprop"):"restricted_atBlock"},T.keyframes=function(e,t,n){return"word"==e?(p="variable","keyframes"):"{"==e?s(n,t,"top"):u(e,t,n)},T.at=function(e,t,n){return";"==e?c(n):"{"==e||"}"==e?f(e,t,n):("word"==e?p="tag":"hash"==e&&(p="builtin"),"at")},T.interpolation=function(e,t,n){return"}"==e?c(n):"{"==e||";"==e?f(e,t,n):("word"==e?p="variable":"variable"!=e&&(p="error"),"interpolation")},{startState:function(e){return{tokenize:null,state:"top",stateArg:null,context:new l("top",e||0,null)}},token:function(e,t){if(!t.tokenize&&e.eatSpace())return null;var n=(t.tokenize||i)(e,t);return n&&"object"==typeof n&&(h=n[1],n=n[0]),p=n,t.state=T[t.state](h,e,t),p},indent:function(e,t){var n=e.context,r=t&&t.charAt(0),i=n.indent;return"prop"!=n.type||"}"!=r&&")"!=r||(n=n.prev),!n.prev||("}"!=r||"block"!=n.type&&"top"!=n.type&&"interpolation"!=n.type&&"restricted_atBlock"!=n.type)&&(")"!=r||"parens"!=n.type&&"atBlock_parens"!=n.type)&&("{"!=r||"at"!=n.type&&"atBlock"!=n.type)||(i=n.indent-m,n=n.prev),i},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",fold:"brace"}});var i=["domain","regexp","url","url-prefix"],o=t(i),a=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],l=t(a),s=["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid"],c=t(s),u=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-position","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marker-offset","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode"],f=t(u),d=["scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-3d-light-color","scrollbar-track-color","shape-inside","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","zoom"],h=t(d),p=["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"],m=t(p),g=["additive-symbols","fallback","negative","pad","prefix","range","speak-as","suffix","symbols","system"],v=t(g),y=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],b=t(y),x=["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","column","compact","condensed","contain","content","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","flex","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","malayalam","match","matrix","matrix3d","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row-resize","rtl","run-in","running","s-resize","sans-serif","scale","scale3d","scaleX","scaleY","scaleZ","scroll","scrollbar","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","solid","somali","source-atop","source-in","source-out","source-over","space","spell-out","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","symbolic","symbols","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","x-large","x-small","xor","xx-large","xx-small"],w=t(x),k=i.concat(a).concat(s).concat(u).concat(d).concat(y).concat(x);e.registerHelper("hintWords","css",k),e.defineMIME("text/css",{documentTypes:o,mediaTypes:l,mediaFeatures:c,propertyKeywords:f,nonStandardPropertyKeywords:h,fontProperties:m,counterDescriptors:v,colorKeywords:b,valueKeywords:w,tokenHooks:{"<":function(e,t){return e.match("!--")?(t.tokenize=r,r(e,t)):!1},"/":function(e,t){return e.eat("*")?(t.tokenize=n,n(e,t)):!1}},name:"css"}),e.defineMIME("text/x-scss",{mediaTypes:l,mediaFeatures:c,propertyKeywords:f,nonStandardPropertyKeywords:h,colorKeywords:b,valueKeywords:w,fontProperties:m,allowNested:!0,tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=n,n(e,t)):["operator","operator"]},":":function(e){return e.match(/\s*\{/)?[null,"{"]:!1},$:function(e){return e.match(/^[\w-]+/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"]},"#":function(e){return e.eat("{")?[null,"interpolation"]:!1}},name:"css",helperType:"scss"}),e.defineMIME("text/x-less",{mediaTypes:l,mediaFeatures:c,propertyKeywords:f,nonStandardPropertyKeywords:h,colorKeywords:b,valueKeywords:w,fontProperties:m,allowNested:!0,tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=n,n(e,t)):["operator","operator"]},"@":function(e){return e.eat("{")?[null,"interpolation"]:e.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/,!1)?!1:(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"])},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../xml/xml"),require("../javascript/javascript"),require("../css/css")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../javascript/javascript","../css/css"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("htmlmixed",function(t,n){function r(e,t){var n=t.htmlState.tagName;n&&(n=n.toLowerCase());var r=l.token(e,t.htmlState);if("script"==n&&/\btag\b/.test(r)&&">"==e.current()){var i=e.string.slice(Math.max(0,e.pos-100),e.pos).match(/\btype\s*=\s*("[^"]+"|'[^']+'|\S+)[^<]*$/i);i=i?i[1]:"",i&&/[\"\']/.test(i.charAt(0))&&(i=i.slice(1,i.length-1));for(var u=0;u<c.length;++u){var f=c[u];if("string"==typeof f.matches?i==f.matches:f.matches.test(i)){f.mode&&(t.token=o,t.localMode=f.mode,t.localState=f.mode.startState&&f.mode.startState(l.indent(t.htmlState,"")));break}}}else"style"==n&&/\btag\b/.test(r)&&">"==e.current()&&(t.token=a,t.localMode=s,t.localState=s.startState(l.indent(t.htmlState,"")));return r}function i(e,t,n){var r,i=e.current(),o=i.search(t);return o>-1?e.backUp(i.length-o):(r=i.match(/<\/?$/))&&(e.backUp(i.length),e.match(t,!1)||e.match(i)),n}function o(e,t){return e.match(/^<\/\s*script\s*>/i,!1)?(t.token=r,t.localState=t.localMode=null,null):i(e,/<\/\s*script\s*>/,t.localMode.token(e,t.localState))}function a(e,t){return e.match(/^<\/\s*style\s*>/i,!1)?(t.token=r,t.localState=t.localMode=null,null):i(e,/<\/\s*style\s*>/,s.token(e,t.localState))}var l=e.getMode(t,{name:"xml",htmlMode:!0,multilineTagIndentFactor:n.multilineTagIndentFactor,multilineTagIndentPastTag:n.multilineTagIndentPastTag}),s=e.getMode(t,"css"),c=[],u=n&&n.scriptTypes;if(c.push({matches:/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i,mode:e.getMode(t,"javascript")}),u)for(var f=0;f<u.length;++f){var d=u[f];c.push({matches:d.matches,mode:d.mode&&e.getMode(t,d.mode)})}return c.push({matches:/./,mode:e.getMode(t,"text/plain")}),{startState:function(){var e=l.startState();return{token:r,localMode:null,localState:null,htmlState:e}},copyState:function(t){if(t.localState)var n=e.copyState(t.localMode,t.localState);return{token:t.token,localMode:t.localMode,localState:n,htmlState:e.copyState(l,t.htmlState)}},token:function(e,t){return t.token(e,t)},indent:function(t,n){return!t.localMode||/^\s*<\//.test(n)?l.indent(t.htmlState,n):t.localMode.indent?t.localMode.indent(t.localState,n):e.Pass},innerMode:function(e){return{state:e.localState||e.htmlState,mode:e.localMode||l}}}},"xml","javascript","css"),e.defineMIME("text/html","htmlmixed")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){for(var t={},n=e.split(" "),r=0;r<n.length;++r)t[n[r]]=!0;return t}function n(e,t){if(!t.startOfLine)return!1;for(;;){if(!e.skipTo("\\")){e.skipToEnd(),t.tokenize=null;break}if(e.next(),e.eol()){t.tokenize=n;break}}return"meta"}function r(e,t){if(e.backUp(1),e.match(/(R|u8R|uR|UR|LR)/)){var n=e.match(/"([^\s\\()]{0,16})\(/);return n?(t.cpp11RawStringDelim=n[1],t.tokenize=o,o(e,t)):!1}return e.match(/(u8|u|U|L)/)?e.match(/["']/,!1)?"string":!1:(e.next(),!1)}function i(e,t){for(var n;null!=(n=e.next());)if('"'==n&&!e.eat('"')){t.tokenize=null;break}return"string"}function o(e,t){var n=t.cpp11RawStringDelim.replace(/[^\w\s]/g,"\\$&"),r=e.match(new RegExp(".*?\\)"+n+'"'));return r?t.tokenize=null:e.skipToEnd(),"string"}function a(t,n){function r(e){if(e)for(var t in e)e.hasOwnProperty(t)&&i.push(t)}"string"==typeof t&&(t=[t]);var i=[];r(n.keywords),r(n.builtin),r(n.atoms),i.length&&(n.helperType=t[0],e.registerHelper("hintWords",t[0],i));for(var o=0;o<t.length;++o)e.defineMIME(t[o],n)}function l(e,t){for(var n=!1;!e.eol();){if(!n&&e.match('"""')){t.tokenize=null;break}n="\\"==e.next()&&!n}return"string"}e.defineMode("clike",function(t,n){function r(e,t){var n=e.next();if(v[n]){var r=v[n](e,t);if(r!==!1)return r}if('"'==n||"'"==n)return t.tokenize=i(n),t.tokenize(e,t);if(/[\[\]{}\(\),;\:\.]/.test(n))return c=n,null;if(/\d/.test(n))return e.eatWhile(/[\w\.]/),"number";if("/"==n){if(e.eat("*"))return t.tokenize=o,o(e,t);if(e.eat("/"))return e.skipToEnd(),"comment"}if(x.test(n))return e.eatWhile(x),"operator";e.eatWhile(/[\w\$_\xa1-\uffff]/);var a=e.current();return h.propertyIsEnumerable(a)?(m.propertyIsEnumerable(a)&&(c="newstatement"),"keyword"):p.propertyIsEnumerable(a)?(m.propertyIsEnumerable(a)&&(c="newstatement"),"builtin"):g.propertyIsEnumerable(a)?"atom":"variable"; -if("="==r&&e.eat(">"))return i("=>","operator");if("0"==r&&e.eat(/x/i))return e.eatWhile(/[\da-f]/i),i("number","number");if(/\d/.test(r))return e.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),i("number","number");if("/"==r)return e.eat("*")?(t.tokenize=l,l(e,t)):e.eat("/")?(e.skipToEnd(),i("comment","comment")):"operator"==t.lastType||"keyword c"==t.lastType||"sof"==t.lastType||/^[\[{}\(,;:]$/.test(t.lastType)?(n(e),e.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/),i("regexp","string-2")):(e.eatWhile(Le),i("operator","operator",e.current()));if("`"==r)return t.tokenize=s,s(e,t);if("#"==r)return e.skipToEnd(),i("error","error");if(Le.test(r))return e.eatWhile(Le),i("operator","operator",e.current());if(Ce.test(r)){e.eatWhile(Ce);var o=e.current(),c=Se.propertyIsEnumerable(o)&&Se[o];return c&&"."!=t.lastType?i(c.type,c.style,o):i("variable","variable",o)}}function a(e){return function(t,r){var n,a=!1;if(xe&&"@"==t.peek()&&t.match(Me))return r.tokenize=o,i("jsonld-keyword","meta");for(;null!=(n=t.next())&&(n!=e||a);)a=!a&&"\\"==n;return a||(r.tokenize=o),i("string","string")}}function l(e,t){for(var r,n=!1;r=e.next();){if("/"==r&&n){t.tokenize=o;break}n="*"==r}return i("comment","comment")}function s(e,t){for(var r,n=!1;null!=(r=e.next());){if(!n&&("`"==r||"$"==r&&e.eat("{"))){t.tokenize=o;break}n=!n&&"\\"==r}return i("quasi","string-2",e.current())}function c(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var r=e.string.indexOf("=>",e.start);if(!(0>r)){for(var n=0,i=!1,o=r-1;o>=0;--o){var a=e.string.charAt(o),l=Te.indexOf(a);if(l>=0&&3>l){if(!n){++o;break}if(0==--n)break}else if(l>=3&&6>l)++n;else if(Ce.test(a))i=!0;else{if(/["'\/]/.test(a))return;if(i&&!n){++o;break}}}i&&!n&&(t.fatArrowAt=o)}}function u(e,t,r,n,i,o){this.indented=e,this.column=t,this.type=r,this.prev=i,this.info=o,null!=n&&(this.align=n)}function d(e,t){for(var r=e.localVars;r;r=r.next)if(r.name==t)return!0;for(var n=e.context;n;n=n.prev)for(var r=n.vars;r;r=r.next)if(r.name==t)return!0}function f(e,t,r,n,i){var o=e.cc;for(Oe.state=e,Oe.stream=i,Oe.marked=null,Oe.cc=o,Oe.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;){var a=o.length?o.pop():we?k:w;if(a(r,n)){for(;o.length&&o[o.length-1].lex;)o.pop()();return Oe.marked?Oe.marked:"variable"==r&&d(e,n)?"variable-2":t}}}function h(){for(var e=arguments.length-1;e>=0;e--)Oe.cc.push(arguments[e])}function p(){return h.apply(null,arguments),!0}function m(e){function t(t){for(var r=t;r;r=r.next)if(r.name==e)return!0;return!1}var n=Oe.state;if(n.context){if(Oe.marked="def",t(n.localVars))return;n.localVars={name:e,next:n.localVars}}else{if(t(n.globalVars))return;r.globalVars&&(n.globalVars={name:e,next:n.globalVars})}}function g(){Oe.state.context={prev:Oe.state.context,vars:Oe.state.localVars},Oe.state.localVars=ze}function v(){Oe.state.localVars=Oe.state.context.vars,Oe.state.context=Oe.state.context.prev}function y(e,t){var r=function(){var r=Oe.state,n=r.indented;if("stat"==r.lexical.type)n=r.lexical.indented;else for(var i=r.lexical;i&&")"==i.type&&i.align;i=i.prev)n=i.indented;r.lexical=new u(n,Oe.stream.column(),e,null,r.lexical,t)};return r.lex=!0,r}function b(){var e=Oe.state;e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function x(e){function t(r){return r==e?p():";"==e?h():p(t)}return t}function w(e,t){return"var"==e?p(y("vardef",t.length),R,x(";"),b):"keyword a"==e?p(y("form"),k,w,b):"keyword b"==e?p(y("form"),w,b):"{"==e?p(y("}"),j,b):";"==e?p():"if"==e?("else"==Oe.state.lexical.info&&Oe.state.cc[Oe.state.cc.length-1]==b&&Oe.state.cc.pop()(),p(y("form"),k,w,b,$)):"function"==e?p(ee):"for"==e?p(y("form"),X,w,b):"variable"==e?p(y("stat"),D):"switch"==e?p(y("form"),k,y("}","switch"),x("{"),j,b,b):"case"==e?p(k,x(":")):"default"==e?p(x(":")):"catch"==e?p(y("form"),g,x("("),te,x(")"),w,b,v):"module"==e?p(y("form"),g,ae,v,b):"class"==e?p(y("form"),re,b):"export"==e?p(y("form"),le,b):"import"==e?p(y("form"),se,b):h(y("stat"),k,x(";"),b)}function k(e){return S(e,!1)}function C(e){return S(e,!0)}function S(e,t){if(Oe.state.fatArrowAt==Oe.stream.start){var r=t?P:N;if("("==e)return p(g,y(")"),H(U,")"),b,x("=>"),r,v);if("variable"==e)return h(g,U,x("=>"),r,v)}var n=t?A:T;return Ae.hasOwnProperty(e)?p(n):"function"==e?p(ee,n):"keyword c"==e?p(t?M:L):"("==e?p(y(")"),L,pe,x(")"),b,n):"operator"==e||"spread"==e?p(t?C:k):"["==e?p(y("]"),fe,b,n):"{"==e?_(I,"}",null,n):"quasi"==e?h(O,n):p()}function L(e){return e.match(/[;\}\)\],]/)?h():h(k)}function M(e){return e.match(/[;\}\)\],]/)?h():h(C)}function T(e,t){return","==e?p(k):A(e,t,!1)}function A(e,t,r){var n=0==r?T:A,i=0==r?k:C;return"=>"==e?p(g,r?P:N,v):"operator"==e?/\+\+|--/.test(t)?p(n):"?"==t?p(k,x(":"),i):p(i):"quasi"==e?h(O,n):";"!=e?"("==e?_(C,")","call",n):"."==e?p(W,n):"["==e?p(y("]"),L,x("]"),b,n):void 0:void 0}function O(e,t){return"quasi"!=e?h():"${"!=t.slice(t.length-2)?p(O):p(k,z)}function z(e){return"}"==e?(Oe.marked="string-2",Oe.state.tokenize=s,p(O)):void 0}function N(e){return c(Oe.stream,Oe.state),h("{"==e?w:k)}function P(e){return c(Oe.stream,Oe.state),h("{"==e?w:C)}function D(e){return":"==e?p(b,w):h(T,x(";"),b)}function W(e){return"variable"==e?(Oe.marked="property",p()):void 0}function I(e,t){return"variable"==e||"keyword"==Oe.style?(Oe.marked="property",p("get"==t||"set"==t?E:F)):"number"==e||"string"==e?(Oe.marked=xe?"property":Oe.style+" property",p(F)):"jsonld-keyword"==e?p(F):"["==e?p(k,x("]"),F):void 0}function E(e){return"variable"!=e?h(F):(Oe.marked="property",p(ee))}function F(e){return":"==e?p(C):"("==e?h(ee):void 0}function H(e,t){function r(n){if(","==n){var i=Oe.state.lexical;return"call"==i.info&&(i.pos=(i.pos||0)+1),p(e,r)}return n==t?p():p(x(t))}return function(n){return n==t?p():h(e,r)}}function _(e,t,r){for(var n=3;n<arguments.length;n++)Oe.cc.push(arguments[n]);return p(y(t,r),H(e,t),b)}function j(e){return"}"==e?p():h(w,j)}function B(e){return ke&&":"==e?p(q):void 0}function q(e){return"variable"==e?(Oe.marked="variable-3",p()):void 0}function R(){return h(U,B,G,K)}function U(e,t){return"variable"==e?(m(t),p()):"["==e?_(U,"]"):"{"==e?_(V,"}"):void 0}function V(e,t){return"variable"!=e||Oe.stream.match(/^\s*:/,!1)?("variable"==e&&(Oe.marked="property"),p(x(":"),U,G)):(m(t),p(G))}function G(e,t){return"="==t?p(C):void 0}function K(e){return","==e?p(R):void 0}function $(e,t){return"keyword b"==e&&"else"==t?p(y("form","else"),w,b):void 0}function X(e){return"("==e?p(y(")"),Y,x(")"),b):void 0}function Y(e){return"var"==e?p(R,x(";"),Q):";"==e?p(Q):"variable"==e?p(Z):h(k,x(";"),Q)}function Z(e,t){return"in"==t||"of"==t?(Oe.marked="keyword",p(k)):p(T,Q)}function Q(e,t){return";"==e?p(J):"in"==t||"of"==t?(Oe.marked="keyword",p(k)):h(k,x(";"),J)}function J(e){")"!=e&&p(k)}function ee(e,t){return"*"==t?(Oe.marked="keyword",p(ee)):"variable"==e?(m(t),p(ee)):"("==e?p(g,y(")"),H(te,")"),b,w,v):void 0}function te(e){return"spread"==e?p(te):h(U,B)}function re(e,t){return"variable"==e?(m(t),p(ne)):void 0}function ne(e,t){return"extends"==t?p(k,ne):"{"==e?p(y("}"),ie,b):void 0}function ie(e,t){return"variable"==e||"keyword"==Oe.style?"static"==t?(Oe.marked="keyword",p(ie)):(Oe.marked="property","get"==t||"set"==t?p(oe,ee,ie):p(ee,ie)):"*"==t?(Oe.marked="keyword",p(ie)):";"==e?p(ie):"}"==e?p():void 0}function oe(e){return"variable"!=e?h():(Oe.marked="property",p())}function ae(e,t){return"string"==e?p(w):"variable"==e?(m(t),p(de)):void 0}function le(e,t){return"*"==t?(Oe.marked="keyword",p(de,x(";"))):"default"==t?(Oe.marked="keyword",p(k,x(";"))):h(w)}function se(e){return"string"==e?p():h(ce,de)}function ce(e,t){return"{"==e?_(ce,"}"):("variable"==e&&m(t),"*"==t&&(Oe.marked="keyword"),p(ue))}function ue(e,t){return"as"==t?(Oe.marked="keyword",p(ce)):void 0}function de(e,t){return"from"==t?(Oe.marked="keyword",p(k)):void 0}function fe(e){return"]"==e?p():h(C,he)}function he(e){return"for"==e?h(pe,x("]")):","==e?p(H(M,"]")):h(H(C,"]"))}function pe(e){return"for"==e?p(X,pe):"if"==e?p(k,pe):void 0}function me(e,t){return"operator"==e.lastType||","==e.lastType||Le.test(t.charAt(0))||/[,.]/.test(t.charAt(0))}var ge,ve,ye=t.indentUnit,be=r.statementIndent,xe=r.jsonld,we=r.json||xe,ke=r.typescript,Ce=r.wordCharacters||/[\w$\xa1-\uffff]/,Se=function(){function e(e){return{type:e,style:"keyword"}}var t=e("keyword a"),r=e("keyword b"),n=e("keyword c"),i=e("operator"),o={type:"atom",style:"atom"},a={"if":e("if"),"while":t,"with":t,"else":r,"do":r,"try":r,"finally":r,"return":n,"break":n,"continue":n,"new":n,"delete":n,"throw":n,"debugger":n,"var":e("var"),"const":e("var"),let:e("var"),"function":e("function"),"catch":e("catch"),"for":e("for"),"switch":e("switch"),"case":e("case"),"default":e("default"),"in":i,"typeof":i,"instanceof":i,"true":o,"false":o,"null":o,undefined:o,NaN:o,Infinity:o,"this":e("this"),module:e("module"),"class":e("class"),"super":e("atom"),"yield":n,"export":e("export"),"import":e("import"),"extends":n};if(ke){var l={type:"variable",style:"variable-3"},s={"interface":e("interface"),"extends":e("extends"),constructor:e("constructor"),"public":e("public"),"private":e("private"),"protected":e("protected"),"static":e("static"),string:l,number:l,bool:l,any:l};for(var c in s)a[c]=s[c]}return a}(),Le=/[+\-*&%=<>!?|~^]/,Me=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,Te="([{}])",Ae={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0,"jsonld-keyword":!0},Oe={state:null,column:null,marked:null,cc:null},ze={name:"this",next:{name:"arguments"}};return b.lex=!0,{startState:function(e){var t={tokenize:o,lastType:"sof",cc:[],lexical:new u((e||0)-ye,0,"block",!1),localVars:r.localVars,context:r.localVars&&{vars:r.localVars},indented:0};return r.globalVars&&"object"==typeof r.globalVars&&(t.globalVars=r.globalVars),t},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),c(e,t)),t.tokenize!=l&&e.eatSpace())return null;var r=t.tokenize(e,t);return"comment"==ge?r:(t.lastType="operator"!=ge||"++"!=ve&&"--"!=ve?ge:"incdec",f(t,r,ge,ve,e))},indent:function(t,n){if(t.tokenize==l)return e.Pass;if(t.tokenize!=o)return 0;var i=n&&n.charAt(0),a=t.lexical;if(!/^\s*else\b/.test(n))for(var s=t.cc.length-1;s>=0;--s){var c=t.cc[s];if(c==b)a=a.prev;else if(c!=$)break}"stat"==a.type&&"}"==i&&(a=a.prev),be&&")"==a.type&&"stat"==a.prev.type&&(a=a.prev);var u=a.type,d=i==u;return"vardef"==u?a.indented+("operator"==t.lastType||","==t.lastType?a.info+1:0):"form"==u&&"{"==i?a.indented:"form"==u?a.indented+ye:"stat"==u?a.indented+(me(t,n)?be||ye:0):"switch"!=a.info||d||0==r.doubleIndentSwitch?a.align?a.column+(d?0:1):a.indented+(d?0:ye):a.indented+(/^(?:case|default)\b/.test(n)?ye:2*ye)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:we?null:"/*",blockCommentEnd:we?null:"*/",lineComment:we?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:we?"json":"javascript",jsonldMode:xe,jsonMode:we}}),e.registerHelper("wordChars","javascript",/[\w$]/),e.defineMIME("text/javascript","javascript"),e.defineMIME("text/ecmascript","javascript"),e.defineMIME("application/javascript","javascript"),e.defineMIME("application/x-javascript","javascript"),e.defineMIME("application/ecmascript","javascript"),e.defineMIME("application/json",{name:"javascript",json:!0}),e.defineMIME("application/x-json",{name:"javascript",json:!0}),e.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),e.defineMIME("text/typescript",{name:"javascript",typescript:!0}),e.defineMIME("application/typescript",{name:"javascript",typescript:!0})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){for(var t={},r=0;r<e.length;++r)t[e[r]]=!0;return t}function r(e,t){for(var r,n=!1;null!=(r=e.next());){if(n&&"/"==r){t.tokenize=null;break}n="*"==r}return["comment","comment"]}function n(e,t){return e.skipTo("-->")?(e.match("-->"),t.tokenize=null):e.skipToEnd(),["comment","comment"]}e.defineMode("css",function(t,r){function n(e,t){return h=t,e}function i(e,t){var r=e.next();if(g[r]){var i=g[r](e,t);if(i!==!1)return i}return"@"==r?(e.eatWhile(/[\w\\\-]/),n("def",e.current())):"="==r||("~"==r||"|"==r)&&e.eat("=")?n(null,"compare"):'"'==r||"'"==r?(t.tokenize=o(r),t.tokenize(e,t)):"#"==r?(e.eatWhile(/[\w\\\-]/),n("atom","hash")):"!"==r?(e.match(/^\s*\w*/),n("keyword","important")):/\d/.test(r)||"."==r&&e.eat(/\d/)?(e.eatWhile(/[\w.%]/),n("number","unit")):"-"!==r?/[,+>*\/]/.test(r)?n(null,"select-op"):"."==r&&e.match(/^-?[_a-z][_a-z0-9-]*/i)?n("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(r)?n(null,r):"u"==r&&e.match(/rl(-prefix)?\(/)||"d"==r&&e.match("omain(")||"r"==r&&e.match("egexp(")?(e.backUp(1),t.tokenize=a,n("property","word")):/[\w\\\-]/.test(r)?(e.eatWhile(/[\w\\\-]/),n("property","word")):n(null,null):/[\d.]/.test(e.peek())?(e.eatWhile(/[\w.%]/),n("number","unit")):e.match(/^-[\w\\\-]+/)?(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?n("variable-2","variable-definition"):n("variable-2","variable")):e.match(/^\w+-/)?n("meta","meta"):void 0}function o(e){return function(t,r){for(var i,o=!1;null!=(i=t.next());){if(i==e&&!o){")"==e&&t.backUp(1);break}o=!o&&"\\"==i}return(i==e||!o&&")"!=e)&&(r.tokenize=null),n("string","string")}}function a(e,t){return e.next(),e.match(/\s*[\"\')]/,!1)?t.tokenize=null:t.tokenize=o(")"),n(null,"(")}function l(e,t,r){this.type=e,this.indent=t,this.prev=r}function s(e,t,r){return e.context=new l(r,t.indentation()+m,e.context),r}function c(e){return e.context=e.context.prev,e.context.type}function u(e,t,r){return T[r.context.type](e,t,r)}function d(e,t,r,n){for(var i=n||1;i>0;i--)r.context=r.context.prev;return u(e,t,r)}function f(e){var t=e.current().toLowerCase();p=L.hasOwnProperty(t)?"atom":S.hasOwnProperty(t)?"keyword":"variable"}r.propertyKeywords||(r=e.resolveMode("text/css"));var h,p,m=t.indentUnit,g=r.tokenHooks,v=r.documentTypes||{},y=r.mediaTypes||{},b=r.mediaFeatures||{},x=r.propertyKeywords||{},w=r.nonStandardPropertyKeywords||{},k=r.fontProperties||{},C=r.counterDescriptors||{},S=r.colorKeywords||{},L=r.valueKeywords||{},M=r.allowNested,T={};return T.top=function(e,t,r){if("{"==e)return s(r,t,"block");if("}"==e&&r.context.prev)return c(r);if(/@(media|supports|(-moz-)?document)/.test(e))return s(r,t,"atBlock");if(/@(font-face|counter-style)/.test(e))return r.stateArg=e,"restricted_atBlock_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(e))return"keyframes";if(e&&"@"==e.charAt(0))return s(r,t,"at");if("hash"==e)p="builtin";else if("word"==e)p="tag";else{if("variable-definition"==e)return"maybeprop";if("interpolation"==e)return s(r,t,"interpolation");if(":"==e)return"pseudo";if(M&&"("==e)return s(r,t,"parens")}return r.context.type},T.block=function(e,t,r){if("word"==e){var n=t.current().toLowerCase();return x.hasOwnProperty(n)?(p="property","maybeprop"):w.hasOwnProperty(n)?(p="string-2","maybeprop"):M?(p=t.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(p+=" error","maybeprop")}return"meta"==e?"block":M||"hash"!=e&&"qualifier"!=e?T.top(e,t,r):(p="error","block")},T.maybeprop=function(e,t,r){return":"==e?s(r,t,"prop"):u(e,t,r)},T.prop=function(e,t,r){if(";"==e)return c(r);if("{"==e&&M)return s(r,t,"propBlock");if("}"==e||"{"==e)return d(e,t,r);if("("==e)return s(r,t,"parens");if("hash"!=e||/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(t.current())){if("word"==e)f(t);else if("interpolation"==e)return s(r,t,"interpolation")}else p+=" error";return"prop"},T.propBlock=function(e,t,r){return"}"==e?c(r):"word"==e?(p="property","maybeprop"):r.context.type},T.parens=function(e,t,r){return"{"==e||"}"==e?d(e,t,r):")"==e?c(r):"("==e?s(r,t,"parens"):"interpolation"==e?s(r,t,"interpolation"):("word"==e&&f(t),"parens")},T.pseudo=function(e,t,r){return"word"==e?(p="variable-3",r.context.type):u(e,t,r)},T.atBlock=function(e,t,r){if("("==e)return s(r,t,"atBlock_parens");if("}"==e)return d(e,t,r);if("{"==e)return c(r)&&s(r,t,M?"block":"top");if("word"==e){var n=t.current().toLowerCase();p="only"==n||"not"==n||"and"==n||"or"==n?"keyword":v.hasOwnProperty(n)?"tag":y.hasOwnProperty(n)?"attribute":b.hasOwnProperty(n)?"property":x.hasOwnProperty(n)?"property":w.hasOwnProperty(n)?"string-2":L.hasOwnProperty(n)?"atom":"error"}return r.context.type},T.atBlock_parens=function(e,t,r){return")"==e?c(r):"{"==e||"}"==e?d(e,t,r,2):T.atBlock(e,t,r)},T.restricted_atBlock_before=function(e,t,r){return"{"==e?s(r,t,"restricted_atBlock"):"word"==e&&"@counter-style"==r.stateArg?(p="variable","restricted_atBlock_before"):u(e,t,r)},T.restricted_atBlock=function(e,t,r){return"}"==e?(r.stateArg=null,c(r)):"word"==e?(p="@font-face"==r.stateArg&&!k.hasOwnProperty(t.current().toLowerCase())||"@counter-style"==r.stateArg&&!C.hasOwnProperty(t.current().toLowerCase())?"error":"property","maybeprop"):"restricted_atBlock"},T.keyframes=function(e,t,r){return"word"==e?(p="variable","keyframes"):"{"==e?s(r,t,"top"):u(e,t,r)},T.at=function(e,t,r){return";"==e?c(r):"{"==e||"}"==e?d(e,t,r):("word"==e?p="tag":"hash"==e&&(p="builtin"),"at")},T.interpolation=function(e,t,r){return"}"==e?c(r):"{"==e||";"==e?d(e,t,r):("word"==e?p="variable":"variable"!=e&&(p="error"),"interpolation")},{startState:function(e){return{tokenize:null,state:"top",stateArg:null,context:new l("top",e||0,null)}},token:function(e,t){if(!t.tokenize&&e.eatSpace())return null;var r=(t.tokenize||i)(e,t);return r&&"object"==typeof r&&(h=r[1],r=r[0]),p=r,t.state=T[t.state](h,e,t),p},indent:function(e,t){var r=e.context,n=t&&t.charAt(0),i=r.indent;return"prop"!=r.type||"}"!=n&&")"!=n||(r=r.prev),!r.prev||("}"!=n||"block"!=r.type&&"top"!=r.type&&"interpolation"!=r.type&&"restricted_atBlock"!=r.type)&&(")"!=n||"parens"!=r.type&&"atBlock_parens"!=r.type)&&("{"!=n||"at"!=r.type&&"atBlock"!=r.type)||(i=r.indent-m,r=r.prev),i},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",fold:"brace"}});var i=["domain","regexp","url","url-prefix"],o=t(i),a=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],l=t(a),s=["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid"],c=t(s),u=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-position","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marker-offset","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode"],d=t(u),f=["scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-3d-light-color","scrollbar-track-color","shape-inside","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","zoom"],h=t(f),p=["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"],m=t(p),g=["additive-symbols","fallback","negative","pad","prefix","range","speak-as","suffix","symbols","system"],v=t(g),y=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],b=t(y),x=["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","column","compact","condensed","contain","content","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","flex","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","malayalam","match","matrix","matrix3d","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row-resize","rtl","run-in","running","s-resize","sans-serif","scale","scale3d","scaleX","scaleY","scaleZ","scroll","scrollbar","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","solid","somali","source-atop","source-in","source-out","source-over","space","spell-out","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","symbolic","symbols","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","x-large","x-small","xor","xx-large","xx-small"],w=t(x),k=i.concat(a).concat(s).concat(u).concat(f).concat(y).concat(x); +}function i(e){return function(t,n){for(var r,i=!1,o=!1;null!=(r=t.next());){if(r==e&&!i){o=!0;break}i=!i&&"\\"==r}return(o||!i&&!y)&&(n.tokenize=null),"string"}}function o(e,t){for(var n,r=!1;n=e.next();){if("/"==n&&r){t.tokenize=null;break}r="*"==n}return"comment"}function a(e,t,n,r,i){this.indented=e,this.column=t,this.type=n,this.align=r,this.prev=i}function l(e,t,n){var r=e.indented;return e.context&&"statement"==e.context.type&&(r=e.context.indented),e.context=new a(r,t,n,null,e.context)}function s(e){var t=e.context.type;return(")"==t||"]"==t||"}"==t)&&(e.indented=e.context.indented),e.context=e.context.prev}var c,u=t.indentUnit,f=n.statementIndentUnit||u,d=n.dontAlignCalls,h=n.keywords||{},p=n.builtin||{},m=n.blockKeywords||{},g=n.atoms||{},v=n.hooks||{},y=n.multiLineStrings,b=n.indentStatements!==!1,x=/[+\-*&%=<>!?|\/]/;return{startState:function(e){return{tokenize:null,context:new a((e||0)-u,0,"top",!1),indented:0,startOfLine:!0}},token:function(e,t){var n=t.context;if(e.sol()&&(null==n.align&&(n.align=!1),t.indented=e.indentation(),t.startOfLine=!0),e.eatSpace())return null;c=null;var i=(t.tokenize||r)(e,t);if("comment"==i||"meta"==i)return i;if(null==n.align&&(n.align=!0),";"!=c&&":"!=c&&","!=c||"statement"!=n.type)if("{"==c)l(t,e.column(),"}");else if("["==c)l(t,e.column(),"]");else if("("==c)l(t,e.column(),")");else if("}"==c){for(;"statement"==n.type;)n=s(t);for("}"==n.type&&(n=s(t));"statement"==n.type;)n=s(t)}else c==n.type?s(t):b&&(("}"==n.type||"top"==n.type)&&";"!=c||"statement"==n.type&&"newstatement"==c)&&l(t,e.column(),"statement");else s(t);return t.startOfLine=!1,i},indent:function(t,n){if(t.tokenize!=r&&null!=t.tokenize)return e.Pass;var i=t.context,o=n&&n.charAt(0);"statement"==i.type&&"}"==o&&(i=i.prev);var a=o==i.type;return"statement"==i.type?i.indented+("{"==o?0:f):!i.align||d&&")"==i.type?")"!=i.type||a?i.indented+(a?0:u):i.indented+f:i.column+(a?0:1)},electricChars:"{}",blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",fold:"brace"}});var s="auto if break int case long char register continue return default short do sizeof double static else struct switch extern typedef float union for unsigned goto while enum void const signed volatile";a(["text/x-csrc","text/x-c","text/x-chdr"],{name:"clike",keywords:t(s),blockKeywords:t("case do else for if switch while struct"),atoms:t("null"),hooks:{"#":n},modeProps:{fold:["brace","include"]}}),a(["text/x-c++src","text/x-c++hdr"],{name:"clike",keywords:t(s+" asm dynamic_cast namespace reinterpret_cast try bool explicit new static_cast typeid catch operator template typename class friend private this using const_cast inline public throw virtual delete mutable protected wchar_t alignas alignof constexpr decltype nullptr noexcept thread_local final static_assert override"),blockKeywords:t("catch class do else finally for if struct switch try while"),atoms:t("true false null"),hooks:{"#":n,u:r,U:r,L:r,R:r},modeProps:{fold:["brace","include"]}}),a("text/x-java",{name:"clike",keywords:t("abstract assert boolean break byte case catch char class const continue default do double else enum extends final finally float for goto if implements import instanceof int interface long native new package private protected public return short static strictfp super switch synchronized this throw throws transient try void volatile while"),blockKeywords:t("catch class do else finally for if switch try while"),atoms:t("true false null"),hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"}},modeProps:{fold:["brace","import"]}}),a("text/x-csharp",{name:"clike",keywords:t("abstract as base break case catch checked class const continue default delegate do else enum event explicit extern finally fixed for foreach goto if implicit in interface internal is lock namespace new operator out override params private protected public readonly ref return sealed sizeof stackalloc static struct switch this throw try typeof unchecked unsafe using virtual void volatile while add alias ascending descending dynamic from get global group into join let orderby partial remove select set value var yield"),blockKeywords:t("catch class do else finally for foreach if struct switch try while"),builtin:t("Boolean Byte Char DateTime DateTimeOffset Decimal Double Guid Int16 Int32 Int64 Object SByte Single String TimeSpan UInt16 UInt32 UInt64 bool byte char decimal double short int long object sbyte float string ushort uint ulong"),atoms:t("true false null"),hooks:{"@":function(e,t){return e.eat('"')?(t.tokenize=i,i(e,t)):(e.eatWhile(/[\w\$_]/),"meta")}}}),a("text/x-scala",{name:"clike",keywords:t("abstract case catch class def do else extends false final finally for forSome if implicit import lazy match new null object override package private protected return sealed super this throw trait try trye type val var while with yield _ : = => <- <: <% >: # @ assert assume require print println printf readLine readBoolean readByte readShort readChar readInt readLong readFloat readDouble AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either Enumeration Equiv Error Exception Fractional Function IndexedSeq Integral Iterable Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector :: #:: Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"),multiLineStrings:!0,blockKeywords:t("catch class do else finally for forSome if match switch try while"),atoms:t("true false null"),indentStatements:!1,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,t){return e.match('""')?(t.tokenize=l,t.tokenize(e,t)):!1},"'":function(e){return e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"}},modeProps:{closeBrackets:{triples:'"'}}}),a(["x-shader/x-vertex","x-shader/x-fragment"],{name:"clike",keywords:t("float int bool void vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 mat2 mat3 mat4 sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadow const attribute uniform varying break continue discard return for while do if else struct in out inout"),blockKeywords:t("for while do if else struct"),builtin:t("radians degrees sin cos tan asin acos atan pow exp log exp2 sqrt inversesqrt abs sign floor ceil fract mod min max clamp mix step smoothstep length distance dot cross normalize ftransform faceforward reflect refract matrixCompMult lessThan lessThanEqual greaterThan greaterThanEqual equal notEqual any all not texture1D texture1DProj texture1DLod texture1DProjLod texture2D texture2DProj texture2DLod texture2DProjLod texture3D texture3DProj texture3DLod texture3DProjLod textureCube textureCubeLod shadow1D shadow2D shadow1DProj shadow2DProj shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod dFdx dFdy fwidth noise1 noise2 noise3 noise4"),atoms:t("true false gl_FragColor gl_SecondaryColor gl_Normal gl_Vertex gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_FogCoord gl_PointCoord gl_Position gl_PointSize gl_ClipVertex gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor gl_TexCoord gl_FogFragCoord gl_FragCoord gl_FrontFacing gl_FragData gl_FragDepth gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse gl_TexureMatrixTranspose gl_ModelViewMatrixInverseTranspose gl_ProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixInverseTranspose gl_TextureMatrixInverseTranspose gl_NormalScale gl_DepthRange gl_ClipPlane gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource gl_LightModel gl_FrontLightModelProduct gl_BackLightModelProduct gl_TextureColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ gl_FogParameters gl_MaxLights gl_MaxClipPlanes gl_MaxTextureUnits gl_MaxTextureCoords gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits gl_MaxDrawBuffers"),hooks:{"#":n},modeProps:{fold:["brace","include"]}}),a("text/x-nesc",{name:"clike",keywords:t(s+"as atomic async call command component components configuration event generic implementation includes interface module new norace nx_struct nx_union post provides signal task uses abstract extends"),blockKeywords:t("case do else for if switch while struct"),atoms:t("null"),hooks:{"#":n},modeProps:{fold:["brace","include"]}}),a("text/x-objectivec",{name:"clike",keywords:t(s+"inline restrict _Bool _Complex _Imaginery BOOL Class bycopy byref id IMP in inout nil oneway out Protocol SEL self super atomic nonatomic retain copy readwrite readonly"),atoms:t("YES NO NULL NILL ON OFF"),hooks:{"@":function(e){return e.eatWhile(/[\w\$]/),"keyword"},"#":n},modeProps:{fold:"brace"}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("clojure",function(e){function t(e){for(var t={},n=e.split(" "),r=0;r<n.length;++r)t[n[r]]=!0;return t}function n(e,t,n){this.indent=e,this.type=t,this.prev=n}function r(e,t,r){e.indentStack=new n(t,r,e.indentStack)}function i(e){e.indentStack=e.indentStack.prev}function o(e,t){return"0"===e&&t.eat(/x/i)?(t.eatWhile(k.hex),!0):("+"!=e&&"-"!=e||!k.digit.test(t.peek())||(t.eat(k.sign),e=t.next()),k.digit.test(e)?(t.eat(e),t.eatWhile(k.digit),"."==t.peek()&&(t.eat("."),t.eatWhile(k.digit)),t.eat(k.exponent)&&(t.eat(k.sign),t.eatWhile(k.digit)),!0):!1)}function a(e){var t=e.next();t&&t.match(/[a-z]/)&&e.match(/[a-z]+/,!0)||"u"===t&&e.match(/[0-9a-z]{4}/i,!0)}var l="builtin",s="comment",c="string",u="string-2",f="atom",d="number",h="bracket",p="keyword",m="variable",g=e.indentUnit||2,v=e.indentUnit||2,y=t("true false nil"),b=t("defn defn- def def- defonce defmulti defmethod defmacro defstruct deftype defprotocol defrecord defproject deftest slice defalias defhinted defmacro- defn-memo defnk defnk defonce- defunbound defunbound- defvar defvar- let letfn do case cond condp for loop recur when when-not when-let when-first if if-let if-not . .. -> ->> doto and or dosync doseq dotimes dorun doall load import unimport ns in-ns refer try catch finally throw with-open with-local-vars binding gen-class gen-and-load-class gen-and-save-class handler-case handle"),x=t("* *' *1 *2 *3 *agent* *allow-unresolved-vars* *assert* *clojure-version* *command-line-args* *compile-files* *compile-path* *compiler-options* *data-readers* *e *err* *file* *flush-on-newline* *fn-loader* *in* *math-context* *ns* *out* *print-dup* *print-length* *print-level* *print-meta* *print-readably* *read-eval* *source-path* *unchecked-math* *use-context-classloader* *verbose-defrecords* *warn-on-reflection* + +' - -' -> ->> ->ArrayChunk ->Vec ->VecNode ->VecSeq -cache-protocol-fn -reset-methods .. / < <= = == > >= EMPTY-NODE accessor aclone add-classpath add-watch agent agent-error agent-errors aget alength alias all-ns alter alter-meta! alter-var-root amap ancestors and apply areduce array-map aset aset-boolean aset-byte aset-char aset-double aset-float aset-int aset-long aset-short assert assoc assoc! assoc-in associative? atom await await-for await1 bases bean bigdec bigint biginteger binding bit-and bit-and-not bit-clear bit-flip bit-not bit-or bit-set bit-shift-left bit-shift-right bit-test bit-xor boolean boolean-array booleans bound-fn bound-fn* bound? butlast byte byte-array bytes case cast char char-array char-escape-string char-name-string char? chars chunk chunk-append chunk-buffer chunk-cons chunk-first chunk-next chunk-rest chunked-seq? class class? clear-agent-errors clojure-version coll? comment commute comp comparator compare compare-and-set! compile complement concat cond condp conj conj! cons constantly construct-proxy contains? count counted? create-ns create-struct cycle dec dec' decimal? declare default-data-readers definline definterface defmacro defmethod defmulti defn defn- defonce defprotocol defrecord defstruct deftype delay delay? deliver denominator deref derive descendants destructure disj disj! dissoc dissoc! distinct distinct? doall dorun doseq dosync dotimes doto double double-array doubles drop drop-last drop-while empty empty? ensure enumeration-seq error-handler error-mode eval even? every-pred every? ex-data ex-info extend extend-protocol extend-type extenders extends? false? ffirst file-seq filter filterv find find-keyword find-ns find-protocol-impl find-protocol-method find-var first flatten float float-array float? floats flush fn fn? fnext fnil for force format frequencies future future-call future-cancel future-cancelled? future-done? future? gen-class gen-interface gensym get get-in get-method get-proxy-class get-thread-bindings get-validator group-by hash hash-combine hash-map hash-set identical? identity if-let if-not ifn? import in-ns inc inc' init-proxy instance? int int-array integer? interleave intern interpose into into-array ints io! isa? iterate iterator-seq juxt keep keep-indexed key keys keyword keyword? last lazy-cat lazy-seq let letfn line-seq list list* list? load load-file load-reader load-string loaded-libs locking long long-array longs loop macroexpand macroexpand-1 make-array make-hierarchy map map-indexed map? mapcat mapv max max-key memfn memoize merge merge-with meta method-sig methods min min-key mod munge name namespace namespace-munge neg? newline next nfirst nil? nnext not not-any? not-empty not-every? not= ns ns-aliases ns-imports ns-interns ns-map ns-name ns-publics ns-refers ns-resolve ns-unalias ns-unmap nth nthnext nthrest num number? numerator object-array odd? or parents partial partition partition-all partition-by pcalls peek persistent! pmap pop pop! pop-thread-bindings pos? pr pr-str prefer-method prefers primitives-classnames print print-ctor print-dup print-method print-simple print-str printf println println-str prn prn-str promise proxy proxy-call-with-super proxy-mappings proxy-name proxy-super push-thread-bindings pvalues quot rand rand-int rand-nth range ratio? rational? rationalize re-find re-groups re-matcher re-matches re-pattern re-seq read read-line read-string realized? reduce reduce-kv reductions ref ref-history-count ref-max-history ref-min-history ref-set refer refer-clojure reify release-pending-sends rem remove remove-all-methods remove-method remove-ns remove-watch repeat repeatedly replace replicate require reset! reset-meta! resolve rest restart-agent resultset-seq reverse reversible? rseq rsubseq satisfies? second select-keys send send-off seq seq? seque sequence sequential? set set-error-handler! set-error-mode! set-validator! set? short short-array shorts shuffle shutdown-agents slurp some some-fn sort sort-by sorted-map sorted-map-by sorted-set sorted-set-by sorted? special-symbol? spit split-at split-with str string? struct struct-map subs subseq subvec supers swap! symbol symbol? sync take take-last take-nth take-while test the-ns thread-bound? time to-array to-array-2d trampoline transient tree-seq true? type unchecked-add unchecked-add-int unchecked-byte unchecked-char unchecked-dec unchecked-dec-int unchecked-divide-int unchecked-double unchecked-float unchecked-inc unchecked-inc-int unchecked-int unchecked-long unchecked-multiply unchecked-multiply-int unchecked-negate unchecked-negate-int unchecked-remainder-int unchecked-short unchecked-subtract unchecked-subtract-int underive unquote unquote-splicing update-in update-proxy use val vals var-get var-set var? vary-meta vec vector vector-of vector? when when-first when-let when-not while with-bindings with-bindings* with-in-str with-loading-context with-local-vars with-meta with-open with-out-str with-precision with-redefs with-redefs-fn xml-seq zero? zipmap *default-data-reader-fn* as-> cond-> cond->> reduced reduced? send-via set-agent-send-executor! set-agent-send-off-executor! some-> some->>"),w=t("ns fn def defn defmethod bound-fn if if-not case condp when while when-not when-first do future comment doto locking proxy with-open with-precision reify deftype defrecord defprotocol extend extend-protocol extend-type try catch let letfn binding loop for doseq dotimes when-let if-let defstruct struct-map assoc testing deftest handler-case handle dotrace deftrace"),k={digit:/\d/,digit_or_colon:/[\d:]/,hex:/[0-9a-f]/i,sign:/[+-]/,exponent:/e/i,keyword_char:/[^\s\(\[\;\)\]]/,symbol:/[\w*+!\-\._?:<>\/\xa1-\uffff]/};return{startState:function(){return{indentStack:null,indentation:0,mode:!1}},token:function(e,t){if(null==t.indentStack&&e.sol()&&(t.indentation=e.indentation()),e.eatSpace())return null;var n=null;switch(t.mode){case"string":for(var C,S=!1;null!=(C=e.next());){if('"'==C&&!S){t.mode=!1;break}S=!S&&"\\"==C}n=c;break;default:var L=e.next();if('"'==L)t.mode="string",n=c;else if("\\"==L)a(e),n=u;else if("'"!=L||k.digit_or_colon.test(e.peek()))if(";"==L)e.skipToEnd(),n=s;else if(o(L,e))n=d;else if("("==L||"["==L||"{"==L){var M,T="",A=e.column();if("("==L)for(;null!=(M=e.eat(k.keyword_char));)T+=M;T.length>0&&(w.propertyIsEnumerable(T)||/^(?:def|with)/.test(T))?r(t,A+g,L):(e.eatSpace(),e.eol()||";"==e.peek()?r(t,A+v,L):r(t,A+e.current().length,L)),e.backUp(e.current().length-1),n=h}else if(")"==L||"]"==L||"}"==L)n=h,null!=t.indentStack&&t.indentStack.type==(")"==L?"(":"]"==L?"[":"{")&&i(t);else{if(":"==L)return e.eatWhile(k.symbol),f;e.eatWhile(k.symbol),n=b&&b.propertyIsEnumerable(e.current())?p:x&&x.propertyIsEnumerable(e.current())?l:y&&y.propertyIsEnumerable(e.current())?f:m}else n=f}return n},indent:function(e){return null==e.indentStack?e.indentation:e.indentStack.indent},closeBrackets:{pairs:'()[]{}""'},lineComment:";;"}}),e.defineMIME("text/x-clojure","clojure")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("ruby",function(e){function t(e){for(var t={},n=0,r=e.length;r>n;++n)t[e[n]]=!0;return t}function n(e,t,n){return n.tokenize.push(e),e(t,n)}function r(e,t){if(c=null,e.sol()&&e.match("=begin")&&e.eol())return t.tokenize.push(s),"comment";if(e.eatSpace())return null;var r,i=e.next();if("`"==i||"'"==i||'"'==i)return n(a(i,"string",'"'==i||"`"==i),e,t);if("/"==i){var o=e.current().length;if(e.skipTo("/")){var u=e.current().length;e.backUp(e.current().length-o);for(var f=0;e.current().length<u;){var d=e.next();if("("==d?f+=1:")"==d&&(f-=1),0>f)break}if(e.backUp(e.current().length-o),0==f)return n(a(i,"string-2",!0),e,t)}return"operator"}if("%"==i){var p="string",m=!0;e.eat("s")?p="atom":e.eat(/[WQ]/)?p="string":e.eat(/[r]/)?p="string-2":e.eat(/[wxq]/)&&(p="string",m=!1);var g=e.eat(/[^\w\s=]/);return g?(h.propertyIsEnumerable(g)&&(g=h[g]),n(a(g,p,m,!0),e,t)):"operator"}if("#"==i)return e.skipToEnd(),"comment";if("<"==i&&(r=e.match(/^<-?[\`\"\']?([a-zA-Z_?]\w*)[\`\"\']?(?:;|$)/)))return n(l(r[1]),e,t);if("0"==i)return e.eatWhile(e.eat("x")?/[\da-fA-F]/:e.eat("b")?/[01]/:/[0-7]/),"number";if(/\d/.test(i))return e.match(/^[\d_]*(?:\.[\d_]+)?(?:[eE][+\-]?[\d_]+)?/),"number";if("?"==i){for(;e.match(/^\\[CM]-/););return e.eat("\\")?e.eatWhile(/\w/):e.next(),"string"}if(":"==i)return e.eat("'")?n(a("'","atom",!1),e,t):e.eat('"')?n(a('"',"atom",!0),e,t):e.eat(/[\<\>]/)?(e.eat(/[\<\>]/),"atom"):e.eat(/[\+\-\*\/\&\|\:\!]/)?"atom":e.eat(/[a-zA-Z$@_\xa1-\uffff]/)?(e.eatWhile(/[\w$\xa1-\uffff]/),e.eat(/[\?\!\=]/),"atom"):"operator";if("@"==i&&e.match(/^@?[a-zA-Z_\xa1-\uffff]/))return e.eat("@"),e.eatWhile(/[\w\xa1-\uffff]/),"variable-2";if("$"==i)return e.eat(/[a-zA-Z_]/)?e.eatWhile(/[\w]/):e.eat(/\d/)?e.eat(/\d/):e.next(),"variable-3";if(/[a-zA-Z_\xa1-\uffff]/.test(i))return e.eatWhile(/[\w\xa1-\uffff]/),e.eat(/[\?\!]/),e.eat(":")?"atom":"ident";if("|"!=i||!t.varList&&"{"!=t.lastTok&&"do"!=t.lastTok){if(/[\(\)\[\]{}\\;]/.test(i))return c=i,null;if("-"==i&&e.eat(">"))return"arrow";if(/[=+\-\/*:\.^%<>~|]/.test(i)){var v=e.eatWhile(/[=+\-\/*:\.^%<>~|]/);return"."!=i||v||(c="."),"operator"}return null}return c="|",null}function i(e){return e||(e=1),function(t,n){if("}"==t.peek()){if(1==e)return n.tokenize.pop(),n.tokenize[n.tokenize.length-1](t,n);n.tokenize[n.tokenize.length-1]=i(e-1)}else"{"==t.peek()&&(n.tokenize[n.tokenize.length-1]=i(e+1));return r(t,n)}}function o(){var e=!1;return function(t,n){return e?(n.tokenize.pop(),n.tokenize[n.tokenize.length-1](t,n)):(e=!0,r(t,n))}}function a(e,t,n,r){return function(a,l){var s,c=!1;for("read-quoted-paused"===l.context.type&&(l.context=l.context.prev,a.eat("}"));null!=(s=a.next());){if(s==e&&(r||!c)){l.tokenize.pop();break}if(n&&"#"==s&&!c){if(a.eat("{")){"}"==e&&(l.context={prev:l.context,type:"read-quoted-paused"}),l.tokenize.push(i());break}if(/[@\$]/.test(a.peek())){l.tokenize.push(o());break}}c=!c&&"\\"==s}return t}}function l(e){return function(t,n){return t.match(e)?n.tokenize.pop():t.skipToEnd(),"string"}}function s(e,t){return e.sol()&&e.match("=end")&&e.eol()&&t.tokenize.pop(),e.skipToEnd(),"comment"}var c,u=t(["alias","and","BEGIN","begin","break","case","class","def","defined?","do","else","elsif","END","end","ensure","false","for","if","in","module","next","not","or","redo","rescue","retry","return","self","super","then","true","undef","unless","until","when","while","yield","nil","raise","throw","catch","fail","loop","callcc","caller","lambda","proc","public","protected","private","require","load","require_relative","extend","autoload","__END__","__FILE__","__LINE__","__dir__"]),f=t(["def","class","case","for","while","module","then","catch","loop","proc","begin"]),d=t(["end","until"]),h={"[":"]","{":"}","(":")"};return{startState:function(){return{tokenize:[r],indented:0,context:{type:"top",indented:-e.indentUnit},continuedLine:!1,lastTok:null,varList:!1}},token:function(e,t){e.sol()&&(t.indented=e.indentation());var n,r=t.tokenize[t.tokenize.length-1](e,t),i=c;if("ident"==r){var o=e.current();r="."==t.lastTok?"property":u.propertyIsEnumerable(e.current())?"keyword":/^[A-Z]/.test(o)?"tag":"def"==t.lastTok||"class"==t.lastTok||t.varList?"def":"variable","keyword"==r&&(i=o,f.propertyIsEnumerable(o)?n="indent":d.propertyIsEnumerable(o)?n="dedent":"if"!=o&&"unless"!=o||e.column()!=e.indentation()?"do"==o&&t.context.indented<t.indented&&(n="indent"):n="indent")}return(c||r&&"comment"!=r)&&(t.lastTok=i),"|"==c&&(t.varList=!t.varList),"indent"==n||/[\(\[\{]/.test(c)?t.context={prev:t.context,type:c||r,indented:t.indented}:("dedent"==n||/[\)\]\}]/.test(c))&&t.context.prev&&(t.context=t.context.prev),e.eol()&&(t.continuedLine="\\"==c||"operator"==r),r},indent:function(t,n){if(t.tokenize[t.tokenize.length-1]!=r)return 0;var i=n&&n.charAt(0),o=t.context,a=o.type==h[i]||"keyword"==o.type&&/^(?:end|until|else|elsif|when|rescue)\b/.test(n);return o.indented+(a?0:e.indentUnit)+(t.continuedLine?e.indentUnit:0)},electricChars:"}de",lineComment:"#"}}),e.defineMIME("text/x-ruby","ruby")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../lib/codemirror"),require("../addon/search/searchcursor"),require("../addon/edit/matchbrackets")):"function"==typeof define&&define.amd?define(["../lib/codemirror","../addon/search/searchcursor","../addon/edit/matchbrackets"],e):e(CodeMirror)}(function(e){"use strict";function t(t,n,r){if(0>r&&0==n.ch)return t.clipPos(d(n.line-1));var i=t.getLine(n.line);if(r>0&&n.ch>=i.length)return t.clipPos(d(n.line+1,0));for(var o,a="start",l=n.ch,s=0>r?0:i.length,c=0;l!=s;l+=r,c++){var u=i.charAt(0>r?l-1:l),f="_"!=u&&e.isWordChar(u)?"w":"o";if("w"==f&&u.toUpperCase()==u&&(f="W"),"start"==a)"o"!=f&&(a="in",o=f);else if("in"==a&&o!=f){if("w"==o&&"W"==f&&0>r&&l--,"W"==o&&"w"==f&&r>0){o="w";continue}break}}return d(n.line,l)}function n(e,n){e.extendSelectionsBy(function(r){return e.display.shift||e.doc.extend||r.empty()?t(e.doc,r.head,n):0>n?r.from():r.to()})}function r(e,t){e.operation(function(){for(var n=e.listSelections().length,r=[],i=-1,o=0;n>o;o++){var a=e.listSelections()[o].head;if(!(a.line<=i)){var l=d(a.line+(t?0:1),0);e.replaceRange("\n",l,null,"+insertLine"),e.indentLine(l.line,null,!0),r.push({head:l,anchor:l}),i=a.line+1}}e.setSelections(r)})}function i(t,n){for(var r=n.ch,i=r,o=t.getLine(n.line);r&&e.isWordChar(o.charAt(r-1));)--r;for(;i<o.length&&e.isWordChar(o.charAt(i));)++i;return{from:d(n.line,r),to:d(n.line,i),word:o.slice(r,i)}}function o(e){var t=e.getCursor(),n=e.scanForBracket(t,-1);if(n)for(;;){var r=e.scanForBracket(t,1);if(!r)return;if(r.ch==m.charAt(m.indexOf(n.ch)+1))return e.setSelection(d(n.pos.line,n.pos.ch+1),r.pos,!1),!0;t=d(r.pos.line,r.pos.ch+1)}}function a(e,t){for(var n,r=e.listSelections(),i=[],o=0;o<r.length;o++){var a=r[o];if(!a.empty()){for(var l=a.from().line,s=a.to().line;o<r.length-1&&r[o+1].from().line==s;)s=a[++o].to().line;i.push(l,s)}}i.length?n=!0:i.push(e.firstLine(),e.lastLine()),e.operation(function(){for(var r=[],o=0;o<i.length;o+=2){var a=i[o],l=i[o+1],s=d(a,0),c=d(l),u=e.getRange(s,c,!1);t?u.sort():u.sort(function(e,t){var n=e.toUpperCase(),r=t.toUpperCase();return n!=r&&(e=n,t=r),t>e?-1:e==t?0:1}),e.replaceRange(u,s,c,"+sortLines"),n&&r.push({anchor:s,head:c})}n&&e.setSelections(r,0)})}function l(t,n){t.operation(function(){for(var r=t.listSelections(),o=[],a=[],l=0;l<r.length;l++){var s=r[l];s.empty()?(o.push(l),a.push("")):a.push(n(t.getRange(s.from(),s.to())))}t.replaceSelections(a,"around","case");for(var c,l=o.length-1;l>=0;l--){var s=r[o[l]];if(!(c&&e.cmpPos(s.head,c)>0)){var u=i(t,s.head);c=u.from,t.replaceRange(n(u.word),u.from,u.to,"case")}}})}function s(t){var n=t.getCursor("from"),r=t.getCursor("to");if(0==e.cmpPos(n,r)){var o=i(t,n);if(!o.word)return;n=o.from,r=o.to}return{from:n,to:r,query:t.getRange(n,r),word:o}}function c(e,t){var n=s(e);if(n){var r=n.query,i=e.getSearchCursor(r,t?n.to:n.from);(t?i.findNext():i.findPrevious())?e.setSelection(i.from(),i.to()):(i=e.getSearchCursor(r,t?d(e.firstLine(),0):e.clipPos(d(e.lastLine()))),(t?i.findNext():i.findPrevious())?e.setSelection(i.from(),i.to()):n.word&&e.setSelection(n.from,n.to))}}var u=e.keyMap.sublime={fallthrough:"default"},f=e.commands,d=e.Pos,h=e.keyMap["default"]==e.keyMap.macDefault,p=h?"Cmd-":"Ctrl-";f[u["Alt-Left"]="goSubwordLeft"]=function(e){n(e,-1)},f[u["Alt-Right"]="goSubwordRight"]=function(e){n(e,1)},f[u[p+"Up"]="scrollLineUp"]=function(e){var t=e.getScrollInfo();if(!e.somethingSelected()){var n=e.lineAtHeight(t.top+t.clientHeight,"local");e.getCursor().line>=n&&e.execCommand("goLineUp")}e.scrollTo(null,t.top-e.defaultTextHeight())},f[u[p+"Down"]="scrollLineDown"]=function(e){var t=e.getScrollInfo();if(!e.somethingSelected()){var n=e.lineAtHeight(t.top,"local")+1;e.getCursor().line<=n&&e.execCommand("goLineDown")}e.scrollTo(null,t.top+e.defaultTextHeight())},f[u["Shift-"+p+"L"]="splitSelectionByLine"]=function(e){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++)for(var i=t[r].from(),o=t[r].to(),a=i.line;a<=o.line;++a)o.line>i.line&&a==o.line&&0==o.ch||n.push({anchor:a==i.line?i:d(a,0),head:a==o.line?o:d(a)});e.setSelections(n,0)},u["Shift-Tab"]="indentLess",f[u.Esc="singleSelectionTop"]=function(e){var t=e.listSelections()[0];e.setSelection(t.anchor,t.head,{scroll:!1})},f[u[p+"L"]="selectLine"]=function(e){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){var i=t[r];n.push({anchor:d(i.from().line,0),head:d(i.to().line+1,0)})}e.setSelections(n)},u["Shift-"+p+"K"]="deleteLine",f[u[p+"Enter"]="insertLineAfter"]=function(e){r(e,!1)},f[u["Shift-"+p+"Enter"]="insertLineBefore"]=function(e){r(e,!0)},f[u[p+"D"]="selectNextOccurrence"]=function(t){var n=t.getCursor("from"),r=t.getCursor("to"),o=t.state.sublimeFindFullWord==t.doc.sel;if(0==e.cmpPos(n,r)){var a=i(t,n);if(!a.word)return;t.setSelection(a.from,a.to),o=!0}else{var l=t.getRange(n,r),s=o?new RegExp("\\b"+l+"\\b"):l,c=t.getSearchCursor(s,r);c.findNext()?t.addSelection(c.from(),c.to()):(c=t.getSearchCursor(s,d(t.firstLine(),0)),c.findNext()&&t.addSelection(c.from(),c.to()))}o&&(t.state.sublimeFindFullWord=t.doc.sel)};var m="(){}[]";f[u["Shift-"+p+"Space"]="selectScope"]=function(e){o(e)||e.execCommand("selectAll")},f[u["Shift-"+p+"M"]="selectBetweenBrackets"]=function(t){return o(t)?void 0:e.Pass},f[u[p+"M"]="goToBracket"]=function(t){t.extendSelectionsBy(function(n){var r=t.scanForBracket(n.head,1);if(r&&0!=e.cmpPos(r.pos,n.head))return r.pos;var i=t.scanForBracket(n.head,-1);return i&&d(i.pos.line,i.pos.ch+1)||n.head})};var g=h?"Cmd-Ctrl-":"Shift-Ctrl-";f[u[g+"Up"]="swapLineUp"]=function(e){for(var t=e.listSelections(),n=[],r=e.firstLine()-1,i=[],o=0;o<t.length;o++){var a=t[o],l=a.from().line-1,s=a.to().line;i.push({anchor:d(a.anchor.line-1,a.anchor.ch),head:d(a.head.line-1,a.head.ch)}),0!=a.to().ch||a.empty()||--s,l>r?n.push(l,s):n.length&&(n[n.length-1]=s),r=s}e.operation(function(){for(var t=0;t<n.length;t+=2){var r=n[t],o=n[t+1],a=e.getLine(r);e.replaceRange("",d(r,0),d(r+1,0),"+swapLine"),o>e.lastLine()?e.replaceRange("\n"+a,d(e.lastLine()),null,"+swapLine"):e.replaceRange(a+"\n",d(o,0),null,"+swapLine")}e.setSelections(i),e.scrollIntoView()})},f[u[g+"Down"]="swapLineDown"]=function(e){for(var t=e.listSelections(),n=[],r=e.lastLine()+1,i=t.length-1;i>=0;i--){var o=t[i],a=o.to().line+1,l=o.from().line;0!=o.to().ch||o.empty()||a--,r>a?n.push(a,l):n.length&&(n[n.length-1]=l),r=l}e.operation(function(){for(var t=n.length-2;t>=0;t-=2){var r=n[t],i=n[t+1],o=e.getLine(r);r==e.lastLine()?e.replaceRange("",d(r-1),d(r),"+swapLine"):e.replaceRange("",d(r,0),d(r+1,0),"+swapLine"),e.replaceRange(o+"\n",d(i,0),null,"+swapLine")}e.scrollIntoView()})},u[p+"/"]="toggleComment",f[u[p+"J"]="joinLines"]=function(e){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){for(var i=t[r],o=i.from(),a=o.line,l=i.to().line;r<t.length-1&&t[r+1].from().line==l;)l=t[++r].to().line;n.push({start:a,end:l,anchor:!i.empty()&&o})}e.operation(function(){for(var t=0,r=[],i=0;i<n.length;i++){for(var o,a=n[i],l=a.anchor&&d(a.anchor.line-t,a.anchor.ch),s=a.start;s<=a.end;s++){var c=s-t;s==a.end&&(o=d(c,e.getLine(c).length+1)),c<e.lastLine()&&(e.replaceRange(" ",d(c),d(c+1,/^\s*/.exec(e.getLine(c+1))[0].length),"+joinLines"),++t)}r.push({anchor:l||o,head:o})}e.setSelections(r,0)})},f[u["Shift-"+p+"D"]="duplicateLine"]=function(e){e.operation(function(){for(var t=e.listSelections().length,n=0;t>n;n++){var r=e.listSelections()[n];r.empty()?e.replaceRange(e.getLine(r.head.line)+"\n",d(r.head.line,0),null,"+duplicateLine"):e.replaceRange(e.getRange(r.from(),r.to()),r.from(),null,"+duplicateLine")}e.scrollIntoView()})},u[p+"T"]="transposeChars",f[u.F9="sortLines"]=function(e){a(e,!0)},f[u[p+"F9"]="sortLinesInsensitive"]=function(e){a(e,!1)},f[u.F2="nextBookmark"]=function(e){var t=e.state.sublimeBookmarks;if(t)for(;t.length;){var n=t.shift(),r=n.find();if(r)return t.push(n),e.setSelection(r.from,r.to)}},f[u["Shift-F2"]="prevBookmark"]=function(e){var t=e.state.sublimeBookmarks;if(t)for(;t.length;){t.unshift(t.pop());var n=t[t.length-1].find();if(n)return e.setSelection(n.from,n.to);t.pop()}},f[u[p+"F2"]="toggleBookmark"]=function(e){for(var t=e.listSelections(),n=e.state.sublimeBookmarks||(e.state.sublimeBookmarks=[]),r=0;r<t.length;r++){for(var i=t[r].from(),o=t[r].to(),a=e.findMarks(i,o),l=0;l<a.length;l++)if(a[l].sublimeBookmark){a[l].clear();for(var s=0;s<n.length;s++)n[s]==a[l]&&n.splice(s--,1);break}l==a.length&&n.push(e.markText(i,o,{sublimeBookmark:!0,clearWhenEmpty:!1}))}},f[u["Shift-"+p+"F2"]="clearBookmarks"]=function(e){var t=e.state.sublimeBookmarks; -e.registerHelper("hintWords","css",k),e.defineMIME("text/css",{documentTypes:o,mediaTypes:l,mediaFeatures:c,propertyKeywords:d,nonStandardPropertyKeywords:h,fontProperties:m,counterDescriptors:v,colorKeywords:b,valueKeywords:w,tokenHooks:{"<":function(e,t){return e.match("!--")?(t.tokenize=n,n(e,t)):!1},"/":function(e,t){return e.eat("*")?(t.tokenize=r,r(e,t)):!1}},name:"css"}),e.defineMIME("text/x-scss",{mediaTypes:l,mediaFeatures:c,propertyKeywords:d,nonStandardPropertyKeywords:h,colorKeywords:b,valueKeywords:w,fontProperties:m,allowNested:!0,tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=r,r(e,t)):["operator","operator"]},":":function(e){return e.match(/\s*\{/)?[null,"{"]:!1},$:function(e){return e.match(/^[\w-]+/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"]},"#":function(e){return e.eat("{")?[null,"interpolation"]:!1}},name:"css",helperType:"scss"}),e.defineMIME("text/x-less",{mediaTypes:l,mediaFeatures:c,propertyKeywords:d,nonStandardPropertyKeywords:h,colorKeywords:b,valueKeywords:w,fontProperties:m,allowNested:!0,tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=r,r(e,t)):["operator","operator"]},"@":function(e){return e.eat("{")?[null,"interpolation"]:e.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/,!1)?!1:(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"])},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../xml/xml"),require("../javascript/javascript"),require("../css/css")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../javascript/javascript","../css/css"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("htmlmixed",function(t,r){function n(e,t){var r=t.htmlState.tagName;r&&(r=r.toLowerCase());var n=l.token(e,t.htmlState);if("script"==r&&/\btag\b/.test(n)&&">"==e.current()){var i=e.string.slice(Math.max(0,e.pos-100),e.pos).match(/\btype\s*=\s*("[^"]+"|'[^']+'|\S+)[^<]*$/i);i=i?i[1]:"",i&&/[\"\']/.test(i.charAt(0))&&(i=i.slice(1,i.length-1));for(var u=0;u<c.length;++u){var d=c[u];if("string"==typeof d.matches?i==d.matches:d.matches.test(i)){d.mode&&(t.token=o,t.localMode=d.mode,t.localState=d.mode.startState&&d.mode.startState(l.indent(t.htmlState,"")));break}}}else"style"==r&&/\btag\b/.test(n)&&">"==e.current()&&(t.token=a,t.localMode=s,t.localState=s.startState(l.indent(t.htmlState,"")));return n}function i(e,t,r){var n,i=e.current(),o=i.search(t);return o>-1?e.backUp(i.length-o):(n=i.match(/<\/?$/))&&(e.backUp(i.length),e.match(t,!1)||e.match(i)),r}function o(e,t){return e.match(/^<\/\s*script\s*>/i,!1)?(t.token=n,t.localState=t.localMode=null,null):i(e,/<\/\s*script\s*>/,t.localMode.token(e,t.localState))}function a(e,t){return e.match(/^<\/\s*style\s*>/i,!1)?(t.token=n,t.localState=t.localMode=null,null):i(e,/<\/\s*style\s*>/,s.token(e,t.localState))}var l=e.getMode(t,{name:"xml",htmlMode:!0,multilineTagIndentFactor:r.multilineTagIndentFactor,multilineTagIndentPastTag:r.multilineTagIndentPastTag}),s=e.getMode(t,"css"),c=[],u=r&&r.scriptTypes;if(c.push({matches:/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i,mode:e.getMode(t,"javascript")}),u)for(var d=0;d<u.length;++d){var f=u[d];c.push({matches:f.matches,mode:f.mode&&e.getMode(t,f.mode)})}return c.push({matches:/./,mode:e.getMode(t,"text/plain")}),{startState:function(){var e=l.startState();return{token:n,localMode:null,localState:null,htmlState:e}},copyState:function(t){if(t.localState)var r=e.copyState(t.localMode,t.localState);return{token:t.token,localMode:t.localMode,localState:r,htmlState:e.copyState(l,t.htmlState)}},token:function(e,t){return t.token(e,t)},indent:function(t,r){return!t.localMode||/^\s*<\//.test(r)?l.indent(t.htmlState,r):t.localMode.indent?t.localMode.indent(t.localState,r):e.Pass},innerMode:function(e){return{state:e.localState||e.htmlState,mode:e.localMode||l}}}},"xml","javascript","css"),e.defineMIME("text/html","htmlmixed")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){for(var t={},r=e.split(" "),n=0;n<r.length;++n)t[r[n]]=!0;return t}function r(e,t){if(!t.startOfLine)return!1;for(;;){if(!e.skipTo("\\")){e.skipToEnd(),t.tokenize=null;break}if(e.next(),e.eol()){t.tokenize=r;break}}return"meta"}function n(e,t){if(e.backUp(1),e.match(/(R|u8R|uR|UR|LR)/)){var r=e.match(/"([^\s\\()]{0,16})\(/);return r?(t.cpp11RawStringDelim=r[1],t.tokenize=o,o(e,t)):!1}return e.match(/(u8|u|U|L)/)?e.match(/["']/,!1)?"string":!1:(e.next(),!1)}function i(e,t){for(var r;null!=(r=e.next());)if('"'==r&&!e.eat('"')){t.tokenize=null;break}return"string"}function o(e,t){var r=t.cpp11RawStringDelim.replace(/[^\w\s]/g,"\\$&"),n=e.match(new RegExp(".*?\\)"+r+'"'));return n?t.tokenize=null:e.skipToEnd(),"string"}function a(t,r){function n(e){if(e)for(var t in e)e.hasOwnProperty(t)&&i.push(t)}"string"==typeof t&&(t=[t]);var i=[];n(r.keywords),n(r.builtin),n(r.atoms),i.length&&(r.helperType=t[0],e.registerHelper("hintWords",t[0],i));for(var o=0;o<t.length;++o)e.defineMIME(t[o],r)}function l(e,t){for(var r=!1;!e.eol();){if(!r&&e.match('"""')){t.tokenize=null;break}r="\\"==e.next()&&!r}return"string"}e.defineMode("clike",function(t,r){function n(e,t){var r=e.next();if(v[r]){var n=v[r](e,t);if(n!==!1)return n}if('"'==r||"'"==r)return t.tokenize=i(r),t.tokenize(e,t);if(/[\[\]{}\(\),;\:\.]/.test(r))return c=r,null;if(/\d/.test(r))return e.eatWhile(/[\w\.]/),"number";if("/"==r){if(e.eat("*"))return t.tokenize=o,o(e,t);if(e.eat("/"))return e.skipToEnd(),"comment"}if(x.test(r))return e.eatWhile(x),"operator";e.eatWhile(/[\w\$_\xa1-\uffff]/);var a=e.current();return h.propertyIsEnumerable(a)?(m.propertyIsEnumerable(a)&&(c="newstatement"),"keyword"):p.propertyIsEnumerable(a)?(m.propertyIsEnumerable(a)&&(c="newstatement"),"builtin"):g.propertyIsEnumerable(a)?"atom":"variable"}function i(e){return function(t,r){for(var n,i=!1,o=!1;null!=(n=t.next());){if(n==e&&!i){o=!0;break}i=!i&&"\\"==n}return(o||!i&&!y)&&(r.tokenize=null),"string"}}function o(e,t){for(var r,n=!1;r=e.next();){if("/"==r&&n){t.tokenize=null;break}n="*"==r}return"comment"}function a(e,t,r,n,i){this.indented=e,this.column=t,this.type=r,this.align=n,this.prev=i}function l(e,t,r){var n=e.indented;return e.context&&"statement"==e.context.type&&(n=e.context.indented),e.context=new a(n,t,r,null,e.context)}function s(e){var t=e.context.type;return(")"==t||"]"==t||"}"==t)&&(e.indented=e.context.indented),e.context=e.context.prev}var c,u=t.indentUnit,d=r.statementIndentUnit||u,f=r.dontAlignCalls,h=r.keywords||{},p=r.builtin||{},m=r.blockKeywords||{},g=r.atoms||{},v=r.hooks||{},y=r.multiLineStrings,b=r.indentStatements!==!1,x=/[+\-*&%=<>!?|\/]/;return{startState:function(e){return{tokenize:null,context:new a((e||0)-u,0,"top",!1),indented:0,startOfLine:!0}},token:function(e,t){var r=t.context;if(e.sol()&&(null==r.align&&(r.align=!1),t.indented=e.indentation(),t.startOfLine=!0),e.eatSpace())return null;c=null;var i=(t.tokenize||n)(e,t);if("comment"==i||"meta"==i)return i;if(null==r.align&&(r.align=!0),";"!=c&&":"!=c&&","!=c||"statement"!=r.type)if("{"==c)l(t,e.column(),"}");else if("["==c)l(t,e.column(),"]");else if("("==c)l(t,e.column(),")");else if("}"==c){for(;"statement"==r.type;)r=s(t);for("}"==r.type&&(r=s(t));"statement"==r.type;)r=s(t)}else c==r.type?s(t):b&&(("}"==r.type||"top"==r.type)&&";"!=c||"statement"==r.type&&"newstatement"==c)&&l(t,e.column(),"statement");else s(t);return t.startOfLine=!1,i},indent:function(t,r){if(t.tokenize!=n&&null!=t.tokenize)return e.Pass;var i=t.context,o=r&&r.charAt(0);"statement"==i.type&&"}"==o&&(i=i.prev);var a=o==i.type;return"statement"==i.type?i.indented+("{"==o?0:d):!i.align||f&&")"==i.type?")"!=i.type||a?i.indented+(a?0:u):i.indented+d:i.column+(a?0:1)},electricChars:"{}",blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",fold:"brace"}});var s="auto if break int case long char register continue return default short do sizeof double static else struct switch extern typedef float union for unsigned goto while enum void const signed volatile";a(["text/x-csrc","text/x-c","text/x-chdr"],{name:"clike",keywords:t(s),blockKeywords:t("case do else for if switch while struct"),atoms:t("null"),hooks:{"#":r},modeProps:{fold:["brace","include"]}}),a(["text/x-c++src","text/x-c++hdr"],{name:"clike",keywords:t(s+" asm dynamic_cast namespace reinterpret_cast try bool explicit new static_cast typeid catch operator template typename class friend private this using const_cast inline public throw virtual delete mutable protected wchar_t alignas alignof constexpr decltype nullptr noexcept thread_local final static_assert override"),blockKeywords:t("catch class do else finally for if struct switch try while"),atoms:t("true false null"),hooks:{"#":r,u:n,U:n,L:n,R:n},modeProps:{fold:["brace","include"]}}),a("text/x-java",{name:"clike",keywords:t("abstract assert boolean break byte case catch char class const continue default do double else enum extends final finally float for goto if implements import instanceof int interface long native new package private protected public return short static strictfp super switch synchronized this throw throws transient try void volatile while"),blockKeywords:t("catch class do else finally for if switch try while"),atoms:t("true false null"),hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"}},modeProps:{fold:["brace","import"]}}),a("text/x-csharp",{name:"clike",keywords:t("abstract as base break case catch checked class const continue default delegate do else enum event explicit extern finally fixed for foreach goto if implicit in interface internal is lock namespace new operator out override params private protected public readonly ref return sealed sizeof stackalloc static struct switch this throw try typeof unchecked unsafe using virtual void volatile while add alias ascending descending dynamic from get global group into join let orderby partial remove select set value var yield"),blockKeywords:t("catch class do else finally for foreach if struct switch try while"),builtin:t("Boolean Byte Char DateTime DateTimeOffset Decimal Double Guid Int16 Int32 Int64 Object SByte Single String TimeSpan UInt16 UInt32 UInt64 bool byte char decimal double short int long object sbyte float string ushort uint ulong"),atoms:t("true false null"),hooks:{"@":function(e,t){return e.eat('"')?(t.tokenize=i,i(e,t)):(e.eatWhile(/[\w\$_]/),"meta")}}}),a("text/x-scala",{name:"clike",keywords:t("abstract case catch class def do else extends false final finally for forSome if implicit import lazy match new null object override package private protected return sealed super this throw trait try trye type val var while with yield _ : = => <- <: <% >: # @ assert assume require print println printf readLine readBoolean readByte readShort readChar readInt readLong readFloat readDouble AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either Enumeration Equiv Error Exception Fractional Function IndexedSeq Integral Iterable Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector :: #:: Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"),multiLineStrings:!0,blockKeywords:t("catch class do else finally for forSome if match switch try while"),atoms:t("true false null"),indentStatements:!1,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,t){return e.match('""')?(t.tokenize=l,t.tokenize(e,t)):!1},"'":function(e){return e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"}},modeProps:{closeBrackets:{triples:'"'}}}),a(["x-shader/x-vertex","x-shader/x-fragment"],{name:"clike",keywords:t("float int bool void vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 mat2 mat3 mat4 sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadow const attribute uniform varying break continue discard return for while do if else struct in out inout"),blockKeywords:t("for while do if else struct"),builtin:t("radians degrees sin cos tan asin acos atan pow exp log exp2 sqrt inversesqrt abs sign floor ceil fract mod min max clamp mix step smoothstep length distance dot cross normalize ftransform faceforward reflect refract matrixCompMult lessThan lessThanEqual greaterThan greaterThanEqual equal notEqual any all not texture1D texture1DProj texture1DLod texture1DProjLod texture2D texture2DProj texture2DLod texture2DProjLod texture3D texture3DProj texture3DLod texture3DProjLod textureCube textureCubeLod shadow1D shadow2D shadow1DProj shadow2DProj shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod dFdx dFdy fwidth noise1 noise2 noise3 noise4"),atoms:t("true false gl_FragColor gl_SecondaryColor gl_Normal gl_Vertex gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_FogCoord gl_PointCoord gl_Position gl_PointSize gl_ClipVertex gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor gl_TexCoord gl_FogFragCoord gl_FragCoord gl_FrontFacing gl_FragData gl_FragDepth gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse gl_TexureMatrixTranspose gl_ModelViewMatrixInverseTranspose gl_ProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixInverseTranspose gl_TextureMatrixInverseTranspose gl_NormalScale gl_DepthRange gl_ClipPlane gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource gl_LightModel gl_FrontLightModelProduct gl_BackLightModelProduct gl_TextureColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ gl_FogParameters gl_MaxLights gl_MaxClipPlanes gl_MaxTextureUnits gl_MaxTextureCoords gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits gl_MaxDrawBuffers"),hooks:{"#":r},modeProps:{fold:["brace","include"]}}),a("text/x-nesc",{name:"clike",keywords:t(s+"as atomic async call command component components configuration event generic implementation includes interface module new norace nx_struct nx_union post provides signal task uses abstract extends"),blockKeywords:t("case do else for if switch while struct"),atoms:t("null"),hooks:{"#":r},modeProps:{fold:["brace","include"]}}),a("text/x-objectivec",{name:"clike",keywords:t(s+"inline restrict _Bool _Complex _Imaginery BOOL Class bycopy byref id IMP in inout nil oneway out Protocol SEL self super atomic nonatomic retain copy readwrite readonly"),atoms:t("YES NO NULL NILL ON OFF"),hooks:{"@":function(e){return e.eatWhile(/[\w\$]/),"keyword"},"#":r},modeProps:{fold:"brace"}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("clojure",function(e){function t(e){for(var t={},r=e.split(" "),n=0;n<r.length;++n)t[r[n]]=!0;return t}function r(e,t,r){this.indent=e,this.type=t,this.prev=r}function n(e,t,n){e.indentStack=new r(t,n,e.indentStack)}function i(e){e.indentStack=e.indentStack.prev}function o(e,t){return"0"===e&&t.eat(/x/i)?(t.eatWhile(k.hex),!0):("+"!=e&&"-"!=e||!k.digit.test(t.peek())||(t.eat(k.sign),e=t.next()),k.digit.test(e)?(t.eat(e),t.eatWhile(k.digit),"."==t.peek()&&(t.eat("."),t.eatWhile(k.digit)),t.eat(k.exponent)&&(t.eat(k.sign),t.eatWhile(k.digit)),!0):!1)}function a(e){var t=e.next();t&&t.match(/[a-z]/)&&e.match(/[a-z]+/,!0)||"u"===t&&e.match(/[0-9a-z]{4}/i,!0)}var l="builtin",s="comment",c="string",u="string-2",d="atom",f="number",h="bracket",p="keyword",m="variable",g=e.indentUnit||2,v=e.indentUnit||2,y=t("true false nil"),b=t("defn defn- def def- defonce defmulti defmethod defmacro defstruct deftype defprotocol defrecord defproject deftest slice defalias defhinted defmacro- defn-memo defnk defnk defonce- defunbound defunbound- defvar defvar- let letfn do case cond condp for loop recur when when-not when-let when-first if if-let if-not . .. -> ->> doto and or dosync doseq dotimes dorun doall load import unimport ns in-ns refer try catch finally throw with-open with-local-vars binding gen-class gen-and-load-class gen-and-save-class handler-case handle"),x=t("* *' *1 *2 *3 *agent* *allow-unresolved-vars* *assert* *clojure-version* *command-line-args* *compile-files* *compile-path* *compiler-options* *data-readers* *e *err* *file* *flush-on-newline* *fn-loader* *in* *math-context* *ns* *out* *print-dup* *print-length* *print-level* *print-meta* *print-readably* *read-eval* *source-path* *unchecked-math* *use-context-classloader* *verbose-defrecords* *warn-on-reflection* + +' - -' -> ->> ->ArrayChunk ->Vec ->VecNode ->VecSeq -cache-protocol-fn -reset-methods .. / < <= = == > >= EMPTY-NODE accessor aclone add-classpath add-watch agent agent-error agent-errors aget alength alias all-ns alter alter-meta! alter-var-root amap ancestors and apply areduce array-map aset aset-boolean aset-byte aset-char aset-double aset-float aset-int aset-long aset-short assert assoc assoc! assoc-in associative? atom await await-for await1 bases bean bigdec bigint biginteger binding bit-and bit-and-not bit-clear bit-flip bit-not bit-or bit-set bit-shift-left bit-shift-right bit-test bit-xor boolean boolean-array booleans bound-fn bound-fn* bound? butlast byte byte-array bytes case cast char char-array char-escape-string char-name-string char? chars chunk chunk-append chunk-buffer chunk-cons chunk-first chunk-next chunk-rest chunked-seq? class class? clear-agent-errors clojure-version coll? comment commute comp comparator compare compare-and-set! compile complement concat cond condp conj conj! cons constantly construct-proxy contains? count counted? create-ns create-struct cycle dec dec' decimal? declare default-data-readers definline definterface defmacro defmethod defmulti defn defn- defonce defprotocol defrecord defstruct deftype delay delay? deliver denominator deref derive descendants destructure disj disj! dissoc dissoc! distinct distinct? doall dorun doseq dosync dotimes doto double double-array doubles drop drop-last drop-while empty empty? ensure enumeration-seq error-handler error-mode eval even? every-pred every? ex-data ex-info extend extend-protocol extend-type extenders extends? false? ffirst file-seq filter filterv find find-keyword find-ns find-protocol-impl find-protocol-method find-var first flatten float float-array float? floats flush fn fn? fnext fnil for force format frequencies future future-call future-cancel future-cancelled? future-done? future? gen-class gen-interface gensym get get-in get-method get-proxy-class get-thread-bindings get-validator group-by hash hash-combine hash-map hash-set identical? identity if-let if-not ifn? import in-ns inc inc' init-proxy instance? int int-array integer? interleave intern interpose into into-array ints io! isa? iterate iterator-seq juxt keep keep-indexed key keys keyword keyword? last lazy-cat lazy-seq let letfn line-seq list list* list? load load-file load-reader load-string loaded-libs locking long long-array longs loop macroexpand macroexpand-1 make-array make-hierarchy map map-indexed map? mapcat mapv max max-key memfn memoize merge merge-with meta method-sig methods min min-key mod munge name namespace namespace-munge neg? newline next nfirst nil? nnext not not-any? not-empty not-every? not= ns ns-aliases ns-imports ns-interns ns-map ns-name ns-publics ns-refers ns-resolve ns-unalias ns-unmap nth nthnext nthrest num number? numerator object-array odd? or parents partial partition partition-all partition-by pcalls peek persistent! pmap pop pop! pop-thread-bindings pos? pr pr-str prefer-method prefers primitives-classnames print print-ctor print-dup print-method print-simple print-str printf println println-str prn prn-str promise proxy proxy-call-with-super proxy-mappings proxy-name proxy-super push-thread-bindings pvalues quot rand rand-int rand-nth range ratio? rational? rationalize re-find re-groups re-matcher re-matches re-pattern re-seq read read-line read-string realized? reduce reduce-kv reductions ref ref-history-count ref-max-history ref-min-history ref-set refer refer-clojure reify release-pending-sends rem remove remove-all-methods remove-method remove-ns remove-watch repeat repeatedly replace replicate require reset! reset-meta! resolve rest restart-agent resultset-seq reverse reversible? rseq rsubseq satisfies? second select-keys send send-off seq seq? seque sequence sequential? set set-error-handler! set-error-mode! set-validator! set? short short-array shorts shuffle shutdown-agents slurp some some-fn sort sort-by sorted-map sorted-map-by sorted-set sorted-set-by sorted? special-symbol? spit split-at split-with str string? struct struct-map subs subseq subvec supers swap! symbol symbol? sync take take-last take-nth take-while test the-ns thread-bound? time to-array to-array-2d trampoline transient tree-seq true? type unchecked-add unchecked-add-int unchecked-byte unchecked-char unchecked-dec unchecked-dec-int unchecked-divide-int unchecked-double unchecked-float unchecked-inc unchecked-inc-int unchecked-int unchecked-long unchecked-multiply unchecked-multiply-int unchecked-negate unchecked-negate-int unchecked-remainder-int unchecked-short unchecked-subtract unchecked-subtract-int underive unquote unquote-splicing update-in update-proxy use val vals var-get var-set var? vary-meta vec vector vector-of vector? when when-first when-let when-not while with-bindings with-bindings* with-in-str with-loading-context with-local-vars with-meta with-open with-out-str with-precision with-redefs with-redefs-fn xml-seq zero? zipmap *default-data-reader-fn* as-> cond-> cond->> reduced reduced? send-via set-agent-send-executor! set-agent-send-off-executor! some-> some->>"),w=t("ns fn def defn defmethod bound-fn if if-not case condp when while when-not when-first do future comment doto locking proxy with-open with-precision reify deftype defrecord defprotocol extend extend-protocol extend-type try catch let letfn binding loop for doseq dotimes when-let if-let defstruct struct-map assoc testing deftest handler-case handle dotrace deftrace"),k={digit:/\d/,digit_or_colon:/[\d:]/,hex:/[0-9a-f]/i,sign:/[+-]/,exponent:/e/i,keyword_char:/[^\s\(\[\;\)\]]/,symbol:/[\w*+!\-\._?:<>\/\xa1-\uffff]/};return{startState:function(){return{indentStack:null,indentation:0,mode:!1}},token:function(e,t){if(null==t.indentStack&&e.sol()&&(t.indentation=e.indentation()),e.eatSpace())return null;var r=null;switch(t.mode){case"string":for(var C,S=!1;null!=(C=e.next());){if('"'==C&&!S){t.mode=!1;break}S=!S&&"\\"==C}r=c;break;default:var L=e.next();if('"'==L)t.mode="string",r=c;else if("\\"==L)a(e),r=u;else if("'"!=L||k.digit_or_colon.test(e.peek()))if(";"==L)e.skipToEnd(),r=s;else if(o(L,e))r=f;else if("("==L||"["==L||"{"==L){var M,T="",A=e.column();if("("==L)for(;null!=(M=e.eat(k.keyword_char));)T+=M;T.length>0&&(w.propertyIsEnumerable(T)||/^(?:def|with)/.test(T))?n(t,A+g,L):(e.eatSpace(),e.eol()||";"==e.peek()?n(t,A+v,L):n(t,A+e.current().length,L)),e.backUp(e.current().length-1),r=h}else if(")"==L||"]"==L||"}"==L)r=h,null!=t.indentStack&&t.indentStack.type==(")"==L?"(":"]"==L?"[":"{")&&i(t);else{if(":"==L)return e.eatWhile(k.symbol),d;e.eatWhile(k.symbol),r=b&&b.propertyIsEnumerable(e.current())?p:x&&x.propertyIsEnumerable(e.current())?l:y&&y.propertyIsEnumerable(e.current())?d:m}else r=d}return r},indent:function(e){return null==e.indentStack?e.indentation:e.indentStack.indent},closeBrackets:{pairs:'()[]{}""'},lineComment:";;"}}),e.defineMIME("text/x-clojure","clojure")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("ruby",function(e){function t(e){for(var t={},r=0,n=e.length;n>r;++r)t[e[r]]=!0;return t}function r(e,t,r){return r.tokenize.push(e),e(t,r)}function n(e,t){if(c=null,e.sol()&&e.match("=begin")&&e.eol())return t.tokenize.push(s),"comment";if(e.eatSpace())return null;var n,i=e.next();if("`"==i||"'"==i||'"'==i)return r(a(i,"string",'"'==i||"`"==i),e,t);if("/"==i){var o=e.current().length;if(e.skipTo("/")){var u=e.current().length;e.backUp(e.current().length-o);for(var d=0;e.current().length<u;){var f=e.next();if("("==f?d+=1:")"==f&&(d-=1),0>d)break}if(e.backUp(e.current().length-o),0==d)return r(a(i,"string-2",!0),e,t)}return"operator"}if("%"==i){var p="string",m=!0;e.eat("s")?p="atom":e.eat(/[WQ]/)?p="string":e.eat(/[r]/)?p="string-2":e.eat(/[wxq]/)&&(p="string",m=!1);var g=e.eat(/[^\w\s=]/);return g?(h.propertyIsEnumerable(g)&&(g=h[g]),r(a(g,p,m,!0),e,t)):"operator"}if("#"==i)return e.skipToEnd(),"comment";if("<"==i&&(n=e.match(/^<-?[\`\"\']?([a-zA-Z_?]\w*)[\`\"\']?(?:;|$)/)))return r(l(n[1]),e,t);if("0"==i)return e.eatWhile(e.eat("x")?/[\da-fA-F]/:e.eat("b")?/[01]/:/[0-7]/),"number";if(/\d/.test(i))return e.match(/^[\d_]*(?:\.[\d_]+)?(?:[eE][+\-]?[\d_]+)?/),"number";if("?"==i){for(;e.match(/^\\[CM]-/););return e.eat("\\")?e.eatWhile(/\w/):e.next(),"string"}if(":"==i)return e.eat("'")?r(a("'","atom",!1),e,t):e.eat('"')?r(a('"',"atom",!0),e,t):e.eat(/[\<\>]/)?(e.eat(/[\<\>]/),"atom"):e.eat(/[\+\-\*\/\&\|\:\!]/)?"atom":e.eat(/[a-zA-Z$@_\xa1-\uffff]/)?(e.eatWhile(/[\w$\xa1-\uffff]/),e.eat(/[\?\!\=]/),"atom"):"operator";if("@"==i&&e.match(/^@?[a-zA-Z_\xa1-\uffff]/))return e.eat("@"),e.eatWhile(/[\w\xa1-\uffff]/),"variable-2";if("$"==i)return e.eat(/[a-zA-Z_]/)?e.eatWhile(/[\w]/):e.eat(/\d/)?e.eat(/\d/):e.next(),"variable-3";if(/[a-zA-Z_\xa1-\uffff]/.test(i))return e.eatWhile(/[\w\xa1-\uffff]/),e.eat(/[\?\!]/),e.eat(":")?"atom":"ident";if("|"!=i||!t.varList&&"{"!=t.lastTok&&"do"!=t.lastTok){if(/[\(\)\[\]{}\\;]/.test(i))return c=i,null;if("-"==i&&e.eat(">"))return"arrow";if(/[=+\-\/*:\.^%<>~|]/.test(i)){var v=e.eatWhile(/[=+\-\/*:\.^%<>~|]/);return"."!=i||v||(c="."),"operator"}return null}return c="|",null}function i(e){return e||(e=1),function(t,r){if("}"==t.peek()){if(1==e)return r.tokenize.pop(),r.tokenize[r.tokenize.length-1](t,r);r.tokenize[r.tokenize.length-1]=i(e-1)}else"{"==t.peek()&&(r.tokenize[r.tokenize.length-1]=i(e+1));return n(t,r)}}function o(){var e=!1;return function(t,r){return e?(r.tokenize.pop(),r.tokenize[r.tokenize.length-1](t,r)):(e=!0,n(t,r))}}function a(e,t,r,n){return function(a,l){var s,c=!1;for("read-quoted-paused"===l.context.type&&(l.context=l.context.prev,a.eat("}"));null!=(s=a.next());){if(s==e&&(n||!c)){l.tokenize.pop();break}if(r&&"#"==s&&!c){if(a.eat("{")){"}"==e&&(l.context={prev:l.context,type:"read-quoted-paused"}),l.tokenize.push(i());break}if(/[@\$]/.test(a.peek())){l.tokenize.push(o());break}}c=!c&&"\\"==s}return t}}function l(e){return function(t,r){return t.match(e)?r.tokenize.pop():t.skipToEnd(),"string"}}function s(e,t){return e.sol()&&e.match("=end")&&e.eol()&&t.tokenize.pop(),e.skipToEnd(),"comment"}var c,u=t(["alias","and","BEGIN","begin","break","case","class","def","defined?","do","else","elsif","END","end","ensure","false","for","if","in","module","next","not","or","redo","rescue","retry","return","self","super","then","true","undef","unless","until","when","while","yield","nil","raise","throw","catch","fail","loop","callcc","caller","lambda","proc","public","protected","private","require","load","require_relative","extend","autoload","__END__","__FILE__","__LINE__","__dir__"]),d=t(["def","class","case","for","while","module","then","catch","loop","proc","begin"]),f=t(["end","until"]),h={"[":"]","{":"}","(":")"};return{startState:function(){return{tokenize:[n],indented:0,context:{type:"top",indented:-e.indentUnit},continuedLine:!1,lastTok:null,varList:!1}},token:function(e,t){e.sol()&&(t.indented=e.indentation());var r,n=t.tokenize[t.tokenize.length-1](e,t),i=c;if("ident"==n){var o=e.current();n="."==t.lastTok?"property":u.propertyIsEnumerable(e.current())?"keyword":/^[A-Z]/.test(o)?"tag":"def"==t.lastTok||"class"==t.lastTok||t.varList?"def":"variable","keyword"==n&&(i=o,d.propertyIsEnumerable(o)?r="indent":f.propertyIsEnumerable(o)?r="dedent":"if"!=o&&"unless"!=o||e.column()!=e.indentation()?"do"==o&&t.context.indented<t.indented&&(r="indent"):r="indent")}return(c||n&&"comment"!=n)&&(t.lastTok=i),"|"==c&&(t.varList=!t.varList),"indent"==r||/[\(\[\{]/.test(c)?t.context={prev:t.context,type:c||n,indented:t.indented}:("dedent"==r||/[\)\]\}]/.test(c))&&t.context.prev&&(t.context=t.context.prev),e.eol()&&(t.continuedLine="\\"==c||"operator"==n),n},indent:function(t,r){if(t.tokenize[t.tokenize.length-1]!=n)return 0;var i=r&&r.charAt(0),o=t.context,a=o.type==h[i]||"keyword"==o.type&&/^(?:end|until|else|elsif|when|rescue)\b/.test(r);return o.indented+(a?0:e.indentUnit)+(t.continuedLine?e.indentUnit:0)},electricChars:"}de",lineComment:"#"}}),e.defineMIME("text/x-ruby","ruby")});
\ No newline at end of file +if(t)for(var n=0;n<t.length;n++)t[n].clear();t.length=0},f[u["Alt-F2"]="selectBookmarks"]=function(e){var t=e.state.sublimeBookmarks,n=[];if(t)for(var r=0;r<t.length;r++){var i=t[r].find();i?n.push({anchor:i.from,head:i.to}):t.splice(r--,0)}n.length&&e.setSelections(n,0)},u["Alt-Q"]="wrapLines";var v=p+"K ";u[v+p+"Backspace"]="delLineLeft",f[u.Backspace="smartBackspace"]=function(t){if(t.somethingSelected())return e.Pass;var n=t.getCursor(),r=t.getRange({line:n.line,ch:0},n),i=e.countColumn(r,null,t.getOption("tabSize"));return r&&!/\S/.test(r)&&i%t.getOption("indentUnit")==0?t.indentSelection("subtract"):e.Pass},f[u[v+p+"K"]="delLineRight"]=function(e){e.operation(function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange("",t[n].anchor,d(t[n].to().line),"+delete");e.scrollIntoView()})},f[u[v+p+"U"]="upcaseAtCursor"]=function(e){l(e,function(e){return e.toUpperCase()})},f[u[v+p+"L"]="downcaseAtCursor"]=function(e){l(e,function(e){return e.toLowerCase()})},f[u[v+p+"Space"]="setSublimeMark"]=function(e){e.state.sublimeMark&&e.state.sublimeMark.clear(),e.state.sublimeMark=e.setBookmark(e.getCursor())},f[u[v+p+"A"]="selectToSublimeMark"]=function(e){var t=e.state.sublimeMark&&e.state.sublimeMark.find();t&&e.setSelection(e.getCursor(),t)},f[u[v+p+"W"]="deleteToSublimeMark"]=function(t){var n=t.state.sublimeMark&&t.state.sublimeMark.find();if(n){var r=t.getCursor(),i=n;if(e.cmpPos(r,i)>0){var o=i;i=r,r=o}t.state.sublimeKilled=t.getRange(r,i),t.replaceRange("",r,i,"+delete")}},f[u[v+p+"X"]="swapWithSublimeMark"]=function(e){var t=e.state.sublimeMark&&e.state.sublimeMark.find();t&&(e.state.sublimeMark.clear(),e.state.sublimeMark=e.setBookmark(e.getCursor()),e.setCursor(t))},f[u[v+p+"Y"]="sublimeYank"]=function(e){null!=e.state.sublimeKilled&&e.replaceSelection(e.state.sublimeKilled,null,"paste")},u[v+p+"G"]="clearBookmarks",f[u[v+p+"C"]="showInCenter"]=function(e){var t=e.cursorCoords(null,"local");e.scrollTo(null,(t.top+t.bottom)/2-e.getScrollInfo().clientHeight/2)},f[u["Shift-Alt-Up"]="selectLinesUpward"]=function(e){e.operation(function(){for(var t=e.listSelections(),n=0;n<t.length;n++){var r=t[n];r.head.line>e.firstLine()&&e.addSelection(d(r.head.line-1,r.head.ch))}})},f[u["Shift-Alt-Down"]="selectLinesDownward"]=function(e){e.operation(function(){for(var t=e.listSelections(),n=0;n<t.length;n++){var r=t[n];r.head.line<e.lastLine()&&e.addSelection(d(r.head.line+1,r.head.ch))}})},f[u[p+"F3"]="findUnder"]=function(e){c(e,!0)},f[u["Shift-"+p+"F3"]="findUnderPrevious"]=function(e){c(e,!1)},f[u["Alt-F3"]="findAllUnder"]=function(e){var t=s(e);if(t){for(var n=e.getSearchCursor(t.query),r=[],i=-1;n.findNext();)r.push({anchor:n.from(),head:n.to()}),n.from().line<=t.from.line&&n.from().ch<=t.from.ch&&i++;e.setSelections(r,i)}},u["Shift-"+p+"["]="fold",u["Shift-"+p+"]"]="unfold",u[v+p+"0"]=u[v+p+"j"]="unfoldAll",u[p+"I"]="findIncremental",u["Shift-"+p+"I"]="findIncrementalReverse",u[p+"H"]="replace",u.F3="findNext",u["Shift-F3"]="findPrev",e.normalizeKeyMap(u)});
\ No newline at end of file diff --git a/public/vendor/codemirror/compress.sh b/public/vendor/codemirror/compress.sh index 4918c634..a995acb6 100644 --- a/public/vendor/codemirror/compress.sh +++ b/public/vendor/codemirror/compress.sh @@ -2,12 +2,21 @@ uglifyjs --compress --mangle --output codemirror.min.js \ lib/codemirror.js \ addon/mode/overlay.js \ addon/selection/active-line.js \ +addon/search/searchcursor.js \ +addon/search/search.js \ +addon/search/matchesonscrollbar.js \ +addon/scroll/simplescrollbars.js \ +addon/scroll/annotatescrollbar.js \ +addon/dialog/dialog.js \ addon/edit/matchbrackets.js \ addon/edit/closebrackets.js \ addon/edit/matchtags.js \ addon/edit/closetag.js \ addon/edit/continuelist.js \ +addon/comment/comment.js \ +addon/wrap/hardwrap.js \ addon/fold/foldcode.js \ +addon/fold/brace-fold.js \ addon/fold/foldgutter.js \ addon/fold/markdown-fold.js \ addon/fold/xml-fold.js \ @@ -19,4 +28,5 @@ mode/css/css.js \ mode/htmlmixed/htmlmixed.js \ mode/clike/clike.js \ mode/clojure/clojure.js \ -mode/ruby/ruby.js
\ No newline at end of file +mode/ruby/ruby.js \ +keymap/sublime.js
\ No newline at end of file diff --git a/public/vendor/codemirror/keymap/sublime.js b/public/vendor/codemirror/keymap/sublime.js index 441456f5..4f7a6f31 100755 --- a/public/vendor/codemirror/keymap/sublime.js +++ b/public/vendor/codemirror/keymap/sublime.js @@ -258,7 +258,7 @@ var actual = line - offset; if (line == obj.end) head = Pos(actual, cm.getLine(actual).length + 1); if (actual < cm.lastLine()) { - cm.replaceRange(" ", Pos(actual), Pos(actual + 1, /^\s*/.exec(cm.getLine(actual + 1))[0].length)); + cm.replaceRange(" ", Pos(actual), Pos(actual + 1, /^\s*/.exec(cm.getLine(actual + 1))[0].length), "+joinLines"); ++offset; } } @@ -274,9 +274,9 @@ for (var i = 0; i < rangeCount; i++) { var range = cm.listSelections()[i]; if (range.empty()) - cm.replaceRange(cm.getLine(range.head.line) + "\n", Pos(range.head.line, 0)); + cm.replaceRange(cm.getLine(range.head.line) + "\n", Pos(range.head.line, 0), null, "+duplicateLine"); else - cm.replaceRange(cm.getRange(range.from(), range.to()), range.from()); + cm.replaceRange(cm.getRange(range.from(), range.to()), range.from(), null, "+duplicateLine"); } cm.scrollIntoView(); }); @@ -311,7 +311,7 @@ if (au != bu) { a = au; b = bu; } return a < b ? -1 : a == b ? 0 : 1; }); - cm.replaceRange(lines, start, end); + cm.replaceRange(lines, start, end, "+sortLines"); if (selected) ranges.push({anchor: start, head: end}); } if (selected) cm.setSelections(ranges, 0); @@ -402,7 +402,7 @@ if (at && CodeMirror.cmpPos(range.head, at) > 0) continue; var word = wordAt(cm, range.head); at = word.from; - cm.replaceRange(mod(word.word), word.from, word.to); + cm.replaceRange(mod(word.word), word.from, word.to, "case"); } }); } @@ -452,7 +452,7 @@ var from = cm.getCursor(), to = found; if (CodeMirror.cmpPos(from, to) > 0) { var tmp = to; to = from; from = tmp; } cm.state.sublimeKilled = cm.getRange(from, to); - cm.replaceRange("", from, to); + cm.replaceRange("", from, to, "+delete"); } }; cmds[map[cK + ctrl + "X"] = "swapWithSublimeMark"] = function(cm) { diff --git a/public/vendor/gist-embed.js b/public/vendor/gist-embed.js index 34a9c3b0..a1e923b7 100644 --- a/public/vendor/gist-embed.js +++ b/public/vendor/gist-embed.js @@ -25,7 +25,7 @@ return lineNumbers; } - $.fn.gist = function() { + $.fn.gist = function(callback) { return this.each(function() { var $elem = $(this), id, @@ -165,6 +165,10 @@ }, error: function(jqXHR, textStatus) { $elem.html('Failed loading gist ' + url + ': ' + textStatus); + }, + complete: function() { + if(callback) + callback(); } }); diff --git a/public/vendor/inlineAttachment/codemirror.inline-attachment.js b/public/vendor/inlineAttachment/codemirror.inline-attachment.js new file mode 100755 index 00000000..7816d1c8 --- /dev/null +++ b/public/vendor/inlineAttachment/codemirror.inline-attachment.js @@ -0,0 +1,95 @@ +/*jslint newcap: true */ +/*global inlineAttachment: false */ +/** + * CodeMirror version for inlineAttachment + * + * Call inlineAttachment.attach(editor) to attach to a codemirror instance + */ +(function() { + 'use strict'; + + var codeMirrorEditor = function(instance) { + + if (!instance.getWrapperElement) { + throw "Invalid CodeMirror object given"; + } + + this.codeMirror = instance; + }; + + codeMirrorEditor.prototype.getValue = function() { + return this.codeMirror.getValue(); + }; + + codeMirrorEditor.prototype.insertValue = function(val) { + this.codeMirror.replaceSelection(val); + }; + + codeMirrorEditor.prototype.setValue = function(val) { + var cursor = this.codeMirror.getCursor(); + this.codeMirror.setValue(val); + this.codeMirror.setCursor(cursor); + }; + + codeMirrorEditor.prototype.replaceRange = function(val) { + this.codeMirror.replaceRange(val.replacement, val.from, val.to, "+input"); + }; + + /** + * Attach InlineAttachment to CodeMirror + * + * @param {CodeMirror} codeMirror + */ + codeMirrorEditor.attach = function(codeMirror, options) { + + options = options || {}; + + var editor = new codeMirrorEditor(codeMirror), + inlineattach = new inlineAttachment(options, editor), + el = codeMirror.getWrapperElement(); + + el.addEventListener('paste', function(e) { + inlineattach.onPaste(e); + }, false); + + codeMirror.setOption('onDragEvent', function(data, e) { + if (e.type === "drop") { + e.stopPropagation(); + e.preventDefault(); + return inlineattach.onDrop(e); + } + }); + }; + + inlineAttachment.editors.codemirror3 = codeMirrorEditor; + + var codeMirrorEditor4 = function(instance) { + codeMirrorEditor.call(this, instance); + }; + + codeMirrorEditor4.attach = function(codeMirror, options) { + + options = options || {}; + + var editor = new codeMirrorEditor(codeMirror), + inlineattach = new inlineAttachment(options, editor), + el = codeMirror.getWrapperElement(); + + el.addEventListener('paste', function(e) { + inlineattach.onPaste(e); + }, false); + + codeMirror.on('drop', function(data, e) { + if (inlineattach.onDrop(e)) { + e.stopPropagation(); + e.preventDefault(); + return true; + } else { + return false; + } + }); + }; + + inlineAttachment.editors.codemirror4 = codeMirrorEditor4; + +})();
\ No newline at end of file diff --git a/public/vendor/inlineAttachment/inline-attachment.js b/public/vendor/inlineAttachment/inline-attachment.js new file mode 100755 index 00000000..9353ebd8 --- /dev/null +++ b/public/vendor/inlineAttachment/inline-attachment.js @@ -0,0 +1,435 @@ +/*jslint newcap: true */ +/*global XMLHttpRequest: false, FormData: false */ +/* + * Inline Text Attachment + * + * Author: Roy van Kaathoven + * Contact: ik@royvankaathoven.nl + */ +(function(document, window) { + 'use strict'; + + var inlineAttachment = function(options, instance) { + this.settings = inlineAttachment.util.merge(options, inlineAttachment.defaults); + this.editor = instance; + this.filenameTag = '{filename}'; + this.lastValue = null; + }; + + /** + * Will holds the available editors + * + * @type {Object} + */ + inlineAttachment.editors = {}; + + /** + * Utility functions + */ + inlineAttachment.util = { + + /** + * Simple function to merge the given objects + * + * @param {Object[]} object Multiple object parameters + * @returns {Object} + */ + merge: function() { + var result = {}; + for (var i = arguments.length - 1; i >= 0; i--) { + var obj = arguments[i]; + for (var k in obj) { + if (obj.hasOwnProperty(k)) { + result[k] = obj[k]; + } + } + } + return result; + }, + + /** + * Append a line of text at the bottom, ensuring there aren't unnecessary newlines + * + * @param {String} appended Current content + * @param {String} previous Value which should be appended after the current content + */ + appendInItsOwnLine: function(previous, appended) { + return (previous + "\n\n[[D]]" + appended) + .replace(/(\n{2,})\[\[D\]\]/, "\n\n") + .replace(/^(\n*)/, ""); + }, + + /** + * Inserts the given value at the current cursor position of the textarea element + * + * @param {HtmlElement} el + * @param {String} value Text which will be inserted at the cursor position + */ + insertTextAtCursor: function(el, text) { + var scrollPos = el.scrollTop, + strPos = 0, + browser = false, + range; + + if ((el.selectionStart || el.selectionStart === '0')) { + browser = "ff"; + } else if (document.selection) { + browser = "ie"; + } + + if (browser === "ie") { + el.focus(); + range = document.selection.createRange(); + range.moveStart('character', -el.value.length); + strPos = range.text.length; + } else if (browser === "ff") { + strPos = el.selectionStart; + } + + var front = (el.value).substring(0, strPos); + var back = (el.value).substring(strPos, el.value.length); + el.value = front + text + back; + strPos = strPos + text.length; + if (browser === "ie") { + el.focus(); + range = document.selection.createRange(); + range.moveStart('character', -el.value.length); + range.moveStart('character', strPos); + range.moveEnd('character', 0); + range.select(); + } else if (browser === "ff") { + el.selectionStart = strPos; + el.selectionEnd = strPos; + el.focus(); + } + el.scrollTop = scrollPos; + } + }; + + /** + * Default configuration options + * + * @type {Object} + */ + inlineAttachment.defaults = { + /** + * URL where the file will be send + */ + uploadUrl: 'uploadimage', + + /** + * Which method will be used to send the file to the upload URL + */ + uploadMethod: 'POST', + + /** + * Name in which the file will be placed + */ + uploadFieldName: 'image', + + /** + * Extension which will be used when a file extension could not + * be detected + */ + defualtExtension: 'png', + + /** + * JSON field which refers to the uploaded file URL + */ + jsonFieldName: 'link', + + /** + * Allowed MIME types + */ + allowedTypes: [ + 'image/jpeg', + 'image/png', + 'image/jpg', + 'image/gif' + ], + + /** + * Text which will be inserted when dropping or pasting a file. + * Acts as a placeholder which will be replaced when the file is done with uploading + */ + progressText: '![Uploading file...{filename}]()', + + /** + * When a file has successfully been uploaded the progressText + * will be replaced by the urlText, the {filename} tag will be replaced + * by the filename that has been returned by the server + */ + urlText: "![]({filename})", + + /** + * Text which will be used when uploading has failed + */ + errorText: "Error uploading file", + + /** + * Extra parameters which will be send when uploading a file + */ + extraParams: {}, + + /** + * Extra headers which will be send when uploading a file + */ + extraHeaders: {}, + + /** + * Before the file is send + */ + beforeFileUpload: function() { + return true; + }, + + /** + * Triggers when a file is dropped or pasted + */ + onFileReceived: function() {}, + + /** + * Custom upload handler + * + * @return {Boolean} when false is returned it will prevent default upload behavior + */ + onFileUploadResponse: function() { + return true; + }, + + /** + * Custom error handler. Runs after removing the placeholder text and before the alert(). + * Return false from this function to prevent the alert dialog. + * + * @return {Boolean} when false is returned it will prevent default error behavior + */ + onFileUploadError: function() { + return true; + }, + + /** + * When a file has succesfully been uploaded + */ + onFileUploaded: function() {} + }; + + /** + * Uploads the blob + * + * @param {Blob} file blob data received from event.dataTransfer object + * @return {XMLHttpRequest} request object which sends the file + */ + inlineAttachment.prototype.uploadFile = function(file, id) { + var me = this, + formData = new FormData(), + xhr = new XMLHttpRequest(), + id = id, + settings = this.settings, + extension = settings.defualtExtension; + + if (typeof settings.setupFormData === 'function') { + settings.setupFormData(formData, file); + } + + // Attach the file. If coming from clipboard, add a default filename (only works in Chrome for now) + // http://stackoverflow.com/questions/6664967/how-to-give-a-blob-uploaded-as-formdata-a-file-name + if (file.name) { + var fileNameMatches = file.name.match(/\.(.+)$/); + if (fileNameMatches) { + extension = fileNameMatches[1]; + } + } + + var remoteFilename = "image-" + Date.now() + "." + extension; + if (typeof settings.remoteFilename === 'function') { + remoteFilename = settings.remoteFilename(file); + } + + formData.append(settings.uploadFieldName, file, remoteFilename); + + // Append the extra parameters to the formdata + if (typeof settings.extraParams === "object") { + for (var key in settings.extraParams) { + if (settings.extraParams.hasOwnProperty(key)) { + formData.append(key, settings.extraParams[key]); + } + } + } + + xhr.open('POST', settings.uploadUrl); + + // Add any available extra headers + if (typeof settings.extraHeaders === "object") { + for (var header in settings.extraHeaders) { + if (settings.extraHeaders.hasOwnProperty(header)) { + xhr.setRequestHeader(header, settings.extraHeaders[header]); + } + } + } + + xhr.onload = function() { + // If HTTP status is OK or Created + if (xhr.status === 200 || xhr.status === 201) { + me.onFileUploadResponse(xhr, id); + } else { + me.onFileUploadError(xhr, id); + } + }; + if (settings.beforeFileUpload(xhr) !== false) { + xhr.send(formData); + } + return xhr; + }; + + /** + * Returns if the given file is allowed to handle + * + * @param {File} clipboard data file + */ + inlineAttachment.prototype.isFileAllowed = function(file) { + if (this.settings.allowedTypes.indexOf('*') === 0){ + return true; + } else { + return this.settings.allowedTypes.indexOf(file.type) >= 0; + } + }; + + /** + * Handles upload response + * + * @param {XMLHttpRequest} xhr + * @return {Void} + */ + inlineAttachment.prototype.onFileUploadResponse = function(xhr, id) { + if (this.settings.onFileUploadResponse.call(this, xhr) !== false) { + var result = JSON.parse(xhr.responseText), + filename = result[this.settings.jsonFieldName]; + + if (result && filename) { + var replacements = []; + var string = this.settings.progressText.replace(this.filenameTag, id); + var lines = this.editor.getValue().split('\n'); + var newValue = this.settings.urlText.replace(this.filenameTag, filename); + for(var i = 0; i < lines.length; i++) { + var ch = lines[i].indexOf(string); + if(ch != -1) + replacements.push({replacement:newValue, from:{line:i, ch:ch}, to:{line:i, ch:ch + string.length}}); + } + for(var i = 0; i < replacements.length; i++) + this.editor.replaceRange(replacements[i]); + } + } + }; + + + /** + * Called when a file has failed to upload + * + * @param {XMLHttpRequest} xhr + * @return {Void} + */ + inlineAttachment.prototype.onFileUploadError = function(xhr, id) { + if (this.settings.onFileUploadError.call(this, xhr) !== false) { + var replacements = []; + var string = this.settings.progressText.replace(this.filenameTag, id); + var lines = this.editor.getValue().split('\n'); + for(var i = 0; i < lines.length; i++) { + var ch = lines[i].indexOf(this.lastValue); + if(ch != -1) + replacements.push({replacement:"", from:{line:i, ch:ch}, to:{line:i, ch:ch + string.length}}); + } + for(var i = 0; i < replacements.length; i++) + this.editor.replaceRange(replacements[i]); + } + }; + + /** + * Called when a file has been inserted, either by drop or paste + * + * @param {File} file + * @return {Void} + */ + inlineAttachment.prototype.onFileInserted = function(file, id) { + if (this.settings.onFileReceived.call(this, file) !== false) { + this.lastValue = this.settings.progressText.replace(this.filenameTag, id); + this.editor.insertValue(this.lastValue); + } + }; + + + /** + * Called when a paste event occured + * @param {Event} e + * @return {Boolean} if the event was handled + */ + inlineAttachment.prototype.onPaste = function(e) { + var result = false, + clipboardData = e.clipboardData, + items; + + if (typeof clipboardData === "object") { + items = clipboardData.items || clipboardData.files || []; + + for (var i = 0; i < items.length; i++) { + var item = items[i]; + if (this.isFileAllowed(item)) { + result = true; + var id = ID(); + this.onFileInserted(item.getAsFile(), id); + this.uploadFile(item.getAsFile(), id); + } + } + } + + if (result) { e.preventDefault(); } + + return result; + }; + + /** + * Called when a drop event occures + * @param {Event} e + * @return {Boolean} if the event was handled + */ + inlineAttachment.prototype.onDrop = function(e) { + var result = false; + for (var i = 0; i < e.dataTransfer.files.length; i++) { + var file = e.dataTransfer.files[i]; + if (this.isFileAllowed(file)) { + result = true; + var id = ID(); + this.onFileInserted(file, id); + this.uploadFile(file, id); + } + } + + return result; + }; + + window.inlineAttachment = inlineAttachment; + +})(document, window); + +// Generate unique IDs for use as pseudo-private/protected names. +// Similar in concept to +// <http://wiki.ecmascript.org/doku.php?id=strawman:names>. +// +// The goals of this function are twofold: +// +// * Provide a way to generate a string guaranteed to be unique when compared +// to other strings generated by this function. +// * Make the string complex enough that it is highly unlikely to be +// accidentally duplicated by hand (this is key if you're using `ID` +// as a private/protected name on an object). +// +// Use: +// +// var privateName = ID(); +// var o = { 'public': 'foo' }; +// o[privateName] = 'bar'; +var ID = function () { + // Math.random should be unique because of its seeding algorithm. + // Convert it to base 36 (numbers + letters), and grab the first 9 characters + // after the decimal. + return '_' + Math.random().toString(36).substr(2, 9); +};
\ No newline at end of file diff --git a/public/vendor/jquery.cookie-1.4.1.min.js b/public/vendor/jquery.cookie-1.4.1.min.js deleted file mode 100644 index c0f19d8a..00000000 --- a/public/vendor/jquery.cookie-1.4.1.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! jquery.cookie v1.4.1 | MIT */ -!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?a(require("jquery")):a(jQuery)}(function(a){function b(a){return h.raw?a:encodeURIComponent(a)}function c(a){return h.raw?a:decodeURIComponent(a)}function d(a){return b(h.json?JSON.stringify(a):String(a))}function e(a){0===a.indexOf('"')&&(a=a.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return a=decodeURIComponent(a.replace(g," ")),h.json?JSON.parse(a):a}catch(b){}}function f(b,c){var d=h.raw?b:e(b);return a.isFunction(c)?c(d):d}var g=/\+/g,h=a.cookie=function(e,g,i){if(void 0!==g&&!a.isFunction(g)){if(i=a.extend({},h.defaults,i),"number"==typeof i.expires){var j=i.expires,k=i.expires=new Date;k.setTime(+k+864e5*j)}return document.cookie=[b(e),"=",d(g),i.expires?"; expires="+i.expires.toUTCString():"",i.path?"; path="+i.path:"",i.domain?"; domain="+i.domain:"",i.secure?"; secure":""].join("")}for(var l=e?void 0:{},m=document.cookie?document.cookie.split("; "):[],n=0,o=m.length;o>n;n++){var p=m[n].split("="),q=c(p.shift()),r=p.join("=");if(e&&e===q){l=f(r,g);break}e||void 0===(r=f(r))||(l[q]=r)}return l};h.defaults={},a.removeCookie=function(b,c){return void 0===a.cookie(b)?!1:(a.cookie(b,"",a.extend({},c,{expires:-1})),!a.cookie(b))}});
\ No newline at end of file diff --git a/public/vendor/js.cookie.js b/public/vendor/js.cookie.js new file mode 100755 index 00000000..116e62d8 --- /dev/null +++ b/public/vendor/js.cookie.js @@ -0,0 +1,137 @@ +/*! + * JavaScript Cookie v2.0.0-pre + * https://github.com/js-cookie/js-cookie + * + * Copyright 2006, 2015 Klaus Hartl + * Released under the MIT license + */ +(function (factory) { + if (typeof define === 'function' && define.amd) { + define(factory); + } else if (typeof exports === 'object') { + module.exports = factory(); + } else { + var _OldCookies = window.Cookies; + var api = window.Cookies = factory(window.jQuery); + api.noConflict = function () { + window.Cookies = _OldCookies; + return api; + }; + } +}(function () { + function extend () { + var i = 0; + var result = {}; + for (; i < arguments.length; i++) { + var attributes = arguments[ i ]; + for (var key in attributes) { + result[key] = attributes[key]; + } + } + return result; + } + + function init (converter) { + function api (key, value, attributes) { + var result; + + // Write + + if (arguments.length > 1) { + attributes = extend({ + path: '/' + }, api.defaults, attributes); + + if (typeof attributes.expires === 'number') { + var expires = new Date(); + expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5); + attributes.expires = expires; + } + + try { + result = JSON.stringify(value); + if (/^[\{\[]/.test(result)) { + value = result; + } + } catch (e) {} + + value = encodeURIComponent(String(value)); + value = value.replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent); + + key = encodeURIComponent(String(key)); + key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent); + key = key.replace(/[\(\)]/g, escape); + + return (document.cookie = [ + key, '=', value, + attributes.expires && '; expires=' + attributes.expires.toUTCString(), // use expires attribute, max-age is not supported by IE + attributes.path && '; path=' + attributes.path, + attributes.domain && '; domain=' + attributes.domain, + attributes.secure && '; secure' + ].join('')); + } + + // Read + + if (!key) { + result = {}; + } + + // To prevent the for loop in the first place assign an empty array + // in case there are no cookies at all. Also prevents odd result when + // calling "get()" + var cookies = document.cookie ? document.cookie.split('; ') : []; + var rdecode = /(%[0-9A-Z]{2})+/g; + var i = 0; + + for (; i < cookies.length; i++) { + var parts = cookies[i].split('='); + var name = parts[0].replace(rdecode, decodeURIComponent); + var cookie = parts.slice(1).join('='); + + if (cookie.charAt(0) === '"') { + cookie = cookie.slice(1, -1); + } + + cookie = converter && converter(cookie, name) || cookie.replace(rdecode, decodeURIComponent); + + if (this.json) { + try { + cookie = JSON.parse(cookie); + } catch (e) {} + } + + if (key === name) { + result = cookie; + break; + } + + if (!key) { + result[name] = cookie; + } + } + + return result; + } + + api.get = api.set = api; + api.getJSON = function () { + return api.apply({ + json: true + }, [].slice.call(arguments)); + }; + api.defaults = {}; + + api.remove = function (key, attributes) { + api(key, '', extend(attributes, { + expires: -1 + })); + }; + + api.withConverter = init; + + return api; + } + + return init(); +})); diff --git a/public/vendor/select2/css/select2.css b/public/vendor/select2/css/select2.css deleted file mode 100755 index c69b7273..00000000 --- a/public/vendor/select2/css/select2.css +++ /dev/null @@ -1,421 +0,0 @@ -.select2-container { - box-sizing: border-box; - display: inline-block; - margin: 0; - position: relative; - vertical-align: middle; } - .select2-container .select2-selection--single { - box-sizing: border-box; - cursor: pointer; - display: block; - height: 28px; - user-select: none; - -webkit-user-select: none; } - .select2-container .select2-selection--single .select2-selection__rendered { - display: block; - padding-left: 8px; - padding-right: 20px; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; } - .select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered { - padding-right: 8px; - padding-left: 20px; } - .select2-container .select2-selection--multiple { - box-sizing: border-box; - cursor: pointer; - display: block; - min-height: 32px; - user-select: none; - -webkit-user-select: none; } - .select2-container .select2-selection--multiple .select2-selection__rendered { - display: inline-block; - overflow: hidden; - padding-left: 8px; - text-overflow: ellipsis; - white-space: nowrap; } - .select2-container .select2-search--inline { - float: left; } - .select2-container .select2-search--inline .select2-search__field { - box-sizing: border-box; - border: none; - font-size: 100%; - margin-top: 5px; } - .select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button { - -webkit-appearance: none; } - -.select2-dropdown { - background-color: white; - border: 1px solid #aaa; - border-radius: 4px; - box-sizing: border-box; - display: block; - position: absolute; - left: -100000px; - width: 100%; - z-index: 1051; } - -.select2-results { - display: block; } - -.select2-results__options { - list-style: none; - margin: 0; - padding: 0; } - -.select2-results__option { - padding: 6px; - user-select: none; - -webkit-user-select: none; } - .select2-results__option[aria-selected] { - cursor: pointer; } - -.select2-container--open .select2-dropdown { - left: 0; } - -.select2-container--open .select2-dropdown--above { - border-bottom: none; - border-bottom-left-radius: 0; - border-bottom-right-radius: 0; } - -.select2-container--open .select2-dropdown--below { - border-top: none; - border-top-left-radius: 0; - border-top-right-radius: 0; } - -.select2-search--dropdown { - display: block; - padding: 4px; } - .select2-search--dropdown .select2-search__field { - padding: 4px; - width: 100%; - box-sizing: border-box; } - .select2-search--dropdown .select2-search__field::-webkit-search-cancel-button { - -webkit-appearance: none; } - .select2-search--dropdown.select2-search--hide { - display: none; } - -.select2-close-mask { - border: 0; - margin: 0; - padding: 0; - display: block; - position: fixed; - left: 0; - top: 0; - min-height: 100%; - min-width: 100%; - height: auto; - width: auto; - opacity: 0; - z-index: 99; - background-color: #fff; - filter: alpha(opacity=0); } - -.select2-container--default .select2-selection--single { - background-color: #fff; - border: 1px solid #aaa; - border-radius: 4px; } - .select2-container--default .select2-selection--single .select2-selection__rendered { - color: #444; - line-height: 28px; } - .select2-container--default .select2-selection--single .select2-selection__clear { - cursor: pointer; - float: right; - font-weight: bold; } - .select2-container--default .select2-selection--single .select2-selection__placeholder { - color: #999; } - .select2-container--default .select2-selection--single .select2-selection__arrow { - height: 26px; - position: absolute; - top: 1px; - right: 1px; - width: 20px; } - .select2-container--default .select2-selection--single .select2-selection__arrow b { - border-color: #888 transparent transparent transparent; - border-style: solid; - border-width: 5px 4px 0 4px; - height: 0; - left: 50%; - margin-left: -4px; - margin-top: -2px; - position: absolute; - top: 50%; - width: 0; } -.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear { - float: left; } -.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow { - left: 1px; - right: auto; } -.select2-container--default.select2-container--disabled .select2-selection--single { - background-color: #eee; - cursor: default; } - .select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear { - display: none; } -.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b { - border-color: transparent transparent #888 transparent; - border-width: 0 4px 5px 4px; } -.select2-container--default .select2-selection--multiple { - background-color: white; - border: 1px solid #aaa; - border-radius: 4px; - cursor: text; } - .select2-container--default .select2-selection--multiple .select2-selection__rendered { - box-sizing: border-box; - list-style: none; - margin: 0; - padding: 0 5px; - width: 100%; } - .select2-container--default .select2-selection--multiple .select2-selection__placeholder { - color: #999; - margin-top: 5px; - float: left; } - .select2-container--default .select2-selection--multiple .select2-selection__clear { - cursor: pointer; - float: right; - font-weight: bold; - margin-top: 5px; - margin-right: 10px; } - .select2-container--default .select2-selection--multiple .select2-selection__choice { - background-color: #e4e4e4; - border: 1px solid #aaa; - border-radius: 4px; - cursor: default; - float: left; - margin-right: 5px; - margin-top: 5px; - padding: 0 5px; } - .select2-container--default .select2-selection--multiple .select2-selection__choice__remove { - color: #999; - cursor: pointer; - display: inline-block; - font-weight: bold; - margin-right: 2px; } - .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover { - color: #333; } -.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder { - float: right; } -.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice { - margin-left: 5px; - margin-right: auto; } -.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove { - margin-left: 2px; - margin-right: auto; } -.select2-container--default.select2-container--focus .select2-selection--multiple { - border: solid black 1px; - outline: 0; } -.select2-container--default.select2-container--disabled .select2-selection--multiple { - background-color: #eee; - cursor: default; } -.select2-container--default.select2-container--disabled .select2-selection__choice__remove { - display: none; } -.select2-container--default.select2-container--open.select2-container--above .select2-selection--single, .select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple { - border-top-left-radius: 0; - border-top-right-radius: 0; } -.select2-container--default.select2-container--open.select2-container--below .select2-selection--single, .select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple { - border-bottom-left-radius: 0; - border-bottom-right-radius: 0; } -.select2-container--default .select2-search--dropdown .select2-search__field { - border: 1px solid #aaa; } -.select2-container--default .select2-search--inline .select2-search__field { - background: transparent; - border: none; - outline: 0; } -.select2-container--default .select2-results > .select2-results__options { - max-height: 200px; - overflow-y: auto; } -.select2-container--default .select2-results__option[role=group] { - padding: 0; } -.select2-container--default .select2-results__option[aria-disabled=true] { - color: #999; } -.select2-container--default .select2-results__option[aria-selected=true] { - background-color: #ddd; } -.select2-container--default .select2-results__option .select2-results__option { - padding-left: 1em; } - .select2-container--default .select2-results__option .select2-results__option .select2-results__group { - padding-left: 0; } - .select2-container--default .select2-results__option .select2-results__option .select2-results__option { - margin-left: -1em; - padding-left: 2em; } - .select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option { - margin-left: -2em; - padding-left: 3em; } - .select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option { - margin-left: -3em; - padding-left: 4em; } - .select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option { - margin-left: -4em; - padding-left: 5em; } - .select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option { - margin-left: -5em; - padding-left: 6em; } -.select2-container--default .select2-results__option--highlighted[aria-selected] { - background-color: #5897fb; - color: white; } -.select2-container--default .select2-results__group { - cursor: default; - display: block; - padding: 6px; } - -.select2-container--classic .select2-selection--single { - background-color: #f6f6f6; - border: 1px solid #aaa; - border-radius: 4px; - outline: 0; - background-image: -webkit-linear-gradient(top, #ffffff 50%, #eeeeee 100%); - background-image: -o-linear-gradient(top, #ffffff 50%, #eeeeee 100%); - background-image: linear-gradient(to bottom, #ffffff 50%, #eeeeee 100%); - background-repeat: repeat-x; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0); } - .select2-container--classic .select2-selection--single:focus { - border: 1px solid #5897fb; } - .select2-container--classic .select2-selection--single .select2-selection__rendered { - color: #444; - line-height: 28px; } - .select2-container--classic .select2-selection--single .select2-selection__clear { - cursor: pointer; - float: right; - font-weight: bold; - margin-right: 10px; } - .select2-container--classic .select2-selection--single .select2-selection__placeholder { - color: #999; } - .select2-container--classic .select2-selection--single .select2-selection__arrow { - background-color: #ddd; - border: none; - border-left: 1px solid #aaa; - border-top-right-radius: 4px; - border-bottom-right-radius: 4px; - height: 26px; - position: absolute; - top: 1px; - right: 1px; - width: 20px; - background-image: -webkit-linear-gradient(top, #eeeeee 50%, #cccccc 100%); - background-image: -o-linear-gradient(top, #eeeeee 50%, #cccccc 100%); - background-image: linear-gradient(to bottom, #eeeeee 50%, #cccccc 100%); - background-repeat: repeat-x; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#cccccc', GradientType=0); } - .select2-container--classic .select2-selection--single .select2-selection__arrow b { - border-color: #888 transparent transparent transparent; - border-style: solid; - border-width: 5px 4px 0 4px; - height: 0; - left: 50%; - margin-left: -4px; - margin-top: -2px; - position: absolute; - top: 50%; - width: 0; } -.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear { - float: left; } -.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow { - border: none; - border-right: 1px solid #aaa; - border-radius: 0; - border-top-left-radius: 4px; - border-bottom-left-radius: 4px; - left: 1px; - right: auto; } -.select2-container--classic.select2-container--open .select2-selection--single { - border: 1px solid #5897fb; } - .select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow { - background: transparent; - border: none; } - .select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b { - border-color: transparent transparent #888 transparent; - border-width: 0 4px 5px 4px; } -.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single { - border-top: none; - border-top-left-radius: 0; - border-top-right-radius: 0; - background-image: -webkit-linear-gradient(top, #ffffff 0%, #eeeeee 50%); - background-image: -o-linear-gradient(top, #ffffff 0%, #eeeeee 50%); - background-image: linear-gradient(to bottom, #ffffff 0%, #eeeeee 50%); - background-repeat: repeat-x; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0); } -.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single { - border-bottom: none; - border-bottom-left-radius: 0; - border-bottom-right-radius: 0; - background-image: -webkit-linear-gradient(top, #eeeeee 50%, #ffffff 100%); - background-image: -o-linear-gradient(top, #eeeeee 50%, #ffffff 100%); - background-image: linear-gradient(to bottom, #eeeeee 50%, #ffffff 100%); - background-repeat: repeat-x; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#ffffff', GradientType=0); } -.select2-container--classic .select2-selection--multiple { - background-color: white; - border: 1px solid #aaa; - border-radius: 4px; - cursor: text; - outline: 0; } - .select2-container--classic .select2-selection--multiple:focus { - border: 1px solid #5897fb; } - .select2-container--classic .select2-selection--multiple .select2-selection__rendered { - list-style: none; - margin: 0; - padding: 0 5px; } - .select2-container--classic .select2-selection--multiple .select2-selection__clear { - display: none; } - .select2-container--classic .select2-selection--multiple .select2-selection__choice { - background-color: #e4e4e4; - border: 1px solid #aaa; - border-radius: 4px; - cursor: default; - float: left; - margin-right: 5px; - margin-top: 5px; - padding: 0 5px; } - .select2-container--classic .select2-selection--multiple .select2-selection__choice__remove { - color: #888; - cursor: pointer; - display: inline-block; - font-weight: bold; - margin-right: 2px; } - .select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover { - color: #555; } -.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice { - float: right; } -.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice { - margin-left: 5px; - margin-right: auto; } -.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove { - margin-left: 2px; - margin-right: auto; } -.select2-container--classic.select2-container--open .select2-selection--multiple { - border: 1px solid #5897fb; } -.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple { - border-top: none; - border-top-left-radius: 0; - border-top-right-radius: 0; } -.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple { - border-bottom: none; - border-bottom-left-radius: 0; - border-bottom-right-radius: 0; } -.select2-container--classic .select2-search--dropdown .select2-search__field { - border: 1px solid #aaa; - outline: 0; } -.select2-container--classic .select2-search--inline .select2-search__field { - outline: 0; } -.select2-container--classic .select2-dropdown { - background-color: white; - border: 1px solid transparent; } -.select2-container--classic .select2-dropdown--above { - border-bottom: none; } -.select2-container--classic .select2-dropdown--below { - border-top: none; } -.select2-container--classic .select2-results > .select2-results__options { - max-height: 200px; - overflow-y: auto; } -.select2-container--classic .select2-results__option[role=group] { - padding: 0; } -.select2-container--classic .select2-results__option[aria-disabled=true] { - color: grey; } -.select2-container--classic .select2-results__option--highlighted[aria-selected] { - background-color: #3875d7; - color: white; } -.select2-container--classic .select2-results__group { - cursor: default; - display: block; - padding: 6px; } -.select2-container--classic.select2-container--open .select2-dropdown { - border-color: #5897fb; } diff --git a/public/vendor/select2/css/select2.min.css b/public/vendor/select2/css/select2.min.css deleted file mode 100755 index 4d0256ef..00000000 --- a/public/vendor/select2/css/select2.min.css +++ /dev/null @@ -1 +0,0 @@ -.select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle;}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;user-select:none;-webkit-user-select:none;}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px;}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none;-webkit-user-select:none;}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap;}.select2-container .select2-search--inline{float:left;}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none;}.select2-dropdown{background-color:white;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051;}.select2-results{display:block;}.select2-results__options{list-style:none;margin:0;padding:0;}.select2-results__option{padding:6px;user-select:none;-webkit-user-select:none;}.select2-results__option[aria-selected]{cursor:pointer;}.select2-container--open .select2-dropdown{left:0;}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0;}.select2-search--dropdown{display:block;padding:4px;}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box;}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none;}.select2-search--dropdown.select2-search--hide{display:none;}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0);}.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #aaa;border-radius:4px;}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px;}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999;}.select2-container--default .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px;}.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0;}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left;}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow{left:1px;right:auto;}.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default;}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none;}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px;}.select2-container--default .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;}.select2-container--default .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%;}.select2-container--default .select2-selection--multiple .select2-selection__placeholder{color:#999;margin-top:5px;float:left;}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-top:5px;margin-right:10px;}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px;}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px;}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#333;}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder{float:right;}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto;}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto;}.select2-container--default.select2-container--focus .select2-selection--multiple{border:solid black 1px;outline:0;}.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default;}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none;}.select2-container--default.select2-container--open.select2-container--above .select2-selection--single,.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple{border-top-left-radius:0;border-top-right-radius:0;}.select2-container--default.select2-container--open.select2-container--below .select2-selection--single,.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom-left-radius:0;border-bottom-right-radius:0;}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #aaa;}.select2-container--default .select2-search--inline .select2-search__field{background:transparent;border:none;outline:0;}.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto;}.select2-container--default .select2-results__option[role=group]{padding:0;}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999;}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd;}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em;}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0;}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em;}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em;}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em;}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em;}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em;}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb;color:white;}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px;}.select2-container--classic .select2-selection--single{background-color:#f6f6f6;border:1px solid #aaa;border-radius:4px;outline:0;background-image:-webkit-linear-gradient(top, #ffffff 50%, #eeeeee 100%);background-image:-o-linear-gradient(top, #ffffff 50%, #eeeeee 100%);background-image:linear-gradient(to bottom, #ffffff 50%, #eeeeee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0);}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb;}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px;}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-right:10px;}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999;}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:-webkit-linear-gradient(top, #eeeeee 50%, #cccccc 100%);background-image:-o-linear-gradient(top, #eeeeee 50%, #cccccc 100%);background-image:linear-gradient(to bottom, #eeeeee 50%, #cccccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#cccccc', GradientType=0);}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0;}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left;}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #aaa;border-radius:0;border-top-left-radius:4px;border-bottom-left-radius:4px;left:1px;right:auto;}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb;}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:transparent;border:none;}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px;}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:-webkit-linear-gradient(top, #ffffff 0%, #eeeeee 50%);background-image:-o-linear-gradient(top, #ffffff 0%, #eeeeee 50%);background-image:linear-gradient(to bottom, #ffffff 0%, #eeeeee 50%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0);}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:-webkit-linear-gradient(top, #eeeeee 50%, #ffffff 100%);background-image:-o-linear-gradient(top, #eeeeee 50%, #ffffff 100%);background-image:linear-gradient(to bottom, #eeeeee 50%, #ffffff 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#ffffff', GradientType=0);}.select2-container--classic .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0;}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb;}.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px;}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none;}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px;}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px;}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555;}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{float:right;}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto;}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto;}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb;}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0;}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0;}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;}.select2-container--classic .select2-dropdown{background-color:white;border:1px solid transparent;}.select2-container--classic .select2-dropdown--above{border-bottom:none;}.select2-container--classic .select2-dropdown--below{border-top:none;}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto;}.select2-container--classic .select2-results__option[role=group]{padding:0;}.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey;}.select2-container--classic .select2-results__option--highlighted[aria-selected]{background-color:#3875d7;color:white;}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px;}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb;}
\ No newline at end of file diff --git a/public/vendor/select2/js/i18n/az.js b/public/vendor/select2/js/i18n/az.js deleted file mode 100755 index b861d8ae..00000000 --- a/public/vendor/select2/js/i18n/az.js +++ /dev/null @@ -1 +0,0 @@ -(function(){if(window.define)var e=window.define;if(window.require)var t=window.require;if(window.jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd.define,t=jQuery.fn.select2.amd.require;e("select2/i18n/az",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum;return t+" simvol silin"},inputTooShort:function(e){var t=e.minimum-e.input.length;return t+" simvol daxil edin"},loadingMore:function(){return"Daha çox nəticə yüklənir…"},maximumSelected:function(e){return"Sadəcə "+e.maximum+" element seçə bilərsiniz"},noResults:function(){return"Nəticə tapılmadı"},searching:function(){return"Axtarılır…"}}}),t("jquery.select2"),jQuery.fn.select2.amd={define:e,require:t}})();
\ No newline at end of file diff --git a/public/vendor/select2/js/i18n/bg.js b/public/vendor/select2/js/i18n/bg.js deleted file mode 100755 index 586200d8..00000000 --- a/public/vendor/select2/js/i18n/bg.js +++ /dev/null @@ -1 +0,0 @@ -(function(){if(window.define)var e=window.define;if(window.require)var t=window.require;if(window.jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd.define,t=jQuery.fn.select2.amd.require;e("select2/i18n/bg",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Моля въведете с "+t+" по-малко символ";return t>1&&(n+="a"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Моля въведете още "+t+" символ";return t>1&&(n+="a"),n},loadingMore:function(){return"Зареждат се още…"},maximumSelected:function(e){var t="Можете да направите до "+e.maximum+" ";return e.maximum>1?t+="избора":t+="избор",t},noResults:function(){return"Няма намерени съвпадения"},searching:function(){return"Търсене…"}}}),t("jquery.select2"),jQuery.fn.select2.amd={define:e,require:t}})();
\ No newline at end of file diff --git a/public/vendor/select2/js/i18n/ca.js b/public/vendor/select2/js/i18n/ca.js deleted file mode 100755 index 1d47d89e..00000000 --- a/public/vendor/select2/js/i18n/ca.js +++ /dev/null @@ -1 +0,0 @@ -(function(){if(window.define)var e=window.define;if(window.require)var t=window.require;if(window.jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd.define,t=jQuery.fn.select2.amd.require;e("select2/i18n/ca",[],function(){return{errorLoading:function(){return"La càrrega ha fallat"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Si us plau, elimina "+t+" car";return t==1?n+="àcter":n+="àcters",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Si us plau, introdueix "+t+" car";return t==1?n+="àcter":n+="àcters",n},loadingMore:function(){return"Carregant més resultats…"},maximumSelection:function(e){var t="Només es pot seleccionar "+e.maximum+" element";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No s'han trobat resultats"},searching:function(){return"Cercant…"}}}),t("jquery.select2"),jQuery.fn.select2.amd={define:e,require:t}})();
\ No newline at end of file diff --git a/public/vendor/select2/js/i18n/cs.js b/public/vendor/select2/js/i18n/cs.js deleted file mode 100755 index b7422263..00000000 --- a/public/vendor/select2/js/i18n/cs.js +++ /dev/null @@ -1 +0,0 @@ -(function(){if(window.define)var e=window.define;if(window.require)var t=window.require;if(window.jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd.define,t=jQuery.fn.select2.amd.require;e("select2/i18n/cs",[],function(){function e(e,t){switch(e){case 2:return t?"dva":"dvě";case 3:return"tři";case 4:return"čtyři"}return""}return{errorLoading:function(){return"Výsledky nemohly být načteny."},inputTooLong:function(t){var n=t.input.length-t.maximum;return n==1?"Prosím zadejte o jeden znak méně":n<=4?"Prosím zadejte o "+e(n,!0)+" znaky méně":"Prosím zadejte o "+n+" znaků méně"},inputTooShort:function(t){var n=t.minimum-t.input.length;return n==1?"Prosím zadejte ještě jeden znak":n<=4?"Prosím zadejte ještě další "+e(n,!0)+" znaky":"Prosím zadejte ještě dalších "+n+" znaků"},loadingMore:function(){return"Načítají se další výsledky…"},maximumSelected:function(t){var n=t.maximum;return n==1?"Můžete zvolit jen jednu položku":n<=4?"Můžete zvolit maximálně "+e(n,!1)+" položky":"Můžete zvolit maximálně "+n+" položek"},noResults:function(){return"Nenalezeny žádné položky"},searching:function(){return"Vyhledávání…"}}}),t("jquery.select2"),jQuery.fn.select2.amd={define:e,require:t}})();
\ No newline at end of file diff --git a/public/vendor/select2/js/i18n/da.js b/public/vendor/select2/js/i18n/da.js deleted file mode 100755 index e9d737cc..00000000 --- a/public/vendor/select2/js/i18n/da.js +++ /dev/null @@ -1 +0,0 @@ -(function(){if(window.define)var e=window.define;if(window.require)var t=window.require;if(window.jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd.define,t=jQuery.fn.select2.amd.require;e("select2/i18n/da",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Angiv venligst "+t+" tegn mindre";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Angiv venligst "+t+" tegn mere";return n},loadingMore:function(){return"Indlæser flere resultater…"},maximumSelected:function(e){var t="Du kan kun vælge "+e.maximum+" emne";return e.maximum!=1&&(t+="r"),t},noResults:function(){return"Ingen resultater fundet"},searching:function(){return"Søger…"}}}),t("jquery.select2"),jQuery.fn.select2.amd={define:e,require:t}})();
\ No newline at end of file diff --git a/public/vendor/select2/js/i18n/de.js b/public/vendor/select2/js/i18n/de.js deleted file mode 100755 index 81d58e04..00000000 --- a/public/vendor/select2/js/i18n/de.js +++ /dev/null @@ -1 +0,0 @@ -(function(){if(window.define)var e=window.define;if(window.require)var t=window.require;if(window.jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd.define,t=jQuery.fn.select2.amd.require;e("select2/i18n/de",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum;return"Bitte "+t+" Zeichen weniger eingeben"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Bitte "+t+" Zeichen mehr eingeben"},loadingMore:function(){return"Lade mehr Ergebnisse…"},maximumSelected:function(e){var t="Sie können nur "+e.maximum+" Eintr";return e.maximum===1?t+="ag":t+="äge",t+=" auswählen",t},noResults:function(){return"Keine Übereinstimmungen gefunden"},searching:function(){return"Suche…"}}}),t("jquery.select2"),jQuery.fn.select2.amd={define:e,require:t}})();
\ No newline at end of file diff --git a/public/vendor/select2/js/i18n/en.js b/public/vendor/select2/js/i18n/en.js deleted file mode 100755 index 331d0d88..00000000 --- a/public/vendor/select2/js/i18n/en.js +++ /dev/null @@ -1 +0,0 @@ -(function(){if(window.define)var e=window.define;if(window.require)var t=window.require;if(window.jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd.define,t=jQuery.fn.select2.amd.require;e("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Please delete "+t+" character";return t!=1&&(n+="s"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Please enter "+t+" or more characters";return n},loadingMore:function(){return"Loading more results…"},maximumSelected:function(e){var t="You can only select "+e.maximum+" item";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No results found"},searching:function(){return"Searching…"}}}),t("jquery.select2"),jQuery.fn.select2.amd={define:e,require:t}})();
\ No newline at end of file diff --git a/public/vendor/select2/js/i18n/es.js b/public/vendor/select2/js/i18n/es.js deleted file mode 100755 index b9003b25..00000000 --- a/public/vendor/select2/js/i18n/es.js +++ /dev/null @@ -1 +0,0 @@ -(function(){if(window.define)var e=window.define;if(window.require)var t=window.require;if(window.jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd.define,t=jQuery.fn.select2.amd.require;e("select2/i18n/es",[],function(){return{errorLoading:function(){return"La carga falló"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Por favor, elimine "+t+" car";return t==1?n+="ácter":n+="acteres",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Por favor, introduzca "+t+" car";return t==1?n+="ácter":n+="acteres",n},loadingMore:function(){return"Cargando más resultados…"},maximumSelection:function(e){var t="Sólo puede seleccionar "+e.maximum+" elemento";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No se encontraron resultados"},searching:function(){return"Buscando…"}}}),t("jquery.select2"),jQuery.fn.select2.amd={define:e,require:t}})();
\ No newline at end of file diff --git a/public/vendor/select2/js/i18n/et.js b/public/vendor/select2/js/i18n/et.js deleted file mode 100755 index 32277f9a..00000000 --- a/public/vendor/select2/js/i18n/et.js +++ /dev/null @@ -1 +0,0 @@ -(function(){if(window.define)var e=window.define;if(window.require)var t=window.require;if(window.jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd.define,t=jQuery.fn.select2.amd.require;e("select2/i18n/et",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Sisesta "+t+" täht";return t!=1&&(n+="e"),n+=" vähem",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Sisesta "+t+" täht";return t!=1&&(n+="e"),n+=" rohkem",n},loadingMore:function(){return"Laen tulemusi…"},maximumSelected:function(e){var t="Saad vaid "+e.maximum+" tulemus";return e.maximum==1?t+="e":t+="t",t+=" valida",t},noResults:function(){return"Tulemused puuduvad"},searching:function(){return"Otsin…"}}}),t("jquery.select2"),jQuery.fn.select2.amd={define:e,require:t}})();
\ No newline at end of file diff --git a/public/vendor/select2/js/i18n/eu.js b/public/vendor/select2/js/i18n/eu.js deleted file mode 100755 index ba0aafe2..00000000 --- a/public/vendor/select2/js/i18n/eu.js +++ /dev/null @@ -1 +0,0 @@ -(function(){if(window.define)var e=window.define;if(window.require)var t=window.require;if(window.jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd.define,t=jQuery.fn.select2.amd.require;e("select2/i18n/eu",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Idatzi ";return t==1?n+="karaktere bat":n+=t+" karaktere",n+=" gutxiago",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Idatzi ";return t==1?n+="karaktere bat":n+=t+" karaktere",n+=" gehiago",n},loadingMore:function(){return"Emaitza gehiago kargatzen…"},maximumSelection:function(e){return e.maximum===1?"Elementu bakarra hauta dezakezu":e.maximum+" elementu hauta ditzakezu soilik"},noResults:function(){return"Ez da bat datorrenik aurkitu"},searching:function(){return"Bilatzen…"}}}),t("jquery.select2"),jQuery.fn.select2.amd={define:e,require:t}})();
\ No newline at end of file diff --git a/public/vendor/select2/js/i18n/fi.js b/public/vendor/select2/js/i18n/fi.js deleted file mode 100755 index 41a100ef..00000000 --- a/public/vendor/select2/js/i18n/fi.js +++ /dev/null @@ -1 +0,0 @@ -(function(){if(window.define)var e=window.define;if(window.require)var t=window.require;if(window.jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd.define,t=jQuery.fn.select2.amd.require;e("select2/i18n/fi",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum;return"Ole hyvä ja anna "+t+" merkkiä vähemmän"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Ole hyvä ja anna "+t+" merkkiä lisää"},loadingMore:function(){return"Ladataan lisää tuloksia…"},maximumSelection:function(e){return"Voit valita ainoastaan "+e.maximum+" kpl"},noResults:function(){return"Ei tuloksia"},searching:function(){}}}),t("jquery.select2"),jQuery.fn.select2.amd={define:e,require:t}})();
\ No newline at end of file diff --git a/public/vendor/select2/js/i18n/fr.js b/public/vendor/select2/js/i18n/fr.js deleted file mode 100755 index 448d330c..00000000 --- a/public/vendor/select2/js/i18n/fr.js +++ /dev/null @@ -1 +0,0 @@ -(function(){if(window.define)var e=window.define;if(window.require)var t=window.require;if(window.jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd.define,t=jQuery.fn.select2.amd.require;e("select2/i18n/fr",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Supprimez "+t+" caractère";return t!==1&&(n+="s"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Saisissez "+t+" caractère";return t!==1&&(n+="s"),n},loadingMore:function(){return"Chargement de résultats supplémentaires…"},maximumSelection:function(e){var t="Vous pouvez seulement sélectionner "+e.maximum+" élément";return e.maximum!==1&&(t+="s"),t},noResults:function(){return"Aucun résultat trouvé"},searching:function(){return"Recherche en cours…"}}}),t("jquery.select2"),jQuery.fn.select2.amd={define:e,require:t}})();
\ No newline at end of file diff --git a/public/vendor/select2/js/i18n/gl.js b/public/vendor/select2/js/i18n/gl.js deleted file mode 100755 index 1bb76ff2..00000000 --- a/public/vendor/select2/js/i18n/gl.js +++ /dev/null @@ -1 +0,0 @@ -(function(){if(window.define)var e=window.define;if(window.require)var t=window.require;if(window.jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd.define,t=jQuery.fn.select2.amd.require;e("select2/i18n/gl",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Engada ";return t===1?n+="un carácter":n+=t+" caracteres",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Elimine ";return t===1?n+="un carácter":n+=t+" caracteres",n},loadingMore:function(){return"Cargando máis resultados…"},maximumSelection:function(e){var t="Só pode ";return e.maximum===1?t+="un elemento":t+=e.maximum+" elementos",t},noResults:function(){return"Non se atoparon resultados"},searching:function(){return"Buscando…"}}}),t("jquery.select2"),jQuery.fn.select2.amd={define:e,require:t}})();
\ No newline at end of file diff --git a/public/vendor/select2/js/i18n/hi.js b/public/vendor/select2/js/i18n/hi.js deleted file mode 100755 index a90d618f..00000000 --- a/public/vendor/select2/js/i18n/hi.js +++ /dev/null @@ -1 +0,0 @@ -(function(){if(window.define)var e=window.define;if(window.require)var t=window.require;if(window.jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd.define,t=jQuery.fn.select2.amd.require;e("select2/i18n/hi",[],function(){return{errorLoading:function(){return"परिणामों को लोड नहीं किया जा सका।"},inputTooLong:function(e){var t=e.input.length-e.maximum,n=t+" अक्षर को हटा दें";return t>1&&(n=t+" अक्षरों को हटा दें "),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="कृपया "+t+" या अधिक अक्षर दर्ज करें";return n},loadingMore:function(){return"अधिक परिणाम लोड हो रहे है..."},maximumSelected:function(e){var t="आप केवल "+e.maximum+" आइटम का चयन कर सकते हैं";return t},noResults:function(){return"कोई परिणाम नहीं मिला"},searching:function(){return"खोज रहा है..."}}}),t("jquery.select2"),jQuery.fn.select2.amd={define:e,require:t}})();
\ No newline at end of file diff --git a/public/vendor/select2/js/i18n/hr.js b/public/vendor/select2/js/i18n/hr.js deleted file mode 100755 index 8002dff9..00000000 --- a/public/vendor/select2/js/i18n/hr.js +++ /dev/null @@ -1 +0,0 @@ -(function(){if(window.define)var e=window.define;if(window.require)var t=window.require;if(window.jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd.define,t=jQuery.fn.select2.amd.require;e("select2/i18n/hr",[],function(){function e(e){var t=" "+e+" znak";return e%10<5&&e%10>0&&(e%100<5||e%100>19)?e%10>1&&(t+="a"):t+="ova",t}return{inputTooLong:function(t){var n=t.input.length-t.maximum;return"Unesite "+e(n)},inputTooShort:function(t){var n=t.minimum-t.input.length;return"Unesite još "+e(n)},loadingMore:function(){return"Učitavanje rezultata…"},maximumSelection:function(e){return"Maksimalan broj odabranih stavki je "+e.maximum},noResults:function(){return"Nema rezultata"},searching:function(){return"Pretraga…"}}}),t("jquery.select2"),jQuery.fn.select2.amd={define:e,require:t}})();
\ No newline at end of file diff --git a/public/vendor/select2/js/i18n/hu.js b/public/vendor/select2/js/i18n/hu.js deleted file mode 100755 index 8ade838e..00000000 --- a/public/vendor/select2/js/i18n/hu.js +++ /dev/null @@ -1 +0,0 @@ -(function(){if(window.define)var e=window.define;if(window.require)var t=window.require;if(window.jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd.define,t=jQuery.fn.select2.amd.require;e("select2/i18n/hu",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum;return"Túl hosszú. "+t+" karakterrel több, mint kellene."},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Túl rövid. Még "+t+" karakter hiányzik."},loadingMore:function(){return"Töltés…"},maximumSelection:function(e){return"Csak "+e.maximum+" elemet lehet kiválasztani."},noResults:function(){return"Nincs találat."},searching:function(){return"Keresés…"}}}),t("jquery.select2"),jQuery.fn.select2.amd={define:e,require:t}})();
\ No newline at end of file diff --git a/public/vendor/select2/js/i18n/id.js b/public/vendor/select2/js/i18n/id.js deleted file mode 100755 index 7fd764a7..00000000 --- a/public/vendor/select2/js/i18n/id.js +++ /dev/null @@ -1 +0,0 @@ -(function(){if(window.define)var e=window.define;if(window.require)var t=window.require;if(window.jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd.define,t=jQuery.fn.select2.amd.require;e("select2/i18n/id",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum;return"Hapuskan "+t+" huruf"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Masukkan "+t+" huruf lagi"},loadingMore:function(){return"Mengambil data…"},maximumSelection:function(e){return"Anda hanya dapat memilih "+e.maximum+" pilihan"},noResults:function(){return"Tidak ada data yang sesuai"},searching:function(){return"Mencari…"}}}),t("jquery.select2"),jQuery.fn.select2.amd={define:e,require:t}})();
\ No newline at end of file diff --git a/public/vendor/select2/js/i18n/is.js b/public/vendor/select2/js/i18n/is.js deleted file mode 100755 index 2c9a15fa..00000000 --- a/public/vendor/select2/js/i18n/is.js +++ /dev/null @@ -1 +0,0 @@ -(function(){if(window.define)var e=window.define;if(window.require)var t=window.require;if(window.jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd.define,t=jQuery.fn.select2.amd.require;e("select2/i18n/is",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vinsamlegast styttið texta um "+t+" staf";return t<=1?n:n+"i"},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vinsamlegast skrifið "+t+" staf";return t>1&&(n+="i"),n+=" í viðbót",n},loadingMore:function(){return"Sæki fleiri niðurstöður…"},maximumSelection:function(e){return"Þú getur aðeins valið "+e.maximum+" atriði"},noResults:function(){return"Ekkert fannst"},searching:function(){return"Leita…"}}}),t("jquery.select2"),jQuery.fn.select2.amd={define:e,require:t}})();
\ No newline at end of file diff --git a/public/vendor/select2/js/i18n/it.js b/public/vendor/select2/js/i18n/it.js deleted file mode 100755 index e2949437..00000000 --- a/public/vendor/select2/js/i18n/it.js +++ /dev/null @@ -1 +0,0 @@ -(function(){if(window.define)var e=window.define;if(window.require)var t=window.require;if(window.jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd.define,t=jQuery.fn.select2.amd.require;e("select2/i18n/it",[],function(){return{errorLoading:function(){return"I risultati non possono essere caricati."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Per favore cancella "+t+" caratter";return t!==1?n+="i":n+="e",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Per favore inserisci "+t+" o più caratteri";return n},loadingMore:function(){return"Caricando più risultati…"},maximumSelected:function(e){var t="Puoi selezionare solo "+e.maximum+" element";return e.maximum!==1?t+="i":t+="o",t},noResults:function(){return"Nessun risultato trovato"},searching:function(){return"Sto cercando…"}}}),t("jquery.select2"),jQuery.fn.select2.amd={define:e,require:t}})();
\ No newline at end of file diff --git a/public/vendor/select2/js/i18n/lt.js b/public/vendor/select2/js/i18n/lt.js deleted file mode 100755 index 583219e0..00000000 --- a/public/vendor/select2/js/i18n/lt.js +++ /dev/null @@ -1 +0,0 @@ -(function(){if(window.define)var e=window.define;if(window.require)var t=window.require;if(window.jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd.define,t=jQuery.fn.select2.amd.require;e("select2/i18n/lt",[],function(){function e(e,t,n,r){return e%100>9&&e%100<21||e%10===0?e%10>1?n:r:t}return{inputTooLong:function(t){var n=t.input.length-t.maximum,r="Pašalinkite "+n+" simbol";return r+=e(n,"ių","ius","į"),r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Įrašykite dar "+n+" simbol";return r+=e(n,"ių","ius","į"),r},loadingMore:function(){return"Kraunama daugiau rezultatų…"},maximumSelection:function(t){var n="Jūs galite pasirinkti tik "+t.maximum+" element";return n+=e(t.maximum,"ų","us","ą"),n},noResults:function(){return"Atitikmenų nerasta"},searching:function(){return"Ieškoma…"}}}),t("jquery.select2"),jQuery.fn.select2.amd={define:e,require:t}})();
\ No newline at end of file diff --git a/public/vendor/select2/js/i18n/lv.js b/public/vendor/select2/js/i18n/lv.js deleted file mode 100755 index 7d67cc26..00000000 --- a/public/vendor/select2/js/i18n/lv.js +++ /dev/null @@ -1 +0,0 @@ -(function(){if(window.define)var e=window.define;if(window.require)var t=window.require;if(window.jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd.define,t=jQuery.fn.select2.amd.require;e("select2/i18n/lv",[],function(){function e(e,t,n,r){return e===11?t:e%10===1?n:r}return{inputTooLong:function(t){var n=t.input.length-t.maximum,r="Lūdzu ievadiet par "+n;return r+=" simbol"+e(n,"iem","u","iem"),r+" mazāk"},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Lūdzu ievadiet vēl "+n;return r+=" simbol"+e(n,"us","u","us"),r},loadingMore:function(){return"Datu ielāde…"},maximumSelection:function(t){var n="Jūs varat izvēlēties ne vairāk kā "+t.maximum;return n+=" element"+e(t.maximum,"us","u","us"),n},noResults:function(){return"Sakritību nav"},searching:function(){return"Meklēšana…"}}}),t("jquery.select2"),jQuery.fn.select2.amd={define:e,require:t}})();
\ No newline at end of file diff --git a/public/vendor/select2/js/i18n/mk.js b/public/vendor/select2/js/i18n/mk.js deleted file mode 100755 index f8784f5c..00000000 --- a/public/vendor/select2/js/i18n/mk.js +++ /dev/null @@ -1 +0,0 @@ -(function(){if(window.define)var e=window.define;if(window.require)var t=window.require;if(window.jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd.define,t=jQuery.fn.select2.amd.require;e("select2/i18n/mk",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Ве молиме внесете "+e.maximum+" помалку карактер";return e.maximum!==1&&(n+="и"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Ве молиме внесете уште "+e.maximum+" карактер";return e.maximum!==1&&(n+="и"),n},loadingMore:function(){return"Вчитување резултати…"},maximumSelection:function(e){var t="Можете да изберете само "+e.maximum+" ставк";return e.maximum===1?t+="а":t+="и",t},noResults:function(){return"Нема пронајдено совпаѓања"},searching:function(){return"Пребарување…"}}}),t("jquery.select2"),jQuery.fn.select2.amd={define:e,require:t}})();
\ No newline at end of file diff --git a/public/vendor/select2/js/i18n/nb.js b/public/vendor/select2/js/i18n/nb.js deleted file mode 100755 index 1c2a4550..00000000 --- a/public/vendor/select2/js/i18n/nb.js +++ /dev/null @@ -1 +0,0 @@ -(function(){if(window.define)var e=window.define;if(window.require)var t=window.require;if(window.jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd.define,t=jQuery.fn.select2.amd.require;e("select2/i18n/nb",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum;return"Vennligst fjern "+t+" tegn"},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vennligst skriv inn ";return t>1?n+=" flere tegn":n+=" tegn til",n},loadingMore:function(){return"Laster flere resultater…"},maximumSelection:function(e){return"Du kan velge maks "+e.maximum+" elementer"},noResults:function(){return"Ingen treff"},searching:function(){return"Søker…"}}}),t("jquery.select2"),jQuery.fn.select2.amd={define:e,require:t}})();
\ No newline at end of file diff --git a/public/vendor/select2/js/i18n/nl.js b/public/vendor/select2/js/i18n/nl.js deleted file mode 100755 index 57802d6c..00000000 --- a/public/vendor/select2/js/i18n/nl.js +++ /dev/null @@ -1 +0,0 @@ -(function(){if(window.define)var e=window.define;if(window.require)var t=window.require;if(window.jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd.define,t=jQuery.fn.select2.amd.require;e("select2/i18n/nl",[],function(){return{errorLoading:function(){return"De resultaten konden niet worden geladen."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Gelieve "+t+" karakters te verwijderen";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Gelieve "+t+" of meer karakters in te voeren";return n},loadingMore:function(){return"Meer resultaten laden…"},maximumSelected:function(e){var t="Er kunnen maar "+e.maximum+" item";return e.maximum!=1&&(t+="s"),t+=" worden geselecteerd",t},noResults:function(){return"Geen resultaten gevonden…"},searching:function(){return"Zoeken…"}}}),t("jquery.select2"),jQuery.fn.select2.amd={define:e,require:t}})();
\ No newline at end of file diff --git a/public/vendor/select2/js/i18n/pl.js b/public/vendor/select2/js/i18n/pl.js deleted file mode 100755 index e048786c..00000000 --- a/public/vendor/select2/js/i18n/pl.js +++ /dev/null @@ -1 +0,0 @@ -(function(){if(window.define)var e=window.define;if(window.require)var t=window.require;if(window.jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd.define,t=jQuery.fn.select2.amd.require;e("select2/i18n/pl",[],function(){var e=["znak","znaki","znaków"],t=["element","elementy","elementów"],n=function(t,n){if(t===1)return n[0];if(t>1&&t<=4)return n[1];if(t>=5)return n[2]};return{errorLoading:function(){return"Nie można załadować wyników."},inputTooLong:function(t){var r=t.input.length-t.maximum;return"Usuń "+r+" "+n(r,e)},inputTooShort:function(t){var r=t.minimum-t.input.length;return"Podaj przynajmniej "+r+" "+n(r,e)},loadingMore:function(){return"Trwa ładowanie…"},maximumSelected:function(e){return"Możesz zaznaczyć tylko "+e.maximum+" "+n(e.maxiumum,t)},noResults:function(){return"Brak wyników"},searching:function(){return"Trwa wyszukiwanie…"}}}),t("jquery.select2"),jQuery.fn.select2.amd={define:e,require:t}})();
\ No newline at end of file diff --git a/public/vendor/select2/js/i18n/pt-BR.js b/public/vendor/select2/js/i18n/pt-BR.js deleted file mode 100755 index 641cb432..00000000 --- a/public/vendor/select2/js/i18n/pt-BR.js +++ /dev/null @@ -1 +0,0 @@ -(function(){if(window.define)var e=window.define;if(window.require)var t=window.require;if(window.jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd.define,t=jQuery.fn.select2.amd.require;e("select2/i18n/pt-BR",[],function(){return{errorLoading:function(){return"Os resultados não puderam ser carregados."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Apague "+t+" caracter";return t!=1&&(n+="es"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Digite "+t+" ou mais caracteres";return n},loadingMore:function(){return"Carregando mais resultados…"},maximumSelected:function(e){var t="Você só pode selecionar "+e.maximum+" ite";return e.maximum==1?t+="m":t+="ns",t},noResults:function(){return"Nenhum resultado encontrado"},searching:function(){return"Buscando…"}}}),t("jquery.select2"),jQuery.fn.select2.amd={define:e,require:t}})();
\ No newline at end of file diff --git a/public/vendor/select2/js/i18n/pt.js b/public/vendor/select2/js/i18n/pt.js deleted file mode 100755 index c92b0edd..00000000 --- a/public/vendor/select2/js/i18n/pt.js +++ /dev/null @@ -1 +0,0 @@ -(function(){if(window.define)var e=window.define;if(window.require)var t=window.require;if(window.jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd.define,t=jQuery.fn.select2.amd.require;e("select2/i18n/pt",[],function(){return{errorLoading:function(){return"Os resultados não puderam ser carregados."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Por favor apague "+t+" ";return n+=t!=1?"caracteres":"carácter",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Introduza "+t+" ou mais caracteres";return n},loadingMore:function(){return"A carregar mais resultados…"},maximumSelected:function(e){var t="Apenas pode seleccionar "+e.maximum+" ";return t+=e.maximum!=1?"itens":"item",t},noResults:function(){return"Sem resultados"},searching:function(){return"A procurar…"}}}),t("jquery.select2"),jQuery.fn.select2.amd={define:e,require:t}})();
\ No newline at end of file diff --git a/public/vendor/select2/js/i18n/ro.js b/public/vendor/select2/js/i18n/ro.js deleted file mode 100755 index a787e432..00000000 --- a/public/vendor/select2/js/i18n/ro.js +++ /dev/null @@ -1 +0,0 @@ -(function(){if(window.define)var e=window.define;if(window.require)var t=window.require;if(window.jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd.define,t=jQuery.fn.select2.amd.require;e("select2/i18n/ro",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vă rugăm să introduceți mai puțin de "+t;return n+=" caracter",n!==1&&(n+="e"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vă rugăm să introduceți incă "+t;return n+=" caracter",n!==1&&(n+="e"),n},loadingMore:function(){return"Se încarcă…"},maximumSelection:function(e){var t="Aveți voie să selectați cel mult "+e.maximum;return t+=" element",t!==1&&(t+="e"),t},noResults:function(){return"Nu a fost găsit nimic"},searching:function(){return"Căutare…"}}}),t("jquery.select2"),jQuery.fn.select2.amd={define:e,require:t}})();
\ No newline at end of file diff --git a/public/vendor/select2/js/i18n/ru.js b/public/vendor/select2/js/i18n/ru.js deleted file mode 100755 index 262da3a2..00000000 --- a/public/vendor/select2/js/i18n/ru.js +++ /dev/null @@ -1 +0,0 @@ -(function(){if(window.define)var e=window.define;if(window.require)var t=window.require;if(window.jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd.define,t=jQuery.fn.select2.amd.require;e("select2/i18n/ru",[],function(){function e(e,t,n,r){return e%10<5&&e%10>0&&e%100<5||e%100>20?e%10>1?n:t:r}return{inputTooLong:function(t){var n=t.input.length-t.maximum,r="Пожалуйста, введите на "+n+" символ";return r+=e(n,"","a","ов"),r+=" меньше",r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Пожалуйста, введите еще хотя бы "+n+" символ";return r+=e(n,"","a","ов"),r},loadingMore:function(){return"Загрузка данных…"},maximumSelected:function(t){var n="Вы можете выбрать не более "+t.maximum+" элемент";return n+=e(t.maximum,"","a","ов"),n},noResults:function(){return"Совпадений не найдено"},searching:function(){return"Поиск…"}}}),t("jquery.select2"),jQuery.fn.select2.amd={define:e,require:t}})();
\ No newline at end of file diff --git a/public/vendor/select2/js/i18n/sk.js b/public/vendor/select2/js/i18n/sk.js deleted file mode 100755 index c36f25bb..00000000 --- a/public/vendor/select2/js/i18n/sk.js +++ /dev/null @@ -1 +0,0 @@ -(function(){if(window.define)var e=window.define;if(window.require)var t=window.require;if(window.jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd.define,t=jQuery.fn.select2.amd.require;e("select2/i18n/sk",[],function(){var e={2:function(e){return e?"dva":"dve"},3:function(){return"tri"},4:function(){return"štyri"}};return{inputTooLong:function(t){var n=t.input.length-t.maximum;return n==1?"Prosím, zadajte o jeden znak menej":n>=2&&n<=4?"Prosím, zadajte o "+e[n](!0)+" znaky menej":"Prosím, zadajte o "+n+" znakov menej"},inputTooShort:function(t){var n=t.minimum-t.input.length;return n==1?"Prosím, zadajte ešte jeden znak":n<=4?"Prosím, zadajte ešte ďalšie "+e[n](!0)+" znaky":"Prosím, zadajte ešte ďalších "+n+" znakov"},loadingMore:function(){return"Loading more results…"},maximumSelected:function(t){return t.maximum==1?"Môžete zvoliť len jednu položku":t.maximum>=2&&t.maximum<=4?"Môžete zvoliť najviac "+e[t.maximum](!1)+" položky":"Môžete zvoliť najviac "+t.maximum+" položiek"},noResults:function(){return"Nenašli sa žiadne položky"},searching:function(){return"Vyhľadávanie…"}}}),t("jquery.select2"),jQuery.fn.select2.amd={define:e,require:t}})();
\ No newline at end of file diff --git a/public/vendor/select2/js/i18n/sr.js b/public/vendor/select2/js/i18n/sr.js deleted file mode 100755 index 131dd019..00000000 --- a/public/vendor/select2/js/i18n/sr.js +++ /dev/null @@ -1 +0,0 @@ -(function(){if(window.define)var e=window.define;if(window.require)var t=window.require;if(window.jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd.define,t=jQuery.fn.select2.amd.require;e("select2/i18n/sr",[],function(){function e(e,t,n,r){return e%10==1&&e%100!=11?t:e%10>=2&&e%10<=4&&(e%100<12||e%100>14)?n:r}return{inputTooLong:function(t){var n=t.input.length-t.maximum,r="Obrišite "+n+" simbol";return r+=e(n,"","a","a"),r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Ukucajte bar još "+n+" simbol";return r+=e(n,"","a","a"),r},loadingMore:function(){return"Preuzimanje još rezultata…"},maximumSelected:function(t){var n="Možete izabrati samo "+t.maximum+" stavk";return n+=e(t.maximum,"u","e","i"),n},noResults:function(){return"Ništa nije pronađeno"},searching:function(){return"Pretraga…"}}}),t("jquery.select2"),jQuery.fn.select2.amd={define:e,require:t}})();
\ No newline at end of file diff --git a/public/vendor/select2/js/i18n/sv.js b/public/vendor/select2/js/i18n/sv.js deleted file mode 100755 index 3fa7aac4..00000000 --- a/public/vendor/select2/js/i18n/sv.js +++ /dev/null @@ -1 +0,0 @@ -(function(){if(window.define)var e=window.define;if(window.require)var t=window.require;if(window.jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd.define,t=jQuery.fn.select2.amd.require;e("select2/i18n/sv",[],function(){return{errorLoading:function(){return"Resultat kunde inte laddas."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vänligen sudda ut "+t+" tecken";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vänligen skriv in "+t+" eller fler tecken";return n},loadingMore:function(){return"Laddar fler resultat…"},maximumSelected:function(e){var t="Du kan max välja "+e.maximum+" element";return t},noResults:function(){return"Inga träffar"},searching:function(){return"Söker…"}}}),t("jquery.select2"),jQuery.fn.select2.amd={define:e,require:t}})();
\ No newline at end of file diff --git a/public/vendor/select2/js/i18n/th.js b/public/vendor/select2/js/i18n/th.js deleted file mode 100755 index 326b3c85..00000000 --- a/public/vendor/select2/js/i18n/th.js +++ /dev/null @@ -1 +0,0 @@ -(function(){if(window.define)var e=window.define;if(window.require)var t=window.require;if(window.jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd.define,t=jQuery.fn.select2.amd.require;e("select2/i18n/th",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="โปรดลบออก "+t+" ตัวอักษร";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="โปรดพิมพ์เพิ่มอีก "+t+" ตัวอักษร";return n},loadingMore:function(){return"กำลังค้นข้อมูลเพิ่ม…"},maximumSelected:function(e){var t="คุณสามารถเลือกได้ไม่เกิน "+e.maximum+" รายการ";return t},noResults:function(){return"ม่พบข้อมูล"},searching:function(){return"กำลังค้นข้อมูล…"}}}),t("jquery.select2"),jQuery.fn.select2.amd={define:e,require:t}})();
\ No newline at end of file diff --git a/public/vendor/select2/js/i18n/tr.js b/public/vendor/select2/js/i18n/tr.js deleted file mode 100755 index e46758c6..00000000 --- a/public/vendor/select2/js/i18n/tr.js +++ /dev/null @@ -1 +0,0 @@ -(function(){if(window.define)var e=window.define;if(window.require)var t=window.require;if(window.jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd.define,t=jQuery.fn.select2.amd.require;e("select2/i18n/tr",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n=t+" karakter daha girmelisiniz";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="En az "+t+" karakter daha girmelisiniz";return n},loadingMore:function(){return"Daha fazla…"},maximumSelected:function(e){var t="Sadece "+e.maximum+" seçim yapabilirsiniz";return t},noResults:function(){return"Sonuç bulunamadı"},searching:function(){return"Aranıyor…"}}}),t("jquery.select2"),jQuery.fn.select2.amd={define:e,require:t}})();
\ No newline at end of file diff --git a/public/vendor/select2/js/i18n/uk.js b/public/vendor/select2/js/i18n/uk.js deleted file mode 100755 index 4a9c8722..00000000 --- a/public/vendor/select2/js/i18n/uk.js +++ /dev/null @@ -1 +0,0 @@ -(function(){if(window.define)var e=window.define;if(window.require)var t=window.require;if(window.jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd.define,t=jQuery.fn.select2.amd.require;e("select2/i18n/uk",[],function(){function e(e,t,n,r){return e%100>10&&e%100<15?r:e%10===1?t:e%10>1&&e%10<5?n:r}return{errorLoading:function(){return"Неможливо завантажити результати"},inputTooLong:function(t){var n=t.input.length-t.maximum;return"Будь ласка, видаліть "+n+" "+e(t.maximum,"літеру","літери","літер")},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Будь ласка, введіть "+t+" або більше літер"},loadingMore:function(){return"Завантаження інших результатів…"},maximumSelected:function(t){return"Ви можете вибрати лише "+t.maximum+" "+e(t.maximum,"пункт","пункти","пунктів")},noResults:function(){return"Нічого не знайдено"},searching:function(){return"Пошук…"}}}),t("jquery.select2"),jQuery.fn.select2.amd={define:e,require:t}})();
\ No newline at end of file diff --git a/public/vendor/select2/js/i18n/vi.js b/public/vendor/select2/js/i18n/vi.js deleted file mode 100755 index ae0c8910..00000000 --- a/public/vendor/select2/js/i18n/vi.js +++ /dev/null @@ -1 +0,0 @@ -(function(){if(window.define)var e=window.define;if(window.require)var t=window.require;if(window.jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd.define,t=jQuery.fn.select2.amd.require;e("select2/i18n/vi",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vui lòng nhập ít hơn "+t+" ký tự";return t!=1&&(n+="s"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vui lòng nhập nhiều hơn "+t+' ký tự"';return n},loadingMore:function(){return"Đang lấy thêm kết quả…"},maximumSelected:function(e){var t="Chỉ có thể chọn được "+e.maximum+" lựa chọn";return t},noResults:function(){return"Không tìm thấy kết quả"},searching:function(){return"Đang tìm…"}}}),t("jquery.select2"),jQuery.fn.select2.amd={define:e,require:t}})();
\ No newline at end of file diff --git a/public/vendor/select2/js/i18n/zh-CN.js b/public/vendor/select2/js/i18n/zh-CN.js deleted file mode 100755 index 9073d6cf..00000000 --- a/public/vendor/select2/js/i18n/zh-CN.js +++ /dev/null @@ -1 +0,0 @@ -(function(){if(window.define)var e=window.define;if(window.require)var t=window.require;if(window.jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd.define,t=jQuery.fn.select2.amd.require;e("select2/i18n/zh-CN",[],function(){return{errorLoading:function(){return"无法载入结果。"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="请删除"+t+"个字符";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="请再输入至少"+t+"个字符";return n},loadingMore:function(){return"载入更多结果…"},maximumSelected:function(e){var t="最多只能选择"+e.maximum+"个项目";return t},noResults:function(){return"未找到结果"},searching:function(){return"搜索中…"}}}),t("jquery.select2"),jQuery.fn.select2.amd={define:e,require:t}})();
\ No newline at end of file diff --git a/public/vendor/select2/js/i18n/zh-TW.js b/public/vendor/select2/js/i18n/zh-TW.js deleted file mode 100755 index 60f83be2..00000000 --- a/public/vendor/select2/js/i18n/zh-TW.js +++ /dev/null @@ -1 +0,0 @@ -(function(){if(window.define)var e=window.define;if(window.require)var t=window.require;if(window.jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd.define,t=jQuery.fn.select2.amd.require;e("select2/i18n/zh-TW",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="請刪掉"+t+"個字元";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="請再輸入"+t+"個字元";return n},loadingMore:function(){return"載入中…"},maximumSelected:function(e){var t="你只能選擇最多"+e.maximum+"項";return t},noResults:function(){return"沒有找到相符的項目"},searching:function(){return"搜尋中…"}}}),t("jquery.select2"),jQuery.fn.select2.amd={define:e,require:t}})();
\ No newline at end of file diff --git a/public/vendor/select2/js/select2.amd.full.js b/public/vendor/select2/js/select2.amd.full.js deleted file mode 100755 index 2a444abe..00000000 --- a/public/vendor/select2/js/select2.amd.full.js +++ /dev/null @@ -1,5326 +0,0 @@ -define(['jquery'], function ($) {define('select2/utils',[ - 'jquery' -], function ($) { - var Utils = {}; - - Utils.Extend = function (ChildClass, SuperClass) { - var __hasProp = {}.hasOwnProperty; - - function BaseConstructor () { - this.constructor = ChildClass; - } - - for (var key in SuperClass) { - if (__hasProp.call(SuperClass, key)) { - ChildClass[key] = SuperClass[key]; - } - } - - BaseConstructor.prototype = SuperClass.prototype; - ChildClass.prototype = new BaseConstructor(); - ChildClass.__super__ = SuperClass.prototype; - - return ChildClass; - }; - - function getMethods (theClass) { - var proto = theClass.prototype; - - var methods = []; - - for (var methodName in proto) { - var m = proto[methodName]; - - if (typeof m !== 'function') { - continue; - } - - if (methodName === 'constructor') { - continue; - } - - methods.push(methodName); - } - - return methods; - } - - Utils.Decorate = function (SuperClass, DecoratorClass) { - var decoratedMethods = getMethods(DecoratorClass); - var superMethods = getMethods(SuperClass); - - function DecoratedClass () { - var unshift = Array.prototype.unshift; - - var argCount = DecoratorClass.prototype.constructor.length; - - var calledConstructor = SuperClass.prototype.constructor; - - if (argCount > 0) { - unshift.call(arguments, SuperClass.prototype.constructor); - - calledConstructor = DecoratorClass.prototype.constructor; - } - - calledConstructor.apply(this, arguments); - } - - DecoratorClass.displayName = SuperClass.displayName; - - function ctr () { - this.constructor = DecoratedClass; - } - - DecoratedClass.prototype = new ctr(); - - for (var m = 0; m < superMethods.length; m++) { - var superMethod = superMethods[m]; - - DecoratedClass.prototype[superMethod] = - SuperClass.prototype[superMethod]; - } - - var calledMethod = function (methodName) { - // Stub out the original method if it's not decorating an actual method - var originalMethod = function () {}; - - if (methodName in DecoratedClass.prototype) { - originalMethod = DecoratedClass.prototype[methodName]; - } - - var decoratedMethod = DecoratorClass.prototype[methodName]; - - return function () { - var unshift = Array.prototype.unshift; - - unshift.call(arguments, originalMethod); - - return decoratedMethod.apply(this, arguments); - }; - }; - - for (var d = 0; d < decoratedMethods.length; d++) { - var decoratedMethod = decoratedMethods[d]; - - DecoratedClass.prototype[decoratedMethod] = calledMethod(decoratedMethod); - } - - return DecoratedClass; - }; - - var Observable = function () { - this.listeners = {}; - }; - - Observable.prototype.on = function (event, callback) { - this.listeners = this.listeners || {}; - - if (event in this.listeners) { - this.listeners[event].push(callback); - } else { - this.listeners[event] = [callback]; - } - }; - - Observable.prototype.trigger = function (event) { - var slice = Array.prototype.slice; - - this.listeners = this.listeners || {}; - - if (event in this.listeners) { - this.invoke(this.listeners[event], slice.call(arguments, 1)); - } - - if ('*' in this.listeners) { - this.invoke(this.listeners['*'], arguments); - } - }; - - Observable.prototype.invoke = function (listeners, params) { - for (var i = 0, len = listeners.length; i < len; i++) { - listeners[i].apply(this, params); - } - }; - - Utils.Observable = Observable; - - Utils.generateChars = function (length) { - var chars = ''; - - for (var i = 0; i < length; i++) { - var randomChar = Math.floor(Math.random() * 36); - chars += randomChar.toString(36); - } - - return chars; - }; - - Utils.bind = function (func, context) { - return function () { - func.apply(context, arguments); - }; - }; - - Utils._convertData = function (data) { - for (var originalKey in data) { - var keys = originalKey.split('-'); - - var dataLevel = data; - - if (keys.length === 1) { - continue; - } - - for (var k = 0; k < keys.length; k++) { - var key = keys[k]; - - // Lowercase the first letter - // By default, dash-separated becomes camelCase - key = key.substring(0, 1).toLowerCase() + key.substring(1); - - if (!(key in dataLevel)) { - dataLevel[key] = {}; - } - - if (k == keys.length - 1) { - dataLevel[key] = data[originalKey]; - } - - dataLevel = dataLevel[key]; - } - - delete data[originalKey]; - } - - return data; - }; - - Utils.hasScroll = function (index, el) { - // Adapted from the function created by @ShadowScripter - // and adapted by @BillBarry on the Stack Exchange Code Review website. - // The original code can be found at - // http://codereview.stackexchange.com/q/13338 - // and was designed to be used with the Sizzle selector engine. - - var $el = $(el); - var overflowX = el.style.overflowX; - var overflowY = el.style.overflowY; - - //Check both x and y declarations - if (overflowX === overflowY && - (overflowY === 'hidden' || overflowY === 'visible')) { - return false; - } - - if (overflowX === 'scroll' || overflowY === 'scroll') { - return true; - } - - return ($el.innerHeight() < el.scrollHeight || - $el.innerWidth() < el.scrollWidth); - }; - - Utils.escapeMarkup = function (markup) { - var replaceMap = { - '\\': '\', - '&': '&', - '<': '<', - '>': '>', - '"': '"', - '\'': ''', - '/': '/' - }; - - // Do not try to escape the markup if it's not a string - if (typeof markup !== 'string') { - return markup; - } - - return String(markup).replace(/[&<>"'\/\\]/g, function (match) { - return replaceMap[match]; - }); - }; - - return Utils; -}); - -define('select2/results',[ - 'jquery', - './utils' -], function ($, Utils) { - function Results ($element, options, dataAdapter) { - this.$element = $element; - this.data = dataAdapter; - this.options = options; - - Results.__super__.constructor.call(this); - } - - Utils.Extend(Results, Utils.Observable); - - Results.prototype.render = function () { - var $results = $( - '<ul class="select2-results__options" role="tree"></ul>' - ); - - if (this.options.get('multiple')) { - $results.attr('aria-multiselectable', 'true'); - } - - this.$results = $results; - - return $results; - }; - - Results.prototype.clear = function () { - this.$results.empty(); - }; - - Results.prototype.displayMessage = function (params) { - var escapeMarkup = this.options.get('escapeMarkup'); - - this.clear(); - this.hideLoading(); - - var $message = $( - '<li role="treeitem" class="select2-results__option"></li>' - ); - - var message = this.options.get('translations').get(params.message); - - $message.append( - escapeMarkup( - message(params.args) - ) - ); - - this.$results.append($message); - }; - - Results.prototype.append = function (data) { - this.hideLoading(); - - var $options = []; - - if (data.results == null || data.results.length === 0) { - if (this.$results.children().length === 0) { - this.trigger('results:message', { - message: 'noResults' - }); - } - - return; - } - - data.results = this.sort(data.results); - - for (var d = 0; d < data.results.length; d++) { - var item = data.results[d]; - - var $option = this.option(item); - - $options.push($option); - } - - this.$results.append($options); - }; - - Results.prototype.position = function ($results, $dropdown) { - var $resultsContainer = $dropdown.find('.select2-results'); - $resultsContainer.append($results); - }; - - Results.prototype.sort = function (data) { - var sorter = this.options.get('sorter'); - - return sorter(data); - }; - - Results.prototype.setClasses = function () { - var self = this; - - this.data.current(function (selected) { - var selectedIds = $.map(selected, function (s) { - return s.id.toString(); - }); - - var $options = self.$results - .find('.select2-results__option[aria-selected]'); - - $options.each(function () { - var $option = $(this); - - var item = $.data(this, 'data'); - - if ($.inArray(item.id, selectedIds) > -1) { - $option.attr('aria-selected', 'true'); - } else { - $option.attr('aria-selected', 'false'); - } - }); - - var $selected = $options.filter('[aria-selected=true]'); - - // Check if there are any selected options - if ($selected.length > 0) { - // If there are selected options, highlight the first - $selected.first().trigger('mouseenter'); - } else { - // If there are no selected options, highlight the first option - // in the dropdown - $options.first().trigger('mouseenter'); - } - }); - }; - - Results.prototype.showLoading = function (params) { - this.hideLoading(); - - var loadingMore = this.options.get('translations').get('searching'); - - var loading = { - disabled: true, - loading: true, - text: loadingMore(params) - }; - var $loading = this.option(loading); - $loading.className += ' loading-results'; - - this.$results.prepend($loading); - }; - - Results.prototype.hideLoading = function () { - this.$results.find('.loading-results').remove(); - }; - - Results.prototype.option = function (data) { - var option = document.createElement('li'); - option.className = 'select2-results__option'; - - var attrs = { - 'role': 'treeitem', - 'aria-selected': 'false' - }; - - if (data.disabled) { - delete attrs['aria-selected']; - attrs['aria-disabled'] = 'true'; - } - - if (data.id == null) { - delete attrs['aria-selected']; - } - - if (data._resultId != null) { - option.id = data._resultId; - } - - if (data.title) { - option.title = data.title; - } - - if (data.children) { - attrs.role = 'group'; - attrs['aria-label'] = data.text; - delete attrs['aria-selected']; - } - - for (var attr in attrs) { - var val = attrs[attr]; - - option.setAttribute(attr, val); - } - - if (data.children) { - var $option = $(option); - - var label = document.createElement('strong'); - label.className = 'select2-results__group'; - - var $label = $(label); - this.template(data, label); - - var $children = []; - - for (var c = 0; c < data.children.length; c++) { - var child = data.children[c]; - - var $child = this.option(child); - - $children.push($child); - } - - var $childrenContainer = $('<ul></ul>', { - 'class': 'select2-results__options select2-results__options--nested' - }); - - $childrenContainer.append($children); - - $option.append(label); - $option.append($childrenContainer); - } else { - this.template(data, option); - } - - $.data(option, 'data', data); - - return option; - }; - - Results.prototype.bind = function (container, $container) { - var self = this; - - var id = container.id + '-results'; - - this.$results.attr('id', id); - - container.on('results:all', function (params) { - self.clear(); - self.append(params.data); - - if (container.isOpen()) { - self.setClasses(); - } - }); - - container.on('results:append', function (params) { - self.append(params.data); - - if (container.isOpen()) { - self.setClasses(); - } - }); - - container.on('query', function (params) { - self.showLoading(params); - }); - - container.on('select', function () { - if (!container.isOpen()) { - return; - } - - self.setClasses(); - }); - - container.on('unselect', function () { - if (!container.isOpen()) { - return; - } - - self.setClasses(); - }); - - container.on('open', function () { - // When the dropdown is open, aria-expended="true" - self.$results.attr('aria-expanded', 'true'); - self.$results.attr('aria-hidden', 'false'); - - self.setClasses(); - self.ensureHighlightVisible(); - }); - - container.on('close', function () { - // When the dropdown is closed, aria-expended="false" - self.$results.attr('aria-expanded', 'false'); - self.$results.attr('aria-hidden', 'true'); - self.$results.removeAttr('aria-activedescendant'); - }); - - container.on('results:toggle', function () { - var $highlighted = self.getHighlightedResults(); - - if ($highlighted.length === 0) { - return; - } - - $highlighted.trigger('mouseup'); - }); - - container.on('results:select', function () { - var $highlighted = self.getHighlightedResults(); - - if ($highlighted.length === 0) { - return; - } - - var data = $highlighted.data('data'); - - if ($highlighted.attr('aria-selected') == 'true') { - self.trigger('close'); - } else { - self.trigger('select', { - data: data - }); - } - }); - - container.on('results:previous', function () { - var $highlighted = self.getHighlightedResults(); - - var $options = self.$results.find('[aria-selected]'); - - var currentIndex = $options.index($highlighted); - - // If we are already at te top, don't move further - if (currentIndex === 0) { - return; - } - - var nextIndex = currentIndex - 1; - - // If none are highlighted, highlight the first - if ($highlighted.length === 0) { - nextIndex = 0; - } - - var $next = $options.eq(nextIndex); - - $next.trigger('mouseenter'); - - var currentOffset = self.$results.offset().top; - var nextTop = $next.offset().top; - var nextOffset = self.$results.scrollTop() + (nextTop - currentOffset); - - if (nextIndex === 0) { - self.$results.scrollTop(0); - } else if (nextTop - currentOffset < 0) { - self.$results.scrollTop(nextOffset); - } - }); - - container.on('results:next', function () { - var $highlighted = self.getHighlightedResults(); - - var $options = self.$results.find('[aria-selected]'); - - var currentIndex = $options.index($highlighted); - - var nextIndex = currentIndex + 1; - - // If we are at the last option, stay there - if (nextIndex >= $options.length) { - return; - } - - var $next = $options.eq(nextIndex); - - $next.trigger('mouseenter'); - - var currentOffset = self.$results.offset().top + - self.$results.outerHeight(false); - var nextBottom = $next.offset().top + $next.outerHeight(false); - var nextOffset = self.$results.scrollTop() + nextBottom - currentOffset; - - if (nextIndex === 0) { - self.$results.scrollTop(0); - } else if (nextBottom > currentOffset) { - self.$results.scrollTop(nextOffset); - } - }); - - container.on('results:focus', function (params) { - params.element.addClass('select2-results__option--highlighted'); - }); - - container.on('results:message', function (params) { - self.displayMessage(params); - }); - - if ($.fn.mousewheel) { - this.$results.on('mousewheel', function (e) { - var top = self.$results.scrollTop(); - - var bottom = ( - self.$results.get(0).scrollHeight - - self.$results.scrollTop() + - e.deltaY - ); - - var isAtTop = e.deltaY > 0 && top - e.deltaY <= 0; - var isAtBottom = e.deltaY < 0 && bottom <= self.$results.height(); - - if (isAtTop) { - self.$results.scrollTop(0); - - e.preventDefault(); - e.stopPropagation(); - } else if (isAtBottom) { - self.$results.scrollTop( - self.$results.get(0).scrollHeight - self.$results.height() - ); - - e.preventDefault(); - e.stopPropagation(); - } - }); - } - - this.$results.on('mouseup', '.select2-results__option[aria-selected]', - function (evt) { - var $this = $(this); - - var data = $this.data('data'); - - if ($this.attr('aria-selected') === 'true') { - if (self.options.get('multiple')) { - self.trigger('unselect', { - originalEvent: evt, - data: data - }); - } else { - self.trigger('close'); - } - - return; - } - - self.trigger('select', { - originalEvent: evt, - data: data - }); - }); - - this.$results.on('mouseenter', '.select2-results__option[aria-selected]', - function (evt) { - var data = $(this).data('data'); - - self.getHighlightedResults() - .removeClass('select2-results__option--highlighted'); - - self.trigger('results:focus', { - data: data, - element: $(this) - }); - }); - }; - - Results.prototype.getHighlightedResults = function () { - var $highlighted = this.$results - .find('.select2-results__option--highlighted'); - - return $highlighted; - }; - - Results.prototype.destroy = function () { - this.$results.remove(); - }; - - Results.prototype.ensureHighlightVisible = function () { - var $highlighted = this.getHighlightedResults(); - - if ($highlighted.length === 0) { - return; - } - - var $options = this.$results.find('[aria-selected]'); - - var currentIndex = $options.index($highlighted); - - var currentOffset = this.$results.offset().top; - var nextTop = $highlighted.offset().top; - var nextOffset = this.$results.scrollTop() + (nextTop - currentOffset); - - var offsetDelta = nextTop - currentOffset; - nextOffset -= $highlighted.outerHeight(false) * 2; - - if (currentIndex <= 2) { - this.$results.scrollTop(0); - } else if (offsetDelta > this.$results.outerHeight() || offsetDelta < 0) { - this.$results.scrollTop(nextOffset); - } - }; - - Results.prototype.template = function (result, container) { - var template = this.options.get('templateResult'); - var escapeMarkup = this.options.get('escapeMarkup'); - - var content = template(result); - - if (content == null) { - container.style.display = 'none'; - } else if (typeof content === 'string') { - container.innerHTML = escapeMarkup(content); - } else { - $(container).append(content); - } - }; - - return Results; -}); - -define('select2/keys',[ - -], function () { - var KEYS = { - BACKSPACE: 8, - TAB: 9, - ENTER: 13, - SHIFT: 16, - CTRL: 17, - ALT: 18, - ESC: 27, - SPACE: 32, - PAGE_UP: 33, - PAGE_DOWN: 34, - END: 35, - HOME: 36, - LEFT: 37, - UP: 38, - RIGHT: 39, - DOWN: 40, - DELETE: 46 - }; - - return KEYS; -}); - -define('select2/selection/base',[ - 'jquery', - '../utils', - '../keys' -], function ($, Utils, KEYS) { - function BaseSelection ($element, options) { - this.$element = $element; - this.options = options; - - BaseSelection.__super__.constructor.call(this); - } - - Utils.Extend(BaseSelection, Utils.Observable); - - BaseSelection.prototype.render = function () { - var $selection = $( - '<span class="select2-selection" role="combobox" ' + - 'aria-autocomplete="list" aria-haspopup="true" aria-expanded="false">' + - '</span>' - ); - - this._tabindex = 0; - - if (this.$element.data('old-tabindex') != null) { - this._tabindex = this.$element.data('old-tabindex'); - } else if (this.$element.attr('tabindex') != null) { - this._tabindex = this.$element.attr('tabindex'); - } - - $selection.attr('title', this.$element.attr('title')); - $selection.attr('tabindex', this._tabindex); - - this.$selection = $selection; - - return $selection; - }; - - BaseSelection.prototype.bind = function (container, $container) { - var self = this; - - var id = container.id + '-container'; - var resultsId = container.id + '-results'; - - this.container = container; - - this.$selection.attr('aria-owns', resultsId); - - this.$selection.on('focus', function (evt) { - self.trigger('focus', evt); - }); - - this.$selection.on('blur', function (evt) { - self.trigger('blur', evt); - }); - - this.$selection.on('keydown', function (evt) { - self.trigger('keypress', evt); - - if (evt.which === KEYS.SPACE) { - evt.preventDefault(); - } - }); - - container.on('results:focus', function (params) { - self.$selection.attr('aria-activedescendant', params.data._resultId); - }); - - container.on('selection:update', function (params) { - self.update(params.data); - }); - - container.on('open', function () { - // When the dropdown is open, aria-expanded="true" - self.$selection.attr('aria-expanded', 'true'); - - self._attachCloseHandler(container); - }); - - container.on('close', function () { - // When the dropdown is closed, aria-expanded="false" - self.$selection.attr('aria-expanded', 'false'); - self.$selection.removeAttr('aria-activedescendant'); - - self.$selection.focus(); - - self._detachCloseHandler(container); - }); - - container.on('enable', function () { - self.$selection.attr('tabindex', self._tabindex); - }); - - container.on('disable', function () { - self.$selection.attr('tabindex', '-1'); - }); - }; - - BaseSelection.prototype._attachCloseHandler = function (container) { - var self = this; - - $(document.body).on('mousedown.select2.' + container.id, function (e) { - var $target = $(e.target); - - var $select = $target.closest('.select2'); - - var $all = $('.select2.select2-container--open'); - - $all.each(function () { - var $this = $(this); - - if (this == $select[0]) { - return; - } - - var $element = $this.data('element'); - - $element.select2('close'); - }); - }); - }; - - BaseSelection.prototype._detachCloseHandler = function (container) { - $(document.body).off('mousedown.select2.' + container.id); - }; - - BaseSelection.prototype.position = function ($selection, $container) { - var $selectionContainer = $container.find('.selection'); - $selectionContainer.append($selection); - }; - - BaseSelection.prototype.destroy = function () { - this._detachCloseHandler(this.container); - }; - - BaseSelection.prototype.update = function (data) { - throw new Error('The `update` method must be defined in child classes.'); - }; - - return BaseSelection; -}); - -define('select2/selection/single',[ - 'jquery', - './base', - '../utils', - '../keys' -], function ($, BaseSelection, Utils, KEYS) { - function SingleSelection () { - SingleSelection.__super__.constructor.apply(this, arguments); - } - - Utils.Extend(SingleSelection, BaseSelection); - - SingleSelection.prototype.render = function () { - var $selection = SingleSelection.__super__.render.call(this); - - $selection.addClass('select2-selection--single'); - - $selection.html( - '<span class="select2-selection__rendered"></span>' + - '<span class="select2-selection__arrow" role="presentation">' + - '<b role="presentation"></b>' + - '</span>' - ); - - return $selection; - }; - - SingleSelection.prototype.bind = function (container, $container) { - var self = this; - - SingleSelection.__super__.bind.apply(this, arguments); - - var id = container.id + '-container'; - - this.$selection.find('.select2-selection__rendered').attr('id', id); - this.$selection.attr('aria-labelledby', id); - - this.$selection.on('mousedown', function (evt) { - // Only respond to left clicks - if (evt.which !== 1) { - return; - } - - self.trigger('toggle', { - originalEvent: evt - }); - }); - - this.$selection.on('focus', function (evt) { - // User focuses on the container - }); - - this.$selection.on('blur', function (evt) { - // User exits the container - }); - - container.on('selection:update', function (params) { - self.update(params.data); - }); - }; - - SingleSelection.prototype.clear = function () { - this.$selection.find('.select2-selection__rendered').empty(); - }; - - SingleSelection.prototype.display = function (data) { - var template = this.options.get('templateSelection'); - var escapeMarkup = this.options.get('escapeMarkup'); - - return escapeMarkup(template(data)); - }; - - SingleSelection.prototype.selectionContainer = function () { - return $('<span></span>'); - }; - - SingleSelection.prototype.update = function (data) { - if (data.length === 0) { - this.clear(); - return; - } - - var selection = data[0]; - - var formatted = this.display(selection); - - var $rendered = this.$selection.find('.select2-selection__rendered'); - $rendered.empty().append(formatted); - $rendered.prop('title', selection.title || selection.text); - }; - - return SingleSelection; -}); - -define('select2/selection/multiple',[ - 'jquery', - './base', - '../utils' -], function ($, BaseSelection, Utils) { - function MultipleSelection ($element, options) { - MultipleSelection.__super__.constructor.apply(this, arguments); - } - - Utils.Extend(MultipleSelection, BaseSelection); - - MultipleSelection.prototype.render = function () { - var $selection = MultipleSelection.__super__.render.call(this); - - $selection.addClass('select2-selection--multiple'); - - $selection.html( - '<ul class="select2-selection__rendered"></ul>' - ); - - return $selection; - }; - - MultipleSelection.prototype.bind = function (container, $container) { - var self = this; - - MultipleSelection.__super__.bind.apply(this, arguments); - - this.$selection.on('click', function (evt) { - self.trigger('toggle', { - originalEvent: evt - }); - }); - - this.$selection.on('click', '.select2-selection__choice__remove', - function (evt) { - var $remove = $(this); - var $selection = $remove.parent(); - - var data = $selection.data('data'); - - self.trigger('unselect', { - originalEvent: evt, - data: data - }); - }); - }; - - MultipleSelection.prototype.clear = function () { - this.$selection.find('.select2-selection__rendered').empty(); - }; - - MultipleSelection.prototype.display = function (data) { - var template = this.options.get('templateSelection'); - var escapeMarkup = this.options.get('escapeMarkup'); - - return escapeMarkup(template(data)); - }; - - MultipleSelection.prototype.selectionContainer = function () { - var $container = $( - '<li class="select2-selection__choice">' + - '<span class="select2-selection__choice__remove" role="presentation">' + - '×' + - '</span>' + - '</li>' - ); - - return $container; - }; - - MultipleSelection.prototype.update = function (data) { - this.clear(); - - if (data.length === 0) { - return; - } - - var $selections = []; - - for (var d = 0; d < data.length; d++) { - var selection = data[d]; - - var formatted = this.display(selection); - var $selection = this.selectionContainer(); - - $selection.append(formatted); - $selection.prop('title', selection.title || selection.text); - - $selection.data('data', selection); - - $selections.push($selection); - } - - this.$selection.find('.select2-selection__rendered').append($selections); - }; - - return MultipleSelection; -}); - -define('select2/selection/placeholder',[ - '../utils' -], function (Utils) { - function Placeholder (decorated, $element, options) { - this.placeholder = this.normalizePlaceholder(options.get('placeholder')); - - decorated.call(this, $element, options); - } - - Placeholder.prototype.normalizePlaceholder = function (_, placeholder) { - if (typeof placeholder === 'string') { - placeholder = { - id: '', - text: placeholder - }; - } - - return placeholder; - }; - - Placeholder.prototype.createPlaceholder = function (decorated, placeholder) { - var $placeholder = this.selectionContainer(); - - $placeholder.html(this.display(placeholder)); - $placeholder.addClass('select2-selection__placeholder') - .removeClass('select2-selection__choice'); - - return $placeholder; - }; - - Placeholder.prototype.update = function (decorated, data) { - var singlePlaceholder = ( - data.length == 1 && data[0].id != this.placeholder.id - ); - var multipleSelections = data.length > 1; - - if (multipleSelections || singlePlaceholder) { - return decorated.call(this, data); - } - - this.clear(); - - var $placeholder = this.createPlaceholder(this.placeholder); - - this.$selection.find('.select2-selection__rendered').append($placeholder); - }; - - return Placeholder; -}); - -define('select2/selection/allowClear',[ - 'jquery' -], function ($) { - function AllowClear () { } - - AllowClear.prototype.bind = function (decorated, container, $container) { - var self = this; - - decorated.call(this, container, $container); - - if (self.placeholder == null) { - if (window.console && console.error) { - console.error( - 'Select2: The `allowClear` option should be used in combination ' + - 'with the `placeholder` option.' - ); - } - } - - this.$selection.on('mousedown', '.select2-selection__clear', - function (evt) { - // Ignore the event if it is disabled - if (self.options.get('disabled')) { - return; - } - - evt.stopPropagation(); - - var data = $(this).data('data'); - - for (var d = 0; d < data.length; d++) { - var unselectData = { - data: data[d] - }; - - // Trigger the `unselect` event, so people can prevent it from being - // cleared. - self.trigger('unselect', unselectData); - - // If the event was prevented, don't clear it out. - if (unselectData.prevented) { - return; - } - } - - self.$element.val(self.placeholder.id).trigger('change'); - - self.trigger('toggle'); - }); - }; - - AllowClear.prototype.update = function (decorated, data) { - decorated.call(this, data); - - if (this.$selection.find('.select2-selection__placeholder').length > 0 || - data.length === 0) { - return; - } - - var $remove = $( - '<span class="select2-selection__clear">' + - '×' + - '</span>' - ); - $remove.data('data', data); - - this.$selection.find('.select2-selection__rendered').append($remove); - }; - - return AllowClear; -}); - -define('select2/selection/search',[ - 'jquery', - '../utils', - '../keys' -], function ($, Utils, KEYS) { - function Search (decorated, $element, options) { - decorated.call(this, $element, options); - } - - Search.prototype.render = function (decorated) { - var $search = $( - '<li class="select2-search select2-search--inline">' + - '<input class="select2-search__field" type="search" tabindex="-1"' + - ' autocomplete="off" autocorrect="off" autocapitalize="off"' + - ' spellcheck="false" role="textbox" />' + - '</li>' - ); - - this.$searchContainer = $search; - this.$search = $search.find('input'); - - var $rendered = decorated.call(this); - - return $rendered; - }; - - Search.prototype.bind = function (decorated, container, $container) { - var self = this; - - decorated.call(this, container, $container); - - container.on('open', function () { - self.$search.attr('tabindex', 0); - - self.$search.focus(); - }); - - container.on('close', function () { - self.$search.attr('tabindex', -1); - - self.$search.val(''); - self.$search.focus(); - }); - - container.on('enable', function () { - self.$search.prop('disabled', false); - }); - - container.on('disable', function () { - self.$search.prop('disabled', true); - }); - - this.$selection.on('focusin', '.select2-search--inline', function (evt) { - self.trigger('focus', evt); - }); - - this.$selection.on('focusout', '.select2-search--inline', function (evt) { - self.trigger('blur', evt); - }); - - this.$selection.on('keydown', '.select2-search--inline', function (evt) { - evt.stopPropagation(); - - self.trigger('keypress', evt); - - self._keyUpPrevented = evt.isDefaultPrevented(); - - var key = evt.which; - - if (key === KEYS.BACKSPACE && self.$search.val() === '') { - var $previousChoice = self.$searchContainer - .prev('.select2-selection__choice'); - - if ($previousChoice.length > 0) { - var item = $previousChoice.data('data'); - - self.searchRemoveChoice(item); - } - } - }); - - // Workaround for browsers which do not support the `input` event - // This will prevent double-triggering of events for browsers which support - // both the `keyup` and `input` events. - this.$selection.on('input', '.select2-search--inline', function (evt) { - // Unbind the duplicated `keyup` event - self.$selection.off('keyup.search'); - }); - - this.$selection.on('keyup.search input', '.select2-search--inline', - function (evt) { - self.handleSearch(evt); - }); - }; - - Search.prototype.createPlaceholder = function (decorated, placeholder) { - this.$search.attr('placeholder', placeholder.text); - }; - - Search.prototype.update = function (decorated, data) { - this.$search.attr('placeholder', ''); - - decorated.call(this, data); - - this.$selection.find('.select2-selection__rendered') - .append(this.$searchContainer); - - this.resizeSearch(); - }; - - Search.prototype.handleSearch = function () { - this.resizeSearch(); - - if (!this._keyUpPrevented) { - var input = this.$search.val(); - - this.trigger('query', { - term: input - }); - } - - this._keyUpPrevented = false; - }; - - Search.prototype.searchRemoveChoice = function (decorated, item) { - this.trigger('unselect', { - data: item - }); - - this.trigger('open'); - - this.$search.val(item.text + ' '); - }; - - Search.prototype.resizeSearch = function () { - this.$search.css('width', '25px'); - - var width = ''; - - if (this.$search.attr('placeholder') !== '') { - width = this.$selection.find('.select2-selection__rendered').innerWidth(); - } else { - var minimumWidth = this.$search.val().length + 1; - - width = (minimumWidth * 0.75) + 'em'; - } - - this.$search.css('width', width); - }; - - return Search; -}); - -define('select2/selection/eventRelay',[ - 'jquery' -], function ($) { - function EventRelay () { } - - EventRelay.prototype.bind = function (decorated, container, $container) { - var self = this; - var relayEvents = [ - 'open', 'opening', - 'close', 'closing', - 'select', 'selecting', - 'unselect', 'unselecting' - ]; - - var preventableEvents = ['opening', 'closing', 'selecting', 'unselecting']; - - decorated.call(this, container, $container); - - container.on('*', function (name, params) { - // Ignore events that should not be relayed - if ($.inArray(name, relayEvents) === -1) { - return; - } - - // The parameters should always be an object - params = params || {}; - - // Generate the jQuery event for the Select2 event - var evt = $.Event('select2:' + name, { - params: params - }); - - self.$element.trigger(evt); - - // Only handle preventable events if it was one - if ($.inArray(name, preventableEvents) === -1) { - return; - } - - params.prevented = evt.isDefaultPrevented(); - }); - }; - - return EventRelay; -}); - -define('select2/translation',[ - 'jquery' -], function ($) { - function Translation (dict) { - this.dict = dict || {}; - } - - Translation.prototype.all = function () { - return this.dict; - }; - - Translation.prototype.get = function (key) { - return this.dict[key]; - }; - - Translation.prototype.extend = function (translation) { - this.dict = $.extend({}, translation.all(), this.dict); - }; - - // Static functions - - Translation._cache = {}; - - Translation.loadPath = function (path) { - if (!(path in Translation._cache)) { - var translations = require(path); - - Translation._cache[path] = translations; - } - - return new Translation(Translation._cache[path]); - }; - - return Translation; -}); - -define('select2/diacritics',[ - -], function () { - var diacritics = { - '\u24B6': 'A', - '\uFF21': 'A', - '\u00C0': 'A', - '\u00C1': 'A', - '\u00C2': 'A', - '\u1EA6': 'A', - '\u1EA4': 'A', - '\u1EAA': 'A', - '\u1EA8': 'A', - '\u00C3': 'A', - '\u0100': 'A', - '\u0102': 'A', - '\u1EB0': 'A', - '\u1EAE': 'A', - '\u1EB4': 'A', - '\u1EB2': 'A', - '\u0226': 'A', - '\u01E0': 'A', - '\u00C4': 'A', - '\u01DE': 'A', - '\u1EA2': 'A', - '\u00C5': 'A', - '\u01FA': 'A', - '\u01CD': 'A', - '\u0200': 'A', - '\u0202': 'A', - '\u1EA0': 'A', - '\u1EAC': 'A', - '\u1EB6': 'A', - '\u1E00': 'A', - '\u0104': 'A', - '\u023A': 'A', - '\u2C6F': 'A', - '\uA732': 'AA', - '\u00C6': 'AE', - '\u01FC': 'AE', - '\u01E2': 'AE', - '\uA734': 'AO', - '\uA736': 'AU', - '\uA738': 'AV', - '\uA73A': 'AV', - '\uA73C': 'AY', - '\u24B7': 'B', - '\uFF22': 'B', - '\u1E02': 'B', - '\u1E04': 'B', - '\u1E06': 'B', - '\u0243': 'B', - '\u0182': 'B', - '\u0181': 'B', - '\u24B8': 'C', - '\uFF23': 'C', - '\u0106': 'C', - '\u0108': 'C', - '\u010A': 'C', - '\u010C': 'C', - '\u00C7': 'C', - '\u1E08': 'C', - '\u0187': 'C', - '\u023B': 'C', - '\uA73E': 'C', - '\u24B9': 'D', - '\uFF24': 'D', - '\u1E0A': 'D', - '\u010E': 'D', - '\u1E0C': 'D', - '\u1E10': 'D', - '\u1E12': 'D', - '\u1E0E': 'D', - '\u0110': 'D', - '\u018B': 'D', - '\u018A': 'D', - '\u0189': 'D', - '\uA779': 'D', - '\u01F1': 'DZ', - '\u01C4': 'DZ', - '\u01F2': 'Dz', - '\u01C5': 'Dz', - '\u24BA': 'E', - '\uFF25': 'E', - '\u00C8': 'E', - '\u00C9': 'E', - '\u00CA': 'E', - '\u1EC0': 'E', - '\u1EBE': 'E', - '\u1EC4': 'E', - '\u1EC2': 'E', - '\u1EBC': 'E', - '\u0112': 'E', - '\u1E14': 'E', - '\u1E16': 'E', - '\u0114': 'E', - '\u0116': 'E', - '\u00CB': 'E', - '\u1EBA': 'E', - '\u011A': 'E', - '\u0204': 'E', - '\u0206': 'E', - '\u1EB8': 'E', - '\u1EC6': 'E', - '\u0228': 'E', - '\u1E1C': 'E', - '\u0118': 'E', - '\u1E18': 'E', - '\u1E1A': 'E', - '\u0190': 'E', - '\u018E': 'E', - '\u24BB': 'F', - '\uFF26': 'F', - '\u1E1E': 'F', - '\u0191': 'F', - '\uA77B': 'F', - '\u24BC': 'G', - '\uFF27': 'G', - '\u01F4': 'G', - '\u011C': 'G', - '\u1E20': 'G', - '\u011E': 'G', - '\u0120': 'G', - '\u01E6': 'G', - '\u0122': 'G', - '\u01E4': 'G', - '\u0193': 'G', - '\uA7A0': 'G', - '\uA77D': 'G', - '\uA77E': 'G', - '\u24BD': 'H', - '\uFF28': 'H', - '\u0124': 'H', - '\u1E22': 'H', - '\u1E26': 'H', - '\u021E': 'H', - '\u1E24': 'H', - '\u1E28': 'H', - '\u1E2A': 'H', - '\u0126': 'H', - '\u2C67': 'H', - '\u2C75': 'H', - '\uA78D': 'H', - '\u24BE': 'I', - '\uFF29': 'I', - '\u00CC': 'I', - '\u00CD': 'I', - '\u00CE': 'I', - '\u0128': 'I', - '\u012A': 'I', - '\u012C': 'I', - '\u0130': 'I', - '\u00CF': 'I', - '\u1E2E': 'I', - '\u1EC8': 'I', - '\u01CF': 'I', - '\u0208': 'I', - '\u020A': 'I', - '\u1ECA': 'I', - '\u012E': 'I', - '\u1E2C': 'I', - '\u0197': 'I', - '\u24BF': 'J', - '\uFF2A': 'J', - '\u0134': 'J', - '\u0248': 'J', - '\u24C0': 'K', - '\uFF2B': 'K', - '\u1E30': 'K', - '\u01E8': 'K', - '\u1E32': 'K', - '\u0136': 'K', - '\u1E34': 'K', - '\u0198': 'K', - '\u2C69': 'K', - '\uA740': 'K', - '\uA742': 'K', - '\uA744': 'K', - '\uA7A2': 'K', - '\u24C1': 'L', - '\uFF2C': 'L', - '\u013F': 'L', - '\u0139': 'L', - '\u013D': 'L', - '\u1E36': 'L', - '\u1E38': 'L', - '\u013B': 'L', - '\u1E3C': 'L', - '\u1E3A': 'L', - '\u0141': 'L', - '\u023D': 'L', - '\u2C62': 'L', - '\u2C60': 'L', - '\uA748': 'L', - '\uA746': 'L', - '\uA780': 'L', - '\u01C7': 'LJ', - '\u01C8': 'Lj', - '\u24C2': 'M', - '\uFF2D': 'M', - '\u1E3E': 'M', - '\u1E40': 'M', - '\u1E42': 'M', - '\u2C6E': 'M', - '\u019C': 'M', - '\u24C3': 'N', - '\uFF2E': 'N', - '\u01F8': 'N', - '\u0143': 'N', - '\u00D1': 'N', - '\u1E44': 'N', - '\u0147': 'N', - '\u1E46': 'N', - '\u0145': 'N', - '\u1E4A': 'N', - '\u1E48': 'N', - '\u0220': 'N', - '\u019D': 'N', - '\uA790': 'N', - '\uA7A4': 'N', - '\u01CA': 'NJ', - '\u01CB': 'Nj', - '\u24C4': 'O', - '\uFF2F': 'O', - '\u00D2': 'O', - '\u00D3': 'O', - '\u00D4': 'O', - '\u1ED2': 'O', - '\u1ED0': 'O', - '\u1ED6': 'O', - '\u1ED4': 'O', - '\u00D5': 'O', - '\u1E4C': 'O', - '\u022C': 'O', - '\u1E4E': 'O', - '\u014C': 'O', - '\u1E50': 'O', - '\u1E52': 'O', - '\u014E': 'O', - '\u022E': 'O', - '\u0230': 'O', - '\u00D6': 'O', - '\u022A': 'O', - '\u1ECE': 'O', - '\u0150': 'O', - '\u01D1': 'O', - '\u020C': 'O', - '\u020E': 'O', - '\u01A0': 'O', - '\u1EDC': 'O', - '\u1EDA': 'O', - '\u1EE0': 'O', - '\u1EDE': 'O', - '\u1EE2': 'O', - '\u1ECC': 'O', - '\u1ED8': 'O', - '\u01EA': 'O', - '\u01EC': 'O', - '\u00D8': 'O', - '\u01FE': 'O', - '\u0186': 'O', - '\u019F': 'O', - '\uA74A': 'O', - '\uA74C': 'O', - '\u01A2': 'OI', - '\uA74E': 'OO', - '\u0222': 'OU', - '\u24C5': 'P', - '\uFF30': 'P', - '\u1E54': 'P', - '\u1E56': 'P', - '\u01A4': 'P', - '\u2C63': 'P', - '\uA750': 'P', - '\uA752': 'P', - '\uA754': 'P', - '\u24C6': 'Q', - '\uFF31': 'Q', - '\uA756': 'Q', - '\uA758': 'Q', - '\u024A': 'Q', - '\u24C7': 'R', - '\uFF32': 'R', - '\u0154': 'R', - '\u1E58': 'R', - '\u0158': 'R', - '\u0210': 'R', - '\u0212': 'R', - '\u1E5A': 'R', - '\u1E5C': 'R', - '\u0156': 'R', - '\u1E5E': 'R', - '\u024C': 'R', - '\u2C64': 'R', - '\uA75A': 'R', - '\uA7A6': 'R', - '\uA782': 'R', - '\u24C8': 'S', - '\uFF33': 'S', - '\u1E9E': 'S', - '\u015A': 'S', - '\u1E64': 'S', - '\u015C': 'S', - '\u1E60': 'S', - '\u0160': 'S', - '\u1E66': 'S', - '\u1E62': 'S', - '\u1E68': 'S', - '\u0218': 'S', - '\u015E': 'S', - '\u2C7E': 'S', - '\uA7A8': 'S', - '\uA784': 'S', - '\u24C9': 'T', - '\uFF34': 'T', - '\u1E6A': 'T', - '\u0164': 'T', - '\u1E6C': 'T', - '\u021A': 'T', - '\u0162': 'T', - '\u1E70': 'T', - '\u1E6E': 'T', - '\u0166': 'T', - '\u01AC': 'T', - '\u01AE': 'T', - '\u023E': 'T', - '\uA786': 'T', - '\uA728': 'TZ', - '\u24CA': 'U', - '\uFF35': 'U', - '\u00D9': 'U', - '\u00DA': 'U', - '\u00DB': 'U', - '\u0168': 'U', - '\u1E78': 'U', - '\u016A': 'U', - '\u1E7A': 'U', - '\u016C': 'U', - '\u00DC': 'U', - '\u01DB': 'U', - '\u01D7': 'U', - '\u01D5': 'U', - '\u01D9': 'U', - '\u1EE6': 'U', - '\u016E': 'U', - '\u0170': 'U', - '\u01D3': 'U', - '\u0214': 'U', - '\u0216': 'U', - '\u01AF': 'U', - '\u1EEA': 'U', - '\u1EE8': 'U', - '\u1EEE': 'U', - '\u1EEC': 'U', - '\u1EF0': 'U', - '\u1EE4': 'U', - '\u1E72': 'U', - '\u0172': 'U', - '\u1E76': 'U', - '\u1E74': 'U', - '\u0244': 'U', - '\u24CB': 'V', - '\uFF36': 'V', - '\u1E7C': 'V', - '\u1E7E': 'V', - '\u01B2': 'V', - '\uA75E': 'V', - '\u0245': 'V', - '\uA760': 'VY', - '\u24CC': 'W', - '\uFF37': 'W', - '\u1E80': 'W', - '\u1E82': 'W', - '\u0174': 'W', - '\u1E86': 'W', - '\u1E84': 'W', - '\u1E88': 'W', - '\u2C72': 'W', - '\u24CD': 'X', - '\uFF38': 'X', - '\u1E8A': 'X', - '\u1E8C': 'X', - '\u24CE': 'Y', - '\uFF39': 'Y', - '\u1EF2': 'Y', - '\u00DD': 'Y', - '\u0176': 'Y', - '\u1EF8': 'Y', - '\u0232': 'Y', - '\u1E8E': 'Y', - '\u0178': 'Y', - '\u1EF6': 'Y', - '\u1EF4': 'Y', - '\u01B3': 'Y', - '\u024E': 'Y', - '\u1EFE': 'Y', - '\u24CF': 'Z', - '\uFF3A': 'Z', - '\u0179': 'Z', - '\u1E90': 'Z', - '\u017B': 'Z', - '\u017D': 'Z', - '\u1E92': 'Z', - '\u1E94': 'Z', - '\u01B5': 'Z', - '\u0224': 'Z', - '\u2C7F': 'Z', - '\u2C6B': 'Z', - '\uA762': 'Z', - '\u24D0': 'a', - '\uFF41': 'a', - '\u1E9A': 'a', - '\u00E0': 'a', - '\u00E1': 'a', - '\u00E2': 'a', - '\u1EA7': 'a', - '\u1EA5': 'a', - '\u1EAB': 'a', - '\u1EA9': 'a', - '\u00E3': 'a', - '\u0101': 'a', - '\u0103': 'a', - '\u1EB1': 'a', - '\u1EAF': 'a', - '\u1EB5': 'a', - '\u1EB3': 'a', - '\u0227': 'a', - '\u01E1': 'a', - '\u00E4': 'a', - '\u01DF': 'a', - '\u1EA3': 'a', - '\u00E5': 'a', - '\u01FB': 'a', - '\u01CE': 'a', - '\u0201': 'a', - '\u0203': 'a', - '\u1EA1': 'a', - '\u1EAD': 'a', - '\u1EB7': 'a', - '\u1E01': 'a', - '\u0105': 'a', - '\u2C65': 'a', - '\u0250': 'a', - '\uA733': 'aa', - '\u00E6': 'ae', - '\u01FD': 'ae', - '\u01E3': 'ae', - '\uA735': 'ao', - '\uA737': 'au', - '\uA739': 'av', - '\uA73B': 'av', - '\uA73D': 'ay', - '\u24D1': 'b', - '\uFF42': 'b', - '\u1E03': 'b', - '\u1E05': 'b', - '\u1E07': 'b', - '\u0180': 'b', - '\u0183': 'b', - '\u0253': 'b', - '\u24D2': 'c', - '\uFF43': 'c', - '\u0107': 'c', - '\u0109': 'c', - '\u010B': 'c', - '\u010D': 'c', - '\u00E7': 'c', - '\u1E09': 'c', - '\u0188': 'c', - '\u023C': 'c', - '\uA73F': 'c', - '\u2184': 'c', - '\u24D3': 'd', - '\uFF44': 'd', - '\u1E0B': 'd', - '\u010F': 'd', - '\u1E0D': 'd', - '\u1E11': 'd', - '\u1E13': 'd', - '\u1E0F': 'd', - '\u0111': 'd', - '\u018C': 'd', - '\u0256': 'd', - '\u0257': 'd', - '\uA77A': 'd', - '\u01F3': 'dz', - '\u01C6': 'dz', - '\u24D4': 'e', - '\uFF45': 'e', - '\u00E8': 'e', - '\u00E9': 'e', - '\u00EA': 'e', - '\u1EC1': 'e', - '\u1EBF': 'e', - '\u1EC5': 'e', - '\u1EC3': 'e', - '\u1EBD': 'e', - '\u0113': 'e', - '\u1E15': 'e', - '\u1E17': 'e', - '\u0115': 'e', - '\u0117': 'e', - '\u00EB': 'e', - '\u1EBB': 'e', - '\u011B': 'e', - '\u0205': 'e', - '\u0207': 'e', - '\u1EB9': 'e', - '\u1EC7': 'e', - '\u0229': 'e', - '\u1E1D': 'e', - '\u0119': 'e', - '\u1E19': 'e', - '\u1E1B': 'e', - '\u0247': 'e', - '\u025B': 'e', - '\u01DD': 'e', - '\u24D5': 'f', - '\uFF46': 'f', - '\u1E1F': 'f', - '\u0192': 'f', - '\uA77C': 'f', - '\u24D6': 'g', - '\uFF47': 'g', - '\u01F5': 'g', - '\u011D': 'g', - '\u1E21': 'g', - '\u011F': 'g', - '\u0121': 'g', - '\u01E7': 'g', - '\u0123': 'g', - '\u01E5': 'g', - '\u0260': 'g', - '\uA7A1': 'g', - '\u1D79': 'g', - '\uA77F': 'g', - '\u24D7': 'h', - '\uFF48': 'h', - '\u0125': 'h', - '\u1E23': 'h', - '\u1E27': 'h', - '\u021F': 'h', - '\u1E25': 'h', - '\u1E29': 'h', - '\u1E2B': 'h', - '\u1E96': 'h', - '\u0127': 'h', - '\u2C68': 'h', - '\u2C76': 'h', - '\u0265': 'h', - '\u0195': 'hv', - '\u24D8': 'i', - '\uFF49': 'i', - '\u00EC': 'i', - '\u00ED': 'i', - '\u00EE': 'i', - '\u0129': 'i', - '\u012B': 'i', - '\u012D': 'i', - '\u00EF': 'i', - '\u1E2F': 'i', - '\u1EC9': 'i', - '\u01D0': 'i', - '\u0209': 'i', - '\u020B': 'i', - '\u1ECB': 'i', - '\u012F': 'i', - '\u1E2D': 'i', - '\u0268': 'i', - '\u0131': 'i', - '\u24D9': 'j', - '\uFF4A': 'j', - '\u0135': 'j', - '\u01F0': 'j', - '\u0249': 'j', - '\u24DA': 'k', - '\uFF4B': 'k', - '\u1E31': 'k', - '\u01E9': 'k', - '\u1E33': 'k', - '\u0137': 'k', - '\u1E35': 'k', - '\u0199': 'k', - '\u2C6A': 'k', - '\uA741': 'k', - '\uA743': 'k', - '\uA745': 'k', - '\uA7A3': 'k', - '\u24DB': 'l', - '\uFF4C': 'l', - '\u0140': 'l', - '\u013A': 'l', - '\u013E': 'l', - '\u1E37': 'l', - '\u1E39': 'l', - '\u013C': 'l', - '\u1E3D': 'l', - '\u1E3B': 'l', - '\u017F': 'l', - '\u0142': 'l', - '\u019A': 'l', - '\u026B': 'l', - '\u2C61': 'l', - '\uA749': 'l', - '\uA781': 'l', - '\uA747': 'l', - '\u01C9': 'lj', - '\u24DC': 'm', - '\uFF4D': 'm', - '\u1E3F': 'm', - '\u1E41': 'm', - '\u1E43': 'm', - '\u0271': 'm', - '\u026F': 'm', - '\u24DD': 'n', - '\uFF4E': 'n', - '\u01F9': 'n', - '\u0144': 'n', - '\u00F1': 'n', - '\u1E45': 'n', - '\u0148': 'n', - '\u1E47': 'n', - '\u0146': 'n', - '\u1E4B': 'n', - '\u1E49': 'n', - '\u019E': 'n', - '\u0272': 'n', - '\u0149': 'n', - '\uA791': 'n', - '\uA7A5': 'n', - '\u01CC': 'nj', - '\u24DE': 'o', - '\uFF4F': 'o', - '\u00F2': 'o', - '\u00F3': 'o', - '\u00F4': 'o', - '\u1ED3': 'o', - '\u1ED1': 'o', - '\u1ED7': 'o', - '\u1ED5': 'o', - '\u00F5': 'o', - '\u1E4D': 'o', - '\u022D': 'o', - '\u1E4F': 'o', - '\u014D': 'o', - '\u1E51': 'o', - '\u1E53': 'o', - '\u014F': 'o', - '\u022F': 'o', - '\u0231': 'o', - '\u00F6': 'o', - '\u022B': 'o', - '\u1ECF': 'o', - '\u0151': 'o', - '\u01D2': 'o', - '\u020D': 'o', - '\u020F': 'o', - '\u01A1': 'o', - '\u1EDD': 'o', - '\u1EDB': 'o', - '\u1EE1': 'o', - '\u1EDF': 'o', - '\u1EE3': 'o', - '\u1ECD': 'o', - '\u1ED9': 'o', - '\u01EB': 'o', - '\u01ED': 'o', - '\u00F8': 'o', - '\u01FF': 'o', - '\u0254': 'o', - '\uA74B': 'o', - '\uA74D': 'o', - '\u0275': 'o', - '\u01A3': 'oi', - '\u0223': 'ou', - '\uA74F': 'oo', - '\u24DF': 'p', - '\uFF50': 'p', - '\u1E55': 'p', - '\u1E57': 'p', - '\u01A5': 'p', - '\u1D7D': 'p', - '\uA751': 'p', - '\uA753': 'p', - '\uA755': 'p', - '\u24E0': 'q', - '\uFF51': 'q', - '\u024B': 'q', - '\uA757': 'q', - '\uA759': 'q', - '\u24E1': 'r', - '\uFF52': 'r', - '\u0155': 'r', - '\u1E59': 'r', - '\u0159': 'r', - '\u0211': 'r', - '\u0213': 'r', - '\u1E5B': 'r', - '\u1E5D': 'r', - '\u0157': 'r', - '\u1E5F': 'r', - '\u024D': 'r', - '\u027D': 'r', - '\uA75B': 'r', - '\uA7A7': 'r', - '\uA783': 'r', - '\u24E2': 's', - '\uFF53': 's', - '\u00DF': 's', - '\u015B': 's', - '\u1E65': 's', - '\u015D': 's', - '\u1E61': 's', - '\u0161': 's', - '\u1E67': 's', - '\u1E63': 's', - '\u1E69': 's', - '\u0219': 's', - '\u015F': 's', - '\u023F': 's', - '\uA7A9': 's', - '\uA785': 's', - '\u1E9B': 's', - '\u24E3': 't', - '\uFF54': 't', - '\u1E6B': 't', - '\u1E97': 't', - '\u0165': 't', - '\u1E6D': 't', - '\u021B': 't', - '\u0163': 't', - '\u1E71': 't', - '\u1E6F': 't', - '\u0167': 't', - '\u01AD': 't', - '\u0288': 't', - '\u2C66': 't', - '\uA787': 't', - '\uA729': 'tz', - '\u24E4': 'u', - '\uFF55': 'u', - '\u00F9': 'u', - '\u00FA': 'u', - '\u00FB': 'u', - '\u0169': 'u', - '\u1E79': 'u', - '\u016B': 'u', - '\u1E7B': 'u', - '\u016D': 'u', - '\u00FC': 'u', - '\u01DC': 'u', - '\u01D8': 'u', - '\u01D6': 'u', - '\u01DA': 'u', - '\u1EE7': 'u', - '\u016F': 'u', - '\u0171': 'u', - '\u01D4': 'u', - '\u0215': 'u', - '\u0217': 'u', - '\u01B0': 'u', - '\u1EEB': 'u', - '\u1EE9': 'u', - '\u1EEF': 'u', - '\u1EED': 'u', - '\u1EF1': 'u', - '\u1EE5': 'u', - '\u1E73': 'u', - '\u0173': 'u', - '\u1E77': 'u', - '\u1E75': 'u', - '\u0289': 'u', - '\u24E5': 'v', - '\uFF56': 'v', - '\u1E7D': 'v', - '\u1E7F': 'v', - '\u028B': 'v', - '\uA75F': 'v', - '\u028C': 'v', - '\uA761': 'vy', - '\u24E6': 'w', - '\uFF57': 'w', - '\u1E81': 'w', - '\u1E83': 'w', - '\u0175': 'w', - '\u1E87': 'w', - '\u1E85': 'w', - '\u1E98': 'w', - '\u1E89': 'w', - '\u2C73': 'w', - '\u24E7': 'x', - '\uFF58': 'x', - '\u1E8B': 'x', - '\u1E8D': 'x', - '\u24E8': 'y', - '\uFF59': 'y', - '\u1EF3': 'y', - '\u00FD': 'y', - '\u0177': 'y', - '\u1EF9': 'y', - '\u0233': 'y', - '\u1E8F': 'y', - '\u00FF': 'y', - '\u1EF7': 'y', - '\u1E99': 'y', - '\u1EF5': 'y', - '\u01B4': 'y', - '\u024F': 'y', - '\u1EFF': 'y', - '\u24E9': 'z', - '\uFF5A': 'z', - '\u017A': 'z', - '\u1E91': 'z', - '\u017C': 'z', - '\u017E': 'z', - '\u1E93': 'z', - '\u1E95': 'z', - '\u01B6': 'z', - '\u0225': 'z', - '\u0240': 'z', - '\u2C6C': 'z', - '\uA763': 'z', - '\u0386': '\u0391', - '\u0388': '\u0395', - '\u0389': '\u0397', - '\u038A': '\u0399', - '\u03AA': '\u0399', - '\u038C': '\u039F', - '\u038E': '\u03A5', - '\u03AB': '\u03A5', - '\u038F': '\u03A9', - '\u03AC': '\u03B1', - '\u03AD': '\u03B5', - '\u03AE': '\u03B7', - '\u03AF': '\u03B9', - '\u03CA': '\u03B9', - '\u0390': '\u03B9', - '\u03CC': '\u03BF', - '\u03CD': '\u03C5', - '\u03CB': '\u03C5', - '\u03B0': '\u03C5', - '\u03C9': '\u03C9', - '\u03C2': '\u03C3' - }; - - return diacritics; -}); - -define('select2/data/base',[ - '../utils' -], function (Utils) { - function BaseAdapter ($element, options) { - BaseAdapter.__super__.constructor.call(this); - } - - Utils.Extend(BaseAdapter, Utils.Observable); - - BaseAdapter.prototype.current = function (callback) { - throw new Error('The `current` method must be defined in child classes.'); - }; - - BaseAdapter.prototype.query = function (params, callback) { - throw new Error('The `query` method must be defined in child classes.'); - }; - - BaseAdapter.prototype.bind = function (container, $container) { - // Can be implemented in subclasses - }; - - BaseAdapter.prototype.destroy = function () { - // Can be implemented in subclasses - }; - - BaseAdapter.prototype.generateResultId = function (container, data) { - var id = container.id + '-result-'; - - id += Utils.generateChars(4); - - if (data.id != null) { - id += '-' + data.id.toString(); - } else { - id += '-' + Utils.generateChars(4); - } - return id; - }; - - return BaseAdapter; -}); - -define('select2/data/select',[ - './base', - '../utils', - 'jquery' -], function (BaseAdapter, Utils, $) { - function SelectAdapter ($element, options) { - this.$element = $element; - this.options = options; - - SelectAdapter.__super__.constructor.call(this); - } - - Utils.Extend(SelectAdapter, BaseAdapter); - - SelectAdapter.prototype.current = function (callback) { - var data = []; - var self = this; - - this.$element.find(':selected').each(function () { - var $option = $(this); - - var option = self.item($option); - - data.push(option); - }); - - callback(data); - }; - - SelectAdapter.prototype.select = function (data) { - var self = this; - - // If data.element is a DOM nose, use it instead - if ($(data.element).is('option')) { - data.element.selected = true; - - this.$element.trigger('change'); - - return; - } - - if (this.$element.prop('multiple')) { - this.current(function (currentData) { - var val = []; - - data = [data]; - data.push.apply(data, currentData); - - for (var d = 0; d < data.length; d++) { - var id = data[d].id; - - if ($.inArray(id, val) === -1) { - val.push(id); - } - } - - self.$element.val(val); - self.$element.trigger('change'); - }); - } else { - var val = data.id; - - this.$element.val(val); - this.$element.trigger('change'); - } - }; - - SelectAdapter.prototype.unselect = function (data) { - var self = this; - - if (!this.$element.prop('multiple')) { - return; - } - - if ($(data.element).is('option')) { - data.element.selected = false; - - this.$element.trigger('change'); - - return; - } - - this.current(function (currentData) { - var val = []; - - for (var d = 0; d < currentData.length; d++) { - var id = currentData[d].id; - - if (id !== data.id && $.inArray(id, val) === -1) { - val.push(id); - } - } - - self.$element.val(val); - - self.$element.trigger('change'); - }); - }; - - SelectAdapter.prototype.bind = function (container, $container) { - var self = this; - - this.container = container; - - container.on('select', function (params) { - self.select(params.data); - }); - - container.on('unselect', function (params) { - self.unselect(params.data); - }); - }; - - SelectAdapter.prototype.destroy = function () { - // Remove anything added to child elements - this.$element.find('*').each(function () { - // Remove any custom data set by Select2 - $.removeData(this, 'data'); - }); - }; - - SelectAdapter.prototype.query = function (params, callback) { - var data = []; - var self = this; - - var $options = this.$element.children(); - - $options.each(function () { - var $option = $(this); - - if (!$option.is('option') && !$option.is('optgroup')) { - return; - } - - var option = self.item($option); - - var matches = self.matches(params, option); - - if (matches !== null) { - data.push(matches); - } - }); - - callback({ - results: data - }); - }; - - SelectAdapter.prototype.addOptions = function ($options) { - this.$element.append($options); - }; - - SelectAdapter.prototype.option = function (data) { - var option; - - if (data.children) { - option = document.createElement('optgroup'); - option.label = data.text; - } else { - option = document.createElement('option'); - - if (option.textContent !== undefined) { - option.textContent = data.text; - } else { - option.innerText = data.text; - } - } - - if (data.id) { - option.value = data.id; - } - - if (data.disabled) { - option.disabled = true; - } - - if (data.selected) { - option.selected = true; - } - - if (data.title) { - option.title = data.title; - } - - var $option = $(option); - - var normalizedData = this._normalizeItem(data); - normalizedData.element = option; - - // Override the option's data with the combined data - $.data(option, 'data', normalizedData); - - return $option; - }; - - SelectAdapter.prototype.item = function ($option) { - var data = {}; - - data = $.data($option[0], 'data'); - - if (data != null) { - return data; - } - - if ($option.is('option')) { - data = { - id: $option.val(), - text: $option.html(), - disabled: $option.prop('disabled'), - selected: $option.prop('selected'), - title: $option.prop('title') - }; - } else if ($option.is('optgroup')) { - data = { - text: $option.prop('label'), - children: [], - title: $option.prop('title') - }; - - var $children = $option.children('option'); - var children = []; - - for (var c = 0; c < $children.length; c++) { - var $child = $($children[c]); - - var child = this.item($child); - - children.push(child); - } - - data.children = children; - } - - data = this._normalizeItem(data); - data.element = $option[0]; - - $.data($option[0], 'data', data); - - return data; - }; - - SelectAdapter.prototype._normalizeItem = function (item) { - if (!$.isPlainObject(item)) { - item = { - id: item, - text: item - }; - } - - item = $.extend({}, { - text: '' - }, item); - - var defaults = { - selected: false, - disabled: false - }; - - if (item.id != null) { - item.id = item.id.toString(); - } - - if (item.text != null) { - item.text = item.text.toString(); - } - - if (item._resultId == null && item.id && this.container != null) { - item._resultId = this.generateResultId(this.container, item); - } - - return $.extend({}, defaults, item); - }; - - SelectAdapter.prototype.matches = function (params, data) { - var matcher = this.options.get('matcher'); - - return matcher(params, data); - }; - - return SelectAdapter; -}); - -define('select2/data/array',[ - './select', - '../utils', - 'jquery' -], function (SelectAdapter, Utils, $) { - function ArrayAdapter ($element, options) { - var data = options.get('data') || []; - - ArrayAdapter.__super__.constructor.call(this, $element, options); - - this.addOptions(this.convertToOptions(data)); - } - - Utils.Extend(ArrayAdapter, SelectAdapter); - - ArrayAdapter.prototype.select = function (data) { - var $option = this.$element.find('option[value="' + data.id + '"]'); - - if ($option.length === 0) { - $option = this.option(data); - - this.addOptions([$option]); - } - - ArrayAdapter.__super__.select.call(this, data); - }; - - ArrayAdapter.prototype.convertToOptions = function (data) { - var self = this; - - var $existing = this.$element.find('option'); - var existingIds = $existing.map(function () { - return self.item($(this)).id; - }).get(); - - var $options = []; - - // Filter out all items except for the one passed in the argument - function onlyItem (item) { - return function () { - return $(this).val() == item.id; - }; - } - - for (var d = 0; d < data.length; d++) { - var item = this._normalizeItem(data[d]); - - // Skip items which were pre-loaded, only merge the data - if ($.inArray(item.id, existingIds) >= 0) { - var $existingOption = $existing.filter(onlyItem(item)); - - var existingData = this.item($existingOption); - var newData = $.extend(true, {}, existingData, item); - - var $newOption = this.option(existingData); - - $existingOption.replaceWith($newOption); - - continue; - } - - var $option = this.option(item); - - if (item.children) { - var $children = this.convertToOptions(item.children); - - $option.append($children); - } - - $options.push($option); - } - - return $options; - }; - - return ArrayAdapter; -}); - -define('select2/data/ajax',[ - './array', - '../utils', - 'jquery' -], function (ArrayAdapter, Utils, $) { - function AjaxAdapter ($element, options) { - this.ajaxOptions = this._applyDefaults(options.get('ajax')); - - if (this.ajaxOptions.processResults != null) { - this.processResults = this.ajaxOptions.processResults; - } - - ArrayAdapter.__super__.constructor.call(this, $element, options); - } - - Utils.Extend(AjaxAdapter, ArrayAdapter); - - AjaxAdapter.prototype._applyDefaults = function (options) { - var defaults = { - data: function (params) { - return { - q: params.term - }; - }, - transport: function (params, success, failure) { - var $request = $.ajax(params); - - $request.then(success); - $request.fail(failure); - - return $request; - } - }; - - return $.extend({}, defaults, options, true); - }; - - AjaxAdapter.prototype.processResults = function (results) { - return results; - }; - - AjaxAdapter.prototype.query = function (params, callback) { - var matches = []; - var self = this; - - if (this._request) { - this._request.abort(); - this._request = null; - } - - var options = $.extend({ - type: 'GET' - }, this.ajaxOptions); - - if (typeof options.url === 'function') { - options.url = options.url(params); - } - - if (typeof options.data === 'function') { - options.data = options.data(params); - } - - function request () { - var $request = options.transport(options, function (data) { - var results = self.processResults(data, params); - - if (window.console && console.error) { - // Check to make sure that the response included a `results` key. - if (!results || !results.results || !$.isArray(results.results)) { - console.error( - 'Select2: The AJAX results did not return an array in the ' + - '`results` key of the response.' - ); - } - } - - callback(results); - }, function () { - // TODO: Handle AJAX errors - }); - - self._request = $request; - } - - if (this.ajaxOptions.delay && params.term !== '') { - if (this._queryTimeout) { - window.clearTimeout(this._queryTimeout); - } - - this._queryTimeout = window.setTimeout(request, this.ajaxOptions.delay); - } else { - request(); - } - }; - - return AjaxAdapter; -}); - -define('select2/data/tags',[ - 'jquery' -], function ($) { - function Tags (decorated, $element, options) { - var tags = options.get('tags'); - - var createTag = options.get('createTag'); - - if (createTag !== undefined) { - this.createTag = createTag; - } - - decorated.call(this, $element, options); - - if ($.isArray(tags)) { - for (var t = 0; t < tags.length; t++) { - var tag = tags[t]; - var item = this._normalizeItem(tag); - - var $option = this.option(item); - - this.$element.append($option); - } - } - } - - Tags.prototype.query = function (decorated, params, callback) { - var self = this; - - this._removeOldTags(); - - if (params.term == null || params.term === '' || params.page != null) { - decorated.call(this, params, callback); - return; - } - - function wrapper (obj, child) { - var data = obj.results; - - for (var i = 0; i < data.length; i++) { - var option = data[i]; - - var checkChildren = ( - option.children != null && - !wrapper({ - results: option.children - }, true) - ); - - var checkText = option.text === params.term; - - if (checkText || checkChildren) { - if (child) { - return false; - } - - obj.data = data; - callback(obj); - - return; - } - } - - if (child) { - return true; - } - - var tag = self.createTag(params); - - if (tag != null) { - var $option = self.option(tag); - $option.attr('data-select2-tag', true); - - self.addOptions([$option]); - - self.insertTag(data, tag); - } - - obj.results = data; - - callback(obj); - } - - decorated.call(this, params, wrapper); - }; - - Tags.prototype.createTag = function (decorated, params) { - return { - id: params.term, - text: params.term - }; - }; - - Tags.prototype.insertTag = function (_, data, tag) { - data.unshift(tag); - }; - - Tags.prototype._removeOldTags = function (_) { - var tag = this._lastTag; - - var $options = this.$element.find('option[data-select2-tag]'); - - $options.each(function () { - if (this.selected) { - return; - } - - $(this).remove(); - }); - }; - - return Tags; -}); - -define('select2/data/tokenizer',[ - 'jquery' -], function ($) { - function Tokenizer (decorated, $element, options) { - var tokenizer = options.get('tokenizer'); - - if (tokenizer !== undefined) { - this.tokenizer = tokenizer; - } - - decorated.call(this, $element, options); - } - - Tokenizer.prototype.bind = function (decorated, container, $container) { - decorated.call(this, container, $container); - - this.$search = container.dropdown.$search || container.selection.$search || - $container.find('.select2-search__field'); - }; - - Tokenizer.prototype.query = function (decorated, params, callback) { - var self = this; - - function select (data) { - self.select(data); - } - - params.term = params.term || ''; - - var tokenData = this.tokenizer(params, this.options, select); - - if (tokenData.term !== params.term) { - // Replace the search term if we have the search box - if (this.$search.length) { - this.$search.val(tokenData.term); - this.$search.focus(); - } - - params.term = tokenData.term; - } - - decorated.call(this, params, callback); - }; - - Tokenizer.prototype.tokenizer = function (_, params, options, callback) { - var separators = options.get('tokenSeparators') || []; - var term = params.term; - var i = 0; - - var createTag = this.createTag || function (params) { - return { - id: params.term, - text: params.term - }; - }; - - while (i < term.length) { - var termChar = term[i]; - - if ($.inArray(termChar, separators) === -1) { - i++; - - continue; - } - - var part = term.substr(0, i); - var partParams = $.extend({}, params, { - term: part - }); - - var data = createTag(partParams); - - callback(data); - - // Reset the term to not include the tokenized portion - term = term.substr(i + 1) || ''; - i = 0; - } - - return { - term: term - }; - }; - - return Tokenizer; -}); - -define('select2/data/minimumInputLength',[ - -], function () { - function MinimumInputLength (decorated, $e, options) { - this.minimumInputLength = options.get('minimumInputLength'); - - decorated.call(this, $e, options); - } - - MinimumInputLength.prototype.query = function (decorated, params, callback) { - params.term = params.term || ''; - - if (params.term.length < this.minimumInputLength) { - this.trigger('results:message', { - message: 'inputTooShort', - args: { - minimum: this.minimumInputLength, - input: params.term, - params: params - } - }); - - return; - } - - decorated.call(this, params, callback); - }; - - return MinimumInputLength; -}); - -define('select2/data/maximumInputLength',[ - -], function () { - function MaximumInputLength (decorated, $e, options) { - this.maximumInputLength = options.get('maximumInputLength'); - - decorated.call(this, $e, options); - } - - MaximumInputLength.prototype.query = function (decorated, params, callback) { - params.term = params.term || ''; - - if (this.maximumInputLength > 0 && - params.term.length > this.maximumInputLength) { - this.trigger('results:message', { - message: 'inputTooLong', - args: { - maximum: this.maximumInputLength, - input: params.term, - params: params - } - }); - - return; - } - - decorated.call(this, params, callback); - }; - - return MaximumInputLength; -}); - -define('select2/data/maximumSelectionLength',[ - -], function (){ - function MaximumSelectionLength (decorated, $e, options) { - this.maximumSelectionLength = options.get('maximumSelectionLength'); - - decorated.call(this, $e, options); - } - - MaximumSelectionLength.prototype.query = - function (decorated, params, callback) { - var self = this; - - this.current(function (currentData) { - var count = currentData != null ? currentData.length : 0; - if (self.maximumSelectionLength > 0 && - count >= self.maximumSelectionLength) { - self.trigger('results:message', { - message: 'maximumSelected', - args: { - maximum: self.maximumSelectionLength - } - }); - return; - } - decorated.call(self, params, callback); - }); - }; - - return MaximumSelectionLength; -}); - -define('select2/dropdown',[ - 'jquery', - './utils' -], function ($, Utils) { - function Dropdown ($element, options) { - this.$element = $element; - this.options = options; - - Dropdown.__super__.constructor.call(this); - } - - Utils.Extend(Dropdown, Utils.Observable); - - Dropdown.prototype.render = function () { - var $dropdown = $( - '<span class="select2-dropdown">' + - '<span class="select2-results"></span>' + - '</span>' - ); - - $dropdown.attr('dir', this.options.get('dir')); - - this.$dropdown = $dropdown; - - return $dropdown; - }; - - Dropdown.prototype.position = function ($dropdown, $container) { - // Should be implmented in subclasses - }; - - Dropdown.prototype.destroy = function () { - // Remove the dropdown from the DOM - this.$dropdown.remove(); - }; - - return Dropdown; -}); - -define('select2/dropdown/search',[ - 'jquery', - '../utils' -], function ($, Utils) { - function Search () { } - - Search.prototype.render = function (decorated) { - var $rendered = decorated.call(this); - - var $search = $( - '<span class="select2-search select2-search--dropdown">' + - '<input class="select2-search__field" type="search" tabindex="-1"' + - ' autocomplete="off" autocorrect="off" autocapitalize="off"' + - ' spellcheck="false" role="textbox" />' + - '</span>' - ); - - this.$searchContainer = $search; - this.$search = $search.find('input'); - - $rendered.prepend($search); - - return $rendered; - }; - - Search.prototype.bind = function (decorated, container, $container) { - var self = this; - - decorated.call(this, container, $container); - - this.$search.on('keydown', function (evt) { - self.trigger('keypress', evt); - - self._keyUpPrevented = evt.isDefaultPrevented(); - }); - - // Workaround for browsers which do not support the `input` event - // This will prevent double-triggering of events for browsers which support - // both the `keyup` and `input` events. - this.$search.on('input', function (evt) { - // Unbind the duplicated `keyup` event - $(this).off('keyup'); - }); - - this.$search.on('keyup input', function (evt) { - self.handleSearch(evt); - }); - - container.on('open', function () { - self.$search.attr('tabindex', 0); - - self.$search.focus(); - - window.setTimeout(function () { - self.$search.focus(); - }, 0); - }); - - container.on('close', function () { - self.$search.attr('tabindex', -1); - - self.$search.val(''); - }); - - container.on('results:all', function (params) { - if (params.query.term == null || params.query.term === '') { - var showSearch = self.showSearch(params); - - if (showSearch) { - self.$searchContainer.removeClass('select2-search--hide'); - } else { - self.$searchContainer.addClass('select2-search--hide'); - } - } - }); - }; - - Search.prototype.handleSearch = function (evt) { - if (!this._keyUpPrevented) { - var input = this.$search.val(); - - this.trigger('query', { - term: input - }); - } - - this._keyUpPrevented = false; - }; - - Search.prototype.showSearch = function (_, params) { - return true; - }; - - return Search; -}); - -define('select2/dropdown/hidePlaceholder',[ - -], function () { - function HidePlaceholder (decorated, $element, options, dataAdapter) { - this.placeholder = this.normalizePlaceholder(options.get('placeholder')); - - decorated.call(this, $element, options, dataAdapter); - } - - HidePlaceholder.prototype.append = function (decorated, data) { - data.results = this.removePlaceholder(data.results); - - decorated.call(this, data); - }; - - HidePlaceholder.prototype.normalizePlaceholder = function (_, placeholder) { - if (typeof placeholder === 'string') { - placeholder = { - id: '', - text: placeholder - }; - } - - return placeholder; - }; - - HidePlaceholder.prototype.removePlaceholder = function (_, data) { - var modifiedData = data.slice(0); - - for (var d = data.length - 1; d >= 0; d--) { - var item = data[d]; - - if (this.placeholder.id === item.id) { - modifiedData.splice(d, 1); - } - } - - return modifiedData; - }; - - return HidePlaceholder; -}); - -define('select2/dropdown/infiniteScroll',[ - 'jquery' -], function ($) { - function InfiniteScroll (decorated, $element, options, dataAdapter) { - this.lastParams = {}; - - decorated.call(this, $element, options, dataAdapter); - - this.$loadingMore = this.createLoadingMore(); - this.loading = false; - } - - InfiniteScroll.prototype.append = function (decorated, data) { - this.$loadingMore.remove(); - this.loading = false; - - decorated.call(this, data); - - if (this.showLoadingMore(data)) { - this.$results.append(this.$loadingMore); - } - }; - - InfiniteScroll.prototype.bind = function (decorated, container, $container) { - var self = this; - - decorated.call(this, container, $container); - - container.on('query', function (params) { - self.lastParams = params; - self.loading = true; - }); - - container.on('query:append', function (params) { - self.lastParams = params; - self.loading = true; - }); - - this.$results.on('scroll', function () { - var isLoadMoreVisible = $.contains( - document.documentElement, - self.$loadingMore[0] - ); - - if (self.loading || !isLoadMoreVisible) { - return; - } - - var currentOffset = self.$results.offset().top + - self.$results.outerHeight(false); - var loadingMoreOffset = self.$loadingMore.offset().top + - self.$loadingMore.outerHeight(false); - - if (currentOffset + 50 >= loadingMoreOffset) { - self.loadMore(); - } - }); - }; - - InfiniteScroll.prototype.loadMore = function () { - this.loading = true; - - var params = $.extend({}, {page: 1}, this.lastParams); - - params.page++; - - this.trigger('query:append', params); - }; - - InfiniteScroll.prototype.showLoadingMore = function (_, data) { - return data.pagination && data.pagination.more; - }; - - InfiniteScroll.prototype.createLoadingMore = function () { - var $option = $( - '<li class="option load-more" role="treeitem"></li>' - ); - - var message = this.options.get('translations').get('loadingMore'); - - $option.html(message(this.lastParams)); - - return $option; - }; - - return InfiniteScroll; -}); - -define('select2/dropdown/attachBody',[ - 'jquery', - '../utils' -], function ($, Utils) { - function AttachBody (decorated, $element, options) { - this.$dropdownParent = options.get('dropdownParent') || document.body; - - decorated.call(this, $element, options); - } - - AttachBody.prototype.bind = function (decorated, container, $container) { - var self = this; - - var setupResultsEvents = false; - - decorated.call(this, container, $container); - - container.on('open', function () { - self._showDropdown(); - self._attachPositioningHandler(container); - - if (!setupResultsEvents) { - setupResultsEvents = true; - - container.on('results:all', function () { - self._positionDropdown(); - self._resizeDropdown(); - }); - - container.on('results:append', function () { - self._positionDropdown(); - self._resizeDropdown(); - }); - } - }); - - container.on('close', function () { - self._hideDropdown(); - self._detachPositioningHandler(container); - }); - - this.$dropdownContainer.on('mousedown', function (evt) { - evt.stopPropagation(); - }); - }; - - AttachBody.prototype.position = function (decorated, $dropdown, $container) { - // Clone all of the container classes - $dropdown.attr('class', $container.attr('class')); - - $dropdown.removeClass('select2'); - $dropdown.addClass('select2-container--open'); - - $dropdown.css({ - position: 'absolute', - top: -999999 - }); - - this.$container = $container; - }; - - AttachBody.prototype.render = function (decorated) { - var $container = $('<span></span>'); - - var $dropdown = decorated.call(this); - $container.append($dropdown); - - this.$dropdownContainer = $container; - - return $container; - }; - - AttachBody.prototype._hideDropdown = function (decorated) { - this.$dropdownContainer.detach(); - }; - - AttachBody.prototype._attachPositioningHandler = function (container) { - var self = this; - - var scrollEvent = 'scroll.select2.' + container.id; - var resizeEvent = 'resize.select2.' + container.id; - var orientationEvent = 'orientationchange.select2.' + container.id; - - var $watchers = this.$container.parents().filter(Utils.hasScroll); - $watchers.each(function () { - $(this).data('select2-scroll-position', { - x: $(this).scrollLeft(), - y: $(this).scrollTop() - }); - }); - - $watchers.on(scrollEvent, function (ev) { - var position = $(this).data('select2-scroll-position'); - $(this).scrollTop(position.y); - }); - - $(window).on(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent, - function (e) { - self._positionDropdown(); - self._resizeDropdown(); - }); - }; - - AttachBody.prototype._detachPositioningHandler = function (container) { - var scrollEvent = 'scroll.select2.' + container.id; - var resizeEvent = 'resize.select2.' + container.id; - var orientationEvent = 'orientationchange.select2.' + container.id; - - var $watchers = this.$container.parents().filter(Utils.hasScroll); - $watchers.off(scrollEvent); - - $(window).off(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent); - }; - - AttachBody.prototype._positionDropdown = function () { - var $window = $(window); - - var isCurrentlyAbove = this.$dropdown.hasClass('select2-dropdown--above'); - var isCurrentlyBelow = this.$dropdown.hasClass('select2-dropdown--below'); - - var newDirection = null; - - var position = this.$container.position(); - var offset = this.$container.offset(); - - offset.bottom = offset.top + this.$container.outerHeight(false); - - var container = { - height: this.$container.outerHeight(false) - }; - - container.top = offset.top; - container.bottom = offset.top + container.height; - - var dropdown = { - height: this.$dropdown.outerHeight(false) - }; - - var viewport = { - top: $window.scrollTop(), - bottom: $window.scrollTop() + $window.height() - }; - - var enoughRoomAbove = viewport.top < (offset.top - dropdown.height); - var enoughRoomBelow = viewport.bottom > (offset.bottom + dropdown.height); - - var css = { - left: offset.left, - top: container.bottom - }; - - if (!isCurrentlyAbove && !isCurrentlyBelow) { - newDirection = 'below'; - } - - if (!enoughRoomBelow && enoughRoomAbove && !isCurrentlyAbove) { - newDirection = 'above'; - } else if (!enoughRoomAbove && enoughRoomBelow && isCurrentlyAbove) { - newDirection = 'below'; - } - - if (newDirection == 'above' || - (isCurrentlyAbove && newDirection !== 'below')) { - css.top = container.top - dropdown.height; - } - - if (newDirection != null) { - this.$dropdown - .removeClass('select2-dropdown--below select2-dropdown--above') - .addClass('select2-dropdown--' + newDirection); - this.$container - .removeClass('select2-container--below select2-container--above') - .addClass('select2-container--' + newDirection); - } - - this.$dropdownContainer.css(css); - }; - - AttachBody.prototype._resizeDropdown = function () { - this.$dropdownContainer.width(); - - this.$dropdown.css({ - width: this.$container.outerWidth(false) + 'px' - }); - }; - - AttachBody.prototype._showDropdown = function (decorated) { - this.$dropdownContainer.appendTo(this.$dropdownParent); - - this._positionDropdown(); - this._resizeDropdown(); - }; - - return AttachBody; -}); - -define('select2/dropdown/minimumResultsForSearch',[ - -], function () { - function countResults (data) { - var count = 0; - - for (var d = 0; d < data.length; d++) { - var item = data[d]; - - if (item.children) { - count += countResults(item.children); - } else { - count++; - } - } - - return count; - } - - function MinimumResultsForSearch (decorated, $element, options, dataAdapter) { - this.minimumResultsForSearch = options.get('minimumResultsForSearch'); - - if (this.minimumResultsForSearch < 0) { - this.minimumResultsForSearch = Infinity; - } - - decorated.call(this, $element, options, dataAdapter); - } - - MinimumResultsForSearch.prototype.showSearch = function (decorated, params) { - if (countResults(params.data.results) < this.minimumResultsForSearch) { - return false; - } - - return decorated.call(this, params); - }; - - return MinimumResultsForSearch; -}); - -define('select2/dropdown/selectOnClose',[ - -], function () { - function SelectOnClose () { } - - SelectOnClose.prototype.bind = function (decorated, container, $container) { - var self = this; - - decorated.call(this, container, $container); - - container.on('close', function () { - self._handleSelectOnClose(); - }); - }; - - SelectOnClose.prototype._handleSelectOnClose = function () { - var $highlightedResults = this.getHighlightedResults(); - - if ($highlightedResults.length < 1) { - return; - } - - $highlightedResults.trigger('mouseup'); - }; - - return SelectOnClose; -}); - -define('select2/dropdown/closeOnSelect',[ - -], function () { - function CloseOnSelect () { } - - CloseOnSelect.prototype.bind = function (decorated, container, $container) { - var self = this; - - decorated.call(this, container, $container); - - container.on('select', function (evt) { - self._selectTriggered(evt); - }); - - container.on('unselect', function (evt) { - self._selectTriggered(evt); - }); - }; - - CloseOnSelect.prototype._selectTriggered = function (_, evt) { - var originalEvent = evt.originalEvent; - - // Don't close if the control key is being held - if (originalEvent && originalEvent.ctrlKey) { - return; - } - - this.trigger('close'); - }; - - return CloseOnSelect; -}); - -define('select2/i18n/en',[],function () { - // English - return { - errorLoading: function () { - return 'The results could not be loaded.'; - }, - inputTooLong: function (args) { - var overChars = args.input.length - args.maximum; - - var message = 'Please delete ' + overChars + ' character'; - - if (overChars != 1) { - message += 's'; - } - - return message; - }, - inputTooShort: function (args) { - var remainingChars = args.minimum - args.input.length; - - var message = 'Please enter ' + remainingChars + ' or more characters'; - - return message; - }, - loadingMore: function () { - return 'Loading more results…'; - }, - maximumSelected: function (args) { - var message = 'You can only select ' + args.maximum + ' item'; - - if (args.maximum != 1) { - message += 's'; - } - - return message; - }, - noResults: function () { - return 'No results found'; - }, - searching: function () { - return 'Searching…'; - } - }; -}); - -define('select2/defaults',[ - 'jquery', - './results', - - './selection/single', - './selection/multiple', - './selection/placeholder', - './selection/allowClear', - './selection/search', - './selection/eventRelay', - - './utils', - './translation', - './diacritics', - - './data/select', - './data/array', - './data/ajax', - './data/tags', - './data/tokenizer', - './data/minimumInputLength', - './data/maximumInputLength', - './data/maximumSelectionLength', - - './dropdown', - './dropdown/search', - './dropdown/hidePlaceholder', - './dropdown/infiniteScroll', - './dropdown/attachBody', - './dropdown/minimumResultsForSearch', - './dropdown/selectOnClose', - './dropdown/closeOnSelect', - - './i18n/en' -], function ($, ResultsList, - - SingleSelection, MultipleSelection, Placeholder, AllowClear, - SelectionSearch, EventRelay, - - Utils, Translation, DIACRITICS, - - SelectData, ArrayData, AjaxData, Tags, Tokenizer, - MinimumInputLength, MaximumInputLength, MaximumSelectionLength, - - Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll, - AttachBody, MinimumResultsForSearch, SelectOnClose, CloseOnSelect, - - EnglishTranslation) { - function Defaults () { - this.reset(); - } - - Defaults.prototype.apply = function (options) { - options = $.extend({}, this.defaults, options); - - if (options.dataAdapter == null) { - if (options.ajax != null) { - options.dataAdapter = AjaxData; - } else if (options.data != null) { - options.dataAdapter = ArrayData; - } else { - options.dataAdapter = SelectData; - } - - if (options.minimumInputLength > 0) { - options.dataAdapter = Utils.Decorate( - options.dataAdapter, - MinimumInputLength - ); - } - - if (options.maximumInputLength > 0) { - options.dataAdapter = Utils.Decorate( - options.dataAdapter, - MaximumInputLength - ); - } - - if (options.maximumSelectionLength > 0) { - options.dataAdapter = Utils.Decorate( - options.dataAdapter, - MaximumSelectionLength - ); - } - - if (options.tags != null) { - options.dataAdapter = Utils.Decorate(options.dataAdapter, Tags); - } - - if (options.tokenSeparators != null || options.tokenizer != null) { - options.dataAdapter = Utils.Decorate( - options.dataAdapter, - Tokenizer - ); - } - - if (options.query != null) { - var Query = require(options.amdBase + 'compat/query'); - - options.dataAdapter = Utils.Decorate( - options.dataAdapter, - Query - ); - } - - if (options.initSelection != null) { - var InitSelection = require(options.amdBase + 'compat/initSelection'); - - options.dataAdapter = Utils.Decorate( - options.dataAdapter, - InitSelection - ); - } - } - - if (options.resultsAdapter == null) { - options.resultsAdapter = ResultsList; - - if (options.ajax != null) { - options.resultsAdapter = Utils.Decorate( - options.resultsAdapter, - InfiniteScroll - ); - } - - if (options.placeholder != null) { - options.resultsAdapter = Utils.Decorate( - options.resultsAdapter, - HidePlaceholder - ); - } - - if (options.selectOnClose) { - options.resultsAdapter = Utils.Decorate( - options.resultsAdapter, - SelectOnClose - ); - } - } - - if (options.dropdownAdapter == null) { - if (options.multiple) { - options.dropdownAdapter = Dropdown; - } else { - var SearchableDropdown = Utils.Decorate(Dropdown, DropdownSearch); - - options.dropdownAdapter = SearchableDropdown; - } - - if (options.minimumResultsForSearch !== 0) { - options.dropdownAdapter = Utils.Decorate( - options.dropdownAdapter, - MinimumResultsForSearch - ); - } - - if (options.closeOnSelect) { - options.dropdownAdapter = Utils.Decorate( - options.dropdownAdapter, - CloseOnSelect - ); - } - - options.dropdownAdapter = Utils.Decorate( - options.dropdownAdapter, - AttachBody - ); - } - - if (options.selectionAdapter == null) { - if (options.multiple) { - options.selectionAdapter = MultipleSelection; - } else { - options.selectionAdapter = SingleSelection; - } - - // Add the placeholder mixin if a placeholder was specified - if (options.placeholder != null) { - options.selectionAdapter = Utils.Decorate( - options.selectionAdapter, - Placeholder - ); - } - - if (options.allowClear) { - options.selectionAdapter = Utils.Decorate( - options.selectionAdapter, - AllowClear - ); - } - - if (options.multiple) { - options.selectionAdapter = Utils.Decorate( - options.selectionAdapter, - SelectionSearch - ); - } - - options.selectionAdapter = Utils.Decorate( - options.selectionAdapter, - EventRelay - ); - } - - if (typeof options.language === 'string') { - // Check if the lanugage is specified with a region - if (options.language.indexOf('-') > 0) { - // Extract the region information if it is included - var languageParts = options.language.split('-'); - var baseLanguage = languageParts[0]; - - options.language = [options.language, baseLanguage]; - } else { - options.language = [options.language]; - } - } - - if ($.isArray(options.language)) { - var languages = new Translation(); - options.language.push('en'); - - var languageNames = options.language; - - for (var l = 0; l < languageNames.length; l++) { - var name = languageNames[l]; - var language = {}; - - try { - // Try to load it with the original name - language = Translation.loadPath(name); - } catch (e) { - try { - // If we couldn't load it, check if it wasn't the full path - name = this.defaults.amdLanguageBase + name; - language = Translation.loadPath(name); - } catch (ex) { - // The translation could not be loaded at all. Sometimes this is - // because of a configuration problem, other times this can be - // because of how Select2 helps load all possible translation files. - if (window.console && console.warn) { - console.warn( - 'Select2: The lanugage file for "' + name + '" could not be ' + - 'automatically loaded. A fallback will be used instead.' - ); - } - - continue; - } - } - - languages.extend(language); - } - - options.translations = languages; - } else { - options.translations = new Translation(options.language); - } - - return options; - }; - - Defaults.prototype.reset = function () { - function stripDiacritics (text) { - // Used 'uni range + named function' from http://jsperf.com/diacritics/18 - function match(a) { - return DIACRITICS[a] || a; - } - - return text.replace(/[^\u0000-\u007E]/g, match); - } - - function matcher (params, data) { - // Always return the object if there is nothing to compare - if ($.trim(params.term) === '') { - return data; - } - - // Do a recursive check for options with children - if (data.children && data.children.length > 0) { - // Clone the data object if there are children - // This is required as we modify the object to remove any non-matches - var match = $.extend(true, {}, data); - - // Check each child of the option - for (var c = data.children.length - 1; c >= 0; c--) { - var child = data.children[c]; - - var matches = matcher(params, child); - - // If there wasn't a match, remove the object in the array - if (matches == null) { - match.children.splice(c, 1); - } - } - - // If any children matched, return the new object - if (match.children.length > 0) { - return match; - } - - // If there were no matching children, check just the plain object - return matcher(params, match); - } - - var original = stripDiacritics(data.text).toUpperCase(); - var term = stripDiacritics(params.term).toUpperCase(); - - // Check if the text contains the term - if (original.indexOf(term) > -1) { - return data; - } - - // If it doesn't contain the term, don't return anything - return null; - } - - this.defaults = { - amdBase: 'select2/', - amdLanguageBase: 'select2/i18n/', - closeOnSelect: true, - escapeMarkup: Utils.escapeMarkup, - language: EnglishTranslation, - matcher: matcher, - minimumInputLength: 0, - maximumInputLength: 0, - maximumSelectionLength: 0, - minimumResultsForSearch: 0, - selectOnClose: false, - sorter: function (data) { - return data; - }, - templateResult: function (result) { - return result.text; - }, - templateSelection: function (selection) { - return selection.text; - }, - theme: 'default', - width: 'resolve' - }; - }; - - Defaults.prototype.set = function (key, value) { - var camelKey = $.camelCase(key); - - var data = {}; - data[camelKey] = value; - - var convertedData = Utils._convertData(data); - - $.extend(this.defaults, convertedData); - }; - - var defaults = new Defaults(); - - return defaults; -}); - -define('select2/options',[ - 'jquery', - './defaults', - './utils' -], function ($, Defaults, Utils) { - function Options (options, $element) { - this.options = options; - - if ($element != null) { - this.fromElement($element); - } - - this.options = Defaults.apply(this.options); - - if ($element && $element.is('input')) { - var InputCompat = require(this.get('amdBase') + 'compat/inputData'); - - this.options.dataAdapter = Utils.Decorate( - this.options.dataAdapter, - InputCompat - ); - } - } - - Options.prototype.fromElement = function ($e) { - var excludedData = ['select2']; - - if (this.options.multiple == null) { - this.options.multiple = $e.prop('multiple'); - } - - if (this.options.disabled == null) { - this.options.disabled = $e.prop('disabled'); - } - - if (this.options.language == null) { - if ($e.prop('lang')) { - this.options.language = $e.prop('lang').toLowerCase(); - } else if ($e.closest('[lang]').prop('lang')) { - this.options.language = $e.closest('[lang]').prop('lang'); - } - } - - if (this.options.dir == null) { - if ($e.prop('dir')) { - this.options.dir = $e.prop('dir'); - } else if ($e.closest('[dir]').prop('dir')) { - this.options.dir = $e.closest('[dir]').prop('dir'); - } else { - this.options.dir = 'ltr'; - } - } - - $e.prop('disabled', this.options.disabled); - $e.prop('multiple', this.options.multiple); - - if ($e.data('select2Tags')) { - if (window.console && console.warn) { - console.warn( - 'Select2: The `data-select2-tags` attribute has been changed to ' + - 'use the `data-data` and `data-tags="true"` attributes and will be ' + - 'removed in future versions of Select2.' - ); - } - - $e.data('data', $e.data('select2Tags')); - $e.data('tags', true); - } - - if ($e.data('ajaxUrl')) { - if (window.console && console.warn) { - console.warn( - 'Select2: The `data-ajax-url` attribute has been changed to ' + - '`data-ajax--url` and support for the old attribute will be removed' + - ' in future versions of Select2.' - ); - } - - $e.data('ajax-Url', $e.data('ajaxUrl')); - } - - var dataset = {}; - - // Prefer the element's `dataset` attribute if it exists - // jQuery 1.x does not correctly handle data attributes with multiple dashes - if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) { - dataset = $.extend(true, {}, $e[0].dataset, $e.data()); - } else { - dataset = $e.data(); - } - - var data = $.extend(true, {}, dataset); - - data = Utils._convertData(data); - - for (var key in data) { - if ($.inArray(key, excludedData) > -1) { - continue; - } - - if ($.isPlainObject(this.options[key])) { - $.extend(this.options[key], data[key]); - } else { - this.options[key] = data[key]; - } - } - - return this; - }; - - Options.prototype.get = function (key) { - return this.options[key]; - }; - - Options.prototype.set = function (key, val) { - this.options[key] = val; - }; - - return Options; -}); - -define('select2/core',[ - 'jquery', - './options', - './utils', - './keys' -], function ($, Options, Utils, KEYS) { - var Select2 = function ($element, options) { - if ($element.data('select2') != null) { - $element.data('select2').destroy(); - } - - this.$element = $element; - - this.id = this._generateId($element); - - options = options || {}; - - this.options = new Options(options, $element); - - Select2.__super__.constructor.call(this); - - // Set up the tabindex - - var tabindex = $element.attr('tabindex') || 0; - $element.data('old-tabindex', tabindex); - $element.attr('tabindex', '-1'); - - // Set up containers and adapters - - var DataAdapter = this.options.get('dataAdapter'); - this.data = new DataAdapter($element, this.options); - - var $container = this.render(); - - this._placeContainer($container); - - var SelectionAdapter = this.options.get('selectionAdapter'); - this.selection = new SelectionAdapter($element, this.options); - this.$selection = this.selection.render(); - - this.selection.position(this.$selection, $container); - - var DropdownAdapter = this.options.get('dropdownAdapter'); - this.dropdown = new DropdownAdapter($element, this.options); - this.$dropdown = this.dropdown.render(); - - this.dropdown.position(this.$dropdown, $container); - - var ResultsAdapter = this.options.get('resultsAdapter'); - this.results = new ResultsAdapter($element, this.options, this.data); - this.$results = this.results.render(); - - this.results.position(this.$results, this.$dropdown); - - // Bind events - - var self = this; - - // Bind the container to all of the adapters - this._bindAdapters(); - - // Register any DOM event handlers - this._registerDomEvents(); - - // Register any internal event handlers - this._registerDataEvents(); - this._registerSelectionEvents(); - this._registerDropdownEvents(); - this._registerResultsEvents(); - this._registerEvents(); - - // Set the initial state - this.data.current(function (initialData) { - self.trigger('selection:update', { - data: initialData - }); - }); - - // Hide the original select - $element.hide(); - - // Synchronize any monitored attributes - this._syncAttributes(); - - $element.data('select2', this); - }; - - Utils.Extend(Select2, Utils.Observable); - - Select2.prototype._generateId = function ($element) { - var id = ''; - - if ($element.attr('id') != null) { - id = $element.attr('id'); - } else if ($element.attr('name') != null) { - id = $element.attr('name') + '-' + Utils.generateChars(2); - } else { - id = Utils.generateChars(4); - } - - id = 'select2-' + id; - - return id; - }; - - Select2.prototype._placeContainer = function ($container) { - $container.insertAfter(this.$element); - - var width = this._resolveWidth(this.$element, this.options.get('width')); - - if (width != null) { - $container.css('width', width); - } - }; - - Select2.prototype._resolveWidth = function ($element, method) { - var WIDTH = /^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i; - - if (method == 'resolve') { - var styleWidth = this._resolveWidth($element, 'style'); - - if (styleWidth != null) { - return styleWidth; - } - - return this._resolveWidth($element, 'element'); - } - - if (method == 'element') { - var elementWidth = $element.outerWidth(false); - - if (elementWidth <= 0) { - return 'auto'; - } - - return elementWidth + 'px'; - } - - if (method == 'style') { - var style = $element.attr('style'); - - if (typeof(style) !== 'string') { - return null; - } - - var attrs = style.split(';'); - - for (var i = 0, l = attrs.length; i < l; i = i + 1) { - var attr = attrs[i].replace(/\s/g, ''); - var matches = attr.match(WIDTH); - - if (matches !== null && matches.length >= 1) { - return matches[1]; - } - } - - return null; - } - - return method; - }; - - Select2.prototype._bindAdapters = function () { - this.data.bind(this, this.$container); - this.selection.bind(this, this.$container); - - this.dropdown.bind(this, this.$container); - this.results.bind(this, this.$container); - }; - - Select2.prototype._registerDomEvents = function () { - var self = this; - - this.$element.on('change.select2', function () { - self.data.current(function (data) { - self.trigger('selection:update', { - data: data - }); - }); - }); - - this._sync = Utils.bind(this._syncAttributes, this); - - if (this.$element[0].attachEvent) { - this.$element[0].attachEvent('onpropertychange', this._sync); - } - - var observer = window.MutationObserver || - window.WebKitMutationObserver || - window.MozMutationObserver - ; - - if (observer != null) { - this._observer = new observer(function (mutations) { - $.each(mutations, self._sync); - }); - this._observer.observe(this.$element[0], { - attributes: true, - subtree: false - }); - } else if (this.$element[0].addEventListener) { - this.$element[0].addEventListener('DOMAttrModified', self._sync, false); - } - }; - - Select2.prototype._registerDataEvents = function () { - var self = this; - - this.data.on('*', function (name, params) { - self.trigger(name, params); - }); - }; - - Select2.prototype._registerSelectionEvents = function () { - var self = this; - var nonRelayEvents = ['toggle']; - - this.selection.on('toggle', function () { - self.toggleDropdown(); - }); - - this.selection.on('*', function (name, params) { - if ($.inArray(name, nonRelayEvents) !== -1) { - return; - } - - self.trigger(name, params); - }); - }; - - Select2.prototype._registerDropdownEvents = function () { - var self = this; - - this.dropdown.on('*', function (name, params) { - self.trigger(name, params); - }); - }; - - Select2.prototype._registerResultsEvents = function () { - var self = this; - - this.results.on('*', function (name, params) { - self.trigger(name, params); - }); - }; - - Select2.prototype._registerEvents = function () { - var self = this; - - this.on('open', function () { - self.$container.addClass('select2-container--open'); - }); - - this.on('close', function () { - self.$container.removeClass('select2-container--open'); - }); - - this.on('enable', function () { - self.$container.removeClass('select2-container--disabled'); - }); - - this.on('disable', function () { - self.$container.addClass('select2-container--disabled'); - }); - - this.on('focus', function () { - self.$container.addClass('select2-container--focus'); - }); - - this.on('blur', function () { - self.$container.removeClass('select2-container--focus'); - }); - - this.on('query', function (params) { - if (!self.isOpen()) { - self.trigger('open'); - } - - this.data.query(params, function (data) { - self.trigger('results:all', { - data: data, - query: params - }); - }); - }); - - this.on('query:append', function (params) { - this.data.query(params, function (data) { - self.trigger('results:append', { - data: data, - query: params - }); - }); - }); - - this.on('keypress', function (evt) { - var key = evt.which; - - if (self.isOpen()) { - if (key === KEYS.ENTER) { - self.trigger('results:select'); - - evt.preventDefault(); - } else if ((key === KEYS.SPACE && evt.ctrlKey)) { - self.trigger('results:toggle'); - - evt.preventDefault(); - } else if (key === KEYS.UP) { - self.trigger('results:previous'); - - evt.preventDefault(); - } else if (key === KEYS.DOWN) { - self.trigger('results:next'); - - evt.preventDefault(); - } else if (key === KEYS.ESC || key === KEYS.TAB) { - self.close(); - - evt.preventDefault(); - } - } else { - if (key === KEYS.ENTER || key === KEYS.SPACE || - ((key === KEYS.DOWN || key === KEYS.UP) && evt.altKey)) { - self.open(); - - evt.preventDefault(); - } - } - }); - }; - - Select2.prototype._syncAttributes = function () { - this.options.set('disabled', this.$element.prop('disabled')); - - if (this.options.get('disabled')) { - if (this.isOpen()) { - this.close(); - } - - this.trigger('disable'); - } else { - this.trigger('enable'); - } - }; - - /** - * Override the trigger method to automatically trigger pre-events when - * there are events that can be prevented. - */ - Select2.prototype.trigger = function (name, args) { - var actualTrigger = Select2.__super__.trigger; - var preTriggerMap = { - 'open': 'opening', - 'close': 'closing', - 'select': 'selecting', - 'unselect': 'unselecting' - }; - - if (name in preTriggerMap) { - var preTriggerName = preTriggerMap[name]; - var preTriggerArgs = { - prevented: false, - name: name, - args: args - }; - - actualTrigger.call(this, preTriggerName, preTriggerArgs); - - if (preTriggerArgs.prevented) { - args.prevented = true; - - return; - } - } - - actualTrigger.call(this, name, args); - }; - - Select2.prototype.toggleDropdown = function () { - if (this.options.get('disabled')) { - return; - } - - if (this.isOpen()) { - this.close(); - } else { - this.open(); - } - }; - - Select2.prototype.open = function () { - if (this.isOpen()) { - return; - } - - this.trigger('query', {}); - - this.trigger('open'); - }; - - Select2.prototype.close = function () { - if (!this.isOpen()) { - return; - } - - this.trigger('close'); - }; - - Select2.prototype.isOpen = function () { - return this.$container.hasClass('select2-container--open'); - }; - - Select2.prototype.enable = function (args) { - if (window.console && console.warn) { - console.warn( - 'Select2: The `select2("enable")` method has been deprecated and will' + - ' be removed in later Select2 versions. Use $element.prop("disabled")' + - ' instead.' - ); - } - - if (args.length === 0) { - args = [true]; - } - - var disabled = !args[0]; - - this.$element.prop('disabled', disabled); - }; - - Select2.prototype.data = function () { - if (arguments.length > 0 && window.console && console.warn) { - console.warn( - 'Select2: Data can no longer be set using `select2("data")`. You ' + - 'should consider setting the value instead using `$element.val()`.' - ); - } - - var data = []; - - this.dataAdpater.current(function (currentData) { - data = currentData; - }); - - return data; - }; - - Select2.prototype.val = function (args) { - if (window.console && console.warn) { - console.warn( - 'Select2: The `select2("val")` method has been deprecated and will be' + - ' removed in later Select2 versions. Use $element.val() instead.' - ); - } - - if (args.length === 0) { - return this.$element.val(); - } - - var newVal = args[0]; - - if ($.isArray(newVal)) { - newVal = $.map(newVal, function (obj) { - return obj.toString(); - }); - } - - this.$element.val(newVal).trigger('change'); - }; - - Select2.prototype.destroy = function () { - this.$container.remove(); - - if (this.$element[0].detachEvent) { - this.$element[0].detachEvent('onpropertychange', this._sync); - } - - if (this._observer != null) { - this._observer.disconnect(); - this._observer = null; - } else if (this.$element[0].removeEventListener) { - this.$element[0] - .removeEventListener('DOMAttrModified', this._sync, false); - } - - this._sync = null; - - this.$element.off('.select2'); - this.$element.attr('tabindex', this.$element.data('old-tabindex')); - - this.$element.show(); - this.$element.removeData('select2'); - - this.data.destroy(); - this.selection.destroy(); - this.dropdown.destroy(); - this.results.destroy(); - - this.data = null; - this.selection = null; - this.dropdown = null; - this.results = null; - }; - - Select2.prototype.render = function () { - var $container = $( - '<span class="select2 select2-container">' + - '<span class="selection"></span>' + - '<span class="dropdown-wrapper" aria-hidden="true"></span>' + - '</span>' - ); - - $container.attr('dir', this.options.get('dir')); - - this.$container = $container; - - this.$container.addClass('select2-container--' + this.options.get('theme')); - - $container.data('element', this.$element); - - return $container; - }; - - return Select2; -}); - -/*! - * jQuery Mousewheel 3.1.12 - * - * Copyright 2014 jQuery Foundation and other contributors - * Released under the MIT license. - * http://jquery.org/license - */ - -(function (factory) { - if ( typeof define === 'function' && define.amd ) { - // AMD. Register as an anonymous module. - define('jquery.mousewheel',['jquery'], factory); - } else if (typeof exports === 'object') { - // Node/CommonJS style for Browserify - module.exports = factory; - } else { - // Browser globals - factory(jQuery); - } -}(function ($) { - - var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'], - toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ? - ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'], - slice = Array.prototype.slice, - nullLowestDeltaTimeout, lowestDelta; - - if ( $.event.fixHooks ) { - for ( var i = toFix.length; i; ) { - $.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks; - } - } - - var special = $.event.special.mousewheel = { - version: '3.1.12', - - setup: function() { - if ( this.addEventListener ) { - for ( var i = toBind.length; i; ) { - this.addEventListener( toBind[--i], handler, false ); - } - } else { - this.onmousewheel = handler; - } - // Store the line height and page height for this particular element - $.data(this, 'mousewheel-line-height', special.getLineHeight(this)); - $.data(this, 'mousewheel-page-height', special.getPageHeight(this)); - }, - - teardown: function() { - if ( this.removeEventListener ) { - for ( var i = toBind.length; i; ) { - this.removeEventListener( toBind[--i], handler, false ); - } - } else { - this.onmousewheel = null; - } - // Clean up the data we added to the element - $.removeData(this, 'mousewheel-line-height'); - $.removeData(this, 'mousewheel-page-height'); - }, - - getLineHeight: function(elem) { - var $elem = $(elem), - $parent = $elem['offsetParent' in $.fn ? 'offsetParent' : 'parent'](); - if (!$parent.length) { - $parent = $('body'); - } - return parseInt($parent.css('fontSize'), 10) || parseInt($elem.css('fontSize'), 10) || 16; - }, - - getPageHeight: function(elem) { - return $(elem).height(); - }, - - settings: { - adjustOldDeltas: true, // see shouldAdjustOldDeltas() below - normalizeOffset: true // calls getBoundingClientRect for each event - } - }; - - $.fn.extend({ - mousewheel: function(fn) { - return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel'); - }, - - unmousewheel: function(fn) { - return this.unbind('mousewheel', fn); - } - }); - - - function handler(event) { - var orgEvent = event || window.event, - args = slice.call(arguments, 1), - delta = 0, - deltaX = 0, - deltaY = 0, - absDelta = 0, - offsetX = 0, - offsetY = 0; - event = $.event.fix(orgEvent); - event.type = 'mousewheel'; - - // Old school scrollwheel delta - if ( 'detail' in orgEvent ) { deltaY = orgEvent.detail * -1; } - if ( 'wheelDelta' in orgEvent ) { deltaY = orgEvent.wheelDelta; } - if ( 'wheelDeltaY' in orgEvent ) { deltaY = orgEvent.wheelDeltaY; } - if ( 'wheelDeltaX' in orgEvent ) { deltaX = orgEvent.wheelDeltaX * -1; } - - // Firefox < 17 horizontal scrolling related to DOMMouseScroll event - if ( 'axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) { - deltaX = deltaY * -1; - deltaY = 0; - } - - // Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy - delta = deltaY === 0 ? deltaX : deltaY; - - // New school wheel delta (wheel event) - if ( 'deltaY' in orgEvent ) { - deltaY = orgEvent.deltaY * -1; - delta = deltaY; - } - if ( 'deltaX' in orgEvent ) { - deltaX = orgEvent.deltaX; - if ( deltaY === 0 ) { delta = deltaX * -1; } - } - - // No change actually happened, no reason to go any further - if ( deltaY === 0 && deltaX === 0 ) { return; } - - // Need to convert lines and pages to pixels if we aren't already in pixels - // There are three delta modes: - // * deltaMode 0 is by pixels, nothing to do - // * deltaMode 1 is by lines - // * deltaMode 2 is by pages - if ( orgEvent.deltaMode === 1 ) { - var lineHeight = $.data(this, 'mousewheel-line-height'); - delta *= lineHeight; - deltaY *= lineHeight; - deltaX *= lineHeight; - } else if ( orgEvent.deltaMode === 2 ) { - var pageHeight = $.data(this, 'mousewheel-page-height'); - delta *= pageHeight; - deltaY *= pageHeight; - deltaX *= pageHeight; - } - - // Store lowest absolute delta to normalize the delta values - absDelta = Math.max( Math.abs(deltaY), Math.abs(deltaX) ); - - if ( !lowestDelta || absDelta < lowestDelta ) { - lowestDelta = absDelta; - - // Adjust older deltas if necessary - if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) { - lowestDelta /= 40; - } - } - - // Adjust older deltas if necessary - if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) { - // Divide all the things by 40! - delta /= 40; - deltaX /= 40; - deltaY /= 40; - } - - // Get a whole, normalized value for the deltas - delta = Math[ delta >= 1 ? 'floor' : 'ceil' ](delta / lowestDelta); - deltaX = Math[ deltaX >= 1 ? 'floor' : 'ceil' ](deltaX / lowestDelta); - deltaY = Math[ deltaY >= 1 ? 'floor' : 'ceil' ](deltaY / lowestDelta); - - // Normalise offsetX and offsetY properties - if ( special.settings.normalizeOffset && this.getBoundingClientRect ) { - var boundingRect = this.getBoundingClientRect(); - offsetX = event.clientX - boundingRect.left; - offsetY = event.clientY - boundingRect.top; - } - - // Add information to the event object - event.deltaX = deltaX; - event.deltaY = deltaY; - event.deltaFactor = lowestDelta; - event.offsetX = offsetX; - event.offsetY = offsetY; - // Go ahead and set deltaMode to 0 since we converted to pixels - // Although this is a little odd since we overwrite the deltaX/Y - // properties with normalized deltas. - event.deltaMode = 0; - - // Add event and delta to the front of the arguments - args.unshift(event, delta, deltaX, deltaY); - - // Clearout lowestDelta after sometime to better - // handle multiple device types that give different - // a different lowestDelta - // Ex: trackpad = 3 and mouse wheel = 120 - if (nullLowestDeltaTimeout) { clearTimeout(nullLowestDeltaTimeout); } - nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200); - - return ($.event.dispatch || $.event.handle).apply(this, args); - } - - function nullLowestDelta() { - lowestDelta = null; - } - - function shouldAdjustOldDeltas(orgEvent, absDelta) { - // If this is an older event and the delta is divisable by 120, - // then we are assuming that the browser is treating this as an - // older mouse wheel event and that we should divide the deltas - // by 40 to try and get a more usable deltaFactor. - // Side note, this actually impacts the reported scroll distance - // in older browsers and can cause scrolling to be slower than native. - // Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false. - return special.settings.adjustOldDeltas && orgEvent.type === 'mousewheel' && absDelta % 120 === 0; - } - -})); - -define('select2/compat/matcher',[ - 'jquery' -], function ($) { - function oldMatcher (matcher) { - function wrappedMatcher (params, data) { - var match = $.extend(true, {}, data); - - if (params.term == null || $.trim(params.term) === '') { - return match; - } - - if (data.children) { - for (var c = data.children.length - 1; c >= 0; c--) { - var child = data.children[c]; - - // Check if the child object matches - // The old matcher returned a boolean true or false - var doesMatch = matcher(params.term, child.text, child); - - // If the child didn't match, pop it off - if (!doesMatch) { - match.children.splice(c, 1); - } - } - - if (match.children.length > 0) { - return match; - } - } - - if (matcher(params.term, data.text, data)) { - return match; - } - - return null; - } - - return wrappedMatcher; - } - - return oldMatcher; -}); - -define('select2/compat/initSelection',[ - 'jquery' -], function ($) { - function InitSelection (decorated, $element, options) { - if (window.console && console.warn) { - console.warn( - 'Select2: The `initSelection` option has been deprecated in favor' + - ' of a custom data adapter that overrides the `current` method. ' + - 'This method is now called multiple times instead of a single ' + - 'time when the instance is initialized. Support will be removed ' + - 'for the `initSelection` option in future versions of Select2' - ); - } - - this.initSelection = options.get('initSelection'); - this._isInitialized = false; - - decorated.call(this, $element, options); - } - - InitSelection.prototype.current = function (decorated, callback) { - var self = this; - - if (this._isInitialized) { - decorated.call(this, callback); - - return; - } - - this.initSelection.call(null, this.$element, function (data) { - self._isInitialized = true; - - if (!$.isArray(data)) { - data = [data]; - } - - callback(data); - }); - }; - - return InitSelection; -}); - -define('select2/compat/inputData',[ - 'jquery' -], function ($) { - function InputData (decorated, $element, options) { - this._currentData = []; - this._valueSeparator = options.get('valueSeparator') || ','; - - if ($element.prop('type') === 'hidden') { - if (console && console.warn) { - console.warn( - 'Select2: Using a hidden input with Select2 is no longer ' + - 'supported and may stop working in the future. It is recommended ' + - 'to use a `<select>` element instead.' - ); - } - } - - decorated.call(this, $element, options); - } - - InputData.prototype.current = function (_, callback) { - function getSelected (data, selectedIds) { - var selected = []; - - if (data.selected || $.inArray(data.id, selectedIds) !== -1) { - data.selected = true; - selected.push(data); - } else { - data.selected = false; - } - - if (data.children) { - selected.push.apply(selected, getSelected(data.children, selectedIds)); - } - - return selected; - } - - var selected = []; - - for (var d = 0; d < this._currentData.length; d++) { - var data = this._currentData[d]; - - selected.push.apply( - selected, - getSelected( - data, - this.$element.val().split( - this._valueSeparator - ) - ) - ); - } - - callback(selected); - }; - - InputData.prototype.select = function (_, data) { - if (!this.options.get('multiple')) { - this.current(function (allData) { - $.map(allData, function (data) { - data.selected = false; - }); - }); - - this.$element.val(data.id); - this.$element.trigger('change'); - } else { - var value = this.$element.val(); - value += this._valueSeparator + data.id; - - this.$element.val(value); - this.$element.trigger('change'); - } - }; - - InputData.prototype.unselect = function (_, data) { - var self = this; - - data.selected = false; - - this.current(function (allData) { - var values = []; - - for (var d = 0; d < allData; d++) { - var item = allData[d]; - - if (data.id == item.id) { - continue; - } - - values.push(data.id); - } - - self.$element.val(values.join(self._valueSeparator)); - self.$element.trigger('change'); - }); - }; - - InputData.prototype.query = function (_, params, callback) { - var results = []; - - for (var d = 0; d < this._currentData.length; d++) { - var data = this._currentData[d]; - - var matches = this.matches(params, data); - - if (matches !== null) { - results.push(matches); - } - } - - callback({ - results: results - }); - }; - - InputData.prototype.addOptions = function (_, $options) { - var options = $.map($options, function ($option) { - return $.data($option[0], 'data'); - }); - - this._currentData.push.apply(this._currentData, options); - }; - - return InputData; -}); - -define('select2/compat/query',[ - -], function () { - function Query (decorated, $element, options) { - if (window.console && console.warn) { - console.warn( - 'Select2: The `query` option has been deprecated in favor of a ' + - 'custom data adapter that overrides the `query` method. Support ' + - 'will be removed for the `query` option in future versions of ' + - 'Select2.' - ); - } - - decorated.call(this, $element, options); - } - - Query.prototype.query = function (_, params, callback) { - params.callback = callback; - - var query = this.options.get('query'); - - query.call(null, params); - }; - - return Query; -}); - -define('select2/dropdown/attachContainer',[ - -], function () { - function AttachContainer (decorated, $element, options) { - decorated.call(this, $element, options); - } - - AttachContainer.prototype.position = - function (decorated, $dropdown, $container) { - var $dropdownContainer = $container.find('.dropdown-wrapper'); - $dropdownContainer.append($dropdown); - - $dropdown.addClass('select2-dropdown--below'); - $container.addClass('select2-container--below'); - }; - - return AttachContainer; -}); - -define('select2/dropdown/stopPropagation',[ - -], function () { - function StopPropagation () { } - - StopPropagation.prototype.bind = function (decorated, container, $container) { - decorated.call(this, container, $container); - - var stoppedEvents = [ - 'blur', - 'change', - 'click', - 'dblclick', - 'focus', - 'focusin', - 'focusout', - 'input', - 'keydown', - 'keyup', - 'keypress', - 'mousedown', - 'mouseenter', - 'mouseleave', - 'mousemove', - 'mouseover', - 'mouseup', - 'search', - 'touchend', - 'touchstart' - ]; - - this.$dropdown.on(stoppedEvents.join(' '), function (evt) { - evt.stopPropagation(); - }); - }; - - return StopPropagation; -}); - -define('select2/selection/stopPropagation',[ - -], function () { - function StopPropagation () { } - - StopPropagation.prototype.bind = function (decorated, container, $container) { - decorated.call(this, container, $container); - - var stoppedEvents = [ - 'blur', - 'change', - 'click', - 'dblclick', - 'focus', - 'focusin', - 'focusout', - 'input', - 'keydown', - 'keyup', - 'keypress', - 'mousedown', - 'mouseenter', - 'mouseleave', - 'mousemove', - 'mouseover', - 'mouseup', - 'search', - 'touchend', - 'touchstart' - ]; - - this.$selection.on(stoppedEvents.join(' '), function (evt) { - evt.stopPropagation(); - }); - }; - - return StopPropagation; -}); - -define('jquery.select2',[ - 'jquery', - './select2/core', - './select2/defaults' -], function ($, Select2, Defaults) { - // Force jQuery.mousewheel to be loaded if it hasn't already - try { - require('jquery.mousewheel'); - } catch (Exception) { } - - if ($.fn.select2 == null) { - $.fn.select2 = function (options) { - options = options || {}; - - if (typeof options === 'object') { - this.each(function () { - var instanceOptions = $.extend({}, options, true); - - var instance = new Select2($(this), instanceOptions); - }); - - return this; - } else if (typeof options === 'string') { - var instance = this.data('select2'); - var args = Array.prototype.slice.call(arguments, 1); - - return instance[options](args); - } else { - throw new Error('Invalid arguments for Select2: ' + options); - } - }; - } - - if ($.fn.select2.defaults == null) { - $.fn.select2.defaults = Defaults; - } - - return Select2; -}); - -return require('jquery.select2'); });
\ No newline at end of file diff --git a/public/vendor/select2/js/select2.amd.js b/public/vendor/select2/js/select2.amd.js deleted file mode 100755 index af409578..00000000 --- a/public/vendor/select2/js/select2.amd.js +++ /dev/null @@ -1,4766 +0,0 @@ -define(['jquery'], function ($) {define('select2/utils',[ - 'jquery' -], function ($) { - var Utils = {}; - - Utils.Extend = function (ChildClass, SuperClass) { - var __hasProp = {}.hasOwnProperty; - - function BaseConstructor () { - this.constructor = ChildClass; - } - - for (var key in SuperClass) { - if (__hasProp.call(SuperClass, key)) { - ChildClass[key] = SuperClass[key]; - } - } - - BaseConstructor.prototype = SuperClass.prototype; - ChildClass.prototype = new BaseConstructor(); - ChildClass.__super__ = SuperClass.prototype; - - return ChildClass; - }; - - function getMethods (theClass) { - var proto = theClass.prototype; - - var methods = []; - - for (var methodName in proto) { - var m = proto[methodName]; - - if (typeof m !== 'function') { - continue; - } - - if (methodName === 'constructor') { - continue; - } - - methods.push(methodName); - } - - return methods; - } - - Utils.Decorate = function (SuperClass, DecoratorClass) { - var decoratedMethods = getMethods(DecoratorClass); - var superMethods = getMethods(SuperClass); - - function DecoratedClass () { - var unshift = Array.prototype.unshift; - - var argCount = DecoratorClass.prototype.constructor.length; - - var calledConstructor = SuperClass.prototype.constructor; - - if (argCount > 0) { - unshift.call(arguments, SuperClass.prototype.constructor); - - calledConstructor = DecoratorClass.prototype.constructor; - } - - calledConstructor.apply(this, arguments); - } - - DecoratorClass.displayName = SuperClass.displayName; - - function ctr () { - this.constructor = DecoratedClass; - } - - DecoratedClass.prototype = new ctr(); - - for (var m = 0; m < superMethods.length; m++) { - var superMethod = superMethods[m]; - - DecoratedClass.prototype[superMethod] = - SuperClass.prototype[superMethod]; - } - - var calledMethod = function (methodName) { - // Stub out the original method if it's not decorating an actual method - var originalMethod = function () {}; - - if (methodName in DecoratedClass.prototype) { - originalMethod = DecoratedClass.prototype[methodName]; - } - - var decoratedMethod = DecoratorClass.prototype[methodName]; - - return function () { - var unshift = Array.prototype.unshift; - - unshift.call(arguments, originalMethod); - - return decoratedMethod.apply(this, arguments); - }; - }; - - for (var d = 0; d < decoratedMethods.length; d++) { - var decoratedMethod = decoratedMethods[d]; - - DecoratedClass.prototype[decoratedMethod] = calledMethod(decoratedMethod); - } - - return DecoratedClass; - }; - - var Observable = function () { - this.listeners = {}; - }; - - Observable.prototype.on = function (event, callback) { - this.listeners = this.listeners || {}; - - if (event in this.listeners) { - this.listeners[event].push(callback); - } else { - this.listeners[event] = [callback]; - } - }; - - Observable.prototype.trigger = function (event) { - var slice = Array.prototype.slice; - - this.listeners = this.listeners || {}; - - if (event in this.listeners) { - this.invoke(this.listeners[event], slice.call(arguments, 1)); - } - - if ('*' in this.listeners) { - this.invoke(this.listeners['*'], arguments); - } - }; - - Observable.prototype.invoke = function (listeners, params) { - for (var i = 0, len = listeners.length; i < len; i++) { - listeners[i].apply(this, params); - } - }; - - Utils.Observable = Observable; - - Utils.generateChars = function (length) { - var chars = ''; - - for (var i = 0; i < length; i++) { - var randomChar = Math.floor(Math.random() * 36); - chars += randomChar.toString(36); - } - - return chars; - }; - - Utils.bind = function (func, context) { - return function () { - func.apply(context, arguments); - }; - }; - - Utils._convertData = function (data) { - for (var originalKey in data) { - var keys = originalKey.split('-'); - - var dataLevel = data; - - if (keys.length === 1) { - continue; - } - - for (var k = 0; k < keys.length; k++) { - var key = keys[k]; - - // Lowercase the first letter - // By default, dash-separated becomes camelCase - key = key.substring(0, 1).toLowerCase() + key.substring(1); - - if (!(key in dataLevel)) { - dataLevel[key] = {}; - } - - if (k == keys.length - 1) { - dataLevel[key] = data[originalKey]; - } - - dataLevel = dataLevel[key]; - } - - delete data[originalKey]; - } - - return data; - }; - - Utils.hasScroll = function (index, el) { - // Adapted from the function created by @ShadowScripter - // and adapted by @BillBarry on the Stack Exchange Code Review website. - // The original code can be found at - // http://codereview.stackexchange.com/q/13338 - // and was designed to be used with the Sizzle selector engine. - - var $el = $(el); - var overflowX = el.style.overflowX; - var overflowY = el.style.overflowY; - - //Check both x and y declarations - if (overflowX === overflowY && - (overflowY === 'hidden' || overflowY === 'visible')) { - return false; - } - - if (overflowX === 'scroll' || overflowY === 'scroll') { - return true; - } - - return ($el.innerHeight() < el.scrollHeight || - $el.innerWidth() < el.scrollWidth); - }; - - Utils.escapeMarkup = function (markup) { - var replaceMap = { - '\\': '\', - '&': '&', - '<': '<', - '>': '>', - '"': '"', - '\'': ''', - '/': '/' - }; - - // Do not try to escape the markup if it's not a string - if (typeof markup !== 'string') { - return markup; - } - - return String(markup).replace(/[&<>"'\/\\]/g, function (match) { - return replaceMap[match]; - }); - }; - - return Utils; -}); - -define('select2/results',[ - 'jquery', - './utils' -], function ($, Utils) { - function Results ($element, options, dataAdapter) { - this.$element = $element; - this.data = dataAdapter; - this.options = options; - - Results.__super__.constructor.call(this); - } - - Utils.Extend(Results, Utils.Observable); - - Results.prototype.render = function () { - var $results = $( - '<ul class="select2-results__options" role="tree"></ul>' - ); - - if (this.options.get('multiple')) { - $results.attr('aria-multiselectable', 'true'); - } - - this.$results = $results; - - return $results; - }; - - Results.prototype.clear = function () { - this.$results.empty(); - }; - - Results.prototype.displayMessage = function (params) { - var escapeMarkup = this.options.get('escapeMarkup'); - - this.clear(); - this.hideLoading(); - - var $message = $( - '<li role="treeitem" class="select2-results__option"></li>' - ); - - var message = this.options.get('translations').get(params.message); - - $message.append( - escapeMarkup( - message(params.args) - ) - ); - - this.$results.append($message); - }; - - Results.prototype.append = function (data) { - this.hideLoading(); - - var $options = []; - - if (data.results == null || data.results.length === 0) { - if (this.$results.children().length === 0) { - this.trigger('results:message', { - message: 'noResults' - }); - } - - return; - } - - data.results = this.sort(data.results); - - for (var d = 0; d < data.results.length; d++) { - var item = data.results[d]; - - var $option = this.option(item); - - $options.push($option); - } - - this.$results.append($options); - }; - - Results.prototype.position = function ($results, $dropdown) { - var $resultsContainer = $dropdown.find('.select2-results'); - $resultsContainer.append($results); - }; - - Results.prototype.sort = function (data) { - var sorter = this.options.get('sorter'); - - return sorter(data); - }; - - Results.prototype.setClasses = function () { - var self = this; - - this.data.current(function (selected) { - var selectedIds = $.map(selected, function (s) { - return s.id.toString(); - }); - - var $options = self.$results - .find('.select2-results__option[aria-selected]'); - - $options.each(function () { - var $option = $(this); - - var item = $.data(this, 'data'); - - if ($.inArray(item.id, selectedIds) > -1) { - $option.attr('aria-selected', 'true'); - } else { - $option.attr('aria-selected', 'false'); - } - }); - - var $selected = $options.filter('[aria-selected=true]'); - - // Check if there are any selected options - if ($selected.length > 0) { - // If there are selected options, highlight the first - $selected.first().trigger('mouseenter'); - } else { - // If there are no selected options, highlight the first option - // in the dropdown - $options.first().trigger('mouseenter'); - } - }); - }; - - Results.prototype.showLoading = function (params) { - this.hideLoading(); - - var loadingMore = this.options.get('translations').get('searching'); - - var loading = { - disabled: true, - loading: true, - text: loadingMore(params) - }; - var $loading = this.option(loading); - $loading.className += ' loading-results'; - - this.$results.prepend($loading); - }; - - Results.prototype.hideLoading = function () { - this.$results.find('.loading-results').remove(); - }; - - Results.prototype.option = function (data) { - var option = document.createElement('li'); - option.className = 'select2-results__option'; - - var attrs = { - 'role': 'treeitem', - 'aria-selected': 'false' - }; - - if (data.disabled) { - delete attrs['aria-selected']; - attrs['aria-disabled'] = 'true'; - } - - if (data.id == null) { - delete attrs['aria-selected']; - } - - if (data._resultId != null) { - option.id = data._resultId; - } - - if (data.title) { - option.title = data.title; - } - - if (data.children) { - attrs.role = 'group'; - attrs['aria-label'] = data.text; - delete attrs['aria-selected']; - } - - for (var attr in attrs) { - var val = attrs[attr]; - - option.setAttribute(attr, val); - } - - if (data.children) { - var $option = $(option); - - var label = document.createElement('strong'); - label.className = 'select2-results__group'; - - var $label = $(label); - this.template(data, label); - - var $children = []; - - for (var c = 0; c < data.children.length; c++) { - var child = data.children[c]; - - var $child = this.option(child); - - $children.push($child); - } - - var $childrenContainer = $('<ul></ul>', { - 'class': 'select2-results__options select2-results__options--nested' - }); - - $childrenContainer.append($children); - - $option.append(label); - $option.append($childrenContainer); - } else { - this.template(data, option); - } - - $.data(option, 'data', data); - - return option; - }; - - Results.prototype.bind = function (container, $container) { - var self = this; - - var id = container.id + '-results'; - - this.$results.attr('id', id); - - container.on('results:all', function (params) { - self.clear(); - self.append(params.data); - - if (container.isOpen()) { - self.setClasses(); - } - }); - - container.on('results:append', function (params) { - self.append(params.data); - - if (container.isOpen()) { - self.setClasses(); - } - }); - - container.on('query', function (params) { - self.showLoading(params); - }); - - container.on('select', function () { - if (!container.isOpen()) { - return; - } - - self.setClasses(); - }); - - container.on('unselect', function () { - if (!container.isOpen()) { - return; - } - - self.setClasses(); - }); - - container.on('open', function () { - // When the dropdown is open, aria-expended="true" - self.$results.attr('aria-expanded', 'true'); - self.$results.attr('aria-hidden', 'false'); - - self.setClasses(); - self.ensureHighlightVisible(); - }); - - container.on('close', function () { - // When the dropdown is closed, aria-expended="false" - self.$results.attr('aria-expanded', 'false'); - self.$results.attr('aria-hidden', 'true'); - self.$results.removeAttr('aria-activedescendant'); - }); - - container.on('results:toggle', function () { - var $highlighted = self.getHighlightedResults(); - - if ($highlighted.length === 0) { - return; - } - - $highlighted.trigger('mouseup'); - }); - - container.on('results:select', function () { - var $highlighted = self.getHighlightedResults(); - - if ($highlighted.length === 0) { - return; - } - - var data = $highlighted.data('data'); - - if ($highlighted.attr('aria-selected') == 'true') { - self.trigger('close'); - } else { - self.trigger('select', { - data: data - }); - } - }); - - container.on('results:previous', function () { - var $highlighted = self.getHighlightedResults(); - - var $options = self.$results.find('[aria-selected]'); - - var currentIndex = $options.index($highlighted); - - // If we are already at te top, don't move further - if (currentIndex === 0) { - return; - } - - var nextIndex = currentIndex - 1; - - // If none are highlighted, highlight the first - if ($highlighted.length === 0) { - nextIndex = 0; - } - - var $next = $options.eq(nextIndex); - - $next.trigger('mouseenter'); - - var currentOffset = self.$results.offset().top; - var nextTop = $next.offset().top; - var nextOffset = self.$results.scrollTop() + (nextTop - currentOffset); - - if (nextIndex === 0) { - self.$results.scrollTop(0); - } else if (nextTop - currentOffset < 0) { - self.$results.scrollTop(nextOffset); - } - }); - - container.on('results:next', function () { - var $highlighted = self.getHighlightedResults(); - - var $options = self.$results.find('[aria-selected]'); - - var currentIndex = $options.index($highlighted); - - var nextIndex = currentIndex + 1; - - // If we are at the last option, stay there - if (nextIndex >= $options.length) { - return; - } - - var $next = $options.eq(nextIndex); - - $next.trigger('mouseenter'); - - var currentOffset = self.$results.offset().top + - self.$results.outerHeight(false); - var nextBottom = $next.offset().top + $next.outerHeight(false); - var nextOffset = self.$results.scrollTop() + nextBottom - currentOffset; - - if (nextIndex === 0) { - self.$results.scrollTop(0); - } else if (nextBottom > currentOffset) { - self.$results.scrollTop(nextOffset); - } - }); - - container.on('results:focus', function (params) { - params.element.addClass('select2-results__option--highlighted'); - }); - - container.on('results:message', function (params) { - self.displayMessage(params); - }); - - if ($.fn.mousewheel) { - this.$results.on('mousewheel', function (e) { - var top = self.$results.scrollTop(); - - var bottom = ( - self.$results.get(0).scrollHeight - - self.$results.scrollTop() + - e.deltaY - ); - - var isAtTop = e.deltaY > 0 && top - e.deltaY <= 0; - var isAtBottom = e.deltaY < 0 && bottom <= self.$results.height(); - - if (isAtTop) { - self.$results.scrollTop(0); - - e.preventDefault(); - e.stopPropagation(); - } else if (isAtBottom) { - self.$results.scrollTop( - self.$results.get(0).scrollHeight - self.$results.height() - ); - - e.preventDefault(); - e.stopPropagation(); - } - }); - } - - this.$results.on('mouseup', '.select2-results__option[aria-selected]', - function (evt) { - var $this = $(this); - - var data = $this.data('data'); - - if ($this.attr('aria-selected') === 'true') { - if (self.options.get('multiple')) { - self.trigger('unselect', { - originalEvent: evt, - data: data - }); - } else { - self.trigger('close'); - } - - return; - } - - self.trigger('select', { - originalEvent: evt, - data: data - }); - }); - - this.$results.on('mouseenter', '.select2-results__option[aria-selected]', - function (evt) { - var data = $(this).data('data'); - - self.getHighlightedResults() - .removeClass('select2-results__option--highlighted'); - - self.trigger('results:focus', { - data: data, - element: $(this) - }); - }); - }; - - Results.prototype.getHighlightedResults = function () { - var $highlighted = this.$results - .find('.select2-results__option--highlighted'); - - return $highlighted; - }; - - Results.prototype.destroy = function () { - this.$results.remove(); - }; - - Results.prototype.ensureHighlightVisible = function () { - var $highlighted = this.getHighlightedResults(); - - if ($highlighted.length === 0) { - return; - } - - var $options = this.$results.find('[aria-selected]'); - - var currentIndex = $options.index($highlighted); - - var currentOffset = this.$results.offset().top; - var nextTop = $highlighted.offset().top; - var nextOffset = this.$results.scrollTop() + (nextTop - currentOffset); - - var offsetDelta = nextTop - currentOffset; - nextOffset -= $highlighted.outerHeight(false) * 2; - - if (currentIndex <= 2) { - this.$results.scrollTop(0); - } else if (offsetDelta > this.$results.outerHeight() || offsetDelta < 0) { - this.$results.scrollTop(nextOffset); - } - }; - - Results.prototype.template = function (result, container) { - var template = this.options.get('templateResult'); - var escapeMarkup = this.options.get('escapeMarkup'); - - var content = template(result); - - if (content == null) { - container.style.display = 'none'; - } else if (typeof content === 'string') { - container.innerHTML = escapeMarkup(content); - } else { - $(container).append(content); - } - }; - - return Results; -}); - -define('select2/keys',[ - -], function () { - var KEYS = { - BACKSPACE: 8, - TAB: 9, - ENTER: 13, - SHIFT: 16, - CTRL: 17, - ALT: 18, - ESC: 27, - SPACE: 32, - PAGE_UP: 33, - PAGE_DOWN: 34, - END: 35, - HOME: 36, - LEFT: 37, - UP: 38, - RIGHT: 39, - DOWN: 40, - DELETE: 46 - }; - - return KEYS; -}); - -define('select2/selection/base',[ - 'jquery', - '../utils', - '../keys' -], function ($, Utils, KEYS) { - function BaseSelection ($element, options) { - this.$element = $element; - this.options = options; - - BaseSelection.__super__.constructor.call(this); - } - - Utils.Extend(BaseSelection, Utils.Observable); - - BaseSelection.prototype.render = function () { - var $selection = $( - '<span class="select2-selection" role="combobox" ' + - 'aria-autocomplete="list" aria-haspopup="true" aria-expanded="false">' + - '</span>' - ); - - this._tabindex = 0; - - if (this.$element.data('old-tabindex') != null) { - this._tabindex = this.$element.data('old-tabindex'); - } else if (this.$element.attr('tabindex') != null) { - this._tabindex = this.$element.attr('tabindex'); - } - - $selection.attr('title', this.$element.attr('title')); - $selection.attr('tabindex', this._tabindex); - - this.$selection = $selection; - - return $selection; - }; - - BaseSelection.prototype.bind = function (container, $container) { - var self = this; - - var id = container.id + '-container'; - var resultsId = container.id + '-results'; - - this.container = container; - - this.$selection.attr('aria-owns', resultsId); - - this.$selection.on('focus', function (evt) { - self.trigger('focus', evt); - }); - - this.$selection.on('blur', function (evt) { - self.trigger('blur', evt); - }); - - this.$selection.on('keydown', function (evt) { - self.trigger('keypress', evt); - - if (evt.which === KEYS.SPACE) { - evt.preventDefault(); - } - }); - - container.on('results:focus', function (params) { - self.$selection.attr('aria-activedescendant', params.data._resultId); - }); - - container.on('selection:update', function (params) { - self.update(params.data); - }); - - container.on('open', function () { - // When the dropdown is open, aria-expanded="true" - self.$selection.attr('aria-expanded', 'true'); - - self._attachCloseHandler(container); - }); - - container.on('close', function () { - // When the dropdown is closed, aria-expanded="false" - self.$selection.attr('aria-expanded', 'false'); - self.$selection.removeAttr('aria-activedescendant'); - - self.$selection.focus(); - - self._detachCloseHandler(container); - }); - - container.on('enable', function () { - self.$selection.attr('tabindex', self._tabindex); - }); - - container.on('disable', function () { - self.$selection.attr('tabindex', '-1'); - }); - }; - - BaseSelection.prototype._attachCloseHandler = function (container) { - var self = this; - - $(document.body).on('mousedown.select2.' + container.id, function (e) { - var $target = $(e.target); - - var $select = $target.closest('.select2'); - - var $all = $('.select2.select2-container--open'); - - $all.each(function () { - var $this = $(this); - - if (this == $select[0]) { - return; - } - - var $element = $this.data('element'); - - $element.select2('close'); - }); - }); - }; - - BaseSelection.prototype._detachCloseHandler = function (container) { - $(document.body).off('mousedown.select2.' + container.id); - }; - - BaseSelection.prototype.position = function ($selection, $container) { - var $selectionContainer = $container.find('.selection'); - $selectionContainer.append($selection); - }; - - BaseSelection.prototype.destroy = function () { - this._detachCloseHandler(this.container); - }; - - BaseSelection.prototype.update = function (data) { - throw new Error('The `update` method must be defined in child classes.'); - }; - - return BaseSelection; -}); - -define('select2/selection/single',[ - 'jquery', - './base', - '../utils', - '../keys' -], function ($, BaseSelection, Utils, KEYS) { - function SingleSelection () { - SingleSelection.__super__.constructor.apply(this, arguments); - } - - Utils.Extend(SingleSelection, BaseSelection); - - SingleSelection.prototype.render = function () { - var $selection = SingleSelection.__super__.render.call(this); - - $selection.addClass('select2-selection--single'); - - $selection.html( - '<span class="select2-selection__rendered"></span>' + - '<span class="select2-selection__arrow" role="presentation">' + - '<b role="presentation"></b>' + - '</span>' - ); - - return $selection; - }; - - SingleSelection.prototype.bind = function (container, $container) { - var self = this; - - SingleSelection.__super__.bind.apply(this, arguments); - - var id = container.id + '-container'; - - this.$selection.find('.select2-selection__rendered').attr('id', id); - this.$selection.attr('aria-labelledby', id); - - this.$selection.on('mousedown', function (evt) { - // Only respond to left clicks - if (evt.which !== 1) { - return; - } - - self.trigger('toggle', { - originalEvent: evt - }); - }); - - this.$selection.on('focus', function (evt) { - // User focuses on the container - }); - - this.$selection.on('blur', function (evt) { - // User exits the container - }); - - container.on('selection:update', function (params) { - self.update(params.data); - }); - }; - - SingleSelection.prototype.clear = function () { - this.$selection.find('.select2-selection__rendered').empty(); - }; - - SingleSelection.prototype.display = function (data) { - var template = this.options.get('templateSelection'); - var escapeMarkup = this.options.get('escapeMarkup'); - - return escapeMarkup(template(data)); - }; - - SingleSelection.prototype.selectionContainer = function () { - return $('<span></span>'); - }; - - SingleSelection.prototype.update = function (data) { - if (data.length === 0) { - this.clear(); - return; - } - - var selection = data[0]; - - var formatted = this.display(selection); - - var $rendered = this.$selection.find('.select2-selection__rendered'); - $rendered.empty().append(formatted); - $rendered.prop('title', selection.title || selection.text); - }; - - return SingleSelection; -}); - -define('select2/selection/multiple',[ - 'jquery', - './base', - '../utils' -], function ($, BaseSelection, Utils) { - function MultipleSelection ($element, options) { - MultipleSelection.__super__.constructor.apply(this, arguments); - } - - Utils.Extend(MultipleSelection, BaseSelection); - - MultipleSelection.prototype.render = function () { - var $selection = MultipleSelection.__super__.render.call(this); - - $selection.addClass('select2-selection--multiple'); - - $selection.html( - '<ul class="select2-selection__rendered"></ul>' - ); - - return $selection; - }; - - MultipleSelection.prototype.bind = function (container, $container) { - var self = this; - - MultipleSelection.__super__.bind.apply(this, arguments); - - this.$selection.on('click', function (evt) { - self.trigger('toggle', { - originalEvent: evt - }); - }); - - this.$selection.on('click', '.select2-selection__choice__remove', - function (evt) { - var $remove = $(this); - var $selection = $remove.parent(); - - var data = $selection.data('data'); - - self.trigger('unselect', { - originalEvent: evt, - data: data - }); - }); - }; - - MultipleSelection.prototype.clear = function () { - this.$selection.find('.select2-selection__rendered').empty(); - }; - - MultipleSelection.prototype.display = function (data) { - var template = this.options.get('templateSelection'); - var escapeMarkup = this.options.get('escapeMarkup'); - - return escapeMarkup(template(data)); - }; - - MultipleSelection.prototype.selectionContainer = function () { - var $container = $( - '<li class="select2-selection__choice">' + - '<span class="select2-selection__choice__remove" role="presentation">' + - '×' + - '</span>' + - '</li>' - ); - - return $container; - }; - - MultipleSelection.prototype.update = function (data) { - this.clear(); - - if (data.length === 0) { - return; - } - - var $selections = []; - - for (var d = 0; d < data.length; d++) { - var selection = data[d]; - - var formatted = this.display(selection); - var $selection = this.selectionContainer(); - - $selection.append(formatted); - $selection.prop('title', selection.title || selection.text); - - $selection.data('data', selection); - - $selections.push($selection); - } - - this.$selection.find('.select2-selection__rendered').append($selections); - }; - - return MultipleSelection; -}); - -define('select2/selection/placeholder',[ - '../utils' -], function (Utils) { - function Placeholder (decorated, $element, options) { - this.placeholder = this.normalizePlaceholder(options.get('placeholder')); - - decorated.call(this, $element, options); - } - - Placeholder.prototype.normalizePlaceholder = function (_, placeholder) { - if (typeof placeholder === 'string') { - placeholder = { - id: '', - text: placeholder - }; - } - - return placeholder; - }; - - Placeholder.prototype.createPlaceholder = function (decorated, placeholder) { - var $placeholder = this.selectionContainer(); - - $placeholder.html(this.display(placeholder)); - $placeholder.addClass('select2-selection__placeholder') - .removeClass('select2-selection__choice'); - - return $placeholder; - }; - - Placeholder.prototype.update = function (decorated, data) { - var singlePlaceholder = ( - data.length == 1 && data[0].id != this.placeholder.id - ); - var multipleSelections = data.length > 1; - - if (multipleSelections || singlePlaceholder) { - return decorated.call(this, data); - } - - this.clear(); - - var $placeholder = this.createPlaceholder(this.placeholder); - - this.$selection.find('.select2-selection__rendered').append($placeholder); - }; - - return Placeholder; -}); - -define('select2/selection/allowClear',[ - 'jquery' -], function ($) { - function AllowClear () { } - - AllowClear.prototype.bind = function (decorated, container, $container) { - var self = this; - - decorated.call(this, container, $container); - - if (self.placeholder == null) { - if (window.console && console.error) { - console.error( - 'Select2: The `allowClear` option should be used in combination ' + - 'with the `placeholder` option.' - ); - } - } - - this.$selection.on('mousedown', '.select2-selection__clear', - function (evt) { - // Ignore the event if it is disabled - if (self.options.get('disabled')) { - return; - } - - evt.stopPropagation(); - - var data = $(this).data('data'); - - for (var d = 0; d < data.length; d++) { - var unselectData = { - data: data[d] - }; - - // Trigger the `unselect` event, so people can prevent it from being - // cleared. - self.trigger('unselect', unselectData); - - // If the event was prevented, don't clear it out. - if (unselectData.prevented) { - return; - } - } - - self.$element.val(self.placeholder.id).trigger('change'); - - self.trigger('toggle'); - }); - }; - - AllowClear.prototype.update = function (decorated, data) { - decorated.call(this, data); - - if (this.$selection.find('.select2-selection__placeholder').length > 0 || - data.length === 0) { - return; - } - - var $remove = $( - '<span class="select2-selection__clear">' + - '×' + - '</span>' - ); - $remove.data('data', data); - - this.$selection.find('.select2-selection__rendered').append($remove); - }; - - return AllowClear; -}); - -define('select2/selection/search',[ - 'jquery', - '../utils', - '../keys' -], function ($, Utils, KEYS) { - function Search (decorated, $element, options) { - decorated.call(this, $element, options); - } - - Search.prototype.render = function (decorated) { - var $search = $( - '<li class="select2-search select2-search--inline">' + - '<input class="select2-search__field" type="search" tabindex="-1"' + - ' autocomplete="off" autocorrect="off" autocapitalize="off"' + - ' spellcheck="false" role="textbox" />' + - '</li>' - ); - - this.$searchContainer = $search; - this.$search = $search.find('input'); - - var $rendered = decorated.call(this); - - return $rendered; - }; - - Search.prototype.bind = function (decorated, container, $container) { - var self = this; - - decorated.call(this, container, $container); - - container.on('open', function () { - self.$search.attr('tabindex', 0); - - self.$search.focus(); - }); - - container.on('close', function () { - self.$search.attr('tabindex', -1); - - self.$search.val(''); - self.$search.focus(); - }); - - container.on('enable', function () { - self.$search.prop('disabled', false); - }); - - container.on('disable', function () { - self.$search.prop('disabled', true); - }); - - this.$selection.on('focusin', '.select2-search--inline', function (evt) { - self.trigger('focus', evt); - }); - - this.$selection.on('focusout', '.select2-search--inline', function (evt) { - self.trigger('blur', evt); - }); - - this.$selection.on('keydown', '.select2-search--inline', function (evt) { - evt.stopPropagation(); - - self.trigger('keypress', evt); - - self._keyUpPrevented = evt.isDefaultPrevented(); - - var key = evt.which; - - if (key === KEYS.BACKSPACE && self.$search.val() === '') { - var $previousChoice = self.$searchContainer - .prev('.select2-selection__choice'); - - if ($previousChoice.length > 0) { - var item = $previousChoice.data('data'); - - self.searchRemoveChoice(item); - } - } - }); - - // Workaround for browsers which do not support the `input` event - // This will prevent double-triggering of events for browsers which support - // both the `keyup` and `input` events. - this.$selection.on('input', '.select2-search--inline', function (evt) { - // Unbind the duplicated `keyup` event - self.$selection.off('keyup.search'); - }); - - this.$selection.on('keyup.search input', '.select2-search--inline', - function (evt) { - self.handleSearch(evt); - }); - }; - - Search.prototype.createPlaceholder = function (decorated, placeholder) { - this.$search.attr('placeholder', placeholder.text); - }; - - Search.prototype.update = function (decorated, data) { - this.$search.attr('placeholder', ''); - - decorated.call(this, data); - - this.$selection.find('.select2-selection__rendered') - .append(this.$searchContainer); - - this.resizeSearch(); - }; - - Search.prototype.handleSearch = function () { - this.resizeSearch(); - - if (!this._keyUpPrevented) { - var input = this.$search.val(); - - this.trigger('query', { - term: input - }); - } - - this._keyUpPrevented = false; - }; - - Search.prototype.searchRemoveChoice = function (decorated, item) { - this.trigger('unselect', { - data: item - }); - - this.trigger('open'); - - this.$search.val(item.text + ' '); - }; - - Search.prototype.resizeSearch = function () { - this.$search.css('width', '25px'); - - var width = ''; - - if (this.$search.attr('placeholder') !== '') { - width = this.$selection.find('.select2-selection__rendered').innerWidth(); - } else { - var minimumWidth = this.$search.val().length + 1; - - width = (minimumWidth * 0.75) + 'em'; - } - - this.$search.css('width', width); - }; - - return Search; -}); - -define('select2/selection/eventRelay',[ - 'jquery' -], function ($) { - function EventRelay () { } - - EventRelay.prototype.bind = function (decorated, container, $container) { - var self = this; - var relayEvents = [ - 'open', 'opening', - 'close', 'closing', - 'select', 'selecting', - 'unselect', 'unselecting' - ]; - - var preventableEvents = ['opening', 'closing', 'selecting', 'unselecting']; - - decorated.call(this, container, $container); - - container.on('*', function (name, params) { - // Ignore events that should not be relayed - if ($.inArray(name, relayEvents) === -1) { - return; - } - - // The parameters should always be an object - params = params || {}; - - // Generate the jQuery event for the Select2 event - var evt = $.Event('select2:' + name, { - params: params - }); - - self.$element.trigger(evt); - - // Only handle preventable events if it was one - if ($.inArray(name, preventableEvents) === -1) { - return; - } - - params.prevented = evt.isDefaultPrevented(); - }); - }; - - return EventRelay; -}); - -define('select2/translation',[ - 'jquery' -], function ($) { - function Translation (dict) { - this.dict = dict || {}; - } - - Translation.prototype.all = function () { - return this.dict; - }; - - Translation.prototype.get = function (key) { - return this.dict[key]; - }; - - Translation.prototype.extend = function (translation) { - this.dict = $.extend({}, translation.all(), this.dict); - }; - - // Static functions - - Translation._cache = {}; - - Translation.loadPath = function (path) { - if (!(path in Translation._cache)) { - var translations = require(path); - - Translation._cache[path] = translations; - } - - return new Translation(Translation._cache[path]); - }; - - return Translation; -}); - -define('select2/diacritics',[ - -], function () { - var diacritics = { - '\u24B6': 'A', - '\uFF21': 'A', - '\u00C0': 'A', - '\u00C1': 'A', - '\u00C2': 'A', - '\u1EA6': 'A', - '\u1EA4': 'A', - '\u1EAA': 'A', - '\u1EA8': 'A', - '\u00C3': 'A', - '\u0100': 'A', - '\u0102': 'A', - '\u1EB0': 'A', - '\u1EAE': 'A', - '\u1EB4': 'A', - '\u1EB2': 'A', - '\u0226': 'A', - '\u01E0': 'A', - '\u00C4': 'A', - '\u01DE': 'A', - '\u1EA2': 'A', - '\u00C5': 'A', - '\u01FA': 'A', - '\u01CD': 'A', - '\u0200': 'A', - '\u0202': 'A', - '\u1EA0': 'A', - '\u1EAC': 'A', - '\u1EB6': 'A', - '\u1E00': 'A', - '\u0104': 'A', - '\u023A': 'A', - '\u2C6F': 'A', - '\uA732': 'AA', - '\u00C6': 'AE', - '\u01FC': 'AE', - '\u01E2': 'AE', - '\uA734': 'AO', - '\uA736': 'AU', - '\uA738': 'AV', - '\uA73A': 'AV', - '\uA73C': 'AY', - '\u24B7': 'B', - '\uFF22': 'B', - '\u1E02': 'B', - '\u1E04': 'B', - '\u1E06': 'B', - '\u0243': 'B', - '\u0182': 'B', - '\u0181': 'B', - '\u24B8': 'C', - '\uFF23': 'C', - '\u0106': 'C', - '\u0108': 'C', - '\u010A': 'C', - '\u010C': 'C', - '\u00C7': 'C', - '\u1E08': 'C', - '\u0187': 'C', - '\u023B': 'C', - '\uA73E': 'C', - '\u24B9': 'D', - '\uFF24': 'D', - '\u1E0A': 'D', - '\u010E': 'D', - '\u1E0C': 'D', - '\u1E10': 'D', - '\u1E12': 'D', - '\u1E0E': 'D', - '\u0110': 'D', - '\u018B': 'D', - '\u018A': 'D', - '\u0189': 'D', - '\uA779': 'D', - '\u01F1': 'DZ', - '\u01C4': 'DZ', - '\u01F2': 'Dz', - '\u01C5': 'Dz', - '\u24BA': 'E', - '\uFF25': 'E', - '\u00C8': 'E', - '\u00C9': 'E', - '\u00CA': 'E', - '\u1EC0': 'E', - '\u1EBE': 'E', - '\u1EC4': 'E', - '\u1EC2': 'E', - '\u1EBC': 'E', - '\u0112': 'E', - '\u1E14': 'E', - '\u1E16': 'E', - '\u0114': 'E', - '\u0116': 'E', - '\u00CB': 'E', - '\u1EBA': 'E', - '\u011A': 'E', - '\u0204': 'E', - '\u0206': 'E', - '\u1EB8': 'E', - '\u1EC6': 'E', - '\u0228': 'E', - '\u1E1C': 'E', - '\u0118': 'E', - '\u1E18': 'E', - '\u1E1A': 'E', - '\u0190': 'E', - '\u018E': 'E', - '\u24BB': 'F', - '\uFF26': 'F', - '\u1E1E': 'F', - '\u0191': 'F', - '\uA77B': 'F', - '\u24BC': 'G', - '\uFF27': 'G', - '\u01F4': 'G', - '\u011C': 'G', - '\u1E20': 'G', - '\u011E': 'G', - '\u0120': 'G', - '\u01E6': 'G', - '\u0122': 'G', - '\u01E4': 'G', - '\u0193': 'G', - '\uA7A0': 'G', - '\uA77D': 'G', - '\uA77E': 'G', - '\u24BD': 'H', - '\uFF28': 'H', - '\u0124': 'H', - '\u1E22': 'H', - '\u1E26': 'H', - '\u021E': 'H', - '\u1E24': 'H', - '\u1E28': 'H', - '\u1E2A': 'H', - '\u0126': 'H', - '\u2C67': 'H', - '\u2C75': 'H', - '\uA78D': 'H', - '\u24BE': 'I', - '\uFF29': 'I', - '\u00CC': 'I', - '\u00CD': 'I', - '\u00CE': 'I', - '\u0128': 'I', - '\u012A': 'I', - '\u012C': 'I', - '\u0130': 'I', - '\u00CF': 'I', - '\u1E2E': 'I', - '\u1EC8': 'I', - '\u01CF': 'I', - '\u0208': 'I', - '\u020A': 'I', - '\u1ECA': 'I', - '\u012E': 'I', - '\u1E2C': 'I', - '\u0197': 'I', - '\u24BF': 'J', - '\uFF2A': 'J', - '\u0134': 'J', - '\u0248': 'J', - '\u24C0': 'K', - '\uFF2B': 'K', - '\u1E30': 'K', - '\u01E8': 'K', - '\u1E32': 'K', - '\u0136': 'K', - '\u1E34': 'K', - '\u0198': 'K', - '\u2C69': 'K', - '\uA740': 'K', - '\uA742': 'K', - '\uA744': 'K', - '\uA7A2': 'K', - '\u24C1': 'L', - '\uFF2C': 'L', - '\u013F': 'L', - '\u0139': 'L', - '\u013D': 'L', - '\u1E36': 'L', - '\u1E38': 'L', - '\u013B': 'L', - '\u1E3C': 'L', - '\u1E3A': 'L', - '\u0141': 'L', - '\u023D': 'L', - '\u2C62': 'L', - '\u2C60': 'L', - '\uA748': 'L', - '\uA746': 'L', - '\uA780': 'L', - '\u01C7': 'LJ', - '\u01C8': 'Lj', - '\u24C2': 'M', - '\uFF2D': 'M', - '\u1E3E': 'M', - '\u1E40': 'M', - '\u1E42': 'M', - '\u2C6E': 'M', - '\u019C': 'M', - '\u24C3': 'N', - '\uFF2E': 'N', - '\u01F8': 'N', - '\u0143': 'N', - '\u00D1': 'N', - '\u1E44': 'N', - '\u0147': 'N', - '\u1E46': 'N', - '\u0145': 'N', - '\u1E4A': 'N', - '\u1E48': 'N', - '\u0220': 'N', - '\u019D': 'N', - '\uA790': 'N', - '\uA7A4': 'N', - '\u01CA': 'NJ', - '\u01CB': 'Nj', - '\u24C4': 'O', - '\uFF2F': 'O', - '\u00D2': 'O', - '\u00D3': 'O', - '\u00D4': 'O', - '\u1ED2': 'O', - '\u1ED0': 'O', - '\u1ED6': 'O', - '\u1ED4': 'O', - '\u00D5': 'O', - '\u1E4C': 'O', - '\u022C': 'O', - '\u1E4E': 'O', - '\u014C': 'O', - '\u1E50': 'O', - '\u1E52': 'O', - '\u014E': 'O', - '\u022E': 'O', - '\u0230': 'O', - '\u00D6': 'O', - '\u022A': 'O', - '\u1ECE': 'O', - '\u0150': 'O', - '\u01D1': 'O', - '\u020C': 'O', - '\u020E': 'O', - '\u01A0': 'O', - '\u1EDC': 'O', - '\u1EDA': 'O', - '\u1EE0': 'O', - '\u1EDE': 'O', - '\u1EE2': 'O', - '\u1ECC': 'O', - '\u1ED8': 'O', - '\u01EA': 'O', - '\u01EC': 'O', - '\u00D8': 'O', - '\u01FE': 'O', - '\u0186': 'O', - '\u019F': 'O', - '\uA74A': 'O', - '\uA74C': 'O', - '\u01A2': 'OI', - '\uA74E': 'OO', - '\u0222': 'OU', - '\u24C5': 'P', - '\uFF30': 'P', - '\u1E54': 'P', - '\u1E56': 'P', - '\u01A4': 'P', - '\u2C63': 'P', - '\uA750': 'P', - '\uA752': 'P', - '\uA754': 'P', - '\u24C6': 'Q', - '\uFF31': 'Q', - '\uA756': 'Q', - '\uA758': 'Q', - '\u024A': 'Q', - '\u24C7': 'R', - '\uFF32': 'R', - '\u0154': 'R', - '\u1E58': 'R', - '\u0158': 'R', - '\u0210': 'R', - '\u0212': 'R', - '\u1E5A': 'R', - '\u1E5C': 'R', - '\u0156': 'R', - '\u1E5E': 'R', - '\u024C': 'R', - '\u2C64': 'R', - '\uA75A': 'R', - '\uA7A6': 'R', - '\uA782': 'R', - '\u24C8': 'S', - '\uFF33': 'S', - '\u1E9E': 'S', - '\u015A': 'S', - '\u1E64': 'S', - '\u015C': 'S', - '\u1E60': 'S', - '\u0160': 'S', - '\u1E66': 'S', - '\u1E62': 'S', - '\u1E68': 'S', - '\u0218': 'S', - '\u015E': 'S', - '\u2C7E': 'S', - '\uA7A8': 'S', - '\uA784': 'S', - '\u24C9': 'T', - '\uFF34': 'T', - '\u1E6A': 'T', - '\u0164': 'T', - '\u1E6C': 'T', - '\u021A': 'T', - '\u0162': 'T', - '\u1E70': 'T', - '\u1E6E': 'T', - '\u0166': 'T', - '\u01AC': 'T', - '\u01AE': 'T', - '\u023E': 'T', - '\uA786': 'T', - '\uA728': 'TZ', - '\u24CA': 'U', - '\uFF35': 'U', - '\u00D9': 'U', - '\u00DA': 'U', - '\u00DB': 'U', - '\u0168': 'U', - '\u1E78': 'U', - '\u016A': 'U', - '\u1E7A': 'U', - '\u016C': 'U', - '\u00DC': 'U', - '\u01DB': 'U', - '\u01D7': 'U', - '\u01D5': 'U', - '\u01D9': 'U', - '\u1EE6': 'U', - '\u016E': 'U', - '\u0170': 'U', - '\u01D3': 'U', - '\u0214': 'U', - '\u0216': 'U', - '\u01AF': 'U', - '\u1EEA': 'U', - '\u1EE8': 'U', - '\u1EEE': 'U', - '\u1EEC': 'U', - '\u1EF0': 'U', - '\u1EE4': 'U', - '\u1E72': 'U', - '\u0172': 'U', - '\u1E76': 'U', - '\u1E74': 'U', - '\u0244': 'U', - '\u24CB': 'V', - '\uFF36': 'V', - '\u1E7C': 'V', - '\u1E7E': 'V', - '\u01B2': 'V', - '\uA75E': 'V', - '\u0245': 'V', - '\uA760': 'VY', - '\u24CC': 'W', - '\uFF37': 'W', - '\u1E80': 'W', - '\u1E82': 'W', - '\u0174': 'W', - '\u1E86': 'W', - '\u1E84': 'W', - '\u1E88': 'W', - '\u2C72': 'W', - '\u24CD': 'X', - '\uFF38': 'X', - '\u1E8A': 'X', - '\u1E8C': 'X', - '\u24CE': 'Y', - '\uFF39': 'Y', - '\u1EF2': 'Y', - '\u00DD': 'Y', - '\u0176': 'Y', - '\u1EF8': 'Y', - '\u0232': 'Y', - '\u1E8E': 'Y', - '\u0178': 'Y', - '\u1EF6': 'Y', - '\u1EF4': 'Y', - '\u01B3': 'Y', - '\u024E': 'Y', - '\u1EFE': 'Y', - '\u24CF': 'Z', - '\uFF3A': 'Z', - '\u0179': 'Z', - '\u1E90': 'Z', - '\u017B': 'Z', - '\u017D': 'Z', - '\u1E92': 'Z', - '\u1E94': 'Z', - '\u01B5': 'Z', - '\u0224': 'Z', - '\u2C7F': 'Z', - '\u2C6B': 'Z', - '\uA762': 'Z', - '\u24D0': 'a', - '\uFF41': 'a', - '\u1E9A': 'a', - '\u00E0': 'a', - '\u00E1': 'a', - '\u00E2': 'a', - '\u1EA7': 'a', - '\u1EA5': 'a', - '\u1EAB': 'a', - '\u1EA9': 'a', - '\u00E3': 'a', - '\u0101': 'a', - '\u0103': 'a', - '\u1EB1': 'a', - '\u1EAF': 'a', - '\u1EB5': 'a', - '\u1EB3': 'a', - '\u0227': 'a', - '\u01E1': 'a', - '\u00E4': 'a', - '\u01DF': 'a', - '\u1EA3': 'a', - '\u00E5': 'a', - '\u01FB': 'a', - '\u01CE': 'a', - '\u0201': 'a', - '\u0203': 'a', - '\u1EA1': 'a', - '\u1EAD': 'a', - '\u1EB7': 'a', - '\u1E01': 'a', - '\u0105': 'a', - '\u2C65': 'a', - '\u0250': 'a', - '\uA733': 'aa', - '\u00E6': 'ae', - '\u01FD': 'ae', - '\u01E3': 'ae', - '\uA735': 'ao', - '\uA737': 'au', - '\uA739': 'av', - '\uA73B': 'av', - '\uA73D': 'ay', - '\u24D1': 'b', - '\uFF42': 'b', - '\u1E03': 'b', - '\u1E05': 'b', - '\u1E07': 'b', - '\u0180': 'b', - '\u0183': 'b', - '\u0253': 'b', - '\u24D2': 'c', - '\uFF43': 'c', - '\u0107': 'c', - '\u0109': 'c', - '\u010B': 'c', - '\u010D': 'c', - '\u00E7': 'c', - '\u1E09': 'c', - '\u0188': 'c', - '\u023C': 'c', - '\uA73F': 'c', - '\u2184': 'c', - '\u24D3': 'd', - '\uFF44': 'd', - '\u1E0B': 'd', - '\u010F': 'd', - '\u1E0D': 'd', - '\u1E11': 'd', - '\u1E13': 'd', - '\u1E0F': 'd', - '\u0111': 'd', - '\u018C': 'd', - '\u0256': 'd', - '\u0257': 'd', - '\uA77A': 'd', - '\u01F3': 'dz', - '\u01C6': 'dz', - '\u24D4': 'e', - '\uFF45': 'e', - '\u00E8': 'e', - '\u00E9': 'e', - '\u00EA': 'e', - '\u1EC1': 'e', - '\u1EBF': 'e', - '\u1EC5': 'e', - '\u1EC3': 'e', - '\u1EBD': 'e', - '\u0113': 'e', - '\u1E15': 'e', - '\u1E17': 'e', - '\u0115': 'e', - '\u0117': 'e', - '\u00EB': 'e', - '\u1EBB': 'e', - '\u011B': 'e', - '\u0205': 'e', - '\u0207': 'e', - '\u1EB9': 'e', - '\u1EC7': 'e', - '\u0229': 'e', - '\u1E1D': 'e', - '\u0119': 'e', - '\u1E19': 'e', - '\u1E1B': 'e', - '\u0247': 'e', - '\u025B': 'e', - '\u01DD': 'e', - '\u24D5': 'f', - '\uFF46': 'f', - '\u1E1F': 'f', - '\u0192': 'f', - '\uA77C': 'f', - '\u24D6': 'g', - '\uFF47': 'g', - '\u01F5': 'g', - '\u011D': 'g', - '\u1E21': 'g', - '\u011F': 'g', - '\u0121': 'g', - '\u01E7': 'g', - '\u0123': 'g', - '\u01E5': 'g', - '\u0260': 'g', - '\uA7A1': 'g', - '\u1D79': 'g', - '\uA77F': 'g', - '\u24D7': 'h', - '\uFF48': 'h', - '\u0125': 'h', - '\u1E23': 'h', - '\u1E27': 'h', - '\u021F': 'h', - '\u1E25': 'h', - '\u1E29': 'h', - '\u1E2B': 'h', - '\u1E96': 'h', - '\u0127': 'h', - '\u2C68': 'h', - '\u2C76': 'h', - '\u0265': 'h', - '\u0195': 'hv', - '\u24D8': 'i', - '\uFF49': 'i', - '\u00EC': 'i', - '\u00ED': 'i', - '\u00EE': 'i', - '\u0129': 'i', - '\u012B': 'i', - '\u012D': 'i', - '\u00EF': 'i', - '\u1E2F': 'i', - '\u1EC9': 'i', - '\u01D0': 'i', - '\u0209': 'i', - '\u020B': 'i', - '\u1ECB': 'i', - '\u012F': 'i', - '\u1E2D': 'i', - '\u0268': 'i', - '\u0131': 'i', - '\u24D9': 'j', - '\uFF4A': 'j', - '\u0135': 'j', - '\u01F0': 'j', - '\u0249': 'j', - '\u24DA': 'k', - '\uFF4B': 'k', - '\u1E31': 'k', - '\u01E9': 'k', - '\u1E33': 'k', - '\u0137': 'k', - '\u1E35': 'k', - '\u0199': 'k', - '\u2C6A': 'k', - '\uA741': 'k', - '\uA743': 'k', - '\uA745': 'k', - '\uA7A3': 'k', - '\u24DB': 'l', - '\uFF4C': 'l', - '\u0140': 'l', - '\u013A': 'l', - '\u013E': 'l', - '\u1E37': 'l', - '\u1E39': 'l', - '\u013C': 'l', - '\u1E3D': 'l', - '\u1E3B': 'l', - '\u017F': 'l', - '\u0142': 'l', - '\u019A': 'l', - '\u026B': 'l', - '\u2C61': 'l', - '\uA749': 'l', - '\uA781': 'l', - '\uA747': 'l', - '\u01C9': 'lj', - '\u24DC': 'm', - '\uFF4D': 'm', - '\u1E3F': 'm', - '\u1E41': 'm', - '\u1E43': 'm', - '\u0271': 'm', - '\u026F': 'm', - '\u24DD': 'n', - '\uFF4E': 'n', - '\u01F9': 'n', - '\u0144': 'n', - '\u00F1': 'n', - '\u1E45': 'n', - '\u0148': 'n', - '\u1E47': 'n', - '\u0146': 'n', - '\u1E4B': 'n', - '\u1E49': 'n', - '\u019E': 'n', - '\u0272': 'n', - '\u0149': 'n', - '\uA791': 'n', - '\uA7A5': 'n', - '\u01CC': 'nj', - '\u24DE': 'o', - '\uFF4F': 'o', - '\u00F2': 'o', - '\u00F3': 'o', - '\u00F4': 'o', - '\u1ED3': 'o', - '\u1ED1': 'o', - '\u1ED7': 'o', - '\u1ED5': 'o', - '\u00F5': 'o', - '\u1E4D': 'o', - '\u022D': 'o', - '\u1E4F': 'o', - '\u014D': 'o', - '\u1E51': 'o', - '\u1E53': 'o', - '\u014F': 'o', - '\u022F': 'o', - '\u0231': 'o', - '\u00F6': 'o', - '\u022B': 'o', - '\u1ECF': 'o', - '\u0151': 'o', - '\u01D2': 'o', - '\u020D': 'o', - '\u020F': 'o', - '\u01A1': 'o', - '\u1EDD': 'o', - '\u1EDB': 'o', - '\u1EE1': 'o', - '\u1EDF': 'o', - '\u1EE3': 'o', - '\u1ECD': 'o', - '\u1ED9': 'o', - '\u01EB': 'o', - '\u01ED': 'o', - '\u00F8': 'o', - '\u01FF': 'o', - '\u0254': 'o', - '\uA74B': 'o', - '\uA74D': 'o', - '\u0275': 'o', - '\u01A3': 'oi', - '\u0223': 'ou', - '\uA74F': 'oo', - '\u24DF': 'p', - '\uFF50': 'p', - '\u1E55': 'p', - '\u1E57': 'p', - '\u01A5': 'p', - '\u1D7D': 'p', - '\uA751': 'p', - '\uA753': 'p', - '\uA755': 'p', - '\u24E0': 'q', - '\uFF51': 'q', - '\u024B': 'q', - '\uA757': 'q', - '\uA759': 'q', - '\u24E1': 'r', - '\uFF52': 'r', - '\u0155': 'r', - '\u1E59': 'r', - '\u0159': 'r', - '\u0211': 'r', - '\u0213': 'r', - '\u1E5B': 'r', - '\u1E5D': 'r', - '\u0157': 'r', - '\u1E5F': 'r', - '\u024D': 'r', - '\u027D': 'r', - '\uA75B': 'r', - '\uA7A7': 'r', - '\uA783': 'r', - '\u24E2': 's', - '\uFF53': 's', - '\u00DF': 's', - '\u015B': 's', - '\u1E65': 's', - '\u015D': 's', - '\u1E61': 's', - '\u0161': 's', - '\u1E67': 's', - '\u1E63': 's', - '\u1E69': 's', - '\u0219': 's', - '\u015F': 's', - '\u023F': 's', - '\uA7A9': 's', - '\uA785': 's', - '\u1E9B': 's', - '\u24E3': 't', - '\uFF54': 't', - '\u1E6B': 't', - '\u1E97': 't', - '\u0165': 't', - '\u1E6D': 't', - '\u021B': 't', - '\u0163': 't', - '\u1E71': 't', - '\u1E6F': 't', - '\u0167': 't', - '\u01AD': 't', - '\u0288': 't', - '\u2C66': 't', - '\uA787': 't', - '\uA729': 'tz', - '\u24E4': 'u', - '\uFF55': 'u', - '\u00F9': 'u', - '\u00FA': 'u', - '\u00FB': 'u', - '\u0169': 'u', - '\u1E79': 'u', - '\u016B': 'u', - '\u1E7B': 'u', - '\u016D': 'u', - '\u00FC': 'u', - '\u01DC': 'u', - '\u01D8': 'u', - '\u01D6': 'u', - '\u01DA': 'u', - '\u1EE7': 'u', - '\u016F': 'u', - '\u0171': 'u', - '\u01D4': 'u', - '\u0215': 'u', - '\u0217': 'u', - '\u01B0': 'u', - '\u1EEB': 'u', - '\u1EE9': 'u', - '\u1EEF': 'u', - '\u1EED': 'u', - '\u1EF1': 'u', - '\u1EE5': 'u', - '\u1E73': 'u', - '\u0173': 'u', - '\u1E77': 'u', - '\u1E75': 'u', - '\u0289': 'u', - '\u24E5': 'v', - '\uFF56': 'v', - '\u1E7D': 'v', - '\u1E7F': 'v', - '\u028B': 'v', - '\uA75F': 'v', - '\u028C': 'v', - '\uA761': 'vy', - '\u24E6': 'w', - '\uFF57': 'w', - '\u1E81': 'w', - '\u1E83': 'w', - '\u0175': 'w', - '\u1E87': 'w', - '\u1E85': 'w', - '\u1E98': 'w', - '\u1E89': 'w', - '\u2C73': 'w', - '\u24E7': 'x', - '\uFF58': 'x', - '\u1E8B': 'x', - '\u1E8D': 'x', - '\u24E8': 'y', - '\uFF59': 'y', - '\u1EF3': 'y', - '\u00FD': 'y', - '\u0177': 'y', - '\u1EF9': 'y', - '\u0233': 'y', - '\u1E8F': 'y', - '\u00FF': 'y', - '\u1EF7': 'y', - '\u1E99': 'y', - '\u1EF5': 'y', - '\u01B4': 'y', - '\u024F': 'y', - '\u1EFF': 'y', - '\u24E9': 'z', - '\uFF5A': 'z', - '\u017A': 'z', - '\u1E91': 'z', - '\u017C': 'z', - '\u017E': 'z', - '\u1E93': 'z', - '\u1E95': 'z', - '\u01B6': 'z', - '\u0225': 'z', - '\u0240': 'z', - '\u2C6C': 'z', - '\uA763': 'z', - '\u0386': '\u0391', - '\u0388': '\u0395', - '\u0389': '\u0397', - '\u038A': '\u0399', - '\u03AA': '\u0399', - '\u038C': '\u039F', - '\u038E': '\u03A5', - '\u03AB': '\u03A5', - '\u038F': '\u03A9', - '\u03AC': '\u03B1', - '\u03AD': '\u03B5', - '\u03AE': '\u03B7', - '\u03AF': '\u03B9', - '\u03CA': '\u03B9', - '\u0390': '\u03B9', - '\u03CC': '\u03BF', - '\u03CD': '\u03C5', - '\u03CB': '\u03C5', - '\u03B0': '\u03C5', - '\u03C9': '\u03C9', - '\u03C2': '\u03C3' - }; - - return diacritics; -}); - -define('select2/data/base',[ - '../utils' -], function (Utils) { - function BaseAdapter ($element, options) { - BaseAdapter.__super__.constructor.call(this); - } - - Utils.Extend(BaseAdapter, Utils.Observable); - - BaseAdapter.prototype.current = function (callback) { - throw new Error('The `current` method must be defined in child classes.'); - }; - - BaseAdapter.prototype.query = function (params, callback) { - throw new Error('The `query` method must be defined in child classes.'); - }; - - BaseAdapter.prototype.bind = function (container, $container) { - // Can be implemented in subclasses - }; - - BaseAdapter.prototype.destroy = function () { - // Can be implemented in subclasses - }; - - BaseAdapter.prototype.generateResultId = function (container, data) { - var id = container.id + '-result-'; - - id += Utils.generateChars(4); - - if (data.id != null) { - id += '-' + data.id.toString(); - } else { - id += '-' + Utils.generateChars(4); - } - return id; - }; - - return BaseAdapter; -}); - -define('select2/data/select',[ - './base', - '../utils', - 'jquery' -], function (BaseAdapter, Utils, $) { - function SelectAdapter ($element, options) { - this.$element = $element; - this.options = options; - - SelectAdapter.__super__.constructor.call(this); - } - - Utils.Extend(SelectAdapter, BaseAdapter); - - SelectAdapter.prototype.current = function (callback) { - var data = []; - var self = this; - - this.$element.find(':selected').each(function () { - var $option = $(this); - - var option = self.item($option); - - data.push(option); - }); - - callback(data); - }; - - SelectAdapter.prototype.select = function (data) { - var self = this; - - // If data.element is a DOM nose, use it instead - if ($(data.element).is('option')) { - data.element.selected = true; - - this.$element.trigger('change'); - - return; - } - - if (this.$element.prop('multiple')) { - this.current(function (currentData) { - var val = []; - - data = [data]; - data.push.apply(data, currentData); - - for (var d = 0; d < data.length; d++) { - var id = data[d].id; - - if ($.inArray(id, val) === -1) { - val.push(id); - } - } - - self.$element.val(val); - self.$element.trigger('change'); - }); - } else { - var val = data.id; - - this.$element.val(val); - this.$element.trigger('change'); - } - }; - - SelectAdapter.prototype.unselect = function (data) { - var self = this; - - if (!this.$element.prop('multiple')) { - return; - } - - if ($(data.element).is('option')) { - data.element.selected = false; - - this.$element.trigger('change'); - - return; - } - - this.current(function (currentData) { - var val = []; - - for (var d = 0; d < currentData.length; d++) { - var id = currentData[d].id; - - if (id !== data.id && $.inArray(id, val) === -1) { - val.push(id); - } - } - - self.$element.val(val); - - self.$element.trigger('change'); - }); - }; - - SelectAdapter.prototype.bind = function (container, $container) { - var self = this; - - this.container = container; - - container.on('select', function (params) { - self.select(params.data); - }); - - container.on('unselect', function (params) { - self.unselect(params.data); - }); - }; - - SelectAdapter.prototype.destroy = function () { - // Remove anything added to child elements - this.$element.find('*').each(function () { - // Remove any custom data set by Select2 - $.removeData(this, 'data'); - }); - }; - - SelectAdapter.prototype.query = function (params, callback) { - var data = []; - var self = this; - - var $options = this.$element.children(); - - $options.each(function () { - var $option = $(this); - - if (!$option.is('option') && !$option.is('optgroup')) { - return; - } - - var option = self.item($option); - - var matches = self.matches(params, option); - - if (matches !== null) { - data.push(matches); - } - }); - - callback({ - results: data - }); - }; - - SelectAdapter.prototype.addOptions = function ($options) { - this.$element.append($options); - }; - - SelectAdapter.prototype.option = function (data) { - var option; - - if (data.children) { - option = document.createElement('optgroup'); - option.label = data.text; - } else { - option = document.createElement('option'); - - if (option.textContent !== undefined) { - option.textContent = data.text; - } else { - option.innerText = data.text; - } - } - - if (data.id) { - option.value = data.id; - } - - if (data.disabled) { - option.disabled = true; - } - - if (data.selected) { - option.selected = true; - } - - if (data.title) { - option.title = data.title; - } - - var $option = $(option); - - var normalizedData = this._normalizeItem(data); - normalizedData.element = option; - - // Override the option's data with the combined data - $.data(option, 'data', normalizedData); - - return $option; - }; - - SelectAdapter.prototype.item = function ($option) { - var data = {}; - - data = $.data($option[0], 'data'); - - if (data != null) { - return data; - } - - if ($option.is('option')) { - data = { - id: $option.val(), - text: $option.html(), - disabled: $option.prop('disabled'), - selected: $option.prop('selected'), - title: $option.prop('title') - }; - } else if ($option.is('optgroup')) { - data = { - text: $option.prop('label'), - children: [], - title: $option.prop('title') - }; - - var $children = $option.children('option'); - var children = []; - - for (var c = 0; c < $children.length; c++) { - var $child = $($children[c]); - - var child = this.item($child); - - children.push(child); - } - - data.children = children; - } - - data = this._normalizeItem(data); - data.element = $option[0]; - - $.data($option[0], 'data', data); - - return data; - }; - - SelectAdapter.prototype._normalizeItem = function (item) { - if (!$.isPlainObject(item)) { - item = { - id: item, - text: item - }; - } - - item = $.extend({}, { - text: '' - }, item); - - var defaults = { - selected: false, - disabled: false - }; - - if (item.id != null) { - item.id = item.id.toString(); - } - - if (item.text != null) { - item.text = item.text.toString(); - } - - if (item._resultId == null && item.id && this.container != null) { - item._resultId = this.generateResultId(this.container, item); - } - - return $.extend({}, defaults, item); - }; - - SelectAdapter.prototype.matches = function (params, data) { - var matcher = this.options.get('matcher'); - - return matcher(params, data); - }; - - return SelectAdapter; -}); - -define('select2/data/array',[ - './select', - '../utils', - 'jquery' -], function (SelectAdapter, Utils, $) { - function ArrayAdapter ($element, options) { - var data = options.get('data') || []; - - ArrayAdapter.__super__.constructor.call(this, $element, options); - - this.addOptions(this.convertToOptions(data)); - } - - Utils.Extend(ArrayAdapter, SelectAdapter); - - ArrayAdapter.prototype.select = function (data) { - var $option = this.$element.find('option[value="' + data.id + '"]'); - - if ($option.length === 0) { - $option = this.option(data); - - this.addOptions([$option]); - } - - ArrayAdapter.__super__.select.call(this, data); - }; - - ArrayAdapter.prototype.convertToOptions = function (data) { - var self = this; - - var $existing = this.$element.find('option'); - var existingIds = $existing.map(function () { - return self.item($(this)).id; - }).get(); - - var $options = []; - - // Filter out all items except for the one passed in the argument - function onlyItem (item) { - return function () { - return $(this).val() == item.id; - }; - } - - for (var d = 0; d < data.length; d++) { - var item = this._normalizeItem(data[d]); - - // Skip items which were pre-loaded, only merge the data - if ($.inArray(item.id, existingIds) >= 0) { - var $existingOption = $existing.filter(onlyItem(item)); - - var existingData = this.item($existingOption); - var newData = $.extend(true, {}, existingData, item); - - var $newOption = this.option(existingData); - - $existingOption.replaceWith($newOption); - - continue; - } - - var $option = this.option(item); - - if (item.children) { - var $children = this.convertToOptions(item.children); - - $option.append($children); - } - - $options.push($option); - } - - return $options; - }; - - return ArrayAdapter; -}); - -define('select2/data/ajax',[ - './array', - '../utils', - 'jquery' -], function (ArrayAdapter, Utils, $) { - function AjaxAdapter ($element, options) { - this.ajaxOptions = this._applyDefaults(options.get('ajax')); - - if (this.ajaxOptions.processResults != null) { - this.processResults = this.ajaxOptions.processResults; - } - - ArrayAdapter.__super__.constructor.call(this, $element, options); - } - - Utils.Extend(AjaxAdapter, ArrayAdapter); - - AjaxAdapter.prototype._applyDefaults = function (options) { - var defaults = { - data: function (params) { - return { - q: params.term - }; - }, - transport: function (params, success, failure) { - var $request = $.ajax(params); - - $request.then(success); - $request.fail(failure); - - return $request; - } - }; - - return $.extend({}, defaults, options, true); - }; - - AjaxAdapter.prototype.processResults = function (results) { - return results; - }; - - AjaxAdapter.prototype.query = function (params, callback) { - var matches = []; - var self = this; - - if (this._request) { - this._request.abort(); - this._request = null; - } - - var options = $.extend({ - type: 'GET' - }, this.ajaxOptions); - - if (typeof options.url === 'function') { - options.url = options.url(params); - } - - if (typeof options.data === 'function') { - options.data = options.data(params); - } - - function request () { - var $request = options.transport(options, function (data) { - var results = self.processResults(data, params); - - if (window.console && console.error) { - // Check to make sure that the response included a `results` key. - if (!results || !results.results || !$.isArray(results.results)) { - console.error( - 'Select2: The AJAX results did not return an array in the ' + - '`results` key of the response.' - ); - } - } - - callback(results); - }, function () { - // TODO: Handle AJAX errors - }); - - self._request = $request; - } - - if (this.ajaxOptions.delay && params.term !== '') { - if (this._queryTimeout) { - window.clearTimeout(this._queryTimeout); - } - - this._queryTimeout = window.setTimeout(request, this.ajaxOptions.delay); - } else { - request(); - } - }; - - return AjaxAdapter; -}); - -define('select2/data/tags',[ - 'jquery' -], function ($) { - function Tags (decorated, $element, options) { - var tags = options.get('tags'); - - var createTag = options.get('createTag'); - - if (createTag !== undefined) { - this.createTag = createTag; - } - - decorated.call(this, $element, options); - - if ($.isArray(tags)) { - for (var t = 0; t < tags.length; t++) { - var tag = tags[t]; - var item = this._normalizeItem(tag); - - var $option = this.option(item); - - this.$element.append($option); - } - } - } - - Tags.prototype.query = function (decorated, params, callback) { - var self = this; - - this._removeOldTags(); - - if (params.term == null || params.term === '' || params.page != null) { - decorated.call(this, params, callback); - return; - } - - function wrapper (obj, child) { - var data = obj.results; - - for (var i = 0; i < data.length; i++) { - var option = data[i]; - - var checkChildren = ( - option.children != null && - !wrapper({ - results: option.children - }, true) - ); - - var checkText = option.text === params.term; - - if (checkText || checkChildren) { - if (child) { - return false; - } - - obj.data = data; - callback(obj); - - return; - } - } - - if (child) { - return true; - } - - var tag = self.createTag(params); - - if (tag != null) { - var $option = self.option(tag); - $option.attr('data-select2-tag', true); - - self.addOptions([$option]); - - self.insertTag(data, tag); - } - - obj.results = data; - - callback(obj); - } - - decorated.call(this, params, wrapper); - }; - - Tags.prototype.createTag = function (decorated, params) { - return { - id: params.term, - text: params.term - }; - }; - - Tags.prototype.insertTag = function (_, data, tag) { - data.unshift(tag); - }; - - Tags.prototype._removeOldTags = function (_) { - var tag = this._lastTag; - - var $options = this.$element.find('option[data-select2-tag]'); - - $options.each(function () { - if (this.selected) { - return; - } - - $(this).remove(); - }); - }; - - return Tags; -}); - -define('select2/data/tokenizer',[ - 'jquery' -], function ($) { - function Tokenizer (decorated, $element, options) { - var tokenizer = options.get('tokenizer'); - - if (tokenizer !== undefined) { - this.tokenizer = tokenizer; - } - - decorated.call(this, $element, options); - } - - Tokenizer.prototype.bind = function (decorated, container, $container) { - decorated.call(this, container, $container); - - this.$search = container.dropdown.$search || container.selection.$search || - $container.find('.select2-search__field'); - }; - - Tokenizer.prototype.query = function (decorated, params, callback) { - var self = this; - - function select (data) { - self.select(data); - } - - params.term = params.term || ''; - - var tokenData = this.tokenizer(params, this.options, select); - - if (tokenData.term !== params.term) { - // Replace the search term if we have the search box - if (this.$search.length) { - this.$search.val(tokenData.term); - this.$search.focus(); - } - - params.term = tokenData.term; - } - - decorated.call(this, params, callback); - }; - - Tokenizer.prototype.tokenizer = function (_, params, options, callback) { - var separators = options.get('tokenSeparators') || []; - var term = params.term; - var i = 0; - - var createTag = this.createTag || function (params) { - return { - id: params.term, - text: params.term - }; - }; - - while (i < term.length) { - var termChar = term[i]; - - if ($.inArray(termChar, separators) === -1) { - i++; - - continue; - } - - var part = term.substr(0, i); - var partParams = $.extend({}, params, { - term: part - }); - - var data = createTag(partParams); - - callback(data); - - // Reset the term to not include the tokenized portion - term = term.substr(i + 1) || ''; - i = 0; - } - - return { - term: term - }; - }; - - return Tokenizer; -}); - -define('select2/data/minimumInputLength',[ - -], function () { - function MinimumInputLength (decorated, $e, options) { - this.minimumInputLength = options.get('minimumInputLength'); - - decorated.call(this, $e, options); - } - - MinimumInputLength.prototype.query = function (decorated, params, callback) { - params.term = params.term || ''; - - if (params.term.length < this.minimumInputLength) { - this.trigger('results:message', { - message: 'inputTooShort', - args: { - minimum: this.minimumInputLength, - input: params.term, - params: params - } - }); - - return; - } - - decorated.call(this, params, callback); - }; - - return MinimumInputLength; -}); - -define('select2/data/maximumInputLength',[ - -], function () { - function MaximumInputLength (decorated, $e, options) { - this.maximumInputLength = options.get('maximumInputLength'); - - decorated.call(this, $e, options); - } - - MaximumInputLength.prototype.query = function (decorated, params, callback) { - params.term = params.term || ''; - - if (this.maximumInputLength > 0 && - params.term.length > this.maximumInputLength) { - this.trigger('results:message', { - message: 'inputTooLong', - args: { - maximum: this.maximumInputLength, - input: params.term, - params: params - } - }); - - return; - } - - decorated.call(this, params, callback); - }; - - return MaximumInputLength; -}); - -define('select2/data/maximumSelectionLength',[ - -], function (){ - function MaximumSelectionLength (decorated, $e, options) { - this.maximumSelectionLength = options.get('maximumSelectionLength'); - - decorated.call(this, $e, options); - } - - MaximumSelectionLength.prototype.query = - function (decorated, params, callback) { - var self = this; - - this.current(function (currentData) { - var count = currentData != null ? currentData.length : 0; - if (self.maximumSelectionLength > 0 && - count >= self.maximumSelectionLength) { - self.trigger('results:message', { - message: 'maximumSelected', - args: { - maximum: self.maximumSelectionLength - } - }); - return; - } - decorated.call(self, params, callback); - }); - }; - - return MaximumSelectionLength; -}); - -define('select2/dropdown',[ - 'jquery', - './utils' -], function ($, Utils) { - function Dropdown ($element, options) { - this.$element = $element; - this.options = options; - - Dropdown.__super__.constructor.call(this); - } - - Utils.Extend(Dropdown, Utils.Observable); - - Dropdown.prototype.render = function () { - var $dropdown = $( - '<span class="select2-dropdown">' + - '<span class="select2-results"></span>' + - '</span>' - ); - - $dropdown.attr('dir', this.options.get('dir')); - - this.$dropdown = $dropdown; - - return $dropdown; - }; - - Dropdown.prototype.position = function ($dropdown, $container) { - // Should be implmented in subclasses - }; - - Dropdown.prototype.destroy = function () { - // Remove the dropdown from the DOM - this.$dropdown.remove(); - }; - - return Dropdown; -}); - -define('select2/dropdown/search',[ - 'jquery', - '../utils' -], function ($, Utils) { - function Search () { } - - Search.prototype.render = function (decorated) { - var $rendered = decorated.call(this); - - var $search = $( - '<span class="select2-search select2-search--dropdown">' + - '<input class="select2-search__field" type="search" tabindex="-1"' + - ' autocomplete="off" autocorrect="off" autocapitalize="off"' + - ' spellcheck="false" role="textbox" />' + - '</span>' - ); - - this.$searchContainer = $search; - this.$search = $search.find('input'); - - $rendered.prepend($search); - - return $rendered; - }; - - Search.prototype.bind = function (decorated, container, $container) { - var self = this; - - decorated.call(this, container, $container); - - this.$search.on('keydown', function (evt) { - self.trigger('keypress', evt); - - self._keyUpPrevented = evt.isDefaultPrevented(); - }); - - // Workaround for browsers which do not support the `input` event - // This will prevent double-triggering of events for browsers which support - // both the `keyup` and `input` events. - this.$search.on('input', function (evt) { - // Unbind the duplicated `keyup` event - $(this).off('keyup'); - }); - - this.$search.on('keyup input', function (evt) { - self.handleSearch(evt); - }); - - container.on('open', function () { - self.$search.attr('tabindex', 0); - - self.$search.focus(); - - window.setTimeout(function () { - self.$search.focus(); - }, 0); - }); - - container.on('close', function () { - self.$search.attr('tabindex', -1); - - self.$search.val(''); - }); - - container.on('results:all', function (params) { - if (params.query.term == null || params.query.term === '') { - var showSearch = self.showSearch(params); - - if (showSearch) { - self.$searchContainer.removeClass('select2-search--hide'); - } else { - self.$searchContainer.addClass('select2-search--hide'); - } - } - }); - }; - - Search.prototype.handleSearch = function (evt) { - if (!this._keyUpPrevented) { - var input = this.$search.val(); - - this.trigger('query', { - term: input - }); - } - - this._keyUpPrevented = false; - }; - - Search.prototype.showSearch = function (_, params) { - return true; - }; - - return Search; -}); - -define('select2/dropdown/hidePlaceholder',[ - -], function () { - function HidePlaceholder (decorated, $element, options, dataAdapter) { - this.placeholder = this.normalizePlaceholder(options.get('placeholder')); - - decorated.call(this, $element, options, dataAdapter); - } - - HidePlaceholder.prototype.append = function (decorated, data) { - data.results = this.removePlaceholder(data.results); - - decorated.call(this, data); - }; - - HidePlaceholder.prototype.normalizePlaceholder = function (_, placeholder) { - if (typeof placeholder === 'string') { - placeholder = { - id: '', - text: placeholder - }; - } - - return placeholder; - }; - - HidePlaceholder.prototype.removePlaceholder = function (_, data) { - var modifiedData = data.slice(0); - - for (var d = data.length - 1; d >= 0; d--) { - var item = data[d]; - - if (this.placeholder.id === item.id) { - modifiedData.splice(d, 1); - } - } - - return modifiedData; - }; - - return HidePlaceholder; -}); - -define('select2/dropdown/infiniteScroll',[ - 'jquery' -], function ($) { - function InfiniteScroll (decorated, $element, options, dataAdapter) { - this.lastParams = {}; - - decorated.call(this, $element, options, dataAdapter); - - this.$loadingMore = this.createLoadingMore(); - this.loading = false; - } - - InfiniteScroll.prototype.append = function (decorated, data) { - this.$loadingMore.remove(); - this.loading = false; - - decorated.call(this, data); - - if (this.showLoadingMore(data)) { - this.$results.append(this.$loadingMore); - } - }; - - InfiniteScroll.prototype.bind = function (decorated, container, $container) { - var self = this; - - decorated.call(this, container, $container); - - container.on('query', function (params) { - self.lastParams = params; - self.loading = true; - }); - - container.on('query:append', function (params) { - self.lastParams = params; - self.loading = true; - }); - - this.$results.on('scroll', function () { - var isLoadMoreVisible = $.contains( - document.documentElement, - self.$loadingMore[0] - ); - - if (self.loading || !isLoadMoreVisible) { - return; - } - - var currentOffset = self.$results.offset().top + - self.$results.outerHeight(false); - var loadingMoreOffset = self.$loadingMore.offset().top + - self.$loadingMore.outerHeight(false); - - if (currentOffset + 50 >= loadingMoreOffset) { - self.loadMore(); - } - }); - }; - - InfiniteScroll.prototype.loadMore = function () { - this.loading = true; - - var params = $.extend({}, {page: 1}, this.lastParams); - - params.page++; - - this.trigger('query:append', params); - }; - - InfiniteScroll.prototype.showLoadingMore = function (_, data) { - return data.pagination && data.pagination.more; - }; - - InfiniteScroll.prototype.createLoadingMore = function () { - var $option = $( - '<li class="option load-more" role="treeitem"></li>' - ); - - var message = this.options.get('translations').get('loadingMore'); - - $option.html(message(this.lastParams)); - - return $option; - }; - - return InfiniteScroll; -}); - -define('select2/dropdown/attachBody',[ - 'jquery', - '../utils' -], function ($, Utils) { - function AttachBody (decorated, $element, options) { - this.$dropdownParent = options.get('dropdownParent') || document.body; - - decorated.call(this, $element, options); - } - - AttachBody.prototype.bind = function (decorated, container, $container) { - var self = this; - - var setupResultsEvents = false; - - decorated.call(this, container, $container); - - container.on('open', function () { - self._showDropdown(); - self._attachPositioningHandler(container); - - if (!setupResultsEvents) { - setupResultsEvents = true; - - container.on('results:all', function () { - self._positionDropdown(); - self._resizeDropdown(); - }); - - container.on('results:append', function () { - self._positionDropdown(); - self._resizeDropdown(); - }); - } - }); - - container.on('close', function () { - self._hideDropdown(); - self._detachPositioningHandler(container); - }); - - this.$dropdownContainer.on('mousedown', function (evt) { - evt.stopPropagation(); - }); - }; - - AttachBody.prototype.position = function (decorated, $dropdown, $container) { - // Clone all of the container classes - $dropdown.attr('class', $container.attr('class')); - - $dropdown.removeClass('select2'); - $dropdown.addClass('select2-container--open'); - - $dropdown.css({ - position: 'absolute', - top: -999999 - }); - - this.$container = $container; - }; - - AttachBody.prototype.render = function (decorated) { - var $container = $('<span></span>'); - - var $dropdown = decorated.call(this); - $container.append($dropdown); - - this.$dropdownContainer = $container; - - return $container; - }; - - AttachBody.prototype._hideDropdown = function (decorated) { - this.$dropdownContainer.detach(); - }; - - AttachBody.prototype._attachPositioningHandler = function (container) { - var self = this; - - var scrollEvent = 'scroll.select2.' + container.id; - var resizeEvent = 'resize.select2.' + container.id; - var orientationEvent = 'orientationchange.select2.' + container.id; - - var $watchers = this.$container.parents().filter(Utils.hasScroll); - $watchers.each(function () { - $(this).data('select2-scroll-position', { - x: $(this).scrollLeft(), - y: $(this).scrollTop() - }); - }); - - $watchers.on(scrollEvent, function (ev) { - var position = $(this).data('select2-scroll-position'); - $(this).scrollTop(position.y); - }); - - $(window).on(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent, - function (e) { - self._positionDropdown(); - self._resizeDropdown(); - }); - }; - - AttachBody.prototype._detachPositioningHandler = function (container) { - var scrollEvent = 'scroll.select2.' + container.id; - var resizeEvent = 'resize.select2.' + container.id; - var orientationEvent = 'orientationchange.select2.' + container.id; - - var $watchers = this.$container.parents().filter(Utils.hasScroll); - $watchers.off(scrollEvent); - - $(window).off(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent); - }; - - AttachBody.prototype._positionDropdown = function () { - var $window = $(window); - - var isCurrentlyAbove = this.$dropdown.hasClass('select2-dropdown--above'); - var isCurrentlyBelow = this.$dropdown.hasClass('select2-dropdown--below'); - - var newDirection = null; - - var position = this.$container.position(); - var offset = this.$container.offset(); - - offset.bottom = offset.top + this.$container.outerHeight(false); - - var container = { - height: this.$container.outerHeight(false) - }; - - container.top = offset.top; - container.bottom = offset.top + container.height; - - var dropdown = { - height: this.$dropdown.outerHeight(false) - }; - - var viewport = { - top: $window.scrollTop(), - bottom: $window.scrollTop() + $window.height() - }; - - var enoughRoomAbove = viewport.top < (offset.top - dropdown.height); - var enoughRoomBelow = viewport.bottom > (offset.bottom + dropdown.height); - - var css = { - left: offset.left, - top: container.bottom - }; - - if (!isCurrentlyAbove && !isCurrentlyBelow) { - newDirection = 'below'; - } - - if (!enoughRoomBelow && enoughRoomAbove && !isCurrentlyAbove) { - newDirection = 'above'; - } else if (!enoughRoomAbove && enoughRoomBelow && isCurrentlyAbove) { - newDirection = 'below'; - } - - if (newDirection == 'above' || - (isCurrentlyAbove && newDirection !== 'below')) { - css.top = container.top - dropdown.height; - } - - if (newDirection != null) { - this.$dropdown - .removeClass('select2-dropdown--below select2-dropdown--above') - .addClass('select2-dropdown--' + newDirection); - this.$container - .removeClass('select2-container--below select2-container--above') - .addClass('select2-container--' + newDirection); - } - - this.$dropdownContainer.css(css); - }; - - AttachBody.prototype._resizeDropdown = function () { - this.$dropdownContainer.width(); - - this.$dropdown.css({ - width: this.$container.outerWidth(false) + 'px' - }); - }; - - AttachBody.prototype._showDropdown = function (decorated) { - this.$dropdownContainer.appendTo(this.$dropdownParent); - - this._positionDropdown(); - this._resizeDropdown(); - }; - - return AttachBody; -}); - -define('select2/dropdown/minimumResultsForSearch',[ - -], function () { - function countResults (data) { - var count = 0; - - for (var d = 0; d < data.length; d++) { - var item = data[d]; - - if (item.children) { - count += countResults(item.children); - } else { - count++; - } - } - - return count; - } - - function MinimumResultsForSearch (decorated, $element, options, dataAdapter) { - this.minimumResultsForSearch = options.get('minimumResultsForSearch'); - - if (this.minimumResultsForSearch < 0) { - this.minimumResultsForSearch = Infinity; - } - - decorated.call(this, $element, options, dataAdapter); - } - - MinimumResultsForSearch.prototype.showSearch = function (decorated, params) { - if (countResults(params.data.results) < this.minimumResultsForSearch) { - return false; - } - - return decorated.call(this, params); - }; - - return MinimumResultsForSearch; -}); - -define('select2/dropdown/selectOnClose',[ - -], function () { - function SelectOnClose () { } - - SelectOnClose.prototype.bind = function (decorated, container, $container) { - var self = this; - - decorated.call(this, container, $container); - - container.on('close', function () { - self._handleSelectOnClose(); - }); - }; - - SelectOnClose.prototype._handleSelectOnClose = function () { - var $highlightedResults = this.getHighlightedResults(); - - if ($highlightedResults.length < 1) { - return; - } - - $highlightedResults.trigger('mouseup'); - }; - - return SelectOnClose; -}); - -define('select2/dropdown/closeOnSelect',[ - -], function () { - function CloseOnSelect () { } - - CloseOnSelect.prototype.bind = function (decorated, container, $container) { - var self = this; - - decorated.call(this, container, $container); - - container.on('select', function (evt) { - self._selectTriggered(evt); - }); - - container.on('unselect', function (evt) { - self._selectTriggered(evt); - }); - }; - - CloseOnSelect.prototype._selectTriggered = function (_, evt) { - var originalEvent = evt.originalEvent; - - // Don't close if the control key is being held - if (originalEvent && originalEvent.ctrlKey) { - return; - } - - this.trigger('close'); - }; - - return CloseOnSelect; -}); - -define('select2/i18n/en',[],function () { - // English - return { - errorLoading: function () { - return 'The results could not be loaded.'; - }, - inputTooLong: function (args) { - var overChars = args.input.length - args.maximum; - - var message = 'Please delete ' + overChars + ' character'; - - if (overChars != 1) { - message += 's'; - } - - return message; - }, - inputTooShort: function (args) { - var remainingChars = args.minimum - args.input.length; - - var message = 'Please enter ' + remainingChars + ' or more characters'; - - return message; - }, - loadingMore: function () { - return 'Loading more results…'; - }, - maximumSelected: function (args) { - var message = 'You can only select ' + args.maximum + ' item'; - - if (args.maximum != 1) { - message += 's'; - } - - return message; - }, - noResults: function () { - return 'No results found'; - }, - searching: function () { - return 'Searching…'; - } - }; -}); - -define('select2/defaults',[ - 'jquery', - './results', - - './selection/single', - './selection/multiple', - './selection/placeholder', - './selection/allowClear', - './selection/search', - './selection/eventRelay', - - './utils', - './translation', - './diacritics', - - './data/select', - './data/array', - './data/ajax', - './data/tags', - './data/tokenizer', - './data/minimumInputLength', - './data/maximumInputLength', - './data/maximumSelectionLength', - - './dropdown', - './dropdown/search', - './dropdown/hidePlaceholder', - './dropdown/infiniteScroll', - './dropdown/attachBody', - './dropdown/minimumResultsForSearch', - './dropdown/selectOnClose', - './dropdown/closeOnSelect', - - './i18n/en' -], function ($, ResultsList, - - SingleSelection, MultipleSelection, Placeholder, AllowClear, - SelectionSearch, EventRelay, - - Utils, Translation, DIACRITICS, - - SelectData, ArrayData, AjaxData, Tags, Tokenizer, - MinimumInputLength, MaximumInputLength, MaximumSelectionLength, - - Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll, - AttachBody, MinimumResultsForSearch, SelectOnClose, CloseOnSelect, - - EnglishTranslation) { - function Defaults () { - this.reset(); - } - - Defaults.prototype.apply = function (options) { - options = $.extend({}, this.defaults, options); - - if (options.dataAdapter == null) { - if (options.ajax != null) { - options.dataAdapter = AjaxData; - } else if (options.data != null) { - options.dataAdapter = ArrayData; - } else { - options.dataAdapter = SelectData; - } - - if (options.minimumInputLength > 0) { - options.dataAdapter = Utils.Decorate( - options.dataAdapter, - MinimumInputLength - ); - } - - if (options.maximumInputLength > 0) { - options.dataAdapter = Utils.Decorate( - options.dataAdapter, - MaximumInputLength - ); - } - - if (options.maximumSelectionLength > 0) { - options.dataAdapter = Utils.Decorate( - options.dataAdapter, - MaximumSelectionLength - ); - } - - if (options.tags != null) { - options.dataAdapter = Utils.Decorate(options.dataAdapter, Tags); - } - - if (options.tokenSeparators != null || options.tokenizer != null) { - options.dataAdapter = Utils.Decorate( - options.dataAdapter, - Tokenizer - ); - } - - if (options.query != null) { - var Query = require(options.amdBase + 'compat/query'); - - options.dataAdapter = Utils.Decorate( - options.dataAdapter, - Query - ); - } - - if (options.initSelection != null) { - var InitSelection = require(options.amdBase + 'compat/initSelection'); - - options.dataAdapter = Utils.Decorate( - options.dataAdapter, - InitSelection - ); - } - } - - if (options.resultsAdapter == null) { - options.resultsAdapter = ResultsList; - - if (options.ajax != null) { - options.resultsAdapter = Utils.Decorate( - options.resultsAdapter, - InfiniteScroll - ); - } - - if (options.placeholder != null) { - options.resultsAdapter = Utils.Decorate( - options.resultsAdapter, - HidePlaceholder - ); - } - - if (options.selectOnClose) { - options.resultsAdapter = Utils.Decorate( - options.resultsAdapter, - SelectOnClose - ); - } - } - - if (options.dropdownAdapter == null) { - if (options.multiple) { - options.dropdownAdapter = Dropdown; - } else { - var SearchableDropdown = Utils.Decorate(Dropdown, DropdownSearch); - - options.dropdownAdapter = SearchableDropdown; - } - - if (options.minimumResultsForSearch !== 0) { - options.dropdownAdapter = Utils.Decorate( - options.dropdownAdapter, - MinimumResultsForSearch - ); - } - - if (options.closeOnSelect) { - options.dropdownAdapter = Utils.Decorate( - options.dropdownAdapter, - CloseOnSelect - ); - } - - options.dropdownAdapter = Utils.Decorate( - options.dropdownAdapter, - AttachBody - ); - } - - if (options.selectionAdapter == null) { - if (options.multiple) { - options.selectionAdapter = MultipleSelection; - } else { - options.selectionAdapter = SingleSelection; - } - - // Add the placeholder mixin if a placeholder was specified - if (options.placeholder != null) { - options.selectionAdapter = Utils.Decorate( - options.selectionAdapter, - Placeholder - ); - } - - if (options.allowClear) { - options.selectionAdapter = Utils.Decorate( - options.selectionAdapter, - AllowClear - ); - } - - if (options.multiple) { - options.selectionAdapter = Utils.Decorate( - options.selectionAdapter, - SelectionSearch - ); - } - - options.selectionAdapter = Utils.Decorate( - options.selectionAdapter, - EventRelay - ); - } - - if (typeof options.language === 'string') { - // Check if the lanugage is specified with a region - if (options.language.indexOf('-') > 0) { - // Extract the region information if it is included - var languageParts = options.language.split('-'); - var baseLanguage = languageParts[0]; - - options.language = [options.language, baseLanguage]; - } else { - options.language = [options.language]; - } - } - - if ($.isArray(options.language)) { - var languages = new Translation(); - options.language.push('en'); - - var languageNames = options.language; - - for (var l = 0; l < languageNames.length; l++) { - var name = languageNames[l]; - var language = {}; - - try { - // Try to load it with the original name - language = Translation.loadPath(name); - } catch (e) { - try { - // If we couldn't load it, check if it wasn't the full path - name = this.defaults.amdLanguageBase + name; - language = Translation.loadPath(name); - } catch (ex) { - // The translation could not be loaded at all. Sometimes this is - // because of a configuration problem, other times this can be - // because of how Select2 helps load all possible translation files. - if (window.console && console.warn) { - console.warn( - 'Select2: The lanugage file for "' + name + '" could not be ' + - 'automatically loaded. A fallback will be used instead.' - ); - } - - continue; - } - } - - languages.extend(language); - } - - options.translations = languages; - } else { - options.translations = new Translation(options.language); - } - - return options; - }; - - Defaults.prototype.reset = function () { - function stripDiacritics (text) { - // Used 'uni range + named function' from http://jsperf.com/diacritics/18 - function match(a) { - return DIACRITICS[a] || a; - } - - return text.replace(/[^\u0000-\u007E]/g, match); - } - - function matcher (params, data) { - // Always return the object if there is nothing to compare - if ($.trim(params.term) === '') { - return data; - } - - // Do a recursive check for options with children - if (data.children && data.children.length > 0) { - // Clone the data object if there are children - // This is required as we modify the object to remove any non-matches - var match = $.extend(true, {}, data); - - // Check each child of the option - for (var c = data.children.length - 1; c >= 0; c--) { - var child = data.children[c]; - - var matches = matcher(params, child); - - // If there wasn't a match, remove the object in the array - if (matches == null) { - match.children.splice(c, 1); - } - } - - // If any children matched, return the new object - if (match.children.length > 0) { - return match; - } - - // If there were no matching children, check just the plain object - return matcher(params, match); - } - - var original = stripDiacritics(data.text).toUpperCase(); - var term = stripDiacritics(params.term).toUpperCase(); - - // Check if the text contains the term - if (original.indexOf(term) > -1) { - return data; - } - - // If it doesn't contain the term, don't return anything - return null; - } - - this.defaults = { - amdBase: 'select2/', - amdLanguageBase: 'select2/i18n/', - closeOnSelect: true, - escapeMarkup: Utils.escapeMarkup, - language: EnglishTranslation, - matcher: matcher, - minimumInputLength: 0, - maximumInputLength: 0, - maximumSelectionLength: 0, - minimumResultsForSearch: 0, - selectOnClose: false, - sorter: function (data) { - return data; - }, - templateResult: function (result) { - return result.text; - }, - templateSelection: function (selection) { - return selection.text; - }, - theme: 'default', - width: 'resolve' - }; - }; - - Defaults.prototype.set = function (key, value) { - var camelKey = $.camelCase(key); - - var data = {}; - data[camelKey] = value; - - var convertedData = Utils._convertData(data); - - $.extend(this.defaults, convertedData); - }; - - var defaults = new Defaults(); - - return defaults; -}); - -define('select2/options',[ - 'jquery', - './defaults', - './utils' -], function ($, Defaults, Utils) { - function Options (options, $element) { - this.options = options; - - if ($element != null) { - this.fromElement($element); - } - - this.options = Defaults.apply(this.options); - - if ($element && $element.is('input')) { - var InputCompat = require(this.get('amdBase') + 'compat/inputData'); - - this.options.dataAdapter = Utils.Decorate( - this.options.dataAdapter, - InputCompat - ); - } - } - - Options.prototype.fromElement = function ($e) { - var excludedData = ['select2']; - - if (this.options.multiple == null) { - this.options.multiple = $e.prop('multiple'); - } - - if (this.options.disabled == null) { - this.options.disabled = $e.prop('disabled'); - } - - if (this.options.language == null) { - if ($e.prop('lang')) { - this.options.language = $e.prop('lang').toLowerCase(); - } else if ($e.closest('[lang]').prop('lang')) { - this.options.language = $e.closest('[lang]').prop('lang'); - } - } - - if (this.options.dir == null) { - if ($e.prop('dir')) { - this.options.dir = $e.prop('dir'); - } else if ($e.closest('[dir]').prop('dir')) { - this.options.dir = $e.closest('[dir]').prop('dir'); - } else { - this.options.dir = 'ltr'; - } - } - - $e.prop('disabled', this.options.disabled); - $e.prop('multiple', this.options.multiple); - - if ($e.data('select2Tags')) { - if (window.console && console.warn) { - console.warn( - 'Select2: The `data-select2-tags` attribute has been changed to ' + - 'use the `data-data` and `data-tags="true"` attributes and will be ' + - 'removed in future versions of Select2.' - ); - } - - $e.data('data', $e.data('select2Tags')); - $e.data('tags', true); - } - - if ($e.data('ajaxUrl')) { - if (window.console && console.warn) { - console.warn( - 'Select2: The `data-ajax-url` attribute has been changed to ' + - '`data-ajax--url` and support for the old attribute will be removed' + - ' in future versions of Select2.' - ); - } - - $e.data('ajax-Url', $e.data('ajaxUrl')); - } - - var dataset = {}; - - // Prefer the element's `dataset` attribute if it exists - // jQuery 1.x does not correctly handle data attributes with multiple dashes - if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) { - dataset = $.extend(true, {}, $e[0].dataset, $e.data()); - } else { - dataset = $e.data(); - } - - var data = $.extend(true, {}, dataset); - - data = Utils._convertData(data); - - for (var key in data) { - if ($.inArray(key, excludedData) > -1) { - continue; - } - - if ($.isPlainObject(this.options[key])) { - $.extend(this.options[key], data[key]); - } else { - this.options[key] = data[key]; - } - } - - return this; - }; - - Options.prototype.get = function (key) { - return this.options[key]; - }; - - Options.prototype.set = function (key, val) { - this.options[key] = val; - }; - - return Options; -}); - -define('select2/core',[ - 'jquery', - './options', - './utils', - './keys' -], function ($, Options, Utils, KEYS) { - var Select2 = function ($element, options) { - if ($element.data('select2') != null) { - $element.data('select2').destroy(); - } - - this.$element = $element; - - this.id = this._generateId($element); - - options = options || {}; - - this.options = new Options(options, $element); - - Select2.__super__.constructor.call(this); - - // Set up the tabindex - - var tabindex = $element.attr('tabindex') || 0; - $element.data('old-tabindex', tabindex); - $element.attr('tabindex', '-1'); - - // Set up containers and adapters - - var DataAdapter = this.options.get('dataAdapter'); - this.data = new DataAdapter($element, this.options); - - var $container = this.render(); - - this._placeContainer($container); - - var SelectionAdapter = this.options.get('selectionAdapter'); - this.selection = new SelectionAdapter($element, this.options); - this.$selection = this.selection.render(); - - this.selection.position(this.$selection, $container); - - var DropdownAdapter = this.options.get('dropdownAdapter'); - this.dropdown = new DropdownAdapter($element, this.options); - this.$dropdown = this.dropdown.render(); - - this.dropdown.position(this.$dropdown, $container); - - var ResultsAdapter = this.options.get('resultsAdapter'); - this.results = new ResultsAdapter($element, this.options, this.data); - this.$results = this.results.render(); - - this.results.position(this.$results, this.$dropdown); - - // Bind events - - var self = this; - - // Bind the container to all of the adapters - this._bindAdapters(); - - // Register any DOM event handlers - this._registerDomEvents(); - - // Register any internal event handlers - this._registerDataEvents(); - this._registerSelectionEvents(); - this._registerDropdownEvents(); - this._registerResultsEvents(); - this._registerEvents(); - - // Set the initial state - this.data.current(function (initialData) { - self.trigger('selection:update', { - data: initialData - }); - }); - - // Hide the original select - $element.hide(); - - // Synchronize any monitored attributes - this._syncAttributes(); - - $element.data('select2', this); - }; - - Utils.Extend(Select2, Utils.Observable); - - Select2.prototype._generateId = function ($element) { - var id = ''; - - if ($element.attr('id') != null) { - id = $element.attr('id'); - } else if ($element.attr('name') != null) { - id = $element.attr('name') + '-' + Utils.generateChars(2); - } else { - id = Utils.generateChars(4); - } - - id = 'select2-' + id; - - return id; - }; - - Select2.prototype._placeContainer = function ($container) { - $container.insertAfter(this.$element); - - var width = this._resolveWidth(this.$element, this.options.get('width')); - - if (width != null) { - $container.css('width', width); - } - }; - - Select2.prototype._resolveWidth = function ($element, method) { - var WIDTH = /^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i; - - if (method == 'resolve') { - var styleWidth = this._resolveWidth($element, 'style'); - - if (styleWidth != null) { - return styleWidth; - } - - return this._resolveWidth($element, 'element'); - } - - if (method == 'element') { - var elementWidth = $element.outerWidth(false); - - if (elementWidth <= 0) { - return 'auto'; - } - - return elementWidth + 'px'; - } - - if (method == 'style') { - var style = $element.attr('style'); - - if (typeof(style) !== 'string') { - return null; - } - - var attrs = style.split(';'); - - for (var i = 0, l = attrs.length; i < l; i = i + 1) { - var attr = attrs[i].replace(/\s/g, ''); - var matches = attr.match(WIDTH); - - if (matches !== null && matches.length >= 1) { - return matches[1]; - } - } - - return null; - } - - return method; - }; - - Select2.prototype._bindAdapters = function () { - this.data.bind(this, this.$container); - this.selection.bind(this, this.$container); - - this.dropdown.bind(this, this.$container); - this.results.bind(this, this.$container); - }; - - Select2.prototype._registerDomEvents = function () { - var self = this; - - this.$element.on('change.select2', function () { - self.data.current(function (data) { - self.trigger('selection:update', { - data: data - }); - }); - }); - - this._sync = Utils.bind(this._syncAttributes, this); - - if (this.$element[0].attachEvent) { - this.$element[0].attachEvent('onpropertychange', this._sync); - } - - var observer = window.MutationObserver || - window.WebKitMutationObserver || - window.MozMutationObserver - ; - - if (observer != null) { - this._observer = new observer(function (mutations) { - $.each(mutations, self._sync); - }); - this._observer.observe(this.$element[0], { - attributes: true, - subtree: false - }); - } else if (this.$element[0].addEventListener) { - this.$element[0].addEventListener('DOMAttrModified', self._sync, false); - } - }; - - Select2.prototype._registerDataEvents = function () { - var self = this; - - this.data.on('*', function (name, params) { - self.trigger(name, params); - }); - }; - - Select2.prototype._registerSelectionEvents = function () { - var self = this; - var nonRelayEvents = ['toggle']; - - this.selection.on('toggle', function () { - self.toggleDropdown(); - }); - - this.selection.on('*', function (name, params) { - if ($.inArray(name, nonRelayEvents) !== -1) { - return; - } - - self.trigger(name, params); - }); - }; - - Select2.prototype._registerDropdownEvents = function () { - var self = this; - - this.dropdown.on('*', function (name, params) { - self.trigger(name, params); - }); - }; - - Select2.prototype._registerResultsEvents = function () { - var self = this; - - this.results.on('*', function (name, params) { - self.trigger(name, params); - }); - }; - - Select2.prototype._registerEvents = function () { - var self = this; - - this.on('open', function () { - self.$container.addClass('select2-container--open'); - }); - - this.on('close', function () { - self.$container.removeClass('select2-container--open'); - }); - - this.on('enable', function () { - self.$container.removeClass('select2-container--disabled'); - }); - - this.on('disable', function () { - self.$container.addClass('select2-container--disabled'); - }); - - this.on('focus', function () { - self.$container.addClass('select2-container--focus'); - }); - - this.on('blur', function () { - self.$container.removeClass('select2-container--focus'); - }); - - this.on('query', function (params) { - if (!self.isOpen()) { - self.trigger('open'); - } - - this.data.query(params, function (data) { - self.trigger('results:all', { - data: data, - query: params - }); - }); - }); - - this.on('query:append', function (params) { - this.data.query(params, function (data) { - self.trigger('results:append', { - data: data, - query: params - }); - }); - }); - - this.on('keypress', function (evt) { - var key = evt.which; - - if (self.isOpen()) { - if (key === KEYS.ENTER) { - self.trigger('results:select'); - - evt.preventDefault(); - } else if ((key === KEYS.SPACE && evt.ctrlKey)) { - self.trigger('results:toggle'); - - evt.preventDefault(); - } else if (key === KEYS.UP) { - self.trigger('results:previous'); - - evt.preventDefault(); - } else if (key === KEYS.DOWN) { - self.trigger('results:next'); - - evt.preventDefault(); - } else if (key === KEYS.ESC || key === KEYS.TAB) { - self.close(); - - evt.preventDefault(); - } - } else { - if (key === KEYS.ENTER || key === KEYS.SPACE || - ((key === KEYS.DOWN || key === KEYS.UP) && evt.altKey)) { - self.open(); - - evt.preventDefault(); - } - } - }); - }; - - Select2.prototype._syncAttributes = function () { - this.options.set('disabled', this.$element.prop('disabled')); - - if (this.options.get('disabled')) { - if (this.isOpen()) { - this.close(); - } - - this.trigger('disable'); - } else { - this.trigger('enable'); - } - }; - - /** - * Override the trigger method to automatically trigger pre-events when - * there are events that can be prevented. - */ - Select2.prototype.trigger = function (name, args) { - var actualTrigger = Select2.__super__.trigger; - var preTriggerMap = { - 'open': 'opening', - 'close': 'closing', - 'select': 'selecting', - 'unselect': 'unselecting' - }; - - if (name in preTriggerMap) { - var preTriggerName = preTriggerMap[name]; - var preTriggerArgs = { - prevented: false, - name: name, - args: args - }; - - actualTrigger.call(this, preTriggerName, preTriggerArgs); - - if (preTriggerArgs.prevented) { - args.prevented = true; - - return; - } - } - - actualTrigger.call(this, name, args); - }; - - Select2.prototype.toggleDropdown = function () { - if (this.options.get('disabled')) { - return; - } - - if (this.isOpen()) { - this.close(); - } else { - this.open(); - } - }; - - Select2.prototype.open = function () { - if (this.isOpen()) { - return; - } - - this.trigger('query', {}); - - this.trigger('open'); - }; - - Select2.prototype.close = function () { - if (!this.isOpen()) { - return; - } - - this.trigger('close'); - }; - - Select2.prototype.isOpen = function () { - return this.$container.hasClass('select2-container--open'); - }; - - Select2.prototype.enable = function (args) { - if (window.console && console.warn) { - console.warn( - 'Select2: The `select2("enable")` method has been deprecated and will' + - ' be removed in later Select2 versions. Use $element.prop("disabled")' + - ' instead.' - ); - } - - if (args.length === 0) { - args = [true]; - } - - var disabled = !args[0]; - - this.$element.prop('disabled', disabled); - }; - - Select2.prototype.data = function () { - if (arguments.length > 0 && window.console && console.warn) { - console.warn( - 'Select2: Data can no longer be set using `select2("data")`. You ' + - 'should consider setting the value instead using `$element.val()`.' - ); - } - - var data = []; - - this.dataAdpater.current(function (currentData) { - data = currentData; - }); - - return data; - }; - - Select2.prototype.val = function (args) { - if (window.console && console.warn) { - console.warn( - 'Select2: The `select2("val")` method has been deprecated and will be' + - ' removed in later Select2 versions. Use $element.val() instead.' - ); - } - - if (args.length === 0) { - return this.$element.val(); - } - - var newVal = args[0]; - - if ($.isArray(newVal)) { - newVal = $.map(newVal, function (obj) { - return obj.toString(); - }); - } - - this.$element.val(newVal).trigger('change'); - }; - - Select2.prototype.destroy = function () { - this.$container.remove(); - - if (this.$element[0].detachEvent) { - this.$element[0].detachEvent('onpropertychange', this._sync); - } - - if (this._observer != null) { - this._observer.disconnect(); - this._observer = null; - } else if (this.$element[0].removeEventListener) { - this.$element[0] - .removeEventListener('DOMAttrModified', this._sync, false); - } - - this._sync = null; - - this.$element.off('.select2'); - this.$element.attr('tabindex', this.$element.data('old-tabindex')); - - this.$element.show(); - this.$element.removeData('select2'); - - this.data.destroy(); - this.selection.destroy(); - this.dropdown.destroy(); - this.results.destroy(); - - this.data = null; - this.selection = null; - this.dropdown = null; - this.results = null; - }; - - Select2.prototype.render = function () { - var $container = $( - '<span class="select2 select2-container">' + - '<span class="selection"></span>' + - '<span class="dropdown-wrapper" aria-hidden="true"></span>' + - '</span>' - ); - - $container.attr('dir', this.options.get('dir')); - - this.$container = $container; - - this.$container.addClass('select2-container--' + this.options.get('theme')); - - $container.data('element', this.$element); - - return $container; - }; - - return Select2; -}); - -define('jquery.select2',[ - 'jquery', - './select2/core', - './select2/defaults' -], function ($, Select2, Defaults) { - // Force jQuery.mousewheel to be loaded if it hasn't already - try { - require('jquery.mousewheel'); - } catch (Exception) { } - - if ($.fn.select2 == null) { - $.fn.select2 = function (options) { - options = options || {}; - - if (typeof options === 'object') { - this.each(function () { - var instanceOptions = $.extend({}, options, true); - - var instance = new Select2($(this), instanceOptions); - }); - - return this; - } else if (typeof options === 'string') { - var instance = this.data('select2'); - var args = Array.prototype.slice.call(arguments, 1); - - return instance[options](args); - } else { - throw new Error('Invalid arguments for Select2: ' + options); - } - }; - } - - if ($.fn.select2.defaults == null) { - $.fn.select2.defaults = Defaults; - } - - return Select2; -}); - -return require('jquery.select2'); });
\ No newline at end of file diff --git a/public/vendor/select2/js/select2.full.js b/public/vendor/select2/js/select2.full.js deleted file mode 100755 index 1902f6c7..00000000 --- a/public/vendor/select2/js/select2.full.js +++ /dev/null @@ -1,5765 +0,0 @@ -(function() { if (window.define) { var define = window.define; } if (window.require) { var require = window.require; } if (window.jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) { var define = jQuery.fn.select2.amd.define; var require = jQuery.fn.select2.amd.require; }/** - * @license almond 0.2.9 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved. - * Available via the MIT or new BSD license. - * see: http://github.com/jrburke/almond for details - */ -//Going sloppy to avoid 'use strict' string cost, but strict practices should -//be followed. -/*jslint sloppy: true */ -/*global setTimeout: false */ - -var requirejs, require, define; -(function (undef) { - var main, req, makeMap, handlers, - defined = {}, - waiting = {}, - config = {}, - defining = {}, - hasOwn = Object.prototype.hasOwnProperty, - aps = [].slice, - jsSuffixRegExp = /\.js$/; - - function hasProp(obj, prop) { - return hasOwn.call(obj, prop); - } - - /** - * Given a relative module name, like ./something, normalize it to - * a real name that can be mapped to a path. - * @param {String} name the relative name - * @param {String} baseName a real name that the name arg is relative - * to. - * @returns {String} normalized name - */ - function normalize(name, baseName) { - var nameParts, nameSegment, mapValue, foundMap, lastIndex, - foundI, foundStarMap, starI, i, j, part, - baseParts = baseName && baseName.split("/"), - map = config.map, - starMap = (map && map['*']) || {}; - - //Adjust any relative paths. - if (name && name.charAt(0) === ".") { - //If have a base name, try to normalize against it, - //otherwise, assume it is a top-level require that will - //be relative to baseUrl in the end. - if (baseName) { - //Convert baseName to array, and lop off the last part, - //so that . matches that "directory" and not name of the baseName's - //module. For instance, baseName of "one/two/three", maps to - //"one/two/three.js", but we want the directory, "one/two" for - //this normalization. - baseParts = baseParts.slice(0, baseParts.length - 1); - name = name.split('/'); - lastIndex = name.length - 1; - - // Node .js allowance: - if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) { - name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, ''); - } - - name = baseParts.concat(name); - - //start trimDots - for (i = 0; i < name.length; i += 1) { - part = name[i]; - if (part === ".") { - name.splice(i, 1); - i -= 1; - } else if (part === "..") { - if (i === 1 && (name[2] === '..' || name[0] === '..')) { - //End of the line. Keep at least one non-dot - //path segment at the front so it can be mapped - //correctly to disk. Otherwise, there is likely - //no path mapping for a path starting with '..'. - //This can still fail, but catches the most reasonable - //uses of .. - break; - } else if (i > 0) { - name.splice(i - 1, 2); - i -= 2; - } - } - } - //end trimDots - - name = name.join("/"); - } else if (name.indexOf('./') === 0) { - // No baseName, so this is ID is resolved relative - // to baseUrl, pull off the leading dot. - name = name.substring(2); - } - } - - //Apply map config if available. - if ((baseParts || starMap) && map) { - nameParts = name.split('/'); - - for (i = nameParts.length; i > 0; i -= 1) { - nameSegment = nameParts.slice(0, i).join("/"); - - if (baseParts) { - //Find the longest baseName segment match in the config. - //So, do joins on the biggest to smallest lengths of baseParts. - for (j = baseParts.length; j > 0; j -= 1) { - mapValue = map[baseParts.slice(0, j).join('/')]; - - //baseName segment has config, find if it has one for - //this name. - if (mapValue) { - mapValue = mapValue[nameSegment]; - if (mapValue) { - //Match, update name to the new value. - foundMap = mapValue; - foundI = i; - break; - } - } - } - } - - if (foundMap) { - break; - } - - //Check for a star map match, but just hold on to it, - //if there is a shorter segment match later in a matching - //config, then favor over this star map. - if (!foundStarMap && starMap && starMap[nameSegment]) { - foundStarMap = starMap[nameSegment]; - starI = i; - } - } - - if (!foundMap && foundStarMap) { - foundMap = foundStarMap; - foundI = starI; - } - - if (foundMap) { - nameParts.splice(0, foundI, foundMap); - name = nameParts.join('/'); - } - } - - return name; - } - - function makeRequire(relName, forceSync) { - return function () { - //A version of a require function that passes a moduleName - //value for items that may need to - //look up paths relative to the moduleName - return req.apply(undef, aps.call(arguments, 0).concat([relName, forceSync])); - }; - } - - function makeNormalize(relName) { - return function (name) { - return normalize(name, relName); - }; - } - - function makeLoad(depName) { - return function (value) { - defined[depName] = value; - }; - } - - function callDep(name) { - if (hasProp(waiting, name)) { - var args = waiting[name]; - delete waiting[name]; - defining[name] = true; - main.apply(undef, args); - } - - if (!hasProp(defined, name) && !hasProp(defining, name)) { - throw new Error('No ' + name); - } - return defined[name]; - } - - //Turns a plugin!resource to [plugin, resource] - //with the plugin being undefined if the name - //did not have a plugin prefix. - function splitPrefix(name) { - var prefix, - index = name ? name.indexOf('!') : -1; - if (index > -1) { - prefix = name.substring(0, index); - name = name.substring(index + 1, name.length); - } - return [prefix, name]; - } - - /** - * Makes a name map, normalizing the name, and using a plugin - * for normalization if necessary. Grabs a ref to plugin - * too, as an optimization. - */ - makeMap = function (name, relName) { - var plugin, - parts = splitPrefix(name), - prefix = parts[0]; - - name = parts[1]; - - if (prefix) { - prefix = normalize(prefix, relName); - plugin = callDep(prefix); - } - - //Normalize according - if (prefix) { - if (plugin && plugin.normalize) { - name = plugin.normalize(name, makeNormalize(relName)); - } else { - name = normalize(name, relName); - } - } else { - name = normalize(name, relName); - parts = splitPrefix(name); - prefix = parts[0]; - name = parts[1]; - if (prefix) { - plugin = callDep(prefix); - } - } - - //Using ridiculous property names for space reasons - return { - f: prefix ? prefix + '!' + name : name, //fullName - n: name, - pr: prefix, - p: plugin - }; - }; - - function makeConfig(name) { - return function () { - return (config && config.config && config.config[name]) || {}; - }; - } - - handlers = { - require: function (name) { - return makeRequire(name); - }, - exports: function (name) { - var e = defined[name]; - if (typeof e !== 'undefined') { - return e; - } else { - return (defined[name] = {}); - } - }, - module: function (name) { - return { - id: name, - uri: '', - exports: defined[name], - config: makeConfig(name) - }; - } - }; - - main = function (name, deps, callback, relName) { - var cjsModule, depName, ret, map, i, - args = [], - callbackType = typeof callback, - usingExports; - - //Use name if no relName - relName = relName || name; - - //Call the callback to define the module, if necessary. - if (callbackType === 'undefined' || callbackType === 'function') { - //Pull out the defined dependencies and pass the ordered - //values to the callback. - //Default to [require, exports, module] if no deps - deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps; - for (i = 0; i < deps.length; i += 1) { - map = makeMap(deps[i], relName); - depName = map.f; - - //Fast path CommonJS standard dependencies. - if (depName === "require") { - args[i] = handlers.require(name); - } else if (depName === "exports") { - //CommonJS module spec 1.1 - args[i] = handlers.exports(name); - usingExports = true; - } else if (depName === "module") { - //CommonJS module spec 1.1 - cjsModule = args[i] = handlers.module(name); - } else if (hasProp(defined, depName) || - hasProp(waiting, depName) || - hasProp(defining, depName)) { - args[i] = callDep(depName); - } else if (map.p) { - map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {}); - args[i] = defined[depName]; - } else { - throw new Error(name + ' missing ' + depName); - } - } - - ret = callback ? callback.apply(defined[name], args) : undefined; - - if (name) { - //If setting exports via "module" is in play, - //favor that over return value and exports. After that, - //favor a non-undefined return value over exports use. - if (cjsModule && cjsModule.exports !== undef && - cjsModule.exports !== defined[name]) { - defined[name] = cjsModule.exports; - } else if (ret !== undef || !usingExports) { - //Use the return value from the function. - defined[name] = ret; - } - } - } else if (name) { - //May just be an object definition for the module. Only - //worry about defining if have a module name. - defined[name] = callback; - } - }; - - requirejs = require = req = function (deps, callback, relName, forceSync, alt) { - if (typeof deps === "string") { - if (handlers[deps]) { - //callback in this case is really relName - return handlers[deps](callback); - } - //Just return the module wanted. In this scenario, the - //deps arg is the module name, and second arg (if passed) - //is just the relName. - //Normalize module name, if it contains . or .. - return callDep(makeMap(deps, callback).f); - } else if (!deps.splice) { - //deps is a config object, not an array. - config = deps; - if (config.deps) { - req(config.deps, config.callback); - } - if (!callback) { - return; - } - - if (callback.splice) { - //callback is an array, which means it is a dependency list. - //Adjust args if there are dependencies - deps = callback; - callback = relName; - relName = null; - } else { - deps = undef; - } - } - - //Support require(['a']) - callback = callback || function () {}; - - //If relName is a function, it is an errback handler, - //so remove it. - if (typeof relName === 'function') { - relName = forceSync; - forceSync = alt; - } - - //Simulate async callback; - if (forceSync) { - main(undef, deps, callback, relName); - } else { - //Using a non-zero value because of concern for what old browsers - //do, and latest browsers "upgrade" to 4 if lower value is used: - //http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout: - //If want a value immediately, use require('id') instead -- something - //that works in almond on the global level, but not guaranteed and - //unlikely to work in other AMD implementations. - setTimeout(function () { - main(undef, deps, callback, relName); - }, 4); - } - - return req; - }; - - /** - * Just drops the config on the floor, but returns req in case - * the config return value is used. - */ - req.config = function (cfg) { - return req(cfg); - }; - - /** - * Expose module registry for debugging and tooling - */ - requirejs._defined = defined; - - define = function (name, deps, callback) { - - //This module may not have dependencies - if (!deps.splice) { - //deps is not an array, so probably means - //an object literal or factory function for - //the value. Adjust args. - callback = deps; - deps = []; - } - - if (!hasProp(defined, name) && !hasProp(waiting, name)) { - waiting[name] = [name, deps, callback]; - } - }; - - define.amd = { - jQuery: true - }; -}()); - -define("almond", function(){}); - -/* global jQuery:false, $:false */ -define('jquery',[],function () { - var _$ = jQuery || $; - - if (_$ == null && console && console.error) { - console.error( - 'Select2: An instance of jQuery or a jQuery-compatible library was not ' + - 'found. Make sure that you are including jQuery before Select2 on your ' + - 'web page.' - ); - } - - return _$; -}); - -define('select2/utils',[ - 'jquery' -], function ($) { - var Utils = {}; - - Utils.Extend = function (ChildClass, SuperClass) { - var __hasProp = {}.hasOwnProperty; - - function BaseConstructor () { - this.constructor = ChildClass; - } - - for (var key in SuperClass) { - if (__hasProp.call(SuperClass, key)) { - ChildClass[key] = SuperClass[key]; - } - } - - BaseConstructor.prototype = SuperClass.prototype; - ChildClass.prototype = new BaseConstructor(); - ChildClass.__super__ = SuperClass.prototype; - - return ChildClass; - }; - - function getMethods (theClass) { - var proto = theClass.prototype; - - var methods = []; - - for (var methodName in proto) { - var m = proto[methodName]; - - if (typeof m !== 'function') { - continue; - } - - if (methodName === 'constructor') { - continue; - } - - methods.push(methodName); - } - - return methods; - } - - Utils.Decorate = function (SuperClass, DecoratorClass) { - var decoratedMethods = getMethods(DecoratorClass); - var superMethods = getMethods(SuperClass); - - function DecoratedClass () { - var unshift = Array.prototype.unshift; - - var argCount = DecoratorClass.prototype.constructor.length; - - var calledConstructor = SuperClass.prototype.constructor; - - if (argCount > 0) { - unshift.call(arguments, SuperClass.prototype.constructor); - - calledConstructor = DecoratorClass.prototype.constructor; - } - - calledConstructor.apply(this, arguments); - } - - DecoratorClass.displayName = SuperClass.displayName; - - function ctr () { - this.constructor = DecoratedClass; - } - - DecoratedClass.prototype = new ctr(); - - for (var m = 0; m < superMethods.length; m++) { - var superMethod = superMethods[m]; - - DecoratedClass.prototype[superMethod] = - SuperClass.prototype[superMethod]; - } - - var calledMethod = function (methodName) { - // Stub out the original method if it's not decorating an actual method - var originalMethod = function () {}; - - if (methodName in DecoratedClass.prototype) { - originalMethod = DecoratedClass.prototype[methodName]; - } - - var decoratedMethod = DecoratorClass.prototype[methodName]; - - return function () { - var unshift = Array.prototype.unshift; - - unshift.call(arguments, originalMethod); - - return decoratedMethod.apply(this, arguments); - }; - }; - - for (var d = 0; d < decoratedMethods.length; d++) { - var decoratedMethod = decoratedMethods[d]; - - DecoratedClass.prototype[decoratedMethod] = calledMethod(decoratedMethod); - } - - return DecoratedClass; - }; - - var Observable = function () { - this.listeners = {}; - }; - - Observable.prototype.on = function (event, callback) { - this.listeners = this.listeners || {}; - - if (event in this.listeners) { - this.listeners[event].push(callback); - } else { - this.listeners[event] = [callback]; - } - }; - - Observable.prototype.trigger = function (event) { - var slice = Array.prototype.slice; - - this.listeners = this.listeners || {}; - - if (event in this.listeners) { - this.invoke(this.listeners[event], slice.call(arguments, 1)); - } - - if ('*' in this.listeners) { - this.invoke(this.listeners['*'], arguments); - } - }; - - Observable.prototype.invoke = function (listeners, params) { - for (var i = 0, len = listeners.length; i < len; i++) { - listeners[i].apply(this, params); - } - }; - - Utils.Observable = Observable; - - Utils.generateChars = function (length) { - var chars = ''; - - for (var i = 0; i < length; i++) { - var randomChar = Math.floor(Math.random() * 36); - chars += randomChar.toString(36); - } - - return chars; - }; - - Utils.bind = function (func, context) { - return function () { - func.apply(context, arguments); - }; - }; - - Utils._convertData = function (data) { - for (var originalKey in data) { - var keys = originalKey.split('-'); - - var dataLevel = data; - - if (keys.length === 1) { - continue; - } - - for (var k = 0; k < keys.length; k++) { - var key = keys[k]; - - // Lowercase the first letter - // By default, dash-separated becomes camelCase - key = key.substring(0, 1).toLowerCase() + key.substring(1); - - if (!(key in dataLevel)) { - dataLevel[key] = {}; - } - - if (k == keys.length - 1) { - dataLevel[key] = data[originalKey]; - } - - dataLevel = dataLevel[key]; - } - - delete data[originalKey]; - } - - return data; - }; - - Utils.hasScroll = function (index, el) { - // Adapted from the function created by @ShadowScripter - // and adapted by @BillBarry on the Stack Exchange Code Review website. - // The original code can be found at - // http://codereview.stackexchange.com/q/13338 - // and was designed to be used with the Sizzle selector engine. - - var $el = $(el); - var overflowX = el.style.overflowX; - var overflowY = el.style.overflowY; - - //Check both x and y declarations - if (overflowX === overflowY && - (overflowY === 'hidden' || overflowY === 'visible')) { - return false; - } - - if (overflowX === 'scroll' || overflowY === 'scroll') { - return true; - } - - return ($el.innerHeight() < el.scrollHeight || - $el.innerWidth() < el.scrollWidth); - }; - - Utils.escapeMarkup = function (markup) { - var replaceMap = { - '\\': '\', - '&': '&', - '<': '<', - '>': '>', - '"': '"', - '\'': ''', - '/': '/' - }; - - // Do not try to escape the markup if it's not a string - if (typeof markup !== 'string') { - return markup; - } - - return String(markup).replace(/[&<>"'\/\\]/g, function (match) { - return replaceMap[match]; - }); - }; - - return Utils; -}); - -define('select2/results',[ - 'jquery', - './utils' -], function ($, Utils) { - function Results ($element, options, dataAdapter) { - this.$element = $element; - this.data = dataAdapter; - this.options = options; - - Results.__super__.constructor.call(this); - } - - Utils.Extend(Results, Utils.Observable); - - Results.prototype.render = function () { - var $results = $( - '<ul class="select2-results__options" role="tree"></ul>' - ); - - if (this.options.get('multiple')) { - $results.attr('aria-multiselectable', 'true'); - } - - this.$results = $results; - - return $results; - }; - - Results.prototype.clear = function () { - this.$results.empty(); - }; - - Results.prototype.displayMessage = function (params) { - var escapeMarkup = this.options.get('escapeMarkup'); - - this.clear(); - this.hideLoading(); - - var $message = $( - '<li role="treeitem" class="select2-results__option"></li>' - ); - - var message = this.options.get('translations').get(params.message); - - $message.append( - escapeMarkup( - message(params.args) - ) - ); - - this.$results.append($message); - }; - - Results.prototype.append = function (data) { - this.hideLoading(); - - var $options = []; - - if (data.results == null || data.results.length === 0) { - if (this.$results.children().length === 0) { - this.trigger('results:message', { - message: 'noResults' - }); - } - - return; - } - - data.results = this.sort(data.results); - - for (var d = 0; d < data.results.length; d++) { - var item = data.results[d]; - - var $option = this.option(item); - - $options.push($option); - } - - this.$results.append($options); - }; - - Results.prototype.position = function ($results, $dropdown) { - var $resultsContainer = $dropdown.find('.select2-results'); - $resultsContainer.append($results); - }; - - Results.prototype.sort = function (data) { - var sorter = this.options.get('sorter'); - - return sorter(data); - }; - - Results.prototype.setClasses = function () { - var self = this; - - this.data.current(function (selected) { - var selectedIds = $.map(selected, function (s) { - return s.id.toString(); - }); - - var $options = self.$results - .find('.select2-results__option[aria-selected]'); - - $options.each(function () { - var $option = $(this); - - var item = $.data(this, 'data'); - - if ($.inArray(item.id, selectedIds) > -1) { - $option.attr('aria-selected', 'true'); - } else { - $option.attr('aria-selected', 'false'); - } - }); - - var $selected = $options.filter('[aria-selected=true]'); - - // Check if there are any selected options - if ($selected.length > 0) { - // If there are selected options, highlight the first - $selected.first().trigger('mouseenter'); - } else { - // If there are no selected options, highlight the first option - // in the dropdown - $options.first().trigger('mouseenter'); - } - }); - }; - - Results.prototype.showLoading = function (params) { - this.hideLoading(); - - var loadingMore = this.options.get('translations').get('searching'); - - var loading = { - disabled: true, - loading: true, - text: loadingMore(params) - }; - var $loading = this.option(loading); - $loading.className += ' loading-results'; - - this.$results.prepend($loading); - }; - - Results.prototype.hideLoading = function () { - this.$results.find('.loading-results').remove(); - }; - - Results.prototype.option = function (data) { - var option = document.createElement('li'); - option.className = 'select2-results__option'; - - var attrs = { - 'role': 'treeitem', - 'aria-selected': 'false' - }; - - if (data.disabled) { - delete attrs['aria-selected']; - attrs['aria-disabled'] = 'true'; - } - - if (data.id == null) { - delete attrs['aria-selected']; - } - - if (data._resultId != null) { - option.id = data._resultId; - } - - if (data.title) { - option.title = data.title; - } - - if (data.children) { - attrs.role = 'group'; - attrs['aria-label'] = data.text; - delete attrs['aria-selected']; - } - - for (var attr in attrs) { - var val = attrs[attr]; - - option.setAttribute(attr, val); - } - - if (data.children) { - var $option = $(option); - - var label = document.createElement('strong'); - label.className = 'select2-results__group'; - - var $label = $(label); - this.template(data, label); - - var $children = []; - - for (var c = 0; c < data.children.length; c++) { - var child = data.children[c]; - - var $child = this.option(child); - - $children.push($child); - } - - var $childrenContainer = $('<ul></ul>', { - 'class': 'select2-results__options select2-results__options--nested' - }); - - $childrenContainer.append($children); - - $option.append(label); - $option.append($childrenContainer); - } else { - this.template(data, option); - } - - $.data(option, 'data', data); - - return option; - }; - - Results.prototype.bind = function (container, $container) { - var self = this; - - var id = container.id + '-results'; - - this.$results.attr('id', id); - - container.on('results:all', function (params) { - self.clear(); - self.append(params.data); - - if (container.isOpen()) { - self.setClasses(); - } - }); - - container.on('results:append', function (params) { - self.append(params.data); - - if (container.isOpen()) { - self.setClasses(); - } - }); - - container.on('query', function (params) { - self.showLoading(params); - }); - - container.on('select', function () { - if (!container.isOpen()) { - return; - } - - self.setClasses(); - }); - - container.on('unselect', function () { - if (!container.isOpen()) { - return; - } - - self.setClasses(); - }); - - container.on('open', function () { - // When the dropdown is open, aria-expended="true" - self.$results.attr('aria-expanded', 'true'); - self.$results.attr('aria-hidden', 'false'); - - self.setClasses(); - self.ensureHighlightVisible(); - }); - - container.on('close', function () { - // When the dropdown is closed, aria-expended="false" - self.$results.attr('aria-expanded', 'false'); - self.$results.attr('aria-hidden', 'true'); - self.$results.removeAttr('aria-activedescendant'); - }); - - container.on('results:toggle', function () { - var $highlighted = self.getHighlightedResults(); - - if ($highlighted.length === 0) { - return; - } - - $highlighted.trigger('mouseup'); - }); - - container.on('results:select', function () { - var $highlighted = self.getHighlightedResults(); - - if ($highlighted.length === 0) { - return; - } - - var data = $highlighted.data('data'); - - if ($highlighted.attr('aria-selected') == 'true') { - self.trigger('close'); - } else { - self.trigger('select', { - data: data - }); - } - }); - - container.on('results:previous', function () { - var $highlighted = self.getHighlightedResults(); - - var $options = self.$results.find('[aria-selected]'); - - var currentIndex = $options.index($highlighted); - - // If we are already at te top, don't move further - if (currentIndex === 0) { - return; - } - - var nextIndex = currentIndex - 1; - - // If none are highlighted, highlight the first - if ($highlighted.length === 0) { - nextIndex = 0; - } - - var $next = $options.eq(nextIndex); - - $next.trigger('mouseenter'); - - var currentOffset = self.$results.offset().top; - var nextTop = $next.offset().top; - var nextOffset = self.$results.scrollTop() + (nextTop - currentOffset); - - if (nextIndex === 0) { - self.$results.scrollTop(0); - } else if (nextTop - currentOffset < 0) { - self.$results.scrollTop(nextOffset); - } - }); - - container.on('results:next', function () { - var $highlighted = self.getHighlightedResults(); - - var $options = self.$results.find('[aria-selected]'); - - var currentIndex = $options.index($highlighted); - - var nextIndex = currentIndex + 1; - - // If we are at the last option, stay there - if (nextIndex >= $options.length) { - return; - } - - var $next = $options.eq(nextIndex); - - $next.trigger('mouseenter'); - - var currentOffset = self.$results.offset().top + - self.$results.outerHeight(false); - var nextBottom = $next.offset().top + $next.outerHeight(false); - var nextOffset = self.$results.scrollTop() + nextBottom - currentOffset; - - if (nextIndex === 0) { - self.$results.scrollTop(0); - } else if (nextBottom > currentOffset) { - self.$results.scrollTop(nextOffset); - } - }); - - container.on('results:focus', function (params) { - params.element.addClass('select2-results__option--highlighted'); - }); - - container.on('results:message', function (params) { - self.displayMessage(params); - }); - - if ($.fn.mousewheel) { - this.$results.on('mousewheel', function (e) { - var top = self.$results.scrollTop(); - - var bottom = ( - self.$results.get(0).scrollHeight - - self.$results.scrollTop() + - e.deltaY - ); - - var isAtTop = e.deltaY > 0 && top - e.deltaY <= 0; - var isAtBottom = e.deltaY < 0 && bottom <= self.$results.height(); - - if (isAtTop) { - self.$results.scrollTop(0); - - e.preventDefault(); - e.stopPropagation(); - } else if (isAtBottom) { - self.$results.scrollTop( - self.$results.get(0).scrollHeight - self.$results.height() - ); - - e.preventDefault(); - e.stopPropagation(); - } - }); - } - - this.$results.on('mouseup', '.select2-results__option[aria-selected]', - function (evt) { - var $this = $(this); - - var data = $this.data('data'); - - if ($this.attr('aria-selected') === 'true') { - if (self.options.get('multiple')) { - self.trigger('unselect', { - originalEvent: evt, - data: data - }); - } else { - self.trigger('close'); - } - - return; - } - - self.trigger('select', { - originalEvent: evt, - data: data - }); - }); - - this.$results.on('mouseenter', '.select2-results__option[aria-selected]', - function (evt) { - var data = $(this).data('data'); - - self.getHighlightedResults() - .removeClass('select2-results__option--highlighted'); - - self.trigger('results:focus', { - data: data, - element: $(this) - }); - }); - }; - - Results.prototype.getHighlightedResults = function () { - var $highlighted = this.$results - .find('.select2-results__option--highlighted'); - - return $highlighted; - }; - - Results.prototype.destroy = function () { - this.$results.remove(); - }; - - Results.prototype.ensureHighlightVisible = function () { - var $highlighted = this.getHighlightedResults(); - - if ($highlighted.length === 0) { - return; - } - - var $options = this.$results.find('[aria-selected]'); - - var currentIndex = $options.index($highlighted); - - var currentOffset = this.$results.offset().top; - var nextTop = $highlighted.offset().top; - var nextOffset = this.$results.scrollTop() + (nextTop - currentOffset); - - var offsetDelta = nextTop - currentOffset; - nextOffset -= $highlighted.outerHeight(false) * 2; - - if (currentIndex <= 2) { - this.$results.scrollTop(0); - } else if (offsetDelta > this.$results.outerHeight() || offsetDelta < 0) { - this.$results.scrollTop(nextOffset); - } - }; - - Results.prototype.template = function (result, container) { - var template = this.options.get('templateResult'); - var escapeMarkup = this.options.get('escapeMarkup'); - - var content = template(result); - - if (content == null) { - container.style.display = 'none'; - } else if (typeof content === 'string') { - container.innerHTML = escapeMarkup(content); - } else { - $(container).append(content); - } - }; - - return Results; -}); - -define('select2/keys',[ - -], function () { - var KEYS = { - BACKSPACE: 8, - TAB: 9, - ENTER: 13, - SHIFT: 16, - CTRL: 17, - ALT: 18, - ESC: 27, - SPACE: 32, - PAGE_UP: 33, - PAGE_DOWN: 34, - END: 35, - HOME: 36, - LEFT: 37, - UP: 38, - RIGHT: 39, - DOWN: 40, - DELETE: 46 - }; - - return KEYS; -}); - -define('select2/selection/base',[ - 'jquery', - '../utils', - '../keys' -], function ($, Utils, KEYS) { - function BaseSelection ($element, options) { - this.$element = $element; - this.options = options; - - BaseSelection.__super__.constructor.call(this); - } - - Utils.Extend(BaseSelection, Utils.Observable); - - BaseSelection.prototype.render = function () { - var $selection = $( - '<span class="select2-selection" role="combobox" ' + - 'aria-autocomplete="list" aria-haspopup="true" aria-expanded="false">' + - '</span>' - ); - - this._tabindex = 0; - - if (this.$element.data('old-tabindex') != null) { - this._tabindex = this.$element.data('old-tabindex'); - } else if (this.$element.attr('tabindex') != null) { - this._tabindex = this.$element.attr('tabindex'); - } - - $selection.attr('title', this.$element.attr('title')); - $selection.attr('tabindex', this._tabindex); - - this.$selection = $selection; - - return $selection; - }; - - BaseSelection.prototype.bind = function (container, $container) { - var self = this; - - var id = container.id + '-container'; - var resultsId = container.id + '-results'; - - this.container = container; - - this.$selection.attr('aria-owns', resultsId); - - this.$selection.on('focus', function (evt) { - self.trigger('focus', evt); - }); - - this.$selection.on('blur', function (evt) { - self.trigger('blur', evt); - }); - - this.$selection.on('keydown', function (evt) { - self.trigger('keypress', evt); - - if (evt.which === KEYS.SPACE) { - evt.preventDefault(); - } - }); - - container.on('results:focus', function (params) { - self.$selection.attr('aria-activedescendant', params.data._resultId); - }); - - container.on('selection:update', function (params) { - self.update(params.data); - }); - - container.on('open', function () { - // When the dropdown is open, aria-expanded="true" - self.$selection.attr('aria-expanded', 'true'); - - self._attachCloseHandler(container); - }); - - container.on('close', function () { - // When the dropdown is closed, aria-expanded="false" - self.$selection.attr('aria-expanded', 'false'); - self.$selection.removeAttr('aria-activedescendant'); - - self.$selection.focus(); - - self._detachCloseHandler(container); - }); - - container.on('enable', function () { - self.$selection.attr('tabindex', self._tabindex); - }); - - container.on('disable', function () { - self.$selection.attr('tabindex', '-1'); - }); - }; - - BaseSelection.prototype._attachCloseHandler = function (container) { - var self = this; - - $(document.body).on('mousedown.select2.' + container.id, function (e) { - var $target = $(e.target); - - var $select = $target.closest('.select2'); - - var $all = $('.select2.select2-container--open'); - - $all.each(function () { - var $this = $(this); - - if (this == $select[0]) { - return; - } - - var $element = $this.data('element'); - - $element.select2('close'); - }); - }); - }; - - BaseSelection.prototype._detachCloseHandler = function (container) { - $(document.body).off('mousedown.select2.' + container.id); - }; - - BaseSelection.prototype.position = function ($selection, $container) { - var $selectionContainer = $container.find('.selection'); - $selectionContainer.append($selection); - }; - - BaseSelection.prototype.destroy = function () { - this._detachCloseHandler(this.container); - }; - - BaseSelection.prototype.update = function (data) { - throw new Error('The `update` method must be defined in child classes.'); - }; - - return BaseSelection; -}); - -define('select2/selection/single',[ - 'jquery', - './base', - '../utils', - '../keys' -], function ($, BaseSelection, Utils, KEYS) { - function SingleSelection () { - SingleSelection.__super__.constructor.apply(this, arguments); - } - - Utils.Extend(SingleSelection, BaseSelection); - - SingleSelection.prototype.render = function () { - var $selection = SingleSelection.__super__.render.call(this); - - $selection.addClass('select2-selection--single'); - - $selection.html( - '<span class="select2-selection__rendered"></span>' + - '<span class="select2-selection__arrow" role="presentation">' + - '<b role="presentation"></b>' + - '</span>' - ); - - return $selection; - }; - - SingleSelection.prototype.bind = function (container, $container) { - var self = this; - - SingleSelection.__super__.bind.apply(this, arguments); - - var id = container.id + '-container'; - - this.$selection.find('.select2-selection__rendered').attr('id', id); - this.$selection.attr('aria-labelledby', id); - - this.$selection.on('mousedown', function (evt) { - // Only respond to left clicks - if (evt.which !== 1) { - return; - } - - self.trigger('toggle', { - originalEvent: evt - }); - }); - - this.$selection.on('focus', function (evt) { - // User focuses on the container - }); - - this.$selection.on('blur', function (evt) { - // User exits the container - }); - - container.on('selection:update', function (params) { - self.update(params.data); - }); - }; - - SingleSelection.prototype.clear = function () { - this.$selection.find('.select2-selection__rendered').empty(); - }; - - SingleSelection.prototype.display = function (data) { - var template = this.options.get('templateSelection'); - var escapeMarkup = this.options.get('escapeMarkup'); - - return escapeMarkup(template(data)); - }; - - SingleSelection.prototype.selectionContainer = function () { - return $('<span></span>'); - }; - - SingleSelection.prototype.update = function (data) { - if (data.length === 0) { - this.clear(); - return; - } - - var selection = data[0]; - - var formatted = this.display(selection); - - var $rendered = this.$selection.find('.select2-selection__rendered'); - $rendered.empty().append(formatted); - $rendered.prop('title', selection.title || selection.text); - }; - - return SingleSelection; -}); - -define('select2/selection/multiple',[ - 'jquery', - './base', - '../utils' -], function ($, BaseSelection, Utils) { - function MultipleSelection ($element, options) { - MultipleSelection.__super__.constructor.apply(this, arguments); - } - - Utils.Extend(MultipleSelection, BaseSelection); - - MultipleSelection.prototype.render = function () { - var $selection = MultipleSelection.__super__.render.call(this); - - $selection.addClass('select2-selection--multiple'); - - $selection.html( - '<ul class="select2-selection__rendered"></ul>' - ); - - return $selection; - }; - - MultipleSelection.prototype.bind = function (container, $container) { - var self = this; - - MultipleSelection.__super__.bind.apply(this, arguments); - - this.$selection.on('click', function (evt) { - self.trigger('toggle', { - originalEvent: evt - }); - }); - - this.$selection.on('click', '.select2-selection__choice__remove', - function (evt) { - var $remove = $(this); - var $selection = $remove.parent(); - - var data = $selection.data('data'); - - self.trigger('unselect', { - originalEvent: evt, - data: data - }); - }); - }; - - MultipleSelection.prototype.clear = function () { - this.$selection.find('.select2-selection__rendered').empty(); - }; - - MultipleSelection.prototype.display = function (data) { - var template = this.options.get('templateSelection'); - var escapeMarkup = this.options.get('escapeMarkup'); - - return escapeMarkup(template(data)); - }; - - MultipleSelection.prototype.selectionContainer = function () { - var $container = $( - '<li class="select2-selection__choice">' + - '<span class="select2-selection__choice__remove" role="presentation">' + - '×' + - '</span>' + - '</li>' - ); - - return $container; - }; - - MultipleSelection.prototype.update = function (data) { - this.clear(); - - if (data.length === 0) { - return; - } - - var $selections = []; - - for (var d = 0; d < data.length; d++) { - var selection = data[d]; - - var formatted = this.display(selection); - var $selection = this.selectionContainer(); - - $selection.append(formatted); - $selection.prop('title', selection.title || selection.text); - - $selection.data('data', selection); - - $selections.push($selection); - } - - this.$selection.find('.select2-selection__rendered').append($selections); - }; - - return MultipleSelection; -}); - -define('select2/selection/placeholder',[ - '../utils' -], function (Utils) { - function Placeholder (decorated, $element, options) { - this.placeholder = this.normalizePlaceholder(options.get('placeholder')); - - decorated.call(this, $element, options); - } - - Placeholder.prototype.normalizePlaceholder = function (_, placeholder) { - if (typeof placeholder === 'string') { - placeholder = { - id: '', - text: placeholder - }; - } - - return placeholder; - }; - - Placeholder.prototype.createPlaceholder = function (decorated, placeholder) { - var $placeholder = this.selectionContainer(); - - $placeholder.html(this.display(placeholder)); - $placeholder.addClass('select2-selection__placeholder') - .removeClass('select2-selection__choice'); - - return $placeholder; - }; - - Placeholder.prototype.update = function (decorated, data) { - var singlePlaceholder = ( - data.length == 1 && data[0].id != this.placeholder.id - ); - var multipleSelections = data.length > 1; - - if (multipleSelections || singlePlaceholder) { - return decorated.call(this, data); - } - - this.clear(); - - var $placeholder = this.createPlaceholder(this.placeholder); - - this.$selection.find('.select2-selection__rendered').append($placeholder); - }; - - return Placeholder; -}); - -define('select2/selection/allowClear',[ - 'jquery' -], function ($) { - function AllowClear () { } - - AllowClear.prototype.bind = function (decorated, container, $container) { - var self = this; - - decorated.call(this, container, $container); - - if (self.placeholder == null) { - if (window.console && console.error) { - console.error( - 'Select2: The `allowClear` option should be used in combination ' + - 'with the `placeholder` option.' - ); - } - } - - this.$selection.on('mousedown', '.select2-selection__clear', - function (evt) { - // Ignore the event if it is disabled - if (self.options.get('disabled')) { - return; - } - - evt.stopPropagation(); - - var data = $(this).data('data'); - - for (var d = 0; d < data.length; d++) { - var unselectData = { - data: data[d] - }; - - // Trigger the `unselect` event, so people can prevent it from being - // cleared. - self.trigger('unselect', unselectData); - - // If the event was prevented, don't clear it out. - if (unselectData.prevented) { - return; - } - } - - self.$element.val(self.placeholder.id).trigger('change'); - - self.trigger('toggle'); - }); - }; - - AllowClear.prototype.update = function (decorated, data) { - decorated.call(this, data); - - if (this.$selection.find('.select2-selection__placeholder').length > 0 || - data.length === 0) { - return; - } - - var $remove = $( - '<span class="select2-selection__clear">' + - '×' + - '</span>' - ); - $remove.data('data', data); - - this.$selection.find('.select2-selection__rendered').append($remove); - }; - - return AllowClear; -}); - -define('select2/selection/search',[ - 'jquery', - '../utils', - '../keys' -], function ($, Utils, KEYS) { - function Search (decorated, $element, options) { - decorated.call(this, $element, options); - } - - Search.prototype.render = function (decorated) { - var $search = $( - '<li class="select2-search select2-search--inline">' + - '<input class="select2-search__field" type="search" tabindex="-1"' + - ' autocomplete="off" autocorrect="off" autocapitalize="off"' + - ' spellcheck="false" role="textbox" />' + - '</li>' - ); - - this.$searchContainer = $search; - this.$search = $search.find('input'); - - var $rendered = decorated.call(this); - - return $rendered; - }; - - Search.prototype.bind = function (decorated, container, $container) { - var self = this; - - decorated.call(this, container, $container); - - container.on('open', function () { - self.$search.attr('tabindex', 0); - - self.$search.focus(); - }); - - container.on('close', function () { - self.$search.attr('tabindex', -1); - - self.$search.val(''); - self.$search.focus(); - }); - - container.on('enable', function () { - self.$search.prop('disabled', false); - }); - - container.on('disable', function () { - self.$search.prop('disabled', true); - }); - - this.$selection.on('focusin', '.select2-search--inline', function (evt) { - self.trigger('focus', evt); - }); - - this.$selection.on('focusout', '.select2-search--inline', function (evt) { - self.trigger('blur', evt); - }); - - this.$selection.on('keydown', '.select2-search--inline', function (evt) { - evt.stopPropagation(); - - self.trigger('keypress', evt); - - self._keyUpPrevented = evt.isDefaultPrevented(); - - var key = evt.which; - - if (key === KEYS.BACKSPACE && self.$search.val() === '') { - var $previousChoice = self.$searchContainer - .prev('.select2-selection__choice'); - - if ($previousChoice.length > 0) { - var item = $previousChoice.data('data'); - - self.searchRemoveChoice(item); - } - } - }); - - // Workaround for browsers which do not support the `input` event - // This will prevent double-triggering of events for browsers which support - // both the `keyup` and `input` events. - this.$selection.on('input', '.select2-search--inline', function (evt) { - // Unbind the duplicated `keyup` event - self.$selection.off('keyup.search'); - }); - - this.$selection.on('keyup.search input', '.select2-search--inline', - function (evt) { - self.handleSearch(evt); - }); - }; - - Search.prototype.createPlaceholder = function (decorated, placeholder) { - this.$search.attr('placeholder', placeholder.text); - }; - - Search.prototype.update = function (decorated, data) { - this.$search.attr('placeholder', ''); - - decorated.call(this, data); - - this.$selection.find('.select2-selection__rendered') - .append(this.$searchContainer); - - this.resizeSearch(); - }; - - Search.prototype.handleSearch = function () { - this.resizeSearch(); - - if (!this._keyUpPrevented) { - var input = this.$search.val(); - - this.trigger('query', { - term: input - }); - } - - this._keyUpPrevented = false; - }; - - Search.prototype.searchRemoveChoice = function (decorated, item) { - this.trigger('unselect', { - data: item - }); - - this.trigger('open'); - - this.$search.val(item.text + ' '); - }; - - Search.prototype.resizeSearch = function () { - this.$search.css('width', '25px'); - - var width = ''; - - if (this.$search.attr('placeholder') !== '') { - width = this.$selection.find('.select2-selection__rendered').innerWidth(); - } else { - var minimumWidth = this.$search.val().length + 1; - - width = (minimumWidth * 0.75) + 'em'; - } - - this.$search.css('width', width); - }; - - return Search; -}); - -define('select2/selection/eventRelay',[ - 'jquery' -], function ($) { - function EventRelay () { } - - EventRelay.prototype.bind = function (decorated, container, $container) { - var self = this; - var relayEvents = [ - 'open', 'opening', - 'close', 'closing', - 'select', 'selecting', - 'unselect', 'unselecting' - ]; - - var preventableEvents = ['opening', 'closing', 'selecting', 'unselecting']; - - decorated.call(this, container, $container); - - container.on('*', function (name, params) { - // Ignore events that should not be relayed - if ($.inArray(name, relayEvents) === -1) { - return; - } - - // The parameters should always be an object - params = params || {}; - - // Generate the jQuery event for the Select2 event - var evt = $.Event('select2:' + name, { - params: params - }); - - self.$element.trigger(evt); - - // Only handle preventable events if it was one - if ($.inArray(name, preventableEvents) === -1) { - return; - } - - params.prevented = evt.isDefaultPrevented(); - }); - }; - - return EventRelay; -}); - -define('select2/translation',[ - 'jquery' -], function ($) { - function Translation (dict) { - this.dict = dict || {}; - } - - Translation.prototype.all = function () { - return this.dict; - }; - - Translation.prototype.get = function (key) { - return this.dict[key]; - }; - - Translation.prototype.extend = function (translation) { - this.dict = $.extend({}, translation.all(), this.dict); - }; - - // Static functions - - Translation._cache = {}; - - Translation.loadPath = function (path) { - if (!(path in Translation._cache)) { - var translations = require(path); - - Translation._cache[path] = translations; - } - - return new Translation(Translation._cache[path]); - }; - - return Translation; -}); - -define('select2/diacritics',[ - -], function () { - var diacritics = { - '\u24B6': 'A', - '\uFF21': 'A', - '\u00C0': 'A', - '\u00C1': 'A', - '\u00C2': 'A', - '\u1EA6': 'A', - '\u1EA4': 'A', - '\u1EAA': 'A', - '\u1EA8': 'A', - '\u00C3': 'A', - '\u0100': 'A', - '\u0102': 'A', - '\u1EB0': 'A', - '\u1EAE': 'A', - '\u1EB4': 'A', - '\u1EB2': 'A', - '\u0226': 'A', - '\u01E0': 'A', - '\u00C4': 'A', - '\u01DE': 'A', - '\u1EA2': 'A', - '\u00C5': 'A', - '\u01FA': 'A', - '\u01CD': 'A', - '\u0200': 'A', - '\u0202': 'A', - '\u1EA0': 'A', - '\u1EAC': 'A', - '\u1EB6': 'A', - '\u1E00': 'A', - '\u0104': 'A', - '\u023A': 'A', - '\u2C6F': 'A', - '\uA732': 'AA', - '\u00C6': 'AE', - '\u01FC': 'AE', - '\u01E2': 'AE', - '\uA734': 'AO', - '\uA736': 'AU', - '\uA738': 'AV', - '\uA73A': 'AV', - '\uA73C': 'AY', - '\u24B7': 'B', - '\uFF22': 'B', - '\u1E02': 'B', - '\u1E04': 'B', - '\u1E06': 'B', - '\u0243': 'B', - '\u0182': 'B', - '\u0181': 'B', - '\u24B8': 'C', - '\uFF23': 'C', - '\u0106': 'C', - '\u0108': 'C', - '\u010A': 'C', - '\u010C': 'C', - '\u00C7': 'C', - '\u1E08': 'C', - '\u0187': 'C', - '\u023B': 'C', - '\uA73E': 'C', - '\u24B9': 'D', - '\uFF24': 'D', - '\u1E0A': 'D', - '\u010E': 'D', - '\u1E0C': 'D', - '\u1E10': 'D', - '\u1E12': 'D', - '\u1E0E': 'D', - '\u0110': 'D', - '\u018B': 'D', - '\u018A': 'D', - '\u0189': 'D', - '\uA779': 'D', - '\u01F1': 'DZ', - '\u01C4': 'DZ', - '\u01F2': 'Dz', - '\u01C5': 'Dz', - '\u24BA': 'E', - '\uFF25': 'E', - '\u00C8': 'E', - '\u00C9': 'E', - '\u00CA': 'E', - '\u1EC0': 'E', - '\u1EBE': 'E', - '\u1EC4': 'E', - '\u1EC2': 'E', - '\u1EBC': 'E', - '\u0112': 'E', - '\u1E14': 'E', - '\u1E16': 'E', - '\u0114': 'E', - '\u0116': 'E', - '\u00CB': 'E', - '\u1EBA': 'E', - '\u011A': 'E', - '\u0204': 'E', - '\u0206': 'E', - '\u1EB8': 'E', - '\u1EC6': 'E', - '\u0228': 'E', - '\u1E1C': 'E', - '\u0118': 'E', - '\u1E18': 'E', - '\u1E1A': 'E', - '\u0190': 'E', - '\u018E': 'E', - '\u24BB': 'F', - '\uFF26': 'F', - '\u1E1E': 'F', - '\u0191': 'F', - '\uA77B': 'F', - '\u24BC': 'G', - '\uFF27': 'G', - '\u01F4': 'G', - '\u011C': 'G', - '\u1E20': 'G', - '\u011E': 'G', - '\u0120': 'G', - '\u01E6': 'G', - '\u0122': 'G', - '\u01E4': 'G', - '\u0193': 'G', - '\uA7A0': 'G', - '\uA77D': 'G', - '\uA77E': 'G', - '\u24BD': 'H', - '\uFF28': 'H', - '\u0124': 'H', - '\u1E22': 'H', - '\u1E26': 'H', - '\u021E': 'H', - '\u1E24': 'H', - '\u1E28': 'H', - '\u1E2A': 'H', - '\u0126': 'H', - '\u2C67': 'H', - '\u2C75': 'H', - '\uA78D': 'H', - '\u24BE': 'I', - '\uFF29': 'I', - '\u00CC': 'I', - '\u00CD': 'I', - '\u00CE': 'I', - '\u0128': 'I', - '\u012A': 'I', - '\u012C': 'I', - '\u0130': 'I', - '\u00CF': 'I', - '\u1E2E': 'I', - '\u1EC8': 'I', - '\u01CF': 'I', - '\u0208': 'I', - '\u020A': 'I', - '\u1ECA': 'I', - '\u012E': 'I', - '\u1E2C': 'I', - '\u0197': 'I', - '\u24BF': 'J', - '\uFF2A': 'J', - '\u0134': 'J', - '\u0248': 'J', - '\u24C0': 'K', - '\uFF2B': 'K', - '\u1E30': 'K', - '\u01E8': 'K', - '\u1E32': 'K', - '\u0136': 'K', - '\u1E34': 'K', - '\u0198': 'K', - '\u2C69': 'K', - '\uA740': 'K', - '\uA742': 'K', - '\uA744': 'K', - '\uA7A2': 'K', - '\u24C1': 'L', - '\uFF2C': 'L', - '\u013F': 'L', - '\u0139': 'L', - '\u013D': 'L', - '\u1E36': 'L', - '\u1E38': 'L', - '\u013B': 'L', - '\u1E3C': 'L', - '\u1E3A': 'L', - '\u0141': 'L', - '\u023D': 'L', - '\u2C62': 'L', - '\u2C60': 'L', - '\uA748': 'L', - '\uA746': 'L', - '\uA780': 'L', - '\u01C7': 'LJ', - '\u01C8': 'Lj', - '\u24C2': 'M', - '\uFF2D': 'M', - '\u1E3E': 'M', - '\u1E40': 'M', - '\u1E42': 'M', - '\u2C6E': 'M', - '\u019C': 'M', - '\u24C3': 'N', - '\uFF2E': 'N', - '\u01F8': 'N', - '\u0143': 'N', - '\u00D1': 'N', - '\u1E44': 'N', - '\u0147': 'N', - '\u1E46': 'N', - '\u0145': 'N', - '\u1E4A': 'N', - '\u1E48': 'N', - '\u0220': 'N', - '\u019D': 'N', - '\uA790': 'N', - '\uA7A4': 'N', - '\u01CA': 'NJ', - '\u01CB': 'Nj', - '\u24C4': 'O', - '\uFF2F': 'O', - '\u00D2': 'O', - '\u00D3': 'O', - '\u00D4': 'O', - '\u1ED2': 'O', - '\u1ED0': 'O', - '\u1ED6': 'O', - '\u1ED4': 'O', - '\u00D5': 'O', - '\u1E4C': 'O', - '\u022C': 'O', - '\u1E4E': 'O', - '\u014C': 'O', - '\u1E50': 'O', - '\u1E52': 'O', - '\u014E': 'O', - '\u022E': 'O', - '\u0230': 'O', - '\u00D6': 'O', - '\u022A': 'O', - '\u1ECE': 'O', - '\u0150': 'O', - '\u01D1': 'O', - '\u020C': 'O', - '\u020E': 'O', - '\u01A0': 'O', - '\u1EDC': 'O', - '\u1EDA': 'O', - '\u1EE0': 'O', - '\u1EDE': 'O', - '\u1EE2': 'O', - '\u1ECC': 'O', - '\u1ED8': 'O', - '\u01EA': 'O', - '\u01EC': 'O', - '\u00D8': 'O', - '\u01FE': 'O', - '\u0186': 'O', - '\u019F': 'O', - '\uA74A': 'O', - '\uA74C': 'O', - '\u01A2': 'OI', - '\uA74E': 'OO', - '\u0222': 'OU', - '\u24C5': 'P', - '\uFF30': 'P', - '\u1E54': 'P', - '\u1E56': 'P', - '\u01A4': 'P', - '\u2C63': 'P', - '\uA750': 'P', - '\uA752': 'P', - '\uA754': 'P', - '\u24C6': 'Q', - '\uFF31': 'Q', - '\uA756': 'Q', - '\uA758': 'Q', - '\u024A': 'Q', - '\u24C7': 'R', - '\uFF32': 'R', - '\u0154': 'R', - '\u1E58': 'R', - '\u0158': 'R', - '\u0210': 'R', - '\u0212': 'R', - '\u1E5A': 'R', - '\u1E5C': 'R', - '\u0156': 'R', - '\u1E5E': 'R', - '\u024C': 'R', - '\u2C64': 'R', - '\uA75A': 'R', - '\uA7A6': 'R', - '\uA782': 'R', - '\u24C8': 'S', - '\uFF33': 'S', - '\u1E9E': 'S', - '\u015A': 'S', - '\u1E64': 'S', - '\u015C': 'S', - '\u1E60': 'S', - '\u0160': 'S', - '\u1E66': 'S', - '\u1E62': 'S', - '\u1E68': 'S', - '\u0218': 'S', - '\u015E': 'S', - '\u2C7E': 'S', - '\uA7A8': 'S', - '\uA784': 'S', - '\u24C9': 'T', - '\uFF34': 'T', - '\u1E6A': 'T', - '\u0164': 'T', - '\u1E6C': 'T', - '\u021A': 'T', - '\u0162': 'T', - '\u1E70': 'T', - '\u1E6E': 'T', - '\u0166': 'T', - '\u01AC': 'T', - '\u01AE': 'T', - '\u023E': 'T', - '\uA786': 'T', - '\uA728': 'TZ', - '\u24CA': 'U', - '\uFF35': 'U', - '\u00D9': 'U', - '\u00DA': 'U', - '\u00DB': 'U', - '\u0168': 'U', - '\u1E78': 'U', - '\u016A': 'U', - '\u1E7A': 'U', - '\u016C': 'U', - '\u00DC': 'U', - '\u01DB': 'U', - '\u01D7': 'U', - '\u01D5': 'U', - '\u01D9': 'U', - '\u1EE6': 'U', - '\u016E': 'U', - '\u0170': 'U', - '\u01D3': 'U', - '\u0214': 'U', - '\u0216': 'U', - '\u01AF': 'U', - '\u1EEA': 'U', - '\u1EE8': 'U', - '\u1EEE': 'U', - '\u1EEC': 'U', - '\u1EF0': 'U', - '\u1EE4': 'U', - '\u1E72': 'U', - '\u0172': 'U', - '\u1E76': 'U', - '\u1E74': 'U', - '\u0244': 'U', - '\u24CB': 'V', - '\uFF36': 'V', - '\u1E7C': 'V', - '\u1E7E': 'V', - '\u01B2': 'V', - '\uA75E': 'V', - '\u0245': 'V', - '\uA760': 'VY', - '\u24CC': 'W', - '\uFF37': 'W', - '\u1E80': 'W', - '\u1E82': 'W', - '\u0174': 'W', - '\u1E86': 'W', - '\u1E84': 'W', - '\u1E88': 'W', - '\u2C72': 'W', - '\u24CD': 'X', - '\uFF38': 'X', - '\u1E8A': 'X', - '\u1E8C': 'X', - '\u24CE': 'Y', - '\uFF39': 'Y', - '\u1EF2': 'Y', - '\u00DD': 'Y', - '\u0176': 'Y', - '\u1EF8': 'Y', - '\u0232': 'Y', - '\u1E8E': 'Y', - '\u0178': 'Y', - '\u1EF6': 'Y', - '\u1EF4': 'Y', - '\u01B3': 'Y', - '\u024E': 'Y', - '\u1EFE': 'Y', - '\u24CF': 'Z', - '\uFF3A': 'Z', - '\u0179': 'Z', - '\u1E90': 'Z', - '\u017B': 'Z', - '\u017D': 'Z', - '\u1E92': 'Z', - '\u1E94': 'Z', - '\u01B5': 'Z', - '\u0224': 'Z', - '\u2C7F': 'Z', - '\u2C6B': 'Z', - '\uA762': 'Z', - '\u24D0': 'a', - '\uFF41': 'a', - '\u1E9A': 'a', - '\u00E0': 'a', - '\u00E1': 'a', - '\u00E2': 'a', - '\u1EA7': 'a', - '\u1EA5': 'a', - '\u1EAB': 'a', - '\u1EA9': 'a', - '\u00E3': 'a', - '\u0101': 'a', - '\u0103': 'a', - '\u1EB1': 'a', - '\u1EAF': 'a', - '\u1EB5': 'a', - '\u1EB3': 'a', - '\u0227': 'a', - '\u01E1': 'a', - '\u00E4': 'a', - '\u01DF': 'a', - '\u1EA3': 'a', - '\u00E5': 'a', - '\u01FB': 'a', - '\u01CE': 'a', - '\u0201': 'a', - '\u0203': 'a', - '\u1EA1': 'a', - '\u1EAD': 'a', - '\u1EB7': 'a', - '\u1E01': 'a', - '\u0105': 'a', - '\u2C65': 'a', - '\u0250': 'a', - '\uA733': 'aa', - '\u00E6': 'ae', - '\u01FD': 'ae', - '\u01E3': 'ae', - '\uA735': 'ao', - '\uA737': 'au', - '\uA739': 'av', - '\uA73B': 'av', - '\uA73D': 'ay', - '\u24D1': 'b', - '\uFF42': 'b', - '\u1E03': 'b', - '\u1E05': 'b', - '\u1E07': 'b', - '\u0180': 'b', - '\u0183': 'b', - '\u0253': 'b', - '\u24D2': 'c', - '\uFF43': 'c', - '\u0107': 'c', - '\u0109': 'c', - '\u010B': 'c', - '\u010D': 'c', - '\u00E7': 'c', - '\u1E09': 'c', - '\u0188': 'c', - '\u023C': 'c', - '\uA73F': 'c', - '\u2184': 'c', - '\u24D3': 'd', - '\uFF44': 'd', - '\u1E0B': 'd', - '\u010F': 'd', - '\u1E0D': 'd', - '\u1E11': 'd', - '\u1E13': 'd', - '\u1E0F': 'd', - '\u0111': 'd', - '\u018C': 'd', - '\u0256': 'd', - '\u0257': 'd', - '\uA77A': 'd', - '\u01F3': 'dz', - '\u01C6': 'dz', - '\u24D4': 'e', - '\uFF45': 'e', - '\u00E8': 'e', - '\u00E9': 'e', - '\u00EA': 'e', - '\u1EC1': 'e', - '\u1EBF': 'e', - '\u1EC5': 'e', - '\u1EC3': 'e', - '\u1EBD': 'e', - '\u0113': 'e', - '\u1E15': 'e', - '\u1E17': 'e', - '\u0115': 'e', - '\u0117': 'e', - '\u00EB': 'e', - '\u1EBB': 'e', - '\u011B': 'e', - '\u0205': 'e', - '\u0207': 'e', - '\u1EB9': 'e', - '\u1EC7': 'e', - '\u0229': 'e', - '\u1E1D': 'e', - '\u0119': 'e', - '\u1E19': 'e', - '\u1E1B': 'e', - '\u0247': 'e', - '\u025B': 'e', - '\u01DD': 'e', - '\u24D5': 'f', - '\uFF46': 'f', - '\u1E1F': 'f', - '\u0192': 'f', - '\uA77C': 'f', - '\u24D6': 'g', - '\uFF47': 'g', - '\u01F5': 'g', - '\u011D': 'g', - '\u1E21': 'g', - '\u011F': 'g', - '\u0121': 'g', - '\u01E7': 'g', - '\u0123': 'g', - '\u01E5': 'g', - '\u0260': 'g', - '\uA7A1': 'g', - '\u1D79': 'g', - '\uA77F': 'g', - '\u24D7': 'h', - '\uFF48': 'h', - '\u0125': 'h', - '\u1E23': 'h', - '\u1E27': 'h', - '\u021F': 'h', - '\u1E25': 'h', - '\u1E29': 'h', - '\u1E2B': 'h', - '\u1E96': 'h', - '\u0127': 'h', - '\u2C68': 'h', - '\u2C76': 'h', - '\u0265': 'h', - '\u0195': 'hv', - '\u24D8': 'i', - '\uFF49': 'i', - '\u00EC': 'i', - '\u00ED': 'i', - '\u00EE': 'i', - '\u0129': 'i', - '\u012B': 'i', - '\u012D': 'i', - '\u00EF': 'i', - '\u1E2F': 'i', - '\u1EC9': 'i', - '\u01D0': 'i', - '\u0209': 'i', - '\u020B': 'i', - '\u1ECB': 'i', - '\u012F': 'i', - '\u1E2D': 'i', - '\u0268': 'i', - '\u0131': 'i', - '\u24D9': 'j', - '\uFF4A': 'j', - '\u0135': 'j', - '\u01F0': 'j', - '\u0249': 'j', - '\u24DA': 'k', - '\uFF4B': 'k', - '\u1E31': 'k', - '\u01E9': 'k', - '\u1E33': 'k', - '\u0137': 'k', - '\u1E35': 'k', - '\u0199': 'k', - '\u2C6A': 'k', - '\uA741': 'k', - '\uA743': 'k', - '\uA745': 'k', - '\uA7A3': 'k', - '\u24DB': 'l', - '\uFF4C': 'l', - '\u0140': 'l', - '\u013A': 'l', - '\u013E': 'l', - '\u1E37': 'l', - '\u1E39': 'l', - '\u013C': 'l', - '\u1E3D': 'l', - '\u1E3B': 'l', - '\u017F': 'l', - '\u0142': 'l', - '\u019A': 'l', - '\u026B': 'l', - '\u2C61': 'l', - '\uA749': 'l', - '\uA781': 'l', - '\uA747': 'l', - '\u01C9': 'lj', - '\u24DC': 'm', - '\uFF4D': 'm', - '\u1E3F': 'm', - '\u1E41': 'm', - '\u1E43': 'm', - '\u0271': 'm', - '\u026F': 'm', - '\u24DD': 'n', - '\uFF4E': 'n', - '\u01F9': 'n', - '\u0144': 'n', - '\u00F1': 'n', - '\u1E45': 'n', - '\u0148': 'n', - '\u1E47': 'n', - '\u0146': 'n', - '\u1E4B': 'n', - '\u1E49': 'n', - '\u019E': 'n', - '\u0272': 'n', - '\u0149': 'n', - '\uA791': 'n', - '\uA7A5': 'n', - '\u01CC': 'nj', - '\u24DE': 'o', - '\uFF4F': 'o', - '\u00F2': 'o', - '\u00F3': 'o', - '\u00F4': 'o', - '\u1ED3': 'o', - '\u1ED1': 'o', - '\u1ED7': 'o', - '\u1ED5': 'o', - '\u00F5': 'o', - '\u1E4D': 'o', - '\u022D': 'o', - '\u1E4F': 'o', - '\u014D': 'o', - '\u1E51': 'o', - '\u1E53': 'o', - '\u014F': 'o', - '\u022F': 'o', - '\u0231': 'o', - '\u00F6': 'o', - '\u022B': 'o', - '\u1ECF': 'o', - '\u0151': 'o', - '\u01D2': 'o', - '\u020D': 'o', - '\u020F': 'o', - '\u01A1': 'o', - '\u1EDD': 'o', - '\u1EDB': 'o', - '\u1EE1': 'o', - '\u1EDF': 'o', - '\u1EE3': 'o', - '\u1ECD': 'o', - '\u1ED9': 'o', - '\u01EB': 'o', - '\u01ED': 'o', - '\u00F8': 'o', - '\u01FF': 'o', - '\u0254': 'o', - '\uA74B': 'o', - '\uA74D': 'o', - '\u0275': 'o', - '\u01A3': 'oi', - '\u0223': 'ou', - '\uA74F': 'oo', - '\u24DF': 'p', - '\uFF50': 'p', - '\u1E55': 'p', - '\u1E57': 'p', - '\u01A5': 'p', - '\u1D7D': 'p', - '\uA751': 'p', - '\uA753': 'p', - '\uA755': 'p', - '\u24E0': 'q', - '\uFF51': 'q', - '\u024B': 'q', - '\uA757': 'q', - '\uA759': 'q', - '\u24E1': 'r', - '\uFF52': 'r', - '\u0155': 'r', - '\u1E59': 'r', - '\u0159': 'r', - '\u0211': 'r', - '\u0213': 'r', - '\u1E5B': 'r', - '\u1E5D': 'r', - '\u0157': 'r', - '\u1E5F': 'r', - '\u024D': 'r', - '\u027D': 'r', - '\uA75B': 'r', - '\uA7A7': 'r', - '\uA783': 'r', - '\u24E2': 's', - '\uFF53': 's', - '\u00DF': 's', - '\u015B': 's', - '\u1E65': 's', - '\u015D': 's', - '\u1E61': 's', - '\u0161': 's', - '\u1E67': 's', - '\u1E63': 's', - '\u1E69': 's', - '\u0219': 's', - '\u015F': 's', - '\u023F': 's', - '\uA7A9': 's', - '\uA785': 's', - '\u1E9B': 's', - '\u24E3': 't', - '\uFF54': 't', - '\u1E6B': 't', - '\u1E97': 't', - '\u0165': 't', - '\u1E6D': 't', - '\u021B': 't', - '\u0163': 't', - '\u1E71': 't', - '\u1E6F': 't', - '\u0167': 't', - '\u01AD': 't', - '\u0288': 't', - '\u2C66': 't', - '\uA787': 't', - '\uA729': 'tz', - '\u24E4': 'u', - '\uFF55': 'u', - '\u00F9': 'u', - '\u00FA': 'u', - '\u00FB': 'u', - '\u0169': 'u', - '\u1E79': 'u', - '\u016B': 'u', - '\u1E7B': 'u', - '\u016D': 'u', - '\u00FC': 'u', - '\u01DC': 'u', - '\u01D8': 'u', - '\u01D6': 'u', - '\u01DA': 'u', - '\u1EE7': 'u', - '\u016F': 'u', - '\u0171': 'u', - '\u01D4': 'u', - '\u0215': 'u', - '\u0217': 'u', - '\u01B0': 'u', - '\u1EEB': 'u', - '\u1EE9': 'u', - '\u1EEF': 'u', - '\u1EED': 'u', - '\u1EF1': 'u', - '\u1EE5': 'u', - '\u1E73': 'u', - '\u0173': 'u', - '\u1E77': 'u', - '\u1E75': 'u', - '\u0289': 'u', - '\u24E5': 'v', - '\uFF56': 'v', - '\u1E7D': 'v', - '\u1E7F': 'v', - '\u028B': 'v', - '\uA75F': 'v', - '\u028C': 'v', - '\uA761': 'vy', - '\u24E6': 'w', - '\uFF57': 'w', - '\u1E81': 'w', - '\u1E83': 'w', - '\u0175': 'w', - '\u1E87': 'w', - '\u1E85': 'w', - '\u1E98': 'w', - '\u1E89': 'w', - '\u2C73': 'w', - '\u24E7': 'x', - '\uFF58': 'x', - '\u1E8B': 'x', - '\u1E8D': 'x', - '\u24E8': 'y', - '\uFF59': 'y', - '\u1EF3': 'y', - '\u00FD': 'y', - '\u0177': 'y', - '\u1EF9': 'y', - '\u0233': 'y', - '\u1E8F': 'y', - '\u00FF': 'y', - '\u1EF7': 'y', - '\u1E99': 'y', - '\u1EF5': 'y', - '\u01B4': 'y', - '\u024F': 'y', - '\u1EFF': 'y', - '\u24E9': 'z', - '\uFF5A': 'z', - '\u017A': 'z', - '\u1E91': 'z', - '\u017C': 'z', - '\u017E': 'z', - '\u1E93': 'z', - '\u1E95': 'z', - '\u01B6': 'z', - '\u0225': 'z', - '\u0240': 'z', - '\u2C6C': 'z', - '\uA763': 'z', - '\u0386': '\u0391', - '\u0388': '\u0395', - '\u0389': '\u0397', - '\u038A': '\u0399', - '\u03AA': '\u0399', - '\u038C': '\u039F', - '\u038E': '\u03A5', - '\u03AB': '\u03A5', - '\u038F': '\u03A9', - '\u03AC': '\u03B1', - '\u03AD': '\u03B5', - '\u03AE': '\u03B7', - '\u03AF': '\u03B9', - '\u03CA': '\u03B9', - '\u0390': '\u03B9', - '\u03CC': '\u03BF', - '\u03CD': '\u03C5', - '\u03CB': '\u03C5', - '\u03B0': '\u03C5', - '\u03C9': '\u03C9', - '\u03C2': '\u03C3' - }; - - return diacritics; -}); - -define('select2/data/base',[ - '../utils' -], function (Utils) { - function BaseAdapter ($element, options) { - BaseAdapter.__super__.constructor.call(this); - } - - Utils.Extend(BaseAdapter, Utils.Observable); - - BaseAdapter.prototype.current = function (callback) { - throw new Error('The `current` method must be defined in child classes.'); - }; - - BaseAdapter.prototype.query = function (params, callback) { - throw new Error('The `query` method must be defined in child classes.'); - }; - - BaseAdapter.prototype.bind = function (container, $container) { - // Can be implemented in subclasses - }; - - BaseAdapter.prototype.destroy = function () { - // Can be implemented in subclasses - }; - - BaseAdapter.prototype.generateResultId = function (container, data) { - var id = container.id + '-result-'; - - id += Utils.generateChars(4); - - if (data.id != null) { - id += '-' + data.id.toString(); - } else { - id += '-' + Utils.generateChars(4); - } - return id; - }; - - return BaseAdapter; -}); - -define('select2/data/select',[ - './base', - '../utils', - 'jquery' -], function (BaseAdapter, Utils, $) { - function SelectAdapter ($element, options) { - this.$element = $element; - this.options = options; - - SelectAdapter.__super__.constructor.call(this); - } - - Utils.Extend(SelectAdapter, BaseAdapter); - - SelectAdapter.prototype.current = function (callback) { - var data = []; - var self = this; - - this.$element.find(':selected').each(function () { - var $option = $(this); - - var option = self.item($option); - - data.push(option); - }); - - callback(data); - }; - - SelectAdapter.prototype.select = function (data) { - var self = this; - - // If data.element is a DOM nose, use it instead - if ($(data.element).is('option')) { - data.element.selected = true; - - this.$element.trigger('change'); - - return; - } - - if (this.$element.prop('multiple')) { - this.current(function (currentData) { - var val = []; - - data = [data]; - data.push.apply(data, currentData); - - for (var d = 0; d < data.length; d++) { - var id = data[d].id; - - if ($.inArray(id, val) === -1) { - val.push(id); - } - } - - self.$element.val(val); - self.$element.trigger('change'); - }); - } else { - var val = data.id; - - this.$element.val(val); - this.$element.trigger('change'); - } - }; - - SelectAdapter.prototype.unselect = function (data) { - var self = this; - - if (!this.$element.prop('multiple')) { - return; - } - - if ($(data.element).is('option')) { - data.element.selected = false; - - this.$element.trigger('change'); - - return; - } - - this.current(function (currentData) { - var val = []; - - for (var d = 0; d < currentData.length; d++) { - var id = currentData[d].id; - - if (id !== data.id && $.inArray(id, val) === -1) { - val.push(id); - } - } - - self.$element.val(val); - - self.$element.trigger('change'); - }); - }; - - SelectAdapter.prototype.bind = function (container, $container) { - var self = this; - - this.container = container; - - container.on('select', function (params) { - self.select(params.data); - }); - - container.on('unselect', function (params) { - self.unselect(params.data); - }); - }; - - SelectAdapter.prototype.destroy = function () { - // Remove anything added to child elements - this.$element.find('*').each(function () { - // Remove any custom data set by Select2 - $.removeData(this, 'data'); - }); - }; - - SelectAdapter.prototype.query = function (params, callback) { - var data = []; - var self = this; - - var $options = this.$element.children(); - - $options.each(function () { - var $option = $(this); - - if (!$option.is('option') && !$option.is('optgroup')) { - return; - } - - var option = self.item($option); - - var matches = self.matches(params, option); - - if (matches !== null) { - data.push(matches); - } - }); - - callback({ - results: data - }); - }; - - SelectAdapter.prototype.addOptions = function ($options) { - this.$element.append($options); - }; - - SelectAdapter.prototype.option = function (data) { - var option; - - if (data.children) { - option = document.createElement('optgroup'); - option.label = data.text; - } else { - option = document.createElement('option'); - - if (option.textContent !== undefined) { - option.textContent = data.text; - } else { - option.innerText = data.text; - } - } - - if (data.id) { - option.value = data.id; - } - - if (data.disabled) { - option.disabled = true; - } - - if (data.selected) { - option.selected = true; - } - - if (data.title) { - option.title = data.title; - } - - var $option = $(option); - - var normalizedData = this._normalizeItem(data); - normalizedData.element = option; - - // Override the option's data with the combined data - $.data(option, 'data', normalizedData); - - return $option; - }; - - SelectAdapter.prototype.item = function ($option) { - var data = {}; - - data = $.data($option[0], 'data'); - - if (data != null) { - return data; - } - - if ($option.is('option')) { - data = { - id: $option.val(), - text: $option.html(), - disabled: $option.prop('disabled'), - selected: $option.prop('selected'), - title: $option.prop('title') - }; - } else if ($option.is('optgroup')) { - data = { - text: $option.prop('label'), - children: [], - title: $option.prop('title') - }; - - var $children = $option.children('option'); - var children = []; - - for (var c = 0; c < $children.length; c++) { - var $child = $($children[c]); - - var child = this.item($child); - - children.push(child); - } - - data.children = children; - } - - data = this._normalizeItem(data); - data.element = $option[0]; - - $.data($option[0], 'data', data); - - return data; - }; - - SelectAdapter.prototype._normalizeItem = function (item) { - if (!$.isPlainObject(item)) { - item = { - id: item, - text: item - }; - } - - item = $.extend({}, { - text: '' - }, item); - - var defaults = { - selected: false, - disabled: false - }; - - if (item.id != null) { - item.id = item.id.toString(); - } - - if (item.text != null) { - item.text = item.text.toString(); - } - - if (item._resultId == null && item.id && this.container != null) { - item._resultId = this.generateResultId(this.container, item); - } - - return $.extend({}, defaults, item); - }; - - SelectAdapter.prototype.matches = function (params, data) { - var matcher = this.options.get('matcher'); - - return matcher(params, data); - }; - - return SelectAdapter; -}); - -define('select2/data/array',[ - './select', - '../utils', - 'jquery' -], function (SelectAdapter, Utils, $) { - function ArrayAdapter ($element, options) { - var data = options.get('data') || []; - - ArrayAdapter.__super__.constructor.call(this, $element, options); - - this.addOptions(this.convertToOptions(data)); - } - - Utils.Extend(ArrayAdapter, SelectAdapter); - - ArrayAdapter.prototype.select = function (data) { - var $option = this.$element.find('option[value="' + data.id + '"]'); - - if ($option.length === 0) { - $option = this.option(data); - - this.addOptions([$option]); - } - - ArrayAdapter.__super__.select.call(this, data); - }; - - ArrayAdapter.prototype.convertToOptions = function (data) { - var self = this; - - var $existing = this.$element.find('option'); - var existingIds = $existing.map(function () { - return self.item($(this)).id; - }).get(); - - var $options = []; - - // Filter out all items except for the one passed in the argument - function onlyItem (item) { - return function () { - return $(this).val() == item.id; - }; - } - - for (var d = 0; d < data.length; d++) { - var item = this._normalizeItem(data[d]); - - // Skip items which were pre-loaded, only merge the data - if ($.inArray(item.id, existingIds) >= 0) { - var $existingOption = $existing.filter(onlyItem(item)); - - var existingData = this.item($existingOption); - var newData = $.extend(true, {}, existingData, item); - - var $newOption = this.option(existingData); - - $existingOption.replaceWith($newOption); - - continue; - } - - var $option = this.option(item); - - if (item.children) { - var $children = this.convertToOptions(item.children); - - $option.append($children); - } - - $options.push($option); - } - - return $options; - }; - - return ArrayAdapter; -}); - -define('select2/data/ajax',[ - './array', - '../utils', - 'jquery' -], function (ArrayAdapter, Utils, $) { - function AjaxAdapter ($element, options) { - this.ajaxOptions = this._applyDefaults(options.get('ajax')); - - if (this.ajaxOptions.processResults != null) { - this.processResults = this.ajaxOptions.processResults; - } - - ArrayAdapter.__super__.constructor.call(this, $element, options); - } - - Utils.Extend(AjaxAdapter, ArrayAdapter); - - AjaxAdapter.prototype._applyDefaults = function (options) { - var defaults = { - data: function (params) { - return { - q: params.term - }; - }, - transport: function (params, success, failure) { - var $request = $.ajax(params); - - $request.then(success); - $request.fail(failure); - - return $request; - } - }; - - return $.extend({}, defaults, options, true); - }; - - AjaxAdapter.prototype.processResults = function (results) { - return results; - }; - - AjaxAdapter.prototype.query = function (params, callback) { - var matches = []; - var self = this; - - if (this._request) { - this._request.abort(); - this._request = null; - } - - var options = $.extend({ - type: 'GET' - }, this.ajaxOptions); - - if (typeof options.url === 'function') { - options.url = options.url(params); - } - - if (typeof options.data === 'function') { - options.data = options.data(params); - } - - function request () { - var $request = options.transport(options, function (data) { - var results = self.processResults(data, params); - - if (window.console && console.error) { - // Check to make sure that the response included a `results` key. - if (!results || !results.results || !$.isArray(results.results)) { - console.error( - 'Select2: The AJAX results did not return an array in the ' + - '`results` key of the response.' - ); - } - } - - callback(results); - }, function () { - // TODO: Handle AJAX errors - }); - - self._request = $request; - } - - if (this.ajaxOptions.delay && params.term !== '') { - if (this._queryTimeout) { - window.clearTimeout(this._queryTimeout); - } - - this._queryTimeout = window.setTimeout(request, this.ajaxOptions.delay); - } else { - request(); - } - }; - - return AjaxAdapter; -}); - -define('select2/data/tags',[ - 'jquery' -], function ($) { - function Tags (decorated, $element, options) { - var tags = options.get('tags'); - - var createTag = options.get('createTag'); - - if (createTag !== undefined) { - this.createTag = createTag; - } - - decorated.call(this, $element, options); - - if ($.isArray(tags)) { - for (var t = 0; t < tags.length; t++) { - var tag = tags[t]; - var item = this._normalizeItem(tag); - - var $option = this.option(item); - - this.$element.append($option); - } - } - } - - Tags.prototype.query = function (decorated, params, callback) { - var self = this; - - this._removeOldTags(); - - if (params.term == null || params.term === '' || params.page != null) { - decorated.call(this, params, callback); - return; - } - - function wrapper (obj, child) { - var data = obj.results; - - for (var i = 0; i < data.length; i++) { - var option = data[i]; - - var checkChildren = ( - option.children != null && - !wrapper({ - results: option.children - }, true) - ); - - var checkText = option.text === params.term; - - if (checkText || checkChildren) { - if (child) { - return false; - } - - obj.data = data; - callback(obj); - - return; - } - } - - if (child) { - return true; - } - - var tag = self.createTag(params); - - if (tag != null) { - var $option = self.option(tag); - $option.attr('data-select2-tag', true); - - self.addOptions([$option]); - - self.insertTag(data, tag); - } - - obj.results = data; - - callback(obj); - } - - decorated.call(this, params, wrapper); - }; - - Tags.prototype.createTag = function (decorated, params) { - return { - id: params.term, - text: params.term - }; - }; - - Tags.prototype.insertTag = function (_, data, tag) { - data.unshift(tag); - }; - - Tags.prototype._removeOldTags = function (_) { - var tag = this._lastTag; - - var $options = this.$element.find('option[data-select2-tag]'); - - $options.each(function () { - if (this.selected) { - return; - } - - $(this).remove(); - }); - }; - - return Tags; -}); - -define('select2/data/tokenizer',[ - 'jquery' -], function ($) { - function Tokenizer (decorated, $element, options) { - var tokenizer = options.get('tokenizer'); - - if (tokenizer !== undefined) { - this.tokenizer = tokenizer; - } - - decorated.call(this, $element, options); - } - - Tokenizer.prototype.bind = function (decorated, container, $container) { - decorated.call(this, container, $container); - - this.$search = container.dropdown.$search || container.selection.$search || - $container.find('.select2-search__field'); - }; - - Tokenizer.prototype.query = function (decorated, params, callback) { - var self = this; - - function select (data) { - self.select(data); - } - - params.term = params.term || ''; - - var tokenData = this.tokenizer(params, this.options, select); - - if (tokenData.term !== params.term) { - // Replace the search term if we have the search box - if (this.$search.length) { - this.$search.val(tokenData.term); - this.$search.focus(); - } - - params.term = tokenData.term; - } - - decorated.call(this, params, callback); - }; - - Tokenizer.prototype.tokenizer = function (_, params, options, callback) { - var separators = options.get('tokenSeparators') || []; - var term = params.term; - var i = 0; - - var createTag = this.createTag || function (params) { - return { - id: params.term, - text: params.term - }; - }; - - while (i < term.length) { - var termChar = term[i]; - - if ($.inArray(termChar, separators) === -1) { - i++; - - continue; - } - - var part = term.substr(0, i); - var partParams = $.extend({}, params, { - term: part - }); - - var data = createTag(partParams); - - callback(data); - - // Reset the term to not include the tokenized portion - term = term.substr(i + 1) || ''; - i = 0; - } - - return { - term: term - }; - }; - - return Tokenizer; -}); - -define('select2/data/minimumInputLength',[ - -], function () { - function MinimumInputLength (decorated, $e, options) { - this.minimumInputLength = options.get('minimumInputLength'); - - decorated.call(this, $e, options); - } - - MinimumInputLength.prototype.query = function (decorated, params, callback) { - params.term = params.term || ''; - - if (params.term.length < this.minimumInputLength) { - this.trigger('results:message', { - message: 'inputTooShort', - args: { - minimum: this.minimumInputLength, - input: params.term, - params: params - } - }); - - return; - } - - decorated.call(this, params, callback); - }; - - return MinimumInputLength; -}); - -define('select2/data/maximumInputLength',[ - -], function () { - function MaximumInputLength (decorated, $e, options) { - this.maximumInputLength = options.get('maximumInputLength'); - - decorated.call(this, $e, options); - } - - MaximumInputLength.prototype.query = function (decorated, params, callback) { - params.term = params.term || ''; - - if (this.maximumInputLength > 0 && - params.term.length > this.maximumInputLength) { - this.trigger('results:message', { - message: 'inputTooLong', - args: { - maximum: this.maximumInputLength, - input: params.term, - params: params - } - }); - - return; - } - - decorated.call(this, params, callback); - }; - - return MaximumInputLength; -}); - -define('select2/data/maximumSelectionLength',[ - -], function (){ - function MaximumSelectionLength (decorated, $e, options) { - this.maximumSelectionLength = options.get('maximumSelectionLength'); - - decorated.call(this, $e, options); - } - - MaximumSelectionLength.prototype.query = - function (decorated, params, callback) { - var self = this; - - this.current(function (currentData) { - var count = currentData != null ? currentData.length : 0; - if (self.maximumSelectionLength > 0 && - count >= self.maximumSelectionLength) { - self.trigger('results:message', { - message: 'maximumSelected', - args: { - maximum: self.maximumSelectionLength - } - }); - return; - } - decorated.call(self, params, callback); - }); - }; - - return MaximumSelectionLength; -}); - -define('select2/dropdown',[ - 'jquery', - './utils' -], function ($, Utils) { - function Dropdown ($element, options) { - this.$element = $element; - this.options = options; - - Dropdown.__super__.constructor.call(this); - } - - Utils.Extend(Dropdown, Utils.Observable); - - Dropdown.prototype.render = function () { - var $dropdown = $( - '<span class="select2-dropdown">' + - '<span class="select2-results"></span>' + - '</span>' - ); - - $dropdown.attr('dir', this.options.get('dir')); - - this.$dropdown = $dropdown; - - return $dropdown; - }; - - Dropdown.prototype.position = function ($dropdown, $container) { - // Should be implmented in subclasses - }; - - Dropdown.prototype.destroy = function () { - // Remove the dropdown from the DOM - this.$dropdown.remove(); - }; - - return Dropdown; -}); - -define('select2/dropdown/search',[ - 'jquery', - '../utils' -], function ($, Utils) { - function Search () { } - - Search.prototype.render = function (decorated) { - var $rendered = decorated.call(this); - - var $search = $( - '<span class="select2-search select2-search--dropdown">' + - '<input class="select2-search__field" type="search" tabindex="-1"' + - ' autocomplete="off" autocorrect="off" autocapitalize="off"' + - ' spellcheck="false" role="textbox" />' + - '</span>' - ); - - this.$searchContainer = $search; - this.$search = $search.find('input'); - - $rendered.prepend($search); - - return $rendered; - }; - - Search.prototype.bind = function (decorated, container, $container) { - var self = this; - - decorated.call(this, container, $container); - - this.$search.on('keydown', function (evt) { - self.trigger('keypress', evt); - - self._keyUpPrevented = evt.isDefaultPrevented(); - }); - - // Workaround for browsers which do not support the `input` event - // This will prevent double-triggering of events for browsers which support - // both the `keyup` and `input` events. - this.$search.on('input', function (evt) { - // Unbind the duplicated `keyup` event - $(this).off('keyup'); - }); - - this.$search.on('keyup input', function (evt) { - self.handleSearch(evt); - }); - - container.on('open', function () { - self.$search.attr('tabindex', 0); - - self.$search.focus(); - - window.setTimeout(function () { - self.$search.focus(); - }, 0); - }); - - container.on('close', function () { - self.$search.attr('tabindex', -1); - - self.$search.val(''); - }); - - container.on('results:all', function (params) { - if (params.query.term == null || params.query.term === '') { - var showSearch = self.showSearch(params); - - if (showSearch) { - self.$searchContainer.removeClass('select2-search--hide'); - } else { - self.$searchContainer.addClass('select2-search--hide'); - } - } - }); - }; - - Search.prototype.handleSearch = function (evt) { - if (!this._keyUpPrevented) { - var input = this.$search.val(); - - this.trigger('query', { - term: input - }); - } - - this._keyUpPrevented = false; - }; - - Search.prototype.showSearch = function (_, params) { - return true; - }; - - return Search; -}); - -define('select2/dropdown/hidePlaceholder',[ - -], function () { - function HidePlaceholder (decorated, $element, options, dataAdapter) { - this.placeholder = this.normalizePlaceholder(options.get('placeholder')); - - decorated.call(this, $element, options, dataAdapter); - } - - HidePlaceholder.prototype.append = function (decorated, data) { - data.results = this.removePlaceholder(data.results); - - decorated.call(this, data); - }; - - HidePlaceholder.prototype.normalizePlaceholder = function (_, placeholder) { - if (typeof placeholder === 'string') { - placeholder = { - id: '', - text: placeholder - }; - } - - return placeholder; - }; - - HidePlaceholder.prototype.removePlaceholder = function (_, data) { - var modifiedData = data.slice(0); - - for (var d = data.length - 1; d >= 0; d--) { - var item = data[d]; - - if (this.placeholder.id === item.id) { - modifiedData.splice(d, 1); - } - } - - return modifiedData; - }; - - return HidePlaceholder; -}); - -define('select2/dropdown/infiniteScroll',[ - 'jquery' -], function ($) { - function InfiniteScroll (decorated, $element, options, dataAdapter) { - this.lastParams = {}; - - decorated.call(this, $element, options, dataAdapter); - - this.$loadingMore = this.createLoadingMore(); - this.loading = false; - } - - InfiniteScroll.prototype.append = function (decorated, data) { - this.$loadingMore.remove(); - this.loading = false; - - decorated.call(this, data); - - if (this.showLoadingMore(data)) { - this.$results.append(this.$loadingMore); - } - }; - - InfiniteScroll.prototype.bind = function (decorated, container, $container) { - var self = this; - - decorated.call(this, container, $container); - - container.on('query', function (params) { - self.lastParams = params; - self.loading = true; - }); - - container.on('query:append', function (params) { - self.lastParams = params; - self.loading = true; - }); - - this.$results.on('scroll', function () { - var isLoadMoreVisible = $.contains( - document.documentElement, - self.$loadingMore[0] - ); - - if (self.loading || !isLoadMoreVisible) { - return; - } - - var currentOffset = self.$results.offset().top + - self.$results.outerHeight(false); - var loadingMoreOffset = self.$loadingMore.offset().top + - self.$loadingMore.outerHeight(false); - - if (currentOffset + 50 >= loadingMoreOffset) { - self.loadMore(); - } - }); - }; - - InfiniteScroll.prototype.loadMore = function () { - this.loading = true; - - var params = $.extend({}, {page: 1}, this.lastParams); - - params.page++; - - this.trigger('query:append', params); - }; - - InfiniteScroll.prototype.showLoadingMore = function (_, data) { - return data.pagination && data.pagination.more; - }; - - InfiniteScroll.prototype.createLoadingMore = function () { - var $option = $( - '<li class="option load-more" role="treeitem"></li>' - ); - - var message = this.options.get('translations').get('loadingMore'); - - $option.html(message(this.lastParams)); - - return $option; - }; - - return InfiniteScroll; -}); - -define('select2/dropdown/attachBody',[ - 'jquery', - '../utils' -], function ($, Utils) { - function AttachBody (decorated, $element, options) { - this.$dropdownParent = options.get('dropdownParent') || document.body; - - decorated.call(this, $element, options); - } - - AttachBody.prototype.bind = function (decorated, container, $container) { - var self = this; - - var setupResultsEvents = false; - - decorated.call(this, container, $container); - - container.on('open', function () { - self._showDropdown(); - self._attachPositioningHandler(container); - - if (!setupResultsEvents) { - setupResultsEvents = true; - - container.on('results:all', function () { - self._positionDropdown(); - self._resizeDropdown(); - }); - - container.on('results:append', function () { - self._positionDropdown(); - self._resizeDropdown(); - }); - } - }); - - container.on('close', function () { - self._hideDropdown(); - self._detachPositioningHandler(container); - }); - - this.$dropdownContainer.on('mousedown', function (evt) { - evt.stopPropagation(); - }); - }; - - AttachBody.prototype.position = function (decorated, $dropdown, $container) { - // Clone all of the container classes - $dropdown.attr('class', $container.attr('class')); - - $dropdown.removeClass('select2'); - $dropdown.addClass('select2-container--open'); - - $dropdown.css({ - position: 'absolute', - top: -999999 - }); - - this.$container = $container; - }; - - AttachBody.prototype.render = function (decorated) { - var $container = $('<span></span>'); - - var $dropdown = decorated.call(this); - $container.append($dropdown); - - this.$dropdownContainer = $container; - - return $container; - }; - - AttachBody.prototype._hideDropdown = function (decorated) { - this.$dropdownContainer.detach(); - }; - - AttachBody.prototype._attachPositioningHandler = function (container) { - var self = this; - - var scrollEvent = 'scroll.select2.' + container.id; - var resizeEvent = 'resize.select2.' + container.id; - var orientationEvent = 'orientationchange.select2.' + container.id; - - var $watchers = this.$container.parents().filter(Utils.hasScroll); - $watchers.each(function () { - $(this).data('select2-scroll-position', { - x: $(this).scrollLeft(), - y: $(this).scrollTop() - }); - }); - - $watchers.on(scrollEvent, function (ev) { - var position = $(this).data('select2-scroll-position'); - $(this).scrollTop(position.y); - }); - - $(window).on(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent, - function (e) { - self._positionDropdown(); - self._resizeDropdown(); - }); - }; - - AttachBody.prototype._detachPositioningHandler = function (container) { - var scrollEvent = 'scroll.select2.' + container.id; - var resizeEvent = 'resize.select2.' + container.id; - var orientationEvent = 'orientationchange.select2.' + container.id; - - var $watchers = this.$container.parents().filter(Utils.hasScroll); - $watchers.off(scrollEvent); - - $(window).off(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent); - }; - - AttachBody.prototype._positionDropdown = function () { - var $window = $(window); - - var isCurrentlyAbove = this.$dropdown.hasClass('select2-dropdown--above'); - var isCurrentlyBelow = this.$dropdown.hasClass('select2-dropdown--below'); - - var newDirection = null; - - var position = this.$container.position(); - var offset = this.$container.offset(); - - offset.bottom = offset.top + this.$container.outerHeight(false); - - var container = { - height: this.$container.outerHeight(false) - }; - - container.top = offset.top; - container.bottom = offset.top + container.height; - - var dropdown = { - height: this.$dropdown.outerHeight(false) - }; - - var viewport = { - top: $window.scrollTop(), - bottom: $window.scrollTop() + $window.height() - }; - - var enoughRoomAbove = viewport.top < (offset.top - dropdown.height); - var enoughRoomBelow = viewport.bottom > (offset.bottom + dropdown.height); - - var css = { - left: offset.left, - top: container.bottom - }; - - if (!isCurrentlyAbove && !isCurrentlyBelow) { - newDirection = 'below'; - } - - if (!enoughRoomBelow && enoughRoomAbove && !isCurrentlyAbove) { - newDirection = 'above'; - } else if (!enoughRoomAbove && enoughRoomBelow && isCurrentlyAbove) { - newDirection = 'below'; - } - - if (newDirection == 'above' || - (isCurrentlyAbove && newDirection !== 'below')) { - css.top = container.top - dropdown.height; - } - - if (newDirection != null) { - this.$dropdown - .removeClass('select2-dropdown--below select2-dropdown--above') - .addClass('select2-dropdown--' + newDirection); - this.$container - .removeClass('select2-container--below select2-container--above') - .addClass('select2-container--' + newDirection); - } - - this.$dropdownContainer.css(css); - }; - - AttachBody.prototype._resizeDropdown = function () { - this.$dropdownContainer.width(); - - this.$dropdown.css({ - width: this.$container.outerWidth(false) + 'px' - }); - }; - - AttachBody.prototype._showDropdown = function (decorated) { - this.$dropdownContainer.appendTo(this.$dropdownParent); - - this._positionDropdown(); - this._resizeDropdown(); - }; - - return AttachBody; -}); - -define('select2/dropdown/minimumResultsForSearch',[ - -], function () { - function countResults (data) { - var count = 0; - - for (var d = 0; d < data.length; d++) { - var item = data[d]; - - if (item.children) { - count += countResults(item.children); - } else { - count++; - } - } - - return count; - } - - function MinimumResultsForSearch (decorated, $element, options, dataAdapter) { - this.minimumResultsForSearch = options.get('minimumResultsForSearch'); - - if (this.minimumResultsForSearch < 0) { - this.minimumResultsForSearch = Infinity; - } - - decorated.call(this, $element, options, dataAdapter); - } - - MinimumResultsForSearch.prototype.showSearch = function (decorated, params) { - if (countResults(params.data.results) < this.minimumResultsForSearch) { - return false; - } - - return decorated.call(this, params); - }; - - return MinimumResultsForSearch; -}); - -define('select2/dropdown/selectOnClose',[ - -], function () { - function SelectOnClose () { } - - SelectOnClose.prototype.bind = function (decorated, container, $container) { - var self = this; - - decorated.call(this, container, $container); - - container.on('close', function () { - self._handleSelectOnClose(); - }); - }; - - SelectOnClose.prototype._handleSelectOnClose = function () { - var $highlightedResults = this.getHighlightedResults(); - - if ($highlightedResults.length < 1) { - return; - } - - $highlightedResults.trigger('mouseup'); - }; - - return SelectOnClose; -}); - -define('select2/dropdown/closeOnSelect',[ - -], function () { - function CloseOnSelect () { } - - CloseOnSelect.prototype.bind = function (decorated, container, $container) { - var self = this; - - decorated.call(this, container, $container); - - container.on('select', function (evt) { - self._selectTriggered(evt); - }); - - container.on('unselect', function (evt) { - self._selectTriggered(evt); - }); - }; - - CloseOnSelect.prototype._selectTriggered = function (_, evt) { - var originalEvent = evt.originalEvent; - - // Don't close if the control key is being held - if (originalEvent && originalEvent.ctrlKey) { - return; - } - - this.trigger('close'); - }; - - return CloseOnSelect; -}); - -define('select2/i18n/en',[],function () { - // English - return { - errorLoading: function () { - return 'The results could not be loaded.'; - }, - inputTooLong: function (args) { - var overChars = args.input.length - args.maximum; - - var message = 'Please delete ' + overChars + ' character'; - - if (overChars != 1) { - message += 's'; - } - - return message; - }, - inputTooShort: function (args) { - var remainingChars = args.minimum - args.input.length; - - var message = 'Please enter ' + remainingChars + ' or more characters'; - - return message; - }, - loadingMore: function () { - return 'Loading more results…'; - }, - maximumSelected: function (args) { - var message = 'You can only select ' + args.maximum + ' item'; - - if (args.maximum != 1) { - message += 's'; - } - - return message; - }, - noResults: function () { - return 'No results found'; - }, - searching: function () { - return 'Searching…'; - } - }; -}); - -define('select2/defaults',[ - 'jquery', - './results', - - './selection/single', - './selection/multiple', - './selection/placeholder', - './selection/allowClear', - './selection/search', - './selection/eventRelay', - - './utils', - './translation', - './diacritics', - - './data/select', - './data/array', - './data/ajax', - './data/tags', - './data/tokenizer', - './data/minimumInputLength', - './data/maximumInputLength', - './data/maximumSelectionLength', - - './dropdown', - './dropdown/search', - './dropdown/hidePlaceholder', - './dropdown/infiniteScroll', - './dropdown/attachBody', - './dropdown/minimumResultsForSearch', - './dropdown/selectOnClose', - './dropdown/closeOnSelect', - - './i18n/en' -], function ($, ResultsList, - - SingleSelection, MultipleSelection, Placeholder, AllowClear, - SelectionSearch, EventRelay, - - Utils, Translation, DIACRITICS, - - SelectData, ArrayData, AjaxData, Tags, Tokenizer, - MinimumInputLength, MaximumInputLength, MaximumSelectionLength, - - Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll, - AttachBody, MinimumResultsForSearch, SelectOnClose, CloseOnSelect, - - EnglishTranslation) { - function Defaults () { - this.reset(); - } - - Defaults.prototype.apply = function (options) { - options = $.extend({}, this.defaults, options); - - if (options.dataAdapter == null) { - if (options.ajax != null) { - options.dataAdapter = AjaxData; - } else if (options.data != null) { - options.dataAdapter = ArrayData; - } else { - options.dataAdapter = SelectData; - } - - if (options.minimumInputLength > 0) { - options.dataAdapter = Utils.Decorate( - options.dataAdapter, - MinimumInputLength - ); - } - - if (options.maximumInputLength > 0) { - options.dataAdapter = Utils.Decorate( - options.dataAdapter, - MaximumInputLength - ); - } - - if (options.maximumSelectionLength > 0) { - options.dataAdapter = Utils.Decorate( - options.dataAdapter, - MaximumSelectionLength - ); - } - - if (options.tags != null) { - options.dataAdapter = Utils.Decorate(options.dataAdapter, Tags); - } - - if (options.tokenSeparators != null || options.tokenizer != null) { - options.dataAdapter = Utils.Decorate( - options.dataAdapter, - Tokenizer - ); - } - - if (options.query != null) { - var Query = require(options.amdBase + 'compat/query'); - - options.dataAdapter = Utils.Decorate( - options.dataAdapter, - Query - ); - } - - if (options.initSelection != null) { - var InitSelection = require(options.amdBase + 'compat/initSelection'); - - options.dataAdapter = Utils.Decorate( - options.dataAdapter, - InitSelection - ); - } - } - - if (options.resultsAdapter == null) { - options.resultsAdapter = ResultsList; - - if (options.ajax != null) { - options.resultsAdapter = Utils.Decorate( - options.resultsAdapter, - InfiniteScroll - ); - } - - if (options.placeholder != null) { - options.resultsAdapter = Utils.Decorate( - options.resultsAdapter, - HidePlaceholder - ); - } - - if (options.selectOnClose) { - options.resultsAdapter = Utils.Decorate( - options.resultsAdapter, - SelectOnClose - ); - } - } - - if (options.dropdownAdapter == null) { - if (options.multiple) { - options.dropdownAdapter = Dropdown; - } else { - var SearchableDropdown = Utils.Decorate(Dropdown, DropdownSearch); - - options.dropdownAdapter = SearchableDropdown; - } - - if (options.minimumResultsForSearch !== 0) { - options.dropdownAdapter = Utils.Decorate( - options.dropdownAdapter, - MinimumResultsForSearch - ); - } - - if (options.closeOnSelect) { - options.dropdownAdapter = Utils.Decorate( - options.dropdownAdapter, - CloseOnSelect - ); - } - - options.dropdownAdapter = Utils.Decorate( - options.dropdownAdapter, - AttachBody - ); - } - - if (options.selectionAdapter == null) { - if (options.multiple) { - options.selectionAdapter = MultipleSelection; - } else { - options.selectionAdapter = SingleSelection; - } - - // Add the placeholder mixin if a placeholder was specified - if (options.placeholder != null) { - options.selectionAdapter = Utils.Decorate( - options.selectionAdapter, - Placeholder - ); - } - - if (options.allowClear) { - options.selectionAdapter = Utils.Decorate( - options.selectionAdapter, - AllowClear - ); - } - - if (options.multiple) { - options.selectionAdapter = Utils.Decorate( - options.selectionAdapter, - SelectionSearch - ); - } - - options.selectionAdapter = Utils.Decorate( - options.selectionAdapter, - EventRelay - ); - } - - if (typeof options.language === 'string') { - // Check if the lanugage is specified with a region - if (options.language.indexOf('-') > 0) { - // Extract the region information if it is included - var languageParts = options.language.split('-'); - var baseLanguage = languageParts[0]; - - options.language = [options.language, baseLanguage]; - } else { - options.language = [options.language]; - } - } - - if ($.isArray(options.language)) { - var languages = new Translation(); - options.language.push('en'); - - var languageNames = options.language; - - for (var l = 0; l < languageNames.length; l++) { - var name = languageNames[l]; - var language = {}; - - try { - // Try to load it with the original name - language = Translation.loadPath(name); - } catch (e) { - try { - // If we couldn't load it, check if it wasn't the full path - name = this.defaults.amdLanguageBase + name; - language = Translation.loadPath(name); - } catch (ex) { - // The translation could not be loaded at all. Sometimes this is - // because of a configuration problem, other times this can be - // because of how Select2 helps load all possible translation files. - if (window.console && console.warn) { - console.warn( - 'Select2: The lanugage file for "' + name + '" could not be ' + - 'automatically loaded. A fallback will be used instead.' - ); - } - - continue; - } - } - - languages.extend(language); - } - - options.translations = languages; - } else { - options.translations = new Translation(options.language); - } - - return options; - }; - - Defaults.prototype.reset = function () { - function stripDiacritics (text) { - // Used 'uni range + named function' from http://jsperf.com/diacritics/18 - function match(a) { - return DIACRITICS[a] || a; - } - - return text.replace(/[^\u0000-\u007E]/g, match); - } - - function matcher (params, data) { - // Always return the object if there is nothing to compare - if ($.trim(params.term) === '') { - return data; - } - - // Do a recursive check for options with children - if (data.children && data.children.length > 0) { - // Clone the data object if there are children - // This is required as we modify the object to remove any non-matches - var match = $.extend(true, {}, data); - - // Check each child of the option - for (var c = data.children.length - 1; c >= 0; c--) { - var child = data.children[c]; - - var matches = matcher(params, child); - - // If there wasn't a match, remove the object in the array - if (matches == null) { - match.children.splice(c, 1); - } - } - - // If any children matched, return the new object - if (match.children.length > 0) { - return match; - } - - // If there were no matching children, check just the plain object - return matcher(params, match); - } - - var original = stripDiacritics(data.text).toUpperCase(); - var term = stripDiacritics(params.term).toUpperCase(); - - // Check if the text contains the term - if (original.indexOf(term) > -1) { - return data; - } - - // If it doesn't contain the term, don't return anything - return null; - } - - this.defaults = { - amdBase: 'select2/', - amdLanguageBase: 'select2/i18n/', - closeOnSelect: true, - escapeMarkup: Utils.escapeMarkup, - language: EnglishTranslation, - matcher: matcher, - minimumInputLength: 0, - maximumInputLength: 0, - maximumSelectionLength: 0, - minimumResultsForSearch: 0, - selectOnClose: false, - sorter: function (data) { - return data; - }, - templateResult: function (result) { - return result.text; - }, - templateSelection: function (selection) { - return selection.text; - }, - theme: 'default', - width: 'resolve' - }; - }; - - Defaults.prototype.set = function (key, value) { - var camelKey = $.camelCase(key); - - var data = {}; - data[camelKey] = value; - - var convertedData = Utils._convertData(data); - - $.extend(this.defaults, convertedData); - }; - - var defaults = new Defaults(); - - return defaults; -}); - -define('select2/options',[ - 'jquery', - './defaults', - './utils' -], function ($, Defaults, Utils) { - function Options (options, $element) { - this.options = options; - - if ($element != null) { - this.fromElement($element); - } - - this.options = Defaults.apply(this.options); - - if ($element && $element.is('input')) { - var InputCompat = require(this.get('amdBase') + 'compat/inputData'); - - this.options.dataAdapter = Utils.Decorate( - this.options.dataAdapter, - InputCompat - ); - } - } - - Options.prototype.fromElement = function ($e) { - var excludedData = ['select2']; - - if (this.options.multiple == null) { - this.options.multiple = $e.prop('multiple'); - } - - if (this.options.disabled == null) { - this.options.disabled = $e.prop('disabled'); - } - - if (this.options.language == null) { - if ($e.prop('lang')) { - this.options.language = $e.prop('lang').toLowerCase(); - } else if ($e.closest('[lang]').prop('lang')) { - this.options.language = $e.closest('[lang]').prop('lang'); - } - } - - if (this.options.dir == null) { - if ($e.prop('dir')) { - this.options.dir = $e.prop('dir'); - } else if ($e.closest('[dir]').prop('dir')) { - this.options.dir = $e.closest('[dir]').prop('dir'); - } else { - this.options.dir = 'ltr'; - } - } - - $e.prop('disabled', this.options.disabled); - $e.prop('multiple', this.options.multiple); - - if ($e.data('select2Tags')) { - if (window.console && console.warn) { - console.warn( - 'Select2: The `data-select2-tags` attribute has been changed to ' + - 'use the `data-data` and `data-tags="true"` attributes and will be ' + - 'removed in future versions of Select2.' - ); - } - - $e.data('data', $e.data('select2Tags')); - $e.data('tags', true); - } - - if ($e.data('ajaxUrl')) { - if (window.console && console.warn) { - console.warn( - 'Select2: The `data-ajax-url` attribute has been changed to ' + - '`data-ajax--url` and support for the old attribute will be removed' + - ' in future versions of Select2.' - ); - } - - $e.data('ajax-Url', $e.data('ajaxUrl')); - } - - var dataset = {}; - - // Prefer the element's `dataset` attribute if it exists - // jQuery 1.x does not correctly handle data attributes with multiple dashes - if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) { - dataset = $.extend(true, {}, $e[0].dataset, $e.data()); - } else { - dataset = $e.data(); - } - - var data = $.extend(true, {}, dataset); - - data = Utils._convertData(data); - - for (var key in data) { - if ($.inArray(key, excludedData) > -1) { - continue; - } - - if ($.isPlainObject(this.options[key])) { - $.extend(this.options[key], data[key]); - } else { - this.options[key] = data[key]; - } - } - - return this; - }; - - Options.prototype.get = function (key) { - return this.options[key]; - }; - - Options.prototype.set = function (key, val) { - this.options[key] = val; - }; - - return Options; -}); - -define('select2/core',[ - 'jquery', - './options', - './utils', - './keys' -], function ($, Options, Utils, KEYS) { - var Select2 = function ($element, options) { - if ($element.data('select2') != null) { - $element.data('select2').destroy(); - } - - this.$element = $element; - - this.id = this._generateId($element); - - options = options || {}; - - this.options = new Options(options, $element); - - Select2.__super__.constructor.call(this); - - // Set up the tabindex - - var tabindex = $element.attr('tabindex') || 0; - $element.data('old-tabindex', tabindex); - $element.attr('tabindex', '-1'); - - // Set up containers and adapters - - var DataAdapter = this.options.get('dataAdapter'); - this.data = new DataAdapter($element, this.options); - - var $container = this.render(); - - this._placeContainer($container); - - var SelectionAdapter = this.options.get('selectionAdapter'); - this.selection = new SelectionAdapter($element, this.options); - this.$selection = this.selection.render(); - - this.selection.position(this.$selection, $container); - - var DropdownAdapter = this.options.get('dropdownAdapter'); - this.dropdown = new DropdownAdapter($element, this.options); - this.$dropdown = this.dropdown.render(); - - this.dropdown.position(this.$dropdown, $container); - - var ResultsAdapter = this.options.get('resultsAdapter'); - this.results = new ResultsAdapter($element, this.options, this.data); - this.$results = this.results.render(); - - this.results.position(this.$results, this.$dropdown); - - // Bind events - - var self = this; - - // Bind the container to all of the adapters - this._bindAdapters(); - - // Register any DOM event handlers - this._registerDomEvents(); - - // Register any internal event handlers - this._registerDataEvents(); - this._registerSelectionEvents(); - this._registerDropdownEvents(); - this._registerResultsEvents(); - this._registerEvents(); - - // Set the initial state - this.data.current(function (initialData) { - self.trigger('selection:update', { - data: initialData - }); - }); - - // Hide the original select - $element.hide(); - - // Synchronize any monitored attributes - this._syncAttributes(); - - $element.data('select2', this); - }; - - Utils.Extend(Select2, Utils.Observable); - - Select2.prototype._generateId = function ($element) { - var id = ''; - - if ($element.attr('id') != null) { - id = $element.attr('id'); - } else if ($element.attr('name') != null) { - id = $element.attr('name') + '-' + Utils.generateChars(2); - } else { - id = Utils.generateChars(4); - } - - id = 'select2-' + id; - - return id; - }; - - Select2.prototype._placeContainer = function ($container) { - $container.insertAfter(this.$element); - - var width = this._resolveWidth(this.$element, this.options.get('width')); - - if (width != null) { - $container.css('width', width); - } - }; - - Select2.prototype._resolveWidth = function ($element, method) { - var WIDTH = /^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i; - - if (method == 'resolve') { - var styleWidth = this._resolveWidth($element, 'style'); - - if (styleWidth != null) { - return styleWidth; - } - - return this._resolveWidth($element, 'element'); - } - - if (method == 'element') { - var elementWidth = $element.outerWidth(false); - - if (elementWidth <= 0) { - return 'auto'; - } - - return elementWidth + 'px'; - } - - if (method == 'style') { - var style = $element.attr('style'); - - if (typeof(style) !== 'string') { - return null; - } - - var attrs = style.split(';'); - - for (var i = 0, l = attrs.length; i < l; i = i + 1) { - var attr = attrs[i].replace(/\s/g, ''); - var matches = attr.match(WIDTH); - - if (matches !== null && matches.length >= 1) { - return matches[1]; - } - } - - return null; - } - - return method; - }; - - Select2.prototype._bindAdapters = function () { - this.data.bind(this, this.$container); - this.selection.bind(this, this.$container); - - this.dropdown.bind(this, this.$container); - this.results.bind(this, this.$container); - }; - - Select2.prototype._registerDomEvents = function () { - var self = this; - - this.$element.on('change.select2', function () { - self.data.current(function (data) { - self.trigger('selection:update', { - data: data - }); - }); - }); - - this._sync = Utils.bind(this._syncAttributes, this); - - if (this.$element[0].attachEvent) { - this.$element[0].attachEvent('onpropertychange', this._sync); - } - - var observer = window.MutationObserver || - window.WebKitMutationObserver || - window.MozMutationObserver - ; - - if (observer != null) { - this._observer = new observer(function (mutations) { - $.each(mutations, self._sync); - }); - this._observer.observe(this.$element[0], { - attributes: true, - subtree: false - }); - } else if (this.$element[0].addEventListener) { - this.$element[0].addEventListener('DOMAttrModified', self._sync, false); - } - }; - - Select2.prototype._registerDataEvents = function () { - var self = this; - - this.data.on('*', function (name, params) { - self.trigger(name, params); - }); - }; - - Select2.prototype._registerSelectionEvents = function () { - var self = this; - var nonRelayEvents = ['toggle']; - - this.selection.on('toggle', function () { - self.toggleDropdown(); - }); - - this.selection.on('*', function (name, params) { - if ($.inArray(name, nonRelayEvents) !== -1) { - return; - } - - self.trigger(name, params); - }); - }; - - Select2.prototype._registerDropdownEvents = function () { - var self = this; - - this.dropdown.on('*', function (name, params) { - self.trigger(name, params); - }); - }; - - Select2.prototype._registerResultsEvents = function () { - var self = this; - - this.results.on('*', function (name, params) { - self.trigger(name, params); - }); - }; - - Select2.prototype._registerEvents = function () { - var self = this; - - this.on('open', function () { - self.$container.addClass('select2-container--open'); - }); - - this.on('close', function () { - self.$container.removeClass('select2-container--open'); - }); - - this.on('enable', function () { - self.$container.removeClass('select2-container--disabled'); - }); - - this.on('disable', function () { - self.$container.addClass('select2-container--disabled'); - }); - - this.on('focus', function () { - self.$container.addClass('select2-container--focus'); - }); - - this.on('blur', function () { - self.$container.removeClass('select2-container--focus'); - }); - - this.on('query', function (params) { - if (!self.isOpen()) { - self.trigger('open'); - } - - this.data.query(params, function (data) { - self.trigger('results:all', { - data: data, - query: params - }); - }); - }); - - this.on('query:append', function (params) { - this.data.query(params, function (data) { - self.trigger('results:append', { - data: data, - query: params - }); - }); - }); - - this.on('keypress', function (evt) { - var key = evt.which; - - if (self.isOpen()) { - if (key === KEYS.ENTER) { - self.trigger('results:select'); - - evt.preventDefault(); - } else if ((key === KEYS.SPACE && evt.ctrlKey)) { - self.trigger('results:toggle'); - - evt.preventDefault(); - } else if (key === KEYS.UP) { - self.trigger('results:previous'); - - evt.preventDefault(); - } else if (key === KEYS.DOWN) { - self.trigger('results:next'); - - evt.preventDefault(); - } else if (key === KEYS.ESC || key === KEYS.TAB) { - self.close(); - - evt.preventDefault(); - } - } else { - if (key === KEYS.ENTER || key === KEYS.SPACE || - ((key === KEYS.DOWN || key === KEYS.UP) && evt.altKey)) { - self.open(); - - evt.preventDefault(); - } - } - }); - }; - - Select2.prototype._syncAttributes = function () { - this.options.set('disabled', this.$element.prop('disabled')); - - if (this.options.get('disabled')) { - if (this.isOpen()) { - this.close(); - } - - this.trigger('disable'); - } else { - this.trigger('enable'); - } - }; - - /** - * Override the trigger method to automatically trigger pre-events when - * there are events that can be prevented. - */ - Select2.prototype.trigger = function (name, args) { - var actualTrigger = Select2.__super__.trigger; - var preTriggerMap = { - 'open': 'opening', - 'close': 'closing', - 'select': 'selecting', - 'unselect': 'unselecting' - }; - - if (name in preTriggerMap) { - var preTriggerName = preTriggerMap[name]; - var preTriggerArgs = { - prevented: false, - name: name, - args: args - }; - - actualTrigger.call(this, preTriggerName, preTriggerArgs); - - if (preTriggerArgs.prevented) { - args.prevented = true; - - return; - } - } - - actualTrigger.call(this, name, args); - }; - - Select2.prototype.toggleDropdown = function () { - if (this.options.get('disabled')) { - return; - } - - if (this.isOpen()) { - this.close(); - } else { - this.open(); - } - }; - - Select2.prototype.open = function () { - if (this.isOpen()) { - return; - } - - this.trigger('query', {}); - - this.trigger('open'); - }; - - Select2.prototype.close = function () { - if (!this.isOpen()) { - return; - } - - this.trigger('close'); - }; - - Select2.prototype.isOpen = function () { - return this.$container.hasClass('select2-container--open'); - }; - - Select2.prototype.enable = function (args) { - if (window.console && console.warn) { - console.warn( - 'Select2: The `select2("enable")` method has been deprecated and will' + - ' be removed in later Select2 versions. Use $element.prop("disabled")' + - ' instead.' - ); - } - - if (args.length === 0) { - args = [true]; - } - - var disabled = !args[0]; - - this.$element.prop('disabled', disabled); - }; - - Select2.prototype.data = function () { - if (arguments.length > 0 && window.console && console.warn) { - console.warn( - 'Select2: Data can no longer be set using `select2("data")`. You ' + - 'should consider setting the value instead using `$element.val()`.' - ); - } - - var data = []; - - this.dataAdpater.current(function (currentData) { - data = currentData; - }); - - return data; - }; - - Select2.prototype.val = function (args) { - if (window.console && console.warn) { - console.warn( - 'Select2: The `select2("val")` method has been deprecated and will be' + - ' removed in later Select2 versions. Use $element.val() instead.' - ); - } - - if (args.length === 0) { - return this.$element.val(); - } - - var newVal = args[0]; - - if ($.isArray(newVal)) { - newVal = $.map(newVal, function (obj) { - return obj.toString(); - }); - } - - this.$element.val(newVal).trigger('change'); - }; - - Select2.prototype.destroy = function () { - this.$container.remove(); - - if (this.$element[0].detachEvent) { - this.$element[0].detachEvent('onpropertychange', this._sync); - } - - if (this._observer != null) { - this._observer.disconnect(); - this._observer = null; - } else if (this.$element[0].removeEventListener) { - this.$element[0] - .removeEventListener('DOMAttrModified', this._sync, false); - } - - this._sync = null; - - this.$element.off('.select2'); - this.$element.attr('tabindex', this.$element.data('old-tabindex')); - - this.$element.show(); - this.$element.removeData('select2'); - - this.data.destroy(); - this.selection.destroy(); - this.dropdown.destroy(); - this.results.destroy(); - - this.data = null; - this.selection = null; - this.dropdown = null; - this.results = null; - }; - - Select2.prototype.render = function () { - var $container = $( - '<span class="select2 select2-container">' + - '<span class="selection"></span>' + - '<span class="dropdown-wrapper" aria-hidden="true"></span>' + - '</span>' - ); - - $container.attr('dir', this.options.get('dir')); - - this.$container = $container; - - this.$container.addClass('select2-container--' + this.options.get('theme')); - - $container.data('element', this.$element); - - return $container; - }; - - return Select2; -}); - -/*! - * jQuery Mousewheel 3.1.12 - * - * Copyright 2014 jQuery Foundation and other contributors - * Released under the MIT license. - * http://jquery.org/license - */ - -(function (factory) { - if ( typeof define === 'function' && define.amd ) { - // AMD. Register as an anonymous module. - define('jquery.mousewheel',['jquery'], factory); - } else if (typeof exports === 'object') { - // Node/CommonJS style for Browserify - module.exports = factory; - } else { - // Browser globals - factory(jQuery); - } -}(function ($) { - - var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'], - toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ? - ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'], - slice = Array.prototype.slice, - nullLowestDeltaTimeout, lowestDelta; - - if ( $.event.fixHooks ) { - for ( var i = toFix.length; i; ) { - $.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks; - } - } - - var special = $.event.special.mousewheel = { - version: '3.1.12', - - setup: function() { - if ( this.addEventListener ) { - for ( var i = toBind.length; i; ) { - this.addEventListener( toBind[--i], handler, false ); - } - } else { - this.onmousewheel = handler; - } - // Store the line height and page height for this particular element - $.data(this, 'mousewheel-line-height', special.getLineHeight(this)); - $.data(this, 'mousewheel-page-height', special.getPageHeight(this)); - }, - - teardown: function() { - if ( this.removeEventListener ) { - for ( var i = toBind.length; i; ) { - this.removeEventListener( toBind[--i], handler, false ); - } - } else { - this.onmousewheel = null; - } - // Clean up the data we added to the element - $.removeData(this, 'mousewheel-line-height'); - $.removeData(this, 'mousewheel-page-height'); - }, - - getLineHeight: function(elem) { - var $elem = $(elem), - $parent = $elem['offsetParent' in $.fn ? 'offsetParent' : 'parent'](); - if (!$parent.length) { - $parent = $('body'); - } - return parseInt($parent.css('fontSize'), 10) || parseInt($elem.css('fontSize'), 10) || 16; - }, - - getPageHeight: function(elem) { - return $(elem).height(); - }, - - settings: { - adjustOldDeltas: true, // see shouldAdjustOldDeltas() below - normalizeOffset: true // calls getBoundingClientRect for each event - } - }; - - $.fn.extend({ - mousewheel: function(fn) { - return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel'); - }, - - unmousewheel: function(fn) { - return this.unbind('mousewheel', fn); - } - }); - - - function handler(event) { - var orgEvent = event || window.event, - args = slice.call(arguments, 1), - delta = 0, - deltaX = 0, - deltaY = 0, - absDelta = 0, - offsetX = 0, - offsetY = 0; - event = $.event.fix(orgEvent); - event.type = 'mousewheel'; - - // Old school scrollwheel delta - if ( 'detail' in orgEvent ) { deltaY = orgEvent.detail * -1; } - if ( 'wheelDelta' in orgEvent ) { deltaY = orgEvent.wheelDelta; } - if ( 'wheelDeltaY' in orgEvent ) { deltaY = orgEvent.wheelDeltaY; } - if ( 'wheelDeltaX' in orgEvent ) { deltaX = orgEvent.wheelDeltaX * -1; } - - // Firefox < 17 horizontal scrolling related to DOMMouseScroll event - if ( 'axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) { - deltaX = deltaY * -1; - deltaY = 0; - } - - // Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy - delta = deltaY === 0 ? deltaX : deltaY; - - // New school wheel delta (wheel event) - if ( 'deltaY' in orgEvent ) { - deltaY = orgEvent.deltaY * -1; - delta = deltaY; - } - if ( 'deltaX' in orgEvent ) { - deltaX = orgEvent.deltaX; - if ( deltaY === 0 ) { delta = deltaX * -1; } - } - - // No change actually happened, no reason to go any further - if ( deltaY === 0 && deltaX === 0 ) { return; } - - // Need to convert lines and pages to pixels if we aren't already in pixels - // There are three delta modes: - // * deltaMode 0 is by pixels, nothing to do - // * deltaMode 1 is by lines - // * deltaMode 2 is by pages - if ( orgEvent.deltaMode === 1 ) { - var lineHeight = $.data(this, 'mousewheel-line-height'); - delta *= lineHeight; - deltaY *= lineHeight; - deltaX *= lineHeight; - } else if ( orgEvent.deltaMode === 2 ) { - var pageHeight = $.data(this, 'mousewheel-page-height'); - delta *= pageHeight; - deltaY *= pageHeight; - deltaX *= pageHeight; - } - - // Store lowest absolute delta to normalize the delta values - absDelta = Math.max( Math.abs(deltaY), Math.abs(deltaX) ); - - if ( !lowestDelta || absDelta < lowestDelta ) { - lowestDelta = absDelta; - - // Adjust older deltas if necessary - if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) { - lowestDelta /= 40; - } - } - - // Adjust older deltas if necessary - if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) { - // Divide all the things by 40! - delta /= 40; - deltaX /= 40; - deltaY /= 40; - } - - // Get a whole, normalized value for the deltas - delta = Math[ delta >= 1 ? 'floor' : 'ceil' ](delta / lowestDelta); - deltaX = Math[ deltaX >= 1 ? 'floor' : 'ceil' ](deltaX / lowestDelta); - deltaY = Math[ deltaY >= 1 ? 'floor' : 'ceil' ](deltaY / lowestDelta); - - // Normalise offsetX and offsetY properties - if ( special.settings.normalizeOffset && this.getBoundingClientRect ) { - var boundingRect = this.getBoundingClientRect(); - offsetX = event.clientX - boundingRect.left; - offsetY = event.clientY - boundingRect.top; - } - - // Add information to the event object - event.deltaX = deltaX; - event.deltaY = deltaY; - event.deltaFactor = lowestDelta; - event.offsetX = offsetX; - event.offsetY = offsetY; - // Go ahead and set deltaMode to 0 since we converted to pixels - // Although this is a little odd since we overwrite the deltaX/Y - // properties with normalized deltas. - event.deltaMode = 0; - - // Add event and delta to the front of the arguments - args.unshift(event, delta, deltaX, deltaY); - - // Clearout lowestDelta after sometime to better - // handle multiple device types that give different - // a different lowestDelta - // Ex: trackpad = 3 and mouse wheel = 120 - if (nullLowestDeltaTimeout) { clearTimeout(nullLowestDeltaTimeout); } - nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200); - - return ($.event.dispatch || $.event.handle).apply(this, args); - } - - function nullLowestDelta() { - lowestDelta = null; - } - - function shouldAdjustOldDeltas(orgEvent, absDelta) { - // If this is an older event and the delta is divisable by 120, - // then we are assuming that the browser is treating this as an - // older mouse wheel event and that we should divide the deltas - // by 40 to try and get a more usable deltaFactor. - // Side note, this actually impacts the reported scroll distance - // in older browsers and can cause scrolling to be slower than native. - // Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false. - return special.settings.adjustOldDeltas && orgEvent.type === 'mousewheel' && absDelta % 120 === 0; - } - -})); - -define('select2/compat/matcher',[ - 'jquery' -], function ($) { - function oldMatcher (matcher) { - function wrappedMatcher (params, data) { - var match = $.extend(true, {}, data); - - if (params.term == null || $.trim(params.term) === '') { - return match; - } - - if (data.children) { - for (var c = data.children.length - 1; c >= 0; c--) { - var child = data.children[c]; - - // Check if the child object matches - // The old matcher returned a boolean true or false - var doesMatch = matcher(params.term, child.text, child); - - // If the child didn't match, pop it off - if (!doesMatch) { - match.children.splice(c, 1); - } - } - - if (match.children.length > 0) { - return match; - } - } - - if (matcher(params.term, data.text, data)) { - return match; - } - - return null; - } - - return wrappedMatcher; - } - - return oldMatcher; -}); - -define('select2/compat/initSelection',[ - 'jquery' -], function ($) { - function InitSelection (decorated, $element, options) { - if (window.console && console.warn) { - console.warn( - 'Select2: The `initSelection` option has been deprecated in favor' + - ' of a custom data adapter that overrides the `current` method. ' + - 'This method is now called multiple times instead of a single ' + - 'time when the instance is initialized. Support will be removed ' + - 'for the `initSelection` option in future versions of Select2' - ); - } - - this.initSelection = options.get('initSelection'); - this._isInitialized = false; - - decorated.call(this, $element, options); - } - - InitSelection.prototype.current = function (decorated, callback) { - var self = this; - - if (this._isInitialized) { - decorated.call(this, callback); - - return; - } - - this.initSelection.call(null, this.$element, function (data) { - self._isInitialized = true; - - if (!$.isArray(data)) { - data = [data]; - } - - callback(data); - }); - }; - - return InitSelection; -}); - -define('select2/compat/inputData',[ - 'jquery' -], function ($) { - function InputData (decorated, $element, options) { - this._currentData = []; - this._valueSeparator = options.get('valueSeparator') || ','; - - if ($element.prop('type') === 'hidden') { - if (console && console.warn) { - console.warn( - 'Select2: Using a hidden input with Select2 is no longer ' + - 'supported and may stop working in the future. It is recommended ' + - 'to use a `<select>` element instead.' - ); - } - } - - decorated.call(this, $element, options); - } - - InputData.prototype.current = function (_, callback) { - function getSelected (data, selectedIds) { - var selected = []; - - if (data.selected || $.inArray(data.id, selectedIds) !== -1) { - data.selected = true; - selected.push(data); - } else { - data.selected = false; - } - - if (data.children) { - selected.push.apply(selected, getSelected(data.children, selectedIds)); - } - - return selected; - } - - var selected = []; - - for (var d = 0; d < this._currentData.length; d++) { - var data = this._currentData[d]; - - selected.push.apply( - selected, - getSelected( - data, - this.$element.val().split( - this._valueSeparator - ) - ) - ); - } - - callback(selected); - }; - - InputData.prototype.select = function (_, data) { - if (!this.options.get('multiple')) { - this.current(function (allData) { - $.map(allData, function (data) { - data.selected = false; - }); - }); - - this.$element.val(data.id); - this.$element.trigger('change'); - } else { - var value = this.$element.val(); - value += this._valueSeparator + data.id; - - this.$element.val(value); - this.$element.trigger('change'); - } - }; - - InputData.prototype.unselect = function (_, data) { - var self = this; - - data.selected = false; - - this.current(function (allData) { - var values = []; - - for (var d = 0; d < allData; d++) { - var item = allData[d]; - - if (data.id == item.id) { - continue; - } - - values.push(data.id); - } - - self.$element.val(values.join(self._valueSeparator)); - self.$element.trigger('change'); - }); - }; - - InputData.prototype.query = function (_, params, callback) { - var results = []; - - for (var d = 0; d < this._currentData.length; d++) { - var data = this._currentData[d]; - - var matches = this.matches(params, data); - - if (matches !== null) { - results.push(matches); - } - } - - callback({ - results: results - }); - }; - - InputData.prototype.addOptions = function (_, $options) { - var options = $.map($options, function ($option) { - return $.data($option[0], 'data'); - }); - - this._currentData.push.apply(this._currentData, options); - }; - - return InputData; -}); - -define('select2/compat/query',[ - -], function () { - function Query (decorated, $element, options) { - if (window.console && console.warn) { - console.warn( - 'Select2: The `query` option has been deprecated in favor of a ' + - 'custom data adapter that overrides the `query` method. Support ' + - 'will be removed for the `query` option in future versions of ' + - 'Select2.' - ); - } - - decorated.call(this, $element, options); - } - - Query.prototype.query = function (_, params, callback) { - params.callback = callback; - - var query = this.options.get('query'); - - query.call(null, params); - }; - - return Query; -}); - -define('select2/dropdown/attachContainer',[ - -], function () { - function AttachContainer (decorated, $element, options) { - decorated.call(this, $element, options); - } - - AttachContainer.prototype.position = - function (decorated, $dropdown, $container) { - var $dropdownContainer = $container.find('.dropdown-wrapper'); - $dropdownContainer.append($dropdown); - - $dropdown.addClass('select2-dropdown--below'); - $container.addClass('select2-container--below'); - }; - - return AttachContainer; -}); - -define('select2/dropdown/stopPropagation',[ - -], function () { - function StopPropagation () { } - - StopPropagation.prototype.bind = function (decorated, container, $container) { - decorated.call(this, container, $container); - - var stoppedEvents = [ - 'blur', - 'change', - 'click', - 'dblclick', - 'focus', - 'focusin', - 'focusout', - 'input', - 'keydown', - 'keyup', - 'keypress', - 'mousedown', - 'mouseenter', - 'mouseleave', - 'mousemove', - 'mouseover', - 'mouseup', - 'search', - 'touchend', - 'touchstart' - ]; - - this.$dropdown.on(stoppedEvents.join(' '), function (evt) { - evt.stopPropagation(); - }); - }; - - return StopPropagation; -}); - -define('select2/selection/stopPropagation',[ - -], function () { - function StopPropagation () { } - - StopPropagation.prototype.bind = function (decorated, container, $container) { - decorated.call(this, container, $container); - - var stoppedEvents = [ - 'blur', - 'change', - 'click', - 'dblclick', - 'focus', - 'focusin', - 'focusout', - 'input', - 'keydown', - 'keyup', - 'keypress', - 'mousedown', - 'mouseenter', - 'mouseleave', - 'mousemove', - 'mouseover', - 'mouseup', - 'search', - 'touchend', - 'touchstart' - ]; - - this.$selection.on(stoppedEvents.join(' '), function (evt) { - evt.stopPropagation(); - }); - }; - - return StopPropagation; -}); - -define('jquery.select2',[ - 'jquery', - './select2/core', - './select2/defaults' -], function ($, Select2, Defaults) { - // Force jQuery.mousewheel to be loaded if it hasn't already - try { - require('jquery.mousewheel'); - } catch (Exception) { } - - if ($.fn.select2 == null) { - $.fn.select2 = function (options) { - options = options || {}; - - if (typeof options === 'object') { - this.each(function () { - var instanceOptions = $.extend({}, options, true); - - var instance = new Select2($(this), instanceOptions); - }); - - return this; - } else if (typeof options === 'string') { - var instance = this.data('select2'); - var args = Array.prototype.slice.call(arguments, 1); - - return instance[options](args); - } else { - throw new Error('Invalid arguments for Select2: ' + options); - } - }; - } - - if ($.fn.select2.defaults == null) { - $.fn.select2.defaults = Defaults; - } - - return Select2; -}); - -require('jquery.select2'); jQuery.fn.select2.amd = { define: define, require: require }; }());
\ No newline at end of file diff --git a/public/vendor/select2/js/select2.full.min.js b/public/vendor/select2/js/select2.full.min.js deleted file mode 100755 index 752feb9d..00000000 --- a/public/vendor/select2/js/select2.full.min.js +++ /dev/null @@ -1,3 +0,0 @@ -!function(){if(window.define)var a=window.define;if(window.require)var b=window.require;if(window.jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var a=jQuery.fn.select2.amd.define,b=jQuery.fn.select2.amd.require;var c,b,a;!function(d){function e(a,b){return u.call(a,b)}function f(a,b){var c,d,e,f,g,h,i,j,k,l,m,n=b&&b.split("/"),o=s.map,p=o&&o["*"]||{};if(a&&"."===a.charAt(0))if(b){for(n=n.slice(0,n.length-1),a=a.split("/"),g=a.length-1,s.nodeIdCompat&&w.test(a[g])&&(a[g]=a[g].replace(w,"")),a=n.concat(a),k=0;k<a.length;k+=1)if(m=a[k],"."===m)a.splice(k,1),k-=1;else if(".."===m){if(1===k&&(".."===a[2]||".."===a[0]))break;k>0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((n||p)&&o){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),n)for(l=n.length;l>0;l-=1)if(e=o[n.slice(0,l).join("/")],e&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&p&&p[d]&&(i=p[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function g(a,b){return function(){return n.apply(d,v.call(arguments,0).concat([a,b]))}}function h(a){return function(b){return f(b,a)}}function i(a){return function(b){q[a]=b}}function j(a){if(e(r,a)){var b=r[a];delete r[a],t[a]=!0,m.apply(d,b)}if(!e(q,a)&&!e(t,a))throw new Error("No "+a);return q[a]}function k(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function l(a){return function(){return s&&s.config&&s.config[a]||{}}}var m,n,o,p,q={},r={},s={},t={},u=Object.prototype.hasOwnProperty,v=[].slice,w=/\.js$/;o=function(a,b){var c,d=k(a),e=d[0];return a=d[1],e&&(e=f(e,b),c=j(e)),e?a=c&&c.normalize?c.normalize(a,h(b)):f(a,b):(a=f(a,b),d=k(a),e=d[0],a=d[1],e&&(c=j(e))),{f:e?e+"!"+a:a,n:a,pr:e,p:c}},p={require:function(a){return g(a)},exports:function(a){var b=q[a];return"undefined"!=typeof b?b:q[a]={}},module:function(a){return{id:a,uri:"",exports:q[a],config:l(a)}}},m=function(a,b,c,f){var h,k,l,m,n,s,u=[],v=typeof c;if(f=f||a,"undefined"===v||"function"===v){for(b=!b.length&&c.length?["require","exports","module"]:b,n=0;n<b.length;n+=1)if(m=o(b[n],f),k=m.f,"require"===k)u[n]=p.require(a);else if("exports"===k)u[n]=p.exports(a),s=!0;else if("module"===k)h=u[n]=p.module(a);else if(e(q,k)||e(r,k)||e(t,k))u[n]=j(k);else{if(!m.p)throw new Error(a+" missing "+k);m.p.load(m.n,g(f,!0),i(k),{}),u[n]=q[k]}l=c?c.apply(q[a],u):void 0,a&&(h&&h.exports!==d&&h.exports!==q[a]?q[a]=h.exports:l===d&&s||(q[a]=l))}else a&&(q[a]=c)},c=b=n=function(a,b,c,e,f){if("string"==typeof a)return p[a]?p[a](b):j(o(a,b).f);if(!a.splice){if(s=a,s.deps&&n(s.deps,s.callback),!b)return;b.splice?(a=b,b=c,c=null):a=d}return b=b||function(){},"function"==typeof c&&(c=e,e=f),e?m(d,a,b,c):setTimeout(function(){m(d,a,b,c)},4),n},n.config=function(a){return n(a)},c._defined=q,a=function(a,b,c){b.splice||(c=b,b=[]),e(q,a)||e(r,a)||(r[a]=[a,b,c])},a.amd={jQuery:!0}}(),a("almond",function(){}),a("jquery",[],function(){var a=jQuery||$;return null==a&&console&&console.error&&console.error("Select2: An instance of jQuery or a jQuery-compatible library was not found. Make sure that you are including jQuery before Select2 on your web page."),a}),a("select2/utils",["jquery"],function(a){function b(a){var b=a.prototype,c=[];for(var d in b){var e=b[d];"function"==typeof e&&"constructor"!==d&&c.push(d)}return c}var c={};c.Extend=function(a,b){function c(){this.constructor=a}var d={}.hasOwnProperty;for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},c.Decorate=function(a,c){function d(){var b=Array.prototype.unshift,d=c.prototype.constructor.length,e=a.prototype.constructor;d>0&&(b.call(arguments,a.prototype.constructor),e=c.prototype.constructor),e.apply(this,arguments)}function e(){this.constructor=d}var f=b(c),g=b(a);c.displayName=a.displayName,d.prototype=new e;for(var h=0;h<g.length;h++){var i=g[h];d.prototype[i]=a.prototype[i]}for(var j=(function(a){var b=function(){};a in d.prototype&&(b=d.prototype[a]);var e=c.prototype[a];return function(){var a=Array.prototype.unshift;return a.call(arguments,b),e.apply(this,arguments)}}),k=0;k<f.length;k++){var l=f[k];d.prototype[l]=j(l)}return d};var d=function(){this.listeners={}};return d.prototype.on=function(a,b){this.listeners=this.listeners||{},a in this.listeners?this.listeners[a].push(b):this.listeners[a]=[b]},d.prototype.trigger=function(a){var b=Array.prototype.slice;this.listeners=this.listeners||{},a in this.listeners&&this.invoke(this.listeners[a],b.call(arguments,1)),"*"in this.listeners&&this.invoke(this.listeners["*"],arguments)},d.prototype.invoke=function(a,b){for(var c=0,d=a.length;d>c;c++)a[c].apply(this,b)},c.Observable=d,c.generateChars=function(a){for(var b="",c=0;a>c;c++){var d=Math.floor(36*Math.random());b+=d.toString(36)}return b},c.bind=function(a,b){return function(){a.apply(b,arguments)}},c._convertData=function(a){for(var b in a){var c=b.split("-"),d=a;if(1!==c.length){for(var e=0;e<c.length;e++){var f=c[e];f=f.substring(0,1).toLowerCase()+f.substring(1),f in d||(d[f]={}),e==c.length-1&&(d[f]=a[b]),d=d[f]}delete a[b]}}return a},c.hasScroll=function(b,c){var d=a(c),e=c.style.overflowX,f=c.style.overflowY;return e!==f||"hidden"!==f&&"visible"!==f?"scroll"===e||"scroll"===f?!0:d.innerHeight()<c.scrollHeight||d.innerWidth()<c.scrollWidth:!1},c.escapeMarkup=function(a){var b={"\\":"\","&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return"string"!=typeof a?a:String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})},c}),a("select2/results",["jquery","./utils"],function(a,b){function c(a,b,d){this.$element=a,this.data=d,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<ul class="select2-results__options" role="tree"></ul>');return this.options.get("multiple")&&b.attr("aria-multiselectable","true"),this.$results=b,b},c.prototype.clear=function(){this.$results.empty()},c.prototype.displayMessage=function(b){var c=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var d=a('<li role="treeitem" class="select2-results__option"></li>'),e=this.options.get("translations").get(b.message);d.append(c(e(b.args))),this.$results.append(d)},c.prototype.append=function(a){this.hideLoading();var b=[];if(null==a.results||0===a.results.length)return void(0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"}));a.results=this.sort(a.results);for(var c=0;c<a.results.length;c++){var d=a.results[c],e=this.option(d);b.push(e)}this.$results.append(b)},c.prototype.position=function(a,b){var c=b.find(".select2-results");c.append(a)},c.prototype.sort=function(a){var b=this.options.get("sorter");return b(a)},c.prototype.setClasses=function(){var b=this;this.data.current(function(c){var d=a.map(c,function(a){return a.id.toString()}),e=b.$results.find(".select2-results__option[aria-selected]");e.each(function(){var b=a(this),c=a.data(this,"data");a.inArray(c.id,d)>-1?b.attr("aria-selected","true"):b.attr("aria-selected","false")});var f=e.filter("[aria-selected=true]");f.length>0?f.first().trigger("mouseenter"):e.first().trigger("mouseenter")})},c.prototype.showLoading=function(a){this.hideLoading();var b=this.options.get("translations").get("searching"),c={disabled:!0,loading:!0,text:b(a)},d=this.option(c);d.className+=" loading-results",this.$results.prepend(d)},c.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},c.prototype.option=function(b){var c=document.createElement("li");c.className="select2-results__option";var d={role:"treeitem","aria-selected":"false"};b.disabled&&(delete d["aria-selected"],d["aria-disabled"]="true"),null==b.id&&delete d["aria-selected"],null!=b._resultId&&(c.id=b._resultId),b.title&&(c.title=b.title),b.children&&(d.role="group",d["aria-label"]=b.text,delete d["aria-selected"]);for(var e in d){var f=d[e];c.setAttribute(e,f)}if(b.children){var g=a(c),h=document.createElement("strong");h.className="select2-results__group";{a(h)}this.template(b,h);for(var i=[],j=0;j<b.children.length;j++){var k=b.children[j],l=this.option(k);i.push(l)}var m=a("<ul></ul>",{"class":"select2-results__options select2-results__options--nested"});m.append(i),g.append(h),g.append(m)}else this.template(b,c);return a.data(c,"data",b),c},c.prototype.bind=function(b){var c=this,d=b.id+"-results";this.$results.attr("id",d),b.on("results:all",function(a){c.clear(),c.append(a.data),b.isOpen()&&c.setClasses()}),b.on("results:append",function(a){c.append(a.data),b.isOpen()&&c.setClasses()}),b.on("query",function(a){c.showLoading(a)}),b.on("select",function(){b.isOpen()&&c.setClasses()}),b.on("unselect",function(){b.isOpen()&&c.setClasses()}),b.on("open",function(){c.$results.attr("aria-expanded","true"),c.$results.attr("aria-hidden","false"),c.setClasses(),c.ensureHighlightVisible()}),b.on("close",function(){c.$results.attr("aria-expanded","false"),c.$results.attr("aria-hidden","true"),c.$results.removeAttr("aria-activedescendant")}),b.on("results:toggle",function(){var a=c.getHighlightedResults();0!==a.length&&a.trigger("mouseup")}),b.on("results:select",function(){var a=c.getHighlightedResults();if(0!==a.length){var b=a.data("data");"true"==a.attr("aria-selected")?c.trigger("close"):c.trigger("select",{data:b})}}),b.on("results:previous",function(){var a=c.getHighlightedResults(),b=c.$results.find("[aria-selected]"),d=b.index(a);if(0!==d){var e=d-1;0===a.length&&(e=0);var f=b.eq(e);f.trigger("mouseenter");var g=c.$results.offset().top,h=f.offset().top,i=c.$results.scrollTop()+(h-g);0===e?c.$results.scrollTop(0):0>h-g&&c.$results.scrollTop(i)}}),b.on("results:next",function(){var a=c.getHighlightedResults(),b=c.$results.find("[aria-selected]"),d=b.index(a),e=d+1;if(!(e>=b.length)){var f=b.eq(e);f.trigger("mouseenter");var g=c.$results.offset().top+c.$results.outerHeight(!1),h=f.offset().top+f.outerHeight(!1),i=c.$results.scrollTop()+h-g;0===e?c.$results.scrollTop(0):h>g&&c.$results.scrollTop(i)}}),b.on("results:focus",function(a){a.element.addClass("select2-results__option--highlighted")}),b.on("results:message",function(a){c.displayMessage(a)}),a.fn.mousewheel&&this.$results.on("mousewheel",function(a){var b=c.$results.scrollTop(),d=c.$results.get(0).scrollHeight-c.$results.scrollTop()+a.deltaY,e=a.deltaY>0&&b-a.deltaY<=0,f=a.deltaY<0&&d<=c.$results.height();e?(c.$results.scrollTop(0),a.preventDefault(),a.stopPropagation()):f&&(c.$results.scrollTop(c.$results.get(0).scrollHeight-c.$results.height()),a.preventDefault(),a.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[aria-selected]",function(b){var d=a(this),e=d.data("data");return"true"===d.attr("aria-selected")?void(c.options.get("multiple")?c.trigger("unselect",{originalEvent:b,data:e}):c.trigger("close")):void c.trigger("select",{originalEvent:b,data:e})}),this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(){var b=a(this).data("data");c.getHighlightedResults().removeClass("select2-results__option--highlighted"),c.trigger("results:focus",{data:b,element:a(this)})})},c.prototype.getHighlightedResults=function(){var a=this.$results.find(".select2-results__option--highlighted");return a},c.prototype.destroy=function(){this.$results.remove()},c.prototype.ensureHighlightVisible=function(){var a=this.getHighlightedResults();if(0!==a.length){var b=this.$results.find("[aria-selected]"),c=b.index(a),d=this.$results.offset().top,e=a.offset().top,f=this.$results.scrollTop()+(e-d),g=e-d;f-=2*a.outerHeight(!1),2>=c?this.$results.scrollTop(0):(g>this.$results.outerHeight()||0>g)&&this.$results.scrollTop(f)}},c.prototype.template=function(b,c){var d=this.options.get("templateResult"),e=this.options.get("escapeMarkup"),f=d(b);null==f?c.style.display="none":"string"==typeof f?c.innerHTML=e(f):a(c).append(f)},c}),a("select2/keys",[],function(){var a={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46};return a}),a("select2/selection/base",["jquery","../utils","../keys"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,b.Observable),d.prototype.render=function(){var b=a('<span class="select2-selection" role="combobox" aria-autocomplete="list" aria-haspopup="true" aria-expanded="false"></span>');return this._tabindex=0,null!=this.$element.data("old-tabindex")?this._tabindex=this.$element.data("old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),b.attr("title",this.$element.attr("title")),b.attr("tabindex",this._tabindex),this.$selection=b,b},d.prototype.bind=function(a){var b=this,d=(a.id+"-container",a.id+"-results");this.container=a,this.$selection.attr("aria-owns",d),this.$selection.on("focus",function(a){b.trigger("focus",a)}),this.$selection.on("blur",function(a){b.trigger("blur",a)}),this.$selection.on("keydown",function(a){b.trigger("keypress",a),a.which===c.SPACE&&a.preventDefault()}),a.on("results:focus",function(a){b.$selection.attr("aria-activedescendant",a.data._resultId)}),a.on("selection:update",function(a){b.update(a.data)}),a.on("open",function(){b.$selection.attr("aria-expanded","true"),b._attachCloseHandler(a)}),a.on("close",function(){b.$selection.attr("aria-expanded","false"),b.$selection.removeAttr("aria-activedescendant"),b.$selection.focus(),b._detachCloseHandler(a)}),a.on("enable",function(){b.$selection.attr("tabindex",b._tabindex)}),a.on("disable",function(){b.$selection.attr("tabindex","-1")})},d.prototype._attachCloseHandler=function(b){a(document.body).on("mousedown.select2."+b.id,function(b){var c=a(b.target),d=c.closest(".select2"),e=a(".select2.select2-container--open");e.each(function(){var b=a(this);if(this!=d[0]){var c=b.data("element");c.select2("close")}})})},d.prototype._detachCloseHandler=function(b){a(document.body).off("mousedown.select2."+b.id)},d.prototype.position=function(a,b){var c=b.find(".selection");c.append(a)},d.prototype.destroy=function(){this._detachCloseHandler(this.container)},d.prototype.update=function(){throw new Error("The `update` method must be defined in child classes.")},d}),a("select2/selection/single",["jquery","./base","../utils","../keys"],function(a,b,c){function d(){d.__super__.constructor.apply(this,arguments)}return c.Extend(d,b),d.prototype.render=function(){var a=d.__super__.render.call(this);return a.addClass("select2-selection--single"),a.html('<span class="select2-selection__rendered"></span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>'),a},d.prototype.bind=function(a){var b=this;d.__super__.bind.apply(this,arguments);var c=a.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",c),this.$selection.attr("aria-labelledby",c),this.$selection.on("mousedown",function(a){1===a.which&&b.trigger("toggle",{originalEvent:a})}),this.$selection.on("focus",function(){}),this.$selection.on("blur",function(){}),a.on("selection:update",function(a){b.update(a.data)})},d.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},d.prototype.display=function(a){var b=this.options.get("templateSelection"),c=this.options.get("escapeMarkup");return c(b(a))},d.prototype.selectionContainer=function(){return a("<span></span>")},d.prototype.update=function(a){if(0===a.length)return void this.clear();var b=a[0],c=this.display(b),d=this.$selection.find(".select2-selection__rendered");d.empty().append(c),d.prop("title",b.title||b.text)},d}),a("select2/selection/multiple",["jquery","./base","../utils"],function(a,b,c){function d(){d.__super__.constructor.apply(this,arguments)}return c.Extend(d,b),d.prototype.render=function(){var a=d.__super__.render.call(this);return a.addClass("select2-selection--multiple"),a.html('<ul class="select2-selection__rendered"></ul>'),a},d.prototype.bind=function(){var b=this;d.__super__.bind.apply(this,arguments),this.$selection.on("click",function(a){b.trigger("toggle",{originalEvent:a})}),this.$selection.on("click",".select2-selection__choice__remove",function(c){var d=a(this),e=d.parent(),f=e.data("data");b.trigger("unselect",{originalEvent:c,data:f})})},d.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},d.prototype.display=function(a){var b=this.options.get("templateSelection"),c=this.options.get("escapeMarkup");return c(b(a))},d.prototype.selectionContainer=function(){var b=a('<li class="select2-selection__choice"><span class="select2-selection__choice__remove" role="presentation">×</span></li>');return b},d.prototype.update=function(a){if(this.clear(),0!==a.length){for(var b=[],c=0;c<a.length;c++){var d=a[c],e=this.display(d),f=this.selectionContainer();f.append(e),f.prop("title",d.title||d.text),f.data("data",d),b.push(f)}this.$selection.find(".select2-selection__rendered").append(b)}},d}),a("select2/selection/placeholder",["../utils"],function(){function a(a,b,c){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c)}return a.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},a.prototype.createPlaceholder=function(a,b){var c=this.selectionContainer();return c.html(this.display(b)),c.addClass("select2-selection__placeholder").removeClass("select2-selection__choice"),c},a.prototype.update=function(a,b){var c=1==b.length&&b[0].id!=this.placeholder.id,d=b.length>1;if(d||c)return a.call(this,b);this.clear();var e=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(e)},a}),a("select2/selection/allowClear",["jquery"],function(a){function b(){}return b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),null==e.placeholder&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",function(b){if(!e.options.get("disabled")){b.stopPropagation();for(var c=a(this).data("data"),d=0;d<c.length;d++){var f={data:c[d]};if(e.trigger("unselect",f),f.prevented)return}e.$element.val(e.placeholder.id).trigger("change"),e.trigger("toggle")}})},b.prototype.update=function(b,c){if(b.call(this,c),!(this.$selection.find(".select2-selection__placeholder").length>0||0===c.length)){var d=a('<span class="select2-selection__clear">×</span>');d.data("data",c),this.$selection.find(".select2-selection__rendered").append(d)}},b}),a("select2/selection/search",["jquery","../utils","../keys"],function(a,b,c){function d(a,b,c){a.call(this,b,c)}return d.prototype.render=function(b){var c=a('<li class="select2-search select2-search--inline"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" /></li>');this.$searchContainer=c,this.$search=c.find("input");var d=b.call(this);return d},d.prototype.bind=function(a,b,d){var e=this;a.call(this,b,d),b.on("open",function(){e.$search.attr("tabindex",0),e.$search.focus()}),b.on("close",function(){e.$search.attr("tabindex",-1),e.$search.val(""),e.$search.focus()}),b.on("enable",function(){e.$search.prop("disabled",!1)}),b.on("disable",function(){e.$search.prop("disabled",!0)}),this.$selection.on("focusin",".select2-search--inline",function(a){e.trigger("focus",a)}),this.$selection.on("focusout",".select2-search--inline",function(a){e.trigger("blur",a)}),this.$selection.on("keydown",".select2-search--inline",function(a){a.stopPropagation(),e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented();var b=a.which;if(b===c.BACKSPACE&&""===e.$search.val()){var d=e.$searchContainer.prev(".select2-selection__choice");if(d.length>0){var f=d.data("data");e.searchRemoveChoice(f)}}}),this.$selection.on("input",".select2-search--inline",function(){e.$selection.off("keyup.search")}),this.$selection.on("keyup.search input",".select2-search--inline",function(a){e.handleSearch(a)})},d.prototype.createPlaceholder=function(a,b){this.$search.attr("placeholder",b.text)},d.prototype.update=function(a,b){this.$search.attr("placeholder",""),a.call(this,b),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch()},d.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var a=this.$search.val();this.trigger("query",{term:a})}this._keyUpPrevented=!1},d.prototype.searchRemoveChoice=function(a,b){this.trigger("unselect",{data:b}),this.trigger("open"),this.$search.val(b.text+" ")},d.prototype.resizeSearch=function(){this.$search.css("width","25px");var a="";if(""!==this.$search.attr("placeholder"))a=this.$selection.find(".select2-selection__rendered").innerWidth();else{var b=this.$search.val().length+1;a=.75*b+"em"}this.$search.css("width",a)},d}),a("select2/selection/eventRelay",["jquery"],function(a){function b(){}return b.prototype.bind=function(b,c,d){var e=this,f=["open","opening","close","closing","select","selecting","unselect","unselecting"],g=["opening","closing","selecting","unselecting"];b.call(this,c,d),c.on("*",function(b,c){if(-1!==a.inArray(b,f)){c=c||{};var d=a.Event("select2:"+b,{params:c});e.$element.trigger(d),-1!==a.inArray(b,g)&&(c.prevented=d.isDefaultPrevented())}})},b}),a("select2/translation",["jquery"],function(a){function c(a){this.dict=a||{}}return c.prototype.all=function(){return this.dict},c.prototype.get=function(a){return this.dict[a]},c.prototype.extend=function(b){this.dict=a.extend({},b.all(),this.dict)},c._cache={},c.loadPath=function(a){if(!(a in c._cache)){var d=b(a);c._cache[a]=d}return new c(c._cache[a])},c}),a("select2/diacritics",[],function(){var a={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"};return a}),a("select2/data/base",["../utils"],function(a){function b(){b.__super__.constructor.call(this)}return a.Extend(b,a.Observable),b.prototype.current=function(){throw new Error("The `current` method must be defined in child classes.")},b.prototype.query=function(){throw new Error("The `query` method must be defined in child classes.")},b.prototype.bind=function(){},b.prototype.destroy=function(){},b.prototype.generateResultId=function(b,c){var d=b.id+"-result-";return d+=a.generateChars(4),d+=null!=c.id?"-"+c.id.toString():"-"+a.generateChars(4)},b}),a("select2/data/select",["./base","../utils","jquery"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,a),d.prototype.current=function(a){var b=[],d=this;this.$element.find(":selected").each(function(){var a=c(this),e=d.item(a);b.push(e)}),a(b)},d.prototype.select=function(a){var b=this;if(c(a.element).is("option"))return a.element.selected=!0,void this.$element.trigger("change");if(this.$element.prop("multiple"))this.current(function(d){var e=[];a=[a],a.push.apply(a,d);for(var f=0;f<a.length;f++){var g=a[f].id;-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")});else{var d=a.id;this.$element.val(d),this.$element.trigger("change")}},d.prototype.unselect=function(a){var b=this;if(this.$element.prop("multiple"))return c(a.element).is("option")?(a.element.selected=!1,void this.$element.trigger("change")):void this.current(function(d){for(var e=[],f=0;f<d.length;f++){var g=d[f].id;g!==a.id&&-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")})},d.prototype.bind=function(a){var b=this;this.container=a,a.on("select",function(a){b.select(a.data)}),a.on("unselect",function(a){b.unselect(a.data)})},d.prototype.destroy=function(){this.$element.find("*").each(function(){c.removeData(this,"data")})},d.prototype.query=function(a,b){var d=[],e=this,f=this.$element.children();f.each(function(){var b=c(this);if(b.is("option")||b.is("optgroup")){var f=e.item(b),g=e.matches(a,f);null!==g&&d.push(g)}}),b({results:d})},d.prototype.addOptions=function(a){this.$element.append(a)},d.prototype.option=function(a){var b;a.children?(b=document.createElement("optgroup"),b.label=a.text):(b=document.createElement("option"),void 0!==b.textContent?b.textContent=a.text:b.innerText=a.text),a.id&&(b.value=a.id),a.disabled&&(b.disabled=!0),a.selected&&(b.selected=!0),a.title&&(b.title=a.title);var d=c(b),e=this._normalizeItem(a);return e.element=b,c.data(b,"data",e),d},d.prototype.item=function(a){var b={};if(b=c.data(a[0],"data"),null!=b)return b;if(a.is("option"))b={id:a.val(),text:a.html(),disabled:a.prop("disabled"),selected:a.prop("selected"),title:a.prop("title")};else if(a.is("optgroup")){b={text:a.prop("label"),children:[],title:a.prop("title")};for(var d=a.children("option"),e=[],f=0;f<d.length;f++){var g=c(d[f]),h=this.item(g);e.push(h)}b.children=e}return b=this._normalizeItem(b),b.element=a[0],c.data(a[0],"data",b),b},d.prototype._normalizeItem=function(a){c.isPlainObject(a)||(a={id:a,text:a}),a=c.extend({},{text:""},a);var b={selected:!1,disabled:!1};return null!=a.id&&(a.id=a.id.toString()),null!=a.text&&(a.text=a.text.toString()),null==a._resultId&&a.id&&null!=this.container&&(a._resultId=this.generateResultId(this.container,a)),c.extend({},b,a)},d.prototype.matches=function(a,b){var c=this.options.get("matcher");return c(a,b)},d}),a("select2/data/array",["./select","../utils","jquery"],function(a,b,c){function d(a,b){var c=b.get("data")||[]; -d.__super__.constructor.call(this,a,b),this.addOptions(this.convertToOptions(c))}return b.Extend(d,a),d.prototype.select=function(a){var b=this.$element.find('option[value="'+a.id+'"]');0===b.length&&(b=this.option(a),this.addOptions([b])),d.__super__.select.call(this,a)},d.prototype.convertToOptions=function(a){function b(a){return function(){return c(this).val()==a.id}}for(var d=this,e=this.$element.find("option"),f=e.map(function(){return d.item(c(this)).id}).get(),g=[],h=0;h<a.length;h++){var i=this._normalizeItem(a[h]);if(c.inArray(i.id,f)>=0){var j=e.filter(b(i)),k=this.item(j),l=(c.extend(!0,{},k,i),this.option(k));j.replaceWith(l)}else{var m=this.option(i);if(i.children){var n=this.convertToOptions(i.children);m.append(n)}g.push(m)}}return g},d}),a("select2/data/ajax",["./array","../utils","jquery"],function(a,b,c){function d(b,c){this.ajaxOptions=this._applyDefaults(c.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),a.__super__.constructor.call(this,b,c)}return b.Extend(d,a),d.prototype._applyDefaults=function(a){var b={data:function(a){return{q:a.term}},transport:function(a,b,d){var e=c.ajax(a);return e.then(b),e.fail(d),e}};return c.extend({},b,a,!0)},d.prototype.processResults=function(a){return a},d.prototype.query=function(a,b){function d(){var d=f.transport(f,function(d){var f=e.processResults(d,a);window.console&&console.error&&(f&&f.results&&c.isArray(f.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),b(f)},function(){});e._request=d}var e=this;this._request&&(this._request.abort(),this._request=null);var f=c.extend({type:"GET"},this.ajaxOptions);"function"==typeof f.url&&(f.url=f.url(a)),"function"==typeof f.data&&(f.data=f.data(a)),this.ajaxOptions.delay&&""!==a.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(d,this.ajaxOptions.delay)):d()},d}),a("select2/data/tags",["jquery"],function(a){function b(b,c,d){var e=d.get("tags"),f=d.get("createTag");if(void 0!==f&&(this.createTag=f),b.call(this,c,d),a.isArray(e))for(var g=0;g<e.length;g++){var h=e[g],i=this._normalizeItem(h),j=this.option(i);this.$element.append(j)}}return b.prototype.query=function(a,b,c){function d(a,f){for(var g=a.results,h=0;h<g.length;h++){var i=g[h],j=null!=i.children&&!d({results:i.children},!0),k=i.text===b.term;if(k||j)return f?!1:(a.data=g,void c(a))}if(f)return!0;var l=e.createTag(b);if(null!=l){var m=e.option(l);m.attr("data-select2-tag",!0),e.addOptions([m]),e.insertTag(g,l)}a.results=g,c(a)}var e=this;return this._removeOldTags(),null==b.term||""===b.term||null!=b.page?void a.call(this,b,c):void a.call(this,b,d)},b.prototype.createTag=function(a,b){return{id:b.term,text:b.term}},b.prototype.insertTag=function(a,b,c){b.unshift(c)},b.prototype._removeOldTags=function(){var b=(this._lastTag,this.$element.find("option[data-select2-tag]"));b.each(function(){this.selected||a(this).remove()})},b}),a("select2/data/tokenizer",["jquery"],function(a){function b(a,b,c){var d=c.get("tokenizer");void 0!==d&&(this.tokenizer=d),a.call(this,b,c)}return b.prototype.bind=function(a,b,c){a.call(this,b,c),this.$search=b.dropdown.$search||b.selection.$search||c.find(".select2-search__field")},b.prototype.query=function(a,b,c){function d(a){e.select(a)}var e=this;b.term=b.term||"";var f=this.tokenizer(b,this.options,d);f.term!==b.term&&(this.$search.length&&(this.$search.val(f.term),this.$search.focus()),b.term=f.term),a.call(this,b,c)},b.prototype.tokenizer=function(b,c,d,e){for(var f=d.get("tokenSeparators")||[],g=c.term,h=0,i=this.createTag||function(a){return{id:a.term,text:a.term}};h<g.length;){var j=g[h];if(-1!==a.inArray(j,f)){var k=g.substr(0,h),l=a.extend({},c,{term:k}),m=i(l);e(m),g=g.substr(h+1)||"",h=0}else h++}return{term:g}},b}),a("select2/data/minimumInputLength",[],function(){function a(a,b,c){this.minimumInputLength=c.get("minimumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){return b.term=b.term||"",b.term.length<this.minimumInputLength?void this.trigger("results:message",{message:"inputTooShort",args:{minimum:this.minimumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),a("select2/data/maximumInputLength",[],function(){function a(a,b,c){this.maximumInputLength=c.get("maximumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){return b.term=b.term||"",this.maximumInputLength>0&&b.term.length>this.maximumInputLength?void this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),a("select2/data/maximumSelectionLength",[],function(){function a(a,b,c){this.maximumSelectionLength=c.get("maximumSelectionLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){var d=this;this.current(function(e){var f=null!=e?e.length:0;return d.maximumSelectionLength>0&&f>=d.maximumSelectionLength?void d.trigger("results:message",{message:"maximumSelected",args:{maximum:d.maximumSelectionLength}}):void a.call(d,b,c)})},a}),a("select2/dropdown",["jquery","./utils"],function(a,b){function c(a,b){this.$element=a,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<span class="select2-dropdown"><span class="select2-results"></span></span>');return b.attr("dir",this.options.get("dir")),this.$dropdown=b,b},c.prototype.position=function(){},c.prototype.destroy=function(){this.$dropdown.remove()},c}),a("select2/dropdown/search",["jquery","../utils"],function(a){function b(){}return b.prototype.render=function(b){var c=b.call(this),d=a('<span class="select2-search select2-search--dropdown"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" /></span>');return this.$searchContainer=d,this.$search=d.find("input"),c.prepend(d),c},b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),this.$search.on("keydown",function(a){e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented()}),this.$search.on("input",function(){a(this).off("keyup")}),this.$search.on("keyup input",function(a){e.handleSearch(a)}),c.on("open",function(){e.$search.attr("tabindex",0),e.$search.focus(),window.setTimeout(function(){e.$search.focus()},0)}),c.on("close",function(){e.$search.attr("tabindex",-1),e.$search.val("")}),c.on("results:all",function(a){if(null==a.query.term||""===a.query.term){var b=e.showSearch(a);b?e.$searchContainer.removeClass("select2-search--hide"):e.$searchContainer.addClass("select2-search--hide")}})},b.prototype.handleSearch=function(){if(!this._keyUpPrevented){var a=this.$search.val();this.trigger("query",{term:a})}this._keyUpPrevented=!1},b.prototype.showSearch=function(){return!0},b}),a("select2/dropdown/hidePlaceholder",[],function(){function a(a,b,c,d){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c,d)}return a.prototype.append=function(a,b){b.results=this.removePlaceholder(b.results),a.call(this,b)},a.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},a.prototype.removePlaceholder=function(a,b){for(var c=b.slice(0),d=b.length-1;d>=0;d--){var e=b[d];this.placeholder.id===e.id&&c.splice(d,1)}return c},a}),a("select2/dropdown/infiniteScroll",["jquery"],function(a){function b(a,b,c,d){this.lastParams={},a.call(this,b,c,d),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return b.prototype.append=function(a,b){this.$loadingMore.remove(),this.loading=!1,a.call(this,b),this.showLoadingMore(b)&&this.$results.append(this.$loadingMore)},b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),c.on("query",function(a){e.lastParams=a,e.loading=!0}),c.on("query:append",function(a){e.lastParams=a,e.loading=!0}),this.$results.on("scroll",function(){var b=a.contains(document.documentElement,e.$loadingMore[0]);if(!e.loading&&b){var c=e.$results.offset().top+e.$results.outerHeight(!1),d=e.$loadingMore.offset().top+e.$loadingMore.outerHeight(!1);c+50>=d&&e.loadMore()}})},b.prototype.loadMore=function(){this.loading=!0;var b=a.extend({},{page:1},this.lastParams);b.page++,this.trigger("query:append",b)},b.prototype.showLoadingMore=function(a,b){return b.pagination&&b.pagination.more},b.prototype.createLoadingMore=function(){var b=a('<li class="option load-more" role="treeitem"></li>'),c=this.options.get("translations").get("loadingMore");return b.html(c(this.lastParams)),b},b}),a("select2/dropdown/attachBody",["jquery","../utils"],function(a,b){function c(a,b,c){this.$dropdownParent=c.get("dropdownParent")||document.body,a.call(this,b,c)}return c.prototype.bind=function(a,b,c){var d=this,e=!1;a.call(this,b,c),b.on("open",function(){d._showDropdown(),d._attachPositioningHandler(b),e||(e=!0,b.on("results:all",function(){d._positionDropdown(),d._resizeDropdown()}),b.on("results:append",function(){d._positionDropdown(),d._resizeDropdown()}))}),b.on("close",function(){d._hideDropdown(),d._detachPositioningHandler(b)}),this.$dropdownContainer.on("mousedown",function(a){a.stopPropagation()})},c.prototype.position=function(a,b,c){b.attr("class",c.attr("class")),b.removeClass("select2"),b.addClass("select2-container--open"),b.css({position:"absolute",top:-999999}),this.$container=c},c.prototype.render=function(b){var c=a("<span></span>"),d=b.call(this);return c.append(d),this.$dropdownContainer=c,c},c.prototype._hideDropdown=function(){this.$dropdownContainer.detach()},c.prototype._attachPositioningHandler=function(c){var d=this,e="scroll.select2."+c.id,f="resize.select2."+c.id,g="orientationchange.select2."+c.id,h=this.$container.parents().filter(b.hasScroll);h.each(function(){a(this).data("select2-scroll-position",{x:a(this).scrollLeft(),y:a(this).scrollTop()})}),h.on(e,function(){var b=a(this).data("select2-scroll-position");a(this).scrollTop(b.y)}),a(window).on(e+" "+f+" "+g,function(){d._positionDropdown(),d._resizeDropdown()})},c.prototype._detachPositioningHandler=function(c){var d="scroll.select2."+c.id,e="resize.select2."+c.id,f="orientationchange.select2."+c.id,g=this.$container.parents().filter(b.hasScroll);g.off(d),a(window).off(d+" "+e+" "+f)},c.prototype._positionDropdown=function(){var b=a(window),c=this.$dropdown.hasClass("select2-dropdown--above"),d=this.$dropdown.hasClass("select2-dropdown--below"),e=null,f=(this.$container.position(),this.$container.offset());f.bottom=f.top+this.$container.outerHeight(!1);var g={height:this.$container.outerHeight(!1)};g.top=f.top,g.bottom=f.top+g.height;var h={height:this.$dropdown.outerHeight(!1)},i={top:b.scrollTop(),bottom:b.scrollTop()+b.height()},j=i.top<f.top-h.height,k=i.bottom>f.bottom+h.height,l={left:f.left,top:g.bottom};c||d||(e="below"),k||!j||c?!j&&k&&c&&(e="below"):e="above",("above"==e||c&&"below"!==e)&&(l.top=g.top-h.height),null!=e&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+e),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+e)),this.$dropdownContainer.css(l)},c.prototype._resizeDropdown=function(){this.$dropdownContainer.width(),this.$dropdown.css({width:this.$container.outerWidth(!1)+"px"})},c.prototype._showDropdown=function(){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},c}),a("select2/dropdown/minimumResultsForSearch",[],function(){function a(b){for(var c=0,d=0;d<b.length;d++){var e=b[d];e.children?c+=a(e.children):c++}return c}function b(a,b,c,d){this.minimumResultsForSearch=c.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),a.call(this,b,c,d)}return b.prototype.showSearch=function(b,c){return a(c.data.results)<this.minimumResultsForSearch?!1:b.call(this,c)},b}),a("select2/dropdown/selectOnClose",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("close",function(){d._handleSelectOnClose()})},a.prototype._handleSelectOnClose=function(){var a=this.getHighlightedResults();a.length<1||a.trigger("mouseup")},a}),a("select2/dropdown/closeOnSelect",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("select",function(a){d._selectTriggered(a)}),b.on("unselect",function(a){d._selectTriggered(a)})},a.prototype._selectTriggered=function(a,b){var c=b.originalEvent;c&&c.ctrlKey||this.trigger("close")},a}),a("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(a){var b=a.input.length-a.maximum,c="Please delete "+b+" character";return 1!=b&&(c+="s"),c},inputTooShort:function(a){var b=a.minimum-a.input.length,c="Please enter "+b+" or more characters";return c},loadingMore:function(){return"Loading more results…"},maximumSelected:function(a){var b="You can only select "+a.maximum+" item";return 1!=a.maximum&&(b+="s"),b},noResults:function(){return"No results found"},searching:function(){return"Searching…"}}}),a("select2/defaults",["jquery","./results","./selection/single","./selection/multiple","./selection/placeholder","./selection/allowClear","./selection/search","./selection/eventRelay","./utils","./translation","./diacritics","./data/select","./data/array","./data/ajax","./data/tags","./data/tokenizer","./data/minimumInputLength","./data/maximumInputLength","./data/maximumSelectionLength","./dropdown","./dropdown/search","./dropdown/hidePlaceholder","./dropdown/infiniteScroll","./dropdown/attachBody","./dropdown/minimumResultsForSearch","./dropdown/selectOnClose","./dropdown/closeOnSelect","./i18n/en"],function(a,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C){function D(){this.reset()}D.prototype.apply=function(l){if(l=a.extend({},this.defaults,l),null==l.dataAdapter){if(l.dataAdapter=null!=l.ajax?o:null!=l.data?n:m,l.minimumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,r)),l.maximumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,s)),l.maximumSelectionLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,t)),null!=l.tags&&(l.dataAdapter=j.Decorate(l.dataAdapter,p)),(null!=l.tokenSeparators||null!=l.tokenizer)&&(l.dataAdapter=j.Decorate(l.dataAdapter,q)),null!=l.query){var C=b(l.amdBase+"compat/query");l.dataAdapter=j.Decorate(l.dataAdapter,C)}if(null!=l.initSelection){var D=b(l.amdBase+"compat/initSelection");l.dataAdapter=j.Decorate(l.dataAdapter,D)}}if(null==l.resultsAdapter&&(l.resultsAdapter=c,null!=l.ajax&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,x)),null!=l.placeholder&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,w)),l.selectOnClose&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,A))),null==l.dropdownAdapter){if(l.multiple)l.dropdownAdapter=u;else{var E=j.Decorate(u,v);l.dropdownAdapter=E}0!==l.minimumResultsForSearch&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,z)),l.closeOnSelect&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,B)),l.dropdownAdapter=j.Decorate(l.dropdownAdapter,y)}if(null==l.selectionAdapter&&(l.selectionAdapter=l.multiple?e:d,null!=l.placeholder&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,f)),l.allowClear&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,g)),l.multiple&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,h)),l.selectionAdapter=j.Decorate(l.selectionAdapter,i)),"string"==typeof l.language)if(l.language.indexOf("-")>0){var F=l.language.split("-"),G=F[0];l.language=[l.language,G]}else l.language=[l.language];if(a.isArray(l.language)){var H=new k;l.language.push("en");for(var I=l.language,J=0;J<I.length;J++){var K=I[J],L={};try{L=k.loadPath(K)}catch(M){try{K=this.defaults.amdLanguageBase+K,L=k.loadPath(K)}catch(N){window.console&&console.warn&&console.warn('Select2: The lanugage file for "'+K+'" could not be automatically loaded. A fallback will be used instead.');continue}}H.extend(L)}l.translations=H}else l.translations=new k(l.language);return l},D.prototype.reset=function(){function b(a){function b(a){return l[a]||a}return a.replace(/[^\u0000-\u007E]/g,b)}function c(d,e){if(""===a.trim(d.term))return e;if(e.children&&e.children.length>0){for(var f=a.extend(!0,{},e),g=e.children.length-1;g>=0;g--){var h=e.children[g],i=c(d,h);null==i&&f.children.splice(g,1)}return f.children.length>0?f:c(d,f)}var j=b(e.text).toUpperCase(),k=b(d.term).toUpperCase();return j.indexOf(k)>-1?e:null}this.defaults={amdBase:"select2/",amdLanguageBase:"select2/i18n/",closeOnSelect:!0,escapeMarkup:j.escapeMarkup,language:C,matcher:c,minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,sorter:function(a){return a},templateResult:function(a){return a.text},templateSelection:function(a){return a.text},theme:"default",width:"resolve"}},D.prototype.set=function(b,c){var d=a.camelCase(b),e={};e[d]=c;var f=j._convertData(e);a.extend(this.defaults,f)};var E=new D;return E}),a("select2/options",["jquery","./defaults","./utils"],function(a,c,d){function e(a,e){if(this.options=a,null!=e&&this.fromElement(e),this.options=c.apply(this.options),e&&e.is("input")){var f=b(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=d.Decorate(this.options.dataAdapter,f)}}return e.prototype.fromElement=function(b){var c=["select2"];null==this.options.multiple&&(this.options.multiple=b.prop("multiple")),null==this.options.disabled&&(this.options.disabled=b.prop("disabled")),null==this.options.language&&(b.prop("lang")?this.options.language=b.prop("lang").toLowerCase():b.closest("[lang]").prop("lang")&&(this.options.language=b.closest("[lang]").prop("lang"))),null==this.options.dir&&(this.options.dir=b.prop("dir")?b.prop("dir"):b.closest("[dir]").prop("dir")?b.closest("[dir]").prop("dir"):"ltr"),b.prop("disabled",this.options.disabled),b.prop("multiple",this.options.multiple),b.data("select2Tags")&&(window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),b.data("data",b.data("select2Tags")),b.data("tags",!0)),b.data("ajaxUrl")&&(window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),b.data("ajax-Url",b.data("ajaxUrl")));var e={};e=a.fn.jquery&&"1."==a.fn.jquery.substr(0,2)&&b[0].dataset?a.extend(!0,{},b[0].dataset,b.data()):b.data();var f=a.extend(!0,{},e);f=d._convertData(f);for(var g in f)a.inArray(g,c)>-1||(a.isPlainObject(this.options[g])?a.extend(this.options[g],f[g]):this.options[g]=f[g]);return this},e.prototype.get=function(a){return this.options[a]},e.prototype.set=function(a,b){this.options[a]=b},e}),a("select2/core",["jquery","./options","./utils","./keys"],function(a,b,c,d){var e=function(a,c){null!=a.data("select2")&&a.data("select2").destroy(),this.$element=a,this.id=this._generateId(a),c=c||{},this.options=new b(c,a),e.__super__.constructor.call(this);var d=a.attr("tabindex")||0;a.data("old-tabindex",d),a.attr("tabindex","-1");var f=this.options.get("dataAdapter");this.data=new f(a,this.options);var g=this.render();this._placeContainer(g);var h=this.options.get("selectionAdapter");this.selection=new h(a,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,g);var i=this.options.get("dropdownAdapter");this.dropdown=new i(a,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,g);var j=this.options.get("resultsAdapter");this.results=new j(a,this.options,this.data),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var k=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.data.current(function(a){k.trigger("selection:update",{data:a})}),a.hide(),this._syncAttributes(),a.data("select2",this)};return c.Extend(e,c.Observable),e.prototype._generateId=function(a){var b="";return b=null!=a.attr("id")?a.attr("id"):null!=a.attr("name")?a.attr("name")+"-"+c.generateChars(2):c.generateChars(4),b="select2-"+b},e.prototype._placeContainer=function(a){a.insertAfter(this.$element);var b=this._resolveWidth(this.$element,this.options.get("width"));null!=b&&a.css("width",b)},e.prototype._resolveWidth=function(a,b){var c=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==b){var d=this._resolveWidth(a,"style");return null!=d?d:this._resolveWidth(a,"element")}if("element"==b){var e=a.outerWidth(!1);return 0>=e?"auto":e+"px"}if("style"==b){var f=a.attr("style");if("string"!=typeof f)return null;for(var g=f.split(";"),h=0,i=g.length;i>h;h+=1){var j=g[h].replace(/\s/g,""),k=j.match(c);if(null!==k&&k.length>=1)return k[1]}return null}return b},e.prototype._bindAdapters=function(){this.data.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},e.prototype._registerDomEvents=function(){var b=this;this.$element.on("change.select2",function(){b.data.current(function(a){b.trigger("selection:update",{data:a})})}),this._sync=c.bind(this._syncAttributes,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._sync);var d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=d?(this._observer=new d(function(c){a.each(c,b._sync)}),this._observer.observe(this.$element[0],{attributes:!0,subtree:!1})):this.$element[0].addEventListener&&this.$element[0].addEventListener("DOMAttrModified",b._sync,!1)},e.prototype._registerDataEvents=function(){var a=this;this.data.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerSelectionEvents=function(){var b=this,c=["toggle"];this.selection.on("toggle",function(){b.toggleDropdown()}),this.selection.on("*",function(d,e){-1===a.inArray(d,c)&&b.trigger(d,e)})},e.prototype._registerDropdownEvents=function(){var a=this;this.dropdown.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerResultsEvents=function(){var a=this;this.results.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerEvents=function(){var a=this;this.on("open",function(){a.$container.addClass("select2-container--open")}),this.on("close",function(){a.$container.removeClass("select2-container--open")}),this.on("enable",function(){a.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){a.$container.addClass("select2-container--disabled")}),this.on("focus",function(){a.$container.addClass("select2-container--focus")}),this.on("blur",function(){a.$container.removeClass("select2-container--focus")}),this.on("query",function(b){a.isOpen()||a.trigger("open"),this.data.query(b,function(c){a.trigger("results:all",{data:c,query:b})})}),this.on("query:append",function(b){this.data.query(b,function(c){a.trigger("results:append",{data:c,query:b})})}),this.on("keypress",function(b){var c=b.which;a.isOpen()?c===d.ENTER?(a.trigger("results:select"),b.preventDefault()):c===d.SPACE&&b.ctrlKey?(a.trigger("results:toggle"),b.preventDefault()):c===d.UP?(a.trigger("results:previous"),b.preventDefault()):c===d.DOWN?(a.trigger("results:next"),b.preventDefault()):(c===d.ESC||c===d.TAB)&&(a.close(),b.preventDefault()):(c===d.ENTER||c===d.SPACE||(c===d.DOWN||c===d.UP)&&b.altKey)&&(a.open(),b.preventDefault())})},e.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.options.get("disabled")?(this.isOpen()&&this.close(),this.trigger("disable")):this.trigger("enable")},e.prototype.trigger=function(a,b){var c=e.__super__.trigger,d={open:"opening",close:"closing",select:"selecting",unselect:"unselecting"};if(a in d){var f=d[a],g={prevented:!1,name:a,args:b};if(c.call(this,f,g),g.prevented)return void(b.prevented=!0)}c.call(this,a,b)},e.prototype.toggleDropdown=function(){this.options.get("disabled")||(this.isOpen()?this.close():this.open())},e.prototype.open=function(){this.isOpen()||(this.trigger("query",{}),this.trigger("open"))},e.prototype.close=function(){this.isOpen()&&this.trigger("close")},e.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},e.prototype.enable=function(a){window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),0===a.length&&(a=[!0]);var b=!a[0];this.$element.prop("disabled",b)},e.prototype.data=function(){arguments.length>0&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var a=[];return this.dataAdpater.current(function(b){a=b}),a},e.prototype.val=function(b){if(window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),0===b.length)return this.$element.val();var c=b[0];a.isArray(c)&&(c=a.map(c,function(a){return a.toString()})),this.$element.val(c).trigger("change")},e.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._sync),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&this.$element[0].removeEventListener("DOMAttrModified",this._sync,!1),this._sync=null,this.$element.off(".select2"),this.$element.attr("tabindex",this.$element.data("old-tabindex")),this.$element.show(),this.$element.removeData("select2"),this.data.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.data=null,this.selection=null,this.dropdown=null,this.results=null},e.prototype.render=function(){var b=a('<span class="select2 select2-container"><span class="selection"></span><span class="dropdown-wrapper" aria-hidden="true"></span></span>');return b.attr("dir",this.options.get("dir")),this.$container=b,this.$container.addClass("select2-container--"+this.options.get("theme")),b.data("element",this.$element),b},e}),function(b){"function"==typeof a&&a.amd?a("jquery.mousewheel",["jquery"],b):"object"==typeof exports?module.exports=b:b(jQuery)}(function(a){function b(b){var g=b||window.event,h=i.call(arguments,1),j=0,l=0,m=0,n=0,o=0,p=0;if(b=a.event.fix(g),b.type="mousewheel","detail"in g&&(m=-1*g.detail),"wheelDelta"in g&&(m=g.wheelDelta),"wheelDeltaY"in g&&(m=g.wheelDeltaY),"wheelDeltaX"in g&&(l=-1*g.wheelDeltaX),"axis"in g&&g.axis===g.HORIZONTAL_AXIS&&(l=-1*m,m=0),j=0===m?l:m,"deltaY"in g&&(m=-1*g.deltaY,j=m),"deltaX"in g&&(l=g.deltaX,0===m&&(j=-1*l)),0!==m||0!==l){if(1===g.deltaMode){var q=a.data(this,"mousewheel-line-height");j*=q,m*=q,l*=q}else if(2===g.deltaMode){var r=a.data(this,"mousewheel-page-height");j*=r,m*=r,l*=r}if(n=Math.max(Math.abs(m),Math.abs(l)),(!f||f>n)&&(f=n,d(g,n)&&(f/=40)),d(g,n)&&(j/=40,l/=40,m/=40),j=Math[j>=1?"floor":"ceil"](j/f),l=Math[l>=1?"floor":"ceil"](l/f),m=Math[m>=1?"floor":"ceil"](m/f),k.settings.normalizeOffset&&this.getBoundingClientRect){var s=this.getBoundingClientRect();o=b.clientX-s.left,p=b.clientY-s.top}return b.deltaX=l,b.deltaY=m,b.deltaFactor=f,b.offsetX=o,b.offsetY=p,b.deltaMode=0,h.unshift(b,j,l,m),e&&clearTimeout(e),e=setTimeout(c,200),(a.event.dispatch||a.event.handle).apply(this,h)}}function c(){f=null}function d(a,b){return k.settings.adjustOldDeltas&&"mousewheel"===a.type&&b%120===0}var e,f,g=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],h="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],i=Array.prototype.slice;if(a.event.fixHooks)for(var j=g.length;j;)a.event.fixHooks[g[--j]]=a.event.mouseHooks;var k=a.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var c=h.length;c;)this.addEventListener(h[--c],b,!1);else this.onmousewheel=b;a.data(this,"mousewheel-line-height",k.getLineHeight(this)),a.data(this,"mousewheel-page-height",k.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var c=h.length;c;)this.removeEventListener(h[--c],b,!1);else this.onmousewheel=null;a.removeData(this,"mousewheel-line-height"),a.removeData(this,"mousewheel-page-height")},getLineHeight:function(b){var c=a(b),d=c["offsetParent"in a.fn?"offsetParent":"parent"]();return d.length||(d=a("body")),parseInt(d.css("fontSize"),10)||parseInt(c.css("fontSize"),10)||16},getPageHeight:function(b){return a(b).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})}),a("select2/compat/matcher",["jquery"],function(a){function b(b){function c(c,d){var e=a.extend(!0,{},d);if(null==c.term||""===a.trim(c.term))return e;if(d.children){for(var f=d.children.length-1;f>=0;f--){var g=d.children[f],h=b(c.term,g.text,g);h||e.children.splice(f,1)}if(e.children.length>0)return e}return b(c.term,d.text,d)?e:null}return c}return b}),a("select2/compat/initSelection",["jquery"],function(a){function b(a,b,c){window.console&&console.warn&&console.warn("Select2: The `initSelection` option has been deprecated in favor of a custom data adapter that overrides the `current` method. This method is now called multiple times instead of a single time when the instance is initialized. Support will be removed for the `initSelection` option in future versions of Select2"),this.initSelection=c.get("initSelection"),this._isInitialized=!1,a.call(this,b,c)}return b.prototype.current=function(b,c){var d=this;return this._isInitialized?void b.call(this,c):void this.initSelection.call(null,this.$element,function(b){d._isInitialized=!0,a.isArray(b)||(b=[b]),c(b)})},b}),a("select2/compat/inputData",["jquery"],function(a){function b(a,b,c){this._currentData=[],this._valueSeparator=c.get("valueSeparator")||",","hidden"===b.prop("type")&&console&&console.warn&&console.warn("Select2: Using a hidden input with Select2 is no longer supported and may stop working in the future. It is recommended to use a `<select>` element instead."),a.call(this,b,c)}return b.prototype.current=function(b,c){function d(b,c){var e=[];return b.selected||-1!==a.inArray(b.id,c)?(b.selected=!0,e.push(b)):b.selected=!1,b.children&&e.push.apply(e,d(b.children,c)),e}for(var e=[],f=0;f<this._currentData.length;f++){var g=this._currentData[f];e.push.apply(e,d(g,this.$element.val().split(this._valueSeparator)))}c(e)},b.prototype.select=function(b,c){if(this.options.get("multiple")){var d=this.$element.val();d+=this._valueSeparator+c.id,this.$element.val(d),this.$element.trigger("change")}else this.current(function(b){a.map(b,function(a){a.selected=!1})}),this.$element.val(c.id),this.$element.trigger("change")},b.prototype.unselect=function(a,b){var c=this;b.selected=!1,this.current(function(a){for(var d=[],e=0;a>e;e++){var f=a[e];b.id!=f.id&&d.push(b.id)}c.$element.val(d.join(c._valueSeparator)),c.$element.trigger("change")})},b.prototype.query=function(a,b,c){for(var d=[],e=0;e<this._currentData.length;e++){var f=this._currentData[e],g=this.matches(b,f);null!==g&&d.push(g)}c({results:d})},b.prototype.addOptions=function(b,c){var d=a.map(c,function(b){return a.data(b[0],"data")});this._currentData.push.apply(this._currentData,d)},b}),a("select2/compat/query",[],function(){function a(a,b,c){window.console&&console.warn&&console.warn("Select2: The `query` option has been deprecated in favor of a custom data adapter that overrides the `query` method. Support will be removed for the `query` option in future versions of Select2."),a.call(this,b,c)}return a.prototype.query=function(a,b,c){b.callback=c; -var d=this.options.get("query");d.call(null,b)},a}),a("select2/dropdown/attachContainer",[],function(){function a(a,b,c){a.call(this,b,c)}return a.prototype.position=function(a,b,c){var d=c.find(".dropdown-wrapper");d.append(b),b.addClass("select2-dropdown--below"),c.addClass("select2-container--below")},a}),a("select2/dropdown/stopPropagation",[],function(){function a(){}return a.prototype.bind=function(a,b,c){a.call(this,b,c);var d=["blur","change","click","dblclick","focus","focusin","focusout","input","keydown","keyup","keypress","mousedown","mouseenter","mouseleave","mousemove","mouseover","mouseup","search","touchend","touchstart"];this.$dropdown.on(d.join(" "),function(a){a.stopPropagation()})},a}),a("select2/selection/stopPropagation",[],function(){function a(){}return a.prototype.bind=function(a,b,c){a.call(this,b,c);var d=["blur","change","click","dblclick","focus","focusin","focusout","input","keydown","keyup","keypress","mousedown","mouseenter","mouseleave","mousemove","mouseover","mouseup","search","touchend","touchstart"];this.$selection.on(d.join(" "),function(a){a.stopPropagation()})},a}),a("jquery.select2",["jquery","./select2/core","./select2/defaults"],function(a,c,d){try{b("jquery.mousewheel")}catch(e){}return null==a.fn.select2&&(a.fn.select2=function(b){if(b=b||{},"object"==typeof b)return this.each(function(){{var d=a.extend({},b,!0);new c(a(this),d)}}),this;if("string"==typeof b){var d=this.data("select2"),e=Array.prototype.slice.call(arguments,1);return d[b](e)}throw new Error("Invalid arguments for Select2: "+b)}),null==a.fn.select2.defaults&&(a.fn.select2.defaults=d),c}),b("jquery.select2"),jQuery.fn.select2.amd={define:a,require:b}}();
\ No newline at end of file diff --git a/public/vendor/select2/js/select2.js b/public/vendor/select2/js/select2.js deleted file mode 100755 index 8dbea071..00000000 --- a/public/vendor/select2/js/select2.js +++ /dev/null @@ -1,5205 +0,0 @@ -(function() { if (window.define) { var define = window.define; } if (window.require) { var require = window.require; } if (window.jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) { var define = jQuery.fn.select2.amd.define; var require = jQuery.fn.select2.amd.require; }/** - * @license almond 0.2.9 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved. - * Available via the MIT or new BSD license. - * see: http://github.com/jrburke/almond for details - */ -//Going sloppy to avoid 'use strict' string cost, but strict practices should -//be followed. -/*jslint sloppy: true */ -/*global setTimeout: false */ - -var requirejs, require, define; -(function (undef) { - var main, req, makeMap, handlers, - defined = {}, - waiting = {}, - config = {}, - defining = {}, - hasOwn = Object.prototype.hasOwnProperty, - aps = [].slice, - jsSuffixRegExp = /\.js$/; - - function hasProp(obj, prop) { - return hasOwn.call(obj, prop); - } - - /** - * Given a relative module name, like ./something, normalize it to - * a real name that can be mapped to a path. - * @param {String} name the relative name - * @param {String} baseName a real name that the name arg is relative - * to. - * @returns {String} normalized name - */ - function normalize(name, baseName) { - var nameParts, nameSegment, mapValue, foundMap, lastIndex, - foundI, foundStarMap, starI, i, j, part, - baseParts = baseName && baseName.split("/"), - map = config.map, - starMap = (map && map['*']) || {}; - - //Adjust any relative paths. - if (name && name.charAt(0) === ".") { - //If have a base name, try to normalize against it, - //otherwise, assume it is a top-level require that will - //be relative to baseUrl in the end. - if (baseName) { - //Convert baseName to array, and lop off the last part, - //so that . matches that "directory" and not name of the baseName's - //module. For instance, baseName of "one/two/three", maps to - //"one/two/three.js", but we want the directory, "one/two" for - //this normalization. - baseParts = baseParts.slice(0, baseParts.length - 1); - name = name.split('/'); - lastIndex = name.length - 1; - - // Node .js allowance: - if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) { - name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, ''); - } - - name = baseParts.concat(name); - - //start trimDots - for (i = 0; i < name.length; i += 1) { - part = name[i]; - if (part === ".") { - name.splice(i, 1); - i -= 1; - } else if (part === "..") { - if (i === 1 && (name[2] === '..' || name[0] === '..')) { - //End of the line. Keep at least one non-dot - //path segment at the front so it can be mapped - //correctly to disk. Otherwise, there is likely - //no path mapping for a path starting with '..'. - //This can still fail, but catches the most reasonable - //uses of .. - break; - } else if (i > 0) { - name.splice(i - 1, 2); - i -= 2; - } - } - } - //end trimDots - - name = name.join("/"); - } else if (name.indexOf('./') === 0) { - // No baseName, so this is ID is resolved relative - // to baseUrl, pull off the leading dot. - name = name.substring(2); - } - } - - //Apply map config if available. - if ((baseParts || starMap) && map) { - nameParts = name.split('/'); - - for (i = nameParts.length; i > 0; i -= 1) { - nameSegment = nameParts.slice(0, i).join("/"); - - if (baseParts) { - //Find the longest baseName segment match in the config. - //So, do joins on the biggest to smallest lengths of baseParts. - for (j = baseParts.length; j > 0; j -= 1) { - mapValue = map[baseParts.slice(0, j).join('/')]; - - //baseName segment has config, find if it has one for - //this name. - if (mapValue) { - mapValue = mapValue[nameSegment]; - if (mapValue) { - //Match, update name to the new value. - foundMap = mapValue; - foundI = i; - break; - } - } - } - } - - if (foundMap) { - break; - } - - //Check for a star map match, but just hold on to it, - //if there is a shorter segment match later in a matching - //config, then favor over this star map. - if (!foundStarMap && starMap && starMap[nameSegment]) { - foundStarMap = starMap[nameSegment]; - starI = i; - } - } - - if (!foundMap && foundStarMap) { - foundMap = foundStarMap; - foundI = starI; - } - - if (foundMap) { - nameParts.splice(0, foundI, foundMap); - name = nameParts.join('/'); - } - } - - return name; - } - - function makeRequire(relName, forceSync) { - return function () { - //A version of a require function that passes a moduleName - //value for items that may need to - //look up paths relative to the moduleName - return req.apply(undef, aps.call(arguments, 0).concat([relName, forceSync])); - }; - } - - function makeNormalize(relName) { - return function (name) { - return normalize(name, relName); - }; - } - - function makeLoad(depName) { - return function (value) { - defined[depName] = value; - }; - } - - function callDep(name) { - if (hasProp(waiting, name)) { - var args = waiting[name]; - delete waiting[name]; - defining[name] = true; - main.apply(undef, args); - } - - if (!hasProp(defined, name) && !hasProp(defining, name)) { - throw new Error('No ' + name); - } - return defined[name]; - } - - //Turns a plugin!resource to [plugin, resource] - //with the plugin being undefined if the name - //did not have a plugin prefix. - function splitPrefix(name) { - var prefix, - index = name ? name.indexOf('!') : -1; - if (index > -1) { - prefix = name.substring(0, index); - name = name.substring(index + 1, name.length); - } - return [prefix, name]; - } - - /** - * Makes a name map, normalizing the name, and using a plugin - * for normalization if necessary. Grabs a ref to plugin - * too, as an optimization. - */ - makeMap = function (name, relName) { - var plugin, - parts = splitPrefix(name), - prefix = parts[0]; - - name = parts[1]; - - if (prefix) { - prefix = normalize(prefix, relName); - plugin = callDep(prefix); - } - - //Normalize according - if (prefix) { - if (plugin && plugin.normalize) { - name = plugin.normalize(name, makeNormalize(relName)); - } else { - name = normalize(name, relName); - } - } else { - name = normalize(name, relName); - parts = splitPrefix(name); - prefix = parts[0]; - name = parts[1]; - if (prefix) { - plugin = callDep(prefix); - } - } - - //Using ridiculous property names for space reasons - return { - f: prefix ? prefix + '!' + name : name, //fullName - n: name, - pr: prefix, - p: plugin - }; - }; - - function makeConfig(name) { - return function () { - return (config && config.config && config.config[name]) || {}; - }; - } - - handlers = { - require: function (name) { - return makeRequire(name); - }, - exports: function (name) { - var e = defined[name]; - if (typeof e !== 'undefined') { - return e; - } else { - return (defined[name] = {}); - } - }, - module: function (name) { - return { - id: name, - uri: '', - exports: defined[name], - config: makeConfig(name) - }; - } - }; - - main = function (name, deps, callback, relName) { - var cjsModule, depName, ret, map, i, - args = [], - callbackType = typeof callback, - usingExports; - - //Use name if no relName - relName = relName || name; - - //Call the callback to define the module, if necessary. - if (callbackType === 'undefined' || callbackType === 'function') { - //Pull out the defined dependencies and pass the ordered - //values to the callback. - //Default to [require, exports, module] if no deps - deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps; - for (i = 0; i < deps.length; i += 1) { - map = makeMap(deps[i], relName); - depName = map.f; - - //Fast path CommonJS standard dependencies. - if (depName === "require") { - args[i] = handlers.require(name); - } else if (depName === "exports") { - //CommonJS module spec 1.1 - args[i] = handlers.exports(name); - usingExports = true; - } else if (depName === "module") { - //CommonJS module spec 1.1 - cjsModule = args[i] = handlers.module(name); - } else if (hasProp(defined, depName) || - hasProp(waiting, depName) || - hasProp(defining, depName)) { - args[i] = callDep(depName); - } else if (map.p) { - map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {}); - args[i] = defined[depName]; - } else { - throw new Error(name + ' missing ' + depName); - } - } - - ret = callback ? callback.apply(defined[name], args) : undefined; - - if (name) { - //If setting exports via "module" is in play, - //favor that over return value and exports. After that, - //favor a non-undefined return value over exports use. - if (cjsModule && cjsModule.exports !== undef && - cjsModule.exports !== defined[name]) { - defined[name] = cjsModule.exports; - } else if (ret !== undef || !usingExports) { - //Use the return value from the function. - defined[name] = ret; - } - } - } else if (name) { - //May just be an object definition for the module. Only - //worry about defining if have a module name. - defined[name] = callback; - } - }; - - requirejs = require = req = function (deps, callback, relName, forceSync, alt) { - if (typeof deps === "string") { - if (handlers[deps]) { - //callback in this case is really relName - return handlers[deps](callback); - } - //Just return the module wanted. In this scenario, the - //deps arg is the module name, and second arg (if passed) - //is just the relName. - //Normalize module name, if it contains . or .. - return callDep(makeMap(deps, callback).f); - } else if (!deps.splice) { - //deps is a config object, not an array. - config = deps; - if (config.deps) { - req(config.deps, config.callback); - } - if (!callback) { - return; - } - - if (callback.splice) { - //callback is an array, which means it is a dependency list. - //Adjust args if there are dependencies - deps = callback; - callback = relName; - relName = null; - } else { - deps = undef; - } - } - - //Support require(['a']) - callback = callback || function () {}; - - //If relName is a function, it is an errback handler, - //so remove it. - if (typeof relName === 'function') { - relName = forceSync; - forceSync = alt; - } - - //Simulate async callback; - if (forceSync) { - main(undef, deps, callback, relName); - } else { - //Using a non-zero value because of concern for what old browsers - //do, and latest browsers "upgrade" to 4 if lower value is used: - //http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout: - //If want a value immediately, use require('id') instead -- something - //that works in almond on the global level, but not guaranteed and - //unlikely to work in other AMD implementations. - setTimeout(function () { - main(undef, deps, callback, relName); - }, 4); - } - - return req; - }; - - /** - * Just drops the config on the floor, but returns req in case - * the config return value is used. - */ - req.config = function (cfg) { - return req(cfg); - }; - - /** - * Expose module registry for debugging and tooling - */ - requirejs._defined = defined; - - define = function (name, deps, callback) { - - //This module may not have dependencies - if (!deps.splice) { - //deps is not an array, so probably means - //an object literal or factory function for - //the value. Adjust args. - callback = deps; - deps = []; - } - - if (!hasProp(defined, name) && !hasProp(waiting, name)) { - waiting[name] = [name, deps, callback]; - } - }; - - define.amd = { - jQuery: true - }; -}()); - -define("almond", function(){}); - -/* global jQuery:false, $:false */ -define('jquery',[],function () { - var _$ = jQuery || $; - - if (_$ == null && console && console.error) { - console.error( - 'Select2: An instance of jQuery or a jQuery-compatible library was not ' + - 'found. Make sure that you are including jQuery before Select2 on your ' + - 'web page.' - ); - } - - return _$; -}); - -define('select2/utils',[ - 'jquery' -], function ($) { - var Utils = {}; - - Utils.Extend = function (ChildClass, SuperClass) { - var __hasProp = {}.hasOwnProperty; - - function BaseConstructor () { - this.constructor = ChildClass; - } - - for (var key in SuperClass) { - if (__hasProp.call(SuperClass, key)) { - ChildClass[key] = SuperClass[key]; - } - } - - BaseConstructor.prototype = SuperClass.prototype; - ChildClass.prototype = new BaseConstructor(); - ChildClass.__super__ = SuperClass.prototype; - - return ChildClass; - }; - - function getMethods (theClass) { - var proto = theClass.prototype; - - var methods = []; - - for (var methodName in proto) { - var m = proto[methodName]; - - if (typeof m !== 'function') { - continue; - } - - if (methodName === 'constructor') { - continue; - } - - methods.push(methodName); - } - - return methods; - } - - Utils.Decorate = function (SuperClass, DecoratorClass) { - var decoratedMethods = getMethods(DecoratorClass); - var superMethods = getMethods(SuperClass); - - function DecoratedClass () { - var unshift = Array.prototype.unshift; - - var argCount = DecoratorClass.prototype.constructor.length; - - var calledConstructor = SuperClass.prototype.constructor; - - if (argCount > 0) { - unshift.call(arguments, SuperClass.prototype.constructor); - - calledConstructor = DecoratorClass.prototype.constructor; - } - - calledConstructor.apply(this, arguments); - } - - DecoratorClass.displayName = SuperClass.displayName; - - function ctr () { - this.constructor = DecoratedClass; - } - - DecoratedClass.prototype = new ctr(); - - for (var m = 0; m < superMethods.length; m++) { - var superMethod = superMethods[m]; - - DecoratedClass.prototype[superMethod] = - SuperClass.prototype[superMethod]; - } - - var calledMethod = function (methodName) { - // Stub out the original method if it's not decorating an actual method - var originalMethod = function () {}; - - if (methodName in DecoratedClass.prototype) { - originalMethod = DecoratedClass.prototype[methodName]; - } - - var decoratedMethod = DecoratorClass.prototype[methodName]; - - return function () { - var unshift = Array.prototype.unshift; - - unshift.call(arguments, originalMethod); - - return decoratedMethod.apply(this, arguments); - }; - }; - - for (var d = 0; d < decoratedMethods.length; d++) { - var decoratedMethod = decoratedMethods[d]; - - DecoratedClass.prototype[decoratedMethod] = calledMethod(decoratedMethod); - } - - return DecoratedClass; - }; - - var Observable = function () { - this.listeners = {}; - }; - - Observable.prototype.on = function (event, callback) { - this.listeners = this.listeners || {}; - - if (event in this.listeners) { - this.listeners[event].push(callback); - } else { - this.listeners[event] = [callback]; - } - }; - - Observable.prototype.trigger = function (event) { - var slice = Array.prototype.slice; - - this.listeners = this.listeners || {}; - - if (event in this.listeners) { - this.invoke(this.listeners[event], slice.call(arguments, 1)); - } - - if ('*' in this.listeners) { - this.invoke(this.listeners['*'], arguments); - } - }; - - Observable.prototype.invoke = function (listeners, params) { - for (var i = 0, len = listeners.length; i < len; i++) { - listeners[i].apply(this, params); - } - }; - - Utils.Observable = Observable; - - Utils.generateChars = function (length) { - var chars = ''; - - for (var i = 0; i < length; i++) { - var randomChar = Math.floor(Math.random() * 36); - chars += randomChar.toString(36); - } - - return chars; - }; - - Utils.bind = function (func, context) { - return function () { - func.apply(context, arguments); - }; - }; - - Utils._convertData = function (data) { - for (var originalKey in data) { - var keys = originalKey.split('-'); - - var dataLevel = data; - - if (keys.length === 1) { - continue; - } - - for (var k = 0; k < keys.length; k++) { - var key = keys[k]; - - // Lowercase the first letter - // By default, dash-separated becomes camelCase - key = key.substring(0, 1).toLowerCase() + key.substring(1); - - if (!(key in dataLevel)) { - dataLevel[key] = {}; - } - - if (k == keys.length - 1) { - dataLevel[key] = data[originalKey]; - } - - dataLevel = dataLevel[key]; - } - - delete data[originalKey]; - } - - return data; - }; - - Utils.hasScroll = function (index, el) { - // Adapted from the function created by @ShadowScripter - // and adapted by @BillBarry on the Stack Exchange Code Review website. - // The original code can be found at - // http://codereview.stackexchange.com/q/13338 - // and was designed to be used with the Sizzle selector engine. - - var $el = $(el); - var overflowX = el.style.overflowX; - var overflowY = el.style.overflowY; - - //Check both x and y declarations - if (overflowX === overflowY && - (overflowY === 'hidden' || overflowY === 'visible')) { - return false; - } - - if (overflowX === 'scroll' || overflowY === 'scroll') { - return true; - } - - return ($el.innerHeight() < el.scrollHeight || - $el.innerWidth() < el.scrollWidth); - }; - - Utils.escapeMarkup = function (markup) { - var replaceMap = { - '\\': '\', - '&': '&', - '<': '<', - '>': '>', - '"': '"', - '\'': ''', - '/': '/' - }; - - // Do not try to escape the markup if it's not a string - if (typeof markup !== 'string') { - return markup; - } - - return String(markup).replace(/[&<>"'\/\\]/g, function (match) { - return replaceMap[match]; - }); - }; - - return Utils; -}); - -define('select2/results',[ - 'jquery', - './utils' -], function ($, Utils) { - function Results ($element, options, dataAdapter) { - this.$element = $element; - this.data = dataAdapter; - this.options = options; - - Results.__super__.constructor.call(this); - } - - Utils.Extend(Results, Utils.Observable); - - Results.prototype.render = function () { - var $results = $( - '<ul class="select2-results__options" role="tree"></ul>' - ); - - if (this.options.get('multiple')) { - $results.attr('aria-multiselectable', 'true'); - } - - this.$results = $results; - - return $results; - }; - - Results.prototype.clear = function () { - this.$results.empty(); - }; - - Results.prototype.displayMessage = function (params) { - var escapeMarkup = this.options.get('escapeMarkup'); - - this.clear(); - this.hideLoading(); - - var $message = $( - '<li role="treeitem" class="select2-results__option"></li>' - ); - - var message = this.options.get('translations').get(params.message); - - $message.append( - escapeMarkup( - message(params.args) - ) - ); - - this.$results.append($message); - }; - - Results.prototype.append = function (data) { - this.hideLoading(); - - var $options = []; - - if (data.results == null || data.results.length === 0) { - if (this.$results.children().length === 0) { - this.trigger('results:message', { - message: 'noResults' - }); - } - - return; - } - - data.results = this.sort(data.results); - - for (var d = 0; d < data.results.length; d++) { - var item = data.results[d]; - - var $option = this.option(item); - - $options.push($option); - } - - this.$results.append($options); - }; - - Results.prototype.position = function ($results, $dropdown) { - var $resultsContainer = $dropdown.find('.select2-results'); - $resultsContainer.append($results); - }; - - Results.prototype.sort = function (data) { - var sorter = this.options.get('sorter'); - - return sorter(data); - }; - - Results.prototype.setClasses = function () { - var self = this; - - this.data.current(function (selected) { - var selectedIds = $.map(selected, function (s) { - return s.id.toString(); - }); - - var $options = self.$results - .find('.select2-results__option[aria-selected]'); - - $options.each(function () { - var $option = $(this); - - var item = $.data(this, 'data'); - - if ($.inArray(item.id, selectedIds) > -1) { - $option.attr('aria-selected', 'true'); - } else { - $option.attr('aria-selected', 'false'); - } - }); - - var $selected = $options.filter('[aria-selected=true]'); - - // Check if there are any selected options - if ($selected.length > 0) { - // If there are selected options, highlight the first - $selected.first().trigger('mouseenter'); - } else { - // If there are no selected options, highlight the first option - // in the dropdown - $options.first().trigger('mouseenter'); - } - }); - }; - - Results.prototype.showLoading = function (params) { - this.hideLoading(); - - var loadingMore = this.options.get('translations').get('searching'); - - var loading = { - disabled: true, - loading: true, - text: loadingMore(params) - }; - var $loading = this.option(loading); - $loading.className += ' loading-results'; - - this.$results.prepend($loading); - }; - - Results.prototype.hideLoading = function () { - this.$results.find('.loading-results').remove(); - }; - - Results.prototype.option = function (data) { - var option = document.createElement('li'); - option.className = 'select2-results__option'; - - var attrs = { - 'role': 'treeitem', - 'aria-selected': 'false' - }; - - if (data.disabled) { - delete attrs['aria-selected']; - attrs['aria-disabled'] = 'true'; - } - - if (data.id == null) { - delete attrs['aria-selected']; - } - - if (data._resultId != null) { - option.id = data._resultId; - } - - if (data.title) { - option.title = data.title; - } - - if (data.children) { - attrs.role = 'group'; - attrs['aria-label'] = data.text; - delete attrs['aria-selected']; - } - - for (var attr in attrs) { - var val = attrs[attr]; - - option.setAttribute(attr, val); - } - - if (data.children) { - var $option = $(option); - - var label = document.createElement('strong'); - label.className = 'select2-results__group'; - - var $label = $(label); - this.template(data, label); - - var $children = []; - - for (var c = 0; c < data.children.length; c++) { - var child = data.children[c]; - - var $child = this.option(child); - - $children.push($child); - } - - var $childrenContainer = $('<ul></ul>', { - 'class': 'select2-results__options select2-results__options--nested' - }); - - $childrenContainer.append($children); - - $option.append(label); - $option.append($childrenContainer); - } else { - this.template(data, option); - } - - $.data(option, 'data', data); - - return option; - }; - - Results.prototype.bind = function (container, $container) { - var self = this; - - var id = container.id + '-results'; - - this.$results.attr('id', id); - - container.on('results:all', function (params) { - self.clear(); - self.append(params.data); - - if (container.isOpen()) { - self.setClasses(); - } - }); - - container.on('results:append', function (params) { - self.append(params.data); - - if (container.isOpen()) { - self.setClasses(); - } - }); - - container.on('query', function (params) { - self.showLoading(params); - }); - - container.on('select', function () { - if (!container.isOpen()) { - return; - } - - self.setClasses(); - }); - - container.on('unselect', function () { - if (!container.isOpen()) { - return; - } - - self.setClasses(); - }); - - container.on('open', function () { - // When the dropdown is open, aria-expended="true" - self.$results.attr('aria-expanded', 'true'); - self.$results.attr('aria-hidden', 'false'); - - self.setClasses(); - self.ensureHighlightVisible(); - }); - - container.on('close', function () { - // When the dropdown is closed, aria-expended="false" - self.$results.attr('aria-expanded', 'false'); - self.$results.attr('aria-hidden', 'true'); - self.$results.removeAttr('aria-activedescendant'); - }); - - container.on('results:toggle', function () { - var $highlighted = self.getHighlightedResults(); - - if ($highlighted.length === 0) { - return; - } - - $highlighted.trigger('mouseup'); - }); - - container.on('results:select', function () { - var $highlighted = self.getHighlightedResults(); - - if ($highlighted.length === 0) { - return; - } - - var data = $highlighted.data('data'); - - if ($highlighted.attr('aria-selected') == 'true') { - self.trigger('close'); - } else { - self.trigger('select', { - data: data - }); - } - }); - - container.on('results:previous', function () { - var $highlighted = self.getHighlightedResults(); - - var $options = self.$results.find('[aria-selected]'); - - var currentIndex = $options.index($highlighted); - - // If we are already at te top, don't move further - if (currentIndex === 0) { - return; - } - - var nextIndex = currentIndex - 1; - - // If none are highlighted, highlight the first - if ($highlighted.length === 0) { - nextIndex = 0; - } - - var $next = $options.eq(nextIndex); - - $next.trigger('mouseenter'); - - var currentOffset = self.$results.offset().top; - var nextTop = $next.offset().top; - var nextOffset = self.$results.scrollTop() + (nextTop - currentOffset); - - if (nextIndex === 0) { - self.$results.scrollTop(0); - } else if (nextTop - currentOffset < 0) { - self.$results.scrollTop(nextOffset); - } - }); - - container.on('results:next', function () { - var $highlighted = self.getHighlightedResults(); - - var $options = self.$results.find('[aria-selected]'); - - var currentIndex = $options.index($highlighted); - - var nextIndex = currentIndex + 1; - - // If we are at the last option, stay there - if (nextIndex >= $options.length) { - return; - } - - var $next = $options.eq(nextIndex); - - $next.trigger('mouseenter'); - - var currentOffset = self.$results.offset().top + - self.$results.outerHeight(false); - var nextBottom = $next.offset().top + $next.outerHeight(false); - var nextOffset = self.$results.scrollTop() + nextBottom - currentOffset; - - if (nextIndex === 0) { - self.$results.scrollTop(0); - } else if (nextBottom > currentOffset) { - self.$results.scrollTop(nextOffset); - } - }); - - container.on('results:focus', function (params) { - params.element.addClass('select2-results__option--highlighted'); - }); - - container.on('results:message', function (params) { - self.displayMessage(params); - }); - - if ($.fn.mousewheel) { - this.$results.on('mousewheel', function (e) { - var top = self.$results.scrollTop(); - - var bottom = ( - self.$results.get(0).scrollHeight - - self.$results.scrollTop() + - e.deltaY - ); - - var isAtTop = e.deltaY > 0 && top - e.deltaY <= 0; - var isAtBottom = e.deltaY < 0 && bottom <= self.$results.height(); - - if (isAtTop) { - self.$results.scrollTop(0); - - e.preventDefault(); - e.stopPropagation(); - } else if (isAtBottom) { - self.$results.scrollTop( - self.$results.get(0).scrollHeight - self.$results.height() - ); - - e.preventDefault(); - e.stopPropagation(); - } - }); - } - - this.$results.on('mouseup', '.select2-results__option[aria-selected]', - function (evt) { - var $this = $(this); - - var data = $this.data('data'); - - if ($this.attr('aria-selected') === 'true') { - if (self.options.get('multiple')) { - self.trigger('unselect', { - originalEvent: evt, - data: data - }); - } else { - self.trigger('close'); - } - - return; - } - - self.trigger('select', { - originalEvent: evt, - data: data - }); - }); - - this.$results.on('mouseenter', '.select2-results__option[aria-selected]', - function (evt) { - var data = $(this).data('data'); - - self.getHighlightedResults() - .removeClass('select2-results__option--highlighted'); - - self.trigger('results:focus', { - data: data, - element: $(this) - }); - }); - }; - - Results.prototype.getHighlightedResults = function () { - var $highlighted = this.$results - .find('.select2-results__option--highlighted'); - - return $highlighted; - }; - - Results.prototype.destroy = function () { - this.$results.remove(); - }; - - Results.prototype.ensureHighlightVisible = function () { - var $highlighted = this.getHighlightedResults(); - - if ($highlighted.length === 0) { - return; - } - - var $options = this.$results.find('[aria-selected]'); - - var currentIndex = $options.index($highlighted); - - var currentOffset = this.$results.offset().top; - var nextTop = $highlighted.offset().top; - var nextOffset = this.$results.scrollTop() + (nextTop - currentOffset); - - var offsetDelta = nextTop - currentOffset; - nextOffset -= $highlighted.outerHeight(false) * 2; - - if (currentIndex <= 2) { - this.$results.scrollTop(0); - } else if (offsetDelta > this.$results.outerHeight() || offsetDelta < 0) { - this.$results.scrollTop(nextOffset); - } - }; - - Results.prototype.template = function (result, container) { - var template = this.options.get('templateResult'); - var escapeMarkup = this.options.get('escapeMarkup'); - - var content = template(result); - - if (content == null) { - container.style.display = 'none'; - } else if (typeof content === 'string') { - container.innerHTML = escapeMarkup(content); - } else { - $(container).append(content); - } - }; - - return Results; -}); - -define('select2/keys',[ - -], function () { - var KEYS = { - BACKSPACE: 8, - TAB: 9, - ENTER: 13, - SHIFT: 16, - CTRL: 17, - ALT: 18, - ESC: 27, - SPACE: 32, - PAGE_UP: 33, - PAGE_DOWN: 34, - END: 35, - HOME: 36, - LEFT: 37, - UP: 38, - RIGHT: 39, - DOWN: 40, - DELETE: 46 - }; - - return KEYS; -}); - -define('select2/selection/base',[ - 'jquery', - '../utils', - '../keys' -], function ($, Utils, KEYS) { - function BaseSelection ($element, options) { - this.$element = $element; - this.options = options; - - BaseSelection.__super__.constructor.call(this); - } - - Utils.Extend(BaseSelection, Utils.Observable); - - BaseSelection.prototype.render = function () { - var $selection = $( - '<span class="select2-selection" role="combobox" ' + - 'aria-autocomplete="list" aria-haspopup="true" aria-expanded="false">' + - '</span>' - ); - - this._tabindex = 0; - - if (this.$element.data('old-tabindex') != null) { - this._tabindex = this.$element.data('old-tabindex'); - } else if (this.$element.attr('tabindex') != null) { - this._tabindex = this.$element.attr('tabindex'); - } - - $selection.attr('title', this.$element.attr('title')); - $selection.attr('tabindex', this._tabindex); - - this.$selection = $selection; - - return $selection; - }; - - BaseSelection.prototype.bind = function (container, $container) { - var self = this; - - var id = container.id + '-container'; - var resultsId = container.id + '-results'; - - this.container = container; - - this.$selection.attr('aria-owns', resultsId); - - this.$selection.on('focus', function (evt) { - self.trigger('focus', evt); - }); - - this.$selection.on('blur', function (evt) { - self.trigger('blur', evt); - }); - - this.$selection.on('keydown', function (evt) { - self.trigger('keypress', evt); - - if (evt.which === KEYS.SPACE) { - evt.preventDefault(); - } - }); - - container.on('results:focus', function (params) { - self.$selection.attr('aria-activedescendant', params.data._resultId); - }); - - container.on('selection:update', function (params) { - self.update(params.data); - }); - - container.on('open', function () { - // When the dropdown is open, aria-expanded="true" - self.$selection.attr('aria-expanded', 'true'); - - self._attachCloseHandler(container); - }); - - container.on('close', function () { - // When the dropdown is closed, aria-expanded="false" - self.$selection.attr('aria-expanded', 'false'); - self.$selection.removeAttr('aria-activedescendant'); - - self.$selection.focus(); - - self._detachCloseHandler(container); - }); - - container.on('enable', function () { - self.$selection.attr('tabindex', self._tabindex); - }); - - container.on('disable', function () { - self.$selection.attr('tabindex', '-1'); - }); - }; - - BaseSelection.prototype._attachCloseHandler = function (container) { - var self = this; - - $(document.body).on('mousedown.select2.' + container.id, function (e) { - var $target = $(e.target); - - var $select = $target.closest('.select2'); - - var $all = $('.select2.select2-container--open'); - - $all.each(function () { - var $this = $(this); - - if (this == $select[0]) { - return; - } - - var $element = $this.data('element'); - - $element.select2('close'); - }); - }); - }; - - BaseSelection.prototype._detachCloseHandler = function (container) { - $(document.body).off('mousedown.select2.' + container.id); - }; - - BaseSelection.prototype.position = function ($selection, $container) { - var $selectionContainer = $container.find('.selection'); - $selectionContainer.append($selection); - }; - - BaseSelection.prototype.destroy = function () { - this._detachCloseHandler(this.container); - }; - - BaseSelection.prototype.update = function (data) { - throw new Error('The `update` method must be defined in child classes.'); - }; - - return BaseSelection; -}); - -define('select2/selection/single',[ - 'jquery', - './base', - '../utils', - '../keys' -], function ($, BaseSelection, Utils, KEYS) { - function SingleSelection () { - SingleSelection.__super__.constructor.apply(this, arguments); - } - - Utils.Extend(SingleSelection, BaseSelection); - - SingleSelection.prototype.render = function () { - var $selection = SingleSelection.__super__.render.call(this); - - $selection.addClass('select2-selection--single'); - - $selection.html( - '<span class="select2-selection__rendered"></span>' + - '<span class="select2-selection__arrow" role="presentation">' + - '<b role="presentation"></b>' + - '</span>' - ); - - return $selection; - }; - - SingleSelection.prototype.bind = function (container, $container) { - var self = this; - - SingleSelection.__super__.bind.apply(this, arguments); - - var id = container.id + '-container'; - - this.$selection.find('.select2-selection__rendered').attr('id', id); - this.$selection.attr('aria-labelledby', id); - - this.$selection.on('mousedown', function (evt) { - // Only respond to left clicks - if (evt.which !== 1) { - return; - } - - self.trigger('toggle', { - originalEvent: evt - }); - }); - - this.$selection.on('focus', function (evt) { - // User focuses on the container - }); - - this.$selection.on('blur', function (evt) { - // User exits the container - }); - - container.on('selection:update', function (params) { - self.update(params.data); - }); - }; - - SingleSelection.prototype.clear = function () { - this.$selection.find('.select2-selection__rendered').empty(); - }; - - SingleSelection.prototype.display = function (data) { - var template = this.options.get('templateSelection'); - var escapeMarkup = this.options.get('escapeMarkup'); - - return escapeMarkup(template(data)); - }; - - SingleSelection.prototype.selectionContainer = function () { - return $('<span></span>'); - }; - - SingleSelection.prototype.update = function (data) { - if (data.length === 0) { - this.clear(); - return; - } - - var selection = data[0]; - - var formatted = this.display(selection); - - var $rendered = this.$selection.find('.select2-selection__rendered'); - $rendered.empty().append(formatted); - $rendered.prop('title', selection.title || selection.text); - }; - - return SingleSelection; -}); - -define('select2/selection/multiple',[ - 'jquery', - './base', - '../utils' -], function ($, BaseSelection, Utils) { - function MultipleSelection ($element, options) { - MultipleSelection.__super__.constructor.apply(this, arguments); - } - - Utils.Extend(MultipleSelection, BaseSelection); - - MultipleSelection.prototype.render = function () { - var $selection = MultipleSelection.__super__.render.call(this); - - $selection.addClass('select2-selection--multiple'); - - $selection.html( - '<ul class="select2-selection__rendered"></ul>' - ); - - return $selection; - }; - - MultipleSelection.prototype.bind = function (container, $container) { - var self = this; - - MultipleSelection.__super__.bind.apply(this, arguments); - - this.$selection.on('click', function (evt) { - self.trigger('toggle', { - originalEvent: evt - }); - }); - - this.$selection.on('click', '.select2-selection__choice__remove', - function (evt) { - var $remove = $(this); - var $selection = $remove.parent(); - - var data = $selection.data('data'); - - self.trigger('unselect', { - originalEvent: evt, - data: data - }); - }); - }; - - MultipleSelection.prototype.clear = function () { - this.$selection.find('.select2-selection__rendered').empty(); - }; - - MultipleSelection.prototype.display = function (data) { - var template = this.options.get('templateSelection'); - var escapeMarkup = this.options.get('escapeMarkup'); - - return escapeMarkup(template(data)); - }; - - MultipleSelection.prototype.selectionContainer = function () { - var $container = $( - '<li class="select2-selection__choice">' + - '<span class="select2-selection__choice__remove" role="presentation">' + - '×' + - '</span>' + - '</li>' - ); - - return $container; - }; - - MultipleSelection.prototype.update = function (data) { - this.clear(); - - if (data.length === 0) { - return; - } - - var $selections = []; - - for (var d = 0; d < data.length; d++) { - var selection = data[d]; - - var formatted = this.display(selection); - var $selection = this.selectionContainer(); - - $selection.append(formatted); - $selection.prop('title', selection.title || selection.text); - - $selection.data('data', selection); - - $selections.push($selection); - } - - this.$selection.find('.select2-selection__rendered').append($selections); - }; - - return MultipleSelection; -}); - -define('select2/selection/placeholder',[ - '../utils' -], function (Utils) { - function Placeholder (decorated, $element, options) { - this.placeholder = this.normalizePlaceholder(options.get('placeholder')); - - decorated.call(this, $element, options); - } - - Placeholder.prototype.normalizePlaceholder = function (_, placeholder) { - if (typeof placeholder === 'string') { - placeholder = { - id: '', - text: placeholder - }; - } - - return placeholder; - }; - - Placeholder.prototype.createPlaceholder = function (decorated, placeholder) { - var $placeholder = this.selectionContainer(); - - $placeholder.html(this.display(placeholder)); - $placeholder.addClass('select2-selection__placeholder') - .removeClass('select2-selection__choice'); - - return $placeholder; - }; - - Placeholder.prototype.update = function (decorated, data) { - var singlePlaceholder = ( - data.length == 1 && data[0].id != this.placeholder.id - ); - var multipleSelections = data.length > 1; - - if (multipleSelections || singlePlaceholder) { - return decorated.call(this, data); - } - - this.clear(); - - var $placeholder = this.createPlaceholder(this.placeholder); - - this.$selection.find('.select2-selection__rendered').append($placeholder); - }; - - return Placeholder; -}); - -define('select2/selection/allowClear',[ - 'jquery' -], function ($) { - function AllowClear () { } - - AllowClear.prototype.bind = function (decorated, container, $container) { - var self = this; - - decorated.call(this, container, $container); - - if (self.placeholder == null) { - if (window.console && console.error) { - console.error( - 'Select2: The `allowClear` option should be used in combination ' + - 'with the `placeholder` option.' - ); - } - } - - this.$selection.on('mousedown', '.select2-selection__clear', - function (evt) { - // Ignore the event if it is disabled - if (self.options.get('disabled')) { - return; - } - - evt.stopPropagation(); - - var data = $(this).data('data'); - - for (var d = 0; d < data.length; d++) { - var unselectData = { - data: data[d] - }; - - // Trigger the `unselect` event, so people can prevent it from being - // cleared. - self.trigger('unselect', unselectData); - - // If the event was prevented, don't clear it out. - if (unselectData.prevented) { - return; - } - } - - self.$element.val(self.placeholder.id).trigger('change'); - - self.trigger('toggle'); - }); - }; - - AllowClear.prototype.update = function (decorated, data) { - decorated.call(this, data); - - if (this.$selection.find('.select2-selection__placeholder').length > 0 || - data.length === 0) { - return; - } - - var $remove = $( - '<span class="select2-selection__clear">' + - '×' + - '</span>' - ); - $remove.data('data', data); - - this.$selection.find('.select2-selection__rendered').append($remove); - }; - - return AllowClear; -}); - -define('select2/selection/search',[ - 'jquery', - '../utils', - '../keys' -], function ($, Utils, KEYS) { - function Search (decorated, $element, options) { - decorated.call(this, $element, options); - } - - Search.prototype.render = function (decorated) { - var $search = $( - '<li class="select2-search select2-search--inline">' + - '<input class="select2-search__field" type="search" tabindex="-1"' + - ' autocomplete="off" autocorrect="off" autocapitalize="off"' + - ' spellcheck="false" role="textbox" />' + - '</li>' - ); - - this.$searchContainer = $search; - this.$search = $search.find('input'); - - var $rendered = decorated.call(this); - - return $rendered; - }; - - Search.prototype.bind = function (decorated, container, $container) { - var self = this; - - decorated.call(this, container, $container); - - container.on('open', function () { - self.$search.attr('tabindex', 0); - - self.$search.focus(); - }); - - container.on('close', function () { - self.$search.attr('tabindex', -1); - - self.$search.val(''); - self.$search.focus(); - }); - - container.on('enable', function () { - self.$search.prop('disabled', false); - }); - - container.on('disable', function () { - self.$search.prop('disabled', true); - }); - - this.$selection.on('focusin', '.select2-search--inline', function (evt) { - self.trigger('focus', evt); - }); - - this.$selection.on('focusout', '.select2-search--inline', function (evt) { - self.trigger('blur', evt); - }); - - this.$selection.on('keydown', '.select2-search--inline', function (evt) { - evt.stopPropagation(); - - self.trigger('keypress', evt); - - self._keyUpPrevented = evt.isDefaultPrevented(); - - var key = evt.which; - - if (key === KEYS.BACKSPACE && self.$search.val() === '') { - var $previousChoice = self.$searchContainer - .prev('.select2-selection__choice'); - - if ($previousChoice.length > 0) { - var item = $previousChoice.data('data'); - - self.searchRemoveChoice(item); - } - } - }); - - // Workaround for browsers which do not support the `input` event - // This will prevent double-triggering of events for browsers which support - // both the `keyup` and `input` events. - this.$selection.on('input', '.select2-search--inline', function (evt) { - // Unbind the duplicated `keyup` event - self.$selection.off('keyup.search'); - }); - - this.$selection.on('keyup.search input', '.select2-search--inline', - function (evt) { - self.handleSearch(evt); - }); - }; - - Search.prototype.createPlaceholder = function (decorated, placeholder) { - this.$search.attr('placeholder', placeholder.text); - }; - - Search.prototype.update = function (decorated, data) { - this.$search.attr('placeholder', ''); - - decorated.call(this, data); - - this.$selection.find('.select2-selection__rendered') - .append(this.$searchContainer); - - this.resizeSearch(); - }; - - Search.prototype.handleSearch = function () { - this.resizeSearch(); - - if (!this._keyUpPrevented) { - var input = this.$search.val(); - - this.trigger('query', { - term: input - }); - } - - this._keyUpPrevented = false; - }; - - Search.prototype.searchRemoveChoice = function (decorated, item) { - this.trigger('unselect', { - data: item - }); - - this.trigger('open'); - - this.$search.val(item.text + ' '); - }; - - Search.prototype.resizeSearch = function () { - this.$search.css('width', '25px'); - - var width = ''; - - if (this.$search.attr('placeholder') !== '') { - width = this.$selection.find('.select2-selection__rendered').innerWidth(); - } else { - var minimumWidth = this.$search.val().length + 1; - - width = (minimumWidth * 0.75) + 'em'; - } - - this.$search.css('width', width); - }; - - return Search; -}); - -define('select2/selection/eventRelay',[ - 'jquery' -], function ($) { - function EventRelay () { } - - EventRelay.prototype.bind = function (decorated, container, $container) { - var self = this; - var relayEvents = [ - 'open', 'opening', - 'close', 'closing', - 'select', 'selecting', - 'unselect', 'unselecting' - ]; - - var preventableEvents = ['opening', 'closing', 'selecting', 'unselecting']; - - decorated.call(this, container, $container); - - container.on('*', function (name, params) { - // Ignore events that should not be relayed - if ($.inArray(name, relayEvents) === -1) { - return; - } - - // The parameters should always be an object - params = params || {}; - - // Generate the jQuery event for the Select2 event - var evt = $.Event('select2:' + name, { - params: params - }); - - self.$element.trigger(evt); - - // Only handle preventable events if it was one - if ($.inArray(name, preventableEvents) === -1) { - return; - } - - params.prevented = evt.isDefaultPrevented(); - }); - }; - - return EventRelay; -}); - -define('select2/translation',[ - 'jquery' -], function ($) { - function Translation (dict) { - this.dict = dict || {}; - } - - Translation.prototype.all = function () { - return this.dict; - }; - - Translation.prototype.get = function (key) { - return this.dict[key]; - }; - - Translation.prototype.extend = function (translation) { - this.dict = $.extend({}, translation.all(), this.dict); - }; - - // Static functions - - Translation._cache = {}; - - Translation.loadPath = function (path) { - if (!(path in Translation._cache)) { - var translations = require(path); - - Translation._cache[path] = translations; - } - - return new Translation(Translation._cache[path]); - }; - - return Translation; -}); - -define('select2/diacritics',[ - -], function () { - var diacritics = { - '\u24B6': 'A', - '\uFF21': 'A', - '\u00C0': 'A', - '\u00C1': 'A', - '\u00C2': 'A', - '\u1EA6': 'A', - '\u1EA4': 'A', - '\u1EAA': 'A', - '\u1EA8': 'A', - '\u00C3': 'A', - '\u0100': 'A', - '\u0102': 'A', - '\u1EB0': 'A', - '\u1EAE': 'A', - '\u1EB4': 'A', - '\u1EB2': 'A', - '\u0226': 'A', - '\u01E0': 'A', - '\u00C4': 'A', - '\u01DE': 'A', - '\u1EA2': 'A', - '\u00C5': 'A', - '\u01FA': 'A', - '\u01CD': 'A', - '\u0200': 'A', - '\u0202': 'A', - '\u1EA0': 'A', - '\u1EAC': 'A', - '\u1EB6': 'A', - '\u1E00': 'A', - '\u0104': 'A', - '\u023A': 'A', - '\u2C6F': 'A', - '\uA732': 'AA', - '\u00C6': 'AE', - '\u01FC': 'AE', - '\u01E2': 'AE', - '\uA734': 'AO', - '\uA736': 'AU', - '\uA738': 'AV', - '\uA73A': 'AV', - '\uA73C': 'AY', - '\u24B7': 'B', - '\uFF22': 'B', - '\u1E02': 'B', - '\u1E04': 'B', - '\u1E06': 'B', - '\u0243': 'B', - '\u0182': 'B', - '\u0181': 'B', - '\u24B8': 'C', - '\uFF23': 'C', - '\u0106': 'C', - '\u0108': 'C', - '\u010A': 'C', - '\u010C': 'C', - '\u00C7': 'C', - '\u1E08': 'C', - '\u0187': 'C', - '\u023B': 'C', - '\uA73E': 'C', - '\u24B9': 'D', - '\uFF24': 'D', - '\u1E0A': 'D', - '\u010E': 'D', - '\u1E0C': 'D', - '\u1E10': 'D', - '\u1E12': 'D', - '\u1E0E': 'D', - '\u0110': 'D', - '\u018B': 'D', - '\u018A': 'D', - '\u0189': 'D', - '\uA779': 'D', - '\u01F1': 'DZ', - '\u01C4': 'DZ', - '\u01F2': 'Dz', - '\u01C5': 'Dz', - '\u24BA': 'E', - '\uFF25': 'E', - '\u00C8': 'E', - '\u00C9': 'E', - '\u00CA': 'E', - '\u1EC0': 'E', - '\u1EBE': 'E', - '\u1EC4': 'E', - '\u1EC2': 'E', - '\u1EBC': 'E', - '\u0112': 'E', - '\u1E14': 'E', - '\u1E16': 'E', - '\u0114': 'E', - '\u0116': 'E', - '\u00CB': 'E', - '\u1EBA': 'E', - '\u011A': 'E', - '\u0204': 'E', - '\u0206': 'E', - '\u1EB8': 'E', - '\u1EC6': 'E', - '\u0228': 'E', - '\u1E1C': 'E', - '\u0118': 'E', - '\u1E18': 'E', - '\u1E1A': 'E', - '\u0190': 'E', - '\u018E': 'E', - '\u24BB': 'F', - '\uFF26': 'F', - '\u1E1E': 'F', - '\u0191': 'F', - '\uA77B': 'F', - '\u24BC': 'G', - '\uFF27': 'G', - '\u01F4': 'G', - '\u011C': 'G', - '\u1E20': 'G', - '\u011E': 'G', - '\u0120': 'G', - '\u01E6': 'G', - '\u0122': 'G', - '\u01E4': 'G', - '\u0193': 'G', - '\uA7A0': 'G', - '\uA77D': 'G', - '\uA77E': 'G', - '\u24BD': 'H', - '\uFF28': 'H', - '\u0124': 'H', - '\u1E22': 'H', - '\u1E26': 'H', - '\u021E': 'H', - '\u1E24': 'H', - '\u1E28': 'H', - '\u1E2A': 'H', - '\u0126': 'H', - '\u2C67': 'H', - '\u2C75': 'H', - '\uA78D': 'H', - '\u24BE': 'I', - '\uFF29': 'I', - '\u00CC': 'I', - '\u00CD': 'I', - '\u00CE': 'I', - '\u0128': 'I', - '\u012A': 'I', - '\u012C': 'I', - '\u0130': 'I', - '\u00CF': 'I', - '\u1E2E': 'I', - '\u1EC8': 'I', - '\u01CF': 'I', - '\u0208': 'I', - '\u020A': 'I', - '\u1ECA': 'I', - '\u012E': 'I', - '\u1E2C': 'I', - '\u0197': 'I', - '\u24BF': 'J', - '\uFF2A': 'J', - '\u0134': 'J', - '\u0248': 'J', - '\u24C0': 'K', - '\uFF2B': 'K', - '\u1E30': 'K', - '\u01E8': 'K', - '\u1E32': 'K', - '\u0136': 'K', - '\u1E34': 'K', - '\u0198': 'K', - '\u2C69': 'K', - '\uA740': 'K', - '\uA742': 'K', - '\uA744': 'K', - '\uA7A2': 'K', - '\u24C1': 'L', - '\uFF2C': 'L', - '\u013F': 'L', - '\u0139': 'L', - '\u013D': 'L', - '\u1E36': 'L', - '\u1E38': 'L', - '\u013B': 'L', - '\u1E3C': 'L', - '\u1E3A': 'L', - '\u0141': 'L', - '\u023D': 'L', - '\u2C62': 'L', - '\u2C60': 'L', - '\uA748': 'L', - '\uA746': 'L', - '\uA780': 'L', - '\u01C7': 'LJ', - '\u01C8': 'Lj', - '\u24C2': 'M', - '\uFF2D': 'M', - '\u1E3E': 'M', - '\u1E40': 'M', - '\u1E42': 'M', - '\u2C6E': 'M', - '\u019C': 'M', - '\u24C3': 'N', - '\uFF2E': 'N', - '\u01F8': 'N', - '\u0143': 'N', - '\u00D1': 'N', - '\u1E44': 'N', - '\u0147': 'N', - '\u1E46': 'N', - '\u0145': 'N', - '\u1E4A': 'N', - '\u1E48': 'N', - '\u0220': 'N', - '\u019D': 'N', - '\uA790': 'N', - '\uA7A4': 'N', - '\u01CA': 'NJ', - '\u01CB': 'Nj', - '\u24C4': 'O', - '\uFF2F': 'O', - '\u00D2': 'O', - '\u00D3': 'O', - '\u00D4': 'O', - '\u1ED2': 'O', - '\u1ED0': 'O', - '\u1ED6': 'O', - '\u1ED4': 'O', - '\u00D5': 'O', - '\u1E4C': 'O', - '\u022C': 'O', - '\u1E4E': 'O', - '\u014C': 'O', - '\u1E50': 'O', - '\u1E52': 'O', - '\u014E': 'O', - '\u022E': 'O', - '\u0230': 'O', - '\u00D6': 'O', - '\u022A': 'O', - '\u1ECE': 'O', - '\u0150': 'O', - '\u01D1': 'O', - '\u020C': 'O', - '\u020E': 'O', - '\u01A0': 'O', - '\u1EDC': 'O', - '\u1EDA': 'O', - '\u1EE0': 'O', - '\u1EDE': 'O', - '\u1EE2': 'O', - '\u1ECC': 'O', - '\u1ED8': 'O', - '\u01EA': 'O', - '\u01EC': 'O', - '\u00D8': 'O', - '\u01FE': 'O', - '\u0186': 'O', - '\u019F': 'O', - '\uA74A': 'O', - '\uA74C': 'O', - '\u01A2': 'OI', - '\uA74E': 'OO', - '\u0222': 'OU', - '\u24C5': 'P', - '\uFF30': 'P', - '\u1E54': 'P', - '\u1E56': 'P', - '\u01A4': 'P', - '\u2C63': 'P', - '\uA750': 'P', - '\uA752': 'P', - '\uA754': 'P', - '\u24C6': 'Q', - '\uFF31': 'Q', - '\uA756': 'Q', - '\uA758': 'Q', - '\u024A': 'Q', - '\u24C7': 'R', - '\uFF32': 'R', - '\u0154': 'R', - '\u1E58': 'R', - '\u0158': 'R', - '\u0210': 'R', - '\u0212': 'R', - '\u1E5A': 'R', - '\u1E5C': 'R', - '\u0156': 'R', - '\u1E5E': 'R', - '\u024C': 'R', - '\u2C64': 'R', - '\uA75A': 'R', - '\uA7A6': 'R', - '\uA782': 'R', - '\u24C8': 'S', - '\uFF33': 'S', - '\u1E9E': 'S', - '\u015A': 'S', - '\u1E64': 'S', - '\u015C': 'S', - '\u1E60': 'S', - '\u0160': 'S', - '\u1E66': 'S', - '\u1E62': 'S', - '\u1E68': 'S', - '\u0218': 'S', - '\u015E': 'S', - '\u2C7E': 'S', - '\uA7A8': 'S', - '\uA784': 'S', - '\u24C9': 'T', - '\uFF34': 'T', - '\u1E6A': 'T', - '\u0164': 'T', - '\u1E6C': 'T', - '\u021A': 'T', - '\u0162': 'T', - '\u1E70': 'T', - '\u1E6E': 'T', - '\u0166': 'T', - '\u01AC': 'T', - '\u01AE': 'T', - '\u023E': 'T', - '\uA786': 'T', - '\uA728': 'TZ', - '\u24CA': 'U', - '\uFF35': 'U', - '\u00D9': 'U', - '\u00DA': 'U', - '\u00DB': 'U', - '\u0168': 'U', - '\u1E78': 'U', - '\u016A': 'U', - '\u1E7A': 'U', - '\u016C': 'U', - '\u00DC': 'U', - '\u01DB': 'U', - '\u01D7': 'U', - '\u01D5': 'U', - '\u01D9': 'U', - '\u1EE6': 'U', - '\u016E': 'U', - '\u0170': 'U', - '\u01D3': 'U', - '\u0214': 'U', - '\u0216': 'U', - '\u01AF': 'U', - '\u1EEA': 'U', - '\u1EE8': 'U', - '\u1EEE': 'U', - '\u1EEC': 'U', - '\u1EF0': 'U', - '\u1EE4': 'U', - '\u1E72': 'U', - '\u0172': 'U', - '\u1E76': 'U', - '\u1E74': 'U', - '\u0244': 'U', - '\u24CB': 'V', - '\uFF36': 'V', - '\u1E7C': 'V', - '\u1E7E': 'V', - '\u01B2': 'V', - '\uA75E': 'V', - '\u0245': 'V', - '\uA760': 'VY', - '\u24CC': 'W', - '\uFF37': 'W', - '\u1E80': 'W', - '\u1E82': 'W', - '\u0174': 'W', - '\u1E86': 'W', - '\u1E84': 'W', - '\u1E88': 'W', - '\u2C72': 'W', - '\u24CD': 'X', - '\uFF38': 'X', - '\u1E8A': 'X', - '\u1E8C': 'X', - '\u24CE': 'Y', - '\uFF39': 'Y', - '\u1EF2': 'Y', - '\u00DD': 'Y', - '\u0176': 'Y', - '\u1EF8': 'Y', - '\u0232': 'Y', - '\u1E8E': 'Y', - '\u0178': 'Y', - '\u1EF6': 'Y', - '\u1EF4': 'Y', - '\u01B3': 'Y', - '\u024E': 'Y', - '\u1EFE': 'Y', - '\u24CF': 'Z', - '\uFF3A': 'Z', - '\u0179': 'Z', - '\u1E90': 'Z', - '\u017B': 'Z', - '\u017D': 'Z', - '\u1E92': 'Z', - '\u1E94': 'Z', - '\u01B5': 'Z', - '\u0224': 'Z', - '\u2C7F': 'Z', - '\u2C6B': 'Z', - '\uA762': 'Z', - '\u24D0': 'a', - '\uFF41': 'a', - '\u1E9A': 'a', - '\u00E0': 'a', - '\u00E1': 'a', - '\u00E2': 'a', - '\u1EA7': 'a', - '\u1EA5': 'a', - '\u1EAB': 'a', - '\u1EA9': 'a', - '\u00E3': 'a', - '\u0101': 'a', - '\u0103': 'a', - '\u1EB1': 'a', - '\u1EAF': 'a', - '\u1EB5': 'a', - '\u1EB3': 'a', - '\u0227': 'a', - '\u01E1': 'a', - '\u00E4': 'a', - '\u01DF': 'a', - '\u1EA3': 'a', - '\u00E5': 'a', - '\u01FB': 'a', - '\u01CE': 'a', - '\u0201': 'a', - '\u0203': 'a', - '\u1EA1': 'a', - '\u1EAD': 'a', - '\u1EB7': 'a', - '\u1E01': 'a', - '\u0105': 'a', - '\u2C65': 'a', - '\u0250': 'a', - '\uA733': 'aa', - '\u00E6': 'ae', - '\u01FD': 'ae', - '\u01E3': 'ae', - '\uA735': 'ao', - '\uA737': 'au', - '\uA739': 'av', - '\uA73B': 'av', - '\uA73D': 'ay', - '\u24D1': 'b', - '\uFF42': 'b', - '\u1E03': 'b', - '\u1E05': 'b', - '\u1E07': 'b', - '\u0180': 'b', - '\u0183': 'b', - '\u0253': 'b', - '\u24D2': 'c', - '\uFF43': 'c', - '\u0107': 'c', - '\u0109': 'c', - '\u010B': 'c', - '\u010D': 'c', - '\u00E7': 'c', - '\u1E09': 'c', - '\u0188': 'c', - '\u023C': 'c', - '\uA73F': 'c', - '\u2184': 'c', - '\u24D3': 'd', - '\uFF44': 'd', - '\u1E0B': 'd', - '\u010F': 'd', - '\u1E0D': 'd', - '\u1E11': 'd', - '\u1E13': 'd', - '\u1E0F': 'd', - '\u0111': 'd', - '\u018C': 'd', - '\u0256': 'd', - '\u0257': 'd', - '\uA77A': 'd', - '\u01F3': 'dz', - '\u01C6': 'dz', - '\u24D4': 'e', - '\uFF45': 'e', - '\u00E8': 'e', - '\u00E9': 'e', - '\u00EA': 'e', - '\u1EC1': 'e', - '\u1EBF': 'e', - '\u1EC5': 'e', - '\u1EC3': 'e', - '\u1EBD': 'e', - '\u0113': 'e', - '\u1E15': 'e', - '\u1E17': 'e', - '\u0115': 'e', - '\u0117': 'e', - '\u00EB': 'e', - '\u1EBB': 'e', - '\u011B': 'e', - '\u0205': 'e', - '\u0207': 'e', - '\u1EB9': 'e', - '\u1EC7': 'e', - '\u0229': 'e', - '\u1E1D': 'e', - '\u0119': 'e', - '\u1E19': 'e', - '\u1E1B': 'e', - '\u0247': 'e', - '\u025B': 'e', - '\u01DD': 'e', - '\u24D5': 'f', - '\uFF46': 'f', - '\u1E1F': 'f', - '\u0192': 'f', - '\uA77C': 'f', - '\u24D6': 'g', - '\uFF47': 'g', - '\u01F5': 'g', - '\u011D': 'g', - '\u1E21': 'g', - '\u011F': 'g', - '\u0121': 'g', - '\u01E7': 'g', - '\u0123': 'g', - '\u01E5': 'g', - '\u0260': 'g', - '\uA7A1': 'g', - '\u1D79': 'g', - '\uA77F': 'g', - '\u24D7': 'h', - '\uFF48': 'h', - '\u0125': 'h', - '\u1E23': 'h', - '\u1E27': 'h', - '\u021F': 'h', - '\u1E25': 'h', - '\u1E29': 'h', - '\u1E2B': 'h', - '\u1E96': 'h', - '\u0127': 'h', - '\u2C68': 'h', - '\u2C76': 'h', - '\u0265': 'h', - '\u0195': 'hv', - '\u24D8': 'i', - '\uFF49': 'i', - '\u00EC': 'i', - '\u00ED': 'i', - '\u00EE': 'i', - '\u0129': 'i', - '\u012B': 'i', - '\u012D': 'i', - '\u00EF': 'i', - '\u1E2F': 'i', - '\u1EC9': 'i', - '\u01D0': 'i', - '\u0209': 'i', - '\u020B': 'i', - '\u1ECB': 'i', - '\u012F': 'i', - '\u1E2D': 'i', - '\u0268': 'i', - '\u0131': 'i', - '\u24D9': 'j', - '\uFF4A': 'j', - '\u0135': 'j', - '\u01F0': 'j', - '\u0249': 'j', - '\u24DA': 'k', - '\uFF4B': 'k', - '\u1E31': 'k', - '\u01E9': 'k', - '\u1E33': 'k', - '\u0137': 'k', - '\u1E35': 'k', - '\u0199': 'k', - '\u2C6A': 'k', - '\uA741': 'k', - '\uA743': 'k', - '\uA745': 'k', - '\uA7A3': 'k', - '\u24DB': 'l', - '\uFF4C': 'l', - '\u0140': 'l', - '\u013A': 'l', - '\u013E': 'l', - '\u1E37': 'l', - '\u1E39': 'l', - '\u013C': 'l', - '\u1E3D': 'l', - '\u1E3B': 'l', - '\u017F': 'l', - '\u0142': 'l', - '\u019A': 'l', - '\u026B': 'l', - '\u2C61': 'l', - '\uA749': 'l', - '\uA781': 'l', - '\uA747': 'l', - '\u01C9': 'lj', - '\u24DC': 'm', - '\uFF4D': 'm', - '\u1E3F': 'm', - '\u1E41': 'm', - '\u1E43': 'm', - '\u0271': 'm', - '\u026F': 'm', - '\u24DD': 'n', - '\uFF4E': 'n', - '\u01F9': 'n', - '\u0144': 'n', - '\u00F1': 'n', - '\u1E45': 'n', - '\u0148': 'n', - '\u1E47': 'n', - '\u0146': 'n', - '\u1E4B': 'n', - '\u1E49': 'n', - '\u019E': 'n', - '\u0272': 'n', - '\u0149': 'n', - '\uA791': 'n', - '\uA7A5': 'n', - '\u01CC': 'nj', - '\u24DE': 'o', - '\uFF4F': 'o', - '\u00F2': 'o', - '\u00F3': 'o', - '\u00F4': 'o', - '\u1ED3': 'o', - '\u1ED1': 'o', - '\u1ED7': 'o', - '\u1ED5': 'o', - '\u00F5': 'o', - '\u1E4D': 'o', - '\u022D': 'o', - '\u1E4F': 'o', - '\u014D': 'o', - '\u1E51': 'o', - '\u1E53': 'o', - '\u014F': 'o', - '\u022F': 'o', - '\u0231': 'o', - '\u00F6': 'o', - '\u022B': 'o', - '\u1ECF': 'o', - '\u0151': 'o', - '\u01D2': 'o', - '\u020D': 'o', - '\u020F': 'o', - '\u01A1': 'o', - '\u1EDD': 'o', - '\u1EDB': 'o', - '\u1EE1': 'o', - '\u1EDF': 'o', - '\u1EE3': 'o', - '\u1ECD': 'o', - '\u1ED9': 'o', - '\u01EB': 'o', - '\u01ED': 'o', - '\u00F8': 'o', - '\u01FF': 'o', - '\u0254': 'o', - '\uA74B': 'o', - '\uA74D': 'o', - '\u0275': 'o', - '\u01A3': 'oi', - '\u0223': 'ou', - '\uA74F': 'oo', - '\u24DF': 'p', - '\uFF50': 'p', - '\u1E55': 'p', - '\u1E57': 'p', - '\u01A5': 'p', - '\u1D7D': 'p', - '\uA751': 'p', - '\uA753': 'p', - '\uA755': 'p', - '\u24E0': 'q', - '\uFF51': 'q', - '\u024B': 'q', - '\uA757': 'q', - '\uA759': 'q', - '\u24E1': 'r', - '\uFF52': 'r', - '\u0155': 'r', - '\u1E59': 'r', - '\u0159': 'r', - '\u0211': 'r', - '\u0213': 'r', - '\u1E5B': 'r', - '\u1E5D': 'r', - '\u0157': 'r', - '\u1E5F': 'r', - '\u024D': 'r', - '\u027D': 'r', - '\uA75B': 'r', - '\uA7A7': 'r', - '\uA783': 'r', - '\u24E2': 's', - '\uFF53': 's', - '\u00DF': 's', - '\u015B': 's', - '\u1E65': 's', - '\u015D': 's', - '\u1E61': 's', - '\u0161': 's', - '\u1E67': 's', - '\u1E63': 's', - '\u1E69': 's', - '\u0219': 's', - '\u015F': 's', - '\u023F': 's', - '\uA7A9': 's', - '\uA785': 's', - '\u1E9B': 's', - '\u24E3': 't', - '\uFF54': 't', - '\u1E6B': 't', - '\u1E97': 't', - '\u0165': 't', - '\u1E6D': 't', - '\u021B': 't', - '\u0163': 't', - '\u1E71': 't', - '\u1E6F': 't', - '\u0167': 't', - '\u01AD': 't', - '\u0288': 't', - '\u2C66': 't', - '\uA787': 't', - '\uA729': 'tz', - '\u24E4': 'u', - '\uFF55': 'u', - '\u00F9': 'u', - '\u00FA': 'u', - '\u00FB': 'u', - '\u0169': 'u', - '\u1E79': 'u', - '\u016B': 'u', - '\u1E7B': 'u', - '\u016D': 'u', - '\u00FC': 'u', - '\u01DC': 'u', - '\u01D8': 'u', - '\u01D6': 'u', - '\u01DA': 'u', - '\u1EE7': 'u', - '\u016F': 'u', - '\u0171': 'u', - '\u01D4': 'u', - '\u0215': 'u', - '\u0217': 'u', - '\u01B0': 'u', - '\u1EEB': 'u', - '\u1EE9': 'u', - '\u1EEF': 'u', - '\u1EED': 'u', - '\u1EF1': 'u', - '\u1EE5': 'u', - '\u1E73': 'u', - '\u0173': 'u', - '\u1E77': 'u', - '\u1E75': 'u', - '\u0289': 'u', - '\u24E5': 'v', - '\uFF56': 'v', - '\u1E7D': 'v', - '\u1E7F': 'v', - '\u028B': 'v', - '\uA75F': 'v', - '\u028C': 'v', - '\uA761': 'vy', - '\u24E6': 'w', - '\uFF57': 'w', - '\u1E81': 'w', - '\u1E83': 'w', - '\u0175': 'w', - '\u1E87': 'w', - '\u1E85': 'w', - '\u1E98': 'w', - '\u1E89': 'w', - '\u2C73': 'w', - '\u24E7': 'x', - '\uFF58': 'x', - '\u1E8B': 'x', - '\u1E8D': 'x', - '\u24E8': 'y', - '\uFF59': 'y', - '\u1EF3': 'y', - '\u00FD': 'y', - '\u0177': 'y', - '\u1EF9': 'y', - '\u0233': 'y', - '\u1E8F': 'y', - '\u00FF': 'y', - '\u1EF7': 'y', - '\u1E99': 'y', - '\u1EF5': 'y', - '\u01B4': 'y', - '\u024F': 'y', - '\u1EFF': 'y', - '\u24E9': 'z', - '\uFF5A': 'z', - '\u017A': 'z', - '\u1E91': 'z', - '\u017C': 'z', - '\u017E': 'z', - '\u1E93': 'z', - '\u1E95': 'z', - '\u01B6': 'z', - '\u0225': 'z', - '\u0240': 'z', - '\u2C6C': 'z', - '\uA763': 'z', - '\u0386': '\u0391', - '\u0388': '\u0395', - '\u0389': '\u0397', - '\u038A': '\u0399', - '\u03AA': '\u0399', - '\u038C': '\u039F', - '\u038E': '\u03A5', - '\u03AB': '\u03A5', - '\u038F': '\u03A9', - '\u03AC': '\u03B1', - '\u03AD': '\u03B5', - '\u03AE': '\u03B7', - '\u03AF': '\u03B9', - '\u03CA': '\u03B9', - '\u0390': '\u03B9', - '\u03CC': '\u03BF', - '\u03CD': '\u03C5', - '\u03CB': '\u03C5', - '\u03B0': '\u03C5', - '\u03C9': '\u03C9', - '\u03C2': '\u03C3' - }; - - return diacritics; -}); - -define('select2/data/base',[ - '../utils' -], function (Utils) { - function BaseAdapter ($element, options) { - BaseAdapter.__super__.constructor.call(this); - } - - Utils.Extend(BaseAdapter, Utils.Observable); - - BaseAdapter.prototype.current = function (callback) { - throw new Error('The `current` method must be defined in child classes.'); - }; - - BaseAdapter.prototype.query = function (params, callback) { - throw new Error('The `query` method must be defined in child classes.'); - }; - - BaseAdapter.prototype.bind = function (container, $container) { - // Can be implemented in subclasses - }; - - BaseAdapter.prototype.destroy = function () { - // Can be implemented in subclasses - }; - - BaseAdapter.prototype.generateResultId = function (container, data) { - var id = container.id + '-result-'; - - id += Utils.generateChars(4); - - if (data.id != null) { - id += '-' + data.id.toString(); - } else { - id += '-' + Utils.generateChars(4); - } - return id; - }; - - return BaseAdapter; -}); - -define('select2/data/select',[ - './base', - '../utils', - 'jquery' -], function (BaseAdapter, Utils, $) { - function SelectAdapter ($element, options) { - this.$element = $element; - this.options = options; - - SelectAdapter.__super__.constructor.call(this); - } - - Utils.Extend(SelectAdapter, BaseAdapter); - - SelectAdapter.prototype.current = function (callback) { - var data = []; - var self = this; - - this.$element.find(':selected').each(function () { - var $option = $(this); - - var option = self.item($option); - - data.push(option); - }); - - callback(data); - }; - - SelectAdapter.prototype.select = function (data) { - var self = this; - - // If data.element is a DOM nose, use it instead - if ($(data.element).is('option')) { - data.element.selected = true; - - this.$element.trigger('change'); - - return; - } - - if (this.$element.prop('multiple')) { - this.current(function (currentData) { - var val = []; - - data = [data]; - data.push.apply(data, currentData); - - for (var d = 0; d < data.length; d++) { - var id = data[d].id; - - if ($.inArray(id, val) === -1) { - val.push(id); - } - } - - self.$element.val(val); - self.$element.trigger('change'); - }); - } else { - var val = data.id; - - this.$element.val(val); - this.$element.trigger('change'); - } - }; - - SelectAdapter.prototype.unselect = function (data) { - var self = this; - - if (!this.$element.prop('multiple')) { - return; - } - - if ($(data.element).is('option')) { - data.element.selected = false; - - this.$element.trigger('change'); - - return; - } - - this.current(function (currentData) { - var val = []; - - for (var d = 0; d < currentData.length; d++) { - var id = currentData[d].id; - - if (id !== data.id && $.inArray(id, val) === -1) { - val.push(id); - } - } - - self.$element.val(val); - - self.$element.trigger('change'); - }); - }; - - SelectAdapter.prototype.bind = function (container, $container) { - var self = this; - - this.container = container; - - container.on('select', function (params) { - self.select(params.data); - }); - - container.on('unselect', function (params) { - self.unselect(params.data); - }); - }; - - SelectAdapter.prototype.destroy = function () { - // Remove anything added to child elements - this.$element.find('*').each(function () { - // Remove any custom data set by Select2 - $.removeData(this, 'data'); - }); - }; - - SelectAdapter.prototype.query = function (params, callback) { - var data = []; - var self = this; - - var $options = this.$element.children(); - - $options.each(function () { - var $option = $(this); - - if (!$option.is('option') && !$option.is('optgroup')) { - return; - } - - var option = self.item($option); - - var matches = self.matches(params, option); - - if (matches !== null) { - data.push(matches); - } - }); - - callback({ - results: data - }); - }; - - SelectAdapter.prototype.addOptions = function ($options) { - this.$element.append($options); - }; - - SelectAdapter.prototype.option = function (data) { - var option; - - if (data.children) { - option = document.createElement('optgroup'); - option.label = data.text; - } else { - option = document.createElement('option'); - - if (option.textContent !== undefined) { - option.textContent = data.text; - } else { - option.innerText = data.text; - } - } - - if (data.id) { - option.value = data.id; - } - - if (data.disabled) { - option.disabled = true; - } - - if (data.selected) { - option.selected = true; - } - - if (data.title) { - option.title = data.title; - } - - var $option = $(option); - - var normalizedData = this._normalizeItem(data); - normalizedData.element = option; - - // Override the option's data with the combined data - $.data(option, 'data', normalizedData); - - return $option; - }; - - SelectAdapter.prototype.item = function ($option) { - var data = {}; - - data = $.data($option[0], 'data'); - - if (data != null) { - return data; - } - - if ($option.is('option')) { - data = { - id: $option.val(), - text: $option.html(), - disabled: $option.prop('disabled'), - selected: $option.prop('selected'), - title: $option.prop('title') - }; - } else if ($option.is('optgroup')) { - data = { - text: $option.prop('label'), - children: [], - title: $option.prop('title') - }; - - var $children = $option.children('option'); - var children = []; - - for (var c = 0; c < $children.length; c++) { - var $child = $($children[c]); - - var child = this.item($child); - - children.push(child); - } - - data.children = children; - } - - data = this._normalizeItem(data); - data.element = $option[0]; - - $.data($option[0], 'data', data); - - return data; - }; - - SelectAdapter.prototype._normalizeItem = function (item) { - if (!$.isPlainObject(item)) { - item = { - id: item, - text: item - }; - } - - item = $.extend({}, { - text: '' - }, item); - - var defaults = { - selected: false, - disabled: false - }; - - if (item.id != null) { - item.id = item.id.toString(); - } - - if (item.text != null) { - item.text = item.text.toString(); - } - - if (item._resultId == null && item.id && this.container != null) { - item._resultId = this.generateResultId(this.container, item); - } - - return $.extend({}, defaults, item); - }; - - SelectAdapter.prototype.matches = function (params, data) { - var matcher = this.options.get('matcher'); - - return matcher(params, data); - }; - - return SelectAdapter; -}); - -define('select2/data/array',[ - './select', - '../utils', - 'jquery' -], function (SelectAdapter, Utils, $) { - function ArrayAdapter ($element, options) { - var data = options.get('data') || []; - - ArrayAdapter.__super__.constructor.call(this, $element, options); - - this.addOptions(this.convertToOptions(data)); - } - - Utils.Extend(ArrayAdapter, SelectAdapter); - - ArrayAdapter.prototype.select = function (data) { - var $option = this.$element.find('option[value="' + data.id + '"]'); - - if ($option.length === 0) { - $option = this.option(data); - - this.addOptions([$option]); - } - - ArrayAdapter.__super__.select.call(this, data); - }; - - ArrayAdapter.prototype.convertToOptions = function (data) { - var self = this; - - var $existing = this.$element.find('option'); - var existingIds = $existing.map(function () { - return self.item($(this)).id; - }).get(); - - var $options = []; - - // Filter out all items except for the one passed in the argument - function onlyItem (item) { - return function () { - return $(this).val() == item.id; - }; - } - - for (var d = 0; d < data.length; d++) { - var item = this._normalizeItem(data[d]); - - // Skip items which were pre-loaded, only merge the data - if ($.inArray(item.id, existingIds) >= 0) { - var $existingOption = $existing.filter(onlyItem(item)); - - var existingData = this.item($existingOption); - var newData = $.extend(true, {}, existingData, item); - - var $newOption = this.option(existingData); - - $existingOption.replaceWith($newOption); - - continue; - } - - var $option = this.option(item); - - if (item.children) { - var $children = this.convertToOptions(item.children); - - $option.append($children); - } - - $options.push($option); - } - - return $options; - }; - - return ArrayAdapter; -}); - -define('select2/data/ajax',[ - './array', - '../utils', - 'jquery' -], function (ArrayAdapter, Utils, $) { - function AjaxAdapter ($element, options) { - this.ajaxOptions = this._applyDefaults(options.get('ajax')); - - if (this.ajaxOptions.processResults != null) { - this.processResults = this.ajaxOptions.processResults; - } - - ArrayAdapter.__super__.constructor.call(this, $element, options); - } - - Utils.Extend(AjaxAdapter, ArrayAdapter); - - AjaxAdapter.prototype._applyDefaults = function (options) { - var defaults = { - data: function (params) { - return { - q: params.term - }; - }, - transport: function (params, success, failure) { - var $request = $.ajax(params); - - $request.then(success); - $request.fail(failure); - - return $request; - } - }; - - return $.extend({}, defaults, options, true); - }; - - AjaxAdapter.prototype.processResults = function (results) { - return results; - }; - - AjaxAdapter.prototype.query = function (params, callback) { - var matches = []; - var self = this; - - if (this._request) { - this._request.abort(); - this._request = null; - } - - var options = $.extend({ - type: 'GET' - }, this.ajaxOptions); - - if (typeof options.url === 'function') { - options.url = options.url(params); - } - - if (typeof options.data === 'function') { - options.data = options.data(params); - } - - function request () { - var $request = options.transport(options, function (data) { - var results = self.processResults(data, params); - - if (window.console && console.error) { - // Check to make sure that the response included a `results` key. - if (!results || !results.results || !$.isArray(results.results)) { - console.error( - 'Select2: The AJAX results did not return an array in the ' + - '`results` key of the response.' - ); - } - } - - callback(results); - }, function () { - // TODO: Handle AJAX errors - }); - - self._request = $request; - } - - if (this.ajaxOptions.delay && params.term !== '') { - if (this._queryTimeout) { - window.clearTimeout(this._queryTimeout); - } - - this._queryTimeout = window.setTimeout(request, this.ajaxOptions.delay); - } else { - request(); - } - }; - - return AjaxAdapter; -}); - -define('select2/data/tags',[ - 'jquery' -], function ($) { - function Tags (decorated, $element, options) { - var tags = options.get('tags'); - - var createTag = options.get('createTag'); - - if (createTag !== undefined) { - this.createTag = createTag; - } - - decorated.call(this, $element, options); - - if ($.isArray(tags)) { - for (var t = 0; t < tags.length; t++) { - var tag = tags[t]; - var item = this._normalizeItem(tag); - - var $option = this.option(item); - - this.$element.append($option); - } - } - } - - Tags.prototype.query = function (decorated, params, callback) { - var self = this; - - this._removeOldTags(); - - if (params.term == null || params.term === '' || params.page != null) { - decorated.call(this, params, callback); - return; - } - - function wrapper (obj, child) { - var data = obj.results; - - for (var i = 0; i < data.length; i++) { - var option = data[i]; - - var checkChildren = ( - option.children != null && - !wrapper({ - results: option.children - }, true) - ); - - var checkText = option.text === params.term; - - if (checkText || checkChildren) { - if (child) { - return false; - } - - obj.data = data; - callback(obj); - - return; - } - } - - if (child) { - return true; - } - - var tag = self.createTag(params); - - if (tag != null) { - var $option = self.option(tag); - $option.attr('data-select2-tag', true); - - self.addOptions([$option]); - - self.insertTag(data, tag); - } - - obj.results = data; - - callback(obj); - } - - decorated.call(this, params, wrapper); - }; - - Tags.prototype.createTag = function (decorated, params) { - return { - id: params.term, - text: params.term - }; - }; - - Tags.prototype.insertTag = function (_, data, tag) { - data.unshift(tag); - }; - - Tags.prototype._removeOldTags = function (_) { - var tag = this._lastTag; - - var $options = this.$element.find('option[data-select2-tag]'); - - $options.each(function () { - if (this.selected) { - return; - } - - $(this).remove(); - }); - }; - - return Tags; -}); - -define('select2/data/tokenizer',[ - 'jquery' -], function ($) { - function Tokenizer (decorated, $element, options) { - var tokenizer = options.get('tokenizer'); - - if (tokenizer !== undefined) { - this.tokenizer = tokenizer; - } - - decorated.call(this, $element, options); - } - - Tokenizer.prototype.bind = function (decorated, container, $container) { - decorated.call(this, container, $container); - - this.$search = container.dropdown.$search || container.selection.$search || - $container.find('.select2-search__field'); - }; - - Tokenizer.prototype.query = function (decorated, params, callback) { - var self = this; - - function select (data) { - self.select(data); - } - - params.term = params.term || ''; - - var tokenData = this.tokenizer(params, this.options, select); - - if (tokenData.term !== params.term) { - // Replace the search term if we have the search box - if (this.$search.length) { - this.$search.val(tokenData.term); - this.$search.focus(); - } - - params.term = tokenData.term; - } - - decorated.call(this, params, callback); - }; - - Tokenizer.prototype.tokenizer = function (_, params, options, callback) { - var separators = options.get('tokenSeparators') || []; - var term = params.term; - var i = 0; - - var createTag = this.createTag || function (params) { - return { - id: params.term, - text: params.term - }; - }; - - while (i < term.length) { - var termChar = term[i]; - - if ($.inArray(termChar, separators) === -1) { - i++; - - continue; - } - - var part = term.substr(0, i); - var partParams = $.extend({}, params, { - term: part - }); - - var data = createTag(partParams); - - callback(data); - - // Reset the term to not include the tokenized portion - term = term.substr(i + 1) || ''; - i = 0; - } - - return { - term: term - }; - }; - - return Tokenizer; -}); - -define('select2/data/minimumInputLength',[ - -], function () { - function MinimumInputLength (decorated, $e, options) { - this.minimumInputLength = options.get('minimumInputLength'); - - decorated.call(this, $e, options); - } - - MinimumInputLength.prototype.query = function (decorated, params, callback) { - params.term = params.term || ''; - - if (params.term.length < this.minimumInputLength) { - this.trigger('results:message', { - message: 'inputTooShort', - args: { - minimum: this.minimumInputLength, - input: params.term, - params: params - } - }); - - return; - } - - decorated.call(this, params, callback); - }; - - return MinimumInputLength; -}); - -define('select2/data/maximumInputLength',[ - -], function () { - function MaximumInputLength (decorated, $e, options) { - this.maximumInputLength = options.get('maximumInputLength'); - - decorated.call(this, $e, options); - } - - MaximumInputLength.prototype.query = function (decorated, params, callback) { - params.term = params.term || ''; - - if (this.maximumInputLength > 0 && - params.term.length > this.maximumInputLength) { - this.trigger('results:message', { - message: 'inputTooLong', - args: { - maximum: this.maximumInputLength, - input: params.term, - params: params - } - }); - - return; - } - - decorated.call(this, params, callback); - }; - - return MaximumInputLength; -}); - -define('select2/data/maximumSelectionLength',[ - -], function (){ - function MaximumSelectionLength (decorated, $e, options) { - this.maximumSelectionLength = options.get('maximumSelectionLength'); - - decorated.call(this, $e, options); - } - - MaximumSelectionLength.prototype.query = - function (decorated, params, callback) { - var self = this; - - this.current(function (currentData) { - var count = currentData != null ? currentData.length : 0; - if (self.maximumSelectionLength > 0 && - count >= self.maximumSelectionLength) { - self.trigger('results:message', { - message: 'maximumSelected', - args: { - maximum: self.maximumSelectionLength - } - }); - return; - } - decorated.call(self, params, callback); - }); - }; - - return MaximumSelectionLength; -}); - -define('select2/dropdown',[ - 'jquery', - './utils' -], function ($, Utils) { - function Dropdown ($element, options) { - this.$element = $element; - this.options = options; - - Dropdown.__super__.constructor.call(this); - } - - Utils.Extend(Dropdown, Utils.Observable); - - Dropdown.prototype.render = function () { - var $dropdown = $( - '<span class="select2-dropdown">' + - '<span class="select2-results"></span>' + - '</span>' - ); - - $dropdown.attr('dir', this.options.get('dir')); - - this.$dropdown = $dropdown; - - return $dropdown; - }; - - Dropdown.prototype.position = function ($dropdown, $container) { - // Should be implmented in subclasses - }; - - Dropdown.prototype.destroy = function () { - // Remove the dropdown from the DOM - this.$dropdown.remove(); - }; - - return Dropdown; -}); - -define('select2/dropdown/search',[ - 'jquery', - '../utils' -], function ($, Utils) { - function Search () { } - - Search.prototype.render = function (decorated) { - var $rendered = decorated.call(this); - - var $search = $( - '<span class="select2-search select2-search--dropdown">' + - '<input class="select2-search__field" type="search" tabindex="-1"' + - ' autocomplete="off" autocorrect="off" autocapitalize="off"' + - ' spellcheck="false" role="textbox" />' + - '</span>' - ); - - this.$searchContainer = $search; - this.$search = $search.find('input'); - - $rendered.prepend($search); - - return $rendered; - }; - - Search.prototype.bind = function (decorated, container, $container) { - var self = this; - - decorated.call(this, container, $container); - - this.$search.on('keydown', function (evt) { - self.trigger('keypress', evt); - - self._keyUpPrevented = evt.isDefaultPrevented(); - }); - - // Workaround for browsers which do not support the `input` event - // This will prevent double-triggering of events for browsers which support - // both the `keyup` and `input` events. - this.$search.on('input', function (evt) { - // Unbind the duplicated `keyup` event - $(this).off('keyup'); - }); - - this.$search.on('keyup input', function (evt) { - self.handleSearch(evt); - }); - - container.on('open', function () { - self.$search.attr('tabindex', 0); - - self.$search.focus(); - - window.setTimeout(function () { - self.$search.focus(); - }, 0); - }); - - container.on('close', function () { - self.$search.attr('tabindex', -1); - - self.$search.val(''); - }); - - container.on('results:all', function (params) { - if (params.query.term == null || params.query.term === '') { - var showSearch = self.showSearch(params); - - if (showSearch) { - self.$searchContainer.removeClass('select2-search--hide'); - } else { - self.$searchContainer.addClass('select2-search--hide'); - } - } - }); - }; - - Search.prototype.handleSearch = function (evt) { - if (!this._keyUpPrevented) { - var input = this.$search.val(); - - this.trigger('query', { - term: input - }); - } - - this._keyUpPrevented = false; - }; - - Search.prototype.showSearch = function (_, params) { - return true; - }; - - return Search; -}); - -define('select2/dropdown/hidePlaceholder',[ - -], function () { - function HidePlaceholder (decorated, $element, options, dataAdapter) { - this.placeholder = this.normalizePlaceholder(options.get('placeholder')); - - decorated.call(this, $element, options, dataAdapter); - } - - HidePlaceholder.prototype.append = function (decorated, data) { - data.results = this.removePlaceholder(data.results); - - decorated.call(this, data); - }; - - HidePlaceholder.prototype.normalizePlaceholder = function (_, placeholder) { - if (typeof placeholder === 'string') { - placeholder = { - id: '', - text: placeholder - }; - } - - return placeholder; - }; - - HidePlaceholder.prototype.removePlaceholder = function (_, data) { - var modifiedData = data.slice(0); - - for (var d = data.length - 1; d >= 0; d--) { - var item = data[d]; - - if (this.placeholder.id === item.id) { - modifiedData.splice(d, 1); - } - } - - return modifiedData; - }; - - return HidePlaceholder; -}); - -define('select2/dropdown/infiniteScroll',[ - 'jquery' -], function ($) { - function InfiniteScroll (decorated, $element, options, dataAdapter) { - this.lastParams = {}; - - decorated.call(this, $element, options, dataAdapter); - - this.$loadingMore = this.createLoadingMore(); - this.loading = false; - } - - InfiniteScroll.prototype.append = function (decorated, data) { - this.$loadingMore.remove(); - this.loading = false; - - decorated.call(this, data); - - if (this.showLoadingMore(data)) { - this.$results.append(this.$loadingMore); - } - }; - - InfiniteScroll.prototype.bind = function (decorated, container, $container) { - var self = this; - - decorated.call(this, container, $container); - - container.on('query', function (params) { - self.lastParams = params; - self.loading = true; - }); - - container.on('query:append', function (params) { - self.lastParams = params; - self.loading = true; - }); - - this.$results.on('scroll', function () { - var isLoadMoreVisible = $.contains( - document.documentElement, - self.$loadingMore[0] - ); - - if (self.loading || !isLoadMoreVisible) { - return; - } - - var currentOffset = self.$results.offset().top + - self.$results.outerHeight(false); - var loadingMoreOffset = self.$loadingMore.offset().top + - self.$loadingMore.outerHeight(false); - - if (currentOffset + 50 >= loadingMoreOffset) { - self.loadMore(); - } - }); - }; - - InfiniteScroll.prototype.loadMore = function () { - this.loading = true; - - var params = $.extend({}, {page: 1}, this.lastParams); - - params.page++; - - this.trigger('query:append', params); - }; - - InfiniteScroll.prototype.showLoadingMore = function (_, data) { - return data.pagination && data.pagination.more; - }; - - InfiniteScroll.prototype.createLoadingMore = function () { - var $option = $( - '<li class="option load-more" role="treeitem"></li>' - ); - - var message = this.options.get('translations').get('loadingMore'); - - $option.html(message(this.lastParams)); - - return $option; - }; - - return InfiniteScroll; -}); - -define('select2/dropdown/attachBody',[ - 'jquery', - '../utils' -], function ($, Utils) { - function AttachBody (decorated, $element, options) { - this.$dropdownParent = options.get('dropdownParent') || document.body; - - decorated.call(this, $element, options); - } - - AttachBody.prototype.bind = function (decorated, container, $container) { - var self = this; - - var setupResultsEvents = false; - - decorated.call(this, container, $container); - - container.on('open', function () { - self._showDropdown(); - self._attachPositioningHandler(container); - - if (!setupResultsEvents) { - setupResultsEvents = true; - - container.on('results:all', function () { - self._positionDropdown(); - self._resizeDropdown(); - }); - - container.on('results:append', function () { - self._positionDropdown(); - self._resizeDropdown(); - }); - } - }); - - container.on('close', function () { - self._hideDropdown(); - self._detachPositioningHandler(container); - }); - - this.$dropdownContainer.on('mousedown', function (evt) { - evt.stopPropagation(); - }); - }; - - AttachBody.prototype.position = function (decorated, $dropdown, $container) { - // Clone all of the container classes - $dropdown.attr('class', $container.attr('class')); - - $dropdown.removeClass('select2'); - $dropdown.addClass('select2-container--open'); - - $dropdown.css({ - position: 'absolute', - top: -999999 - }); - - this.$container = $container; - }; - - AttachBody.prototype.render = function (decorated) { - var $container = $('<span></span>'); - - var $dropdown = decorated.call(this); - $container.append($dropdown); - - this.$dropdownContainer = $container; - - return $container; - }; - - AttachBody.prototype._hideDropdown = function (decorated) { - this.$dropdownContainer.detach(); - }; - - AttachBody.prototype._attachPositioningHandler = function (container) { - var self = this; - - var scrollEvent = 'scroll.select2.' + container.id; - var resizeEvent = 'resize.select2.' + container.id; - var orientationEvent = 'orientationchange.select2.' + container.id; - - var $watchers = this.$container.parents().filter(Utils.hasScroll); - $watchers.each(function () { - $(this).data('select2-scroll-position', { - x: $(this).scrollLeft(), - y: $(this).scrollTop() - }); - }); - - $watchers.on(scrollEvent, function (ev) { - var position = $(this).data('select2-scroll-position'); - $(this).scrollTop(position.y); - }); - - $(window).on(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent, - function (e) { - self._positionDropdown(); - self._resizeDropdown(); - }); - }; - - AttachBody.prototype._detachPositioningHandler = function (container) { - var scrollEvent = 'scroll.select2.' + container.id; - var resizeEvent = 'resize.select2.' + container.id; - var orientationEvent = 'orientationchange.select2.' + container.id; - - var $watchers = this.$container.parents().filter(Utils.hasScroll); - $watchers.off(scrollEvent); - - $(window).off(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent); - }; - - AttachBody.prototype._positionDropdown = function () { - var $window = $(window); - - var isCurrentlyAbove = this.$dropdown.hasClass('select2-dropdown--above'); - var isCurrentlyBelow = this.$dropdown.hasClass('select2-dropdown--below'); - - var newDirection = null; - - var position = this.$container.position(); - var offset = this.$container.offset(); - - offset.bottom = offset.top + this.$container.outerHeight(false); - - var container = { - height: this.$container.outerHeight(false) - }; - - container.top = offset.top; - container.bottom = offset.top + container.height; - - var dropdown = { - height: this.$dropdown.outerHeight(false) - }; - - var viewport = { - top: $window.scrollTop(), - bottom: $window.scrollTop() + $window.height() - }; - - var enoughRoomAbove = viewport.top < (offset.top - dropdown.height); - var enoughRoomBelow = viewport.bottom > (offset.bottom + dropdown.height); - - var css = { - left: offset.left, - top: container.bottom - }; - - if (!isCurrentlyAbove && !isCurrentlyBelow) { - newDirection = 'below'; - } - - if (!enoughRoomBelow && enoughRoomAbove && !isCurrentlyAbove) { - newDirection = 'above'; - } else if (!enoughRoomAbove && enoughRoomBelow && isCurrentlyAbove) { - newDirection = 'below'; - } - - if (newDirection == 'above' || - (isCurrentlyAbove && newDirection !== 'below')) { - css.top = container.top - dropdown.height; - } - - if (newDirection != null) { - this.$dropdown - .removeClass('select2-dropdown--below select2-dropdown--above') - .addClass('select2-dropdown--' + newDirection); - this.$container - .removeClass('select2-container--below select2-container--above') - .addClass('select2-container--' + newDirection); - } - - this.$dropdownContainer.css(css); - }; - - AttachBody.prototype._resizeDropdown = function () { - this.$dropdownContainer.width(); - - this.$dropdown.css({ - width: this.$container.outerWidth(false) + 'px' - }); - }; - - AttachBody.prototype._showDropdown = function (decorated) { - this.$dropdownContainer.appendTo(this.$dropdownParent); - - this._positionDropdown(); - this._resizeDropdown(); - }; - - return AttachBody; -}); - -define('select2/dropdown/minimumResultsForSearch',[ - -], function () { - function countResults (data) { - var count = 0; - - for (var d = 0; d < data.length; d++) { - var item = data[d]; - - if (item.children) { - count += countResults(item.children); - } else { - count++; - } - } - - return count; - } - - function MinimumResultsForSearch (decorated, $element, options, dataAdapter) { - this.minimumResultsForSearch = options.get('minimumResultsForSearch'); - - if (this.minimumResultsForSearch < 0) { - this.minimumResultsForSearch = Infinity; - } - - decorated.call(this, $element, options, dataAdapter); - } - - MinimumResultsForSearch.prototype.showSearch = function (decorated, params) { - if (countResults(params.data.results) < this.minimumResultsForSearch) { - return false; - } - - return decorated.call(this, params); - }; - - return MinimumResultsForSearch; -}); - -define('select2/dropdown/selectOnClose',[ - -], function () { - function SelectOnClose () { } - - SelectOnClose.prototype.bind = function (decorated, container, $container) { - var self = this; - - decorated.call(this, container, $container); - - container.on('close', function () { - self._handleSelectOnClose(); - }); - }; - - SelectOnClose.prototype._handleSelectOnClose = function () { - var $highlightedResults = this.getHighlightedResults(); - - if ($highlightedResults.length < 1) { - return; - } - - $highlightedResults.trigger('mouseup'); - }; - - return SelectOnClose; -}); - -define('select2/dropdown/closeOnSelect',[ - -], function () { - function CloseOnSelect () { } - - CloseOnSelect.prototype.bind = function (decorated, container, $container) { - var self = this; - - decorated.call(this, container, $container); - - container.on('select', function (evt) { - self._selectTriggered(evt); - }); - - container.on('unselect', function (evt) { - self._selectTriggered(evt); - }); - }; - - CloseOnSelect.prototype._selectTriggered = function (_, evt) { - var originalEvent = evt.originalEvent; - - // Don't close if the control key is being held - if (originalEvent && originalEvent.ctrlKey) { - return; - } - - this.trigger('close'); - }; - - return CloseOnSelect; -}); - -define('select2/i18n/en',[],function () { - // English - return { - errorLoading: function () { - return 'The results could not be loaded.'; - }, - inputTooLong: function (args) { - var overChars = args.input.length - args.maximum; - - var message = 'Please delete ' + overChars + ' character'; - - if (overChars != 1) { - message += 's'; - } - - return message; - }, - inputTooShort: function (args) { - var remainingChars = args.minimum - args.input.length; - - var message = 'Please enter ' + remainingChars + ' or more characters'; - - return message; - }, - loadingMore: function () { - return 'Loading more results…'; - }, - maximumSelected: function (args) { - var message = 'You can only select ' + args.maximum + ' item'; - - if (args.maximum != 1) { - message += 's'; - } - - return message; - }, - noResults: function () { - return 'No results found'; - }, - searching: function () { - return 'Searching…'; - } - }; -}); - -define('select2/defaults',[ - 'jquery', - './results', - - './selection/single', - './selection/multiple', - './selection/placeholder', - './selection/allowClear', - './selection/search', - './selection/eventRelay', - - './utils', - './translation', - './diacritics', - - './data/select', - './data/array', - './data/ajax', - './data/tags', - './data/tokenizer', - './data/minimumInputLength', - './data/maximumInputLength', - './data/maximumSelectionLength', - - './dropdown', - './dropdown/search', - './dropdown/hidePlaceholder', - './dropdown/infiniteScroll', - './dropdown/attachBody', - './dropdown/minimumResultsForSearch', - './dropdown/selectOnClose', - './dropdown/closeOnSelect', - - './i18n/en' -], function ($, ResultsList, - - SingleSelection, MultipleSelection, Placeholder, AllowClear, - SelectionSearch, EventRelay, - - Utils, Translation, DIACRITICS, - - SelectData, ArrayData, AjaxData, Tags, Tokenizer, - MinimumInputLength, MaximumInputLength, MaximumSelectionLength, - - Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll, - AttachBody, MinimumResultsForSearch, SelectOnClose, CloseOnSelect, - - EnglishTranslation) { - function Defaults () { - this.reset(); - } - - Defaults.prototype.apply = function (options) { - options = $.extend({}, this.defaults, options); - - if (options.dataAdapter == null) { - if (options.ajax != null) { - options.dataAdapter = AjaxData; - } else if (options.data != null) { - options.dataAdapter = ArrayData; - } else { - options.dataAdapter = SelectData; - } - - if (options.minimumInputLength > 0) { - options.dataAdapter = Utils.Decorate( - options.dataAdapter, - MinimumInputLength - ); - } - - if (options.maximumInputLength > 0) { - options.dataAdapter = Utils.Decorate( - options.dataAdapter, - MaximumInputLength - ); - } - - if (options.maximumSelectionLength > 0) { - options.dataAdapter = Utils.Decorate( - options.dataAdapter, - MaximumSelectionLength - ); - } - - if (options.tags != null) { - options.dataAdapter = Utils.Decorate(options.dataAdapter, Tags); - } - - if (options.tokenSeparators != null || options.tokenizer != null) { - options.dataAdapter = Utils.Decorate( - options.dataAdapter, - Tokenizer - ); - } - - if (options.query != null) { - var Query = require(options.amdBase + 'compat/query'); - - options.dataAdapter = Utils.Decorate( - options.dataAdapter, - Query - ); - } - - if (options.initSelection != null) { - var InitSelection = require(options.amdBase + 'compat/initSelection'); - - options.dataAdapter = Utils.Decorate( - options.dataAdapter, - InitSelection - ); - } - } - - if (options.resultsAdapter == null) { - options.resultsAdapter = ResultsList; - - if (options.ajax != null) { - options.resultsAdapter = Utils.Decorate( - options.resultsAdapter, - InfiniteScroll - ); - } - - if (options.placeholder != null) { - options.resultsAdapter = Utils.Decorate( - options.resultsAdapter, - HidePlaceholder - ); - } - - if (options.selectOnClose) { - options.resultsAdapter = Utils.Decorate( - options.resultsAdapter, - SelectOnClose - ); - } - } - - if (options.dropdownAdapter == null) { - if (options.multiple) { - options.dropdownAdapter = Dropdown; - } else { - var SearchableDropdown = Utils.Decorate(Dropdown, DropdownSearch); - - options.dropdownAdapter = SearchableDropdown; - } - - if (options.minimumResultsForSearch !== 0) { - options.dropdownAdapter = Utils.Decorate( - options.dropdownAdapter, - MinimumResultsForSearch - ); - } - - if (options.closeOnSelect) { - options.dropdownAdapter = Utils.Decorate( - options.dropdownAdapter, - CloseOnSelect - ); - } - - options.dropdownAdapter = Utils.Decorate( - options.dropdownAdapter, - AttachBody - ); - } - - if (options.selectionAdapter == null) { - if (options.multiple) { - options.selectionAdapter = MultipleSelection; - } else { - options.selectionAdapter = SingleSelection; - } - - // Add the placeholder mixin if a placeholder was specified - if (options.placeholder != null) { - options.selectionAdapter = Utils.Decorate( - options.selectionAdapter, - Placeholder - ); - } - - if (options.allowClear) { - options.selectionAdapter = Utils.Decorate( - options.selectionAdapter, - AllowClear - ); - } - - if (options.multiple) { - options.selectionAdapter = Utils.Decorate( - options.selectionAdapter, - SelectionSearch - ); - } - - options.selectionAdapter = Utils.Decorate( - options.selectionAdapter, - EventRelay - ); - } - - if (typeof options.language === 'string') { - // Check if the lanugage is specified with a region - if (options.language.indexOf('-') > 0) { - // Extract the region information if it is included - var languageParts = options.language.split('-'); - var baseLanguage = languageParts[0]; - - options.language = [options.language, baseLanguage]; - } else { - options.language = [options.language]; - } - } - - if ($.isArray(options.language)) { - var languages = new Translation(); - options.language.push('en'); - - var languageNames = options.language; - - for (var l = 0; l < languageNames.length; l++) { - var name = languageNames[l]; - var language = {}; - - try { - // Try to load it with the original name - language = Translation.loadPath(name); - } catch (e) { - try { - // If we couldn't load it, check if it wasn't the full path - name = this.defaults.amdLanguageBase + name; - language = Translation.loadPath(name); - } catch (ex) { - // The translation could not be loaded at all. Sometimes this is - // because of a configuration problem, other times this can be - // because of how Select2 helps load all possible translation files. - if (window.console && console.warn) { - console.warn( - 'Select2: The lanugage file for "' + name + '" could not be ' + - 'automatically loaded. A fallback will be used instead.' - ); - } - - continue; - } - } - - languages.extend(language); - } - - options.translations = languages; - } else { - options.translations = new Translation(options.language); - } - - return options; - }; - - Defaults.prototype.reset = function () { - function stripDiacritics (text) { - // Used 'uni range + named function' from http://jsperf.com/diacritics/18 - function match(a) { - return DIACRITICS[a] || a; - } - - return text.replace(/[^\u0000-\u007E]/g, match); - } - - function matcher (params, data) { - // Always return the object if there is nothing to compare - if ($.trim(params.term) === '') { - return data; - } - - // Do a recursive check for options with children - if (data.children && data.children.length > 0) { - // Clone the data object if there are children - // This is required as we modify the object to remove any non-matches - var match = $.extend(true, {}, data); - - // Check each child of the option - for (var c = data.children.length - 1; c >= 0; c--) { - var child = data.children[c]; - - var matches = matcher(params, child); - - // If there wasn't a match, remove the object in the array - if (matches == null) { - match.children.splice(c, 1); - } - } - - // If any children matched, return the new object - if (match.children.length > 0) { - return match; - } - - // If there were no matching children, check just the plain object - return matcher(params, match); - } - - var original = stripDiacritics(data.text).toUpperCase(); - var term = stripDiacritics(params.term).toUpperCase(); - - // Check if the text contains the term - if (original.indexOf(term) > -1) { - return data; - } - - // If it doesn't contain the term, don't return anything - return null; - } - - this.defaults = { - amdBase: 'select2/', - amdLanguageBase: 'select2/i18n/', - closeOnSelect: true, - escapeMarkup: Utils.escapeMarkup, - language: EnglishTranslation, - matcher: matcher, - minimumInputLength: 0, - maximumInputLength: 0, - maximumSelectionLength: 0, - minimumResultsForSearch: 0, - selectOnClose: false, - sorter: function (data) { - return data; - }, - templateResult: function (result) { - return result.text; - }, - templateSelection: function (selection) { - return selection.text; - }, - theme: 'default', - width: 'resolve' - }; - }; - - Defaults.prototype.set = function (key, value) { - var camelKey = $.camelCase(key); - - var data = {}; - data[camelKey] = value; - - var convertedData = Utils._convertData(data); - - $.extend(this.defaults, convertedData); - }; - - var defaults = new Defaults(); - - return defaults; -}); - -define('select2/options',[ - 'jquery', - './defaults', - './utils' -], function ($, Defaults, Utils) { - function Options (options, $element) { - this.options = options; - - if ($element != null) { - this.fromElement($element); - } - - this.options = Defaults.apply(this.options); - - if ($element && $element.is('input')) { - var InputCompat = require(this.get('amdBase') + 'compat/inputData'); - - this.options.dataAdapter = Utils.Decorate( - this.options.dataAdapter, - InputCompat - ); - } - } - - Options.prototype.fromElement = function ($e) { - var excludedData = ['select2']; - - if (this.options.multiple == null) { - this.options.multiple = $e.prop('multiple'); - } - - if (this.options.disabled == null) { - this.options.disabled = $e.prop('disabled'); - } - - if (this.options.language == null) { - if ($e.prop('lang')) { - this.options.language = $e.prop('lang').toLowerCase(); - } else if ($e.closest('[lang]').prop('lang')) { - this.options.language = $e.closest('[lang]').prop('lang'); - } - } - - if (this.options.dir == null) { - if ($e.prop('dir')) { - this.options.dir = $e.prop('dir'); - } else if ($e.closest('[dir]').prop('dir')) { - this.options.dir = $e.closest('[dir]').prop('dir'); - } else { - this.options.dir = 'ltr'; - } - } - - $e.prop('disabled', this.options.disabled); - $e.prop('multiple', this.options.multiple); - - if ($e.data('select2Tags')) { - if (window.console && console.warn) { - console.warn( - 'Select2: The `data-select2-tags` attribute has been changed to ' + - 'use the `data-data` and `data-tags="true"` attributes and will be ' + - 'removed in future versions of Select2.' - ); - } - - $e.data('data', $e.data('select2Tags')); - $e.data('tags', true); - } - - if ($e.data('ajaxUrl')) { - if (window.console && console.warn) { - console.warn( - 'Select2: The `data-ajax-url` attribute has been changed to ' + - '`data-ajax--url` and support for the old attribute will be removed' + - ' in future versions of Select2.' - ); - } - - $e.data('ajax-Url', $e.data('ajaxUrl')); - } - - var dataset = {}; - - // Prefer the element's `dataset` attribute if it exists - // jQuery 1.x does not correctly handle data attributes with multiple dashes - if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) { - dataset = $.extend(true, {}, $e[0].dataset, $e.data()); - } else { - dataset = $e.data(); - } - - var data = $.extend(true, {}, dataset); - - data = Utils._convertData(data); - - for (var key in data) { - if ($.inArray(key, excludedData) > -1) { - continue; - } - - if ($.isPlainObject(this.options[key])) { - $.extend(this.options[key], data[key]); - } else { - this.options[key] = data[key]; - } - } - - return this; - }; - - Options.prototype.get = function (key) { - return this.options[key]; - }; - - Options.prototype.set = function (key, val) { - this.options[key] = val; - }; - - return Options; -}); - -define('select2/core',[ - 'jquery', - './options', - './utils', - './keys' -], function ($, Options, Utils, KEYS) { - var Select2 = function ($element, options) { - if ($element.data('select2') != null) { - $element.data('select2').destroy(); - } - - this.$element = $element; - - this.id = this._generateId($element); - - options = options || {}; - - this.options = new Options(options, $element); - - Select2.__super__.constructor.call(this); - - // Set up the tabindex - - var tabindex = $element.attr('tabindex') || 0; - $element.data('old-tabindex', tabindex); - $element.attr('tabindex', '-1'); - - // Set up containers and adapters - - var DataAdapter = this.options.get('dataAdapter'); - this.data = new DataAdapter($element, this.options); - - var $container = this.render(); - - this._placeContainer($container); - - var SelectionAdapter = this.options.get('selectionAdapter'); - this.selection = new SelectionAdapter($element, this.options); - this.$selection = this.selection.render(); - - this.selection.position(this.$selection, $container); - - var DropdownAdapter = this.options.get('dropdownAdapter'); - this.dropdown = new DropdownAdapter($element, this.options); - this.$dropdown = this.dropdown.render(); - - this.dropdown.position(this.$dropdown, $container); - - var ResultsAdapter = this.options.get('resultsAdapter'); - this.results = new ResultsAdapter($element, this.options, this.data); - this.$results = this.results.render(); - - this.results.position(this.$results, this.$dropdown); - - // Bind events - - var self = this; - - // Bind the container to all of the adapters - this._bindAdapters(); - - // Register any DOM event handlers - this._registerDomEvents(); - - // Register any internal event handlers - this._registerDataEvents(); - this._registerSelectionEvents(); - this._registerDropdownEvents(); - this._registerResultsEvents(); - this._registerEvents(); - - // Set the initial state - this.data.current(function (initialData) { - self.trigger('selection:update', { - data: initialData - }); - }); - - // Hide the original select - $element.hide(); - - // Synchronize any monitored attributes - this._syncAttributes(); - - $element.data('select2', this); - }; - - Utils.Extend(Select2, Utils.Observable); - - Select2.prototype._generateId = function ($element) { - var id = ''; - - if ($element.attr('id') != null) { - id = $element.attr('id'); - } else if ($element.attr('name') != null) { - id = $element.attr('name') + '-' + Utils.generateChars(2); - } else { - id = Utils.generateChars(4); - } - - id = 'select2-' + id; - - return id; - }; - - Select2.prototype._placeContainer = function ($container) { - $container.insertAfter(this.$element); - - var width = this._resolveWidth(this.$element, this.options.get('width')); - - if (width != null) { - $container.css('width', width); - } - }; - - Select2.prototype._resolveWidth = function ($element, method) { - var WIDTH = /^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i; - - if (method == 'resolve') { - var styleWidth = this._resolveWidth($element, 'style'); - - if (styleWidth != null) { - return styleWidth; - } - - return this._resolveWidth($element, 'element'); - } - - if (method == 'element') { - var elementWidth = $element.outerWidth(false); - - if (elementWidth <= 0) { - return 'auto'; - } - - return elementWidth + 'px'; - } - - if (method == 'style') { - var style = $element.attr('style'); - - if (typeof(style) !== 'string') { - return null; - } - - var attrs = style.split(';'); - - for (var i = 0, l = attrs.length; i < l; i = i + 1) { - var attr = attrs[i].replace(/\s/g, ''); - var matches = attr.match(WIDTH); - - if (matches !== null && matches.length >= 1) { - return matches[1]; - } - } - - return null; - } - - return method; - }; - - Select2.prototype._bindAdapters = function () { - this.data.bind(this, this.$container); - this.selection.bind(this, this.$container); - - this.dropdown.bind(this, this.$container); - this.results.bind(this, this.$container); - }; - - Select2.prototype._registerDomEvents = function () { - var self = this; - - this.$element.on('change.select2', function () { - self.data.current(function (data) { - self.trigger('selection:update', { - data: data - }); - }); - }); - - this._sync = Utils.bind(this._syncAttributes, this); - - if (this.$element[0].attachEvent) { - this.$element[0].attachEvent('onpropertychange', this._sync); - } - - var observer = window.MutationObserver || - window.WebKitMutationObserver || - window.MozMutationObserver - ; - - if (observer != null) { - this._observer = new observer(function (mutations) { - $.each(mutations, self._sync); - }); - this._observer.observe(this.$element[0], { - attributes: true, - subtree: false - }); - } else if (this.$element[0].addEventListener) { - this.$element[0].addEventListener('DOMAttrModified', self._sync, false); - } - }; - - Select2.prototype._registerDataEvents = function () { - var self = this; - - this.data.on('*', function (name, params) { - self.trigger(name, params); - }); - }; - - Select2.prototype._registerSelectionEvents = function () { - var self = this; - var nonRelayEvents = ['toggle']; - - this.selection.on('toggle', function () { - self.toggleDropdown(); - }); - - this.selection.on('*', function (name, params) { - if ($.inArray(name, nonRelayEvents) !== -1) { - return; - } - - self.trigger(name, params); - }); - }; - - Select2.prototype._registerDropdownEvents = function () { - var self = this; - - this.dropdown.on('*', function (name, params) { - self.trigger(name, params); - }); - }; - - Select2.prototype._registerResultsEvents = function () { - var self = this; - - this.results.on('*', function (name, params) { - self.trigger(name, params); - }); - }; - - Select2.prototype._registerEvents = function () { - var self = this; - - this.on('open', function () { - self.$container.addClass('select2-container--open'); - }); - - this.on('close', function () { - self.$container.removeClass('select2-container--open'); - }); - - this.on('enable', function () { - self.$container.removeClass('select2-container--disabled'); - }); - - this.on('disable', function () { - self.$container.addClass('select2-container--disabled'); - }); - - this.on('focus', function () { - self.$container.addClass('select2-container--focus'); - }); - - this.on('blur', function () { - self.$container.removeClass('select2-container--focus'); - }); - - this.on('query', function (params) { - if (!self.isOpen()) { - self.trigger('open'); - } - - this.data.query(params, function (data) { - self.trigger('results:all', { - data: data, - query: params - }); - }); - }); - - this.on('query:append', function (params) { - this.data.query(params, function (data) { - self.trigger('results:append', { - data: data, - query: params - }); - }); - }); - - this.on('keypress', function (evt) { - var key = evt.which; - - if (self.isOpen()) { - if (key === KEYS.ENTER) { - self.trigger('results:select'); - - evt.preventDefault(); - } else if ((key === KEYS.SPACE && evt.ctrlKey)) { - self.trigger('results:toggle'); - - evt.preventDefault(); - } else if (key === KEYS.UP) { - self.trigger('results:previous'); - - evt.preventDefault(); - } else if (key === KEYS.DOWN) { - self.trigger('results:next'); - - evt.preventDefault(); - } else if (key === KEYS.ESC || key === KEYS.TAB) { - self.close(); - - evt.preventDefault(); - } - } else { - if (key === KEYS.ENTER || key === KEYS.SPACE || - ((key === KEYS.DOWN || key === KEYS.UP) && evt.altKey)) { - self.open(); - - evt.preventDefault(); - } - } - }); - }; - - Select2.prototype._syncAttributes = function () { - this.options.set('disabled', this.$element.prop('disabled')); - - if (this.options.get('disabled')) { - if (this.isOpen()) { - this.close(); - } - - this.trigger('disable'); - } else { - this.trigger('enable'); - } - }; - - /** - * Override the trigger method to automatically trigger pre-events when - * there are events that can be prevented. - */ - Select2.prototype.trigger = function (name, args) { - var actualTrigger = Select2.__super__.trigger; - var preTriggerMap = { - 'open': 'opening', - 'close': 'closing', - 'select': 'selecting', - 'unselect': 'unselecting' - }; - - if (name in preTriggerMap) { - var preTriggerName = preTriggerMap[name]; - var preTriggerArgs = { - prevented: false, - name: name, - args: args - }; - - actualTrigger.call(this, preTriggerName, preTriggerArgs); - - if (preTriggerArgs.prevented) { - args.prevented = true; - - return; - } - } - - actualTrigger.call(this, name, args); - }; - - Select2.prototype.toggleDropdown = function () { - if (this.options.get('disabled')) { - return; - } - - if (this.isOpen()) { - this.close(); - } else { - this.open(); - } - }; - - Select2.prototype.open = function () { - if (this.isOpen()) { - return; - } - - this.trigger('query', {}); - - this.trigger('open'); - }; - - Select2.prototype.close = function () { - if (!this.isOpen()) { - return; - } - - this.trigger('close'); - }; - - Select2.prototype.isOpen = function () { - return this.$container.hasClass('select2-container--open'); - }; - - Select2.prototype.enable = function (args) { - if (window.console && console.warn) { - console.warn( - 'Select2: The `select2("enable")` method has been deprecated and will' + - ' be removed in later Select2 versions. Use $element.prop("disabled")' + - ' instead.' - ); - } - - if (args.length === 0) { - args = [true]; - } - - var disabled = !args[0]; - - this.$element.prop('disabled', disabled); - }; - - Select2.prototype.data = function () { - if (arguments.length > 0 && window.console && console.warn) { - console.warn( - 'Select2: Data can no longer be set using `select2("data")`. You ' + - 'should consider setting the value instead using `$element.val()`.' - ); - } - - var data = []; - - this.dataAdpater.current(function (currentData) { - data = currentData; - }); - - return data; - }; - - Select2.prototype.val = function (args) { - if (window.console && console.warn) { - console.warn( - 'Select2: The `select2("val")` method has been deprecated and will be' + - ' removed in later Select2 versions. Use $element.val() instead.' - ); - } - - if (args.length === 0) { - return this.$element.val(); - } - - var newVal = args[0]; - - if ($.isArray(newVal)) { - newVal = $.map(newVal, function (obj) { - return obj.toString(); - }); - } - - this.$element.val(newVal).trigger('change'); - }; - - Select2.prototype.destroy = function () { - this.$container.remove(); - - if (this.$element[0].detachEvent) { - this.$element[0].detachEvent('onpropertychange', this._sync); - } - - if (this._observer != null) { - this._observer.disconnect(); - this._observer = null; - } else if (this.$element[0].removeEventListener) { - this.$element[0] - .removeEventListener('DOMAttrModified', this._sync, false); - } - - this._sync = null; - - this.$element.off('.select2'); - this.$element.attr('tabindex', this.$element.data('old-tabindex')); - - this.$element.show(); - this.$element.removeData('select2'); - - this.data.destroy(); - this.selection.destroy(); - this.dropdown.destroy(); - this.results.destroy(); - - this.data = null; - this.selection = null; - this.dropdown = null; - this.results = null; - }; - - Select2.prototype.render = function () { - var $container = $( - '<span class="select2 select2-container">' + - '<span class="selection"></span>' + - '<span class="dropdown-wrapper" aria-hidden="true"></span>' + - '</span>' - ); - - $container.attr('dir', this.options.get('dir')); - - this.$container = $container; - - this.$container.addClass('select2-container--' + this.options.get('theme')); - - $container.data('element', this.$element); - - return $container; - }; - - return Select2; -}); - -define('jquery.select2',[ - 'jquery', - './select2/core', - './select2/defaults' -], function ($, Select2, Defaults) { - // Force jQuery.mousewheel to be loaded if it hasn't already - try { - require('jquery.mousewheel'); - } catch (Exception) { } - - if ($.fn.select2 == null) { - $.fn.select2 = function (options) { - options = options || {}; - - if (typeof options === 'object') { - this.each(function () { - var instanceOptions = $.extend({}, options, true); - - var instance = new Select2($(this), instanceOptions); - }); - - return this; - } else if (typeof options === 'string') { - var instance = this.data('select2'); - var args = Array.prototype.slice.call(arguments, 1); - - return instance[options](args); - } else { - throw new Error('Invalid arguments for Select2: ' + options); - } - }; - } - - if ($.fn.select2.defaults == null) { - $.fn.select2.defaults = Defaults; - } - - return Select2; -}); - -require('jquery.select2'); jQuery.fn.select2.amd = { define: define, require: require }; }());
\ No newline at end of file diff --git a/public/vendor/select2/js/select2.min.js b/public/vendor/select2/js/select2.min.js deleted file mode 100755 index 4753ff97..00000000 --- a/public/vendor/select2/js/select2.min.js +++ /dev/null @@ -1,2 +0,0 @@ -!function(){if(window.define)var a=window.define;if(window.require)var b=window.require;if(window.jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var a=jQuery.fn.select2.amd.define,b=jQuery.fn.select2.amd.require;var c,b,a;!function(d){function e(a,b){return u.call(a,b)}function f(a,b){var c,d,e,f,g,h,i,j,k,l,m,n=b&&b.split("/"),o=s.map,p=o&&o["*"]||{};if(a&&"."===a.charAt(0))if(b){for(n=n.slice(0,n.length-1),a=a.split("/"),g=a.length-1,s.nodeIdCompat&&w.test(a[g])&&(a[g]=a[g].replace(w,"")),a=n.concat(a),k=0;k<a.length;k+=1)if(m=a[k],"."===m)a.splice(k,1),k-=1;else if(".."===m){if(1===k&&(".."===a[2]||".."===a[0]))break;k>0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((n||p)&&o){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),n)for(l=n.length;l>0;l-=1)if(e=o[n.slice(0,l).join("/")],e&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&p&&p[d]&&(i=p[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function g(a,b){return function(){return n.apply(d,v.call(arguments,0).concat([a,b]))}}function h(a){return function(b){return f(b,a)}}function i(a){return function(b){q[a]=b}}function j(a){if(e(r,a)){var b=r[a];delete r[a],t[a]=!0,m.apply(d,b)}if(!e(q,a)&&!e(t,a))throw new Error("No "+a);return q[a]}function k(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function l(a){return function(){return s&&s.config&&s.config[a]||{}}}var m,n,o,p,q={},r={},s={},t={},u=Object.prototype.hasOwnProperty,v=[].slice,w=/\.js$/;o=function(a,b){var c,d=k(a),e=d[0];return a=d[1],e&&(e=f(e,b),c=j(e)),e?a=c&&c.normalize?c.normalize(a,h(b)):f(a,b):(a=f(a,b),d=k(a),e=d[0],a=d[1],e&&(c=j(e))),{f:e?e+"!"+a:a,n:a,pr:e,p:c}},p={require:function(a){return g(a)},exports:function(a){var b=q[a];return"undefined"!=typeof b?b:q[a]={}},module:function(a){return{id:a,uri:"",exports:q[a],config:l(a)}}},m=function(a,b,c,f){var h,k,l,m,n,s,u=[],v=typeof c;if(f=f||a,"undefined"===v||"function"===v){for(b=!b.length&&c.length?["require","exports","module"]:b,n=0;n<b.length;n+=1)if(m=o(b[n],f),k=m.f,"require"===k)u[n]=p.require(a);else if("exports"===k)u[n]=p.exports(a),s=!0;else if("module"===k)h=u[n]=p.module(a);else if(e(q,k)||e(r,k)||e(t,k))u[n]=j(k);else{if(!m.p)throw new Error(a+" missing "+k);m.p.load(m.n,g(f,!0),i(k),{}),u[n]=q[k]}l=c?c.apply(q[a],u):void 0,a&&(h&&h.exports!==d&&h.exports!==q[a]?q[a]=h.exports:l===d&&s||(q[a]=l))}else a&&(q[a]=c)},c=b=n=function(a,b,c,e,f){if("string"==typeof a)return p[a]?p[a](b):j(o(a,b).f);if(!a.splice){if(s=a,s.deps&&n(s.deps,s.callback),!b)return;b.splice?(a=b,b=c,c=null):a=d}return b=b||function(){},"function"==typeof c&&(c=e,e=f),e?m(d,a,b,c):setTimeout(function(){m(d,a,b,c)},4),n},n.config=function(a){return n(a)},c._defined=q,a=function(a,b,c){b.splice||(c=b,b=[]),e(q,a)||e(r,a)||(r[a]=[a,b,c])},a.amd={jQuery:!0}}(),a("almond",function(){}),a("jquery",[],function(){var a=jQuery||$;return null==a&&console&&console.error&&console.error("Select2: An instance of jQuery or a jQuery-compatible library was not found. Make sure that you are including jQuery before Select2 on your web page."),a}),a("select2/utils",["jquery"],function(a){function b(a){var b=a.prototype,c=[];for(var d in b){var e=b[d];"function"==typeof e&&"constructor"!==d&&c.push(d)}return c}var c={};c.Extend=function(a,b){function c(){this.constructor=a}var d={}.hasOwnProperty;for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},c.Decorate=function(a,c){function d(){var b=Array.prototype.unshift,d=c.prototype.constructor.length,e=a.prototype.constructor;d>0&&(b.call(arguments,a.prototype.constructor),e=c.prototype.constructor),e.apply(this,arguments)}function e(){this.constructor=d}var f=b(c),g=b(a);c.displayName=a.displayName,d.prototype=new e;for(var h=0;h<g.length;h++){var i=g[h];d.prototype[i]=a.prototype[i]}for(var j=(function(a){var b=function(){};a in d.prototype&&(b=d.prototype[a]);var e=c.prototype[a];return function(){var a=Array.prototype.unshift;return a.call(arguments,b),e.apply(this,arguments)}}),k=0;k<f.length;k++){var l=f[k];d.prototype[l]=j(l)}return d};var d=function(){this.listeners={}};return d.prototype.on=function(a,b){this.listeners=this.listeners||{},a in this.listeners?this.listeners[a].push(b):this.listeners[a]=[b]},d.prototype.trigger=function(a){var b=Array.prototype.slice;this.listeners=this.listeners||{},a in this.listeners&&this.invoke(this.listeners[a],b.call(arguments,1)),"*"in this.listeners&&this.invoke(this.listeners["*"],arguments)},d.prototype.invoke=function(a,b){for(var c=0,d=a.length;d>c;c++)a[c].apply(this,b)},c.Observable=d,c.generateChars=function(a){for(var b="",c=0;a>c;c++){var d=Math.floor(36*Math.random());b+=d.toString(36)}return b},c.bind=function(a,b){return function(){a.apply(b,arguments)}},c._convertData=function(a){for(var b in a){var c=b.split("-"),d=a;if(1!==c.length){for(var e=0;e<c.length;e++){var f=c[e];f=f.substring(0,1).toLowerCase()+f.substring(1),f in d||(d[f]={}),e==c.length-1&&(d[f]=a[b]),d=d[f]}delete a[b]}}return a},c.hasScroll=function(b,c){var d=a(c),e=c.style.overflowX,f=c.style.overflowY;return e!==f||"hidden"!==f&&"visible"!==f?"scroll"===e||"scroll"===f?!0:d.innerHeight()<c.scrollHeight||d.innerWidth()<c.scrollWidth:!1},c.escapeMarkup=function(a){var b={"\\":"\","&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return"string"!=typeof a?a:String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})},c}),a("select2/results",["jquery","./utils"],function(a,b){function c(a,b,d){this.$element=a,this.data=d,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<ul class="select2-results__options" role="tree"></ul>');return this.options.get("multiple")&&b.attr("aria-multiselectable","true"),this.$results=b,b},c.prototype.clear=function(){this.$results.empty()},c.prototype.displayMessage=function(b){var c=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var d=a('<li role="treeitem" class="select2-results__option"></li>'),e=this.options.get("translations").get(b.message);d.append(c(e(b.args))),this.$results.append(d)},c.prototype.append=function(a){this.hideLoading();var b=[];if(null==a.results||0===a.results.length)return void(0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"}));a.results=this.sort(a.results);for(var c=0;c<a.results.length;c++){var d=a.results[c],e=this.option(d);b.push(e)}this.$results.append(b)},c.prototype.position=function(a,b){var c=b.find(".select2-results");c.append(a)},c.prototype.sort=function(a){var b=this.options.get("sorter");return b(a)},c.prototype.setClasses=function(){var b=this;this.data.current(function(c){var d=a.map(c,function(a){return a.id.toString()}),e=b.$results.find(".select2-results__option[aria-selected]");e.each(function(){var b=a(this),c=a.data(this,"data");a.inArray(c.id,d)>-1?b.attr("aria-selected","true"):b.attr("aria-selected","false")});var f=e.filter("[aria-selected=true]");f.length>0?f.first().trigger("mouseenter"):e.first().trigger("mouseenter")})},c.prototype.showLoading=function(a){this.hideLoading();var b=this.options.get("translations").get("searching"),c={disabled:!0,loading:!0,text:b(a)},d=this.option(c);d.className+=" loading-results",this.$results.prepend(d)},c.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},c.prototype.option=function(b){var c=document.createElement("li");c.className="select2-results__option";var d={role:"treeitem","aria-selected":"false"};b.disabled&&(delete d["aria-selected"],d["aria-disabled"]="true"),null==b.id&&delete d["aria-selected"],null!=b._resultId&&(c.id=b._resultId),b.title&&(c.title=b.title),b.children&&(d.role="group",d["aria-label"]=b.text,delete d["aria-selected"]);for(var e in d){var f=d[e];c.setAttribute(e,f)}if(b.children){var g=a(c),h=document.createElement("strong");h.className="select2-results__group";{a(h)}this.template(b,h);for(var i=[],j=0;j<b.children.length;j++){var k=b.children[j],l=this.option(k);i.push(l)}var m=a("<ul></ul>",{"class":"select2-results__options select2-results__options--nested"});m.append(i),g.append(h),g.append(m)}else this.template(b,c);return a.data(c,"data",b),c},c.prototype.bind=function(b){var c=this,d=b.id+"-results";this.$results.attr("id",d),b.on("results:all",function(a){c.clear(),c.append(a.data),b.isOpen()&&c.setClasses()}),b.on("results:append",function(a){c.append(a.data),b.isOpen()&&c.setClasses()}),b.on("query",function(a){c.showLoading(a)}),b.on("select",function(){b.isOpen()&&c.setClasses()}),b.on("unselect",function(){b.isOpen()&&c.setClasses()}),b.on("open",function(){c.$results.attr("aria-expanded","true"),c.$results.attr("aria-hidden","false"),c.setClasses(),c.ensureHighlightVisible()}),b.on("close",function(){c.$results.attr("aria-expanded","false"),c.$results.attr("aria-hidden","true"),c.$results.removeAttr("aria-activedescendant")}),b.on("results:toggle",function(){var a=c.getHighlightedResults();0!==a.length&&a.trigger("mouseup")}),b.on("results:select",function(){var a=c.getHighlightedResults();if(0!==a.length){var b=a.data("data");"true"==a.attr("aria-selected")?c.trigger("close"):c.trigger("select",{data:b})}}),b.on("results:previous",function(){var a=c.getHighlightedResults(),b=c.$results.find("[aria-selected]"),d=b.index(a);if(0!==d){var e=d-1;0===a.length&&(e=0);var f=b.eq(e);f.trigger("mouseenter");var g=c.$results.offset().top,h=f.offset().top,i=c.$results.scrollTop()+(h-g);0===e?c.$results.scrollTop(0):0>h-g&&c.$results.scrollTop(i)}}),b.on("results:next",function(){var a=c.getHighlightedResults(),b=c.$results.find("[aria-selected]"),d=b.index(a),e=d+1;if(!(e>=b.length)){var f=b.eq(e);f.trigger("mouseenter");var g=c.$results.offset().top+c.$results.outerHeight(!1),h=f.offset().top+f.outerHeight(!1),i=c.$results.scrollTop()+h-g;0===e?c.$results.scrollTop(0):h>g&&c.$results.scrollTop(i)}}),b.on("results:focus",function(a){a.element.addClass("select2-results__option--highlighted")}),b.on("results:message",function(a){c.displayMessage(a)}),a.fn.mousewheel&&this.$results.on("mousewheel",function(a){var b=c.$results.scrollTop(),d=c.$results.get(0).scrollHeight-c.$results.scrollTop()+a.deltaY,e=a.deltaY>0&&b-a.deltaY<=0,f=a.deltaY<0&&d<=c.$results.height();e?(c.$results.scrollTop(0),a.preventDefault(),a.stopPropagation()):f&&(c.$results.scrollTop(c.$results.get(0).scrollHeight-c.$results.height()),a.preventDefault(),a.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[aria-selected]",function(b){var d=a(this),e=d.data("data");return"true"===d.attr("aria-selected")?void(c.options.get("multiple")?c.trigger("unselect",{originalEvent:b,data:e}):c.trigger("close")):void c.trigger("select",{originalEvent:b,data:e})}),this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(){var b=a(this).data("data");c.getHighlightedResults().removeClass("select2-results__option--highlighted"),c.trigger("results:focus",{data:b,element:a(this)})})},c.prototype.getHighlightedResults=function(){var a=this.$results.find(".select2-results__option--highlighted");return a},c.prototype.destroy=function(){this.$results.remove()},c.prototype.ensureHighlightVisible=function(){var a=this.getHighlightedResults();if(0!==a.length){var b=this.$results.find("[aria-selected]"),c=b.index(a),d=this.$results.offset().top,e=a.offset().top,f=this.$results.scrollTop()+(e-d),g=e-d;f-=2*a.outerHeight(!1),2>=c?this.$results.scrollTop(0):(g>this.$results.outerHeight()||0>g)&&this.$results.scrollTop(f)}},c.prototype.template=function(b,c){var d=this.options.get("templateResult"),e=this.options.get("escapeMarkup"),f=d(b);null==f?c.style.display="none":"string"==typeof f?c.innerHTML=e(f):a(c).append(f)},c}),a("select2/keys",[],function(){var a={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46};return a}),a("select2/selection/base",["jquery","../utils","../keys"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,b.Observable),d.prototype.render=function(){var b=a('<span class="select2-selection" role="combobox" aria-autocomplete="list" aria-haspopup="true" aria-expanded="false"></span>');return this._tabindex=0,null!=this.$element.data("old-tabindex")?this._tabindex=this.$element.data("old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),b.attr("title",this.$element.attr("title")),b.attr("tabindex",this._tabindex),this.$selection=b,b},d.prototype.bind=function(a){var b=this,d=(a.id+"-container",a.id+"-results");this.container=a,this.$selection.attr("aria-owns",d),this.$selection.on("focus",function(a){b.trigger("focus",a)}),this.$selection.on("blur",function(a){b.trigger("blur",a)}),this.$selection.on("keydown",function(a){b.trigger("keypress",a),a.which===c.SPACE&&a.preventDefault()}),a.on("results:focus",function(a){b.$selection.attr("aria-activedescendant",a.data._resultId)}),a.on("selection:update",function(a){b.update(a.data)}),a.on("open",function(){b.$selection.attr("aria-expanded","true"),b._attachCloseHandler(a)}),a.on("close",function(){b.$selection.attr("aria-expanded","false"),b.$selection.removeAttr("aria-activedescendant"),b.$selection.focus(),b._detachCloseHandler(a)}),a.on("enable",function(){b.$selection.attr("tabindex",b._tabindex)}),a.on("disable",function(){b.$selection.attr("tabindex","-1")})},d.prototype._attachCloseHandler=function(b){a(document.body).on("mousedown.select2."+b.id,function(b){var c=a(b.target),d=c.closest(".select2"),e=a(".select2.select2-container--open");e.each(function(){var b=a(this);if(this!=d[0]){var c=b.data("element");c.select2("close")}})})},d.prototype._detachCloseHandler=function(b){a(document.body).off("mousedown.select2."+b.id)},d.prototype.position=function(a,b){var c=b.find(".selection");c.append(a)},d.prototype.destroy=function(){this._detachCloseHandler(this.container)},d.prototype.update=function(){throw new Error("The `update` method must be defined in child classes.")},d}),a("select2/selection/single",["jquery","./base","../utils","../keys"],function(a,b,c){function d(){d.__super__.constructor.apply(this,arguments)}return c.Extend(d,b),d.prototype.render=function(){var a=d.__super__.render.call(this);return a.addClass("select2-selection--single"),a.html('<span class="select2-selection__rendered"></span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>'),a},d.prototype.bind=function(a){var b=this;d.__super__.bind.apply(this,arguments);var c=a.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",c),this.$selection.attr("aria-labelledby",c),this.$selection.on("mousedown",function(a){1===a.which&&b.trigger("toggle",{originalEvent:a})}),this.$selection.on("focus",function(){}),this.$selection.on("blur",function(){}),a.on("selection:update",function(a){b.update(a.data)})},d.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},d.prototype.display=function(a){var b=this.options.get("templateSelection"),c=this.options.get("escapeMarkup");return c(b(a))},d.prototype.selectionContainer=function(){return a("<span></span>")},d.prototype.update=function(a){if(0===a.length)return void this.clear();var b=a[0],c=this.display(b),d=this.$selection.find(".select2-selection__rendered");d.empty().append(c),d.prop("title",b.title||b.text)},d}),a("select2/selection/multiple",["jquery","./base","../utils"],function(a,b,c){function d(){d.__super__.constructor.apply(this,arguments)}return c.Extend(d,b),d.prototype.render=function(){var a=d.__super__.render.call(this);return a.addClass("select2-selection--multiple"),a.html('<ul class="select2-selection__rendered"></ul>'),a},d.prototype.bind=function(){var b=this;d.__super__.bind.apply(this,arguments),this.$selection.on("click",function(a){b.trigger("toggle",{originalEvent:a})}),this.$selection.on("click",".select2-selection__choice__remove",function(c){var d=a(this),e=d.parent(),f=e.data("data");b.trigger("unselect",{originalEvent:c,data:f})})},d.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},d.prototype.display=function(a){var b=this.options.get("templateSelection"),c=this.options.get("escapeMarkup");return c(b(a))},d.prototype.selectionContainer=function(){var b=a('<li class="select2-selection__choice"><span class="select2-selection__choice__remove" role="presentation">×</span></li>');return b},d.prototype.update=function(a){if(this.clear(),0!==a.length){for(var b=[],c=0;c<a.length;c++){var d=a[c],e=this.display(d),f=this.selectionContainer();f.append(e),f.prop("title",d.title||d.text),f.data("data",d),b.push(f)}this.$selection.find(".select2-selection__rendered").append(b)}},d}),a("select2/selection/placeholder",["../utils"],function(){function a(a,b,c){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c)}return a.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},a.prototype.createPlaceholder=function(a,b){var c=this.selectionContainer();return c.html(this.display(b)),c.addClass("select2-selection__placeholder").removeClass("select2-selection__choice"),c},a.prototype.update=function(a,b){var c=1==b.length&&b[0].id!=this.placeholder.id,d=b.length>1;if(d||c)return a.call(this,b);this.clear();var e=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(e)},a}),a("select2/selection/allowClear",["jquery"],function(a){function b(){}return b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),null==e.placeholder&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",function(b){if(!e.options.get("disabled")){b.stopPropagation();for(var c=a(this).data("data"),d=0;d<c.length;d++){var f={data:c[d]};if(e.trigger("unselect",f),f.prevented)return}e.$element.val(e.placeholder.id).trigger("change"),e.trigger("toggle")}})},b.prototype.update=function(b,c){if(b.call(this,c),!(this.$selection.find(".select2-selection__placeholder").length>0||0===c.length)){var d=a('<span class="select2-selection__clear">×</span>');d.data("data",c),this.$selection.find(".select2-selection__rendered").append(d)}},b}),a("select2/selection/search",["jquery","../utils","../keys"],function(a,b,c){function d(a,b,c){a.call(this,b,c)}return d.prototype.render=function(b){var c=a('<li class="select2-search select2-search--inline"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" /></li>');this.$searchContainer=c,this.$search=c.find("input");var d=b.call(this);return d},d.prototype.bind=function(a,b,d){var e=this;a.call(this,b,d),b.on("open",function(){e.$search.attr("tabindex",0),e.$search.focus()}),b.on("close",function(){e.$search.attr("tabindex",-1),e.$search.val(""),e.$search.focus()}),b.on("enable",function(){e.$search.prop("disabled",!1)}),b.on("disable",function(){e.$search.prop("disabled",!0)}),this.$selection.on("focusin",".select2-search--inline",function(a){e.trigger("focus",a)}),this.$selection.on("focusout",".select2-search--inline",function(a){e.trigger("blur",a)}),this.$selection.on("keydown",".select2-search--inline",function(a){a.stopPropagation(),e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented();var b=a.which;if(b===c.BACKSPACE&&""===e.$search.val()){var d=e.$searchContainer.prev(".select2-selection__choice");if(d.length>0){var f=d.data("data");e.searchRemoveChoice(f)}}}),this.$selection.on("input",".select2-search--inline",function(){e.$selection.off("keyup.search")}),this.$selection.on("keyup.search input",".select2-search--inline",function(a){e.handleSearch(a)})},d.prototype.createPlaceholder=function(a,b){this.$search.attr("placeholder",b.text)},d.prototype.update=function(a,b){this.$search.attr("placeholder",""),a.call(this,b),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch()},d.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var a=this.$search.val();this.trigger("query",{term:a})}this._keyUpPrevented=!1},d.prototype.searchRemoveChoice=function(a,b){this.trigger("unselect",{data:b}),this.trigger("open"),this.$search.val(b.text+" ")},d.prototype.resizeSearch=function(){this.$search.css("width","25px");var a="";if(""!==this.$search.attr("placeholder"))a=this.$selection.find(".select2-selection__rendered").innerWidth();else{var b=this.$search.val().length+1;a=.75*b+"em"}this.$search.css("width",a)},d}),a("select2/selection/eventRelay",["jquery"],function(a){function b(){}return b.prototype.bind=function(b,c,d){var e=this,f=["open","opening","close","closing","select","selecting","unselect","unselecting"],g=["opening","closing","selecting","unselecting"];b.call(this,c,d),c.on("*",function(b,c){if(-1!==a.inArray(b,f)){c=c||{};var d=a.Event("select2:"+b,{params:c});e.$element.trigger(d),-1!==a.inArray(b,g)&&(c.prevented=d.isDefaultPrevented())}})},b}),a("select2/translation",["jquery"],function(a){function c(a){this.dict=a||{}}return c.prototype.all=function(){return this.dict},c.prototype.get=function(a){return this.dict[a]},c.prototype.extend=function(b){this.dict=a.extend({},b.all(),this.dict)},c._cache={},c.loadPath=function(a){if(!(a in c._cache)){var d=b(a);c._cache[a]=d}return new c(c._cache[a])},c}),a("select2/diacritics",[],function(){var a={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"};return a}),a("select2/data/base",["../utils"],function(a){function b(){b.__super__.constructor.call(this)}return a.Extend(b,a.Observable),b.prototype.current=function(){throw new Error("The `current` method must be defined in child classes.")},b.prototype.query=function(){throw new Error("The `query` method must be defined in child classes.")},b.prototype.bind=function(){},b.prototype.destroy=function(){},b.prototype.generateResultId=function(b,c){var d=b.id+"-result-";return d+=a.generateChars(4),d+=null!=c.id?"-"+c.id.toString():"-"+a.generateChars(4)},b}),a("select2/data/select",["./base","../utils","jquery"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,a),d.prototype.current=function(a){var b=[],d=this;this.$element.find(":selected").each(function(){var a=c(this),e=d.item(a);b.push(e)}),a(b)},d.prototype.select=function(a){var b=this;if(c(a.element).is("option"))return a.element.selected=!0,void this.$element.trigger("change");if(this.$element.prop("multiple"))this.current(function(d){var e=[];a=[a],a.push.apply(a,d);for(var f=0;f<a.length;f++){var g=a[f].id;-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")});else{var d=a.id;this.$element.val(d),this.$element.trigger("change")}},d.prototype.unselect=function(a){var b=this;if(this.$element.prop("multiple"))return c(a.element).is("option")?(a.element.selected=!1,void this.$element.trigger("change")):void this.current(function(d){for(var e=[],f=0;f<d.length;f++){var g=d[f].id;g!==a.id&&-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")})},d.prototype.bind=function(a){var b=this;this.container=a,a.on("select",function(a){b.select(a.data)}),a.on("unselect",function(a){b.unselect(a.data)})},d.prototype.destroy=function(){this.$element.find("*").each(function(){c.removeData(this,"data")})},d.prototype.query=function(a,b){var d=[],e=this,f=this.$element.children();f.each(function(){var b=c(this);if(b.is("option")||b.is("optgroup")){var f=e.item(b),g=e.matches(a,f);null!==g&&d.push(g)}}),b({results:d})},d.prototype.addOptions=function(a){this.$element.append(a)},d.prototype.option=function(a){var b;a.children?(b=document.createElement("optgroup"),b.label=a.text):(b=document.createElement("option"),void 0!==b.textContent?b.textContent=a.text:b.innerText=a.text),a.id&&(b.value=a.id),a.disabled&&(b.disabled=!0),a.selected&&(b.selected=!0),a.title&&(b.title=a.title);var d=c(b),e=this._normalizeItem(a);return e.element=b,c.data(b,"data",e),d},d.prototype.item=function(a){var b={};if(b=c.data(a[0],"data"),null!=b)return b;if(a.is("option"))b={id:a.val(),text:a.html(),disabled:a.prop("disabled"),selected:a.prop("selected"),title:a.prop("title")};else if(a.is("optgroup")){b={text:a.prop("label"),children:[],title:a.prop("title")};for(var d=a.children("option"),e=[],f=0;f<d.length;f++){var g=c(d[f]),h=this.item(g);e.push(h)}b.children=e}return b=this._normalizeItem(b),b.element=a[0],c.data(a[0],"data",b),b},d.prototype._normalizeItem=function(a){c.isPlainObject(a)||(a={id:a,text:a}),a=c.extend({},{text:""},a);var b={selected:!1,disabled:!1};return null!=a.id&&(a.id=a.id.toString()),null!=a.text&&(a.text=a.text.toString()),null==a._resultId&&a.id&&null!=this.container&&(a._resultId=this.generateResultId(this.container,a)),c.extend({},b,a)},d.prototype.matches=function(a,b){var c=this.options.get("matcher");return c(a,b)},d}),a("select2/data/array",["./select","../utils","jquery"],function(a,b,c){function d(a,b){var c=b.get("data")||[]; -d.__super__.constructor.call(this,a,b),this.addOptions(this.convertToOptions(c))}return b.Extend(d,a),d.prototype.select=function(a){var b=this.$element.find('option[value="'+a.id+'"]');0===b.length&&(b=this.option(a),this.addOptions([b])),d.__super__.select.call(this,a)},d.prototype.convertToOptions=function(a){function b(a){return function(){return c(this).val()==a.id}}for(var d=this,e=this.$element.find("option"),f=e.map(function(){return d.item(c(this)).id}).get(),g=[],h=0;h<a.length;h++){var i=this._normalizeItem(a[h]);if(c.inArray(i.id,f)>=0){var j=e.filter(b(i)),k=this.item(j),l=(c.extend(!0,{},k,i),this.option(k));j.replaceWith(l)}else{var m=this.option(i);if(i.children){var n=this.convertToOptions(i.children);m.append(n)}g.push(m)}}return g},d}),a("select2/data/ajax",["./array","../utils","jquery"],function(a,b,c){function d(b,c){this.ajaxOptions=this._applyDefaults(c.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),a.__super__.constructor.call(this,b,c)}return b.Extend(d,a),d.prototype._applyDefaults=function(a){var b={data:function(a){return{q:a.term}},transport:function(a,b,d){var e=c.ajax(a);return e.then(b),e.fail(d),e}};return c.extend({},b,a,!0)},d.prototype.processResults=function(a){return a},d.prototype.query=function(a,b){function d(){var d=f.transport(f,function(d){var f=e.processResults(d,a);window.console&&console.error&&(f&&f.results&&c.isArray(f.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),b(f)},function(){});e._request=d}var e=this;this._request&&(this._request.abort(),this._request=null);var f=c.extend({type:"GET"},this.ajaxOptions);"function"==typeof f.url&&(f.url=f.url(a)),"function"==typeof f.data&&(f.data=f.data(a)),this.ajaxOptions.delay&&""!==a.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(d,this.ajaxOptions.delay)):d()},d}),a("select2/data/tags",["jquery"],function(a){function b(b,c,d){var e=d.get("tags"),f=d.get("createTag");if(void 0!==f&&(this.createTag=f),b.call(this,c,d),a.isArray(e))for(var g=0;g<e.length;g++){var h=e[g],i=this._normalizeItem(h),j=this.option(i);this.$element.append(j)}}return b.prototype.query=function(a,b,c){function d(a,f){for(var g=a.results,h=0;h<g.length;h++){var i=g[h],j=null!=i.children&&!d({results:i.children},!0),k=i.text===b.term;if(k||j)return f?!1:(a.data=g,void c(a))}if(f)return!0;var l=e.createTag(b);if(null!=l){var m=e.option(l);m.attr("data-select2-tag",!0),e.addOptions([m]),e.insertTag(g,l)}a.results=g,c(a)}var e=this;return this._removeOldTags(),null==b.term||""===b.term||null!=b.page?void a.call(this,b,c):void a.call(this,b,d)},b.prototype.createTag=function(a,b){return{id:b.term,text:b.term}},b.prototype.insertTag=function(a,b,c){b.unshift(c)},b.prototype._removeOldTags=function(){var b=(this._lastTag,this.$element.find("option[data-select2-tag]"));b.each(function(){this.selected||a(this).remove()})},b}),a("select2/data/tokenizer",["jquery"],function(a){function b(a,b,c){var d=c.get("tokenizer");void 0!==d&&(this.tokenizer=d),a.call(this,b,c)}return b.prototype.bind=function(a,b,c){a.call(this,b,c),this.$search=b.dropdown.$search||b.selection.$search||c.find(".select2-search__field")},b.prototype.query=function(a,b,c){function d(a){e.select(a)}var e=this;b.term=b.term||"";var f=this.tokenizer(b,this.options,d);f.term!==b.term&&(this.$search.length&&(this.$search.val(f.term),this.$search.focus()),b.term=f.term),a.call(this,b,c)},b.prototype.tokenizer=function(b,c,d,e){for(var f=d.get("tokenSeparators")||[],g=c.term,h=0,i=this.createTag||function(a){return{id:a.term,text:a.term}};h<g.length;){var j=g[h];if(-1!==a.inArray(j,f)){var k=g.substr(0,h),l=a.extend({},c,{term:k}),m=i(l);e(m),g=g.substr(h+1)||"",h=0}else h++}return{term:g}},b}),a("select2/data/minimumInputLength",[],function(){function a(a,b,c){this.minimumInputLength=c.get("minimumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){return b.term=b.term||"",b.term.length<this.minimumInputLength?void this.trigger("results:message",{message:"inputTooShort",args:{minimum:this.minimumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),a("select2/data/maximumInputLength",[],function(){function a(a,b,c){this.maximumInputLength=c.get("maximumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){return b.term=b.term||"",this.maximumInputLength>0&&b.term.length>this.maximumInputLength?void this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),a("select2/data/maximumSelectionLength",[],function(){function a(a,b,c){this.maximumSelectionLength=c.get("maximumSelectionLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){var d=this;this.current(function(e){var f=null!=e?e.length:0;return d.maximumSelectionLength>0&&f>=d.maximumSelectionLength?void d.trigger("results:message",{message:"maximumSelected",args:{maximum:d.maximumSelectionLength}}):void a.call(d,b,c)})},a}),a("select2/dropdown",["jquery","./utils"],function(a,b){function c(a,b){this.$element=a,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<span class="select2-dropdown"><span class="select2-results"></span></span>');return b.attr("dir",this.options.get("dir")),this.$dropdown=b,b},c.prototype.position=function(){},c.prototype.destroy=function(){this.$dropdown.remove()},c}),a("select2/dropdown/search",["jquery","../utils"],function(a){function b(){}return b.prototype.render=function(b){var c=b.call(this),d=a('<span class="select2-search select2-search--dropdown"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" /></span>');return this.$searchContainer=d,this.$search=d.find("input"),c.prepend(d),c},b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),this.$search.on("keydown",function(a){e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented()}),this.$search.on("input",function(){a(this).off("keyup")}),this.$search.on("keyup input",function(a){e.handleSearch(a)}),c.on("open",function(){e.$search.attr("tabindex",0),e.$search.focus(),window.setTimeout(function(){e.$search.focus()},0)}),c.on("close",function(){e.$search.attr("tabindex",-1),e.$search.val("")}),c.on("results:all",function(a){if(null==a.query.term||""===a.query.term){var b=e.showSearch(a);b?e.$searchContainer.removeClass("select2-search--hide"):e.$searchContainer.addClass("select2-search--hide")}})},b.prototype.handleSearch=function(){if(!this._keyUpPrevented){var a=this.$search.val();this.trigger("query",{term:a})}this._keyUpPrevented=!1},b.prototype.showSearch=function(){return!0},b}),a("select2/dropdown/hidePlaceholder",[],function(){function a(a,b,c,d){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c,d)}return a.prototype.append=function(a,b){b.results=this.removePlaceholder(b.results),a.call(this,b)},a.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},a.prototype.removePlaceholder=function(a,b){for(var c=b.slice(0),d=b.length-1;d>=0;d--){var e=b[d];this.placeholder.id===e.id&&c.splice(d,1)}return c},a}),a("select2/dropdown/infiniteScroll",["jquery"],function(a){function b(a,b,c,d){this.lastParams={},a.call(this,b,c,d),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return b.prototype.append=function(a,b){this.$loadingMore.remove(),this.loading=!1,a.call(this,b),this.showLoadingMore(b)&&this.$results.append(this.$loadingMore)},b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),c.on("query",function(a){e.lastParams=a,e.loading=!0}),c.on("query:append",function(a){e.lastParams=a,e.loading=!0}),this.$results.on("scroll",function(){var b=a.contains(document.documentElement,e.$loadingMore[0]);if(!e.loading&&b){var c=e.$results.offset().top+e.$results.outerHeight(!1),d=e.$loadingMore.offset().top+e.$loadingMore.outerHeight(!1);c+50>=d&&e.loadMore()}})},b.prototype.loadMore=function(){this.loading=!0;var b=a.extend({},{page:1},this.lastParams);b.page++,this.trigger("query:append",b)},b.prototype.showLoadingMore=function(a,b){return b.pagination&&b.pagination.more},b.prototype.createLoadingMore=function(){var b=a('<li class="option load-more" role="treeitem"></li>'),c=this.options.get("translations").get("loadingMore");return b.html(c(this.lastParams)),b},b}),a("select2/dropdown/attachBody",["jquery","../utils"],function(a,b){function c(a,b,c){this.$dropdownParent=c.get("dropdownParent")||document.body,a.call(this,b,c)}return c.prototype.bind=function(a,b,c){var d=this,e=!1;a.call(this,b,c),b.on("open",function(){d._showDropdown(),d._attachPositioningHandler(b),e||(e=!0,b.on("results:all",function(){d._positionDropdown(),d._resizeDropdown()}),b.on("results:append",function(){d._positionDropdown(),d._resizeDropdown()}))}),b.on("close",function(){d._hideDropdown(),d._detachPositioningHandler(b)}),this.$dropdownContainer.on("mousedown",function(a){a.stopPropagation()})},c.prototype.position=function(a,b,c){b.attr("class",c.attr("class")),b.removeClass("select2"),b.addClass("select2-container--open"),b.css({position:"absolute",top:-999999}),this.$container=c},c.prototype.render=function(b){var c=a("<span></span>"),d=b.call(this);return c.append(d),this.$dropdownContainer=c,c},c.prototype._hideDropdown=function(){this.$dropdownContainer.detach()},c.prototype._attachPositioningHandler=function(c){var d=this,e="scroll.select2."+c.id,f="resize.select2."+c.id,g="orientationchange.select2."+c.id,h=this.$container.parents().filter(b.hasScroll);h.each(function(){a(this).data("select2-scroll-position",{x:a(this).scrollLeft(),y:a(this).scrollTop()})}),h.on(e,function(){var b=a(this).data("select2-scroll-position");a(this).scrollTop(b.y)}),a(window).on(e+" "+f+" "+g,function(){d._positionDropdown(),d._resizeDropdown()})},c.prototype._detachPositioningHandler=function(c){var d="scroll.select2."+c.id,e="resize.select2."+c.id,f="orientationchange.select2."+c.id,g=this.$container.parents().filter(b.hasScroll);g.off(d),a(window).off(d+" "+e+" "+f)},c.prototype._positionDropdown=function(){var b=a(window),c=this.$dropdown.hasClass("select2-dropdown--above"),d=this.$dropdown.hasClass("select2-dropdown--below"),e=null,f=(this.$container.position(),this.$container.offset());f.bottom=f.top+this.$container.outerHeight(!1);var g={height:this.$container.outerHeight(!1)};g.top=f.top,g.bottom=f.top+g.height;var h={height:this.$dropdown.outerHeight(!1)},i={top:b.scrollTop(),bottom:b.scrollTop()+b.height()},j=i.top<f.top-h.height,k=i.bottom>f.bottom+h.height,l={left:f.left,top:g.bottom};c||d||(e="below"),k||!j||c?!j&&k&&c&&(e="below"):e="above",("above"==e||c&&"below"!==e)&&(l.top=g.top-h.height),null!=e&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+e),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+e)),this.$dropdownContainer.css(l)},c.prototype._resizeDropdown=function(){this.$dropdownContainer.width(),this.$dropdown.css({width:this.$container.outerWidth(!1)+"px"})},c.prototype._showDropdown=function(){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},c}),a("select2/dropdown/minimumResultsForSearch",[],function(){function a(b){for(var c=0,d=0;d<b.length;d++){var e=b[d];e.children?c+=a(e.children):c++}return c}function b(a,b,c,d){this.minimumResultsForSearch=c.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),a.call(this,b,c,d)}return b.prototype.showSearch=function(b,c){return a(c.data.results)<this.minimumResultsForSearch?!1:b.call(this,c)},b}),a("select2/dropdown/selectOnClose",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("close",function(){d._handleSelectOnClose()})},a.prototype._handleSelectOnClose=function(){var a=this.getHighlightedResults();a.length<1||a.trigger("mouseup")},a}),a("select2/dropdown/closeOnSelect",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("select",function(a){d._selectTriggered(a)}),b.on("unselect",function(a){d._selectTriggered(a)})},a.prototype._selectTriggered=function(a,b){var c=b.originalEvent;c&&c.ctrlKey||this.trigger("close")},a}),a("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(a){var b=a.input.length-a.maximum,c="Please delete "+b+" character";return 1!=b&&(c+="s"),c},inputTooShort:function(a){var b=a.minimum-a.input.length,c="Please enter "+b+" or more characters";return c},loadingMore:function(){return"Loading more results…"},maximumSelected:function(a){var b="You can only select "+a.maximum+" item";return 1!=a.maximum&&(b+="s"),b},noResults:function(){return"No results found"},searching:function(){return"Searching…"}}}),a("select2/defaults",["jquery","./results","./selection/single","./selection/multiple","./selection/placeholder","./selection/allowClear","./selection/search","./selection/eventRelay","./utils","./translation","./diacritics","./data/select","./data/array","./data/ajax","./data/tags","./data/tokenizer","./data/minimumInputLength","./data/maximumInputLength","./data/maximumSelectionLength","./dropdown","./dropdown/search","./dropdown/hidePlaceholder","./dropdown/infiniteScroll","./dropdown/attachBody","./dropdown/minimumResultsForSearch","./dropdown/selectOnClose","./dropdown/closeOnSelect","./i18n/en"],function(a,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C){function D(){this.reset()}D.prototype.apply=function(l){if(l=a.extend({},this.defaults,l),null==l.dataAdapter){if(l.dataAdapter=null!=l.ajax?o:null!=l.data?n:m,l.minimumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,r)),l.maximumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,s)),l.maximumSelectionLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,t)),null!=l.tags&&(l.dataAdapter=j.Decorate(l.dataAdapter,p)),(null!=l.tokenSeparators||null!=l.tokenizer)&&(l.dataAdapter=j.Decorate(l.dataAdapter,q)),null!=l.query){var C=b(l.amdBase+"compat/query");l.dataAdapter=j.Decorate(l.dataAdapter,C)}if(null!=l.initSelection){var D=b(l.amdBase+"compat/initSelection");l.dataAdapter=j.Decorate(l.dataAdapter,D)}}if(null==l.resultsAdapter&&(l.resultsAdapter=c,null!=l.ajax&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,x)),null!=l.placeholder&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,w)),l.selectOnClose&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,A))),null==l.dropdownAdapter){if(l.multiple)l.dropdownAdapter=u;else{var E=j.Decorate(u,v);l.dropdownAdapter=E}0!==l.minimumResultsForSearch&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,z)),l.closeOnSelect&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,B)),l.dropdownAdapter=j.Decorate(l.dropdownAdapter,y)}if(null==l.selectionAdapter&&(l.selectionAdapter=l.multiple?e:d,null!=l.placeholder&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,f)),l.allowClear&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,g)),l.multiple&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,h)),l.selectionAdapter=j.Decorate(l.selectionAdapter,i)),"string"==typeof l.language)if(l.language.indexOf("-")>0){var F=l.language.split("-"),G=F[0];l.language=[l.language,G]}else l.language=[l.language];if(a.isArray(l.language)){var H=new k;l.language.push("en");for(var I=l.language,J=0;J<I.length;J++){var K=I[J],L={};try{L=k.loadPath(K)}catch(M){try{K=this.defaults.amdLanguageBase+K,L=k.loadPath(K)}catch(N){window.console&&console.warn&&console.warn('Select2: The lanugage file for "'+K+'" could not be automatically loaded. A fallback will be used instead.');continue}}H.extend(L)}l.translations=H}else l.translations=new k(l.language);return l},D.prototype.reset=function(){function b(a){function b(a){return l[a]||a}return a.replace(/[^\u0000-\u007E]/g,b)}function c(d,e){if(""===a.trim(d.term))return e;if(e.children&&e.children.length>0){for(var f=a.extend(!0,{},e),g=e.children.length-1;g>=0;g--){var h=e.children[g],i=c(d,h);null==i&&f.children.splice(g,1)}return f.children.length>0?f:c(d,f)}var j=b(e.text).toUpperCase(),k=b(d.term).toUpperCase();return j.indexOf(k)>-1?e:null}this.defaults={amdBase:"select2/",amdLanguageBase:"select2/i18n/",closeOnSelect:!0,escapeMarkup:j.escapeMarkup,language:C,matcher:c,minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,sorter:function(a){return a},templateResult:function(a){return a.text},templateSelection:function(a){return a.text},theme:"default",width:"resolve"}},D.prototype.set=function(b,c){var d=a.camelCase(b),e={};e[d]=c;var f=j._convertData(e);a.extend(this.defaults,f)};var E=new D;return E}),a("select2/options",["jquery","./defaults","./utils"],function(a,c,d){function e(a,e){if(this.options=a,null!=e&&this.fromElement(e),this.options=c.apply(this.options),e&&e.is("input")){var f=b(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=d.Decorate(this.options.dataAdapter,f)}}return e.prototype.fromElement=function(b){var c=["select2"];null==this.options.multiple&&(this.options.multiple=b.prop("multiple")),null==this.options.disabled&&(this.options.disabled=b.prop("disabled")),null==this.options.language&&(b.prop("lang")?this.options.language=b.prop("lang").toLowerCase():b.closest("[lang]").prop("lang")&&(this.options.language=b.closest("[lang]").prop("lang"))),null==this.options.dir&&(this.options.dir=b.prop("dir")?b.prop("dir"):b.closest("[dir]").prop("dir")?b.closest("[dir]").prop("dir"):"ltr"),b.prop("disabled",this.options.disabled),b.prop("multiple",this.options.multiple),b.data("select2Tags")&&(window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),b.data("data",b.data("select2Tags")),b.data("tags",!0)),b.data("ajaxUrl")&&(window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),b.data("ajax-Url",b.data("ajaxUrl")));var e={};e=a.fn.jquery&&"1."==a.fn.jquery.substr(0,2)&&b[0].dataset?a.extend(!0,{},b[0].dataset,b.data()):b.data();var f=a.extend(!0,{},e);f=d._convertData(f);for(var g in f)a.inArray(g,c)>-1||(a.isPlainObject(this.options[g])?a.extend(this.options[g],f[g]):this.options[g]=f[g]);return this},e.prototype.get=function(a){return this.options[a]},e.prototype.set=function(a,b){this.options[a]=b},e}),a("select2/core",["jquery","./options","./utils","./keys"],function(a,b,c,d){var e=function(a,c){null!=a.data("select2")&&a.data("select2").destroy(),this.$element=a,this.id=this._generateId(a),c=c||{},this.options=new b(c,a),e.__super__.constructor.call(this);var d=a.attr("tabindex")||0;a.data("old-tabindex",d),a.attr("tabindex","-1");var f=this.options.get("dataAdapter");this.data=new f(a,this.options);var g=this.render();this._placeContainer(g);var h=this.options.get("selectionAdapter");this.selection=new h(a,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,g);var i=this.options.get("dropdownAdapter");this.dropdown=new i(a,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,g);var j=this.options.get("resultsAdapter");this.results=new j(a,this.options,this.data),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var k=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.data.current(function(a){k.trigger("selection:update",{data:a})}),a.hide(),this._syncAttributes(),a.data("select2",this)};return c.Extend(e,c.Observable),e.prototype._generateId=function(a){var b="";return b=null!=a.attr("id")?a.attr("id"):null!=a.attr("name")?a.attr("name")+"-"+c.generateChars(2):c.generateChars(4),b="select2-"+b},e.prototype._placeContainer=function(a){a.insertAfter(this.$element);var b=this._resolveWidth(this.$element,this.options.get("width"));null!=b&&a.css("width",b)},e.prototype._resolveWidth=function(a,b){var c=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==b){var d=this._resolveWidth(a,"style");return null!=d?d:this._resolveWidth(a,"element")}if("element"==b){var e=a.outerWidth(!1);return 0>=e?"auto":e+"px"}if("style"==b){var f=a.attr("style");if("string"!=typeof f)return null;for(var g=f.split(";"),h=0,i=g.length;i>h;h+=1){var j=g[h].replace(/\s/g,""),k=j.match(c);if(null!==k&&k.length>=1)return k[1]}return null}return b},e.prototype._bindAdapters=function(){this.data.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},e.prototype._registerDomEvents=function(){var b=this;this.$element.on("change.select2",function(){b.data.current(function(a){b.trigger("selection:update",{data:a})})}),this._sync=c.bind(this._syncAttributes,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._sync);var d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=d?(this._observer=new d(function(c){a.each(c,b._sync)}),this._observer.observe(this.$element[0],{attributes:!0,subtree:!1})):this.$element[0].addEventListener&&this.$element[0].addEventListener("DOMAttrModified",b._sync,!1)},e.prototype._registerDataEvents=function(){var a=this;this.data.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerSelectionEvents=function(){var b=this,c=["toggle"];this.selection.on("toggle",function(){b.toggleDropdown()}),this.selection.on("*",function(d,e){-1===a.inArray(d,c)&&b.trigger(d,e)})},e.prototype._registerDropdownEvents=function(){var a=this;this.dropdown.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerResultsEvents=function(){var a=this;this.results.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerEvents=function(){var a=this;this.on("open",function(){a.$container.addClass("select2-container--open")}),this.on("close",function(){a.$container.removeClass("select2-container--open")}),this.on("enable",function(){a.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){a.$container.addClass("select2-container--disabled")}),this.on("focus",function(){a.$container.addClass("select2-container--focus")}),this.on("blur",function(){a.$container.removeClass("select2-container--focus")}),this.on("query",function(b){a.isOpen()||a.trigger("open"),this.data.query(b,function(c){a.trigger("results:all",{data:c,query:b})})}),this.on("query:append",function(b){this.data.query(b,function(c){a.trigger("results:append",{data:c,query:b})})}),this.on("keypress",function(b){var c=b.which;a.isOpen()?c===d.ENTER?(a.trigger("results:select"),b.preventDefault()):c===d.SPACE&&b.ctrlKey?(a.trigger("results:toggle"),b.preventDefault()):c===d.UP?(a.trigger("results:previous"),b.preventDefault()):c===d.DOWN?(a.trigger("results:next"),b.preventDefault()):(c===d.ESC||c===d.TAB)&&(a.close(),b.preventDefault()):(c===d.ENTER||c===d.SPACE||(c===d.DOWN||c===d.UP)&&b.altKey)&&(a.open(),b.preventDefault())})},e.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.options.get("disabled")?(this.isOpen()&&this.close(),this.trigger("disable")):this.trigger("enable")},e.prototype.trigger=function(a,b){var c=e.__super__.trigger,d={open:"opening",close:"closing",select:"selecting",unselect:"unselecting"};if(a in d){var f=d[a],g={prevented:!1,name:a,args:b};if(c.call(this,f,g),g.prevented)return void(b.prevented=!0)}c.call(this,a,b)},e.prototype.toggleDropdown=function(){this.options.get("disabled")||(this.isOpen()?this.close():this.open())},e.prototype.open=function(){this.isOpen()||(this.trigger("query",{}),this.trigger("open"))},e.prototype.close=function(){this.isOpen()&&this.trigger("close")},e.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},e.prototype.enable=function(a){window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),0===a.length&&(a=[!0]);var b=!a[0];this.$element.prop("disabled",b)},e.prototype.data=function(){arguments.length>0&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var a=[];return this.dataAdpater.current(function(b){a=b}),a},e.prototype.val=function(b){if(window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),0===b.length)return this.$element.val();var c=b[0];a.isArray(c)&&(c=a.map(c,function(a){return a.toString()})),this.$element.val(c).trigger("change")},e.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._sync),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&this.$element[0].removeEventListener("DOMAttrModified",this._sync,!1),this._sync=null,this.$element.off(".select2"),this.$element.attr("tabindex",this.$element.data("old-tabindex")),this.$element.show(),this.$element.removeData("select2"),this.data.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.data=null,this.selection=null,this.dropdown=null,this.results=null},e.prototype.render=function(){var b=a('<span class="select2 select2-container"><span class="selection"></span><span class="dropdown-wrapper" aria-hidden="true"></span></span>');return b.attr("dir",this.options.get("dir")),this.$container=b,this.$container.addClass("select2-container--"+this.options.get("theme")),b.data("element",this.$element),b},e}),a("jquery.select2",["jquery","./select2/core","./select2/defaults"],function(a,c,d){try{b("jquery.mousewheel")}catch(e){}return null==a.fn.select2&&(a.fn.select2=function(b){if(b=b||{},"object"==typeof b)return this.each(function(){{var d=a.extend({},b,!0);new c(a(this),d)}}),this;if("string"==typeof b){var d=this.data("select2"),e=Array.prototype.slice.call(arguments,1);return d[b](e)}throw new Error("Invalid arguments for Select2: "+b)}),null==a.fn.select2.defaults&&(a.fn.select2.defaults=d),c}),b("jquery.select2"),jQuery.fn.select2.amd={define:a,require:b}}();
\ No newline at end of file diff --git a/public/vendor/select2/select2-bootstrap.css b/public/vendor/select2/select2-bootstrap.css new file mode 100644 index 00000000..1e392c93 --- /dev/null +++ b/public/vendor/select2/select2-bootstrap.css @@ -0,0 +1,495 @@ +/*! Select2 Bootstrap 3 CSS v1.4.6 | MIT License | github.com/t0m/select2-bootstrap-css */ +/** + * Reset Bootstrap 3 .form-control styles which - if applied to the + * original <select>-element the Select2-plugin may be run against - + * are copied to the .select2-container. + * + * 1. Overwrite .select2-container's original display:inline-block + * with Bootstrap 3's default for .form-control, display:block; + * courtesy of @juristr (@see https://github.com/fk/select2-bootstrap-css/pull/1) + */ +.select2-container.form-control { + background: transparent; + box-shadow: none; + border: none; + display: block; + /* 1 */ + margin: 0; + padding: 0; +} + +/** + * Adjust Select2 inputs to fit Bootstrap 3 default .form-control appearance. + */ +.select2-container .select2-choices .select2-search-field input, +.select2-container .select2-choice, +.select2-container .select2-choices { + background: none; + padding: 0; + border-color: #cccccc; + border-radius: 4px; + color: #555555; + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + background-color: white; + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); +} + +.select2-search input { + border-color: #cccccc; + border-radius: 4px; + color: #555555; + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + background-color: white; + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); +} + +.select2-container .select2-choices .select2-search-field input { + -webkit-box-shadow: none; + box-shadow: none; +} + +/** + * Adjust Select2 input heights to match the Bootstrap default. + */ +.select2-container .select2-choice { + height: 34px; + line-height: 1.42857; +} + +/** + * Address Multi Select2's height which - depending on how many elements have been selected - + * may grown higher than their initial size. + */ +.select2-container.select2-container-multi.form-control { + height: auto; +} + +/** + * Address Bootstrap 3 control sizing classes + * @see http://getbootstrap.com/css/#forms-control-sizes + */ +.select2-container.input-sm .select2-choice, +.input-group-sm .select2-container .select2-choice { + height: 30px; + line-height: 1.5; + border-radius: 3px; +} + +.select2-container.input-lg .select2-choice, +.input-group-lg .select2-container .select2-choice { + height: 46px; + line-height: 1.33333; + border-radius: 6px; +} + +.select2-container-multi .select2-choices .select2-search-field input { + height: 32px; +} + +.select2-container-multi.input-sm .select2-choices .select2-search-field input, +.input-group-sm .select2-container-multi .select2-choices .select2-search-field input { + height: 28px; +} + +.select2-container-multi.input-lg .select2-choices .select2-search-field input, +.input-group-lg .select2-container-multi .select2-choices .select2-search-field input { + height: 44px; +} + +/** + * Adjust height and line-height for .select2-search-field amd multi-select Select2 widgets. + * + * 1. Class repetition to address missing .select2-chosen in Select2 < 3.3.2. + */ +.select2-container-multi .select2-choices .select2-search-field input { + margin: 0; +} + +.select2-chosen, +.select2-choice > span:first-child, +.select2-container .select2-choices .select2-search-field input { + padding: 6px 12px; +} + +.input-sm .select2-chosen, +.input-group-sm .select2-chosen, +.input-sm .select2-choice > span:first-child, +.input-group-sm .select2-choice > span:first-child, +.input-sm .select2-choices .select2-search-field input, +.input-group-sm .select2-choices .select2-search-field input { + padding: 5px 10px; +} + +.input-lg .select2-chosen, +.input-group-lg .select2-chosen, +.input-lg .select2-choice > span:first-child, +.input-group-lg .select2-choice > span:first-child, +.input-lg .select2-choices .select2-search-field input, +.input-group-lg .select2-choices .select2-search-field input { + padding: 10px 16px; +} + +.select2-container-multi .select2-choices .select2-search-choice { + margin-top: 5px; + margin-bottom: 3px; +} + +.select2-container-multi.input-sm .select2-choices .select2-search-choice, +.input-group-sm .select2-container-multi .select2-choices .select2-search-choice { + margin-top: 3px; + margin-bottom: 2px; +} + +.select2-container-multi.input-lg .select2-choices .select2-search-choice, +.input-group-lg .select2-container-multi .select2-choices .select2-search-choice { + line-height: 24px; +} + +/** + * Adjust the single Select2's dropdown arrow button appearance. + * + * 1. For Select2 v.3.3.2. + */ +.select2-container .select2-choice .select2-arrow, +.select2-container .select2-choice div { + border-left: none; + background: none; + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); +} + +.select2-dropdown-open .select2-choice .select2-arrow, +.select2-dropdown-open .select2-choice div { + border-left-color: transparent; + background: none; + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); +} + +/** + * Adjust the dropdown arrow button icon position for the single-select Select2 elements + * to make it line up vertically now that we increased the height of .select2-container. + * + * 1. Class repetition to address missing .select2-chosen in Select2 v.3.3.2. + */ +.select2-container .select2-choice .select2-arrow b, +.select2-container .select2-choice div b { + background-position: 0 3px; +} + +.select2-dropdown-open .select2-choice .select2-arrow b, +.select2-dropdown-open .select2-choice div b { + background-position: -18px 3px; +} + +.select2-container.input-sm .select2-choice .select2-arrow b, +.input-group-sm .select2-container .select2-choice .select2-arrow b, +.select2-container.input-sm .select2-choice div b, +.input-group-sm .select2-container .select2-choice div b { + background-position: 0 1px; +} + +.select2-dropdown-open.input-sm .select2-choice .select2-arrow b, +.input-group-sm .select2-dropdown-open .select2-choice .select2-arrow b, +.select2-dropdown-open.input-sm .select2-choice div b, +.input-group-sm .select2-dropdown-open .select2-choice div b { + background-position: -18px 1px; +} + +.select2-container.input-lg .select2-choice .select2-arrow b, +.input-group-lg .select2-container .select2-choice .select2-arrow b, +.select2-container.input-lg .select2-choice div b, +.input-group-lg .select2-container .select2-choice div b { + background-position: 0 9px; +} + +.select2-dropdown-open.input-lg .select2-choice .select2-arrow b, +.input-group-lg .select2-dropdown-open .select2-choice .select2-arrow b, +.select2-dropdown-open.input-lg .select2-choice div b, +.input-group-lg .select2-dropdown-open .select2-choice div b { + background-position: -18px 9px; +} + +/** + * Address Bootstrap's validation states and change Select2's border colors and focus states. + * Apply .has-warning, .has-danger or .has-succes to #select2-drop to match Bootstraps' colors. + */ +.has-warning .select2-choice, +.has-warning .select2-choices { + border-color: #8a6d3b; +} +.has-warning .select2-container-active .select2-choice, +.has-warning .select2-container-multi.select2-container-active .select2-choices { + border-color: #66512c; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #c0a16b; + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #c0a16b; +} +.has-warning.select2-drop-active { + border-color: #66512c; +} +.has-warning.select2-drop-active.select2-drop.select2-drop-above { + border-top-color: #66512c; +} + +.has-error .select2-choice, +.has-error .select2-choices { + border-color: #a94442; +} +.has-error .select2-container-active .select2-choice, +.has-error .select2-container-multi.select2-container-active .select2-choices { + border-color: #843534; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #ce8483; + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #ce8483; +} +.has-error.select2-drop-active { + border-color: #843534; +} +.has-error.select2-drop-active.select2-drop.select2-drop-above { + border-top-color: #843534; +} + +.has-success .select2-choice, +.has-success .select2-choices { + border-color: #3c763d; +} +.has-success .select2-container-active .select2-choice, +.has-success .select2-container-multi.select2-container-active .select2-choices { + border-color: #2b542c; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #67b168; + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #67b168; +} +.has-success.select2-drop-active { + border-color: #2b542c; +} +.has-success.select2-drop-active.select2-drop.select2-drop-above { + border-top-color: #2b542c; +} + +/** + * Make Select2's active-styles - applied to .select2-container when the widget receives focus - + * fit Bootstrap 3's .form-element:focus appearance. + */ +.select2-container-active .select2-choice, +.select2-container-multi.select2-container-active .select2-choices { + border-color: #66afe9; + outline: none; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6); + -webkit-transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s; + -o-transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s; + transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s; +} + +.select2-drop-active { + border-color: #66afe9; +} + +.select2-drop-auto-width, +.select2-drop.select2-drop-above.select2-drop-active { + border-top-color: #66afe9; +} + +/** + * Select2 widgets in Bootstrap Input Groups + * + * When Select2 widgets are combined with other elements using Bootstrap 3's + * "Input Group" component, we don't want specific edges of the Select2 container + * to have a border-radius. + * + * In Bootstrap 2, input groups required a markup where these style adjustments + * could be bound to a CSS-class identifying if the additional elements are appended, + * prepended or both. + * + * Bootstrap 3 doesn't rely on these classes anymore, so we have to use our own. + * Use .select2-bootstrap-prepend and .select2-bootstrap-append on a Bootstrap 3 .input-group + * to let the contained Select2 widget know which edges should not be rounded as they are + * directly followed by another element. + * + * @see http://getbootstrap.com/components/#input-groups + */ +.input-group.select2-bootstrap-prepend [class^="select2-choice"] { + border-bottom-left-radius: 0 !important; + border-top-left-radius: 0 !important; +} + +.input-group.select2-bootstrap-append [class^="select2-choice"] { + border-bottom-right-radius: 0 !important; + border-top-right-radius: 0 !important; +} + +.select2-dropdown-open [class^="select2-choice"] { + border-bottom-right-radius: 0 !important; + border-bottom-left-radius: 0 !important; +} + +.select2-dropdown-open.select2-drop-above [class^="select2-choice"] { + border-top-right-radius: 0 !important; + border-top-left-radius: 0 !important; + border-bottom-right-radius: 4px !important; + border-bottom-left-radius: 4px !important; + background: white; + filter: none; +} +.input-group.select2-bootstrap-prepend .select2-dropdown-open.select2-drop-above [class^="select2-choice"] { + border-bottom-left-radius: 0 !important; + border-top-left-radius: 0 !important; +} +.input-group.select2-bootstrap-append .select2-dropdown-open.select2-drop-above [class^="select2-choice"] { + border-bottom-right-radius: 0 !important; + border-top-right-radius: 0 !important; +} +.input-group.input-group-sm.select2-bootstrap-prepend .select2-dropdown-open.select2-drop-above [class^="select2-choice"] { + border-bottom-right-radius: 3px !important; +} +.input-group.input-group-lg.select2-bootstrap-prepend .select2-dropdown-open.select2-drop-above [class^="select2-choice"] { + border-bottom-right-radius: 6px !important; +} +.input-group.input-group-sm.select2-bootstrap-append .select2-dropdown-open.select2-drop-above [class^="select2-choice"] { + border-bottom-left-radius: 3px !important; +} +.input-group.input-group-lg.select2-bootstrap-append .select2-dropdown-open.select2-drop-above [class^="select2-choice"] { + border-bottom-left-radius: 6px !important; +} + +/** + * Adjust Select2's choices hover and selected styles to match Bootstrap 3's default dropdown styles. + */ +.select2-results .select2-highlighted { + color: white; + background-color: #337ab7; +} + +/** + * Adjust alignment of Bootstrap 3 buttons in Bootstrap 3 Input Groups to address + * Multi Select2's height which - depending on how many elements have been selected - + * may grown higher than their initial size. + */ +.select2-bootstrap-append .select2-container-multiple, +.select2-bootstrap-append .input-group-btn, +.select2-bootstrap-append .input-group-btn .btn, +.select2-bootstrap-prepend .select2-container-multiple, +.select2-bootstrap-prepend .input-group-btn, +.select2-bootstrap-prepend .input-group-btn .btn { + vertical-align: top; +} + +/** + * Make Multi Select2's choices match Bootstrap 3's default button styles. + */ +.select2-container-multi .select2-choices .select2-search-choice { + color: #555555; + background: white; + border-color: #cccccc; + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); + -webkit-box-shadow: none; + box-shadow: none; +} + +.select2-container-multi .select2-choices .select2-search-choice-focus { + background: #ebebeb; + border-color: #adadad; + color: #333333; + -webkit-box-shadow: none; + box-shadow: none; +} + +/** + * Address Multi Select2's choice close-button vertical alignment. + */ +.select2-search-choice-close { + margin-top: -7px; + top: 50%; +} + +/** + * Adjust the single Select2's clear button position (used to reset the select box + * back to the placeholder value and visible once a selection is made + * activated by Select2's "allowClear" option). + */ +.select2-container .select2-choice abbr { + top: 50%; +} + +/** + * Adjust "no results" and "selection limit" messages to make use + * of Bootstrap 3's default "Alert" style. + * + * @see http://getbootstrap.com/components/#alerts-default + */ +.select2-results .select2-no-results, +.select2-results .select2-searching, +.select2-results .select2-selection-limit { + background-color: #fcf8e3; + color: #8a6d3b; +} + +/** + * Address disabled Select2 styles. + * + * 1. For Select2 v.3.3.2. + * 2. Revert border-left:0 inherited from Select2's CSS to prevent the arrow + * from jumping when switching from disabled to enabled state and vice versa. + */ +.select2-container.select2-container-disabled .select2-choice, +.select2-container.select2-container-disabled .select2-choices { + cursor: not-allowed; + background-color: #eeeeee; + border-color: #cccccc; +} +.select2-container.select2-container-disabled .select2-choice .select2-arrow, +.select2-container.select2-container-disabled .select2-choice div, +.select2-container.select2-container-disabled .select2-choices .select2-arrow, +.select2-container.select2-container-disabled .select2-choices div { + background-color: transparent; + border-left: 1px solid transparent; + /* 2 */ +} + +/** + * Address Select2's loading indicator position - which should not stick + * to the right edge of Select2's search input. + * + * 1. in .select2-search input + * 2. in Multi Select2's .select2-search-field input + * 3. in the status-message of infinite-scroll with remote data (@see http://ivaynberg.github.io/select2/#infinite) + * + * These styles alter Select2's default background-position of 100% + * and supply the new background-position syntax to browsers which support it: + * + * 1. Android, Safari < 6/Mobile, IE<9: change to a relative background-position of 99% + * 2. Chrome 25+, Firefox 13+, IE 9+, Opera 10.5+: use the new CSS3-background-position syntax + * + * @see http://www.w3.org/TR/css3-background/#background-position + * + * @todo Since both Select2 and Bootstrap 3 only support IE8 and above, + * we could use the :after-pseudo-element to display the loading indicator. + * Alternatively, we could supply an altered loading indicator image which already + * contains an offset to the right. + */ +.select2-search input.select2-active, +.select2-container-multi .select2-choices .select2-search-field input.select2-active, +.select2-more-results.select2-active { + background-position: 99%; + /* 4 */ + background-position: right 4px center; + /* 5 */ +} + +/** + * To support Select2 pre v3.4.2 in combination with Bootstrap v3.2.0, + * ensure that .select2-offscreen width, height and position can not be overwritten. + * + * This adresses changes in Bootstrap somewhere after the initial v3.0.0 which - + * in combination with Select2's pre-v3.4.2 CSS missing the "!important" after + * the following rules - allow Bootstrap to overwrite the latter, which results in + * the original <select> element Select2 is replacing not be properly being hidden + * when used in a "Bootstrap Input Group with Addon". + **/ +.select2-offscreen, +.select2-offscreen:focus { + width: 1px !important; + height: 1px !important; + position: absolute !important; +} diff --git a/public/vendor/select2/select2-spinner.gif b/public/vendor/select2/select2-spinner.gif Binary files differnew file mode 100755 index 00000000..5b33f7e5 --- /dev/null +++ b/public/vendor/select2/select2-spinner.gif diff --git a/public/vendor/select2/select2.css b/public/vendor/select2/select2.css new file mode 100755 index 00000000..2d07a034 --- /dev/null +++ b/public/vendor/select2/select2.css @@ -0,0 +1,704 @@ +/* +Version: 3.5.2 Timestamp: Sat Nov 1 14:43:36 EDT 2014 +*/ +.select2-container { + margin: 0; + position: relative; + display: inline-block; + /* inline-block for ie7 */ + zoom: 1; + *display: inline; + vertical-align: middle; +} + +.select2-container, +.select2-drop, +.select2-search, +.select2-search input { + /* + Force border-box so that % widths fit the parent + container without overlap because of margin/padding. + More Info : http://www.quirksmode.org/css/box.html + */ + -webkit-box-sizing: border-box; /* webkit */ + -moz-box-sizing: border-box; /* firefox */ + box-sizing: border-box; /* css3 */ +} + +.select2-container .select2-choice { + display: block; + height: 26px; + padding: 0 0 0 8px; + overflow: hidden; + position: relative; + + border: 1px solid #aaa; + white-space: nowrap; + line-height: 26px; + color: #444; + text-decoration: none; + + border-radius: 4px; + + background-clip: padding-box; + + -webkit-touch-callout: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + + background-color: #fff; + background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #eee), color-stop(0.5, #fff)); + background-image: -webkit-linear-gradient(center bottom, #eee 0%, #fff 50%); + background-image: -moz-linear-gradient(center bottom, #eee 0%, #fff 50%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr = '#ffffff', endColorstr = '#eeeeee', GradientType = 0); + background-image: linear-gradient(to top, #eee 0%, #fff 50%); +} + +html[dir="rtl"] .select2-container .select2-choice { + padding: 0 8px 0 0; +} + +.select2-container.select2-drop-above .select2-choice { + border-bottom-color: #aaa; + + border-radius: 0 0 4px 4px; + + background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #eee), color-stop(0.9, #fff)); + background-image: -webkit-linear-gradient(center bottom, #eee 0%, #fff 90%); + background-image: -moz-linear-gradient(center bottom, #eee 0%, #fff 90%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0); + background-image: linear-gradient(to bottom, #eee 0%, #fff 90%); +} + +.select2-container.select2-allowclear .select2-choice .select2-chosen { + margin-right: 42px; +} + +.select2-container .select2-choice > .select2-chosen { + margin-right: 26px; + display: block; + overflow: hidden; + + white-space: nowrap; + + text-overflow: ellipsis; + float: none; + width: auto; +} + +html[dir="rtl"] .select2-container .select2-choice > .select2-chosen { + margin-left: 26px; + margin-right: 0; +} + +.select2-container .select2-choice abbr { + display: none; + width: 12px; + height: 12px; + position: absolute; + right: 24px; + top: 8px; + + font-size: 1px; + text-decoration: none; + + border: 0; + background: url('select2.png') right top no-repeat; + cursor: pointer; + outline: 0; +} + +.select2-container.select2-allowclear .select2-choice abbr { + display: inline-block; +} + +.select2-container .select2-choice abbr:hover { + background-position: right -11px; + cursor: pointer; +} + +.select2-drop-mask { + border: 0; + margin: 0; + padding: 0; + position: fixed; + left: 0; + top: 0; + min-height: 100%; + min-width: 100%; + height: auto; + width: auto; + opacity: 0; + z-index: 9998; + /* styles required for IE to work */ + background-color: #fff; + filter: alpha(opacity=0); +} + +.select2-drop { + width: 100%; + margin-top: -1px; + position: absolute; + z-index: 9999; + top: 100%; + + background: #fff; + color: #000; + border: 1px solid #aaa; + border-top: 0; + + border-radius: 0 0 4px 4px; + + -webkit-box-shadow: 0 4px 5px rgba(0, 0, 0, .15); + box-shadow: 0 4px 5px rgba(0, 0, 0, .15); +} + +.select2-drop.select2-drop-above { + margin-top: 1px; + border-top: 1px solid #aaa; + border-bottom: 0; + + border-radius: 4px 4px 0 0; + + -webkit-box-shadow: 0 -4px 5px rgba(0, 0, 0, .15); + box-shadow: 0 -4px 5px rgba(0, 0, 0, .15); +} + +.select2-drop-active { + border: 1px solid #5897fb; + border-top: none; +} + +.select2-drop.select2-drop-above.select2-drop-active { + border-top: 1px solid #5897fb; +} + +.select2-drop-auto-width { + border-top: 1px solid #aaa; + width: auto; +} + +.select2-drop-auto-width .select2-search { + padding-top: 4px; +} + +.select2-container .select2-choice .select2-arrow { + display: inline-block; + width: 18px; + height: 100%; + position: absolute; + right: 0; + top: 0; + + border-left: 1px solid #aaa; + border-radius: 0 4px 4px 0; + + background-clip: padding-box; + + background: #ccc; + background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #ccc), color-stop(0.6, #eee)); + background-image: -webkit-linear-gradient(center bottom, #ccc 0%, #eee 60%); + background-image: -moz-linear-gradient(center bottom, #ccc 0%, #eee 60%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr = '#eeeeee', endColorstr = '#cccccc', GradientType = 0); + background-image: linear-gradient(to top, #ccc 0%, #eee 60%); +} + +html[dir="rtl"] .select2-container .select2-choice .select2-arrow { + left: 0; + right: auto; + + border-left: none; + border-right: 1px solid #aaa; + border-radius: 4px 0 0 4px; +} + +.select2-container .select2-choice .select2-arrow b { + display: block; + width: 100%; + height: 100%; + background: url('select2.png') no-repeat 0 1px; +} + +html[dir="rtl"] .select2-container .select2-choice .select2-arrow b { + background-position: 2px 1px; +} + +.select2-search { + display: inline-block; + width: 100%; + min-height: 26px; + margin: 0; + padding-left: 4px; + padding-right: 4px; + + position: relative; + z-index: 10000; + + white-space: nowrap; +} + +.select2-search input { + width: 100%; + height: auto !important; + min-height: 26px; + padding: 4px 20px 4px 5px; + margin: 0; + + outline: 0; + font-family: sans-serif; + font-size: 1em; + + border: 1px solid #aaa; + border-radius: 0; + + -webkit-box-shadow: none; + box-shadow: none; + + background: #fff url('select2.png') no-repeat 100% -22px; + background: url('select2.png') no-repeat 100% -22px, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, #fff), color-stop(0.99, #eee)); + background: url('select2.png') no-repeat 100% -22px, -webkit-linear-gradient(center bottom, #fff 85%, #eee 99%); + background: url('select2.png') no-repeat 100% -22px, -moz-linear-gradient(center bottom, #fff 85%, #eee 99%); + background: url('select2.png') no-repeat 100% -22px, linear-gradient(to bottom, #fff 85%, #eee 99%) 0 0; +} + +html[dir="rtl"] .select2-search input { + padding: 4px 5px 4px 20px; + + background: #fff url('select2.png') no-repeat -37px -22px; + background: url('select2.png') no-repeat -37px -22px, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, #fff), color-stop(0.99, #eee)); + background: url('select2.png') no-repeat -37px -22px, -webkit-linear-gradient(center bottom, #fff 85%, #eee 99%); + background: url('select2.png') no-repeat -37px -22px, -moz-linear-gradient(center bottom, #fff 85%, #eee 99%); + background: url('select2.png') no-repeat -37px -22px, linear-gradient(to bottom, #fff 85%, #eee 99%) 0 0; +} + +.select2-drop.select2-drop-above .select2-search input { + margin-top: 4px; +} + +.select2-search input.select2-active { + background: #fff url('select2-spinner.gif') no-repeat 100%; + background: url('select2-spinner.gif') no-repeat 100%, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, #fff), color-stop(0.99, #eee)); + background: url('select2-spinner.gif') no-repeat 100%, -webkit-linear-gradient(center bottom, #fff 85%, #eee 99%); + background: url('select2-spinner.gif') no-repeat 100%, -moz-linear-gradient(center bottom, #fff 85%, #eee 99%); + background: url('select2-spinner.gif') no-repeat 100%, linear-gradient(to bottom, #fff 85%, #eee 99%) 0 0; +} + +.select2-container-active .select2-choice, +.select2-container-active .select2-choices { + border: 1px solid #5897fb; + outline: none; + + -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, .3); + box-shadow: 0 0 5px rgba(0, 0, 0, .3); +} + +.select2-dropdown-open .select2-choice { + border-bottom-color: transparent; + -webkit-box-shadow: 0 1px 0 #fff inset; + box-shadow: 0 1px 0 #fff inset; + + border-bottom-left-radius: 0; + border-bottom-right-radius: 0; + + background-color: #eee; + background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #fff), color-stop(0.5, #eee)); + background-image: -webkit-linear-gradient(center bottom, #fff 0%, #eee 50%); + background-image: -moz-linear-gradient(center bottom, #fff 0%, #eee 50%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#ffffff', GradientType=0); + background-image: linear-gradient(to top, #fff 0%, #eee 50%); +} + +.select2-dropdown-open.select2-drop-above .select2-choice, +.select2-dropdown-open.select2-drop-above .select2-choices { + border: 1px solid #5897fb; + border-top-color: transparent; + + background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #fff), color-stop(0.5, #eee)); + background-image: -webkit-linear-gradient(center top, #fff 0%, #eee 50%); + background-image: -moz-linear-gradient(center top, #fff 0%, #eee 50%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#ffffff', GradientType=0); + background-image: linear-gradient(to bottom, #fff 0%, #eee 50%); +} + +.select2-dropdown-open .select2-choice .select2-arrow { + background: transparent; + border-left: none; + filter: none; +} +html[dir="rtl"] .select2-dropdown-open .select2-choice .select2-arrow { + border-right: none; +} + +.select2-dropdown-open .select2-choice .select2-arrow b { + background-position: -18px 1px; +} + +html[dir="rtl"] .select2-dropdown-open .select2-choice .select2-arrow b { + background-position: -16px 1px; +} + +.select2-hidden-accessible { + border: 0; + clip: rect(0 0 0 0); + height: 1px; + margin: -1px; + overflow: hidden; + padding: 0; + position: absolute; + width: 1px; +} + +/* results */ +.select2-results { + max-height: 200px; + padding: 0 0 0 4px; + margin: 4px 4px 4px 0; + position: relative; + overflow-x: hidden; + overflow-y: auto; + -webkit-tap-highlight-color: rgba(0, 0, 0, 0); +} + +html[dir="rtl"] .select2-results { + padding: 0 4px 0 0; + margin: 4px 0 4px 4px; +} + +.select2-results ul.select2-result-sub { + margin: 0; + padding-left: 0; +} + +.select2-results li { + list-style: none; + display: list-item; + background-image: none; +} + +.select2-results li.select2-result-with-children > .select2-result-label { + font-weight: bold; +} + +.select2-results .select2-result-label { + padding: 3px 7px 4px; + margin: 0; + cursor: pointer; + + min-height: 1em; + + -webkit-touch-callout: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.select2-results-dept-1 .select2-result-label { padding-left: 20px } +.select2-results-dept-2 .select2-result-label { padding-left: 40px } +.select2-results-dept-3 .select2-result-label { padding-left: 60px } +.select2-results-dept-4 .select2-result-label { padding-left: 80px } +.select2-results-dept-5 .select2-result-label { padding-left: 100px } +.select2-results-dept-6 .select2-result-label { padding-left: 110px } +.select2-results-dept-7 .select2-result-label { padding-left: 120px } + +.select2-results .select2-highlighted { + background: #3875d7; + color: #fff; +} + +.select2-results li em { + background: #feffde; + font-style: normal; +} + +.select2-results .select2-highlighted em { + background: transparent; +} + +.select2-results .select2-highlighted ul { + background: #fff; + color: #000; +} + +.select2-results .select2-no-results, +.select2-results .select2-searching, +.select2-results .select2-ajax-error, +.select2-results .select2-selection-limit { + background: #f4f4f4; + display: list-item; + padding-left: 5px; +} + +/* +disabled look for disabled choices in the results dropdown +*/ +.select2-results .select2-disabled.select2-highlighted { + color: #666; + background: #f4f4f4; + display: list-item; + cursor: default; +} +.select2-results .select2-disabled { + background: #f4f4f4; + display: list-item; + cursor: default; +} + +.select2-results .select2-selected { + display: none; +} + +.select2-more-results.select2-active { + background: #f4f4f4 url('select2-spinner.gif') no-repeat 100%; +} + +.select2-results .select2-ajax-error { + background: rgba(255, 50, 50, .2); +} + +.select2-more-results { + background: #f4f4f4; + display: list-item; +} + +/* disabled styles */ + +.select2-container.select2-container-disabled .select2-choice { + background-color: #f4f4f4; + background-image: none; + border: 1px solid #ddd; + cursor: default; +} + +.select2-container.select2-container-disabled .select2-choice .select2-arrow { + background-color: #f4f4f4; + background-image: none; + border-left: 0; +} + +.select2-container.select2-container-disabled .select2-choice abbr { + display: none; +} + + +/* multiselect */ + +.select2-container-multi .select2-choices { + height: auto !important; + height: 1%; + margin: 0; + padding: 0 5px 0 0; + position: relative; + + border: 1px solid #aaa; + cursor: text; + overflow: hidden; + + background-color: #fff; + background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(1%, #eee), color-stop(15%, #fff)); + background-image: -webkit-linear-gradient(top, #eee 1%, #fff 15%); + background-image: -moz-linear-gradient(top, #eee 1%, #fff 15%); + background-image: linear-gradient(to bottom, #eee 1%, #fff 15%); +} + +html[dir="rtl"] .select2-container-multi .select2-choices { + padding: 0 0 0 5px; +} + +.select2-locked { + padding: 3px 5px 3px 5px !important; +} + +.select2-container-multi .select2-choices { + min-height: 26px; +} + +.select2-container-multi.select2-container-active .select2-choices { + border: 1px solid #5897fb; + outline: none; + + -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, .3); + box-shadow: 0 0 5px rgba(0, 0, 0, .3); +} +.select2-container-multi .select2-choices li { + float: left; + list-style: none; +} +html[dir="rtl"] .select2-container-multi .select2-choices li +{ + float: right; +} +.select2-container-multi .select2-choices .select2-search-field { + margin: 0; + padding: 0; + white-space: nowrap; +} + +.select2-container-multi .select2-choices .select2-search-field input { + padding: 5px; + margin: 1px 0; + + font-family: sans-serif; + font-size: 100%; + color: #666; + outline: 0; + border: 0; + -webkit-box-shadow: none; + box-shadow: none; + background: transparent !important; +} + +.select2-container-multi .select2-choices .select2-search-field input.select2-active { + background: #fff url('select2-spinner.gif') no-repeat 100% !important; +} + +.select2-default { + color: #999 !important; +} + +.select2-container-multi .select2-choices .select2-search-choice { + padding: 3px 5px 3px 18px; + margin: 3px 0 3px 5px; + position: relative; + + line-height: 13px; + color: #333; + cursor: default; + border: 1px solid #aaaaaa; + + border-radius: 3px; + + -webkit-box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(0, 0, 0, 0.05); + box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(0, 0, 0, 0.05); + + background-clip: padding-box; + + -webkit-touch-callout: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + + background-color: #e4e4e4; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#f4f4f4', GradientType=0); + background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eee)); + background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%); + background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%); + background-image: linear-gradient(to bottom, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%); +} +html[dir="rtl"] .select2-container-multi .select2-choices .select2-search-choice +{ + margin: 3px 5px 3px 0; + padding: 3px 18px 3px 5px; +} +.select2-container-multi .select2-choices .select2-search-choice .select2-chosen { + cursor: default; +} +.select2-container-multi .select2-choices .select2-search-choice-focus { + background: #d4d4d4; +} + +.select2-search-choice-close { + display: block; + width: 12px; + height: 13px; + position: absolute; + right: 3px; + top: 4px; + + font-size: 1px; + outline: none; + background: url('select2.png') right top no-repeat; +} +html[dir="rtl"] .select2-search-choice-close { + right: auto; + left: 3px; +} + +.select2-container-multi .select2-search-choice-close { + left: 3px; +} + +html[dir="rtl"] .select2-container-multi .select2-search-choice-close { + left: auto; + right: 2px; +} + +.select2-container-multi .select2-choices .select2-search-choice .select2-search-choice-close:hover { + background-position: right -11px; +} +.select2-container-multi .select2-choices .select2-search-choice-focus .select2-search-choice-close { + background-position: right -11px; +} + +/* disabled styles */ +.select2-container-multi.select2-container-disabled .select2-choices { + background-color: #f4f4f4; + background-image: none; + border: 1px solid #ddd; + cursor: default; +} + +.select2-container-multi.select2-container-disabled .select2-choices .select2-search-choice { + padding: 3px 5px 3px 5px; + border: 1px solid #ddd; + background-image: none; + background-color: #f4f4f4; +} + +.select2-container-multi.select2-container-disabled .select2-choices .select2-search-choice .select2-search-choice-close { display: none; + background: none; +} +/* end multiselect */ + + +.select2-result-selectable .select2-match, +.select2-result-unselectable .select2-match { + text-decoration: underline; +} + +.select2-offscreen, .select2-offscreen:focus { + clip: rect(0 0 0 0) !important; + width: 1px !important; + height: 1px !important; + border: 0 !important; + margin: 0 !important; + padding: 0 !important; + overflow: hidden !important; + position: absolute !important; + outline: 0 !important; + left: 0px !important; + top: 0px !important; +} + +.select2-display-none { + display: none; +} + +.select2-measure-scrollbar { + position: absolute; + top: -10000px; + left: -10000px; + width: 100px; + height: 100px; + overflow: scroll; +} + +/* Retina-ize icons */ + +@media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-resolution: 2dppx) { + .select2-search input, + .select2-search-choice-close, + .select2-container .select2-choice abbr, + .select2-container .select2-choice .select2-arrow b { + background-image: url('select2x2.png') !important; + background-repeat: no-repeat !important; + background-size: 60px 40px !important; + } + + .select2-search input { + background-position: 100% -21px !important; + } +} diff --git a/public/vendor/select2/select2.min.js b/public/vendor/select2/select2.min.js new file mode 100755 index 00000000..b56419e2 --- /dev/null +++ b/public/vendor/select2/select2.min.js @@ -0,0 +1,23 @@ +/* +Copyright 2014 Igor Vaynberg + +Version: 3.5.2 Timestamp: Sat Nov 1 14:43:36 EDT 2014 + +This software is licensed under the Apache License, Version 2.0 (the "Apache License") or the GNU +General Public License version 2 (the "GPL License"). You may choose either license to govern your +use of this software only upon the condition that you accept all of the terms of either the Apache +License or the GPL License. + +You may obtain a copy of the Apache License and the GPL License at: + +http://www.apache.org/licenses/LICENSE-2.0 +http://www.gnu.org/licenses/gpl-2.0.html + +Unless required by applicable law or agreed to in writing, software distributed under the Apache License +or the GPL Licesnse is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +either express or implied. See the Apache License and the GPL License for the specific language governing +permissions and limitations under the Apache License and the GPL License. +*/ +!function(a){"undefined"==typeof a.fn.each2&&a.extend(a.fn,{each2:function(b){for(var c=a([0]),d=-1,e=this.length;++d<e&&(c.context=c[0]=this[d])&&b.call(c[0],d,c)!==!1;);return this}})}(jQuery),function(a,b){"use strict";function n(b){var c=a(document.createTextNode(""));b.before(c),c.before(b),c.remove()}function o(a){function b(a){return m[a]||a}return a.replace(/[^\u0000-\u007E]/g,b)}function p(a,b){for(var c=0,d=b.length;d>c;c+=1)if(r(a,b[c]))return c;return-1}function q(){var b=a(l);b.appendTo(document.body);var c={width:b.width()-b[0].clientWidth,height:b.height()-b[0].clientHeight};return b.remove(),c}function r(a,c){return a===c?!0:a===b||c===b?!1:null===a||null===c?!1:a.constructor===String?a+""==c+"":c.constructor===String?c+""==a+"":!1}function s(a,b,c){var d,e,f;if(null===a||a.length<1)return[];for(d=a.split(b),e=0,f=d.length;f>e;e+=1)d[e]=c(d[e]);return d}function t(a){return a.outerWidth(!1)-a.width()}function u(c){var d="keyup-change-value";c.on("keydown",function(){a.data(c,d)===b&&a.data(c,d,c.val())}),c.on("keyup",function(){var e=a.data(c,d);e!==b&&c.val()!==e&&(a.removeData(c,d),c.trigger("keyup-change"))})}function v(c){c.on("mousemove",function(c){var d=h;(d===b||d.x!==c.pageX||d.y!==c.pageY)&&a(c.target).trigger("mousemove-filtered",c)})}function w(a,c,d){d=d||b;var e;return function(){var b=arguments;window.clearTimeout(e),e=window.setTimeout(function(){c.apply(d,b)},a)}}function x(a,b){var c=w(a,function(a){b.trigger("scroll-debounced",a)});b.on("scroll",function(a){p(a.target,b.get())>=0&&c(a)})}function y(a){a[0]!==document.activeElement&&window.setTimeout(function(){var d,b=a[0],c=a.val().length;a.focus();var e=b.offsetWidth>0||b.offsetHeight>0;e&&b===document.activeElement&&(b.setSelectionRange?b.setSelectionRange(c,c):b.createTextRange&&(d=b.createTextRange(),d.collapse(!1),d.select()))},0)}function z(b){b=a(b)[0];var c=0,d=0;if("selectionStart"in b)c=b.selectionStart,d=b.selectionEnd-c;else if("selection"in document){b.focus();var e=document.selection.createRange();d=document.selection.createRange().text.length,e.moveStart("character",-b.value.length),c=e.text.length-d}return{offset:c,length:d}}function A(a){a.preventDefault(),a.stopPropagation()}function B(a){a.preventDefault(),a.stopImmediatePropagation()}function C(b){if(!g){var c=b[0].currentStyle||window.getComputedStyle(b[0],null);g=a(document.createElement("div")).css({position:"absolute",left:"-10000px",top:"-10000px",display:"none",fontSize:c.fontSize,fontFamily:c.fontFamily,fontStyle:c.fontStyle,fontWeight:c.fontWeight,letterSpacing:c.letterSpacing,textTransform:c.textTransform,whiteSpace:"nowrap"}),g.attr("class","select2-sizer"),a(document.body).append(g)}return g.text(b.val()),g.width()}function D(b,c,d){var e,g,f=[];e=a.trim(b.attr("class")),e&&(e=""+e,a(e.split(/\s+/)).each2(function(){0===this.indexOf("select2-")&&f.push(this)})),e=a.trim(c.attr("class")),e&&(e=""+e,a(e.split(/\s+/)).each2(function(){0!==this.indexOf("select2-")&&(g=d(this),g&&f.push(g))})),b.attr("class",f.join(" "))}function E(a,b,c,d){var e=o(a.toUpperCase()).indexOf(o(b.toUpperCase())),f=b.length;return 0>e?(c.push(d(a)),void 0):(c.push(d(a.substring(0,e))),c.push("<span class='select2-match'>"),c.push(d(a.substring(e,e+f))),c.push("</span>"),c.push(d(a.substring(e+f,a.length))),void 0)}function F(a){var b={"\\":"\","&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})}function G(c){var d,e=null,f=c.quietMillis||100,g=c.url,h=this;return function(i){window.clearTimeout(d),d=window.setTimeout(function(){var d=c.data,f=g,j=c.transport||a.fn.select2.ajaxDefaults.transport,k={type:c.type||"GET",cache:c.cache||!1,jsonpCallback:c.jsonpCallback||b,dataType:c.dataType||"json"},l=a.extend({},a.fn.select2.ajaxDefaults.params,k);d=d?d.call(h,i.term,i.page,i.context):null,f="function"==typeof f?f.call(h,i.term,i.page,i.context):f,e&&"function"==typeof e.abort&&e.abort(),c.params&&(a.isFunction(c.params)?a.extend(l,c.params.call(h)):a.extend(l,c.params)),a.extend(l,{url:f,dataType:c.dataType,data:d,success:function(a){var b=c.results(a,i.page,i);i.callback(b)},error:function(a,b,c){var d={hasError:!0,jqXHR:a,textStatus:b,errorThrown:c};i.callback(d)}}),e=j.call(h,l)},f)}}function H(b){var d,e,c=b,f=function(a){return""+a.text};a.isArray(c)&&(e=c,c={results:e}),a.isFunction(c)===!1&&(e=c,c=function(){return e});var g=c();return g.text&&(f=g.text,a.isFunction(f)||(d=g.text,f=function(a){return a[d]})),function(b){var g,d=b.term,e={results:[]};return""===d?(b.callback(c()),void 0):(g=function(c,e){var h,i;if(c=c[0],c.children){h={};for(i in c)c.hasOwnProperty(i)&&(h[i]=c[i]);h.children=[],a(c.children).each2(function(a,b){g(b,h.children)}),(h.children.length||b.matcher(d,f(h),c))&&e.push(h)}else b.matcher(d,f(c),c)&&e.push(c)},a(c().results).each2(function(a,b){g(b,e.results)}),b.callback(e),void 0)}}function I(c){var d=a.isFunction(c);return function(e){var f=e.term,g={results:[]},h=d?c(e):c;a.isArray(h)&&(a(h).each(function(){var a=this.text!==b,c=a?this.text:this;(""===f||e.matcher(f,c))&&g.results.push(a?this:{id:this,text:this})}),e.callback(g))}}function J(b,c){if(a.isFunction(b))return!0;if(!b)return!1;if("string"==typeof b)return!0;throw new Error(c+" must be a string, function, or falsy value")}function K(b,c){if(a.isFunction(b)){var d=Array.prototype.slice.call(arguments,2);return b.apply(c,d)}return b}function L(b){var c=0;return a.each(b,function(a,b){b.children?c+=L(b.children):c++}),c}function M(a,c,d,e){var h,i,j,k,l,f=a,g=!1;if(!e.createSearchChoice||!e.tokenSeparators||e.tokenSeparators.length<1)return b;for(;;){for(i=-1,j=0,k=e.tokenSeparators.length;k>j&&(l=e.tokenSeparators[j],i=a.indexOf(l),!(i>=0));j++);if(0>i)break;if(h=a.substring(0,i),a=a.substring(i+l.length),h.length>0&&(h=e.createSearchChoice.call(this,h,c),h!==b&&null!==h&&e.id(h)!==b&&null!==e.id(h))){for(g=!1,j=0,k=c.length;k>j;j++)if(r(e.id(h),e.id(c[j]))){g=!0;break}g||d(h)}}return f!==a?a:void 0}function N(){var b=this;a.each(arguments,function(a,c){b[c].remove(),b[c]=null})}function O(b,c){var d=function(){};return d.prototype=new b,d.prototype.constructor=d,d.prototype.parent=b.prototype,d.prototype=a.extend(d.prototype,c),d}if(window.Select2===b){var c,d,e,f,g,i,j,h={x:0,y:0},k={TAB:9,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,SHIFT:16,CTRL:17,ALT:18,PAGE_UP:33,PAGE_DOWN:34,HOME:36,END:35,BACKSPACE:8,DELETE:46,isArrow:function(a){switch(a=a.which?a.which:a){case k.LEFT:case k.RIGHT:case k.UP:case k.DOWN:return!0}return!1},isControl:function(a){var b=a.which;switch(b){case k.SHIFT:case k.CTRL:case k.ALT:return!0}return a.metaKey?!0:!1},isFunctionKey:function(a){return a=a.which?a.which:a,a>=112&&123>=a}},l="<div class='select2-measure-scrollbar'></div>",m={"\u24b6":"A","\uff21":"A","\xc0":"A","\xc1":"A","\xc2":"A","\u1ea6":"A","\u1ea4":"A","\u1eaa":"A","\u1ea8":"A","\xc3":"A","\u0100":"A","\u0102":"A","\u1eb0":"A","\u1eae":"A","\u1eb4":"A","\u1eb2":"A","\u0226":"A","\u01e0":"A","\xc4":"A","\u01de":"A","\u1ea2":"A","\xc5":"A","\u01fa":"A","\u01cd":"A","\u0200":"A","\u0202":"A","\u1ea0":"A","\u1eac":"A","\u1eb6":"A","\u1e00":"A","\u0104":"A","\u023a":"A","\u2c6f":"A","\ua732":"AA","\xc6":"AE","\u01fc":"AE","\u01e2":"AE","\ua734":"AO","\ua736":"AU","\ua738":"AV","\ua73a":"AV","\ua73c":"AY","\u24b7":"B","\uff22":"B","\u1e02":"B","\u1e04":"B","\u1e06":"B","\u0243":"B","\u0182":"B","\u0181":"B","\u24b8":"C","\uff23":"C","\u0106":"C","\u0108":"C","\u010a":"C","\u010c":"C","\xc7":"C","\u1e08":"C","\u0187":"C","\u023b":"C","\ua73e":"C","\u24b9":"D","\uff24":"D","\u1e0a":"D","\u010e":"D","\u1e0c":"D","\u1e10":"D","\u1e12":"D","\u1e0e":"D","\u0110":"D","\u018b":"D","\u018a":"D","\u0189":"D","\ua779":"D","\u01f1":"DZ","\u01c4":"DZ","\u01f2":"Dz","\u01c5":"Dz","\u24ba":"E","\uff25":"E","\xc8":"E","\xc9":"E","\xca":"E","\u1ec0":"E","\u1ebe":"E","\u1ec4":"E","\u1ec2":"E","\u1ebc":"E","\u0112":"E","\u1e14":"E","\u1e16":"E","\u0114":"E","\u0116":"E","\xcb":"E","\u1eba":"E","\u011a":"E","\u0204":"E","\u0206":"E","\u1eb8":"E","\u1ec6":"E","\u0228":"E","\u1e1c":"E","\u0118":"E","\u1e18":"E","\u1e1a":"E","\u0190":"E","\u018e":"E","\u24bb":"F","\uff26":"F","\u1e1e":"F","\u0191":"F","\ua77b":"F","\u24bc":"G","\uff27":"G","\u01f4":"G","\u011c":"G","\u1e20":"G","\u011e":"G","\u0120":"G","\u01e6":"G","\u0122":"G","\u01e4":"G","\u0193":"G","\ua7a0":"G","\ua77d":"G","\ua77e":"G","\u24bd":"H","\uff28":"H","\u0124":"H","\u1e22":"H","\u1e26":"H","\u021e":"H","\u1e24":"H","\u1e28":"H","\u1e2a":"H","\u0126":"H","\u2c67":"H","\u2c75":"H","\ua78d":"H","\u24be":"I","\uff29":"I","\xcc":"I","\xcd":"I","\xce":"I","\u0128":"I","\u012a":"I","\u012c":"I","\u0130":"I","\xcf":"I","\u1e2e":"I","\u1ec8":"I","\u01cf":"I","\u0208":"I","\u020a":"I","\u1eca":"I","\u012e":"I","\u1e2c":"I","\u0197":"I","\u24bf":"J","\uff2a":"J","\u0134":"J","\u0248":"J","\u24c0":"K","\uff2b":"K","\u1e30":"K","\u01e8":"K","\u1e32":"K","\u0136":"K","\u1e34":"K","\u0198":"K","\u2c69":"K","\ua740":"K","\ua742":"K","\ua744":"K","\ua7a2":"K","\u24c1":"L","\uff2c":"L","\u013f":"L","\u0139":"L","\u013d":"L","\u1e36":"L","\u1e38":"L","\u013b":"L","\u1e3c":"L","\u1e3a":"L","\u0141":"L","\u023d":"L","\u2c62":"L","\u2c60":"L","\ua748":"L","\ua746":"L","\ua780":"L","\u01c7":"LJ","\u01c8":"Lj","\u24c2":"M","\uff2d":"M","\u1e3e":"M","\u1e40":"M","\u1e42":"M","\u2c6e":"M","\u019c":"M","\u24c3":"N","\uff2e":"N","\u01f8":"N","\u0143":"N","\xd1":"N","\u1e44":"N","\u0147":"N","\u1e46":"N","\u0145":"N","\u1e4a":"N","\u1e48":"N","\u0220":"N","\u019d":"N","\ua790":"N","\ua7a4":"N","\u01ca":"NJ","\u01cb":"Nj","\u24c4":"O","\uff2f":"O","\xd2":"O","\xd3":"O","\xd4":"O","\u1ed2":"O","\u1ed0":"O","\u1ed6":"O","\u1ed4":"O","\xd5":"O","\u1e4c":"O","\u022c":"O","\u1e4e":"O","\u014c":"O","\u1e50":"O","\u1e52":"O","\u014e":"O","\u022e":"O","\u0230":"O","\xd6":"O","\u022a":"O","\u1ece":"O","\u0150":"O","\u01d1":"O","\u020c":"O","\u020e":"O","\u01a0":"O","\u1edc":"O","\u1eda":"O","\u1ee0":"O","\u1ede":"O","\u1ee2":"O","\u1ecc":"O","\u1ed8":"O","\u01ea":"O","\u01ec":"O","\xd8":"O","\u01fe":"O","\u0186":"O","\u019f":"O","\ua74a":"O","\ua74c":"O","\u01a2":"OI","\ua74e":"OO","\u0222":"OU","\u24c5":"P","\uff30":"P","\u1e54":"P","\u1e56":"P","\u01a4":"P","\u2c63":"P","\ua750":"P","\ua752":"P","\ua754":"P","\u24c6":"Q","\uff31":"Q","\ua756":"Q","\ua758":"Q","\u024a":"Q","\u24c7":"R","\uff32":"R","\u0154":"R","\u1e58":"R","\u0158":"R","\u0210":"R","\u0212":"R","\u1e5a":"R","\u1e5c":"R","\u0156":"R","\u1e5e":"R","\u024c":"R","\u2c64":"R","\ua75a":"R","\ua7a6":"R","\ua782":"R","\u24c8":"S","\uff33":"S","\u1e9e":"S","\u015a":"S","\u1e64":"S","\u015c":"S","\u1e60":"S","\u0160":"S","\u1e66":"S","\u1e62":"S","\u1e68":"S","\u0218":"S","\u015e":"S","\u2c7e":"S","\ua7a8":"S","\ua784":"S","\u24c9":"T","\uff34":"T","\u1e6a":"T","\u0164":"T","\u1e6c":"T","\u021a":"T","\u0162":"T","\u1e70":"T","\u1e6e":"T","\u0166":"T","\u01ac":"T","\u01ae":"T","\u023e":"T","\ua786":"T","\ua728":"TZ","\u24ca":"U","\uff35":"U","\xd9":"U","\xda":"U","\xdb":"U","\u0168":"U","\u1e78":"U","\u016a":"U","\u1e7a":"U","\u016c":"U","\xdc":"U","\u01db":"U","\u01d7":"U","\u01d5":"U","\u01d9":"U","\u1ee6":"U","\u016e":"U","\u0170":"U","\u01d3":"U","\u0214":"U","\u0216":"U","\u01af":"U","\u1eea":"U","\u1ee8":"U","\u1eee":"U","\u1eec":"U","\u1ef0":"U","\u1ee4":"U","\u1e72":"U","\u0172":"U","\u1e76":"U","\u1e74":"U","\u0244":"U","\u24cb":"V","\uff36":"V","\u1e7c":"V","\u1e7e":"V","\u01b2":"V","\ua75e":"V","\u0245":"V","\ua760":"VY","\u24cc":"W","\uff37":"W","\u1e80":"W","\u1e82":"W","\u0174":"W","\u1e86":"W","\u1e84":"W","\u1e88":"W","\u2c72":"W","\u24cd":"X","\uff38":"X","\u1e8a":"X","\u1e8c":"X","\u24ce":"Y","\uff39":"Y","\u1ef2":"Y","\xdd":"Y","\u0176":"Y","\u1ef8":"Y","\u0232":"Y","\u1e8e":"Y","\u0178":"Y","\u1ef6":"Y","\u1ef4":"Y","\u01b3":"Y","\u024e":"Y","\u1efe":"Y","\u24cf":"Z","\uff3a":"Z","\u0179":"Z","\u1e90":"Z","\u017b":"Z","\u017d":"Z","\u1e92":"Z","\u1e94":"Z","\u01b5":"Z","\u0224":"Z","\u2c7f":"Z","\u2c6b":"Z","\ua762":"Z","\u24d0":"a","\uff41":"a","\u1e9a":"a","\xe0":"a","\xe1":"a","\xe2":"a","\u1ea7":"a","\u1ea5":"a","\u1eab":"a","\u1ea9":"a","\xe3":"a","\u0101":"a","\u0103":"a","\u1eb1":"a","\u1eaf":"a","\u1eb5":"a","\u1eb3":"a","\u0227":"a","\u01e1":"a","\xe4":"a","\u01df":"a","\u1ea3":"a","\xe5":"a","\u01fb":"a","\u01ce":"a","\u0201":"a","\u0203":"a","\u1ea1":"a","\u1ead":"a","\u1eb7":"a","\u1e01":"a","\u0105":"a","\u2c65":"a","\u0250":"a","\ua733":"aa","\xe6":"ae","\u01fd":"ae","\u01e3":"ae","\ua735":"ao","\ua737":"au","\ua739":"av","\ua73b":"av","\ua73d":"ay","\u24d1":"b","\uff42":"b","\u1e03":"b","\u1e05":"b","\u1e07":"b","\u0180":"b","\u0183":"b","\u0253":"b","\u24d2":"c","\uff43":"c","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\xe7":"c","\u1e09":"c","\u0188":"c","\u023c":"c","\ua73f":"c","\u2184":"c","\u24d3":"d","\uff44":"d","\u1e0b":"d","\u010f":"d","\u1e0d":"d","\u1e11":"d","\u1e13":"d","\u1e0f":"d","\u0111":"d","\u018c":"d","\u0256":"d","\u0257":"d","\ua77a":"d","\u01f3":"dz","\u01c6":"dz","\u24d4":"e","\uff45":"e","\xe8":"e","\xe9":"e","\xea":"e","\u1ec1":"e","\u1ebf":"e","\u1ec5":"e","\u1ec3":"e","\u1ebd":"e","\u0113":"e","\u1e15":"e","\u1e17":"e","\u0115":"e","\u0117":"e","\xeb":"e","\u1ebb":"e","\u011b":"e","\u0205":"e","\u0207":"e","\u1eb9":"e","\u1ec7":"e","\u0229":"e","\u1e1d":"e","\u0119":"e","\u1e19":"e","\u1e1b":"e","\u0247":"e","\u025b":"e","\u01dd":"e","\u24d5":"f","\uff46":"f","\u1e1f":"f","\u0192":"f","\ua77c":"f","\u24d6":"g","\uff47":"g","\u01f5":"g","\u011d":"g","\u1e21":"g","\u011f":"g","\u0121":"g","\u01e7":"g","\u0123":"g","\u01e5":"g","\u0260":"g","\ua7a1":"g","\u1d79":"g","\ua77f":"g","\u24d7":"h","\uff48":"h","\u0125":"h","\u1e23":"h","\u1e27":"h","\u021f":"h","\u1e25":"h","\u1e29":"h","\u1e2b":"h","\u1e96":"h","\u0127":"h","\u2c68":"h","\u2c76":"h","\u0265":"h","\u0195":"hv","\u24d8":"i","\uff49":"i","\xec":"i","\xed":"i","\xee":"i","\u0129":"i","\u012b":"i","\u012d":"i","\xef":"i","\u1e2f":"i","\u1ec9":"i","\u01d0":"i","\u0209":"i","\u020b":"i","\u1ecb":"i","\u012f":"i","\u1e2d":"i","\u0268":"i","\u0131":"i","\u24d9":"j","\uff4a":"j","\u0135":"j","\u01f0":"j","\u0249":"j","\u24da":"k","\uff4b":"k","\u1e31":"k","\u01e9":"k","\u1e33":"k","\u0137":"k","\u1e35":"k","\u0199":"k","\u2c6a":"k","\ua741":"k","\ua743":"k","\ua745":"k","\ua7a3":"k","\u24db":"l","\uff4c":"l","\u0140":"l","\u013a":"l","\u013e":"l","\u1e37":"l","\u1e39":"l","\u013c":"l","\u1e3d":"l","\u1e3b":"l","\u017f":"l","\u0142":"l","\u019a":"l","\u026b":"l","\u2c61":"l","\ua749":"l","\ua781":"l","\ua747":"l","\u01c9":"lj","\u24dc":"m","\uff4d":"m","\u1e3f":"m","\u1e41":"m","\u1e43":"m","\u0271":"m","\u026f":"m","\u24dd":"n","\uff4e":"n","\u01f9":"n","\u0144":"n","\xf1":"n","\u1e45":"n","\u0148":"n","\u1e47":"n","\u0146":"n","\u1e4b":"n","\u1e49":"n","\u019e":"n","\u0272":"n","\u0149":"n","\ua791":"n","\ua7a5":"n","\u01cc":"nj","\u24de":"o","\uff4f":"o","\xf2":"o","\xf3":"o","\xf4":"o","\u1ed3":"o","\u1ed1":"o","\u1ed7":"o","\u1ed5":"o","\xf5":"o","\u1e4d":"o","\u022d":"o","\u1e4f":"o","\u014d":"o","\u1e51":"o","\u1e53":"o","\u014f":"o","\u022f":"o","\u0231":"o","\xf6":"o","\u022b":"o","\u1ecf":"o","\u0151":"o","\u01d2":"o","\u020d":"o","\u020f":"o","\u01a1":"o","\u1edd":"o","\u1edb":"o","\u1ee1":"o","\u1edf":"o","\u1ee3":"o","\u1ecd":"o","\u1ed9":"o","\u01eb":"o","\u01ed":"o","\xf8":"o","\u01ff":"o","\u0254":"o","\ua74b":"o","\ua74d":"o","\u0275":"o","\u01a3":"oi","\u0223":"ou","\ua74f":"oo","\u24df":"p","\uff50":"p","\u1e55":"p","\u1e57":"p","\u01a5":"p","\u1d7d":"p","\ua751":"p","\ua753":"p","\ua755":"p","\u24e0":"q","\uff51":"q","\u024b":"q","\ua757":"q","\ua759":"q","\u24e1":"r","\uff52":"r","\u0155":"r","\u1e59":"r","\u0159":"r","\u0211":"r","\u0213":"r","\u1e5b":"r","\u1e5d":"r","\u0157":"r","\u1e5f":"r","\u024d":"r","\u027d":"r","\ua75b":"r","\ua7a7":"r","\ua783":"r","\u24e2":"s","\uff53":"s","\xdf":"s","\u015b":"s","\u1e65":"s","\u015d":"s","\u1e61":"s","\u0161":"s","\u1e67":"s","\u1e63":"s","\u1e69":"s","\u0219":"s","\u015f":"s","\u023f":"s","\ua7a9":"s","\ua785":"s","\u1e9b":"s","\u24e3":"t","\uff54":"t","\u1e6b":"t","\u1e97":"t","\u0165":"t","\u1e6d":"t","\u021b":"t","\u0163":"t","\u1e71":"t","\u1e6f":"t","\u0167":"t","\u01ad":"t","\u0288":"t","\u2c66":"t","\ua787":"t","\ua729":"tz","\u24e4":"u","\uff55":"u","\xf9":"u","\xfa":"u","\xfb":"u","\u0169":"u","\u1e79":"u","\u016b":"u","\u1e7b":"u","\u016d":"u","\xfc":"u","\u01dc":"u","\u01d8":"u","\u01d6":"u","\u01da":"u","\u1ee7":"u","\u016f":"u","\u0171":"u","\u01d4":"u","\u0215":"u","\u0217":"u","\u01b0":"u","\u1eeb":"u","\u1ee9":"u","\u1eef":"u","\u1eed":"u","\u1ef1":"u","\u1ee5":"u","\u1e73":"u","\u0173":"u","\u1e77":"u","\u1e75":"u","\u0289":"u","\u24e5":"v","\uff56":"v","\u1e7d":"v","\u1e7f":"v","\u028b":"v","\ua75f":"v","\u028c":"v","\ua761":"vy","\u24e6":"w","\uff57":"w","\u1e81":"w","\u1e83":"w","\u0175":"w","\u1e87":"w","\u1e85":"w","\u1e98":"w","\u1e89":"w","\u2c73":"w","\u24e7":"x","\uff58":"x","\u1e8b":"x","\u1e8d":"x","\u24e8":"y","\uff59":"y","\u1ef3":"y","\xfd":"y","\u0177":"y","\u1ef9":"y","\u0233":"y","\u1e8f":"y","\xff":"y","\u1ef7":"y","\u1e99":"y","\u1ef5":"y","\u01b4":"y","\u024f":"y","\u1eff":"y","\u24e9":"z","\uff5a":"z","\u017a":"z","\u1e91":"z","\u017c":"z","\u017e":"z","\u1e93":"z","\u1e95":"z","\u01b6":"z","\u0225":"z","\u0240":"z","\u2c6c":"z","\ua763":"z","\u0386":"\u0391","\u0388":"\u0395","\u0389":"\u0397","\u038a":"\u0399","\u03aa":"\u0399","\u038c":"\u039f","\u038e":"\u03a5","\u03ab":"\u03a5","\u038f":"\u03a9","\u03ac":"\u03b1","\u03ad":"\u03b5","\u03ae":"\u03b7","\u03af":"\u03b9","\u03ca":"\u03b9","\u0390":"\u03b9","\u03cc":"\u03bf","\u03cd":"\u03c5","\u03cb":"\u03c5","\u03b0":"\u03c5","\u03c9":"\u03c9","\u03c2":"\u03c3"};i=a(document),f=function(){var a=1;return function(){return a++}}(),c=O(Object,{bind:function(a){var b=this;return function(){a.apply(b,arguments)}},init:function(c){var d,e,g=".select2-results";this.opts=c=this.prepareOpts(c),this.id=c.id,c.element.data("select2")!==b&&null!==c.element.data("select2")&&c.element.data("select2").destroy(),this.container=this.createContainer(),this.liveRegion=a(".select2-hidden-accessible"),0==this.liveRegion.length&&(this.liveRegion=a("<span>",{role:"status","aria-live":"polite"}).addClass("select2-hidden-accessible").appendTo(document.body)),this.containerId="s2id_"+(c.element.attr("id")||"autogen"+f()),this.containerEventName=this.containerId.replace(/([.])/g,"_").replace(/([;&,\-\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g,"\\$1"),this.container.attr("id",this.containerId),this.container.attr("title",c.element.attr("title")),this.body=a(document.body),D(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.attr("style",c.element.attr("style")),this.container.css(K(c.containerCss,this.opts.element)),this.container.addClass(K(c.containerCssClass,this.opts.element)),this.elementTabIndex=this.opts.element.attr("tabindex"),this.opts.element.data("select2",this).attr("tabindex","-1").before(this.container).on("click.select2",A),this.container.data("select2",this),this.dropdown=this.container.find(".select2-drop"),D(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(K(c.dropdownCssClass,this.opts.element)),this.dropdown.data("select2",this),this.dropdown.on("click",A),this.results=d=this.container.find(g),this.search=e=this.container.find("input.select2-input"),this.queryCount=0,this.resultsPage=0,this.context=null,this.initContainer(),this.container.on("click",A),v(this.results),this.dropdown.on("mousemove-filtered",g,this.bind(this.highlightUnderEvent)),this.dropdown.on("touchstart touchmove touchend",g,this.bind(function(a){this._touchEvent=!0,this.highlightUnderEvent(a)})),this.dropdown.on("touchmove",g,this.bind(this.touchMoved)),this.dropdown.on("touchstart touchend",g,this.bind(this.clearTouchMoved)),this.dropdown.on("click",this.bind(function(){this._touchEvent&&(this._touchEvent=!1,this.selectHighlighted())})),x(80,this.results),this.dropdown.on("scroll-debounced",g,this.bind(this.loadMoreIfNeeded)),a(this.container).on("change",".select2-input",function(a){a.stopPropagation()}),a(this.dropdown).on("change",".select2-input",function(a){a.stopPropagation()}),a.fn.mousewheel&&d.mousewheel(function(a,b,c,e){var f=d.scrollTop();e>0&&0>=f-e?(d.scrollTop(0),A(a)):0>e&&d.get(0).scrollHeight-d.scrollTop()+e<=d.height()&&(d.scrollTop(d.get(0).scrollHeight-d.height()),A(a))}),u(e),e.on("keyup-change input paste",this.bind(this.updateResults)),e.on("focus",function(){e.addClass("select2-focused")}),e.on("blur",function(){e.removeClass("select2-focused")}),this.dropdown.on("mouseup",g,this.bind(function(b){a(b.target).closest(".select2-result-selectable").length>0&&(this.highlightUnderEvent(b),this.selectHighlighted(b))})),this.dropdown.on("click mouseup mousedown touchstart touchend focusin",function(a){a.stopPropagation()}),this.nextSearchTerm=b,a.isFunction(this.opts.initSelection)&&(this.initSelection(),this.monitorSource()),null!==c.maximumInputLength&&this.search.attr("maxlength",c.maximumInputLength);var h=c.element.prop("disabled");h===b&&(h=!1),this.enable(!h);var i=c.element.prop("readonly");i===b&&(i=!1),this.readonly(i),j=j||q(),this.autofocus=c.element.prop("autofocus"),c.element.prop("autofocus",!1),this.autofocus&&this.focus(),this.search.attr("placeholder",c.searchInputPlaceholder)},destroy:function(){var a=this.opts.element,c=a.data("select2"),d=this;this.close(),a.length&&a[0].detachEvent&&d._sync&&a.each(function(){d._sync&&this.detachEvent("onpropertychange",d._sync)}),this.propertyObserver&&(this.propertyObserver.disconnect(),this.propertyObserver=null),this._sync=null,c!==b&&(c.container.remove(),c.liveRegion.remove(),c.dropdown.remove(),a.show().removeData("select2").off(".select2").prop("autofocus",this.autofocus||!1),this.elementTabIndex?a.attr({tabindex:this.elementTabIndex}):a.removeAttr("tabindex"),a.show()),N.call(this,"container","liveRegion","dropdown","results","search")},optionToData:function(a){return a.is("option")?{id:a.prop("value"),text:a.text(),element:a.get(),css:a.attr("class"),disabled:a.prop("disabled"),locked:r(a.attr("locked"),"locked")||r(a.data("locked"),!0)}:a.is("optgroup")?{text:a.attr("label"),children:[],element:a.get(),css:a.attr("class")}:void 0},prepareOpts:function(c){var d,e,g,h,i=this;if(d=c.element,"select"===d.get(0).tagName.toLowerCase()&&(this.select=e=c.element),e&&a.each(["id","multiple","ajax","query","createSearchChoice","initSelection","data","tags"],function(){if(this in c)throw new Error("Option '"+this+"' is not allowed for Select2 when attached to a <select> element.")}),c=a.extend({},{populateResults:function(d,e,g){var h,j=this.opts.id,k=this.liveRegion;h=function(d,e,l){var m,n,o,p,q,r,s,t,u,v;d=c.sortResults(d,e,g);var w=[];for(m=0,n=d.length;n>m;m+=1)o=d[m],q=o.disabled===!0,p=!q&&j(o)!==b,r=o.children&&o.children.length>0,s=a("<li></li>"),s.addClass("select2-results-dept-"+l),s.addClass("select2-result"),s.addClass(p?"select2-result-selectable":"select2-result-unselectable"),q&&s.addClass("select2-disabled"),r&&s.addClass("select2-result-with-children"),s.addClass(i.opts.formatResultCssClass(o)),s.attr("role","presentation"),t=a(document.createElement("div")),t.addClass("select2-result-label"),t.attr("id","select2-result-label-"+f()),t.attr("role","option"),v=c.formatResult(o,t,g,i.opts.escapeMarkup),v!==b&&(t.html(v),s.append(t)),r&&(u=a("<ul></ul>"),u.addClass("select2-result-sub"),h(o.children,u,l+1),s.append(u)),s.data("select2-data",o),w.push(s[0]);e.append(w),k.text(c.formatMatches(d.length))},h(e,d,0)}},a.fn.select2.defaults,c),"function"!=typeof c.id&&(g=c.id,c.id=function(a){return a[g]}),a.isArray(c.element.data("select2Tags"))){if("tags"in c)throw"tags specified as both an attribute 'data-select2-tags' and in options of Select2 "+c.element.attr("id");c.tags=c.element.data("select2Tags")}if(e?(c.query=this.bind(function(a){var f,g,h,c={results:[],more:!1},e=a.term;h=function(b,c){var d;b.is("option")?a.matcher(e,b.text(),b)&&c.push(i.optionToData(b)):b.is("optgroup")&&(d=i.optionToData(b),b.children().each2(function(a,b){h(b,d.children)}),d.children.length>0&&c.push(d))},f=d.children(),this.getPlaceholder()!==b&&f.length>0&&(g=this.getPlaceholderOption(),g&&(f=f.not(g))),f.each2(function(a,b){h(b,c.results)}),a.callback(c)}),c.id=function(a){return a.id}):"query"in c||("ajax"in c?(h=c.element.data("ajax-url"),h&&h.length>0&&(c.ajax.url=h),c.query=G.call(c.element,c.ajax)):"data"in c?c.query=H(c.data):"tags"in c&&(c.query=I(c.tags),c.createSearchChoice===b&&(c.createSearchChoice=function(b){return{id:a.trim(b),text:a.trim(b)}}),c.initSelection===b&&(c.initSelection=function(b,d){var e=[];a(s(b.val(),c.separator,c.transformVal)).each(function(){var b={id:this,text:this},d=c.tags;a.isFunction(d)&&(d=d()),a(d).each(function(){return r(this.id,b.id)?(b=this,!1):void 0}),e.push(b)}),d(e)}))),"function"!=typeof c.query)throw"query function not defined for Select2 "+c.element.attr("id");if("top"===c.createSearchChoicePosition)c.createSearchChoicePosition=function(a,b){a.unshift(b)};else if("bottom"===c.createSearchChoicePosition)c.createSearchChoicePosition=function(a,b){a.push(b)};else if("function"!=typeof c.createSearchChoicePosition)throw"invalid createSearchChoicePosition option must be 'top', 'bottom' or a custom function";return c},monitorSource:function(){var d,c=this.opts.element,e=this;c.on("change.select2",this.bind(function(){this.opts.element.data("select2-change-triggered")!==!0&&this.initSelection()})),this._sync=this.bind(function(){var a=c.prop("disabled");a===b&&(a=!1),this.enable(!a);var d=c.prop("readonly");d===b&&(d=!1),this.readonly(d),this.container&&(D(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.addClass(K(this.opts.containerCssClass,this.opts.element))),this.dropdown&&(D(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(K(this.opts.dropdownCssClass,this.opts.element)))}),c.length&&c[0].attachEvent&&c.each(function(){this.attachEvent("onpropertychange",e._sync)}),d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver,d!==b&&(this.propertyObserver&&(delete this.propertyObserver,this.propertyObserver=null),this.propertyObserver=new d(function(b){a.each(b,e._sync)}),this.propertyObserver.observe(c.get(0),{attributes:!0,subtree:!1}))},triggerSelect:function(b){var c=a.Event("select2-selecting",{val:this.id(b),object:b,choice:b});return this.opts.element.trigger(c),!c.isDefaultPrevented()},triggerChange:function(b){b=b||{},b=a.extend({},b,{type:"change",val:this.val()}),this.opts.element.data("select2-change-triggered",!0),this.opts.element.trigger(b),this.opts.element.data("select2-change-triggered",!1),this.opts.element.click(),this.opts.blurOnChange&&this.opts.element.blur()},isInterfaceEnabled:function(){return this.enabledInterface===!0},enableInterface:function(){var a=this._enabled&&!this._readonly,b=!a;return a===this.enabledInterface?!1:(this.container.toggleClass("select2-container-disabled",b),this.close(),this.enabledInterface=a,!0)},enable:function(a){a===b&&(a=!0),this._enabled!==a&&(this._enabled=a,this.opts.element.prop("disabled",!a),this.enableInterface())},disable:function(){this.enable(!1)},readonly:function(a){a===b&&(a=!1),this._readonly!==a&&(this._readonly=a,this.opts.element.prop("readonly",a),this.enableInterface())},opened:function(){return this.container?this.container.hasClass("select2-dropdown-open"):!1},positionDropdown:function(){var v,w,x,y,z,b=this.dropdown,c=this.container,d=c.offset(),e=c.outerHeight(!1),f=c.outerWidth(!1),g=b.outerHeight(!1),h=a(window),i=h.width(),k=h.height(),l=h.scrollLeft()+i,m=h.scrollTop()+k,n=d.top+e,o=d.left,p=m>=n+g,q=d.top-g>=h.scrollTop(),r=b.outerWidth(!1),s=function(){return l>=o+r},t=function(){return d.left+l+c.outerWidth(!1)>r},u=b.hasClass("select2-drop-above");u?(w=!0,!q&&p&&(x=!0,w=!1)):(w=!1,!p&&q&&(x=!0,w=!0)),x&&(b.hide(),d=this.container.offset(),e=this.container.outerHeight(!1),f=this.container.outerWidth(!1),g=b.outerHeight(!1),l=h.scrollLeft()+i,m=h.scrollTop()+k,n=d.top+e,o=d.left,r=b.outerWidth(!1),b.show(),this.focusSearch()),this.opts.dropdownAutoWidth?(z=a(".select2-results",b)[0],b.addClass("select2-drop-auto-width"),b.css("width",""),r=b.outerWidth(!1)+(z.scrollHeight===z.clientHeight?0:j.width),r>f?f=r:r=f,g=b.outerHeight(!1)):this.container.removeClass("select2-drop-auto-width"),"static"!==this.body.css("position")&&(v=this.body.offset(),n-=v.top,o-=v.left),!s()&&t()&&(o=d.left+this.container.outerWidth(!1)-r),y={left:o,width:f},w?(y.top=d.top-g,y.bottom="auto",this.container.addClass("select2-drop-above"),b.addClass("select2-drop-above")):(y.top=n,y.bottom="auto",this.container.removeClass("select2-drop-above"),b.removeClass("select2-drop-above")),y=a.extend(y,K(this.opts.dropdownCss,this.opts.element)),b.css(y)},shouldOpen:function(){var b;return this.opened()?!1:this._enabled===!1||this._readonly===!0?!1:(b=a.Event("select2-opening"),this.opts.element.trigger(b),!b.isDefaultPrevented())},clearDropdownAlignmentPreference:function(){this.container.removeClass("select2-drop-above"),this.dropdown.removeClass("select2-drop-above")},open:function(){return this.shouldOpen()?(this.opening(),i.on("mousemove.select2Event",function(a){h.x=a.pageX,h.y=a.pageY}),!0):!1},opening:function(){var f,b=this.containerEventName,c="scroll."+b,d="resize."+b,e="orientationchange."+b;this.container.addClass("select2-dropdown-open").addClass("select2-container-active"),this.clearDropdownAlignmentPreference(),this.dropdown[0]!==this.body.children().last()[0]&&this.dropdown.detach().appendTo(this.body),f=a("#select2-drop-mask"),0===f.length&&(f=a(document.createElement("div")),f.attr("id","select2-drop-mask").attr("class","select2-drop-mask"),f.hide(),f.appendTo(this.body),f.on("mousedown touchstart click",function(b){n(f);var d,c=a("#select2-drop");c.length>0&&(d=c.data("select2"),d.opts.selectOnBlur&&d.selectHighlighted({noFocus:!0}),d.close(),b.preventDefault(),b.stopPropagation())})),this.dropdown.prev()[0]!==f[0]&&this.dropdown.before(f),a("#select2-drop").removeAttr("id"),this.dropdown.attr("id","select2-drop"),f.show(),this.positionDropdown(),this.dropdown.show(),this.positionDropdown(),this.dropdown.addClass("select2-drop-active");var g=this;this.container.parents().add(window).each(function(){a(this).on(d+" "+c+" "+e,function(){g.opened()&&g.positionDropdown()})})},close:function(){if(this.opened()){var b=this.containerEventName,c="scroll."+b,d="resize."+b,e="orientationchange."+b;this.container.parents().add(window).each(function(){a(this).off(c).off(d).off(e)}),this.clearDropdownAlignmentPreference(),a("#select2-drop-mask").hide(),this.dropdown.removeAttr("id"),this.dropdown.hide(),this.container.removeClass("select2-dropdown-open").removeClass("select2-container-active"),this.results.empty(),i.off("mousemove.select2Event"),this.clearSearch(),this.search.removeClass("select2-active"),this.opts.element.trigger(a.Event("select2-close"))}},externalSearch:function(a){this.open(),this.search.val(a),this.updateResults(!1)},clearSearch:function(){},getMaximumSelectionSize:function(){return K(this.opts.maximumSelectionSize,this.opts.element)},ensureHighlightVisible:function(){var c,d,e,f,g,h,i,j,b=this.results;if(d=this.highlight(),!(0>d)){if(0==d)return b.scrollTop(0),void 0;c=this.findHighlightableChoices().find(".select2-result-label"),e=a(c[d]),j=(e.offset()||{}).top||0,f=j+e.outerHeight(!0),d===c.length-1&&(i=b.find("li.select2-more-results"),i.length>0&&(f=i.offset().top+i.outerHeight(!0))),g=b.offset().top+b.outerHeight(!1),f>g&&b.scrollTop(b.scrollTop()+(f-g)),h=j-b.offset().top,0>h&&"none"!=e.css("display")&&b.scrollTop(b.scrollTop()+h)}},findHighlightableChoices:function(){return this.results.find(".select2-result-selectable:not(.select2-disabled):not(.select2-selected)")},moveHighlight:function(b){for(var c=this.findHighlightableChoices(),d=this.highlight();d>-1&&d<c.length;){d+=b; +var e=a(c[d]);if(e.hasClass("select2-result-selectable")&&!e.hasClass("select2-disabled")&&!e.hasClass("select2-selected")){this.highlight(d);break}}},highlight:function(b){var d,e,c=this.findHighlightableChoices();return 0===arguments.length?p(c.filter(".select2-highlighted")[0],c.get()):(b>=c.length&&(b=c.length-1),0>b&&(b=0),this.removeHighlight(),d=a(c[b]),d.addClass("select2-highlighted"),this.search.attr("aria-activedescendant",d.find(".select2-result-label").attr("id")),this.ensureHighlightVisible(),this.liveRegion.text(d.text()),e=d.data("select2-data"),e&&this.opts.element.trigger({type:"select2-highlight",val:this.id(e),choice:e}),void 0)},removeHighlight:function(){this.results.find(".select2-highlighted").removeClass("select2-highlighted")},touchMoved:function(){this._touchMoved=!0},clearTouchMoved:function(){this._touchMoved=!1},countSelectableResults:function(){return this.findHighlightableChoices().length},highlightUnderEvent:function(b){var c=a(b.target).closest(".select2-result-selectable");if(c.length>0&&!c.is(".select2-highlighted")){var d=this.findHighlightableChoices();this.highlight(d.index(c))}else 0==c.length&&this.removeHighlight()},loadMoreIfNeeded:function(){var c,a=this.results,b=a.find("li.select2-more-results"),d=this.resultsPage+1,e=this,f=this.search.val(),g=this.context;0!==b.length&&(c=b.offset().top-a.offset().top-a.height(),c<=this.opts.loadMorePadding&&(b.addClass("select2-active"),this.opts.query({element:this.opts.element,term:f,page:d,context:g,matcher:this.opts.matcher,callback:this.bind(function(c){e.opened()&&(e.opts.populateResults.call(this,a,c.results,{term:f,page:d,context:g}),e.postprocessResults(c,!1,!1),c.more===!0?(b.detach().appendTo(a).html(e.opts.escapeMarkup(K(e.opts.formatLoadMore,e.opts.element,d+1))),window.setTimeout(function(){e.loadMoreIfNeeded()},10)):b.remove(),e.positionDropdown(),e.resultsPage=d,e.context=c.context,this.opts.element.trigger({type:"select2-loaded",items:c}))})})))},tokenize:function(){},updateResults:function(c){function m(){d.removeClass("select2-active"),h.positionDropdown(),e.find(".select2-no-results,.select2-selection-limit,.select2-searching").length?h.liveRegion.text(e.text()):h.liveRegion.text(h.opts.formatMatches(e.find('.select2-result-selectable:not(".select2-selected")').length))}function n(a){e.html(a),m()}var g,i,l,d=this.search,e=this.results,f=this.opts,h=this,j=d.val(),k=a.data(this.container,"select2-last-term");if((c===!0||!k||!r(j,k))&&(a.data(this.container,"select2-last-term",j),c===!0||this.showSearchInput!==!1&&this.opened())){l=++this.queryCount;var o=this.getMaximumSelectionSize();if(o>=1&&(g=this.data(),a.isArray(g)&&g.length>=o&&J(f.formatSelectionTooBig,"formatSelectionTooBig")))return n("<li class='select2-selection-limit'>"+K(f.formatSelectionTooBig,f.element,o)+"</li>"),void 0;if(d.val().length<f.minimumInputLength)return J(f.formatInputTooShort,"formatInputTooShort")?n("<li class='select2-no-results'>"+K(f.formatInputTooShort,f.element,d.val(),f.minimumInputLength)+"</li>"):n(""),c&&this.showSearch&&this.showSearch(!0),void 0;if(f.maximumInputLength&&d.val().length>f.maximumInputLength)return J(f.formatInputTooLong,"formatInputTooLong")?n("<li class='select2-no-results'>"+K(f.formatInputTooLong,f.element,d.val(),f.maximumInputLength)+"</li>"):n(""),void 0;f.formatSearching&&0===this.findHighlightableChoices().length&&n("<li class='select2-searching'>"+K(f.formatSearching,f.element)+"</li>"),d.addClass("select2-active"),this.removeHighlight(),i=this.tokenize(),i!=b&&null!=i&&d.val(i),this.resultsPage=1,f.query({element:f.element,term:d.val(),page:this.resultsPage,context:null,matcher:f.matcher,callback:this.bind(function(g){var i;if(l==this.queryCount){if(!this.opened())return this.search.removeClass("select2-active"),void 0;if(g.hasError!==b&&J(f.formatAjaxError,"formatAjaxError"))return n("<li class='select2-ajax-error'>"+K(f.formatAjaxError,f.element,g.jqXHR,g.textStatus,g.errorThrown)+"</li>"),void 0;if(this.context=g.context===b?null:g.context,this.opts.createSearchChoice&&""!==d.val()&&(i=this.opts.createSearchChoice.call(h,d.val(),g.results),i!==b&&null!==i&&h.id(i)!==b&&null!==h.id(i)&&0===a(g.results).filter(function(){return r(h.id(this),h.id(i))}).length&&this.opts.createSearchChoicePosition(g.results,i)),0===g.results.length&&J(f.formatNoMatches,"formatNoMatches"))return n("<li class='select2-no-results'>"+K(f.formatNoMatches,f.element,d.val())+"</li>"),void 0;e.empty(),h.opts.populateResults.call(this,e,g.results,{term:d.val(),page:this.resultsPage,context:null}),g.more===!0&&J(f.formatLoadMore,"formatLoadMore")&&(e.append("<li class='select2-more-results'>"+f.escapeMarkup(K(f.formatLoadMore,f.element,this.resultsPage))+"</li>"),window.setTimeout(function(){h.loadMoreIfNeeded()},10)),this.postprocessResults(g,c),m(),this.opts.element.trigger({type:"select2-loaded",items:g})}})})}},cancel:function(){this.close()},blur:function(){this.opts.selectOnBlur&&this.selectHighlighted({noFocus:!0}),this.close(),this.container.removeClass("select2-container-active"),this.search[0]===document.activeElement&&this.search.blur(),this.clearSearch(),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus")},focusSearch:function(){y(this.search)},selectHighlighted:function(a){if(this._touchMoved)return this.clearTouchMoved(),void 0;var b=this.highlight(),c=this.results.find(".select2-highlighted"),d=c.closest(".select2-result").data("select2-data");d?(this.highlight(b),this.onSelect(d,a)):a&&a.noFocus&&this.close()},getPlaceholder:function(){var a;return this.opts.element.attr("placeholder")||this.opts.element.attr("data-placeholder")||this.opts.element.data("placeholder")||this.opts.placeholder||((a=this.getPlaceholderOption())!==b?a.text():b)},getPlaceholderOption:function(){if(this.select){var c=this.select.children("option").first();if(this.opts.placeholderOption!==b)return"first"===this.opts.placeholderOption&&c||"function"==typeof this.opts.placeholderOption&&this.opts.placeholderOption(this.select);if(""===a.trim(c.text())&&""===c.val())return c}},initContainerWidth:function(){function c(){var c,d,e,f,g,h;if("off"===this.opts.width)return null;if("element"===this.opts.width)return 0===this.opts.element.outerWidth(!1)?"auto":this.opts.element.outerWidth(!1)+"px";if("copy"===this.opts.width||"resolve"===this.opts.width){if(c=this.opts.element.attr("style"),c!==b)for(d=c.split(";"),f=0,g=d.length;g>f;f+=1)if(h=d[f].replace(/\s/g,""),e=h.match(/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i),null!==e&&e.length>=1)return e[1];return"resolve"===this.opts.width?(c=this.opts.element.css("width"),c.indexOf("%")>0?c:0===this.opts.element.outerWidth(!1)?"auto":this.opts.element.outerWidth(!1)+"px"):null}return a.isFunction(this.opts.width)?this.opts.width():this.opts.width}var d=c.call(this);null!==d&&this.container.css("width",d)}}),d=O(c,{createContainer:function(){var b=a(document.createElement("div")).attr({"class":"select2-container"}).html(["<a href='javascript:void(0)' class='select2-choice' tabindex='-1'>"," <span class='select2-chosen'> </span><abbr class='select2-search-choice-close'></abbr>"," <span class='select2-arrow' role='presentation'><b role='presentation'></b></span>","</a>","<label for='' class='select2-offscreen'></label>","<input class='select2-focusser select2-offscreen' type='text' aria-haspopup='true' role='button' />","<div class='select2-drop select2-display-none'>"," <div class='select2-search'>"," <label for='' class='select2-offscreen'></label>"," <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input' role='combobox' aria-expanded='true'"," aria-autocomplete='list' />"," </div>"," <ul class='select2-results' role='listbox'>"," </ul>","</div>"].join(""));return b},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.focusser.prop("disabled",!this.isInterfaceEnabled())},opening:function(){var c,d,e;this.opts.minimumResultsForSearch>=0&&this.showSearch(!0),this.parent.opening.apply(this,arguments),this.showSearchInput!==!1&&this.search.val(this.focusser.val()),this.opts.shouldFocusInput(this)&&(this.search.focus(),c=this.search.get(0),c.createTextRange?(d=c.createTextRange(),d.collapse(!1),d.select()):c.setSelectionRange&&(e=this.search.val().length,c.setSelectionRange(e,e))),""===this.search.val()&&this.nextSearchTerm!=b&&(this.search.val(this.nextSearchTerm),this.search.select()),this.focusser.prop("disabled",!0).val(""),this.updateResults(!0),this.opts.element.trigger(a.Event("select2-open"))},close:function(){this.opened()&&(this.parent.close.apply(this,arguments),this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus())},focus:function(){this.opened()?this.close():(this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus())},isFocused:function(){return this.container.hasClass("select2-container-active")},cancel:function(){this.parent.cancel.apply(this,arguments),this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus()},destroy:function(){a("label[for='"+this.focusser.attr("id")+"']").attr("for",this.opts.element.attr("id")),this.parent.destroy.apply(this,arguments),N.call(this,"selection","focusser")},initContainer:function(){var b,g,c=this.container,d=this.dropdown,e=f();this.opts.minimumResultsForSearch<0?this.showSearch(!1):this.showSearch(!0),this.selection=b=c.find(".select2-choice"),this.focusser=c.find(".select2-focusser"),b.find(".select2-chosen").attr("id","select2-chosen-"+e),this.focusser.attr("aria-labelledby","select2-chosen-"+e),this.results.attr("id","select2-results-"+e),this.search.attr("aria-owns","select2-results-"+e),this.focusser.attr("id","s2id_autogen"+e),g=a("label[for='"+this.opts.element.attr("id")+"']"),this.opts.element.focus(this.bind(function(){this.focus()})),this.focusser.prev().text(g.text()).attr("for",this.focusser.attr("id"));var h=this.opts.element.attr("title");this.opts.element.attr("title",h||g.text()),this.focusser.attr("tabindex",this.elementTabIndex),this.search.attr("id",this.focusser.attr("id")+"_search"),this.search.prev().text(a("label[for='"+this.focusser.attr("id")+"']").text()).attr("for",this.search.attr("id")),this.search.on("keydown",this.bind(function(a){if(this.isInterfaceEnabled()&&229!=a.keyCode){if(a.which===k.PAGE_UP||a.which===k.PAGE_DOWN)return A(a),void 0;switch(a.which){case k.UP:case k.DOWN:return this.moveHighlight(a.which===k.UP?-1:1),A(a),void 0;case k.ENTER:return this.selectHighlighted(),A(a),void 0;case k.TAB:return this.selectHighlighted({noFocus:!0}),void 0;case k.ESC:return this.cancel(a),A(a),void 0}}})),this.search.on("blur",this.bind(function(){document.activeElement===this.body.get(0)&&window.setTimeout(this.bind(function(){this.opened()&&this.search.focus()}),0)})),this.focusser.on("keydown",this.bind(function(a){if(this.isInterfaceEnabled()&&a.which!==k.TAB&&!k.isControl(a)&&!k.isFunctionKey(a)&&a.which!==k.ESC){if(this.opts.openOnEnter===!1&&a.which===k.ENTER)return A(a),void 0;if(a.which==k.DOWN||a.which==k.UP||a.which==k.ENTER&&this.opts.openOnEnter){if(a.altKey||a.ctrlKey||a.shiftKey||a.metaKey)return;return this.open(),A(a),void 0}return a.which==k.DELETE||a.which==k.BACKSPACE?(this.opts.allowClear&&this.clear(),A(a),void 0):void 0}})),u(this.focusser),this.focusser.on("keyup-change input",this.bind(function(a){if(this.opts.minimumResultsForSearch>=0){if(a.stopPropagation(),this.opened())return;this.open()}})),b.on("mousedown touchstart","abbr",this.bind(function(a){this.isInterfaceEnabled()&&(this.clear(),B(a),this.close(),this.selection&&this.selection.focus())})),b.on("mousedown touchstart",this.bind(function(c){n(b),this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.opened()?this.close():this.isInterfaceEnabled()&&this.open(),A(c)})),d.on("mousedown touchstart",this.bind(function(){this.opts.shouldFocusInput(this)&&this.search.focus()})),b.on("focus",this.bind(function(a){A(a)})),this.focusser.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.container.addClass("select2-container-active")})).on("blur",this.bind(function(){this.opened()||(this.container.removeClass("select2-container-active"),this.opts.element.trigger(a.Event("select2-blur")))})),this.search.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.container.addClass("select2-container-active")})),this.initContainerWidth(),this.opts.element.hide(),this.setPlaceholder()},clear:function(b){var c=this.selection.data("select2-data");if(c){var d=a.Event("select2-clearing");if(this.opts.element.trigger(d),d.isDefaultPrevented())return;var e=this.getPlaceholderOption();this.opts.element.val(e?e.val():""),this.selection.find(".select2-chosen").empty(),this.selection.removeData("select2-data"),this.setPlaceholder(),b!==!1&&(this.opts.element.trigger({type:"select2-removed",val:this.id(c),choice:c}),this.triggerChange({removed:c}))}},initSelection:function(){if(this.isPlaceholderOptionSelected())this.updateSelection(null),this.close(),this.setPlaceholder();else{var c=this;this.opts.initSelection.call(null,this.opts.element,function(a){a!==b&&null!==a&&(c.updateSelection(a),c.close(),c.setPlaceholder(),c.nextSearchTerm=c.opts.nextSearchTerm(a,c.search.val()))})}},isPlaceholderOptionSelected:function(){var a;return this.getPlaceholder()===b?!1:(a=this.getPlaceholderOption())!==b&&a.prop("selected")||""===this.opts.element.val()||this.opts.element.val()===b||null===this.opts.element.val()},prepareOpts:function(){var b=this.parent.prepareOpts.apply(this,arguments),c=this;return"select"===b.element.get(0).tagName.toLowerCase()?b.initSelection=function(a,b){var d=a.find("option").filter(function(){return this.selected&&!this.disabled});b(c.optionToData(d))}:"data"in b&&(b.initSelection=b.initSelection||function(c,d){var e=c.val(),f=null;b.query({matcher:function(a,c,d){var g=r(e,b.id(d));return g&&(f=d),g},callback:a.isFunction(d)?function(){d(f)}:a.noop})}),b},getPlaceholder:function(){return this.select&&this.getPlaceholderOption()===b?b:this.parent.getPlaceholder.apply(this,arguments)},setPlaceholder:function(){var a=this.getPlaceholder();if(this.isPlaceholderOptionSelected()&&a!==b){if(this.select&&this.getPlaceholderOption()===b)return;this.selection.find(".select2-chosen").html(this.opts.escapeMarkup(a)),this.selection.addClass("select2-default"),this.container.removeClass("select2-allowclear")}},postprocessResults:function(a,b,c){var d=0,e=this;if(this.findHighlightableChoices().each2(function(a,b){return r(e.id(b.data("select2-data")),e.opts.element.val())?(d=a,!1):void 0}),c!==!1&&(b===!0&&d>=0?this.highlight(d):this.highlight(0)),b===!0){var g=this.opts.minimumResultsForSearch;g>=0&&this.showSearch(L(a.results)>=g)}},showSearch:function(b){this.showSearchInput!==b&&(this.showSearchInput=b,this.dropdown.find(".select2-search").toggleClass("select2-search-hidden",!b),this.dropdown.find(".select2-search").toggleClass("select2-offscreen",!b),a(this.dropdown,this.container).toggleClass("select2-with-searchbox",b))},onSelect:function(a,b){if(this.triggerSelect(a)){var c=this.opts.element.val(),d=this.data();this.opts.element.val(this.id(a)),this.updateSelection(a),this.opts.element.trigger({type:"select2-selected",val:this.id(a),choice:a}),this.nextSearchTerm=this.opts.nextSearchTerm(a,this.search.val()),this.close(),b&&b.noFocus||!this.opts.shouldFocusInput(this)||this.focusser.focus(),r(c,this.id(a))||this.triggerChange({added:a,removed:d})}},updateSelection:function(a){var d,e,c=this.selection.find(".select2-chosen");this.selection.data("select2-data",a),c.empty(),null!==a&&(d=this.opts.formatSelection(a,c,this.opts.escapeMarkup)),d!==b&&c.append(d),e=this.opts.formatSelectionCssClass(a,c),e!==b&&c.addClass(e),this.selection.removeClass("select2-default"),this.opts.allowClear&&this.getPlaceholder()!==b&&this.container.addClass("select2-allowclear")},val:function(){var a,c=!1,d=null,e=this,f=this.data();if(0===arguments.length)return this.opts.element.val();if(a=arguments[0],arguments.length>1&&(c=arguments[1]),this.select)this.select.val(a).find("option").filter(function(){return this.selected}).each2(function(a,b){return d=e.optionToData(b),!1}),this.updateSelection(d),this.setPlaceholder(),c&&this.triggerChange({added:d,removed:f});else{if(!a&&0!==a)return this.clear(c),void 0;if(this.opts.initSelection===b)throw new Error("cannot call val() if initSelection() is not defined");this.opts.element.val(a),this.opts.initSelection(this.opts.element,function(a){e.opts.element.val(a?e.id(a):""),e.updateSelection(a),e.setPlaceholder(),c&&e.triggerChange({added:a,removed:f})})}},clearSearch:function(){this.search.val(""),this.focusser.val("")},data:function(a){var c,d=!1;return 0===arguments.length?(c=this.selection.data("select2-data"),c==b&&(c=null),c):(arguments.length>1&&(d=arguments[1]),a?(c=this.data(),this.opts.element.val(a?this.id(a):""),this.updateSelection(a),d&&this.triggerChange({added:a,removed:c})):this.clear(d),void 0)}}),e=O(c,{createContainer:function(){var b=a(document.createElement("div")).attr({"class":"select2-container select2-container-multi"}).html(["<ul class='select2-choices'>"," <li class='select2-search-field'>"," <label for='' class='select2-offscreen'></label>"," <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input'>"," </li>","</ul>","<div class='select2-drop select2-drop-multi select2-display-none'>"," <ul class='select2-results'>"," </ul>","</div>"].join(""));return b},prepareOpts:function(){var b=this.parent.prepareOpts.apply(this,arguments),c=this;return"select"===b.element.get(0).tagName.toLowerCase()?b.initSelection=function(a,b){var d=[];a.find("option").filter(function(){return this.selected&&!this.disabled}).each2(function(a,b){d.push(c.optionToData(b))}),b(d)}:"data"in b&&(b.initSelection=b.initSelection||function(c,d){var e=s(c.val(),b.separator,b.transformVal),f=[];b.query({matcher:function(c,d,g){var h=a.grep(e,function(a){return r(a,b.id(g))}).length;return h&&f.push(g),h},callback:a.isFunction(d)?function(){for(var a=[],c=0;c<e.length;c++)for(var g=e[c],h=0;h<f.length;h++){var i=f[h];if(r(g,b.id(i))){a.push(i),f.splice(h,1);break}}d(a)}:a.noop})}),b},selectChoice:function(a){var b=this.container.find(".select2-search-choice-focus");b.length&&a&&a[0]==b[0]||(b.length&&this.opts.element.trigger("choice-deselected",b),b.removeClass("select2-search-choice-focus"),a&&a.length&&(this.close(),a.addClass("select2-search-choice-focus"),this.opts.element.trigger("choice-selected",a)))},destroy:function(){a("label[for='"+this.search.attr("id")+"']").attr("for",this.opts.element.attr("id")),this.parent.destroy.apply(this,arguments),N.call(this,"searchContainer","selection")},initContainer:function(){var c,b=".select2-choices";this.searchContainer=this.container.find(".select2-search-field"),this.selection=c=this.container.find(b);var d=this;this.selection.on("click",".select2-container:not(.select2-container-disabled) .select2-search-choice:not(.select2-locked)",function(){d.search[0].focus(),d.selectChoice(a(this))}),this.search.attr("id","s2id_autogen"+f()),this.search.prev().text(a("label[for='"+this.opts.element.attr("id")+"']").text()).attr("for",this.search.attr("id")),this.opts.element.focus(this.bind(function(){this.focus()})),this.search.on("input paste",this.bind(function(){this.search.attr("placeholder")&&0==this.search.val().length||this.isInterfaceEnabled()&&(this.opened()||this.open())})),this.search.attr("tabindex",this.elementTabIndex),this.keydowns=0,this.search.on("keydown",this.bind(function(a){if(this.isInterfaceEnabled()){++this.keydowns;var b=c.find(".select2-search-choice-focus"),d=b.prev(".select2-search-choice:not(.select2-locked)"),e=b.next(".select2-search-choice:not(.select2-locked)"),f=z(this.search);if(b.length&&(a.which==k.LEFT||a.which==k.RIGHT||a.which==k.BACKSPACE||a.which==k.DELETE||a.which==k.ENTER)){var g=b;return a.which==k.LEFT&&d.length?g=d:a.which==k.RIGHT?g=e.length?e:null:a.which===k.BACKSPACE?this.unselect(b.first())&&(this.search.width(10),g=d.length?d:e):a.which==k.DELETE?this.unselect(b.first())&&(this.search.width(10),g=e.length?e:null):a.which==k.ENTER&&(g=null),this.selectChoice(g),A(a),g&&g.length||this.open(),void 0}if((a.which===k.BACKSPACE&&1==this.keydowns||a.which==k.LEFT)&&0==f.offset&&!f.length)return this.selectChoice(c.find(".select2-search-choice:not(.select2-locked)").last()),A(a),void 0;if(this.selectChoice(null),this.opened())switch(a.which){case k.UP:case k.DOWN:return this.moveHighlight(a.which===k.UP?-1:1),A(a),void 0;case k.ENTER:return this.selectHighlighted(),A(a),void 0;case k.TAB:return this.selectHighlighted({noFocus:!0}),this.close(),void 0;case k.ESC:return this.cancel(a),A(a),void 0}if(a.which!==k.TAB&&!k.isControl(a)&&!k.isFunctionKey(a)&&a.which!==k.BACKSPACE&&a.which!==k.ESC){if(a.which===k.ENTER){if(this.opts.openOnEnter===!1)return;if(a.altKey||a.ctrlKey||a.shiftKey||a.metaKey)return}this.open(),(a.which===k.PAGE_UP||a.which===k.PAGE_DOWN)&&A(a),a.which===k.ENTER&&A(a)}}})),this.search.on("keyup",this.bind(function(){this.keydowns=0,this.resizeSearch()})),this.search.on("blur",this.bind(function(b){this.container.removeClass("select2-container-active"),this.search.removeClass("select2-focused"),this.selectChoice(null),this.opened()||this.clearSearch(),b.stopImmediatePropagation(),this.opts.element.trigger(a.Event("select2-blur"))})),this.container.on("click",b,this.bind(function(b){this.isInterfaceEnabled()&&(a(b.target).closest(".select2-search-choice").length>0||(this.selectChoice(null),this.clearPlaceholder(),this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.open(),this.focusSearch(),b.preventDefault()))})),this.container.on("focus",b,this.bind(function(){this.isInterfaceEnabled()&&(this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"),this.clearPlaceholder())})),this.initContainerWidth(),this.opts.element.hide(),this.clearSearch()},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.search.prop("disabled",!this.isInterfaceEnabled())},initSelection:function(){if(""===this.opts.element.val()&&""===this.opts.element.text()&&(this.updateSelection([]),this.close(),this.clearSearch()),this.select||""!==this.opts.element.val()){var c=this;this.opts.initSelection.call(null,this.opts.element,function(a){a!==b&&null!==a&&(c.updateSelection(a),c.close(),c.clearSearch())})}},clearSearch:function(){var a=this.getPlaceholder(),c=this.getMaxSearchWidth();a!==b&&0===this.getVal().length&&this.search.hasClass("select2-focused")===!1?(this.search.val(a).addClass("select2-default"),this.search.width(c>0?c:this.container.css("width"))):this.search.val("").width(10)},clearPlaceholder:function(){this.search.hasClass("select2-default")&&this.search.val("").removeClass("select2-default")},opening:function(){this.clearPlaceholder(),this.resizeSearch(),this.parent.opening.apply(this,arguments),this.focusSearch(),""===this.search.val()&&this.nextSearchTerm!=b&&(this.search.val(this.nextSearchTerm),this.search.select()),this.updateResults(!0),this.opts.shouldFocusInput(this)&&this.search.focus(),this.opts.element.trigger(a.Event("select2-open"))},close:function(){this.opened()&&this.parent.close.apply(this,arguments)},focus:function(){this.close(),this.search.focus()},isFocused:function(){return this.search.hasClass("select2-focused")},updateSelection:function(b){var c=[],d=[],e=this;a(b).each(function(){p(e.id(this),c)<0&&(c.push(e.id(this)),d.push(this))}),b=d,this.selection.find(".select2-search-choice").remove(),a(b).each(function(){e.addSelectedChoice(this)}),e.postprocessResults()},tokenize:function(){var a=this.search.val();a=this.opts.tokenizer.call(this,a,this.data(),this.bind(this.onSelect),this.opts),null!=a&&a!=b&&(this.search.val(a),a.length>0&&this.open())},onSelect:function(a,c){this.triggerSelect(a)&&""!==a.text&&(this.addSelectedChoice(a),this.opts.element.trigger({type:"selected",val:this.id(a),choice:a}),this.nextSearchTerm=this.opts.nextSearchTerm(a,this.search.val()),this.clearSearch(),this.updateResults(),(this.select||!this.opts.closeOnSelect)&&this.postprocessResults(a,!1,this.opts.closeOnSelect===!0),this.opts.closeOnSelect?(this.close(),this.search.width(10)):this.countSelectableResults()>0?(this.search.width(10),this.resizeSearch(),this.getMaximumSelectionSize()>0&&this.val().length>=this.getMaximumSelectionSize()?this.updateResults(!0):this.nextSearchTerm!=b&&(this.search.val(this.nextSearchTerm),this.updateResults(),this.search.select()),this.positionDropdown()):(this.close(),this.search.width(10)),this.triggerChange({added:a}),c&&c.noFocus||this.focusSearch())},cancel:function(){this.close(),this.focusSearch()},addSelectedChoice:function(c){var j,k,d=!c.locked,e=a("<li class='select2-search-choice'> <div></div> <a href='#' class='select2-search-choice-close' tabindex='-1'></a></li>"),f=a("<li class='select2-search-choice select2-locked'><div></div></li>"),g=d?e:f,h=this.id(c),i=this.getVal();j=this.opts.formatSelection(c,g.find("div"),this.opts.escapeMarkup),j!=b&&g.find("div").replaceWith(a("<div></div>").html(j)),k=this.opts.formatSelectionCssClass(c,g.find("div")),k!=b&&g.addClass(k),d&&g.find(".select2-search-choice-close").on("mousedown",A).on("click dblclick",this.bind(function(b){this.isInterfaceEnabled()&&(this.unselect(a(b.target)),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus"),A(b),this.close(),this.focusSearch())})).on("focus",this.bind(function(){this.isInterfaceEnabled()&&(this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"))})),g.data("select2-data",c),g.insertBefore(this.searchContainer),i.push(h),this.setVal(i)},unselect:function(b){var d,e,c=this.getVal();if(b=b.closest(".select2-search-choice"),0===b.length)throw"Invalid argument: "+b+". Must be .select2-search-choice";if(d=b.data("select2-data")){var f=a.Event("select2-removing");if(f.val=this.id(d),f.choice=d,this.opts.element.trigger(f),f.isDefaultPrevented())return!1;for(;(e=p(this.id(d),c))>=0;)c.splice(e,1),this.setVal(c),this.select&&this.postprocessResults();return b.remove(),this.opts.element.trigger({type:"select2-removed",val:this.id(d),choice:d}),this.triggerChange({removed:d}),!0}},postprocessResults:function(a,b,c){var d=this.getVal(),e=this.results.find(".select2-result"),f=this.results.find(".select2-result-with-children"),g=this;e.each2(function(a,b){var c=g.id(b.data("select2-data"));p(c,d)>=0&&(b.addClass("select2-selected"),b.find(".select2-result-selectable").addClass("select2-selected"))}),f.each2(function(a,b){b.is(".select2-result-selectable")||0!==b.find(".select2-result-selectable:not(.select2-selected)").length||b.addClass("select2-selected")}),-1==this.highlight()&&c!==!1&&this.opts.closeOnSelect===!0&&g.highlight(0),!this.opts.createSearchChoice&&!e.filter(".select2-result:not(.select2-selected)").length>0&&(!a||a&&!a.more&&0===this.results.find(".select2-no-results").length)&&J(g.opts.formatNoMatches,"formatNoMatches")&&this.results.append("<li class='select2-no-results'>"+K(g.opts.formatNoMatches,g.opts.element,g.search.val())+"</li>")},getMaxSearchWidth:function(){return this.selection.width()-t(this.search)},resizeSearch:function(){var a,b,c,d,e,f=t(this.search);a=C(this.search)+10,b=this.search.offset().left,c=this.selection.width(),d=this.selection.offset().left,e=c-(b-d)-f,a>e&&(e=c-f),40>e&&(e=c-f),0>=e&&(e=a),this.search.width(Math.floor(e))},getVal:function(){var a;return this.select?(a=this.select.val(),null===a?[]:a):(a=this.opts.element.val(),s(a,this.opts.separator,this.opts.transformVal))},setVal:function(b){var c;this.select?this.select.val(b):(c=[],a(b).each(function(){p(this,c)<0&&c.push(this)}),this.opts.element.val(0===c.length?"":c.join(this.opts.separator)))},buildChangeDetails:function(a,b){for(var b=b.slice(0),a=a.slice(0),c=0;c<b.length;c++)for(var d=0;d<a.length;d++)r(this.opts.id(b[c]),this.opts.id(a[d]))&&(b.splice(c,1),c>0&&c--,a.splice(d,1),d--);return{added:b,removed:a}},val:function(c,d){var e,f=this;if(0===arguments.length)return this.getVal();if(e=this.data(),e.length||(e=[]),!c&&0!==c)return this.opts.element.val(""),this.updateSelection([]),this.clearSearch(),d&&this.triggerChange({added:this.data(),removed:e}),void 0;if(this.setVal(c),this.select)this.opts.initSelection(this.select,this.bind(this.updateSelection)),d&&this.triggerChange(this.buildChangeDetails(e,this.data()));else{if(this.opts.initSelection===b)throw new Error("val() cannot be called if initSelection() is not defined");this.opts.initSelection(this.opts.element,function(b){var c=a.map(b,f.id);f.setVal(c),f.updateSelection(b),f.clearSearch(),d&&f.triggerChange(f.buildChangeDetails(e,f.data()))})}this.clearSearch()},onSortStart:function(){if(this.select)throw new Error("Sorting of elements is not supported when attached to <select>. Attach to <input type='hidden'/> instead.");this.search.width(0),this.searchContainer.hide()},onSortEnd:function(){var b=[],c=this;this.searchContainer.show(),this.searchContainer.appendTo(this.searchContainer.parent()),this.resizeSearch(),this.selection.find(".select2-search-choice").each(function(){b.push(c.opts.id(a(this).data("select2-data")))}),this.setVal(b),this.triggerChange()},data:function(b,c){var e,f,d=this;return 0===arguments.length?this.selection.children(".select2-search-choice").map(function(){return a(this).data("select2-data")}).get():(f=this.data(),b||(b=[]),e=a.map(b,function(a){return d.opts.id(a)}),this.setVal(e),this.updateSelection(b),this.clearSearch(),c&&this.triggerChange(this.buildChangeDetails(f,this.data())),void 0)}}),a.fn.select2=function(){var d,e,f,g,h,c=Array.prototype.slice.call(arguments,0),i=["val","destroy","opened","open","close","focus","isFocused","container","dropdown","onSortStart","onSortEnd","enable","disable","readonly","positionDropdown","data","search"],j=["opened","isFocused","container","dropdown"],k=["val","data"],l={search:"externalSearch"};return this.each(function(){if(0===c.length||"object"==typeof c[0])d=0===c.length?{}:a.extend({},c[0]),d.element=a(this),"select"===d.element.get(0).tagName.toLowerCase()?h=d.element.prop("multiple"):(h=d.multiple||!1,"tags"in d&&(d.multiple=h=!0)),e=h?new window.Select2["class"].multi:new window.Select2["class"].single,e.init(d);else{if("string"!=typeof c[0])throw"Invalid arguments to select2 plugin: "+c;if(p(c[0],i)<0)throw"Unknown method: "+c[0];if(g=b,e=a(this).data("select2"),e===b)return;if(f=c[0],"container"===f?g=e.container:"dropdown"===f?g=e.dropdown:(l[f]&&(f=l[f]),g=e[f].apply(e,c.slice(1))),p(c[0],j)>=0||p(c[0],k)>=0&&1==c.length)return!1}}),g===b?this:g},a.fn.select2.defaults={width:"copy",loadMorePadding:0,closeOnSelect:!0,openOnEnter:!0,containerCss:{},dropdownCss:{},containerCssClass:"",dropdownCssClass:"",formatResult:function(a,b,c,d){var e=[];return E(this.text(a),c.term,e,d),e.join("")},transformVal:function(b){return a.trim(b)},formatSelection:function(a,c,d){return a?d(this.text(a)):b},sortResults:function(a){return a},formatResultCssClass:function(a){return a.css},formatSelectionCssClass:function(){return b},minimumResultsForSearch:0,minimumInputLength:0,maximumInputLength:null,maximumSelectionSize:0,id:function(a){return a==b?null:a.id},text:function(b){return b&&this.data&&this.data.text?a.isFunction(this.data.text)?this.data.text(b):b[this.data.text]:b.text +},matcher:function(a,b){return o(""+b).toUpperCase().indexOf(o(""+a).toUpperCase())>=0},separator:",",tokenSeparators:[],tokenizer:M,escapeMarkup:F,blurOnChange:!1,selectOnBlur:!1,adaptContainerCssClass:function(a){return a},adaptDropdownCssClass:function(){return null},nextSearchTerm:function(){return b},searchInputPlaceholder:"",createSearchChoicePosition:"top",shouldFocusInput:function(a){var b="ontouchstart"in window||navigator.msMaxTouchPoints>0;return b?a.opts.minimumResultsForSearch<0?!1:!0:!0}},a.fn.select2.locales=[],a.fn.select2.locales.en={formatMatches:function(a){return 1===a?"One result is available, press enter to select it.":a+" results are available, use up and down arrow keys to navigate."},formatNoMatches:function(){return"No matches found"},formatAjaxError:function(){return"Loading failed"},formatInputTooShort:function(a,b){var c=b-a.length;return"Please enter "+c+" or more character"+(1==c?"":"s")},formatInputTooLong:function(a,b){var c=a.length-b;return"Please delete "+c+" character"+(1==c?"":"s")},formatSelectionTooBig:function(a){return"You can only select "+a+" item"+(1==a?"":"s")},formatLoadMore:function(){return"Loading more results\u2026"},formatSearching:function(){return"Searching\u2026"}},a.extend(a.fn.select2.defaults,a.fn.select2.locales.en),a.fn.select2.ajaxDefaults={transport:a.ajax,params:{type:"GET",cache:!1,dataType:"json"}},window.Select2={query:{ajax:G,local:H,tags:I},util:{debounce:w,markMatch:E,escapeMarkup:F,stripDiacritics:o},"class":{"abstract":c,single:d,multi:e}}}}(jQuery);
\ No newline at end of file diff --git a/public/vendor/select2/select2.png b/public/vendor/select2/select2.png Binary files differnew file mode 100755 index 00000000..1d804ffb --- /dev/null +++ b/public/vendor/select2/select2.png diff --git a/public/vendor/select2/select2x2.png b/public/vendor/select2/select2x2.png Binary files differnew file mode 100755 index 00000000..4bdd5c96 --- /dev/null +++ b/public/vendor/select2/select2x2.png diff --git a/public/vendor/store.min.js b/public/vendor/store.min.js new file mode 100644 index 00000000..7334a7e7 --- /dev/null +++ b/public/vendor/store.min.js @@ -0,0 +1,2 @@ +/* Copyright (c) 2010-2013 Marcus Westin */ +"use strict";(function(e,t){typeof define=="function"&&define.amd?define([],t):typeof exports=="object"?module.exports=t():e.store=t()})(this,function(){function o(){try{return r in t&&t[r]}catch(e){return!1}}var e={},t=window,n=t.document,r="localStorage",i="script",s;e.disabled=!1,e.version="1.3.17",e.set=function(e,t){},e.get=function(e,t){},e.has=function(t){return e.get(t)!==undefined},e.remove=function(e){},e.clear=function(){},e.transact=function(t,n,r){r==null&&(r=n,n=null),n==null&&(n={});var i=e.get(t,n);r(i),e.set(t,i)},e.getAll=function(){},e.forEach=function(){},e.serialize=function(e){return JSON.stringify(e)},e.deserialize=function(e){if(typeof e!="string")return undefined;try{return JSON.parse(e)}catch(t){return e||undefined}};if(o())s=t[r],e.set=function(t,n){return n===undefined?e.remove(t):(s.setItem(t,e.serialize(n)),n)},e.get=function(t,n){var r=e.deserialize(s.getItem(t));return r===undefined?n:r},e.remove=function(e){s.removeItem(e)},e.clear=function(){s.clear()},e.getAll=function(){var t={};return e.forEach(function(e,n){t[e]=n}),t},e.forEach=function(t){for(var n=0;n<s.length;n++){var r=s.key(n);t(r,e.get(r))}};else if(n.documentElement.addBehavior){var u,a;try{a=new ActiveXObject("htmlfile"),a.open(),a.write("<"+i+">document.w=window</"+i+'><iframe src="/favicon.ico"></iframe>'),a.close(),u=a.w.frames[0].document,s=u.createElement("div")}catch(f){s=n.createElement("div"),u=n.body}var l=function(t){return function(){var n=Array.prototype.slice.call(arguments,0);n.unshift(s),u.appendChild(s),s.addBehavior("#default#userData"),s.load(r);var i=t.apply(e,n);return u.removeChild(s),i}},c=new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]","g"),h=function(e){return e.replace(/^d/,"___$&").replace(c,"___")};e.set=l(function(t,n,i){return n=h(n),i===undefined?e.remove(n):(t.setAttribute(n,e.serialize(i)),t.save(r),i)}),e.get=l(function(t,n,r){n=h(n);var i=e.deserialize(t.getAttribute(n));return i===undefined?r:i}),e.remove=l(function(e,t){t=h(t),e.removeAttribute(t),e.save(r)}),e.clear=l(function(e){var t=e.XMLDocument.documentElement.attributes;e.load(r);while(t.length)e.removeAttribute(t[0].name);e.save(r)}),e.getAll=function(t){var n={};return e.forEach(function(e,t){n[e]=t}),n},e.forEach=l(function(t,n){var r=t.XMLDocument.documentElement.attributes;for(var i=0,s;s=r[i];++i)n(s.name,e.deserialize(t.getAttribute(s.name)))})}try{var p="__storejs__";e.set(p,p),e.get(p)!=p&&(e.disabled=!0),e.remove(p)}catch(f){e.disabled=!0}return e.enabled=!e.disabled,e})
\ No newline at end of file diff --git a/public/vendor/url.min.js b/public/vendor/url.min.js new file mode 100755 index 00000000..8057e0aa --- /dev/null +++ b/public/vendor/url.min.js @@ -0,0 +1 @@ +/*! url - v1.8.6 - 2013-11-22 */window.url=function(){function a(a){return!isNaN(parseFloat(a))&&isFinite(a)}return function(b,c){var d=c||window.location.toString();if(!b)return d;b=b.toString(),"//"===d.substring(0,2)?d="http:"+d:1===d.split("://").length&&(d="http://"+d),c=d.split("/");var e={auth:""},f=c[2].split("@");1===f.length?f=f[0].split(":"):(e.auth=f[0],f=f[1].split(":")),e.protocol=c[0],e.hostname=f[0],e.port=f[1]||("https"===e.protocol.split(":")[0].toLowerCase()?"443":"80"),e.pathname=(c.length>3?"/":"")+c.slice(3,c.length).join("/").split("?")[0].split("#")[0];var g=e.pathname;"/"===g.charAt(g.length-1)&&(g=g.substring(0,g.length-1));var h=e.hostname,i=h.split("."),j=g.split("/");if("hostname"===b)return h;if("domain"===b)return/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/.test(h)?h:i.slice(-2).join(".");if("sub"===b)return i.slice(0,i.length-2).join(".");if("port"===b)return e.port;if("protocol"===b)return e.protocol.split(":")[0];if("auth"===b)return e.auth;if("user"===b)return e.auth.split(":")[0];if("pass"===b)return e.auth.split(":")[1]||"";if("path"===b)return e.pathname;if("."===b.charAt(0)){if(b=b.substring(1),a(b))return b=parseInt(b,10),i[0>b?i.length+b:b-1]||""}else{if(a(b))return b=parseInt(b,10),j[0>b?j.length+b:b]||"";if("file"===b)return j.slice(-1)[0];if("filename"===b)return j.slice(-1)[0].split(".")[0];if("fileext"===b)return j.slice(-1)[0].split(".")[1]||"";if("?"===b.charAt(0)||"#"===b.charAt(0)){var k=d,l=null;if("?"===b.charAt(0)?k=(k.split("?")[1]||"").split("#")[0]:"#"===b.charAt(0)&&(k=k.split("#")[1]||""),!b.charAt(1))return k;b=b.substring(1),k=k.split("&");for(var m=0,n=k.length;n>m;m++)if(l=k[m].split("="),l[0]===b)return l[1]||"";return null}}return""}}(),"undefined"!=typeof jQuery&&jQuery.extend({url:function(a,b){return window.url(a,b)}});
\ No newline at end of file |