@qbix/q.js 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -6
- package/dist/Metrics.js +2013 -1
- package/dist/Metrics.min.js +159 -94
- package/dist/handlebars.minimal.min.js +12 -1
- package/dist/jquery.minimal.min.js +10 -18
- package/package.json +1 -1
package/dist/Metrics.min.js
CHANGED
|
@@ -1,95 +1,160 @@
|
|
|
1
|
-
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(
|
|
2
|
-
$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};$jscomp.Symbol=function(){var
|
|
3
|
-
$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var
|
|
4
|
-
$jscomp.iteratorPrototype=function(
|
|
5
|
-
$jscomp.polyfill=function(
|
|
6
|
-
(function(
|
|
7
|
-
document.addEventListener(
|
|
8
|
-
Math.round((Date.now()-
|
|
9
|
-
|
|
10
|
-
Date.now().toString(36)+Math.random().toString(36).slice(2);return
|
|
11
|
-
headers:{"Content-Type":"text/plain"},keepalive:!0,body:
|
|
12
|
-
(b._sessionKey=
|
|
13
|
-
"undefined"!==typeof Q&&function(
|
|
14
|
-
keepalive:!0})},5E3)};
|
|
15
|
-
document.title,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"Metrics.NavigationTracker");
|
|
19
|
-
location.hash.queryField("v"))k(
|
|
20
|
-
userAgent:navigator.userAgent,timestamp:Date.now(),performanceNow:performance.now()};k&&(g.details=k);g=JSON.stringify({error:g});
|
|
21
|
-
!0)});window.addEventListener("error",function(
|
|
22
|
-
(function(
|
|
23
|
-
|
|
24
|
-
0;
|
|
25
|
-
for(
|
|
26
|
-
-100<=c.top&&c.top<window.innerHeight&&(
|
|
27
|
-
trackClicks:!0,tocSelector:null,tocActiveClass:"active",tocSectionSelector:"h2[id]"},
|
|
28
|
-
n.init({endpoint:c.endpoint,page:c.page,sessionKey:c.sessionKey,sessionId:c.sessionId,extra:c.extra,trackUnload:c.trackUnload});setTimeout(function(){
|
|
29
|
-
!0},getSessionId:function(){return n.getSessionId()},getSections:function(){return
|
|
30
|
-
clearTimeout(
|
|
31
|
-
(function(
|
|
32
|
-
|
|
33
|
-
0;
|
|
34
|
-
for(
|
|
35
|
-
-100<=c.top&&c.top<window.innerHeight&&(
|
|
36
|
-
trackClicks:!0,tocSelector:null,tocActiveClass:"active",tocSectionSelector:"h2[id]"},
|
|
37
|
-
n.init({endpoint:c.endpoint,page:c.page,sessionKey:c.sessionKey,sessionId:c.sessionId,extra:c.extra,trackUnload:c.trackUnload});setTimeout(function(){
|
|
38
|
-
!0},getSessionId:function(){return n.getSessionId()},getSections:function(){return
|
|
39
|
-
clearTimeout(
|
|
40
|
-
(function(
|
|
41
|
-
|
|
42
|
-
0;
|
|
43
|
-
for(
|
|
44
|
-
|
|
45
|
-
window.IntersectionObserver&&!1!==b.autoTrack&&(b=new IntersectionObserver(function(a){a.forEach(function(a){a.isIntersecting&&.3<a.intersectionRatio?
|
|
46
|
-
a.getAttribute("data-action")||a.getAttribute("href")||a.textContent.trim().slice(0,40));
|
|
47
|
-
a.nodeType&&(a.matches&&a.matches(b)&&
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
for(var
|
|
52
|
-
""})}},closed:function(a){
|
|
53
|
-
{},b;for(b in
|
|
54
|
-
window.removeEventListener("scroll",
|
|
55
|
-
|
|
56
|
-
(function(
|
|
57
|
-
position:Math.round(a.lastPosition),duration:Math.round(a.duration),watched:a.watched.total()};if(c)for(var
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
function(){l._ytApiLoaded=!0;l._ytApiLoading=!1;b&&b();a();for(var
|
|
61
|
-
|
|
62
|
-
a);
|
|
63
|
-
b.src="https://player.vimeo.com/api/player.js";b.onload=function(){l._vimeoApiLoaded=!0;l._vimeoApiLoading=!1;a()};document.head.appendChild(b)}}function
|
|
64
|
-
function(
|
|
65
|
-
a>
|
|
66
|
-
/open\.spotify\.com\/embed/.test(c)?trackSpotify(a[b]):/player\.twitch\.tv/.test(c)?trackTwitch(a[b]):/muse\.ai\/embed/.test(c)&&trackMuseAi(a[b])}a=document.querySelectorAll('[class*="wistia_embed"], [class*="wistia_async_"]');for(b=0;b<a.length;b++)trackWistia(a[b]);a=document.querySelectorAll(".jwplayer, [data-jw-id]");for(b=0;b<a.length;b++)trackJWPlayer(a[b])}function
|
|
67
|
-
a.nodeType){a.matches&&a.matches("video, audio")&&n(a);if("IFRAME"===a.tagName&&a.src){var b=a.src;/youtube\.com\/embed/.test(b)?
|
|
68
|
-
/jwplayer/.test(a.className)&&trackJWPlayer(a);if(a.querySelectorAll){b=a.querySelectorAll("video, audio");for(var
|
|
69
|
-
/muse\.ai\/embed/.test(b)&&trackMuseAi(c
|
|
70
|
-
c.lastPosition),
|
|
71
|
-
this.ranges[
|
|
72
|
-
void 0!==a[c]&&(b[c]=a[c]);l.options=b;l.initialized=!0;!
|
|
1
|
+
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(d,k,c){d!=Array.prototype&&d!=Object.prototype&&(d[k]=c.value)};$jscomp.getGlobal=function(d){return"undefined"!=typeof window&&window===d?d:"undefined"!=typeof global&&null!=global?global:d};$jscomp.global=$jscomp.getGlobal(this);$jscomp.SYMBOL_PREFIX="jscomp_symbol_";
|
|
2
|
+
$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};$jscomp.Symbol=function(){var d=0;return function(k){return $jscomp.SYMBOL_PREFIX+(k||"")+d++}}();
|
|
3
|
+
$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var d=$jscomp.global.Symbol.iterator;d||(d=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));"function"!=typeof Array.prototype[d]&&$jscomp.defineProperty(Array.prototype,d,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}});$jscomp.initSymbolIterator=function(){}};$jscomp.arrayIterator=function(d){var k=0;return $jscomp.iteratorPrototype(function(){return k<d.length?{done:!1,value:d[k++]}:{done:!0}})};
|
|
4
|
+
$jscomp.iteratorPrototype=function(d){$jscomp.initSymbolIterator();d={next:d};d[$jscomp.global.Symbol.iterator]=function(){return this};return d};$jscomp.iteratorFromArray=function(d,k){$jscomp.initSymbolIterator();d instanceof String&&(d+="");var c=0,b={next:function(){if(c<d.length){var a=c++;return{value:k(a,d[a]),done:!1}}b.next=function(){return{done:!0,value:void 0}};return b.next()}};b[Symbol.iterator]=function(){return b};return b};
|
|
5
|
+
$jscomp.polyfill=function(d,k,c,b){if(k){c=$jscomp.global;d=d.split(".");for(b=0;b<d.length-1;b++){var a=d[b];a in c||(c[a]={});c=c[a]}d=d[d.length-1];b=c[d];k=k(b);k!=b&&null!=k&&$jscomp.defineProperty(c,d,{configurable:!0,writable:!0,value:k})}};$jscomp.polyfill("Array.prototype.keys",function(d){return d?d:function(){return $jscomp.iteratorFromArray(this,function(d){return d})}},"es6","es3");
|
|
6
|
+
(function(d){function k(){function b(b){b=!("pause"===b.type||"resign"===b.type||("resume"===b.type||"active"===b.type?0:"hidden"===document.visibilityState));if(b!==a._visible){a._visible=b;for(var c=0;c<a._visibilityCallbacks.length;c++)try{a._visibilityCallbacks[c].fn(b)}catch(m){}}}if(!a._visibilityBound){a._visibilityBound=!0;for(var c=null,d=["","moz","ms","webkit","o"],k=0;k<d.length;k++){var h=d[k];if((h?h+"Hidden":"hidden")in document){c=h?h+"visibilitychange":"visibilitychange";break}}c&&
|
|
7
|
+
document.addEventListener(c,b,!1);document.addEventListener("pause",b,!1);document.addEventListener("resume",b,!1);document.addEventListener("resign",b,!1);document.addEventListener("active",b,!1)}}function c(){a._unloadBound||(a._unloadBound=!0,a.onVisibilityChange(function(c){c?a._unloaded=!1:b()},"Metrics.unload"),window.addEventListener("pagehide",function(){b()}),window.addEventListener("pageshow",function(b){b.persisted&&(a._unloaded=!1)}))}function b(){if(!a._unloaded){a._unloaded=!0;var b=
|
|
8
|
+
Math.round((Date.now()-a._startTime)/1E3);a.send("unload:"+b+"s")}}var a=d.Metrics||{};d.Metrics=a;a._sessionKey="metrics_sid";a._visitorKey="metrics_vid";a._sid=null;a._vid=null;a.getSessionId=function(){if(a._sid)return a._sid;try{var b=sessionStorage.getItem(a._sessionKey);b||(b=Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2),sessionStorage.setItem(a._sessionKey,b));a._sid=b}catch(q){a._sid=Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)}return a._sid};
|
|
9
|
+
a.getVisitorId=function(){if(a._vid)return a._vid;var b=null;try{return b=localStorage.getItem(a._visitorKey),b||(b=Math.random().toString(36).slice(2)+Date.now().toString(36)+Math.random().toString(36).slice(2),localStorage.setItem(a._visitorKey,b)),a._vid=b}catch(q){}try{return b=sessionStorage.getItem(a._visitorKey),b||(b=Math.random().toString(36).slice(2)+Date.now().toString(36)+Math.random().toString(36).slice(2),sessionStorage.setItem(a._visitorKey,b)),a._vid=b}catch(q){}b=Math.random().toString(36).slice(2)+
|
|
10
|
+
Date.now().toString(36)+Math.random().toString(36).slice(2);return a._vid=b};a._endpoint=null;a._page=null;a._extra=null;a._unloaded=!1;a._startTime=Date.now();a.send=function(b,c){if(a._endpoint&&!a._unloaded){b={session:a.getSessionId(),visitor:a.getVisitorId(),origin:location.origin,page:a._page||document.title,label:b,t:Date.now()};a._extra&&(b.extra=a._extra);c&&(b.data=c);c=JSON.stringify(b);try{navigator.sendBeacon?navigator.sendBeacon(a._endpoint,new Blob([c],{type:"text/plain"})):fetch(a._endpoint,
|
|
11
|
+
{method:"POST",headers:{"Content-Type":"text/plain"},keepalive:!0,body:c})}catch(n){}}};a._visible=!0;a._visibilityCallbacks=[];a._visibilityBound=!1;a.isVisible=function(){return a._visible};a.onVisibilityChange=function(b,c){if(c)for(var g=0;g<a._visibilityCallbacks.length;g++)if(a._visibilityCallbacks[g].key===c){a._visibilityCallbacks[g].fn=b;return}a._visibilityCallbacks.push({fn:b,key:c||null})};a._unloadBound=!1;a._defaultEndpoint="https://invites.to/metrics";a.init=function(b){b=b||{};a._endpoint=
|
|
12
|
+
b.endpoint||a._defaultEndpoint;b.page&&(a._page=b.page);b.sessionKey&&(a._sessionKey=b.sessionKey);b.sessionId&&(a._sid=b.sessionId);b.extra&&(a._extra=b.extra);k();!1!==b.trackUnload&&c();a.send("loaded");return a}})("undefined"!==typeof window?window:this);
|
|
13
|
+
"undefined"!==typeof Q&&function(d){function k(b){var a=location.hash||"#";b=a.queryField("v",b);b!==a&&history.replaceState(history.state,document.title,b)}var c=d.Metrics=d.plugins.Metrics=window.Metrics;c.setState=function(b,a){var g=d.info.url;c.setState.pending[g]=d.setTimeout(function(){c.setState.pending[g]&&(clearTimeout(c.setState.pending[g]),delete c.setState.pending[g]);d.req("Metrics/update",[],null,{method:"POST",fields:{navigatorUrl:location.href,url:d.info.url,state:b,extra:JSON.stringify(a)},
|
|
14
|
+
keepalive:!0})},5E3)};c.setState.pending={};d.extend.dontCopy["Q.Users.User"]=!0;d.text.Metrics={};d.onReady.add(function(){d.onVisibilityChange&&d.onVisibilityChange.set&&d.onVisibilityChange.set(function(a){if(c._visible!==a){c._visible=a;for(var b=0;b<c._visibilityCallbacks.length;b++)try{c._visibilityCallbacks[b].fn(a)}catch(h){}}},"Metrics");var b=d.getObject("Metrics.navigationTracker",d.plugins)||d.getObject("Metrics.navigationTracker",d);b&&c.NavigationTracker&&(b.page=b.page||d.info.url||
|
|
15
|
+
document.title,c.NavigationTracker.init(b));(b=d.getObject("Metrics.mediaTracker",d.plugins)||d.getObject("Metrics.mediaTracker",d))&&c.MediaTracker&&c.MediaTracker.init(b);var a=c.NavigationTracker;if(a){var g=null;d.Tool.onActivate("Q/tabs").set(function(){this.state.onCurrent.set(function(b,c){clearTimeout(g);g=setTimeout(function(){c&&a.state.initialized&&a.opened("tab:"+c)},300)},"Metrics.NavigationTracker")},"Metrics.NavigationTracker");d.Tool.onActivate("Q/columns").set(function(){this.state.onActivate.set(function(b,
|
|
16
|
+
c,g){a.state.initialized&&(b=b&&b.getAttribute("data-name")||"column-"+g,a.opened("column:"+b))},"Metrics.NavigationTracker");this.state.onClose.set(function(b,c){a.state.initialized&&(b=c&&c.getAttribute("data-name")||"column-"+b,a.closed("column:"+b))},"Metrics.NavigationTracker")},"Metrics.NavigationTracker");d.Tool.onActivate("Q/expandable").set(function(){var b=this.element.id||this.element.getAttribute("data-name")||this.id;this.state.onExpand.set(function(){a.state.initialized&&a.opened("expandable:"+
|
|
17
|
+
b)},"Metrics.NavigationTracker");this.state.onCollapse.set(function(){a.state.initialized&&a.closed("expandable:"+b)},"Metrics.NavigationTracker")},"Metrics.NavigationTracker");if(d.Contextual){d.Contextual.onShow.set(function(b){if(a.state.initialized){var c=$(b).data("Q/contextual trigger");c=c&&c.attr("data-name")||c&&c.attr("id")||"contextual-"+d.Contextual.current;a.opened("contextual:"+c);(b=b.querySelector?b.querySelector(".Q_listing_wrapper, .Q_listing"):null)&&a.observeNavContainer(b)}},
|
|
18
|
+
"Metrics.NavigationTracker");d.Contextual.onHide.set(function(b){a.state.initialized&&a.state.activeSection&&0===a.state.activeSection.indexOf("contextual:")&&a.closed(a.state.activeSection)},"Metrics.NavigationTracker");var q=d.Contextual.itemSelectHandler;q&&(d.Contextual.itemSelectHandler=function(b,g){if(a.state.initialized){var d=b.getAttribute("data-action")||b.getAttribute("data-name")||(b.textContent||"").trim().slice(0,40);c.send("contextual-item:"+d)}return q.apply(this,arguments)})}}if(b=
|
|
19
|
+
location.hash.queryField("v"))k(b),d.req("Metrics/landed",{method:"POST",fields:{trackerId:"visitId:"+b}},function(a,b){a?window.console&&console.error("Metrics landed request failed",a):b&&b.slots&&b.slots.visitId&&k(b.slots.visitId)})},"Metrics");(function(){function b(a,b){var c="",g="";if(a instanceof Error)c=a.message,g=a.stack;else if("string"===typeof a)c=a;else if(a&&"object"===typeof a)try{var k=JSON.stringify(a)}catch(h){k="[unserializable reason]"}g={message:c||"",stack:g||"",url:location.href,
|
|
20
|
+
userAgent:navigator.userAgent,timestamp:Date.now(),performanceNow:performance.now()};k&&(g.details=k);g=JSON.stringify({error:g});d.req("Metrics/update",[],null,{method:"POST",fields:{navigatorUrl:location.href,url:d.info&&d.info.url,state:"error",extra:g},keepalive:!0});console.warn(b?"Unhandled rejection:":"Unhandled error:",a);c&&/indexedDB/i.test(c)&&console.warn("[Recovery] Error suggests IndexedDB corruption. Triggering recovery...")}window.addEventListener("unhandledrejection",function(a){b(a.reason,
|
|
21
|
+
!0)});window.addEventListener("error",function(a){b(a.error||a.message,!1)})})()}(Q);"use strict";
|
|
22
|
+
(function(d){function k(a){a=document.querySelectorAll(a);for(var b=[],c=0,g=h.options&&h.options.minSectionHeight||0,f=0;f<a.length;f++){var d=a[f];if(!(d.offsetHeight<g)){if(!d.id){var t=(d.textContent||"").trim().slice(0,60).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");d.id=t||"section-"+c}b.push({el:d,id:d.id,tag:d.tagName.toLowerCase(),ordinal:c++,snippet:(d.textContent||"").trim().slice(0,80)})}}return b}function c(){var a=h.options,b=window.scrollY||window.pageYOffset;if(Math.abs(b-
|
|
23
|
+
h._prevY)>a.settleTolerance)h._prevY=b,h.scrollTimer=setTimeout(c,a.recheckInterval);else{var g=window.scrollY||window.pageYOffset;for(var d=h.options,f=null,k=Infinity,t=0;t<h.sections.length;t++){var l=h.sections[t],e=l.el.offsetTop;e<=g+d.sectionLookback&&(e=Math.abs(e-g-180),e<k&&(k=e,f=l))}(g=f)&&!h.seen[g.id]&&(h.seen[g.id]=!0,n.send("section:"+g.id,{tag:g.tag,ordinal:g.ordinal,snippet:g.snippet}));g=document.documentElement.scrollHeight-window.innerHeight;if(0<g)for(b=Math.round(b/g*100),g=
|
|
24
|
+
0;g<a.depthMilestones.length;g++)d=a.depthMilestones[g],b>=d&&!h.depthHit[d]&&(h.depthHit[d]=!0,n.send("depth:"+d+"%"))}}function b(){h.anchorCooling||(clearTimeout(h.scrollTimer),h._prevY=window.scrollY||window.pageYOffset,h.scrollTimer=setTimeout(c,h.options.debounce))}function a(){var a=h.options;if(a.tocSelector){for(var b=window.scrollY||window.pageYOffset,c="",g=0;g<h.tocSections.length;g++)b>=h.tocSections[g].el.offsetTop-160&&(c=h.tocSections[g].id);b=document.querySelectorAll(a.tocSelector);
|
|
25
|
+
for(g=0;g<b.length;g++)b[g].classList.remove(a.tocActiveClass),b[g].getAttribute("href")==="#"+c&&b[g].classList.add(a.tocActiveClass)}}function g(a){if(a=a.target.closest("a[href]")){var b=a.getAttribute("href")||"";"#"===b.charAt(0)?(h.anchorCooling=!0,setTimeout(function(){h.anchorCooling=!1},h.options.anchorCooldown),n.send("anchor:"+b.slice(1))):n.send(a.dataset.track||"link:"+b)}}function q(){for(var a=window.scrollY||window.pageYOffset,b=0;b<h.sections.length;b++){var c=h.sections[b].el.getBoundingClientRect();
|
|
26
|
+
-100<=c.top&&c.top<window.innerHeight&&(h.seen[h.sections[b].id]=!0)}b=document.documentElement.scrollHeight-window.innerHeight;if(0<b)for(a=Math.round(a/b*100),b=0;b<h.options.depthMilestones.length;b++)c=h.options.depthMilestones[b],a>=c&&(h.depthHit[c]=!0)}var n=d.Metrics;if(n){var u={sections:"h2[id], h3[id], section[id], [data-section]",minSectionHeight:100,debounce:1E3,initDelay:800,anchorCooldown:1500,depthMilestones:[25,50,75,100],sectionLookback:300,settleTolerance:2,recheckInterval:500,
|
|
27
|
+
trackClicks:!0,tocSelector:null,tocActiveClass:"active",tocSectionSelector:"h2[id]"},h={initialized:!1,options:null,sections:[],tocSections:[],seen:{},depthHit:{},scrollTimer:null,anchorCooling:!1,_prevY:-1};n.ScrollTracker={init:function(c){if(h.initialized)return console.warn("Metrics.ScrollTracker already initialized"),this;var d={},m;for(m in u)u.hasOwnProperty(m)&&(d[m]=u[m]);for(m in c||{})c.hasOwnProperty(m)&&void 0!==c[m]&&(d[m]=c[m]);h.options=d;h.initialized=!0;!n._endpoint&&c&&c.endpoint&&
|
|
28
|
+
n.init({endpoint:c.endpoint,page:c.page,sessionKey:c.sessionKey,sessionId:c.sessionId,extra:c.extra,trackUnload:c.trackUnload});setTimeout(function(){h.sections=k(d.sections);d.tocSelector&&d.tocSectionSelector&&(h.tocSections=k(d.tocSectionSelector));q();window.addEventListener("scroll",b,{passive:!0});d.tocSelector&&(window.addEventListener("scroll",a,{passive:!0}),a())},d.initDelay);d.trackClicks&&document.addEventListener("click",g);return this},send:function(a,b){n.send(a,b)},markSeen:function(a){h.seen[a]=
|
|
29
|
+
!0},getSessionId:function(){return n.getSessionId()},getSections:function(){return h.sections.map(function(a){return{id:a.id,tag:a.tag,ordinal:a.ordinal,snippet:a.snippet}})},getSeen:function(){var a={},b;for(b in h.seen)a[b]=!0;return a},reset:function(){h.seen={};h.depthHit={};h.anchorCooling=!1;clearTimeout(h.scrollTimer);h.sections=k(h.options.sections);q()},destroy:function(){window.removeEventListener("scroll",b);window.removeEventListener("scroll",a);document.removeEventListener("click",g);
|
|
30
|
+
clearTimeout(h.scrollTimer);h.initialized=!1},defaults:u,state:h}}else console.warn("Metrics.ScrollTracker: Metrics core not loaded")})("undefined"!==typeof window?window:this);"use strict";
|
|
31
|
+
(function(d){function k(a){a=document.querySelectorAll(a);for(var b=[],c=0,g=h.options&&h.options.minSectionHeight||0,f=0;f<a.length;f++){var d=a[f];if(!(d.offsetHeight<g)){if(!d.id){var t=(d.textContent||"").trim().slice(0,60).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");d.id=t||"section-"+c}b.push({el:d,id:d.id,tag:d.tagName.toLowerCase(),ordinal:c++,snippet:(d.textContent||"").trim().slice(0,80)})}}return b}function c(){var a=h.options,b=window.scrollY||window.pageYOffset;if(Math.abs(b-
|
|
32
|
+
h._prevY)>a.settleTolerance)h._prevY=b,h.scrollTimer=setTimeout(c,a.recheckInterval);else{var g=window.scrollY||window.pageYOffset;for(var d=h.options,f=null,k=Infinity,t=0;t<h.sections.length;t++){var l=h.sections[t],e=l.el.offsetTop;e<=g+d.sectionLookback&&(e=Math.abs(e-g-180),e<k&&(k=e,f=l))}(g=f)&&!h.seen[g.id]&&(h.seen[g.id]=!0,n.send("section:"+g.id,{tag:g.tag,ordinal:g.ordinal,snippet:g.snippet}));g=document.documentElement.scrollHeight-window.innerHeight;if(0<g)for(b=Math.round(b/g*100),g=
|
|
33
|
+
0;g<a.depthMilestones.length;g++)d=a.depthMilestones[g],b>=d&&!h.depthHit[d]&&(h.depthHit[d]=!0,n.send("depth:"+d+"%"))}}function b(){h.anchorCooling||(clearTimeout(h.scrollTimer),h._prevY=window.scrollY||window.pageYOffset,h.scrollTimer=setTimeout(c,h.options.debounce))}function a(){var a=h.options;if(a.tocSelector){for(var b=window.scrollY||window.pageYOffset,c="",g=0;g<h.tocSections.length;g++)b>=h.tocSections[g].el.offsetTop-160&&(c=h.tocSections[g].id);b=document.querySelectorAll(a.tocSelector);
|
|
34
|
+
for(g=0;g<b.length;g++)b[g].classList.remove(a.tocActiveClass),b[g].getAttribute("href")==="#"+c&&b[g].classList.add(a.tocActiveClass)}}function g(a){if(a=a.target.closest("a[href]")){var b=a.getAttribute("href")||"";"#"===b.charAt(0)?(h.anchorCooling=!0,setTimeout(function(){h.anchorCooling=!1},h.options.anchorCooldown),n.send("anchor:"+b.slice(1))):n.send(a.dataset.track||"link:"+b)}}function q(){for(var a=window.scrollY||window.pageYOffset,b=0;b<h.sections.length;b++){var c=h.sections[b].el.getBoundingClientRect();
|
|
35
|
+
-100<=c.top&&c.top<window.innerHeight&&(h.seen[h.sections[b].id]=!0)}b=document.documentElement.scrollHeight-window.innerHeight;if(0<b)for(a=Math.round(a/b*100),b=0;b<h.options.depthMilestones.length;b++)c=h.options.depthMilestones[b],a>=c&&(h.depthHit[c]=!0)}var n=d.Metrics;if(n){var u={sections:"h2[id], h3[id], section[id], [data-section]",minSectionHeight:100,debounce:1E3,initDelay:800,anchorCooldown:1500,depthMilestones:[25,50,75,100],sectionLookback:300,settleTolerance:2,recheckInterval:500,
|
|
36
|
+
trackClicks:!0,tocSelector:null,tocActiveClass:"active",tocSectionSelector:"h2[id]"},h={initialized:!1,options:null,sections:[],tocSections:[],seen:{},depthHit:{},scrollTimer:null,anchorCooling:!1,_prevY:-1};n.ScrollTracker={init:function(c){if(h.initialized)return console.warn("Metrics.ScrollTracker already initialized"),this;var d={},m;for(m in u)u.hasOwnProperty(m)&&(d[m]=u[m]);for(m in c||{})c.hasOwnProperty(m)&&void 0!==c[m]&&(d[m]=c[m]);h.options=d;h.initialized=!0;!n._endpoint&&c&&c.endpoint&&
|
|
37
|
+
n.init({endpoint:c.endpoint,page:c.page,sessionKey:c.sessionKey,sessionId:c.sessionId,extra:c.extra,trackUnload:c.trackUnload});setTimeout(function(){h.sections=k(d.sections);d.tocSelector&&d.tocSectionSelector&&(h.tocSections=k(d.tocSectionSelector));q();window.addEventListener("scroll",b,{passive:!0});d.tocSelector&&(window.addEventListener("scroll",a,{passive:!0}),a())},d.initDelay);d.trackClicks&&document.addEventListener("click",g);return this},send:function(a,b){n.send(a,b)},markSeen:function(a){h.seen[a]=
|
|
38
|
+
!0},getSessionId:function(){return n.getSessionId()},getSections:function(){return h.sections.map(function(a){return{id:a.id,tag:a.tag,ordinal:a.ordinal,snippet:a.snippet}})},getSeen:function(){var a={},b;for(b in h.seen)a[b]=!0;return a},reset:function(){h.seen={};h.depthHit={};h.anchorCooling=!1;clearTimeout(h.scrollTimer);h.sections=k(h.options.sections);q()},destroy:function(){window.removeEventListener("scroll",b);window.removeEventListener("scroll",a);document.removeEventListener("click",g);
|
|
39
|
+
clearTimeout(h.scrollTimer);h.initialized=!1},defaults:u,state:h}}else console.warn("Metrics.ScrollTracker: Metrics core not loaded")})("undefined"!==typeof window?window:this);"use strict";
|
|
40
|
+
(function(d){function k(a){return a.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,60)}function c(a){a=document.querySelectorAll(a);for(var b=[],e=0,c=f.options&&f.options.minSectionHeight||0,r=0;r<a.length;r++){var g=a[r];g.offsetHeight<c||(g.id||(g.id=k(g.textContent||"")||"section-"+e),b.push({el:g,id:g.id,tag:g.tagName.toLowerCase(),ordinal:e++,snippet:(g.textContent||"").trim().slice(0,80)}))}return b}function b(){var a=f.options,c=window.scrollY||window.pageYOffset;if(Math.abs(c-
|
|
41
|
+
f._prevY)>a.settleTolerance)f._prevY=c,f.scrollTimer=setTimeout(b,a.recheckInterval);else{var e=window.scrollY||window.pageYOffset;for(var p=f.options,r=null,g=Infinity,d=0;d<f.sections.length;d++){var h=f.sections[d],k=h.el.offsetTop;k<=e+p.sectionLookback&&(k=Math.abs(k-e-180),k<g&&(g=k,r=h))}(e=r)&&!f.seen[e.id]&&(f.seen[e.id]=!0,m.send("section:"+e.id,{tag:e.tag,ordinal:e.ordinal,snippet:e.snippet}));e=document.documentElement.scrollHeight-window.innerHeight;if(0<e)for(c=Math.round(c/e*100),e=
|
|
42
|
+
0;e<a.depthMilestones.length;e++)p=a.depthMilestones[e],c>=p&&!f.depthHit[p]&&(f.depthHit[p]=!0,m.send("depth:"+p+"%"))}}function a(){f.anchorCooling||(clearTimeout(f.scrollTimer),f._prevY=window.scrollY||window.pageYOffset,f.scrollTimer=setTimeout(b,f.options.debounce))}function g(){var a=f.options;if(a.tocSelector){for(var b=window.scrollY||window.pageYOffset,e="",c=0;c<f.tocSections.length;c++)b>=f.tocSections[c].el.offsetTop-160&&(e=f.tocSections[c].id);b=document.querySelectorAll(a.tocSelector);
|
|
43
|
+
for(c=0;c<b.length;c++)b[c].classList.remove(a.tocActiveClass),b[c].getAttribute("href")==="#"+e&&b[c].classList.add(a.tocActiveClass)}}function q(a){if(a=a.target.closest("a[href]")){var b=a.getAttribute("href")||"";"#"===b.charAt(0)?(f.anchorCooling=!0,setTimeout(function(){f.anchorCooling=!1},f.options.anchorCooldown),m.send("anchor:"+b.slice(1))):m.send(a.dataset.track||"link:"+b)}}function n(){if(f.activeSection&&f.options.trackDwell){var a=Math.round((Date.now()-f.activeSince)/1E3);if(0<a){var b=
|
|
44
|
+
f.dynamicSections[f.activeSection];m.send("dwell:"+f.activeSection,{seconds:a,name:b?b.name:f.activeSection})}f.activeSection=null;f.activeSince=null}}function u(a,b){var e=b.id||a.id||a.getAttribute("data-section")||a.getAttribute("data-track-section")||k(a.textContent||"")||"dyn-"+Object.keys(f.dynamicSections).length;a.id||(a.id=e);f.dynamicSections[e]={el:a,id:e,name:b.name||a.getAttribute("data-section-name")||a.getAttribute("title")||e,snippet:(a.textContent||"").trim().slice(0,80),observedAt:Date.now()};
|
|
45
|
+
window.IntersectionObserver&&!1!==b.autoTrack&&(b=new IntersectionObserver(function(a){a.forEach(function(a){a.isIntersecting&&.3<a.intersectionRatio?v.opened(e):a.isIntersecting||f.activeSection!==e||v.closed(e)})},{threshold:[0,.3]}),b.observe(a),f.dynamicSections[e]._io=b);return e}function h(a){var b=a.querySelectorAll("a[href], li[data-action], li[data-name]");if(b.length){a=new IntersectionObserver(function(a){a.forEach(function(a){if(a.isIntersecting){a=a.target;var b="nav-link:"+(a.getAttribute("data-name")||
|
|
46
|
+
a.getAttribute("data-action")||a.getAttribute("href")||a.textContent.trim().slice(0,40));f._navLinksSeen[b]||(f._navLinksSeen[b]=!0,m.send(b,{text:a.textContent.trim().slice(0,60)}))}})},{root:a,threshold:.5});for(var e=0;e<b.length;e++)a.observe(b[e]);f._navObservers.push(a)}}function y(){if(window.MutationObserver&&f.options.observeDom){var a=f.options.observeRoot||document.body,b=f.options.observeSelector;f._mutationObserver=new MutationObserver(function(a){a.forEach(function(a){a.addedNodes.forEach(function(a){if(1===
|
|
47
|
+
a.nodeType&&(a.matches&&a.matches(b)&&u(a,{}),a.querySelectorAll)){a=a.querySelectorAll(b);for(var e=0;e<a.length;e++)u(a[e],{})}})})});f._mutationObserver.observe(a,{childList:!0,subtree:!0})}}function w(){for(var a=window.scrollY||window.pageYOffset,b=0;b<f.sections.length;b++){var e=f.sections[b].el.getBoundingClientRect();-100<=e.top&&e.top<window.innerHeight&&(f.seen[f.sections[b].id]=!0)}b=document.documentElement.scrollHeight-window.innerHeight;if(0<b)for(a=Math.round(a/b*100),b=0;b<f.options.depthMilestones.length;b++)e=
|
|
48
|
+
f.options.depthMilestones[b],a>=e&&(f.depthHit[e]=!0)}var m=d.Metrics;if(m){var x={sections:"h2[id], h3[id], section[id], [data-section]",minSectionHeight:100,debounce:1E3,initDelay:800,anchorCooldown:1500,depthMilestones:[25,50,75,100],sectionLookback:300,settleTolerance:2,recheckInterval:500,observeDom:!1,observeRoot:null,observeSelector:"[data-section], [data-track-section]",trackDwell:!0,navContainers:null,trackContextuals:!0,trackClicks:!0,tocSelector:null,tocActiveClass:"active",tocSectionSelector:"h2[id]"},
|
|
49
|
+
f={initialized:!1,options:null,sections:[],tocSections:[],seen:{},depthHit:{},scrollTimer:null,anchorCooling:!1,_prevY:-1,dynamicSections:{},activeSection:null,activeSince:null,_mutationObserver:null,_navObservers:[],_navLinksSeen:{}},v={init:function(b){if(f.initialized)return console.warn("Metrics.NavigationTracker already initialized"),this;var d={},e;for(e in x)x.hasOwnProperty(e)&&(d[e]=x[e]);for(e in b||{})b.hasOwnProperty(e)&&void 0!==b[e]&&(d[e]=b[e]);f.options=d;f.initialized=!0;!m._endpoint&&
|
|
50
|
+
b&&b.endpoint&&m.init({endpoint:b.endpoint,page:b.page,sessionKey:b.sessionKey,sessionId:b.sessionId,extra:b.extra,trackUnload:b.trackUnload});setTimeout(function(){f.sections=c(d.sections);d.tocSelector&&d.tocSectionSelector&&(f.tocSections=c(d.tocSectionSelector));w();window.addEventListener("scroll",a,{passive:!0});d.tocSelector&&(window.addEventListener("scroll",g,{passive:!0}),g());d.observeDom&&y();if(d.navContainers){var b=f.options.navContainers;if(b&&window.IntersectionObserver){b=document.querySelectorAll(b);
|
|
51
|
+
for(var e=0;e<b.length;e++)h(b[e])}}},d.initDelay);d.trackClicks&&document.addEventListener("click",q);if(d.trackDwell)m.onVisibilityChange(function(a){a||n()},"NavigationTracker.dwell");return this},observe:function(a,b){return u(a,b||{})},opened:function(a){if(f.activeSection!==a)if(n(),f.activeSection=a,f.activeSince=Date.now(),f.seen[a])m.send("switched:"+a,{name:(f.dynamicSections[a]||{}).name||a});else{f.seen[a]=!0;var b=f.dynamicSections[a];m.send("opened:"+a,{name:b?b.name:a,snippet:b?b.snippet:
|
|
52
|
+
""})}},closed:function(a){f.activeSection===a&&n()},observeNavContainer:function(a){h(a)},send:function(a,b){m.send(a,b)},markSeen:function(a){f.seen[a]=!0},getSessionId:function(){return m.getSessionId()},getSections:function(){return f.sections.map(function(a){return{id:a.id,tag:a.tag,ordinal:a.ordinal,snippet:a.snippet}})},getDynamicSections:function(){var a={},b;for(b in f.dynamicSections){var e=f.dynamicSections[b];a[b]={id:e.id,name:e.name,snippet:e.snippet}}return a},getSeen:function(){var a=
|
|
53
|
+
{},b;for(b in f.seen)a[b]=!0;return a},getActive:function(){return f.activeSection?{id:f.activeSection,since:f.activeSince,elapsed:Math.round((Date.now()-f.activeSince)/1E3)}:null},reset:function(){n();f.seen={};f.depthHit={};f.anchorCooling=!1;f._navLinksSeen={};clearTimeout(f.scrollTimer);for(var a in f.dynamicSections)f.dynamicSections[a]._io&&f.dynamicSections[a]._io.disconnect();f.dynamicSections={};f.activeSection=null;f.activeSince=null;f.sections=c(f.options.sections);w()},destroy:function(){n();
|
|
54
|
+
window.removeEventListener("scroll",a);window.removeEventListener("scroll",g);document.removeEventListener("click",q);clearTimeout(f.scrollTimer);f._mutationObserver&&(f._mutationObserver.disconnect(),f._mutationObserver=null);for(var b in f.dynamicSections)f.dynamicSections[b]._io&&f.dynamicSections[b]._io.disconnect();for(b=0;b<f._navObservers.length;b++)f._navObservers[b].disconnect();f._navObservers=[];f.initialized=!1},defaults:x,state:f};m.NavigationTracker=v;m.SectionTracker=v;m.ScrollTracker=
|
|
55
|
+
v}else console.warn("Metrics.NavigationTracker: Metrics core not loaded")})("undefined"!==typeof window?window:this);"use strict";
|
|
56
|
+
(function(d){function k(a){if(a.id)return a.id;if(a=a.src||a.currentSrc||""){var b=a.match(/(?:youtu\.be\/|youtube\.com\/embed\/|vimeo\.com\/video\/|vimeo\.com\/)([^?&#]+)/);if(b)return b[1];if((a=a.split("/").pop().split("?")[0])&&60>a.length)return a}return"media-"+l._counter++}function c(){this.ranges=[]}function b(a,b,r,g){return{id:a,type:b,el:r,duration:g||0,playing:!1,lastPosition:0,lastCheckpointAt:0,watched:new c,checkpointTimer:null,_lastTimeUpdate:0}}function a(a,b,c){var e={type:a.type,
|
|
57
|
+
position:Math.round(a.lastPosition),duration:Math.round(a.duration),watched:a.watched.total()};if(c)for(var p in c)e[p]=c[p];v.send(b+":"+a.id,e)}function g(b){q(b);b.checkpointTimer=setInterval(function(){b.playing&&a(b,"media-checkpoint")},1E3*l.options.checkpointInterval)}function q(a){a.checkpointTimer&&(clearInterval(a.checkpointTimer),a.checkpointTimer=null)}function n(e){var c=k(e);if(!l.tracked[c]){var r=b(c,"native",e,e.duration||0);l.tracked[c]=r;e.addEventListener("loadedmetadata",function(){r.duration=
|
|
58
|
+
e.duration||0});e.addEventListener("play",function(){r.playing=!0;r.lastPosition=e.currentTime;r._lastTimeUpdate=e.currentTime;a(r,"media-play");g(r)});e.addEventListener("pause",function(){r.playing&&(r.playing=!1,r.watched.add(r._lastTimeUpdate,e.currentTime),r.lastPosition=e.currentTime,q(r),a(r,"media-pause"))});e.addEventListener("ended",function(){r.playing=!1;r.watched.add(r._lastTimeUpdate,e.currentTime);r.lastPosition=e.currentTime;q(r);a(r,"media-ended")});e.addEventListener("seeked",function(){var b=
|
|
59
|
+
r.lastPosition;r.lastPosition=e.currentTime;r._lastTimeUpdate=e.currentTime;a(r,"media-seeked",{from:Math.round(b),to:Math.round(e.currentTime)})});e.addEventListener("timeupdate",function(){r.playing&&e.currentTime>r._lastTimeUpdate&&r.watched.add(r._lastTimeUpdate,e.currentTime);r._lastTimeUpdate=e.currentTime;r.lastPosition=e.currentTime})}}function u(a){if(l._ytApiLoaded)a();else if(l._ytApiLoading)l._ytPendingPlayers.push(a);else{l._ytApiLoading=!0;var b=d.onYouTubeIframeAPIReady;d.onYouTubeIframeAPIReady=
|
|
60
|
+
function(){l._ytApiLoaded=!0;l._ytApiLoading=!1;b&&b();a();for(var e=0;e<l._ytPendingPlayers.length;e++)l._ytPendingPlayers[e]();l._ytPendingPlayers=[]};var e=document.createElement("script");e.src="https://www.youtube.com/iframe_api";document.head.appendChild(e)}}function h(e){var c=e.src||"",r=k(e);if(!l.tracked[r]){if(-1===c.indexOf("enablejsapi"))if(l.options.reloadIframes){var d=-1===c.indexOf("?")?"?":"&";e.src=c+d+"enablejsapi=1&origin="+encodeURIComponent(location.origin)}else{console.warn("Metrics.MediaTracker: YouTube iframe missing enablejsapi=1, set reloadIframes:true to auto-fix. iframe:",
|
|
61
|
+
e);return}e.id||(e.id="yt-"+r);u(function(){if(!l.tracked[r]){var c=b(r,"youtube",e,0);l.tracked[r]=c;var p=new YT.Player(e.id,{events:{onReady:function(a){c.duration=p.getDuration()||0},onStateChange:function(b){var e=p.getCurrentTime()||0;c.lastPosition=e;switch(b.data){case YT.PlayerState.PLAYING:c.playing=!0;c._lastTimeUpdate=e;c.duration=p.getDuration()||c.duration;a(c,"media-play");g(c);c._pollTimer=setInterval(function(){var a=p.getCurrentTime()||0;c.playing&&a>c._lastTimeUpdate&&c.watched.add(c._lastTimeUpdate,
|
|
62
|
+
a);c._lastTimeUpdate=a;c.lastPosition=a},1E3);break;case YT.PlayerState.PAUSED:if(!c.playing)break;c.playing=!1;c.watched.add(c._lastTimeUpdate,e);q(c);clearInterval(c._pollTimer);a(c,"media-pause");break;case YT.PlayerState.ENDED:c.playing=!1,c.watched.add(c._lastTimeUpdate,e),q(c),clearInterval(c._pollTimer),a(c,"media-ended")}}}});c._player=p}})}}function y(a){if(l._vimeoApiLoaded)a();else if(l._vimeoApiLoading)setTimeout(function(){y(a)},200);else{l._vimeoApiLoading=!0;var b=document.createElement("script");
|
|
63
|
+
b.src="https://player.vimeo.com/api/player.js";b.onload=function(){l._vimeoApiLoaded=!0;l._vimeoApiLoading=!1;a()};document.head.appendChild(b)}}function w(e){var c=k(e);l.tracked[c]||y(function(){if(!l.tracked[c]){var p=b(c,"vimeo",e,0);l.tracked[c]=p;var d=new Vimeo.Player(e);p._player=d;d.getDuration().then(function(a){p.duration=a||0});d.on("play",function(b){p.playing=!0;p.lastPosition=b.seconds||0;p._lastTimeUpdate=p.lastPosition;p.duration=b.duration||p.duration;a(p,"media-play");g(p)});d.on("pause",
|
|
64
|
+
function(b){p.playing&&(p.playing=!1,b=b.seconds||0,p.watched.add(p._lastTimeUpdate,b),p.lastPosition=b,q(p),a(p,"media-pause"))});d.on("ended",function(b){p.playing=!1;b=b.seconds||p.duration;p.watched.add(p._lastTimeUpdate,b);p.lastPosition=b;q(p);a(p,"media-ended")});d.on("seeked",function(b){var e=p.lastPosition;p.lastPosition=b.seconds||0;p._lastTimeUpdate=p.lastPosition;a(p,"media-seeked",{from:Math.round(e),to:Math.round(p.lastPosition)})});d.on("timeupdate",function(a){a=a.seconds||0;p.playing&&
|
|
65
|
+
a>p._lastTimeUpdate&&p.watched.add(p._lastTimeUpdate,a);p._lastTimeUpdate=a;p.lastPosition=a})}})}function m(){for(var a=document.querySelectorAll(l.options.mediaSelector),b=0;b<a.length;b++)n(a[b]);a=document.querySelectorAll("iframe[src]");for(b=0;b<a.length;b++){var c=a[b].src||"";/youtube\.com\/embed|youtube-nocookie\.com\/embed/.test(c)?h(a[b]):/player\.vimeo\.com/.test(c)?w(a[b]):/w\.soundcloud\.com\/player/.test(c)?trackSoundCloud(a[b]):/dailymotion\.com\/embed/.test(c)?trackDailymotion(a[b]):
|
|
66
|
+
/open\.spotify\.com\/embed/.test(c)?trackSpotify(a[b]):/player\.twitch\.tv/.test(c)?trackTwitch(a[b]):/muse\.ai\/embed/.test(c)&&trackMuseAi(a[b])}a=document.querySelectorAll('[class*="wistia_embed"], [class*="wistia_async_"]');for(b=0;b<a.length;b++)trackWistia(a[b]);a=document.querySelectorAll(".jwplayer, [data-jw-id]");for(b=0;b<a.length;b++)trackJWPlayer(a[b])}function x(){if(window.MutationObserver&&l.options.observeDom){var a=l.options.observeRoot||document.body;l._mutationObserver=new MutationObserver(function(a){a.forEach(function(a){a.addedNodes.forEach(function(a){if(1===
|
|
67
|
+
a.nodeType){a.matches&&a.matches("video, audio")&&n(a);if("IFRAME"===a.tagName&&a.src){var b=a.src;/youtube\.com\/embed/.test(b)?h(a):/player\.vimeo\.com/.test(b)?w(a):/w\.soundcloud\.com\/player/.test(b)?trackSoundCloud(a):/dailymotion\.com\/embed/.test(b)?trackDailymotion(a):/open\.spotify\.com\/embed/.test(b)?trackSpotify(a):/player\.twitch\.tv/.test(b)?trackTwitch(a):/muse\.ai\/embed/.test(b)&&trackMuseAi(a)}a.className&&/wistia_embed|wistia_async_/.test(a.className)&&trackWistia(a);a.className&&
|
|
68
|
+
/jwplayer/.test(a.className)&&trackJWPlayer(a);if(a.querySelectorAll){b=a.querySelectorAll("video, audio");for(var e=0;e<b.length;e++)n(b[e]);e=a.querySelectorAll("iframe[src]");for(var c=0;c<e.length;c++)b=e[c].src||"",/youtube\.com\/embed/.test(b)?h(e[c]):/player\.vimeo\.com/.test(b)?w(e[c]):/w\.soundcloud\.com\/player/.test(b)?trackSoundCloud(e[c]):/dailymotion\.com\/embed/.test(b)?trackDailymotion(e[c]):/open\.spotify\.com\/embed/.test(b)?trackSpotify(e[c]):/player\.twitch\.tv/.test(b)?trackTwitch(e[c]):
|
|
69
|
+
/muse\.ai\/embed/.test(b)&&trackMuseAi(e[c]);b=a.querySelectorAll('[class*="wistia_embed"], [class*="wistia_async_"]');for(e=0;e<b.length;e++)trackWistia(b[e]);a=a.querySelectorAll(".jwplayer, [data-jw-id]");for(b=0;b<a.length;b++)trackJWPlayer(a[b])}}})})});l._mutationObserver.observe(a,{childList:!0,subtree:!0})}}function f(){for(var b in l.tracked){var c=l.tracked[b];c.playing&&("native"===c.type&&c.el&&(c.watched.add(c._lastTimeUpdate,c.el.currentTime||c.lastPosition),c.lastPosition=c.el.currentTime||
|
|
70
|
+
c.lastPosition),a(c,"media-checkpoint"))}}var v=d.Metrics;if(v){var t={checkpointInterval:10,autoDiscover:!0,mediaSelector:"video, audio",reloadIframes:!1,observeDom:!0,observeRoot:null,checkpointDebounce:1E3},l={initialized:!1,options:null,tracked:{},_counter:0,_mutationObserver:null,_ytApiLoaded:!1,_ytApiLoading:!1,_ytPendingPlayers:[],_vimeoApiLoaded:!1,_vimeoApiLoading:!1};c.prototype.add=function(a,b){if(!(b<=a)){a={start:Math.floor(a),end:Math.ceil(b)};b=[];for(var e=!1,c=0;c<this.ranges.length;c++){var g=
|
|
71
|
+
this.ranges[c];g.end<a.start?b.push(g):g.start>a.end?(e||(b.push(a),e=!0),b.push(g)):(a.start=Math.min(a.start,g.start),a.end=Math.max(a.end,g.end))}e||b.push(a);this.ranges=b}};c.prototype.total=function(){for(var a=0,b=0;b<this.ranges.length;b++)a+=this.ranges[b].end-this.ranges[b].start;return a};v.MediaTracker={init:function(a){if(l.initialized)return console.warn("Metrics.MediaTracker already initialized"),this;var b={},c;for(c in t)t.hasOwnProperty(c)&&(b[c]=t[c]);for(c in a||{})a.hasOwnProperty(c)&&
|
|
72
|
+
void 0!==a[c]&&(b[c]=a[c]);l.options=b;l.initialized=!0;!v._endpoint&&a&&a.endpoint&&v.init({endpoint:a.endpoint,page:a.page,trackUnload:a.trackUnload});b.autoDiscover&&setTimeout(function(){m()},500);b.observeDom&&x();v.onVisibilityChange(function(a){a||f()},"MediaTracker.flush");return this},trackNative:function(a,b){b&&(a.id=b);n(a)},trackYouTube:function(a,b){b&&(a.id=b);h(a)},trackVimeo:function(a,b){b&&(a.id=b);w(a)},trackSoundCloud:function(a,b){b&&(a.id=b);trackSoundCloud(a)},trackWistia:function(a,
|
|
73
73
|
b){b&&(a.id=b);trackWistia(a)},trackJWPlayer:function(a,b){b&&(a.id=b);trackJWPlayer(a)},trackDailymotion:function(a,b){b&&(a.id=b);trackDailymotion(a)},trackSpotify:function(a,b){b&&(a.id=b);trackSpotify(a)},trackTwitch:function(a,b){b&&(a.id=b);trackTwitch(a)},trackMuseAi:function(a,b){b&&(a.id=b);trackMuseAi(a)},getTracked:function(){var a={},b;for(b in l.tracked){var c=l.tracked[b];a[b]={id:c.id,type:c.type,playing:c.playing,position:Math.round(c.lastPosition),duration:Math.round(c.duration),
|
|
74
|
-
watched:c.watched.total()}}return a},flush:
|
|
75
|
-
function loadSoundCloudAPI(
|
|
76
|
-
function trackSoundCloud(
|
|
77
|
-
(
|
|
78
|
-
to:Math.round(
|
|
79
|
-
function trackWistia(
|
|
80
|
-
function(){if(
|
|
81
|
-
|
|
82
|
-
function trackJWPlayer(
|
|
83
|
-
g.watched.add(g._lastTimeUpdate,
|
|
84
|
-
b);g._lastTimeUpdate=b;g.lastPosition=b;g.duration=a.duration||g.duration});return!0}var
|
|
85
|
-
function trackDailymotion(
|
|
86
|
-
!1;
|
|
87
|
-
|
|
88
|
-
function trackSpotify(
|
|
89
|
-
|
|
90
|
-
function trackTwitch(
|
|
91
|
-
c);
|
|
92
|
-
var
|
|
93
|
-
function trackMuseAi(
|
|
94
|
-
0,
|
|
95
|
-
"*")}catch(
|
|
74
|
+
watched:c.watched.total()}}return a},flush:f,rescan:m,destroy:function(){for(var a in l.tracked){var b=l.tracked[a];q(b);b._pollTimer&&clearInterval(b._pollTimer)}l.tracked={};l._mutationObserver&&(l._mutationObserver.disconnect(),l._mutationObserver=null);l.initialized=!1},defaults:t,state:l}}else console.warn("Metrics.MediaTracker: Metrics core not loaded")})("undefined"!==typeof window?window:this);
|
|
75
|
+
function loadSoundCloudAPI(d){if(root.SC&&root.SC.Widget)d();else{var k=document.createElement("script");k.src="https://w.soundcloud.com/player/api.js";k.onload=d;document.head.appendChild(k)}}
|
|
76
|
+
function trackSoundCloud(d){var k=genId(d);state.tracked[k]||loadSoundCloudAPI(function(){if(!state.tracked[k]){var c=SC.Widget(d),b=createTracker(k,"soundcloud",d,0);state.tracked[k]=b;c.bind(SC.Widget.Events.READY,function(){c.getDuration(function(a){b.duration=(a||0)/1E3})});c.bind(SC.Widget.Events.PLAY,function(){b.playing=!0;c.getPosition(function(a){b.lastPosition=(a||0)/1E3;b._lastTimeUpdate=b.lastPosition;sendEvent(b,"media-play");startCheckpoints(b)})});c.bind(SC.Widget.Events.PAUSE,function(){b.playing&&
|
|
77
|
+
(b.playing=!1,c.getPosition(function(a){a=(a||0)/1E3;b.watched.add(b._lastTimeUpdate,a);b.lastPosition=a;stopCheckpoints(b);sendEvent(b,"media-pause")}))});c.bind(SC.Widget.Events.FINISH,function(){b.playing=!1;b.watched.add(b._lastTimeUpdate,b.duration);b.lastPosition=b.duration;stopCheckpoints(b);sendEvent(b,"media-ended")});c.bind(SC.Widget.Events.SEEK,function(a){var c=b.lastPosition;b.lastPosition=(a.currentPosition||0)/1E3;b._lastTimeUpdate=b.lastPosition;sendEvent(b,"media-seeked",{from:Math.round(c),
|
|
78
|
+
to:Math.round(b.lastPosition)})});c.bind(SC.Widget.Events.PLAY_PROGRESS,function(a){a=(a.currentPosition||0)/1E3;b.playing&&a>b._lastTimeUpdate&&b.watched.add(b._lastTimeUpdate,a);b._lastTimeUpdate=a;b.lastPosition=a})}})}
|
|
79
|
+
function trackWistia(d){var k=genId(d);if(!state.tracked[k]){var c=d.getAttribute("data-wistia-id")||(d.className.match(/wistia_async_(\w+)/)||[])[1]||k;root._wq=root._wq||[];root._wq.push({id:c,onReady:function(b){if(!state.tracked[k]){var a=createTracker(k,"wistia",d,b.duration()||0);state.tracked[k]=a;a._player=b;b.bind("play",function(){a.playing=!0;a.lastPosition=b.time();a._lastTimeUpdate=a.lastPosition;a.duration=b.duration()||a.duration;sendEvent(a,"media-play");startCheckpoints(a)});b.bind("pause",
|
|
80
|
+
function(){if(a.playing){a.playing=!1;var c=b.time();a.watched.add(a._lastTimeUpdate,c);a.lastPosition=c;stopCheckpoints(a);sendEvent(a,"media-pause")}});b.bind("end",function(){a.playing=!1;a.watched.add(a._lastTimeUpdate,a.duration);a.lastPosition=a.duration;stopCheckpoints(a);sendEvent(a,"media-ended")});b.bind("seek",function(b,c){a.lastPosition=b;a._lastTimeUpdate=b;sendEvent(a,"media-seeked",{from:Math.round(c),to:Math.round(b)})});b.bind("secondchange",function(b){a.playing&&b>a._lastTimeUpdate&&
|
|
81
|
+
a.watched.add(a._lastTimeUpdate,b);a._lastTimeUpdate=b;a.lastPosition=b})}}});root.Wistia||(c=document.createElement("script"),c.src="https://fast.wistia.com/assets/external/E-v1.js",c.async=!0,document.head.appendChild(c))}}
|
|
82
|
+
function trackJWPlayer(d){function k(){if(!root.jwplayer||"function"!==typeof root.jwplayer)return!1;try{var a=jwplayer(b)}catch(q){return!1}if(!a||!a.getState)return!1;var g=createTracker(c,"jwplayer",d,a.getDuration()||0);state.tracked[c]=g;g._player=a;a.on("play",function(){g.playing=!0;g.lastPosition=a.getPosition();g._lastTimeUpdate=g.lastPosition;g.duration=a.getDuration()||g.duration;sendEvent(g,"media-play");startCheckpoints(g)});a.on("pause",function(){if(g.playing){g.playing=!1;var b=a.getPosition();
|
|
83
|
+
g.watched.add(g._lastTimeUpdate,b);g.lastPosition=b;stopCheckpoints(g);sendEvent(g,"media-pause")}});a.on("complete",function(){g.playing=!1;g.watched.add(g._lastTimeUpdate,g.duration);g.lastPosition=g.duration;stopCheckpoints(g);sendEvent(g,"media-ended")});a.on("seek",function(a){g.lastPosition=a.offset;g._lastTimeUpdate=a.offset;sendEvent(g,"media-seeked",{from:Math.round(a.position),to:Math.round(a.offset)})});a.on("time",function(a){var b=a.position;g.playing&&b>g._lastTimeUpdate&&g.watched.add(g._lastTimeUpdate,
|
|
84
|
+
b);g._lastTimeUpdate=b;g.lastPosition=b;g.duration=a.duration||g.duration});return!0}var c=genId(d);if(!state.tracked[c]){var b=d.id||c;k()||setTimeout(function(){k()},2E3)}}
|
|
85
|
+
function trackDailymotion(d){function k(){if(!state.tracked[c]){var b=createTracker(c,"dailymotion",d,0);state.tracked[c]=b;var a=DM.player(d,{events:{playing:function(){b.playing=!0;b.lastPosition=a.currentTime||0;b._lastTimeUpdate=b.lastPosition;b.duration=a.duration||b.duration;sendEvent(b,"media-play");startCheckpoints(b)},pause:function(){if(b.playing){b.playing=!1;var c=a.currentTime||0;b.watched.add(b._lastTimeUpdate,c);b.lastPosition=c;stopCheckpoints(b);sendEvent(b,"media-pause")}},end:function(){b.playing=
|
|
86
|
+
!1;b.watched.add(b._lastTimeUpdate,b.duration);b.lastPosition=b.duration;stopCheckpoints(b);sendEvent(b,"media-ended")},seeking:function(){var c=b.lastPosition;b.lastPosition=a.currentTime||0;b._lastTimeUpdate=b.lastPosition;sendEvent(b,"media-seeked",{from:Math.round(c),to:Math.round(b.lastPosition)})},timeupdate:function(){var c=a.currentTime||0;b.playing&&c>b._lastTimeUpdate&&b.watched.add(b._lastTimeUpdate,c);b._lastTimeUpdate=c;b.lastPosition=c;b.duration=a.duration||b.duration}}});b._player=
|
|
87
|
+
a}}var c=genId(d);state.tracked[c]||function(){if(root.DM&&root.DM.player)k();else{var b=document.createElement("script");b.src="https://api.dmcdn.net/all.js";b.onload=function(){k()};document.head.appendChild(b)}}()}
|
|
88
|
+
function trackSpotify(d){var k=genId(d);if(!state.tracked[k]){var c=createTracker(k,"spotify",d,0);state.tracked[k]=c;window.addEventListener("message",function(b){if(b.data&&b.source===d.contentWindow){try{var a="string"===typeof b.data?JSON.parse(b.data):b.data}catch(q){return}if(a.type&&"playback_update"===a.type){b=a.payload&&a.payload.position||0;b/=1E3;var g=a.payload&&a.payload.isPaused;c.duration=(a.payload&&a.payload.duration||0)/1E3||c.duration;g||c.playing?g&&c.playing?(c.playing=!1,c.watched.add(c._lastTimeUpdate,
|
|
89
|
+
b),c.lastPosition=b,stopCheckpoints(c),sendEvent(c,"media-pause")):!g&&c.playing&&b>c._lastTimeUpdate&&(c.watched.add(c._lastTimeUpdate,b),c._lastTimeUpdate=b,c.lastPosition=b):(c.playing=!0,c.lastPosition=b,c._lastTimeUpdate=b,sendEvent(c,"media-play"),startCheckpoints(c))}}})}}
|
|
90
|
+
function trackTwitch(d){function k(){if(!state.tracked[c]){d.id||(d.id="twitch-"+c);var b=createTracker(c,"twitch",d,0);state.tracked[c]=b;var a=new Twitch.Player(d.id,{});b._player=a;a.addEventListener(Twitch.Player.PLAY,function(){b.playing=!0;b.lastPosition=a.getCurrentTime()||0;b._lastTimeUpdate=b.lastPosition;b.duration=a.getDuration()||b.duration;sendEvent(b,"media-play");startCheckpoints(b);b._pollTimer=setInterval(function(){var c=a.getCurrentTime()||0;b.playing&&c>b._lastTimeUpdate&&b.watched.add(b._lastTimeUpdate,
|
|
91
|
+
c);b._lastTimeUpdate=c;b.lastPosition=c},1E3)});a.addEventListener(Twitch.Player.PAUSE,function(){if(b.playing){b.playing=!1;var c=a.getCurrentTime()||0;b.watched.add(b._lastTimeUpdate,c);b.lastPosition=c;stopCheckpoints(b);clearInterval(b._pollTimer);sendEvent(b,"media-pause")}});a.addEventListener(Twitch.Player.ENDED,function(){b.playing=!1;var c=a.getCurrentTime()||b.duration;b.watched.add(b._lastTimeUpdate,c);b.lastPosition=c;stopCheckpoints(b);clearInterval(b._pollTimer);sendEvent(b,"media-ended")})}}
|
|
92
|
+
var c=genId(d);state.tracked[c]||function(){if(root.Twitch&&root.Twitch.Player)k();else{var b=document.createElement("script");b.src="https://player.twitch.tv/js/embed/v1.js";b.onload=function(){k()};document.head.appendChild(b)}}()}
|
|
93
|
+
function trackMuseAi(d){var k=genId(d);if(!state.tracked[k]){var c=createTracker(k,"museai",d,0);state.tracked[k]=c;window.addEventListener("message",function(b){if(b.data&&b.source===d.contentWindow){try{var a="string"===typeof b.data?JSON.parse(b.data):b.data}catch(g){return}"play"===a.event?(c.playing=!0,c.lastPosition=a.currentTime||0,c._lastTimeUpdate=c.lastPosition,c.duration=a.duration||c.duration,sendEvent(c,"media-play"),startCheckpoints(c)):"pause"===a.event?c.playing&&(c.playing=!1,b=a.currentTime||
|
|
94
|
+
0,c.watched.add(c._lastTimeUpdate,b),c.lastPosition=b,stopCheckpoints(c),sendEvent(c,"media-pause")):"ended"===a.event?(c.playing=!1,c.watched.add(c._lastTimeUpdate,c.duration),c.lastPosition=c.duration,stopCheckpoints(c),sendEvent(c,"media-ended")):"timeupdate"===a.event&&(b=a.currentTime||0,c.duration=a.duration||c.duration,c.playing&&b>c._lastTimeUpdate&&c.watched.add(c._lastTimeUpdate,b),c._lastTimeUpdate=b,c.lastPosition=b)}});try{d.contentWindow.postMessage({method:"addEventListener",value:"play"},
|
|
95
|
+
"*")}catch(b){}try{d.contentWindow.postMessage({method:"addEventListener",value:"pause"},"*")}catch(b){}try{d.contentWindow.postMessage({method:"addEventListener",value:"ended"},"*")}catch(b){}try{d.contentWindow.postMessage({method:"addEventListener",value:"timeupdate"},"*")}catch(b){}}}"use strict";
|
|
96
|
+
(function(d){function k(a){a=document.querySelectorAll(a);for(var b=[],c=0,d=h.options&&h.options.minSectionHeight||0,g=0;g<a.length;g++){var k=a[g];if(!(k.offsetHeight<d)){if(!k.id){var t=(k.textContent||"").trim().slice(0,60).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");k.id=t||"section-"+c}b.push({el:k,id:k.id,tag:k.tagName.toLowerCase(),ordinal:c++,snippet:(k.textContent||"").trim().slice(0,80)})}}return b}function c(){var a=h.options,b=window.scrollY||window.pageYOffset;if(Math.abs(b-
|
|
97
|
+
h._prevY)>a.settleTolerance)h._prevY=b,h.scrollTimer=setTimeout(c,a.recheckInterval);else{var d=window.scrollY||window.pageYOffset;for(var g=h.options,f=null,k=Infinity,t=0;t<h.sections.length;t++){var l=h.sections[t],e=l.el.offsetTop;e<=d+g.sectionLookback&&(e=Math.abs(e-d-180),e<k&&(k=e,f=l))}(d=f)&&!h.seen[d.id]&&(h.seen[d.id]=!0,n.send("section:"+d.id,{tag:d.tag,ordinal:d.ordinal,snippet:d.snippet}));d=document.documentElement.scrollHeight-window.innerHeight;if(0<d)for(b=Math.round(b/d*100),d=
|
|
98
|
+
0;d<a.depthMilestones.length;d++)g=a.depthMilestones[d],b>=g&&!h.depthHit[g]&&(h.depthHit[g]=!0,n.send("depth:"+g+"%"))}}function b(){h.anchorCooling||(clearTimeout(h.scrollTimer),h._prevY=window.scrollY||window.pageYOffset,h.scrollTimer=setTimeout(c,h.options.debounce))}function a(){var a=h.options;if(a.tocSelector){for(var b=window.scrollY||window.pageYOffset,c="",d=0;d<h.tocSections.length;d++)b>=h.tocSections[d].el.offsetTop-160&&(c=h.tocSections[d].id);b=document.querySelectorAll(a.tocSelector);
|
|
99
|
+
for(d=0;d<b.length;d++)b[d].classList.remove(a.tocActiveClass),b[d].getAttribute("href")==="#"+c&&b[d].classList.add(a.tocActiveClass)}}function g(a){if(a=a.target.closest("a[href]")){var b=a.getAttribute("href")||"";"#"===b.charAt(0)?(h.anchorCooling=!0,setTimeout(function(){h.anchorCooling=!1},h.options.anchorCooldown),n.send("anchor:"+b.slice(1))):n.send(a.dataset.track||"link:"+b)}}function q(){for(var a=window.scrollY||window.pageYOffset,b=0;b<h.sections.length;b++){var c=h.sections[b].el.getBoundingClientRect();
|
|
100
|
+
-100<=c.top&&c.top<window.innerHeight&&(h.seen[h.sections[b].id]=!0)}b=document.documentElement.scrollHeight-window.innerHeight;if(0<b)for(a=Math.round(a/b*100),b=0;b<h.options.depthMilestones.length;b++)c=h.options.depthMilestones[b],a>=c&&(h.depthHit[c]=!0)}var n=d.Metrics;if(n){var u={sections:"h2[id], h3[id], section[id], [data-section]",minSectionHeight:100,debounce:1E3,initDelay:800,anchorCooldown:1500,depthMilestones:[25,50,75,100],sectionLookback:300,settleTolerance:2,recheckInterval:500,
|
|
101
|
+
trackClicks:!0,tocSelector:null,tocActiveClass:"active",tocSectionSelector:"h2[id]"},h={initialized:!1,options:null,sections:[],tocSections:[],seen:{},depthHit:{},scrollTimer:null,anchorCooling:!1,_prevY:-1};n.ScrollTracker={init:function(c){if(h.initialized)return console.warn("Metrics.ScrollTracker already initialized"),this;var d={},m;for(m in u)u.hasOwnProperty(m)&&(d[m]=u[m]);for(m in c||{})c.hasOwnProperty(m)&&void 0!==c[m]&&(d[m]=c[m]);h.options=d;h.initialized=!0;!n._endpoint&&c&&c.endpoint&&
|
|
102
|
+
n.init({endpoint:c.endpoint,page:c.page,sessionKey:c.sessionKey,sessionId:c.sessionId,extra:c.extra,trackUnload:c.trackUnload});setTimeout(function(){h.sections=k(d.sections);d.tocSelector&&d.tocSectionSelector&&(h.tocSections=k(d.tocSectionSelector));q();window.addEventListener("scroll",b,{passive:!0});d.tocSelector&&(window.addEventListener("scroll",a,{passive:!0}),a())},d.initDelay);d.trackClicks&&document.addEventListener("click",g);return this},send:function(a,b){n.send(a,b)},markSeen:function(a){h.seen[a]=
|
|
103
|
+
!0},getSessionId:function(){return n.getSessionId()},getSections:function(){return h.sections.map(function(a){return{id:a.id,tag:a.tag,ordinal:a.ordinal,snippet:a.snippet}})},getSeen:function(){var a={},b;for(b in h.seen)a[b]=!0;return a},reset:function(){h.seen={};h.depthHit={};h.anchorCooling=!1;clearTimeout(h.scrollTimer);h.sections=k(h.options.sections);q()},destroy:function(){window.removeEventListener("scroll",b);window.removeEventListener("scroll",a);document.removeEventListener("click",g);
|
|
104
|
+
clearTimeout(h.scrollTimer);h.initialized=!1},defaults:u,state:h}}else console.warn("Metrics.ScrollTracker: Metrics core not loaded")})("undefined"!==typeof window?window:this);"use strict";
|
|
105
|
+
(function(d){function k(a){return a.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,60)}function c(a){a=document.querySelectorAll(a);for(var b=[],c=0,d=f.options&&f.options.minSectionHeight||0,g=0;g<a.length;g++){var h=a[g];h.offsetHeight<d||(h.id||(h.id=k(h.textContent||"")||"section-"+c),b.push({el:h,id:h.id,tag:h.tagName.toLowerCase(),ordinal:c++,snippet:(h.textContent||"").trim().slice(0,80)}))}return b}function b(){var a=f.options,c=window.scrollY||window.pageYOffset;if(Math.abs(c-
|
|
106
|
+
f._prevY)>a.settleTolerance)f._prevY=c,f.scrollTimer=setTimeout(b,a.recheckInterval);else{var e=window.scrollY||window.pageYOffset;for(var d=f.options,g=null,h=Infinity,k=0;k<f.sections.length;k++){var q=f.sections[k],n=q.el.offsetTop;n<=e+d.sectionLookback&&(n=Math.abs(n-e-180),n<h&&(h=n,g=q))}(e=g)&&!f.seen[e.id]&&(f.seen[e.id]=!0,m.send("section:"+e.id,{tag:e.tag,ordinal:e.ordinal,snippet:e.snippet}));e=document.documentElement.scrollHeight-window.innerHeight;if(0<e)for(c=Math.round(c/e*100),e=
|
|
107
|
+
0;e<a.depthMilestones.length;e++)d=a.depthMilestones[e],c>=d&&!f.depthHit[d]&&(f.depthHit[d]=!0,m.send("depth:"+d+"%"))}}function a(){f.anchorCooling||(clearTimeout(f.scrollTimer),f._prevY=window.scrollY||window.pageYOffset,f.scrollTimer=setTimeout(b,f.options.debounce))}function g(){var a=f.options;if(a.tocSelector){for(var b=window.scrollY||window.pageYOffset,c="",d=0;d<f.tocSections.length;d++)b>=f.tocSections[d].el.offsetTop-160&&(c=f.tocSections[d].id);b=document.querySelectorAll(a.tocSelector);
|
|
108
|
+
for(d=0;d<b.length;d++)b[d].classList.remove(a.tocActiveClass),b[d].getAttribute("href")==="#"+c&&b[d].classList.add(a.tocActiveClass)}}function q(a){if(a=a.target.closest("a[href]")){var b=a.getAttribute("href")||"";"#"===b.charAt(0)?(f.anchorCooling=!0,setTimeout(function(){f.anchorCooling=!1},f.options.anchorCooldown),m.send("anchor:"+b.slice(1))):m.send(a.dataset.track||"link:"+b)}}function n(){if(f.activeSection&&f.options.trackDwell){var a=Math.round((Date.now()-f.activeSince)/1E3);if(0<a){var b=
|
|
109
|
+
f.dynamicSections[f.activeSection];m.send("dwell:"+f.activeSection,{seconds:a,name:b?b.name:f.activeSection})}f.activeSection=null;f.activeSince=null}}function u(a,b){var c=b.id||a.id||a.getAttribute("data-section")||a.getAttribute("data-track-section")||k(a.textContent||"")||"dyn-"+Object.keys(f.dynamicSections).length;a.id||(a.id=c);f.dynamicSections[c]={el:a,id:c,name:b.name||a.getAttribute("data-section-name")||a.getAttribute("title")||c,snippet:(a.textContent||"").trim().slice(0,80),observedAt:Date.now()};
|
|
110
|
+
window.IntersectionObserver&&!1!==b.autoTrack&&(b=new IntersectionObserver(function(a){a.forEach(function(a){a.isIntersecting&&.3<a.intersectionRatio?v.opened(c):a.isIntersecting||f.activeSection!==c||v.closed(c)})},{threshold:[0,.3]}),b.observe(a),f.dynamicSections[c]._io=b);return c}function h(a){var b=a.querySelectorAll("a[href], li[data-action], li[data-name]");if(b.length){a=new IntersectionObserver(function(a){a.forEach(function(a){if(a.isIntersecting){a=a.target;var b="nav-link:"+(a.getAttribute("data-name")||
|
|
111
|
+
a.getAttribute("data-action")||a.getAttribute("href")||a.textContent.trim().slice(0,40));f._navLinksSeen[b]||(f._navLinksSeen[b]=!0,m.send(b,{text:a.textContent.trim().slice(0,60)}))}})},{root:a,threshold:.5});for(var c=0;c<b.length;c++)a.observe(b[c]);f._navObservers.push(a)}}function y(){if(window.MutationObserver&&f.options.observeDom){var a=f.options.observeRoot||document.body,b=f.options.observeSelector;f._mutationObserver=new MutationObserver(function(a){a.forEach(function(a){a.addedNodes.forEach(function(a){if(1===
|
|
112
|
+
a.nodeType&&(a.matches&&a.matches(b)&&u(a,{}),a.querySelectorAll)){a=a.querySelectorAll(b);for(var c=0;c<a.length;c++)u(a[c],{})}})})});f._mutationObserver.observe(a,{childList:!0,subtree:!0})}}function w(){for(var a=window.scrollY||window.pageYOffset,b=0;b<f.sections.length;b++){var c=f.sections[b].el.getBoundingClientRect();-100<=c.top&&c.top<window.innerHeight&&(f.seen[f.sections[b].id]=!0)}b=document.documentElement.scrollHeight-window.innerHeight;if(0<b)for(a=Math.round(a/b*100),b=0;b<f.options.depthMilestones.length;b++)c=
|
|
113
|
+
f.options.depthMilestones[b],a>=c&&(f.depthHit[c]=!0)}var m=d.Metrics;if(m){var x={sections:"h2[id], h3[id], section[id], [data-section]",minSectionHeight:100,debounce:1E3,initDelay:800,anchorCooldown:1500,depthMilestones:[25,50,75,100],sectionLookback:300,settleTolerance:2,recheckInterval:500,observeDom:!1,observeRoot:null,observeSelector:"[data-section], [data-track-section]",trackDwell:!0,navContainers:null,trackContextuals:!0,trackClicks:!0,tocSelector:null,tocActiveClass:"active",tocSectionSelector:"h2[id]"},
|
|
114
|
+
f={initialized:!1,options:null,sections:[],tocSections:[],seen:{},depthHit:{},scrollTimer:null,anchorCooling:!1,_prevY:-1,dynamicSections:{},activeSection:null,activeSince:null,_mutationObserver:null,_navObservers:[],_navLinksSeen:{}},v={init:function(b){if(f.initialized)return console.warn("Metrics.NavigationTracker already initialized"),this;var d={},e;for(e in x)x.hasOwnProperty(e)&&(d[e]=x[e]);for(e in b||{})b.hasOwnProperty(e)&&void 0!==b[e]&&(d[e]=b[e]);f.options=d;f.initialized=!0;!m._endpoint&&
|
|
115
|
+
b&&b.endpoint&&m.init({endpoint:b.endpoint,page:b.page,sessionKey:b.sessionKey,sessionId:b.sessionId,extra:b.extra,trackUnload:b.trackUnload});setTimeout(function(){f.sections=c(d.sections);d.tocSelector&&d.tocSectionSelector&&(f.tocSections=c(d.tocSectionSelector));w();window.addEventListener("scroll",a,{passive:!0});d.tocSelector&&(window.addEventListener("scroll",g,{passive:!0}),g());d.observeDom&&y();if(d.navContainers){var b=f.options.navContainers;if(b&&window.IntersectionObserver){b=document.querySelectorAll(b);
|
|
116
|
+
for(var e=0;e<b.length;e++)h(b[e])}}},d.initDelay);d.trackClicks&&document.addEventListener("click",q);if(d.trackDwell)m.onVisibilityChange(function(a){a||n()},"NavigationTracker.dwell");return this},observe:function(a,b){return u(a,b||{})},opened:function(a){if(f.activeSection!==a)if(n(),f.activeSection=a,f.activeSince=Date.now(),f.seen[a])m.send("switched:"+a,{name:(f.dynamicSections[a]||{}).name||a});else{f.seen[a]=!0;var b=f.dynamicSections[a];m.send("opened:"+a,{name:b?b.name:a,snippet:b?b.snippet:
|
|
117
|
+
""})}},closed:function(a){f.activeSection===a&&n()},observeNavContainer:function(a){h(a)},send:function(a,b){m.send(a,b)},markSeen:function(a){f.seen[a]=!0},getSessionId:function(){return m.getSessionId()},getSections:function(){return f.sections.map(function(a){return{id:a.id,tag:a.tag,ordinal:a.ordinal,snippet:a.snippet}})},getDynamicSections:function(){var a={},b;for(b in f.dynamicSections){var c=f.dynamicSections[b];a[b]={id:c.id,name:c.name,snippet:c.snippet}}return a},getSeen:function(){var a=
|
|
118
|
+
{},b;for(b in f.seen)a[b]=!0;return a},getActive:function(){return f.activeSection?{id:f.activeSection,since:f.activeSince,elapsed:Math.round((Date.now()-f.activeSince)/1E3)}:null},reset:function(){n();f.seen={};f.depthHit={};f.anchorCooling=!1;f._navLinksSeen={};clearTimeout(f.scrollTimer);for(var a in f.dynamicSections)f.dynamicSections[a]._io&&f.dynamicSections[a]._io.disconnect();f.dynamicSections={};f.activeSection=null;f.activeSince=null;f.sections=c(f.options.sections);w()},destroy:function(){n();
|
|
119
|
+
window.removeEventListener("scroll",a);window.removeEventListener("scroll",g);document.removeEventListener("click",q);clearTimeout(f.scrollTimer);f._mutationObserver&&(f._mutationObserver.disconnect(),f._mutationObserver=null);for(var b in f.dynamicSections)f.dynamicSections[b]._io&&f.dynamicSections[b]._io.disconnect();for(b=0;b<f._navObservers.length;b++)f._navObservers[b].disconnect();f._navObservers=[];f.initialized=!1},defaults:x,state:f};m.NavigationTracker=v;m.SectionTracker=v;m.ScrollTracker=
|
|
120
|
+
v}else console.warn("Metrics.NavigationTracker: Metrics core not loaded")})("undefined"!==typeof window?window:this);"use strict";
|
|
121
|
+
(function(d){function k(a){if(a.id)return a.id;if(a=a.src||a.currentSrc||""){var b=a.match(/(?:youtu\.be\/|youtube\.com\/embed\/|vimeo\.com\/video\/|vimeo\.com\/)([^?&#]+)/);if(b)return b[1];if((a=a.split("/").pop().split("?")[0])&&60>a.length)return a}return"media-"+l._counter++}function c(){this.ranges=[]}function b(a,b,d,g){return{id:a,type:b,el:d,duration:g||0,playing:!1,lastPosition:0,lastCheckpointAt:0,watched:new c,checkpointTimer:null,_lastTimeUpdate:0}}function a(a,b,c){var d={type:a.type,
|
|
122
|
+
position:Math.round(a.lastPosition),duration:Math.round(a.duration),watched:a.watched.total()};if(c)for(var e in c)d[e]=c[e];v.send(b+":"+a.id,d)}function g(b){q(b);b.checkpointTimer=setInterval(function(){b.playing&&a(b,"media-checkpoint")},1E3*l.options.checkpointInterval)}function q(a){a.checkpointTimer&&(clearInterval(a.checkpointTimer),a.checkpointTimer=null)}function n(c){var d=k(c);if(!l.tracked[d]){var e=b(d,"native",c,c.duration||0);l.tracked[d]=e;c.addEventListener("loadedmetadata",function(){e.duration=
|
|
123
|
+
c.duration||0});c.addEventListener("play",function(){e.playing=!0;e.lastPosition=c.currentTime;e._lastTimeUpdate=c.currentTime;a(e,"media-play");g(e)});c.addEventListener("pause",function(){e.playing&&(e.playing=!1,e.watched.add(e._lastTimeUpdate,c.currentTime),e.lastPosition=c.currentTime,q(e),a(e,"media-pause"))});c.addEventListener("ended",function(){e.playing=!1;e.watched.add(e._lastTimeUpdate,c.currentTime);e.lastPosition=c.currentTime;q(e);a(e,"media-ended")});c.addEventListener("seeked",function(){var b=
|
|
124
|
+
e.lastPosition;e.lastPosition=c.currentTime;e._lastTimeUpdate=c.currentTime;a(e,"media-seeked",{from:Math.round(b),to:Math.round(c.currentTime)})});c.addEventListener("timeupdate",function(){e.playing&&c.currentTime>e._lastTimeUpdate&&e.watched.add(e._lastTimeUpdate,c.currentTime);e._lastTimeUpdate=c.currentTime;e.lastPosition=c.currentTime})}}function u(a){if(l._ytApiLoaded)a();else if(l._ytApiLoading)l._ytPendingPlayers.push(a);else{l._ytApiLoading=!0;var b=d.onYouTubeIframeAPIReady;d.onYouTubeIframeAPIReady=
|
|
125
|
+
function(){l._ytApiLoaded=!0;l._ytApiLoading=!1;b&&b();a();for(var c=0;c<l._ytPendingPlayers.length;c++)l._ytPendingPlayers[c]();l._ytPendingPlayers=[]};var c=document.createElement("script");c.src="https://www.youtube.com/iframe_api";document.head.appendChild(c)}}function h(c){var d=c.src||"",e=k(c);if(!l.tracked[e]){if(-1===d.indexOf("enablejsapi"))if(l.options.reloadIframes){var f=-1===d.indexOf("?")?"?":"&";c.src=d+f+"enablejsapi=1&origin="+encodeURIComponent(location.origin)}else{console.warn("Metrics.MediaTracker: YouTube iframe missing enablejsapi=1, set reloadIframes:true to auto-fix. iframe:",
|
|
126
|
+
c);return}c.id||(c.id="yt-"+e);u(function(){if(!l.tracked[e]){var d=b(e,"youtube",c,0);l.tracked[e]=d;var f=new YT.Player(c.id,{events:{onReady:function(a){d.duration=f.getDuration()||0},onStateChange:function(b){var c=f.getCurrentTime()||0;d.lastPosition=c;switch(b.data){case YT.PlayerState.PLAYING:d.playing=!0;d._lastTimeUpdate=c;d.duration=f.getDuration()||d.duration;a(d,"media-play");g(d);d._pollTimer=setInterval(function(){var a=f.getCurrentTime()||0;d.playing&&a>d._lastTimeUpdate&&d.watched.add(d._lastTimeUpdate,
|
|
127
|
+
a);d._lastTimeUpdate=a;d.lastPosition=a},1E3);break;case YT.PlayerState.PAUSED:if(!d.playing)break;d.playing=!1;d.watched.add(d._lastTimeUpdate,c);q(d);clearInterval(d._pollTimer);a(d,"media-pause");break;case YT.PlayerState.ENDED:d.playing=!1,d.watched.add(d._lastTimeUpdate,c),q(d),clearInterval(d._pollTimer),a(d,"media-ended")}}}});d._player=f}})}}function y(a){if(l._vimeoApiLoaded)a();else if(l._vimeoApiLoading)setTimeout(function(){y(a)},200);else{l._vimeoApiLoading=!0;var b=document.createElement("script");
|
|
128
|
+
b.src="https://player.vimeo.com/api/player.js";b.onload=function(){l._vimeoApiLoaded=!0;l._vimeoApiLoading=!1;a()};document.head.appendChild(b)}}function w(c){var d=k(c);l.tracked[d]||y(function(){if(!l.tracked[d]){var e=b(d,"vimeo",c,0);l.tracked[d]=e;var f=new Vimeo.Player(c);e._player=f;f.getDuration().then(function(a){e.duration=a||0});f.on("play",function(b){e.playing=!0;e.lastPosition=b.seconds||0;e._lastTimeUpdate=e.lastPosition;e.duration=b.duration||e.duration;a(e,"media-play");g(e)});f.on("pause",
|
|
129
|
+
function(b){e.playing&&(e.playing=!1,b=b.seconds||0,e.watched.add(e._lastTimeUpdate,b),e.lastPosition=b,q(e),a(e,"media-pause"))});f.on("ended",function(b){e.playing=!1;b=b.seconds||e.duration;e.watched.add(e._lastTimeUpdate,b);e.lastPosition=b;q(e);a(e,"media-ended")});f.on("seeked",function(b){var c=e.lastPosition;e.lastPosition=b.seconds||0;e._lastTimeUpdate=e.lastPosition;a(e,"media-seeked",{from:Math.round(c),to:Math.round(e.lastPosition)})});f.on("timeupdate",function(a){a=a.seconds||0;e.playing&&
|
|
130
|
+
a>e._lastTimeUpdate&&e.watched.add(e._lastTimeUpdate,a);e._lastTimeUpdate=a;e.lastPosition=a})}})}function m(){for(var a=document.querySelectorAll(l.options.mediaSelector),b=0;b<a.length;b++)n(a[b]);a=document.querySelectorAll("iframe[src]");for(b=0;b<a.length;b++){var c=a[b].src||"";/youtube\.com\/embed|youtube-nocookie\.com\/embed/.test(c)?h(a[b]):/player\.vimeo\.com/.test(c)?w(a[b]):/w\.soundcloud\.com\/player/.test(c)?trackSoundCloud(a[b]):/dailymotion\.com\/embed/.test(c)?trackDailymotion(a[b]):
|
|
131
|
+
/open\.spotify\.com\/embed/.test(c)?trackSpotify(a[b]):/player\.twitch\.tv/.test(c)?trackTwitch(a[b]):/muse\.ai\/embed/.test(c)&&trackMuseAi(a[b])}a=document.querySelectorAll('[class*="wistia_embed"], [class*="wistia_async_"]');for(b=0;b<a.length;b++)trackWistia(a[b]);a=document.querySelectorAll(".jwplayer, [data-jw-id]");for(b=0;b<a.length;b++)trackJWPlayer(a[b])}function x(){if(window.MutationObserver&&l.options.observeDom){var a=l.options.observeRoot||document.body;l._mutationObserver=new MutationObserver(function(a){a.forEach(function(a){a.addedNodes.forEach(function(a){if(1===
|
|
132
|
+
a.nodeType){a.matches&&a.matches("video, audio")&&n(a);if("IFRAME"===a.tagName&&a.src){var b=a.src;/youtube\.com\/embed/.test(b)?h(a):/player\.vimeo\.com/.test(b)?w(a):/w\.soundcloud\.com\/player/.test(b)?trackSoundCloud(a):/dailymotion\.com\/embed/.test(b)?trackDailymotion(a):/open\.spotify\.com\/embed/.test(b)?trackSpotify(a):/player\.twitch\.tv/.test(b)?trackTwitch(a):/muse\.ai\/embed/.test(b)&&trackMuseAi(a)}a.className&&/wistia_embed|wistia_async_/.test(a.className)&&trackWistia(a);a.className&&
|
|
133
|
+
/jwplayer/.test(a.className)&&trackJWPlayer(a);if(a.querySelectorAll){b=a.querySelectorAll("video, audio");for(var c=0;c<b.length;c++)n(b[c]);c=a.querySelectorAll("iframe[src]");for(var d=0;d<c.length;d++)b=c[d].src||"",/youtube\.com\/embed/.test(b)?h(c[d]):/player\.vimeo\.com/.test(b)?w(c[d]):/w\.soundcloud\.com\/player/.test(b)?trackSoundCloud(c[d]):/dailymotion\.com\/embed/.test(b)?trackDailymotion(c[d]):/open\.spotify\.com\/embed/.test(b)?trackSpotify(c[d]):/player\.twitch\.tv/.test(b)?trackTwitch(c[d]):
|
|
134
|
+
/muse\.ai\/embed/.test(b)&&trackMuseAi(c[d]);b=a.querySelectorAll('[class*="wistia_embed"], [class*="wistia_async_"]');for(c=0;c<b.length;c++)trackWistia(b[c]);a=a.querySelectorAll(".jwplayer, [data-jw-id]");for(b=0;b<a.length;b++)trackJWPlayer(a[b])}}})})});l._mutationObserver.observe(a,{childList:!0,subtree:!0})}}function f(){for(var b in l.tracked){var c=l.tracked[b];c.playing&&("native"===c.type&&c.el&&(c.watched.add(c._lastTimeUpdate,c.el.currentTime||c.lastPosition),c.lastPosition=c.el.currentTime||
|
|
135
|
+
c.lastPosition),a(c,"media-checkpoint"))}}var v=d.Metrics;if(v){var t={checkpointInterval:10,autoDiscover:!0,mediaSelector:"video, audio",reloadIframes:!1,observeDom:!0,observeRoot:null,checkpointDebounce:1E3},l={initialized:!1,options:null,tracked:{},_counter:0,_mutationObserver:null,_ytApiLoaded:!1,_ytApiLoading:!1,_ytPendingPlayers:[],_vimeoApiLoaded:!1,_vimeoApiLoading:!1};c.prototype.add=function(a,b){if(!(b<=a)){a={start:Math.floor(a),end:Math.ceil(b)};b=[];for(var c=!1,d=0;d<this.ranges.length;d++){var e=
|
|
136
|
+
this.ranges[d];e.end<a.start?b.push(e):e.start>a.end?(c||(b.push(a),c=!0),b.push(e)):(a.start=Math.min(a.start,e.start),a.end=Math.max(a.end,e.end))}c||b.push(a);this.ranges=b}};c.prototype.total=function(){for(var a=0,b=0;b<this.ranges.length;b++)a+=this.ranges[b].end-this.ranges[b].start;return a};v.MediaTracker={init:function(a){if(l.initialized)return console.warn("Metrics.MediaTracker already initialized"),this;var b={},c;for(c in t)t.hasOwnProperty(c)&&(b[c]=t[c]);for(c in a||{})a.hasOwnProperty(c)&&
|
|
137
|
+
void 0!==a[c]&&(b[c]=a[c]);l.options=b;l.initialized=!0;!v._endpoint&&a&&a.endpoint&&v.init({endpoint:a.endpoint,page:a.page,trackUnload:a.trackUnload});b.autoDiscover&&setTimeout(function(){m()},500);b.observeDom&&x();v.onVisibilityChange(function(a){a||f()},"MediaTracker.flush");return this},trackNative:function(a,b){b&&(a.id=b);n(a)},trackYouTube:function(a,b){b&&(a.id=b);h(a)},trackVimeo:function(a,b){b&&(a.id=b);w(a)},trackSoundCloud:function(a,b){b&&(a.id=b);trackSoundCloud(a)},trackWistia:function(a,
|
|
138
|
+
b){b&&(a.id=b);trackWistia(a)},trackJWPlayer:function(a,b){b&&(a.id=b);trackJWPlayer(a)},trackDailymotion:function(a,b){b&&(a.id=b);trackDailymotion(a)},trackSpotify:function(a,b){b&&(a.id=b);trackSpotify(a)},trackTwitch:function(a,b){b&&(a.id=b);trackTwitch(a)},trackMuseAi:function(a,b){b&&(a.id=b);trackMuseAi(a)},getTracked:function(){var a={},b;for(b in l.tracked){var c=l.tracked[b];a[b]={id:c.id,type:c.type,playing:c.playing,position:Math.round(c.lastPosition),duration:Math.round(c.duration),
|
|
139
|
+
watched:c.watched.total()}}return a},flush:f,rescan:m,destroy:function(){for(var a in l.tracked){var b=l.tracked[a];q(b);b._pollTimer&&clearInterval(b._pollTimer)}l.tracked={};l._mutationObserver&&(l._mutationObserver.disconnect(),l._mutationObserver=null);l.initialized=!1},defaults:t,state:l}}else console.warn("Metrics.MediaTracker: Metrics core not loaded")})("undefined"!==typeof window?window:this);
|
|
140
|
+
function loadSoundCloudAPI(d){if(root.SC&&root.SC.Widget)d();else{var k=document.createElement("script");k.src="https://w.soundcloud.com/player/api.js";k.onload=d;document.head.appendChild(k)}}
|
|
141
|
+
function trackSoundCloud(d){var k=genId(d);state.tracked[k]||loadSoundCloudAPI(function(){if(!state.tracked[k]){var c=SC.Widget(d),b=createTracker(k,"soundcloud",d,0);state.tracked[k]=b;c.bind(SC.Widget.Events.READY,function(){c.getDuration(function(a){b.duration=(a||0)/1E3})});c.bind(SC.Widget.Events.PLAY,function(){b.playing=!0;c.getPosition(function(a){b.lastPosition=(a||0)/1E3;b._lastTimeUpdate=b.lastPosition;sendEvent(b,"media-play");startCheckpoints(b)})});c.bind(SC.Widget.Events.PAUSE,function(){b.playing&&
|
|
142
|
+
(b.playing=!1,c.getPosition(function(a){a=(a||0)/1E3;b.watched.add(b._lastTimeUpdate,a);b.lastPosition=a;stopCheckpoints(b);sendEvent(b,"media-pause")}))});c.bind(SC.Widget.Events.FINISH,function(){b.playing=!1;b.watched.add(b._lastTimeUpdate,b.duration);b.lastPosition=b.duration;stopCheckpoints(b);sendEvent(b,"media-ended")});c.bind(SC.Widget.Events.SEEK,function(a){var c=b.lastPosition;b.lastPosition=(a.currentPosition||0)/1E3;b._lastTimeUpdate=b.lastPosition;sendEvent(b,"media-seeked",{from:Math.round(c),
|
|
143
|
+
to:Math.round(b.lastPosition)})});c.bind(SC.Widget.Events.PLAY_PROGRESS,function(a){a=(a.currentPosition||0)/1E3;b.playing&&a>b._lastTimeUpdate&&b.watched.add(b._lastTimeUpdate,a);b._lastTimeUpdate=a;b.lastPosition=a})}})}
|
|
144
|
+
function trackWistia(d){var k=genId(d);if(!state.tracked[k]){var c=d.getAttribute("data-wistia-id")||(d.className.match(/wistia_async_(\w+)/)||[])[1]||k;root._wq=root._wq||[];root._wq.push({id:c,onReady:function(b){if(!state.tracked[k]){var a=createTracker(k,"wistia",d,b.duration()||0);state.tracked[k]=a;a._player=b;b.bind("play",function(){a.playing=!0;a.lastPosition=b.time();a._lastTimeUpdate=a.lastPosition;a.duration=b.duration()||a.duration;sendEvent(a,"media-play");startCheckpoints(a)});b.bind("pause",
|
|
145
|
+
function(){if(a.playing){a.playing=!1;var c=b.time();a.watched.add(a._lastTimeUpdate,c);a.lastPosition=c;stopCheckpoints(a);sendEvent(a,"media-pause")}});b.bind("end",function(){a.playing=!1;a.watched.add(a._lastTimeUpdate,a.duration);a.lastPosition=a.duration;stopCheckpoints(a);sendEvent(a,"media-ended")});b.bind("seek",function(b,c){a.lastPosition=b;a._lastTimeUpdate=b;sendEvent(a,"media-seeked",{from:Math.round(c),to:Math.round(b)})});b.bind("secondchange",function(b){a.playing&&b>a._lastTimeUpdate&&
|
|
146
|
+
a.watched.add(a._lastTimeUpdate,b);a._lastTimeUpdate=b;a.lastPosition=b})}}});root.Wistia||(c=document.createElement("script"),c.src="https://fast.wistia.com/assets/external/E-v1.js",c.async=!0,document.head.appendChild(c))}}
|
|
147
|
+
function trackJWPlayer(d){function k(){if(!root.jwplayer||"function"!==typeof root.jwplayer)return!1;var a;try{a=jwplayer(b)}catch(q){return!1}if(!a||!a.getState)return!1;var g=createTracker(c,"jwplayer",d,a.getDuration()||0);state.tracked[c]=g;g._player=a;a.on("play",function(){g.playing=!0;g.lastPosition=a.getPosition();g._lastTimeUpdate=g.lastPosition;g.duration=a.getDuration()||g.duration;sendEvent(g,"media-play");startCheckpoints(g)});a.on("pause",function(){if(g.playing){g.playing=!1;var b=
|
|
148
|
+
a.getPosition();g.watched.add(g._lastTimeUpdate,b);g.lastPosition=b;stopCheckpoints(g);sendEvent(g,"media-pause")}});a.on("complete",function(){g.playing=!1;g.watched.add(g._lastTimeUpdate,g.duration);g.lastPosition=g.duration;stopCheckpoints(g);sendEvent(g,"media-ended")});a.on("seek",function(a){g.lastPosition=a.offset;g._lastTimeUpdate=a.offset;sendEvent(g,"media-seeked",{from:Math.round(a.position),to:Math.round(a.offset)})});a.on("time",function(a){var b=a.position;g.playing&&b>g._lastTimeUpdate&&
|
|
149
|
+
g.watched.add(g._lastTimeUpdate,b);g._lastTimeUpdate=b;g.lastPosition=b;g.duration=a.duration||g.duration});return!0}var c=genId(d);if(!state.tracked[c]){var b=d.id||c;k()||setTimeout(function(){k()},2E3)}}
|
|
150
|
+
function trackDailymotion(d){function k(){if(root.DM&&root.DM.player)c();else{var a=document.createElement("script");a.src="https://api.dmcdn.net/all.js";a.onload=function(){c()};document.head.appendChild(a)}}function c(){if(!state.tracked[b]){var a=createTracker(b,"dailymotion",d,0);state.tracked[b]=a;var c=DM.player(d,{events:{playing:function(){a.playing=!0;a.lastPosition=c.currentTime||0;a._lastTimeUpdate=a.lastPosition;a.duration=c.duration||a.duration;sendEvent(a,"media-play");startCheckpoints(a)},
|
|
151
|
+
pause:function(){if(a.playing){a.playing=!1;var b=c.currentTime||0;a.watched.add(a._lastTimeUpdate,b);a.lastPosition=b;stopCheckpoints(a);sendEvent(a,"media-pause")}},end:function(){a.playing=!1;a.watched.add(a._lastTimeUpdate,a.duration);a.lastPosition=a.duration;stopCheckpoints(a);sendEvent(a,"media-ended")},seeking:function(){var b=a.lastPosition;a.lastPosition=c.currentTime||0;a._lastTimeUpdate=a.lastPosition;sendEvent(a,"media-seeked",{from:Math.round(b),to:Math.round(a.lastPosition)})},timeupdate:function(){var b=
|
|
152
|
+
c.currentTime||0;a.playing&&b>a._lastTimeUpdate&&a.watched.add(a._lastTimeUpdate,b);a._lastTimeUpdate=b;a.lastPosition=b;a.duration=c.duration||a.duration}}});a._player=c}}var b=genId(d);state.tracked[b]||k()}
|
|
153
|
+
function trackSpotify(d){var k=genId(d);if(!state.tracked[k]){var c=createTracker(k,"spotify",d,0);state.tracked[k]=c;window.addEventListener("message",function(b){if(b.data&&b.source===d.contentWindow){var a;try{a="string"===typeof b.data?JSON.parse(b.data):b.data}catch(q){return}if(a.type&&"playback_update"===a.type){b=a.payload&&a.payload.position||0;b/=1E3;var g=a.payload&&a.payload.duration||0;a=a.payload&&a.payload.isPaused;c.duration=g/1E3||c.duration;a||c.playing?a&&c.playing?(c.playing=!1,
|
|
154
|
+
c.watched.add(c._lastTimeUpdate,b),c.lastPosition=b,stopCheckpoints(c),sendEvent(c,"media-pause")):!a&&c.playing&&b>c._lastTimeUpdate&&(c.watched.add(c._lastTimeUpdate,b),c._lastTimeUpdate=b,c.lastPosition=b):(c.playing=!0,c.lastPosition=b,c._lastTimeUpdate=b,sendEvent(c,"media-play"),startCheckpoints(c))}}})}}
|
|
155
|
+
function trackTwitch(d){function k(){if(root.Twitch&&root.Twitch.Player)c();else{var a=document.createElement("script");a.src="https://player.twitch.tv/js/embed/v1.js";a.onload=function(){c()};document.head.appendChild(a)}}function c(){if(!state.tracked[b]){d.id||(d.id="twitch-"+b);var a=createTracker(b,"twitch",d,0);state.tracked[b]=a;var c=new Twitch.Player(d.id,{});a._player=c;c.addEventListener(Twitch.Player.PLAY,function(){a.playing=!0;a.lastPosition=c.getCurrentTime()||0;a._lastTimeUpdate=a.lastPosition;
|
|
156
|
+
a.duration=c.getDuration()||a.duration;sendEvent(a,"media-play");startCheckpoints(a);a._pollTimer=setInterval(function(){var b=c.getCurrentTime()||0;a.playing&&b>a._lastTimeUpdate&&a.watched.add(a._lastTimeUpdate,b);a._lastTimeUpdate=b;a.lastPosition=b},1E3)});c.addEventListener(Twitch.Player.PAUSE,function(){if(a.playing){a.playing=!1;var b=c.getCurrentTime()||0;a.watched.add(a._lastTimeUpdate,b);a.lastPosition=b;stopCheckpoints(a);clearInterval(a._pollTimer);sendEvent(a,"media-pause")}});c.addEventListener(Twitch.Player.ENDED,
|
|
157
|
+
function(){a.playing=!1;var b=c.getCurrentTime()||a.duration;a.watched.add(a._lastTimeUpdate,b);a.lastPosition=b;stopCheckpoints(a);clearInterval(a._pollTimer);sendEvent(a,"media-ended")})}}var b=genId(d);state.tracked[b]||k()}
|
|
158
|
+
function trackMuseAi(d){var k=genId(d);if(!state.tracked[k]){var c=createTracker(k,"museai",d,0);state.tracked[k]=c;window.addEventListener("message",function(b){if(b.data&&b.source===d.contentWindow){var a;try{a="string"===typeof b.data?JSON.parse(b.data):b.data}catch(g){return}"play"===a.event?(c.playing=!0,c.lastPosition=a.currentTime||0,c._lastTimeUpdate=c.lastPosition,c.duration=a.duration||c.duration,sendEvent(c,"media-play"),startCheckpoints(c)):"pause"===a.event?c.playing&&(c.playing=!1,b=
|
|
159
|
+
a.currentTime||0,c.watched.add(c._lastTimeUpdate,b),c.lastPosition=b,stopCheckpoints(c),sendEvent(c,"media-pause")):"ended"===a.event?(c.playing=!1,c.watched.add(c._lastTimeUpdate,c.duration),c.lastPosition=c.duration,stopCheckpoints(c),sendEvent(c,"media-ended")):"timeupdate"===a.event&&(b=a.currentTime||0,c.duration=a.duration||c.duration,c.playing&&b>c._lastTimeUpdate&&c.watched.add(c._lastTimeUpdate,b),c._lastTimeUpdate=b,c.lastPosition=b)}});try{d.contentWindow.postMessage({method:"addEventListener",
|
|
160
|
+
value:"play"},"*")}catch(b){}try{d.contentWindow.postMessage({method:"addEventListener",value:"pause"},"*")}catch(b){}try{d.contentWindow.postMessage({method:"addEventListener",value:"ended"},"*")}catch(b){}try{d.contentWindow.postMessage({method:"addEventListener",value:"timeupdate"},"*")}catch(b){}}};
|