import{h as e,r as t,c as s}from"./p-083180bf.js";import{i as a}from"./p-f8a09b0f.js";import{b as r,j as i,f as l,n,u as o}from"./p-a7fc1e02.js";import{d,J as c,H as u,L as h,w as p,R as m,i as v}from"./p-d0993bb9.js";import{c as E}from"./p-c1086930.js";import{l as g}from"./p-9ec99ced.js";import{c as f}from"./p-cef45012.js";import"./p-49b20dae.js";import{G as y}from"./p-b1eb2a6a.js";import{u as w,a as b}from"./p-642f2c89.js";import{u as x}from"./p-d18dedd4.js";import{l as A}from"./p-2786819c.js";import{m as D}from"./p-11c127f5.js";import{g as N}from"./p-035d9b65.js";const R=r("sq:useRewardsTable"),P=d.gql`
  query getRewards(
    $limit: Int!
    $offset: Int!
    $rewardFilter: RewardFilterInput
    $locale: RSLocale
  ) {
    viewer {
      ... on User {
        id
        rewards(
          limit: $limit
          offset: $offset
          filter: $rewardFilter
          sortBy: { field: "dateCreated", order: DESC }
        ) {
          totalCount
          count
          data {
            meta {
              status
              integration {
                name
              }
              message
              customMeta
            }
            id
            type
            value
            unit
            name
            dateGiven
            dateCreated
            dateExpires
            dateCancelled
            dateRedeemed
            dateScheduledFor
            fuelTankCode
            fuelTankType
            currency
            prettyValue(locale: $locale)
            prettyValueNumber: prettyValue(
              formatType: NUMBER_FORMATTED
              locale: $locale
            )
            prettyAvailableNumber: prettyAvailableValue(
              formatType: NUMBER_FORMATTED
              locale: $locale
            )
            prettyRedeemedNumber: prettyRedeemedCredit(
              formatType: NUMBER_FORMATTED
              locale: $locale
            )
            programId
            program {
              name
            }
            partnerFundsTransfer {
              id
              status
              dateScheduled
              dateCreated
              dateTransferred
            }
            statuses
            pendingReasons
            cancelledReason
            globalRewardKey
            programRewardKey
            rewardSource
            prettyRedeemedCredit(locale: $locale)
            prettyAssignedCredit(locale: $locale)
            prettyAvailableValue(locale: $locale)
            exchangedRewardRedemptionTransaction {
              id
              creditRedeemed
              prettyRedeemedCredit(locale: $locale)
              unit
              dateRedeemed
            }
            referral {
              id
              dateModerated
              referrerUser {
                id
                firstName
                lastName
              }
              referredUser {
                id
                firstName
                lastName
              }
              fraudData {
                moderationStatus
                autoModerationStatus
                manualModerationStatus
              }
            }

            rewardRedemptionTransactions {
              data {
                exchangedRewards {
                  data {
                    prettyValue(locale: $locale)
                    type
                    fuelTankCode
                    globalRewardKey
                  }
                }
              }
            }
          }
        }
      }
    }
  }
`,I=d.gql`
  query getImpactTax {
    viewer {
      ... on User {
        id
        impactConnection {
          connected
          taxHandlingEnabled
          publisher {
            requiredTaxDocumentType
            currentTaxDocument {
              status
              type
              dateCreated
            }
            withdrawalSettings {
              paymentMethod
            }
            payoutsAccount {
              hold
              holdReasons
              balance
            }
          }
        }
      }
    }
  }
`;async function T(t,s){const a=t.tagName.toLowerCase();let r;await customElements.whenDefined(a);try{r=s()}catch(t){return R("label promise failed",t),e("span",null)}try{return await r}catch(t){R("Error rendering label",t);const s=N(t);return e("details",null,e("summary",null,"Error"),s)}}const S=class{constructor(e){t(this,e),this.perPage=4,this.hideLabels=!1,this.prevLabel="Prev",this.moreLabel="Next",this.hiddenColumns="0",this.smBreakpoint=599,this.mdBreakpoint=799,n(this)}disconnectedCallback(){}render(){const t=e(_,null),s=e(C,null),{states:a,data:r,callbacks:n,elements:d}=v()?function(e,t,s){const[a,r]=i(((e,t)=>({...e,...t})),{columns:[],rows:[],loading:!1,page:0}),n=w(),{data:d}=o((()=>{var t;return(null===(t=e.demoData)||void 0===t?void 0:t.mockData)||D(e.perPage)}),[e.perPage]),c=x();return l((()=>{r({loading:!0}),d&&async function(t){let s=d;s=d.slice(0,e.perPage);const a=t.filter((e=>{var t,s;return"loading"!==e.slot&&"empty"!==e.slot&&"loading"!==(null===(t=null==e?void 0:e.firstElementChild)||void 0===t?void 0:t.getAttribute("slot"))&&"empty"!==(null===(s=null==e?void 0:e.firstElementChild)||void 0===s?void 0:s.getAttribute("slot"))})),i=null==a?void 0:a.map((async(e,t)=>{var s;const a=null===(s=null==e?void 0:e.firstElementChild)||void 0===s?void 0:s.getAttribute("slot");if("RAISINS-PLOP-TARGET"===e.tagName&&"loading"!==a&&"empty"!==a){e.style.position="absolute",e.setAttribute("slot","column-"+t);const s=e.firstElementChild.childNodes[1];return s.innerHTML="＋",s.style.lineHeight="20px",T(e,(()=>e.renderLabel(t)))}return T(e,(()=>e.renderLabel()))})),l=null==s?void 0:s.map((async e=>{const t=null==a?void 0:a.map((async t=>T(t,(()=>t.renderCell(e,void 0,{})))));return await Promise.all(t)})),n=l&&(await Promise.all(l)).filter((e=>e));r({rows:n});const o=i&&await Promise.all(i);r({columns:o,loading:!1,page:0})}(c)}),[d,c,n]),E({states:{hasPrev:!1,hasNext:!1,loading:!1,show:"rows"},callbacks:{prevPage:()=>console.log("Prev"),nextPage:()=>console.log("Next")},data:{textOverrides:{showLabels:!e.hideLabels,prevLabel:e.prevLabel,moreLabel:e.moreLabel},referralData:[],mdBreakpoint:799,smBreakpoint:599},elements:{columns:a.columns,rows:a.rows,emptyElement:t,loadingElement:s}},e.demoData||{},{arrayMerge:(e,t)=>t})}(this,t,s):function(t,s,a){var r,n,o;const d=c(),v=u(),E=h(),g=null!==(r=t.programId)&&void 0!==r?r:v,f="GLOBAL"===g?null:g,y={userId_eq:null==d?void 0:d.id,accountId_eq:null==d?void 0:d.accountId,...f?"classic"===f?{programId_exists:!1}:{programId_eq:f}:{}},[b,A]=i(((e,t)=>({...e,...t})),{columns:[],rows:[],loading:!1,page:0}),{data:D,loading:N}=p(I,{},!(null==d?void 0:d.jwt)),{envelope:R,states:S,callbacks:_}=m(P,(e=>{var t;return null===(t=null==e?void 0:e.viewer)||void 0===t?void 0:t.rewards}),{limit:t.perPage,offset:0},{rewardFilter:y,locale:E},!(null==d?void 0:d.jwt)),C=w(),L=x(),q=null==R?void 0:R.data,U=null===(n=null==D?void 0:D.viewer)||void 0===n?void 0:n.impactConnection;l((()=>{A({loading:!0}),R&&async function(t){const s=t.filter((e=>"loading"!==e.slot&&"empty"!==e.slot)),a=null==s?void 0:s.map((async e=>T(e,(()=>e.renderLabel())))),r=null==q?void 0:q.map((async t=>{const a=null==s?void 0:s.map((async s=>T(s,(()=>s.renderCell(t,{locale:E,taxConnection:U},e)))));return await Promise.all(a)})),i=r&&(await Promise.all(r)).filter((e=>e));A({rows:i});const l=a&&await Promise.all(a);A({columns:l,loading:!1,page:S.currentPage})}(L)}),[R,L,C]);const O=!(null===(o=null==b?void 0:b.rows)||void 0===o?void 0:o.length)&&!(null==q?void 0:q.length);return{states:{hasNext:S.currentPage<S.pageCount-1,hasPrev:S.currentPage>0,show:S.loading||b.loading||N?"loading":O?"empty":"rows",namespace:"sqm-rewards-table"},data:{textOverrides:{showLabels:!t.hideLabels,prevLabel:t.prevLabel,moreLabel:t.moreLabel},hiddenColumns:t.hiddenColumns,smBreakpoint:t.smBreakpoint,mdBreakpoint:t.mdBreakpoint},elements:{columns:b.columns,rows:b.rows,emptyElement:s,loadingElement:a},callbacks:{nextPage:()=>{_.setCurrentPage(S.currentPage+1)},prevPage:()=>{_.setCurrentPage(S.currentPage-1)}}}}(this,t,s);return b([this.perPage]),e(y,{states:a,data:r,callbacks:n,elements:d})}};function _(){return e("slot",{name:"empty"},e("sqm-empty",{"empty-state-image":"https://res.cloudinary.com/saasquatch/image/upload/v1644360953/squatch-assets/empty_reward2.png","empty-state-header":"View your rewards","empty-state-text":"Refer friends and complete tasks to view the details of your rewards"}))}function C(){return e("slot",{name:"loading"},e(L,null),e(L,null),e(L,null),e(L,null))}function L(){return e("sqm-table-row",null,e("sqm-table-cell",{colspan:5},e("sqm-skeleton",null)))}const q=class{constructor(e){t(this,e),this.ignored=!0,this.locale="en",n(this)}disconnectedCallback(){}render(){var e,t;return this.date?null===(t=null===(e=A.DateTime.fromMillis(this.date))||void 0===e?void 0:e.setLocale(g(this.locale)))||void 0===t?void 0:t.toLocaleString(A.DateTime.DATE_MED):"-"}},U=class{constructor(e){t(this,e),this.columnTitle="Date received",this.dateShown="dateGiven",n(this)}disconnectedCallback(){}async renderCell(t,s){return e("sqm-rewards-table-date-cell",{date:t[this.dateShown],locale:null==s?void 0:s.locale})}async renderLabel(){return this.columnTitle}render(){return b([this.dateShown,this.columnTitle]),e(s,{style:{display:"none"}})}},O=f({DetailsContainer:{width:"100%",display:"flex","align-items":"center","justify-content":"space-between","margin-right":"var(--sl-spacing-small)","flex-wrap":"wrap"},Details:{"padding-bottom":"var(--sl-spacing-small)","max-width":"500px","padding-right":"var(--sl-spacing-x-small)","&::part(header)":{padding:"var(--sl-spacing-x-small)",cursor:"default"},"&::part(content)":{padding:"var(--sl-spacing-x-small) var(--sl-spacing-medium)"},"&::part(base)":{opacity:"1"},"&::part(summary-icon)":{display:"flex"}},BadgeContainer:{"& > :not(:last-child)":{"margin-right":"var(--sl-spacing-x-small)"}},BoldText:{"font-weight":"var(--sl-font-weight-semibold)"},StatusBadge:{paddingLeft:"var(--sl-spacing-xxx-small)","&::part(base)":{textAlign:"center",maxWidth:"170px",whiteSpace:"pre-line"}},Fueltank:{"& .code":{display:"flex",cursor:"pointer",userSelect:"none",color:"var(--sl-color-neutral-500)","&:hover":{color:"var(--sl-color-sky-500)"}},"& .text":{maxWidth:"90%",overflow:"hidden",textOverflow:"ellipsis",color:"inherit",fontSize:"var(--sl-font-size-small)",fontWeight:"var(--sl-font-weight-bold)"},"& .icon":{position:"relative",top:"1px",marginLeft:"var(--sl-spacing-x-small)",color:"inherit"}}}),k=O.toString(),G=class{constructor(e){t(this,e)}render(){return a.locale=this.locale,e("div",{style:{display:"contents"}},e("style",{type:"text/css"},k),e((({reward:t})=>{var s;const r="CENTS"===t.unit?t.prettyValue.replace(/USD/gi,"$"):null!==(s=t.prettyValue)&&void 0!==s?s:"-",i="1"===t.prettyValueNumber||t.dateRedeemed&&"0"===t.prettyAvailableNumber;if("FUELTANK"===t.type)return e("div",{class:O.classes.Fueltank},t.prettyValue,t.fuelTankCode&&e("div",{class:"code",onClick:()=>navigator.clipboard.writeText(t.fuelTankCode)},e("sl-tooltip",{trigger:"click",placement:"top",distance:5,skidding:11,content:this.copyText,"onSl-show":e=>setTimeout((()=>e.path[0].hide()),1e3)},e("span",{class:"text"},t.fuelTankCode),e("span",{class:"icon"},e("sl-icon",{name:"files"})))));if("CREDIT"===t.type&&!i){const s=parseFloat(t.prettyValueNumber)-parseFloat(t.prettyRedeemedNumber),i=Math.round(s/parseFloat(t.prettyValueNumber)*100),l=t.statuses.includes("EXPIRED")||t.statuses.includes("CANCELLED")?e("div",null,a.formatMessage({id:"redeemedText",defaultMessage:this.redeemedText},{redeemedAmount:t.prettyRedeemedCredit})):e("div",null,a.formatMessage({id:"availableText",defaultMessage:this.availableText},{availableAmount:t.statuses.includes("PENDING")?t.prettyAssignedCredit:t.prettyAvailableValue})),n=f({Progress:{height:"3px",width:"100%",margin:"var(--sl-spacing-xx-small) 0",background:"var(--sqm-border-color)","&:after":{content:'""',display:"block",background:"var(--sqm-accent-color-icon)",borderRadius:"100px",width:`${i}%`,height:"100%"}},Container:{display:"inline-block",verticalAlign:"top",width:"150px",whiteSpace:"break",overflow:"hidden",textOverflow:"ellipsis"},Text:{fontSize:"var(--sl-font-size-medium)",color:"var(--sqm-text)"},Subtext:{fontSize:"var(--sl-font-size-small)",color:"var(--sqm-text-subdued)"}}),o=n.toString();return e("div",null,e("style",{type:"text/css"},o),e("div",{class:n.classes.Container},e("span",{part:"sqm-reward-cell-value"},r+" "),e("br",null)," ",e("div",{part:"sqm-reward-cell-progress",class:n.classes.Progress}),e("span",{part:"sqm-reward-cell-subtext",class:n.classes.Subtext},l)))}return e("div",null,r)}),{reward:this.reward}))}},F=class{constructor(e){t(this,e),this.columnTitle="Reward",this.redeemedText="{redeemedAmount} redeemed",this.availableText="{availableAmount} remaining",this.copyText="Copied!",n(this)}disconnectedCallback(){}async renderCell(t,s){return e("sqm-rewards-table-reward-cell",{reward:t,redeemedText:this.redeemedText,availableText:this.availableText,copyText:this.copyText,locale:null==s?void 0:s.locale,exportparts:"sqm-rewards-cell-value, sqm-rewards-cell-progress-bar, sqm-rewards-cell-subtext"})}async renderLabel(){return this.columnTitle}render(){return b([this.columnTitle,this.redeemedText,this.availableText,this.copyText]),e(s,{style:{display:"none"}})}},V=class{constructor(e){t(this,e),this.locale="en"}render(){a.locale=this.locale;const t=({reward:t})=>{var s;return e("span",null,a.formatMessage({id:"rewardSourceText",defaultMessage:this.rewardSourceText},{rewardSource:t.rewardSource,programName:null===(s=null==t?void 0:t.program)||void 0===s?void 0:s.name}))},s=({reward:t})=>{var s;const a=e("div",null,e("span",{style:{fontSize:"var(--sl-font-size-small)",color:"var(--sqm-text-subdued)"}},this.rewardExchangeText),e("br",null),null===(s=t.exchangedRewardRedemptionTransaction)||void 0===s?void 0:s.prettyRedeemedCredit," → ",t.prettyValue);return t.exchangedRewardRedemptionTransaction.prettyRedeemedCredit.length+t.prettyValue.length<21?a:e("div",{style:{display:"inline-block",verticalAlign:"top"}},a)},r=e=>e?e.firstName||e.lastName?e.firstName?e.lastName?`${e.firstName} ${e.lastName}`:`${e.firstName}`:`${e.lastName}`:this.anonymousUserText:this.deletedUserText;return e((()=>"FRIEND_SIGNUP"===this.reward.rewardSource||"REFERRED"===this.reward.rewardSource?null===this.reward.referral?e("p",{style:{color:"var(--sqm-text-subdued)"}},this.deletedReferralText):e("div",null,e("div",{style:{fontSize:"var(--sl-font-size-small)",color:"var(--sqm-text-subdued)"}},a.formatMessage({id:"referralText",defaultMessage:this.referralText},{rewardSource:this.reward.rewardSource})),e("div",null,r("FRIEND_SIGNUP"==this.reward.rewardSource?this.reward.referral.referredUser:this.reward.referral.referrerUser))):e(this.reward.exchangedRewardRedemptionTransaction?s:t,{reward:this.reward})),null)}},M=class{constructor(e){t(this,e),this.columnTitle="Source",this.anonymousUser="Your Friend",this.deletedUser="Deleted User",this.rewardExchangeText="Reward Exchange",this.referralText="{rewardSource, select, FRIEND_SIGNUP {Referral to} REFERRED {Referred by} other {}}",this.rewardSourceText="{rewardSource, select, MANUAL {Manual} AUTOMATED {{programName}} other {}}",n(this)}disconnectedCallback(){}async renderCell(t,s){return e("sqm-rewards-table-source-cell",{reward:t,anonymousUserText:this.anonymousUser,deletedUserText:this.deletedUser,rewardExchangeText:this.rewardExchangeText,referralText:this.referralText,rewardSourceText:this.rewardSourceText,locale:null==s?void 0:s.locale})}async renderLabel(){return this.columnTitle}render(){return b([this.deletedUser,this.anonymousUser,this.columnTitle,this.rewardExchangeText,this.referralText,this.rewardSourceText]),e(s,{style:{display:"none"}})}},B=f({Badge:{"&::part(base)":{fontSize:"var(--sl-font-size-small)",padding:"4px 8px",paddingLeft:"10px",whiteSpace:"pre-line"}},RedeemBadge:{"&::part(base)":{padding:"4px 8px",fontSize:"var(--sl-font-size-small)",textAlign:"center",whiteSpace:"pre-line",background:"var(--sqm-informative-color-icon)",color:"var(--sl-color-white)"}},DangerBadge:{"&::part(base)":{padding:"4px 8px",fontSize:"var(--sl-font-size-small)",textAlign:"center",whiteSpace:"pre-line",background:"var(--sqm-danger-color-icon)",color:"var(--sl-color-white)"}},WarningBadge:{"&::part(base)":{padding:"4px 8px",fontSize:"var(--sl-font-size-small)",textAlign:"center",whiteSpace:"pre-line",background:"var(--sqm-warning-color-icon)",color:"var(--sl-color-white)"}},SuccessBadge:{"&::part(base)":{padding:"4px 8px",fontSize:"var(--sl-font-size-small)",textAlign:"center",whiteSpace:"pre-line",background:"var(--sqm-success-color-icon)",color:"var(--sl-color-white)"}},Date:{fontSize:"var(--sl-font-size-small)",color:"var(--sqm-text-subdued)",margin:"0"}}),$=B.toString(),z=class{constructor(e){t(this,e),this.expiryText="Expires",this.locale="en",this.pendingUsTax="W-9 required",this.pendingTaxReview="Awaiting tax form review.",this.pendingNewTaxForm="Invalid tax form. Submit a new form to receive your rewards.",this.pendingTaxSubmission="Submit your tax documents to receive your rewards.",this.pendingPartnerCreation="Complete your tax and cash payout setup to receive your rewards.",this.pendingScheduled="Until",this.pendingUnhandled="Fulfillment error",this.pendingReviewText="Awaiting review",this.deniedText="Detected self-referral",this.payoutFailed="Payout failed due to a fulfillment issue and is currently being retried.",this.payoutApproved="Payout approved and scheduled for payment based on your settings.",this.payoutCancelled="If you think this is a mistake, contact our Support team.",this.payoutProcessing="Processing until {date}. Payout is then scheduled based on your settings."}rewardStatus(e){var t,s,a,r,i,l,n,o,d;const c=null===(t=e.statuses)||void 0===t?void 0:t.includes("EXPIRED"),u=null===(s=e.statuses)||void 0===s?void 0:s.includes("PENDING"),h="INTEGRATION"===e.type||"FUELTANK"===e.type,p=null===(r=null===(a=e.referral)||void 0===a?void 0:a.fraudData)||void 0===r?void 0:r.moderationStatus;if("DENIED"===p)return"DENIED";if("PENDING"===p)return"PENDING_REVIEW";const m=null===(i=e.partnerFundsTransfer)||void 0===i?void 0:i.status;if(e.partnerFundsTransfer){if("REVERSED"===m)return"PAYOUT_CANCELLED";if("OVERDUE"===m)return"PAYOUT_FAILED";if(e.partnerFundsTransfer.dateScheduled&&e.partnerFundsTransfer.dateScheduled>Date.now())return"PROCESSING";if("TRANSFERRED"===m||"NOT_YET_DUE"===m||e.partnerFundsTransfer.dateScheduled&&e.partnerFundsTransfer.dateScheduled<Date.now()&&"OVERDUE"!==m&&"REVERSED"!==m)return"PAYOUT_APPROVED"}return e.dateCancelled?"CANCELLED":c?"EXPIRED":u?"PENDING":"CREDIT"===e.type?(null===(l=e.statuses)||void 0===l?void 0:l.includes("REDEEMED"))?"REDEEMED":"AVAILABLE":"PCT_DISCOUNT"===e.type&&(null===(n=e.statuses)||void 0===n?void 0:n.includes("AVAILABLE"))?"AVAILABLE":h&&u?"PENDING":h&&(null===(o=e.statuses)||void 0===o?void 0:o.includes("CANCELLED"))?"CANCELLED":h&&(null===(d=e.statuses)||void 0===d?void 0:d.includes("AVAILABLE"))?"AVAILABLE":""}getTaxPendingReasons(e,t){var s,a,r,i,l;if(null===(s=null==e?void 0:e.pendingReasons)||void 0===s?void 0:s.includes("US_TAX")){if(!(null==t?void 0:t.taxHandlingEnabled))return this.pendingUsTax;if(!(null==t?void 0:t.connected))return this.pendingPartnerCreation;if(null===(a=null==t?void 0:t.publisher)||void 0===a?void 0:a.requiredTaxDocumentType){if(!(null===(r=null==t?void 0:t.publisher)||void 0===r?void 0:r.currentTaxDocument))return this.pendingTaxSubmission;const e=t.publisher.currentTaxDocument.status;if("INACTIVE"===e)return this.pendingNewTaxForm;if("NOT_VERIFIED"===e)return this.pendingTaxReview}if(!(null===(i=null==t?void 0:t.publisher)||void 0===i?void 0:i.withdrawalSettings))return this.pendingPartnerCreation}return(null===(l=null==e?void 0:e.pendingReasons)||void 0===l?void 0:l.includes("MISSING_PAYOUT_CONFIGURATION"))?this.pendingPartnerCreation:""}getBadgeType(e){switch(e){case"AVAILABLE":return"success";case"REDEEMED":case"PAYOUT_APPROVED":return"primary";case"PENDING":case"PENDING_REVIEW":case"PROCESSING":return"warning";default:return"danger"}}getPayoutStatusText(e){var t;switch(e){case"US_TAX":return this.pendingUsTax;case"PAYOUT_APPROVED":return this.payoutApproved;case"PAYOUT_FAILED":return this.payoutFailed;case"PAYOUT_CANCELLED":return this.payoutCancelled;case"PENDING_TAX_REVIEW":return this.pendingTaxReview;case"PENDING_NEW_TAX_FORM":return this.pendingNewTaxForm;case"PENDING_TAX_SUBMISSION":return this.pendingTaxSubmission;case"PENDING_PARTNER_CREATION":return this.pendingPartnerCreation;case"PROCESSING":return a.formatMessage({id:"payoutProcessingText",defaultMessage:this.payoutProcessing},{date:null===(t=A.DateTime.fromMillis(this.reward.partnerFundsTransfer.dateScheduled))||void 0===t?void 0:t.setLocale(g(this.locale)).toLocaleString(A.DateTime.DATE_MED)})}}render(){var t;a.locale=this.locale;const s=this.rewardStatus(this.reward),r=a.formatMessage({id:"statusMessage",defaultMessage:this.statusText},{status:s}),i=this.getBadgeType(s),l=this.reward.dateCancelled||this.reward.dateExpires||this.reward.dateRedeemed||"",n=l&&`${"AVAILABLE"===s&&this.reward.dateExpires?this.expiryText+" ":""}${null===(t=A.DateTime.fromMillis(l))||void 0===t?void 0:t.setLocale(g(g(this.locale))).toLocaleString(A.DateTime.DATE_MED)}`,o="PENDING"===s?this.getTaxPendingReasons(this.reward,this.taxConnection)||function(e){var t;const s={SCHEDULED:e.reward.dateScheduledFor&&e.pendingScheduled+" "+(null===(t=A.DateTime.fromMillis(e.reward.dateScheduledFor))||void 0===t?void 0:t.setLocale(g(g(e.locale||"en"))).toLocaleString(A.DateTime.DATE_MED)),UNHANDLED_ERROR:e.pendingUnhandled,SUSPECTED_FRAUD:e.pendingReview},a=e.getTaxPendingReasons(e.reward,e.taxConnection);return[...a?[a]:[],...e.reward.pendingReasons.map((e=>{var t;return null!==(t=s[e])&&void 0!==t?t:e}))].join(", ")}(this):null,d="PENDING_REVIEW"===s?this.pendingReviewText:"DENIED"===s?this.deniedText:null,c=(()=>{switch(s){case"AVAILABLE":return B.classes.SuccessBadge;case"REDEEMED":case"PAYOUT_APPROVED":return B.classes.RedeemBadge;case"PENDING":case"PENDING_REVIEW":case"PROCESSING":return B.classes.WarningBadge;default:return B.classes.DangerBadge}})();return e("div",{style:{display:"contents"}},e("style",{type:"text/css"},$),e("sl-badge",{type:i,pill:!0,class:c},r),e("p",{class:B.classes.Date},d||o||this.getPayoutStatusText(s)||n))}},j=class{constructor(e){t(this,e),this.columnTitle="Status",this.statusText="{status, select, AVAILABLE {Available} CANCELLED {Cancelled} PENDING {Pending} PENDING_REVIEW {Pending} PAYOUT_APPROVED {Payout Approved} PROCESSING {Payment Processing} PAYOUT_CANCELLED {Payout Cancelled} PAYOUT_FAILED {Payout Failed} EXPIRED {Expired} REDEEMED {Redeemed} DENIED {Denied} other {Not available} }",this.expiryText="Expires on ",this.pendingUsTax="W-9 required",this.pendingScheduled="Until",this.pendingUnhandled="Fulfillment error",this.pendingReviewText="Awaiting review",this.deniedText="Detected self-referral",this.pendingTaxReview="Awaiting tax form review.",this.pendingNewTaxForm="Invalid tax form. Submit a new form to receive your rewards.",this.pendingTaxSubmission="Submit your tax documents to receive your rewards.",this.pendingPartnerCreation="Complete your tax and cash payout setup to receive your rewards.",this.payoutFailed="Payout failed due to a fulfillment issue and is currently being retried.",this.payoutProcessing="Processing until {date}. Payout is then scheduled based on your settings.",this.payoutCancelled="If you think this is a mistake, contact our Support team.",this.payoutApproved="Reward was scheduled for payment based on your settings, barring any account holds.",n(this)}disconnectedCallback(){}async renderCell(t,s){return e("sqm-rewards-table-status-cell",{statusText:this.statusText,reward:t,taxConnection:null==s?void 0:s.taxConnection,expiryText:this.expiryText,pendingScheduled:this.pendingScheduled,pendingUsTax:this.pendingUsTax,pendingUnhandled:this.pendingUnhandled,pendingReviewText:this.pendingReviewText,payoutFailed:this.payoutFailed,payoutApproved:this.payoutApproved,payoutProcessing:this.payoutProcessing,payoutCancelled:this.payoutCancelled,deniedText:this.deniedText,locale:null==s?void 0:s.locale})}async renderLabel(){return this.columnTitle}render(){return b([this.columnTitle,this.statusText,this.expiryText,this.pendingReviewText,this.pendingScheduled,this.pendingUsTax,this.pendingUnhandled]),e(s,{style:{display:"none"}})}};export{S as sqm_rewards_table,q as sqm_rewards_table_date_cell,U as sqm_rewards_table_date_column,G as sqm_rewards_table_reward_cell,F as sqm_rewards_table_reward_column,V as sqm_rewards_table_source_cell,M as sqm_rewards_table_source_column,z as sqm_rewards_table_status_cell,j as sqm_rewards_table_status_column}