import{u as D,ca as P,aE as I,j as i,B as n,i as y}from"./bundle.CHKSNOJF.js";import{I as s}from"./invoice-status-C0SI5VYC.js";function B(e){const[t]=D(),{status_id:a,due_date:v,partial_due_date:d,partial:f,balance:h}=e.entity,r=P(),j=()=>e.entity.invitations.some(l=>l.viewed_date),x=I(),C=a!==s.Draft,c=!(a===s.Paid),m=j(),b=a===s.Partial,g=a===s.Reversed,o=a===s.Cancelled||g,u=!!e.entity.is_deleted,R=x&&["R1","R2"].includes(e.entity.backup?.document_type??""),_=()=>{const l=f!==0&&d?d:v;if(!l||h===0)return!1;const k=y(l).diff(y().format("YYYY-MM-DD"),"day")<=-1;return!u&&C&&c&&k};return u?i.jsx(n,{variant:"red",style:e.style,children:t("deleted")}):e.entity.archived_at?i.jsx(n,{variant:"orange",style:e.style,children:t("archived")}):_()&&!o?i.jsx(n,{variant:"red",style:{backgroundColor:r.$5,...e.style},children:t("past_due")}):m&&c&&!b&&!o?i.jsx(n,{variant:"yellow",style:{backgroundColor:r.$4,...e.style},children:t("viewed")}):a===s.Draft?i.jsx(n,{variant:"generic",style:e.style,children:t("draft")}):a===s.Sent?i.jsx(n,{variant:"light-blue",style:{backgroundColor:r.$1,...e.style},children:R?"Rectificativa":t("sent")}):a===s.Partial?i.jsx(n,{variant:"dark-blue",style:{backgroundColor:r.$2,...e.style},children:t("partial")}):a===s.Paid?i.jsx(n,{variant:"green",style:{backgroundColor:r.$3,...e.style},children:t("paid")}):a===s.Cancelled?i.jsx(n,{variant:"purple",style:e.style,children:t("cancelled")}):a===s.Reversed?i.jsx(n,{variant:"teal",style:e.style,children:t("reversed")}):i.jsx(n,{variant:"teal",style:e.style,children:t("reversed")})}export{B as I};
