!function(){"use strict";class t{constructor(){this.forceImprTime=3,this.dnt=!0,this.segment={maxSegments:400,maxSegmentStateItems:86400,minSegmentDuration:1e3},this.enabled=!0,this.projectVersion="1.0",this.configVersion=1,this.sdkVersion="2.4.3",this.tech="s2s-w",this.projectName="es1",this.trackingUrl="https://es1-s2s.sensic.net",this.streamCustom=["c1","c2","programmname","streamlength","channelname","airtime","streamtype","playerid","productname","brandname"],this.contentCustom=["c1","c2","c3","c4","c5","c6","c7","c8","c9","c10","productname","brandname"],this.heartbeat={enabled:!0,interval:[1,2,3,5,10,20],maximum:0},this.crashReporting={sampling:0,dsn:"https://c008894239817c0f17863da3b0d96ea8@o4506071144792064.ingest.sentry.io/4506071148265472",scriptUrl:"https://js.sentry-cdn.com/c008894239817c0f17863da3b0d96ea8.min.js",ignoreErrors:"#noreport"}}}class e{static enable(){var t,n,i,r;if(e.shouldEnableLogging()){s.output("Sensic crash reporting enabled","log","fcall");const e=document.createElement("script"),o=document.getElementsByTagName("script")[0];if(o){e.type="text/javascript",e.src=null===(n=null===(t=window.s2sSdkConfig)||void 0===t?void 0:t.crashReporting)||void 0===n?void 0:n.scriptUrl,e.setAttribute("crossorigin","anonymous"),o.parentNode.insertBefore(e,o);const s=document.createElement("script");s.innerHTML=`\n Sentry.onLoad(function() {\n class GfKIntegration {\n name = "GfKIntegration";\n \n setupOnce() {\n Sentry.addGlobalEventProcessor(event => {\n const clientHasSentry = window.gfkSentryHub.getClient().getDsn().projectId !== Sentry.getCurrentHub().getClient().getDsn().projectId;\n if (event?.tags?.sentryClient === 'gfkClient') { // prevent recursive calls\n return event;\n }\n /* some event filters */\n const frames = event.exception?.values[0]?.stacktrace?.frames;\n if(frames && (frames[frames.length-1].filename.indexOf('.sensic.net') !== -1 || frames[frames.length-1].filename.indexOf('localhost:8082') !== -1)){\n window.gfkSentryHub.captureEvent(event);\n return null;\n } else if(!clientHasSentry) {\n return null;\n }\n /* some event filters end */\n return event;\n });\n }\n }\n window.gfkSentry = new Sentry.BrowserClient({\n dsn: '${null===(r=null===(i=window.s2sSdkConfig)||void 0===i?void 0:i.crashReporting)||void 0===r?void 0:r.dsn}',\n enabled: true,\n environment: '${window.s2sSdkConfig.projectName||"development"}',\n attachStacktrace: true,\n transport: Sentry.makeFetchTransport,\n integrations: [new GfKIntegration()],\n beforeSend: (event, hint) => {\n const ctvEnv = '${window.gfkS2sConf.url.includes("/ctv/")?"ctv-":""}';\n let ver = "agent-${window.s2sSdkConfig.projectName||"development"}"+"-"+ctvEnv+window.s2sSdkConfig.sdkVersion;\n const frames = event.exception?.values[0]?.stacktrace?.frames;\n if(frames && frames[frames.length-1].filename.indexOf('s2s-web.js') === -1){\n ver = "extension-${window.s2sSdkConfig.projectName||"development"}"+"-"+ctvEnv+window.extensionConfig.version;\n }\n event.release = ver;\n event.environment = '${window.s2sSdkConfig.projectName||"development"}';\n return event;\n },\n allowUrls: [\n ".sensic.net",\n "http://localhost:8082/"\n ],\n\n // Set tracesSampleRate to 1.0 to capture 100%\n // of transactions for performance monitoring.\n // We recommend adjusting this value in production\n // tracesSampleRate: 1.0\n });\n window.gfkSentryHub = new Sentry.Hub(window.gfkSentry);\n window.gfkSentryHub.run(currentHub => {\n currentHub.configureScope(function (scope) {\n scope.setTag("sentryClient", "gfkClient");\n });\n });\n });\n `,e.onload=()=>{e.parentNode.appendChild(s)}}}}static log(t,e){var n,i;"error"===e&&(null===(i=null===(n=window.s2sSdkConfig)||void 0===n?void 0:n.crashReporting)||void 0===i?void 0:i.sampling)>0&&window.gfkS2sConf.crashReporting&&window.gfkSentryHub&&window.gfkSentryHub.captureMessage(t)}static isScriptMissingCrossorigin(t){const e=document.querySelector(`script[src*='${t}']`);return e&&"anonymous"!==e.getAttribute("crossorigin")}static checkImplementation(t){t&&(this.isScriptMissingCrossorigin("playerextension.js")&&s.warn('WARN: Crash reporting is enabled but "crossorigin" attribute is missing from playerextension.js script. Please check our documentation here: https://confluence-docu.gfk.com/pages/viewpage.action?pageId=102334502#GenericPlayerExtension(JSSDK)-Theidea-somepseudocode'),this.isScriptMissingCrossorigin("s2s-web.js")&&s.warn('WARN: Crash reporting is enabled but "crossorigin" attribute is missing from the tag. Please check our documentation here: https://confluence-docu.gfk.com/pages/viewpage.action?pageId=13044049'))}static shouldEnableLogging(){var t,e,n,i,r,o;if(window&&(null===(e=null===(t=null===window||void 0===window?void 0:window.s2sSdkConfig)||void 0===t?void 0:t.crashReporting)||void 0===e?void 0:e.sampling)>0&&(null===(n=null===window||void 0===window?void 0:window.gfkS2sConf)||void 0===n?void 0:n.crashReporting)){const t=(null===(r=null===(i=window.s2sSdkConfig)||void 0===i?void 0:i.crashReporting)||void 0===r?void 0:r.sampling)||0;let e;if(sessionStorage){if(sessionStorage.getItem("sensicCrashReporting"))return this.checkImplementation("true"===sessionStorage.getItem("sensicCrashReporting")),"true"===sessionStorage.getItem("sensicCrashReporting");e=100*Math.random(),sessionStorage.setItem("sensicCrashReporting",(t>e)+"")}else e=100*Math.random();return this.checkImplementation(t>e),t>e}if(null===(o=null===window||void 0===window?void 0:window.gfkS2sConf)||void 0===o?void 0:o.crashReporting)return!1;{const t=(null===window||void 0===window?void 0:window.extensionConfig)?"https://confluence-docu.gfk.com/pages/viewpage.action?pageId=102334502":"https://confluence-docu.gfk.com/display/SENSIC/Configuration+for+Websites";return s.warn(`WARN: Crash reporting is disabled at the moment. Please consider its activation as documented here: ${t}`),!1}}}const n={none:0,error:1,warn:2,info:3,log:4,debug:5},i=["none","debug","log","info","warn","error"];class s{static debug(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};s.output(t,"debug",e.coloring,e.extraObj)}static log(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};s.output(t,"log",e.coloring,e.extraObj)}static info(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};s.output(t,"info",e.coloring,e.extraObj)}static warn(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};s.output(t,"warn",e.coloring,e.extraObj)}static error(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};s.output(t,"error",e.coloring,e.extraObj)}static output(t){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"log",r=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0;var a,d;if(!(n[i]>n[s.logLevel])){if(t.match(null===(d=null===(a=window.s2sSdkConfig)||void 0===a?void 0:a.crashReporting)||void 0===d?void 0:d.ignoreErrors)||e.log(t,i),s.url&&XMLHttpRequest){const e=new XMLHttpRequest,n=s.url+"?"+i+"="+encodeURIComponent(t+(o?"\n"+JSON.stringify(o):""))+"&src=S2S";e.open("GET",n,!0),e.send()}if("undefined"!=typeof console){const e=(r?"%c ":"")+t+(r?" %c":""),n=console;"function"==typeof n[i]?"fcall"===r?o?n[i]("GFK: "+e,"background: #060; color: #fff","","object"==typeof o&&Array.from?Array.from(o):o):n[i]("GFK: "+e,"background: #060; color: #fff",""):"request"===r?n[i]("GFK: "+e,"background: #059; color: #fff","",o):n[i]("GFK: "+e):n.error("GFK: "+e)}}}static formatDuration(t){const e=t%1e3,n=(t=(t-e)/1e3)%60,i=(t=(t-n)/60)%60,s=(t-i)/60;return(s?s+":":"")+("0"+i).slice(-2)+":"+("0"+n).slice(-2)+"."+("00"+e).slice(-3)}static readFromTagConf(){this.readFromConf(window.gfkS2sConf)}static readFromConnectorConf(){this.readFromConf(window.gfkConnectorConf)}static readFromLocalStorage(){try{if(window.localStorage){const t=window.localStorage.getItem("sensic-logLevel");r(t)&&(s.logLevel=t)}}catch(t){console.warn("Couldn't read log settings from local storage:",t)}}static readFromConf(t){r(null==t?void 0:t.logLevel)&&(s.logLevel=t.logLevel),(null==t?void 0:t.logUrl)&&(s.url=t.logUrl)}}function r(t){return i.includes(t)}s.logLevel="none",s.url=null;class o{constructor(t){this.appType=t.hasOwnProperty("type")?t.type:"WEB";const e=o.getParticularDeviceType(),n=t.hasOwnProperty("device")?t.device:"UNKNOWN";this.deviceType="UNKNOWN"===e?n:e}static determineDeviceType(t,e){let n="";return e.match(/Linux/i)&&t.match(/(WEBOS)/i)&&(n="Smart-TV"),n}static determineOs(t,e){let n="";return e.match(/Linux /i)&&t.match(/WEBOS/i)&&(n="WebOS"),n}static getPlatform(){return o.isWebContext()?window.navigator.platform:""}static getOperatingSystem(){const t=o.getUserAgent(),e=o.getPlatform();return o.determineOs(t,e)}static getParticularDeviceType(){const t=o.getUserAgent(),e=o.getPlatform();return o.determineDeviceType(t,e)}static getUserAgent(){return o.isWebContext()?window.navigator.userAgent:""}static getTimeOffset(){return o.timeOffset}static getTimeWithOffset(){return o.getUTCTimeStamp()+o.getTimeOffset()}static setTimeOffset(){"idle"!==o.dateStatus&&"canceled"!==o.dateStatus||(o.dateStatus="waiting",o.getServerDate())}static isDntEnabled(){return o.config.dnt}static setConfig(t){o.isHttp()&&["trackingUrl"].forEach((t=>{window.s2sSdkConfig[t]=window.s2sSdkConfig[t].replace(/^https:/,"http:")})),o.config=t}static init(t,e){var n;o.suiapiV2=e,o.tagConf=t,"undefined"!=typeof document&&(o.suiapiV2.init(o.tagConf.optin),(null===(n=window.gfkS2s)||void 0===n?void 0:n.scb)&&"function"==typeof window.gfkS2s.scb&&window.gfkS2s.scb(o.suiapiV2.instanceID))}static getInstanceID(){return o.suiapiV2.instanceID}static getServerDate(){window.addEventListener("message",(t=>{t.data.relayRequestServerDate&&"finished"!==o.dateStatus&&"canceled"!==o.dateStatus&&(o.dateStatus="finished",o.setCalculatedOffset(t.data.relayRequestServerDate))})),setTimeout((()=>{"finished"!==o.dateStatus&&(o.dateStatus="canceled",s.output("Request Timeout!","warn"))}),3e3)}static setCalculatedOffset(t){const e=o.getUTCTimeStamp(),n=Date.parse(t);o.timeOffset=isNaN(n)?0:n-e,0!==o.timeOffset&&s.output("Time offset = "+o.timeOffset+" milliseconds","info")}static getUTCTimeStamp(){return(new Date).getTime()}static isWebContext(){return"undefined"!=typeof window}static isHttp(){if("undefined"!=typeof window){if(window.document.currentScript){const t=window.document.currentScript;if(t.src)return t.src.match(/^http:/)}const t=document.getElementsByTagName("script");for(let e=0;e0;return!1===s&&this.errorLog(n,e,t,"is not a string",i),s}static isCorrectStreamOffset(t,e,n,i){const s="number"==typeof t&&!isNaN(t);return s||this.errorLog(n,e,t,"is not a number!",i),s}static isCorrectStreamStart(t,e,n,i){const s=Date.parse(t);return!isNaN(s)||0===t.length||(this.errorLog(n,e,t,"must be a valid date string with timezone offset (YYYY-MM-DDTHH:ii:ss TZ +OFFSET)!",i),!1)}static areParameterValid(t){for(const e in t)if(t.hasOwnProperty(e)&&!1===t[e])return s.output(`Input param "${e}" is not valid, request couldn't be sent!`,"warn"),!1;return!0}static isPlayOptionsValid(t,e,n,i){let s=!0;if("object"!=typeof t)this.errorLog(n,e,"(valueType="+typeof t+")","is invalid object!","warn"),s=!1;else{void 0===t.screen||"string"==typeof t.screen||(this.errorLog(n,e+".screen","(valueType="+typeof t.screen+")","is invalid object!","warn"),s=!1),void 0!==t.volume&&"string"!=typeof t.volume&&(s=!1),"string"==typeof t.speed&&isNaN(parseFloat(t.speed))&&(s=!1);let r=void 0===t.position;i&&(r=r||"number"==typeof t.position),r||(this.errorLog(n,e+".position","(valueType="+typeof t.position+")","is invalid object!","warn"),s=!1)}return s}static areCustomParametersValid(t,e,n){const i="object"==typeof t;return!1===i&&this.errorLog(n,e,"(valueType="+typeof t+")","is invalid object!","warn"),i}static checkArgCount(t,e,n){if(!a.isArgumentsLengthValid(t,e,n))throw new Error(n+" cannot be executed!")}static isArgumentsLengthValid(t,e,n,i){return!1!=(t===e)||(this.errorLog(n,"Input parameter number",t.toString(),"; Invalid number of arguments, given: "+t+", expected: "+e+"!",i),!1)}static errorLog(t,e,n,i){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"error";s.output("Origin="+t+"; Parameter="+e+"; Value="+n+"; "+i,r)}}class d{constructor(t,e){this.sMediaId=t,this.sInstance=e}get mediaId(){return this.sMediaId}get instance(){return this.sInstance}}class u extends d{constructor(t,e,n,i,s,r,o,a){super(t,a),this.iStreamPosition=e,this.sPresentationId=n,this.iStateItemNumber=i,this.iSegmentNumber=s,this.iSegmentDuration=r,this.iUsageTime=o}get presentationId(){return this.sPresentationId}get stateItemNumber(){return this.iStateItemNumber}get segmentNumber(){return this.iSegmentNumber}get segmentDuration(){return this.iSegmentDuration}get streamPosition(){return this.iStreamPosition}get usageTime(){return this.iUsageTime}}class c{static playbackSpeedConverter(t){if("string"!=typeof t||""===t||isNaN(parseFloat(t))){if("number"==typeof t)return Number(t.toFixed(2).replace(/(\.0+|0+)$/,""));if(void 0===t||""===t||null===t)return 1;throw new Error("Error in start event: Playback Speed wrong format. No data will be send")}return Number(Number(t).toFixed(2).replace(/(\.0+|0+)$/,""))}}class l extends u{constructor(t,e,n,i,s,r,o,a,d,u,h,m,g,p){super(t,"ondemand"===h?n:-1,o,d,a,u,r,l.instance),this.fPlaybackSpeedMultiplier=c.playbackSpeedConverter(m.speed),this.sPlayType=h,this.sContentId=e,this.oOptions=m,this.sVisibility=g||"",this.oCustomParams=p||{},this.iStreamStartTime=0===i.length?r-s:Date.parse(i)-s}get playType(){return this.sPlayType}set playType(t){this.sPlayType=t}get contentId(){return this.sContentId}get options(){return this.oOptions}get visibility(){return this.sVisibility}get customParams(){return this.oCustomParams}get streamStartTime(){return this.iStreamStartTime}}l.instance="EventPlay";class h extends u{constructor(t,e,n,i,s,r,o){super(t,e,n,s,i,r,o,h.instance)}}h.instance="EventStop";class m extends u{constructor(t,e,n,i,s,r,o){super(t,e,n,s,i,r,o,m.instance)}}m.instance="EventSkip";class g extends u{constructor(t,e,n,i,s,r,o,a){super(t,e,n,s,i,r,a,g.instance),this.sVolume=o}get volume(){return this.sVolume}}g.instance="EventVolume";class p extends u{constructor(t,e,n,i,s,r,o,a){super(t,e,n,s,i,r,a,p.instance),this.sScreen=o}get screen(){return this.sScreen}}p.instance="EventScreen";class f extends u{constructor(t,e,n,i,s,r,o){super(t,e,n,s,i,r,o,f.instance)}}f.instance="EventHeartbeat";class v extends d{constructor(t,e,n){super(t,v.instance),this.sContentId=e,this.oCustomParams=n||{}}get contentId(){return this.sContentId}get customParams(){return this.oCustomParams}}v.instance="EventImpression";class S extends u{constructor(t,e,n,i,s,r,o,a){super(t,e,n,s,i,r,a,S.instance),this.sVisibility=o}get visibility(){return this.sVisibility}}S.instance="EventVisibility";class w{constructor(t){this.mediaId=t}buildEventImpression(t,e){return new v(this.mediaId,t,e)}buildEventPlay(t,e,n,i,s,r,o,a,d){return new l(this.mediaId,s,t.streamPosition,e,n,i,t.presentationId,t.segmentNumber,t.stateItemNumber,t.segmentDuration,r,o,a,d)}buildEventStop(t,e){return new h(this.mediaId,t.streamPosition,t.presentationId,t.segmentNumber,t.stateItemNumber,t.segmentDuration,e)}buildEventSkip(t,e){return new m(this.mediaId,t.streamPosition,t.presentationId,t.segmentNumber,t.stateItemNumber,t.segmentDuration,e)}buildEventVolume(t,e,n){return new g(this.mediaId,t.streamPosition,t.presentationId,t.segmentNumber,t.stateItemNumber,t.segmentDuration,e,n)}buildEventScreen(t,e,n){return new p(this.mediaId,t.streamPosition,t.presentationId,t.segmentNumber,t.stateItemNumber,t.segmentDuration,e,n)}buildEventHeartbeat(t,e){return new f(this.mediaId,t.streamPosition,t.presentationId,t.segmentNumber,t.stateItemNumber,t.segmentDuration,e)}buildEventVisibility(t,e,n){return new S(this.mediaId,t.streamPosition,t.presentationId,t.segmentNumber,t.stateItemNumber,t.segmentDuration,e,n)}}class b{constructor(t,e,n,i,s){this.iStateItemNumber=t,this.iSegmentNumber=e,this.iStreamPosition=n,this.sPresentationId=i,this.iSegmentDuration=s}get presentationId(){return this.sPresentationId}get segmentNumber(){return this.iSegmentNumber}get stateItemNumber(){return this.iStateItemNumber}get segmentDuration(){return this.iSegmentDuration}get streamPosition(){return this.iStreamPosition}}class y{hash(t){let e,n,i,s,r,o,a,d,u,c=[];for(t=this.Utf8Encode(t),c=this.ConvertToWordArray(t),o=1732584193,a=4023233417,d=2562383102,u=271733878,e=0;e>>32-e}AddUnsigned(t,e){const n=2147483648&t,i=2147483648&e,s=1073741824&t,r=1073741824&e,o=(1073741823&t)+(1073741823&e);return s&r?2147483648^o^n^i:s|r?1073741824&o?3221225472^o^n^i:1073741824^o^n^i:o^n^i}F(t,e,n){return t&e|~t&n}G(t,e,n){return t&n|e&~n}H(t,e,n){return t^e^n}I(t,e,n){return e^(t|~n)}FF(t,e,n,i,s,r,o){return t=this.AddUnsigned(t,this.AddUnsigned(this.AddUnsigned(this.F(e,n,i),s),o)),this.AddUnsigned(this.RotateLeft(t,r),e)}GG(t,e,n,i,s,r,o){return t=this.AddUnsigned(t,this.AddUnsigned(this.AddUnsigned(this.G(e,n,i),s),o)),this.AddUnsigned(this.RotateLeft(t,r),e)}HH(t,e,n,i,s,r,o){return t=this.AddUnsigned(t,this.AddUnsigned(this.AddUnsigned(this.H(e,n,i),s),o)),this.AddUnsigned(this.RotateLeft(t,r),e)}II(t,e,n,i,s,r,o){return t=this.AddUnsigned(t,this.AddUnsigned(this.AddUnsigned(this.I(e,n,i),s),o)),this.AddUnsigned(this.RotateLeft(t,r),e)}ConvertToWordArray(t){let e;const n=t.length,i=n+8,s=16*((i-i%64)/64+1),r=Array(s-1);let o=0,a=0;for(;a>>29,r}WordToHex(t){let e,n,i="",s="";for(n=0;n<=3;n++)e=t>>>8*n&255,s="0"+e.toString(16),i+=s.substr(s.length-2,2);return i}Utf8Encode(t){t=t.replace(/\r\n/g,"\n");let e="";for(let n=0;n127&&i<2048?(e+=String.fromCharCode(i>>6|192),e+=String.fromCharCode(63&i|128)):(e+=String.fromCharCode(i>>12|224),e+=String.fromCharCode(i>>6&63|128),e+=String.fromCharCode(63&i|128))}return e}}class I{constructor(t){this.milliseconds=1e3,this.minSegmentDuration=0,this.maxStateItemsNumber=0,this.maxSegmentNumber=0,this.state=1,this.presentationId="",this.streamId="",this.stateItemNumber=0,this.segmentNumber=0,this.playStreamPosition=0,this.streamOffset=0,this.startTime=0,this.toleranceSeconds=3,this.playbackSpeed=1,this.minSegmentDuration=t.minSegmentDuration,this.maxStateItemsNumber=t.maxSegmentStateItems,this.maxSegmentNumber=t.maxSegments,this.md5=new y}isSegmentStopped(){return 1===this.state}createSegmentStarting(t,e,n,i,s){if(this.isMaxStateItemNumberReached()||this.isMaxSegmentNumberReached())throw new Error("Max state item number or max segment number reached! #noreport");return this.startTime=this.getTimeSeconds(),this.setSegmentAsPlayed(),this.playbackSpeed=i,this.playType=s,this.generateStreamSegment(t,e,n),this.incrementStateItemNumber(),this.incrementSegmentNumber(),this.createSegment(0,n)}createSegmentRunning(t,e){if(this.isSegmentStopped()||this.isMaxStateItemNumberReached())throw new Error("Stream not yet started or max state item number reached! #noreport");const n=this.calculateSegmentDuration(t);if(e&&this.isBelowMinSegmentDuration(n))throw new Error(`Duration of ${n} ms is below min segment duration of ${this.minSegmentDuration} ms! #noreport`);return this.checkSegmentDuration(n),this.incrementStateItemNumber(),this.createSegment(n,t)}createSegmentStopping(t){if(this.isSegmentStopped())throw new Error("Stop called for an already stopped segment #noreport");this.setSegmentAsStopped();const e=this.calculateSegmentDuration(t);if(this.isBelowMinSegmentDuration(e))throw new Error(`Duration of ${e} ms is below min segment duration of ${this.minSegmentDuration} ms! #noreport`);return this.checkSegmentDuration(e),this.incrementStateItemNumber(),this.createSegment(e,t)}setStartTime(t){this.startTime=t}setToleranceLimit(t){this.toleranceSeconds=t}checkSegmentDuration(t){const e=this.getTimeSeconds()-this.startTime+this.toleranceSeconds;if(Math.round(t/1e3)>e*this.playbackSpeed)throw new Error(`Segment duration (${t}) >= actual elapsed time (${e} with playback speed ${this.playbackSpeed})! #noreport`)}isBelowMinSegmentDuration(t){return t{this.buildHeartbeatEvent(this),this.intervalId=window.setInterval(this.buildHeartbeatEvent,e*this.milliseconds,this)}),n*this.milliseconds))}stop(){for(const t of this.timeoutId)clearTimeout(t);clearInterval(this.intervalId),this.timeoutId=[],this.intervalId=0}isHeartbeatActive(){return this.intervalId>0||this.timeoutId.length>0}getMaxHeartbeatInterval(){let t=0;return this.isHeartbeatEnabled()&&this.heartbeatConfig.interval.length>0&&(t=Math.max.apply(Math,this.heartbeatConfig.interval)),t}buildHeartbeatEvent(t){t.isMaxHeartbeatReached()?t.stop():(t.heartbeatNumber++,t.buildHeartbeat())}isHeartbeatEnabled(){return this.heartbeatConfig.enabled}isMaxHeartbeatReached(){return 0!==this.heartbeatConfig.maximum&&this.heartbeatNumber>=this.heartbeatConfig.maximum}extendTimeoutIntervallWithParamsForOldIE(){if("undefined"!=typeof window){if(document.all){const t=window.setTimeout;window.setTimeout=function(e,n){const i=Array.prototype.slice.call(arguments,2);return t(e instanceof Function?()=>{e.apply(this,i)}:e,n)}}if(document.all){const t=window.setInterval;window.setInterval=function(e,n){const i=Array.prototype.slice.call(arguments,2);return t(e instanceof Function?()=>{e.apply(this,i)}:e,n)}}}}}class M{constructor(t){this.timeWithOffsetCallback=t}setPlayType(t){this.playType=t}setStreamPositionCallback(t){this.streamPositionCallback=t}getCurrentStreamPosition(){let t=0;switch(this.playType){case"live":t=this.getCurrentStreamPositionLive();break;case"ondemand":t=this.getCurrentStreamPositionOnDemand()}return t}getCurrentStreamPositionLive(){return this.timeWithOffsetCallback()}getCurrentStreamPositionOnDemand(){let t=0;try{t=this.streamPositionCallback()}catch(t){throw new Error("Error while executing stream position callback: "+t.message)}if("number"!=typeof t||t<0)throw new Error(`Stream position must be a positive milliseconds value, but is ${t}.`);return s.output(`Stream position: ${s.formatDuration(t)} (${t})`,"log"),t}}class L{constructor(t){this.skipAllAfterValidationError=!1,this.lastPosition=0,this.heartbeat=t}start(t){if(t<0)throw this.skipAllAfterValidationError=!0,new Error("Position must be >= 0.");this.skipAllAfterValidationError=!1,this.lastPosition=t}validate(t){if(this.skipAllAfterValidationError)throw new Error("Event skipped after validation error! #noreport");if(tn){this.heartbeat.stop(),this.skipAllAfterValidationError=!0;let i=`Time interval since last segment is ${e} ms, should be < ${n} ms.`;throw i+=` Last: ${this.lastPosition}, current: ${t}.`,s.output(i,"error"),new Error(i)}}}L.toleranceSeconds=30;class V{constructor(){this.mostRecentHeartbeats={}}onNewHeartbeatGenerated(t){t.isMostRecent=!0,this.invalidateMostRecentHeartbeat(t),this.storeAsMostRecentHeartbeat(t)}invalidateMostRecentHeartbeat(t){const{presentationId:e,segmentNumber:n}=t;this.mostRecentHeartbeats[e]&&this.mostRecentHeartbeats[e][n]&&(this.mostRecentHeartbeats[e][n].isMostRecent=!1)}storeAsMostRecentHeartbeat(t){const{presentationId:e,segmentNumber:n}=t;this.mostRecentHeartbeats[e]={[n]:t}}}class q{constructor(t){this.sendTo=t}send(t){let e;const n=new Promise(((t,n)=>{e=e=>e?t():n("Sending request failed")}));return this.isWebContext()?this.isIEContext()?this.sendWithOldIE(t,e):this.sendWithDefault(t,e):this.sendNotInBrowser(e),n}sendWithDefault(t,e){if(XMLHttpRequest){const n=new XMLHttpRequest;if(!("withCredentials"in n))return s.output("withCredentials not possible on XMLHttpRequest","error"),void e(!1);n.open("POST",this.sendTo,!0),n.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),n.onreadystatechange=()=>{4===n.readyState&&(204===n.status?e(!0):e(!1))},n.send(t.getAsUrlString())}else s.output("XMLHttpRequest not found","error"),e(!1)}sendWithOldIE(t,e){const n=new XDomainRequest;n.open("POST",this.sendTo),n.onerror=()=>{s.output("Can't send a request with old IE","error"),e(!1)},n.ontimeout=()=>{s.output("Server status unknown, POST data not sent!","error"),e(!1)},n.onload=()=>{s.output(t.requestType,"log","request",t.fields),e(!0)},n.send(t.getAsUrlString())}sendNotInBrowser(t){s.output("Cannot send xhttp request, not in a browser","warn"),t(!0)}isWebContext(){return"undefined"!=typeof window}isIEContext(){return"undefined"!=typeof XDomainRequest}}var U=function(t,e,n,i){return new(n||(n=Promise))((function(s,r){function o(t){try{d(i.next(t))}catch(t){r(t)}}function a(t){try{d(i.throw(t))}catch(t){r(t)}}function d(t){var e;t.done?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}d((i=i.apply(t,e||[])).next())}))};class F{constructor(t){this.storage=[],this.currentDelay=F.BASE_DELAY,this.isResendQueued=!1,this.requestSender=new q(t)}sendRequest(t){return this.requestSender.send(t).then((()=>s.output("Sent: "+t.requestType,"log","request",t.fields))).catch((e=>{s.output("Failed to send request: "+e,"error"),_(t)&&(s.output("Queueing request","info"),this.storage.push(t)),this.isResendQueued||(s.output("No re-sending active, starting new re-sending after "+this.currentDelay+" ms","info"),this.scheduleNextResend())}))}resend(){return U(this,void 0,void 0,(function*(){for(;this.storage.length>0;){const t=this.storage.shift();try{yield this.requestSender.send(t)}catch(e){_(t)&&this.storage.unshift(t),this.increaseDelay(),s.output("Failed to re-send request: "+e,"error"),s.output("Increasing re-send delay to "+this.currentDelay,"info"),this.scheduleNextResend();break}}0===this.storage.length&&(s.output("All requests flushed","info"),this.isResendQueued=!1,this.currentDelay=F.BASE_DELAY)}))}scheduleNextResend(){setTimeout((()=>this.resend()),this.currentDelay),this.isResendQueued=!0}increaseDelay(){this.currentDelay=Math.min(2*this.currentDelay,F.MAX_DELAY)}get _requestSender(){return this.requestSender}}function _(t){return!("HB"===t.requestType)||t.isMostRecent}F.MAX_DELAY=32e3,F.BASE_DELAY=500;class B{constructor(t,e,n){this.heartbeatInvalidator=new V,this.htmlPlayerId=n,o.setConfig(e),this.collector=new o(t),this.streamPositionManager=new M(o.getTimeWithOffset),this.builder=new x(t.media,this.collector),this.transmitter=new F(e.trackingUrl),this.heartbeat=new H((()=>{s.output("Triggered: HB","log","fcall"),this.createEventHeartbeat()}),e.heartbeat),this.itemValidator=new L(this.heartbeat)}setStreamPositionCallback(t){this.streamPositionManager.setStreamPositionCallback(t)}isPlaying(){return!this.builder.getSegmentBuilder().isSegmentStopped()}createEventImpression(t,e){try{const n=this.builder.getEventBuilder().buildEventImpression(t,e),i=this.builder.getRequestBuilder().buildRequest(n);this.send(i)}catch(t){s.output("Error in impression event: "+t.message,"error")}}createEventPlayLive(t,e,n,i,r,a){try{this.streamPositionManager.setPlayType("live");const s=this.streamPositionManager.getCurrentStreamPosition();this.itemValidator.start(s);const d=this.builder.getSegmentBuilder().createSegmentStarting(n,i,s,c.playbackSpeedConverter(r.speed),"live");this.heartbeat.start();const u=o.getTimeWithOffset(),l=this.builder.getEventBuilder().buildEventPlay(d,e,n,u,t,"live",r,"",a),h=this.builder.getRequestBuilder().buildRequest(l);this.send(h)}catch(t){s.output("Error in play (live) event: "+t.message,"error")}}createEventPlayOnDemand(t,e,n,i){var r;try{this.streamPositionManager.setPlayType("ondemand");const s=null!==(r=n.position)&&void 0!==r?r:this.streamPositionManager.getCurrentStreamPosition();this.itemValidator.start(s);const a=this.builder.getSegmentBuilder().createSegmentStarting(0,e,s,c.playbackSpeedConverter(n.speed),"ondemand");this.heartbeat.start();const d=o.getTimeWithOffset(),u=this.builder.getEventBuilder().buildEventPlay(a,"",0,d,t,"ondemand",n,"",i),l=this.builder.getRequestBuilder().buildRequest(u);this.send(l)}catch(t){s.output("Error in play (on demand) event: "+t.message,"error")}}createEventStop(t){let e=!1;try{const n=null!=t?t:this.streamPositionManager.getCurrentStreamPosition();this.itemValidator.validate(n);const i=this.builder.getSegmentBuilder().createSegmentStopping(n),s=o.getTimeWithOffset(),r=this.builder.getEventBuilder().buildEventStop(i,s),a=this.builder.getRequestBuilder().buildRequest(r);this.send(a),e=!0,this.itemValidator.updateLastPosition(n)}catch(t){s.output("Error in stop event: "+t.message,"error")}return this.heartbeat.stop(),e}createEventSkip(t){let e=!1;try{const n=null!=t?t:this.streamPositionManager.getCurrentStreamPosition();this.itemValidator.validate(n);const i=this.builder.getSegmentBuilder().createSegmentStopping(n),s=o.getTimeWithOffset(),r=this.builder.getEventBuilder().buildEventSkip(i,s),a=this.builder.getRequestBuilder().buildRequest(r);this.send(a),e=!0,this.itemValidator.updateLastPosition(n)}catch(t){s.output("Error in skip event: "+t.message,"error")}return this.heartbeat.stop(),e}createEventHeartbeat(){try{const t=this.streamPositionManager.getCurrentStreamPosition();this.itemValidator.validate(t);const e=this.builder.getSegmentBuilder().createSegmentRunning(t,!0),n=o.getTimeWithOffset(),i=this.builder.getEventBuilder().buildEventHeartbeat(e,n),s=this.builder.getRequestBuilder().buildRequest(i);this.send(s),this.heartbeatInvalidator.onNewHeartbeatGenerated(s),this.itemValidator.updateLastPosition(t)}catch(t){s.output("Error in heartbeat event: "+t.message,"error")}}createEventVisibility(t){try{const e=this.streamPositionManager.getCurrentStreamPosition();this.itemValidator.validate(e);const n=this.builder.getSegmentBuilder().createSegmentRunning(e,!1),i=o.getTimeWithOffset(),s=this.builder.getEventBuilder().buildEventVisibility(n,t,i),r=this.builder.getRequestBuilder().buildRequest(s);this.send(r),this.itemValidator.updateLastPosition(e)}catch(t){s.output("Error in visibility event: "+t.message,"error")}}createEventScreen(t){try{const e=this.streamPositionManager.getCurrentStreamPosition();this.itemValidator.validate(e);const n=this.builder.getSegmentBuilder().createSegmentRunning(e,!0),i=o.getTimeWithOffset(),s=this.builder.getEventBuilder().buildEventScreen(n,t,i),r=this.builder.getRequestBuilder().buildRequest(s);this.send(r),this.itemValidator.updateLastPosition(e)}catch(t){s.output("Error in screen event: "+t.message,"error")}}createEventVolume(t){try{const e=this.streamPositionManager.getCurrentStreamPosition();this.itemValidator.validate(e);const n=this.builder.getSegmentBuilder().createSegmentRunning(e,!0),i=o.getTimeWithOffset(),s=this.builder.getEventBuilder().buildEventVolume(n,t,i),r=this.builder.getRequestBuilder().buildRequest(s);this.send(r),this.itemValidator.updateLastPosition(e)}catch(t){s.output("Error in volume event: "+t.message,"error")}}isProjectEnabled(){return!0===this.collector.getProjectStatus()}send(t){this.isProjectEnabled()&&this.transmitter.sendRequest(t)}setExtensionVersion(t){this.collector.setExtensionVersion(t)}}class G{constructor(t,e,n,i){if(a.validateTagConfig(t),void 0===i){i=window.s2sSdkConfig}this.processor=new B(t,i,e),"function"==typeof n&&this.setStreamPositionCallback(n)}impression(t,e){const n="impression()";s.output("Triggered: "+n,"log","fcall",arguments),a.checkArgCount(arguments.length,2,n);const i={contentId:a.isStringAndNotEmpty(t,"contentId",n),customParams:a.areCustomParametersValid(e,"customParams",n)};return a.areParameterValid(i)&&this.processor.createEventImpression(t,e),i}playStreamLive(t,e,n,i,r,o){const d="playStreamLive()";s.output("Triggered: "+d,"log","fcall",arguments),a.checkArgCount(arguments.length,6,d);const u={contentId:a.isStringAndNotEmpty(t,"contentId",d),streamStart:a.isCorrectStreamStart(e,"streamStart",d),streamOffset:a.isCorrectStreamOffset(n,"streamOffset",d),streamId:a.isStringAndNotEmpty(i,"streamId",d),options:a.isPlayOptionsValid(r,"options",d,!1),customParams:a.areCustomParametersValid(o,"customParams",d)};return a.areParameterValid(u)&&this.processor.createEventPlayLive(t,e,n,i,r,o),u}playLive(t,e,n,i,s,r,o){a.checkArgCount(arguments.length,7,"playLive()");const d={screen:s,volume:r};return this.playStreamLive(t,e,n,i,d,o)}playStreamOnDemand(t,e,n,i,r){const o="playStreamOnDemand()";let d;if(s.output("Triggered: "+o,"log","fcall",arguments),"number"==typeof n){a.checkArgCount(arguments.length,5,o);const s=Object.assign(Object.assign({},i),{position:n}),u=r;d={contentId:a.isStringAndNotEmpty(t,"contentId",o),streamId:a.isStringAndNotEmpty(e,"streamId",o),options:a.isPlayOptionsValid(s,"options",o,!0),customParams:a.areCustomParametersValid(u,"customParams",o)};a.areParameterValid(d)&&this.processor.createEventPlayOnDemand(t,e,s,u)}else{a.checkArgCount(arguments.length,4,o);const s=n,r=i;d={contentId:a.isStringAndNotEmpty(t,"contentId",o),streamId:a.isStringAndNotEmpty(e,"streamId",o),options:a.isPlayOptionsValid(s,"options",o,!0),customParams:a.areCustomParametersValid(r,"customParams",o)};a.areParameterValid(d)&&this.processor.createEventPlayOnDemand(t,e,s,r)}return d}playVOD(t,e,n,i,s){a.checkArgCount(arguments.length,5,"playVOD()");const r={screen:n,volume:i};return this.playStreamOnDemand(t,e,r,s)}stop(t){return s.output("Triggered: stop()","log","fcall",t),{stop:this.processor.createEventStop(t)}}skip(t){return s.output("Triggered: skip()","log","fcall"),{skip:this.processor.createEventSkip(t)}}volume(t){const e="volume()";s.output("Triggered: "+e,"log","fcall",t),a.checkArgCount(arguments.length,1,e);const n={volume:a.isStringAndNotEmpty(t,"volume",e)};return this.processor.isPlaying()&&this.processor.createEventVolume(t),n}screen(t){const e="screen()";s.output("Triggered: "+e,"log","fcall",t),a.checkArgCount(arguments.length,1,e);const n={screen:a.isStringAndNotEmpty(t,"screen",e)};return this.processor.isPlaying()&&this.processor.createEventScreen(t),n}setStreamPositionCallback(t){this.processor.setStreamPositionCallback(t)}setExtensionVersion(t){this.processor.setExtensionVersion(t)}}function W(){let t=Date.now().toString().substring(0,13).padStart(13,"0");const e="ABCDEF0123456789",n=e.length,i=56-t.length;for(let s=0;s{i||t(!1),n.gdprApplies||(t(e),window.__tcfapi("removeEventListener",2,(()=>{}),n.listenerId)),!i||"tcloaded"!==n.eventStatus&&"useractioncomplete"!==n.eventStatus||(t(function(t){return $.hasGfK(t)&&$.hasMarketResearch(t)&&$.hasMeasureAdPerformance(t)&&$.hasMeasureContentPerformance(t)&&$.hasReadWrite(t)}(n)),window.__tcfapi("removeEventListener",2,(()=>{}),n.listenerId))}))}class z{static sendData(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"POST",n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;return new Promise(((s,r)=>{const o=new XMLHttpRequest;o.onloadend=()=>{o.status>=200&&o.status<400?(i&&i(o),s()):r()},o.open(e,t,!0),o.setRequestHeader("Content-Type","text/plain"),n?o.send(JSON.stringify(n)):o.send()}))}}class J{static getCookie(t){const e=document.cookie.match("(^|;) ?"+t+"=([^;]*)(;|$)");return e?decodeURIComponent(e[2]):null}static deleteCookie(t,e){this.setCookie(t,"",{days:-1,domain:e})}static setCookie(t,e){let{days:n=730,domain:i,sameSite:s="None"}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=new Date;r.setTime(r.getTime()+24*n*60*60*1e3);let o=t+"="+encodeURIComponent(e)+";path=/;expires="+r.toUTCString();i&&(o+=";domain="+i),o+=";sameSite="+s,"https:"===window.location.protocol&&(o+=";secure"),document.cookie=o}static isHttp(){if("undefined"!=typeof window){const t=window.document.getElementsByTagName("script");for(let e=0;e{setTimeout((()=>n(`No value returned after ${e} ms`)),e)}));return Promise.race([t,n])}var ot=function(t,e,n,i){return new(n||(n=Promise))((function(s,r){function o(t){try{d(i.next(t))}catch(t){r(t)}}function a(t){try{d(i.throw(t))}catch(t){r(t)}}function d(t){var e;t.done?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}d((i=i.apply(t,e||[])).next())}))};let at,dt,ut;const ct=1e4;function lt(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];void 0===at&&ht();const n={};return e&&(ut=rt(mt(st),ct),setTimeout((()=>{at.contentWindow.postMessage({readOldCookie:!0},"*")}),500),n.oldCookie=ut),t&&(dt=rt(mt(it),ct),at.contentWindow.postMessage({readNewCookie:!0},"*"),n.newCookie=dt),n}function ht(){at=document.createElement("iframe"),at.style.visibility="hidden",at.style.display="none",at.width="0",at.height="0",at.src=K.thirdPartyCookieIframeUrl.replace(/^https?:/,J.isHttp()?"http:":"https:");const t=document.body.childNodes[0];var e,n;e=at,(n=t)&&n.parentNode?n.parentNode.insertBefore(e,n.nextSibling):document.body.appendChild(e)}function mt(t){return new Promise((e=>{window.addEventListener("message",(n=>{n.data.hasOwnProperty(t)&&e(n.data[t])}))}))}function gt(){const t="https://fc-id.sensic.net/".replace(/^https?:/,J.isHttp()?"http:":"https:");return new Promise(((e,n)=>{const i=new XMLHttpRequest;i.onloadend=()=>{i.status>=200&&i.status<=299?e(i.response):n(`${t} returned ${i.status}`)},i.open("GET",t,!0),i.send()}))}var pt=function(t,e,n,i){return new(n||(n=Promise))((function(s,r){function o(t){try{d(i.next(t))}catch(t){r(t)}}function a(t){try{d(i.throw(t))}catch(t){r(t)}}function d(t){var e;t.done?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}d((i=i.apply(t,e||[])).next())}))};function ft(){return rt(new Promise(((t,e)=>{Y.isEnabled("TCF")||e("TCF feature flag is disabled"),window.__tcfapi||e("No __tcfapi found."),window.__tcfapi("addEventListener",2,((e,n)=>{!n||"tcloaded"!==e.eventStatus&&"useractioncomplete"!==e.eventStatus||t(e.tcString)}),[758])})),1e3)}function vt(){return pt(this,void 0,void 0,(function*(){const{oldCookie:t,newCookie:e}=lt(!0),n=[["sui_1pc",tt()],["ai",nt()],["sui_fc",gt()],["sui_3pc",e],["sui_old_3pc",t],["external",window.gfkS2sConf?window.gfkS2sConf.extID:window.gfkConnectorConf?window.gfkConnectorConf.extID:void 0]],i={};for(const[t,e]of n)try{const n=yield e;n&&(i[t]=n)}catch(e){s.warn(`Failed to collect ID '${t}': `+e.toString())}return i}))}function St(){const t=new URL("id",K.trackingUrl);return J.isHttp()?t.protocol="http:":t.protocol="https:",t}var wt=function(t,e,n){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"1",o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"sensic-sdk-web";return pt(this,void 0,void 0,(function*(){const a={version:r,source:o,id:Object.assign({},t),privacy:{providedOptin:e},tracking:n};try{a.privacy.tcString=yield ft()}catch(t){s.warn("Could not determine TC string: "+t)}n&&i&&Object.assign(a.id,yield vt()),s.log(`VMS privacy settings:, ${JSON.stringify(a,null,2)}`);const d=St();yield z.sendData(d.href,"POST",a)}))},bt=function(t,e,n,i){return new(n||(n=Promise))((function(s,r){function o(t){try{d(i.next(t))}catch(t){r(t)}}function a(t){try{d(i.throw(t))}catch(t){r(t)}}function d(t){var e;t.done?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}d((i=i.apply(t,e||[])).next())}))};function yt(t){return bt(this,void 0,void 0,(function*(){try{const e=function(t){const e=J.isHttp()?"http://":"https://",n=(t||"error-got-empty-id").replace("|","-")+K.suiPixelUrl;return new URL(e+n)}(t);return function(t,e){let{searchParams:n}=e;var i;const s=new URLSearchParams(window.location.search);if(n.append("m",(null===(i=window.gfkS2sConf)||void 0===i?void 0:i.media)||"no_mediaid"),n.append("r",window.location.host),n.append("p",K.projectId),n.append("instanceid",t),window.location.host.includes(".sensic.net"))for(const t of["paneluserid","hhid","uid","pid","origin"])s.has(t)&&n.append(t,s.get(t))}(t,e),s.log("Relay ID: "+e),yield z.sendData(e.href+"&redirect=manual","GET",null,(t=>{if(window.postMessage({relayRequestServerDate:t.getResponseHeader("Date")},"*"),t.getAllResponseHeaders().includes("x-location")){const e=new XMLHttpRequest;e.open("GET",t.getResponseHeader("x-location"),!0),e.send()}}))}catch(t){s.error("Failed to send relay request: "+t.message)}}))}var It=function(t,e,n,i){return new(n||(n=Promise))((function(s,r){function o(t){try{d(i.next(t))}catch(t){r(t)}}function a(t){try{d(i.throw(t))}catch(t){r(t)}}function d(t){var e;t.done?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}d((i=i.apply(t,e||[])).next())}))};var Ct=function(t,e,n,i){return new(n||(n=Promise))((function(s,r){function o(t){try{d(i.next(t))}catch(t){r(t)}}function a(t){try{d(i.throw(t))}catch(t){r(t)}}function d(t){var e;t.done?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}d((i=i.apply(t,e||[])).next())}))};const Et=new class{constructor(){this.instanceID=W()}init(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;return It(this,void 0,void 0,(function*(){s.info("Using VMS V2"),yt(this.instanceID);const r=yield this.hasOldPanelCookie(),o={instanceid:this.instanceID};(n.paneluserid||n.hhid)&&(o.panelistid={panel:n.pid,paneluserid:n.paneluserid,panelhouseholdid:n.hhid,panelhouseholdmemberid:n.uid}),function(t){let{optin:e}=t,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return new Promise((t=>{if(n)return t(!0);if(void 0!==e)return t(e);if(setTimeout((()=>{t(!1)}),1e4),Y.isEnabled("TCF")){let n=0,i=setInterval((()=>{n++,window.__tcfapi&&(Q(t,e),clearInterval(i)),30!==n||window.__tcfapi||(clearInterval(i),t(!0))}),100)}else t(!0)}))}({optin:t},r).then((s=>{var r;wt(o,null!==(r=n.optin)&&void 0!==r?r:t,s,!0,"2",i).then((()=>{"function"==typeof e&&e()}))}))}))}hasOldPanelCookie(){return It(this,void 0,void 0,(function*(){try{const t=yield function(){var t;return ot(this,void 0,void 0,(function*(){const{oldCookie:e}=lt();let n=null;if(void 0!==(null===(t=null===document||void 0===document?void 0:document.body)||void 0===t?void 0:t.nodeName))try{n=yield e}catch(t){s.warn("Failed to collect oldCookie: "+t.toString())}return n}))}();return void 0!==(null==t?void 0:t.paneluserid)||void 0!==(null==t?void 0:t.uid)||void 0!==(null==t?void 0:t.hhid)||void 0!==(null==t?void 0:t.pid)}catch(t){s.error("Failed to get oldPanelCookie: "+t.message)}}))}};let Pt;s.readFromTagConf(),s.readFromLocalStorage(),function(){const t=Array.from(document.scripts).find((t=>t.text.includes("w.gfks =")));t&&t.parentNode===document.head&&s.output("The sensic tag is in the section. Please put it into the ","error")}(),Array.prototype.forEach&&Array.prototype.indexOf&&window.JSON?(Pt=(new Date).getTime(),window.s2sSdkConfig=new t,e.enable(),o.setConfig(window.s2sSdkConfig),o.init(window.gfkS2sConf,Et),function(){var t,e;Ct(this,void 0,void 0,(function*(){window.gfks?window.gfks=G:(s.output("You are using a deprecated tag. Please visit https://confluence-docu.gfk.com/display/SENSIC/Adding+the+Tag and update your tag.","warn"),window.s=G),(null===(t=window.gfkS2s)||void 0===t?void 0:t.agents)&&window.gfkS2s.agents.forEach((t=>{const e=t.a;t.a=new G(e.config,e.pId,(()=>e.p),window.s2sSdkConfig),s.output('Processing started for player "'+e.pId+'"',"info"),e.queue.forEach((n=>{s.output('Method "'+n.f+'" was executed for player "'+e.pId+'" before SDK loaded',"info"),t.a[n.f].apply(t.a,n.a)})),t.a.setStreamPositionCallback(e.cb)})),(null===(e=window.gfkS2s)||void 0===e?void 0:e.onSdkLoaded)&&window.gfkS2s.onSdkLoaded();const n=(new Date).getTime()-Pt;s.output(`Agents initialized after ${n} ms`,"debug"),window.gfkS2s&&(window.gfkS2s.getInstanceID=()=>Et.instanceID)}))}(),o.setTimeOffset()):s.output("Device doesn't support ECMAScript 5","error")}(); //# sourceMappingURL=s2s-web.js.map