text: (function(t){function e(e){for(var n,r,a=e[0],d=e[1],u=e[2],c=0,v=[];c<a.length;c++)r=a[c],Object.prototype.hasOwnProperty.call(o,r)&&o[r]&&v.push(o[r][0]),o[r]=0;for(n in d)Object.prototype.hasOwnProperty.call(d,n)&&(t[n]=d[n]);l&&l(e);while(v.length)v.shift()();return s.push.apply(s,u||[]),i()}function i(){for(var t,e=0;e<s.length;e++){for(var i=s[e],n=!0,a=1;a<i.length;a++){var d=i[a];0!==o[d]&&(n=!1)}n&&(s.splice(e--,1),t=r(r.s=i[0]))}return t}var n={},o={app:0},s=[];function r(e){if(n[e])return n[e].exports;var i=n[e]={i:e,l:!1,exports:{}};return t[e].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=t,r.c=n,r.d=function(t,e,i){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},r.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)r.d(i,n,function(e){return t[e]}.bind(null,n));return i},r.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="/";var a=window["webpackJsonp"]=window["webpackJsonp"]||[],d=a.push.bind(a);a.push=e,a=a.slice();for(var u=0;u<a.length;u++)e(a[u]);var l=d;s.push([0,"chunk-vendors"]),i()})({0:function(t,e,i){t.exports=i("56d7")},"034f":function(t,e,i){"use strict";var n=i("85ec"),o=i.n(n);o.a},"07d6":function(t,e,i){},"07e6":function(t,e,i){t.exports=i.p+"static/img/info.7da79fd6.svg"},"22d4":function(t,e,i){"use strict";var n=i("91a2"),o=i.n(n);o.a},4e3:function(t,e,i){},"56d7":function(t,e,i){"use strict";i.r(e);i("e260"),i("e6cf"),i("cca6"),i("a79d");var n=i("2b0e"),o=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{attrs:{id:"app"}},[i("list",{ref:"listRef",attrs:{videos:t.videos,status:t.status,update:t.update,current_id:t.current.id},on:{change:t.changeCurrent,"del-video":t.deleteVideo,"add-video":t.addVideo}}),i("settings",{attrs:{video:t.current},on:{"update-settings":t.update_settings}}),i("general",{attrs:{folder:t.folder,status:t.status},on:{start:t.start,"set-folder":t.set_folder}})],1)},s=[],r=(i("a4d3"),i("e01a"),i("d28b"),i("99af"),i("a623"),i("4de4"),i("4160"),i("d3b7"),i("3ca3"),i("159b"),i("ddb0"),i("96cf"),i("1da1")),a=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{attrs:{id:"list"}},[""!==t.status||t.update?t._e():i("div",{staticClass:"info"},[i("p",[t._v(" Start adding videos by entering the url in the text field below. Then choose a destination folder and hit start in the bottom right ")])]),t.update&&""===t.status?i("div",{staticClass:"info",attrs:{id:"updateMessage"}},[i("p",[t._v("An update is available! Start the update by clicking "),i("a",{attrs:{href:"https://jaguardownloader.netlify.com/#download",target:"_blank"},on:{click:t.closer}},[t._v("this link")]),t._v(".")])]):t._e(),i("addVideo",{ref:"addVideo",on:{"add-video":function(e){t.$emit("add-video",e)}}}),i("div",{attrs:{id:"videowrapper"}},t._l(t.videos,(function(e){return i("div",{key:e.id,attrs:{id:"items"}},[i("videoItem",{staticClass:"videoItem",attrs:{video:e,current:t.current_id},on:{current:function(i){return t.$emit("change",e)},"del-video":function(i){return t.$emit("del-video",e.id)}}})],1)})),0),"FINISHED!"===t.status&&0===this.videos.length?i("div",{attrs:{id:"finished"}},[i("p",[t._v("FINISHED!")])]):t._e()],1)},d=[],u=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{attrs:{id:"addVideo"}},[i("form",{on:{submit:t.addVideo}},[i("label",{attrs:{for:"add video"}},[t._v("ADD URL")]),i("input",{directives:[{name:"model",rawName:"v-model",value:t.url,expression:"url"}],attrs:{id:"url_input",type:"text",placeholder:"enter url"},domProps:{value:t.url},on:{input:function(e){e.target.composing||(t.url=e.target.value)}}}),i("input",{staticClass:"button",attrs:{type:"submit",value:"enter"}}),t._m(0)]),t._m(1),i("div",{attrs:{id:"playlist"}},[i("p",[t._v("Playlist detected! Do you want to download the entire playlist?")]),i("button",{on:{click:t.yes}},[t._v(" YES ")]),i("button",{on:{click:t.no}},[t._v(" NO ")])])])},l=[function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"lds-ellipsis"},[i("div"),i("div"),i("div"),i("div")])},function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{attrs:{id:"invalid"}},[i("p",[t._v("Something went wrong! Check your internet connection or the url.")])])}],c=(i("caad"),i("ac1f"),i("2532"),i("5319"),["2160p","1440p","1080p","720p","480p","240p"]),v={name:"AddVideo",data:function(){return{url_playlist:"",videos:[],url:""}},methods:{addVideo:function(t){var e=this;t.preventDefault();var i=document.getElementsByClassName("lds-ellipsis")[0];i.style.display="inline-block",fetch("http://127.0.0.1:5000/add",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({url:this.url})}).then((function(t){return t.json()})).then((function(t){if(t.forEach((function(t){t.settings={ext:"mkv",type:"video",tag:!1,tags:{},filename:t.title.replace(/[/\\?%*:|"<>]/g,""),duration:t.duration},t.filesize="unknown",t.resolutions=new Array,t.mp4_resolutions=new Array,t.status="ready to download",t.progress=0,t.formats.forEach((function(e){c.includes(e.format_note)&&!t.resolutions.includes(e.format_note)&&t.resolutions.push(e.format_note),"mp4"===e.ext&&c.includes(e.format_note)&&t.mp4_resolutions.push(e.format_note)})),t.resolutions.includes("1080p")?t.settings.quality="1080p":t.settings.quality=t.resolutions[t.resolutions.length-1]})),i.style.display="none",t.length>1){var n=document.getElementById("addVideo"),o=document.getElementById("playlist");n.style.height="90px",o.style.display="flex",e.url_playlist=e.url,e.videos=t}else e.$emit("add-video",t)})).catch((function(t){e.invalid(!1),console.error(t),i.style.display="none"}))},yes:function(){this.$emit("add-video",this.videos),document.getElementById("addVideo").style.height="50px",document.getElementById("playlist").style.display="none"},no:function(){var t=this.url_playlist.charAt(this.url_playlist.length-1);isNaN(t)&&(t=0),this.$emit("add-video",[this.videos[t-1]]),document.getElementById("addVideo").style.height="50px",document.getElementById("playlist").style.display="none"},invalid:function(t){var e=document.getElementById("addVideo"),i=document.getElementById("invalid");t?(i.style.display="none",e.style.height="50px"):(i.style.display="block",e.style.height="80px")}}},f=v,p=(i("b633"),i("2877")),m=Object(p["a"])(f,u,l,!1,null,"b676442e",null),h=m.exports,g=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{class:{selected:t.video.id===t.current},attrs:{id:"item",tabindex:"-1"},on:{focus:function(e){return t.$emit("current",t.video)}}},[n("div",{attrs:{id:"title"}},[n("p",[t._v(t._s(t.video.title))])]),n("div",{attrs:{id:"progress"}},[n("div",{style:{width:t.video.progress+"%"}})]),n("p",{attrs:{id:"ext"}},[t._v(" "+t._s(t.video.settings.ext)+" ")]),"video"===t.video.settings.type?n("p",{attrs:{id:"quality"}},[t._v(" "+t._s(t.video.settings.quality)+" ")]):t._e(),n("button",{on:{click:function(e){return t.$emit("del-video",t.video.id)}}},[n("img",{attrs:{src:i("d739")}})])])},y=[],_={name:"VideoItem",props:["video","current"]},b=_,x=(i("e6ae"),Object(p["a"])(b,g,y,!1,null,"f3305f24",null)),w=x.exports,k={name:"List",components:{addVideo:h,videoItem:w},props:["videos","current_id","status","update"],methods:{setFocus:function(){setTimeout((function(){return document.getElementsByClassName("videoItem")[0].focus()}),100)},invalid:function(t){this.$refs.addVideo.invalid(t)},closer:function(){console.log("closing"),fetch("http://127.0.0.1:5000/close",{method:"GET"})}}},E=k,$=(i("a310"),Object(p["a"])(E,a,d,!1,null,"9fe2543e",null)),j=$.exports,O=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{attrs:{id:"settings"}},[t.video.id?i("info",{attrs:{video:t.video}}):t._e(),t.video.id?i("setting",{attrs:{video:t.video},on:{"update-settings":function(e){t.$emit("update-settings",e)},"update-format":t.format_change}}):t._e(),t.video.id?i("div",{attrs:{id:"size"}},[i("p",[t._v("Estimated filesize: "+t._s(t.filesize)+" ")])]):t._e()],1)},C=[],I=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{attrs:{id:"info"}},[i("img",{attrs:{src:t.video.thumbnail}}),i("div",{attrs:{id:"wrapper"}},[t._m(0),i("div",{staticClass:"content"},[i("p",[t._v(t._s(t.video.title))]),i("p",[t._v(t._s(t.video.channel))]),i("p",[t._v(t._s(t.video.date))])])])])},S=[function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"labels"},[i("p",[t._v("Title:")]),i("p",[t._v("Channel:")]),i("p",[t._v("Date:")])])}],T={name:"Info",props:["video"]},V=T,N=(i("a230"),Object(p["a"])(V,I,S,!1,null,"079c6728",null)),z=N.exports,A=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{attrs:{id:"setting"}},[n("form",{attrs:{id:"general"}},[n("div",[n("p",[t._v("Filename: ")]),n("input",{directives:[{name:"model",rawName:"v-model",value:t.video.settings.filename,expression:"video.settings.filename"}],attrs:{type:"text"},domProps:{value:t.video.settings.filename},on:{input:function(e){e.target.composing||t.$set(t.video.settings,"filename",e.target.value)}}}),n("img",{staticClass:"info",attrs:{src:i("07e6"),alt:"info",id:"filename"},on:{mouseover:function(e){return t.over("filenametext")},mouseout:function(e){return t.out("filenametext")}}})]),n("div",[n("p",[t._v("Format: ")]),n("select",{directives:[{name:"model",rawName:"v-model",value:t.ext,expression:"ext"}],attrs:{id:"format"},on:{change:function(e){var i=Array.prototype.filter.call(e.target.options,(function(t){return t.selected})).map((function(t){var e="_value"in t?t._value:t.value;return e}));t.ext=e.target.multiple?i:i[0]}}},[n("option",{attrs:{value:"mkv"}},[t._v(" mkv ")]),n("option",{attrs:{value:"mp4"}},[t._v(" mp4 ")]),n("option",{attrs:{value:"m4a"}},[t._v(" m4a ")]),n("option",{attrs:{value:"mp3"}},[t._v(" mp3 ")])]),n("img",{staticClass:"info",attrs:{src:i("07e6"),alt:"info",id:"ext"},on:{mouseover:function(e){return t.over("exttext")},mouseout:function(e){return t.out("exttext")}}})]),t.audio?t._e():n("div",{staticClass:"tooltip"},[n("p",[t._v("Resolution: ")]),n("select",{directives:[{name:"model",rawName:"v-model",value:t.resolution,expression:"resolution"}],attrs:{id:"resolution"},on:{change:function(e){var i=Array.prototype.filter.call(e.target.options,(function(t){return t.selected})).map((function(t){var e="_value"in t?t._value:t.value;return e}));t.resolution=e.target.multiple?i:i[0]}}},t._l(t.video.resolutions,(function(e){return n("option",{key:e,domProps:{value:e}},[t._v(" "+t._s(e)+" ")])})),0),n("img",{staticClass:"info",attrs:{src:i("07e6"),alt:"info",id:"res"},on:{mouseover:function(e){return t.over("restext")},mouseout:function(e){return t.out("restext")}}})]),t._m(0),t.audio?n("div",{attrs:{id:"checkbox_tags"}},[n("p",[t._v("Include mp3 tags")]),n("input",{directives:[{name:"model",rawName:"v-model",value:t.tag,expression:"tag"}],attrs:{type:"checkbox"},domProps:{checked:Array.isArray(t.tag)?t._i(t.tag,null)>-1:t.tag},on:{change:function(e){var i=t.tag,n=e.target,o=!!n.checked;if(Array.isArray(i)){var s=null,r=t._i(i,s);n.checked?r<0&&(t.tag=i.concat([s])):r>-1&&(t.tag=i.slice(0,r).concat(i.slice(r+1)))}else t.tag=o}}})]):t._e(),n("p",{staticClass:"tooltiptext"})]),t.video.settings.tag&&t.audio?n("form",{attrs:{id:"tags"}},t._l(["title","artist","album","year","genre","album artist"],(function(e){return n("div",{key:e},[n("p",[t._v(t._s(e)+": ")]),n("input",{directives:[{name:"model",rawName:"v-model",value:t.video.settings.tags[e],expression:"video.settings.tags[el]"}],attrs:{type:"text"},domProps:{value:t.video.settings.tags[e]},on:{input:function(i){i.target.composing||t.$set(t.video.settings.tags,e,i.target.value)}}})])})),0):t._e(),t.convert?n("div",{attrs:{id:"convert"}},[n("p",[t._v("The requested format is unavailable. The video will be downloaded as mkv and converted into "+t._s(t.video.settings.ext)+". This may take a long time depending on the size of the video.")])]):t._e()])},B=[function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{attrs:{id:"tooltiptexts"}},[i("p",{attrs:{id:"filenametext"}},[t._v("Enter the filename without the extension")]),i("p",{attrs:{id:"exttext"}},[t._v("The extension of the file. Mkv and mp4 are video formats, m4a and mp3 contain audio only. Mp4 and mp3 have better compatibility, while mkv and m4a preserve better quality.")]),i("p",{attrs:{id:"restext"}},[t._v("The quality of the video, higher resolution means higher quality but a larger filesize. 1080p is recommended for most displays.")])])}],P={name:"Setting",props:["video"],computed:{convert:function(){return"video"===this.video.settings.type?!this.video.mp4_resolutions.includes(this.video.settings.quality)&&"mp4"===this.video.settings.ext:"mp3"===this.video.settings.ext},audio:function(){return["mp3","m4a"].includes(this.video.settings.ext)},filename:{get:function(){return this.video.settings.filename},set:function(t){this.$emit("update-settings",{id:this.video.id,filename:t})}},ext:{get:function(){return this.video.settings.ext},set:function(t){this.$emit("update-settings",{id:this.video.id,ext:t})}},resolution:{get:function(){return this.video.settings.quality},set:function(t){this.$emit("update-settings",{id:this.video.id,quality:t})}},tag:{get:function(){return this.video.settings.tag},set:function(t){this.$emit("update-settings",{id:this.video.id,tag:t})}},tags:{get:function(){return this.video.settings.tags},set:function(t){this.$emit("update-settings",{id:this.video.id,tags:t})}},format:function(){return[this.ext,this.resolution]}},watch:{format:function(){this.formatter()}},created:function(){this.formatter()},methods:{formatter:function(){var t;t=this.audio?"audio":"video";var e,i=[],n={mkv:"webm",mp4:"mp4",m4a:"m4a",mp3:"mp3"},o=0,s=!0,r=!1,a=void 0;try{for(var d,u=this.video.formats[Symbol.iterator]();!(s=(d=u.next()).done);s=!0)e=d.value,this.convert?e.format_note===this.video.settings.quality&&(i[0]=e):e.format_note===this.video.settings.quality&&n[this.video.settings.ext]===e.ext&&(i[0]=e),"audio"===e.type&&e.filesize>o&&(["mkv","mp3"].includes(e.ext)||this.convert?(o=e.filesize,"audio"===t?i[0]=e:i[1]=e):"m4a"===e.ext&&(o=e.filesize,"audio"===t?i[0]=e:i[1]=e))}catch(l){r=!0,a=l}finally{try{s||null==u.return||u.return()}finally{if(r)throw a}}this.$emit("update-settings",{id:this.video.id,format:i,type:t}),this.$emit("update-format"),this.$emit("update-settings",{id:this.video.id,convert:this.convert})},over:function(t){document.getElementById(t).style.display="block"},out:function(t){document.getElementById(t).style.display="none"}}},q=P,M=(i("22d4"),Object(p["a"])(q,A,B,!1,null,"cd5d275e",null)),D=M.exports,R={name:"Settings",components:{info:z,setting:D},props:["video"],data:function(){return{filesize:"unknown"}},computed:{convert:function(){return!this.video.mp4_resolutions.includes(this.video.settings.quality)&&"mp4"===this.video.settings.ext}},methods:{format_change:function(){var t;if(this.video.settings.hasOwnProperty("format")){var e=this.video.settings.format;t=1===e.length?Math.round(e[0].filesize/1e6):Math.round((e[0].filesize+e[1].filesize)/1e6)}else t="unknown";this.filesize="".concat(t," MB")}}},F=R,G=(i("7087"),Object(p["a"])(F,O,C,!1,null,"10073dea",null)),H=G.exports,J=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{attrs:{id:"general"}},[i("div",{attrs:{id:"left"}},[i("p",[t._v(t._s(t.status))])]),i("div",{attrs:{id:"right"}},[i("p",[t._v("location:")]),i("button",{staticClass:"link",on:{click:function(e){return t.$emit("set-folder")}}},[i("p",[t._v(t._s(t.folder))])]),i("button",{class:{greyed:"ready to download"!==t.status&&""!==t.status},attrs:{id:"start"},on:{click:function(e){return t.$emit("start")}}},[t._v(" start ")])])])},L=[],U={name:"General",components:{},props:["folder","status"]},Y=U,K=(i("e36c"),Object(p["a"])(Y,J,L,!1,null,"4ef4f752",null)),Q=K.exports,W={name:"App",components:{list:j,settings:H,general:Q},data:function(){return{videos:[],folder:"C:/users/",current:"",status:"",version:.1,update:!1}},created:function(){var t=this;window.addEventListener("beforeunload",(function(){console.log("unloading"),fetch("http://127.0.0.1:5000/close",{method:"GET"})})),fetch("http://127.0.0.1:5000/defaultpath",{method:"GET"}).then((function(t){return t.json()})).then((function(e){t.folder=e})).catch((function(t){return console.error(t)})),fetch("http://127.0.0.1:5000/version",{method:"GET"}).then((function(t){return t.json()})).then((function(e){e.version!==t.version&&(t.update=!0)})).catch((function(t){console.error(t)}))},methods:{changeCurrent:function(t){this.current=t},deleteVideo:function(t){this.videos=this.videos.filter((function(e){return e.id!==t})),this.current.id===t&&(this.current="")},addVideo:function(t){var e=this;this.status="ready to download",0!==t.length?(t=t.filter((function(t){var i,n=!0,o=!1,s=void 0;try{for(var r,a=e.videos[Symbol.iterator]();!(n=(r=a.next()).done);n=!0)if(i=r.value,i.id===t.id)return!1}catch(d){o=!0,s=d}finally{try{n||null==a.return||a.return()}finally{if(o)throw s}}return!0})),this.videos=t.concat(this.videos),this.current=t[0],this.$refs.listRef.setFocus(),this.$refs.listRef.invalid(!0)):this.$refs.listRef.invalid(!1)},update_settings:function(t){this.videos.forEach((function(e){if(e.id===t.id)for(var i in t)"id"!==i&&(e.settings[i]=t[i])}))},start:function(){var t=this;return Object(r["a"])(regeneratorRuntime.mark((function e(){var i,n,o,s,r,a,d;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(""!==t.status&&"ready to download"!==t.status){e.next=23;break}for(t.status="downloading ...",i={},n=!0,o=!1,s=void 0,e.prev=6,r=t.videos[Symbol.iterator]();!(n=(a=r.next()).done);n=!0)d=a.value,i[d.id]=d.settings;e.next=14;break;case 10:e.prev=10,e.t0=e["catch"](6),o=!0,s=e.t0;case 14:e.prev=14,e.prev=15,n||null==r.return||r.return();case 17:if(e.prev=17,!o){e.next=20;break}throw s;case 20:return e.finish(17);case 21:return e.finish(14);case 22:t.$socket.emit("start",{settings:i,path:t.folder});case 23:case"end":return e.stop()}}),e,null,[[6,10,14,22],[15,,17,21]])})))()},set_folder:function(){var t=this;document.getElementsByClassName("link")[0].style.cursor="wait",fetch("http://127.0.0.1:5000/directory",{method:"GET"}).then((function(t){return t.json()})).then((function(e){document.getElementsByClassName("link")[0].style.cursor="pointer",e.length>2&&(t.folder=e)})).catch((function(t){return alert(t)}))}},sockets:{connect:function(){console.log("socket connected!")},progress:function(t){var e=this,i=function(i){e.videos.forEach((function(n){n.id===i&&(n.progress=t[i].progress,e.status=t[i].status,"FINISHED!"===t[i].status&&e.videos.every((function(t){return 100===t.progress}))&&e.deleteVideo(i))}))};for(var n in t)i(n)},errorlog:function(t){alert("An error occurred: \n ".concat(t.type,": ").concat(t.msg))}}},X=W,Z=(i("034f"),Object(p["a"])(X,o,s,!1,null,null,null)),tt=Z.exports,et=i("683f"),it=i.n(et);window.resizeTo(1e3,700),n["a"].config.productionTip=!1,n["a"].use(new it.a({debug:!0,connection:"127.0.0.1:5000"})),new n["a"]({render:function(t){return t(tt)}}).$mount("#app")},7087:function(t,e,i){"use strict";var n=i("4000"),o=i.n(n);o.a},"85ec":function(t,e,i){},"91a2":function(t,e,i){},a230:function(t,e,i){"use strict";var n=i("07d6"),o=i.n(n);o.a},a310:function(t,e,i){"use strict";var n=i("ae71"),o=i.n(n);o.a},ae71:function(t,e,i){},b08f:function(t,e,i){},b2a6:function(t,e,i){},b2bd:function(t,e,i){},b633:function(t,e,i){"use strict";var n=i("b2a6"),o=i.n(n);o.a},d739:function(t,e,i){t.exports=i.p+"static/img/delete.fadc8b0d.svg"},e36c:function(t,e,i){"use strict";var n=i("b08f"),o=i.n(n);o.a},e6ae:function(t,e,i){"use strict";var n=i("b2bd"),o=i.n(n);o.a}});
  //# sourceMappingURL=app.6886ad56.js.map