/*! * vidbg.js v2.1.0 (https://github.com/blakewilson/vidbg) * vidbg.js by Blake Wilson (https://blake.id) * @license MIT (https://github.com/blakewilson/vidbg/blob/master/LICENSE) */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.vidbg=t():e.vidbg=t()}(this,(function(){return function(){"use strict";var e={293:function(e){var t="a-f\\d",o="#?[".concat(t,"]{3}[").concat(t,"]?"),n="#?[".concat(t,"]{6}([").concat(t,"]{2})?"),r=new RegExp("[^#".concat(t,"]"),"gi"),i=new RegExp("^".concat(o,"$|^").concat(n,"$"),"i");e.exports=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"!=typeof e||r.test(e)||!i.test(e))throw new TypeError("Expected a valid hex string");var o=1;8===(e=e.replace(/^#/,"")).length&&(o=Number.parseInt(e.slice(6,8),16)/255,e=e.slice(0,6)),4===e.length&&(o=Number.parseInt(e.slice(3,4).repeat(2),16)/255,e=e.slice(0,3)),3===e.length&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]);var n=Number.parseInt(e,16),a=n>>16,c=n>>8&255,l=255&n,s="number"==typeof t.alpha?t.alpha:o;if("array"===t.format)return[a,c,l,s];if("css"===t.format){var u=1===s?"":" / ".concat(Number((100*s).toFixed(2)),"%");return"rgb(".concat(a," ").concat(c," ").concat(l).concat(u,")")}return{red:a,green:c,blue:l,alpha:s}}}},t={};function o(n){var r=t[n];if(void 0!==r)return r.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,o),i.exports}o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,{a:t}),t},o.d=function(e,t){for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};var n={};return function(){o.d(n,{default:function(){return d}});var e,t=o(293),r=o.n(t),i={mp4:null,webm:null,poster:null,overlay:!1,overlayColor:"#000",overlayAlpha:.3},a={controls:!1,loop:!0,muted:!0,playsInline:!0},c=(e=function(t,o){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])})(t,o)},function(t,o){if("function"!=typeof o&&null!==o)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function n(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(n.prototype=o.prototype,new n)}),l=function(e){function t(t){var o=e.call(this,t)||this;return o.name="InvalidSelectorError",o}return c(t,e),t}(Error),s=function(){var e=function(t,o){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])})(t,o)};return function(t,o){if("function"!=typeof o&&null!==o)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function n(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(n.prototype=o.prototype,new n)}}(),u=function(e){function t(t){var o=e.call(this,t)||this;return o.name="VideoSourceNotSpecifiedError",o}return s(t,e),t}(Error),p=function(){return(p=Object.assign||function(e){for(var t,o=1,n=arguments.length;ot/n.videoEl.videoHeight?(n.videoEl.style.width=e+"px",n.videoEl.style.height="auto"):(n.videoEl.style.width="auto",n.videoEl.style.height=t+"px")},!e)throw new l("A selector is required!");var c=document.querySelector(e);if(!c)throw new l('The selector you specified, "'+e+'", does not exist!');if(this.el=c,this.options=p(p({},i),t),this.attributes=p(p({},a),o),!this.options.mp4&&!this.options.webm)throw new u("Please provide an mp4, webm, or both");this.init()}return e.prototype.init=function(){this.el.style.position="relative",this.el.style.zIndex="1",this.createContainer(),this.createVideo(),this.createOverlay(),window.addEventListener("resize",this.resize)},e}()}(),n=n.default}()}));