@streamlayer/react 1.21.0 → 1.21.1

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),e=require("./provider.js");require("nanostores");const i=require("react");require("@nanostores/react");require("lodash.throttle");require("react-dom");require("react-countup");const B=require("./vast-client.min-B0NUra1B.js"),_={},I=new B.ce,T=e.i(_),E=e.createLogger("ui:gam-static"),w=s=>new Promise((t,a)=>{const l=new Image;l.onload=()=>t(s),l.onerror=()=>a(),l.src=s}),R=()=>{const s=i.useRef(0);return[i.useCallback(async t=>{var a,l,r,p,c,u,y,d,h,x,A;if((a=T.get()[t])!=null&&a.imageSrc)return{success:!0};const v=Date.now();s.current=v,T.setKey(t,{id:"",url:t});try{e.eventBus.emit("exposedPauseAd",{action:"load",payload:{}});const m=await I.get(t);if(E.debug(m,"parsedVAST"),s.current===v&&T.get()[t].url){const o=m.ads.find(f=>f.creatives.length>0);if(o){E.debug(o,"validAd");const f=o.creatives.find(g=>g.type==="nonlinear");if(f){E.debug(f,"nonlinear");const g=(r=(l=f.variations)==null?void 0:l[0])==null?void 0:r.staticResource,j=(c=(p=f.variations)==null?void 0:p[0])==null?void 0:c.nonlinearClickThroughURLTemplate;if(g)return await w(g),T.setKey(t,{id:o.id||"",url:t,imageSrc:g,adUrl:j}),e.eventBus.emit("exposedPauseAd",{action:"loaded",payload:{id:o.id||""}}),{success:!0}}const P=o.creatives.find(g=>g.type==="companion");E.debug(P,"companion");const k=(h=(d=(y=(u=P==null?void 0:P.variations)==null?void 0:u[0])==null?void 0:y.staticResources)==null?void 0:d[0])==null?void 0:h.url,S=(A=(x=P==null?void 0:P.variations)==null?void 0:x[0])==null?void 0:A.companionClickThroughURLTemplate;if(k)return await w(k),T.setKey(t,{id:o.id||"",url:t,imageSrc:k,adUrl:S}),e.eventBus.emit("exposedPauseAd",{action:"loaded",payload:{id:o.id||""}}),{success:!0}}}}catch(m){console.error("Error parsing VAST",m)}return{success:!1}},[]),T]},L=e.styled_default("div")({name:"PauseAdOverlay",class:"pw9gih8",propsAsIs:!1}),D=e.styled_default("div")({name:"PauseAdContent",class:"p8lpomy",propsAsIs:!1}),q=e.styled_default("div")({name:"PauseAdGradientRight",class:"pv7u167",propsAsIs:!1}),U=e.styled_default("div")({name:"PauseAdGradientBottom",class:"p1kh2yb0",propsAsIs:!1}),V=e.styled_default("div")({name:"PauseAdTopLeft",class:"pl8f94x",propsAsIs:!1}),K=e.styled_default("h2")({name:"PauseAdTitle",class:"p1m6zmrt",propsAsIs:!1}),M=e.styled_default("p")({name:"PauseAdCaption",class:"pm3vwfa",propsAsIs:!1}),F=e.styled_default("div")({name:"PauseAdBottomLeft",class:"p1tibuhw",propsAsIs:!1}),N=e.styled_default("button")({name:"PauseAdPlayButton",class:"ptqqrqd",propsAsIs:!1}),G=e.styled_default("div")({name:"PauseAdSidebar",class:"p14estxv",propsAsIs:!1}),O=e.styled_default("span")({name:"PauseAdTitleDescription",class:"p1dpvfl1",propsAsIs:!1}),C=e.styled_default("img")({name:"ExternalAdContainer",class:"ezfmabr",propsAsIs:!1}),z=({vastUrl:s,isDesktop:t})=>{var a;const[,l]=R(),r=e.useStore(l,{keys:[s]});return i.useEffect(()=>{r&&r[s]&&r[s].imageSrc&&r[s].id&&e.eventBus.emit("exposedPauseAd",{action:"rendered",payload:{id:r[s].id}})},[r,s]),(a=r==null?void 0:r[s])!=null&&a.imageSrc?!r[s].adUrl||!t?n.jsx(C,{src:r[s].imageSrc}):n.jsx("a",{onClick:()=>{e.eventBus.emit("exposedPauseAd",{action:"navigated",payload:{id:r[s].id}})},href:r[s].adUrl,target:"_blank",rel:"noopener noreferrer",children:n.jsx(C,{src:r[s].imageSrc})}):null},$=({isClosing:s,title:t,caption:a,onPlay:l,onClose:r,vastUrl:p,options:c,isDesktop:u})=>{const y=(c==null?void 0:c.showPauseButton)??!0,{ref:d,focusSelf:h}=e.distExports.useFocusable({focusKey:"sl-pause-ad-play",onEnterRelease:l,isFocusBoundary:!0,forceFocus:!0});return i.useEffect(()=>{d.current&&h()},[d,h]),i.useEffect(()=>{if(!r)return()=>{};const x=A=>{const v=A.keyCode;if(v===461||v===10009||v===27||v===8){A.preventDefault(),A.stopPropagation(),A.stopImmediatePropagation(),r();return}};return window.addEventListener("keydown",x,{capture:!0}),()=>window.removeEventListener("keydown",x,{capture:!0})},[r]),n.jsx(L,{className:e.cx_default("SL_PauseAdOverlay",s&&"pause-ad-closing"),children:n.jsxs(D,{children:[n.jsx(q,{}),n.jsx(U,{}),n.jsxs(V,{children:[n.jsx(K,{children:t}),n.jsx(M,{children:a})]}),y&&n.jsx(F,{children:n.jsx(N,{ref:d,onClick:l,onMouseEnter:()=>d.current.focus(),"aria-label":"Resume playback"})}),n.jsxs(G,{children:[p&&n.jsx(z,{isDesktop:u,vastUrl:p}),n.jsx(O,{children:"ADVERTISEMENT"})]})]})})},W=({showPauseAd:s,vastUrls:t,title:a,caption:l,sdk:r,onClose:p,onRender:c,options:u,isDesktop:y})=>{const d=(u==null?void 0:u.pauseAdDelay)??5e3,[h,x]=i.useState(!1),[A,v]=i.useState(!1),m=i.useRef(),o=t==null?void 0:t[0].url,f=i.useRef(o);f.current=o;const[P,k]=R(),S=i.useCallback(()=>{p&&(e.eventBus.emit("exposedPauseAd",{action:"closed",payload:{}}),p())},[p]),g=i.useCallback(()=>{r.controlVideoPlayer({play:!0})},[r]);return i.useEffect(()=>{if(s&&o){e.eventBus.emit("exposedPauseAd",{action:"enabled",payload:{}}),P(o).then(b=>{f.current===o&&(b==null?void 0:b.success)!==!0&&(clearTimeout(m.current),S==null||S())}).catch(()=>{f.current===o&&(clearTimeout(m.current),S==null||S())});const j=()=>{const b=k.get()[f.current];b!=null&&b.imageSrc?(clearTimeout(m.current),v(!1),x(!0)):m.current=setTimeout(()=>{j()},200)};m.current=setTimeout(()=>{j()},d)}else e.eventBus.emit("exposedPauseAd",{action:"disabled",payload:{}}),v(!0),m.current=setTimeout(()=>{x(!1)},400);return()=>{m.current&&clearTimeout(m.current)}},[k,P,S,d,s,o]),i.useEffect(()=>{c==null||c({rendered:h})},[h,c]),i.useEffect(()=>()=>{c==null||c({rendered:!1})},[c]),h?n.jsx($,{onClose:S,isClosing:A,title:a,caption:l,onPlay:g,vastUrl:o,options:u,isDesktop:y}):null},X=({showPauseAd:s,pauseAdVastUrl:t,videoPlayerController:a,onRenderPauseAd:l,onClosePauseAd:r,children:p,options:c})=>{const u=e.useStreamLayer(),y=e.useStreamLayerTheme(),d=i.useRef();return i.useEffect(()=>u?(a&&(d.current=a,u.addVideoPlayerController(d.current)),()=>{d.current&&u.removeVideoPlayerController(d.current)}):()=>{},[u,a]),u?n.jsx("div",{className:"StreamLayerSDK",children:n.jsxs(e.h,{style:p?{position:"relative"}:{},customTheme:y.theme,themeMode:y.themeMode,children:[p,t&&n.jsx(W,{sdk:u,showPauseAd:s,vastUrls:t,onClose:r,onRender:l,options:c,isDesktop:!0})]})}):p};class H extends i.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,a){console.error(t,a.componentStack)}render(){return this.state.hasError?this.props.children:n.jsx(X,{...this.props})}}exports.StreamLayerPauseAd=H;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),e=require("./provider.js");require("nanostores");const i=require("react");require("@nanostores/react");require("lodash.throttle");require("react-dom");require("react-countup");const R=require("./vast-client.min-B0NUra1B.js"),_={},B=new R.ce,k=e.i(_),j=e.createLogger("ui:gam-static"),C=s=>new Promise((t,n)=>{const l=new Image;l.onload=()=>t(s),l.onerror=()=>n(),l.src=s}),L=()=>{const s=i.useRef(0);return[i.useCallback(async t=>{var n,l,r,p,c,u,y,d,h,x,A;if((n=k.get()[t])!=null&&n.imageSrc)return{success:!0};const f=Date.now();s.current=f,k.setKey(t,{id:"",url:t});try{e.eventBus.emit("exposedPauseAd",{action:"load",payload:{}});const m=await B.get(t);if(j.debug(m,"parsedVAST"),s.current===f&&k.get()[t].url){const o=m.ads.find(v=>v.creatives.length>0);if(o){j.debug(o,"validAd");const v=o.creatives.find(g=>g.type==="nonlinear");if(v){j.debug(v,"nonlinear");const g=(r=(l=v.variations)==null?void 0:l[0])==null?void 0:r.staticResource,E=(c=(p=v.variations)==null?void 0:p[0])==null?void 0:c.nonlinearClickThroughURLTemplate;if(g)return await C(g),k.setKey(t,{id:o.id||"",url:t,imageSrc:g,adUrl:E}),e.eventBus.emit("exposedPauseAd",{action:"loaded",payload:{id:o.id||""}}),{success:!0}}const P=o.creatives.find(g=>g.type==="companion");j.debug(P,"companion");const b=(h=(d=(y=(u=P==null?void 0:P.variations)==null?void 0:u[0])==null?void 0:y.staticResources)==null?void 0:d[0])==null?void 0:h.url,S=(A=(x=P==null?void 0:P.variations)==null?void 0:x[0])==null?void 0:A.companionClickThroughURLTemplate;if(b)return await C(b),k.setKey(t,{id:o.id||"",url:t,imageSrc:b,adUrl:S}),e.eventBus.emit("exposedPauseAd",{action:"loaded",payload:{id:o.id||""}}),{success:!0}}}}catch(m){console.error("Error parsing VAST",m)}return{success:!1}},[]),k]},D=e.styled_default("div")({name:"PauseAdOverlay",class:"pw9gih8",propsAsIs:!1}),I=e.styled_default("div")({name:"PauseAdContent",class:"p8lpomy",propsAsIs:!1}),q=e.styled_default("div")({name:"PauseAdTopLeft",class:"pv7u167",propsAsIs:!1}),U=e.styled_default("h2")({name:"PauseAdTitle",class:"p1kh2yb0",propsAsIs:!1}),M=e.styled_default("p")({name:"PauseAdCaption",class:"pl8f94x",propsAsIs:!1}),V=e.styled_default("div")({name:"PauseAdBottomLeft",class:"p1m6zmrt",propsAsIs:!1}),K=e.styled_default("button")({name:"PauseAdPlayButton",class:"pm3vwfa",propsAsIs:!1}),N=e.styled_default("div")({name:"PauseAdSidebarGradient",class:"p1tibuhw",propsAsIs:!1}),F=e.styled_default("div")({name:"PauseAdSidebar",class:"ptqqrqd",propsAsIs:!1}),$=e.styled_default("span")({name:"PauseAdTitleDescription",class:"p14estxv",propsAsIs:!1}),w=e.styled_default("img")({name:"ExternalAdContainer",class:"e1dpvfl1",propsAsIs:!1}),O=({vastUrl:s,isDesktop:t})=>{var n;const[,l]=L(),r=e.useStore(l,{keys:[s]});return i.useEffect(()=>{r&&r[s]&&r[s].imageSrc&&r[s].id&&e.eventBus.emit("exposedPauseAd",{action:"rendered",payload:{id:r[s].id}})},[r,s]),(n=r==null?void 0:r[s])!=null&&n.imageSrc?!r[s].adUrl||!t?a.jsx(w,{src:r[s].imageSrc}):a.jsx("a",{onClick:()=>{e.eventBus.emit("exposedPauseAd",{action:"navigated",payload:{id:r[s].id}})},href:r[s].adUrl,target:"_blank",rel:"noopener noreferrer",children:a.jsx(w,{src:r[s].imageSrc})}):null},z=({isClosing:s,title:t,caption:n,onPlay:l,onClose:r,vastUrl:p,options:c,isDesktop:u})=>{const y=(c==null?void 0:c.showPauseButton)??!0,{ref:d,focusSelf:h}=e.distExports.useFocusable({focusKey:"sl-pause-ad-play",onEnterRelease:l,isFocusBoundary:!0,forceFocus:!0});return i.useEffect(()=>{d.current&&h()},[d,h]),i.useEffect(()=>{if(!r)return()=>{};const x=A=>{const f=A.keyCode;if(f===461||f===10009||f===27||f===8){A.preventDefault(),A.stopPropagation(),A.stopImmediatePropagation(),r();return}};return window.addEventListener("keydown",x,{capture:!0}),()=>window.removeEventListener("keydown",x,{capture:!0})},[r]),a.jsx(D,{className:e.cx_default("SL_PauseAdOverlay",s&&"pause-ad-closing"),children:a.jsxs(I,{children:[a.jsxs(q,{children:[a.jsx(U,{children:t}),a.jsx(M,{children:n})]}),y&&a.jsx(V,{children:a.jsx(K,{ref:d,onClick:l,onMouseEnter:()=>d.current.focus(),"aria-label":"Resume playback"})}),a.jsx(N,{className:"SL_PauseAdSidebar",children:a.jsxs(F,{children:[p&&a.jsx(O,{isDesktop:u,vastUrl:p}),a.jsx($,{children:"ADVERTISEMENT"})]})})]})})},G=({showPauseAd:s,vastUrls:t,title:n,caption:l,sdk:r,onClose:p,onRender:c,options:u,isDesktop:y})=>{const d=(u==null?void 0:u.pauseAdDelay)??5e3,[h,x]=i.useState(!1),[A,f]=i.useState(!1),m=i.useRef(),o=t==null?void 0:t[0].url,v=i.useRef(o);v.current=o;const[P,b]=L(),S=i.useCallback(()=>{p&&(e.eventBus.emit("exposedPauseAd",{action:"closed",payload:{}}),p())},[p]),g=i.useCallback(()=>{r.controlVideoPlayer({play:!0})},[r]);return i.useEffect(()=>{if(s&&o){e.eventBus.emit("exposedPauseAd",{action:"enabled",payload:{}}),P(o).then(T=>{v.current===o&&(T==null?void 0:T.success)!==!0&&(clearTimeout(m.current),S==null||S())}).catch(()=>{v.current===o&&(clearTimeout(m.current),S==null||S())});const E=()=>{const T=b.get()[v.current];T!=null&&T.imageSrc?(clearTimeout(m.current),f(!1),x(!0)):m.current=setTimeout(()=>{E()},200)};m.current=setTimeout(()=>{E()},d)}else e.eventBus.emit("exposedPauseAd",{action:"disabled",payload:{}}),f(!0),m.current=setTimeout(()=>{x(!1)},400);return()=>{m.current&&clearTimeout(m.current)}},[b,P,S,d,s,o]),i.useEffect(()=>{c==null||c({rendered:h})},[h,c]),i.useEffect(()=>()=>{c==null||c({rendered:!1})},[c]),h?a.jsx(z,{onClose:S,isClosing:A,title:n,caption:l,onPlay:g,vastUrl:o,options:u,isDesktop:y}):null},J=({showPauseAd:s,pauseAdVastUrl:t,videoPlayerController:n,onRenderPauseAd:l,onClosePauseAd:r,children:p,options:c})=>{const u=e.useStreamLayer(),y=e.useStreamLayerTheme(),d=i.useRef();return i.useEffect(()=>u?(n&&(d.current=n,u.addVideoPlayerController(d.current)),()=>{d.current&&u.removeVideoPlayerController(d.current)}):()=>{},[u,n]),u?a.jsx("div",{className:"StreamLayerSDK",children:a.jsxs(e.h,{style:p?{position:"relative"}:{},customTheme:y.theme,themeMode:y.themeMode,children:[p,t&&a.jsx(G,{sdk:u,showPauseAd:s,vastUrls:t,onClose:r,onRender:l,options:c,isDesktop:!0})]})}):p};class Q extends i.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,n){console.error(t,n.componentStack)}render(){return this.state.hasError?this.props.children:a.jsx(J,{...this.props})}}exports.StreamLayerPauseAd=Q;
@@ -13,4 +13,4 @@
13
13
  `),a=`
