"use strict";const n=require("react"),f=require("react/jsx-runtime"),w=require("./useStreamLayerApp2.js"),E=({event:e,internal:r})=>{const s=m(),o=L();return n.useEffect(()=>{s&&(e&&(s.createEventSession(e,r),o&&(o.current=e)),!e&&o!=null&&o.current&&(s.createEventSession("",r),o.current=""))},[e,r,o,s]),null};var h=(e=>(e[e.UNSET=0]="UNSET",e[e.CONNECTED=1]="CONNECTED",e[e.READY=2]="READY",e))(h||{});const x={status:0,sdk:null},i=n.createContext(x),N=({sdkKey:e,theme:r,themeMode:s,plugins:o,children:d,event:p,production:y=!0,autoEnable:C=!0,withAdNotification:S,withAd:D=!0,betPack:a=!1,hideFriends:A,skipOnboarding:c,friendsTab:v="enabled",onDeepLinkHandled:l,videoPlayerController:u,onContentActivate:K,containerId:k,webOS:P})=>{const t=w.$({sdkKey:e,plugins:o,production:y,autoEnable:C,onDeepLinkHandled:l,videoPlayerController:u,onContentActivate:K,hideFriends:A,skipOnboarding:c,withAdNotification:S,withAd:D,friendsTab:v,betPack:a,webOS:P}),b=n.useRef(""),g=n.useMemo(()=>t?{sdk:t,status:2,event:b}:{status:1,sdk:null,event:b},[t]);return n.useEffect(()=>{t&&(t.options.setKey("friendsTab",v),t.options.setKey("theme",r),t.options.setKey("themeMode",s),t.options.setKey("skipOnboarding",c),t.options.setKey("betPack",a),t.options.setKey("containerId",k))},[t,v,r,s,c,a,k]),n.useEffect(()=>()=>{l&&(t==null||t.removeDeepLinkHandler(l)),u&&(t==null||t.removeVideoPlayerController(u))},[t]),n.useEffect(()=>{localStorage.getItem("SL_DEBUG")&&console.log("StreamLayerProvider mounted with props:",{sdkKey:!!e,onDeepLinkHandled:!!l,videoPlayerController:!!u})},[e,l,u]),f.jsxs(i.Provider,{value:g,children:[p!==void 0&&f.jsx(E,{event:p}),d]})},m=()=>{const{sdk:e}=n.useContext(i);return e},L=()=>{const{event:e}=n.useContext(i);return e},O=()=>{const{sdk:e}=n.useContext(i),[r,s]=n.useState({});return n.useEffect(()=>{var o;return e!=null&&e.options?(o=e==null?void 0:e.options)==null?void 0:o.subscribe(d=>{s({theme:d.theme,themeMode:d.themeMode})}):()=>{}},[e==null?void 0:e.options]),r},T=()=>{const{sdk:e}=n.useContext(i),[r,s]=n.useState({});return n.useEffect(()=>e!=null&&e.uiState?e==null?void 0:e.uiState.subscribe(o=>{s({...o})}):()=>{},[e==null?void 0:e.uiState]),r};exports.B=m;exports.F=T;exports.Y=h;exports.i=i;exports.j=E;exports.q=N;exports.z=O;
