text: (this.webpackJsonp=this.webpackJsonp||[]).push([[58],{1019:function(t,e,n){n(42),n(110),t.exports=n(1420)},110:function(t,e,n){"use strict";n.r(e);var a=n(36),r=n(38);document.addEventListener("DOMContentLoaded",function(){var t,e=document.body.dataset.page;["groups:clusters:new","groups:clusters:create_gcp","groups:clusters:create_user"].indexOf(e)>-1&&((t=document.querySelector(".gcp-signup-offer"))&&new a.a(t),Object(r.a)())})},1420:function(t,e,n){"use strict";n.r(e);var a=n(285),r=n(0),i=n.n(r);function o(t,e){for(var n=0;n<e.length;n++){var a=e[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}var s=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.groupDropdown=i()(".js-groups-dropdown"),this.parentInput=i()("#new_parent_group_id"),this.data=this.groupDropdown.data("data"),this.init()}var e,n,a;return e=t,(n=[{key:"init",value:function(){this.buildDropdown()}},{key:"buildDropdown",value:function(){var t=this;this.groupDropdown.glDropdown({selectable:!0,filterable:!0,toggleLabel:function(t){return t.text},search:{fields:["text"]},data:[{id:"",text:"No parent group"},"divider"].concat(this.data),text:function(t){return t.text},clicked:function(e){e.e.preventDefault(),t.assignSelected(e.selectedObj)}})}},{key:"assignSelected",value:function(t){this.parentInput.val(t.id)}}])&&o(e.prototype,n),a&&o(e,a),t}(),u=n(474),c=n(155),l=n(5),d=n.n(l);function p(t,e){for(var n=0;n<e.length;n++){var a=e[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}var f=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.form=e,this.dirtyInputs=[],this.isDisabled=!0,this.init()}var e,n,a;return e=t,a=[{key:"initInput",value:function(e){e.dataset.isDirtySubmitInput=!0,e.dataset.dirtySubmitOriginalValue=t.inputCurrentValue(e)}},{key:"isInputCheckable",value:function(t){return"checkbox"===t.type||"radio"===t.type}},{key:"inputCurrentValue",value:function(e){return t.isInputCheckable(e)?e.checked.toString():e.value}}],(n=[{key:"init",value:function(){this.inputs=this.form.querySelectorAll("input, textarea, select"),this.submits=this.form.querySelectorAll("input[type=submit], button[type=submit]"),this.inputs.forEach(t.initInput),this.toggleSubmission(),this.registerListeners()}},{key:"registerListeners",value:function(){var e=this,n=d.a.throttle(function(t){return e.updateDirtyInput(t)},t.THROTTLE_DURATION);this.form.addEventListener("input",n),this.form.addEventListener("submit",function(t){return e.formSubmit(t)})}},{key:"updateDirtyInput",value:function(t){var e=t.target;e.dataset.isDirtySubmitInput&&(this.updateDirtyInputs(e),this.toggleSubmission())}},{key:"updateDirtyInputs",value:function(e){var n=e.name,a=e.dataset.dirtySubmitOriginalValue!==t.inputCurrentValue(e),r=this.dirtyInputs.indexOf(n),i=-1!==r;a&&!i&&this.dirtyInputs.push(n),!a&&i&&this.dirtyInputs.splice(r,1)}},{key:"toggleSubmission",value:function(){var t=this;this.isDisabled=0===this.dirtyInputs.length,this.submits.forEach(function(e){e.disabled=t.isDisabled})}},{key:"formSubmit",value:function(t){return this.isDisabled&&(t.preventDefault(),t.stopImmediatePropagation()),!this.isDisabled}}])&&p(e.prototype,n),a&&p(e,a),t}();f.THROTTLE_DURATION=500;var h=f;var g=function t(e){var n=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.forms=e,this.dirtySubmits=[],this.forms.forEach(function(t){return n.dirtySubmits.push(new h(t))})};var m=n(425),v=n(276),b=n(475),w=n(28);document.addEventListener("DOMContentLoaded",function(){var t;Object(a.a)(),new s,Object(u.a)(),Object(c.a)(),new((t=document.querySelectorAll(".js-general-settings-form, .js-general-permissions-form"))instanceof NodeList||t instanceof Array?g:h)(t),Object(m.a)(v.a),Object(b.a)(),Object(w.a)()})},155:function(t,e,n){"use strict";n.d(e,"a",function(){return u});var a=n(0),r=n.n(a),i=n(1);function o(t){t.find(".js-settings-toggle:not(.js-settings-toggle-trigger-only)").text(Object(i.a)("Collapse")),t.find(".settings-content").off("scroll.expandSection").scrollTop(0),t.addClass("expanded"),t.hasClass("no-animate")||t.addClass("animating").one("animationend.animateSection",function(){return t.removeClass("animating")})}function s(t){t.removeClass("no-animate"),t.hasClass("expanded")?function(t){t.find(".js-settings-toggle:not(.js-settings-toggle-trigger-only)").text(Object(i.a)("Expand")),t.find(".settings-content").on("scroll.expandSection",function(){return o(t)}),t.removeClass("expanded"),t.hasClass("no-animate")||t.addClass("animating").one("animationend.animateSection",function(){return t.removeClass("animating")})}(t):o(t)}function u(){if(r()(".settings").each(function(t,e){var n=r()(e);n.on("click.toggleSection",".js-settings-toggle",function(){return s(n)}),n.hasClass("expanded")||n.find(".settings-content").on("scroll.expandSection",function(){n.removeClass("no-animate"),o(n)})}),window.location.hash){var t=r()(window.location.hash);t.length&&t.hasClass("settings")&&o(t)}}},28:function(t,e,n){"use strict";var a=n(0),r=n.n(a),i=n(12),o=n(31);function s(t,e){for(var n=0;n<e.length;n++){var a=e[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}var u=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.projectSelectInput=r()(e),this.newItemBtn=r()(".new-project-item-link"),this.resourceType=this.newItemBtn.data("type"),this.resourceLabel=this.newItemBtn.data("label"),this.formattedText=this.deriveTextVariants(),this.groupId=this.projectSelectInput.data("groupId"),this.bindEvents(),this.initLocalStorage()}var e,n,a;return e=t,(n=[{key:"bindEvents",value:function(){var t=this;this.projectSelectInput.siblings(".new-project-item-select-button").on("click",function(e){return t.openDropdown(e)}),this.newItemBtn.on("click",function(e){t.getProjectFromLocalStorage()||(e.preventDefault(),t.openDropdown(e))}),this.projectSelectInput.on("change",function(){return t.selectProject()})}},{key:"initLocalStorage",value:function(){o.a.isLocalStorageAccessSafe()&&(this.localStorageKey=["group",this.groupId,this.formattedText.localStorageItemType,"recent-project"].join("-"),this.setBtnTextFromLocalStorage())}},{key:"openDropdown",value:function(t){r()(t.currentTarget).siblings(".project-item-select").select2("open")}},{key:"selectProject",value:function(){var t=JSON.parse(this.projectSelectInput.val()),e={url:"".concat(t.url,"/").concat(this.projectSelectInput.data("relativePath")),name:t.name};this.setNewItemBtnAttributes(e),this.setProjectInLocalStorage(e)}},{key:"setBtnTextFromLocalStorage",value:function(){var t=this.getProjectFromLocalStorage();this.setNewItemBtnAttributes(t)}},{key:"setNewItemBtnAttributes",value:function(t){t?(this.newItemBtn.attr("href",t.url),this.newItemBtn.text("".concat(this.formattedText.defaultTextPrefix," in ").concat(t.name))):this.newItemBtn.text("Select project to create ".concat(this.formattedText.presetTextSuffix))}},{key:"getProjectFromLocalStorage",value:function(){var t=localStorage.getItem(this.localStorageKey);return JSON.parse(t)}},{key:"setProjectInLocalStorage",value:function(t){var e=JSON.stringify(t);localStorage.setItem(this.localStorageKey,e)}},{key:"deriveTextVariants",value:function(){var t=this.resourceLabel;return{localStorageItemType:"new-".concat(this.resourceType.split("_").join("-").slice(0,-1)),defaultTextPrefix:t,presetTextSuffix:this.resourceType.split("_").join(" ").slice(0,-1)}}}])&&s(e.prototype,n),a&&s(e,a),t}();function c(){r()(".ajax-project-select").each(function(t,e){var n,a,o=r()(e).data("simpleFilter")||!1;return this.groupId=r()(e).data("groupId"),this.includeGroups=r()(e).data("includeGroups"),this.allProjects=r()(e).data("allProjects")||!1,this.orderBy=r()(e).data("orderBy")||"id",this.withIssuesEnabled=r()(e).data("withIssuesEnabled"),this.withMergeRequestsEnabled=r()(e).data("withMergeRequestsEnabled"),this.withShared=void 0===r()(e).data("withShared")||r()(e).data("withShared"),this.includeProjectsInSubgroups=r()(e).data("includeProjectsInSubgroups")||!1,this.allowClear=r()(e).data("allowClear")||!1,n="Search for project",this.includeGroups&&(n+=" or group"),r()(e).select2({placeholder:n,minimumInputLength:0,query:(a=this,function(t){var e,n;return e=function(e){var n;return n={results:e},t.callback(n)},n=a.includeGroups?function(n){var a;return a=function(t){var a;return a=t.concat(n),e(a)},i.a.groups(t.term,{},a)}:e,a.groupId?i.a.groupProjects(a.groupId,t.term,{with_issues_enabled:a.withIssuesEnabled,with_merge_requests_enabled:a.withMergeRequestsEnabled,with_shared:a.withShared,include_subgroups:a.includeProjectsInSubgroups},n):i.a.projects(t.term,{order_by:a.orderBy,with_issues_enabled:a.withIssuesEnabled,with_merge_requests_enabled:a.withMergeRequestsEnabled,membership:!a.allProjects},n)}),id:function(t){return o?t.id:JSON.stringify({name:t.name,url:t.web_url})},text:function(t){return t.name_with_namespace||t.name},initSelection:function(t,e){return i.a.project(t.val()).then(function(t){var n=t.data;return e(n)})},allowClear:this.allowClear,dropdownCssClass:"ajax-project-dropdown"}),o?e:new u(e)})}n.d(e,"a",function(){return c})},285:function(t,e,n){"use strict";n.d(e,"a",function(){return i});var a=n(0),r=n.n(a);function i(){r()(".js-choose-group-avatar-button").on("click",function(){return r()(this).closest("form").find(".js-group-avatar-input").click()}),r()(".js-group-avatar-input").on("change",function(){var t=r()(this).closest("form"),e=r()(this).val().replace(/^.*[\\\/]/,"");return t.find(".js-avatar-filename").text(e)})}},474:function(t,e,n){"use strict";n.d(e,"a",function(){return o});var a=n(0),r=n.n(a),i=n(13);function o(){r()(document).on("click",".js-confirm-danger",function(t){t.preventDefault();var e=r()(t.target);!function(t,e){var n=r()(".js-confirm-danger-input");n.val(""),r()(".js-confirm-text").text(e||""),r()("#modal-confirm-danger").modal("show");var a=r()(".js-confirm-danger-match").text(),o=r()(".js-confirm-danger-submit");o.disable(),n.focus(),r()(".js-confirm-danger-input").off("input").on("input",function(){Object(i.F)(r()(this).val())===a?o.enable():o.disable()}),r()(".js-confirm-danger-submit").off("click").on("click",function(){return t.submit()})}(e.closest("form"),e.data("confirmDangerMessage"))})}},475:function(t,e,n){"use strict";n.d(e,"a",function(){return u});var a=n(0),r=n.n(a),i=n(6),o=n(12),s=n(13);function u(){window.GROUP_SELECT_PER_PAGE=20,r()(".ajax-groups-select").each(function(){var t=r()(this),e=t.data("allAvailable"),n=t.data("skipGroups")||[],a=t.data("parentId"),u=a?o.a.subgroupsPath.replace(":id",a):o.a.groupsPath;t.select2({placeholder:"Search for a group",allowClear:t.hasClass("allowClear"),multiple:t.hasClass("multiselect"),minimumInputLength:0,ajax:{url:o.a.buildUrl(u),dataType:"json",quietMillis:250,transport:function(t){i.a[t.type.toLowerCase()](t.url,{params:t.data}).then(function(e){var n=e.data||[],a=Object(s.y)(e.headers),r=(parseInt(a["X-PAGE"],10)||0)<(parseInt(a["X-TOTAL-PAGES"],10)||0);t.success({results:n,pagination:{more:r}})}).catch(t.error)},data:function(t,n){return{search:t,page:n,per_page:window.GROUP_SELECT_PER_PAGE,all_available:e}},results:function(t,e){if(t.length)return{results:[]};var a=t.length?t:t.results||[],r=!!t.pagination&&t.pagination.more,i=a.filter(function(t){return-1===n.indexOf(t.id)});return{results:i,page:e,more:r}}},initSelection:function(t,e){var n=r()(t).val();if(""!==n)return o.a.group(n,e)},formatResult:function(t){return"<div class='group-result'> <div class='group-name'>".concat(t.full_name,"</div> <div class='group-path'>").concat(t.full_path,"</div> </div>")},formatSelection:function(t){return t.full_name},dropdownCssClass:"ajax-groups-dropdown select2-infinite",escapeMarkup:function(t){return t}}),t.on("select2-loaded",function(){var t=document.querySelector(".select2-infinite .select2-results");t.style.height="".concat(Math.floor(t.scrollHeight),"px")})})}}},[[1019,1,0,2,15]]]);
  //# sourceMappingURL=pages.groups.edit.3757b709.chunk.js.map