!function(){"use strict";function a(a,b,c,g,h,i,j,n){return{restrict:"AE",scope:!0,templateUrl:function(a,b){return b.embedTemplateUrl||i},link:function(i,o,p){function q(a){i.video={},i.image={},i.pdf={},i.audio={},i.videoServices=[],i.audioServices=[],i.codeServices=[],i.gist=[],angular.isString(a)&&0!==a.length||(a=" ");var c=r(a,u).$$unwrapTrustedValue();u.video.embed&&(u.gdevAuth?v.embed(c,u).then(function(a){i.video=a}):console.error("Youtube authentication key is required to get data from youtube.")),c=u.basicVideo?v.embedBasic(c):c,c=u.audio.embed?w.embed(c):c,c=u.image.embed?x.embed(c):c,c=u.pdf.embed?z.embed(c):c,c=u.tweetEmbed?A.embed(c,u):c,c=u.twitchtvEmbed?v.twitchtvEmbed(c,u):c,c=u.dailymotionEmbed?v.dailymotionEmbed(c,u):c,c=u.tedEmbed?v.tedEmbed(c,u):c,c=u.dotsubEmbed?v.dotsubEmbed(c,u):c,c=u.liveleakEmbed?v.liveleakEmbed(c,u):c,c=u.ustreamEmbed?v.ustreamEmbed(c,u):c,c=u.soundCloudEmbed?w.soundcloudEmbed(c,u):c,c=u.spotifyEmbed?w.spotifyEmbed(c):c,c=u.code.highlight?B.highlightEmbed(c,u):c,c=u.codepenEmbed?B.codepenEmbed(c,u):c,c=u.jsfiddleEmbed?B.jsfiddleEmbed(c,u):c,c=u.jsbinEmbed?B.jsbinEmbed(c,u):c,c=u.plunkerEmbed?B.plunkerEmbed(c,u):c,c=u.githubgistEmbed?B.githubgistEmbed(c,u):c,c=u.ideoneEmbed?B.ideoneEmbed(c,u):c,g(function(a){i.neText=b.trustAsHtml(a)},0,!0,c)}var r=a("embed"),s=m(),t=i.$eval(p.embedOptions),u={};angular.copy(n,u),f(u,t);var v={calcDimensions:function(a){var b={width:null,height:null};return b.width=a.video.width,b.height=a.video.height,a.video.height&&a.video.width?b:a.video.height?(b.width=a.video.height/390*640,b):a.video.width?(b.height=b.width/640*390,b):(b.width=640,b.height=390,b)},getRequestConfig:function(){return{headers:{Authorization:void 0}}},youtubeEmbed:function(a,d){var f,g;if(a.match(j.youtube)){var i=v.calcDimensions(d);g={id:RegExp.$1,host:"youtube",width:i.width,height:i.height},d.video.details?f=c.get("https://www.googleapis.com/youtube/v3/videos?id="+g.id+"&key="+d.gdevAuth+"&part=snippet,statistics",v.getRequestConfig()).then(function(a){var c=void 0===d.video.autoPlay||!0===d.video.autoPlay?"?autoplay=1":"?autoplay=0",f=a.data.items[0];return g.title=f.snippet.title,g.thumbnail=f.snippet.thumbnails.medium.url,g.description=e(f.snippet.description,250,!0).replace(/\n/g," ").replace(/
/g," "),g.rawDescription=f.snippet.description,g.views=f.statistics.viewCount,g.likes=f.statistics.likeCount,g.uploader=f.snippet.channelTitle,g.uploaderPage="https://www.youtube.com/channel/"+f.snippet.channelId,g.uploadDate=f.snippet.publishedAt,g.url=b.trustAsResourceUrl("https://www.youtube.com/watch?v="+f.id),g.embedSrc=b.trustAsResourceUrl("https://www.youtube.com/embed/"+g.id+c),g}):(g.embedSrc=b.trustAsResourceUrl("https://www.youtube.com/embed/"+g.id+"?autoplay=0"),f=h.resolve(g))}else f=h.reject();return f},vimeoEmbed:function(a,d){var f,g;if(a.match(j.vimeo)){var i=v.calcDimensions(d);g={id:RegExp.$3,host:"vimeo",width:i.width,height:i.height},d.video.details?f=c.get("https://vimeo.com/api/v2/video/"+g.id+".json",v.getRequestConfig()).then(function(a){var c=a.data,f=void 0===d.video.autoPlay||!0===d.video.autoPlay?"&autoplay=1":"&autoplay=0";return g.title=c[0].title,g.rawDescription=c[0].description.replace(/\n/g,"
").replace(/
/g,"
"),g.description=e(c[0].description.replace(/((<|<)br\s*\/*(>|>)\r\n)/g," "),250,!0),g.thumbnail=c[0].thumbnail_medium,g.views=c[0].stats_number_of_plays,g.likes=c[0].stats_number_of_likes,g.uploader=c[0].user_name,g.uploaderPage=c[0].user_url,g.uploadDate=c[0].uploadDate,g.url=c[0].url,g.embedSrc=b.trustAsResourceUrl("//player.vimeo.com/video/"+c[0].id+"?title=0&byline=0&portrait=0"+f),g}):(g.embedSrc=b.trustAsResourceUrl("//player.vimeo.com/video/"+g.id+"?title=0&byline=0&portrait=0&autoplay=0"),f=h.resolve(g))}else f=h.reject();return f},embed:function(a,b){return v.youtubeEmbed(a,b).catch(function(){return v.vimeoEmbed(a,b)})},embedBasic:function(a){return a.match(j.basicVideo)&&(i.video.basic=b.trustAsResourceUrl(RegExp.$1)),a},twitchtvEmbed:function(a,c){var e=a.match(j.twitchtv);if(e){var f=d(e),g=v.calcDimensions(c);angular.forEach(f,function(a){var c=b.trustAsHtml('');i.videoServices.push(c)})}return a},dailymotionEmbed:function(a,c){var e=a.match(j.dailymotion);if(e){var f=d(e),g=v.calcDimensions(c);angular.forEach(f,function(a){var c=b.trustAsHtml('');i.videoServices.push(c)})}return a},tedEmbed:function(a,c){var e=a.match(j.ted);if(e){var f=d(e),g=v.calcDimensions(c);angular.forEach(f,function(a){var c=b.trustAsHtml('');i.videoServices.push(c)})}return a},dotsubEmbed:function(a,c){var e=a.match(j.dotsub);if(e){var f=d(e),g=v.calcDimensions(c);angular.forEach(f,function(a){var c=b.trustAsHtml('');i.videoServices.push(c)})}return a},liveleakEmbed:function(a,c){var e=a.match(j.liveleak);if(e){var f=d(e),g=v.calcDimensions(c);angular.forEach(f,function(a){var c=b.trustAsHtml('');i.videoServices.push(c)})}return a},ustreamEmbed:function(a,c){var e=a.match(j.ustream);if(e){var f=d(e),g=v.calcDimensions(c);angular.forEach(f,function(a){var c=a.split("/");c.indexOf("embed")<0&&c.splice(1,0,"embed");var d=b.trustAsHtml('');i.videoServices.push(d)})}return a}},w={embed:function(a){return a.match(j.basicAudio)&&(i.audio.url=b.trustAsResourceUrl(RegExp.$1)),a},soundcloudEmbed:function(a,c){var e=a.match(j.soundCloud);if(e){var f=d(e);angular.forEach(f,function(a){var d=b.trustAsHtml('');i.videoServices.push(d)})}return a},spotifyEmbed:function(a){var c=a.match(j.spotify);if(c){var e=d(c);angular.forEach(e,function(a){var c=b.trustAsHtml('');i.audioServices.push(c)})}return a}},x={embed:function(a){return a.match(j.basicImage)&&(i.image.url=RegExp.$1),a}},y={encode:function(a){var b=k(a);return b=b.replace(/&/gm,"")},getCode:function(a){return(a+"").replace(j.highlightCode,function(a,b,c,d){var e=d;e=l(e),e=y.encode(e),e=e.replace(/:\/\//g,"~P");var f,g=c.split("\n")[0];return g?f=hljs.highlightAuto(e,[g]):(f=hljs.highlightAuto(e),g=f.language),'
'+f.value+"
"})}},z={embed:function(a){return a.match(j.pdf)&&(i.pdf.url=b.trustAsResourceUrl(RegExp.$1)),a}},A={embed:function(a,e){function f(){g(function(){twttr.widgets.load()},10)}if(!window.twttr)return console.error(new ReferenceError("twttr is not defined. Load http://platform.twitter.com/widgets.js")),data;i.tweets=[];var h=a.match(j.twitter);if(h){var k=d(h);angular.forEach(k,function(a){var d,g="https://api.twitter.com/1/statuses/oembed.json?omit_script=true&&url="+a+"&maxwidth="+e.tweetOptions.maxWidth+"&hide_media="+e.tweetOptions.hideMedia+"&hide_thread="+e.tweetOptions.hideThread+"&align="+e.tweetOptions.align+"&lang="+e.tweetOptions.lang;d=parseInt(angular.version.major)>=1&&parseInt(angular.version.minor)>=6?c.jsonp(b.trustAsResourceUrl(g),{callbackParam:"JSON_CALLBACK"}):c.jsonp(g+"&callback=JSON_CALLBACK"),d.then(function(a){i.tweets.push(a.data.html),i.tweets.length==k.length&&f()}).catch(function(a){console.error(a)})})}return a}},B={codepenEmbed:function(a,c){var e=a.match(j.codepen);if(e){var f=d(e);angular.forEach(f,function(a){var d=b.trustAsHtml('');i.codeServices.push(d)})}return a},jsfiddleEmbed:function(a,c){var e=a.match(j.jsfiddle);if(e){var f=d(e);angular.forEach(f,function(a){var d=b.trustAsHtml('');i.codeServices.push(d)})}return a},jsbinEmbed:function(a,c){var e=a.match(j.jsbin);if(e){var f=d(e);angular.forEach(f,function(a){var d=b.trustAsHtml('');i.codeServices.push(d)})}return a},plunkerEmbed:function(a,c){var e=a.match(j.plunker);if(e){var f=d(e);angular.forEach(f,function(a){var d=a.split("/")[2],e=-1===a.indexOf("?")?d:d.split("?")[0],f=b.trustAsHtml('');i.codeServices.push(f)})}return a},githubgistEmbed:function(a){var b=a.match(j.gist);if(b){var c=[];angular.forEach(b,function(a){c.push(a.split("/")[2])}),i.gist=d(c)}return a},ideoneEmbed:function(a,c){var e=a.match(j.ideone);if(e){var f=d(e);angular.forEach(f,function(a){var d=b.trustAsHtml('');i.codeServices.push(d)})}return a},highlightEmbed:function(a,b){return window.hljs?(a=y.getCode(a),g(function(){if(b.code.lineNumbers){var a=o.find(".ne-code");a.length>0&&angular.forEach(a,function(a){for(var b=angular.element(a).addClass("has-numbering"),c=b.text(),d=c.split("\n").length,e=angular.element("