1&&(Nt.forEach(function(e){i.addAnimationState({target:e,rect:Bt?y(e):r}),W(e),e.fromRect=r,t.removeAnimationState(e)}),Bt=!1,ce(!this.options.removeCloneOnHide,n))},dragOverCompleted:function(e){var t=e.sortable,n=e.isOwner,i=e.insertion,r=e.activeSortable,o=e.parentEl,a=e.putSortable,s=this.options;if(i){if(n&&r._hideClone(),Wt=!1,s.animation&&Nt.length>1&&(Bt||!n&&!r.options.sort&&!a)){var c=y(Ot,!1,!0,!0);Nt.forEach(function(e){e!==Ot&&(Y(e,c),o.appendChild(e))}),Bt=!0}if(!n)if(Bt||le(),Nt.length>1){var u=Et;r._showClone(t),r.options.animation&&!Et&&u&&Yt.forEach(function(e){r.addAnimationState({target:e,rect:Ct}),e.fromRect=Ct,e.thisAnimationDuration=null})}else r._showClone(t)}},dragOverAnimationCapture:function(e){var t=e.dragRect,i=e.isOwner,r=e.activeSortable;if(Nt.forEach(function(e){e.thisAnimationDuration=null}),r.options.animation&&!i&&r.multiDrag.isMultiDrag){Ct=n({},t);var o=v(Ot,!0);Ct.top-=o.f,Ct.left-=o.e}},dragOverAnimationComplete:function(){Bt&&(Bt=!1,le())},drop:function(e){var t=e.originalEvent,n=e.rootEl,i=e.parentEl,r=e.sortable,o=e.dispatchSortableEvent,a=e.oldIndex,s=e.putSortable,c=s||this.sortable;if(t){var u=this.options,l=i.children;if(!Ft)if(u.multiDragKey&&!this.multiDragKeyDown&&this._deselectMultiDrag(),M(Ot,u.selectedClass,!~Nt.indexOf(Ot)),~Nt.indexOf(Ot))Nt.splice(Nt.indexOf(Ot),1),St=null,X({sortable:r,rootEl:n,name:"deselect",targetEl:Ot,originalEvt:t});else{if(Nt.push(Ot),X({sortable:r,rootEl:n,name:"select",targetEl:Ot,originalEvt:t}),t.shiftKey&&St&&r.el.contains(St)){var d=z(St),h=z(Ot);if(~d&&~h&&d!==h){var p,f;for(h>d?(f=d,p=h):(f=h,p=d+1);f1){var m=y(Ot),g=z(Ot,":not(."+this.options.selectedClass+")");if(!Wt&&u.animation&&(Ot.thisAnimationDuration=null),c.captureAnimationState(),!Wt&&(u.animation&&(Ot.fromRect=m,Nt.forEach(function(e){if(e.thisAnimationDuration=null,e!==Ot){var t=Bt?y(e):m;e.fromRect=t,c.addAnimationState({target:e,rect:t})}})),le(),Nt.forEach(function(e){l[g]?i.insertBefore(e,l[g]):i.appendChild(e),g++}),a===z(Ot))){var v=!1;Nt.forEach(function(e){if(e.sortableIndex!==z(e))return void(v=!0)}),v&&o("update")}Nt.forEach(function(e){W(e)}),c.animateAll()}kt=c}(n===i||s&&"clone"!==s.lastPutMode)&&Yt.forEach(function(e){e.parentNode&&e.parentNode.removeChild(e)})}},nullingGlobal:function(){this.isMultiDrag=Ft=!1,Yt.length=0},destroyGlobal:function(){this._deselectMultiDrag(),h(document,"pointerup",this._deselectMultiDrag),h(document,"mouseup",this._deselectMultiDrag),h(document,"touchend",this._deselectMultiDrag),h(document,"keydown",this._checkKeyDown),h(document,"keyup",this._checkKeyUp)},_deselectMultiDrag:function(e){if(!("undefined"!=typeof Ft&&Ft||kt!==this.sortable||e&&m(e.target,this.options.draggable,this.sortable.el,!1)||e&&0!==e.button))for(;Nt.length;){var t=Nt[0];M(t,this.options.selectedClass,!1),Nt.shift(),X({sortable:this.sortable,rootEl:this.sortable.el,name:"deselect",targetEl:t,originalEvt:e})}},_checkKeyDown:function(e){e.key===this.options.multiDragKey&&(this.multiDragKeyDown=!0)},_checkKeyUp:function(e){e.key===this.options.multiDragKey&&(this.multiDragKeyDown=!1)}},n(e,{pluginName:"multiDrag",utils:{select:function(e){var t=e.parentNode[Ue];t&&t.options.multiDrag&&!~Nt.indexOf(e)&&(kt&&kt!==t&&(kt.multiDrag._deselectMultiDrag(),kt=t),M(e,t.options.selectedClass,!0),Nt.push(e))},deselect:function(e){var t=e.parentNode[Ue],n=Nt.indexOf(e);t&&t.options.multiDrag&&~n&&(M(e,t.options.selectedClass,!1),Nt.splice(n,1))}},eventProperties:function(){var e=this,t=[],n=[];return Nt.forEach(function(i){t.push({multiDragElement:i,index:i.sortableIndex});var r;r=Bt&&i!==Ot?-1:Bt?z(i,":not(."+e.options.selectedClass+")"):z(i),n.push({multiDragElement:i,index:r})}),{items:a(Nt),clones:[].concat(Yt),oldIndicies:t,newIndicies:n}},optionListeners:{multiDragKey:function(e){return e=e.toLowerCase(),"ctrl"===e?e="Control":e.length>1&&(e=e.charAt(0).toUpperCase()+e.substr(1)),e}}})}function ce(e,t){Nt.forEach(function(n,i){var r=t.children[n.sortableIndex+(e?Number(i):0)];r?t.insertBefore(n,r):t.appendChild(n)})}function ue(e,t){Yt.forEach(function(n,i){var r=t.children[n.sortableIndex+(e?Number(i):0)];r?t.insertBefore(n,r):t.appendChild(n)})}function le(){Nt.forEach(function(e){e!==Ot&&e.parentNode&&e.parentNode.removeChild(e)})}var de,he,pe,fe,me,Me,ge,ve,_e,be,ye,Ae,Le,Te,ze,we,De,xe,Se,ke,Oe,Ce,Ee,Ne,Ye,We,Be="1.10.2",Fe=l(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),qe=l(/Edge/i),Xe=l(/firefox/i),Pe=l(/safari/i)&&!l(/chrome/i)&&!l(/android/i),He=l(/iP(ad|od|hone)/i),Re=l(/chrome/i)&&l(/android/i),Ie={capture:!1,passive:!1},je=/\s+/g,Ue="Sortable"+(new Date).getTime(),Je=[],Ge={initializeByDefault:!0},Ke={mount:function(e){for(var t in Ge)!Ge.hasOwnProperty(t)||t in e||(e[t]=Ge[t]);Je.push(e)},pluginEvent:function(e,t,n){var r=this;this.eventCanceled=!1,n.cancel=function(){r.eventCanceled=!0};var o=e+"Global";Je.forEach(function(r){t[r.pluginName]&&(t[r.pluginName][o]&&t[r.pluginName][o](i({sortable:t},n)),t.options[r.pluginName]&&t[r.pluginName][e]&&t[r.pluginName][e](i({sortable:t},n)))})},initializePlugins:function(e,t,i,r){Je.forEach(function(r){var o=r.pluginName;if(e.options[o]||r.initializeByDefault){var a=new r(e,t,e.options);a.sortable=e,a.options=e.options,e[o]=a,n(i,a.defaults)}});for(var o in e.options)if(e.options.hasOwnProperty(o)){var a=this.modifyOption(e,o,e.options[o]);"undefined"!=typeof a&&(e.options[o]=a)}},getEventProperties:function(e,t){var i={};return Je.forEach(function(r){"function"==typeof r.eventProperties&&n(i,r.eventProperties.call(t[r.pluginName],e))}),i},modifyOption:function(e,t,n){var i;return Je.forEach(function(r){e[r.pluginName]&&r.optionListeners&&"function"==typeof r.optionListeners[t]&&(i=r.optionListeners[t].call(e[r.pluginName],n))}),i}},$e=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.evt,a=o(n,["evt"]);Ke.pluginEvent.bind(H)(e,t,i({dragEl:he,parentEl:pe,ghostEl:fe,rootEl:me,nextEl:Me,lastDownEl:ge,cloneEl:ve,cloneHidden:_e,dragStarted:Ce,putSortable:ze,activeSortable:H.active,originalEvent:r,oldIndex:be,oldDraggableIndex:Ae,newIndex:ye,newDraggableIndex:Le,hideGhostForTarget:ft,unhideGhostForTarget:mt,cloneNowHidden:function(){_e=!0},cloneNowShown:function(){_e=!1},dispatchSortableEvent:function(e){P({sortable:t,name:e,originalEvent:r})}},a))},Ve=!1,Qe=!1,Ze=[],et=!1,tt=!1,nt=[],it=!1,rt=[],ot="undefined"!=typeof document,at=He,st=qe||Fe?"cssFloat":"float",ct=ot&&!Re&&!He&&"draggable"in document.createElement("div"),ut=function(){if(ot){if(Fe)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}}(),lt=function(e,t){var n=g(e),i=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),r=L(e,0,t),o=L(e,1,t),a=r&&g(r),s=o&&g(o),c=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+y(r).width,u=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+y(o).width;if("flex"===n.display)return"column"===n.flexDirection||"column-reverse"===n.flexDirection?"vertical":"horizontal";if("grid"===n.display)return n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(r&&a.float&&"none"!==a.float){var l="left"===a.float?"left":"right";return!o||"both"!==s.clear&&s.clear!==l?"horizontal":"vertical"}return r&&("block"===a.display||"flex"===a.display||"table"===a.display||"grid"===a.display||c>=i&&"none"===n[st]||o&&"none"===n[st]&&c+u>i)?"vertical":"horizontal"},dt=function(e,t,n){var i=n?e.left:e.top,r=n?e.right:e.bottom,o=n?e.width:e.height,a=n?t.left:t.top,s=n?t.right:t.bottom,c=n?t.width:t.height;return i===a||r===s||i+o/2===a+c/2},ht=function(e,t){var n;return Ze.some(function(i){if(!T(i)){var r=y(i),o=i[Ue].options.emptyInsertThreshold,a=e>=r.left-o&&e<=r.right+o,s=t>=r.top-o&&t<=r.bottom+o;return o&&a&&s?n=i:void 0}}),n},pt=function(t){function n(e,t){return function(i,r,o,a){var s=i.options.group.name&&r.options.group.name&&i.options.group.name===r.options.group.name;if(null==e&&(t||s))return!0;if(null==e||e===!1)return!1;if(t&&"clone"===e)return e;if("function"==typeof e)return n(e(i,r,o,a),t)(i,r,o,a);var c=(t?i:r).options.group.name;return e===!0||"string"==typeof e&&e===c||e.join&&e.indexOf(c)>-1}}var i={},r=t.group;r&&"object"==e(r)||(r={name:r}),i.name=r.name,i.checkPull=n(r.pull,!0),i.checkPut=n(r.put),i.revertClone=r.revertClone,t.group=i},ft=function(){!ut&&fe&&g(fe,"display","none")},mt=function(){!ut&&fe&&g(fe,"display","")};ot&&document.addEventListener("click",function(e){if(Qe)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),Qe=!1,!1},!0);var Mt=function(e){if(he){e=e.touches?e.touches[0]:e;var t=ht(e.clientX,e.clientY);if(t){var n={};for(var i in e)e.hasOwnProperty(i)&&(n[i]=e[i]);n.target=n.rootEl=t,n.preventDefault=void 0,n.stopPropagation=void 0,t[Ue]._onDragOver(n)}}},gt=function(e){he&&he.parentNode[Ue]._isOutsideThisEl(e.target)};H.prototype={constructor:H,_isOutsideThisEl:function(e){this.el.contains(e)||e===this.el||(Ee=null)},_getDirection:function(e,t){return"function"==typeof this.options.direction?this.options.direction.call(this,e,t,he):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,n=this.el,i=this.options,r=i.preventOnFilter,o=e.type,a=e.touches&&e.touches[0]||e.pointerType&&"touch"===e.pointerType&&e,s=(a||e).target,c=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||s,u=i.filter;if(V(n),!he&&!(/mousedown|pointerdown/.test(o)&&0!==e.button||i.disabled||c.isContentEditable||(s=m(s,i.draggable,n,!1),s&&s.animated||ge===s))){if(be=z(s),Ae=z(s,i.draggable),"function"==typeof u){if(u.call(this,e,s,this))return P({sortable:t,rootEl:c,name:"filter",targetEl:s,toEl:n,fromEl:n}),$e("filter",t,{evt:e}),void(r&&e.cancelable&&e.preventDefault())}else if(u&&(u=u.split(",").some(function(i){if(i=m(c,i.trim(),n,!1))return P({sortable:t,rootEl:i,name:"filter",targetEl:s,fromEl:n,toEl:n}),$e("filter",t,{evt:e}),!0})))return void(r&&e.cancelable&&e.preventDefault());i.handle&&!m(c,i.handle,n,!1)||this._prepareDragStart(e,a,s)}}},_prepareDragStart:function(e,t,n){var i,r=this,o=r.el,a=r.options,s=o.ownerDocument;if(n&&!he&&n.parentNode===o){var c=y(n);if(me=o,he=n,pe=he.parentNode,Me=he.nextSibling,ge=n,Te=a.group,H.dragged=he,we={target:he,clientX:(t||e).clientX,clientY:(t||e).clientY},ke=we.clientX-c.left,Oe=we.clientY-c.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,he.style["will-change"]="all",i=function(){return $e("delayEnded",r,{evt:e}),H.eventCanceled?void r._onDrop():(r._disableDelayedDragEvents(),!Xe&&r.nativeDraggable&&(he.draggable=!0),r._triggerDragStart(e,t),P({sortable:r,name:"choose",originalEvent:e}),void M(he,a.chosenClass,!0))},a.ignore.split(",").forEach(function(e){_(he,e.trim(),j)}),d(s,"dragover",Mt),d(s,"mousemove",Mt),d(s,"touchmove",Mt),d(s,"mouseup",r._onDrop),d(s,"touchend",r._onDrop),d(s,"touchcancel",r._onDrop),Xe&&this.nativeDraggable&&(this.options.touchStartThreshold=4,he.draggable=!0),$e("delayStart",this,{evt:e}),!a.delay||a.delayOnTouchOnly&&!t||this.nativeDraggable&&(qe||Fe))i();else{if(H.eventCanceled)return void this._onDrop();d(s,"mouseup",r._disableDelayedDrag),d(s,"touchend",r._disableDelayedDrag),d(s,"touchcancel",r._disableDelayedDrag),d(s,"mousemove",r._delayedDragTouchMoveHandler),d(s,"touchmove",r._delayedDragTouchMoveHandler),a.supportPointer&&d(s,"pointermove",r._delayedDragTouchMoveHandler),r._dragStartTimer=setTimeout(i,a.delay)}}},_delayedDragTouchMoveHandler:function(e){var t=e.touches?e.touches[0]:e;Math.max(Math.abs(t.clientX-this._lastX),Math.abs(t.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){he&&j(he),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;h(e,"mouseup",this._disableDelayedDrag),h(e,"touchend",this._disableDelayedDrag),h(e,"touchcancel",this._disableDelayedDrag),h(e,"mousemove",this._delayedDragTouchMoveHandler),h(e,"touchmove",this._delayedDragTouchMoveHandler),h(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?this.options.supportPointer?d(document,"pointermove",this._onTouchMove):t?d(document,"touchmove",this._onTouchMove):d(document,"mousemove",this._onTouchMove):(d(he,"dragend",this),d(me,"dragstart",this._onDragStart));try{document.selection?Q(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){if(Ve=!1,me&&he){$e("dragStarted",this,{evt:t}),this.nativeDraggable&&d(document,"dragover",gt);var n=this.options;!e&&M(he,n.dragClass,!1),M(he,n.ghostClass,!0),H.active=this,e&&this._appendGhost(),P({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(De){this._lastX=De.clientX,this._lastY=De.clientY,ft();for(var e=document.elementFromPoint(De.clientX,De.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(De.clientX,De.clientY),e!==t);)t=e;if(he.parentNode[Ue]._isOutsideThisEl(e),t)do{if(t[Ue]){var n=void 0;if(n=t[Ue]._onDragOver({clientX:De.clientX,clientY:De.clientY,target:e,rootEl:t}),n&&!this.options.dragoverBubble)break}e=t}while(t=t.parentNode);mt()}},_onTouchMove:function(e){if(we){var t=this.options,n=t.fallbackTolerance,i=t.fallbackOffset,r=e.touches?e.touches[0]:e,o=fe&&v(fe,!0),a=fe&&o&&o.a,s=fe&&o&&o.d,c=at&&We&&w(We),u=(r.clientX-we.clientX+i.x)/(a||1)+(c?c[0]-nt[0]:0)/(a||1),l=(r.clientY-we.clientY+i.y)/(s||1)+(c?c[1]-nt[1]:0)/(s||1);if(!H.active&&!Ve){if(n&&Math.max(Math.abs(r.clientX-this._lastX),Math.abs(r.clientY-this._lastY))=0&&(P({rootEl:pe,name:"add",toEl:pe,fromEl:me,originalEvent:e}),P({sortable:this,name:"remove",toEl:pe,originalEvent:e}),P({rootEl:pe,name:"sort",toEl:pe,fromEl:me,originalEvent:e}),P({sortable:this,name:"sort",toEl:pe,originalEvent:e})),ze&&ze.save()):ye!==be&&ye>=0&&(P({sortable:this,name:"update",toEl:pe,originalEvent:e}),P({sortable:this,name:"sort",toEl:pe,originalEvent:e})),H.active&&(null!=ye&&ye!==-1||(ye=be,Le=Ae),P({sortable:this,name:"end",toEl:pe,originalEvent:e}),this.save()))),void this._nulling())},_nulling:function(){$e("nulling",this),me=he=pe=fe=Me=ve=ge=_e=we=De=Ce=ye=Le=be=Ae=Ee=Ne=ze=Te=H.dragged=H.ghost=H.clone=H.active=null,rt.forEach(function(e){e.checked=!0}),rt.length=xe=Se=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":he&&(this._onDragOver(e),R(e));break;case"selectstart":e.preventDefault()}},toArray:function(){for(var e,t=[],n=this.el.children,i=0,r=n.length,o=this.options;i=0&&e.data.length>0){var o=e.data.match(n),a=document.createElement("span");a.className="highlight";var s=e.splitText(r),c=(s.splitText(o[0].length),s.cloneNode(!0));a.appendChild(c),s.parentNode.replaceChild(a,s),t=1}}else if(1===e.nodeType&&e.childNodes&&!/(script|style)/i.test(e.tagName)&&("highlight"!==e.className||"SPAN"!==e.tagName))for(var u=0;u/g,">").replace(/"/g,""")},D={};D.before=function(e,t,n){var i=e[t];e[t]=function(){return n.apply(e,arguments),i.apply(e,arguments)}},D.after=function(e,t,n){var i=e[t];e[t]=function(){var t=i.apply(e,arguments);return n.apply(e,arguments),t}};var x=function(e){var t=!1;return function(){t||(t=!0,e.apply(this,arguments))}},S=function(e,t){var n;return function(){var i=this,r=arguments;window.clearTimeout(n),n=window.setTimeout(function(){e.apply(i,r)},t)}},k=function(e,t,n){var i,r=e.trigger,o={};e.trigger=function(){var n=arguments[0];return t.indexOf(n)===-1?r.apply(e,arguments):void(o[n]=arguments)},n.apply(e,[]),e.trigger=r;for(i in o)o.hasOwnProperty(i)&&r.apply(e,o[i])},O=function(e,t,n,i){e.on(t,n,function(t){for(var n=t.target;n&&n.parentNode!==e[0];)n=n.parentNode;return t.currentTarget=n,i.apply(this,[t])})},C=function(e){var t={};if("selectionStart"in e)t.start=e.selectionStart,t.length=e.selectionEnd-t.start;else if(document.selection){e.focus();var n=document.selection.createRange(),i=document.selection.createRange().text.length;n.moveStart("character",-e.value.length),t.start=n.text.length-i,t.length=i}return t},E=function(e,t,n){var i,r,o={};if(n)for(i=0,r=n.length;i").css({position:"absolute",top:-99999,left:-99999,width:"auto",padding:0,whiteSpace:"pre"}).appendTo("body")),F.$testInput.text(t),E(n,F.$testInput,["letterSpacing","fontSize","fontFamily","fontWeight","textTransform"]),F.$testInput.width()):0},Y=function(e){var t=null,n=function(n,i){var r,o,a,s,c,u,l,d;n=n||window.event||{},i=i||{},n.metaKey||n.altKey||(i.force||e.data("grow")!==!1)&&(r=e.val(),n.type&&"keydown"===n.type.toLowerCase()&&(o=n.keyCode,a=o>=48&&o<=57||o>=65&&o<=90||o>=96&&o<=111||o>=186&&o<=222||32===o,o===M||o===m?(d=C(e[0]),d.length?r=r.substring(0,d.start)+r.substring(d.start+d.length):o===m&&d.start?r=r.substring(0,d.start-1)+r.substring(d.start+1):o===M&&"undefined"!=typeof d.start&&(r=r.substring(0,d.start)+r.substring(d.start+1))):a&&(u=n.shiftKey,l=String.fromCharCode(n.keyCode),l=u?l.toUpperCase():l.toLowerCase(),r+=l)),s=e.attr("placeholder"),!r&&s&&(r=s),c=N(r,e)+4,c!==t&&(t=c,e.width(c),e.triggerHandler("resize")))};e.on("keydown keyup update blur",n),n()},W=function(e){var t=document.createElement("div");return t.appendChild(e.cloneNode(!0)),t.innerHTML},B=function(e,t){t||(t={});var n="Selectize";console.error(n+": "+e),t.explanation&&(console.group&&console.group(),console.error(t.explanation),console.group&&console.groupEnd())},F=function(n,i){var r,o,a,s,c=this;s=n[0],s.selectize=c;var u=window.getComputedStyle&&window.getComputedStyle(s,null);if(a=u?u.getPropertyValue("direction"):s.currentStyle&&s.currentStyle.direction,a=a||n.parents("[dir]:first").attr("dir")||"",e.extend(c,{order:0,settings:i,$input:n,tabIndex:n.attr("tabindex")||"",tagType:"select"===s.tagName.toLowerCase()?y:A,rtl:/rtl/i.test(a),eventNS:".selectize"+ ++F.count,highlightedValue:null,isBlurring:!1,isOpen:!1,isDisabled:!1,isRequired:n.is("[required]"),isInvalid:!1,isLocked:!1,isFocused:!1,isInputHidden:!1,isSetup:!1,isShiftDown:!1,isCmdDown:!1,isCtrlDown:!1,ignoreFocus:!1,ignoreBlur:!1,ignoreHover:!1,hasOptions:!1,currentResults:null,lastValue:"",caretPos:0,loading:0,loadedSearches:{},$activeOption:null,$activeItems:[],optgroups:{},options:{},userOptions:{},items:[],renderCache:{},onSearchChange:null===i.loadThrottle?c.onSearchChange:S(c.onSearchChange,i.loadThrottle)}),c.sifter=new t(this.options,{diacritics:i.diacritics}),c.settings.options){for(r=0,o=c.settings.options.length;r").addClass(p.wrapperClass).addClass(u).addClass(c),n=e("").addClass(p.inputClass).addClass("items").appendTo(t),i=e('
').appendTo(n).attr("tabindex",b.is(":disabled")?"-1":h.tabIndex),s=e(p.dropdownParent||t),r=e("
").addClass(p.dropdownClass).addClass(c).hide().appendTo(s),a=e("
").addClass(p.dropdownContentClass).appendTo(r),(d=b.attr("id"))&&(i.attr("id",d+"-selectized"),e("label[for='"+d+"']").attr("for",d+"-selectized")),h.settings.copyClassesToDropdown&&r.addClass(u),t.css({width:b[0].style.width}),h.plugins.names.length&&(l="plugin-"+h.plugins.names.join(" plugin-"),t.addClass(l),r.addClass(l)),(null===p.maxItems||p.maxItems>1)&&h.tagType===y&&b.attr("multiple","multiple"),h.settings.placeholder&&i.attr("placeholder",p.placeholder),!h.settings.splitOn&&h.settings.delimiter){var A=h.settings.delimiter.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");h.settings.splitOn=new RegExp("\\s*"+A+"+\\s*")}b.attr("autocorrect")&&i.attr("autocorrect",b.attr("autocorrect")),b.attr("autocapitalize")&&i.attr("autocapitalize",b.attr("autocapitalize")),i[0].type=b[0].type,h.$wrapper=t,h.$control=n,h.$control_input=i,h.$dropdown=r,h.$dropdown_content=a,r.on("mouseenter mousedown click","[data-disabled]>[data-selectable]",function(e){e.stopImmediatePropagation()}),r.on("mouseenter","[data-selectable]",function(){return h.onOptionHover.apply(h,arguments)}),r.on("mousedown click","[data-selectable]",function(){return h.onOptionSelect.apply(h,arguments)}),O(n,"mousedown","*:not(input)",function(){return h.onItemSelect.apply(h,arguments)}),Y(i),n.on({mousedown:function(){return h.onMouseDown.apply(h,arguments)},click:function(){return h.onClick.apply(h,arguments)}}),i.on({mousedown:function(e){e.stopPropagation()},keydown:function(){return h.onKeyDown.apply(h,arguments)},keyup:function(){return h.onKeyUp.apply(h,arguments)},keypress:function(){return h.onKeyPress.apply(h,arguments)},resize:function(){h.positionDropdown.apply(h,[])},blur:function(){return h.onBlur.apply(h,arguments)},focus:function(){return h.ignoreBlur=!1,h.onFocus.apply(h,arguments)},paste:function(){return h.onPaste.apply(h,arguments)}}),M.on("keydown"+f,function(e){h.isCmdDown=e[o?"metaKey":"ctrlKey"],h.isCtrlDown=e[o?"altKey":"ctrlKey"],h.isShiftDown=e.shiftKey}),M.on("keyup"+f,function(e){e.keyCode===_&&(h.isCtrlDown=!1),e.keyCode===g&&(h.isShiftDown=!1),e.keyCode===v&&(h.isCmdDown=!1)}),M.on("mousedown"+f,function(e){if(h.isFocused){if(e.target===h.$dropdown[0]||e.target.parentNode===h.$dropdown[0])return!1;h.$control.has(e.target).length||e.target===h.$control[0]||h.blur(e.target)}}),m.on(["scroll"+f,"resize"+f].join(" "),function(){h.isOpen&&h.positionDropdown.apply(h,arguments)}),m.on("mousemove"+f,function(){h.ignoreHover=!1}),this.revertSettings={$children:b.children().detach(),tabindex:b.attr("tabindex")},b.attr("tabindex",-1).hide().after(h.$wrapper),e.isArray(p.items)&&(h.setValue(p.items),delete p.items),L&&b.on("invalid"+f,function(e){e.preventDefault(),h.isInvalid=!0,h.refreshState()}),h.updateOriginalInput(),h.refreshItems(),h.refreshState(),h.updatePlaceholder(),h.isSetup=!0,b.is(":disabled")&&h.disable(),h.on("change",this.onChange),b.data("selectize",h),b.addClass("selectized"),h.trigger("initialize"),p.preload===!0&&h.onSearchChange("")},setupTemplates:function(){var t=this,n=t.settings.labelField,i=t.settings.optgroupLabelField,r={optgroup:function(e){return'
'+e.html+"
"},optgroup_header:function(e,t){return'"},option:function(e,t){return'
'+t(e[n])+"
"},item:function(e,t){return'
'+t(e[n])+"
"},option_create:function(e,t){return'
Add '+t(e.input)+"…
"}};t.settings.render=e.extend({},r,t.settings.render)},setupCallbacks:function(){var e,t,n={initialize:"onInitialize",change:"onChange",item_add:"onItemAdd",item_remove:"onItemRemove",clear:"onClear",option_add:"onOptionAdd",option_remove:"onOptionRemove",option_clear:"onOptionClear",optgroup_add:"onOptionGroupAdd",optgroup_remove:"onOptionGroupRemove",optgroup_clear:"onOptionGroupClear",dropdown_open:"onDropdownOpen",dropdown_close:"onDropdownClose",type:"onType",load:"onLoad",focus:"onFocus",blur:"onBlur"};for(e in n)n.hasOwnProperty(e)&&(t=this.settings[n[e]],t&&this.on(e,t))},onClick:function(e){var t=this;t.isFocused&&t.isOpen||(t.focus(),e.preventDefault())},onMouseDown:function(t){var n=this,i=t.isDefaultPrevented();e(t.target);if(n.isFocused){if(t.target!==n.$control_input[0])return"single"===n.settings.mode?n.isOpen?n.close():n.open():i||n.setActiveItem(null),!1}else i||window.setTimeout(function(){n.focus()},0)},onChange:function(){this.$input.trigger("change")},onPaste:function(t){var n=this;return n.isFull()||n.isInputHidden||n.isLocked?void t.preventDefault():void(n.settings.splitOn&&setTimeout(function(){var t=n.$control_input.val();if(t.match(n.settings.splitOn))for(var i=e.trim(t).split(n.settings.splitOn),r=0,o=i.length;r
s&&(u=a,a=s,s=u),r=a;r<=s;r++)c=d.$control[0].childNodes[r],d.$activeItems.indexOf(c)===-1&&(e(c).addClass("active"),d.$activeItems.push(c));n.preventDefault()}else"mousedown"===i&&d.isCtrlDown||"keydown"===i&&this.isShiftDown?t.hasClass("active")?(o=d.$activeItems.indexOf(t[0]),d.$activeItems.splice(o,1),t.removeClass("active")):d.$activeItems.push(t.addClass("active")[0]):(e(d.$activeItems).removeClass("active"),d.$activeItems=[t.addClass("active")[0]]);d.hideInput(),this.isFocused||d.focus()}},setActiveOption:function(t,n,i){var r,o,a,s,c,u=this;u.$activeOption&&u.$activeOption.removeClass("active"),u.$activeOption=null,t=e(t),t.length&&(u.$activeOption=t.addClass("active"),!n&&T(n)||(r=u.$dropdown_content.height(),o=u.$activeOption.outerHeight(!0),n=u.$dropdown_content.scrollTop()||0,a=u.$activeOption.offset().top-u.$dropdown_content.offset().top+n,s=a,c=a-r+o,a+o>r+n?u.$dropdown_content.stop().animate({scrollTop:c},i?u.settings.scrollDuration:0):a=0;n--)o.items.indexOf(z(i.items[n].id))!==-1&&i.items.splice(n,1);return i},refreshOptions:function(t){var n,r,o,a,s,c,u,l,d,h,p,f,m,M,g,v;"undefined"==typeof t&&(t=!0);var _=this,b=e.trim(_.$control_input.val()),y=_.search(b),A=_.$dropdown_content,L=_.$activeOption&&z(_.$activeOption.attr("data-value"));for(a=y.items.length,"number"==typeof _.settings.maxOptions&&(a=Math.min(a,_.settings.maxOptions)),s={},c=[],n=0;n0||m,_.hasOptions?(y.items.length>0?(g=L&&_.getOption(L),g&&g.length?M=g:"single"===_.settings.mode&&_.items.length&&(M=_.getOption(_.items[0])),M&&M.length||(M=v&&!_.settings.addPrecedence?_.getAdjacentOption(v,1):A.find("[data-selectable]:first"))):M=v,_.setActiveOption(M),t&&!_.isOpen&&_.open()):(_.setActiveOption(null),t&&_.isOpen&&_.close())},addOption:function(t){var n,i,r,o=this;
-if(e.isArray(t))for(n=0,i=t.length;n=0&&r0),t.$control_input.data("grow",!n&&!i)},isFull:function(){return null!==this.settings.maxItems&&this.items.length>=this.settings.maxItems},updateOriginalInput:function(e){var t,n,i,r,o=this;if(e=e||{},o.tagType===y){for(i=[],t=0,n=o.items.length;t'+w(r)+"");i.length||this.$input.attr("multiple")||i.push(''),o.$input.html(i.join(""))}else o.$input.val(o.getValue()),o.$input.attr("value",o.$input.val());o.isSetup&&(e.silent||o.trigger("change",o.$input.val()))},updatePlaceholder:function(){if(this.settings.placeholder){var e=this.$control_input;this.items.length?e.removeAttr("placeholder"):e.attr("placeholder",this.settings.placeholder),e.triggerHandler("update",{force:!0})}},open:function(){var e=this;e.isLocked||e.isOpen||"multi"===e.settings.mode&&e.isFull()||(e.focus(),e.isOpen=!0,e.refreshState(),e.$dropdown.css({visibility:"hidden",display:"block"}),e.positionDropdown(),e.$dropdown.css({visibility:"visible"}),e.trigger("dropdown_open",e.$dropdown))},close:function(){var e=this,t=e.isOpen;"single"===e.settings.mode&&e.items.length&&(e.hideInput(),e.isBlurring||e.$control_input.blur()),e.isOpen=!1,e.$dropdown.hide(),e.setActiveOption(null),e.refreshState(),t&&e.trigger("dropdown_close",e.$dropdown)},positionDropdown:function(){var e=this.$control,t="body"===this.settings.dropdownParent?e.offset():e.position();t.top+=e.outerHeight(!0),this.$dropdown.css({width:e[0].getBoundingClientRect().width,top:t.top,left:t.left})},clear:function(e){var t=this;t.items.length&&(t.$control.children(":not(input)").remove(),t.items=[],t.lastQuery=null,t.setCaret(0),t.setActiveItem(null),t.updatePlaceholder(),t.updateOriginalInput({silent:e}),t.refreshState(),t.showInput(),t.trigger("clear"))},insertAtCaret:function(e){var t=Math.min(this.caretPos,this.items.length),n=e[0],i=this.buffer||this.$control[0];0===t?i.insertBefore(n,i.firstChild):i.insertBefore(n,i.childNodes[t]),this.setCaret(t+1)},deleteSelection:function(t){var n,i,r,o,a,s,c,u,l,d=this;if(r=t&&t.keyCode===m?-1:1,o=C(d.$control_input[0]),d.$activeOption&&!d.settings.hideSelected&&(c=d.getAdjacentOption(d.$activeOption,-1).attr("data-value")),a=[],d.$activeItems.length){for(l=d.$control.children(".active:"+(r>0?"last":"first")),s=d.$control.children(":not(input)").index(l),r>0&&s++,n=0,i=d.$activeItems.length;n0&&o.start===d.$control_input.val().length&&a.push(d.items[d.caretPos]));if(!a.length||"function"==typeof d.settings.onDelete&&d.settings.onDelete.apply(d,[a])===!1)return!1;for("undefined"!=typeof s&&d.setCaret(s);a.length;)d.removeItem(a.pop());return d.showInput(),d.positionDropdown(),d.refreshOptions(!0),c&&(u=d.getOption(c),u.length&&d.setActiveOption(u)),!0},advanceSelection:function(e,t){var n,i,r,o,a,s,c=this;0!==e&&(c.rtl&&(e*=-1),n=e>0?"last":"first",i=C(c.$control_input[0]),c.isFocused&&!c.isInputHidden?(o=c.$control_input.val().length,a=e<0?0===i.start&&0===i.length:i.start===o,a&&!o&&c.advanceCaret(e,t)):(s=c.$control.children(".active:"+n),s.length&&(r=c.$control.children(":not(input)").index(s),c.setActiveItem(null),c.setCaret(e>0?r+1:r))))},advanceCaret:function(e,t){var n,i,r=this;0!==e&&(n=e>0?"next":"prev",r.isShiftDown?(i=r.$control_input[n](),i.length&&(r.hideInput(),r.setActiveItem(i),t&&t.preventDefault())):r.setCaret(r.caretPos+e))},setCaret:function(t){var n=this;if(t="single"===n.settings.mode?n.items.length:Math.max(0,Math.min(n.items.length,t)),!n.isPending){var i,r,o,a;for(o=n.$control.children(":not(input)"),i=0,r=o.length;i'}},t),n.setup=function(){var i=n.setup;return function(){i.apply(n,arguments),n.$dropdown_header=e(t.html(t)),n.$dropdown.prepend(n.$dropdown_header)}}()}),F.define("optgroup_columns",function(t){var n=this;t=e.extend({equalizeWidth:!0,equalizeHeight:!0},t),this.getAdjacentOption=function(t,n){var i=t.closest("[data-group]").find("[data-selectable]"),r=i.index(t)+n;return r>=0&&r
',e=e.firstChild,n.body.appendChild(e),t=i.width=e.offsetWidth-e.clientWidth,n.body.removeChild(e)),t},r=function(){var r,o,a,s,c,u,l;if(l=e("[data-group]",n.$dropdown_content),o=l.length,o&&n.$dropdown_content.width()){if(t.equalizeHeight){for(a=0,r=0;r
1&&(c=u-s*(o-1),l.eq(o-1).css({width:c})))}};(t.equalizeHeight||t.equalizeWidth)&&(D.after(this,"positionDropdown",r),D.after(this,"refreshOptions",r))}),F.define("remove_button",function(t){t=e.extend({label:"×",title:"Remove",className:"remove",append:!0},t);var n=function(t,n){n.className="remove-single";var i=t,r=''+n.label+"",o=function(t,n){return e("").append(t).append(n)};t.setup=function(){var a=i.setup;return function(){if(n.append){var s=e(i.$input.context).attr("id"),c=(e("#"+s),i.settings.render.item);i.settings.render.item=function(e){return o(c.apply(t,arguments),r)}}a.apply(t,arguments),t.$control.on("click","."+n.className,function(e){e.preventDefault(),i.isLocked||i.clear()})}}()},i=function(t,n){var i=t,r=''+n.label+"",o=function(e,t){var n=e.search(/(<\/[^>]+>\s*)$/);return e.substring(0,n)+t+e.substring(n)};t.setup=function(){var a=i.setup;return function(){if(n.append){var s=i.settings.render.item;i.settings.render.item=function(e){return o(s.apply(t,arguments),r)}}a.apply(t,arguments),t.$control.on("click","."+n.className,function(t){if(t.preventDefault(),!i.isLocked){var n=e(t.currentTarget).parent();i.setActiveItem(n),i.deleteSelection()&&i.setCaret(i.items.length)}})}}()};return"single"===this.settings.mode?void n(this,t):void i(this,t)}),F.define("restore_on_backspace",function(e){var t=this;e.text=e.text||function(e){return e[this.settings.labelField]},this.onKeyDown=function(){var n=t.onKeyDown;return function(t){var i,r;return t.keyCode===m&&""===this.$control_input.val()&&!this.$activeItems.length&&(i=this.caretPos-1,i>=0&&i0)&&i.items.push({score:n,id:r})}):a.iterator(a.items,function(e,t){i.items.push({score:1,id:t})}),r=a.getSortFunction(i,t),r&&i.items.sort(r),i.total=i.items.length,"number"==typeof t.limit&&(i.items=i.items.slice(0,t.limit)),i};var t=function(e,t){return"number"==typeof e&&"number"==typeof t?e>t?1:et?1:t>e?-1:0)},n=function(e,t){var n,i,r,o;for(n=1,i=arguments.length;n=0||(r[n]=e[n]);return r}function o(e,t){if(null==e)return{};var n,i,o=r(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function a(e){return s(e)||c(e)||u()}function s(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t"===t[0]&&(t=t.substring(1)),e)try{if(e.matches)return e.matches(t);if(e.msMatchesSelector)return e.msMatchesSelector(t);if(e.webkitMatchesSelector)return e.webkitMatchesSelector(t)}catch(e){return!1}return!1}}function f(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function m(e,t,n,i){if(e){n=n||document;do{if(null!=t&&(">"===t[0]?e.parentNode===n&&p(e,t):p(e,t))||i&&e===n)return e;if(e===n)break}while(e=f(e))}return null}function M(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var i=(" "+e.className+" ").replace(Re," ").replace(" "+t+" "," ");e.className=(i+(n?" "+t:"")).replace(Re," ")}}function g(e,t,n){var i=e&&e.style;if(i){if(void 0===n)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(e,""):e.currentStyle&&(n=e.currentStyle),void 0===t?n:n[t];t in i||t.indexOf("webkit")!==-1||(t="-webkit-"+t),i[t]=n+("string"==typeof n?"":"px")}}function v(e,t){var n="";if("string"==typeof e)n=e;else do{var i=g(e,"transform");i&&"none"!==i&&(n=i+" "+n)}while(!t&&(e=e.parentNode));var r=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return r&&new r(n)}function _(e,t,n){if(e){var i=e.getElementsByTagName(t),r=0,o=i.length;if(n)for(;r=o:r<=o,!a)return i;if(i===b())break;i=T(i,!1)}return!1}function L(e,t,n){for(var i=0,r=0,o=e.children;rli":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return lt(e,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(e,t){e.setData("Text",t.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:H.supportPointer!==!1&&"PointerEvent"in window,emptyInsertThreshold:5};$e.initializePlugins(this,e,i);for(var r in i)!(r in t)&&(t[r]=i[r]);pt(t);for(var o in this)"_"===o.charAt(0)&&"function"==typeof this[o]&&(this[o]=this[o].bind(this));this.nativeDraggable=!t.forceFallback&&ct,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?d(e,"pointerdown",this._onTapStart):(d(e,"mousedown",this._onTapStart),d(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(d(e,"dragover",this),d(e,"dragenter",this)),Ze.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),n(this,B())}function j(e){e.dataTransfer&&(e.dataTransfer.dropEffect="move"),e.cancelable&&e.preventDefault()}function I(e,t,n,i,r,o,a,s){var c,u,l=e[Ue],d=l.options.onMove;return!window.CustomEvent||qe||Fe?(c=document.createEvent("Event"),c.initEvent("move",!0,!0)):c=new CustomEvent("move",{bubbles:!0,cancelable:!0}),c.to=t,c.from=e,c.dragged=n,c.draggedRect=i,c.related=r||t,c.relatedRect=o||y(t),c.willInsertAfter=s,c.originalEvent=a,e.dispatchEvent(c),d&&(u=d.call(l,c,a)),u}function R(e){e.draggable=!1}function U(){it=!1}function J(e,t,n){var i=y(w(n.el,n.options.draggable)),r=10;return t?e.clientX>i.right+r||e.clientX<=i.right&&e.clientY>i.bottom&&e.clientX>=i.left:e.clientX>i.right&&e.clientY>i.top||e.clientX<=i.right&&e.clientY>i.bottom+r}function G(e,t,n,i,r,o,a,s){var c=i?e.clientY:e.clientX,u=i?n.height:n.width,l=i?n.top:n.left,d=i?n.bottom:n.right,h=!1;if(!a)if(s&&Yel+u*o/2:cd-Ye)return-Ne}else if(c>l+u*(1-r)/2&&cd-u*o/2)?c>l+u/2?1:-1:0}function $(e){return D(he)1&&(Nt.forEach(function(e){i.addAnimationState({target:e,rect:Bt?y(e):r}),W(e),e.fromRect=r,t.removeAnimationState(e)}),Bt=!1,ce(!this.options.removeCloneOnHide,n))},dragOverCompleted:function(e){var t=e.sortable,n=e.isOwner,i=e.insertion,r=e.activeSortable,o=e.parentEl,a=e.putSortable,s=this.options;if(i){if(n&&r._hideClone(),Wt=!1,s.animation&&Nt.length>1&&(Bt||!n&&!r.options.sort&&!a)){var c=y(Ot,!1,!0,!0);Nt.forEach(function(e){e!==Ot&&(Y(e,c),o.appendChild(e))}),Bt=!0}if(!n)if(Bt||le(),Nt.length>1){var u=Et;r._showClone(t),r.options.animation&&!Et&&u&&Yt.forEach(function(e){r.addAnimationState({target:e,rect:Ct}),e.fromRect=Ct,e.thisAnimationDuration=null})}else r._showClone(t)}},dragOverAnimationCapture:function(e){var t=e.dragRect,i=e.isOwner,r=e.activeSortable;if(Nt.forEach(function(e){e.thisAnimationDuration=null}),r.options.animation&&!i&&r.multiDrag.isMultiDrag){Ct=n({},t);var o=v(Ot,!0);Ct.top-=o.f,Ct.left-=o.e}},dragOverAnimationComplete:function(){Bt&&(Bt=!1,le())},drop:function(e){var t=e.originalEvent,n=e.rootEl,i=e.parentEl,r=e.sortable,o=e.dispatchSortableEvent,a=e.oldIndex,s=e.putSortable,c=s||this.sortable;if(t){var u=this.options,l=i.children;if(!qt)if(u.multiDragKey&&!this.multiDragKeyDown&&this._deselectMultiDrag(),M(Ot,u.selectedClass,!~Nt.indexOf(Ot)),~Nt.indexOf(Ot))Nt.splice(Nt.indexOf(Ot),1),St=null,X({sortable:r,rootEl:n,name:"deselect",targetEl:Ot,originalEvt:t});else{if(Nt.push(Ot),X({sortable:r,rootEl:n,name:"select",targetEl:Ot,originalEvt:t}),t.shiftKey&&St&&r.el.contains(St)){var d=D(St),h=D(Ot);if(~d&&~h&&d!==h){var p,f;for(h>d?(f=d,p=h):(f=h,p=d+1);f1){var m=y(Ot),g=D(Ot,":not(."+this.options.selectedClass+")");if(!Wt&&u.animation&&(Ot.thisAnimationDuration=null),c.captureAnimationState(),!Wt&&(u.animation&&(Ot.fromRect=m,Nt.forEach(function(e){if(e.thisAnimationDuration=null,e!==Ot){var t=Bt?y(e):m;e.fromRect=t,c.addAnimationState({target:e,rect:t})}})),le(),Nt.forEach(function(e){l[g]?i.insertBefore(e,l[g]):i.appendChild(e),g++}),a===D(Ot))){var v=!1;Nt.forEach(function(e){if(e.sortableIndex!==D(e))return void(v=!0)}),v&&o("update")}Nt.forEach(function(e){W(e)}),c.animateAll()}kt=c}(n===i||s&&"clone"!==s.lastPutMode)&&Yt.forEach(function(e){e.parentNode&&e.parentNode.removeChild(e)})}},nullingGlobal:function(){this.isMultiDrag=qt=!1,Yt.length=0},destroyGlobal:function(){this._deselectMultiDrag(),h(document,"pointerup",this._deselectMultiDrag),h(document,"mouseup",this._deselectMultiDrag),h(document,"touchend",this._deselectMultiDrag),h(document,"keydown",this._checkKeyDown),h(document,"keyup",this._checkKeyUp)},_deselectMultiDrag:function(e){if(!("undefined"!=typeof qt&&qt||kt!==this.sortable||e&&m(e.target,this.options.draggable,this.sortable.el,!1)||e&&0!==e.button))for(;Nt.length;){var t=Nt[0];M(t,this.options.selectedClass,!1),Nt.shift(),X({sortable:this.sortable,rootEl:this.sortable.el,name:"deselect",targetEl:t,originalEvt:e})}},_checkKeyDown:function(e){e.key===this.options.multiDragKey&&(this.multiDragKeyDown=!0)},_checkKeyUp:function(e){e.key===this.options.multiDragKey&&(this.multiDragKeyDown=!1)}},n(e,{pluginName:"multiDrag",utils:{select:function(e){var t=e.parentNode[Ue];t&&t.options.multiDrag&&!~Nt.indexOf(e)&&(kt&&kt!==t&&(kt.multiDrag._deselectMultiDrag(),kt=t),M(e,t.options.selectedClass,!0),Nt.push(e))},deselect:function(e){var t=e.parentNode[Ue],n=Nt.indexOf(e);t&&t.options.multiDrag&&~n&&(M(e,t.options.selectedClass,!1),Nt.splice(n,1))}},eventProperties:function(){var e=this,t=[],n=[];return Nt.forEach(function(i){t.push({multiDragElement:i,index:i.sortableIndex});var r;r=Bt&&i!==Ot?-1:Bt?D(i,":not(."+e.options.selectedClass+")"):D(i),n.push({multiDragElement:i,index:r})}),{items:a(Nt),clones:[].concat(Yt),oldIndicies:t,newIndicies:n}},optionListeners:{multiDragKey:function(e){return e=e.toLowerCase(),"ctrl"===e?e="Control":e.length>1&&(e=e.charAt(0).toUpperCase()+e.substr(1)),e}}})}function ce(e,t){Nt.forEach(function(n,i){var r=t.children[n.sortableIndex+(e?Number(i):0)];r?t.insertBefore(n,r):t.appendChild(n)})}function ue(e,t){Yt.forEach(function(n,i){var r=t.children[n.sortableIndex+(e?Number(i):0)];r?t.insertBefore(n,r):t.appendChild(n)})}function le(){Nt.forEach(function(e){e!==Ot&&e.parentNode&&e.parentNode.removeChild(e)})}var de,he,pe,fe,me,Me,ge,ve,_e,be,ye,Ae,Le,we,De,xe,ze,Te,Se,ke,Oe,Ce,Ee,Ne,Ye,We,Be="1.10.2",qe=l(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Fe=l(/Edge/i),Xe=l(/firefox/i),Pe=l(/safari/i)&&!l(/chrome/i)&&!l(/android/i),He=l(/iP(ad|od|hone)/i),je=l(/chrome/i)&&l(/android/i),Ie={capture:!1,passive:!1},Re=/\s+/g,Ue="Sortable"+(new Date).getTime(),Je=[],Ge={initializeByDefault:!0},$e={mount:function(e){for(var t in Ge)!Ge.hasOwnProperty(t)||t in e||(e[t]=Ge[t]);Je.push(e)},pluginEvent:function(e,t,n){var r=this;this.eventCanceled=!1,n.cancel=function(){r.eventCanceled=!0};var o=e+"Global";Je.forEach(function(r){t[r.pluginName]&&(t[r.pluginName][o]&&t[r.pluginName][o](i({sortable:t},n)),t.options[r.pluginName]&&t[r.pluginName][e]&&t[r.pluginName][e](i({sortable:t},n)))})},initializePlugins:function(e,t,i,r){Je.forEach(function(r){var o=r.pluginName;if(e.options[o]||r.initializeByDefault){var a=new r(e,t,e.options);a.sortable=e,a.options=e.options,e[o]=a,n(i,a.defaults)}});for(var o in e.options)if(e.options.hasOwnProperty(o)){var a=this.modifyOption(e,o,e.options[o]);"undefined"!=typeof a&&(e.options[o]=a)}},getEventProperties:function(e,t){var i={};return Je.forEach(function(r){"function"==typeof r.eventProperties&&n(i,r.eventProperties.call(t[r.pluginName],e))}),i},modifyOption:function(e,t,n){var i;return Je.forEach(function(r){e[r.pluginName]&&r.optionListeners&&"function"==typeof r.optionListeners[t]&&(i=r.optionListeners[t].call(e[r.pluginName],n))}),i}},Ke=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.evt,a=o(n,["evt"]);$e.pluginEvent.bind(H)(e,t,i({dragEl:he,parentEl:pe,ghostEl:fe,rootEl:me,nextEl:Me,lastDownEl:ge,cloneEl:ve,cloneHidden:_e,dragStarted:Ce,putSortable:De,activeSortable:H.active,originalEvent:r,oldIndex:be,oldDraggableIndex:Ae,newIndex:ye,newDraggableIndex:Le,hideGhostForTarget:ft,unhideGhostForTarget:mt,cloneNowHidden:function(){_e=!0},cloneNowShown:function(){_e=!1},dispatchSortableEvent:function(e){P({sortable:t,name:e,originalEvent:r})}},a))},Ve=!1,Qe=!1,Ze=[],et=!1,tt=!1,nt=[],it=!1,rt=[],ot="undefined"!=typeof document,at=He,st=Fe||qe?"cssFloat":"float",ct=ot&&!je&&!He&&"draggable"in document.createElement("div"),ut=function(){if(ot){if(qe)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}}(),lt=function(e,t){var n=g(e),i=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),r=L(e,0,t),o=L(e,1,t),a=r&&g(r),s=o&&g(o),c=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+y(r).width,u=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+y(o).width;if("flex"===n.display)return"column"===n.flexDirection||"column-reverse"===n.flexDirection?"vertical":"horizontal";if("grid"===n.display)return n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(r&&a.float&&"none"!==a.float){var l="left"===a.float?"left":"right";return!o||"both"!==s.clear&&s.clear!==l?"horizontal":"vertical"}return r&&("block"===a.display||"flex"===a.display||"table"===a.display||"grid"===a.display||c>=i&&"none"===n[st]||o&&"none"===n[st]&&c+u>i)?"vertical":"horizontal"},dt=function(e,t,n){var i=n?e.left:e.top,r=n?e.right:e.bottom,o=n?e.width:e.height,a=n?t.left:t.top,s=n?t.right:t.bottom,c=n?t.width:t.height;return i===a||r===s||i+o/2===a+c/2},ht=function(e,t){var n;return Ze.some(function(i){if(!w(i)){var r=y(i),o=i[Ue].options.emptyInsertThreshold,a=e>=r.left-o&&e<=r.right+o,s=t>=r.top-o&&t<=r.bottom+o;return o&&a&&s?n=i:void 0}}),n},pt=function(t){function n(e,t){return function(i,r,o,a){var s=i.options.group.name&&r.options.group.name&&i.options.group.name===r.options.group.name;if(null==e&&(t||s))return!0;if(null==e||e===!1)return!1;if(t&&"clone"===e)return e;if("function"==typeof e)return n(e(i,r,o,a),t)(i,r,o,a);var c=(t?i:r).options.group.name;return e===!0||"string"==typeof e&&e===c||e.join&&e.indexOf(c)>-1}}var i={},r=t.group;r&&"object"==e(r)||(r={name:r}),i.name=r.name,i.checkPull=n(r.pull,!0),i.checkPut=n(r.put),i.revertClone=r.revertClone,t.group=i},ft=function(){!ut&&fe&&g(fe,"display","none")},mt=function(){!ut&&fe&&g(fe,"display","")};ot&&document.addEventListener("click",function(e){if(Qe)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),Qe=!1,!1},!0);var Mt=function(e){if(he){e=e.touches?e.touches[0]:e;var t=ht(e.clientX,e.clientY);if(t){var n={};for(var i in e)e.hasOwnProperty(i)&&(n[i]=e[i]);n.target=n.rootEl=t,n.preventDefault=void 0,n.stopPropagation=void 0,t[Ue]._onDragOver(n)}}},gt=function(e){he&&he.parentNode[Ue]._isOutsideThisEl(e.target)};H.prototype={constructor:H,_isOutsideThisEl:function(e){this.el.contains(e)||e===this.el||(Ee=null)},_getDirection:function(e,t){return"function"==typeof this.options.direction?this.options.direction.call(this,e,t,he):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,n=this.el,i=this.options,r=i.preventOnFilter,o=e.type,a=e.touches&&e.touches[0]||e.pointerType&&"touch"===e.pointerType&&e,s=(a||e).target,c=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||s,u=i.filter;if(V(n),!he&&!(/mousedown|pointerdown/.test(o)&&0!==e.button||i.disabled||c.isContentEditable||(s=m(s,i.draggable,n,!1),s&&s.animated||ge===s))){if(be=D(s),Ae=D(s,i.draggable),"function"==typeof u){if(u.call(this,e,s,this))return P({sortable:t,rootEl:c,name:"filter",targetEl:s,toEl:n,fromEl:n}),Ke("filter",t,{evt:e}),void(r&&e.cancelable&&e.preventDefault())}else if(u&&(u=u.split(",").some(function(i){if(i=m(c,i.trim(),n,!1))return P({sortable:t,rootEl:i,name:"filter",targetEl:s,fromEl:n,toEl:n}),Ke("filter",t,{evt:e}),!0})))return void(r&&e.cancelable&&e.preventDefault());i.handle&&!m(c,i.handle,n,!1)||this._prepareDragStart(e,a,s)}}},_prepareDragStart:function(e,t,n){var i,r=this,o=r.el,a=r.options,s=o.ownerDocument;if(n&&!he&&n.parentNode===o){var c=y(n);if(me=o,he=n,pe=he.parentNode,Me=he.nextSibling,ge=n,we=a.group,H.dragged=he,xe={target:he,clientX:(t||e).clientX,clientY:(t||e).clientY},ke=xe.clientX-c.left,Oe=xe.clientY-c.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,he.style["will-change"]="all",i=function(){return Ke("delayEnded",r,{evt:e}),H.eventCanceled?void r._onDrop():(r._disableDelayedDragEvents(),!Xe&&r.nativeDraggable&&(he.draggable=!0),r._triggerDragStart(e,t),P({sortable:r,name:"choose",originalEvent:e}),void M(he,a.chosenClass,!0))},a.ignore.split(",").forEach(function(e){_(he,e.trim(),R)}),d(s,"dragover",Mt),d(s,"mousemove",Mt),d(s,"touchmove",Mt),d(s,"mouseup",r._onDrop),d(s,"touchend",r._onDrop),d(s,"touchcancel",r._onDrop),Xe&&this.nativeDraggable&&(this.options.touchStartThreshold=4,he.draggable=!0),Ke("delayStart",this,{evt:e}),!a.delay||a.delayOnTouchOnly&&!t||this.nativeDraggable&&(Fe||qe))i();else{if(H.eventCanceled)return void this._onDrop();d(s,"mouseup",r._disableDelayedDrag),d(s,"touchend",r._disableDelayedDrag),d(s,"touchcancel",r._disableDelayedDrag),d(s,"mousemove",r._delayedDragTouchMoveHandler),d(s,"touchmove",r._delayedDragTouchMoveHandler),a.supportPointer&&d(s,"pointermove",r._delayedDragTouchMoveHandler),r._dragStartTimer=setTimeout(i,a.delay)}}},_delayedDragTouchMoveHandler:function(e){var t=e.touches?e.touches[0]:e;Math.max(Math.abs(t.clientX-this._lastX),Math.abs(t.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){he&&R(he),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;h(e,"mouseup",this._disableDelayedDrag),h(e,"touchend",this._disableDelayedDrag),h(e,"touchcancel",this._disableDelayedDrag),h(e,"mousemove",this._delayedDragTouchMoveHandler),h(e,"touchmove",this._delayedDragTouchMoveHandler),h(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?this.options.supportPointer?d(document,"pointermove",this._onTouchMove):t?d(document,"touchmove",this._onTouchMove):d(document,"mousemove",this._onTouchMove):(d(he,"dragend",this),d(me,"dragstart",this._onDragStart));try{document.selection?Q(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){if(Ve=!1,me&&he){Ke("dragStarted",this,{evt:t}),this.nativeDraggable&&d(document,"dragover",gt);var n=this.options;!e&&M(he,n.dragClass,!1),M(he,n.ghostClass,!0),H.active=this,e&&this._appendGhost(),P({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(ze){this._lastX=ze.clientX,this._lastY=ze.clientY,ft();for(var e=document.elementFromPoint(ze.clientX,ze.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(ze.clientX,ze.clientY),e!==t);)t=e;if(he.parentNode[Ue]._isOutsideThisEl(e),t)do{if(t[Ue]){var n=void 0;if(n=t[Ue]._onDragOver({clientX:ze.clientX,clientY:ze.clientY,target:e,rootEl:t}),n&&!this.options.dragoverBubble)break}e=t}while(t=t.parentNode);mt()}},_onTouchMove:function(e){if(xe){var t=this.options,n=t.fallbackTolerance,i=t.fallbackOffset,r=e.touches?e.touches[0]:e,o=fe&&v(fe,!0),a=fe&&o&&o.a,s=fe&&o&&o.d,c=at&&We&&x(We),u=(r.clientX-xe.clientX+i.x)/(a||1)+(c?c[0]-nt[0]:0)/(a||1),l=(r.clientY-xe.clientY+i.y)/(s||1)+(c?c[1]-nt[1]:0)/(s||1);if(!H.active&&!Ve){if(n&&Math.max(Math.abs(r.clientX-this._lastX),Math.abs(r.clientY-this._lastY))=0&&(P({rootEl:pe,name:"add",toEl:pe,fromEl:me,originalEvent:e}),P({sortable:this,name:"remove",toEl:pe,originalEvent:e}),P({rootEl:pe,name:"sort",toEl:pe,fromEl:me,originalEvent:e}),P({sortable:this,name:"sort",toEl:pe,originalEvent:e})),De&&De.save()):ye!==be&&ye>=0&&(P({sortable:this,name:"update",toEl:pe,originalEvent:e}),P({sortable:this,name:"sort",toEl:pe,originalEvent:e})),H.active&&(null!=ye&&ye!==-1||(ye=be,Le=Ae),P({sortable:this,name:"end",toEl:pe,originalEvent:e}),this.save()))),void this._nulling())},_nulling:function(){Ke("nulling",this),me=he=pe=fe=Me=ve=ge=_e=xe=ze=Ce=ye=Le=be=Ae=Ee=Ne=De=we=H.dragged=H.ghost=H.clone=H.active=null,rt.forEach(function(e){e.checked=!0}),rt.length=Te=Se=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":he&&(this._onDragOver(e),j(e));break;case"selectstart":e.preventDefault()}},toArray:function(){for(var e,t=[],n=this.el.children,i=0,r=n.length,o=this.options;i=0&&e.data.length>0){var o=e.data.match(n),a=document.createElement("span");a.className="highlight";var s=e.splitText(r),c=(s.splitText(o[0].length),s.cloneNode(!0));a.appendChild(c),s.parentNode.replaceChild(a,s),t=1}}else if(1===e.nodeType&&e.childNodes&&!/(script|style)/i.test(e.tagName)&&("highlight"!==e.className||"SPAN"!==e.tagName))for(var u=0;u/g,">").replace(/"/g,""")},z={};z.before=function(e,t,n){var i=e[t];e[t]=function(){return n.apply(e,arguments),i.apply(e,arguments)}},z.after=function(e,t,n){var i=e[t];e[t]=function(){var t=i.apply(e,arguments);return n.apply(e,arguments),t}};var T=function(e){var t=!1;return function(){t||(t=!0,e.apply(this,arguments))}},S=function(e,t){var n;return function(){var i=this,r=arguments;window.clearTimeout(n),n=window.setTimeout(function(){e.apply(i,r)},t)}},k=function(e,t,n){var i,r=e.trigger,o={};e.trigger=function(){var n=arguments[0];return t.indexOf(n)===-1?r.apply(e,arguments):void(o[n]=arguments)},n.apply(e,[]),e.trigger=r;for(i in o)o.hasOwnProperty(i)&&r.apply(e,o[i])},O=function(e,t,n,i){e.on(t,n,function(t){for(var n=t.target;n&&n.parentNode!==e[0];)n=n.parentNode;return t.currentTarget=n,i.apply(this,[t])})},C=function(e){var t={};if("selectionStart"in e)t.start=e.selectionStart,t.length=e.selectionEnd-t.start;else if(document.selection){e.focus();var n=document.selection.createRange(),i=document.selection.createRange().text.length;n.moveStart("character",-e.value.length),t.start=n.text.length-i,t.length=i}return t},E=function(e,t,n){var i,r,o={};if(n)for(i=0,r=n.length;i").css({position:"absolute",top:-99999,left:-99999,width:"auto",padding:0,whiteSpace:"pre"}).appendTo("body")),q.$testInput.text(t),E(n,q.$testInput,["letterSpacing","fontSize","fontFamily","fontWeight","textTransform"]),q.$testInput.width()):0},Y=function(e){var t=null,n=function(n,i){var r,o,a,s,c,u,l,d;n=n||window.event||{},i=i||{},n.metaKey||n.altKey||(i.force||e.data("grow")!==!1)&&(r=e.val(),n.type&&"keydown"===n.type.toLowerCase()&&(o=n.keyCode,a=o>=48&&o<=57||o>=65&&o<=90||o>=96&&o<=111||o>=186&&o<=222||32===o,o===M||o===m?(d=C(e[0]),d.length?r=r.substring(0,d.start)+r.substring(d.start+d.length):o===m&&d.start?r=r.substring(0,d.start-1)+r.substring(d.start+1):o===M&&"undefined"!=typeof d.start&&(r=r.substring(0,d.start)+r.substring(d.start+1))):a&&(u=n.shiftKey,l=String.fromCharCode(n.keyCode),l=u?l.toUpperCase():l.toLowerCase(),r+=l)),s=e.attr("placeholder"),!r&&s&&(r=s),c=N(r,e)+4,c!==t&&(t=c,e.width(c),e.triggerHandler("resize")))};e.on("keydown keyup update blur",n),n()},W=function(e){var t=document.createElement("div");return t.appendChild(e.cloneNode(!0)),t.innerHTML},B=function(e,t){t||(t={});var n="Selectize";console.error(n+": "+e),t.explanation&&(console.group&&console.group(),console.error(t.explanation),console.group&&console.groupEnd())},q=function(n,i){var r,o,a,s,c=this;s=n[0],s.selectize=c;var u=window.getComputedStyle&&window.getComputedStyle(s,null);if(a=u?u.getPropertyValue("direction"):s.currentStyle&&s.currentStyle.direction,a=a||n.parents("[dir]:first").attr("dir")||"",e.extend(c,{order:0,settings:i,$input:n,tabIndex:n.attr("tabindex")||"",tagType:"select"===s.tagName.toLowerCase()?y:A,rtl:/rtl/i.test(a),eventNS:".selectize"+ ++q.count,highlightedValue:null,isBlurring:!1,isOpen:!1,isDisabled:!1,isRequired:n.is("[required]"),isInvalid:!1,isLocked:!1,isFocused:!1,isInputHidden:!1,isSetup:!1,isShiftDown:!1,isCmdDown:!1,isCtrlDown:!1,ignoreFocus:!1,ignoreBlur:!1,ignoreHover:!1,hasOptions:!1,currentResults:null,lastValue:"",caretPos:0,loading:0,loadedSearches:{},$activeOption:null,$activeItems:[],optgroups:{},options:{},userOptions:{},items:[],renderCache:{},onSearchChange:null===i.loadThrottle?c.onSearchChange:S(c.onSearchChange,i.loadThrottle)}),c.sifter=new t(this.options,{diacritics:i.diacritics}),c.settings.options){for(r=0,o=c.settings.options.length;r").addClass(p.wrapperClass).addClass(u).addClass(c),n=e("").addClass(p.inputClass).addClass("items").appendTo(t),i=e('
').appendTo(n).attr("tabindex",b.is(":disabled")?"-1":h.tabIndex),s=e(p.dropdownParent||t),r=e("
").addClass(p.dropdownClass).addClass(c).hide().appendTo(s),a=e("
").addClass(p.dropdownContentClass).appendTo(r),(d=b.attr("id"))&&(i.attr("id",d+"-selectized"),e("label[for='"+d+"']").attr("for",d+"-selectized")),h.settings.copyClassesToDropdown&&r.addClass(u),t.css({width:b[0].style.width}),h.plugins.names.length&&(l="plugin-"+h.plugins.names.join(" plugin-"),t.addClass(l),r.addClass(l)),(null===p.maxItems||p.maxItems>1)&&h.tagType===y&&b.attr("multiple","multiple"),h.settings.placeholder&&i.attr("placeholder",p.placeholder),!h.settings.splitOn&&h.settings.delimiter){var A=h.settings.delimiter.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");h.settings.splitOn=new RegExp("\\s*"+A+"+\\s*")}b.attr("autocorrect")&&i.attr("autocorrect",b.attr("autocorrect")),b.attr("autocapitalize")&&i.attr("autocapitalize",b.attr("autocapitalize")),i[0].type=b[0].type,h.$wrapper=t,h.$control=n,h.$control_input=i,h.$dropdown=r,h.$dropdown_content=a,r.on("mouseenter mousedown click","[data-disabled]>[data-selectable]",function(e){e.stopImmediatePropagation()}),r.on("mouseenter","[data-selectable]",function(){return h.onOptionHover.apply(h,arguments)}),r.on("mousedown click","[data-selectable]",function(){return h.onOptionSelect.apply(h,arguments)}),O(n,"mousedown","*:not(input)",function(){return h.onItemSelect.apply(h,arguments)}),Y(i),n.on({mousedown:function(){return h.onMouseDown.apply(h,arguments)},click:function(){return h.onClick.apply(h,arguments)}}),i.on({mousedown:function(e){e.stopPropagation()},keydown:function(){return h.onKeyDown.apply(h,arguments)},keyup:function(){return h.onKeyUp.apply(h,arguments)},keypress:function(){return h.onKeyPress.apply(h,arguments)},resize:function(){h.positionDropdown.apply(h,[])},blur:function(){return h.onBlur.apply(h,arguments)},focus:function(){return h.ignoreBlur=!1,h.onFocus.apply(h,arguments)},paste:function(){return h.onPaste.apply(h,arguments)}}),M.on("keydown"+f,function(e){h.isCmdDown=e[o?"metaKey":"ctrlKey"],h.isCtrlDown=e[o?"altKey":"ctrlKey"],h.isShiftDown=e.shiftKey}),M.on("keyup"+f,function(e){e.keyCode===_&&(h.isCtrlDown=!1),e.keyCode===g&&(h.isShiftDown=!1),e.keyCode===v&&(h.isCmdDown=!1)}),M.on("mousedown"+f,function(e){if(h.isFocused){if(e.target===h.$dropdown[0]||e.target.parentNode===h.$dropdown[0])return!1;h.$control.has(e.target).length||e.target===h.$control[0]||h.blur(e.target)}}),m.on(["scroll"+f,"resize"+f].join(" "),function(){h.isOpen&&h.positionDropdown.apply(h,arguments)}),m.on("mousemove"+f,function(){h.ignoreHover=!1}),this.revertSettings={$children:b.children().detach(),tabindex:b.attr("tabindex")},b.attr("tabindex",-1).hide().after(h.$wrapper),e.isArray(p.items)&&(h.setValue(p.items),delete p.items),L&&b.on("invalid"+f,function(e){e.preventDefault(),h.isInvalid=!0,h.refreshState()}),h.updateOriginalInput(),h.refreshItems(),h.refreshState(),h.updatePlaceholder(),h.isSetup=!0,b.is(":disabled")&&h.disable(),h.on("change",this.onChange),b.data("selectize",h),b.addClass("selectized"),h.trigger("initialize"),p.preload===!0&&h.onSearchChange("")},setupTemplates:function(){var t=this,n=t.settings.labelField,i=t.settings.optgroupLabelField,r={optgroup:function(e){return'
'+e.html+"
"},optgroup_header:function(e,t){return'"},option:function(e,t){return'
'+t(e[n])+"
"},item:function(e,t){return'
'+t(e[n])+"
"},option_create:function(e,t){return'
Add '+t(e.input)+"…
"}};t.settings.render=e.extend({},r,t.settings.render)},setupCallbacks:function(){var e,t,n={initialize:"onInitialize",change:"onChange",item_add:"onItemAdd",item_remove:"onItemRemove",clear:"onClear",option_add:"onOptionAdd",option_remove:"onOptionRemove",option_clear:"onOptionClear",optgroup_add:"onOptionGroupAdd",optgroup_remove:"onOptionGroupRemove",optgroup_clear:"onOptionGroupClear",dropdown_open:"onDropdownOpen",dropdown_close:"onDropdownClose",type:"onType",load:"onLoad",focus:"onFocus",blur:"onBlur"};for(e in n)n.hasOwnProperty(e)&&(t=this.settings[n[e]],t&&this.on(e,t))},onClick:function(e){var t=this;t.isFocused&&t.isOpen||(t.focus(),e.preventDefault())},onMouseDown:function(t){var n=this,i=t.isDefaultPrevented();e(t.target);if(n.isFocused){if(t.target!==n.$control_input[0])return"single"===n.settings.mode?n.isOpen?n.close():n.open():i||n.setActiveItem(null),!1}else i||window.setTimeout(function(){n.focus()},0)},onChange:function(){this.$input.trigger("change")},onPaste:function(t){var n=this;return n.isFull()||n.isInputHidden||n.isLocked?void t.preventDefault():void(n.settings.splitOn&&setTimeout(function(){var t=n.$control_input.val();if(t.match(n.settings.splitOn))for(var i=e.trim(t).split(n.settings.splitOn),r=0,o=i.length;r
s&&(u=a,a=s,s=u),r=a;r<=s;r++)c=d.$control[0].childNodes[r],d.$activeItems.indexOf(c)===-1&&(e(c).addClass("active"),d.$activeItems.push(c));n.preventDefault()}else"mousedown"===i&&d.isCtrlDown||"keydown"===i&&this.isShiftDown?t.hasClass("active")?(o=d.$activeItems.indexOf(t[0]),d.$activeItems.splice(o,1),t.removeClass("active")):d.$activeItems.push(t.addClass("active")[0]):(e(d.$activeItems).removeClass("active"),d.$activeItems=[t.addClass("active")[0]]);d.hideInput(),this.isFocused||d.focus()}},setActiveOption:function(t,n,i){var r,o,a,s,c,u=this;u.$activeOption&&u.$activeOption.removeClass("active"),u.$activeOption=null,t=e(t),t.length&&(u.$activeOption=t.addClass("active"),!n&&w(n)||(r=u.$dropdown_content.height(),o=u.$activeOption.outerHeight(!0),n=u.$dropdown_content.scrollTop()||0,a=u.$activeOption.offset().top-u.$dropdown_content.offset().top+n,s=a,c=a-r+o,a+o>r+n?u.$dropdown_content.stop().animate({scrollTop:c},i?u.settings.scrollDuration:0):a=0;n--)o.items.indexOf(D(i.items[n].id))!==-1&&i.items.splice(n,1);return i},refreshOptions:function(t){var n,r,o,a,s,c,u,l,d,h,p,f,m,M,g,v;"undefined"==typeof t&&(t=!0);var _=this,b=e.trim(_.$control_input.val()),y=_.search(b),A=_.$dropdown_content,L=_.$activeOption&&D(_.$activeOption.attr("data-value"));for(a=y.items.length,"number"==typeof _.settings.maxOptions&&(a=Math.min(a,_.settings.maxOptions)),s={},c=[],n=0;n0||m,_.hasOptions?(y.items.length>0?(g=L&&_.getOption(L),g&&g.length?M=g:"single"===_.settings.mode&&_.items.length&&(M=_.getOption(_.items[0])),M&&M.length||(M=v&&!_.settings.addPrecedence?_.getAdjacentOption(v,1):A.find("[data-selectable]:first"))):M=v,_.setActiveOption(M),t&&!_.isOpen&&_.open()):(_.setActiveOption(null),t&&_.isOpen&&_.close())},addOption:function(t){var n,i,r,o=this;
+if(e.isArray(t))for(n=0,i=t.length;n=0&&r0),t.$control_input.data("grow",!n&&!i)},isFull:function(){return null!==this.settings.maxItems&&this.items.length>=this.settings.maxItems},updateOriginalInput:function(e){var t,n,i,r,o=this;if(e=e||{},o.tagType===y){for(i=[],t=0,n=o.items.length;t'+x(r)+"");i.length||this.$input.attr("multiple")||i.push(''),o.$input.html(i.join(""))}else o.$input.val(o.getValue()),o.$input.attr("value",o.$input.val());o.isSetup&&(e.silent||o.trigger("change",o.$input.val()))},updatePlaceholder:function(){if(this.settings.placeholder){var e=this.$control_input;this.items.length?e.removeAttr("placeholder"):e.attr("placeholder",this.settings.placeholder),e.triggerHandler("update",{force:!0})}},open:function(){var e=this;e.isLocked||e.isOpen||"multi"===e.settings.mode&&e.isFull()||(e.focus(),e.isOpen=!0,e.refreshState(),e.$dropdown.css({visibility:"hidden",display:"block"}),e.positionDropdown(),e.$dropdown.css({visibility:"visible"}),e.trigger("dropdown_open",e.$dropdown))},close:function(){var e=this,t=e.isOpen;"single"===e.settings.mode&&e.items.length&&(e.hideInput(),e.isBlurring||e.$control_input.blur()),e.isOpen=!1,e.$dropdown.hide(),e.setActiveOption(null),e.refreshState(),t&&e.trigger("dropdown_close",e.$dropdown)},positionDropdown:function(){var e=this.$control,t="body"===this.settings.dropdownParent?e.offset():e.position();t.top+=e.outerHeight(!0),this.$dropdown.css({width:e[0].getBoundingClientRect().width,top:t.top,left:t.left})},clear:function(e){var t=this;t.items.length&&(t.$control.children(":not(input)").remove(),t.items=[],t.lastQuery=null,t.setCaret(0),t.setActiveItem(null),t.updatePlaceholder(),t.updateOriginalInput({silent:e}),t.refreshState(),t.showInput(),t.trigger("clear"))},insertAtCaret:function(e){var t=Math.min(this.caretPos,this.items.length),n=e[0],i=this.buffer||this.$control[0];0===t?i.insertBefore(n,i.firstChild):i.insertBefore(n,i.childNodes[t]),this.setCaret(t+1)},deleteSelection:function(t){var n,i,r,o,a,s,c,u,l,d=this;if(r=t&&t.keyCode===m?-1:1,o=C(d.$control_input[0]),d.$activeOption&&!d.settings.hideSelected&&(c=d.getAdjacentOption(d.$activeOption,-1).attr("data-value")),a=[],d.$activeItems.length){for(l=d.$control.children(".active:"+(r>0?"last":"first")),s=d.$control.children(":not(input)").index(l),r>0&&s++,n=0,i=d.$activeItems.length;n0&&o.start===d.$control_input.val().length&&a.push(d.items[d.caretPos]));if(!a.length||"function"==typeof d.settings.onDelete&&d.settings.onDelete.apply(d,[a])===!1)return!1;for("undefined"!=typeof s&&d.setCaret(s);a.length;)d.removeItem(a.pop());return d.showInput(),d.positionDropdown(),d.refreshOptions(!0),c&&(u=d.getOption(c),u.length&&d.setActiveOption(u)),!0},advanceSelection:function(e,t){var n,i,r,o,a,s,c=this;0!==e&&(c.rtl&&(e*=-1),n=e>0?"last":"first",i=C(c.$control_input[0]),c.isFocused&&!c.isInputHidden?(o=c.$control_input.val().length,a=e<0?0===i.start&&0===i.length:i.start===o,a&&!o&&c.advanceCaret(e,t)):(s=c.$control.children(".active:"+n),s.length&&(r=c.$control.children(":not(input)").index(s),c.setActiveItem(null),c.setCaret(e>0?r+1:r))))},advanceCaret:function(e,t){var n,i,r=this;0!==e&&(n=e>0?"next":"prev",r.isShiftDown?(i=r.$control_input[n](),i.length&&(r.hideInput(),r.setActiveItem(i),t&&t.preventDefault())):r.setCaret(r.caretPos+e))},setCaret:function(t){var n=this;if(t="single"===n.settings.mode?n.items.length:Math.max(0,Math.min(n.items.length,t)),!n.isPending){var i,r,o,a;for(o=n.$control.children(":not(input)"),i=0,r=o.length;i'}},t),n.setup=function(){var i=n.setup;return function(){i.apply(n,arguments),n.$dropdown_header=e(t.html(t)),n.$dropdown.prepend(n.$dropdown_header)}}()}),q.define("optgroup_columns",function(t){var n=this;t=e.extend({equalizeWidth:!0,equalizeHeight:!0},t),this.getAdjacentOption=function(t,n){var i=t.closest("[data-group]").find("[data-selectable]"),r=i.index(t)+n;return r>=0&&r
',e=e.firstChild,n.body.appendChild(e),t=i.width=e.offsetWidth-e.clientWidth,n.body.removeChild(e)),t},r=function(){var r,o,a,s,c,u,l;if(l=e("[data-group]",n.$dropdown_content),o=l.length,o&&n.$dropdown_content.width()){if(t.equalizeHeight){for(a=0,r=0;r
1&&(c=u-s*(o-1),l.eq(o-1).css({width:c})))}};(t.equalizeHeight||t.equalizeWidth)&&(z.after(this,"positionDropdown",r),z.after(this,"refreshOptions",r))}),q.define("remove_button",function(t){t=e.extend({label:"×",title:"Remove",className:"remove",append:!0},t);var n=function(t,n){n.className="remove-single";var i=t,r=''+n.label+"",o=function(t,n){return e("").append(t).append(n)};t.setup=function(){var a=i.setup;return function(){if(n.append){var s=e(i.$input.context).attr("id"),c=(e("#"+s),i.settings.render.item);i.settings.render.item=function(e){return o(c.apply(t,arguments),r)}}a.apply(t,arguments),t.$control.on("click","."+n.className,function(e){e.preventDefault(),i.isLocked||i.clear()})}}()},i=function(t,n){var i=t,r=''+n.label+"",o=function(e,t){var n=e.search(/(<\/[^>]+>\s*)$/);return e.substring(0,n)+t+e.substring(n)};t.setup=function(){var a=i.setup;return function(){if(n.append){var s=i.settings.render.item;i.settings.render.item=function(e){return o(s.apply(t,arguments),r)}}a.apply(t,arguments),t.$control.on("click","."+n.className,function(t){if(t.preventDefault(),!i.isLocked){var n=e(t.currentTarget).parent();i.setActiveItem(n),i.deleteSelection()&&i.setCaret(i.items.length)}})}}()};return"single"===this.settings.mode?void n(this,t):void i(this,t)}),q.define("restore_on_backspace",function(e){var t=this;e.text=e.text||function(e){return e[this.settings.labelField]},this.onKeyDown=function(){var n=t.onKeyDown;return function(t){var i,r;return t.keyCode===m&&""===this.$control_input.val()&&!this.$activeItems.length&&(i=this.caretPos-1,i>=0&&i0)&&i.items.push({score:n,id:r})}):a.iterator(a.items,function(e,t){i.items.push({score:1,id:t})}),r=a.getSortFunction(i,t),r&&i.items.sort(r),i.total=i.items.length,"number"==typeof t.limit&&(i.items=i.items.slice(0,t.limit)),i};var t=function(e,t){return"number"==typeof e&&"number"==typeof t?e>t?1:et?1:t>e?-1:0)},n=function(e,t){var n,i,r,o;for(n=1,i=arguments.length;n":"akbar-men","∑":"majmou","¤":"omla"},az:{},ca:{"∆":"delta","∞":"infinit","♥":"amor","&":"i","|":"o","<":"menys que",">":"mes que","∑":"suma dels","¤":"moneda"},cs:{"∆":"delta","∞":"nekonecno","♥":"laska","&":"a","|":"nebo","<":"mensi nez",">":"vetsi nez","∑":"soucet","¤":"mena"},de:{"∆":"delta","∞":"unendlich","♥":"Liebe","&":"und","|":"oder","<":"kleiner als",">":"groesser als","∑":"Summe von","¤":"Waehrung"},dv:{"∆":"delta","∞":"kolunulaa","♥":"loabi","&":"aai","|":"noonee","<":"ah vure kuda",">":"ah vure bodu","∑":"jumula","¤":"faisaa"},en:{"∆":"delta","∞":"infinity","♥":"love","&":"and","|":"or","<":"less than",">":"greater than","∑":"sum","¤":"currency"},es:{"∆":"delta","∞":"infinito","♥":"amor","&":"y","|":"u","<":"menos que",">":"mas que","∑":"suma de los","¤":"moneda"},fa:{"∆":"delta","∞":"bi-nahayat","♥":"eshgh","&":"va","|":"ya","<":"kamtar-az",">":"bishtar-az","∑":"majmooe","¤":"vahed"},fi:{"∆":"delta","∞":"aarettomyys","♥":"rakkaus","&":"ja","|":"tai","<":"pienempi kuin",">":"suurempi kuin","∑":"summa","¤":"valuutta"},fr:{"∆":"delta","∞":"infiniment","♥":"Amour","&":"et","|":"ou","<":"moins que",">":"superieure a","∑":"somme des","¤":"monnaie"},ge:{"∆":"delta","∞":"usasruloba","♥":"siqvaruli","&":"da","|":"an","<":"naklebi",">":"meti","∑":"jami","¤":"valuta"},gr:{},hu:{"∆":"delta","∞":"vegtelen","♥":"szerelem","&":"es","|":"vagy","<":"kisebb mint",">":"nagyobb mint","∑":"szumma","¤":"penznem"},it:{"∆":"delta","∞":"infinito","♥":"amore","&":"e","|":"o","<":"minore di",">":"maggiore di","∑":"somma","¤":"moneta"},lt:{"∆":"delta","∞":"begalybe","♥":"meile","&":"ir","|":"ar","<":"maziau nei",">":"daugiau nei","∑":"suma","¤":"valiuta"},lv:{"∆":"delta","∞":"bezgaliba","♥":"milestiba","&":"un","|":"vai","<":"mazak neka",">":"lielaks neka","∑":"summa","¤":"valuta"},my:{"∆":"kwahkhyaet","∞":"asaonasme","♥":"akhyait","&":"nhin","|":"tho","<":"ngethaw",">":"kyithaw","∑":"paungld","¤":"ngwekye"},mk:{},nl:{"∆":"delta","∞":"oneindig","♥":"liefde","&":"en","|":"of","<":"kleiner dan",">":"groter dan","∑":"som","¤":"valuta"},pl:{"∆":"delta","∞":"nieskonczonosc","♥":"milosc","&":"i","|":"lub","<":"mniejsze niz",">":"wieksze niz","∑":"suma","¤":"waluta"},pt:{"∆":"delta","∞":"infinito","♥":"amor","&":"e","|":"ou","<":"menor que",">":"maior que","∑":"soma","¤":"moeda"},ro:{"∆":"delta","∞":"infinit","♥":"dragoste","&":"si","|":"sau","<":"mai mic ca",">":"mai mare ca","∑":"suma","¤":"valuta"},ru:{"∆":"delta","∞":"beskonechno","♥":"lubov","&":"i","|":"ili","<":"menshe",">":"bolshe","∑":"summa","¤":"valjuta"},sk:{"∆":"delta","∞":"nekonecno","♥":"laska","&":"a","|":"alebo","<":"menej ako",">":"viac ako","∑":"sucet","¤":"mena"},sr:{},tr:{"∆":"delta","∞":"sonsuzluk","♥":"ask","&":"ve","|":"veya","<":"kucuktur",">":"buyuktur","∑":"toplam","¤":"para birimi"},uk:{"∆":"delta","∞":"bezkinechnist","♥":"lubov","&":"i","|":"abo","<":"menshe",">":"bilshe","∑":"suma","¤":"valjuta"},vn:{"∆":"delta","∞":"vo cuc","♥":"yeu","&":"va","|":"hoac","<":"nho hon",">":"lon hon","∑":"tong","¤":"tien te"}},l=[";","?",":","@","&","=","+","$",",","/"].join(""),d=[";","?",":","@","&","=","+","$",","].join(""),h=[".","!","~","*","'","(",")"].join(""),p=function(e,t){var n,i,r,p,f,g,v,_,b,y,A,L,T,z,w="-",D="",x="",S=!0,k={},O="";if("string"!=typeof e)return"";if("string"==typeof t&&(w=t),v=u.en,_=c.en,"object"==typeof t){n=t.maintainCase||!1,k=t.custom&&"object"==typeof t.custom?t.custom:k,r=+t.truncate>1&&t.truncate||!1,p=t.uric||!1,f=t.uricNoSlash||!1,g=t.mark||!1,S=!1!==t.symbols&&!1!==t.lang,w=t.separator||w,p&&(O+=l),f&&(O+=d),g&&(O+=h),v=t.lang&&u[t.lang]&&S?u[t.lang]:S?u.en:{},_=t.lang&&c[t.lang]?c[t.lang]:!1===t.lang||!0===t.lang?{}:c.en,t.titleCase&&"number"==typeof t.titleCase.length&&Array.prototype.toString.call(t.titleCase)?(t.titleCase.forEach(function(e){k[e+""]=e+""}),i=!0):i=!!t.titleCase,t.custom&&"number"==typeof t.custom.length&&Array.prototype.toString.call(t.custom)&&t.custom.forEach(function(e){k[e+""]=e+""}),Object.keys(k).forEach(function(t){var n;n=t.length>1?new RegExp("\\b"+m(t)+"\\b","gi"):new RegExp(m(t),"gi"),e=e.replace(n,k[t])});for(A in k)O+=A}for(O=m(O+=w),T=!1,z=!1,y=0,L=(e=e.replace(/(^\s+|\s+$)/g,"")).length;y=0?(x+=A,A=""):!0===z?(A=s[x]+o[A],x=""):A=T&&o[A].match(/[A-Za-z0-9]/)?" "+o[A]:o[A],T=!1,z=!1):A in s?(x+=A,A="",y===L-1&&(A=s[x]),z=!0):!v[A]||p&&-1!==l.indexOf(A)||f&&-1!==d.indexOf(A)?(!0===z?(A=s[x]+A,x="",z=!1):T&&(/[A-Za-z0-9]/.test(A)||D.substr(-1).match(/A-Za-z0-9]/))&&(A=" "+A),T=!1):(A=T||D.substr(-1).match(/[A-Za-z0-9]/)?w+v[A]:v[A],A+=void 0!==e[y+1]&&e[y+1].match(/[A-Za-z0-9]/)?w:"",T=!0),D+=A.replace(new RegExp("[^\\w\\s"+O+"_-]","g"),w);return i&&(D=D.replace(/(\w)(\S*)/g,function(e,t,n){var i=t.toUpperCase()+(null!==n?n:"");return Object.keys(k).indexOf(i.toLowerCase())<0?i:i.toLowerCase()})),D=D.replace(/\s+/g,w).replace(new RegExp("\\"+w+"+","g"),w).replace(new RegExp("(^\\"+w+"+|\\"+w+"+$)","g"),""),r&&D.length>r&&(b=D.charAt(r)===w,D=D.slice(0,r),b||(D=D.slice(0,D.lastIndexOf(w)))),n||i||(D=D.toLowerCase()),D},f=function(e){return function(t){return p(t,e)}},m=function(e){return e.replace(/[-\\^$*+?.()|[\]{}\/]/g,"\\$&")},M=function(e,t){for(var n in t)if(t[n]===e)return!0};"undefined"!=typeof e&&e.exports?(e.exports=p,e.exports.createSlug=f):(i=[],r=function(){return p}.apply(t,i),!(void 0!==r&&(e.exports=r)))}(this)},,,,,,,function(e,t,n){(function(e){"use strict";function t(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function n(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){return"undefined"!=typeof e&&null!==e?t(e):void 0}function o(e,t,n){return"undefined"!=typeof e&&null!==e&&"function"==typeof e[t]?n(e,t):void 0}var a=function(){function e(e,t){for(var n=0;n1?n-1:0),r=1;r=o.length)break;c=o[s++]}else{if(s=o.next(),s.done)break;c=s.value}var u=c;u.apply(this,i)}}return this}},{key:"off",value:function(e,t){if(!this._callbacks||0===arguments.length)return this._callbacks={},this;var n=this._callbacks[e];if(!n)return this;if(1===arguments.length)return delete this._callbacks[e],this;for(var i=0;i=t.length)break;r=t[i++]}else{if(i=t.next(),i.done)break;r=i.value}var o=r;if(/(^| )dz-message($| )/.test(o.className)){e=o,o.className="dz-message";break}}e||(e=c.createElement('
'),this.element.appendChild(e));var a=e.getElementsByTagName("span")[0];return a&&(null!=a.textContent?a.textContent=this.options.dictFallbackMessage:null!=a.innerText&&(a.innerText=this.options.dictFallbackMessage)),this.element.appendChild(this.getFallbackForm())},resize:function(e,t,n,i){var r={srcX:0,srcY:0,srcWidth:e.width,srcHeight:e.height},o=e.width/e.height;null==t&&null==n?(t=r.srcWidth,n=r.srcHeight):null==t?t=n*o:null==n&&(n=t/o),t=Math.min(t,r.srcWidth),n=Math.min(n,r.srcHeight);var a=t/n;if(r.srcWidth>t||r.srcHeight>n)if("crop"===i)o>a?(r.srcHeight=e.height,r.srcWidth=r.srcHeight*a):(r.srcWidth=e.width,r.srcHeight=r.srcWidth/a);else{if("contain"!==i)throw new Error("Unknown resizeMethod '"+i+"'");o>a?n=t/o:t=n*o}return r.srcX=(e.width-r.srcWidth)/2,r.srcY=(e.height-r.srcHeight)/2,r.trgWidth=t,r.trgHeight=n,r},transformFile:function(e,t){return(this.options.resizeWidth||this.options.resizeHeight)&&e.type.match(/image.*/)?this.resizeImage(e,this.options.resizeWidth,this.options.resizeHeight,this.options.resizeMethod,t):t(e)},previewTemplate:'\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
',drop:function(e){return this.element.classList.remove("dz-drag-hover")},dragstart:function(e){},dragend:function(e){return this.element.classList.remove("dz-drag-hover")},dragenter:function(e){return this.element.classList.add("dz-drag-hover")},dragover:function(e){return this.element.classList.add("dz-drag-hover")},dragleave:function(e){return this.element.classList.remove("dz-drag-hover")},paste:function(e){},reset:function(){return this.element.classList.remove("dz-started")},addedfile:function(e){var t=this;if(this.element===this.previewsContainer&&this.element.classList.add("dz-started"),this.previewsContainer){e.previewElement=c.createElement(this.options.previewTemplate.trim()),e.previewTemplate=e.previewElement,this.previewsContainer.appendChild(e.previewElement);for(var n=e.previewElement.querySelectorAll("[data-dz-name]"),i=!0,r=0,n=i?n:n[Symbol.iterator]();;){var o;if(i){if(r>=n.length)break;o=n[r++]}else{if(r=n.next(),r.done)break;o=r.value}var a=o;a.textContent=e.name}for(var s=e.previewElement.querySelectorAll("[data-dz-size]"),u=!0,l=0,s=u?s:s[Symbol.iterator]();;){if(u){if(l>=s.length)break;a=s[l++]}else{if(l=s.next(),l.done)break;a=l.value}a.innerHTML=this.filesize(e.size)}this.options.addRemoveLinks&&(e._removeLink=c.createElement(''+this.options.dictRemoveFile+""),e.previewElement.appendChild(e._removeLink));for(var d=function(n){return n.preventDefault(),n.stopPropagation(),e.status===c.UPLOADING?c.confirm(t.options.dictCancelUploadConfirmation,function(){return t.removeFile(e)}):t.options.dictRemoveFileConfirmation?c.confirm(t.options.dictRemoveFileConfirmation,function(){return t.removeFile(e)}):t.removeFile(e)},h=e.previewElement.querySelectorAll("[data-dz-remove]"),p=!0,f=0,h=p?h:h[Symbol.iterator]();;){var m;if(p){if(f>=h.length)break;m=h[f++]}else{if(f=h.next(),f.done)break;m=f.value}var M=m;M.addEventListener("click",d)}}},removedfile:function(e){return null!=e.previewElement&&null!=e.previewElement.parentNode&&e.previewElement.parentNode.removeChild(e.previewElement),this._updateMaxFilesReachedClass()},thumbnail:function(e,t){if(e.previewElement){e.previewElement.classList.remove("dz-file-preview");for(var n=e.previewElement.querySelectorAll("[data-dz-thumbnail]"),i=!0,r=0,n=i?n:n[Symbol.iterator]();;){var o;if(i){if(r>=n.length)break;o=n[r++]}else{if(r=n.next(),r.done)break;o=r.value}var a=o;a.alt=e.name,a.src=t}return setTimeout(function(){return e.previewElement.classList.add("dz-image-preview")},1)}},error:function(e,t){if(e.previewElement){e.previewElement.classList.add("dz-error"),"String"!=typeof t&&t.error&&(t=t.error);for(var n=e.previewElement.querySelectorAll("[data-dz-errormessage]"),i=!0,r=0,n=i?n:n[Symbol.iterator]();;){var o;if(i){if(r>=n.length)break;o=n[r++]}else{if(r=n.next(),r.done)break;o=r.value}var a=o;a.textContent=t}}},errormultiple:function(){},processing:function(e){if(e.previewElement&&(e.previewElement.classList.add("dz-processing"),e._removeLink))return e._removeLink.innerHTML=this.options.dictCancelUpload},processingmultiple:function(){},uploadprogress:function(e,t,n){if(e.previewElement)for(var i=e.previewElement.querySelectorAll("[data-dz-uploadprogress]"),r=!0,o=0,i=r?i:i[Symbol.iterator]();;){var a;if(r){if(o>=i.length)break;a=i[o++]}else{if(o=i.next(),o.done)break;a=o.value}var s=a;"PROGRESS"===s.nodeName?s.value=t:s.style.width=t+"%"}},totaluploadprogress:function(){},sending:function(){},sendingmultiple:function(){},success:function(e){if(e.previewElement)return e.previewElement.classList.add("dz-success")},successmultiple:function(){},canceled:function(e){return this.emit("error",e,this.options.dictUploadCanceled)},canceledmultiple:function(){},complete:function(e){if(e._removeLink&&(e._removeLink.innerHTML=this.options.dictRemoveFile),e.previewElement)return e.previewElement.classList.add("dz-complete")},completemultiple:function(){},maxfilesexceeded:function(){},maxfilesreached:function(){},queuecomplete:function(){},addedfiles:function(){}},this.prototype._thumbnailQueue=[],this.prototype._processingThumbnail=!1}},{key:"extend",value:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i=r.length)break;s=r[a++]}else{if(a=r.next(),a.done)break;s=a.value}var c=s;for(var u in c){var l=c[u];e[u]=l}}return e}}]),a(c,[{key:"getAcceptedFiles",value:function(){return this.files.filter(function(e){return e.accepted}).map(function(e){return e})}},{key:"getRejectedFiles",value:function(){return this.files.filter(function(e){return!e.accepted}).map(function(e){return e})}},{key:"getFilesWithStatus",value:function(e){return this.files.filter(function(t){return t.status===e}).map(function(e){return e})}},{key:"getQueuedFiles",value:function(){return this.getFilesWithStatus(c.QUEUED)}},{key:"getUploadingFiles",value:function(){return this.getFilesWithStatus(c.UPLOADING)}},{key:"getAddedFiles",value:function(){return this.getFilesWithStatus(c.ADDED)}},{key:"getActiveFiles",value:function(){return this.files.filter(function(e){return e.status===c.UPLOADING||e.status===c.QUEUED}).map(function(e){return e})}},{key:"init",value:function(){var e=this;if("form"===this.element.tagName&&this.element.setAttribute("enctype","multipart/form-data"),this.element.classList.contains("dropzone")&&!this.element.querySelector(".dz-message")&&this.element.appendChild(c.createElement(''+this.options.dictDefaultMessage+"
")),this.clickableElements.length){var t=function t(){return e.hiddenFileInput&&e.hiddenFileInput.parentNode.removeChild(e.hiddenFileInput),e.hiddenFileInput=document.createElement("input"),e.hiddenFileInput.setAttribute("type","file"),(null===e.options.maxFiles||e.options.maxFiles>1)&&e.hiddenFileInput.setAttribute("multiple","multiple"),e.hiddenFileInput.className="dz-hidden-input",null!==e.options.acceptedFiles&&e.hiddenFileInput.setAttribute("accept",e.options.acceptedFiles),null!==e.options.capture&&e.hiddenFileInput.setAttribute("capture",e.options.capture),e.hiddenFileInput.style.visibility="hidden",e.hiddenFileInput.style.position="absolute",e.hiddenFileInput.style.top="0",e.hiddenFileInput.style.left="0",e.hiddenFileInput.style.height="0",e.hiddenFileInput.style.width="0",c.getElement(e.options.hiddenInputContainer,"hiddenInputContainer").appendChild(e.hiddenFileInput),e.hiddenFileInput.addEventListener("change",function(){var n=e.hiddenFileInput.files;if(n.length)for(var i=n,r=!0,o=0,i=r?i:i[Symbol.iterator]();;){var a;if(r){if(o>=i.length)break;a=i[o++]}else{if(o=i.next(),o.done)break;a=o.value}var s=a;e.addFile(s)}return e.emit("addedfiles",n),t()})};t()}this.URL=null!==window.URL?window.URL:window.webkitURL;for(var n=this.events,i=!0,r=0,n=i?n:n[Symbol.iterator]();;){var o;if(i){if(r>=n.length)break;o=n[r++]}else{if(r=n.next(),r.done)break;o=r.value}var a=o;this.on(a,this.options[a])}this.on("uploadprogress",function(){return e.updateTotalUploadProgress()}),this.on("removedfile",function(){return e.updateTotalUploadProgress()}),this.on("canceled",function(t){return e.emit("complete",t)}),this.on("complete",function(t){if(0===e.getAddedFiles().length&&0===e.getUploadingFiles().length&&0===e.getQueuedFiles().length)return setTimeout(function(){return e.emit("queuecomplete")},0)});var s=function(e){return e.stopPropagation(),e.preventDefault?e.preventDefault():e.returnValue=!1};return this.listeners=[{element:this.element,events:{dragstart:function(t){return e.emit("dragstart",t)},dragenter:function(t){return s(t),e.emit("dragenter",t)},dragover:function(t){var n=void 0;try{n=t.dataTransfer.effectAllowed}catch(e){}
-return t.dataTransfer.dropEffect="move"===n||"linkMove"===n?"move":"copy",s(t),e.emit("dragover",t)},dragleave:function(t){return e.emit("dragleave",t)},drop:function(t){return s(t),e.drop(t)},dragend:function(t){return e.emit("dragend",t)}}}],this.clickableElements.forEach(function(t){return e.listeners.push({element:t,events:{click:function(n){return(t!==e.element||n.target===e.element||c.elementInside(n.target,e.element.querySelector(".dz-message")))&&e.hiddenFileInput.click(),!0}}})}),this.enable(),this.options.init.call(this)}},{key:"destroy",value:function(){return this.disable(),this.removeAllFiles(!0),(null!=this.hiddenFileInput?this.hiddenFileInput.parentNode:void 0)&&(this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput),this.hiddenFileInput=null),delete this.element.dropzone,c.instances.splice(c.instances.indexOf(this),1)}},{key:"updateTotalUploadProgress",value:function(){var e=void 0,t=0,n=0,i=this.getActiveFiles();if(i.length){for(var r=this.getActiveFiles(),o=!0,a=0,r=o?r:r[Symbol.iterator]();;){var s;if(o){if(a>=r.length)break;s=r[a++]}else{if(a=r.next(),a.done)break;s=a.value}var c=s;t+=c.upload.bytesSent,n+=c.upload.total}e=100*t/n}else e=100;return this.emit("totaluploadprogress",e,n,t)}},{key:"_getParamName",value:function(e){return"function"==typeof this.options.paramName?this.options.paramName(e):""+this.options.paramName+(this.options.uploadMultiple?"["+e+"]":"")}},{key:"_renameFile",value:function(e){return"function"!=typeof this.options.renameFile?e.name:this.options.renameFile(e)}},{key:"getFallbackForm",value:function(){var e=void 0,t=void 0;if(e=this.getExistingFallback())return e;var n='';var i=c.createElement(n);return"FORM"!==this.element.tagName?(t=c.createElement(''),t.appendChild(i)):(this.element.setAttribute("enctype","multipart/form-data"),this.element.setAttribute("method",this.options.method)),null!=t?t:i}},{key:"getExistingFallback",value:function(){for(var e=function(e){for(var t=e,n=!0,i=0,t=n?t:t[Symbol.iterator]();;){var r;if(n){if(i>=t.length)break;r=t[i++]}else{if(i=t.next(),i.done)break;r=i.value}var o=r;if(/(^| )fallback($| )/.test(o.className))return o}},t=["div","form"],n=0;n0){for(var i=["tb","gb","mb","kb","b"],r=0;r=a){t=e/Math.pow(this.options.filesizeBase,4-r),n=o;break}}t=Math.round(10*t)/10}return""+t+" "+this.options.dictFileSizeUnits[n]}},{key:"_updateMaxFilesReachedClass",value:function(){return null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles?(this.getAcceptedFiles().length===this.options.maxFiles&&this.emit("maxfilesreached",this.files),this.element.classList.add("dz-max-files-reached")):this.element.classList.remove("dz-max-files-reached")}},{key:"drop",value:function(e){if(e.dataTransfer){this.emit("drop",e);for(var t=[],n=0;n=t.length)break;r=t[i++]}else{if(i=t.next(),i.done)break;r=i.value}var o=r;this.addFile(o)}}},{key:"_addFilesFromItems",value:function(e){var t=this;return function(){for(var n=[],i=e,r=!0,o=0,i=r?i:i[Symbol.iterator]();;){var a;if(r){if(o>=i.length)break;a=i[o++]}else{if(o=i.next(),o.done)break;a=o.value}var s,c=a;null!=c.webkitGetAsEntry&&(s=c.webkitGetAsEntry())?s.isFile?n.push(t.addFile(c.getAsFile())):s.isDirectory?n.push(t._addFilesFromDirectory(s,s.name)):n.push(void 0):null!=c.getAsFile&&(null==c.kind||"file"===c.kind)?n.push(t.addFile(c.getAsFile())):n.push(void 0)}return n}()}},{key:"_addFilesFromDirectory",value:function(e,t){var n=this,i=e.createReader(),r=function(e){return o(console,"log",function(t){return t.log(e)})},a=function e(){return i.readEntries(function(i){if(i.length>0){for(var r=i,o=!0,a=0,r=o?r:r[Symbol.iterator]();;){var s;if(o){if(a>=r.length)break;s=r[a++]}else{if(a=r.next(),a.done)break;s=a.value}var c=s;c.isFile?c.file(function(e){if(!n.options.ignoreHiddenFiles||"."!==e.name.substring(0,1))return e.fullPath=t+"/"+e.name,n.addFile(e)}):c.isDirectory&&n._addFilesFromDirectory(c,t+"/"+c.name)}e()}return null},r)};return a()}},{key:"accept",value:function(e,t){return this.options.maxFilesize&&e.size>1024*this.options.maxFilesize*1024?t(this.options.dictFileTooBig.replace("{{filesize}}",Math.round(e.size/1024/10.24)/100).replace("{{maxFilesize}}",this.options.maxFilesize)):c.isValidFile(e,this.options.acceptedFiles)?null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles?(t(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}",this.options.maxFiles)),this.emit("maxfilesexceeded",e)):this.options.accept.call(this,e,t):t(this.options.dictInvalidFileType)}},{key:"addFile",value:function(e){var t=this;return e.upload={uuid:c.uuidv4(),progress:0,total:e.size,bytesSent:0,filename:this._renameFile(e),chunked:this.options.chunking&&(this.options.forceChunking||e.size>this.options.chunkSize),totalChunkCount:Math.ceil(e.size/this.options.chunkSize)},this.files.push(e),e.status=c.ADDED,this.emit("addedfile",e),this._enqueueThumbnail(e),this.accept(e,function(n){return n?(e.accepted=!1,t._errorProcessing([e],n)):(e.accepted=!0,t.options.autoQueue&&t.enqueueFile(e)),t._updateMaxFilesReachedClass()})}},{key:"enqueueFiles",value:function(e){for(var t=e,n=!0,i=0,t=n?t:t[Symbol.iterator]();;){var r;if(n){if(i>=t.length)break;r=t[i++]}else{if(i=t.next(),i.done)break;r=i.value}var o=r;this.enqueueFile(o)}return null}},{key:"enqueueFile",value:function(e){var t=this;if(e.status!==c.ADDED||e.accepted!==!0)throw new Error("This file can't be queued because it has already been processed or was rejected.");if(e.status=c.QUEUED,this.options.autoProcessQueue)return setTimeout(function(){return t.processQueue()},0)}},{key:"_enqueueThumbnail",value:function(e){var t=this;if(this.options.createImageThumbnails&&e.type.match(/image.*/)&&e.size<=1024*this.options.maxThumbnailFilesize*1024)return this._thumbnailQueue.push(e),setTimeout(function(){return t._processThumbnailQueue()},0)}},{key:"_processThumbnailQueue",value:function(){var e=this;if(!this._processingThumbnail&&0!==this._thumbnailQueue.length){this._processingThumbnail=!0;var t=this._thumbnailQueue.shift();return this.createThumbnail(t,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.thumbnailMethod,!0,function(n){return e.emit("thumbnail",t,n),e._processingThumbnail=!1,e._processThumbnailQueue()})}}},{key:"removeFile",value:function(e){if(e.status===c.UPLOADING&&this.cancelUpload(e),this.files=u(this.files,e),this.emit("removedfile",e),0===this.files.length)return this.emit("reset")}},{key:"removeAllFiles",value:function(e){null==e&&(e=!1);for(var t=this.files.slice(),n=!0,i=0,t=n?t:t[Symbol.iterator]();;){var r;if(n){if(i>=t.length)break;r=t[i++]}else{if(i=t.next(),i.done)break;r=i.value}var o=r;(o.status!==c.UPLOADING||e)&&this.removeFile(o)}return null}},{key:"resizeImage",value:function(e,t,n,i,r){var o=this;return this.createThumbnail(e,t,n,i,!0,function(t,n){if(null==n)return r(e);var i=o.options.resizeMimeType;null==i&&(i=e.type);var a=n.toDataURL(i,o.options.resizeQuality);return"image/jpeg"!==i&&"image/jpg"!==i||(a=p.restore(e.dataURL,a)),r(c.dataURItoBlob(a))})}},{key:"createThumbnail",value:function(e,t,n,i,r,o){var a=this,s=new FileReader;return s.onload=function(){return e.dataURL=s.result,"image/svg+xml"===e.type?void(null!=o&&o(s.result)):a.createThumbnailFromUrl(e,t,n,i,r,o)},s.readAsDataURL(e)}},{key:"createThumbnailFromUrl",value:function(e,t,n,i,r,o,a){var s=this,c=document.createElement("img");return a&&(c.crossOrigin=a),c.onload=function(){var a=function(e){return e(1)};return"undefined"!=typeof EXIF&&null!==EXIF&&r&&(a=function(e){return EXIF.getData(c,function(){return e(EXIF.getTag(this,"Orientation"))})}),a(function(r){e.width=c.width,e.height=c.height;var a=s.options.resize.call(s,e,t,n,i),u=document.createElement("canvas"),l=u.getContext("2d");switch(u.width=a.trgWidth,u.height=a.trgHeight,r>4&&(u.width=a.trgHeight,u.height=a.trgWidth),r){case 2:l.translate(u.width,0),l.scale(-1,1);break;case 3:l.translate(u.width,u.height),l.rotate(Math.PI);break;case 4:l.translate(0,u.height),l.scale(1,-1);break;case 5:l.rotate(.5*Math.PI),l.scale(1,-1);break;case 6:l.rotate(.5*Math.PI),l.translate(0,-u.width);break;case 7:l.rotate(.5*Math.PI),l.translate(u.height,-u.width),l.scale(-1,1);break;case 8:l.rotate(-.5*Math.PI),l.translate(-u.height,0)}h(l,c,null!=a.srcX?a.srcX:0,null!=a.srcY?a.srcY:0,a.srcWidth,a.srcHeight,null!=a.trgX?a.trgX:0,null!=a.trgY?a.trgY:0,a.trgWidth,a.trgHeight);var d=u.toDataURL("image/png");if(null!=o)return o(d,u)})},null!=o&&(c.onerror=o),c.src=e.dataURL}},{key:"processQueue",value:function(){var e=this.options.parallelUploads,t=this.getUploadingFiles().length,n=t;if(!(t>=e)){var i=this.getQueuedFiles();if(i.length>0){if(this.options.uploadMultiple)return this.processFiles(i.slice(0,e-t));for(;n=t.length)break;r=t[i++]}else{if(i=t.next(),i.done)break;r=i.value}var o=r;o.processing=!0,o.status=c.UPLOADING,this.emit("processing",o)}return this.options.uploadMultiple&&this.emit("processingmultiple",e),this.uploadFiles(e)}},{key:"_getFilesWithXhr",value:function(e){var t=void 0;return t=this.files.filter(function(t){return t.xhr===e}).map(function(e){return e})}},{key:"cancelUpload",value:function(e){if(e.status===c.UPLOADING){for(var t=this._getFilesWithXhr(e.xhr),n=t,i=!0,r=0,n=i?n:n[Symbol.iterator]();;){var o;if(i){if(r>=n.length)break;o=n[r++]}else{if(r=n.next(),r.done)break;o=r.value}var a=o;a.status=c.CANCELED}"undefined"!=typeof e.xhr&&e.xhr.abort();for(var s=t,u=!0,l=0,s=u?s:s[Symbol.iterator]();;){var d;if(u){if(l>=s.length)break;d=s[l++]}else{if(l=s.next(),l.done)break;d=l.value}var h=d;this.emit("canceled",h)}this.options.uploadMultiple&&this.emit("canceledmultiple",t)}else e.status!==c.ADDED&&e.status!==c.QUEUED||(e.status=c.CANCELED,this.emit("canceled",e),this.options.uploadMultiple&&this.emit("canceledmultiple",[e]));if(this.options.autoProcessQueue)return this.processQueue()}},{key:"resolveOption",value:function(e){if("function"==typeof e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i=i.upload.totalChunkCount)){o++;var a=n*t.options.chunkSize,s=Math.min(a+t.options.chunkSize,i.size),u={name:t._getParamName(0),data:r.webkitSlice?r.webkitSlice(a,s):r.slice(a,s),filename:i.upload.filename,chunkIndex:n};i.upload.chunks[n]={file:i,index:n,dataBlock:u,status:c.UPLOADING,progress:0,retries:0},t._uploadData(e,[u])}};if(i.upload.finishedChunkUpload=function(n){var r=!0;n.status=c.SUCCESS,n.dataBlock=null,n.xhr=null;for(var o=0;o=r.length)break;s=r[a++]}else{if(a=r.next(),a.done)break;s=a.value}var u=s;u.xhr=i}e[0].upload.chunked&&(e[0].upload.chunks[t[0].chunkIndex].xhr=i);var l=this.resolveOption(this.options.method,e),d=this.resolveOption(this.options.url,e);i.open(l,d,!0),i.timeout=this.resolveOption(this.options.timeout,e),i.withCredentials=!!this.options.withCredentials,i.onload=function(t){n._finishedUploading(e,i,t)},i.onerror=function(){n._handleUploadError(e,i)};var h=null!=i.upload?i.upload:i;h.onprogress=function(t){return n._updateFilesUploadProgress(e,i,t)};var p={Accept:"application/json","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"};this.options.headers&&c.extend(p,this.options.headers);for(var f in p){var m=p[f];m&&i.setRequestHeader(f,m)}var M=new FormData;if(this.options.params){var g=this.options.params;"function"==typeof g&&(g=g.call(this,e,i,e[0].upload.chunked?this._getChunk(e[0],i):null));for(var v in g){var _=g[v];M.append(v,_)}}for(var b=e,y=!0,A=0,b=y?b:b[Symbol.iterator]();;){var L;if(y){if(A>=b.length)break;L=b[A++]}else{if(A=b.next(),A.done)break;L=A.value}var T=L;this.emit("sending",T,i,M)}this.options.uploadMultiple&&this.emit("sendingmultiple",e,i,M),this._addFormElementData(M);for(var z=0;z=t.length)break;r=t[i++]}else{if(i=t.next(),i.done)break;r=i.value}var o=r,a=o.getAttribute("name"),s=o.getAttribute("type");if(s&&(s=s.toLowerCase()),"undefined"!=typeof a&&null!==a)if("SELECT"===o.tagName&&o.hasAttribute("multiple"))for(var c=o.options,u=!0,l=0,c=u?c:c[Symbol.iterator]();;){var d;if(u){if(l>=c.length)break;d=c[l++]}else{if(l=c.next(),l.done)break;d=l.value}var h=d;h.selected&&e.append(a,h.value)}else(!s||"checkbox"!==s&&"radio"!==s||o.checked)&&e.append(a,o.value)}}},{key:"_updateFilesUploadProgress",value:function(e,t,n){var i=void 0;if("undefined"!=typeof n){if(i=100*n.loaded/n.total,e[0].upload.chunked){var r=e[0],o=this._getChunk(r,t);o.progress=i,o.total=n.total,o.bytesSent=n.loaded;r.upload.progress=0,r.upload.total=0,r.upload.bytesSent=0;for(var a=0;a=s.length)break;l=s[u++]}else{if(u=s.next(),u.done)break;l=u.value}var d=l;d.upload.progress=i,d.upload.total=n.total,d.upload.bytesSent=n.loaded}for(var h=e,p=!0,f=0,h=p?h:h[Symbol.iterator]();;){var m;if(p){if(f>=h.length)break;m=h[f++]}else{if(f=h.next(),f.done)break;m=f.value}var M=m;this.emit("uploadprogress",M,M.upload.progress,M.upload.bytesSent)}}else{var g=!0;i=100;for(var v=e,_=!0,b=0,v=_?v:v[Symbol.iterator]();;){var y;if(_){if(b>=v.length)break;y=v[b++]}else{if(b=v.next(),b.done)break;y=b.value}var A=y;100===A.upload.progress&&A.upload.bytesSent===A.upload.total||(g=!1),A.upload.progress=i,A.upload.bytesSent=A.upload.total}if(g)return;for(var L=e,T=!0,z=0,L=T?L:L[Symbol.iterator]();;){var w;if(T){if(z>=L.length)break;w=L[z++]}else{if(z=L.next(),z.done)break;w=z.value}var D=w;this.emit("uploadprogress",D,i,D.upload.bytesSent)}}}},{key:"_finishedUploading",value:function(e,t,n){var i=void 0;if(e[0].status!==c.CANCELED&&4===t.readyState){if("arraybuffer"!==t.responseType&&"blob"!==t.responseType&&(i=t.responseText,t.getResponseHeader("content-type")&&~t.getResponseHeader("content-type").indexOf("application/json")))try{i=JSON.parse(i)}catch(e){n=e,i="Invalid JSON response from server."}this._updateFilesUploadProgress(e),200<=t.status&&t.status<300?e[0].upload.chunked?e[0].upload.finishedChunkUpload(this._getChunk(e[0],t)):this._finished(e,i,n):this._handleUploadError(e,t,i)}}},{key:"_handleUploadError",value:function(e,t,n){if(e[0].status!==c.CANCELED){if(e[0].upload.chunked&&this.options.retryChunks){var i=this._getChunk(e[0],t);if(i.retries++=r.length)break;s=r[a++]}else{if(a=r.next(),a.done)break;s=a.value}this._errorProcessing(e,n||this.options.dictResponseError.replace("{{statusCode}}",t.status),t)}}}},{key:"submitRequest",value:function(e,t,n){e.send(t)}},{key:"_finished",value:function(e,t,n){for(var i=e,r=!0,o=0,i=r?i:i[Symbol.iterator]();;){var a;if(r){if(o>=i.length)break;a=i[o++]}else{if(o=i.next(),o.done)break;a=o.value}var s=a;s.status=c.SUCCESS,this.emit("success",s,t,n),this.emit("complete",s)}if(this.options.uploadMultiple&&(this.emit("successmultiple",e,t,n),this.emit("completemultiple",e)),this.options.autoProcessQueue)return this.processQueue()}},{key:"_errorProcessing",value:function(e,t,n){for(var i=e,r=!0,o=0,i=r?i:i[Symbol.iterator]();;){var a;if(r){if(o>=i.length)break;a=i[o++]}else{if(o=i.next(),o.done)break;a=o.value}var s=a;s.status=c.ERROR,this.emit("error",s,t,n),this.emit("complete",s)}if(this.options.uploadMultiple&&(this.emit("errormultiple",e,t,n),this.emit("completemultiple",e)),this.options.autoProcessQueue)return this.processQueue()}}],[{key:"uuidv4",value:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0,n="x"===e?t:3&t|8;return n.toString(16)})}}]),c}(s);c.initClass(),c.version="5.5.1",c.options={},c.optionsForElement=function(e){return e.getAttribute("id")?c.options[l(e.getAttribute("id"))]:void 0},c.instances=[],c.forElement=function(e){if("string"==typeof e&&(e=document.querySelector(e)),null==(null!=e?e.dropzone:void 0))throw new Error("No Dropzone found for given element. This is probably because you're trying to access it before Dropzone had the time to initialize. Use the `init` option to setup any additional observers on your Dropzone.");return e.dropzone},c.autoDiscover=!0,c.discover=function(){var e=void 0;if(document.querySelectorAll)e=document.querySelectorAll(".dropzone");else{e=[];var t=function(t){return function(){for(var n=[],i=t,r=!0,o=0,i=r?i:i[Symbol.iterator]();;){var a;if(r){if(o>=i.length)break;a=i[o++]}else{if(o=i.next(),o.done)break;a=o.value}var s=a;/(^| )dropzone($| )/.test(s.className)?n.push(e.push(s)):n.push(void 0)}return n}()};t(document.getElementsByTagName("div")),t(document.getElementsByTagName("form"))}return function(){for(var t=[],n=e,i=!0,r=0,n=i?n:n[Symbol.iterator]();;){var o;if(i){if(r>=n.length)break;o=n[r++]}else{if(r=n.next(),r.done)break;o=r.value}var a=o;c.optionsForElement(a)!==!1?t.push(new c(a)):t.push(void 0)}return t}()},c.blacklistedBrowsers=[/opera.*(Macintosh|Windows Phone).*version\/12/i],c.isBrowserSupported=function(){var e=!0;if(window.File&&window.FileReader&&window.FileList&&window.Blob&&window.FormData&&document.querySelector)if("classList"in document.createElement("a"))for(var t=c.blacklistedBrowsers,n=!0,i=0,t=n?t:t[Symbol.iterator]();;){var r;if(n){if(i>=t.length)break;r=t[i++]}else{if(i=t.next(),i.done)break;r=i.value}var o=r;o.test(navigator.userAgent)&&(e=!1)}else e=!1;else e=!1;return e},c.dataURItoBlob=function(e){for(var t=atob(e.split(",")[1]),n=e.split(",")[0].split(":")[1].split(";")[0],i=new ArrayBuffer(t.length),r=new Uint8Array(i),o=0,a=t.length,s=0<=a;s?o<=a:o>=a;s?o++:o--)r[o]=t.charCodeAt(o);return new Blob([i],{type:n})};var u=function(e,t){return e.filter(function(e){return e!==t}).map(function(e){return e})},l=function(e){return e.replace(/[\-_](\w)/g,function(e){return e.charAt(1).toUpperCase()})};c.createElement=function(e){var t=document.createElement("div");return t.innerHTML=e,t.childNodes[0]},c.elementInside=function(e,t){if(e===t)return!0;for(;e=e.parentNode;)if(e===t)return!0;return!1},c.getElement=function(e,t){var n=void 0;if("string"==typeof e?n=document.querySelector(e):null!=e.nodeType&&(n=e),null==n)throw new Error("Invalid `"+t+"` option provided. Please provide a CSS selector or a plain HTML element.");return n},c.getElements=function(e,t){var n=void 0,i=void 0;if(e instanceof Array){i=[];try{for(var r=e,o=!0,a=0,r=o?r:r[Symbol.iterator]();;){if(o){if(a>=r.length)break;n=r[a++]}else{if(a=r.next(),a.done)break;n=a.value}i.push(this.getElement(n,t))}}catch(e){i=null}}else if("string"==typeof e){i=[];for(var s=document.querySelectorAll(e),c=!0,u=0,s=c?s:s[Symbol.iterator]();;){if(c){if(u>=s.length)break;n=s[u++]}else{if(u=s.next(),u.done)break;n=u.value}i.push(n)}}else null!=e.nodeType&&(i=[e]);if(null==i||!i.length)throw new Error("Invalid `"+t+"` option provided. Please provide a CSS selector, a plain HTML element or a list of those.");return i},c.confirm=function(e,t,n){return window.confirm(e)?t():null!=n?n():void 0},c.isValidFile=function(e,t){if(!t)return!0;t=t.split(",");for(var n=e.type,i=n.replace(/\/.*$/,""),r=t,o=!0,a=0,r=o?r:r[Symbol.iterator]();;){var s;if(o){if(a>=r.length)break;s=r[a++]}else{if(a=r.next(),a.done)break;s=a.value}var c=s;if(c=c.trim(),"."===c.charAt(0)){if(e.name.toLowerCase().indexOf(c.toLowerCase(),e.name.length-c.length)!==-1)return!0}else if(/\/\*$/.test(c)){if(i===c.replace(/\/.*$/,""))return!0}else if(n===c)return!0}return!1},"undefined"!=typeof jQuery&&null!==jQuery&&(jQuery.fn.dropzone=function(e){return this.each(function(){return new c(this,e)})}),"undefined"!=typeof e&&null!==e?e.exports=c:window.Dropzone=c,c.ADDED="added",c.QUEUED="queued",c.ACCEPTED=c.QUEUED,c.UPLOADING="uploading",c.PROCESSING=c.UPLOADING,c.CANCELED="canceled",c.ERROR="error",c.SUCCESS="success";var d=function(e){var t=(e.naturalWidth,e.naturalHeight),n=document.createElement("canvas");n.width=1,n.height=t;var i=n.getContext("2d");i.drawImage(e,0,0);for(var r=i.getImageData(1,0,1,t),o=r.data,a=0,s=t,c=t;c>a;){var u=o[4*(c-1)+3];0===u?s=c:a=c,c=s+a>>1}var l=c/t;return 0===l?1:l},h=function(e,t,n,i,r,o,a,s,c,u){var l=d(t);return e.drawImage(t,n,i,r,o,a,s,c,u/l)},p=function(){function e(){i(this,e)}return a(e,null,[{key:"initClass",value:function(){this.KEY_STR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}},{key:"encode64",value:function(e){for(var t="",n=void 0,i=void 0,r="",o=void 0,a=void 0,s=void 0,c="",u=0;;)if(n=e[u++],i=e[u++],r=e[u++],o=n>>2,a=(3&n)<<4|i>>4,s=(15&i)<<2|r>>6,c=63&r,isNaN(i)?s=c=64:isNaN(r)&&(c=64),t=t+this.KEY_STR.charAt(o)+this.KEY_STR.charAt(a)+this.KEY_STR.charAt(s)+this.KEY_STR.charAt(c),n=i=r="",o=a=s=c="",!(ue.length)break}return n}},{key:"decode64",value:function(e){var t=void 0,n=void 0,i="",r=void 0,o=void 0,a=void 0,s="",c=0,u=[],l=/[^A-Za-z0-9\+\/\=]/g;for(l.exec(e)&&console.warn("There were invalid base64 characters in the input text.\nValid base64 characters are A-Z, a-z, 0-9, '+', '/',and '='\nExpect errors in decoding."),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");;)if(r=this.KEY_STR.indexOf(e.charAt(c++)),o=this.KEY_STR.indexOf(e.charAt(c++)),a=this.KEY_STR.indexOf(e.charAt(c++)),s=this.KEY_STR.indexOf(e.charAt(c++)),t=r<<2|o>>4,n=(15&o)<<4|a>>2,i=(3&a)<<6|s,u.push(t),64!==a&&u.push(n),64!==s&&u.push(i),t=n=i="",r=o=a=s="",!(c0;--t)e.removeChild(e.firstChild);return e}function n(e,n){return t(e).appendChild(n)}function i(e,t,n,i){var r=document.createElement(e);if(n&&(r.className=n),i&&(r.style.cssText=i),"string"==typeof t)r.appendChild(document.createTextNode(t));else if(t)for(var o=0;o=t)return a+(t-o);a+=s-o,a+=n-a%n,o=s+1}}function h(e,t){for(var n=0;n=t)return i+Math.min(a,t-r);if(r+=o-i,r+=n-r%n,i=o+1,r>=t)return i}}function f(e){for(;Va.length<=e;)Va.push(m(Va)+" ");return Va[e]}function m(e){return e[e.length-1]}function M(e,t){for(var n=[],i=0;i""&&(e.toUpperCase()!=e.toLowerCase()||Qa.test(e))}function y(e,t){return t?!!(t.source.indexOf("\\w")>-1&&b(e))||t.test(e):b(e)}function A(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function L(e){return e.charCodeAt(0)>=768&&Za.test(e)}function T(e,t,n){for(;(n<0?t>0:tn?-1:1;;){if(t==n)return t;var r=(t+n)/2,o=i<0?Math.ceil(r):Math.floor(r);if(o==t)return e(o)?t:n;e(o)?n=o:t=o+i}}function w(e,t,n,i){if(!e)return i(t,n,"ltr",0);for(var r=!1,o=0;ot||t==n&&a.to==t)&&(i(Math.max(a.from,t),Math.min(a.to,n),1==a.level?"rtl":"ltr",o),r=!0)}r||i(t,n,"ltr")}function D(e,t,n){var i;es=null;for(var r=0;rt)return r;o.to==t&&(o.from!=o.to&&"before"==n?i=r:es=r),o.from==t&&(o.from!=o.to&&"before"!=n?i=r:es=r)}return null!=i?i:es}function x(e,t){var n=e.order;return null==n&&(n=e.order=ts(e.text,t)),n}function S(e,t){return e._handlers&&e._handlers[t]||ns}function k(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var i=e._handlers,r=i&&i[t];if(r){var o=h(r,n);o>-1&&(i[t]=r.slice(0,o).concat(r.slice(o+1)))}}}function O(e,t){var n=S(e,t);if(n.length)for(var i=Array.prototype.slice.call(arguments,2),r=0;r0}function Y(e){e.prototype.on=function(e,t){is(this,e,t)},e.prototype.off=function(e,t){k(this,e,t)}}function W(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function B(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function F(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function q(e){W(e),B(e)}function X(e){return e.target||e.srcElement}function P(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),Na&&e.ctrlKey&&1==t&&(t=3),t}function H(e){if(null==Ia){var t=i("span","");n(e,i("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(Ia=t.offsetWidth<=1&&t.offsetHeight>2&&!(Aa&&La<8))}var r=Ia?i("span",""):i("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}function R(e){if(null!=ja)return ja;var i=n(e,document.createTextNode("AخA")),r=Fa(i,0,1).getBoundingClientRect(),o=Fa(i,1,2).getBoundingClientRect();return t(e),!(!r||r.left==r.right)&&(ja=o.right-r.right<3);
-}function I(e){if(null!=cs)return cs;var t=n(e,i("span","x")),r=t.getBoundingClientRect(),o=Fa(t,0,1).getBoundingClientRect();return cs=Math.abs(r.left-o.left)>1}function j(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),us[e]=t}function U(e,t){ls[e]=t}function J(e){if("string"==typeof e&&ls.hasOwnProperty(e))e=ls[e];else if(e&&"string"==typeof e.name&&ls.hasOwnProperty(e.name)){var t=ls[e.name];"string"==typeof t&&(t={name:t}),e=_(t,e),e.name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return J("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return J("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function G(e,t){t=J(t);var n=us[t.name];if(!n)return G(e,"text/plain");var i=n(e,t);if(ds.hasOwnProperty(t.name)){var r=ds[t.name];for(var o in r)r.hasOwnProperty(o)&&(i.hasOwnProperty(o)&&(i["_"+o]=i[o]),i[o]=r[o])}if(i.name=t.name,t.helperType&&(i.helperType=t.helperType),t.modeProps)for(var a in t.modeProps)i[a]=t.modeProps[a];return i}function K(e,t){var n=ds.hasOwnProperty(e)?ds[e]:ds[e]={};l(t,n)}function $(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var i in t){var r=t[i];r instanceof Array&&(r=r.concat([])),n[i]=r}return n}function V(e,t){for(var n;e.innerMode&&(n=e.innerMode(t),n&&n.mode!=e);)t=n.state,e=n.mode;return n||{mode:e,state:t}}function Q(e,t,n){return!e.startState||e.startState(t,n)}function Z(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var i=0;;++i){var r=n.children[i],o=r.chunkSize();if(t=e.first&&tn?se(n,Z(e,n).text.length):me(t,Z(e,t.line).text.length)}function me(e,t){var n=e.ch;return null==n||n>t?se(e.line,t):n<0?se(e.line,0):e}function Me(e,t){for(var n=[],i=0;ie&&r.splice(c,1,e,r[c+1],i),c+=2,u=Math.min(e,i)}if(t)if(s.opaque)r.splice(n,c-n,e,"overlay "+t),c=n+2;else for(;ne.options.maxHighlightLength&&$(e.doc.mode,i.state),o=ge(e,t,i);r&&(i.state=r),t.stateAfter=i.save(!r),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function _e(e,t,n){var i=e.doc,r=e.display;if(!i.mode.startState)return new fs(i,!0,t);var o=we(e,t,n),a=o>i.first&&Z(i,o-1).stateAfter,s=a?fs.fromSaved(i,a,o):new fs(i,Q(i.mode),o);return i.iter(o,t,function(n){be(e,n.text,s);var i=s.line;n.stateAfter=i==t-1||i%5==0||i>=r.viewFrom&&it.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}function Le(e,t,n,i){var r,o=e.doc,a=o.mode;t=fe(o,t);var s,c=Z(o,t.line),u=_e(e,t.line,n),l=new hs(c.text,e.options.tabSize,u);for(i&&(s=[]);(i||l.pose.options.maxHighlightLength?(s=!1,a&&be(e,t,i,d.pos),d.pos=t.length,c=null):c=Te(Ae(n,d,i.state,h),o),h){var p=h[0].name;p&&(c="m-"+(c?p+" "+c:p))}if(!s||l!=c){for(;ua;--s){if(s<=o.first)return o.first;var c=Z(o,s-1),u=c.stateAfter;if(u&&(!n||s+(u instanceof ps?u.lookAhead:0)<=o.modeFrontier))return s;var l=d(c.text,null,e.options.tabSize);(null==r||i>l)&&(r=s-1,i=l)}return r}function De(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontiern;i--){var r=Z(e,i).stateAfter;if(r&&(!(r instanceof ps)||i+r.lookAhead=t:o.to>t);(i||(i=[])).push(new ke(a,o.from,c?null:o.to))}}return i}function Ye(e,t,n){var i;if(e)for(var r=0;r=t:o.to>t);if(s||o.from==t&&"bookmark"==a.type&&(!n||o.marker.insertLeft)){var c=null==o.from||(a.inclusiveLeft?o.from<=t:o.from0&&s)for(var y=0;y0)){var l=[c,1],d=ce(u.from,s.from),p=ce(u.to,s.to);(d<0||!a.inclusiveLeft&&!d)&&l.push({from:u.from,to:s.from}),(p>0||!a.inclusiveRight&&!p)&&l.push({from:s.to,to:u.to}),r.splice.apply(r,l),c+=l.length-3}}return r}function qe(e){var t=e.markedSpans;if(t){for(var n=0;nt)&&(!n||Re(n,o.marker)<0)&&(n=o.marker)}return n}function Ge(e,t,n,i,r){var o=Z(e,t),a=gs&&o.markedSpans;if(a)for(var s=0;s=0&&d<=0||l<=0&&d>=0)&&(l<=0&&(c.marker.inclusiveRight&&r.inclusiveLeft?ce(u.to,n)>=0:ce(u.to,n)>0)||l>=0&&(c.marker.inclusiveRight&&r.inclusiveLeft?ce(u.from,i)<=0:ce(u.from,i)<0)))return!0}}}function Ke(e){for(var t;t=je(e);)e=t.find(-1,!0).line;return e}function $e(e){for(var t;t=Ue(e);)e=t.find(1,!0).line;return e}function Ve(e){for(var t,n;t=Ue(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function Qe(e,t){var n=Z(e,t),i=Ke(n);return n==i?t:ie(i)}function Ze(e,t){if(t>e.lastLine())return t;var n,i=Z(e,t);if(!et(e,i))return t;for(;n=Ue(i);)i=n.find(1,!0).line;return ie(i)+1}function et(e,t){var n=gs&&t.markedSpans;if(n)for(var i=void 0,r=0;rt.maxLineLength&&(t.maxLineLength=n,t.maxLine=e)})}function ot(e,t,n,i){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),qe(e),Xe(e,n);var r=i?i(e):1;r!=e.height&&ne(e,r)}function at(e){e.parent=null,qe(e)}function st(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?ys:bs;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function ct(e,t){var n=r("span",null,null,Ta?"padding-right: .1px":null),i={pre:r("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var o=0;o<=(t.rest?t.rest.length:0);o++){var a=o?t.rest[o-1]:t.line,s=void 0;i.pos=0,i.addToken=lt,R(e.display.measure)&&(s=x(a,e.doc.direction))&&(i.addToken=ht(i.addToken,s)),i.map=[];var u=t!=e.display.externalMeasured&&ie(a);ft(a,i,ve(e,a,u)),a.styleClasses&&(a.styleClasses.bgClass&&(i.bgClass=c(a.styleClasses.bgClass,i.bgClass||"")),a.styleClasses.textClass&&(i.textClass=c(a.styleClasses.textClass,i.textClass||""))),0==i.map.length&&i.map.push(0,0,i.content.appendChild(H(e.display.measure))),0==o?(t.measure.map=i.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(i.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(Ta){var l=i.content.lastChild;(/\bcm-tab\b/.test(l.className)||l.querySelector&&l.querySelector(".cm-tab"))&&(i.content.className="cm-tab-wrap-hack")}return O(e,"renderLine",e,t.line,i.pre),i.pre.className&&(i.textClass=c(i.pre.className,i.textClass||"")),i}function ut(e){var t=i("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function lt(e,t,n,r,o,a,s){if(t){var c,u=e.splitSpaces?dt(t,e.trailingSpace):t,l=e.cm.state.specialChars,d=!1;if(l.test(t)){c=document.createDocumentFragment();for(var h=0;;){l.lastIndex=h;var p=l.exec(t),m=p?p.index-h:t.length-h;if(m){var M=document.createTextNode(u.slice(h,h+m));Aa&&La<9?c.appendChild(i("span",[M])):c.appendChild(M),e.map.push(e.pos,e.pos+m,M),e.col+=m,e.pos+=m}if(!p)break;h+=m+1;var g=void 0;if("\t"==p[0]){var v=e.cm.options.tabSize,_=v-e.col%v;g=c.appendChild(i("span",f(_),"cm-tab")),g.setAttribute("role","presentation"),g.setAttribute("cm-text","\t"),e.col+=_}else"\r"==p[0]||"\n"==p[0]?(g=c.appendChild(i("span","\r"==p[0]?"␍":"","cm-invalidchar")),g.setAttribute("cm-text",p[0]),e.col+=1):(g=e.cm.options.specialCharPlaceholder(p[0]),g.setAttribute("cm-text",p[0]),Aa&&La<9?c.appendChild(i("span",[g])):c.appendChild(g),e.col+=1);e.map.push(e.pos,e.pos+1,g),e.pos++}}else e.col+=t.length,c=document.createTextNode(u),e.map.push(e.pos,e.pos+t.length,c),Aa&&La<9&&(d=!0),e.pos+=t.length;if(e.trailingSpace=32==u.charCodeAt(t.length-1),n||r||o||d||a){var b=n||"";r&&(b+=r),o&&(b+=o);var y=i("span",[c],b,a);if(s)for(var A in s)s.hasOwnProperty(A)&&"style"!=A&&"class"!=A&&y.setAttribute(A,s[A]);return e.content.appendChild(y)}e.content.appendChild(c)}}function dt(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,i="",r=0;ru&&d.from<=u));h++);if(d.to>=l)return e(n,i,r,o,a,s,c);e(n,i.slice(0,d.to-u),r,o,null,s,c),o=null,i=i.slice(d.to-u),u=d.to}}}function pt(e,t,n,i){var r=!i&&n.widgetNode;r&&e.map.push(e.pos,e.pos+t,r),!i&&e.cm.display.input.needsContentAttribute&&(r||(r=e.content.appendChild(document.createElement("span"))),r.setAttribute("cm-marker",n.id)),r&&(e.cm.display.input.setUneditable(r),e.content.appendChild(r)),e.pos+=t,e.trailingSpace=!1}function ft(e,t,n){var i=e.markedSpans,r=e.text,o=0;if(i)for(var a,s,c,u,l,d,h,p=r.length,f=0,m=1,M="",g=0;;){if(g==f){c=u=l=s="",h=null,d=null,g=1/0;for(var v=[],_=void 0,b=0;bf||A.collapsed&&y.to==f&&y.from==f)){if(null!=y.to&&y.to!=f&&g>y.to&&(g=y.to,u=""),A.className&&(c+=" "+A.className),A.css&&(s=(s?s+";":"")+A.css),A.startStyle&&y.from==f&&(l+=" "+A.startStyle),A.endStyle&&y.to==g&&(_||(_=[])).push(A.endStyle,y.to),A.title&&((h||(h={})).title=A.title),A.attributes)for(var L in A.attributes)(h||(h={}))[L]=A.attributes[L];A.collapsed&&(!d||Re(d.marker,A)<0)&&(d=y)}else y.from>f&&g>y.from&&(g=y.from)}if(_)for(var T=0;T<_.length;T+=2)_[T+1]==g&&(u+=" "+_[T]);if(!d||d.from==f)for(var z=0;z=p)break;for(var w=Math.min(p,g);;){if(M){var D=f+M.length;if(!d){var x=D>w?M.slice(0,w-f):M;t.addToken(t,x,a?a+c:c,l,f+x.length==g?u:"",s,h)}if(D>=w){M=M.slice(w-f),f=w;break}f=D,l=""}M=r.slice(o,o=n[m++]),a=st(n[m++],t.cm.options)}}else for(var S=1;S2&&o.push((c.bottom+u.top)/2-n.top)}}o.push(n.bottom-n.top)}}function Rt(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var i=0;in)return{map:e.measure.maps[r],cache:e.measure.caches[r],before:!0}}function It(e,t){t=Ke(t);var i=ie(t),r=e.display.externalMeasured=new mt(e.doc,t,i);r.lineN=i;var o=r.built=ct(e,r);return r.text=o.pre,n(e.display.lineMeasure,o.pre),r}function jt(e,t,n,i){return Gt(e,Jt(e,t),n,i)}function Ut(e,t){if(t>=e.display.viewFrom&&t=n.lineN&&tt)&&(o=c-s,r=o-1,t>=c&&(a="right")),null!=r){if(i=e[u+2],s==c&&n==(i.insertLeft?"left":"right")&&(a=n),"left"==n&&0==r)for(;u&&e[u-2]==e[u-3]&&e[u-1].insertLeft;)i=e[(u-=3)+2],a="left";if("right"==n&&r==c-s)for(;u=0&&(n=e[r]).left==n.right;r--);return n}function Vt(e,t,n,i){var r,o=Kt(t.map,n,i),a=o.node,s=o.start,c=o.end,u=o.collapse;if(3==a.nodeType){for(var l=0;l<4;l++){for(;s&&L(t.line.text.charAt(o.coverStart+s));)--s;for(;o.coverStart+c0&&(u=i="right");var d;r=e.options.lineWrapping&&(d=a.getClientRects()).length>1?d["right"==i?d.length-1:0]:a.getBoundingClientRect()}if(Aa&&La<9&&!s&&(!r||!r.left&&!r.right)){var h=a.parentNode.getClientRects()[0];r=h?{left:h.left,right:h.left+bn(e.display),top:h.top,bottom:h.bottom}:Ts}for(var p=r.top-t.rect.top,f=r.bottom-t.rect.top,m=(p+f)/2,M=t.view.measure.heights,g=0;g=i.text.length?(u=i.text.length,l="before"):u<=0&&(u=0,l="after"),!c)return a("before"==l?u-1:u,"before"==l);var d=D(c,u,l),h=es,p=s(u,d,"before"==l);return null!=h&&(p.other=s(u,h,"before"!=l)),p}function ln(e,t){var n=0;t=fe(e.doc,t),e.options.lineWrapping||(n=bn(e.display)*t.ch);var i=Z(e.doc,t.line),r=nt(i)+Wt(e.display);return{left:n,right:n,top:r,bottom:r+i.height}}function dn(e,t,n,i,r){var o=se(e,t,n);return o.xRel=r,i&&(o.outside=i),o}function hn(e,t,n){var i=e.doc;if(n+=e.display.viewOffset,n<0)return dn(i.first,0,null,-1,-1);var r=re(i,n),o=i.first+i.size-1;if(r>o)return dn(i.first+i.size-1,Z(i,o).text.length,null,1,1);t<0&&(t=0);for(var a=Z(i,r);;){var s=Mn(e,a,r,t,n),c=Je(a,s.ch+(s.xRel>0||s.outside>0?1:0));if(!c)return s;var u=c.find(1);if(u.line==r)return u;a=Z(i,r=u.line)}}function pn(e,t,n,i){i-=on(t);var r=t.text.length,o=z(function(t){return Gt(e,n,t-1).bottom<=i},r,0);return r=z(function(t){return Gt(e,n,t).top>i},o,r),{begin:o,end:r}}function fn(e,t,n,i){n||(n=Jt(e,t));var r=an(e,t,Gt(e,n,i),"line").top;return pn(e,t,n,r)}function mn(e,t,n,i){return!(e.bottom<=n)&&(e.top>n||(i?e.left:e.right)>t)}function Mn(e,t,n,i,r){r-=nt(t);var o=Jt(e,t),a=on(t),s=0,c=t.text.length,u=!0,l=x(t,e.doc.direction);if(l){var d=(e.options.lineWrapping?vn:gn)(e,t,n,o,l,i,r);u=1!=d.level,s=u?d.from:d.to-1,c=u?d.to:d.from-1}var h,p,f=null,m=null,M=z(function(t){var n=Gt(e,o,t);return n.top+=a,n.bottom+=a,!!mn(n,i,r,!1)&&(n.top<=r&&n.left<=i&&(f=t,m=n),!0)},s,c),g=!1;if(m){var v=i-m.left=b.bottom?1:0}return M=T(t.text,M,1),dn(n,M,p,g,i-h)}function gn(e,t,n,i,r,o,a){var s=z(function(s){var c=r[s],u=1!=c.level;return mn(un(e,se(n,u?c.to:c.from,u?"before":"after"),"line",t,i),o,a,!0)},0,r.length-1),c=r[s];if(s>0){var u=1!=c.level,l=un(e,se(n,u?c.from:c.to,u?"after":"before"),"line",t,i);mn(l,o,a,!0)&&l.top>a&&(c=r[s-1])}return c}function vn(e,t,n,i,r,o,a){var s=pn(e,t,i,a),c=s.begin,u=s.end;/\s/.test(t.text.charAt(u-1))&&u--;for(var l=null,d=null,h=0;h=u||p.to<=c)){var f=1!=p.level,m=Gt(e,i,f?Math.min(u,p.to)-1:Math.max(c,p.from)).right,M=mM)&&(l=p,d=M)}}return l||(l=r[r.length-1]),l.fromu&&(l={from:l.from,to:u,level:l.level}),l}function _n(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==_s){_s=i("pre",null,"CodeMirror-line-like");for(var r=0;r<49;++r)_s.appendChild(document.createTextNode("x")),_s.appendChild(i("br"));_s.appendChild(document.createTextNode("x"))}n(e.measure,_s);var o=_s.offsetHeight/50;return o>3&&(e.cachedTextHeight=o),t(e.measure),o||1}function bn(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=i("span","xxxxxxxxxx"),r=i("pre",[t],"CodeMirror-line-like");n(e.measure,r);var o=t.getBoundingClientRect(),a=(o.right-o.left)/10;return a>2&&(e.cachedCharWidth=a),a||10}function yn(e){for(var t=e.display,n={},i={},r=t.gutters.clientLeft,o=t.gutters.firstChild,a=0;o;o=o.nextSibling,
-++a){var s=e.display.gutterSpecs[a].className;n[s]=o.offsetLeft+o.clientLeft+r,i[s]=o.clientWidth}return{fixedPos:An(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:i,wrapperWidth:t.wrapper.clientWidth}}function An(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Ln(e){var t=_n(e.display),n=e.options.lineWrapping,i=n&&Math.max(5,e.display.scroller.clientWidth/bn(e.display)-3);return function(r){if(et(e.doc,r))return 0;var o=0;if(r.widgets)for(var a=0;a0&&(c=Z(e.doc,u.line).text).length==u.ch){var l=d(c,c.length,e.options.tabSize)-c.length;u=se(u.line,Math.max(0,Math.round((o-Ft(e.display).left)/bn(e.display))-l))}return u}function wn(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,i=0;it)&&(r.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=r.viewTo)gs&&Qe(e.doc,t)r.viewFrom?Sn(e):(r.viewFrom+=i,r.viewTo+=i);else if(t<=r.viewFrom&&n>=r.viewTo)Sn(e);else if(t<=r.viewFrom){var o=kn(e,n,n+i,1);o?(r.view=r.view.slice(o.index),r.viewFrom=o.lineN,r.viewTo+=i):Sn(e)}else if(n>=r.viewTo){var a=kn(e,t,t,-1);a?(r.view=r.view.slice(0,a.index),r.viewTo=a.lineN):Sn(e)}else{var s=kn(e,t,t,-1),c=kn(e,n,n+i,1);s&&c?(r.view=r.view.slice(0,s.index).concat(Mt(e,s.lineN,c.lineN)).concat(r.view.slice(c.index)),r.viewTo+=i):Sn(e)}var u=r.externalMeasured;u&&(n=r.lineN&&t=i.viewTo)){var o=i.view[wn(e,t)];if(null!=o.node){var a=o.changes||(o.changes=[]);h(a,n)==-1&&a.push(n)}}}function Sn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function kn(e,t,n,i){var r,o=wn(e,t),a=e.display.view;if(!gs||n==e.doc.first+e.doc.size)return{index:o,lineN:n};for(var s=e.display.viewFrom,c=0;c0){if(o==a.length-1)return null;r=s+a[o].size-t,o++}else r=s-t;t+=r,n+=r}for(;Qe(e.doc,n)!=n;){if(o==(i<0?0:a.length-1))return null;n+=i*a[o-(i<0?1:0)].size,o+=i}return{index:o,lineN:n}}function On(e,t,n){var i=e.display,r=i.view;0==r.length||t>=i.viewTo||n<=i.viewFrom?(i.view=Mt(e,t,n),i.viewFrom=t):(i.viewFrom>t?i.view=Mt(e,t,i.viewFrom).concat(i.view):i.viewFromn&&(i.view=i.view.slice(0,wn(e,n)))),i.viewTo=n}function Cn(e){for(var t=e.display.view,n=0,i=0;i=e.display.viewTo||s.to().line0?t.blinker=setInterval(function(){return t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function qn(e){e.state.focused||(e.display.input.focus(),Pn(e))}function Xn(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Hn(e))},100)}function Pn(e,t){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(O(e,"focus",e,t),e.state.focused=!0,s(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),Ta&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Fn(e))}function Hn(e,t){e.state.delayingBlurEvent||(e.state.focused&&(O(e,"blur",e,t),e.state.focused=!1,Pa(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function Rn(e){for(var t=e.display,n=t.lineDiv.offsetTop,i=0;i.005||l<-.005)&&(ne(r.line,a),In(r.line),r.rest))for(var d=0;de.display.sizerWidth){var h=Math.ceil(s/bn(e.display));h>e.display.maxLineLength&&(e.display.maxLineLength=h,e.display.maxLine=r.line,e.display.maxLineChanged=!0)}}}}function In(e){if(e.widgets)for(var t=0;t=a&&(o=re(t,nt(Z(t,c))-e.wrapper.clientHeight),a=c)}return{from:o,to:Math.max(a,o+1)}}function Un(e,t){if(!C(e,"scrollCursorIntoView")){var n=e.display,r=n.sizer.getBoundingClientRect(),o=null;if(t.top+r.top<0?o=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(o=!1),null!=o&&!ka){var a=i("div","",null,"position: absolute;\n top: "+(t.top-n.viewOffset-Wt(e.display))+"px;\n height: "+(t.bottom-t.top+qt(e)+n.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(a),a.scrollIntoView(o),e.display.lineSpace.removeChild(a)}}}function Jn(e,t,n,i){null==i&&(i=0);var r;e.options.lineWrapping||t!=n||(t=t.ch?se(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t,n="before"==t.sticky?se(t.line,t.ch+1,"before"):t);for(var o=0;o<5;o++){var a=!1,s=un(e,t),c=n&&n!=t?un(e,n):s;r={left:Math.min(s.left,c.left),top:Math.min(s.top,c.top)-i,right:Math.max(s.left,c.left),bottom:Math.max(s.bottom,c.bottom)+i};var u=Kn(e,r),l=e.doc.scrollTop,d=e.doc.scrollLeft;if(null!=u.scrollTop&&(ni(e,u.scrollTop),Math.abs(e.doc.scrollTop-l)>1&&(a=!0)),null!=u.scrollLeft&&(ri(e,u.scrollLeft),Math.abs(e.doc.scrollLeft-d)>1&&(a=!0)),!a)break}return r}function Gn(e,t){var n=Kn(e,t);null!=n.scrollTop&&ni(e,n.scrollTop),null!=n.scrollLeft&&ri(e,n.scrollLeft)}function Kn(e,t){var n=e.display,i=_n(e.display);t.top<0&&(t.top=0);var r=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:n.scroller.scrollTop,o=Pt(e),a={};t.bottom-t.top>o&&(t.bottom=t.top+o);var s=e.doc.height+Bt(n),c=t.tops-i;if(t.topr+o){var l=Math.min(t.top,(u?s:t.bottom)-o);l!=r&&(a.scrollTop=l)}var d=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:n.scroller.scrollLeft,h=Xt(e)-(e.options.fixedGutter?n.gutters.offsetWidth:0),p=t.right-t.left>h;return p&&(t.right=t.left+h),t.left<10?a.scrollLeft=0:t.lefth+d-3&&(a.scrollLeft=t.right+(p?0:10)-h),a}function $n(e,t){null!=t&&(ei(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function Vn(e){ei(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Qn(e,t,n){null==t&&null==n||ei(e),null!=t&&(e.curOp.scrollLeft=t),null!=n&&(e.curOp.scrollTop=n)}function Zn(e,t){ei(e),e.curOp.scrollToPos=t}function ei(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=ln(e,t.from),i=ln(e,t.to);ti(e,n,i,t.margin)}}function ti(e,t,n,i){var r=Kn(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-i,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+i});Qn(e,r.scrollLeft,r.scrollTop)}function ni(e,t){Math.abs(e.doc.scrollTop-t)<2||(va||xi(e,{top:t}),ii(e,t,!0),va&&xi(e),yi(e,100))}function ii(e,t,n){t=Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t),(e.display.scroller.scrollTop!=t||n)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function ri(e,t,n,i){t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!i||(e.doc.scrollLeft=t,Ci(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function oi(e){var t=e.display,n=t.gutters.offsetWidth,i=Math.round(e.doc.height+Bt(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:i,scrollHeight:i+qt(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}function ai(e,t){t||(t=oi(e));var n=e.display.barWidth,i=e.display.barHeight;si(e,t);for(var r=0;r<4&&n!=e.display.barWidth||i!=e.display.barHeight;r++)n!=e.display.barWidth&&e.options.lineWrapping&&Rn(e),si(e,oi(e)),n=e.display.barWidth,i=e.display.barHeight}function si(e,t){var n=e.display,i=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=i.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=i.bottom)+"px",n.heightForcer.style.borderBottom=i.bottom+"px solid transparent",i.right&&i.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=i.bottom+"px",n.scrollbarFiller.style.width=i.right+"px"):n.scrollbarFiller.style.display="",i.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=i.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}function ci(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&Pa(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Ds[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),is(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){"horizontal"==n?ri(e,t):ni(e,t)},e),e.display.scrollbars.addClass&&s(e.display.wrapper,e.display.scrollbars.addClass)}function ui(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++xs},gt(e.curOp)}function li(e){var t=e.curOp;t&&_t(t,function(e){for(var t=0;t=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Ss(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function pi(e){e.updatedDisplay=e.mustUpdate&&wi(e.cm,e.update)}function fi(e){var t=e.cm,n=t.display;e.updatedDisplay&&Rn(t),e.barMeasure=oi(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=jt(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+qt(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Xt(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function mi(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft=e.display.viewTo)){var n=+new Date+e.options.workTime,i=_e(e,t.highlightFrontier),r=[];t.iter(i.line,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(i.line>=e.display.viewFrom){var a=o.styles,s=o.text.length>e.options.maxHighlightLength?$(t.mode,i.state):null,c=ge(e,o,i,!0);s&&(i.state=s),o.styles=c.styles;var u=o.styleClasses,l=c.classes;l?o.styleClasses=l:u&&(o.styleClasses=null);for(var d=!a||a.length!=o.styles.length||u!=l&&(!u||!l||u.bgClass!=l.bgClass||u.textClass!=l.textClass),h=0;!d&&hn)return yi(e,e.options.workDelay),!0}),t.highlightFrontier=i.line,t.modeFrontier=Math.max(t.modeFrontier,i.line),r.length&&gi(e,function(){for(var t=0;t=i.viewFrom&&n.visible.to<=i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&0==Cn(e))return!1;Ei(e)&&(Sn(e),n.dims=yn(e));var o=r.first+r.size,a=Math.max(n.visible.from-e.options.viewportMargin,r.first),s=Math.min(o,n.visible.to+e.options.viewportMargin);i.viewFroms&&i.viewTo-s<20&&(s=Math.min(o,i.viewTo)),gs&&(a=Qe(e.doc,a),s=Ze(e.doc,s));var c=a!=i.viewFrom||s!=i.viewTo||i.lastWrapHeight!=n.wrapperHeight||i.lastWrapWidth!=n.wrapperWidth;On(e,a,s),i.viewOffset=nt(Z(e.doc,i.viewFrom)),e.display.mover.style.top=i.viewOffset+"px";var u=Cn(e);if(!c&&0==u&&!n.force&&i.renderedView==i.view&&(null==i.updateLineNumbers||i.updateLineNumbers>=i.viewTo))return!1;var l=Ti(e);return u>4&&(i.lineDiv.style.display="none"),Si(e,i.updateLineNumbers,n.dims),u>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,zi(l),t(i.cursorDiv),t(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,c&&(i.lastWrapHeight=n.wrapperHeight,i.lastWrapWidth=n.wrapperWidth,yi(e,400)),i.updateLineNumbers=null,!0}function Di(e,t){for(var n=t.viewport,i=!0;(i&&e.options.lineWrapping&&t.oldDisplayWidth!=Xt(e)||(n&&null!=n.top&&(n={top:Math.min(e.doc.height+Bt(e.display)-Pt(e),n.top)}),t.visible=jn(e.display,e.doc,n),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&wi(e,t);i=!1){Rn(e);var r=oi(e);En(e),ai(e,r),Oi(e,r),t.force=!1}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 xi(e,t){var n=new Ss(e,t);if(wi(e,n)){Rn(e),Di(e,n);var i=oi(e);En(e),ai(e,i),Oi(e,i),n.finish()}}function Si(e,n,i){function r(t){var n=t.nextSibling;return Ta&&Na&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),n}for(var o=e.display,a=e.options.lineNumbers,s=o.lineDiv,c=s.firstChild,u=o.view,l=o.viewFrom,d=0;d-1&&(f=!1),At(e,p,l,i)),f&&(t(p.lineNumber),p.lineNumber.appendChild(document.createTextNode(ae(e.options,l)))),c=p.node.nextSibling}else{var m=kt(e,p,l,i);s.insertBefore(m,c)}l+=p.size}for(;c;)c=r(c)}function ki(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Oi(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+qt(e)+"px"}function Ci(e){var t=e.display,n=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var i=An(t)-t.scroller.scrollLeft+e.doc.scrollLeft,r=t.gutters.offsetWidth,o=i+"px",a=0;aa.clientWidth,c=a.scrollHeight>a.clientHeight;if(i&&s||r&&c){if(r&&Na&&Ta)e:for(var u=t.target,l=o.view;u!=a;u=u.parentNode)for(var d=0;d0:c>=0){var u=he(s.from(),a.from()),l=de(s.to(),a.to()),d=s.empty()?a.from()==a.head:s.from()==s.head;o<=n&&--n,t.splice(--o,2,new Es(d?l:u,d?u:l))}}return new Cs(t,n)}function Hi(e,t){return new Cs([new Es(e,t||e)],0)}function Ri(e){return e.text?se(e.from.line+e.text.length-1,m(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function Ii(e,t){if(ce(e,t.from)<0)return e;if(ce(e,t.to)<=0)return Ri(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,i=e.ch;return e.line==t.to.line&&(i+=Ri(t).ch-t.to.ch),se(n,i)}function ji(e,t){for(var n=[],i=0;i1&&e.remove(s.line+1,f-1),e.insert(s.line+1,v)}bt(e,"change",e,t)}function Qi(e,t,n){function i(e,r,o){if(e.linked)for(var a=0;a1&&!e.done[e.done.length-2].ranges?(e.done.pop(),m(e.done)):void 0}function ar(e,t,n,i){var r=e.history;r.undone.length=0;var o,a,s=+new Date;if((r.lastOp==i||r.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&r.lastModTime>s-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(o=or(r,r.lastOp==i)))a=m(o.changes),0==ce(t.from,t.to)&&0==ce(t.from,a.to)?a.to=Ri(t):o.changes.push(ir(e,t));else{var c=m(r.done);for(c&&c.ranges||ur(e.sel,r.done),o={changes:[ir(e,t)],generation:r.generation},r.done.push(o);r.done.length>r.undoDepth;)r.done.shift(),r.done[0].ranges||r.done.shift()}r.done.push(n),r.generation=++r.maxGeneration,r.lastModTime=r.lastSelTime=s,r.lastOp=r.lastSelOp=i,r.lastOrigin=r.lastSelOrigin=t.origin,a||O(e,"historyAdded")}function sr(e,t,n,i){var r=t.charAt(0);return"*"==r||"+"==r&&n.ranges.length==i.ranges.length&&n.somethingSelected()==i.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function cr(e,t,n,i){var r=e.history,o=i&&i.origin;n==r.lastSelOp||o&&r.lastSelOrigin==o&&(r.lastModTime==r.lastSelTime&&r.lastOrigin==o||sr(e,o,m(r.done),t))?r.done[r.done.length-1]=t:ur(t,r.done),r.lastSelTime=+new Date,r.lastSelOrigin=o,r.lastSelOp=n,i&&i.clearRedo!==!1&&rr(r.undone)}function ur(e,t){var n=m(t);n&&n.ranges&&n.equals(e)||t.push(e)}function lr(e,t,n,i){var r=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,i),function(n){n.markedSpans&&((r||(r=t["spans_"+e.id]={}))[o]=n.markedSpans),++o})}function dr(e){if(!e)return null;for(var t,n=0;n-1&&(m(s)[d]=u[d],delete u[d])}}}return i}function mr(e,t,n,i){if(i){var r=e.anchor;if(n){var o=ce(t,r)<0;o!=ce(n,r)<0?(r=t,t=n):o!=ce(t,n)<0&&(t=n)}return new Es(r,t)}return new Es(n||t,t)}function Mr(e,t,n,i,r){null==r&&(r=e.cm&&(e.cm.display.shift||e.extend)),Ar(e,new Cs([mr(e.sel.primary(),t,n,r)],0),i)}function gr(e,t,n){for(var i=[],r=e.cm&&(e.cm.display.shift||e.extend),o=0;o=t.ch:s.to>t.ch))){if(r&&(O(c,"beforeCursorEnter"),c.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(!c.atomic)continue;if(n){var d=c.find(i<0?1:-1),h=void 0;if((i<0?l:u)&&(d=Sr(e,d,-i,d&&d.line==t.line?o:null)),d&&d.line==t.line&&(h=ce(d,n))&&(i<0?h<0:h>0))return Dr(e,d,t,i,r)}var p=c.find(i<0?-1:1);return(i<0?u:l)&&(p=Sr(e,p,i,p.line==t.line?o:null)),p?Dr(e,p,t,i,r):null}}return t}function xr(e,t,n,i,r){var o=i||1,a=Dr(e,t,n,o,r)||!r&&Dr(e,t,n,o,!0)||Dr(e,t,n,-o,r)||!r&&Dr(e,t,n,-o,!0);return a?a:(e.cantEdit=!0,se(e.first,0))}function Sr(e,t,n,i){return n<0&&0==t.ch?t.line>e.first?fe(e,se(t.line-1)):null:n>0&&t.ch==(i||Z(e,t.line)).text.length?t.line=0;--r)Er(e,{from:i[r].from,to:i[r].to,text:r?[""]:t.text,origin:t.origin});else Er(e,t)}}function Er(e,t){if(1!=t.text.length||""!=t.text[0]||0!=ce(t.from,t.to)){var n=ji(e,t);ar(e,t,n,e.cm?e.cm.curOp.id:NaN),Wr(e,t,n,We(e,t));var i=[];Qi(e,function(e,n){n||h(i,e.history)!=-1||(Pr(e.history,t),i.push(e.history)),Wr(e,t,null,We(e,t))})}}function Nr(e,t,n){var i=e.cm&&e.cm.state.suppressEdits;if(!i||n){for(var r,o=e.history,a=e.sel,s="undo"==t?o.done:o.undone,c="undo"==t?o.undone:o.done,u=0;u=0;--f){var M=p(f);if(M)return M.v}}}}function Yr(e,t){if(0!=t&&(e.first+=t,e.sel=new Cs(M(e.sel.ranges,function(e){return new Es(se(e.anchor.line+t,e.anchor.ch),se(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){Dn(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,i=n.viewFrom;ie.lastLine())){if(t.from.lineo&&(t={from:t.from,to:se(o,Z(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=ee(e,t.from,t.to),n||(n=ji(e,t)),e.cm?Br(e.cm,t,i):Vi(e,t,i),Lr(e,n,Ga),e.cantEdit&&xr(e,se(e.firstLine(),0))&&(e.cantEdit=!1)}}function Br(e,t,n){var i=e.doc,r=e.display,o=t.from,a=t.to,s=!1,c=o.line;e.options.lineWrapping||(c=ie(Ke(Z(i,o.line))),i.iter(c,a.line+1,function(e){if(e==r.maxLine)return s=!0,!0})),i.sel.contains(t.from,t.to)>-1&&E(e),Vi(i,t,n,Ln(e)),e.options.lineWrapping||(i.iter(c,o.line+t.text.length,function(e){var t=it(e);t>r.maxLineLength&&(r.maxLine=e,r.maxLineLength=t,r.maxLineChanged=!0,s=!1)}),s&&(e.curOp.updateMaxLine=!0)),De(i,o.line),yi(e,400);var u=t.text.length-(a.line-o.line)-1;t.full?Dn(e):o.line!=a.line||1!=t.text.length||$i(e.doc,t)?Dn(e,o.line,a.line+1,u):xn(e,o.line,"text");var l=N(e,"changes"),d=N(e,"change");if(d||l){var h={from:o,to:a,text:t.text,removed:t.removed,origin:t.origin};d&&bt(e,"change",e,h),l&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(h)}e.display.selForContextMenu=null}function Fr(e,t,n,i,r){var o;i||(i=n),ce(i,n)<0&&(o=[i,n],n=o[0],i=o[1]),"string"==typeof t&&(t=e.splitLines(t)),Cr(e,{from:n,to:i,text:t,origin:r})}function qr(e,t,n,i){n0||0==s&&a.clearWhenEmpty!==!1)return a;if(a.replacedWith&&(a.collapsed=!0,a.widgetNode=r("span",[a.replacedWith],"CodeMirror-widget"),i.handleMouseEvents||a.widgetNode.setAttribute("cm-ignore-events","true"),i.insertLeft&&(a.widgetNode.insertLeft=!0)),a.collapsed){if(Ge(e,t.line,t,n,a)||t.line!=n.line&&Ge(e,n.line,t,n,a))throw new Error("Inserting collapsed marker partially overlapping an existing one");Se()}a.addToHistory&&ar(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var c,u=t.line,d=e.cm;if(e.iter(u,n.line+1,function(e){d&&a.collapsed&&!d.options.lineWrapping&&Ke(e)==d.display.maxLine&&(c=!0),a.collapsed&&u!=t.line&&ne(e,0),Ee(e,new ke(a,u==t.line?t.ch:null,u==n.line?n.ch:null)),++u}),a.collapsed&&e.iter(t.line,n.line+1,function(t){et(e,t)&&ne(t,0)}),a.clearOnEnter&&is(a,"beforeCursorEnter",function(){return a.clear()}),a.readOnly&&(xe(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),a.collapsed&&(a.id=++Ys,a.atomic=!0),d){if(c&&(d.curOp.updateMaxLine=!0),a.collapsed)Dn(d,t.line,n.line+1);else if(a.className||a.startStyle||a.endStyle||a.css||a.attributes||a.title)for(var h=t.line;h<=n.line;h++)xn(d,h,"text");a.atomic&&zr(d.doc),bt(d,"markerAdded",d,a)}return a}function Gr(e,t,n,i,r){i=l(i),i.shared=!1;var o=[Jr(e,t,n,i,r)],a=o[0],s=i.widgetNode;return Qi(e,function(e){s&&(i.widgetNode=s.cloneNode(!0)),o.push(Jr(e,fe(e,t),fe(e,n),i,r));for(var c=0;c-1)return t.state.draggingText(e),void setTimeout(function(){return t.display.input.focus()},20);try{var l=e.dataTransfer.getData("Text");if(l){var d;if(t.state.draggingText&&!t.state.draggingText.copy&&(d=t.listSelections()),Lr(t.doc,Hi(n,n)),d)for(var p=0;p=0;t--)Fr(e.doc,"",i[t].from,i[t].to,"+delete");Vn(e)})}function mo(e,t,n){var i=T(e.text,t+n,n);return i<0||i>e.text.length?null:i}function Mo(e,t,n){var i=mo(e,t.ch,n);return null==i?null:new se(t.line,i,n<0?"after":"before")}function go(e,t,n,i,r){if(e){"rtl"==t.getOption("direction")&&(r=-r);var o=x(n,t.doc.direction);if(o){var a,s=r<0?m(o):o[0],c=r<0==(1==s.level),u=c?"after":"before";if(s.level>0||"rtl"==t.doc.direction){var l=Jt(t,n);a=r<0?n.text.length-1:0;var d=Gt(t,l,a).top;a=z(function(e){return Gt(t,l,e).top==d},r<0==(1==s.level)?s.from:s.to-1,a),"before"==u&&(a=mo(n,a,1))}else a=r<0?s.to:s.from;return new se(i,a,u)}}return new se(i,r<0?n.text.length:0,r<0?"before":"after")}function vo(e,t,n,i){var r=x(t,e.doc.direction);if(!r)return Mo(t,n,i);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var o=D(r,n.ch,n.sticky),a=r[o];if("ltr"==e.doc.direction&&a.level%2==0&&(i>0?a.to>n.ch:a.from=a.from&&h>=l.begin)){var p=d?"before":"after";return new se(n.line,h,p)}}var f=function(e,t,i){for(var o=function(e,t){return t?new se(n.line,c(e,1),"before"):new se(n.line,e,"after")};e>=0&&e0==(1!=a.level),u=s?i.begin:c(i.end,-1);if(a.from<=u&&u0?l.end:c(l.begin,-1);return null==M||i>0&&M==t.text.length||!(m=f(i>0?0:r.length-1,i,u(M)))?null:m}function _o(e,t){var n=Z(e.doc,t),i=Ke(n);return i!=n&&(t=ie(i)),go(!0,e,i,t,1)}function bo(e,t){var n=Z(e.doc,t),i=$e(n);return i!=n&&(t=ie(i)),go(!0,e,n,t,-1)}function yo(e,t){var n=_o(e,t.line),i=Z(e.doc,n.line),r=x(i,e.doc.direction);if(!r||0==r[0].level){var o=Math.max(0,i.text.search(/\S/)),a=t.line==n.line&&t.ch<=o&&t.ch;return se(n.line,a?0:o,n.sticky)}return n}function Ao(e,t,n){if("string"==typeof t&&(t=Js[t],!t))return!1;e.display.input.ensurePolled();var i=e.display.shift,r=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),r=t(e)!=Ja}finally{e.display.shift=i,e.state.suppressEdits=!1}return r}function Lo(e,t,n){for(var i=0;i-1&&(ce((r=s.ranges[r]).from(),t)<0||t.xRel>0)&&(ce(r.to(),t)>0||t.xRel<0)?Bo(e,i,t,o):qo(e,i,t,o)}function Bo(e,t,n,i){var r=e.display,o=!1,a=vi(e,function(t){Ta&&(r.scroller.draggable=!1),e.state.draggingText=!1,k(r.wrapper.ownerDocument,"mouseup",a),k(r.wrapper.ownerDocument,"mousemove",s),k(r.scroller,"dragstart",c),k(r.scroller,"drop",a),o||(W(t),i.addNew||Mr(e.doc,n,null,null,i.extend),Ta||Aa&&9==La?setTimeout(function(){r.wrapper.ownerDocument.body.focus(),r.input.focus()},20):r.input.focus())}),s=function(e){o=o||Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)>=10},c=function(){return o=!0};Ta&&(r.scroller.draggable=!0),e.state.draggingText=a,a.copy=!i.moveOnDrag,r.scroller.dragDrop&&r.scroller.dragDrop(),is(r.wrapper.ownerDocument,"mouseup",a),is(r.wrapper.ownerDocument,"mousemove",s),is(r.scroller,"dragstart",c),is(r.scroller,"drop",a),Xn(e),setTimeout(function(){return r.input.focus()},20)}function Fo(e,t,n){if("char"==n)return new Es(t,t);if("word"==n)return e.findWordAt(t);if("line"==n)return new Es(se(t.line,0),fe(e.doc,se(t.line+1,0)));var i=n(e,t);return new Es(i.from,i.to)}function qo(e,t,n,i){function r(t){if(0!=ce(g,t))if(g=t,"rectangle"==i.unit){for(var r=[],o=e.options.tabSize,a=d(Z(u,n.line).text,n.ch,o),s=d(Z(u,t.line).text,t.ch,o),c=Math.min(a,s),m=Math.max(a,s),M=Math.min(n.line,t.line),v=Math.min(e.lastLine(),Math.max(n.line,t.line));M<=v;M++){var _=Z(u,M).text,b=p(_,c,o);c==m?r.push(new Es(se(M,b),se(M,b))):_.length>b&&r.push(new Es(se(M,b),se(M,p(_,m,o))))}r.length||r.push(new Es(n,n)),Ar(u,Pi(e,f.ranges.slice(0,h).concat(r),h),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var y,A=l,L=Fo(e,t,i.unit),T=A.anchor;ce(L.anchor,T)>0?(y=L.head,T=he(A.from(),L.anchor)):(y=L.anchor,T=de(A.to(),L.head));var z=f.ranges.slice(0);z[h]=Xo(e,new Es(fe(u,T),y)),Ar(u,Pi(e,z,h),Ka)}}function o(t){var n=++_,s=zn(e,t,!0,"rectangle"==i.unit);if(s)if(0!=ce(s,g)){e.curOp.focus=a(),r(s);var l=jn(c,u);(s.line>=l.to||s.linev.bottom?20:0;d&&setTimeout(vi(e,function(){_==n&&(c.scroller.scrollTop+=d,o(t))}),50)}}function s(t){e.state.selectingText=!1,_=1/0,t&&(W(t),c.input.focus()),k(c.wrapper.ownerDocument,"mousemove",b),k(c.wrapper.ownerDocument,"mouseup",y),u.history.lastSelOrigin=null}var c=e.display,u=e.doc;W(t);var l,h,f=u.sel,m=f.ranges;if(i.addNew&&!i.extend?(h=u.sel.contains(n),l=h>-1?m[h]:new Es(n,n)):(l=u.sel.primary(),h=u.sel.primIndex),"rectangle"==i.unit)i.addNew||(l=new Es(n,n)),n=zn(e,t,!0,!0),h=-1;else{var M=Fo(e,n,i.unit);l=i.extend?mr(l,M.anchor,M.head,i.extend):M}i.addNew?h==-1?(h=m.length,Ar(u,Pi(e,m.concat([l]),h),{scroll:!1,origin:"*mouse"})):m.length>1&&m[h].empty()&&"char"==i.unit&&!i.extend?(Ar(u,Pi(e,m.slice(0,h).concat(m.slice(h+1)),0),{scroll:!1,origin:"*mouse"}),f=u.sel):vr(u,h,l,Ka):(h=0,Ar(u,new Cs([l],0),Ka),f=u.sel);var g=n,v=c.wrapper.getBoundingClientRect(),_=0,b=vi(e,function(e){0!==e.buttons&&P(e)?o(e):s(e)}),y=vi(e,s);e.state.selectingText=y,is(c.wrapper.ownerDocument,"mousemove",b),is(c.wrapper.ownerDocument,"mouseup",y)}function Xo(e,t){var n=t.anchor,i=t.head,r=Z(e.doc,n.line);if(0==ce(n,i)&&n.sticky==i.sticky)return t;var o=x(r);if(!o)return t;var a=D(o,n.ch,n.sticky),s=o[a];if(s.from!=n.ch&&s.to!=n.ch)return t;var c=a+(s.from==n.ch==(1!=s.level)?0:1);if(0==c||c==o.length)return t;var u;if(i.line!=n.line)u=(i.line-n.line)*("ltr"==e.doc.direction?1:-1)>0;else{var l=D(o,i.ch,i.sticky),d=l-a||(i.ch-n.ch)*(1==s.level?-1:1);u=l==c-1||l==c?d<0:d>0}var h=o[c+(u?-1:0)],p=u==(1==h.level),f=p?h.from:h.to,m=p?"after":"before";return n.ch==f&&n.sticky==m?t:new Es(new se(n.line,f,m),i)}function Po(e,t,n,i){var r,o;if(t.touches)r=t.touches[0].clientX,o=t.touches[0].clientY;else try{r=t.clientX,o=t.clientY}catch(e){return!1}if(r>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;i&&W(t);var a=e.display,s=a.lineDiv.getBoundingClientRect();if(o>s.bottom||!N(e,n))return F(t);o-=s.top-a.viewOffset;for(var c=0;c=r){var l=re(e.doc,o),d=e.display.gutterSpecs[c];return O(e,n,e,l,d.className,t),F(t)}}}function Ho(e,t){return Po(e,t,"gutterClick",!0)}function Ro(e,t){Yt(e.display,t)||Io(e,t)||C(e,t,"contextmenu")||Xa||e.display.input.onContextMenu(t)}function Io(e,t){return!!N(e,"gutterContextMenu")&&Po(e,t,"gutterContextMenu",!1)}function jo(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),tn(e)}function Uo(e){function t(t,i,r,o){e.defaults[t]=i,r&&(n[t]=o?function(e,t,n){n!=ec&&r(e,t,n)}:r)}var n=e.optionHandlers;e.defineOption=t,e.Init=ec,t("value","",function(e,t){return e.setValue(t)},!0),t("mode",null,function(e,t){e.doc.modeOption=t,Gi(e)},!0),t("indentUnit",2,Gi,!0),t("indentWithTabs",!1),t("smartIndent",!0),t("tabSize",4,function(e){Ki(e),tn(e),Dn(e)},!0),t("lineSeparator",null,function(e,t){if(e.doc.lineSep=t,t){var n=[],i=e.doc.first;e.doc.iter(function(e){for(var r=0;;){var o=e.text.indexOf(t,r);if(o==-1)break;r=o+t.length,n.push(se(i,o))}i++});for(var r=n.length-1;r>=0;r--)Fr(e.doc,t,n[r],se(n[r].line,n[r].ch+t.length))}}),t("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(e,t,n){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),n!=ec&&e.refresh()}),t("specialCharPlaceholder",ut,function(e){return e.refresh()},!0),t("electricChars",!0),t("inputStyle",Ea?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),t("spellcheck",!1,function(e,t){return e.getInputField().spellcheck=t},!0),t("autocorrect",!1,function(e,t){return e.getInputField().autocorrect=t},!0),t("autocapitalize",!1,function(e,t){return e.getInputField().autocapitalize=t},!0),t("rtlMoveVisually",!Wa),t("wholeLineUpdateBefore",!0),t("theme","default",function(e){jo(e),Wi(e)},!0),t("keyMap","default",function(e,t,n){var i=po(t),r=n!=ec&&po(n);r&&r.detach&&r.detach(e,i),i.attach&&i.attach(e,r||null)}),t("extraKeys",null),t("configureMouse",null),t("lineWrapping",!1,Go,!0),t("gutters",[],function(e,t){e.display.gutterSpecs=Ni(t,e.options.lineNumbers),Wi(e)},!0),t("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?An(e.display)+"px":"0",e.refresh()},!0),t("coverGutterNextToScrollbar",!1,function(e){return ai(e)},!0),t("scrollbarStyle","native",function(e){ci(e),ai(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),t("lineNumbers",!1,function(e,t){e.display.gutterSpecs=Ni(e.options.gutters,t),Wi(e)},!0),t("firstLineNumber",1,Wi,!0),t("lineNumberFormatter",function(e){return e},Wi,!0),t("showCursorWhenSelecting",!1,En,!0),t("resetSelectionOnContextMenu",!0),t("lineWiseCopyCut",!0),t("pasteLinesPerSelection",!0),t("selectionsMayTouch",!1),t("readOnly",!1,function(e,t){"nocursor"==t&&(Hn(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)}),t("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),t("dragDrop",!0,Jo),t("allowDropFileTypes",null),t("cursorBlinkRate",530),t("cursorScrollMargin",0),t("cursorHeight",1,En,!0),t("singleCursorHeightPerLine",!0,En,!0),t("workTime",100),t("workDelay",100),t("flattenSpans",!0,Ki,!0),t("addModeClass",!1,Ki,!0),t("pollInterval",100),t("undoDepth",200,function(e,t){return e.doc.history.undoDepth=t}),t("historyEventDelay",1250),t("viewportMargin",10,function(e){return e.refresh()},!0),t("maxHighlightLength",1e4,Ki,!0),t("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),t("tabindex",null,function(e,t){return e.display.input.getField().tabIndex=t||""}),t("autofocus",null),t("direction","ltr",function(e,t){return e.doc.setDirection(t)},!0),t("phrases",null)}function Jo(e,t,n){var i=n&&n!=ec;if(!t!=!i){var r=e.display.dragFunctions,o=t?is:k;o(e.display.scroller,"dragstart",r.start),o(e.display.scroller,"dragenter",r.enter),o(e.display.scroller,"dragover",r.over),o(e.display.scroller,"dragleave",r.leave),o(e.display.scroller,"drop",r.drop)}}function Go(e){e.options.lineWrapping?(s(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(Pa(e.display.wrapper,"CodeMirror-wrap"),rt(e)),Tn(e),Dn(e),tn(e),setTimeout(function(){return ai(e)},100)}function Ko(e,t){var n=this;if(!(this instanceof Ko))return new Ko(e,t);this.options=t=t?l(t):{},l(tc,t,!1);var i=t.value;"string"==typeof i?i=new qs(i,t.mode,null,t.lineSeparator,t.direction):t.mode&&(i.modeOption=t.mode),this.doc=i;var r=new Ko.inputStyles[t.inputStyle](this),o=this.display=new Bi(e,i,r,t);o.wrapper.CodeMirror=this,jo(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),ci(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new Ra,keySeq:null,specialChars:null},t.autofocus&&!Ea&&o.input.focus(),Aa&&La<11&&setTimeout(function(){return n.display.input.reset(!0)},20),$o(this),io(),ui(this),this.curOp.forceUpdate=!0,Zi(this,i),t.autofocus&&!Ea||this.hasFocus()?setTimeout(u(Pn,this),20):Hn(this);for(var a in nc)nc.hasOwnProperty(a)&&nc[a](this,t[a],ec);Ei(this),t.finishInit&&t.finishInit(this);for(var s=0;s400}var r=e.display;is(r.scroller,"mousedown",vi(e,Eo)),Aa&&La<11?is(r.scroller,"dblclick",vi(e,function(t){if(!C(e,t)){var n=zn(e,t);if(n&&!Ho(e,t)&&!Yt(e.display,t)){W(t);var i=e.findWordAt(n);Mr(e.doc,i.anchor,i.head)}}})):is(r.scroller,"dblclick",function(t){return C(e,t)||W(t)}),is(r.scroller,"contextmenu",function(t){return Ro(e,t)}),is(r.input.getField(),"contextmenu",function(t){r.scroller.contains(t.target)||Ro(e,t)});var o,a={end:0};is(r.scroller,"touchstart",function(t){if(!C(e,t)&&!n(t)&&!Ho(e,t)){r.input.ensurePolled(),clearTimeout(o);var i=+new Date;r.activeTouch={start:i,moved:!1,prev:i-a.end<=300?a:null},1==t.touches.length&&(r.activeTouch.left=t.touches[0].pageX,
-r.activeTouch.top=t.touches[0].pageY)}}),is(r.scroller,"touchmove",function(){r.activeTouch&&(r.activeTouch.moved=!0)}),is(r.scroller,"touchend",function(n){var o=r.activeTouch;if(o&&!Yt(r,n)&&null!=o.left&&!o.moved&&new Date-o.start<300){var a,s=e.coordsChar(r.activeTouch,"page");a=!o.prev||i(o,o.prev)?new Es(s,s):!o.prev.prev||i(o,o.prev.prev)?e.findWordAt(s):new Es(se(s.line,0),fe(e.doc,se(s.line+1,0))),e.setSelection(a.anchor,a.head),e.focus(),W(n)}t()}),is(r.scroller,"touchcancel",t),is(r.scroller,"scroll",function(){r.scroller.clientHeight&&(ni(e,r.scroller.scrollTop),ri(e,r.scroller.scrollLeft,!0),O(e,"scroll",e))}),is(r.scroller,"mousewheel",function(t){return Xi(e,t)}),is(r.scroller,"DOMMouseScroll",function(t){return Xi(e,t)}),is(r.wrapper,"scroll",function(){return r.wrapper.scrollTop=r.wrapper.scrollLeft=0}),r.dragFunctions={enter:function(t){C(e,t)||q(t)},over:function(t){C(e,t)||(eo(e,t),q(t))},start:function(t){return Zr(e,t)},drop:vi(e,Qr),leave:function(t){C(e,t)||to(e)}};var s=r.input.getField();is(s,"keyup",function(t){return ko.call(e,t)}),is(s,"keydown",vi(e,xo)),is(s,"keypress",vi(e,Oo)),is(s,"focus",function(t){return Pn(e,t)}),is(s,"blur",function(t){return Hn(e,t)})}function Vo(e,t,n,i){var r,o=e.doc;null==n&&(n="add"),"smart"==n&&(o.mode.indent?r=_e(e,t).state:n="prev");var a=e.options.tabSize,s=Z(o,t),c=d(s.text,null,a);s.stateAfter&&(s.stateAfter=null);var u,l=s.text.match(/^\s*/)[0];if(i||/\S/.test(s.text)){if("smart"==n&&(u=o.mode.indent(r,s.text.slice(l.length),s.text),u==Ja||u>150)){if(!i)return;n="prev"}}else u=0,n="not";"prev"==n?u=t>o.first?d(Z(o,t-1).text,null,a):0:"add"==n?u=c+e.options.indentUnit:"subtract"==n?u=c-e.options.indentUnit:"number"==typeof n&&(u=c+n),u=Math.max(0,u);var h="",p=0;if(e.options.indentWithTabs)for(var m=Math.floor(u/a);m;--m)p+=a,h+="\t";if(pa,c=os(t),u=null;if(s&&i.ranges.length>1)if(rc&&rc.text.join("\n")==t){if(i.ranges.length%rc.text.length==0){u=[];for(var l=0;l=0;h--){var p=i.ranges[h],f=p.from(),g=p.to();p.empty()&&(n&&n>0?f=se(f.line,f.ch-n):e.state.overwrite&&!s?g=se(g.line,Math.min(Z(o,g.line).text.length,g.ch+m(c).length)):s&&rc&&rc.lineWise&&rc.text.join("\n")==t&&(f=g=se(f.line,0)));var v={from:f,to:g,text:u?u[h%u.length]:c,origin:r||(s?"paste":e.state.cutIncoming>a?"cut":"+input")};Cr(e.doc,v),bt(e,"inputRead",e,v)}t&&!s&&ta(e,t),Vn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=d),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function ea(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||gi(t,function(){return Zo(t,n,0,null,"paste")}),!0}function ta(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var n=e.doc.sel,i=n.ranges.length-1;i>=0;i--){var r=n.ranges[i];if(!(r.head.ch>100||i&&n.ranges[i-1].head.line==r.head.line)){var o=e.getModeAt(r.head),a=!1;if(o.electricChars){for(var s=0;s-1){a=Vo(e,r.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(Z(e.doc,r.head.line).text.slice(0,r.head.ch))&&(a=Vo(e,r.head.line,"smart"));a&&bt(e,"electricInput",e,r.head.line)}}}function na(e){for(var t=[],n=[],i=0;in&&(Vo(this,r.head.line,e,!0),n=r.head.line,i==this.doc.sel.primIndex&&Vn(this));else{var o=r.from(),a=r.to(),s=Math.max(n,o.line);n=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1;for(var c=s;c0&&vr(this.doc,i,new Es(o,u[i].to()),Ga)}}}),getTokenAt:function(e,t){return Le(this,e,t)},getLineTokens:function(e,t){return Le(this,se(e),t,!0)},getTokenTypeAt:function(e){e=fe(this.doc,e);var t,n=ve(this,Z(this.doc,e.line)),i=0,r=(n.length-1)/2,o=e.ch;if(0==o)t=n[2];else for(;;){var a=i+r>>1;if((a?n[2*a-1]:0)>=o)r=a;else{if(!(n[2*a+1]o&&(e=o,r=!0),i=Z(this.doc,e)}else i=e;return an(this,i,{top:0,left:0},t||"page",n||r).top+(r?this.doc.height-nt(i):0)},defaultTextHeight:function(){return _n(this.display)},defaultCharWidth:function(){return bn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,n,i,r){var o=this.display;e=un(this,fe(this.doc,e));var a=e.bottom,s=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),o.sizer.appendChild(t),"over"==i)a=e.top;else if("above"==i||"near"==i){var c=Math.max(o.wrapper.clientHeight,this.doc.height),u=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==i||e.bottom+t.offsetHeight>c)&&e.top>t.offsetHeight?a=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=c&&(a=e.bottom),s+t.offsetWidth>u&&(s=u-t.offsetWidth)}t.style.top=a+"px",t.style.left=t.style.right="","right"==r?(s=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==r?s=0:"middle"==r&&(s=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=s+"px"),n&&Gn(this,{left:s,top:a,right:s+t.offsetWidth,bottom:a+t.offsetHeight})},triggerOnKeyDown:_i(xo),triggerOnKeyPress:_i(Oo),triggerOnKeyUp:ko,triggerOnMouseDown:_i(Eo),execCommand:function(e){if(Js.hasOwnProperty(e))return Js[e].call(null,this)},triggerElectric:_i(function(e){ta(this,e)}),findPosH:function(e,t,n,i){var r=1;t<0&&(r=-1,t=-t);for(var o=fe(this.doc,e),a=0;a0&&s(n.charAt(i-1));)--i;for(;r.5)&&Tn(this),O(this,"refresh",this)}),swapDoc:_i(function(e){var t=this.doc;return t.cm=null,this.state.selectingText&&this.state.selectingText(),Zi(this,e),tn(this),this.display.input.reset(),Qn(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,bt(this,"swapDoc",this,t),t}),phrase:function(e){var t=this.options.phrases;return t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:e},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Y(e),e.registerHelper=function(t,i,r){n.hasOwnProperty(t)||(n[t]=e[t]={_global:[]}),n[t][i]=r},e.registerGlobalHelper=function(t,i,r,o){e.registerHelper(t,i,o),n[t]._global.push({pred:r,val:o})}}function aa(e,t,n,i,r){function o(){var n=t.line+l;return!(n=e.first+e.size)&&(t=new se(n,t.ch,t.sticky),u=Z(e,n))}function a(i){var a;if(a=r?vo(e.cm,u,t,n):Mo(u,t,n),null==a){if(i||!o())return!1;t=go(r,e.cm,u,t.line,l)}else t=a;return!0}var s=t,c=n,u=Z(e,t.line),l=r&&e.cm&&"rtl"==e.cm.getOption("direction")?-n:n;if("char"==i)a();else if("column"==i)a(!0);else if("word"==i||"group"==i)for(var d=null,h="group"==i,p=e.cm&&e.cm.getHelper(t,"wordChars"),f=!0;!(n<0)||a(!f);f=!1){var m=u.text.charAt(t.ch)||"\n",M=y(m,p)?"w":h&&"\n"==m?"n":!h||/\s/.test(m)?null:"p";if(!h||f||M||(M="s"),d&&d!=M){n<0&&(n=1,a(),t.sticky="after");break}if(M&&(d=M),n>0&&!a(!f))break}var g=xr(e,t,s,c,!0);return ue(s,g)&&(g.hitSide=!0),g}function sa(e,t,n,i){var r,o=e.doc,a=t.left;if("page"==i){var s=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),c=Math.max(s-.5*_n(e.display),3);r=(n>0?t.bottom:t.top)+n*c}else"line"==i&&(r=n>0?t.bottom+3:t.top-3);for(var u;u=hn(e,a,r),u.outside;){if(n<0?r<=0:r>=o.height){u.hitSide=!0;break}r+=5*n}return u}function ca(e,t){var n=Ut(e,t.line);if(!n||n.hidden)return null;var i=Z(e.doc,t.line),r=Rt(n,i,t.line),o=x(i,e.doc.direction),a="left";if(o){var s=D(o,t.ch);a=s%2?"right":"left"}var c=Kt(r.map,t.ch,a);return c.offset="right"==c.collapse?c.end:c.start,c}function ua(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function la(e,t){return t&&(e.bad=!0),e}function da(e,t,n,i,r){function o(e){return function(t){return t.id==e}}function a(){l&&(u+=d,h&&(u+=d),l=h=!1)}function s(e){e&&(a(),u+=e)}function c(t){if(1==t.nodeType){var n=t.getAttribute("cm-text");if(n)return void s(n);var u,p=t.getAttribute("cm-marker");if(p){var f=e.findMarks(se(i,0),se(r+1,0),o(+p));return void(f.length&&(u=f[0].find(0))&&s(ee(e.doc,u.from,u.to).join(d)))}if("false"==t.getAttribute("contenteditable"))return;var m=/^(pre|div|p|li|table|br)$/i.test(t.nodeName);if(!/^br$/i.test(t.nodeName)&&0==t.textContent.length)return;m&&a();for(var M=0;M=15&&(Da=!1,Ta=!0);var Fa,qa=Na&&(za||Da&&(null==Ba||Ba<12.11)),Xa=va||Aa&&La>=9,Pa=function(t,n){var i=t.className,r=e(n).exec(i);if(r){var o=i.slice(r.index+r[0].length);t.className=i.slice(0,r.index)+(o?r[1]+o:"")}};Fa=document.createRange?function(e,t,n,i){var r=document.createRange();return r.setEnd(i||e,n),r.setStart(e,t),r}:function(e,t,n){var i=document.body.createTextRange();try{i.moveToElementText(e.parentNode)}catch(e){return i}return i.collapse(!0),i.moveEnd("character",n),i.moveStart("character",t),i};var Ha=function(e){e.select()};Oa?Ha=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:Aa&&(Ha=function(e){try{e.select()}catch(e){}});var Ra=function(){this.id=null,this.f=null,this.time=0,this.handler=u(this.onTimeout,this)};Ra.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},Ra.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n=this.string.length},hs.prototype.sol=function(){return this.pos==this.lineStart},hs.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},hs.prototype.next=function(){if(this.post},hs.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},hs.prototype.skipToEnd=function(){this.pos=this.string.length},hs.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},hs.prototype.backUp=function(e){this.pos-=e},hs.prototype.column=function(){return this.lastColumnPos0?null:(i&&t!==!1&&(this.pos+=i[0].length),i)}var r=function(e){return n?e.toLowerCase():e},o=this.string.substr(this.pos,e.length);if(r(o)==r(e))return t!==!1&&(this.pos+=e.length),!0},hs.prototype.current=function(){return this.string.slice(this.start,this.pos)},hs.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},hs.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},hs.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var ps=function(e,t){this.state=e,this.lookAhead=t},fs=function(e,t,n,i){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=i||0,this.baseTokens=null,this.baseTokenPos=1};fs.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},fs.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},fs.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},fs.fromSaved=function(e,t,n){return t instanceof ps?new fs(e,$(e.mode,t.state),n,t.lookAhead):new fs(e,$(e.mode,t),n)},fs.prototype.save=function(e){var t=e!==!1?$(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new ps(t,this.maxLookAhead):t};var ms=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n},Ms=!1,gs=!1,vs=function(e,t,n){this.text=e,Xe(this,t),this.height=n?n(this):1};vs.prototype.lineNo=function(){return ie(this)},Y(vs);var _s,bs={},ys={},As=null,Ls=null,Ts={left:0,right:0,top:0,bottom:0},zs=function(e,t,n){this.cm=n;var r=this.vert=i("div",[i("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),o=this.horiz=i("div",[i("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=o.tabIndex=-1,e(r),e(o),is(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),is(o,"scroll",function(){o.clientWidth&&t(o.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,Aa&&La<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};zs.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,i=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?i+"px":"0";var r=e.viewHeight-(t?i:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+r)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?i+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(n?i:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(0==i&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?i:0,bottom:t?i:0}},zs.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},zs.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},zs.prototype.zeroWidthHack=function(){var e=Na&&!Sa?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Ra,this.disableVert=new Ra},zs.prototype.enableZeroWidthBar=function(e,t,n){function i(){var r=e.getBoundingClientRect(),o="vert"==n?document.elementFromPoint(r.right-1,(r.top+r.bottom)/2):document.elementFromPoint((r.right+r.left)/2,r.bottom-1);o!=e?e.style.pointerEvents="none":t.set(1e3,i)}e.style.pointerEvents="auto",t.set(1e3,i)},zs.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var ws=function(){};ws.prototype.update=function(){return{bottom:0,right:0}},ws.prototype.setScrollLeft=function(){},ws.prototype.setScrollTop=function(){},ws.prototype.clear=function(){};var Ds={native:zs,null:ws},xs=0,Ss=function(e,t,n){var i=e.display;this.viewport=t,this.visible=jn(i,e.doc,t),this.editorIsHidden=!i.wrapper.offsetWidth,this.wrapperHeight=i.wrapper.clientHeight,this.wrapperWidth=i.wrapper.clientWidth,this.oldDisplayWidth=Xt(e),this.force=n,this.dims=yn(e),this.events=[]};Ss.prototype.signal=function(e,t){N(e,t)&&this.events.push(arguments)},Ss.prototype.finish=function(){for(var e=0;e=0&&ce(e,i.to())<=0)return n}return-1};var Es=function(e,t){this.anchor=e,this.head=t};Es.prototype.from=function(){return he(this.anchor,this.head)},Es.prototype.to=function(){return de(this.anchor,this.head)},Es.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},Rr.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,i=e+t;n1||!(this.children[0]instanceof Rr))){var s=[];this.collapse(s),this.children=[new Rr(s)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var a=r.lines.length%25+25,s=a;s10);e.parent.maybeSpill()}},iterN:function(e,t,n){for(var i=0;ie.display.maxLineLength&&(e.display.maxLine=u,e.display.maxLineLength=l,e.display.maxLineChanged=!0)}null!=i&&e&&this.collapsed&&Dn(e,i,r+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&zr(e.doc)),e&&bt(e,"markerCleared",e,this,i,r),t&&li(e),this.parent&&this.parent.clear()}},Ws.prototype.find=function(e,t){null==e&&"bookmark"==this.type&&(e=1);for(var n,i,r=0;r=0;c--)Cr(this,i[c]);s?yr(this,s):this.cm&&Vn(this.cm)}),undo:bi(function(){Nr(this,"undo")}),redo:bi(function(){Nr(this,"redo")}),undoSelection:bi(function(){Nr(this,"undo",!0)}),redoSelection:bi(function(){Nr(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,i=0;i=e.ch)&&t.push(r.marker.parent||r.marker)}return t},findMarks:function(e,t,n){e=fe(this,e),t=fe(this,t);var i=[],r=e.line;return this.iter(e.line,t.line+1,function(o){var a=o.markedSpans;if(a)for(var s=0;s=c.to||null==c.from&&r!=e.line||null!=c.from&&r==t.line&&c.from>=t.ch||n&&!n(c.marker)||i.push(c.marker.parent||c.marker)}++r}),i},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var i=0;ie?(t=e,!0):(e-=o,void++n)}),fe(this,se(n,t))},indexFromPos:function(e){e=fe(this,e);var t=e.ch;if(e.linet&&(t=e.from),null!=e.to&&e.to0)r=new se(r.line,r.ch+1),e.replaceRange(o.charAt(r.ch-1)+o.charAt(r.ch-2),se(r.line,r.ch-2),r,"+transpose");else if(r.line>e.doc.first){var a=Z(e.doc,r.line-1).text;a&&(r=new se(r.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+a.charAt(a.length-1),se(r.line-1,a.length-1),r,"+transpose"))}n.push(new Es(r,r))}e.setSelections(n)})},newlineAndIndent:function(e){return gi(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var i=0;ie&&0==ce(t,this.pos)&&n==this.button};var Qs,Zs,ec={toString:function(){return"CodeMirror.Init"}},tc={},nc={};Ko.defaults=tc,Ko.optionHandlers=nc;var ic=[];Ko.defineInitHook=function(e){return ic.push(e)};var rc=null,oc=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Ra,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};oc.prototype.init=function(e){function t(e){if(!C(r,e)){if(r.somethingSelected())Qo({lineWise:!1,text:r.getSelections()}),"cut"==e.type&&r.replaceSelection("",null,"cut");else{if(!r.options.lineWiseCopyCut)return;var t=na(r);Qo({lineWise:!0,text:t.text}),"cut"==e.type&&r.operation(function(){r.setSelections(t.ranges,0,Ga),r.replaceSelection("",null,"cut")})}if(e.clipboardData){e.clipboardData.clearData();var n=rc.text.join("\n");if(e.clipboardData.setData("Text",n),e.clipboardData.getData("Text")==n)return void e.preventDefault()}var a=ra(),s=a.firstChild;r.display.lineSpace.insertBefore(a,r.display.lineSpace.firstChild),s.value=rc.text.join("\n");var c=document.activeElement;Ha(s),setTimeout(function(){r.display.lineSpace.removeChild(a),c.focus(),c==o&&i.showPrimarySelection()},50)}}var n=this,i=this,r=i.cm,o=i.div=e.lineDiv;ia(o,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize),is(o,"paste",function(e){C(r,e)||ea(e,r)||La<=11&&setTimeout(vi(r,function(){return n.updateFromDOM()}),20)}),is(o,"compositionstart",function(e){n.composing={data:e.data,done:!1}}),is(o,"compositionupdate",function(e){n.composing||(n.composing={data:e.data,done:!1})}),is(o,"compositionend",function(e){n.composing&&(e.data!=n.composing.data&&n.readFromDOMSoon(),n.composing.done=!0)}),is(o,"touchstart",function(){return i.forceCompositionEnd()}),is(o,"input",function(){n.composing||n.readFromDOMSoon()}),is(o,"copy",t),is(o,"cut",t)},oc.prototype.prepareSelection=function(){var e=Nn(this.cm,!1);return e.focus=this.cm.state.focused,e},oc.prototype.showSelection=function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},oc.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},oc.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),i=n.from(),r=n.to();if(t.display.viewTo==t.display.viewFrom||i.line>=t.display.viewTo||r.line