@vpdev2/metakyc-sdk 1.0.43 → 1.0.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,7 +13,7 @@ export interface SelectProps extends React.SelectHTMLAttributes<HTMLSelectElemen
13
13
  placeholder?: string;
14
14
  }
15
15
  /**
16
- * Select component
16
+ * Select component — uses CSS variables so it follows the SDK theme.
17
17
  */
18
18
  export declare const Select: React.ForwardRefExoticComponent<SelectProps & React.RefAttributes<HTMLSelectElement>>;
19
19
  //# sourceMappingURL=Select.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../../src/components/core/Select.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAG1C,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,WAAY,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;IAChF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,eAAO,MAAM,MAAM,uFA8ClB,CAAC"}
1
+ {"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../../src/components/core/Select.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAG1C,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,WAAY,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;IAChF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,eAAO,MAAM,MAAM,uFA6ElB,CAAC"}
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var ar=Object.defineProperty;var nr=(t,r,s)=>r in t?ar(t,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[r]=s;var Q=(t,r,s)=>nr(t,typeof r!="symbol"?r+"":r,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ir=require("axios"),l=require("react"),e=require("react/jsx-runtime"),ke=require("react-hook-form"),ve=require("zod");function lr(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const s in t)if(s!=="default"){const a=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(r,s,a.get?a:{enumerable:!0,get:()=>t[s]})}}return r.default=t,Object.freeze(r)}const Ke=lr(l);var z=(t=>(t[t.IdentitySdk=0]="IdentitySdk",t[t.RiskScoring=1]="RiskScoring",t[t.Questionaries=2]="Questionaries",t[t.AdditionalData=3]="AdditionalData",t[t.AppropriatenessTest=4]="AppropriatenessTest",t[t.UploadDocument=5]="UploadDocument",t[t.ManualReview=6]="ManualReview",t[t.Overview=7]="Overview",t[t.InvestorCategorization=8]="InvestorCategorization",t))(z||{}),Re=(t=>(t[t.NotStarted=0]="NotStarted",t[t.InProgress=1]="InProgress",t[t.Success=2]="Success",t[t.PartialSuccess=3]="PartialSuccess",t[t.Failed=4]="Failed",t[t.Skipped=5]="Skipped",t[t.AdminReview=6]="AdminReview",t[t.SkippedAndAdminReview=7]="SkippedAndAdminReview",t))(Re||{}),me=(t=>(t[t.None=0]="None",t[t.InProgress=1]="InProgress",t[t.Finished=2]="Finished",t[t.OnHold=3]="OnHold",t[t.IdentityPending=4]="IdentityPending",t))(me||{}),He=(t=>(t[t.None=0]="None",t[t.RepresentativeKYC=1]="RepresentativeKYC",t[t.ManualRiskCriteria=2]="ManualRiskCriteria",t[t.UploadDocumentReview=3]="UploadDocumentReview",t[t.AdminReview=4]="AdminReview",t))(He||{}),We=(t=>(t[t.LowRisk=0]="LowRisk",t[t.MediumRisk=1]="MediumRisk",t[t.HighRisk=2]="HighRisk",t[t.Alert=3]="Alert",t))(We||{}),we=(t=>(t[t.None=0]="None",t[t.Pending=1]="Pending",t[t.Approved=2]="Approved",t[t.Rejected=3]="Rejected",t[t.ResendRequested=4]="ResendRequested",t[t.Unknown=5]="Unknown",t[t.InProgress=6]="InProgress",t))(we||{}),je=(t=>(t[t.Approved=0]="Approved",t[t.Reject=1]="Reject",t[t.UnderReview=2]="UnderReview",t[t.Closed=3]="Closed",t[t.AdminReview=4]="AdminReview",t[t.New=5]="New",t[t.InProgress=6]="InProgress",t))(je||{}),Ye=(t=>(t[t.ProviderResultPending=0]="ProviderResultPending",t[t.ProviderResultReceived=1]="ProviderResultReceived",t[t.Canceled=2]="Canceled",t[t.ExtendedToNewApplicant=3]="ExtendedToNewApplicant",t))(Ye||{}),Qe=(t=>(t[t.None=0]="None",t[t.ProviderResultPending=1]="ProviderResultPending",t[t.ProviderResultReceived=2]="ProviderResultReceived",t[t.Canceled=3]="Canceled",t))(Qe||{}),ue=(t=>(t[t.Onfido=0]="Onfido",t[t.Sumsub=2]="Sumsub",t[t.SardinAI=3]="SardinAI",t))(ue||{}),Ve=(t=>(t[t.Individual=0]="Individual",t[t.Company=1]="Company",t))(Ve||{}),Ie=(t=>(t[t.Male=0]="Male",t[t.Female=1]="Female",t[t.Other=2]="Other",t))(Ie||{}),Ge=(t=>(t[t.Image=0]="Image",t[t.Video=1]="Video",t[t.PDF=2]="PDF",t[t.OfficePDF=3]="OfficePDF",t[t.Custom=4]="Custom",t))(Ge||{}),Ze=(t=>(t[t.Pending=0]="Pending",t[t.Approved=1]="Approved",t[t.Rejected=2]="Rejected",t[t.RequiresRevision=3]="RequiresRevision",t))(Ze||{}),Je=(t=>(t[t.SingleChoice=0]="SingleChoice",t[t.MultipleChoice=1]="MultipleChoice",t[t.Text=2]="Text",t))(Je||{}),fe=(t=>(t[t.String=0]="String",t[t.Integer=1]="Integer",t[t.Decimal=2]="Decimal",t[t.Boolean=3]="Boolean",t[t.Date=4]="Date",t[t.Country=5]="Country",t[t.DigitOnly=6]="DigitOnly",t))(fe||{}),Xe=(t=>(t[t.Text=0]="Text",t[t.Radio=1]="Radio",t[t.Checkbox=2]="Checkbox",t[t.Dropdown=3]="Dropdown",t[t.Country=4]="Country",t))(Xe||{}),et=(t=>(t[t.None=0]="None",t[t.Country=1]="Country",t))(et||{}),ce=(t=>(t[t.Individual=0]="Individual",t[t.Sophisticated=1]="Sophisticated",t[t.HighNetWorth=2]="HighNetWorth",t[t.Business=3]="Business",t))(ce||{}),tt=(t=>(t[t.Retail=0]="Retail",t[t.Professional=1]="Professional",t[t.EligibleCounterparty=2]="EligibleCounterparty",t))(tt||{});const Fe={firstName:{label:"First Name",type:"text"},lastName:{label:"Last Name",type:"text"},email:{label:"Email",type:"email"},phonenumber:{label:"Phone Number",type:"tel"},dateOfBirth:{label:"Date of Birth",type:"date"},salutation:{label:"Salutation",type:"select"},title:{label:"Title",type:"text"},mobileCountryCode:{label:"Mobile Country Code",type:"text"},street:{label:"Street",type:"text"},streetNumber:{label:"Street Number",type:"text"},zip:{label:"ZIP / Postal Code",type:"text"},city:{label:"City",type:"text"},country:{label:"Country",type:"select"},nationality:{label:"Nationality",type:"select"},otherNationality:{label:"Other Nationalities",type:"multiselect"},countryOfBirth:{label:"Country of Birth",type:"select"},placeOfBirth:{label:"Place of Birth",type:"text"},taxCountry:{label:"Tax Country",type:"select"},taxNumber:{label:"Tax Number",type:"text"},defaultLanguage:{label:"Default Language",type:"select"},educationLevel:{label:"Education Level",type:"text"},occupation:{label:"Occupation",type:"text"}},rt=["firstName","lastName","email","phonenumber","dateOfBirth"],ze=[{value:"EN",label:"English"},{value:"DE",label:"German"},{value:"FR",label:"French"},{value:"ES",label:"Spanish"},{value:"IT",label:"Italian"},{value:"PT",label:"Portuguese"},{value:"NL",label:"Dutch"},{value:"PL",label:"Polish"},{value:"RU",label:"Russian"},{value:"ZH",label:"Chinese"},{value:"JA",label:"Japanese"},{value:"AR",label:"Arabic"},{value:"TR",label:"Turkish"},{value:"SV",label:"Swedish"},{value:"DA",label:"Danish"},{value:"FI",label:"Finnish"},{value:"NO",label:"Norwegian"}];var ee=(t=>(t.Default="default",t.Corporate="corporate",t.Fintech="fintech",t.Healthcare="healthcare",t.Modern="modern",t.Minimal="minimal",t))(ee||{});const st={timeout:3e4,retries:3,locale:"en",endpoints:{pattern:"host-controller"}};class at{constructor(r){this.config=r}build(r,s){const a=`${r}.${s}`;if(this.config.customPaths&&this.config.customPaths[a])return this.config.customPaths[a];switch(this.config.pattern){case"host-controller":return`/api/${r}/${s}`;case"application-service":return`/services/app/${this.getServiceName(r)}/${s}`;case"custom":throw new Error(`Custom endpoint path not found for ${a}. Please provide it in customPaths.`);default:throw new Error(`Unknown endpoint pattern: ${this.config.pattern}`)}}getServiceName(r){return{Applicant:"MetaKYCVerification",Questionnaire:"MetaKYCVerification",UploadDocument:"MetaKYCVerification",AppropriatenessTest:"MetaKYCVerification",BaseInformation:"MetaKYCVerification"}[r]||r}}class xe extends Error{constructor(s,a,n,i,o){super(s);Q(this,"response");this.code=a,this.details=n,this.validationErrors=i,this.name="MetaKYCError",this.response=o,Object.setPrototypeOf(this,xe.prototype)}}class Ce{static handleApiError(r){return new xe(r.message||"An unknown error occurred",r.code,r.details||void 0,r.validationErrors||void 0)}static handleAxiosError(r){if(r.response){const s=r.response.data;return s&&s.error?new xe(s.error.message||"An unknown error occurred",s.error.code,s.error.details||void 0,s.error.validationErrors||void 0,r.response):s&&s.result&&s.result.message?new xe(s.result.message,r.response.status,`HTTP ${r.response.status}: ${r.response.statusText}`,void 0,r.response):new xe((s==null?void 0:s.message)||r.message||"Request failed",r.response.status,`HTTP ${r.response.status}: ${r.response.statusText}`,void 0,r.response)}else return r.request?new xe("No response from server",0,"The request was made but no response was received. Please check your network connection."):new xe(r.message||"An unexpected error occurred",0,r.toString())}static isMetaKYCError(r){return r instanceof xe}}class nt{constructor(r){Q(this,"axiosInstance");Q(this,"endpointBuilder");Q(this,"config");this.config={...st,...r},this.endpointBuilder=new at(this.config.endpoints),this.axiosInstance=ir.create({baseURL:this.config.baseUrl,timeout:this.config.timeout,headers:{"Content-Type":"application/json"}}),this.axiosInstance.interceptors.request.use(s=>(s.headers["Abp-TenantId"]=this.config.tenantId.toString(),s.headers.ApiKey=this.config.apiKey,s.headers["X-API-KEY"]=this.config.apiKey,this.config.locale&&(s.headers["Accept-Language"]=this.config.locale),s),s=>Promise.reject(s)),this.axiosInstance.interceptors.response.use(s=>s,async s=>{var n;const a=s.config;return((n=s.response)==null?void 0:n.status)>=500&&!a._retry&&(a._retry=!0,a._retryCount=(a._retryCount||0)+1,a._retryCount<(this.config.retries||3))?(await new Promise(i=>setTimeout(i,1e3*a._retryCount)),this.axiosInstance(a)):Promise.reject(s)})}buildEndpoint(r,s){return this.endpointBuilder.build(r,s)}async get(r,s,a){try{const n=this.buildEndpoint(r,s),i=await this.axiosInstance.get(n,{params:a});return this.handleResponse(i)}catch(n){throw Ce.handleAxiosError(n)}}async post(r,s,a){try{const n=this.buildEndpoint(r,s),i=await this.axiosInstance.post(n,a);return this.handleResponse(i)}catch(n){throw Ce.handleAxiosError(n)}}async put(r,s,a){try{const n=this.buildEndpoint(r,s),i=await this.axiosInstance.put(n,a);return this.handleResponse(i)}catch(n){throw Ce.handleAxiosError(n)}}async delete(r,s,a){try{const n=this.buildEndpoint(r,s),i=await this.axiosInstance.delete(n,{params:a});return this.handleResponse(i)}catch(n){throw Ce.handleAxiosError(n)}}handleResponse(r){const s=r.data;if(!s.success&&s.error)throw Ce.handleApiError(s.error);return s}getAxiosInstance(){return this.axiosInstance}}class it{constructor(r){this.httpClient=r}async createApplicant(r){return(await this.httpClient.post("Applicant","ApplicantRegistrationRequest",r)).result}async createCompanyApplicant(r){return(await this.httpClient.post("Applicant","ApplicantCompanyRegistrationRequest",r)).result}async duplicateApplicant(r){return(await this.httpClient.post("Applicant","DuplicateApplicantRegistrationRequest",r)).result}async getProgress(r){return(await this.httpClient.get("Applicant","GetApplicantProgress",{applicantId:r})).result}async getProgressStatus(r){return(await this.httpClient.get("Applicant","GetApplicantProgressStaus",{applicantId:r})).result}async getApplicantData(r){return(await this.httpClient.get("Applicant","GetApplicantData",{applicantId:r})).result}async getApplicantStatus(r){return(await this.httpClient.get("Applicant","GetApplicantStatus",{applicantId:r})).result}async stopProgress(r){await this.httpClient.get("Applicant","StopProgress",{applicantId:r})}async progressStepBack(r){await this.httpClient.get("Applicant","ProgressStepBack",{applicantId:r})}async setLanguage(r,s){await this.httpClient.post("Applicant","SetApplicantLng",{applicantId:r,language:s})}async activateApplicant(r){await this.httpClient.get("Applicant","ActivateApplicant",{applicantId:r})}async deleteApplicant(r){await this.httpClient.delete("Applicant","DeleteApplicant",{applicantId:r})}async checkApplicantExists(r){return(await this.httpClient.get("Applicant","CheckApplicantIfExists",{externalRefId:r})).result}}class lt{constructor(r){this.httpClient=r}async getQuestionnaire(r){return(await this.httpClient.get("Questionnaire","GetQuestionnaire",{applicantid:r})).result}async fillQuestionnaire(r){return(await this.httpClient.post("Applicant","FillQuestionnarie",r)).result}}class ot{constructor(r){this.httpClient=r}async getUploadDocument(r){return(await this.httpClient.get("UploadDocument","GetUploadDocument",{applicantid:r})).result}async fillUploadDocument(r){await this.httpClient.post("Applicant","FillUploadDocument",r)}async reviewUploadDocument(r){await this.httpClient.post("UploadDocument","ReviewUploadDocument",r)}}class ct{constructor(r){this.httpClient=r}async getAppropriatenessTest(r){return(await this.httpClient.get("AppropriatenessTest","GetAppropriatenessTest",{applicantid:r})).result}async fillAppropriatenessTest(r){return(await this.httpClient.post("Applicant","FillAppropriatenessTest",r)).result}}class dt{constructor(r){this.httpClient=r}async getOverviewData(r){return(await this.httpClient.get("Applicant","GetOverviewData",{ApplicantId:r})).result}async passOverview(r){await this.httpClient.get("Applicant","PassOverview",{applicantId:r})}}class ut{constructor(r){this.httpClient=r}async getRiskScoringPlan(){return(await this.httpClient.get("Applicant","GetRiskScoringPlanInfo")).result}async getRiskCriterias(r){return(await this.httpClient.get("Risk","GetCriterias",{applicantId:r})).result}async submitRiskScoring(r){return(await this.httpClient.post("Applicant","RiskScoringRequest",r)).result}}class mt{constructor(r){this.httpClient=r}async identityRequest(r){console.log("[IdentityService] Calling IdentityRequest with input:",r);const s=await this.httpClient.post("Applicant","IdentityRequest",r);return console.log("[IdentityService] IdentityRequest response:",s),s.result}async identityCompanyRequest(r){return(await this.httpClient.post("Applicant","IdentityCompanyRequest",r)).result}async restartIdentityRequest(r){const s={applicantId:r,restart:!0,redirectUrl:"",ttl:604800};return console.log("[IdentityService] Restarting identity with restart=true:",s),this.identityRequest(s)}async restartIdentityCompanyRequest(r){const s={applicantId:r,restart:!0,redirectUrl:"",ttl:604800};return this.identityCompanyRequest(s)}}class pt{constructor(r){this.httpClient=r}async getCountries(r,s,a){return(await this.httpClient.get("BaseInformation","GetAllCountries",{filter:r||"",lng:s||"en",type:a})).result}async getBranches(){return(await this.httpClient.get("BaseInformation","GetBranches")).result}async getLegalEntities(){return(await this.httpClient.get("BaseInformation","GetLegalEntities")).result}}class ht{constructor(r){this.httpClient=r}async setInvestorCategorization(r){return(await this.httpClient.post("Applicant","SetInvestorCategorization",r)).result}async getInvestorCategorization(r){return(await this.httpClient.get("Applicant","GetInvestorCategorisation",{applicantId:r})).result}}const ne={name:"Default",title:"KYC Verification",logo:{url:"",height:"40px",visible:!0},colors:{primary:"#2563eb",primaryHover:"#1d4ed8",primaryLight:"#dbeafe",primaryDark:"#1e40af",secondary:"#64748b",secondaryHover:"#475569",success:"#10b981",warning:"#f59e0b",danger:"#ef4444",info:"#3b82f6",background:"#ffffff",surface:"#f9fafb",border:"#e5e7eb",textPrimary:"#111827",textSecondary:"#6b7280",textMuted:"#9ca3af"},typography:{fontFamily:"Inter, system-ui, -apple-system, sans-serif",fontSize:{xs:"0.75rem",sm:"0.875rem",base:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","3xl":"1.875rem"},fontWeight:{normal:400,medium:500,semibold:600,bold:700}},spacing:{borderRadius:"0.5rem",cardPadding:"1.5rem",inputHeight:"2.5rem"},darkMode:{colors:{background:"#111827",surface:"#1f2937",border:"#374151",textPrimary:"#f9fafb",textSecondary:"#d1d5db",textMuted:"#9ca3af"}}},gt={name:"Corporate",logo:{url:"",height:"40px",visible:!0},colors:{primary:"#0052CC",primaryHover:"#0747A6",primaryLight:"#DEEBFF",primaryDark:"#0747A6",secondary:"#6B778C",secondaryHover:"#5E6C84",success:"#00875A",warning:"#FF991F",danger:"#DE350B",info:"#0065FF",background:"#ffffff",surface:"#F4F5F7",border:"#DFE1E6",textPrimary:"#172B4D",textSecondary:"#5E6C84",textMuted:"#97A0AF"},typography:{fontFamily:"system-ui, -apple-system, sans-serif"},spacing:{borderRadius:"0.25rem",cardPadding:"1.5rem",inputHeight:"2.5rem"}},xt={name:"Fintech",logo:{url:"",height:"36px",visible:!0},colors:{primary:"#00B386",primaryHover:"#009973",primaryLight:"#D1FAE5",primaryDark:"#047857",secondary:"#7C3AED",secondaryHover:"#6D28D9",success:"#10B981",warning:"#F59E0B",danger:"#EF4444",info:"#3B82F6",background:"#ffffff",surface:"#F9FAFB",border:"#E5E7EB",textPrimary:"#111827",textSecondary:"#6B7280",textMuted:"#9CA3AF"},typography:{fontFamily:"Montserrat, system-ui, sans-serif"},spacing:{borderRadius:"0.75rem",cardPadding:"2rem",inputHeight:"3rem"}},yt={name:"Healthcare",logo:{url:"",height:"44px",visible:!0},colors:{primary:"#06B6D4",primaryHover:"#0891B2",primaryLight:"#CFFAFE",primaryDark:"#0E7490",secondary:"#8B5CF6",secondaryHover:"#7C3AED",success:"#059669",warning:"#D97706",danger:"#DC2626",info:"#0284C7",background:"#ffffff",surface:"#F0F9FF",border:"#E0F2FE",textPrimary:"#0F172A",textSecondary:"#475569",textMuted:"#94A3B8"},typography:{fontFamily:"Lato, system-ui, sans-serif"},spacing:{borderRadius:"0.5rem",cardPadding:"1.75rem",inputHeight:"2.75rem"},darkMode:{colors:{background:"#0F172A",surface:"#1E293B",border:"#334155",textPrimary:"#F1F5F9",textSecondary:"#CBD5E1"}}},ft={name:"Modern",logo:{url:"",height:"38px",visible:!0},colors:{primary:"#8B5CF6",primaryHover:"#7C3AED",primaryLight:"#EDE9FE",primaryDark:"#6D28D9",secondary:"#EC4899",secondaryHover:"#DB2777",success:"#10B981",warning:"#F59E0B",danger:"#EF4444",info:"#3B82F6",background:"#ffffff",surface:"#FAFAFA",border:"#E5E5E5",textPrimary:"#171717",textSecondary:"#737373",textMuted:"#A3A3A3"},typography:{fontFamily:"Poppins, system-ui, sans-serif"},spacing:{borderRadius:"1rem",cardPadding:"2rem",inputHeight:"3rem"}},bt={name:"Minimal",logo:{url:"",height:"32px",visible:!0},colors:{primary:"#000000",primaryHover:"#18181B",primaryLight:"#F4F4F5",primaryDark:"#000000",secondary:"#71717A",secondaryHover:"#52525B",success:"#22C55E",warning:"#EAB308",danger:"#EF4444",info:"#3B82F6",background:"#ffffff",surface:"#FAFAFA",border:"#E4E4E7",textPrimary:"#09090B",textSecondary:"#71717A",textMuted:"#A1A1AA"},typography:{fontFamily:"system-ui, -apple-system, sans-serif"},spacing:{borderRadius:"0.25rem",cardPadding:"1.25rem",inputHeight:"2.25rem"}},vt={[ee.Default]:ne,[ee.Corporate]:gt,[ee.Fintech]:xt,[ee.Healthcare]:yt,[ee.Modern]:ft,[ee.Minimal]:bt};function Ae(t){return vt[t]||ne}class kt{constructor(r){this.httpClient=r}async getThemeConfiguration(){var r;try{const s=await this.httpClient.get("Tenant","GetThemeConfiguration");if(!s.result.isEnabled)return Ae(ee.Default);let a=s.result.preset?Ae(s.result.preset):Ae(ee.Default);if(s.result.title&&(a.title=s.result.title),s.result.logo&&(a.logo={...a.logo,...s.result.logo}),s.result.colors&&(a.colors={...a.colors,...s.result.colors}),s.result.typography&&(a.typography={...a.typography,...s.result.typography}),s.result.spacing&&(a.spacing={...a.spacing,...s.result.spacing}),s.result.customCSS&&(a.customCSS=s.result.customCSS),s.result.darkMode&&(a.darkMode={colors:{...(r=a.darkMode)==null?void 0:r.colors,...s.result.darkMode.colors}}),s.result.applicantFormVisibleFields&&s.result.applicantFormVisibleFields.length>0&&(a.applicantFormVisibleFields=s.result.applicantFormVisibleFields),s.result.applicantFormRequiredFields&&s.result.applicantFormRequiredFields.length>0&&(a.applicantFormRequiredFields=s.result.applicantFormRequiredFields),s.result.allowedLanguages&&s.result.allowedLanguages.length>0&&(a.allowedLanguages=s.result.allowedLanguages),s.result.applicantFormPages)try{const n=typeof s.result.applicantFormPages=="string"?JSON.parse(s.result.applicantFormPages):s.result.applicantFormPages;Array.isArray(n)&&n.length>0&&(a.applicantFormPages=n)}catch{}return a}catch(s){return console.warn("[ThemeService] Failed to fetch theme configuration:",s),Ae(ee.Default)}}async saveThemeConfiguration(r){await this.httpClient.post("Tenant","SaveThemeConfiguration",r)}getAvailablePresets(){return[{id:ee.Default,name:"Default"},{id:ee.Corporate,name:"Corporate"},{id:ee.Fintech,name:"Fintech"},{id:ee.Healthcare,name:"Healthcare"},{id:ee.Modern,name:"Modern"},{id:ee.Minimal,name:"Minimal"}]}getPreviewTheme(r,s){const a=Ae(r);return s?{...a,...s,logo:{...a.logo,...s.logo},colors:{...a.colors,...s.colors},typography:s.typography?{...a.typography,...s.typography}:a.typography,spacing:s.spacing?{...a.spacing,...s.spacing}:a.spacing}:a}}class wt{constructor(){Q(this,"listeners",new Map)}on(r,s){return this.listeners.has(r)||this.listeners.set(r,new Set),this.listeners.get(r).add(s),()=>{this.off(r,s)}}off(r,s){const a=this.listeners.get(r);a&&a.delete(s)}emit(r,s){const a=this.listeners.get(r);a&&a.forEach(n=>{try{n(s)}catch(i){console.error(`Error in event listener for "${r}":`,i)}})}clear(){this.listeners.clear()}clearEvent(r){this.listeners.delete(r)}}class jt{constructor(){Q(this,"events",new wt);Q(this,"_applicantId",null);Q(this,"_progress",null);Q(this,"_error",null)}get applicantId(){return this._applicantId}get progress(){return this._progress}get currentStep(){var r;return((r=this._progress)==null?void 0:r.currentStep)||null}get steps(){var r;return((r=this._progress)==null?void 0:r.stepInfoList)||[]}get status(){var r;return((r=this._progress)==null?void 0:r.status)||me.None}get workflowResult(){var r;return((r=this._progress)==null?void 0:r.workflowResult)||null}get error(){return this._error}get isComplete(){return this.status===me.Finished}get isOnHold(){return this.status===me.OnHold}get isInProgress(){return this.status===me.InProgress}setApplicantId(r){this._applicantId=r}updateProgress(r){var a,n;const s=(a=this._progress)==null?void 0:a.currentStep;this._progress=r,this._applicantId=r.applicantId,this._error=null,this.events.emit("progressUpdated",r),(s==null?void 0:s.order)!==((n=r.currentStep)==null?void 0:n.order)&&this.events.emit("stepChanged",r.currentStep),this.events.emit("statusChanged",r.status),r.status===me.Finished&&r.workflowResult&&this.events.emit("completed",r.workflowResult)}setError(r){this._error=r,this.events.emit("error",r)}clearError(){this._error=null}reset(){this._applicantId=null,this._progress=null,this._error=null}onProgressUpdated(r){return this.events.on("progressUpdated",r)}onStepChanged(r){return this.events.on("stepChanged",r)}onStatusChanged(r){return this.events.on("statusChanged",r)}onError(r){return this.events.on("error",r)}onCompleted(r){return this.events.on("completed",r)}clearListeners(){this.events.clear()}}class Nt{constructor(){Q(this,"handlers",new Map)}registerHandler(r,s){this.handlers.set(r,s)}getHandler(r){return this.handlers.get(r)}hasHandler(r){return this.handlers.has(r)}async loadStepData(r,s){const a=this.getHandler(r);if(!a)throw new Error(`No handler registered for step action: ${z[r]}`);return a.loadData(s)}async submitStepData(r,s){const a=this.getHandler(r);if(!a)throw new Error(`No handler registered for step action: ${z[r]}`);return a.submitData(s)}}class St{constructor(r,s,a,n,i,o,c,d){Q(this,"state");Q(this,"stepRouter");this.applicantService=r,this.questionnaireService=s,this.uploadDocumentService=a,this.appropriatenessTestService=n,this.overviewService=i,this.riskScoringService=o,this.investorCategorizationService=d,this.state=new jt,this.stepRouter=new Nt,this.registerStepHandlers()}registerStepHandlers(){this.stepRouter.registerHandler(z.Questionaries,{loadData:r=>this.questionnaireService.getQuestionnaire(r),submitData:async r=>{await this.questionnaireService.fillQuestionnaire(r)}}),this.stepRouter.registerHandler(z.UploadDocument,{loadData:r=>this.uploadDocumentService.getUploadDocument(r),submitData:r=>this.uploadDocumentService.fillUploadDocument(r)}),this.stepRouter.registerHandler(z.AppropriatenessTest,{loadData:r=>this.appropriatenessTestService.getAppropriatenessTest(r),submitData:async r=>{await this.appropriatenessTestService.fillAppropriatenessTest(r)}}),this.stepRouter.registerHandler(z.Overview,{loadData:r=>this.overviewService.getOverviewData(r),submitData:r=>this.overviewService.passOverview(r.applicantId)}),this.stepRouter.registerHandler(z.RiskScoring,{loadData:r=>this.riskScoringService.getRiskCriterias(r),submitData:async r=>{await this.riskScoringService.submitRiskScoring(r)}}),this.stepRouter.registerHandler(z.IdentitySdk,{loadData:async r=>({applicantId:r,message:"Identity verification required"}),submitData:async()=>{}}),this.stepRouter.registerHandler(z.InvestorCategorization,{loadData:r=>this.investorCategorizationService.getInvestorCategorization(r),submitData:async r=>{await this.investorCategorizationService.setInvestorCategorization(r)}}),this.stepRouter.registerHandler(z.ManualReview,{loadData:async r=>({applicantId:r,message:"Your application is under manual review"}),submitData:async()=>{}}),this.stepRouter.registerHandler(z.AdditionalData,{loadData:async r=>({applicantId:r,message:"Additional data required"}),submitData:async()=>{}})}async initialize(r){try{this.state.setApplicantId(r);const s=await this.applicantService.getProgress(r);return this.state.updateProgress(s),s}catch(s){throw this.state.setError(s),s}}async refreshProgress(){if(!this.state.applicantId)throw new Error("Workflow not initialized. Call initialize() first.");try{const r=await this.applicantService.getProgress(this.state.applicantId);return this.state.updateProgress(r),r}catch(r){throw this.state.setError(r),r}}async getCurrentStepData(){if(!this.state.currentStep)throw new Error("No current step available");if(!this.state.applicantId)throw new Error("Workflow not initialized");try{return await this.stepRouter.loadStepData(this.state.currentStep.action,this.state.applicantId)}catch(r){throw this.state.setError(r),r}}async submitCurrentStep(r){if(!this.state.currentStep)throw new Error("No current step available");try{await this.stepRouter.submitStepData(this.state.currentStep.action,r),await this.refreshProgress()}catch(s){throw this.state.setError(s),s}}async moveToNextStep(){return this.refreshProgress()}async moveToPreviousStep(){if(!this.state.applicantId)throw new Error("Workflow not initialized");try{return await this.applicantService.progressStepBack(this.state.applicantId),await this.refreshProgress()}catch(r){throw this.state.setError(r),r}}getState(){return this.state}getStepRouter(){return this.stepRouter}}function $e(t,r){return new Promise((s,a)=>{if(r&&document.getElementById(r)){s();return}const n=document.createElement("script");n.src=t,r&&(n.id=r),n.async=!0,n.onload=()=>s(),n.onerror=()=>a(new Error(`Failed to load script: ${t}`)),document.head.appendChild(n)})}function or(t){return!!document.getElementById(t)}function cr(t){const r=document.getElementById(t);r&&r.remove()}class Ct{constructor(r){Q(this,"sdk",null);Q(this,"config");this.config=r}async loadSDK(){await $e("https://cdn.sumsub.com/websdk/v2/production/websdk.js","sumsub-sdk")}async initialize(r){if(window.snsWebSdk||await this.loadSDK(),!window.snsWebSdk)throw new Error("Sumsub SDK failed to load");this.sdk=window.snsWebSdk.init(this.config.accessToken,()=>this.config.accessToken).withConf({lang:this.config.lang||"en",email:this.config.applicantEmail,phone:this.config.applicantPhone,i18n:{}}).on("idCheck.onStepCompleted",s=>{console.log("Sumsub step completed:",s)}).on("idCheck.onError",s=>{console.error("Sumsub error:",s)}).build(),this.sdk.launch(`#${r}`)}destroy(){this.sdk&&(this.sdk.destroy(),this.sdk=null)}onComplete(r){this.sdk&&this.sdk.on("idCheck.applicantStatus",s=>{s.applicantStatus==="completed"&&r(s)})}onError(r){this.sdk&&this.sdk.on("idCheck.onError",r)}}class At{constructor(r){Q(this,"sdk",null);Q(this,"config");this.config=r}async loadSDK(){await $e("https://sdk.onfido.com/v12.0.0/onfido.min.js","onfido-sdk")}async initialize(r){if(window.Onfido||await this.loadSDK(),!window.Onfido)throw new Error("Onfido SDK failed to load");this.sdk=window.Onfido.init({token:this.config.token,containerId:r,steps:this.config.steps||[{type:"welcome",options:{title:"Identity Verification"}},{type:"document",options:{documentTypes:{passport:!0,driving_licence:!0,national_identity_card:!0}}},{type:"face",options:{requestedVariant:"standard"}},{type:"complete"}],onComplete:()=>{this.config.onComplete&&this.config.onComplete()},onError:s=>{this.config.onError&&this.config.onError(s)}})}destroy(){this.sdk&&(this.sdk.tearDown(),this.sdk=null)}}class Et{constructor(r){Q(this,"sardineContext",null);Q(this,"config");Q(this,"sessionKey");this.config=r,this.sessionKey=r.sessionKey||this.generateSessionKey()}generateSessionKey(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(r){const s=Math.random()*16|0;return(r==="x"?s:s&3|8).toString(16)})}getSardineHost(){const{environment:r,region:s}=this.config;if(r==="sandbox")return"api.sandbox.sardine.ai";switch(s){case"eu":return"api.eu.sardine.ai";case"ca":return"api.ca.sardine.ai";case"au":return"api.au.sardine.ai";default:return"api.sardine.ai"}}async loadSDK(){return new Promise((r,s)=>{if(window._Sardine){r();return}const a=this.getSardineHost(),n=document.createElement("script");n.type="text/javascript",n.async=!0,n.src=`https://${a}/assets/loader.min.js`,n.onload=()=>{console.log("[SardinAI] SDK loaded successfully"),r()},n.onerror=()=>{s(new Error("Failed to load SardinAI SDK"))};const i=document.getElementsByTagName("script")[0];i&&i.parentNode?i.parentNode.insertBefore(n,i):document.head.appendChild(n)})}async initialize(){try{if(await this.loadSDK(),!window._Sardine)throw new Error("SardinAI SDK not available after loading");const r=this.getSardineHost(),{clientId:s,environment:a,flow:n,enableBiometrics:i,enablePortScanning:o}=this.config;this.sardineContext=window._Sardine.createContext({clientId:s,sessionKey:this.sessionKey,userIdHash:void 0,flow:n||window.location.pathname,environment:a||"production",parentElement:document.body,enableBiometrics:i!==!1,enablePortScanning:o===!0,region:this.config.region,onDeviceResponse:c=>{console.log(`[SardinAI] Device ID: ${c.deviceId}`)},onConfigUpdate:(c,d,m)=>{switch(c){case"SESSION_UPDATE_FAILED":console.error("[SardinAI] Session update failed:",m);break;case"SESSION_UPDATED":console.log("[SardinAI] Session updated:",d);break;case"SESSION_NO_UPDATE":console.log("[SardinAI] No session update");break;default:console.warn("[SardinAI] Unknown event:",c)}}}),this.addNoScriptFallback(r),console.log("[SardinAI] SDK initialized with sessionKey:",this.sessionKey)}catch(r){throw console.error("[SardinAI] Initialization failed:",r),r}}addNoScriptFallback(r){const s=document.createElement("noscript"),a=document.createElement("img"),{clientId:n,flow:i}=this.config;a.src=`https://${r}/v1/a.png?clientId=${n}&sessionKey=${this.sessionKey}&flow=${i||"kyc"}&ns=1`,a.style.display="none",s.appendChild(a),document.body.appendChild(s)}updateConfig(r){if(!this.sardineContext){console.warn("[SardinAI] Cannot update config - SDK not initialized");return}r.sessionKey&&(this.sessionKey=r.sessionKey),this.sardineContext.updateConfig({...r,onConfigUpdate:(s,a,n)=>{switch(s){case"SESSION_UPDATE_FAILED":console.error("[SardinAI] Config update failed:",n);break;case"SESSION_UPDATED":console.log("[SardinAI] Config updated:",a);break;case"SESSION_NO_UPDATE":console.log("[SardinAI] No config update needed");break}}})}getSessionKey(){return this.sessionKey}destroy(){this.sardineContext&&(this.sardineContext=null)}}class Ne{static createProvider(r,s){switch(r){case ue.Sumsub:return new Ct(s);case ue.Onfido:return new At(s);case ue.SardinAI:return new Et(s);default:throw new Error(`Unsupported identity provider: ${r}`)}}static parseProviderConfig(r,s,a){var n;switch(r){case ue.Sumsub:return{accessToken:s.accessToken||s.token,applicantEmail:s.email,applicantPhone:s.phone,externalUserId:s.externalUserId,lang:s.lang||"en"};case ue.Onfido:return{token:s.token||s.sdkToken};case ue.SardinAI:const i=((n=a==null?void 0:a.identityProviders)==null?void 0:n.sardinai)||{};return{clientId:i.clientId||s.clientId,sessionKey:i.sessionKey||s.sessionKey,environment:i.environment||s.environment||"production",flow:i.flow||s.flow,region:i.region,enableBiometrics:i.enableBiometrics,enablePortScanning:i.enablePortScanning};default:throw new Error(`Unsupported identity provider: ${r}`)}}}class Rt{constructor(r){Q(this,"currentTheme",ne);Q(this,"customStyleElement",null);Q(this,"container");this.container=r||document.documentElement}applyTheme(r){this.currentTheme=this.mergeWithDefault(r),this.applyColors(this.currentTheme.colors),this.currentTheme.typography&&this.applyTypography(this.currentTheme.typography),this.currentTheme.spacing&&this.applySpacing(this.currentTheme.spacing),this.currentTheme.customCSS&&this.injectCustomCSS(this.currentTheme.customCSS),console.log("[ThemeManager] Theme applied:",this.currentTheme.name||"Custom")}applyColors(r){var a;const s={primary:r.primary,"primary-hover":r.primaryHover,"primary-light":r.primaryLight,"primary-dark":r.primaryDark,secondary:r.secondary,"secondary-hover":r.secondaryHover,success:r.success,warning:r.warning,danger:r.danger,info:r.info,background:r.background,surface:r.surface,border:r.border,"text-primary":r.textPrimary,"text-secondary":r.textSecondary,"text-muted":r.textMuted};Object.entries(s).forEach(([n,i])=>{this.container.style.setProperty(`--metakyc-${n}`,i)}),(a=this.currentTheme.darkMode)!=null&&a.colors&&this.applyDarkModeColors(this.currentTheme.darkMode.colors)}applyDarkModeColors(r){Object.entries(r).forEach(([s,a])=>{if(a){const n=`--metakyc-dark-${this.kebabCase(s)}`;this.container.style.setProperty(n,a)}})}applyTypography(r){r&&(r.fontFamily&&this.container.style.setProperty("--metakyc-font-family",r.fontFamily),r.headingFont&&this.container.style.setProperty("--metakyc-heading-font",r.headingFont),r.fontSize&&Object.entries(r.fontSize).forEach(([s,a])=>{this.container.style.setProperty(`--metakyc-font-size-${s}`,a)}),r.fontWeight&&Object.entries(r.fontWeight).forEach(([s,a])=>{this.container.style.setProperty(`--metakyc-font-weight-${s}`,a.toString())}))}applySpacing(r){r&&Object.entries(r).forEach(([s,a])=>{const n=`--metakyc-${this.kebabCase(s)}`;this.container.style.setProperty(n,a)})}injectCustomCSS(r){this.customStyleElement&&this.customStyleElement.remove(),this.customStyleElement=document.createElement("style"),this.customStyleElement.id="metakyc-custom-css",this.customStyleElement.textContent=r,document.head.appendChild(this.customStyleElement)}mergeWithDefault(r){var s;return{name:r.name||ne.name,title:r.title||ne.title,logo:{...ne.logo,...r.logo},colors:{...ne.colors,...r.colors},typography:r.typography?{...ne.typography,...r.typography}:ne.typography,spacing:r.spacing?{...ne.spacing,...r.spacing}:ne.spacing,customCSS:r.customCSS,darkMode:r.darkMode?{colors:{...(s=ne.darkMode)==null?void 0:s.colors,...r.darkMode.colors}}:ne.darkMode,applicantFormVisibleFields:r.applicantFormVisibleFields,applicantFormRequiredFields:r.applicantFormRequiredFields,allowedLanguages:r.allowedLanguages,applicantFormPages:r.applicantFormPages}}getCurrentTheme(){return this.currentTheme}resetTheme(){this.applyTheme(ne)}cleanup(){this.customStyleElement&&(this.customStyleElement.remove(),this.customStyleElement=null)}kebabCase(r){return r.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}}const Ue=l.createContext(null),dr=({config:t,children:r})=>{const[s,a]=l.useState(null),n=l.useRef(!1),i=l.useRef(!1),o=l.useMemo(()=>{const d=new nt(t),m=new it(d),v=new lt(d),w=new ot(d),x=new ct(d),h=new dt(d),g=new ut(d),k=new mt(d),f=new pt(d),p=new ht(d),R=new kt(d),N=new Rt;return{httpClient:d,applicantService:m,questionnaireService:v,uploadDocumentService:w,appropriatenessTestService:x,overviewService:h,riskScoringService:g,identityService:k,baseInformationService:f,investorCategorizationService:p,themeService:R,themeManager:N}},[t]),c=l.useMemo(()=>({config:t,...o,currentTheme:s,createOrchestrator:()=>new St(o.applicantService,o.questionnaireService,o.uploadDocumentService,o.appropriatenessTestService,o.overviewService,o.riskScoringService,o.identityService,o.investorCategorizationService)}),[t,o,s]);return l.useEffect(()=>((async()=>{if(n.current||i.current){console.log("[MetaKYC] Theme already loading or loaded, skipping...");return}n.current=!0;try{if(t.theme){console.log("[MetaKYC] Applying static theme from config"),o.themeManager.applyTheme(t.theme),a(o.themeManager.getCurrentTheme()),i.current=!0;return}console.log("[MetaKYC] Fetching theme from backend...");const m=await o.themeService.getThemeConfiguration();o.themeManager.applyTheme(m),a(o.themeManager.getCurrentTheme()),i.current=!0,console.log("[MetaKYC] Theme loaded and applied",m)}catch(m){console.warn("[MetaKYC] Failed to load theme, using default:",m),a(o.themeManager.getCurrentTheme()),i.current=!0}finally{n.current=!1}})(),()=>{o.themeManager.cleanup()}),[]),e.jsx(Ue.Provider,{value:c,children:r})};function de(){const t=l.useContext(Ue);if(!t)throw new Error("useMetaKYC must be used within a MetaKYCProvider");return t}async function It(t){return new Promise((r,s)=>{const a=new FileReader;a.readAsDataURL(t),a.onload=()=>{const i=a.result.split(",")[1];r(i)},a.onerror=n=>s(n)})}function ur(t,r){return t.size<=r}function mr(t,r){return r.split(",").map(a=>a.trim()).some(a=>{if(a.endsWith("/*")){const n=a.slice(0,-2);return t.type.startsWith(n)}return t.type===a})}function Pe(t){if(t===0)return"0 Bytes";const r=1024,s=["Bytes","KB","MB","GB"],a=Math.floor(Math.log(t)/Math.log(r));return Math.round(t/Math.pow(r,a)*100)/100+" "+s[a]}function pr(t){return t}function te(...t){return t.filter(Boolean).join(" ")}const Ee={APPLICANT_ID:"metakyc_applicant_id",WORKFLOW_STATE:"metakyc_workflow_state"};function Dt(t){try{localStorage.setItem(Ee.APPLICANT_ID,t.toString())}catch(r){console.warn("Failed to save applicant ID to storage:",r)}}function Ft(){try{const t=localStorage.getItem(Ee.APPLICANT_ID);return t?parseInt(t,10):null}catch(t){return console.warn("Failed to retrieve applicant ID from storage:",t),null}}function Pt(){try{localStorage.removeItem(Ee.APPLICANT_ID)}catch(t){console.warn("Failed to clear applicant ID from storage:",t)}}function Lt(t){try{localStorage.setItem(Ee.WORKFLOW_STATE,JSON.stringify(t))}catch(r){console.warn("Failed to save workflow state to storage:",r)}}function hr(){try{const t=localStorage.getItem(Ee.WORKFLOW_STATE);return t?JSON.parse(t):null}catch(t){return console.warn("Failed to retrieve workflow state from storage:",t),null}}function Tt(){try{localStorage.removeItem(Ee.WORKFLOW_STATE)}catch(t){console.warn("Failed to clear workflow state from storage:",t)}}function gr(){Pt(),Tt()}function Mt(t){const{createOrchestrator:r}=de(),[s,a]=l.useState(null),[n,i]=l.useState(!1),[o,c]=l.useState(null),d=l.useRef(null),m=t||Ft();l.useEffect(()=>{d.current||(d.current=r())},[r]),l.useEffect(()=>{var N;s&&m&&(Dt(m),Lt({applicantId:m,currentStepOrder:(N=s.currentStep)==null?void 0:N.order,status:s.status,lastUpdated:new Date().toISOString(),workflowKey:s.workFlowKey,nextWorkflowKey:s.nextWorkflowKey}))},[s,m]);const v=l.useRef(!1),w=l.useRef(!1),x=l.useCallback(async()=>{if(!(!m||!d.current)){if(v.current){console.log("[Workflow] Load already in progress, skipping...");return}v.current=!0,i(!0),c(null);try{const N=await d.current.initialize(m);a(N),w.current=!0}catch(N){c(N)}finally{i(!1),v.current=!1}}},[m]);l.useEffect(()=>{m&&!w.current&&x()},[m,x]);const h=l.useCallback(async()=>{if(d.current){if(v.current){console.log("[Workflow] Refresh already in progress, skipping...");return}v.current=!0,i(!0),c(null);try{const N=await d.current.refreshProgress();a(N)}catch(N){c(N)}finally{i(!1),v.current=!1}}},[]),g=l.useCallback(async()=>{if(d.current){i(!0),c(null);try{const N=await d.current.moveToNextStep();a(N)}catch(N){c(N)}finally{i(!1)}}},[]),k=l.useCallback(async()=>{if(d.current){i(!0),c(null);try{const N=await d.current.moveToPreviousStep();a(N)}catch(N){c(N)}finally{i(!1)}}},[]),f=l.useCallback(async N=>{if(d.current){i(!0),c(null);try{await d.current.submitCurrentStep(N);const b=await d.current.refreshProgress();a(b)}catch(b){throw c(b),b}finally{i(!1)}}},[]),p=Ke.useMemo(()=>s!=null&&s.stepInfoList?[...s.stepInfoList].sort((N,b)=>N.order-b.order):[],[s==null?void 0:s.stepInfoList]),R=Ke.useMemo(()=>s?s.nextWorkflowKey&&s.nextWorkflowKey!==s.workFlowKey:!1,[s]);return{progress:s,applicantId:m,currentStep:(s==null?void 0:s.currentStep)||null,steps:p,status:(s==null?void 0:s.status)||me.None,workflowResult:(s==null?void 0:s.workflowResult)||null,workflowKey:s==null?void 0:s.workFlowKey,nextWorkflowKey:s==null?void 0:s.nextWorkflowKey,hasWorkflowChanged:R,isLoading:n,error:o,isComplete:(s==null?void 0:s.status)===me.Finished,isOnHold:(s==null?void 0:s.status)===me.OnHold,refreshProgress:h,moveToNext:g,moveBack:k,submitCurrentStep:f,orchestrator:d.current}}function Ot(t){const{questionnaireService:r,applicantService:s}=de(),[a,n]=l.useState(null),[i,o]=l.useState({}),[c,d]=l.useState(!1),[m,v]=l.useState(!1),[w,x]=l.useState(null),h=l.useRef(!1),g=l.useRef(null),k=l.useCallback(async()=>{var p,R;if(t){if(h.current){console.log("[Questionnaire] Load already in progress, skipping...");return}h.current=!0,d(!0),x(null);try{const[N,b]=await Promise.all([r.getQuestionnaire(t),s.getApplicantData(t).catch(()=>null)]);if(n(N),(p=b==null?void 0:b.questionnaireResults)!=null&&p.length&&N){const _=new Map;for(const y of b.questionnaireResults)y.question&&((R=y.answers)!=null&&R.length)&&_.set(y.question.trim().toLowerCase(),y.answers);const W={},P=N.questionGroups.flatMap(y=>y.questions??[]);for(const y of P){const S=y.text.trim().toLowerCase();_.has(S)&&(W[y.id]=_.get(S))}o(W)}g.current=t}catch(N){x(N)}finally{d(!1),h.current=!1}}},[t,r,s]);l.useEffect(()=>{t&&g.current!==t&&k()},[t]);const f=l.useCallback(async p=>{v(!0),x(null);try{return await r.fillQuestionnaire(p)}catch(R){throw x(R),R}finally{v(!1)}},[r]);return{questionnaire:a,initialAnswers:i,isLoading:c,isSubmitting:m,error:w,load:k,submit:f}}function zt(t){const{uploadDocumentService:r}=de(),[s,a]=l.useState(null),[n,i]=l.useState(!1),[o,c]=l.useState(!1),[d,m]=l.useState(0),[v,w]=l.useState(null),x=l.useRef(!1),h=l.useRef(null),g=l.useCallback(async()=>{if(t){if(x.current){console.log("[UploadDocument] Load already in progress, skipping...");return}x.current=!0,i(!0),w(null);try{const f=await r.getUploadDocument(t);a(f),h.current=t}catch(f){w(f)}finally{i(!1),x.current=!1}}},[t,r]);l.useEffect(()=>{t&&h.current!==t&&g()},[t]);const k=l.useCallback(async f=>{c(!0),m(0),w(null);try{await r.fillUploadDocument(f),m(100)}catch(p){throw w(p),p}finally{c(!1)}},[r]);return{uploadDocument:s,isLoading:n,isSubmitting:o,uploadProgress:d,error:v,load:g,submit:k}}function xr(t){const{appropriatenessTestService:r}=de(),[s,a]=l.useState(null),[n,i]=l.useState(!1),[o,c]=l.useState(!1),[d,m]=l.useState(null),[v,w]=l.useState(null),x=l.useRef(!1),h=l.useRef(null),g=l.useCallback(async()=>{if(t){if(x.current){console.log("[AppropriatenessTest] Load already in progress, skipping...");return}x.current=!0,i(!0),m(null);try{const f=await r.getAppropriatenessTest(t);a(f),h.current=t}catch(f){m(f)}finally{i(!1),x.current=!1}}},[t,r]);l.useEffect(()=>{t&&h.current!==t&&g()},[t]);const k=l.useCallback(async f=>{c(!0),m(null);try{const p=await r.fillAppropriatenessTest(f);return w(p),p}catch(p){throw m(p),p}finally{c(!1)}},[r]);return{test:s,result:v,isLoading:n,isSubmitting:o,error:d,load:g,submit:k}}function Bt(t){const{overviewService:r}=de(),[s,a]=l.useState(null),[n,i]=l.useState(!1),[o,c]=l.useState(!1),[d,m]=l.useState(null),v=l.useRef(!1),w=l.useRef(null),x=l.useCallback(async()=>{if(t){if(v.current){console.log("[Overview] Load already in progress, skipping...");return}v.current=!0,i(!0),m(null);try{const g=await r.getOverviewData(t);a(g),w.current=t}catch(g){m(g)}finally{i(!1),v.current=!1}}},[t,r]);l.useEffect(()=>{t&&w.current!==t&&x()},[t]);const h=l.useCallback(async()=>{if(t){c(!0),m(null);try{await r.passOverview(t)}catch(g){throw m(g),g}finally{c(!1)}}},[t,r]);return{overview:s,isLoading:n,isSubmitting:o,error:d,load:x,passOverview:h}}function $t(t){const{identityService:r}=de(),[s,a]=l.useState(null),[n,i]=l.useState(!1),[o,c]=l.useState(null),d=l.useRef(!1),m=l.useCallback(async(x,h)=>{if(t){if(d.current){console.log("[Identity] Request already in progress, skipping...");return}d.current=!0,i(!0),c(null);try{const g={applicantId:t,restart:!1,redirectUrl:x||"",ttl:h||604800};console.log("Identity request input:",g);const k=await r.identityRequest(g);return console.log("Identity request result:",k),a(k),k}catch(g){throw c(g),g}finally{i(!1),d.current=!1}}},[t,r]),v=l.useCallback(async(x,h)=>{if(t){i(!0),c(null);try{const g={applicantId:t,restart:!1,redirectUrl:x,ttl:h},k=await r.identityCompanyRequest(g);return a(k),k}catch(g){throw c(g),g}finally{i(!1)}}},[t,r]),w=l.useCallback(async()=>{if(t){if(d.current){console.log("[Identity] Restart already in progress, skipping...");return}d.current=!0,i(!0),c(null);try{const x={applicantId:t,restart:!0,redirectUrl:"",ttl:604800};console.log("Restarting identity with input:",x);const h=await r.identityRequest(x);return console.log("Restart identity result:",h),a(h),h}catch(x){throw c(x),x}finally{i(!1),d.current=!1}}},[t,r]);return{identityData:s,provider:(s==null?void 0:s.provider)||null,token:(s==null?void 0:s.publicProviderTokenObject)||null,isLoading:n,error:o,requestIdentity:m,requestCompanyIdentity:v,restartIdentity:w}}function Ut(t){const{riskScoringService:r,applicantService:s}=de(),[a,n]=l.useState(null),[i,o]=l.useState({}),[c,d]=l.useState(!1),[m,v]=l.useState(!1),[w,x]=l.useState(null),[h,g]=l.useState(null),k=l.useRef(!1),f=l.useRef(null),p=l.useCallback(async()=>{var N;if(t){if(k.current){console.log("[RiskScoring] Load already in progress, skipping...");return}k.current=!0,d(!0),x(null);try{const[b,_]=await Promise.all([r.getRiskCriterias(t),s.getApplicantData(t).catch(()=>null)]);if(n(b),(N=_==null?void 0:_.riskScoringResults)!=null&&N.length){const W=_.riskScoringResults[0],P={};for(const y of W.riskCriteriaResults??[])if(y.riskCriteriaId!=null&&y.answer!=null&&y.answer!==""){const S=[...new Set(y.answer.split(",").map(I=>I.trim()).filter(I=>I!==""))];S.length>0&&(P[y.riskCriteriaId]=S)}o(P)}f.current=t}catch(b){x(b)}finally{d(!1),k.current=!1}}},[t,r,s]);l.useEffect(()=>{t&&f.current!==t&&p()},[t]);const R=l.useCallback(async N=>{v(!0),x(null);try{const b=await r.submitRiskScoring(N);return g(b),b}catch(b){throw x(b),b}finally{v(!1)}},[r]);return{criteria:a,initialAnswers:i,result:h,isLoading:c,isSubmitting:m,error:w,load:p,submit:R}}function _t(){const{applicantService:t,config:r}=de(),[s,a]=l.useState(!1),[n,i]=l.useState(null),o=l.useRef(!1),c=l.useRef(!1),d=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(h){const g=Math.random()*16|0;return(h==="x"?g:g&3|8).toString(16)}),m=l.useCallback(async h=>{var g;if(o.current)throw console.log("[Applicant] Create already in progress, skipping..."),new Error("Creation already in progress");o.current=!0,a(!0),i(null);try{if(h.applicantAdditionalDatas||(h.applicantAdditionalDatas=[]),(g=r.identityProviders)!=null&&g.sardinai){const f=d();console.log("[SardinAI] Generated session key:",f),h.applicantAdditionalDatas.push({paramName:"sessionKey",value:f})}return await t.createApplicant(h)}catch(k){throw i(k),k}finally{a(!1),o.current=!1}},[t,r]),v=l.useCallback(async h=>{a(!0),i(null);try{return await t.createCompanyApplicant(h)}catch(g){throw i(g),g}finally{a(!1)}},[t]),w=l.useCallback(async h=>{if(c.current)throw console.log("[Applicant] Data load already in progress, skipping..."),new Error("Data load already in progress");c.current=!0,a(!0),i(null);try{return await t.getApplicantData(h)}catch(g){throw i(g),g}finally{a(!1),c.current=!1}},[t]),x=l.useCallback(async h=>{a(!0),i(null);try{await t.stopProgress(h)}catch(g){throw i(g),g}finally{a(!1)}},[t]);return{isLoading:s,error:n,createApplicant:m,createCompanyApplicant:v,getApplicantData:w,stopProgress:x}}const B=({children:t,variant:r="primary",size:s="md",isLoading:a=!1,disabled:n,className:i,...o})=>{const c="inline-flex items-center justify-center rounded-lg font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed",d={primary:"bg-primary-500 text-white hover:bg-primary-600 focus:ring-primary-500",secondary:"bg-gray-200 text-gray-900 hover:bg-gray-300 focus:ring-gray-400",outline:"border-2 border-primary-500 text-primary-500 hover:bg-primary-50 focus:ring-primary-500",danger:"bg-danger-500 text-white hover:bg-danger-600 focus:ring-danger-500",ghost:"text-gray-700 hover:bg-gray-100 focus:ring-gray-400"},m={sm:"px-3 py-1.5 text-sm",md:"px-4 py-2 text-base",lg:"px-6 py-3 text-lg"};return e.jsxs("button",{className:te(c,d[r],m[s],i),disabled:n||a,...o,children:[a&&e.jsxs("svg",{className:"animate-spin -ml-1 mr-2 h-4 w-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),t]})},ie=l.forwardRef(({label:t,error:r,helperText:s,leftIcon:a,rightIcon:n,className:i,...o},c)=>e.jsxs("div",{className:"w-full",children:[t&&e.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:[t,o.required&&e.jsx("span",{className:"text-danger-500 ml-1",children:"*"})]}),e.jsxs("div",{className:"relative",children:[a&&e.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:a}),e.jsx("input",{ref:c,className:te("block w-full rounded-lg border px-3 py-2 text-sm transition-colors","focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent","disabled:bg-gray-100 disabled:cursor-not-allowed",r?"border-danger-500 focus:ring-danger-500":"border-gray-300 dark:border-gray-600","dark:bg-gray-800 dark:text-white",a?"pl-10":"",n?"pr-10":"",i),...o}),n&&e.jsx("div",{className:"absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none",children:n})]}),r&&e.jsx("p",{className:"mt-1 text-sm text-danger-500",children:r}),!r&&s&&e.jsx("p",{className:"mt-1 text-sm text-gray-500",children:s})]}));ie.displayName="Input";const T=({children:t,className:r,...s})=>e.jsx("div",{className:te("metakyc-card rounded-xl shadow-sm border",r),style:{backgroundColor:"var(--metakyc-surface, #ffffff)",borderColor:"var(--metakyc-border, #e5e7eb)"},...s,children:t}),se=({children:t,className:r,...s})=>e.jsx("div",{className:te("px-6 py-4 border-b",r),style:{borderColor:"var(--metakyc-border, #e5e7eb)"},...s,children:t}),M=({children:t,className:r,...s})=>e.jsx("div",{className:te("px-6 py-4",r),...s,children:t}),le=({children:t,className:r,...s})=>e.jsx("div",{className:te("px-6 py-4 border-t",r),style:{borderColor:"var(--metakyc-border, #e5e7eb)"},...s,children:t}),ye=({children:t,variant:r="default",className:s,...a})=>{const n={default:"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300",success:"bg-success-100 text-success-800 dark:bg-success-900 dark:text-success-300",danger:"bg-danger-100 text-danger-800 dark:bg-danger-900 dark:text-danger-300",warning:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-300",info:"bg-primary-100 text-primary-800 dark:bg-primary-900 dark:text-primary-300"};return e.jsx("span",{className:te("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium",n[r],s),...a,children:t})},pe=({size:t="md",className:r,...s})=>{const a={sm:"h-4 w-4",md:"h-8 w-8",lg:"h-12 w-12"};return e.jsx("div",{className:te("flex items-center justify-center",r),...s,children:e.jsxs("svg",{className:te("animate-spin text-primary-500",a[t]),xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})})},be=l.forwardRef(({label:t,error:r,helperText:s,options:a,placeholder:n,className:i,...o},c)=>e.jsxs("div",{className:"w-full",children:[t&&e.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:[t,o.required&&e.jsx("span",{className:"text-danger-500 ml-1",children:"*"})]}),e.jsxs("select",{ref:c,className:te("block w-full rounded-lg border px-3 py-2 text-sm transition-colors","focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent","disabled:bg-gray-100 disabled:cursor-not-allowed",r?"border-danger-500 focus:ring-danger-500":"border-gray-300 dark:border-gray-600","dark:bg-gray-800 dark:text-white",i),...o,children:[n&&e.jsx("option",{value:"",disabled:!0,children:n},"__placeholder__"),a.map((d,m)=>e.jsx("option",{value:d.value,disabled:d.disabled,children:d.label},d.value||`option-${m}`))]}),r&&e.jsx("p",{className:"mt-1 text-sm text-danger-500",children:r}),!r&&s&&e.jsx("p",{className:"mt-1 text-sm text-gray-500",children:s})]}));be.displayName="Select";const Kt=({label:t,value:r,onChange:s,options:a,placeholder:n="Select...",disabled:i=!1,required:o=!1})=>{const[c,d]=l.useState(!1),[m,v]=l.useState(""),w=l.useRef(null);l.useEffect(()=>{const f=p=>{w.current&&!w.current.contains(p.target)&&(d(!1),v(""))};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[]);const x=a.filter(f=>f.label.toLowerCase().includes(m.toLowerCase())),h=f=>{i||(r.includes(f)?s(r.filter(p=>p!==f)):s([...r,f]))},g=(f,p)=>{p.stopPropagation(),i||s(r.filter(R=>R!==f))},k=f=>{var p;return((p=a.find(R=>R.value===f))==null?void 0:p.label)||f};return e.jsxs("div",{className:"w-full metakyc-multiselect",ref:w,children:[t&&e.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:[t,o&&e.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{onClick:()=>!i&&d(!c),className:te("metakyc-multiselect-trigger","min-h-[42px] w-full px-3 py-2 rounded-lg border text-sm transition-colors","bg-white dark:bg-gray-800","border-gray-300 dark:border-gray-600",c&&"ring-2 ring-blue-500 border-transparent",i?"opacity-50 cursor-not-allowed":"cursor-pointer"),children:[r.length===0?e.jsx("span",{className:"metakyc-multiselect-placeholder text-gray-400 dark:text-gray-500 leading-6",children:n}):e.jsx("div",{className:"flex flex-wrap gap-1 pr-6",children:r.map(f=>e.jsxs("span",{className:"metakyc-multiselect-chip inline-flex items-center gap-1 px-2 py-0.5 rounded bg-blue-100 dark:bg-blue-900/40 text-blue-800 dark:text-blue-300 text-xs font-medium",children:[k(f),!i&&e.jsx("button",{type:"button",onClick:p=>g(f,p),className:"metakyc-multiselect-chip-remove",style:{background:"transparent",border:"none",padding:"0 0 0 2px",margin:0,cursor:"pointer",fontSize:"14px",lineHeight:1,fontWeight:"bold",display:"inline-flex",alignItems:"center",boxShadow:"none",transform:"none",minWidth:0,width:"auto",height:"auto",letterSpacing:"normal",textTransform:"none"},children:"×"})]},f))}),e.jsx("span",{className:"metakyc-multiselect-arrow absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none text-xs",children:c?"▲":"▼"})]}),c&&e.jsxs("div",{className:"metakyc-multiselect-dropdown absolute z-50 w-full mt-1 rounded-lg shadow-lg",style:{background:"inherit",border:"1px solid #d1d5db"},children:[e.jsx("div",{className:"metakyc-multiselect-search-wrapper p-2",style:{borderBottom:"1px solid #e5e7eb"},children:e.jsx("input",{type:"text",value:m,onChange:f=>v(f.target.value),placeholder:"Search...",autoFocus:!0,onClick:f=>f.stopPropagation(),className:"metakyc-multiselect-search w-full px-2 py-1.5 text-sm rounded focus:outline-none focus:ring-1 focus:ring-blue-500",style:{border:"1px solid #d1d5db"}})}),e.jsx("ul",{className:"max-h-48 overflow-y-auto py-1",children:x.length===0?e.jsx("li",{className:"px-3 py-2 text-sm text-gray-500 dark:text-gray-400",children:"No results"}):x.map(f=>e.jsxs("li",{onClick:()=>h(f.value),className:te("metakyc-multiselect-option","flex items-center gap-2 px-3 py-2 text-sm cursor-pointer","hover:bg-gray-50 dark:hover:bg-gray-700",r.includes(f.value)&&"metakyc-multiselect-option-selected bg-blue-50 dark:bg-blue-900/20"),children:[e.jsx("input",{type:"checkbox",checked:r.includes(f.value),readOnly:!0,className:"rounded border-gray-300 text-blue-600 pointer-events-none"}),e.jsx("span",{className:"text-gray-900 dark:text-gray-100",children:f.label})]},f.value))}),r.length>0&&e.jsx("div",{className:"metakyc-multiselect-clear p-2 border-t border-gray-100 dark:border-gray-700",children:e.jsxs("button",{type:"button",onClick:()=>{s([]),v("")},className:"text-xs text-red-500 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300",children:["Clear all (",r.length," selected)"]})})]})]})]})},qt=({label:t,error:r,accept:s,multiple:a=!1,maxSize:n,onChange:i,value:o=[],className:c})=>{const[d,m]=l.useState(!1),v=l.useRef(null),w=p=>{if(!p)return;const R=Array.from(p);if(n&&R.filter(b=>b.size>n).length>0){const b=Pe(n);alert(`Some files exceed the maximum size of ${b}`);return}i==null||i(a?[...o,...R]:[R[0]])},x=p=>{p.preventDefault(),m(!0)},h=()=>{m(!1)},g=p=>{p.preventDefault(),m(!1),w(p.dataTransfer.files)},k=()=>{var p;(p=v.current)==null||p.click()},f=p=>{const R=o.filter((N,b)=>b!==p);i==null||i(R)};return e.jsxs("div",{className:te("w-full",c),children:[t&&e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:t}),e.jsxs("div",{className:te("border-2 border-dashed rounded-lg p-6 text-center cursor-pointer transition-colors",d?"border-primary-500 bg-primary-50 dark:bg-primary-900/20":"border-gray-300 dark:border-gray-600 hover:border-primary-500",r&&"border-danger-500"),onDragOver:x,onDragLeave:h,onDrop:g,onClick:k,children:[e.jsx("input",{ref:v,type:"file",className:"hidden",accept:s,multiple:a,onChange:p=>w(p.target.files)}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("svg",{className:"mx-auto h-12 w-12 text-gray-400",stroke:"currentColor",fill:"none",viewBox:"0 0 48 48",children:e.jsx("path",{d:"M28 8H12a4 4 0 00-4 4v20m32-12v8m0 0v8a4 4 0 01-4 4H12a4 4 0 01-4-4v-4m32-4l-3.172-3.172a4 4 0 00-5.656 0L28 28M8 32l9.172-9.172a4 4 0 015.656 0L28 28m0 0l4 4m4-24h8m-4-4v8m-12 4h.02",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}),e.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:[e.jsx("span",{className:"font-medium text-primary-500",children:"Click to upload"})," or drag and drop"]}),n&&e.jsxs("p",{className:"text-xs text-gray-500",children:["Maximum file size: ",Pe(n)]})]})]}),o.length>0&&e.jsx("div",{className:"mt-3 space-y-2",children:o.map((p,R)=>e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[e.jsxs("div",{className:"flex items-center space-x-2 flex-1 min-w-0",children:[e.jsx("svg",{className:"h-5 w-5 text-gray-400 flex-shrink-0",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M4 4a2 2 0 012-2h4.586A2 2 0 0112 2.586L15.414 6A2 2 0 0116 7.414V16a2 2 0 01-2 2H6a2 2 0 01-2-2V4z",clipRule:"evenodd"})}),e.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300 truncate",children:p.name}),e.jsxs("span",{className:"text-xs text-gray-500",children:["(",Pe(p.size),")"]})]}),e.jsx("button",{type:"button",onClick:N=>{N.stopPropagation(),f(R)},className:"ml-2 text-danger-500 hover:text-danger-700 focus:outline-none",children:e.jsx("svg",{className:"h-5 w-5",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]},R))}),r&&e.jsx("p",{className:"mt-1 text-sm text-danger-500",children:r})]})},Ht=l.forwardRef(({countryCode:t="+1",onCountryCodeChange:r,className:s,...a},n)=>e.jsxs("div",{className:"w-full",children:[a.label&&e.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:[a.label,a.required&&e.jsx("span",{className:"text-danger-500 ml-1",children:"*"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:t,onChange:i=>r==null?void 0:r(i.target.value),className:te("w-20 rounded-lg border px-3 py-2 text-sm","focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent","border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-white"),placeholder:"+1"}),e.jsx(ie,{ref:n,type:"tel",className:te("flex-1",s),...a,label:""})]}),a.error&&e.jsx("p",{className:"mt-1 text-sm text-danger-500",children:a.error})]}));Ht.displayName="PhoneInput";/**
1
+ "use strict";var ar=Object.defineProperty;var nr=(t,r,s)=>r in t?ar(t,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[r]=s;var Q=(t,r,s)=>nr(t,typeof r!="symbol"?r+"":r,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ir=require("axios"),l=require("react"),e=require("react/jsx-runtime"),ke=require("react-hook-form"),ve=require("zod");function lr(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const s in t)if(s!=="default"){const a=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(r,s,a.get?a:{enumerable:!0,get:()=>t[s]})}}return r.default=t,Object.freeze(r)}const Ke=lr(l);var z=(t=>(t[t.IdentitySdk=0]="IdentitySdk",t[t.RiskScoring=1]="RiskScoring",t[t.Questionaries=2]="Questionaries",t[t.AdditionalData=3]="AdditionalData",t[t.AppropriatenessTest=4]="AppropriatenessTest",t[t.UploadDocument=5]="UploadDocument",t[t.ManualReview=6]="ManualReview",t[t.Overview=7]="Overview",t[t.InvestorCategorization=8]="InvestorCategorization",t))(z||{}),Re=(t=>(t[t.NotStarted=0]="NotStarted",t[t.InProgress=1]="InProgress",t[t.Success=2]="Success",t[t.PartialSuccess=3]="PartialSuccess",t[t.Failed=4]="Failed",t[t.Skipped=5]="Skipped",t[t.AdminReview=6]="AdminReview",t[t.SkippedAndAdminReview=7]="SkippedAndAdminReview",t))(Re||{}),me=(t=>(t[t.None=0]="None",t[t.InProgress=1]="InProgress",t[t.Finished=2]="Finished",t[t.OnHold=3]="OnHold",t[t.IdentityPending=4]="IdentityPending",t))(me||{}),He=(t=>(t[t.None=0]="None",t[t.RepresentativeKYC=1]="RepresentativeKYC",t[t.ManualRiskCriteria=2]="ManualRiskCriteria",t[t.UploadDocumentReview=3]="UploadDocumentReview",t[t.AdminReview=4]="AdminReview",t))(He||{}),We=(t=>(t[t.LowRisk=0]="LowRisk",t[t.MediumRisk=1]="MediumRisk",t[t.HighRisk=2]="HighRisk",t[t.Alert=3]="Alert",t))(We||{}),we=(t=>(t[t.None=0]="None",t[t.Pending=1]="Pending",t[t.Approved=2]="Approved",t[t.Rejected=3]="Rejected",t[t.ResendRequested=4]="ResendRequested",t[t.Unknown=5]="Unknown",t[t.InProgress=6]="InProgress",t))(we||{}),je=(t=>(t[t.Approved=0]="Approved",t[t.Reject=1]="Reject",t[t.UnderReview=2]="UnderReview",t[t.Closed=3]="Closed",t[t.AdminReview=4]="AdminReview",t[t.New=5]="New",t[t.InProgress=6]="InProgress",t))(je||{}),Ye=(t=>(t[t.ProviderResultPending=0]="ProviderResultPending",t[t.ProviderResultReceived=1]="ProviderResultReceived",t[t.Canceled=2]="Canceled",t[t.ExtendedToNewApplicant=3]="ExtendedToNewApplicant",t))(Ye||{}),Qe=(t=>(t[t.None=0]="None",t[t.ProviderResultPending=1]="ProviderResultPending",t[t.ProviderResultReceived=2]="ProviderResultReceived",t[t.Canceled=3]="Canceled",t))(Qe||{}),ue=(t=>(t[t.Onfido=0]="Onfido",t[t.Sumsub=2]="Sumsub",t[t.SardinAI=3]="SardinAI",t))(ue||{}),Ve=(t=>(t[t.Individual=0]="Individual",t[t.Company=1]="Company",t))(Ve||{}),Ie=(t=>(t[t.Male=0]="Male",t[t.Female=1]="Female",t[t.Other=2]="Other",t))(Ie||{}),Ge=(t=>(t[t.Image=0]="Image",t[t.Video=1]="Video",t[t.PDF=2]="PDF",t[t.OfficePDF=3]="OfficePDF",t[t.Custom=4]="Custom",t))(Ge||{}),Ze=(t=>(t[t.Pending=0]="Pending",t[t.Approved=1]="Approved",t[t.Rejected=2]="Rejected",t[t.RequiresRevision=3]="RequiresRevision",t))(Ze||{}),Je=(t=>(t[t.SingleChoice=0]="SingleChoice",t[t.MultipleChoice=1]="MultipleChoice",t[t.Text=2]="Text",t))(Je||{}),fe=(t=>(t[t.String=0]="String",t[t.Integer=1]="Integer",t[t.Decimal=2]="Decimal",t[t.Boolean=3]="Boolean",t[t.Date=4]="Date",t[t.Country=5]="Country",t[t.DigitOnly=6]="DigitOnly",t))(fe||{}),Xe=(t=>(t[t.Text=0]="Text",t[t.Radio=1]="Radio",t[t.Checkbox=2]="Checkbox",t[t.Dropdown=3]="Dropdown",t[t.Country=4]="Country",t))(Xe||{}),et=(t=>(t[t.None=0]="None",t[t.Country=1]="Country",t))(et||{}),ce=(t=>(t[t.Individual=0]="Individual",t[t.Sophisticated=1]="Sophisticated",t[t.HighNetWorth=2]="HighNetWorth",t[t.Business=3]="Business",t))(ce||{}),tt=(t=>(t[t.Retail=0]="Retail",t[t.Professional=1]="Professional",t[t.EligibleCounterparty=2]="EligibleCounterparty",t))(tt||{});const Fe={firstName:{label:"First Name",type:"text"},lastName:{label:"Last Name",type:"text"},email:{label:"Email",type:"email"},phonenumber:{label:"Phone Number",type:"tel"},dateOfBirth:{label:"Date of Birth",type:"date"},salutation:{label:"Salutation",type:"select"},title:{label:"Title",type:"text"},mobileCountryCode:{label:"Mobile Country Code",type:"text"},street:{label:"Street",type:"text"},streetNumber:{label:"Street Number",type:"text"},zip:{label:"ZIP / Postal Code",type:"text"},city:{label:"City",type:"text"},country:{label:"Country",type:"select"},nationality:{label:"Nationality",type:"select"},otherNationality:{label:"Other Nationalities",type:"multiselect"},countryOfBirth:{label:"Country of Birth",type:"select"},placeOfBirth:{label:"Place of Birth",type:"text"},taxCountry:{label:"Tax Country",type:"select"},taxNumber:{label:"Tax Number",type:"text"},defaultLanguage:{label:"Default Language",type:"select"},educationLevel:{label:"Education Level",type:"text"},occupation:{label:"Occupation",type:"text"}},rt=["firstName","lastName","email","phonenumber","dateOfBirth"],ze=[{value:"EN",label:"English"},{value:"DE",label:"German"},{value:"FR",label:"French"},{value:"ES",label:"Spanish"},{value:"IT",label:"Italian"},{value:"PT",label:"Portuguese"},{value:"NL",label:"Dutch"},{value:"PL",label:"Polish"},{value:"RU",label:"Russian"},{value:"ZH",label:"Chinese"},{value:"JA",label:"Japanese"},{value:"AR",label:"Arabic"},{value:"TR",label:"Turkish"},{value:"SV",label:"Swedish"},{value:"DA",label:"Danish"},{value:"FI",label:"Finnish"},{value:"NO",label:"Norwegian"}];var ee=(t=>(t.Default="default",t.Corporate="corporate",t.Fintech="fintech",t.Healthcare="healthcare",t.Modern="modern",t.Minimal="minimal",t))(ee||{});const st={timeout:3e4,retries:3,locale:"en",endpoints:{pattern:"host-controller"}};class at{constructor(r){this.config=r}build(r,s){const a=`${r}.${s}`;if(this.config.customPaths&&this.config.customPaths[a])return this.config.customPaths[a];switch(this.config.pattern){case"host-controller":return`/api/${r}/${s}`;case"application-service":return`/services/app/${this.getServiceName(r)}/${s}`;case"custom":throw new Error(`Custom endpoint path not found for ${a}. Please provide it in customPaths.`);default:throw new Error(`Unknown endpoint pattern: ${this.config.pattern}`)}}getServiceName(r){return{Applicant:"MetaKYCVerification",Questionnaire:"MetaKYCVerification",UploadDocument:"MetaKYCVerification",AppropriatenessTest:"MetaKYCVerification",BaseInformation:"MetaKYCVerification"}[r]||r}}class xe extends Error{constructor(s,a,n,i,o){super(s);Q(this,"response");this.code=a,this.details=n,this.validationErrors=i,this.name="MetaKYCError",this.response=o,Object.setPrototypeOf(this,xe.prototype)}}class Ce{static handleApiError(r){return new xe(r.message||"An unknown error occurred",r.code,r.details||void 0,r.validationErrors||void 0)}static handleAxiosError(r){if(r.response){const s=r.response.data;return s&&s.error?new xe(s.error.message||"An unknown error occurred",s.error.code,s.error.details||void 0,s.error.validationErrors||void 0,r.response):s&&s.result&&s.result.message?new xe(s.result.message,r.response.status,`HTTP ${r.response.status}: ${r.response.statusText}`,void 0,r.response):new xe((s==null?void 0:s.message)||r.message||"Request failed",r.response.status,`HTTP ${r.response.status}: ${r.response.statusText}`,void 0,r.response)}else return r.request?new xe("No response from server",0,"The request was made but no response was received. Please check your network connection."):new xe(r.message||"An unexpected error occurred",0,r.toString())}static isMetaKYCError(r){return r instanceof xe}}class nt{constructor(r){Q(this,"axiosInstance");Q(this,"endpointBuilder");Q(this,"config");this.config={...st,...r},this.endpointBuilder=new at(this.config.endpoints),this.axiosInstance=ir.create({baseURL:this.config.baseUrl,timeout:this.config.timeout,headers:{"Content-Type":"application/json"}}),this.axiosInstance.interceptors.request.use(s=>(s.headers["Abp-TenantId"]=this.config.tenantId.toString(),s.headers.ApiKey=this.config.apiKey,s.headers["X-API-KEY"]=this.config.apiKey,this.config.locale&&(s.headers["Accept-Language"]=this.config.locale),s),s=>Promise.reject(s)),this.axiosInstance.interceptors.response.use(s=>s,async s=>{var n;const a=s.config;return((n=s.response)==null?void 0:n.status)>=500&&!a._retry&&(a._retry=!0,a._retryCount=(a._retryCount||0)+1,a._retryCount<(this.config.retries||3))?(await new Promise(i=>setTimeout(i,1e3*a._retryCount)),this.axiosInstance(a)):Promise.reject(s)})}buildEndpoint(r,s){return this.endpointBuilder.build(r,s)}async get(r,s,a){try{const n=this.buildEndpoint(r,s),i=await this.axiosInstance.get(n,{params:a});return this.handleResponse(i)}catch(n){throw Ce.handleAxiosError(n)}}async post(r,s,a){try{const n=this.buildEndpoint(r,s),i=await this.axiosInstance.post(n,a);return this.handleResponse(i)}catch(n){throw Ce.handleAxiosError(n)}}async put(r,s,a){try{const n=this.buildEndpoint(r,s),i=await this.axiosInstance.put(n,a);return this.handleResponse(i)}catch(n){throw Ce.handleAxiosError(n)}}async delete(r,s,a){try{const n=this.buildEndpoint(r,s),i=await this.axiosInstance.delete(n,{params:a});return this.handleResponse(i)}catch(n){throw Ce.handleAxiosError(n)}}handleResponse(r){const s=r.data;if(!s.success&&s.error)throw Ce.handleApiError(s.error);return s}getAxiosInstance(){return this.axiosInstance}}class it{constructor(r){this.httpClient=r}async createApplicant(r){return(await this.httpClient.post("Applicant","ApplicantRegistrationRequest",r)).result}async createCompanyApplicant(r){return(await this.httpClient.post("Applicant","ApplicantCompanyRegistrationRequest",r)).result}async duplicateApplicant(r){return(await this.httpClient.post("Applicant","DuplicateApplicantRegistrationRequest",r)).result}async getProgress(r){return(await this.httpClient.get("Applicant","GetApplicantProgress",{applicantId:r})).result}async getProgressStatus(r){return(await this.httpClient.get("Applicant","GetApplicantProgressStaus",{applicantId:r})).result}async getApplicantData(r){return(await this.httpClient.get("Applicant","GetApplicantData",{applicantId:r})).result}async getApplicantStatus(r){return(await this.httpClient.get("Applicant","GetApplicantStatus",{applicantId:r})).result}async stopProgress(r){await this.httpClient.get("Applicant","StopProgress",{applicantId:r})}async progressStepBack(r){await this.httpClient.get("Applicant","ProgressStepBack",{applicantId:r})}async setLanguage(r,s){await this.httpClient.post("Applicant","SetApplicantLng",{applicantId:r,language:s})}async activateApplicant(r){await this.httpClient.get("Applicant","ActivateApplicant",{applicantId:r})}async deleteApplicant(r){await this.httpClient.delete("Applicant","DeleteApplicant",{applicantId:r})}async checkApplicantExists(r){return(await this.httpClient.get("Applicant","CheckApplicantIfExists",{externalRefId:r})).result}}class lt{constructor(r){this.httpClient=r}async getQuestionnaire(r){return(await this.httpClient.get("Questionnaire","GetQuestionnaire",{applicantid:r})).result}async fillQuestionnaire(r){return(await this.httpClient.post("Applicant","FillQuestionnarie",r)).result}}class ot{constructor(r){this.httpClient=r}async getUploadDocument(r){return(await this.httpClient.get("UploadDocument","GetUploadDocument",{applicantid:r})).result}async fillUploadDocument(r){await this.httpClient.post("Applicant","FillUploadDocument",r)}async reviewUploadDocument(r){await this.httpClient.post("UploadDocument","ReviewUploadDocument",r)}}class ct{constructor(r){this.httpClient=r}async getAppropriatenessTest(r){return(await this.httpClient.get("AppropriatenessTest","GetAppropriatenessTest",{applicantid:r})).result}async fillAppropriatenessTest(r){return(await this.httpClient.post("Applicant","FillAppropriatenessTest",r)).result}}class dt{constructor(r){this.httpClient=r}async getOverviewData(r){return(await this.httpClient.get("Applicant","GetOverviewData",{ApplicantId:r})).result}async passOverview(r){await this.httpClient.get("Applicant","PassOverview",{applicantId:r})}}class ut{constructor(r){this.httpClient=r}async getRiskScoringPlan(){return(await this.httpClient.get("Applicant","GetRiskScoringPlanInfo")).result}async getRiskCriterias(r){return(await this.httpClient.get("Risk","GetCriterias",{applicantId:r})).result}async submitRiskScoring(r){return(await this.httpClient.post("Applicant","RiskScoringRequest",r)).result}}class mt{constructor(r){this.httpClient=r}async identityRequest(r){console.log("[IdentityService] Calling IdentityRequest with input:",r);const s=await this.httpClient.post("Applicant","IdentityRequest",r);return console.log("[IdentityService] IdentityRequest response:",s),s.result}async identityCompanyRequest(r){return(await this.httpClient.post("Applicant","IdentityCompanyRequest",r)).result}async restartIdentityRequest(r){const s={applicantId:r,restart:!0,redirectUrl:"",ttl:604800};return console.log("[IdentityService] Restarting identity with restart=true:",s),this.identityRequest(s)}async restartIdentityCompanyRequest(r){const s={applicantId:r,restart:!0,redirectUrl:"",ttl:604800};return this.identityCompanyRequest(s)}}class pt{constructor(r){this.httpClient=r}async getCountries(r,s,a){return(await this.httpClient.get("BaseInformation","GetAllCountries",{filter:r||"",lng:s||"en",type:a})).result}async getBranches(){return(await this.httpClient.get("BaseInformation","GetBranches")).result}async getLegalEntities(){return(await this.httpClient.get("BaseInformation","GetLegalEntities")).result}}class ht{constructor(r){this.httpClient=r}async setInvestorCategorization(r){return(await this.httpClient.post("Applicant","SetInvestorCategorization",r)).result}async getInvestorCategorization(r){return(await this.httpClient.get("Applicant","GetInvestorCategorisation",{applicantId:r})).result}}const ne={name:"Default",title:"KYC Verification",logo:{url:"",height:"40px",visible:!0},colors:{primary:"#2563eb",primaryHover:"#1d4ed8",primaryLight:"#dbeafe",primaryDark:"#1e40af",secondary:"#64748b",secondaryHover:"#475569",success:"#10b981",warning:"#f59e0b",danger:"#ef4444",info:"#3b82f6",background:"#ffffff",surface:"#f9fafb",border:"#e5e7eb",textPrimary:"#111827",textSecondary:"#6b7280",textMuted:"#9ca3af"},typography:{fontFamily:"Inter, system-ui, -apple-system, sans-serif",fontSize:{xs:"0.75rem",sm:"0.875rem",base:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","3xl":"1.875rem"},fontWeight:{normal:400,medium:500,semibold:600,bold:700}},spacing:{borderRadius:"0.5rem",cardPadding:"1.5rem",inputHeight:"2.5rem"},darkMode:{colors:{background:"#111827",surface:"#1f2937",border:"#374151",textPrimary:"#f9fafb",textSecondary:"#d1d5db",textMuted:"#9ca3af"}}},gt={name:"Corporate",logo:{url:"",height:"40px",visible:!0},colors:{primary:"#0052CC",primaryHover:"#0747A6",primaryLight:"#DEEBFF",primaryDark:"#0747A6",secondary:"#6B778C",secondaryHover:"#5E6C84",success:"#00875A",warning:"#FF991F",danger:"#DE350B",info:"#0065FF",background:"#ffffff",surface:"#F4F5F7",border:"#DFE1E6",textPrimary:"#172B4D",textSecondary:"#5E6C84",textMuted:"#97A0AF"},typography:{fontFamily:"system-ui, -apple-system, sans-serif"},spacing:{borderRadius:"0.25rem",cardPadding:"1.5rem",inputHeight:"2.5rem"}},xt={name:"Fintech",logo:{url:"",height:"36px",visible:!0},colors:{primary:"#00B386",primaryHover:"#009973",primaryLight:"#D1FAE5",primaryDark:"#047857",secondary:"#7C3AED",secondaryHover:"#6D28D9",success:"#10B981",warning:"#F59E0B",danger:"#EF4444",info:"#3B82F6",background:"#ffffff",surface:"#F9FAFB",border:"#E5E7EB",textPrimary:"#111827",textSecondary:"#6B7280",textMuted:"#9CA3AF"},typography:{fontFamily:"Montserrat, system-ui, sans-serif"},spacing:{borderRadius:"0.75rem",cardPadding:"2rem",inputHeight:"3rem"}},yt={name:"Healthcare",logo:{url:"",height:"44px",visible:!0},colors:{primary:"#06B6D4",primaryHover:"#0891B2",primaryLight:"#CFFAFE",primaryDark:"#0E7490",secondary:"#8B5CF6",secondaryHover:"#7C3AED",success:"#059669",warning:"#D97706",danger:"#DC2626",info:"#0284C7",background:"#ffffff",surface:"#F0F9FF",border:"#E0F2FE",textPrimary:"#0F172A",textSecondary:"#475569",textMuted:"#94A3B8"},typography:{fontFamily:"Lato, system-ui, sans-serif"},spacing:{borderRadius:"0.5rem",cardPadding:"1.75rem",inputHeight:"2.75rem"},darkMode:{colors:{background:"#0F172A",surface:"#1E293B",border:"#334155",textPrimary:"#F1F5F9",textSecondary:"#CBD5E1"}}},ft={name:"Modern",logo:{url:"",height:"38px",visible:!0},colors:{primary:"#8B5CF6",primaryHover:"#7C3AED",primaryLight:"#EDE9FE",primaryDark:"#6D28D9",secondary:"#EC4899",secondaryHover:"#DB2777",success:"#10B981",warning:"#F59E0B",danger:"#EF4444",info:"#3B82F6",background:"#ffffff",surface:"#FAFAFA",border:"#E5E5E5",textPrimary:"#171717",textSecondary:"#737373",textMuted:"#A3A3A3"},typography:{fontFamily:"Poppins, system-ui, sans-serif"},spacing:{borderRadius:"1rem",cardPadding:"2rem",inputHeight:"3rem"}},bt={name:"Minimal",logo:{url:"",height:"32px",visible:!0},colors:{primary:"#000000",primaryHover:"#18181B",primaryLight:"#F4F4F5",primaryDark:"#000000",secondary:"#71717A",secondaryHover:"#52525B",success:"#22C55E",warning:"#EAB308",danger:"#EF4444",info:"#3B82F6",background:"#ffffff",surface:"#FAFAFA",border:"#E4E4E7",textPrimary:"#09090B",textSecondary:"#71717A",textMuted:"#A1A1AA"},typography:{fontFamily:"system-ui, -apple-system, sans-serif"},spacing:{borderRadius:"0.25rem",cardPadding:"1.25rem",inputHeight:"2.25rem"}},vt={[ee.Default]:ne,[ee.Corporate]:gt,[ee.Fintech]:xt,[ee.Healthcare]:yt,[ee.Modern]:ft,[ee.Minimal]:bt};function Ae(t){return vt[t]||ne}class kt{constructor(r){this.httpClient=r}async getThemeConfiguration(){var r;try{const s=await this.httpClient.get("Tenant","GetThemeConfiguration");if(!s.result.isEnabled)return Ae(ee.Default);let a=s.result.preset?Ae(s.result.preset):Ae(ee.Default);if(s.result.title&&(a.title=s.result.title),s.result.logo&&(a.logo={...a.logo,...s.result.logo}),s.result.colors&&(a.colors={...a.colors,...s.result.colors}),s.result.typography&&(a.typography={...a.typography,...s.result.typography}),s.result.spacing&&(a.spacing={...a.spacing,...s.result.spacing}),s.result.customCSS&&(a.customCSS=s.result.customCSS),s.result.darkMode&&(a.darkMode={colors:{...(r=a.darkMode)==null?void 0:r.colors,...s.result.darkMode.colors}}),s.result.applicantFormVisibleFields&&s.result.applicantFormVisibleFields.length>0&&(a.applicantFormVisibleFields=s.result.applicantFormVisibleFields),s.result.applicantFormRequiredFields&&s.result.applicantFormRequiredFields.length>0&&(a.applicantFormRequiredFields=s.result.applicantFormRequiredFields),s.result.allowedLanguages&&s.result.allowedLanguages.length>0&&(a.allowedLanguages=s.result.allowedLanguages),s.result.applicantFormPages)try{const n=typeof s.result.applicantFormPages=="string"?JSON.parse(s.result.applicantFormPages):s.result.applicantFormPages;Array.isArray(n)&&n.length>0&&(a.applicantFormPages=n)}catch{}return a}catch(s){return console.warn("[ThemeService] Failed to fetch theme configuration:",s),Ae(ee.Default)}}async saveThemeConfiguration(r){await this.httpClient.post("Tenant","SaveThemeConfiguration",r)}getAvailablePresets(){return[{id:ee.Default,name:"Default"},{id:ee.Corporate,name:"Corporate"},{id:ee.Fintech,name:"Fintech"},{id:ee.Healthcare,name:"Healthcare"},{id:ee.Modern,name:"Modern"},{id:ee.Minimal,name:"Minimal"}]}getPreviewTheme(r,s){const a=Ae(r);return s?{...a,...s,logo:{...a.logo,...s.logo},colors:{...a.colors,...s.colors},typography:s.typography?{...a.typography,...s.typography}:a.typography,spacing:s.spacing?{...a.spacing,...s.spacing}:a.spacing}:a}}class wt{constructor(){Q(this,"listeners",new Map)}on(r,s){return this.listeners.has(r)||this.listeners.set(r,new Set),this.listeners.get(r).add(s),()=>{this.off(r,s)}}off(r,s){const a=this.listeners.get(r);a&&a.delete(s)}emit(r,s){const a=this.listeners.get(r);a&&a.forEach(n=>{try{n(s)}catch(i){console.error(`Error in event listener for "${r}":`,i)}})}clear(){this.listeners.clear()}clearEvent(r){this.listeners.delete(r)}}class jt{constructor(){Q(this,"events",new wt);Q(this,"_applicantId",null);Q(this,"_progress",null);Q(this,"_error",null)}get applicantId(){return this._applicantId}get progress(){return this._progress}get currentStep(){var r;return((r=this._progress)==null?void 0:r.currentStep)||null}get steps(){var r;return((r=this._progress)==null?void 0:r.stepInfoList)||[]}get status(){var r;return((r=this._progress)==null?void 0:r.status)||me.None}get workflowResult(){var r;return((r=this._progress)==null?void 0:r.workflowResult)||null}get error(){return this._error}get isComplete(){return this.status===me.Finished}get isOnHold(){return this.status===me.OnHold}get isInProgress(){return this.status===me.InProgress}setApplicantId(r){this._applicantId=r}updateProgress(r){var a,n;const s=(a=this._progress)==null?void 0:a.currentStep;this._progress=r,this._applicantId=r.applicantId,this._error=null,this.events.emit("progressUpdated",r),(s==null?void 0:s.order)!==((n=r.currentStep)==null?void 0:n.order)&&this.events.emit("stepChanged",r.currentStep),this.events.emit("statusChanged",r.status),r.status===me.Finished&&r.workflowResult&&this.events.emit("completed",r.workflowResult)}setError(r){this._error=r,this.events.emit("error",r)}clearError(){this._error=null}reset(){this._applicantId=null,this._progress=null,this._error=null}onProgressUpdated(r){return this.events.on("progressUpdated",r)}onStepChanged(r){return this.events.on("stepChanged",r)}onStatusChanged(r){return this.events.on("statusChanged",r)}onError(r){return this.events.on("error",r)}onCompleted(r){return this.events.on("completed",r)}clearListeners(){this.events.clear()}}class Nt{constructor(){Q(this,"handlers",new Map)}registerHandler(r,s){this.handlers.set(r,s)}getHandler(r){return this.handlers.get(r)}hasHandler(r){return this.handlers.has(r)}async loadStepData(r,s){const a=this.getHandler(r);if(!a)throw new Error(`No handler registered for step action: ${z[r]}`);return a.loadData(s)}async submitStepData(r,s){const a=this.getHandler(r);if(!a)throw new Error(`No handler registered for step action: ${z[r]}`);return a.submitData(s)}}class St{constructor(r,s,a,n,i,o,c,d){Q(this,"state");Q(this,"stepRouter");this.applicantService=r,this.questionnaireService=s,this.uploadDocumentService=a,this.appropriatenessTestService=n,this.overviewService=i,this.riskScoringService=o,this.investorCategorizationService=d,this.state=new jt,this.stepRouter=new Nt,this.registerStepHandlers()}registerStepHandlers(){this.stepRouter.registerHandler(z.Questionaries,{loadData:r=>this.questionnaireService.getQuestionnaire(r),submitData:async r=>{await this.questionnaireService.fillQuestionnaire(r)}}),this.stepRouter.registerHandler(z.UploadDocument,{loadData:r=>this.uploadDocumentService.getUploadDocument(r),submitData:r=>this.uploadDocumentService.fillUploadDocument(r)}),this.stepRouter.registerHandler(z.AppropriatenessTest,{loadData:r=>this.appropriatenessTestService.getAppropriatenessTest(r),submitData:async r=>{await this.appropriatenessTestService.fillAppropriatenessTest(r)}}),this.stepRouter.registerHandler(z.Overview,{loadData:r=>this.overviewService.getOverviewData(r),submitData:r=>this.overviewService.passOverview(r.applicantId)}),this.stepRouter.registerHandler(z.RiskScoring,{loadData:r=>this.riskScoringService.getRiskCriterias(r),submitData:async r=>{await this.riskScoringService.submitRiskScoring(r)}}),this.stepRouter.registerHandler(z.IdentitySdk,{loadData:async r=>({applicantId:r,message:"Identity verification required"}),submitData:async()=>{}}),this.stepRouter.registerHandler(z.InvestorCategorization,{loadData:r=>this.investorCategorizationService.getInvestorCategorization(r),submitData:async r=>{await this.investorCategorizationService.setInvestorCategorization(r)}}),this.stepRouter.registerHandler(z.ManualReview,{loadData:async r=>({applicantId:r,message:"Your application is under manual review"}),submitData:async()=>{}}),this.stepRouter.registerHandler(z.AdditionalData,{loadData:async r=>({applicantId:r,message:"Additional data required"}),submitData:async()=>{}})}async initialize(r){try{this.state.setApplicantId(r);const s=await this.applicantService.getProgress(r);return this.state.updateProgress(s),s}catch(s){throw this.state.setError(s),s}}async refreshProgress(){if(!this.state.applicantId)throw new Error("Workflow not initialized. Call initialize() first.");try{const r=await this.applicantService.getProgress(this.state.applicantId);return this.state.updateProgress(r),r}catch(r){throw this.state.setError(r),r}}async getCurrentStepData(){if(!this.state.currentStep)throw new Error("No current step available");if(!this.state.applicantId)throw new Error("Workflow not initialized");try{return await this.stepRouter.loadStepData(this.state.currentStep.action,this.state.applicantId)}catch(r){throw this.state.setError(r),r}}async submitCurrentStep(r){if(!this.state.currentStep)throw new Error("No current step available");try{await this.stepRouter.submitStepData(this.state.currentStep.action,r),await this.refreshProgress()}catch(s){throw this.state.setError(s),s}}async moveToNextStep(){return this.refreshProgress()}async moveToPreviousStep(){if(!this.state.applicantId)throw new Error("Workflow not initialized");try{return await this.applicantService.progressStepBack(this.state.applicantId),await this.refreshProgress()}catch(r){throw this.state.setError(r),r}}getState(){return this.state}getStepRouter(){return this.stepRouter}}function $e(t,r){return new Promise((s,a)=>{if(r&&document.getElementById(r)){s();return}const n=document.createElement("script");n.src=t,r&&(n.id=r),n.async=!0,n.onload=()=>s(),n.onerror=()=>a(new Error(`Failed to load script: ${t}`)),document.head.appendChild(n)})}function or(t){return!!document.getElementById(t)}function cr(t){const r=document.getElementById(t);r&&r.remove()}class Ct{constructor(r){Q(this,"sdk",null);Q(this,"config");this.config=r}async loadSDK(){await $e("https://cdn.sumsub.com/websdk/v2/production/websdk.js","sumsub-sdk")}async initialize(r){if(window.snsWebSdk||await this.loadSDK(),!window.snsWebSdk)throw new Error("Sumsub SDK failed to load");this.sdk=window.snsWebSdk.init(this.config.accessToken,()=>this.config.accessToken).withConf({lang:this.config.lang||"en",email:this.config.applicantEmail,phone:this.config.applicantPhone,i18n:{}}).on("idCheck.onStepCompleted",s=>{console.log("Sumsub step completed:",s)}).on("idCheck.onError",s=>{console.error("Sumsub error:",s)}).build(),this.sdk.launch(`#${r}`)}destroy(){this.sdk&&(this.sdk.destroy(),this.sdk=null)}onComplete(r){this.sdk&&this.sdk.on("idCheck.applicantStatus",s=>{s.applicantStatus==="completed"&&r(s)})}onError(r){this.sdk&&this.sdk.on("idCheck.onError",r)}}class At{constructor(r){Q(this,"sdk",null);Q(this,"config");this.config=r}async loadSDK(){await $e("https://sdk.onfido.com/v12.0.0/onfido.min.js","onfido-sdk")}async initialize(r){if(window.Onfido||await this.loadSDK(),!window.Onfido)throw new Error("Onfido SDK failed to load");this.sdk=window.Onfido.init({token:this.config.token,containerId:r,steps:this.config.steps||[{type:"welcome",options:{title:"Identity Verification"}},{type:"document",options:{documentTypes:{passport:!0,driving_licence:!0,national_identity_card:!0}}},{type:"face",options:{requestedVariant:"standard"}},{type:"complete"}],onComplete:()=>{this.config.onComplete&&this.config.onComplete()},onError:s=>{this.config.onError&&this.config.onError(s)}})}destroy(){this.sdk&&(this.sdk.tearDown(),this.sdk=null)}}class Et{constructor(r){Q(this,"sardineContext",null);Q(this,"config");Q(this,"sessionKey");this.config=r,this.sessionKey=r.sessionKey||this.generateSessionKey()}generateSessionKey(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(r){const s=Math.random()*16|0;return(r==="x"?s:s&3|8).toString(16)})}getSardineHost(){const{environment:r,region:s}=this.config;if(r==="sandbox")return"api.sandbox.sardine.ai";switch(s){case"eu":return"api.eu.sardine.ai";case"ca":return"api.ca.sardine.ai";case"au":return"api.au.sardine.ai";default:return"api.sardine.ai"}}async loadSDK(){return new Promise((r,s)=>{if(window._Sardine){r();return}const a=this.getSardineHost(),n=document.createElement("script");n.type="text/javascript",n.async=!0,n.src=`https://${a}/assets/loader.min.js`,n.onload=()=>{console.log("[SardinAI] SDK loaded successfully"),r()},n.onerror=()=>{s(new Error("Failed to load SardinAI SDK"))};const i=document.getElementsByTagName("script")[0];i&&i.parentNode?i.parentNode.insertBefore(n,i):document.head.appendChild(n)})}async initialize(){try{if(await this.loadSDK(),!window._Sardine)throw new Error("SardinAI SDK not available after loading");const r=this.getSardineHost(),{clientId:s,environment:a,flow:n,enableBiometrics:i,enablePortScanning:o}=this.config;this.sardineContext=window._Sardine.createContext({clientId:s,sessionKey:this.sessionKey,userIdHash:void 0,flow:n||window.location.pathname,environment:a||"production",parentElement:document.body,enableBiometrics:i!==!1,enablePortScanning:o===!0,region:this.config.region,onDeviceResponse:c=>{console.log(`[SardinAI] Device ID: ${c.deviceId}`)},onConfigUpdate:(c,d,m)=>{switch(c){case"SESSION_UPDATE_FAILED":console.error("[SardinAI] Session update failed:",m);break;case"SESSION_UPDATED":console.log("[SardinAI] Session updated:",d);break;case"SESSION_NO_UPDATE":console.log("[SardinAI] No session update");break;default:console.warn("[SardinAI] Unknown event:",c)}}}),this.addNoScriptFallback(r),console.log("[SardinAI] SDK initialized with sessionKey:",this.sessionKey)}catch(r){throw console.error("[SardinAI] Initialization failed:",r),r}}addNoScriptFallback(r){const s=document.createElement("noscript"),a=document.createElement("img"),{clientId:n,flow:i}=this.config;a.src=`https://${r}/v1/a.png?clientId=${n}&sessionKey=${this.sessionKey}&flow=${i||"kyc"}&ns=1`,a.style.display="none",s.appendChild(a),document.body.appendChild(s)}updateConfig(r){if(!this.sardineContext){console.warn("[SardinAI] Cannot update config - SDK not initialized");return}r.sessionKey&&(this.sessionKey=r.sessionKey),this.sardineContext.updateConfig({...r,onConfigUpdate:(s,a,n)=>{switch(s){case"SESSION_UPDATE_FAILED":console.error("[SardinAI] Config update failed:",n);break;case"SESSION_UPDATED":console.log("[SardinAI] Config updated:",a);break;case"SESSION_NO_UPDATE":console.log("[SardinAI] No config update needed");break}}})}getSessionKey(){return this.sessionKey}destroy(){this.sardineContext&&(this.sardineContext=null)}}class Ne{static createProvider(r,s){switch(r){case ue.Sumsub:return new Ct(s);case ue.Onfido:return new At(s);case ue.SardinAI:return new Et(s);default:throw new Error(`Unsupported identity provider: ${r}`)}}static parseProviderConfig(r,s,a){var n;switch(r){case ue.Sumsub:return{accessToken:s.accessToken||s.token,applicantEmail:s.email,applicantPhone:s.phone,externalUserId:s.externalUserId,lang:s.lang||"en"};case ue.Onfido:return{token:s.token||s.sdkToken};case ue.SardinAI:const i=((n=a==null?void 0:a.identityProviders)==null?void 0:n.sardinai)||{};return{clientId:i.clientId||s.clientId,sessionKey:i.sessionKey||s.sessionKey,environment:i.environment||s.environment||"production",flow:i.flow||s.flow,region:i.region,enableBiometrics:i.enableBiometrics,enablePortScanning:i.enablePortScanning};default:throw new Error(`Unsupported identity provider: ${r}`)}}}class Rt{constructor(r){Q(this,"currentTheme",ne);Q(this,"customStyleElement",null);Q(this,"container");this.container=r||document.documentElement}applyTheme(r){this.currentTheme=this.mergeWithDefault(r),this.applyColors(this.currentTheme.colors),this.currentTheme.typography&&this.applyTypography(this.currentTheme.typography),this.currentTheme.spacing&&this.applySpacing(this.currentTheme.spacing),this.currentTheme.customCSS&&this.injectCustomCSS(this.currentTheme.customCSS),console.log("[ThemeManager] Theme applied:",this.currentTheme.name||"Custom")}applyColors(r){var a;const s={primary:r.primary,"primary-hover":r.primaryHover,"primary-light":r.primaryLight,"primary-dark":r.primaryDark,secondary:r.secondary,"secondary-hover":r.secondaryHover,success:r.success,warning:r.warning,danger:r.danger,info:r.info,background:r.background,surface:r.surface,border:r.border,"text-primary":r.textPrimary,"text-secondary":r.textSecondary,"text-muted":r.textMuted};Object.entries(s).forEach(([n,i])=>{this.container.style.setProperty(`--metakyc-${n}`,i)}),(a=this.currentTheme.darkMode)!=null&&a.colors&&this.applyDarkModeColors(this.currentTheme.darkMode.colors)}applyDarkModeColors(r){Object.entries(r).forEach(([s,a])=>{if(a){const n=`--metakyc-dark-${this.kebabCase(s)}`;this.container.style.setProperty(n,a)}})}applyTypography(r){r&&(r.fontFamily&&this.container.style.setProperty("--metakyc-font-family",r.fontFamily),r.headingFont&&this.container.style.setProperty("--metakyc-heading-font",r.headingFont),r.fontSize&&Object.entries(r.fontSize).forEach(([s,a])=>{this.container.style.setProperty(`--metakyc-font-size-${s}`,a)}),r.fontWeight&&Object.entries(r.fontWeight).forEach(([s,a])=>{this.container.style.setProperty(`--metakyc-font-weight-${s}`,a.toString())}))}applySpacing(r){r&&Object.entries(r).forEach(([s,a])=>{const n=`--metakyc-${this.kebabCase(s)}`;this.container.style.setProperty(n,a)})}injectCustomCSS(r){this.customStyleElement&&this.customStyleElement.remove(),this.customStyleElement=document.createElement("style"),this.customStyleElement.id="metakyc-custom-css",this.customStyleElement.textContent=r,document.head.appendChild(this.customStyleElement)}mergeWithDefault(r){var s;return{name:r.name||ne.name,title:r.title||ne.title,logo:{...ne.logo,...r.logo},colors:{...ne.colors,...r.colors},typography:r.typography?{...ne.typography,...r.typography}:ne.typography,spacing:r.spacing?{...ne.spacing,...r.spacing}:ne.spacing,customCSS:r.customCSS,darkMode:r.darkMode?{colors:{...(s=ne.darkMode)==null?void 0:s.colors,...r.darkMode.colors}}:ne.darkMode,applicantFormVisibleFields:r.applicantFormVisibleFields,applicantFormRequiredFields:r.applicantFormRequiredFields,allowedLanguages:r.allowedLanguages,applicantFormPages:r.applicantFormPages}}getCurrentTheme(){return this.currentTheme}resetTheme(){this.applyTheme(ne)}cleanup(){this.customStyleElement&&(this.customStyleElement.remove(),this.customStyleElement=null)}kebabCase(r){return r.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}}const Ue=l.createContext(null),dr=({config:t,children:r})=>{const[s,a]=l.useState(null),n=l.useRef(!1),i=l.useRef(!1),o=l.useMemo(()=>{const d=new nt(t),m=new it(d),v=new lt(d),w=new ot(d),x=new ct(d),h=new dt(d),g=new ut(d),k=new mt(d),f=new pt(d),p=new ht(d),R=new kt(d),N=new Rt;return{httpClient:d,applicantService:m,questionnaireService:v,uploadDocumentService:w,appropriatenessTestService:x,overviewService:h,riskScoringService:g,identityService:k,baseInformationService:f,investorCategorizationService:p,themeService:R,themeManager:N}},[t]),c=l.useMemo(()=>({config:t,...o,currentTheme:s,createOrchestrator:()=>new St(o.applicantService,o.questionnaireService,o.uploadDocumentService,o.appropriatenessTestService,o.overviewService,o.riskScoringService,o.identityService,o.investorCategorizationService)}),[t,o,s]);return l.useEffect(()=>((async()=>{if(n.current||i.current){console.log("[MetaKYC] Theme already loading or loaded, skipping...");return}n.current=!0;try{if(t.theme){console.log("[MetaKYC] Applying static theme from config"),o.themeManager.applyTheme(t.theme),a(o.themeManager.getCurrentTheme()),i.current=!0;return}console.log("[MetaKYC] Fetching theme from backend...");const m=await o.themeService.getThemeConfiguration();o.themeManager.applyTheme(m),a(o.themeManager.getCurrentTheme()),i.current=!0,console.log("[MetaKYC] Theme loaded and applied",m)}catch(m){console.warn("[MetaKYC] Failed to load theme, using default:",m),a(o.themeManager.getCurrentTheme()),i.current=!0}finally{n.current=!1}})(),()=>{o.themeManager.cleanup()}),[]),e.jsx(Ue.Provider,{value:c,children:r})};function de(){const t=l.useContext(Ue);if(!t)throw new Error("useMetaKYC must be used within a MetaKYCProvider");return t}async function It(t){return new Promise((r,s)=>{const a=new FileReader;a.readAsDataURL(t),a.onload=()=>{const i=a.result.split(",")[1];r(i)},a.onerror=n=>s(n)})}function ur(t,r){return t.size<=r}function mr(t,r){return r.split(",").map(a=>a.trim()).some(a=>{if(a.endsWith("/*")){const n=a.slice(0,-2);return t.type.startsWith(n)}return t.type===a})}function Pe(t){if(t===0)return"0 Bytes";const r=1024,s=["Bytes","KB","MB","GB"],a=Math.floor(Math.log(t)/Math.log(r));return Math.round(t/Math.pow(r,a)*100)/100+" "+s[a]}function pr(t){return t}function te(...t){return t.filter(Boolean).join(" ")}const Ee={APPLICANT_ID:"metakyc_applicant_id",WORKFLOW_STATE:"metakyc_workflow_state"};function Dt(t){try{localStorage.setItem(Ee.APPLICANT_ID,t.toString())}catch(r){console.warn("Failed to save applicant ID to storage:",r)}}function Ft(){try{const t=localStorage.getItem(Ee.APPLICANT_ID);return t?parseInt(t,10):null}catch(t){return console.warn("Failed to retrieve applicant ID from storage:",t),null}}function Pt(){try{localStorage.removeItem(Ee.APPLICANT_ID)}catch(t){console.warn("Failed to clear applicant ID from storage:",t)}}function Lt(t){try{localStorage.setItem(Ee.WORKFLOW_STATE,JSON.stringify(t))}catch(r){console.warn("Failed to save workflow state to storage:",r)}}function hr(){try{const t=localStorage.getItem(Ee.WORKFLOW_STATE);return t?JSON.parse(t):null}catch(t){return console.warn("Failed to retrieve workflow state from storage:",t),null}}function Tt(){try{localStorage.removeItem(Ee.WORKFLOW_STATE)}catch(t){console.warn("Failed to clear workflow state from storage:",t)}}function gr(){Pt(),Tt()}function Mt(t){const{createOrchestrator:r}=de(),[s,a]=l.useState(null),[n,i]=l.useState(!1),[o,c]=l.useState(null),d=l.useRef(null),m=t||Ft();l.useEffect(()=>{d.current||(d.current=r())},[r]),l.useEffect(()=>{var N;s&&m&&(Dt(m),Lt({applicantId:m,currentStepOrder:(N=s.currentStep)==null?void 0:N.order,status:s.status,lastUpdated:new Date().toISOString(),workflowKey:s.workFlowKey,nextWorkflowKey:s.nextWorkflowKey}))},[s,m]);const v=l.useRef(!1),w=l.useRef(!1),x=l.useCallback(async()=>{if(!(!m||!d.current)){if(v.current){console.log("[Workflow] Load already in progress, skipping...");return}v.current=!0,i(!0),c(null);try{const N=await d.current.initialize(m);a(N),w.current=!0}catch(N){c(N)}finally{i(!1),v.current=!1}}},[m]);l.useEffect(()=>{m&&!w.current&&x()},[m,x]);const h=l.useCallback(async()=>{if(d.current){if(v.current){console.log("[Workflow] Refresh already in progress, skipping...");return}v.current=!0,i(!0),c(null);try{const N=await d.current.refreshProgress();a(N)}catch(N){c(N)}finally{i(!1),v.current=!1}}},[]),g=l.useCallback(async()=>{if(d.current){i(!0),c(null);try{const N=await d.current.moveToNextStep();a(N)}catch(N){c(N)}finally{i(!1)}}},[]),k=l.useCallback(async()=>{if(d.current){i(!0),c(null);try{const N=await d.current.moveToPreviousStep();a(N)}catch(N){c(N)}finally{i(!1)}}},[]),f=l.useCallback(async N=>{if(d.current){i(!0),c(null);try{await d.current.submitCurrentStep(N);const b=await d.current.refreshProgress();a(b)}catch(b){throw c(b),b}finally{i(!1)}}},[]),p=Ke.useMemo(()=>s!=null&&s.stepInfoList?[...s.stepInfoList].sort((N,b)=>N.order-b.order):[],[s==null?void 0:s.stepInfoList]),R=Ke.useMemo(()=>s?s.nextWorkflowKey&&s.nextWorkflowKey!==s.workFlowKey:!1,[s]);return{progress:s,applicantId:m,currentStep:(s==null?void 0:s.currentStep)||null,steps:p,status:(s==null?void 0:s.status)||me.None,workflowResult:(s==null?void 0:s.workflowResult)||null,workflowKey:s==null?void 0:s.workFlowKey,nextWorkflowKey:s==null?void 0:s.nextWorkflowKey,hasWorkflowChanged:R,isLoading:n,error:o,isComplete:(s==null?void 0:s.status)===me.Finished,isOnHold:(s==null?void 0:s.status)===me.OnHold,refreshProgress:h,moveToNext:g,moveBack:k,submitCurrentStep:f,orchestrator:d.current}}function Ot(t){const{questionnaireService:r,applicantService:s}=de(),[a,n]=l.useState(null),[i,o]=l.useState({}),[c,d]=l.useState(!1),[m,v]=l.useState(!1),[w,x]=l.useState(null),h=l.useRef(!1),g=l.useRef(null),k=l.useCallback(async()=>{var p,R;if(t){if(h.current){console.log("[Questionnaire] Load already in progress, skipping...");return}h.current=!0,d(!0),x(null);try{const[N,b]=await Promise.all([r.getQuestionnaire(t),s.getApplicantData(t).catch(()=>null)]);if(n(N),(p=b==null?void 0:b.questionnaireResults)!=null&&p.length&&N){const _=new Map;for(const y of b.questionnaireResults)y.question&&((R=y.answers)!=null&&R.length)&&_.set(y.question.trim().toLowerCase(),y.answers);const W={},P=N.questionGroups.flatMap(y=>y.questions??[]);for(const y of P){const S=y.text.trim().toLowerCase();_.has(S)&&(W[y.id]=_.get(S))}o(W)}g.current=t}catch(N){x(N)}finally{d(!1),h.current=!1}}},[t,r,s]);l.useEffect(()=>{t&&g.current!==t&&k()},[t]);const f=l.useCallback(async p=>{v(!0),x(null);try{return await r.fillQuestionnaire(p)}catch(R){throw x(R),R}finally{v(!1)}},[r]);return{questionnaire:a,initialAnswers:i,isLoading:c,isSubmitting:m,error:w,load:k,submit:f}}function zt(t){const{uploadDocumentService:r}=de(),[s,a]=l.useState(null),[n,i]=l.useState(!1),[o,c]=l.useState(!1),[d,m]=l.useState(0),[v,w]=l.useState(null),x=l.useRef(!1),h=l.useRef(null),g=l.useCallback(async()=>{if(t){if(x.current){console.log("[UploadDocument] Load already in progress, skipping...");return}x.current=!0,i(!0),w(null);try{const f=await r.getUploadDocument(t);a(f),h.current=t}catch(f){w(f)}finally{i(!1),x.current=!1}}},[t,r]);l.useEffect(()=>{t&&h.current!==t&&g()},[t]);const k=l.useCallback(async f=>{c(!0),m(0),w(null);try{await r.fillUploadDocument(f),m(100)}catch(p){throw w(p),p}finally{c(!1)}},[r]);return{uploadDocument:s,isLoading:n,isSubmitting:o,uploadProgress:d,error:v,load:g,submit:k}}function xr(t){const{appropriatenessTestService:r}=de(),[s,a]=l.useState(null),[n,i]=l.useState(!1),[o,c]=l.useState(!1),[d,m]=l.useState(null),[v,w]=l.useState(null),x=l.useRef(!1),h=l.useRef(null),g=l.useCallback(async()=>{if(t){if(x.current){console.log("[AppropriatenessTest] Load already in progress, skipping...");return}x.current=!0,i(!0),m(null);try{const f=await r.getAppropriatenessTest(t);a(f),h.current=t}catch(f){m(f)}finally{i(!1),x.current=!1}}},[t,r]);l.useEffect(()=>{t&&h.current!==t&&g()},[t]);const k=l.useCallback(async f=>{c(!0),m(null);try{const p=await r.fillAppropriatenessTest(f);return w(p),p}catch(p){throw m(p),p}finally{c(!1)}},[r]);return{test:s,result:v,isLoading:n,isSubmitting:o,error:d,load:g,submit:k}}function Bt(t){const{overviewService:r}=de(),[s,a]=l.useState(null),[n,i]=l.useState(!1),[o,c]=l.useState(!1),[d,m]=l.useState(null),v=l.useRef(!1),w=l.useRef(null),x=l.useCallback(async()=>{if(t){if(v.current){console.log("[Overview] Load already in progress, skipping...");return}v.current=!0,i(!0),m(null);try{const g=await r.getOverviewData(t);a(g),w.current=t}catch(g){m(g)}finally{i(!1),v.current=!1}}},[t,r]);l.useEffect(()=>{t&&w.current!==t&&x()},[t]);const h=l.useCallback(async()=>{if(t){c(!0),m(null);try{await r.passOverview(t)}catch(g){throw m(g),g}finally{c(!1)}}},[t,r]);return{overview:s,isLoading:n,isSubmitting:o,error:d,load:x,passOverview:h}}function $t(t){const{identityService:r}=de(),[s,a]=l.useState(null),[n,i]=l.useState(!1),[o,c]=l.useState(null),d=l.useRef(!1),m=l.useCallback(async(x,h)=>{if(t){if(d.current){console.log("[Identity] Request already in progress, skipping...");return}d.current=!0,i(!0),c(null);try{const g={applicantId:t,restart:!1,redirectUrl:x||"",ttl:h||604800};console.log("Identity request input:",g);const k=await r.identityRequest(g);return console.log("Identity request result:",k),a(k),k}catch(g){throw c(g),g}finally{i(!1),d.current=!1}}},[t,r]),v=l.useCallback(async(x,h)=>{if(t){i(!0),c(null);try{const g={applicantId:t,restart:!1,redirectUrl:x,ttl:h},k=await r.identityCompanyRequest(g);return a(k),k}catch(g){throw c(g),g}finally{i(!1)}}},[t,r]),w=l.useCallback(async()=>{if(t){if(d.current){console.log("[Identity] Restart already in progress, skipping...");return}d.current=!0,i(!0),c(null);try{const x={applicantId:t,restart:!0,redirectUrl:"",ttl:604800};console.log("Restarting identity with input:",x);const h=await r.identityRequest(x);return console.log("Restart identity result:",h),a(h),h}catch(x){throw c(x),x}finally{i(!1),d.current=!1}}},[t,r]);return{identityData:s,provider:(s==null?void 0:s.provider)||null,token:(s==null?void 0:s.publicProviderTokenObject)||null,isLoading:n,error:o,requestIdentity:m,requestCompanyIdentity:v,restartIdentity:w}}function Ut(t){const{riskScoringService:r,applicantService:s}=de(),[a,n]=l.useState(null),[i,o]=l.useState({}),[c,d]=l.useState(!1),[m,v]=l.useState(!1),[w,x]=l.useState(null),[h,g]=l.useState(null),k=l.useRef(!1),f=l.useRef(null),p=l.useCallback(async()=>{var N;if(t){if(k.current){console.log("[RiskScoring] Load already in progress, skipping...");return}k.current=!0,d(!0),x(null);try{const[b,_]=await Promise.all([r.getRiskCriterias(t),s.getApplicantData(t).catch(()=>null)]);if(n(b),(N=_==null?void 0:_.riskScoringResults)!=null&&N.length){const W=_.riskScoringResults[0],P={};for(const y of W.riskCriteriaResults??[])if(y.riskCriteriaId!=null&&y.answer!=null&&y.answer!==""){const S=[...new Set(y.answer.split(",").map(I=>I.trim()).filter(I=>I!==""))];S.length>0&&(P[y.riskCriteriaId]=S)}o(P)}f.current=t}catch(b){x(b)}finally{d(!1),k.current=!1}}},[t,r,s]);l.useEffect(()=>{t&&f.current!==t&&p()},[t]);const R=l.useCallback(async N=>{v(!0),x(null);try{const b=await r.submitRiskScoring(N);return g(b),b}catch(b){throw x(b),b}finally{v(!1)}},[r]);return{criteria:a,initialAnswers:i,result:h,isLoading:c,isSubmitting:m,error:w,load:p,submit:R}}function _t(){const{applicantService:t,config:r}=de(),[s,a]=l.useState(!1),[n,i]=l.useState(null),o=l.useRef(!1),c=l.useRef(!1),d=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(h){const g=Math.random()*16|0;return(h==="x"?g:g&3|8).toString(16)}),m=l.useCallback(async h=>{var g;if(o.current)throw console.log("[Applicant] Create already in progress, skipping..."),new Error("Creation already in progress");o.current=!0,a(!0),i(null);try{if(h.applicantAdditionalDatas||(h.applicantAdditionalDatas=[]),(g=r.identityProviders)!=null&&g.sardinai){const f=d();console.log("[SardinAI] Generated session key:",f),h.applicantAdditionalDatas.push({paramName:"sessionKey",value:f})}return await t.createApplicant(h)}catch(k){throw i(k),k}finally{a(!1),o.current=!1}},[t,r]),v=l.useCallback(async h=>{a(!0),i(null);try{return await t.createCompanyApplicant(h)}catch(g){throw i(g),g}finally{a(!1)}},[t]),w=l.useCallback(async h=>{if(c.current)throw console.log("[Applicant] Data load already in progress, skipping..."),new Error("Data load already in progress");c.current=!0,a(!0),i(null);try{return await t.getApplicantData(h)}catch(g){throw i(g),g}finally{a(!1),c.current=!1}},[t]),x=l.useCallback(async h=>{a(!0),i(null);try{await t.stopProgress(h)}catch(g){throw i(g),g}finally{a(!1)}},[t]);return{isLoading:s,error:n,createApplicant:m,createCompanyApplicant:v,getApplicantData:w,stopProgress:x}}const B=({children:t,variant:r="primary",size:s="md",isLoading:a=!1,disabled:n,className:i,...o})=>{const c="inline-flex items-center justify-center rounded-lg font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed",d={primary:"bg-primary-500 text-white hover:bg-primary-600 focus:ring-primary-500",secondary:"bg-gray-200 text-gray-900 hover:bg-gray-300 focus:ring-gray-400",outline:"border-2 border-primary-500 text-primary-500 hover:bg-primary-50 focus:ring-primary-500",danger:"bg-danger-500 text-white hover:bg-danger-600 focus:ring-danger-500",ghost:"text-gray-700 hover:bg-gray-100 focus:ring-gray-400"},m={sm:"px-3 py-1.5 text-sm",md:"px-4 py-2 text-base",lg:"px-6 py-3 text-lg"};return e.jsxs("button",{className:te(c,d[r],m[s],i),disabled:n||a,...o,children:[a&&e.jsxs("svg",{className:"animate-spin -ml-1 mr-2 h-4 w-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),t]})},ie=l.forwardRef(({label:t,error:r,helperText:s,leftIcon:a,rightIcon:n,className:i,...o},c)=>e.jsxs("div",{className:"w-full",children:[t&&e.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:[t,o.required&&e.jsx("span",{className:"text-danger-500 ml-1",children:"*"})]}),e.jsxs("div",{className:"relative",children:[a&&e.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:a}),e.jsx("input",{ref:c,className:te("block w-full rounded-lg border px-3 py-2 text-sm transition-colors","focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent","disabled:bg-gray-100 disabled:cursor-not-allowed",r?"border-danger-500 focus:ring-danger-500":"border-gray-300 dark:border-gray-600","dark:bg-gray-800 dark:text-white",a?"pl-10":"",n?"pr-10":"",i),...o}),n&&e.jsx("div",{className:"absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none",children:n})]}),r&&e.jsx("p",{className:"mt-1 text-sm text-danger-500",children:r}),!r&&s&&e.jsx("p",{className:"mt-1 text-sm text-gray-500",children:s})]}));ie.displayName="Input";const T=({children:t,className:r,...s})=>e.jsx("div",{className:te("metakyc-card rounded-xl shadow-sm border",r),style:{backgroundColor:"var(--metakyc-surface, #ffffff)",borderColor:"var(--metakyc-border, #e5e7eb)"},...s,children:t}),se=({children:t,className:r,...s})=>e.jsx("div",{className:te("px-6 py-4 border-b",r),style:{borderColor:"var(--metakyc-border, #e5e7eb)"},...s,children:t}),M=({children:t,className:r,...s})=>e.jsx("div",{className:te("px-6 py-4",r),...s,children:t}),le=({children:t,className:r,...s})=>e.jsx("div",{className:te("px-6 py-4 border-t",r),style:{borderColor:"var(--metakyc-border, #e5e7eb)"},...s,children:t}),ye=({children:t,variant:r="default",className:s,...a})=>{const n={default:"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300",success:"bg-success-100 text-success-800 dark:bg-success-900 dark:text-success-300",danger:"bg-danger-100 text-danger-800 dark:bg-danger-900 dark:text-danger-300",warning:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-300",info:"bg-primary-100 text-primary-800 dark:bg-primary-900 dark:text-primary-300"};return e.jsx("span",{className:te("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium",n[r],s),...a,children:t})},pe=({size:t="md",className:r,...s})=>{const a={sm:"h-4 w-4",md:"h-8 w-8",lg:"h-12 w-12"};return e.jsx("div",{className:te("flex items-center justify-center",r),...s,children:e.jsxs("svg",{className:te("animate-spin text-primary-500",a[t]),xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})})},be=l.forwardRef(({label:t,error:r,helperText:s,options:a,placeholder:n,className:i,style:o,...c},d)=>e.jsxs("div",{className:"w-full",children:[t&&e.jsxs("label",{className:"block text-sm font-medium mb-1",style:{color:"var(--metakyc-text-primary, #374151)"},children:[t,c.required&&e.jsx("span",{className:"text-danger-500 ml-1",children:"*"})]}),e.jsxs("select",{ref:d,className:te("block w-full rounded-lg border px-3 py-2 text-sm transition-colors","focus:outline-none focus:ring-2 focus:ring-offset-0","disabled:opacity-60 disabled:cursor-not-allowed",r?"border-danger-500":"",i),style:{backgroundColor:"var(--metakyc-input-bg, #ffffff)",color:"var(--metakyc-text-primary, #111827)",borderColor:r?"var(--metakyc-error, #ef4444)":"var(--metakyc-border, #d1d5db)",...o},...c,children:[n&&e.jsx("option",{value:"",disabled:!0,style:{backgroundColor:"var(--metakyc-input-bg, #ffffff)",color:"var(--metakyc-text-secondary, #6b7280)"},children:n},"__placeholder__"),a.map((m,v)=>e.jsx("option",{value:m.value,disabled:m.disabled,style:{backgroundColor:"var(--metakyc-input-bg, #ffffff)",color:m.disabled?"var(--metakyc-text-secondary, #9ca3af)":"var(--metakyc-text-primary, #111827)"},children:m.label},m.value||`option-${v}`))]}),r&&e.jsx("p",{className:"mt-1 text-sm",style:{color:"var(--metakyc-error, #ef4444)"},children:r}),!r&&s&&e.jsx("p",{className:"mt-1 text-sm",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:s})]}));be.displayName="Select";const Kt=({label:t,value:r,onChange:s,options:a,placeholder:n="Select...",disabled:i=!1,required:o=!1})=>{const[c,d]=l.useState(!1),[m,v]=l.useState(""),w=l.useRef(null);l.useEffect(()=>{const f=p=>{w.current&&!w.current.contains(p.target)&&(d(!1),v(""))};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[]);const x=a.filter(f=>f.label.toLowerCase().includes(m.toLowerCase())),h=f=>{i||(r.includes(f)?s(r.filter(p=>p!==f)):s([...r,f]))},g=(f,p)=>{p.stopPropagation(),i||s(r.filter(R=>R!==f))},k=f=>{var p;return((p=a.find(R=>R.value===f))==null?void 0:p.label)||f};return e.jsxs("div",{className:"w-full metakyc-multiselect",ref:w,children:[t&&e.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:[t,o&&e.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{onClick:()=>!i&&d(!c),className:te("metakyc-multiselect-trigger","min-h-[42px] w-full px-3 py-2 rounded-lg border text-sm transition-colors","bg-white dark:bg-gray-800","border-gray-300 dark:border-gray-600",c&&"ring-2 ring-blue-500 border-transparent",i?"opacity-50 cursor-not-allowed":"cursor-pointer"),children:[r.length===0?e.jsx("span",{className:"metakyc-multiselect-placeholder text-gray-400 dark:text-gray-500 leading-6",children:n}):e.jsx("div",{className:"flex flex-wrap gap-1 pr-6",children:r.map(f=>e.jsxs("span",{className:"metakyc-multiselect-chip inline-flex items-center gap-1 px-2 py-0.5 rounded bg-blue-100 dark:bg-blue-900/40 text-blue-800 dark:text-blue-300 text-xs font-medium",children:[k(f),!i&&e.jsx("button",{type:"button",onClick:p=>g(f,p),className:"metakyc-multiselect-chip-remove",style:{background:"transparent",border:"none",padding:"0 0 0 2px",margin:0,cursor:"pointer",fontSize:"14px",lineHeight:1,fontWeight:"bold",display:"inline-flex",alignItems:"center",boxShadow:"none",transform:"none",minWidth:0,width:"auto",height:"auto",letterSpacing:"normal",textTransform:"none"},children:"×"})]},f))}),e.jsx("span",{className:"metakyc-multiselect-arrow absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none text-xs",children:c?"▲":"▼"})]}),c&&e.jsxs("div",{className:"metakyc-multiselect-dropdown absolute z-50 w-full mt-1 rounded-lg shadow-lg",style:{background:"inherit",border:"1px solid #d1d5db"},children:[e.jsx("div",{className:"metakyc-multiselect-search-wrapper p-2",style:{borderBottom:"1px solid #e5e7eb"},children:e.jsx("input",{type:"text",value:m,onChange:f=>v(f.target.value),placeholder:"Search...",autoFocus:!0,onClick:f=>f.stopPropagation(),className:"metakyc-multiselect-search w-full px-2 py-1.5 text-sm rounded focus:outline-none focus:ring-1 focus:ring-blue-500",style:{border:"1px solid #d1d5db"}})}),e.jsx("ul",{className:"max-h-48 overflow-y-auto py-1",children:x.length===0?e.jsx("li",{className:"px-3 py-2 text-sm text-gray-500 dark:text-gray-400",children:"No results"}):x.map(f=>e.jsxs("li",{onClick:()=>h(f.value),className:te("metakyc-multiselect-option","flex items-center gap-2 px-3 py-2 text-sm cursor-pointer","hover:bg-gray-50 dark:hover:bg-gray-700",r.includes(f.value)&&"metakyc-multiselect-option-selected bg-blue-50 dark:bg-blue-900/20"),children:[e.jsx("input",{type:"checkbox",checked:r.includes(f.value),readOnly:!0,className:"rounded border-gray-300 text-blue-600 pointer-events-none"}),e.jsx("span",{className:"text-gray-900 dark:text-gray-100",children:f.label})]},f.value))}),r.length>0&&e.jsx("div",{className:"metakyc-multiselect-clear p-2 border-t border-gray-100 dark:border-gray-700",children:e.jsxs("button",{type:"button",onClick:()=>{s([]),v("")},className:"text-xs text-red-500 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300",children:["Clear all (",r.length," selected)"]})})]})]})]})},qt=({label:t,error:r,accept:s,multiple:a=!1,maxSize:n,onChange:i,value:o=[],className:c})=>{const[d,m]=l.useState(!1),v=l.useRef(null),w=p=>{if(!p)return;const R=Array.from(p);if(n&&R.filter(b=>b.size>n).length>0){const b=Pe(n);alert(`Some files exceed the maximum size of ${b}`);return}i==null||i(a?[...o,...R]:[R[0]])},x=p=>{p.preventDefault(),m(!0)},h=()=>{m(!1)},g=p=>{p.preventDefault(),m(!1),w(p.dataTransfer.files)},k=()=>{var p;(p=v.current)==null||p.click()},f=p=>{const R=o.filter((N,b)=>b!==p);i==null||i(R)};return e.jsxs("div",{className:te("w-full",c),children:[t&&e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:t}),e.jsxs("div",{className:te("border-2 border-dashed rounded-lg p-6 text-center cursor-pointer transition-colors",d?"border-primary-500 bg-primary-50 dark:bg-primary-900/20":"border-gray-300 dark:border-gray-600 hover:border-primary-500",r&&"border-danger-500"),onDragOver:x,onDragLeave:h,onDrop:g,onClick:k,children:[e.jsx("input",{ref:v,type:"file",className:"hidden",accept:s,multiple:a,onChange:p=>w(p.target.files)}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("svg",{className:"mx-auto h-12 w-12 text-gray-400",stroke:"currentColor",fill:"none",viewBox:"0 0 48 48",children:e.jsx("path",{d:"M28 8H12a4 4 0 00-4 4v20m32-12v8m0 0v8a4 4 0 01-4 4H12a4 4 0 01-4-4v-4m32-4l-3.172-3.172a4 4 0 00-5.656 0L28 28M8 32l9.172-9.172a4 4 0 015.656 0L28 28m0 0l4 4m4-24h8m-4-4v8m-12 4h.02",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}),e.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:[e.jsx("span",{className:"font-medium text-primary-500",children:"Click to upload"})," or drag and drop"]}),n&&e.jsxs("p",{className:"text-xs text-gray-500",children:["Maximum file size: ",Pe(n)]})]})]}),o.length>0&&e.jsx("div",{className:"mt-3 space-y-2",children:o.map((p,R)=>e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[e.jsxs("div",{className:"flex items-center space-x-2 flex-1 min-w-0",children:[e.jsx("svg",{className:"h-5 w-5 text-gray-400 flex-shrink-0",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M4 4a2 2 0 012-2h4.586A2 2 0 0112 2.586L15.414 6A2 2 0 0116 7.414V16a2 2 0 01-2 2H6a2 2 0 01-2-2V4z",clipRule:"evenodd"})}),e.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300 truncate",children:p.name}),e.jsxs("span",{className:"text-xs text-gray-500",children:["(",Pe(p.size),")"]})]}),e.jsx("button",{type:"button",onClick:N=>{N.stopPropagation(),f(R)},className:"ml-2 text-danger-500 hover:text-danger-700 focus:outline-none",children:e.jsx("svg",{className:"h-5 w-5",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]},R))}),r&&e.jsx("p",{className:"mt-1 text-sm text-danger-500",children:r})]})},Ht=l.forwardRef(({countryCode:t="+1",onCountryCodeChange:r,className:s,...a},n)=>e.jsxs("div",{className:"w-full",children:[a.label&&e.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:[a.label,a.required&&e.jsx("span",{className:"text-danger-500 ml-1",children:"*"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:t,onChange:i=>r==null?void 0:r(i.target.value),className:te("w-20 rounded-lg border px-3 py-2 text-sm","focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent","border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-white"),placeholder:"+1"}),e.jsx(ie,{ref:n,type:"tel",className:te("flex-1",s),...a,label:""})]}),a.error&&e.jsx("p",{className:"mt-1 text-sm text-danger-500",children:a.error})]}));Ht.displayName="PhoneInput";/**
2
2
  * @license lucide-react v0.574.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.