LibDrive / build /static /js /main.4c186c3c.chunk.js
thejagstudio's picture
Upload 101 files
dcb132a verified
raw
history blame
110 kB
(this["webpackJsonplibdrive-web"]=this["webpackJsonplibdrive-web"]||[]).push([[0],{114:function(e){e.exports=JSON.parse('{"a":"1.4.7"}')},186:function(e,t,n){},188:function(e,t,n){},189:function(e,t,n){},190:function(e,t,n){},192:function(e,t,n){},193:function(e,t,n){},194:function(e,t,n){"use strict";n.r(t);var a=n(8),r=n(0),o=n.n(r),i=n(20),s=n.n(i),c=n(15),l=n(27),d=n(241),u=n(253),h=n(9),p=n(10),m=n(6),j=n(11),b=n(12),g=n(228),f=n(141),O=n(232),v=n(233),x=n(115),w=n.n(x),y=(n(39),n(1)),S=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var a;return Object(h.a)(this,n),(a=t.call(this,e)).state={menuAnchor:!1},a.handleClick=a.handleClick.bind(Object(m.a)(a)),a.handleClose=a.handleClose.bind(Object(m.a)(a)),a}return Object(p.a)(n,[{key:"handleClick",value:function(e){this.setState({menuAnchor:e.currentTarget})}},{key:"handleClose",value:function(e){this.setState({menuAnchor:!1})}},{key:"render",value:function(){var e=this.props,t=e.accounts,n=e.ui_config,a=Object(y.jsx)(w.a,{});return t&&t.pic&&(t.pic.includes("http")||t.pic.includes("www"))&&(a=Object(y.jsx)("img",{src:t.pic,width:"32px",alt:"profile-pic"})),Object(y.jsxs)("div",{className:"AccountMenu",children:[Object(y.jsx)(g.a,{"aria-label":"more","aria-controls":"account-menu","aria-haspopup":"true",onClick:this.handleClick,children:a}),Object(y.jsxs)(f.a,{id:"account-menu",anchorEl:this.state.menuAnchor,anchorOrigin:{vertical:"top",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},keepMounted:!0,open:Boolean(this.state.menuAnchor),onClose:this.handleClose,children:[(n.custom_button||{}).text?Object(y.jsxs)("div",{children:[Object(y.jsx)(O.a,{}),Object(y.jsx)("a",{href:n.custom_button.url,target:"__blank",className:"no_decoration_link",children:Object(y.jsx)(v.a,{onClick:this.handleClose,children:n.custom_button.text})})]}):null,Object(y.jsx)(c.b,{to:"/settings",className:"no_decoration_link",children:Object(y.jsx)(v.a,{onClick:this.handleClose,children:"Settings"})}),Object(y.jsx)(c.b,{to:"/logout",className:"no_decoration_link",children:Object(y.jsx)(v.a,{onClick:this.handleClose,children:"Logout"})})]})]})}}]),n}(r.Component),C=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var a;return Object(h.a)(this,n),(a=t.call(this,e)).state={auth:window.sessionStorage.getItem("auth")||window.localStorage.getItem("auth"),server:window.sessionStorage.getItem("server")||window.localStorage.getItem("server")},a}return Object(p.a)(n,[{key:"componentDidMount",value:function(){window.localStorage.getItem("_VERSION")||window.localStorage.setItem("_VERSION",Pt.a),window.localStorage.getItem("_VERSION")!==Pt.a&&("caches"in window&&(caches.keys().then((function(e){e.forEach((function(e){caches.delete(e)}))})),window.location.reload(!0)),window.localStorage.setItem("_VERSION",Pt.a))}},{key:"render",value:function(){var e=this.state,t=e.auth,n=e.server;return t&&n?Object(y.jsx)(l.a,{to:"/browse"},we()):Object(y.jsx)(l.a,{to:"/login"},we())}}]),n}(r.Component),k=n(234),_=n(13),I=n(19),N=n.n(I),B=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var a;return Object(h.a)(this,n),(a=t.call(this,e)).state={auth:window.sessionStorage.getItem("auth")||window.localStorage.getItem("auth")||"0",isLoaded:!1,metadata:{},server:window.sessionStorage.getItem("server")||window.localStorage.getItem("server")||window.location.origin,starred_lists:JSON.parse(window.localStorage.getItem("starred_lists")||"[]"),ui_config:JSON.parse(window.localStorage.getItem("ui_config")||window.sessionStorage.getItem("ui_config")||"{}")},a}return Object(p.a)(n,[{key:"componentDidMount",value:function(){var e=this,t=this.state,n=t.auth,a=t.server,r=t.starred_lists,o=t.ui_config;n&&a||this.props.history.push("/logout");var i="".concat(a,"/api/v1/metadata"),s="?a=".concat(n,"&r=0:").concat(o.range||"16","&s=popularity-des&rmdup=true");N.a.get(i+s).then((function(t){for(var n=t.data.content,a=r.length-1;a>=0;a--)r[a].categoryInfo.pinned&&n.unshift(r[a]);e.setState({isLoaded:!0,metadata:n})})).catch((function(t){if(console.error(t),t.response){var n=t.response.data;401===n.code?_.a.fire({title:"Error!",text:n.message,icon:"error",confirmButtonText:"Login",confirmButtonColor:Dt.palette.success.main}).then((function(t){t.isConfirmed&&e.props.history.push("/logout")})):a?_.a.fire({title:"Error!",text:n.message,icon:"error",confirmButtonText:"Logout",confirmButtonColor:Dt.palette.success.main,cancelButtonText:"Retry",cancelButtonColor:Dt.palette.error.main,showCancelButton:!0}).then((function(t){t.isConfirmed?e.props.history.push("/logout"):t.isDismissed&&location.reload()})):e.props.history.push("/logout")}else t.request&&(a?_.a.fire({title:"Error!",text:"libDrive could not communicate with the server! Is '".concat(a,"' the correct address?"),icon:"error",confirmButtonText:"Logout",confirmButtonColor:Dt.palette.success.main,cancelButtonText:"Retry",cancelButtonColor:Dt.palette.error.main,showCancelButton:!0}).then((function(t){t.isConfirmed?e.props.history.push("/logout"):t.isDismissed&&location.reload()})):e.props.history.push("/logout"))}))}},{key:"render",value:function(){var e=this.state,t=e.isLoaded,n=e.metadata;return t?Object(y.jsxs)("div",{className:"Browse",children:[Object(y.jsx)(Ue,Object(a.a)({},this.props)),Object(y.jsx)(ue,{metadata:n}),Object(y.jsx)(ve,{})]}):Object(y.jsx)("div",{className:"Loading",children:Object(y.jsx)(k.a,{})})}}]),n}(r.Component),T=n(235),D=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var a;return Object(h.a)(this,n),(a=t.call(this,e)).state={menuAnchor:!1},a.handleClick=a.handleClick.bind(Object(m.a)(a)),a.handleClose=a.handleClose.bind(Object(m.a)(a)),a}return Object(p.a)(n,[{key:"handleClick",value:function(e){this.setState({menuAnchor:e.currentTarget})}},{key:"handleClose",value:function(e){this.setState({menuAnchor:!1})}},{key:"render",value:function(){var e=this,t=this.props.categories,n=JSON.parse(window.localStorage.getItem("starred_lists")||"[]");return Object(y.jsxs)("div",{className:"Browse",style:{marginRight:"15px"},children:[Object(y.jsx)(T.a,{"aria-controls":"browse-menu","aria-haspopup":"true",onClick:this.handleClick,children:"Browse"}),Object(y.jsxs)(f.a,{id:"browse-menu",anchorEl:this.state.menuAnchor,keepMounted:!0,anchorOrigin:{vertical:"top",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},open:Boolean(this.state.menuAnchor),onClose:this.handleClose,children:[Object(y.jsx)(c.b,{to:"/",className:"no_decoration_link",children:Object(y.jsx)(v.a,{onClick:this.handleClose,children:"Home Page"})}),Object(y.jsx)(O.a,{}),t.length?t.map((function(t){return Object(y.jsx)(c.b,{to:"/browse/".concat(t.name),className:"no_decoration_link",children:Object(y.jsx)(v.a,{onClick:e.handleClose,children:t.name})},we())})):null,n.length?Object(y.jsxs)("div",{children:[Object(y.jsx)(O.a,{}),Object(y.jsx)(c.b,{to:"/starred",className:"no_decoration_link",children:Object(y.jsx)(v.a,{onClick:this.handleClose,children:"Starred Lists"})})]}):null]})]})}}]),n}(r.Component),E=n(121),L=n.n(E),R=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var r;return Object(h.a)(this,n),(r=t.call(this,e)).state=Object(a.a)({menuAnchor:!1},e.state),r.handleClick=r.handleClick.bind(Object(m.a)(r)),r.handleClose=r.handleClose.bind(Object(m.a)(r)),r.handleSeason=r.handleSeason.bind(Object(m.a)(r)),r}return Object(p.a)(n,[{key:"handleClick",value:function(e){this.setState({menuAnchor:e.currentTarget})}},{key:"handleClose",value:function(){this.setState({menuAnchor:!1})}},{key:"handleSeason",value:function(e){e.preventDefault();for(var t=this.state,n=t.auth,a=t.metadata,r=t.server,o=0;o<a.children.length;o++){var i="".concat(r,"/api/v1/redirectdownload/").concat(encodeURIComponent(a.children[o].name)),s="?a=".concat(n,"&id=").concat(a.children[o].id);window.open(i+s)}this.setState({menuAnchor:e.currentTarget})}},{key:"render",value:function(){var e=this,t=this.state,n=t.menuAnchor,a=t.videos;return Object(y.jsxs)("div",{className:"info__button",children:[Object(y.jsx)(T.a,{variant:"outlined",color:"primary",style:{width:"135px"},"aria-controls":"download-menu","aria-haspopup":"true",onClick:this.handleClick,startIcon:Object(y.jsx)(L.a,{}),children:"Download"}),Object(y.jsxs)(f.a,{id:"download-menu",anchorEl:n,keepMounted:!0,anchorOrigin:{vertical:"top",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},open:Boolean(n),onClose:this.handleClose,children:[a.length?a.map((function(t,n){return Object(y.jsxs)("div",{children:[Object(y.jsx)("a",{href:encodeURI(t.url),className:"no_decoration_link",target:"_blank",children:Object(y.jsx)(v.a,{onClick:e.handleClose,children:t.name})}),Object(y.jsx)("div",{children:0==n&&a.length>1?Object(y.jsx)(O.a,{}):null})]},we())})):null,this.props.tv?Object(y.jsxs)("div",{children:[Object(y.jsx)(O.a,{}),Object(y.jsx)(v.a,{onClick:this.handleSeason,children:"Entire Season"})]}):null]})]})}}]),n}(r.Component),A=n(258),M=n(65),P=n(257),J=n(236),U=n(126),q=n.n(U),W=n(125),F=n.n(W),K=n(124),V=n.n(K),z=n(123),H=n.n(z),G=n(129),Y=n.n(G),X=n(130),Q=n.n(X),$=n(128),Z=n.n($),ee=n(61),te=n.n(ee),ne=n(93),ae=n(140),re=n(231),oe=n(196),ie=n(239),se=n(237),ce=n(238),le=n(127),de=n.n(le),ue=(n(186),function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var a;return Object(h.a)(this,n),(a=t.call(this,e)).state={currentEditing:null,hide:e.hide||!1,isAndroid:/(android)/i.test(navigator.userAgent||navigator.vendor||window.opera),isIOS:/iPad|iPhone|iPod/.test(navigator.userAgent||navigator.vendor||window.opera)&&!window.MSStream,isEditOpen:!1,metadata:a.props.metadata,server:window.sessionStorage.getItem("server")||window.localStorage.getItem("server")||window.location.origin,star:e.star},a.handleStar=a.handleStar.bind(Object(m.a)(a)),a.handleStarReset=a.handleStarReset.bind(Object(m.a)(a)),a.handleStarImport=a.handleStarImport.bind(Object(m.a)(a)),a.handleStarExport=a.handleStarExport.bind(Object(m.a)(a)),a.handlePin=a.handlePin.bind(Object(m.a)(a)),a.handleEditOpen=a.handleEditOpen.bind(Object(m.a)(a)),a.handleEditClose=a.handleEditClose.bind(Object(m.a)(a)),a.handleEditDrop=a.handleEditDrop.bind(Object(m.a)(a)),a.handleEditSave=a.handleEditSave.bind(Object(m.a)(a)),a.handleScroll=a.handleScroll.bind(Object(m.a)(a)),a}return Object(p.a)(n,[{key:"handleStar",value:function(e,t){var n=this.state.metadata,a=JSON.parse(window.localStorage.getItem("starred_lists")||"[]");try{var r=a.findIndex((function(e){return e.id==t.id})),o=a[r].children.findIndex((function(t){return t.id==e.id})),i=n.findIndex((function(e){return e.id==t.id})),s=n[i].children.findIndex((function(t){return t.id==e.id}));a[r].children.splice(o,1),n[i].children.splice(s,1),window.localStorage.setItem("starred_lists",JSON.stringify(a)),this.setState({metadata:n})}catch(c){_.a.fire({title:"Error!",text:"Your starred list seems to be corrupted!",icon:"error",confirmButtonText:"Reset",confirmButtonColor:Dt.palette.success.main,cancelButtonText:"Ignore",cancelButtonColor:Dt.palette.error.main,showCancelButton:!0}).then((function(e){e.isConfirmed&&(window.localStorage.setItem("starred_lists","[]"),location.reload())}))}}},{key:"handleStarReset",value:function(e){var t=this,n=this.state.metadata;_.a.fire({title:"Warning!",text:"Are you sure you want to delete this starred list?",icon:"warning",confirmButtonText:"Delete",confirmButtonColor:Dt.palette.success.main,cancelButtonText:"No",cancelButtonColor:Dt.palette.error.main,showCancelButton:!0}).then((function(a){if(a.isConfirmed){var r=JSON.parse(window.localStorage.getItem("starred_lists")||"[]");1==r.length?(r.shift(),n.shift()):(r.splice(e,1),n.splice(e,1)),window.localStorage.setItem("starred_lists",JSON.stringify(r)),t.setState({metadata:n})}}))}},{key:"handleStarImport",value:function(e){var t=this;if(e.target.files.length){var n=e.target.files[0],a=new FileReader;a.onload=function(n){var a=JSON.parse(window.localStorage.getItem("starred_lists")||"[]"),r=JSON.parse(n.target.result),o=parseInt(e.target.id.replace("file-input-",""));a[o].children=r.children,window.localStorage.setItem("starred_lists",JSON.stringify(a));var i=t.state.metadata;i.length&&"Starred"==i[o].type&&(i[o].children=r.children,t.setState({metadata:i}))},a.readAsText(n)}}},{key:"handleStarExport",value:function(e){var t=JSON.parse(window.localStorage.getItem("starred_lists")||"[]")[e],n=new Blob([JSON.stringify(t)],{type:"application/json"}),a=document.createElement("a");a.href=window.URL.createObjectURL(n),a.download="libdrive-starred-".concat(t.name,"-").concat(+new Date,".json"),a.click()}},{key:"handlePin",value:function(e,t){var n=JSON.parse(window.localStorage.getItem("starred_lists")||"[]");t?(n[e].categoryInfo.pinned=!0,window.localStorage.setItem("starred_lists",JSON.stringify(n)),this.setState({metadata:n})):(n[e].categoryInfo.pinned=!1,window.localStorage.setItem("starred_lists",JSON.stringify(n)),this.setState({metadata:n}))}},{key:"handleEditOpen",value:function(e){this.setState({currentEditing:e,isEditOpen:!0})}},{key:"handleEditClose",value:function(){var e=JSON.parse(window.localStorage.getItem("starred_lists")||"[]");this.setState({currentEditing:null,isEditOpen:!1,metadata:e})}},{key:"handleEditDrop",value:function(e){var t=e.removedIndex,n=e.addedIndex,a=this.state,r=a.metadata,o=a.currentEditing,i=r[o].children;r[o].children=Object(ae.a)(i,t,n),this.setState({metadata:r})}},{key:"handleEditSave",value:function(){var e=this.state.metadata;window.localStorage.setItem("starred_lists",JSON.stringify(e)),this.setState({currentEditing:null,isEditOpen:!1})}},{key:"handleScroll",value:function(e,t){document.getElementsByClassName("carousel__items")[e].scrollLeft+=t}},{key:"render",value:function(){var e=this,t=this.state,n=t.currentEditing,a=t.hide,r=t.isAndroid,o=t.isIOS,i=t.isEditOpen,s=t.metadata,l=t.server;return t.star?Object(y.jsxs)("div",{className:"Carousel",style:{paddingTop:"3%"},children:[s.length?s.map((function(t,n){return t.children.length||!a?Object(y.jsxs)("div",{className:"carousel__category",style:{margin:"0 auto 0 auto"},children:[Object(y.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:Object(y.jsxs)("div",{style:{width:"100%"},children:[Object(y.jsxs)("div",{style:{float:"left",display:"flex",justifyContent:"center",alignItems:"center"},children:[Object(y.jsx)(c.b,{id:"".concat(t.categoryInfo.name),to:"#".concat(t.categoryInfo.name),className:"carousel__category__title no_decoration_link",children:t.categoryInfo.name}),Object(y.jsx)(A.a,{title:"Edit",placement:"top",children:Object(y.jsx)(g.a,{color:"primary",onClick:function(){return e.handleEditOpen(n)},style:{marginLeft:"20px"},children:Object(y.jsx)(H.a,{})})}),Object(y.jsx)(A.a,{title:"Delete",placement:"top",children:Object(y.jsx)(g.a,{color:"primary",onClick:function(){return e.handleStarReset(n)},children:Object(y.jsx)(V.a,{})})})]}),Object(y.jsxs)("div",{style:{float:"right",display:"flex",justifyContent:"center",alignItems:"center"},children:[Object(y.jsx)("input",{id:"file-input-".concat(n),hidden:!0,onChange:e.handleStarImport,type:"file"}),Object(y.jsx)("label",{htmlFor:"file-input-".concat(n),children:Object(y.jsx)(A.a,{title:"Upload",placement:"top",children:Object(y.jsx)(g.a,{color:"primary",children:Object(y.jsx)(F.a,{})})})}),Object(y.jsx)(A.a,{title:"Export",placement:"top",children:Object(y.jsx)(g.a,{color:"primary",onClick:function(){return e.handleStarExport(n)},children:Object(y.jsx)(q.a,{})})}),t.categoryInfo.pinned?Object(y.jsx)(A.a,{title:"Unpin",placement:"top",children:Object(y.jsx)(g.a,{color:"primary",onClick:function(){return e.handlePin(n,!1)},children:Object(y.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",enableBackground:"new 0 0 24 24",height:"24px",viewBox:"0 0 24 24",width:"24px",fill:Dt.palette.primary.main,children:[Object(y.jsx)("g",{children:Object(y.jsx)("rect",{fill:"none",height:"24",width:"24"})}),Object(y.jsx)("g",{children:Object(y.jsx)("path",{d:"M16,9V4l1,0c0.55,0,1-0.45,1-1v0c0-0.55-0.45-1-1-1H7C6.45,2,6,2.45,6,3v0 c0,0.55,0.45,1,1,1l1,0v5c0,1.66-1.34,3-3,3h0v2h5.97v7l1,1l1-1v-7H19v-2h0C17.34,12,16,10.66,16,9z",fillRule:"evenodd"})})]})})}):Object(y.jsx)(A.a,{title:"Pin",placement:"top",children:Object(y.jsx)(g.a,{color:"primary",onClick:function(){return e.handlePin(n,!0)},children:Object(y.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",enableBackground:"new 0 0 24 24",height:"24px",viewBox:"0 0 24 24",width:"24px",fill:Dt.palette.primary.main,children:[Object(y.jsx)("g",{children:Object(y.jsx)("rect",{fill:"none",height:"24",width:"24"})}),Object(y.jsx)("g",{children:Object(y.jsx)("path",{d:"M14,4v5c0,1.12,0.37,2.16,1,3H9c0.65-0.86,1-1.9,1-3V4H14 M17,2H7C6.45,2,6,2.45,6,3c0,0.55,0.45,1,1,1c0,0,0,0,0,0l1,0v5 c0,1.66-1.34,3-3,3v2h5.97v7l1,1l1-1v-7H19v-2c0,0,0,0,0,0c-1.66,0-3-1.34-3-3V4l1,0c0,0,0,0,0,0c0.55,0,1-0.45,1-1 C18,2.45,17.55,2,17,2L17,2z"})})]})})})]})]})}),Object(y.jsx)("div",{className:"carousel__items",children:t.children.length?t.children.map((function(n){return Object(y.jsx)("div",{children:Object(y.jsxs)("figure",{className:"carousel__item__figure",children:[Object(y.jsx)(c.b,{to:"/view/".concat(n.id),children:Object(y.jsx)("img",{src:n.posterPath||"".concat(l,"/api/v1/image/poster?text=").concat(n.title,"&extention=jpeg"),className:"carousel__item__poster",alt:n.title},we())},we()),Object(y.jsx)(M.a,{className:"carousel__item__title",children:n.title}),Object(y.jsx)("div",{style:{display:"flex",justifyContent:"center"},children:Object(y.jsx)(g.a,{style:{padding:"2px"},onClick:function(){return e.handleStar(n,t)},children:Object(y.jsx)(te.a,{})})})]},we())})})):null})]},we()):null})):null,i?Object(y.jsxs)(P.a,{onClose:this.handleEditClose,"aria-labelledby":"simple-dialog-title",fullWidth:!0,maxWidth:"md",open:i||!1,children:[Object(y.jsx)(J.a,{id:"simple-dialog-title",children:s[n].categoryInfo.name}),Object(y.jsx)(re.a,{children:Object(y.jsxs)(ne.Container,{dragHandleSelector:".drag-handle",lockAxis:"y",onDrop:this.handleEditDrop,children:[s[n].children.map((function(e){var t=e.id,n=e.title;return Object(y.jsx)(ne.Draggable,{children:Object(y.jsxs)(oe.a,{divider:!0,children:[Object(y.jsx)(se.a,{primary:n}),Object(y.jsx)(ce.a,{children:Object(y.jsx)(ie.a,{className:"drag-handle",children:Object(y.jsx)(de.a,{})})})]})},t)})),Object(y.jsx)(T.a,{variant:"contained",color:"primary",style:{width:"135px",margin:"30px 0 15px 15px"},onClick:this.handleEditSave,startIcon:Object(y.jsx)(Z.a,{}),children:"Save"})]})})]}):null]}):Object(y.jsx)("div",{className:"Carousel",children:s.length?s.map((function(t,n){return t.children.length||!a?Object(y.jsxs)("div",{className:"carousel__category",children:[Object(y.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:[Object(y.jsx)("div",{style:{display:"flex",flexShrink:"0"},children:Object(y.jsx)(c.b,{id:"".concat(t.categoryInfo.name),to:"Starred"==t.categoryInfo.type?"/starred#".concat(t.categoryInfo.name):"/browse/".concat(t.categoryInfo.name),className:"carousel__category__title no_decoration_link",children:t.categoryInfo.name},we())}),r||o?null:Object(y.jsxs)("div",{style:{width:"100%",display:"flex",justifyContent:"space-between"},children:[Object(y.jsx)(g.a,{onClick:function(){return e.handleScroll(n,-500)},children:Object(y.jsx)(Y.a,{style:{fontSize:"36px",fill:Dt.palette.primary.main}})}),Object(y.jsx)(g.a,{onClick:function(){return e.handleScroll(n,500)},children:Object(y.jsx)(Q.a,{style:{fontSize:"36px",fill:Dt.palette.primary.main}})})]})]}),Object(y.jsx)("div",{className:"carousel__items",children:t.children.length?t.children.map((function(e){return Object(y.jsxs)("figure",{className:"carousel__item__figure",children:[Object(y.jsx)(c.b,{to:"/view/".concat("file"==e.type?"m":"tb","/").concat(e.id),children:Object(y.jsx)("img",{src:e.posterPath||"".concat(l,"/api/v1/image/poster?text=").concat(e.title,"&extention=jpeg"),className:"carousel__item__poster",alt:e.title},we())},we()),Object(y.jsx)(M.a,{className:"carousel__item__title",children:e.title},we())]},we())})):null})]},we()):null})):null})}}]),n}(r.Component)),he=n(31),pe=n.n(he),me=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var a;return Object(h.a)(this,n),(a=t.call(this,e)).state={auth:window.sessionStorage.getItem("auth")||window.localStorage.getItem("auth")||"0",category:a.props.match.params.category,genre:pe.a.parse(a.props.location.search).genre||"",isLoaded:!1,metadata:{},page:parseInt(pe.a.parse(a.props.location.search).page)||1,range:"".concat(void 0===pe.a.parse(a.props.location.search).page?"0:".concat(JSON.parse(window.localStorage.getItem("ui_config")||window.sessionStorage.getItem("ui_config")||"{}").range||"16"):"".concat((parseInt(pe.a.parse(a.props.location.search).page)-1)*parseInt(JSON.parse(window.localStorage.getItem("ui_config")||window.sessionStorage.getItem("ui_config")||"{}").range||"16"),":").concat(parseInt(pe.a.parse(a.props.location.search).page)*parseInt(JSON.parse(window.localStorage.getItem("ui_config")||window.sessionStorage.getItem("ui_config")||"{}").range||"16"))),server:window.sessionStorage.getItem("server")||window.localStorage.getItem("server")||window.location.origin,sort:pe.a.parse(a.props.location.search).sort||"",ui_config:JSON.parse(window.localStorage.getItem("ui_config")||window.sessionStorage.getItem("ui_config")||"{}")},a}return Object(p.a)(n,[{key:"componentDidMount",value:function(){var e=this,t=this.state,n=t.auth,a=t.category,r=t.genre,o=t.range,i=t.server,s=t.sort,c=t.ui_config;n&&i||this.props.history.push("/logout"),window.scrollTo(0,0);var l="".concat(i,"/api/v1/metadata"),d="?a=".concat(n,"&c=").concat(encodeURIComponent(a),"&g=").concat(encodeURIComponent(r),"&r=").concat(o,"&s=").concat(s);N.a.get(l+d).then((function(t){e.setState({isLoaded:!0,metadata:t.data.content,pages:Math.ceil(t.data.content[0].length/parseInt(c.range||"16"))||1})})).catch((function(t){if(console.error(t),t.response){var n=t.response.data;401===n.code?_.a.fire({title:"Error!",text:n.message,icon:"error",confirmButtonText:"Login",confirmButtonColor:Dt.palette.success.main}).then((function(t){t.isConfirmed&&e.props.history.push("/logout")})):i?_.a.fire({title:"Error!",text:n.message,icon:"error",confirmButtonText:"Logout",confirmButtonColor:Dt.palette.success.main,cancelButtonText:"Retry",cancelButtonColor:Dt.palette.error.main,showCancelButton:!0}).then((function(t){t.isConfirmed?e.props.history.push("/logout"):t.isDismissed&&location.reload()})):e.props.history.push("/logout")}else t.request&&(i?_.a.fire({title:"Error!",text:"libDrive could not communicate with the server! Is '".concat(i,"' the correct address?"),icon:"error",confirmButtonText:"Logout",confirmButtonColor:Dt.palette.success.main,cancelButtonText:"Retry",cancelButtonColor:Dt.palette.error.main,showCancelButton:!0}).then((function(t){t.isConfirmed?e.props.history.push("/logout"):t.isDismissed&&location.reload()})):e.props.history.push("/logout"))}))}},{key:"componentWillUnmount",value:function(){at()}},{key:"render",value:function(){var e=this.state,t=e.genre,n=e.isLoaded,r=e.metadata,o=e.page,i=e.pages,s=e.sort,c=e.ui_config;return n&&at({title:"".concat(c.title||"libDrive"," - ").concat(r[0].categoryInfo.name),description:"Browse ".concat(r[0].categoryInfo.name," on ").concat(c.title||"libDrive","!")}),n?Object(y.jsxs)("div",{className:"CategoryBrowse",children:[Object(y.jsx)(Ue,Object(a.a)({},this.props)),Object(y.jsx)(At,{metadata:r}),Object(y.jsx)(Ye,{state:{genre:t,page:o,pages:i,sort:s},props:this.props}),Object(y.jsx)(jt,{state:{genre:t,sort:s},props:this.props}),Object(y.jsx)(ve,{})]}):Object(y.jsx)("div",{className:"Loading",children:Object(y.jsx)(k.a,{})})}}]),n}(r.Component),je=n(131),be=n.n(je),ge=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var r;return Object(h.a)(this,n),(r=t.call(this,e)).state=Object(a.a)({menuAnchor:!1},e.state),r.handleClick=r.handleClick.bind(Object(m.a)(r)),r.handleClose=r.handleClose.bind(Object(m.a)(r)),r}return Object(p.a)(n,[{key:"handleClick",value:function(e){this.setState({menuAnchor:e.currentTarget})}},{key:"handleClose",value:function(){this.setState({menuAnchor:!1})}},{key:"render",value:function(){var e=this,t=this.state,n=t.metadata,a=t.menuAnchor;return Object(y.jsxs)("div",{className:"info__button2",children:[Object(y.jsx)(T.a,{variant:"outlined",color:"primary",style:{width:"135px"},"aria-controls":"children-menu","aria-haspopup":"true",onClick:this.handleClick,startIcon:Object(y.jsx)(be.a,{}),children:"Seasons"}),Object(y.jsx)(f.a,{id:"children-menu",anchorEl:a,keepMounted:!0,anchorOrigin:{vertical:"top",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},open:Boolean(a),onClose:this.handleClose,children:n.children.length?n.children.map((function(t){if("directory"==t.type)return Object(y.jsx)(c.b,{to:"/view/ts/".concat(t.id),className:"no_decoration_link",children:Object(y.jsx)(v.a,{onClick:e.handleClose,children:t.name})},we())})):null})]})}}]),n}(r.Component);var fe=n(5),Oe=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(){return Object(h.a)(this,n),t.apply(this,arguments)}return Object(p.a)(n,[{key:"render",value:function(){var e=this.props.classes;return Object(y.jsx)("div",{style:{paddingTop:"75px"},children:Object(y.jsxs)("footer",{className:e.footer__container,id:"footer__container",children:[Object(y.jsx)("img",{src:"https://cdn2.iconfinder.com/data/icons/social-media-2285/512/1_Instagram_colored_svg_1-512.png",className:"footer__github",height:"64px",alt:"github-logo"}),Object(y.jsx)("a",{className:"no_decoration_link footer__text",href:"https://www.instagram.com/thejagstudio/",target:"_blank",children:"\xa9 2024 Copyright: TheJagStudio - v".concat(Pt.a)})]})})}}]),n}(r.Component),ve=Object(fe.a)((function(e){return{footer__container:{width:"100%",height:"75px",display:"flex",alignItems:"center",justifyContent:"center"}}}),{withTheme:!0})(Oe),xe=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var a;return Object(h.a)(this,n),(a=t.call(this,e)).state={auth:window.sessionStorage.getItem("auth")||window.localStorage.getItem("auth")||"0",genre:pe.a.parse(a.props.location.search).genre||"",isLoaded:!1,metadata:{},page:parseInt(pe.a.parse(a.props.location.search).page)||1,range:"".concat(void 0===pe.a.parse(a.props.location.search).page?"0:8":"".concat(8*(parseInt(pe.a.parse(a.props.location.search).page)-1),":").concat(8*parseInt(pe.a.parse(a.props.location.search).page))),server:window.sessionStorage.getItem("server")||window.localStorage.getItem("server")||window.location.origin,sort:pe.a.parse(a.props.location.search).sort||"",ui_config:JSON.parse(window.localStorage.getItem("ui_config")||window.sessionStorage.getItem("ui_config")||"{}")},a}return Object(p.a)(n,[{key:"componentDidMount",value:function(){var e=this,t=this.state,n=t.auth,a=t.genre,r=t.range,o=t.server,i=t.sort;n&&o||this.props.history.push("/logout");var s="".concat(o,"/api/v1/metadata"),c="?a=".concat(n,"&g=").concat(encodeURIComponent(a),"&r=").concat(r,"&s=").concat(i);N.a.get(s+c).then((function(t){e.setState({isLoaded:!0,metadata:t.data.content,pages:Math.ceil(t.data.content[0].length/8)||1})})).catch((function(t){if(console.error(t),t.response){var n=t.response.data;401===n.code?_.a.fire({title:"Error!",text:n.message,icon:"error",confirmButtonText:"Login",confirmButtonColor:Dt.palette.success.main}).then((function(t){t.isConfirmed&&e.props.history.push("/logout")})):o?_.a.fire({title:"Error!",text:n.message,icon:"error",confirmButtonText:"Logout",confirmButtonColor:Dt.palette.success.main,cancelButtonText:"Retry",cancelButtonColor:Dt.palette.error.main,showCancelButton:!0}).then((function(t){t.isConfirmed?e.props.history.push("/logout"):t.isDismissed&&location.reload()})):e.props.history.push("/logout")}else t.request&&(o?_.a.fire({title:"Error!",text:"libDrive could not communicate with the server! Is '".concat(o,"' the correct address?"),icon:"error",confirmButtonText:"Logout",confirmButtonColor:Dt.palette.success.main,cancelButtonText:"Retry",cancelButtonColor:Dt.palette.error.main,showCancelButton:!0}).then((function(t){t.isConfirmed?e.props.history.push("/logout"):t.isDismissed&&location.reload()})):e.props.history.push("/logout"))}))}},{key:"componentWillUnmount",value:function(){at()}},{key:"render",value:function(){var e=this.state,t=e.genre,n=e.isLoaded,r=e.metadata,o=e.page,i=e.pages,s=e.sort,c=e.ui_config;return n&&at({title:"".concat(c.title||"libDrive").concat(t?" - ".concat(t):""),description:"Browse ".concat(t?"the ".concat(t," genre"):"genres"," on ").concat(c.title||"libDrive","!")}),n?Object(y.jsxs)("div",{className:"CategoryBrowse",children:[Object(y.jsx)(Ue,Object(a.a)({},this.props)),Object(y.jsx)(At,{metadata:r}),Object(y.jsx)(Ye,{state:{genre:t,page:o,pages:i,sort:s},props:this.props}),Object(y.jsx)(jt,{state:{genre:t,sort:s},props:this.props}),Object(y.jsx)(ve,{})]}):Object(y.jsx)("div",{className:"Loading",children:Object(y.jsx)(k.a,{})})}}]),n}(r.Component);function we(){function e(e){var t=(Math.random().toString(16)+"000000000").substr(2,8);return e?"-"+t.substr(0,4)+"-"+t.substr(4,4):t}return e()+e(!0)+e(!0)+e()}var ye=n(240),Se=n(259),Ce=n(260),ke=n(69),_e=n.n(ke),Ie=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var a;return Object(h.a)(this,n),(a=t.call(this,e)).state={auth:"",error:"",page:!1,password:"",signup:!1,server:window.location.origin,username:""},a.handleTempServerChange=a.handleTempServerChange.bind(Object(m.a)(a)),a.handlePassChange=a.handlePassChange.bind(Object(m.a)(a)),a.handleUserChange=a.handleUserChange.bind(Object(m.a)(a)),a.handleServerSubmit=a.handleServerSubmit.bind(Object(m.a)(a)),a.handleSubmit=a.handleSubmit.bind(Object(m.a)(a)),a.handleSignup=a.handleSignup.bind(Object(m.a)(a)),a.dismissError=a.dismissError.bind(Object(m.a)(a)),a}return Object(p.a)(n,[{key:"componentDidMount",value:function(){var e=this,t=this.state.server,n="".concat(t,"/api/v1/auth");N.a.get(n+"?rules=signup").then((function(n){var a=n.data;200===a.code?(window.localStorage.setItem("auth","0"),window.localStorage.setItem("server",t),window.localStorage.setItem("ui_config",JSON.stringify(a.content.ui_config)),window.sessionStorage.setItem("auth","0"),window.sessionStorage.setItem("server",t),window.sessionStorage.setItem("ui_config",JSON.stringify(a.content.ui_config)),e.props.history.push("/browse")):!0===a.content?e.setState({signup:!0,page:!0}):!1===a.content&&e.setState({signup:!1,page:!0})}))}},{key:"dismissError",value:function(){this.setState({error:""})}},{key:"handleServerSubmit",value:function(e){var t=this;e.preventDefault();var n=this.state.server;if(!n)return this.setState({error:"Server is required"});n.startsWith("http")||(n="https://".concat(n));var a="".concat(n,"/api/v1/auth");N.a.get(a+"?rules=signup").then((function(e){var a=e.data;200===a.code?(window.localStorage.setItem("auth","0"),window.localStorage.setItem("server",n),window.localStorage.setItem("ui_config",JSON.stringify(a.content.ui_config)),window.sessionStorage.setItem("auth","0"),window.sessionStorage.setItem("server",n),window.sessionStorage.setItem("ui_config",JSON.stringify(a.content.ui_config)),t.props.history.push("/browse")):!0===a.content?t.setState({server:n,signup:!0,page:!0}):!1===a.content&&t.setState({server:n,signup:!1,page:!0})})).catch((function(e){console.error(e);try{var t=response.data;_.a.fire({title:"Error!",text:t.message,icon:"error",confirmButtonText:"OK",confirmButtonColor:Dt.palette.success.main})}catch(a){_.a.fire({title:"Error!",text:"You were unable to communicate with the server. Are you sure ".concat(n," is the correct server?"),icon:"error",confirmButtonText:"OK",confirmButtonColor:Dt.palette.success.main})}}))}},{key:"handleSubmit",value:function(e){var t=this;e.preventDefault();var n=this.state,a=n.password,r=n.server,o=n.username,i="".concat(r,"/api/v1/auth"),s="?u=".concat(encodeURIComponent(o),"&p=").concat(encodeURIComponent(a));return N.a.get(i+s).then((function(e){var n=e.data;window.localStorage.setItem("server",r),window.sessionStorage.setItem("server",r),window.localStorage.setItem("ui_config",JSON.stringify(n.content.ui_config)),window.localStorage.setItem("auth",n.content.auth),window.sessionStorage.setItem("auth",n.content.auth),window.sessionStorage.setItem("ui_config",JSON.stringify(n.content.ui_config)),t.props.history.push("/")})).catch((function(e){console.error(e);try{var t=response.data;_.a.fire({title:"Error!",text:t.message,icon:"error",confirmButtonText:"OK",confirmButtonColor:Dt.palette.success.main})}catch(n){_.a.fire({title:"Error!",text:"The username and or password was incorrect!",icon:"error",confirmButtonText:"OK",confirmButtonColor:Dt.palette.success.main})}})),this.setState({error:""})}},{key:"handleSignup",value:function(){var e=this,t=this.state,n=t.password,a=t.server,r=t.username;if(!r)return this.setState({error:"Username is required"});if(!n)return this.setState({error:"Password is required"});var o="".concat(a,"/api/v1/signup"),i="?u=".concat(encodeURIComponent(r),"&p=").concat(encodeURIComponent(n));return N.a.get(o+i).then((function(t){var n=t.data;window.localStorage.setItem("server",a),window.sessionStorage.setItem("server",a),window.localStorage.setItem("auth",n.content.auth),window.sessionStorage.setItem("auth",n.content.auth),e.props.history.push("/")})).catch((function(e){console.error(e);var t=e.response;try{_.a.fire({title:"Error!",text:t.message,icon:"error",confirmButtonText:"OK",confirmButtonColor:Dt.palette.success.main})}catch(n){_.a.fire({title:"Error!",text:"Something went wrong while communicating with the server ".concat(a),icon:"error",confirmButtonText:"OK",confirmButtonColor:Dt.palette.success.main})}})),this.setState({error:""})}},{key:"handleTempServerChange",value:function(e){this.setState({server:e.target.value})}},{key:"handleUserChange",value:function(e){this.setState({username:e.target.value})}},{key:"handlePassChange",value:function(e){this.setState({password:e.target.value})}},{key:"render",value:function(){var e=this.state,t=e.error,n=e.password,a=e.page,r=e.server,o=e.username,i=this.props.classes;return a?Object(y.jsxs)("div",{className:"Login",children:[Object(y.jsxs)(ye.a,{component:"main",maxWidth:"xs",children:[Object(y.jsx)(d.a,{}),Object(y.jsxs)("div",{className:i.paper,children:[Object(y.jsx)(Se.a,{className:i.avatar,children:Object(y.jsx)(_e.a,{})}),Object(y.jsx)(M.a,{variant:"h5",children:"Sign in"}),Object(y.jsxs)("form",{className:i.form,onSubmit:this.handleSubmit,noValidate:!0,children:[t&&Object(y.jsx)("div",{style:{},children:Object(y.jsxs)("h3",{"data-test":"error",onClick:this.dismissError,children:[Object(y.jsx)("button",{onClick:this.dismissError,children:"\u2716"}),t]})}),Object(y.jsx)(Ce.a,{variant:"outlined",margin:"normal",required:!0,fullWidth:!0,id:"server",label:"Server",name:"server",autoComplete:"server",onChange:this.handleTempServerChange,value:r,autoFocus:!0,disabled:!0}),Object(y.jsx)(Ce.a,{variant:"outlined",margin:"normal",required:!0,fullWidth:!0,id:"username",label:"Username",name:"username",autoComplete:"username",onChange:this.handleUserChange,value:o}),Object(y.jsx)(Ce.a,{variant:"outlined",margin:"normal",required:!0,fullWidth:!0,name:"password",label:"Password",type:"password",id:"password",autoComplete:"current-password",onChange:this.handlePassChange,value:n}),Object(y.jsx)(T.a,{type:"submit",fullWidth:!0,variant:"contained",color:"primary",className:i.submit,children:"Sign In"}),this.state.signup?Object(y.jsxs)("div",{className:"Signup",style:{textAlign:"center"},children:[Object(y.jsx)(T.a,{type:"button",onClick:this.handleSignup,fullWidth:!0,variant:"contained",color:"primary",style:{marginTop:0},className:i.submit,children:"Sign Up"}),Object(y.jsx)(M.a,{variant:"body1",children:"Be aware that the owner of this server can view your credentials!"})]}):Object(y.jsx)("div",{className:"Signup"})]})]})]}),Object(y.jsx)(ve,{})]}):Object(y.jsxs)("div",{className:"Login",children:[Object(y.jsxs)(ye.a,{component:"main",maxWidth:"xs",children:[Object(y.jsx)(d.a,{}),Object(y.jsxs)("div",{className:i.paper,children:[Object(y.jsx)(Se.a,{className:i.avatar,children:Object(y.jsx)(_e.a,{})}),Object(y.jsx)(M.a,{variant:"h5",children:"Sign in"}),Object(y.jsxs)("form",{className:i.form,onSubmit:this.handleServerSubmit,noValidate:!0,children:[t&&Object(y.jsx)("div",{style:{},children:Object(y.jsxs)("h3",{"data-test":"error",onClick:this.dismissError,children:[Object(y.jsx)("button",{onClick:this.dismissError,children:"\u2716"}),t]})}),Object(y.jsx)(Ce.a,{variant:"outlined",margin:"normal",required:!0,fullWidth:!0,id:"server",label:"Server",name:"server",autoComplete:"server",onChange:this.handleTempServerChange,value:r,autoFocus:!0}),Object(y.jsx)(T.a,{type:"submit",fullWidth:!0,variant:"contained",color:"primary",className:i.submit,children:"Next"})]})]})]}),Object(y.jsx)(ve,{})]})}}]),n}(r.Component),Ne=Object(fe.a)((function(e){return{paper:{marginTop:e.spacing(8),display:"flex",flexDirection:"column",alignItems:"center"},avatar:{margin:e.spacing(1),backgroundColor:e.palette.secondary.main},form:{width:"100%",marginTop:e.spacing(1)},submit:{margin:e.spacing(3,0,2)}}}),{withTheme:!0})(Ie),Be=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var a;return Object(h.a)(this,n),(a=t.call(this,e)).state={isLoaded:!1},a}return Object(p.a)(n,[{key:"componentDidMount",value:function(){var e=this;window.localStorage.clear(),window.sessionStorage.clear(),setTimeout((function(){return e.setState({isLoaded:!0})}),500)}},{key:"render",value:function(){return this.state.isLoaded?Object(y.jsx)(l.a,{to:"/login"},we()):Object(y.jsx)("div",{className:"Loading",children:Object(y.jsx)(k.a,{})})}}]),n}(r.Component),Te=n(66),De=n(245),Ee=n(246),Le=n(144),Re=n(18),Ae=n(132),Me=n.n(Ae),Pe=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var r;return Object(h.a)(this,n),(r=t.call(this,e)).state=Object(a.a)(Object(a.a)({},e.state),{},{ui_config:JSON.parse(window.localStorage.getItem("ui_config")||window.sessionStorage.getItem("ui_config")||"{}")}),r.searchChange=r.searchChange.bind(Object(m.a)(r)),r.searchSubmit=r.searchSubmit.bind(Object(m.a)(r)),r.onMouseOver=r.onMouseOver.bind(Object(m.a)(r)),r.onMouseOut=r.onMouseOut.bind(Object(m.a)(r)),r}return Object(p.a)(n,[{key:"searchChange",value:function(e){this.setState({search:e.target.value})}},{key:"searchSubmit",value:function(e){e.preventDefault(),""!=this.state.search&&null!=this.state.search&&this.props.history.push({pathname:"/search/".concat(this.state.search),key:we()})}},{key:"onMouseOver",value:function(e){e.target.style.width="20vw"}},{key:"onMouseOut",value:function(e){e.target.style.width="15vw"}},{key:"render",value:function(){var e=this.state,t=e.accounts,n=e.categories,a=e.query,r=e.search,o=e.ui_config,i=this.props.classes;return Object(y.jsx)("div",{className:i.grow,children:Object(y.jsx)(De.a,{position:"static",className:i.root,children:Object(y.jsxs)(Ee.a,{children:[Object(y.jsx)(c.b,{to:"/",className:"no_decoration_link",children:o.icon_on_nav?Object(y.jsx)(Se.a,{alt:"logo",src:o.icon,children:"L"}):Object(y.jsx)(M.a,{className:i.title,variant:"h6",noWrap:!0,children:o.title||"libDrive"})}),Object(y.jsxs)("form",{className:i.search,onSubmit:this.searchSubmit,children:[Object(y.jsx)(g.a,{onClick:this.searchSubmit,className:i.searchIcon,children:Object(y.jsx)(Me.a,{})}),Object(y.jsx)(Le.a,{placeholder:"Search\u2026",classes:{root:i.inputRoot,input:i.inputInput},inputProps:{"aria-label":"search"},onChange:this.searchChange,onMouseOver:this.onMouseOver,onMouseOut:this.onMouseOut,value:null==r?a:r})]}),Object(y.jsx)("div",{className:i.grow}),Object(y.jsx)(D,{categories:n}),Object(y.jsx)(Rt,{ui_config:o}),o.hide_news?null:Object(y.jsx)(Ke,{}),Object(y.jsx)(S,{accounts:t,ui_config:o})]})})})}}]),n}(r.Component),Je=Object(fe.a)((function(e){return{root:{backgroundColor:e.palette.background.default,color:e.palette.text.primary},grow:{flexGrow:1},title:Object(Te.a)({display:"none"},e.breakpoints.up("sm"),{display:"block"}),search:Object(Te.a)({position:"relative",borderRadius:e.shape.borderRadius,backgroundColor:Object(Re.a)(e.palette.common.main,.15),"&:hover":{backgroundColor:Object(Re.a)(e.palette.common.main,.25)},marginRight:e.spacing(2),marginLeft:0,width:"100%"},e.breakpoints.up("sm"),{marginLeft:e.spacing(3),width:"auto"}),searchIcon:{padding:e.spacing(0,2),height:"100%",position:"absolute",zIndex:10,display:"flex",alignItems:"center",justifyContent:"center"},inputRoot:{color:"inherit"},inputInput:{padding:e.spacing(1,1,1,0),paddingLeft:"calc(1em + ".concat(e.spacing(4),"px)"),transition:e.transitions.create("width"),width:"15vw",maxWidth:"500px"}}}),{withTheme:!0})(Pe),Ue=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var a;return Object(h.a)(this,n),(a=t.call(this,e)).state={accounts:{},auth:window.sessionStorage.getItem("auth")||window.localStorage.getItem("auth")||"0",categories:[],isLoaded:!1,server:window.sessionStorage.getItem("server")||window.localStorage.getItem("server")||window.location.origin,ui_config:{}},a}return Object(p.a)(n,[{key:"componentDidMount",value:function(){var e=this,t=this.state,n=t.auth,a=t.server,r="".concat(a,"/api/v1/environment"),o="?a=".concat(n);N.a.get(r+o).then((function(t){var n=t.data;e.setState({accounts:n.content.account_list,categories:n.content.category_list,isLoaded:!0,ui_config:n.content.ui_config}),"object"==typeof n.content.ui_config&&(window.localStorage.setItem("ui_config",JSON.stringify(n.content.ui_config)),window.sessionStorage.setItem("ui_config",JSON.stringify(n.content.ui_config)))}))}},{key:"render",value:function(){var e=this.state,t=e.accounts,n=e.categories,r=e.isLoaded;return r||r?Object(y.jsx)("div",{className:"Nav",children:Object(y.jsx)(Je,Object(a.a)({state:{accounts:t,categories:n,query:this.props.query}},this.props))}):Object(y.jsx)(Je,Object(a.a)({state:{accounts:[],categories:[],query:this.props.query}},this.props))}}]),n}(r.Component),qe=n(247),We=n(94),Fe=n.n(We),Ke=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var a;return Object(h.a)(this,n),(a=t.call(this,e)).state={dismissed:"true"==(window.localStorage.getItem("dismissed")||"false"),isLoaded:!1,isNew:!1,lastChecked:new Date(window.localStorage.getItem("last_news_check")||"0").getTime(),menuAnchor:!1,news:JSON.parse(window.localStorage.getItem("news")||"[]"),now:(new Date).getTime()},a.handleClick=a.handleClick.bind(Object(m.a)(a)),a.handleClose=a.handleClose.bind(Object(m.a)(a)),a}return Object(p.a)(n,[{key:"componentDidMount",value:function(){var e=this,t=this.state,n=t.isNew,a=t.lastChecked,r=t.news,o=t.now,i=a+108e5;r.length&&r[0].tag_name&&Pt.a!=r[0].tag_name.replace("v","")&&(n=!0),o>=i?N.a.get("https://api.github.com/repos/libDrive/libDrive/releases").then((function(t){var a=t.data;window.localStorage.setItem("news",JSON.stringify(a)),window.localStorage.setItem("last_news_check",o),r.length&&a.length&&r[0].tag_name!=a[0].tag_name?(window.localStorage.setItem("dismissed","false"),e.setState({dismissed:!1,isLoaded:!0,isNew:n,news:a})):e.setState({isLoaded:!0,isNew:n,news:a})})):this.setState({isLoaded:!0,isNew:n})}},{key:"handleClick",value:function(e){var t=this,n=this.state,a=(n.news,n.now);this.setState({menuAnchor:e.currentTarget}),N.a.get("https://api.github.com/repos/libDrive/libDrive/releases").then((function(e){var n=e.data;window.localStorage.setItem("news",JSON.stringify(n)),window.localStorage.setItem("last_news_check",a),window.localStorage.setItem("dismissed","true"),t.setState({dismissed:!0,news:n})}))}},{key:"handleClose",value:function(){this.setState({menuAnchor:!1})}},{key:"render",value:function(){var e=this.state,t=e.dismissed,n=e.isNew,a=e.isLoaded,r=e.menuAnchor,i=e.news;return a?Object(y.jsxs)("div",{className:"NewsMenu",children:[Object(y.jsx)(g.a,{"aria-label":"more","aria-controls":"news-menu","aria-haspopup":"true",onClick:this.handleClick,children:!t&&n?Object(y.jsx)(qe.a,{badgeContent:"N",color:"primary",children:Object(y.jsx)(Fe.a,{})}):Object(y.jsx)(Fe.a,{})}),Object(y.jsx)(f.a,{id:"news-menu",anchorEl:r,keepMounted:!0,open:Boolean(r),onClose:this.handleClose,children:Object(y.jsxs)(re.a,{style:{width:"530px",maxwidth:"90vw"},children:[Object(y.jsx)(oe.a,{pri:"true",alignItems:"flex-start",children:Object(y.jsx)(se.a,{primary:n?Object(y.jsx)("strong",{style:{color:Dt.palette.warning.main},children:"There is a new version available!"}):Object(y.jsx)("strong",{style:{color:Dt.palette.success.main},children:"You are on the latest version"})})}),Object(y.jsx)(O.a,{}),i.length?i.slice(0,3).map((function(e){return Object(y.jsx)(oe.a,{pri:"true",alignItems:"flex-start",children:Object(y.jsx)(se.a,{primary:Object(y.jsxs)("strong",{children:["libDrive ",e.tag_name]}),secondary:Object(y.jsx)(o.a.Fragment,{children:Object(y.jsxs)("span",{style:{whiteSpace:"pre-line"},children:["Version: ",e.tag_name,"\n","Date: ",new Date(e.published_at).toDateString(),"\n","Info:"," ",Object(y.jsx)("a",{href:e.html_url,target:"_blank",className:"no_decoration_link",children:Object(y.jsx)("u",{children:e.html_url.replace("https://github.com/","")})})]})})})},we())})):null]})})]}):null}}]),n}(r.Component),Ve=(n(188),function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(){return Object(h.a)(this,n),t.apply(this,arguments)}return Object(p.a)(n,[{key:"render",value:function(){return Object(y.jsxs)("div",{className:"NotFound",children:[Object(y.jsx)(Ue,Object(a.a)({},this.props)),Object(y.jsx)("div",{className:"nf",children:Object(y.jsx)("div",{className:"fof",children:Object(y.jsx)("h1",{children:"Error 404: Not Found"})})})]})}}]),n}(r.Component)),ze=n(265),He=n(256),Ge=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var a;return Object(h.a)(this,n),(a=t.call(this,e)).state=e.state,a}return Object(p.a)(n,[{key:"render",value:function(){var e=this,t=this.state,n=t.genre,r=t.page,o=t.pages,i=t.sort,s=this.props.classes;return r>o?Object(y.jsx)(l.a,{to:{pathname:this.props.props.location.pathname,search:"?page=".concat(o,"&genre=").concat(n,"&sort=").concat(i)}},we()):Object(y.jsx)("div",{className:s.root,children:Object(y.jsx)(ze.a,{page:r,count:o,variant:"outlined",size:window.innerWidth>=600?"large":window.innerWidth>=390?"medium":"small",color:"primary",renderItem:function(t){return t.page?Object(y.jsx)(c.b,{to:{pathname:e.props.props.location.pathname,search:"?page=".concat(t.page,"&genre=").concat(n,"&sort=").concat(i)},className:"no_decoration_link",children:Object(y.jsx)(He.a,Object(a.a)({},t))},we()):Object(y.jsx)(He.a,Object(a.a)({},t))}})})}}]),n}(r.Component),Ye=Object(fe.a)((function(e){return{root:{"& > *":{display:"flex",justifyContent:"center",alignItems:"center",margin:"20px"}}}}),{withTheme:!0})(Ge),Xe=n(133),Qe=n.n(Xe),$e=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var r;return Object(h.a)(this,n),(r=t.call(this,e)).state=Object(a.a)({menuAnchor:!1},e.state),r.handleClick=r.handleClick.bind(Object(m.a)(r)),r.handleClose=r.handleClose.bind(Object(m.a)(r)),r}return Object(p.a)(n,[{key:"handleClick",value:function(e){this.setState({menuAnchor:e.currentTarget})}},{key:"handleClose",value:function(e){this.setState({menuAnchor:!1})}},{key:"render",value:function(){var e,t=this,n=this.state,a=(n.auth,n.id),r=n.isAndroid,o=n.isIOS,i=n.metadata,s=n.server,c=new URL("".concat(s,"/api/v1/redirectdownload/").concat(encodeURIComponent(i.name),"?id=").concat(a));if(r){var l=c.protocol.slice(0,-1);c.hash="Intent;action=android.intent.action.VIEW;scheme=".concat(l,";type=").concat(i.mimeType,";S.title=").concat(encodeURIComponent(i.name),";end"),c.protocol="intent",e=c.toString()}else o&&(c.host="x-callback-url",c.port="",c.pathname="stream",c.search="url=".concat(s,"/api/v1/redirectdownload/").concat(encodeURIComponent(i.name),"?id=").concat(a),c.protocol="vlc-x-callback",e=c.toString());return Object(y.jsxs)("div",{className:"info__button",children:[Object(y.jsx)(T.a,{variant:"outlined",color:"primary",style:{width:"135px"},"aria-controls":"player-menu","aria-haspopup":"true",onClick:this.handleClick,startIcon:Object(y.jsx)(Qe.a,{}),children:"Player"}),Object(y.jsxs)(f.a,{id:"player-menu",anchorEl:this.state.menuAnchor,keepMounted:!0,anchorOrigin:{vertical:"top",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},open:Boolean(this.state.menuAnchor),onClose:this.handleClose,children:[r||o?Object(y.jsxs)("div",{children:[Object(y.jsx)("a",{href:e,className:"no_decoration_link",children:Object(y.jsx)(v.a,{onClick:this.handleClose,children:r?"Android":o?"IOS selector":null})}),Object(y.jsx)(O.a,{})]}):Object(y.jsx)("div",{children:Object(y.jsx)("a",{href:"potplayer://".concat(s,"/api/v1/redirectdownload/").concat(encodeURIComponent(i.name),"?id=").concat(a),className:"no_decoration_link",children:Object(y.jsx)(v.a,{onClick:this.handleClose,children:"PotPlayer"})})}),Object(y.jsx)(O.a,{}),Object(y.jsx)(v.a,{onClick:function(){navigator.clipboard.writeText("".concat(s,"/api/v1/redirectdownload/").concat(encodeURIComponent(i.name),"?id=").concat(a)),t.handleClose()},children:"Copy URL"})]})]})}}]),n}(r.Component),Ze=n(134),et=n.n(Ze),tt=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var a;return Object(h.a)(this,n),(a=t.call(this,e)).state=e.state,a.handleClick=a.handleClick.bind(Object(m.a)(a)),a}return Object(p.a)(n,[{key:"handleClick",value:function(e){for(var t=this.state,n=(t.auth,t.metadata),a=t.server,r="#EXTM3U\n#EXTENC: UTF-8\n#PLAYLIST: ".concat(n.name,"\n"),o=0;o<n.children.length;o++)r+="#EXTINF:0, ".concat(n.children[o].name,"\n").concat(a,"/api/v1/redirectdownload/").concat(encodeURI(n.children[o].name),"?id=").concat(n.children[o].id,"\n");var i=document.createElement("a");i.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(r)),i.setAttribute("download","".concat(n.name,".m3u8")),i.style.display="none",document.body.appendChild(i),i.click(),document.body.removeChild(i)}},{key:"render",value:function(){return Object(y.jsx)("div",{className:"info__button",children:Object(y.jsx)(T.a,{variant:"outlined",color:"primary",style:{width:"135px"},onClick:this.handleClick,startIcon:Object(y.jsx)(et.a,{}),children:"Playlist"})})}}]),n}(r.Component),nt=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var a;return Object(h.a)(this,n),(a=t.call(this,e)).state={auth:window.sessionStorage.getItem("auth")||window.localStorage.getItem("auth")||"0",isLoaded:!1,metadata:[],query:a.props.match.params.q,server:window.sessionStorage.getItem("server")||window.localStorage.getItem("server")||window.location.origin,ui_config:JSON.parse(window.localStorage.getItem("ui_config")||window.sessionStorage.getItem("ui_config")||"{}")},a}return Object(p.a)(n,[{key:"componentDidMount",value:function(){var e=this,t=this.state,n=t.auth,a=t.query,r=t.server,o=t.ui_config;n&&r||this.props.history.push("/logout"),at({title:"".concat(o.title||"libDrive"," - ").concat(a),description:"Find ".concat(a," on ").concat(o.title||"libDrive","!")});var i="".concat(r,"/api/v1/metadata"),s="?a=".concat(n,"&q=").concat(encodeURIComponent(a));N.a.get(i+s).then((function(t){return e.setState({isLoaded:!0,metadata:t.data.content})})).catch((function(t){if(console.error(t),t.response){var n=t.response.data;401===n.code?_.a.fire({title:"Error!",text:n.message,icon:"error",confirmButtonText:"Login",confirmButtonColor:Dt.palette.success.main}).then((function(t){t.isConfirmed&&e.props.history.push("/logout")})):r?_.a.fire({title:"Error!",text:n.message,icon:"error",confirmButtonText:"Logout",confirmButtonColor:Dt.palette.success.main,cancelButtonText:"Retry",cancelButtonColor:Dt.palette.error.main,showCancelButton:!0}).then((function(t){t.isConfirmed?e.props.history.push("/logout"):t.isDismissed&&location.reload()})):e.props.history.push("/logout")}else t.request&&(r?_.a.fire({title:"Error!",text:"libDrive could not communicate with the server! Is '".concat(r,"' the correct address?"),icon:"error",confirmButtonText:"Logout",confirmButtonColor:Dt.palette.success.main,cancelButtonText:"Retry",cancelButtonColor:Dt.palette.error.main,showCancelButton:!0}).then((function(t){t.isConfirmed?e.props.history.push("/logout"):t.isDismissed&&location.reload()})):e.props.history.push("/logout"))}))}},{key:"componentWillUnmount",value:function(){at()}},{key:"render",value:function(){var e=this.state,t=e.isLoaded,n=e.metadata,r=e.query;return t?Object(y.jsxs)("div",{className:"Search",children:[Object(y.jsx)(Ue,Object(a.a)(Object(a.a)({},this.props),{},{query:r})),Object(y.jsx)(ue,{metadata:n,hide:!0}),Object(y.jsx)(ve,{})]}):Object(y.jsx)("div",{className:"Loading",children:Object(y.jsx)(k.a,{})})}}]),n}(r.Component);function at(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=JSON.parse(window.localStorage.getItem("ui_config")||window.sessionStorage.getItem("ui_config")||"{}");e.title=e.title||t.title||"libDrive",e.description=e.description||"libDrive is a Google Drive media library manager and indexer, similar to Plex, that organizes Google Drive media to offer an intuitive and user-friendly experience.",e.image=e.image||t.icon||"/images/icons/icon-512x512.png",e.type=e.type||"website",document.title=e.title||t.title,document.querySelector('meta[property="og:title"]').setAttribute("content",e.title),document.querySelector('meta[name="description"]').setAttribute("content",e.description),document.querySelector('meta[property="og:description"]').setAttribute("content",e.description),document.querySelector('meta[property="og:image"]').setAttribute("content",e.image),document.querySelector('meta[property="og:type"]').setAttribute("content",e.type)}var rt,ot,it=n(263),st=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var a;return Object(h.a)(this,n),(a=t.call(this,e)).state={auth:window.sessionStorage.getItem("auth")||window.localStorage.getItem("auth")||"0",error:"",isLoaded:!1,secret:window.sessionStorage.getItem("secret"),server:window.sessionStorage.getItem("server")||window.localStorage.getItem("server")||window.location.origin},a.dismissError=a.dismissError.bind(Object(m.a)(a)),a.handleSubmit=a.handleSubmit.bind(Object(m.a)(a)),a.handleChange=a.handleChange.bind(Object(m.a)(a)),a.handleRestart=a.handleRestart.bind(Object(m.a)(a)),a.handleKillSwitch=a.handleKillSwitch.bind(Object(m.a)(a)),a.handleRebuild=a.handleRebuild.bind(Object(m.a)(a)),a.handleFileBrowser=a.handleFileBrowser.bind(Object(m.a)(a)),a}return Object(p.a)(n,[{key:"componentDidMount",value:function(){var e=this,t=this.state,n=t.secret,r=t.server,o=Object(a.a)({},this.props);if(o.classes={},null==window.sessionStorage.getItem("secret"))this.props.history.push("/settings/login");else{var i="".concat(r,"/api/v1/config"),s="?a=".concat(auth,"&secret=").concat(encodeURIComponent(n));N.a.get(i+s).then((function(t){return e.setState({config:JSON.stringify(t.data.content,null,4),isLoaded:!0,navProps:o,tempSecret:t.data.content.secret_key})})).catch((function(t){if(console.error(t),t.response){var n=t.response.data;401===n.code?_.a.fire({title:"Error!",text:n.message,icon:"error",confirmButtonText:"Login",confirmButtonColor:Dt.palette.success.main}).then((function(t){t.isConfirmed&&e.props.history.push("/logout")})):r?_.a.fire({title:"Error!",text:n.message,icon:"error",confirmButtonText:"Logout",confirmButtonColor:Dt.palette.success.main,cancelButtonText:"Retry",cancelButtonColor:Dt.palette.error.main,showCancelButton:!0}).then((function(t){t.isConfirmed?e.props.history.push("/logout"):t.isDismissed&&location.reload()})):e.props.history.push("/logout")}else t.request&&(r?_.a.fire({title:"Error!",text:"libDrive could not communicate with the server! Is '".concat(r,"' the correct address?"),icon:"error",confirmButtonText:"Logout",confirmButtonColor:Dt.palette.success.main,cancelButtonText:"Retry",cancelButtonColor:Dt.palette.error.main,showCancelButton:!0}).then((function(t){t.isConfirmed?e.props.history.push("/logout"):t.isDismissed&&location.reload()})):e.props.history.push("/logout"))}))}}},{key:"dismissError",value:function(){this.setState({error:""})}},{key:"handleRestart",value:function(e){e.preventDefault();var t=this.state,n=t.secret,a=t.server,r="".concat(a,"/api/v1/restart"),o="?a=".concat(auth,"&secret=").concat(encodeURIComponent(n));N.a.get(r+o).then((function(e){_.a.fire({title:"Success!",text:e.data.message,icon:"success",confirmButtonText:"OK",confirmButtonColor:Dt.palette.success.main})})).catch((function(e){console.error(e),_.a.fire({title:"Success!",text:"libDrive is being restarted, this might take some time, so the app won't load",icon:"success",confirmButtonText:"OK",confirmButtonColor:Dt.palette.success.main})}))}},{key:"handleSubmit",value:function(e){var t=this;e.preventDefault();var n=this.state,a=n.secret,r=n.server,o="".concat(r,"/api/v1/config"),i="?a=".concat(auth,"&secret=").concat(encodeURIComponent(a));N.a.post(o+i,JSON.parse(this.state.config)).then((function(e){_.a.fire({title:"Success!",text:e.data.message,icon:"success",confirmButtonText:"OK",confirmButtonColor:Dt.palette.success.main})})).catch((function(e){if(console.error(e),e.response){var n=e.response.data;401===n.code?_.a.fire({title:"Error!",text:n.message,icon:"error",confirmButtonText:"Logout",confirmButtonColor:Dt.palette.success.main}).then((function(e){e.isConfirmed&&(window.sessionStorage.removeItem("secret"),t.props.history.push("/settings/login"))})):_.a.fire({title:"Error!",text:n.message,icon:"error",confirmButtonText:"Logout",confirmButtonColor:Dt.palette.success.main,cancelButtonText:"Retry",cancelButtonColor:Dt.palette.error.main,showCancelButton:!0}).then((function(e){e.isConfirmed?t.props.history.push("/logout"):e.isDismissed&&location.reload()}))}else e.request&&_.a.fire({title:"Error!",text:"libDrive could not communicate with the server! Is ".concat(r," the correct address?"),icon:"error",confirmButtonText:"Logout",confirmButtonColor:Dt.palette.success.main,cancelButtonText:"Retry",cancelButtonColor:Dt.palette.error.main,showCancelButton:!0}).then((function(e){e.isConfirmed?t.props.history.push("/logout"):e.isDismissed&&location.reload()}))}))}},{key:"handleChange",value:function(e){this.setState({config:e.target.value})}},{key:"handleKillSwitch",value:function(e){var t=JSON.parse(this.state.config);t.kill_switch=e.target.checked,this.setState({config:JSON.stringify(t,null,4)}),this.handleSubmit(e)}},{key:"handleRebuild",value:function(e){var t=this,n=this.state,a=n.secret,r=n.server,o="".concat(r,"/api/v1/rebuild"),i="?a=".concat(auth,"&secret=").concat(encodeURIComponent(a));N.a.get(o+i).then((function(e){return _.a.fire({title:"Success!",text:"libDrive's metadata is being rebuilt...",icon:"success",confirmButtonText:"OK",confirmButtonColor:Dt.palette.success.main})})).catch((function(e){console.error(e),null==auth||null==r?t.props.history.push("/login"):e.response?401===e.response.status?_.a.fire({title:"Error!",text:"Your credentials are invalid!",icon:"error",confirmButtonText:"Logout",confirmButtonColor:Dt.palette.success.main}).then((function(e){e.isConfirmed&&t.props.history.push("/logout")})):_.a.fire({title:"Error!",text:"Something went wrong while communicating with the server!",icon:"error",confirmButtonText:"Logout",confirmButtonColor:Dt.palette.success.main,cancelButtonText:"Retry",cancelButtonColor:Dt.palette.error.main,showCancelButton:!0}).then((function(e){e.isConfirmed?t.props.history.push("/logout"):e.isDismissed&&location.reload()})):e.request&&_.a.fire({title:"Error!",text:"libDrive could not communicate with the server! Is ".concat(r," the correct address?"),icon:"error",confirmButtonText:"Logout",confirmButtonColor:Dt.palette.success.main,cancelButtonText:"Retry",cancelButtonColor:Dt.palette.error.main,showCancelButton:!0}).then((function(e){e.isConfirmed?t.props.history.push("/logout"):e.isDismissed&&location.reload()}))}))}},{key:"handleFileBrowser",value:function(){var e=this.state,t=e.secret,n=e.server;window.open("".concat(n,"/api/v1/debug?secret=").concat(t))}},{key:"render",value:function(){var e=this.state,t=e.config,n=e.isLoaded,r=e.navProps,o=this.props.classes;return n?Object(y.jsxs)("div",{className:"Settings",children:[Object(y.jsx)(Ue,Object(a.a)({},r)),Object(y.jsx)("div",{style:{margin:"auto",marginTop:"50px",width:"80vw",maxWidth:"1500px"},children:Object(y.jsx)(Ce.a,{style:{width:"100%",backgroundColor:Dt.palette.background.paper},variant:"outlined",label:"Config",value:t,id:"config-box",onChange:this.handleChange,multiline:!0,minRows:15,maxRows:30})}),Object(y.jsx)("form",{className:o.Form,noValidate:!0,autoComplete:"off",onSubmit:this.handleSubmit,children:Object(y.jsxs)("div",{style:{margin:"30px"},children:[Object(y.jsx)(T.a,{style:{margin:"10px",width:"175px"},type:"submit",fullWidth:!0,variant:"contained",color:"primary",className:o.submit,children:"Submit Config"}),Object(y.jsx)(T.a,{style:{margin:"10px",width:"175px"},fullWidth:!0,variant:"contained",color:"primary",className:o.submit,onClick:this.handleRestart,children:"Restart Server"}),Object(y.jsx)(T.a,{style:{margin:"10px",width:"175px"},fullWidth:!0,variant:"contained",color:"primary",className:o.submit,onClick:this.handleRebuild,children:"Rebuild Metadata"}),Object(y.jsx)(T.a,{style:{margin:"10px",width:"175px"},fullWidth:!0,variant:"contained",color:"primary",className:o.submit,onClick:this.handleFileBrowser,children:"File Browser"}),Object(y.jsx)("br",{}),Object(y.jsx)("p",{style:{fontSize:"16px",marginTop:"10px",marginBotoom:"5px"},children:"Kill Switch"}),Object(y.jsx)(it.a,{checked:this.state.config.kill_switch,onChange:this.handleKillSwitch,color:"primary",name:"checkedB",inputProps:{"aria-label":"primary checkbox"}})]})}),Object(y.jsx)(ve,{})]}):Object(y.jsx)("div",{className:"Loading",children:Object(y.jsx)(k.a,{})})}}]),n}(r.Component),ct=Object(fe.a)((function(e){return{Form:{textAlign:"center","& .MuiTextField-root":{width:"30ch",margin:e.spacing(1),textAlign:"left"},"& .MuiTypography-root":{margin:"30px 30px"}},submit:{margin:e.spacing(4,0,2),width:"20ch"}}}),{withTheme:!0})(st),lt=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var a;return Object(h.a)(this,n),(a=t.call(this,e)).state={auth:window.sessionStorage.getItem("auth")||window.localStorage.getItem("auth")||"0",isLoaded:!1,secret:"",server:window.sessionStorage.getItem("server")||window.localStorage.getItem("server")||window.location.origin},a.handleSecretChange=a.handleSecretChange.bind(Object(m.a)(a)),a.handleSubmit=a.handleSubmit.bind(Object(m.a)(a)),a}return Object(p.a)(n,[{key:"componentDidMount",value:function(){var e=Object(a.a)({},this.props);e.classes={},this.setState({isLoaded:!0,navProps:e})}},{key:"handleSubmit",value:function(e){var t=this;e.preventDefault();var n=this.state,a=n.secret,r=n.server,o="".concat(r,"/api/v1/config"),i="?a=".concat(auth,"&secret=").concat(encodeURIComponent(a));N.a.get(o+i).then((function(e){window.sessionStorage.setItem("secret",a),t.props.history.push("/settings")})).catch((function(e){if(console.error(e),e.response){var n=e.response.data;401===n.code?_.a.fire({title:"Error!",text:n.message,icon:"error",confirmButtonText:"OK",confirmButtonColor:Dt.palette.success.main}):_.a.fire({title:"Error!",text:n.message,icon:"error",confirmButtonText:"OK",confirmButtonColor:Dt.palette.success.main}).then((function(e){location.reload()}))}else e.request&&_.a.fire({title:"Error!",text:"libDrive could not communicate with the server. Is ${server} the correct address?",icon:"error",confirmButtonText:"Logout",confirmButtonColor:Dt.palette.success.main,cancelButtonText:"Retry",cancelButtonColor:Dt.palette.error.main,showCancelButton:!0}).then((function(e){e.isConfirmed?t.props.history.push("/logout"):e.isDismissed&&location.reload()}))}))}},{key:"handleSecretChange",value:function(e){this.setState({secret:e.target.value})}},{key:"render",value:function(){var e=this.state,t=e.isLoaded,n=e.navProps,r=e.secret,o=this.props.classes;return t?Object(y.jsxs)("div",{className:"SettingsLoginForm",children:[Object(y.jsx)(Ue,Object(a.a)({},n)),Object(y.jsxs)(ye.a,{component:"main",maxWidth:"xs",children:[Object(y.jsx)(d.a,{}),Object(y.jsxs)("div",{className:o.paper,children:[Object(y.jsx)(Se.a,{className:o.avatar,children:Object(y.jsx)(_e.a,{})}),Object(y.jsx)(M.a,{variant:"h5",children:"Settings Login"}),Object(y.jsxs)("form",{className:o.form,onSubmit:this.handleSubmit,noValidate:!0,children:[Object(y.jsx)(Ce.a,{variant:"outlined",margin:"normal",fullWidth:!0,id:"secret",label:"Secret",name:"secret",type:"password",autoComplete:"secret",onChange:this.handleSecretChange,value:r,required:!0,autoFocus:!0}),Object(y.jsx)(T.a,{type:"submit",fullWidth:!0,variant:"contained",color:"primary",className:o.submit,children:"Sign In"})]})]})]}),Object(y.jsx)(ve,{})]}):Object(y.jsx)("div",{className:"Loading",children:Object(y.jsx)(k.a,{})})}}]),n}(r.Component),dt=Object(fe.a)((function(e){return{paper:{marginTop:e.spacing(8),display:"flex",flexDirection:"column",alignItems:"center"},avatar:{margin:e.spacing(1),backgroundColor:e.palette.secondary.main},form:{width:"100%",marginTop:e.spacing(1)},submit:{margin:e.spacing(3,0,2)}}}),{withTheme:!0})(lt),ut=n(244),ht=n(262),pt=n(255),mt=(n(189),function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var a;return Object(h.a)(this,n),(a=t.call(this,e)).state=e.state,a.formatSort=a.formatSort.bind(Object(m.a)(a)),a}return Object(p.a)(n,[{key:"formatSort",value:function(e){if(!e)return"Sort";for(var t=e.split("-"),n=0;n<t.length;n++)"asc"==t[n]?t[n]="ascending":"des"==t[n]&&(t[n]="descending"),t[n]=t[n].charAt(0).toUpperCase()+t[n].substring(1);return t.join(" ")}},{key:"render",value:function(){var e=this,t=this.state,n=t.genre,a=t.sort;return Object(y.jsxs)("div",{className:"SortMenu",children:[Object(y.jsxs)(ut.a,{variant:"outlined",className:"sort__container",children:[Object(y.jsx)(ht.a,{id:"sort-menu-label",children:this.formatSort(a)||"Sort"}),Object(y.jsxs)(pt.a,{labelId:"sort-menu-label",id:"sort-menu",value:"",label:this.formatSort(a)||"Sort",children:[Object(y.jsx)(c.b,{to:{pathname:this.props.props.location.pathname,search:"?sort=alphabet-asc&genre=".concat(n)},className:"no_decoration_link",children:Object(y.jsx)(v.a,{children:"Alphabet Ascending"})},we()),Object(y.jsx)(c.b,{to:{pathname:this.props.props.location.pathname,search:"?sort=alphabet-des&genre=".concat(n)},className:"no_decoration_link",children:Object(y.jsx)(v.a,{children:"Alphabet Descending"})},we()),Object(y.jsx)(c.b,{to:{pathname:this.props.props.location.pathname,search:"?sort=date-asc&genre=".concat(n)},className:"no_decoration_link",children:Object(y.jsx)(v.a,{children:"Date Ascending"})},we()),Object(y.jsx)(c.b,{to:{pathname:this.props.props.location.pathname,search:"?sort=date-des&genre=".concat(n)},className:"no_decoration_link",children:Object(y.jsx)(v.a,{children:"Date Descending"})},we()),Object(y.jsx)(c.b,{to:{pathname:this.props.props.location.pathname,search:"?sort=popularity-asc&genre=".concat(n)},className:"no_decoration_link",children:Object(y.jsx)(v.a,{children:"Popularity Ascending"})},we()),Object(y.jsx)(c.b,{to:{pathname:this.props.props.location.pathname,search:"?sort=popularity-des&genre=".concat(n)},className:"no_decoration_link",children:Object(y.jsx)(v.a,{children:"Popularity Descending"})},we()),Object(y.jsx)(c.b,{to:{pathname:this.props.props.location.pathname,search:"?sort=vote-asc&genre=".concat(n)},className:"no_decoration_link",children:Object(y.jsx)(v.a,{children:"Vote Ascending"})},we()),Object(y.jsx)(c.b,{to:{pathname:this.props.props.location.pathname,search:"?sort=vote-des&genre=".concat(n)},className:"no_decoration_link",children:Object(y.jsx)(v.a,{children:"Vote Descending"})},we()),Object(y.jsx)(c.b,{to:{pathname:this.props.props.location.pathname,search:"?sort=random&genre=".concat(n)},className:"no_decoration_link",children:Object(y.jsx)(v.a,{children:"Random"})},we())]})]}),Object(y.jsxs)(ut.a,{variant:"outlined",className:"sort__container",children:[Object(y.jsx)(ht.a,{id:"genre-menu-label",children:n||"Genre"}),Object(y.jsxs)(pt.a,{labelId:"genre-menu-label",id:"genre-menu",value:"",label:n||"Genre",children:[Object(y.jsx)(c.b,{to:{pathname:this.props.props.location.pathname,search:"?sort=&genre=".concat(n)},className:"no_decoration_link",children:Object(y.jsx)(v.a,{children:"All"})},we()),Object(y.jsx)(O.a,{}),["Action","Action & Adventure","Adventure","Animation","Comedy","Crime","Documentary","Drama","Ecchi","Family","Fantasy","Hentai","History","Horror","Kids","Mahou Shoujo","Mecha","Music","Mystery","News","Psychological","Reality","Romance","Sci-Fi","Sci-Fi & Fantasy","Science Fiction","Slice of Life","Soap","Sports","Supernatural","TV Movie","Talk","Thriller","War","War & Politics","Western"].map((function(t){return Object(y.jsx)(c.b,{to:{pathname:e.props.props.location.pathname,search:"?sort=".concat(a,"&genre=").concat(t)},className:"no_decoration_link",children:Object(y.jsx)(v.a,{children:t})},we())}))]})]})]})}}]),n}(r.Component)),jt=Object(fe.a)({withTheme:!0})(mt),bt=n(248),gt=n(249),ft=n(250),Ot=n(251),vt=n(135),xt=n.n(vt),wt=n(136),yt=n.n(wt),St=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var r;return Object(h.a)(this,n),(r=t.call(this,e)).state=Object(a.a)(Object(a.a)({},e.state),{},{isCreateOpen:!1}),r.handleCreateClose=r.handleCreateClose.bind(Object(m.a)(r)),r.handleCreateChange=r.handleCreateChange.bind(Object(m.a)(r)),r.handleCreateSubmit=r.handleCreateSubmit.bind(Object(m.a)(r)),r.handleListItemClick=r.handleListItemClick.bind(Object(m.a)(r)),r}return Object(p.a)(n,[{key:"handleCreateClose",value:function(e){this.setState({isCreateOpen:!1})}},{key:"handleCreateChange",value:function(e){this.setState({createValue:e.target.value})}},{key:"handleCreateSubmit",value:function(){var e=this.state.createValue,t=JSON.parse(window.localStorage.getItem("starred_lists")||"[]");if(-1==t.findIndex((function(t){return t.name==e}))){var n={categoryInfo:{id:"starred",name:e,type:"Starred"},name:e,children:[],type:"Starred"};t.push(n),window.localStorage.setItem("starred_lists",JSON.stringify(t)),this.setState({isCreateOpen:!1,starred_lists:t})}else this.setState({isCreateOpen:!1})}},{key:"handleListItemClick",value:function(e,t){if("createStarredList"==e&&-1==t)this.setState({isCreateOpen:!0});else{var n=this.props.metadata,a=JSON.parse(window.localStorage.getItem("starred_lists")||"[]"),r=a[t].children.findIndex((function(e){return e.id==n.id}));-1==r?(a[t].children.unshift(n),window.localStorage.setItem("starred_lists",JSON.stringify(a)),this.props.handleClose("unstarred"),this.setState({starred_lists:a})):(a[t].children.splice(r,1),window.localStorage.setItem("starred_lists",JSON.stringify(a)),this.props.handleClose())}}},{key:"render",value:function(){var e=this,t=this.props,n=t.isOpen,a=t.metadata,r=this.state.isCreateOpen,o=JSON.parse(window.localStorage.getItem("starred_lists")||"[]");return Object(y.jsxs)("div",{children:[Object(y.jsxs)(P.a,{onClose:this.props.handleClose,"aria-labelledby":"simple-dialog-title",open:n,children:[Object(y.jsx)(J.a,{id:"simple-dialog-title",children:"Select starred list"}),Object(y.jsxs)(re.a,{children:[o&&o.length?o.map((function(t,n){return Object(y.jsxs)(oe.a,{button:!0,onClick:function(){return e.handleListItemClick(t,n)},children:[Object(y.jsx)(bt.a,{children:Object(y.jsx)(Se.a,{style:t.children.some((function(e){return e.id==a.id}))?{backgroundColor:Dt.palette.success.main}:null,children:Object(y.jsx)(xt.a,{})})}),Object(y.jsx)(se.a,{primary:t.name})]},t.name)})):null,Object(y.jsx)("br",{}),Object(y.jsxs)(oe.a,{autoFocus:!0,button:!0,onClick:function(){return e.handleListItemClick("createStarredList",-1)},children:[Object(y.jsx)(bt.a,{children:Object(y.jsx)(Se.a,{children:Object(y.jsx)(yt.a,{})})}),Object(y.jsx)(se.a,{primary:"Create starred list"})]})]})]}),Object(y.jsxs)(P.a,{open:r,onClose:this.handleCreateClose,"aria-labelledby":"form-dialog-title",children:[Object(y.jsx)(J.a,{id:"form-dialog-title",children:"Create starred list"}),Object(y.jsxs)(gt.a,{children:[Object(y.jsx)(ft.a,{children:"Enter the starred list's name in the form below."}),Object(y.jsx)(Ce.a,{autoFocus:!0,margin:"dense",id:"name",label:"Name",type:"text",onChange:this.handleCreateChange,fullWidth:!0})]}),Object(y.jsxs)(Ot.a,{children:[Object(y.jsx)(T.a,{onClick:this.handleCreateClose,color:"primary",children:"Cancel"}),Object(y.jsx)(T.a,{onClick:this.handleCreateSubmit,color:"primary",children:"Create"})]})]})]})}}]),n}(r.Component),Ct=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var a;return Object(h.a)(this,n),(a=t.call(this,e)).state={starred_lists:JSON.parse(window.localStorage.getItem("starred_lists")||"[]")},a}return Object(p.a)(n,[{key:"render",value:function(){var e=this.state.starred_lists;return Object(y.jsxs)("div",{className:"StarredLists",children:[Object(y.jsx)(Ue,Object(a.a)({},this.props)),Object(y.jsx)(ue,{metadata:e,star:!0}),Object(y.jsx)(ve,{})]})}}]),n}(r.Component),kt=n(139),_t=Object(kt.a)({palette:{type:"light",primary:{main:"#4197fe"},secondary:{main:"#68a0e5"},error:{main:"#d32f2f"},warning:{main:"#ff9800"},success:{main:"#4caf50"},background:{default:"#fafafa",paper:"#e8e8e8"},text:{primary:"#0f0f0f"},common:{main:"#000000"}}}),It=Object(kt.a)({palette:{type:"dark",primary:{main:"#4197fe"},secondary:{main:"#68a0e5"},error:{main:"#d32f2f"},warning:{main:"#ff9800"},success:{main:"#4caf50"},background:{default:"#181a1b",paper:"#151617"},text:{primary:"#e8e6e3"},common:{main:"#ffffff"}}}),Nt=Object(kt.a)({palette:{type:"dark",primary:{main:"#6272a4"},secondary:{main:"#44475a"},error:{main:"#ffb86c"},warning:{main:"#ff5555"},success:{main:"#50fa7b"},background:{default:"#282a36",paper:"#242630"},text:{primary:"#f8f8f2"},common:{main:"#6272a4"}}}),Bt=Object(kt.a)({palette:{type:"dark",primary:{main:"#5E81AC"},secondary:{main:"#88C0D0"},error:{main:"#BF616A"},warning:{main:"#EBCB8B"},success:{main:"#A3BE8C"},background:{default:"#2E3440",paper:"#3B4252"},text:{primary:"#ECEFF4"},common:{main:"#81A1C1"}}}),Tt=JSON.parse(window.localStorage.getItem("ui_config")||window.sessionStorage.getItem("ui_config")||"{}");Tt.custom_theme&&(rt=Object(kt.a)(Tt.custom_theme)),"light"===window.localStorage.getItem("theme")||"light"===window.sessionStorage.getItem("theme")?ot=_t:"dark"===window.localStorage.getItem("theme")||"dark"===window.sessionStorage.getItem("theme")?ot=It:"dracula"===window.localStorage.getItem("theme")||"dracula"===window.sessionStorage.getItem("theme")?ot=Nt:"nord"===window.localStorage.getItem("theme")||"nord"===window.sessionStorage.getItem("theme")?ot=Bt:"custom"===window.localStorage.getItem("theme")||"custom"===window.sessionStorage.getItem("theme")?ot=rt:(ot=It,window.localStorage.setItem("theme","dark"),window.sessionStorage.setItem("theme","dark"));var Dt=ot,Et=n(137),Lt=n.n(Et),Rt=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var a;return Object(h.a)(this,n),(a=t.call(this,e)).state={menuAnchor:!1,ui_config:e.ui_config},a.handleClick=a.handleClick.bind(Object(m.a)(a)),a.handleClose=a.handleClose.bind(Object(m.a)(a)),a.handleTheme=a.handleTheme.bind(Object(m.a)(a)),a}return Object(p.a)(n,[{key:"handleClick",value:function(e){this.setState({menuAnchor:e.currentTarget})}},{key:"handleClose",value:function(e){this.setState({menuAnchor:!1})}},{key:"handleTheme",value:function(e){this.setState({menuAnchor:!1}),window.localStorage.setItem("theme",e),window.sessionStorage.setItem("theme",e),window.location.reload()}},{key:"render",value:function(){var e=this,t=this.state,n=t.menuAnchor,a=t.ui_config;return Object(y.jsxs)("div",{className:"ThemeMenu",children:[Object(y.jsx)(g.a,{"aria-label":"more","aria-controls":"theme-menu","aria-haspopup":"true",onClick:this.handleClick,children:Object(y.jsx)(Lt.a,{})}),Object(y.jsxs)(f.a,{id:"theme-menu",anchorEl:n,anchorOrigin:{vertical:"top",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},keepMounted:!0,open:Boolean(n),onClose:this.handleClose,children:[Object(y.jsx)(v.a,{onClick:function(){return e.handleTheme("light")},children:"Light"}),Object(y.jsx)(v.a,{onClick:function(){return e.handleTheme("dark")},children:"Dark"}),Object(y.jsx)(v.a,{onClick:function(){return e.handleTheme("dracula")},children:"Dracula"}),Object(y.jsx)(v.a,{onClick:function(){return e.handleTheme("nord")},children:"Nord"}),a.custom_theme?Object(y.jsxs)("div",{children:[Object(y.jsx)(O.a,{}),Object(y.jsx)(v.a,{onClick:function(){return e.handleTheme("custom")},children:"Custom"})]}):null]})]})}}]),n}(r.Component),At=(n(190),function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var a;return Object(h.a)(this,n),(a=t.call(this,e)).state={metadata:a.props.metadata,server:window.sessionStorage.getItem("server")||window.localStorage.getItem("server")||window.location.origin},a}return Object(p.a)(n,[{key:"render",value:function(){var e=this.state,t=e.metadata,n=e.server;return Object(y.jsx)("div",{className:"Tile",children:t.length?t.map((function(e){return Object(y.jsxs)("div",{className:"tile__category",children:[Object(y.jsx)(c.b,{to:"/browse/".concat(e.categoryInfo.name),className:"tile__category__title no_decoration_link",children:e.categoryInfo.name},we()),Object(y.jsx)("div",{className:"tile__items",children:e.children.length?e.children.map((function(e){return Object(y.jsxs)("figure",{className:"tile__item__figure",children:[Object(y.jsx)(c.b,{to:"/view/".concat("file"==e.type?"m":"tb","/").concat(e.id),children:Object(y.jsx)("img",{src:e.posterPath||"".concat(n,"/api/v1/image/poster?text=").concat(e.title,"&extention=jpeg"),className:"tile__item__poster",alt:e.title},we())},we()),Object(y.jsx)(M.a,{className:"tile__item__title",children:e.title},we())]},we())})):null})]},we())})):null})}}]),n}(r.Component)),Mt=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var r;return Object(h.a)(this,n),(r=t.call(this,e)).state=Object(a.a)(Object(a.a)({},e.state),{},{isCreateOpen:!1}),r}return Object(p.a)(n,[{key:"render",value:function(){var e=this.props,t=e.isOpen,n=e.metadata,a=e.trailer;return Object(y.jsx)("div",{children:Object(y.jsxs)(P.a,{onClose:this.props.handleClose,"aria-labelledby":"simple-dialog-title",fullWidth:!0,maxWidth:"lg",open:t||!1,children:[Object(y.jsxs)(J.a,{id:"simple-dialog-title",children:[n.title," - Trailer"]}),Object(y.jsx)("div",{style:{padding:"0 30px 30px 30px",height:"70vh"},children:Object(y.jsx)("iframe",{style:{width:"100%",height:"100%",borderRadius:"12px"},src:"https://www.youtube.com/embed/".concat(a.key),title:"".concat(n.title," - Trailer"),frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; fullscreen;",allowFullScreen:!0})})]})})}}]),n}(r.Component);var Pt=n(114),Jt=n(48),Ut=n.n(Jt),qt=n(62),Wt=n(252),Ft=n(264),Kt=n(266),Vt=n(86),zt=n.n(Vt),Ht=n(88),Gt=n.n(Ht),Yt=n(87),Xt=n.n(Yt),Qt=n(89),$t=n(85),Zt=n.n($t),en=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var r;return Object(h.a)(this,n),(r=t.call(this,e)).state=Object(a.a)(Object(a.a)({},e.state),{},{subtitleMenuAnchor:!1,tooltipOpen:!1,tooltipOpen2:!1,trailer:{}}),r.onFileChange=r.onFileChange.bind(Object(m.a)(r)),r.prettyDate=r.prettyDate.bind(Object(m.a)(r)),r.handleStar=r.handleStar.bind(Object(m.a)(r)),r.handleStarClose=r.handleStarClose.bind(Object(m.a)(r)),r.handleTrailer=r.handleTrailer.bind(Object(m.a)(r)),r.handleTrailerClose=r.handleTrailerClose.bind(Object(m.a)(r)),r.handleSubtitleMenuOpen=r.handleSubtitleMenuOpen.bind(Object(m.a)(r)),r.handleSubtitleMenuClose=r.handleSubtitleMenuClose.bind(Object(m.a)(r)),r}return Object(p.a)(n,[{key:"componentDidMount",value:function(){var e=this.state,t=e.metadata,n=e.ui_config;at({title:"".concat(n.title||"libDrive"," - ").concat(t.title||t.name),description:"Watch ".concat(t.title||t.name," on ").concat(n.title||"libDrive","! \u2014 ").concat(t.overview),image:t.backdropPath,type:"video.movie"})}},{key:"onFileChange",value:function(){var e=Object(qt.a)(Ut.a.mark((function e(t){var n;return Ut.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.target.files.length){e.next=11;break}if(!t.target.files[0].name.endsWith(".srt")){e.next=8;break}return e.next=4,Zt()(t.target.files[0]);case 4:n=e.sent,this.setState({file:n,fileName:t.target.files[0].name,playerKey:we()}),e.next=9;break;case 8:this.setState({file:URL.createObjectURL(t.target.files[0]),playerKey:we()});case 9:e.next=12;break;case 11:this.setState({file:null,playerKey:we()});case 12:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"prettyDate",value:function(){var e=this.state.metadata.releaseDate.split("-");return new Date(e[0],e[1],e[2]).toDateString()}},{key:"handleStar",value:function(){this.setState({openStarDialog:!0})}},{key:"handleStarClose",value:function(e){var t=this;"starred"==e?this.setState({openStarDialog:!1,starred:!0}):"unstarred"==e?this.setState({openStarDialog:!1,starred:JSON.parse(window.localStorage.getItem("starred_lists")||"[]").some((function(e){return e.children.some((function(e){return e.id==t.state.metadata.id}))}))||!1}):this.setState({openStarDialog:!1})}},{key:"handleTrailer",value:function(){var e=this,t=this.state,n=t.auth,a=t.metadata,r=t.server,o="".concat(r,"/api/v1/trailer/").concat(a.apiId),i="?a=".concat(n,"&t=movie&api=").concat(a.api);N.a.get(o+i).then((function(t){return e.setState({openTrailerDialog:!0,trailer:t.data.content})})).catch((function(t){if(console.error(t),t.response){var n=t.response.data;401===n.code?_.a.fire({title:"Error!",text:n.message,icon:"error",confirmButtonText:"Login",confirmButtonColor:Dt.palette.success.main}).then((function(t){t.isConfirmed&&e.props.history.push("/logout")})):r?_.a.fire({title:"Error!",text:"No trailer could be found.",icon:"error",confirmButtonText:"Ok",confirmButtonColor:Dt.palette.success.main}):e.props.history.push("/logout")}else t.request&&(r?_.a.fire({title:"Error!",text:"libDrive could not communicate with the server! Is '".concat(r,"' the correct address?"),icon:"error",confirmButtonText:"Logout",confirmButtonColor:Dt.palette.success.main,cancelButtonText:"Retry",cancelButtonColor:Dt.palette.error.main,showCancelButton:!0}).then((function(t){t.isConfirmed?e.props.history.push("/logout"):t.isDismissed&&location.reload()})):e.props.history.push("/logout"))}))}},{key:"handleTrailerClose",value:function(){this.setState({openTrailerDialog:!1})}},{key:"handleSubtitleMenuOpen",value:function(e){this.state.tracks.length?this.setState({subtitleMenuAnchor:e.currentTarget}):document.getElementById("file-input-button").click()}},{key:"handleSubtitleMenuClose",value:function(){this.setState({subtitleMenuAnchor:!1})}},{key:"render",value:function(){var e=this,t=this.state,n=t.default_track,a=t.default_video,r=t.file,o=t.fileName,i=t.metadata,s=t.playerKey,l=t.server,d=t.videos,u=t.starred,h=t.subtitleMenuAnchor,p=t.tracks,m=t.tooltipOpen,j=t.tooltipOpen2,b=t.trailer;return r&&(p=[{name:o,url:r}]),Object(y.jsxs)("div",{className:"MovieView",children:[Object(y.jsx)("div",{className:"plyr__component",children:Object(y.jsx)(Qt.a,{style:{borderRadius:"12px",borderWidth:"5px",borderColor:"black",borderStyle:"solid"},options:{video:{quality:d,defaultQuality:a,pic:i.backdropPath||"".concat(l,"/api/v1/image/thumbnail?id=").concat(i.id)},subtitle:p[n],preload:"auto",theme:Dt.palette.primary.main,contextmenu:[{text:"TheJagStudio",link:"https://github.com/TheJagStudio"}],screenshot:!0,volume:1,lang:"en"}},s)}),Object(y.jsxs)("div",{className:"info__container",children:[Object(y.jsx)("div",{className:"info__left",children:Object(y.jsx)("img",{className:"info__poster",src:i.posterPath||"".concat(l,"/api/v1/image/poster?text=").concat(encodeURIComponent(i.title),"&extention=jpeg")})}),Object(y.jsxs)("div",{className:"info__right",children:[Object(y.jsx)(Wt.a,{onClickAway:function(){return e.setState({tooltipOpen:!1})},children:Object(y.jsx)(A.a,{title:Object(y.jsx)(M.a,{variant:"subtitle2",children:i.name}),arrow:!0,placement:"top-start",open:m,disableFocusListener:!0,disableHoverListener:!0,disableTouchListener:!0,onClose:function(){return e.setState({tooltipOpen:!1})},PopperProps:{disablePortal:!0},children:Object(y.jsx)(M.a,{onClick:function(){return e.setState({tooltipOpen:!0})},variant:"h3",style:{fontWeight:"bold"},className:"info__title",children:i.title})})}),Object(y.jsx)(M.a,{variant:"body1",className:"info__overview",style:{marginTop:"30px"},children:i.overview}),Object(y.jsx)("div",{className:"vote__container",children:Object(y.jsx)(Wt.a,{onClickAway:function(){return e.setState({tooltipOpen2:!1})},children:Object(y.jsx)(A.a,{title:Object(y.jsxs)(M.a,{variant:"subtitle2",children:[i.voteAverage,"/10"]}),arrow:!0,placement:"right",open:j,disableFocusListener:!0,disableHoverListener:!0,disableTouchListener:!0,onClose:function(){return e.setState({tooltipOpen2:!1})},PopperProps:{disablePortal:!0},children:Object(y.jsx)("div",{onClick:function(){return e.setState({tooltipOpen2:!0})},children:Object(y.jsx)(Kt.a,{name:"Rating",value:i.voteAverage,max:10,readOnly:!0})})})})}),Object(y.jsxs)("div",{className:"info__release",children:[Object(y.jsx)(g.a,{onClick:this.handleStar,children:u?Object(y.jsx)(te.a,{}):Object(y.jsx)(zt.a,{})}),Object(y.jsx)(M.a,{style:{display:"flex",alignItems:"center"},variant:"body2",children:i.language?"".concat(this.prettyDate()," (").concat(i.language.toUpperCase(),")"):this.prettyDate()})]}),Object(y.jsxs)("div",{className:"info__buttons",children:[Object(y.jsx)($e,{state:this.state}),Object(y.jsx)(R,{state:this.state}),Object(y.jsx)("div",{className:"info__button",children:Object(y.jsx)(T.a,{variant:"outlined",color:"primary",style:{width:"135px"},onClick:this.handleTrailer,startIcon:Object(y.jsx)(Xt.a,{}),children:"Trailer"})}),Object(y.jsxs)("div",{className:"info__button",children:[Object(y.jsx)("input",{id:"file-input",hidden:!0,onChange:this.onFileChange,type:"file",accept:".vtt,.srt"}),Object(y.jsx)(T.a,{color:"primary",variant:"outlined",style:{width:"135px"},component:"span","aria-controls":"subtitles-menu",startIcon:Object(y.jsx)(Gt.a,{}),onClick:this.handleSubtitleMenuOpen,children:"Subtitle"}),Object(y.jsxs)(f.a,{id:"subtitles-menu",anchorEl:h,keepMounted:!0,anchorOrigin:{vertical:"top",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},open:Boolean(h),onClose:this.handleSubtitleMenuClose,children:[p.length?Object(y.jsxs)("div",{children:[p.map((function(t){return Object(y.jsx)("a",{className:"no_decoration_link",href:t.url,children:Object(y.jsx)(v.a,{onClick:e.handleSubtitleMenuClose,children:t.name})})})),Object(y.jsx)(O.a,{})]}):null,Object(y.jsx)(v.a,{onClick:function(){document.getElementById("file-input-button").click(),e.setState({subtitleMenuAnchor:!1})},children:"Upload"})]}),Object(y.jsx)("label",{htmlFor:"file-input",id:"file-input-button"})]})]}),Object(y.jsxs)("div",{className:"info__genres",children:[i.adult?Object(y.jsx)(Ft.a,{color:"secondary",avatar:Object(y.jsx)(Se.a,{children:"E"}),className:"info__genre",label:"Adult (18+)",variant:"outlined"}):null,i.genres&&i.genres.length?i.genres.map((function(e){return Object(y.jsx)(c.b,{to:"/genres?genre=".concat(e),className:"no_decoration_link",children:Object(y.jsx)(Ft.a,{avatar:Object(y.jsx)(Se.a,{children:e.charAt(0)}),className:"info__genre",label:e,variant:"outlined"})},we())})):null]})]})]}),Object(y.jsx)(St,{isOpen:this.state.openStarDialog,handleClose:this.handleStarClose,metadata:i}),Object(y.jsx)(Mt,{isOpen:this.state.openTrailerDialog,handleClose:this.handleTrailerClose,metadata:i,trailer:b})]})}}]),n}(r.Component),tn=n(95),nn=n.n(tn),an=n(96),rn=n.n(an),on=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var r;return Object(h.a)(this,n),(r=t.call(this,e)).state=Object(a.a)(Object(a.a)({},e.state),{},{tooltipOpen:!1,tooltipOpen2:!1,trailer:{}}),r.prettyDate=r.prettyDate.bind(Object(m.a)(r)),r.handleStar=r.handleStar.bind(Object(m.a)(r)),r.handleStarClose=r.handleStarClose.bind(Object(m.a)(r)),r.handleTrailer=r.handleTrailer.bind(Object(m.a)(r)),r.handleTrailerClose=r.handleTrailerClose.bind(Object(m.a)(r)),r}return Object(p.a)(n,[{key:"componentDidMount",value:function(){var e=this.state,t=e.metadata,n=e.ui_config;at({title:"".concat(n.title||"libDrive"," - ").concat(t.title||t.name),description:"Watch ".concat(t.title||t.name," on ").concat(n.title||"libDrive","! \u2014 ").concat(t.overview),image:t.backdropPath,type:"video.movie"})}},{key:"prettyDate",value:function(){var e=this.state.metadata.releaseDate.split("-");return new Date(e[0],e[1],e[2]).toDateString()}},{key:"handleStar",value:function(){this.setState({openStarDialog:!0})}},{key:"handleStarClose",value:function(e){var t=this;"starred"==e?this.setState({openStarDialog:!1,starred:!0}):"unstarred"==e?this.setState({openStarDialog:!1,starred:JSON.parse(window.localStorage.getItem("starred_lists")||"[]").some((function(e){return e.children.some((function(e){return e.id==t.state.metadata.id}))}))||!1}):this.setState({openStarDialog:!1})}},{key:"handleTrailer",value:function(){var e=this,t=this.state,n=t.auth,a=t.metadata,r=t.server;if(t.trailer.key)this.setState({openTrailerDialog:!0});else{var o="".concat(r,"/api/v1/trailer/").concat(a.apiId),i="?a=".concat(n,"&t=tv&api=").concat(a.api);N.a.get(o+i).then((function(t){return e.setState({openTrailerDialog:!0,trailer:t.data.content})})).catch((function(t){if(console.error(t),t.response){var n=t.response.data;401===n.code?_.a.fire({title:"Error!",text:n.message,icon:"error",confirmButtonText:"Login",confirmButtonColor:Dt.palette.success.main}).then((function(t){t.isConfirmed&&e.props.history.push("/logout")})):r?_.a.fire({title:"Error!",text:"No trailer could be found.",icon:"error",confirmButtonText:"Ok",confirmButtonColor:Dt.palette.success.main}):e.props.history.push("/logout")}else t.request&&(r?_.a.fire({title:"Error!",text:"Something went wrong while looking for trailers.",icon:"error",confirmButtonText:"Ok",confirmButtonColor:Dt.palette.success.main}):e.props.history.push("/logout"))}))}}},{key:"handleTrailerClose",value:function(){this.setState({openTrailerDialog:!1})}},{key:"render",value:function(){var e=this,t=this.state,n=t.metadata,a=t.server,r=t.starred,o=t.tooltipOpen,i=t.tooltipOpen2,s=t.trailer;return Object(y.jsxs)("div",{className:"TVBView",children:[Object(y.jsxs)("div",{className:"info__container",children:[Object(y.jsxs)("div",{className:"info__left",children:[Object(y.jsx)("img",{className:"info__poster",src:n.posterPath||"".concat(a,"/api/v1/image/poster?text=").concat(n.title,"&extention=jpeg")}),Object(y.jsx)("img",{className:"info__backdrop",src:n.backdropPath||"".concat(a,"/api/v1/image/backdrop?text=").concat(n.title,"&extention=jpeg")})]}),Object(y.jsxs)("div",{className:"info__right",children:[Object(y.jsx)(Wt.a,{onClickAway:function(){return e.setState({tooltipOpen:!1})},children:Object(y.jsx)(A.a,{title:Object(y.jsx)(M.a,{variant:"subtitle2",children:n.name}),arrow:!0,placement:"top-start",open:o,disableFocusListener:!0,disableHoverListener:!0,disableTouchListener:!0,onClose:function(){return e.setState({tooltipOpen:!1})},PopperProps:{disablePortal:!0},children:Object(y.jsx)(M.a,{onClick:function(){return e.setState({tooltipOpen:!0})},variant:"h3",style:{fontWeight:"bold"},className:"info__title",children:n.title})})}),Object(y.jsx)(M.a,{variant:"body1",className:"info__overview",style:{marginTop:"30px"},children:n.overview}),Object(y.jsx)("div",{className:"vote__container",children:Object(y.jsx)(Wt.a,{onClickAway:function(){return e.setState({tooltipOpen2:!1})},children:Object(y.jsx)(A.a,{title:Object(y.jsxs)(M.a,{variant:"subtitle2",children:[n.voteAverage,"/10"]}),arrow:!0,placement:"right",open:i,disableFocusListener:!0,disableHoverListener:!0,disableTouchListener:!0,onClose:function(){return e.setState({tooltipOpen2:!1})},PopperProps:{disablePortal:!0},children:Object(y.jsx)("div",{onClick:function(){return e.setState({tooltipOpen2:!0})},children:Object(y.jsx)(Kt.a,{name:"Rating",value:n.voteAverage,max:10,readOnly:!0})})})})}),Object(y.jsxs)("div",{className:"info__release",children:[Object(y.jsx)(g.a,{onClick:this.handleStar,children:r?Object(y.jsx)(te.a,{}):Object(y.jsx)(zt.a,{})}),Object(y.jsx)(M.a,{style:{display:"flex",alignItems:"center"},variant:"body2",children:n.language?"".concat(this.prettyDate()," (").concat(n.language.toUpperCase(),")"):this.prettyDate()})]}),Object(y.jsxs)("div",{className:"info__buttons2",children:[Object(y.jsx)(ge,{state:this.state}),Object(y.jsx)("div",{className:"info__button2",children:Object(y.jsx)(T.a,{variant:"outlined",color:"primary",style:{width:"135px"},onClick:this.handleTrailer,startIcon:Object(y.jsx)(Xt.a,{}),children:"Trailer"})})]}),Object(y.jsx)("div",{className:"info__genres",children:n.genres&&n.genres.length?n.genres.map((function(e){return Object(y.jsx)(c.b,{to:"/genres?genre=".concat(e),className:"no_decoration_link",children:Object(y.jsx)(Ft.a,{avatar:Object(y.jsx)(Se.a,{children:e.charAt(0)}),className:"info__genre",label:e,variant:"outlined"})},we())})):null})]})]}),Object(y.jsx)(St,{isOpen:this.state.openStarDialog,handleClose:this.handleStarClose,metadata:n}),Object(y.jsx)(Mt,{isOpen:this.state.openTrailerDialog,handleClose:this.handleTrailerClose,metadata:n,trailer:s})]})}}]),n}(r.Component),sn=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var r;return Object(h.a)(this,n),(r=t.call(this,e)).state=Object(a.a)(Object(a.a)({},e.state),{},{subtitleMenuAnchor:!1}),r.onFileChange=r.onFileChange.bind(Object(m.a)(r)),r.handleSubtitleMenuOpen=r.handleSubtitleMenuOpen.bind(Object(m.a)(r)),r.handleSubtitleMenuClose=r.handleSubtitleMenuClose.bind(Object(m.a)(r)),r.handleClickImage=r.handleClickImage.bind(Object(m.a)(r)),r.handleCloseDialog=r.handleCloseDialog.bind(Object(m.a)(r)),r.handleParentSeason=r.handleParentSeason.bind(Object(m.a)(r)),r}return Object(p.a)(n,[{key:"componentDidMount",value:function(){var e=this.state,t=e.metadata,n=e.q,a=e.ui_config;at({title:"".concat(a.title||"libDrive"," - ").concat(t.children[n].name),description:"Watch ".concat(t.children[n].name," on ").concat(a.title||"libDrive","!"),type:"video.episode"})}},{key:"componentWillUnmount",value:function(){var e=this.state,t=e.id,n=e.q,a=e.watching;a[t]=n,window.localStorage.setItem("watching",JSON.stringify(a))}},{key:"onFileChange",value:function(){var e=Object(qt.a)(Ut.a.mark((function e(t){var n;return Ut.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.target.files.length){e.next=11;break}if(!t.target.files[0].name.endsWith(".srt")){e.next=8;break}return e.next=4,Zt()(t.target.files[0]);case 4:n=e.sent,this.setState({file:n,fileName:t.target.files[0].name,playerKey:we()}),e.next=9;break;case 8:this.setState({file:URL.createObjectURL(t.target.files[0]),playerKey:we()});case 9:e.next=12;break;case 11:this.setState({file:null,playerKey:we()});case 12:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"handleSubtitleMenuOpen",value:function(e){this.state.tracks.length?this.setState({subtitleMenuAnchor:e.currentTarget}):document.getElementById("file-input-button").click()}},{key:"handleSubtitleMenuClose",value:function(){this.setState({subtitleMenuAnchor:!1})}},{key:"handleClickImage",value:function(e){this.setState({image_url:e})}},{key:"handleCloseDialog",value:function(){this.setState({image_url:null})}},{key:"handleParentSeason",value:function(e){var t=this.state,n=t.metadata,a=t.parent_index;e?n.parent_children[a+1]&&this.props.history.push("/view/ts/".concat(n.parent_children[a+1].id)):n.parent_children[a-1]&&this.props.history.push("/view/ts/".concat(n.parent_children[a-1].id))}},{key:"render",value:function(){var e=this,t=this.state,n=t.default_track,r=t.default_video,o=t.file,i=t.fileName,s=t.image_url,l=t.metadata,d=t.parent_index,u=t.playerKey,h=t.q,p=t.server,m=t.videos,j=t.tracks,b=t.subtitleMenuAnchor;function x(e,t){return e===t?"pls-playing":""}return o&&(j=[{name:i,url:o}]),Object(y.jsxs)("div",{className:"TVSView",children:[Object(y.jsxs)(P.a,{onClose:this.handleCloseDialog,"aria-labelledby":"img-dialog",open:!!s,children:[Object(y.jsx)(J.a,{id:"img-dialog",children:"Thumbnail"}),Object(y.jsx)("img",{src:s,style:{padding:"25px"}})]}),Object(y.jsxs)("div",{className:"plyr__component",children:[Object(y.jsx)(Qt.a,{style:{borderRadius:"12px 12px 0 0",borderWidth:"4px 4px 0 4px",borderColor:"black",borderStyle:"solid"},options:{video:{quality:m,defaultQuality:r,pic:"".concat(p,"/api/v1/image/thumbnail?id=").concat(l.children[h].id)},subtitle:j[n],preload:"auto",theme:Dt.palette.primary.main,contextmenu:[{text:"libDrive",link:"https://github.com/libDrive/libDrive"}],screenshot:!0,volume:1,lang:"en"}},u),Object(y.jsx)("div",{className:"plyr-playlist-wrapper",children:Object(y.jsx)("ul",{className:"plyr-playlist",children:l.children.length?l.children.map((function(t,n){return Object(y.jsx)("li",{className:x(n,h),children:Object(y.jsxs)("div",{children:[Object(y.jsx)("img",{onClick:function(){return e.handleClickImage("".concat(p,"/api/v1/image/thumbnail?id=").concat(t.id))},onError:function(e){return e.target.style="display: none;"},src:"".concat(p,"/api/v1/image/thumbnail?id=").concat(t.id),className:"plyr-miniposter"}),Object(y.jsx)(c.b,{to:{pathname:window.location.pathname,search:"?q=".concat(n)},className:"plyr-miniposter-link",children:Object(y.jsx)("div",{children:t.name})},we())]})},n)})):null})})]}),Object(y.jsx)("div",{className:"file__info",style:{background:Dt.palette.background.paper},children:Object(y.jsxs)("div",{style:{display:"flex",width:"100%",justifyContent:"space-between"},children:[l.parent_children[d-1]?Object(y.jsx)(A.a,{title:l.parent_children[d-1]?l.parent_children[d-1].name:null,placement:"left",children:Object(y.jsx)(g.a,{onClick:function(){return e.handleParentSeason(!1)},style:{justifySelf:"flex-start",marginLeft:"5px"},children:Object(y.jsx)(nn.a,{})})}):Object(y.jsx)("div",{className:"MuiIconButton-root MuiButtonBase-root",style:{justifySelf:"flex-end",marginLeft:"5px"},children:Object(y.jsx)(nn.a,{color:"disabled"})}),Object(y.jsxs)("div",{style:{display:"flex",alignContent:"center",justifyContent:"center",flexWrap:"wrap",margin:"20px 5px 20px 5px"},children:[Object(y.jsx)($e,{state:Object(a.a)(Object(a.a)({},this.state),{},{id:l.children[h].id,metadata:l.children[h]})}),Object(y.jsx)(R,{state:this.state,tv:!0}),Object(y.jsx)(tt,{state:this.state}),Object(y.jsxs)("div",{className:"info__button",children:[Object(y.jsx)("input",{id:"file-input",hidden:!0,onChange:this.onFileChange,type:"file",accept:".vtt,.srt"}),Object(y.jsx)(T.a,{color:"primary",variant:"outlined",style:{width:"135px"},component:"span","aria-controls":"subtitles-menu",startIcon:Object(y.jsx)(Gt.a,{}),onClick:this.handleSubtitleMenuOpen,children:"Subtitle"}),Object(y.jsxs)(f.a,{id:"subtitles-menu",anchorEl:b,keepMounted:!0,anchorOrigin:{vertical:"top",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},open:Boolean(b),onClose:this.handleSubtitleMenuClose,children:[j.length?Object(y.jsxs)("div",{children:[j.map((function(t){return Object(y.jsx)("a",{className:"no_decoration_link",href:t.url,children:Object(y.jsx)(v.a,{onClick:e.handleSubtitleMenuClose,children:t.name})})})),Object(y.jsx)(O.a,{})]}):null,Object(y.jsx)(v.a,{onClick:function(){document.getElementById("file-input-button").click(),e.setState({subtitleMenuAnchor:!1})},children:"Upload"})]}),Object(y.jsx)("label",{htmlFor:"file-input",id:"file-input-button"})]})]}),l.parent_children[d+1]?Object(y.jsx)(A.a,{title:l.parent_children[d+1]?l.parent_children[d+1].name:null,placement:"right",children:Object(y.jsx)(g.a,{onClick:function(){return e.handleParentSeason(!0)},style:{justifySelf:"flex-end",marginRight:"5px"},children:Object(y.jsx)(rn.a,{})})}):Object(y.jsx)("div",{className:"MuiIconButton-root MuiButtonBase-root",style:{justifySelf:"flex-end",marginRight:"5px"},children:Object(y.jsx)(rn.a,{color:"disabled"})})]})})]})}}]),n}(r.Component),cn=(n(192),function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var a;return Object(h.a)(this,n),(a=t.call(this,e)).state={auth:window.sessionStorage.getItem("auth")||window.localStorage.getItem("auth")||"0",id:a.props.match.params.id,isAndroid:/(android)/i.test(navigator.userAgent||navigator.vendor||window.opera),isIOS:/iPad|iPhone|iPod/.test(navigator.userAgent||navigator.vendor||window.opera)&&!window.MSStream,isLoaded:!1,metadata:{},openStarDialog:!1,playerKey:we(),q:pe.a.parse(a.props.location.search).q||JSON.parse(window.localStorage.getItem("watching")||"{}")[a.props.match.params.id]||0,server:window.sessionStorage.getItem("server")||window.localStorage.getItem("server")||window.location.origin,videos:[],starred:JSON.parse(window.localStorage.getItem("starred_lists")||"[]").some((function(e){return e.children.some((function(e){return e.id==a.props.match.params.id}))}))||!1,tracks:[{name:null,url:null}],type:a.props.type,ui_config:JSON.parse(window.localStorage.getItem("ui_config")||window.sessionStorage.getItem("ui_config")||"{}"),watching:JSON.parse(window.localStorage.getItem("watching")||"{}")},a}return Object(p.a)(n,[{key:"componentDidMount",value:function(){var e=Object(qt.a)(Ut.a.mark((function e(){var t,n,a,r,o,i,s,c,l,d,u,h,p,m,j,b,g,f=this;return Ut.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.state,n=t.auth,a=t.id,r=t.q,o=t.server,i=t.type,r=parseInt(r),n&&o||this.props.history.push("/logout"),document.documentElement.style.setProperty("--plyr-color-main",Dt.palette.primary.main),document.documentElement.style.setProperty("--plyr-video-background",Dt.palette.background.default),document.documentElement.style.setProperty("--plyr-menu-background",Dt.palette.background.paper),document.documentElement.style.setProperty("--plyr-menu-color",Dt.palette.text.primary),s="".concat(o,"/api/v1/metadata"),c="?a=".concat(n,"&id=").concat(encodeURIComponent(a)),e.next=11,N.a.get(s+c).catch((function(e){if(console.error(e),e.response){var t=e.response.data;401===t.code?_.a.fire({title:"Error!",text:t.message,icon:"error",confirmButtonText:"Login",confirmButtonColor:Dt.palette.success.main}).then((function(e){e.isConfirmed&&f.props.history.push("/logout")})):o?_.a.fire({title:"Error!",text:"Something went wrong while communicating with the server! Is '".concat(o,"' the correct address?"),icon:"error",confirmButtonText:"Logout",confirmButtonColor:Dt.palette.success.main,cancelButtonText:"Retry",cancelButtonColor:Dt.palette.error.main,showCancelButton:!0}).then((function(e){e.isConfirmed?f.props.history.push("/logout"):e.isDismissed&&location.reload()})):f.props.history.push("/logout")}else e.request&&(o?_.a.fire({title:"Error!",text:"libDrive could not communicate with the server! Is '".concat(o,"' the correct address?"),icon:"error",confirmButtonText:"Logout",confirmButtonColor:Dt.palette.success.main,cancelButtonText:"Retry",cancelButtonColor:Dt.palette.error.main,showCancelButton:!0}).then((function(e){e.isConfirmed?f.props.history.push("/logout"):e.isDismissed&&location.reload()})):f.props.history.push("/logout"))}));case 11:if(l=e.sent,d=l.data.content,"m"!=i){e.next=21;break}return h="".concat(o,"/api/v1/streammap"),p="?a=".concat(n,"&id=").concat(encodeURIComponent(a),"&parent=").concat(d.parents[0],"&name=").concat(encodeURIComponent(d.name),"&t=").concat(d.type,"&server=").concat(encodeURIComponent(o)),e.next=18,N.a.get(h+p).catch((function(e){if(console.error(e),e.response){var t=e.response.data;401===t.code?_.a.fire({title:"Error!",text:t.message,icon:"error",confirmButtonText:"Login",confirmButtonColor:Dt.palette.success.main}).then((function(e){e.isConfirmed&&f.props.history.push("/logout")})):o?_.a.fire({title:"Error!",text:"Something went wrong while communicating with the server! Is '".concat(o,"' the correct address?"),icon:"error",confirmButtonText:"Logout",confirmButtonColor:Dt.palette.success.main,cancelButtonText:"Retry",cancelButtonColor:Dt.palette.error.main,showCancelButton:!0}).then((function(e){e.isConfirmed?f.props.history.push("/logout"):e.isDismissed&&location.reload()})):f.props.history.push("/logout")}else e.request&&(o?_.a.fire({title:"Error!",text:"libDrive could not communicate with the server! Is '".concat(o,"' the correct address?"),icon:"error",confirmButtonText:"Logout",confirmButtonColor:Dt.palette.success.main,cancelButtonText:"Retry",cancelButtonColor:Dt.palette.error.main,showCancelButton:!0}).then((function(e){e.isConfirmed?f.props.history.push("/logout"):e.isDismissed&&location.reload()})):f.props.history.push("/logout"))}));case 18:u=e.sent,e.next=31;break;case 21:if("ts"!=i){e.next=31;break}if(!d.children.length||!d.children[r]){e.next=30;break}return m="".concat(o,"/api/v1/streammap"),j="?a=".concat(n,"&id=").concat(encodeURIComponent(d.children[r].id),"&parent=").concat(a,"&name=").concat(encodeURIComponent(d.children[r].name),"&t=").concat(d.children[r].type,"&server=").concat(encodeURIComponent(o)),e.next=27,N.a.get(m+j).catch((function(e){if(console.error(e),e.response){var t=e.response.data;401===t.code?_.a.fire({title:"Error!",text:t.message,icon:"error",confirmButtonText:"Login",confirmButtonColor:Dt.palette.success.main}).then((function(e){e.isConfirmed&&f.props.history.push("/logout")})):o?_.a.fire({title:"Error!",text:"Something went wrong while communicating with the server! Is '".concat(o,"' the correct address?"),icon:"error",confirmButtonText:"Logout",confirmButtonColor:Dt.palette.success.main,cancelButtonText:"Retry",cancelButtonColor:Dt.palette.error.main,showCancelButton:!0}).then((function(e){e.isConfirmed?f.props.history.push("/logout"):e.isDismissed&&location.reload()})):f.props.history.push("/logout")}else e.request&&(o?_.a.fire({title:"Error!",text:"libDrive could not communicate with the server! Is '".concat(o,"' the correct address?"),icon:"error",confirmButtonText:"Logout",confirmButtonColor:Dt.palette.success.main,cancelButtonText:"Retry",cancelButtonColor:Dt.palette.error.main,showCancelButton:!0}).then((function(e){e.isConfirmed?f.props.history.push("/logout"):e.isDismissed&&location.reload()})):f.props.history.push("/logout"))}));case 27:u=e.sent,e.next=31;break;case 30:u={data:{content:{default_video:0,videos:[],subtitles:[]}}};case 31:if(d.parent_children)for(g=0;g<d.parent_children.length;g++)d.parent_children[g].id==a&&(b=g);"m"==i||"ts"==i?this.setState({default_track:u.data.content.default_track,default_video:u.data.content.default_video,isLoaded:!0,metadata:l.data.content,parent_index:b,q:r,type:i,videos:u.data.content.videos,tracks:u.data.content.tracks}):this.setState({isLoaded:!0,metadata:l.data.content,type:i});case 33:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"componentWillUnmount",value:function(){at()}},{key:"render",value:function(){var e=this.state,t=e.isLoaded,n=e.metadata,r=e.ui_config;return t&&at({title:n.title?"".concat(r.title||"libDrive"," - ").concat(n.title):r.title||"libDrive",description:"Watch ".concat(n.title||n.name," on ").concat(r.title||"libDrive","!"),image:n.backdropPath}),t&&"file"==n.type?Object(y.jsxs)("div",{className:"View",children:[Object(y.jsx)(Ue,Object(a.a)({},this.props)),Object(y.jsx)(en,{state:this.state}),Object(y.jsx)(ve,{})]}):t&&"directory"==n.type&&n.title?Object(y.jsxs)("div",{className:"View",children:[Object(y.jsx)(Ue,Object(a.a)({},this.props)),Object(y.jsx)(on,{state:this.state}),Object(y.jsx)(ve,{})]}):t&&"directory"==n.type?Object(y.jsxs)("div",{className:"View",children:[Object(y.jsx)(Ue,Object(a.a)({},this.props)),Object(y.jsx)(sn,{state:this.state,history:this.props.history}),Object(y.jsx)(ve,{})]}):Object(y.jsx)("div",{className:"Loading",children:Object(y.jsx)(k.a,{})})}}]),n}(r.Component));n(193);s.a.render(Object(y.jsx)(c.a,{children:Object(y.jsxs)(u.a,{theme:Dt,children:[Object(y.jsx)(d.a,{}),Object(y.jsxs)(l.d,{children:[Object(y.jsx)(l.b,{exact:!0,path:"/",render:function(e){return Object(y.jsx)(C,Object(a.a)({},e),we())}}),Object(y.jsx)(l.b,{exact:!0,path:"/browse",render:function(e){return Object(y.jsx)(B,Object(a.a)({},e),we())}}),Object(y.jsx)(l.b,{exact:!0,path:"/browse/:category",render:function(e){return Object(y.jsx)(me,Object(a.a)({},e),we())}}),Object(y.jsx)(l.b,{exact:!0,path:"/starred",render:function(e){return Object(y.jsx)(Ct,Object(a.a)({},e),we())}}),Object(y.jsx)(l.b,{exact:!0,path:"/genres",render:function(e){return Object(y.jsx)(xe,Object(a.a)({},e),we())}}),Object(y.jsx)(l.b,{exact:!0,path:"/login",render:function(e){return Object(y.jsx)(Ne,Object(a.a)({},e),we())}}),Object(y.jsx)(l.b,{exact:!0,path:"/logout",render:function(e){return Object(y.jsx)(Be,Object(a.a)({},e),we())}}),Object(y.jsx)(l.b,{exact:!0,path:"/search/:q",render:function(e){return Object(y.jsx)(nt,Object(a.a)({},e),we())}}),Object(y.jsx)(l.b,{exact:!0,path:"/settings",render:function(e){return Object(y.jsx)(ct,Object(a.a)({},e),we())}}),Object(y.jsx)(l.b,{exact:!0,path:"/settings/login",render:function(e){return Object(y.jsx)(dt,Object(a.a)({},e),we())}}),Object(y.jsx)(l.b,{exact:!0,path:"/view/m/:id",render:function(e){return Object(y.jsx)(cn,Object(a.a)({type:"m"},e),we())}}),Object(y.jsx)(l.b,{exact:!0,path:"/view/tb/:id",render:function(e){return Object(y.jsx)(cn,Object(a.a)({type:"tb"},e),we())}}),Object(y.jsx)(l.b,{exact:!0,path:"/view/ts/:id",render:function(e){return Object(y.jsx)(cn,Object(a.a)({type:"ts"},e),we())}}),Object(y.jsx)(l.b,{path:"",render:function(e){return Object(y.jsx)(Ve,Object(a.a)({},e),we())}})]})]})}),document.getElementById("root"))}},[[194,1,2]]]);
//# sourceMappingURL=main.4c186c3c.chunk.js.map