@gumlet/insights-js-core 1.1.62 → 2.0.0

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.
@@ -0,0 +1,9 @@
1
+
2
+ // Copyright (C) 2026, Gumlet Pte Ltd., All Rights Reserved
3
+
4
+ // This source code and its use and distribution, is subject to the terms
5
+ // and conditions of the applicable license agreement.
6
+
7
+ // @gumlet/insights-js-core version 2.0.0
8
+
9
+ var gminsights=(function(e){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var t=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,s=(e,t)=>()=>(e&&(t=e(e=0)),t),c=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),l=(e,t)=>{let r={};for(var i in e)n(r,i,{get:e[i],enumerable:!0});return t||n(r,Symbol.toStringTag,{value:`Module`}),r},u=(e,t,a,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=i(t),l=0,u=c.length,d;l<u;l++)d=c[l],!o.call(e,d)&&d!==a&&n(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(s=r(t,d))||s.enumerable});return e},d=(e,r,i)=>(i=e==null?{}:t(a(e)),u(r||!e||!e.__esModule?n(i,`default`,{value:e,enumerable:!0}):i,e));let f=e=>e!==void 0&&typeof e==`string`,ee=e=>e!==void 0&&typeof e==`boolean`,te=e=>e!==void 0&&typeof e==`number`,ne=e=>e.replace(/\/$/g,``),re=e=>(e*=1e3,Math.round(e)),ie=e=>{let t=e.toString().length;return t===13?e:e*10**(13-t)},ae=()=>Date.now(),oe=e=>ae()-e,se=()=>{if(crypto&&crypto.randomUUID)return crypto.randomUUID();let e=new Uint8Array(16);crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=[...e].map(e=>e.toString(16).padStart(2,`0`));return t.slice(0,4).join(``)+`-`+t.slice(4,6).join(``)+`-`+t.slice(6,8).join(``)+`-`+t.slice(8,10).join(``)+`-`+t.slice(10,16).join(``)},ce=e=>{let t=`${e}=`,n=[];try{n=document.cookie.split(`;`)}catch{return``}let r=null;for(let e=0;e<n.length;e++){let i=n[e];for(;i.charAt(0)===` `;)i=i.substring(1);i.indexOf(t)===0&&(r=i.substring(t.length,i.length))}if(!r){try{r=localStorage.getItem(e)}catch{return``}let t=null;if(r)try{t=JSON.parse(r)}catch{return``}else return``;let n=null;if(t.expires)n=new Date(t.expires);else return``;if(Object.prototype.toString.call(n)===`[object Date]`){if(!(n instanceof Date&&!isNaN(n.getTime())))return``}else return``;if(n.getTime()>new Date().getTime())r=t.value?t.value:``;else return``}return r},le=(e,t=30,n=null)=>{let r=new Date;r.setTime(r.getTime()+t*60*1e3);let i=n||se();try{document.cookie=`${e}=${i}; expires=${r.toUTCString()}; path=/`,localStorage.setItem(e,JSON.stringify({expires:r.getTime(),value:i}))}catch{}return i},ue=()=>{},de=(e,t)=>{let n=0,r;return()=>n>=t?r:(r=e.apply(null,arguments),n++,r)},fe=e=>de(e,1),pe=()=>{let e=[`webkit`,`moz`,`ms`,`o`];if(`hidden`in document)return`hidden`;for(let t=0;t<e.length;t++)if(`${e[t]}Hidden`in document)return`${e[t]}Hidden`;return null},me=e=>typeof e==`object`?JSON.stringify(e):typeof e==`function`?me(e()):e===void 0||typeof e==`string`?e:String(e);var p={validString:f,validBoolean:ee,validNumber:te,sanitizePath:ne,calculateTime:re,getCurrentTimestamp:ae,getDurationFromTimestampToNow:oe,uuidv4:se,getCookie:ce,setCookie:le,noOp:ue,times:de,once:fe,getHiddenProp:pe,getCustomDataString:me,jsonToQueryString:e=>`?`+Object.keys(e).map(t=>encodeURIComponent(t)+`=`+encodeURIComponent(e[t])).join(`&`),currentDateTimeFormatString:()=>new Date().toISOString(),convertEpochTime:ie};function he(e){e.z=Date.now()/1e3;let t=[void 0,null,!1];Object.keys(e).forEach(n=>{t.indexOf(e[n])!==-1&&delete e[n]}),Object.keys(e).forEach(t=>{Number.isNaN(e[t])&&delete e[t]})}var ge=class{get(e,t,n,r=!0){he(t);let i=p.jsonToQueryString(t);e+=i,fetch(e,{method:`GET`,keepalive:r===!1}).then(e=>e.text()).then(e=>{e&&e.length>0&&n(e)}).catch(()=>{})}asyncGet(e,t){return new Promise((n,r)=>{he(t);let i=p.jsonToQueryString(t);e+=i,fetch(e,{method:`GET`}).then(e=>e.ok?e.text():Promise.reject({status:e.status,statusText:e.statusText})).then(e=>n(e)).catch(e=>{e&&typeof e.status==`number`?r(e):r({status:0,statusText:``})})})}},_e,ve,m=s((()=>{_e=`urn:x-cast:com.gumlet.ingest.cast`,ve=`https://ingest.gumlytics.com`}));m();var ye=class e extends ge{constructor(...t){super(...t),this.sendRequest=function(t,n){t.event_family=`session_event`,this.get(e.analyticsServerUrl,t,n)},this.sendRequestAsync=function(t){return t.event_family=`session_event`,new Promise((n,r)=>{this.asyncGet(e.analyticsServerUrl,t).then(e=>{n(e)}).catch(e=>{r(e)})})},this.sendRequestSynchronous=function(t,n){t.event_family=`session_event`,this.get(e.analyticsServerUrl,t,n,!1)},this.getAnalyticsServerUrl=()=>e.analyticsServerUrl}static{this.analyticsServerUrl=ve}},be,h,xe=s((()=>{be=class{constructor(e=!1){this.log=e=>{this.showLogs&&console.log(e)},this.error=e=>{this.showLogs&&console.error(e)},this.warning=e=>{this.showLogs&&console.warn(e)},this.showLogs=e}setLogging(e){this.showLogs=e}isLogging(){return this.showLogs}},h=new be}));xe();function Se(e){return typeof window>`u`||!window.shaka?!1:typeof shaka.Player==`function`&&e?.constructor===shaka.Player}function Ce(e){return typeof window>`u`||!window.Hls?!1:typeof Hls==`function`&&e?.constructor===Hls}let we={isShaka:Se,isHlsjs:Ce};m();var Te=class{setUp(){h.log(`setting up cast session`),this.castSession=cast.framework.CastContext.getInstance().getCurrentSession(),this.addMessageListener()}addMessageListener(){let e=this.castSession.getApplicationMetadata();if(!e||e.namespaces.indexOf(`urn:x-cast:com.gumlet.ingest.cast`)<0){h.log(`No analytics on chrome cast receiver enabled!`);return}h.log(`adding message listener`),this.castSession.addMessageListener(_e,(e,t)=>{h.log(`Received: ${e} ${t}`);try{let e=JSON.parse(t);this.handleReceiverMessage(e)}catch{h.error(`Message parsing failed ${t}`)}})}handleReceiverMessage(e){h.log(e)}sendMessage(e){let t=this.castSession.getApplicationMetadata();if(!t||t.namespaces.indexOf(`urn:x-cast:com.gumlet.ingest.cast`)<0){h.log(`No analytics on chrome cast receiver enabled!`);return}h.log(`Sending message: ${JSON.stringify(e)}`),this.castSession.sendMessage(_e,e)}};m(),xe();var Ee=class{setUp(){this.messageBus=cast.receiver.CastReceiverManager.getInstance().getCastMessageBus(_e,cast.receiver.CastMessageBus.MessageType.JSON),h.log(this.messageBus),this.messageBus.onMessage=e=>{h.log(`Received message from cast client: ${JSON.stringify(e)}`);let t=e.data;this.handleClientMessage(t)}}setCallback(e){this.callback=e}handleClientMessage(e){this.callback(e)}sendMessage(e){this.messageBus.broadcast(e)}};let g={SETUP:`event_setup`,PLAYER_READY:`event_player_ready`,PLAYBACK_READY:`event_playback_ready`,PLAYBACK_STARTED:`event_playback_started`,PAUSE:`event_pause`,PLAY:`event_play`,PLAYING:`event_playing`,PLAYBACK_UPDATE:`event_playback_update`,END:`event_ended`,MUTE:`event_muted`,UNMUTE:`event_unmute`,SEEKED:`event_seeked`,START_REBUFFER:`event_rebuffer_start`,END_REBUFFER:`event_rebuffer_end`,ERROR:`event_error`,ERROR_RECOVERED:`event_error_recovered`};m();var De=class e extends ge{constructor(...t){super(...t),this.sendRequest=function(t,n){t.event_family=`session`,this.get(e.analyticsServerUrl,t,n)},this.sendRequestSynchronous=function(t,n){t.event_family=`session`,this.get(e.analyticsServerUrl,t,n,!1)},this.getAnalyticsServerUrl=()=>e.analyticsServerUrl}static{this.analyticsServerUrl=ve}};m();var Oe=class e extends ge{constructor(...t){super(...t),this.sendRequest=function(t,n){t.event_family=`player_init`,this.get(e.analyticsServerUrl,t,n)},this.sendRequestSynchronous=function(t,n){t.event_family=`player_init`,this.get(e.analyticsServerUrl,t,n,!1)},this.getAnalyticsServerUrl=()=>e.analyticsServerUrl}static{this.analyticsServerUrl=ve}};let ke=()=>{let e=window.navigator.userAgent;return/(tablet|ipad|playbook|silk)|(android(?!.*mobi))/i.test(e)?`tablet`:/Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Kindle|Silk-Accelerated|(hpw|web)OS|Opera M(obi|ini)/.test(e)?`mobile`:`desktop`};var Ae=`2.0.9`,je=500,Me=`user-agent`,_=``,Ne=`?`,v={FUNCTION:`function`,OBJECT:`object`,STRING:`string`,UNDEFINED:`undefined`},y=`browser`,b=`cpu`,x=`device`,S=`engine`,C=`os`,w=`result`,T=`name`,E=`type`,D=`vendor`,O=`version`,k=`architecture`,Pe=`major`,A=`model`,Fe=`console`,j=`mobile`,M=`tablet`,N=`smarttv`,P=`wearable`,Ie=`xr`,Le=`embedded`,Re=`fetcher`,F=`inapp`,ze=`brands`,I=`formFactors`,Be=`fullVersionList`,L=`platform`,Ve=`platformVersion`,He=`bitness`,R=`sec-ch-ua`,Ue=R+`-full-version-list`,We=R+`-arch`,Ge=R+`-`+He,Ke=R+`-form-factors`,qe=R+`-`+j,Je=R+`-`+A,Ye=R+`-`+L,Xe=Ye+`-version`,Ze=[ze,Be,j,A,L,Ve,k,I,He],Qe=`Amazon`,z=`Apple`,$e=`ASUS`,et=`BlackBerry`,B=`Google`,tt=`Huawei`,nt=`Lenovo`,rt=`Honor`,it=`LG`,at=`Microsoft`,ot=`Motorola`,st=`Nvidia`,ct=`OnePlus`,lt=`OPPO`,ut=`Samsung`,dt=`Sharp`,ft=`Sony`,pt=`Xiaomi`,mt=`Zebra`,ht=`Chrome`,gt=`Chromium`,V=`Chromecast`,_t=`Edge`,vt=`Firefox`,yt=`Opera`,bt=`Facebook`,xt=`Sogou`,St=`Mobile `,Ct=` Browser`,wt=`Windows`,H=typeof window!==v.UNDEFINED&&window.navigator?window.navigator:void 0,U=H&&H.userAgentData?H.userAgentData:void 0,Tt=function(e,t){var n={},r=t;if(!Ot(t))for(var i in r={},t)for(var a in t[i])r[a]=t[i][a].concat(r[a]?r[a]:[]);for(var o in e)n[o]=r[o]&&r[o].length%2==0?r[o].concat(e[o]):e[o];return n},Et=function(e){for(var t={},n=0;n<e.length;n++)t[e[n].toUpperCase()]=e[n];return t},Dt=function(e,t){if(typeof e===v.OBJECT&&e.length>0){for(var n in e)if(W(t)==W(e[n]))return!0;return!1}return kt(e)?W(t)==W(e):!1},Ot=function(e,t){for(var n in e)return/^(browser|cpu|device|engine|os)$/.test(n)||(t?Ot(e[n]):!1)},kt=function(e){return typeof e===v.STRING},At=function(e){if(e){for(var t=[],n=Mt(/\\?\"/g,e).split(`,`),r=0;r<n.length;r++)if(n[r].indexOf(`;`)>-1){var i=Pt(n[r]).split(`;v=`);t[r]={brand:i[0],version:i[1]}}else t[r]=Pt(n[r]);return t}},W=function(e){return kt(e)?e.toLowerCase():e},jt=function(e){return kt(e)?Mt(/[^\d\.]/g,e).split(`.`)[0]:void 0},G=function(e){for(var t in e)if(e.hasOwnProperty(t)){var n=e[t];typeof n==v.OBJECT&&n.length==2?this[n[0]]=n[1]:this[n]=void 0}return this},Mt=function(e,t){return kt(t)?t.replace(e,_):t},Nt=function(e){return Mt(/\\?\"/g,e)},Pt=function(e,t){return e=Mt(/^\s\s*/,String(e)),typeof t===v.UNDEFINED?e:e.substring(0,t)},Ft=function(e,t){if(!(!e||!t))for(var n=0,r,i,a,o,s,c;n<t.length&&!s;){var l=t[n],u=t[n+1];for(r=i=0;r<l.length&&!s&&l[r];)if(s=l[r++].exec(e),s)for(a=0;a<u.length;a++)c=s[++i],o=u[a],typeof o===v.OBJECT&&o.length>0?o.length===2?typeof o[1]==v.FUNCTION?this[o[0]]=o[1].call(this,c):this[o[0]]=o[1]:o.length>=3&&(typeof o[1]===v.FUNCTION&&!(o[1].exec&&o[1].test)?o.length>3?this[o[0]]=c?o[1].apply(this,o.slice(2)):void 0:this[o[0]]=c?o[1].call(this,c,o[2]):void 0:o.length==3?this[o[0]]=c?c.replace(o[1],o[2]):void 0:o.length==4?this[o[0]]=c?o[3].call(this,c.replace(o[1],o[2])):void 0:o.length>4&&(this[o[0]]=c?o[3].apply(this,[c.replace(o[1],o[2])].concat(o.slice(4))):void 0)):this[o]=c||void 0;n+=2}},K=function(e,t){for(var n in t)if(typeof t[n]===v.OBJECT&&t[n].length>0){for(var r=0;r<t[n].length;r++)if(Dt(t[n][r],e))return n===Ne?void 0:n}else if(Dt(t[n],e))return n===Ne?void 0:n;return t.hasOwnProperty(`*`)?t[`*`]:e},It={ME:`4.90`,"NT 3.51":`3.51`,"NT 4.0":`4.0`,2e3:[`5.0`,`5.01`],XP:[`5.1`,`5.2`],Vista:`6.0`,7:`6.1`,8:`6.2`,"8.1":`6.3`,10:[`6.4`,`10.0`],NT:``},Lt={embedded:`Automotive`,mobile:`Mobile`,tablet:[`Tablet`,`EInk`],smarttv:`TV`,wearable:`Watch`,xr:[`VR`,`XR`],"?":[`Desktop`,`Unknown`],"*":void 0},Rt={Chrome:`Google Chrome`,Edge:`Microsoft Edge`,"Edge WebView2":`Microsoft Edge WebView2`,"Chrome WebView":`Android WebView`,"Chrome Headless":`HeadlessChrome`,"Huawei Browser":`HuaweiBrowser`,"MIUI Browser":`Miui Browser`,"Opera Mobi":`OperaMobile`,Yandex:`YaBrowser`},zt={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[O,[T,St+`Chrome`]],[/webview.+edge\/([\w\.]+)/i],[O,[T,_t+` WebView`]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[O,[T,`Edge`]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[T,O],[/opios[\/ ]+([\w\.]+)/i],[O,[T,yt+` Mini`]],[/\bop(?:rg)?x\/([\w\.]+)/i],[O,[T,yt+` GX`]],[/\bopr\/([\w\.]+)/i],[O,[T,yt]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[O,[T,`Baidu`]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[O,[T,`Maxthon`]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(atlas|flock|rockmelt|midori|epiphany|silk|skyfire|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon|otter|dooble|(?:hi|lg |ovi|qute)browser|palemoon)\/v?([-\w\.]+)/i,/(brave)(?: chrome)?\/([\d\.]+)/i,/(aloha|heytap|ovi|115|surf|qwant)browser\/([\d\.]+)/i,/(qwant)(?:ios|mobile)\/([\d\.]+)/i,/(ecosia|weibo)(?:__| \w+@)([\d\.]+)/i],[T,O],[/quark(?:pc)?\/([-\w\.]+)/i],[O,[T,`Quark`]],[/\bddg\/([\w\.]+)/i],[O,[T,`DuckDuckGo`]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[O,[T,`UCBrowser`]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[O,[T,`WeChat`]],[/konqueror\/([\w\.]+)/i],[O,[T,`Konqueror`]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[O,[T,`IE`]],[/ya(?:search)?browser\/([\w\.]+)/i],[O,[T,`Yandex`]],[/slbrowser\/([\w\.]+)/i],[O,[T,`Smart `+nt+Ct]],[/(av(?:ast|g|ira))\/([\w\.]+)/i],[[T,/(.+)/,`$1 Secure`+Ct],O],[/norton\/([\w\.]+)/i],[O,[T,`Norton Private`+Ct]],[/\bfocus\/([\w\.]+)/i],[O,[T,vt+` Focus`]],[/ mms\/([\w\.]+)$/i],[O,[T,yt+` Neon`]],[/ opt\/([\w\.]+)$/i],[O,[T,yt+` Touch`]],[/coc_coc\w+\/([\w\.]+)/i],[O,[T,`Coc Coc`]],[/dolfin\/([\w\.]+)/i],[O,[T,`Dolphin`]],[/coast\/([\w\.]+)/i],[O,[T,yt+` Coast`]],[/miuibrowser\/([\w\.]+)/i],[O,[T,`MIUI`+Ct]],[/fxios\/([\w\.-]+)/i],[O,[T,St+vt]],[/\bqihoobrowser\/?([\w\.]*)/i],[O,[T,`360`]],[/\b(qq)\/([\w\.]+)/i],[[T,/(.+)/,`$1Browser`],O],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[T,/(.+)/,`$1`+Ct],O],[/samsungbrowser\/([\w\.]+)/i],[O,[T,ut+` Internet`]],[/metasr[\/ ]?([\d\.]+)/i],[O,[T,xt+` Explorer`]],[/(sogou)mo\w+\/([\d\.]+)/i],[[T,xt+` Mobile`],O],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[T,O],[/(lbbrowser|luakit|rekonq|steam(?= (clie|tenf|gameo)))/i],[T],[/ome\/([\w\.]+).+(iron(?= saf)|360(?=[es]e$))/i],[O,T],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[T,bt],O,[E,F]],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/(daum)apps[\/ ]([\w\.]+)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(bing)(?:web|sapphire)\/([\w\.]+)/i,/(instagram|snapchat|klarna)[\/ ]([-\w\.]+)/i],[T,O,[E,F]],[/\bgsa\/([\w\.]+) .*safari\//i],[O,[T,`GSA`],[E,F]],[/(?:musical_ly|trill)(?:.+app_?version\/|_)([\w\.]+)/i],[O,[T,`TikTok`],[E,F]],[/\[(linkedin)app\]/i],[T,[E,F]],[/(zalo(?:app)?)[\/\sa-z]*([\w\.-]+)/i],[[T,/(.+)/,`Zalo`],O,[E,F]],[/(chromium)[\/ ]([-\w\.]+)/i],[T,O],[/ome-(lighthouse)$/i],[T,[E,Re]],[/headlesschrome(?:\/([\w\.]+)| )/i],[O,[T,ht+` Headless`]],[/wv\).+chrome\/([\w\.]+).+edgw\//i],[O,[T,_t+` WebView2`]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[T,ht+` WebView`],O],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[O,[T,`Android`+Ct]],[/chrome\/([\w\.]+) mobile/i],[O,[T,St+`Chrome`]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[T,O],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[O,[T,St+`Safari`]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[T,St+`Safari`]],[/version\/([\w\.\,]+) .*(safari)/i],[O,T],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[T,[O,`1`]],[/(webkit|khtml)\/([\w\.]+)/i],[T,O],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[T,St+vt],O],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[T,`Netscape`],O],[/(wolvic|librewolf)\/([\w\.]+)/i],[T,O],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[O,[T,vt+` Reality`]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+(?= .+rv\:.+gecko\/\d+)|[0-4][\w\.]+(?!.+compatible))/i,/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[T,[O,/_/g,`.`]],[/(cobalt)\/([\w\.]+)/i],[T,[O,/[^\d\.]+./,_]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[k,`amd64`]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[k,`ia32`]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[k,`arm64`]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[k,`armhf`]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[k,`arm`]],[/ sun4\w[;\)]/i],[[k,`sparc`]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i,/((ppc|powerpc)(64)?)( mac|;|\))/i,/(?:osf1|[freopnt]{3,4}bsd) (alpha)/i],[[k,/ower/,_,W]],[/mc680.0/i],[[k,`68k`]],[/winnt.+\[axp/i],[[k,`alpha`]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[A,[D,ut],[E,M]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr]|browser)[-\w]+)/i,/sec-(sgh\w+)/i],[A,[D,ut],[E,j]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)[\/\);]/i],[A,[D,z],[E,j]],[/\b(?:ios|apple\w+)\/.+[\(\/](ipad)/i,/\b(ipad)[\d,]*[;\] ].+(mac |i(pad)?)os/i],[A,[D,z],[E,M]],[/(macintosh);/i],[A,[D,z]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[A,[D,dt],[E,j]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[A,[D,rt],[E,M]],[/honor([-\w ]+)[;\)]/i],[A,[D,rt],[E,j]],[/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i],[A,[D,tt],[E,M]],[/(?:huawei) ?([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][\dc][adnt]?)\b(?!.+d\/s)/i],[A,[D,tt],[E,j]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b(?:xiao)?((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[A,/_/g,` `],[D,pt],[E,M]],[/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/oid[^\)]+; (redmi[\-_ ]?(?:note|k)?[\w_ ]+|m?[12]\d[01]\d\w{3,6}|poco[\w ]+|(shark )?\w{3}-[ah]0|qin ?[1-3](s\+|ultra| pro)?)( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note|max|cc)?[_ ]?(?:\d{0,2}\w?)[_ ]?(?:plus|se|lite|pro)?( 5g|lte)?)(?: bui|\))/i,/ ([\w ]+) miui\/v?\d/i],[[A,/_/g,` `],[D,pt],[E,j]],[/droid.+; (cph2[3-6]\d[13579]|((gm|hd)19|(ac|be|in|kb)20|(d[en]|eb|le|mt)21|ne22)[0-2]\d|p[g-l]\w[1m]10)\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[A,[D,ct],[E,j]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[A,[D,lt],[E,j]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[A,[D,K,{OnePlus:[`203`,`304`,`403`,`404`,`413`,`415`],"*":lt}],[E,M]],[/(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i],[A,[D,`BLU`],[E,j]],[/; vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[A,[D,`Vivo`],[E,j]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[A,[D,`Realme`],[E,j]],[/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i],[A,[D,nt],[E,M]],[/lenovo[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i],[A,[D,nt],[E,j]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ]([\w\s]+)(\)| bui)/i,/((?:moto(?! 360)[-\w\(\) ]+|xt\d{3,4}[cgkosw\+]?[-\d]*|nexus 6)(?= bui|\)))/i],[A,[D,ot],[E,j]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[A,[D,ot],[E,M]],[/\b(?:lg)?([vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[A,[D,it],[E,M]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch|webos))(\w+)/i,/\blg-?([\d\w]+) bui/i],[A,[D,it],[E,j]],[/(nokia) (t[12][01])/i],[D,A,[E,M]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*?))( bui|\)|;|\/)/i],[[A,/_/g,` `],[E,j],[D,`Nokia`]],[/(pixel (c|tablet))\b/i],[A,[D,B],[E,M]],[/droid.+;(?: google)? (g(01[13]a|020[aem]|025[jn]|1b60|1f8f|2ybb|4s1m|576d|5nz6|8hhn|8vou|a02099|c15s|d1yq|e2ae|ec77|gh2x|kv4x|p4bc|pj41|r83y|tt9q|ur25|wvk6)|pixel[\d ]*a?( pro)?( xl)?( fold)?( \(5g\))?)( bui|\))/i],[A,[D,B],[E,j]],[/(google) (pixelbook( go)?)/i],[D,A],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-\w\w\d\d)(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[A,[D,ft],[E,j]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[A,`Xperia Tablet`],[D,ft],[E,M]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[A,[D,Qe],[E,M]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[A,/(.+)/g,`Fire Phone $1`],[D,Qe],[E,j]],[/(playbook);[-\w\),; ]+(rim)/i],[A,D,[E,M]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/(?:blackberry|\(bb10;) (\w+)/i],[A,[D,et],[E,j]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[A,[D,$e],[E,M]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[A,[D,$e],[E,j]],[/(nexus 9)/i],[A,[D,`HTC`],[E,M]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[D,[A,/_/g,` `],[E,j]],[/tcl (xess p17aa)/i,/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i],[A,[D,`TCL`],[E,M]],[/droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i],[A,[D,`TCL`],[E,j]],[/(itel) ((\w+))/i],[[D,W],A,[E,K,{tablet:[`p10001l`,`w7001`],"*":`mobile`}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[A,[D,`Acer`],[E,M]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[A,[D,`Meizu`],[E,j]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[A,[D,`Ulefone`],[E,j]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[A,[D,`Energizer`],[E,j]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[A,[D,`Cat`],[E,j]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[A,[D,`Smartfren`],[E,j]],[/droid.+; (a(in)?(0(15|59|6[35])|142)p?)/i],[A,[D,`Nothing`],[E,j]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[A,[D,`Archos`],[E,M]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[A,[D,`Archos`],[E,j]],[/; (n159v)/i],[A,[D,`HMD`],[E,j]],[/(imo) (tab \w+)/i,/(infinix|tecno) (x1101b?|p904|dp(7c|8d|10a)( pro)?|p70[1-3]a?|p904|t1101)/i],[D,A,[E,M]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (blu|hmd|imo|infinix|lava|oneplus|tcl|wiko)[_ ]([\w\+ ]+?)(?: bui|\)|; r)/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(oppo) ?([\w ]+) bui/i,/(hisense) ([ehv][\w ]+)\)/i,/droid[^;]+; (philips)[_ ]([sv-x][\d]{3,4}[xz]?)/i],[D,A,[E,j]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[D,A,[E,M]],[/(surface duo)/i],[A,[D,at],[E,M]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[A,[D,`Fairphone`],[E,j]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[A,[D,st],[E,M]],[/(sprint) (\w+)/i],[D,A,[E,j]],[/(kin\.[onetw]{3})/i],[[A,/\./g,` `],[D,at],[E,j]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[A,[D,mt],[E,M]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[A,[D,mt],[E,j]],[/(philips)[\w ]+tv/i,/smart-tv.+(samsung)/i],[D,[E,N]],[/hbbtv.+maple;(\d+)/i],[[A,/^/,`SmartTV`],[D,ut],[E,N]],[/(vizio)(?: |.+model\/)(\w+-\w+)/i,/tcast.+(lg)e?. ([-\w]+)/i],[D,A,[E,N]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[D,it],[E,N]],[/(apple) ?tv/i],[D,[A,z+` TV`],[E,N]],[/crkey.*devicetype\/chromecast/i],[[A,V+` Third Generation`],[D,B],[E,N]],[/crkey.*devicetype\/([^/]*)/i],[[A,/^/,`Chromecast `],[D,B],[E,N]],[/fuchsia.*crkey/i],[[A,V+` Nest Hub`],[D,B],[E,N]],[/crkey/i],[[A,V],[D,B],[E,N]],[/(portaltv)/i],[A,[D,bt],[E,N]],[/droid.+aft(\w+)( bui|\))/i],[A,[D,Qe],[E,N]],[/(shield \w+ tv)/i],[A,[D,st],[E,N]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[A,[D,dt],[E,N]],[/(bravia[\w ]+)( bui|\))/i],[A,[D,ft],[E,N]],[/(mi(tv|box)-?\w+) bui/i],[A,[D,pt],[E,N]],[/Hbbtv.*(technisat) (.*);/i],[D,A,[E,N]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[D,/.+\/(\w+)/,`$1`,K,{LG:`lge`}],[A,Pt],[E,N]],[/(playstation \w+)/i],[A,[D,ft],[E,Fe]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[A,[D,at],[E,Fe]],[/(ouya)/i,/(nintendo) (\w+)/i,/(retroid) (pocket ([^\)]+))/i,/(valve).+(steam deck)/i,/droid.+; ((shield|rgcube|gr0006))( bui|\))/i],[[D,K,{Nvidia:`Shield`,Anbernic:`RGCUBE`,Logitech:`GR0006`}],A,[E,Fe]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[A,[D,ut],[E,P]],[/((pebble))app/i,/(asus|google|lg|oppo|xiaomi) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[D,A,[E,P]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[A,[D,lt],[E,P]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[A,[D,z],[E,P]],[/(opwwe\d{3})/i],[A,[D,ct],[E,P]],[/(moto 360)/i],[A,[D,ot],[E,P]],[/(smartwatch 3)/i],[A,[D,ft],[E,P]],[/(g watch r)/i],[A,[D,it],[E,P]],[/droid.+; (wt63?0{2,3})\)/i],[A,[D,mt],[E,P]],[/droid.+; (glass) \d/i],[A,[D,B],[E,Ie]],[/(pico) ([\w ]+) os\d/i],[D,A,[E,Ie]],[/(quest( \d| pro)?s?).+vr/i],[A,[D,bt],[E,Ie]],[/mobile vr; rv.+firefox/i],[[E,Ie]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[D,[E,Le]],[/(aeobc)\b/i],[A,[D,Qe],[E,Le]],[/(homepod).+mac os/i],[A,[D,z],[E,Le]],[/windows iot/i],[[E,Le]],[/droid.+; ([\w- ]+) (4k|android|smart|google)[- ]?tv/i],[A,[E,N]],[/\b((4k|android|smart|opera)[- ]?tv|tv; rv:|large screen[\w ]+safari)\b/i],[[E,N]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew|; hmsc).+?(mobile|vr|\d) safari/i],[A,[E,K,{mobile:`Mobile`,xr:`VR`,"*":M}]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[E,M]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[E,j]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[A,[D,`Generic`]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[O,[T,_t+`HTML`]],[/(arkweb)\/([\w\.]+)/i],[T,O],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[O,[T,`Blink`]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links|dillo)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[T,O],[/ladybird\//i],[[T,`LibWeb`]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[O,T]],os:[[/(windows nt) (6\.[23]); arm/i],[[T,/N/,`R`],[O,K,It]],[/(windows (?:phone|mobile|iot))(?: os)?[\/ ]?([\d\.]*( se)?)/i,/(windows)[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i],[T,O],[/windows nt ?([\d\.\)]*)(?!.+xbox)/i,/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d\.;]*)/i],[[O,/(;|\))/g,``,K,It],[T,wt]],[/(windows ce)\/?([\d\.]*)/i],[T,O],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv|ios(?=.+ip(?:ad|hone)|.+apple ?tv)|ip(?:ad|hone)(?: |.+i(?:pad)?)os|apple ?tv.+ios)[\/ ]([\w\.]+)/i,/\btvos ?([\w\.]+)/i,/cfnetwork\/.+darwin/i],[[O,/_/g,`.`],[T,`iOS`]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i],[[T,`macOS`],[O,/_/g,`.`]],[/android ([\d\.]+).*crkey/i],[O,[T,V+` Android`]],[/fuchsia.*crkey\/([\d\.]+)/i],[O,[T,V+` Fuchsia`]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[O,[T,V+` SmartSpeaker`]],[/linux.*crkey\/([\d\.]+)/i],[O,[T,V+` Linux`]],[/crkey\/([\d\.]+)/i],[O,[T,V]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[O,T],[/(ubuntu) ([\w\.]+) like android/i],[[T,/(.+)/,`$1 Touch`],O],[/(harmonyos)[\/ ]?([\d\.]*)/i,/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen)\w*[-\/\.; ]?([\d\.]*)/i],[T,O],[/\(bb(10);/i],[O,[T,et]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[O,[T,`Symbian`]],[/mozilla\/[\d\.]+ \((?:mobile[;\w ]*|tablet|tv|[^\)]*(?:viera|lg(?:l25|-d300)|alcatel ?o.+|y300-f1)); rv:([\w\.]+)\).+gecko\//i],[O,[T,vt+` OS`]],[/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i,/webos(?:[ \/]?|\.tv-20(?=2[2-9]))(\d[\d\.]*)/i],[O,[T,`webOS`]],[/web0s;.+?(?:chr[o0]me|safari)\/(\d+)/i],[[O,K,{25:`120`,24:`108`,23:`94`,22:`87`,6:`79`,5:`68`,4:`53`,3:`38`,2:`538`,1:`537`,"*":`TV`}],[T,`webOS`]],[/watch(?: ?os[,\/ ]|\d,\d\/)([\d\.]+)/i],[O,[T,`watchOS`]],[/cros [\w]+(?:\)| ([\w\.]+)\b)/i],[O,[T,`Chrome OS`]],[/kepler ([\w\.]+); (aft|aeo)/i],[O,[T,`Vega OS`]],[/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) (\w+)/i,/(xbox); +xbox ([^\);]+)/i,/(pico) .+os([\w\.]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/linux.+(mint)[\/\(\) ]?([\w\.]*)/i,/(mageia|vectorlinux|fuchsia|arcaos|arch(?= ?linux))[;l ]([\d\.]*)/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire|knoppix)(?: gnu[\/ ]linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/\b(aix)[; ]([1-9\.]{0,4})/i,/(hurd|linux|morphos)(?: (?:arm|x86|ppc)\w*| ?)([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) ?(r\d)?/i],[T,O],[/(sunos) ?([\d\.]*)/i],[[T,`Solaris`],O],[/\b(beos|os\/2|amigaos|openvms|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[T,O]]},Bt=(function(){var e={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}};return G.call(e.init,[[y,[T,O,Pe,E]],[b,[k]],[x,[E,A,D]],[S,[T,O]],[C,[T,O]]]),G.call(e.isIgnore,[[y,[O,Pe]],[S,[O]],[C,[O]]]),G.call(e.isIgnoreRgx,[[y,/ ?browser$/i],[C,/ ?os$/i]]),G.call(e.toString,[[y,[T,O]],[b,[k]],[x,[D,A]],[S,[T,O]],[C,[T,O]]]),e})(),Vt=function(e,t){var n=Bt.init[t],r=Bt.isIgnore[t]||0,i=Bt.isIgnoreRgx[t]||0,a=Bt.toString[t]||0;function o(){G.call(this,n)}return o.prototype.getItem=function(){return e},o.prototype.withClientHints=function(){return U?U.getHighEntropyValues(Ze).then(function(t){return e.setCH(new Ht(t,!1)).parseCH().get()}):e.parseCH().get()},o.prototype.withFeatureCheck=function(){return e.detectFeature().get()},t!=w&&(o.prototype.is=function(e){var t=!1;for(var n in this)if(this.hasOwnProperty(n)&&!Dt(r,n)&&W(i?Mt(i,this[n]):this[n])==W(i?Mt(i,e):e)){if(t=!0,e!=v.UNDEFINED)break}else if(e==v.UNDEFINED&&t){t=!t;break}return t},o.prototype.toString=function(){var e=_;for(var t in a)typeof this[a[t]]!==v.UNDEFINED&&(e+=(e?` `:_)+this[a[t]]);return e||v.UNDEFINED}),o.prototype.then=function(e){var t=this,n=function(){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e])};n.prototype={is:o.prototype.is,toString:o.prototype.toString,withClientHints:o.prototype.withClientHints,withFeatureCheck:o.prototype.withFeatureCheck};var r=new n;return e(r),r},new o};function Ht(e,t){if(e||={},G.call(this,Ze),t)G.call(this,[[ze,At(e[R])],[Be,At(e[Ue])],[j,/\?1/.test(e[qe])],[A,Nt(e[Je])],[L,Nt(e[Ye])],[Ve,Nt(e[Xe])],[k,Nt(e[We])],[I,At(e[Ke])],[He,Nt(e[Ge])]]);else for(var n in e)this.hasOwnProperty(n)&&typeof e[n]!==v.UNDEFINED&&(this[n]=e[n])}function q(e,t,n,r){return G.call(this,[[`itemType`,e],[`ua`,t],[`uaCH`,r],[`rgxMap`,n],[`data`,Vt(this,e)]]),this}q.prototype.get=function(e){return e?this.data.hasOwnProperty(e)?this.data[e]:void 0:this.data},q.prototype.set=function(e,t){return this.data[e]=t,this},q.prototype.setCH=function(e){return this.uaCH=e,this},q.prototype.detectFeature=function(){if(H&&H.userAgent==this.ua)switch(this.itemType){case y:H.brave&&typeof H.brave.isBrave==v.FUNCTION&&this.set(T,`Brave`);break;case x:!this.get(E)&&U&&U[j]&&this.set(E,j),this.get(A)==`Macintosh`&&H&&typeof H.standalone!==v.UNDEFINED&&H.maxTouchPoints&&H.maxTouchPoints>2&&this.set(A,`iPad`).set(E,M);break;case C:!this.get(T)&&U&&U[L]&&this.set(T,U[L]);break;case w:var e=this.data,t=function(t){return e[t].getItem().detectFeature().get()};this.set(y,t(y)).set(b,t(b)).set(x,t(x)).set(S,t(S)).set(C,t(C))}return this},q.prototype.parseUA=function(){switch(this.itemType!=w&&Ft.call(this.data,this.ua,this.rgxMap),this.itemType){case y:this.set(Pe,jt(this.get(O)));break;case C:if(this.get(T)==`iOS`&&this.get(O)==`18.6`){var e=/\) Version\/([\d\.]+)/.exec(this.ua);e&&parseInt(e[1].substring(0,2),10)>=26&&this.set(O,e[1])}break}return this},q.prototype.parseCH=function(){var e=this.uaCH,t=this.rgxMap;switch(this.itemType){case y:case S:var n=e[Be]||e[ze],r;if(n)for(var i=0;i<n.length;i++){var a=n[i].brand||n[i],o=n[i].version;this.itemType==y&&!/not.a.brand/i.test(a)&&(!r||/Chrom/.test(r)&&a!=gt||r==_t&&/WebView2/.test(a))&&(a=K(a,Rt),r=this.get(T),r&&!/Chrom/.test(r)&&/Chrom/.test(a)||this.set(T,a).set(O,o).set(Pe,jt(o)),r=a),this.itemType==S&&a==gt&&this.set(O,o)}break;case b:var s=e[k];s&&(s&&e[He]==`64`&&(s+=`64`),Ft.call(this.data,s+`;`,t));break;case x:if(e[j]&&this.set(E,j),e[A]&&(this.set(A,e[A]),!this.get(E)||!this.get(D))){var c={};Ft.call(c,`droid 9; `+e[A]+`)`,t),!this.get(E)&&c.type&&this.set(E,c.type),!this.get(D)&&c.vendor&&this.set(D,c.vendor)}if(e[I]){var l;if(typeof e[I]!=`string`)for(var u=0;!l&&u<e[I].length;)l=K(e[I][u++],Lt);else l=K(e[I],Lt);this.set(E,l)}break;case C:var d=e[L];if(d){var f=e[Ve];d==wt&&(f=parseInt(jt(f),10)>=13?`11`:`10`),this.set(T,d).set(O,f)}this.get(T)==wt&&e[A]==`Xbox`&&this.set(T,`Xbox`).set(O,void 0);break;case w:var ee=this.data,te=function(t){return ee[t].getItem().setCH(e).parseCH().get()};this.set(y,te(y)).set(b,te(b)).set(x,te(x)).set(S,te(S)).set(C,te(C))}return this};function J(e,t,n){if(typeof e===v.OBJECT?(Ot(e,!0)?(typeof t===v.OBJECT&&(n=t),t=e):(n=e,t=void 0),e=void 0):typeof e===v.STRING&&!Ot(t,!0)&&(n=t,t=void 0),n)if(typeof n.append===v.FUNCTION){var r={};n.forEach(function(e,t){r[String(t).toLowerCase()]=e}),n=r}else{var i={};for(var a in n)n.hasOwnProperty(a)&&(i[String(a).toLowerCase()]=n[a]);n=i}if(!(this instanceof J))return new J(e,t,n).getResult();var o=typeof e===v.STRING?e:n&&n[Me]?n[Me]:H&&H.userAgent?H.userAgent:_,s=new Ht(n,!0),c=t?Tt(zt,t):zt,l=function(e){return e==w?function(){return new q(e,o,c,s).set(`ua`,o).set(y,this.getBrowser()).set(b,this.getCPU()).set(x,this.getDevice()).set(S,this.getEngine()).set(C,this.getOS()).get()}:function(){return new q(e,o,c[e],s).parseUA().get()}};return G.call(this,[[`getBrowser`,l(y)],[`getCPU`,l(b)],[`getDevice`,l(x)],[`getEngine`,l(S)],[`getOS`,l(C)],[`getResult`,l(w)],[`getUA`,function(){return o}],[`setUA`,function(e){return kt(e)&&(o=Pt(e,je)),this}]]).setUA(o),this}J.VERSION=Ae,J.BROWSER=Et([T,O,Pe,E]),J.CPU=Et([k]),J.DEVICE=Et([A,D,E,Fe,j,N,M,P,Le]),J.ENGINE=J.OS=Et([T,O]);let Y=new J().getResult();var Ut=class{constructor(e){this.SDKVersion=`1.0.0`,this.config=e,this.sessionCreationCall=new De,this.playerInitCall=new Oe,this.setConfigParameters()}setConfigParameters(e=this.config){this.customData1=p.getCustomDataString(e.customData1),this.customData2=p.getCustomDataString(e.customData2),this.customData3=p.getCustomDataString(e.customData3),this.customData4=p.getCustomDataString(e.customData4),this.customData5=p.getCustomDataString(e.customData5),this.customData6=p.getCustomDataString(e.customData6),this.customData7=p.getCustomDataString(e.customData7),this.customData8=p.getCustomDataString(e.customData8),this.customData9=p.getCustomDataString(e.customData9),this.customData10=p.getCustomDataString(e.customData10),this.customPlayerIntegrationVersion=p.getCustomDataString(e.customPlayerIntegrationVersion),this.customPlayerName=p.getCustomDataString(e.customPlayerName),this.customPageType=p.getCustomDataString(e.customPageType),this.customUserId=p.getCustomDataString(e.userId),this.userName=p.getCustomDataString(e.userName),this.userEMail=p.getCustomDataString(e.userEMail),this.userPhone=p.getCustomDataString(e.userPhone),this.userProfileImage=p.getCustomDataString(e.userProfileImage),this.userAddressLine1=p.getCustomDataString(e.userAddressLine1),this.userAddressLine2=p.getCustomDataString(e.userAddressLine2),this.userCity=p.getCustomDataString(e.userCity),this.userState=p.getCustomDataString(e.userState),this.userCountry=p.getCustomDataString(e.userCountry),this.userZipcode=p.getCustomDataString(e.userZipcode),this.customContentType=p.getCustomDataString(e.customContentType),this.customVideoDurationMillis=p.getCustomDataString(e.customVideoDurationMillis),this.customEncodingVariant=p.getCustomDataString(e.customEncodingVariant),this.customVideoLanguage=p.getCustomDataString(e.customVideoLanguage),this.customVideoId=p.getCustomDataString(e.customVideoId),this.customVideoSeries=p.getCustomDataString(e.customVideoSeries),this.customVideoProducer=p.getCustomDataString(e.customVideoProducer),this.customVideoTitle=p.getCustomDataString(e.customVideoTitle),this.customVideoVariantName=p.getCustomDataString(e.customVideoVariantName),this.customVideoVariant=p.getCustomDataString(e.customVideoVariant),this.SDKVersion=`1.0.0`,this.experimentName=e.experimentName}updateCustomData(e){this.customData1=p.getCustomDataString(e.customData1),this.customData2=p.getCustomDataString(e.customData2),this.customData3=p.getCustomDataString(e.customData3),this.customData4=p.getCustomDataString(e.customData4),this.customData5=p.getCustomDataString(e.customData5),this.customData6=p.getCustomDataString(e.customData6),this.customData7=p.getCustomDataString(e.customData7),this.customData8=p.getCustomDataString(e.customData8),this.customData9=p.getCustomDataString(e.customData9),this.customData10=p.getCustomDataString(e.customData10)}updateCustomUserData(e){this.customUserId=p.getCustomDataString(e.userId),this.userName=p.getCustomDataString(e.userName),this.userEMail=p.getCustomDataString(e.userEMail),this.userPhone=p.getCustomDataString(e.userPhone),this.userProfileImage=p.getCustomDataString(e.userProfileImage),this.userAddressLine1=p.getCustomDataString(e.userAddressLine1),this.userAddressLine2=p.getCustomDataString(e.userAddressLine2),this.userCity=p.getCustomDataString(e.userCity),this.userState=p.getCustomDataString(e.userState),this.userCountry=p.getCustomDataString(e.userCountry),this.userZipcode=p.getCustomDataString(e.userZipcode)}updateCustomVideoData(e){this.customContentType=p.getCustomDataString(e.customContentType),this.customVideoDurationMillis=p.getCustomDataString(e.customVideoDurationMillis),this.customEncodingVariant=p.getCustomDataString(e.customEncodingVariant),this.customVideoLanguage=p.getCustomDataString(e.customVideoLanguage),this.customVideoId=p.getCustomDataString(e.customVideoId),this.customVideoSeries=p.getCustomDataString(e.customVideoSeries),this.customVideoProducer=p.getCustomDataString(e.customVideoProducer),this.customVideoTitle=p.getCustomDataString(e.customVideoTitle),this.customVideoVariantName=p.getCustomDataString(e.customVideoVariantName),this.customVideoVariant=p.getCustomDataString(e.customVideoVariant)}updateCustomPlayerData(e){this.customPlayerIntegrationVersion=p.getCustomDataString(e.customPlayerIntegrationVersion),this.customPlayerName=p.getCustomDataString(e.customPlayerName),this.customPageType=p.getCustomDataString(e.customPageType)}setUserId(e=!1,t=null){if(t){this.userId=t;return}if(e){this.userId=p.uuidv4();return}let n=p.getCookie(`gumlet_user_id`);!n||n===``?this.userId=p.setCookie(`gumlet_user_id`,720*60):this.userId=n}setSessionId(e=!1,t=null,n=!0){if(t){this.sessionId=t,this.setSessionData(),n&&this.sessionCreationCall.sendRequest(this.sessionData,p.noOp);return}if(e){this.sessionId=p.uuidv4();return}let r=p.getCookie(`gumlet_session_id`);!r||r===``?(this.sessionId=p.setCookie(`gumlet_session_id`,30),this.setSessionData(),this.sessionCreationCall.sendRequest(this.sessionData,p.noOp)):(this.sessionId=r,this.setSessionData())}setPlayerInstanceId(e){this.playerInstanceId=e?e():p.uuidv4(),this.setPlayerData()}setPlaybackId(e){this.playbackId=e?e():p.uuidv4()}resetSessionExpiry(){this.config.test||this.config.sessionID||(p.setCookie(`gumlet_session_id`,30,this.sessionId),p.setCookie(`gumlet_user_id`,720*60,this.userId))}setSessionData(){if(this.sessionData={session_id:this.sessionId,property_id:this.propertyId,user_id:this.userId,custom_user_id:this.customUserId,custom_data_1:this.customData1,custom_data_2:this.customData2,custom_data_3:this.customData3,custom_data_4:this.customData4,custom_data_5:this.customData5,custom_data_6:this.customData6,custom_data_7:this.customData7,custom_data_8:this.customData8,custom_data_9:this.customData9,custom_data_10:this.customData10,user_name:this.userName,user_email:this.userEMail,user_phone:this.userPhone,user_profile_image:this.userProfileImage,user_address_line1:this.userAddressLine1,user_address_line2:this.userAddressLine2,user_city:this.userCity,user_state:this.userState,user_country:this.userCountry,user_zipcode:this.userZipcode,viewer_client_version:this.SDKVersion},this.config.deviceData){let e=this.config.deviceData;this.sessionData.meta_device_name=e.meta_device_name,this.sessionData.meta_device_manufacturer=e.meta_device_manufacturer,this.sessionData.meta_operating_system_version=e.meta_operating_system_version,this.sessionData.meta_operating_system=e.meta_operating_system,this.sessionData.meta_browser=e.meta_browser,this.sessionData.meta_device_display_dpr=e.meta_device_display_dpr,this.sessionData.meta_browser_version=e.meta_browser_version,this.sessionData.meta_device_category=e.meta_device_category,this.sessionData.meta_device_architecture=e.meta_device_architecture,this.sessionData.meta_device_display_width=e.meta_device_display_width,this.sessionData.meta_device_display_height=e.meta_device_display_height,this.sessionData.meta_device_is_touchscreen=e.meta_device_is_touchscreen,this.sessionData.meta_browser_language=e.meta_browser_language}else this.sessionData.meta_device_name=Y.device.model,this.sessionData.meta_device_manufacturer=Y.device.vendor,this.sessionData.meta_operating_system_version=Y.os.version,this.sessionData.meta_operating_system=Y.os.name,this.sessionData.meta_browser=Y.browser.name,this.sessionData.meta_browser_version=Y.browser.version,this.sessionData.meta_device_category=ke(),this.sessionData.meta_device_architecture=Y.cpu.architecture,typeof window<`u`&&(this.sessionData.meta_device_display_dpr=parseInt(String(window.devicePixelRatio),10),this.sessionData.meta_device_display_width=window.screen.width,this.sessionData.meta_device_display_height=window.screen.height,this.sessionData.meta_browser_language=navigator?navigator.language||navigator.userLanguage:``,`ontouchstart`in document.documentElement&&(this.sessionData.meta_device_is_touchscreen=`true`))}setPlayerData(e){if(this.playerData={player_instance_id:this.playerInstanceId,property_id:this.propertyId,session_id:this.sessionId,user_id:this.userId,custom_user_id:this.customUserId,custom_data_1:this.customData1,custom_data_2:this.customData2,custom_data_3:this.customData3,custom_data_4:this.customData4,custom_data_5:this.customData5,custom_data_6:this.customData6,custom_data_7:this.customData7,custom_data_8:this.customData8,custom_data_9:this.customData9,custom_data_10:this.customData10,player_integration_version:this.customPlayerIntegrationVersion,meta_page_type:this.customPageType,meta_page_url:this.pageURL},this.config.deviceData){let e=this.config.playerData||{};this.playerData.player_preload=e.player_preload,this.playerData.player_autoplay=e.player_autoplay,this.playerData.player_software_version=e.player_software_version,this.playerData.player_integration_version=e.player_integration_version,this.playerData.player_name=e.player_name,this.playerData.player_language_code=e.player_language_code,this.playerData.player_software=e.player_software,this.playerData.meta_page_url=e.meta_page_url,this.playerData.meta_page_type=e.meta_page_type,this.playerData.player_height_pixels=e.player_height_pixels,this.playerData.player_width_pixels=e.player_width_pixels}e&&p.validNumber(e.videoWindowHeight)&&(this.playerData.player_height_pixels=e.videoWindowHeight),e&&p.validNumber(e.videoWindowWidth)&&(this.playerData.player_width_pixels=e.videoWindowWidth),e&&p.validBoolean(e.autoplay)&&(this.playerData.player_autoplay=e.autoplay),e&&p.validBoolean(e.preload)&&(this.playerData.player_preload=e.preload),e&&p.validString(e.version)&&(this.playerData.player_software_version=e.version),e&&p.validString(e.audioLanguage)&&(this.playerData.player_language_code=e.audioLanguage),e&&p.validString(e.playerSoftware)&&(this.playerData.player_software=e.playerSoftware)}},Wt=class{constructor(e,t){this.sample={},this.currentTime=0,this.isMuted=!1,this.orientation=`undetected`,this.playbackWatchTime=0,this.config=e,this.session=t;try{this.orientation=screen.orientation.type.match(/\w+/)[0],screen.orientation.addEventListener(`change`,()=>{this.orientation=screen.orientation.type.match(/\w+/)[0]})}catch{this.orientation=`undetected`}}setDuration(e){}setPlaybackWatchTime(e){this.playbackWatchTime=e}getPlaybackWatchTime(){return this.playbackWatchTime}setVideoData(e){e&&p.validNumber(e.duration)&&(this.videoDuration=p.calculateTime(e.duration)),e&&p.validString(e.streamType)&&(this.videoSourceType=e.streamType,e.streamType===`dash`&&p.validString(e.mpdUrl)?(this.videoSourceUrl=e.mpdUrl,this.videoSourceHostname=new URL(this.videoSourceUrl).hostname):e.streamType===`hls`&&p.validString(e.m3u8Url)?(this.videoSourceUrl=e.m3u8Url,this.videoSourceHostname=new URL(this.videoSourceUrl).hostname):e.streamType===`hls`&&p.validString(e.streamUrl)?(this.videoSourceUrl=e.streamUrl,this.videoSourceHostname=new URL(this.videoSourceUrl).hostname):e.streamType===`progressive`&&p.validString(e.progUrl)?(this.videoSourceUrl=e.progUrl,this.videoSourceHostname=new URL(this.videoSourceUrl).hostname):e?.streamUrl&&(this.videoSourceUrl=e.streamUrl,this.videoSourceHostname=new URL(this.videoSourceUrl).hostname)),e?.streamUrl&&(this.videoSourceUrl=e.streamUrl),e?.sourceHostName&&(this.videoSourceHostname=e.sourceHostName),e?.muted&&(this.isMuted=e.muted),e?.currentVideoData?.height&&p.validNumber(e.currentVideoData.height)&&e.currentVideoData.height>0&&(this.videoHeightPixels=e.currentVideoData.height),e?.currentVideoData?.width&&p.validNumber(e.currentVideoData.width)&&e.currentVideoData.width>0&&(this.videoWidthPixels=e.currentVideoData.width),e?.currentVideoData?.bitrate&&p.validNumber(e.currentVideoData.bitrate)&&e.currentVideoData.bitrate>-1&&(this.videoBitrate=e.currentVideoData.bitrate/1e6),e?.currentVideoData?.audioCodec&&p.validString(e.currentVideoData.audioCodec)&&e.currentVideoData.audioCodec.length>0&&(this.audioCodec=e.currentVideoData.audioCodec),e?.currentVideoData&&p.validString(e.currentVideoData.videoCodec)&&e.currentVideoData.videoCodec.length>0&&(this.videoCodec=e.currentVideoData.videoCodec);let t=this.session,n=0;if(this.videoHeightPixels&&t.playerData?.player_height_pixels&&t.sessionData?.meta_device_display_dpr?n=t.playerData.player_height_pixels*t.sessionData.meta_device_display_dpr/this.videoHeightPixels-1:(this.upscalePercentage=void 0,this.downscalePercentage=void 0),this.videoHeightPixels&&t.playerData?.player_height_pixels&&t.sessionData?.meta_device_display_dpr&&(n>0?(this.upscalePercentage=n*100,this.downscalePercentage=0):n<0?(this.upscalePercentage=0,this.downscalePercentage=n*100*-1):(this.upscalePercentage=0,this.downscalePercentage=0)),this.videoSourceUrl)try{let e=new URL(this.videoSourceUrl);e.hostname===`video.gumlet.io`&&!t.customVideoId&&(t.customVideoId=e.pathname.split(`/`)[2])}catch{}}setPlaybackSettingsFromLoadedEvent(e){e&&p.validNumber(e.currentTime)&&(this.currentTime=p.calculateTime(e.currentTime)),e&&p.validBoolean(e.isFullScreen)&&(this.isFullScreen=e.isFullScreen),e&&p.validBoolean(e.isCasting)&&(this.isCasting=e.isCasting)}setupSample(){let e=this.session;this.sample={property_id:e.propertyId,session_id:e.sessionId,user_id:e.userId,player_instance_id:e.playerInstanceId,playback_id:e.playbackId,from:void 0,to:void 0,playback_time_instant_millis:void 0,bitrate_mbps:this.videoBitrate,error_code:void 0,error:void 0,error_text:void 0,video_cover:void 0,video_cover_reference:void 0,player_remote_played:void 0,video_total_duration_millis:this.videoDuration,video_width_pixels:void 0,video_height_pixels:void 0,video_source_url:void 0,video_source_hostname:void 0,video_source_type:void 0,custom_content_type:e.customContentType,custom_video_duration_millis:e.customVideoDurationMillis,custom_encoding_variant:e.customEncodingVariant,custom_video_language:e.customVideoLanguage,custom_video_id:e.customVideoId,custom_video_series:e.customVideoSeries,custom_video_producer:e.customVideoProducer,custom_video_title:e.customVideoTitle,custom_video_variant_name:e.customVideoVariantName,custom_video_variant:e.customVideoVariant,muted:this.isMuted,casting:void 0,fullscreen:this.isFullScreen,video_downscale_percentage:void 0,video_upscale_percentage:void 0,orientation:void 0,orientation_from:void 0,quality:void 0,quality_from:void 0,previous_event:void 0,millis_from_previous_event:void 0,video_codec:void 0,audio_codec:void 0,custom_data_1:e.customData1,custom_data_2:e.customData2,custom_data_3:e.customData3,custom_data_4:e.customData4,custom_data_5:e.customData5,custom_data_6:e.customData6,custom_data_7:e.customData7,custom_data_8:e.customData8,custom_data_9:e.customData9,custom_data_10:e.customData10,custom_event_data:void 0,playback_watch_time:void 0}}getSample(e=null,t={}){let n=this.session,r=this.sample;if(r.event=e,r.event_id=n.config?.getUUID?n.config.getUUID():p.uuidv4(),r.custom_data_1=n.customData1,r.custom_data_2=n.customData2,r.custom_data_3=n.customData3,r.custom_data_4=n.customData4,r.custom_data_5=n.customData5,r.custom_data_6=n.customData6,r.custom_data_7=n.customData7,r.custom_data_8=n.customData8,r.custom_data_9=n.customData9,r.custom_data_10=n.customData10,r.custom_content_type=n.customContentType,r.custom_video_duration_millis=n.customVideoDurationMillis,r.custom_encoding_variant=n.customEncodingVariant,r.custom_video_language=n.customVideoLanguage,r.custom_video_id=n.customVideoId,r.custom_video_series=n.customVideoSeries,r.custom_video_producer=n.customVideoProducer,r.custom_video_title=n.customVideoTitle,r.custom_video_variant_name=n.customVideoVariantName,r.custom_video_variant=n.customVideoVariant,r.fullscreen=this.isFullScreen,r.muted=this.isMuted,r.video_width_pixels=this.videoWidthPixels,r.video_height_pixels=this.videoHeightPixels,r.video_total_duration_millis=this.videoDuration,r.bitrate=this.videoBitrate,r.audio_codec=this.audioCodec,r.video_codec=this.videoCodec,r.orientation=this.orientation,r.playback_time_instant_millis=this.currentTime,r.video_source_type=this.videoSourceType,r.video_source_url=this.videoSourceUrl,r.video_upscale_percentage=this.upscalePercentage,r.video_downscale_percentage=this.downscalePercentage,r.video_source_hostname=this.videoSourceHostname,r.custom_event_data=void 0,r.playback_watch_time=this.playbackWatchTime,Object.keys(t).forEach(e=>{r[e]=t[e]}),typeof window<`u`&&window.parent!==void 0&&window.navigator)try{typeof window.navigator.getBattery==`function`&&window.navigator.getBattery().then(e=>{e&&(r.battery_level_percentage=e.level*100,r.battery_charging=e.charging)})}catch{}return r}};xe();var Gt=class{constructor(e,t){this.licensing=`granted`,this.analyticsCall=e,this.sampleBuilder=t}sendRequest(e,t={}){let n=this.sampleBuilder.getSample(e,t);if(e!==g.END){if(n.playback_time_instant_millis&&n.video_total_duration_millis&&n.playback_time_instant_millis>n.video_total_duration_millis)return}else n.video_total_duration_millis&&(n.playback_time_instant_millis=Math.min(n.playback_time_instant_millis??0,n.video_total_duration_millis));this.analyticsCall.sendRequest(n,p.noOp)}sendRequestAsync(e,t={}){return new Promise((n,r)=>{let i=this.sampleBuilder.getSample(e,t);if(i.playback_time_instant_millis&&i.video_total_duration_millis&&i.playback_time_instant_millis>i.video_total_duration_millis){n(406);return}this.analyticsCall.sendRequestAsync(i).then(e=>n(e)).catch(e=>r(e))})}sendAndClear(e=null,t={}){if(!e){h.log(`event null passed not hitting the ingestion API`);return}this.sampleBuilder.videoDuration&&this.sampleBuilder.videoDuration>864e5||this.sendRequest(e,t)}sendAndClearAsync(e=null,t={}){return new Promise((n,r)=>{if(!e){h.log(`event null passed not hitting the ingestion API`),r(`event null passed not hitting the ingestion API`);return}this.sendRequestAsync(e,t).then(e=>n(e)).catch(e=>r(e))})}sendUnload(){if(this.licensing===`denied`)return;let e=this.sampleBuilder.sample;if(navigator.sendBeacon===void 0){this.sendSynchronous();return}fetch(this.analyticsCall.getAnalyticsServerUrl(),{method:`POST`,body:JSON.stringify(e),headers:{"Content-Type":`application/json`}}).then(e=>{e.ok||this.sendSynchronous()}).catch(()=>{this.sendSynchronous()})}sendSynchronous(){this.licensing!==`denied`&&this.analyticsCall.sendRequestSynchronous(this.sampleBuilder.sample,p.noOp)}},Kt=c(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define(`StateMachine`,[],r):typeof e==`object`?e.StateMachine=r():n.StateMachine=r()})(e,function(){return(function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,`a`,t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p=``,n(n.s=5)})([(function(e,t,n){"use strict";e.exports=function(e,t){var n,r,i;for(n=1;n<arguments.length;n++)for(i in r=arguments[n],r)r.hasOwnProperty(i)&&(e[i]=r[i]);return e}}),(function(e,t,n){"use strict";var r=n(0);e.exports={build:function(e,t){var n,i,a,o=t.plugins;for(n=0,i=o.length;n<i;n++)a=o[n],a.methods&&r(e,a.methods),a.properties&&Object.defineProperties(e,a.properties)},hook:function(e,t,n){var r,i,a,o,s=e.config.plugins,c=[e.context];for(n&&(c=c.concat(n)),r=0,i=s.length;r<i;r++)o=s[r],a=s[r][t],a&&a.apply(o,c)}}}),(function(e,t,n){"use strict";function r(e){if(e.length===0)return e;var t,n,r=e.split(/[_-]/);if(r.length===1&&r[0][0].toLowerCase()===r[0][0])return e;for(n=r[0].toLowerCase(),t=1;t<r.length;t++)n=n+r[t].charAt(0).toUpperCase()+r[t].substring(1).toLowerCase();return n}r.prepended=function(e,t){return t=r(t),e+t[0].toUpperCase()+t.substring(1)},e.exports=r}),(function(e,t,n){"use strict";var r=n(0),i=n(2);function a(e,t){e||={},this.options=e,this.defaults=t.defaults,this.states=[],this.transitions=[],this.map={},this.lifecycle=this.configureLifecycle(),this.init=this.configureInitTransition(e.init),this.data=this.configureData(e.data),this.methods=this.configureMethods(e.methods),this.map[this.defaults.wildcard]={},this.configureTransitions(e.transitions||[]),this.plugins=this.configurePlugins(e.plugins,t.plugin)}r(a.prototype,{addState:function(e){this.map[e]||(this.states.push(e),this.addStateLifecycleNames(e),this.map[e]={})},addStateLifecycleNames:function(e){this.lifecycle.onEnter[e]=i.prepended(`onEnter`,e),this.lifecycle.onLeave[e]=i.prepended(`onLeave`,e),this.lifecycle.on[e]=i.prepended(`on`,e)},addTransition:function(e){this.transitions.indexOf(e)<0&&(this.transitions.push(e),this.addTransitionLifecycleNames(e))},addTransitionLifecycleNames:function(e){this.lifecycle.onBefore[e]=i.prepended(`onBefore`,e),this.lifecycle.onAfter[e]=i.prepended(`onAfter`,e),this.lifecycle.on[e]=i.prepended(`on`,e)},mapTransition:function(e){var t=e.name,n=e.from,r=e.to;return this.addState(n),typeof r!=`function`&&this.addState(r),this.addTransition(t),this.map[n][t]=e,e},configureLifecycle:function(){return{onBefore:{transition:`onBeforeTransition`},onAfter:{transition:`onAfterTransition`},onEnter:{state:`onEnterState`},onLeave:{state:`onLeaveState`},on:{transition:`onTransition`}}},configureInitTransition:function(e){return typeof e==`string`?this.mapTransition(r({},this.defaults.init,{to:e,active:!0})):typeof e==`object`?this.mapTransition(r({},this.defaults.init,e,{active:!0})):(this.addState(this.defaults.init.from),this.defaults.init)},configureData:function(e){return typeof e==`function`?e:typeof e==`object`?function(){return e}:function(){return{}}},configureMethods:function(e){return e||{}},configurePlugins:function(e,t){e||=[];var n,r,i;for(n=0,r=e.length;n<r;n++)i=e[n],typeof i==`function`&&(e[n]=i=i()),i.configure&&i.configure(this);return e},configureTransitions:function(e){var t,n,r,i,a,o=this.defaults.wildcard;for(n=0;n<e.length;n++)for(r=e[n],i=Array.isArray(r.from)?r.from:[r.from||o],a=r.to||o,t=0;t<i.length;t++)this.mapTransition({name:r.name,from:i[t],to:a})},transitionFor:function(e,t){var n=this.defaults.wildcard;return this.map[e][t]||this.map[n][t]},transitionsFor:function(e){var t=this.defaults.wildcard;return Object.keys(this.map[e]).concat(Object.keys(this.map[t]))},allStates:function(){return this.states},allTransitions:function(){return this.transitions}}),e.exports=a}),(function(e,t,n){var r=n(0),i=n(6),a=n(1),o=[null,[]];function s(e,t){this.context=e,this.config=t,this.state=t.init.from,this.observers=[e]}r(s.prototype,{init:function(e){if(r(this.context,this.config.data.apply(this.context,e)),a.hook(this,`init`),this.config.init.active)return this.fire(this.config.init.name,[])},is:function(e){return Array.isArray(e)?e.indexOf(this.state)>=0:this.state===e},isPending:function(){return this.pending},can:function(e){return!this.isPending()&&!!this.seek(e)},cannot:function(e){return!this.can(e)},allStates:function(){return this.config.allStates()},allTransitions:function(){return this.config.allTransitions()},transitions:function(){return this.config.transitionsFor(this.state)},seek:function(e,t){var n=this.config.defaults.wildcard,r=this.config.transitionFor(this.state,e),i=r&&r.to;return typeof i==`function`?i.apply(this.context,t):i===n?this.state:i},fire:function(e,t){return this.transit(e,this.state,this.seek(e,t),t)},transit:function(e,t,n,r){var i=this.config.lifecycle,a=this.config.options.observeUnchangedState||t!==n;return n?this.isPending()?this.context.onPendingTransition(e,t,n):(this.config.addState(n),this.beginTransit(),r.unshift({transition:e,from:t,to:n,fsm:this.context}),this.observeEvents([this.observersForEvent(i.onBefore.transition),this.observersForEvent(i.onBefore[e]),a?this.observersForEvent(i.onLeave.state):o,a?this.observersForEvent(i.onLeave[t]):o,this.observersForEvent(i.on.transition),a?[`doTransit`,[this]]:o,a?this.observersForEvent(i.onEnter.state):o,a?this.observersForEvent(i.onEnter[n]):o,a?this.observersForEvent(i.on[n]):o,this.observersForEvent(i.onAfter.transition),this.observersForEvent(i.onAfter[e]),this.observersForEvent(i.on[e])],r)):this.context.onInvalidTransition(e,t,n)},beginTransit:function(){this.pending=!0},endTransit:function(e){return this.pending=!1,e},failTransit:function(e){throw this.pending=!1,e},doTransit:function(e){this.state=e.to},observe:function(e){if(e.length===2){var t={};t[e[0]]=e[1],this.observers.push(t)}else this.observers.push(e[0])},observersForEvent:function(e){for(var t=0,n=this.observers.length,r,i=[];t<n;t++)r=this.observers[t],r[e]&&i.push(r);return[e,i,!0]},observeEvents:function(e,t,n,r){if(e.length===0)return this.endTransit(r===void 0?!0:r);var i=e[0][0],o=e[0][1],s=e[0][2];if(t[0].event=i,i&&s&&i!==n&&a.hook(this,`lifecycle`,t),o.length===0)return e.shift(),this.observeEvents(e,t,i,r);var c=o.shift(),l=c[i].apply(c,t);return l&&typeof l.then==`function`?l.then(this.observeEvents.bind(this,e,t,i)).catch(this.failTransit.bind(this)):l===!1?this.endTransit(!1):this.observeEvents(e,t,i,l)},onInvalidTransition:function(e,t,n){throw new i(`transition is invalid in current state`,e,t,n,this.state)},onPendingTransition:function(e,t,n){throw new i(`transition is invalid while previous transition is still in progress`,e,t,n,this.state)}}),e.exports=s}),(function(e,t,n){"use strict";var r=n(0),i=n(2),a=n(1),o=n(3),s=n(4),c={is:function(e){return this._fsm.is(e)},can:function(e){return this._fsm.can(e)},cannot:function(e){return this._fsm.cannot(e)},observe:function(){return this._fsm.observe(arguments)},transitions:function(){return this._fsm.transitions()},allTransitions:function(){return this._fsm.allTransitions()},allStates:function(){return this._fsm.allStates()},onInvalidTransition:function(e,t,n){return this._fsm.onInvalidTransition(e,t,n)},onPendingTransition:function(e,t,n){return this._fsm.onPendingTransition(e,t,n)}},l={state:{configurable:!1,enumerable:!0,get:function(){return this._fsm.state},set:function(e){throw Error(`use transitions to change state`)}}};function u(e){return f(this||{},e)}function d(){var e,t;typeof arguments[0]==`function`?(e=arguments[0],t=arguments[1]||{}):(e=function(){this._fsm.apply(this,arguments)},t=arguments[0]||{});var n=new o(t,u);return ee(e.prototype,n),e.prototype._fsm.config=n,e}function f(e,t){return ee(e,new o(t,u)),e._fsm(),e}function ee(e,t){if(typeof e!=`object`||Array.isArray(e))throw Error(`StateMachine can only be applied to objects`);a.build(e,t),Object.defineProperties(e,l),r(e,c),r(e,t.methods),t.allTransitions().forEach(function(t){e[i(t)]=function(){return this._fsm.fire(t,[].slice.call(arguments))}}),e._fsm=function(){this._fsm=new s(this,t),this._fsm.init(arguments)}}u.version=`3.0.1`,u.factory=d,u.apply=f,u.defaults={wildcard:`*`,init:{name:`init`,from:`none`}},e.exports=u}),(function(e,t,n){"use strict";e.exports=function(e,t,n,r,i){this.message=e,this.transition=t,this.from=n,this.to=r,this.current=i}})])})})),X,qt=s((()=>{X={READY:`ready`,STARTUP:`startup`,SOURCE_LOADED:`sourceLoaded`,PLAY:`play`,PAUSE:`pause`,TIMECHANGED:`timechanged`,SEEK:`seek`,SEEKED:`seeked`,START_CAST:`startCasting`,END_CAST:`endCasting`,START_BUFFERING:`startBuffering`,END_BUFFERING:`endBuffering`,AUDIO_CHANGE:`audioChange`,VIDEO_CHANGE:`videoChange`,START_FULLSCREEN:`startFullscreen`,END_FULLSCREEN:`endFullscreen`,START_AD:`adStart`,END_AD:`adEnd`,MUTE:`mute`,UN_MUTE:`unMute`,ERROR:`playerError`,NON_FATAL_ERROR:`playerNonFatalError`,PLAYBACK_FINISHED:`end`,SCREEN_RESIZE:`resize`,UNLOAD:`unload`,END:`end`,METADATA_LOADED:`metadataLoaded`,SOURCE_UNLOADED:`sourceUnloaded`,PLAYBACK_PLAYING:`playback_playing`}})),Jt=l({GumletStateMachine:()=>Xt}),Yt,Xt,Zt=s((()=>{Yt=d(Kt(),1),xe(),qt(),m(),Xt=class{constructor(e,t={}){this.previousRecordTime=0,this.playbackWatchTime=0,this.lastPlayHeadDuration=0,this.onEnterStateTimestamp=0,this.heartbeatTimestamp=0,this.seekStartedAt=null,this.seekedFrom=0,this.seekedTimestamp=0,this.playTimeStamp=null,this.startupBufferingPending=!1,this.pendingErrorRecovery_=!1,this.States={SETUP:`SETUP`,STARTUP:`STARTUP`,READY:`READY`,PLAYING:`PLAYING`,REBUFFERING:`REBUFFERING`,PAUSE:`PAUSE`,PAUSED_SEEKING:`PAUSED_SEEKING`,END:`END`,ERROR:`ERROR`,CASTING:`CASTING`},this.callbacks=e,this.opts=t,this.createStateMachine()}callEvent(e,t,n){this.fsm.can(e)?this.fsm[e](n,t):h.log(`Ignored Event: ${e}`)}updateMetadata(e){this.callbacks.updateSample(e)}allStates(){return Object.values(this.States)}createStateMachine(){let e=this,t=this.States,n=this.opts,r=[X.PLAY,X.PAUSE,X.SEEK,X.SEEKED,X.PLAYBACK_PLAYING,X.PLAYBACK_FINISHED,X.READY,X.SCREEN_RESIZE,X.END,X.ERROR,X.NON_FATAL_ERROR,X.UN_MUTE,X.MUTE];this.fsm=new Yt.default({init:t.SETUP,transitions:[{name:X.TIMECHANGED,from:t.SETUP,to:t.SETUP},{name:X.READY,from:[t.SETUP,t.ERROR],to:t.READY},{name:X.SOURCE_LOADED,from:t.SETUP,to:t.SETUP},{name:X.PLAY,from:t.READY,to:t.STARTUP},{name:X.SOURCE_LOADED,from:t.READY,to:t.READY},{name:X.SEEK,from:t.READY,to:t.READY},{name:X.SEEKED,from:t.READY,to:t.READY},{name:X.MUTE,from:t.READY,to:t.READY},{name:X.UN_MUTE,from:t.READY,to:t.READY},{name:X.VIDEO_CHANGE,from:t.READY,to:t.READY},{name:X.AUDIO_CHANGE,from:t.READY,to:t.READY},{name:X.TIMECHANGED,from:t.STARTUP,to:t.PLAYING},{name:X.START_BUFFERING,from:t.STARTUP,to:t.STARTUP},{name:X.END_BUFFERING,from:t.STARTUP,to:t.STARTUP},{name:X.VIDEO_CHANGE,from:t.STARTUP,to:t.STARTUP},{name:X.AUDIO_CHANGE,from:t.STARTUP,to:t.STARTUP},{name:X.SEEK,from:t.STARTUP,to:t.STARTUP},{name:X.SEEKED,from:t.STARTUP,to:t.STARTUP},{name:X.SOURCE_LOADED,from:t.STARTUP,to:t.STARTUP},{name:X.END,from:t.STARTUP,to:t.END},{name:X.TIMECHANGED,from:t.PLAYING,to:t.PLAYING},{name:X.END_BUFFERING,from:t.PLAYING,to:t.PLAYING},{name:X.SEEKED,from:t.PLAYING,to:t.PLAYING},{name:X.SOURCE_LOADED,from:t.PLAYING,to:t.PLAYING},{name:X.VIDEO_CHANGE,from:t.PLAYING,to:t.PLAYING},{name:X.AUDIO_CHANGE,from:t.PLAYING,to:t.PLAYING},{name:X.MUTE,from:t.PLAYING,to:t.PLAYING},{name:X.UN_MUTE,from:t.PLAYING,to:t.PLAYING},{name:X.PAUSE,from:t.PLAYING,to:t.PAUSE},{name:X.START_BUFFERING,from:t.PLAYING,to:t.REBUFFERING},{name:X.END,from:t.PLAYING,to:t.END},{name:X.START_BUFFERING,from:t.REBUFFERING,to:t.REBUFFERING},{name:X.VIDEO_CHANGE,from:t.REBUFFERING,to:t.REBUFFERING},{name:X.AUDIO_CHANGE,from:t.REBUFFERING,to:t.REBUFFERING},{name:X.PLAY,from:t.REBUFFERING,to:t.PLAYING},{name:X.TIMECHANGED,from:t.REBUFFERING,to:t.PLAYING},{name:X.PAUSE,from:t.REBUFFERING,to:t.PAUSE},{name:X.END,from:t.REBUFFERING,to:t.END},{name:X.TIMECHANGED,from:t.PAUSE,to:t.PAUSE},{name:X.SEEKED,from:t.PAUSE,to:t.PAUSE},{name:X.VIDEO_CHANGE,from:t.PAUSE,to:t.PAUSE},{name:X.AUDIO_CHANGE,from:t.PAUSE,to:t.PAUSE},{name:X.MUTE,from:t.PAUSE,to:t.PAUSE},{name:X.UN_MUTE,from:t.PAUSE,to:t.PAUSE},{name:X.PLAY,from:t.PAUSE,to:t.PLAYING},{name:X.SEEK,from:t.PAUSE,to:t.PAUSED_SEEKING},{name:X.END,from:t.PAUSE,to:t.END},{name:X.SEEK,from:t.PAUSED_SEEKING,to:t.PAUSED_SEEKING},{name:X.AUDIO_CHANGE,from:t.PAUSED_SEEKING,to:t.PAUSED_SEEKING},{name:X.VIDEO_CHANGE,from:t.PAUSED_SEEKING,to:t.PAUSED_SEEKING},{name:X.START_BUFFERING,from:t.PAUSED_SEEKING,to:t.PAUSED_SEEKING},{name:X.END_BUFFERING,from:t.PAUSED_SEEKING,to:t.PAUSED_SEEKING},{name:X.PLAY,from:t.PAUSED_SEEKING,to:t.PAUSED_SEEKING},{name:X.SEEKED,from:t.PAUSED_SEEKING,to:t.PAUSE},{name:X.TIMECHANGED,from:t.PAUSED_SEEKING,to:t.PLAYING},{name:X.PAUSE,from:t.PAUSED_SEEKING,to:t.PAUSE},{name:X.END,from:t.PAUSED_SEEKING,to:t.END},{name:X.SEEK,from:t.END,to:t.END},{name:X.SEEKED,from:t.END,to:t.END},{name:X.TIMECHANGED,from:t.END,to:t.END},{name:X.END_BUFFERING,from:t.END,to:t.END},{name:X.START_BUFFERING,from:t.END,to:t.END},{name:X.END,from:t.END,to:t.END},{name:X.PLAY,from:t.END,to:t.PLAYING},{name:X.ERROR,from:this.allStates(),to:t.ERROR},{name:X.PAUSE,from:t.ERROR,to:t.ERROR},{name:X.PLAY,from:t.ERROR,to:t.PLAYING},{name:X.TIMECHANGED,from:t.ERROR,to:t.PLAYING},{name:X.SOURCE_LOADED,from:t.ERROR,to:t.ERROR},{name:X.METADATA_LOADED,from:t.ERROR,to:t.ERROR},{name:X.START_BUFFERING,from:t.ERROR,to:t.REBUFFERING},{name:X.SEEK,from:t.ERROR,to:t.ERROR},{name:X.SEEKED,from:t.ERROR,to:t.ERROR},{name:X.MUTE,from:t.ERROR,to:t.ERROR},{name:X.UN_MUTE,from:t.ERROR,to:t.ERROR},{name:X.VIDEO_CHANGE,from:t.ERROR,to:t.ERROR},{name:X.AUDIO_CHANGE,from:t.ERROR,to:t.ERROR},{name:X.END_BUFFERING,from:t.ERROR,to:t.ERROR},{name:X.END,from:t.ERROR,to:t.END},...this.allStates().map(e=>({name:X.NON_FATAL_ERROR,from:e,to:e})),{name:X.UNLOAD,from:this.allStates(),to:t.END},{name:X.START_CAST,from:[t.READY,t.PAUSE],to:t.CASTING},{name:X.PAUSE,from:t.CASTING,to:t.CASTING},{name:X.PLAY,from:t.CASTING,to:t.CASTING},{name:X.TIMECHANGED,from:t.CASTING,to:t.CASTING},{name:X.MUTE,from:t.CASTING,to:t.CASTING},{name:X.SEEK,from:t.CASTING,to:t.CASTING},{name:X.SEEKED,from:t.CASTING,to:t.CASTING},{name:X.END_CAST,from:t.CASTING,to:t.READY}],methods:{onBeforeTransition(n,i,a){e.callbacks.playbackWatchTime(e.playbackWatchTime),r.includes(n.transition)&&(n.transition===X.PLAYBACK_FINISHED&&(e.previousRecordTime=0),a&&(e.previousRecordTime=a.currentTime)),n.transition===X.SEEK&&n.from===t.PAUSE&&(e.seekedFrom=e.lastPlayHeadDuration),a&&n.transition!==X.SOURCE_LOADED&&(e.lastPlayHeadDuration=a.currentTime*1e3)},onLeaveState(n,r,i){if(!r)return;let a=r-e.onEnterStateTimestamp;i&&n.to!==t.PAUSED_SEEKING&&(h.log(`Setting video time end to ${i.currentTime}, going to ${n.to}`),e.callbacks.setVideoTimeEndFromEvent(i));let o=n.from.toLowerCase();if(n.from===t.PAUSED_SEEKING){let a=r-(e.seekStartedAt??r);e.seekStartedAt=null,e.callbacks.playback_seeked(e.seekedFrom,i.currentTime*1e3,a,n.to),e.callbacks.heartbeat(r,t.PAUSE.toLowerCase(),i),h.log(`Seek was ${a}ms`)}else n.transition===X.UNLOAD&&n.from===t.PLAYING?e.callbacks.playingAndBye(a,o,i):n.from===t.PAUSE&&n.to!==t.PAUSED_SEEKING&&n.to!==t.PLAYING&&(e.callbacks.setVideoTimeStartFromEvent(n.transition),e.callbacks.pause(a,o,i),e.callbacks.heartbeat(r,o,i))},onAfterTransition(t,n,r){e.callbacks.resetSessionExpiry(),t.transition===X.VIDEO_CHANGE?e.callbacks.videoChange(r):t.transition===X.AUDIO_CHANGE?e.callbacks.audioChange(r):t.transition===X.MUTE?(h.log(`Setting sample to muted`),e.callbacks.mute(n,r)):t.transition===X.UN_MUTE&&(h.log(`Setting sample to unmuted`),e.callbacks.unMute(n,r))},onEnterState(i,a,o){i.to===t.ERROR&&(e.pendingErrorRecovery_=!1),e.callbacks.playbackWatchTime(e.playbackWatchTime),r.includes(i.transition)&&o&&(e.previousRecordTime=o.currentTime),i.transition!==X.NON_FATAL_ERROR&&(i.from===`none`&&n.starttime?e.onEnterStateTimestamp=n.starttime:e.onEnterStateTimestamp=a||Date.now()),(i.to===t.PLAYING&&(i.from===t.STARTUP||i.from===t.PAUSE||i.from===t.REBUFFERING||i.from===t.PAUSED_SEEKING||i.from===t.ERROR)||i.from===`none`&&i.to===t.SETUP)&&(e.heartbeatTimestamp=i.from===`none`&&n.starttime?n.starttime:a||Date.now()),o&&i.to!==t.PAUSED_SEEKING&&e.callbacks.setVideoTimeStartFromEvent(o)},onEnterSetup(r,i,a){r.from===`none`&&e.callbacks.setup(i,t.SETUP,a,n)},onEnterReady(n,r,i){n.from===t.SETUP&&e.callbacks.ready(r,t.READY,i)},onEnterStartup(n,r,i){n.transition===X.PLAY&&(e.playTimeStamp=new Date,e.callbacks.first_play(r,t.STARTUP,i))},onEnterPlaying(n,r,i){n.transition===X.PLAY&&n.from===t.PAUSE?(e.callbacks.play(r,t.PLAYING,i),e.callbacks.playing(r,t.PLAYING,i),e.callbacks.heartbeat(r,t.PLAYING,i)):n.from===t.STARTUP?(e.startupBufferingPending&&(e.startupBufferingPending=!1,e.callbacks.start_rebuffer(r,t.REBUFFERING,i),e.callbacks.end_rebuffer(r,t.REBUFFERING,i)),e.callbacks.playing(r,t.PLAYING,i),e.callbacks.playback_started(i)):n.from===t.REBUFFERING?(e.callbacks.end_rebuffer(r,t.REBUFFERING,i),e.pendingErrorRecovery_&&(e.pendingErrorRecovery_=!1,e.callbacks.error_recovered(r,t.ERROR,i))):n.from===t.ERROR&&e.callbacks.error_recovered(r,t.ERROR,i)},onEnterPause(n,r,i){n.from===t.PLAYING&&(e.callbacks.pause(r,t.PAUSE,i),e.callbacks.heartbeat(r,t.PAUSE,i))},onEnterRebuffering(n,r,i){n.transition===X.START_BUFFERING&&(e.callbacks.start_rebuffer(r,t.REBUFFERING,i),n.from===t.ERROR&&(e.pendingErrorRecovery_=!0))},onBeforeStartBuffering(n,r,i){n.from===t.STARTUP&&(e.startupBufferingPending=!0)},onEnterEnd(n,r,i){e.callbacks.end(r,t.END,i),e.callbacks.heartbeat(r,t.END,i)},onBeforeSourceLoaded(n,r,i){let a=n.from===t.PLAYING&&e.playTimeStamp?Date.now()-e.playTimeStamp.getTime():null;e.callbacks.loaded(r,t.READY,i,a)},onSeek(t,n,r){r&&(e.previousRecordTime=r.currentTime),e.callbacks.playbackWatchTime(e.playbackWatchTime),e.seekStartedAt=e.seekStartedAt??n},onSeeked(t,n,r){r&&(e.previousRecordTime=r.currentTime),e.callbacks.playbackWatchTime(e.playbackWatchTime),e.seekedTimestamp=n},onTimechanged(t,n,r){e.callbacks.playbackWatchTime(e.playbackWatchTime);let i=r.currentTime-e.previousRecordTime;i>0&&i<5&&(e.playbackWatchTime+=Math.round(i*1e3),e.previousRecordTime=r.currentTime);let a=n-e.heartbeatTimestamp;a>1e4&&(e.callbacks.setVideoTimeEndFromEvent(r),h.log(`Sending heartbeat`),e.callbacks.heartbeat(a,t.from.toLowerCase(),r),e.heartbeatTimestamp=n,e.callbacks.setVideoTimeStartFromEvent(r),e.callbacks.resetSessionExpiry())},onPlayerError(t,n,r){e.callbacks.error(r)},onPlayerNonFatalError(t,n,r){e.callbacks.error(r)}}})}static pad(e,t){return(e+Array(t).join(` `)).slice(0,t)}}}));function Qt(e){return e=e.toLowerCase(),e.endsWith(`.m3u8`)?tn:e.endsWith(`.mp4`)||e.endsWith(`.m4v`)||e.endsWith(`.m4a`)?$t:e.endsWith(`.webm`)?en:e.endsWith(`.mpd`)?nn:null}var $t,en,tn,nn,rn,an=s((()=>{$t=`video/mp4`,en=`video/webm`,tn=`application/x-mpegURL`,nn=`application/dash+xml`,rn={MP4:$t,WEBM:en,HLS:tn,DASH:nn}}));function on(e){return dn[e]}var sn,cn,ln,un,dn,fn=s((()=>{an(),{MP4:sn,WEBM:cn,HLS:ln,DASH:un}=rn,dn={[sn]:`mp4`,[cn]:`webm`,[ln]:`hls`,[un]:`dash`}})),Z,pn=s((()=>{Z={JW:`jw`,RADIANT:`radiant`,HLSJS:`hlsjs`,SHAKA:`shaka`,HTML:`html5`,REACTNATIVEVIDEO:`react-native-video`}})),mn=l({HTML5Adapter:()=>gn}),hn,gn,_n=s((()=>{qt(),an(),fn(),pn(),hn=1e3,gn=class{constructor(e,t,n,r=null){this.lastKnownCurrentTime_=0,this.sourceSwitching_=!1,this.eventCallback=t,this.playerSoftwareName=r??Z.HTML,this.stateMachine=n,this.mediaEl=e,this.mediaElEventHandlers=[],this.analyticsBitrate_=-1,this.audioCodec_=``,this.videoCodec_=``,this.bufferingTimeout_=null,this.isBuffering_=!1,this.isLive_=!1,this.isPaused_=!1,this.previousMediaTime_=null,this.needsReadyEvent_=!0,this.needsFirstPlayIntent_=!0,this.mediaElementSet_=!1,this.playbackReadySet_=!1,e&&this.setMediaElement()}getCurrentQualityLevelInfo(){return null}isLive(){return!1}getMIMEType(){let e=this.mediaEl;if(!e)return null;let t=e.src||e.querySelector(`source`)?.src||null;return t?Qt(t):null}getStreamType(){return on(this.getMIMEType()??``)}getPlayerVersion(){return null}getStreamURL(){let e=this.mediaEl;return e&&(e.src||e.querySelector(`source`)?.src)||null}destroy(){this.mediaEl&&this.unregisterMediaElement()}setMediaElement(e=null){if(e&&this.mediaEl&&(this.unregisterMediaElement(),this.mediaElementSet_=!1),e&&(this.mediaEl=e),!this.mediaEl)throw Error(`No media element owned`);if(this.mediaElementSet_)throw Error(`Media element already set (only call this once)`);this.mediaElementSet_=!0,this.registerMediaElement(),this.onMaybeReady()}resetMedia(){this.mediaEl=null,this.mediaElEventHandlers=[]}registerMediaElement(){let e=this.mediaEl;e&&(this.listenToMediaElementEvent(`loadedmetadata`,()=>{if(e.readyState!==1)return;this.checkQualityLevelAttributes(!0);let{duration:t,autoplay:n,videoWidth:r,videoHeight:i,muted:a}=e,o={type:`html5`,isLive:this.isLive(),version:this.getPlayerVersion()??`html5`,streamType:this.getStreamType(),streamUrl:this.getStreamURL(),duration:t,autoplay:n,currentVideoData:{height:i,width:r,bitrate:this.analyticsBitrate_,audioCodec:this.audioCodec_,videoCodec:this.videoCodec_},videoWindowWidth:e.clientWidth,videoWindowHeight:e.clientHeight,muted:a};this.needsFirstPlayIntent_||this.eventCallback(X.METADATA_LOADED,o)}),this.listenToMediaElementEvent(`canplay`,()=>{if(this.playbackReadySet_)return;this.playbackReadySet_=!0;let{duration:t,autoplay:n,videoWidth:r,videoHeight:i,muted:a}=e,o={type:`html5`,isLive:this.isLive(),version:this.getPlayerVersion()??`html5`,streamType:this.getStreamType(),streamUrl:this.getStreamURL(),duration:t,autoplay:n,playerSoftware:this.playerSoftwareName,videoWindowWidth:e.clientWidth,videoWindowHeight:e.clientHeight,currentVideoData:{height:i,width:r,bitrate:this.analyticsBitrate_,audioCodec:this.audioCodec_,videoCodec:this.videoCodec_},muted:a};this.eventCallback(X.SOURCE_LOADED,o)}),this.listenToMediaElementEvent(`emptied`,()=>{this.sourceSwitching_=!0}),this.listenToMediaElementEvent(`play`,()=>{let{currentTime:t,videoWidth:n,videoHeight:r}=e;this.needsFirstPlayIntent_=!1,this.eventCallback(X.PLAY,{currentVideoData:{height:r,width:n,bitrate:this.analyticsBitrate_,audioCodec:this.audioCodec_,videoCodec:this.videoCodec_},currentTime:t})}),this.listenToMediaElementEvent(`pause`,()=>{this.onPaused()}),this.listenToMediaElementEvent(`playing`,()=>{let{currentTime:t,videoWidth:n,videoHeight:r}=e;this.isPaused_=!1,!this.needsFirstPlayIntent_&&(this.sourceSwitching_||this.eventCallback(X.TIMECHANGED,{currentVideoData:{height:r,width:n,bitrate:this.analyticsBitrate_,audioCodec:this.audioCodec_,videoCodec:this.videoCodec_},currentTime:t}))}),this.listenToMediaElementEvent(`error`,()=>{let{error:t}=e;this.eventCallback(X.ERROR,{currentTime:this.lastKnownCurrentTime_,code:t?.code,message:t?.message})}),this.listenToMediaElementEvent(`volumechange`,()=>{let{muted:t,currentTime:n}=e;t?this.eventCallback(X.MUTE,{currentTime:n}):this.eventCallback(X.UN_MUTE,{currentTime:n})}),this.listenToMediaElementEvent(`seeking`,()=>{let{currentTime:t,videoWidth:n,videoHeight:r}=e;this.eventCallback(X.SEEK,{currentVideoData:{height:r,width:n,bitrate:this.analyticsBitrate_,audioCodec:this.audioCodec_,videoCodec:this.videoCodec_},currentTime:t,droppedFrames:0})}),this.listenToMediaElementEvent(`seeked`,()=>{let{currentTime:t,videoWidth:n,videoHeight:r}=e;this.bufferingTimeout_&&clearTimeout(this.bufferingTimeout_),this.eventCallback(X.SEEKED,{currentVideoData:{height:r,width:n,bitrate:this.analyticsBitrate_,audioCodec:this.audioCodec_,videoCodec:this.videoCodec_},currentTime:t,droppedFrames:0})}),this.listenToMediaElementEvent(`ended`,()=>{let{currentTime:t,videoWidth:n,videoHeight:r}=e;this.eventCallback(X.END,{currentVideoData:{height:r,width:n,bitrate:this.analyticsBitrate_,audioCodec:this.audioCodec_,videoCodec:this.videoCodec_},currentTime:t})}),this.listenToMediaElementEvent(`timeupdate`,()=>{let{currentTime:t,videoHeight:n,videoWidth:r}=e;this.isBuffering_=!1,t>0&&(this.lastKnownCurrentTime_=t,this.sourceSwitching_=!1),!this.needsFirstPlayIntent_&&(!this.isPaused_&&!this.sourceSwitching_&&this.eventCallback(X.TIMECHANGED,{currentVideoData:{height:n,width:r,bitrate:this.analyticsBitrate_,audioCodec:this.audioCodec_,videoCodec:this.videoCodec_},currentTime:t}),this.checkQualityLevelAttributes(),this.checkPlayheadProgress(),this.previousMediaTime_=t)}),this.listenToMediaElementEvent(`stalled`,()=>{}),this.listenToMediaElementEvent(`waiting`,()=>{this.onBuffering()}))}listenToMediaElementEvent(e,t){if(!this.mediaEl)throw Error(`No media attached`);let n=t.bind(this);this.mediaElEventHandlers.push({event:e,handler:n}),this.mediaEl.addEventListener(e,n,!1)}unregisterMediaElement(){if(!this.mediaEl)throw Error(`No media attached`);for(let{event:e,handler:t}of this.mediaElEventHandlers)this.mediaEl.removeEventListener(e,t,!1);this.resetMedia()}onMaybeReady(){if(!this.needsReadyEvent_||!this.mediaEl)return;this.needsReadyEvent_=!1;let{duration:e,autoplay:t,videoWidth:n,videoHeight:r,muted:i,preload:a}=this.mediaEl,o=this.getStreamURL(),s=a!==`none`,c={type:`html5`,isLive:this.isLive(),version:this.getPlayerVersion()??`html5`,streamType:this.getStreamType(),streamUrl:o,duration:e,autoplay:t,preload:s,playerSoftware:this.playerSoftwareName,currentVideoData:{height:r,width:n,bitrate:this.analyticsBitrate_,audioCodec:this.audioCodec_,videoCodec:this.videoCodec_},videoWindowWidth:this.mediaEl.clientWidth,videoWindowHeight:this.mediaEl.clientHeight,muted:i};this.stateMachine.updateMetadata(c),this.eventCallback(X.READY,c)}onBuffering(){let{currentTime:e}=this.mediaEl;this.isBuffering_||this.isPaused_||(this.eventCallback(X.START_BUFFERING,{currentTime:e}),this.isBuffering_=!0)}onPaused(){if(this.isPaused_)return;if(this.sourceSwitching_){this.isPaused_=!0;return}let{videoHeight:e,videoWidth:t}=this.mediaEl,n=this.lastKnownCurrentTime_>0?this.lastKnownCurrentTime_:this.mediaEl.currentTime??0;this.eventCallback(X.PAUSE,{currentVideoData:{height:e,width:t,bitrate:this.analyticsBitrate_,audioCodec:this.audioCodec_,videoCodec:this.videoCodec_},currentTime:n}),this.isPaused_=!0}checkPlayheadProgress(){let e=this.mediaEl;e.paused&&this.onPaused(),this.bufferingTimeout_&&clearTimeout(this.bufferingTimeout_),this.bufferingTimeout_=setTimeout(()=>{(e.paused||e.ended)&&!this.isBuffering_||e.currentTime-(this.previousMediaTime_??e.currentTime)<hn&&this.onBuffering()},hn)}checkQualityLevelAttributes(e=!1){let t=this.mediaEl,n=this.getCurrentQualityLevelInfo();if(!n)return;let{bitrate:r,width:i,height:a,videoCodec:o,audioCodec:s}=n,c=this.isLive();if(c!==this.isLive_&&(this.isLive_=c,e||this.stateMachine.updateMetadata({isLive:c})),this.audioCodec_=s??``,this.videoCodec_=o??``,this.analyticsBitrate_!==r){let n={width:i,height:a,bitrate:r,videoCodec:o,audioCodec:s,currentTime:t.currentTime};e||this.eventCallback(X.VIDEO_CHANGE,n),this.analyticsBitrate_=r??-1}}}})),vn=l({HlsjsAdapter:()=>yn}),yn,bn=s((()=>{qt(),_n(),an(),pn(),yn=class extends gn{constructor(e,t,n){super(null,t,n,Z.HLSJS),this.hls=e,this.playerSoftwareName=Z.HLSJS,this.boundOnMediaAttaching=this.onMediaAttaching.bind(this),this.boundOnMediaDetaching=this.onMediaDetaching.bind(this),this.boundOnManifestLoading=this.onManifestLoading.bind(this),this.hlsErrorHandler=(e,t)=>this.onError(t),this.resetMedia(),this.registerHlsEvents()}getCurrentQualityLevelInfo(){let e=this.hls,t=e.levels?.[e.currentLevel];if(!t)return null;let n=t.attrs,r=n.BANDWIDTH?parseInt(n.BANDWIDTH,10):0,i=n.RESOLUTION?.width?parseInt(n.RESOLUTION.width,10):0,a=n.RESOLUTION?.height?parseInt(n.RESOLUTION.height,10):0,o=null,s=null;if(n.CODECS){let e=n.CODECS.split(`,`);s=e[0]??null,o=e.length>1?e[1]:null}return{bitrate:r,width:i,height:a,audioCodec:o,videoCodec:s}}isLive(){let e=this.hls;return e.currentLevel<0?!1:!!(e.levels?.[e.currentLevel])?.details?.live}getPlayerVersion(){return Hls.version}getMIMEType(){return rn.HLS}getStreamURL(){return this.hls.url??null}destroy(){let e=this.hls;e.off(Hls.Events.MEDIA_ATTACHING,this.boundOnMediaAttaching),e.off(Hls.Events.MEDIA_DETACHING,this.boundOnMediaDetaching),e.off(Hls.Events.MANIFEST_LOADING,this.boundOnManifestLoading),e.off(Hls.Events.ERROR,this.hlsErrorHandler),super.destroy()}registerHlsEvents(){let e=this.hls;if(!Hls)throw Error(`Hls.js is not installed (must be loaded before analytics module)`);e.on(Hls.Events.MEDIA_ATTACHING,this.boundOnMediaAttaching),e.on(Hls.Events.MEDIA_DETACHING,this.boundOnMediaDetaching),e.on(Hls.Events.MANIFEST_LOADING,this.boundOnManifestLoading),e.on(Hls.Events.ERROR,this.hlsErrorHandler),e.media&&this.onMediaAttaching(),e.url&&this.onManifestLoading()}onMediaAttaching(){this.mediaEl||(this.mediaEl=this.hls.media,this.registerMediaElement(),this.onMaybeReady())}onMediaDetaching(){this.unregisterMediaElement()}onManifestLoading(){this.onMaybeReady()}onError(e){let t=e,n=this.lastKnownCurrentTime_>0?this.lastKnownCurrentTime_:this.mediaEl?.currentTime??0;t?.fatal===!0&&t?.details===`internalException`&&console.error(e),this.eventCallback(X.ERROR,{currentTime:n,code:t?.type,message:JSON.stringify({details:t?.details,fatal:t?.fatal,type:t?.type,fragment_url:t?.url,error:{message:t?.error?.message,stack:t?.error?.stack},extra:{networkDetails:{status:t?.networkDetails?.status,statusText:t?.networkDetails?.statusText,url:t?.networkDetails?.url,responseHeaders:t?.networkDetails?.responseHeaders,responseText:t?.networkDetails?.responseText,responseURL:t?.networkDetails?.responseURL,data:t?.networkDetails?.data}}})})}}})),xn=l({ShakaAdapter:()=>Sn}),Sn,Cn=s((()=>{_n(),an(),pn(),qt(),Sn=class extends gn{constructor(e,t,n,r){if(super(r,t,n,Z.SHAKA),typeof shaka>`u`)throw Error("`shaka` lib is not installed (must be loaded before analytics module)");this.shakaPlayer=e,this.playerSoftwareName=Z.SHAKA,this.shakaErrorHandler=e=>{this.onGumletShakaError(e,this.eventCallback,this.mediaEl).catch(()=>{let e=this.lastKnownCurrentTime_>0?this.lastKnownCurrentTime_:this.mediaEl?.currentTime??0;this.eventCallback(X.ERROR,{currentTime:e,code:`error_handler_exception`,message:`Shaka error handler threw before firing callback`})})},this.registerShakaEvents()}getPlayerVersion(){return shaka.Player.version}isLive(){return this.shakaPlayer?.isLive()??!1}getMIMEType(){return this.shakaPlayer?.getManifestType?.()===`HLS`?rn.HLS:rn.DASH}getStreamURL(){return this.shakaPlayer?.getAssetUri()??null}getCurrentQualityLevelInfo(){let e=this.shakaPlayer.getVariantTracks().filter(e=>e.active).find(e=>e.videoCodec!==null||e.videoId!==null);return e?{bitrate:e.videoBandwidth??e.bandwidth??null,width:e.width??null,height:e.height??null,videoCodec:e.videoCodec??null,audioCodec:e.audioCodec??null}:null}destroy(){this.shakaPlayer.removeEventListener(`error`,this.shakaErrorHandler),super.destroy()}registerShakaEvents(){if(!this.shakaPlayer)throw Error(`Shaka player object is not defined`);this.shakaPlayer.addEventListener(`error`,this.shakaErrorHandler)}async onGumletShakaError(e,t,n){let r=this.lastKnownCurrentTime_>0?this.lastKnownCurrentTime_:n?.currentTime??0,i=e;if(!i.detail){t(X.ERROR,{currentTime:r,code:`not_set_by_shaka`,message:`{}`});return}let a=i.detail,o=[];if(a.data)for(let e of a.data)o.push(e);let s=[],c=null;try{let e=[];if(this.shakaPlayer.getVariantTracks().forEach(t=>{e.push({width:t.width,height:t.height,bitrate:t.videoBandwidth??t.bandwidth,framerate:t.frameRate,contentType:`${t.mimeType}; codecs="${t.videoCodec}"`})}),navigator?.mediaCapabilities?.decodingInfo)for(let t of e)try{let e={type:`media-source`,video:{contentType:t.contentType,width:t.width??0,height:t.height??0,bitrate:t.bitrate??0,framerate:t.framerate??0},keySystemConfiguration:{keySystem:`com.widevine.alpha`,video:{contentType:t.contentType}}},n=await navigator.mediaCapabilities.decodingInfo(e);s.push({...n,keySystemAccess:n.keySystemAccess?.getConfiguration()})}catch{}c=this.getCurrentQualityLevelInfo()}catch{}t(!a.severity||a.severity===2?X.ERROR:X.NON_FATAL_ERROR,{currentTime:r,code:a.code,message:JSON.stringify({category:a.v,code:a.code,severity:a.severity,handled:a.handled,timestamp:i.timestamp,extra_data:o,media_capabilities:s,selected_quality_info:c})})}}}));xe();var wn=class e{static{this.PAGE_LOAD_TYPE={FOREGROUND:1,BACKGROUND:2}}static{this.LICENSE_CALL_PENDING_TIMEOUT=200}static{this.PAGE_LOAD_TYPE_TIMEOUT=200}static{this.CAST_RECEIVER_CONFIG_MESSAGE=`CAST_RECEIVER_CONFIG_MESSAGE`}constructor(t){this.previousState=void 0,this.previousStateTimeStamp=new Date,this.firstPlayTimestamp=0,this.startupTime=0,this.pageLoadType=e.PAGE_LOAD_TYPE.FOREGROUND,this.droppedSampleFrames=0,this.autoplay=void 0,this.isCastClient=!1,this.isCastReceiver=!1,this.isAllowedToSendSamples=!1,this.samplesQueue=[],this.customEventHandler=(e,t)=>{this.sampleBuilder.sample.custom_event_data=JSON.stringify(t),this.sendAnalyticsRequestAndClearValues(e,{custom_event_data:JSON.stringify(t)})},this.customEventHandlerAsync=(e,t)=>new Promise((n,r)=>{let i=JSON.stringify(t);this.sendAnalyticsRequestAndClearValuesAsync(e,{custom_event_data:i}).then(e=>n(e)).catch(e=>r(e))}),this.getCurrentImpressionId=()=>this.sample.impressionId,this.setDroppedFrames=e=>{},this.register=async(e,t={})=>{t.starttime?t.starttime=p.convertEpochTime(t.starttime):t.starttime=p.getCurrentTimestamp();let{GumletStateMachine:n}=await Promise.resolve().then(()=>(Zt(),Jt));if(this.analyticsStateMachine=new n(this.stateMachineCallbacks,t),!e){let{HTML5Adapter:e}=await Promise.resolve().then(()=>(_n(),mn));return this.adapter=new e(this.mediaElement,this.record,this.analyticsStateMachine),this.analyticsStateMachine}if(we.isHlsjs(e)){let{HlsjsAdapter:t}=await Promise.resolve().then(()=>(bn(),vn));this.adapter=new t(e,this.record,this.analyticsStateMachine)}else if(we.isShaka(e)){let{ShakaAdapter:n}=await Promise.resolve().then(()=>(Cn(),xn));this.adapter=new n(e,this.record,this.analyticsStateMachine,t.mediaElement??null)}else{let{HTML5Adapter:t}=await Promise.resolve().then(()=>(_n(),mn));this.adapter=new t(e,this.record,this.analyticsStateMachine)}this.adapter||h.error(`Could not detect player.`)},this.registerHLSJSPlayer=async(e,t={})=>{t.starttime?t.starttime=p.convertEpochTime(t.starttime):t.starttime=p.getCurrentTimestamp();let{GumletStateMachine:n}=await Promise.resolve().then(()=>(Zt(),Jt));this.analyticsStateMachine=new n(this.stateMachineCallbacks,t);let{HlsjsAdapter:r}=await Promise.resolve().then(()=>(bn(),vn));this.adapter=new r(e,this.record,this.analyticsStateMachine)},this.registerShakaPlayer=async(e,t={})=>{t.starttime?t.starttime=p.convertEpochTime(t.starttime):t.starttime=p.getCurrentTimestamp();let{GumletStateMachine:n}=await Promise.resolve().then(()=>(Zt(),Jt));this.analyticsStateMachine=new n(this.stateMachineCallbacks,t);let{ShakaAdapter:r}=await Promise.resolve().then(()=>(Cn(),xn));this.adapter=new r(e,this.record,this.analyticsStateMachine,t.mediaElement)},this.registerHTML5Player=async(e,t={})=>{t.starttime?t.starttime=p.convertEpochTime(t.starttime):t.starttime=p.getCurrentTimestamp();let{GumletStateMachine:n}=await Promise.resolve().then(()=>(Zt(),Jt));this.analyticsStateMachine=new n(this.stateMachineCallbacks,t);let{HTML5Adapter:r}=await Promise.resolve().then(()=>(_n(),mn));this.adapter=new r(e,this.record,this.analyticsStateMachine)},this.registerReactNativeVideoPlayer=async e=>{e.starttime?e.starttime=p.convertEpochTime(e.starttime):e.starttime=p.getCurrentTimestamp();let{GumletStateMachine:t}=await Promise.resolve().then(()=>(Zt(),Jt));return this.analyticsStateMachine=new t(this.stateMachineCallbacks,e),this.analyticsStateMachine},this.record=(e,t)=>{t||={},this.analyticsStateMachine.callEvent(e,t,p.getCurrentTimestamp())},this.config=t,this.analyticsCall=new ye,this.castClient=new Te,this.castReceiver=new Ee,this.session=new Ut(t),this.sampleBuilder=new Wt(t,this.session),this.publisher=new Gt(this.analyticsCall,this.sampleBuilder),this.init(),this.setupSample(),this.setupStateMachineCallbacks()}init(){if(!this.isCastReceiver&&(this.config.property_id===``||!p.validString(this.config.property_id))){console.error(`Invalid analytics property_id provided`);return}h.setLogging(this.config.debug||!1),this.session.propertyId=this.config.property_id,typeof window<`u`&&window.parent!==void 0?this.session.pageURL=window.location===window.parent.location?document.location.href:document.referrer:this.config.page_url?this.session.pageURL=this.config.page_url:this.session.pageURL=null;let e=!!this.config.test,t=this.config.sessionID||null,n=this.config.userID||null,r=Object.hasOwn(this.config,`sendSessionRequest`)?this.config.sendSessionRequest:!0;this.session.setUserId(e,n),this.session.setSessionId(e,t,r),this.session.setPlayerInstanceId(this.config.getUUID),this.session.setPlaybackId(this.config.getUUID)}setConfigParameters(e=this.config){this.session.setConfigParameters(e)}updateCustomData(e){this.session.updateCustomData(e)}updateCustomUserData(e){this.session.updateCustomUserData(e)}updateCustomVideoData(e){this.session.updateCustomVideoData(e)}updateCustomPlayerData(e){this.session.updateCustomPlayerData(e)}get userId(){return this.session.userId}get sessionId(){return this.session.sessionId}get propertyId(){return this.session.propertyId}get playerData(){return this.session.playerData}get sessionData(){return this.session.sessionData}get playerInitCall(){return this.session.playerInitCall}get isMuted(){return this.sampleBuilder.isMuted}set isMuted(e){this.sampleBuilder.isMuted=e}get sample(){return this.sampleBuilder.sample}setupSample(){this.sampleBuilder.setupSample()}setDuration(e){this.sampleBuilder.setDuration(e)}setVideoData(e){this.sampleBuilder.setVideoData(e)}setPlaybackSettingsFromLoadedEvent(e){this.sampleBuilder.setPlaybackSettingsFromLoadedEvent(e)}setPlaybackWatchTime(e){this.sampleBuilder.setPlaybackWatchTime(e)}getPlaybackWatchTime(){return this.sampleBuilder.getPlaybackWatchTime()}getSample(e=null,t={}){let n=this.sampleBuilder.getSample(e,t);return n.millis_from_previous_event=this.getMillisFromPreviousState(),n.previous_event=this.previousState,n}setPlayerData(e){this.session.setPlayerData(e)}setSessionData(){this.session.setSessionData()}setPlaybackId(){this.session.setPlaybackId(this.config.getUUID)}setUserId(e=!1,t=null){this.session.setUserId(e,t)}setSessionId(e=!1,t=null,n=!0){this.session.setSessionId(e,t,n)}setPlayerInstanceId(){this.session.setPlayerInstanceId(this.config.getUUID)}sendAnalyticsRequest(e,t){this.publisher.sendRequest(e,t)}sendAnalyticsRequestAsync(e,t){return this.publisher.sendRequestAsync(e,t)}sendAnalyticsRequestAndClearValues(e=null,t={}){let n={millis_from_previous_event:this.getMillisFromPreviousState(),previous_event:this.previousState,...t};this.publisher.sendAndClear(e,n)}sendAnalyticsRequestAndClearValuesAsync(e=null,t={}){return this.publisher.sendAndClearAsync(e,t)}sendUnloadRequest(){this.publisher.sendUnload()}sendAnalyticsRequestSynchronous(){this.publisher.sendSynchronous()}getMillisFromPreviousState(){return new Date().getTime()-this.previousStateTimeStamp.getTime()}setState(e=void 0){e&&(this.previousState=e,this.previousStateTimeStamp=new Date)}getDroppedFrames(e){if(e!==void 0&&e!==0){let t=e-this.droppedSampleFrames;return this.droppedSampleFrames=e,t}return 0}setupStateMachineCallbacks(){this.stateMachineCallbacks={setup:(e,t,n,r)=>{h.log(`Setup Gumlet analytics `+this.analyticsVersion),this.setDuration(e),this.setVideoData(n);let i=0;r?.starttime&&(i=new Date().getTime()-r.starttime),this.sendAnalyticsRequestAndClearValues(g.SETUP,{millis_from_previous_event:i}),this.setState(g.SETUP)},ready:(e,t,n)=>{this.setDuration(e),this.setVideoData(n),this.setPlaybackSettingsFromLoadedEvent(n),this.sendAnalyticsRequestAndClearValues(g.PLAYER_READY),this.setState(g.PLAYER_READY),this.setPlayerData(n),this.playerInitCall.sendRequest(this.playerData,p.noOp)},loaded:(e,t,n,r=null)=>{this.setDuration(e),this.setVideoData(n),this.setPlaybackSettingsFromLoadedEvent(n);let i={};r!==null&&(i={millis_from_previous_event:r,previous_event:g.PLAYER_READY}),this.sendAnalyticsRequestAndClearValues(g.PLAYBACK_READY,i),r===null&&this.setState(g.PLAYBACK_READY)},startup:(e,t)=>{this.setDuration(e)},first_play:(e,t,n)=>{this.setDuration(e),this.setVideoData(n),this.setPlaybackSettingsFromLoadedEvent(n),this.sendAnalyticsRequestAndClearValues(g.PLAY),this.setState(g.PLAY),this.firstPlayTimestamp=new Date},play:(e,t,n)=>{this.setDuration(e),this.setVideoData(n),this.setPlaybackSettingsFromLoadedEvent(n),this.sendAnalyticsRequestAndClearValues(g.PLAY),this.setState(g.PLAY)},updateSample:e=>{this.setPlaybackSettingsFromLoadedEvent(e)},playing:(e,t,n)=>{this.setDuration(e),this.setVideoData(n),this.setPlaybackSettingsFromLoadedEvent(n),this.sendAnalyticsRequestAndClearValues(g.PLAYING),this.setState(g.PLAYING)},playback_started:(e,t,n)=>{this.setDuration(e),this.setVideoData(n),this.setPlaybackSettingsFromLoadedEvent(n);let r=new Date().getTime()-this.firstPlayTimestamp.getTime();this.sendAnalyticsRequestAndClearValues(g.PLAYBACK_STARTED,{millis_from_previous_event:r}),this.setState(g.PLAYBACK_STARTED)},playingAndBye:(e,t,n)=>{this.setDuration(e),this.setDroppedFrames(n),this.sendUnloadRequest()},heartbeat:(e,t,n)=>{this.setDuration(e),this.setVideoData(n),this.setPlaybackSettingsFromLoadedEvent(n),this.sendAnalyticsRequestAndClearValues(g.PLAYBACK_UPDATE),this.setState(g.PLAYBACK_UPDATE)},playbackWatchTime:e=>{this.setPlaybackWatchTime(e)},qualitychange:(e,t)=>{this.setDuration(e)},qualitychange_pause:(e,t)=>{this.setDuration(e)},qualitychange_rebuffering:(e,t)=>{this.setDuration(e)},videoChange:e=>{this.stateMachineCallbacks.setVideoTimeEndFromEvent(e),this.stateMachineCallbacks.setVideoTimeStartFromEvent(e),this.setPlaybackSettingsFromLoadedEvent(e)},audioChange:e=>{this.stateMachineCallbacks.setVideoTimeEndFromEvent(e),this.stateMachineCallbacks.setVideoTimeStartFromEvent(e)},pause:(e,t,n)=>{this.setDuration(e),this.setVideoData(n),this.setPlaybackSettingsFromLoadedEvent(n),this.sendAnalyticsRequestAndClearValues(g.PAUSE),this.setState(g.PAUSE)},start_rebuffer:(e,t,n,r=!1)=>{this.setDuration(e),this.setVideoData(n),this.setPlaybackSettingsFromLoadedEvent(n),r||this.sendAnalyticsRequestAndClearValues(g.START_REBUFFER),this.setState(g.START_REBUFFER)},end_rebuffer:(e,t,n,r=!1)=>{if(this.setDuration(e),this.setVideoData(n),this.setPlaybackSettingsFromLoadedEvent(n),!r)this.sendAnalyticsRequestAndClearValues(g.END_REBUFFER);else return this.getSample(g.END_REBUFFER);this.setState(g.END_REBUFFER)},playback_seeked:(e,t,n,r)=>{this.sendAnalyticsRequestAndClearValues(g.SEEKED,{from:e,to:t}),this.setState(g.SEEKED),this.setupSample(),r===`PAUSE`?(this.sendAnalyticsRequestAndClearValues(g.PAUSE,{millis_from_previous_event:n}),this.setState(g.PAUSE)):r===`PLAYING`&&(this.sendAnalyticsRequestAndClearValues(g.PLAYING,{millis_from_previous_event:n}),this.setState(g.PLAYING))},paused_seeking:(e,t,n)=>{this.setDuration(e)},play_seeking:p.noOp,end_play_seeking:(e,t,n)=>{this.setDuration(e)},rebuffering:(e,t,n)=>{this.setDuration(e)},error:e=>{this.setPlaybackSettingsFromLoadedEvent(e),this.stateMachineCallbacks.setVideoTimeEndFromEvent(e),this.stateMachineCallbacks.setVideoTimeStartFromEvent(e),this.sendAnalyticsRequestAndClearValues(g.ERROR,{error_code:e&&e.code,error:e&&e.message}),this.setState(g.ERROR),this.setupSample()},error_recovered:(e,t,n)=>{this.setPlaybackSettingsFromLoadedEvent(n),this.stateMachineCallbacks.setVideoTimeEndFromEvent(n),this.stateMachineCallbacks.setVideoTimeStartFromEvent(n),this.sendAnalyticsRequestAndClearValues(g.ERROR_RECOVERED,{})},end:(e,t,n)=>{this.setPlaybackId(),this.setDuration(e),this.sendAnalyticsRequestAndClearValues(g.END),this.setState(g.END)},ad:(e,t,n)=>{this.setDuration(e),this.setDroppedFrames(n)},mute:(e,t)=>{this.isMuted=!0,this.setPlaybackSettingsFromLoadedEvent(t),this.sendAnalyticsRequestAndClearValues(g.MUTE)},unMute:(e,t)=>{this.isMuted=!1,this.setPlaybackSettingsFromLoadedEvent(t),this.sendAnalyticsRequestAndClearValues(g.UNMUTE)},muting_ready:p.noOp,muting_play:p.noOp,muting_pause:p.noOp,setVideoTimeEndFromEvent:e=>{},setVideoTimeStartFromEvent:e=>{},startCasting:(t,n)=>{if(n&&n.resuming){this.isAllowedToSendSamples=!1,h.warning(`Player started casting but a session is already casting!`);return}this.isCastClient=!0,this.isAllowedToSendSamples=!1;let{domain:r,path:i,language:a,userAgent:o,userId:s,impressionId:c}=this.sample,l={type:e.CAST_RECEIVER_CONFIG_MESSAGE,data:{config:this.config,userId:s,domain:r,path:i,language:a,userAgent:o,impressionId:c}};this.castClient.setUp(),this.castClient.sendMessage(l)},casting:()=>{this.isCastClient=!1,this.samplesQueue=[],this.isAllowedToSendSamples=!0},source_changing:()=>{},resetSessionExpiry:()=>{this.session.resetSessionExpiry()}}}};let Q=`[GumletInsights]`;var Tn=class{constructor(e){if(this.analytics_=null,this.ready_=!1,this.attached_=!1,!e||!p.validString(e.property_id)||e.property_id===``){console.error(`${Q} A valid property_id is required. No analytics events will be sent until the SDK is re-constructed with a valid config.`);return}this.analytics_=new wn(e),this.ready_=!0}async attach(e,t={}){if(!this.ready_||!this.analytics_){console.error(`${Q} attach() called but the SDK is not initialized. Check that you passed a valid property_id to the constructor.`);return}this.attached_&&(console.warn(`${Q} attach() called while a player is already attached. Detaching the previous player first.`),this.detach());let n=t.mediaElement??null;if(n!==null&&!this.isHTMLVideoElement_(n)){console.error(`${Q} opts.mediaElement must be an HTMLVideoElement, got: ${Object.prototype.toString.call(n)}`);return}if(e==null){if(!n){console.error(`${Q} HTML5 mode requires opts.mediaElement (an HTMLVideoElement). Pass the <video> element as opts.mediaElement, or pass it directly as the player argument.`);return}}else if(Ce(e)){if(!this.isValidHlsPlayer_(e)){console.error(`${Q} HLS.js player is not in a valid state. The player may have been destroyed. Create a new Hls() instance before attaching.`);return}}else if(Se(e)){let t=typeof e.getMediaElement==`function`?e.getMediaElement():null;if(!n&&!t){console.error(`${Q} Shaka Player requires opts.mediaElement — pass the HTMLVideoElement that Shaka is rendering into.`);return}if(!this.isValidShakaPlayer_(e)){console.error(`${Q} Shaka Player is not in a valid state. The player may have been destroyed. Create a new shaka.Player() before attaching.`);return}}else if(!this.isHTMLVideoElement_(e)){console.error(`${Q} Unrecognized player type (${Object.prototype.toString.call(e)}). Supported players: HLS.js (Hls instance), Shaka Player (shaka.Player instance), HTMLVideoElement, or null/undefined (HTML5 mode with opts.mediaElement).`);return}await this.analytics_.register(e,{...t,mediaElement:n}),this.attached_=!0}detach(){this.attached_&&=(this.analytics_?.adapter?.destroy?.(),!1)}get isAttached(){return this.attached_}getImpressionId(){return this.analytics_?.getCurrentImpressionId()??void 0}updateConfig(e){!this.ready_||!this.analytics_||(this.analytics_.updateCustomData(e),this.analytics_.updateCustomVideoData(e),this.analytics_.updateCustomUserData(e),this.analytics_.updateCustomPlayerData(e))}updateCustomData(e){this.analytics_?.updateCustomData(e)}updateCustomVideoData(e){this.analytics_?.updateCustomVideoData(e)}updateCustomUserData(e){this.analytics_?.updateCustomUserData(e)}updateCustomPlayerData(e){this.analytics_?.updateCustomPlayerData(e)}isHTMLVideoElement_(e){return typeof HTMLVideoElement<`u`?e instanceof HTMLVideoElement:typeof e==`object`&&!!e&&typeof e.play==`function`&&typeof e.pause==`function`&&typeof e.addEventListener==`function`}isValidHlsPlayer_(e){return typeof e==`object`&&!!e&&typeof e.loadSource==`function`&&typeof e.attachMedia==`function`&&typeof e.destroy==`function`}isValidShakaPlayer_(e){return typeof e!=`object`||!e?!1:typeof e.isDestroyed==`function`?!e.isDestroyed():typeof e.load==`function`&&typeof e.unload==`function`&&typeof e.addEventListener==`function`}};let En={CLOUDFLARE:`cloudflare`,AKAMAI:`akamai`,FASTLY:`fastly`,MAXCDN:`maxcdn`,CLOUDFRONT:`cloudfront`,CHINACACHE:`chinacache`,BITGRAVITY:`bitgravity`};pn(),qt();let $,Dn=(e,t={})=>$.register(e,t),On=(e,t={})=>$.registerHLSJSPlayer(e,t),kn=(e,t={})=>$.registerShakaPlayer(e,t),An=(e,t={})=>$.registerHTML5Player(e,t),jn=(e,t={})=>$.registerReactNativeVideoPlayer(e,t),Mn=()=>$.getCurrentImpressionId(),Nn=()=>$.analyticsStateMachine,Pn=e=>$.updateCustomData(e),Fn=e=>$.updateCustomVideoData(e),In=e=>$.updateCustomUserData(e),Ln=e=>$.updateCustomPlayerData(e),Rn=(e,t)=>$.customEventHandler(e,t),zn=(e,t)=>new Promise((n,r)=>{$.customEventHandlerAsync(e,t).then(e=>{n(e)}).catch(e=>{r(e)})}),Bn=e=>($=new wn(e),{register:Dn,registerHLSJSPlayer:On,registerShakaPlayer:kn,registerHTML5Player:An,registerReactNativeVideoPlayer:jn,getCurrentImpressionId:Mn,stateMachine:Nn,updateCustomData:Pn,updateCustomVideoData:Fn,updateCustomUserData:In,updateCustomPlayerData:Ln,setCustomData:$.setCustomData,setCustomDataOnce:$.setCustomDataOnce,customEventHandler:Rn,customEventHandlerAsync:zn});Bn.Players=Z,Bn.CdnProviders=En,Bn.gumletInsightsEvents=X,Bn.gumletSupportedPlayers=Z,typeof window<`u`&&(window.gumlet=window.gumlet||{},window.gumlet.insights=Bn,window.gumlet.GumletInsights=Tn,window.gumletInsightsEvents=X,window.gumletSupportedPlayers=Z);var Vn={insights:Bn,gumletInsightsEvents:X,gumletSupportedPlayers:Z};return e.GumletInsights=Tn,e.default=Vn,e})({});
package/dist/main.mjs ADDED
@@ -0,0 +1,9 @@
1
+
2
+ // Copyright (C) 2026, Gumlet Pte Ltd., All Rights Reserved
3
+
4
+ // This source code and its use and distribution, is subject to the terms
5
+ // and conditions of the applicable license agreement.
6
+
7
+ // @gumlet/insights-js-core version 2.0.0
8
+
9
+ import{i as e,n as t,t as n}from"./Logger-MEnh480a.mjs";import{t as r}from"./Players-jG9GBGw8.mjs";import{t as i}from"./Events-CULxdRMS.mjs";const a=e=>e!==void 0&&typeof e==`string`,o=e=>e!==void 0&&typeof e==`boolean`,s=e=>e!==void 0&&typeof e==`number`,c=e=>e.replace(/\/$/g,``),l=e=>(e*=1e3,Math.round(e)),u=e=>{let t=e.toString().length;return t===13?e:e*10**(13-t)},ee=()=>Date.now(),te=e=>ee()-e,ne=()=>{if(crypto&&crypto.randomUUID)return crypto.randomUUID();let e=new Uint8Array(16);crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=[...e].map(e=>e.toString(16).padStart(2,`0`));return t.slice(0,4).join(``)+`-`+t.slice(4,6).join(``)+`-`+t.slice(6,8).join(``)+`-`+t.slice(8,10).join(``)+`-`+t.slice(10,16).join(``)},d=e=>{let t=`${e}=`,n=[];try{n=document.cookie.split(`;`)}catch{return``}let r=null;for(let e=0;e<n.length;e++){let i=n[e];for(;i.charAt(0)===` `;)i=i.substring(1);i.indexOf(t)===0&&(r=i.substring(t.length,i.length))}if(!r){try{r=localStorage.getItem(e)}catch{return``}let t=null;if(r)try{t=JSON.parse(r)}catch{return``}else return``;let n=null;if(t.expires)n=new Date(t.expires);else return``;if(Object.prototype.toString.call(n)===`[object Date]`){if(!(n instanceof Date&&!isNaN(n.getTime())))return``}else return``;if(n.getTime()>new Date().getTime())r=t.value?t.value:``;else return``}return r},re=(e,t=30,n=null)=>{let r=new Date;r.setTime(r.getTime()+t*60*1e3);let i=n||ne();try{document.cookie=`${e}=${i}; expires=${r.toUTCString()}; path=/`,localStorage.setItem(e,JSON.stringify({expires:r.getTime(),value:i}))}catch{}return i},ie=()=>{},ae=(e,t)=>{let n=0,r;return()=>n>=t?r:(r=e.apply(null,arguments),n++,r)},oe=e=>ae(e,1),se=()=>{let e=[`webkit`,`moz`,`ms`,`o`];if(`hidden`in document)return`hidden`;for(let t=0;t<e.length;t++)if(`${e[t]}Hidden`in document)return`${e[t]}Hidden`;return null},ce=e=>typeof e==`object`?JSON.stringify(e):typeof e==`function`?ce(e()):e===void 0||typeof e==`string`?e:String(e);var f={validString:a,validBoolean:o,validNumber:s,sanitizePath:c,calculateTime:l,getCurrentTimestamp:ee,getDurationFromTimestampToNow:te,uuidv4:ne,getCookie:d,setCookie:re,noOp:ie,times:ae,once:oe,getHiddenProp:se,getCustomDataString:ce,jsonToQueryString:e=>`?`+Object.keys(e).map(t=>encodeURIComponent(t)+`=`+encodeURIComponent(e[t])).join(`&`),currentDateTimeFormatString:()=>new Date().toISOString(),convertEpochTime:u};function le(e){e.z=Date.now()/1e3;let t=[void 0,null,!1];Object.keys(e).forEach(n=>{t.indexOf(e[n])!==-1&&delete e[n]}),Object.keys(e).forEach(t=>{Number.isNaN(e[t])&&delete e[t]})}var ue=class{get(e,t,n,r=!0){le(t);let i=f.jsonToQueryString(t);e+=i,fetch(e,{method:`GET`,keepalive:r===!1}).then(e=>e.text()).then(e=>{e&&e.length>0&&n(e)}).catch(()=>{})}asyncGet(e,t){return new Promise((n,r)=>{le(t);let i=f.jsonToQueryString(t);e+=i,fetch(e,{method:`GET`}).then(e=>e.ok?e.text():Promise.reject({status:e.status,statusText:e.statusText})).then(e=>n(e)).catch(e=>{e&&typeof e.status==`number`?r(e):r({status:0,statusText:``})})})}},de=class e extends ue{constructor(...t){super(...t),this.sendRequest=function(t,n){t.event_family=`session_event`,this.get(e.analyticsServerUrl,t,n)},this.sendRequestAsync=function(t){return t.event_family=`session_event`,new Promise((n,r)=>{this.asyncGet(e.analyticsServerUrl,t).then(e=>{n(e)}).catch(e=>{r(e)})})},this.sendRequestSynchronous=function(t,n){t.event_family=`session_event`,this.get(e.analyticsServerUrl,t,n,!1)},this.getAnalyticsServerUrl=()=>e.analyticsServerUrl}static{this.analyticsServerUrl=t}};function fe(e){return typeof window>`u`||!window.shaka?!1:typeof shaka.Player==`function`&&e?.constructor===shaka.Player}function pe(e){return typeof window>`u`||!window.Hls?!1:typeof Hls==`function`&&e?.constructor===Hls}const me={isShaka:fe,isHlsjs:pe};var he=class{setUp(){n.log(`setting up cast session`),this.castSession=cast.framework.CastContext.getInstance().getCurrentSession(),this.addMessageListener()}addMessageListener(){let t=this.castSession.getApplicationMetadata();if(!t||t.namespaces.indexOf(`urn:x-cast:com.gumlet.ingest.cast`)<0){n.log(`No analytics on chrome cast receiver enabled!`);return}n.log(`adding message listener`),this.castSession.addMessageListener(e,(e,t)=>{n.log(`Received: ${e} ${t}`);try{let e=JSON.parse(t);this.handleReceiverMessage(e)}catch{n.error(`Message parsing failed ${t}`)}})}handleReceiverMessage(e){n.log(e)}sendMessage(t){let r=this.castSession.getApplicationMetadata();if(!r||r.namespaces.indexOf(`urn:x-cast:com.gumlet.ingest.cast`)<0){n.log(`No analytics on chrome cast receiver enabled!`);return}n.log(`Sending message: ${JSON.stringify(t)}`),this.castSession.sendMessage(e,t)}},ge=class{setUp(){this.messageBus=cast.receiver.CastReceiverManager.getInstance().getCastMessageBus(e,cast.receiver.CastMessageBus.MessageType.JSON),n.log(this.messageBus),this.messageBus.onMessage=e=>{n.log(`Received message from cast client: ${JSON.stringify(e)}`);let t=e.data;this.handleClientMessage(t)}}setCallback(e){this.callback=e}handleClientMessage(e){this.callback(e)}sendMessage(e){this.messageBus.broadcast(e)}};const p={SETUP:`event_setup`,PLAYER_READY:`event_player_ready`,PLAYBACK_READY:`event_playback_ready`,PLAYBACK_STARTED:`event_playback_started`,PAUSE:`event_pause`,PLAY:`event_play`,PLAYING:`event_playing`,PLAYBACK_UPDATE:`event_playback_update`,END:`event_ended`,MUTE:`event_muted`,UNMUTE:`event_unmute`,SEEKED:`event_seeked`,START_REBUFFER:`event_rebuffer_start`,END_REBUFFER:`event_rebuffer_end`,ERROR:`event_error`,ERROR_RECOVERED:`event_error_recovered`};var _e=class e extends ue{constructor(...t){super(...t),this.sendRequest=function(t,n){t.event_family=`session`,this.get(e.analyticsServerUrl,t,n)},this.sendRequestSynchronous=function(t,n){t.event_family=`session`,this.get(e.analyticsServerUrl,t,n,!1)},this.getAnalyticsServerUrl=()=>e.analyticsServerUrl}static{this.analyticsServerUrl=t}},ve=class e extends ue{constructor(...t){super(...t),this.sendRequest=function(t,n){t.event_family=`player_init`,this.get(e.analyticsServerUrl,t,n)},this.sendRequestSynchronous=function(t,n){t.event_family=`player_init`,this.get(e.analyticsServerUrl,t,n,!1)},this.getAnalyticsServerUrl=()=>e.analyticsServerUrl}static{this.analyticsServerUrl=t}};const ye=()=>{let e=window.navigator.userAgent;return/(tablet|ipad|playbook|silk)|(android(?!.*mobi))/i.test(e)?`tablet`:/Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Kindle|Silk-Accelerated|(hpw|web)OS|Opera M(obi|ini)/.test(e)?`mobile`:`desktop`};var be=`2.0.9`,xe=500,Se=`user-agent`,m=``,Ce=`?`,h={FUNCTION:`function`,OBJECT:`object`,STRING:`string`,UNDEFINED:`undefined`},g=`browser`,_=`cpu`,v=`device`,y=`engine`,b=`os`,x=`result`,S=`name`,C=`type`,w=`vendor`,T=`version`,E=`architecture`,we=`major`,D=`model`,Te=`console`,O=`mobile`,k=`tablet`,A=`smarttv`,j=`wearable`,Ee=`xr`,De=`embedded`,Oe=`fetcher`,M=`inapp`,ke=`brands`,N=`formFactors`,Ae=`fullVersionList`,P=`platform`,je=`platformVersion`,Me=`bitness`,F=`sec-ch-ua`,Ne=F+`-full-version-list`,Pe=F+`-arch`,Fe=F+`-`+Me,Ie=F+`-form-factors`,Le=F+`-`+O,Re=F+`-`+D,ze=F+`-`+P,Be=ze+`-version`,Ve=[ke,Ae,O,D,P,je,E,N,Me],He=`Amazon`,I=`Apple`,Ue=`ASUS`,We=`BlackBerry`,L=`Google`,Ge=`Huawei`,Ke=`Lenovo`,qe=`Honor`,Je=`LG`,Ye=`Microsoft`,Xe=`Motorola`,Ze=`Nvidia`,Qe=`OnePlus`,$e=`OPPO`,et=`Samsung`,tt=`Sharp`,nt=`Sony`,rt=`Xiaomi`,it=`Zebra`,at=`Chrome`,ot=`Chromium`,R=`Chromecast`,st=`Edge`,ct=`Firefox`,z=`Opera`,lt=`Facebook`,ut=`Sogou`,B=`Mobile `,V=` Browser`,dt=`Windows`,H=typeof window!==h.UNDEFINED&&window.navigator?window.navigator:void 0,U=H&&H.userAgentData?H.userAgentData:void 0,ft=function(e,t){var n={},r=t;if(!ht(t))for(var i in r={},t)for(var a in t[i])r[a]=t[i][a].concat(r[a]?r[a]:[]);for(var o in e)n[o]=r[o]&&r[o].length%2==0?r[o].concat(e[o]):e[o];return n},pt=function(e){for(var t={},n=0;n<e.length;n++)t[e[n].toUpperCase()]=e[n];return t},mt=function(e,t){if(typeof e===h.OBJECT&&e.length>0){for(var n in e)if(W(t)==W(e[n]))return!0;return!1}return gt(e)?W(t)==W(e):!1},ht=function(e,t){for(var n in e)return/^(browser|cpu|device|engine|os)$/.test(n)||(t?ht(e[n]):!1)},gt=function(e){return typeof e===h.STRING},_t=function(e){if(e){for(var t=[],n=K(/\\?\"/g,e).split(`,`),r=0;r<n.length;r++)if(n[r].indexOf(`;`)>-1){var i=bt(n[r]).split(`;v=`);t[r]={brand:i[0],version:i[1]}}else t[r]=bt(n[r]);return t}},W=function(e){return gt(e)?e.toLowerCase():e},vt=function(e){return gt(e)?K(/[^\d\.]/g,e).split(`.`)[0]:void 0},G=function(e){for(var t in e)if(e.hasOwnProperty(t)){var n=e[t];typeof n==h.OBJECT&&n.length==2?this[n[0]]=n[1]:this[n]=void 0}return this},K=function(e,t){return gt(t)?t.replace(e,m):t},yt=function(e){return K(/\\?\"/g,e)},bt=function(e,t){return e=K(/^\s\s*/,String(e)),typeof t===h.UNDEFINED?e:e.substring(0,t)},xt=function(e,t){if(!(!e||!t))for(var n=0,r,i,a,o,s,c;n<t.length&&!s;){var l=t[n],u=t[n+1];for(r=i=0;r<l.length&&!s&&l[r];)if(s=l[r++].exec(e),s)for(a=0;a<u.length;a++)c=s[++i],o=u[a],typeof o===h.OBJECT&&o.length>0?o.length===2?typeof o[1]==h.FUNCTION?this[o[0]]=o[1].call(this,c):this[o[0]]=o[1]:o.length>=3&&(typeof o[1]===h.FUNCTION&&!(o[1].exec&&o[1].test)?o.length>3?this[o[0]]=c?o[1].apply(this,o.slice(2)):void 0:this[o[0]]=c?o[1].call(this,c,o[2]):void 0:o.length==3?this[o[0]]=c?c.replace(o[1],o[2]):void 0:o.length==4?this[o[0]]=c?o[3].call(this,c.replace(o[1],o[2])):void 0:o.length>4&&(this[o[0]]=c?o[3].apply(this,[c.replace(o[1],o[2])].concat(o.slice(4))):void 0)):this[o]=c||void 0;n+=2}},q=function(e,t){for(var n in t)if(typeof t[n]===h.OBJECT&&t[n].length>0){for(var r=0;r<t[n].length;r++)if(mt(t[n][r],e))return n===Ce?void 0:n}else if(mt(t[n],e))return n===Ce?void 0:n;return t.hasOwnProperty(`*`)?t[`*`]:e},St={ME:`4.90`,"NT 3.51":`3.51`,"NT 4.0":`4.0`,2e3:[`5.0`,`5.01`],XP:[`5.1`,`5.2`],Vista:`6.0`,7:`6.1`,8:`6.2`,"8.1":`6.3`,10:[`6.4`,`10.0`],NT:``},Ct={embedded:`Automotive`,mobile:`Mobile`,tablet:[`Tablet`,`EInk`],smarttv:`TV`,wearable:`Watch`,xr:[`VR`,`XR`],"?":[`Desktop`,`Unknown`],"*":void 0},wt={Chrome:`Google Chrome`,Edge:`Microsoft Edge`,"Edge WebView2":`Microsoft Edge WebView2`,"Chrome WebView":`Android WebView`,"Chrome Headless":`HeadlessChrome`,"Huawei Browser":`HuaweiBrowser`,"MIUI Browser":`Miui Browser`,"Opera Mobi":`OperaMobile`,Yandex:`YaBrowser`},Tt={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[T,[S,B+`Chrome`]],[/webview.+edge\/([\w\.]+)/i],[T,[S,st+` WebView`]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[T,[S,`Edge`]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[S,T],[/opios[\/ ]+([\w\.]+)/i],[T,[S,z+` Mini`]],[/\bop(?:rg)?x\/([\w\.]+)/i],[T,[S,z+` GX`]],[/\bopr\/([\w\.]+)/i],[T,[S,z]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[T,[S,`Baidu`]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[T,[S,`Maxthon`]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(atlas|flock|rockmelt|midori|epiphany|silk|skyfire|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon|otter|dooble|(?:hi|lg |ovi|qute)browser|palemoon)\/v?([-\w\.]+)/i,/(brave)(?: chrome)?\/([\d\.]+)/i,/(aloha|heytap|ovi|115|surf|qwant)browser\/([\d\.]+)/i,/(qwant)(?:ios|mobile)\/([\d\.]+)/i,/(ecosia|weibo)(?:__| \w+@)([\d\.]+)/i],[S,T],[/quark(?:pc)?\/([-\w\.]+)/i],[T,[S,`Quark`]],[/\bddg\/([\w\.]+)/i],[T,[S,`DuckDuckGo`]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[T,[S,`UCBrowser`]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[T,[S,`WeChat`]],[/konqueror\/([\w\.]+)/i],[T,[S,`Konqueror`]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[T,[S,`IE`]],[/ya(?:search)?browser\/([\w\.]+)/i],[T,[S,`Yandex`]],[/slbrowser\/([\w\.]+)/i],[T,[S,`Smart `+Ke+V]],[/(av(?:ast|g|ira))\/([\w\.]+)/i],[[S,/(.+)/,`$1 Secure`+V],T],[/norton\/([\w\.]+)/i],[T,[S,`Norton Private`+V]],[/\bfocus\/([\w\.]+)/i],[T,[S,ct+` Focus`]],[/ mms\/([\w\.]+)$/i],[T,[S,z+` Neon`]],[/ opt\/([\w\.]+)$/i],[T,[S,z+` Touch`]],[/coc_coc\w+\/([\w\.]+)/i],[T,[S,`Coc Coc`]],[/dolfin\/([\w\.]+)/i],[T,[S,`Dolphin`]],[/coast\/([\w\.]+)/i],[T,[S,z+` Coast`]],[/miuibrowser\/([\w\.]+)/i],[T,[S,`MIUI`+V]],[/fxios\/([\w\.-]+)/i],[T,[S,B+ct]],[/\bqihoobrowser\/?([\w\.]*)/i],[T,[S,`360`]],[/\b(qq)\/([\w\.]+)/i],[[S,/(.+)/,`$1Browser`],T],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[S,/(.+)/,`$1`+V],T],[/samsungbrowser\/([\w\.]+)/i],[T,[S,et+` Internet`]],[/metasr[\/ ]?([\d\.]+)/i],[T,[S,ut+` Explorer`]],[/(sogou)mo\w+\/([\d\.]+)/i],[[S,ut+` Mobile`],T],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[S,T],[/(lbbrowser|luakit|rekonq|steam(?= (clie|tenf|gameo)))/i],[S],[/ome\/([\w\.]+).+(iron(?= saf)|360(?=[es]e$))/i],[T,S],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[S,lt],T,[C,M]],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/(daum)apps[\/ ]([\w\.]+)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(bing)(?:web|sapphire)\/([\w\.]+)/i,/(instagram|snapchat|klarna)[\/ ]([-\w\.]+)/i],[S,T,[C,M]],[/\bgsa\/([\w\.]+) .*safari\//i],[T,[S,`GSA`],[C,M]],[/(?:musical_ly|trill)(?:.+app_?version\/|_)([\w\.]+)/i],[T,[S,`TikTok`],[C,M]],[/\[(linkedin)app\]/i],[S,[C,M]],[/(zalo(?:app)?)[\/\sa-z]*([\w\.-]+)/i],[[S,/(.+)/,`Zalo`],T,[C,M]],[/(chromium)[\/ ]([-\w\.]+)/i],[S,T],[/ome-(lighthouse)$/i],[S,[C,Oe]],[/headlesschrome(?:\/([\w\.]+)| )/i],[T,[S,at+` Headless`]],[/wv\).+chrome\/([\w\.]+).+edgw\//i],[T,[S,st+` WebView2`]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[S,at+` WebView`],T],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[T,[S,`Android`+V]],[/chrome\/([\w\.]+) mobile/i],[T,[S,B+`Chrome`]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[S,T],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[T,[S,B+`Safari`]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[S,B+`Safari`]],[/version\/([\w\.\,]+) .*(safari)/i],[T,S],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[S,[T,`1`]],[/(webkit|khtml)\/([\w\.]+)/i],[S,T],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[S,B+ct],T],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[S,`Netscape`],T],[/(wolvic|librewolf)\/([\w\.]+)/i],[S,T],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[T,[S,ct+` Reality`]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+(?= .+rv\:.+gecko\/\d+)|[0-4][\w\.]+(?!.+compatible))/i,/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[S,[T,/_/g,`.`]],[/(cobalt)\/([\w\.]+)/i],[S,[T,/[^\d\.]+./,m]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[E,`amd64`]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[E,`ia32`]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[E,`arm64`]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[E,`armhf`]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[E,`arm`]],[/ sun4\w[;\)]/i],[[E,`sparc`]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i,/((ppc|powerpc)(64)?)( mac|;|\))/i,/(?:osf1|[freopnt]{3,4}bsd) (alpha)/i],[[E,/ower/,m,W]],[/mc680.0/i],[[E,`68k`]],[/winnt.+\[axp/i],[[E,`alpha`]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[D,[w,et],[C,k]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr]|browser)[-\w]+)/i,/sec-(sgh\w+)/i],[D,[w,et],[C,O]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)[\/\);]/i],[D,[w,I],[C,O]],[/\b(?:ios|apple\w+)\/.+[\(\/](ipad)/i,/\b(ipad)[\d,]*[;\] ].+(mac |i(pad)?)os/i],[D,[w,I],[C,k]],[/(macintosh);/i],[D,[w,I]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[D,[w,tt],[C,O]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[D,[w,qe],[C,k]],[/honor([-\w ]+)[;\)]/i],[D,[w,qe],[C,O]],[/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i],[D,[w,Ge],[C,k]],[/(?:huawei) ?([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][\dc][adnt]?)\b(?!.+d\/s)/i],[D,[w,Ge],[C,O]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b(?:xiao)?((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[D,/_/g,` `],[w,rt],[C,k]],[/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/oid[^\)]+; (redmi[\-_ ]?(?:note|k)?[\w_ ]+|m?[12]\d[01]\d\w{3,6}|poco[\w ]+|(shark )?\w{3}-[ah]0|qin ?[1-3](s\+|ultra| pro)?)( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note|max|cc)?[_ ]?(?:\d{0,2}\w?)[_ ]?(?:plus|se|lite|pro)?( 5g|lte)?)(?: bui|\))/i,/ ([\w ]+) miui\/v?\d/i],[[D,/_/g,` `],[w,rt],[C,O]],[/droid.+; (cph2[3-6]\d[13579]|((gm|hd)19|(ac|be|in|kb)20|(d[en]|eb|le|mt)21|ne22)[0-2]\d|p[g-l]\w[1m]10)\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[D,[w,Qe],[C,O]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[D,[w,$e],[C,O]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[D,[w,q,{OnePlus:[`203`,`304`,`403`,`404`,`413`,`415`],"*":$e}],[C,k]],[/(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i],[D,[w,`BLU`],[C,O]],[/; vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[D,[w,`Vivo`],[C,O]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[D,[w,`Realme`],[C,O]],[/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i],[D,[w,Ke],[C,k]],[/lenovo[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i],[D,[w,Ke],[C,O]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ]([\w\s]+)(\)| bui)/i,/((?:moto(?! 360)[-\w\(\) ]+|xt\d{3,4}[cgkosw\+]?[-\d]*|nexus 6)(?= bui|\)))/i],[D,[w,Xe],[C,O]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[D,[w,Xe],[C,k]],[/\b(?:lg)?([vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[D,[w,Je],[C,k]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch|webos))(\w+)/i,/\blg-?([\d\w]+) bui/i],[D,[w,Je],[C,O]],[/(nokia) (t[12][01])/i],[w,D,[C,k]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*?))( bui|\)|;|\/)/i],[[D,/_/g,` `],[C,O],[w,`Nokia`]],[/(pixel (c|tablet))\b/i],[D,[w,L],[C,k]],[/droid.+;(?: google)? (g(01[13]a|020[aem]|025[jn]|1b60|1f8f|2ybb|4s1m|576d|5nz6|8hhn|8vou|a02099|c15s|d1yq|e2ae|ec77|gh2x|kv4x|p4bc|pj41|r83y|tt9q|ur25|wvk6)|pixel[\d ]*a?( pro)?( xl)?( fold)?( \(5g\))?)( bui|\))/i],[D,[w,L],[C,O]],[/(google) (pixelbook( go)?)/i],[w,D],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-\w\w\d\d)(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[D,[w,nt],[C,O]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[D,`Xperia Tablet`],[w,nt],[C,k]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[D,[w,He],[C,k]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[D,/(.+)/g,`Fire Phone $1`],[w,He],[C,O]],[/(playbook);[-\w\),; ]+(rim)/i],[D,w,[C,k]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/(?:blackberry|\(bb10;) (\w+)/i],[D,[w,We],[C,O]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[D,[w,Ue],[C,k]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[D,[w,Ue],[C,O]],[/(nexus 9)/i],[D,[w,`HTC`],[C,k]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[w,[D,/_/g,` `],[C,O]],[/tcl (xess p17aa)/i,/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i],[D,[w,`TCL`],[C,k]],[/droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i],[D,[w,`TCL`],[C,O]],[/(itel) ((\w+))/i],[[w,W],D,[C,q,{tablet:[`p10001l`,`w7001`],"*":`mobile`}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[D,[w,`Acer`],[C,k]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[D,[w,`Meizu`],[C,O]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[D,[w,`Ulefone`],[C,O]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[D,[w,`Energizer`],[C,O]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[D,[w,`Cat`],[C,O]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[D,[w,`Smartfren`],[C,O]],[/droid.+; (a(in)?(0(15|59|6[35])|142)p?)/i],[D,[w,`Nothing`],[C,O]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[D,[w,`Archos`],[C,k]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[D,[w,`Archos`],[C,O]],[/; (n159v)/i],[D,[w,`HMD`],[C,O]],[/(imo) (tab \w+)/i,/(infinix|tecno) (x1101b?|p904|dp(7c|8d|10a)( pro)?|p70[1-3]a?|p904|t1101)/i],[w,D,[C,k]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (blu|hmd|imo|infinix|lava|oneplus|tcl|wiko)[_ ]([\w\+ ]+?)(?: bui|\)|; r)/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(oppo) ?([\w ]+) bui/i,/(hisense) ([ehv][\w ]+)\)/i,/droid[^;]+; (philips)[_ ]([sv-x][\d]{3,4}[xz]?)/i],[w,D,[C,O]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[w,D,[C,k]],[/(surface duo)/i],[D,[w,Ye],[C,k]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[D,[w,`Fairphone`],[C,O]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[D,[w,Ze],[C,k]],[/(sprint) (\w+)/i],[w,D,[C,O]],[/(kin\.[onetw]{3})/i],[[D,/\./g,` `],[w,Ye],[C,O]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[D,[w,it],[C,k]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[D,[w,it],[C,O]],[/(philips)[\w ]+tv/i,/smart-tv.+(samsung)/i],[w,[C,A]],[/hbbtv.+maple;(\d+)/i],[[D,/^/,`SmartTV`],[w,et],[C,A]],[/(vizio)(?: |.+model\/)(\w+-\w+)/i,/tcast.+(lg)e?. ([-\w]+)/i],[w,D,[C,A]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[w,Je],[C,A]],[/(apple) ?tv/i],[w,[D,I+` TV`],[C,A]],[/crkey.*devicetype\/chromecast/i],[[D,R+` Third Generation`],[w,L],[C,A]],[/crkey.*devicetype\/([^/]*)/i],[[D,/^/,`Chromecast `],[w,L],[C,A]],[/fuchsia.*crkey/i],[[D,R+` Nest Hub`],[w,L],[C,A]],[/crkey/i],[[D,R],[w,L],[C,A]],[/(portaltv)/i],[D,[w,lt],[C,A]],[/droid.+aft(\w+)( bui|\))/i],[D,[w,He],[C,A]],[/(shield \w+ tv)/i],[D,[w,Ze],[C,A]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[D,[w,tt],[C,A]],[/(bravia[\w ]+)( bui|\))/i],[D,[w,nt],[C,A]],[/(mi(tv|box)-?\w+) bui/i],[D,[w,rt],[C,A]],[/Hbbtv.*(technisat) (.*);/i],[w,D,[C,A]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[w,/.+\/(\w+)/,`$1`,q,{LG:`lge`}],[D,bt],[C,A]],[/(playstation \w+)/i],[D,[w,nt],[C,Te]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[D,[w,Ye],[C,Te]],[/(ouya)/i,/(nintendo) (\w+)/i,/(retroid) (pocket ([^\)]+))/i,/(valve).+(steam deck)/i,/droid.+; ((shield|rgcube|gr0006))( bui|\))/i],[[w,q,{Nvidia:`Shield`,Anbernic:`RGCUBE`,Logitech:`GR0006`}],D,[C,Te]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[D,[w,et],[C,j]],[/((pebble))app/i,/(asus|google|lg|oppo|xiaomi) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[w,D,[C,j]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[D,[w,$e],[C,j]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[D,[w,I],[C,j]],[/(opwwe\d{3})/i],[D,[w,Qe],[C,j]],[/(moto 360)/i],[D,[w,Xe],[C,j]],[/(smartwatch 3)/i],[D,[w,nt],[C,j]],[/(g watch r)/i],[D,[w,Je],[C,j]],[/droid.+; (wt63?0{2,3})\)/i],[D,[w,it],[C,j]],[/droid.+; (glass) \d/i],[D,[w,L],[C,Ee]],[/(pico) ([\w ]+) os\d/i],[w,D,[C,Ee]],[/(quest( \d| pro)?s?).+vr/i],[D,[w,lt],[C,Ee]],[/mobile vr; rv.+firefox/i],[[C,Ee]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[w,[C,De]],[/(aeobc)\b/i],[D,[w,He],[C,De]],[/(homepod).+mac os/i],[D,[w,I],[C,De]],[/windows iot/i],[[C,De]],[/droid.+; ([\w- ]+) (4k|android|smart|google)[- ]?tv/i],[D,[C,A]],[/\b((4k|android|smart|opera)[- ]?tv|tv; rv:|large screen[\w ]+safari)\b/i],[[C,A]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew|; hmsc).+?(mobile|vr|\d) safari/i],[D,[C,q,{mobile:`Mobile`,xr:`VR`,"*":k}]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[C,k]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[C,O]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[D,[w,`Generic`]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[T,[S,st+`HTML`]],[/(arkweb)\/([\w\.]+)/i],[S,T],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[T,[S,`Blink`]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links|dillo)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[S,T],[/ladybird\//i],[[S,`LibWeb`]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[T,S]],os:[[/(windows nt) (6\.[23]); arm/i],[[S,/N/,`R`],[T,q,St]],[/(windows (?:phone|mobile|iot))(?: os)?[\/ ]?([\d\.]*( se)?)/i,/(windows)[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i],[S,T],[/windows nt ?([\d\.\)]*)(?!.+xbox)/i,/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d\.;]*)/i],[[T,/(;|\))/g,``,q,St],[S,dt]],[/(windows ce)\/?([\d\.]*)/i],[S,T],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv|ios(?=.+ip(?:ad|hone)|.+apple ?tv)|ip(?:ad|hone)(?: |.+i(?:pad)?)os|apple ?tv.+ios)[\/ ]([\w\.]+)/i,/\btvos ?([\w\.]+)/i,/cfnetwork\/.+darwin/i],[[T,/_/g,`.`],[S,`iOS`]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i],[[S,`macOS`],[T,/_/g,`.`]],[/android ([\d\.]+).*crkey/i],[T,[S,R+` Android`]],[/fuchsia.*crkey\/([\d\.]+)/i],[T,[S,R+` Fuchsia`]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[T,[S,R+` SmartSpeaker`]],[/linux.*crkey\/([\d\.]+)/i],[T,[S,R+` Linux`]],[/crkey\/([\d\.]+)/i],[T,[S,R]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[T,S],[/(ubuntu) ([\w\.]+) like android/i],[[S,/(.+)/,`$1 Touch`],T],[/(harmonyos)[\/ ]?([\d\.]*)/i,/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen)\w*[-\/\.; ]?([\d\.]*)/i],[S,T],[/\(bb(10);/i],[T,[S,We]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[T,[S,`Symbian`]],[/mozilla\/[\d\.]+ \((?:mobile[;\w ]*|tablet|tv|[^\)]*(?:viera|lg(?:l25|-d300)|alcatel ?o.+|y300-f1)); rv:([\w\.]+)\).+gecko\//i],[T,[S,ct+` OS`]],[/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i,/webos(?:[ \/]?|\.tv-20(?=2[2-9]))(\d[\d\.]*)/i],[T,[S,`webOS`]],[/web0s;.+?(?:chr[o0]me|safari)\/(\d+)/i],[[T,q,{25:`120`,24:`108`,23:`94`,22:`87`,6:`79`,5:`68`,4:`53`,3:`38`,2:`538`,1:`537`,"*":`TV`}],[S,`webOS`]],[/watch(?: ?os[,\/ ]|\d,\d\/)([\d\.]+)/i],[T,[S,`watchOS`]],[/cros [\w]+(?:\)| ([\w\.]+)\b)/i],[T,[S,`Chrome OS`]],[/kepler ([\w\.]+); (aft|aeo)/i],[T,[S,`Vega OS`]],[/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) (\w+)/i,/(xbox); +xbox ([^\);]+)/i,/(pico) .+os([\w\.]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/linux.+(mint)[\/\(\) ]?([\w\.]*)/i,/(mageia|vectorlinux|fuchsia|arcaos|arch(?= ?linux))[;l ]([\d\.]*)/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire|knoppix)(?: gnu[\/ ]linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/\b(aix)[; ]([1-9\.]{0,4})/i,/(hurd|linux|morphos)(?: (?:arm|x86|ppc)\w*| ?)([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) ?(r\d)?/i],[S,T],[/(sunos) ?([\d\.]*)/i],[[S,`Solaris`],T],[/\b(beos|os\/2|amigaos|openvms|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[S,T]]},Et=(function(){var e={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}};return G.call(e.init,[[g,[S,T,we,C]],[_,[E]],[v,[C,D,w]],[y,[S,T]],[b,[S,T]]]),G.call(e.isIgnore,[[g,[T,we]],[y,[T]],[b,[T]]]),G.call(e.isIgnoreRgx,[[g,/ ?browser$/i],[b,/ ?os$/i]]),G.call(e.toString,[[g,[S,T]],[_,[E]],[v,[w,D]],[y,[S,T]],[b,[S,T]]]),e})(),Dt=function(e,t){var n=Et.init[t],r=Et.isIgnore[t]||0,i=Et.isIgnoreRgx[t]||0,a=Et.toString[t]||0;function o(){G.call(this,n)}return o.prototype.getItem=function(){return e},o.prototype.withClientHints=function(){return U?U.getHighEntropyValues(Ve).then(function(t){return e.setCH(new Ot(t,!1)).parseCH().get()}):e.parseCH().get()},o.prototype.withFeatureCheck=function(){return e.detectFeature().get()},t!=x&&(o.prototype.is=function(e){var t=!1;for(var n in this)if(this.hasOwnProperty(n)&&!mt(r,n)&&W(i?K(i,this[n]):this[n])==W(i?K(i,e):e)){if(t=!0,e!=h.UNDEFINED)break}else if(e==h.UNDEFINED&&t){t=!t;break}return t},o.prototype.toString=function(){var e=m;for(var t in a)typeof this[a[t]]!==h.UNDEFINED&&(e+=(e?` `:m)+this[a[t]]);return e||h.UNDEFINED}),o.prototype.then=function(e){var t=this,n=function(){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e])};n.prototype={is:o.prototype.is,toString:o.prototype.toString,withClientHints:o.prototype.withClientHints,withFeatureCheck:o.prototype.withFeatureCheck};var r=new n;return e(r),r},new o};function Ot(e,t){if(e||={},G.call(this,Ve),t)G.call(this,[[ke,_t(e[F])],[Ae,_t(e[Ne])],[O,/\?1/.test(e[Le])],[D,yt(e[Re])],[P,yt(e[ze])],[je,yt(e[Be])],[E,yt(e[Pe])],[N,_t(e[Ie])],[Me,yt(e[Fe])]]);else for(var n in e)this.hasOwnProperty(n)&&typeof e[n]!==h.UNDEFINED&&(this[n]=e[n])}function J(e,t,n,r){return G.call(this,[[`itemType`,e],[`ua`,t],[`uaCH`,r],[`rgxMap`,n],[`data`,Dt(this,e)]]),this}J.prototype.get=function(e){return e?this.data.hasOwnProperty(e)?this.data[e]:void 0:this.data},J.prototype.set=function(e,t){return this.data[e]=t,this},J.prototype.setCH=function(e){return this.uaCH=e,this},J.prototype.detectFeature=function(){if(H&&H.userAgent==this.ua)switch(this.itemType){case g:H.brave&&typeof H.brave.isBrave==h.FUNCTION&&this.set(S,`Brave`);break;case v:!this.get(C)&&U&&U[O]&&this.set(C,O),this.get(D)==`Macintosh`&&H&&typeof H.standalone!==h.UNDEFINED&&H.maxTouchPoints&&H.maxTouchPoints>2&&this.set(D,`iPad`).set(C,k);break;case b:!this.get(S)&&U&&U[P]&&this.set(S,U[P]);break;case x:var e=this.data,t=function(t){return e[t].getItem().detectFeature().get()};this.set(g,t(g)).set(_,t(_)).set(v,t(v)).set(y,t(y)).set(b,t(b))}return this},J.prototype.parseUA=function(){switch(this.itemType!=x&&xt.call(this.data,this.ua,this.rgxMap),this.itemType){case g:this.set(we,vt(this.get(T)));break;case b:if(this.get(S)==`iOS`&&this.get(T)==`18.6`){var e=/\) Version\/([\d\.]+)/.exec(this.ua);e&&parseInt(e[1].substring(0,2),10)>=26&&this.set(T,e[1])}break}return this},J.prototype.parseCH=function(){var e=this.uaCH,t=this.rgxMap;switch(this.itemType){case g:case y:var n=e[Ae]||e[ke],r;if(n)for(var i=0;i<n.length;i++){var a=n[i].brand||n[i],o=n[i].version;this.itemType==g&&!/not.a.brand/i.test(a)&&(!r||/Chrom/.test(r)&&a!=ot||r==st&&/WebView2/.test(a))&&(a=q(a,wt),r=this.get(S),r&&!/Chrom/.test(r)&&/Chrom/.test(a)||this.set(S,a).set(T,o).set(we,vt(o)),r=a),this.itemType==y&&a==ot&&this.set(T,o)}break;case _:var s=e[E];s&&(s&&e[Me]==`64`&&(s+=`64`),xt.call(this.data,s+`;`,t));break;case v:if(e[O]&&this.set(C,O),e[D]&&(this.set(D,e[D]),!this.get(C)||!this.get(w))){var c={};xt.call(c,`droid 9; `+e[D]+`)`,t),!this.get(C)&&c.type&&this.set(C,c.type),!this.get(w)&&c.vendor&&this.set(w,c.vendor)}if(e[N]){var l;if(typeof e[N]!=`string`)for(var u=0;!l&&u<e[N].length;)l=q(e[N][u++],Ct);else l=q(e[N],Ct);this.set(C,l)}break;case b:var ee=e[P];if(ee){var te=e[je];ee==dt&&(te=parseInt(vt(te),10)>=13?`11`:`10`),this.set(S,ee).set(T,te)}this.get(S)==dt&&e[D]==`Xbox`&&this.set(S,`Xbox`).set(T,void 0);break;case x:var ne=this.data,d=function(t){return ne[t].getItem().setCH(e).parseCH().get()};this.set(g,d(g)).set(_,d(_)).set(v,d(v)).set(y,d(y)).set(b,d(b))}return this};function Y(e,t,n){if(typeof e===h.OBJECT?(ht(e,!0)?(typeof t===h.OBJECT&&(n=t),t=e):(n=e,t=void 0),e=void 0):typeof e===h.STRING&&!ht(t,!0)&&(n=t,t=void 0),n)if(typeof n.append===h.FUNCTION){var r={};n.forEach(function(e,t){r[String(t).toLowerCase()]=e}),n=r}else{var i={};for(var a in n)n.hasOwnProperty(a)&&(i[String(a).toLowerCase()]=n[a]);n=i}if(!(this instanceof Y))return new Y(e,t,n).getResult();var o=typeof e===h.STRING?e:n&&n[Se]?n[Se]:H&&H.userAgent?H.userAgent:m,s=new Ot(n,!0),c=t?ft(Tt,t):Tt,l=function(e){return e==x?function(){return new J(e,o,c,s).set(`ua`,o).set(g,this.getBrowser()).set(_,this.getCPU()).set(v,this.getDevice()).set(y,this.getEngine()).set(b,this.getOS()).get()}:function(){return new J(e,o,c[e],s).parseUA().get()}};return G.call(this,[[`getBrowser`,l(g)],[`getCPU`,l(_)],[`getDevice`,l(v)],[`getEngine`,l(y)],[`getOS`,l(b)],[`getResult`,l(x)],[`getUA`,function(){return o}],[`setUA`,function(e){return gt(e)&&(o=bt(e,xe)),this}]]).setUA(o),this}Y.VERSION=be,Y.BROWSER=pt([S,T,we,C]),Y.CPU=pt([E]),Y.DEVICE=pt([D,w,C,Te,O,A,k,j,De]),Y.ENGINE=Y.OS=pt([S,T]);const X=new Y().getResult();var kt=class{constructor(e){this.SDKVersion=`1.0.0`,this.config=e,this.sessionCreationCall=new _e,this.playerInitCall=new ve,this.setConfigParameters()}setConfigParameters(e=this.config){this.customData1=f.getCustomDataString(e.customData1),this.customData2=f.getCustomDataString(e.customData2),this.customData3=f.getCustomDataString(e.customData3),this.customData4=f.getCustomDataString(e.customData4),this.customData5=f.getCustomDataString(e.customData5),this.customData6=f.getCustomDataString(e.customData6),this.customData7=f.getCustomDataString(e.customData7),this.customData8=f.getCustomDataString(e.customData8),this.customData9=f.getCustomDataString(e.customData9),this.customData10=f.getCustomDataString(e.customData10),this.customPlayerIntegrationVersion=f.getCustomDataString(e.customPlayerIntegrationVersion),this.customPlayerName=f.getCustomDataString(e.customPlayerName),this.customPageType=f.getCustomDataString(e.customPageType),this.customUserId=f.getCustomDataString(e.userId),this.userName=f.getCustomDataString(e.userName),this.userEMail=f.getCustomDataString(e.userEMail),this.userPhone=f.getCustomDataString(e.userPhone),this.userProfileImage=f.getCustomDataString(e.userProfileImage),this.userAddressLine1=f.getCustomDataString(e.userAddressLine1),this.userAddressLine2=f.getCustomDataString(e.userAddressLine2),this.userCity=f.getCustomDataString(e.userCity),this.userState=f.getCustomDataString(e.userState),this.userCountry=f.getCustomDataString(e.userCountry),this.userZipcode=f.getCustomDataString(e.userZipcode),this.customContentType=f.getCustomDataString(e.customContentType),this.customVideoDurationMillis=f.getCustomDataString(e.customVideoDurationMillis),this.customEncodingVariant=f.getCustomDataString(e.customEncodingVariant),this.customVideoLanguage=f.getCustomDataString(e.customVideoLanguage),this.customVideoId=f.getCustomDataString(e.customVideoId),this.customVideoSeries=f.getCustomDataString(e.customVideoSeries),this.customVideoProducer=f.getCustomDataString(e.customVideoProducer),this.customVideoTitle=f.getCustomDataString(e.customVideoTitle),this.customVideoVariantName=f.getCustomDataString(e.customVideoVariantName),this.customVideoVariant=f.getCustomDataString(e.customVideoVariant),this.SDKVersion=`1.0.0`,this.experimentName=e.experimentName}updateCustomData(e){this.customData1=f.getCustomDataString(e.customData1),this.customData2=f.getCustomDataString(e.customData2),this.customData3=f.getCustomDataString(e.customData3),this.customData4=f.getCustomDataString(e.customData4),this.customData5=f.getCustomDataString(e.customData5),this.customData6=f.getCustomDataString(e.customData6),this.customData7=f.getCustomDataString(e.customData7),this.customData8=f.getCustomDataString(e.customData8),this.customData9=f.getCustomDataString(e.customData9),this.customData10=f.getCustomDataString(e.customData10)}updateCustomUserData(e){this.customUserId=f.getCustomDataString(e.userId),this.userName=f.getCustomDataString(e.userName),this.userEMail=f.getCustomDataString(e.userEMail),this.userPhone=f.getCustomDataString(e.userPhone),this.userProfileImage=f.getCustomDataString(e.userProfileImage),this.userAddressLine1=f.getCustomDataString(e.userAddressLine1),this.userAddressLine2=f.getCustomDataString(e.userAddressLine2),this.userCity=f.getCustomDataString(e.userCity),this.userState=f.getCustomDataString(e.userState),this.userCountry=f.getCustomDataString(e.userCountry),this.userZipcode=f.getCustomDataString(e.userZipcode)}updateCustomVideoData(e){this.customContentType=f.getCustomDataString(e.customContentType),this.customVideoDurationMillis=f.getCustomDataString(e.customVideoDurationMillis),this.customEncodingVariant=f.getCustomDataString(e.customEncodingVariant),this.customVideoLanguage=f.getCustomDataString(e.customVideoLanguage),this.customVideoId=f.getCustomDataString(e.customVideoId),this.customVideoSeries=f.getCustomDataString(e.customVideoSeries),this.customVideoProducer=f.getCustomDataString(e.customVideoProducer),this.customVideoTitle=f.getCustomDataString(e.customVideoTitle),this.customVideoVariantName=f.getCustomDataString(e.customVideoVariantName),this.customVideoVariant=f.getCustomDataString(e.customVideoVariant)}updateCustomPlayerData(e){this.customPlayerIntegrationVersion=f.getCustomDataString(e.customPlayerIntegrationVersion),this.customPlayerName=f.getCustomDataString(e.customPlayerName),this.customPageType=f.getCustomDataString(e.customPageType)}setUserId(e=!1,t=null){if(t){this.userId=t;return}if(e){this.userId=f.uuidv4();return}let n=f.getCookie(`gumlet_user_id`);!n||n===``?this.userId=f.setCookie(`gumlet_user_id`,720*60):this.userId=n}setSessionId(e=!1,t=null,n=!0){if(t){this.sessionId=t,this.setSessionData(),n&&this.sessionCreationCall.sendRequest(this.sessionData,f.noOp);return}if(e){this.sessionId=f.uuidv4();return}let r=f.getCookie(`gumlet_session_id`);!r||r===``?(this.sessionId=f.setCookie(`gumlet_session_id`,30),this.setSessionData(),this.sessionCreationCall.sendRequest(this.sessionData,f.noOp)):(this.sessionId=r,this.setSessionData())}setPlayerInstanceId(e){this.playerInstanceId=e?e():f.uuidv4(),this.setPlayerData()}setPlaybackId(e){this.playbackId=e?e():f.uuidv4()}resetSessionExpiry(){this.config.test||this.config.sessionID||(f.setCookie(`gumlet_session_id`,30,this.sessionId),f.setCookie(`gumlet_user_id`,720*60,this.userId))}setSessionData(){if(this.sessionData={session_id:this.sessionId,property_id:this.propertyId,user_id:this.userId,custom_user_id:this.customUserId,custom_data_1:this.customData1,custom_data_2:this.customData2,custom_data_3:this.customData3,custom_data_4:this.customData4,custom_data_5:this.customData5,custom_data_6:this.customData6,custom_data_7:this.customData7,custom_data_8:this.customData8,custom_data_9:this.customData9,custom_data_10:this.customData10,user_name:this.userName,user_email:this.userEMail,user_phone:this.userPhone,user_profile_image:this.userProfileImage,user_address_line1:this.userAddressLine1,user_address_line2:this.userAddressLine2,user_city:this.userCity,user_state:this.userState,user_country:this.userCountry,user_zipcode:this.userZipcode,viewer_client_version:this.SDKVersion},this.config.deviceData){let e=this.config.deviceData;this.sessionData.meta_device_name=e.meta_device_name,this.sessionData.meta_device_manufacturer=e.meta_device_manufacturer,this.sessionData.meta_operating_system_version=e.meta_operating_system_version,this.sessionData.meta_operating_system=e.meta_operating_system,this.sessionData.meta_browser=e.meta_browser,this.sessionData.meta_device_display_dpr=e.meta_device_display_dpr,this.sessionData.meta_browser_version=e.meta_browser_version,this.sessionData.meta_device_category=e.meta_device_category,this.sessionData.meta_device_architecture=e.meta_device_architecture,this.sessionData.meta_device_display_width=e.meta_device_display_width,this.sessionData.meta_device_display_height=e.meta_device_display_height,this.sessionData.meta_device_is_touchscreen=e.meta_device_is_touchscreen,this.sessionData.meta_browser_language=e.meta_browser_language}else this.sessionData.meta_device_name=X.device.model,this.sessionData.meta_device_manufacturer=X.device.vendor,this.sessionData.meta_operating_system_version=X.os.version,this.sessionData.meta_operating_system=X.os.name,this.sessionData.meta_browser=X.browser.name,this.sessionData.meta_browser_version=X.browser.version,this.sessionData.meta_device_category=ye(),this.sessionData.meta_device_architecture=X.cpu.architecture,typeof window<`u`&&(this.sessionData.meta_device_display_dpr=parseInt(String(window.devicePixelRatio),10),this.sessionData.meta_device_display_width=window.screen.width,this.sessionData.meta_device_display_height=window.screen.height,this.sessionData.meta_browser_language=navigator?navigator.language||navigator.userLanguage:``,`ontouchstart`in document.documentElement&&(this.sessionData.meta_device_is_touchscreen=`true`))}setPlayerData(e){if(this.playerData={player_instance_id:this.playerInstanceId,property_id:this.propertyId,session_id:this.sessionId,user_id:this.userId,custom_user_id:this.customUserId,custom_data_1:this.customData1,custom_data_2:this.customData2,custom_data_3:this.customData3,custom_data_4:this.customData4,custom_data_5:this.customData5,custom_data_6:this.customData6,custom_data_7:this.customData7,custom_data_8:this.customData8,custom_data_9:this.customData9,custom_data_10:this.customData10,player_integration_version:this.customPlayerIntegrationVersion,meta_page_type:this.customPageType,meta_page_url:this.pageURL},this.config.deviceData){let e=this.config.playerData||{};this.playerData.player_preload=e.player_preload,this.playerData.player_autoplay=e.player_autoplay,this.playerData.player_software_version=e.player_software_version,this.playerData.player_integration_version=e.player_integration_version,this.playerData.player_name=e.player_name,this.playerData.player_language_code=e.player_language_code,this.playerData.player_software=e.player_software,this.playerData.meta_page_url=e.meta_page_url,this.playerData.meta_page_type=e.meta_page_type,this.playerData.player_height_pixels=e.player_height_pixels,this.playerData.player_width_pixels=e.player_width_pixels}e&&f.validNumber(e.videoWindowHeight)&&(this.playerData.player_height_pixels=e.videoWindowHeight),e&&f.validNumber(e.videoWindowWidth)&&(this.playerData.player_width_pixels=e.videoWindowWidth),e&&f.validBoolean(e.autoplay)&&(this.playerData.player_autoplay=e.autoplay),e&&f.validBoolean(e.preload)&&(this.playerData.player_preload=e.preload),e&&f.validString(e.version)&&(this.playerData.player_software_version=e.version),e&&f.validString(e.audioLanguage)&&(this.playerData.player_language_code=e.audioLanguage),e&&f.validString(e.playerSoftware)&&(this.playerData.player_software=e.playerSoftware)}},At=class{constructor(e,t){this.sample={},this.currentTime=0,this.isMuted=!1,this.orientation=`undetected`,this.playbackWatchTime=0,this.config=e,this.session=t;try{this.orientation=screen.orientation.type.match(/\w+/)[0],screen.orientation.addEventListener(`change`,()=>{this.orientation=screen.orientation.type.match(/\w+/)[0]})}catch{this.orientation=`undetected`}}setDuration(e){}setPlaybackWatchTime(e){this.playbackWatchTime=e}getPlaybackWatchTime(){return this.playbackWatchTime}setVideoData(e){e&&f.validNumber(e.duration)&&(this.videoDuration=f.calculateTime(e.duration)),e&&f.validString(e.streamType)&&(this.videoSourceType=e.streamType,e.streamType===`dash`&&f.validString(e.mpdUrl)?(this.videoSourceUrl=e.mpdUrl,this.videoSourceHostname=new URL(this.videoSourceUrl).hostname):e.streamType===`hls`&&f.validString(e.m3u8Url)?(this.videoSourceUrl=e.m3u8Url,this.videoSourceHostname=new URL(this.videoSourceUrl).hostname):e.streamType===`hls`&&f.validString(e.streamUrl)?(this.videoSourceUrl=e.streamUrl,this.videoSourceHostname=new URL(this.videoSourceUrl).hostname):e.streamType===`progressive`&&f.validString(e.progUrl)?(this.videoSourceUrl=e.progUrl,this.videoSourceHostname=new URL(this.videoSourceUrl).hostname):e?.streamUrl&&(this.videoSourceUrl=e.streamUrl,this.videoSourceHostname=new URL(this.videoSourceUrl).hostname)),e?.streamUrl&&(this.videoSourceUrl=e.streamUrl),e?.sourceHostName&&(this.videoSourceHostname=e.sourceHostName),e?.muted&&(this.isMuted=e.muted),e?.currentVideoData?.height&&f.validNumber(e.currentVideoData.height)&&e.currentVideoData.height>0&&(this.videoHeightPixels=e.currentVideoData.height),e?.currentVideoData?.width&&f.validNumber(e.currentVideoData.width)&&e.currentVideoData.width>0&&(this.videoWidthPixels=e.currentVideoData.width),e?.currentVideoData?.bitrate&&f.validNumber(e.currentVideoData.bitrate)&&e.currentVideoData.bitrate>-1&&(this.videoBitrate=e.currentVideoData.bitrate/1e6),e?.currentVideoData?.audioCodec&&f.validString(e.currentVideoData.audioCodec)&&e.currentVideoData.audioCodec.length>0&&(this.audioCodec=e.currentVideoData.audioCodec),e?.currentVideoData&&f.validString(e.currentVideoData.videoCodec)&&e.currentVideoData.videoCodec.length>0&&(this.videoCodec=e.currentVideoData.videoCodec);let t=this.session,n=0;if(this.videoHeightPixels&&t.playerData?.player_height_pixels&&t.sessionData?.meta_device_display_dpr?n=t.playerData.player_height_pixels*t.sessionData.meta_device_display_dpr/this.videoHeightPixels-1:(this.upscalePercentage=void 0,this.downscalePercentage=void 0),this.videoHeightPixels&&t.playerData?.player_height_pixels&&t.sessionData?.meta_device_display_dpr&&(n>0?(this.upscalePercentage=n*100,this.downscalePercentage=0):n<0?(this.upscalePercentage=0,this.downscalePercentage=n*100*-1):(this.upscalePercentage=0,this.downscalePercentage=0)),this.videoSourceUrl)try{let e=new URL(this.videoSourceUrl);e.hostname===`video.gumlet.io`&&!t.customVideoId&&(t.customVideoId=e.pathname.split(`/`)[2])}catch{}}setPlaybackSettingsFromLoadedEvent(e){e&&f.validNumber(e.currentTime)&&(this.currentTime=f.calculateTime(e.currentTime)),e&&f.validBoolean(e.isFullScreen)&&(this.isFullScreen=e.isFullScreen),e&&f.validBoolean(e.isCasting)&&(this.isCasting=e.isCasting)}setupSample(){let e=this.session;this.sample={property_id:e.propertyId,session_id:e.sessionId,user_id:e.userId,player_instance_id:e.playerInstanceId,playback_id:e.playbackId,from:void 0,to:void 0,playback_time_instant_millis:void 0,bitrate_mbps:this.videoBitrate,error_code:void 0,error:void 0,error_text:void 0,video_cover:void 0,video_cover_reference:void 0,player_remote_played:void 0,video_total_duration_millis:this.videoDuration,video_width_pixels:void 0,video_height_pixels:void 0,video_source_url:void 0,video_source_hostname:void 0,video_source_type:void 0,custom_content_type:e.customContentType,custom_video_duration_millis:e.customVideoDurationMillis,custom_encoding_variant:e.customEncodingVariant,custom_video_language:e.customVideoLanguage,custom_video_id:e.customVideoId,custom_video_series:e.customVideoSeries,custom_video_producer:e.customVideoProducer,custom_video_title:e.customVideoTitle,custom_video_variant_name:e.customVideoVariantName,custom_video_variant:e.customVideoVariant,muted:this.isMuted,casting:void 0,fullscreen:this.isFullScreen,video_downscale_percentage:void 0,video_upscale_percentage:void 0,orientation:void 0,orientation_from:void 0,quality:void 0,quality_from:void 0,previous_event:void 0,millis_from_previous_event:void 0,video_codec:void 0,audio_codec:void 0,custom_data_1:e.customData1,custom_data_2:e.customData2,custom_data_3:e.customData3,custom_data_4:e.customData4,custom_data_5:e.customData5,custom_data_6:e.customData6,custom_data_7:e.customData7,custom_data_8:e.customData8,custom_data_9:e.customData9,custom_data_10:e.customData10,custom_event_data:void 0,playback_watch_time:void 0}}getSample(e=null,t={}){let n=this.session,r=this.sample;if(r.event=e,r.event_id=n.config?.getUUID?n.config.getUUID():f.uuidv4(),r.custom_data_1=n.customData1,r.custom_data_2=n.customData2,r.custom_data_3=n.customData3,r.custom_data_4=n.customData4,r.custom_data_5=n.customData5,r.custom_data_6=n.customData6,r.custom_data_7=n.customData7,r.custom_data_8=n.customData8,r.custom_data_9=n.customData9,r.custom_data_10=n.customData10,r.custom_content_type=n.customContentType,r.custom_video_duration_millis=n.customVideoDurationMillis,r.custom_encoding_variant=n.customEncodingVariant,r.custom_video_language=n.customVideoLanguage,r.custom_video_id=n.customVideoId,r.custom_video_series=n.customVideoSeries,r.custom_video_producer=n.customVideoProducer,r.custom_video_title=n.customVideoTitle,r.custom_video_variant_name=n.customVideoVariantName,r.custom_video_variant=n.customVideoVariant,r.fullscreen=this.isFullScreen,r.muted=this.isMuted,r.video_width_pixels=this.videoWidthPixels,r.video_height_pixels=this.videoHeightPixels,r.video_total_duration_millis=this.videoDuration,r.bitrate=this.videoBitrate,r.audio_codec=this.audioCodec,r.video_codec=this.videoCodec,r.orientation=this.orientation,r.playback_time_instant_millis=this.currentTime,r.video_source_type=this.videoSourceType,r.video_source_url=this.videoSourceUrl,r.video_upscale_percentage=this.upscalePercentage,r.video_downscale_percentage=this.downscalePercentage,r.video_source_hostname=this.videoSourceHostname,r.custom_event_data=void 0,r.playback_watch_time=this.playbackWatchTime,Object.keys(t).forEach(e=>{r[e]=t[e]}),typeof window<`u`&&window.parent!==void 0&&window.navigator)try{typeof window.navigator.getBattery==`function`&&window.navigator.getBattery().then(e=>{e&&(r.battery_level_percentage=e.level*100,r.battery_charging=e.charging)})}catch{}return r}},jt=class{constructor(e,t){this.licensing=`granted`,this.analyticsCall=e,this.sampleBuilder=t}sendRequest(e,t={}){let n=this.sampleBuilder.getSample(e,t);if(e!==p.END){if(n.playback_time_instant_millis&&n.video_total_duration_millis&&n.playback_time_instant_millis>n.video_total_duration_millis)return}else n.video_total_duration_millis&&(n.playback_time_instant_millis=Math.min(n.playback_time_instant_millis??0,n.video_total_duration_millis));this.analyticsCall.sendRequest(n,f.noOp)}sendRequestAsync(e,t={}){return new Promise((n,r)=>{let i=this.sampleBuilder.getSample(e,t);if(i.playback_time_instant_millis&&i.video_total_duration_millis&&i.playback_time_instant_millis>i.video_total_duration_millis){n(406);return}this.analyticsCall.sendRequestAsync(i).then(e=>n(e)).catch(e=>r(e))})}sendAndClear(e=null,t={}){if(!e){n.log(`event null passed not hitting the ingestion API`);return}this.sampleBuilder.videoDuration&&this.sampleBuilder.videoDuration>864e5||this.sendRequest(e,t)}sendAndClearAsync(e=null,t={}){return new Promise((r,i)=>{if(!e){n.log(`event null passed not hitting the ingestion API`),i(`event null passed not hitting the ingestion API`);return}this.sendRequestAsync(e,t).then(e=>r(e)).catch(e=>i(e))})}sendUnload(){if(this.licensing===`denied`)return;let e=this.sampleBuilder.sample;if(navigator.sendBeacon===void 0){this.sendSynchronous();return}fetch(this.analyticsCall.getAnalyticsServerUrl(),{method:`POST`,body:JSON.stringify(e),headers:{"Content-Type":`application/json`}}).then(e=>{e.ok||this.sendSynchronous()}).catch(()=>{this.sendSynchronous()})}sendSynchronous(){this.licensing!==`denied`&&this.analyticsCall.sendRequestSynchronous(this.sampleBuilder.sample,f.noOp)}},Mt=class e{static{this.PAGE_LOAD_TYPE={FOREGROUND:1,BACKGROUND:2}}static{this.LICENSE_CALL_PENDING_TIMEOUT=200}static{this.PAGE_LOAD_TYPE_TIMEOUT=200}static{this.CAST_RECEIVER_CONFIG_MESSAGE=`CAST_RECEIVER_CONFIG_MESSAGE`}constructor(t){this.previousState=void 0,this.previousStateTimeStamp=new Date,this.firstPlayTimestamp=0,this.startupTime=0,this.pageLoadType=e.PAGE_LOAD_TYPE.FOREGROUND,this.droppedSampleFrames=0,this.autoplay=void 0,this.isCastClient=!1,this.isCastReceiver=!1,this.isAllowedToSendSamples=!1,this.samplesQueue=[],this.customEventHandler=(e,t)=>{this.sampleBuilder.sample.custom_event_data=JSON.stringify(t),this.sendAnalyticsRequestAndClearValues(e,{custom_event_data:JSON.stringify(t)})},this.customEventHandlerAsync=(e,t)=>new Promise((n,r)=>{let i=JSON.stringify(t);this.sendAnalyticsRequestAndClearValuesAsync(e,{custom_event_data:i}).then(e=>n(e)).catch(e=>r(e))}),this.getCurrentImpressionId=()=>this.sample.impressionId,this.setDroppedFrames=e=>{},this.register=async(e,t={})=>{t.starttime?t.starttime=f.convertEpochTime(t.starttime):t.starttime=f.getCurrentTimestamp();let{GumletStateMachine:r}=await import(`./GumletStateMachine-D4hv41aC.mjs`);if(this.analyticsStateMachine=new r(this.stateMachineCallbacks,t),!e){let{HTML5Adapter:e}=await import(`./HTML5Adapter-Brvz5Xu2.mjs`);return this.adapter=new e(this.mediaElement,this.record,this.analyticsStateMachine),this.analyticsStateMachine}if(me.isHlsjs(e)){let{HlsjsAdapter:t}=await import(`./HlsjsAdapter-NfwbLfnY.mjs`);this.adapter=new t(e,this.record,this.analyticsStateMachine)}else if(me.isShaka(e)){let{ShakaAdapter:n}=await import(`./ShakaAdapter-DKoy0f1_.mjs`);this.adapter=new n(e,this.record,this.analyticsStateMachine,t.mediaElement??null)}else{let{HTML5Adapter:t}=await import(`./HTML5Adapter-Brvz5Xu2.mjs`);this.adapter=new t(e,this.record,this.analyticsStateMachine)}this.adapter||n.error(`Could not detect player.`)},this.registerHLSJSPlayer=async(e,t={})=>{t.starttime?t.starttime=f.convertEpochTime(t.starttime):t.starttime=f.getCurrentTimestamp();let{GumletStateMachine:n}=await import(`./GumletStateMachine-D4hv41aC.mjs`);this.analyticsStateMachine=new n(this.stateMachineCallbacks,t);let{HlsjsAdapter:r}=await import(`./HlsjsAdapter-NfwbLfnY.mjs`);this.adapter=new r(e,this.record,this.analyticsStateMachine)},this.registerShakaPlayer=async(e,t={})=>{t.starttime?t.starttime=f.convertEpochTime(t.starttime):t.starttime=f.getCurrentTimestamp();let{GumletStateMachine:n}=await import(`./GumletStateMachine-D4hv41aC.mjs`);this.analyticsStateMachine=new n(this.stateMachineCallbacks,t);let{ShakaAdapter:r}=await import(`./ShakaAdapter-DKoy0f1_.mjs`);this.adapter=new r(e,this.record,this.analyticsStateMachine,t.mediaElement)},this.registerHTML5Player=async(e,t={})=>{t.starttime?t.starttime=f.convertEpochTime(t.starttime):t.starttime=f.getCurrentTimestamp();let{GumletStateMachine:n}=await import(`./GumletStateMachine-D4hv41aC.mjs`);this.analyticsStateMachine=new n(this.stateMachineCallbacks,t);let{HTML5Adapter:r}=await import(`./HTML5Adapter-Brvz5Xu2.mjs`);this.adapter=new r(e,this.record,this.analyticsStateMachine)},this.registerReactNativeVideoPlayer=async e=>{e.starttime?e.starttime=f.convertEpochTime(e.starttime):e.starttime=f.getCurrentTimestamp();let{GumletStateMachine:t}=await import(`./GumletStateMachine-D4hv41aC.mjs`);return this.analyticsStateMachine=new t(this.stateMachineCallbacks,e),this.analyticsStateMachine},this.record=(e,t)=>{t||={},this.analyticsStateMachine.callEvent(e,t,f.getCurrentTimestamp())},this.config=t,this.analyticsCall=new de,this.castClient=new he,this.castReceiver=new ge,this.session=new kt(t),this.sampleBuilder=new At(t,this.session),this.publisher=new jt(this.analyticsCall,this.sampleBuilder),this.init(),this.setupSample(),this.setupStateMachineCallbacks()}init(){if(!this.isCastReceiver&&(this.config.property_id===``||!f.validString(this.config.property_id))){console.error(`Invalid analytics property_id provided`);return}n.setLogging(this.config.debug||!1),this.session.propertyId=this.config.property_id,typeof window<`u`&&window.parent!==void 0?this.session.pageURL=window.location===window.parent.location?document.location.href:document.referrer:this.config.page_url?this.session.pageURL=this.config.page_url:this.session.pageURL=null;let e=!!this.config.test,t=this.config.sessionID||null,r=this.config.userID||null,i=Object.hasOwn(this.config,`sendSessionRequest`)?this.config.sendSessionRequest:!0;this.session.setUserId(e,r),this.session.setSessionId(e,t,i),this.session.setPlayerInstanceId(this.config.getUUID),this.session.setPlaybackId(this.config.getUUID)}setConfigParameters(e=this.config){this.session.setConfigParameters(e)}updateCustomData(e){this.session.updateCustomData(e)}updateCustomUserData(e){this.session.updateCustomUserData(e)}updateCustomVideoData(e){this.session.updateCustomVideoData(e)}updateCustomPlayerData(e){this.session.updateCustomPlayerData(e)}get userId(){return this.session.userId}get sessionId(){return this.session.sessionId}get propertyId(){return this.session.propertyId}get playerData(){return this.session.playerData}get sessionData(){return this.session.sessionData}get playerInitCall(){return this.session.playerInitCall}get isMuted(){return this.sampleBuilder.isMuted}set isMuted(e){this.sampleBuilder.isMuted=e}get sample(){return this.sampleBuilder.sample}setupSample(){this.sampleBuilder.setupSample()}setDuration(e){this.sampleBuilder.setDuration(e)}setVideoData(e){this.sampleBuilder.setVideoData(e)}setPlaybackSettingsFromLoadedEvent(e){this.sampleBuilder.setPlaybackSettingsFromLoadedEvent(e)}setPlaybackWatchTime(e){this.sampleBuilder.setPlaybackWatchTime(e)}getPlaybackWatchTime(){return this.sampleBuilder.getPlaybackWatchTime()}getSample(e=null,t={}){let n=this.sampleBuilder.getSample(e,t);return n.millis_from_previous_event=this.getMillisFromPreviousState(),n.previous_event=this.previousState,n}setPlayerData(e){this.session.setPlayerData(e)}setSessionData(){this.session.setSessionData()}setPlaybackId(){this.session.setPlaybackId(this.config.getUUID)}setUserId(e=!1,t=null){this.session.setUserId(e,t)}setSessionId(e=!1,t=null,n=!0){this.session.setSessionId(e,t,n)}setPlayerInstanceId(){this.session.setPlayerInstanceId(this.config.getUUID)}sendAnalyticsRequest(e,t){this.publisher.sendRequest(e,t)}sendAnalyticsRequestAsync(e,t){return this.publisher.sendRequestAsync(e,t)}sendAnalyticsRequestAndClearValues(e=null,t={}){let n={millis_from_previous_event:this.getMillisFromPreviousState(),previous_event:this.previousState,...t};this.publisher.sendAndClear(e,n)}sendAnalyticsRequestAndClearValuesAsync(e=null,t={}){return this.publisher.sendAndClearAsync(e,t)}sendUnloadRequest(){this.publisher.sendUnload()}sendAnalyticsRequestSynchronous(){this.publisher.sendSynchronous()}getMillisFromPreviousState(){return new Date().getTime()-this.previousStateTimeStamp.getTime()}setState(e=void 0){e&&(this.previousState=e,this.previousStateTimeStamp=new Date)}getDroppedFrames(e){if(e!==void 0&&e!==0){let t=e-this.droppedSampleFrames;return this.droppedSampleFrames=e,t}return 0}setupStateMachineCallbacks(){this.stateMachineCallbacks={setup:(e,t,r,i)=>{n.log(`Setup Gumlet analytics `+this.analyticsVersion),this.setDuration(e),this.setVideoData(r);let a=0;i?.starttime&&(a=new Date().getTime()-i.starttime),this.sendAnalyticsRequestAndClearValues(p.SETUP,{millis_from_previous_event:a}),this.setState(p.SETUP)},ready:(e,t,n)=>{this.setDuration(e),this.setVideoData(n),this.setPlaybackSettingsFromLoadedEvent(n),this.sendAnalyticsRequestAndClearValues(p.PLAYER_READY),this.setState(p.PLAYER_READY),this.setPlayerData(n),this.playerInitCall.sendRequest(this.playerData,f.noOp)},loaded:(e,t,n,r=null)=>{this.setDuration(e),this.setVideoData(n),this.setPlaybackSettingsFromLoadedEvent(n);let i={};r!==null&&(i={millis_from_previous_event:r,previous_event:p.PLAYER_READY}),this.sendAnalyticsRequestAndClearValues(p.PLAYBACK_READY,i),r===null&&this.setState(p.PLAYBACK_READY)},startup:(e,t)=>{this.setDuration(e)},first_play:(e,t,n)=>{this.setDuration(e),this.setVideoData(n),this.setPlaybackSettingsFromLoadedEvent(n),this.sendAnalyticsRequestAndClearValues(p.PLAY),this.setState(p.PLAY),this.firstPlayTimestamp=new Date},play:(e,t,n)=>{this.setDuration(e),this.setVideoData(n),this.setPlaybackSettingsFromLoadedEvent(n),this.sendAnalyticsRequestAndClearValues(p.PLAY),this.setState(p.PLAY)},updateSample:e=>{this.setPlaybackSettingsFromLoadedEvent(e)},playing:(e,t,n)=>{this.setDuration(e),this.setVideoData(n),this.setPlaybackSettingsFromLoadedEvent(n),this.sendAnalyticsRequestAndClearValues(p.PLAYING),this.setState(p.PLAYING)},playback_started:(e,t,n)=>{this.setDuration(e),this.setVideoData(n),this.setPlaybackSettingsFromLoadedEvent(n);let r=new Date().getTime()-this.firstPlayTimestamp.getTime();this.sendAnalyticsRequestAndClearValues(p.PLAYBACK_STARTED,{millis_from_previous_event:r}),this.setState(p.PLAYBACK_STARTED)},playingAndBye:(e,t,n)=>{this.setDuration(e),this.setDroppedFrames(n),this.sendUnloadRequest()},heartbeat:(e,t,n)=>{this.setDuration(e),this.setVideoData(n),this.setPlaybackSettingsFromLoadedEvent(n),this.sendAnalyticsRequestAndClearValues(p.PLAYBACK_UPDATE),this.setState(p.PLAYBACK_UPDATE)},playbackWatchTime:e=>{this.setPlaybackWatchTime(e)},qualitychange:(e,t)=>{this.setDuration(e)},qualitychange_pause:(e,t)=>{this.setDuration(e)},qualitychange_rebuffering:(e,t)=>{this.setDuration(e)},videoChange:e=>{this.stateMachineCallbacks.setVideoTimeEndFromEvent(e),this.stateMachineCallbacks.setVideoTimeStartFromEvent(e),this.setPlaybackSettingsFromLoadedEvent(e)},audioChange:e=>{this.stateMachineCallbacks.setVideoTimeEndFromEvent(e),this.stateMachineCallbacks.setVideoTimeStartFromEvent(e)},pause:(e,t,n)=>{this.setDuration(e),this.setVideoData(n),this.setPlaybackSettingsFromLoadedEvent(n),this.sendAnalyticsRequestAndClearValues(p.PAUSE),this.setState(p.PAUSE)},start_rebuffer:(e,t,n,r=!1)=>{this.setDuration(e),this.setVideoData(n),this.setPlaybackSettingsFromLoadedEvent(n),r||this.sendAnalyticsRequestAndClearValues(p.START_REBUFFER),this.setState(p.START_REBUFFER)},end_rebuffer:(e,t,n,r=!1)=>{if(this.setDuration(e),this.setVideoData(n),this.setPlaybackSettingsFromLoadedEvent(n),!r)this.sendAnalyticsRequestAndClearValues(p.END_REBUFFER);else return this.getSample(p.END_REBUFFER);this.setState(p.END_REBUFFER)},playback_seeked:(e,t,n,r)=>{this.sendAnalyticsRequestAndClearValues(p.SEEKED,{from:e,to:t}),this.setState(p.SEEKED),this.setupSample(),r===`PAUSE`?(this.sendAnalyticsRequestAndClearValues(p.PAUSE,{millis_from_previous_event:n}),this.setState(p.PAUSE)):r===`PLAYING`&&(this.sendAnalyticsRequestAndClearValues(p.PLAYING,{millis_from_previous_event:n}),this.setState(p.PLAYING))},paused_seeking:(e,t,n)=>{this.setDuration(e)},play_seeking:f.noOp,end_play_seeking:(e,t,n)=>{this.setDuration(e)},rebuffering:(e,t,n)=>{this.setDuration(e)},error:e=>{this.setPlaybackSettingsFromLoadedEvent(e),this.stateMachineCallbacks.setVideoTimeEndFromEvent(e),this.stateMachineCallbacks.setVideoTimeStartFromEvent(e),this.sendAnalyticsRequestAndClearValues(p.ERROR,{error_code:e&&e.code,error:e&&e.message}),this.setState(p.ERROR),this.setupSample()},error_recovered:(e,t,n)=>{this.setPlaybackSettingsFromLoadedEvent(n),this.stateMachineCallbacks.setVideoTimeEndFromEvent(n),this.stateMachineCallbacks.setVideoTimeStartFromEvent(n),this.sendAnalyticsRequestAndClearValues(p.ERROR_RECOVERED,{})},end:(e,t,n)=>{this.setPlaybackId(),this.setDuration(e),this.sendAnalyticsRequestAndClearValues(p.END),this.setState(p.END)},ad:(e,t,n)=>{this.setDuration(e),this.setDroppedFrames(n)},mute:(e,t)=>{this.isMuted=!0,this.setPlaybackSettingsFromLoadedEvent(t),this.sendAnalyticsRequestAndClearValues(p.MUTE)},unMute:(e,t)=>{this.isMuted=!1,this.setPlaybackSettingsFromLoadedEvent(t),this.sendAnalyticsRequestAndClearValues(p.UNMUTE)},muting_ready:f.noOp,muting_play:f.noOp,muting_pause:f.noOp,setVideoTimeEndFromEvent:e=>{},setVideoTimeStartFromEvent:e=>{},startCasting:(t,r)=>{if(r&&r.resuming){this.isAllowedToSendSamples=!1,n.warning(`Player started casting but a session is already casting!`);return}this.isCastClient=!0,this.isAllowedToSendSamples=!1;let{domain:i,path:a,language:o,userAgent:s,userId:c,impressionId:l}=this.sample,u={type:e.CAST_RECEIVER_CONFIG_MESSAGE,data:{config:this.config,userId:c,domain:i,path:a,language:o,userAgent:s,impressionId:l}};this.castClient.setUp(),this.castClient.sendMessage(u)},casting:()=>{this.isCastClient=!1,this.samplesQueue=[],this.isAllowedToSendSamples=!0},source_changing:()=>{},resetSessionExpiry:()=>{this.session.resetSessionExpiry()}}}};const Z=`[GumletInsights]`;var Nt=class{constructor(e){if(this.analytics_=null,this.ready_=!1,this.attached_=!1,!e||!f.validString(e.property_id)||e.property_id===``){console.error(`${Z} A valid property_id is required. No analytics events will be sent until the SDK is re-constructed with a valid config.`);return}this.analytics_=new Mt(e),this.ready_=!0}async attach(e,t={}){if(!this.ready_||!this.analytics_){console.error(`${Z} attach() called but the SDK is not initialized. Check that you passed a valid property_id to the constructor.`);return}this.attached_&&(console.warn(`${Z} attach() called while a player is already attached. Detaching the previous player first.`),this.detach());let n=t.mediaElement??null;if(n!==null&&!this.isHTMLVideoElement_(n)){console.error(`${Z} opts.mediaElement must be an HTMLVideoElement, got: ${Object.prototype.toString.call(n)}`);return}if(e==null){if(!n){console.error(`${Z} HTML5 mode requires opts.mediaElement (an HTMLVideoElement). Pass the <video> element as opts.mediaElement, or pass it directly as the player argument.`);return}}else if(pe(e)){if(!this.isValidHlsPlayer_(e)){console.error(`${Z} HLS.js player is not in a valid state. The player may have been destroyed. Create a new Hls() instance before attaching.`);return}}else if(fe(e)){let t=typeof e.getMediaElement==`function`?e.getMediaElement():null;if(!n&&!t){console.error(`${Z} Shaka Player requires opts.mediaElement — pass the HTMLVideoElement that Shaka is rendering into.`);return}if(!this.isValidShakaPlayer_(e)){console.error(`${Z} Shaka Player is not in a valid state. The player may have been destroyed. Create a new shaka.Player() before attaching.`);return}}else if(!this.isHTMLVideoElement_(e)){console.error(`${Z} Unrecognized player type (${Object.prototype.toString.call(e)}). Supported players: HLS.js (Hls instance), Shaka Player (shaka.Player instance), HTMLVideoElement, or null/undefined (HTML5 mode with opts.mediaElement).`);return}await this.analytics_.register(e,{...t,mediaElement:n}),this.attached_=!0}detach(){this.attached_&&=(this.analytics_?.adapter?.destroy?.(),!1)}get isAttached(){return this.attached_}getImpressionId(){return this.analytics_?.getCurrentImpressionId()??void 0}updateConfig(e){!this.ready_||!this.analytics_||(this.analytics_.updateCustomData(e),this.analytics_.updateCustomVideoData(e),this.analytics_.updateCustomUserData(e),this.analytics_.updateCustomPlayerData(e))}updateCustomData(e){this.analytics_?.updateCustomData(e)}updateCustomVideoData(e){this.analytics_?.updateCustomVideoData(e)}updateCustomUserData(e){this.analytics_?.updateCustomUserData(e)}updateCustomPlayerData(e){this.analytics_?.updateCustomPlayerData(e)}isHTMLVideoElement_(e){return typeof HTMLVideoElement<`u`?e instanceof HTMLVideoElement:typeof e==`object`&&!!e&&typeof e.play==`function`&&typeof e.pause==`function`&&typeof e.addEventListener==`function`}isValidHlsPlayer_(e){return typeof e==`object`&&!!e&&typeof e.loadSource==`function`&&typeof e.attachMedia==`function`&&typeof e.destroy==`function`}isValidShakaPlayer_(e){return typeof e!=`object`||!e?!1:typeof e.isDestroyed==`function`?!e.isDestroyed():typeof e.load==`function`&&typeof e.unload==`function`&&typeof e.addEventListener==`function`}};const Pt={CLOUDFLARE:`cloudflare`,AKAMAI:`akamai`,FASTLY:`fastly`,MAXCDN:`maxcdn`,CLOUDFRONT:`cloudfront`,CHINACACHE:`chinacache`,BITGRAVITY:`bitgravity`};let Q;const Ft=(e,t={})=>Q.register(e,t),It=(e,t={})=>Q.registerHLSJSPlayer(e,t),Lt=(e,t={})=>Q.registerShakaPlayer(e,t),Rt=(e,t={})=>Q.registerHTML5Player(e,t),zt=(e,t={})=>Q.registerReactNativeVideoPlayer(e,t),Bt=()=>Q.getCurrentImpressionId(),Vt=()=>Q.analyticsStateMachine,Ht=e=>Q.updateCustomData(e),Ut=e=>Q.updateCustomVideoData(e),Wt=e=>Q.updateCustomUserData(e),Gt=e=>Q.updateCustomPlayerData(e),Kt=(e,t)=>Q.customEventHandler(e,t),qt=(e,t)=>new Promise((n,r)=>{Q.customEventHandlerAsync(e,t).then(e=>{n(e)}).catch(e=>{r(e)})}),$=e=>(Q=new Mt(e),{register:Ft,registerHLSJSPlayer:It,registerShakaPlayer:Lt,registerHTML5Player:Rt,registerReactNativeVideoPlayer:zt,getCurrentImpressionId:Bt,stateMachine:Vt,updateCustomData:Ht,updateCustomVideoData:Ut,updateCustomUserData:Wt,updateCustomPlayerData:Gt,setCustomData:Q.setCustomData,setCustomDataOnce:Q.setCustomDataOnce,customEventHandler:Kt,customEventHandlerAsync:qt});$.Players=r,$.CdnProviders=Pt,$.gumletInsightsEvents=i,$.gumletSupportedPlayers=r,typeof window<`u`&&(window.gumlet=window.gumlet||{},window.gumlet.insights=$,window.gumlet.GumletInsights=Nt,window.gumletInsightsEvents=i,window.gumletSupportedPlayers=r);var Jt={insights:$,gumletInsightsEvents:i,gumletSupportedPlayers:r};export{Nt as GumletInsights,Jt as default};
package/package.json CHANGED
@@ -1,11 +1,18 @@
1
1
  {
2
2
  "name": "@gumlet/insights-js-core",
3
- "version": "1.1.62",
4
- "description": "",
5
- "main": "build/release/gumlet-insights.min.js",
3
+ "version": "2.0.0",
4
+ "description": "Gumlet Insights allows you to collect data from Video playback.",
5
+ "main": "./dist/main.mjs",
6
+ "browser": "dist/main.iife.js",
7
+ "module": "./dist/main.mjs",
8
+ "exports": {
9
+ ".": "./dist/main.mjs",
10
+ "./package.json": "./package.json"
11
+ },
6
12
  "files": [
7
- "build/"
13
+ "dist/"
8
14
  ],
15
+ "type": "module",
9
16
  "repository": {
10
17
  "type": "git",
11
18
  "url": "https://github.com/gumlet/insights-js-core.git"
@@ -17,50 +24,30 @@
17
24
  },
18
25
  "homepage": "https://docs.gumlet.com/docs/insights-getting-started",
19
26
  "dependencies": {
20
- "@babel/cli": "^7.16.0",
21
- "@babel/core": "^7.16.0",
22
- "@babel/plugin-proposal-class-properties": "^7.18.6",
23
- "@babel/plugin-proposal-object-rest-spread": "^7.20.7",
24
- "@babel/preset-env": "^7.16.4",
25
- "babel-loader": "^8.2.3",
26
- "generate-json-webpack-plugin": "^2.0.0",
27
- "htmlhint": "^1.1.0",
28
- "javascript-state-machine": "^2.4.0",
29
- "platform": "^1.3.6",
30
- "regenerator-runtime": "^0.13.9",
31
- "webpack": "^5.64.0",
32
- "webpack-cli": "^4.9.1"
27
+ "javascript-state-machine": "^3.1.0",
28
+ "ua-parser-js": "^2.0.9"
33
29
  },
34
30
  "devDependencies": {
35
31
  "@biomejs/biome": "^2.2.4",
36
32
  "@vitest/coverage-v8": "^4.1.0",
37
- "vitest": "^4.1.0",
38
- "webpack-dev-server": "^5.2.1"
33
+ "concurrently": "^9.2.1",
34
+ "http-server": "^14.1.1",
35
+ "regenerator-runtime": "^0.14.1",
36
+ "tsdown": "^0.21.6",
37
+ "typescript": "^6.0.2",
38
+ "vitest": "^4.1.0"
39
39
  },
40
40
  "scripts": {
41
- "build:debug": "webpack --progress --config webpack.config.debug.js",
42
- "build:release": "webpack --progress --config webpack.config.release.js",
41
+ "build:debug": "tsdown --watch",
42
+ "build:release": "tsdown",
43
43
  "lint": "biome lint",
44
44
  "lint:fix": "biome lint --write",
45
45
  "precommit": "./precommit.bash",
46
- "start": "webpack-dev-server --progress --config webpack.config.debug.js",
47
- "test": "vitest --coverage"
46
+ "test": "vitest --coverage",
47
+ "start": "concurrently \"tsdown --watch\" \"http-server . -p 8080 -c-1 -o html/hlsjs.html\""
48
48
  },
49
- "babel": {
50
- "presets": [
51
- [
52
- "@babel/preset-env",
53
- {
54
- "targets": {
55
- "chrome": "58",
56
- "ie": "11"
57
- }
58
- }
59
- ]
60
- ],
61
- "plugins": [
62
- "@babel/plugin-proposal-class-properties",
63
- "@babel/plugin-proposal-object-rest-spread"
64
- ]
49
+ "inlinedDependencies": {
50
+ "javascript-state-machine": "3.1.0",
51
+ "ua-parser-js": "2.0.9"
65
52
  }
66
53
  }