!(function () { !(function (e, t) { "use strict"; "function" == typeof define && define.amd ? define([], t) : "object" == typeof exports ? (module.exports = t()) : (e.viewportUnitsBuggyfill = t()); })(this, function () { "use strict"; function e(e, t) { var n; return function () { var i = this, r = arguments; clearTimeout(n), (n = setTimeout(function () { e.apply(i, r); }, t)); }; } function t() { try { return window.self !== window.top; } catch (e) { return !0; } } function n() { (g.textContent = s()), g.parentNode.appendChild(g), window.dispatchEvent(new A("viewport-units-buggyfill-style")); } function i() { y && (o(), setTimeout(function () { n(); }, 1)); } function r(e) { try { if (!e.cssRules) return; } catch (e) { if ("SecurityError" !== e.name) throw e; return; } for (var t = [], n = 0; n < e.cssRules.length; n++) { var i = e.cssRules[n]; t.push(i); } return t; } function o() { return ( (m = []), T.call(document.styleSheets, function (e) { var t = r(e); t && "patched-viewport" !== e.ownerNode.id && "ignore" !== e.ownerNode.getAttribute("data-viewport-units-buggyfill") && ((e.media && e.media.mediaText && window.matchMedia && !window.matchMedia(e.media.mediaText).matches) || T.call(t, a)); }), m ); } function a(e) { if (7 === e.type) { var t; try { t = e.cssText; } catch (e) { return; } return ( (x.lastIndex = 0), void ( x.test(t) && !E.test(t) && (m.push([e, null, t]), w.hacks && w.hacks.findDeclarations(m, e, null, t)) ) ); } if (e.style) T.call(e.style, function (t) { var n = e.style.getPropertyValue(t); e.style.getPropertyPriority(t) && (n += " !important"), (x.lastIndex = 0), x.test(n) && (m.push([e, t, n]), w.hacks && w.hacks.findDeclarations(m, e, t, n)); }); else { if (!e.cssRules) return; T.call(e.cssRules, function (e) { a(e); }); } } function s() { v = d(); var e, t, n = [], i = []; return ( m.forEach(function (r) { var o = c.apply(null, r), a = o.selector.length ? o.selector.join(" {\n") + " {\n" : "", s = new Array(o.selector.length + 1).join("\n}"); if (!a || a !== e) return ( i.length && (n.push(e + i.join("\n") + t), (i.length = 0)), void (a ? ((e = a), (t = s), i.push(o.content)) : (n.push(o.content), (e = null), (t = null))) ); a && !e && ((e = a), (t = s)), i.push(o.content); }), i.length && n.push(e + i.join("\n") + t), C && n.push("* { content: normal !important; }"), n.join("\n\n") ); } function c(e, t, n) { var i, r = []; (i = n.replace(x, u)), w.hacks && (i = w.hacks.overwriteDeclaration(e, t, i)), t && (r.push(e.selectorText), (i = t + ": " + i + ";")); for (var o = e.parentRule; o; ) o.media ? r.unshift("@media " + o.media.mediaText) : o.conditionText && r.unshift("@supports " + o.conditionText), (o = o.parentRule); return { selector: r, content: i }; } function u(e, t, n) { var i = v[n]; return (parseFloat(t) / 100) * i + "px"; } function d() { var e = window.innerHeight, t = window.innerWidth; return { vh: e, vw: t, vmax: Math.max(t, e), vmin: Math.min(t, e) }; } function l(e) { var t = 0, n = function () { --t || e(); }; T.call(document.styleSheets, function (e) { e.href && f(e.href) !== f(location.href) && "ignore" !== e.ownerNode.getAttribute("data-viewport-units-buggyfill") && (t++, h(e.ownerNode, n)); }), t || e(); } function f(e) { return e.slice(0, e.indexOf("/", e.indexOf("://") + 3)); } function h(e, t) { p( e.href, function () { var n = document.createElement("style"); (n.media = e.media), n.setAttribute("data-href", e.href), (n.textContent = this.responseText), e.parentNode.replaceChild(n, e), t(); }, t ); } function p(e, t, n) { var i = new XMLHttpRequest(); if ("withCredentials" in i) i.open("GET", e, !0); else { if ("undefined" == typeof XDomainRequest) throw new Error("cross-domain XHR not supported"); (i = new XDomainRequest()).open("GET", e); } return (i.onload = t), (i.onerror = n), i.send(), i; } var w, v, m, g, y = !1, b = window.navigator.userAgent, x = /([+-]?[0-9.]+)(vh|vw|vmin|vmax)/g, E = /(https?:)?\/\//, T = [].forEach, k = /MSIE [0-9]\./i.test(b), R = /MSIE [0-8]\./i.test(b), C = b.indexOf("Opera Mini") > -1, M = /(iPhone|iPod|iPad).+AppleWebKit/i.test(b) && (function () { var e = b.match(/OS (\d)/); return e && e.length > 1 && parseInt(e[1]) < 10; })(), S = b.indexOf(" Android ") > -1 && b.indexOf("Version/") > -1 && parseFloat((b.match("Android ([0-9.]+)") || [])[1]) <= 4.4; k || (k = !!navigator.userAgent.match( /MSIE 10\.|Trident.*rv[ :]*1[01]\.| Edge\/1\d\./ )); try { new A("test"); } catch (e) { var A = function (e, t) { var n; return ( (t = t || { bubbles: !1, cancelable: !1, detail: void 0 }), (n = document.createEvent("CustomEvent")).initCustomEvent( e, t.bubbles, t.cancelable, t.detail ), n ); }; (A.prototype = window.Event.prototype), (window.CustomEvent = A); } return { version: "0.6.1", findProperties: o, getCss: s, init: function (n) { if (!y) { if ( (!0 === n && (n = { force: !0 }), (w = n || {}), (w.isMobileSafari = M), (w.isBadStockAndroid = S), !w.ignoreVmax || w.force || R || (k = !1), R || (!w.force && !M && !k && !S && !C && (!w.hacks || !w.hacks.required(w)))) ) return ( window.console && R && console.info( "viewport-units-buggyfill requires a proper CSSOM and basic viewport unit support, which are not available in IE8 and below" ), { init: function () {} } ); window.dispatchEvent(new A("viewport-units-buggyfill-init")), w.hacks && w.hacks.initialize(w), (y = !0), ((g = document.createElement("style")).id = "patched-viewport"), document[w.appendToBody ? "body" : "head"].appendChild(g), l(function () { var n = e(i, w.refreshDebounceWait || 100); window.addEventListener("orientationchange", n, !0), window.addEventListener("pageshow", n, !0), (w.force || k || t()) && (window.addEventListener("resize", n, !0), (w._listeningToResize = !0)), w.hacks && w.hacks.initializeEvents(w, i, n), i(); }); } }, refresh: i, }; }); })();