@gumlet/insights-js-core 2.0.3 → 2.1.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.
package/dist/main.mjs CHANGED
@@ -4,6 +4,6 @@
4
4
  // This source code and its use and distribution, is subject to the terms
5
5
  // and conditions of the applicable license agreement.
6
6
 
7
- // @gumlet/insights-js-core version 2.0.3
7
+ // @gumlet/insights-js-core version 2.1.0
8
8
 
9
- import{i as e,n as t,t as n}from"./Logger-DUjT1Fln.mjs";import{t as r}from"./Players-lN6_JYCc.mjs";import{t as i}from"./Events-BytR6Vlt.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.previousStateMono=0,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-Bz_mEACv.mjs`);if(this.analyticsStateMachine=new r(this.stateMachineCallbacks,t),!e){let{HTML5Adapter:e}=await import(`./HTML5Adapter-bek9XmEB.mjs`);return this.adapter=new e(this.mediaElement,this.record,this.analyticsStateMachine),this.analyticsStateMachine}if(me.isHlsjs(e)){let{HlsjsAdapter:t}=await import(`./HlsjsAdapter-Ci7V7yt1.mjs`);this.adapter=new t(e,this.record,this.analyticsStateMachine)}else if(me.isShaka(e)){let{ShakaAdapter:n}=await import(`./ShakaAdapter-szvRUx2l.mjs`);this.adapter=new n(e,this.record,this.analyticsStateMachine,t.mediaElement??null)}else{let{HTML5Adapter:t}=await import(`./HTML5Adapter-bek9XmEB.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-Bz_mEACv.mjs`);this.analyticsStateMachine=new n(this.stateMachineCallbacks,t);let{HlsjsAdapter:r}=await import(`./HlsjsAdapter-Ci7V7yt1.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-Bz_mEACv.mjs`);this.analyticsStateMachine=new n(this.stateMachineCallbacks,t);let{ShakaAdapter:r}=await import(`./ShakaAdapter-szvRUx2l.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-Bz_mEACv.mjs`);this.analyticsStateMachine=new n(this.stateMachineCallbacks,t);let{HTML5Adapter:r}=await import(`./HTML5Adapter-bek9XmEB.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-Bz_mEACv.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(),typeof performance<`u`&&typeof performance.now==`function`?this.previousStateMono=performance.now():this.previousStateMono=this.previousStateTimeStamp.getTime()}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(){let e;e=typeof performance<`u`&&typeof performance.now==`function`?performance.now()-this.previousStateMono:new Date().getTime()-this.previousStateTimeStamp.getTime();let t=Math.round(e);return t<=0&&this.previousState!==void 0?1:Math.max(0,t)}setState(e=void 0){e&&(this.previousState=e,this.previousStateTimeStamp=new Date,typeof performance<`u`&&typeof performance.now==`function`?this.previousStateMono=performance.now():this.previousStateMono=this.previousStateTimeStamp.getTime())}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)}customEventHandler(e,t){if(!this.ready_||!this.analytics_){console.warn(`${Z} customEventHandler ignored — SDK not initialized (check property_id).`);return}this.analytics_.customEventHandler(e,t)}customEventHandlerAsync(e,t){return!this.ready_||!this.analytics_?Promise.reject(Error(`${Z} customEventHandlerAsync — SDK not initialized (check property_id).`)):this.analytics_.customEventHandlerAsync(e,t)}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};
9
+ import{t as e}from"./Events-C63wBhV3.mjs";import{t}from"./Players-D1WY0Vuh.mjs";import{a as n,n as r,o as i,r as a,t as o}from"./Logger-CI5ZEMmu.mjs";const s={CLOUDFLARE:`cloudflare`,AKAMAI:`akamai`,FASTLY:`fastly`,MAXCDN:`maxcdn`,CLOUDFRONT:`cloudfront`,CHINACACHE:`chinacache`,BITGRAVITY:`bitgravity`},c={experimentName:`insights-test-experiment`,customData1:`custom_data_1:test-slot-1`,customData2:`custom_data_2:test-slot-2`,customData3:`custom_data_3:test-slot-3`,customData4:`custom_data_4:test-slot-4`,customData5:`custom_data_5:test-slot-5`,customData6:`custom_data_6:test-slot-6`,customData7:`custom_data_7:test-slot-7`,customData8:`custom_data_8:test-slot-8`,customData9:`custom_data_9:test-slot-9`,customData10:`custom_data_10:test-slot-10`,customPlayerIntegrationVersion:`custom_player_integration_version:1.2.3-test`,customPlayerName:`custom_player_name:TestPlayerShell`,customPageType:`custom_page_type:article`,userId:`custom_user_id:test-user-42`,userName:`custom_user_name:Ada Test`,userEMail:`custom_user_email:test@example.com`,userPhone:`custom_user_phone:+1-555-0100`,userProfileImage:`custom_user_profile_image:https://example.com/avatar.png`,userAddressLine1:`custom_user_address_line_1:1 Test Street`,userAddressLine2:`custom_user_address_line_2:Suite 100`,userCity:`custom_user_city:Testville`,userState:`custom_user_state:TS`,userCountry:`custom_user_country:Testland`,userZipcode:`custom_user_zipcode:99999`,customContentType:`custom_content_type:application/x-test-stream`,customVideoDurationMillis:`custom_video_duration_millis:12345678`,customEncodingVariant:`custom_encoding_variant:h264-720p-test`,customVideoLanguage:`custom_video_language:en-TEST`,customVideoId:`custom_video_id:vid-integration-001`,customVideoSeries:`custom_video_series:Series Test Pack`,customVideoProducer:`custom_video_producer:QA Producer`,customVideoTitle:`custom_video_title:Full metadata smoke test`,customVideoVariantName:`custom_video_variant_name:main-feed`,customVideoVariant:`custom_video_variant:abr-ladder-a`},l=e=>e!==void 0&&typeof e==`string`,u=e=>e!==void 0&&typeof e==`boolean`,ee=e=>e!==void 0&&typeof e==`number`,te=e=>e.replace(/\/$/g,``),ne=e=>(e*=1e3,Math.round(e)),d=e=>{let t=e.toString().length;return t===13?e:e*10**(13-t)},re=()=>Date.now(),ie=e=>re()-e,ae=()=>{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(``)},oe=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},se=(e,t=30,n=null)=>{let r=new Date;r.setTime(r.getTime()+t*60*1e3);let i=n||ae();try{document.cookie=`${e}=${i}; expires=${r.toUTCString()}; path=/`,localStorage.setItem(e,JSON.stringify({expires:r.getTime(),value:i}))}catch{}return i},ce=()=>{},le=(e,t)=>{let n=0,r;return()=>n>=t?r:(r=e.apply(null,arguments),n++,r)},ue=e=>le(e,1),de=()=>{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},fe=e=>typeof e==`object`?JSON.stringify(e):typeof e==`function`?fe(e()):e===void 0||typeof e==`string`?e:String(e);var f={validString:l,validBoolean:u,validNumber:ee,sanitizePath:te,calculateTime:ne,getCurrentTimestamp:re,getDurationFromTimestampToNow:ie,uuidv4:ae,getCookie:oe,setCookie:se,noOp:ce,times:le,once:ue,getHiddenProp:de,getCustomDataString:fe,jsonToQueryString:e=>`?`+Object.keys(e).map(t=>encodeURIComponent(t)+`=`+encodeURIComponent(e[t])).join(`&`),currentDateTimeFormatString:()=>new Date().toISOString(),convertEpochTime:d};function pe(){return typeof performance<`u`&&typeof performance.timeOrigin==`number`&&!Number.isNaN(performance.timeOrigin)&&typeof performance.now==`function`?((performance.timeOrigin+performance.now())/1e3).toFixed(9):(Date.now()/1e3).toFixed(9)}function me(e){e.z=pe();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 he=class{get(e,t,n,r=!0){me(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)=>{me(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:``})})})}};let ge=!1;function _e(e){ge=e}function ve(){return ge}function ye(){return{}}let be=ye;function xe(e){be=e}function Se(e){if(!(e.meta_user_agent!=null&&e.meta_user_agent!==``))try{typeof navigator<`u`&&navigator.userAgent&&(e.meta_user_agent=navigator.userAgent)}catch{}}function Ce(e){if(e.event_duration_millis!=null)return;let t=e.from,n=e.to;typeof t==`number`&&typeof n==`number`&&!Number.isNaN(t)&&!Number.isNaN(n)&&(e.event_duration_millis=n-t)}function we(e){let t=e.user_email;t!=null&&t!==``&&(e.custom_user_email==null||e.custom_user_email===``)&&(e.custom_user_email=t)}function Te(e,t){let n={...e};for(let[e,r]of Object.entries(t))r!==void 0&&(n[e]=r);return n}function Ee(e){let t=Te(be(),e);return t.bitrate_mbps==null&&t.bitrate!=null&&(t.bitrate_mbps=t.bitrate),t.player_software==null&&t.player_name!=null&&(t.player_software=t.player_name),Se(t),Ce(t),we(t),t}var De=class e extends he{constructor(...t){super(...t),this.sendRequest=function(t,n){t.event_family=`session_event`;let r=ve()?Ee({...t}):null;this.get(e.analyticsServerUrl,t,n),r&&this.get(e.analyticsServerUrlV2,r,f.noOp)},this.sendRequestAsync=function(t){t.event_family=`session_event`;let n=ve()?Ee({...t}):null,r=this.asyncGet(e.analyticsServerUrl,t);return n&&this.asyncGet(e.analyticsServerUrlV2,n).catch(()=>{}),r},this.sendRequestSynchronous=function(t,n){t.event_family=`session_event`;let r=ve()?Ee({...t}):null;this.get(e.analyticsServerUrl,t,n,!1),r&&this.get(e.analyticsServerUrlV2,r,f.noOp,!1)},this.getAnalyticsServerUrl=()=>e.analyticsServerUrl}static{this.analyticsServerUrl=r}static{this.analyticsServerUrlV2=a}};function Oe(e){return typeof window>`u`||!window.shaka?!1:typeof shaka.Player==`function`&&e?.constructor===shaka.Player}function ke(e){return typeof window>`u`||!window.Hls?!1:typeof Hls==`function`&&e?.constructor===Hls}const Ae={isShaka:Oe,isHlsjs:ke};var je=class{setUp(){o.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){o.log(`No analytics on chrome cast receiver enabled!`);return}o.log(`adding message listener`),this.castSession.addMessageListener(n,(e,t)=>{o.log(`Received: ${e} ${t}`);try{let e=JSON.parse(t);this.handleReceiverMessage(e)}catch{o.error(`Message parsing failed ${t}`)}})}handleReceiverMessage(e){o.log(e)}sendMessage(e){let t=this.castSession.getApplicationMetadata();if(!t||t.namespaces.indexOf(`urn:x-cast:com.gumlet.ingest.cast`)<0){o.log(`No analytics on chrome cast receiver enabled!`);return}o.log(`Sending message: ${JSON.stringify(e)}`),this.castSession.sendMessage(n,e)}},Me=class{setUp(){this.messageBus=cast.receiver.CastReceiverManager.getInstance().getCastMessageBus(n,cast.receiver.CastMessageBus.MessageType.JSON),o.log(this.messageBus),this.messageBus.onMessage=e=>{o.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 Ne=`2.0.9`,Pe=500,Fe=`user-agent`,m=``,Ie=`?`,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`,Le=`major`,D=`model`,Re=`console`,O=`mobile`,k=`tablet`,A=`smarttv`,j=`wearable`,ze=`xr`,Be=`embedded`,Ve=`fetcher`,M=`inapp`,He=`brands`,N=`formFactors`,Ue=`fullVersionList`,P=`platform`,We=`platformVersion`,Ge=`bitness`,F=`sec-ch-ua`,Ke=F+`-full-version-list`,qe=F+`-arch`,Je=F+`-`+Ge,Ye=F+`-form-factors`,Xe=F+`-`+O,Ze=F+`-`+D,Qe=F+`-`+P,$e=Qe+`-version`,et=[He,Ue,O,D,P,We,E,N,Ge],tt=`Amazon`,I=`Apple`,nt=`ASUS`,rt=`BlackBerry`,L=`Google`,it=`Huawei`,at=`Lenovo`,ot=`Honor`,st=`LG`,ct=`Microsoft`,lt=`Motorola`,ut=`Nvidia`,dt=`OnePlus`,ft=`OPPO`,pt=`Samsung`,mt=`Sharp`,ht=`Sony`,gt=`Xiaomi`,_t=`Zebra`,vt=`Chrome`,yt=`Chromium`,R=`Chromecast`,bt=`Edge`,xt=`Firefox`,z=`Opera`,St=`Facebook`,Ct=`Sogou`,B=`Mobile `,V=` Browser`,wt=`Windows`,H=typeof window!==h.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===h.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===h.STRING},At=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=Nt(n[r]).split(`;v=`);t[r]={brand:i[0],version:i[1]}}else t[r]=Nt(n[r]);return t}},W=function(e){return kt(e)?e.toLowerCase():e},jt=function(e){return kt(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 kt(t)?t.replace(e,m):t},Mt=function(e){return K(/\\?\"/g,e)},Nt=function(e,t){return e=K(/^\s\s*/,String(e)),typeof t===h.UNDEFINED?e:e.substring(0,t)},Pt=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(Dt(t[n][r],e))return n===Ie?void 0:n}else if(Dt(t[n],e))return n===Ie?void 0:n;return t.hasOwnProperty(`*`)?t[`*`]:e},Ft={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:``},It={embedded:`Automotive`,mobile:`Mobile`,tablet:[`Tablet`,`EInk`],smarttv:`TV`,wearable:`Watch`,xr:[`VR`,`XR`],"?":[`Desktop`,`Unknown`],"*":void 0},Lt={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`},Rt={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[T,[S,B+`Chrome`]],[/webview.+edge\/([\w\.]+)/i],[T,[S,bt+` 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 `+at+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,xt+` 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+xt]],[/\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,pt+` Internet`]],[/metasr[\/ ]?([\d\.]+)/i],[T,[S,Ct+` Explorer`]],[/(sogou)mo\w+\/([\d\.]+)/i],[[S,Ct+` 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,St],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,Ve]],[/headlesschrome(?:\/([\w\.]+)| )/i],[T,[S,vt+` Headless`]],[/wv\).+chrome\/([\w\.]+).+edgw\//i],[T,[S,bt+` WebView2`]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[S,vt+` 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+xt],T],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[S,`Netscape`],T],[/(wolvic|librewolf)\/([\w\.]+)/i],[S,T],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[T,[S,xt+` 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,pt],[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,pt],[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,mt],[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,ot],[C,k]],[/honor([-\w ]+)[;\)]/i],[D,[w,ot],[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,it],[C,k]],[/(?:huawei) ?([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][\dc][adnt]?)\b(?!.+d\/s)/i],[D,[w,it],[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,gt],[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,gt],[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,dt],[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,ft],[C,O]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[D,[w,q,{OnePlus:[`203`,`304`,`403`,`404`,`413`,`415`],"*":ft}],[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,at],[C,k]],[/lenovo[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i],[D,[w,at],[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,lt],[C,O]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[D,[w,lt],[C,k]],[/\b(?:lg)?([vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[D,[w,st],[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,st],[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,ht],[C,O]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[D,`Xperia Tablet`],[w,ht],[C,k]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[D,[w,tt],[C,k]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[D,/(.+)/g,`Fire Phone $1`],[w,tt],[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,rt],[C,O]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[D,[w,nt],[C,k]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[D,[w,nt],[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,ct],[C,k]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[D,[w,`Fairphone`],[C,O]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[D,[w,ut],[C,k]],[/(sprint) (\w+)/i],[w,D,[C,O]],[/(kin\.[onetw]{3})/i],[[D,/\./g,` `],[w,ct],[C,O]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[D,[w,_t],[C,k]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[D,[w,_t],[C,O]],[/(philips)[\w ]+tv/i,/smart-tv.+(samsung)/i],[w,[C,A]],[/hbbtv.+maple;(\d+)/i],[[D,/^/,`SmartTV`],[w,pt],[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,st],[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,St],[C,A]],[/droid.+aft(\w+)( bui|\))/i],[D,[w,tt],[C,A]],[/(shield \w+ tv)/i],[D,[w,ut],[C,A]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[D,[w,mt],[C,A]],[/(bravia[\w ]+)( bui|\))/i],[D,[w,ht],[C,A]],[/(mi(tv|box)-?\w+) bui/i],[D,[w,gt],[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,Nt],[C,A]],[/(playstation \w+)/i],[D,[w,ht],[C,Re]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[D,[w,ct],[C,Re]],[/(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,Re]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[D,[w,pt],[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,ft],[C,j]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[D,[w,I],[C,j]],[/(opwwe\d{3})/i],[D,[w,dt],[C,j]],[/(moto 360)/i],[D,[w,lt],[C,j]],[/(smartwatch 3)/i],[D,[w,ht],[C,j]],[/(g watch r)/i],[D,[w,st],[C,j]],[/droid.+; (wt63?0{2,3})\)/i],[D,[w,_t],[C,j]],[/droid.+; (glass) \d/i],[D,[w,L],[C,ze]],[/(pico) ([\w ]+) os\d/i],[w,D,[C,ze]],[/(quest( \d| pro)?s?).+vr/i],[D,[w,St],[C,ze]],[/mobile vr; rv.+firefox/i],[[C,ze]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[w,[C,Be]],[/(aeobc)\b/i],[D,[w,tt],[C,Be]],[/(homepod).+mac os/i],[D,[w,I],[C,Be]],[/windows iot/i],[[C,Be]],[/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,bt+`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,Ft]],[/(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,Ft],[S,wt]],[/(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,rt]],[/(?: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,xt+` 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]]},zt=(function(){var e={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}};return G.call(e.init,[[g,[S,T,Le,C]],[_,[E]],[v,[C,D,w]],[y,[S,T]],[b,[S,T]]]),G.call(e.isIgnore,[[g,[T,Le]],[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})(),Bt=function(e,t){var n=zt.init[t],r=zt.isIgnore[t]||0,i=zt.isIgnoreRgx[t]||0,a=zt.toString[t]||0;function o(){G.call(this,n)}return o.prototype.getItem=function(){return e},o.prototype.withClientHints=function(){return U?U.getHighEntropyValues(et).then(function(t){return e.setCH(new Vt(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)&&!Dt(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 Vt(e,t){if(e||={},G.call(this,et),t)G.call(this,[[He,At(e[F])],[Ue,At(e[Ke])],[O,/\?1/.test(e[Xe])],[D,Mt(e[Ze])],[P,Mt(e[Qe])],[We,Mt(e[$e])],[E,Mt(e[qe])],[N,At(e[Ye])],[Ge,Mt(e[Je])]]);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`,Bt(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&&Pt.call(this.data,this.ua,this.rgxMap),this.itemType){case g:this.set(Le,jt(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[Ue]||e[He],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!=yt||r==bt&&/WebView2/.test(a))&&(a=q(a,Lt),r=this.get(S),r&&!/Chrom/.test(r)&&/Chrom/.test(a)||this.set(S,a).set(T,o).set(Le,jt(o)),r=a),this.itemType==y&&a==yt&&this.set(T,o)}break;case _:var s=e[E];s&&(s&&e[Ge]==`64`&&(s+=`64`),Pt.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={};Pt.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++],It);else l=q(e[N],It);this.set(C,l)}break;case b:var ee=e[P];if(ee){var te=e[We];ee==wt&&(te=parseInt(jt(te),10)>=13?`11`:`10`),this.set(S,ee).set(T,te)}this.get(S)==wt&&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?(Ot(e,!0)?(typeof t===h.OBJECT&&(n=t),t=e):(n=e,t=void 0),e=void 0):typeof e===h.STRING&&!Ot(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[Fe]?n[Fe]:H&&H.userAgent?H.userAgent:m,s=new Vt(n,!0),c=t?Tt(Rt,t):Rt,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 kt(e)&&(o=Nt(e,Pe)),this}]]).setUA(o),this}Y.VERSION=Ne,Y.BROWSER=Et([S,T,Le,C]),Y.CPU=Et([E]),Y.DEVICE=Et([D,w,C,Re,O,A,k,j,Be]),Y.ENGINE=Y.OS=Et([S,T]);const Ht=()=>{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 Ut=class e extends he{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=r}},Wt=class e extends he{constructor(...t){super(...t),this.sendRequest=function(t,n){t.event_family=`session`;let r=ve()?Ee({...t}):null;this.get(e.analyticsServerUrl,t,n),r&&this.get(e.analyticsServerUrlV2,r,f.noOp)},this.sendRequestSynchronous=function(t,n){t.event_family=`session`;let r=ve()?Ee({...t}):null;this.get(e.analyticsServerUrl,t,n,!1),r&&this.get(e.analyticsServerUrlV2,r,f.noOp,!1)},this.getAnalyticsServerUrl=()=>e.analyticsServerUrl}static{this.analyticsServerUrl=r}static{this.analyticsServerUrlV2=a}};const X=new Y().getResult();var Gt=class{constructor(e){this.SDKVersion=`1.0.0`,this.config=e,this.sessionCreationCall=new Wt,this.playerInitCall=new Ut,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??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??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,custom_user_email:this.userEMail,custom_content_type:this.customContentType,custom_video_duration_millis:this.customVideoDurationMillis,custom_encoding_variant:this.customEncodingVariant,custom_video_language:this.customVideoLanguage,custom_video_id:this.customVideoId,custom_video_series:this.customVideoSeries,custom_video_producer:this.customVideoProducer,custom_video_title:this.customVideoTitle,custom_video_variant_name:this.customVideoVariantName,custom_video_variant:this.customVideoVariant},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=Ht(),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)}},Kt=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}},qt=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){o.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){o.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,f.noOp)}},Jt=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.previousStateMono=0,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:n}=await import(`./GumletStateMachine-C24imGQ5.mjs`);if(this.analyticsStateMachine=new n(this.stateMachineCallbacks,t),!e){let{HTML5Adapter:e}=await import(`./HTML5Adapter-CZqoUTTi.mjs`);return this.adapter=new e(this.mediaElement,this.record,this.analyticsStateMachine),this.analyticsStateMachine}if(Ae.isHlsjs(e)){let{HlsjsAdapter:t}=await import(`./HlsjsAdapter-CFz6-RzE.mjs`);this.adapter=new t(e,this.record,this.analyticsStateMachine)}else if(Ae.isShaka(e)){let{ShakaAdapter:n}=await import(`./ShakaAdapter-BporBfea.mjs`);this.adapter=new n(e,this.record,this.analyticsStateMachine,t.mediaElement??null)}else{let{HTML5Adapter:t}=await import(`./HTML5Adapter-CZqoUTTi.mjs`);this.adapter=new t(e,this.record,this.analyticsStateMachine)}this.adapter||o.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-C24imGQ5.mjs`);this.analyticsStateMachine=new n(this.stateMachineCallbacks,t);let{HlsjsAdapter:r}=await import(`./HlsjsAdapter-CFz6-RzE.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-C24imGQ5.mjs`);this.analyticsStateMachine=new n(this.stateMachineCallbacks,t);let{ShakaAdapter:r}=await import(`./ShakaAdapter-BporBfea.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-C24imGQ5.mjs`);this.analyticsStateMachine=new n(this.stateMachineCallbacks,t);let{HTML5Adapter:r}=await import(`./HTML5Adapter-CZqoUTTi.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-C24imGQ5.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,_e((t.enable_analytics_v2===!0||i())&&t.disable_analytics_v2!==!0),this.analyticsCall=new De,this.castClient=new je,this.castReceiver=new Me,this.session=new Gt(t),xe(()=>{let e=this.session.sessionData,t=this.session.playerData;return{...e&&typeof e==`object`?e:{},...t&&typeof t==`object`?t:{}}}),this.sampleBuilder=new Kt(t,this.session),this.publisher=new qt(this.analyticsCall,this.sampleBuilder),this.init(),this.setupSample(),this.setupStateMachineCallbacks(),typeof performance<`u`&&typeof performance.now==`function`?this.previousStateMono=performance.now():this.previousStateMono=this.previousStateTimeStamp.getTime()}init(){if(!this.isCastReceiver&&(this.config.property_id===``||!f.validString(this.config.property_id))){console.error(`Invalid analytics property_id provided`);return}o.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(){let e;e=typeof performance<`u`&&typeof performance.now==`function`?performance.now()-this.previousStateMono:new Date().getTime()-this.previousStateTimeStamp.getTime();let t=Math.round(e);return t<=0&&this.previousState!==void 0?1:Math.max(0,t)}setState(e=void 0){e&&(this.previousState=e,this.previousStateTimeStamp=new Date,typeof performance<`u`&&typeof performance.now==`function`?this.previousStateMono=performance.now():this.previousStateMono=this.previousStateTimeStamp.getTime())}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)=>{o.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(p.SETUP,{millis_from_previous_event:i}),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,n)=>{if(n&&n.resuming){this.isAllowedToSendSamples=!1,o.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:s,userId:c,impressionId:l}=this.sample,u={type:e.CAST_RECEIVER_CONFIG_MESSAGE,data:{config:this.config,userId:c,domain:r,path:i,language:a,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 Yt=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 Jt(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(ke(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(Oe(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)}customEventHandler(e,t){if(!this.ready_||!this.analytics_){console.warn(`${Z} customEventHandler ignored — SDK not initialized (check property_id).`);return}this.analytics_.customEventHandler(e,t)}customEventHandlerAsync(e,t){return!this.ready_||!this.analytics_?Promise.reject(Error(`${Z} customEventHandlerAsync — SDK not initialized (check property_id).`)):this.analytics_.customEventHandlerAsync(e,t)}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 Q;const Xt=(e,t={})=>Q.register(e,t),Zt=(e,t={})=>Q.registerHLSJSPlayer(e,t),Qt=(e,t={})=>Q.registerShakaPlayer(e,t),$t=(e,t={})=>Q.registerHTML5Player(e,t),en=(e,t={})=>Q.registerReactNativeVideoPlayer(e,t),tn=()=>Q.getCurrentImpressionId(),nn=()=>Q.analyticsStateMachine,rn=e=>Q.updateCustomData(e),an=e=>Q.updateCustomVideoData(e),on=e=>Q.updateCustomUserData(e),sn=e=>Q.updateCustomPlayerData(e),cn=(e,t)=>Q.customEventHandler(e,t),ln=(e,t)=>new Promise((n,r)=>{Q.customEventHandlerAsync(e,t).then(e=>{n(e)}).catch(e=>{r(e)})}),$=e=>(Q=new Jt(e),{register:Xt,registerHLSJSPlayer:Zt,registerShakaPlayer:Qt,registerHTML5Player:$t,registerReactNativeVideoPlayer:en,getCurrentImpressionId:tn,stateMachine:nn,updateCustomData:rn,updateCustomVideoData:an,updateCustomUserData:on,updateCustomPlayerData:sn,setCustomData:Q.setCustomData,setCustomDataOnce:Q.setCustomDataOnce,customEventHandler:cn,customEventHandlerAsync:ln});$.Players=t,$.CdnProviders=s,$.gumletInsightsEvents=e,$.gumletSupportedPlayers=t,typeof window<`u`&&(window.gumlet=window.gumlet||{},window.gumlet.insights=$,window.gumlet.GumletInsights=Yt,window.gumletInsightsEvents=e,window.gumletSupportedPlayers=t,window.gumlet.insightsFullCustomTestConfig=c);var un={insights:$,gumletInsightsEvents:e,gumletSupportedPlayers:t,fullCustomAnalyticsConfig:c};export{Yt as GumletInsights,un as default,c as fullCustomAnalyticsConfig};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gumlet/insights-js-core",
3
- "version": "2.0.3",
3
+ "version": "2.1.0",
4
4
  "description": "Gumlet Insights allows you to collect data from Video playback.",
5
5
  "main": "./dist/main.mjs",
6
6
  "browser": "dist/main.iife.js",
@@ -1,9 +0,0 @@
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.3
8
-
9
- import{t as e}from"./Logger-DUjT1Fln.mjs";import{t}from"./Events-BytR6Vlt.mjs";var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),l=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=a(t),l=0,u=c.length,d;l<u;l++)d=c[l],!s.call(e,d)&&d!==n&&r(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(o=i(t,d))||o.enumerable});return e},u=((e,t,i)=>(i=e==null?{}:n(o(e)),l(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)))(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){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){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){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){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){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 p(e.prototype,n),e.prototype._fsm.config=n,e}function f(e,t){return p(e,new o(t,u)),e._fsm(),e}function p(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){e.exports=function(e,t,n,r,i){this.message=e,this.transition=t,this.from=n,this.to=r,this.current=i}})])})}))(),1),d=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(t,n,r){this.fsm.can(t)?this.fsm[t](r,n):e.log(`Ignored Event: ${t}`)}updateMetadata(e){this.callbacks.updateSample(e)}allStates(){return Object.values(this.States)}createStateMachine(){let n=this,r=this.States,i=this.opts,a=[t.PLAY,t.PAUSE,t.SEEK,t.SEEKED,t.PLAYBACK_PLAYING,t.PLAYBACK_FINISHED,t.READY,t.SCREEN_RESIZE,t.END,t.ERROR,t.NON_FATAL_ERROR,t.UN_MUTE,t.MUTE];this.fsm=new u.default({init:r.SETUP,transitions:[{name:t.TIMECHANGED,from:r.SETUP,to:r.SETUP},{name:t.READY,from:[r.SETUP,r.ERROR],to:r.READY},{name:t.SOURCE_LOADED,from:r.SETUP,to:r.SETUP},{name:t.PLAY,from:r.READY,to:r.STARTUP},{name:t.SOURCE_LOADED,from:r.READY,to:r.READY},{name:t.SEEK,from:r.READY,to:r.READY},{name:t.SEEKED,from:r.READY,to:r.READY},{name:t.MUTE,from:r.READY,to:r.READY},{name:t.UN_MUTE,from:r.READY,to:r.READY},{name:t.VIDEO_CHANGE,from:r.READY,to:r.READY},{name:t.AUDIO_CHANGE,from:r.READY,to:r.READY},{name:t.TIMECHANGED,from:r.STARTUP,to:r.PLAYING},{name:t.START_BUFFERING,from:r.STARTUP,to:r.STARTUP},{name:t.END_BUFFERING,from:r.STARTUP,to:r.STARTUP},{name:t.VIDEO_CHANGE,from:r.STARTUP,to:r.STARTUP},{name:t.AUDIO_CHANGE,from:r.STARTUP,to:r.STARTUP},{name:t.SEEK,from:r.STARTUP,to:r.STARTUP},{name:t.SEEKED,from:r.STARTUP,to:r.STARTUP},{name:t.SOURCE_LOADED,from:r.STARTUP,to:r.STARTUP},{name:t.END,from:r.STARTUP,to:r.END},{name:t.TIMECHANGED,from:r.PLAYING,to:r.PLAYING},{name:t.END_BUFFERING,from:r.PLAYING,to:r.PLAYING},{name:t.SEEK,from:r.PLAYING,to:r.PLAYING},{name:t.SEEKED,from:r.PLAYING,to:r.PLAYING},{name:t.SOURCE_LOADED,from:r.PLAYING,to:r.PLAYING},{name:t.VIDEO_CHANGE,from:r.PLAYING,to:r.PLAYING},{name:t.AUDIO_CHANGE,from:r.PLAYING,to:r.PLAYING},{name:t.MUTE,from:r.PLAYING,to:r.PLAYING},{name:t.UN_MUTE,from:r.PLAYING,to:r.PLAYING},{name:t.PAUSE,from:r.PLAYING,to:r.PAUSE},{name:t.START_BUFFERING,from:r.PLAYING,to:r.REBUFFERING},{name:t.END,from:r.PLAYING,to:r.END},{name:t.START_BUFFERING,from:r.REBUFFERING,to:r.REBUFFERING},{name:t.VIDEO_CHANGE,from:r.REBUFFERING,to:r.REBUFFERING},{name:t.AUDIO_CHANGE,from:r.REBUFFERING,to:r.REBUFFERING},{name:t.PLAY,from:r.REBUFFERING,to:r.PLAYING},{name:t.TIMECHANGED,from:r.REBUFFERING,to:r.PLAYING},{name:t.SEEKED,from:r.REBUFFERING,to:r.PLAYING},{name:t.PAUSE,from:r.REBUFFERING,to:r.PAUSE},{name:t.END,from:r.REBUFFERING,to:r.END},{name:t.TIMECHANGED,from:r.PAUSE,to:r.PAUSE},{name:t.SEEKED,from:r.PAUSE,to:r.PAUSE},{name:t.VIDEO_CHANGE,from:r.PAUSE,to:r.PAUSE},{name:t.AUDIO_CHANGE,from:r.PAUSE,to:r.PAUSE},{name:t.MUTE,from:r.PAUSE,to:r.PAUSE},{name:t.UN_MUTE,from:r.PAUSE,to:r.PAUSE},{name:t.PLAY,from:r.PAUSE,to:r.PLAYING},{name:t.SEEK,from:r.PAUSE,to:r.PAUSED_SEEKING},{name:t.END,from:r.PAUSE,to:r.END},{name:t.SEEK,from:r.PAUSED_SEEKING,to:r.PAUSED_SEEKING},{name:t.AUDIO_CHANGE,from:r.PAUSED_SEEKING,to:r.PAUSED_SEEKING},{name:t.VIDEO_CHANGE,from:r.PAUSED_SEEKING,to:r.PAUSED_SEEKING},{name:t.START_BUFFERING,from:r.PAUSED_SEEKING,to:r.PAUSED_SEEKING},{name:t.END_BUFFERING,from:r.PAUSED_SEEKING,to:r.PAUSED_SEEKING},{name:t.PLAY,from:r.PAUSED_SEEKING,to:r.PAUSED_SEEKING},{name:t.SEEKED,from:r.PAUSED_SEEKING,to:r.PAUSE},{name:t.TIMECHANGED,from:r.PAUSED_SEEKING,to:r.PLAYING},{name:t.PAUSE,from:r.PAUSED_SEEKING,to:r.PAUSE},{name:t.END,from:r.PAUSED_SEEKING,to:r.END},{name:t.SEEK,from:r.END,to:r.END},{name:t.SEEKED,from:r.END,to:r.END},{name:t.TIMECHANGED,from:r.END,to:r.END},{name:t.END_BUFFERING,from:r.END,to:r.END},{name:t.START_BUFFERING,from:r.END,to:r.END},{name:t.END,from:r.END,to:r.END},{name:t.PLAY,from:r.END,to:r.PLAYING},{name:t.ERROR,from:this.allStates(),to:r.ERROR},{name:t.PAUSE,from:r.ERROR,to:r.ERROR},{name:t.PLAY,from:r.ERROR,to:r.PLAYING},{name:t.TIMECHANGED,from:r.ERROR,to:r.PLAYING},{name:t.SOURCE_LOADED,from:r.ERROR,to:r.ERROR},{name:t.METADATA_LOADED,from:r.ERROR,to:r.ERROR},{name:t.START_BUFFERING,from:r.ERROR,to:r.REBUFFERING},{name:t.SEEK,from:r.ERROR,to:r.ERROR},{name:t.SEEKED,from:r.ERROR,to:r.ERROR},{name:t.MUTE,from:r.ERROR,to:r.ERROR},{name:t.UN_MUTE,from:r.ERROR,to:r.ERROR},{name:t.VIDEO_CHANGE,from:r.ERROR,to:r.ERROR},{name:t.AUDIO_CHANGE,from:r.ERROR,to:r.ERROR},{name:t.END_BUFFERING,from:r.ERROR,to:r.ERROR},{name:t.END,from:r.ERROR,to:r.END},...this.allStates().map(e=>({name:t.NON_FATAL_ERROR,from:e,to:e})),{name:t.UNLOAD,from:this.allStates(),to:r.END},{name:t.START_CAST,from:[r.READY,r.PAUSE],to:r.CASTING},{name:t.PAUSE,from:r.CASTING,to:r.CASTING},{name:t.PLAY,from:r.CASTING,to:r.CASTING},{name:t.TIMECHANGED,from:r.CASTING,to:r.CASTING},{name:t.MUTE,from:r.CASTING,to:r.CASTING},{name:t.SEEK,from:r.CASTING,to:r.CASTING},{name:t.SEEKED,from:r.CASTING,to:r.CASTING},{name:t.END_CAST,from:r.CASTING,to:r.READY}],methods:{onBeforeTransition(e,i,o){n.callbacks.playbackWatchTime(n.playbackWatchTime),a.includes(e.transition)&&(e.transition===t.PLAYBACK_FINISHED&&(n.previousRecordTime=0),o&&(n.previousRecordTime=o.currentTime)),e.transition===t.SEEK&&e.from===r.PAUSE&&(n.seekedFrom=n.lastPlayHeadDuration),o&&e.transition!==t.SOURCE_LOADED&&(n.lastPlayHeadDuration=o.currentTime*1e3)},onLeaveState(i,a,o){if(!a)return;let s=a-n.onEnterStateTimestamp;o&&i.to!==r.PAUSED_SEEKING&&(e.log(`Setting video time end to ${o.currentTime}, going to ${i.to}`),n.callbacks.setVideoTimeEndFromEvent(o));let c=i.from.toLowerCase();if(i.from===r.PAUSED_SEEKING){let t=a-(n.seekStartedAt??a);n.seekStartedAt=null,n.callbacks.playback_seeked(n.seekedFrom,o.currentTime*1e3,t,i.to),n.callbacks.heartbeat(a,r.PAUSE.toLowerCase(),o),e.log(`Seek was ${t}ms`)}else i.transition===t.UNLOAD&&i.from===r.PLAYING?n.callbacks.playingAndBye(s,c,o):i.from===r.PAUSE&&i.to!==r.PAUSED_SEEKING&&i.to!==r.PLAYING&&(n.callbacks.setVideoTimeStartFromEvent(i.transition),n.callbacks.pause(s,c,o),n.callbacks.heartbeat(a,c,o))},onAfterTransition(r,i,a){n.callbacks.resetSessionExpiry(),r.transition===t.VIDEO_CHANGE?n.callbacks.videoChange(a):r.transition===t.AUDIO_CHANGE?n.callbacks.audioChange(a):r.transition===t.MUTE?(e.log(`Setting sample to muted`),n.callbacks.mute(i,a)):r.transition===t.UN_MUTE&&(e.log(`Setting sample to unmuted`),n.callbacks.unMute(i,a))},onEnterState(e,o,s){e.to===r.ERROR&&(n.pendingErrorRecovery_=!1),n.callbacks.playbackWatchTime(n.playbackWatchTime),a.includes(e.transition)&&s&&(n.previousRecordTime=s.currentTime),e.transition!==t.NON_FATAL_ERROR&&(e.from===`none`&&i.starttime?n.onEnterStateTimestamp=i.starttime:n.onEnterStateTimestamp=o||Date.now()),(e.to===r.PLAYING&&(e.from===r.STARTUP||e.from===r.PAUSE||e.from===r.REBUFFERING||e.from===r.PAUSED_SEEKING||e.from===r.ERROR)||e.from===`none`&&e.to===r.SETUP)&&(n.heartbeatTimestamp=e.from===`none`&&i.starttime?i.starttime:o||Date.now()),s&&e.to!==r.PAUSED_SEEKING&&n.callbacks.setVideoTimeStartFromEvent(s)},onEnterSetup(e,t,a){e.from===`none`&&n.callbacks.setup(t,r.SETUP,a,i)},onEnterReady(e,t,i){e.from===r.SETUP&&n.callbacks.ready(t,r.READY,i)},onEnterStartup(e,i,a){e.transition===t.PLAY&&(n.playTimeStamp=new Date,n.callbacks.first_play(i,r.STARTUP,a))},onEnterPlaying(e,i,a){e.transition===t.PLAY&&e.from===r.PAUSE?(n.callbacks.play(i,r.PLAYING,a),n.callbacks.playing(i,r.PLAYING,a),n.callbacks.heartbeat(i,r.PLAYING,a)):e.from===r.STARTUP?(n.startupBufferingPending&&(n.startupBufferingPending=!1,n.callbacks.start_rebuffer(i,r.REBUFFERING,a),n.callbacks.end_rebuffer(i,r.REBUFFERING,a)),n.callbacks.playing(i,r.PLAYING,a),n.callbacks.playback_started(a)):e.from===r.REBUFFERING?(n.callbacks.end_rebuffer(i,r.REBUFFERING,a),n.pendingErrorRecovery_&&(n.pendingErrorRecovery_=!1,n.callbacks.error_recovered(i,r.ERROR,a))):e.from===r.ERROR&&n.callbacks.error_recovered(i,r.ERROR,a)},onEnterPause(e,t,i){e.from===r.PLAYING&&(n.callbacks.pause(t,r.PAUSE,i),n.callbacks.heartbeat(t,r.PAUSE,i))},onEnterRebuffering(e,i,a){e.transition===t.START_BUFFERING&&(n.callbacks.start_rebuffer(i,r.REBUFFERING,a),e.from===r.ERROR&&(n.pendingErrorRecovery_=!0))},onBeforeStartBuffering(e,t,i){e.from===r.STARTUP&&(n.startupBufferingPending=!0)},onEnterEnd(e,t,i){n.callbacks.end(t,r.END,i),n.callbacks.heartbeat(t,r.END,i)},onBeforeSourceLoaded(e,t,i){let a=e.from===r.PLAYING&&n.playTimeStamp?Date.now()-n.playTimeStamp.getTime():null;n.callbacks.loaded(t,r.READY,i,a)},onSeek(e,t,r){r&&(n.previousRecordTime=r.currentTime),n.callbacks.playbackWatchTime(n.playbackWatchTime),n.seekStartedAt=n.seekStartedAt??t},onSeeked(e,t,r){r&&(n.previousRecordTime=r.currentTime),n.callbacks.playbackWatchTime(n.playbackWatchTime),n.seekedTimestamp=t,n.seekStartedAt=null},onTimechanged(t,r,i){n.callbacks.playbackWatchTime(n.playbackWatchTime);let a=i.currentTime-n.previousRecordTime;a>0&&a<5&&(n.playbackWatchTime+=Math.round(a*1e3),n.previousRecordTime=i.currentTime);let o=r-n.heartbeatTimestamp;o>1e4&&(n.callbacks.setVideoTimeEndFromEvent(i),e.log(`Sending heartbeat`),n.callbacks.heartbeat(o,t.from.toLowerCase(),i),n.heartbeatTimestamp=r,n.callbacks.setVideoTimeStartFromEvent(i),n.callbacks.resetSessionExpiry())},onPlayerError(e,t,r){n.callbacks.error(r)},onPlayerNonFatalError(e,t,r){n.callbacks.error(r)}}})}static pad(e,t){return(e+Array(t).join(` `)).slice(0,t)}};export{d as GumletStateMachine};
@@ -1,9 +0,0 @@
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.3
8
-
9
- const e=`urn:x-cast:com.gumlet.ingest.cast`,t=`https://ingest.gumlytics.com`,n=1e4,r=new 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}};export{e as i,t as n,n as r,r as t};