/**
 * Minified by jsDelivr using Terser v5.37.0.
 * Original file: /npm/browser-interaction-time@3.0.0/dist/browser-interaction-time.umd.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).browserInteractionTime=t()}(this,(function(){"use strict";
/*! *****************************************************************************
    Copyright (c) Microsoft Corporation. All rights reserved.
    Licensed under the Apache License, Version 2.0 (the "License"); you may not use
    this file except in compliance with the License. You may obtain a copy of the
    License at http://www.apache.org/licenses/LICENSE-2.0

    THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
    WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
    MERCHANTABLITY OR NON-INFRINGEMENT.

    See the Apache Version 2.0 License for specific language governing permissions
    and limitations under the License.
    ***************************************************************************** */var e=function(){return e=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},e.apply(this,arguments)};var t=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},i="object"==typeof n&&n&&n.Object===Object&&n,r="object"==typeof self&&self&&self.Object===Object&&self,s=i||r||Function("return this")(),a=function(){return s.Date.now()},l=s.Symbol,o=Object.prototype,c=o.hasOwnProperty,u=o.toString,d=l?l.toStringTag:void 0;var f=function(e){var t=c.call(e,d),n=e[d];try{e[d]=void 0;var i=!0}catch(e){}var r=u.call(e);return i&&(t?e[d]=n:delete e[d]),r},v=Object.prototype.toString;var h=function(e){return v.call(e)},m=l?l.toStringTag:void 0;var b=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":m&&m in Object(e)?f(e):h(e)};var p=function(e){return null!=e&&"object"==typeof e};var T=function(e){return"symbol"==typeof e||p(e)&&"[object Symbol]"==b(e)},k=/^\s+|\s+$/g,g=/^[-+]0x[0-9a-f]+$/i,I=/^0b[01]+$/i,C=/^0o[0-7]+$/i,w=parseInt;var y=function(e){if("number"==typeof e)return e;if(T(e))return NaN;if(t(e)){var n="function"==typeof e.valueOf?e.valueOf():e;e=t(n)?n+"":n}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(k,"");var i=I.test(e);return i||C.test(e)?w(e.slice(2),i?2:8):g.test(e)?NaN:+e},E=Math.max,M=Math.min;var O=function(e,n,i){var r,s,l,o,c,u,d=0,f=!1,v=!1,h=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function m(t){var n=r,i=s;return r=s=void 0,d=t,o=e.apply(i,n)}function b(e){var t=e-u;return void 0===u||t>=n||t<0||v&&e-d>=l}function p(){var e=a();if(b(e))return T(e);c=setTimeout(p,function(e){var t=n-(e-u);return v?M(t,l-(e-d)):t}(e))}function T(e){return c=void 0,h&&r?m(e):(r=s=void 0,o)}function k(){var e=a(),t=b(e);if(r=arguments,s=this,u=e,t){if(void 0===c)return function(e){return d=e,c=setTimeout(p,n),f?m(e):o}(u);if(v)return c=setTimeout(p,n),m(u)}return void 0===c&&(c=setTimeout(p,n)),o}return n=y(n)||0,t(i)&&(f=!!i.leading,l=(v="maxWait"in i)?E(y(i.maxWait)||0,n):l,h="trailing"in i?!!i.trailing:h),k.cancel=function(){void 0!==c&&clearTimeout(c),d=0,r=u=s=c=void 0},k.flush=function(){return void 0===c?o:T(a())},k};var j=function(e,n,i){var r=!0,s=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return t(i)&&(r="leading"in i?!!i.leading:r,s="trailing"in i?!!i.trailing:s),O(e,n,{leading:r,maxWait:n,trailing:s})},A=["scroll","resize"],x=["wheel","keydown","keyup","mousedown","mousemove","touchstart","touchmove","click","contextmenu"];return function(){function t(t){var n=t.timeIntervalEllapsedCallbacks,i=void 0===n?[]:n,r=t.absoluteTimeEllapsedCallbacks,s=void 0===r?[]:r,a=t.checkCallbacksIntervalMs,l=void 0===a?100:a,o=t.browserTabInactiveCallbacks,c=void 0===o?[]:o,u=t.idleCallbacks,d=void 0===u?[]:u,f=t.stopTimerOnTabchange,v=void 0===f||f,h=t.activeCallbacks,m=void 0===h?[]:h,b=t.browserTabActiveCallbacks,p=void 0===b?[]:b,T=t.idleTimeoutMs,k=void 0===T?3e3:T,g=this;this.onBrowserTabInactive=function(){g.isRunning()&&g.stopTimerOnTabchange&&g.stopTimer(),g.browserTabInactiveCallbacks.forEach((function(e){return e(g.getTimeInMilliseconds())}))},this.onBrowserTabActive=function(){g.isRunning()||g.startTimer(),g.browserTabActiveCallbacks.forEach((function(e){return e(g.getTimeInMilliseconds())}))},this.onBrowserActiveChange=function(){"visible"===document.visibilityState?g.onBrowserTabActive():g.onBrowserTabInactive()},this.onTimePassed=function(){g.absoluteTimeEllapsedCallbacks.forEach((function(e,t){var n=e.callback,i=e.pending,r=e.timeInMilliseconds;i&&r<=g.getTimeInMilliseconds()&&(n(g.getTimeInMilliseconds()),g.absoluteTimeEllapsedCallbacks[t].pending=!1)})),g.timeIntervalEllapsedCallbacks.forEach((function(e,t){var n=e.callback,i=e.timeInMilliseconds,r=e.multiplier;i<=g.getTimeInMilliseconds()&&(n(g.getTimeInMilliseconds()),g.timeIntervalEllapsedCallbacks[t].timeInMilliseconds=r(i))})),g.currentIdleTimeMs>=g.idleTimeoutMs&&g.isRunning()?(g.idle=!0,g.stopTimer(),g.idleCallbacks.forEach((function(e){return e(g.getTimeInMilliseconds())}))):g.currentIdleTimeMs+=g.checkCallbacksIntervalMs},this.resetIdleTime=function(){g.idle&&g.startTimer(),g.activeCallbacks.forEach((function(e){return e(g.getTimeInMilliseconds())})),g.idle=!1,g.currentIdleTimeMs=0},this.registerEventListeners=function(){var t={passive:!0},n=e({},t,{capture:!0});document.addEventListener("visibilitychange",g.onBrowserActiveChange);var i=j(g.resetIdleTime,2e3,{leading:!0,trailing:!1});A.forEach((function(e){window.addEventListener(e,i,n)})),x.forEach((function(e){return document.addEventListener(e,i,t)}))},this.unregisterEventListeners=function(){document.removeEventListener("visibilitychange",g.onBrowserActiveChange),A.forEach((function(e){return window.removeEventListener(e,g.resetIdleTime)})),x.forEach((function(e){return document.removeEventListener(e,g.resetIdleTime)}))},this.checkCallbacksOnInterval=function(){g.checkCallbackIntervalId=window.setInterval((function(){g.onTimePassed()}),g.checkCallbacksIntervalMs)},this.startTimer=function(){g.checkCallbackIntervalId||g.checkCallbacksOnInterval();var e=g.times[g.times.length-1];e&&null===e.stop||(g.times.push({start:performance.now(),stop:null}),g.running=!0)},this.stopTimer=function(){g.times.length&&(g.times[g.times.length-1].stop=performance.now(),g.running=!1)},this.addTimeIntervalEllapsedCallback=function(e){g.timeIntervalEllapsedCallbacks.push(e)},this.addAbsoluteTimeEllapsedCallback=function(e){g.absoluteTimeEllapsedCallbacks.push(e)},this.addBrowserTabInactiveCallback=function(e){g.browserTabInactiveCallbacks.push(e)},this.addBrowserTabActiveCallback=function(e){g.browserTabActiveCallbacks.push(e)},this.addIdleCallback=function(e){g.idleCallbacks.push(e)},this.addActiveCallback=function(e){g.activeCallbacks.push(e)},this.getTimeInMilliseconds=function(){return g.times.reduce((function(e,t){return t.stop?e+=t.stop-t.start:e+=performance.now()-t.start,e}),0)},this.isRunning=function(){return g.running},this.isIdle=function(){return g.idle},this.reset=function(){g.times=[]},this.destroy=function(){g.unregisterEventListeners(),g.checkCallbackIntervalId&&window.clearInterval(g.checkCallbackIntervalId)},this.running=!1,this.times=[],this.idle=!1,this.currentIdleTimeMs=0,this.marks={},this.measures={},this.stopTimerOnTabchange=v,this.browserTabActiveCallbacks=p,this.browserTabInactiveCallbacks=c,this.checkCallbacksIntervalMs=l,this.idleTimeoutMs=k,this.timeIntervalEllapsedCallbacks=i,this.absoluteTimeEllapsedCallbacks=s,this.idleCallbacks=d,this.activeCallbacks=m,this.registerEventListeners()}return t.prototype.mark=function(e){this.marks[e]||(this.marks[e]=[]),this.marks[e].push({time:this.getTimeInMilliseconds()})},t.prototype.getMarks=function(e){if(!(this.marks[e].length<1))return this.marks[e]},t.prototype.measure=function(e,t,n){var i=this.marks[t],r=i[i.length-1],s=this.marks[n],a=s[s.length-1];this.measures[e]||(this.measures[e]=[]),this.measures[e].push({name:e,startTime:r.time,duration:a.time-r.time})},t.prototype.getMeasures=function(e){if(this.measures[e]||!(this.measures[e].length<1))return this.measures[e]},t}()}));
//# sourceMappingURL=/sm/ff231e432d8b975c27fb455edf5bba5f022a7f30130c013d78626a9477d6a7c4.map