!function(e){define("jquery-chosen",["jquery"],(function(){return function(){
/*!
Chosen, a Select Box Enhancer for jQuery and Prototype
by Patrick Filler for Harvest, http://getharvest.com
Version 1.5.1
Full source at https://github.com/harvesthq/chosen
Copyright (c) 2011-2016 Harvest http://getharvest.com
MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
This file is generated by `grunt build`, do not edit it by hand.
*/
(function(){var e,t,s,o,i={}.hasOwnProperty;o=function(){function e(){this.options_index=0,this.parsed=[]}return e.prototype.add_node=function(e){return"OPTGROUP"===e.nodeName.toUpperCase()?this.add_group(e):this.add_option(e)},e.prototype.add_group=function(e){var t,s,o,i,r,n;for(t=this.parsed.length,this.parsed.push({array_index:t,group:!0,label:this.escapeExpression(e.label),title:e.title?e.title:void 0,children:0,disabled:e.disabled,classes:e.className}),n=[],o=0,i=(r=e.childNodes).length;o<i;o++)s=r[o],n.push(this.add_option(s,t,e.disabled));return n},e.prototype.add_option=function(e,t,s){if("OPTION"===e.nodeName.toUpperCase())return""!==e.text?(null!=t&&(this.parsed[t].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:e.value,text:e.text,html:e.innerHTML,title:e.title?e.title:void 0,selected:e.selected,disabled:!0===s?s:e.disabled,group_array_index:t,group_label:null!=t?this.parsed[t].label:null,classes:e.className,style:e.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1},e.prototype.escapeExpression=function(e){var t,s;return null==e||!1===e?"":/[\&\<\>\"\'\`]/.test(e)?(t={"<":"<",">":">",'"':""","'":"'","`":"`"},s=/&(?!\w+;)|[\<\>\"\'\`]/g,e.replace(s,(function(e){return t[e]||"&"}))):e},e}(),o.select_to_array=function(e){var t,s,i,r,n;for(s=new o,i=0,r=(n=e.childNodes).length;i<r;i++)t=n[i],s.add_node(t);return s.parsed},t=function(){function e(t,s){this.form_field=t,this.options=null!=s?s:{},e.browser_is_supported()&&(this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers(),this.on_ready())}return e.prototype.set_default_values=function(){var e=this;return this.click_test_action=function(t){return e.test_active_click(t)},this.activate_action=function(t){return e.activate_field(t)},this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.allow_single_deselect=null!=this.options.allow_single_deselect&&null!=this.form_field.options[0]&&""===this.form_field.options[0].text&&this.options.allow_single_deselect,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=null==this.options.enable_split_word_search||this.options.enable_split_word_search,this.group_search=null==this.options.group_search||this.options.group_search,this.search_contains=this.options.search_contains||!1,this.single_backstroke_delete=null==this.options.single_backstroke_delete||this.options.single_backstroke_delete,this.max_selected_options=this.options.max_selected_options||1/0,this.inherit_select_classes=this.options.inherit_select_classes||!1,this.display_selected_options=null==this.options.display_selected_options||this.options.display_selected_options,this.display_disabled_options=null==this.options.display_disabled_options||this.options.display_disabled_options,this.include_group_label_in_selected=this.options.include_group_label_in_selected||!1,this.max_shown_results=this.options.max_shown_results||Number.POSITIVE_INFINITY},e.prototype.set_default_text=function(){return this.form_field.getAttribute("data-placeholder")?this.default_text=this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.default_text=this.options.placeholder_text_multiple||this.options.placeholder_text||e.default_multiple_text:this.default_text=this.options.placeholder_text_single||this.options.placeholder_text||e.default_single_text,this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||e.default_no_result_text},e.prototype.choice_label=function(e){return this.include_group_label_in_selected&&null!=e.group_label?"<b class='group-name'>"+e.group_label+"</b>"+e.html:e.html},e.prototype.mouse_enter=function(){return this.mouse_on_container=!0},e.prototype.mouse_leave=function(){return this.mouse_on_container=!1},e.prototype.input_focus=function(e){var t=this;if(this.is_multiple){if(!this.active_field)return setTimeout((function(){return t.container_mousedown()}),50)}else if(!this.active_field)return this.activate_field()},e.prototype.input_blur=function(e){var t=this;if(!this.mouse_on_container)return this.active_field=!1,setTimeout((function(){return t.blur_test()}),100)},e.prototype.results_option_build=function(e){var t,s,o,i,r,n,a;for(t="",i=0,r=0,n=(a=this.results_data).length;r<n&&(o="",""!==(o=(s=a[r]).group?this.result_add_group(s):this.result_add_option(s))&&(i++,t+=o),(null!=e?e.first:void 0)&&(s.selected&&this.is_multiple?this.choice_build(s):s.selected&&!this.is_multiple&&this.single_set_selected_text(this.choice_label(s))),!(i>=this.max_shown_results));r++);return t},e.prototype.result_add_option=function(e){var t,s;return e.search_match&&this.include_option_in_results(e)?(t=[],e.disabled||e.selected&&this.is_multiple||t.push("active-result"),!e.disabled||e.selected&&this.is_multiple||t.push("disabled-result"),e.selected&&t.push("result-selected"),null!=e.group_array_index&&t.push("group-option"),""!==e.classes&&t.push(e.classes),(s=document.createElement("li")).className=t.join(" "),s.style.cssText=e.style,s.setAttribute("data-option-array-index",e.array_index),s.innerHTML=e.search_text,e.title&&(s.title=e.title),this.outerHTML(s)):""},e.prototype.result_add_group=function(e){var t,s;return(e.search_match||e.group_match)&&e.active_options>0?((t=[]).push("group-result"),e.classes&&t.push(e.classes),(s=document.createElement("li")).className=t.join(" "),s.innerHTML=e.search_text,e.title&&(s.title=e.title),this.outerHTML(s)):""},e.prototype.results_update_field=function(){if(this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.results_build(),this.results_showing)return this.winnow_results()},e.prototype.reset_single_select_options=function(){var e,t,s,o,i;for(i=[],t=0,s=(o=this.results_data).length;t<s;t++)(e=o[t]).selected?i.push(e.selected=!1):i.push(void 0);return i},e.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},e.prototype.results_search=function(e){return this.results_showing?this.winnow_results():this.results_show()},e.prototype.winnow_results=function(){var e,t,s,o,i,r,n,a,l,c,u,h;for(this.no_results_clear(),o=0,e=(r=this.get_search_text()).replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),l=new RegExp(e,"i"),s=this.get_search_regex(e),c=0,u=(h=this.results_data).length;c<u;c++)(t=h[c]).search_match=!1,i=null,this.include_option_in_results(t)&&(t.group&&(t.group_match=!1,t.active_options=0),null!=t.group_array_index&&this.results_data[t.group_array_index]&&(0===(i=this.results_data[t.group_array_index]).active_options&&i.search_match&&(o+=1),i.active_options+=1),t.search_text=t.group?t.label:t.html,t.group&&!this.group_search||(t.search_match=this.search_string_match(t.search_text,s),t.search_match&&!t.group&&(o+=1),t.search_match?(r.length&&(n=t.search_text.search(l),a=t.search_text.substr(0,n+r.length)+"</em>"+t.search_text.substr(n+r.length),t.search_text=a.substr(0,n)+"<em>"+a.substr(n)),null!=i&&(i.group_match=!0)):null!=t.group_array_index&&this.results_data[t.group_array_index].search_match&&(t.search_match=!0)));return this.result_clear_highlight(),o<1&&r.length?(this.update_results_content(""),this.no_results(r)):(this.update_results_content(this.results_option_build()),this.winnow_results_set_highlight())},e.prototype.get_search_regex=function(e){var t;return t=this.search_contains?"":"^",new RegExp(t+e,"i")},e.prototype.search_string_match=function(e,t){var s,o,i,r;if(t.test(e))return!0;if(this.enable_split_word_search&&(e.indexOf(" ")>=0||0===e.indexOf("["))&&(o=e.replace(/\[|\]/g,"").split(" ")).length)for(i=0,r=o.length;i<r;i++)if(s=o[i],t.test(s))return!0},e.prototype.choices_count=function(){var e,t,s;if(null!=this.selected_option_count)return this.selected_option_count;for(this.selected_option_count=0,e=0,t=(s=this.form_field.options).length;e<t;e++)s[e].selected&&(this.selected_option_count+=1);return this.selected_option_count},e.prototype.choices_click=function(e){if(e.preventDefault(),!this.results_showing&&!this.is_disabled)return this.results_show()},e.prototype.keyup_checker=function(e){var t,s;switch(t=null!=(s=e.which)?s:e.keyCode,this.search_field_scale(),t){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices_count()>0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:if(e.preventDefault(),this.results_showing)return this.result_select(e);break;case 27:return this.results_showing&&this.results_hide(),!0;case 9:case 38:case 40:case 16:case 91:case 17:case 18:break;default:return this.results_search()}},e.prototype.clipboard_event_checker=function(e){var t=this;return setTimeout((function(){return t.results_search()}),50)},e.prototype.container_width=function(){return null!=this.options.width?this.options.width:this.form_field.offsetWidth+"px"},e.prototype.include_option_in_results=function(e){return!(this.is_multiple&&!this.display_selected_options&&e.selected)&&(!(!this.display_disabled_options&&e.disabled)&&!e.empty)},e.prototype.search_results_touchstart=function(e){return this.touch_started=!0,this.search_results_mouseover(e)},e.prototype.search_results_touchmove=function(e){return this.touch_started=!1,this.search_results_mouseout(e)},e.prototype.search_results_touchend=function(e){if(this.touch_started)return this.search_results_mouseup(e)},e.prototype.outerHTML=function(e){var t;return e.outerHTML?e.outerHTML:((t=document.createElement("div")).appendChild(e),t.innerHTML)},e.browser_is_supported=function(){return!/iP(od|hone)/i.test(window.navigator.userAgent)&&((!/Android/i.test(window.navigator.userAgent)||!/Mobile/i.test(window.navigator.userAgent))&&(!/IEMobile/i.test(window.navigator.userAgent)&&(!/Windows Phone/i.test(window.navigator.userAgent)&&(!/BlackBerry/i.test(window.navigator.userAgent)&&(!/BB10/i.test(window.navigator.userAgent)&&("Microsoft Internet Explorer"!==window.navigator.appName||document.documentMode>=8))))))},e.default_multiple_text="Select Some Options",e.default_single_text="Select an Option",e.default_no_result_text="No results match",e}(),(e=jQuery).fn.extend({chosen:function(o){return t.browser_is_supported()?this.each((function(t){var i,r;r=(i=e(this)).data("chosen"),"destroy"!==o?r instanceof s||i.data("chosen",new s(this,o)):r instanceof s&&r.destroy()})):this}}),s=function(t){function s(){return s.__super__.constructor.apply(this,arguments)}return function(e,t){for(var s in t)i.call(t,s)&&(e[s]=t[s]);function o(){this.constructor=e}o.prototype=t.prototype,e.prototype=new o,e.__super__=t.prototype}(s,t),s.prototype.setup=function(){return this.form_field_jq=e(this.form_field),this.current_selectedIndex=this.form_field.selectedIndex,this.is_rtl=this.form_field_jq.hasClass("chosen-rtl")},s.prototype.set_up_html=function(){var t,s;return(t=["chosen-container"]).push("chosen-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&t.push(this.form_field.className),this.is_rtl&&t.push("chosen-rtl"),s={class:t.join(" "),style:"width: "+this.container_width()+";",title:this.form_field.title},this.form_field.id.length&&(s.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chosen"),this.container=e("<div />",s),this.is_multiple?this.container.html('<ul class="chosen-choices"><li class="search-field"><input type="text" value="'+this.default_text+'" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>'):this.container.html('<a class="chosen-single chosen-default"><span>'+this.default_text+'</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>'),this.form_field_jq.hide().after(this.container),this.dropdown=this.container.find("div.chosen-drop").first(),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chosen-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chosen-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chosen-search").first(),this.selected_item=this.container.find(".chosen-single").first()),this.results_build(),this.set_tab_index(),this.set_label_behavior()},s.prototype.on_ready=function(){return this.form_field_jq.trigger("chosen:ready",{chosen:this})},s.prototype.register_observers=function(){var e=this;return this.container.bind("touchstart.chosen",(function(t){return e.container_mousedown(t),t.preventDefault()})),this.container.bind("touchend.chosen",(function(t){return e.container_mouseup(t),t.preventDefault()})),this.container.bind("mousedown.chosen",(function(t){e.container_mousedown(t)})),this.container.bind("mouseup.chosen",(function(t){e.container_mouseup(t)})),this.container.bind("mouseenter.chosen",(function(t){e.mouse_enter(t)})),this.container.bind("mouseleave.chosen",(function(t){e.mouse_leave(t)})),this.search_results.bind("mouseup.chosen",(function(t){e.search_results_mouseup(t)})),this.search_results.bind("mouseover.chosen",(function(t){e.search_results_mouseover(t)})),this.search_results.bind("mouseout.chosen",(function(t){e.search_results_mouseout(t)})),this.search_results.bind("mousewheel.chosen DOMMouseScroll.chosen",(function(t){e.search_results_mousewheel(t)})),this.search_results.bind("touchstart.chosen",(function(t){e.search_results_touchstart(t)})),this.search_results.bind("touchmove.chosen",(function(t){e.search_results_touchmove(t)})),this.search_results.bind("touchend.chosen",(function(t){e.search_results_touchend(t)})),this.form_field_jq.bind("chosen:updated.chosen",(function(t){e.results_update_field(t)})),this.form_field_jq.bind("chosen:activate.chosen",(function(t){e.activate_field(t)})),this.form_field_jq.bind("chosen:open.chosen",(function(t){e.container_mousedown(t)})),this.form_field_jq.bind("chosen:close.chosen",(function(t){e.input_blur(t)})),this.search_field.bind("blur.chosen",(function(t){e.input_blur(t)})),this.search_field.bind("keyup.chosen",(function(t){e.keyup_checker(t)})),this.search_field.bind("keydown.chosen",(function(t){e.keydown_checker(t)})),this.search_field.bind("focus.chosen",(function(t){e.input_focus(t)})),this.search_field.bind("cut.chosen",(function(t){e.clipboard_event_checker(t)})),this.search_field.bind("paste.chosen",(function(t){e.clipboard_event_checker(t)})),this.is_multiple?this.search_choices.bind("click.chosen",(function(t){e.choices_click(t)})):this.container.bind("click.chosen",(function(e){e.preventDefault()}))},s.prototype.destroy=function(){return e(this.container[0].ownerDocument).unbind("click.chosen",this.click_test_action),this.search_field[0].tabIndex&&(this.form_field_jq[0].tabIndex=this.search_field[0].tabIndex),this.container.remove(),this.form_field_jq.removeData("chosen"),this.form_field_jq.show()},s.prototype.search_field_disabled=function(){return this.is_disabled=this.form_field_jq[0].disabled,this.is_disabled?(this.container.addClass("chosen-disabled"),this.search_field[0].disabled=!0,this.is_multiple||this.selected_item.unbind("focus.chosen",this.activate_action),this.close_field()):(this.container.removeClass("chosen-disabled"),this.search_field[0].disabled=!1,this.is_multiple?void 0:this.selected_item.bind("focus.chosen",this.activate_action))},s.prototype.container_mousedown=function(t){if(!this.is_disabled&&(t&&"mousedown"===t.type&&!this.results_showing&&t.preventDefault(),null==t||!e(t.target).hasClass("search-choice-close")))return this.active_field?this.is_multiple||!t||e(t.target)[0]!==this.selected_item[0]&&!e(t.target).parents("a.chosen-single").length||(t.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),e(this.container[0].ownerDocument).bind("click.chosen",this.click_test_action),this.results_show()),this.activate_field()},s.prototype.container_mouseup=function(e){if("ABBR"===e.target.nodeName&&!this.is_disabled)return this.results_reset(e)},s.prototype.search_results_mousewheel=function(e){var t;if(e.originalEvent&&(t=e.originalEvent.deltaY||-e.originalEvent.wheelDelta||e.originalEvent.detail),null!=t)return e.preventDefault(),"DOMMouseScroll"===e.type&&(t*=40),this.search_results.scrollTop(t+this.search_results.scrollTop())},s.prototype.blur_test=function(e){if(!this.active_field&&this.container.hasClass("chosen-container-active"))return this.close_field()},s.prototype.close_field=function(){return e(this.container[0].ownerDocument).unbind("click.chosen",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClass("chosen-container-active"),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},s.prototype.activate_field=function(){return this.container.addClass("chosen-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},s.prototype.test_active_click=function(t){var s;return(s=e(t.target).closest(".chosen-container")).length&&this.container[0]===s[0]?this.active_field=!0:this.close_field()},s.prototype.results_build=function(){return this.parsing=!0,this.selected_option_count=null,this.results_data=o.select_to_array(this.form_field),this.is_multiple?this.search_choices.find("li.search-choice").remove():this.is_multiple||(this.single_set_selected_text(),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?(this.search_field[0].readOnly=!0,this.container.addClass("chosen-container-single-nosearch")):(this.search_field[0].readOnly=!1,this.container.removeClass("chosen-container-single-nosearch"))),this.update_results_content(this.results_option_build({first:!0})),this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.parsing=!1},s.prototype.result_do_highlight=function(e){var t,s,o,i,r;if(e.length){if(this.result_clear_highlight(),this.result_highlight=e,this.result_highlight.addClass("highlighted"),i=(o=parseInt(this.search_results.css("maxHeight"),10))+(r=this.search_results.scrollTop()),(t=(s=this.result_highlight.position().top+this.search_results.scrollTop())+this.result_highlight.outerHeight())>=i)return this.search_results.scrollTop(t-o>0?t-o:0);if(s<r)return this.search_results.scrollTop(s)}},s.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null},s.prototype.results_show=function(){return this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.container.addClass("chosen-with-drop"),this.results_showing=!0,this.search_field.focus(),this.search_field.val(this.search_field.val()),this.winnow_results(),this.form_field_jq.trigger("chosen:showing_dropdown",{chosen:this}))},s.prototype.update_results_content=function(e){return this.search_results.html(e)},s.prototype.results_hide=function(){return this.results_showing&&(this.result_clear_highlight(),this.container.removeClass("chosen-with-drop"),this.form_field_jq.trigger("chosen:hiding_dropdown",{chosen:this})),this.results_showing=!1},s.prototype.set_tab_index=function(e){var t;if(this.form_field.tabIndex)return t=this.form_field.tabIndex,this.form_field.tabIndex=-1,this.search_field[0].tabIndex=t},s.prototype.set_label_behavior=function(){var t=this;if(this.form_field_label=this.form_field_jq.parents("label"),!this.form_field_label.length&&this.form_field.id.length&&(this.form_field_label=e("label[for='"+this.form_field.id+"']")),this.form_field_label.length>0)return this.form_field_label.bind("click.chosen",(function(e){return t.is_multiple?t.container_mousedown(e):t.activate_field()}))},s.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices_count()<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},s.prototype.search_results_mouseup=function(t){var s;if((s=e(t.target).hasClass("active-result")?e(t.target):e(t.target).parents(".active-result").first()).length)return this.result_highlight=s,this.result_select(t),this.search_field.focus()},s.prototype.search_results_mouseover=function(t){var s;if(s=e(t.target).hasClass("active-result")?e(t.target):e(t.target).parents(".active-result").first())return this.result_do_highlight(s)},s.prototype.search_results_mouseout=function(t){if(e(t.target).hasClass("active-result"))return this.result_clear_highlight()},s.prototype.choice_build=function(t){var s,o,i=this;return s=e("<li />",{class:"search-choice"}).html("<span>"+this.choice_label(t)+"</span>"),t.disabled?s.addClass("search-choice-disabled"):((o=e("<a />",{class:"search-choice-close","data-option-array-index":t.array_index})).bind("click.chosen",(function(e){return i.choice_destroy_link_click(e)})),s.append(o)),this.search_container.before(s)},s.prototype.choice_destroy_link_click=function(t){if(t.preventDefault(),t.stopPropagation(),!this.is_disabled)return this.choice_destroy(e(t.target))},s.prototype.choice_destroy=function(e){if(this.result_deselect(e[0].getAttribute("data-option-array-index")))return this.show_search_field_default(),this.is_multiple&&this.choices_count()>0&&this.search_field.val().length<1&&this.results_hide(),e.parents("li").first().remove(),this.search_field_scale()},s.prototype.results_reset=function(){if(this.reset_single_select_options(),this.form_field.options[0].selected=!0,this.single_set_selected_text(),this.show_search_field_default(),this.results_reset_cleanup(),this.form_field_jq.trigger("change"),this.active_field)return this.results_hide()},s.prototype.results_reset_cleanup=function(){return this.current_selectedIndex=this.form_field.selectedIndex,this.selected_item.find("abbr").remove()},s.prototype.result_select=function(e){var t,s;if(this.result_highlight)return t=this.result_highlight,this.result_clear_highlight(),this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.is_multiple?t.removeClass("active-result"):this.reset_single_select_options(),t.addClass("result-selected"),(s=this.results_data[t[0].getAttribute("data-option-array-index")]).selected=!0,this.form_field.options[s.options_index].selected=!0,this.selected_option_count=null,this.is_multiple?this.choice_build(s):this.single_set_selected_text(this.choice_label(s)),(e.metaKey||e.ctrlKey)&&this.is_multiple||this.results_hide(),this.show_search_field_default(),(this.is_multiple||this.form_field.selectedIndex!==this.current_selectedIndex)&&this.form_field_jq.trigger("change",{selected:this.form_field.options[s.options_index].value}),this.current_selectedIndex=this.form_field.selectedIndex,e.preventDefault(),this.search_field_scale())},s.prototype.single_set_selected_text=function(e){return null==e&&(e=this.default_text),e===this.default_text?this.selected_item.addClass("chosen-default"):(this.single_deselect_control_build(),this.selected_item.removeClass("chosen-default")),this.selected_item.find("span").html(e)},s.prototype.result_deselect=function(e){var t;return t=this.results_data[e],!this.form_field.options[t.options_index].disabled&&(t.selected=!1,this.form_field.options[t.options_index].selected=!1,this.selected_option_count=null,this.result_clear_highlight(),this.results_showing&&this.winnow_results(),this.form_field_jq.trigger("change",{deselected:this.form_field.options[t.options_index].value}),this.search_field_scale(),!0)},s.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect)return this.selected_item.find("abbr").length||this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>'),this.selected_item.addClass("chosen-single-with-deselect")},s.prototype.get_search_text=function(){return e("<div/>").text(e.trim(this.search_field.val())).html()},s.prototype.winnow_results_set_highlight=function(){var e,t;if(null!=(e=(t=this.is_multiple?[]:this.search_results.find(".result-selected.active-result")).length?t.first():this.search_results.find(".active-result").first()))return this.result_do_highlight(e)},s.prototype.no_results=function(t){var s;return(s=e('<li class="no-results">'+this.results_none_found+' "<span></span>"</li>')).find("span").first().html(t),this.search_results.append(s),this.form_field_jq.trigger("chosen:no_results",{chosen:this})},s.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},s.prototype.keydown_arrow=function(){var e;return this.results_showing&&this.result_highlight?(e=this.result_highlight.nextAll("li.active-result").first())?this.result_do_highlight(e):void 0:this.results_show()},s.prototype.keyup_arrow=function(){var e;return this.results_showing||this.is_multiple?this.result_highlight?(e=this.result_highlight.prevAll("li.active-result")).length?this.result_do_highlight(e.first()):(this.choices_count()>0&&this.results_hide(),this.result_clear_highlight()):void 0:this.results_show()},s.prototype.keydown_backstroke=function(){var e;return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(e=this.search_container.siblings("li.search-choice").last()).length&&!e.hasClass("search-choice-disabled")?(this.pending_backstroke=e,this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")):void 0},s.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},s.prototype.keydown_checker=function(e){var t,s;switch(t=null!=(s=e.which)?s:e.keyCode,this.search_field_scale(),8!==t&&this.pending_backstroke&&this.clear_backstroke(),t){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(e),this.mouse_on_container=!1;break;case 13:this.results_showing&&e.preventDefault();break;case 32:this.disable_search&&e.preventDefault();break;case 38:e.preventDefault(),this.keyup_arrow();break;case 40:e.preventDefault(),this.keydown_arrow()}},s.prototype.search_field_scale=function(){var t,s,o,i,r,n,a,l;if(this.is_multiple){for(n=0,i="position:absolute; left: -1000px; top: -1000px; display:none;",a=0,l=(r=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"]).length;a<l;a++)i+=(o=r[a])+":"+this.search_field.css(o)+";";return(t=e("<div />",{style:i})).text(this.search_field.val()),e("body").append(t),n=t.width()+25,t.remove(),n>(s=this.container.outerWidth())-10&&(n=s-10),this.search_field.css({width:n+"px"})}},s}(t)}).call(this)}.apply(e,arguments)}))}(this),function(e){define("angular-chosen",["angular","jquery-chosen"],(function(){return function(){
/**
* angular-chosen-localytics - Angular Chosen directive is an AngularJS Directive that brings the Chosen jQuery in a Angular way
* @version v1.3.0
* @link http://github.com/leocaseiro/angular-chosen
* @license MIT
*/
(function(){var e=[].indexOf||function(e){for(var t=0,s=this.length;t<s;t++)if(t in this&&this[t]===e)return t;return-1};angular.module("localytics.directives",[]),angular.module("localytics.directives").directive("chosen",["$timeout",function(t){var s,o,i,r;return o=/^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+group\s+by\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?$/,s=["persistentCreateOption","createOptionText","createOption","skipNoResults","noResultsText","allowSingleDeselect","disableSearchThreshold","disableSearch","enableSplitWordSearch","inheritSelectClasses","maxSelectedOptions","placeholderTextMultiple","placeholderTextSingle","searchContains","singleBackstrokeDelete","displayDisabledOptions","displaySelectedOptions","width","includeGroupLabelInSelected","maxShownResults"],r=function(e){return e.replace(/[A-Z]/g,(function(e){return"_"+e.toLowerCase()}))},i=function(e){var t;if(angular.isArray(e))return 0===e.length;if(angular.isObject(e))for(t in e)if(e.hasOwnProperty(t))return!1;return!0},{restrict:"A",require:"?ngModel",priority:1,link:function(n,a,l,c){var u,h,d,p,_,f,m,g,y,v;if(n.disabledValuesHistory=n.disabledValuesHistory?n.disabledValuesHistory:[],(a=$(a)).addClass("localytics-chosen"),p=n.$eval(l.chosen)||{},angular.forEach(l,(function(t,o){if(e.call(s,o)>=0)return l.$observe(o,(function(e){return p[r(o)]="{{"===String(a.attr(l.$attr[o])).slice(0,2)?e:n.$eval(e),g()}))})),f=function(){return a.addClass("loading").attr("disabled",!0).trigger("chosen:updated")},m=function(){return a.removeClass("loading"),angular.isDefined(l.disabled)?a.attr("disabled",l.disabled):a.attr("disabled",!1),a.trigger("chosen:updated")},u=null,h=!1,d=function(){return u?a.trigger("chosen:updated"):(t((function(){u=a.chosen(p).data("chosen")})),angular.isObject(u)?u.default_text:void 0)},g=function(){return h?a.attr("data-placeholder",u.results_none_found).attr("disabled",!0):a.removeAttr("data-placeholder"),a.trigger("chosen:updated")},c?(_=c.$render,c.$render=function(){return _(),d()},a.on("chosen:hiding_dropdown",(function(){return n.$apply((function(){return c.$setTouched()}))})),l.multiple&&(v=function(){return c.$viewValue},n.$watch(v,c.$render,!0))):d(),l.$observe("disabled",(function(){return a.trigger("chosen:updated")})),l.ngOptions&&c)return y=l.ngOptions.match(o)[7],n.$watchCollection(y,(function(e,s){return t((function(){return angular.isUndefined(e)?f():(h=i(e),m(),g())}))})),n.$on("$destroy",(function(e){if("undefined"!=typeof timer&&null!==timer)return t.cancel(timer)}))}}}])}).call(this)}.apply(e,arguments)}))}(this),define("app/services/versionControlService",["angular","cjt/util/locale","cjt/util/parse","cjt/io/uapi-request","cjt/io/api","cjt/io/uapi","cjt/services/APIService","cjt/filters/qaSafeIDFilter"],(function(e,t,s,o){"use strict";var i=e.module("cpanel.versionControl.service",[]);i.value("PAGE",PAGE),i.factory("versionControlService",["$q","APIService","$filter","PAGE","$timeout","$rootScope",function(i,r,n,a,l,c){var u=function(){},h=[],d=a.fileManagerURL,p=a.gitwebURL;function _(e){if(e&&void 0!==e){if(e.qaSafeSuffix=n("qaSafeID")(e.repository_root),e.fileManagerRedirectURL=d?d+encodeURIComponent(e.repository_root):"",p){var o=e.repository_root.replace(/^\/+/g,"")+"/.git";e.gitWebURL=p+encodeURIComponent(o)}else e.gitWebURL="";e.hasRemote=void 0!==e.source_repository&&e.source_repository,void 0!==e.clone_urls&&e.clone_urls&&(e.cloneURL=e.clone_urls.read_write[0]||e.clone_urls.read_only[0]),e.activeBranch=t.maketext("Not available."),e.hasActiveBranch=!1,void 0!==e.branch&&e.branch&&(e.activeBranch=e.branch,e.hasActiveBranch=!0);var i=function(e){var s={};return s.lastUpdateSHA=t.maketext("Not available."),s.lastUpdateDate=t.maketext("Not available."),s.commitMessage=t.maketext("Not available."),s.author=t.maketext("Not available."),s.hasHeadInformation=!1,void 0!==e.last_update&&e.last_update&&(s.hasHeadInformation=!0,void 0!==e.last_update.identifier&&e.last_update.identifier&&(s.lastUpdateSHA=e.last_update.identifier),void 0!==e.last_update.date&&e.last_update.date&&(s.lastUpdateDate=f(e.last_update.date)),void 0!==e.last_update.author&&e.last_update.author&&(s.author=e.last_update.author),void 0!==e.last_update.message&&e.last_update.message&&(s.commitMessage=e.last_update.message)),s}(e);e.lastUpdateSHA=i.lastUpdateSHA,e.lastUpdateDate=i.lastUpdateDate,e.commitMessage=i.commitMessage,e.author=i.author,e.hasHeadInformation=i.hasHeadInformation;var r=function(e){var s={hasDeploymentInformation:!1};return s.lastDeployedSHA=t.maketext("Not available."),s.lastDeployedDate=t.maketext("Not available."),s.lastDeployedCommitDate=t.maketext("Not available."),s.lastDeployedCommitMessage=t.maketext("Not available."),s.lastDeployedAuthor=t.maketext("Not available."),void 0!==e.last_deployment&&e.last_deployment&&(s.hasDeploymentInformation=!0,void 0!==e.last_deployment.timestamps&&void 0!==e.last_deployment.timestamps.succeeded&&e.last_deployment.timestamps.succeeded&&(s.lastDeployedDate=f(e.last_deployment.timestamps.succeeded),void 0!==e.last_deployment.repository_state&&e.last_deployment.repository_state&&(void 0!==e.last_deployment.repository_state.identifier&&e.last_deployment.repository_state.identifier&&(s.lastDeployedSHA=e.last_deployment.repository_state.identifier),void 0!==e.last_deployment.repository_state.date&&e.last_deployment.repository_state.date&&(s.lastDeployedCommitDate=f(e.last_deployment.repository_state.date)),void 0!==e.last_deployment.repository_state.message&&e.last_deployment.repository_state.message&&(s.lastDeployedCommitMessage=e.last_deployment.repository_state.message),void 0!==e.last_deployment.repository_state.author&&e.last_deployment.repository_state.author&&(s.lastDeployedAuthor=e.last_deployment.repository_state.author)))),s}(e);if(e.hasDeploymentInformation=r.hasDeploymentInformation,e.lastDeployedSHA=r.lastDeployedSHA,e.lastDeployedDate=r.lastDeployedDate,e.lastDeployedCommitDate=r.lastDeployedCommitDate,e.lastDeployedCommitMessage=r.lastDeployedCommitMessage,e.lastDeployedAuthor=r.lastDeployedAuthor,e.deployable=s.parsePerlBoolean(e.deployable),e.cloneInProgress=!1,e.deployInProgress=!1,void 0!==e.tasks&&e.tasks&&e.tasks.length>0)for(var a=0,l=e.tasks.length;a<l;a++)"create"===e.tasks[a].action&&(e.cloneInProgress=!0,e.cloneTaskID=e.tasks[a].id),"deploy"===e.tasks[a].action&&(e.deployInProgress=!0)}return e}function f(e){return e?"number"!=typeof e&&(e=Number(e),isNaN(e))?t.maketext("Not available."):(e=Math.floor(e),t.local_datetime(e,"datetime_format_medium")):t.maketext("Not available.")}function m(e){var t=[];if(null!=e)for(var s=0,o=e.length;s<o;s++){var i=_(e[s]);t.push(i)}return t}function g(e,t){var s=null;if(void 0!==typeof e&&e)for(var o=0,i=e.length;o<i;o++)if(e[o].repository_root===t){s=o;break}return s}return h=m(a.repos),u.prototype=new r,e.extend(u.prototype,{getRepositoryList:function(){return h},listRepositories:function(e,t){if(e){var s=new o.Class;return s.initialize("VersionControl","retrieve"),t&&s.addArgument("fields",t),this.deferred(s).promise.then((function(e){try{return h=m(e.data),i.resolve(h)}catch(e){return i.reject(e)}})).catch((function(e){return i.reject(e)}))}return i.resolve(h)},getRepositoryInformation:function(e,s){var r=new o.Class;if(r.initialize("VersionControl","retrieve"),!e)throw new Error(t.maketext("Repository path cannot be empty."));r.addFilter("repository_root","eq",e),s&&r.addArgument("fields",s);var n=[];return this.deferred(r).promise.then((function(s){try{return(n=m(s.data))&&n.length>0?i.resolve(n[0]):i.reject(t.maketext("The system could not find the “[_1]” repository.",e))}catch(e){return i.reject(e)}})).catch((function(e){return i.reject(e)}))},cloneToClipboard:function(e){if("string"==typeof e&&""!==e)return function(e){var s=document.createElement("textarea");s.value=e,document.body.appendChild(s),s.select();try{document.execCommand("copy")}catch(s){throw new Error(t.maketext("You cannot copy the “[_1]” clone [output,acronym,URL,Uniform Resource Locator] to the clipboard.",e))}document.body.removeChild(s)}(e),!0;throw new Error(t.maketext("“[_1]” is not a valid clone [output,acronym,URL,Universal Resource Locator].",e))},createRepository:function(e,t,s){var r=new o.Class;return r.initialize("VersionControl","create"),r.addArgument("name",e),r.addArgument("repository_root",t),r.addArgument("type","git"),void 0!==s&&s&&r.addArgument("source_repository",JSON.stringify({remote_name:"origin",url:s})),this.deferred(r).promise.then((function(e){var t={};return e.data&&(t=_(e.data),h.push(t)),t})).catch((function(e){return i.reject(e)}))},deleteRepository:function(e){if("string"==typeof e&&""!==e){var t=new o.Class;return t.initialize("VersionControl","delete"),t.addArgument("repository_root",e),this.deferred(t).promise.then((function(){var t=g(h,e);return"number"==typeof t&&t>=0&&h.splice(t,1),i.resolve()})).catch((function(e){return i.reject(e)}))}},updateRepository:function(e,t,s){var r=new o.Class;return r.initialize("VersionControl","update"),r.addArgument("repository_root",e),"string"==typeof t&&t&&r.addArgument("name",t),"string"==typeof s&&s&&r.addArgument("branch",s),this.deferred(r).promise.then((function(t){if(t.data){var s=g(h,e);"number"==typeof s&&s>=0&&(h[s]=_(t.data))}return t})).catch((function(e){return i.reject(e)}))},updateFromRemote:function(e,t){var s=new o.Class;return s.initialize("VersionControl","update"),s.addArgument("repository_root",e),s.addArgument("branch",t||""),this.deferred(s).promise.then((function(t){if(t.data){var s=g(h,e);"number"==typeof s&&s>=0&&(h[s]=_(t.data))}return t})).catch((function(e){return i.reject(e)}))},deployRepository:function(e){var t=new o.Class;return t.initialize("VersionControlDeployment","create"),t.addArgument("repository_root",e),this.deferred(t).promise.then((function(e){return e})).catch((function(e){return i.reject(e)}))}}),new u}])})),define("app/services/sseAPIService",["angular","cjt/core","lodash"],(function(e,t,s){"use strict";e.module("cpanel.versionControl.sseAPIService",[]).factory("sseAPIService",["$rootScope",function(e){var s=function(t,s){return function(o){o.eventName=t;var i=o.data;try{i=function(e,t){return e&&e.json&&t&&(t=JSON.parse(t)),t}(s,i)}catch(s){return void function(t,s,o){e.$broadcast("sse:"+t+":error",{data:o,error:s})}(t,s,i)}e.$broadcast("sse:"+t,i)}};return{initialize:function(s){if(window.EventSource)s&&s(),e.$broadcast("sse:ready");else{var o=document.createElement("script");o.src=t.buildFullPath("libraries/eventsource-polyfill/eventsource.js"),o.onload=function(){s&&s(),e.$broadcast("sse:ready")},document.body.appendChild(o)}},connect:function(t,o,i){o||(o=[]);var r=i||{},n=new EventSource(t);return o&&o.forEach((function(e){n.addEventListener(e,s(e,r))})),n.onerror=function(t){e.$broadcast("sse:error",t)},window.addEventListener("beforeunload",(function(t){n&&(n.close(),n=null,e.$broadcast("sse:beforeunload",t))})),n},close:function(e){e&&e.close()}}}])})),define("app/views/listRepositoriesController",["angular","lodash","cjt/util/locale","cjt/util/table","uiBootstrap","cjt/filters/wrapFilter","cjt/services/cpanel/nvDataService","app/services/versionControlService","app/services/sseAPIService","cjt/services/alertService","cjt/directives/alert","cjt/directives/alertList","cjt/directives/actionButtonDirective"],(function(e,t,s,o){"use strict";var i=e.module("cpanel.versionControl");return i.value("PAGE",PAGE),i.controller("ListRepositoriesController",["$scope","$window","$location","versionControlService","sseAPIService","PAGE","nvDataService","alertService","$timeout",function(e,i,r,n,a,l,c,u,h){var d=this;d.isLoading=!1,d.list=[],d.cloningList=[];var p,_=l.securityToken+"/sse/UserTasks",f=["task_processing","task_complete","task_failed"],m={json:!0};d.homeDirPath=l.homeDir,d.hasFilemanagerAccess="0"!==l.hasFileManagerAccess,d.hasShellAccess="0"!==l.hasShellAccess;var g=new o;function y(e){return e&&(e.isExpanded=!1,e.detailsLoading=!1,e.delete_requested=!1,e.cloneState=""),e}g.setSort("name","asc"),d.meta=g.getMetadata(),d.filteredList=g.getList(),d.paginationMessage=g.paginationMessage,d.meta.pageSize=parseInt(l.reposListPageSize,10),g.setSearchFunction((function(e,t){return t=t.toLowerCase(),-1!==e.name.toLowerCase().indexOf(t)||-1!==e.repository_root.toLowerCase().indexOf(t)})),d.render=function(){d.filteredList=g.update()},d.sortList=function(){d.render()},d.selectPage=function(){d.render()},d.selectPageSize=function(){d.render(),l.reposListPageSize!==d.meta.pageSize&&c.setObject({repos_list_page_size:d.meta.pageSize}).then((function(){l.reposListPageSize=d.meta.pageSize})).catch((function(e){u.add({type:"danger",message:e.message,closeable:!0,replace:!1,group:"versionControl"})}))},d.searchList=function(){d.render()},d.init=function(){var e=l.repoErrors;e.length>0?e.forEach((function(e){u.add({type:"danger",message:e,closeable:!0,replace:!1,group:"versionControl"})})):d.updateRepositoriesList(!0)},d.updateRepositoriesList=function(e){d.isLoading=!0;var s=e?"name,tasks":null;return n.listRepositories(e,s).then((function(e){d.list=t.map(e,(function(e){return y(e)}));for(var s=0,o=d.list.length;s<o;s++)d.list[s].cloneInProgress&&d.cloningList.push(d.list[s]);d.cloningList&&d.cloningList.length>0&&a.initialize(),g.load(d.list),d.render(),d.isLoading=!1}),(function(e){u.add({type:"danger",message:e.message,closeable:!0,replace:!1,group:"versionControl"}),d.isLoading=!1}))},e.$on("sse:task_processing",(function(s,o){var i=o.task_id,r=t.find(d.cloningList,(function(e){return e.cloneTaskID===i}));if(r){var n=t.indexOf(d.list,r);-1!==n&&(r.cloneState="processing",t.extend(d.list[n],r),e.$apply(d.render))}})),e.$on("sse:task_complete",(function(s,o){var i=o.task_id,r=t.find(d.cloningList,(function(e){return e.cloneTaskID===i}));if(r){var l=t.indexOf(d.list,r);-1!==l&&(r.cloneState="complete",t.extend(d.list[l],r),e.$apply(d.render),t.remove(d.cloningList,r),0===d.cloningList.length&&a.close(p),h((function(){return n.getRepositoryInformation(r.repository_root,"name,tasks").then((function(e){var s,o=y(e);t.extend(d.list[l],((s=o)&&(s.cloneState="",s.cloneInProgress=!1,delete s.cloneTaskID),s)),u.removeById(i,"versionControl"),d.render()}),(function(e){u.removeById(i,"versionControl"),u.add({type:"danger",message:e.message,closeable:!0,replace:!1,group:"versionControl"})}))}),5e3))}})),e.$on("sse:task_failed",(function(o,i){var r=i.task_id,n=t.find(d.cloningList,(function(e){return e.cloneTaskID===r}));if(n){var l=t.indexOf(d.list,n);t.remove(d.cloningList,n),0===d.cloningList.length&&a.close(p),-1!==l&&(d.list.splice(l,1),u.add({type:"danger",message:s.maketext("Error occurred while cloning repository “[_1]”.",n.name),closeable:!0,replace:!1,group:"versionControl"}),e.$apply(d.render))}})),e.$on("sse:ready",(function(e){p=a.connect(_,f,m)})),e.$on("$destroy",(function(){p&&a.close(p)})),d.redirectToGitWeb=function(e,t){e?i.open(e,t+"GitWeb"):u.add({type:"danger",message:s.maketext("Unable to find repository web url"),closeable:!0,replace:!1,group:"versionControl"})},d.redirectToFileManager=function(e,t){e?i.open(e,t+"FileManager"):u.add({type:"danger",message:s.maketext("Unable to redirect to File Manager interface"),closeable:!0,replace:!1,group:"versionControl"})},d.cloneToClipboard=function(e){try{n.cloneToClipboard(e)&&u.add({type:"success",message:s.maketext("The system successfully copied the “[_1]” clone [output,acronym,URL,Uniform Resource Locator] to the clipboard.",e),closeable:!0,replace:!1,autoClose:1e4,group:"versionControl"})}catch(e){u.add({type:"danger",message:e,closeable:!0,replace:!1,group:"versionControl"})}},d.createRepository=function(){u.clear("","versionControl"),r.path("/create")},d.delete=function(e){var t;return e.removing=!0,t=d.hasFilemanagerAccess?s.maketext("The system successfully removed the “[_1]” repository from the list of [asis,cPanel]-managed repositories. You can use the [output,url,_2,File Manager,target,_3] interface to delete the repository contents.",e.name,e.fileManagerRedirectURL,"file-manager"):s.maketext("The system successfully removed the “[_1]” repository from the list of [asis,cPanel]-managed repositories.",e.name),n.deleteRepository(e.repository_root).then((function(){g.remove(e),d.render(),u.add({type:"success",message:t,closeable:!0,replace:!1,autoClose:!1,group:"versionControl"})}),(function(t){u.add({type:"danger",message:s.maketext("The system could not remove the “[_1]” repository in the “[_2]” directory.",e.name,e.repository_root),closeable:!0,replace:!1,group:"versionControl"}),e.removing=!1,e.delete_requested=!1}))},d.deleteText=function(e){return s.maketext("Are you sure that you want to remove the “[_1]” repository from the list of [asis,cPanel]-managed repositories?",e.name)},d.manageRepository=function(e){r.path("/manage/"+encodeURIComponent(e)+"/basic-info")},d.getRepositoryDetails=function(e,s){if(e.detailsLoading=!0,s)return n.getRepositoryInformation(e.repository_root,"name,clone_urls,branch,last_update,source_repository").then((function(s){var o;o=e.repository_root,-1!==t.findIndex(d.filteredList,(function(e){return e.repository_root===o}))&&(s.detailsLoading=!1,s.isExpanded=!0,s.delete_requested=e.delete_requested,t.assign(e,s)),t.assign(e,s)}),(function(e){u.add({type:"danger",message:e.message,closeable:!0,replace:!1,group:"versionControl"})}));e.detailsLoading=!1,e.isExpanded=!1},d.init()}])})),define("app/utils/cloneUrlParser",[],(function(){"use strict";return{parse:function(e){var t={};if(!e)return t;var s=e.match(/^(https?:\/\/)?(?!\[)([^/]+)\/*(?!\])/);if(null!==s&&s[2].match(/.*:.*:.*/))return t;function o(t,s){return s=s||0,null!==t&&t.length>0?(e=e.replace(t[0],""),t[s]):null}return t.scheme=o(e.match(/^\S+:\/\//i)),t.userInfo=o(e.match(/^\S+@/i)),t.ipv6Authority=o(e.match(/^\[\S+\]/i)),t.ipv6Authority&&(t.ipv6Authority=t.ipv6Authority.replace(/(\[|\])/gi,"")),t.authority=null===t.ipv6Authority?o(e.split(/((:\d+\/)|(\/|:))/i)):null,t.port=e.match(/^:\d+\//i)?o(e.match(/^:(\d+)/i),1):null,t.path=o(e.match(/^\S+/i)),t.unparsed=e,t}}})),define("app/services/knownHostsService",["angular","cjt/util/locale","cjt/util/parse","cjt/io/uapi-request","cjt/io/uapi","cjt/services/APIService"],(function(e,t,s,o){"use strict";var i=e.module("cpanel.versionControl.knownHostsService",["cjt2.services.api"]);i.value("PAGE",PAGE),i.factory("knownHostsService",["$q","APIService","$filter","PAGE","$timeout","$rootScope",function(t,s,i,r,n,a){var l=function(){};return l.prototype=new s,e.extend(l.prototype,{verify:function(e,s){var i=new o.Class;return i.initialize("KnownHosts","verify"),i.addArgument("host_name",e),s&&i.addArgument("port",s),this.deferred(i).promise.then((function(e){var s=e&&e.data||{};return s.status?{status:"recognized"}:s.host.length&&s.failure_type?t.reject({status:"unrecognized-"+s.failure_type,keys:s.host}):t.reject({status:"unrecognized-unknown"})}),(function(e){return t.reject({status:"unrecognized-unknown",error:e})}))},create:function(e,t){var s=new o.Class;return s.initialize("KnownHosts","create"),s.addArgument("host_name",e),t&&s.addArgument("port",t),this.deferred(s).promise.then((function(e){return{status:"recognized"}}))}}),new l}])})),define("app/services/sshKeyVerification",["angular","lodash","cjt/util/locale","app/utils/cloneUrlParser","ngSanitize","uiBootstrap","app/services/knownHostsService","cjt/directives/actionButtonDirective"],(function(e,t,s,o){"use strict";e.module("cpanel.versionControl.sshKeyVerificationService",["cpanel.versionControl.knownHostsService","ui.bootstrap","ngSanitize","cjt2.directives.actionButton"]).factory("sshKeyVerification",["knownHostsService","$uibModal",function(e,i){var r,n,a,l=(r=t.memoize(e.verify,h),n=r.cache,(a=r.bind(e)).cache=n,a),c={verify:l,getHostnameAndPort:function(e){var t=o.parse(e);if("ssh://"===t.scheme||!t.scheme&&t.userInfo)return{hostname:t.authority||t.ipv6Authority,port:t.port}},openModal:function(e){var t=this;return t.modal=i.open({templateUrl:"views/sshKeyVerification.ptt",controllerAs:"modal",controller:u,resolve:{props:function(){return e}}}),t.modal.result.finally((function(){delete t.modal})),t.modal}};function u(e){t.assign(this,e)}function h(e,t){return e+(t=t?":"+t:"")}return u.$inject=["props"],t.assign(u.prototype,{acceptIdentity:function(){var t=this,s=e.create(t.hostname,t.port).then((function(e){return e.status})).finally((function(){var e=h(t.hostname,t.port);l.cache.delete(e),l(t.hostname,t.port)}));return t.onAccept?t.onAccept(s):s},rejectIdentity:function(){c.modal.dismiss()},newKeyIntro:function(){return s.maketext("You have not connected this [asis,cPanel] account to the SSH server for “[output,strong,_1].” The system cannot verify the server’s identity.",this.hostname)},changedKeyIntro:function(){return s.maketext("The current identity of the SSH server at “[output,strong,_1]” does not match its identity in your account’s [asis,known_hosts] file.",this.hostname)},keyIsNew:function(){return"unrecognized-new"===this.type},keyIsChanged:function(){return"unrecognized-changed"===this.type}}),c}])})),define("app/services/directoryLookupService",["angular","lodash","cjt/core","cjt/util/locale","cjt/io/api","cjt/io/uapi-request","cjt/io/uapi","cjt/util/parse"],(function(e,t,s,o,i,r,n,a){"use strict";var l=e.module("cpanel.services.directoryLookup",[]),c=null;l.factory("directoryLookupService",["$q","APIService",function(t,s){var o=function(){};return o.prototype=new s,e.extend(o.prototype,{complete:function(e){c&&c.abort();var t=new r.Class;return t.initialize("Fileman","autocompletedir"),t.addArgument("path",e),t.addArgument("dirsonly",!0),t.addArgument("skipreserved",!0),t.addArgument("html",0),"/"===e.charAt(e.length-1)&&t.addArgument("list_all",!0),this.deferred(t,{transformAPISuccess:function(e){for(var t=[],s=0,o=e.data.length;s<o;s++)t.push(e.data[s].file);return t}}).promise},sendRequest:function(e,t,o){return e=new s.AngularAPICall(e,t,o),c=e.jqXHR,e.deferred}}),new o}])})),define("app/directives/cloneURLValidator",["angular","app/utils/cloneUrlParser","cjt/util/locale","cjt/validator/validator-utils","cjt/validator/ip-validators","cjt/validator/domain-validators","cjt/validator/validateDirectiveFactory"],(function(e,t,s,o,i,r){"use strict";var n={validCloneUrl:function(e){var n=o.initializeValidationResult();if(null==e)return n.isValid=!1,n.add("cloneURLValidator",s.maketext("You must specify a valid clone URL.")),n;var a=t.parse(e),l=a.scheme,c=a.userInfo,u=a.ipv6Authority,h=a.authority,d=a.path,p=a.unparsed,_=/^(?:git|ssh|https?)(?::\/\/)$/i.test(l);if(/^\S+:\S+@/i.test(c))return n.isValid=!1,n.add("cloneURLValidator",s.maketext("The clone URL [output,strong,cannot] include a password.")),n;var f=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@/i.test(c),m=!1;if(_&&f&&(m=!0),_^f){if(!_&&null!==l)return n.isValid=!1,n.add("cloneURLValidator",s.maketext("The provided clone URL [output,strong,must] include a valid protocol.")),n;m=!0}if(!m)return n.isValid=!1,n.add("cloneURLValidator",s.maketext("Clone URLs [output,strong,must] include a valid protocol or username.")),n;if(null!==u){var g=i.methods.ipv6(u);if(!g.isValid){var y=function(e){for(var t="",s=0,o=e.length;s<o;s++)t+=s!==o-1?e[s].message+" ":e[s].message;return t}(g.messages);return n.isValid=!1,n.add("cloneURLValidator",y),n}}if(null!==h&&""!==h){var v=i.methods.ipv4(h),b=r.methods.fqdn(h);if(!v.isValid&&!b.isValid)return n.isValid=!1,n.add("cloneURLValidator",s.maketext("The clone URL [output,strong,must] include a valid IP address or a fully-qualified domain name.")),n}else if(null===u)return n.isValid=!1,n.add("cloneURLValidator",s.maketext("The clone URL [output,strong,must] include a valid IP address or a fully-qualified domain name.")),n;var k=/^:/i.test(d);if(_&&f&&k)return n.isValid=!1,n.add("cloneURLValidator",s.maketext("The repository path should [output,strong,not] begin with “:” if it includes the protocol.")),n;return/^(:|\/)\S*(\.git)?\/?/i.test(d)?""!==p?(n.isValid=!1,n.add("cloneURLValidator",s.maketext("The clone URL [output,strong,cannot] include whitespace characters.")),n):n:(n.isValid=!1,n.add("cloneURLValidator",s.maketext("The path or port number is [output,strong,not] valid.")),n)}};return e.module("cjt2.validate").run(["validatorFactory",function(e){e.generate(n)}]),{methods:n,name:"clone-url-validator",description:"Validation on git-based clone URLs.",version:1}})),define("app/views/createRepositoriesController",["angular","lodash","cjt/util/locale","uiBootstrap","app/services/versionControlService","app/services/sshKeyVerification","cjt/services/alertService","cjt/directives/alert","cjt/directives/alertList","cjt/directives/actionButtonDirective","cjt/directives/toggleSwitchDirective","cjt/directives/toggleLabelInfoDirective","app/services/versionControlService","cjt/directives/validationContainerDirective","cjt/directives/validationItemDirective","cjt/validator/ascii-data-validators","cjt/validator/path-validators","app/services/directoryLookupService","app/directives/cloneURLValidator","cjt/filters/htmlFilter","cjt/decorators/uibTypeaheadDecorator"],(function(e,t,s){"use strict";var o=e.module("cpanel.versionControl");return o.value("PAGE",PAGE),o.controller("CreateRepositoriesController",["$scope","$location","versionControlService","sshKeyVerification","PAGE","alertService","directoryLookupService",function(e,t,o,i,r,n,a){var l=this;l.homeDirPath=r.homeDir+"/",l.displaySuccessSummary=!1,l.formData={repoName:"",repoPath:"",clone:!0,cloneURL:"",createAnother:!1},l.ssh={},l.pathExcludeList="[^'\":\\\\*?<>|@&=%#`$(){};\\[\\]\\s]+";var c=/[%*{}()=?`$@:|[\]'"<>&#;\s\\]+/g;function u(e,t){return e&&t&&e.hostname===t.hostname&&t.port==t.port}function h(e){return e.then((function(e){return l.ssh.status=e,d()}),(function(e){n.add({type:"danger",message:s.maketext("The system failed to add the fingerprints from “[_1]” to the [asis,known_hosts] file: [_2]",l.ssh.hostname,e),closeable:!0,replace:!0,group:"versionControl",id:"known-hosts-verification-failure"})})).finally((function(){l.ssh.modal.close(),delete l.ssh.modal}))}function d(){var e=l.homeDirPath+l.formData.repoPath;return o.createRepository(l.formData.repoName,e,l.formData.cloneURL).then((function(e){if(l.formData.cloneURL)n.add({type:"info",message:s.maketext("The system successfully initiated the clone process for the “[_1]” repository.",l.formData.repoName)+" "+s.maketext("The system may require more time to clone large remote repositories."),closeable:!0,replace:!1,group:"versionControl",id:e.cloneTaskID,counter:!1}),l.formData.createAnother?l.resetFormData({isCreateAnother:!0}):l.backToListView();else if(n.add({type:"success",message:s.maketext("The system successfully created the “[_1]” repository.",l.formData.repoName),closeable:!0,replace:!1,autoClose:1e4,group:"versionControl"}),l.formData.createAnother)l.resetFormData({isCreateAnother:!0});else{var t=e,o=t.cloneURL;if(void 0!==o&&o){l.displaySuccessSummary=!0,l.summary={},l.summary.remoteURL=o;var i=l.summary.remoteURL.split("/");i&&i.length>0?l.summary.directoryName=i[i.length-1]:l.summary.directoryName="",l.summary.readOnly=0===t.clone_urls.read_write.length}else l.backToListView()}}),(function(e){n.add({type:"danger",message:e,closeable:!0,replace:!1,group:"versionControl"})}))}l.checkKnownHosts=function(){var e=l.formData.cloneURL,t=e&&i.getHostnameAndPort(e);if(t){if(!u(l.ssh,t))return l.ssh.hostname=t.hostname,l.ssh.port=t.port,l.ssh.status="verifying",l.ssh.keys=[],l.ssh.promise=i.verify(t.hostname,t.port).then(s,s)}else l.ssh={};function s(e){if(u(l.ssh,t))return l.ssh.status=e.status,l.ssh.keys=e.keys,e.status}},l.backToListView=function(){t.path("/list")},l.resetFormData=function(e){l.formData={repoName:"",repoPath:"",clone:!e.isCreateAnother||l.formData.clone,cloneURL:"",createAnother:Boolean(e.isCreateAnother)},l.createRepoForm.$setPristine()},l.createRepository=function(){if(l.formData.repoName&&l.formData.repoPath)return n.clear(null,"versionControl"),l.formData.clone||(l.formData.cloneURL=null),!l.formData.cloneURL||"unrecognized-new"!==l.ssh.status&&"unrecognized-changed"!==l.ssh.status?l.formData.cloneURL&&l.ssh.promise?l.ssh.promise.then((function(e){return delete l.ssh.promise,l.createRepository()})):d():(n.clear(null,"versionControl"),l.ssh.modal=i.openModal({hostname:l.ssh.hostname,port:l.ssh.port,type:l.ssh.status,keys:l.ssh.keys,onAccept:h}),void l.ssh.modal.result.catch((function(){n.add({type:"danger",message:s.maketext("The system [output,strong,cannot] clone this repository if you do not trust the host key for “[output,strong,_1]”. To create your repository, select one of the following options:",l.ssh.hostname),list:[s.maketext("Enter a clone URL that uses the HTTPS or Git protocols instead of SSH."),s.maketext("Enter a clone URL for a different, previously-trusted host."),s.maketext("Click [output,em,Create] again and choose to trust the remote server.")],closeable:!0,replace:!0,group:"versionControl",id:"known-hosts-verification-cancelled"})})))},l.completeDirectory=function(e){var t=a.complete(e),s=[];return t.then((function(e){for(var t=0,o=e.length;t<o;t++){var i=e[t];-1===i.search(c)&&s.push(i)}return s}))},l.toggleStatus=function(){return l.formData.clone=!l.formData.clone,!0},l.autoFillPathAndName=function(){if(!l.formData.repoName&&!l.formData.repoPath&&l.createRepoForm.repoCloneURL.$valid&&l.formData.cloneURL){var e=l.formData.cloneURL,t=(e=e.replace(/\/+$/,"")).substr(e.lastIndexOf("/")+1).replace(".git",""),s="repositories/"+(t=t.replace(c,"_"));l.formData.repoPath=s,l.formData.repoName=t}}}])})),define("app/views/manageRepositoriesController",["angular","lodash","cjt/util/locale","uiBootstrap","app/services/versionControlService","app/services/sseAPIService","cjt/services/alertService","cjt/directives/alert","cjt/directives/alertList","cjt/directives/actionButtonDirective","jquery-chosen","angular-chosen","cjt/decorators/angularChosenDecorator"],(function(e,t,s){"use strict";var o=e.module("cpanel.versionControl");return o.value("PAGE",PAGE),o.controller("ManageRepositoriesController",["$scope","$window","$location","$timeout","versionControlService","sseAPIService","PAGE","$routeParams","alertService","sshKeyVerification","$q",function(e,o,i,r,n,a,l,c,u,h,d){var p=this;p.isRTL=!1;var _=document.querySelector("html");_&&(p.isRTL="rtl"===_.getAttribute("dir")),p.isLoading=!0,p.deployInProgress=!1,p.deployState="",p.deployedTaskInformation=null,p.deployCalloutType="info";var f,m="",g=["log_update","task_complete","task_failed"],y={json:!0},v=["basic-info","deploy"],b=0,k=decodeURIComponent(c.repoPath);function w(e){return n.getRepositoryInformation(e,"available_branches").then((function(e){p.branchList=e&&e.available_branches||[]}),(function(e){return p.unableToRetrieveAvailableBranches=!0,d.reject(e)}))}function x(){return w(p.repoPath).catch((function(){u.add({type:"danger",id:"retrieve-branches-again-error",message:t.escape(s.maketext("The system cannot update information for the repository at “[_1]” because it cannot access the remote repository.",p.repoPath)),closeable:!0,replace:!0,group:"versionControl"})}))}function C(e){return e.then((function(e){return p.ssh.status=e,x()}),(function(e){u.add({type:"danger",message:t.escape(s.maketext("The system failed to add the fingerprints from “[_1]” to the [asis,known_hosts] file: [_2]",p.ssh.hostname,e)),closeable:!0,replace:!0,group:"versionControl",id:"known-hosts-verification-failure"})})).finally((function(){p.ssh.modal.close(),delete p.ssh.modal}))}function D(e){p.name=e.name,p.repoPath=e.repository_root,p.cloneURL=e.clone_urls.read_write[0],p.branch=e.branch,p.checkedoutBranch=e.branch,p.hasActiveBranch=e.hasActiveBranch,p.hasHeadInformation=e.hasHeadInformation,p.lastUpdateSHA=e.lastUpdateSHA,p.lastUpdateDate=e.lastUpdateDate,p.commitMessage=e.commitMessage,p.author=e.author,e.available_branches&&(p.branchList=e.available_branches),p.hasRemote=e.hasRemote,p.remoteInformation=e.source_repository,p.gitWebURL=e.gitWebURL,p.fileManagerRedirectURL=e.fileManagerRedirectURL,p.fullRepoPath=p.repoPath,p.qaSafeSuffix=e.qaSafeSuffix,p.deployInProgress=e.deployInProgress,p.deployable=e.deployable,p.hasDeploymentInformation=e.hasDeploymentInformation,p.lastDeployedDate=e.lastDeployedDate,p.lastDeployedSHA=e.lastDeployedSHA,p.lastDeployedAuthor=e.lastDeployedAuthor,p.lastDeployedCommitDate=e.lastDeployedCommitDate,p.lastDeployedCommitMessage=e.lastDeployedCommitMessage,p.changesAvailableToDeploy=e.lastDeployedSHA!==e.lastUpdateSHA,p.deployTasks=A(e.tasks),void 0===f&&p.deployInProgress&&R()}function A(e){var o=t.map(e,(function(e){if("deploy"===e.action){var t=function(e){var t;if(e){t=e.split("/").pop().match(/\d+(\.\d+)/g)}return t[0]}(e.args.log_file);return{task_id:e.task_id,log_file:e.args.log_file,sse_url:e.sse_url,timeStamp:t,humanReadableDate:s.local_datetime(t,"datetime_format_medium")}}}));return t.sortBy(o,[function(e){return e.log_file}])}function S(){p.deployState="",p.deployCalloutType="info",p.deployedTaskInformation=null,f=null}function R(){var e;p.queuedDeployTasksCount=p.deployTasks.length-1,p.queuedDeployTasksCount&&(p.queuedTaskString=(e=p.queuedDeployTasksCount,s.maketext("[quant,_1,additional task,additional tasks] queued",e))),p.firstDeployTask=p.deployTasks[0],m=p.firstDeployTask.sse_url,p.deployProgress=s.maketext("The deployment that you triggered on [_1] is in progress …",p.firstDeployTask.humanReadableDate),p.deployComplete=s.maketext("The deployment that you triggered on [_1] is complete. Updating last deployment information …",p.firstDeployTask.humanReadableDate),p.deployQueued=s.maketext("The deployment that you triggered on [_1] is queued …",p.firstDeployTask.humanReadableDate),a.initialize()}!function(t){t&&-1!==(b=v.indexOf(t))?e.activeTabIndex=b:i.path("/list/")}(decodeURIComponent(c.tabname)),function(e){var s;n.getRepositoryInformation(e,"name,tasks,clone_urls,branch,last_update,source_repository,last_deployment,deployable").then((function(t){s=t;var o=w(e);return o.catch((function(){var e=h.getHostnameAndPort(t&&t.source_repository&&t.source_repository.url);e&&(p.ssh={},p.ssh.hostname=e.hostname,p.ssh.port=e.port,p.ssh.promise=h.verify(e.hostname,e.port))})),o}),(function(e){u.add({type:"danger",message:t.escape(e),closeable:!0,replace:!1,group:"versionControl"}),i.path("/list/")})).finally((function(){D(s),p.isLoading=!1}))}(k),e.changeActiveTab=function(t){var s=i.url().split("/").pop().toLowerCase();t&&(e.activeTabIndex=v.indexOf(t),s!==t&&i.path("/manage/"+encodeURIComponent(k)+"/"+t))},e.$watch("repository.hasRemote",(function(e){e?(p._noConnectionText=s.maketext("The system could not contact the remote repository."),p._tryAgainTooltipText=s.maketext("Attempt to contact the remote repository again.")):(p._noConnectionText=s.maketext("The system could not read from the repository."),p._tryAgainTooltipText=s.maketext("Attempt to read from the repository again."))})),p.tryAgain=function(){return u.removeById("retrieve-branches-again-error","versionControl"),p.ssh.promise?p.ssh.promise.then((function(){return x()}),(function(e){p.ssh.status=e.status,p.ssh.keys=e.keys,u.clear(null,"versionControl"),p.ssh.modal=h.openModal({hostname:p.ssh.hostname,port:p.ssh.port,type:p.ssh.status,keys:p.ssh.keys,onAccept:C}),p.ssh.modal.result.catch((function(){u.add({type:"danger",message:t.escape(s.maketext("The system [output,strong,cannot] connect to the remote repository if you do not accept the host key for “[output,strong,_1].”",p.ssh.hostname)),closeable:!0,replace:!0,group:"versionControl",id:"known-hosts-verification-cancelled"})})),p.ssh.modal})):x()},p.updateRepository=function(){var e=p.branch===p.checkedoutBranch?"":p.branch;return n.updateRepository(p.repoPath,p.name,e).then((function(e){u.add({type:"success",message:t.escape(s.maketext("The system successfully updated the “[_1]” repository.",p.name)),closeable:!0,replace:!0,autoClose:1e4,group:"versionControl"}),D(e.data)}),(function(e){u.add({type:"danger",message:t.escape(e),closeable:!0,replace:!1,group:"versionControl"})}))},p.pullFromRemote=function(){return n.updateFromRemote(p.repoPath,p.branch).then((function(e){var o=e.data;p.lastUpdateSHA===o.lastUpdateSHA?u.add({type:"info",message:t.escape(s.maketext("The “[_1]” repository is up-to-date.",p.name)),closeable:!0,replace:!0,autoClose:1e4,group:"versionControl"}):(u.add({type:"success",message:t.escape(s.maketext("The system successfully updated the “[_1]” repository.",p.name)),closeable:!0,replace:!0,autoClose:1e4,group:"versionControl"}),p.hasHeadInformation=o.hasHeadInformation,p.lastUpdateSHA=o.lastUpdateSHA,p.lastUpdateDate=o.lastUpdateDate,p.commitMessage=o.commitMessage,p.author=o.author,p.newCommits=!0,r((function(){p.newCommits=!1}),1e4))}),(function(e){u.add({type:"danger",message:t.escape(e),closeable:!0,replace:!1,group:"versionControl"})}))},e.$on("sse:ready",(function(e){m=l.securityToken+m,f=a.connect(m,g,y)})),e.$on("$destroy",(function(){f&&a.close(f)})),e.$on("sse:log_update",(function(t,s){p.deployState="processing",e.$apply()})),e.$on("sse:task_complete",(function(s,o){a.close(f),p.deployCalloutType="success",p.deployState="complete",e.$apply(),r((function(){return n.getRepositoryInformation(p.repoPath,"last_deployment,tasks").then((function(e){p.lastDeployedDate=e.lastDeployedDate,p.lastDeployedSHA=e.lastDeployedSHA,p.lastDeployedAuthor=e.lastDeployedAuthor,p.lastDeployedCommitDate=e.lastDeployedCommitDate,p.lastDeployedCommitMessage=e.lastDeployedCommitMessage,p.hasDeploymentInformation=!0,p.changesAvailableToDeploy=e.lastDeployedSHA!==p.lastUpdateSHA,p.deployTasks=A(e.tasks),S(),p.deployTasks&&p.deployTasks.length>0?(p.deployInProgress=!0,R()):p.deployInProgress=!1,p.newDeployCommit=!0,r((function(){p.newDeployCommit=!1}),5e3)}),(function(e){u.add({type:"danger",message:t.escape(e.message),closeable:!0,replace:!1,group:"versionControl"})}))}),5e3)})),e.$on("sse:task_failed",(function(o,i){a.close(f);var r=function(e){var t={};if(e){var s=e.split("/").pop(),o=l.homeDir+"/.cpanel/logs",i=l.deprefix+"filemanager/showfile.html?file="+encodeURIComponent(s)+"&dir="+encodeURIComponent(o);t.fileName=s,t.fileManagerURL=i}return t}(p.deployedTaskInformation.log_path);return u.add({type:"danger",message:s.maketext("Error occurred while deploying.")+" "+s.maketext("You can view the log file: [output,url,_1,_2,target,_3]",r.fileManagerURL,r.fileName,"_blank"),closeable:!0,replace:!1,group:"versionControl"}),e.$apply(),n.getRepositoryInformation(p.repoPath,"tasks").then((function(e){p.deployTasks=A(e.tasks),S(),p.deployTasks&&p.deployTasks.length>0?(p.deployInProgress=!0,R()):p.deployInProgress=!1}),(function(e){u.add({type:"danger",message:t.escape(e.message),closeable:!0,replace:!1,group:"versionControl"})}))})),p.deployRepository=function(){return n.deployRepository(p.repoPath).then((function(e){var t=e.data||{};p.deployTasks=A([{action:"deploy",task_id:t.task_id,sse_url:t.sse_url,args:{log_file:t.log_path}}]),p.deployTasks&&p.deployTasks.length>0?(p.deployInProgress=!0,R()):p.deployInProgress=!1}),(function(e){p.deployInProgress=!1,u.add({type:"danger",message:t.escape(e)+" "+s.maketext("For more information, read our [output,url,_1,documentation,target,_2].","https://go.cpanel.net/GitDeployment","_blank"),closeable:!0,replace:!1,group:"versionControl"})}))},p.backToListView=function(){i.path("/list")},p.redirectToGitWeb=function(e,t){e?o.open(e,t+"GitWeb"):u.add({type:"danger",message:s.maketext("The system could not find the repository’s [asis,Gitweb] [output,acronym,URL,Universal Resource Locator]."),closeable:!0,replace:!1,group:"versionControl"})},p.redirectToFileManager=function(e,t){e?o.open(e,t+"FileManager"):u.add({type:"danger",message:s.maketext("The system could not redirect you to the File Manager interface."),closeable:!0,replace:!1,group:"versionControl"})},p.cloneToClipboard=function(e){try{n.cloneToClipboard(e)&&u.add({type:"success",message:s.maketext("The system successfully copied the “[_1]” clone [output,acronym,URL,Uniform Resource Locator] to the clipboard.",e),closeable:!0,replace:!1,autoClose:1e4,group:"versionControl"})}catch(e){u.add({type:"danger",message:t.escape(e),closeable:!0,replace:!1,group:"versionControl"})}},p.hasAvailableBranches=function(){return Boolean(p.branchList&&0!==p.branchList.length)}}])})),define("app/index",["angular","cjt/core","cjt/modules","ngRoute","uiBootstrap","cjt/services/alertService","cjt/directives/alert","cjt/directives/alertList","cjt/directives/callout","jquery-chosen","angular-chosen"],(function(e){"use strict";return function(){return e.module("cpanel.versionControl",["ngRoute","ui.bootstrap","cjt2.cpanel","cpanel.versionControl.service","cpanel.versionControl.sshKeyVerificationService","cpanel.services.directoryLookup","cpanel.versionControl.sseAPIService","localytics.directives"]),require(["cjt/bootstrap","app/views/listRepositoriesController","app/views/createRepositoriesController","app/views/manageRepositoriesController"],(function(t){var s=e.module("cpanel.versionControl");s.value("PAGE",PAGE),s.config(["$routeProvider",function(e){e.when("/list/",{controller:"ListRepositoriesController",controllerAs:"repositories",templateUrl:"views/listRepositoriesView.ptt"}),e.when("/create/",{controller:"CreateRepositoriesController",controllerAs:"repository",templateUrl:"views/createRepositoriesView.ptt"}),e.when("/manage/:repoPath/:tabname?",{controller:"ManageRepositoriesController",controllerAs:"repository",templateUrl:"views/manageRepositoriesView.ptt"}),e.otherwise({redirectTo:"/list"})}]),t("#content","cpanel.versionControl")}))}}));