!function(o,m,s){"use strict";var i=s,p="media",l="blazy-"+p,r="b-"+p,f=p+"--player",d="."+f,u=p+"__icon",c="."+u+"--play",h="iframe",v="is-playing",$="data-"+h+"-title",y="data-url";function e(a){var r,d,n,e=o(a),t=e.find(h),a=e.find(c);o.isElm(a)&&(r=o.attr(a,y),d=o.attr(a,$),o.remove(t),e.on("click."+l,c,function(a){if(a.preventDefault(),""===r)return!1;var e=this,t=e.parentNode,i=o.find(s,"."+v),l=o.find(t,h),a=o.find(s,"video");r=o.attr(e,y),d=o.attr(e,$),o.isElm(a)&&!a.paused&&a.pause(),o.isElm(i)&&(a=o.find(s,"."+v+" "+h),o.remove(a),i.className=i.className.replace(/(\S+)playing/,"")),o.addClass(t,v),o.remove(l),n||(n=o.create(h,p+"__iframe "+p+"__element"),o.attr(n,{src:r,allowfullscreen:!0,title:d})),t.appendChild(n)}),e.on("click."+l,".media__icon--close",function(a){a.preventDefault();var e=this.parentNode,a=o.find(e,h);e.className.match(v)&&(e.className=e.className.replace(/(\S+)playing/,"")),o.remove(a)}))}m.theme.blazyMedia=function(a){var e=a.el||a.element,t=o(e),i=t.find("img"),l=o.parse(t.attr("data-"+p)),r=o.isElm(i)?m.checkPlain(o.attr(i,"alt","Video preview",!0)):"",d=l.width?parseInt(l.width,10):640,n=l.height?parseInt(l.height,10):360,s=l?(n/d*100).toFixed(2):100,c=t.attr("data-box-url"),e=t.attr("href"),i=t.attr("data-oembed-url",e,!0),n=p+"__image "+p+"__element",t=a.imgClass?n+" "+a.imgClass:n,e=l.id?" media--"+l.id:"",n="video"===l.type?" "+f:"",l="";return c&&(l+='$alt'),n&&(l+='',l+=''),l='
'+l+"
",a.unwrap||(l='
'+l+"
"),o.template(l,{md:p,icon:u,idClass:e,player:n,pad:s,imgUrl:c,imgClass:t,alt:r,oembed:i,width:d,wrapper:p+"-wrapper"})},m.behaviors.blazyMedia={attach:function(a){i=o.context(a),o.once(e,r,d,i)},detach:function(a,e,t){"unload"===t&&o.once.removeSafely(r,d,i)}}}(dBlazy,Drupal,this.document);