]> source.dussan.org Git - gitea.git/commitdiff
fix bug when pack js (#8992)
authorLunny Xiao <xiaolunwen@gmail.com>
Thu, 14 Nov 2019 17:58:32 +0000 (01:58 +0800)
committerLauris BH <lauris@nix.lv>
Thu, 14 Nov 2019 17:58:32 +0000 (19:58 +0200)
public/js/index.js
public/js/index.js.map
templates/repo/issue/view_content/sidebar.tmpl
web_src/js/index.js

index 34b95ac0d932ba71aaded06d863ba14250f7476b..3d2f0fe7a008bc7694a4764bfb7d462fc3d68bb8 100644 (file)
@@ -1,2 +1,2 @@
-!function(e){var t={};function n(i){if(t[i])return t[i].exports;var o=t[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(i,o,function(t){return e[t]}.bind(null,o));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";function i(e){return jQuery("<div />").text(e).html()}let o,a,s,r,c;function l(e){const t=e.find(".tabular.menu");t.find(".item").tab(),t.find('.item[data-tab="'+t.data("preview")+'"]').click((function(){const n=$(this);$.post(n.data("url"),{_csrf:o,mode:"gfm",context:n.data("context"),text:e.find('.tab.segment[data-tab="'+t.data("write")+'"] textarea').val()},(function(n){const i=e.find('.tab.segment[data-tab="'+t.data("preview")+'"]');i.html(n),emojify.run(i[0]),$("pre code",i[0]).each((function(){hljs.highlightBlock(this)}))}))})),k()}function d(){0!=$(".edit.form").length&&(function(e){const t=e.find(".tabular.menu");t.find(".item").tab();const n=t.find('.item[data-tab="'+t.data("preview")+'"]');n.length&&(s=n.data("preview-file-modes").split(","),n.click((function(){const n=$(this);$.post(n.data("url"),{_csrf:o,mode:"gfm",context:n.data("context"),text:e.find('.tab.segment[data-tab="'+t.data("write")+'"] textarea').val()},(function(n){const i=e.find('.tab.segment[data-tab="'+t.data("preview")+'"]');i.html(n),emojify.run(i[0]),$("pre code",i[0]).each((function(){hljs.highlightBlock(this)}))}))})))}($(".edit.form")),function(e){const t=e.find(".tabular.menu");t.find(".item").tab(),t.find('.item[data-tab="'+t.data("diff")+'"]').click((function(){const n=$(this);$.post(n.data("url"),{_csrf:o,context:n.data("context"),content:e.find('.tab.segment[data-tab="'+t.data("write")+'"] textarea').val()},(function(n){const i=e.find('.tab.segment[data-tab="'+t.data("diff")+'"]');i.html(n),emojify.run(i[0])}))}))}($(".edit.form")))}function u(e,t,n,i){return new Promise((function(a){$.ajax({type:"POST",url:e,data:{_csrf:o,action:t,issue_ids:n,id:i},success:a})}))}function h(){window.location.reload()}function f(e){e.each((function(){const e=this;e.addEventListener("paste",(function(t){!function(e,t){if(!e.clipboardData)return;const n=e.clipboardData.items;if(void 0!==n)for(let i=0;i<n.length;i++){if(-1===n[i].type.indexOf("image"))continue;const o=n[i].getAsFile();"function"==typeof t&&(e.preventDefault(),e.stopPropagation(),t(o))}}(t,(function(t){const n=t.name.substr(0,t.name.lastIndexOf("."));!function(e,t){if(e.selectionStart||0===e.selectionStart){const 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,"!["+n+"]()"),function(e,t){const n=new XMLHttpRequest;n.onload=function(){200==n.status&&t(n.responseText)},n.open("post",a+"/attachments",!0),n.setRequestHeader("X-Csrf-Token",o);const i=new FormData;i.append("file",e,e.name),n.send(i)}(t,(function(t){const i=JSON.parse(t);!function(e,t,n){if(e.selectionStart||0===e.selectionStart){const i=e.selectionStart,o=e.selectionEnd;e.value=e.value.replace(t,n),e.selectionStart=i+n.length-t.length,e.selectionEnd=o+n.length-t.length}else e.value=e.value.replace(t,n)}(e,"!["+n+"]()","!["+n+"]("+a+"/attachments/"+i.uuid+")");const o=$('<input id="'+i.uuid+'" name="files" type="hidden">').val(i.uuid);$(".files").append(o)}))}))}),!1)}))}function p(){function e(e,t){const n=$(".ui."+t+".list"),i=n.find(".no-select"),o=$("."+e+" .menu");let a="update"==o.data("action");const s={};$("."+e).dropdown("setting","onHide",(function(){if(a="update"==o.data("action")){const e=[];Object.keys(s).forEach((function(t){const n=s[t],i=u(n["update-url"],n.action,n["issue-id"],t);e.push(i)})),Promise.all(e).then(h)}})),o.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")),u(o.data("update-url"),"",o.data("issue-id"),$(this).data("id")),o.data("action","update"),!1;$(this).hasClass("checked")?($(this).removeClass("checked"),$(this).find(".octicon").removeClass("octicon-check"),a&&($(this).data("id")in s?delete s[$(this).data("id")]:s[$(this).data("id")]={"update-url":o.data("update-url"),action:"detach","issue-id":o.data("issue-id")})):($(this).addClass("checked"),$(this).find(".octicon").addClass("octicon-check"),a&&($(this).data("id")in s?delete s[$(this).data("id")]:s[$(this).data("id")]={"update-url":o.data("update-url"),action:"attach","issue-id":o.data("issue-id")}));const 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})),o.find(".no-select.item").click((function(){(a||"select-assignees-modify"==e)&&u(o.data("update-url"),"clear",o.data("issue-id"),"").then(h),$(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 t(e,t){const n=$(e+" .menu"),o=$(".ui"+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&&u(n.data("update-url"),"",n.data("issue-id"),$(this).data("id")).then(h),t){case"#milestone_id":o.find(".selected").html('<a class="item" href='+$(this).data("href")+">"+i($(this).text())+"</a>");break;case"#assignee_id":o.find(".selected").html('<a class="item" href='+$(this).data("href")+'><img class="ui avatar image" src='+$(this).data("avatar")+">"+i($(this).text())+"</a>")}$(".ui"+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&&u(n.data("update-url"),"",n.data("issue-id"),$(this).data("id")).then(h),o.find(".selected").html(""),o.find(".no-select").removeClass("hide"),$(t).val("")}))}0!=$(".comment.form").length&&(!function(){const e=$(".ui.select-branch");e.find(".reference-list-menu").find(".item:not(.no-select)").click((function(){const 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}))}(),l($(".comment.form")),f($(".comment.form textarea")),e("select-label","labels"),e("select-assignees","assignees"),e("select-assignees-modify","assignees"),t(".select-milestone","#milestone_id"),t(".select-assignee","#assignee_id"))}function m(){if(0==$(".repository").length)return;function e(e){const 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")}})}if(($(".repository.file.list").length>0||".repository.commits".length>0)&&$(".choose.reference .dropdown").each((function(){const 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(){const 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(){const 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(){const 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){const 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(){const e=this;Vue.nextTick((function(){e.$refs.searchField.focus()}))},getSelected:function(){for(let e=0,t=this.items.length;e<t;++e)if(this.items[e].selected)return this.items[e];return null},getSelectedIndexInFiltered:function(){for(let e=0,t=this.filteredItems.length;e<t;++e)if(this.filteredItems[e].selected)return e;return-1},scrollToActive:function(){let e=this.$refs["listItem"+this.active];if(!e||0===e.length)return;Array.isArray(e)&&(e=e[0]);const 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){const 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&&e(".choose.page .dropdown"),$(".repository.settings.options").length>0&&($("#repo_name").keyup((function(){const 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){const 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(){const 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){const e=$(".milestone.datepicker");e.datetimepicker({lang:e.data("lang"),inline:!0,timepicker:!1,startDate:e.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){const e=$("#issue-title"),t=$("#edit-title-input input"),n=function(){return e.toggle(),$(".not-in-edit").toggle(),$("#edit-title-input").toggle(),$(".in-edit").toggle(),t.focus(),!1};$("#edit-title").click(n),$("#cancel-edit-title").click(n),$("#save-edit-title").click(n).click((function(){return 0==t.val().length||t.val()==e.text()?(t.val(e.text()),!1):($.post($(this).data("update-url"),{_csrf:o,title:t.val()},(function(n){t.val(n.title),e.text(n.title),h()})),!1)})),$(".edit-content").click((function(){const e=$(this).parent().parent().parent().next(),t=e.find(".edit-content-zone"),n=e.find(".render-content"),i=e.find(".raw-content");let a;if(0==t.html().length){t.html($("#edit-content-form").html()),a=t.find("textarea"),issuesTribute.attach(a.get()),emojiTribute.attach(a.get());const i=t.find(".dropzone");i.data("saved",!1);const s=t.find(".comment-files");if(i.length>0){const e={};i.dropzone({url:i.data("upload-url"),headers:{"X-Csrf-Token":o},maxFiles:i.data("max-file"),maxFilesize:i.data("max-size"),acceptedFiles:"*/*"===i.data("accepts")?null:i.data("accepts"),addRemoveLinks:!0,dictDefaultMessage:i.data("default-message"),dictInvalidFileType:i.data("invalid-input-type"),dictFileTooBig:i.data("file-too-big"),dictRemoveFile:i.data("remove-file"),init:function(){this.on("success",(function(t,n){e[t.name]={uuid:n.uuid,submitted:!1};const i=$('<input id="'+n.uuid+'" name="files" type="hidden">').val(n.uuid);s.append(i)})),this.on("removedfile",(function(t){t.name in e&&($("#"+e[t.name].uuid).remove(),i.data("remove-url")&&i.data("csrf")&&!e[t.name].submitted&&$.post(i.data("remove-url"),{file:e[t.name].uuid,_csrf:i.data("csrf")}))})),this.on("submit",(function(){$.each(e,(function(t){e[t].submitted=!0}))})),this.on("reload",(function(){$.getJSON(t.data("attachment-url"),(function(t){const n=i.get(0).dropzone;n.removeAllFiles(!0),s.empty(),$.each(t,(function(){const t=i.data("upload-url")+"/"+this.uuid;n.emit("addedfile",this),n.emit("thumbnail",this,t),n.emit("complete",this),n.files.push(this),e[this.name]={submitted:!0,uuid:this.uuid},i.find("img[src='"+t+"']").css("max-width","100%");const o=$('<input id="'+this.uuid+'" name="files" type="hidden">').val(this.uuid);s.append(o)}))}))}))}}),i.get(0).dropzone.emit("reload")}const r=t.find(".ui.comment.form"),c=r.find(".tabular.menu");c.attr("data-write",t.data("write")),c.attr("data-preview",t.data("preview")),c.find(".write.item").attr("data-tab",t.data("write")),c.find(".preview.item").attr("data-tab",t.data("preview")),r.find(".write.segment").attr("data-tab",t.data("write")),r.find(".preview.segment").attr("data-tab",t.data("preview")),l(r),t.find(".cancel.button").click((function(){n.show(),t.hide(),i.get(0).dropzone.emit("reload")})),t.find(".save.button").click((function(){n.show(),t.hide();const r=s.find("[name=files]").map((function(){return $(this).val()})).get();$.post(t.data("update-url"),{_csrf:o,content:a.val(),context:t.data("context"),files:r},(function(t){0==t.length?n.html($("#no-content").html()):(n.html(t.content),emojify.run(n[0]),$("pre code",n[0]).each((function(){hljs.highlightBlock(this)})));const o=e.parent();o.find(".ui.small.images").length?""==t.attachments?o.find(".ui.small.images").parent().remove():o.find(".ui.small.images").html(t.attachments):""!=t.attachments&&(o.append('<div class="ui bottom attached segment">    <div class="ui small images">    </div></div>'),o.find(".ui.small.images").html(t.attachments)),i.get(0).dropzone.emit("submit"),i.get(0).dropzone.emit("reload")}))}))}else a=e.find("textarea");return t.show(),n.hide(),0==a.val().length&&a.val(i.text()),a.focus(),!1})),$(".delete-comment").click((function(){const e=$(this);return confirm(e.data("locale"))&&$.post(e.data("url"),{_csrf:o}).success((function(){$("#"+e.data("comment-id")).remove()})),!1}));const i=$("#status-button");$("#comment-form .edit_area").keyup((function(){0==$(this).val().length?i.text(i.data("status")):i.text(i.data("status-and-comment"))})),i.click((function(){$("#status").val(i.data("status-val")),$("#comment-form").submit()}));const a=$(".merge-button > button");a.on("click",(function(e){e.preventDefault(),$("."+$(this).data("do")+"-fields").show(),$(this).parent().hide()})),$(".merge-button > .dropdown").dropdown({onChange:function(e,t,n){n.data("do")&&(a.find(".button-text").text(n.text()),a.data("do",n.data("do")))}}),$(".merge-cancel").on("click",(function(e){e.preventDefault(),$(this).closest(".form").hide(),a.parent().show()})),function e(t){let n="";t||(t=$(document),n=".reactions > "),t.find(n+"a.label").popup({position:"bottom left",metadata:{content:"title",title:"none"}}),t.find(".select-reaction > .menu > .item, "+n+"a.label").on("click",(function(t){const n=this;if(t.preventDefault(),$(this).hasClass("disabled"))return;const i=($(this).hasClass("item")?$(this).closest(".select-reaction").data("action-url"):$(this).data("action-url"))+"/"+($(this).hasClass("blue")?"unreact":"react");$.ajax({type:"POST",url:i,data:{_csrf:o,content:$(this).data("content")}}).done((function(t){if(t&&(t.html||t.empty)){const i=$(n).closest(".content");let o=i.find(".segment.reactions");if(!t.empty&&o.length>0&&o.remove(),!t.empty){o=$('<div class="ui attached segment reactions"></div>');const n=i.find(".segment.bottom:first");n.length>0?o.insertBefore(n):o.appendTo(i),o.html(t.html);const a=o.find(".has-emoji");for(let e=0;e<a.length;e++)emojify.run(a.get(e));o.find(".dropdown").dropdown(),e(o)}}}))}))}()}$(".repository.diff").length>0&&$(".diff-counter").each((function(){const 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",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()}));const t=$(".repository.compare.pull");t.length>0&&(e(".choose.branch .dropdown"),t.find("button.show-form").on("click",(function(e){e.preventDefault(),t.find(".pullrequest-form").show(),$(this).parent().hide()}))),$(".repository.settings.branches").length>0&&(e(".protected-branches .dropdown"),$(".enable-protection, .enable-whitelist").change((function(){this.checked?$($(this).data("target")).removeClass("disabled"):$($(this).data("target")).addClass("disabled")})))}function g(e){const 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(){const e=$(this).attr("data-tab")+t;$(this).attr("data-tab",e)})),e.parent().find("*[data-tab='write']").attr("data-tab","write"+t),e.parent().find("*[data-tab='preview']").attr("data-tab","preview"+t),l(e.parent(".form")),t}function v(){$(".access-mode.menu .item").click((function(){const e=$(this).parent();$.post(e.data("url"),{_csrf:o,uid:e.data("uid"),mode:$(this).data("value")})}))}function b(){$(".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"))}));const e=$("#file-name");e.keyup((function(e){const t=$(".breadcrumb span.section"),n=$(".breadcrumb div.divider");let i,o;if(8==e.keyCode&&0==$(this).getCursorPosition()&&t.length>0&&(i=t.last().find("a").text(),$(this).val(i+$(this).val()),$(this)[0].setSelectionRange(i.length,i.length),t.last().remove(),n.last().remove()),191==e.keyCode){o=$(this).val().split("/");for(let e=0;e<o.length;++e)i=o[e],e<o.length-1?i.length&&($('<span class="section"><a href="#">'+i+"</a></span>").insertBefore($(this)),$('<div class="divider"> / </div>').insertBefore($(this))):$(this).val(i),$(this)[0].setSelectionRange(0,0)}o=[],$(".breadcrumb span.section").each((function(){const e=$(this);e.find("a").length?o.push(e.find("a").text()):o.push(e.text())})),$(this).val()&&o.push($(this).val()),$("#tree_path").val(o.join("/"))})).trigger("keyup");const t=$(".repository.editor textarea#edit_area");if(!t.length)return;const n=t.data("markdown-file-exts").split(","),i=t.data("line-wrap-extensions").split(",");e.on("keyup",(function(){const a=e.val();let l,d,u,h,f,p;u=h="";const m=/.+\.([^.]+)$/.exec(a);m&&(h="."+(u=m[1]));const g=CodeMirror.findModeByExtension(u),v=$("a[data-tab=preview]");if(g?(l=g.mode,d=g.mime,p=l):p=u,v.length&&p&&s&&s.length&&s.indexOf(p)>=0?(f=v.data("url"),v.data("url",f.replace(/(.*)\/.*/i,"$1/"+l)),v.show()):v.hide(),n.indexOf(h)>=0&&function(e){return c&&(c.toTextArea(),c=null),!!r||(r=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:o,mode:"gfm",context:e.data("context"),text:t},(function(e){n.innerHTML='<div class="markdown ui segment">'+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))return;if(!c&&!function(e){return r&&(r.toTextArea(),r=null),!!c||((c=CodeMirror.fromTextArea(e[0],{lineNumbers:!0})).on("change",(function(t,n){e.val(t.getValue())})),!0)}(t))return;l&&(c.setOption("mode",d),CodeMirror.autoLoadMode(c,l)),i.indexOf(h)>=0?c.setOption("lineWrapping",!0):c.setOption("lineWrapping",!1);let 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?(c.setOption("indentWithTabs",!0),c.setOption("extraKeys",{})):(c.setOption("indentWithTabs",!1),c.setOption("extraKeys",{Tab:function(e){const t=Array(parseInt(e.getOption("indentUnit"))+1).join(" ");e.replaceSelection(t)}})),c.setOption("indentUnit",e.indent_size||4),c.setOption("tabSize",e.tab_width||4)})))})).trigger("keyup");const a=$("#commit-button"),l=$(".ui.edit.form");a.prop("disabled",!0),l.areYouSure({silent:!0,dirtyClass:"dirty-file",fieldSelector:":input:not(.commit-form-wrapper :input)",change:function(){const 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 w(){$(".user.settings.profile").length>0&&$("#username").keyup((function(){const e=$("#name-change-prompt");$(this).val().toString().toLowerCase()!=$(this).data("name").toString().toLowerCase()?e.show():e.hide()}))}function k(){$(".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){const t=$(this),n=t.parent().siblings(".lines-code").find("ol.linenums > li");T(n,n.filter("[rel="+t.attr("id")+"]"),e.shiftKey?n.filter(".active").eq(0):null),window.getSelection?window.getSelection().removeAllRanges():document.selection.empty()})),$(window).on("hashchange",(function(){let e=window.location.hash.match(/^#(L\d+)-(L\d+)$/);const t=$(".code-view ol.linenums > li");let n;if(e)return n=t.filter("."+e[1]),T(t,n,t.filter("."+e[2])),void $("html, body").scrollTop(n.offset().top-200);(e=window.location.hash.match(/^#(L|n)(\d+)$/))&&(n=t.filter(".L"+e[2]),T(t,n),$("html, body").scrollTop(n.offset().top-200))})).trigger("hashchange"))}function y(e){$.ajax({url:a+"/user/u2f/sign",type:"POST",headers:{"X-Csrf-Token":o},data:JSON.stringify(e),contentType:"application/json; charset=utf-8"}).done((function(e){window.location.replace(e)})).fail((function(){x(1)}))}function C(e){(function(e){if(!("errorCode"in e))return!1;if(0===e.errorCode)return!1;return x(e.errorCode),!0})(e)||$.ajax({url:a+"/user/settings/security/u2f/register",type:"POST",headers:{"X-Csrf-Token":o},data:JSON.stringify(e),contentType:"application/json; charset=utf-8",success:function(){h()},fail:function(){x(1)}})}function x(e){const 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");for(const n in t)n!=e&&t[n].addClass("hide");$("#u2f-error").modal("show")}function S(){$.post(a+"/user/settings/security/u2f/request_register",{_csrf:o,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(C).catch((function(e){x(void 0!==e?e.metaData.code:1)}))})).fail((function(e){409===e.status&&$("#nickname").closest("div.field").addClass("error")}))}function q(e){history.pushState?history.pushState(null,null,e):location.hash=e}function T(e,t,n){if(e.removeClass("active"),n){let i,o=parseInt(t.attr("rel").substr(1)),a=parseInt(n.attr("rel").substr(1));if(o!=a){o>a&&(i=o,o=a,a=i);const t=[];for(let e=o;e<=a;e++)t.push(".L"+e);return e.filter(t.join(",")).addClass("active"),void q("#L"+o+"-L"+a)}}t.addClass("active"),q("#"+t.attr("rel"))}function L(){const e=$(this);let t="";e.attr("id")&&(t+="#"+e.attr("id"));const n=$(".delete.modal"+t);return n.find(".name").text(e.data("name")),n.modal({closable:!1,onApprove:function(){"form"!=e.data("type")?$.post(e.data("url"),{_csrf:o,id:e.data("id")}).done((function(e){window.location.href=e.redirect})):$(e.data("form")).submit()}}).modal("show"),!1}function O(){const e=$(this);let t="";e.attr("id")&&(t+="#"+e.attr("id"));const n=$(".addall.modal"+t);return n.find(".name").text(e.data("name")),n.modal({closable:!1,onApprove:function(){"form"!=e.data("type")?$.post(e.data("url"),{_csrf:o,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),Array.from||(Array.from=function(){const e=Object.prototype.toString,t=function(t){return"function"==typeof t||"[object Function]"===e.call(t)},n=Math.pow(2,53)-1,i=function(e){const t=function(e){const t=Number(e);return isNaN(t)?0:0!==t&&isFinite(t)?(t>0?1:-1)*Math.floor(Math.abs(t)):t}(e);return Math.min(Math.max(t,0),n)};return function(e){const n=this,o=Object(e);if(null==e)throw new TypeError("Array.from requires an array-like object - not null or undefined");const a=arguments.length>1?arguments[1]:void 0;let s;if(void 0!==a){if(!t(a))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(s=arguments[2])}const r=i(o.length),c=t(n)?Object(new n(r)):new Array(r);let l,d=0;for(;d<r;)l=o[d],c[d]=a?void 0===s?a(l,d):a.call(s,l,d):l,d+=1;return c.length=r,c}}()),"function"!=typeof Object.assign&&Object.defineProperty(Object,"assign",{value:function(e,t){if(null==e)throw new TypeError("Cannot convert undefined or null to object");const n=Object(e);for(let e=1;e<arguments.length;e++){const t=arguments[e];if(null!=t)for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e])}return n},writable:!0,configurable:!0}),String.prototype.endsWith=function(e){const t=this.length-e.length;return t>=0&&this.lastIndexOf(e)===t},$.fn.getCursorPosition=function(){const e=$(this).get(0);let t=0;if("selectionStart"in e)t=e.selectionStart;else if("selection"in document){e.focus();const 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(o=$("meta[name=_csrf]").attr("content"),a=$("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){const e=[].slice.call(document.querySelectorAll("pre code")||[]);for(let t=0;t<e.length;t++)hljs.highlightBlock(e[t])}const e=$("#dropzone");if(e.length>0){const t={};new Dropzone("#dropzone",{url:e.data("upload-url"),headers:{"X-Csrf-Token":o},maxFiles:e.data("max-file"),maxFilesize:e.data("max-size"),acceptedFiles:"*/*"===e.data("accepts")?null:e.data("accepts"),addRemoveLinks:!0,dictDefaultMessage:e.data("default-message"),dictInvalidFileType:e.data("invalid-input-type"),dictFileTooBig:e.data("file-too-big"),dictRemoveFile:e.data("remove-file"),init:function(){this.on("success",(function(e,n){t[e.name]=n.uuid;const i=$('<input id="'+n.uuid+'" name="files" type="hidden">').val(n.uuid);$(".files").append(i)})),this.on("removedfile",(function(n){n.name in t&&$("#"+t[n.name]).remove(),e.data("remove-url")&&e.data("csrf")&&$.post(e.data("remove-url"),{file:t[n.name],_csrf:e.data("csrf")})}))}})}emojify.setConfig({img_dir:a+"/vendor/plugins/emojify/images",ignore_emoticons:!0});const t=document.getElementsByClassName("has-emoji");for(let e=0;e<t.length;e++){emojify.run(t[e]);for(let n=0;n<t[e].childNodes.length;n++)"A"===t[e].childNodes[n].nodeName&&emojify.run(t[e].childNodes[n])}const n=new Clipboard(".clipboard");if(n.on("success",(function(e){e.clearSelection(),$("#"+e.trigger.getAttribute("id")).popup("destroy"),e.trigger.setAttribute("data-content",e.trigger.getAttribute("data-success")),$("#"+e.trigger.getAttribute("id")).popup("show"),e.trigger.setAttribute("data-content",e.trigger.getAttribute("data-original"))})),n.on("error",(function(e){$("#"+e.trigger.getAttribute("id")).popup("destroy"),e.trigger.setAttribute("data-content",e.trigger.getAttribute("data-error")),$("#"+e.trigger.getAttribute("id")).popup("show"),e.trigger.setAttribute("data-content",e.trigger.getAttribute("data-original"))})),$(".delete-button").click(L),$(".add-all-button").click(O),$(".delete-branch-button").click(L),$(".undo-button").click((function(){const e=$(this);$.post(e.data("url"),{_csrf:o,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(){const e=$(this);$.post(e.data("request-url"),{_csrf:o}).done((function(){window.location.href=e.data("done-url")}))})),$(".markdown").each((function(){const e={};$(this).find("h1, h2, h3, h4, h5, h6").each((function(){let t=$(this);const n=encodeURIComponent(t.text().toLowerCase().replace(/[^\u00C0-\u1FFF\u2C00-\uD7FF\w\- ]/g,"").replace(/[ ]/g,"-"));let i=n;e[n]>0&&(i=n+"-"+e[n]),null==e[n]?e[n]=1:e[n]+=1,(t=t.wrap('<div id="'+i+'" class="anchor-wrap" ></div>')).append('<a class="anchor" href="#'+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(){let e=this.dataset.action,t=this.dataset.elementId;const 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"),u(i,e,n,t).then((function(){"close"!==e&&"open"!==e||$('.issue-checkbox input[type="checkbox"]').each((function(e,t){t.checked=!1})),h()}))})),$('.issue-checkbox input[type="checkbox"]:checked').first().each((function(e,t){t.checked=!1,$(t).click()})),k(),$("#search-user-box").search({minCharacters:2,apiSettings:{url:a+"/api/v1/users/search?q={query}",onResponse:function(e){const t=[];return $.each(e.data,(function(e,n){let o=n.login;n.full_name&&n.full_name.length>0&&(o+=" ("+i(n.full_name)+")"),t.push({title:o,image:n.avatar_url})})),{results:t}}},searchFields:["login","full_name"],showNoResults:!1}),function(){const e=$("#search-team-box");e.search({minCharacters:2,apiSettings:{url:a+"/api/v1/orgs/"+e.data("org")+"/teams/search?q={query}",headers:{"X-Csrf-Token":o},onResponse:function(e){const t=[];return $.each(e.data,(function(e,n){const i=n.name+" ("+n.permission+" access)";t.push({title:i})})),{results:t}}},searchFields:["name","description"],showNoResults:!1})}(),function(){const e=$("#search-repo-box");e.search({minCharacters:2,apiSettings:{url:a+"/api/v1/repos/search?q={query}&uid="+e.data("uid"),onResponse:function(e){const 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})}(),p(),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(){const 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"));const 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")}))),m(),function(){const e=function(){const e=$("#auth_username").val(),t=$("#clone_addr").val();!$("#mirror").is(":checked")&&null!=e&&e.length>0&&null!=t&&(t.startsWith("https://github.com")||t.startsWith("http://github.com"))?$("#migrate_items").show():$("#migrate_items").hide()};e(),$("#clone_addr").on("input",e),$("#auth_username").on("input",e),$("#mirror").on("change",e)}(),function(){const e=$(".repository.wiki textarea#edit_area");if(e.length>0){const t=new SimpleMDE({autoDownloadFontAwesome:!1,element:e[0],forceSync:!0,previewRender:function(t,n){return setTimeout((function(){$.post(e.data("url"),{_csrf:o,mode:"gfm",context:e.data("context"),text:t},(function(e){n.innerHTML='<div class="markdown ui segment">'+e+"</div>",emojify.run($(".editor-preview")[0])}))}),0),"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){const t=e.codemirror,n=t.getSelection();if(t.replaceSelection("`"+n+"`"),!n){const e=t.getCursor();t.setCursor(e.line,e.ch-1)}t.focus()},className:"fa fa-angle-right",title:"Add Inline Code"},"code","quote","|",{name:"checkbox-empty",action:function(e){const t=e.codemirror;t.replaceSelection("\n- [ ] "+t.getSelection()),t.focus()},className:"fa fa-square-o",title:"Add Checkbox (empty)"},{name:"checkbox-checked",action:function(e){const t=e.codemirror;t.replaceSelection("\n- [x] "+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"]});$(t.codemirror.getInputField()).addClass("js-quick-submit")}}(),d(),b(),0!=$(".organization").length&&$(".organization.settings.options").length>0&&$("#org_name").keyup((function(){const e=$("#org-name-change-prompt");$(this).val().toString().toLowerCase()!=$(this).data("org-name").toString().toLowerCase()?e.show():e.hide()})),function(){if(0==$(".new.webhook").length)return;$(".events.checkbox input").change((function(){$(this).is(":checked")&&$(".events.fields").show()})),$(".non-events.checkbox input").change((function(){$(this).is(":checked")&&$(".events.fields").hide()}));const e=function(){const e="POST"===$("#http_method").val();$("#content_type").parent().parent()[e?"show":"hide"]()};e(),$("#http_method").change((function(){e()})),$("#test-delivery").click((function(){const e=$(this);e.addClass("loading disabled"),$.post(e.data("link"),{_csrf:o}).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").hide(),$(".ldap input[required], .binddnrequired input[required], .dldap input[required], .smtp input[required], .pam input[required], .oauth2 input[required], .has-tls input[required]").removeAttr("required"),$(".binddnrequired").removeClass("required");const i=$(this).val();switch(i){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"),n()}"2"!=i&&"5"!=i||e(),"2"==i&&t()})),$("#auth_type").change(),$("#security_protocol").change(e),$("#use_paged_search").change(t),$("#oauth2_provider").change(n),$("#oauth2_use_custom_url").change(i)),$(".admin.edit.authentication").length>0){const o=$("#auth_type").val();"2"==o||"5"==o?($("#security_protocol").change(e),"2"==o&&$("#use_paged_search").change(t)):"6"==o&&($("#oauth2_provider").change(n),$("#oauth2_use_custom_url").change(i),n())}if($(".admin.notice")){const e=$("#detail-modal");$(".view-detail").click((function(){return e.find(".content p").text($(this).data("content")),e.modal("show"),!1}));const t=$(".select.table .ui.checkbox");$(".select.action").click((function(){switch($(this).data("action")){case"select-all":t.checkbox("check");break;case"deselect-all":t.checkbox("uncheck");break;case"inverse":t.checkbox("toggle")}})),$("#delete-selection").click((function(){const e=$(this);e.addClass("loading disabled");const n=[];t.each((function(){$(this).checkbox("is checked")&&n.push($(this).data("id"))})),$.post(e.data("link"),{_csrf:o,ids:n}).done((function(){window.location.href=e.data("redirect")}))}))}}function e(){$("#security_protocol").val()>0?$(".has-tls").show():$(".has-tls").hide()}function t(){$("#use_paged_search").prop("checked")?$(".search-page-size").show().find("input").attr("required","required"):$(".search-page-size").hide().find("input").removeAttr("required")}function n(){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()}i()}function i(){const 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($("#"+e+"_token_url").val()),$("#oauth2_auth_url").val()||$("#oauth2_auth_url").val($("#"+e+"_auth_url").val()),$("#oauth2_profile_url").val()||$("#oauth2_profile_url").val($("#"+e+"_profile_url").val()),$("#oauth2_email_url").val()||$("#oauth2_email_url").val($("#"+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(){const 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 this.suburl+"/api/v1/repos/search?sort=updated&order=desc&uid="+this.uid+"&q="+this.searchQuery+"&limit="+this.searchLimit+"&mode="+this.repoTypes[this.reposFilter].searchMode+("all"!==this.reposFilter?"&exclusive=1":"")},repoTypeCount:function(){return this.repoTypes[this.reposFilter].count}},mounted:function(){this.searchRepos(this.reposFilter);const 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){const t=this;this.isLoading=!0;const n=this.repoTypes[e].searchMode,i=this.searchURL,o=this.searchQuery;$.getJSON(i,(function(a,s,r){if(i==t.searchURL){t.repos=a.data;const i=r.getResponseHeader("X-Total-Count");""===o&&""===n&&(t.reposTotalCount=i),t.repoTypes[e].count=i}})).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()})),function(){const e=$("#navbar"),t=$("#navbar-expand-toggle");let n=!1;t.click((function(){(n=!n)?(e.addClass("shown"),t.addClass("active")):(e.removeClass("shown"),t.removeClass("active"))}))}(),function(){const e=$("#manage_topic"),t=$("#topic_edit"),n=$("#repo-topics"),i=$("#save_topic"),s=$("#topic_edit .dropdown"),r=$("#topic_edit.ui.form"),c=function(){const e=$("div.hide#validate_prompt"),t={countPrompt:e.children("#count_prompt").text(),formatPrompt:e.children("#format_prompt").text()};return e.remove(),t}();e.click((function(){n.hide(),t.css("display","")})),i.click((function(){const e=$("input[name=topics]").val();$.post(i.data("link"),{_csrf:o,topics:e},(function(i,o,a){if("ok"===a.responseJSON.status){if(n.children(".topic").remove(),e.length){const t=e.split(","),i=n.children("a").last();for(let e=0;e<t.length;e++)$('<div class="ui small label topic" style="cursor:pointer;">'+t[e]+"</div>").insertBefore(i)}t.css("display","none"),n.show()}})).fail((function(t){if(422===t.status)if(t.responseJSON.invalidTopics.length>0){c.formatPrompt=t.responseJSON.message;const n=t.responseJSON.invalidTopics,i=s.children("a.ui.label");e.split(",").forEach((function(e,t){for(let o=0;o<n.length;o++)n[o]===e&&i.eq(t).removeClass("green").addClass("red")}))}else c.countPrompt=t.responseJSON.message})).always((function(){r.form("validate form")}))})),s.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:a+"/api/v1/topics/search?q={query}",throttle:500,cache:!1,onResponse:function(e){const t={success:!1,results:[]},n=this.urlData.query.trim().replace(/<[^>]*>?/gm,"");let i=!1;const o=[];if(s.find("div.label.visible.topic,a.label.visible").each((function(e,t){o.push(t.dataset.value)})),e.topics){let a=!1;for(let s=0;s<e.topics.length;s++)-1==o.indexOf(e.topics[s].topic_name)&&(e.topics[s].topic_name.toLowerCase()===n.toLowerCase()&&(i=!0),t.results.push({description:e.topics[s].topic_name,"data-value":e.topics[s].topic_name}),a=!0);t.success=a}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){const n=s.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===s.children("a.ui.label.red").length},r.form({on:"change",inline:!0,fields:{topics:{identifier:"topics",rules:[{type:"validateTopic",value:/^[a-z0-9][a-z0-9-]{1,35}$/,prompt:c.formatPrompt},{type:"maxCount[25]",prompt:c.countPrompt}]}}})}(),0!==$("#wait-for-key").length&&u2fApi.ensureSupport().then((function(){$.getJSON(a+"/user/u2f/challenge").success((function(e){u2fApi.sign(e.appId,e.challenge,e.registeredKeys,30).then(y).catch((function(e){x(void 0!==e?e.metaData.code:1)}))}))})).catch((function(){window.location.href=a+"/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(S).catch((function(){x("browser")}))})),function(){const e=$("#repolink").val(),t=$("#repoId").val(),n=$("#crossRepoSearch").val();let o=a+"/api/v1/repos/"+e+"/issues?q={query}";"true"===n&&(o=a+"/api/v1/repos/issues/search?q={query}&priority_repo_id="+t);$("#new-dependency-drop-list").dropdown({apiSettings:{url:o,onResponse:function(e){const t={success:!0,results:[]},n=$("#new-dependency-drop-list").data("issue-id");return $.each(e,(function(e,o){o.id!==n&&t.results.push({name:"#"+o.number+" "+i(o.title)+'<div class="text small dont-break-out">'+i(o.repository.full_name)+"</div>",value:o.id})})),t},cache:!1},fullTextSearch:!0}),$(".menu a.label-filter-item").each((function(){$(this).click((function(e){if(e.altKey){e.preventDefault();const t=$(this).attr("href"),n="labels=(-?[0-9]+%2c)*("+$(this).data("label-id")+")(%2c-?[0-9]+)*&",i="labels=$1-$2$3&";window.location=t.replace(new RegExp(n),i)}}))})),$(".menu .ui.dropdown.label-filter").keydown((function(e){if(e.altKey&&13==e.keyCode){const e=$(".menu .ui.dropdown.label-filter .menu .item.selected");if(e.length>0){const t=$(e[0]),n=t.attr("href"),i="labels=(-?[0-9]+%2c)*("+t.data("label-id")+")(%2c-?[0-9]+)*&",o="labels=$1-$2$3&";window.location=n.replace(new RegExp(i),o)}}}))}(),$(".title_wip_desc > a").click((function(e){e.preventDefault();const t=$("#issue_title");t.focus();const n=t.val().trim().toUpperCase();for(const e in wipPrefixes)if(n.startsWith(wipPrefixes[e].toUpperCase()))return;t.val(wipPrefixes[0]+" "+t.val())})),$(".show-outdated").on("click",(function(e){e.preventDefault();const t=$(this).data("comment");$(this).addClass("hide"),$("#code-comments-"+t).removeClass("hide"),$("#code-preview-"+t).removeClass("hide"),$("#hide-outdated-"+t).removeClass("hide")})),$(".hide-outdated").on("click",(function(e){e.preventDefault();const t=$(this).data("comment");$(this).addClass("hide"),$("#code-comments-"+t).addClass("hide"),$("#code-preview-"+t).addClass("hide"),$("#show-outdated-"+t).removeClass("hide")})),$("button.comment-form-reply").on("click",(function(e){e.preventDefault(),$(this).hide();const t=$(this).parent().find(".comment-form");t.removeClass("hide"),g(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(){const 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"))return;e.preventDefault();const t=$(this).closest(".code-diff").hasClass("code-diff-split"),n=$(this).data("side"),i=$(this).data("idx"),o=$(this).data("path"),a=$("#pull_review_add_comment").html(),s=$(this).closest("tr");let r=s.next();r.hasClass("add-comment")||(r=$('<tr class="add-comment">'+(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>"),s.after(r));const c=r.find(".add-comment-"+n);let l=c.find(".comment-code-cloud");0===l.length&&(c.html(a),g((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(o)),l.find("textarea").focus()}))),function e(){const t=$("#repo_migrating");if($("#repo_migrating_failed").hide(),t){const n=t.attr("repo");if(void 0===n)return;$.ajax({type:"GET",url:a+"/"+n+"/status",data:{_csrf:o},complete:function(t){if(200==t.status&&t.responseJSON)return 0==t.responseJSON.status?void location.reload():void setTimeout((function(){e()}),2e3);$("#repo_migrating_progress").hide(),$("#repo_migrating_failed").show()}})}}(),function(){const e=$("#repo_template"),t=function(){const t=$("#template_units"),n=$("#non_template");""!==e.val()?(t.show(),n.hide()):(t.hide(),n.show())};e.change(t),t();const n=function(){$("#repo_template_search").dropdown({apiSettings:{url:a+"/api/v1/repos/search?q={query}&template=true&priority_owner_id="+$("#uid").val(),onResponse:function(e){const t={success:!0,results:[]};return t.results.push({name:"",value:""}),$.each(e.data,(function(e,n){t.results.push({name:i(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()}const s={"div.user.settings":w,"div.repository.settings.collaboration":v};let r;for(r in s)if($(r).length>0){s[r]();break}const c=$("#clone_addr");c.change((function(){const e=$("#repo_name");c.val().length>0&&0===e.val().length&&e.val(c.val().match(/^(.*\/)?((.+?)(\.git)?)$/)[3])}))})),$((function(){0===$(".user.signin").length&&$("form:not(.ignore-dirty)").areYouSure(),$("#ssh-key-content").on("change paste keyup",(function(){const 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){const i=document.getElementById(e);if(!i)return;(n=n||{}).contributions=n.contributions||"contributions",n.no_contributions=n.no_contributions||"No contributions";const o=["${","}"];Vue.component("activity-heatmap",{delimiters:o,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){const t=this;$.get(this.suburl+"/api/v1/users/"+e+"/heatmap",(function(e){const n=[];for(let 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){const t=document.createElement("div");t.className="heatmap-color-"+e,document.body.appendChild(t);const 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:o,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(){!function(e){$("#deadline-err-invalid-date").hide(),$("#deadline-loader").addClass("loading");let t=null;if(""!==e){const n=Date.parse(e);if(isNaN(n))return $("#deadline-loader").removeClass("loading"),$("#deadline-err-invalid-date").show(),!1;t=new Date(n)}$.ajax($("#update-issue-deadline-form").attr("action")+"/deadline",{data:JSON.stringify({due_date:t}),headers:{"X-Csrf-Token":o,"X-Remote":!0},contentType:"application/json",type:"POST",success:function(){h()},error:function(){$("#deadline-loader").removeClass("loading"),$("#deadline-err-invalid-date").show()}})}($("#deadlineDate").val())},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){const 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(){const e=$("#oauth2-login-loader"),t=$("#oauth2-login-navigator");t.hide(),e.removeClass("disabled"),setTimeout((function(){e.addClass("disabled"),t.show()}),5e3)}}]);
+!function(e){var t={};function n(i){if(t[i])return t[i].exports;var o=t[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(i,o,function(t){return e[t]}.bind(null,o));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";function i(e){return jQuery("<div />").text(e).html()}let o,a,s,r,c;function l(e){const t=e.find(".tabular.menu");t.find(".item").tab(),t.find('.item[data-tab="'+t.data("preview")+'"]').click((function(){const n=$(this);$.post(n.data("url"),{_csrf:o,mode:"gfm",context:n.data("context"),text:e.find('.tab.segment[data-tab="'+t.data("write")+'"] textarea').val()},(function(n){const i=e.find('.tab.segment[data-tab="'+t.data("preview")+'"]');i.html(n),emojify.run(i[0]),$("pre code",i[0]).each((function(){hljs.highlightBlock(this)}))}))})),k()}function d(){0!=$(".edit.form").length&&(function(e){const t=e.find(".tabular.menu");t.find(".item").tab();const n=t.find('.item[data-tab="'+t.data("preview")+'"]');n.length&&(s=n.data("preview-file-modes").split(","),n.click((function(){const n=$(this);$.post(n.data("url"),{_csrf:o,mode:"gfm",context:n.data("context"),text:e.find('.tab.segment[data-tab="'+t.data("write")+'"] textarea').val()},(function(n){const i=e.find('.tab.segment[data-tab="'+t.data("preview")+'"]');i.html(n),emojify.run(i[0]),$("pre code",i[0]).each((function(){hljs.highlightBlock(this)}))}))})))}($(".edit.form")),function(e){const t=e.find(".tabular.menu");t.find(".item").tab(),t.find('.item[data-tab="'+t.data("diff")+'"]').click((function(){const n=$(this);$.post(n.data("url"),{_csrf:o,context:n.data("context"),content:e.find('.tab.segment[data-tab="'+t.data("write")+'"] textarea').val()},(function(n){const i=e.find('.tab.segment[data-tab="'+t.data("diff")+'"]');i.html(n),emojify.run(i[0])}))}))}($(".edit.form")))}function u(e,t,n,i){return new Promise((function(a){$.ajax({type:"POST",url:e,data:{_csrf:o,action:t,issue_ids:n,id:i},success:a})}))}function h(){window.location.reload()}function f(e){e.each((function(){const e=this;e.addEventListener("paste",(function(t){!function(e,t){if(!e.clipboardData)return;const n=e.clipboardData.items;if(void 0!==n)for(let i=0;i<n.length;i++){if(-1===n[i].type.indexOf("image"))continue;const o=n[i].getAsFile();"function"==typeof t&&(e.preventDefault(),e.stopPropagation(),t(o))}}(t,(function(t){const n=t.name.substr(0,t.name.lastIndexOf("."));!function(e,t){if(e.selectionStart||0===e.selectionStart){const 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,"!["+n+"]()"),function(e,t){const n=new XMLHttpRequest;n.onload=function(){200==n.status&&t(n.responseText)},n.open("post",a+"/attachments",!0),n.setRequestHeader("X-Csrf-Token",o);const i=new FormData;i.append("file",e,e.name),n.send(i)}(t,(function(t){const i=JSON.parse(t);!function(e,t,n){if(e.selectionStart||0===e.selectionStart){const i=e.selectionStart,o=e.selectionEnd;e.value=e.value.replace(t,n),e.selectionStart=i+n.length-t.length,e.selectionEnd=o+n.length-t.length}else e.value=e.value.replace(t,n)}(e,"!["+n+"]()","!["+n+"]("+a+"/attachments/"+i.uuid+")");const o=$('<input id="'+i.uuid+'" name="files" type="hidden">').val(i.uuid);$(".files").append(o)}))}))}),!1)}))}function p(){function e(e,t){const n=$(".ui."+t+".list"),i=n.find(".no-select"),o=$("."+e+" .menu");let a="update"==o.data("action");const s={};$("."+e).dropdown("setting","onHide",(function(){if(a="update"==o.data("action")){const e=[];Object.keys(s).forEach((function(t){const n=s[t],i=u(n["update-url"],n.action,n["issue-id"],t);e.push(i)})),Promise.all(e).then(h)}})),o.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")),u(o.data("update-url"),"",o.data("issue-id"),$(this).data("id")),o.data("action","update"),!1;$(this).hasClass("checked")?($(this).removeClass("checked"),$(this).find(".octicon").removeClass("octicon-check"),a&&($(this).data("id")in s?delete s[$(this).data("id")]:s[$(this).data("id")]={"update-url":o.data("update-url"),action:"detach","issue-id":o.data("issue-id")})):($(this).addClass("checked"),$(this).find(".octicon").addClass("octicon-check"),a&&($(this).data("id")in s?delete s[$(this).data("id")]:s[$(this).data("id")]={"update-url":o.data("update-url"),action:"attach","issue-id":o.data("issue-id")}));const 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})),o.find(".no-select.item").click((function(){(a||"select-assignees-modify"==e)&&u(o.data("update-url"),"clear",o.data("issue-id"),"").then(h),$(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 t(e,t){const n=$(e+" .menu"),o=$(".ui"+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&&u(n.data("update-url"),"",n.data("issue-id"),$(this).data("id")).then(h),t){case"#milestone_id":o.find(".selected").html('<a class="item" href='+$(this).data("href")+">"+i($(this).text())+"</a>");break;case"#assignee_id":o.find(".selected").html('<a class="item" href='+$(this).data("href")+'><img class="ui avatar image" src='+$(this).data("avatar")+">"+i($(this).text())+"</a>")}$(".ui"+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&&u(n.data("update-url"),"",n.data("issue-id"),$(this).data("id")).then(h),o.find(".selected").html(""),o.find(".no-select").removeClass("hide"),$(t).val("")}))}0!=$(".comment.form").length&&(!function(){const e=$(".ui.select-branch");e.find(".reference-list-menu").find(".item:not(.no-select)").click((function(){const 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}))}(),l($(".comment.form")),f($(".comment.form textarea")),e("select-label","labels"),e("select-assignees","assignees"),e("select-assignees-modify","assignees"),t(".select-milestone","#milestone_id"),t(".select-assignee","#assignee_id"))}function m(){if(0==$(".repository").length)return;function e(e){const 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")}})}if(($(".repository.file.list").length>0||".repository.commits".length>0)&&$(".choose.reference .dropdown").each((function(){const 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(){const 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(){const 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(){const 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){const 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(){const e=this;Vue.nextTick((function(){e.$refs.searchField.focus()}))},getSelected:function(){for(let e=0,t=this.items.length;e<t;++e)if(this.items[e].selected)return this.items[e];return null},getSelectedIndexInFiltered:function(){for(let e=0,t=this.filteredItems.length;e<t;++e)if(this.filteredItems[e].selected)return e;return-1},scrollToActive:function(){let e=this.$refs["listItem"+this.active];if(!e||0===e.length)return;Array.isArray(e)&&(e=e[0]);const 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){const 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&&e(".choose.page .dropdown"),$(".repository.settings.options").length>0&&($("#repo_name").keyup((function(){const 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){const 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(){const 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){const e=$(".milestone.datepicker");e.datetimepicker({lang:e.data("lang"),inline:!0,timepicker:!1,startDate:e.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){const e=$("#issue-title"),t=$("#edit-title-input input"),n=function(){return e.toggle(),$(".not-in-edit").toggle(),$("#edit-title-input").toggle(),$(".in-edit").toggle(),t.focus(),!1};$("#edit-title").click(n),$("#cancel-edit-title").click(n),$("#save-edit-title").click(n).click((function(){return 0==t.val().length||t.val()==e.text()?(t.val(e.text()),!1):($.post($(this).data("update-url"),{_csrf:o,title:t.val()},(function(n){t.val(n.title),e.text(n.title),h()})),!1)})),$(".edit-content").click((function(){const e=$(this).parent().parent().parent().next(),t=e.find(".edit-content-zone"),n=e.find(".render-content"),i=e.find(".raw-content");let a;if(0==t.html().length){t.html($("#edit-content-form").html()),a=t.find("textarea"),issuesTribute.attach(a.get()),emojiTribute.attach(a.get());const i=t.find(".dropzone");i.data("saved",!1);const s=t.find(".comment-files");if(i.length>0){const e={};i.dropzone({url:i.data("upload-url"),headers:{"X-Csrf-Token":o},maxFiles:i.data("max-file"),maxFilesize:i.data("max-size"),acceptedFiles:"*/*"===i.data("accepts")?null:i.data("accepts"),addRemoveLinks:!0,dictDefaultMessage:i.data("default-message"),dictInvalidFileType:i.data("invalid-input-type"),dictFileTooBig:i.data("file-too-big"),dictRemoveFile:i.data("remove-file"),init:function(){this.on("success",(function(t,n){e[t.name]={uuid:n.uuid,submitted:!1};const i=$('<input id="'+n.uuid+'" name="files" type="hidden">').val(n.uuid);s.append(i)})),this.on("removedfile",(function(t){t.name in e&&($("#"+e[t.name].uuid).remove(),i.data("remove-url")&&i.data("csrf")&&!e[t.name].submitted&&$.post(i.data("remove-url"),{file:e[t.name].uuid,_csrf:i.data("csrf")}))})),this.on("submit",(function(){$.each(e,(function(t){e[t].submitted=!0}))})),this.on("reload",(function(){$.getJSON(t.data("attachment-url"),(function(t){const n=i.get(0).dropzone;n.removeAllFiles(!0),s.empty(),$.each(t,(function(){const t=i.data("upload-url")+"/"+this.uuid;n.emit("addedfile",this),n.emit("thumbnail",this,t),n.emit("complete",this),n.files.push(this),e[this.name]={submitted:!0,uuid:this.uuid},i.find("img[src='"+t+"']").css("max-width","100%");const o=$('<input id="'+this.uuid+'" name="files" type="hidden">').val(this.uuid);s.append(o)}))}))}))}}),i.get(0).dropzone.emit("reload")}const r=t.find(".ui.comment.form"),c=r.find(".tabular.menu");c.attr("data-write",t.data("write")),c.attr("data-preview",t.data("preview")),c.find(".write.item").attr("data-tab",t.data("write")),c.find(".preview.item").attr("data-tab",t.data("preview")),r.find(".write.segment").attr("data-tab",t.data("write")),r.find(".preview.segment").attr("data-tab",t.data("preview")),l(r),t.find(".cancel.button").click((function(){n.show(),t.hide(),i.get(0).dropzone.emit("reload")})),t.find(".save.button").click((function(){n.show(),t.hide();const r=s.find("[name=files]").map((function(){return $(this).val()})).get();$.post(t.data("update-url"),{_csrf:o,content:a.val(),context:t.data("context"),files:r},(function(t){0==t.length?n.html($("#no-content").html()):(n.html(t.content),emojify.run(n[0]),$("pre code",n[0]).each((function(){hljs.highlightBlock(this)})));const o=e.parent();o.find(".ui.small.images").length?""==t.attachments?o.find(".ui.small.images").parent().remove():o.find(".ui.small.images").html(t.attachments):""!=t.attachments&&(o.append('<div class="ui bottom attached segment">    <div class="ui small images">    </div></div>'),o.find(".ui.small.images").html(t.attachments)),i.get(0).dropzone.emit("submit"),i.get(0).dropzone.emit("reload")}))}))}else a=e.find("textarea");return t.show(),n.hide(),0==a.val().length&&a.val(i.text()),a.focus(),!1})),$(".delete-comment").click((function(){const e=$(this);return confirm(e.data("locale"))&&$.post(e.data("url"),{_csrf:o}).success((function(){$("#"+e.data("comment-id")).remove()})),!1}));const i=$("#status-button");$("#comment-form .edit_area").keyup((function(){0==$(this).val().length?i.text(i.data("status")):i.text(i.data("status-and-comment"))})),i.click((function(){$("#status").val(i.data("status-val")),$("#comment-form").submit()}));const a=$(".merge-button > button");a.on("click",(function(e){e.preventDefault(),$("."+$(this).data("do")+"-fields").show(),$(this).parent().hide()})),$(".merge-button > .dropdown").dropdown({onChange:function(e,t,n){n.data("do")&&(a.find(".button-text").text(n.text()),a.data("do",n.data("do")))}}),$(".merge-cancel").on("click",(function(e){e.preventDefault(),$(this).closest(".form").hide(),a.parent().show()})),function e(t){let n="";t||(t=$(document),n=".reactions > "),t.find(n+"a.label").popup({position:"bottom left",metadata:{content:"title",title:"none"}}),t.find(".select-reaction > .menu > .item, "+n+"a.label").on("click",(function(t){const n=this;if(t.preventDefault(),$(this).hasClass("disabled"))return;const i=($(this).hasClass("item")?$(this).closest(".select-reaction").data("action-url"):$(this).data("action-url"))+"/"+($(this).hasClass("blue")?"unreact":"react");$.ajax({type:"POST",url:i,data:{_csrf:o,content:$(this).data("content")}}).done((function(t){if(t&&(t.html||t.empty)){const i=$(n).closest(".content");let o=i.find(".segment.reactions");if(!t.empty&&o.length>0&&o.remove(),!t.empty){o=$('<div class="ui attached segment reactions"></div>');const n=i.find(".segment.bottom:first");n.length>0?o.insertBefore(n):o.appendTo(i),o.html(t.html);const a=o.find(".has-emoji");for(let e=0;e<a.length;e++)emojify.run(a.get(e));o.find(".dropdown").dropdown(),e(o)}}}))}))}()}$(".repository.diff").length>0&&$(".diff-counter").each((function(){const 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",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()}));const t=$(".repository.compare.pull");t.length>0&&(e(".choose.branch .dropdown"),t.find("button.show-form").on("click",(function(e){e.preventDefault(),t.find(".pullrequest-form").show(),$(this).parent().hide()}))),$(".repository.settings.branches").length>0&&(e(".protected-branches .dropdown"),$(".enable-protection, .enable-whitelist").change((function(){this.checked?$($(this).data("target")).removeClass("disabled"):$($(this).data("target")).addClass("disabled")})))}function g(e){const 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(){const e=$(this).attr("data-tab")+t;$(this).attr("data-tab",e)})),e.parent().find("*[data-tab='write']").attr("data-tab","write"+t),e.parent().find("*[data-tab='preview']").attr("data-tab","preview"+t),l(e.parent(".form")),t}function v(){$(".access-mode.menu .item").click((function(){const e=$(this).parent();$.post(e.data("url"),{_csrf:o,uid:e.data("uid"),mode:$(this).data("value")})}))}function b(){$(".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"))}));const e=$("#file-name");e.keyup((function(e){const t=$(".breadcrumb span.section"),n=$(".breadcrumb div.divider");let i,o;if(8==e.keyCode&&0==$(this).getCursorPosition()&&t.length>0&&(i=t.last().find("a").text(),$(this).val(i+$(this).val()),$(this)[0].setSelectionRange(i.length,i.length),t.last().remove(),n.last().remove()),191==e.keyCode){o=$(this).val().split("/");for(let e=0;e<o.length;++e)i=o[e],e<o.length-1?i.length&&($('<span class="section"><a href="#">'+i+"</a></span>").insertBefore($(this)),$('<div class="divider"> / </div>').insertBefore($(this))):$(this).val(i),$(this)[0].setSelectionRange(0,0)}o=[],$(".breadcrumb span.section").each((function(){const e=$(this);e.find("a").length?o.push(e.find("a").text()):o.push(e.text())})),$(this).val()&&o.push($(this).val()),$("#tree_path").val(o.join("/"))})).trigger("keyup");const t=$(".repository.editor textarea#edit_area");if(!t.length)return;const n=t.data("markdown-file-exts").split(","),i=t.data("line-wrap-extensions").split(",");e.on("keyup",(function(){const a=e.val();let l,d,u,h,f,p;u=h="";const m=/.+\.([^.]+)$/.exec(a);m&&(h="."+(u=m[1]));const g=CodeMirror.findModeByExtension(u),v=$("a[data-tab=preview]");if(g?(l=g.mode,d=g.mime,p=l):p=u,v.length&&p&&s&&s.length&&s.indexOf(p)>=0?(f=v.data("url"),v.data("url",f.replace(/(.*)\/.*/i,"$1/"+l)),v.show()):v.hide(),n.indexOf(h)>=0&&function(e){return c&&(c.toTextArea(),c=null),!!r||(r=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:o,mode:"gfm",context:e.data("context"),text:t},(function(e){n.innerHTML='<div class="markdown ui segment">'+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))return;if(!c&&!function(e){return r&&(r.toTextArea(),r=null),!!c||((c=CodeMirror.fromTextArea(e[0],{lineNumbers:!0})).on("change",(function(t,n){e.val(t.getValue())})),!0)}(t))return;l&&(c.setOption("mode",d),CodeMirror.autoLoadMode(c,l)),i.indexOf(h)>=0?c.setOption("lineWrapping",!0):c.setOption("lineWrapping",!1);let 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?(c.setOption("indentWithTabs",!0),c.setOption("extraKeys",{})):(c.setOption("indentWithTabs",!1),c.setOption("extraKeys",{Tab:function(e){const t=Array(parseInt(e.getOption("indentUnit"))+1).join(" ");e.replaceSelection(t)}})),c.setOption("indentUnit",e.indent_size||4),c.setOption("tabSize",e.tab_width||4)})))})).trigger("keyup");const a=$("#commit-button"),l=$(".ui.edit.form");a.prop("disabled",!0),l.areYouSure({silent:!0,dirtyClass:"dirty-file",fieldSelector:":input:not(.commit-form-wrapper :input)",change:function(){const 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 w(){$(".user.settings.profile").length>0&&$("#username").keyup((function(){const e=$("#name-change-prompt");$(this).val().toString().toLowerCase()!=$(this).data("name").toString().toLowerCase()?e.show():e.hide()}))}function k(){$(".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){const t=$(this),n=t.parent().siblings(".lines-code").find("ol.linenums > li");T(n,n.filter("[rel="+t.attr("id")+"]"),e.shiftKey?n.filter(".active").eq(0):null),window.getSelection?window.getSelection().removeAllRanges():document.selection.empty()})),$(window).on("hashchange",(function(){let e=window.location.hash.match(/^#(L\d+)-(L\d+)$/);const t=$(".code-view ol.linenums > li");let n;if(e)return n=t.filter("."+e[1]),T(t,n,t.filter("."+e[2])),void $("html, body").scrollTop(n.offset().top-200);(e=window.location.hash.match(/^#(L|n)(\d+)$/))&&(n=t.filter(".L"+e[2]),T(t,n),$("html, body").scrollTop(n.offset().top-200))})).trigger("hashchange"))}function y(e){$.ajax({url:a+"/user/u2f/sign",type:"POST",headers:{"X-Csrf-Token":o},data:JSON.stringify(e),contentType:"application/json; charset=utf-8"}).done((function(e){window.location.replace(e)})).fail((function(){x(1)}))}function C(e){(function(e){if(!("errorCode"in e))return!1;if(0===e.errorCode)return!1;return x(e.errorCode),!0})(e)||$.ajax({url:a+"/user/settings/security/u2f/register",type:"POST",headers:{"X-Csrf-Token":o},data:JSON.stringify(e),contentType:"application/json; charset=utf-8",success:function(){h()},fail:function(){x(1)}})}function x(e){const 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");for(const n in t)n!=e&&t[n].addClass("hide");$("#u2f-error").modal("show")}function S(){$.post(a+"/user/settings/security/u2f/request_register",{_csrf:o,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(C).catch((function(e){x(void 0!==e?e.metaData.code:1)}))})).fail((function(e){409===e.status&&$("#nickname").closest("div.field").addClass("error")}))}function q(e){history.pushState?history.pushState(null,null,e):location.hash=e}function T(e,t,n){if(e.removeClass("active"),n){let i,o=parseInt(t.attr("rel").substr(1)),a=parseInt(n.attr("rel").substr(1));if(o!=a){o>a&&(i=o,o=a,a=i);const t=[];for(let e=o;e<=a;e++)t.push(".L"+e);return e.filter(t.join(",")).addClass("active"),void q("#L"+o+"-L"+a)}}t.addClass("active"),q("#"+t.attr("rel"))}function L(){const e=$(this);let t="";e.attr("id")&&(t+="#"+e.attr("id"));const n=$(".delete.modal"+t);return n.find(".name").text(e.data("name")),n.modal({closable:!1,onApprove:function(){"form"!=e.data("type")?$.post(e.data("url"),{_csrf:o,id:e.data("id")}).done((function(e){window.location.href=e.redirect})):$(e.data("form")).submit()}}).modal("show"),!1}function O(){const e=$(this);let t="";e.attr("id")&&(t+="#"+e.attr("id"));const n=$(".addall.modal"+t);return n.find(".name").text(e.data("name")),n.modal({closable:!1,onApprove:function(){"form"!=e.data("type")?$.post(e.data("url"),{_csrf:o,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),Array.from||(Array.from=function(){const e=Object.prototype.toString,t=function(t){return"function"==typeof t||"[object Function]"===e.call(t)},n=Math.pow(2,53)-1,i=function(e){const t=function(e){const t=Number(e);return isNaN(t)?0:0!==t&&isFinite(t)?(t>0?1:-1)*Math.floor(Math.abs(t)):t}(e);return Math.min(Math.max(t,0),n)};return function(e){const n=this,o=Object(e);if(null==e)throw new TypeError("Array.from requires an array-like object - not null or undefined");const a=arguments.length>1?arguments[1]:void 0;let s;if(void 0!==a){if(!t(a))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(s=arguments[2])}const r=i(o.length),c=t(n)?Object(new n(r)):new Array(r);let l,d=0;for(;d<r;)l=o[d],c[d]=a?void 0===s?a(l,d):a.call(s,l,d):l,d+=1;return c.length=r,c}}()),"function"!=typeof Object.assign&&Object.defineProperty(Object,"assign",{value:function(e,t){if(null==e)throw new TypeError("Cannot convert undefined or null to object");const n=Object(e);for(let e=1;e<arguments.length;e++){const t=arguments[e];if(null!=t)for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e])}return n},writable:!0,configurable:!0}),String.prototype.endsWith=function(e){const t=this.length-e.length;return t>=0&&this.lastIndexOf(e)===t},$.fn.getCursorPosition=function(){const e=$(this).get(0);let t=0;if("selectionStart"in e)t=e.selectionStart;else if("selection"in document){e.focus();const 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(o=$("meta[name=_csrf]").attr("content"),a=$("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){const e=[].slice.call(document.querySelectorAll("pre code")||[]);for(let t=0;t<e.length;t++)hljs.highlightBlock(e[t])}const e=$("#dropzone");if(e.length>0){const t={};new Dropzone("#dropzone",{url:e.data("upload-url"),headers:{"X-Csrf-Token":o},maxFiles:e.data("max-file"),maxFilesize:e.data("max-size"),acceptedFiles:"*/*"===e.data("accepts")?null:e.data("accepts"),addRemoveLinks:!0,dictDefaultMessage:e.data("default-message"),dictInvalidFileType:e.data("invalid-input-type"),dictFileTooBig:e.data("file-too-big"),dictRemoveFile:e.data("remove-file"),init:function(){this.on("success",(function(e,n){t[e.name]=n.uuid;const i=$('<input id="'+n.uuid+'" name="files" type="hidden">').val(n.uuid);$(".files").append(i)})),this.on("removedfile",(function(n){n.name in t&&$("#"+t[n.name]).remove(),e.data("remove-url")&&e.data("csrf")&&$.post(e.data("remove-url"),{file:t[n.name],_csrf:e.data("csrf")})}))}})}emojify.setConfig({img_dir:a+"/vendor/plugins/emojify/images",ignore_emoticons:!0});const t=document.getElementsByClassName("has-emoji");for(let e=0;e<t.length;e++){emojify.run(t[e]);for(let n=0;n<t[e].childNodes.length;n++)"A"===t[e].childNodes[n].nodeName&&emojify.run(t[e].childNodes[n])}const n=new Clipboard(".clipboard");if(n.on("success",(function(e){e.clearSelection(),$("#"+e.trigger.getAttribute("id")).popup("destroy"),e.trigger.setAttribute("data-content",e.trigger.getAttribute("data-success")),$("#"+e.trigger.getAttribute("id")).popup("show"),e.trigger.setAttribute("data-content",e.trigger.getAttribute("data-original"))})),n.on("error",(function(e){$("#"+e.trigger.getAttribute("id")).popup("destroy"),e.trigger.setAttribute("data-content",e.trigger.getAttribute("data-error")),$("#"+e.trigger.getAttribute("id")).popup("show"),e.trigger.setAttribute("data-content",e.trigger.getAttribute("data-original"))})),$(".delete-button").click(L),$(".add-all-button").click(O),$(".delete-branch-button").click(L),$(".undo-button").click((function(){const e=$(this);$.post(e.data("url"),{_csrf:o,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(){const e=$(this);$.post(e.data("request-url"),{_csrf:o}).done((function(){window.location.href=e.data("done-url")}))})),$(".markdown").each((function(){const e={};$(this).find("h1, h2, h3, h4, h5, h6").each((function(){let t=$(this);const n=encodeURIComponent(t.text().toLowerCase().replace(/[^\u00C0-\u1FFF\u2C00-\uD7FF\w\- ]/g,"").replace(/[ ]/g,"-"));let i=n;e[n]>0&&(i=n+"-"+e[n]),null==e[n]?e[n]=1:e[n]+=1,(t=t.wrap('<div id="'+i+'" class="anchor-wrap" ></div>')).append('<a class="anchor" href="#'+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(){let e=this.dataset.action,t=this.dataset.elementId;const 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"),u(i,e,n,t).then((function(){"close"!==e&&"open"!==e||$('.issue-checkbox input[type="checkbox"]').each((function(e,t){t.checked=!1})),h()}))})),$('.issue-checkbox input[type="checkbox"]:checked').first().each((function(e,t){t.checked=!1,$(t).click()})),k(),$("#search-user-box").search({minCharacters:2,apiSettings:{url:a+"/api/v1/users/search?q={query}",onResponse:function(e){const t=[];return $.each(e.data,(function(e,n){let o=n.login;n.full_name&&n.full_name.length>0&&(o+=" ("+i(n.full_name)+")"),t.push({title:o,image:n.avatar_url})})),{results:t}}},searchFields:["login","full_name"],showNoResults:!1}),function(){const e=$("#search-team-box");e.search({minCharacters:2,apiSettings:{url:a+"/api/v1/orgs/"+e.data("org")+"/teams/search?q={query}",headers:{"X-Csrf-Token":o},onResponse:function(e){const t=[];return $.each(e.data,(function(e,n){const i=n.name+" ("+n.permission+" access)";t.push({title:i})})),{results:t}}},searchFields:["name","description"],showNoResults:!1})}(),function(){const e=$("#search-repo-box");e.search({minCharacters:2,apiSettings:{url:a+"/api/v1/repos/search?q={query}&uid="+e.data("uid"),onResponse:function(e){const 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})}(),p(),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(){const 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"));const 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")}))),m(),function(){const e=function(){const e=$("#auth_username").val(),t=$("#clone_addr").val();!$("#mirror").is(":checked")&&null!=e&&e.length>0&&null!=t&&(t.startsWith("https://github.com")||t.startsWith("http://github.com"))?$("#migrate_items").show():$("#migrate_items").hide()};e(),$("#clone_addr").on("input",e),$("#auth_username").on("input",e),$("#mirror").on("change",e)}(),function(){const e=$(".repository.wiki textarea#edit_area");if(e.length>0){const t=new SimpleMDE({autoDownloadFontAwesome:!1,element:e[0],forceSync:!0,previewRender:function(t,n){return setTimeout((function(){$.post(e.data("url"),{_csrf:o,mode:"gfm",context:e.data("context"),text:t},(function(e){n.innerHTML='<div class="markdown ui segment">'+e+"</div>",emojify.run($(".editor-preview")[0])}))}),0),"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){const t=e.codemirror,n=t.getSelection();if(t.replaceSelection("`"+n+"`"),!n){const e=t.getCursor();t.setCursor(e.line,e.ch-1)}t.focus()},className:"fa fa-angle-right",title:"Add Inline Code"},"code","quote","|",{name:"checkbox-empty",action:function(e){const t=e.codemirror;t.replaceSelection("\n- [ ] "+t.getSelection()),t.focus()},className:"fa fa-square-o",title:"Add Checkbox (empty)"},{name:"checkbox-checked",action:function(e){const t=e.codemirror;t.replaceSelection("\n- [x] "+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"]});$(t.codemirror.getInputField()).addClass("js-quick-submit")}}(),d(),b(),0!=$(".organization").length&&$(".organization.settings.options").length>0&&$("#org_name").keyup((function(){const e=$("#org-name-change-prompt");$(this).val().toString().toLowerCase()!=$(this).data("org-name").toString().toLowerCase()?e.show():e.hide()})),function(){if(0==$(".new.webhook").length)return;$(".events.checkbox input").change((function(){$(this).is(":checked")&&$(".events.fields").show()})),$(".non-events.checkbox input").change((function(){$(this).is(":checked")&&$(".events.fields").hide()}));const e=function(){const e="POST"===$("#http_method").val();$("#content_type").parent().parent()[e?"show":"hide"]()};e(),$("#http_method").change((function(){e()})),$("#test-delivery").click((function(){const e=$(this);e.addClass("loading disabled"),$.post(e.data("link"),{_csrf:o}).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").hide(),$(".ldap input[required], .binddnrequired input[required], .dldap input[required], .smtp input[required], .pam input[required], .oauth2 input[required], .has-tls input[required]").removeAttr("required"),$(".binddnrequired").removeClass("required");const i=$(this).val();switch(i){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"),n()}"2"!=i&&"5"!=i||e(),"2"==i&&t()})),$("#auth_type").change(),$("#security_protocol").change(e),$("#use_paged_search").change(t),$("#oauth2_provider").change(n),$("#oauth2_use_custom_url").change(i)),$(".admin.edit.authentication").length>0){const o=$("#auth_type").val();"2"==o||"5"==o?($("#security_protocol").change(e),"2"==o&&$("#use_paged_search").change(t)):"6"==o&&($("#oauth2_provider").change(n),$("#oauth2_use_custom_url").change(i),n())}if($(".admin.notice")){const e=$("#detail-modal");$(".view-detail").click((function(){return e.find(".content p").text($(this).data("content")),e.modal("show"),!1}));const t=$(".select.table .ui.checkbox");$(".select.action").click((function(){switch($(this).data("action")){case"select-all":t.checkbox("check");break;case"deselect-all":t.checkbox("uncheck");break;case"inverse":t.checkbox("toggle")}})),$("#delete-selection").click((function(){const e=$(this);e.addClass("loading disabled");const n=[];t.each((function(){$(this).checkbox("is checked")&&n.push($(this).data("id"))})),$.post(e.data("link"),{_csrf:o,ids:n}).done((function(){window.location.href=e.data("redirect")}))}))}}function e(){$("#security_protocol").val()>0?$(".has-tls").show():$(".has-tls").hide()}function t(){$("#use_paged_search").prop("checked")?$(".search-page-size").show().find("input").attr("required","required"):$(".search-page-size").hide().find("input").removeAttr("required")}function n(){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()}i()}function i(){const 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($("#"+e+"_token_url").val()),$("#oauth2_auth_url").val()||$("#oauth2_auth_url").val($("#"+e+"_auth_url").val()),$("#oauth2_profile_url").val()||$("#oauth2_profile_url").val($("#"+e+"_profile_url").val()),$("#oauth2_email_url").val()||$("#oauth2_email_url").val($("#"+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(){const 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 this.suburl+"/api/v1/repos/search?sort=updated&order=desc&uid="+this.uid+"&q="+this.searchQuery+"&limit="+this.searchLimit+"&mode="+this.repoTypes[this.reposFilter].searchMode+("all"!==this.reposFilter?"&exclusive=1":"")},repoTypeCount:function(){return this.repoTypes[this.reposFilter].count}},mounted:function(){this.searchRepos(this.reposFilter);const 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){const t=this;this.isLoading=!0;const n=this.repoTypes[e].searchMode,i=this.searchURL,o=this.searchQuery;$.getJSON(i,(function(a,s,r){if(i==t.searchURL){t.repos=a.data;const i=r.getResponseHeader("X-Total-Count");""===o&&""===n&&(t.reposTotalCount=i),t.repoTypes[e].count=i}})).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()})),function(){const e=$("#navbar"),t=$("#navbar-expand-toggle");let n=!1;t.click((function(){(n=!n)?(e.addClass("shown"),t.addClass("active")):(e.removeClass("shown"),t.removeClass("active"))}))}(),function(){const e=$("#manage_topic"),t=$("#topic_edit"),n=$("#repo-topics"),i=$("#save_topic"),s=$("#topic_edit .dropdown"),r=$("#topic_edit.ui.form"),c=function(){const e=$("div.hide#validate_prompt"),t={countPrompt:e.children("#count_prompt").text(),formatPrompt:e.children("#format_prompt").text()};return e.remove(),t}();e.click((function(){n.hide(),t.css("display","")})),i.click((function(){const e=$("input[name=topics]").val();$.post(i.data("link"),{_csrf:o,topics:e},(function(i,o,a){if("ok"===a.responseJSON.status){if(n.children(".topic").remove(),e.length){const t=e.split(","),i=n.children("a").last();for(let e=0;e<t.length;e++)$('<div class="ui small label topic" style="cursor:pointer;">'+t[e]+"</div>").insertBefore(i)}t.css("display","none"),n.show()}})).fail((function(t){if(422===t.status)if(t.responseJSON.invalidTopics.length>0){c.formatPrompt=t.responseJSON.message;const n=t.responseJSON.invalidTopics,i=s.children("a.ui.label");e.split(",").forEach((function(e,t){for(let o=0;o<n.length;o++)n[o]===e&&i.eq(t).removeClass("green").addClass("red")}))}else c.countPrompt=t.responseJSON.message})).always((function(){r.form("validate form")}))})),s.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:a+"/api/v1/topics/search?q={query}",throttle:500,cache:!1,onResponse:function(e){const t={success:!1,results:[]},n=this.urlData.query.trim().replace(/<[^>]*>?/gm,"");let i=!1;const o=[];if(s.find("div.label.visible.topic,a.label.visible").each((function(e,t){o.push(t.dataset.value)})),e.topics){let a=!1;for(let s=0;s<e.topics.length;s++)-1==o.indexOf(e.topics[s].topic_name)&&(e.topics[s].topic_name.toLowerCase()===n.toLowerCase()&&(i=!0),t.results.push({description:e.topics[s].topic_name,"data-value":e.topics[s].topic_name}),a=!0);t.success=a}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){const n=s.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===s.children("a.ui.label.red").length},r.form({on:"change",inline:!0,fields:{topics:{identifier:"topics",rules:[{type:"validateTopic",value:/^[a-z0-9][a-z0-9-]{1,35}$/,prompt:c.formatPrompt},{type:"maxCount[25]",prompt:c.countPrompt}]}}})}(),0!==$("#wait-for-key").length&&u2fApi.ensureSupport().then((function(){$.getJSON(a+"/user/u2f/challenge").success((function(e){u2fApi.sign(e.appId,e.challenge,e.registeredKeys,30).then(y).catch((function(e){x(void 0!==e?e.metaData.code:1)}))}))})).catch((function(){window.location.href=a+"/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(S).catch((function(){x("browser")}))})),function(){const e=$("#repolink").val(),t=$("#repoId").val(),n=$("#crossRepoSearch").val();let o=a+"/api/v1/repos/"+e+"/issues?q={query}";"true"===n&&(o=a+"/api/v1/repos/issues/search?q={query}&priority_repo_id="+t);$("#new-dependency-drop-list").dropdown({apiSettings:{url:o,onResponse:function(e){const t={success:!0,results:[]},n=$("#new-dependency-drop-list").data("issue-id");return $.each(e,(function(e,o){o.id!==n&&t.results.push({name:"#"+o.number+" "+i(o.title)+'<div class="text small dont-break-out">'+i(o.repository.full_name)+"</div>",value:o.id})})),t},cache:!1},fullTextSearch:!0}),$(".menu a.label-filter-item").each((function(){$(this).click((function(e){if(e.altKey){e.preventDefault();const t=$(this).attr("href"),n="labels=(-?[0-9]+%2c)*("+$(this).data("label-id")+")(%2c-?[0-9]+)*&",i="labels=$1-$2$3&";window.location=t.replace(new RegExp(n),i)}}))})),$(".menu .ui.dropdown.label-filter").keydown((function(e){if(e.altKey&&13==e.keyCode){const e=$(".menu .ui.dropdown.label-filter .menu .item.selected");if(e.length>0){const t=$(e[0]),n=t.attr("href"),i="labels=(-?[0-9]+%2c)*("+t.data("label-id")+")(%2c-?[0-9]+)*&",o="labels=$1-$2$3&";window.location=n.replace(new RegExp(i),o)}}}))}(),$(".title_wip_desc > a").click((function(e){e.preventDefault();const t=$("#issue_title");t.focus();const n=t.val().trim().toUpperCase();for(const e in wipPrefixes)if(n.startsWith(wipPrefixes[e].toUpperCase()))return;t.val(wipPrefixes[0]+" "+t.val())})),$(".show-outdated").on("click",(function(e){e.preventDefault();const t=$(this).data("comment");$(this).addClass("hide"),$("#code-comments-"+t).removeClass("hide"),$("#code-preview-"+t).removeClass("hide"),$("#hide-outdated-"+t).removeClass("hide")})),$(".hide-outdated").on("click",(function(e){e.preventDefault();const t=$(this).data("comment");$(this).addClass("hide"),$("#code-comments-"+t).addClass("hide"),$("#code-preview-"+t).addClass("hide"),$("#show-outdated-"+t).removeClass("hide")})),$("button.comment-form-reply").on("click",(function(e){e.preventDefault(),$(this).hide();const t=$(this).parent().find(".comment-form");t.removeClass("hide"),g(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(){const 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"))return;e.preventDefault();const t=$(this).closest(".code-diff").hasClass("code-diff-split"),n=$(this).data("side"),i=$(this).data("idx"),o=$(this).data("path"),a=$("#pull_review_add_comment").html(),s=$(this).closest("tr");let r=s.next();r.hasClass("add-comment")||(r=$('<tr class="add-comment">'+(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>"),s.after(r));const c=r.find(".add-comment-"+n);let l=c.find(".comment-code-cloud");0===l.length&&(c.html(a),g((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(o)),l.find("textarea").focus()}))),function e(){const t=$("#repo_migrating");if($("#repo_migrating_failed").hide(),t){const n=t.attr("repo");if(void 0===n)return;$.ajax({type:"GET",url:a+"/"+n+"/status",data:{_csrf:o},complete:function(t){if(200==t.status&&t.responseJSON)return 0==t.responseJSON.status?void location.reload():void setTimeout((function(){e()}),2e3);$("#repo_migrating_progress").hide(),$("#repo_migrating_failed").show()}})}}(),function(){const e=$("#repo_template"),t=function(){const t=$("#template_units"),n=$("#non_template");""!==e.val()?(t.show(),n.hide()):(t.hide(),n.show())};e.change(t),t();const n=function(){$("#repo_template_search").dropdown({apiSettings:{url:a+"/api/v1/repos/search?q={query}&template=true&priority_owner_id="+$("#uid").val(),onResponse:function(e){const t={success:!0,results:[]};return t.results.push({name:"",value:""}),$.each(e.data,(function(e,n){t.results.push({name:i(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()}const s={"div.user.settings":w,"div.repository.settings.collaboration":v};let r;for(r in s)if($(r).length>0){s[r]();break}const c=$("#clone_addr");c.change((function(){const e=$("#repo_name");c.val().length>0&&0===e.val().length&&e.val(c.val().match(/^(.*\/)?((.+?)(\.git)?)$/)[3])}))})),$((function(){0===$(".user.signin").length&&$("form:not(.ignore-dirty)").areYouSure(),$("#ssh-key-content").on("change paste keyup",(function(){const 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){const i=document.getElementById(e);if(!i)return;(n=n||{}).contributions=n.contributions||"contributions",n.no_contributions=n.no_contributions||"No contributions";const o=["${","}"];Vue.component("activity-heatmap",{delimiters:o,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){const t=this;$.get(this.suburl+"/api/v1/users/"+e+"/heatmap",(function(e){const n=[];for(let 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){const t=document.createElement("div");t.className="heatmap-color-"+e,document.body.appendChild(t);const 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:o,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(){const e=$("#deadlineDate").val();window.updateDeadline(e)},window.updateDeadline=function(e){$("#deadline-err-invalid-date").hide(),$("#deadline-loader").addClass("loading");let t=null;if(""!==e){const n=Date.parse(e);if(isNaN(n))return $("#deadline-loader").removeClass("loading"),$("#deadline-err-invalid-date").show(),!1;t=new Date(n)}$.ajax($("#update-issue-deadline-form").attr("action")+"/deadline",{data:JSON.stringify({due_date:t}),headers:{"X-Csrf-Token":o,"X-Remote":!0},contentType:"application/json",type:"POST",success:function(){h()},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){const 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(){const 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
\ No newline at end of file
index 3d675c22ff468b88e90a7eae7d285f47b91e2042..2d346471ed97c1b5a7225d7ce3d68f5ebe75d257 100644 (file)
@@ -1 +1 @@
-{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./web_src/js/index.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","htmlEncode","text","jQuery","html","csrf","suburl","previewFileModes","simpleMDEditor","codeMirrorEditor","initCommentPreviewTab","$form","$tabMenu","find","tab","data","click","$this","$","this","post","val","$previewPanel","emojify","run","each","hljs","highlightBlock","buttonsClickOnEnter","initEditForm","length","$previewTab","split","initEditPreviewTab","$diffPreviewPanel","initEditDiffTab","updateIssuesMeta","url","action","issueIds","elementId","Promise","resolve","ajax","type","success","reload","window","location","initImagePaste","target","field","addEventListener","event","pasteEvent","callback","clipboardData","items","indexOf","blob","getAsFile","preventDefault","stopPropagation","retrieveImageFromClipboardAsBlob","img","substr","lastIndexOf","selectionStart","startPos","endPos","selectionEnd","substring","insertAtCursor","file","xhr","XMLHttpRequest","onload","status","responseText","open","setRequestHeader","formData","FormData","append","send","uploadFile","res","JSON","parse","oldval","newval","replace","replaceAndKeepCursor","uuid","input","initCommentForm","initListSubmits","selector","outerSelector","$list","$noSelect","$listMenu","hasLabelUpdateAction","labels","dropdown","promises","keys","forEach","label","promise","push","all","then","hasClass","removeClass","addClass","listIds","parent","join","selectItem","select_id","input_id","$menu","hasUpdateAction","$selectBranch","selectedValue","css","initBranchSelector","initRepository","initFilterSearchDropdown","$dropdown","fullTextSearch","selectOnKeydown","onChange","_text","_value","$choice","href","message","noResults","$data","searchTerm","canCreateBranch","menuVisible","active","branch","tag","selected","remove","Vue","delimiters","el","beforeMount","vm","$el","getAttribute","document","body","contains","set","watch","visible","focusSearchField","computed","filteredItems","filter","item","toLowerCase","showCreateNewBranch","showNoResults","methods","prev","getSelected","createNewBranch","$refs","newBranchForm","submit","nextTick","searchField","focus","j","getSelectedIndexInFiltered","scrollToActive","Array","isArray","cont","scrollContainer","offsetTop","scrollTop","clientHeight","keydown","keyCode","keyup","$prompt","toString","show","hide","change","checked","$newLabelPanel","minicolors","color_hex","modal","onApprove","$datepicker","datetimepicker","lang","inline","timepicker","startDate","formatDate","onSelectDate","ct","dateFormat","$issueTitle","$editInput","editTitleToggle","toggle","title","$segment","next","$editContentZone","$renderContent","$rawContent","$textarea","issuesTribute","attach","emojiTribute","$dropzone","$files","filenameDict","dropzone","headers","maxFiles","maxFilesize","acceptedFiles","addRemoveLinks","dictDefaultMessage","dictInvalidFileType","dictFileTooBig","dictRemoveFile","init","on","submitted","_csrf","getJSON","drop","removeAllFiles","empty","imgSrc","emit","files","$editContentForm","attr","$attachments","map","content","$content","attachments","confirm","$statusButton","$mergeButton","e","closest","initReactionSelector","reactions","popup","done","resp","react","insertBefore","appendTo","hasEmoji","$item","addLine","delLine","addPercent","parseFloat","localStorage","setItem","select","$repoComparePull","assingMenuAttributes","menu","id","Math","floor","random","initRepositoryCollaboration","initEditor","prop","$editFilename","$section","$divider","parts","getCursorPosition","last","setSelectionRange","element","trigger","$editArea","markdownFileExts","lineWrapExtensions","spec","extension","extWithDot","dataUrl","apiCall","exec","info","CodeMirror","findModeByExtension","previewLink","mime","toTextArea","SimpleMDE","autoDownloadFontAwesome","forceSync","renderingConfig","singleLineBreaks","indentWithTabs","tabSize","spellChecker","previewRender","plainText","preview","setTimeout","innerHTML","toolbar","setSimpleMDE","fromTextArea","lineNumbers","cm","_change","getValue","setCodeMirror","setOption","autoLoadMode","editorconfig","indent_style","Tab","spaces","parseInt","getOption","replaceSelection","indent_size","tab_width","$commitButton","$editForm","areYouSure","silent","dirtyClass","fieldSelector","dirty","initUserSettings","keypress","initCodeView","$select","siblings","selectRange","shiftKey","eq","getSelection","removeAllRanges","selection","hash","match","$first","offset","top","u2fSigned","stringify","contentType","fail","u2fError","u2fRegistered","errorCode","checkError","errorType","u2fErrors","1","2","3","4","5","u2fRegisterRequest","req","registeredKeys","u2fApi","register","appId","registerRequests","catch","reason","undefined","metaData","code","changeHash","history","pushState","$from","a","b","classes","showDeletePopup","dialog","closable","redirect","showAddAllPopup","Dropzone","autoDiscover","from","toStr","isCallable","fn","maxSafeInteger","pow","toLength","len","number","Number","isNaN","isFinite","abs","toInteger","min","max","arrayLike","C","TypeError","mapFn","arguments","T","A","kValue","k","assign","_varArgs","to","index","nextSource","nextKey","writable","configurable","String","endsWith","pattern","pos","Sel","createRange","SelLength","moveStart","ready","onShow","transition","direction","accordion","checkbox","progress","showActivity","slideToggle","nodes","slice","querySelectorAll","setConfig","img_dir","ignore_emoticons","getElementsByClassName","childNodes","nodeName","clipboard","Clipboard","clearSelection","setAttribute","node","encodeURIComponent","wrap","children","dataset","issueIDs","issueId","_","first","search","minCharacters","apiSettings","onResponse","response","_i","login","full_name","image","avatar_url","results","searchFields","$searchTeamBox","permission","searchTeams","$searchRepoBox","description","searchRepositories","dbType","dbDefaults","_type","defaultHost","is","toggleMigrations","authUserName","cloneAddr","startsWith","initMigration","simplemde","codemirror","cursorPos","getCursor","setCursor","line","ch","className","getInputField","initWikiForm","updateContentType","initWebhook","removeAttr","authType","onOAuth2Change","onSecurityProtocolChange","onUsePagedSearchChange","onOAuth2UseCustomURLChange","$detailModal","$checkboxes","ids","provider","initAdmin","getElementById","component","props","searchLimit","default","required","uid","organizations","isOrganization","Boolean","canCreateOrganization","organizationsTotalCount","moreReposLink","repos","reposTotalCount","reposFilter","searchQuery","isLoading","repoTypes","count","searchMode","showMoreReposLink","searchURL","repoTypeCount","mounted","searchRepos","self","changeTab","changeReposFilter","showRepo","repo","owner","mirror","fork","searchedMode","searchedURL","searchedQuery","result","_textStatus","request","getResponseHeader","always","repoClass","private","querySelector","initVueApp","ctrlKey","altKey","metaKey","isExpanded","initNavbarContentToggle","mgrBtn","editDiv","viewDiv","saveBtn","topicDropdown","topicForm","topicPrompts","hidePrompt","prompts","countPrompt","formatPrompt","getPrompts","topics","_data","responseJSON","topicArray","invalidTopics","topicLables","form","allowAdditions","forceSelection","fields","saveRemoteData","duration","variation","blue","basic","throttle","cache","formattedResponse","query","urlData","trim","found_query","current_topics","found","topic_name","unshift","sort","onLabelCreate","contents","replaceWith","onAdd","addedValue","_addedText","$addedChoice","settings","rules","validateTopic","_values","regExp","identifier","prompt","initTopicbar","ensureSupport","sign","challenge","err","allowMultiple","repolink","repoId","crossRepoSearch","issueSearchUrl","filteredResponse","currIssueId","issue","repository","regStr","newStr","RegExp","selectedItems","initIssueList","toUpperCase","wipPrefixes","sticky","isSplit","side","idx","path","tr","ntr","after","td","commentCloud","initRepoStatusChecker","migrating","repo_name","complete","$repoTemplate","checkTemplate","$templateUnits","$nonTemplate","changeOwner","_r","initTemplateSearch","getItem","routes","$cloneAddr","$repoName","arrays","$title","timeAddManual","toggleStopwatch","cancelStopwatch","initHeatmap","appElementId","heatmapUser","locale","contributions","no_contributions","vueDelimeters","user","colorRange","endDate","values","totalContributions","getColor","Date","loadHeatmap","userName","chartRawData","chartData","date","timestamp","createElement","appendChild","color","getComputedStyle","backgroundColor","removeChild","template","toggleDeadlineForm","fadeToggle","setDeadline","deadlineString","realDeadline","newDate","error","updateDeadline","deleteDependencyModal","cancelCodeComment","btn","onOAuthLoginClick","oauthLoader","oauthNav"],"mappings":"aACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QAKfF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SA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AoBiG,SAAS,WAE/B,IAAI6lB,EAAe,KACnB,GAAuB,KAAnBD,EAAuB,CAEvB,MAAME,EAAUnB,KAAKtmB,MAAMunB,GAE3B,GAAI1S,MAAM4S,GAGN,OAFA/rB,EAAE,oBAAoBgG,YAAY,WAClChG,EAAE,8BAA8BiL,QACzB,EAEX6gB,EAAe,IAAIlB,KAAKmB,GAG5B/rB,EAAEyB,KAAKzB,EAAE,+BAA+B2O,KAAK,UAAY,YAAa,CAClE9O,KAAMwE,KAAK4R,UAAU,CACjB,SAAY6V,IAEhBxe,QAAS,CACL,eAAgBnO,EAChB,YAAY,GAEhB+W,YAAa,mBACbxU,KAAM,OACNC,QAAS,WACLC,KAEJoqB,MAAO,WACHhsB,EAAE,oBAAoBgG,YAAY,WAClChG,EAAE,8BAA8BiL,UAnCxCghB,CADiBjsB,EAAE,iBAAiBG,QAyCxC0B,OAAOqqB,sBAAwB,SAASxb,EAAIhP,GACxC1B,EAAE,sBACGwL,MAAM,CACH4M,UAAU,EACV0M,SAAU,IACVrZ,UAAW,WACPzL,EAAE,uBAAuBG,IAAIuQ,GAC7B1Q,EAAE,mBAAmBG,IAAIuB,GACzB1B,EAAE,yBAAyB8J,YAEhC0B,MAAM,SAyEjB3J,OAAOsqB,kBAAoB,SAASC,GAChC,MAAM3H,EAAOzkB,EAAEosB,GAAK/c,QAAQ,QACzBoV,EAAK7jB,OAAS,GAAK6jB,EAAK1e,SAAS,iBAChC0e,EAAKxe,SAAS,QACdwe,EAAKte,SAASxG,KAAK,6BAA6BsL,QAEhDwZ,EAAKpV,QAAQ,uBAAuBnH,UAG5CrG,OAAOwqB,kBAAoB,WACvB,MAAMC,EAActsB,EAAE,wBAChBusB,EAAWvsB,EAAE,2BAEnBusB,EAASrhB,OACTohB,EAAYtmB,YAAY,YAExBoN,YAAW,WAGPkZ,EAAYrmB,SAAS,YACrBsmB,EAASthB,SACX","file":"index.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","/* globals wipPrefixes, issuesTribute, emojiTribute */\n/* exported timeAddManual, toggleStopwatch, cancelStopwatch, initHeatmap */\n/* exported toggleDeadlineForm, setDeadline, deleteDependencyModal, cancelCodeComment, onOAuthLoginClick */\n'use strict';\n\nfunction htmlEncode(text) {\n   return jQuery('<div />').text(text).html()\n}\n\nlet csrf;\nlet suburl;\nlet previewFileModes;\nlet simpleMDEditor;\nlet codeMirrorEditor;\n\n// Disable Dropzone auto-discover because it's manually initialized\nif (typeof(Dropzone) !== \"undefined\") {\n    Dropzone.autoDiscover = false;\n}\n\n// Polyfill for IE9+ support (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from)\nif (!Array.from) {\n    Array.from = (function () {\n        const toStr = Object.prototype.toString;\n        const isCallable = function (fn) {\n            return typeof fn === 'function' || toStr.call(fn) === '[object Function]';\n        };\n        const toInteger = function (value) {\n            const number = Number(value);\n            if (isNaN(number)) { return 0; }\n            if (number === 0 || !isFinite(number)) { return number; }\n            return (number > 0 ? 1 : -1) * Math.floor(Math.abs(number));\n        };\n        const maxSafeInteger = Math.pow(2, 53) - 1;\n        const toLength = function (value) {\n            const len = toInteger(value);\n            return Math.min(Math.max(len, 0), maxSafeInteger);\n        };\n\n        // The length property of the from method is 1.\n        return function from(arrayLike/*, mapFn, thisArg */) {\n            // 1. Let C be the this value.\n            const C = this;\n\n            // 2. Let items be ToObject(arrayLike).\n            const items = Object(arrayLike);\n\n            // 3. ReturnIfAbrupt(items).\n            if (arrayLike == null) {\n                throw new TypeError(\"Array.from requires an array-like object - not null or undefined\");\n            }\n\n            // 4. If mapfn is undefined, then let mapping be false.\n            const mapFn = arguments.length > 1 ? arguments[1] : void undefined;\n            let T;\n            if (typeof mapFn !== 'undefined') {\n                // 5. else\n                // 5. a If IsCallable(mapfn) is false, throw a TypeError exception.\n                if (!isCallable(mapFn)) {\n                    throw new TypeError('Array.from: when provided, the second argument must be a function');\n                }\n\n                // 5. b. If thisArg was supplied, let T be thisArg; else let T be undefined.\n                if (arguments.length > 2) {\n                    T = arguments[2];\n                }\n            }\n\n            // 10. Let lenValue be Get(items, \"length\").\n            // 11. Let len be ToLength(lenValue).\n            const len = toLength(items.length);\n\n            // 13. If IsConstructor(C) is true, then\n            // 13. a. Let A be the result of calling the [[Construct]] internal method of C with an argument list containing the single item len.\n            // 14. a. Else, Let A be ArrayCreate(len).\n            const A = isCallable(C) ? Object(new C(len)) : new Array(len);\n\n            // 16. Let k be 0.\n            let k = 0;\n            // 17. Repeat, while k < len… (also steps a - h)\n            let kValue;\n            while (k < len) {\n                kValue = items[k];\n                if (mapFn) {\n                    A[k] = typeof T === 'undefined' ? mapFn(kValue, k) : mapFn.call(T, kValue, k);\n                } else {\n                    A[k] = kValue;\n                }\n                k += 1;\n            }\n            // 18. Let putStatus be Put(A, \"length\", len, true).\n            A.length = len;\n            // 20. Return A.\n            return A;\n        };\n    }());\n}\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign\nif (typeof Object.assign != 'function') {\n    // Must be writable: true, enumerable: false, configurable: true\n    Object.defineProperty(Object, \"assign\", {\n        value: function assign(target, _varArgs) { // .length of function is 2\n            'use strict';\n            if (target == null) { // TypeError if undefined or null\n                throw new TypeError('Cannot convert undefined or null to object');\n            }\n\n            const to = Object(target);\n\n            for (let index = 1; index < arguments.length; index++) {\n                const nextSource = arguments[index];\n\n                if (nextSource != null) { // Skip over if undefined or null\n                    for (const nextKey in nextSource) {\n                        // Avoid bugs when hasOwnProperty is shadowed\n                        if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {\n                            to[nextKey] = nextSource[nextKey];\n                        }\n                    }\n                }\n            }\n            return to;\n        },\n        writable: true,\n        configurable: true\n    });\n}\n\nfunction initCommentPreviewTab($form) {\n    const $tabMenu = $form.find('.tabular.menu');\n    $tabMenu.find('.item').tab();\n    $tabMenu.find('.item[data-tab=\"' + $tabMenu.data('preview') + '\"]').click(function () {\n        const $this = $(this);\n        $.post($this.data('url'), {\n                \"_csrf\": csrf,\n                \"mode\": \"gfm\",\n                \"context\": $this.data('context'),\n                \"text\": $form.find('.tab.segment[data-tab=\"' + $tabMenu.data('write') + '\"] textarea').val()\n            },\n            function (data) {\n                const $previewPanel = $form.find('.tab.segment[data-tab=\"' + $tabMenu.data('preview') + '\"]');\n                $previewPanel.html(data);\n                emojify.run($previewPanel[0]);\n                $('pre code', $previewPanel[0]).each(function () {\n                    hljs.highlightBlock(this);\n                });\n            }\n        );\n    });\n\n    buttonsClickOnEnter();\n}\n\nfunction initEditPreviewTab($form) {\n    const $tabMenu = $form.find('.tabular.menu');\n    $tabMenu.find('.item').tab();\n    const $previewTab = $tabMenu.find('.item[data-tab=\"' + $tabMenu.data('preview') + '\"]');\n    if ($previewTab.length) {\n        previewFileModes = $previewTab.data('preview-file-modes').split(',');\n        $previewTab.click(function () {\n            const $this = $(this);\n            $.post($this.data('url'), {\n                    \"_csrf\": csrf,\n                    \"mode\": \"gfm\",\n                    \"context\": $this.data('context'),\n                    \"text\": $form.find('.tab.segment[data-tab=\"' + $tabMenu.data('write') + '\"] textarea').val()\n                },\n                function (data) {\n                    const $previewPanel = $form.find('.tab.segment[data-tab=\"' + $tabMenu.data('preview') + '\"]');\n                    $previewPanel.html(data);\n                    emojify.run($previewPanel[0]);\n                    $('pre code', $previewPanel[0]).each(function () {\n                        hljs.highlightBlock(this);\n                    });\n                }\n            );\n        });\n    }\n}\n\nfunction initEditDiffTab($form) {\n    const $tabMenu = $form.find('.tabular.menu');\n    $tabMenu.find('.item').tab();\n    $tabMenu.find('.item[data-tab=\"' + $tabMenu.data('diff') + '\"]').click(function () {\n        const $this = $(this);\n        $.post($this.data('url'), {\n                \"_csrf\": csrf,\n                \"context\": $this.data('context'),\n                \"content\": $form.find('.tab.segment[data-tab=\"' + $tabMenu.data('write') + '\"] textarea').val()\n            },\n            function (data) {\n                const $diffPreviewPanel = $form.find('.tab.segment[data-tab=\"' + $tabMenu.data('diff') + '\"]');\n                $diffPreviewPanel.html(data);\n                emojify.run($diffPreviewPanel[0]);\n            }\n        );\n    });\n}\n\n\nfunction initEditForm() {\n    if ($('.edit.form').length == 0) {\n        return;\n    }\n\n    initEditPreviewTab($('.edit.form'));\n    initEditDiffTab($('.edit.form'));\n}\n\nfunction initBranchSelector() {\n    const $selectBranch = $('.ui.select-branch')\n    const $branchMenu = $selectBranch.find('.reference-list-menu');\n    $branchMenu.find('.item:not(.no-select)').click(function () {\n        const selectedValue = $(this).data('id');\n        $($(this).data('id-selector')).val(selectedValue);\n        $selectBranch.find('.ui .branch-name').text(selectedValue);\n    });\n    $selectBranch.find('.reference.column').click(function () {\n        $selectBranch.find('.scrolling.reference-list-menu').css('display', 'none');\n        $selectBranch.find('.reference .text').removeClass('black');\n        $($(this).data('target')).css('display', 'block');\n        $(this).find('.text').addClass('black');\n        return false;\n    });\n}\n\nfunction updateIssuesMeta(url, action, issueIds, elementId) {\n    return new Promise(function(resolve) {\n        $.ajax({\n            type: \"POST\",\n            url: url,\n            data: {\n                \"_csrf\": csrf,\n                \"action\": action,\n                \"issue_ids\": issueIds,\n                \"id\": elementId\n            },\n            success: resolve\n        })\n    })\n}\n\nfunction initRepoStatusChecker() {\n    const migrating = $(\"#repo_migrating\");\n    $('#repo_migrating_failed').hide();\n    if (migrating) {\n        const repo_name = migrating.attr('repo');\n        if (typeof repo_name === 'undefined') {\n            return\n        }\n        $.ajax({\n            type: \"GET\",\n            url: suburl +\"/\"+repo_name+\"/status\",\n            data: {\n                \"_csrf\": csrf,\n            },\n            complete: function(xhr) {\n                if (xhr.status == 200) {\n                    if (xhr.responseJSON) {\n                        if (xhr.responseJSON[\"status\"] == 0) {\n                            location.reload();\n                            return\n                        }\n\n                        setTimeout(function () {\n                            initRepoStatusChecker()\n                        }, 2000);\n                        return\n                    }\n                }\n                $('#repo_migrating_progress').hide();\n                $('#repo_migrating_failed').show();\n            }\n        })\n    }\n}\n\nfunction initReactionSelector(parent) {\n    let reactions = '';\n    if (!parent) {\n        parent = $(document);\n        reactions = '.reactions > ';\n    }\n\n    parent.find(reactions + 'a.label').popup({'position': 'bottom left', 'metadata': {'content': 'title', 'title': 'none'}});\n\n    parent.find('.select-reaction > .menu > .item, ' + reactions + 'a.label').on('click', function(e){\n        const vm = this;\n        e.preventDefault();\n\n        if ($(this).hasClass('disabled')) return;\n\n        const actionURL = $(this).hasClass('item') ?\n                $(this).closest('.select-reaction').data('action-url') :\n                $(this).data('action-url');\n        const url = actionURL + '/' + ($(this).hasClass('blue') ? 'unreact' : 'react');\n        $.ajax({\n            type: 'POST',\n            url: url,\n            data: {\n                '_csrf': csrf,\n                'content': $(this).data('content')\n            }\n        }).done(function(resp) {\n            if (resp && (resp.html || resp.empty)) {\n                const content = $(vm).closest('.content');\n                let react = content.find('.segment.reactions');\n                if (!resp.empty && react.length > 0) {\n                    react.remove();\n                }\n                if (!resp.empty) {\n                    react = $('<div class=\"ui attached segment reactions\"></div>');\n                    const attachments = content.find('.segment.bottom:first');\n                    if (attachments.length > 0) {\n                        react.insertBefore(attachments);\n                    } else {\n                        react.appendTo(content);\n                    }\n                    react.html(resp.html);\n                    const hasEmoji = react.find('.has-emoji');\n                    for (let i = 0; i < hasEmoji.length; i++) {\n                        emojify.run(hasEmoji.get(i));\n                    }\n                    react.find('.dropdown').dropdown();\n                    initReactionSelector(react);\n                }\n            }\n        });\n    });\n}\n\nfunction insertAtCursor(field, value) {\n    if (field.selectionStart || field.selectionStart === 0) {\n        const startPos = field.selectionStart;\n        const endPos = field.selectionEnd;\n        field.value = field.value.substring(0, startPos)\n            + value\n            + field.value.substring(endPos, field.value.length);\n        field.selectionStart = startPos + value.length;\n        field.selectionEnd = startPos + value.length;\n    } else {\n        field.value += value;\n    }\n}\n\nfunction replaceAndKeepCursor(field, oldval, newval) {\n    if (field.selectionStart || field.selectionStart === 0) {\n        const startPos = field.selectionStart;\n        const endPos = field.selectionEnd;\n        field.value = field.value.replace(oldval, newval);\n        field.selectionStart = startPos + newval.length - oldval.length;\n        field.selectionEnd = endPos + newval.length - oldval.length;\n    } else {\n        field.value = field.value.replace(oldval, newval);\n    }\n}\n\nfunction retrieveImageFromClipboardAsBlob(pasteEvent, callback){\n    if (!pasteEvent.clipboardData) {\n        return;\n    }\n\n    const items = pasteEvent.clipboardData.items;\n    if (typeof(items) === \"undefined\") {\n        return;\n    }\n\n    for (let i = 0; i < items.length; i++) {\n        if (items[i].type.indexOf(\"image\") === -1) continue;\n        const blob = items[i].getAsFile();\n\n        if (typeof(callback) === \"function\") {\n            pasteEvent.preventDefault();\n            pasteEvent.stopPropagation();\n            callback(blob);\n        }\n    }\n}\n\nfunction uploadFile(file, callback) {\n    const xhr = new XMLHttpRequest();\n\n    xhr.onload = function() {\n        if (xhr.status == 200) {\n            callback(xhr.responseText);\n        }\n    };\n\n    xhr.open(\"post\", suburl + \"/attachments\", true);\n    xhr.setRequestHeader(\"X-Csrf-Token\", csrf);\n    const formData = new FormData();\n    formData.append('file', file, file.name);\n    xhr.send(formData);\n}\n\nfunction reload() {\n    window.location.reload();\n}\n\nfunction initImagePaste(target) {\n    target.each(function() {\n        const field = this;\n        field.addEventListener('paste', function(event){\n            retrieveImageFromClipboardAsBlob(event, function(img) {\n                const name = img.name.substr(0, img.name.lastIndexOf('.'));\n                insertAtCursor(field, '![' + name + ']()');\n                uploadFile(img, function(res) {\n                    const data = JSON.parse(res);\n                    replaceAndKeepCursor(field, '![' + name + ']()', '![' + name + '](' + suburl + '/attachments/' + data.uuid + ')');\n                    const input = $('<input id=\"' + data.uuid + '\" name=\"files\" type=\"hidden\">').val(data.uuid);\n                    $('.files').append(input);\n                });\n            });\n        }, false);\n    });\n}\n\nfunction initCommentForm() {\n    if ($('.comment.form').length == 0) {\n        return\n    }\n\n    initBranchSelector();\n    initCommentPreviewTab($('.comment.form'));\n    initImagePaste($('.comment.form textarea'));\n\n    // Listsubmit\n    function initListSubmits(selector, outerSelector) {\n        const $list = $('.ui.' + outerSelector + '.list');\n        const $noSelect = $list.find('.no-select');\n        const $listMenu = $('.' + selector + ' .menu');\n        let hasLabelUpdateAction = $listMenu.data('action') == 'update';\n        const labels = {};\n\n        $('.' + selector).dropdown('setting', 'onHide', function(){\n            hasLabelUpdateAction = $listMenu.data('action') == 'update'; // Update the var\n            if (hasLabelUpdateAction) {\n                const promises = [];\n                Object.keys(labels).forEach(function(elementId) {\n                    const label = labels[elementId];\n                    const promise = updateIssuesMeta(\n                        label[\"update-url\"],\n                        label[\"action\"],\n                        label[\"issue-id\"],\n                        elementId\n                    );\n                    promises.push(promise);\n                });\n                Promise.all(promises).then(reload);\n            }\n        });\n\n        $listMenu.find('.item:not(.no-select)').click(function () {\n\n            // we don't need the action attribute when updating assignees\n            if (selector == 'select-assignees-modify') {\n\n                // UI magic. We need to do this here, otherwise it would destroy the functionality of\n                // adding/removing labels\n                if ($(this).hasClass('checked')) {\n                    $(this).removeClass('checked');\n                    $(this).find('.octicon').removeClass('octicon-check');\n                } else {\n                    $(this).addClass('checked');\n                    $(this).find('.octicon').addClass('octicon-check');\n                }\n\n                updateIssuesMeta(\n                    $listMenu.data('update-url'),\n                    \"\",\n                    $listMenu.data('issue-id'),\n                    $(this).data('id')\n                );\n                $listMenu.data('action', 'update'); // Update to reload the page when we updated items\n                return false;\n            }\n\n            if ($(this).hasClass('checked')) {\n                $(this).removeClass('checked');\n                $(this).find('.octicon').removeClass('octicon-check');\n                if (hasLabelUpdateAction) {\n                    if (!($(this).data('id') in labels)) {\n                        labels[$(this).data('id')] = {\n                            \"update-url\": $listMenu.data('update-url'),\n                            \"action\": \"detach\",\n                            \"issue-id\": $listMenu.data('issue-id'),\n                        };\n                    } else {\n                        delete labels[$(this).data('id')];\n                    }\n                }\n            } else {\n                $(this).addClass('checked');\n                $(this).find('.octicon').addClass('octicon-check');\n                if (hasLabelUpdateAction) {\n                    if (!($(this).data('id') in labels)) {\n                        labels[$(this).data('id')] = {\n                            \"update-url\": $listMenu.data('update-url'),\n                            \"action\": \"attach\",\n                            \"issue-id\": $listMenu.data('issue-id'),\n                        };\n                    } else {\n                        delete labels[$(this).data('id')];\n                    }\n                }\n            }\n\n            const listIds = [];\n            $(this).parent().find('.item').each(function () {\n                if ($(this).hasClass('checked')) {\n                    listIds.push($(this).data('id'));\n                    $($(this).data('id-selector')).removeClass('hide');\n                } else {\n                    $($(this).data('id-selector')).addClass('hide');\n                }\n            });\n            if (listIds.length == 0) {\n                $noSelect.removeClass('hide');\n            } else {\n                $noSelect.addClass('hide');\n            }\n            $($(this).parent().data('id')).val(listIds.join(\",\"));\n            return false;\n        });\n        $listMenu.find('.no-select.item').click(function () {\n            if (hasLabelUpdateAction || selector == 'select-assignees-modify') {\n                updateIssuesMeta(\n                    $listMenu.data('update-url'),\n                    \"clear\",\n                    $listMenu.data('issue-id'),\n                    \"\"\n                ).then(reload);\n            }\n\n            $(this).parent().find('.item').each(function () {\n                $(this).removeClass('checked');\n                $(this).find('.octicon').removeClass('octicon-check');\n            });\n\n            $list.find('.item').each(function () {\n                $(this).addClass('hide');\n            });\n            $noSelect.removeClass('hide');\n            $($(this).parent().data('id')).val('');\n\n        });\n    }\n\n    // Init labels and assignees\n    initListSubmits('select-label', 'labels');\n    initListSubmits('select-assignees', 'assignees');\n    initListSubmits('select-assignees-modify', 'assignees');\n\n    function selectItem(select_id, input_id) {\n        const $menu = $(select_id + ' .menu');\n        const $list = $('.ui' + select_id + '.list');\n        const hasUpdateAction = $menu.data('action') == 'update';\n\n        $menu.find('.item:not(.no-select)').click(function () {\n            $(this).parent().find('.item').each(function () {\n                $(this).removeClass('selected active')\n            });\n\n            $(this).addClass('selected active');\n            if (hasUpdateAction) {\n                updateIssuesMeta(\n                    $menu.data('update-url'),\n                    \"\",\n                    $menu.data('issue-id'),\n                    $(this).data('id')\n                ).then(reload);\n            }\n            switch (input_id) {\n                case '#milestone_id':\n                    $list.find('.selected').html('<a class=\"item\" href=' + $(this).data('href') + '>' +\n                        htmlEncode($(this).text()) + '</a>');\n                    break;\n                case '#assignee_id':\n                    $list.find('.selected').html('<a class=\"item\" href=' + $(this).data('href') + '>' +\n                        '<img class=\"ui avatar image\" src=' + $(this).data('avatar') + '>' +\n                        htmlEncode($(this).text()) + '</a>');\n            }\n            $('.ui' + select_id + '.list .no-select').addClass('hide');\n            $(input_id).val($(this).data('id'));\n        });\n        $menu.find('.no-select.item').click(function () {\n            $(this).parent().find('.item:not(.no-select)').each(function () {\n                $(this).removeClass('selected active')\n            });\n\n            if (hasUpdateAction) {\n                updateIssuesMeta(\n                    $menu.data('update-url'),\n                    \"\",\n                    $menu.data('issue-id'),\n                    $(this).data('id')\n                ).then(reload);\n            }\n\n            $list.find('.selected').html('');\n            $list.find('.no-select').removeClass('hide');\n            $(input_id).val('');\n        });\n    }\n\n    // Milestone and assignee\n    selectItem('.select-milestone', '#milestone_id');\n    selectItem('.select-assignee', '#assignee_id');\n}\n\nfunction initInstall() {\n    if ($('.install').length == 0) {\n        return;\n    }\n\n    if ($('#db_host').val()==\"\") {\n        $('#db_host').val(\"127.0.0.1:3306\");\n        $('#db_user').val(\"gitea\");\n        $('#db_name').val(\"gitea\");\n    }\n\n    // Database type change detection.\n    $(\"#db_type\").change(function () {\n        const sqliteDefault = 'data/gitea.db';\n        const tidbDefault = 'data/gitea_tidb';\n\n        const dbType = $(this).val();\n        if (dbType === \"SQLite3\") {\n            $('#sql_settings').hide();\n            $('#pgsql_settings').hide();\n            $('#mysql_settings').hide();\n            $('#sqlite_settings').show();\n\n            if (dbType === \"SQLite3\" && $('#db_path').val() == tidbDefault) {\n                $('#db_path').val(sqliteDefault);\n            }\n            return;\n        }\n\n        const dbDefaults = {\n            \"MySQL\": \"127.0.0.1:3306\",\n            \"PostgreSQL\": \"127.0.0.1:5432\",\n            \"MSSQL\": \"127.0.0.1:1433\"\n        };\n\n        $('#sqlite_settings').hide();\n        $('#sql_settings').show();\n\n        $('#pgsql_settings').toggle(dbType === \"PostgreSQL\");\n        $('#mysql_settings').toggle(dbType === \"MySQL\");\n        $.each(dbDefaults, function(_type, defaultHost) {\n            if ($('#db_host').val() == defaultHost) {\n                $('#db_host').val(dbDefaults[dbType]);\n                return false;\n            }\n        });\n    });\n\n    // TODO: better handling of exclusive relations.\n    $('#offline-mode input').change(function () {\n        if ($(this).is(':checked')) {\n            $('#disable-gravatar').checkbox('check');\n            $('#federated-avatar-lookup').checkbox('uncheck');\n        }\n    });\n    $('#disable-gravatar input').change(function () {\n        if ($(this).is(':checked')) {\n            $('#federated-avatar-lookup').checkbox('uncheck');\n        } else {\n            $('#offline-mode').checkbox('uncheck');\n        }\n    });\n    $('#federated-avatar-lookup input').change(function () {\n        if ($(this).is(':checked')) {\n            $('#disable-gravatar').checkbox('uncheck');\n            $('#offline-mode').checkbox('uncheck');\n        }\n    });\n    $('#enable-openid-signin input').change(function () {\n        if ($(this).is(':checked')) {\n            if (!$('#disable-registration input').is(':checked')) {\n                $('#enable-openid-signup').checkbox('check');\n            }\n        } else {\n            $('#enable-openid-signup').checkbox('uncheck');\n        }\n    });\n    $('#disable-registration input').change(function () {\n        if ($(this).is(':checked')) {\n            $('#enable-captcha').checkbox('uncheck');\n            $('#enable-openid-signup').checkbox('uncheck');\n        } else {\n            $('#enable-openid-signup').checkbox('check');\n        }\n    });\n    $('#enable-captcha input').change(function () {\n        if ($(this).is(':checked')) {\n            $('#disable-registration').checkbox('uncheck');\n        }\n    });\n}\n\nfunction initRepository() {\n    if ($('.repository').length == 0) {\n        return;\n    }\n\n    function initFilterSearchDropdown(selector) {\n        const $dropdown = $(selector);\n        $dropdown.dropdown({\n            fullTextSearch: true,\n            selectOnKeydown: false,\n            onChange: function (_text, _value, $choice) {\n                if ($choice.data('url')) {\n                    window.location.href = $choice.data('url');\n                }\n            },\n            message: {noResults: $dropdown.data('no-results')}\n        });\n    }\n\n    // File list and commits\n    if ($('.repository.file.list').length > 0 ||\n        ('.repository.commits').length > 0) {\n        initFilterBranchTagDropdown('.choose.reference .dropdown');\n    }\n\n    // Wiki\n    if ($('.repository.wiki.view').length > 0) {\n        initFilterSearchDropdown('.choose.page .dropdown');\n    }\n\n    // Options\n    if ($('.repository.settings.options').length > 0) {\n        $('#repo_name').keyup(function () {\n            const $prompt = $('#repo-name-change-prompt');\n            if ($(this).val().toString().toLowerCase() != $(this).data('name').toString().toLowerCase()) {\n                $prompt.show();\n            } else {\n                $prompt.hide();\n            }\n        });\n\n        // Enable or select internal/external wiki system and issue tracker.\n        $('.enable-system').change(function () {\n            if (this.checked) {\n                $($(this).data('target')).removeClass('disabled');\n                if (!$(this).data('context')) $($(this).data('context')).addClass('disabled');\n            } else {\n                $($(this).data('target')).addClass('disabled');\n                if (!$(this).data('context')) $($(this).data('context')).removeClass('disabled');\n            }\n        });\n        $('.enable-system-radio').change(function () {\n            if (this.value == 'false') {\n                $($(this).data('target')).addClass('disabled');\n                if (typeof $(this).data('context') !== 'undefined') $($(this).data('context')).removeClass('disabled');\n            } else if (this.value == 'true') {\n                $($(this).data('target')).removeClass('disabled');\n                if (typeof $(this).data('context') !== 'undefined')  $($(this).data('context')).addClass('disabled');\n            }\n        });\n    }\n\n    // Labels\n    if ($('.repository.labels').length > 0) {\n        // Create label\n        const $newLabelPanel = $('.new-label.segment');\n        $('.new-label.button').click(function () {\n            $newLabelPanel.show();\n        });\n        $('.new-label.segment .cancel').click(function () {\n            $newLabelPanel.hide();\n        });\n\n        $('.color-picker').each(function () {\n            $(this).minicolors();\n        });\n        $('.precolors .color').click(function () {\n            const color_hex = $(this).data('color-hex');\n            $('.color-picker').val(color_hex);\n            $('.minicolors-swatch-color').css(\"background-color\", color_hex);\n        });\n        $('.edit-label-button').click(function () {\n            $('#label-modal-id').val($(this).data('id'));\n            $('.edit-label .new-label-input').val($(this).data('title'));\n            $('.edit-label .new-label-desc-input').val($(this).data('description'));\n            $('.edit-label .color-picker').val($(this).data('color'));\n            $('.minicolors-swatch-color').css(\"background-color\", $(this).data('color'));\n            $('.edit-label.modal').modal({\n                onApprove: function () {\n                    $('.edit-label.form').submit();\n                }\n            }).modal('show');\n            return false;\n        });\n    }\n\n    // Milestones\n    if ($('.repository.new.milestone').length > 0) {\n        const $datepicker = $('.milestone.datepicker');\n        $datepicker.datetimepicker({\n            lang: $datepicker.data('lang'),\n            inline: true,\n            timepicker: false,\n            startDate: $datepicker.data('start-date'),\n            formatDate: 'Y-m-d',\n            onSelectDate: function (ct) {\n                $('#deadline').val(ct.dateFormat('Y-m-d'));\n            }\n        });\n        $('#clear-date').click(function () {\n            $('#deadline').val('');\n            return false;\n        });\n    }\n\n    // Issues\n    if ($('.repository.view.issue').length > 0) {\n        // Edit issue title\n        const $issueTitle = $('#issue-title');\n        const $editInput = $('#edit-title-input input');\n        const editTitleToggle = function () {\n            $issueTitle.toggle();\n            $('.not-in-edit').toggle();\n            $('#edit-title-input').toggle();\n            $('.in-edit').toggle();\n            $editInput.focus();\n            return false;\n        };\n        $('#edit-title').click(editTitleToggle);\n        $('#cancel-edit-title').click(editTitleToggle);\n        $('#save-edit-title').click(editTitleToggle).click(function () {\n            if ($editInput.val().length == 0 ||\n                $editInput.val() == $issueTitle.text()) {\n                $editInput.val($issueTitle.text());\n                return false;\n            }\n\n            $.post($(this).data('update-url'), {\n                    \"_csrf\": csrf,\n                    \"title\": $editInput.val()\n                },\n                function (data) {\n                    $editInput.val(data.title);\n                    $issueTitle.text(data.title);\n                    reload();\n                });\n            return false;\n        });\n\n        // Edit issue or comment content\n        $('.edit-content').click(function () {\n            const $segment = $(this).parent().parent().parent().next();\n            const $editContentZone = $segment.find('.edit-content-zone');\n            const $renderContent = $segment.find('.render-content');\n            const $rawContent = $segment.find('.raw-content');\n            let $textarea;\n\n            // Setup new form\n            if ($editContentZone.html().length == 0) {\n                $editContentZone.html($('#edit-content-form').html());\n                $textarea = $editContentZone.find('textarea');\n                issuesTribute.attach($textarea.get());\n                emojiTribute.attach($textarea.get());\n\n                const $dropzone = $editContentZone.find('.dropzone');\n                $dropzone.data(\"saved\", false);\n                const $files = $editContentZone.find('.comment-files');\n                if ($dropzone.length > 0) {\n                    const filenameDict = {};\n                    $dropzone.dropzone({\n                        url: $dropzone.data('upload-url'),\n                        headers: {\"X-Csrf-Token\": csrf},\n                        maxFiles: $dropzone.data('max-file'),\n                        maxFilesize: $dropzone.data('max-size'),\n                        acceptedFiles: ($dropzone.data('accepts') === '*/*') ? null : $dropzone.data('accepts'),\n                        addRemoveLinks: true,\n                        dictDefaultMessage: $dropzone.data('default-message'),\n                        dictInvalidFileType: $dropzone.data('invalid-input-type'),\n                        dictFileTooBig: $dropzone.data('file-too-big'),\n                        dictRemoveFile: $dropzone.data('remove-file'),\n                        init: function () {\n                            this.on(\"success\", function (file, data) {\n                                filenameDict[file.name] = {\n                                    \"uuid\": data.uuid,\n                                    \"submitted\": false\n                                }\n                                const input = $('<input id=\"' + data.uuid + '\" name=\"files\" type=\"hidden\">').val(data.uuid);\n                                $files.append(input);\n                            });\n                            this.on(\"removedfile\", function (file) {\n                                if (!(file.name in filenameDict)) {\n                                    return;\n                                }\n                                $('#' + filenameDict[file.name].uuid).remove();\n                                if ($dropzone.data('remove-url') && $dropzone.data('csrf') && !filenameDict[file.name].submitted) {\n                                    $.post($dropzone.data('remove-url'), {\n                                        file: filenameDict[file.name].uuid,\n                                        _csrf: $dropzone.data('csrf')\n                                    });\n                                }\n                            });\n                            this.on(\"submit\", function () {\n                                $.each(filenameDict, function(name){\n                                    filenameDict[name].submitted = true;\n                                });\n                            });\n                            this.on(\"reload\", function (){\n                                $.getJSON($editContentZone.data('attachment-url'), function(data){\n                                    const drop = $dropzone.get(0).dropzone;\n                                    drop.removeAllFiles(true);\n                                    $files.empty();\n                                    $.each(data, function(){\n                                        const imgSrc =  $dropzone.data('upload-url') + \"/\" + this.uuid;\n                                        drop.emit(\"addedfile\", this);\n                                        drop.emit(\"thumbnail\", this, imgSrc);\n                                        drop.emit(\"complete\", this);\n                                        drop.files.push(this);\n                                        filenameDict[this.name] = {\n                                            \"submitted\": true,\n                                            \"uuid\": this.uuid\n                                        }\n                                        $dropzone.find(\"img[src='\" + imgSrc + \"']\").css(\"max-width\", \"100%\");\n                                        const input = $('<input id=\"' + this.uuid + '\" name=\"files\" type=\"hidden\">').val(this.uuid);\n                                        $files.append(input);\n                                    });\n                                });\n                            });\n                        }\n                    });\n                    $dropzone.get(0).dropzone.emit(\"reload\");\n                }\n                // Give new write/preview data-tab name to distinguish from others\n                const $editContentForm = $editContentZone.find('.ui.comment.form');\n                const $tabMenu = $editContentForm.find('.tabular.menu');\n                $tabMenu.attr('data-write', $editContentZone.data('write'));\n                $tabMenu.attr('data-preview', $editContentZone.data('preview'));\n                $tabMenu.find('.write.item').attr('data-tab', $editContentZone.data('write'));\n                $tabMenu.find('.preview.item').attr('data-tab', $editContentZone.data('preview'));\n                $editContentForm.find('.write.segment').attr('data-tab', $editContentZone.data('write'));\n                $editContentForm.find('.preview.segment').attr('data-tab', $editContentZone.data('preview'));\n\n                initCommentPreviewTab($editContentForm);\n\n                $editContentZone.find('.cancel.button').click(function () {\n                    $renderContent.show();\n                    $editContentZone.hide();\n                    $dropzone.get(0).dropzone.emit(\"reload\");\n                });\n                $editContentZone.find('.save.button').click(function () {\n                    $renderContent.show();\n                    $editContentZone.hide();\n                    const $attachments = $files.find(\"[name=files]\").map(function(){\n                        return $(this).val();\n                    }).get();\n                    $.post($editContentZone.data('update-url'), {\n                        \"_csrf\": csrf,\n                        \"content\": $textarea.val(),\n                        \"context\": $editContentZone.data('context'),\n                        \"files\": $attachments\n                    },\n                    function (data) {\n                        if (data.length == 0) {\n                            $renderContent.html($('#no-content').html());\n                        } else {\n                            $renderContent.html(data.content);\n                            emojify.run($renderContent[0]);\n                            $('pre code', $renderContent[0]).each(function () {\n                                hljs.highlightBlock(this);\n                            });\n                        }\n                        const $content = $segment.parent();\n                        if(!$content.find(\".ui.small.images\").length){\n                            if(data.attachments != \"\"){\n                                $content.append(\n                                '<div class=\"ui bottom attached segment\">' +\n                                '    <div class=\"ui small images\">' +\n                                '    </div>' +\n                                '</div>'\n                                );\n                                $content.find(\".ui.small.images\").html(data.attachments);\n                            }\n                        } else if (data.attachments == \"\") {\n                            $content.find(\".ui.small.images\").parent().remove();\n                        } else {\n                            $content.find(\".ui.small.images\").html(data.attachments);\n                        }\n                        $dropzone.get(0).dropzone.emit(\"submit\");\n                        $dropzone.get(0).dropzone.emit(\"reload\");\n                    });\n                });\n            } else {\n                $textarea = $segment.find('textarea');\n            }\n\n            // Show write/preview tab and copy raw content as needed\n            $editContentZone.show();\n            $renderContent.hide();\n            if ($textarea.val().length == 0) {\n                $textarea.val($rawContent.text());\n            }\n            $textarea.focus();\n            return false;\n        });\n\n        // Delete comment\n        $('.delete-comment').click(function () {\n            const $this = $(this);\n            if (confirm($this.data('locale'))) {\n                $.post($this.data('url'), {\n                    \"_csrf\": csrf\n                }).success(function () {\n                    $('#' + $this.data('comment-id')).remove();\n                });\n            }\n            return false;\n        });\n\n        // Change status\n        const $statusButton = $('#status-button');\n        $('#comment-form .edit_area').keyup(function () {\n            if ($(this).val().length == 0) {\n                $statusButton.text($statusButton.data('status'))\n            } else {\n                $statusButton.text($statusButton.data('status-and-comment'))\n            }\n        });\n        $statusButton.click(function () {\n            $('#status').val($statusButton.data('status-val'));\n            $('#comment-form').submit();\n        });\n\n        // Pull Request merge button\n        const $mergeButton = $('.merge-button > button');\n        $mergeButton.on('click', function(e) {\n            e.preventDefault();\n            $('.' + $(this).data('do') + '-fields').show();\n            $(this).parent().hide();\n        });\n        $('.merge-button > .dropdown').dropdown({\n            onChange: function (_text, _value, $choice) {\n                if ($choice.data('do')) {\n                    $mergeButton.find('.button-text').text($choice.text());\n                    $mergeButton.data('do', $choice.data('do'));\n                }\n            }\n        });\n        $('.merge-cancel').on('click', function(e) {\n            e.preventDefault();\n            $(this).closest('.form').hide();\n            $mergeButton.parent().show();\n        });\n\n        initReactionSelector();\n    }\n\n    // Diff\n    if ($('.repository.diff').length > 0) {\n        $('.diff-counter').each(function () {\n            const $item = $(this);\n            const addLine = $item.find('span[data-line].add').data(\"line\");\n            const delLine = $item.find('span[data-line].del').data(\"line\");\n            const addPercent = parseFloat(addLine) / (parseFloat(addLine) + parseFloat(delLine)) * 100;\n            $item.find(\".bar .add\").css(\"width\", addPercent + \"%\");\n        });\n    }\n\n    // Quick start and repository home\n    $('#repo-clone-ssh').click(function () {\n        $('.clone-url').text($(this).data('link'));\n        $('#repo-clone-url').val($(this).data('link'));\n        $(this).addClass('blue');\n        $('#repo-clone-https').removeClass('blue');\n        localStorage.setItem('repo-clone-protocol', 'ssh');\n    });\n    $('#repo-clone-https').click(function () {\n        $('.clone-url').text($(this).data('link'));\n        $('#repo-clone-url').val($(this).data('link'));\n        $(this).addClass('blue');\n        $('#repo-clone-ssh').removeClass('blue');\n        localStorage.setItem('repo-clone-protocol', 'https');\n    });\n    $('#repo-clone-url').click(function () {\n        $(this).select();\n    });\n\n    // Pull request\n    const $repoComparePull = $('.repository.compare.pull');\n    if ($repoComparePull.length > 0) {\n        initFilterSearchDropdown('.choose.branch .dropdown');\n        // show pull request form\n        $repoComparePull.find('button.show-form').on('click', function(e) {\n            e.preventDefault();\n            $repoComparePull.find('.pullrequest-form').show();\n            $(this).parent().hide();\n        });\n    }\n\n    // Branches\n    if ($('.repository.settings.branches').length > 0) {\n        initFilterSearchDropdown('.protected-branches .dropdown');\n        $('.enable-protection, .enable-whitelist').change(function () {\n            if (this.checked) {\n                $($(this).data('target')).removeClass('disabled');\n            } else {\n                $($(this).data('target')).addClass('disabled');\n            }\n        });\n    }\n}\n\nfunction initMigration() {\n    const toggleMigrations = function() {\n        const authUserName = $('#auth_username').val();\n        const cloneAddr = $('#clone_addr').val();\n        if (!$('#mirror').is(\":checked\") && (authUserName!=undefined && authUserName.length > 0)\n        && (cloneAddr!=undefined && (cloneAddr.startsWith(\"https://github.com\") || cloneAddr.startsWith(\"http://github.com\")))) {\n            $('#migrate_items').show();\n        } else {\n            $('#migrate_items').hide();\n        }\n    }\n\n    toggleMigrations();\n\n    $('#clone_addr').on('input', toggleMigrations)\n    $('#auth_username').on('input', toggleMigrations)\n    $('#mirror').on('change', toggleMigrations)\n}\n\nfunction initPullRequestReview() {\n    $('.show-outdated').on('click', function (e) {\n        e.preventDefault();\n        const id = $(this).data('comment');\n        $(this).addClass(\"hide\");\n        $(\"#code-comments-\" + id).removeClass('hide');\n        $(\"#code-preview-\" + id).removeClass('hide');\n        $(\"#hide-outdated-\" + id).removeClass('hide');\n    });\n\n    $('.hide-outdated').on('click', function (e) {\n        e.preventDefault();\n        const id = $(this).data('comment');\n        $(this).addClass(\"hide\");\n        $(\"#code-comments-\" + id).addClass('hide');\n        $(\"#code-preview-\" + id).addClass('hide');\n        $(\"#show-outdated-\" + id).removeClass('hide');\n    });\n\n    $('button.comment-form-reply').on('click', function (e) {\n        e.preventDefault();\n        $(this).hide();\n        const form = $(this).parent().find('.comment-form')\n        form.removeClass('hide');\n        assingMenuAttributes(form.find('.menu'));\n    });\n    // The following part is only for diff views\n    if ($('.repository.pull.diff').length == 0) {\n        return;\n    }\n\n    $('.diff-detail-box.ui.sticky').sticky();\n\n    $('.btn-review').on('click', function(e) {\n        e.preventDefault();\n        $(this).closest('.dropdown').find('.menu').toggle('visible');\n    }).closest('.dropdown').find('.link.close').on('click', function(e) {\n        e.preventDefault();\n        $(this).closest('.menu').toggle('visible');\n    });\n\n    $('.code-view .lines-code,.code-view .lines-num')\n        .on('mouseenter', function() {\n            const parent = $(this).closest('td');\n            $(this).closest('tr').addClass(\n                parent.hasClass('lines-num-old') || parent.hasClass('lines-code-old')\n                    ? 'focus-lines-old' : 'focus-lines-new'\n            );\n        })\n        .on('mouseleave', function() {\n            $(this).closest('tr').removeClass('focus-lines-new focus-lines-old');\n        });\n    $('.add-code-comment').on('click', function(e) {\n        // https://github.com/go-gitea/gitea/issues/4745\n        if ($(e.target).hasClass('btn-add-single')) {\n          return;\n        }\n        e.preventDefault();\n        const isSplit = $(this).closest('.code-diff').hasClass('code-diff-split');\n        const side = $(this).data('side');\n        const idx = $(this).data('idx');\n        const path = $(this).data('path');\n        const form = $('#pull_review_add_comment').html();\n        const tr = $(this).closest('tr');\n        let ntr = tr.next();\n        if (!ntr.hasClass('add-comment')) {\n            ntr = $('<tr class=\"add-comment\">'\n                    + (isSplit ? '<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>'\n                               : '<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>')\n                    + '</tr>');\n            tr.after(ntr);\n        }\n        const td = ntr.find('.add-comment-' + side);\n        let commentCloud = td.find('.comment-code-cloud');\n        if (commentCloud.length === 0) {\n            td.html(form);\n            commentCloud = td.find('.comment-code-cloud');\n            assingMenuAttributes(commentCloud.find('.menu'));\n\n            td.find(\"input[name='line']\").val(idx);\n            td.find(\"input[name='side']\").val(side === \"left\" ? \"previous\":\"proposed\");\n            td.find(\"input[name='path']\").val(path);\n        }\n        commentCloud.find('textarea').focus();\n    });\n}\n\nfunction assingMenuAttributes(menu) {\n    const id = Math.floor(Math.random() * Math.floor(1000000));\n    menu.attr('data-write', menu.attr('data-write') + id);\n    menu.attr('data-preview', menu.attr('data-preview') + id);\n    menu.find('.item').each(function() {\n        const tab = $(this).attr('data-tab') + id;\n        $(this).attr('data-tab', tab);\n    });\n    menu.parent().find(\"*[data-tab='write']\").attr('data-tab', 'write' + id);\n    menu.parent().find(\"*[data-tab='preview']\").attr('data-tab', 'preview' + id);\n    initCommentPreviewTab(menu.parent(\".form\"));\n    return id;\n}\n\nfunction initRepositoryCollaboration() {\n    // Change collaborator access mode\n    $('.access-mode.menu .item').click(function () {\n        const $menu = $(this).parent();\n        $.post($menu.data('url'), {\n            \"_csrf\": csrf,\n            \"uid\": $menu.data('uid'),\n            \"mode\": $(this).data('value')\n        })\n    });\n}\n\nfunction initTeamSettings() {\n    // Change team access mode\n    $('.organization.new.team input[name=permission]').change(function () {\n        const val = $('input[name=permission]:checked', '.organization.new.team').val()\n        if (val === 'admin') {\n            $('.organization.new.team .team-units').hide();\n        } else {\n            $('.organization.new.team .team-units').show();\n        }\n    });\n}\n\nfunction initWikiForm() {\n    const $editArea = $('.repository.wiki textarea#edit_area');\n    if ($editArea.length > 0) {\n        const simplemde = new SimpleMDE({\n            autoDownloadFontAwesome: false,\n            element: $editArea[0],\n            forceSync: true,\n            previewRender: function (plainText, preview) { // Async method\n                setTimeout(function () {\n                    // FIXME: still send render request when return back to edit mode\n                    $.post($editArea.data('url'), {\n                            \"_csrf\": csrf,\n                            \"mode\": \"gfm\",\n                            \"context\": $editArea.data('context'),\n                            \"text\": plainText\n                        },\n                        function (data) {\n                            preview.innerHTML = '<div class=\"markdown ui segment\">' + data + '</div>';\n                            emojify.run($('.editor-preview')[0]);\n                        }\n                    );\n                }, 0);\n\n                return \"Loading...\";\n            },\n            renderingConfig: {\n                singleLineBreaks: false\n            },\n            indentWithTabs: false,\n            tabSize: 4,\n            spellChecker: false,\n            toolbar: [\"bold\", \"italic\", \"strikethrough\", \"|\",\n                \"heading-1\", \"heading-2\", \"heading-3\", \"heading-bigger\", \"heading-smaller\", \"|\",\n                {\n                    name: \"code-inline\",\n                    action: function(e){\n                        const cm = e.codemirror;\n                        const selection = cm.getSelection();\n                        cm.replaceSelection(\"`\" + selection + \"`\");\n                        if (!selection) {\n                            const cursorPos = cm.getCursor();\n                            cm.setCursor(cursorPos.line, cursorPos.ch - 1);\n                        }\n                        cm.focus();\n                    },\n                    className: \"fa fa-angle-right\",\n                    title: \"Add Inline Code\",\n                },\"code\", \"quote\", \"|\", {\n                    name: \"checkbox-empty\",\n                    action: function(e){\n                        const cm = e.codemirror;\n                        cm.replaceSelection(\"\\n- [ ] \" + cm.getSelection());\n                        cm.focus();\n                    },\n                    className: \"fa fa-square-o\",\n                    title: \"Add Checkbox (empty)\",\n                },\n                {\n                    name: \"checkbox-checked\",\n                    action: function(e){\n                        const cm = e.codemirror;\n                        cm.replaceSelection(\"\\n- [x] \" + cm.getSelection());\n                        cm.focus();\n                    },\n                    className: \"fa fa-check-square-o\",\n                    title: \"Add Checkbox (checked)\",\n                }, \"|\",\n                \"unordered-list\", \"ordered-list\", \"|\",\n                \"link\", \"image\", \"table\", \"horizontal-rule\", \"|\",\n                \"clean-block\", \"preview\", \"fullscreen\"]\n        })\n        $(simplemde.codemirror.getInputField()).addClass(\"js-quick-submit\");\n    }\n}\n\n// For IE\nString.prototype.endsWith = function (pattern) {\n    const d = this.length - pattern.length;\n    return d >= 0 && this.lastIndexOf(pattern) === d;\n};\n\n// Adding function to get the cursor position in a text field to jQuery object.\n$.fn.getCursorPosition = function () {\n    const el = $(this).get(0);\n    let pos = 0;\n    if ('selectionStart' in el) {\n        pos = el.selectionStart;\n    } else if ('selection' in document) {\n        el.focus();\n        const Sel = document.selection.createRange();\n        const SelLength = document.selection.createRange().text.length;\n        Sel.moveStart('character', -el.value.length);\n        pos = Sel.text.length - SelLength;\n    }\n    return pos;\n}\n\nfunction setSimpleMDE($editArea) {\n    if (codeMirrorEditor) {\n        codeMirrorEditor.toTextArea();\n        codeMirrorEditor = null;\n    }\n\n    if (simpleMDEditor) {\n        return true;\n    }\n\n    simpleMDEditor = new SimpleMDE({\n        autoDownloadFontAwesome: false,\n        element: $editArea[0],\n        forceSync: true,\n        renderingConfig: {\n            singleLineBreaks: false\n        },\n        indentWithTabs: false,\n        tabSize: 4,\n        spellChecker: false,\n        previewRender: function (plainText, preview) { // Async method\n            setTimeout(function () {\n                // FIXME: still send render request when return back to edit mode\n                $.post($editArea.data('url'), {\n                        \"_csrf\": csrf,\n                        \"mode\": \"gfm\",\n                        \"context\": $editArea.data('context'),\n                        \"text\": plainText\n                    },\n                    function (data) {\n                        preview.innerHTML = '<div class=\"markdown ui segment\">' + data + '</div>';\n                        emojify.run($('.editor-preview')[0]);\n                    }\n                );\n            }, 0);\n\n            return \"Loading...\";\n        },\n        toolbar: [\"bold\", \"italic\", \"strikethrough\", \"|\",\n            \"heading-1\", \"heading-2\", \"heading-3\", \"heading-bigger\", \"heading-smaller\", \"|\",\n            \"code\", \"quote\", \"|\",\n            \"unordered-list\", \"ordered-list\", \"|\",\n            \"link\", \"image\", \"table\", \"horizontal-rule\", \"|\",\n            \"clean-block\", \"preview\", \"fullscreen\", \"side-by-side\"]\n    });\n\n    return true;\n}\n\nfunction setCodeMirror($editArea) {\n    if (simpleMDEditor) {\n        simpleMDEditor.toTextArea();\n        simpleMDEditor = null;\n    }\n\n    if (codeMirrorEditor) {\n        return true;\n    }\n\n    codeMirrorEditor = CodeMirror.fromTextArea($editArea[0], {\n        lineNumbers: true\n    });\n    codeMirrorEditor.on(\"change\", function (cm, _change) {\n        $editArea.val(cm.getValue());\n    });\n\n    return true;\n}\n\nfunction initEditor() {\n    $('.js-quick-pull-choice-option').change(function () {\n        if ($(this).val() == 'commit-to-new-branch') {\n            $('.quick-pull-branch-name').show();\n            $('.quick-pull-branch-name input').prop('required',true);\n        } else {\n            $('.quick-pull-branch-name').hide();\n            $('.quick-pull-branch-name input').prop('required',false);\n        }\n        $('#commit-button').text($(this).attr('button_text'));\n    });\n\n    const $editFilename = $(\"#file-name\");\n    $editFilename.keyup(function (e) {\n        const $section = $('.breadcrumb span.section');\n        const $divider = $('.breadcrumb div.divider');\n        let value;\n        let parts;\n\n        if (e.keyCode == 8) {\n            if ($(this).getCursorPosition() == 0) {\n                if ($section.length > 0) {\n                    value = $section.last().find('a').text();\n                    $(this).val(value + $(this).val());\n                    $(this)[0].setSelectionRange(value.length, value.length);\n                    $section.last().remove();\n                    $divider.last().remove();\n                }\n            }\n        }\n        if (e.keyCode == 191) {\n            parts = $(this).val().split('/');\n            for (let i = 0; i < parts.length; ++i) {\n                value = parts[i];\n                if (i < parts.length - 1) {\n                    if (value.length) {\n                        $('<span class=\"section\"><a href=\"#\">' + value + '</a></span>').insertBefore($(this));\n                        $('<div class=\"divider\"> / </div>').insertBefore($(this));\n                    }\n                }\n                else {\n                    $(this).val(value);\n                }\n                $(this)[0].setSelectionRange(0, 0);\n            }\n        }\n        parts = [];\n        $('.breadcrumb span.section').each(function () {\n            const element = $(this);\n            if (element.find('a').length) {\n                parts.push(element.find('a').text());\n            } else {\n                parts.push(element.text());\n            }\n        });\n        if ($(this).val())\n            parts.push($(this).val());\n        $('#tree_path').val(parts.join('/'));\n    }).trigger('keyup');\n\n    const $editArea = $('.repository.editor textarea#edit_area');\n    if (!$editArea.length)\n        return;\n\n    const markdownFileExts = $editArea.data(\"markdown-file-exts\").split(\",\");\n    const lineWrapExtensions = $editArea.data(\"line-wrap-extensions\").split(\",\");\n\n    $editFilename.on(\"keyup\", function () {\n        const val = $editFilename.val();\n        let mode, spec, extension, extWithDot, dataUrl, apiCall;\n\n        extension = extWithDot = \"\";\n        const m = /.+\\.([^.]+)$/.exec(val);\n        if (m) {\n            extension = m[1];\n            extWithDot = \".\" + extension;\n        }\n\n        const info = CodeMirror.findModeByExtension(extension);\n        const previewLink = $('a[data-tab=preview]');\n        if (info) {\n            mode = info.mode;\n            spec = info.mime;\n            apiCall = mode;\n        }\n        else {\n            apiCall = extension\n        }\n\n        if (previewLink.length && apiCall && previewFileModes && previewFileModes.length && previewFileModes.indexOf(apiCall) >= 0) {\n            dataUrl = previewLink.data('url');\n            previewLink.data('url', dataUrl.replace(/(.*)\\/.*/i, '$1/' + mode));\n            previewLink.show();\n        }\n        else {\n            previewLink.hide();\n        }\n\n        // If this file is a Markdown extensions, we will load that editor and return\n        if (markdownFileExts.indexOf(extWithDot) >= 0) {\n            if (setSimpleMDE($editArea)) {\n                return;\n            }\n        }\n\n        // Else we are going to use CodeMirror\n        if (!codeMirrorEditor && !setCodeMirror($editArea)) {\n            return;\n        }\n\n        if (mode) {\n            codeMirrorEditor.setOption(\"mode\", spec);\n            CodeMirror.autoLoadMode(codeMirrorEditor, mode);\n        }\n\n        if (lineWrapExtensions.indexOf(extWithDot) >= 0) {\n            codeMirrorEditor.setOption(\"lineWrapping\", true);\n        }\n        else {\n            codeMirrorEditor.setOption(\"lineWrapping\", false);\n        }\n\n        // get the filename without any folder\n        let value = $editFilename.val();\n        if (value.length === 0) {\n            return;\n        }\n        value = value.split('/');\n        value = value[value.length - 1];\n\n        $.getJSON($editFilename.data('ec-url-prefix')+value, function(editorconfig) {\n            if (editorconfig.indent_style === 'tab') {\n                codeMirrorEditor.setOption(\"indentWithTabs\", true);\n                codeMirrorEditor.setOption('extraKeys', {});\n            } else {\n                codeMirrorEditor.setOption(\"indentWithTabs\", false);\n                // required because CodeMirror doesn't seems to use spaces correctly for {\"indentWithTabs\": false}:\n                // - https://github.com/codemirror/CodeMirror/issues/988\n                // - https://codemirror.net/doc/manual.html#keymaps\n                codeMirrorEditor.setOption('extraKeys', {\n                    Tab: function(cm) {\n                        const spaces = Array(parseInt(cm.getOption(\"indentUnit\")) + 1).join(\" \");\n                        cm.replaceSelection(spaces);\n                    }\n                });\n            }\n            codeMirrorEditor.setOption(\"indentUnit\", editorconfig.indent_size || 4);\n            codeMirrorEditor.setOption(\"tabSize\", editorconfig.tab_width || 4);\n        });\n    }).trigger('keyup');\n\n    // Using events from https://github.com/codedance/jquery.AreYouSure#advanced-usage\n    // to enable or disable the commit button\n    const $commitButton = $('#commit-button');\n    const $editForm = $('.ui.edit.form');\n    const dirtyFileClass = 'dirty-file';\n\n    // Disabling the button at the start\n    $commitButton.prop('disabled', true);\n\n    // Registering a custom listener for the file path and the file content\n    $editForm.areYouSure({\n        silent: true,\n        dirtyClass: dirtyFileClass,\n        fieldSelector: ':input:not(.commit-form-wrapper :input)',\n        change: function () {\n            const dirty = $(this).hasClass(dirtyFileClass);\n            $commitButton.prop('disabled', !dirty);\n        }\n    });\n\n    $commitButton.click(function (event) {\n        // A modal which asks if an empty file should be committed\n        if ($editArea.val().length === 0) {\n            $('#edit-empty-content-modal').modal({\n                onApprove: function () {\n                    $('.edit.form').submit();\n                }\n            }).modal('show');\n            event.preventDefault();\n        }\n    });\n}\n\nfunction initOrganization() {\n    if ($('.organization').length == 0) {\n        return;\n    }\n\n    // Options\n    if ($('.organization.settings.options').length > 0) {\n        $('#org_name').keyup(function () {\n            const $prompt = $('#org-name-change-prompt');\n            if ($(this).val().toString().toLowerCase() != $(this).data('org-name').toString().toLowerCase()) {\n                $prompt.show();\n            } else {\n                $prompt.hide();\n            }\n        });\n    }\n}\n\nfunction initUserSettings() {\n    // Options\n    if ($('.user.settings.profile').length > 0) {\n        $('#username').keyup(function () {\n            const $prompt = $('#name-change-prompt');\n            if ($(this).val().toString().toLowerCase() != $(this).data('name').toString().toLowerCase()) {\n                $prompt.show();\n            } else {\n                $prompt.hide();\n            }\n        });\n    }\n}\n\nfunction initWebhook() {\n    if ($('.new.webhook').length == 0) {\n        return;\n    }\n\n    $('.events.checkbox input').change(function () {\n        if ($(this).is(':checked')) {\n            $('.events.fields').show();\n        }\n    });\n    $('.non-events.checkbox input').change(function () {\n        if ($(this).is(':checked')) {\n            $('.events.fields').hide();\n        }\n    });\n\n    const updateContentType = function () {\n        const visible = $('#http_method').val() === 'POST';\n        $('#content_type').parent().parent()[visible ? 'show' : 'hide']();\n    };\n    updateContentType();\n    $('#http_method').change(function () {\n        updateContentType();\n    });\n\n    // Test delivery\n    $('#test-delivery').click(function () {\n        const $this = $(this);\n        $this.addClass('loading disabled');\n        $.post($this.data('link'), {\n            \"_csrf\": csrf\n        }).done(\n            setTimeout(function () {\n                window.location.href = $this.data('redirect');\n            }, 5000)\n        )\n    });\n}\n\nfunction initAdmin() {\n    if ($('.admin').length == 0) {\n        return;\n    }\n\n    // New user\n    if ($('.admin.new.user').length > 0 ||\n        $('.admin.edit.user').length > 0) {\n        $('#login_type').change(function () {\n            if ($(this).val().substring(0, 1) == '0') {\n                $('#login_name').removeAttr('required');\n                $('.non-local').hide();\n                $('.local').show();\n                $('#user_name').focus();\n\n                if ($(this).data('password') == \"required\") {\n                    $('#password').attr('required', 'required');\n                }\n\n            } else {\n                $('#login_name').attr('required', 'required');\n                $('.non-local').show();\n                $('.local').hide();\n                $('#login_name').focus();\n\n                $('#password').removeAttr('required');\n            }\n        });\n    }\n\n    function onSecurityProtocolChange() {\n        if ($('#security_protocol').val() > 0) {\n            $('.has-tls').show();\n        } else {\n            $('.has-tls').hide();\n        }\n    }\n\n    function onUsePagedSearchChange() {\n        if ($('#use_paged_search').prop('checked')) {\n            $('.search-page-size').show()\n                .find('input').attr('required', 'required');\n        } else {\n            $('.search-page-size').hide()\n                .find('input').removeAttr('required');\n        }\n    }\n\n    function onOAuth2Change() {\n        $('.open_id_connect_auto_discovery_url, .oauth2_use_custom_url').hide();\n        $('.open_id_connect_auto_discovery_url input[required]').removeAttr('required');\n\n        const provider = $('#oauth2_provider').val();\n        switch (provider) {\n            case 'github':\n            case 'gitlab':\n            case 'gitea':\n                $('.oauth2_use_custom_url').show();\n                break;\n            case 'openidConnect':\n                $('.open_id_connect_auto_discovery_url input').attr('required', 'required');\n                $('.open_id_connect_auto_discovery_url').show();\n                break;\n        }\n        onOAuth2UseCustomURLChange();\n    }\n\n    function onOAuth2UseCustomURLChange() {\n        const provider = $('#oauth2_provider').val();\n        $('.oauth2_use_custom_url_field').hide();\n        $('.oauth2_use_custom_url_field input[required]').removeAttr('required');\n\n        if ($('#oauth2_use_custom_url').is(':checked')) {\n            if (!$('#oauth2_token_url').val()) {\n                $('#oauth2_token_url').val($('#' + provider + '_token_url').val());\n            }\n            if (!$('#oauth2_auth_url').val()) {\n                $('#oauth2_auth_url').val($('#' + provider + '_auth_url').val());\n            }\n            if (!$('#oauth2_profile_url').val()) {\n                $('#oauth2_profile_url').val($('#' + provider + '_profile_url').val());\n            }\n            if (!$('#oauth2_email_url').val()) {\n                $('#oauth2_email_url').val($('#' + provider + '_email_url').val());\n            }\n            switch (provider) {\n                case 'github':\n                    $('.oauth2_token_url input, .oauth2_auth_url input, .oauth2_profile_url input, .oauth2_email_url input').attr('required', 'required');\n                    $('.oauth2_token_url, .oauth2_auth_url, .oauth2_profile_url, .oauth2_email_url').show();\n                    break;\n                case 'gitea':\n                case 'gitlab':\n                    $('.oauth2_token_url input, .oauth2_auth_url input, .oauth2_profile_url input').attr('required', 'required');\n                    $('.oauth2_token_url, .oauth2_auth_url, .oauth2_profile_url').show();\n                    $('#oauth2_email_url').val('');\n                    break;\n            }\n        }\n    }\n\n    // New authentication\n    if ($('.admin.new.authentication').length > 0) {\n        $('#auth_type').change(function () {\n            $('.ldap, .dldap, .smtp, .pam, .oauth2, .has-tls .search-page-size').hide();\n\n            $('.ldap input[required], .binddnrequired input[required], .dldap input[required], .smtp input[required], .pam input[required], .oauth2 input[required], .has-tls input[required]').removeAttr('required');\n            $('.binddnrequired').removeClass(\"required\");\n\n            const authType = $(this).val();\n            switch (authType) {\n                case '2':     // LDAP\n                    $('.ldap').show();\n                    $('.binddnrequired input, .ldap div.required:not(.dldap) input').attr('required', 'required');\n                    $('.binddnrequired').addClass(\"required\");\n                    break;\n                case '3':     // SMTP\n                    $('.smtp').show();\n                    $('.has-tls').show();\n                    $('.smtp div.required input, .has-tls').attr('required', 'required');\n                    break;\n                case '4':     // PAM\n                    $('.pam').show();\n                    $('.pam input').attr('required', 'required');\n                    break;\n                case '5':     // LDAP\n                    $('.dldap').show();\n                    $('.dldap div.required:not(.ldap) input').attr('required', 'required');\n                    break;\n                case '6':     // OAuth2\n                    $('.oauth2').show();\n                    $('.oauth2 div.required:not(.oauth2_use_custom_url,.oauth2_use_custom_url_field,.open_id_connect_auto_discovery_url) input').attr('required', 'required');\n                    onOAuth2Change();\n                    break;\n            }\n            if (authType == '2' || authType == '5') {\n                onSecurityProtocolChange()\n            }\n            if (authType == '2') {\n                onUsePagedSearchChange();\n            }\n        });\n        $('#auth_type').change();\n        $('#security_protocol').change(onSecurityProtocolChange);\n        $('#use_paged_search').change(onUsePagedSearchChange);\n        $('#oauth2_provider').change(onOAuth2Change);\n        $('#oauth2_use_custom_url').change(onOAuth2UseCustomURLChange);\n    }\n    // Edit authentication\n    if ($('.admin.edit.authentication').length > 0) {\n        const authType = $('#auth_type').val();\n        if (authType == '2' || authType == '5') {\n            $('#security_protocol').change(onSecurityProtocolChange);\n            if (authType == '2') {\n                $('#use_paged_search').change(onUsePagedSearchChange);\n            }\n        } else if (authType == '6') {\n            $('#oauth2_provider').change(onOAuth2Change);\n            $('#oauth2_use_custom_url').change(onOAuth2UseCustomURLChange);\n            onOAuth2Change();\n        }\n    }\n\n    // Notice\n    if ($('.admin.notice')) {\n        const $detailModal = $('#detail-modal');\n\n        // Attach view detail modals\n        $('.view-detail').click(function () {\n            $detailModal.find('.content p').text($(this).data('content'));\n            $detailModal.modal('show');\n            return false;\n        });\n\n        // Select actions\n        const $checkboxes = $('.select.table .ui.checkbox');\n        $('.select.action').click(function () {\n            switch ($(this).data('action')) {\n                case 'select-all':\n                    $checkboxes.checkbox('check');\n                    break;\n                case 'deselect-all':\n                    $checkboxes.checkbox('uncheck');\n                    break;\n                case 'inverse':\n                    $checkboxes.checkbox('toggle');\n                    break;\n            }\n        });\n        $('#delete-selection').click(function () {\n            const $this = $(this);\n            $this.addClass(\"loading disabled\");\n            const ids = [];\n            $checkboxes.each(function () {\n                if ($(this).checkbox('is checked')) {\n                    ids.push($(this).data('id'));\n                }\n            });\n            $.post($this.data('link'), {\n                \"_csrf\": csrf,\n                \"ids\": ids\n            }).done(function () {\n                window.location.href = $this.data('redirect');\n            });\n        });\n    }\n}\n\nfunction buttonsClickOnEnter() {\n    $('.ui.button').keypress(function (e) {\n        if (e.keyCode == 13 || e.keyCode == 32) // enter key or space bar\n            $(this).click();\n    });\n}\n\nfunction searchUsers() {\n    const $searchUserBox = $('#search-user-box');\n    $searchUserBox.search({\n        minCharacters: 2,\n        apiSettings: {\n            url: suburl + '/api/v1/users/search?q={query}',\n            onResponse: function(response) {\n                const items = [];\n                $.each(response.data, function (_i, item) {\n                    let title = item.login;\n                    if (item.full_name && item.full_name.length > 0) {\n                        title += ' (' + htmlEncode(item.full_name) + ')';\n                    }\n                    items.push({\n                        title: title,\n                        image: item.avatar_url\n                    })\n                });\n\n                return { results: items }\n            }\n        },\n        searchFields: ['login', 'full_name'],\n        showNoResults: false\n    });\n}\n\nfunction searchTeams() {\n    const $searchTeamBox = $('#search-team-box');\n    $searchTeamBox.search({\n        minCharacters: 2,\n        apiSettings: {\n            url: suburl + '/api/v1/orgs/' + $searchTeamBox.data('org') + '/teams/search?q={query}',\n            headers: {\"X-Csrf-Token\": csrf},\n            onResponse: function(response) {\n                const items = [];\n                $.each(response.data, function (_i, item) {\n                    const title = item.name + ' (' + item.permission + ' access)';\n                    items.push({\n                        title: title,\n                    })\n                });\n\n                return { results: items }\n            }\n        },\n        searchFields: ['name', 'description'],\n        showNoResults: false\n    });\n}\n\nfunction searchRepositories() {\n    const $searchRepoBox = $('#search-repo-box');\n    $searchRepoBox.search({\n        minCharacters: 2,\n        apiSettings: {\n            url: suburl + '/api/v1/repos/search?q={query}&uid=' + $searchRepoBox.data('uid'),\n            onResponse: function(response) {\n                const items = [];\n                $.each(response.data, function (_i, item) {\n                    items.push({\n                        title: item.full_name.split(\"/\")[1],\n                        description: item.full_name\n                    })\n                });\n\n                return { results: items }\n            }\n        },\n        searchFields: ['full_name'],\n        showNoResults: false\n    });\n}\n\nfunction initCodeView() {\n    if ($('.code-view .linenums').length > 0) {\n        $(document).on('click', '.lines-num span', function (e) {\n            const $select = $(this);\n            const $list = $select.parent().siblings('.lines-code').find('ol.linenums > li');\n            selectRange($list, $list.filter('[rel=' + $select.attr('id') + ']'), (e.shiftKey ? $list.filter('.active').eq(0) : null));\n            deSelect();\n        });\n\n        $(window).on('hashchange', function () {\n            let m = window.location.hash.match(/^#(L\\d+)-(L\\d+)$/);\n            const $list = $('.code-view ol.linenums > li');\n            let $first;\n            if (m) {\n                $first = $list.filter('.' + m[1]);\n                selectRange($list, $first, $list.filter('.' + m[2]));\n                $(\"html, body\").scrollTop($first.offset().top - 200);\n                return;\n            }\n            m = window.location.hash.match(/^#(L|n)(\\d+)$/);\n            if (m) {\n                $first = $list.filter('.L' + m[2]);\n                selectRange($list, $first);\n                $(\"html, body\").scrollTop($first.offset().top - 200);\n            }\n        }).trigger('hashchange');\n    }\n}\n\nfunction initU2FAuth() {\n    if($('#wait-for-key').length === 0) {\n        return\n    }\n    u2fApi.ensureSupport()\n        .then(function () {\n            $.getJSON(suburl + '/user/u2f/challenge').success(function(req) {\n                u2fApi.sign(req.appId, req.challenge, req.registeredKeys, 30)\n                    .then(u2fSigned)\n                    .catch(function (err) {\n                        if(err === undefined) {\n                            u2fError(1);\n                            return\n                        }\n                        u2fError(err.metaData.code);\n                    });\n            });\n        }).catch(function () {\n            // Fallback in case browser do not support U2F\n            window.location.href = suburl + \"/user/two_factor\"\n        })\n}\nfunction u2fSigned(resp) {\n    $.ajax({\n        url: suburl + '/user/u2f/sign',\n        type: \"POST\",\n        headers: {\"X-Csrf-Token\": csrf},\n        data: JSON.stringify(resp),\n        contentType: \"application/json; charset=utf-8\",\n    }).done(function(res){\n        window.location.replace(res);\n    }).fail(function () {\n        u2fError(1);\n    });\n}\n\nfunction u2fRegistered(resp) {\n    if (checkError(resp)) {\n        return;\n    }\n    $.ajax({\n        url: suburl + '/user/settings/security/u2f/register',\n        type: \"POST\",\n        headers: {\"X-Csrf-Token\": csrf},\n        data: JSON.stringify(resp),\n        contentType: \"application/json; charset=utf-8\",\n        success: function(){\n            reload();\n        },\n        fail: function () {\n            u2fError(1);\n        }\n    });\n}\n\nfunction checkError(resp) {\n    if (!('errorCode' in resp)) {\n        return false;\n    }\n    if (resp.errorCode === 0) {\n        return false;\n    }\n    u2fError(resp.errorCode);\n    return true;\n}\n\n\nfunction u2fError(errorType) {\n    const u2fErrors = {\n        'browser': $('#unsupported-browser'),\n        1: $('#u2f-error-1'),\n        2: $('#u2f-error-2'),\n        3: $('#u2f-error-3'),\n        4: $('#u2f-error-4'),\n        5: $('.u2f-error-5')\n    };\n    u2fErrors[errorType].removeClass('hide');\n    for(const type in u2fErrors){\n        if(type != errorType){\n            u2fErrors[type].addClass('hide');\n        }\n    }\n    $('#u2f-error').modal('show');\n}\n\nfunction initU2FRegister() {\n    $('#register-device').modal({allowMultiple: false});\n    $('#u2f-error').modal({allowMultiple: false});\n    $('#register-security-key').on('click', function(e) {\n        e.preventDefault();\n        u2fApi.ensureSupport()\n            .then(u2fRegisterRequest)\n            .catch(function() {\n                u2fError('browser');\n            })\n    })\n}\n\nfunction u2fRegisterRequest() {\n    $.post(suburl + \"/user/settings/security/u2f/request_register\", {\n        \"_csrf\": csrf,\n        \"name\": $('#nickname').val()\n    }).success(function(req) {\n        $(\"#nickname\").closest(\"div.field\").removeClass(\"error\");\n        $('#register-device').modal('show');\n        if(req.registeredKeys === null) {\n            req.registeredKeys = []\n        }\n        u2fApi.register(req.appId, req.registerRequests, req.registeredKeys, 30)\n            .then(u2fRegistered)\n            .catch(function (reason) {\n                if(reason === undefined) {\n                    u2fError(1);\n                    return\n                }\n                u2fError(reason.metaData.code);\n            });\n    }).fail(function(xhr) {\n        if(xhr.status === 409) {\n            $(\"#nickname\").closest(\"div.field\").addClass(\"error\");\n        }\n    });\n}\n\nfunction initWipTitle() {\n    $(\".title_wip_desc > a\").click(function (e) {\n        e.preventDefault();\n\n        const $issueTitle = $(\"#issue_title\");\n        $issueTitle.focus();\n        const value = $issueTitle.val().trim().toUpperCase();\n\n        for (const i in wipPrefixes) {\n            if (value.startsWith(wipPrefixes[i].toUpperCase())) {\n                return;\n            }\n        }\n\n        $issueTitle.val(wipPrefixes[0] + \" \" + $issueTitle.val());\n    });\n}\n\nfunction initTemplateSearch() {\n    const $repoTemplate = $(\"#repo_template\");\n    const checkTemplate = function() {\n        const $templateUnits = $(\"#template_units\");\n        const $nonTemplate = $(\"#non_template\");\n        if ($repoTemplate.val() !== \"\") {\n            $templateUnits.show();\n            $nonTemplate.hide();\n        } else {\n            $templateUnits.hide();\n            $nonTemplate.show();\n        }\n    };\n    $repoTemplate.change(checkTemplate);\n    checkTemplate();\n\n    const changeOwner = function() {\n        $(\"#repo_template_search\")\n            .dropdown({\n                apiSettings: {\n                    url: suburl + '/api/v1/repos/search?q={query}&template=true&priority_owner_id=' + $(\"#uid\").val(),\n                    onResponse: function(response) {\n                        const filteredResponse = {'success': true, 'results': []};\n                        filteredResponse.results.push({\n                            'name': '',\n                            'value': ''\n                        });\n                        // Parse the response from the api to work with our dropdown\n                        $.each(response.data, function(_r, repo) {\n                            filteredResponse.results.push({\n                                'name'  : htmlEncode(repo.full_name) ,\n                                'value' : repo.id\n                            });\n                        });\n                        return filteredResponse;\n                    },\n                    cache: false,\n                },\n\n                fullTextSearch: true\n            });\n    };\n    $(\"#uid\").change(changeOwner);\n    changeOwner();\n}\n\n$(document).ready(function () {\n    csrf = $('meta[name=_csrf]').attr(\"content\");\n    suburl = $('meta[name=_suburl]').attr(\"content\");\n\n    // Show exact time\n    $('.time-since').each(function () {\n        $(this).addClass('poping up').attr('data-content', $(this).attr('title')).attr('data-variation', 'inverted tiny').attr('title', '');\n    });\n\n    // Semantic UI modules.\n    $('.dropdown:not(.custom)').dropdown();\n    $('.jump.dropdown').dropdown({\n        action: 'hide',\n        onShow: function () {\n            $('.poping.up').popup('hide');\n        }\n    });\n    $('.slide.up.dropdown').dropdown({\n        transition: 'slide up'\n    });\n    $('.upward.dropdown').dropdown({\n        direction: 'upward'\n    });\n    $('.ui.accordion').accordion();\n    $('.ui.checkbox').checkbox();\n    $('.ui.progress').progress({\n        showActivity: false\n    });\n    $('.poping.up').popup();\n    $('.top.menu .poping.up').popup({\n        onShow: function () {\n            if ($('.top.menu .menu.transition').hasClass('visible')) {\n                return false;\n            }\n        }\n    });\n    $('.tabular.menu .item').tab();\n    $('.tabable.menu .item').tab();\n\n    $('.toggle.button').click(function () {\n        $($(this).data('target')).slideToggle(100);\n    });\n\n    // make table <tr> element clickable like a link\n    $('tr[data-href]').click(function() {\n        window.location = $(this).data('href');\n    });\n\n    // Highlight JS\n    if (typeof hljs != 'undefined') {\n        const nodes = [].slice.call(document.querySelectorAll('pre code') || []);\n        for (let i = 0; i < nodes.length; i++) {\n            hljs.highlightBlock(nodes[i]);\n        }\n    }\n\n    // Dropzone\n    const $dropzone = $('#dropzone');\n    if ($dropzone.length > 0) {\n        const filenameDict = {};\n\n        new Dropzone(\"#dropzone\", {\n            url: $dropzone.data('upload-url'),\n            headers: {\"X-Csrf-Token\": csrf},\n            maxFiles: $dropzone.data('max-file'),\n            maxFilesize: $dropzone.data('max-size'),\n            acceptedFiles: ($dropzone.data('accepts') === '*/*') ? null : $dropzone.data('accepts'),\n            addRemoveLinks: true,\n            dictDefaultMessage: $dropzone.data('default-message'),\n            dictInvalidFileType: $dropzone.data('invalid-input-type'),\n            dictFileTooBig: $dropzone.data('file-too-big'),\n            dictRemoveFile: $dropzone.data('remove-file'),\n            init: function () {\n                this.on(\"success\", function (file, data) {\n                    filenameDict[file.name] = data.uuid;\n                    const input = $('<input id=\"' + data.uuid + '\" name=\"files\" type=\"hidden\">').val(data.uuid);\n                    $('.files').append(input);\n                });\n                this.on(\"removedfile\", function (file) {\n                    if (file.name in filenameDict) {\n                        $('#' + filenameDict[file.name]).remove();\n                    }\n                    if ($dropzone.data('remove-url') && $dropzone.data('csrf')) {\n                        $.post($dropzone.data('remove-url'), {\n                            file: filenameDict[file.name],\n                            _csrf: $dropzone.data('csrf')\n                        });\n                    }\n                })\n            },\n        });\n    }\n\n    // Emojify\n    emojify.setConfig({\n        img_dir: suburl + '/vendor/plugins/emojify/images',\n        ignore_emoticons: true\n    });\n    const hasEmoji = document.getElementsByClassName('has-emoji');\n    for (let i = 0; i < hasEmoji.length; i++) {\n        emojify.run(hasEmoji[i]);\n        for (let j = 0; j < hasEmoji[i].childNodes.length; j++) {\n            if (hasEmoji[i].childNodes[j].nodeName === \"A\") {\n                emojify.run(hasEmoji[i].childNodes[j])\n            }\n        }\n    }\n\n    // Clipboard JS\n    const clipboard = new Clipboard('.clipboard');\n    clipboard.on('success', function (e) {\n        e.clearSelection();\n\n        $('#' + e.trigger.getAttribute('id')).popup('destroy');\n        e.trigger.setAttribute('data-content', e.trigger.getAttribute('data-success'))\n        $('#' + e.trigger.getAttribute('id')).popup('show');\n        e.trigger.setAttribute('data-content', e.trigger.getAttribute('data-original'))\n    });\n\n    clipboard.on('error', function (e) {\n        $('#' + e.trigger.getAttribute('id')).popup('destroy');\n        e.trigger.setAttribute('data-content', e.trigger.getAttribute('data-error'))\n        $('#' + e.trigger.getAttribute('id')).popup('show');\n        e.trigger.setAttribute('data-content', e.trigger.getAttribute('data-original'))\n    });\n\n    // Helpers.\n    $('.delete-button').click(showDeletePopup);\n    $('.add-all-button').click(showAddAllPopup);\n\n    $('.delete-branch-button').click(showDeletePopup);\n\n    $('.undo-button').click(function() {\n        const $this = $(this);\n        $.post($this.data('url'), {\n            \"_csrf\": csrf,\n            \"id\": $this.data(\"id\")\n        }).done(function(data) {\n            window.location.href = data.redirect;\n        });\n    });\n    $('.show-panel.button').click(function () {\n        $($(this).data('panel')).show();\n    });\n    $('.show-modal.button').click(function () {\n        $($(this).data('modal')).modal('show');\n    });\n    $('.delete-post.button').click(function () {\n        const $this = $(this);\n        $.post($this.data('request-url'), {\n            \"_csrf\": csrf\n        }).done(function () {\n            window.location.href = $this.data('done-url');\n        });\n    });\n\n    // Set anchor.\n    $('.markdown').each(function () {\n        const headers = {};\n        $(this).find('h1, h2, h3, h4, h5, h6').each(function () {\n            let node = $(this);\n            const val = encodeURIComponent(node.text().toLowerCase().replace(/[^\\u00C0-\\u1FFF\\u2C00-\\uD7FF\\w\\- ]/g, '').replace(/[ ]/g, '-'));\n            let name = val;\n            if (headers[val] > 0) {\n                name = val + '-' + headers[val];\n            }\n            if (headers[val] == undefined) {\n                headers[val] = 1;\n            } else {\n                headers[val] += 1;\n            }\n            node = node.wrap('<div id=\"' + name + '\" class=\"anchor-wrap\" ></div>');\n            node.append('<a class=\"anchor\" href=\"#' + name + '\"><span class=\"octicon octicon-link\"></span></a>');\n        });\n    });\n\n    $('.issue-checkbox').click(function() {\n        const numChecked = $('.issue-checkbox').children('input:checked').length;\n        if (numChecked > 0) {\n            $('#issue-filters').addClass(\"hide\");\n            $('#issue-actions').removeClass(\"hide\");\n        } else {\n            $('#issue-filters').removeClass(\"hide\");\n            $('#issue-actions').addClass(\"hide\");\n        }\n    });\n\n    $('.issue-action').click(function () {\n        let action = this.dataset.action;\n        let elementId = this.dataset.elementId;\n        const issueIDs = $('.issue-checkbox').children('input:checked').map(function() {\n            return this.dataset.issueId;\n        }).get().join();\n        const url = this.dataset.url;\n        if (elementId === '0' && url.substr(-9) === '/assignee'){\n            elementId = '';\n            action = 'clear';\n        }\n        updateIssuesMeta(url, action, issueIDs, elementId).then(function() {\n            // NOTICE: This reset of checkbox state targets Firefox caching behaviour, as the checkboxes stay checked after reload\n            if (action === \"close\" || action === \"open\" ){\n                //uncheck all checkboxes\n                $('.issue-checkbox input[type=\"checkbox\"]').each(function(_,e){ e.checked = false; });\n            }\n            reload();\n        });\n    });\n\n    // NOTICE: This event trigger targets Firefox caching behaviour, as the checkboxes stay checked after reload\n    // trigger ckecked event, if checkboxes are checked on load\n    $('.issue-checkbox input[type=\"checkbox\"]:checked').first().each(function(_,e) {\n        e.checked = false;\n        $(e).click();\n    });\n\n    buttonsClickOnEnter();\n    searchUsers();\n    searchTeams();\n    searchRepositories();\n\n    initCommentForm();\n    initInstall();\n    initRepository();\n    initMigration();\n    initWikiForm();\n    initEditForm();\n    initEditor();\n    initOrganization();\n    initWebhook();\n    initAdmin();\n    initCodeView();\n    initVueApp();\n    initTeamSettings();\n    initCtrlEnterSubmit();\n    initNavbarContentToggle();\n    initTopicbar();\n    initU2FAuth();\n    initU2FRegister();\n    initIssueList();\n    initWipTitle();\n    initPullRequestReview();\n    initRepoStatusChecker();\n    initTemplateSearch();\n\n    // Repo clone url.\n    if ($('#repo-clone-url').length > 0) {\n        switch (localStorage.getItem('repo-clone-protocol')) {\n            case 'ssh':\n                if ($('#repo-clone-ssh').click().length === 0) {\n                    $('#repo-clone-https').click();\n                }\n                break;\n            default:\n                $('#repo-clone-https').click();\n                break;\n        }\n    }\n\n    const routes = {\n        'div.user.settings': initUserSettings,\n        'div.repository.settings.collaboration': initRepositoryCollaboration\n    };\n\n    let selector;\n    for (selector in routes) {\n        if ($(selector).length > 0) {\n            routes[selector]();\n            break;\n        }\n    }\n\n    const $cloneAddr = $('#clone_addr');\n    $cloneAddr.change(function() {\n        const $repoName = $('#repo_name');\n        if ($cloneAddr.val().length > 0 && $repoName.val().length === 0) { // Only modify if repo_name input is blank\n            $repoName.val($cloneAddr.val().match(/^(.*\\/)?((.+?)(\\.git)?)$/)[3]);\n        }\n    });\n});\n\nfunction changeHash(hash) {\n    if (history.pushState) {\n        history.pushState(null, null, hash);\n    }\n    else {\n        location.hash = hash;\n    }\n}\n\nfunction deSelect() {\n    if (window.getSelection) {\n        window.getSelection().removeAllRanges();\n    } else {\n        document.selection.empty();\n    }\n}\n\nfunction selectRange($list, $select, $from) {\n    $list.removeClass('active');\n    if ($from) {\n        let a = parseInt($select.attr('rel').substr(1));\n        let b = parseInt($from.attr('rel').substr(1));\n        let c;\n        if (a != b) {\n            if (a > b) {\n                c = a;\n                a = b;\n                b = c;\n            }\n            const classes = [];\n            for (let i = a; i <= b; i++) {\n                classes.push('.L' + i);\n            }\n            $list.filter(classes.join(',')).addClass('active');\n            changeHash('#L' + a + '-' + 'L' + b);\n            return\n        }\n    }\n    $select.addClass('active');\n    changeHash('#' + $select.attr('rel'));\n}\n\n$(function () {\n    // Warn users that try to leave a page after entering data into a form.\n    // Except on sign-in pages, and for forms marked as 'ignore-dirty'.\n    if ($('.user.signin').length === 0) {\n      $('form:not(.ignore-dirty)').areYouSure();\n    }\n\n    // Parse SSH Key\n    $(\"#ssh-key-content\").on('change paste keyup',function(){\n        const arrays = $(this).val().split(\" \");\n        const $title = $(\"#ssh-key-title\")\n        if ($title.val() === \"\" && arrays.length === 3 && arrays[2] !== \"\") {\n            $title.val(arrays[2]);\n        }\n    });\n});\n\nfunction showDeletePopup() {\n    const $this = $(this);\n    let filter = \"\";\n    if ($this.attr(\"id\")) {\n        filter += \"#\" + $this.attr(\"id\")\n    }\n\n    const dialog = $('.delete.modal' + filter);\n    dialog.find('.name').text($this.data('name'));\n\n    dialog.modal({\n        closable: false,\n        onApprove: function() {\n            if ($this.data('type') == \"form\") {\n                $($this.data('form')).submit();\n                return;\n            }\n\n            $.post($this.data('url'), {\n                \"_csrf\": csrf,\n                \"id\": $this.data(\"id\")\n            }).done(function(data) {\n                window.location.href = data.redirect;\n            });\n        }\n    }).modal('show');\n    return false;\n}\n\nfunction showAddAllPopup() {\n    const $this = $(this);\n    let filter = \"\";\n    if ($this.attr(\"id\")) {\n        filter += \"#\" + $this.attr(\"id\")\n    }\n\n    const dialog = $('.addall.modal' + filter);\n    dialog.find('.name').text($this.data('name'));\n\n    dialog.modal({\n        closable: false,\n        onApprove: function() {\n            if ($this.data('type') == \"form\") {\n                $($this.data('form')).submit();\n                return;\n            }\n\n            $.post($this.data('url'), {\n                \"_csrf\": csrf,\n                \"id\": $this.data(\"id\")\n            }).done(function(data) {\n                window.location.href = data.redirect;\n            });\n        }\n    }).modal('show');\n    return false;\n}\n\nfunction initVueComponents(){\n    const vueDelimeters = ['${', '}'];\n\n    Vue.component('repo-search', {\n        delimiters: vueDelimeters,\n\n        props: {\n            searchLimit: {\n                type: Number,\n                default: 10\n            },\n            suburl: {\n                type: String,\n                required: true\n            },\n            uid: {\n                type: Number,\n                required: true\n            },\n            organizations: {\n                type: Array,\n                default: []\n            },\n            isOrganization: {\n                type: Boolean,\n                default: true\n            },\n            canCreateOrganization: {\n                type: Boolean,\n                default: false\n            },\n            organizationsTotalCount: {\n                type: Number,\n                default: 0\n            },\n            moreReposLink: {\n                type: String,\n                default: ''\n            }\n        },\n\n        data: function() {\n            return {\n                tab: 'repos',\n                repos: [],\n                reposTotalCount: 0,\n                reposFilter: 'all',\n                searchQuery: '',\n                isLoading: false,\n                repoTypes: {\n                    'all': {\n                        count: 0,\n                        searchMode: '',\n                    },\n                    'forks': {\n                        count: 0,\n                        searchMode: 'fork',\n                    },\n                    'mirrors': {\n                        count: 0,\n                        searchMode: 'mirror',\n                    },\n                    'sources': {\n                        count: 0,\n                        searchMode: 'source',\n                    },\n                    'collaborative': {\n                        count: 0,\n                        searchMode: 'collaborative',\n                    },\n                }\n            }\n        },\n\n        computed: {\n            showMoreReposLink: function() {\n                return this.repos.length > 0 && this.repos.length < this.repoTypes[this.reposFilter].count;\n            },\n            searchURL: function() {\n                return this.suburl + '/api/v1/repos/search?sort=updated&order=desc&uid=' + this.uid + '&q=' + this.searchQuery\n                                   + '&limit=' + this.searchLimit + '&mode=' + this.repoTypes[this.reposFilter].searchMode\n                                   + (this.reposFilter !== 'all' ? '&exclusive=1' : '');\n            },\n            repoTypeCount: function() {\n                return this.repoTypes[this.reposFilter].count;\n            }\n        },\n\n        mounted: function() {\n            this.searchRepos(this.reposFilter);\n\n            const self = this;\n            Vue.nextTick(function() {\n                self.$refs.search.focus();\n            });\n        },\n\n        methods: {\n            changeTab: function(t) {\n                this.tab = t;\n            },\n\n            changeReposFilter: function(filter) {\n                this.reposFilter = filter;\n                this.repos = [];\n                this.repoTypes[filter].count = 0;\n                this.searchRepos(filter);\n            },\n\n            showRepo: function(repo, filter) {\n                switch (filter) {\n                    case 'sources':\n                        return repo.owner.id == this.uid && !repo.mirror && !repo.fork;\n                    case 'forks':\n                        return repo.owner.id == this.uid && !repo.mirror && repo.fork;\n                    case 'mirrors':\n                        return repo.mirror;\n                    case 'collaborative':\n                        return repo.owner.id != this.uid && !repo.mirror;\n                    default:\n                        return true;\n                }\n            },\n\n            searchRepos: function(reposFilter) {\n                const self = this;\n\n                this.isLoading = true;\n\n                const searchedMode = this.repoTypes[reposFilter].searchMode;\n                const searchedURL = this.searchURL;\n                const searchedQuery = this.searchQuery;\n\n                $.getJSON(searchedURL, function(result, _textStatus, request) {\n                    if (searchedURL == self.searchURL) {\n                        self.repos = result.data;\n                        const count = request.getResponseHeader('X-Total-Count');\n                        if (searchedQuery === '' && searchedMode === '') {\n                            self.reposTotalCount = count;\n                        }\n                        self.repoTypes[reposFilter].count = count;\n                    }\n                }).always(function() {\n                    if (searchedURL == self.searchURL) {\n                        self.isLoading = false;\n                    }\n                });\n            },\n\n            repoClass: function(repo) {\n                if (repo.fork) {\n                    return 'octicon octicon-repo-forked';\n                } else if (repo.mirror) {\n                    return 'octicon octicon-repo-clone';\n                } else if (repo.private) {\n                    return 'octicon octicon-lock';\n                } else {\n                    return 'octicon octicon-repo';\n                }\n            }\n        }\n    })\n}\n\nfunction initCtrlEnterSubmit() {\n    $(\".js-quick-submit\").keydown(function(e) {\n        if (((e.ctrlKey && !e.altKey) || e.metaKey) && (e.keyCode == 13 || e.keyCode == 10)) {\n            $(this).closest(\"form\").submit();\n        }\n    });\n}\n\nfunction initVueApp() {\n    const el = document.getElementById('app');\n    if (!el) {\n        return;\n    }\n\n    initVueComponents();\n\n    new Vue({\n        delimiters: ['${', '}'],\n        el: el,\n\n        data: {\n            searchLimit: document.querySelector('meta[name=_search_limit]').content,\n            suburl: document.querySelector('meta[name=_suburl]').content,\n            uid: document.querySelector('meta[name=_context_uid]').content,\n        },\n    });\n}\n\nwindow.timeAddManual = function() {\n    $('.mini.modal')\n        .modal({\n            duration: 200,\n            onApprove: function() {\n                $('#add_time_manual_form').submit();\n            }\n        }).modal('show')\n    ;\n}\n\nwindow.toggleStopwatch = function() {\n    $(\"#toggle_stopwatch_form\").submit();\n}\nwindow.cancelStopwatch = function() {\n    $(\"#cancel_stopwatch_form\").submit();\n}\n\nwindow.initHeatmap = function(appElementId, heatmapUser, locale) {\n    const el = document.getElementById(appElementId);\n    if (!el) {\n        return;\n    }\n\n    locale = locale || {};\n\n    locale.contributions = locale.contributions || 'contributions';\n    locale.no_contributions = locale.no_contributions || 'No contributions';\n\n    const vueDelimeters = ['${', '}'];\n\n    Vue.component('activity-heatmap', {\n        delimiters: vueDelimeters,\n\n        props: {\n            user: {\n                type: String,\n                required: true\n            },\n            suburl: {\n                type: String,\n                required: true\n            },\n            locale: {\n                type: Object,\n                required: true\n            }\n        },\n\n        data: function () {\n            return {\n                isLoading: true,\n                colorRange: [],\n                endDate: null,\n                values: [],\n                totalContributions: 0,\n            };\n        },\n\n        mounted: function() {\n            this.colorRange = [\n                this.getColor(0),\n                this.getColor(1),\n                this.getColor(2),\n                this.getColor(3),\n                this.getColor(4),\n                this.getColor(5)\n            ];\n            this.endDate = new Date();\n            this.loadHeatmap(this.user);\n        },\n\n        methods: {\n            loadHeatmap: function(userName) {\n                const self = this;\n                $.get(this.suburl + '/api/v1/users/' + userName + '/heatmap', function(chartRawData) {\n                    const chartData = [];\n                    for (let i = 0; i < chartRawData.length; i++) {\n                        self.totalContributions += chartRawData[i].contributions;\n                        chartData[i] = { date: new Date(chartRawData[i].timestamp * 1000), count: chartRawData[i].contributions };\n                    }\n                    self.values = chartData;\n                    self.isLoading = false;\n                });\n            },\n\n            getColor: function(idx) {\n                const el = document.createElement('div');\n                el.className = 'heatmap-color-' + idx;\n                document.body.appendChild(el);\n\n                const color = getComputedStyle(el).backgroundColor;\n\n                document.body.removeChild(el);\n\n                return color;\n            }\n        },\n\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\" />'\n    });\n\n    new Vue({\n        delimiters: vueDelimeters,\n        el: el,\n\n        data: {\n            suburl: document.querySelector('meta[name=_suburl]').content,\n            heatmapUser: heatmapUser,\n            locale: locale\n        },\n    });\n}\n\nfunction initFilterBranchTagDropdown(selector) {\n    $(selector).each(function() {\n        const $dropdown = $(this);\n        const $data = $dropdown.find('.data');\n        const data = {\n            items: [],\n            mode: $data.data('mode'),\n            searchTerm: '',\n            noResults: '',\n            canCreateBranch: false,\n            menuVisible: false,\n            active: 0\n        };\n        $data.find('.item').each(function() {\n            data.items.push({\n                name: $(this).text(),\n                url: $(this).data('url'),\n                branch: $(this).hasClass('branch'),\n                tag: $(this).hasClass('tag'),\n                selected: $(this).hasClass('selected')\n            });\n        });\n        $data.remove();\n        new Vue({\n            delimiters: ['${', '}'],\n            el: this,\n            data: data,\n\n            beforeMount: function () {\n                const vm = this;\n\n                this.noResults = vm.$el.getAttribute('data-no-results');\n                this.canCreateBranch = vm.$el.getAttribute('data-can-create-branch') === 'true';\n\n                document.body.addEventListener('click', function(event) {\n                    if (vm.$el.contains(event.target)) {\n                        return;\n                    }\n                    if (vm.menuVisible) {\n                        Vue.set(vm, 'menuVisible', false);\n                    }\n                });\n            },\n\n            watch: {\n                menuVisible: function(visible) {\n                    if (visible) {\n                        this.focusSearchField();\n                    }\n                }\n            },\n\n            computed: {\n                filteredItems: function() {\n                    const vm = this;\n\n                    const items = vm.items.filter(function (item) {\n                        return ((vm.mode === 'branches' && item.branch)\n                                || (vm.mode === 'tags' && item.tag))\n                            && (!vm.searchTerm\n                                || item.name.toLowerCase().indexOf(vm.searchTerm.toLowerCase()) >= 0);\n                    });\n\n                    vm.active = (items.length === 0 && vm.showCreateNewBranch ? 0 : -1);\n\n                    return items;\n                },\n                showNoResults: function() {\n                    return this.filteredItems.length === 0\n                            && !this.showCreateNewBranch;\n                },\n                showCreateNewBranch: function() {\n                    const vm = this;\n                    if (!this.canCreateBranch || !vm.searchTerm || vm.mode === 'tags') {\n                        return false;\n                    }\n\n                    return vm.items.filter(function (item) {\n                        return item.name.toLowerCase() === vm.searchTerm.toLowerCase()\n                    }).length === 0;\n                }\n            },\n\n            methods: {\n                selectItem: function(item) {\n                    const prev = this.getSelected();\n                    if (prev !== null) {\n                        prev.selected = false;\n                    }\n                    item.selected = true;\n                    window.location.href = item.url;\n                },\n                createNewBranch: function() {\n                    if (!this.showCreateNewBranch) {\n                        return;\n                    }\n                    this.$refs.newBranchForm.submit();\n                },\n                focusSearchField: function() {\n                    const vm = this;\n                    Vue.nextTick(function() {\n                        vm.$refs.searchField.focus();\n                    });\n                },\n                getSelected: function() {\n                    for (let i = 0, j = this.items.length; i < j; ++i) {\n                        if (this.items[i].selected)\n                            return this.items[i];\n                    }\n                    return null;\n                },\n                getSelectedIndexInFiltered: function() {\n                    for (let i = 0, j = this.filteredItems.length; i < j; ++i) {\n                        if (this.filteredItems[i].selected)\n                            return i;\n                    }\n                    return -1;\n                },\n                scrollToActive: function() {\n                    let el = this.$refs['listItem' + this.active];\n                    if (!el || el.length === 0) {\n                        return;\n                    }\n                    if (Array.isArray(el)) {\n                        el = el[0];\n                    }\n\n                    const cont = this.$refs.scrollContainer;\n\n                     if (el.offsetTop < cont.scrollTop) {\n                         cont.scrollTop = el.offsetTop;\n                     }\n                     else if (el.offsetTop + el.clientHeight > cont.scrollTop + cont.clientHeight) {\n                        cont.scrollTop = el.offsetTop + el.clientHeight - cont.clientHeight;\n                    }\n                },\n                keydown: function(event) {\n                    const vm = this;\n                    if (event.keyCode === 40) {\n                        // arrow down\n                        event.preventDefault();\n\n                        if (vm.active === -1) {\n                            vm.active = vm.getSelectedIndexInFiltered();\n                        }\n\n                        if (vm.active + (vm.showCreateNewBranch ? 0 : 1) >= vm.filteredItems.length) {\n                            return;\n                        }\n                        vm.active++;\n                        vm.scrollToActive();\n                    }\n                    if (event.keyCode === 38) {\n                        // arrow up\n                        event.preventDefault();\n\n                         if (vm.active === -1) {\n                            vm.active = vm.getSelectedIndexInFiltered();\n                        }\n\n                         if (vm.active <= 0) {\n                            return;\n                        }\n                        vm.active--;\n                        vm.scrollToActive();\n                    }\n                    if (event.keyCode == 13) {\n                        // enter\n                        event.preventDefault();\n\n                         if (vm.active >= vm.filteredItems.length) {\n                            vm.createNewBranch();\n                        } else if (vm.active >= 0) {\n                            vm.selectItem(vm.filteredItems[vm.active]);\n                        }\n                    }\n                    if (event.keyCode == 27) {\n                        // escape\n                        event.preventDefault();\n                        vm.menuVisible = false;\n                    }\n                }\n            }\n        });\n    });\n}\n\n$(\".commit-button\").click(function(e) {\n    e.preventDefault();\n    $(this).parent().find('.commit-body').toggle();\n});\n\nfunction initNavbarContentToggle() {\n    const content = $('#navbar');\n    const toggle = $('#navbar-expand-toggle');\n    let isExpanded = false;\n    toggle.click(function() {\n        isExpanded = !isExpanded;\n        if (isExpanded) {\n            content.addClass('shown');\n            toggle.addClass('active');\n        }\n        else {\n            content.removeClass('shown');\n            toggle.removeClass('active');\n        }\n    });\n}\n\nfunction initTopicbar() {\n    const mgrBtn = $(\"#manage_topic\");\n    const editDiv = $(\"#topic_edit\");\n    const viewDiv = $(\"#repo-topics\");\n    const saveBtn = $(\"#save_topic\");\n    const topicDropdown = $('#topic_edit .dropdown');\n    const topicForm = $('#topic_edit.ui.form');\n    const topicPrompts = getPrompts();\n\n    mgrBtn.click(function() {\n        viewDiv.hide();\n        editDiv.css('display', ''); // show Semantic UI Grid\n    });\n\n    function getPrompts() {\n        const hidePrompt = $(\"div.hide#validate_prompt\"),\n            prompts = {\n                countPrompt: hidePrompt.children('#count_prompt').text(),\n                formatPrompt: hidePrompt.children('#format_prompt').text()\n            };\n        hidePrompt.remove();\n        return prompts;\n    }\n\n    saveBtn.click(function() {\n        const topics = $(\"input[name=topics]\").val();\n\n        $.post(saveBtn.data('link'), {\n            \"_csrf\": csrf,\n            \"topics\": topics\n        }, function(_data, _textStatus, xhr){\n            if (xhr.responseJSON.status === 'ok') {\n                viewDiv.children(\".topic\").remove();\n                if (topics.length) {\n                    const topicArray = topics.split(\",\");\n\n                    const last = viewDiv.children(\"a\").last();\n                    for (let i=0; i < topicArray.length; i++) {\n                        $('<div class=\"ui small label topic\" style=\"cursor:pointer;\">'+topicArray[i]+'</div>').insertBefore(last)\n                    }\n                }\n                editDiv.css('display', 'none');\n                viewDiv.show();\n            }\n        }).fail(function(xhr){\n            if (xhr.status === 422) {\n                if (xhr.responseJSON.invalidTopics.length > 0) {\n                    topicPrompts.formatPrompt = xhr.responseJSON.message;\n\n                    const invalidTopics = xhr.responseJSON.invalidTopics,\n                        topicLables = topicDropdown.children('a.ui.label');\n\n                    topics.split(',').forEach(function(value, index) {\n                        for (let i=0; i < invalidTopics.length; i++) {\n                            if (invalidTopics[i] === value) {\n                                topicLables.eq(index).removeClass(\"green\").addClass(\"red\");\n                            }\n                        }\n                    });\n                } else {\n                    topicPrompts.countPrompt = xhr.responseJSON.message;\n                }\n            }\n        }).always(function() {\n            topicForm.form('validate form');\n        });\n    });\n\n    topicDropdown.dropdown({\n        allowAdditions: true,\n        forceSelection: false,\n        fields: { name: \"description\", value: \"data-value\" },\n        saveRemoteData: false,\n        label: {\n            transition : 'horizontal flip',\n            duration   : 200,\n            variation  : false,\n            blue : true,\n            basic: true,\n        },\n        className: {\n            label: 'ui small label'\n        },\n        apiSettings: {\n            url: suburl + '/api/v1/topics/search?q={query}',\n            throttle: 500,\n            cache: false,\n            onResponse: function(res) {\n                const formattedResponse = {\n                    success: false,\n                    results: [],\n                };\n                const stripTags = function (text) {\n                    return text.replace(/<[^>]*>?/gm, \"\");\n                };\n\n                const query = stripTags(this.urlData.query.trim());\n                let found_query = false;\n                const current_topics = [];\n                topicDropdown.find('div.label.visible.topic,a.label.visible').each(function(_,e){ current_topics.push(e.dataset.value); });\n\n                if (res.topics) {\n                    let found = false;\n                    for (let i=0;i < res.topics.length;i++) {\n                        // skip currently added tags\n                        if (current_topics.indexOf(res.topics[i].topic_name) != -1){\n                            continue;\n                        }\n\n                        if (res.topics[i].topic_name.toLowerCase() === query.toLowerCase()){\n                            found_query = true;\n                        }\n                        formattedResponse.results.push({\"description\": res.topics[i].topic_name, \"data-value\": res.topics[i].topic_name});\n                        found = true;\n                    }\n                    formattedResponse.success = found;\n                }\n\n                if (query.length > 0 && !found_query){\n                    formattedResponse.success = true;\n                    formattedResponse.results.unshift({\"description\": query, \"data-value\": query});\n                } else if (query.length > 0 && found_query) {\n                    formattedResponse.results.sort(function(a, b){\n                        if (a.description.toLowerCase() === query.toLowerCase()) return -1;\n                        if (b.description.toLowerCase() === query.toLowerCase()) return 1;\n                        if (a.description > b.description) return -1;\n                        if (a.description < b.description) return 1;\n                        return 0;\n                    });\n                }\n\n\n                return formattedResponse;\n            },\n        },\n        onLabelCreate: function(value) {\n            value = value.toLowerCase().trim();\n            this.attr(\"data-value\", value).contents().first().replaceWith(value);\n            return $(this);\n        },\n        onAdd: function(addedValue, _addedText, $addedChoice) {\n            addedValue = addedValue.toLowerCase().trim();\n            $($addedChoice).attr('data-value', addedValue);\n            $($addedChoice).attr('data-text', addedValue);\n        }\n    });\n\n    $.fn.form.settings.rules.validateTopic = function(_values, regExp) {\n        const topics = topicDropdown.children('a.ui.label'),\n            status = topics.length === 0 || topics.last().attr(\"data-value\").match(regExp);\n        if (!status) {\n            topics.last().removeClass(\"green\").addClass(\"red\");\n        }\n        return status && topicDropdown.children('a.ui.label.red').length === 0;\n    };\n\n    topicForm.form({\n            on: 'change',\n            inline : true,\n            fields: {\n                topics: {\n                    identifier: 'topics',\n                    rules: [\n                        {\n                            type: 'validateTopic',\n                            value: /^[a-z0-9][a-z0-9-]{1,35}$/,\n                            prompt: topicPrompts.formatPrompt\n                        },\n                        {\n                            type: 'maxCount[25]',\n                            prompt: topicPrompts.countPrompt\n                        }\n                    ]\n                },\n            }\n        });\n}\nwindow.toggleDeadlineForm = function() {\n    $('#deadlineForm').fadeToggle(150);\n}\n\nwindow.setDeadline = function() {\n    const deadline = $('#deadlineDate').val();\n    updateDeadline(deadline);\n}\n\nfunction updateDeadline(deadlineString) {\n    $('#deadline-err-invalid-date').hide();\n    $('#deadline-loader').addClass('loading');\n\n    let realDeadline = null;\n    if (deadlineString !== '') {\n\n        const newDate = Date.parse(deadlineString)\n\n        if (isNaN(newDate)) {\n            $('#deadline-loader').removeClass('loading');\n            $('#deadline-err-invalid-date').show();\n            return false;\n        }\n        realDeadline = new Date(newDate);\n    }\n\n    $.ajax($('#update-issue-deadline-form').attr('action') + '/deadline', {\n        data: JSON.stringify({\n            'due_date': realDeadline,\n        }),\n        headers: {\n            'X-Csrf-Token': csrf,\n            'X-Remote': true,\n        },\n        contentType: 'application/json',\n        type: 'POST',\n        success: function () {\n            reload();\n        },\n        error: function () {\n            $('#deadline-loader').removeClass('loading');\n            $('#deadline-err-invalid-date').show();\n        }\n    });\n}\n\nwindow.deleteDependencyModal = function(id, type) {\n    $('.remove-dependency')\n        .modal({\n            closable: false,\n            duration: 200,\n            onApprove: function () {\n                $('#removeDependencyID').val(id);\n                $('#dependencyType').val(type);\n                $('#removeDependencyForm').submit();\n            }\n        }).modal('show')\n    ;\n}\n\nfunction initIssueList() {\n    const repolink = $('#repolink').val();\n    const repoId = $('#repoId').val();\n    const crossRepoSearch = $('#crossRepoSearch').val();\n    let issueSearchUrl = suburl + '/api/v1/repos/' + repolink + '/issues?q={query}';\n    if (crossRepoSearch === 'true') {\n        issueSearchUrl = suburl + '/api/v1/repos/issues/search?q={query}&priority_repo_id=' + repoId;\n    }\n    $('#new-dependency-drop-list')\n        .dropdown({\n            apiSettings: {\n                url: issueSearchUrl,\n                onResponse: function(response) {\n                    const filteredResponse = {'success': true, 'results': []};\n                    const currIssueId = $('#new-dependency-drop-list').data('issue-id');\n                    // Parse the response from the api to work with our dropdown\n                    $.each(response, function(_i, issue) {\n                        // Don't list current issue in the dependency list.\n                        if(issue.id === currIssueId) {\n                            return;\n                        }\n                        filteredResponse.results.push({\n                            'name'  : '#' + issue.number + ' ' + htmlEncode(issue.title) +\n                                '<div class=\"text small dont-break-out\">' + htmlEncode(issue.repository.full_name) + '</div>',\n                            'value' : issue.id\n                        });\n                    });\n                    return filteredResponse;\n                },\n                cache: false,\n            },\n\n            fullTextSearch: true\n        });\n\n    $(\".menu a.label-filter-item\").each(function() {\n        $(this).click(function(e) {\n            if (e.altKey) {\n                e.preventDefault();\n\n                const href = $(this).attr(\"href\");\n                const id = $(this).data(\"label-id\");\n\n                const regStr = \"labels=(-?[0-9]+%2c)*(\" + id + \")(%2c-?[0-9]+)*&\";\n                const newStr = \"labels=$1-$2$3&\";\n\n                window.location = href.replace(new RegExp(regStr), newStr);\n            }\n        });\n    });\n\n    $(\".menu .ui.dropdown.label-filter\").keydown(function(e) {\n        if (e.altKey && e.keyCode == 13) {\n            const selectedItems = $(\".menu .ui.dropdown.label-filter .menu .item.selected\");\n\n            if (selectedItems.length > 0) {\n                const item = $(selectedItems[0]);\n\n                const href = item.attr(\"href\");\n                const id = item.data(\"label-id\");\n\n                const regStr = \"labels=(-?[0-9]+%2c)*(\" + id + \")(%2c-?[0-9]+)*&\";\n                const newStr = \"labels=$1-$2$3&\";\n\n                window.location = href.replace(new RegExp(regStr), newStr);\n            }\n        }\n    });\n}\nwindow.cancelCodeComment = function(btn) {\n    const form = $(btn).closest(\"form\");\n    if(form.length > 0 && form.hasClass('comment-form')) {\n        form.addClass('hide');\n        form.parent().find('button.comment-form-reply').show();\n    } else {\n        form.closest('.comment-code-cloud').remove()\n    }\n}\nwindow.onOAuthLoginClick = function() {\n    const oauthLoader = $('#oauth2-login-loader');\n    const oauthNav = $('#oauth2-login-navigator');\n\n    oauthNav.hide();\n    oauthLoader.removeClass('disabled');\n\n    setTimeout(function(){\n        // recover previous content to let user try again\n        // usually redirection will be performed before this action\n        oauthLoader.addClass('disabled');\n        oauthNav.show();\n    },5000);\n}\n"],"sourceRoot":""}
\ No newline at end of file
+{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./web_src/js/index.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","htmlEncode","text","jQuery","html","csrf","suburl","previewFileModes","simpleMDEditor","codeMirrorEditor","initCommentPreviewTab","$form","$tabMenu","find","tab","data","click","$this","$","this","post","val","$previewPanel","emojify","run","each","hljs","highlightBlock","buttonsClickOnEnter","initEditForm","length","$previewTab","split","initEditPreviewTab","$diffPreviewPanel","initEditDiffTab","updateIssuesMeta","url","action","issueIds","elementId","Promise","resolve","ajax","type","success","reload","window","location","initImagePaste","target","field","addEventListener","event","pasteEvent","callback","clipboardData","items","indexOf","blob","getAsFile","preventDefault","stopPropagation","retrieveImageFromClipboardAsBlob","img","substr","lastIndexOf","selectionStart","startPos","endPos","selectionEnd","substring","insertAtCursor","file","xhr","XMLHttpRequest","onload","status","responseText","open","setRequestHeader","formData","FormData","append","send","uploadFile","res","JSON","parse","oldval","newval","replace","replaceAndKeepCursor","uuid","input","initCommentForm","initListSubmits","selector","outerSelector","$list","$noSelect","$listMenu","hasLabelUpdateAction","labels","dropdown","promises","keys","forEach","label","promise","push","all","then","hasClass","removeClass","addClass","listIds","parent","join","selectItem","select_id","input_id","$menu","hasUpdateAction","$selectBranch","selectedValue","css","initBranchSelector","initRepository","initFilterSearchDropdown","$dropdown","fullTextSearch","selectOnKeydown","onChange","_text","_value","$choice","href","message","noResults","$data","searchTerm","canCreateBranch","menuVisible","active","branch","tag","selected","remove","Vue","delimiters","el","beforeMount","vm","$el","getAttribute","document","body","contains","set","watch","visible","focusSearchField","computed","filteredItems","filter","item","toLowerCase","showCreateNewBranch","showNoResults","methods","prev","getSelected","createNewBranch","$refs","newBranchForm","submit","nextTick","searchField","focus","j","getSelectedIndexInFiltered","scrollToActive","Array","isArray","cont","scrollContainer","offsetTop","scrollTop","clientHeight","keydown","keyCode","keyup","$prompt","toString","show","hide","change","checked","$newLabelPanel","minicolors","color_hex","modal","onApprove","$datepicker","datetimepicker","lang","inline","timepicker","startDate","formatDate","onSelectDate","ct","dateFormat","$issueTitle","$editInput","editTitleToggle","toggle","title","$segment","next","$editContentZone","$renderContent","$rawContent","$textarea","issuesTribute","attach","emojiTribute","$dropzone","$files","filenameDict","dropzone","headers","maxFiles","maxFilesize","acceptedFiles","addRemoveLinks","dictDefaultMessage","dictInvalidFileType","dictFileTooBig","dictRemoveFile","init","on","submitted","_csrf","getJSON","drop","removeAllFiles","empty","imgSrc","emit","files","$editContentForm","attr","$attachments","map","content","$content","attachments","confirm","$statusButton","$mergeButton","e","closest","initReactionSelector","reactions","popup","done","resp","react","insertBefore","appendTo","hasEmoji","$item","addLine","delLine","addPercent","parseFloat","localStorage","setItem","select","$repoComparePull","assingMenuAttributes","menu","id","Math","floor","random","initRepositoryCollaboration","initEditor","prop","$editFilename","$section","$divider","parts","getCursorPosition","last","setSelectionRange","element","trigger","$editArea","markdownFileExts","lineWrapExtensions","spec","extension","extWithDot","dataUrl","apiCall","exec","info","CodeMirror","findModeByExtension","previewLink","mime","toTextArea","SimpleMDE","autoDownloadFontAwesome","forceSync","renderingConfig","singleLineBreaks","indentWithTabs","tabSize","spellChecker","previewRender","plainText","preview","setTimeout","innerHTML","toolbar","setSimpleMDE","fromTextArea","lineNumbers","cm","_change","getValue","setCodeMirror","setOption","autoLoadMode","editorconfig","indent_style","Tab","spaces","parseInt","getOption","replaceSelection","indent_size","tab_width","$commitButton","$editForm","areYouSure","silent","dirtyClass","fieldSelector","dirty","initUserSettings","keypress","initCodeView","$select","siblings","selectRange","shiftKey","eq","getSelection","removeAllRanges","selection","hash","match","$first","offset","top","u2fSigned","stringify","contentType","fail","u2fError","u2fRegistered","errorCode","checkError","errorType","u2fErrors","1","2","3","4","5","u2fRegisterRequest","req","registeredKeys","u2fApi","register","appId","registerRequests","catch","reason","undefined","metaData","code","changeHash","history","pushState","$from","a","b","classes","showDeletePopup","dialog","closable","redirect","showAddAllPopup","Dropzone","autoDiscover","from","toStr","isCallable","fn","maxSafeInteger","pow","toLength","len","number","Number","isNaN","isFinite","abs","toInteger","min","max","arrayLike","C","TypeError","mapFn","arguments","T","A","kValue","k","assign","_varArgs","to","index","nextSource","nextKey","writable","configurable","String","endsWith","pattern","pos","Sel","createRange","SelLength","moveStart","ready","onShow","transition","direction","accordion","checkbox","progress","showActivity","slideToggle","nodes","slice","querySelectorAll","setConfig","img_dir","ignore_emoticons","getElementsByClassName","childNodes","nodeName","clipboard","Clipboard","clearSelection","setAttribute","node","encodeURIComponent","wrap","children","dataset","issueIDs","issueId","_","first","search","minCharacters","apiSettings","onResponse","response","_i","login","full_name","image","avatar_url","results","searchFields","$searchTeamBox","permission","searchTeams","$searchRepoBox","description","searchRepositories","dbType","dbDefaults","_type","defaultHost","is","toggleMigrations","authUserName","cloneAddr","startsWith","initMigration","simplemde","codemirror","cursorPos","getCursor","setCursor","line","ch","className","getInputField","initWikiForm","updateContentType","initWebhook","removeAttr","authType","onOAuth2Change","onSecurityProtocolChange","onUsePagedSearchChange","onOAuth2UseCustomURLChange","$detailModal","$checkboxes","ids","provider","initAdmin","getElementById","component","props","searchLimit","default","required","uid","organizations","isOrganization","Boolean","canCreateOrganization","organizationsTotalCount","moreReposLink","repos","reposTotalCount","reposFilter","searchQuery","isLoading","repoTypes","count","searchMode","showMoreReposLink","searchURL","repoTypeCount","mounted","searchRepos","self","changeTab","changeReposFilter","showRepo","repo","owner","mirror","fork","searchedMode","searchedURL","searchedQuery","result","_textStatus","request","getResponseHeader","always","repoClass","private","querySelector","initVueApp","ctrlKey","altKey","metaKey","isExpanded","initNavbarContentToggle","mgrBtn","editDiv","viewDiv","saveBtn","topicDropdown","topicForm","topicPrompts","hidePrompt","prompts","countPrompt","formatPrompt","getPrompts","topics","_data","responseJSON","topicArray","invalidTopics","topicLables","form","allowAdditions","forceSelection","fields","saveRemoteData","duration","variation","blue","basic","throttle","cache","formattedResponse","query","urlData","trim","found_query","current_topics","found","topic_name","unshift","sort","onLabelCreate","contents","replaceWith","onAdd","addedValue","_addedText","$addedChoice","settings","rules","validateTopic","_values","regExp","identifier","prompt","initTopicbar","ensureSupport","sign","challenge","err","allowMultiple","repolink","repoId","crossRepoSearch","issueSearchUrl","filteredResponse","currIssueId","issue","repository","regStr","newStr","RegExp","selectedItems","initIssueList","toUpperCase","wipPrefixes","sticky","isSplit","side","idx","path","tr","ntr","after","td","commentCloud","initRepoStatusChecker","migrating","repo_name","complete","$repoTemplate","checkTemplate","$templateUnits","$nonTemplate","changeOwner","_r","initTemplateSearch","getItem","routes","$cloneAddr","$repoName","arrays","$title","timeAddManual","toggleStopwatch","cancelStopwatch","initHeatmap","appElementId","heatmapUser","locale","contributions","no_contributions","vueDelimeters","user","colorRange","endDate","values","totalContributions","getColor","Date","loadHeatmap","userName","chartRawData","chartData","date","timestamp","createElement","appendChild","color","getComputedStyle","backgroundColor","removeChild","template","toggleDeadlineForm","fadeToggle","setDeadline","deadline","updateDeadline","deadlineString","realDeadline","newDate","error","deleteDependencyModal","cancelCodeComment","btn","onOAuthLoginClick","oauthLoader","oauthNav"],"mappings":"aACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QAKfF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE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,oBAAoBgG,YAAY,WAClChG,EAAE,8BAA8BiL,QACzB,EAEX+gB,EAAe,IAAIpB,KAAKqB,GAG5BjsB,EAAEyB,KAAKzB,EAAE,+BAA+B2O,KAAK,UAAY,YAAa,CAClE9O,KAAMwE,KAAK4R,UAAU,CACjB,SAAY+V,IAEhB1e,QAAS,CACL,eAAgBnO,EAChB,YAAY,GAEhB+W,YAAa,mBACbxU,KAAM,OACNC,QAAS,WACLC,KAEJsqB,MAAO,WACHlsB,EAAE,oBAAoBgG,YAAY,WAClChG,EAAE,8BAA8BiL,WAK5CpJ,OAAOsqB,sBAAwB,SAASzb,EAAIhP,GACxC1B,EAAE,sBACGwL,MAAM,CACH4M,UAAU,EACV0M,SAAU,IACVrZ,UAAW,WACPzL,EAAE,uBAAuBG,IAAIuQ,GAC7B1Q,EAAE,mBAAmBG,IAAIuB,GACzB1B,EAAE,yBAAyB8J,YAEhC0B,MAAM,SAyEjB3J,OAAOuqB,kBAAoB,SAASC,GAChC,MAAM5H,EAAOzkB,EAAEqsB,GAAKhd,QAAQ,QACzBoV,EAAK7jB,OAAS,GAAK6jB,EAAK1e,SAAS,iBAChC0e,EAAKxe,SAAS,QACdwe,EAAKte,SAASxG,KAAK,6BAA6BsL,QAEhDwZ,EAAKpV,QAAQ,uBAAuBnH,UAG5CrG,OAAOyqB,kBAAoB,WACvB,MAAMC,EAAcvsB,EAAE,wBAChBwsB,EAAWxsB,EAAE,2BAEnBwsB,EAASthB,OACTqhB,EAAYvmB,YAAY,YAExBoN,YAAW,WAGPmZ,EAAYtmB,SAAS,YACrBumB,EAASvhB,SACX","file":"index.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","/* globals wipPrefixes, issuesTribute, emojiTribute */\n/* exported timeAddManual, toggleStopwatch, cancelStopwatch, initHeatmap */\n/* exported toggleDeadlineForm, setDeadline, deleteDependencyModal, cancelCodeComment, onOAuthLoginClick */\n'use strict';\n\nfunction htmlEncode(text) {\n   return jQuery('<div />').text(text).html()\n}\n\nlet csrf;\nlet suburl;\nlet previewFileModes;\nlet simpleMDEditor;\nlet codeMirrorEditor;\n\n// Disable Dropzone auto-discover because it's manually initialized\nif (typeof(Dropzone) !== \"undefined\") {\n    Dropzone.autoDiscover = false;\n}\n\n// Polyfill for IE9+ support (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from)\nif (!Array.from) {\n    Array.from = (function () {\n        const toStr = Object.prototype.toString;\n        const isCallable = function (fn) {\n            return typeof fn === 'function' || toStr.call(fn) === '[object Function]';\n        };\n        const toInteger = function (value) {\n            const number = Number(value);\n            if (isNaN(number)) { return 0; }\n            if (number === 0 || !isFinite(number)) { return number; }\n            return (number > 0 ? 1 : -1) * Math.floor(Math.abs(number));\n        };\n        const maxSafeInteger = Math.pow(2, 53) - 1;\n        const toLength = function (value) {\n            const len = toInteger(value);\n            return Math.min(Math.max(len, 0), maxSafeInteger);\n        };\n\n        // The length property of the from method is 1.\n        return function from(arrayLike/*, mapFn, thisArg */) {\n            // 1. Let C be the this value.\n            const C = this;\n\n            // 2. Let items be ToObject(arrayLike).\n            const items = Object(arrayLike);\n\n            // 3. ReturnIfAbrupt(items).\n            if (arrayLike == null) {\n                throw new TypeError(\"Array.from requires an array-like object - not null or undefined\");\n            }\n\n            // 4. If mapfn is undefined, then let mapping be false.\n            const mapFn = arguments.length > 1 ? arguments[1] : void undefined;\n            let T;\n            if (typeof mapFn !== 'undefined') {\n                // 5. else\n                // 5. a If IsCallable(mapfn) is false, throw a TypeError exception.\n                if (!isCallable(mapFn)) {\n                    throw new TypeError('Array.from: when provided, the second argument must be a function');\n                }\n\n                // 5. b. If thisArg was supplied, let T be thisArg; else let T be undefined.\n                if (arguments.length > 2) {\n                    T = arguments[2];\n                }\n            }\n\n            // 10. Let lenValue be Get(items, \"length\").\n            // 11. Let len be ToLength(lenValue).\n            const len = toLength(items.length);\n\n            // 13. If IsConstructor(C) is true, then\n            // 13. a. Let A be the result of calling the [[Construct]] internal method of C with an argument list containing the single item len.\n            // 14. a. Else, Let A be ArrayCreate(len).\n            const A = isCallable(C) ? Object(new C(len)) : new Array(len);\n\n            // 16. Let k be 0.\n            let k = 0;\n            // 17. Repeat, while k < len… (also steps a - h)\n            let kValue;\n            while (k < len) {\n                kValue = items[k];\n                if (mapFn) {\n                    A[k] = typeof T === 'undefined' ? mapFn(kValue, k) : mapFn.call(T, kValue, k);\n                } else {\n                    A[k] = kValue;\n                }\n                k += 1;\n            }\n            // 18. Let putStatus be Put(A, \"length\", len, true).\n            A.length = len;\n            // 20. Return A.\n            return A;\n        };\n    }());\n}\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign\nif (typeof Object.assign != 'function') {\n    // Must be writable: true, enumerable: false, configurable: true\n    Object.defineProperty(Object, \"assign\", {\n        value: function assign(target, _varArgs) { // .length of function is 2\n            'use strict';\n            if (target == null) { // TypeError if undefined or null\n                throw new TypeError('Cannot convert undefined or null to object');\n            }\n\n            const to = Object(target);\n\n            for (let index = 1; index < arguments.length; index++) {\n                const nextSource = arguments[index];\n\n                if (nextSource != null) { // Skip over if undefined or null\n                    for (const nextKey in nextSource) {\n                        // Avoid bugs when hasOwnProperty is shadowed\n                        if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {\n                            to[nextKey] = nextSource[nextKey];\n                        }\n                    }\n                }\n            }\n            return to;\n        },\n        writable: true,\n        configurable: true\n    });\n}\n\nfunction initCommentPreviewTab($form) {\n    const $tabMenu = $form.find('.tabular.menu');\n    $tabMenu.find('.item').tab();\n    $tabMenu.find('.item[data-tab=\"' + $tabMenu.data('preview') + '\"]').click(function () {\n        const $this = $(this);\n        $.post($this.data('url'), {\n                \"_csrf\": csrf,\n                \"mode\": \"gfm\",\n                \"context\": $this.data('context'),\n                \"text\": $form.find('.tab.segment[data-tab=\"' + $tabMenu.data('write') + '\"] textarea').val()\n            },\n            function (data) {\n                const $previewPanel = $form.find('.tab.segment[data-tab=\"' + $tabMenu.data('preview') + '\"]');\n                $previewPanel.html(data);\n                emojify.run($previewPanel[0]);\n                $('pre code', $previewPanel[0]).each(function () {\n                    hljs.highlightBlock(this);\n                });\n            }\n        );\n    });\n\n    buttonsClickOnEnter();\n}\n\nfunction initEditPreviewTab($form) {\n    const $tabMenu = $form.find('.tabular.menu');\n    $tabMenu.find('.item').tab();\n    const $previewTab = $tabMenu.find('.item[data-tab=\"' + $tabMenu.data('preview') + '\"]');\n    if ($previewTab.length) {\n        previewFileModes = $previewTab.data('preview-file-modes').split(',');\n        $previewTab.click(function () {\n            const $this = $(this);\n            $.post($this.data('url'), {\n                    \"_csrf\": csrf,\n                    \"mode\": \"gfm\",\n                    \"context\": $this.data('context'),\n                    \"text\": $form.find('.tab.segment[data-tab=\"' + $tabMenu.data('write') + '\"] textarea').val()\n                },\n                function (data) {\n                    const $previewPanel = $form.find('.tab.segment[data-tab=\"' + $tabMenu.data('preview') + '\"]');\n                    $previewPanel.html(data);\n                    emojify.run($previewPanel[0]);\n                    $('pre code', $previewPanel[0]).each(function () {\n                        hljs.highlightBlock(this);\n                    });\n                }\n            );\n        });\n    }\n}\n\nfunction initEditDiffTab($form) {\n    const $tabMenu = $form.find('.tabular.menu');\n    $tabMenu.find('.item').tab();\n    $tabMenu.find('.item[data-tab=\"' + $tabMenu.data('diff') + '\"]').click(function () {\n        const $this = $(this);\n        $.post($this.data('url'), {\n                \"_csrf\": csrf,\n                \"context\": $this.data('context'),\n                \"content\": $form.find('.tab.segment[data-tab=\"' + $tabMenu.data('write') + '\"] textarea').val()\n            },\n            function (data) {\n                const $diffPreviewPanel = $form.find('.tab.segment[data-tab=\"' + $tabMenu.data('diff') + '\"]');\n                $diffPreviewPanel.html(data);\n                emojify.run($diffPreviewPanel[0]);\n            }\n        );\n    });\n}\n\n\nfunction initEditForm() {\n    if ($('.edit.form').length == 0) {\n        return;\n    }\n\n    initEditPreviewTab($('.edit.form'));\n    initEditDiffTab($('.edit.form'));\n}\n\nfunction initBranchSelector() {\n    const $selectBranch = $('.ui.select-branch')\n    const $branchMenu = $selectBranch.find('.reference-list-menu');\n    $branchMenu.find('.item:not(.no-select)').click(function () {\n        const selectedValue = $(this).data('id');\n        $($(this).data('id-selector')).val(selectedValue);\n        $selectBranch.find('.ui .branch-name').text(selectedValue);\n    });\n    $selectBranch.find('.reference.column').click(function () {\n        $selectBranch.find('.scrolling.reference-list-menu').css('display', 'none');\n        $selectBranch.find('.reference .text').removeClass('black');\n        $($(this).data('target')).css('display', 'block');\n        $(this).find('.text').addClass('black');\n        return false;\n    });\n}\n\nfunction updateIssuesMeta(url, action, issueIds, elementId) {\n    return new Promise(function(resolve) {\n        $.ajax({\n            type: \"POST\",\n            url: url,\n            data: {\n                \"_csrf\": csrf,\n                \"action\": action,\n                \"issue_ids\": issueIds,\n                \"id\": elementId\n            },\n            success: resolve\n        })\n    })\n}\n\nfunction initRepoStatusChecker() {\n    const migrating = $(\"#repo_migrating\");\n    $('#repo_migrating_failed').hide();\n    if (migrating) {\n        const repo_name = migrating.attr('repo');\n        if (typeof repo_name === 'undefined') {\n            return\n        }\n        $.ajax({\n            type: \"GET\",\n            url: suburl +\"/\"+repo_name+\"/status\",\n            data: {\n                \"_csrf\": csrf,\n            },\n            complete: function(xhr) {\n                if (xhr.status == 200) {\n                    if (xhr.responseJSON) {\n                        if (xhr.responseJSON[\"status\"] == 0) {\n                            location.reload();\n                            return\n                        }\n\n                        setTimeout(function () {\n                            initRepoStatusChecker()\n                        }, 2000);\n                        return\n                    }\n                }\n                $('#repo_migrating_progress').hide();\n                $('#repo_migrating_failed').show();\n            }\n        })\n    }\n}\n\nfunction initReactionSelector(parent) {\n    let reactions = '';\n    if (!parent) {\n        parent = $(document);\n        reactions = '.reactions > ';\n    }\n\n    parent.find(reactions + 'a.label').popup({'position': 'bottom left', 'metadata': {'content': 'title', 'title': 'none'}});\n\n    parent.find('.select-reaction > .menu > .item, ' + reactions + 'a.label').on('click', function(e){\n        const vm = this;\n        e.preventDefault();\n\n        if ($(this).hasClass('disabled')) return;\n\n        const actionURL = $(this).hasClass('item') ?\n                $(this).closest('.select-reaction').data('action-url') :\n                $(this).data('action-url');\n        const url = actionURL + '/' + ($(this).hasClass('blue') ? 'unreact' : 'react');\n        $.ajax({\n            type: 'POST',\n            url: url,\n            data: {\n                '_csrf': csrf,\n                'content': $(this).data('content')\n            }\n        }).done(function(resp) {\n            if (resp && (resp.html || resp.empty)) {\n                const content = $(vm).closest('.content');\n                let react = content.find('.segment.reactions');\n                if (!resp.empty && react.length > 0) {\n                    react.remove();\n                }\n                if (!resp.empty) {\n                    react = $('<div class=\"ui attached segment reactions\"></div>');\n                    const attachments = content.find('.segment.bottom:first');\n                    if (attachments.length > 0) {\n                        react.insertBefore(attachments);\n                    } else {\n                        react.appendTo(content);\n                    }\n                    react.html(resp.html);\n                    const hasEmoji = react.find('.has-emoji');\n                    for (let i = 0; i < hasEmoji.length; i++) {\n                        emojify.run(hasEmoji.get(i));\n                    }\n                    react.find('.dropdown').dropdown();\n                    initReactionSelector(react);\n                }\n            }\n        });\n    });\n}\n\nfunction insertAtCursor(field, value) {\n    if (field.selectionStart || field.selectionStart === 0) {\n        const startPos = field.selectionStart;\n        const endPos = field.selectionEnd;\n        field.value = field.value.substring(0, startPos)\n            + value\n            + field.value.substring(endPos, field.value.length);\n        field.selectionStart = startPos + value.length;\n        field.selectionEnd = startPos + value.length;\n    } else {\n        field.value += value;\n    }\n}\n\nfunction replaceAndKeepCursor(field, oldval, newval) {\n    if (field.selectionStart || field.selectionStart === 0) {\n        const startPos = field.selectionStart;\n        const endPos = field.selectionEnd;\n        field.value = field.value.replace(oldval, newval);\n        field.selectionStart = startPos + newval.length - oldval.length;\n        field.selectionEnd = endPos + newval.length - oldval.length;\n    } else {\n        field.value = field.value.replace(oldval, newval);\n    }\n}\n\nfunction retrieveImageFromClipboardAsBlob(pasteEvent, callback){\n    if (!pasteEvent.clipboardData) {\n        return;\n    }\n\n    const items = pasteEvent.clipboardData.items;\n    if (typeof(items) === \"undefined\") {\n        return;\n    }\n\n    for (let i = 0; i < items.length; i++) {\n        if (items[i].type.indexOf(\"image\") === -1) continue;\n        const blob = items[i].getAsFile();\n\n        if (typeof(callback) === \"function\") {\n            pasteEvent.preventDefault();\n            pasteEvent.stopPropagation();\n            callback(blob);\n        }\n    }\n}\n\nfunction uploadFile(file, callback) {\n    const xhr = new XMLHttpRequest();\n\n    xhr.onload = function() {\n        if (xhr.status == 200) {\n            callback(xhr.responseText);\n        }\n    };\n\n    xhr.open(\"post\", suburl + \"/attachments\", true);\n    xhr.setRequestHeader(\"X-Csrf-Token\", csrf);\n    const formData = new FormData();\n    formData.append('file', file, file.name);\n    xhr.send(formData);\n}\n\nfunction reload() {\n    window.location.reload();\n}\n\nfunction initImagePaste(target) {\n    target.each(function() {\n        const field = this;\n        field.addEventListener('paste', function(event){\n            retrieveImageFromClipboardAsBlob(event, function(img) {\n                const name = img.name.substr(0, img.name.lastIndexOf('.'));\n                insertAtCursor(field, '![' + name + ']()');\n                uploadFile(img, function(res) {\n                    const data = JSON.parse(res);\n                    replaceAndKeepCursor(field, '![' + name + ']()', '![' + name + '](' + suburl + '/attachments/' + data.uuid + ')');\n                    const input = $('<input id=\"' + data.uuid + '\" name=\"files\" type=\"hidden\">').val(data.uuid);\n                    $('.files').append(input);\n                });\n            });\n        }, false);\n    });\n}\n\nfunction initCommentForm() {\n    if ($('.comment.form').length == 0) {\n        return\n    }\n\n    initBranchSelector();\n    initCommentPreviewTab($('.comment.form'));\n    initImagePaste($('.comment.form textarea'));\n\n    // Listsubmit\n    function initListSubmits(selector, outerSelector) {\n        const $list = $('.ui.' + outerSelector + '.list');\n        const $noSelect = $list.find('.no-select');\n        const $listMenu = $('.' + selector + ' .menu');\n        let hasLabelUpdateAction = $listMenu.data('action') == 'update';\n        const labels = {};\n\n        $('.' + selector).dropdown('setting', 'onHide', function(){\n            hasLabelUpdateAction = $listMenu.data('action') == 'update'; // Update the var\n            if (hasLabelUpdateAction) {\n                const promises = [];\n                Object.keys(labels).forEach(function(elementId) {\n                    const label = labels[elementId];\n                    const promise = updateIssuesMeta(\n                        label[\"update-url\"],\n                        label[\"action\"],\n                        label[\"issue-id\"],\n                        elementId\n                    );\n                    promises.push(promise);\n                });\n                Promise.all(promises).then(reload);\n            }\n        });\n\n        $listMenu.find('.item:not(.no-select)').click(function () {\n\n            // we don't need the action attribute when updating assignees\n            if (selector == 'select-assignees-modify') {\n\n                // UI magic. We need to do this here, otherwise it would destroy the functionality of\n                // adding/removing labels\n                if ($(this).hasClass('checked')) {\n                    $(this).removeClass('checked');\n                    $(this).find('.octicon').removeClass('octicon-check');\n                } else {\n                    $(this).addClass('checked');\n                    $(this).find('.octicon').addClass('octicon-check');\n                }\n\n                updateIssuesMeta(\n                    $listMenu.data('update-url'),\n                    \"\",\n                    $listMenu.data('issue-id'),\n                    $(this).data('id')\n                );\n                $listMenu.data('action', 'update'); // Update to reload the page when we updated items\n                return false;\n            }\n\n            if ($(this).hasClass('checked')) {\n                $(this).removeClass('checked');\n                $(this).find('.octicon').removeClass('octicon-check');\n                if (hasLabelUpdateAction) {\n                    if (!($(this).data('id') in labels)) {\n                        labels[$(this).data('id')] = {\n                            \"update-url\": $listMenu.data('update-url'),\n                            \"action\": \"detach\",\n                            \"issue-id\": $listMenu.data('issue-id'),\n                        };\n                    } else {\n                        delete labels[$(this).data('id')];\n                    }\n                }\n            } else {\n                $(this).addClass('checked');\n                $(this).find('.octicon').addClass('octicon-check');\n                if (hasLabelUpdateAction) {\n                    if (!($(this).data('id') in labels)) {\n                        labels[$(this).data('id')] = {\n                            \"update-url\": $listMenu.data('update-url'),\n                            \"action\": \"attach\",\n                            \"issue-id\": $listMenu.data('issue-id'),\n                        };\n                    } else {\n                        delete labels[$(this).data('id')];\n                    }\n                }\n            }\n\n            const listIds = [];\n            $(this).parent().find('.item').each(function () {\n                if ($(this).hasClass('checked')) {\n                    listIds.push($(this).data('id'));\n                    $($(this).data('id-selector')).removeClass('hide');\n                } else {\n                    $($(this).data('id-selector')).addClass('hide');\n                }\n            });\n            if (listIds.length == 0) {\n                $noSelect.removeClass('hide');\n            } else {\n                $noSelect.addClass('hide');\n            }\n            $($(this).parent().data('id')).val(listIds.join(\",\"));\n            return false;\n        });\n        $listMenu.find('.no-select.item').click(function () {\n            if (hasLabelUpdateAction || selector == 'select-assignees-modify') {\n                updateIssuesMeta(\n                    $listMenu.data('update-url'),\n                    \"clear\",\n                    $listMenu.data('issue-id'),\n                    \"\"\n                ).then(reload);\n            }\n\n            $(this).parent().find('.item').each(function () {\n                $(this).removeClass('checked');\n                $(this).find('.octicon').removeClass('octicon-check');\n            });\n\n            $list.find('.item').each(function () {\n                $(this).addClass('hide');\n            });\n            $noSelect.removeClass('hide');\n            $($(this).parent().data('id')).val('');\n\n        });\n    }\n\n    // Init labels and assignees\n    initListSubmits('select-label', 'labels');\n    initListSubmits('select-assignees', 'assignees');\n    initListSubmits('select-assignees-modify', 'assignees');\n\n    function selectItem(select_id, input_id) {\n        const $menu = $(select_id + ' .menu');\n        const $list = $('.ui' + select_id + '.list');\n        const hasUpdateAction = $menu.data('action') == 'update';\n\n        $menu.find('.item:not(.no-select)').click(function () {\n            $(this).parent().find('.item').each(function () {\n                $(this).removeClass('selected active')\n            });\n\n            $(this).addClass('selected active');\n            if (hasUpdateAction) {\n                updateIssuesMeta(\n                    $menu.data('update-url'),\n                    \"\",\n                    $menu.data('issue-id'),\n                    $(this).data('id')\n                ).then(reload);\n            }\n            switch (input_id) {\n                case '#milestone_id':\n                    $list.find('.selected').html('<a class=\"item\" href=' + $(this).data('href') + '>' +\n                        htmlEncode($(this).text()) + '</a>');\n                    break;\n                case '#assignee_id':\n                    $list.find('.selected').html('<a class=\"item\" href=' + $(this).data('href') + '>' +\n                        '<img class=\"ui avatar image\" src=' + $(this).data('avatar') + '>' +\n                        htmlEncode($(this).text()) + '</a>');\n            }\n            $('.ui' + select_id + '.list .no-select').addClass('hide');\n            $(input_id).val($(this).data('id'));\n        });\n        $menu.find('.no-select.item').click(function () {\n            $(this).parent().find('.item:not(.no-select)').each(function () {\n                $(this).removeClass('selected active')\n            });\n\n            if (hasUpdateAction) {\n                updateIssuesMeta(\n                    $menu.data('update-url'),\n                    \"\",\n                    $menu.data('issue-id'),\n                    $(this).data('id')\n                ).then(reload);\n            }\n\n            $list.find('.selected').html('');\n            $list.find('.no-select').removeClass('hide');\n            $(input_id).val('');\n        });\n    }\n\n    // Milestone and assignee\n    selectItem('.select-milestone', '#milestone_id');\n    selectItem('.select-assignee', '#assignee_id');\n}\n\nfunction initInstall() {\n    if ($('.install').length == 0) {\n        return;\n    }\n\n    if ($('#db_host').val()==\"\") {\n        $('#db_host').val(\"127.0.0.1:3306\");\n        $('#db_user').val(\"gitea\");\n        $('#db_name').val(\"gitea\");\n    }\n\n    // Database type change detection.\n    $(\"#db_type\").change(function () {\n        const sqliteDefault = 'data/gitea.db';\n        const tidbDefault = 'data/gitea_tidb';\n\n        const dbType = $(this).val();\n        if (dbType === \"SQLite3\") {\n            $('#sql_settings').hide();\n            $('#pgsql_settings').hide();\n            $('#mysql_settings').hide();\n            $('#sqlite_settings').show();\n\n            if (dbType === \"SQLite3\" && $('#db_path').val() == tidbDefault) {\n                $('#db_path').val(sqliteDefault);\n            }\n            return;\n        }\n\n        const dbDefaults = {\n            \"MySQL\": \"127.0.0.1:3306\",\n            \"PostgreSQL\": \"127.0.0.1:5432\",\n            \"MSSQL\": \"127.0.0.1:1433\"\n        };\n\n        $('#sqlite_settings').hide();\n        $('#sql_settings').show();\n\n        $('#pgsql_settings').toggle(dbType === \"PostgreSQL\");\n        $('#mysql_settings').toggle(dbType === \"MySQL\");\n        $.each(dbDefaults, function(_type, defaultHost) {\n            if ($('#db_host').val() == defaultHost) {\n                $('#db_host').val(dbDefaults[dbType]);\n                return false;\n            }\n        });\n    });\n\n    // TODO: better handling of exclusive relations.\n    $('#offline-mode input').change(function () {\n        if ($(this).is(':checked')) {\n            $('#disable-gravatar').checkbox('check');\n            $('#federated-avatar-lookup').checkbox('uncheck');\n        }\n    });\n    $('#disable-gravatar input').change(function () {\n        if ($(this).is(':checked')) {\n            $('#federated-avatar-lookup').checkbox('uncheck');\n        } else {\n            $('#offline-mode').checkbox('uncheck');\n        }\n    });\n    $('#federated-avatar-lookup input').change(function () {\n        if ($(this).is(':checked')) {\n            $('#disable-gravatar').checkbox('uncheck');\n            $('#offline-mode').checkbox('uncheck');\n        }\n    });\n    $('#enable-openid-signin input').change(function () {\n        if ($(this).is(':checked')) {\n            if (!$('#disable-registration input').is(':checked')) {\n                $('#enable-openid-signup').checkbox('check');\n            }\n        } else {\n            $('#enable-openid-signup').checkbox('uncheck');\n        }\n    });\n    $('#disable-registration input').change(function () {\n        if ($(this).is(':checked')) {\n            $('#enable-captcha').checkbox('uncheck');\n            $('#enable-openid-signup').checkbox('uncheck');\n        } else {\n            $('#enable-openid-signup').checkbox('check');\n        }\n    });\n    $('#enable-captcha input').change(function () {\n        if ($(this).is(':checked')) {\n            $('#disable-registration').checkbox('uncheck');\n        }\n    });\n}\n\nfunction initRepository() {\n    if ($('.repository').length == 0) {\n        return;\n    }\n\n    function initFilterSearchDropdown(selector) {\n        const $dropdown = $(selector);\n        $dropdown.dropdown({\n            fullTextSearch: true,\n            selectOnKeydown: false,\n            onChange: function (_text, _value, $choice) {\n                if ($choice.data('url')) {\n                    window.location.href = $choice.data('url');\n                }\n            },\n            message: {noResults: $dropdown.data('no-results')}\n        });\n    }\n\n    // File list and commits\n    if ($('.repository.file.list').length > 0 ||\n        ('.repository.commits').length > 0) {\n        initFilterBranchTagDropdown('.choose.reference .dropdown');\n    }\n\n    // Wiki\n    if ($('.repository.wiki.view').length > 0) {\n        initFilterSearchDropdown('.choose.page .dropdown');\n    }\n\n    // Options\n    if ($('.repository.settings.options').length > 0) {\n        $('#repo_name').keyup(function () {\n            const $prompt = $('#repo-name-change-prompt');\n            if ($(this).val().toString().toLowerCase() != $(this).data('name').toString().toLowerCase()) {\n                $prompt.show();\n            } else {\n                $prompt.hide();\n            }\n        });\n\n        // Enable or select internal/external wiki system and issue tracker.\n        $('.enable-system').change(function () {\n            if (this.checked) {\n                $($(this).data('target')).removeClass('disabled');\n                if (!$(this).data('context')) $($(this).data('context')).addClass('disabled');\n            } else {\n                $($(this).data('target')).addClass('disabled');\n                if (!$(this).data('context')) $($(this).data('context')).removeClass('disabled');\n            }\n        });\n        $('.enable-system-radio').change(function () {\n            if (this.value == 'false') {\n                $($(this).data('target')).addClass('disabled');\n                if (typeof $(this).data('context') !== 'undefined') $($(this).data('context')).removeClass('disabled');\n            } else if (this.value == 'true') {\n                $($(this).data('target')).removeClass('disabled');\n                if (typeof $(this).data('context') !== 'undefined')  $($(this).data('context')).addClass('disabled');\n            }\n        });\n    }\n\n    // Labels\n    if ($('.repository.labels').length > 0) {\n        // Create label\n        const $newLabelPanel = $('.new-label.segment');\n        $('.new-label.button').click(function () {\n            $newLabelPanel.show();\n        });\n        $('.new-label.segment .cancel').click(function () {\n            $newLabelPanel.hide();\n        });\n\n        $('.color-picker').each(function () {\n            $(this).minicolors();\n        });\n        $('.precolors .color').click(function () {\n            const color_hex = $(this).data('color-hex');\n            $('.color-picker').val(color_hex);\n            $('.minicolors-swatch-color').css(\"background-color\", color_hex);\n        });\n        $('.edit-label-button').click(function () {\n            $('#label-modal-id').val($(this).data('id'));\n            $('.edit-label .new-label-input').val($(this).data('title'));\n            $('.edit-label .new-label-desc-input').val($(this).data('description'));\n            $('.edit-label .color-picker').val($(this).data('color'));\n            $('.minicolors-swatch-color').css(\"background-color\", $(this).data('color'));\n            $('.edit-label.modal').modal({\n                onApprove: function () {\n                    $('.edit-label.form').submit();\n                }\n            }).modal('show');\n            return false;\n        });\n    }\n\n    // Milestones\n    if ($('.repository.new.milestone').length > 0) {\n        const $datepicker = $('.milestone.datepicker');\n        $datepicker.datetimepicker({\n            lang: $datepicker.data('lang'),\n            inline: true,\n            timepicker: false,\n            startDate: $datepicker.data('start-date'),\n            formatDate: 'Y-m-d',\n            onSelectDate: function (ct) {\n                $('#deadline').val(ct.dateFormat('Y-m-d'));\n            }\n        });\n        $('#clear-date').click(function () {\n            $('#deadline').val('');\n            return false;\n        });\n    }\n\n    // Issues\n    if ($('.repository.view.issue').length > 0) {\n        // Edit issue title\n        const $issueTitle = $('#issue-title');\n        const $editInput = $('#edit-title-input input');\n        const editTitleToggle = function () {\n            $issueTitle.toggle();\n            $('.not-in-edit').toggle();\n            $('#edit-title-input').toggle();\n            $('.in-edit').toggle();\n            $editInput.focus();\n            return false;\n        };\n        $('#edit-title').click(editTitleToggle);\n        $('#cancel-edit-title').click(editTitleToggle);\n        $('#save-edit-title').click(editTitleToggle).click(function () {\n            if ($editInput.val().length == 0 ||\n                $editInput.val() == $issueTitle.text()) {\n                $editInput.val($issueTitle.text());\n                return false;\n            }\n\n            $.post($(this).data('update-url'), {\n                    \"_csrf\": csrf,\n                    \"title\": $editInput.val()\n                },\n                function (data) {\n                    $editInput.val(data.title);\n                    $issueTitle.text(data.title);\n                    reload();\n                });\n            return false;\n        });\n\n        // Edit issue or comment content\n        $('.edit-content').click(function () {\n            const $segment = $(this).parent().parent().parent().next();\n            const $editContentZone = $segment.find('.edit-content-zone');\n            const $renderContent = $segment.find('.render-content');\n            const $rawContent = $segment.find('.raw-content');\n            let $textarea;\n\n            // Setup new form\n            if ($editContentZone.html().length == 0) {\n                $editContentZone.html($('#edit-content-form').html());\n                $textarea = $editContentZone.find('textarea');\n                issuesTribute.attach($textarea.get());\n                emojiTribute.attach($textarea.get());\n\n                const $dropzone = $editContentZone.find('.dropzone');\n                $dropzone.data(\"saved\", false);\n                const $files = $editContentZone.find('.comment-files');\n                if ($dropzone.length > 0) {\n                    const filenameDict = {};\n                    $dropzone.dropzone({\n                        url: $dropzone.data('upload-url'),\n                        headers: {\"X-Csrf-Token\": csrf},\n                        maxFiles: $dropzone.data('max-file'),\n                        maxFilesize: $dropzone.data('max-size'),\n                        acceptedFiles: ($dropzone.data('accepts') === '*/*') ? null : $dropzone.data('accepts'),\n                        addRemoveLinks: true,\n                        dictDefaultMessage: $dropzone.data('default-message'),\n                        dictInvalidFileType: $dropzone.data('invalid-input-type'),\n                        dictFileTooBig: $dropzone.data('file-too-big'),\n                        dictRemoveFile: $dropzone.data('remove-file'),\n                        init: function () {\n                            this.on(\"success\", function (file, data) {\n                                filenameDict[file.name] = {\n                                    \"uuid\": data.uuid,\n                                    \"submitted\": false\n                                }\n                                const input = $('<input id=\"' + data.uuid + '\" name=\"files\" type=\"hidden\">').val(data.uuid);\n                                $files.append(input);\n                            });\n                            this.on(\"removedfile\", function (file) {\n                                if (!(file.name in filenameDict)) {\n                                    return;\n                                }\n                                $('#' + filenameDict[file.name].uuid).remove();\n                                if ($dropzone.data('remove-url') && $dropzone.data('csrf') && !filenameDict[file.name].submitted) {\n                                    $.post($dropzone.data('remove-url'), {\n                                        file: filenameDict[file.name].uuid,\n                                        _csrf: $dropzone.data('csrf')\n                                    });\n                                }\n                            });\n                            this.on(\"submit\", function () {\n                                $.each(filenameDict, function(name){\n                                    filenameDict[name].submitted = true;\n                                });\n                            });\n                            this.on(\"reload\", function (){\n                                $.getJSON($editContentZone.data('attachment-url'), function(data){\n                                    const drop = $dropzone.get(0).dropzone;\n                                    drop.removeAllFiles(true);\n                                    $files.empty();\n                                    $.each(data, function(){\n                                        const imgSrc =  $dropzone.data('upload-url') + \"/\" + this.uuid;\n                                        drop.emit(\"addedfile\", this);\n                                        drop.emit(\"thumbnail\", this, imgSrc);\n                                        drop.emit(\"complete\", this);\n                                        drop.files.push(this);\n                                        filenameDict[this.name] = {\n                                            \"submitted\": true,\n                                            \"uuid\": this.uuid\n                                        }\n                                        $dropzone.find(\"img[src='\" + imgSrc + \"']\").css(\"max-width\", \"100%\");\n                                        const input = $('<input id=\"' + this.uuid + '\" name=\"files\" type=\"hidden\">').val(this.uuid);\n                                        $files.append(input);\n                                    });\n                                });\n                            });\n                        }\n                    });\n                    $dropzone.get(0).dropzone.emit(\"reload\");\n                }\n                // Give new write/preview data-tab name to distinguish from others\n                const $editContentForm = $editContentZone.find('.ui.comment.form');\n                const $tabMenu = $editContentForm.find('.tabular.menu');\n                $tabMenu.attr('data-write', $editContentZone.data('write'));\n                $tabMenu.attr('data-preview', $editContentZone.data('preview'));\n                $tabMenu.find('.write.item').attr('data-tab', $editContentZone.data('write'));\n                $tabMenu.find('.preview.item').attr('data-tab', $editContentZone.data('preview'));\n                $editContentForm.find('.write.segment').attr('data-tab', $editContentZone.data('write'));\n                $editContentForm.find('.preview.segment').attr('data-tab', $editContentZone.data('preview'));\n\n                initCommentPreviewTab($editContentForm);\n\n                $editContentZone.find('.cancel.button').click(function () {\n                    $renderContent.show();\n                    $editContentZone.hide();\n                    $dropzone.get(0).dropzone.emit(\"reload\");\n                });\n                $editContentZone.find('.save.button').click(function () {\n                    $renderContent.show();\n                    $editContentZone.hide();\n                    const $attachments = $files.find(\"[name=files]\").map(function(){\n                        return $(this).val();\n                    }).get();\n                    $.post($editContentZone.data('update-url'), {\n                        \"_csrf\": csrf,\n                        \"content\": $textarea.val(),\n                        \"context\": $editContentZone.data('context'),\n                        \"files\": $attachments\n                    },\n                    function (data) {\n                        if (data.length == 0) {\n                            $renderContent.html($('#no-content').html());\n                        } else {\n                            $renderContent.html(data.content);\n                            emojify.run($renderContent[0]);\n                            $('pre code', $renderContent[0]).each(function () {\n                                hljs.highlightBlock(this);\n                            });\n                        }\n                        const $content = $segment.parent();\n                        if(!$content.find(\".ui.small.images\").length){\n                            if(data.attachments != \"\"){\n                                $content.append(\n                                '<div class=\"ui bottom attached segment\">' +\n                                '    <div class=\"ui small images\">' +\n                                '    </div>' +\n                                '</div>'\n                                );\n                                $content.find(\".ui.small.images\").html(data.attachments);\n                            }\n                        } else if (data.attachments == \"\") {\n                            $content.find(\".ui.small.images\").parent().remove();\n                        } else {\n                            $content.find(\".ui.small.images\").html(data.attachments);\n                        }\n                        $dropzone.get(0).dropzone.emit(\"submit\");\n                        $dropzone.get(0).dropzone.emit(\"reload\");\n                    });\n                });\n            } else {\n                $textarea = $segment.find('textarea');\n            }\n\n            // Show write/preview tab and copy raw content as needed\n            $editContentZone.show();\n            $renderContent.hide();\n            if ($textarea.val().length == 0) {\n                $textarea.val($rawContent.text());\n            }\n            $textarea.focus();\n            return false;\n        });\n\n        // Delete comment\n        $('.delete-comment').click(function () {\n            const $this = $(this);\n            if (confirm($this.data('locale'))) {\n                $.post($this.data('url'), {\n                    \"_csrf\": csrf\n                }).success(function () {\n                    $('#' + $this.data('comment-id')).remove();\n                });\n            }\n            return false;\n        });\n\n        // Change status\n        const $statusButton = $('#status-button');\n        $('#comment-form .edit_area').keyup(function () {\n            if ($(this).val().length == 0) {\n                $statusButton.text($statusButton.data('status'))\n            } else {\n                $statusButton.text($statusButton.data('status-and-comment'))\n            }\n        });\n        $statusButton.click(function () {\n            $('#status').val($statusButton.data('status-val'));\n            $('#comment-form').submit();\n        });\n\n        // Pull Request merge button\n        const $mergeButton = $('.merge-button > button');\n        $mergeButton.on('click', function(e) {\n            e.preventDefault();\n            $('.' + $(this).data('do') + '-fields').show();\n            $(this).parent().hide();\n        });\n        $('.merge-button > .dropdown').dropdown({\n            onChange: function (_text, _value, $choice) {\n                if ($choice.data('do')) {\n                    $mergeButton.find('.button-text').text($choice.text());\n                    $mergeButton.data('do', $choice.data('do'));\n                }\n            }\n        });\n        $('.merge-cancel').on('click', function(e) {\n            e.preventDefault();\n            $(this).closest('.form').hide();\n            $mergeButton.parent().show();\n        });\n\n        initReactionSelector();\n    }\n\n    // Diff\n    if ($('.repository.diff').length > 0) {\n        $('.diff-counter').each(function () {\n            const $item = $(this);\n            const addLine = $item.find('span[data-line].add').data(\"line\");\n            const delLine = $item.find('span[data-line].del').data(\"line\");\n            const addPercent = parseFloat(addLine) / (parseFloat(addLine) + parseFloat(delLine)) * 100;\n            $item.find(\".bar .add\").css(\"width\", addPercent + \"%\");\n        });\n    }\n\n    // Quick start and repository home\n    $('#repo-clone-ssh').click(function () {\n        $('.clone-url').text($(this).data('link'));\n        $('#repo-clone-url').val($(this).data('link'));\n        $(this).addClass('blue');\n        $('#repo-clone-https').removeClass('blue');\n        localStorage.setItem('repo-clone-protocol', 'ssh');\n    });\n    $('#repo-clone-https').click(function () {\n        $('.clone-url').text($(this).data('link'));\n        $('#repo-clone-url').val($(this).data('link'));\n        $(this).addClass('blue');\n        $('#repo-clone-ssh').removeClass('blue');\n        localStorage.setItem('repo-clone-protocol', 'https');\n    });\n    $('#repo-clone-url').click(function () {\n        $(this).select();\n    });\n\n    // Pull request\n    const $repoComparePull = $('.repository.compare.pull');\n    if ($repoComparePull.length > 0) {\n        initFilterSearchDropdown('.choose.branch .dropdown');\n        // show pull request form\n        $repoComparePull.find('button.show-form').on('click', function(e) {\n            e.preventDefault();\n            $repoComparePull.find('.pullrequest-form').show();\n            $(this).parent().hide();\n        });\n    }\n\n    // Branches\n    if ($('.repository.settings.branches').length > 0) {\n        initFilterSearchDropdown('.protected-branches .dropdown');\n        $('.enable-protection, .enable-whitelist').change(function () {\n            if (this.checked) {\n                $($(this).data('target')).removeClass('disabled');\n            } else {\n                $($(this).data('target')).addClass('disabled');\n            }\n        });\n    }\n}\n\nfunction initMigration() {\n    const toggleMigrations = function() {\n        const authUserName = $('#auth_username').val();\n        const cloneAddr = $('#clone_addr').val();\n        if (!$('#mirror').is(\":checked\") && (authUserName!=undefined && authUserName.length > 0)\n        && (cloneAddr!=undefined && (cloneAddr.startsWith(\"https://github.com\") || cloneAddr.startsWith(\"http://github.com\")))) {\n            $('#migrate_items').show();\n        } else {\n            $('#migrate_items').hide();\n        }\n    }\n\n    toggleMigrations();\n\n    $('#clone_addr').on('input', toggleMigrations)\n    $('#auth_username').on('input', toggleMigrations)\n    $('#mirror').on('change', toggleMigrations)\n}\n\nfunction initPullRequestReview() {\n    $('.show-outdated').on('click', function (e) {\n        e.preventDefault();\n        const id = $(this).data('comment');\n        $(this).addClass(\"hide\");\n        $(\"#code-comments-\" + id).removeClass('hide');\n        $(\"#code-preview-\" + id).removeClass('hide');\n        $(\"#hide-outdated-\" + id).removeClass('hide');\n    });\n\n    $('.hide-outdated').on('click', function (e) {\n        e.preventDefault();\n        const id = $(this).data('comment');\n        $(this).addClass(\"hide\");\n        $(\"#code-comments-\" + id).addClass('hide');\n        $(\"#code-preview-\" + id).addClass('hide');\n        $(\"#show-outdated-\" + id).removeClass('hide');\n    });\n\n    $('button.comment-form-reply').on('click', function (e) {\n        e.preventDefault();\n        $(this).hide();\n        const form = $(this).parent().find('.comment-form')\n        form.removeClass('hide');\n        assingMenuAttributes(form.find('.menu'));\n    });\n    // The following part is only for diff views\n    if ($('.repository.pull.diff').length == 0) {\n        return;\n    }\n\n    $('.diff-detail-box.ui.sticky').sticky();\n\n    $('.btn-review').on('click', function(e) {\n        e.preventDefault();\n        $(this).closest('.dropdown').find('.menu').toggle('visible');\n    }).closest('.dropdown').find('.link.close').on('click', function(e) {\n        e.preventDefault();\n        $(this).closest('.menu').toggle('visible');\n    });\n\n    $('.code-view .lines-code,.code-view .lines-num')\n        .on('mouseenter', function() {\n            const parent = $(this).closest('td');\n            $(this).closest('tr').addClass(\n                parent.hasClass('lines-num-old') || parent.hasClass('lines-code-old')\n                    ? 'focus-lines-old' : 'focus-lines-new'\n            );\n        })\n        .on('mouseleave', function() {\n            $(this).closest('tr').removeClass('focus-lines-new focus-lines-old');\n        });\n    $('.add-code-comment').on('click', function(e) {\n        // https://github.com/go-gitea/gitea/issues/4745\n        if ($(e.target).hasClass('btn-add-single')) {\n          return;\n        }\n        e.preventDefault();\n        const isSplit = $(this).closest('.code-diff').hasClass('code-diff-split');\n        const side = $(this).data('side');\n        const idx = $(this).data('idx');\n        const path = $(this).data('path');\n        const form = $('#pull_review_add_comment').html();\n        const tr = $(this).closest('tr');\n        let ntr = tr.next();\n        if (!ntr.hasClass('add-comment')) {\n            ntr = $('<tr class=\"add-comment\">'\n                    + (isSplit ? '<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>'\n                               : '<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>')\n                    + '</tr>');\n            tr.after(ntr);\n        }\n        const td = ntr.find('.add-comment-' + side);\n        let commentCloud = td.find('.comment-code-cloud');\n        if (commentCloud.length === 0) {\n            td.html(form);\n            commentCloud = td.find('.comment-code-cloud');\n            assingMenuAttributes(commentCloud.find('.menu'));\n\n            td.find(\"input[name='line']\").val(idx);\n            td.find(\"input[name='side']\").val(side === \"left\" ? \"previous\":\"proposed\");\n            td.find(\"input[name='path']\").val(path);\n        }\n        commentCloud.find('textarea').focus();\n    });\n}\n\nfunction assingMenuAttributes(menu) {\n    const id = Math.floor(Math.random() * Math.floor(1000000));\n    menu.attr('data-write', menu.attr('data-write') + id);\n    menu.attr('data-preview', menu.attr('data-preview') + id);\n    menu.find('.item').each(function() {\n        const tab = $(this).attr('data-tab') + id;\n        $(this).attr('data-tab', tab);\n    });\n    menu.parent().find(\"*[data-tab='write']\").attr('data-tab', 'write' + id);\n    menu.parent().find(\"*[data-tab='preview']\").attr('data-tab', 'preview' + id);\n    initCommentPreviewTab(menu.parent(\".form\"));\n    return id;\n}\n\nfunction initRepositoryCollaboration() {\n    // Change collaborator access mode\n    $('.access-mode.menu .item').click(function () {\n        const $menu = $(this).parent();\n        $.post($menu.data('url'), {\n            \"_csrf\": csrf,\n            \"uid\": $menu.data('uid'),\n            \"mode\": $(this).data('value')\n        })\n    });\n}\n\nfunction initTeamSettings() {\n    // Change team access mode\n    $('.organization.new.team input[name=permission]').change(function () {\n        const val = $('input[name=permission]:checked', '.organization.new.team').val()\n        if (val === 'admin') {\n            $('.organization.new.team .team-units').hide();\n        } else {\n            $('.organization.new.team .team-units').show();\n        }\n    });\n}\n\nfunction initWikiForm() {\n    const $editArea = $('.repository.wiki textarea#edit_area');\n    if ($editArea.length > 0) {\n        const simplemde = new SimpleMDE({\n            autoDownloadFontAwesome: false,\n            element: $editArea[0],\n            forceSync: true,\n            previewRender: function (plainText, preview) { // Async method\n                setTimeout(function () {\n                    // FIXME: still send render request when return back to edit mode\n                    $.post($editArea.data('url'), {\n                            \"_csrf\": csrf,\n                            \"mode\": \"gfm\",\n                            \"context\": $editArea.data('context'),\n                            \"text\": plainText\n                        },\n                        function (data) {\n                            preview.innerHTML = '<div class=\"markdown ui segment\">' + data + '</div>';\n                            emojify.run($('.editor-preview')[0]);\n                        }\n                    );\n                }, 0);\n\n                return \"Loading...\";\n            },\n            renderingConfig: {\n                singleLineBreaks: false\n            },\n            indentWithTabs: false,\n            tabSize: 4,\n            spellChecker: false,\n            toolbar: [\"bold\", \"italic\", \"strikethrough\", \"|\",\n                \"heading-1\", \"heading-2\", \"heading-3\", \"heading-bigger\", \"heading-smaller\", \"|\",\n                {\n                    name: \"code-inline\",\n                    action: function(e){\n                        const cm = e.codemirror;\n                        const selection = cm.getSelection();\n                        cm.replaceSelection(\"`\" + selection + \"`\");\n                        if (!selection) {\n                            const cursorPos = cm.getCursor();\n                            cm.setCursor(cursorPos.line, cursorPos.ch - 1);\n                        }\n                        cm.focus();\n                    },\n                    className: \"fa fa-angle-right\",\n                    title: \"Add Inline Code\",\n                },\"code\", \"quote\", \"|\", {\n                    name: \"checkbox-empty\",\n                    action: function(e){\n                        const cm = e.codemirror;\n                        cm.replaceSelection(\"\\n- [ ] \" + cm.getSelection());\n                        cm.focus();\n                    },\n                    className: \"fa fa-square-o\",\n                    title: \"Add Checkbox (empty)\",\n                },\n                {\n                    name: \"checkbox-checked\",\n                    action: function(e){\n                        const cm = e.codemirror;\n                        cm.replaceSelection(\"\\n- [x] \" + cm.getSelection());\n                        cm.focus();\n                    },\n                    className: \"fa fa-check-square-o\",\n                    title: \"Add Checkbox (checked)\",\n                }, \"|\",\n                \"unordered-list\", \"ordered-list\", \"|\",\n                \"link\", \"image\", \"table\", \"horizontal-rule\", \"|\",\n                \"clean-block\", \"preview\", \"fullscreen\"]\n        })\n        $(simplemde.codemirror.getInputField()).addClass(\"js-quick-submit\");\n    }\n}\n\n// For IE\nString.prototype.endsWith = function (pattern) {\n    const d = this.length - pattern.length;\n    return d >= 0 && this.lastIndexOf(pattern) === d;\n};\n\n// Adding function to get the cursor position in a text field to jQuery object.\n$.fn.getCursorPosition = function () {\n    const el = $(this).get(0);\n    let pos = 0;\n    if ('selectionStart' in el) {\n        pos = el.selectionStart;\n    } else if ('selection' in document) {\n        el.focus();\n        const Sel = document.selection.createRange();\n        const SelLength = document.selection.createRange().text.length;\n        Sel.moveStart('character', -el.value.length);\n        pos = Sel.text.length - SelLength;\n    }\n    return pos;\n}\n\nfunction setSimpleMDE($editArea) {\n    if (codeMirrorEditor) {\n        codeMirrorEditor.toTextArea();\n        codeMirrorEditor = null;\n    }\n\n    if (simpleMDEditor) {\n        return true;\n    }\n\n    simpleMDEditor = new SimpleMDE({\n        autoDownloadFontAwesome: false,\n        element: $editArea[0],\n        forceSync: true,\n        renderingConfig: {\n            singleLineBreaks: false\n        },\n        indentWithTabs: false,\n        tabSize: 4,\n        spellChecker: false,\n        previewRender: function (plainText, preview) { // Async method\n            setTimeout(function () {\n                // FIXME: still send render request when return back to edit mode\n                $.post($editArea.data('url'), {\n                        \"_csrf\": csrf,\n                        \"mode\": \"gfm\",\n                        \"context\": $editArea.data('context'),\n                        \"text\": plainText\n                    },\n                    function (data) {\n                        preview.innerHTML = '<div class=\"markdown ui segment\">' + data + '</div>';\n                        emojify.run($('.editor-preview')[0]);\n                    }\n                );\n            }, 0);\n\n            return \"Loading...\";\n        },\n        toolbar: [\"bold\", \"italic\", \"strikethrough\", \"|\",\n            \"heading-1\", \"heading-2\", \"heading-3\", \"heading-bigger\", \"heading-smaller\", \"|\",\n            \"code\", \"quote\", \"|\",\n            \"unordered-list\", \"ordered-list\", \"|\",\n            \"link\", \"image\", \"table\", \"horizontal-rule\", \"|\",\n            \"clean-block\", \"preview\", \"fullscreen\", \"side-by-side\"]\n    });\n\n    return true;\n}\n\nfunction setCodeMirror($editArea) {\n    if (simpleMDEditor) {\n        simpleMDEditor.toTextArea();\n        simpleMDEditor = null;\n    }\n\n    if (codeMirrorEditor) {\n        return true;\n    }\n\n    codeMirrorEditor = CodeMirror.fromTextArea($editArea[0], {\n        lineNumbers: true\n    });\n    codeMirrorEditor.on(\"change\", function (cm, _change) {\n        $editArea.val(cm.getValue());\n    });\n\n    return true;\n}\n\nfunction initEditor() {\n    $('.js-quick-pull-choice-option').change(function () {\n        if ($(this).val() == 'commit-to-new-branch') {\n            $('.quick-pull-branch-name').show();\n            $('.quick-pull-branch-name input').prop('required',true);\n        } else {\n            $('.quick-pull-branch-name').hide();\n            $('.quick-pull-branch-name input').prop('required',false);\n        }\n        $('#commit-button').text($(this).attr('button_text'));\n    });\n\n    const $editFilename = $(\"#file-name\");\n    $editFilename.keyup(function (e) {\n        const $section = $('.breadcrumb span.section');\n        const $divider = $('.breadcrumb div.divider');\n        let value;\n        let parts;\n\n        if (e.keyCode == 8) {\n            if ($(this).getCursorPosition() == 0) {\n                if ($section.length > 0) {\n                    value = $section.last().find('a').text();\n                    $(this).val(value + $(this).val());\n                    $(this)[0].setSelectionRange(value.length, value.length);\n                    $section.last().remove();\n                    $divider.last().remove();\n                }\n            }\n        }\n        if (e.keyCode == 191) {\n            parts = $(this).val().split('/');\n            for (let i = 0; i < parts.length; ++i) {\n                value = parts[i];\n                if (i < parts.length - 1) {\n                    if (value.length) {\n                        $('<span class=\"section\"><a href=\"#\">' + value + '</a></span>').insertBefore($(this));\n                        $('<div class=\"divider\"> / </div>').insertBefore($(this));\n                    }\n                }\n                else {\n                    $(this).val(value);\n                }\n                $(this)[0].setSelectionRange(0, 0);\n            }\n        }\n        parts = [];\n        $('.breadcrumb span.section').each(function () {\n            const element = $(this);\n            if (element.find('a').length) {\n                parts.push(element.find('a').text());\n            } else {\n                parts.push(element.text());\n            }\n        });\n        if ($(this).val())\n            parts.push($(this).val());\n        $('#tree_path').val(parts.join('/'));\n    }).trigger('keyup');\n\n    const $editArea = $('.repository.editor textarea#edit_area');\n    if (!$editArea.length)\n        return;\n\n    const markdownFileExts = $editArea.data(\"markdown-file-exts\").split(\",\");\n    const lineWrapExtensions = $editArea.data(\"line-wrap-extensions\").split(\",\");\n\n    $editFilename.on(\"keyup\", function () {\n        const val = $editFilename.val();\n        let mode, spec, extension, extWithDot, dataUrl, apiCall;\n\n        extension = extWithDot = \"\";\n        const m = /.+\\.([^.]+)$/.exec(val);\n        if (m) {\n            extension = m[1];\n            extWithDot = \".\" + extension;\n        }\n\n        const info = CodeMirror.findModeByExtension(extension);\n        const previewLink = $('a[data-tab=preview]');\n        if (info) {\n            mode = info.mode;\n            spec = info.mime;\n            apiCall = mode;\n        }\n        else {\n            apiCall = extension\n        }\n\n        if (previewLink.length && apiCall && previewFileModes && previewFileModes.length && previewFileModes.indexOf(apiCall) >= 0) {\n            dataUrl = previewLink.data('url');\n            previewLink.data('url', dataUrl.replace(/(.*)\\/.*/i, '$1/' + mode));\n            previewLink.show();\n        }\n        else {\n            previewLink.hide();\n        }\n\n        // If this file is a Markdown extensions, we will load that editor and return\n        if (markdownFileExts.indexOf(extWithDot) >= 0) {\n            if (setSimpleMDE($editArea)) {\n                return;\n            }\n        }\n\n        // Else we are going to use CodeMirror\n        if (!codeMirrorEditor && !setCodeMirror($editArea)) {\n            return;\n        }\n\n        if (mode) {\n            codeMirrorEditor.setOption(\"mode\", spec);\n            CodeMirror.autoLoadMode(codeMirrorEditor, mode);\n        }\n\n        if (lineWrapExtensions.indexOf(extWithDot) >= 0) {\n            codeMirrorEditor.setOption(\"lineWrapping\", true);\n        }\n        else {\n            codeMirrorEditor.setOption(\"lineWrapping\", false);\n        }\n\n        // get the filename without any folder\n        let value = $editFilename.val();\n        if (value.length === 0) {\n            return;\n        }\n        value = value.split('/');\n        value = value[value.length - 1];\n\n        $.getJSON($editFilename.data('ec-url-prefix')+value, function(editorconfig) {\n            if (editorconfig.indent_style === 'tab') {\n                codeMirrorEditor.setOption(\"indentWithTabs\", true);\n                codeMirrorEditor.setOption('extraKeys', {});\n            } else {\n                codeMirrorEditor.setOption(\"indentWithTabs\", false);\n                // required because CodeMirror doesn't seems to use spaces correctly for {\"indentWithTabs\": false}:\n                // - https://github.com/codemirror/CodeMirror/issues/988\n                // - https://codemirror.net/doc/manual.html#keymaps\n                codeMirrorEditor.setOption('extraKeys', {\n                    Tab: function(cm) {\n                        const spaces = Array(parseInt(cm.getOption(\"indentUnit\")) + 1).join(\" \");\n                        cm.replaceSelection(spaces);\n                    }\n                });\n            }\n            codeMirrorEditor.setOption(\"indentUnit\", editorconfig.indent_size || 4);\n            codeMirrorEditor.setOption(\"tabSize\", editorconfig.tab_width || 4);\n        });\n    }).trigger('keyup');\n\n    // Using events from https://github.com/codedance/jquery.AreYouSure#advanced-usage\n    // to enable or disable the commit button\n    const $commitButton = $('#commit-button');\n    const $editForm = $('.ui.edit.form');\n    const dirtyFileClass = 'dirty-file';\n\n    // Disabling the button at the start\n    $commitButton.prop('disabled', true);\n\n    // Registering a custom listener for the file path and the file content\n    $editForm.areYouSure({\n        silent: true,\n        dirtyClass: dirtyFileClass,\n        fieldSelector: ':input:not(.commit-form-wrapper :input)',\n        change: function () {\n            const dirty = $(this).hasClass(dirtyFileClass);\n            $commitButton.prop('disabled', !dirty);\n        }\n    });\n\n    $commitButton.click(function (event) {\n        // A modal which asks if an empty file should be committed\n        if ($editArea.val().length === 0) {\n            $('#edit-empty-content-modal').modal({\n                onApprove: function () {\n                    $('.edit.form').submit();\n                }\n            }).modal('show');\n            event.preventDefault();\n        }\n    });\n}\n\nfunction initOrganization() {\n    if ($('.organization').length == 0) {\n        return;\n    }\n\n    // Options\n    if ($('.organization.settings.options').length > 0) {\n        $('#org_name').keyup(function () {\n            const $prompt = $('#org-name-change-prompt');\n            if ($(this).val().toString().toLowerCase() != $(this).data('org-name').toString().toLowerCase()) {\n                $prompt.show();\n            } else {\n                $prompt.hide();\n            }\n        });\n    }\n}\n\nfunction initUserSettings() {\n    // Options\n    if ($('.user.settings.profile').length > 0) {\n        $('#username').keyup(function () {\n            const $prompt = $('#name-change-prompt');\n            if ($(this).val().toString().toLowerCase() != $(this).data('name').toString().toLowerCase()) {\n                $prompt.show();\n            } else {\n                $prompt.hide();\n            }\n        });\n    }\n}\n\nfunction initWebhook() {\n    if ($('.new.webhook').length == 0) {\n        return;\n    }\n\n    $('.events.checkbox input').change(function () {\n        if ($(this).is(':checked')) {\n            $('.events.fields').show();\n        }\n    });\n    $('.non-events.checkbox input').change(function () {\n        if ($(this).is(':checked')) {\n            $('.events.fields').hide();\n        }\n    });\n\n    const updateContentType = function () {\n        const visible = $('#http_method').val() === 'POST';\n        $('#content_type').parent().parent()[visible ? 'show' : 'hide']();\n    };\n    updateContentType();\n    $('#http_method').change(function () {\n        updateContentType();\n    });\n\n    // Test delivery\n    $('#test-delivery').click(function () {\n        const $this = $(this);\n        $this.addClass('loading disabled');\n        $.post($this.data('link'), {\n            \"_csrf\": csrf\n        }).done(\n            setTimeout(function () {\n                window.location.href = $this.data('redirect');\n            }, 5000)\n        )\n    });\n}\n\nfunction initAdmin() {\n    if ($('.admin').length == 0) {\n        return;\n    }\n\n    // New user\n    if ($('.admin.new.user').length > 0 ||\n        $('.admin.edit.user').length > 0) {\n        $('#login_type').change(function () {\n            if ($(this).val().substring(0, 1) == '0') {\n                $('#login_name').removeAttr('required');\n                $('.non-local').hide();\n                $('.local').show();\n                $('#user_name').focus();\n\n                if ($(this).data('password') == \"required\") {\n                    $('#password').attr('required', 'required');\n                }\n\n            } else {\n                $('#login_name').attr('required', 'required');\n                $('.non-local').show();\n                $('.local').hide();\n                $('#login_name').focus();\n\n                $('#password').removeAttr('required');\n            }\n        });\n    }\n\n    function onSecurityProtocolChange() {\n        if ($('#security_protocol').val() > 0) {\n            $('.has-tls').show();\n        } else {\n            $('.has-tls').hide();\n        }\n    }\n\n    function onUsePagedSearchChange() {\n        if ($('#use_paged_search').prop('checked')) {\n            $('.search-page-size').show()\n                .find('input').attr('required', 'required');\n        } else {\n            $('.search-page-size').hide()\n                .find('input').removeAttr('required');\n        }\n    }\n\n    function onOAuth2Change() {\n        $('.open_id_connect_auto_discovery_url, .oauth2_use_custom_url').hide();\n        $('.open_id_connect_auto_discovery_url input[required]').removeAttr('required');\n\n        const provider = $('#oauth2_provider').val();\n        switch (provider) {\n            case 'github':\n            case 'gitlab':\n            case 'gitea':\n                $('.oauth2_use_custom_url').show();\n                break;\n            case 'openidConnect':\n                $('.open_id_connect_auto_discovery_url input').attr('required', 'required');\n                $('.open_id_connect_auto_discovery_url').show();\n                break;\n        }\n        onOAuth2UseCustomURLChange();\n    }\n\n    function onOAuth2UseCustomURLChange() {\n        const provider = $('#oauth2_provider').val();\n        $('.oauth2_use_custom_url_field').hide();\n        $('.oauth2_use_custom_url_field input[required]').removeAttr('required');\n\n        if ($('#oauth2_use_custom_url').is(':checked')) {\n            if (!$('#oauth2_token_url').val()) {\n                $('#oauth2_token_url').val($('#' + provider + '_token_url').val());\n            }\n            if (!$('#oauth2_auth_url').val()) {\n                $('#oauth2_auth_url').val($('#' + provider + '_auth_url').val());\n            }\n            if (!$('#oauth2_profile_url').val()) {\n                $('#oauth2_profile_url').val($('#' + provider + '_profile_url').val());\n            }\n            if (!$('#oauth2_email_url').val()) {\n                $('#oauth2_email_url').val($('#' + provider + '_email_url').val());\n            }\n            switch (provider) {\n                case 'github':\n                    $('.oauth2_token_url input, .oauth2_auth_url input, .oauth2_profile_url input, .oauth2_email_url input').attr('required', 'required');\n                    $('.oauth2_token_url, .oauth2_auth_url, .oauth2_profile_url, .oauth2_email_url').show();\n                    break;\n                case 'gitea':\n                case 'gitlab':\n                    $('.oauth2_token_url input, .oauth2_auth_url input, .oauth2_profile_url input').attr('required', 'required');\n                    $('.oauth2_token_url, .oauth2_auth_url, .oauth2_profile_url').show();\n                    $('#oauth2_email_url').val('');\n                    break;\n            }\n        }\n    }\n\n    // New authentication\n    if ($('.admin.new.authentication').length > 0) {\n        $('#auth_type').change(function () {\n            $('.ldap, .dldap, .smtp, .pam, .oauth2, .has-tls .search-page-size').hide();\n\n            $('.ldap input[required], .binddnrequired input[required], .dldap input[required], .smtp input[required], .pam input[required], .oauth2 input[required], .has-tls input[required]').removeAttr('required');\n            $('.binddnrequired').removeClass(\"required\");\n\n            const authType = $(this).val();\n            switch (authType) {\n                case '2':     // LDAP\n                    $('.ldap').show();\n                    $('.binddnrequired input, .ldap div.required:not(.dldap) input').attr('required', 'required');\n                    $('.binddnrequired').addClass(\"required\");\n                    break;\n                case '3':     // SMTP\n                    $('.smtp').show();\n                    $('.has-tls').show();\n                    $('.smtp div.required input, .has-tls').attr('required', 'required');\n                    break;\n                case '4':     // PAM\n                    $('.pam').show();\n                    $('.pam input').attr('required', 'required');\n                    break;\n                case '5':     // LDAP\n                    $('.dldap').show();\n                    $('.dldap div.required:not(.ldap) input').attr('required', 'required');\n                    break;\n                case '6':     // OAuth2\n                    $('.oauth2').show();\n                    $('.oauth2 div.required:not(.oauth2_use_custom_url,.oauth2_use_custom_url_field,.open_id_connect_auto_discovery_url) input').attr('required', 'required');\n                    onOAuth2Change();\n                    break;\n            }\n            if (authType == '2' || authType == '5') {\n                onSecurityProtocolChange()\n            }\n            if (authType == '2') {\n                onUsePagedSearchChange();\n            }\n        });\n        $('#auth_type').change();\n        $('#security_protocol').change(onSecurityProtocolChange);\n        $('#use_paged_search').change(onUsePagedSearchChange);\n        $('#oauth2_provider').change(onOAuth2Change);\n        $('#oauth2_use_custom_url').change(onOAuth2UseCustomURLChange);\n    }\n    // Edit authentication\n    if ($('.admin.edit.authentication').length > 0) {\n        const authType = $('#auth_type').val();\n        if (authType == '2' || authType == '5') {\n            $('#security_protocol').change(onSecurityProtocolChange);\n            if (authType == '2') {\n                $('#use_paged_search').change(onUsePagedSearchChange);\n            }\n        } else if (authType == '6') {\n            $('#oauth2_provider').change(onOAuth2Change);\n            $('#oauth2_use_custom_url').change(onOAuth2UseCustomURLChange);\n            onOAuth2Change();\n        }\n    }\n\n    // Notice\n    if ($('.admin.notice')) {\n        const $detailModal = $('#detail-modal');\n\n        // Attach view detail modals\n        $('.view-detail').click(function () {\n            $detailModal.find('.content p').text($(this).data('content'));\n            $detailModal.modal('show');\n            return false;\n        });\n\n        // Select actions\n        const $checkboxes = $('.select.table .ui.checkbox');\n        $('.select.action').click(function () {\n            switch ($(this).data('action')) {\n                case 'select-all':\n                    $checkboxes.checkbox('check');\n                    break;\n                case 'deselect-all':\n                    $checkboxes.checkbox('uncheck');\n                    break;\n                case 'inverse':\n                    $checkboxes.checkbox('toggle');\n                    break;\n            }\n        });\n        $('#delete-selection').click(function () {\n            const $this = $(this);\n            $this.addClass(\"loading disabled\");\n            const ids = [];\n            $checkboxes.each(function () {\n                if ($(this).checkbox('is checked')) {\n                    ids.push($(this).data('id'));\n                }\n            });\n            $.post($this.data('link'), {\n                \"_csrf\": csrf,\n                \"ids\": ids\n            }).done(function () {\n                window.location.href = $this.data('redirect');\n            });\n        });\n    }\n}\n\nfunction buttonsClickOnEnter() {\n    $('.ui.button').keypress(function (e) {\n        if (e.keyCode == 13 || e.keyCode == 32) // enter key or space bar\n            $(this).click();\n    });\n}\n\nfunction searchUsers() {\n    const $searchUserBox = $('#search-user-box');\n    $searchUserBox.search({\n        minCharacters: 2,\n        apiSettings: {\n            url: suburl + '/api/v1/users/search?q={query}',\n            onResponse: function(response) {\n                const items = [];\n                $.each(response.data, function (_i, item) {\n                    let title = item.login;\n                    if (item.full_name && item.full_name.length > 0) {\n                        title += ' (' + htmlEncode(item.full_name) + ')';\n                    }\n                    items.push({\n                        title: title,\n                        image: item.avatar_url\n                    })\n                });\n\n                return { results: items }\n            }\n        },\n        searchFields: ['login', 'full_name'],\n        showNoResults: false\n    });\n}\n\nfunction searchTeams() {\n    const $searchTeamBox = $('#search-team-box');\n    $searchTeamBox.search({\n        minCharacters: 2,\n        apiSettings: {\n            url: suburl + '/api/v1/orgs/' + $searchTeamBox.data('org') + '/teams/search?q={query}',\n            headers: {\"X-Csrf-Token\": csrf},\n            onResponse: function(response) {\n                const items = [];\n                $.each(response.data, function (_i, item) {\n                    const title = item.name + ' (' + item.permission + ' access)';\n                    items.push({\n                        title: title,\n                    })\n                });\n\n                return { results: items }\n            }\n        },\n        searchFields: ['name', 'description'],\n        showNoResults: false\n    });\n}\n\nfunction searchRepositories() {\n    const $searchRepoBox = $('#search-repo-box');\n    $searchRepoBox.search({\n        minCharacters: 2,\n        apiSettings: {\n            url: suburl + '/api/v1/repos/search?q={query}&uid=' + $searchRepoBox.data('uid'),\n            onResponse: function(response) {\n                const items = [];\n                $.each(response.data, function (_i, item) {\n                    items.push({\n                        title: item.full_name.split(\"/\")[1],\n                        description: item.full_name\n                    })\n                });\n\n                return { results: items }\n            }\n        },\n        searchFields: ['full_name'],\n        showNoResults: false\n    });\n}\n\nfunction initCodeView() {\n    if ($('.code-view .linenums').length > 0) {\n        $(document).on('click', '.lines-num span', function (e) {\n            const $select = $(this);\n            const $list = $select.parent().siblings('.lines-code').find('ol.linenums > li');\n            selectRange($list, $list.filter('[rel=' + $select.attr('id') + ']'), (e.shiftKey ? $list.filter('.active').eq(0) : null));\n            deSelect();\n        });\n\n        $(window).on('hashchange', function () {\n            let m = window.location.hash.match(/^#(L\\d+)-(L\\d+)$/);\n            const $list = $('.code-view ol.linenums > li');\n            let $first;\n            if (m) {\n                $first = $list.filter('.' + m[1]);\n                selectRange($list, $first, $list.filter('.' + m[2]));\n                $(\"html, body\").scrollTop($first.offset().top - 200);\n                return;\n            }\n            m = window.location.hash.match(/^#(L|n)(\\d+)$/);\n            if (m) {\n                $first = $list.filter('.L' + m[2]);\n                selectRange($list, $first);\n                $(\"html, body\").scrollTop($first.offset().top - 200);\n            }\n        }).trigger('hashchange');\n    }\n}\n\nfunction initU2FAuth() {\n    if($('#wait-for-key').length === 0) {\n        return\n    }\n    u2fApi.ensureSupport()\n        .then(function () {\n            $.getJSON(suburl + '/user/u2f/challenge').success(function(req) {\n                u2fApi.sign(req.appId, req.challenge, req.registeredKeys, 30)\n                    .then(u2fSigned)\n                    .catch(function (err) {\n                        if(err === undefined) {\n                            u2fError(1);\n                            return\n                        }\n                        u2fError(err.metaData.code);\n                    });\n            });\n        }).catch(function () {\n            // Fallback in case browser do not support U2F\n            window.location.href = suburl + \"/user/two_factor\"\n        })\n}\nfunction u2fSigned(resp) {\n    $.ajax({\n        url: suburl + '/user/u2f/sign',\n        type: \"POST\",\n        headers: {\"X-Csrf-Token\": csrf},\n        data: JSON.stringify(resp),\n        contentType: \"application/json; charset=utf-8\",\n    }).done(function(res){\n        window.location.replace(res);\n    }).fail(function () {\n        u2fError(1);\n    });\n}\n\nfunction u2fRegistered(resp) {\n    if (checkError(resp)) {\n        return;\n    }\n    $.ajax({\n        url: suburl + '/user/settings/security/u2f/register',\n        type: \"POST\",\n        headers: {\"X-Csrf-Token\": csrf},\n        data: JSON.stringify(resp),\n        contentType: \"application/json; charset=utf-8\",\n        success: function(){\n            reload();\n        },\n        fail: function () {\n            u2fError(1);\n        }\n    });\n}\n\nfunction checkError(resp) {\n    if (!('errorCode' in resp)) {\n        return false;\n    }\n    if (resp.errorCode === 0) {\n        return false;\n    }\n    u2fError(resp.errorCode);\n    return true;\n}\n\n\nfunction u2fError(errorType) {\n    const u2fErrors = {\n        'browser': $('#unsupported-browser'),\n        1: $('#u2f-error-1'),\n        2: $('#u2f-error-2'),\n        3: $('#u2f-error-3'),\n        4: $('#u2f-error-4'),\n        5: $('.u2f-error-5')\n    };\n    u2fErrors[errorType].removeClass('hide');\n    for(const type in u2fErrors){\n        if(type != errorType){\n            u2fErrors[type].addClass('hide');\n        }\n    }\n    $('#u2f-error').modal('show');\n}\n\nfunction initU2FRegister() {\n    $('#register-device').modal({allowMultiple: false});\n    $('#u2f-error').modal({allowMultiple: false});\n    $('#register-security-key').on('click', function(e) {\n        e.preventDefault();\n        u2fApi.ensureSupport()\n            .then(u2fRegisterRequest)\n            .catch(function() {\n                u2fError('browser');\n            })\n    })\n}\n\nfunction u2fRegisterRequest() {\n    $.post(suburl + \"/user/settings/security/u2f/request_register\", {\n        \"_csrf\": csrf,\n        \"name\": $('#nickname').val()\n    }).success(function(req) {\n        $(\"#nickname\").closest(\"div.field\").removeClass(\"error\");\n        $('#register-device').modal('show');\n        if(req.registeredKeys === null) {\n            req.registeredKeys = []\n        }\n        u2fApi.register(req.appId, req.registerRequests, req.registeredKeys, 30)\n            .then(u2fRegistered)\n            .catch(function (reason) {\n                if(reason === undefined) {\n                    u2fError(1);\n                    return\n                }\n                u2fError(reason.metaData.code);\n            });\n    }).fail(function(xhr) {\n        if(xhr.status === 409) {\n            $(\"#nickname\").closest(\"div.field\").addClass(\"error\");\n        }\n    });\n}\n\nfunction initWipTitle() {\n    $(\".title_wip_desc > a\").click(function (e) {\n        e.preventDefault();\n\n        const $issueTitle = $(\"#issue_title\");\n        $issueTitle.focus();\n        const value = $issueTitle.val().trim().toUpperCase();\n\n        for (const i in wipPrefixes) {\n            if (value.startsWith(wipPrefixes[i].toUpperCase())) {\n                return;\n            }\n        }\n\n        $issueTitle.val(wipPrefixes[0] + \" \" + $issueTitle.val());\n    });\n}\n\nfunction initTemplateSearch() {\n    const $repoTemplate = $(\"#repo_template\");\n    const checkTemplate = function() {\n        const $templateUnits = $(\"#template_units\");\n        const $nonTemplate = $(\"#non_template\");\n        if ($repoTemplate.val() !== \"\") {\n            $templateUnits.show();\n            $nonTemplate.hide();\n        } else {\n            $templateUnits.hide();\n            $nonTemplate.show();\n        }\n    };\n    $repoTemplate.change(checkTemplate);\n    checkTemplate();\n\n    const changeOwner = function() {\n        $(\"#repo_template_search\")\n            .dropdown({\n                apiSettings: {\n                    url: suburl + '/api/v1/repos/search?q={query}&template=true&priority_owner_id=' + $(\"#uid\").val(),\n                    onResponse: function(response) {\n                        const filteredResponse = {'success': true, 'results': []};\n                        filteredResponse.results.push({\n                            'name': '',\n                            'value': ''\n                        });\n                        // Parse the response from the api to work with our dropdown\n                        $.each(response.data, function(_r, repo) {\n                            filteredResponse.results.push({\n                                'name'  : htmlEncode(repo.full_name) ,\n                                'value' : repo.id\n                            });\n                        });\n                        return filteredResponse;\n                    },\n                    cache: false,\n                },\n\n                fullTextSearch: true\n            });\n    };\n    $(\"#uid\").change(changeOwner);\n    changeOwner();\n}\n\n$(document).ready(function () {\n    csrf = $('meta[name=_csrf]').attr(\"content\");\n    suburl = $('meta[name=_suburl]').attr(\"content\");\n\n    // Show exact time\n    $('.time-since').each(function () {\n        $(this).addClass('poping up').attr('data-content', $(this).attr('title')).attr('data-variation', 'inverted tiny').attr('title', '');\n    });\n\n    // Semantic UI modules.\n    $('.dropdown:not(.custom)').dropdown();\n    $('.jump.dropdown').dropdown({\n        action: 'hide',\n        onShow: function () {\n            $('.poping.up').popup('hide');\n        }\n    });\n    $('.slide.up.dropdown').dropdown({\n        transition: 'slide up'\n    });\n    $('.upward.dropdown').dropdown({\n        direction: 'upward'\n    });\n    $('.ui.accordion').accordion();\n    $('.ui.checkbox').checkbox();\n    $('.ui.progress').progress({\n        showActivity: false\n    });\n    $('.poping.up').popup();\n    $('.top.menu .poping.up').popup({\n        onShow: function () {\n            if ($('.top.menu .menu.transition').hasClass('visible')) {\n                return false;\n            }\n        }\n    });\n    $('.tabular.menu .item').tab();\n    $('.tabable.menu .item').tab();\n\n    $('.toggle.button').click(function () {\n        $($(this).data('target')).slideToggle(100);\n    });\n\n    // make table <tr> element clickable like a link\n    $('tr[data-href]').click(function() {\n        window.location = $(this).data('href');\n    });\n\n    // Highlight JS\n    if (typeof hljs != 'undefined') {\n        const nodes = [].slice.call(document.querySelectorAll('pre code') || []);\n        for (let i = 0; i < nodes.length; i++) {\n            hljs.highlightBlock(nodes[i]);\n        }\n    }\n\n    // Dropzone\n    const $dropzone = $('#dropzone');\n    if ($dropzone.length > 0) {\n        const filenameDict = {};\n\n        new Dropzone(\"#dropzone\", {\n            url: $dropzone.data('upload-url'),\n            headers: {\"X-Csrf-Token\": csrf},\n            maxFiles: $dropzone.data('max-file'),\n            maxFilesize: $dropzone.data('max-size'),\n            acceptedFiles: ($dropzone.data('accepts') === '*/*') ? null : $dropzone.data('accepts'),\n            addRemoveLinks: true,\n            dictDefaultMessage: $dropzone.data('default-message'),\n            dictInvalidFileType: $dropzone.data('invalid-input-type'),\n            dictFileTooBig: $dropzone.data('file-too-big'),\n            dictRemoveFile: $dropzone.data('remove-file'),\n            init: function () {\n                this.on(\"success\", function (file, data) {\n                    filenameDict[file.name] = data.uuid;\n                    const input = $('<input id=\"' + data.uuid + '\" name=\"files\" type=\"hidden\">').val(data.uuid);\n                    $('.files').append(input);\n                });\n                this.on(\"removedfile\", function (file) {\n                    if (file.name in filenameDict) {\n                        $('#' + filenameDict[file.name]).remove();\n                    }\n                    if ($dropzone.data('remove-url') && $dropzone.data('csrf')) {\n                        $.post($dropzone.data('remove-url'), {\n                            file: filenameDict[file.name],\n                            _csrf: $dropzone.data('csrf')\n                        });\n                    }\n                })\n            },\n        });\n    }\n\n    // Emojify\n    emojify.setConfig({\n        img_dir: suburl + '/vendor/plugins/emojify/images',\n        ignore_emoticons: true\n    });\n    const hasEmoji = document.getElementsByClassName('has-emoji');\n    for (let i = 0; i < hasEmoji.length; i++) {\n        emojify.run(hasEmoji[i]);\n        for (let j = 0; j < hasEmoji[i].childNodes.length; j++) {\n            if (hasEmoji[i].childNodes[j].nodeName === \"A\") {\n                emojify.run(hasEmoji[i].childNodes[j])\n            }\n        }\n    }\n\n    // Clipboard JS\n    const clipboard = new Clipboard('.clipboard');\n    clipboard.on('success', function (e) {\n        e.clearSelection();\n\n        $('#' + e.trigger.getAttribute('id')).popup('destroy');\n        e.trigger.setAttribute('data-content', e.trigger.getAttribute('data-success'))\n        $('#' + e.trigger.getAttribute('id')).popup('show');\n        e.trigger.setAttribute('data-content', e.trigger.getAttribute('data-original'))\n    });\n\n    clipboard.on('error', function (e) {\n        $('#' + e.trigger.getAttribute('id')).popup('destroy');\n        e.trigger.setAttribute('data-content', e.trigger.getAttribute('data-error'))\n        $('#' + e.trigger.getAttribute('id')).popup('show');\n        e.trigger.setAttribute('data-content', e.trigger.getAttribute('data-original'))\n    });\n\n    // Helpers.\n    $('.delete-button').click(showDeletePopup);\n    $('.add-all-button').click(showAddAllPopup);\n\n    $('.delete-branch-button').click(showDeletePopup);\n\n    $('.undo-button').click(function() {\n        const $this = $(this);\n        $.post($this.data('url'), {\n            \"_csrf\": csrf,\n            \"id\": $this.data(\"id\")\n        }).done(function(data) {\n            window.location.href = data.redirect;\n        });\n    });\n    $('.show-panel.button').click(function () {\n        $($(this).data('panel')).show();\n    });\n    $('.show-modal.button').click(function () {\n        $($(this).data('modal')).modal('show');\n    });\n    $('.delete-post.button').click(function () {\n        const $this = $(this);\n        $.post($this.data('request-url'), {\n            \"_csrf\": csrf\n        }).done(function () {\n            window.location.href = $this.data('done-url');\n        });\n    });\n\n    // Set anchor.\n    $('.markdown').each(function () {\n        const headers = {};\n        $(this).find('h1, h2, h3, h4, h5, h6').each(function () {\n            let node = $(this);\n            const val = encodeURIComponent(node.text().toLowerCase().replace(/[^\\u00C0-\\u1FFF\\u2C00-\\uD7FF\\w\\- ]/g, '').replace(/[ ]/g, '-'));\n            let name = val;\n            if (headers[val] > 0) {\n                name = val + '-' + headers[val];\n            }\n            if (headers[val] == undefined) {\n                headers[val] = 1;\n            } else {\n                headers[val] += 1;\n            }\n            node = node.wrap('<div id=\"' + name + '\" class=\"anchor-wrap\" ></div>');\n            node.append('<a class=\"anchor\" href=\"#' + name + '\"><span class=\"octicon octicon-link\"></span></a>');\n        });\n    });\n\n    $('.issue-checkbox').click(function() {\n        const numChecked = $('.issue-checkbox').children('input:checked').length;\n        if (numChecked > 0) {\n            $('#issue-filters').addClass(\"hide\");\n            $('#issue-actions').removeClass(\"hide\");\n        } else {\n            $('#issue-filters').removeClass(\"hide\");\n            $('#issue-actions').addClass(\"hide\");\n        }\n    });\n\n    $('.issue-action').click(function () {\n        let action = this.dataset.action;\n        let elementId = this.dataset.elementId;\n        const issueIDs = $('.issue-checkbox').children('input:checked').map(function() {\n            return this.dataset.issueId;\n        }).get().join();\n        const url = this.dataset.url;\n        if (elementId === '0' && url.substr(-9) === '/assignee'){\n            elementId = '';\n            action = 'clear';\n        }\n        updateIssuesMeta(url, action, issueIDs, elementId).then(function() {\n            // NOTICE: This reset of checkbox state targets Firefox caching behaviour, as the checkboxes stay checked after reload\n            if (action === \"close\" || action === \"open\" ){\n                //uncheck all checkboxes\n                $('.issue-checkbox input[type=\"checkbox\"]').each(function(_,e){ e.checked = false; });\n            }\n            reload();\n        });\n    });\n\n    // NOTICE: This event trigger targets Firefox caching behaviour, as the checkboxes stay checked after reload\n    // trigger ckecked event, if checkboxes are checked on load\n    $('.issue-checkbox input[type=\"checkbox\"]:checked').first().each(function(_,e) {\n        e.checked = false;\n        $(e).click();\n    });\n\n    buttonsClickOnEnter();\n    searchUsers();\n    searchTeams();\n    searchRepositories();\n\n    initCommentForm();\n    initInstall();\n    initRepository();\n    initMigration();\n    initWikiForm();\n    initEditForm();\n    initEditor();\n    initOrganization();\n    initWebhook();\n    initAdmin();\n    initCodeView();\n    initVueApp();\n    initTeamSettings();\n    initCtrlEnterSubmit();\n    initNavbarContentToggle();\n    initTopicbar();\n    initU2FAuth();\n    initU2FRegister();\n    initIssueList();\n    initWipTitle();\n    initPullRequestReview();\n    initRepoStatusChecker();\n    initTemplateSearch();\n\n    // Repo clone url.\n    if ($('#repo-clone-url').length > 0) {\n        switch (localStorage.getItem('repo-clone-protocol')) {\n            case 'ssh':\n                if ($('#repo-clone-ssh').click().length === 0) {\n                    $('#repo-clone-https').click();\n                }\n                break;\n            default:\n                $('#repo-clone-https').click();\n                break;\n        }\n    }\n\n    const routes = {\n        'div.user.settings': initUserSettings,\n        'div.repository.settings.collaboration': initRepositoryCollaboration\n    };\n\n    let selector;\n    for (selector in routes) {\n        if ($(selector).length > 0) {\n            routes[selector]();\n            break;\n        }\n    }\n\n    const $cloneAddr = $('#clone_addr');\n    $cloneAddr.change(function() {\n        const $repoName = $('#repo_name');\n        if ($cloneAddr.val().length > 0 && $repoName.val().length === 0) { // Only modify if repo_name input is blank\n            $repoName.val($cloneAddr.val().match(/^(.*\\/)?((.+?)(\\.git)?)$/)[3]);\n        }\n    });\n});\n\nfunction changeHash(hash) {\n    if (history.pushState) {\n        history.pushState(null, null, hash);\n    }\n    else {\n        location.hash = hash;\n    }\n}\n\nfunction deSelect() {\n    if (window.getSelection) {\n        window.getSelection().removeAllRanges();\n    } else {\n        document.selection.empty();\n    }\n}\n\nfunction selectRange($list, $select, $from) {\n    $list.removeClass('active');\n    if ($from) {\n        let a = parseInt($select.attr('rel').substr(1));\n        let b = parseInt($from.attr('rel').substr(1));\n        let c;\n        if (a != b) {\n            if (a > b) {\n                c = a;\n                a = b;\n                b = c;\n            }\n            const classes = [];\n            for (let i = a; i <= b; i++) {\n                classes.push('.L' + i);\n            }\n            $list.filter(classes.join(',')).addClass('active');\n            changeHash('#L' + a + '-' + 'L' + b);\n            return\n        }\n    }\n    $select.addClass('active');\n    changeHash('#' + $select.attr('rel'));\n}\n\n$(function () {\n    // Warn users that try to leave a page after entering data into a form.\n    // Except on sign-in pages, and for forms marked as 'ignore-dirty'.\n    if ($('.user.signin').length === 0) {\n      $('form:not(.ignore-dirty)').areYouSure();\n    }\n\n    // Parse SSH Key\n    $(\"#ssh-key-content\").on('change paste keyup',function(){\n        const arrays = $(this).val().split(\" \");\n        const $title = $(\"#ssh-key-title\")\n        if ($title.val() === \"\" && arrays.length === 3 && arrays[2] !== \"\") {\n            $title.val(arrays[2]);\n        }\n    });\n});\n\nfunction showDeletePopup() {\n    const $this = $(this);\n    let filter = \"\";\n    if ($this.attr(\"id\")) {\n        filter += \"#\" + $this.attr(\"id\")\n    }\n\n    const dialog = $('.delete.modal' + filter);\n    dialog.find('.name').text($this.data('name'));\n\n    dialog.modal({\n        closable: false,\n        onApprove: function() {\n            if ($this.data('type') == \"form\") {\n                $($this.data('form')).submit();\n                return;\n            }\n\n            $.post($this.data('url'), {\n                \"_csrf\": csrf,\n                \"id\": $this.data(\"id\")\n            }).done(function(data) {\n                window.location.href = data.redirect;\n            });\n        }\n    }).modal('show');\n    return false;\n}\n\nfunction showAddAllPopup() {\n    const $this = $(this);\n    let filter = \"\";\n    if ($this.attr(\"id\")) {\n        filter += \"#\" + $this.attr(\"id\")\n    }\n\n    const dialog = $('.addall.modal' + filter);\n    dialog.find('.name').text($this.data('name'));\n\n    dialog.modal({\n        closable: false,\n        onApprove: function() {\n            if ($this.data('type') == \"form\") {\n                $($this.data('form')).submit();\n                return;\n            }\n\n            $.post($this.data('url'), {\n                \"_csrf\": csrf,\n                \"id\": $this.data(\"id\")\n            }).done(function(data) {\n                window.location.href = data.redirect;\n            });\n        }\n    }).modal('show');\n    return false;\n}\n\nfunction initVueComponents(){\n    const vueDelimeters = ['${', '}'];\n\n    Vue.component('repo-search', {\n        delimiters: vueDelimeters,\n\n        props: {\n            searchLimit: {\n                type: Number,\n                default: 10\n            },\n            suburl: {\n                type: String,\n                required: true\n            },\n            uid: {\n                type: Number,\n                required: true\n            },\n            organizations: {\n                type: Array,\n                default: []\n            },\n            isOrganization: {\n                type: Boolean,\n                default: true\n            },\n            canCreateOrganization: {\n                type: Boolean,\n                default: false\n            },\n            organizationsTotalCount: {\n                type: Number,\n                default: 0\n            },\n            moreReposLink: {\n                type: String,\n                default: ''\n            }\n        },\n\n        data: function() {\n            return {\n                tab: 'repos',\n                repos: [],\n                reposTotalCount: 0,\n                reposFilter: 'all',\n                searchQuery: '',\n                isLoading: false,\n                repoTypes: {\n                    'all': {\n                        count: 0,\n                        searchMode: '',\n                    },\n                    'forks': {\n                        count: 0,\n                        searchMode: 'fork',\n                    },\n                    'mirrors': {\n                        count: 0,\n                        searchMode: 'mirror',\n                    },\n                    'sources': {\n                        count: 0,\n                        searchMode: 'source',\n                    },\n                    'collaborative': {\n                        count: 0,\n                        searchMode: 'collaborative',\n                    },\n                }\n            }\n        },\n\n        computed: {\n            showMoreReposLink: function() {\n                return this.repos.length > 0 && this.repos.length < this.repoTypes[this.reposFilter].count;\n            },\n            searchURL: function() {\n                return this.suburl + '/api/v1/repos/search?sort=updated&order=desc&uid=' + this.uid + '&q=' + this.searchQuery\n                                   + '&limit=' + this.searchLimit + '&mode=' + this.repoTypes[this.reposFilter].searchMode\n                                   + (this.reposFilter !== 'all' ? '&exclusive=1' : '');\n            },\n            repoTypeCount: function() {\n                return this.repoTypes[this.reposFilter].count;\n            }\n        },\n\n        mounted: function() {\n            this.searchRepos(this.reposFilter);\n\n            const self = this;\n            Vue.nextTick(function() {\n                self.$refs.search.focus();\n            });\n        },\n\n        methods: {\n            changeTab: function(t) {\n                this.tab = t;\n            },\n\n            changeReposFilter: function(filter) {\n                this.reposFilter = filter;\n                this.repos = [];\n                this.repoTypes[filter].count = 0;\n                this.searchRepos(filter);\n            },\n\n            showRepo: function(repo, filter) {\n                switch (filter) {\n                    case 'sources':\n                        return repo.owner.id == this.uid && !repo.mirror && !repo.fork;\n                    case 'forks':\n                        return repo.owner.id == this.uid && !repo.mirror && repo.fork;\n                    case 'mirrors':\n                        return repo.mirror;\n                    case 'collaborative':\n                        return repo.owner.id != this.uid && !repo.mirror;\n                    default:\n                        return true;\n                }\n            },\n\n            searchRepos: function(reposFilter) {\n                const self = this;\n\n                this.isLoading = true;\n\n                const searchedMode = this.repoTypes[reposFilter].searchMode;\n                const searchedURL = this.searchURL;\n                const searchedQuery = this.searchQuery;\n\n                $.getJSON(searchedURL, function(result, _textStatus, request) {\n                    if (searchedURL == self.searchURL) {\n                        self.repos = result.data;\n                        const count = request.getResponseHeader('X-Total-Count');\n                        if (searchedQuery === '' && searchedMode === '') {\n                            self.reposTotalCount = count;\n                        }\n                        self.repoTypes[reposFilter].count = count;\n                    }\n                }).always(function() {\n                    if (searchedURL == self.searchURL) {\n                        self.isLoading = false;\n                    }\n                });\n            },\n\n            repoClass: function(repo) {\n                if (repo.fork) {\n                    return 'octicon octicon-repo-forked';\n                } else if (repo.mirror) {\n                    return 'octicon octicon-repo-clone';\n                } else if (repo.private) {\n                    return 'octicon octicon-lock';\n                } else {\n                    return 'octicon octicon-repo';\n                }\n            }\n        }\n    })\n}\n\nfunction initCtrlEnterSubmit() {\n    $(\".js-quick-submit\").keydown(function(e) {\n        if (((e.ctrlKey && !e.altKey) || e.metaKey) && (e.keyCode == 13 || e.keyCode == 10)) {\n            $(this).closest(\"form\").submit();\n        }\n    });\n}\n\nfunction initVueApp() {\n    const el = document.getElementById('app');\n    if (!el) {\n        return;\n    }\n\n    initVueComponents();\n\n    new Vue({\n        delimiters: ['${', '}'],\n        el: el,\n\n        data: {\n            searchLimit: document.querySelector('meta[name=_search_limit]').content,\n            suburl: document.querySelector('meta[name=_suburl]').content,\n            uid: document.querySelector('meta[name=_context_uid]').content,\n        },\n    });\n}\n\nwindow.timeAddManual = function() {\n    $('.mini.modal')\n        .modal({\n            duration: 200,\n            onApprove: function() {\n                $('#add_time_manual_form').submit();\n            }\n        }).modal('show')\n    ;\n}\n\nwindow.toggleStopwatch = function() {\n    $(\"#toggle_stopwatch_form\").submit();\n}\nwindow.cancelStopwatch = function() {\n    $(\"#cancel_stopwatch_form\").submit();\n}\n\nwindow.initHeatmap = function(appElementId, heatmapUser, locale) {\n    const el = document.getElementById(appElementId);\n    if (!el) {\n        return;\n    }\n\n    locale = locale || {};\n\n    locale.contributions = locale.contributions || 'contributions';\n    locale.no_contributions = locale.no_contributions || 'No contributions';\n\n    const vueDelimeters = ['${', '}'];\n\n    Vue.component('activity-heatmap', {\n        delimiters: vueDelimeters,\n\n        props: {\n            user: {\n                type: String,\n                required: true\n            },\n            suburl: {\n                type: String,\n                required: true\n            },\n            locale: {\n                type: Object,\n                required: true\n            }\n        },\n\n        data: function () {\n            return {\n                isLoading: true,\n                colorRange: [],\n                endDate: null,\n                values: [],\n                totalContributions: 0,\n            };\n        },\n\n        mounted: function() {\n            this.colorRange = [\n                this.getColor(0),\n                this.getColor(1),\n                this.getColor(2),\n                this.getColor(3),\n                this.getColor(4),\n                this.getColor(5)\n            ];\n            this.endDate = new Date();\n            this.loadHeatmap(this.user);\n        },\n\n        methods: {\n            loadHeatmap: function(userName) {\n                const self = this;\n                $.get(this.suburl + '/api/v1/users/' + userName + '/heatmap', function(chartRawData) {\n                    const chartData = [];\n                    for (let i = 0; i < chartRawData.length; i++) {\n                        self.totalContributions += chartRawData[i].contributions;\n                        chartData[i] = { date: new Date(chartRawData[i].timestamp * 1000), count: chartRawData[i].contributions };\n                    }\n                    self.values = chartData;\n                    self.isLoading = false;\n                });\n            },\n\n            getColor: function(idx) {\n                const el = document.createElement('div');\n                el.className = 'heatmap-color-' + idx;\n                document.body.appendChild(el);\n\n                const color = getComputedStyle(el).backgroundColor;\n\n                document.body.removeChild(el);\n\n                return color;\n            }\n        },\n\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\" />'\n    });\n\n    new Vue({\n        delimiters: vueDelimeters,\n        el: el,\n\n        data: {\n            suburl: document.querySelector('meta[name=_suburl]').content,\n            heatmapUser: heatmapUser,\n            locale: locale\n        },\n    });\n}\n\nfunction initFilterBranchTagDropdown(selector) {\n    $(selector).each(function() {\n        const $dropdown = $(this);\n        const $data = $dropdown.find('.data');\n        const data = {\n            items: [],\n            mode: $data.data('mode'),\n            searchTerm: '',\n            noResults: '',\n            canCreateBranch: false,\n            menuVisible: false,\n            active: 0\n        };\n        $data.find('.item').each(function() {\n            data.items.push({\n                name: $(this).text(),\n                url: $(this).data('url'),\n                branch: $(this).hasClass('branch'),\n                tag: $(this).hasClass('tag'),\n                selected: $(this).hasClass('selected')\n            });\n        });\n        $data.remove();\n        new Vue({\n            delimiters: ['${', '}'],\n            el: this,\n            data: data,\n\n            beforeMount: function () {\n                const vm = this;\n\n                this.noResults = vm.$el.getAttribute('data-no-results');\n                this.canCreateBranch = vm.$el.getAttribute('data-can-create-branch') === 'true';\n\n                document.body.addEventListener('click', function(event) {\n                    if (vm.$el.contains(event.target)) {\n                        return;\n                    }\n                    if (vm.menuVisible) {\n                        Vue.set(vm, 'menuVisible', false);\n                    }\n                });\n            },\n\n            watch: {\n                menuVisible: function(visible) {\n                    if (visible) {\n                        this.focusSearchField();\n                    }\n                }\n            },\n\n            computed: {\n                filteredItems: function() {\n                    const vm = this;\n\n                    const items = vm.items.filter(function (item) {\n                        return ((vm.mode === 'branches' && item.branch)\n                                || (vm.mode === 'tags' && item.tag))\n                            && (!vm.searchTerm\n                                || item.name.toLowerCase().indexOf(vm.searchTerm.toLowerCase()) >= 0);\n                    });\n\n                    vm.active = (items.length === 0 && vm.showCreateNewBranch ? 0 : -1);\n\n                    return items;\n                },\n                showNoResults: function() {\n                    return this.filteredItems.length === 0\n                            && !this.showCreateNewBranch;\n                },\n                showCreateNewBranch: function() {\n                    const vm = this;\n                    if (!this.canCreateBranch || !vm.searchTerm || vm.mode === 'tags') {\n                        return false;\n                    }\n\n                    return vm.items.filter(function (item) {\n                        return item.name.toLowerCase() === vm.searchTerm.toLowerCase()\n                    }).length === 0;\n                }\n            },\n\n            methods: {\n                selectItem: function(item) {\n                    const prev = this.getSelected();\n                    if (prev !== null) {\n                        prev.selected = false;\n                    }\n                    item.selected = true;\n                    window.location.href = item.url;\n                },\n                createNewBranch: function() {\n                    if (!this.showCreateNewBranch) {\n                        return;\n                    }\n                    this.$refs.newBranchForm.submit();\n                },\n                focusSearchField: function() {\n                    const vm = this;\n                    Vue.nextTick(function() {\n                        vm.$refs.searchField.focus();\n                    });\n                },\n                getSelected: function() {\n                    for (let i = 0, j = this.items.length; i < j; ++i) {\n                        if (this.items[i].selected)\n                            return this.items[i];\n                    }\n                    return null;\n                },\n                getSelectedIndexInFiltered: function() {\n                    for (let i = 0, j = this.filteredItems.length; i < j; ++i) {\n                        if (this.filteredItems[i].selected)\n                            return i;\n                    }\n                    return -1;\n                },\n                scrollToActive: function() {\n                    let el = this.$refs['listItem' + this.active];\n                    if (!el || el.length === 0) {\n                        return;\n                    }\n                    if (Array.isArray(el)) {\n                        el = el[0];\n                    }\n\n                    const cont = this.$refs.scrollContainer;\n\n                     if (el.offsetTop < cont.scrollTop) {\n                         cont.scrollTop = el.offsetTop;\n                     }\n                     else if (el.offsetTop + el.clientHeight > cont.scrollTop + cont.clientHeight) {\n                        cont.scrollTop = el.offsetTop + el.clientHeight - cont.clientHeight;\n                    }\n                },\n                keydown: function(event) {\n                    const vm = this;\n                    if (event.keyCode === 40) {\n                        // arrow down\n                        event.preventDefault();\n\n                        if (vm.active === -1) {\n                            vm.active = vm.getSelectedIndexInFiltered();\n                        }\n\n                        if (vm.active + (vm.showCreateNewBranch ? 0 : 1) >= vm.filteredItems.length) {\n                            return;\n                        }\n                        vm.active++;\n                        vm.scrollToActive();\n                    }\n                    if (event.keyCode === 38) {\n                        // arrow up\n                        event.preventDefault();\n\n                         if (vm.active === -1) {\n                            vm.active = vm.getSelectedIndexInFiltered();\n                        }\n\n                         if (vm.active <= 0) {\n                            return;\n                        }\n                        vm.active--;\n                        vm.scrollToActive();\n                    }\n                    if (event.keyCode == 13) {\n                        // enter\n                        event.preventDefault();\n\n                         if (vm.active >= vm.filteredItems.length) {\n                            vm.createNewBranch();\n                        } else if (vm.active >= 0) {\n                            vm.selectItem(vm.filteredItems[vm.active]);\n                        }\n                    }\n                    if (event.keyCode == 27) {\n                        // escape\n                        event.preventDefault();\n                        vm.menuVisible = false;\n                    }\n                }\n            }\n        });\n    });\n}\n\n$(\".commit-button\").click(function(e) {\n    e.preventDefault();\n    $(this).parent().find('.commit-body').toggle();\n});\n\nfunction initNavbarContentToggle() {\n    const content = $('#navbar');\n    const toggle = $('#navbar-expand-toggle');\n    let isExpanded = false;\n    toggle.click(function() {\n        isExpanded = !isExpanded;\n        if (isExpanded) {\n            content.addClass('shown');\n            toggle.addClass('active');\n        }\n        else {\n            content.removeClass('shown');\n            toggle.removeClass('active');\n        }\n    });\n}\n\nfunction initTopicbar() {\n    const mgrBtn = $(\"#manage_topic\");\n    const editDiv = $(\"#topic_edit\");\n    const viewDiv = $(\"#repo-topics\");\n    const saveBtn = $(\"#save_topic\");\n    const topicDropdown = $('#topic_edit .dropdown');\n    const topicForm = $('#topic_edit.ui.form');\n    const topicPrompts = getPrompts();\n\n    mgrBtn.click(function() {\n        viewDiv.hide();\n        editDiv.css('display', ''); // show Semantic UI Grid\n    });\n\n    function getPrompts() {\n        const hidePrompt = $(\"div.hide#validate_prompt\"),\n            prompts = {\n                countPrompt: hidePrompt.children('#count_prompt').text(),\n                formatPrompt: hidePrompt.children('#format_prompt').text()\n            };\n        hidePrompt.remove();\n        return prompts;\n    }\n\n    saveBtn.click(function() {\n        const topics = $(\"input[name=topics]\").val();\n\n        $.post(saveBtn.data('link'), {\n            \"_csrf\": csrf,\n            \"topics\": topics\n        }, function(_data, _textStatus, xhr){\n            if (xhr.responseJSON.status === 'ok') {\n                viewDiv.children(\".topic\").remove();\n                if (topics.length) {\n                    const topicArray = topics.split(\",\");\n\n                    const last = viewDiv.children(\"a\").last();\n                    for (let i=0; i < topicArray.length; i++) {\n                        $('<div class=\"ui small label topic\" style=\"cursor:pointer;\">'+topicArray[i]+'</div>').insertBefore(last)\n                    }\n                }\n                editDiv.css('display', 'none');\n                viewDiv.show();\n            }\n        }).fail(function(xhr){\n            if (xhr.status === 422) {\n                if (xhr.responseJSON.invalidTopics.length > 0) {\n                    topicPrompts.formatPrompt = xhr.responseJSON.message;\n\n                    const invalidTopics = xhr.responseJSON.invalidTopics,\n                        topicLables = topicDropdown.children('a.ui.label');\n\n                    topics.split(',').forEach(function(value, index) {\n                        for (let i=0; i < invalidTopics.length; i++) {\n                            if (invalidTopics[i] === value) {\n                                topicLables.eq(index).removeClass(\"green\").addClass(\"red\");\n                            }\n                        }\n                    });\n                } else {\n                    topicPrompts.countPrompt = xhr.responseJSON.message;\n                }\n            }\n        }).always(function() {\n            topicForm.form('validate form');\n        });\n    });\n\n    topicDropdown.dropdown({\n        allowAdditions: true,\n        forceSelection: false,\n        fields: { name: \"description\", value: \"data-value\" },\n        saveRemoteData: false,\n        label: {\n            transition : 'horizontal flip',\n            duration   : 200,\n            variation  : false,\n            blue : true,\n            basic: true,\n        },\n        className: {\n            label: 'ui small label'\n        },\n        apiSettings: {\n            url: suburl + '/api/v1/topics/search?q={query}',\n            throttle: 500,\n            cache: false,\n            onResponse: function(res) {\n                const formattedResponse = {\n                    success: false,\n                    results: [],\n                };\n                const stripTags = function (text) {\n                    return text.replace(/<[^>]*>?/gm, \"\");\n                };\n\n                const query = stripTags(this.urlData.query.trim());\n                let found_query = false;\n                const current_topics = [];\n                topicDropdown.find('div.label.visible.topic,a.label.visible').each(function(_,e){ current_topics.push(e.dataset.value); });\n\n                if (res.topics) {\n                    let found = false;\n                    for (let i=0;i < res.topics.length;i++) {\n                        // skip currently added tags\n                        if (current_topics.indexOf(res.topics[i].topic_name) != -1){\n                            continue;\n                        }\n\n                        if (res.topics[i].topic_name.toLowerCase() === query.toLowerCase()){\n                            found_query = true;\n                        }\n                        formattedResponse.results.push({\"description\": res.topics[i].topic_name, \"data-value\": res.topics[i].topic_name});\n                        found = true;\n                    }\n                    formattedResponse.success = found;\n                }\n\n                if (query.length > 0 && !found_query){\n                    formattedResponse.success = true;\n                    formattedResponse.results.unshift({\"description\": query, \"data-value\": query});\n                } else if (query.length > 0 && found_query) {\n                    formattedResponse.results.sort(function(a, b){\n                        if (a.description.toLowerCase() === query.toLowerCase()) return -1;\n                        if (b.description.toLowerCase() === query.toLowerCase()) return 1;\n                        if (a.description > b.description) return -1;\n                        if (a.description < b.description) return 1;\n                        return 0;\n                    });\n                }\n\n\n                return formattedResponse;\n            },\n        },\n        onLabelCreate: function(value) {\n            value = value.toLowerCase().trim();\n            this.attr(\"data-value\", value).contents().first().replaceWith(value);\n            return $(this);\n        },\n        onAdd: function(addedValue, _addedText, $addedChoice) {\n            addedValue = addedValue.toLowerCase().trim();\n            $($addedChoice).attr('data-value', addedValue);\n            $($addedChoice).attr('data-text', addedValue);\n        }\n    });\n\n    $.fn.form.settings.rules.validateTopic = function(_values, regExp) {\n        const topics = topicDropdown.children('a.ui.label'),\n            status = topics.length === 0 || topics.last().attr(\"data-value\").match(regExp);\n        if (!status) {\n            topics.last().removeClass(\"green\").addClass(\"red\");\n        }\n        return status && topicDropdown.children('a.ui.label.red').length === 0;\n    };\n\n    topicForm.form({\n            on: 'change',\n            inline : true,\n            fields: {\n                topics: {\n                    identifier: 'topics',\n                    rules: [\n                        {\n                            type: 'validateTopic',\n                            value: /^[a-z0-9][a-z0-9-]{1,35}$/,\n                            prompt: topicPrompts.formatPrompt\n                        },\n                        {\n                            type: 'maxCount[25]',\n                            prompt: topicPrompts.countPrompt\n                        }\n                    ]\n                },\n            }\n        });\n}\nwindow.toggleDeadlineForm = function() {\n    $('#deadlineForm').fadeToggle(150);\n}\n\nwindow.setDeadline = function() {\n    const deadline = $('#deadlineDate').val();\n    window.updateDeadline(deadline);\n}\n\nwindow.updateDeadline = function(deadlineString) {\n    $('#deadline-err-invalid-date').hide();\n    $('#deadline-loader').addClass('loading');\n\n    let realDeadline = null;\n    if (deadlineString !== '') {\n\n        const newDate = Date.parse(deadlineString)\n\n        if (isNaN(newDate)) {\n            $('#deadline-loader').removeClass('loading');\n            $('#deadline-err-invalid-date').show();\n            return false;\n        }\n        realDeadline = new Date(newDate);\n    }\n\n    $.ajax($('#update-issue-deadline-form').attr('action') + '/deadline', {\n        data: JSON.stringify({\n            'due_date': realDeadline,\n        }),\n        headers: {\n            'X-Csrf-Token': csrf,\n            'X-Remote': true,\n        },\n        contentType: 'application/json',\n        type: 'POST',\n        success: function () {\n            reload();\n        },\n        error: function () {\n            $('#deadline-loader').removeClass('loading');\n            $('#deadline-err-invalid-date').show();\n        }\n    });\n}\n\nwindow.deleteDependencyModal = function(id, type) {\n    $('.remove-dependency')\n        .modal({\n            closable: false,\n            duration: 200,\n            onApprove: function () {\n                $('#removeDependencyID').val(id);\n                $('#dependencyType').val(type);\n                $('#removeDependencyForm').submit();\n            }\n        }).modal('show')\n    ;\n}\n\nfunction initIssueList() {\n    const repolink = $('#repolink').val();\n    const repoId = $('#repoId').val();\n    const crossRepoSearch = $('#crossRepoSearch').val();\n    let issueSearchUrl = suburl + '/api/v1/repos/' + repolink + '/issues?q={query}';\n    if (crossRepoSearch === 'true') {\n        issueSearchUrl = suburl + '/api/v1/repos/issues/search?q={query}&priority_repo_id=' + repoId;\n    }\n    $('#new-dependency-drop-list')\n        .dropdown({\n            apiSettings: {\n                url: issueSearchUrl,\n                onResponse: function(response) {\n                    const filteredResponse = {'success': true, 'results': []};\n                    const currIssueId = $('#new-dependency-drop-list').data('issue-id');\n                    // Parse the response from the api to work with our dropdown\n                    $.each(response, function(_i, issue) {\n                        // Don't list current issue in the dependency list.\n                        if(issue.id === currIssueId) {\n                            return;\n                        }\n                        filteredResponse.results.push({\n                            'name'  : '#' + issue.number + ' ' + htmlEncode(issue.title) +\n                                '<div class=\"text small dont-break-out\">' + htmlEncode(issue.repository.full_name) + '</div>',\n                            'value' : issue.id\n                        });\n                    });\n                    return filteredResponse;\n                },\n                cache: false,\n            },\n\n            fullTextSearch: true\n        });\n\n    $(\".menu a.label-filter-item\").each(function() {\n        $(this).click(function(e) {\n            if (e.altKey) {\n                e.preventDefault();\n\n                const href = $(this).attr(\"href\");\n                const id = $(this).data(\"label-id\");\n\n                const regStr = \"labels=(-?[0-9]+%2c)*(\" + id + \")(%2c-?[0-9]+)*&\";\n                const newStr = \"labels=$1-$2$3&\";\n\n                window.location = href.replace(new RegExp(regStr), newStr);\n            }\n        });\n    });\n\n    $(\".menu .ui.dropdown.label-filter\").keydown(function(e) {\n        if (e.altKey && e.keyCode == 13) {\n            const selectedItems = $(\".menu .ui.dropdown.label-filter .menu .item.selected\");\n\n            if (selectedItems.length > 0) {\n                const item = $(selectedItems[0]);\n\n                const href = item.attr(\"href\");\n                const id = item.data(\"label-id\");\n\n                const regStr = \"labels=(-?[0-9]+%2c)*(\" + id + \")(%2c-?[0-9]+)*&\";\n                const newStr = \"labels=$1-$2$3&\";\n\n                window.location = href.replace(new RegExp(regStr), newStr);\n            }\n        }\n    });\n}\nwindow.cancelCodeComment = function(btn) {\n    const form = $(btn).closest(\"form\");\n    if(form.length > 0 && form.hasClass('comment-form')) {\n        form.addClass('hide');\n        form.parent().find('button.comment-form-reply').show();\n    } else {\n        form.closest('.comment-code-cloud').remove()\n    }\n}\nwindow.onOAuthLoginClick = function() {\n    const oauthLoader = $('#oauth2-login-loader');\n    const oauthNav = $('#oauth2-login-navigator');\n\n    oauthNav.hide();\n    oauthLoader.removeClass('disabled');\n\n    setTimeout(function(){\n        // recover previous content to let user try again\n        // usually redirection will be performed before this action\n        oauthLoader.addClass('disabled');\n        oauthNav.show();\n    },5000);\n}\n"],"sourceRoot":""}
\ No newline at end of file
index 5a812d4fbf5fd76ee7c1dcfab6bf246288f8c243..7f6ee2c4374a2fa67c53c11ddefc8176980a0fbd 100644 (file)
                                        {{if and .IsIssueWriter (not .Repository.IsArchived)}}
                                                <br/>
                                                <a style="cursor:pointer;" onclick="window.toggleDeadlineForm();"><i class="edit icon"></i>{{$.i18n.Tr "repo.issues.due_date_form_edit"}}</a> -
-                                               <a style="cursor:pointer;" onclick="updateDeadline('');"><i class="remove icon"></i>{{$.i18n.Tr "repo.issues.due_date_form_remove"}}</a>
+                                               <a style="cursor:pointer;" onclick="window.updateDeadline('');"><i class="remove icon"></i>{{$.i18n.Tr "repo.issues.due_date_form_remove"}}</a>
                                        {{end}}
                                </p>
                        {{else}}
index 900b5893a50ce4f8c124f70e43f47f87e0bdc2a5..2edd70c87d5bc87836bf9c99324fea9e82a0eb01 100644 (file)
@@ -1,6 +1,6 @@
 /* globals wipPrefixes, issuesTribute, emojiTribute */
 /* exported timeAddManual, toggleStopwatch, cancelStopwatch, initHeatmap */
-/* exported toggleDeadlineForm, setDeadline, deleteDependencyModal, cancelCodeComment, onOAuthLoginClick */
+/* exported toggleDeadlineForm, setDeadline, updateDeadline, deleteDependencyModal, cancelCodeComment, onOAuthLoginClick */
 'use strict';
 
 function htmlEncode(text) {
@@ -3276,10 +3276,10 @@ window.toggleDeadlineForm = function() {
 
 window.setDeadline = function() {
     const deadline = $('#deadlineDate').val();
-    updateDeadline(deadline);
+    window.updateDeadline(deadline);
 }
 
-function updateDeadline(deadlineString) {
+window.updateDeadline = function(deadlineString) {
     $('#deadline-err-invalid-date').hide();
     $('#deadline-loader').addClass('loading');