14
14
  `+n+(i.length?o("│"):" ")+" ";return n+c.join(a)+`
15
15
  `+i.map(function(s,r){var u=r===i.length-1,V=s.nodes&&s.nodes.length,R=n+(u?" ":o("│"))+" ";return n+o(u?"└":"├")+o("─")+o(V?"┬":"─")+" "+e(s,R,l).slice(n.length+2)}).join("")};const Vb=ub,mi=Symbol("avvio.TimeTree.untrackNode"),Pn=Symbol("avvio.TimeTree.trackNode"),gi=Symbol("avvio.TimeTree.getParent"),hi=Symbol("avvio.TimeTree.getNode"),Wi=Symbol("avvio.TimeTree.addNode");let bb=class{constructor(){this.root=null,this.tableId=new Map,this.tableLabel=new Map}[Pn](e){this.tableId.set(e.id,e),this.tableLabel.has(e.label)?this.tableLabel.get(e.label).push(e):this.tableLabel.set(e.label,[e])}[mi](e){this.tableId.delete(e.id);const t=this.tableLabel.get(e.label);if(t.id){this.tableLabel.delete(e.label);return}t.pop(),t.length===0&&this.tableLabel.delete(e.label)}[gi](e){if(e===null)return this.root;const t=this.tableLabel.get(e);return t.id?t:t[t.length-1]}[hi](e){return this.tableId.get(e)}[Wi](e,t,n){if(e===null)return this.root={id:"root",label:t,start:n,nodes:[]},this[Pn](this.root),this.root.id;const l=this[gi](e),o=`${t}-${Math.random()}`,i={id:o,parent:e,start:n,label:t,nodes:[]};return l.nodes.push(i),this[Pn](i),o}start(e,t,n=Date.now()){return this[Wi](e,t,n)}stop(e,t=Date.now()){const n=this[hi](e);n&&(n.stop=t,n.diff=n.stop-n.start||0,this[mi](n))}toJSON(){return Object.assign({},this.root)}prittyPrint(){const e=n=>(n.label=`${n.label} ${n.diff} ms`,n.nodes.length>0&&(n.nodes=n.nodes.map(l=>e(l))),n),t=e(this.toJSON());return Vb(t)}};var Rb=bb,$l={exports:{}},Xl={exports:{}},_n,Zi;function Ab(){if(Zi)return _n;Zi=1;var e=1e3,t=e*60,n=t*60,l=n*24,o=l*7,i=l*365.25;_n=function(u,V){V=V||{};var R=typeof u;if(R==="string"&&u.length>0)return c(u);if(R==="number"&&isFinite(u))return V.long?s(u):a(u);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(u))};function c(u){if(u=String(u),!(u.length>100)){var V=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(u);if(V){var R=parseFloat(V[1]),g=(V[2]||"ms").toLowerCase();switch(g){case"years":case"year":case"yrs":case"yr":case"y":return R*i;case"weeks":case"week":case"w":return R*o;case"days":case"day":case"d":return R*l;case"hours":case"hour":case"hrs":case"hr":case"h":return R*n;case"minutes":case"minute":case"mins":case"min":case"m":return R*t;case"seconds":case"second":case"secs":case"sec":case"s":return R*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return R;default:return}}}}function a(u){var V=Math.abs(u);return V>=l?Math.round(u/l)+"d":V>=n?Math.round(u/n)+"h":V>=t?Math.round(u/t)+"m":V>=e?Math.round(u/e)+"s":u+"ms"}function s(u){var V=Math.abs(u);return V>=l?r(u,V,l,"day"):V>=n?r(u,V,n,"hour"):V>=t?r(u,V,t,"minute"):V>=e?r(u,V,e,"second"):u+" ms"}function r(u,V,R,g){var h=V>=R*1.5;return Math.round(u/R)+" "+g+(h?"s":"")}return _n}function mb(e){n.debug=n,n.default=n,n.coerce=s,n.disable=i,n.enable=o,n.enabled=c,n.humanize=Ab(),n.destroy=r,Object.keys(e).forEach(u=>{n[u]=e[u]}),n.names=[],n.skips=[],n.formatters={};function t(u){let V=0;for(let R=0;R<u.length;R++)V=(V<<5)-V+u.charCodeAt(R),V|=0;return n.colors[Math.abs(V)%n.colors.length]}n.selectColor=t;function n(u){let V,R=null,g,h;function X(...p){if(!X.enabled)return;const W=X,A=Number(new Date),F=A-(V||A);W.diff=F,W.prev=V,W.curr=A,V=A,p[0]=n.coerce(p[0]),typeof p[0]!="string"&&p.unshift("%O");let y=0;p[0]=p[0].replace(/%([a-zA-Z%])/g,(N,U)=>{if(N==="%%")return"%";y++;const S=n.formatters[U];if(typeof S=="function"){const M=p[y];N=S.call(W,M),p.splice(y,1),y--}return N}),n.formatArgs.call(W,p),(W.log||n.log).apply(W,p)}return X.namespace=u,X.useColors=n.useColors(),X.color=n.selectColor(u),X.extend=l,X.destroy=n.destroy,Object.defineProperty(X,"enabled",{enumerable:!0,configurable:!1,get:()=>R!==null?R:(g!==n.namespaces&&(g=n.namespaces,h=n.enabled(u)),h),set:p=>{R=p}}),typeof n.init=="function"&&n.init(X),X}function l(u,V){const R=n(this.namespace+(typeof V>"u"?":":V)+u);return R.log=this.log,R}function o(u){n.save(u),n.namespaces=u,n.names=[],n.skips=[];let V;const R=(typeof u=="string"?u:"").split(/[\s,]+/),g=R.length;for(V=0;V<g;V++)R[V]&&(u=R[V].replace(/\*/g,".*?"),u[0]==="-"?n.skips.push(new RegExp("^"+u.slice(1)+"$")):n.names.push(new RegExp("^"+u+"$")))}function i(){const u=[...n.names.map(a),...n.skips.map(a).map(V=>"-"+V)].join(",");return n.enable(""),u}function c(u){if(u[u.length-1]==="*")return!0;let V,R;for(V=0,R=n.skips.length;V<R;V++)if(n.skips[V].test(u))return!1;for(V=0,R=n.names.length;V<R;V++)if(n.names[V].test(u))return!0;return!1}function a(u){return u.toString().substring(2,u.toString().length-2).replace(/\.\*\?$/,"*")}function s(u){return u instanceof Error?u.stack||u.message:u}function r(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}var gb=mb;(function(e,t){t.formatArgs=l,t.save=o,t.load=i,t.useColors=n,t.storage=c(),t.destroy=(()=>{let s=!1;return()=>{s||(s=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function n(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function l(s){if(s[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+s[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;s.splice(1,0,r,"color: inherit");let u=0,V=0;s[0].replace(/%[a-zA-Z%]/g,R=>{R!=="%%"&&(u++,R==="%c"&&(V=u))}),s.splice(V,0,r)}t.log=console.debug||console.log||(()=>{});function o(s){try{s?t.storage.setItem("debug",s):t.storage.removeItem("debug")}catch{}}function i(){let s;try{s=t.storage.getItem("debug")}catch{}return!s&&typeof B<"u"&&"env"in B&&(s=B.env.DEBUG),s}function c(){try{return localStorage}catch{}}e.exports=gb(t);const{formatters:a}=e.exports;a.j=function(s){try{return JSON.stringify(s)}catch(r){return"[UnexpectedJSONParseError]: "+r.message}}})(Xl,Xl.exports);var wc=Xl.exports;const hb=mc,Wb=yc.EventEmitter,Zb=Nn.inherits,be=wc("avvio"),{AVV_ERR_READY_TIMEOUT:Eb}=Lc,qn=Symbol.for("plugin-meta");function Gb(e,t){return e[qn]&&e[qn].name?e[qn].name:typeof t<"u"&&typeof t!="function"&&t.name?t.name:e.name?e.name:e.toString().split(`
