import{r,h as t}from"./p-083180bf.js";import{i as e}from"./p-f8a09b0f.js";import{n as a}from"./p-a7fc1e02.js";import{d as o,H as n,J as s,w as i,i as l}from"./p-d0993bb9.js";import{c as d}from"./p-c1086930.js";import{L as p}from"./p-6c3a1d86.js";const u=o.gql`
  query ($type: String!, $filter: UserLeaderboardFilterInput) {
    viewer {
      ... on User {
        leaderboardRank(type: $type, filter: $filter) {
          rowNumber
          rank
          denseRank
        }
      }
    }
  }
`,c=class{constructor(t){r(this,t),this.rankText="You are currently in {rank, selectordinal, one {#st} two {#nd} few {#rd} other {#th} } place!",a(this)}disconnectedCallback(){}render(){const r=l()?function(r){const t=e.formatMessage({id:"rankText",defaultMessage:r.rankText},{rank:1})||"1st";return d({data:{rank:t}},r.demoData||{},{arrayMerge:(r,t)=>t})}(this):function(r){var t,a,o,l;const d=n(),p=null!==(t=r.programId)&&void 0!==t?t:d,c=s(),f=p?{type:r.leaderboardType,filter:{programId_eq:p}}:{type:r.leaderboardType,filter:{}};r.interval&&(f.filter.interval=r.interval);const{data:m}=i(u,f,!(null==c?void 0:c.jwt));return{data:{rank:(null===(a=null==m?void 0:m.viewer)||void 0===a?void 0:a.leaderboardRank)?e.formatMessage({id:"rankText",defaultMessage:r.rankText},{rank:null===(l=null===(o=null==m?void 0:m.viewer)||void 0===o?void 0:o.leaderboardRank)||void 0===l?void 0:l[r.rankType]}):r.unrankedText||"unranked"}}}(this);return t(p,Object.assign({},r))}};c.style="p,.P{font-size:var(--sl-font-size-small);color:var(--sqm-text);margin-top:0px}p.Subtitle,.P.Subtitle{color:var(--sqm-text-subdued);margin:0px}";export{c as sqm_leaderboard_rank}