import{A as u,B as D,D as n,e as f,f as y,g as S,s as v,v as l,x as L}from"./chunk-ALDBR463.js";import{Ia as g,K as h,Na as x,V as p,a as s,b as o}from"./chunk-V6BPA3D7.js";var F=t=>t&&t.firstName?t.firstName:void 0,d=t=>!!(t&&t.ssoId);var B=t=>!!t&&d(t)&&!!t.canImpersonate,X=t=>t.status===n.success,w=t=>!!t&&!!t.impersonatedBySsoid,A=t=>!!(t&&t.userType==="tkr");var a=y({source:"Identity",events:{getIdentity:S(),getIdentitySuccess:f(),getIdentityError:f()}});var T={status:n.initial,me:null,error:null},U=(t,e)=>t?.ssoId===e?.ssoId&&t?.msisdn===e?.ssoId,I=L({name:"identity",reducer:D(T,u(a.getIdentity,t=>o(s({},t),{status:n.loading})),u(a.getIdentitySuccess,(t,{identity:e})=>o(s({},t),{status:n.success,me:U(t.me,e)?t.me:e,error:null})),u(a.getIdentityError,(t,{error:e})=>o(s({},t),{status:n.error,me:null,error:e})))});var C=l(I.selectMe,d),R=t=>({selector:I.selectIdentityState,action:()=>a.getIdentity(),shouldDispatch(e){return(t||!e.me)&&e.status===n.initial||!1}}),c=t=>o(s({},R(t)),{filter:e=>e.status===n.success||e.status===n.error}),V=t=>o(s({},c(t)),{map:e=>e.me}),Y=o(s({},c(!1)),{map:({me:t})=>w(t)}),Z=o(s({},c(!1)),{map:({me:t})=>B(t)}),M=o(s({},c(!1)),{map:({me:t})=>t&&t.channel||"B2C"}),_=o(s({},c(!1)),{map:({me:t})=>d(t)}),tt=o(s({},c(!1)),{map:({me:t})=>F(t)}),et=o(s({},c(!1)),{map:({me:t})=>A(t)});function ut(t){return o(s({},t),{selector:l(t.selector,C,(e,r)=>o(s({},e),{loggedIn:r})),shouldDispatch:e=>e.loggedIn&&t.shouldDispatch&&t.shouldDispatch(e)||!1})}var dt=(()=>{class t{constructor(r){this.store=r}getWithSelector(r){if(!r)throw new Error("store.selectData was called without a selector");let i=this.store.select(r.selector);return r.action&&r.shouldDispatch&&(i=i.pipe(p(m=>r.shouldDispatch&&r.shouldDispatch(m)?(r.shouldDispatchAsync?setTimeout(()=>{this.store.dispatch(r.action(m))}):this.store.dispatch(r.action(m)),!1):!0))),r.filter&&(i=i.pipe(p(r.filter))),r.map?i.pipe(h(r.map)):i}static{this.\u0275fac=function(i){return new(i||t)(x(v))}}static{this.\u0275prov=g({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();export{a,d as b,B as c,X as d,T as e,I as f,C as g,R as h,c as i,V as j,Y as k,Z as l,_ as m,ut as n,dt as o};