16
- `).slice(0,2).map(n=>n.trim()).join(" -- ")}function Xb(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}function ft(e,t,n,l,o){this.started=!1,this.func=t,this.opts=n,this.onFinish=null,this.parent=e,this.timeout=o===void 0?e._timeout:o,this.name=Gb(t,n),this.isAfter=l,this.q=hb(e,pb,1),this.q.pause(),this._error=null,this.loaded=!1,this._promise=null}Zb(ft,Wb);ft.prototype.exec=function(e,t){const n=this.func;let l=!1;const o=this.name;if(this.parent._error&&!this.isAfter){be("skipping loading of plugin as parent errored and it is not an after",o),B.nextTick(t);return}if(this.isAfter)this.server=e;else try{this.server=this.parent.override(e,n,this.opts)}catch(s){return be("override errored",o),t(s)}this.opts=typeof this.opts=="function"?this.opts(this.server):this.opts,be("exec",o);let i;const c=s=>{if(l){be("loading complete",o);return}this._error=s,be(s?"exec errored":"exec completed",o),l=!0,i&&clearTimeout(i),t(s)};this.timeout>0&&(be("setting up timeout",o,this.timeout),i=setTimeout(function(){be("timed out",o),i=null;const s=new Eb(o);s.fn=n,c(s)},this.timeout)),this.started=!0,this.emit("start",this.server?this.server.name:null,this.name,Date.now());const a=n(this.server,this.opts,c);a&&typeof a.then=="function"&&(be("exec: resolving promise",o),a.then(()=>B.nextTick(c),s=>B.nextTick(c,s)))};ft.prototype.loadedSoFar=function(){if(this.loaded)return Promise.resolve();const e=()=>{this.server.after((n,l)=>{this._error=n,this.q.pause(),n?(be("rejecting promise",this.name,n),this._promise.reject(n)):(be("resolving promise",this.name),this._promise.resolve()),this._promise=null,B.nextTick(l,n)}),this.q.resume()};let t;return this._promise?t=Promise.resolve():(this._promise=Xb(),t=this._promise.promise,this.server?e():this.on("start",e)),t};ft.prototype.enqueue=function(e,t){be("enqueue",this.name,e.name),this.emit("enqueue",this.server?this.server.name:null,this.name,Date.now()),this.q.push(e,t)};ft.prototype.finish=function(e,t){be("finish",this.name,e);const n=()=>{this.loaded||(be("loaded",this.name),this.emit("loaded",this.server?this.server.name:null,this.name,Date.now()),this.loaded=!0,t(e))};if(e){this._promise&&(this._promise.reject(e),this._promise=null),n();return}const l=()=>{if(be("check",this.name,this.q.length(),this.q.running(),this._promise),this.q.length()===0&&this.q.running()===0)if(this._promise){const o=()=>{be("wrap"),queueMicrotask(l)};this._promise.resolve(),this._promise.promise.then(o,o),this._promise=null}else n();else be("delayed",this.name),this.q.drain=()=>{be("drain",this.name),this.q.drain=yb,queueMicrotask(l)}};queueMicrotask(l),this.q.resume()};function pb(e,t){const n=this;B.nextTick(eo.bind(n),e,t)}function eo(e,t){if(typeof e.func.then=="function"){e.func.then(l=>{typeof l.default=="function"&&(l=l.default),e.func=l,eo.call(this,e,t)},t);return}const n=this._current[0];this._current.unshift(e),e.exec(n&&n.server||this._server,l=>{e.finish(l,o=>{this._current.shift(),t(o)})})}function yb(){}$l.exports=ft;$l.exports.loadPlugin=eo;var Fb=$l.exports;const Ei=mc,Sb=yc.EventEmitter,Yb=Nn.inherits,{AVV_ERR_EXPOSE_ALREADY_DEFINED:$n,AVV_ERR_CALLBACK_NOT_FN:zt,AVV_ERR_PLUGIN_NOT_VALID:Nb,AVV_ERR_ROOT_PLG_BOOTED:Ib,AVV_ERR_READY_TIMEOUT:Ub}=Lc,Bb=Rb,pl=Fb,Ut=wc("avvio"),pn=Symbol("kAvvio"),el=Symbol("kThenifyDoNotWrap");function fb(e,t,n){const l=t.expose||{},o=l.use||"use",i=l.after||"after",c=l.ready||"ready",a=l.onClose||"onClose",s=l.close||"close";if(e[o])throw new $n(o);if(e[i])throw new $n(i);if(e[c])throw new $n(c);e[o]=function(r,u){return n.use(r,u),this},Object.defineProperty(e,"then",{get:xc.bind(n)}),e[pn]=!0,e[i]=function(r){return typeof r!="function"?n._loadRegistered():(n.after(tl(r,this)),this)},e[c]=function(r){if(r&&typeof r!="function")throw new zt(c,typeof r);return n.ready(r?tl(r,this):void 0)},e[a]=function(r){if(typeof r!="function")throw new zt(a,typeof r);return n.onClose(vb(r,this)),this},e[s]=function(r){if(r&&typeof r!="function")throw new zt(s,typeof r);return r?(n.close(tl(r,this)),this):n.close()}}function Ve(e,t,n){if(typeof e=="function"&&arguments.length===1&&(n=e,t={},e=null),typeof t=="function"&&(n=t,t={}),t=t||{},!(this instanceof Ve)){const l=new Ve(e,t,n);return e&&fb(e,t,l),l}t.autostart!==!1&&(t.autostart=!0),e=e||this,this._timeout=Number(t.timeout)||0,this._server=e,this._current=[],this._error=null,this._isOnCloseHandlerKey=Symbol("isOnCloseHandler"),this._lastUsed=null,this.setMaxListeners(0),n&&this.once("start",n),this.started=!1,this.booted=!1,this.pluginTree=new Bb,this._readyQ=Ei(this,Mc,1),this._readyQ.pause(),this._readyQ.drain=()=>{this.emit("start"),this._readyQ.drain=Gi},this._closeQ=Ei(this,Qb,1),this._closeQ.pause(),this._closeQ.drain=()=>{this.emit("close"),this._closeQ.drain=Gi},this._doStart=null,this._root=new pl(this,Cb.bind(this),t,!1,0),this._root.once("start",(l,o,i)=>{const c=this.pluginTree.start(null,o,i);this._root.once("loaded",(a,s,r)=>{this.pluginTree.stop(c,r)})}),pl.loadPlugin.call(this,this._root,l=>{Ut("root plugin ready");try{this.emit("preReady"),this._root=null}catch(o){l=l||this._error||o}if(l){if(this._error=l,this._readyQ.length()===0)throw l}else this.booted=!0;this._readyQ.resume()})}function Cb(e,t,n){this._doStart=n,t.autostart&&this.start()}Yb(Ve,Sb);Ve.prototype.start=function(){return this.started=!0,B.nextTick(this._doStart),this};Ve.prototype.override=function(e,t,n){return e};function Jb(e){if(e&&typeof e=="object"&&typeof e.default=="function"&&(e=e.default),!(e&&(typeof e=="function"||typeof e.then=="function")))throw new Nb(typeof e);return e}Ve.prototype[pn]=!0;Ve.prototype.use=function(e,t){return this._lastUsed=this._addPlugin(e,t,!1),this};Ve.prototype._loadRegistered=function(){const e=this._current[0];return!this.started&&!this.booted&&B.nextTick(()=>this._root.q.resume()),e?e.loadedSoFar():Promise.resolve()};Object.defineProperty(Ve.prototype,"then",{get:xc});Ve.prototype._addPlugin=function(e,t,n){if(e=Jb(e),t=t||{},this.booted)throw new Ib;const l=this._current[0],o=new pl(this,e,t,n);if(o.once("start",(i,c,a)=>{const s=this.pluginTree.start(l.name,c,a);o.once("loaded",(r,u,V)=>{this.pluginTree.stop(s,V)})}),l.loaded)throw new Error(o.name,l.name);return l.enqueue(o,i=>{i&&(this._error=i)}),o};Ve.prototype.after=function(e){if(!e)return this._loadRegistered();this._addPlugin(t.bind(this),{},!0);function t(n,l,o){Mc.call(this,e,o)}return this};Ve.prototype.onClose=function(e){if(typeof e!="function")throw new Error("not a function");e[this._isOnCloseHandlerKey]=!0,this._closeQ.unshift(e,t.bind(this));function t(n){n&&(this._error=n)}return this};Ve.prototype.close=function(e){let t;if(e){if(typeof e!="function")throw new zt("close",typeof e)}else t=new Promise(function(n,l){e=function(o){if(o)return l(o);n()}});return this.ready(()=>{this._error=null,this._closeQ.push(e),B.nextTick(this._closeQ.resume.bind(this._closeQ))}),t};Ve.prototype.ready=function(e){if(e){if(typeof e!="function")throw new zt("ready",typeof e);this._readyQ.push(e),queueMicrotask(this.start.bind(this));return}return new Promise((t,n)=>{this._readyQ.push(o),this.start();const l=this._current[0].server;function o(i,c,a){i?n(i):t(l),B.nextTick(a)}})};Ve.prototype.prettyPrint=function(){return this.pluginTree.prittyPrint()};Ve.prototype.toJSON=function(){return this.pluginTree.toJSON()};function Gi(){}function xc(){if(this.booted){Ut("thenify returning null because we are already booted");return}if(this[el]){this[el]=!1;return}return Ut("thenify"),(e,t)=>this._loadRegistered().then(()=>(this[el]=!0,e(this._server)),t)}function Mc(e,t){const n=this._server,l=this._error;let o;if(this._error=null,e.length===0)this._error=l,o=e(),o&&!o[pn]&&typeof o.then=="function"?o.then(()=>B.nextTick(t),i=>B.nextTick(t,i)):B.nextTick(t);else if(e.length===1)o=e(l),o&&!o[pn]&&typeof o.then=="function"?o.then(()=>B.nextTick(t),i=>B.nextTick(t,i)):B.nextTick(t);else if(this._timeout===0){const i=c=>{this._error=c,t(this._error)};e.length===2?e(l,i):e(l,n,i)}else Tb.call(this,e,l,n,t)}function Tb(e,t,n,l){const o=e.name;Ut("setting up ready timeout",o,this._timeout);let i=setTimeout(()=>{Ut("timed out",o),i=null;const a=new Ub(o);a.fn=e,this._error=a,l(a)},this._timeout);e.length===2?e(t,c.bind(this)):e(t,n,c.bind(this));function c(a){i&&(clearTimeout(i),this._error=a,l(this._error))}}function Qb(e,t){const n=this._server,l=e[this._isOnCloseHandlerKey];if(e.length===0||e.length===1){let o;l?o=e(n):o=e(this._error),o&&typeof o.then=="function"?(Ut("resolving close/onClose promise"),o.then(()=>B.nextTick(t),i=>B.nextTick(t,i))):B.nextTick(t)}else e.length===2?e(l?n:this._error,t):l?e(n,t):e(this._error,n,t)}function vb(e,t){return n.bind(t);function n(l,o){let i;e.length===0?(i=e(),i&&i.then?i.then(function(){B.nextTick(o)},o):B.nextTick(o)):e.length===1?(i=e(this),i&&i.then?i.then(function(){B.nextTick(o)},o):B.nextTick(o)):e(this,o)}}function tl(e,t){return n.bind(t);function n(l,o){let i;e?e.length===0?(i=e(),i&&i.then?i.then(function(){B.nextTick(o,l)},o):B.nextTick(o,l)):e.length===1?(i=e(l),i&&i.then?i.then(function(){B.nextTick(o)},o):B.nextTick(o)):e.length===2?e(l,o):e(l,this,o):B.nextTick(o)}}Ll.exports=Ve;Ll.exports.express=function(e){return Ve(e,{expose:{use:"load"}})};var kb=Ll.exports;const zb=Ru(kb);(function(){if(window.requestAnimationFrame&&window.cancelAnimationFrame)return;const e=["webkit","moz","ms","o"];for(const t of e)window.requestAnimationFrame=window.requestAnimationFrame||window[`${t}RequestAnimationFrame`],window.cancelAnimationFrame=window.cancelAnimationFrame||window[`${t}CancelAnimationFrame`]||window[`${t}CancelRequestAnimationFrame`];if(/iP(ad|hone|od).*OS 6/.test(window.navigator.userAgent)||!window.requestAnimationFrame||!window.cancelAnimationFrame){let t=0;const n=!!(window.performance&&window.performance.now);window.requestAnimationFrame=function(l){const o=n?window.performance.now():new Date().getTime(),i=Math.max(0,16-(o-t)),c=window.setTimeout(function(){l(o+i)},i);return t=o+i,c},window.cancelAnimationFrame=clearTimeout}})();function Kb(e,t=!0,n=!0,l={friendsTab:"enabled"}){const o=t?"https://grpc-sdk.streamlayer.io:443":"https://grpc-sdk.next.streamlayer.io:443",i=t?"https://grpc.streamlayer.io:443":"https://grpc.next.streamlayer.io:443",c=zb(Object.create({}),{autostart:!1});return c.use(Md,{hideFriends:l.hideFriends,skipOnboarding:l.skipOnboarding,betPack:l.betPack,friendsTab:l.friendsTab,theme:l.theme,themeMode:l.themeMode}),c.use(vd,{onDeepLinkHandled:l==null?void 0:l.onDeepLinkHandled}),c.use(Ld,{videoPlayerController:l==null?void 0:l.videoPlayerController}),c.use(xd,{onContentActivate:l==null?void 0:l.onContentActivate,withAd:l==null?void 0:l.withAd,withAdNotification:l==null?void 0:l.withAdNotification}),c.use(od,{sdkKey:e,host:o,analyticsHost:i,version:l==null?void 0:l.version,webOS:l==null?void 0:l.webOS}),c.use(rd),c.use(Kd),c.use(nu),c.use(Ud),c.use(bu),c.after((a,s,r)=>{if(a)throw a;s.ready(),r()}),n&&c.after(async(a,s,r)=>{if(a)throw a;await s.sdk.initializeApp(),r()}),c.onClose(()=>{console.log("close StreamLayer instance")}),c}const Lb=({sdkKey:e,plugins:t,production:n,autoEnable:l,onDeepLinkHandled:o,videoPlayerController:i,onContentActivate:c,hideFriends:a,skipOnboarding:s,withAdNotification:r,withAd:u,friendsTab:V,betPack:R,webOS:g})=>{const[h,X]=oo.useState(null);return oo.useEffect(()=>{let p=!1;if(!e)return console.error("streamlayer sdk key should be provided"),X(A=>(A!==null&&typeof A.disableApp=="function"&&A.disableApp(),null)),()=>{p=!0};const W=Kb(e,n,l,{version:"1.21.0",onDeepLinkHandled:o,videoPlayerController:i,onContentActivate:c,skipOnboarding:s,withAdNotification:r,withAd:u,hideFriends:a,friendsTab:V,betPack:R,webOS:g});if(t)for(const A of t)W.use(A);return W.ready().then(A=>{p||(X(A.sdk),typeof window<"u")}).catch(A=>console.log(A)),()=>{p=!0,W.close(function(A){if(A)throw A})}},[e,n]),h};exports.AdUnit=pe;exports.AutoPlayVideo=$s;exports.CloseTimerAuto=_s;exports.CtaIconMode=vs;exports.InvitationFrom=rl;exports.NotificationEnabled=sl;exports.NotificationPromotionImagePosition=Cs;exports.NotificationPromotionMode=Bs;exports.NotificationSponsorLogoMode=Ts;exports.NotificationUseContentMedia=Ds;exports.PickHistoryStatus=Tt;exports.PlayVideoMuted=tr;exports.PromotionButtonType=Ks;exports.PromotionLogoMode=ws;exports.PromotionType=T;exports.QuestionImages=Is;exports.QuestionStatus=ue;exports.QuestionType=f;exports.SdkOverlayType=O;exports.global=dl;exports.useStreamLayerApp=Lb;
16
+ `).slice(0,2).map(n=>n.trim()).join(" -- ")}function Xb(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}function ft(e,t,n,l,o){this.started=!1,this.func=t,this.opts=n,this.onFinish=null,this.parent=e,this.timeout=o===void 0?e._timeout:o,this.name=Gb(t,n),this.isAfter=l,this.q=hb(e,pb,1),this.q.pause(),this._error=null,this.loaded=!1,this._promise=null}Zb(ft,Wb);ft.prototype.exec=function(e,t){const n=this.func;let l=!1;const o=this.name;if(this.parent._error&&!this.isAfter){be("skipping loading of plugin as parent errored and it is not an after",o),B.nextTick(t);return}if(this.isAfter)this.server=e;else try{this.server=this.parent.override(e,n,this.opts)}catch(s){return be("override errored",o),t(s)}this.opts=typeof this.opts=="function"?this.opts(this.server):this.opts,be("exec",o);let i;const c=s=>{if(l){be("loading complete",o);return}this._error=s,be(s?"exec errored":"exec completed",o),l=!0,i&&clearTimeout(i),t(s)};this.timeout>0&&(be("setting up timeout",o,this.timeout),i=setTimeout(function(){be("timed out",o),i=null;const s=new Eb(o);s.fn=n,c(s)},this.timeout)),this.started=!0,this.emit("start",this.server?this.server.name:null,this.name,Date.now());const a=n(this.server,this.opts,c);a&&typeof a.then=="function"&&(be("exec: resolving promise",o),a.then(()=>B.nextTick(c),s=>B.nextTick(c,s)))};ft.prototype.loadedSoFar=function(){if(this.loaded)return Promise.resolve();const e=()=>{this.server.after((n,l)=>{this._error=n,this.q.pause(),n?(be("rejecting promise",this.name,n),this._promise.reject(n)):(be("resolving promise",this.name),this._promise.resolve()),this._promise=null,B.nextTick(l,n)}),this.q.resume()};let t;return this._promise?t=Promise.resolve():(this._promise=Xb(),t=this._promise.promise,this.server?e():this.on("start",e)),t};ft.prototype.enqueue=function(e,t){be("enqueue",this.name,e.name),this.emit("enqueue",this.server?this.server.name:null,this.name,Date.now()),this.q.push(e,t)};ft.prototype.finish=function(e,t){be("finish",this.name,e);const n=()=>{this.loaded||(be("loaded",this.name),this.emit("loaded",this.server?this.server.name:null,this.name,Date.now()),this.loaded=!0,t(e))};if(e){this._promise&&(this._promise.reject(e),this._promise=null),n();return}const l=()=>{if(be("check",this.name,this.q.length(),this.q.running(),this._promise),this.q.length()===0&&this.q.running()===0)if(this._promise){const o=()=>{be("wrap"),queueMicrotask(l)};this._promise.resolve(),this._promise.promise.then(o,o),this._promise=null}else n();else be("delayed",this.name),this.q.drain=()=>{be("drain",this.name),this.q.drain=yb,queueMicrotask(l)}};queueMicrotask(l),this.q.resume()};function pb(e,t){const n=this;B.nextTick(eo.bind(n),e,t)}function eo(e,t){if(typeof e.func.then=="function"){e.func.then(l=>{typeof l.default=="function"&&(l=l.default),e.func=l,eo.call(this,e,t)},t);return}const n=this._current[0];this._current.unshift(e),e.exec(n&&n.server||this._server,l=>{e.finish(l,o=>{this._current.shift(),t(o)})})}function yb(){}$l.exports=ft;$l.exports.loadPlugin=eo;var Fb=$l.exports;const Ei=mc,Sb=yc.EventEmitter,Yb=Nn.inherits,{AVV_ERR_EXPOSE_ALREADY_DEFINED:$n,AVV_ERR_CALLBACK_NOT_FN:zt,AVV_ERR_PLUGIN_NOT_VALID:Nb,AVV_ERR_ROOT_PLG_BOOTED:Ib,AVV_ERR_READY_TIMEOUT:Ub}=Lc,Bb=Rb,pl=Fb,Ut=wc("avvio"),pn=Symbol("kAvvio"),el=Symbol("kThenifyDoNotWrap");function fb(e,t,n){const l=t.expose||{},o=l.use||"use",i=l.after||"after",c=l.ready||"ready",a=l.onClose||"onClose",s=l.close||"close";if(e[o])throw new $n(o);if(e[i])throw new $n(i);if(e[c])throw new $n(c);e[o]=function(r,u){return n.use(r,u),this},Object.defineProperty(e,"then",{get:xc.bind(n)}),e[pn]=!0,e[i]=function(r){return typeof r!="function"?n._loadRegistered():(n.after(tl(r,this)),this)},e[c]=function(r){if(r&&typeof r!="function")throw new zt(c,typeof r);return n.ready(r?tl(r,this):void 0)},e[a]=function(r){if(typeof r!="function")throw new zt(a,typeof r);return n.onClose(vb(r,this)),this},e[s]=function(r){if(r&&typeof r!="function")throw new zt(s,typeof r);return r?(n.close(tl(r,this)),this):n.close()}}function Ve(e,t,n){if(typeof e=="function"&&arguments.length===1&&(n=e,t={},e=null),typeof t=="function"&&(n=t,t={}),t=t||{},!(this instanceof Ve)){const l=new Ve(e,t,n);return e&&fb(e,t,l),l}t.autostart!==!1&&(t.autostart=!0),e=e||this,this._timeout=Number(t.timeout)||0,this._server=e,this._current=[],this._error=null,this._isOnCloseHandlerKey=Symbol("isOnCloseHandler"),this._lastUsed=null,this.setMaxListeners(0),n&&this.once("start",n),this.started=!1,this.booted=!1,this.pluginTree=new Bb,this._readyQ=Ei(this,Mc,1),this._readyQ.pause(),this._readyQ.drain=()=>{this.emit("start"),this._readyQ.drain=Gi},this._closeQ=Ei(this,Qb,1),this._closeQ.pause(),this._closeQ.drain=()=>{this.emit("close"),this._closeQ.drain=Gi},this._doStart=null,this._root=new pl(this,Cb.bind(this),t,!1,0),this._root.once("start",(l,o,i)=>{const c=this.pluginTree.start(null,o,i);this._root.once("loaded",(a,s,r)=>{this.pluginTree.stop(c,r)})}),pl.loadPlugin.call(this,this._root,l=>{Ut("root plugin ready");try{this.emit("preReady"),this._root=null}catch(o){l=l||this._error||o}if(l){if(this._error=l,this._readyQ.length()===0)throw l}else this.booted=!0;this._readyQ.resume()})}function Cb(e,t,n){this._doStart=n,t.autostart&&this.start()}Yb(Ve,Sb);Ve.prototype.start=function(){return this.started=!0,B.nextTick(this._doStart),this};Ve.prototype.override=function(e,t,n){return e};function Jb(e){if(e&&typeof e=="object"&&typeof e.default=="function"&&(e=e.default),!(e&&(typeof e=="function"||typeof e.then=="function")))throw new Nb(typeof e);return e}Ve.prototype[pn]=!0;Ve.prototype.use=function(e,t){return this._lastUsed=this._addPlugin(e,t,!1),this};Ve.prototype._loadRegistered=function(){const e=this._current[0];return!this.started&&!this.booted&&B.nextTick(()=>this._root.q.resume()),e?e.loadedSoFar():Promise.resolve()};Object.defineProperty(Ve.prototype,"then",{get:xc});Ve.prototype._addPlugin=function(e,t,n){if(e=Jb(e),t=t||{},this.booted)throw new Ib;const l=this._current[0],o=new pl(this,e,t,n);if(o.once("start",(i,c,a)=>{const s=this.pluginTree.start(l.name,c,a);o.once("loaded",(r,u,V)=>{this.pluginTree.stop(s,V)})}),l.loaded)throw new Error(o.name,l.name);return l.enqueue(o,i=>{i&&(this._error=i)}),o};Ve.prototype.after=function(e){if(!e)return this._loadRegistered();this._addPlugin(t.bind(this),{},!0);function t(n,l,o){Mc.call(this,e,o)}return this};Ve.prototype.onClose=function(e){if(typeof e!="function")throw new Error("not a function");e[this._isOnCloseHandlerKey]=!0,this._closeQ.unshift(e,t.bind(this));function t(n){n&&(this._error=n)}return this};Ve.prototype.close=function(e){let t;if(e){if(typeof e!="function")throw new zt("close",typeof e)}else t=new Promise(function(n,l){e=function(o){if(o)return l(o);n()}});return this.ready(()=>{this._error=null,this._closeQ.push(e),B.nextTick(this._closeQ.resume.bind(this._closeQ))}),t};Ve.prototype.ready=function(e){if(e){if(typeof e!="function")throw new zt("ready",typeof e);this._readyQ.push(e),queueMicrotask(this.start.bind(this));return}return new Promise((t,n)=>{this._readyQ.push(o),this.start();const l=this._current[0].server;function o(i,c,a){i?n(i):t(l),B.nextTick(a)}})};Ve.prototype.prettyPrint=function(){return this.pluginTree.prittyPrint()};Ve.prototype.toJSON=function(){return this.pluginTree.toJSON()};function Gi(){}function xc(){if(this.booted){Ut("thenify returning null because we are already booted");return}if(this[el]){this[el]=!1;return}return Ut("thenify"),(e,t)=>this._loadRegistered().then(()=>(this[el]=!0,e(this._server)),t)}function Mc(e,t){const n=this._server,l=this._error;let o;if(this._error=null,e.length===0)this._error=l,o=e(),o&&!o[pn]&&typeof o.then=="function"?o.then(()=>B.nextTick(t),i=>B.nextTick(t,i)):B.nextTick(t);else if(e.length===1)o=e(l),o&&!o[pn]&&typeof o.then=="function"?o.then(()=>B.nextTick(t),i=>B.nextTick(t,i)):B.nextTick(t);else if(this._timeout===0){const i=c=>{this._error=c,t(this._error)};e.length===2?e(l,i):e(l,n,i)}else Tb.call(this,e,l,n,t)}function Tb(e,t,n,l){const o=e.name;Ut("setting up ready timeout",o,this._timeout);let i=setTimeout(()=>{Ut("timed out",o),i=null;const a=new Ub(o);a.fn=e,this._error=a,l(a)},this._timeout);e.length===2?e(t,c.bind(this)):e(t,n,c.bind(this));function c(a){i&&(clearTimeout(i),this._error=a,l(this._error))}}function Qb(e,t){const n=this._server,l=e[this._isOnCloseHandlerKey];if(e.length===0||e.length===1){let o;l?o=e(n):o=e(this._error),o&&typeof o.then=="function"?(Ut("resolving close/onClose promise"),o.then(()=>B.nextTick(t),i=>B.nextTick(t,i))):B.nextTick(t)}else e.length===2?e(l?n:this._error,t):l?e(n,t):e(this._error,n,t)}function vb(e,t){return n.bind(t);function n(l,o){let i;e.length===0?(i=e(),i&&i.then?i.then(function(){B.nextTick(o)},o):B.nextTick(o)):e.length===1?(i=e(this),i&&i.then?i.then(function(){B.nextTick(o)},o):B.nextTick(o)):e(this,o)}}function tl(e,t){return n.bind(t);function n(l,o){let i;e?e.length===0?(i=e(),i&&i.then?i.then(function(){B.nextTick(o,l)},o):B.nextTick(o,l)):e.length===1?(i=e(l),i&&i.then?i.then(function(){B.nextTick(o)},o):B.nextTick(o)):e.length===2?e(l,o):e(l,this,o):B.nextTick(o)}}Ll.exports=Ve;Ll.exports.express=function(e){return Ve(e,{expose:{use:"load"}})};var kb=Ll.exports;const zb=Ru(kb);(function(){if(window.requestAnimationFrame&&window.cancelAnimationFrame)return;const e=["webkit","moz","ms","o"];for(const t of e)window.requestAnimationFrame=window.requestAnimationFrame||window[`${t}RequestAnimationFrame`],window.cancelAnimationFrame=window.cancelAnimationFrame||window[`${t}CancelAnimationFrame`]||window[`${t}CancelRequestAnimationFrame`];if(/iP(ad|hone|od).*OS 6/.test(window.navigator.userAgent)||!window.requestAnimationFrame||!window.cancelAnimationFrame){let t=0;const n=!!(window.performance&&window.performance.now);window.requestAnimationFrame=function(l){const o=n?window.performance.now():new Date().getTime(),i=Math.max(0,16-(o-t)),c=window.setTimeout(function(){l(o+i)},i);return t=o+i,c},window.cancelAnimationFrame=clearTimeout}})();function Kb(e,t=!0,n=!0,l={friendsTab:"enabled"}){const o=t?"https://grpc-sdk.streamlayer.io:443":"https://grpc-sdk.next.streamlayer.io:443",i=t?"https://grpc.streamlayer.io:443":"https://grpc.next.streamlayer.io:443",c=zb(Object.create({}),{autostart:!1});return c.use(Md,{hideFriends:l.hideFriends,skipOnboarding:l.skipOnboarding,betPack:l.betPack,friendsTab:l.friendsTab,theme:l.theme,themeMode:l.themeMode}),c.use(vd,{onDeepLinkHandled:l==null?void 0:l.onDeepLinkHandled}),c.use(Ld,{videoPlayerController:l==null?void 0:l.videoPlayerController}),c.use(xd,{onContentActivate:l==null?void 0:l.onContentActivate,withAd:l==null?void 0:l.withAd,withAdNotification:l==null?void 0:l.withAdNotification}),c.use(od,{sdkKey:e,host:o,analyticsHost:i,version:l==null?void 0:l.version,webOS:l==null?void 0:l.webOS}),c.use(rd),c.use(Kd),c.use(nu),c.use(Ud),c.use(bu),c.after((a,s,r)=>{if(a)throw a;s.ready(),r()}),n&&c.after(async(a,s,r)=>{if(a)throw a;await s.sdk.initializeApp(),r()}),c.onClose(()=>{console.log("close StreamLayer instance")}),c}const Lb=({sdkKey:e,plugins:t,production:n,autoEnable:l,onDeepLinkHandled:o,videoPlayerController:i,onContentActivate:c,hideFriends:a,skipOnboarding:s,withAdNotification:r,withAd:u,friendsTab:V,betPack:R,webOS:g})=>{const[h,X]=oo.useState(null);return oo.useEffect(()=>{let p=!1;if(!e)return console.error("streamlayer sdk key should be provided"),X(A=>(A!==null&&typeof A.disableApp=="function"&&A.disableApp(),null)),()=>{p=!0};const W=Kb(e,n,l,{version:"1.21.1",onDeepLinkHandled:o,videoPlayerController:i,onContentActivate:c,skipOnboarding:s,withAdNotification:r,withAd:u,hideFriends:a,friendsTab:V,betPack:R,webOS:g});if(t)for(const A of t)W.use(A);return W.ready().then(A=>{p||(X(A.sdk),typeof window<"u")}).catch(A=>console.log(A)),()=>{p=!0,W.close(function(A){if(A)throw A})}},[e,n]),h};exports.AdUnit=pe;exports.AutoPlayVideo=$s;exports.CloseTimerAuto=_s;exports.CtaIconMode=vs;exports.InvitationFrom=rl;exports.NotificationEnabled=sl;exports.NotificationPromotionImagePosition=Cs;exports.NotificationPromotionMode=Bs;exports.NotificationSponsorLogoMode=Ts;exports.NotificationUseContentMedia=Ds;exports.PickHistoryStatus=Tt;exports.PlayVideoMuted=tr;exports.PromotionButtonType=Ks;exports.PromotionLogoMode=ws;exports.PromotionType=T;exports.QuestionImages=Is;exports.QuestionStatus=ue;exports.QuestionType=f;exports.SdkOverlayType=O;exports.global=dl;exports.useStreamLayerApp=Lb;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),e=require("./provider.js");require("nanostores");const i=require("react");require("@nanostores/react");require("lodash.throttle");require("react-dom");require("react-countup");const B=require("./vast-client.min-B0NUra1B.js"),_={},I=new B.ce,T=e.i(_),E=e.createLogger("ui:gam-static"),w=s=>new Promise((t,a)=>{const l=new Image;l.onload=()=>t(s),l.onerror=()=>a(),l.src=s}),R=()=>{const s=i.useRef(0);return[i.useCallback(async t=>{var a,l,r,p,c,u,y,d,h,x,A;if((a=T.get()[t])!=null&&a.imageSrc)return{success:!0};const v=Date.now();s.current=v,T.setKey(t,{id:"",url:t});try{e.eventBus.emit("exposedPauseAd",{action:"load",payload:{}});const m=await I.get(t);if(E.debug(m,"parsedVAST"),s.current===v&&T.get()[t].url){const o=m.ads.find(f=>f.creatives.length>0);if(o){E.debug(o,"validAd");const f=o.creatives.find(g=>g.type==="nonlinear");if(f){E.debug(f,"nonlinear");const g=(r=(l=f.variations)==null?void 0:l[0])==null?void 0:r.staticResource,j=(c=(p=f.variations)==null?void 0:p[0])==null?void 0:c.nonlinearClickThroughURLTemplate;if(g)return await w(g),T.setKey(t,{id:o.id||"",url:t,imageSrc:g,adUrl:j}),e.eventBus.emit("exposedPauseAd",{action:"loaded",payload:{id:o.id||""}}),{success:!0}}const P=o.creatives.find(g=>g.type==="companion");E.debug(P,"companion");const k=(h=(d=(y=(u=P==null?void 0:P.variations)==null?void 0:u[0])==null?void 0:y.staticResources)==null?void 0:d[0])==null?void 0:h.url,S=(A=(x=P==null?void 0:P.variations)==null?void 0:x[0])==null?void 0:A.companionClickThroughURLTemplate;if(k)return await w(k),T.setKey(t,{id:o.id||"",url:t,imageSrc:k,adUrl:S}),e.eventBus.emit("exposedPauseAd",{action:"loaded",payload:{id:o.id||""}}),{success:!0}}}}catch(m){console.error("Error parsing VAST",m)}return{success:!1}},[]),T]},L=e.styled_default("div")({name:"PauseAdOverlay",class:"pw9gih8",propsAsIs:!1}),D=e.styled_default("div")({name:"PauseAdContent",class:"p8lpomy",propsAsIs:!1}),q=e.styled_default("div")({name:"PauseAdGradientRight",class:"pv7u167",propsAsIs:!1}),U=e.styled_default("div")({name:"PauseAdGradientBottom",class:"p1kh2yb0",propsAsIs:!1}),V=e.styled_default("div")({name:"PauseAdTopLeft",class:"pl8f94x",propsAsIs:!1}),K=e.styled_default("h2")({name:"PauseAdTitle",class:"p1m6zmrt",propsAsIs:!1}),M=e.styled_default("p")({name:"PauseAdCaption",class:"pm3vwfa",propsAsIs:!1}),F=e.styled_default("div")({name:"PauseAdBottomLeft",class:"p1tibuhw",propsAsIs:!1}),N=e.styled_default("button")({name:"PauseAdPlayButton",class:"ptqqrqd",propsAsIs:!1}),G=e.styled_default("div")({name:"PauseAdSidebar",class:"p14estxv",propsAsIs:!1}),O=e.styled_default("span")({name:"PauseAdTitleDescription",class:"p1dpvfl1",propsAsIs:!1}),C=e.styled_default("img")({name:"ExternalAdContainer",class:"ezfmabr",propsAsIs:!1}),z=({vastUrl:s,isDesktop:t})=>{var a;const[,l]=R(),r=e.useStore(l,{keys:[s]});return i.useEffect(()=>{r&&r[s]&&r[s].imageSrc&&r[s].id&&e.eventBus.emit("exposedPauseAd",{action:"rendered",payload:{id:r[s].id}})},[r,s]),(a=r==null?void 0:r[s])!=null&&a.imageSrc?!r[s].adUrl||!t?n.jsx(C,{src:r[s].imageSrc}):n.jsx("a",{onClick:()=>{e.eventBus.emit("exposedPauseAd",{action:"navigated",payload:{id:r[s].id}})},href:r[s].adUrl,target:"_blank",rel:"noopener noreferrer",children:n.jsx(C,{src:r[s].imageSrc})}):null},$=({isClosing:s,title:t,caption:a,onPlay:l,onClose:r,vastUrl:p,options:c,isDesktop:u})=>{const y=(c==null?void 0:c.showPauseButton)??!0,{ref:d,focusSelf:h}=e.distExports.useFocusable({focusKey:"sl-pause-ad-play",onEnterRelease:l,isFocusBoundary:!0,forceFocus:!0});return i.useEffect(()=>{d.current&&h()},[d,h]),i.useEffect(()=>{if(!r)return()=>{};const x=A=>{const v=A.keyCode;if(v===461||v===10009||v===27||v===8){A.preventDefault(),A.stopPropagation(),A.stopImmediatePropagation(),r();return}};return window.addEventListener("keydown",x,{capture:!0}),()=>window.removeEventListener("keydown",x,{capture:!0})},[r]),n.jsx(L,{className:e.cx_default("SL_PauseAdOverlay",s&&"pause-ad-closing"),children:n.jsxs(D,{children:[n.jsx(q,{}),n.jsx(U,{}),n.jsxs(V,{children:[n.jsx(K,{children:t}),n.jsx(M,{children:a})]}),y&&n.jsx(F,{children:n.jsx(N,{ref:d,onClick:l,onMouseEnter:()=>d.current.focus(),"aria-label":"Resume playback"})}),n.jsxs(G,{children:[p&&n.jsx(z,{isDesktop:u,vastUrl:p}),n.jsx(O,{children:"ADVERTISEMENT"})]})]})})},W=({showPauseAd:s,vastUrls:t,title:a,caption:l,sdk:r,onClose:p,onRender:c,options:u,isDesktop:y})=>{const d=(u==null?void 0:u.pauseAdDelay)??5e3,[h,x]=i.useState(!1),[A,v]=i.useState(!1),m=i.useRef(),o=t==null?void 0:t[0].url,f=i.useRef(o);f.current=o;const[P,k]=R(),S=i.useCallback(()=>{p&&(e.eventBus.emit("exposedPauseAd",{action:"closed",payload:{}}),p())},[p]),g=i.useCallback(()=>{r.controlVideoPlayer({play:!0})},[r]);return i.useEffect(()=>{if(s&&o){e.eventBus.emit("exposedPauseAd",{action:"enabled",payload:{}}),P(o).then(b=>{f.current===o&&(b==null?void 0:b.success)!==!0&&(clearTimeout(m.current),S==null||S())}).catch(()=>{f.current===o&&(clearTimeout(m.current),S==null||S())});const j=()=>{const b=k.get()[f.current];b!=null&&b.imageSrc?(clearTimeout(m.current),v(!1),x(!0)):m.current=setTimeout(()=>{j()},200)};m.current=setTimeout(()=>{j()},d)}else e.eventBus.emit("exposedPauseAd",{action:"disabled",payload:{}}),v(!0),m.current=setTimeout(()=>{x(!1)},400);return()=>{m.current&&clearTimeout(m.current)}},[k,P,S,d,s,o]),i.useEffect(()=>{c==null||c({rendered:h})},[h,c]),i.useEffect(()=>()=>{c==null||c({rendered:!1})},[c]),h?n.jsx($,{onClose:S,isClosing:A,title:a,caption:l,onPlay:g,vastUrl:o,options:u,isDesktop:y}):null},X=({showPauseAd:s,pauseAdVastUrl:t,videoPlayerController:a,onRenderPauseAd:l,onClosePauseAd:r,children:p,options:c})=>{const u=e.useStreamLayer(),y=e.useStreamLayerTheme(),d=i.useRef();return i.useEffect(()=>u?(a&&(d.current=a,u.addVideoPlayerController(d.current)),()=>{d.current&&u.removeVideoPlayerController(d.current)}):()=>{},[u,a]),u?n.jsx("div",{className:"StreamLayerSDK",children:n.jsxs(e.h,{style:p?{position:"relative"}:{},customTheme:y.theme,themeMode:y.themeMode,children:[p,t&&n.jsx(W,{sdk:u,showPauseAd:s,vastUrls:t,onClose:r,onRender:l,options:c,isDesktop:!0})]})}):p};class H extends i.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,a){console.error(t,a.componentStack)}render(){return this.state.hasError?this.props.children:n.jsx(X,{...this.props})}}exports.StreamLayerPauseAd=H;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),e=require("./provider.js");require("nanostores");const i=require("react");require("@nanostores/react");require("lodash.throttle");require("react-dom");require("react-countup");const R=require("./vast-client.min-B0NUra1B.js"),_={},B=new R.ce,k=e.i(_),j=e.createLogger("ui:gam-static"),C=s=>new Promise((t,n)=>{const l=new Image;l.onload=()=>t(s),l.onerror=()=>n(),l.src=s}),L=()=>{const s=i.useRef(0);return[i.useCallback(async t=>{var n,l,r,p,c,u,y,d,h,x,A;if((n=k.get()[t])!=null&&n.imageSrc)return{success:!0};const f=Date.now();s.current=f,k.setKey(t,{id:"",url:t});try{e.eventBus.emit("exposedPauseAd",{action:"load",payload:{}});const m=await B.get(t);if(j.debug(m,"parsedVAST"),s.current===f&&k.get()[t].url){const o=m.ads.find(v=>v.creatives.length>0);if(o){j.debug(o,"validAd");const v=o.creatives.find(g=>g.type==="nonlinear");if(v){j.debug(v,"nonlinear");const g=(r=(l=v.variations)==null?void 0:l[0])==null?void 0:r.staticResource,E=(c=(p=v.variations)==null?void 0:p[0])==null?void 0:c.nonlinearClickThroughURLTemplate;if(g)return await C(g),k.setKey(t,{id:o.id||"",url:t,imageSrc:g,adUrl:E}),e.eventBus.emit("exposedPauseAd",{action:"loaded",payload:{id:o.id||""}}),{success:!0}}const P=o.creatives.find(g=>g.type==="companion");j.debug(P,"companion");const b=(h=(d=(y=(u=P==null?void 0:P.variations)==null?void 0:u[0])==null?void 0:y.staticResources)==null?void 0:d[0])==null?void 0:h.url,S=(A=(x=P==null?void 0:P.variations)==null?void 0:x[0])==null?void 0:A.companionClickThroughURLTemplate;if(b)return await C(b),k.setKey(t,{id:o.id||"",url:t,imageSrc:b,adUrl:S}),e.eventBus.emit("exposedPauseAd",{action:"loaded",payload:{id:o.id||""}}),{success:!0}}}}catch(m){console.error("Error parsing VAST",m)}return{success:!1}},[]),k]},D=e.styled_default("div")({name:"PauseAdOverlay",class:"pw9gih8",propsAsIs:!1}),I=e.styled_default("div")({name:"PauseAdContent",class:"p8lpomy",propsAsIs:!1}),q=e.styled_default("div")({name:"PauseAdTopLeft",class:"pv7u167",propsAsIs:!1}),U=e.styled_default("h2")({name:"PauseAdTitle",class:"p1kh2yb0",propsAsIs:!1}),M=e.styled_default("p")({name:"PauseAdCaption",class:"pl8f94x",propsAsIs:!1}),V=e.styled_default("div")({name:"PauseAdBottomLeft",class:"p1m6zmrt",propsAsIs:!1}),K=e.styled_default("button")({name:"PauseAdPlayButton",class:"pm3vwfa",propsAsIs:!1}),N=e.styled_default("div")({name:"PauseAdSidebarGradient",class:"p1tibuhw",propsAsIs:!1}),F=e.styled_default("div")({name:"PauseAdSidebar",class:"ptqqrqd",propsAsIs:!1}),$=e.styled_default("span")({name:"PauseAdTitleDescription",class:"p14estxv",propsAsIs:!1}),w=e.styled_default("img")({name:"ExternalAdContainer",class:"e1dpvfl1",propsAsIs:!1}),O=({vastUrl:s,isDesktop:t})=>{var n;const[,l]=L(),r=e.useStore(l,{keys:[s]});return i.useEffect(()=>{r&&r[s]&&r[s].imageSrc&&r[s].id&&e.eventBus.emit("exposedPauseAd",{action:"rendered",payload:{id:r[s].id}})},[r,s]),(n=r==null?void 0:r[s])!=null&&n.imageSrc?!r[s].adUrl||!t?a.jsx(w,{src:r[s].imageSrc}):a.jsx("a",{onClick:()=>{e.eventBus.emit("exposedPauseAd",{action:"navigated",payload:{id:r[s].id}})},href:r[s].adUrl,target:"_blank",rel:"noopener noreferrer",children:a.jsx(w,{src:r[s].imageSrc})}):null},z=({isClosing:s,title:t,caption:n,onPlay:l,onClose:r,vastUrl:p,options:c,isDesktop:u})=>{const y=(c==null?void 0:c.showPauseButton)??!0,{ref:d,focusSelf:h}=e.distExports.useFocusable({focusKey:"sl-pause-ad-play",onEnterRelease:l,isFocusBoundary:!0,forceFocus:!0});return i.useEffect(()=>{d.current&&h()},[d,h]),i.useEffect(()=>{if(!r)return()=>{};const x=A=>{const f=A.keyCode;if(f===461||f===10009||f===27||f===8){A.preventDefault(),A.stopPropagation(),A.stopImmediatePropagation(),r();return}};return window.addEventListener("keydown",x,{capture:!0}),()=>window.removeEventListener("keydown",x,{capture:!0})},[r]),a.jsx(D,{className:e.cx_default("SL_PauseAdOverlay",s&&"pause-ad-closing"),children:a.jsxs(I,{children:[a.jsxs(q,{children:[a.jsx(U,{children:t}),a.jsx(M,{children:n})]}),y&&a.jsx(V,{children:a.jsx(K,{ref:d,onClick:l,onMouseEnter:()=>d.current.focus(),"aria-label":"Resume playback"})}),a.jsx(N,{className:"SL_PauseAdSidebar",children:a.jsxs(F,{children:[p&&a.jsx(O,{isDesktop:u,vastUrl:p}),a.jsx($,{children:"ADVERTISEMENT"})]})})]})})},G=({showPauseAd:s,vastUrls:t,title:n,caption:l,sdk:r,onClose:p,onRender:c,options:u,isDesktop:y})=>{const d=(u==null?void 0:u.pauseAdDelay)??5e3,[h,x]=i.useState(!1),[A,f]=i.useState(!1),m=i.useRef(),o=t==null?void 0:t[0].url,v=i.useRef(o);v.current=o;const[P,b]=L(),S=i.useCallback(()=>{p&&(e.eventBus.emit("exposedPauseAd",{action:"closed",payload:{}}),p())},[p]),g=i.useCallback(()=>{r.controlVideoPlayer({play:!0})},[r]);return i.useEffect(()=>{if(s&&o){e.eventBus.emit("exposedPauseAd",{action:"enabled",payload:{}}),P(o).then(T=>{v.current===o&&(T==null?void 0:T.success)!==!0&&(clearTimeout(m.current),S==null||S())}).catch(()=>{v.current===o&&(clearTimeout(m.current),S==null||S())});const E=()=>{const T=b.get()[v.current];T!=null&&T.imageSrc?(clearTimeout(m.current),f(!1),x(!0)):m.current=setTimeout(()=>{E()},200)};m.current=setTimeout(()=>{E()},d)}else e.eventBus.emit("exposedPauseAd",{action:"disabled",payload:{}}),f(!0),m.current=setTimeout(()=>{x(!1)},400);return()=>{m.current&&clearTimeout(m.current)}},[b,P,S,d,s,o]),i.useEffect(()=>{c==null||c({rendered:h})},[h,c]),i.useEffect(()=>()=>{c==null||c({rendered:!1})},[c]),h?a.jsx(z,{onClose:S,isClosing:A,title:n,caption:l,onPlay:g,vastUrl:o,options:u,isDesktop:y}):null},J=({showPauseAd:s,pauseAdVastUrl:t,videoPlayerController:n,onRenderPauseAd:l,onClosePauseAd:r,children:p,options:c})=>{const u=e.useStreamLayer(),y=e.useStreamLayerTheme(),d=i.useRef();return i.useEffect(()=>u?(n&&(d.current=n,u.addVideoPlayerController(d.current)),()=>{d.current&&u.removeVideoPlayerController(d.current)}):()=>{},[u,n]),u?a.jsx("div",{className:"StreamLayerSDK",children:a.jsxs(e.h,{style:p?{position:"relative"}:{},customTheme:y.theme,themeMode:y.themeMode,children:[p,t&&a.jsx(G,{sdk:u,showPauseAd:s,vastUrls:t,onClose:r,onRender:l,options:c,isDesktop:!0})]})}):p};class Q extends i.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,n){console.error(t,n.componentStack)}render(){return this.state.hasError?this.props.children:a.jsx(J,{...this.props})}}exports.StreamLayerPauseAd=Q;
@@ -13,4 +13,4 @@
13
13
  `),a=`
