(self.webpackChunk=self.webpackChunk||[]).push([[2414],{11225:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return d}}),n(23938),n(98010);var i=n(6594),s=n(17025),o=n(53754),a=n(1115),r=(n(78066),n(65219),n(50447),n(16589),n(17734),[]);function l(e){i.ZP.show(),ApiClient.getJSON(ApiClient.getUrl("Repositories")).then((function(t){r=t,function(e){var t="";t+='<div class="paperList">';for(var n=0;n<e.repositories.length;n++)t+=u(e.repositories[n]);t+="</div>",e.repositories.length?e.noneElement.classList.add("hide"):e.noneElement.classList.remove("hide"),e.listElement.innerHTML=t,i.ZP.hide()}({listElement:e.querySelector("#repositories"),noneElement:e.querySelector("#none"),repositories:r})})).catch((function(t){console.error("error loading repositories"),e.querySelector("#none").classList.remove("hide"),i.ZP.hide()}))}function c(e){i.ZP.show(),ApiClient.ajax({type:"POST",url:ApiClient.getUrl("Repositories"),data:JSON.stringify(r),contentType:"application/json"}).then((function(t){l(e)})).catch((function(e){console.error("error saving repositories"),i.ZP.hide()}))}function u(e){var t="";return t+='<div class="listItem listItem-border">',t+='<a is="emby-linkbutton" style="margin:0;padding:0" class="clearLink listItemIconContainer" href="'.concat(e.Url,'">'),t+='<span class="material-icons listItemIcon open_in_new"></span>',t+="</a>",t+='<div class="listItemBody two-line">',t+='<h3 class="listItemBodyText">'.concat(e.Name,"</h3>"),t+='<div class="listItemBodyText secondary">'.concat(e.Url,"</div>"),t+="</div>",(t+='<button type="button" is="paper-icon-button-light" id="'.concat(e.Url,'" class="btnDelete" title="').concat(o.ZP.translate("Delete"),'"><span class="material-icons delete"></span></button>'))+"</div>"}function p(){return[{href:"#!/installedplugins.html",name:o.ZP.translate("TabMyPlugins")},{href:"#!/availableplugins.html",name:o.ZP.translate("TabCatalog")},{href:"#!/repositories.html",name:o.ZP.translate("TabRepositories")}]}function d(e,t){e.addEventListener("viewshow",(function(){s.Z.setTabs("plugins",2,p),l(this);var t=this;$("#repositories",e).on("click",".btnDelete",(function(){var e=this;r=r.filter((function(t){return t.Url!==e.id})),c(t)}))})),e.querySelector(".btnNewRepository").addEventListener("click",(function(){var t=a.default.createDialog({scrollY:!1,size:"large",modal:!1,removeOnClose:!0}),n="";n+='<div class="formDialogHeader">',n+='<button type="button" is="paper-icon-button-light" class="btnCancel autoSize" tabindex="-1"><span class="material-icons arrow_back"></span></button>',n+='<h3 class="formDialogHeaderTitle">'.concat(o.ZP.translate("HeaderNewRepository"),"</h3>"),n+="</div>",n+='<form class="newPluginForm" style="margin:4em">',n+='<div class="inputContainer">',n+='<input is="emby-input" id="txtRepositoryName" label="'.concat(o.ZP.translate("LabelRepositoryName"),'" type="text" required />'),n+='<div class="fieldDescription">'.concat(o.ZP.translate("LabelRepositoryNameHelp"),"</div>"),n+="</div>",n+='<div class="inputContainer">',n+='<input is="emby-input" id="txtRepositoryUrl" label="'.concat(o.ZP.translate("LabelRepositoryUrl"),'" type="url" required />'),n+='<div class="fieldDescription">'.concat(o.ZP.translate("LabelRepositoryUrlHelp"),"</div>"),n+="</div>",n+='<button is="emby-button" type="submit" class="raised button-submit block"><span>'.concat(o.ZP.translate("Save"),"</span></button>"),n+="</div>",n+="</form>",t.innerHTML=n,t.querySelector(".btnCancel").addEventListener("click",(function(){a.default.close(t)})),t.querySelector(".newPluginForm").addEventListener("submit",(function(n){return n.preventDefault(),r.push({Name:t.querySelector("#txtRepositoryName").value,Url:t.querySelector("#txtRepositoryUrl").value,Enabled:!0}),c(e),a.default.close(t),!1})),a.default.open(t)}))}}}]);