"use strict";function polyfill(){function v(n){return new RegExp("MSIE |Trident/|Edge/").test(n)}function s(n,t){this.scrollLeft=n;this.scrollTop=t}function y(n){return.5*(1-Math.cos(Math.PI*n))}function u(n){if(n===null||typeof n!="object"||n.behavior===undefined||n.behavior==="auto"||n.behavior==="instant")return!0;if(typeof n=="object"&&n.behavior==="smooth")return!1;throw new TypeError("behavior member of ScrollOptions "+n.behavior+" is not a valid value for enumeration ScrollBehavior.");}function h(n,t){return t==="Y"?n.clientHeight+e<n.scrollHeight:t==="X"?n.clientWidth+e<n.scrollWidth:void 0}function c(t,i){var r=n.getComputedStyle(t,null)["overflow"+i];return r==="auto"||r==="scroll"}function p(n){var t=h(n,"Y")&&c(n,"Y"),i=h(n,"X")&&c(n,"X");return t||i}function w(n){while(n!==t.body&&p(n)===!1)n=n.parentNode||n.host;return n}function l(t){var e=o(),r,u,f,i=(e-t.startTime)/a;i=i>1?1:i;r=y(i);u=t.startX+(t.x-t.startX)*r;f=t.startY+(t.y-t.startY)*r;t.method.call(t.scrollable,u,f);(u!==t.x||f!==t.y)&&n.requestAnimationFrame(l.bind(n,t))}function f(i,u,f){var e,h,c,a,v=o();i===t.body?(e=n,h=n.scrollX||n.pageXOffset,c=n.scrollY||n.pageYOffset,a=r.scroll):(e=i,h=i.scrollLeft,c=i.scrollTop,a=s);l({scrollable:e,method:a,startTime:v,startX:h,startY:c,x:u,y:f})}var n=window,t=document,e;if(!("scrollBehavior"in t.documentElement.style)||n.__forceSmoothScrollPolyfill__===!0){var i=n.HTMLElement||n.Element,a=468,r={scroll:n.scroll||n.scrollTo,scrollBy:n.scrollBy,elementScroll:i.prototype.scroll||s,scrollIntoView:i.prototype.scrollIntoView},o=n.performance&&n.performance.now?n.performance.now.bind(n.performance):Date.now;e=v(n.navigator.userAgent)?1:0;n.scroll=n.scrollTo=function(){if(arguments[0]!==undefined){if(u(arguments[0])===!0){r.scroll.call(n,arguments[0].left!==undefined?arguments[0].left:typeof arguments[0]!="object"?arguments[0]:n.scrollX||n.pageXOffset,arguments[0].top!==undefined?arguments[0].top:arguments[1]!==undefined?arguments[1]:n.scrollY||n.pageYOffset);return}f.call(n,t.body,arguments[0].left!==undefined?~~arguments[0].left:n.scrollX||n.pageXOffset,arguments[0].top!==undefined?~~arguments[0].top:n.scrollY||n.pageYOffset)}};n.scrollBy=function(){if(arguments[0]!==undefined){if(u(arguments[0])){r.scrollBy.call(n,arguments[0].left!==undefined?arguments[0].left:typeof arguments[0]!="object"?arguments[0]:0,arguments[0].top!==undefined?arguments[0].top:arguments[1]!==undefined?arguments[1]:0);return}f.call(n,t.body,~~arguments[0].left+(n.scrollX||n.pageXOffset),~~arguments[0].top+(n.scrollY||n.pageYOffset))}};i.prototype.scroll=i.prototype.scrollTo=function(){if(arguments[0]!==undefined){if(u(arguments[0])===!0){if(typeof arguments[0]=="number"&&arguments[1]===undefined)throw new SyntaxError("Value could not be converted");r.elementScroll.call(this,arguments[0].left!==undefined?~~arguments[0].left:typeof arguments[0]!="object"?~~arguments[0]:this.scrollLeft,arguments[0].top!==undefined?~~arguments[0].top:arguments[1]!==undefined?~~arguments[1]:this.scrollTop);return}var n=arguments[0].left,t=arguments[0].top;f.call(this,this,typeof n=="undefined"?this.scrollLeft:~~n,typeof t=="undefined"?this.scrollTop:~~t)}};i.prototype.scrollBy=function(){if(arguments[0]!==undefined){if(u(arguments[0])===!0){r.elementScroll.call(this,arguments[0].left!==undefined?~~arguments[0].left+this.scrollLeft:~~arguments[0]+this.scrollLeft,arguments[0].top!==undefined?~~arguments[0].top+this.scrollTop:~~arguments[1]+this.scrollTop);return}this.scroll({left:~~arguments[0].left+this.scrollLeft,top:~~arguments[0].top+this.scrollTop,behavior:arguments[0].behavior})}};i.prototype.scrollIntoView=function(){if(u(arguments[0])===!0){r.scrollIntoView.call(this,arguments[0]===undefined?!0:arguments[0]);return}var i=w(this),e=i.getBoundingClientRect(),o=this.getBoundingClientRect();i!==t.body?(f.call(this,i,i.scrollLeft+o.left-e.left,i.scrollTop+o.top-e.top),n.getComputedStyle(i).position!=="fixed"&&n.scrollBy({left:e.left,top:e.top,behavior:"smooth"})):n.scrollBy({left:o.left,top:o.top,behavior:"smooth"})}}}typeof exports=="object"&&typeof module!="undefined"?module.exports={polyfill:polyfill}:polyfill()