14
14
  `+n+(i.length?o("│"):" ")+" ";return n+c.join(a)+`
15
15
  `+i.map(function(s,r){var u=r===i.length-1,V=s.nodes&&s.nodes.length,R=n+(u?" ":o("│"))+" ";return n+o(u?"└":"├")+o("─")+o(V?"┬":"─")+" "+e(s,R,l).slice(n.length+2)}).join("")};const Vb=ub,mi=Symbol("avvio.TimeTree.untrackNode"),Pn=Symbol("avvio.TimeTree.trackNode"),gi=Symbol("avvio.TimeTree.getParent"),hi=Symbol("avvio.TimeTree.getNode"),Wi=Symbol("avvio.TimeTree.addNode");let bb=class{constructor(){this.root=null,this.tableId=new Map,this.tableLabel=new Map}[Pn](e){this.tableId.set(e.id,e),this.tableLabel.has(e.label)?this.tableLabel.get(e.label).push(e):this.tableLabel.set(e.label,[e])}[mi](e){this.tableId.delete(e.id);const t=this.tableLabel.get(e.label);if(t.id){this.tableLabel.delete(e.label);return}t.pop(),t.length===0&&this.tableLabel.delete(e.label)}[gi](e){if(e===null)return this.root;const t=this.tableLabel.get(e);return t.id?t:t[t.length-1]}[hi](e){return this.tableId.get(e)}[Wi](e,t,n){if(e===null)return this.root={id:"root",label:t,start:n,nodes:[]},this[Pn](this.root),this.root.id;const l=this[gi](e),o=`${t}-${Math.random()}`,i={id:o,parent:e,start:n,label:t,nodes:[]};return l.nodes.push(i),this[Pn](i),o}start(e,t,n=Date.now()){return this[Wi](e,t,n)}stop(e,t=Date.now()){const n=this[hi](e);n&&(n.stop=t,n.diff=n.stop-n.start||0,this[mi](n))}toJSON(){return Object.assign({},this.root)}prittyPrint(){const e=n=>(n.label=`${n.label} ${n.diff} ms`,n.nodes.length>0&&(n.nodes=n.nodes.map(l=>e(l))),n),t=e(this.toJSON());return Vb(t)}};var Rb=bb,$l={exports:{}},Xl={exports:{}},_n,Zi;function Ab(){if(Zi)return _n;Zi=1;var e=1e3,t=e*60,n=t*60,l=n*24,o=l*7,i=l*365.25;_n=function(u,V){V=V||{};var R=typeof u;if(R==="string"&&u.length>0)return c(u);if(R==="number"&&isFinite(u))return V.long?s(u):a(u);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(u))};function c(u){if(u=String(u),!(u.length>100)){var V=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(u);if(V){var R=parseFloat(V[1]),g=(V[2]||"ms").toLowerCase();switch(g){case"years":case"year":case"yrs":case"yr":case"y":return R*i;case"weeks":case"week":case"w":return R*o;case"days":case"day":case"d":return R*l;case"hours":case"hour":case"hrs":case"hr":case"h":return R*n;case"minutes":case"minute":case"mins":case"min":case"m":return R*t;case"seconds":case"second":case"secs":case"sec":case"s":return R*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return R;default:return}}}}function a(u){var V=Math.abs(u);return V>=l?Math.round(u/l)+"d":V>=n?Math.round(u/n)+"h":V>=t?Math.round(u/t)+"m":V>=e?Math.round(u/e)+"s":u+"ms"}function s(u){var V=Math.abs(u);return V>=l?r(u,V,l,"day"):V>=n?r(u,V,n,"hour"):V>=t?r(u,V,t,"minute"):V>=e?r(u,V,e,"second"):u+" ms"}function r(u,V,R,g){var h=V>=R*1.5;return Math.round(u/R)+" "+g+(h?"s":"")}return _n}function mb(e){n.debug=n,n.default=n,n.coerce=s,n.disable=i,n.enable=o,n.enabled=c,n.humanize=Ab(),n.destroy=r,Object.keys(e).forEach(u=>{n[u]=e[u]}),n.names=[],n.skips=[],n.formatters={};function t(u){let V=0;for(let R=0;R<u.length;R++)V=(V<<5)-V+u.charCodeAt(R),V|=0;return n.colors[Math.abs(V)%n.colors.length]}n.selectColor=t;function n(u){let V,R=null,g,h;function X(...p){if(!X.enabled)return;const W=X,A=Number(new Date),F=A-(V||A);W.diff=F,W.prev=V,W.curr=A,V=A,p[0]=n.coerce(p[0]),typeof p[0]!="string"&&p.unshift("%O");let y=0;p[0]=p[0].replace(/%([a-zA-Z%])/g,(N,U)=>{if(N==="%%")return"%";y++;const S=n.formatters[U];if(typeof S=="function"){const M=p[y];N=S.call(W,M),p.splice(y,1),y--}return N}),n.formatArgs.call(W,p),(W.log||n.log).apply(W,p)}return X.namespace=u,X.useColors=n.useColors(),X.color=n.selectColor(u),X.extend=l,X.destroy=n.destroy,Object.defineProperty(X,"enabled",{enumerable:!0,configurable:!1,get:()=>R!==null?R:(g!==n.namespaces&&(g=n.namespaces,h=n.enabled(u)),h),set:p=>{R=p}}),typeof n.init=="function"&&n.init(X),X}function l(u,V){const R=n(this.namespace+(typeof V>"u"?":":V)+u);return R.log=this.log,R}function o(u){n.save(u),n.namespaces=u,n.names=[],n.skips=[];let V;const R=(typeof u=="string"?u:"").split(/[\s,]+/),g=R.length;for(V=0;V<g;V++)R[V]&&(u=R[V].replace(/\*/g,".*?"),u[0]==="-"?n.skips.push(new RegExp("^"+u.slice(1)+"$")):n.names.push(new RegExp("^"+u+"$")))}function i(){const u=[...n.names.map(a),...n.skips.map(a).map(V=>"-"+V)].join(",");return n.enable(""),u}function c(u){if(u[u.length-1]==="*")return!0;let V,R;for(V=0,R=n.skips.length;V<R;V++)if(n.skips[V].test(u))return!1;for(V=0,R=n.names.length;V<R;V++)if(n.names[V].test(u))return!0;return!1}function a(u){return u.toString().substring(2,u.toString().length-2).replace(/\.\*\?$/,"*")}function s(u){return u instanceof Error?u.stack||u.message:u}function r(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}var gb=mb;(function(e,t){t.formatArgs=l,t.save=o,t.load=i,t.useColors=n,t.storage=c(),t.destroy=(()=>{let s=!1;return()=>{s||(s=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function n(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function l(s){if(s[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+s[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;s.splice(1,0,r,"color: inherit");let u=0,V=0;s[0].replace(/%[a-zA-Z%]/g,R=>{R!=="%%"&&(u++,R==="%c"&&(V=u))}),s.splice(V,0,r)}t.log=console.debug||console.log||(()=>{});function o(s){try{s?t.storage.setItem("debug",s):t.storage.removeItem("debug")}catch{}}function i(){let s;try{s=t.storage.getItem("debug")}catch{}return!s&&typeof B<"u"&&"env"in B&&(s=B.env.DEBUG),s}function c(){try{return localStorage}catch{}}e.exports=gb(t);const{formatters:a}=e.exports;a.j=function(s){try{return JSON.stringify(s)}catch(r){return"[UnexpectedJSONParseError]: "+r.message}}})(Xl,Xl.exports);var wc=Xl.exports;const hb=mc,Wb=yc.EventEmitter,Zb=Nn.inherits,be=wc("avvio"),{AVV_ERR_READY_TIMEOUT:Eb}=Lc,qn=Symbol.for("plugin-meta");function Gb(e,t){return e[qn]&&e[qn].name?e[qn].name:typeof t<"u"&&typeof t!="function"&&t.name?t.name:e.name?e.name:e.toString().split(`
