1import{r as l,j as e,g as Pe,a as ns,e as as}from"./vendor-BYDWwPae.js";import{ce as Rs,dK as ls,dD as rs,b8 as Os,o as is,aY as pt,aZ as ht,a$ as os,cn as cs,ci as be,aD as Y,b7 as Ms,ao as ds,bG as $s,a0 as z,aa as rt,bm as Z,aP as zs,df as mt,cc as Hs,aq as De,cg as Gs,a2 as ft,bc as gt,ha as qs,hb as Us,bd as bt,aI as Vs,aJ as Ws,aK as Ys,aL as Zs,aM as zt,a1 as Be,ae as H,V as Xs,a7 as it,a3 as Ks,gg as Ht,cO as xs,bz as us,i as Ye,hc as Qs,hd as Js,he as en,hf as tn,w as sn,eu as nn,e_ as an,a8 as ln,ch as Ee,dM as rn,ar as Gt,hg as qt,az as Ze,aH as Ut,ag as on}from"./index-DJOi_ihA.js";import{c as cn,F as dn}from"./FiltersButton-B7iTFR7X.js";import{A as xn,s as un}from"./ApplyConfirmationModal-bTVkQgKb.js";import{C as pn,a as ot}from"./icons-CBAdbCdv.js";import{c as ps}from"./cube-CyZAJzS2.js";import{C as hn}from"./CompanyAvatar-CpJ01Rw9.js";import{i as mn,k as fn}from"./companyListUtils-CGGT7JOa.js";import{B as ct,S as hs}from"./BaseTable-IcWHMNFb.js";import{S as dt}from"./StatusBadge-Cqldjj7_.js";import{C as xt}from"./statusColors-Dd8KPNoI.js";import{c as Ie,i as gn}from"./servicePricing-DnJEuAte.js";import{S as bn}from"./ScrollStrip-DGq5e-qp.js";import{l as W}from"./legalServices.api-BOdTNjvd.js";import{C as jn}from"./stakeholderUtils-CGL3PVZ8.js";import{u as ms}from"./useCountries-ZMj2bPz4.js";import{P as Nn}from"./Pagination-D-HSvm0E.js";import{l as wn}from"./legalProvidersApi-D9QPuRbi.js";import{S as yn}from"./SortRadios-DHAtHIrq.js";import{c as vn,d as Vt}from"./legalWorkflowRoutes-BuKcX3i5.js";import{a as Fn}from"./legalCategoryStats-Cmy-VQtO.js";import"./query-DAfX1kxE.js";import"./ui-DI4_AqlD.js";import"./utils-CXlbsO6u.js";import"./accountOffersHelpers-Bfjtk7rV.js";import"./clientBlurVisibility-9WhYBVaX.js";import"./legalServices-CavkuwKx.js";import"./index-DiTzUL1h.js";import"./index-Chjiymov.js";/** 2 * @license lucide-react v0.475.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const Cn=[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}],["circle",{cx:"19",cy:"21",r:"1",key:"13723u"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",key:"9zh506"}]],fs=Rs("ShoppingCart",Cn),ut="/assets/ball-DdGOis1B.png";function Sn(){const{openChat:t}=ls(),[n,a]=l.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex w-full flex-1 flex-col gap-4 roun
6ded-2xl bg-white p-5 shadow-[0px_20px_50px_-10px_rgba(18,49,96,0.1)] lg:min-h-[250px] lg:gap-0 lg:p-[22px]",children:[e.jsxs("div",{className:"flex items-center gap-[14px]",children:[e.jsxs("div",{className:"relative w-[48px] h-[48px] shrink-0",children:[e.jsx("img",{src:rs,alt:"Emily",className:"w-[48px] h-[48px] rounded-full object-cover"}),e.jsx("div",{className:"absolute top-0 right-[-2px] w-3 h-3 bg-[#34D399] rounded-full border border-white"})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-bold text-[15px] leading-[140%] text-[#040404]",children:"Emily"}),e.jsx("p",{className:"text-[14px] leading-[140%] text-[#6B7280]",children:"Coming soon"})]})]}),e.jsxs("div",{className:"flex flex-col gap-3 mt-auto",children:[e.jsx("h4",{className:"font-bold text-[16px] leading-[140%] text-[#16111C]",children:"Need Your Legal AI Assistance?"}),e.jsx("p",{className:"font-medium text-[15px] leading-[140%] text-[#1F2937]",children:"Legal out-staffing lets you focus on your business."})]}),e.jsxs("div",{className:"mt-auto flex flex-wrap items-center gap-x-[18px] gap-y-2",children:[e.jsxs("button",{onClick:()=>a(!0),className:"flex h-[48px] min-w-[160px] flex-1 items-center justify-center gap-2 whitespace-nowrap rounded-[24px] bg-[#305DFF] px-4 text-[16px] font-bold leading-[140%] text-white transition-colors hover:bg-[#2750E0]",children:[e.jsx(pn,{className:"w-5 h-5 shrink-0",color:"white"}),"Book a Call"]}),e.jsxs("button",{onClick:()=>t(),title:"Emily, our AI legal expert, is coming soon",className:"flex h-[48px] min-w-[160px] flex-1 items-center justify-center gap-2 whitespace-nowrap rounded-[24px] px-4 text-[16px] font-bold leading-[140%] text-[#01145F] transition-colors hover:text-[#002ED3]",children:["Get Legal AI Help",e.jsx("span",{className:"rounded-full bg-[#EEF2FF] px-2 py-0.5 text-[11px] font-bold uppercase leading-[1.4] tracking-wide text-[#305DFF]",children:"Soon"})]})]})]}),e.jsx(Os,{isOpen:n,onClose:()=>a(!1)})]})}function En({isActive:t=!1}){const n=Pe();return e.jsxs("div",{className:"flex w-full flex-1 flex-row flex-wrap items-center gap-4 roun
6ded-2xl bg-white p-5 text-left shadow-[0px_20px_50px_-10px_rgba(18,49,96,0.1)] lg:min-h-[250px] lg:flex-col lg:flex-nowrap lg:justify-between lg:p-[30px] lg:text-center",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col items-start gap-2 lg:flex-none lg:items-center lg:gap-3",children:[e.jsx("img",{src:ut,alt:"",className:"hidden h-[64px] w-[64px] object-contain lg:block"}),e.jsx("h3",{className:"font-bold text-[18px] leading-[140%] text-[#040404]",children:"Country Legislation"}),e.jsx("p",{className:"font-medium text-[15px] leading-[140%] text-[#1F2937] lg:max-w-[250px]",children:"Check the regulatory requirements and law for the country you want to operate in."})]}),e.jsx("img",{src:ut,alt:"",className:"h-[56px] w-[56px] shrink-0 object-contain lg:hidden"}),e.jsx("button",{onClick:()=>n("/CountryLegislation"),className:"flex h-[48px] w-full shrink-0 items-center justify-center rounded-[24px] text-[16px] font-bold leading-[140%] text-white transition-all hover:opacity-90 max-lg:order-last max-lg:basis-full",style:{backgroundImage:t?"linear-gradient(11deg, #22C55E 0%, #16A34A 99%)":"linear-gradient(11deg, #305DFF 0%, #6730FF 99%)"},children:"Check Country"})]})}function kn({onIncorporate:t}){return e.jsxs("div",{"data-tour":"legal-incorporate",className:"flex w-full flex-1 flex-row flex-wrap items-center gap-4 overflow-visible rounded-2xl bg-white p-5 text-left shadow-[0px_20px_50px_-10px_rgba(18,49,96,0.1)] lg:min-h-[250px] lg:flex-col lg:flex-nowrap lg:justify-center lg:gap-7 lg:p-[30px] lg:text-center",children:[e.jsx("img",{src:ps,alt:"",className:"order-2 h-[70px] w-[60px] shrink-0 object-contain lg:order-none lg:h-[130px] lg:w-[110px]"}),e.jsxs("div",{className:"order-1 flex w-full min-w-0 flex-1 flex-col items-start gap-3 lg:order-none lg:flex-none lg:items-center",children:[e.jsx("h3",{className:"font-bold text-[16px] leading-[140%] text-[#040404]",children:"Incorporate a New Company"}),e.jsx("button",{onClick:t,className:"flex h-[48px] w-full items-center justify-center rounded-[24px] text-[16px] font-bold leading-[140%] text-white transition-all hover:opacity-90",style:{backgroundImage:"linear-gradient(58.82deg, #E74E1D 14.83%, #FD9834 94.3%)"},children:"Incorporate Company"})]})]})}const Wt=5,An=t=>{const n=t==null?void 0:t.country;return n&&typeof n=="object"?{name:n.name||"",flag:n.flag||""}:{name:n||(t==null?void 0:t.city)||"",flag:""}},Yt=({company:t,selected:n,onSelect:a})=>{const r=mn(t),c=An(t),d=fn(t);return e.jsxs("button",{type:"button",role:"option","aria-selected":n,onClick:a,className:`flex w-full min-w-0 items-center gap-3 rounded-[16px] border p-3 text-left transition-colors ${n?"border-[#305DFF] bg-[#F0F7FF]":"border-[#E2E8F0] bg-white hover:border-[#C7D2FE] hover:bg-[#F9FAFB]"}`,children:[e.jsx(hn,{company:t,className:"h-10 w-10"}),e.jsxs("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate text-[15px] font-bold leading-[140%] text-[#040404]",children:t.company_name||t.name}),r?e.jsx("span",{className:"shrink-0 rounded-[16px] px-1.5 text-[12px] font-medium leading-[17px] text-white",style:{background:r.color},children:r.label}):null]}),e.jsx("span",{className:"truncate text-[13px] font-medium leading-[140%] text-[#6B7280]",children:[c.flag?`${c.flag} ${c.name}`:c.name,d].filter(h=>h&&h!=="-").join(" · ")||"No country yet"})]}),e.jsx("span",{"aria-hidden":"true",className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-full transition-colors ${n?"bg-[#305DFF]":"border-2 border-[#CCCED4] bg-white"}`,children:n?e.jsx(Y,{className:"h-3.5 w-3.5 text-white"}):null})]})};function Dn({isOpen:t,onClose:n,onSelect:a,selectedCompany:r,allowNoCompany:c=!1}){const[d,h]=l.useState([]),[j,w]=l.useState(!0),[N,b]=l.useState(1),[g,_]=l.useState(1),[y,A]=l.useState(""),[C,I]=l.useState(""),[D,S]=l.useState((r==null?void 0:r.id)??null);l.useEffect(()=>{const u=setTimeout(()=>I(y.trim()),350);return()=>clearTimeout(u)},[y]),l.useEffect(()=>{b(1)},[C]);const L=l.useCallback(async()=>{var u;w(!0);try{const F=await is.getAllPaged({page:N,limit:Wt,...C&&{search:C}});h(F.data||[]),_(((u=F.meta)==null?void 0:u.totalPages)||1)}catch(F){console.error("Failed to load companies:",F),h([]),_(1)}finally{w(!1)}},[N,C]),i=j&&d.length>0,f=j&&d.length===0;l.useEffect(()=>{t&&L()},[t,L]),l.useEffect(()=>{t&&(S((r==null?void 0:r.id)??null),A(""),I(""),b(1))},[t,r]);const x=()=>
6{if(D===null){c&&a(null),n();return}const u=d.find(F=>F.id===D);u&&a(u),n()},v=()=>{S((r==null?void 0:r.id)??null),n()},T=c||!!D,O=(()=>{if(g<=5)return Array.from({length:g},(F,P)=>P+1);const u=[1];N>3&&u.push("â¦");for(let F=Math.max(2,N-1);F<=Math.min(g-1,N+1);F++)u.push(F);return N<g-2&&u.push("â¦"),u.push(g),u})();return e.jsx(pt,{open:t,onOpenChange:u=>!u&&n(),children:e.jsx(ht,{className:"w-[520px] max-w-[95vw] overflow-hidden rounded-[24px] border-0 !gap-0 !p-0 shadow-[-2px_20px_50px_-10px_rgba(18,49,96,0.1)] [&>button]:hidden",children:e.jsxs("div",{className:"relative box-border flex max-h-[85vh] w-full min-w-0 flex-col gap-5 p-6",children:[e.jsx("button",{type:"button",onClick:v,"aria-label":"Close",className:"absolute right-[16px] top-[16px] flex h-[32px] w-[32px] items-center justify-center rounded-full bg-[#F3F4F6] transition-colors hover:bg-gray-300",children:e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M1 1L11 11M11 1L1 11",stroke:"#ABB3C3",strokeWidth:"2",strokeLinecap:"round"})})}),e.jsxs("div",{className:"flex w-full min-w-0 flex-col items-start gap-2",children:[e.jsx(os,{className:"text-[26px] font-bold leading-[140%] text-[#040404]",children:"Select company"}),e.jsx(cs,{className:"text-[16px] font-medium leading-[140%] text-[#374151]",children:c?"Pick the company this service is for, or continue without one.":"Pick the company this service is for."})]}),e.jsxs("div",{className:"relative w-full min-w-0",children:[e.jsx(be,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-500"}),e.jsx("input",{type:"text",value:y,onChange:u=>A(u.target.value),placeholder:"Search company...","aria-label":"Search company",className:"h-[40px] w-full rounded-full border border-transparent bg-[#F0F7FF] pl-9 pr-3 text-base sm:text-sm text-neutral-800 placeholder:text-neutral-500 focus:border-brand-500 focus:outline-none"})]}),e.jsxs("div",{className:"relative flex min-h-0 w-full min-w-0 flex-1 flex-col gap-2 overflow-y-auto",role:"listbox","aria-label":"Companies",children:[c&&!C?e.jsxs("button",{type:"button",role:"option","aria-selected":D===null,onClick:()=>S(null),className:`flex w-full min-w-0 items-center gap-3 rounded-[16px] border p-3 text-left transition-colors ${D===null?"border-[#305DFF] bg-[#F0F7FF]":"border-dashed border-[#CCCED4] bg-white hover:border-[#305DFF] hover:bg-[#F9FAFB]"}`,children:[e.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-[#F3F4F6] text-[18px] font-bold text-[#6B7280]",children:"â
"}),e.jsxs("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[e.jsx("span",{className:"truncate text-[15px] font-bold leading-[140%] text-[#040404]",children:"No company"}),e.jsx("span",{className:"truncate text-[13px] font-medium leading-[140%] text-[#6B7280]",children:"Browse every service and order without attaching a company"})]}),e.jsx("span",{"aria-hidden":"true",className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-full transition-colors ${D===null?"bg-[#305DFF]":"border-2 border-[#CCCED4] bg-white"}`,children:D===null?e.jsx(Y,{className:"h-3.5 w-3.5 text-white"}):null})]}):null,!j&&d.length===0?e.jsx("p",{className:"flex h-[160px] items-center justify-center text-center text-[15px] text-[#6B7280]",children:C?"No companies match that search":"No companies yet"}):e.jsxs("div",{className:`flex flex-col gap-2 transition-opacity duration-200 ${i?"pointer-events-none opacity-50":"opacity-100"}`,children:[d.map(u=>e.jsx(Yt,{company:u,selected:D===u.id,onSelect:()=>S(u.id)},u.id)),Array.from({length:g>1||f?Math.max(0,Wt-d.length):0}).map((u,F)=>e.jsx("div",{"aria-hidden":"true",className:"invisible pointer-events-none",children:e.jsx(Yt,{company:{id:`filler-${F}`,name:"â"},selected:!1})},`filler-${F}`))]}),j?e.jsx("span",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:e.jsx("span",{className:"h-8 w-8 animate-spin rounded-full border-b-2 border-[#305DFF]"})}):null]}),g>1&&e.jsxs("div",{className:"flex w-full shrink-0 items-center justify-center gap-1.5",children:[e.jsx("button",{type:"button",onClick:()=>b(u=>Math.max(1,u-1)),disabled:N===1,"aria-label":"Previous page",className:"flex h-8 w-8 items-center justify-center rounded-full disabled:opacity-40",children:e.jsx(Ms,{className:"h-5 w-5 text-[#305DFF]"})}),O.map((u,F)=>e.jsx("button",{type:"button",onClick:()=>typeof u=="number"&&b(u),disabled:u==="â¦","aria-current":u===N?"page":void 0,className:`flex h-8 w-8 items-center justify-center rounded-full text-[15px] leading-[140%] transition-colors ${u===N?"bg-[#305DFF] text-white":u==="â¦"?"cursor-default text-[#374151]":"text-[#374151] hover:bg-gray-100"}`,children:u},`${u}-${F}`)),e.jsx("button",{type:"button",onClick:()=>b(u=>Math.min(g,u+1)),disabled:N===g,"aria-label":"Next page",className:"flex h-8 w-8 items-center justify-center rounded-full disabled:opacity-40",children:e.jsx(ds,{className:"h-5 w-5 text-[#305DFF]"})})]}),e.jsxs("div",{className:"flex w-full shrink-0 items-start gap-4",children:[e.jsx("button",{type:"button",onClick:v,className:"h-12 flex-1 rounded-[24px] text-[16px] font-bold leading-[140%] text-[#01145F] transition-colors hover:text-[#002ED3]",children:"Cancel"}),e.jsx("button",{type:"button",onClick:x,disabled:!T,className:"h-12 flex-1 rounded-[24px] bg-[#01145F] text-[16px] font-bold leading-[140%] text-white transition-opacity hover:opacity-90 disabled:bg-[#E5E7EB] disabled:text-[#6B7280] disabled:opacity-100",children:"Done"})]})]})})})}const In="/assets/glassMag-WpVa8XkU.png";function re({text:t,iconClassName:n="w-6 h-6"}){return e.jsx($s,{content:t,label:t,className:"group",children:e.jsx("svg",{className:`${n} cursor-pointer`,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:e.jsx("path",{d:"M12 17C12.2833 17 12.521 16.904 12.713 16.712C12.905 16.52 13.0007 16.2827 13 16V12C13 11.7167 12.904 11.4793 12.712 11.288C12.52 11.0967 12.2827 11.0007 12 11C11.7173
610.9993 11.48 11.0953 11.288 11.288C11.096 11.4807 11 11.718 11 12V16C11 16.2833 11.096 16.521 11.288 16.713C11.48 16.905 11.7173 17.0007 12 17ZM12 9C12.2833 9 12.521 8.904 12.713 8.712C12.905 8.52 13.0007 8.28267 13 8C12.9993 7.71733 12.9033 7.48 12.712 7.288C12.5207 7.096 12.2833 7 12 7C11.7167 7 11.4793 7.096 11.288 7.288C11.0967 7.48 11.0007 7.71733 11 8C10.9993 8.28267 11.0953 8.52033 11.288 8.713C11.4807 8.90567 11.718 9.00133 12 9ZM12 22C10.6167 22 9.31667 21.7373 8.1 21.212C6.88334 20.6867 5.825 19.9743 4.925 19.075C4.025 18.1757 3.31267 17.1173 2.788 15.9C2.26333 14.6827 2.00067 13.3827 2 12C1.99933 10.6173 2.262 9.31733 2.788 8.1C3.314 6.88267 4.02633 5.82433 4.925 4.925C5.82367 4.02567 6.882 3.31333 8.1 2.788C9.318 2.26267 10.618 2 12 2C13.382 2 14.682 2.26267 15.9 2.788C17.118 3.31333 18.1763 4.02567 19.075 4.925C19.9737 5.82433 20.6863 6.88267 21.213 8.1C21.7397 9.31733 22.002 10.6173 22 12C21.998 13.3827 21.7353 14.6827 21.212 15.9C20.6887 17.1173 19.9763 18.1757 19.075 19.075C18.1737 19.9743 17.1153 20.687 15.9 21.213C14.6847 21.739 13.3847 22.0013 12 22Z",className:"fill-[#CCCED4] transition-colors group-hover:fill-[#374151] group-data-[state=delayed-open]:fill-[#374151] group-data-[state=instant-open]:fill-[#374151]"})})})}const Tn=/^(?:provides?|provision of|offers?|offering|includes?|including|additional|supplementary|comprehensive|full range of|assistance with|support (?:for|with)|services? (?:for|of|include[sd]?))\s+/i,Te=t=>String(t??"").replace(/\s+/g," ").trim(),ke=t=>t.replace(/[\s,;:.]+$/,"");function _n(t){const n=Te(t==null?void 0:t.name);if(!n||n.length>70)return!1;const a=Te(t==null?void 0:t.description);return!a||!a.startsWith(n)?!0:/[.!?]$/.test(n)}function Ln(t,n){let a=Te(t);if(!a)return"";const r=a.indexOf(":");if(r>3&&r<=n+8)return ke(a.slice(0,r));if(a=a.replace(Tn,""),a=a.charAt(0).toUpperCase()+a.slice(1),a.length<=n)return ke(a);const c=a.indexOf(",");if(c>24&&c<=n+10)return ke(a.slice(0,c));const d=a.slice(0,n),h=d.lastIndexOf(" ");return`${ke(h>20?d.slice(0,h):d)}â¦`}function gs(t,{limit:n=64,fallback:a="Legal service"}={}){return _n(t)?Te(t.name):Ln((t==null?void 0:t.description)||(t==null?void 0:t.name),n)||a}const jt={ALL_SERVICES:"All Services",STRUCTURE_MAINTENANCE:"Structure Maintenance",TAX_ADVISING:"Tax Advising",LEGAL_ASSISTANT:"Legal Assistant",INCORPORATION:"Incorporation",REPORTING:"Reporting",OTHER:"Legal Assistant"},Pn={"Structure Maintenance":{bg:"#EEF2FF",text:"#4338CA"},Reporting:{bg:"#ECFDF5",text:"#047857"},"Tax Advising":{bg:"#FFF7ED",text:"#C2410C"},"Legal Assistant":{bg:"#F0F7FF",text:"#1D4ED8"},Incorporation:{bg:"#FDF2F8",text:"#BE185D"}};function _e({name:t,className:n,width:a=90,textClassName:r="text-[15px]"}){const c=t?String(t).charAt(0).toUpperCase():"?",d=l.useMemo(()=>{const h=Math.max(((t==null?void 0:t.length)||6)-1,4),j="abcdefghijklmnopqrstuvwxyz0123456789";let w="";for(let N=0;N<h;N+=1)w+=j.charAt(Math.floor(Math.random()*j.length));return w},[t]);return e.jsxs("span",{className:z("relative isolate inline-flex shrink-0 overflow-hidden align-middle",n),style:{width:a},children:[e.jsx("span",{className:z("block w-full overflow-hidden text-ellipsis whitespace-nowrap pr-4 leading-[140%] text-[#1F2937]",r),children:`${c}${d}`}),e.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute bottom-0 top-0 rounded-[100px]",style:{left:"10px",right:"16px",background:"rgba(249, 252, 255, 0.7)",backdropFilter:"blur(4px)",WebkitBackdropFilter:"blur(4px)"}})]})}function Le(t){var n;return((n=t==null?void 0:t.provider)==null?void 0:n.companyName)||(t==null?void 0:t.providerName)||"Provider"}function Bn({text:t}){const[n,a]=l.useState(!1),[r,c]=l.useState(!1),d=l.useRef(null),[h,j]=l.useState({top:0,left:0}),w=()=>{const N=d.current;if(N&&N.scrollHeight>N.clientHeight){c(!0);const b=N.getBoundingClientRect();j({top:b.top+window.scrollY-8,left:b.left+window.scrollX}),a(!0)}};return e.jsxs("div",{onMouseEnter:w,onMouseLeave:()=>a(!1),children:[e.jsx("p",{ref:d,className:"text-[15px] leading-[140%] text-[#1F2937] line-clamp-2",children:t}),n&&r&&ns.createPortal(e.jsx("div",{className:"fixed z-[9999] max-w-[416px] p-2 bg-white rounded-[10px] text-[12px] leading-[140%] text-[#16111C] font-normal pointer-events-none",style:{to
6p:h.top,left:h.left,transform:"translateY(-100%)",boxShadow:"0px 2px 10px rgba(0, 0, 0, 0.08)"},children:t}),document.body)]})}function bs({row:t,className:n=""}){const a=jt[t.category]||t.category;if(!a)return null;const r=Pn[a]||{bg:"#F3F4F6",text:"#374151"};return e.jsx("span",{className:`inline-flex h-[19px] shrink-0 items-center rounded-md px-1.5 text-[10.5px] font-bold leading-[140%] ${n}`,style:{background:r.bg,color:r.text},children:a})}function js({row:t}){var a;const n=(a=t.countries)==null?void 0:a[0];return n?e.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 text-[11px] font-medium leading-[140%] text-[#6B7280]",children:[e.jsx(mt,{code:n,height:10}),n]}):null}function Rn({services:t,userRequests:n=[],loading:a,onAddToCart:r,onApply:c,onViewWorkflow:d,onPay:h,onOpenDetails:j,showStatus:w=!1,isCartView:N=!1,emptyMessage:b="No services found"}){const g=i=>n.filter(f=>{var x,v,T;return f.serviceId===i||f.providerServiceId===i||f.partnerServiceId===i||((x=f.service)==null?void 0:x.id)===i||((v=f.providerService)==null?void 0:v.id)===i||((T=f.partnerService)==null?void 0:T.id)===i}),_=i=>{const f=g(i);return f.find(x=>x.status!=="CANCELLED"&&x.status!=="DECLINED")??f.find(x=>x.status==="DECLINED")},y=i=>{var f;return((f=_(i))==null?void 0:f.status)||null},A=(t==null?void 0:t.map((i,f)=>{const x=_(i.serviceId||i.id),v=w?i.status||y(i.id):(x==null?void 0:x.status)||null;return{...i,_index:f,_request:x,_status:v}}))||[],C=(i,{compact:f=!1}={})=>{const x=i._status;return x?f?e.jsx(dt,{status:x,variant:"pill",colorMap:xt,fallback:{bg:"bg-neutral-200",text:"text-neutral-500"},className:"h-7 justify-center rounded-full px-3 py-0 text-[13px] font-bold leading-[140%]"}):e.jsx(hs,{status:x}):e.jsx("span",{className:f?"inline-flex h-7 items-center justify-center rounded-full bg-[#F3F4F6] px-3 text-[13px] font-bold leading-[140%] text-[#6B7280]":"inline-flex h-[41px] w-[168px] items-center justify-center rounded-[25px] bg-[#F3F4F6] text-[16px] font-bold leading-[140%] text-[#6B7280]",children:"Not requested"})},I=i=>{const f=i._status,x=i._request,v=e.jsx("button",{className:"h-[40px] flex-1 rounded-[24px] border-[1.4px] border-[#01145F] bg-white text-center text-[16px] font-bold leading-[140%] text-[#01145F] transition-colors hover:bg-[#F0F4FF]",onClick:()=>d==null?void 0:d(x||i),children:"Flow"});return w?f==="NOT_PAID"?e.jsx("button",{className:"h-[40px] flex-1 rounded-[24px] bg-success-500 text-base font-bold text-white transition-colors hover:bg-success-600",onClick:()=>h==null?void 0:h(x||i),children:"Pay Here"}):["APPLIED","IN_PROCESS","PURCHASED","COMPLETED"].includes(f)?v:f==="DECLINED"?e.jsx(zs,{className:"w-5 h-5 text-red-500"}):null:f?["PURCHASED","IN_PROCESS","COMPLETED","REVIEWED"].includes(f)?v:null:e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"flex flex-1 items-center justify-center gap-2 text-[16px] font-bold leading-[140%] text-[#01145F] hover:underline",onClick:()=>r==null?void 0:r(i),children:[e.jsx(ot,{className:"w-5 h-5",color:"#01145F"}),"Add to Cart"]}),e.jsx("button",{className:"h-[40px] flex-1 rounded-[24px] bg-[#305DFF] text-[16px] font-bold leading-[140%] text-white transition-colors hover:bg-[#2750E0]",onClick:()=>c==null?void 0:c(i),children:"Apply"})]})},D=i=>{const f=i._status,x=i._request;return f==="NOT_PAID"?e.jsx("button",{className:"h-9 flex-1 rounded-full bg-success-500 px-3 text-[13px] font-bold text-white transition-colors hover:bg-success-600",onClick:()=>h==null?void 0:h(x||i),children:"Pay Here"}):f?e.jsxs(e.Fragment,{children:[e.jsx(dt,{status:f,variant:"pill",colorMap:xt,fallback:{bg:"bg-neutral-200",text:"text-neutral-500"},className:"h-6 justify-center rounded-full px-2 py-0 text-[11px] font-bold leading-[140%]"}),["APPLIED","PENDING","DECLINED"].includes(f)?null:e.jsx("button",{className:"text-[12.5px] font-bold leading-[140%] text-[#01145F] hover:underline",onClick:()=>d==null?void 0:d(x||i),children:"Flow"})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button","aria-label":"Add to cart",title:"Add to Cart",className:"flex size-9 shrink-0 items-center justify-center rounded-full border-[1.4px] border-[#
6E5E7EB] transition-colors hover:bg-gray-50",onClick:()=>r==null?void 0:r(i),children:e.jsx(ot,{className:"size-[17px]",color:"#01145F"})}),e.jsx("button",{className:"h-9 flex-1 rounded-full bg-[#305DFF] px-3 text-[13px] font-bold text-white transition-colors hover:bg-[#2750E0]",onClick:()=>c==null?void 0:c(i),children:"Apply"})]})},S=[{key:"number",header:"â",width:"60px",render:i=>e.jsx("span",{className:"text-[15px] leading-[140%] text-[#1F2937] text-center",children:i._index+1})},{key:"providerTitle",header:"Provider Title",width:"106px",separator:!0,render:i=>e.jsx(_e,{name:Le(i)})},{key:"name",header:"Type of Service",width:"186px",separator:!0,render:i=>e.jsx("div",{className:"text-[15px] leading-[140%] text-[#1F2937]",children:jt[i.category]||i.name})},{key:"providerPrice",header:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{children:"Provider Price"}),e.jsx(re,{text:"Estimated cost (final price may vary)."})]}),width:"144px",render:i=>e.jsx("span",{className:"text-[15px] leading-[140%] text-[#1F2937]",children:Ie(i)})},{key:"price",header:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{children:"Price"}),e.jsx(re,{text:"This is the estimated fee for services provided by our legal team."})]}),width:"90px",render:i=>e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-[#EEF2FF] flex items-center justify-center shrink-0",children:e.jsx(Z,{className:"w-6 h-6"})}),e.jsx("span",{className:"font-bold text-[18px] leading-[140%] text-[#305DFF]",children:i.price||i.tokensCost||0})]})},{key:"description",header:"Service Description",width:"416px",separator:!0,render:i=>e.jsx(Bn,{text:i.description||"â"})},{key:"deliveryTime",header:"Delivery Time",width:"90px",separator:!0,render:i=>{const f=i.serviceTime||i.expectedTime||`${i.expectedDays||"-"}`,x=typeof f=="string"&&f.toLowerCase().includes("ongoing");return e.jsx("span",{className:`text-[15px] leading-[140%] ${x?"font-medium text-[#305DFF]":"text-[#1F2937]"}`,children:f})}},{key:"status",header:"Status",width:"184px",separator:!0,render:i=>e.jsx("div",{className:"flex w-full items-center justify-center",children:C(i)})},{key:"actions",header:"Actions",width:"284px",separator:!0,render:i=>e.jsx("div",{className:"flex w-full items-center justify-center gap-4 px-2",children:I(i)})}],L=[{key:"providerTitle",header:"Provider",width:"82px",cellClassName:"px-2",headerClassName:"px-2",render:i=>e.jsx(_e,{name:Le(i),width:66,textClassName:"text-[13px]"})},{key:"service",header:"Service",separator:!0,cellClassName:"px-2",headerClassName:"px-2",render:i=>{const f=e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(bs,{row:i}),e.jsx(js,{row:i})]}),e.jsx("span",{className:"line-clamp-2 text-[12.5px] leading-[1.4] text-[#374151]",children:i.description||"â"})]});return j?e.jsx("button",{type:"button",onClick:()=>j(i),className:"flex w-full flex-col gap-1 py-2 text-left",children:f}):e.jsx("div",{className:"flex flex-col gap-1 py-2",children:f})}},{key:"providerPrice",header:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{children:"Provider price"}),e.jsx(re,{text:"Estimated cost (final price may vary)."})]}),width:"108px",cellClassName:"px-2",headerClassName:"px-2",render:i=>e.jsx("span",{className:"text-[13px] font-semibold leading-[140%] text-[#1F2937]",children:Ie(i)})},{key:"price",header:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{children:"Price"}),e.jsx(re,{text:"This is the estimated fee for services provided by our legal team."})]}),width:"62px",cellClassName:"px-2",headerClassName:"px-2",render:i=>e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Z,{className:"size-4 shrink-0"}),e.jsx("span",{className:"text-[15px] font-bold leading-[140%] text-[#305DFF]",children:i.price||i.tokensCost||0})]})},{key:"actions",header:"Actions",width:"148px",separator:!0,headerAlign:"center",cellClassName:"px-2",headerClassName:"px-2",render:i=>e.jsx("div",{className:"flex w-full items-center justify-center gap-2",children:D(i)})}];return a?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(rt,{className:"w-8 h-8"})}):!A||A.length===0?e.jsxs("div",{className:"w-full bg-white rounded-2xl shadow-[0px_20px_50px_-10px_rgba(18,49,96,0.1)] flex flex-col items-center justify-center py-16 gap-3",children:[e.jsx("img",{src:In,alt:"No services",className:"w-16 h-16",style:{opacity:.3}}),e.jsx("p",{className:"text-base font-medium text-gray-400",children:b})]}):e.jsx(e.Fragment,{children:e.jsxs("div",{className:"[container-type:inline-size]",children:[e.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(min(100%,320px),1fr))] gap-3 [@container(min-width:700px)]:hidden",children:A.map(i=>e.jsx(On,{row:i,status:i._status?C(i,{compact:!0}):null,actions:I(i),onOpenDetails:j},i.id||i._index))}),e.jsx("div",{className:"[@container(min-width:1560px)]:hidden",children:e.jsx("div",{className:"hidden [@container(min-width:700px)]:block",children:e.jsx(ct,{columns:L,data:A,minWidth:"668px"})})}),e.jsx("div",{className:"hidden [@container(min-width:1560px)]:block",children:e.jsx(ct,{columns:S,data:A,minWidth:"1560px"})})]})})}function On({row:t,status:n,actions:a,onOpenDetails:r}){const c=t.serviceTime||t.expectedTime||t.expectedDays||null,d=e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsx("h3",{className:"min-w-0 text-[15px] font-bold leading-[1.3] text-[#040404]",children:gs(t)}),n?e.jsx("div",{className:"shrink-0",children:n}):null]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1.5",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"shrink-0 text-[12px] leading-[140%] text-[#6B7280]",children:"Provider"}),e.jsx(_e,{name:Le(t),width:86,textClassName:"text-[13px] font-semibold"})]}),e.jsx(bs,{row:t}),e.jsx(js,{row:t})]})]});return e.jsxs("article",{className:"flex flex-col gap-3 rounded-2xl bg-white p-4 shadow-[0px_20px_50px_-10px_rgba(18,49,96,0.1)]",children:[r?e.jsx("button",{type:"button",onClick:()=>r(t),className:"flex flex-col gap-2 text-left",children:d}):e.jsx("div",{className:"flex flex-col gap-2",children:d}),e.jsxs("div",{className:"flex items-stretch justify-between gap-3 border-y border-[#F3F4F6] py-3",children:[e.jsx(Xe,{label:"Provider price",children:Ie(t)}),e.jsx("span",{"aria-hidden":"true",className:"w-px shrink-0 bg-[#E5E7EB]"}),e.jsxs(Xe,{label:"Price",children:[e.jsx(Z,{className:"h-5 w-5 shrink-0"}),e.jsx("span",{className:"text-[18px] font-bold leading-none text-[#305DFF]",children:t.price||t.tokensCost||0})]}),c?e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":"true",className:"w-px shrink-0 bg-[#E5E7EB]"}),e.jsx(Xe,{label:"Delivery",children:c})]}):null]}),t.description?e.jsx("p",{className:"line-clamp-2 text-[13.5px] leading-[1.45] text-[#374151]",children:t.description}):null,r?e.jsx("button",{type:"button",onClick:()=>r(t),className:"self-start text-[13px] font-bold leading-[140%] text-[#305DFF] hover:underline",children:"Read in full"}):null,a?e.jsx("div",{className:"mt-auto flex items-center gap-3",children:a}):null]})}function Xe({label:t,children:n}){return e.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[e.jsx("span",{className:"whitespace-nowrap text-[12px] leading-[140%] text-[#6B7280]",children:t}),e.jsx("span",{className:"flex min-h-7 min-w-0 items-center gap-1 text-[15px] leading-[140%] text-[#1F2937]",children:n})]})}const Mn=[{value:"ALL_SERVICES",label:"All Services"},{value:"STRUCTURE_MAINTENANCE",label:"Structure Maintenance"},{value:"REPORTING",label:"Reporting"},{value:"TAX_ADVISING",label:"Tax Advising"},{value:"LEGAL_ASSISTANT",label:"Legal Assistant"},{value:"COMPANY_INCORPORATION",label:"Company Incorporation"}];function $n({activeCategory:t,onCategoryChange:n}){return e.jsx(bn,{className:"-mx-4 md:mx-0",contentClassName:"px-4 md:px-0",children:e.jsx("div",{className:"flex min-w-max items-center gap-3 md:min-w-0 md:gap-[26px]",children:Mn.map(({value:a,label:r})=>{const c=t===a;return e.jsx("button",{onClick:()=>{a!==t&&n(a)},className:` 7 md:flex-1 h-[44px] md:h-[48px] px-4 md:px-6 rounded-xl font-bold text-[14px] md:text-[15px] leading-[140%] transition-all whitespace-nowrap 8 ${c?"bg-[#F0F7FF] border border-[#305DFF]":"bg-[#F3F4F6] border border-transparent hover:bg-gray-200"} 9 `,children:e.jsx("span",{className:c?void 0:"text-[#374151]",style:c?{WebkitBackgroun
9dClip:"text",WebkitTextFillColor:"transparent",backgroundImage:"linear-gradient(24.78deg, #305DFF 0%, #6730FF 98.99%)"}:void 0,children:r})},a)})})})}function zn({isOpen:t,onClose:n,serviceName:a,onViewFlow:r}){return e.jsx(pt,{open:t,onOpenChange:n,children:e.jsx(ht,{className:"max-w-sm text-center",children:e.jsxs("div",{className:"py-6",children:[e.jsx("div",{className:"mx-auto w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mb-6",children:e.jsx(Hs,{className:"w-10 h-10 text-green-600"})}),e.jsx("h2",{className:"text-2xl font-bold text-gray-900 mb-2",children:"Your Request is Submitted!"}),e.jsx("p",{className:"text-gray-600 mb-6",children:a?e.jsxs(e.Fragment,{children:["Your request for ",e.jsx("strong",{children:a})," has been submitted successfully."]}):"Your request has been submitted successfully."}),e.jsx("p",{className:"text-sm text-gray-500 mb-6",children:"Our team will review your request and get back to you within 24 hours."}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs(De,{className:"w-full bg-blue-600 hover:bg-blue-700 text-white rounded-full",onClick:r,children:["View Flow",e.jsx(Gs,{className:"w-4 h-4 ml-2"})]}),e.jsx(De,{variant:"outline",className:"w-full rounded-full",onClick:n,children:"Continue Browsing"})]})]})})})}const Hn=100,Gn=({className:t})=>e.jsx("svg",{className:t,viewBox:"0 0 30 30",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M26.25 11.25H22.5V8.75C22.5 6.76088 21.7098 4.85322 20.3033 3.4467C18.8968 2.04018 16.9891 1.25 15 1.25C13.0109 1.25 11.1032 2.04018 9.6967 3.4467C8.29018 4.85322 7.5 6.76088 7.5 8.75V11.25H3.75C3.41848 11.25 3.10054 11.3817 2.86612 11.6161C2.6317 11.8505 2.5 12.1685 2.5 12.5V25C2.5 25.663 2.76339 26.2989 3.23223 26.7678C3.70107 27.2366 4.33696 27.5 5 27.5H25C25.663 27.5 26.2989 27.2366 26.7678 26.7678C27.2366 26.2989 27.5 25.663 27.5 25V12.5C27.5 12.1685 27.3683 11.8505 27.1339 11.6161C26.8995 11.3817 26.5815 11.25 26.25 11.25ZM10 8.75C10 7.42392 10.5268 6.15215 11.4645 5.21447C12.4021 4.27678 13.6739 3.75 15 3.75C16.3261 3.75 17.5979 4.27678 18.5355 5.21447C19.4732 6.15215 20 7.42392 20 8.75V11.25H10V8.75Z",fill:"currentColor"})}),qn=({className:t})=>e.jsx("svg",{className:t,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M10 0C4.47 0 0 4.47 0 10C0 15.53 4.47 20 10 20C15.53 20 20 15.53 20 10C20 4.47 15.53 0 10 0ZM14.3 14.3C14.11 14.49 13.86 14.59 13.6 14.59C13.34 14.59 13.09 14.49 12.9 14.3L10 11.41L7.1 14.3C6.91 14.49 6.66 14.59 6.4 14.59C6.14 14.59 5.89 14.49 5.7 14.3C5.31 13.91 5.31 13.28 5.7 12.89L8.59 10L5.7 7.1C5.31 6.71 5.31 6.08 5.7 5.69C6.09 5.3 6.72 5.3 7.11 5.69L10 8.58L12.9 5.69C13.29 5.3 13.92 5.3 14.31 5.69C14.7 6.08 14.7 6.71 14.31 7.1L11.42 10L14.31 12.9C14.69 13.28 14.69 13.91 14.3 14.3Z",fill:"#F87171"})});function Un({cart:t,onCartUpdate:n,onCheckoutSuccess:a,className:r=""}){var O;const[c,d]=l.useState(!1),[h,j]=l.useState(!1),[w,N]=l.useState(!1),[b,g]=l.useState("all"),_=Pe(),{user:y,refreshUser:A}=ft(),C=((O=t==null?void 0:t.items)==null?void 0:O.length)||0,I=(t==null?void 0:t.totalTokens)||0,D=l.useMemo(()=>{var F;if(!((F=t==null?void 0:t.items)!=null&&F.length))return{};const u={};return t.items.forEach(P=>{var X,oe;const G=((X=P.company)==null?void 0:X.name)||((oe=P.company)==null?void 0:oe.company_name)||"No Company Selected";u[G]||(u[G]=[]),u[G].push(P)}),u},[t==null?void 0:t.items]),S=l.useMemo(()=>b==="all"?D:{[b]:D[b]||[]},[D,b]),L=l.useMemo(()=>Object.keys(D),[D]),i=async u=>{try{await W.removeFromCart({serviceId:u.serviceId,companyId:u.companyId}),n==null||n(),H.success("Item removed from cart")}catch(F){console.error("Failed to remove item:",F),H.error("Failed to remove item")}},f=async()=>{var u,F;j(!0);try{const P=await W.checkout({useTokens:!0});H.success("Checkout successful!"),n==null||n(),await A(),a==null||a(),d(!1)}catch(P){console.error("Checkout failed:",P),H.error(((F=(u=P.response)==null?void 0:u.data)==null?void 0:F.message)||"Checkout failed")}finally{j(!1)}},x=async()=>{const u=I-((y==null?void 0:y.tokens)||0);if(!(u<=0)){N(!0);try{const F=await Xs.createOrder({type:"TOKEN_PURCHASE",tokens:u});d(!1),_(it("Checkout")+`?orderId=${F.id}`)}catch(F){console.error("Failed to create token order:",F),H.error("Failed to create order. Please try again.")}finally{N(!1)}}},v=()=>{d(!1)},T=I*Hn;return e.jsxs(gt,{open:c,onOpenChange:d,children:[e.jsx(qs,{asChild:!0,children:e.jsxs("button",{className:`relative min-w-0 sm:min-w-[252px] h-[48px] px-6 bg-[#1CB17B] hover:bg-[#18a06f] rounded-[24px] flex items-center justify-center gap-2 text-white font-bold text-[16px] leading-[140%] transition-colors ${r}`,children:[e.jsx(fs,{className:"w-5 h-5"}),e.jsx("span",{children:"Cart"}),C>0&&e.jsx(Us,{value:C,max:9,variant:"white"})]})}),e.jsx(bt,{className:"p-0 bg-white flex flex-col",side:"right",showCloseButton:!1,children:e.jsxs("div",{className:"flex flex-col h-full pt-[30px] px-10 pb-[40px]",children:[e.jsxs("div",{className:"flex items-start justify-between mb-[10px]",children:[e.jsx("h2",{className:"text-3xl font-bold text-neutral-950 leading-[1.4]",children:"Cart"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Gn,{className:"w-[30px] h-[30px] text-[#1CB17B]"}),e.jsx("div",{className:`w-[36px] h-[36px] rounded-full flex items-center justify-center text-white text-sm font-bold ${C>0?"bg-success-500":"bg-neutral-300"}`,children:C})]})]}),e.jsx("p",{className:"text-base font-medium text-neutral-700 mb-[40px]",children:C===0?"Your cart is currently empty. Go back to request Services.":"Pay for Services to speed up the process of receiving them."}),C===0?e.jsxs("div",{className:"flex-1 flex flex-col",children:[e.jsxs("div",{className:"flex gap-6 mb-10",children:[e.jsx("button",{onClick:()=>d(!1),className:"flex-1 h-[48px] rounded-3xl text-base font-bold text-brand-900 hover:bg-gray-50 transition-colors",children:"Cancel"}),e.jsx("button",{onClick:v,className:"flex-1 h-[48px] rounded-3xl bg-brand-500 text-white text-base font-bold hover:bg-brand-600 transition-colors",children:"Select Services"})]}),e.jsx("div",{className:"flex-1 flex items-center justify-center opacity-5",children:e.jsx("img",{src:"/assets/rocket2.png",alt:"",className:"max-w-[552px] max-h-[555px] object-contain",onError:u=>{u.target.style.display="none"}})})]}):e.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[e.jsxs("div",{className:"mb-5",children:[e.jsx("p",{className:"text-base font-medium text-neutral-800 mb-2",children:"Filter by Company"}),e.jsxs(Vs,{value:b,onValueChange:g,children:[e.jsx(Ws,{className:"h-[48px] px-4 roun
9ded-full border-[1.4px] border-neutral-200 bg-neutral-50 text-base text-neutral-800",children:e.jsx(Ys,{placeholder:"All Companies"})}),e.jsxs(Zs,{children:[e.jsx(zt,{value:"all",children:"All Companies"}),L.map(u=>e.jsx(zt,{value:u,children:u},u))]})]}),e.jsxs("div",{className:"flex items-center mt-3",children:[e.jsx("span",{className:"text-sm font-semibold text-brand-500",children:b==="all"?"All Companies":b}),e.jsx("button",{onClick:()=>g("all"),className:"ml-1",children:e.jsx(Be,{className:"w-5 h-5 text-brand-500"})})]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto min-h-0 -mx-2 px-2",children:Object.entries(S).map(([u,F])=>e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:`h-[26px] flex items-center justify-center rounded-full px-3 mb-3 ${u==="No Company Selected"?"bg-warning-50":"bg-brand-100"}`,children:e.jsx("span",{className:"text-sm font-bold text-neutral-800",children:u})}),e.jsxs("div",{className:"flex items-center justify-between mb-2 px-1",children:[e.jsx("span",{className:"text-sm font-bold text-neutral-800",children:"Service Name"}),e.jsx("span",{className:"text-sm font-bold text-neutral-800 w-[128px]",children:"Price"})]}),F.map(P=>{var G,X;return e.jsxs("div",{className:"flex items-center justify-between py-2 px-1",children:[e.jsx("span",{className:"text-base text-neutral-800",children:((G=P.service)==null?void 0:G.name)||"Unknown Service"}),e.jsxs("div",{className:"flex items-center justify-between w-[128px]",children:[e.jsxs("span",{className:"text-lg font-medium text-neutral-800 flex items-center gap-1",children:[e.jsx(Z,{className:"size-4"}),((X=P.service)==null?void 0:X.tokensCost)||1]}),e.jsx("button",{onClick:()=>i(P),className:"w-[35px] flex items-center justify-center",children:e.jsx(qn,{className:"w-5 h-5"})})]})]},P.id)})]},u))}),e.jsx("div",{className:"mt-auto pt-4",children:e.jsxs("div",{className:"bg-brand-50 rounded-2xl p-3.5",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-base font-bold text-neutral-800",children:"Total Amount"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-2xl font-bold text-brand-900 flex items-center gap-1",children:[e.jsx(Z,{className:"size-6"}),I]}),e.jsxs("span",{className:"text-sm text-neutral-500",children:["($",T.toLocaleString("en-GB"),")"]})]})]}),e.jsx("p",{className:"text-base font-medium text-neutral-700 mb-5",children:"If you pay for all services at once, you'll skip this step in the process and receive results faster."}),y&&e.jsxs("div",{className:"flex items-center justify-between text-sm text-neutral-500 mb-4",children:[e.jsx("span",{children:"Your Tokens"}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Z,{className:"size-4"}),y.tokens||0]})]}),e.jsxs("div",{className:"flex gap-6",children:[e.jsx("button",{onClick:()=>d(!1),className:"flex-1 h-[48px] rounded-3xl text-base font-bold text-brand-900 hover:bg-white/50 transition-colors",children:"Cancel"}),((y==null?void 0:y.tokens)||0)>=I?e.jsxs("button",{onClick:f,disabled:h,className:"flex-1 h-[48px] rounded-3xl bg-brand-500 text-white text-base font-bold hover:bg-brand-600 transition-colors disabled:opacity-50 flex items-center justify-center gap-2",children:[h?e.jsx(rt,{className:"w-5 h-5"}):null,"Pay for all"]}):e.jsxs("button",{onClick:x,disabled:w,className:"flex-1 h-[48px] rounded-3xl bg-brand-500 text-white text-base font-bold hover:bg-brand-600 transition-colors disabled:opacity-50 flex items-center justify-center gap-2",children:[w?e.jsx(rt,{className:"w-5 h-5"}):null,"Buy ",I-((y==null?void 0:y.tokens)||0)," Tokens"]})]})]})})]})]})})]})}function Vn(t){return e.jsx(xn,{...t})}const Wn=()=>e.jsx("svg",{width:"24",height:"24",viewBox:"0 0 40 40",fill:"none","aria-hidden":"true",className:"size-6",children:e.jsx("path",{d:"M27 9H13C11.6744 9.00159 10.4036 9.52888 9.46622 10.4662C8.52888 11.4036 8.00159 12.6744 8 14V26C8.00159 27.3256 8.52888 28.5964 9.46622 29.5338C10.4036 30.4711 11.6744 30.9984 13 31H27C28.3256 30.9984 29.5964 30.4711 30.5338 29.5338C31.4711 28.5964 31.9984 27.3256 32 26V14C31.9984 12.6744 31.4711 11.4036 30.5338 10.4662C29.5964 9.52888 28.3256 9.00159 27 9ZM13 11H27C27.5988 11.0012 28.1835 11.1815 28.679 11.5178C29.1744 11.8541 29.5579 12.3309 29.78 12.887L22.122 20.546C21.5584 21.1073 20.7954 21.4225 20 21.4225C19.2046 21.4225 18.4416 21.1073 17.878 20.546L10.22 12.887C10.4421 12.3309 10.8256 11.8541 11.321 11.5178C11.8165 11.1815 12.4012 11.0012 13 11ZM27 29H13C12.2044 29 11.4413 28.6839 10.8787 28.1213C10.3161 27.5587 10 26.7956 10 26V15.5L16.464 21.96C17.4026 22.8963 18.6743 23.422 20 23.422C21.3257 23.422 22.5974 22.8963 23.536 21.96L30 15.5V26C30 26.7956 29.6839 27.5587 29.1213 28.1213C28.5587 28.6839 27.7956 29 27 29Z",fill:"currentColor"})}),Yn=()=>e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M1 1L11 11M11 1L1 11",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})});function Zn({onIncorporate:t}){const[n,a]=l.useState(!1),r=Ks(h=>h.openChatWithCategory);l.useEffect(()=>{document.cookie.split("; ").find(j=>j.startsWith("service_not_listed_closed="))||a(!0)},[]);const c=()=>{a(!1);const h=new Date;h.setTime(h.getTime()+365*24*60*60*1e3),document.cookie="service_not_listed_closed=true; expires="+h.toUTCString()+"; path=/"},d=()=>r("LEGAL");return n?e.jsxs("div",{className:"relative mt-4 flex w-full flex-col gap-4 roun
9ded-3xl px-4 py-4 shadow-2xl sm:flex-row sm:items-center sm:justify-between sm:gap-6 sm:px-6 sm:pr-14 lg:rounded-full lg:pl-8",style:{background:"rgba(179, 217, 255, 0.6)",backdropFilter:"blur(10px)"},children:[e.jsxs("button",{type:"button",onClick:d,className:"group flex min-w-0 items-center gap-3 rounded-full pr-8 text-left focus:outline-none sm:pr-0 focus-visible:ring-2 focus-visible:ring-[#002ED3] focus-visible:ring-offset-2 focus-visible:ring-offset-[#CFE4FF]",children:[e.jsx("span",{className:"flex size-11 shrink-0 items-center justify-center rounded-full bg-white/70 text-[#002ED3] transition-all group-hover:bg-white group-hover:shadow-md group-active:scale-95",children:e.jsx(Wn,{})}),e.jsxs("span",{className:"min-w-0 text-[15px] font-medium leading-[140%] text-neutral-800 transition-colors group-hover:text-[#002ED3] sm:text-base",children:["Service not listed?"," ",e.jsx("span",{className:"whitespace-nowrap font-bold underline-offset-4 group-hover:underline",children:"Contact manager"})]})]}),e.jsxs("div",{className:"flex w-full min-w-0 items-center gap-3 sm:w-auto sm:shrink-0 lg:gap-4",children:[e.jsx("span",{className:"hidden select-none bg-clip-text text-base font-bold lg:inline",style:{WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundImage:"linear-gradient(18.72deg, #E74E1D 14.83%, #FD9834 94.3%)"},children:"Set Up Incorporation!"}),e.jsx("button",{type:"button",onClick:t,className:"h-11 w-full rounded-full bg-neutral-950 px-5 sm:w-auto sm:shrink-0 text-[15px] font-bold text-white shadow-sm transition-all hover:bg-[#2B2D36] hover:shadow-lg focus:outline-none focus-visible:ring-2 focus-visible:ring-[#002ED3] focus-visible:ring-offset-2 focus-visible:ring-offset-[#CFE4FF] active:scale-[0.98] sm:px-6 sm:text-base",children:"Incorporation & Structuring"})]}),e.jsx("button",{type:"button",onClick:c,title:"Hide this suggestion",className:"absolute right-3 top-3 flex size-7 items-center justify-center rounded-full text-[#5B6474] transition-colors hover:bg-white/70 hover:text-neutral-900 focus:outline-none focus-visible:ring-2 focus-visible:ring-[#002ED3] focus-visible:ring-offset-2 focus-visible:ring-offset-[#CFE4FF] sm:right-4 sm:top-1/2 sm:-translate-y-1/2","aria-label":"Hide this suggestion",children:e.jsx(Yn,{})})]}):null}const Xn='[data-tour="legal-cart"] button',ie=0,Kn=["0 0 0 2px #fff","0 0 0 4.5px #3366ff","0 0 0 10px rgba(51, 102, 255, 0.28)","0 0 30px 6px rgba(51, 102, 255, 0.45)","0 0 0 100vmax rgba(6, 10, 22, 0.7)"].join(", "),Zt=24,Qn=640,Jn=280,ea=420,le=16;function ta(t){if(typeof document>"u")return null;const n=document.querySelector(t);if(!n)return null;const a=n.getBoundingClientRect();return!a.width||!a.height?null:{top:a.top,left:a.left,width:a.width,height:a.height}}function sa(t){const n=[];for(let a=t==null?void 0:t.parentElement;a;a=a.parentElement)n.push({node:a,top:a.scrollTop,left:a.scrollLeft});return()=>{n.forEach(({node:a,top:r,left:c})=>{a.scrollTop!==r&&(a.scrollTop=r),a.scrollLeft!==c&&(a.scrollLeft=c)})}}function na(t,n){if(!t)return null;const{width:a,height:r}=n,c=t.top+t.height+ie;if(c+Zt+Jn>r)return null;const d=c+Zt,h=t.left+t.width/2;if(a<Qn){const b=a-le*2;return{top:d,left:le,width:b,arrowLeft:Xt(h-le,24,b-24)}}const j=Math.min(ea,a-le*2),w=Math.max(le,a-(t.left+t.width+ie)),N=Math.max(le,a-w-j);return{top:d,left:N,width:j,arrowLeft:Xt(h-N,24,j-24)}}const Xt=(t,n,a)=>Math.min(Math.max(t,n),a);function aa({open:t,onOpenChange:n,anchorSelector:a=Xn}){const[r,c]=l.useState(null),[d,h]=l.useState({width:0,height:0}),j=l.useRef(null);l.useLayoutEffect(()=>{var A,C;if(!t){c(null),(A=j.current)==null||A.call(j),j.current=null;return}const b=document.querySelector(a);j.current||(j.current=sa(b)),(C=b==null?void 0:b.scrollIntoView)==null||C.call(b,{block:"nearest",inline:"nearest"});const g=()=>{c(ta(a)),h({width:window.innerWidth,height:window.innerHeight})};g();const _=window.requestAnimationFrame(g),y=window.setTimeout(g,350);return window.addEventListener("resize",g),window.addEventListener("scroll",g,!0),()=>{window.cancelAnimationFrame(_),window.clearTimeout(y),window.removeEventListener("resize",g),window.removeEventListener("scroll",g,!0)}},[t,a]);
9const w=na(r,d),N=w?{top:w.top,left:w.left,width:w.width,right:"auto"}:void 0;return e.jsxs(pt,{open:t,onOpenChange:n,children:[t&&r&&ns.createPortal(e.jsx("div",{"data-testid":"cart-intro-spotlight","aria-hidden":"true",className:"pointer-events-none fixed z-[110] rounded-full",style:{top:r.top-ie,left:r.left-ie,width:r.width+ie*2,height:r.height+ie*2,boxShadow:Kn}}),document.body),e.jsxs(ht,{"data-testid":"cart-intro-dialog",overlayClassName:r?"bg-transparent":void 0,phoneSheet:!w,hideClose:!0,className:z("gap-0 rounded-2xl border-[1.4px] border-[#305DFF] bg-white p-6 shadow-[-2px_20px_50px_-10px_rgba(48,93,255,0.1)] sm:rounded-2xl",w?"max-w-none translate-x-0 translate-y-0 overflow-visible":"max-w-[420px]"),style:N,children:[w&&e.jsx("span",{"aria-hidden":"true",className:"absolute -top-[9px] size-4 rotate-45 rounded-tl-[3px] border-l-[1.4px] border-t-[1.4px] border-[#305DFF] bg-white",style:{left:w.arrowLeft-8}}),e.jsxs(Ht,{className:"absolute right-[14px] top-[14px] flex size-8 items-center justify-center rounded-full bg-[#F3F4F6] transition-colors hover:bg-gray-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-[#305DFF] focus-visible:ring-offset-2",children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M1 1L11 11M11 1L1 11",stroke:"#ABB3C3",strokeWidth:"2",strokeLinecap:"round"})}),e.jsx("span",{className:"sr-only",children:"Close"})]}),e.jsxs("div",{className:"flex items-start gap-4 pr-8",children:[e.jsx("span",{className:"flex size-11 shrink-0 items-center justify-center rounded-full bg-[#E8F7F0] text-[#1CB17B]",children:e.jsx(fs,{className:"size-5","aria-hidden":"true"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(os,{className:"text-[20px] font-bold leading-[140%] text-[#040404]",children:"Added â your cart is up here"}),e.jsx(cs,{className:"mt-1.5 text-[15px] leading-[150%] text-[#4B5563]",children:"Every service you add collects in the Cart. Open it whenever you like to review what is in it and pay for everything at once."})]})]}),e.jsx(Ht,{asChild:!0,children:e.jsx("button",{type:"button",className:"mt-5 h-11 w-full rounded-[24px] bg-[#305DFF] text-[16px] font-bold leading-[140%] text-white transition-colors hover:bg-[#2750E0] sm:ml-auto sm:w-auto sm:px-8",children:"Got it"})})]})]})}function la({onIncorporate:t}){const n=Pe(),{openChat:a}=ls(),r=[{key:"ai",label:"Ask Emily",image:rs,onClick:()=>a(),title:"Emily, our AI legal expert, is coming soon"},{key:"legislation",label:"Legislation",image:ut,onClick:()=>n("/CountryLegislation")},{key:"incorporate",label:"Incorporate",image:ps,onClick:t}];return e.jsx("div",{className:"no-scrollbar -mx-4 flex items-center gap-2 overflow-x-auto px-4",children:r.map(c=>e.jsxs("button",{type:"button",onClick:c.onClick,title:c.title,className:"flex h-9 shrink-0 items-center gap-2 rounded-full border border-[#E5E7EB] bg-white py-0 pl-1 pr-3 transition-colors active:bg-gray-50",children:[e.jsx("img",{src:c.image,alt:"",className:"size-7 shrink-0 rounded-full bg-[#F3F4F6] object-cover"}),e.jsx("span",{className:"whitespace-nowrap text-[12.5px] font-bold leading-[140%] text-[#16111C]",children:c.label})]},c.key))})}const ra=[{value:"price-asc",label:"Low to High"},{value:"price-desc",label:"High to Low"}];function Ke({children:t}){return e.jsx("span",{className:"text-[12px] font-bold uppercase tracking-[0.02em] text-[#6B7280]",children:t})}function ia({open:t,onOpenChange:n,selectedCompany:a,onPickCompany:r,countryOptions:c=[],selectedCountries:d=[],onCountriesChange:h,countrySearch:j="",onCountrySearchChange:w,sortBy:N,onSortChange:b,onlyRequested:g,onOrderedChange:_,liveOrderCount:y=0,resultCount:A=null,onReset:C}){const I=x=>{h==null||h(d.includes(x)?d.filter(v=>v!==x):[...d,x])},D=c.filter(x=>d.includes(x.code)),S=c.filter(x=>!d.includes(x.code)),L=j.trim()?20:Math.max(0,8-D.length),i=[...D,...S.slice(0,L)],f=Math.max(0,S.length-L);return e.jsx(gt,{open:t,onOpenChange:n,children:e.jsxs(bt,{side:"bottom",showCloseButton:!1,children:[e.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 px-4 pb-1 pt-2",children:[e.jsx("h2",{className:"text-[19px] font-bold leading-[140%] text-[#040404]",children:"Filters"}),e.jsx("button",{type:"button",onClick:()=>n(!1),"aria-label":"Close",className:"flex size-8 items-center justify-center rounded-full bg-[#F3F4F6] transition-colors hover:bg-gray-200",children:e.jsx(Be,{className:"size-3",style:{color:"#ABB3C3"},strokeWidth:2.5})})]}),e.jsxs("div",{className:"no-scrollbar flex min-h-0 flex-1 flex-col gap-5 overflow-y-auto px-4 pb-4 pt-3",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(Ke,{children:"Company"}),e.jsxs("button",{type:"button",onClick:r,className:"flex h-12 items-center gap-2.5 rounded-xl border-[1.4px] border-[#
9E5E7EB] bg-white px-3 text-left transition-colors hover:bg-gray-50",children:[e.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-full bg-[#24252B]",children:e.jsx(jn,{className:"size-4"})}),e.jsx("span",{className:z("min-w-0 flex-1 truncate text-[14px] font-bold leading-[140%]",a?"text-[#16111C]":"text-[#6B7280]"),children:(a==null?void 0:a.company_name)||(a==null?void 0:a.name)||"No company attached"}),e.jsx(ds,{className:"size-4 shrink-0 text-[#6B7280]"})]}),e.jsx("span",{className:"text-[11.5px] font-medium leading-[140%] text-[#6B7280]",children:"A service can be ordered with no company attached."})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(Ke,{children:"Country"}),e.jsxs("div",{className:"relative",children:[e.jsx(be,{className:"pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-gray-500"}),e.jsx("input",{type:"text",value:j,onChange:x=>w==null?void 0:w(x.target.value),placeholder:"Search country...",className:"h-10 w-full rounded-full border border-transparent bg-[#F0F7FF] pl-9 pr-3 text-base text-neutral-800 placeholder:text-neutral-500 focus:border-brand-500 focus:outline-none"})]}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("button",{type:"button",onClick:()=>h==null?void 0:h([]),className:z("flex h-11 items-center justify-between gap-2 rounded-lg px-3 text-left text-sm transition-colors",d.length===0?"bg-[#F0F7FF] font-bold text-[#002ED3]":"text-[#1F2937] hover:bg-[#F9FAFB]"),children:[e.jsx("span",{children:"All countries"}),d.length===0?e.jsx(Y,{className:"size-4 shrink-0"}):null]}),i.map(x=>{const v=d.includes(x.code);return e.jsxs("button",{type:"button",onClick:()=>I(x.code),className:z("flex h-11 items-center justify-between gap-2 rounded-lg px-3 text-left text-sm transition-colors",v?"bg-[#F0F7FF] font-bold text-[#002ED3]":"text-[#1F2937] hover:bg-[#F9FAFB]"),children:[e.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[x.flag?`${x.flag} `:"",x.name]}),v?e.jsx(Y,{className:"size-4 shrink-0"}):null]},x.code)}),f>0?e.jsx("span",{className:"px-3 pt-1 text-[11.5px] font-medium leading-[140%] text-[#6B7280]",children:`${f} more â type a name to find it`}):null]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(Ke,{children:"Sort by price"}),e.jsx("div",{className:"flex gap-2.5",children:ra.map(x=>{const v=N===x.value;return e.jsxs("button",{type:"button",onClick:()=>b==null?void 0:b(x.value),className:z("flex h-11 flex-1 items-center justify-center gap-2 rounded-xl border-[1.4px] text-[13.5px] font-bold text-[#16111C] transition-colors",v?"border-[#305DFF] bg-[#F0F7FF]":"border-[#E5E7EB] bg-white"),children:[e.jsx("span",{className:z("flex size-[18px] items-center justify-center rounded-full border-2",v?"border-[#305DFF]":"border-[#D1D5DB]"),children:v?e.jsx("span",{className:"size-2 rounded-full bg-[#305DFF]"}):null}),x.label]},x.value)})})]}),e.jsxs("button",{type:"button",role:"switch","aria-checked":!!g,disabled:!g&&y===0,onClick:()=>_==null?void 0:_(!g),className:z("flex items-center gap-2.5 rounded-xl border-[1.4px] px-3.5 py-3 text-left transition-colors",g?"border-[#305DFF] bg-[#F0F7FF]":"border-[#E5E7EB] bg-white",!g&&y===0&&"cursor-not-allowed opacity-60"),children:[e.jsx(xs,{className:"size-[18px] shrink-0 text-[#6B7280]"}),e.jsxs("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[e.jsx("span",{className:"text-[14px] font-bold leading-[140%] text-[#16111C]",children:"Ordered only"}),e.jsx("span",{className:"text-[11.5px] font-medium leading-[140%] text-[#6B7280]",children:y>0?`${y} service${y===1?"":"s"} you have ordered`:"Nothing ordered yet"})]}),e.jsx("span",{className:z("relative h-6 w-[45px] shrink-0 rounded-full border border-[#E2E8F0] transition-colors",g?"bg-[#305DFF]":"bg-[#F0F7FF]"),children:e.jsx("span",{className:z("absolute top-1/2 size-[18px] -translate-y-1/2 rounded-full transition-all",g?"left-[24px] bg-white":"left-[3px] bg-[#6B7280]")})})]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2.5 border-t border-[#E5E7EB] bg-white px-4 pb-6 pt-3",children:[e.jsx("button",{type:"button",onClick:C,className:"h-12 shrink-0 rounded-[24px] border-[1.4px] border-[#
9E5E7EB] px-5 text-[14px] font-bold text-[#01145F] transition-colors hover:bg-gray-50",children:"Reset"}),e.jsx("button",{type:"button",onClick:()=>n(!1),className:"h-12 flex-1 rounded-[24px] bg-[#305DFF] text-[15px] font-bold text-white transition-colors hover:bg-[#2750E0]",children:A===null?"Show services":`Show ${A} service${A===1?"":"s"}`})]})]})})}const oa=["PENDING","APPLIED","IN_PROCESS","REVIEWED","PURCHASED","COMPLETED"],Qe=t=>`${t} token${t===1?"":"s"}`;function Je({label:t,value:n,note:a}){return e.jsxs("div",{className:"flex items-start justify-between gap-3 border-t border-[#F3F4F6] py-2.5 first:border-t-0",children:[e.jsx("span",{className:"shrink-0 text-[13.5px] font-medium leading-[140%] text-[#6B7280]",children:t}),e.jsxs("span",{className:"min-w-0 text-right",children:[e.jsx("span",{className:"flex items-center justify-end gap-1.5 text-[14px] font-bold leading-[140%] text-[#16111C]",children:n}),a?e.jsx("span",{className:"mt-0.5 block text-[11px] font-medium leading-[140%] text-[#6B7280]",children:a}):null]})]})}function et({children:t,tone:n="grey"}){return e.jsx("span",{className:z("inline-flex h-[22px] items-center gap-1.5 rounded-md px-2 text-[11px] font-bold leading-[140%]",n==="brand"?"bg-[#F0F7FF] text-[#1D4ED8]":"bg-[#F3F4F6] text-[#374151]"),children:t})}function tt({number:t,children:n}){return e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx("span",{className:"flex size-5 shrink-0 items-center justify-center rounded-full bg-[#F0F7FF] text-[11px] font-bold text-[#305DFF]",children:t}),e.jsx("span",{className:"text-[12.5px] font-medium leading-[1.4] text-[#374151]",children:n})]})}function ca({service:t,isOpen:n,onClose:a,onApply:r,onAddToCart:c,onViewWorkflow:d,onPay:h}){var S;const j=us(640),{countries:w}=ms(),N=((S=t==null?void 0:t.countries)==null?void 0:S[0])||null,b=l.useMemo(()=>{if(!N)return null;const L=(w||[]).find(i=>i.code===N);return(L==null?void 0:L.name)||N},[w,N]);if(!t)return null;const g=t._status||null,_=t._request||null,y=Number(t.price??t.tokensCost??1)||1,A=(t.description||"").trim(),C=jt[t.category]||t.category||null,I=String(t.companyType||"").toUpperCase()==="INTERNATIONAL",D=g==="NOT_PAID"?e.jsx("button",{type:"button",onClick:()=>h==null?void 0:h(_||t),className:"h-12 flex-1 rounded-[24px] bg-success-500 text-base font-bold text-white transition-colors hover:bg-success-600",children:"Pay Here"}):g&&oa.includes(g)?e.jsx("button",{type:"button",onClick:()=>d==null?void 0:d(_||t),className:"h-12 flex-1 rounded-[24px] border-[1.4px] border-[#01145F] bg-white text-base font-bold text-[#01145F] transition-colors hover:bg-[#F0F4FF]",children:"Open Flow"}):g==="DECLINED"?e.jsx("p",{className:"flex-1 text-center text-[13px] font-medium leading-[140%] text-[#6B7280]",children:"This request was declined. Your manager can tell you why."}):e.jsxs(e.Fragment,{children:[c?e.jsxs("button",{type:"button",onClick:()=>c(t),className:"flex h-12 shrink-0 items-center gap-2 rounded-[24px] border-[1.4px] border-[#E5E7EB] bg-white px-4 text-[14px] font-bold text-[#01145F] transition-colors hover:bg-gray-50",children:[e.jsx(ot,{className:"size-[18px]",color:"#01145F"}),"Cart"]}):null,e.jsx("button",{type:"button",onClick:()=>r==null?void 0:r(t),className:"h-12 flex-1 rounded-[24px] bg-[#305DFF] text-[15px] font-bold text-white transition-colors hover:bg-[#2750E0]",children:`Apply · ${Qe(y)}`})]});return e.jsx(gt,{open:n,onOpenChange:L=>!L&&(a==null?void 0:a()),children:e.jsxs(bt,{side:j?"bottom":"right",showCloseButton:!1,children:[e.jsx("button",{type:"button",onClick:a,"aria-label":"Close",className:"absolute right-4 top-4 z-10 flex size-8 items-center justify-center rounded-full bg-[#F3F4F6] transition-colors hover:bg-gray-200 sm:right-6 sm:top-6",children:e.jsx(Be,{className:"size-3",style:{color:"#ABB3C3"},strokeWidth:2.5})}),e.jsxs("div",{className:"no-scrollbar flex min-h-0 flex-1 flex-col gap-3.5 overflow-y-auto px-4 pb-4 pt-3 sm:gap-5 sm:px-8 sm:pt-8",children:[e.jsxs("div",{className:"flex items-center gap-2 rounded-xl border border-[#F3F4F6] bg-[#F9FAFB] px-3 py-2.5 pr-12 sm:pr-14",children:[e.jsx("span",{className:"shrink-0 text-[12px] font-medium leading-[140%] text-[#6B7280]",children:"Provider"}),e.jsx(_e,{name:Le(t),width:96,textClassName:"text-[13.5px] font-semibold"}),e.jsx("span",{className:"ml-auto hidden text-[11px] font-semibold leading-[140%] text-[#6B7280] min-[380px]:block",children:"Shown after the order"})]}),e.jsx("h2",{className:"text-[18.5px] font-bold leading-[1.28] tracking-[-0.01em] text-[#040404] sm:text-[22px]",children:gs(t,{limit:96})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[C?e.jsx(et,{tone:"brand",children:C}):null,b?e.jsxs(et,{children:[N?e.jsx(mt,{code:N,height:9}):null,b]}):null,e.jsx(et,{children:I?"International":"Local company"}),g?e.jsx(dt,{status:g,variant:"pill",colorMap:xt,fallback:{bg:"bg-neutral-200",text:"text-neutral-500"},className:"h-[22px] justify-center rounded-full px-2 py-0 text-[11px] font-bold leading-[140%]"}):null]}),A?e.jsx("p",{className:"text-[13.5px] font-normal leading-[1.5] text-[#374151] sm:text-[15px]",children:A}
9):null,e.jsxs("div",{className:"rounded-2xl border border-[#E5E7EB] px-3.5",children:[e.jsx(Je,{label:"Our price",value:e.jsxs(e.Fragment,{children:[e.jsx(Z,{className:"size-[17px]"}),e.jsx("span",{className:"text-[#305DFF]",children:Qe(y)})]})}),e.jsx(Je,{label:"Provider price",value:Ie(t),note:"estimated, the final price may vary"}),e.jsx(Je,{label:"Delivery",value:t.serviceTime||t.expectedTime||"â"})]}),g?null:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[12px] font-bold uppercase tracking-[0.02em] text-[#374151]",children:"What happens next"}),e.jsxs(tt,{number:1,children:["Apply â ",Qe(y)," charged, cancellable within 10 seconds."]}),e.jsx(tt,{number:2,children:"A manager agrees the scope with the provider and sends the invoice."}),e.jsx(tt,{number:3,children:"You pay the provider fee and follow the work in Flow."})]})]}),e.jsx("div",{className:"flex shrink-0 items-center gap-2.5 border-t border-[#E5E7EB] bg-white px-4 pb-6 pt-3 sm:px-8",children:D})]})})}const st="/users/me/ui-flags",ge="cartIntroSeen";function da(t){if(!t||typeof t!="object"||!("uiFlags"in t))return;const n=t.uiFlags;return!n||typeof n!="object"||Array.isArray(n)?{}:n}function Ae(t){var a;return((a=t==null?void 0:t.response)==null?void 0:a.status)===404}let nt=null;async function at(t){if(nt)throw nt;try{const{data:n}=await t();return(n==null?void 0:n.flags)??{}}catch(n){throw Ae(n)&&(nt=n),n}}const lt={read:()=>at(()=>Ye.get(st)),update:t=>at(()=>Ye.patch(st,t)),reset:()=>at(()=>Ye.delete(st))},Kt="resetCartIntro",xa=t=>`bankstore:${ge}:${t||"anonymous"}`,Qt=t=>{try{return window.localStorage.getItem(t)==="1"}catch{return!1}},Jt=(t,n)=>{try{n?window.localStorage.setItem(t,"1"):window.localStorage.removeItem(t)}catch{}};function ua(){const{user:t,updateUser:n}=ft(),[a,r]=as(),c=(t==null?void 0:t.id)??null,d=xa(c),h=!!a.get(Kt),[j,w]=l.useState(!1),[N,b]=l.useState(!1),g=l.useRef(!1),_=l.useRef("unknown"),y=l.useRef(null),A=l.useRef(null);if(!A.current){let x;const v=new Promise(T=>{x=T});A.current={promise:v,resolve:x}}const C=l.useRef(t);C.current=t;const I=l.useRef(n);I.current=n;const D=l.useRef(r);D.current=r;const S=l.useCallback((x,v)=>{g.current=x,_.current=v,w(x),b(!0),A.current.resolve(x)},[]),L=l.useCallback(x=>{var T;const v=C.current;v&&((T=I.current)==null||T.call(I,{...v,uiFlags:x}))},[]);l.useEffect(()=>{let x=!1;if(!c){S(Qt(d),"local");return}if(h){y.current=c,Jt(d,!1),lt.update({[ge]:!1}).then(T=>{var O;((O=C.current)==null?void 0:O.id)===c&&L(T),S(!1,"server")}).catch(T=>{S(!1,Ae(T)?"local":"unknown")}),D.current(T=>{const O=new URLSearchParams(T);return O.delete(Kt),O},{replace:!0});return}if(y.current===c)return;const v=da(t);if(v){S(!!v[ge],"server");return}return lt.read().then(T=>{x||(L(T),S(!!T[ge],"server"))}).catch(T=>{x||S(Qt(d),Ae(T)?"local":"unknown")}),()=>{x=!0}},[c,h,d,S,L]);const i=l.useCallback(async()=>(await A.current.promise,g.current),[]),f=l.useCallback(()=>{g.current=!0,w(!0),Jt(d,!0),!(!c||_.current==="local")&<.update({[ge]:!0}).then(x=>{_.current="server",L(x)}).catch(x=>
9{if(Ae(x)){_.current="local";return}console.warn("Could not record the cart introduction on the account:",x)})},[d,c,L]);return{seen:j,ready:N,isSeen:i,markSeen:f}}const pa="legalSupport.tutorialBanner.dismissed";function Ns(t){return`${pa}:${t||"anon"}`}function es(t){try{return localStorage.getItem(Ns(t))==="1"}catch{return!1}}function ha(t){try{localStorage.setItem(Ns(t),"1")}catch{}}function ma({userId:t,className:n=""}){const[a,r]=l.useState(()=>es(t)),[c,d]=l.useState(()=>!!Qs());if(l.useEffect(()=>{r(es(t))},[t]),l.useEffect(()=>Js(j=>d(!!j)),[]),a||c)return null;const h=()=>{ha(t),r(!0)};return e.jsxs("div",{role:"region","aria-label":"Legal Support walkthrough",className:`flex flex-wrap items-center gap-x-4 gap-y-2 rounded-2xl border border-[#D6E4FF] bg-[#F0F7FF] px-4 py-3 sm:px-5 ${n}`,children:[e.jsxs("p",{className:"min-w-0 grow-[999] basis-60 text-[14px] leading-[140%] text-[#1F2937] sm:text-[15px]",children:[e.jsx("span",{className:"font-bold text-[#01145F]",children:"New to Legal Support?"})," A short walkthrough shows what the catalogue is, where an incorporation starts and where the services you pick collect."]}),e.jsxs("div",{className:"flex shrink-0 grow items-center gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>{h(),tn("legal")},className:"inline-flex h-10 grow items-center justify-center gap-2 rounded-3xl bg-[#01145F] px-4 text-[14px] font-bold text-white transition-colors hover:bg-[#0A2280]",children:[e.jsx(en,{className:"size-4","aria-hidden":"true"}),"Watch tutorial"]}),e.jsx("button",{type:"button",onClick:h,"aria-label":"Dismiss",className:"flex size-10 items-center justify-center rounded-full text-[#6B7280] transition-colors hover:bg-white hover:text-[#305DFF]",children:e.jsx(Be,{className:"size-4","aria-hidden":"true"})})]})]})}function ts({country:t,isSelected:n,onToggle:a}){return e.jsxs("button",{type:"button",role:"option","aria-selected":n,onClick:()=>a(t.code),className:z("flex w-full items-center justify-between gap-2 rounded-lg px-3 py-2 text-left text-sm transition-colors",n?"bg-[#F0F7FF] text-[#002ED3] font-bold":"text-[#1F2937] hover:bg-[#F9FAFB]"),children:[e.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[t.flag?`${t.flag} `:"",t.name]}),n&&e.jsx(Y,{className:"w-4 h-4 shrink-0"})]})}function fa(t,n){const a=new Set(n??[]),r=[],c=[];for(const d of t??[])(a.has(d.code)?r:c).push(d);return{pinned:r,rest:c}}const ga=new Set(["STRUCTURE_MAINTENANCE","REPORTING","TAX_ADVISING","LEGAL_ASSISTANT","OTHER"]),ss={ALL_SERVICES:[...ga],LEGAL_ASSISTANT:["LEGAL_ASSISTANT","OTHER"]},ba=["PENDING","APPLIED","NOT_PAID","IN_PROCESS","REVIEWED","PURCHASED","COMPLETED"],ja=[{value:"price-asc",label:"Low to High",direction:"asc"},{value:"price-desc",label:"High to Low",direction:"desc"}];function Ka(){const t=Pe(),[n,a]=as(),{user:r,refreshUser:c}=ft(),d=ua(),[h,j]=l.useState(!1),[w,N]=l.useState([]),[b,g]=l.useState([]),[_,y]=l.useState([]),[A,C]=l.useState(!1),[I,D]=l.useState(null),[S,L]=l.useState([]),[i,f]=l.useState(!0),[x,v]=l.useState(!0),[T,O]=l.useState(!0),u=us(640),[F,P]=l.useState(!1),[G,X]=l.useState(!1),[oe,J]=l.useState(null),[m,Re]=l.useState(null),[ws,Oe]=l.useState(!1),[Me,ce]=l.useState(!1),[$e,de]=l.useState(""),ze=l.useRef(null),[ys,Nt]=l.useState(!1),[ee,Na]=l.useState(null),[wt,wa]=l.useState(null),[vs,xe]=l.useState(!1),[K,He]=l.useState(null),[Fs,yt]=l.useState(!1),[vt,Cs]=l.useState(null),[R,Ft]=l.useState("ALL_SERVICES"),[te,je]=l.useState(""),[E,ue]=l.useState([]),[Q,Ct]=l.useState(!1),[Ne,pe]=l.useState(""),[St,Ss]=l.useState([]),Et=l.useRef(null),[he,we]=l.useState("price-asc"),[M,ye]=l.useState(!1),Es=(M?1:0)+(E.length>0?1:0),[Ge,U]=l.useState(1),[kt,ks]=l.useState(1),[ve,As]=l.useState(null),[Fe,At]=l.useState(""),[Ds,Dt]=l.useState(!1),qe=l.useRef(null);l.useEffect(()=>{const s=o=>{ze.current&&!ze.current.contains(o.target)&&(ce(!1),de(""))};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[]),l.useEffect(()=>{const s=setTimeout(()=>At(te.trim()),400);return()=>clearTimeout(s)},[te]),l.useEffect(()=>{const s=n.get("category"),o=n.get("search"),p=n.get("sort");s&&Ft(s),o&&(je(o),At(o.trim())),p&&["price-asc","price-desc"].includes(p)&&we(p),n.get("requested")==="1"&&ye(!0)},[]);const q=l.useCallback((s,o=!1)=>{const p=()=>{const k=new URLSearchParams(n);
9Object.entries(s).forEach(([B,$])=>{$&&$!=="all"&&$!=="ALL_SERVICES"?k.set(B,$):k.delete(B)}),m!=null&&m.id&&k.set("companyId",m.id),a(k,{replace:!0})};o?(qe.current&&clearTimeout(qe.current),qe.current=setTimeout(p,500)):p()},[n,a,m]),It=l.useCallback(async()=>{f(!0);try{const s={page:Ge,limit:10,sort:he,...Fe&&{search:Fe},...ss[R]?{categories:ss[R].join(",")}:{category:R},...E.length>0&&{countryCodes:E.join(",")},...(m==null?void 0:m.id)&&{companyId:m.id},...M&&{requested:"true"}},o=await wn.getAllServices(s);N(o.data||[]),o.meta&&(ks(o.meta.totalPages||1),As(typeof o.meta.total=="number"?o.meta.total:null))}catch(s){console.error("Failed to load provider services:",s),N([])}finally{f(!1)}},[R,E,Ge,he,Fe,m==null?void 0:m.id,M]),Tt=l.useCallback(async()=>{C(!0);try{const s=await sn.getAll();y(Array.isArray(s)?s:[])}catch(s){console.error("Failed to load incorporations:",s),y([])}finally{C(!1)}},[]),Is=w;l.useEffect(()=>{U(1)},[Fe,he,M]);const se=l.useCallback(async()=>{if(r){v(!0);try{const s={...(m==null?void 0:m.id)&&{companyId:m.id},limit:200},o=await W.getMyRequests(s);g(o.data||[])}catch(s){console.error("Failed to load user requests:",s),g([])}finally{v(!1)}}},[r,m]),me=l.useCallback(async()=>{if(r)try{const s=await W.getCart();D(s)}catch(s){console.error("Failed to load cart:",s)}},[r]),fe=l.useCallback(s=>{const o=new URLSearchParams;s&&o.set("companyId",s),a(o,{replace:!0})},[a]),Ts=async()=>{var s;if(r){O(!0);try{const o=await is.getAll({createdBy:r.email,limit:100}),p=Array.isArray(o)?o:o.data||[];L(p);const k=n.get("companyId"),B=Fn(n.get("countries"));let $=null;if(k&&p.length>0&&($=p.find(Se=>Se.id===k)),!$&&p.length>0&&B===null&&($=p[0]),$){Re($);const Se=((s=$.country)==null?void 0:s.code)||$.countryCode||"";Se&&ue([Se]),fe($.id)}else B&&ue(B)}catch(o){console.error("Failed to load companies:",o),L([])}finally{O(!1)}}},{countries:V}=ms({scope:"legal-support"});l.useEffect(()=>{if(!(V!=null&&V.length)||E.length===0)return;const s=new Set(V.map(p=>p.code)),o=E.filter(p=>s.has(p));o.length!==E.length&&ue(o)},[V,E]);const _t=nn(),Ce=l.useMemo(()=>{const s=Ne.trim().toLowerCase(),o=V||[];if(!s){const{popular:p,rest:k}=an(o,void 0,_t);return[...p,...k]}return o.filter(p=>{var k,B;return((k=p.name)==null?void 0:k.toLowerCase().includes(s))||((B=p.code)==null?void 0:B.toLowerCase().includes(s))})},[V,Ne,_t]),{pinned:Lt,rest:_s}=l.useMemo(()=>fa(Ce,St),[Ce,St]),Pt=l.useMemo(()=>{if(E.length===0)return"All countries";if(E.length===1){const s=(V||[]).find(o=>o.code===E[0]);return s?`${s.flag?`${s.flag} `:""}${s.name}`:E[0]}return`${E.length} countries`},[E,V]);l.useEffect(()=>{if(!Q)return;const s=o=>{var p;(p=Et.current)!=null&&p.contains(o.target)||(Ct(!1),pe(""))};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[Q]);const ne=l.useCallback(s=>{ue(s),U(1),m&&(Re(null),fe(void 0))},[m,fe]),Bt=l.useCallback(s=>ne(E.includes(s)?E.filter(o=>o!==s):[...E,s]),[ne,E]),Ue=l.useCallback(s=>{var p;Re(s||null);const o=((p=s==null?void 0:s.country)==null?void 0:p.code)||(s==null?void 0:s.countryCode)||"";ue(o?[o]:[]),fe(s==null?void 0:s.id),U(1)},[fe]);l.useEffect(()=>{Ts()},[r==null?void 0:r.id]),l.useEffect(()=>{R==="COMPANY_INCORPORATION"?Tt():It()},[It,Tt,R]),l.useEffect(()=>{se(),me()},[se,me]);const Rt=async s=>{var o,p;try{await W.addToCart({serviceId:s.id,companyId:m==null?void 0:m.id}),await me(),await d.isSeen()?H.success("Added to cart"):(d.markSeen(),j(!0))}catch(k){console.error("Failed to add to cart:",k),H.error(((p=(o=k.response)==null?void 0:o.data)==null?void 0:p.message)||"Failed to add to cart")}},Ot=s=>{He(s),xe(!0)},Ve=l.useRef(new Set),Ls=async s=>{var o;if(!(!s||Ve.current.has(s))){Ve.current.add(s),vt&&(clearTimeout(vt),Cs(null));try{await W.cancelRequest(s),H.success("Application cancelled"),await se(),await c()}catch(p){const k=(o=p==null?void 0:p.response)==null?void 0:o.status;if(k===404||k===410){await se(),await c();return}console.error("Failed to cancel application:",p),H.error(on(p,"Failed to cancel application")),Ve.current.delete(s)}}},Ps=l.useMemo(()=>{var k;const s=K;if(!s)return 0;const o=((k=s.legalProviderService)==null?void 0:k.price)??s.tokensCost??s.tokens_cost??s.price??0,p=Number(o);return Number.isFinite(p)&&p>0?p:0},[K]),Bs=async()=>{var s,o,p;if(K){yt(!0);
9try{const k=await W.apply({serviceId:K.id,companyId:m==null?void 0:m.id});if(xe(!1),(s=I==null?void 0:I.items)!=null&&s.some(B=>B.serviceId===K.id))try{await W.removeFromCart({serviceId:K.id,companyId:m==null?void 0:m.id})}catch{}await se(),await me(),await c(),un({id:`undo-${k.id}`,message:"Application submitted!",onUndo:()=>Ls(k.id)}),He(null)}catch(k){console.error("Failed to apply for service:",k);const B=((p=(o=k.response)==null?void 0:o.data)==null?void 0:p.message)||"Failed to apply for service";B.includes("Insufficient tokens")?(await c(),xe(!0)):H.error(B)}finally{yt(!1)}}},Mt=s=>{const o=Vt(s);if(!o){H.error("That request could not be opened");return}t(o)},$t=s=>{t(`/checkout?type=service&requestId=${s.id}`)},We=()=>{t("/NewCompanyIncorporation")},ae=b.filter(s=>ba.includes(s.status)).length;return b.filter(s=>["APPLIED","PENDING","NOT_PAID","REVIEWED"].includes(s.status)).length,b.filter(s=>["PURCHASED","IN_PROCESS","COMPLETED"].includes(s.status)).length,T?e.jsx(ln,{}):e.jsx("div",{className:"min-h-full bg-page p-4",children:e.jsxs("div",{className:"max-w-[1920px] mx-auto w-full flex flex-col gap-[22px]",children:[e.jsxs("div",{className:"flex flex-row items-center justify-between gap-3",children:[e.jsx("h1",{className:"text-[22px] sm:text-[32px] font-bold leading-[140%] text-[#040404]",children:"Legal Support"}),e.jsx("div",{className:"flex items-center gap-3",children:e.jsx("div",{"data-tour":"legal-cart",children:e.jsx(Un,{cart:I,onCartUpdate:me,onCheckoutSuccess:se,className:"w-auto sm:min-w-[252px]"})})})]}),e.jsx(aa,{open:h,onOpenChange:j}),u?e.jsx(la,{onIncorporate:We}):Ds?e.jsxs("div",{className:"bg-white rounded-2xl shadow-[0px_20px_50px_-10px_rgba(18,49,96,0.1)] px-6 py-2.5 flex items-center justify-between",children:[e.jsx("p",{className:"text-neutral-950 font-medium text-lg",children:"AI Expert, Country Legislation, Company incorporation"}),e.jsxs("button",{onClick:()=>Dt(!1),className:"flex items-center gap-2 h-[40px] px-5 rounded-3xl hover:bg-gray-50 transition-colors",children:[e.jsx(Ee,{className:"w-5 h-5 text-[#305DFF]"}),e.jsx("span",{className:"font-bold text-base",style:{WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundImage:"linear-gradient(11deg, #305DFF 0%, #6730FF 99%)"},children:"Open"})]})]}):e.jsxs("div",{"data-tour":"legal-shortcuts",className:"flex flex-col lg:flex-row items-stretch gap-4 lg:gap-[22px]",children:[e.jsx(Sn,{}),e.jsx(En,{isActive:!!m}),e.jsx(kn,{onIncorporate:We}),e.jsxs("button",{onClick:()=>Dt(!0),"aria-label":"Hide the cards above",className:"flex h-[40px] w-full shrink-0 items-center justify-center gap-2 rounded-xl bg-white shadow-[0px_20px_50px_-10px_rgba(18,49,96,0.1)] transition-colors hover:bg-gray-50 lg:h-auto lg:w-[40px]",children:[e.jsx(rn,{className:"w-5 h-5 text-[#01145F]"}),e.jsx("span",{className:"text-base font-bold text-[#01145F] lg:hidden",children:"Hide"})]})]}),e.jsx(ma,{userId:r==null?void 0:r.id}),e.jsx("div",{"data-tour":"legal-categories",children:e.jsx($n,{activeCategory:R,onCategoryChange:s=>{Ft(s),q({category:s}),U(1)}})}),u?e.jsxs("div",{"data-tour":"legal-filters",className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>P(!0),className:"flex h-[38px] min-w-0 flex-1 items-center gap-1.5 rounded-full bg-[#F0F7FF] pl-3 pr-2.5 text-left",children:[E.length===1?e.jsx(mt,{code:E[0],height:12}):null,e.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] font-bold leading-[140%] text-[#01145F]",children:m?m.company_name||m.name:S.length>0?"No company attached":"All services"}),e.jsx("span",{className:"shrink-0 text-[12px] text-[#6B7280]",children:"·"}),e.jsx("span",{className:"shrink-0 max-w-[104px] truncate text-[13px] font-medium leading-[140%] text-[#374151]",children:Pt.replace(/^[^\p{L}]+/u,"")}),e.jsx(Ee,{className:"size-4 shrink-0 text-[#01145F]"})]}),e.jsx("button",{type:"button","aria-label":"Search services","aria-pressed":G,onClick:()=>X(s=>!s),className:`flex size-[38px] shrink-0 items-center justify-center rounded-full transition-colors ${G||te?"bg-[#F0F7FF] text-[#305DFF]":"bg-[#F3F4F6] text-[#01145F]"}`,children:e.jsx(be,{className:"size-[18px]"})}),e.jsx("button",{type:"button","aria-label":"Filters","aria-haspopup":"dialog",onClick:()=>P(!0),className:`flex size-[38px] shrink-0 items-center justify-center rounded-full ${cn}`,children:e.jsx(dn,{className:"size-[18px]",count:Es})})]}),G||te?e.jsx(Gt,{autoFocus:!0,placeholder:"Search by Service title",value:te,onChange:s=>{const o=qt(s);
9je(o),q({search:o},!0),U(1)},onClear:()=>q({search:""},!1)}):null,R!=="COMPANY_INCORPORATION"&&ve!==null?e.jsxs("span",{className:"px-1 text-[12px] font-semibold leading-[140%] text-[#6B7280]",children:[`${ve} service${ve===1?"":"s"}`,M?" · ordered only":""]}):null]}):null,e.jsxs("div",{"data-tour":u?void 0:"legal-filters",className:`${u?"!hidden ":""}flex flex-col flex-wrap items-stretch gap-3 rounded-2xl bg-white px-3 py-3 shadow-[0px_20px_50px_-10px_rgba(18,49,96,0.1)] md:flex-row md:items-center md:gap-x-6 md:gap-y-3 md:px-4`,children:[R!=="COMPANY_INCORPORATION"&&e.jsx(e.Fragment,{children:e.jsxs("div",{"data-tour":"legal-company",className:"relative w-full md:w-auto shrink-0",ref:ze,children:[e.jsxs("button",{type:"button",className:`h-[40px] w-full md:w-auto px-4 rounded-full border-[1.4px] bg-white flex items-center justify-center gap-2 transition-colors ${S.length===0?"border-[#E5E7EB] text-gray-400 cursor-not-allowed":m?"border-[#002ED3] hover:bg-blue-50":"border-[#E5E7EB] text-[#01145F] hover:border-[#002ED3] hover:bg-gray-50"}`,onClick:()=>S.length>0&&ce(s=>!s),disabled:S.length===0,"aria-expanded":Me,"aria-haspopup":"listbox",title:"Support for Your Company",children:[e.jsx("span",{className:`font-bold text-sm leading-[140%] max-w-[180px] truncate ${m?"text-[#002ED3]":""}`,children:m?m.company_name||m.name:S.length>0?"No company attached":"No companies yet"}),e.jsx(Ee,{className:`w-4 h-4 shrink-0 transition-transform ${m?"text-[#002ED3]":""} ${Me?"rotate-180":""}`})]}),Me&&e.jsxs("div",{className:"absolute left-0 top-[calc(100%+6px)] z-50 w-full md:w-[320px] rounded-2xl border border-[#E5E7EB] bg-white shadow-[0px_20px_50px_-10px_rgba(18,49,96,0.18)] overflow-hidden",children:[e.jsx("div",{className:"p-2 border-b border-[#F3F4F6]",children:e.jsxs("div",{className:"relative",children:[e.jsx(be,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500 pointer-events-none"}
9),e.jsx("input",{autoFocus:!0,type:"text",value:$e,onChange:s=>de(s.target.value),placeholder:"Search company...",className:"w-full h-[36px] pl-9 pr-3 rounded-full bg-[#F0F7FF] text-base sm:text-sm text-neutral-800 placeholder:text-neutral-500 focus:outline-none border border-transparent focus:border-brand-500"})]})}),e.jsxs("div",{className:"max-h-[240px] overflow-y-auto p-1.5",role:"listbox",children:[!$e.trim()&&e.jsxs("button",{type:"button",role:"option","aria-selected":!m,onClick:()=>{Ue(null),ce(!1),de("")},className:`mb-1 w-full flex items-center justify-between gap-2 rounded-lg px-3 py-2 text-left text-sm transition-colors ${m?"text-[#1F2937] hover:bg-[#F9FAFB]":"bg-[#F0F7FF] text-[#002ED3] font-bold"}`,children:[e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block truncate",children:"No company attached"}),e.jsx("span",{className:"block truncate text-xs font-normal text-[#6B7280]",children:"Browse every service"})]}),!m&&e.jsx(Y,{className:"w-4 h-4 shrink-0"})]}),(()=>{const s=$e.trim().toLowerCase(),o=S.filter(p=>(p.company_name||p.name||"").toLowerCase().includes(s));return o.length===0?e.jsx("p",{className:"px-3 py-4 text-center text-sm text-[#6B7280]",children:"No companies found"}):o.map(p=>{var B;const k=(m==null?void 0:m.id)===p.id;return e.jsxs("button",{type:"button",role:"option","aria-selected":k,onClick:()=>{Ue(p),ce(!1),de("")},className:`w-full flex items-center justify-between gap-2 rounded-lg px-3 py-2 text-left text-sm transition-colors ${k?"bg-[#F0F7FF] text-[#002ED3] font-bold":"text-[#1F2937] hover:bg-[#F9FAFB]"}`,children:[e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block truncate",children:p.company_name||p.name}),(B=p.country)!=null&&B.name?e.jsxs("span",{className:"block truncate text-xs font-normal text-[#6B7280]",children:[p.country.flag?`${p.country.flag} `:"",p.country.name]}):null]}),k&&e.jsx(Y,{className:"w-4 h-4 shrink-0"})]},p.id)})})()]}),e.jsx("div",{className:"p-2 border-t border-[#F3F4F6]",children:e.jsx("button",{type:"button",onClick:()=>{ce(!1),de(""),Oe(!0)},className:"w-full h-[36px] rounded-full border border-[#305DFF] text-sm font-bold text-[#305DFF] hover:bg-blue-50 transition-colors",children:"View all companies"})})]})]})}),e.jsx("div",{"data-tour":"legal-search",className:"relative w-full min-w-0 flex-1 md:min-w-[220px] md:basis-[220px]",children:e.jsx(Gt,{placeholder:"Search by Service title",value:te,onChange:s=>{const o=qt(s);
9je(o),q({search:o},!0),U(1)},onClear:()=>q({search:""},!1)})}),R!=="COMPANY_INCORPORATION"&&e.jsx(e.Fragment,{children:e.jsxs("div",{"data-tour":"legal-country",className:"relative w-full md:w-auto md:min-w-[180px] shrink-0",ref:Et,children:[e.jsxs("button",{type:"button",onClick:()=>{Q||Ss(E),Ct(!Q)},"aria-expanded":Q,"aria-haspopup":"listbox",className:`flex h-[40px] w-full items-center justify-between gap-2 rounded-full border-[1.4px] bg-white px-4 transition-colors ${E.length>0?"border-[#002ED3] hover:bg-blue-50":"border-[#E5E7EB] hover:border-[#002ED3] hover:bg-gray-50"}`,children:[e.jsx("span",{className:`truncate text-[14px] font-bold leading-[140%] ${E.length>0?"text-[#002ED3]":"text-[#6B7280]"}`,children:Pt}),e.jsx(Ee,{className:`w-4 h-4 shrink-0 transition-transform ${E.length>0?"text-[#002ED3]":""} ${Q?"rotate-180":""}`})]}),Q&&e.jsxs("div",{className:"absolute left-0 top-[calc(100%+6px)] z-50 w-full md:w-[300px] rounded-2xl border border-[#E5E7EB] bg-white shadow-[0px_20px_50px_-10px_rgba(18,49,96,0.18)] overflow-hidden",children:[e.jsx("div",{className:"p-2 border-b border-[#F3F4F6]",children:e.jsxs("div",{className:"relative",children:[e.jsx(be,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500 pointer-events-none"}
9),e.jsx("input",{autoFocus:!0,type:"text",value:Ne,onChange:s=>pe(s.target.value),placeholder:"Search country...",className:"w-full h-[36px] pl-9 pr-3 rounded-full bg-[#F0F7FF] text-base sm:text-sm text-neutral-800 placeholder:text-neutral-500 focus:outline-none border border-transparent focus:border-brand-500"})]})}),e.jsxs("div",{className:"max-h-[260px] overflow-y-auto p-1.5",role:"listbox","aria-multiselectable":"true",children:[Lt.length>0&&e.jsxs("div",{role:"group","aria-labelledby":"legal-country-selected-heading",className:"mb-1 border-b border-[#F3F4F6] pb-1",children:[e.jsx("p",{id:"legal-country-selected-heading",className:"px-3 pb-1 pt-1.5 text-[11px] font-bold uppercase tracking-[0.02em] text-[#6B7280]",children:"Selected"}),e.jsx("div",{className:"flex flex-col gap-0.5",children:Lt.map(s=>e.jsx(ts,{country:s,isSelected:E.includes(s.code),onToggle:Bt},s.code))})]}),e.jsxs("button",{type:"button",role:"option","aria-selected":E.length===0,onClick:()=>{ne([]),pe("")},className:`mb-1 flex w-full items-center justify-between gap-2 rounded-lg px-3 py-2 text-left text-sm transition-colors ${E.length===0?"bg-[#F0F7FF] text-[#002ED3] font-bold":"text-[#1F2937] hover:bg-[#F9FAFB]"}`,children:[e.jsx("span",{children:"All countries"}),E.length===0&&e.jsx(Y,{className:"w-4 h-4 shrink-0"})]}),Ce.length===0?e.jsx("p",{className:"px-3 py-4 text-center text-sm text-[#6B7280]",children:"No countries found"}):_s.map(s=>e.jsx(ts,{country:s,isSelected:E.includes(s.code),onToggle:Bt},s.code))]}),E.length>0&&e.jsx("div",{className:"p-2 border-t border-[#F3F4F6]",children:e.jsx("button",{type:"button",onClick:()=>ne([]),className:"w-full h-[36px] rounded-full border border-[#305DFF] text-sm font-bold text-[#305DFF] hover:bg-blue-50 transition-colors",children:"Clear countries"})})]})]})}),e.jsx(yn,{dataTour:"legal-sort",name:"sort",label:"Sort by price",value:he,onChange:s=>{we(s),q({sort:s})},options:ja,className:"justify-center lg:justify-start"}),R!=="COMPANY_INCORPORATION"&&e.jsxs("button",{type:"button","data-tour":"legal-ordered-only","aria-pressed":M,disabled:!M&&ae===0,title:ae===0&&!M?m?"No services ordered for this company yet":"No services ordered yet":M?"Show the whole catalogue":"Show only the services you have ordered",onClick:()=>{const s=!M;ye(s),q({requested:s?"1":""})},className:`flex h-[40px] w-full items-center justify-center gap-2 rounded-full border-[1.4px] bg-white px-4 transition-colors md:w-auto md:shrink-0 ${M?"border-[#002ED3] bg-blue-50 text-[#002ED3]":ae===0?"cursor-not-allowed border-[#E5E7EB] text-gray-400":"border-[#E5E7EB] text-[#6B7280] hover:border-[#002ED3] hover:bg-gray-50"}`,children:[e.jsx(xs,{className:"h-4 w-4 shrink-0"}),e.jsxs("span",{className:"whitespace-nowrap text-[14px] font-bold leading-[140%]",children:["Ordered only",ae>0?` (${ae})`:""]})]})]}),R!=="COMPANY_INCORPORATION"&&!T&&!m&&e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-3 w-full bg-white rounded-2xl shadow-[0px_20px_50px_-10px_rgba(18,49,96,0.1)] px-4 py-3",children:[e.jsx(Ze,{className:"w-5 h-5 shrink-0 text-[#305DFF]"}),e.jsx("p",{className:"flex-1 min-w-0 text-sm text-[#374151]",children:S.length===0?"You can order any service without a company. Adding one filters the catalog to its registration country and keeps the paperwork together.":"Showing every service, with no company attached. Pick a company to filter by its registration country."}),S.length===0&&e.jsxs(De,{onClick:()=>t("/Companies"),className:"shrink-0 bg-[#305DFF] hover:bg-[#2750E0] text-white gap-2 rounded-[24px] h-9 px-4 font-bold text-sm",children:[e.jsx(Ut,{className:"w-4 h-4"}),"Create Company"]})]}),e.jsx("div",{"data-tour":"legal-table",className:"relative",children:R==="COMPANY_INCORPORATION"?e.jsx("div",{className:"w-full flex flex-col gap-4",children:A?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600"})}):_.length===0?e.jsxs("div",{className:"w-full bg-white rounded-2xl shadow-[0px_20px_50px_-10px_rgba(18,49,96,0.1)] text-center py-16 px-6",children:[e.jsx(Ze,{className:"w-14 h-14 mx-auto mb-4 text-gray-300"}),e.jsx("p",{className:"text-[#01145F] font-bold text-lg mb-1",children:"No incorporation requests yet"}),e.jsx("p",{className:"text-gray-500 mb-5 max-w-md mx-auto",children:"Start a new incorporation and track every step here â from document collection to company registration."}),e.jsxs(De,{onClick:()=>t("/NewCompanyIncorporation"),className:"bg-[#305DFF] hover:bg-[#2750E0] text-white gap-2 rounded-[24px] h-10 px-5 font-bold text-base",children:[e.jsx(Ut,{className:"w-4 h-4"}),"Start New Incorporation"]})]}):e.jsx(ct,{columns:[{key:"number",header:"â",width:"60px",render:(s,o)=>e.jsx("span",{className:"text-[15px] leading-[140%] text-[#1F2937] text-center",children:o+1})},{key:"companyName",header:"Company Name",width:"204px",render:s=>e.jsx("span",{className:"text-[15px] leading-[140%] text-[#1F2937] font-medium",children:s.companyName||"N/A"})},{key:"country",header:"Country",width:"160px",render:s=>{var o;return e.jsx("span",{className:"text-[15px] leading-[140%] text-[#1F2937]",children:((o=s.country)==null?void 0:o.name)||s.c
9ountryName||"N/A"})}},{key:"providerPrice",header:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{children:"Provider Price"}),e.jsx(re,{text:"Estimated cost (final price may vary)."})]}),width:"144px",render:s=>e.jsx("span",{className:"text-[15px] leading-[140%] text-[#1F2937]",children:gn(s)})},{key:"price",header:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{children:"Price"}),e.jsx(re,{text:"This is the estimated fee for services provided by our legal team."})]}),width:"110px",render:s=>{var o;return e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"w-7 h-7 rounded-full bg-[#EEF2FF] flex items-center justify-center shrink-0",children:e.jsx(Z,{className:"w-5 h-5"})}),e.jsx("span",{className:"font-bold text-[16px] leading-[140%] text-[#305DFF]",children:((o=s.legalProviderService)==null?void 0:o.price)??0})]})}},{key:"delivery",header:"Delivery",width:"120px",render:s=>{var p;const o=s.serviceTime||((p=s.legalProviderService)==null?void 0:p.serviceTime);return e.jsx("span",{className:"text-[14px] leading-[140%] text-gray-600",children:o||"â"})}},{key:"created",header:"Created",width:"120px",render:s=>e.jsx("span",{className:"text-[14px] leading-[140%] text-gray-500",children:s.created_date||s.createdAt?new Date(s.created_date||s.createdAt).toLocaleDateString("en-GB"):"â"})},{key:"status",header:"Status",width:"170px",separator:!0,headerAlign:"center",cellAlign:"center",render:s=>{const o=s.status==="REJECTED"&&typeof s.adminNotes=="string"&&s.adminNotes.trim()&&!s.adminNotes.startsWith("[ARCHIVED")?s.adminNotes.trim():null;return e.jsxs("div",{className:"flex flex-col items-center gap-1",children:[e.jsx(hs,{status:s.status||"DRAFT"}),o&&e.jsx("p",{className:"max-w-[160px] truncate text-[12px] leading-[140%] text-red-500",title:o,children:o})]})}},{key:"actions",header:"Actions",width:"150px",separator:!0,headerAlign:"center",cellAlign:"center",render:s=>e.jsx("div",{className:"flex items-center justify-center",children:e.jsx("button",{className:"h-9 px-6 rounded-[24px] border-[1.4px] border-[#01145F] bg-white font-bold text-[15px] leading-[140%] text-[#01145F] hover:bg-[#F0F4FF] transition-colors",onClick:()=>t(vn(s.id)),children:"Open Flow"})})}],data:_,minWidth:"900px",emptyMessage:"No incorporation requests found",emptyIcon:Ze})}):e.jsx(Rn,{services:Is,userRequests:b,loading:i,onAddToCart:Rt,onApply:Ot,onViewWorkflow:Mt,onPay:$t,onOpenDetails:J,showStatus:!1,emptyMessage:M?m?"No ordered services for this company match these filters":"No ordered services match these filters":"No services found"})}),R!=="COMPANY_INCORPORATION"&&kt>1&&e.jsx(Nn,{currentPage:Ge,totalPages:kt,onPageChange:U}),!i&&e.jsx("div",{"data-tour":"legal-not-listed",children:e.jsx(Zn,{onIncorporate:We})}),e.jsx(ca,{service:oe,isOpen:!!oe,onClose:()=>J(null),onApply:s=>{J(null),Ot(s)},onAddToCart:s=>{J(null),Rt(s)},onViewWorkflow:s=>{J(null),Mt(s)},onPay:s=>{J(null),$t(s)}}),e.jsx(ia,{open:u&&F,onOpenChange:P,selectedCompany:m,onPickCompany:()=>{P(!1),Oe(!0)},countryOptions:Ce,selectedCountries:E,onCountriesChange:ne,countrySearch:Ne,onCountrySearchChange:pe,sortBy:he,onSortChange:s=>{we(s),q({sort:s})},onlyRequested:M,onOrderedChange:s=>{ye(s),q({requested:s?"1":""}),U(1)},liveOrderCount:ae,resultCount:ve,onReset:()=>{ne([]),pe(""),je(""),ye(!1),we("price-asc"),q({search:"",requested:"",sort:"price-asc"}),U(1)}}),e.jsx(Dn,{isOpen:ws,onClose:()=>Oe(!1),onSelect:Ue,selectedCompany:m,allowNoCompany:!0}),e.jsx(zn,{isOpen:ys,onClose:()=>Nt(!1),serviceName:ee==null?void 0:ee.name,onViewFlow:()=>{Nt(!1),wt&&t(Vt({id:wt,category:ee==null?void 0:ee.category})||it("LegalSupport"))}}),e.jsx(Vn,{isOpen:vs,onClose:()=>{xe(!1),He(null)},onConfirm:Bs,onTopUp:()=>{xe(!1),t(it("Pricing"))},service:K,company:m,userTokens:(r==null?void 0:r.tokens)??0,tokenCost:Ps,loading:Fs})]})})}export{Ka as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.