PageSourceSearch

https://kokobeo.com/static/js/main-09e9fed2.33f8ed41.js

js kokobeo.com collected 2026-10-02 04:21:01 UTC 55,033 bytes, 1 lines download raw bytes

1"use strict";(globalThis.webpackChunkreact_ts=globalThis.webpackChunkreact_ts||[]).push([[5259],{41182(e,s,t){t.d(s,{A:()=>h});var a=t(5544),i=t(9950),l=t(10300),r=t(98932),n=t(86400),o=t(40978),c=t(77708),d=t(42461),u=t(16255),m=t(64767),x=t(44414);const g={monday:{start:"",end:"",active:!1},tuesday:{start:"",end:"",active:!1},wednesday:{start:"",end:"",active:!1},thursday:{start:"",end:"",active:!1},friday:{start:"",end:"",active:!1},saturday:{start:"",end:"",active:!1},sunday:{start:"",end:"",active:!1}};function h(e){let s=e.userId,t=e.isEmergency,h=void 0!==t&&t,v=e.showEditIcon,y=void 0===v||v;const p=(0,m.Bd)().t,f=(0,n.jLQ)(),b=(0,l.d4)(e=>e.auth).user,j=(0,l.d4)(e=>e.professional),N=j.availabilities,w=j.emergencyAvailabilities,A=s||(null===b||void 0===b?void 0:b.id),S=(0,i.useState)(!1),C=(0,a.A)(S,2),k=C[0],I=C[1],E=(0,i.useState)(g),D=(0,a.A)(E,2),T=D[0],L=D[1],U=(0,i.useState)(g),M=(0,a.A)(U,2),F=M[0],B=M[1],$=(0,i.useState)(!1),H=(0,a.A)($,2),O=H[0],P=H[1],_=(0,i.useState)(()=>localStorage.getItem("timeFormat")||"12"),z=(0,a.A)(_,2),R=(z[0],z[1]);(0,i.useEffect)(()=>{if(N&&N.length>0){const e={...g};N.forEach(s=>{var t;const a=null===(t=s.day)||void 0===t?void 0:t.toLowerCase();e[a]&&(e[a]={id:s.id,start:(0,r.SK)(new Date(s.startAt)).substring(11,16),end:(0,r.SK)(new Date(s.endAt)).substring(11,16),active:s.isAvailable})}),B(e),L(e)}else B(g),L(g)},[N]),(0,i.useEffect)(()=>{Q()},[A]);const Q=async()=>{A&&await f((0,n.Poc)({id:A}))};return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(u.Ay,{color:void 0,className:"p-6",children:[(0,x.jsxs)("div",{className:"flex justify-between items-start mb-4",children:[(0,x.jsx)("h2",{className:"text-xl font-semibold",children:p("availability.title")}),y&&(0,x.jsx)(d.A,{variant:"ghost",size:"sm",className:"text-blue-600 hover:text-blue-700",onClick:()=>{w&&w.length>0?r.dI.showToast("warning",p("availability.restrictedAccess"),p("availability.restrictedMessage")):I(!0)},children:(0,x.jsx)(o.A,{className:"w-4 h-4"})})]}),(0,x.jsx)("div",{className:"space-y-4",children:(0,x.jsxs)("div",{children:[(0,x.jsx)("h3",{className:"font-medium mb-2",children:p("availability.regularHours")}),(0,x.jsx)("div",{className:"grid grid-cols-1 gap-4",children:Object.entries(T).map(e=>{let s=(0,a.A)(e,2),t=s[0],i=s[1];return i.active&&(0,x.jsxs)("div",{className:"flex items-center justify-between",children:[(0,x.jsx)("span",{children:p(`availabilityModal.days.${t}`)}),(0,r.fU)(i.start)," - ",(0,r.fU)(i.end)]},t)})})]})})]}),(0,x.jsx)(c.A,{isEmergency:h,open:k,regularHours:T,handleSave:async e=>{if(O){if(N&&N.length>0)for(const e of N)try{await f((0,n.AC7)({id:e.id}))}catch(l){console.error("Error deleting regular availability:",l)}return console.log("Regular data reset successfully"),r.dI.showToast("success",p("availability.successTitle"),p("availability.resetSuccessMessage")),L(g),B(g),void I(!1)}const s=[];let t=0,i=!1;for(const a in e){const s=e[a];!s.active||s.start&&s.end||(r.dI.showToast("error",p("availability.validationError"),p("availability.setBothTimesMessage",{day:a.charAt(0).toUpperCase()+a.slice(1)})),i=!0)}if(!i){for(const i in e){const l=F[i],r=e[i];if(!(l.start!==r.start||l.end!==r.end||l.active!==r.active))continue;if(!r.active)continue;const o=new Date,c=new Date,d=r.start.split(":"),u=(0,a.A)(d,2),m=u[0],x=u[1],g=r.end.split(":"),h=(0,a.A)(g,2),v=h[0],y=h[1];o.setHours(+m,+x),c.setHours(+v,+y);const p={isEmergency:!1,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,userId:{id:null===b||void 0===b?void 0:b.id},startAt:o.toISOString(),endAt:c.toISOString(),isAvailable:r.active,day:i.charAt(0).toUpperCase()+i.slice(1)};r.id?(await f((0,n.Gol)({id:r.id,data:p})),t++):s.push(p)}if(s.length>0)try{await f((0,n.P71)({data:s})),r.dI.showToast("success",p("availability.successTitle"),s.length>1?p("availability.newAvailabilitiesCreated"):p("availability.newAvailabilityCreated"))}catch(l){r.dI.showToast("error",p("common.error"),p("availability.createError"))}t>0&&r.dI.showToast("success",p("availability.successTitle"),p(t>1?"availability.availabilitiesUpdated":"availability.availabilityUpdated")),(s.length>0||t>0)&&I(!1)}},onClose:()=>{I(!1),R(localStorage.getItem("timeFormat")||"12")},resetData:O,onResetDataChange:P})]})}},43165(e,s,t){t(9950);var a=t(86805),i=t(60348),l=t(64767),r=t(95798),n=t(44414);const o=e=>{let s=e.selectedCategories,t=e.selectedSubcategories;e.onEdit,e.showEditIcon;const o=(0,l.Bd)(),c=o.t,d=o.i18n.language.split("-")[0];return 0===s.length&&0===t.length?(0,n.jsxs)("div",{className:"bg-gray-50 border border-gray-200 rounded-lg p-6 text-center",children:[(0,n.jsx)(a.A,{className:"w-12 h-12 mx-auto mb-3 text-gray-300"}),(0,n.jsx)("p",{className:"text-gray-500 mb-2",children:c("categoryDisplay.noCategoriesSelected")}),(0,n.jsx)("p",{className:"text-sm text-gray-400",children:c("categoryDisplay.addCategoriesHelp")})]}):(0,n.jsx)("div",{className:"space-y-4",children:s.length>0&&(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"flex items-center justify-between mb-3",children:(0,n.jsxs)("h3",{className:"text-lg font-semibold flex items-center gap-2",children:[(0,n.jsx)(a.A,{className:"w-5 h-5 text-blue-600"}),c("categoryDisplay.serviceCategories")]})}),(0,n.jsx)("div",{className:"grid grid-cols-1 gap-3",children:s.map(e=>{var s;const a=(0,r.aZ)(e,d),l=e.subcategories||[],o=null===(s=e.translatedSubCategories)||void 0===s?void 0:s[d];let u={};return o&&(Array.isArray(o)?l.forEach((e,s)=>{o[s]&&(u[e]=o[s])}):"object"===typeof o&&(u=o)),(0,n.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg p-4 hover:shadow-md transition-shadow",children:[(0,n.jsxs)("div",{className:"flex items-start justify-between mb-2",children:[(0,n.jsx)("h4",{className:"font-medium text-gray-900",children:a}),(0,n.jsx)("div",{className:"flex gap-1",children:!1})]}),e.subcategories&&e.subcategories.length>0&&(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"text-xs font-medium text-gray-500 mb-2 uppercase tracking-wide",children:c("categoryDisplay.subcategories")}),(0,n.jsx)("div",{className:"flex flex-wrap gap-1",children:l.filter(e=>t.some(s=>s.name===e||s.name===e.toString())).map((s,t)=>{const a=u[s]||s;return(0,n.jsx)(i.E,{variant:"outline",className:"text-xs",children:a},`${e.id}-${t}`)})})]})]},e.id)})})]})})};t.d(s,["A",0,o])},30525(e,s,t){t.d(s,{A:()=>b});var a=t(5544),i=t(9950),l=t(10300),r=t(86400),n=t(45448),o=t(36391),c=t(27453),d=t(90983),u=t(83655),m=t(96479),x=t(60348),g=t(42461),h=t(69293),v=t(14697),y=t(64767),p=t(95798),f=t(44414);const b=e=>{let s=e.selectedCategories,t=e.selectedSubcategories,b=e.onCategoriesChange,j=e.onSubcategoriesChange,N=e.disabled,w=void 0!==N&&N,A=e.professionalType,S=e.resetKey;const C=(0,r.jLQ)(),k=(0,y.Bd)(),I=k.t,E=k.i18n.language.split("-")[0],D=(0,l.d4)(e=>e.client).categoriesByType,T=(0,i.useState)([]),L=(0,a.A)(T,2),U=L[0],M=L[1],F=(0,i.useState)(!1),B=(0,a.A)(F,2),$=B[0],H=B[1],O=(0,i.useState)(new Set),P=(0,a.A)(O,2),_=P[0],z=P[1],R=(0,i.useState)(!1),Q=(0,a.A)(R,2),W=Q[0],Z=Q[1],q=(0,i.useState)(!1),J=(0,a.A)(q,2),K=J[0],Y=J[1],G=(0,i.useState)(""),V=(0,a.A)(G,2),X=V[0],ee=V[1],se=(0,i.useState)(!1),te=(0,a.A)(se,2),ae=te[0],ie=te[1],le=(0,i.useState)(""),re=(0,a.A)(le,2),ne=re[0],oe=re[1],ce=(0,i.useState)(""),de=(0,a.A)(ce,2),ue=de[0],me=de[1],xe=(0,i.useMemo)(()=>A&&D[A]||[],[A,D]),ge=(0,i.useMemo)(()=>
1{if(!X||X.length<3)return[];const e=X.toLowerCase();return U.filter(s=>{const t=(0,p.aZ)(s,E),a=s.name.toLowerCase().includes(e)||t.toLowerCase().includes(e),i=(0,p.H3)(s,E)||[],l=s.subcategories&&s.subcategories.some(s=>s.toLowerCase().includes(e))||Array.isArray(i)&&i.some(s=>s.toLowerCase().includes(e));return a||l})},[U,X,E]);(0,i.useEffect)(()=>{if(X&&X.length>=3){const e=X.toLowerCase(),s=new Set(_);U.forEach(t=>{const a=(0,p.H3)(t,E)||[];(t.subcategories&&t.subcategories.some(s=>s.toLowerCase().includes(e))||Array.isArray(a)&&a.some(s=>s.toLowerCase().includes(e)))&&s.add(t.id)}),z(s)}},[X,U,E]),(0,i.useEffect)(()=>{Z(!1)},[A]),(0,i.useEffect)(()=>{if(A&&!W){const s=`typeCategories_${A}`,t=localStorage.getItem(s);if(t)try{const e=JSON.parse(t).data;if((null===e||void 0===e?void 0:e.length)>0)return M(e),H(!1),void Z(!0)}catch(e){}xe&&xe.length>0?(M(xe),H(!1),Z(!0)):(he(A),Z(!0))}},[A,xe,W]),(0,i.useEffect)(()=>{$&&xe&&xe.length>0&&(M(xe),H(!1))},[xe,$]),(0,i.useEffect)(()=>{ee("")},[S]);const he=async e=>{H(!0);try{const s=await C((0,n.Rn)({id:e})).unwrap();let t=null;if(s&&s.data?t=s.data:(s&&Array.isArray(s)||s&&s.length>0)&&(t=s),t&&t.length>0){M(t);const s=`typeCategories_${e}`;localStorage.setItem(s,JSON.stringify({data:t,timestamp:Date.now()}))}else M([])}catch(s){console.error("Error fetching categories:",s),M([])}finally{H(!1)}},ve=e=>{const a=pe(e.id);if(console.log("=== Category Toggle Debug ==="),console.log("Category:",e),console.log("Category ID:",e.id,"Type:",typeof e.id),console.log("Is Selected:",a),console.log("Selected Categories:",s.map(e=>({id:e.id,name:e.name,type:typeof e.id}))),console.log("============================"),a){const a=s.filter(s=>s.id!==e.id),i=t.filter(s=>!e.subcategories||!e.subcategories.includes(s.name));console.log("Removing - New Categories:",a),console.log("Calling onCategoriesChange with:",a),b(a),j(i)}else{const t=[...s,e];console.log("Adding - Category:",e),console.log("Calling onCategoriesChange with:",t),b(t)}},ye=(e,s)=>{if(t.some(s=>s.name===e)){const s=t.filter(s=>s.name!==e);j(s)}else{const a={id:e,name:e,description:""};j([...t,a]);const i=U.find(e=>e.id===s),l=pe(s);i&&!l&&ve(i)}},pe=e=>{const t=s.some(s=>s.id===e);return console.log("isCategorySelected check:",{categoryId:e,categoryIdType:typeof e,selectedCategories:s.map(e=>({id:e.id,type:typeof e.id})),result:t}),t},fe=e=>t.some(s=>s.name===e),be=(e,s)=>{if(!s||s.length<3)return e;const t=new RegExp(`(${s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`,"gi");return e.split(t).map((e,s)=>t.test(e)?(0,f.jsx)("mark",{className:"bg-yellow-200 px-1 rounded",children:e},s):e)},je=e=>t.filter(s=>{const t=U.find(s=>s.id===e);return(null===t||void 0===t?void 0:t.subcategories)&&t.subcategories.includes(s.name)}).length;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("div",{className:"space-y-6",children:[(0,f.jsxs)("div",{children:[(0,f.jsxs)("div",{className:"flex items-center justify-between mb-3 relative",children:[(0,f.jsxs)("div",{className:"flex items-center gap-2",children:[(0,f.jsx)("label",{className:"block text-sm font-medium text-gray-700",children:I("categorySelection.serviceCategories")}),(0,f.jsx)("button",{onClick:()=>Y(!K),className:"w-5 h-5 rounded-full bg-gray-200 hover:bg-gray-300 flex items-center justify-center transition-colors",children:(0,f.jsx)(o.A,{className:"w-3 h-3 text-gray-600"})})]}),K&&(0,f.jsxs)("div",{className:"absolute left-0 top-full mt-2 w-80 bg-white rounded-xl shadow-xl border border-gray-200 p-4 z-50",children:[(0,f.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,f.jsxs)("h4",{className:"text-sm font-semibold text-gray-800 flex items-center gap-1",children:[(0,f.jsx)(o.A,{className:"w-4 h-4 text-blue-500"}),I("categorySelection.categoryHelpTitle")]}),(0,f.jsx)("button",{onClick:()=>Y(!1),className:"text-gray-400 hover:text-gray-600",children:(0,f.jsx)(m.A,{className:"w-4 h-4"})})]}),(0,f.jsxs)("ul",{className:"space-y-1.5 text-xs text-gray-600",children:[(0,f.jsxs)("li",{className:"flex items-start gap-1.5",children:[(0,f.jsx)("span",{className:"text-green-500",children:"\u2713"}),I("categorySelection.categoryHelp1")]}),(0,f.jsxs)("li",{className:"flex items-start gap-1.5",children:[(0,f.jsx)("span",{className:"text-green-500",children:"\u2713"}),I("categorySelection.categoryHelp2")]}),(0,f.jsxs)("li",{className:"flex items-start gap-1.5",children:[(0,f.jsx)("span",{className:"text-green-500",children:"\u2713"}),I("categorySelection.categoryHelp3")]}),(0,f.jsxs)("li",{className:"flex items-start gap-1.5",children:[(0,f.jsx)("span",{className:"text-green-500",children:"\u2713"}),I("categorySelection.categoryHelp4")]}),(0,f.jsxs)("li",{className:"flex items-start gap-1.5",children:[(0,f.jsx)("span",{className:"text-green-500",children:"\u2713"}),I("categorySelection.categoryHelp5")]})]})]})]}),(0,f.jsxs)("div",{className:"mb-4",children:[(0,f.jsxs)("div",{className:"relative",children:[(0,f.jsx)("input",{type:"text",placeholder:I("categorySelection.searchPlaceholder"),value:X,onChange:e=>ee(e.target.value),className:"w-full px-4 py-2 pl-10 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-colors",disabled:w}),(0,f.jsx)("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:(0,f.jsx)("svg",{className:"h-5 w-5 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,f.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})}),X&&(0,f.jsx)("button",{type:"button",onClick:e=>{e.preventDefault(),e.stopPropagation(),ee("")},className:"absolute inset-y-0 right-0 pr-3 flex items-center text-gray-400 hover:text-gray-600",disabled:w,children:(0,f.jsx)("svg",{className:"h-5 w-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,f.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),X.length>0&&X.length<3&&(0,f.jsx)("p",{className:"text-sm text-amber-600 mt-1",children:I("categorySelection.minCharactersWarning")}),X.length>=3&&ge.length>0&&(0,f.jsx)("p",{className:"text-sm text-gray-600 mt-1",children:I("categorySelection.foundResults",{count:ge.length,query:X,context:1===ge.length?"one":"other"})})]}),$&&0===U.length&&(0,f.jsxs)("div",{className:"flex items-center justify-center py-4",children:[(0,f.jsx)("div",{className:"animate-spin rounded-full h-5 w-5 border-b-2 border-blue-500"}),(0,f.jsx)("span",{className:"ml-2 text-gray-500 text-sm",children:I("categorySelection.loadingCategories")})]}),$||0!==U.length?!$&&X.length>=3&&0===ge.length?(0,f.jsxs)("div",{className:"text-center py-8 text-gray-500",children:[(0,f.jsx)("svg",{className:"w-12 h-12 mx-auto mb-2 text-gray-300",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,f.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 0114 0z"})}),(0,f.jsx)("p",{children:I("categorySelection.noResultsFound",{query:X})}),(0,f.jsx)("p",{className:"text-sm text-gray-400 mt-1",children:I("categorySelection.tryDifferentTerm")}),!w&&(0,f.jsx)("div",{className:"mt-4",children:(0,f.jsx)(g.A,{size:"sm",onClick:()=>ie(!0),children:I("categorySelection.addCategoryButton")})})]}):(0,f.jsx)(f.Fragment,{children:(0,f.jsx)("div",{className:"space-y-3",children:ge.map(e=>{var s;return(0,f.jsxs)("div",{className:"border border-gray-200 rounded-lg overflow-hidden",children:[(0,f.jsx)("div",{className:"bg-gray-50 p-4",children:(0,f.jsxs)("div",{className:"flex items-center justify-between",children:[(0,f.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,f.jsx)("button",{type:"button",onClick:s=>{s.preventDefault(),s.stopPropagation(),(e=>{const s=new Set(_);s.has(e)?s.delete(e):s.add(e),z(s)})(e.id)},disabled:w,className:"p-1 hover:bg-gray-200 rounded transition-colors",children:_.has(e.id)?(0,f.jsx)(c.A,{className:"w-4 h-4"}):(0,f.jsx)(d.A,{className:"w-4 h-4"})}),(0,f.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,f.jsx)("input",{type:"checkbox",checked:pe(e.id),onChange:()=>{ve(e)},disabled:w,className:"w-4 h-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500"}),(0,f.jsx)("span",{className:"font-medium",children:be((0,p.aZ)(e,E),X)}
1),e.isEmergency&&(0,f.jsx)(x.E,{variant:"destructive",className:"text-xs",children:I("categorySelection.emergency")})]})]}),(0,f.jsxs)("div",{className:"flex items-center space-x-2",children:[je(e.id)>0&&(0,f.jsxs)(x.E,{variant:"outline",className:"text-xs",children:[je(e.id)," ",I("categorySelection.selected")]}),(0,f.jsxs)("span",{className:"text-sm text-gray-500",children:[(null===(s=e.subcategories)||void 0===s?void 0:s.length)||0," ",I("categorySelection.subcategories"),X.length>=3&&(()=>{const s=(0,p.H3)(e,E)||[];return(e.subcategories&&e.subcategories.some(e=>e.toLowerCase().includes(X.toLowerCase()))||Array.isArray(s)&&s.some(e=>e.toLowerCase().includes(X.toLowerCase())))&&(0,f.jsx)("span",{className:"ml-1 text-blue-600",children:I("categorySelection.containsMatches")})})()]})]})]})}),_.has(e.id)&&e.subcategories&&(s=>{const t=e.subcategories||[],a=null===(s=e.translatedSubCategories)||void 0===s?void 0:s[E];let i={};return a&&(Array.isArray(a)?t.forEach((e,s)=>{a[s]&&(i[e]=a[s])}):"object"===typeof a&&(i=a)),(0,f.jsx)("div",{className:"border-t border-gray-200 bg-white",children:(0,f.jsx)("div",{className:"p-4",children:(0,f.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:t.map((s,t)=>{const a=i[s]||s;return(0,f.jsxs)("label",{className:`flex items-center space-x-3 p-3 rounded-lg border cursor-pointer transition-colors ${fe(s)?"border-blue-500 bg-blue-50":"border-gray-200 hover:border-gray-300 hover:bg-gray-50"} ${w?"opacity-50 cursor-not-allowed":""}`,children:[(0,f.jsx)("input",{type:"checkbox",checked:fe(s),onChange:()=>{ye(s,e.id)},disabled:w,className:"w-4 h-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500"}),(0,f.jsx)("div",{className:"flex-1",children:(0,f.jsx)("div",{className:"font-medium text-sm",children:be(a,X)})})]},`${e.id}-${t}`)})})})})})()]},e.id)})})}):(0,f.jsxs)("div",{className:"text-center py-8 text-gray-500",children:[(0,f.jsx)(u.A,{className:"w-12 h-12 mx-auto mb-2 text-gray-300"}),(0,f.jsx)("p",{children:I("categorySelection.noCategoriesAvailable")}),(0,f.jsx)("p",{className:"text-sm text-gray-400 mt-1",children:I("categorySelection.categoriesAddedByAdmin")})]})]}),(s.length>0||t.length>0)&&(0,f.jsxs)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:[(0,f.jsx)("h3",{className:"text-sm font-medium text-blue-800 mb-3",children:I("categorySelection.selectedCategoriesTitle")}),(0,f.jsxs)("div",{className:"space-y-2",children:[s.length>0&&(0,f.jsxs)("div",{children:[(0,f.jsx)("span",{className:"text-xs font-medium text-blue-700",children:I("categorySelection.categoriesLabel")}),(0,f.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:s.map(e=>{const s=U.find(s=>s.id===e.id)||e,t=(0,p.aZ)(s,E);return(0,f.jsxs)(x.E,{variant:"outline",className:"text-xs bg-blue-100 border-blue-300 text-blue-800 flex items-center gap-1",children:[t,!w&&(0,f.jsx)("button",{type:"button",onClick:s=>{s.preventDefault(),s.stopPropagation(),ve(e)},className:"ml-1 hover:text-blue-600",children:(0,f.jsx)(m.A,{className:"w-3 h-3"})})]},e.id)})})]}),t.length>0&&(0,f.jsxs)("div",{children:[(0,f.jsx)("span",{className:"text-xs font-medium text-blue-700",children:I("categorySelection.subcategoriesLabel")}),(0,f.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:t.map(e=>{const s=U.find(s=>s.subcategories&&s.subcategories.includes(e.name));let t=e.name;if(s){var a;const i=null===(a=s.translatedSubCategories)||void 0===a?void 0:a[E];if(i)if(Array.isArray(i)){const a=(s.subcategories||[]).indexOf(e.name);-1!==a&&i[a]&&(t=i[a])}else"object"===typeof i&&(t=i[e.name]||e.name)}return(0,f.jsxs)(x.E,{variant:"outline",className:"text-xs bg-green-100 border-green-300 text-green-800 flex items-center gap-1",children:[t,!w&&(0,f.jsx)("button",{type:"button",onClick:s=>{s.preventDefault(),s.stopPropagation(),ye(e.name,"")},className:"ml-1 hover:text-green-600",children:(0,f.jsx)(m.A,{className:"w-3 h-3"})})]},e.id)})})]})]})]})]}),(0,f.jsx)(h.lG,{open:ae,onOpenChange:ie,children:(0,f.jsxs)(h.Cf,{children:[(0,f.jsxs)(h.c7,{className:"flex justify-between items-center",children:[(0,f.jsx)(h.L3,{children:I("categorySelection.addNewCategory")}),(0,f.jsx)(g.A,{variant:"ghost",size:"icon",className:"h-6 w-6 rounded-full",onClick:()=>ie(!1),children:(0,f.jsx)(m.A,{className:"h-4 w-4"})})]}),(0,f.jsxs)("div",{className:"space-y-4",children:[(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"text-sm font-medium",children:I("categorySelection.categoryName")}),(0,f.jsx)(v.p,{value:ne,onChange:e=>oe(e.target.value),placeholder:I("categorySelection.categoryNamePlaceholder"),className:"mt-1"})]}),(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"text-sm font-medium",children:I("categorySelection.subcategoriesCommaSeparated")}),(0,f.jsx)(v.p,{value:ue,onChange:e=>me(e.target.value),placeholder:I("categorySelection.subcategoriesPlaceholder"),className:"mt-1"})]}),(0,f.jsxs)("div",{className:"flex justify-end space-x-2",children:[(0,f.jsx)(g.A,{variant:"outline",onClick:()=>ie(!1),children:I("categorySelection.cancel")}),(0,f.jsx)(g.A,{onClick:async()=>
1{if(!ne.trim())return;const e=ue.split(",").map(e=>e.trim()).filter(e=>""!==e),s={name:ne.trim(),description:"",requirements:[],subcategories:e,isRequireVerification:!0,isEmergency:!1,type:{id:Number(A)}},t=await C((0,r.Yo6)({data:s}));r.Yo6.fulfilled.match(t)&&A&&(await he(A),oe(""),me(""),ie(!1))},children:I("categorySelection.addCategory")})]})]})]})})]})}},65242(e,s,t){t.d(s,{A:()=>g});var a=t(5544),i=t(9950),l=t(40978),r=t(10300),n=t(98932),o=t(42461),c=t(16255),d=t(26110),u=t(86400),m=t(64767),x=t(44414);function g(e){let s=e.userId,t=e.showEditIcon,g=void 0===t||t;const h=(0,m.Bd)().t,v=(0,r.d4)(e=>e.auth).user,y=(0,i.useState)(!1),p=(0,a.A)(y,2),f=p[0],b=p[1],j=(0,u.jLQ)(),N=(0,i.useState)([]),w=(0,a.A)(N,2),A=w[0],S=w[1],C=(0,i.useState)([]),k=(0,a.A)(C,2),I=k[0],E=k[1],D=(0,r.d4)(e=>e.professional).certificates,T=s||(null===v||void 0===v?void 0:v.id);(0,i.useEffect)(()=>{if(!D)return;const e=D.map(e=>({id:e.id,name:e.name,issuer:e.issuer,issueDate:new Date(e.issueDate).getFullYear().toString(),expiryDate:e.expiryDate?new Date(e.expiryDate).getFullYear().toString():null}));E(e),S(e)},[D]),(0,i.useEffect)(()=>{L()},[T]);const L=async()=>{await j((0,u.UVG)({id:T}))};return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(c.Ay,{color:void 0,className:"p-6",children:[(0,x.jsxs)("div",{className:"flex justify-between items-start mb-4",children:[(0,x.jsx)("h2",{className:"text-lg font-semibold",children:h("certificate.title")}),g&&(0,x.jsx)(o.A,{variant:"ghost",size:"sm",className:"text-blue-600 hover:text-blue-700",onClick:()=>{b(!0)},children:(0,x.jsx)(l.A,{className:"w-4 h-4"})})]}),(0,x.jsx)("div",{className:"space-y-4",children:A.map((e,s)=>(0,x.jsxs)("div",{className:"border rounded-lg p-4",children:[(0,x.jsx)("h3",{className:"font-medium text-gray-900",children:e.name}),(0,x.jsx)("p",{className:"text-sm text-gray-600",children:e.issuer}),(0,x.jsxs)("div",{className:"flex justify-between items-center mt-2 text-sm text-gray-500",children:[(0,x.jsxs)("span",{children:[h("certificate.issued")," ",e.issueDate]}),(0,x.jsxs)("span",{children:[h("certificate.expires")," ",e.expiryDate]})]})]},s))})]}),(0,x.jsx)(d.A,{open:f,onClose:()=>{b(!1)},onSave:async e=>{const s=e.filter(e=>!e.id),t=e.filter(e=>e.id);let a=0;for(const r of t){const e=I.find(e=>e.id===r.id);if(!(r.name!==(null===e||void 0===e?void 0:e.name)||r.issuer!==(null===e||void 0===e?void 0:e.issuer)||r.issueDate!==(null===e||void 0===e?void 0:e.issueDate)||r.expiryDate!==(null===e||void 0===e?void 0:e.expiryDate)))continue;const s={userId:{id:T},name:r.name,issuer:r.issuer,issueDate:r.issueDate,expiryDate:r.expiryDate};await j((0,u.gcO)({id:r.id,data:s})),a++}let i=[];if(s.length>0){const e=s.map(e=>({userId:{id:T},name:e.name,issueDate:e.issueDate,issuer:e.issuer,expiryDate:e.expiryDate})),t=await j((0,u.bvP)({data:e}));u.bvP.fulfilled.match(t)&&(i=t.payload.map(e=>({...e,issueDate:new Date(e.issueDate).getFullYear().toString(),expiryDate:e.expiryDate?new Date(e.expiryDate).getFullYear().toString():null})))}const l=[...t,...i];S(l),E(l),a>0&&0===s.length&&n.dI.showToast("success",h("certificate.successTitle"),h("certificate.updateSuccess"))},initialData:A})]})}},87117(e,s,t){t.d(s,{A:()=>g});var a=t(5544),i=t(9950),l=t(98932),r=t(42461),n=t(16255),o=t(86400),c=t(12599),d=t(40978),u=t(10300),m=t(64767),x=t(44414);function g(e){let s=e.userId,t=e.showEditIcon,g=void 0===t||t;const h=(0,m.Bd)().t,v=(0,u.d4)(e=>e.professional).education,y=(0,u.d4)(e=>e.auth).user,p=(0,i.useState)(!1),f=(0,a.A)(p,2),b=f[0],j=f[1],N=(0,i.useState)(null),w=(0,a.A)(N,2),A=w[0],S=w[1],C=(0,o.jLQ)(),k=(0,i.useState)([]),I=(0,a.A)(k,2),E=I[0],D=I[1],T=(0,i.useState)([]),L=(0,a.A)(T,2),U=L[0],M=L[1],F=s||(null===y||void 0===y?void 0:y.id);(0,i.useEffect)(()=>{if(!v)return;const e=v.map(e=>({id:e.id,degree:e.degree,school:e.school,year:new Date(e.createdAt).getFullYear().toString(),createdAt:e.createdAt,updatedAt:e.updatedAt,userId:e.userId}));M(e),D(e)},[v]),(0,i.useEffect)(()=>{B()},[F]);const B=async()=>{await C((0,o.C38)({id:F}))};return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(n.Ay,{color:void 0,className:"p-6",children:[(0,x.jsxs)("div",{className:"flex justify-between items-start mb-4",children:[(0,x.jsx)("h2",{className:"text-lg font-semibold",children:h("education.title")}),g&&(0,x.jsx)(r.A,{variant:"ghost",size:"sm",className:"text-blue-600 hover:text-blue-700",onClick:()=>{S(E),j(!0)},children:(0,x.jsx)(d.A,{className:"w-4 h-4"})})]}),(0,x.jsx)("div",{className:"space-y-4",children:(E||[]).map((e,s)=>(0,x.jsxs)("div",{className:"border-l-2 border-gray-200 pl-4 py-2",children:[(0,x.jsx)("h3",{className:"font-medium text-gray-900",children:e.degree}),(0,x.jsx)("p",{className:"text-sm text-gray-600",children:e.school}),(0,x.jsx)("p",{className:"text-sm text-gray-500",children:e.year})]},s))})]}),(0,x.jsx)(c.A,{open:b,onClose:()=>{j(!1)},onSave:async e=>{const s=e.filter(e=>!e.id),t=e.filter(e=>e.id);let a=0;for(const l of t){const e=U.find(e=>e.id===l.id);if(!(l.degree!==(null===e||void 0===e?void 0:e.degree)||l.school!==(null===e||void 0===e?void 0:e.sc
1hool)||l.year!==(null===e||void 0===e?void 0:e.year)))continue;const s={userId:{id:F},degree:l.degree,school:l.school,year:Number(l.year)};await C((0,o.d3R)({id:l.id,data:s})),a++}let i=[];if(s.length>0){const e=s.map(e=>({userId:{id:F},degree:e.degree,school:e.school,year:Number(e.year)})),t=await C((0,o.IL7)({data:e}));o.IL7.fulfilled.match(t)&&(i=t.payload)}const r=[...t,...i];D(r),M(r),a>0&&0===s.length&&l.dI.showToast("success",h("education.successTitle"),h("education.updateSuccess"))},initialData:A})]})}},4133(e,s,t){t.d(s,{A:()=>y});var a=t(5544),i=t(9950),l=t(10300),r=t(98932),n=t(86400),o=t(40978),c=t(77708),d=t(42461),u=t(16255),m=t(99884),x=t(49164),g=t(64767),h=t(44414);const v={monday:{start:"",end:"",active:!1},tuesday:{start:"",end:"",active:!1},wednesday:{start:"",end:"",active:!1},thursday:{start:"",end:"",active:!1},friday:{start:"",end:"",active:!1},saturday:{start:"",end:"",active:!1},sunday:{start:"",end:"",active:!1}};function y(e){let s=e.userId,t=e.isModalOpen,y=e.onModalOpen,p=e.onModalClose,f=e.showEmergencyHoursModal,b=e.onEmergencyHoursModalOpen,j=e.onEmergencyHoursModalClose,N=e.onEmergencyHoursSaved,w=e.showEditIcon,A=void 0===w||w;const S=(0,g.Bd)().t,C=(0,n.jLQ)(),k=(0,l.d4)(e=>e.auth).user,I=(0,l.d4)(e=>e.professional).emergencyAvailabilities,E=s||(null===k||void 0===k?void 0:k.id),D=(0,i.useState)(!1),T=(0,a.A)(D,2),L=T[0],U=T[1],M=(0,i.useState)(v),F=(0,a.A)(M,2),B=F[0],$=F[1],H=(0,i.useState)(v),O=(0,a.A)(H,2),P=O[0],_=O[1],z=(0,i.useState)(()=>localStorage.getItem("timeFormat")||"12"),R=(0,a.A)(z,2),Q=(R[0],R[1]),W=void 0!==t,Z=W?t:L,q=()=>{Q(localStorage.getItem("timeFormat")||"12"),W?null===p||void 0===p||p():U(!1)};(0,i.useEffect)(()=>{if(I&&I.length>0){const e={...v};I.forEach(s=>{var t;const a=null===(t=s.day)||void 0===t?void 0:t.toLowerCase();e[a]&&(e[a]={id:s.id,start:(0,r.SK)(new Date(s.startAt)).substring(11,16),end:(0,r.SK)(new Date(s.endAt)).substring(11,16),active:s.isAvailable})}),_(e),$(e)}else _(v),$(v)},[I]),(0,i.useEffect)(()=>{J()},[E]);const J=async()=>{E&&await C((0,n.Poc)({id:E}))};return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(u.Ay,{color:void 0,className:"p-6 border-red-500",children:[(0,h.jsxs)("div",{className:"flex justify-between items-start mb-4",children:[(0,h.jsx)("h2",{className:"text-xl font-semibold text-red-500",children:S("emergencyAvailability.title")}),A&&(0,h.jsx)(d.A,{variant:"ghost",size:"sm",className:"text-blue-600 hover:text-blue-700",onClick:()=>(()=>{var e;Number(null===k||void 0===k||null===(e=k.role)||void 0===e?void 0:e.id)!==x.Uv.internationl_professional?I&&I.length>0?W?null===y||void 0===y||y():U(!0):b&&b():r.dI.showToast("info","",S("emergencyAvailability.internationalNotAllowed"))})(),children:(0,h.jsx)(o.A,{className:"w-4 h-4"})})]}),(0,h.jsx)("div",{className:"space-y-4",children:(0,h.jsxs)("div",{children:[(0,h.jsx)("h3",{className:"font-medium mb-2",children:S("emergencyAvailability.emergencyHours")}),(0,h.jsx)("div",{className:"grid grid-cols-1 gap-4",children:Object.entries(B).map(e=>{let s=(0,a.A)(e,2),t=s[0],i=s[1];return i.active&&(0,h.jsxs)("div",{className:"flex items-center justify-between",children:[(0,h.jsx)("span",{children:S(`availabilityModal.days.${t}`)}),(0,r.fU)(i.start)," - ",(0,r.fU)(i.end)]},t)})})]})})]}),(0,h.jsx)(c.A,{isEmergency:!0,open:Z,regularHours:B,handleSave:async e=>{const s=[];let t=0,i=!1;for(const a in e){const s=e[a];!s.active||s.start&&s.end||(r.dI.showToast("error",S("emergencyAvailability.validationError"),S("emergencyAvailability.setBothTimes",{day:a.charAt(0).toUpperCase()+a.slice(1)})),i=!0)}if(!i){for(const i in e){const l=P[i],r=e[i];if(!(l.start!==r.start||l.end!==r.end||l.active!==r.active))continue;if(!r.active)continue;const o=new Date,c=new Date,d=r.start.split(":"),u=(0,a.A)(d,2),m=u[0],x=u[1],g=r.end.split(":"),h=(0,a.A)(g,2),v=h[0],y=h[1];o.setHours(+m,+x),c.setHours(+v,+y);const p={isEmergency:!0,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,userId:{id:null===k||void 0===k?void 0:k.id},startAt:o.toISOString(),endAt:c.toISOString(),isAvailable:r.active,day:i.charAt(0).toUpperCase()+i.slice(1)};r.id?(await C((0,n.Gol)({id:r.id,data:p})),t++):s.push(p)}if(s.length>0)try{await C((0,n.P71)({data:s})),r.dI.showToast("success",S("emergencyAvailability.success"),s.length>1?S("emergencyAvailability.newAvailabilitiesCreated"):S("emergencyAvailability.newEmergencyCreated"))}catch(l){r.dI.showToast("error",S("emergencyAvailability.error"),S("emergencyAvailability.failedToCreate"))}t>0&&r.dI.showToast("success",S("emergencyAvailability.success"),S(t>1?"emergencyAvailability.availabilitiesUpdated":"emergencyAvailability.availabilityUpdated")),(s.length>0||t>0)&&q()}},onClose:q,onEmergencyHoursSaved:N,onEmergencyDataReset:()=>{J()}}),f&&(0,h.jsx)(m.K,{isOpen:f,onClose:j||(()=>{}),onConfirm:()=>{null===j||void 0===j||j(),W?null===y||void 0===y||y():U(!0)}})]})}},19207(e,s,t){t.d(s,{A:()=>h});var a=t(5544),i=t(9950),l=t(10300),r=t(40978),n=t(86311),o=t(86400),c=t(98932),d=t(50951),u=t(42461),m=t(16255),x=t(64767),g=t(44414);function h(e){let s=e.userId,t=e.showEditIcon,h=void 0===t||t;const v=(0,x.Bd)().t,y=(0,i.useState)(!1),p=(0,a.A)(y,2),f=p[0],b=p[1],j=(0,i.useState)(null),N=(0,a.A)(j,2),w=N[0],A=N[1],S=(0,i.useState)([]),C=(0,a.A)(S,2),k=C[0],I=C[1],E=(0,i.useState)([]),D=(0,a.A)(E,2),T=D[0],L=D[1],U=(0,o.jLQ)(),M=(0,l.d4)(e=>e.professional).experience,F=(0,l.d4)(e=>e.auth).user,B=s||(null===F||void 0===F?void 0:F.id);(0,i.useEffect)(()=>{$()},[B]);const $=async()=>{await U((0,o.ugs)({id:B}))};return(0,i.useEffect)(()=>{M&&(I(M),L(M))},[M]),(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(m.Ay,{color:void 0,className:"p-6",children:[(0,g.jsxs)("div",{className:"flex justify-between items-start mb-4",children:[(0,g.jsx)("h2",{className:"text-xl font-semibold",children:v("experience.title")}),h&&(0,g.jsx)(u.A,{variant:"ghost",size:"sm",className:"text-blue-600 hover:text-blue-700",onClick:()=>{A(k),b(!0)},children:(0,g.jsx)(r.A,{className:"w-4 h-4"})})]}),(0,g.jsx)("div",{className:"space-y-6",children:k.map((e,s)=>(0,g.jsxs)("div",{className:"border-l-2 border-gray-200 pl-4 py-2",children:[(0,g.jsx)("div",{children:(0,g.jsx)("h3",{className:"font-medium text-gray-900",children:e.title})}),(0,g.jsx)("p",{className:"text-sm text-gray-600",children:e.company}),(0,g.jsx)("p",{className:"text-sm text-gray-500",children:e.period}),(0,g.jsx)("p",{className:"mt-2 text-gray-600",children:e.description}),(0,g.jsx)("ul",{className:"mt-2 space-y-1",children:e.achievements.map((e,s)=>(0,g.jsxs)("li",{className:"flex items-start gap-2 text-sm text-gray-600",children:[(0,g.jsx)(n.A,{className:"w-4 h-4 text-green-500 mt-1"}),(0,g.jsx)("span",{children:e})]},s))})]},s))})]}),(0,g.jsx)(d.A,{open:f,onClose:()=>b(!1),onSave:async e=>{const s=e.filter(e=>!e.id),t=e.filter(e=>e.id);let a=0;for(const r of t){const e=T.find(e=>e.id===r.id);if(!(r.title!==(null===e||void 0===e?void 0:e.title)||r.company!==(null===e||void 0===e?void 0:e.company)||r.period!==(null===e||void 0===e?void 0:e.period)||r.description!==(null===e||void 0===e?void 0:e.description)||JSON.stringify(r.achievements||[])!==JSON.stringify((null===e||void 0===e?void 0:e.achievements)||[])))continue;const s={userId:{id:B},achievements:r.achievements||[],description:r.description,company:r.company,peri
1od:r.period,title:r.title};await U((0,o.Fvh)({id:r.id,data:s})),a++}let i=[];if(s.length>0){const e=s.map(e=>({userId:{id:B},achievements:e.achievements||[],description:e.description,period:e.period,company:e.company,title:e.title})),t=await U((0,o.Uaw)({data:e}));o.Uaw.fulfilled.match(t)&&(i=t.payload)}const l=[...t,...i];I(l),L(l),a>0&&0===s.length&&c.dI.showToast("success",v("experience.successTitle"),v("experience.updateSuccess"))},initialData:w})]})}},87550(e,s,t){t.d(s,{A:()=>x});var a=t(5544),i=t(9950),l=t(64767),r=t(31855),n=(t(60348),t(10300)),o=t(86400),c=t(7732),d=t(89051),u=t(83955),m=t(44414);const x=e=>{let s=e.userId,t=e.role,x=e.selectedServiceAreas,g=void 0===x?[]:x;const h=(0,l.Bd)().t,v=(0,o.jLQ)(),y=(0,n.d4)(e=>e.auth).user,p=s||(null===y||void 0===y?void 0:y.id),f=(0,i.useState)(g||[]),b=(0,a.A)(f,2),j=b[0],N=b[1],w=(0,i.useMemo)(()=>t,[t]),A=(0,i.useMemo)(()=>w===u.Uv.internationl_professional?2:(u.Uv.professional,1),[w]),S=(0,i.useState)(A),C=(0,a.A)(S,2),k=C[0],I=C[1];return(0,i.useEffect)(()=>{g&&0!==g.length||(async()=>{if(p)try{const e=await v((0,c.jD)({userId:String(p),type:d.j8.Profile})).unwrap(),s=(null===e||void 0===e?void 0:e.serviceAreaIds)||[];N(Array.isArray(s)?s:[])}catch(e){N([])}})()},[v,p,g]),(0,i.useEffect)(()=>{I(A)},[A]),(0,i.useEffect)(()=>{Array.isArray(g)&&N(g)},[g]),j&&0!==j.length?(0,m.jsxs)("div",{className:"space-y-4",children:[(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[(0,m.jsx)(r.A,{className:"w-5 h-5 text-blue-600"}),(0,m.jsx)("h3",{className:"text-lg font-semibold",children:h("internationalServiceAreas.workplaces")})]}),(0,m.jsx)("div",{className:"grid grid-cols-1 gap-3",children:j.slice(0,k).map(e=>{var s,t;return(0,m.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg p-4 hover:shadow-md transition-shadow",children:[(0,m.jsxs)("div",{className:"flex items-start justify-between mb-2",children:[(0,m.jsx)("h4",{className:"font-medium text-gray-900",children:e.name||h("internationalServiceAreas.area")}),!1]}),(0,m.jsx)("p",{className:"text-sm text-gray-600 mb-2",children:null!==e&&void 0!==e&&e.province&&null!==e&&void 0!==e&&null!==(s=e.country)&&void 0!==s&&s.name?`${e.province}, ${e.country.name}`:(null===e||void 0===e||null===(t=e.country)||void 0===t?void 0:t.name)||""})]},String(e.id))})}),j.length>A&&t===u.Uv.internationl_professional&&(0,m.jsxs)("div",{className:"flex items-center gap-3",children:[k<j.length&&(0,m.jsx)("button",{onClick:()=>I(j.length),className:"text-blue-600 hover:text-blue-700 text-sm underline",children:h("internationalServiceAreas.showMore")}),k>A&&(0,m.jsx)("button",{onClick:()=>I(A),className:"text-blue-600 hover:text-blue-700 text-sm underline",children:h("internationalServiceAreas.showLess")})]})]}):(0,m.jsx)("div",{className:"bg-gray-50 border border-gray-200 rounded-lg p-6 text-center",children:(0,m.jsx)("p",{className:"text-gray-600",children:h("internationalServiceAreas.noWorkplaceConfigured")})})}},77139(e,s,t){t.d(s,{A:()=>v});var a=t(5544),i=t(9950),l=t(86400),r=t(10300),n=t(1361),o=t(40978),c=t(29126),d=t(98932),u=t(42461),m=t(16255),x=t(60348),g=t(64767),h=t(44414);function v(e){let s=e.userId,t=e.showEditIcon,v=void 0===t||t;const y=(0,g.Bd)().t,p=(0,i.useState)(!1),f=(0,a.A)(p,2),b=f[0],j=f[1],N=(0,i.useState)(null),w=(0,a.A)(N,2),A=w[0],S=w[1],C=(0,i.useState)([]),k=(0,a.A)(C,2),I=k[0],E=k[1],D=(0,i.useState)([]),T=(0,a.A)(D,2),L=T[0],U=T[1],M=(0,l.jLQ)(),F=(0,r.d4)(e=>e.professional).portfolio,B=(0,r.d4)(e=>e.auth).user,$=s||(null===B||void 0===B?void 0:B.id);(0,i.useEffect)(()=>{F&&(E(F),U(F))},[F]),(0,i.useEffect)(()=>{H()},[$]);const H=async()=>{await M((0,l.KyB)({id:$}))};return(0,i.useEffect)(()=>{F&&E(F)},[F]),(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(m.Ay,{color:void 0,className:"p-6",children:[(0,h.jsxs)("div",{className:"flex justify-between items-start mb-4",children:[(0,h.jsx)("h2",{className:"text-xl font-semibold",children:y("portfolio.title")}),v&&(0,h.jsx)(u.A,{variant:"ghost",size:"sm",className:"text-blue-600 hover:text-blue-700",onClick:()=>{S(I),j(!0)},children:(0,h.jsx)(o.A,{className:"w-4 h-4"})})]}),(0,h.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:null===I||void 0===I?void 0:I.map((e,s)=>{var t;return(0,h.jsxs)("div",{className:"border rounded-xl overflow-hidden",children:[(0,h.jsx)("img",{src:"https://bloomidea.com/sites/default/files/styles/og_image/public/blog/Tipos%20de%20come%CC%81rcio%20electro%CC%81nico_0.png?itok=jC9MlQZq",alt:null===e||void 0===e?void 0:e.title,className:"w-full h-48 object-cover"}),(0,h.jsxs)("div",{className:"p-4",children:[(0,h.jsx)("h3",{className:"font-medium text-lg mb-2",children:e.title}),(0,h.jsx)("p",{className:"text-gray-600 text-sm mb-4",children:e.description}),(0,h.jsx)("div",{className:"flex flex-wrap gap-2 mb-4",children:null===e||void 0===e||null===(t=e.technology)||void 0===t?void 0:t.map((e,s)=>(0,h.jsx)(x.E,{variant:void 0,className:"bg-blue-50 text-blue-700",children:e},s))}),(0,h.jsxs)(u.A,{variant:"outline",className:"w-full flex items-center justify-center gap-2",onClick:()=>window.open(e.link,"_blank"),children:[(0,h.jsx)(c.A,{className:"w-4 h-4"}
1),y("portfolio.viewProject")]})]})]},s)})})]}),(0,h.jsx)(n.A,{open:b,onClose:()=>j(!1),onSave:async e=>{const s=L.map(e=>e.id),t=e.filter(e=>!e.id),a=e.filter(e=>e.id&&s.includes(e.id));let i=0;for(const o of a){const e=L.find(e=>e.id===o.id);if((null===e||void 0===e?void 0:e.title)!==o.title||(null===e||void 0===e?void 0:e.description)!==o.description||(null===e||void 0===e?void 0:e.link)!==o.link||JSON.stringify((null===e||void 0===e?void 0:e.technology)||[])!==JSON.stringify(o.technology||[])){const e={userId:{id:$},title:o.title,description:o.description,link:o.link,technology:o.technology||[]};await M((0,l.PX4)({id:o.id,data:e})),i++}}let r=[];if(t.length>0){const e=t.map(e=>({userId:{id:$},title:e.title,description:e.description,link:e.link,technology:e.technology||[]})),s=await M((0,l.uZ8)({data:e}));l.uZ8.fulfilled.match(s)&&(r=s.payload)}const n=[...e.filter(e=>e.id&&s.includes(e.id)),...r];E(n),U(n),i>0&&0===t.length&&d.dI.showToast("success",y("toast.titles.success"),y("toast.portfolio.updated"))},initialData:A})]})}},84999(e,s,t){t.d(s,{A:()=>m});var a=t(5544),i=t(9950),l=t(31855),r=t(60348),n=t(10300),o=t(49164),c=t(86400),d=t(64767),u=t(44414);const m=e=>{var s,t;let m=e.userId,x=e.selectedServiceAreas,g=void 0===x?[]:x;e.onEdit,e.showEditIcon;const h=(0,d.Bd)().t,v=(0,n.d4)(e=>e.auth).user,y=m||(null===v||void 0===v?void 0:v.id),p=(0,c.jLQ)(),f=(0,i.useState)(null),b=(0,a.A)(f,2),j=b[0],N=b[1];return(0,i.useEffect)(()=>{(async()=>{if(y){const e=await p((0,c.klJ)({id:y}));N(e.payload)}})()},[y]),Number(null===v||void 0===v||null===(s=v.role)||void 0===s?void 0:s.id)===o.Uv.internationl_professional||Number(null===j||void 0===j||null===(t=j.role)||void 0===t?void 0:t.id)===o.Uv.internationl_professional?(0,u.jsx)("div",{className:"bg-gray-50 border border-gray-200 rounded-lg p-6 text-center",children:(0,u.jsx)("h1",{children:h("serviceAreaDisplay.internationalProMessage")})}):g&&0!==g.length?(0,u.jsx)("div",{className:"space-y-4",children:(0,u.jsxs)("div",{children:[(0,u.jsx)("div",{className:"flex items-center justify-between mb-3",children:(0,u.jsxs)("h3",{className:"text-lg font-semibold flex items-center gap-2",children:[(0,u.jsx)(l.A,{className:"w-5 h-5 text-blue-600"}),h("serviceAreaDisplay.serviceAreas")]})}),(0,u.jsx)("div",{className:"grid grid-cols-1 gap-3",children:null===g||void 0===g?void 0:g.map(e=>{var s;return(0,u.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg p-4 hover:shadow-md transition-shadow",children:[(0,u.jsx)("div",{className:"flex items-start justify-between mb-2",children:(0,u.jsxs)("div",{className:"flex items-start justify-between mb-2",children:[(0,u.jsx)("h4",{className:"font-medium text-gray-900",children:e.name}),!1]})}),(0,u.jsx)("p",{className:"text-sm text-gray-600 mb-3",children:e.province&&null!==(s=e.country)&&void 0!==s&&s.name?`${e.province}, ${e.country.name}`:h("serviceAreaDisplay.locationNotAvailable")}),e.serviceTypes&&e.serviceTypes.length>0&&(0,u.jsxs)("div",{children:[(0,u.jsx)("div",{className:"text-xs font-medium text-gray-500 mb-2 uppercase tracking-wide",children:h("serviceAreaDisplay.serviceTypes")}),(0,u.jsx)("div",{className:"flex flex-wrap gap-1",children:(e.serviceTypes.filter(e=>"Emergency Services"!==e).length>0?e.serviceTypes.filter(e=>"Emergency Services"!==e):["General Services"]).map((s,t)=>(0,u.jsx)(r.E,{variant:"outline",className:"text-xs",children:"Emergency Services"===s?h("serviceAreaDisplay.emergencyServicesType"):"General Services"===s?h("serviceAreaDisplay.generalServicesType"):"International Services"===s?h("serviceAreaDisplay.internationalServicesType"):"Any available service"===s?h("serviceAreaDisplay.serviceTypeAnyAvailable"):s},`${e.id}-${t}`))})]})]},e.id)})})]})}):(0,u.jsx)("div",{className:"bg-gray-50 border border-gray-200 rounded-lg p-6 text-center",children:(0,u.jsx)("h1",{children:h("serviceAreaDisplay.noServiceAreasSelected")})})}},22843(e,s,t){t.d(s,{A:()=>b});var a=t(5544),i=t(9950),l=t(10300),r=t(86400),n=t(19618),o=t(37043),c=t(31855),d=t(13147),u=t(96479),m=t(60348),x=t(42461),g=t(33184),h=t(67871),v=t(98932),y=t(64767),p=t(67406),f=t(44414);const b=e=>{let s=e.selectedServiceAreas,t=e.professionalType,b=e.onServiceAreasChange,j=e.disabled,N=void 0!==j&&j;
1const w=(0,y.Bd)(),A=w.t,S=w.i18n,C=(0,r.jLQ)(),k=(0,i.useState)(""),I=(0,a.A)(k,2),E=I[0],D=I[1],T=(0,i.useState)(!1),L=(0,a.A)(T,2),U=L[0],M=L[1],F=(0,i.useState)([]),B=(0,a.A)(F,2),$=B[0],H=B[1],O=(0,i.useState)(!1),P=(0,a.A)(O,2),_=(P[0],P[1]),z=((0,l.d4)(e=>e.auth).user,(0,i.useState)(!1)),R=(0,a.A)(z,2),Q=R[0],W=R[1],Z=(0,i.useState)(null),q=(0,a.A)(Z,2),J=q[0],K=q[1],Y=(0,i.useState)(!1),G=(0,a.A)(Y,2),V=G[0],X=G[1],ee=(0,i.useState)(!1),se=(0,a.A)(ee,2),te=se[0],ae=se[1],ie=(0,i.useRef)(null),le=(0,l.d4)(e=>e.admin).countries;(0,i.useEffect)(()=>{oe(),re()},[]),(0,i.useEffect)(()=>{le&&0!==le.length||C((0,o.oj)({isShowLoader:!1}))},[le,C]);const re=()=>{W(!0)};(0,i.useEffect)(()=>{if(E.length<2)return void X(!1);if(J&&E===J.formatted_address)return;let e=!0;const s=setTimeout(async()=>{const s=await(0,p.a)(E,S.language);e&&(s&&s.length>0?(K((0,p.k)(s[0])),X(!0)):X(!1))},400);return()=>{e=!1,clearTimeout(s)}},[E,S.language]);(0,i.useEffect)(()=>{ie.current&&window.google&&window.google.maps},[ie.current,window.google,S.language]);const ne=e=>{if(!e.type)return"Unknown Type";if("object"===typeof e.type&&e.type.name)return e.type.name;if("object"===typeof e.type&&e.type.id){const s=e.type.id;return{1:"Metropolitan Area",2:"City",3:"Region",4:"Province"}[s]||`Type ${s}`}if("number"===typeof e.type){return{1:"Metropolitan Area",2:"City",3:"Region",4:"Province"}[e.type]||`Type ${e.type}`}return"Unknown Type"},oe=async()=>{M(!0);try{const e=await C((0,n.xU)({page:1,limit:1e3,isShowLoader:!1})).unwrap();e&&e.data&&(console.log("Service areas fetched:",e.data),e.data.length>0&&(console.log("First service area structure:",e.data[0]),console.log("Type property:",e.data[0].type)),H(e.data))}catch(e){console.error("Error fetching service areas:",e)}finally{M(!1)}},ce=(0,i.useMemo)(()=>{if(!E||E.length<2)return[];const e=E.toLowerCase();return $.filter(s=>{var t;const a=s.name.toLowerCase().includes(e),i=s.province.toLowerCase().includes(e),l=(null===(t=s.country)||void 0===t||null===(t=t.name)||void 0===t?void 0:t.toLowerCase().includes(e))||!1,r=s.cities.some(s=>s.toLowerCase().includes(e));return a||i||l||r}).filter(e=>!s.some(s=>s.id===e.id))},[$,E,s]);return(0,f.jsxs)("div",{className:"space-y-4",children:[(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:t&&t===v.Uv.professional?A("serviceAreaSelection.serviceAreas"):A("serviceAreaSelection.myWorkplace")}),(0,f.jsxs)("div",{className:"relative",children:[(0,f.jsxs)("div",{className:"relative",children:[(0,f.jsx)("input",{ref:ie,type:"text",placeholder:A("serviceAreaSelection.searchPlaceholder"),value:E,onChange:e=>{const s=e.target.value;D(s),_(s.length>=2),s!==(null===J||void 0===J?void 0:J.formatted_address)&&(X(!1),K(null))},onFocus:()=>E.length>=2&&_(!0),onBlur:()=>setTimeout(()=>_(!1),200),className:"w-full px-4 py-2 pl-10 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-colors",disabled:N}),(0,f.jsx)("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:(0,f.jsx)(d.A,{className:"h-5 w-5 text-gray-400"})}),E&&(0,f.jsx)("button",{onClick:()=>{D(""),_(!1),X(!1),K(null)},className:"absolute inset-y-0 right-0 pr-3 flex items-center text-gray-400 hover:text-gray-600",disabled:N,children:(0,f.jsx)(u.A,{className:"h-5 w-5"})})]}),!Q&&(0,f.jsx)("div",{className:"mt-2 p-2 bg-yellow-50 border border-yellow-200 rounded-lg",children:(0,f.jsxs)("p",{className:"text-xs text-yellow-800",children:[(0,f.jsx)("strong",{children:"Note:"})," ",A("serviceAreaSelection.googleMapsNote")]})}),E.length>0&&E.length<2&&(0,f.jsx)("p",{className:"text-sm text-amber-600 mt-1",children:A("serviceAreaSelection.minCharactersWarning")}),!U&&E.length>=2&&ce.length>0&&(0,f.jsx)("p",{className:"text-sm text-gray-600 mt-1",children:A("serviceAreaSelection.foundResults",{count:ce.length,query:E,context:1===ce.length?"one":"other"})}),E.length>=2&&(0,f.jsxs)("div",{className:"absolute z-10 w-full mt-1 bg-white border border-gray-300 rounded-lg shadow-lg max-h-60 overflow-y-auto",children:[U&&(0,f.jsxs)("div",{className:"p-4 text-center text-gray-500",children:[(0,f.jsx)("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-500 mx-auto"}),(0,f.jsx)("p",{className:"mt-2",children:A("serviceAreaSelection.loadingServiceAreas")})]}),(ce.length>0||V)&&(0,f.jsxs)("div",{className:"py-2",children:[ce.length>0&&(0,f.jsxs)("div",{className:"border-b border-gray-200 pb-2 mb-2",children:[(0,f.jsx)("div",{className:"px-4 py-2 text-xs font-medium text-gray-500 uppercase tracking-wide",children:t&&t===v.Uv.professional?A("serviceAreaSelection.existingServiceAreas"):A("serviceAreaSelection.existingWorkplaces")}),ce.map(e=>{var t;return(0,f.jsx)("button",{onClick:()=>{return t=e,s.some(e=>e.id===t.id)||b([...s,t]),D(""),_(!1),void X(!1);var t},className:"w-full px-4 py-3 text-left hover:bg-gray-50 focus:bg-gray-50 focus:outline-none transition-colors",children:(0,f.jsxs)("div",{className:"flex items-center gap-3",children:[(0,f.jsx)(c.A,{className:"w-4 h-4 text-gray-400 flex-shrink-0"}),(0,f.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,f.jsx)("div",{className:"font-medium text-gray-900 truncate",children:e.name}),(0,f.jsxs)("div",{className:"text-sm text-gray-500 truncate",children:[e.province,null!==(t=e.country)&&void 0!==t&&t.name?`, ${e.country.name}`:""]})]}),(0,f.jsx)(m.E,{variant:"outline",className:"text-xs",children:ne(e)})]})},e.id)})]}),0===ce.length&&V&&J&&(0,f.jsxs)("div",{className:"border-t border-gray-200 pt-2",children:[(0,f.jsx)("div",{className:"px-4 py-2 text-xs font-medium text-gray-500 uppercase tracking-wide",children:A("serviceAreaSelection.createNewServiceArea")}),(0,f.jsx)("div",{className:"p-3 bg-green-50 border border-green-200 rounded-lg mx-2 mb-2",children:(0,f.jsxs)("div",{className:"flex flex-row gap-2",children:[(0,f.jsxs)("div",{className:"flex-1",children:[(0,f.jsx)("p",{className:"text-xs font-medium text-green-800",children:A("serviceAreaSelection.selectedLocation")}),(0,f.jsx)("p",{className:"text-xs text-green-700 break-words",children:J.formatted_address})]}),(0,f.jsxs)("div",{className:"flex items-center gap-2",children:[(0,f.jsx)("button",{onClick:()=>{K(null),D(""),X(!1)},className:"p-1 text-gray-400 hover:text-gray-600",title:A("serviceAreaSelection.clearSelection"),children:(0,f.jsx)(u.A,{className:"h-4 w-4"})}),(0,f.jsx)(x.$,{onClick:()=>(async e=>{if(e&&e.geometry){ae(!0);try{const a=(0,h.WU)(e);let i="";if(a.country)try{i=await(0,h.Bl)(a.country,le||[],o.Fk,C)}catch(t){return console.error("Error handling country:",t),g.dI.showToast("error",A("toast.titles.error"),A("serviceAreaSelection.toastCountryError")),void ae(!1)}const l=a.city?[a.city]:[];let r=[];if(a.postalCode)r=[a.postalCode];else if(a.latitude&&a.longitude&&a.country){const e=(0,h.K7)(a.latitude,a.longitude,a.country,a.city);e&&(r=[e])}const c={name:e.formatted_address||a.city||"New Service Area",type:{id:2},radius:50,restrictions:[],cities:l,postalCodes:r,country:{id:i},serviceTypes:[A("generalServices")],emergencyServices:!1,province:a.province||"",latitude:a.latitude,longitude:a.longitude},d=await C((0,n.NW)({data:c}));if("fulfilled"!==d.meta.requestStatus)throw new Error("Failed to create service area");{const e=d.payload;b([...s,e]),D(""),X(!1),K(null),g.dI.showToast("success",A("toast.titles.success"),A("serviceAreaSelection.toastCreatedSuccess")),oe()}}catch(t){console.error("Error creating service area:",t),g.dI.showToast("error",A("toast.titles.error"),A("serviceAreaSelection.toastCreationFailed"))}finally{ae(!1)}}else g.dI.showToast("error",A("toast.titles.error"),A("serviceAreaSelection.toastInvalidLocation"))})(J),disabled:te||N,className:"px-3 py-1 text-xs bg-green-600 hover:bg-green-700 text-white rounded",children:te?(0,f.jsxs)("div",{className:"flex items-center gap-1",children:[(0,f.jsx)("div",{className:"animate-spin rounded-full h-3 w-3 border-b-2 border-white"}),(0,f.jsx)("span",{children:A("serviceAreaSelection.creating")})]}):A("serviceAreaSelection.createServiceAreaButton")})]})]})})]}),!U&&0===ce.length&&!V&&!Q&&(0,f.jsxs)("div",{className:"p-4 text-center text-gray-500",children:[(0,f.jsx)(c.A,{className:"w-8 h-8 mx-auto mb-2 text-gray-300"}),(0,f.jsx)("p",{children:A("serviceAreaSelection.noResultsFound",{query:E}
1)}),Q&&(0,f.jsx)("p",{className:"text-sm mt-1",children:A("serviceAreaSelection.tryAutocomplete")})]})]})]})]})]}),s.length>0&&(0,f.jsxs)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:[(0,f.jsx)("h3",{className:"text-sm font-medium text-blue-800 mb-3",children:t&&t===v.Uv.professional?A("serviceAreaSelection.selectedServiceAreas"):A("serviceAreaSelection.selectedWorkplaces")}),(0,f.jsx)("div",{className:"flex flex-wrap gap-2",children:s.map(e=>(0,f.jsxs)(m.E,{variant:"outline",className:"text-xs bg-blue-100 border-blue-300 text-blue-800 flex items-center gap-1",children:[(0,f.jsx)(c.A,{className:"w-3 h-3"}),e.name,!N&&(0,f.jsx)("button",{onClick:()=>(e=>{const t=s.filter(s=>s.id!==e);b(t)})(e.id),className:"ml-1 hover:text-blue-600",children:(0,f.jsx)(u.A,{className:"w-3 h-3"})})]},e.id))})]})]})}},19209(e,s,t){t.d(s,{A:()=>h});var a=t(5544),i=t(9950),l=t(98932),r=t(42461),n=t(16255),o=t(40978),c=t(86400),d=t(10300),u=t(11633),m=t(49164),x=t(64767),g=t(44414);function h(e){let s=e.userId,t=e.showEditIcon,h=void 0===t||t;const v=(0,x.Bd)().t,y=(0,c.jLQ)(),p=(0,d.d4)(e=>e.auth).user,f=(0,d.d4)(e=>e.professional).skills,b=s||(null===p||void 0===p?void 0:p.id),j=(0,i.useState)(!1),N=(0,a.A)(j,2),w=N[0],A=N[1],S=(0,i.useState)([]),C=(0,a.A)(S,2),k=C[0],I=C[1],E=(0,i.useState)([]),D=(0,a.A)(E,2),T=D[0],L=D[1],U=(0,i.useState)([]),M=(0,a.A)(U,2),F=M[0],B=M[1];(0,i.useEffect)(()=>{$()},[b]);const $=async()=>{await y((0,c.QOi)({id:b}));const e=(await y((0,c.jAs)({}))).payload;L(null===e||void 0===e?void 0:e.data)};return(0,i.useEffect)(()=>{if(!f)return;const e=f.map(e=>{var s,t,a;return{id:e.id,name:(null===(s=e.skillId)||void 0===s?void 0:s.name)||"Unnamed Skill",level:m.NI[parseInt(null===(t=e.level)||void 0===t?void 0:t.id)]||"Unknown",skillId:{id:null===e||void 0===e||null===(a=e.skillId)||void 0===a?void 0:a.id}}});B(e),I(e)},[f]),(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(n.Ay,{color:void 0,className:"p-6",children:[(0,g.jsxs)("div",{className:"flex justify-between items-start mb-4",children:[(0,g.jsx)("h2",{className:"text-xl font-semibold",children:v("skills.title")}),h&&(0,g.jsx)(r.A,{variant:"ghost",size:"sm",className:"text-blue-600 hover:text-blue-700",onClick:()=>A(!0),children:(0,g.jsx)(o.A,{className:"w-4 h-4"})})]}),(0,g.jsx)("div",{className:"space-y-4",children:F.length>0&&F.map(e=>{var s;return(0,g.jsx)("div",{className:"flex items-center justify-between",children:(0,g.jsxs)("div",{className:"flex-1",children:[(0,g.jsx)("div",{className:"flex items-center justify-between mb-1",children:(0,g.jsx)("span",{className:"font-medium text-gray-900",children:e.name})}),(0,g.jsxs)("div",{className:"flex items-center gap-2",children:[(0,g.jsx)("span",{className:"text-sm text-gray-500",children:v(`skills.levels.${null===e||void 0===e||null===(s=e.level)||void 0===s?void 0:s.toLowerCase()}`)}),(0,g.jsx)("div",{className:"flex-1 h-2 bg-gray-100 rounded-full",children:(0,g.jsx)("div",{className:"h-full bg-blue-600 rounded-full",style:{width:"Expert"===e.level?"100%":"Advanced"===e.level?"75%":"Intermediate"===e.level?"50%":"25%"}})})]})]})},e.id)})})]}),(0,g.jsx)(u.A,{open:w,skillsData:F,handleSave:async e=>{const s=e.filter(e=>!e.id),t=e.filter(e=>e.id);let a=0;for(const l of t){var i;const e=k.find(e=>e.id===l.id),s=m.kL[null===e||void 0===e?void 0:e.level.toLowerCase()];if(!(l.name!==(null===e||void 0===e?void 0:e.name)||Number(l.level)!==s))continue;const t={userId:{id:b},endorsements:0,skillId:{id:null===(i=l.skillId)||void 0===i?void 0:i.id},level:{id:Number(l.level)}};await y((0,c.JET)({id:l.id,data:t})),a++}let r=[];if(s.length>0){const e=s.map(e=>{var s;return{userId:{id:b},skillId:{id:null===(s=e.skillId)||void 0===s?void 0:s.id},endorsements:0,level:{id:void 0!=e.level.id?Number(e.level.id):Number(e.level)}}}),t=await y((0,c.bMy)({data:e}));c.bMy.fulfilled.match(t)&&(r=t.payload)}a>0&&l.dI.showToast("success",v("skills.successTitle"),v("skills.updateSuccess"))},allStaticSkills:T,onClose:()=>A(!1)})]})}}}]);

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.