/
opt
/
canhelp
/
apps
/
web
/
.next
/
static
/
chunks
/
app
/
profile
/
/opt/canhelp/apps/web/.next/static/chunks/app/profile
mkdir
upload
Name
Size
Mode
Actions
page-ae7382171a8281f4.js
90490
0644
edit
dl
rm
Edit:
/opt/canhelp/apps/web/.next/static/chunks/app/profile/page-ae7382171a8281f4.js
(90490B)
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6636],{1511:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>x});var l=s(4568),r=s(7620),a=s(7541),n=s(1592),i=s(9906),o=s(2982),c=s(5940);function d(e){var t,s,a,n,d,u,x,m,p;let{card:g,isOpen:h,onToggle:b,onUpdate:f,onDelete:y,categories:v,locationTree:j,catLocale:N,locale:w,hasPriceList:k,visibilityIssues:_=[],moderationNotice:S=null}=e,{t:C}=(0,i.Y)(),L=_.length>0,[A,E]=(0,r.useState)("main"),[T,D]=(0,r.useState)(!1),[M,P]=(0,r.useState)(!1),[B,F]=(0,r.useState)(g.title),[W,z]=(0,r.useState)(null!=(t=g.descriptionEl)?t:""),[q,O]=(0,r.useState)(null!=(s=g.descriptionEn)?s:""),[U,R]=(0,r.useState)(null!=(a=g.descriptionRu)?a:""),[H,V]=(0,r.useState)(null!=(n=g.descriptionUk)?n:""),[I,J]=(0,r.useState)(null!=(d=g.skills)?d:[]),[K,Y]=(0,r.useState)(""),[G,Z]=(0,r.useState)(null!=(u=g.categories)?u:[]),[Q,X]=(0,r.useState)(null!=(x=g.locations)?x:[]),[$,ee]=(0,r.useState)(null!=(m=g.publicationStatus)?m:g.isActive?"active":"inactive"),[et,es]=(0,r.useState)([]),[el,er]=(0,r.useState)(null!=(p=g.portfolio)?p:[]),[ea,en]=(0,r.useState)(!1),[ei,eo]=(0,r.useState)(null),[ec,ed]=(0,r.useState)(""),[eu,ex]=(0,r.useState)(""),em=(0,r.useRef)(null),[ep,eg]=(0,r.useState)([]),[eh,eb]=(0,r.useState)(!1),[ef,ey]=(0,r.useState)(""),[ev,ej]=(0,r.useState)(null),[eN,ew]=(0,r.useState)({name:"",description:"",price:"",unit:""}),[ek,e_]=(0,r.useState)(null),[eS,eC]=(0,r.useState)("");async function eL(){if(!ef.trim())return;let e=await o.vD(g.id,{title:ef.trim(),locale:["el","en","ru","uk"].includes(w)?w:"el",autoTranslate:!0});eg(t=>[...t,e]),ey("")}async function eA(e){await o.Ic(e),eg(t=>t.filter(t=>t.id!==e))}async function eE(e){let t=await o.oD(e,{title:eS.trim(),locale:["el","en","ru","uk"].includes(w)?w:"el",autoTranslate:!0});eg(s=>s.map(s=>s.id===e?{...s,title:t.title}:s)),e_(null)}async function eT(e){if(!eN.name.trim())return;let t=await o.Z2(e,{name:eN.name.trim(),description:eN.description.trim()||null,price:eN.price.trim()||null,unit:eN.unit.trim()||null,locale:["el","en","ru","uk"].includes(w)?w:"el",autoTranslate:!0});eg(s=>s.map(s=>s.id===e?{...s,items:[...s.items,t]}:s)),ew({name:"",description:"",price:"",unit:""}),ej(null)}async function eD(e,t){await o.U9(e),eg(s=>s.map(s=>s.id===t?{...s,items:s.items.filter(t=>t.id!==e)}:s))}async function eM(){D(!0);try{let e=["el","en","ru","uk"].includes(w)?w:"el",t=e.charAt(0).toUpperCase()+e.slice(1),s={el:W,en:q,ru:U,uk:H}[e]||null,l=await o.zc(g.id,{title:B,["description".concat(t)]:s,descriptionLocale:e,autoTranslate:!!s,skills:I,categories:G,locations:Q,publicationStatus:$,isActive:"active"===$});f({...l,portfolio:el}),P(!0),setTimeout(()=>P(!1),2e3)}catch(e){}finally{D(!1)}}async function eP(e){ee(e);try{await o.zc(g.id,{publicationStatus:e,isActive:"active"===e})}catch(e){}}function eB(e){let t=e.trim();t&&!I.includes(t)&&J([...I,t]),Y("")}function eF(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];G.includes(e)?Z(G.filter(s=>s!==e&&!t.includes(s))):Z([...new Set([...G,e,...t])])}function eW(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];Q.includes(e)?X(Q.filter(s=>s!==e&&!t.includes(s))):X([...new Set([...Q,e,...t])])}async function ez(e){var t;let s=null==(t=e.target.files)?void 0:t[0];if(s){en(!0);try{let e=new FormData;e.append("file",s),e.append("cardId",g.id);let t=await fetch("".concat("https://api.canhelp.gr","/api/portfolio"),{method:"POST",credentials:"include",body:e});if(!t.ok)throw Error("Upload failed");let l=await t.json(),r=[...el,l];er(r),f({...g,portfolio:r})}catch(e){}finally{en(!1),em.current&&(em.current.value="")}}}async function eq(e){try{await o.zB(e);let t=el.filter(t=>t.id!==e);er(t),f({...g,portfolio:t})}catch(e){}}async function eO(e){try{let t=await o.hl(e,{title:ec,description:eu});er(s=>s.map(s=>s.id===e?t:s)),eo(null)}catch(e){}}(0,r.useEffect)(()=>{"pricelist"!==A||ep.length>0||eh||(eb(!0),o.Ck(g.id,w).then(eg).catch(()=>{}).finally(()=>eb(!1)))},[A,w]),(0,r.useEffect)(()=>{"skills"===A&&o.rl(G.length>0?G:void 0).then(es).catch(()=>es([]))},[G,A]);let eU=[{id:"main",label:C("profile.card.tab.main")},{id:"categories",label:C("profile.card.tab.categories")},{id:"skills",label:C("profile.card.tab.skills")},{id:"geography",label:C("profile.card.tab.geography")},{id:"pricelist",label:C("profile.card.tab.pricelist"),hidden:!k},{id:"portfolio",label:C("profile.card.tab.portfolio")}],eR="pending"===$?{title:C("profile.card.review_pending","Pending approval"),body:C("profile.card.review_pending_hint","Your card is being reviewed by the admin team."),tone:"amber"}:null,eH=null!=S?S:eR;return(0,l.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-gray-100 ".concat(L?"bg-amber-50":""),children:[(0,l.jsxs)("button",{type:"button",onClick:b,className:"flex-1 flex items-center gap-3 text-left",children:[(0,l.jsx)("span",{className:"text-sm font-semibold text-gray-800 flex-1",children:B||g.title}),L&&(0,l.jsx)("span",{className:"inline-flex items-center justify-center w-5 h-5 rounded-full bg-amber-500 text-white text-xs font-bold",title:C("profile.card.visibility_issue","Card is not shown in offers"),children:"!"}),(0,l.jsx)("span",{className:"text-gray-400 text-xs",children:h?"▲":"▼"})]}),(0,l.jsx)("button",{type:"button",onClick:()=>eP("active"===$||"pending"===$?"inactive":"pending"),className:"px-3 py-1.5 rounded-lg text-xs font-medium whitespace-nowrap ".concat("active"===$?"bg-red-50 text-red-700 hover:bg-red-100":"pending"===$?"bg-amber-50 text-amber-700 hover:bg-amber-100":"bg-green-50 text-green-700 hover:bg-green-100"),children:"active"===$?C("profile.card.unpublish","Unpublish"):"pending"===$?C("profile.card.withdraw_review","Withdraw request"):C("profile.card.submit_review","Submit for review")}),(0,l.jsx)("button",{type:"button",onClick:y,className:"text-red-400 hover:text-red-600 text-sm px-1 flex-shrink-0",title:C("profile.card.delete"),children:"\uD83D\uDDD1"})]}),h&&(0,l.jsxs)("div",{children:[L&&(0,l.jsxs)("div",{className:"mx-4 mt-4 mb-2 rounded-lg border border-amber-300 bg-amber-50 p-3",children:[(0,l.jsx)("p",{className:"text-xs font-semibold text-amber-900",children:C("profile.card.visibility_issue","Card is not shown in offers")}),(0,l.jsx)("ul",{className:"mt-1.5 list-disc pl-4 text-xs text-amber-900 space-y-0.5",children:_.map(e=>(0,l.jsx)("li",{children:e},e))})]}),eH&&(0,l.jsxs)("div",{className:"mx-4 mt-4 mb-2 rounded-lg border p-3 ".concat("green"===eH.tone?"border-green-300 bg-green-50":"red"===eH.tone?"border-red-300 bg-red-50":"border-amber-300 bg-amber-50"),children:[(0,l.jsx)("p",{className:"text-xs font-semibold ".concat("green"===eH.tone?"text-green-900":"red"===eH.tone?"text-red-900":"text-amber-900"),children:eH.title}),eH.body&&(0,l.jsx)("p",{className:"mt-1 text-xs ".concat("green"===eH.tone?"text-green-800":"red"===eH.tone?"text-red-800":"text-amber-800"),children:eH.body})]}),(0,l.jsx)("div",{className:"flex overflow-x-auto border-b border-gray-100 bg-gray-50 gap-0",children:eU.filter(e=>!e.hidden).map(e=>(0,l.jsx)("button",{type:"button",onClick:()=>E(e.id),className:"px-4 py-2.5 text-xs font-medium whitespace-nowrap border-b-2 transition -mb-px ".concat(A===e.id?"border-green-500 text-green-600 bg-white":"border-transparent text-gray-500 hover:text-gray-700"),children:e.label},e.id))}),(0,l.jsxs)("div",{className:"p-4",children:["main"===A&&(0,l.jsxs)("div",{className:"space-y-3",children:[(0,l.jsx)("input",{value:B,onChange:e=>F(e.target.value),maxLength:200,placeholder:C("profile.cards.new_title"),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"}),(()=>{let e=["el","en","ru","uk"].includes(w)?w:"el",t={el:[W,z],en:[q,O],ru:[U,R],uk:[H,V]},[s,r]=t[e],a={el:"\uD83C\uDDEC\uD83C\uDDF7",en:"\uD83C\uDDEC\uD83C\uDDE7",ru:"\uD83C\uDDF7\uD83C\uDDFA",uk:"\uD83C\uDDFA\uD83C\uDDE6"},n=["el","en","ru","uk"].filter(t=>t!==e),i=n.some(e=>t[e][0]);return(0,l.jsxs)("div",{children:[(0,l.jsxs)("label",{className:"flex items-center gap-1.5 text-xs font-medium text-gray-500 mb-1",children:[a[e]," ",C("profile.card.description","Description")]}),(0,l.jsx)("textarea",{value:s,onChange:e=>r(e.target.value),rows:4,maxLength:2e3,placeholder:C("profile.bio.placeholder"),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400 resize-none"}),s&&(0,l.jsx)("p",{className:"text-xs text-gray-400 mt-1",children:C("profile.card.desc_auto_translate","Will be automatically translated into other languages on save")}),i&&(0,l.jsxs)("div",{className:"flex items-center gap-1.5 mt-1.5",children:[(0,l.jsx)("span",{className:"text-xs text-gray-400",children:C("profile.card.desc_translated","Translations available:")}),n.map(e=>(0,l.jsx)("span",{className:"text-xs px-1.5 py-0.5 rounded-full ".concat(t[e][0]?"bg-green-50 text-green-600":"bg-gray-100 text-gray-400"),children:a[e]},e))]})]})})()]}),"skills"===A&&(0,l.jsxs)("div",{className:"space-y-3",children:[I.length>0&&(0,l.jsx)("div",{className:"flex flex-wrap gap-2",children:I.map(e=>(0,l.jsxs)("span",{className:"flex items-center gap-1.5 bg-green-50 text-green-700 text-sm px-3 py-1 rounded-full",children:[e,(0,l.jsx)("button",{type:"button",onClick:()=>J(I.filter(t=>t!==e)),className:"text-gray-400 hover:text-green-700 leading-none",children:"\xd7"})]},e))}),(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)("input",{value:K,onChange:e=>Y(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),eB(K))},placeholder:C("profile.card.skill.add"),className:"flex-1 border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"}),(0,l.jsx)("button",{type:"button",onClick:()=>eB(K),className:"px-3 py-2 bg-gray-100 hover:bg-gray-200 rounded-lg text-sm font-medium",children:"+"})]}),et.length>0&&(0,l.jsx)("div",{className:"flex flex-wrap gap-1.5",children:et.map(e=>{var t;return null!=(t=e.names[N])?t:e.names.el}).filter((e,t,s)=>s.indexOf(e)===t&&!I.includes(e)).slice(0,16).map(e=>(0,l.jsxs)("button",{type:"button",onClick:()=>eB(e),className:"text-xs px-2.5 py-1 border border-gray-200 rounded-full text-gray-500 hover:border-green-400 hover:text-green-600 transition",children:["+ ",e]},e))})]}),"categories"===A&&(0,l.jsx)("div",{className:"space-y-3",children:v.map(e=>{var t,s,r,a,n;let i=null!=(a=null!=(r=null==(t=e.names)?void 0:t[N])?r:null==(s=e.names)?void 0:s.el)?a:e.slug,o=null!=(n=e.children)?n:[],d=o.map(e=>e.slug);return(0,l.jsxs)("div",{children:[(0,l.jsxs)("label",{className:"flex items-center gap-2.5 cursor-pointer",children:[(0,l.jsx)("input",{type:"checkbox",checked:G.includes(e.slug),onChange:()=>eF(e.slug,d),className:"w-4 h-4 rounded border-gray-300 text-green-600 focus:ring-blue-400"}),(0,l.jsxs)("span",{className:"text-sm font-medium text-gray-800 inline-flex items-center gap-1",children:[e.icon&&(0,l.jsx)(c.Ez,{icon:e.icon,alt:i,className:(0,c.V)(e.icon)?"h-4 w-4 object-contain":"text-sm leading-none",fallback:"\uD83D\uDCE6"}),i]})]}),o.length>0&&(0,l.jsx)("div",{className:"ml-6 mt-2 space-y-2",children:o.map(e=>{var t,s,r,a;let n=null!=(a=null!=(r=null==(t=e.names)?void 0:t[N])?r:null==(s=e.names)?void 0:s.el)?a:e.slug;return(0,l.jsxs)("label",{className:"flex items-center gap-2.5 cursor-pointer",children:[(0,l.jsx)("input",{type:"checkbox",checked:G.includes(e.slug),onChange:()=>eF(e.slug),className:"w-4 h-4 rounded border-gray-300 text-green-600 focus:ring-blue-400"}),(0,l.jsx)("span",{className:"text-sm text-gray-600",children:n})]},e.id)})})]},e.id)})}),"geography"===A&&(0,l.jsx)("div",{className:"space-y-3",children:j.map(e=>{var t,s,r,a,n;let i=null!=(a=null!=(r=null==(t=e.names)?void 0:t[N])?r:null==(s=e.names)?void 0:s.el)?a:e.slug,o=null!=(n=e.children)?n:[],c=o.map(e=>e.slug);return(0,l.jsxs)("div",{children:[(0,l.jsxs)("label",{className:"flex items-center gap-2.5 cursor-pointer",children:[(0,l.jsx)("input",{type:"checkbox",checked:Q.includes(e.slug),onChange:()=>eW(e.slug,c),className:"w-4 h-4 rounded border-gray-300 text-green-600 focus:ring-blue-400"}),(0,l.jsx)("span",{className:"text-sm font-medium text-gray-800",children:i})]}),o.length>0&&(0,l.jsx)("div",{className:"ml-6 mt-2 space-y-2",children:o.map(e=>{var t,s,r,a;let n=null!=(a=null!=(r=null==(t=e.names)?void 0:t[N])?r:null==(s=e.names)?void 0:s.el)?a:e.slug;return(0,l.jsxs)("label",{className:"flex items-center gap-2.5 cursor-pointer",children:[(0,l.jsx)("input",{type:"checkbox",checked:Q.includes(e.slug),onChange:()=>eW(e.slug),className:"w-4 h-4 rounded border-gray-300 text-green-600 focus:ring-blue-400"}),(0,l.jsx)("span",{className:"text-sm text-gray-600",children:n})]},e.id)})})]},e.id)})}),"pricelist"===A&&(0,l.jsx)("div",{className:"space-y-4",children:eh?(0,l.jsx)("div",{className:"text-center py-6 text-gray-400 text-sm",children:C("common.loading","Loading...")}):(0,l.jsxs)(l.Fragment,{children:[0===ep.length&&(0,l.jsx)("div",{className:"text-center py-6 text-gray-400 text-sm border-2 border-dashed border-gray-200 rounded-xl",children:C("profile.card.pricelist.empty")}),ep.map(e=>(0,l.jsxs)("div",{className:"border border-gray-200 rounded-xl overflow-hidden",children:[(0,l.jsx)("div",{className:"flex items-center gap-2 bg-gray-50 px-4 py-2.5 border-b border-gray-200",children:ek===e.id?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("input",{value:eS,onChange:e=>eC(e.target.value),className:"flex-1 border border-gray-300 rounded-lg px-3 py-1.5 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400",onKeyDown:t=>{"Enter"===t.key&&eE(e.id)},autoFocus:!0}),(0,l.jsx)("button",{type:"button",onClick:()=>eE(e.id),className:"px-3 py-1.5 bg-green-600 text-white rounded-lg text-xs font-medium hover:bg-green-700",children:C("profile.card.pricelist.save_group")}),(0,l.jsx)("button",{type:"button",onClick:()=>e_(null),className:"px-2 py-1.5 text-gray-500 hover:text-gray-700 text-xs",children:"✕"})]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("span",{className:"flex-1 font-semibold text-sm text-gray-800",children:e.title}),(0,l.jsx)("button",{type:"button",onClick:()=>{e_(e.id),eC(e.title)},className:"text-gray-400 hover:text-green-600 text-xs px-2 py-1 rounded hover:bg-green-50",children:"✏️"}),(0,l.jsx)("button",{type:"button",onClick:()=>eA(e.id),className:"text-gray-400 hover:text-red-500 text-xs px-2 py-1 rounded hover:bg-red-50",children:C("profile.card.pricelist.delete_group")})]})}),(0,l.jsx)("div",{className:"divide-y divide-gray-100",children:e.items.map(t=>(0,l.jsxs)("div",{className:"flex items-center gap-3 px-4 py-2.5 text-sm group",children:[(0,l.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,l.jsx)("p",{className:"font-medium text-gray-800 truncate",children:t.name}),t.description&&(0,l.jsx)("p",{className:"text-xs text-gray-500 truncate",children:t.description})]}),(t.price||t.unit)&&(0,l.jsxs)("span",{className:"text-green-700 font-semibold text-sm whitespace-nowrap",children:[t.price?"€".concat(t.price):"",t.unit?" ".concat(t.unit):""]}),(0,l.jsx)("button",{type:"button",onClick:()=>eD(t.id,e.id),className:"opacity-0 group-hover:opacity-100 text-red-400 hover:text-red-600 text-xs px-1 transition",children:C("profile.card.pricelist.delete_item")})]},t.id))}),ev===e.id?(0,l.jsxs)("div",{className:"p-3 bg-green-50 border-t border-green-100 space-y-2",children:[(0,l.jsx)("input",{placeholder:C("profile.card.pricelist.item_name"),value:eN.name,onChange:e=>ew(t=>({...t,name:e.target.value})),className:"w-full border border-gray-300 rounded-lg px-3 py-1.5 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"}),(0,l.jsx)("input",{placeholder:C("profile.card.pricelist.item_desc"),value:eN.description,onChange:e=>ew(t=>({...t,description:e.target.value})),className:"w-full border border-gray-300 rounded-lg px-3 py-1.5 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"}),(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)("input",{placeholder:C("profile.card.pricelist.item_price"),value:eN.price,onChange:e=>ew(t=>({...t,price:e.target.value})),className:"w-28 border border-gray-300 rounded-lg px-3 py-1.5 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"}),(0,l.jsx)("input",{placeholder:C("profile.card.pricelist.item_unit"),value:eN.unit,onChange:e=>ew(t=>({...t,unit:e.target.value})),className:"flex-1 border border-gray-300 rounded-lg px-3 py-1.5 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"})]}),(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)("button",{type:"button",onClick:()=>eT(e.id),className:"px-4 py-1.5 bg-green-600 text-white rounded-lg text-sm font-medium hover:bg-green-700",children:C("profile.card.pricelist.save_item")}),(0,l.jsx)("button",{type:"button",onClick:()=>{ej(null),ew({name:"",description:"",price:"",unit:""})},className:"px-3 py-1.5 text-gray-500 hover:text-gray-700 text-sm",children:"✕"})]})]}):(0,l.jsx)("div",{className:"px-4 py-2 border-t border-gray-100",children:(0,l.jsxs)("button",{type:"button",onClick:()=>ej(e.id),className:"text-green-600 hover:text-gray-800 text-sm font-medium",children:["+ ",C("profile.card.pricelist.add_item")]})})]},e.id)),(0,l.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,l.jsx)("input",{placeholder:C("profile.card.pricelist.group_title"),value:ef,onChange:e=>ey(e.target.value),onKeyDown:e=>{"Enter"===e.key&&eL()},className:"flex-1 border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"}),(0,l.jsx)("button",{type:"button",onClick:eL,className:"px-4 py-2 bg-green-600 hover:bg-green-700 text-white rounded-lg text-sm font-medium",children:C("profile.card.pricelist.add_group")})]})]})}),"portfolio"===A&&(0,l.jsxs)("div",{className:"space-y-3",children:[el.length<20&&(0,l.jsxs)("div",{children:[(0,l.jsx)("button",{type:"button",onClick:()=>{var e;return null==(e=em.current)?void 0:e.click()},disabled:ea,className:"flex items-center gap-2 px-4 py-2 bg-green-600 hover:bg-green-700 text-white rounded-lg text-sm font-medium disabled:opacity-50",children:ea?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("span",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),C("profile.card.photo.uploading")]}):(0,l.jsxs)(l.Fragment,{children:["\uD83D\uDCF7 ",C("profile.card.photo.add")]})}),(0,l.jsx)("input",{ref:em,type:"file",accept:"image/jpeg,image/png,image/webp",className:"hidden",onChange:ez})]}),0===el.length?(0,l.jsx)("div",{className:"text-center py-8 text-gray-400 text-sm border-2 border-dashed border-gray-200 rounded-xl",children:C("profile.card.photo.empty")}):(0,l.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3",children:el.map(e=>{var t;return(0,l.jsxs)("div",{className:"group relative rounded-xl overflow-hidden border border-gray-200 bg-gray-50",children:[(0,l.jsx)("img",{src:e.imageUrl,alt:null!=(t=e.title)?t:"",className:"w-full aspect-square object-cover"}),(0,l.jsxs)("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/50 transition-all flex flex-col justify-between p-2",children:[(0,l.jsx)("button",{type:"button",onClick:()=>eq(e.id),className:"self-end opacity-0 group-hover:opacity-100 transition w-7 h-7 rounded-full bg-red-500 text-white text-sm flex items-center justify-center hover:bg-red-600",children:"\xd7"}),(0,l.jsxs)("button",{type:"button",onClick:()=>{var t,s;eo(e),ed(null!=(t=e.title)?t:""),ex(null!=(s=e.description)?s:"")},className:"opacity-0 group-hover:opacity-100 transition text-xs text-white bg-black/50 hover:bg-black/70 rounded-lg px-2 py-1",children:["✏️ ",C("profile.card.item.edit")]})]}),e.title&&(0,l.jsx)("div",{className:"px-2 py-1.5",children:(0,l.jsx)("p",{className:"text-xs font-medium text-gray-700 truncate",children:e.title})})]},e.id)})})]}),"portfolio"!==A&&"pricelist"!==A&&(0,l.jsxs)("div",{className:"flex items-center gap-3 mt-4 pt-4 border-t border-gray-100",children:[(0,l.jsx)("button",{type:"button",disabled:T,onClick:eM,className:"px-5 py-2 bg-green-600 hover:bg-green-700 text-white rounded-lg text-sm font-semibold disabled:opacity-50",children:T?"...":C("profile.card.save")}),M&&(0,l.jsxs)("span",{className:"text-sm text-green-600",children:["✓ ",C("profile.card.saved")]})]})]})]}),ei&&(0,l.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 px-4",children:(0,l.jsxs)("div",{className:"bg-white rounded-2xl shadow-xl p-6 w-full max-w-md",children:[(0,l.jsx)("h3",{className:"font-semibold text-gray-800 mb-4",children:C("profile.card.item.edit")}),(0,l.jsx)("img",{src:ei.imageUrl,alt:"",className:"w-full h-40 object-cover rounded-xl mb-4"}),(0,l.jsxs)("div",{className:"space-y-3",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:C("profile.card.item.title")}),(0,l.jsx)("input",{value:ec,onChange:e=>ed(e.target.value),maxLength:200,className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:C("profile.card.item.desc")}),(0,l.jsx)("textarea",{value:eu,onChange:e=>ex(e.target.value),rows:3,maxLength:1e3,className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400 resize-none"})]})]}),(0,l.jsxs)("div",{className:"flex gap-3 mt-5",children:[(0,l.jsx)("button",{type:"button",onClick:()=>eO(ei.id),className:"flex-1 bg-green-600 hover:bg-green-700 text-white py-2 rounded-lg text-sm font-medium",children:C("profile.card.item.save")}),(0,l.jsx)("button",{type:"button",onClick:()=>eo(null),className:"flex-1 bg-gray-100 hover:bg-gray-200 text-gray-700 py-2 rounded-lg text-sm font-medium",children:C("profile.card.item.cancel")})]})]})})]})}function u(e){let{categories:t,locationTree:s,loaded:a,onLoad:n,settings:i,saving:o,saved:c,onSave:d,t:u,catLocale:x}=e,{useEffect:m,useState:p}={useEffect:r.useEffect,useState:r.useState},[g,h]=p(!1),[b,f]=p(""),[y,v]=p(""),[j,N]=p(""),[w,k]=p(""),[_,S]=p(""),[C,L]=p([]),[A,E]=p([]);if(m(()=>{n()},[]),m(()=>{var e,t,s;i&&(h(i.enabled),f(null!=i.minBudget?String(i.minBudget):""),v(null!=i.maxBudget?String(i.maxBudget):""),N(null!=i.defaultPrice?String(i.defaultPrice):""),k(null!=(e=i.defaultMessage)?e:""),S(null!=i.maxAutoOffersPerDay?String(i.maxAutoOffersPerDay):""),L(null!=(t=i.categories)?t:[]),E(null!=(s=i.locations)?s:[]))},[i]),!a)return(0,l.jsx)("div",{className:"text-center py-10 text-white/60",children:u("common.loading")});let T=[];return!function e(t){for(let l of t){var s;T.push({id:l.id,name:l.name}),(null==(s=l.children)?void 0:s.length)&&e(l.children)}}(s),(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.jsx)("div",{className:"bg-white rounded-xl border border-gray-200 p-5",children:(0,l.jsxs)("label",{className:"flex items-center justify-between cursor-pointer",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium text-gray-800",children:u("auto_response.title","Auto response")}),(0,l.jsx)("p",{className:"text-xs text-gray-400 mt-0.5",children:u("auto_response.desc","Automatically respond to matching tasks")})]}),(0,l.jsx)("button",{type:"button",onClick:()=>h(e=>!e),className:"relative inline-flex h-6 w-11 items-center rounded-full transition-colors ".concat(g?"bg-green-500":"bg-gray-300"),children:(0,l.jsx)("span",{className:"inline-block h-4 w-4 transform rounded-full bg-white shadow transition-transform ".concat(g?"translate-x-6":"translate-x-1")})})]})}),(0,l.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 p-5 space-y-4",children:[(0,l.jsx)("h3",{className:"font-medium text-gray-800 text-sm",children:u("auto_response.budget_range","Task budget")}),(0,l.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:u("auto_response.min_budget","Min €")}),(0,l.jsx)("input",{type:"number",min:"0",value:b,onChange:e=>f(e.target.value),placeholder:"0",className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:u("auto_response.max_budget","Max €")}),(0,l.jsx)("input",{type:"number",min:"0",value:y,onChange:e=>v(e.target.value),placeholder:"∞",className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"})]})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:u("auto_response.default_price","Default price €")}),(0,l.jsx)("input",{type:"number",min:"0",value:j,onChange:e=>N(e.target.value),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:u("auto_response.max_per_day","Max auto-offers/day")}),(0,l.jsx)("input",{type:"number",min:"1",max:"50",value:_,onChange:e=>S(e.target.value),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"})]})]}),(0,l.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 p-5",children:[(0,l.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:u("auto_response.default_message","Auto-response text")}),(0,l.jsx)("textarea",{value:w,onChange:e=>k(e.target.value),rows:4,maxLength:2e3,placeholder:u("auto_response.message_placeholder","Hello! I can help with this task..."),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400 resize-none"})]}),t.length>0&&(0,l.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 p-5",children:[(0,l.jsx)("h3",{className:"font-medium text-gray-800 text-sm mb-3",children:u("auto_response.categories","Task categories")}),(0,l.jsx)("div",{className:"flex flex-wrap gap-2 max-h-40 overflow-y-auto",children:t.flatMap(e=>{var t;return[e,...null!=(t=e.children)?t:[]]}).map(e=>{var t,s,r,a;let n=null!=(a=null!=(r=null==(t=e.names)?void 0:t[x])?r:null==(s=e.names)?void 0:s.el)?a:e.slug,i=C.includes(e.slug);return(0,l.jsx)("button",{type:"button",onClick:()=>L(i?C.filter(t=>t!==e.slug):[...C,e.slug]),className:"px-3 py-1.5 rounded-lg text-xs border transition ".concat(i?"bg-green-600 border-green-600 text-white":"bg-white border-gray-300 text-gray-700 hover:border-green-400"),children:n},e.slug)})})]}),(0,l.jsx)("button",{type:"button",disabled:o,onClick:()=>d({enabled:g,minBudget:b?Number(b):null,maxBudget:y?Number(y):null,defaultPrice:j?Number(j):null,defaultMessage:w||null,maxAutoOffersPerDay:_?Number(_):null,categories:C.length>0?C:null,locations:A.length>0?A:null}),className:"w-full bg-green-600 text-white py-3 rounded-xl font-semibold hover:bg-green-700 disabled:opacity-50",children:o?u("common.loading"):c?u("auto_response.saved","Saved ✓"):u("common.save")})]})}function x(){return(0,l.jsx)(r.Suspense,{fallback:null,children:(0,l.jsx)(m,{})})}function m(){var e,t,s,c,x,m,p,g,h,b,f,y,v,j,N,w,k,_,S,C,L,A,E,T;let D=(0,a.useRouter)(),M=(0,a.useSearchParams)(),{data:P,isPending:B}=(0,n.wV)(),{t:F,locale:W}=(0,i.Y)(),z=null!=(j=M.get("tab"))?j:"info",[q,O]=(0,r.useState)(["info","finance","cards","notifications","reviews","referral","auto_response","site"].includes(z)?z:"info"),[U,R]=(0,r.useState)(null),[H,V]=(0,r.useState)(!0),[I,J]=(0,r.useState)(!1),[K,Y]=(0,r.useState)(!1),[G,Z]=(0,r.useState)(""),[Q,X]=(0,r.useState)({firstName:"",lastName:"",phone:"",bio:"",locale:"el"}),[$,ee]=(0,r.useState)([]),[et,es]=(0,r.useState)([]),[el,er]=(0,r.useState)(1),[ea,en]=(0,r.useState)(!1),[ei,eo]=(0,r.useState)([]),[ec,ed]=(0,r.useState)(null),[eu,ex]=(0,r.useState)(!1),[em,ep]=(0,r.useState)(""),[eg,eh]=(0,r.useState)(!1),[eb,ef]=(0,r.useState)(!1),[ey,ev]=(0,r.useState)([]),[ej,eN]=(0,r.useState)([]),[ew,ek]=(0,r.useState)(!1),[e_,eS]=(0,r.useState)(!1),[eC,eL]=(0,r.useState)(!1),eA=(0,r.useRef)(null),eE=(0,r.useRef)(null),[eT,eD]=(0,r.useState)(!1),[eM,eP]=(0,r.useState)(!0),[eB,eF]=(0,r.useState)(!1),[eW,ez]=(0,r.useState)(!1),[eq,eO]=(0,r.useState)("idle"),[eU,eR]=(0,r.useState)(null),[eH,eV]=(0,r.useState)(0),[eI,eJ]=(0,r.useState)(!1),[eK,eY]=(0,r.useState)(!1),[eG,eZ]=(0,r.useState)(!1),[eQ,eX]=(0,r.useState)(10),[e$,e0]=(0,r.useState)(!1),[e1,e2]=(0,r.useState)(""),[e5,e4]=(0,r.useState)([]),[e3,e6]=(0,r.useState)([]),[e8,e7]=(0,r.useState)(null),e9=null==(N=null==e8?void 0:e8.showPricing)||N,[te,tt]=(0,r.useState)([]),[ts,tl]=(0,r.useState)(null),[tr,ta]=(0,r.useState)(""),[tn,ti]=(0,r.useState)(!1),[to,tc]=(0,r.useState)(!1),[td,tu]=(0,r.useState)(!1),[tx,tm]=(0,r.useState)(""),[tp,tg]=(0,r.useState)(!1),[th,tb]=(0,r.useState)({}),[tf,ty]=(0,r.useState)(!1),[tv,tj]=(0,r.useState)(null),[tN,tw]=(0,r.useState)(!1),[tk,t_]=(0,r.useState)(null),[tS,tC]=(0,r.useState)(!1),[tL,tA]=(0,r.useState)(!1),[tE,tT]=(0,r.useState)(!1);async function tD(){let e=Number(eQ);if(e&&!(e<1)){e0(!0),e2("");try{let{url:t,params:s}=await o.oh(e),l=document.createElement("form");l.method="POST",l.action=t,Object.entries(s).forEach(e=>{let[t,s]=e,r=document.createElement("input");r.type="hidden",r.name=t,r.value=s,l.appendChild(r)}),document.body.appendChild(l),l.submit()}catch(e){e2((null==e?void 0:e.message)||F("profile.balance.topup.error")),e0(!1)}}}async function tM(){if(!(null==U?void 0:U.email)||"idle"!==eq)return;eO("sending");let e="".concat(window.location.origin,"/profile"),t=await n.yK.sendVerificationEmail({email:U.email,callbackURL:e});(null==t?void 0:t.error)?eO("idle"):eO("sent")}(0,r.useEffect)(()=>{"referral"!==q||eK||o.st().then(e=>{eR(e.referralCode),eV(e.referralCount)}).catch(()=>{}).finally(()=>eY(!0))},[q]);let[tP,tB]=(0,r.useState)(null),[tF,tW]=(0,r.useState)(!1),[tz,tq]=(0,r.useState)(null);async function tO(){en(!0);try{let{cards:e,maxCards:t}=await o.Bb();es(e),er(t),ed(t=>{var s,l;return t&&e.some(e=>e.id===t)?t:null!=(l=null==(s=e[0])?void 0:s.id)?l:null}),o.Tr().then(e=>eo(e.filter(e=>["specialist_card_submitted","specialist_card_approved","specialist_card_rejected"].includes(e.type)))).catch(()=>eo([]))}catch(e){}finally{en(!1)}}async function tU(e){e.preventDefault(),Z(""),J(!0);try{let e=await o.Em("/users/me",{method:"PATCH",body:JSON.stringify({firstName:Q.firstName,lastName:Q.lastName,phone:Q.phone||void 0,bio:Q.bio||void 0,bioLocale:Q.locale,autoTranslateBio:!0,locale:Q.locale,languages:$,showContactInfo:tp})});R(e),Y(!0),setTimeout(()=>Y(!1),2500)}catch(e){Z(e.message||F("common.error"))}finally{J(!1)}}async function tR(){ek(!0),Z("");try{let e=await o.Em("/users/me/become-specialist",{method:"POST"});R(e),O("cards"),tO()}catch(e){Z(e.message||F("common.error"))}finally{ek(!1)}}async function tH(){var e,t;ti(!0),tm("");try{let t=await o.Em("/users/me",{method:"PATCH",body:JSON.stringify({personalSiteSlug:tr||null})});R(t),ta(null!=(e=t.personalSiteSlug)?e:""),tc(!0),setTimeout(()=>tc(!1),2500)}catch(e){"SLUG_TAKEN"===(null!=(t=null==e?void 0:e.code)?t:"")||"This URL is already taken"===e.message?tm(F("profile.site.slug_taken","This address is already taken")):tm(e.message||F("common.error"))}finally{ti(!1)}}async function tV(e){tb(e),ty(!0);try{await o.Em("/users/me",{method:"PATCH",body:JSON.stringify({siteSettings:e})})}catch(e){}finally{ty(!1)}}async function tI(e){var t;let s=null==(t=e.target.files)?void 0:t[0];if(s){eS(!0);try{let e=new FormData;e.append("file",s);let t=await fetch("".concat("https://api.canhelp.gr","/api/uploads"),{method:"POST",credentials:"include",body:e});if(!t.ok)throw Error("Upload failed");let{url:l}=await t.json(),r="".concat("https://api.canhelp.gr").concat(l);await o.Em("/users/me",{method:"PATCH",body:JSON.stringify({image:r})}),R(e=>({...e,image:r}))}catch(e){Z(F("profile.upload.error"))}finally{eS(!1)}}}async function tJ(e){var t;let s=null==(t=e.target.files)?void 0:t[0];if(s){eL(!0);try{let e=new FormData;e.append("file",s);let t=await fetch("".concat("https://api.canhelp.gr","/api/uploads"),{method:"POST",credentials:"include",body:e});if(!t.ok)throw Error("Upload failed");let{url:l}=await t.json(),r="".concat("https://api.canhelp.gr").concat(l),a={...th,profileBackgroundImage:r};await o.Em("/users/me",{method:"PATCH",body:JSON.stringify({siteSettings:a})}),tb(a),Y(!0),setTimeout(()=>Y(!1),2500)}catch(e){Z(F("profile.upload.error"))}finally{eL(!1),eE.current&&(eE.current.value="")}}}async function tK(){eL(!0);try{let e={...th,profileBackgroundImage:null};await o.Em("/users/me",{method:"PATCH",body:JSON.stringify({siteSettings:e})}),tb(e),Y(!0),setTimeout(()=>Y(!1),2500)}catch(e){Z(F("profile.upload.error"))}finally{eL(!1)}}async function tY(){if(em.trim()){ex(!0);try{let e=await o.eR({title:em.trim()});es(t=>[...t,e]),ed(e.id),ep(""),eh(!1)}catch(e){Z(e.message||F("common.error"))}finally{ex(!1)}}}async function tG(e){if(confirm(F("profile.cards.delete_confirm")))try{await o.f5(e),es(t=>{var s,l;let r=t.filter(t=>t.id!==e);return ec===e&&ed(null!=(l=null==(s=r[0])?void 0:s.id)?l:null),r})}catch(e){Z(e.message||F("common.error"))}}if((0,r.useEffect)(()=>{"reviews"!==q||null!==tP||tF||(tW(!0),o.q7().then(tB).catch(()=>tB([])).finally(()=>tW(!1)))},[q]),(0,r.useEffect)(()=>{"site"!==q||null!==tv||tN||(tw(!0),o.RN().then(e=>tj(e.days)).catch(()=>tj([])).finally(()=>tw(!1)))},[q]),(0,r.useEffect)(()=>{B||P||D.push("/login")},[P,B]),(0,r.useEffect)(()=>{P&&Promise.all([o.Em("/users/me"),o.bW(),o.Vs(),o.H().catch(()=>null),o.z6().catch(()=>[]),o.fm(8).catch(()=>[]),o.ew(20).catch(()=>[])]).then(e=>{var t,s,l,r,a,n,i,c,d,u,x;let[m,p,g,h,b,f,y]=e;R(m),X({firstName:null!=(t=m.firstName)?t:"",lastName:null!=(s=m.lastName)?s:"",phone:null!=(l=m.phone)?l:"",bio:null!=(r=m.bio)?r:"",locale:null!=(a=m.locale)?a:"el"}),ee(null!=(n=m.languages)?n:[]),eD(null!=(i=m.notifyNewTasks)&&i),eP(null==(c=m.notifMessages)||c),ev(p),eN(g),e7(h),tt((null!=b?b:[]).filter(e=>e.isActive).map(e=>e.statusType)),e4(f),e6(y),ta(null!=(d=m.personalSiteSlug)?d:""),tg(null!=(u=m.showContactInfo)&&u),tb(null!=(x=m.siteSettings)?x:{}),tO(),o.Bm(m.id).then(e=>tq(e.avg)).catch(()=>{})}).catch(()=>{}).finally(()=>V(!1))},[P]),(0,r.useEffect)(()=>{e9||"finance"!==q||O("info")},[q,e9]),B||H)return(0,l.jsx)("div",{className:"text-center py-20 text-white",children:F("common.loading")});let tZ="en"===W?"en":"ru"===W?"ru":"uk"===W?"uk":"el",tQ="en"===W?"en-US":"ru"===W?"ru-RU":"el-GR",tX=(null==U?void 0:U.role)==="specialist",t$=(null==U?void 0:U.role)==="admin",t0=tX||t$,t1=U?"".concat(null!=(w=null==(e=U.firstName)?void 0:e[0])?w:"").concat(null!=(k=null==(t=U.lastName)?void 0:t[0])?k:"").toUpperCase():"?",t2=!!(null==e8||null==(s=e8.features)?void 0:s.hasAutoResponse),t5=String(null!=(S=null!=(_=Q.bio)?_:null==U?void 0:U.bio)?S:"").trim(),t4=et.filter(e=>{var t;return(null!=(t=e.publicationStatus)?t:e.isActive?"active":"inactive")==="active"}),t3=t4.length>0,t6=t4.some(e=>{var t,s;return(null!=(s=null==(t=e.categories)?void 0:t.length)?s:0)>0}),t8=t4.some(e=>{var t,s;return(null!=(s=null==(t=e.locations)?void 0:t.length)?s:0)>0}),t7=ei.reduce((e,t)=>{if(!t.referenceId||e[t.referenceId])return e;let s="specialist_card_approved"===t.type?"green":"specialist_card_rejected"===t.type?"red":"amber",l="specialist_card_approved"===t.type?F("profile.card.review_approved","Card approved"):"specialist_card_rejected"===t.type?F("profile.card.review_rejected","Card rejected"):F("profile.card.review_pending","Pending approval"),r="specialist_card_approved"===t.type?F("profile.card.review_approved_hint","Your card is now visible in offers."):"specialist_card_rejected"===t.type?F("profile.card.review_rejected_hint","Your card was not approved. Please update it and submit again."):F("profile.card.review_pending_hint","Your card is being reviewed by the admin team.");return e[t.referenceId]={title:l,body:r,tone:s},e},{}),t9=[];t5||t9.push(F("profile.listing_requirements.bio","Add a short bio in the main profile section")),t3||t9.push(F("profile.listing_requirements.published_card","Publish at least one card")),t6||t9.push(F("profile.listing_requirements.categories","Add at least one category to the published card")),t8||t9.push(F("profile.listing_requirements.locations","Add at least one location to the published card"));let se={info:!t5,cards:t9.length>0},st={info:(0,l.jsx)("svg",{className:"w-4 h-4 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 6a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0zM4.501 20.118a7.5 7.5 0 0114.998 0A17.933 17.933 0 0112 21.75c-2.676 0-5.216-.584-7.499-1.632z"})}),finance:(0,l.jsx)("svg",{className:"w-4 h-4 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v12m-3-2.818l.879.659c1.171.879 3.07.879 4.242 0 1.172-.879 1.172-2.303 0-3.182C13.536 12.219 12.768 12 12 12c-.725 0-1.45-.22-2.003-.659-1.106-.879-1.106-2.303 0-3.182s2.9-.879 4.006 0l.415.33M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),cards:(0,l.jsx)("svg",{className:"w-4 h-4 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 14.15v4.073a2.25 2.25 0 01-2.25 2.25h-12a2.25 2.25 0 01-2.25-2.25V6a2.25 2.25 0 012.25-2.25h4.073M15.75 3h5.25v5.25M15.75 3l-9 9"})}),notifications:(0,l.jsx)("svg",{className:"w-4 h-4 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.857 17.082a23.848 23.848 0 005.454-1.31A8.967 8.967 0 0118 9.75v-.7V9A6 6 0 006 9v.75a8.967 8.967 0 01-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 01-5.714 0m5.714 0a3 3 0 11-5.714 0"})}),reviews:(0,l.jsx)("svg",{className:"w-4 h-4 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.48 3.499a.562.562 0 011.04 0l2.125 5.111a.563.563 0 00.475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 00-.182.557l1.285 5.385a.562.562 0 01-.84.61l-4.725-2.885a.562.562 0 00-.586 0L6.982 20.54a.562.562 0 01-.84-.61l1.285-5.386a.562.562 0 00-.182-.557l-4.204-3.602a.562.562 0 01.321-.988l5.518-.442a.563.563 0 00.475-.345L11.48 3.5z"})}),referral:(0,l.jsx)("svg",{className:"w-4 h-4 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.19 8.688a4.5 4.5 0 011.242 7.244l-4.5 4.5a4.5 4.5 0 01-6.364-6.364l1.757-1.757m13.35-.622l1.757-1.757a4.5 4.5 0 00-6.364-6.364l-4.5 4.5a4.5 4.5 0 001.242 7.244"})}),auto_response:(0,l.jsx)("svg",{className:"w-4 h-4 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09z"})}),site:(0,l.jsx)("svg",{className:"w-4 h-4 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 21a9.004 9.004 0 008.716-6.747M12 21a9.004 9.004 0 01-8.716-6.747M12 21c2.485 0 4.5-4.03 4.5-9S14.485 3 12 3m0 18c-2.485 0-4.5-4.03-4.5-9S9.515 3 12 3m0 0a8.997 8.997 0 017.843 4.582M12 3a8.997 8.997 0 00-7.843 4.582m15.686 0A11.953 11.953 0 0112 10.5c-2.998 0-5.74-1.1-7.843-2.918m15.686 0A8.959 8.959 0 0121 12c0 .778-.099 1.533-.284 2.253m0 0A17.919 17.919 0 0112 16.5c-3.162 0-6.133-.815-8.716-2.247m0 0A9.015 9.015 0 013 12c0-1.605.42-3.113 1.157-4.418"})})},ss=t0?[{id:"info",label:F("profile.tab.info")},{id:"cards",label:F("profile.tab.cards")},{id:"notifications",label:F("profile.tab.notifications")},{id:"reviews",label:F("profile.tab.reviews")},...e9?[{id:"finance",label:F("profile.tab.finance")}]:[],{id:"referral",label:F("profile.tab.referral")},...t2?[{id:"auto_response",label:F("profile.tab.auto_response","Auto response")}]:[],...(null==e8||null==(c=e8.features)?void 0:c.hasPersonalSite)?[{id:"site",label:F("profile.tab.site")}]:[]]:[{id:"info",label:F("profile.tab.info")},{id:"cards",label:F("profile.tab.cards")},{id:"notifications",label:F("profile.tab.notifications")},{id:"reviews",label:F("profile.tab.reviews")},...e9?[{id:"finance",label:F("profile.tab.finance")}]:[],{id:"referral",label:F("profile.tab.referral")},...(null==e8||null==(x=e8.features)?void 0:x.hasPersonalSite)?[{id:"site",label:F("profile.tab.site")}]:[]];return(0,l.jsxs)("div",{className:"max-w-4xl mx-auto px-4 py-8",children:[(0,l.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,l.jsx)("div",{className:"w-14 h-14 rounded-full flex-shrink-0 overflow-hidden border-2 border-white/40 flex items-center justify-center text-green-700 text-xl font-bold bg-green-100 cursor-pointer",onClick:()=>{var e;O("info"),null==(e=eA.current)||e.click()},title:F("profile.photo.change"),children:(null==U?void 0:U.image)?(0,l.jsx)("img",{src:U.image,alt:U.name,className:"w-full h-full object-cover"}):t1}),(0,l.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,l.jsx)("h1",{className:"text-xl font-bold text-white leading-tight",children:(null==U?void 0:U.firstName)?"".concat(U.firstName," ").concat(null!=(C=U.lastName)?C:"").trim():null!=(L=null==U?void 0:U.name)?L:F("nav.profile")}),tz&&(0,l.jsxs)("div",{className:"flex items-center gap-1 mt-0.5",children:[(0,l.jsx)("span",{className:"text-yellow-300",children:"★"}),(0,l.jsx)("span",{className:"font-semibold text-white text-sm",children:Number(tz).toFixed(1)}),null!==tP&&tP.length>0&&(0,l.jsxs)("span",{className:"text-white/60 text-xs",children:["(",tP.length,")"]})]})]})]}),!ea&&0===et.length&&(0,l.jsx)("div",{className:"mb-6 rounded-2xl border border-amber-300 bg-amber-50/95 p-4 sm:p-5 shadow-sm",children:(0,l.jsxs)("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-sm font-semibold text-amber-950",children:F("profile.cards.empty","No offers yet")}),(0,l.jsx)("p",{className:"text-xs leading-relaxed text-amber-800 mt-1 max-w-2xl",children:F("profile.cards.empty_hint","Создайте первую карточку, чтобы показать услуги клиентам.")})]}),(0,l.jsx)("button",{type:"button",onClick:()=>{O("cards"),eh(!0)},className:"inline-flex items-center justify-center rounded-xl bg-amber-600 px-4 py-2 text-sm font-semibold text-white transition hover:bg-amber-700",children:F("profile.cards.create_first")})]})}),(0,l.jsxs)("div",{className:"flex gap-6 items-start",children:[ss.length>1&&(0,l.jsx)("aside",{className:"w-52 shrink-0 hidden sm:block",children:(0,l.jsx)("nav",{className:"rounded-2xl overflow-hidden bg-white/10 backdrop-blur-sm",children:ss.map(e=>(0,l.jsxs)("button",{type:"button",onClick:()=>O(e.id),className:"w-full text-left px-4 py-3 text-sm font-medium transition border-b border-white/10 last:border-0 flex items-center gap-3 ".concat(q===e.id?"bg-white text-green-700":"text-white/80 hover:bg-white/10 hover:text-white"),children:[st[e.id],(0,l.jsxs)("span",{className:"flex items-center gap-1.5",children:[e.label,se[e.id]&&(0,l.jsx)("span",{className:"inline-flex items-center justify-center w-4 h-4 rounded-full bg-amber-500 text-white text-[10px] font-bold",children:"!"})]})]},e.id))})}),(0,l.jsxs)("div",{className:"flex-1 min-w-0",children:[ss.length>1&&(0,l.jsx)("div",{className:"flex sm:hidden bg-white/15 backdrop-blur rounded-xl p-1 mb-4 gap-1 overflow-x-auto",children:ss.map(e=>(0,l.jsxs)("button",{type:"button",onClick:()=>O(e.id),className:"flex-1 min-w-fit px-3 py-2 text-xs font-medium rounded-lg transition whitespace-nowrap flex flex-col items-center gap-0.5 ".concat(q===e.id?"bg-white text-green-700 shadow-sm":"text-white/80 hover:text-white hover:bg-white/10"),children:[st[e.id],(0,l.jsxs)("span",{className:"flex items-center gap-1.5",children:[e.label,se[e.id]&&(0,l.jsx)("span",{className:"inline-flex items-center justify-center w-4 h-4 rounded-full bg-amber-500 text-white text-[10px] font-bold",children:"!"})]})]},e.id))}),"cards"===q&&(0,l.jsxs)("div",{className:"space-y-4",children:[G&&(0,l.jsx)("div",{className:"bg-red-50 text-red-700 p-3 rounded-lg text-sm",children:G}),t9.length>0&&(0,l.jsxs)("div",{className:"bg-amber-50 border border-amber-300 rounded-xl p-4",children:[(0,l.jsx)("p",{className:"text-sm font-semibold text-amber-900",children:F("profile.listing_requirements.title","Your profile is not shown yet in offers")}),(0,l.jsx)("p",{className:"text-xs text-amber-800 mt-1",children:F("profile.listing_requirements.hint","To make the card visible, complete these conditions:")}),(0,l.jsx)("ul",{className:"mt-2 list-disc pl-5 text-xs text-amber-900 space-y-0.5",children:t9.map(e=>(0,l.jsx)("li",{children:e},e))})]}),(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("p",{className:"text-sm text-white/70",children:[F("profile.cards.count"),": ",et.length," / ",null===el?"∞":el]}),(0,l.jsxs)("button",{type:"button",onClick:()=>{null!==el&&et.length>=el?ef(!0):eh(!0)},className:"flex items-center gap-1.5 text-sm font-medium text-white hover:text-white/80",children:["+ ",F("profile.cards.add")]})]}),eg&&(0,l.jsxs)("div",{className:"bg-white rounded-xl border border-green-200 p-4 space-y-3",children:[(0,l.jsx)("p",{className:"text-sm font-medium text-gray-800",children:F("profile.cards.new_title")}),(0,l.jsx)("input",{value:em,onChange:e=>ep(e.target.value),onKeyDown:e=>{"Enter"===e.key&&tY()},maxLength:200,placeholder:F("profile.cards.placeholder"),autoFocus:!0,className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"}),(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)("button",{type:"button",onClick:tY,disabled:eu||!em.trim(),className:"px-4 py-2 bg-green-600 hover:bg-green-700 text-white rounded-lg text-sm font-medium disabled:opacity-50",children:eu?"...":F("profile.cards.create")}),(0,l.jsx)("button",{type:"button",onClick:()=>{eh(!1),ep("")},className:"px-4 py-2 bg-gray-100 hover:bg-gray-200 text-gray-700 rounded-lg text-sm font-medium",children:F("profile.cards.cancel")})]})]}),ea&&(0,l.jsx)("div",{className:"text-center py-10 text-white/70",children:F("common.loading")}),!ea&&0===et.length&&!eg&&(0,l.jsxs)("div",{className:"text-center py-14 border-2 border-dashed border-white/30 rounded-xl",children:[(0,l.jsx)("p",{className:"text-white/70 text-sm mb-3",children:F("profile.cards.empty")}),(0,l.jsxs)("button",{type:"button",onClick:()=>eh(!0),className:"text-sm text-white font-medium hover:underline",children:["+ ",F("profile.cards.create_first")]})]}),et.map(e=>{var t,s,r;let a=[];t5||a.push(F("profile.listing_requirements.bio","Add a short bio in the main profile section"));let n=null!=(s=e.publicationStatus)?s:e.isActive?"active":"inactive";return"pending"===n?a.push(F("profile.listing_requirements.review_pending","Card is under review")):"active"!==n&&a.push(F("profile.listing_requirements.card_inactive","Make the card active")),e.categories&&0!==e.categories.length||a.push(F("profile.listing_requirements.categories","Add at least one category to the active card")),e.locations&&0!==e.locations.length||a.push(F("profile.listing_requirements.locations","Add at least one location to the active card")),(0,l.jsx)(d,{card:e,isOpen:ec===e.id,onToggle:()=>ed(e.id),onUpdate:e=>es(t=>t.map(t=>t.id===e.id?e:t)),onDelete:()=>tG(e.id),categories:ey,locationTree:ej,catLocale:tZ,locale:W,hasPriceList:!!(null==e8||null==(t=e8.features)?void 0:t.hasPriceList),visibilityIssues:a,moderationNotice:null!=(r=t7[e.id])?r:null},e.id)})]}),"site"===q&&(0,l.jsxs)("div",{className:"space-y-5",children:[(0,l.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 p-6 space-y-4",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("h2",{className:"font-semibold text-gray-800 mb-1",children:F("profile.site.title")}),(0,l.jsx)("p",{className:"text-xs text-gray-400",children:F("profile.site_slug_hint")})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"block text-xs font-medium text-gray-500 mb-1.5",children:F("profile.site.url_label")}),(0,l.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,l.jsx)("span",{className:"text-sm text-gray-400 shrink-0",children:"canhelp.gr/site/"}),(0,l.jsx)("input",{value:tr,onChange:e=>ta(e.target.value.toLowerCase().replace(/[^a-z0-9_-]/g,"")),placeholder:"my-slug",maxLength:50,className:"flex-1 min-w-32 border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,l.jsx)("button",{type:"button",onClick:tH,disabled:tn,className:"px-5 py-2 bg-green-600 text-white rounded-lg text-sm font-medium hover:bg-green-700 disabled:opacity-50",children:tn?F("profile.saving"):F("common.save")}),to&&(0,l.jsxs)("span",{className:"text-sm text-green-600",children:["✓ ",F("profile.saved")]}),tr&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("button",{type:"button",onClick:()=>{navigator.clipboard.writeText("".concat(window.location.origin,"/site/").concat(tr)),tu(!0),setTimeout(()=>tu(!1),2e3)},className:"px-3 py-2 border border-gray-300 rounded-lg text-sm text-gray-600 hover:bg-gray-50 flex items-center gap-1.5",children:[(0,l.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})}),td?F("profile.site.copied"):F("profile.site.copy")]}),(0,l.jsxs)("a",{href:"/site/".concat(tr),target:"_blank",rel:"noopener noreferrer",className:"px-3 py-2 border border-green-200 bg-green-50 rounded-lg text-sm text-green-600 hover:bg-green-100 flex items-center gap-1.5",children:[F("profile.site_open"),(0,l.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})]})]}),tx&&(0,l.jsx)("p",{className:"text-xs text-red-500",children:tx})]}),(0,l.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,l.jsx)("h3",{className:"font-semibold text-gray-800",children:F("profile.site.visible_title")}),tf&&(0,l.jsx)("span",{className:"text-xs text-gray-400",children:F("profile.saving","Saving...")})]}),(0,l.jsx)("div",{className:"space-y-3",children:[{key:"showBio",label:F("profile.site.visible.bio","Biography")},{key:"showRating",label:F("profile.site.visible.rating","Rating and reviews")},{key:"showReviews",label:F("profile.site.visible.reviews","Reviews section")},{key:"showServices",label:F("profile.site.visible.services","Service cards")},{key:"showPriceList",label:F("profile.site.visible.price_list","Price list")},{key:"showPortfolio",label:F("profile.site.visible.portfolio","Portfolio")},{key:"showPhone",label:F("profile.site.visible.contacts","Contact phone")},{key:"showFullLastName",label:F("profile.site.visible.full_last_name","Show full last name")},{key:"showStatus",label:F("profile.site.visible.status",'Status "Available now"')}].map(e=>{let{key:t,label:s}=e,r=!1!==th[t];return(0,l.jsxs)("label",{className:"flex items-center gap-3 cursor-pointer group",children:[(0,l.jsx)("div",{className:"w-5 h-5 rounded border-2 flex items-center justify-center transition shrink-0 ".concat(r?"bg-green-600 border-green-600":"bg-white border-gray-300 group-hover:border-green-400"),onClick:()=>{tV({...th,[t]:!r})},children:r&&(0,l.jsx)("svg",{className:"w-3 h-3 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})})}),(0,l.jsx)("span",{className:"text-sm text-gray-700 select-none",onClick:()=>{tV({...th,[t]:!r})},children:s})]},t)})}),(0,l.jsx)("p",{className:"text-xs text-gray-400 mt-4",children:F("profile.site.edit_bio_hint","Name and photo are always visible")}),(0,l.jsxs)("div",{className:"mt-6 pt-4 border-t border-gray-100",children:[(0,l.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:F("profile.site.theme","Theme")}),(0,l.jsx)("div",{className:"flex gap-3",children:[{value:"dark",label:F("profile.site.theme.dark","Dark"),icon:"\uD83C\uDF19"},{value:"light",label:F("profile.site.theme.light","Light"),icon:"☀️"}].map(e=>{var t;let s=(null!=(t=th.siteTheme)?t:"dark")===e.value;return(0,l.jsxs)("button",{onClick:()=>tV({...th,siteTheme:e.value}),className:"flex-1 flex items-center justify-center gap-2 px-4 py-2.5 rounded-xl border-2 text-sm font-medium transition ".concat(s?"border-green-500 bg-green-50 text-green-700":"border-gray-200 bg-white text-gray-500 hover:border-gray-300"),children:[(0,l.jsx)("span",{children:e.icon}),e.label]},e.value)})})]})]}),(0,l.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[(0,l.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,l.jsxs)("div",{children:[(0,l.jsx)("h3",{className:"font-semibold text-gray-800",children:F("profile.site.stats.title","Site analytics")}),(0,l.jsx)("p",{className:"text-xs text-gray-400 mt-0.5",children:F("profile.site.stats.days","last 30 days")})]})}),tr?tN||null===tv?(0,l.jsx)("p",{className:"text-sm text-gray-400 py-4 text-center",children:F("profile.site.stats.loading","Loading analytics...")}):(()=>{let e=tv.reduce((e,t)=>e+t.views,0),t=tv.reduce((e,t)=>e+t.unique,0),s=tv.reduce((e,t)=>e+t.messages,0),r=tv.map(e=>e.date),a=[{vals:tv.map(e=>e.views),color:"#3b82f6",fill:"#3b82f615",label:F("profile.site.stats.views","Views")},{vals:tv.map(e=>e.unique),color:"#8b5cf6",fill:"#8b5cf610",label:F("profile.site.stats.unique","Unique")},{vals:tv.map(e=>e.messages),color:"#10b981",fill:"#10b98110",label:F("profile.site.stats.messages","Messages")}],n=Math.max(...a.flatMap(e=>e.vals),1),i=540/(r.length-1);function o(e){return e.map((e,t)=>[36+t*i,138-e/n*138])}function c(e){if(e.length<2)return"";let t="M ".concat(e[0][0].toFixed(1)," ").concat(e[0][1].toFixed(1));for(let s=1;s<e.length;s++){let l=((e[s-1][0]+e[s][0])/2).toFixed(1);t+=" C ".concat(l," ").concat(e[s-1][1].toFixed(1)," ").concat(l," ").concat(e[s][1].toFixed(1)," ").concat(e[s][0].toFixed(1)," ").concat(e[s][1].toFixed(1))}return t}let d=[0,Math.round(n/3),Math.round(2*n/3),n],u=r.map((e,t)=>({i:t,label:e.slice(8)})).filter((e,t)=>t%7==0||t===r.length-1);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:"grid grid-cols-3 gap-3 mb-5",children:[{label:F("profile.site.stats.total_views","Views"),value:e,color:"text-green-600",bg:"bg-green-50"},{label:F("profile.site.stats.total_unique","Unique visitors"),value:t,color:"text-violet-600",bg:"bg-violet-50"},{label:F("profile.site.stats.total_messages","Messages"),value:s,color:"text-emerald-600",bg:"bg-emerald-50"}].map(e=>(0,l.jsxs)("div",{className:"".concat(e.bg," rounded-xl p-3 text-center"),children:[(0,l.jsx)("div",{className:"text-2xl font-bold ".concat(e.color),children:e.value}),(0,l.jsx)("div",{className:"text-xs text-gray-500 mt-0.5",children:e.label})]},e.label))}),(0,l.jsx)("div",{className:"flex items-center gap-4 mb-2",children:a.map(e=>(0,l.jsxs)("span",{className:"flex items-center gap-1.5 text-xs text-gray-500",children:[(0,l.jsx)("span",{className:"w-3 h-0.5 inline-block rounded",style:{background:e.color}}),e.label]},e.label))}),(0,l.jsx)("div",{className:"overflow-x-auto",children:(0,l.jsxs)("svg",{viewBox:"0 0 ".concat(580," ").concat(172),className:"w-full",style:{minWidth:320},children:[d.map((e,t)=>{let s=138-e/n*138;return(0,l.jsxs)("g",{children:[(0,l.jsx)("line",{x1:36,y1:s,x2:576,y2:s,stroke:"#f3f4f6",strokeWidth:1}),(0,l.jsx)("text",{x:31,y:s+3.5,textAnchor:"end",fontSize:9,fill:"#9ca3af",children:e>=1e3?"".concat(Math.round(e/1e3),"K"):String(e)})]},"y-".concat(t,"-").concat(e))}),u.map(e=>{let{i:t}=e;return(0,l.jsx)("line",{x1:36+t*i,y1:0,x2:36+t*i,y2:138,stroke:"#f9fafb",strokeWidth:1},"vg-".concat(t))}),u.map(e=>{let{i:t,label:s}=e;return(0,l.jsx)("text",{x:36+t*i,y:170,textAnchor:"middle",fontSize:9,fill:"#9ca3af",children:s},t)}),a.map((e,t)=>(0,l.jsx)("path",{d:function(e){let t=o(e),s=c(t);if(!s)return"";let l=t[t.length-1][0].toFixed(1);return"".concat(s," L ").concat(l," ").concat("138.0"," L ").concat("36.0"," ").concat("138.0"," Z")}(e.vals),fill:e.fill},"fill-".concat(t))),a.map((e,t)=>(0,l.jsx)("path",{d:c(o(e.vals)),fill:"none",stroke:e.color,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},"line-".concat(t))),a.map((e,t)=>{let s=o(e.vals),r=s[s.length-1];return(0,l.jsx)("circle",{cx:r[0],cy:r[1],r:4,fill:"white",stroke:e.color,strokeWidth:2},"dot-".concat(t))}),(0,l.jsx)("line",{x1:36,y1:138,x2:576,y2:138,stroke:"#e5e7eb",strokeWidth:1})]})})]})})():(0,l.jsx)("p",{className:"text-sm text-gray-400 py-4 text-center",children:F("profile.site.stats.no_slug","Set your site URL to view statistics")})]})]}),"reviews"===q&&(0,l.jsx)("div",{className:"space-y-4",children:null===tP?(0,l.jsx)("div",{className:"text-center py-10 text-white/70",children:F("common.loading")}):0===tP.length?(0,l.jsxs)("div",{className:"text-center py-20 text-white/60",children:[(0,l.jsx)("p",{className:"text-4xl mb-3",children:"⭐"}),(0,l.jsx)("p",{children:F("profile.no_reviews")})]}):tP.map(e=>{var t,s,r,a;let{review:n,author:i}=e;return(0,l.jsx)("div",{className:"bg-white rounded-xl border border-gray-200 p-4",children:(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)("div",{className:"w-9 h-9 rounded-full bg-gray-100 flex-shrink-0 flex items-center justify-center text-gray-600 text-sm font-bold overflow-hidden",children:(null==i?void 0:i.image)?(0,l.jsx)("img",{src:i.image,alt:i.name,className:"w-full h-full object-cover"}):null!=(r=null==i||null==(s=i.name)||null==(t=s[0])?void 0:t.toUpperCase())?r:"?"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,l.jsx)("span",{className:"text-sm font-medium text-gray-800",children:null!=(a=null==i?void 0:i.name)?a:"—"}),(0,l.jsxs)("span",{className:"text-yellow-400",children:["★".repeat(n.rating),"☆".repeat(5-n.rating)]})]}),n.comment&&(0,l.jsx)("p",{className:"text-sm text-gray-600",children:n.comment}),(0,l.jsx)("p",{className:"text-xs text-gray-400 mt-1",children:new Date(n.createdAt).toLocaleDateString()})]})]})},n.id)})}),e9&&"finance"===q&&(0,l.jsxs)("div",{className:"space-y-5",children:[(0,l.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,l.jsx)("h2",{className:"font-semibold text-gray-800",children:F("profile.balance")}),(0,l.jsxs)("button",{onClick:()=>{eX(10),e2(""),eZ(!0)},className:"flex items-center gap-1.5 text-sm font-medium text-green-600 hover:text-green-700 hover:bg-green-50 px-3 py-1.5 rounded-lg transition-colors",children:[(0,l.jsx)("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"})}),F("profile.balance.topup")]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-3 p-4 bg-green-50 rounded-xl border border-green-100",children:[(0,l.jsx)("svg",{className:"w-6 h-6 text-green-600 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,l.jsxs)("span",{className:"text-xl font-bold text-green-700",children:[parseFloat(null!=(A=null==U?void 0:U.balance)?A:"0").toFixed(2)," EUR"]})]}),(0,l.jsxs)("div",{className:"mt-4",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,l.jsx)("h3",{className:"text-sm font-semibold text-gray-800",children:F("profile.balance.history","Operation history")}),(0,l.jsx)("span",{className:"text-xs text-gray-400",children:F("profile.balance.history.last","Latest operations")})]}),0===e5.length?(0,l.jsx)("div",{className:"rounded-xl border border-dashed border-gray-200 px-4 py-6 text-sm text-gray-400 text-center",children:F("profile.balance.history.empty","No operations yet")}):(0,l.jsx)("div",{className:"space-y-2",children:e5.map(e=>{let t="credit"===e.direction,s=Number(e.amount).toFixed(2),r="topup"===e.kind?F("profile.balance.history.kind.topup","Balance top-up"):"plan_purchase"===e.kind?F("profile.balance.history.kind.plan_purchase","Plan charge"):"admin_topup"===e.kind?F("profile.balance.history.kind.admin_topup","Admin top-up"):F("profile.balance.history.kind.admin_adjustment","Admin adjustment");return(0,l.jsxs)("div",{className:"rounded-xl border border-gray-200 px-4 py-3",children:[(0,l.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsx)("div",{className:"text-sm font-medium text-gray-900",children:e.description||r}),(0,l.jsx)("div",{className:"text-xs text-gray-500 mt-1",children:new Date(e.createdAt).toLocaleString(tQ)})]}),(0,l.jsxs)("div",{className:"shrink-0 rounded-full border px-2.5 py-1 text-xs font-semibold ".concat(t?"bg-emerald-50 text-emerald-700 border-emerald-100":"bg-rose-50 text-rose-700 border-rose-100"),children:[t?"+":"-",s," ",e.currency]})]}),(0,l.jsxs)("div",{className:"mt-2 text-xs text-gray-500",children:[F("profile.balance.history.balance_after","Balance after"),": ",Number(e.balanceAfter).toFixed(2)," ",e.currency]})]},e.id)})})]})]}),(0,l.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[(0,l.jsx)("h2",{className:"font-semibold text-gray-800 mb-4",children:F("profile.plan_history.title","Plan history")}),0===e3.length?(0,l.jsx)("div",{className:"rounded-xl border border-dashed border-gray-200 px-4 py-6 text-sm text-gray-400 text-center",children:F("profile.plan_history.empty","Plan change history is empty")}):(0,l.jsx)("div",{className:"space-y-2",children:e3.map(e=>{var t,s;let r={activated:F("profile.plan_history.event.activated","Activated"),renewed:F("profile.plan_history.event.renewed","Renewed"),downgraded:F("profile.plan_history.event.downgraded","Downgraded"),referral_reward:F("profile.plan_history.event.referral_reward","Referral reward"),admin_change:F("profile.plan_history.event.admin_change","Changed by admin"),expired:F("profile.plan_history.event.expired","Expired")},a=null!=(t=({activated:"bg-green-50 text-green-700 border-green-100",renewed:"bg-emerald-50 text-emerald-700 border-emerald-100",downgraded:"bg-rose-50 text-rose-700 border-rose-100",referral_reward:"bg-amber-50 text-amber-700 border-amber-100",admin_change:"bg-purple-50 text-purple-700 border-purple-100",expired:"bg-gray-100 text-gray-600 border-gray-200"})[e.event])?t:"bg-gray-100 text-gray-600 border-gray-200",n=null!=(s=r[e.event])?s:e.event;return(0,l.jsx)("div",{className:"rounded-xl border border-gray-200 px-4 py-3",children:(0,l.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,l.jsx)("span",{className:"text-sm font-semibold text-gray-900",children:e.planName}),e.previousPlanName&&e.previousPlanName!==e.planName&&(0,l.jsxs)("span",{className:"text-xs text-gray-400",children:["← ",e.previousPlanName]})]}),(0,l.jsx)("div",{className:"text-xs text-gray-500 mt-1",children:new Date(e.createdAt).toLocaleString(tQ)}),e.expiresAt&&(0,l.jsxs)("div",{className:"text-xs text-gray-500 mt-0.5",children:[F("profile.plan_history.expires","Until"),": ",new Date(e.expiresAt).toLocaleDateString(tQ)]}),e.daysAdded&&"referral_reward"===e.event&&(0,l.jsxs)("div",{className:"text-xs text-amber-600 mt-0.5",children:["+",e.daysAdded," ",F("profile.plan_history.days","days")]}),e.note&&(0,l.jsx)("div",{className:"text-xs text-gray-400 mt-0.5",children:e.note})]}),(0,l.jsx)("span",{className:"shrink-0 rounded-full border px-2.5 py-1 text-xs font-semibold ".concat(a),children:n})]})},e.id)})})]}),eG&&(0,l.jsx)("div",{className:"fixed inset-0 z-50 flex items-end sm:items-center justify-center p-4 bg-black/40 backdrop-blur-sm",children:(0,l.jsxs)("div",{className:"bg-white rounded-2xl shadow-2xl w-full max-w-sm p-6",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between mb-5",children:[(0,l.jsx)("h3",{className:"text-lg font-semibold text-gray-900",children:F("profile.balance.topup.title")}),(0,l.jsx)("button",{onClick:()=>eZ(!1),className:"text-gray-400 hover:text-gray-600",children:(0,l.jsx)("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),(0,l.jsx)("p",{className:"text-sm text-gray-500 mb-3",children:F("profile.balance.topup.hint")}),(0,l.jsx)("div",{className:"grid grid-cols-4 gap-2 mb-4",children:[5,10,20,50].map(e=>(0,l.jsxs)("button",{onClick:()=>eX(e),className:"py-2 rounded-xl text-sm font-semibold border transition-colors ".concat(Number(eQ)===e?"bg-green-600 text-white border-green-600":"border-gray-200 text-gray-700 hover:border-green-400"),children:["€",e]},e))}),(0,l.jsxs)("div",{className:"mb-5",children:[(0,l.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:F("profile.balance.topup.amount")}),(0,l.jsxs)("div",{className:"relative",children:[(0,l.jsx)("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 text-sm",children:"€"}),(0,l.jsx)("input",{type:"number",min:"1",max:"9999",step:"1",value:eQ,onChange:e=>eX(e.target.value),className:"w-full pl-7 pr-4 py-2.5 border border-gray-300 rounded-xl text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"})]})]}),e1&&(0,l.jsx)("p",{className:"text-sm text-red-600 mb-3",children:e1}),(0,l.jsx)("button",{onClick:tD,disabled:e$||!Number(eQ)||1>Number(eQ),className:"w-full py-3 bg-green-600 hover:bg-green-700 disabled:bg-gray-300 disabled:cursor-not-allowed text-white font-semibold rounded-xl transition-colors flex items-center justify-center gap-2",children:e$?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("svg",{className:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[(0,l.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,l.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8z"})]}),F("profile.balance.topup.loading")]}):F("profile.balance.topup.submit")})]})}),(0,l.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[(0,l.jsx)("h2",{className:"font-semibold text-gray-800 mb-3",children:F("profile.plan.title")}),(null==U?void 0:U.plan)?(0,l.jsxs)("div",{className:"flex items-start gap-3 p-4 bg-green-50 rounded-xl border border-green-100",children:[(0,l.jsx)("svg",{className:"w-6 h-6 text-gray-500 shrink-0 mt-0.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z"})}),(0,l.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,l.jsx)("p",{className:"font-semibold text-gray-900",children:U.plan.name}),U.plan.description&&(0,l.jsx)("p",{className:"text-sm text-gray-500 mt-0.5",children:U.plan.description}),(0,l.jsxs)("div",{className:"flex flex-wrap gap-3 mt-2 text-xs text-gray-500",children:[(0,l.jsxs)("span",{className:"font-medium text-green-700",children:[U.plan.price," ",U.plan.currency]}),null!=U.plan.maxCards?(0,l.jsxs)("span",{children:[F("profile.plan.cards_up_to")," ",U.plan.maxCards]}):(0,l.jsx)("span",{children:F("profile.plan.cards_unlimited")}),null!=U.plan.maxTasks&&(0,l.jsxs)("span",{children:[F("profile.plan.tasks_up_to")," ",U.plan.maxTasks]}),null!=U.plan.maxOffers&&(0,l.jsxs)("span",{children:[F("profile.plan.offers_up_to")," ",U.plan.maxOffers]}),(0,l.jsx)("span",{className:U.planExpiresAt&&new Date(U.planExpiresAt)<new Date(Date.now()+6048e5)?"text-red-500 font-medium":"",children:U.planExpiresAt?"".concat(F("profile.plan.valid_until")," ").concat(new Date(U.planExpiresAt).toLocaleDateString()):F("profile.plan.no_expiry")})]}),(null!=(E=U.plan.features)?E:[]).length>0&&(0,l.jsx)("ul",{className:"mt-2 space-y-0.5",children:U.plan.features.map((e,t)=>(0,l.jsxs)("li",{className:"text-xs text-gray-600 flex items-center gap-1.5",children:[(0,l.jsx)("span",{className:"text-green-500",children:"✓"})," ",e]},t))})]})]}):(0,l.jsxs)("div",{className:"flex items-center gap-3 p-4 bg-gray-50 rounded-xl border border-gray-100",children:[(0,l.jsx)("svg",{className:"w-5 h-5 text-gray-400 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-sm font-medium text-gray-700",children:F("profile.plan.basic")}),(0,l.jsx)("p",{className:"text-xs text-gray-400 mt-0.5",children:F("profile.plan.contact_upgrade")})]})]})]}),e9&&(0,l.jsx)("div",{className:"text-center",children:(0,l.jsxs)("a",{href:"/pricing",className:"inline-flex items-center gap-1.5 text-sm font-medium text-white/70 hover:text-white transition",children:[(0,l.jsx)("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 7l5 5m0 0l-5 5m5-5H6"})}),F("pricing.title","Pricing")]})})]}),"cards"!==q&&"reviews"!==q&&"finance"!==q&&"site"!==q&&(0,l.jsxs)("form",{onSubmit:tU,className:"space-y-6",children:[G&&(0,l.jsx)("div",{className:"bg-red-50 text-red-700 p-3 rounded-lg text-sm",children:G}),K&&(0,l.jsxs)("div",{className:"bg-green-50 text-green-700 p-3 rounded-lg text-sm",children:["✓ ",F("profile.saved")]}),"notifications"===q&&(0,l.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 p-6 space-y-6",children:[(0,l.jsx)("h2",{className:"font-semibold text-gray-800",children:F("notifications.title")}),eW&&(0,l.jsxs)("div",{className:"bg-green-50 text-green-700 p-3 rounded-lg text-sm",children:["✓ ",F("notifications.saved")]}),(0,l.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-gray-800 text-sm",children:F("chat.notif_messages")}),(0,l.jsx)("p",{className:"text-xs text-gray-500 mt-0.5",children:F("notifications.messages.desc")})]}),(0,l.jsx)("button",{type:"button",disabled:eB,onClick:async()=>{let e=!eM;eP(e),eF(!0);try{await o.Em("/users/me",{method:"PATCH",body:JSON.stringify({notifMessages:e})}),ez(!0),setTimeout(()=>ez(!1),2500)}catch(t){eP(!e)}finally{eF(!1)}},className:"relative inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full transition-colors focus:outline-none focus:ring-2 focus:ring-green-500 focus:ring-offset-2 disabled:opacity-50 ".concat(eM?"bg-green-600":"bg-gray-200"),role:"switch","aria-checked":eM,children:(0,l.jsx)("span",{className:"inline-block h-4 w-4 transform rounded-full bg-white shadow transition-transform ".concat(eM?"translate-x-6":"translate-x-1")})})]}),t0&&(0,l.jsxs)("div",{className:"flex items-start justify-between gap-4 ".concat((null==U||null==(m=U.plan)?void 0:m.notifyNewTasks)?"":"opacity-60"),children:[(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-gray-800 text-sm",children:F("notifications.email.new_tasks")}),(0,l.jsx)("p",{className:"text-xs text-gray-500 mt-0.5",children:F("notifications.email.new_tasks.desc")}),!(null==U||null==(p=U.plan)?void 0:p.notifyNewTasks)&&(0,l.jsxs)("p",{className:"text-xs text-amber-600 mt-1",children:["\uD83D\uDD12 ",F("notifications.plan_required")]})]}),(0,l.jsx)("button",{type:"button",disabled:eB||!(null==U||null==(g=U.plan)?void 0:g.notifyNewTasks),onClick:async()=>{let e=!eT;eD(e),eF(!0);try{await o.Em("/users/me",{method:"PATCH",body:JSON.stringify({notifyNewTasks:e})}),ez(!0),setTimeout(()=>ez(!1),2500)}catch(t){eD(!e)}finally{eF(!1)}},className:"relative inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full transition-colors focus:outline-none focus:ring-2 focus:ring-green-500 focus:ring-offset-2 disabled:opacity-50 ".concat(eT?"bg-green-600":"bg-gray-200"),role:"switch","aria-checked":eT,children:(0,l.jsx)("span",{className:"inline-block h-4 w-4 transform rounded-full bg-white shadow transition-transform ".concat(eT?"translate-x-6":"translate-x-1")})})]})]}),"referral"===q&&(0,l.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 p-6 space-y-5",children:[(0,l.jsx)("h2",{className:"font-semibold text-gray-800",children:F("profile.referral.title")}),(0,l.jsx)("p",{className:"text-sm text-gray-500",children:F("profile.referral.desc")}),eK?eU?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-xs font-medium text-gray-500 mb-1.5",children:F("profile.referral.link_label")}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("input",{readOnly:!0,value:"".concat(window.location.origin,"/register?ref=").concat(eU),className:"flex-1 text-sm border border-gray-200 rounded-lg px-3 py-2 bg-gray-50 text-gray-700 focus:outline-none"}),(0,l.jsx)("button",{type:"button",onClick:()=>{navigator.clipboard.writeText("".concat(window.location.origin,"/register?ref=").concat(eU)),eJ(!0),setTimeout(()=>eJ(!1),2e3)},className:"px-3 py-2 rounded-lg border border-gray-200 text-sm font-medium hover:bg-gray-50 transition whitespace-nowrap",children:eI?F("profile.referral.copied"):F("profile.referral.copy")})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-3 p-4 bg-green-50 rounded-xl",children:[(0,l.jsx)("div",{className:"text-2xl font-bold text-green-700",children:eH}),(0,l.jsx)("p",{className:"text-sm text-green-700",children:F("profile.referral.invited_count")})]})]}):(0,l.jsx)("div",{className:"text-sm text-gray-400",children:F("profile.referral.no_code")}):(0,l.jsx)("div",{className:"text-sm text-gray-400",children:F("common.loading")})]}),"auto_response"===q&&(0,l.jsx)(u,{categories:ey,locationTree:ej,loaded:tS,onLoad:()=>{tS||o.Gp().then(e=>{t_(e),tC(!0)}).catch(()=>tC(!0))},settings:tk,saving:tL,saved:tE,onSave:async e=>{tA(!0),tT(!1);try{let t=await o.RQ(e);t_(t),tT(!0),setTimeout(()=>tT(!1),2500)}catch(e){}finally{tA(!1)}},t:F,catLocale:tZ}),"info"===q&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[(0,l.jsx)("h2",{className:"font-semibold text-gray-800 mb-4",children:F("profile.photo")}),(0,l.jsxs)("div",{className:"flex items-center gap-5",children:[(0,l.jsxs)("div",{className:"relative",children:[(null==U?void 0:U.image)?(0,l.jsx)("img",{src:U.image,alt:U.name,className:"w-20 h-20 rounded-full object-cover border-2 border-gray-200"}):(0,l.jsx)("div",{className:"w-20 h-20 rounded-full bg-green-100 flex items-center justify-center text-green-700 text-2xl font-bold border-2 border-gray-200",children:t1}),e_&&(0,l.jsx)("div",{className:"absolute inset-0 rounded-full bg-black/40 flex items-center justify-center",children:(0,l.jsx)("div",{className:"w-5 h-5 border-2 border-white border-t-transparent rounded-full animate-spin"})})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("button",{type:"button",onClick:()=>{var e;return null==(e=eA.current)?void 0:e.click()},disabled:e_,className:"bg-gray-100 hover:bg-gray-200 text-gray-700 px-4 py-2 rounded-lg text-sm font-medium disabled:opacity-50",children:F("profile.photo.change")}),(0,l.jsx)("p",{className:"text-xs text-gray-400 mt-1",children:F("profile.photo.hint")}),(0,l.jsx)("input",{ref:eA,type:"file",accept:"image/jpeg,image/png,image/webp",className:"hidden",onChange:tI}),(0,l.jsx)("div",{className:"mt-3 rounded-lg border border-gray-200 bg-gray-50 px-3 py-2.5",children:tX?(null==e8||null==(h=e8.features)?void 0:h.hasCanHelpNowStatus)?(0,l.jsxs)("label",{className:"flex items-center justify-between cursor-pointer gap-3",children:[(0,l.jsx)("span",{className:"text-xs font-medium text-gray-700",children:F("status.can_help_now","Available now")}),(0,l.jsx)("button",{type:"button",disabled:"canhelp_now"===ts,onClick:async()=>{tl("canhelp_now");let e=!te.includes("canhelp_now");try{let t=await o.bc("canhelp_now",e);tt(e=>t.isActive?[...e.filter(e=>"canhelp_now"!==e),"canhelp_now"]:e.filter(e=>"canhelp_now"!==e))}catch(e){}finally{tl(null)}},className:"relative inline-flex h-5 w-10 items-center rounded-full transition-colors ".concat(te.includes("canhelp_now")?"bg-green-500":"bg-gray-300"," disabled:opacity-50"),children:(0,l.jsx)("span",{className:"inline-block h-3.5 w-3.5 transform rounded-full bg-white shadow transition-transform ".concat(te.includes("canhelp_now")?"translate-x-5.5":"translate-x-1")})})]}):(0,l.jsx)("p",{className:"text-xs text-amber-700",children:F("status.plan_required","Status is unavailable on your current plan")}):t$?(0,l.jsx)("p",{className:"text-xs text-gray-600",children:F("status.admin_not_applicable","User status is not applicable to admin accounts")}):(null==e8||null==(b=e8.features)?void 0:b.hasNeedHelpStatus)?(0,l.jsxs)("label",{className:"flex items-center justify-between cursor-pointer gap-3",children:[(0,l.jsx)("span",{className:"text-xs font-medium text-gray-700",children:F("status.need_help","Need help")}),(0,l.jsx)("button",{type:"button",disabled:"need_help"===ts,onClick:async()=>{tl("need_help");let e=!te.includes("need_help");try{let t=await o.bc("need_help",e);tt(e=>t.isActive?[...e.filter(e=>"need_help"!==e),"need_help"]:e.filter(e=>"need_help"!==e))}catch(e){}finally{tl(null)}},className:"relative inline-flex h-5 w-10 items-center rounded-full transition-colors ".concat(te.includes("need_help")?"bg-green-500":"bg-gray-300"," disabled:opacity-50"),children:(0,l.jsx)("span",{className:"inline-block h-3.5 w-3.5 transform rounded-full bg-white shadow transition-transform ".concat(te.includes("need_help")?"translate-x-5.5":"translate-x-1")})})]}):(0,l.jsx)("p",{className:"text-xs text-amber-700",children:F("status.plan_required","Status is unavailable on your current plan")})})]})]})]}),(0,l.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[(0,l.jsx)("h2",{className:"font-semibold text-gray-800 mb-4",children:F("profile.background.title","Profile header background")}),(0,l.jsx)("div",{className:"w-full h-40 rounded-2xl border border-gray-200 overflow-hidden relative",style:{backgroundImage:th.profileBackgroundImage?"linear-gradient(135deg, rgba(22,163,74,0.45), rgba(21,128,61,0.65)), url(".concat(th.profileBackgroundImage,")"):"linear-gradient(135deg, #22c55e 0%, #16a34a 45%, #166534 100%)",backgroundSize:"cover",backgroundPosition:"center"},children:eC&&(0,l.jsx)("div",{className:"absolute inset-0 bg-black/35 flex items-center justify-center",children:(0,l.jsx)("div",{className:"w-6 h-6 border-2 border-white border-t-transparent rounded-full animate-spin"})})}),(0,l.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,l.jsx)("button",{type:"button",onClick:()=>{var e;return null==(e=eE.current)?void 0:e.click()},disabled:eC,className:"bg-gray-100 hover:bg-gray-200 text-gray-700 px-4 py-2 rounded-lg text-sm font-medium disabled:opacity-50",children:eC?F("profile.photo.uploading","Uploading..."):F("profile.background.change","Change background")}),th.profileBackgroundImage&&(0,l.jsx)("button",{type:"button",onClick:tK,disabled:eC,className:"bg-white hover:bg-gray-50 text-gray-700 px-4 py-2 rounded-lg text-sm font-medium border border-gray-200 disabled:opacity-50",children:F("profile.background.remove","Remove background")}),(0,l.jsx)("input",{ref:eE,type:"file",accept:"image/jpeg,image/png,image/webp",className:"hidden",onChange:tJ})]}),(0,l.jsx)("p",{className:"text-xs text-gray-400 mt-2",children:F("profile.background.hint","Shown in the public profile header on web and mobile app.")})]}),(0,l.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 p-6 space-y-4",children:[(0,l.jsx)("h2",{className:"font-semibold text-gray-800",children:F("profile.basic_info")}),(0,l.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:F("register.first_name")}),(0,l.jsx)("input",{value:Q.firstName,onChange:e=>X({...Q,firstName:e.target.value}),required:!0,className:"w-full border border-gray-300 rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-400 text-sm"})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:F("register.last_name")}),(0,l.jsx)("input",{value:Q.lastName,onChange:e=>X({...Q,lastName:e.target.value}),required:!0,className:"w-full border border-gray-300 rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-400 text-sm"})]})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Email"}),(0,l.jsx)("input",{value:null==U?void 0:U.email,disabled:!0,className:"w-full border border-gray-200 rounded-lg px-3 py-2 text-sm text-gray-400 bg-gray-50 cursor-not-allowed"}),(0,l.jsxs)("div",{className:"flex items-center justify-between mt-1.5",children:[(null==U?void 0:U.emailVerified)?(0,l.jsxs)("span",{className:"flex items-center gap-1 text-xs text-green-600",children:[(0,l.jsx)("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-green-500"}),F("profile.email.verified")]}):(0,l.jsxs)("span",{className:"flex items-center gap-1 text-xs text-amber-600",children:[(0,l.jsx)("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-amber-500"}),F("profile.email.not_verified")]}),!(null==U?void 0:U.emailVerified)&&(0,l.jsx)("button",{type:"button",disabled:"idle"!==eq,onClick:tM,className:"text-xs text-green-600 hover:underline disabled:opacity-60 disabled:no-underline",children:"sending"===eq?F("login.unverified.sending"):"sent"===eq?F("login.unverified.sent"):F("login.unverified.resend")})]})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:F("profile.phone")}),(0,l.jsx)("input",{type:"tel",value:Q.phone,onChange:e=>X({...Q,phone:e.target.value}),placeholder:F("profile.phone.placeholder"),className:"w-full border border-gray-300 rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-400 text-sm"})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:F("profile.bio")}),(0,l.jsx)("textarea",{value:Q.bio,onChange:e=>X({...Q,bio:e.target.value}),rows:3,maxLength:1e3,placeholder:F("profile.bio.placeholder"),className:"w-full border border-gray-300 rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-400 text-sm resize-none"})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:F("profile.language")}),(0,l.jsx)("p",{className:"text-xs text-gray-400 mb-2",children:F("profile.language.hint")}),(0,l.jsxs)("select",{value:Q.locale,onChange:e=>X({...Q,locale:e.target.value}),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400",children:[(0,l.jsx)("option",{value:"el",children:"Ελληνικά"}),(0,l.jsx)("option",{value:"en",children:"English"}),(0,l.jsx)("option",{value:"ru",children:"Русский"}),(0,l.jsx)("option",{value:"uk",children:"Українська"})]})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:F("profile.languages")}),(0,l.jsx)("p",{className:"text-xs text-gray-400 mb-2",children:F("profile.languages.hint")}),(0,l.jsx)("div",{className:"flex flex-wrap gap-2",children:[{code:"el",flag:"\uD83C\uDDEC\uD83C\uDDF7",label:"Ελληνικά"},{code:"en",flag:"\uD83C\uDDEC\uD83C\uDDE7",label:"English"},{code:"ru",flag:"\uD83C\uDDF7\uD83C\uDDFA",label:"Русский"},{code:"uk",flag:"\uD83C\uDDFA\uD83C\uDDE6",label:"Українська"},{code:"de",flag:"\uD83C\uDDE9\uD83C\uDDEA",label:"Deutsch"},{code:"fr",flag:"\uD83C\uDDEB\uD83C\uDDF7",label:"Fran\xe7ais"},{code:"it",flag:"\uD83C\uDDEE\uD83C\uDDF9",label:"Italiano"},{code:"es",flag:"\uD83C\uDDEA\uD83C\uDDF8",label:"Espa\xf1ol"},{code:"ar",flag:"\uD83C\uDDF8\uD83C\uDDE6",label:"العربية"},{code:"zh",flag:"\uD83C\uDDE8\uD83C\uDDF3",label:"中文"}].map(e=>{let{code:t,flag:s,label:r}=e,a=$.includes(t);return(0,l.jsxs)("button",{type:"button",onClick:()=>ee(a?$.filter(e=>e!==t):[...$,t]),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm border transition ".concat(a?"bg-green-600 border-green-600 text-white":"bg-white border-gray-300 text-gray-700 hover:border-green-400"),children:[(0,l.jsx)("span",{children:s}),(0,l.jsx)("span",{children:r})]},t)})})]})]}),!tX&&!t$&&(0,l.jsx)("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:(0,l.jsxs)("div",{className:"p-4 bg-purple-50 rounded-xl",children:[(0,l.jsx)("p",{className:"text-sm text-gray-600 mb-3",children:F("profile.become_specialist.desc")}),(0,l.jsx)("button",{type:"button",onClick:tR,disabled:ew,className:"bg-purple-600 hover:bg-purple-700 text-white px-5 py-2 rounded-lg text-sm font-semibold disabled:opacity-50",children:ew?F("common.loading"):F("profile.become_specialist")})]})}),tX&&((null==e8||null==(f=e8.plan)?void 0:f.tier)==="pro"||(null==e8||null==(y=e8.plan)?void 0:y.tier)==="ultimate")&&(0,l.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[(0,l.jsx)("h2",{className:"font-semibold text-gray-800 mb-4",children:F("profile.show_contact","Show contacts")}),(0,l.jsxs)("label",{className:"flex items-center justify-between cursor-pointer gap-3",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-sm font-medium text-gray-800",children:F("profile.show_contact_hint","Clients can see your phone number")}),(0,l.jsx)("p",{className:"text-xs text-gray-400 mt-0.5",children:F("profile.show_contact_desc","Lets clients contact you directly")})]}),(0,l.jsx)("button",{type:"button",onClick:()=>tg(e=>!e),className:"relative inline-flex h-6 w-11 items-center rounded-full transition-colors ".concat(tp?"bg-green-500":"bg-gray-300"),children:(0,l.jsx)("span",{className:"inline-block h-4 w-4 transform rounded-full bg-white shadow transition-transform ".concat(tp?"translate-x-6":"translate-x-1")})})]})]})]}),(0,l.jsx)("button",{type:"submit",disabled:I,className:"w-full bg-green-600 text-white py-3 rounded-xl font-semibold hover:bg-green-700 disabled:opacity-50 disabled:cursor-not-allowed ".concat("notifications"===q||"referral"===q||"auto_response"===q?"hidden":""),children:I?F("profile.saving"):F("common.save")})]}),eb&&(0,l.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 px-4",children:(0,l.jsxs)("div",{className:"bg-white rounded-2xl shadow-xl p-6 w-full max-w-md",children:[(0,l.jsx)("div",{className:"text-center mb-5",children:(0,l.jsx)("span",{className:"text-5xl",children:"\uD83D\uDE80"})}),(0,l.jsx)("h2",{className:"text-lg font-bold text-gray-900 text-center mb-2",children:F("profile.upgrade.cards_limit")}),(0,l.jsxs)("p",{className:"text-sm text-gray-600 text-center mb-4",children:[null!=(T=null==U||null==(v=U.plan)?void 0:v.name)?T:F("profile.plan.basic")," — ",F("profile.plan.cards_up_to")," ",el]}),(null==U?void 0:U.plan)&&(0,l.jsxs)("div",{className:"bg-gray-50 rounded-xl p-4 mb-5 text-sm text-gray-600 text-center",children:[(0,l.jsx)("span",{className:"font-medium text-gray-800",children:F("profile.upgrade.plan")})," ",U.plan.name," — ",U.plan.price," ",U.plan.currency]}),(0,l.jsx)("p",{className:"text-xs text-gray-400 text-center mb-5",children:F("profile.upgrade.contact")}),(0,l.jsx)("button",{onClick:()=>ef(!1),className:"w-full bg-green-600 hover:bg-green-700 text-white py-2.5 rounded-xl text-sm font-semibold",children:F("profile.upgrade.ok")})]})})]})]})]})}},1592:(e,t,s)=>{"use strict";s.d(t,{CI:()=>a,Hh:()=>n,Jv:()=>r,wV:()=>i,yK:()=>l});let l=(0,s(6504).M)({baseURL:"https://api.canhelp.gr"}),{signIn:r,signOut:a,signUp:n,useSession:i}=l},3589:(e,t,s)=>{Promise.resolve().then(s.bind(s,1511))},5940:(e,t,s)=>{"use strict";s.d(t,{Ez:()=>n,V:()=>a});var l=s(4568),r=s(7620);function a(e){if(!e)return!1;let t=e.trim();return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("/")}function n(e){let{icon:t,alt:s="",className:n,fallback:i="\uD83D\uDCE6"}=e,o=(t||"").trim(),[c,d]=(0,r.useState)(!1);(0,r.useEffect)(()=>{d(!1)},[o]);let u=(0,r.useMemo)(()=>a(o)?o.startsWith("/api/")?"".concat("https://api.canhelp.gr").concat(o):o:"",[o]),x="/category-icons/package.svg";return a(o)?c&&o!==x?(0,l.jsx)("img",{src:x,alt:s,className:n,loading:"lazy",onError:()=>d(!0)}):c&&o===x?(0,l.jsx)("span",{className:n,children:i}):(0,l.jsx)("img",{src:u,alt:s,className:n,loading:"lazy",onError:()=>d(!0)}):(0,l.jsx)("span",{className:n,children:o||i})}}},e=>{e.O(0,[1516,9906,2982,587,18,7358],()=>e(e.s=3589)),_N_E=e.O()}]);
Save
cmd:
run