"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[3052],{93052:function(e,t,a){a.r(t),a.d(t,{default:function(){return T},show:function(){return H}}),a(63238),a(95289),a(61418);var l=a(90914),i=a(53913),n=a(83094),s=a(56705),r=a(13800),o=a(78695),u=a(44614),d=a(25152),c=(a(78066),a(20716),a(6626),a(1892)),b=a.n(c),p=a(95760),f=a.n(p),v=a(38311),m=a.n(v),h=a(58192),g=a.n(h),y=a(38060),S=a.n(y),L=a(54865),Z=a.n(L),k=a(13005),q={};q.styleTagTransform=Z(),q.setAttributes=g(),q.insert=m().bind(null,"head"),q.domAPI=f(),q.insertStyleElement=S(),b()(k.Z,q),k.Z&&k.Z.locals&&k.Z.locals;var w,D,C,F=!1;function P(e){s.ZP.hide();var t=e.target.error;t.code!==t.ABORT_ERR&&(0,d.Z)(u.ZP.translate("MessageFileReadError"))}function x(e){return e&&[".sub",".srt",".vtt",".ass",".ssa"].some((function(t){return e.name.endsWith(t)}))}function E(e){var t=C;if(!x(t))return(0,d.Z)(u.ZP.translate("MessageSubtitleFileTypeAllowed")),void e.preventDefault();s.ZP.show();var a=n.ZP.parentWithClass(this,"dialog"),r=a.querySelector("#selectLanguage").value,o=a.querySelector("#chkIsForced").checked;i.Z.getApiClient(D).uploadItemSubtitle(w,r,o,t).then((function(){a.querySelector("#uploadSubtitle").value="",s.ZP.hide(),F=!0,l.default.close(a)})),e.preventDefault()}function H(e){return new Promise((function(t){F=!1,function(e,t){w=(e=e||{}).itemId,D=e.serverId;var a={removeOnClose:!0,scrollY:!1};o.Z.tv?a.size="fullscreen":a.size="small";var i,n=l.default.createDialog(a);n.classList.add("formDialog"),n.classList.add("subtitleUploaderDialog"),n.innerHTML=u.ZP.translateHtml('<div class="formDialogHeader"> <button is="paper-icon-button-light" class="btnCancel autoSize" tabindex="-1" title="${ButtonBack}"><span class="material-icons arrow_back" aria-hidden="true"></span></button> <h3 class="formDialogHeaderTitle"> ${HeaderUploadSubtitle} </h3> </div> <div class="formDialogContent"> <div class="dialogContentInner"> <form class="uploadSubtitleForm"> <div class="flex align-items-center" style="margin:1.5em 0"> <h2 style="margin:0">${HeaderAddUpdateSubtitle}</h2> <button is="emby-button" type="button" class="raised raised-mini btnBrowse" style="margin-left:1.5em"> <span class="material-icons folder" aria-hidden="true"></span> <span>${Browse}</span> </button> </div> <div> <div class="subtitleEditor-dropZone fieldDescription"> <div id="labelDropSubtitle">${LabelDropSubtitleHere}</div> <output id="subtitleOutput" class="flex align-items-center justify-content-center" style="position:absolute;top:0;left:0;right:0;bottom:0;width:100%"></output> <input type="file" accept=".sub,.srt,.vtt,.ass,.ssa" id="uploadSubtitle" name="uploadSubtitle" style="position:absolute;top:0;left:0;right:0;bottom:0;width:100%;opacity:0"/> </div> <div id="fldUpload" class="hide"> <br/> <div class="checkboxContainer"> <label> <input type="checkbox" is="emby-checkbox" id="chkIsForced"/> <span>${LabelIsForced}</span> </label> </div> <div class="selectContainer flex-grow"> <select is="emby-select" id="selectLanguage" required="required" label="${LabelLanguage}" autofocus></select> </div> <button is="emby-button" type="submit" class="raised button-submit block"> <span>${Upload}</span> </button> </div> </div> </form> </div> </div> ',"core"),o.Z.tv&&r.Z.centerFocus.on(n,!1),n.addEventListener("close",(function(){o.Z.tv&&r.Z.centerFocus.off(n,!1),s.ZP.hide(),t(F)})),l.default.open(n),(i=n).querySelector(".uploadSubtitleForm").addEventListener("submit",E),i.querySelector("#uploadSubtitle").addEventListener("change",(function(){!function(e,t){var a=t[0];if(!x(a))return e.querySelector("#subtitleOutput").innerHTML="",e.querySelector("#fldUpload").classList.add("hide"),e.querySelector("#labelDropSubtitle").classList.remove("hide"),void(C=null);C=a;var l,i=new FileReader;i.onerror=P,i.onloadstart=function(){e.querySelector("#fldUpload").classList.add("hide")},i.onabort=function(){s.ZP.hide(),console.debug("File read cancelled")},i.onload=(l=a,function(){var t='<a><span class="material-icons subtitles" aria-hidden="true" style="transform: translateY(25%);"></span><span>'+escape(l.name)+"</span><a/>";e.querySelector("#subtitleOutput").innerHTML=t,e.querySelector("#fldUpload").classList.remove("hide"),e.querySelector("#labelDropSubtitle").classList.add("hide")}),i.readAsDataURL(a)}(i,this.files)})),i.querySelector(".btnBrowse").addEventListener("click",(function(){i.querySelector("#uploadSubtitle").click()}));var d=n.querySelector("#selectLanguage");e.languages&&(d.innerHTML=e.languages.list||null,d.value=e.languages.value||null),n.querySelector(".btnCancel").addEventListener("click",(function(){l.default.close(n)}))}(e,t)}))}var T={show:H}},13005:function(e,t,a){var l=a(54933),i=a.n(l),n=a(93476),s=a.n(n)()(i());s.push([e.id,".subtitleEditor-dropZone{-webkit-align-items:center;align-items:center;border:.2em dashed;border-radius:.25em;display:-webkit-flex;display:flex;height:12em;-webkit-justify-content:center;justify-content:center;position:relative;text-align:center}",""]),t.Z=s}}]);