"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),i=require("react"),e=require("./provider.js"),c=require("./useStreamLayerApp2.js"),d=e.styled_default("div")({name:"PointsContainer",class:"psiob9b",propsAsIs:!1}),m=e.styled_default("div")({name:"PointsIcon",class:"p1gqe4lh",propsAsIs:!1}),p=()=>e.f1,y=e.styled_default(p())({name:"PointsSvg",class:"p15syg2y",propsAsIs:!0}),S=e.styled_default("div")({name:"PointsBody",class:"p12n4f2h",propsAsIs:!1}),f=e.styled_default("div")({name:"PointsTitle",class:"poqmx89",propsAsIs:!1}),h=e.styled_default("div")({name:"PointsValue",class:"prj9b3v",propsAsIs:!1}),j=({points:s,onClick:r})=>t.jsxs(d,{className:e.f,onClick:r,children:[t.jsx(m,{children:t.jsx(y,{name:"icon-trophy-solid"})}),t.jsxs(S,{children:[t.jsx(f,{children:"Total points"}),t.jsx(h,{children:t.jsx(e.d,{value:s})})]})]}),v=({gamification:s})=>{const r=s.userSummary.$store,[n,l]=i.useState(0);return i.useEffect(()=>{const u=r.subscribe(a=>{var o;(o=a==null?void 0:a.summary)!=null&&o.points&&l(a.summary.points)});return()=>{u()}},[r]),t.jsx(j,{points:n,onClick:()=>{s.status.get()===e.FeatureStatus.Suspended?s.openFeature():s.status.get()===e.FeatureStatus.Ready&&s.closeFeature(!1)}})},x=({sdk:s})=>{if(!e.useStore(s.featuresList.getStore()))return null;const r=s.getFeature(c.SdkOverlayType.GAMES);return r?t.jsx(v,{gamification:r}):null},g=({theme:s})=>{const r=e.useStreamLayer(),n=e.useStreamLayerTheme();return r?t.jsx("div",{className:"StreamLayerSDK",children:t.jsx(e.h,{customTheme:s??n.theme,themeMode:n.themeMode,children:t.jsx(x,{sdk:r})})}):null};exports.StreamLayerSDKPoints=g;
