(self.webpackChunk=self.webpackChunk||[]).push([[6968],{44754:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return u}}),t(25901),t(92189),t(98010),t(5769),t(69217),t(63238),t(61418),t(17460),t(14078),t(71848);var i=t(6594),r=t(53754),s=(t(78066),t(76543)),a=t(61642),l=t(56346);function o(e){(0,a.Z)(e)}function u(e,n){$(".addPluginForm",e).on("submit",(function(){i.ZP.show();var e=$(this).parents("#addPluginPage")[0],t=n.name,a=n.guid;return ApiClient.getInstalledPlugins().then((function(n){var u=n.filter((function(e){return e.Name==t}))[0],v=$("#selectVersion",e).val();u&&u.Version===v?(i.ZP.hide(),s.ZP.alert({message:r.ZP.translate("MessageAlreadyInstalled"),title:r.ZP.translate("HeaderPluginInstallation")})):function(e,n,t,s){var a=$("#developer",e).html().toLowerCase(),u=function(){i.ZP.show(),e.querySelector("#btnInstall").disabled=!0,ApiClient.installPlugin(n,t,s).then((function(){i.ZP.hide(),o(r.ZP.translate("MessagePluginInstalled"))})).catch((function(){o(r.ZP.translate("MessagePluginInstallError"))}))};if("jellyfin"!==a){i.ZP.hide();var v=r.ZP.translate("MessagePluginInstallDisclaimer");v+="<br/>",v+="<br/>",v+=r.ZP.translate("PleaseConfirmPluginInstallation"),(0,l.Z)(v,r.ZP.translate("HeaderConfirmPluginInstallation")).then((function(){u()})).catch((function(){console.debug("plugin not installed")}))}else u()}(e,t,a,v)})).catch((function(){o(r.ZP.translate("MessageGetInstalledPluginsError"))})),!1})),e.addEventListener("viewshow",(function(){var e=this;i.ZP.show();var t=n.name,s=n.guid,a=ApiClient.getPackageInfo(t,s),l=ApiClient.getInstalledPlugins();Promise.all([a,l]).then((function(n){!function(e,n,t){var s=n.filter((function(n){return n.Name==e.name}))[0];if(function(e,n,t){var i="";e.versions.sort((function(e,n){return n.timestamp<e.timestamp?-1:1}));for(var s=0;s<e.versions.length;s++){var a=e.versions[s];i+='<option value="'+a.version+'">'+r.ZP.translate("PluginFromRepo",a.version,a.repositoryName)+"</option>"}var l=$("#selectVersion",n).html(i);t||$("#pCurrentVersion",n).hide().html("");var o=e.versions[0];o&&l.val(o.version)}(e,t,s),function(e,n){for(var t="",i=Math.min(e.versions.length,10),r=0;r<i;r++){var s=e.versions[r];t+='<h2 style="margin:.5em 0;">'+s.version+"</h2>",t+='<div style="margin-bottom:1.5em;">'+s.changelog+"</div>"}$("#revisionHistory",n).html(t)}(e,t),$(".pluginName",t).html(e.name),$("#btnInstallDiv",t).removeClass("hide"),$("#pSelectVersion",t).removeClass("hide"),e.overview?$("#overview",t).show().html(e.overview):$("#overview",t).hide(),$("#description",t).html(e.description),$("#developer",t).html(e.owner),s){var a=r.ZP.translate("MessageYouHaveVersionInstalled","<strong>"+s.Version+"</strong>");$("#pCurrentVersion",t).show().html(a)}else $("#pCurrentVersion",t).hide().html("");i.ZP.hide()}(n[0],n[1],e)}))}))}}}]);