"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("./index8.js"),l=require("react"),n=require("./sl-types.js"),o=require("./index3.js"),y=require("./index5.js"),S=require("./theme.js"),h=require("./index6.js"),c=require("./feature.js"),x=require("./useStreamLayerApp2.js"),d=require("./hooks-WfHlJH12.js"),f=n.styled_default("div")({name:"PointsContainer",class:"psiob9b",propsAsIs:!1}),v=n.styled_default("div")({name:"PointsIcon",class:"p1gqe4lh",propsAsIs:!1}),j=()=>h.B1,q=n.styled_default(j())({name:"PointsSvg",class:"p15syg2y",propsAsIs:!0}),g=n.styled_default("div")({name:"PointsBody",class:"p12n4f2h",propsAsIs:!1}),P=n.styled_default("div")({name:"PointsTitle",class:"poqmx89",propsAsIs:!1}),b=n.styled_default("div")({name:"PointsValue",class:"prj9b3v",propsAsIs:!1}),k=({points:s,onClick:t})=>e.jsxs(f,{className:S.m,onClick:t,children:[e.jsx(v,{children:e.jsx(q,{name:"icon-trophy-solid"})}),e.jsxs(g,{children:[e.jsx(P,{children:"Total points"}),e.jsx(b,{children:e.jsx(y.d,{value:s})})]})]}),A=({gamification:s})=>{const t=s.userSummary.$store,[r,p]=l.useState(0);return l.useEffect(()=>{const a=t.subscribe(i=>{var u;(u=i==null?void 0:i.summary)!=null&&u.points&&p(i.summary.points)});return()=>{a()}},[t]),e.jsx(k,{points:r,onClick:()=>{const a=s.status.get();a===c.FeatureStatus.Suspended?(s.openFeature(),o.eventBus.emit("app",{action:"open",payload:{}}),o.eventBus.emit("interactions",{action:"tap",payload:{}})):a===c.FeatureStatus.Ready&&(s.closeFeature(!1),o.eventBus.emit("app",{action:"close",payload:{}}),o.eventBus.emit("interactions",{action:"tap",payload:{}}))}})},B=({sdk:s})=>{if(!n.useStore(s.featuresList.getStore()))return null;const t=s.getFeature(x.SdkOverlayType.GAMES);return t?e.jsx(A,{gamification:t}):null},I=({theme:s})=>{const t=d.B(),r=d.z();return t?e.jsx("div",{className:"StreamLayerSDK",children:e.jsx(m.h,{customTheme:s??r.theme,themeMode:r.themeMode,children:e.jsx(B,{sdk:t})})}):null};exports.StreamLayerSDKPoints=I;
