"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),p=require("./index7.js"),u=require("react"),n=require("./sl-types.js"),o=require("./index5.js"),y=require("./index3.js"),S=require("./index4.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}),h=n.styled_default("div")({name:"PointsIcon",class:"p1gqe4lh",propsAsIs:!1}),v=()=>S.B1,j=n.styled_default(v())({name:"PointsSvg",class:"p15syg2y",propsAsIs:!0}),q=n.styled_default("div")({name:"PointsBody",class:"p12n4f2h",propsAsIs:!1}),g=n.styled_default("div")({name:"PointsTitle",class:"poqmx89",propsAsIs:!1}),P=n.styled_default("div")({name:"PointsValue",class:"prj9b3v",propsAsIs:!1}),b=({points:s,onClick:t})=>e.jsxs(f,{className:p.m,onClick:t,children:[e.jsx(h,{children:e.jsx(j,{name:"icon-trophy-solid"})}),e.jsxs(q,{children:[e.jsx(g,{children:"Total points"}),e.jsx(P,{children:e.jsx(y.d,{value:s})})]})]}),k=({gamification:s})=>{const t=s.userSummary.$store,[r,m]=u.useState(0);return u.useEffect(()=>{const a=t.subscribe(i=>{var l;(l=i==null?void 0:i.summary)!=null&&l.points&&m(i.summary.points)});return()=>{a()}},[t]),e.jsx(b,{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:{}}))}})},A=({sdk:s})=>{if(!n.useStore(s.featuresList.getStore()))return null;const t=s.getFeature(x.SdkOverlayType.GAMES);return t?e.jsx(k,{gamification:t}):null},B=({theme:s})=>{const t=d.B(),r=d.z();return t?e.jsx("div",{className:"StreamLayerSDK",children:e.jsx(p.h,{customTheme:s??r.theme,themeMode:r.themeMode,children:e.jsx(A,{sdk:t})})}):null};exports.StreamLayerSDKPoints=B;