16
- `).slice(0,2).map(n=>n.trim()).join(" -- ")}function Xb(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}function ft(e,t,n,l,o){this.started=!1,this.func=t,this.opts=n,this.onFinish=null,this.parent=e,this.timeout=o===void 0?e._timeout:o,this.name=Gb(t,n),this.isAfter=l,this.q=hb(e,pb,1),this.q.pause(),this._error=null,this.loaded=!1,this._promise=null}Zb(ft,Wb);ft.prototype.exec=function(e,t){const n=this.func;let l=!1;const o=this.name;if(this.parent._error&&!this.isAfter){be("skipping loading of plugin as parent errored and it is not an after",o),B.nextTick(t);return}if(this.isAfter)this.server=e;else try{this.server=this.parent.override(e,n,this.opts)}catch(s){return be("override errored",o),t(s)}this.opts=typeof this.opts=="function"?this.opts(this.server):this.opts,be("exec",o);let i;const c=s=>{if(l){be("loading complete",o);return}this._error=s,be(s?"exec errored":"exec completed",o),l=!0,i&&clearTimeout(i),t(s)};this.timeout>0&&(be("setting up timeout",o,this.timeout),i=setTimeout(function(){be("timed out",o),i=null;const s=new Eb(o);s.fn=n,c(s)},this.timeout)),this.started=!0,this.emit("start",this.server?this.server.name:null,this.name,Date.now());const a=n(this.server,this.opts,c);a&&typeof a.then=="function"&&(be("exec: resolving promise",o),a.then(()=>B.nextTick(c),s=>B.nextTick(c,s)))};ft.prototype.loadedSoFar=function(){if(this.loaded)return Promise.resolve();const e=()=>{this.server.after((n,l)=>{this._error=n,this.q.pause(),n?(be("rejecting promise",this.name,n),this._promise.reject(n)):(be("resolving promise",this.name),this._promise.resolve()),this._promise=null,B.nextTick(l,n)}),this.q.resume()};let t;return this._promise?t=Promise.resolve():(this._promise=Xb(),t=this._promise.promise,this.server?e():this.on("start",e)),t};ft.prototype.enqueue=function(e,t){be("enqueue",this.name,e.name),this.emit("enqueue",this.server?this.server.name:null,this.name,Date.now()),this.q.push(e,t)};ft.prototype.finish=function(e,t){be("finish",this.name,e);const n=()=>{this.loaded||(be("loaded",this.name),this.emit("loaded",this.server?this.server.name:null,this.name,Date.now()),this.loaded=!0,t(e))};if(e){this._promise&&(this._promise.reject(e),this._promise=null),n();return}const l=()=>{if(be("check",this.name,this.q.length(),this.q.running(),this._promise),this.q.length()===0&&this.q.running()===0)if(this._promise){const o=()=>{be("wrap"),queueMicrotask(l)};this._promise.resolve(),this._promise.promise.then(o,o),this._promise=null}else n();else be("delayed",this.name),this.q.drain=()=>{be("drain",this.name),this.q.drain=yb,queueMicrotask(l)}};queueMicrotask(l),this.q.resume()};function pb(e,t){const n=this;B.nextTick(eo.bind(n),e,t)}function eo(e,t){if(typeof e.func.then=="function"){e.func.then(l=>{typeof l.default=="function"&&(l=l.default),e.func=l,eo.call(this,e,t)},t);return}const n=this._current[0];this._current.unshift(e),e.exec(n&&n.server||this._server,l=>{e.finish(l,o=>{this._current.shift(),t(o)})})}function yb(){}$l.exports=ft;$l.exports.loadPlugin=eo;var Fb=$l.exports;const Ei=mc,Sb=yc.EventEmitter,Yb=Nn.inherits,{AVV_ERR_EXPOSE_ALREADY_DEFINED:$n,AVV_ERR_CALLBACK_NOT_FN:zt,AVV_ERR_PLUGIN_NOT_VALID:Nb,AVV_ERR_ROOT_PLG_BOOTED:Ib,AVV_ERR_READY_TIMEOUT:Ub}=Lc,Bb=Rb,pl=Fb,Ut=wc("avvio"),pn=Symbol("kAvvio"),el=Symbol("kThenifyDoNotWrap");function fb(e,t,n){const l=t.expose||{},o=l.use||"use",i=l.after||"after",c=l.ready||"ready",a=l.onClose||"onClose",s=l.close||"close";if(e[o])throw new $n(o);if(e[i])throw new $n(i);if(e[c])throw new $n(c);e[o]=function(r,u){return n.use(r,u),this},Object.defineProperty(e,"then",{get:xc.bind(n)}),e[pn]=!0,e[i]=function(r){return typeof r!="function"?n._loadRegistered():(n.after(tl(r,this)),this)},e[c]=function(r){if(r&&typeof r!="function")throw new zt(c,typeof r);return n.ready(r?tl(r,this):void 0)},e[a]=function(r){if(typeof r!="function")throw new zt(a,typeof r);return n.onClose(vb(r,this)),this},e[s]=function(r){if(r&&typeof r!="function")throw new zt(s,typeof r);return r?(n.close(tl(r,this)),this):n.close()}}function Ve(e,t,n){if(typeof e=="function"&&arguments.length===1&&(n=e,t={},e=null),typeof t=="function"&&(n=t,t={}),t=t||{},!(this instanceof Ve)){const l=new Ve(e,t,n);return e&&fb(e,t,l),l}t.autostart!==!1&&(t.autostart=!0),e=e||this,this._timeout=Number(t.timeout)||0,this._server=e,this._current=[],this._error=null,this._isOnCloseHandlerKey=Symbol("isOnCloseHandler"),this._lastUsed=null,this.setMaxListeners(0),n&&this.once("start",n),this.started=!1,this.booted=!1,this.pluginTree=new Bb,this._readyQ=Ei(this,Mc,1),this._readyQ.pause(),this._readyQ.drain=()=>{this.emit("start"),this._readyQ.drain=Gi},this._closeQ=Ei(this,Qb,1),this._closeQ.pause(),this._closeQ.drain=()=>{this.emit("close"),this._closeQ.drain=Gi},this._doStart=null,this._root=new pl(this,Cb.bind(this),t,!1,0),this._root.once("start",(l,o,i)=>{const c=this.pluginTree.start(null,o,i);this._root.once("loaded",(a,s,r)=>{this.pluginTree.stop(c,r)})}),pl.loadPlugin.call(this,this._root,l=>{Ut("root plugin ready");try{this.emit("preReady"),this._root=null}catch(o){l=l||this._error||o}if(l){if(this._error=l,this._readyQ.length()===0)throw l}else this.booted=!0;this._readyQ.resume()})}function Cb(e,t,n){this._doStart=n,t.autostart&&this.start()}Yb(Ve,Sb);Ve.prototype.start=function(){return this.started=!0,B.nextTick(this._doStart),this};Ve.prototype.override=function(e,t,n){return e};function Jb(e){if(e&&typeof e=="object"&&typeof e.default=="function"&&(e=e.default),!(e&&(typeof e=="function"||typeof e.then=="function")))throw new Nb(typeof e);return e}Ve.prototype[pn]=!0;Ve.prototype.use=function(e,t){return this._lastUsed=this._addPlugin(e,t,!1),this};Ve.prototype._loadRegistered=function(){const e=this._current[0];return!this.started&&!this.booted&&B.nextTick(()=>this._root.q.resume()),e?e.loadedSoFar():Promise.resolve()};Object.defineProperty(Ve.prototype,"then",{get:xc});Ve.prototype._addPlugin=function(e,t,n){if(e=Jb(e),t=t||{},this.booted)throw new Ib;const l=this._current[0],o=new pl(this,e,t,n);if(o.once("start",(i,c,a)=>{const s=this.pluginTree.start(l.name,c,a);o.once("loaded",(r,u,V)=>{this.pluginTree.stop(s,V)})}),l.loaded)throw new Error(o.name,l.name);return l.enqueue(o,i=>{i&&(this._error=i)}),o};Ve.prototype.after=function(e){if(!e)return this._loadRegistered();this._addPlugin(t.bind(this),{},!0);function t(n,l,o){Mc.call(this,e,o)}return this};Ve.prototype.onClose=function(e){if(typeof e!="function")throw new Error("not a function");e[this._isOnCloseHandlerKey]=!0,this._closeQ.unshift(e,t.bind(this));function t(n){n&&(this._error=n)}return this};Ve.prototype.close=function(e){let t;if(e){if(typeof e!="function")throw new zt("close",typeof e)}else t=new Promise(function(n,l){e=function(o){if(o)return l(o);n()}});return this.ready(()=>{this._error=null,this._closeQ.push(e),B.nextTick(this._closeQ.resume.bind(this._closeQ))}),t};Ve.prototype.ready=function(e){if(e){if(typeof e!="function")throw new zt("ready",typeof e);this._readyQ.push(e),queueMicrotask(this.start.bind(this));return}return new Promise((t,n)=>{this._readyQ.push(o),this.start();const l=this._current[0].server;function o(i,c,a){i?n(i):t(l),B.nextTick(a)}})};Ve.prototype.prettyPrint=function(){return this.pluginTree.prittyPrint()};Ve.prototype.toJSON=function(){return this.pluginTree.toJSON()};function Gi(){}function xc(){if(this.booted){Ut("thenify returning null because we are already booted");return}if(this[el]){this[el]=!1;return}return Ut("thenify"),(e,t)=>this._loadRegistered().then(()=>(this[el]=!0,e(this._server)),t)}function Mc(e,t){const n=this._server,l=this._error;let o;if(this._error=null,e.length===0)this._error=l,o=e(),o&&!o[pn]&&typeof o.then=="function"?o.then(()=>B.nextTick(t),i=>B.nextTick(t,i)):B.nextTick(t);else if(e.length===1)o=e(l),o&&!o[pn]&&typeof o.then=="function"?o.then(()=>B.nextTick(t),i=>B.nextTick(t,i)):B.nextTick(t);else if(this._timeout===0){const i=c=>{this._error=c,t(this._error)};e.length===2?e(l,i):e(l,n,i)}else Tb.call(this,e,l,n,t)}function Tb(e,t,n,l){const o=e.name;Ut("setting up ready timeout",o,this._timeout);let i=setTimeout(()=>{Ut("timed out",o),i=null;const a=new Ub(o);a.fn=e,this._error=a,l(a)},this._timeout);e.length===2?e(t,c.bind(this)):e(t,n,c.bind(this));function c(a){i&&(clearTimeout(i),this._error=a,l(this._error))}}function Qb(e,t){const n=this._server,l=e[this._isOnCloseHandlerKey];if(e.length===0||e.length===1){let o;l?o=e(n):o=e(this._error),o&&typeof o.then=="function"?(Ut("resolving close/onClose promise"),o.then(()=>B.nextTick(t),i=>B.nextTick(t,i))):B.nextTick(t)}else e.length===2?e(l?n:this._error,t):l?e(n,t):e(this._error,n,t)}function vb(e,t){return n.bind(t);function n(l,o){let i;e.length===0?(i=e(),i&&i.then?i.then(function(){B.nextTick(o)},o):B.nextTick(o)):e.length===1?(i=e(this),i&&i.then?i.then(function(){B.nextTick(o)},o):B.nextTick(o)):e(this,o)}}function tl(e,t){return n.bind(t);function n(l,o){let i;e?e.length===0?(i=e(),i&&i.then?i.then(function(){B.nextTick(o,l)},o):B.nextTick(o,l)):e.length===1?(i=e(l),i&&i.then?i.then(function(){B.nextTick(o)},o):B.nextTick(o)):e.length===2?e(l,o):e(l,this,o):B.nextTick(o)}}Ll.exports=Ve;Ll.exports.express=function(e){return Ve(e,{expose:{use:"load"}})};var kb=Ll.exports;const zb=Ru(kb);(function(){if(window.requestAnimationFrame&&window.cancelAnimationFrame)return;const e=["webkit","moz","ms","o"];for(const t of e)window.requestAnimationFrame=window.requestAnimationFrame||window[`${t}RequestAnimationFrame`],window.cancelAnimationFrame=window.cancelAnimationFrame||window[`${t}CancelAnimationFrame`]||window[`${t}CancelRequestAnimationFrame`];if(/iP(ad|hone|od).*OS 6/.test(window.navigator.userAgent)||!window.requestAnimationFrame||!window.cancelAnimationFrame){let t=0;const n=!!(window.performance&&window.performance.now);window.requestAnimationFrame=function(l){const o=n?window.performance.now():new Date().getTime(),i=Math.max(0,16-(o-t)),c=window.setTimeout(function(){l(o+i)},i);return t=o+i,c},window.cancelAnimationFrame=clearTimeout}})();function Kb(e,t=!0,n=!0,l={friendsTab:"enabled"}){const o=t?"https://grpc-sdk.streamlayer.io:443":"https://grpc-sdk.next.streamlayer.io:443",i=t?"https://grpc.streamlayer.io:443":"https://grpc.next.streamlayer.io:443",c=zb(Object.create({}),{autostart:!1});return c.use(Md,{hideFriends:l.hideFriends,skipOnboarding:l.skipOnboarding,betPack:l.betPack,friendsTab:l.friendsTab,theme:l.theme,themeMode:l.themeMode}),c.use(vd,{onDeepLinkHandled:l==null?void 0:l.onDeepLinkHandled}),c.use(Ld,{videoPlayerController:l==null?void 0:l.videoPlayerController}),c.use(xd,{onContentActivate:l==null?void 0:l.onContentActivate,withAd:l==null?void 0:l.withAd,withAdNotification:l==null?void 0:l.withAdNotification}),c.use(od,{sdkKey:e,host:o,analyticsHost:i,version:l==null?void 0:l.version,webOS:l==null?void 0:l.webOS}),c.use(rd),c.use(Kd),c.use(nu),c.use(Ud),c.use(bu),c.after((a,s,r)=>{if(a)throw a;s.ready(),r()}),n&&c.after(async(a,s,r)=>{if(a)throw a;await s.sdk.initializeApp(),r()}),c.onClose(()=>{console.log("close StreamLayer instance")}),c}const Lb=({sdkKey:e,plugins:t,production:n,autoEnable:l,onDeepLinkHandled:o,videoPlayerController:i,onContentActivate:c,hideFriends:a,skipOnboarding:s,withAdNotification:r,withAd:u,friendsTab:V,betPack:R,webOS:g})=>{const[h,X]=oo.useState(null);return oo.useEffect(()=>{let p=!1;if(!e)return console.error("streamlayer sdk key should be provided"),X(A=>(A!==null&&typeof A.disableApp=="function"&&A.disableApp(),null)),()=>{p=!0};const W=Kb(e,n,l,{version:"1.21.0",onDeepLinkHandled:o,videoPlayerController:i,onContentActivate:c,skipOnboarding:s,withAdNotification:r,withAd:u,hideFriends:a,friendsTab:V,betPack:R,webOS:g});if(t)for(const A of t)W.use(A);return W.ready().then(A=>{p||(X(A.sdk),typeof window<"u")}).catch(A=>console.log(A)),()=>{p=!0,W.close(function(A){if(A)throw A})}},[e,n]),h};exports.AdUnit=pe;exports.AutoPlayVideo=$s;exports.CloseTimerAuto=_s;exports.CtaIconMode=vs;exports.InvitationFrom=rl;exports.NotificationEnabled=sl;exports.NotificationPromotionImagePosition=Cs;exports.NotificationPromotionMode=Bs;exports.NotificationSponsorLogoMode=Ts;exports.NotificationUseContentMedia=Ds;exports.PickHistoryStatus=Tt;exports.PlayVideoMuted=tr;exports.PromotionButtonType=Ks;exports.PromotionLogoMode=ws;exports.PromotionType=T;exports.QuestionImages=Is;exports.QuestionStatus=ue;exports.QuestionType=f;exports.SdkOverlayType=O;exports.global=dl;exports.useStreamLayerApp=Lb;
16
+ `).slice(0,2).map(n=>n.trim()).join(" -- ")}function Xb(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}function ft(e,t,n,l,o){this.started=!1,this.func=t,this.opts=n,this.onFinish=null,this.parent=e,this.timeout=o===void 0?e._timeout:o,this.name=Gb(t,n),this.isAfter=l,this.q=hb(e,pb,1),this.q.pause(),this._error=null,this.loaded=!1,this._promise=null}Zb(ft,Wb);ft.prototype.exec=function(e,t){const n=this.func;let l=!1;const o=this.name;if(this.parent._error&&!this.isAfter){be("skipping loading of plugin as parent errored and it is not an after",o),B.nextTick(t);return}if(this.isAfter)this.server=e;else try{this.server=this.parent.override(e,n,this.opts)}catch(s){return be("override errored",o),t(s)}this.opts=typeof this.opts=="function"?this.opts(this.server):this.opts,be("exec",o);let i;const c=s=>{if(l){be("loading complete",o);return}this._error=s,be(s?"exec errored":"exec completed",o),l=!0,i&&clearTimeout(i),t(s)};this.timeout>0&&(be("setting up timeout",o,this.timeout),i=setTimeout(function(){be("timed out",o),i=null;const s=new Eb(o);s.fn=n,c(s)},this.timeout)),this.started=!0,this.emit("start",this.server?this.server.name:null,this.name,Date.now());const a=n(this.server,this.opts,c);a&&typeof a.then=="function"&&(be("exec: resolving promise",o),a.then(()=>B.nextTick(c),s=>B.nextTick(c,s)))};ft.prototype.loadedSoFar=function(){if(this.loaded)return Promise.resolve();const e=()=>{this.server.after((n,l)=>{this._error=n,this.q.pause(),n?(be("rejecting promise",this.name,n),this._promise.reject(n)):(be("resolving promise",this.name),this._promise.resolve()),this._promise=null,B.nextTick(l,n)}),this.q.resume()};let t;return this._promise?t=Promise.resolve():(this._promise=Xb(),t=this._promise.promise,this.server?e():this.on("start",e)),t};ft.prototype.enqueue=function(e,t){be("enqueue",this.name,e.name),this.emit("enqueue",this.server?this.server.name:null,this.name,Date.now()),this.q.push(e,t)};ft.prototype.finish=function(e,t){be("finish",this.name,e);const n=()=>{this.loaded||(be("loaded",this.name),this.emit("loaded",this.server?this.server.name:null,this.name,Date.now()),this.loaded=!0,t(e))};if(e){this._promise&&(this._promise.reject(e),this._promise=null),n();return}const l=()=>{if(be("check",this.name,this.q.length(),this.q.running(),this._promise),this.q.length()===0&&this.q.running()===0)if(this._promise){const o=()=>{be("wrap"),queueMicrotask(l)};this._promise.resolve(),this._promise.promise.then(o,o),this._promise=null}else n();else be("delayed",this.name),this.q.drain=()=>{be("drain",this.name),this.q.drain=yb,queueMicrotask(l)}};queueMicrotask(l),this.q.resume()};function pb(e,t){const n=this;B.nextTick(eo.bind(n),e,t)}function eo(e,t){if(typeof e.func.then=="function"){e.func.then(l=>{typeof l.default=="function"&&(l=l.default),e.func=l,eo.call(this,e,t)},t);return}const n=this._current[0];this._current.unshift(e),e.exec(n&&n.server||this._server,l=>{e.finish(l,o=>{this._current.shift(),t(o)})})}function yb(){}$l.exports=ft;$l.exports.loadPlugin=eo;var Fb=$l.exports;const Ei=mc,Sb=yc.EventEmitter,Yb=Nn.inherits,{AVV_ERR_EXPOSE_ALREADY_DEFINED:$n,AVV_ERR_CALLBACK_NOT_FN:zt,AVV_ERR_PLUGIN_NOT_VALID:Nb,AVV_ERR_ROOT_PLG_BOOTED:Ib,AVV_ERR_READY_TIMEOUT:Ub}=Lc,Bb=Rb,pl=Fb,Ut=wc("avvio"),pn=Symbol("kAvvio"),el=Symbol("kThenifyDoNotWrap");function fb(e,t,n){const l=t.expose||{},o=l.use||"use",i=l.after||"after",c=l.ready||"ready",a=l.onClose||"onClose",s=l.close||"close";if(e[o])throw new $n(o);if(e[i])throw new $n(i);if(e[c])throw new $n(c);e[o]=function(r,u){return n.use(r,u),this},Object.defineProperty(e,"then",{get:xc.bind(n)}),e[pn]=!0,e[i]=function(r){return typeof r!="function"?n._loadRegistered():(n.after(tl(r,this)),this)},e[c]=function(r){if(r&&typeof r!="function")throw new zt(c,typeof r);return n.ready(r?tl(r,this):void 0)},e[a]=function(r){if(typeof r!="function")throw new zt(a,typeof r);return n.onClose(vb(r,this)),this},e[s]=function(r){if(r&&typeof r!="function")throw new zt(s,typeof r);return r?(n.close(tl(r,this)),this):n.close()}}function Ve(e,t,n){if(typeof e=="function"&&arguments.length===1&&(n=e,t={},e=null),typeof t=="function"&&(n=t,t={}),t=t||{},!(this instanceof Ve)){const l=new Ve(e,t,n);return e&&fb(e,t,l),l}t.autostart!==!1&&(t.autostart=!0),e=e||this,this._timeout=Number(t.timeout)||0,this._server=e,this._current=[],this._error=null,this._isOnCloseHandlerKey=Symbol("isOnCloseHandler"),this._lastUsed=null,this.setMaxListeners(0),n&&this.once("start",n),this.started=!1,this.booted=!1,this.pluginTree=new Bb,this._readyQ=Ei(this,Mc,1),this._readyQ.pause(),this._readyQ.drain=()=>{this.emit("start"),this._readyQ.drain=Gi},this._closeQ=Ei(this,Qb,1),this._closeQ.pause(),this._closeQ.drain=()=>{this.emit("close"),this._closeQ.drain=Gi},this._doStart=null,this._root=new pl(this,Cb.bind(this),t,!1,0),this._root.once("start",(l,o,i)=>{const c=this.pluginTree.start(null,o,i);this._root.once("loaded",(a,s,r)=>{this.pluginTree.stop(c,r)})}),pl.loadPlugin.call(this,this._root,l=>{Ut("root plugin ready");try{this.emit("preReady"),this._root=null}catch(o){l=l||this._error||o}if(l){if(this._error=l,this._readyQ.length()===0)throw l}else this.booted=!0;this._readyQ.resume()})}function Cb(e,t,n){this._doStart=n,t.autostart&&this.start()}Yb(Ve,Sb);Ve.prototype.start=function(){return this.started=!0,B.nextTick(this._doStart),this};Ve.prototype.override=function(e,t,n){return e};function Jb(e){if(e&&typeof e=="object"&&typeof e.default=="function"&&(e=e.default),!(e&&(typeof e=="function"||typeof e.then=="function")))throw new Nb(typeof e);return e}Ve.prototype[pn]=!0;Ve.prototype.use=function(e,t){return this._lastUsed=this._addPlugin(e,t,!1),this};Ve.prototype._loadRegistered=function(){const e=this._current[0];return!this.started&&!this.booted&&B.nextTick(()=>this._root.q.resume()),e?e.loadedSoFar():Promise.resolve()};Object.defineProperty(Ve.prototype,"then",{get:xc});Ve.prototype._addPlugin=function(e,t,n){if(e=Jb(e),t=t||{},this.booted)throw new Ib;const l=this._current[0],o=new pl(this,e,t,n);if(o.once("start",(i,c,a)=>{const s=this.pluginTree.start(l.name,c,a);o.once("loaded",(r,u,V)=>{this.pluginTree.stop(s,V)})}),l.loaded)throw new Error(o.name,l.name);return l.enqueue(o,i=>{i&&(this._error=i)}),o};Ve.prototype.after=function(e){if(!e)return this._loadRegistered();this._addPlugin(t.bind(this),{},!0);function t(n,l,o){Mc.call(this,e,o)}return this};Ve.prototype.onClose=function(e){if(typeof e!="function")throw new Error("not a function");e[this._isOnCloseHandlerKey]=!0,this._closeQ.unshift(e,t.bind(this));function t(n){n&&(this._error=n)}return this};Ve.prototype.close=function(e){let t;if(e){if(typeof e!="function")throw new zt("close",typeof e)}else t=new Promise(function(n,l){e=function(o){if(o)return l(o);n()}});return this.ready(()=>{this._error=null,this._closeQ.push(e),B.nextTick(this._closeQ.resume.bind(this._closeQ))}),t};Ve.prototype.ready=function(e){if(e){if(typeof e!="function")throw new zt("ready",typeof e);this._readyQ.push(e),queueMicrotask(this.start.bind(this));return}return new Promise((t,n)=>{this._readyQ.push(o),this.start();const l=this._current[0].server;function o(i,c,a){i?n(i):t(l),B.nextTick(a)}})};Ve.prototype.prettyPrint=function(){return this.pluginTree.prittyPrint()};Ve.prototype.toJSON=function(){return this.pluginTree.toJSON()};function Gi(){}function xc(){if(this.booted){Ut("thenify returning null because we are already booted");return}if(this[el]){this[el]=!1;return}return Ut("thenify"),(e,t)=>this._loadRegistered().then(()=>(this[el]=!0,e(this._server)),t)}function Mc(e,t){const n=this._server,l=this._error;let o;if(this._error=null,e.length===0)this._error=l,o=e(),o&&!o[pn]&&typeof o.then=="function"?o.then(()=>B.nextTick(t),i=>B.nextTick(t,i)):B.nextTick(t);else if(e.length===1)o=e(l),o&&!o[pn]&&typeof o.then=="function"?o.then(()=>B.nextTick(t),i=>B.nextTick(t,i)):B.nextTick(t);else if(this._timeout===0){const i=c=>{this._error=c,t(this._error)};e.length===2?e(l,i):e(l,n,i)}else Tb.call(this,e,l,n,t)}function Tb(e,t,n,l){const o=e.name;Ut("setting up ready timeout",o,this._timeout);let i=setTimeout(()=>{Ut("timed out",o),i=null;const a=new Ub(o);a.fn=e,this._error=a,l(a)},this._timeout);e.length===2?e(t,c.bind(this)):e(t,n,c.bind(this));function c(a){i&&(clearTimeout(i),this._error=a,l(this._error))}}function Qb(e,t){const n=this._server,l=e[this._isOnCloseHandlerKey];if(e.length===0||e.length===1){let o;l?o=e(n):o=e(this._error),o&&typeof o.then=="function"?(Ut("resolving close/onClose promise"),o.then(()=>B.nextTick(t),i=>B.nextTick(t,i))):B.nextTick(t)}else e.length===2?e(l?n:this._error,t):l?e(n,t):e(this._error,n,t)}function vb(e,t){return n.bind(t);function n(l,o){let i;e.length===0?(i=e(),i&&i.then?i.then(function(){B.nextTick(o)},o):B.nextTick(o)):e.length===1?(i=e(this),i&&i.then?i.then(function(){B.nextTick(o)},o):B.nextTick(o)):e(this,o)}}function tl(e,t){return n.bind(t);function n(l,o){let i;e?e.length===0?(i=e(),i&&i.then?i.then(function(){B.nextTick(o,l)},o):B.nextTick(o,l)):e.length===1?(i=e(l),i&&i.then?i.then(function(){B.nextTick(o)},o):B.nextTick(o)):e.length===2?e(l,o):e(l,this,o):B.nextTick(o)}}Ll.exports=Ve;Ll.exports.express=function(e){return Ve(e,{expose:{use:"load"}})};var kb=Ll.exports;const zb=Ru(kb);(function(){if(window.requestAnimationFrame&&window.cancelAnimationFrame)return;const e=["webkit","moz","ms","o"];for(const t of e)window.requestAnimationFrame=window.requestAnimationFrame||window[`${t}RequestAnimationFrame`],window.cancelAnimationFrame=window.cancelAnimationFrame||window[`${t}CancelAnimationFrame`]||window[`${t}CancelRequestAnimationFrame`];if(/iP(ad|hone|od).*OS 6/.test(window.navigator.userAgent)||!window.requestAnimationFrame||!window.cancelAnimationFrame){let t=0;const n=!!(window.performance&&window.performance.now);window.requestAnimationFrame=function(l){const o=n?window.performance.now():new Date().getTime(),i=Math.max(0,16-(o-t)),c=window.setTimeout(function(){l(o+i)},i);return t=o+i,c},window.cancelAnimationFrame=clearTimeout}})();function Kb(e,t=!0,n=!0,l={friendsTab:"enabled"}){const o=t?"https://grpc-sdk.streamlayer.io:443":"https://grpc-sdk.next.streamlayer.io:443",i=t?"https://grpc.streamlayer.io:443":"https://grpc.next.streamlayer.io:443",c=zb(Object.create({}),{autostart:!1});return c.use(Md,{hideFriends:l.hideFriends,skipOnboarding:l.skipOnboarding,betPack:l.betPack,friendsTab:l.friendsTab,theme:l.theme,themeMode:l.themeMode}),c.use(vd,{onDeepLinkHandled:l==null?void 0:l.onDeepLinkHandled}),c.use(Ld,{videoPlayerController:l==null?void 0:l.videoPlayerController}),c.use(xd,{onContentActivate:l==null?void 0:l.onContentActivate,withAd:l==null?void 0:l.withAd,withAdNotification:l==null?void 0:l.withAdNotification}),c.use(od,{sdkKey:e,host:o,analyticsHost:i,version:l==null?void 0:l.version,webOS:l==null?void 0:l.webOS}),c.use(rd),c.use(Kd),c.use(nu),c.use(Ud),c.use(bu),c.after((a,s,r)=>{if(a)throw a;s.ready(),r()}),n&&c.after(async(a,s,r)=>{if(a)throw a;await s.sdk.initializeApp(),r()}),c.onClose(()=>{console.log("close StreamLayer instance")}),c}const Lb=({sdkKey:e,plugins:t,production:n,autoEnable:l,onDeepLinkHandled:o,videoPlayerController:i,onContentActivate:c,hideFriends:a,skipOnboarding:s,withAdNotification:r,withAd:u,friendsTab:V,betPack:R,webOS:g})=>{const[h,X]=oo.useState(null);return oo.useEffect(()=>{let p=!1;if(!e)return console.error("streamlayer sdk key should be provided"),X(A=>(A!==null&&typeof A.disableApp=="function"&&A.disableApp(),null)),()=>{p=!0};const W=Kb(e,n,l,{version:"1.21.1",onDeepLinkHandled:o,videoPlayerController:i,onContentActivate:c,skipOnboarding:s,withAdNotification:r,withAd:u,hideFriends:a,friendsTab:V,betPack:R,webOS:g});if(t)for(const A of t)W.use(A);return W.ready().then(A=>{p||(X(A.sdk),typeof window<"u")}).catch(A=>console.log(A)),()=>{p=!0,W.close(function(A){if(A)throw A})}},[e,n]),h};exports.AdUnit=pe;exports.AutoPlayVideo=$s;exports.CloseTimerAuto=_s;exports.CtaIconMode=vs;exports.InvitationFrom=rl;exports.NotificationEnabled=sl;exports.NotificationPromotionImagePosition=Cs;exports.NotificationPromotionMode=Bs;exports.NotificationSponsorLogoMode=Ts;exports.NotificationUseContentMedia=Ds;exports.PickHistoryStatus=Tt;exports.PlayVideoMuted=tr;exports.PromotionButtonType=Ks;exports.PromotionLogoMode=ws;exports.PromotionType=T;exports.QuestionImages=Is;exports.QuestionStatus=ue;exports.QuestionType=f;exports.SdkOverlayType=O;exports.global=dl;exports.useStreamLayerApp=Lb;