1import{c as Ye,u as Ze,b as Ee,j as e}from"./query-C9rthSUJ.js";import{a as o}from"./vendor-D5-NEHb5.js";import{u as et,B as p}from"./navigation-Dsw3USph.js";import{A as R}from"./account-layout-CspMc0N6.js";import{P as W,b as tt,a as P}from"./page-shell-B_QWxdTZ.js";import{X as st,G as rt,I as N,C as at}from"./dropdown-menu-BYmjAYFV.js";import{L as g}from"./label-DOHzhs-N.js";import{C as it}from"./country-select-CuoMgOuX.js";import{e as nt,g as ot,c as lt,h as K,b as m,U as we}from"./index-1qHllCzV.js";import{i as dt}from"./identity-verification-DBX8n1S1.js";import{m as ct}from"./member-Cvo-6J55.js";import{m as Q,M as ve,B as xt}from"./site-header-C-ga5QUs.js";import{o as _e}from"./oauth-rylahrrG.js";import{g as mt}from"./oauth-scopes-0qOFCs6F.js";import{d as pt}from"./format-I42qvieW.js";import{u as ft}from"./useConfirm-C9JaqIVg.js";import{c as ht}from"./country-I05UXO8R.js";import y from"./loader-circle-t1fdXJtH.js";import Pe from"./circle-alert-DmTb0b_k.js";import H from"./shield-alert-DeZSyYGT.js";import Ce from"./pencil-BHV2JknV.js";import ke from"./phone-Deist9Ps.js";import Se from"./message-circle-8kSRTSC9.js";import Ie from"./map-pin-COGEP8He.js";import ut from"./save-LBMFoZnD.js";import Le from"./circle-x-B0ygDn0k.js";import gt from"./key-BQrgmP13.js";import{f as G,E as O}from"./dialog-DDYUSWYc.js";import Me from"./clock-D_aQwV6T.js";import yt from"./shield-check-De6YQMUI.js";import{f as J}from"./format-D4YE7dny.js";import"./ui-B72G9_re.js";import"./charts-3WZcVZCN.js";import"./user-round-DobIWPVN.js";import"./receipt-text-CrEpgz0p.js";import"./clipboard-list-nomMHFMW.js";import"./layout-dashboard-B16n9kqU.js";import"./box-CpV0eWSF.js";import"./users-round-wVr-YTeu.js";import"./calendar-days-dvKkC3ld.js";import"./wallet-cards-CXJq92QM.js";import"./key-round-8Eel-15I.js";import"./settings-B4WokloQ.js";import"./site-layout-limBRqDA.js";import"./chevron-left-DjRDferW.js";import"./index-DMQGXP0o.js";import"./chevrons-up-down-Dug-87w9.js";import"./zh-TW-CjSIZPpn.js";import"./alert-dialog-CFuNEyXY.js";import"./info-D8ttYUxU.js";import"./triangle-alert-DOM9v9BM.js";import"./trash-2-BxCcsnSK.js";import"./circle-help-BdpO14f2.js";function js(){var ye,je,be,Ne;const Fe=et(),{language:C}=nt(),t=o.useCallback((s,a)=>ot(C,s,a),[C]),{isAuthenticated:w,isLoading:k,refreshUser:S}=lt(),De=Ye(),Ae=ft(),[r,ze]=o.useState(null),[Xe,Y]=o.useState(!0),[Z,E]=o.useState(!1),[I,L]=o.useState(!1),[M,F]=o.useState(null),[ee,te]=o.useState(null),[Te,se]=o.useState(!0),[re,ae]=o.useState([]),[$e,ie]=o.useState(!0),[T,ne]=o.useState([]),[Ue,oe]=o.useState(!0),[D,A]=o.useState(null),[le,$]=o.useState(!1),[x,v]=o.useState({currentPassword:"",newPassword:"",confirmPassword:""}),[U,Ve]=o.useState(!1),[V,qe]=o.useState(!1),[q,Be]=o.useState(!1),[de,j]=o.useState(null),[ce,xe]=o.useState(!1),[d,h]=o.useState({name:"",phone:"",line_id:"",address:"",country:""}),[b,me]=o.useState("+886"),[u,pe]=o.useState([]),[fe,he]=o.useState(!0),_=Ze({queryKey:["oauth-consents"],queryFn:_e.listConsents,enabled:w,retry:!1}),z=Ee({mutationFn:_e.revokeConsent,onSuccess:async()=>{await De.invalidateQueries({queryKey:["oauth-consents"]}),m.success(t("innerPages.consents.revoked"))},onError:()=>m.error(t("innerPages.consents.revokeFailed"))}),ue=(s,a)=>s?s.startsWith(a)?s.slice(a.length):s:"";o.useEffect(()=>{(async()=>{try{he(!0);const a=await ht.getActiveCountries();pe(a||[])}catch(a){console.error("Failed to fetch countries:",a),pe([{code:"TW",name_en:"Taiwan",name_zh_tw:t("profile.text1"),phone_prefix:"+886",currency_code:"TWD",currency_symbol:"NT$",currency_symbol_position:"prefix",is_active:!0,created_at:""},{code:"US",name_en:"United States",name_zh_tw:t("profile.text2"),phone_prefix:"+1",currency_code:"USD",currency_symbol:"$",currency_symbol_position:"prefix",is_active:!0,created_at:""}])}finally{he(!1)}})()},[t]);const f=!!(r!=null&&r.name&&(r!=null&&r.phone));o.useEffect(()=>{if(r!=null&&r.phone&&u.length>0){const a=[...u].sort((n,l)=>{var i,c;return(((i=l.phone_prefix)==null?void 0:i.length)||0)-(((c=n.phone_prefix)==null?void 0:c.length)||0)}).find(n=>{var l;return n.phone_prefix&&((l=r.phone)==null?void 0:l.startsWith(n.phone_prefix))});a!=null&&a.phone_prefix&&me(a.phone_prefix)}},[r,u]),o.useEffect(()=>{if(!k&&!w){Fe.push("/");return}!k&&w&&X()},[w,k]),o.useEffect(()=>{r!=null&&r.id&&(Re(),ge(),B())},[r==null?void 0:r.id]);const X=async()=>{var s;try{Y(!0),F(null);const a=await K.getCurrentMember();ze(a),h({name:a.name||"",phone:a.phone||"",line_id:a.line_id||"",address:a.address||"",country:a.country||""})}catch(a){const n=a;console.error("Load member error:",a),console.error("Error body:",n==null?void 0:n.body);let l=t("profile.text3");(s=n==null?void 0:n.body)!=null&&s.detail?l=typeof n.body.detail=="string"?n.body.detail:n.body.detail.message||l:n!=null&&n.detail?l=typeof n.detail=="string"?n.detail:n.detail.message||l:n!=null&&n.message&&(l=n.message),F(l),m.error(t("profile.text3"),{description:l})}finally{Y(!1)}},Re=async()=>
1{if(r!=null&&r.id)try{se(!0);const s=await dt.getLatestVerificationByMember(r.id);te(s)}catch{te(null)}finally{se(!1)}},ge=async()=>{if(r!=null&&r.id)try{ie(!0);const s=await ct.getMemberCompanies(r.id);ae(s)}catch{ae([])}finally{ie(!1)}},B=async()=>{try{oe(!0);const s=await Q.getMyInvitations();ne(s)}catch{ne([])}finally{oe(!1)}},We=async s=>{try{A(s),await Q.acceptInvitation(s),m.success(t("profile.invitation_accepted")),await Promise.all([B(),X(),ge()]),S&&S()}catch(a){m.error(t("profile.invitation_accept_failed"),{description:a==null?void 0:a.detail})}finally{A(null)}},Ke=async s=>{try{A(s),await Q.rejectInvitation(s),m.success(t("profile.invitation_rejected")),await B()}catch(a){m.error(t("profile.invitation_reject_failed"),{description:a==null?void 0:a.detail})}finally{A(null)}},Qe=async(s,a)=>{await Ae({title:t("innerPages.consents.revokeTitle"),description:t("innerPages.consents.revokeDescription",{app:a}),confirmText:t("innerPages.consents.revoke"),cancelText:t("common.cancel"),variant:"danger"})&&z.mutate(s)},He=s=>{const a=mt(s);return a?t(a):s},Ge=async s=>{var a,n;if(s.preventDefault(),!!r){if(!d.name.trim()){m.error(t("profile.text4"));return}if(!d.phone.trim()){m.error(t("profile.text5"));return}try{E(!0),F(null),await K.updateMember(r.id,{name:d.name.trim(),phone:d.phone.trim(),line_id:d.line_id.trim()||void 0,address:d.address.trim()||void 0,country:d.country||void 0}),m.success(t("profile.text6"),{description:t("profile.text7")}),L(!1),S&&await S(),await X()}catch(l){const i=l;let c=t("profile.text8");console.error("Update member error:",l),console.error("Error body:",i==null?void 0:i.body),console.error("Error detail:",(a=i==null?void 0:i.body)==null?void 0:a.detail),(n=i==null?void 0:i.body)!=null&&n.detail?typeof i.body.detail=="string"?c=i.body.detail:i.body.detail.message&&(c=i.body.detail.message):i!=null&&i.detail?typeof i.detail=="string"?c=i.detail:i.detail.message&&(c=i.detail.message):i!=null&&i.message&&(c=i.message),F(c),m.error(t("profile.text8"),{description:c})}finally{E(!1)}}},Oe=async s=>{var a,n;if(s.preventDefault(),j(null),!x.currentPassword){j(t("profile.text9"));return}if(!x.newPassword){j(t("profile.text10"));return}if(x.newPassword.length<8){j(`${t("profile.text11")} 8 ${t("profile.text12")}`);return}if(x.newPassword!==x.confirmPassword){j(t("profile.text13"));return}try{xe(!0),await K.updatePassword({current_password:x.currentPassword,new_password:x.newPassword}),m.success(t("profile.text14"),{description:t("profile.text15")}),v({currentPassword:"",newPassword:"",confirmPassword:""}),$(!1)}catch(l){const i=l;console.error("Update password error:",l),console.error("Error body:",i==null?void 0:i.body),console.error("Error detail:",(a=i==null?void 0:i.body)==null?void 0:a.detail);let c=t("profile.text16");(n=i==null?void 0:i.body)!=null&&n.detail?typeof i.body.detail=="string"?c=i.body.detail:i.body.detail.message&&(c=i.body.detail.message):i!=null&&i.detail?c=typeof i.detail=="string"?i.detail:i.detail.message||c:i!=null&&i.message&&(c=i.message),j(c),m.error(t("profile.text16"),{description:c})}finally{xe(!1)}},Je=()=>{if(Te)return{icon:Me,text:`${t("profile.text17")}...`,color:"text-gray-500",bg:"bg-gray-50"};if(!ee)return{icon:H,text:t("profile.text18"),color:"text-amber-600",bg:"bg-amber-50"};switch(ee.status){case"approved":return{icon:yt,text:t("profile.text19"),color:"text-green-600",bg:"bg-green-50"};case"pending":return{icon:Me,text:t("profile.text20"),color:"text-blue-600",bg:"bg-blue-50"};case"rejected":return{icon:Le,text:t("profile.text21"),color:"text-red-600",bg:"bg-red-50"};default:return{icon:H,text:t("profile.text18"),color:"text-amber-600",bg:"bg-amber-50"}}};return k||Xe?e.jsx(W,{width:"default",children:e.jsx(R,{children:e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(y,{className:"w-8 h-8 animate-spin text-brand"}),e.jsxs("span",{className:"ml-3 text-gray-600",children:[t("profile.text17"),"..."]})]})})}):w?M&&!r?e.jsx(W,{width:"default",children:e.jsx(R,{children:e.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-md p-6 text-center max-w-md mx-auto",children:[e.jsx(Pe,{className:"w-12 h-12 text-red-500 mx-auto mb-4"}),e.jsx("p",{className:"text-red-600 mb-4 font-medium",children:M}),e.jsx(p,{onClick:X,variant:"outline",children:t("profile.text22")})]})})}):(Je().icon,e.jsx(W,{width:"default",children:e.jsx(R,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(tt,{title:t("profile.text24"),description:t("profile.text25")}),!f&&e.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-md p-6 mb-6",children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx(H,{className:"w-8 h-8 text-amber-500 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-bold text-gray-900 mb-1",children:t("profile.text26")}),e.jsxs("p",{className:"text-gray-600 text-sm",children:[t("profile.text27"),"ï¼",t("profile.text28"),"ã"]})]})]})}),e.jsxs(P,{children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsx("h2",{className:"text-base font-bold text-ink",children:t(f?"profile.text29":"profile.text30")}),f&&!I&&e.jsxs(p,{type:"button",variant:"secondary",size:"sm",onClick:()=>L(!0),className:"gap-2",children:[e.jsx(Ce,{className:"w-4 h-4"}),t("profile.text31")]}),I&&e.jsxs(p,{type:"button",variant:"ghost",size:"sm",onClick:()=>{L(!1),r&&h({name:r.name||"",phone:r.phone||"",line_id:r.line_id||"",address:r.address||"",country:r.country||""})},className:"gap-2 text-gray-500",children:[e.jsx(st,{className:"w-4 h-4"}),t("profile.text32")]})]}),M&&e.jsx("div",{className:"bg-red-50 border border-red-200 rounded-md p-4 mb-6",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Pe,{className:"w-5 h-5 text-red-600 mt-0.5 flex-shrink-0"}),e.jsx("p",{className:"text-sm text-red-800",children:M})]})}),f&&!I?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center py-3 border-b border-gray-100",children:[e.jsxs("div",{className:"flex items-center gap-3 w-24 md:w-32 text-gray-500 flex-shrink-0",children:[e.jsx(ve,{className:"w-4 h-4"}),e.jsx("span",{className:"text-sm",children:t("profile.text33")})]}),e.jsx("span",{className:"text-gray-900 font-medium",children:r==null?void 0:r.email})]}),e.jsxs("div",{className:"flex items-center py-3 border-b border-gray-100",children:[e.jsxs("div",{className:"flex items-center gap-3 w-24 md:w-32 text-gray-500 flex-shrink-0",children:[e.jsx(we,{className:"w-4 h-4"}),e.jsx("span",{className:"text-sm",children:t("profile.text34")})]}),e.jsx("span",{className:"text-gray-900 font-medium",children:r==null?void 0:r.name})]}),e.jsxs("div",{className:"flex items-center py-3 border-b border-gray-100",children:[e.jsxs("div",{className:"flex items-center gap-3 w-24 md:w-32 text-gray-500 flex-shrink-0",children:[e.jsx(ke,{className:"w-4 h-4"}),e.jsx("span",{className:"text-sm",children:t("profile.text35")})]}),e.jsx("span",{className:"text-gray-900 font-medium",children:r==null?void 0:r.phone})]}),(r==null?void 0:r.line_id)&&e.jsxs("div",{className:"flex items-center py-3 border-b border-gray-100",children:[e.jsxs("div",{className:"flex items-center gap-3 w-24 md:w-32 text-gray-500 flex-shrink-0",children:[e.jsx(Se,{className:"w-4 h-4"}),e.jsx("span",{className:"text-sm",children:"LINE ID"})]}),e.jsx("span",{className:"text-gray-900 font-medium",children:r.line_id})]}),(r==null?void 0:r.address)&&e.jsxs("div",{className:"flex items-start py-3 border-b border-gray-100",children:[e.jsxs("div",{className:"flex items-center gap-3 w-24 md:w-32 text-gray-500 flex-shrink-0",children:[e.jsx(Ie,{className:"w-4 h-4"}),e.jsx("span",{className:"text-sm",children:t("profile.text36")})]}),e.jsx("span",{className:"text-gray-900 font-medium",children:r.address})]}),(r==null?void 0:r.country)&&e.jsxs("div",{className:"flex items-center py-3",children:[e.jsxs("div",{className:"flex items-center gap-3 w-24 md:w-32 text-gray-500 flex-shrink-0",children:[e.jsx(rt,{className:"w-4 h-4"}),e.jsxs("span",{className:"text-sm",children:[t("profile.text37"),"/",t("profile.text38")]})]}),e.jsx("span",{className:"text-gray-900 font-medium",children:((ye=u.find(s=>
1s.code===r.country))==null?void 0:ye.name_zh_tw)||((je=u.find(s=>s.code===r.country))==null?void 0:je.name_en)||r.country||t("profile.text39")})]})]}):e.jsxs("form",{onSubmit:Ge,children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs(g,{htmlFor:"email",className:"flex items-center gap-2 mb-2",children:[e.jsx(ve,{className:"w-4 h-4 text-gray-500"}),t("profile.text33")]}),e.jsx(N,{id:"email",type:"email",value:(r==null?void 0:r.email)||"",disabled:!0,className:"bg-gray-50"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:t("profile.text40")})]}),e.jsxs("div",{children:[e.jsxs(g,{htmlFor:"name",className:"flex items-center gap-2 mb-2",children:[e.jsx(we,{className:"w-4 h-4 text-gray-500"}),t("profile.text34"),!f&&e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(N,{id:"name",type:"text",value:d.name,onChange:s=>h({...d,name:s.target.value}),placeholder:t("profile.text41"),required:!f})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsxs(g,{htmlFor:"phone",className:"flex items-center gap-2 mb-2",children:[e.jsx(ke,{className:"w-4 h-4 text-gray-500"}),t("profile.text35"),!f&&e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("select",{className:"flex h-10 w-24 md:w-28 shrink-0 rounded-md border border-input bg-background px-2 md:px-3 py-2 text-sm r
1ing-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",value:b,onChange:s=>{const a=s.target.value;me(a);const n=ue(d.phone,b);h({...d,phone:a+n})},disabled:fe,children:u==null?void 0:u.map(s=>e.jsxs("option",{value:s.phone_prefix||"",children:[s.code," ",s.phone_prefix]},s.code))}),e.jsx(N,{id:"phone",type:"tel",value:ue(d.phone,b),onChange:s=>{let a=s.target.value.replace(/\D/g,"");b==="+886"&&a.startsWith("0")&&(a=a.substring(1)),h({...d,phone:b+a})},placeholder:b==="+886"?"912345678":t("profile.text5"),required:!f,inputMode:"numeric",maxLength:20,className:"flex-1"})]}),b==="+886"&&e.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["â» ",t("profile.text42"),"ï¼9XXXXXXXX (9",t("profile.text43"),"ï¼",t("profile.text44"),"0)"]})]}),e.jsxs("div",{children:[e.jsxs(g,{htmlFor:"line_id",className:"flex items-center gap-2 mb-2",children:[e.jsx(Se,{className:"w-4 h-4 text-gray-500"}),"LINE ID"]}),e.jsx(N,{id:"line_id",type:"text",value:d.line_id,onChange:s=>h({...d,line_id:s.target.value}),placeholder:`${t("profile.text45")} LINE ID`})]})]}),e.jsxs("div",{children:[e.jsxs(g,{htmlFor:"address",className:"flex items-center gap-2 mb-2",children:[e.jsx(Ie,{className:"w-4 h-4 text-gray-500"}),t("profile.text36")]}),e.jsx("textarea",{id:"address",value:d.address,onChange:s=>h({...d,address:s.target.value}),placeholder:t("profile.text46"),rows:2,className:"w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-2 text-base transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm resize-y"})]}),e.jsxs("div",{children:[e.jsxs(g,{htmlFor:"country",className:"flex items-center gap-2 mb-2",children:[t("profile.text37"),"/",t("profile.text38")]}),e.jsx(it,{countries:u,value:d.country,onValueChange:s=>h({...d,country:s}),placeholder:t("profile.text47"),disabled:fe,showIcon:!1})]})]}),e.jsxs("div",{className:"flex gap-4 justify-end mt-6 pt-6 border-t border-gray-200",children:[I&&e.jsx(p,{type:"button",variant:"outline",onClick:()=>{L(!1),r&&h({name:r.name||"",phone:r.phone||"",line_id:r.line_id||"",address:r.address||"",country:r.country||""})},children:t("profile.text32")}),e.jsx(p,{type:"submit",disabled:Z,className:"bg-[#1c1c1a] hover:bg-brand-dark text-white",children:Z?e.jsxs(e.Fragment,{children:[e.jsx(y,{className:"w-4 h-4 mr-2 animate-spin"}),t("profile.text48"),"..."]}):e.jsxs(e.Fragment,{children:[e.jsx(ut,{className:"w-4 h-4 mr-2"}),t(f?"profile.text49":"profile.text50")]})})]})]})]}),!Ue&&T.length>0&&e.jsxs("div",{className:"bg-white rounded-md p-8 mt-6 border border-blue-200",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[e.jsx("div",{className:"p-2 bg-blue-50 rounded-md",children:e.jsx(xt,{className:"w-6 h-6 text-blue-600"})}),e.jsx("h2",{className:"text-xl font-bold text-gray-900",children:t("profile.pen
1ding_invitations")}),e.jsx("span",{className:"bg-red-500 text-white text-xs font-bold rounded-md h-5 min-w-[20px] flex items-center justify-center px-1",children:T.length})]}),e.jsx("p",{className:"text-sm text-gray-500 mb-4",children:t("profile.pending_invitations_desc")}),e.jsx("div",{className:"space-y-3",children:T.map(s=>{var a,n;return e.jsx("div",{className:"bg-blue-50 rounded-md p-5 border border-blue-200",children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:((a=s.company)==null?void 0:a.company_name)||t("profile.text61")}),((n=s.company)==null?void 0:n.brand_name)&&e.jsxs("p",{className:"text-sm text-gray-600 mt-0.5",children:[t("profile.text62"),"ï¼",s.company.brand_name]}),s.position==="pt"&&e.jsx("p",{className:"text-sm text-blue-600 font-medium mt-1",children:t("profile.invitation_as_pt")}),e.jsx("p",{className:"text-xs text-gray-400 mt-1",children:J(new Date(s.created_at),"yyyy/MM/dd")})]}),e.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[e.jsxs(p,{size:"sm",variant:"outline",className:"text-red-600 border-red-200 hover:bg-red-50",disabled:D===s.id,onClick:()=>Ke(s.id),children:[D===s.id?e.jsx(y,{className:"w-4 h-4 animate-spin"}):e.jsx(Le,{className:"w-4 h-4 mr-1"}),t("profile.invitation_reject")]}),e.jsxs(p,{size:"sm",className:"bg-green-600 hover:bg-green-700 text-white",disabled:D===s.id,onClick:()=>We(s.id),children:[D===s.id?e.jsx(y,{className:"w-4 h-4 animate-spin"}):e.jsx(at,{className:"w-4 h-4 mr-1"}),t("profile.invitation_accept")]})]})]})},s.id)})})]}),(((be=r==null?void 0:r.identities)==null?void 0:be.includes("vendor"))||((Ne=r==null?void 0:r.identities)==null?void 0:Ne.includes("organizer")))&&e.jsxs(P,{children:[e.jsx("h2",{className:"mb-2 text-base font-bold text-ink",children:t("profile.text60")}),$e?e.jsxs("div",{className:"flex items-center justify-center py-8",children:[e.jsx(y,{className:"w-6 h-6 animate-spin text-gray-400"}),e.jsxs("span",{className:"ml-3 text-gray-500",children:[t("profile.text17"),"..."]})]}):re.filter(s=>s.status==="approved").length>0?e.jsx("div",{children:re.filter(s=>s.status==="approved").map(s=>{var a,n,l;return e.jsxs("div",{className:"flex items-start justify-between gap-4 border-t border-divider py-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h3",{className:"text-[15px] font-semibold text-ink",children:((a=s.company)==null?void 0:a.company_name)||t("profile.text61")}),e.jsxs("div",{className:"mt-1 flex flex-wrap gap-x-3 gap-y-1 text-[13px] text-ink-muted",children:[s.position==="pt"&&e.jsx("span",{children:t("profile.text70")}),((n=s.company)==null?void 0:n.brand_name)&&e.jsxs("span",{children:[t("profile.text62"),"ï¼",s.company.brand_name]}),((l=s.company)==null?void 0:l.tax_id)&&e.jsxs("span",{children:[t("profile.text63"),"ï¼",s.company.tax_id]})]})]}),e.jsx("span",{className:"shrink-0 rounded-md bg-[#eaf3ec] px-2 py-0.5 text-xs font-semibold text-[#2f6b3a]",children:t("profile.text64")})]},s.id)})}):null]}),r&&f&&e.jsxs(P,{children:[e.jsx("h2",{className:"mb-4 text-base font-bold text-ink",children:t("profile.text65")}),e.jsxs("dl",{className:"grid grid-cols-[minmax(0,1fr)_minmax(0,1fr)]",children:[e.jsxs("div",{className:"contents",children:[e.jsx("dt",{className:"border-t border-divider py-3 text-[13px] text-ink-muted",children:t("profile.text66")}),e.jsx("dd",{className:"border-t border-divider py-3 text-right text-sm font-medium text-ink",children:(()=>{const s=r.identities||[],a=[];return s.includes("organizer")&&a.push(t("profile.text68")),s.includes("vendor")&&a.push(t("profile.text69")),s.includes("pt")&&a.push(t("profile.text70")),a.length>0?a.join("ã"):t("profile.text67")})()})]}),e.jsxs("div",{className:"contents",children:[e.jsx("dt",{className:"border-t border-divider py-3 text-[13px] text-ink-muted",children:t("profile.text71")}),e.jsx("dd",{className:"border-t border-divider py-3 text-right text-sm font-medium text-ink",children:r.status==="active"?t("profile.text72"):r.status==="suspended"?t("profile.text73"):r.status==="banned"?t("profile.text74"):r.status==="inactive"?t("profile.text75"):t("profile.text76")})]}),r.created_at&&e.jsxs("div",{className:"contents",children:[e.jsx("dt",{className:"border-t border-divider py-3 text-[13px] text-ink-muted",children:t("profile.text77")}),e.jsx("dd",{className:"border-t border-divider py-3 text-right text-sm font-medium text-ink tabular-nums",children:J(new Date(r.created_at),"yyyy/MM/dd")})]})]})]}),e.jsxs(P,{children:[e.jsx("h2",{className:"text-base font-bold text-ink",children:t("innerPages.consents.title")}),e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-muted",children:t("innerPages.consents.description")}),_.isPending?e.jsxs("div",{className:"flex items-center justify-center gap-2 py-8 text-sm text-ink-muted",children:[e.jsx(y,{className:"size-4 animate-spin"}),t("common.loading")]}):_.isError?e.jsxs("div",{className:"mt-4 rounded-md bg-site-bg p-4 text-sm text-ink-secondary",children:[e.jsx("p",{children:t("innerPages.consents.loadFailed")}),e.jsx(p,{variant:"ghost",size:"sm",className:"mt-2",onClick:()=>_.refetch(),children:t("common.retry")})]}):_.data.data.length===0?e.jsx("p",{className:"mt-5 border-t border-divider pt-5 text-sm text-ink-muted",children:t("innerPages.consents.empty")}):e.jsx("div",{className:"mt-4",children:_.data.data.map(s=>e.jsxs("div",{className:"flex flex-col gap-3 border-t border-divider py-4 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"text-[15px] font-semibold text-ink",children:s.client_name}),e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:s.scopes.map(He).join(C==="en"?", ":"ã")}),e.jsx("p",{className:"mt-1 text-xs text-ink-muted tabular-nums",children:t("innerPages.consents.grantedAt",{time:J(new Date(s.granted_at),"yyyy/MM/dd HH:mm",{locale:pt(C)})})})]}),e.jsxs(p,{variant:"outline",size:"sm",className:"w-full shrink-0 sm:w-auto",disabled:z.isPending,onClick:()=>Qe(s.id,s.client_name),children:[z.isPending&&z.variables===s.id?e.jsx(y,{className:"size-4 animate-spin"}):null,t("innerPages.consents.revoke")]})]},s.id))})]}),r&&f&&e.jsxs(P,{id:"settings",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h2",{className:"flex items-center gap-2 text-base font-bold text-ink",children:[e.jsx(gt,{className:"w-5 h-5 text-gray-500"}),t("profile.text78")]}),!le&&e.jsxs(p,{type:"button",variant:"secondary",size:"sm",onClick:()=>$(!0),className:"gap-2",children:[e.jsx(Ce,{className:"w-4 h-4"}),t("profile.text79")]})]}),le?e.jsxs("form",{onSubmit:Oe,className:"space-y-4",children:[de&&e.jsx("div",{className:"bg-red-50 border border-red-200 rounded-md p-3",children:e.jsx("p",{className:"text-sm text-red-600",children:de})}),e.jsxs("div",{children:[e.jsx(g,{htmlFor:"currentPassword",className:"mb-2",children:t("profile.text82")}),e.jsxs("div",{className:"relative",children:[e.jsx(N,{id:"currentPassword",type:U?"text":"password",value:x.currentPassword,onChange:s=>v({...x,currentPassword:s.target.value}),placeholder:t("profile.text82"),className:"pr-10"}),e.jsx("button",{type:"button",onClick:()=>Ve(!U),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600",children:U?e.jsx(G,{className:"h-5 w-5"}):e.jsx(O,{className:"h-5 w-5"})})]})]}),e.jsxs("div",{children:[e.jsx(g,{htmlFor:"newPassword",className:"mb-2",children:t("profile.text83")}),e.jsxs("div",{className:"relative",children:[e.jsx(N,{id:"newPassword",type:V?"text":"password",value:x.newPassword,onChange:s=>v({...x,newPassword:s.target.value}),placeholder:`${t("profile.text10")}ï¼${t("profile.text84")} 8 ${t("profile.text12")}ï¼`,className:"pr-10"}),e.jsx("button",{type:"button",onClick:()=>qe(!V),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600",children:V?e.jsx(G,{className:"h-5 w-5"}):e.jsx(O,{className:"h-5 w-5"})})]})]}),e.jsxs("div",{children:[e.jsx(g,{htmlFor:"confirmNewPassword",className:"mb-2",children:t("profile.text85")}),e.jsxs("div",{className:"relative",children:[e.jsx(N,{id:"confirmNewPassword",type:q?"text":"password",value:x.confirmPassword,onChange:s=>v({...x,confirmPassword:s.target.value}),placeholder:t("profile.text86"),className:"pr-10"}),e.jsx("button",{type:"button",onClick:()=>Be(!q),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600",children:q?e.jsx(G,{className:"h-5 w-5"}):e.jsx(O,{className:"h-5 w-5"})})]})]}),e.jsxs("div",{className:"flex gap-4 justify-end pt-4 border-t border-gray-200",children:[e.jsx(p,{type:"button",variant:"outline",onClick:()=>{$(!1),v({currentPassword:"",newPassword:"",confirmPassword:""}),j(null)},children:t("profile.text32")}),e.jsx(p,{type:"submit",disabled:ce,className:"bg-[#1c1c1a] hover:bg-brand-dark text-white",children:ce?e.jsxs(e.Fragment,{children:[e.jsx(y,{className:"w-4 h-4 mr-2 animate-spin"}),t("profile.text87"),"..."]}):t("profile.text88")})]})]}):e.jsxs("p",{className:"text-sm text-gray-600",children:[t("profile.text80"),"ã",t("profile.text79"),"ã",t("profile.text81"),"ã"]})]})]})})})):null}export{js as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.