!function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):(a.Vimeo=a.Vimeo||{},a.Vimeo.Player=b())}(this,function(){"use strict";function a(a,b){return 0===a.indexOf(b.toLowerCase())?a:""+b.toLowerCase()+a.substr(0,1).toUpperCase()+a.substr(1)}function b(a){return a instanceof window.HTMLElement}function c(a){return!isNaN(parseFloat(a))&&isFinite(a)&&Math.floor(a)==a}function d(a){return/^(https?:)?\/\/((player|www).)?vimeo.com(?=$|\/)/.test(a)}function e(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},b=a.id,e=a.url,f=b||e;if(!f)throw new Error("An id or url must be passed, either in an options object or as a data-vimeo-id or data-vimeo-url attribute.");if(c(f))return"https://vimeo.com/"+f;if(d(f))return f.replace("http:","https:");if(b)throw new TypeError("“"+b+"” is not a valid video id.");throw new TypeError("“"+f+"” is not a vimeo.com url.")}function f(a,b){return b={exports:{}},a(b,b.exports),b.exports}function g(a,b,c){var d=x.get(a.element)||{};b in d||(d[b]=[]),d[b].push(c),x.set(a.element,d)}function h(a,b){return(x.get(a.element)||{})[b]||[]}function i(a,b,c){var d=x.get(a.element)||{};if(!d[b])return!0;if(!c)return d[b]=[],x.set(a.element,d),!0;var e=d[b].indexOf(c);return-1!==e&&d[b].splice(e,1),x.set(a.element,d),d[b]&&0===d[b].length}function j(a,b){var c=h(a,b);if(c.length<1)return!1;var d=c.shift();return i(a,b,d),d}function k(a,b){var c=x.get(a);x.set(b,c),x.delete(a)}function l(a){var b=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return y.reduce(function(b,c){var d=a.getAttribute("data-vimeo-"+c);return(d||""===d)&&(b[c]=""===d?1:d),b},b)}function m(a){var b=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(c,e){if(!d(a))throw new TypeError("“"+a+"” is not a vimeo.com url.");var f="https://vimeo.com/api/oembed.json?url="+encodeURIComponent(a);for(var g in b)b.hasOwnProperty(g)&&(f+="&"+g+"="+encodeURIComponent(b[g]));var h="XDomainRequest"in window?new XDomainRequest:new XMLHttpRequest;h.open("GET",f,!0),h.onload=function(){if(404===h.status)return void e(new Error("“"+a+"” was not found."));if(403===h.status)return void e(new Error("“"+a+"” is not embeddable."));try{var b=JSON.parse(h.responseText);c(b)}catch(a){e(a)}},h.onerror=function(){var a=h.status?" ("+h.status+")":"";e(new Error("There was an error fetching the embed code from Vimeo"+a+"."))},h.send()})}function n(a,b){var c=a.html;if(!b)throw new TypeError("An element must be provided");if(null!==b.getAttribute("data-vimeo-initialized"))return b.querySelector("iframe");var d=document.createElement("div");return d.innerHTML=c,b.appendChild(d.firstChild),b.setAttribute("data-vimeo-initialized","true"),b.querySelector("iframe")}function o(a){return"string"==typeof a&&(a=JSON.parse(a)),a}function p(a,b,c){if(a.element.contentWindow&&a.element.contentWindow.postMessage){var d={method:b};void 0!==c&&(d.value=c);var e=parseFloat(navigator.userAgent.toLowerCase().replace(/^.*msie (\d+).*$/,"$1"));e>=8&&e<10&&(d=JSON.stringify(d)),a.element.contentWindow.postMessage(d,a.origin)}}function q(a,b){b=o(b);var c=[],d=void 0;if(b.event)"error"===b.event&&h(a,b.data.method).forEach(function(c){var d=new Error(b.data.message);d.name=b.data.name,c.reject(d),i(a,b.data.method,c)}),c=h(a,"event:"+b.event),d=b.data;else if(b.method){var e=j(a,b.method);e&&(c.push(e),d=b.value)}c.forEach(function(b){try{if("function"==typeof b)return void b.call(a,d);b.resolve(d)}catch(a){}})}function r(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}var s="undefined"!=typeof global&&"[object global]"==={}.toString.call(global),t=void 0!==Array.prototype.indexOf,u="undefined"!=typeof window&&void 0!==window.postMessage;if(!(s||t&&u))throw new Error("Sorry, the Vimeo Player API is not available in this browser.");var v="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},w=(f(function(a,b){!function(a){function b(a,b){function d(a){if(!this||this.constructor!==d)return new d(a);this._keys=[],this._values=[],this._itp=[],this.objectOnly=b,a&&c.call(this,a)}return b||t(a,"size",{get:q}),a.constructor=d,d.prototype=a,d}function c(a){this.add?a.forEach(this.add,this):a.forEach(function(a){this.set(a[0],a[1])},this)}function d(a){return this.has(a)&&(this._keys.splice(s,1),this._values.splice(s,1),this._itp.forEach(function(a){s0&&a(d,h))}catch(a){g.call(new i(h),a)}}}function g(b){var c=this;c.triggered||(c.triggered=!0,c.def&&(c=c.def),c.msg=b,c.state=2,c.chain.length>0&&a(d,c))}function h(a,b,c,d){for(var e=0;e1&&void 0!==arguments[1]?arguments[1]:{};if(r(this,c),window.jQuery&&a instanceof jQuery&&(a.length>1&&window.console&&console.warn,a=a[0]),"string"==typeof a&&(a=document.getElementById(a)),!b(a))throw new TypeError("You must pass either a valid element or a valid id.");if("IFRAME"!==a.nodeName){var h=a.querySelector("iframe");h&&(a=h)}if("IFRAME"===a.nodeName&&!d(a.getAttribute("src")||""))throw new Error("The player element passed isn’t a Vimeo embed.");if(A.has(a))return A.get(a);this.element=a,this.origin="*";var i=new w(function(b,c){var h=function(a){if(d(a.origin)&&f.element.contentWindow===a.source){"*"===f.origin&&(f.origin=a.origin);var c=o(a.data),e="event"in c&&"ready"===c.event,g="method"in c&&"ping"===c.method;if(e||g)return f.element.setAttribute("data-ready","true"),void b();q(f,c)}};if(window.addEventListener?window.addEventListener("message",h,!1):window.attachEvent&&window.attachEvent("onmessage",h),"IFRAME"!==f.element.nodeName){var i=l(a,g);m(e(i),i).then(function(b){var c=n(b,a);return f.element=c,k(a,c),A.set(f.element,f),b}).catch(function(a){return c(a)})}});return B.set(this,i),A.set(this.element,this),"IFRAME"===this.element.nodeName&&p(this,"ping"),this}return z(c,[{key:"callMethod",value:function(a){var b=this,c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new w(function(d,e){return b.ready().then(function(){g(b,a,{resolve:d,reject:e}),p(b,a,c)})})}},{key:"get",value:function(b){var c=this;return new w(function(d,e){return b=a(b,"get"),c.ready().then(function(){g(c,b,{resolve:d,reject:e}),p(c,b)})})}},{key:"set",value:function(b,c){var d=this;return w.resolve(c).then(function(c){if(b=a(b,"set"),void 0===c||null===c)throw new TypeError("There must be a value to set.");return d.ready().then(function(){return new w(function(a,e){g(d,b,{resolve:a,reject:e}),p(d,b,c)})})})}},{key:"on",value:function(a,b){if(!a)throw new TypeError("You must pass an event name.");if(!b)throw new TypeError("You must pass a callback function.");if("function"!=typeof b)throw new TypeError("The callback must be a function.");0===h(this,"event:"+a).length&&this.callMethod("addEventListener",a).catch(function(){}),g(this,"event:"+a,b)}},{key:"off",value:function(a,b){if(!a)throw new TypeError("You must pass an event name.");if(b&&"function"!=typeof b)throw new TypeError("The callback must be a function.");i(this,"event:"+a,b)&&this.callMethod("removeEventListener",a).catch(function(a){})}},{key:"loadVideo",value:function(a){return this.callMethod("loadVideo",a)}},{key:"ready",value:function(){var a=B.get(this);return w.resolve(a)}},{key:"addCuePoint",value:function(a){var b=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.callMethod("addCuePoint",{time:a,data:b})}},{key:"removeCuePoint",value:function(a){return this.callMethod("removeCuePoint",a)}},{key:"enableTextTrack",value:function(a,b){if(!a)throw new TypeError("You must pass a language.");return this.callMethod("enableTextTrack",{language:a,kind:b})}},{key:"disableTextTrack",value:function(){return this.callMethod("disableTextTrack")}},{key:"pause",value:function(){return this.callMethod("pause")}},{key:"play",value:function(){return this.callMethod("play")}},{key:"unload",value:function(){return this.callMethod("unload")}},{key:"getAutopause",value:function(){return this.get("autopause")}},{key:"setAutopause",value:function(a){return this.set("autopause",a)}},{key:"getColor",value:function(){return this.get("color")}},{key:"setColor",value:function(a){return this.set("color",a)}},{key:"getCuePoints",value:function(){return this.get("cuePoints")}},{key:"getCurrentTime",value:function(){return this.get("currentTime")}},{key:"setCurrentTime",value:function(a){return this.set("currentTime",a)}},{key:"getDuration",value:function(){return this.get("duration")}},{key:"getEnded",value:function(){return this.get("ended")}},{key:"getLoop",value:function(){return this.get("loop")}},{key:"setLoop",value:function(a){return this.set("loop",a)}},{key:"getPaused",value:function(){return this.get("paused")}},{key:"getPlaybackRate",value:function(){return this.get("playbackRate")}},{key:"setPlaybackRate",value:function(a){return this.set("playbackRate",a)}},{key:"getTextTracks",value:function(){return this.get("textTracks")}},{key:"getVideoEmbedCode",value:function(){return this.get("videoEmbedCode")}},{key:"getVideoId",value:function(){return this.get("videoId")}},{key:"getVideoTitle",value:function(){return this.get("videoTitle")}},{key:"getVideoWidth",value:function(){return this.get("videoWidth")}},{key:"getVideoHeight",value:function(){return this.get("videoHeight")}},{key:"getVideoUrl",value:function(){return this.get("videoUrl")}},{key:"getVolume",value:function(){return this.get("volume")}},{key:"setVolume",value:function(a){return this.set("volume",a)}}]),c}();return s||(function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,b=[].slice.call(a.querySelectorAll("[data-vimeo-id], [data-vimeo-url]")),c=function(a){"console"in window&&console.error};b.forEach(function(a){try{if(null!==a.getAttribute("data-vimeo-defer"))return;var b=l(a);m(e(b),b).then(function(b){return n(b,a)}).catch(c)}catch(a){c()}})}(),function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,b=function(b){if(d(b.origin)&&b.data&&"spacechange"===b.data.event)for(var c=a.querySelectorAll("iframe"),e=0;e