forgejo/public/js/index.js
jaqra 802aa6d5f3 Add comment highlight when target from url (#9047)
* Add comment highlight css

* Add js to remove highlight on click outside

* Improve refresh page on click outside

* Use location.hash property to remove target

* Handle click ONLY clicked outside of 'targetted comment' (not other comment)

* Remove unnecessary checks and simply code

* Combine hash and setState to remove target path
2019-11-25 11:50:46 +00:00

2 lines
120 KiB
JavaScript

!function(e){function t(t){for(var n,a,o=t[0],r=t[1],s=0,l=[];s<o.length;s++)a=o[s],Object.prototype.hasOwnProperty.call(i,a)&&i[a]&&l.push(i[a][0]),i[a]=0;for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n]);for(c&&c(t);l.length;)l.shift()()}var n={},i={1:0};function a(t){if(n[t])return n[t].exports;var i=n[t]={i:t,l:!1,exports:{}};return e[t].call(i.exports,i,i.exports,a),i.l=!0,i.exports}a.e=function(e){var t=[],n=i[e];if(0!==n)if(n)t.push(n[2]);else{var o=new Promise((function(t,a){n=i[e]=[t,a]}));t.push(n[2]=o);var r,s=document.createElement("script");s.charset="utf-8",s.timeout=120,a.nc&&s.setAttribute("nonce",a.nc),s.src=function(e){return a.p+""+({0:"gitgraph"}[e]||e)+".js"}(e);var c=new Error;r=function(t){s.onerror=s.onload=null,clearTimeout(l);var n=i[e];if(0!==n){if(n){var a=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;c.message="Loading chunk "+e+" failed.\n("+a+": "+o+")",c.name="ChunkLoadError",c.type=a,c.request=o,n[1](c)}i[e]=void 0}};var l=setTimeout((function(){r({type:"timeout",target:s})}),12e4);s.onerror=s.onload=r,document.head.appendChild(s)}return Promise.all(t)},a.m=e,a.c=n,a.d=function(e,t,n){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)a.d(n,i,function(t){return e[t]}.bind(null,i));return n},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a.oe=function(e){throw console.error(e),e};var o=window.webpackJsonp=window.webpackJsonp||[],r=o.push.bind(o);o.push=t,o=o.slice();for(var s=0;s<o.length;s++)t(o[s]);var c=r;a(a.s=2)}([function(e,t,n){e.exports=n(4)},function(e,t,n){var i=n(5),a=n(6),o=n(7);e.exports=function(e,t){return i(e)||a(e,t)||o()}},function(e,t,n){e.exports=n(9)},function(e,t,n){if(document.currentScript&&document.currentScript.src){var i=new URL(document.currentScript.src);n.p="".concat(i.pathname.replace(/\/[^/]*$/,""),"/")}else{var a=document.querySelector('script[src*="/index.js"]');n.p="".concat(a.getAttribute("src").replace(/\/[^/]*$/,""),"/")}},function(e,t,n){var i=function(e){"use strict";var t,n=Object.prototype,i=n.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",r=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function c(e,t,n,i){var a=t&&t.prototype instanceof v?t:v,o=Object.create(a.prototype),r=new T(i||[]);return o._invoke=function(e,t,n){var i=d;return function(a,o){if(i===h)throw new Error("Generator is already running");if(i===f){if("throw"===a)throw o;return L()}for(n.method=a,n.arg=o;;){var r=n.delegate;if(r){var s=k(r,n);if(s){if(s===m)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===d)throw i=f,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=h;var c=l(e,t,n);if("normal"===c.type){if(i=n.done?f:u,c.arg===m)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(i=f,n.method="throw",n.arg=c.arg)}}}(e,n,r),o}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var d="suspendedStart",u="suspendedYield",h="executing",f="completed",m={};function v(){}function p(){}function g(){}var b={};b[o]=function(){return this};var $=Object.getPrototypeOf,w=$&&$($(A([])));w&&w!==n&&i.call(w,o)&&(b=w);var y=g.prototype=v.prototype=Object.create(b);function x(e){["next","throw","return"].forEach((function(t){e[t]=function(e){return this._invoke(t,e)}}))}function C(e){var t;this._invoke=function(n,a){function o(){return new Promise((function(t,o){!function t(n,a,o,r){var s=l(e[n],e,a);if("throw"!==s.type){var c=s.arg,d=c.value;return d&&"object"==typeof d&&i.call(d,"__await")?Promise.resolve(d.__await).then((function(e){t("next",e,o,r)}),(function(e){t("throw",e,o,r)})):Promise.resolve(d).then((function(e){c.value=e,o(c)}),(function(e){return t("throw",e,o,r)}))}r(s.arg)}(n,a,t,o)}))}return t=t?t.then(o,o):o()}}function k(e,n){var i=e.iterator[n.method];if(i===t){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=t,k(e,n),"throw"===n.method))return m;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return m}var a=l(i,e.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,m;var o=a.arg;return o?o.done?(n[e.resultName]=o.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,m):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function _(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function A(e){if(e){var n=e[o];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var a=-1,r=function n(){for(;++a<e.length;)if(i.call(e,a))return n.value=e[a],n.done=!1,n;return n.value=t,n.done=!0,n};return r.next=r}}return{next:L}}function L(){return{value:t,done:!0}}return p.prototype=y.constructor=g,g.constructor=p,g[s]=p.displayName="GeneratorFunction",e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,s in e||(e[s]="GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},x(C.prototype),C.prototype[r]=function(){return this},e.AsyncIterator=C,e.async=function(t,n,i,a){var o=new C(c(t,n,i,a));return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},x(y),y[s]="Generator",y[o]=function(){return this},y.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var i=t.pop();if(i in e)return n.value=i,n.done=!1,n}return n.done=!0,n}},e.values=A,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(_),!e)for(var n in this)"t"===n.charAt(0)&&i.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function a(i,a){return s.type="throw",s.arg=e,n.next=i,a&&(n.method="next",n.arg=t),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var r=this.tryEntries[o],s=r.completion;if("root"===r.tryLoc)return a("end");if(r.tryLoc<=this.prev){var c=i.call(r,"catchLoc"),l=i.call(r,"finallyLoc");if(c&&l){if(this.prev<r.catchLoc)return a(r.catchLoc,!0);if(this.prev<r.finallyLoc)return a(r.finallyLoc)}else if(c){if(this.prev<r.catchLoc)return a(r.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<r.finallyLoc)return a(r.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&i.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var r=o?o.completion:{};return r.type=e,r.arg=t,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(r)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),_(n),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var a=i.arg;_(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,i){return this.delegate={iterator:A(e),resultName:n,nextLoc:i},"next"===this.method&&(this.arg=t),m}},e}(e.exports);try{regeneratorRuntime=i}catch(e){Function("r","regeneratorRuntime = r")(i)}},function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},function(e,t){e.exports=function(e,t){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)){var n=[],i=!0,a=!1,o=void 0;try{for(var r,s=e[Symbol.iterator]();!(i=(r=s.next()).done)&&(n.push(r.value),!t||n.length!==t);i=!0);}catch(e){a=!0,o=e}finally{try{i||null==s.return||s.return()}finally{if(a)throw o}}return n}}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}},function(e,t){!function(e,t,n,i){"use strict";t=void 0!==t&&t.Math==Math?t:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),e.fn.dropdown=function(i){var a,o=e(this),r=e(n),s=o.selector||"",c="ontouchstart"in n.documentElement,l=(new Date).getTime(),d=[],u=arguments[0],h="string"==typeof u,f=[].slice.call(arguments,1),m=1;return o.each((function(v){var p,g,b,$,w,y,x,C,k=e.isPlainObject(i)?e.extend(!0,{},e.fn.dropdown.settings,i):e.extend({},e.fn.dropdown.settings),S=k.className,_=k.message,T=k.fields,A=k.keys,L=k.metadata,q=k.namespace,D=k.regExp,O=k.selector,I=k.error,R=k.templates,E="."+q,F="module-"+q,j=e(this),M=e(k.context),N=j.find(O.text),z=j.find(O.search),P=j.find(O.sizer),V=j.find(O.input),B=j.find(O.icon),H=j.prev().find(O.text).length>0?j.prev().find(O.text):j.prev(),U=j.children(O.menu),K=U.find(O.item),W=!1,J=!1,Q=!1,X=this,G=j.data(F);C={initialize:function(){C.debug("Initializing dropdown",k),C.is.alreadySetup()?C.setup.reference():(C.setup.layout(),k.values&&C.change.values(k.values),C.refreshData(),C.save.defaults(),C.restore.selected(),C.create.id(),C.bind.events(),C.observeChanges(),C.instantiate(),C.aria.setup())},instantiate:function(){C.verbose("Storing instance of dropdown",C),G=C,j.data(F,C)},destroy:function(){C.verbose("Destroying previous dropdown",j),C.remove.tabbable(),j.off(E).removeData(F),U.off(E),r.off($),C.disconnect.menuObserver(),C.disconnect.selectObserver()},observeChanges:function(){"MutationObserver"in t&&(y=new MutationObserver(C.event.select.mutation),x=new MutationObserver(C.event.menu.mutation),C.debug("Setting up mutation observer",y,x),C.observe.select(),C.observe.menu())},disconnect:{menuObserver:function(){x&&x.disconnect()},selectObserver:function(){y&&y.disconnect()}},observe:{select:function(){C.has.input()&&y.observe(j[0],{childList:!0,subtree:!0})},menu:function(){C.has.menu()&&x.observe(U[0],{childList:!0,subtree:!0})}},create:{id:function(){w=(Math.random().toString(16)+"000000000").substr(2,8),$="."+w,C.verbose("Creating unique id for element",w)},userChoice:function(t){var n,i,a;return!!(t=t||C.get.userValues())&&(t=e.isArray(t)?t:[t],e.each(t,(function(t,o){!1===C.get.item(o)&&(a=k.templates.addition(C.add.variables(_.addResult,o)),i=e("<div />").html(a).attr("data-"+L.value,o).attr("data-"+L.text,o).addClass(S.addition).addClass(S.item),k.hideAdditions&&i.addClass(S.hidden),n=void 0===n?i:n.add(i),C.verbose("Creating user choices for value",o,i))})),n)},userLabels:function(t){var n=C.get.userValues();n&&(C.debug("Adding user labels",n),e.each(n,(function(e,t){C.verbose("Adding custom user value"),C.add.label(t,t)})))},menu:function(){U=e("<div />").addClass(S.menu).appendTo(j)},sizer:function(){P=e("<span />").addClass(S.sizer).insertAfter(z)}},search:function(e){e=void 0!==e?e:C.get.query(),C.verbose("Searching for query",e),C.has.minCharacters(e)?C.filter(e):C.hide()},select:{firstUnfiltered:function(){C.verbose("Selecting first non-filtered element"),C.remove.selectedItem(),K.not(O.unselectable).not(O.addition+O.hidden).eq(0).addClass(S.selected)},nextAvailable:function(e){var t=(e=e.eq(0)).nextAll(O.item).not(O.unselectable).eq(0),n=e.prevAll(O.item).not(O.unselectable).eq(0);t.length>0?(C.verbose("Moving selection to",t),t.addClass(S.selected)):(C.verbose("Moving selection to",n),n.addClass(S.selected))}},aria:{setup:function(){"menu"===C.aria.guessRole()&&(j.attr("aria-busy","true"),j.attr("role","menu"),j.attr("aria-haspopup","menu"),j.attr("aria-expanded","false"),U.find(".divider").attr("role","separator"),K.attr("role","menuitem"),K.each((function(e,t){t.id||(t.id=C.aria.nextID("menuitem"))})),N=j.find("> .text").eq(0),j.data("content")?(N.attr("aria-hidden"),j.attr("aria-label",j.data("content"))):(N.attr("id",C.aria.nextID("menutext")),j.attr("aria-labelledby",N.attr("id"))),j.attr("aria-busy","false"))},nextID:function(e){var t;do{t=e+"_"+m++}while(n.getElementById(t));return t},setExpanded:function(e){j.attr("aria-haspopup")&&j.attr("aria-expanded",e)},refreshDescendant:function(){if("menu"===j.attr("aria-haspopup")){var e=K.not(O.unselectable).filter("."+S.selected).eq(0),t=U.children("."+S.active).eq(0),n=e.length>0?e:t;n?j.attr("aria-activedescendant",n.attr("id")):C.aria.removeDescendant()}},removeDescendant:function(){"menu"==j.attr("aria-haspopup")&&j.removeAttr("aria-activedescendant")},guessRole:function(){var e=j.hasClass("icon"),t=C.has.search(),n=V.length>0,i=C.is.multiple();return e||t||n||i?"unknown":"menu"}},setup:{api:function(){var e={debug:k.debug,urlData:{value:C.get.value(),query:C.get.query()},on:!1};C.verbose("First request, initializing API"),j.api(e)},layout:function(){j.is("select")&&(C.setup.select(),C.setup.returnedObject()),C.has.menu()||C.create.menu(),C.is.search()&&!C.has.search()&&(C.verbose("Adding search input"),z=e("<input />").addClass(S.search).prop("autocomplete","off").insertBefore(N)),C.is.multiple()&&C.is.searchSelection()&&!C.has.sizer()&&C.create.sizer(),k.allowTab&&C.set.tabbable(),K.attr("tabindex","-1")},select:function(){var t=C.get.selectValues();C.debug("Dropdown initialized on a select",t),j.is("select")&&(V=j),V.parent(O.dropdown).length>0?(C.debug("UI dropdown already exists. Creating dropdown menu only"),j=V.closest(O.dropdown),C.has.menu()||C.create.menu(),U=j.children(O.menu),C.setup.menu(t)):(C.debug("Creating entire dropdown from select"),j=e("<div />").attr("class",V.attr("class")).addClass(S.selection).addClass(S.dropdown).html(R.dropdown(t)).insertBefore(V),V.hasClass(S.multiple)&&!1===V.prop("multiple")&&(C.error(I.missingMultiple),V.prop("multiple",!0)),V.is("[multiple]")&&C.set.multiple(),V.prop("disabled")&&(C.debug("Disabling dropdown"),j.addClass(S.disabled)),V.removeAttr("class").detach().prependTo(j)),C.refresh()},menu:function(e){U.html(R.menu(e,T)),K=U.find(O.item)},reference:function(){C.debug("Dropdown behavior was called on select, replacing with closest dropdown"),j=j.parent(O.dropdown),G=j.data(F),X=j.get(0),C.refresh(),C.setup.returnedObject()},returnedObject:function(){var e=o.slice(0,v),t=o.slice(v+1);o=e.add(j).add(t)}},refresh:function(){C.refreshSelectors(),C.refreshData()},refreshItems:function(){K=U.find(O.item)},refreshSelectors:function(){C.verbose("Refreshing selector cache"),N=j.find(O.text),z=j.find(O.search),V=j.find(O.input),B=j.find(O.icon),H=j.prev().find(O.text).length>0?j.prev().find(O.text):j.prev(),U=j.children(O.menu),K=U.find(O.item)},refreshData:function(){C.verbose("Refreshing cached metadata"),K.removeData(L.text).removeData(L.value)},clearData:function(){C.verbose("Clearing metadata"),K.removeData(L.text).removeData(L.value),j.removeData(L.defaultText).removeData(L.defaultValue).removeData(L.placeholderText)},toggle:function(){C.verbose("Toggling menu visibility"),C.is.active()?C.hide():C.show()},show:function(t){if(t=e.isFunction(t)?t:function(){},!C.can.show()&&C.is.remote()&&(C.debug("No API results retrieved, searching before show"),C.queryRemote(C.get.query(),C.show)),C.can.show()&&!C.is.active()){if(C.debug("Showing dropdown"),!C.has.message()||C.has.maxSelections()||C.has.allResultsFiltered()||C.remove.message(),C.is.allFiltered())return!0;!1!==k.onShow.call(X)&&(C.aria.setExpanded(!0),C.aria.refreshDescendant(),C.animate.show((function(){C.can.click()&&C.bind.intent(),C.has.menuSearch()&&C.focusSearch(),C.set.visible(),t.call(X)})))}},hide:function(t){t=e.isFunction(t)?t:function(){},C.is.active()&&!C.is.animatingOutward()&&(C.debug("Hiding dropdown"),!1!==k.onHide.call(X)&&(C.aria.setExpanded(!1),C.aria.removeDescendant(),C.animate.hide((function(){C.remove.visible(),t.call(X)}))))},hideOthers:function(){C.verbose("Finding other dropdowns to hide"),o.not(j).has(O.menu+"."+S.visible).dropdown("hide")},hideMenu:function(){C.verbose("Hiding menu instantaneously"),C.remove.active(),C.remove.visible(),U.transition("hide")},hideSubMenus:function(){var e=U.children(O.item).find(O.menu);C.verbose("Hiding sub menus",e),e.transition("hide")},bind:{events:function(){c&&C.bind.touchEvents(),C.bind.keyboardEvents(),C.bind.inputEvents(),C.bind.mouseEvents()},touchEvents:function(){C.debug("Touch device detected binding additional touch events"),C.is.searchSelection()||C.is.single()&&j.on("touchstart"+E,C.event.test.toggle),U.on("touchstart"+E,O.item,C.event.item.mouseenter)},keyboardEvents:function(){C.verbose("Binding keyboard events"),j.on("keydown"+E,C.event.keydown),C.has.search()&&j.on(C.get.inputEvent()+E,O.search,C.event.input),C.is.multiple()&&r.on("keydown"+$,C.event.document.keydown)},inputEvents:function(){C.verbose("Binding input change events"),j.on("change"+E,O.input,C.event.change)},mouseEvents:function(){C.verbose("Binding mouse events"),C.is.multiple()&&j.on("click"+E,O.label,C.event.label.click).on("click"+E,O.remove,C.event.remove.click),C.is.searchSelection()?(j.on("mousedown"+E,C.event.mousedown).on("mouseup"+E,C.event.mouseup).on("mousedown"+E,O.menu,C.event.menu.mousedown).on("mouseup"+E,O.menu,C.event.menu.mouseup).on("click"+E,O.icon,C.event.icon.click).on("focus"+E,O.search,C.event.search.focus).on("click"+E,O.search,C.event.search.focus).on("blur"+E,O.search,C.event.search.blur).on("click"+E,O.text,C.event.text.focus),C.is.multiple()&&j.on("click"+E,C.event.click)):("click"==k.on?j.on("click"+E,O.icon,C.event.icon.click).on("click"+E,C.event.test.toggle):"hover"==k.on?j.on("mouseenter"+E,C.delay.show).on("mouseleave"+E,C.delay.hide):j.on(k.on+E,C.toggle),j.on("mousedown"+E,C.event.mousedown).on("mouseup"+E,C.event.mouseup).on("focus"+E,C.event.focus),C.has.menuSearch()?j.on("blur"+E,O.search,C.event.search.blur):j.on("blur"+E,C.event.blur)),U.on("mouseenter"+E,O.item,C.event.item.mouseenter).on("mouseleave"+E,O.item,C.event.item.mouseleave).on("click"+E,O.item,C.event.item.click)},intent:function(){C.verbose("Binding hide intent event to document"),c&&r.on("touchstart"+$,C.event.test.touch).on("touchmove"+$,C.event.test.touch),r.on("click"+$,C.event.test.hide)}},unbind:{intent:function(){C.verbose("Removing hide intent event from document"),c&&r.off("touchstart"+$).off("touchmove"+$),r.off("click"+$)}},filter:function(e){var t=void 0!==e?e:C.get.query(),n=function(){C.is.multiple()&&C.filterActive(),(e||!e&&0==C.get.activeItem().length)&&C.select.firstUnfiltered(),C.has.allResultsFiltered()?k.onNoResults.call(X,t)?k.allowAdditions?k.hideAdditions&&(C.verbose("User addition with no menu, setting empty style"),C.set.empty(),C.hideMenu()):(C.verbose("All items filtered, showing message",t),C.add.message(_.noResults)):(C.verbose("All items filtered, hiding dropdown",t),C.hideMenu()):(C.remove.empty(),C.remove.message()),k.allowAdditions&&C.add.userSuggestion(e),C.is.searchSelection()&&C.can.show()&&C.is.focusedOnSearch()&&C.show()};k.useLabels&&C.has.maxSelections()||(k.apiSettings?C.can.useAPI()?C.queryRemote(t,(function(){k.filterRemoteData&&C.filterItems(t),n()})):C.error(I.noAPI):(C.filterItems(t),n()))},queryRemote:function(t,n){var i={errorDuration:!1,cache:"local",throttle:k.throttle,urlData:{query:t},onError:function(){C.add.message(_.serverError),n()},onFailure:function(){C.add.message(_.serverError),n()},onSuccess:function(e){C.remove.message(),C.setup.menu({values:e[T.remoteValues]}),n()}};j.api("get request")||C.setup.api(),i=e.extend(!0,{},i,k.apiSettings),j.api("setting",i).api("query")},filterItems:function(t){var n=void 0!==t?t:C.get.query(),i=null,a=C.escape.string(n),o=new RegExp("^"+a,"igm");C.has.query()&&(i=[],C.verbose("Searching for matching values",n),K.each((function(){var t,a,r=e(this);if("both"==k.match||"text"==k.match){if(-1!==(t=String(C.get.choiceText(r,!1))).search(o))return i.push(this),!0;if("exact"===k.fullTextSearch&&C.exactSearch(n,t))return i.push(this),!0;if(!0===k.fullTextSearch&&C.fuzzySearch(n,t))return i.push(this),!0}if("both"==k.match||"value"==k.match){if(-1!==(a=String(C.get.choiceValue(r,t))).search(o))return i.push(this),!0;if("exact"===k.fullTextSearch&&C.exactSearch(n,a))return i.push(this),!0;if(!0===k.fullTextSearch&&C.fuzzySearch(n,a))return i.push(this),!0}}))),C.debug("Showing only matched items",n),C.remove.filteredItem(),i&&K.not(i).addClass(S.filtered)},fuzzySearch:function(e,t){var n=t.length,i=e.length;if(e=e.toLowerCase(),t=t.toLowerCase(),i>n)return!1;if(i===n)return e===t;e:for(var a=0,o=0;a<i;a++){for(var r=e.charCodeAt(a);o<n;)if(t.charCodeAt(o++)===r)continue e;return!1}return!0},exactSearch:function(e,t){return e=e.toLowerCase(),(t=t.toLowerCase()).indexOf(e)>-1},filterActive:function(){k.useLabels&&K.filter("."+S.active).addClass(S.filtered)},focusSearch:function(e){C.has.search()&&!C.is.focusedOnSearch()&&(e?(j.off("focus"+E,O.search),z.focus(),j.on("focus"+E,O.search,C.event.search.focus)):z.focus())},forceSelection:function(){var e=K.not(S.filtered).filter("."+S.selected).eq(0),t=K.not(S.filtered).filter("."+S.active).eq(0),n=e.length>0?e:t;if(n.length>0&&!C.is.multiple())return C.debug("Forcing partial selection to selected item",n),void C.event.item.click.call(n,{},!0);k.allowAdditions?(C.set.selected(C.get.query()),C.remove.searchTerm()):C.remove.searchTerm()},change:{values:function(t){k.allowAdditions||C.clear(),C.debug("Creating dropdown with specified values",t),C.setup.menu({values:t}),e.each(t,(function(e,t){if(1==t.selected)return C.debug("Setting initial selection to",t.value),C.set.selected(t.value),!0}))}},event:{change:function(){Q||(C.debug("Input changed, updating selection"),C.set.selected())},focus:function(){k.showOnFocus&&!W&&C.is.hidden()&&!g&&C.show()},blur:function(e){g=n.activeElement===this,W||g||(C.remove.activeLabel(),C.hide())},mousedown:function(){C.is.searchSelection()?b=!0:W=!0},mouseup:function(){C.is.searchSelection()?b=!1:W=!1},click:function(t){e(t.target).is(j)&&(C.is.focusedOnSearch()?C.show():C.focusSearch())},search:{focus:function(){W=!0,C.is.multiple()&&C.remove.activeLabel(),k.showOnFocus&&C.search()},blur:function(e){g=n.activeElement===this,C.is.searchSelection()&&!b&&(J||g||(k.forceSelection&&C.forceSelection(),C.hide())),b=!1}},icon:{click:function(e){C.toggle()}},text:{focus:function(e){W=!0,C.focusSearch()}},input:function(e){(C.is.multiple()||C.is.searchSelection())&&C.set.filtered(),clearTimeout(C.timer),C.timer=setTimeout(C.search,k.delay.search)},label:{click:function(t){var n=e(this),i=j.find(O.label),a=i.filter("."+S.active),o=n.nextAll("."+S.active),r=n.prevAll("."+S.active),s=o.length>0?n.nextUntil(o).add(a).add(n):n.prevUntil(r).add(a).add(n);t.shiftKey?(a.removeClass(S.active),s.addClass(S.active)):t.ctrlKey?n.toggleClass(S.active):(a.removeClass(S.active),n.addClass(S.active)),k.onLabelSelect.apply(this,i.filter("."+S.active))}},remove:{click:function(){var t=e(this).parent();t.hasClass(S.active)?C.remove.activeLabels():C.remove.activeLabels(t)}},test:{toggle:function(e){var t=C.is.multiple()?C.show:C.toggle;C.is.bubbledLabelClick(e)||C.is.bubbledIconClick(e)||C.determine.eventOnElement(e,t)&&e.preventDefault()},touch:function(e){C.determine.eventOnElement(e,(function(){"touchstart"==e.type?C.timer=setTimeout((function(){C.hide()}),k.delay.touch):"touchmove"==e.type&&clearTimeout(C.timer)})),e.stopPropagation()},hide:function(e){C.determine.eventInModule(e,C.hide)}},select:{mutation:function(t){C.debug("<select> modified, recreating menu");var n=!1;e.each(t,(function(t,i){if(e(i.target).is("select")||e(i.addedNodes).is("select"))return n=!0,!0})),n&&(C.disconnect.selectObserver(),C.refresh(),C.setup.select(),C.set.selected(),C.observe.select())}},menu:{mutation:function(t){var n=t[0],i=n.addedNodes?e(n.addedNodes[0]):e(!1),a=n.removedNodes?e(n.removedNodes[0]):e(!1),o=i.add(a),r=o.is(O.addition)||o.closest(O.addition).length>0,s=o.is(O.message)||o.closest(O.message).length>0;r||s?(C.debug("Updating item selector cache"),C.refreshItems()):(C.debug("Menu modified, updating selector cache"),C.refresh())},mousedown:function(){J=!0},mouseup:function(){J=!1}},item:{mouseenter:function(t){var n=e(t.target),i=e(this),a=i.children(O.menu),o=i.siblings(O.item).children(O.menu),r=a.length>0;!(a.find(n).length>0)&&r&&(clearTimeout(C.itemTimer),C.itemTimer=setTimeout((function(){C.verbose("Showing sub-menu",a),e.each(o,(function(){C.animate.hide(!1,e(this))})),C.animate.show(!1,a)}),k.delay.show),t.preventDefault())},mouseleave:function(t){var n=e(this).children(O.menu);n.length>0&&(clearTimeout(C.itemTimer),C.itemTimer=setTimeout((function(){C.verbose("Hiding sub-menu",n),C.animate.hide(!1,n)}),k.delay.hide))},click:function(t,i){var a=e(this),o=e(t?t.target:""),r=a.find(O.menu),s=C.get.choiceText(a),c=C.get.choiceValue(a,s),l=r.length>0,d=r.find(o).length>0;C.has.menuSearch()&&e(n.activeElement).blur(),d||l&&!k.allowCategorySelection||(C.is.searchSelection()&&(k.allowAdditions&&C.remove.userAddition(),C.remove.searchTerm(),C.is.focusedOnSearch()||1==i||C.focusSearch(!0)),k.useLabels||(C.remove.filteredItem(),C.set.scrollPosition(a)),C.determine.selectAction.call(this,s,c))}},document:{keydown:function(e){var t=e.which;if(C.is.inObject(t,A)){var n=j.find(O.label),i=n.filter("."+S.active),a=(i.data(L.value),n.index(i)),o=n.length,r=i.length>0,s=i.length>1,c=0===a,l=a+1==o,d=C.is.searchSelection(),u=C.is.focusedOnSearch(),h=C.is.focused(),f=u&&0===C.get.caretPosition();if(d&&!r&&!u)return;t==A.leftArrow?!h&&!f||r?r&&(e.shiftKey?C.verbose("Adding previous label to selection"):(C.verbose("Selecting previous label"),n.removeClass(S.active)),c&&!s?i.addClass(S.active):i.prev(O.siblingLabel).addClass(S.active).end(),e.preventDefault()):(C.verbose("Selecting previous label"),n.last().addClass(S.active)):t==A.rightArrow?(h&&!r&&n.first().addClass(S.active),r&&(e.shiftKey?C.verbose("Adding next label to selection"):(C.verbose("Selecting next label"),n.removeClass(S.active)),l?d?u?n.removeClass(S.active):C.focusSearch():s?i.next(O.siblingLabel).addClass(S.active):i.addClass(S.active):i.next(O.siblingLabel).addClass(S.active),e.preventDefault())):t==A.deleteKey||t==A.backspace?r?(C.verbose("Removing active labels"),l&&d&&!u&&C.focusSearch(),i.last().next(O.siblingLabel).addClass(S.active),C.remove.activeLabels(i),e.preventDefault()):f&&!r&&t==A.backspace&&(C.verbose("Removing last label on input backspace"),i=n.last().addClass(S.active),C.remove.activeLabels(i)):i.removeClass(S.active)}}},keydown:function(e){var t=e.which;if(C.is.inObject(t,A)){var n,i=K.not(O.unselectable).filter("."+S.selected).eq(0),a=U.children("."+S.active).eq(0),o=i.length>0?i:a,r=o.length>0?o.siblings(":not(."+S.filtered+")").addBack():U.children(":not(."+S.filtered+")"),s=o.children(O.menu),c=o.closest(O.menu),l=c.hasClass(S.visible)||c.hasClass(S.animating)||c.parent(O.menu).length>0,d=s.length>0,u=o.length>0,h=o.not(O.unselectable).length>0,f=t==A.delimiter&&k.allowAdditions&&C.is.multiple();if(k.allowAdditions&&k.hideAdditions&&(t==A.enter||f)&&h&&(C.verbose("Selecting item from keyboard shortcut",o),o[0].click(),C.is.searchSelection()&&C.remove.searchTerm()),C.is.visible()){if((t==A.enter||f)&&(t==A.enter&&u&&d&&!k.allowCategorySelection?(C.verbose("Pressed enter on unselectable category, opening sub menu"),t=A.rightArrow):h&&(C.verbose("Selecting item from keyboard shortcut",o),o[0].click(),C.is.searchSelection()&&C.remove.searchTerm()),e.preventDefault()),u&&(t==A.leftArrow&&c[0]!==U[0]&&(C.verbose("Left key pressed, closing sub-menu"),C.animate.hide(!1,c),o.removeClass(S.selected),c.closest(O.item).addClass(S.selected),C.aria.refreshDescendant(),e.preventDefault()),t==A.rightArrow&&d&&(C.verbose("Right key pressed, opening sub-menu"),C.animate.show(!1,s),o.removeClass(S.selected),s.find(O.item).eq(0).addClass(S.selected),C.aria.refreshDescendant(),e.preventDefault())),t==A.upArrow){if(n=u&&l?o.prevAll(O.item+":not("+O.unselectable+")").eq(0):K.eq(0),r.index(n)<0)return C.verbose("Up key pressed but reached top of current menu"),void e.preventDefault();C.verbose("Up key pressed, changing active item"),o.removeClass(S.selected),n.addClass(S.selected),C.aria.refreshDescendant(),C.set.scrollPosition(n),k.selectOnKeydown&&C.is.single()&&C.set.selectedItem(n),e.preventDefault()}if(t==A.downArrow){if(0===(n=u&&l?n=o.nextAll(O.item+":not("+O.unselectable+")").eq(0):K.eq(0)).length)return C.verbose("Down key pressed but reached bottom of current menu"),void e.preventDefault();C.verbose("Down key pressed, changing active item"),K.removeClass(S.selected),n.addClass(S.selected),C.aria.refreshDescendant(),C.set.scrollPosition(n),k.selectOnKeydown&&C.is.single()&&C.set.selectedItem(n),e.preventDefault()}t==A.pageUp&&(C.scrollPage("up"),e.preventDefault()),t==A.pageDown&&(C.scrollPage("down"),e.preventDefault()),t==A.escape&&(C.verbose("Escape key pressed, closing dropdown"),C.hide())}else f&&e.preventDefault(),t!=A.downArrow||C.is.visible()||(C.verbose("Down key pressed, showing dropdown"),C.show(),e.preventDefault())}else C.has.search()||C.set.selectedLetter(String.fromCharCode(t))}},trigger:{change:function(){var e=n.createEvent("HTMLEvents"),t=V[0];t&&(C.verbose("Triggering native change event"),e.initEvent("change",!0,!1),t.dispatchEvent(e))}},determine:{selectAction:function(t,n){C.verbose("Determining action",k.action),e.isFunction(C.action[k.action])?(C.verbose("Triggering preset action",k.action,t,n),C.action[k.action].call(X,t,n,this)):e.isFunction(k.action)?(C.verbose("Triggering user action",k.action,t,n),k.action.call(X,t,n,this)):C.error(I.action,k.action)},eventInModule:function(t,i){var a=e(t.target),o=a.closest(n.documentElement).length>0,r=a.closest(j).length>0;return i=e.isFunction(i)?i:function(){},o&&!r?(C.verbose("Triggering event",i),i(),!0):(C.verbose("Event occurred in dropdown, canceling callback"),!1)},eventOnElement:function(t,i){var a=e(t.target),o=a.closest(O.siblingLabel),r=n.body.contains(t.target),s=0===j.find(o).length,c=0===a.closest(U).length;return i=e.isFunction(i)?i:function(){},r&&s&&c?(C.verbose("Triggering event",i),i(),!0):(C.verbose("Event occurred in dropdown menu, canceling callback"),!1)}},action:{nothing:function(){},activate:function(t,n,i){if(n=void 0!==n?n:t,C.can.activate(e(i))){if(C.set.selected(n,e(i)),C.is.multiple()&&!C.is.allFiltered())return;C.hideAndClear()}},select:function(t,n,i){if(n=void 0!==n?n:t,C.can.activate(e(i))){if(C.set.value(n,t,e(i)),C.is.multiple()&&!C.is.allFiltered())return;C.hideAndClear()}},combo:function(t,n,i){n=void 0!==n?n:t,C.set.selected(n,e(i)),C.hideAndClear()},hide:function(e,t,n){C.set.value(t,e),C.hideAndClear()}},get:{id:function(){return w},defaultText:function(){return j.data(L.defaultText)},defaultValue:function(){return j.data(L.defaultValue)},placeholderText:function(){return"auto"!=k.placeholder&&"string"==typeof k.placeholder?k.placeholder:j.data(L.placeholderText)||""},text:function(){return N.text()},query:function(){return e.trim(z.val())},searchWidth:function(e){return e=void 0!==e?e:z.val(),P.text(e),Math.ceil(P.width()+1)},selectionCount:function(){var t=C.get.values();return C.is.multiple()?e.isArray(t)?t.length:0:""!==C.get.value()?1:0},transition:function(e){return"auto"==k.transition?C.is.upward(e)?"slide up":"slide down":k.transition},userValues:function(){var t=C.get.values();return!!t&&(t=e.isArray(t)?t:[t],e.grep(t,(function(e){return!1===C.get.item(e)})))},uniqueArray:function(t){return e.grep(t,(function(n,i){return e.inArray(n,t)===i}))},caretPosition:function(){var e,t,i=z.get(0);return"selectionStart"in i?i.selectionStart:n.selection?(i.focus(),t=(e=n.selection.createRange()).text.length,e.moveStart("character",-i.value.length),e.text.length-t):void 0},value:function(){var t=V.length>0?V.val():j.data(L.value),n=e.isArray(t)&&1===t.length&&""===t[0];return void 0===t||n?"":t},values:function(){var e=C.get.value();return""===e?"":!C.has.selectInput()&&C.is.multiple()?"string"==typeof e?e.split(k.delimiter):"":e},remoteValues:function(){var t=C.get.values(),n=!1;return t&&("string"==typeof t&&(t=[t]),e.each(t,(function(e,t){var i=C.read.remoteData(t);C.verbose("Restoring value from session data",i,t),i&&(n||(n={}),n[t]=i)}))),n},choiceText:function(t,n){if(n=void 0!==n?n:k.preserveHTML,t)return t.find(O.menu).length>0&&(C.verbose("Retrieving text of element with sub-menu"),(t=t.clone()).find(O.menu).remove(),t.find(O.menuIcon).remove()),void 0!==t.data(L.text)?t.data(L.text):n?e.trim(t.html()):e.trim(t.text())},choiceValue:function(t,n){return n=n||C.get.choiceText(t),!!t&&(void 0!==t.data(L.value)?String(t.data(L.value)):"string"==typeof n?e.trim(n.toLowerCase()):String(n))},inputEvent:function(){var e=z[0];return!!e&&(void 0!==e.oninput?"input":void 0!==e.onpropertychange?"propertychange":"keyup")},selectValues:function(){var t={values:[]};return j.find("option").each((function(){var n=e(this),i=n.html(),a=n.attr("disabled"),o=void 0!==n.attr("value")?n.attr("value"):i;"auto"===k.placeholder&&""===o?t.placeholder=i:t.values.push({name:i,value:o,disabled:a})})),k.placeholder&&"auto"!==k.placeholder&&(C.debug("Setting placeholder value to",k.placeholder),t.placeholder=k.placeholder),k.sortSelect?(t.values.sort((function(e,t){return e.name>t.name?1:-1})),C.debug("Retrieved and sorted values from select",t)):C.debug("Retrieved values from select",t),t},activeItem:function(){return K.filter("."+S.active)},selectedItem:function(){var e=K.not(O.unselectable).filter("."+S.selected);return e.length>0?e:K.eq(0)},itemWithAdditions:function(e){var t=C.get.item(e),n=C.create.userChoice(e);return n&&n.length>0&&(t=t.length>0?t.add(n):n),t},item:function(t,n){var i,a,o=!1;return t=void 0!==t?t:void 0!==C.get.values()?C.get.values():C.get.text(),i=a?t.length>0:null!=t,a=C.is.multiple()&&e.isArray(t),n=""===t||0===t||(n||!1),i&&K.each((function(){var i=e(this),r=C.get.choiceText(i),s=C.get.choiceValue(i,r);if(null!=s)if(a)-1===e.inArray(String(s),t)&&-1===e.inArray(r,t)||(o=o?o.add(i):i);else if(n){if(C.verbose("Ambiguous dropdown value using strict type check",i,t),s===t||r===t)return o=i,!0}else if(String(s)==String(t)||r==t)return C.verbose("Found select item by value",s,t),o=i,!0})),o}},check:{maxSelections:function(e){return!k.maxSelections||((e=void 0!==e?e:C.get.selectionCount())>=k.maxSelections?(C.debug("Maximum selection count reached"),k.useLabels&&(K.addClass(S.filtered),C.add.message(_.maxSelections)),!0):(C.verbose("No longer at maximum selection count"),C.remove.message(),C.remove.filteredItem(),C.is.searchSelection()&&C.filterItems(),!1))}},restore:{defaults:function(){C.clear(),C.restore.defaultText(),C.restore.defaultValue()},defaultText:function(){var e=C.get.defaultText();e===C.get.placeholderText?(C.debug("Restoring default placeholder text",e),C.set.placeholderText(e)):(C.debug("Restoring default text",e),C.set.text(e))},placeholderText:function(){C.set.placeholderText()},defaultValue:function(){var e=C.get.defaultValue();void 0!==e&&(C.debug("Restoring default value",e),""!==e?(C.set.value(e),C.set.selected()):(C.remove.activeItem(),C.remove.selectedItem()))},labels:function(){k.allowAdditions&&(k.useLabels||(C.error(I.labels),k.useLabels=!0),C.debug("Restoring selected values"),C.create.userLabels()),C.check.maxSelections()},selected:function(){C.restore.values(),C.is.multiple()?(C.debug("Restoring previously selected values and labels"),C.restore.labels()):C.debug("Restoring previously selected values")},values:function(){C.set.initialLoad(),k.apiSettings&&k.saveRemoteData&&C.get.remoteValues()?C.restore.remoteValues():C.set.selected(),C.remove.initialLoad()},remoteValues:function(){var t=C.get.remoteValues();C.debug("Recreating selected from session data",t),t&&(C.is.single()?e.each(t,(function(e,t){C.set.text(t)})):e.each(t,(function(e,t){C.add.label(e,t)})))}},read:{remoteData:function(e){var n;if(void 0!==t.Storage)return void 0!==(n=sessionStorage.getItem(e))&&n;C.error(I.noStorage)}},save:{defaults:function(){C.save.defaultText(),C.save.placeholderText(),C.save.defaultValue()},defaultValue:function(){var e=C.get.value();C.verbose("Saving default value as",e),j.data(L.defaultValue,e)},defaultText:function(){var e=C.get.text();C.verbose("Saving default text as",e),j.data(L.defaultText,e)},placeholderText:function(){var e;!1!==k.placeholder&&N.hasClass(S.placeholder)&&(e=C.get.text(),C.verbose("Saving placeholder text as",e),j.data(L.placeholderText,e))},remoteData:function(e,n){void 0!==t.Storage?(C.verbose("Saving remote data to session storage",n,e),sessionStorage.setItem(n,e)):C.error(I.noStorage)}},clear:function(){C.is.multiple()&&k.useLabels?C.remove.labels():(C.remove.activeItem(),C.remove.selectedItem()),C.set.placeholderText(),C.clearValue()},clearValue:function(){C.set.value("")},scrollPage:function(e,t){var n,i,a=t||C.get.selectedItem(),o=a.closest(O.menu),r=o.outerHeight(),s=o.scrollTop(),c=K.eq(0).outerHeight(),l=Math.floor(r/c),d=(o.prop("scrollHeight"),"up"==e?s-c*l:s+c*l),u=K.not(O.unselectable);i="up"==e?u.index(a)-l:u.index(a)+l,(n=("up"==e?i>=0:i<u.length)?u.eq(i):"up"==e?u.first():u.last()).length>0&&(C.debug("Scrolling page",e,n),a.removeClass(S.selected),n.addClass(S.selected),k.selectOnKeydown&&C.is.single()&&C.set.selectedItem(n),o.scrollTop(d))},set:{filtered:function(){var e=C.is.multiple(),t=C.is.searchSelection(),n=e&&t,i=t?C.get.query():"",a="string"==typeof i&&i.length>0,o=C.get.searchWidth(),r=""!==i;e&&a&&(C.verbose("Adjusting input width",o,k.glyphWidth),z.css("width",o)),a||n&&r?(C.verbose("Hiding placeholder text"),N.addClass(S.filtered)):(!e||n&&!r)&&(C.verbose("Showing placeholder text"),N.removeClass(S.filtered))},empty:function(){j.addClass(S.empty)},loading:function(){j.addClass(S.loading)},placeholderText:function(e){e=e||C.get.placeholderText(),C.debug("Setting placeholder text",e),C.set.text(e),N.addClass(S.placeholder)},tabbable:function(){C.is.searchSelection()?(C.debug("Added tabindex to searchable dropdown"),z.val("").attr("tabindex",0),U.attr("tabindex",-1)):(C.debug("Added tabindex to dropdown"),void 0===j.attr("tabindex")&&(j.attr("tabindex",0),U.attr("tabindex",-1)))},initialLoad:function(){C.verbose("Setting initial load"),p=!0},activeItem:function(e){k.allowAdditions&&e.filter(O.addition).length>0?e.addClass(S.filtered):e.addClass(S.active)},partialSearch:function(e){var t=C.get.query().length;z.val(e.substr(0,t))},scrollPosition:function(e,t){var n,i,a,o,r,s;n=(e=e||C.get.selectedItem()).closest(O.menu),i=e&&e.length>0,t=void 0!==t&&t,e&&n.length>0&&i&&(e.position().top,n.addClass(S.loading),a=(o=n.scrollTop())-n.offset().top+e.offset().top,t||(s=o+n.height()<a+5,r=a-5<o),C.debug("Scrolling to active item",a),(t||r||s)&&n.scrollTop(a),n.removeClass(S.loading))},text:function(e){"select"!==k.action&&("combo"==k.action?(C.debug("Changing combo button text",e,H),k.preserveHTML?H.html(e):H.text(e)):(e!==C.get.placeholderText()&&N.removeClass(S.placeholder),C.debug("Changing text",e,N),N.removeClass(S.filtered),k.preserveHTML?N.html(e):N.text(e)))},selectedItem:function(e){var t=C.get.choiceValue(e),n=C.get.choiceText(e,!1),i=C.get.choiceText(e,!0);C.debug("Setting user selection to item",e),C.remove.activeItem(),C.set.partialSearch(n),C.set.activeItem(e),C.set.selected(t,e),C.set.text(i)},selectedLetter:function(t){var n,i=K.filter("."+S.selected),a=i.length>0&&C.has.firstLetter(i,t),o=!1;a&&(n=i.nextAll(K).eq(0),C.has.firstLetter(n,t)&&(o=n)),o||K.each((function(){if(C.has.firstLetter(e(this),t))return o=e(this),!1})),o&&(C.verbose("Scrolling to next value with letter",t),C.set.scrollPosition(o),i.removeClass(S.selected),o.addClass(S.selected),C.aria.refreshDescendant(),k.selectOnKeydown&&C.is.single()&&C.set.selectedItem(o))},direction:function(e){"auto"==k.direction?(C.remove.upward(),C.can.openDownward(e)?C.remove.upward(e):C.set.upward(e),C.is.leftward(e)||C.can.openRightward(e)||C.set.leftward(e)):"upward"==k.direction&&C.set.upward(e)},upward:function(e){(e||j).addClass(S.upward)},leftward:function(e){(e||U).addClass(S.leftward)},value:function(e,t,n){var i=C.escape.value(e),a=V.length>0,o=C.get.values(),r=void 0!==e?String(e):e;if(a){if(!k.allowReselection&&r==o&&(C.verbose("Skipping value update already same value",e,o),!C.is.initialLoad()))return;C.is.single()&&C.has.selectInput()&&C.can.extendSelect()&&(C.debug("Adding user option",e),C.add.optionValue(e)),C.debug("Updating input value",i,o),Q=!0,V.val(i),!1===k.fireOnInit&&C.is.initialLoad()?C.debug("Input native change event ignored on initial load"):C.trigger.change(),Q=!1}else C.verbose("Storing value in metadata",i,V),i!==o&&j.data(L.value,r);!1===k.fireOnInit&&C.is.initialLoad()?C.verbose("No callback on initial load",k.onChange):k.onChange.call(X,e,t,n)},active:function(){j.addClass(S.active)},multiple:function(){j.addClass(S.multiple)},visible:function(){j.addClass(S.visible)},exactly:function(e,t){C.debug("Setting selected to exact values"),C.clear(),C.set.selected(e,t)},selected:function(t,n){var i=C.is.multiple();(n=k.allowAdditions?n||C.get.itemWithAdditions(t):n||C.get.item(t))&&(C.debug("Setting selected menu item to",n),C.is.multiple()&&C.remove.searchWidth(),C.is.single()?(C.remove.activeItem(),C.remove.selectedItem()):k.useLabels&&C.remove.selectedItem(),n.each((function(){var t=e(this),a=C.get.choiceText(t),o=C.get.choiceValue(t,a),r=t.hasClass(S.filtered),s=t.hasClass(S.active),c=t.hasClass(S.addition),l=i&&1==n.length;i?!s||c?(k.apiSettings&&k.saveRemoteData&&C.save.remoteData(a,o),k.useLabels?(C.add.label(o,a,l),C.add.value(o,a,t),C.set.activeItem(t),C.filterActive(),C.select.nextAvailable(n)):(C.add.value(o,a,t),C.set.text(C.add.variables(_.count)),C.set.activeItem(t))):r||(C.debug("Selected active value, removing label"),C.remove.selected(o)):(k.apiSettings&&k.saveRemoteData&&C.save.remoteData(a,o),C.set.text(a),C.set.value(o,a,t),t.addClass(S.active).addClass(S.selected))})))}},add:{label:function(t,n,i){var a,o=C.is.searchSelection()?z:N,r=C.escape.value(t);k.ignoreCase&&(r=r.toLowerCase()),a=e("<a />").addClass(S.label).attr("data-"+L.value,r).html(R.label(r,n)),a=k.onLabelCreate.call(a,r,n),C.has.label(t)?C.debug("User selection already exists, skipping",r):(k.label.variation&&a.addClass(k.label.variation),!0===i?(C.debug("Animating in label",a),a.addClass(S.hidden).insertBefore(o).transition(k.label.transition,k.label.duration)):(C.debug("Adding selection label",a),a.insertBefore(o)))},message:function(t){var n=U.children(O.message),i=k.templates.message(C.add.variables(t));n.length>0?n.html(i):n=e("<div/>").html(i).addClass(S.message).appendTo(U)},optionValue:function(t){var n=C.escape.value(t);V.find('option[value="'+C.escape.string(n)+'"]').length>0||(C.disconnect.selectObserver(),C.is.single()&&(C.verbose("Removing previous user addition"),V.find("option."+S.addition).remove()),e("<option/>").prop("value",n).addClass(S.addition).html(t).appendTo(V),C.verbose("Adding user addition as an <option>",t),C.observe.select())},userSuggestion:function(e){var t,n=U.children(O.addition),i=C.get.item(e),a=i&&i.not(O.addition).length,o=n.length>0;k.useLabels&&C.has.maxSelections()||(""===e||a?n.remove():(o?(n.data(L.value,e).data(L.text,e).attr("data-"+L.value,e).attr("data-"+L.text,e).removeClass(S.filtered),k.hideAdditions||(t=k.templates.addition(C.add.variables(_.addResult,e)),n.html(t)),C.verbose("Replacing user suggestion with new value",n)):((n=C.create.userChoice(e)).prependTo(U),C.verbose("Adding item choice to menu corresponding with user choice addition",n)),k.hideAdditions&&!C.is.allFiltered()||n.addClass(S.selected).siblings().removeClass(S.selected),C.refreshItems()))},variables:function(e,t){var n,i,a=-1!==e.search("{count}"),o=-1!==e.search("{maxCount}"),r=-1!==e.search("{term}");return C.verbose("Adding templated variables to message",e),a&&(n=C.get.selectionCount(),e=e.replace("{count}",n)),o&&(n=C.get.selectionCount(),e=e.replace("{maxCount}",k.maxSelections)),r&&(i=t||C.get.query(),e=e.replace("{term}",i)),e},value:function(t,n,i){var a,o=C.get.values();C.has.value(t)?C.debug("Value already selected"):""!==t?(e.isArray(o)?(a=o.concat([t]),a=C.get.uniqueArray(a)):a=[t],C.has.selectInput()?C.can.extendSelect()&&(C.debug("Adding value to select",t,a,V),C.add.optionValue(t)):(a=a.join(k.delimiter),C.debug("Setting hidden input to delimited value",a,V)),!1===k.fireOnInit&&C.is.initialLoad()?C.verbose("Skipping onadd callback on initial load",k.onAdd):k.onAdd.call(X,t,n,i),C.set.value(a,t,n,i),C.check.maxSelections()):C.debug("Cannot select blank values from multiselect")}},remove:{active:function(){j.removeClass(S.active)},activeLabel:function(){j.find(O.label).removeClass(S.active)},empty:function(){j.removeClass(S.empty)},loading:function(){j.removeClass(S.loading)},initialLoad:function(){p=!1},upward:function(e){(e||j).removeClass(S.upward)},leftward:function(e){(e||U).removeClass(S.leftward)},visible:function(){j.removeClass(S.visible)},activeItem:function(){K.removeClass(S.active)},filteredItem:function(){k.useLabels&&C.has.maxSelections()||(k.useLabels&&C.is.multiple()?K.not("."+S.active).removeClass(S.filtered):K.removeClass(S.filtered),C.remove.empty())},optionValue:function(e){var t=C.escape.value(e),n=V.find('option[value="'+C.escape.string(t)+'"]');n.length>0&&n.hasClass(S.addition)&&(y&&(y.disconnect(),C.verbose("Temporarily disconnecting mutation observer")),n.remove(),C.verbose("Removing user addition as an <option>",t),y&&y.observe(V[0],{childList:!0,subtree:!0}))},message:function(){U.children(O.message).remove()},searchWidth:function(){z.css("width","")},searchTerm:function(){C.verbose("Cleared search term"),z.val(""),C.set.filtered()},userAddition:function(){K.filter(O.addition).remove()},selected:function(t,n){if(!(n=k.allowAdditions?n||C.get.itemWithAdditions(t):n||C.get.item(t)))return!1;n.each((function(){var t=e(this),n=C.get.choiceText(t),i=C.get.choiceValue(t,n);C.is.multiple()?k.useLabels?(C.remove.value(i,n,t),C.remove.label(i)):(C.remove.value(i,n,t),0===C.get.selectionCount()?C.set.placeholderText():C.set.text(C.add.variables(_.count))):C.remove.value(i,n,t),t.removeClass(S.filtered).removeClass(S.active),k.useLabels&&t.removeClass(S.selected)}))},selectedItem:function(){K.removeClass(S.selected)},value:function(e,t,n){var i,a=C.get.values();C.has.selectInput()?(C.verbose("Input is <select> removing selected option",e),i=C.remove.arrayValue(e,a),C.remove.optionValue(e)):(C.verbose("Removing from delimited values",e),i=(i=C.remove.arrayValue(e,a)).join(k.delimiter)),!1===k.fireOnInit&&C.is.initialLoad()?C.verbose("No callback on initial load",k.onRemove):k.onRemove.call(X,e,t,n),C.set.value(i,t,n),C.check.maxSelections()},arrayValue:function(t,n){return e.isArray(n)||(n=[n]),n=e.grep(n,(function(e){return t!=e})),C.verbose("Removed value from delimited string",t,n),n},label:function(e,t){var n=j.find(O.label).filter("[data-"+L.value+'="'+C.escape.string(e)+'"]');C.verbose("Removing label",n),n.remove()},activeLabels:function(e){e=e||j.find(O.label).filter("."+S.active),C.verbose("Removing active label selections",e),C.remove.labels(e)},labels:function(t){t=t||j.find(O.label),C.verbose("Removing labels",t),t.each((function(){var t=e(this),n=t.data(L.value),i=void 0!==n?String(n):n,a=C.is.userValue(i);!1!==k.onLabelRemove.call(t,n)?(C.remove.message(),a?(C.remove.value(i),C.remove.label(i)):C.remove.selected(i)):C.debug("Label remove callback cancelled removal")}))},tabbable:function(){C.is.searchSelection()?(C.debug("Searchable dropdown initialized"),z.removeAttr("tabindex"),U.removeAttr("tabindex")):(C.debug("Simple selection dropdown initialized"),j.removeAttr("tabindex"),U.removeAttr("tabindex"))}},has:{menuSearch:function(){return C.has.search()&&z.closest(U).length>0},search:function(){return z.length>0},sizer:function(){return P.length>0},selectInput:function(){return V.is("select")},minCharacters:function(e){return!k.minCharacters||(e=String(void 0!==e?e:C.get.query())).length>=k.minCharacters},firstLetter:function(e,t){var n,i;return!(!e||0===e.length||"string"!=typeof t)&&(n=C.get.choiceText(e,!1),t=t.toLowerCase(),i=String(n).charAt(0).toLowerCase(),t==i)},input:function(){return V.length>0},items:function(){return K.length>0},menu:function(){return U.length>0},message:function(){return 0!==U.children(O.message).length},label:function(e){var t=C.escape.value(e),n=j.find(O.label);return k.ignoreCase&&(t=t.toLowerCase()),n.filter("[data-"+L.value+'="'+C.escape.string(t)+'"]').length>0},maxSelections:function(){return k.maxSelections&&C.get.selectionCount()>=k.maxSelections},allResultsFiltered:function(){var e=K.not(O.addition);return e.filter(O.unselectable).length===e.length},userSuggestion:function(){return U.children(O.addition).length>0},query:function(){return""!==C.get.query()},value:function(e){return k.ignoreCase?C.has.valueIgnoringCase(e):C.has.valueMatchingCase(e)},valueMatchingCase:function(t){var n=C.get.values();return!!(e.isArray(n)?n&&-1!==e.inArray(t,n):n==t)},valueIgnoringCase:function(t){var n=C.get.values(),i=!1;return e.isArray(n)||(n=[n]),e.each(n,(function(e,n){if(String(t).toLowerCase()==String(n).toLowerCase())return i=!0,!1})),i}},is:{active:function(){return j.hasClass(S.active)},animatingInward:function(){return U.transition("is inward")},animatingOutward:function(){return U.transition("is outward")},bubbledLabelClick:function(t){return e(t.target).is("select, input")&&j.closest("label").length>0},bubbledIconClick:function(t){return e(t.target).closest(B).length>0},alreadySetup:function(){return j.is("select")&&void 0!==j.parent(O.dropdown).data(F)&&0===j.prev().length},animating:function(e){return e?e.transition&&e.transition("is animating"):U.transition&&U.transition("is animating")},leftward:function(e){return(e||U).hasClass(S.leftward)},disabled:function(){return j.hasClass(S.disabled)},focused:function(){return n.activeElement===j[0]},focusedOnSearch:function(){return n.activeElement===z[0]},allFiltered:function(){return(C.is.multiple()||C.has.search())&&!(0==k.hideAdditions&&C.has.userSuggestion())&&!C.has.message()&&C.has.allResultsFiltered()},hidden:function(e){return!C.is.visible(e)},initialLoad:function(){return p},inObject:function(t,n){var i=!1;return e.each(n,(function(e,n){if(n==t)return i=!0,!0})),i},multiple:function(){return j.hasClass(S.multiple)},remote:function(){return k.apiSettings&&C.can.useAPI()},single:function(){return!C.is.multiple()},selectMutation:function(t){var n=!1;return e.each(t,(function(t,i){if(i.target&&e(i.target).is("select"))return n=!0,!0})),n},search:function(){return j.hasClass(S.search)},searchSelection:function(){return C.has.search()&&1===z.parent(O.dropdown).length},selection:function(){return j.hasClass(S.selection)},userValue:function(t){return-1!==e.inArray(t,C.get.userValues())},upward:function(e){return(e||j).hasClass(S.upward)},visible:function(e){return e?e.hasClass(S.visible):U.hasClass(S.visible)},verticallyScrollableContext:function(){var e=M.get(0)!==t&&M.css("overflow-y");return"auto"==e||"scroll"==e},horizontallyScrollableContext:function(){var e=M.get(0)!==t&&M.css("overflow-X");return"auto"==e||"scroll"==e}},can:{activate:function(e){return!!k.useLabels||(!C.has.maxSelections()||!(!C.has.maxSelections()||!e.hasClass(S.active)))},openDownward:function(e){var n,i,a=e||U,o=!0;return a.addClass(S.loading),i={context:{offset:M.get(0)===t?{top:0,left:0}:M.offset(),scrollTop:M.scrollTop(),height:M.outerHeight()},menu:{offset:a.offset(),height:a.outerHeight()}},C.is.verticallyScrollableContext()&&(i.menu.offset.top+=i.context.scrollTop),(n={above:i.context.scrollTop<=i.menu.offset.top-i.context.offset.top-i.menu.height,below:i.context.scrollTop+i.context.height>=i.menu.offset.top-i.context.offset.top+i.menu.height}).below?(C.verbose("Dropdown can fit in context downward",n),o=!0):n.below||n.above?(C.verbose("Dropdown cannot fit below, opening upward",n),o=!1):(C.verbose("Dropdown cannot fit in either direction, favoring downward",n),o=!0),a.removeClass(S.loading),o},openRightward:function(e){var n,i,a=e||U,o=!0;return a.addClass(S.loading),i={context:{offset:M.get(0)===t?{top:0,left:0}:M.offset(),scrollLeft:M.scrollLeft(),width:M.outerWidth()},menu:{offset:a.offset(),width:a.outerWidth()}},C.is.horizontallyScrollableContext()&&(i.menu.offset.left+=i.context.scrollLeft),(n=i.menu.offset.left-i.context.offset.left+i.menu.width>=i.context.scrollLeft+i.context.width)&&(C.verbose("Dropdown cannot fit in context rightward",n),o=!1),a.removeClass(S.loading),o},click:function(){return c||"click"==k.on},extendSelect:function(){return k.allowAdditions||k.apiSettings},show:function(){return!C.is.disabled()&&(C.has.items()||C.has.message())},useAPI:function(){return void 0!==e.fn.api}},animate:{show:function(t,n){var i,a=n||U,o=n?function(){}:function(){C.hideSubMenus(),C.hideOthers(),C.set.active()};t=e.isFunction(t)?t:function(){},C.verbose("Doing menu show animation",a),C.set.direction(n),i=C.get.transition(n),C.is.selection()&&C.set.scrollPosition(C.get.selectedItem(),!0),(C.is.hidden(a)||C.is.animating(a))&&("none"==i?(o(),a.transition("show"),t.call(X)):void 0!==e.fn.transition&&j.transition("is supported")?a.transition({animation:i+" in",debug:k.debug,verbose:k.verbose,duration:k.duration,queue:!0,onStart:o,onComplete:function(){t.call(X)}}):C.error(I.noTransition,i))},hide:function(t,n){var i=n||U,a=(n?k.duration:k.duration,n?function(){}:function(){C.can.click()&&C.unbind.intent(),C.remove.active()}),o=C.get.transition(n);t=e.isFunction(t)?t:function(){},(C.is.visible(i)||C.is.animating(i))&&(C.verbose("Doing menu hide animation",i),"none"==o?(a(),i.transition("hide"),t.call(X)):void 0!==e.fn.transition&&j.transition("is supported")?i.transition({animation:o+" out",duration:k.duration,debug:k.debug,verbose:k.verbose,queue:!1,onStart:a,onComplete:function(){t.call(X)}}):C.error(I.transition))}},hideAndClear:function(){C.remove.searchTerm(),C.has.maxSelections()||(C.has.search()?C.hide((function(){C.remove.filteredItem()})):C.hide())},delay:{show:function(){C.verbose("Delaying show event to ensure user intent"),clearTimeout(C.timer),C.timer=setTimeout(C.show,k.delay.show)},hide:function(){C.verbose("Delaying hide event to ensure user intent"),clearTimeout(C.timer),C.timer=setTimeout(C.hide,k.delay.hide)}},escape:{value:function(t){var n=e.isArray(t),i="string"==typeof t,a=!i&&!n,o=i&&-1!==t.search(D.quote),r=[];return a||!o?t:(C.debug("Encoding quote values for use in select",t),n?(e.each(t,(function(e,t){r.push(t.replace(D.quote,"&quot;"))})),r):t.replace(D.quote,"&quot;"))},string:function(e){return(e=String(e)).replace(D.escape,"\\$&")}},setting:function(t,n){if(C.debug("Changing setting",t,n),e.isPlainObject(t))e.extend(!0,k,t);else{if(void 0===n)return k[t];e.isPlainObject(k[t])?e.extend(!0,k[t],n):k[t]=n}},internal:function(t,n){if(e.isPlainObject(t))e.extend(!0,C,t);else{if(void 0===n)return C[t];C[t]=n}},debug:function(){!k.silent&&k.debug&&(k.performance?C.performance.log(arguments):(C.debug=Function.prototype.bind.call(console.info,console,k.name+":"),C.debug.apply(console,arguments)))},verbose:function(){!k.silent&&k.verbose&&k.debug&&(k.performance?C.performance.log(arguments):(C.verbose=Function.prototype.bind.call(console.info,console,k.name+":"),C.verbose.apply(console,arguments)))},error:function(){k.silent||(C.error=Function.prototype.bind.call(console.error,console,k.name+":"),C.error.apply(console,arguments))},performance:{log:function(e){var t,n;k.performance&&(n=(t=(new Date).getTime())-(l||t),l=t,d.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:X,"Execution Time":n})),clearTimeout(C.performance.timer),C.performance.timer=setTimeout(C.performance.display,500)},display:function(){var t=k.name+":",n=0;l=!1,clearTimeout(C.performance.timer),e.each(d,(function(e,t){n+=t["Execution Time"]})),t+=" "+n+"ms",s&&(t+=" '"+s+"'"),(void 0!==console.group||void 0!==console.table)&&d.length>0&&(console.groupCollapsed(t),console.table?console.table(d):e.each(d,(function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")})),console.groupEnd()),d=[]}},invoke:function(t,n,i){var o,r,s,c=G;return n=n||f,i=X||i,"string"==typeof t&&void 0!==c&&(t=t.split(/[\. ]/),o=t.length-1,e.each(t,(function(n,i){var a=n!=o?i+t[n+1].charAt(0).toUpperCase()+t[n+1].slice(1):t;if(e.isPlainObject(c[a])&&n!=o)c=c[a];else{if(void 0!==c[a])return r=c[a],!1;if(!e.isPlainObject(c[i])||n==o)return void 0!==c[i]?(r=c[i],!1):(C.error(I.method,t),!1);c=c[i]}}))),e.isFunction(r)?s=r.apply(i,n):void 0!==r&&(s=r),e.isArray(a)?a.push(s):void 0!==a?a=[a,s]:void 0!==s&&(a=s),r}},h?(void 0===G&&C.initialize(),C.invoke(u)):(void 0!==G&&G.invoke("destroy"),C.initialize())})),void 0!==a?a:o},e.fn.dropdown.settings={silent:!1,debug:!1,verbose:!1,performance:!0,on:"click",action:"activate",values:!1,apiSettings:!1,selectOnKeydown:!0,minCharacters:0,filterRemoteData:!1,saveRemoteData:!0,throttle:200,context:t,direction:"auto",keepOnScreen:!0,match:"both",fullTextSearch:!1,placeholder:"auto",preserveHTML:!0,sortSelect:!1,forceSelection:!0,allowAdditions:!1,ignoreCase:!1,hideAdditions:!0,maxSelections:!1,useLabels:!0,delimiter:",",showOnFocus:!0,allowReselection:!1,allowTab:!0,allowCategorySelection:!1,fireOnInit:!1,transition:"auto",duration:200,glyphWidth:1.037,label:{transition:"scale",duration:200,variation:!1},delay:{hide:300,show:200,search:20,touch:50},onChange:function(e,t,n){},onAdd:function(e,t,n){},onRemove:function(e,t,n){},onLabelSelect:function(e){},onLabelCreate:function(t,n){return e(this)},onLabelRemove:function(e){return!0},onNoResults:function(e){return!0},onShow:function(){},onHide:function(){},name:"Dropdown",namespace:"dropdown",message:{addResult:"Add <b>{term}</b>",count:"{count} selected",maxSelections:"Max {maxCount} selections",noResults:"No results found.",serverError:"There was an error contacting the server"},error:{action:"You called a dropdown action that was not defined",alreadySetup:"Once a select has been initialized behaviors must be called on the created ui dropdown",labels:"Allowing user additions currently requires the use of labels.",missingMultiple:"<select> requires multiple property to be set to correctly preserve multiple values",method:"The method you called is not defined.",noAPI:"The API module is required to load resources remotely",noStorage:"Saving remote data requires session storage",noTransition:"This module requires ui transitions <https://github.com/Semantic-Org/UI-Transition>"},regExp:{escape:/[-[\]{}()*+?.,\\^$|#\s]/g,quote:/"/g},metadata:{defaultText:"defaultText",defaultValue:"defaultValue",placeholderText:"placeholder",text:"text",value:"value"},fields:{remoteValues:"results",values:"values",disabled:"disabled",name:"name",value:"value",text:"text"},keys:{backspace:8,delimiter:188,deleteKey:46,enter:13,escape:27,pageUp:33,pageDown:34,leftArrow:37,upArrow:38,rightArrow:39,downArrow:40},selector:{addition:".addition",dropdown:".ui.dropdown",hidden:".hidden",icon:"> .dropdown.icon",input:'> input[type="hidden"], > select',item:".item",label:"> .label",remove:"> .label > .delete.icon",siblingLabel:".label",menu:".menu",message:".message",menuIcon:".dropdown.icon",search:"input.search, .menu > .search > input, .menu input.search",sizer:"> input.sizer",text:"> .text:not(.icon)",unselectable:".disabled, .filtered"},className:{active:"active",addition:"addition",animating:"animating",disabled:"disabled",empty:"empty",dropdown:"ui dropdown",filtered:"filtered",hidden:"hidden transition",item:"item",label:"ui label",loading:"loading",menu:"menu",message:"message",multiple:"multiple",placeholder:"default",sizer:"sizer",search:"search",selected:"selected",selection:"selection",upward:"upward",leftward:"left",visible:"visible"}},e.fn.dropdown.settings.templates={dropdown:function(t){var n=t.placeholder||!1,i=(t.values,"");return i+='<i class="dropdown icon"></i>',t.placeholder?i+='<div class="default text">'+n+"</div>":i+='<div class="text"></div>',i+='<div class="menu">',e.each(t.values,(function(e,t){i+=t.disabled?'<div class="disabled item" data-value="'+t.value+'">'+t.name+"</div>":'<div class="item" data-value="'+t.value+'">'+t.name+"</div>"})),i+="</div>"},menu:function(t,n){var i=t[n.values]||{},a="";return e.each(i,(function(e,t){var i=t[n.text]?'data-text="'+t[n.text]+'"':"",o=t[n.disabled]?"disabled ":"";a+='<div class="'+o+'item" data-value="'+t[n.value]+'"'+i+">",a+=t[n.name],a+="</div>"})),a},label:function(e,t){return t+'<i class="delete icon"></i>'},message:function(e){return e},addition:function(e){return e}}}(jQuery,window,document)},function(e,t,n){"use strict";n.r(t);n(3);var i=n(0),a=n.n(i),o=n(1),r=n.n(o);$((function(){var e,t,i,o,s;return a.a.async((function(c){for(;;)switch(c.prev=c.next){case 0:if(e=document.getElementById("graph-canvas")){c.next=3;break}return c.abrupt("return");case 3:return c.next=5,a.a.awrap(Promise.all([n.e(0).then(n.bind(null,13)),n.e(0).then(n.t.bind(null,14,7))]));case 5:t=c.sent,i=r()(t,1),o=i[0].default,s=[],$("#graph-raw-list li span.node-relation").each((function(){s.push($(this).text())})),o(e,s);case 11:case"end":return c.stop()}}))}));var s,c,l,d,u;n(8);function h(e){return jQuery("<div />").text(e).html()}function f(e){var t=e.find(".tabular.menu");t.find(".item").tab(),t.find('.item[data-tab="'.concat(t.data("preview"),'"]')).click((function(){var n=$(this);$.post(n.data("url"),{_csrf:s,mode:"gfm",context:n.data("context"),text:e.find('.tab.segment[data-tab="'.concat(t.data("write"),'"] textarea')).val()},(function(n){var i=e.find('.tab.segment[data-tab="'.concat(t.data("preview"),'"]'));i.html(n),emojify.run(i[0]),$("pre code",i[0]).each((function(){hljs.highlightBlock(this)}))}))})),S()}function m(){var e,t;0!==$(".edit.form").length&&(!function(e){var t=e.find(".tabular.menu");t.find(".item").tab();var n=t.find('.item[data-tab="'.concat(t.data("preview"),'"]'));n.length&&(l=n.data("preview-file-modes").split(","),n.click((function(){var n=$(this);$.post(n.data("url"),{_csrf:s,mode:"gfm",context:n.data("context"),text:e.find('.tab.segment[data-tab="'.concat(t.data("write"),'"] textarea')).val()},(function(n){var i=e.find('.tab.segment[data-tab="'.concat(t.data("preview"),'"]'));i.html(n),emojify.run(i[0]),$("pre code",i[0]).each((function(){hljs.highlightBlock(this)}))}))})))}($(".edit.form")),e=$(".edit.form"),(t=e.find(".tabular.menu")).find(".item").tab(),t.find('.item[data-tab="'.concat(t.data("diff"),'"]')).click((function(){var n=$(this);$.post(n.data("url"),{_csrf:s,context:n.data("context"),content:e.find('.tab.segment[data-tab="'.concat(t.data("write"),'"] textarea')).val()},(function(n){var i=e.find('.tab.segment[data-tab="'.concat(t.data("diff"),'"]'));i.html(n),emojify.run(i[0])}))})))}function v(e,t,n,i){return new Promise((function(a){$.ajax({type:"POST",url:e,data:{_csrf:s,action:t,issue_ids:n,id:i},success:a})}))}function p(){window.location.reload()}function g(e){e.each((function(){var e=this;e.addEventListener("paste",(function(t){!function(e,t){if(e.clipboardData){var n=e.clipboardData.items;if(void 0!==n)for(var i=0;i<n.length;i++)if(-1!==n[i].type.indexOf("image")){var a=n[i].getAsFile();"function"==typeof t&&(e.preventDefault(),e.stopPropagation(),t(a))}}}(t,(function(t){var n=t.name.substr(0,t.name.lastIndexOf("."));!function(e,t){if(e.selectionStart||0===e.selectionStart){var n=e.selectionStart,i=e.selectionEnd;e.value=e.value.substring(0,n)+t+e.value.substring(i,e.value.length),e.selectionStart=n+t.length,e.selectionEnd=n+t.length}else e.value+=t}(e,"![".concat(n,"]()")),function(e,t){var n=new XMLHttpRequest;n.onload=function(){200===n.status&&t(n.responseText)},n.open("post","".concat(c,"/attachments"),!0),n.setRequestHeader("X-Csrf-Token",s);var i=new FormData;i.append("file",e,e.name),n.send(i)}(t,(function(t){var i=JSON.parse(t);!function(e,t,n){if(e.selectionStart||0===e.selectionStart){var i=e.selectionStart,a=e.selectionEnd;e.value=e.value.replace(t,n),e.selectionStart=i+n.length-t.length,e.selectionEnd=a+n.length-t.length}else e.value=e.value.replace(t,n)}(e,"![".concat(n,"]()"),"![".concat(n,"](").concat(c,"/attachments/").concat(i.uuid,")"));var a=$('<input id="'.concat(i.uuid,'" name="files" type="hidden">')).val(i.uuid);$(".files").append(a)}))}))}),!1)}))}function b(){var e;0!==$(".comment.form").length&&((e=$(".ui.select-branch")).find(".reference-list-menu").find(".item:not(.no-select)").click((function(){var t=$(this).data("id");$($(this).data("id-selector")).val(t),e.find(".ui .branch-name").text(t)})),e.find(".reference.column").click((function(){return e.find(".scrolling.reference-list-menu").css("display","none"),e.find(".reference .text").removeClass("black"),$($(this).data("target")).css("display","block"),$(this).find(".text").addClass("black"),!1})),f($(".comment.form")),g($(".comment.form textarea")),t("select-label","labels"),t("select-assignees","assignees"),t("select-assignees-modify","assignees"),n(".select-milestone","#milestone_id"),n(".select-assignee","#assignee_id"));function t(e,t){var n=$(".ui.".concat(t,".list")),i=n.find(".no-select"),a=$(".".concat(e," .menu")),o="update"===a.data("action"),r={};$(".".concat(e)).dropdown("setting","onHide",(function(){if(o="update"===a.data("action")){var e=[];Object.keys(r).forEach((function(t){var n=r[t],i=v(n["update-url"],n.action,n["issue-id"],t);e.push(i)})),Promise.all(e).then(p)}})),a.find(".item:not(.no-select)").click((function(){if("select-assignees-modify"===e)return $(this).hasClass("checked")?($(this).removeClass("checked"),$(this).find(".octicon").removeClass("octicon-check")):($(this).addClass("checked"),$(this).find(".octicon").addClass("octicon-check")),v(a.data("update-url"),"",a.data("issue-id"),$(this).data("id")),a.data("action","update"),!1;$(this).hasClass("checked")?($(this).removeClass("checked"),$(this).find(".octicon").removeClass("octicon-check"),o&&($(this).data("id")in r?delete r[$(this).data("id")]:r[$(this).data("id")]={"update-url":a.data("update-url"),action:"detach","issue-id":a.data("issue-id")})):($(this).addClass("checked"),$(this).find(".octicon").addClass("octicon-check"),o&&($(this).data("id")in r?delete r[$(this).data("id")]:r[$(this).data("id")]={"update-url":a.data("update-url"),action:"attach","issue-id":a.data("issue-id")}));var t=[];return $(this).parent().find(".item").each((function(){$(this).hasClass("checked")?(t.push($(this).data("id")),$($(this).data("id-selector")).removeClass("hide")):$($(this).data("id-selector")).addClass("hide")})),0===t.length?i.removeClass("hide"):i.addClass("hide"),$($(this).parent().data("id")).val(t.join(",")),!1})),a.find(".no-select.item").click((function(){(o||"select-assignees-modify"===e)&&v(a.data("update-url"),"clear",a.data("issue-id"),"").then(p),$(this).parent().find(".item").each((function(){$(this).removeClass("checked"),$(this).find(".octicon").removeClass("octicon-check")})),n.find(".item").each((function(){$(this).addClass("hide")})),i.removeClass("hide"),$($(this).parent().data("id")).val("")}))}function n(e,t){var n=$("".concat(e," .menu")),i=$(".ui".concat(e,".list")),a="update"===n.data("action");n.find(".item:not(.no-select)").click((function(){switch($(this).parent().find(".item").each((function(){$(this).removeClass("selected active")})),$(this).addClass("selected active"),a&&v(n.data("update-url"),"",n.data("issue-id"),$(this).data("id")).then(p),t){case"#milestone_id":i.find(".selected").html('<a class="item" href='.concat($(this).data("href"),">").concat(h($(this).text()),"</a>"));break;case"#assignee_id":i.find(".selected").html('<a class="item" href='.concat($(this).data("href"),">")+'<img class="ui avatar image" src='.concat($(this).data("avatar"),">").concat(h($(this).text()),"</a>"))}$(".ui".concat(e,".list .no-select")).addClass("hide"),$(t).val($(this).data("id"))})),n.find(".no-select.item").click((function(){$(this).parent().find(".item:not(.no-select)").each((function(){$(this).removeClass("selected active")})),a&&v(n.data("update-url"),"",n.data("issue-id"),$(this).data("id")).then(p),i.find(".selected").html(""),i.find(".no-select").removeClass("hide"),$(t).val("")}))}}function w(){if(0!==$(".repository").length){if(($(".repository.file.list").length>0||".repository.commits".length>0)&&$(".choose.reference .dropdown").each((function(){var e=$(this).find(".data"),t={items:[],mode:e.data("mode"),searchTerm:"",noResults:"",canCreateBranch:!1,menuVisible:!1,active:0};e.find(".item").each((function(){t.items.push({name:$(this).text(),url:$(this).data("url"),branch:$(this).hasClass("branch"),tag:$(this).hasClass("tag"),selected:$(this).hasClass("selected")})})),e.remove(),new Vue({delimiters:["${","}"],el:this,data:t,beforeMount:function(){var e=this;this.noResults=e.$el.getAttribute("data-no-results"),this.canCreateBranch="true"===e.$el.getAttribute("data-can-create-branch"),document.body.addEventListener("click",(function(t){e.$el.contains(t.target)||e.menuVisible&&Vue.set(e,"menuVisible",!1)}))},watch:{menuVisible:function(e){e&&this.focusSearchField()}},computed:{filteredItems:function(){var e=this,t=e.items.filter((function(t){return("branches"===e.mode&&t.branch||"tags"===e.mode&&t.tag)&&(!e.searchTerm||t.name.toLowerCase().indexOf(e.searchTerm.toLowerCase())>=0)}));return e.active=0===t.length&&e.showCreateNewBranch?0:-1,t},showNoResults:function(){return 0===this.filteredItems.length&&!this.showCreateNewBranch},showCreateNewBranch:function(){var e=this;return!(!this.canCreateBranch||!e.searchTerm||"tags"===e.mode)&&0===e.items.filter((function(t){return t.name.toLowerCase()===e.searchTerm.toLowerCase()})).length}},methods:{selectItem:function(e){var t=this.getSelected();null!==t&&(t.selected=!1),e.selected=!0,window.location.href=e.url},createNewBranch:function(){this.showCreateNewBranch&&this.$refs.newBranchForm.submit()},focusSearchField:function(){var e=this;Vue.nextTick((function(){e.$refs.searchField.focus()}))},getSelected:function(){for(var e=0,t=this.items.length;e<t;++e)if(this.items[e].selected)return this.items[e];return null},getSelectedIndexInFiltered:function(){for(var e=0,t=this.filteredItems.length;e<t;++e)if(this.filteredItems[e].selected)return e;return-1},scrollToActive:function(){var e=this.$refs["listItem".concat(this.active)];if(e&&0!==e.length){Array.isArray(e)&&(e=e[0]);var t=this.$refs.scrollContainer;e.offsetTop<t.scrollTop?t.scrollTop=e.offsetTop:e.offsetTop+e.clientHeight>t.scrollTop+t.clientHeight&&(t.scrollTop=e.offsetTop+e.clientHeight-t.clientHeight)}},keydown:function(e){var t=this;if(40===e.keyCode){if(e.preventDefault(),-1===t.active&&(t.active=t.getSelectedIndexInFiltered()),t.active+(t.showCreateNewBranch?0:1)>=t.filteredItems.length)return;t.active++,t.scrollToActive()}if(38===e.keyCode){if(e.preventDefault(),-1===t.active&&(t.active=t.getSelectedIndexInFiltered()),t.active<=0)return;t.active--,t.scrollToActive()}13===e.keyCode&&(e.preventDefault(),t.active>=t.filteredItems.length?t.createNewBranch():t.active>=0&&t.selectItem(t.filteredItems[t.active])),27===e.keyCode&&(e.preventDefault(),t.menuVisible=!1)}}})})),$(".repository.wiki.view").length>0&&l(".choose.page .dropdown"),$(".repository.settings.options").length>0&&($("#repo_name").keyup((function(){var e=$("#repo-name-change-prompt");$(this).val().toString().toLowerCase()!==$(this).data("name").toString().toLowerCase()?e.show():e.hide()})),$(".enable-system").change((function(){this.checked?($($(this).data("target")).removeClass("disabled"),$(this).data("context")||$($(this).data("context")).addClass("disabled")):($($(this).data("target")).addClass("disabled"),$(this).data("context")||$($(this).data("context")).removeClass("disabled"))})),$(".enable-system-radio").change((function(){"false"===this.value?($($(this).data("target")).addClass("disabled"),void 0!==$(this).data("context")&&$($(this).data("context")).removeClass("disabled")):"true"===this.value&&($($(this).data("target")).removeClass("disabled"),void 0!==$(this).data("context")&&$($(this).data("context")).addClass("disabled"))}))),$(".repository.labels").length>0){var e=$(".new-label.segment");$(".new-label.button").click((function(){e.show()})),$(".new-label.segment .cancel").click((function(){e.hide()})),$(".color-picker").each((function(){$(this).minicolors()})),$(".precolors .color").click((function(){var e=$(this).data("color-hex");$(".color-picker").val(e),$(".minicolors-swatch-color").css("background-color",e)})),$(".edit-label-button").click((function(){return $("#label-modal-id").val($(this).data("id")),$(".edit-label .new-label-input").val($(this).data("title")),$(".edit-label .new-label-desc-input").val($(this).data("description")),$(".edit-label .color-picker").val($(this).data("color")),$(".minicolors-swatch-color").css("background-color",$(this).data("color")),$(".edit-label.modal").modal({onApprove:function(){$(".edit-label.form").submit()}}).modal("show"),!1}))}if($(".repository.new.milestone").length>0){var t=$(".milestone.datepicker");t.datetimepicker({lang:t.data("lang"),inline:!0,timepicker:!1,startDate:t.data("start-date"),formatDate:"Y-m-d",onSelectDate:function(e){$("#deadline").val(e.dateFormat("Y-m-d"))}}),$("#clear-date").click((function(){return $("#deadline").val(""),!1}))}if($(".repository.view.issue").length>0){var n=$("#issue-title"),i=$("#edit-title-input input"),a=function(){return n.toggle(),$(".not-in-edit").toggle(),$("#edit-title-input").toggle(),$(".in-edit").toggle(),i.focus(),!1};$("#edit-title").click(a),$("#cancel-edit-title").click(a),$("#save-edit-title").click(a).click((function(){return 0===i.val().length||i.val()===n.text()?(i.val(n.text()),!1):($.post($(this).data("update-url"),{_csrf:s,title:i.val()},(function(e){i.val(e.title),n.text(e.title),p()})),!1)})),0!==$(".repository.view.issue .comments").length&&$(document).click((function(e){var t=$(":target");if(0!==t.length){var n=t.attr("id");if(n&&/^(issue|pull)(comment)?-\d+$/.test(n)&&0===$(e.target).closest("#".concat(n)).length){var i=$(window).scrollTop();window.location.hash="",$(window).scrollTop(i),window.history.pushState(null,null," ")}}})),$(".context-dropdown").dropdown({action:"hide"}),$(".quote-reply").click((function(e){$(this).closest(".dropdown").find(".menu").toggle("visible");var t,n=$(this).data("target");if($(this).hasClass("quote-reply-diff")){var i=$(this).closest(".comment-code-cloud");i.find("button.comment-form-reply").click(),t=i.find('[name="content"]')}else t=$("#content");var a=$("#comment-".concat(n)).text().replace(/\n/g,"\n> "),o="> ".concat(a,"\n\n");""!==t.val()?t.val("".concat(t.val(),"\n\n").concat(o)):t.val("".concat(o)),t.focus(),e.preventDefault()})),$(".edit-content").click((function(e){$(this).closest(".dropdown").find(".menu").toggle("visible");var t,n=$(this).closest(".header").next(),i=n.find(".edit-content-zone"),a=n.find(".render-content"),o=n.find(".raw-content");if(0===i.html().length){i.html($("#edit-content-form").html()),t=i.find("textarea"),issuesTribute.attach(t.get()),emojiTribute.attach(t.get());var r=i.find(".dropzone");r.data("saved",!1);var c=i.find(".comment-files");if(r.length>0){var l={};r.dropzone({url:r.data("upload-url"),headers:{"X-Csrf-Token":s},maxFiles:r.data("max-file"),maxFilesize:r.data("max-size"),acceptedFiles:"*/*"===r.data("accepts")?null:r.data("accepts"),addRemoveLinks:!0,dictDefaultMessage:r.data("default-message"),dictInvalidFileType:r.data("invalid-input-type"),dictFileTooBig:r.data("file-too-big"),dictRemoveFile:r.data("remove-file"),init:function(){this.on("success",(function(e,t){l[e.name]={uuid:t.uuid,submitted:!1};var n=$('<input id="'.concat(t.uuid,'" name="files" type="hidden">')).val(t.uuid);c.append(n)})),this.on("removedfile",(function(e){e.name in l&&($("#".concat(l[e.name].uuid)).remove(),r.data("remove-url")&&r.data("csrf")&&!l[e.name].submitted&&$.post(r.data("remove-url"),{file:l[e.name].uuid,_csrf:r.data("csrf")}))})),this.on("submit",(function(){$.each(l,(function(e){l[e].submitted=!0}))})),this.on("reload",(function(){$.getJSON(i.data("attachment-url"),(function(e){var t=r.get(0).dropzone;t.removeAllFiles(!0),c.empty(),$.each(e,(function(){var e="".concat(r.data("upload-url"),"/").concat(this.uuid);t.emit("addedfile",this),t.emit("thumbnail",this,e),t.emit("complete",this),t.files.push(this),l[this.name]={submitted:!0,uuid:this.uuid},r.find("img[src='".concat(e,"']")).css("max-width","100%");var n=$('<input id="'.concat(this.uuid,'" name="files" type="hidden">')).val(this.uuid);c.append(n)}))}))}))}}),r.get(0).dropzone.emit("reload")}var d=i.find(".ui.comment.form"),u=d.find(".tabular.menu");u.attr("data-write",i.data("write")),u.attr("data-preview",i.data("preview")),u.find(".write.item").attr("data-tab",i.data("write")),u.find(".preview.item").attr("data-tab",i.data("preview")),d.find(".write.segment").attr("data-tab",i.data("write")),d.find(".preview.segment").attr("data-tab",i.data("preview")),f(d),i.find(".cancel.button").click((function(){a.show(),i.hide(),r.get(0).dropzone.emit("reload")})),i.find(".save.button").click((function(){a.show(),i.hide();var e=c.find("[name=files]").map((function(){return $(this).val()})).get();$.post(i.data("update-url"),{_csrf:s,content:t.val(),context:i.data("context"),files:e},(function(e){0===e.length?a.html($("#no-content").html()):(a.html(e.content),emojify.run(a[0]),$("pre code",a[0]).each((function(){hljs.highlightBlock(this)})));var t=n.parent();t.find(".ui.small.images").length?""===e.attachments?t.find(".ui.small.images").parent().remove():t.find(".ui.small.images").html(e.attachments):""!==e.attachments&&(t.append('<div class="ui bottom attached segment"><div class="ui small images"></div></div>'),t.find(".ui.small.images").html(e.attachments)),r.get(0).dropzone.emit("submit"),r.get(0).dropzone.emit("reload")}))}))}else t=n.find("textarea");i.show(),a.hide(),0===t.val().length&&t.val(o.text()),t.focus(),e.preventDefault()})),$(".delete-comment").click((function(){var e=$(this);return window.confirm(e.data("locale"))&&$.post(e.data("url"),{_csrf:s}).success((function(){$("#".concat(e.data("comment-id"))).remove()})),!1}));var o=$("#status-button");$("#comment-form .edit_area").keyup((function(){0===$(this).val().length?o.text(o.data("status")):o.text(o.data("status-and-comment"))})),o.click((function(){$("#status").val(o.data("status-val")),$("#comment-form").submit()}));var r=$(".merge-button > button");r.on("click",(function(e){e.preventDefault(),$(".".concat($(this).data("do"),"-fields")).show(),$(this).parent().hide()})),$(".merge-button > .dropdown").dropdown({onChange:function(e,t,n){n.data("do")&&(r.find(".button-text").text(n.text()),r.data("do",n.data("do")))}}),$(".merge-cancel").on("click",(function(e){e.preventDefault(),$(this).closest(".form").hide(),r.parent().show()})),function e(t){var n="";t||(t=$(document),n=".reactions > "),t.find("".concat(n,"a.label")).popup({position:"bottom left",metadata:{content:"title",title:"none"}}),t.find(".select-reaction > .menu > .item, ".concat(n,"a.label")).on("click",(function(t){var n=this;if(t.preventDefault(),!$(this).hasClass("disabled")){var i=$(this).hasClass("item")?$(this).closest(".select-reaction").data("action-url"):$(this).data("action-url"),a="".concat(i,"/").concat($(this).hasClass("blue")?"unreact":"react");$.ajax({type:"POST",url:a,data:{_csrf:s,content:$(this).data("content")}}).done((function(t){if(t&&(t.html||t.empty)){var i=$(n).closest(".content"),a=i.find(".segment.reactions");if(!t.empty&&a.length>0&&a.remove(),!t.empty){a=$('<div class="ui attached segment reactions"></div>');var o=i.find(".segment.bottom:first");o.length>0?a.insertBefore(o):a.appendTo(i),a.html(t.html);for(var r=a.find(".has-emoji"),s=0;s<r.length;s++)emojify.run(r.get(s));a.find(".dropdown").dropdown(),e(a)}}}))}}))}()}$(".repository.diff").length>0&&$(".diff-counter").each((function(){var e=$(this),t=e.find("span[data-line].add").data("line"),n=e.find("span[data-line].del").data("line"),i=parseFloat(t)/(parseFloat(t)+parseFloat(n))*100;e.find(".bar .add").css("width","".concat(i,"%"))})),$("#repo-clone-ssh").click((function(){$(".clone-url").text($(this).data("link")),$("#repo-clone-url").val($(this).data("link")),$(this).addClass("blue"),$("#repo-clone-https").removeClass("blue"),localStorage.setItem("repo-clone-protocol","ssh")})),$("#repo-clone-https").click((function(){$(".clone-url").text($(this).data("link")),$("#repo-clone-url").val($(this).data("link")),$(this).addClass("blue"),$("#repo-clone-ssh").removeClass("blue"),localStorage.setItem("repo-clone-protocol","https")})),$("#repo-clone-url").click((function(){$(this).select()}));var c=$(".repository.compare.pull");c.length>0&&(l(".choose.branch .dropdown"),c.find("button.show-form").on("click",(function(e){e.preventDefault(),c.find(".pullrequest-form").show(),$(this).parent().hide()}))),$(".repository.settings.branches").length>0&&(l(".protected-branches .dropdown"),$(".enable-protection, .enable-whitelist").change((function(){this.checked?$($(this).data("target")).removeClass("disabled"):$($(this).data("target")).addClass("disabled")})))}function l(e){var t=$(e);t.dropdown({fullTextSearch:!0,selectOnKeydown:!1,onChange:function(e,t,n){n.data("url")&&(window.location.href=n.data("url"))},message:{noResults:t.data("no-results")}})}}function y(e){var t=Math.floor(Math.random()*Math.floor(1e6));return e.attr("data-write",e.attr("data-write")+t),e.attr("data-preview",e.attr("data-preview")+t),e.find(".item").each((function(){var e=$(this).attr("data-tab")+t;$(this).attr("data-tab",e)})),e.parent().find("*[data-tab='write']").attr("data-tab","write".concat(t)),e.parent().find("*[data-tab='preview']").attr("data-tab","preview".concat(t)),f(e.parent(".form")),t}function x(){$(".access-mode.menu .item").click((function(){var e=$(this).parent();$.post(e.data("url"),{_csrf:s,uid:e.data("uid"),mode:$(this).data("value")})}))}function C(){$(".js-quick-pull-choice-option").change((function(){"commit-to-new-branch"===$(this).val()?($(".quick-pull-branch-name").show(),$(".quick-pull-branch-name input").prop("required",!0)):($(".quick-pull-branch-name").hide(),$(".quick-pull-branch-name input").prop("required",!1)),$("#commit-button").text($(this).attr("button_text"))}));var e=$("#file-name");e.keyup((function(e){var t,n,i=$(".breadcrumb span.section"),a=$(".breadcrumb div.divider");if(8===e.keyCode&&0===$(this).getCursorPosition()&&i.length>0&&(t=i.last().find("a").text(),$(this).val(t+$(this).val()),$(this)[0].setSelectionRange(t.length,t.length),i.last().remove(),a.last().remove()),191===e.keyCode){n=$(this).val().split("/");for(var o=0;o<n.length;++o)t=n[o],o<n.length-1?t.length&&($('<span class="section"><a href="#">'.concat(t,"</a></span>")).insertBefore($(this)),$('<div class="divider"> / </div>').insertBefore($(this))):$(this).val(t),$(this)[0].setSelectionRange(0,0)}n=[],$(".breadcrumb span.section").each((function(){var e=$(this);e.find("a").length?n.push(e.find("a").text()):n.push(e.text())})),$(this).val()&&n.push($(this).val()),$("#tree_path").val(n.join("/"))})).trigger("keyup");var t=$(".repository.editor textarea#edit_area");if(t.length){var n=t.data("markdown-file-exts").split(","),i=t.data("line-wrap-extensions").split(",");e.on("keyup",(function(){var a,o,r,c,h,f,m=e.val();r=c="";var v=/.+\.([^.]+)$/.exec(m);v&&(r=v[1],c=".".concat(r));var p=CodeMirror.findModeByExtension(r),g=$("a[data-tab=preview]");if(p?(a=p.mode,o=p.mime,f=a):f=r,g.length&&f&&l&&l.length&&l.indexOf(f)>=0?(h=g.data("url"),g.data("url",h.replace(/(.*)\/.*/i,"$1/".concat(a))),g.show()):g.hide(),!(n.indexOf(c)>=0&&function(e){return u&&(u.toTextArea(),u=null),!!d||(d=new SimpleMDE({autoDownloadFontAwesome:!1,element:e[0],forceSync:!0,renderingConfig:{singleLineBreaks:!1},indentWithTabs:!1,tabSize:4,spellChecker:!1,previewRender:function(t,n){return setTimeout((function(){$.post(e.data("url"),{_csrf:s,mode:"gfm",context:e.data("context"),text:t},(function(e){n.innerHTML='<div class="markdown ui segment">'.concat(e,"</div>"),emojify.run($(".editor-preview")[0])}))}),0),"Loading..."},toolbar:["bold","italic","strikethrough","|","heading-1","heading-2","heading-3","heading-bigger","heading-smaller","|","code","quote","|","unordered-list","ordered-list","|","link","image","table","horizontal-rule","|","clean-block","preview","fullscreen","side-by-side"]}),!0)}(t))&&(u||function(e){return d&&(d.toTextArea(),d=null),!!u||((u=CodeMirror.fromTextArea(e[0],{lineNumbers:!0})).on("change",(function(t,n){e.val(t.getValue())})),!0)}(t))){a&&(u.setOption("mode",o),CodeMirror.autoLoadMode(u,a)),i.indexOf(c)>=0?u.setOption("lineWrapping",!0):u.setOption("lineWrapping",!1);var b=e.val();0!==b.length&&(b=(b=b.split("/"))[b.length-1],$.getJSON(e.data("ec-url-prefix")+b,(function(e){"tab"===e.indent_style?(u.setOption("indentWithTabs",!0),u.setOption("extraKeys",{})):(u.setOption("indentWithTabs",!1),u.setOption("extraKeys",{Tab:function(e){var t=Array(parseInt(e.getOption("indentUnit"))+1).join(" ");e.replaceSelection(t)}})),u.setOption("indentUnit",e.indent_size||4),u.setOption("tabSize",e.tab_width||4)})))}})).trigger("keyup");var a=$("#commit-button"),o=$(".ui.edit.form");a.prop("disabled",!0),o.areYouSure({silent:!0,dirtyClass:"dirty-file",fieldSelector:":input:not(.commit-form-wrapper :input)",change:function(){var e=$(this).hasClass("dirty-file");a.prop("disabled",!e)}}),a.click((function(e){0===t.val().length&&($("#edit-empty-content-modal").modal({onApprove:function(){$(".edit.form").submit()}}).modal("show"),e.preventDefault())}))}}function k(){$(".user.settings.profile").length>0&&$("#username").keyup((function(){var e=$("#name-change-prompt");$(this).val().toString().toLowerCase()!==$(this).data("name").toString().toLowerCase()?e.show():e.hide()}))}function S(){$(".ui.button").keypress((function(e){13!==e.keyCode&&32!==e.keyCode||$(this).click()}))}function _(){$(".code-view .linenums").length>0&&($(document).on("click",".lines-num span",(function(e){var t=$(this),n=t.parent().siblings(".lines-code").find("ol.linenums > li");O(n,n.filter("[rel=".concat(t.attr("id"),"]")),e.shiftKey?n.filter(".active").eq(0):null),window.getSelection?window.getSelection().removeAllRanges():document.selection.empty()})),$(window).on("hashchange",(function(){var e,t=window.location.hash.match(/^#(L\d+)-(L\d+)$/),n=$(".code-view ol.linenums > li");if(t)return e=n.filter(".".concat(t[1])),O(n,e,n.filter(".".concat(t[2]))),void $("html, body").scrollTop(e.offset().top-200);(t=window.location.hash.match(/^#(L|n)(\d+)$/))&&(e=n.filter(".L".concat(t[2])),O(n,e),$("html, body").scrollTop(e.offset().top-200))})).trigger("hashchange")),$(".ui.fold-code").on("click",(function(e){var t=$(e.target);t.hasClass("fa-chevron-down")?$(e.target).parent().next().slideUp("fast",(function(){t.removeClass("fa-chevron-down").addClass("fa-chevron-right")})):$(e.target).parent().next().slideDown("fast",(function(){t.removeClass("fa-chevron-right").addClass("fa-chevron-down")}))})),$(".ui.blob-excerpt").on("click",(function(e){!function e(t){var n=$(t.target),i=n.parent().parent();$.get("".concat(n.data("url"),"?").concat(n.data("query"),"&anchor=").concat(n.data("anchor")),(function(t){i.replaceWith(t),$('[data-anchor="'.concat(n.data("anchor"),'"]')).on("click",(function(t){e(t)}))}))}(e)}))}function T(e){$.ajax({url:"".concat(c,"/user/u2f/sign"),type:"POST",headers:{"X-Csrf-Token":s},data:JSON.stringify(e),contentType:"application/json; charset=utf-8"}).done((function(e){window.location.replace(e)})).fail((function(){L(1)}))}function A(e){(function(e){if(!("errorCode"in e))return!1;if(0===e.errorCode)return!1;return L(e.errorCode),!0})(e)||$.ajax({url:"".concat(c,"/user/settings/security/u2f/register"),type:"POST",headers:{"X-Csrf-Token":s},data:JSON.stringify(e),contentType:"application/json; charset=utf-8",success:function(){p()},fail:function(){L(1)}})}function L(e){var t={browser:$("#unsupported-browser"),1:$("#u2f-error-1"),2:$("#u2f-error-2"),3:$("#u2f-error-3"),4:$("#u2f-error-4"),5:$(".u2f-error-5")};t[e].removeClass("hide"),Object.keys(t).forEach((function(n){n!==e&&t[n].addClass("hide")})),$("#u2f-error").modal("show")}function q(){$.post("".concat(c,"/user/settings/security/u2f/request_register"),{_csrf:s,name:$("#nickname").val()}).success((function(e){$("#nickname").closest("div.field").removeClass("error"),$("#register-device").modal("show"),null===e.registeredKeys&&(e.registeredKeys=[]),u2fApi.register(e.appId,e.registerRequests,e.registeredKeys,30).then(A).catch((function(e){L(void 0!==e?e.metaData.code:1)}))})).fail((function(e){409===e.status&&$("#nickname").closest("div.field").addClass("error")}))}function D(e){window.history.pushState?window.history.pushState(null,null,e):window.location.hash=e}function O(e,t,n){if(e.removeClass("active"),n){var i,a=parseInt(t.attr("rel").substr(1)),o=parseInt(n.attr("rel").substr(1));if(a!==o){a>o&&(i=a,a=o,o=i);for(var r=[],s=a;s<=o;s++)r.push(".L".concat(s));return e.filter(r.join(",")).addClass("active"),void D("#L".concat(a,"-L").concat(o))}}t.addClass("active"),D("#".concat(t.attr("rel")))}function I(){var e=$(this),t="";e.attr("id")&&(t+="#".concat(e.attr("id")));var n=$(".delete.modal".concat(t));return n.find(".name").text(e.data("name")),n.modal({closable:!1,onApprove:function(){"form"!==e.data("type")?$.post(e.data("url"),{_csrf:s,id:e.data("id")}).done((function(e){window.location.href=e.redirect})):$(e.data("form")).submit()}}).modal("show"),!1}function R(){var e=$(this),t="";e.attr("id")&&(t+="#".concat(e.attr("id")));var n=$(".addall.modal".concat(t));return n.find(".name").text(e.data("name")),n.modal({closable:!1,onApprove:function(){"form"!==e.data("type")?$.post(e.data("url"),{_csrf:s,id:e.data("id")}).done((function(e){window.location.href=e.redirect})):$(e.data("form")).submit()}}).modal("show"),!1}"undefined"!=typeof Dropzone&&(Dropzone.autoDiscover=!1),$.fn.getCursorPosition=function(){var e=$(this).get(0),t=0;if("selectionStart"in e)t=e.selectionStart;else if("selection"in document){e.focus();var n=document.selection.createRange(),i=document.selection.createRange().text.length;n.moveStart("character",-e.value.length),t=n.text.length-i}return t},$(document).ready((function(){if(s=$("meta[name=_csrf]").attr("content"),c=$("meta[name=_suburl]").attr("content"),$(".time-since").each((function(){$(this).addClass("poping up").attr("data-content",$(this).attr("title")).attr("data-variation","inverted tiny").attr("title","")})),$(".dropdown:not(.custom)").dropdown(),$(".jump.dropdown").dropdown({action:"hide",onShow:function(){$(".poping.up").popup("hide")}}),$(".slide.up.dropdown").dropdown({transition:"slide up"}),$(".upward.dropdown").dropdown({direction:"upward"}),$(".ui.accordion").accordion(),$(".ui.checkbox").checkbox(),$(".ui.progress").progress({showActivity:!1}),$(".poping.up").popup(),$(".top.menu .poping.up").popup({onShow:function(){if($(".top.menu .menu.transition").hasClass("visible"))return!1}}),$(".tabular.menu .item").tab(),$(".tabable.menu .item").tab(),$(".toggle.button").click((function(){$($(this).data("target")).slideToggle(100)})),$("tr[data-href]").click((function(){window.location=$(this).data("href")})),"undefined"!=typeof hljs)for(var e=[].slice.call(document.querySelectorAll("pre code")||[]),t=0;t<e.length;t++)hljs.highlightBlock(e[t]);var n=$("#dropzone");if(n.length>0){var i={};new Dropzone("#dropzone",{url:n.data("upload-url"),headers:{"X-Csrf-Token":s},maxFiles:n.data("max-file"),maxFilesize:n.data("max-size"),acceptedFiles:"*/*"===n.data("accepts")?null:n.data("accepts"),addRemoveLinks:!0,dictDefaultMessage:n.data("default-message"),dictInvalidFileType:n.data("invalid-input-type"),dictFileTooBig:n.data("file-too-big"),dictRemoveFile:n.data("remove-file"),init:function(){this.on("success",(function(e,t){i[e.name]=t.uuid;var n=$('<input id="'.concat(t.uuid,'" name="files" type="hidden">')).val(t.uuid);$(".files").append(n)})),this.on("removedfile",(function(e){e.name in i&&$("#".concat(i[e.name])).remove(),n.data("remove-url")&&n.data("csrf")&&$.post(n.data("remove-url"),{file:i[e.name],_csrf:n.data("csrf")})}))}})}emojify.setConfig({img_dir:"".concat(c,"/vendor/plugins/emojify/images"),ignore_emoticons:!0});for(var a=document.getElementsByClassName("has-emoji"),o=0;o<a.length;o++){emojify.run(a[o]);for(var r=0;r<a[o].childNodes.length;r++)"A"===a[o].childNodes[r].nodeName&&emojify.run(a[o].childNodes[r])}var l,d,u,f,g,A,D,O,E,F,j,M,N,z,P,V=new Clipboard(".clipboard");if(V.on("success",(function(e){e.clearSelection(),$("#".concat(e.trigger.getAttribute("id"))).popup("destroy"),e.trigger.setAttribute("data-content",e.trigger.getAttribute("data-success")),$("#".concat(e.trigger.getAttribute("id"))).popup("show"),e.trigger.setAttribute("data-content",e.trigger.getAttribute("data-original"))})),V.on("error",(function(e){$("#".concat(e.trigger.getAttribute("id"))).popup("destroy"),e.trigger.setAttribute("data-content",e.trigger.getAttribute("data-error")),$("#".concat(e.trigger.getAttribute("id"))).popup("show"),e.trigger.setAttribute("data-content",e.trigger.getAttribute("data-original"))})),$(".delete-button").click(I),$(".add-all-button").click(R),$(".delete-branch-button").click(I),$(".undo-button").click((function(){var e=$(this);$.post(e.data("url"),{_csrf:s,id:e.data("id")}).done((function(e){window.location.href=e.redirect}))})),$(".show-panel.button").click((function(){$($(this).data("panel")).show()})),$(".show-modal.button").click((function(){$($(this).data("modal")).modal("show")})),$(".delete-post.button").click((function(){var e=$(this);$.post(e.data("request-url"),{_csrf:s}).done((function(){window.location.href=e.data("done-url")}))})),$(".markdown").each((function(){var e={};$(this).find("h1, h2, h3, h4, h5, h6").each((function(){var t=$(this),n=encodeURIComponent(t.text().toLowerCase().replace(/[^\u00C0-\u1FFF\u2C00-\uD7FF\w\- ]/g,"").replace(/[ ]/g,"-")),i=n;e[n]>0&&(i="".concat(n,"-").concat(e[n])),void 0===e[n]?e[n]=1:e[n]+=1,(t=t.wrap('<div id="'.concat(i,'" class="anchor-wrap" ></div>'))).append('<a class="anchor" href="#'.concat(i,'"><span class="octicon octicon-link"></span></a>'))}))})),$(".issue-checkbox").click((function(){$(".issue-checkbox").children("input:checked").length>0?($("#issue-filters").addClass("hide"),$("#issue-actions").removeClass("hide")):($("#issue-filters").removeClass("hide"),$("#issue-actions").addClass("hide"))})),$(".issue-action").click((function(){var e=this.dataset.action,t=this.dataset.elementId,n=$(".issue-checkbox").children("input:checked").map((function(){return this.dataset.issueId})).get().join(),i=this.dataset.url;"0"===t&&"/assignee"===i.substr(-9)&&(t="",e="clear"),v(i,e,n,t).then((function(){"close"!==e&&"open"!==e||$('.issue-checkbox input[type="checkbox"]').each((function(e,t){t.checked=!1})),p()}))})),$('.issue-checkbox input[type="checkbox"]:checked').first().each((function(e,t){t.checked=!1,$(t).click()})),S(),$("#search-user-box").search({minCharacters:2,apiSettings:{url:"".concat(c,"/api/v1/users/search?q={query}"),onResponse:function(e){var t=[];return $.each(e.data,(function(e,n){var i=n.login;n.full_name&&n.full_name.length>0&&(i+=" (".concat(h(n.full_name),")")),t.push({title:i,image:n.avatar_url})})),{results:t}}},searchFields:["login","full_name"],showNoResults:!1}),(l=$("#search-team-box")).search({minCharacters:2,apiSettings:{url:"".concat(c,"/api/v1/orgs/").concat(l.data("org"),"/teams/search?q={query}"),headers:{"X-Csrf-Token":s},onResponse:function(e){var t=[];return $.each(e.data,(function(e,n){var i="".concat(n.name," (").concat(n.permission," access)");t.push({title:i})})),{results:t}}},searchFields:["name","description"],showNoResults:!1}),(d=$("#search-repo-box")).search({minCharacters:2,apiSettings:{url:"".concat(c,"/api/v1/repos/search?q={query}&uid=").concat(d.data("uid")),onResponse:function(e){var t=[];return $.each(e.data,(function(e,n){t.push({title:n.full_name.split("/")[1],description:n.full_name})})),{results:t}}},searchFields:["full_name"],showNoResults:!1}),b(),0!==$(".install").length&&(""===$("#db_host").val()&&($("#db_host").val("127.0.0.1:3306"),$("#db_user").val("gitea"),$("#db_name").val("gitea")),$("#db_type").change((function(){var e=$(this).val();if("SQLite3"===e)return $("#sql_settings").hide(),$("#pgsql_settings").hide(),$("#mysql_settings").hide(),$("#sqlite_settings").show(),void("SQLite3"===e&&"data/gitea_tidb"===$("#db_path").val()&&$("#db_path").val("data/gitea.db"));var t={MySQL:"127.0.0.1:3306",PostgreSQL:"127.0.0.1:5432",MSSQL:"127.0.0.1:1433"};$("#sqlite_settings").hide(),$("#sql_settings").show(),$("#pgsql_settings").toggle("PostgreSQL"===e),$("#mysql_settings").toggle("MySQL"===e),$.each(t,(function(n,i){if($("#db_host").val()===i)return $("#db_host").val(t[e]),!1}))})),$("#offline-mode input").change((function(){$(this).is(":checked")&&($("#disable-gravatar").checkbox("check"),$("#federated-avatar-lookup").checkbox("uncheck"))})),$("#disable-gravatar input").change((function(){$(this).is(":checked")?$("#federated-avatar-lookup").checkbox("uncheck"):$("#offline-mode").checkbox("uncheck")})),$("#federated-avatar-lookup input").change((function(){$(this).is(":checked")&&($("#disable-gravatar").checkbox("uncheck"),$("#offline-mode").checkbox("uncheck"))})),$("#enable-openid-signin input").change((function(){$(this).is(":checked")?$("#disable-registration input").is(":checked")||$("#enable-openid-signup").checkbox("check"):$("#enable-openid-signup").checkbox("uncheck")})),$("#disable-registration input").change((function(){$(this).is(":checked")?($("#enable-captcha").checkbox("uncheck"),$("#enable-openid-signup").checkbox("uncheck")):$("#enable-openid-signup").checkbox("check")})),$("#enable-captcha input").change((function(){$(this).is(":checked")&&$("#disable-registration").checkbox("uncheck")}))),w(),(u=function(){var e=$("#auth_username").val(),t=$("#clone_addr").val();!$("#mirror").is(":checked")&&e&&e.length>0&&void 0!==t&&(t.startsWith("https://github.com")||t.startsWith("http://github.com"))?$("#migrate_items").show():$("#migrate_items").hide()})(),$("#clone_addr").on("input",u),$("#auth_username").on("input",u),$("#mirror").on("change",u),function(){var e=$(".repository.wiki textarea#edit_area"),t=0,n=null;if(e.length>0){var i=new SimpleMDE({autoDownloadFontAwesome:!1,element:e[0],forceSync:!0,previewRender:function(a,o){return setTimeout((function(){var r=function(){t=0,null!=n&&(clearTimeout(n),n=null),$.post(e.data("url"),{_csrf:s,mode:"gfm",context:e.data("context"),text:a},(function(e){o.innerHTML='<div class="markdown ui segment">'.concat(e,"</div>"),emojify.run($(".editor-preview")[0]),$(o).find("pre code").each((function(e,t){hljs.highlightBlock(t)}))}))};i.isSideBySideActive()?(++t>10&&r(),null!=n&&(clearTimeout(n),n=null),n=setTimeout(r,600)):r()}),0),i.isSideBySideActive()?o.innerHTML:"Loading..."},renderingConfig:{singleLineBreaks:!1},indentWithTabs:!1,tabSize:4,spellChecker:!1,toolbar:["bold","italic","strikethrough","|","heading-1","heading-2","heading-3","heading-bigger","heading-smaller","|",{name:"code-inline",action:function(e){var t=e.codemirror,n=t.getSelection();if(t.replaceSelection("`".concat(n,"`")),!n){var i=t.getCursor();t.setCursor(i.line,i.ch-1)}t.focus()},className:"fa fa-angle-right",title:"Add Inline Code"},"code","quote","|",{name:"checkbox-empty",action:function(e){var t=e.codemirror;t.replaceSelection("\n- [ ] ".concat(t.getSelection())),t.focus()},className:"fa fa-square-o",title:"Add Checkbox (empty)"},{name:"checkbox-checked",action:function(e){var t=e.codemirror;t.replaceSelection("\n- [x] ".concat(t.getSelection())),t.focus()},className:"fa fa-check-square-o",title:"Add Checkbox (checked)"},"|","unordered-list","ordered-list","|","link","image","table","horizontal-rule","|","clean-block","preview","fullscreen","side-by-side"]});$(i.codemirror.getInputField()).addClass("js-quick-submit"),setTimeout((function(){var e=$('.repository.wiki.new .previewtabs a[data-tab="write"]'),n=$('.repository.wiki.new .previewtabs a[data-tab="preview"]'),i=$(".editor-toolbar"),a=$(".editor-toolbar a.fa-eye"),o=$(".editor-toolbar a.fa-columns");e.on("click",(function(){i.hasClass("disabled-for-preview")&&a.click()})),n.on("click",(function(){i.hasClass("disabled-for-preview")||a.click()})),a.on("click",(function(){setTimeout((function(){i.hasClass("disabled-for-preview")?(e.hasClass("active")&&e.removeClass("active"),n.hasClass("active")||n.addClass("active")):(e.hasClass("active")||e.addClass("active"),n.hasClass("active")&&n.removeClass("active"))}),0)})),o.on("click",(function(){t=10}))}),0)}}(),m(),C(),0!==$(".organization").length&&$(".organization.settings.options").length>0&&$("#org_name").keyup((function(){var e=$("#org-name-change-prompt");$(this).val().toString().toLowerCase()!==$(this).data("org-name").toString().toLowerCase()?e.show():e.hide()})),0!==$(".edit.githook").length&&CodeMirror.autoLoadMode(CodeMirror.fromTextArea($("#content")[0],{lineNumbers:!0,mode:"shell"}),"shell"),function(){if(0!==$(".new.webhook").length){$(".events.checkbox input").change((function(){$(this).is(":checked")&&$(".events.fields").show()})),$(".non-events.checkbox input").change((function(){$(this).is(":checked")&&$(".events.fields").hide()}));var e=function(){var e="POST"===$("#http_method").val();$("#content_type").parent().parent()[e?"show":"hide"]()};e(),$("#http_method").change((function(){e()})),$("#test-delivery").click((function(){var e=$(this);e.addClass("loading disabled"),$.post(e.data("link"),{_csrf:s}).done(setTimeout((function(){window.location.href=e.data("redirect")}),5e3))}))}}(),function(){if(0!==$(".admin").length){if(($(".admin.new.user").length>0||$(".admin.edit.user").length>0)&&$("#login_type").change((function(){"0"===$(this).val().substring(0,1)?($("#login_name").removeAttr("required"),$(".non-local").hide(),$(".local").show(),$("#user_name").focus(),"required"===$(this).data("password")&&$("#password").attr("required","required")):($("#login_name").attr("required","required"),$(".non-local").show(),$(".local").hide(),$("#login_name").focus(),$("#password").removeAttr("required"))})),$(".admin.new.authentication").length>0&&($("#auth_type").change((function(){$(".ldap, .dldap, .smtp, .pam, .oauth2, .has-tls .search-page-size .sspi").hide(),$(".ldap input[required], .binddnrequired input[required], .dldap input[required], .smtp input[required], .pam input[required], .oauth2 input[required], .has-tls input[required], .sspi input[required]").removeAttr("required"),$(".binddnrequired").removeClass("required");var e=$(this).val();switch(e){case"2":$(".ldap").show(),$(".binddnrequired input, .ldap div.required:not(.dldap) input").attr("required","required"),$(".binddnrequired").addClass("required");break;case"3":$(".smtp").show(),$(".has-tls").show(),$(".smtp div.required input, .has-tls").attr("required","required");break;case"4":$(".pam").show(),$(".pam input").attr("required","required");break;case"5":$(".dldap").show(),$(".dldap div.required:not(.ldap) input").attr("required","required");break;case"6":$(".oauth2").show(),$(".oauth2 div.required:not(.oauth2_use_custom_url,.oauth2_use_custom_url_field,.open_id_connect_auto_discovery_url) input").attr("required","required"),o();break;case"7":$(".sspi").show(),$(".sspi div.required input").attr("required","required")}"2"!==e&&"5"!==e||i(),"2"===e&&a()})),$("#auth_type").change(),$("#security_protocol").change(i),$("#use_paged_search").change(a),$("#oauth2_provider").change(o),$("#oauth2_use_custom_url").change(r)),$(".admin.edit.authentication").length>0){var e=$("#auth_type").val();"2"===e||"5"===e?($("#security_protocol").change(i),"2"===e&&$("#use_paged_search").change(a)):"6"===e&&($("#oauth2_provider").change(o),$("#oauth2_use_custom_url").change(r),o())}if($(".admin.notice")){var t=$("#detail-modal");$(".view-detail").click((function(){return t.find(".content p").text($(this).data("content")),t.modal("show"),!1}));var n=$(".select.table .ui.checkbox");$(".select.action").click((function(){switch($(this).data("action")){case"select-all":n.checkbox("check");break;case"deselect-all":n.checkbox("uncheck");break;case"inverse":n.checkbox("toggle")}})),$("#delete-selection").click((function(){var e=$(this);e.addClass("loading disabled");var t=[];n.each((function(){$(this).checkbox("is checked")&&t.push($(this).data("id"))})),$.post(e.data("link"),{_csrf:s,ids:t}).done((function(){window.location.href=e.data("redirect")}))}))}}function i(){$("#security_protocol").val()>0?$(".has-tls").show():$(".has-tls").hide()}function a(){$("#use_paged_search").prop("checked")?$(".search-page-size").show().find("input").attr("required","required"):$(".search-page-size").hide().find("input").removeAttr("required")}function o(){switch($(".open_id_connect_auto_discovery_url, .oauth2_use_custom_url").hide(),$(".open_id_connect_auto_discovery_url input[required]").removeAttr("required"),$("#oauth2_provider").val()){case"github":case"gitlab":case"gitea":$(".oauth2_use_custom_url").show();break;case"openidConnect":$(".open_id_connect_auto_discovery_url input").attr("required","required"),$(".open_id_connect_auto_discovery_url").show()}r()}function r(){var e=$("#oauth2_provider").val();if($(".oauth2_use_custom_url_field").hide(),$(".oauth2_use_custom_url_field input[required]").removeAttr("required"),$("#oauth2_use_custom_url").is(":checked"))switch($("#oauth2_token_url").val()||$("#oauth2_token_url").val($("#".concat(e,"_token_url")).val()),$("#oauth2_auth_url").val()||$("#oauth2_auth_url").val($("#".concat(e,"_auth_url")).val()),$("#oauth2_profile_url").val()||$("#oauth2_profile_url").val($("#".concat(e,"_profile_url")).val()),$("#oauth2_email_url").val()||$("#oauth2_email_url").val($("#".concat(e,"_email_url")).val()),e){case"github":$(".oauth2_token_url input, .oauth2_auth_url input, .oauth2_profile_url input, .oauth2_email_url input").attr("required","required"),$(".oauth2_token_url, .oauth2_auth_url, .oauth2_profile_url, .oauth2_email_url").show();break;case"gitea":case"gitlab":$(".oauth2_token_url input, .oauth2_auth_url input, .oauth2_profile_url input").attr("required","required"),$(".oauth2_token_url, .oauth2_auth_url, .oauth2_profile_url").show(),$("#oauth2_email_url").val("")}}}(),_(),function(){var e=document.getElementById("app");if(!e)return;Vue.component("repo-search",{delimiters:["${","}"],props:{searchLimit:{type:Number,default:10},suburl:{type:String,required:!0},uid:{type:Number,required:!0},organizations:{type:Array,default:[]},isOrganization:{type:Boolean,default:!0},canCreateOrganization:{type:Boolean,default:!1},organizationsTotalCount:{type:Number,default:0},moreReposLink:{type:String,default:""}},data:function(){return{tab:"repos",repos:[],reposTotalCount:0,reposFilter:"all",searchQuery:"",isLoading:!1,repoTypes:{all:{count:0,searchMode:""},forks:{count:0,searchMode:"fork"},mirrors:{count:0,searchMode:"mirror"},sources:{count:0,searchMode:"source"},collaborative:{count:0,searchMode:"collaborative"}}}},computed:{showMoreReposLink:function(){return this.repos.length>0&&this.repos.length<this.repoTypes[this.reposFilter].count},searchURL:function(){return"".concat(this.suburl,"/api/v1/repos/search?sort=updated&order=desc&uid=").concat(this.uid,"&q=").concat(this.searchQuery,"&limit=").concat(this.searchLimit,"&mode=").concat(this.repoTypes[this.reposFilter].searchMode).concat("all"!==this.reposFilter?"&exclusive=1":"")},repoTypeCount:function(){return this.repoTypes[this.reposFilter].count}},mounted:function(){this.searchRepos(this.reposFilter);var e=this;Vue.nextTick((function(){e.$refs.search.focus()}))},methods:{changeTab:function(e){this.tab=e},changeReposFilter:function(e){this.reposFilter=e,this.repos=[],this.repoTypes[e].count=0,this.searchRepos(e)},showRepo:function(e,t){switch(t){case"sources":return e.owner.id===this.uid&&!e.mirror&&!e.fork;case"forks":return e.owner.id===this.uid&&!e.mirror&&e.fork;case"mirrors":return e.mirror;case"collaborative":return e.owner.id!==this.uid&&!e.mirror;default:return!0}},searchRepos:function(e){var t=this;this.isLoading=!0;var n=this.repoTypes[e].searchMode,i=this.searchURL,a=this.searchQuery;$.getJSON(i,(function(o,r,s){if(i===t.searchURL){t.repos=o.data;var c=s.getResponseHeader("X-Total-Count");""===a&&""===n&&(t.reposTotalCount=c),t.repoTypes[e].count=c}})).always((function(){i===t.searchURL&&(t.isLoading=!1)}))},repoClass:function(e){return e.fork?"octicon octicon-repo-forked":e.mirror?"octicon octicon-repo-clone":e.private?"octicon octicon-lock":"octicon octicon-repo"}}}),new Vue({delimiters:["${","}"],el:e,data:{searchLimit:document.querySelector("meta[name=_search_limit]").content,suburl:document.querySelector("meta[name=_suburl]").content,uid:document.querySelector("meta[name=_context_uid]").content}})}(),$(".organization.new.team input[name=permission]").change((function(){"admin"===$("input[name=permission]:checked",".organization.new.team").val()?$(".organization.new.team .team-units").hide():$(".organization.new.team .team-units").show()})),$(".js-quick-submit").keydown((function(e){!(e.ctrlKey&&!e.altKey||e.metaKey)||13!==e.keyCode&&10!==e.keyCode||$(this).closest("form").submit()})),f=$("#navbar"),g=$("#navbar-expand-toggle"),A=!1,g.click((function(){(A=!A)?(f.addClass("shown"),g.addClass("active")):(f.removeClass("shown"),g.removeClass("active"))})),D=$("#manage_topic"),O=$("#topic_edit"),E=$("#repo-topics"),F=$("#save_topic"),j=$("#topic_edit .dropdown"),M=$("#topic_edit.ui.form"),z=$("div.hide#validate_prompt"),P={countPrompt:z.children("#count_prompt").text(),formatPrompt:z.children("#format_prompt").text()},z.remove(),N=P,D.click((function(){E.hide(),O.css("display","")})),F.click((function(){var e=$("input[name=topics]").val();$.post(F.data("link"),{_csrf:s,topics:e},(function(t,n,i){if("ok"===i.responseJSON.status){if(E.children(".topic").remove(),e.length)for(var a=e.split(","),o=E.children("a").last(),r=0;r<a.length;r++)$('<div class="ui small label topic" style="cursor:pointer;">'.concat(a[r],"</div>")).insertBefore(o);O.css("display","none"),E.show()}})).fail((function(t){if(422===t.status)if(t.responseJSON.invalidTopics.length>0){N.formatPrompt=t.responseJSON.message;var n=t.responseJSON.invalidTopics,i=j.children("a.ui.label");e.split(",").forEach((function(e,t){for(var a=0;a<n.length;a++)n[a]===e&&i.eq(t).removeClass("green").addClass("red")}))}else N.countPrompt=t.responseJSON.message})).always((function(){M.form("validate form")}))})),j.dropdown({allowAdditions:!0,forceSelection:!1,fields:{name:"description",value:"data-value"},saveRemoteData:!1,label:{transition:"horizontal flip",duration:200,variation:!1,blue:!0,basic:!0},className:{label:"ui small label"},apiSettings:{url:"".concat(c,"/api/v1/topics/search?q={query}"),throttle:500,cache:!1,onResponse:function(e){var t={success:!1,results:[]},n=this.urlData.query.trim().replace(/<[^>]*>?/gm,""),i=!1,a=[];if(j.find("div.label.visible.topic,a.label.visible").each((function(e,t){a.push(t.dataset.value)})),e.topics){for(var o=!1,r=0;r<e.topics.length;r++)-1===a.indexOf(e.topics[r].topic_name)&&(e.topics[r].topic_name.toLowerCase()===n.toLowerCase()&&(i=!0),t.results.push({description:e.topics[r].topic_name,"data-value":e.topics[r].topic_name}),o=!0);t.success=o}return n.length>0&&!i?(t.success=!0,t.results.unshift({description:n,"data-value":n})):n.length>0&&i&&t.results.sort((function(e,t){return e.description.toLowerCase()===n.toLowerCase()?-1:t.description.toLowerCase()===n.toLowerCase()?1:e.description>t.description?-1:e.description<t.description?1:0})),t}},onLabelCreate:function(e){return e=e.toLowerCase().trim(),this.attr("data-value",e).contents().first().replaceWith(e),$(this)},onAdd:function(e,t,n){e=e.toLowerCase().trim(),$(n).attr("data-value",e),$(n).attr("data-text",e)}}),$.fn.form.settings.rules.validateTopic=function(e,t){var n=j.children("a.ui.label"),i=0===n.length||n.last().attr("data-value").match(t);return i||n.last().removeClass("green").addClass("red"),i&&0===j.children("a.ui.label.red").length},M.form({on:"change",inline:!0,fields:{topics:{identifier:"topics",rules:[{type:"validateTopic",value:/^[a-z0-9][a-z0-9-]{1,35}$/,prompt:N.formatPrompt},{type:"maxCount[25]",prompt:N.countPrompt}]}}}),0!==$("#wait-for-key").length&&u2fApi.ensureSupport().then((function(){$.getJSON("".concat(c,"/user/u2f/challenge")).success((function(e){u2fApi.sign(e.appId,e.challenge,e.registeredKeys,30).then(T).catch((function(e){L(void 0!==e?e.metaData.code:1)}))}))})).catch((function(){window.location.href="".concat(c,"/user/two_factor")})),$("#register-device").modal({allowMultiple:!1}),$("#u2f-error").modal({allowMultiple:!1}),$("#register-security-key").on("click",(function(e){e.preventDefault(),u2fApi.ensureSupport().then(q).catch((function(){L("browser")}))})),function(){var e=$("#repolink").val(),t=$("#repoId").val(),n=$("#crossRepoSearch").val(),i="".concat(c,"/api/v1/repos/").concat(e,"/issues?q={query}");"true"===n&&(i="".concat(c,"/api/v1/repos/issues/search?q={query}&priority_repo_id=").concat(t));$("#new-dependency-drop-list").dropdown({apiSettings:{url:i,onResponse:function(e){var t={success:!0,results:[]},n=$("#new-dependency-drop-list").data("issue-id");return $.each(e,(function(e,i){i.id!==n&&t.results.push({name:"#".concat(i.number," ").concat(h(i.title),'<div class="text small dont-break-out">').concat(h(i.repository.full_name),"</div>"),value:i.id})})),t},cache:!1},fullTextSearch:!0}),$(".menu a.label-filter-item").each((function(){$(this).click((function(e){if(e.altKey){e.preventDefault();var t=$(this).attr("href"),n=$(this).data("label-id"),i="labels=(-?[0-9]+%2c)*(".concat(n,")(%2c-?[0-9]+)*&");window.location=t.replace(new RegExp(i),"labels=$1-$2$3&")}}))})),$(".menu .ui.dropdown.label-filter").keydown((function(e){if(e.altKey&&13===e.keyCode){var t=$(".menu .ui.dropdown.label-filter .menu .item.selected");if(t.length>0){var n=$(t[0]),i=n.attr("href"),a=n.data("label-id"),o="labels=(-?[0-9]+%2c)*(".concat(a,")(%2c-?[0-9]+)*&");window.location=i.replace(new RegExp(o),"labels=$1-$2$3&")}}}))}(),$(".title_wip_desc > a").click((function(e){e.preventDefault();var t=$("#issue_title");t.focus();var n=t.val().trim().toUpperCase();for(var i in wipPrefixes)if(n.startsWith(wipPrefixes[i].toUpperCase()))return;t.val("".concat(wipPrefixes[0]," ").concat(t.val()))})),$(".show-outdated").on("click",(function(e){e.preventDefault();var t=$(this).data("comment");$(this).addClass("hide"),$("#code-comments-".concat(t)).removeClass("hide"),$("#code-preview-".concat(t)).removeClass("hide"),$("#hide-outdated-".concat(t)).removeClass("hide")})),$(".hide-outdated").on("click",(function(e){e.preventDefault();var t=$(this).data("comment");$(this).addClass("hide"),$("#code-comments-".concat(t)).addClass("hide"),$("#code-preview-".concat(t)).addClass("hide"),$("#show-outdated-".concat(t)).removeClass("hide")})),$("button.comment-form-reply").on("click",(function(e){e.preventDefault(),$(this).hide();var t=$(this).parent().find(".comment-form");t.removeClass("hide"),y(t.find(".menu"))})),0!==$(".repository.pull.diff").length&&($(".diff-detail-box.ui.sticky").sticky(),$(".btn-review").on("click",(function(e){e.preventDefault(),$(this).closest(".dropdown").find(".menu").toggle("visible")})).closest(".dropdown").find(".link.close").on("click",(function(e){e.preventDefault(),$(this).closest(".menu").toggle("visible")})),$(".code-view .lines-code,.code-view .lines-num").on("mouseenter",(function(){var e=$(this).closest("td");$(this).closest("tr").addClass(e.hasClass("lines-num-old")||e.hasClass("lines-code-old")?"focus-lines-old":"focus-lines-new")})).on("mouseleave",(function(){$(this).closest("tr").removeClass("focus-lines-new focus-lines-old")})),$(".add-code-comment").on("click",(function(e){if(!$(e.target).hasClass("btn-add-single")){e.preventDefault();var t=$(this).closest(".code-diff").hasClass("code-diff-split"),n=$(this).data("side"),i=$(this).data("idx"),a=$(this).data("path"),o=$("#pull_review_add_comment").html(),r=$(this).closest("tr"),s=r.next();s.hasClass("add-comment")||(s=$('<tr class="add-comment">'.concat(t?'<td class="lines-num"></td><td class="lines-type-marker"></td><td class="add-comment-left"></td><td class="lines-num"></td><td class="lines-type-marker"></td><td class="add-comment-right"></td>':'<td class="lines-num"></td><td class="lines-num"></td><td class="lines-type-marker"></td><td class="add-comment-left add-comment-right"></td>',"</tr>")),r.after(s));var c=s.find(".add-comment-".concat(n)),l=c.find(".comment-code-cloud");0===l.length&&(c.html(o),y((l=c.find(".comment-code-cloud")).find(".menu")),c.find("input[name='line']").val(i),c.find("input[name='side']").val("left"===n?"previous":"proposed"),c.find("input[name='path']").val(a)),l.find("textarea").focus()}}))),function e(){var t=$("#repo_migrating");if($("#repo_migrating_failed").hide(),t){var n=t.attr("repo");if(void 0===n)return;$.ajax({type:"GET",url:"".concat(c,"/").concat(n,"/status"),data:{_csrf:s},complete:function(t){if(200===t.status&&t.responseJSON)return 0===t.responseJSON.status?void window.location.reload():void setTimeout((function(){e()}),2e3);$("#repo_migrating_progress").hide(),$("#repo_migrating_failed").show()}})}}(),function(){var e=$("#repo_template"),t=function(){var t=$("#template_units"),n=$("#non_template");""!==e.val()?(t.show(),n.hide()):(t.hide(),n.show())};e.change(t),t();var n=function(){$("#repo_template_search").dropdown({apiSettings:{url:"".concat(c,"/api/v1/repos/search?q={query}&template=true&priority_owner_id=").concat($("#uid").val()),onResponse:function(e){var t={success:!0,results:[]};return t.results.push({name:"",value:""}),$.each(e.data,(function(e,n){t.results.push({name:h(n.full_name),value:n.id})})),t},cache:!1},fullTextSearch:!0})};$("#uid").change(n),n()}(),$("#repo-clone-url").length>0)switch(localStorage.getItem("repo-clone-protocol")){case"ssh":0===$("#repo-clone-ssh").click().length&&$("#repo-clone-https").click();break;default:$("#repo-clone-https").click()}var B,H={"div.user.settings":k,"div.repository.settings.collaboration":x};for(B in H)if($(B).length>0){H[B]();break}var U=$("#clone_addr");U.change((function(){var e=$("#repo_name");U.val().length>0&&0===e.val().length&&e.val(U.val().match(/^(.*\/)?((.+?)(\.git)?)$/)[3])}))})),$((function(){0===$(".user.signin").length&&$("form:not(.ignore-dirty)").areYouSure(),$("#ssh-key-content").on("change paste keyup",(function(){var e=$(this).val().split(" "),t=$("#ssh-key-title");""===t.val()&&3===e.length&&""!==e[2]&&t.val(e[2])}))})),window.timeAddManual=function(){$(".mini.modal").modal({duration:200,onApprove:function(){$("#add_time_manual_form").submit()}}).modal("show")},window.toggleStopwatch=function(){$("#toggle_stopwatch_form").submit()},window.cancelStopwatch=function(){$("#cancel_stopwatch_form").submit()},window.initHeatmap=function(e,t,n){var i=document.getElementById(e);if(i){(n=n||{}).contributions=n.contributions||"contributions",n.no_contributions=n.no_contributions||"No contributions";var a=["${","}"];Vue.component("activity-heatmap",{delimiters:a,props:{user:{type:String,required:!0},suburl:{type:String,required:!0},locale:{type:Object,required:!0}},data:function(){return{isLoading:!0,colorRange:[],endDate:null,values:[],totalContributions:0}},mounted:function(){this.colorRange=[this.getColor(0),this.getColor(1),this.getColor(2),this.getColor(3),this.getColor(4),this.getColor(5)],this.endDate=new Date,this.loadHeatmap(this.user)},methods:{loadHeatmap:function(e){var t=this;$.get("".concat(this.suburl,"/api/v1/users/").concat(e,"/heatmap"),(function(e){for(var n=[],i=0;i<e.length;i++)t.totalContributions+=e[i].contributions,n[i]={date:new Date(1e3*e[i].timestamp),count:e[i].contributions};t.values=n,t.isLoading=!1}))},getColor:function(e){var t=document.createElement("div");t.className="heatmap-color-".concat(e),document.body.appendChild(t);var n=getComputedStyle(t).backgroundColor;return document.body.removeChild(t),n}},template:'<div><div v-show="isLoading"><slot name="loading"></slot></div><h4 class="total-contributions" v-if="!isLoading"><span v-html="totalContributions"></span> total contributions in the last 12 months</h4><calendar-heatmap v-show="!isLoading" :locale="locale" :no-data-text="locale.no_contributions" :tooltip-unit="locale.contributions" :end-date="endDate" :values="values" :range-color="colorRange" />'}),new Vue({delimiters:a,el:i,data:{suburl:document.querySelector("meta[name=_suburl]").content,heatmapUser:t,locale:n}})}},$(".commit-button").click((function(e){e.preventDefault(),$(this).parent().find(".commit-body").toggle()})),window.toggleDeadlineForm=function(){$("#deadlineForm").fadeToggle(150)},window.setDeadline=function(){var e=$("#deadlineDate").val();window.updateDeadline(e)},window.updateDeadline=function(e){$("#deadline-err-invalid-date").hide(),$("#deadline-loader").addClass("loading");var t=null;if(""!==e){var n=Date.parse(e);if(Number.isNaN(n))return $("#deadline-loader").removeClass("loading"),$("#deadline-err-invalid-date").show(),!1;t=new Date(n)}$.ajax("".concat($("#update-issue-deadline-form").attr("action"),"/deadline"),{data:JSON.stringify({due_date:t}),headers:{"X-Csrf-Token":s,"X-Remote":!0},contentType:"application/json",type:"POST",success:function(){p()},error:function(){$("#deadline-loader").removeClass("loading"),$("#deadline-err-invalid-date").show()}})},window.deleteDependencyModal=function(e,t){$(".remove-dependency").modal({closable:!1,duration:200,onApprove:function(){$("#removeDependencyID").val(e),$("#dependencyType").val(t),$("#removeDependencyForm").submit()}}).modal("show")},window.cancelCodeComment=function(e){var t=$(e).closest("form");t.length>0&&t.hasClass("comment-form")?(t.addClass("hide"),t.parent().find("button.comment-form-reply").show()):t.closest(".comment-code-cloud").remove()},window.onOAuthLoginClick=function(){var e=$("#oauth2-login-loader"),t=$("#oauth2-login-navigator");t.hide(),e.removeClass("disabled"),setTimeout((function(){e.addClass("disabled"),t.show()}),5e3)}}]);
//# sourceMappingURL=index.js.map