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-VYUKN3XQ.js";import{Na as g,P as h,Sa as x,_ as p,a as s,b as o}from"./chunk-XNQ3RS5P.js";var F=t=>t&&t.firstName?t.firstName:void 0,d=t=>!!(t&&t.ssoId);var B=t=>!!t&&d(t)&&!!t.canImpersonate,W=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 U={status:n.initial,me:null,error:null},R=(t,e)=>(t==null?void 0:t.ssoId)===(e==null?void 0:e.ssoId)&&(t==null?void 0:t.msisdn)===(e==null?void 0:e.ssoId),I=L({name:"identity",reducer:D(U,u(a.getIdentity,t=>o(s({},t),{status:n.loading})),u(a.getIdentitySuccess,(t,{identity:e})=>o(s({},t),{status:n.success,me:R(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),j=t=>({selector:I.selectIdentityState,action:()=>a.getIdentity(),shouldDispatch(e){return(t||!e.me)&&e.status===n.initial||!1}}),c=t=>o(s({},j(t)),{filter:e=>e.status===n.success||e.status===n.error}),Z=t=>o(s({},c(t)),{map:e=>e.me}),M=o(s({},c(!1)),{map:({me:t})=>w(t)}),_=o(s({},c(!1)),{map:({me:t})=>B(t)}),b=o(s({},c(!1)),{map:({me:t})=>t&&t.channel||"B2C"}),tt=o(s({},c(!1)),{map:({me:t})=>d(t)}),et=o(s({},c(!1)),{map:({me:t})=>F(t)}),rt=o(s({},c(!1)),{map:({me:t})=>A(t)});function dt(t){return o(s({},t),{selector:l(t.selector,C,(e,N)=>o(s({},e),{loggedIn:N})),shouldDispatch:e=>e.loggedIn&&t.shouldDispatch&&t.shouldDispatch(e)||!1})}var mt=(()=>{let e=class e{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}};e.\u0275fac=function(i){return new(i||e)(x(v))},e.\u0275prov=g({token:e,factory:e.\u0275fac,providedIn:"root"});let t=e;return t})();export{a,d as b,B as c,W as d,U as e,I as f,C as g,j as h,c as i,Z as j,M as k,_ as l,tt as m,dt as n,mt as o};