@vpdev2/metakyc 1.0.19 → 1.0.21

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.
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var Vr=Object.defineProperty;var Qr=(t,r,a)=>r in t?Vr(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a;var pe=(t,r,a)=>Qr(t,typeof r!="symbol"?r+"":r,a);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Gr=require("axios"),i=require("react"),e=require("react/jsx-runtime"),pt=require("react-dom"),Ye=require("react-hook-form"),Ue=require("zod");function Jr(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const s=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(r,a,s.get?s:{enumerable:!0,get:()=>t[a]})}}return r.default=t,Object.freeze(r)}const St=Jr(i);var ie=(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))(ie||{}),ot=(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))(ot||{}),Te=(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))(Te||{}),Pt=(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))(Pt||{}),Lt=(t=>(t[t.LowRisk=0]="LowRisk",t[t.MediumRisk=1]="MediumRisk",t[t.HighRisk=2]="HighRisk",t[t.Alert=3]="Alert",t))(Lt||{}),Ve=(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))(Ve||{}),Qe=(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))(Qe||{}),Dt=(t=>(t[t.ProviderResultPending=0]="ProviderResultPending",t[t.ProviderResultReceived=1]="ProviderResultReceived",t[t.Canceled=2]="Canceled",t[t.ExtendedToNewApplicant=3]="ExtendedToNewApplicant",t))(Dt||{}),Mt=(t=>(t[t.None=0]="None",t[t.ProviderResultPending=1]="ProviderResultPending",t[t.ProviderResultReceived=2]="ProviderResultReceived",t[t.Canceled=3]="Canceled",t))(Mt||{}),Ae=(t=>(t[t.Onfido=0]="Onfido",t[t.Sumsub=2]="Sumsub",t[t.SardinAI=3]="SardinAI",t))(Ae||{}),zt=(t=>(t[t.Individual=0]="Individual",t[t.Company=1]="Company",t))(zt||{}),lt=(t=>(t[t.Male=0]="Male",t[t.Female=1]="Female",t[t.Other=2]="Other",t))(lt||{}),Ot=(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))(Ot||{}),$t=(t=>(t[t.Pending=0]="Pending",t[t.Approved=1]="Approved",t[t.Rejected=2]="Rejected",t[t.RequiresRevision=3]="RequiresRevision",t))($t||{}),Bt=(t=>(t[t.SingleChoice=0]="SingleChoice",t[t.MultipleChoice=1]="MultipleChoice",t[t.Text=2]="Text",t))(Bt||{}),Me=(t=>(t[t.String=0]="String",t[t.Integer=1]="Integer",t[t.Money=2]="Money",t[t.Boolean=3]="Boolean",t[t.Date=4]="Date",t[t.Country=5]="Country",t[t.DigitOnly=6]="DigitOnly",t))(Me||{}),_t=(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))(_t||{}),Ht=(t=>(t[t.None=0]="None",t[t.Country=1]="Country",t))(Ht||{}),we=(t=>(t[t.Individual=0]="Individual",t[t.Sophisticated=1]="Sophisticated",t[t.HighNetWorth=2]="HighNetWorth",t[t.Business=3]="Business",t))(we||{}),Wt=(t=>(t[t.Retail=0]="Retail",t[t.Professional=1]="Professional",t[t.EligibleCounterparty=2]="EligibleCounterparty",t))(Wt||{});const We={Nationality:10,Address:20,CountryOfBirth:30,PhoneNumber:40,UboAddress:50},Ge={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:"select",countriesType:We.PhoneNumber},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",countriesType:We.Address},nationality:{label:"Nationality",type:"select",countriesType:We.Nationality},otherNationality:{label:"Other Nationalities",type:"multiselect",countriesType:We.Nationality},countryOfBirth:{label:"Country of Birth",type:"select",countriesType:We.CountryOfBirth},placeOfBirth:{label:"Place of Birth",type:"text"},taxCountry:{label:"Tax Country",type:"select",countriesType:We.Address},taxNumber:{label:"Tax Number",type:"text"},defaultLanguage:{label:"Default Language",type:"select"},educationLevel:{label:"Education Level",type:"text"},occupation:{label:"Occupation",type:"text"}},Ze={companyName:{label:"Company Name",type:"text"},email:{label:"Email",type:"email"},phone:{label:"Phone",type:"tel"},registrationNumber:{label:"Registration Number",type:"text"},countryResidence:{label:"Country of Residence",type:"select",countriesType:We.Address},legalAddress:{label:"Legal Address",type:"text"},incorporatedOn:{label:"Incorporation Date",type:"date"},controlScheme:{label:"Control Scheme",type:"text"},taxId:{label:"Tax ID",type:"text"},registrationLocation:{label:"Registration Location",type:"text"},website:{label:"Website",type:"text"},postalAddress:{label:"Postal Address",type:"text"},street:{label:"Street",type:"text"},streetNumber:{label:"Street Number",type:"text"},city:{label:"City",type:"text"},state:{label:"State / Province",type:"text"},postalCode:{label:"Postal Code",type:"text"},addressCountry:{label:"Address Country",type:"select",countriesType:We.Address},lei:{label:"LEI",type:"text"}},Ut=["companyName","email","phone","registrationNumber"],Kt=["firstName","lastName","email","phonenumber","dateOfBirth"],ht=[{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 Se=(t=>(t.Default="default",t.Corporate="corporate",t.Fintech="fintech",t.Healthcare="healthcare",t.Modern="modern",t.Minimal="minimal",t))(Se||{});const qt={timeout:3e4,retries:3,locale:"en",endpoints:{pattern:"host-controller"}};class Yt{constructor(r){this.config=r}build(r,a){const s=`${r}.${a}`;if(this.config.customPaths&&this.config.customPaths[s])return this.config.customPaths[s];switch(this.config.pattern){case"host-controller":return`/api/${r}/${a}`;case"application-service":return`/services/app/${this.getServiceName(r)}/${a}`;case"custom":throw new Error(`Custom endpoint path not found for ${s}. 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 De extends Error{constructor(a,s,n,l,c){super(a);pe(this,"response");this.code=s,this.details=n,this.validationErrors=l,this.name="MetaKYCError",this.response=c,Object.setPrototypeOf(this,De.prototype)}}class at{static handleApiError(r){return new De(r.message||"An unknown error occurred",r.code,r.details||void 0,r.validationErrors||void 0)}static handleAxiosError(r){if(r.response){const a=r.response.data;return a&&a.error?new De(a.error.message||"An unknown error occurred",a.error.code,a.error.details||void 0,a.error.validationErrors||void 0,r.response):a&&a.result&&a.result.message?new De(a.result.message,r.response.status,`HTTP ${r.response.status}: ${r.response.statusText}`,void 0,r.response):new De((a==null?void 0:a.message)||r.message||"Request failed",r.response.status,`HTTP ${r.response.status}: ${r.response.statusText}`,void 0,r.response)}else return r.request?new De("No response from server",0,"The request was made but no response was received. Please check your network connection."):new De(r.message||"An unexpected error occurred",0,r.toString())}static isMetaKYCError(r){return r instanceof De}}class Vt{constructor(r){pe(this,"axiosInstance");pe(this,"endpointBuilder");pe(this,"config");this.config={...qt,...r},this.endpointBuilder=new Yt(this.config.endpoints),this.axiosInstance=Gr.create({baseURL:this.config.baseUrl,timeout:this.config.timeout,headers:{"Content-Type":"application/json"}}),this.axiosInstance.interceptors.request.use(a=>{if(a.headers["Abp-TenantId"]=this.config.tenantId.toString(),this.config.getAccessToken){const s=this.config.getAccessToken();s&&(a.headers.Authorization=`Bearer ${s}`)}else this.config.apiKey&&(a.headers.ApiKey=this.config.apiKey,a.headers["X-API-KEY"]=this.config.apiKey);return this.config.locale&&(a.headers["Accept-Language"]=this.config.locale),a},a=>Promise.reject(a)),this.axiosInstance.interceptors.response.use(a=>a,async a=>{var n;const s=a.config;return((n=a.response)==null?void 0:n.status)>=500&&!s._retry&&(s._retry=!0,s._retryCount=(s._retryCount||0)+1,s._retryCount<(this.config.retries||3))?(await new Promise(l=>setTimeout(l,1e3*s._retryCount)),this.axiosInstance(s)):Promise.reject(a)})}buildEndpoint(r,a){return this.endpointBuilder.build(r,a)}async get(r,a,s){try{const n=this.buildEndpoint(r,a),l=await this.axiosInstance.get(n,{params:s});return this.handleResponse(l)}catch(n){throw at.handleAxiosError(n)}}async post(r,a,s){try{const n=this.buildEndpoint(r,a),l=await this.axiosInstance.post(n,s);return this.handleResponse(l)}catch(n){throw at.handleAxiosError(n)}}async put(r,a,s){try{const n=this.buildEndpoint(r,a),l=await this.axiosInstance.put(n,s);return this.handleResponse(l)}catch(n){throw at.handleAxiosError(n)}}async delete(r,a,s){try{const n=this.buildEndpoint(r,a),l=await this.axiosInstance.delete(n,{params:s});return this.handleResponse(l)}catch(n){throw at.handleAxiosError(n)}}handleResponse(r){const a=r.data;if(!a.success&&a.error)throw at.handleApiError(a.error);return a}getAxiosInstance(){return this.axiosInstance}}class Qt{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,a){await this.httpClient.post("Applicant","SetApplicantLng",{applicantId:r,language:a})}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 Gt{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 Jt{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 Xt{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 Zt{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 er{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 tr{constructor(r){this.httpClient=r}async identityRequest(r){console.log("[IdentityService] Calling IdentityRequest with input:",r);const a=await this.httpClient.post("Applicant","IdentityRequest",r);return console.log("[IdentityService] IdentityRequest response:",a),a.result}async identityCompanyRequest(r){return(await this.httpClient.post("Applicant","IdentityCompanyRequest",r)).result}async restartIdentityRequest(r){const a={applicantId:r,restart:!0,redirectUrl:"",ttl:604800};return console.log("[IdentityService] Restarting identity with restart=true:",a),this.identityRequest(a)}async restartIdentityCompanyRequest(r){const a={applicantId:r,restart:!0,redirectUrl:"",ttl:604800};return this.identityCompanyRequest(a)}async refreshSumsubToken(r){console.log("[IdentityService] Refreshing Sumsub token for applicant:",r);const a=await this.httpClient.post("Applicant","RefreshSumsubToken",{applicantId:r});return console.log("[IdentityService] Sumsub token refresh result:",a),a.result.accessToken}}class rr{constructor(r){this.httpClient=r}async getCountries(r,a,s){return(await this.httpClient.get("BaseInformation","GetAllCountries",{filter:r||"",lng:a||"en",type:s})).result}async getBranches(){return(await this.httpClient.get("BaseInformation","GetBranches")).result}async getLegalEntities(){return(await this.httpClient.get("BaseInformation","GetLegalEntities")).result}}class ar{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 je={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"}}},sr={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"}},nr={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"}},ir={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"}}},or={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"}},lr={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"}},cr={[Se.Default]:je,[Se.Corporate]:sr,[Se.Fintech]:nr,[Se.Healthcare]:ir,[Se.Modern]:or,[Se.Minimal]:lr};function st(t){return cr[t]||je}class dr{constructor(r){this.httpClient=r}async getThemeConfiguration(){var r;try{const a=await this.httpClient.get("Tenant","GetThemeConfiguration");if(!a.result.isEnabled)return st(Se.Default);let s=a.result.preset?st(a.result.preset):st(Se.Default);if(a.result.title&&(s.title=a.result.title),a.result.logo&&(s.logo={...s.logo,...a.result.logo}),a.result.colors&&(s.colors={...s.colors,...a.result.colors}),a.result.typography&&(s.typography={...s.typography,...a.result.typography}),a.result.spacing&&(s.spacing={...s.spacing,...a.result.spacing}),a.result.customCSS&&(s.customCSS=a.result.customCSS),a.result.darkMode&&(s.darkMode={colors:{...(r=s.darkMode)==null?void 0:r.colors,...a.result.darkMode.colors}}),a.result.applicantFormVisibleFields&&a.result.applicantFormVisibleFields.length>0&&(s.applicantFormVisibleFields=a.result.applicantFormVisibleFields),a.result.applicantFormRequiredFields&&a.result.applicantFormRequiredFields.length>0&&(s.applicantFormRequiredFields=a.result.applicantFormRequiredFields),a.result.allowedLanguages&&a.result.allowedLanguages.length>0&&(s.allowedLanguages=a.result.allowedLanguages),a.result.applicantFormPages)try{const n=typeof a.result.applicantFormPages=="string"?JSON.parse(a.result.applicantFormPages):a.result.applicantFormPages;Array.isArray(n)&&n.length>0&&(s.applicantFormPages=n.map(l=>{const c=!l._v||l._v<4;return{...l,fields:(l.fields||[]).map(d=>({...d,colSpan:c?d.colSpan===1?2:4:Math.min(4,Math.max(1,d.colSpan??4))}))}}))}catch{}if(a.result.reviewPageFields)try{const n=typeof a.result.reviewPageFields=="string"?JSON.parse(a.result.reviewPageFields):a.result.reviewPageFields;Array.isArray(n)&&n.length>0&&(s.reviewPageFields=n)}catch{}if(a.result.reviewPageDisabled&&(s.reviewPageDisabled=!0),a.result.fieldLabelMode==="placeholder"&&(s.fieldLabelMode="placeholder"),a.result.companyFormVisibleFields&&a.result.companyFormVisibleFields.length>0&&(s.companyFormVisibleFields=a.result.companyFormVisibleFields),a.result.companyFormRequiredFields&&a.result.companyFormRequiredFields.length>0&&(s.companyFormRequiredFields=a.result.companyFormRequiredFields),a.result.companyFormPages)try{const n=typeof a.result.companyFormPages=="string"?JSON.parse(a.result.companyFormPages):a.result.companyFormPages;Array.isArray(n)&&n.length>0&&(s.companyFormPages=n.map(l=>{const c=!l._v||l._v<4;return{...l,fields:(l.fields||[]).map(d=>({...d,colSpan:c?d.colSpan===1?2:4:Math.min(4,Math.max(1,d.colSpan??4))}))}}))}catch{}if(a.result.companyReviewPageFields)try{const n=typeof a.result.companyReviewPageFields=="string"?JSON.parse(a.result.companyReviewPageFields):a.result.companyReviewPageFields;Array.isArray(n)&&n.length>0&&(s.companyReviewPageFields=n)}catch{}return s}catch(a){return console.warn("[ThemeService] Failed to fetch theme configuration:",a),st(Se.Default)}}async saveThemeConfiguration(r){await this.httpClient.post("Tenant","SaveThemeConfiguration",r)}getAvailablePresets(){return[{id:Se.Default,name:"Default"},{id:Se.Corporate,name:"Corporate"},{id:Se.Fintech,name:"Fintech"},{id:Se.Healthcare,name:"Healthcare"},{id:Se.Modern,name:"Modern"},{id:Se.Minimal,name:"Minimal"}]}getPreviewTheme(r,a){const s=st(r);return a?{...s,...a,logo:{...s.logo,...a.logo},colors:{...s.colors,...a.colors},typography:a.typography?{...s.typography,...a.typography}:s.typography,spacing:a.spacing?{...s.spacing,...a.spacing}:s.spacing}:s}}class mr{constructor(){pe(this,"listeners",new Map)}on(r,a){return this.listeners.has(r)||this.listeners.set(r,new Set),this.listeners.get(r).add(a),()=>{this.off(r,a)}}off(r,a){const s=this.listeners.get(r);s&&s.delete(a)}emit(r,a){const s=this.listeners.get(r);s&&s.forEach(n=>{try{n(a)}catch(l){console.error(`Error in event listener for "${r}":`,l)}})}clear(){this.listeners.clear()}clearEvent(r){this.listeners.delete(r)}}class pr{constructor(){pe(this,"events",new mr);pe(this,"_applicantId",null);pe(this,"_progress",null);pe(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)||Te.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===Te.Finished}get isOnHold(){return this.status===Te.OnHold}get isInProgress(){return this.status===Te.InProgress}setApplicantId(r){this._applicantId=r}updateProgress(r){var s,n;const a=(s=this._progress)==null?void 0:s.currentStep;this._progress=r,this._applicantId=r.applicantId,this._error=null,this.events.emit("progressUpdated",r),(a==null?void 0:a.order)!==((n=r.currentStep)==null?void 0:n.order)&&this.events.emit("stepChanged",r.currentStep),this.events.emit("statusChanged",r.status),r.status===Te.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 ur{constructor(){pe(this,"handlers",new Map)}registerHandler(r,a){this.handlers.set(r,a)}getHandler(r){return this.handlers.get(r)}hasHandler(r){return this.handlers.has(r)}async loadStepData(r,a){const s=this.getHandler(r);if(!s)throw new Error(`No handler registered for step action: ${ie[r]}`);return s.loadData(a)}async submitStepData(r,a){const s=this.getHandler(r);if(!s)throw new Error(`No handler registered for step action: ${ie[r]}`);return s.submitData(a)}}class yr{constructor(r,a,s,n,l,c,d,y){pe(this,"state");pe(this,"stepRouter");this.applicantService=r,this.questionnaireService=a,this.uploadDocumentService=s,this.appropriatenessTestService=n,this.overviewService=l,this.riskScoringService=c,this.investorCategorizationService=y,this.state=new pr,this.stepRouter=new ur,this.registerStepHandlers()}registerStepHandlers(){this.stepRouter.registerHandler(ie.Questionaries,{loadData:r=>this.questionnaireService.getQuestionnaire(r),submitData:async r=>{await this.questionnaireService.fillQuestionnaire(r)}}),this.stepRouter.registerHandler(ie.UploadDocument,{loadData:r=>this.uploadDocumentService.getUploadDocument(r),submitData:r=>this.uploadDocumentService.fillUploadDocument(r)}),this.stepRouter.registerHandler(ie.AppropriatenessTest,{loadData:r=>this.appropriatenessTestService.getAppropriatenessTest(r),submitData:async r=>{await this.appropriatenessTestService.fillAppropriatenessTest(r)}}),this.stepRouter.registerHandler(ie.Overview,{loadData:r=>this.overviewService.getOverviewData(r),submitData:r=>this.overviewService.passOverview(r.applicantId)}),this.stepRouter.registerHandler(ie.RiskScoring,{loadData:r=>this.riskScoringService.getRiskCriterias(r),submitData:async r=>{await this.riskScoringService.submitRiskScoring(r)}}),this.stepRouter.registerHandler(ie.IdentitySdk,{loadData:async r=>({applicantId:r,message:"Identity verification required"}),submitData:async()=>{}}),this.stepRouter.registerHandler(ie.InvestorCategorization,{loadData:r=>this.investorCategorizationService.getInvestorCategorization(r),submitData:async r=>{await this.investorCategorizationService.setInvestorCategorization(r)}}),this.stepRouter.registerHandler(ie.ManualReview,{loadData:async r=>({applicantId:r,message:"Your application is under manual review"}),submitData:async()=>{}}),this.stepRouter.registerHandler(ie.AdditionalData,{loadData:async r=>({applicantId:r,message:"Additional data required"}),submitData:async()=>{}})}async initialize(r){try{this.state.setApplicantId(r);const a=await this.applicantService.getProgress(r);return this.state.updateProgress(a),a}catch(a){throw this.state.setError(a),a}}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(a){throw this.state.setError(a),a}}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 kt(t,r){return new Promise((a,s)=>{if(r&&document.getElementById(r)){a();return}const n=document.createElement("script");n.src=t,r&&(n.id=r),n.async=!0,n.onload=()=>a(),n.onerror=()=>s(new Error(`Failed to load script: ${t}`)),document.head.appendChild(n)})}function Xr(t){return!!document.getElementById(t)}function Zr(t){const r=document.getElementById(t);r&&r.remove()}const ea="https://static.sumsub.com/idensic/static/sns-websdk-builder.js";function _e(t,r){try{const a=document.querySelector(".metakyc-sdk")||document.documentElement;return getComputedStyle(a).getPropertyValue(t).trim()||r}catch{return r}}function ta(){const t=_e("--metakyc-primary","#2563eb"),r=_e("--metakyc-primary-hover","#1d4ed8"),a=_e("--metakyc-background","#ffffff"),s=_e("--metakyc-surface","#f9fafb"),n=_e("--metakyc-text-primary","#111827"),l=_e("--metakyc-text-secondary","#6b7280"),c=_e("--metakyc-text-muted","#9ca3af"),d=_e("--metakyc-border","#e5e7eb");return`
1
+ "use strict";var Vr=Object.defineProperty;var Qr=(t,r,a)=>r in t?Vr(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a;var pe=(t,r,a)=>Qr(t,typeof r!="symbol"?r+"":r,a);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Gr=require("axios"),i=require("react"),e=require("react/jsx-runtime"),pt=require("react-dom"),Ye=require("react-hook-form"),Ue=require("zod");function Jr(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const s=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(r,a,s.get?s:{enumerable:!0,get:()=>t[a]})}}return r.default=t,Object.freeze(r)}const St=Jr(i);var oe=(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))(oe||{}),ot=(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))(ot||{}),Te=(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))(Te||{}),Pt=(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))(Pt||{}),Lt=(t=>(t[t.LowRisk=0]="LowRisk",t[t.MediumRisk=1]="MediumRisk",t[t.HighRisk=2]="HighRisk",t[t.Alert=3]="Alert",t))(Lt||{}),Ve=(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))(Ve||{}),Qe=(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))(Qe||{}),Dt=(t=>(t[t.ProviderResultPending=0]="ProviderResultPending",t[t.ProviderResultReceived=1]="ProviderResultReceived",t[t.Canceled=2]="Canceled",t[t.ExtendedToNewApplicant=3]="ExtendedToNewApplicant",t))(Dt||{}),Mt=(t=>(t[t.None=0]="None",t[t.ProviderResultPending=1]="ProviderResultPending",t[t.ProviderResultReceived=2]="ProviderResultReceived",t[t.Canceled=3]="Canceled",t))(Mt||{}),Ae=(t=>(t[t.Onfido=0]="Onfido",t[t.Sumsub=2]="Sumsub",t[t.SardinAI=3]="SardinAI",t))(Ae||{}),zt=(t=>(t[t.Individual=0]="Individual",t[t.Company=1]="Company",t))(zt||{}),lt=(t=>(t[t.Male=0]="Male",t[t.Female=1]="Female",t[t.Other=2]="Other",t))(lt||{}),Ot=(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))(Ot||{}),$t=(t=>(t[t.Pending=0]="Pending",t[t.Approved=1]="Approved",t[t.Rejected=2]="Rejected",t[t.RequiresRevision=3]="RequiresRevision",t))($t||{}),Bt=(t=>(t[t.SingleChoice=0]="SingleChoice",t[t.MultipleChoice=1]="MultipleChoice",t[t.Text=2]="Text",t))(Bt||{}),Me=(t=>(t[t.String=0]="String",t[t.Integer=1]="Integer",t[t.Money=2]="Money",t[t.Boolean=3]="Boolean",t[t.Date=4]="Date",t[t.Country=5]="Country",t[t.DigitOnly=6]="DigitOnly",t))(Me||{}),_t=(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))(_t||{}),Ht=(t=>(t[t.None=0]="None",t[t.Country=1]="Country",t))(Ht||{}),we=(t=>(t[t.Individual=0]="Individual",t[t.Sophisticated=1]="Sophisticated",t[t.HighNetWorth=2]="HighNetWorth",t[t.Business=3]="Business",t))(we||{}),Wt=(t=>(t[t.Retail=0]="Retail",t[t.Professional=1]="Professional",t[t.EligibleCounterparty=2]="EligibleCounterparty",t))(Wt||{});const We={Nationality:10,Address:20,CountryOfBirth:30,PhoneNumber:40,UboAddress:50},Ge={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:"select",countriesType:We.PhoneNumber},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",countriesType:We.Address},nationality:{label:"Nationality",type:"select",countriesType:We.Nationality},otherNationality:{label:"Other Nationalities",type:"multiselect",countriesType:We.Nationality},countryOfBirth:{label:"Country of Birth",type:"select",countriesType:We.CountryOfBirth},placeOfBirth:{label:"Place of Birth",type:"text"},taxCountry:{label:"Tax Country",type:"select",countriesType:We.Address},taxNumber:{label:"Tax Number",type:"text"},defaultLanguage:{label:"Default Language",type:"select"},educationLevel:{label:"Education Level",type:"text"},occupation:{label:"Occupation",type:"text"}},Ze={companyName:{label:"Company Name",type:"text"},email:{label:"Email",type:"email"},phone:{label:"Phone",type:"tel"},registrationNumber:{label:"Registration Number",type:"text"},countryResidence:{label:"Country of Residence",type:"select",countriesType:We.Address},legalAddress:{label:"Legal Address",type:"text"},incorporatedOn:{label:"Incorporation Date",type:"date"},controlScheme:{label:"Control Scheme",type:"text"},taxId:{label:"Tax ID",type:"text"},registrationLocation:{label:"Registration Location",type:"text"},website:{label:"Website",type:"text"},postalAddress:{label:"Postal Address",type:"text"},street:{label:"Street",type:"text"},streetNumber:{label:"Street Number",type:"text"},city:{label:"City",type:"text"},state:{label:"State / Province",type:"text"},postalCode:{label:"Postal Code",type:"text"},addressCountry:{label:"Address Country",type:"select",countriesType:We.Address},lei:{label:"LEI",type:"text"}},Ut=["companyName","email","phone","registrationNumber"],Kt=["firstName","lastName","email","phonenumber","dateOfBirth"],ht=[{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 Se=(t=>(t.Default="default",t.Corporate="corporate",t.Fintech="fintech",t.Healthcare="healthcare",t.Modern="modern",t.Minimal="minimal",t))(Se||{});const qt={timeout:3e4,retries:3,locale:"en",endpoints:{pattern:"host-controller"}};class Yt{constructor(r){this.config=r}build(r,a){const s=`${r}.${a}`;if(this.config.customPaths&&this.config.customPaths[s])return this.config.customPaths[s];switch(this.config.pattern){case"host-controller":return`/api/${r}/${a}`;case"application-service":return`/services/app/${this.getServiceName(r)}/${a}`;case"custom":throw new Error(`Custom endpoint path not found for ${s}. 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 De extends Error{constructor(a,s,n,l,c){super(a);pe(this,"response");this.code=s,this.details=n,this.validationErrors=l,this.name="MetaKYCError",this.response=c,Object.setPrototypeOf(this,De.prototype)}}class at{static handleApiError(r){return new De(r.message||"An unknown error occurred",r.code,r.details||void 0,r.validationErrors||void 0)}static handleAxiosError(r){if(r.response){const a=r.response.data;return a&&a.error?new De(a.error.message||"An unknown error occurred",a.error.code,a.error.details||void 0,a.error.validationErrors||void 0,r.response):a&&a.result&&a.result.message?new De(a.result.message,r.response.status,`HTTP ${r.response.status}: ${r.response.statusText}`,void 0,r.response):new De((a==null?void 0:a.message)||r.message||"Request failed",r.response.status,`HTTP ${r.response.status}: ${r.response.statusText}`,void 0,r.response)}else return r.request?new De("No response from server",0,"The request was made but no response was received. Please check your network connection."):new De(r.message||"An unexpected error occurred",0,r.toString())}static isMetaKYCError(r){return r instanceof De}}class Vt{constructor(r){pe(this,"axiosInstance");pe(this,"endpointBuilder");pe(this,"config");this.config={...qt,...r},this.endpointBuilder=new Yt(this.config.endpoints),this.axiosInstance=Gr.create({baseURL:this.config.baseUrl,timeout:this.config.timeout,headers:{"Content-Type":"application/json"}}),this.axiosInstance.interceptors.request.use(a=>{if(a.headers["Abp-TenantId"]=this.config.tenantId.toString(),this.config.getAccessToken){const s=this.config.getAccessToken();s&&(a.headers.Authorization=`Bearer ${s}`)}else this.config.apiKey&&(a.headers.ApiKey=this.config.apiKey,a.headers["X-API-KEY"]=this.config.apiKey);return this.config.locale&&(a.headers["Accept-Language"]=this.config.locale),a},a=>Promise.reject(a)),this.axiosInstance.interceptors.response.use(a=>a,async a=>{var n;const s=a.config;return((n=a.response)==null?void 0:n.status)>=500&&!s._retry&&(s._retry=!0,s._retryCount=(s._retryCount||0)+1,s._retryCount<(this.config.retries||3))?(await new Promise(l=>setTimeout(l,1e3*s._retryCount)),this.axiosInstance(s)):Promise.reject(a)})}buildEndpoint(r,a){return this.endpointBuilder.build(r,a)}async get(r,a,s){try{const n=this.buildEndpoint(r,a),l=await this.axiosInstance.get(n,{params:s});return this.handleResponse(l)}catch(n){throw at.handleAxiosError(n)}}async post(r,a,s){try{const n=this.buildEndpoint(r,a),l=await this.axiosInstance.post(n,s);return this.handleResponse(l)}catch(n){throw at.handleAxiosError(n)}}async put(r,a,s){try{const n=this.buildEndpoint(r,a),l=await this.axiosInstance.put(n,s);return this.handleResponse(l)}catch(n){throw at.handleAxiosError(n)}}async delete(r,a,s){try{const n=this.buildEndpoint(r,a),l=await this.axiosInstance.delete(n,{params:s});return this.handleResponse(l)}catch(n){throw at.handleAxiosError(n)}}handleResponse(r){const a=r.data;if(!a.success&&a.error)throw at.handleApiError(a.error);return a}getAxiosInstance(){return this.axiosInstance}}class Qt{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,a){await this.httpClient.post("Applicant","SetApplicantLng",{applicantId:r,language:a})}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 Gt{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 Jt{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 Xt{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 Zt{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 er{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 tr{constructor(r){this.httpClient=r}async identityRequest(r){console.log("[IdentityService] Calling IdentityRequest with input:",r);const a=await this.httpClient.post("Applicant","IdentityRequest",r);return console.log("[IdentityService] IdentityRequest response:",a),a.result}async identityCompanyRequest(r){return(await this.httpClient.post("Applicant","IdentityCompanyRequest",r)).result}async restartIdentityRequest(r){const a={applicantId:r,restart:!0,redirectUrl:"",ttl:604800};return console.log("[IdentityService] Restarting identity with restart=true:",a),this.identityRequest(a)}async restartIdentityCompanyRequest(r){const a={applicantId:r,restart:!0,redirectUrl:"",ttl:604800};return this.identityCompanyRequest(a)}async refreshSumsubToken(r){console.log("[IdentityService] Refreshing Sumsub token for applicant:",r);const a=await this.httpClient.post("Applicant","RefreshSumsubToken",{applicantId:r});return console.log("[IdentityService] Sumsub token refresh result:",a),a.result.accessToken}}class rr{constructor(r){this.httpClient=r}async getCountries(r,a,s){return(await this.httpClient.get("BaseInformation","GetAllCountries",{filter:r||"",lng:a||"en",type:s})).result}async getBranches(){return(await this.httpClient.get("BaseInformation","GetBranches")).result}async getLegalEntities(){return(await this.httpClient.get("BaseInformation","GetLegalEntities")).result}}class ar{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 je={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"}}},sr={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"}},nr={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"}},ir={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"}}},or={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"}},lr={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"}},cr={[Se.Default]:je,[Se.Corporate]:sr,[Se.Fintech]:nr,[Se.Healthcare]:ir,[Se.Modern]:or,[Se.Minimal]:lr};function st(t){return cr[t]||je}class dr{constructor(r){this.httpClient=r}async getThemeConfiguration(){var r;try{const a=await this.httpClient.get("Tenant","GetThemeConfiguration");if(!a.result.isEnabled)return st(Se.Default);let s=a.result.preset?st(a.result.preset):st(Se.Default);if(a.result.title&&(s.title=a.result.title),a.result.logo&&(s.logo={...s.logo,...a.result.logo}),a.result.colors&&(s.colors={...s.colors,...a.result.colors}),a.result.typography&&(s.typography={...s.typography,...a.result.typography}),a.result.spacing&&(s.spacing={...s.spacing,...a.result.spacing}),a.result.customCSS&&(s.customCSS=a.result.customCSS),a.result.darkMode&&(s.darkMode={colors:{...(r=s.darkMode)==null?void 0:r.colors,...a.result.darkMode.colors}}),a.result.applicantFormVisibleFields&&a.result.applicantFormVisibleFields.length>0&&(s.applicantFormVisibleFields=a.result.applicantFormVisibleFields),a.result.applicantFormRequiredFields&&a.result.applicantFormRequiredFields.length>0&&(s.applicantFormRequiredFields=a.result.applicantFormRequiredFields),a.result.allowedLanguages&&a.result.allowedLanguages.length>0&&(s.allowedLanguages=a.result.allowedLanguages),a.result.applicantFormPages)try{const n=typeof a.result.applicantFormPages=="string"?JSON.parse(a.result.applicantFormPages):a.result.applicantFormPages;Array.isArray(n)&&n.length>0&&(s.applicantFormPages=n.map(l=>{const c=!l._v||l._v<4;return{...l,fields:(l.fields||[]).map(d=>({...d,colSpan:c?d.colSpan===1?2:4:Math.min(4,Math.max(1,d.colSpan??4))}))}}))}catch{}if(a.result.reviewPageFields)try{const n=typeof a.result.reviewPageFields=="string"?JSON.parse(a.result.reviewPageFields):a.result.reviewPageFields;Array.isArray(n)&&n.length>0&&(s.reviewPageFields=n)}catch{}if(a.result.reviewPageDisabled&&(s.reviewPageDisabled=!0),a.result.fieldLabelMode==="placeholder"&&(s.fieldLabelMode="placeholder"),a.result.companyFormVisibleFields&&a.result.companyFormVisibleFields.length>0&&(s.companyFormVisibleFields=a.result.companyFormVisibleFields),a.result.companyFormRequiredFields&&a.result.companyFormRequiredFields.length>0&&(s.companyFormRequiredFields=a.result.companyFormRequiredFields),a.result.companyFormPages)try{const n=typeof a.result.companyFormPages=="string"?JSON.parse(a.result.companyFormPages):a.result.companyFormPages;Array.isArray(n)&&n.length>0&&(s.companyFormPages=n.map(l=>{const c=!l._v||l._v<4;return{...l,fields:(l.fields||[]).map(d=>({...d,colSpan:c?d.colSpan===1?2:4:Math.min(4,Math.max(1,d.colSpan??4))}))}}))}catch{}if(a.result.companyReviewPageFields)try{const n=typeof a.result.companyReviewPageFields=="string"?JSON.parse(a.result.companyReviewPageFields):a.result.companyReviewPageFields;Array.isArray(n)&&n.length>0&&(s.companyReviewPageFields=n)}catch{}return s}catch(a){return console.warn("[ThemeService] Failed to fetch theme configuration:",a),st(Se.Default)}}async saveThemeConfiguration(r){await this.httpClient.post("Tenant","SaveThemeConfiguration",r)}getAvailablePresets(){return[{id:Se.Default,name:"Default"},{id:Se.Corporate,name:"Corporate"},{id:Se.Fintech,name:"Fintech"},{id:Se.Healthcare,name:"Healthcare"},{id:Se.Modern,name:"Modern"},{id:Se.Minimal,name:"Minimal"}]}getPreviewTheme(r,a){const s=st(r);return a?{...s,...a,logo:{...s.logo,...a.logo},colors:{...s.colors,...a.colors},typography:a.typography?{...s.typography,...a.typography}:s.typography,spacing:a.spacing?{...s.spacing,...a.spacing}:s.spacing}:s}}class mr{constructor(){pe(this,"listeners",new Map)}on(r,a){return this.listeners.has(r)||this.listeners.set(r,new Set),this.listeners.get(r).add(a),()=>{this.off(r,a)}}off(r,a){const s=this.listeners.get(r);s&&s.delete(a)}emit(r,a){const s=this.listeners.get(r);s&&s.forEach(n=>{try{n(a)}catch(l){console.error(`Error in event listener for "${r}":`,l)}})}clear(){this.listeners.clear()}clearEvent(r){this.listeners.delete(r)}}class pr{constructor(){pe(this,"events",new mr);pe(this,"_applicantId",null);pe(this,"_progress",null);pe(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)||Te.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===Te.Finished}get isOnHold(){return this.status===Te.OnHold}get isInProgress(){return this.status===Te.InProgress}setApplicantId(r){this._applicantId=r}updateProgress(r){var s,n;const a=(s=this._progress)==null?void 0:s.currentStep;this._progress=r,this._applicantId=r.applicantId,this._error=null,this.events.emit("progressUpdated",r),(a==null?void 0:a.order)!==((n=r.currentStep)==null?void 0:n.order)&&this.events.emit("stepChanged",r.currentStep),this.events.emit("statusChanged",r.status),r.status===Te.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 ur{constructor(){pe(this,"handlers",new Map)}registerHandler(r,a){this.handlers.set(r,a)}getHandler(r){return this.handlers.get(r)}hasHandler(r){return this.handlers.has(r)}async loadStepData(r,a){const s=this.getHandler(r);if(!s)throw new Error(`No handler registered for step action: ${oe[r]}`);return s.loadData(a)}async submitStepData(r,a){const s=this.getHandler(r);if(!s)throw new Error(`No handler registered for step action: ${oe[r]}`);return s.submitData(a)}}class yr{constructor(r,a,s,n,l,c,d,y){pe(this,"state");pe(this,"stepRouter");this.applicantService=r,this.questionnaireService=a,this.uploadDocumentService=s,this.appropriatenessTestService=n,this.overviewService=l,this.riskScoringService=c,this.investorCategorizationService=y,this.state=new pr,this.stepRouter=new ur,this.registerStepHandlers()}registerStepHandlers(){this.stepRouter.registerHandler(oe.Questionaries,{loadData:r=>this.questionnaireService.getQuestionnaire(r),submitData:async r=>{await this.questionnaireService.fillQuestionnaire(r)}}),this.stepRouter.registerHandler(oe.UploadDocument,{loadData:r=>this.uploadDocumentService.getUploadDocument(r),submitData:r=>this.uploadDocumentService.fillUploadDocument(r)}),this.stepRouter.registerHandler(oe.AppropriatenessTest,{loadData:r=>this.appropriatenessTestService.getAppropriatenessTest(r),submitData:async r=>{await this.appropriatenessTestService.fillAppropriatenessTest(r)}}),this.stepRouter.registerHandler(oe.Overview,{loadData:r=>this.overviewService.getOverviewData(r),submitData:r=>this.overviewService.passOverview(r.applicantId)}),this.stepRouter.registerHandler(oe.RiskScoring,{loadData:r=>this.riskScoringService.getRiskCriterias(r),submitData:async r=>{await this.riskScoringService.submitRiskScoring(r)}}),this.stepRouter.registerHandler(oe.IdentitySdk,{loadData:async r=>({applicantId:r,message:"Identity verification required"}),submitData:async()=>{}}),this.stepRouter.registerHandler(oe.InvestorCategorization,{loadData:r=>this.investorCategorizationService.getInvestorCategorization(r),submitData:async r=>{await this.investorCategorizationService.setInvestorCategorization(r)}}),this.stepRouter.registerHandler(oe.ManualReview,{loadData:async r=>({applicantId:r,message:"Your application is under manual review"}),submitData:async()=>{}}),this.stepRouter.registerHandler(oe.AdditionalData,{loadData:async r=>({applicantId:r,message:"Additional data required"}),submitData:async()=>{}})}async initialize(r){try{this.state.setApplicantId(r);const a=await this.applicantService.getProgress(r);return this.state.updateProgress(a),a}catch(a){throw this.state.setError(a),a}}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(a){throw this.state.setError(a),a}}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 kt(t,r){return new Promise((a,s)=>{if(r&&document.getElementById(r)){a();return}const n=document.createElement("script");n.src=t,r&&(n.id=r),n.async=!0,n.onload=()=>a(),n.onerror=()=>s(new Error(`Failed to load script: ${t}`)),document.head.appendChild(n)})}function Xr(t){return!!document.getElementById(t)}function Zr(t){const r=document.getElementById(t);r&&r.remove()}const ea="https://static.sumsub.com/idensic/static/sns-websdk-builder.js";function _e(t,r){try{const a=document.querySelector(".metakyc-sdk")||document.documentElement;return getComputedStyle(a).getPropertyValue(t).trim()||r}catch{return r}}function ta(){const t=_e("--metakyc-primary","#2563eb"),r=_e("--metakyc-primary-hover","#1d4ed8"),a=_e("--metakyc-background","#ffffff"),s=_e("--metakyc-surface","#f9fafb"),n=_e("--metakyc-text-primary","#111827"),l=_e("--metakyc-text-secondary","#6b7280"),c=_e("--metakyc-text-muted","#9ca3af"),d=_e("--metakyc-border","#e5e7eb");return`
2
2
  body, html { font-family: ${_e("--metakyc-font-family","-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif")} !important; background-color: ${a} !important; }
3
3
  p, span, label, div { color: ${n}; }
4
4
  h1, h2, h3, h4 { color: ${n}; }
@@ -71,7 +71,7 @@ ${Object.entries(n).filter(([,y])=>!!y).map(([y,p])=>` --metakyc-${y}: ${p} !im
71
71
  color: var(--metakyc-input-text, var(--metakyc-text-primary, #111827)) !important;
72
72
  border-color: var(--metakyc-input-border, var(--metakyc-border, #d1d5db)) !important;
73
73
  }
74
- `;this.themeStyleElement=document.createElement("style"),this.themeStyleElement.id="metakyc-theme-vars",this.themeStyleElement.textContent=c,(d=this.customStyleElement)!=null&&d.parentNode?document.head.insertBefore(this.themeStyleElement,this.customStyleElement):document.head.appendChild(this.themeStyleElement)}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 a;return{name:r.name||je.name,title:r.title||je.title,logo:{...je.logo,...r.logo},colors:{...je.colors,...r.colors},typography:r.typography?{...je.typography,...r.typography}:je.typography,spacing:r.spacing?{...je.spacing,...r.spacing}:je.spacing,customCSS:r.customCSS,darkMode:r.darkMode?{colors:{...(a=je.darkMode)==null?void 0:a.colors,...r.darkMode.colors}}:je.darkMode,applicantFormVisibleFields:r.applicantFormVisibleFields,applicantFormRequiredFields:r.applicantFormRequiredFields,allowedLanguages:r.allowedLanguages,applicantFormPages:r.applicantFormPages,reviewPageFields:r.reviewPageFields,reviewPageDisabled:r.reviewPageDisabled,fieldLabelMode:r.fieldLabelMode,companyFormVisibleFields:r.companyFormVisibleFields,companyFormRequiredFields:r.companyFormRequiredFields,companyFormPages:r.companyFormPages,companyReviewPageFields:r.companyReviewPageFields}}getCurrentTheme(){return this.currentTheme}resetTheme(){this.applyTheme(je)}cleanup(){this.themeStyleElement&&(this.themeStyleElement.remove(),this.themeStyleElement=null),this.customStyleElement&&(this.customStyleElement.remove(),this.customStyleElement=null)}kebabCase(r){return r.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}}const bt=i.createContext(null),kr="1.0.19",ra='.metakyc-sdk .pointer-events-none{pointer-events:none}.metakyc-sdk .visible{visibility:visible}.metakyc-sdk .static{position:static}.metakyc-sdk .fixed{position:fixed}.metakyc-sdk .absolute{position:absolute}.metakyc-sdk .relative{position:relative}.metakyc-sdk .inset-y-0{top:0;bottom:0}.metakyc-sdk .left-0{left:0}.metakyc-sdk .right-0{right:0}.metakyc-sdk .right-3{right:.75rem}.metakyc-sdk .top-1\\/2{top:50%}.metakyc-sdk .mx-4{margin-left:1rem;margin-right:1rem}.metakyc-sdk .mx-6{margin-left:1.5rem;margin-right:1.5rem}.metakyc-sdk .mx-auto{margin-left:auto;margin-right:auto}.metakyc-sdk .my-8{margin-top:2rem;margin-bottom:2rem}.metakyc-sdk .-ml-1{margin-left:-.25rem}.metakyc-sdk .mb-0\\.5{margin-bottom:.125rem}.metakyc-sdk .mb-1{margin-bottom:.25rem}.metakyc-sdk .mb-2{margin-bottom:.5rem}.metakyc-sdk .mb-3{margin-bottom:.75rem}.metakyc-sdk .mb-4{margin-bottom:1rem}.metakyc-sdk .mb-6{margin-bottom:1.5rem}.metakyc-sdk .ml-0\\.5{margin-left:.125rem}.metakyc-sdk .ml-1{margin-left:.25rem}.metakyc-sdk .ml-3{margin-left:.75rem}.metakyc-sdk .mr-2{margin-right:.5rem}.metakyc-sdk .mr-3{margin-right:.75rem}.metakyc-sdk .mt-0\\.5{margin-top:.125rem}.metakyc-sdk .mt-1{margin-top:.25rem}.metakyc-sdk .mt-2{margin-top:.5rem}.metakyc-sdk .mt-3{margin-top:.75rem}.metakyc-sdk .mt-4{margin-top:1rem}.metakyc-sdk .mt-6{margin-top:1.5rem}.metakyc-sdk .block{display:block}.metakyc-sdk .inline-block{display:inline-block}.metakyc-sdk .inline{display:inline}.metakyc-sdk .flex{display:flex}.metakyc-sdk .inline-flex{display:inline-flex}.metakyc-sdk .grid{display:grid}.metakyc-sdk .hidden{display:none}.metakyc-sdk .h-12{height:3rem}.metakyc-sdk .h-16{height:4rem}.metakyc-sdk .h-24{height:6rem}.metakyc-sdk .h-4{height:1rem}.metakyc-sdk .h-6{height:1.5rem}.metakyc-sdk .h-8{height:2rem}.metakyc-sdk .h-full{height:100%}.metakyc-sdk .max-h-52{max-height:13rem}.metakyc-sdk .min-h-\\[400px\\]{min-height:400px}.metakyc-sdk .w-12{width:3rem}.metakyc-sdk .w-16{width:4rem}.metakyc-sdk .w-20{width:5rem}.metakyc-sdk .w-24{width:6rem}.metakyc-sdk .w-4{width:1rem}.metakyc-sdk .w-6{width:1.5rem}.metakyc-sdk .w-8{width:2rem}.metakyc-sdk .w-full{width:100%}.metakyc-sdk .max-w-md{max-width:28rem}.metakyc-sdk .flex-1{flex:1 1 0%}.metakyc-sdk .flex-shrink-0{flex-shrink:0}.metakyc-sdk .-translate-y-1\\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.metakyc-sdk .transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes spin{to{transform:rotate(360deg)}}.metakyc-sdk .animate-spin{animation:spin 1s linear infinite}.metakyc-sdk .cursor-not-allowed{cursor:not-allowed}.metakyc-sdk .cursor-pointer{cursor:pointer}.metakyc-sdk .resize{resize:both}.metakyc-sdk .list-inside{list-style-position:inside}.metakyc-sdk .list-disc{list-style-type:disc}.metakyc-sdk .list-none{list-style-type:none}.metakyc-sdk .grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.metakyc-sdk .grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.metakyc-sdk .flex-col{flex-direction:column}.metakyc-sdk .flex-wrap{flex-wrap:wrap}.metakyc-sdk .items-start{align-items:flex-start}.metakyc-sdk .items-center{align-items:center}.metakyc-sdk .justify-center{justify-content:center}.metakyc-sdk .justify-between{justify-content:space-between}.metakyc-sdk .gap-1{gap:.25rem}.metakyc-sdk .gap-1\\.5{gap:.375rem}.metakyc-sdk .gap-2{gap:.5rem}.metakyc-sdk .gap-4{gap:1rem}.metakyc-sdk :is(.space-x-3>:not([hidden])~:not([hidden])){--tw-space-x-reverse: 0;margin-right:calc(.75rem * var(--tw-space-x-reverse));margin-left:calc(.75rem * calc(1 - var(--tw-space-x-reverse)))}.metakyc-sdk :is(.space-y-1>:not([hidden])~:not([hidden])){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.metakyc-sdk :is(.space-y-1\\.5>:not([hidden])~:not([hidden])){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.metakyc-sdk :is(.space-y-2>:not([hidden])~:not([hidden])){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.metakyc-sdk :is(.space-y-4>:not([hidden])~:not([hidden])){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.metakyc-sdk :is(.space-y-6>:not([hidden])~:not([hidden])){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.metakyc-sdk :is(.space-y-8>:not([hidden])~:not([hidden])){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.metakyc-sdk .truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.metakyc-sdk .rounded{border-radius:.25rem}.metakyc-sdk .rounded-full{border-radius:9999px}.metakyc-sdk .rounded-lg{border-radius:.5rem}.metakyc-sdk .rounded-xl{border-radius:.75rem}.metakyc-sdk .border{border-width:1px}.metakyc-sdk .border-0{border-width:0px}.metakyc-sdk .border-2{border-width:2px}.metakyc-sdk .border-b{border-bottom-width:1px}.metakyc-sdk .border-t{border-top-width:1px}.metakyc-sdk .border-blue-200{--tw-border-opacity: 1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1))}.metakyc-sdk .border-danger-500{border-color:var(--metakyc-danger, #EF4444)}.metakyc-sdk .border-green-200{--tw-border-opacity: 1;border-color:rgb(187 247 208 / var(--tw-border-opacity, 1))}.metakyc-sdk .border-red-200{--tw-border-opacity: 1;border-color:rgb(254 202 202 / var(--tw-border-opacity, 1))}.metakyc-sdk .border-yellow-200{--tw-border-opacity: 1;border-color:rgb(254 240 138 / var(--tw-border-opacity, 1))}.metakyc-sdk .bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.metakyc-sdk .bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.metakyc-sdk .bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.metakyc-sdk .bg-green-50{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.metakyc-sdk .bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.metakyc-sdk .bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.metakyc-sdk .bg-yellow-100{--tw-bg-opacity: 1;background-color:rgb(254 249 195 / var(--tw-bg-opacity, 1))}.metakyc-sdk .bg-yellow-50{--tw-bg-opacity: 1;background-color:rgb(254 252 232 / var(--tw-bg-opacity, 1))}.metakyc-sdk .p-3{padding:.75rem}.metakyc-sdk .p-4{padding:1rem}.metakyc-sdk .px-2{padding-left:.5rem;padding-right:.5rem}.metakyc-sdk .px-2\\.5{padding-left:.625rem;padding-right:.625rem}.metakyc-sdk .px-3{padding-left:.75rem;padding-right:.75rem}.metakyc-sdk .px-4{padding-left:1rem;padding-right:1rem}.metakyc-sdk .px-6{padding-left:1.5rem;padding-right:1.5rem}.metakyc-sdk .py-0\\.5{padding-top:.125rem;padding-bottom:.125rem}.metakyc-sdk .py-1\\.5{padding-top:.375rem;padding-bottom:.375rem}.metakyc-sdk .py-12{padding-top:3rem;padding-bottom:3rem}.metakyc-sdk .py-2{padding-top:.5rem;padding-bottom:.5rem}.metakyc-sdk .py-3{padding-top:.75rem;padding-bottom:.75rem}.metakyc-sdk .py-4{padding-top:1rem;padding-bottom:1rem}.metakyc-sdk .py-8{padding-top:2rem;padding-bottom:2rem}.metakyc-sdk .pb-4{padding-bottom:1rem}.metakyc-sdk .pl-10{padding-left:2.5rem}.metakyc-sdk .pl-3{padding-left:.75rem}.metakyc-sdk .pr-10{padding-right:2.5rem}.metakyc-sdk .pr-3{padding-right:.75rem}.metakyc-sdk .pr-6{padding-right:1.5rem}.metakyc-sdk .pt-6{padding-top:1.5rem}.metakyc-sdk .text-left{text-align:left}.metakyc-sdk .text-center{text-align:center}.metakyc-sdk .text-right{text-align:right}.metakyc-sdk .text-2xl{font-size:1.5rem;line-height:2rem}.metakyc-sdk .text-3xl{font-size:1.875rem;line-height:2.25rem}.metakyc-sdk .text-5xl{font-size:3rem;line-height:1}.metakyc-sdk .text-base{font-size:1rem;line-height:1.5rem}.metakyc-sdk .text-lg{font-size:1.125rem;line-height:1.75rem}.metakyc-sdk .text-sm{font-size:.875rem;line-height:1.25rem}.metakyc-sdk .text-xl{font-size:1.25rem;line-height:1.75rem}.metakyc-sdk .text-xs{font-size:.75rem;line-height:1rem}.metakyc-sdk .font-bold{font-weight:700}.metakyc-sdk .font-medium{font-weight:500}.metakyc-sdk .font-semibold{font-weight:600}.metakyc-sdk .uppercase{text-transform:uppercase}.metakyc-sdk .lowercase{text-transform:lowercase}.metakyc-sdk .tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.metakyc-sdk .leading-6{line-height:1.5rem}.metakyc-sdk .text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.metakyc-sdk .text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.metakyc-sdk .text-blue-900{--tw-text-opacity: 1;color:rgb(30 58 138 / var(--tw-text-opacity, 1))}.metakyc-sdk .text-danger-500{color:var(--metakyc-danger, #EF4444)}.metakyc-sdk .text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.metakyc-sdk .text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.metakyc-sdk .text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.metakyc-sdk .text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.metakyc-sdk .text-green-800{--tw-text-opacity: 1;color:rgb(22 101 52 / var(--tw-text-opacity, 1))}.metakyc-sdk .text-green-900{--tw-text-opacity: 1;color:rgb(20 83 45 / var(--tw-text-opacity, 1))}.metakyc-sdk .text-primary,.metakyc-sdk .text-primary-500{color:var(--metakyc-primary, #3B82F6)}.metakyc-sdk .text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.metakyc-sdk .text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.metakyc-sdk .text-red-800{--tw-text-opacity: 1;color:rgb(153 27 27 / var(--tw-text-opacity, 1))}.metakyc-sdk .text-red-900{--tw-text-opacity: 1;color:rgb(127 29 29 / var(--tw-text-opacity, 1))}.metakyc-sdk .text-secondary{color:var(--metakyc-secondary, #64748b)}.metakyc-sdk .text-yellow-700{--tw-text-opacity: 1;color:rgb(161 98 7 / var(--tw-text-opacity, 1))}.metakyc-sdk .text-yellow-800{--tw-text-opacity: 1;color:rgb(133 77 14 / var(--tw-text-opacity, 1))}.metakyc-sdk .underline{text-decoration-line:underline}.metakyc-sdk .opacity-25{opacity:.25}.metakyc-sdk .opacity-50{opacity:.5}.metakyc-sdk .opacity-60{opacity:.6}.metakyc-sdk .opacity-75{opacity:.75}.metakyc-sdk .shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.metakyc-sdk .outline{outline-style:solid}.metakyc-sdk .blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.metakyc-sdk .filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.metakyc-sdk .transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.metakyc-sdk .transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.metakyc-sdk .transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.metakyc-sdk .transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.metakyc-sdk .duration-200{transition-duration:.2s}.metakyc-sdk .grid{display:grid!important}.metakyc-sdk .flex{display:flex!important}.metakyc-sdk .inline-flex{display:inline-flex!important}.metakyc-sdk .hidden{display:none!important}.metakyc-sdk .block{display:block!important}.metakyc-sdk .grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))!important}.metakyc-sdk .grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))!important}.metakyc-sdk .grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))!important}.metakyc-sdk .grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))!important}.metakyc-sdk .col-span-1{grid-column:span 1 / span 1!important}.metakyc-sdk .col-span-2{grid-column:span 2 / span 2!important}.metakyc-sdk .col-span-3{grid-column:span 3 / span 3!important}.metakyc-sdk .col-span-4{grid-column:span 4 / span 4!important}.metakyc-sdk .gap-1{gap:.25rem!important}.metakyc-sdk .gap-2{gap:.5rem!important}.metakyc-sdk .gap-3{gap:.75rem!important}.metakyc-sdk .gap-4{gap:1rem!important}.metakyc-sdk .gap-6{gap:1.5rem!important}.metakyc-sdk .gap-8{gap:2rem!important}.metakyc-sdk .flex-col{flex-direction:column!important}.metakyc-sdk .flex-row{flex-direction:row!important}.metakyc-sdk .flex-wrap{flex-wrap:wrap!important}.metakyc-sdk .flex-1{flex:1 1 0%!important}.metakyc-sdk .flex-shrink-0{flex-shrink:0!important}.metakyc-sdk .items-center{align-items:center!important}.metakyc-sdk .items-start{align-items:flex-start!important}.metakyc-sdk .items-end{align-items:flex-end!important}.metakyc-sdk .justify-between{justify-content:space-between!important}.metakyc-sdk .justify-center{justify-content:center!important}.metakyc-sdk .justify-end{justify-content:flex-end!important}.metakyc-sdk .justify-start{justify-content:flex-start!important}.metakyc-sdk .space-y-1>*+*{margin-top:.25rem!important}.metakyc-sdk .space-y-1\\.5>*+*{margin-top:.375rem!important}.metakyc-sdk .space-y-2>*+*{margin-top:.5rem!important}.metakyc-sdk .space-y-3>*+*{margin-top:.75rem!important}.metakyc-sdk .space-y-4>*+*{margin-top:1rem!important}.metakyc-sdk .space-y-6>*+*{margin-top:1.5rem!important}.metakyc-sdk .w-full{width:100%!important}.metakyc-sdk .relative{position:relative!important}.metakyc-sdk .absolute{position:absolute!important}.metakyc-sdk .overflow-hidden{overflow:hidden!important}.metakyc-sdk .overflow-auto{overflow:auto!important}.metakyc-sdk .overflow-x-auto{overflow-x:auto!important}@media (min-width: 768px){.metakyc-sdk .md\\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))!important}.metakyc-sdk .md\\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))!important}}.metakyc-sdk *,.metakyc-sdk *:before,.metakyc-sdk *:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:var(--metakyc-border, #e5e7eb)}.metakyc-sdk{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4}.metakyc-sdk img,.metakyc-sdk video{max-width:100%;height:auto}.metakyc-sdk h1,.metakyc-sdk h2,.metakyc-sdk h3,.metakyc-sdk h4,.metakyc-sdk h5,.metakyc-sdk h6,.metakyc-sdk p{margin:0}.metakyc-sdk ol,.metakyc-sdk ul{list-style:none;margin:0;padding:0}.metakyc-sdk button,.metakyc-sdk input,.metakyc-sdk optgroup,.metakyc-sdk select,.metakyc-sdk textarea{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}.metakyc-sdk button,.metakyc-sdk [role=button]{cursor:pointer}.metakyc-sdk a{color:inherit;text-decoration:inherit}.metakyc-sdk input:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=range]),.metakyc-sdk select,.metakyc-sdk textarea,.metakyc-sdk .metakyc-searchable-select-trigger,.metakyc-sdk .metakyc-multiselect-trigger{background-color:var(--metakyc-input-bg, var(--metakyc-background, #ffffff))!important;color:var(--metakyc-input-text, var(--metakyc-text-primary, #111827))!important;border-color:var(--metakyc-input-border, var(--metakyc-border, #d1d5db))!important}.metakyc-sdk input::-moz-placeholder,.metakyc-sdk textarea::-moz-placeholder{color:var(--metakyc-input-placeholder, var(--metakyc-text-muted, #9ca3af))!important;opacity:1!important}.metakyc-sdk input::placeholder,.metakyc-sdk textarea::placeholder{color:var(--metakyc-input-placeholder, var(--metakyc-text-muted, #9ca3af))!important;opacity:1!important}.metakyc-sdk input:not([type=checkbox]):not([type=radio]):focus,.metakyc-sdk select:focus,.metakyc-sdk textarea:focus{outline:none!important;border-color:var(--metakyc-input-border-focus, var(--metakyc-primary, #2563eb))!important;box-shadow:0 0 0 2px color-mix(in srgb,var(--metakyc-input-border-focus, var(--metakyc-primary, #2563eb)) 20%,transparent)!important}.metakyc-sdk input[type=checkbox],.metakyc-sdk input[type=radio]{appearance:none!important;-webkit-appearance:none!important;-moz-appearance:none!important;width:16px!important;height:16px!important;min-width:16px!important;min-height:16px!important;max-width:16px!important;max-height:16px!important;flex-shrink:0!important;cursor:pointer!important;background-color:var(--metakyc-input-bg, var(--metakyc-background, #ffffff))!important;border:1.5px solid var(--metakyc-input-border, var(--metakyc-border, #d1d5db))!important;position:relative!important;transition:background-color .15s,border-color .15s!important;vertical-align:middle!important;display:inline-block!important;padding:0!important;margin:0!important;color-scheme:light!important}.metakyc-sdk input[type=checkbox]{border-radius:4px!important}.metakyc-sdk input[type=radio]{border-radius:50%!important}.metakyc-sdk input[type=checkbox]:checked,.metakyc-sdk input[type=radio]:checked{background-color:var(--metakyc-primary, #2563eb)!important;border-color:var(--metakyc-primary, #2563eb)!important}.metakyc-sdk input[type=checkbox]:checked:after{content:""!important;display:block!important;position:absolute!important;left:4px!important;top:1px!important;width:5px!important;height:9px!important;border:2px solid #ffffff!important;border-top:none!important;border-left:none!important;transform:rotate(45deg)!important}.metakyc-sdk input[type=radio]:checked:after{content:""!important;display:block!important;position:absolute!important;left:50%!important;top:50%!important;transform:translate(-50%,-50%)!important;width:6px!important;height:6px!important;border-radius:50%!important;background:#fff!important}.metakyc-sdk input[type=checkbox]:focus,.metakyc-sdk input[type=radio]:focus{outline:none!important;box-shadow:0 0 0 2px color-mix(in srgb,var(--metakyc-primary, #2563eb) 30%,transparent)!important}.metakyc-searchable-select-dropdown,.metakyc-multiselect-dropdown{background-color:var(--metakyc-input-bg, var(--metakyc-background, #ffffff))!important;border-color:var(--metakyc-input-border, var(--metakyc-border, #d1d5db))!important;color:var(--metakyc-input-text, var(--metakyc-text-primary, #111827))!important}.metakyc-searchable-select-dropdown input,.metakyc-multiselect-dropdown input{background-color:var(--metakyc-input-bg, var(--metakyc-background, #ffffff))!important;color:var(--metakyc-input-text, var(--metakyc-text-primary, #111827))!important;border-color:var(--metakyc-input-border, var(--metakyc-border, #d1d5db))!important}.metakyc-searchable-select-dropdown input::-moz-placeholder,.metakyc-multiselect-dropdown input::-moz-placeholder{color:var(--metakyc-input-placeholder, var(--metakyc-text-muted, #9ca3af))!important;opacity:1!important}.metakyc-searchable-select-dropdown input::placeholder,.metakyc-multiselect-dropdown input::placeholder{color:var(--metakyc-input-placeholder, var(--metakyc-text-muted, #9ca3af))!important;opacity:1!important}.metakyc-searchable-select-dropdown input:focus,.metakyc-multiselect-dropdown input:focus{outline:none!important;background-color:var(--metakyc-input-bg, var(--metakyc-background, #ffffff))!important;color:var(--metakyc-input-text, var(--metakyc-text-primary, #111827))!important;border-color:var(--metakyc-input-border-focus, var(--metakyc-primary, #2563eb))!important;box-shadow:0 0 0 2px color-mix(in srgb,var(--metakyc-input-border-focus, var(--metakyc-primary, #2563eb)) 20%,transparent)!important}.metakyc-searchable-select-dropdown li:hover,.metakyc-multiselect-dropdown li:hover{background-color:var(--metakyc-surface, var(--metakyc-background, #f9fafb))!important}.metakyc-sdk .metakyc-help-btn{color:var(--metakyc-primary, #2563eb)!important;border-color:var(--metakyc-primary, #2563eb)!important;background:transparent!important;position:relative!important;z-index:2!important}.metakyc-sdk .metakyc-overview-step-item,.metakyc-sdk .metakyc-overview-step-item *,.metakyc-sdk .metakyc-step-content,.metakyc-sdk .metakyc-step-content *,.metakyc-sdk .metakyc-step-title,.metakyc-sdk .metakyc-step-title *,.metakyc-sdk .metakyc-step-icon,.metakyc-sdk .metakyc-step-icon *,.metakyc-sdk .metakyc-step-description,.metakyc-sdk .metakyc-step-description *{border-top-width:0!important;border-bottom-width:0!important;border-left-width:0!important;border-right-width:0!important;border-top-style:none!important;border-bottom-style:none!important;border-left-style:none!important;border-right-style:none!important;border-top-color:transparent!important;border-bottom-color:transparent!important;border-left-color:transparent!important;border-right-color:transparent!important;border:0!important;box-shadow:none!important;outline:none!important;outline-width:0!important;outline-style:none!important;text-decoration:none!important;text-decoration-line:none!important}.metakyc-sdk .metakyc-overview-step-item:before,.metakyc-sdk .metakyc-overview-step-item:after,.metakyc-sdk .metakyc-overview-step-item *:before,.metakyc-sdk .metakyc-overview-step-item *:after,.metakyc-sdk .metakyc-step-content:before,.metakyc-sdk .metakyc-step-content:after,.metakyc-sdk .metakyc-step-content *:before,.metakyc-sdk .metakyc-step-content *:after,.metakyc-sdk .metakyc-step-title:before,.metakyc-sdk .metakyc-step-title:after,.metakyc-sdk .metakyc-step-description:before,.metakyc-sdk .metakyc-step-description:after{content:none!important;display:none!important;visibility:hidden!important;border:none!important;box-shadow:none!important;outline:none!important;background:none!important;height:0!important;width:0!important}.metakyc-sdk .metakyc-overview-step-item{border-width:0!important;border-style:none!important;border:0!important;box-shadow:none!important;outline:none!important}.metakyc-sdk .metakyc-step-content{border-width:0!important;border-style:none!important;border:0!important;padding-top:0!important;margin-top:0!important;box-shadow:none!important;outline:none!important}.metakyc-sdk .metakyc-step-title{border-width:0!important;border-style:none!important;border:0!important;padding-top:0!important;margin-top:0!important;box-shadow:none!important;outline:none!important;text-decoration:none!important}.metakyc-sdk hr,.metakyc-sdk .metakyc-overview-step-item hr,.metakyc-sdk .metakyc-overview-step-item * hr,.metakyc-sdk .metakyc-step-content hr,.metakyc-sdk .metakyc-step-content * hr{display:block!important;height:0!important;border:0!important;border-top:1px solid var(--metakyc-primary, #2563eb)!important;opacity:.25!important;margin:1rem 0!important;overflow:visible!important}.metakyc-sdk{background-color:var(--metakyc-background, #ffffff)!important;color:var(--metakyc-text-primary, #111827)!important;font-family:var(--metakyc-font-family, inherit)!important;padding:1.5rem!important;border-radius:.75rem!important}.metakyc-sdk h1,.metakyc-sdk h2,.metakyc-sdk h3,.metakyc-sdk h4,.metakyc-sdk h5,.metakyc-sdk h6{color:var(--metakyc-text-primary, #111827);letter-spacing:normal}.metakyc-sdk .text-gray-900{color:var(--metakyc-text-primary, #111827)!important}.metakyc-sdk .text-gray-800{color:var(--metakyc-text-primary, #1f2937)!important}.metakyc-sdk .text-gray-700{color:var(--metakyc-text-secondary, #374151)!important}.metakyc-sdk .text-gray-600{color:var(--metakyc-text-secondary, #6b7280)!important}.metakyc-sdk .text-gray-500{color:var(--metakyc-text-muted, #6b7280)!important}.metakyc-sdk .text-gray-400{color:var(--metakyc-text-muted, #9ca3af)!important}.metakyc-sdk .text-gray-300{color:var(--metakyc-text-muted, #d1d5db)!important}.metakyc-sdk .text-white{color:#fff!important}.metakyc-sdk .bg-white{background-color:var(--metakyc-background, #ffffff)!important}.metakyc-sdk .bg-gray-50{background-color:var(--metakyc-surface, #f9fafb)!important}.metakyc-sdk .bg-gray-100{background-color:var(--metakyc-surface, #f3f4f6)!important}.metakyc-sdk .bg-gray-200{background-color:var(--metakyc-border, #e5e7eb)!important}.metakyc-sdk .bg-gray-800{background-color:var(--metakyc-surface, #1f2937)!important}.metakyc-sdk .border-gray-100,.metakyc-sdk .border-gray-200,.metakyc-sdk .border-gray-300{border-color:var(--metakyc-border, #e5e7eb)!important}.metakyc-sdk .border-t{border-top-color:var(--metakyc-border, #e5e7eb)!important}.metakyc-sdk .border-b{border-bottom-color:var(--metakyc-border, #e5e7eb)!important}.metakyc-sdk .divide-gray-200>*{border-color:var(--metakyc-border, #e5e7eb)!important}.metakyc-sdk .bg-primary-500,.metakyc-sdk .bg-primary-600{background-color:var(--metakyc-primary, #2563eb)!important}.metakyc-sdk .bg-primary-50,.metakyc-sdk .bg-primary-100{background-color:var(--metakyc-primary-light, #dbeafe)!important}.metakyc-sdk .text-primary-500,.metakyc-sdk .text-primary-600,.metakyc-sdk .text-primary-800{color:var(--metakyc-primary, #2563eb)!important}.metakyc-sdk .text-primary-900{color:var(--metakyc-primary-dark, #1e40af)!important}.metakyc-sdk .border-primary-500,.metakyc-sdk .border-primary-600{border-color:var(--metakyc-primary, #2563eb)!important}.metakyc-sdk .hover\\:bg-primary-50:hover{background-color:var(--metakyc-primary-light, #dbeafe)!important}.metakyc-sdk .hover\\:bg-primary-600:hover{background-color:var(--metakyc-primary-hover, #1d4ed8)!important}.metakyc-sdk .bg-blue-600{background-color:var(--metakyc-primary, #2563eb)!important}.metakyc-sdk .bg-blue-100{background-color:var(--metakyc-primary-light, #dbeafe)!important}.metakyc-sdk .text-blue-600,.metakyc-sdk .text-blue-400{color:var(--metakyc-primary, #2563eb)!important}.metakyc-sdk .hover\\:bg-blue-700:hover{background-color:var(--metakyc-primary-hover, #1d4ed8)!important}.metakyc-sdk .metakyc-overview-steps h3:before,.metakyc-sdk .metakyc-overview-steps h3:after{content:none!important;display:none!important}.metakyc-sdk .metakyc-overview-steps *:before,.metakyc-sdk .metakyc-overview-steps *:after{content:none!important;display:none!important}.metakyc-sdk .metakyc-stepper-scroll::-webkit-scrollbar{display:none!important;height:0!important;width:0!important}.metakyc-sdk .metakyc-file-dropzone:hover{border-color:var(--metakyc-primary, #2563eb)!important;background-color:color-mix(in srgb,var(--metakyc-primary, #2563eb) 3%,var(--metakyc-background, #ffffff))!important}.metakyc-sdk .metakyc-file-item:hover{background-color:color-mix(in srgb,var(--metakyc-surface, #f9fafb) 80%,var(--metakyc-border, #e5e7eb))!important}.metakyc-sdk .metakyc-file-upload label{color:var(--metakyc-text-primary, #111827)!important}.metakyc-sdk .metakyc-file-upload p{margin:0!important;line-height:1.4!important}.metakyc-sdk .metakyc-file-item button{background:transparent!important;border:none!important;box-shadow:none!important;outline:none!important}.metakyc-sdk .metakyc-file-dropzone{box-shadow:none!important;outline:none!important}.metakyc-sdk .hover\\:opacity-90:hover{opacity:.9}.metakyc-sdk .focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.metakyc-sdk .focus\\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.metakyc-sdk .focus\\:ring-offset-0:focus{--tw-ring-offset-width: 0px}.metakyc-sdk .focus\\:ring-offset-1:focus{--tw-ring-offset-width: 1px}.metakyc-sdk .disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.metakyc-sdk .disabled\\:opacity-50:disabled{opacity:.5}.metakyc-sdk .disabled\\:opacity-60:disabled{opacity:.6}.metakyc-sdk .dark\\:border-blue-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(30 64 175 / var(--tw-border-opacity, 1))}.metakyc-sdk .dark\\:border-green-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(22 101 52 / var(--tw-border-opacity, 1))}.metakyc-sdk .dark\\:border-red-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(153 27 27 / var(--tw-border-opacity, 1))}.metakyc-sdk .dark\\:border-yellow-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(133 77 14 / var(--tw-border-opacity, 1))}.metakyc-sdk .dark\\:bg-blue-900\\/20:is(.dark *){background-color:#1e3a8a33}.metakyc-sdk .dark\\:bg-blue-900\\/30:is(.dark *){background-color:#1e3a8a4d}.metakyc-sdk .dark\\:bg-green-900\\/20:is(.dark *){background-color:#14532d33}.metakyc-sdk .dark\\:bg-green-900\\/30:is(.dark *){background-color:#14532d4d}.metakyc-sdk .dark\\:bg-red-900\\/20:is(.dark *){background-color:#7f1d1d33}.metakyc-sdk .dark\\:bg-red-900\\/30:is(.dark *){background-color:#7f1d1d4d}.metakyc-sdk .dark\\:bg-yellow-900\\/20:is(.dark *){background-color:#713f1233}.metakyc-sdk .dark\\:bg-yellow-900\\/30:is(.dark *){background-color:#713f124d}.metakyc-sdk .dark\\:text-blue-100:is(.dark *){--tw-text-opacity: 1;color:rgb(219 234 254 / var(--tw-text-opacity, 1))}.metakyc-sdk .dark\\:text-blue-200:is(.dark *){--tw-text-opacity: 1;color:rgb(191 219 254 / var(--tw-text-opacity, 1))}.metakyc-sdk .dark\\:text-blue-400:is(.dark *){--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.metakyc-sdk .dark\\:text-gray-400:is(.dark *){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.metakyc-sdk .dark\\:text-gray-500:is(.dark *){--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.metakyc-sdk .dark\\:text-green-100:is(.dark *){--tw-text-opacity: 1;color:rgb(220 252 231 / var(--tw-text-opacity, 1))}.metakyc-sdk .dark\\:text-green-200:is(.dark *){--tw-text-opacity: 1;color:rgb(187 247 208 / var(--tw-text-opacity, 1))}.metakyc-sdk .dark\\:text-green-400:is(.dark *){--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.metakyc-sdk .dark\\:text-red-100:is(.dark *){--tw-text-opacity: 1;color:rgb(254 226 226 / var(--tw-text-opacity, 1))}.metakyc-sdk .dark\\:text-red-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 202 202 / var(--tw-text-opacity, 1))}.metakyc-sdk .dark\\:text-red-400:is(.dark *){--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.metakyc-sdk .dark\\:text-white:is(.dark *){--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.metakyc-sdk .dark\\:text-yellow-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 240 138 / var(--tw-text-opacity, 1))}.metakyc-sdk .dark\\:text-yellow-400:is(.dark *){--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}@media (min-width: 768px){.metakyc-sdk .md\\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}',Ct="metakyc-sdk-styles";let yt=!1;function aa(){if(yt||typeof document>"u")return;if(document.getElementById(Ct)){yt=!0;return}const t=document.createElement("style");t.id=Ct,t.textContent=ra,document.head.appendChild(t),yt=!0}const Nt="metakyc-theme-cache",sa=({config:t,children:r})=>{aa();const[a,s]=i.useState(null),n=i.useRef(!1),l=i.useRef(!1),c=i.useMemo(()=>{const y=new Vt(t),p=new Qt(y),k=new Gt(y),I=new Jt(y),w=new Xt(y),E=new Zt(y),T=new er(y),b=new tr(y),C=new rr(y),O=new ar(y),q=new dr(y),F=new fr;if(typeof document<"u")if(t.theme)F.applyTheme(t.theme);else try{const D=localStorage.getItem(Nt);F.applyTheme(D?JSON.parse(D):je)}catch{F.applyTheme(je)}return{httpClient:y,applicantService:p,questionnaireService:k,uploadDocumentService:I,appropriatenessTestService:w,overviewService:E,riskScoringService:T,identityService:b,baseInformationService:C,investorCategorizationService:O,themeService:q,themeManager:F}},[t]),d=i.useMemo(()=>({config:t,...c,currentTheme:a,createOrchestrator:()=>new yr(c.applicantService,c.questionnaireService,c.uploadDocumentService,c.appropriatenessTestService,c.overviewService,c.riskScoringService,c.identityService,c.investorCategorizationService)}),[t,c,a]);return i.useEffect(()=>((async()=>{if(n.current||l.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"),c.themeManager.applyTheme(t.theme),s(c.themeManager.getCurrentTheme()),l.current=!0;return}console.log("[MetaKYC] Fetching theme from backend...");const p=await c.themeService.getThemeConfiguration();c.themeManager.applyTheme(p),s(c.themeManager.getCurrentTheme()),l.current=!0;try{localStorage.setItem(Nt,JSON.stringify(p))}catch{}console.log("[MetaKYC] Theme loaded and applied",p)}catch(p){console.warn("[MetaKYC] Failed to load theme, using default:",p),s(c.themeManager.getCurrentTheme()),l.current=!0}finally{n.current=!1}})(),()=>{c.themeManager.cleanup()}),[]),e.jsxs(bt.Provider,{value:d,children:[t.showVersion&&e.jsxs("div",{style:{fontSize:"0.625rem",color:"var(--metakyc-text-muted, #9ca3af)",opacity:.5,textAlign:"right",padding:"2px 8px",userSelect:"none",pointerEvents:"none",letterSpacing:"0.02em",lineHeight:1},children:["SDK v",kr]}),r]})};function Re(){const t=i.useContext(bt);if(!t)throw new Error("useMetaKYC must be used within a MetaKYCProvider");return t}async function br(t){return new Promise((r,a)=>{const s=new FileReader;s.readAsDataURL(t),s.onload=()=>{const l=s.result.split(",")[1];r(l)},s.onerror=n=>a(n)})}function na(t,r){return t.size<=r}function ia(t,r){return r.split(",").map(s=>s.trim()).some(s=>{if(s.endsWith("/*")){const n=s.slice(0,-2);return t.type.startsWith(n)}return t.type===s})}function mt(t){if(t===0)return"0 Bytes";const r=1024,a=["Bytes","KB","MB","GB"],s=Math.floor(Math.log(t)/Math.log(r));return Math.round(t/Math.pow(r,s)*100)/100+" "+a[s]}function oa(t){return t}function Ce(...t){return t.filter(Boolean).join(" ")}const it={APPLICANT_ID:"metakyc_applicant_id",WORKFLOW_STATE:"metakyc_workflow_state"};function vr(t){try{localStorage.setItem(it.APPLICANT_ID,t.toString())}catch(r){console.warn("Failed to save applicant ID to storage:",r)}}function wr(){try{const t=localStorage.getItem(it.APPLICANT_ID);return t?parseInt(t,10):null}catch(t){return console.warn("Failed to retrieve applicant ID from storage:",t),null}}function jr(){try{localStorage.removeItem(it.APPLICANT_ID)}catch(t){console.warn("Failed to clear applicant ID from storage:",t)}}function Sr(t){try{localStorage.setItem(it.WORKFLOW_STATE,JSON.stringify(t))}catch(r){console.warn("Failed to save workflow state to storage:",r)}}function la(){try{const t=localStorage.getItem(it.WORKFLOW_STATE);return t?JSON.parse(t):null}catch(t){return console.warn("Failed to retrieve workflow state from storage:",t),null}}function Cr(){try{localStorage.removeItem(it.WORKFLOW_STATE)}catch(t){console.warn("Failed to clear workflow state from storage:",t)}}function ca(){jr(),Cr()}function Nr(t){const{createOrchestrator:r}=Re(),[a,s]=i.useState(null),[n,l]=i.useState(!1),[c,d]=i.useState(null),y=i.useRef(null),p=t||wr();i.useEffect(()=>{y.current||(y.current=r())},[r]),i.useEffect(()=>{var F;a&&p&&(vr(p),Sr({applicantId:p,currentStepOrder:(F=a.currentStep)==null?void 0:F.order,status:a.status,lastUpdated:new Date().toISOString(),workflowKey:a.workFlowKey,nextWorkflowKey:a.nextWorkflowKey}))},[a,p]);const k=i.useRef(!1),I=i.useRef(!1),w=i.useCallback(async()=>{if(!(!p||!y.current)){if(k.current){console.log("[Workflow] Load already in progress, skipping...");return}k.current=!0,l(!0),d(null);try{const F=await y.current.initialize(p);s(F),I.current=!0}catch(F){d(F)}finally{l(!1),k.current=!1}}},[p]);i.useEffect(()=>{p&&!I.current&&w()},[p,w]);const E=i.useCallback(async()=>{if(y.current){if(k.current){console.log("[Workflow] Refresh already in progress, skipping...");return}k.current=!0,l(!0),d(null);try{const F=await y.current.refreshProgress();s(F)}catch(F){d(F)}finally{l(!1),k.current=!1}}},[]),T=i.useCallback(async()=>{if(y.current){l(!0),d(null);try{const F=await y.current.moveToNextStep();s(F)}catch(F){d(F)}finally{l(!1)}}},[]),b=i.useCallback(async()=>{if(y.current){l(!0),d(null);try{const F=await y.current.moveToPreviousStep();s(F)}catch(F){d(F)}finally{l(!1)}}},[]),C=i.useCallback(async F=>{if(y.current){l(!0),d(null);try{await y.current.submitCurrentStep(F);const D=await y.current.refreshProgress();s(D)}catch(D){throw d(D),D}finally{l(!1)}}},[]),O=St.useMemo(()=>a!=null&&a.stepInfoList?[...a.stepInfoList].sort((F,D)=>F.order-D.order):[],[a==null?void 0:a.stepInfoList]),q=St.useMemo(()=>a?a.nextWorkflowKey&&a.nextWorkflowKey!==a.workFlowKey:!1,[a]);return{progress:a,applicantId:p,currentStep:(a==null?void 0:a.currentStep)||null,steps:O,status:(a==null?void 0:a.status)||Te.None,workflowResult:(a==null?void 0:a.workflowResult)||null,workflowKey:a==null?void 0:a.workFlowKey,nextWorkflowKey:a==null?void 0:a.nextWorkflowKey,hasWorkflowChanged:q,isLoading:n,error:c,isComplete:(a==null?void 0:a.status)===Te.Finished,isOnHold:(a==null?void 0:a.status)===Te.OnHold,refreshProgress:E,moveToNext:T,moveBack:b,submitCurrentStep:C,orchestrator:y.current}}function Rr(t){const{questionnaireService:r,applicantService:a}=Re(),[s,n]=i.useState(null),[l,c]=i.useState({}),[d,y]=i.useState(!1),[p,k]=i.useState(!1),[I,w]=i.useState(null),E=i.useRef(!1),T=i.useRef(null),b=i.useCallback(async()=>{var O,q;if(t){if(E.current){console.log("[Questionnaire] Load already in progress, skipping...");return}E.current=!0,y(!0),w(null);try{const[F,D]=await Promise.all([r.getQuestionnaire(t),a.getApplicantData(t).catch(()=>null)]);if(n(F),(O=D==null?void 0:D.questionnaireResults)!=null&&O.length&&F){const X=new Map;for(const f of D.questionnaireResults)f.question&&((q=f.answers)!=null&&q.length)&&X.set(f.question.trim().toLowerCase(),f.answers);const re={},N=F.questionGroups.flatMap(f=>f.questions??[]);for(const f of N){const z=f.text.trim().toLowerCase();X.has(z)&&(re[f.id]=X.get(z))}c(re)}T.current=t}catch(F){w(F)}finally{y(!1),E.current=!1}}},[t,r,a]);i.useEffect(()=>{t&&T.current!==t&&b()},[t]);const C=i.useCallback(async O=>{k(!0),w(null);try{return await r.fillQuestionnaire(O)}catch(q){throw w(q),q}finally{k(!1)}},[r]);return{questionnaire:s,initialAnswers:l,isLoading:d,isSubmitting:p,error:I,load:b,submit:C}}function Ir(t){const{uploadDocumentService:r}=Re(),[a,s]=i.useState(null),[n,l]=i.useState(!1),[c,d]=i.useState(!1),[y,p]=i.useState(0),[k,I]=i.useState(null),w=i.useRef(!1),E=i.useRef(null),T=i.useCallback(async()=>{if(t){if(w.current){console.log("[UploadDocument] Load already in progress, skipping...");return}w.current=!0,l(!0),I(null);try{const C=await r.getUploadDocument(t);s(C),E.current=t}catch(C){I(C)}finally{l(!1),w.current=!1}}},[t,r]);i.useEffect(()=>{t&&E.current!==t&&T()},[t]);const b=i.useCallback(async C=>{d(!0),p(0),I(null);try{await r.fillUploadDocument(C),p(100)}catch(O){throw I(O),O}finally{d(!1)}},[r]);return{uploadDocument:a,isLoading:n,isSubmitting:c,uploadProgress:y,error:k,load:T,submit:b}}function da(t){const{appropriatenessTestService:r}=Re(),[a,s]=i.useState(null),[n,l]=i.useState(!1),[c,d]=i.useState(!1),[y,p]=i.useState(null),[k,I]=i.useState(null),w=i.useRef(!1),E=i.useRef(null),T=i.useCallback(async()=>{if(t){if(w.current){console.log("[AppropriatenessTest] Load already in progress, skipping...");return}w.current=!0,l(!0),p(null);try{const C=await r.getAppropriatenessTest(t);s(C),E.current=t}catch(C){p(C)}finally{l(!1),w.current=!1}}},[t,r]);i.useEffect(()=>{t&&E.current!==t&&T()},[t]);const b=i.useCallback(async C=>{d(!0),p(null);try{const O=await r.fillAppropriatenessTest(C);return I(O),O}catch(O){throw p(O),O}finally{d(!1)}},[r]);return{test:a,result:k,isLoading:n,isSubmitting:c,error:y,load:T,submit:b}}function Er(t){const{overviewService:r}=Re(),[a,s]=i.useState(null),[n,l]=i.useState(!1),[c,d]=i.useState(!1),[y,p]=i.useState(null),k=i.useRef(!1),I=i.useRef(null),w=i.useCallback(async()=>{if(t){if(k.current){console.log("[Overview] Load already in progress, skipping...");return}k.current=!0,l(!0),p(null);try{const T=await r.getOverviewData(t);s(T),I.current=t}catch(T){p(T)}finally{l(!1),k.current=!1}}},[t,r]);i.useEffect(()=>{t&&I.current!==t&&w()},[t]);const E=i.useCallback(async()=>{if(t){d(!0),p(null);try{await r.passOverview(t)}catch(T){throw p(T),T}finally{d(!1)}}},[t,r]);return{overview:a,isLoading:n,isSubmitting:c,error:y,load:w,passOverview:E}}function Ar(t){const{identityService:r}=Re(),[a,s]=i.useState(null),[n,l]=i.useState(!1),[c,d]=i.useState(null),y=i.useRef(!1),p=i.useCallback(async(w,E)=>{if(t){if(y.current){console.log("[Identity] Request already in progress, skipping...");return}y.current=!0,l(!0),d(null);try{const T={applicantId:t,restart:!1,redirectUrl:w||"",ttl:E||604800};console.log("Identity request input:",T);const b=await r.identityRequest(T);return console.log("Identity request result:",b),s(b),b}catch(T){throw d(T),T}finally{l(!1),y.current=!1}}},[t,r]),k=i.useCallback(async(w,E)=>{if(t){l(!0),d(null);try{const T={applicantId:t,restart:!1,redirectUrl:w,ttl:E},b=await r.identityCompanyRequest(T);return s(b),b}catch(T){throw d(T),T}finally{l(!1)}}},[t,r]),I=i.useCallback(async()=>{if(t){if(y.current){console.log("[Identity] Restart already in progress, skipping...");return}y.current=!0,l(!0),d(null);try{const w={applicantId:t,restart:!0,redirectUrl:"",ttl:604800};console.log("Restarting identity with input:",w);const E=await r.identityRequest(w);return console.log("Restart identity result:",E),s(E),E}catch(w){throw d(w),w}finally{l(!1),y.current=!1}}},[t,r]);return{identityData:a,provider:(a==null?void 0:a.provider)||null,token:(a==null?void 0:a.publicProviderTokenObject)||null,isLoading:n,error:c,requestIdentity:p,requestCompanyIdentity:k,restartIdentity:I}}function Tr(t){const{riskScoringService:r,applicantService:a}=Re(),[s,n]=i.useState(null),[l,c]=i.useState({}),[d,y]=i.useState(!1),[p,k]=i.useState(!1),[I,w]=i.useState(null),[E,T]=i.useState(null),b=i.useRef(!1),C=i.useRef(null),O=i.useCallback(async()=>{var F;if(t){if(b.current){console.log("[RiskScoring] Load already in progress, skipping...");return}b.current=!0,y(!0),w(null);try{const[D,X]=await Promise.all([r.getRiskCriterias(t),a.getApplicantData(t).catch(()=>null)]);if(n(D),(F=X==null?void 0:X.riskScoringResults)!=null&&F.length){const re=X.riskScoringResults[0],N={};for(const f of re.riskCriteriaResults??[])if(f.riskCriteriaId!=null&&f.answer!=null&&f.answer!==""){const z=[...new Set(f.answer.split(",").map(G=>G.trim()).filter(G=>G!==""))];z.length>0&&(N[f.riskCriteriaId]=z)}c(N)}C.current=t}catch(D){w(D)}finally{y(!1),b.current=!1}}},[t,r,a]);i.useEffect(()=>{t&&C.current!==t&&O()},[t]);const q=i.useCallback(async F=>{k(!0),w(null);try{const D=await r.submitRiskScoring(F);return T(D),D}catch(D){throw w(D),D}finally{k(!1)}},[r]);return{criteria:s,initialAnswers:l,result:E,isLoading:d,isSubmitting:p,error:I,load:O,submit:q}}function vt(){const{applicantService:t,config:r}=Re(),[a,s]=i.useState(!1),[n,l]=i.useState(null),c=i.useRef(!1),d=i.useRef(!1),y=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(E){const T=Math.random()*16|0;return(E==="x"?T:T&3|8).toString(16)}),p=i.useCallback(async E=>{var T;if(c.current)throw console.log("[Applicant] Create already in progress, skipping..."),new Error("Creation already in progress");c.current=!0,s(!0),l(null);try{if(E.applicantAdditionalDatas||(E.applicantAdditionalDatas=[]),(T=r.identityProviders)!=null&&T.sardinai){const C=y();console.log("[SardinAI] Generated session key:",C),E.applicantAdditionalDatas.push({paramName:"sessionKey",value:C})}return await t.createApplicant(E)}catch(b){throw l(b),b}finally{s(!1),c.current=!1}},[t,r]),k=i.useCallback(async E=>{s(!0),l(null);try{return await t.createCompanyApplicant(E)}catch(T){throw l(T),T}finally{s(!1)}},[t]),I=i.useCallback(async E=>{if(d.current)throw console.log("[Applicant] Data load already in progress, skipping..."),new Error("Data load already in progress");d.current=!0,s(!0),l(null);try{return await t.getApplicantData(E)}catch(T){throw l(T),T}finally{s(!1),d.current=!1}},[t]),w=i.useCallback(async E=>{s(!0),l(null);try{await t.stopProgress(E)}catch(T){throw l(T),T}finally{s(!1)}},[t]);return{isLoading:a,error:n,createApplicant:p,createCompanyApplicant:k,getApplicantData:I,stopProgress:w}}const ma={primary:{backgroundColor:"var(--metakyc-primary, #2563eb)",color:"#ffffff",borderColor:"transparent"},secondary:{backgroundColor:"var(--metakyc-surface, #f3f4f6)",color:"var(--metakyc-text-primary, #111827)",borderColor:"var(--metakyc-border, #e5e7eb)"},outline:{backgroundColor:"transparent",color:"var(--metakyc-primary, #2563eb)",borderColor:"var(--metakyc-primary, #2563eb)"},danger:{backgroundColor:"var(--metakyc-danger, #ef4444)",color:"#ffffff",borderColor:"transparent"},ghost:{backgroundColor:"transparent",color:"var(--metakyc-text-secondary, #6b7280)",borderColor:"transparent"}},Q=({children:t,variant:r="primary",size:a="md",isLoading:s=!1,disabled:n,className:l,style:c,...d})=>{const y="inline-flex items-center justify-center rounded-lg font-medium transition-opacity border focus:outline-none focus:ring-2 focus:ring-offset-1 disabled:opacity-50 disabled:cursor-not-allowed",p={sm:"px-3 py-1.5 text-sm",md:"px-4 py-2 text-sm",lg:"px-6 py-3 text-base"},k={sm:{padding:"0.375rem 0.75rem",fontSize:"0.875rem"},md:{padding:"0.5rem 1rem",fontSize:"0.875rem"},lg:{padding:"0.75rem 1.5rem",fontSize:"1rem"}};return e.jsxs("button",{className:Ce(y,p[a],l),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",borderRadius:"0.5rem",fontWeight:500,borderWidth:"1px",borderStyle:"solid",cursor:n||s?"not-allowed":"pointer",opacity:n||s?.5:1,lineHeight:"1.25rem",...k[a],...ma[r],...c},disabled:n||s,...d,children:[s&&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]})},xe=i.forwardRef(({label:t,error:r,helperText:a,leftIcon:s,rightIcon:n,className:l,style:c,...d},y)=>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,d.required&&e.jsx("span",{className:"text-danger-500 ml-1",children:"*"})]}),e.jsxs("div",{className:"relative",children:[s&&e.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:s}),e.jsx("input",{ref:y,className:Ce("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",s?"pl-10":"",n?"pr-10":"",l),style:{minHeight:"38px",backgroundColor:d.readOnly?"var(--metakyc-surface, #f3f4f6)":"var(--metakyc-input-bg, #ffffff)",color:"var(--metakyc-input-text, var(--metakyc-text-primary, #111827))",borderColor:r?"var(--metakyc-danger, #ef4444)":"var(--metakyc-input-border, var(--metakyc-border, #d1d5db))",cursor:d.readOnly?"default":void 0,...c},...d}),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",style:{color:"var(--metakyc-danger, #ef4444)"},children:r}),!r&&a&&e.jsx("p",{className:"mt-1 text-sm",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:a})]}));xe.displayName="Input";const Z=({children:t,className:r,style:a,...s})=>e.jsx("div",{className:Ce("metakyc-card rounded-xl shadow-sm border",r),style:{backgroundColor:"var(--metakyc-surface, #ffffff)",borderColor:"var(--metakyc-border, #e5e7eb)",borderWidth:"1px",borderStyle:"solid",borderRadius:"0.75rem",overflow:"hidden",...a},...s,children:t}),he=({children:t,className:r,style:a,...s})=>e.jsx("div",{className:Ce("px-6 py-4 border-b",r),style:{padding:"1rem 1.5rem",borderBottomWidth:"1px",borderBottomStyle:"solid",borderBottomColor:"var(--metakyc-border, #e5e7eb)",...a},...s,children:t}),ee=({children:t,className:r,style:a,...s})=>e.jsx("div",{className:Ce("px-6 py-4",r),style:{padding:"1rem 1.5rem",...a},...s,children:t}),fe=({children:t,className:r,style:a,...s})=>e.jsx("div",{className:Ce("px-6 py-4 border-t",r),style:{padding:"1rem 1.5rem",borderTopWidth:"1px",borderTopStyle:"solid",borderTopColor:"var(--metakyc-border, #e5e7eb)",...a},...s,children:t}),pa={display:"inline-flex",alignItems:"center",justifyContent:"center",width:16,height:16,minWidth:16,minHeight:16,maxWidth:16,maxHeight:16,borderRadius:4,borderWidth:"1.5px",borderStyle:"solid",cursor:"pointer",flexShrink:0,position:"relative",transition:"background-color 0.15s, border-color 0.15s",boxSizing:"border-box",padding:0,margin:0,verticalAlign:"middle"},Fe=({checked:t,onChange:r,disabled:a,style:s})=>{const n="var(--metakyc-input-border, var(--metakyc-border, #d1d5db))",l="var(--metakyc-input-bg, var(--metakyc-background, #ffffff))",c="var(--metakyc-primary, #2563eb)";return e.jsx("span",{role:"checkbox","aria-checked":t,tabIndex:0,onClick:()=>!a&&r(!t),onKeyDown:d=>{(d.key===" "||d.key==="Enter")&&(d.preventDefault(),a||r(!t))},style:{...pa,backgroundColor:t?c:l,borderColor:t?c:n,opacity:a?.5:1,cursor:a?"not-allowed":"pointer",...s},children:t&&e.jsx("svg",{width:"10",height:"8",viewBox:"0 0 10 8",fill:"none",style:{display:"block",flexShrink:0},children:e.jsx("path",{d:"M1 4L3.5 6.5L9 1",stroke:"#ffffff",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})},ua={default:{backgroundColor:"var(--metakyc-surface, #f3f4f6)",color:"var(--metakyc-text-secondary, #6b7280)"},info:{backgroundColor:"var(--metakyc-input-bg, var(--metakyc-surface, #f9fafb))",color:"var(--metakyc-input-text, var(--metakyc-text-secondary, #6b7280))",border:"1px solid var(--metakyc-input-border, var(--metakyc-border, #e5e7eb))"},success:{backgroundColor:"var(--metakyc-input-bg, var(--metakyc-surface, #f9fafb))",color:"var(--metakyc-input-text, var(--metakyc-text-secondary, #6b7280))",border:"1px solid var(--metakyc-input-border, var(--metakyc-border, #e5e7eb))"},danger:{backgroundColor:"#fee2e2",color:"#991b1b"},warning:{backgroundColor:"#fef3c7",color:"#92400e"}},wt=({children:t,variant:r="default",className:a,style:s,...n})=>e.jsx("span",{className:Ce("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium",a),style:{...ua[r],...s},...n,children:t}),Ee=({size:t="md",className:r,...a})=>{const s={sm:"h-4 w-4",md:"h-8 w-8",lg:"h-12 w-12"};return e.jsx("div",{className:Ce("flex items-center justify-center",r),...a,children:e.jsxs("svg",{className:Ce("animate-spin text-primary-500",s[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"})]})})},ut=i.forwardRef(({label:t,error:r,helperText:a,options:s,placeholder:n,className:l,style:c,...d},y)=>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,d.required&&e.jsx("span",{className:"text-danger-500 ml-1",children:"*"})]}),e.jsxs("select",{ref:y,className:Ce("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":"",l),style:{minHeight:"38px",backgroundColor:"var(--metakyc-input-bg, #ffffff)",color:"var(--metakyc-input-text, var(--metakyc-text-primary, #111827))",borderColor:r?"var(--metakyc-danger, #ef4444)":"var(--metakyc-input-border, var(--metakyc-border, #d1d5db))",...c},...d,children:[n&&e.jsx("option",{value:"",disabled:!0,style:{backgroundColor:"var(--metakyc-input-bg, #ffffff)",color:"var(--metakyc-text-secondary, #6b7280)"},children:n},"__placeholder__"),s.map((p,k)=>e.jsx("option",{value:p.value,disabled:p.disabled,style:{backgroundColor:"var(--metakyc-input-bg, #ffffff)",color:p.disabled?"var(--metakyc-text-muted, #9ca3af)":"var(--metakyc-input-text, var(--metakyc-text-primary, #111827))"},children:p.label},p.value||`option-${k}`))]}),r&&e.jsx("p",{className:"mt-1 text-sm",style:{color:"var(--metakyc-error, #ef4444)"},children:r}),!r&&a&&e.jsx("p",{className:"mt-1 text-sm",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:a})]}));ut.displayName="Select";const Rt=280,Fr=({label:t,value:r,onChange:a,options:s,placeholder:n="Select...",disabled:l=!1,readOnly:c=!1,required:d=!1})=>{const y=l||c,[p,k]=i.useState(!1),[I,w]=i.useState(""),[E,T]=i.useState(null),[b,C]=i.useState({bg:"#ffffff",borderColor:"#d1d5db",textPrimary:"#111827",textSecondary:"#6b7280",primaryColor:"#2563eb",primaryLight:"#eff6ff",hoverBg:"#f9fafb"}),O=i.useRef(null),q=i.useRef(null),F=i.useRef(null),D=i.useCallback(()=>{if(!q.current)return null;const A=q.current.getBoundingClientRect(),$=window.innerHeight-A.bottom<Rt&&A.top>Rt;return{top:$?A.top:A.bottom+4,left:A.left,width:A.width,openUp:$}},[]),X=i.useCallback(()=>{const A=getComputedStyle(document.querySelector(".metakyc-sdk")||document.documentElement),W=(_,ue)=>A.getPropertyValue(_).trim()||ue,$=W("--metakyc-input-bg",W("--metakyc-background","#ffffff"));C({bg:$,borderColor:W("--metakyc-input-border",W("--metakyc-border","#d1d5db")),textPrimary:W("--metakyc-input-text",W("--metakyc-text-primary","#111827")),textSecondary:W("--metakyc-text-secondary","#6b7280"),primaryColor:W("--metakyc-primary","#2563eb"),primaryLight:W("--metakyc-primary-light","#eff6ff"),hoverBg:W("--metakyc-surface",$)})},[]),re=i.useCallback(()=>{if(y)return;X();const A=D();A&&T(A),k(!0)},[y,D,X]),N=i.useCallback(()=>{k(!1),w("")},[]);i.useEffect(()=>{if(!p)return;const A=W=>{var _,ue;const $=W.target;!((_=O.current)!=null&&_.contains($))&&!((ue=F.current)!=null&&ue.contains($))&&N()};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[p,N]),i.useEffect(()=>{if(!p)return;const A=()=>{const W=D();W&&T(W)};return window.addEventListener("scroll",A,!0),window.addEventListener("resize",A),()=>{window.removeEventListener("scroll",A,!0),window.removeEventListener("resize",A)}},[p,D]);const f=s.filter(A=>A.label.toLowerCase().includes(I.toLowerCase())),z=A=>{y||a(r.includes(A)?r.filter(W=>W!==A):[...r,A])},G=(A,W)=>{W.stopPropagation(),y||a(r.filter($=>$!==A))},Y=A=>{var W;return((W=s.find($=>$.value===A))==null?void 0:W.label)||A},{bg:B,borderColor:V,textPrimary:ae,textSecondary:K,primaryColor:ke,primaryLight:oe,hoverBg:de}=b,ge=p&&E&&e.jsxs("div",{ref:F,className:"metakyc-multiselect-dropdown",style:{position:"fixed",top:E.openUp?void 0:E.top,bottom:E.openUp?window.innerHeight-E.top+4:void 0,left:E.left,width:E.width,zIndex:99999,borderRadius:"8px",boxShadow:"0 4px 16px rgba(0,0,0,0.18)",border:`1px solid ${V}`,backgroundColor:B,overflow:"hidden"},children:[e.jsx("div",{style:{padding:"8px",borderBottom:`1px solid ${V}`},children:e.jsx("input",{type:"text",value:I,onChange:A=>w(A.target.value),placeholder:"Search...",autoFocus:!0,onClick:A=>A.stopPropagation(),className:"metakyc-multiselect-search w-full",style:{display:"block",width:"100%",padding:"6px 8px",fontSize:"13px",borderRadius:"6px",border:`1px solid ${V}`,backgroundColor:B,color:ae,outline:"none",boxSizing:"border-box"},onFocus:A=>{const W=getComputedStyle(document.querySelector(".metakyc-sdk")||document.documentElement),$=W.getPropertyValue("--metakyc-input-border-focus").trim()||W.getPropertyValue("--metakyc-primary").trim()||"#2563eb";A.currentTarget.style.backgroundColor=B,A.currentTarget.style.color=ae,A.currentTarget.style.borderColor=$,A.currentTarget.style.outline="none",A.currentTarget.style.boxShadow=`0 0 0 2px ${$}33`},onBlur:A=>{A.currentTarget.style.backgroundColor=B,A.currentTarget.style.color=ae,A.currentTarget.style.borderColor=V,A.currentTarget.style.outline="none",A.currentTarget.style.boxShadow="none"}})}),e.jsx("ul",{style:{listStyle:"none",margin:0,padding:"4px 0",maxHeight:"192px",overflowY:"auto"},children:f.length===0?e.jsx("li",{style:{padding:"8px 12px",fontSize:"13px",color:K},children:"No results"}):f.map(A=>{const W=r.includes(A.value);return e.jsxs("li",{onClick:()=>z(A.value),className:"metakyc-multiselect-option",style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 12px",fontSize:"13px",cursor:"pointer",backgroundColor:W?oe:"transparent",color:W?ke:ae,userSelect:"none"},onMouseEnter:$=>{W||($.currentTarget.style.backgroundColor=de)},onMouseLeave:$=>{W||($.currentTarget.style.backgroundColor="transparent")},children:[e.jsx(Fe,{checked:W,onChange:()=>{}}),e.jsx("span",{children:A.label})]},A.value)})}),r.length>0&&e.jsx("div",{style:{padding:"6px 12px",borderTop:`1px solid ${V}`},children:e.jsxs("button",{type:"button",onClick:()=>{a([]),w("")},style:{fontSize:"12px",color:"#ef4444",background:"none",border:"none",cursor:"pointer",padding:0},children:["Clear all (",r.length," selected)"]})})]});return e.jsxs("div",{className:"w-full metakyc-multiselect",ref:O,children:[t&&e.jsxs("label",{className:"block text-sm font-medium mb-1",style:{color:"var(--metakyc-text-primary, #374151)"},children:[t,d&&e.jsx("span",{style:{color:"var(--metakyc-error, #ef4444)",marginLeft:"4px"},children:"*"})]}),e.jsxs("div",{ref:q,onClick:()=>p?N():re(),className:Ce("metakyc-multiselect-trigger","w-full px-3 py-2 rounded-lg border text-sm transition-colors relative",y?"opacity-50 cursor-not-allowed":"cursor-pointer"),style:{minHeight:"38px",backgroundColor:"var(--metakyc-input-bg, #ffffff)",borderColor:p?"var(--metakyc-input-border-focus, var(--metakyc-primary, #2563eb))":"var(--metakyc-input-border, var(--metakyc-border, #d1d5db))",outline:p?"2px solid var(--metakyc-input-border-focus, var(--metakyc-primary, #2563eb))":"none",outlineOffset:"-1px"},children:[r.length===0?e.jsx("span",{className:"metakyc-multiselect-placeholder leading-6",style:{color:"var(--metakyc-text-secondary, #9ca3af)"},children:n}):e.jsx("div",{className:"flex flex-wrap gap-1 pr-6",children:r.map(A=>e.jsxs("span",{className:"metakyc-multiselect-chip inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-medium",style:{backgroundColor:"var(--metakyc-primary-light, #eff6ff)",color:"var(--metakyc-primary, #2563eb)"},children:[Y(A),!y&&e.jsx("button",{type:"button",onClick:W=>G(A,W),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:"×"})]},A))}),e.jsx("span",{className:"metakyc-multiselect-arrow absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none text-xs",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:p?"▲":"▼"})]}),typeof document<"u"&&ge?pt.createPortal(ge,document.body):null]})},It=260,ze=({label:t,error:r,helperText:a,options:s,placeholder:n="Select...",value:l,onChange:c,disabled:d=!1,readOnly:y=!1,required:p=!1,className:k})=>{var ue;const I=d||y,[w,E]=i.useState(!1),[T,b]=i.useState(""),[C,O]=i.useState(null),[q,F]=i.useState({bg:"#ffffff",border:"#d1d5db",text:"#111827",textSecondary:"#6b7280",primary:"#2563eb",primaryLight:"#eff6ff",hoverBg:"#f9fafb"}),D=i.useCallback(()=>{const R=getComputedStyle(document.querySelector(".metakyc-sdk")||document.documentElement),te=(se,be)=>R.getPropertyValue(se).trim()||be,me=te("--metakyc-input-bg",te("--metakyc-background","#ffffff"));F({bg:me,border:te("--metakyc-input-border",te("--metakyc-border","#d1d5db")),text:te("--metakyc-input-text",te("--metakyc-text-primary","#111827")),textSecondary:te("--metakyc-text-secondary","#6b7280"),primary:te("--metakyc-primary","#2563eb"),primaryLight:te("--metakyc-primary-light","#eff6ff"),hoverBg:te("--metakyc-surface",me)})},[]),X=i.useRef(null),re=i.useRef(null),N=i.useRef(null),f=i.useRef(null),z=i.useCallback(()=>{if(!re.current)return null;const R=re.current.getBoundingClientRect(),me=window.innerHeight-R.bottom<It&&R.top>It;return{top:me?R.top:R.bottom+4,left:R.left,width:R.width,openUp:me}},[]),G=i.useCallback(()=>{if(I)return;D();const R=z();R&&O(R),E(!0)},[I,z,D]),Y=i.useCallback(()=>{E(!1),b("")},[]),B=()=>w?Y():G();i.useEffect(()=>{if(!w)return;const R=te=>{var se,be;const me=te.target;!((se=X.current)!=null&&se.contains(me))&&!((be=N.current)!=null&&be.contains(me))&&Y()};return document.addEventListener("mousedown",R),()=>document.removeEventListener("mousedown",R)},[w,Y]),i.useEffect(()=>{if(!w)return;const R=()=>{const te=z();te&&O(te)};return window.addEventListener("scroll",R,!0),window.addEventListener("resize",R),()=>{window.removeEventListener("scroll",R,!0),window.removeEventListener("resize",R)}},[w,z]),i.useEffect(()=>{w&&f.current&&setTimeout(()=>{var R;return(R=f.current)==null?void 0:R.focus()},0)},[w]);const V=s.filter(R=>R.label.toLowerCase().includes(T.toLowerCase())||R.value.toLowerCase().includes(T.toLowerCase())),ae=(ue=s.find(R=>R.value===l))==null?void 0:ue.label,K=(R,te)=>{I||te||(c(R),Y())},{bg:ke,border:oe,text:de,textSecondary:ge,primary:A,primaryLight:W,hoverBg:$}=q,_=w&&C&&e.jsxs("div",{ref:N,className:"metakyc-searchable-select-dropdown",style:{position:"fixed",top:C.openUp?void 0:C.top,bottom:C.openUp?window.innerHeight-C.top+4:void 0,left:C.left,width:C.width,zIndex:99999,borderRadius:"8px",boxShadow:"0 4px 16px rgba(0,0,0,0.18)",border:`1px solid ${oe}`,backgroundColor:ke,overflow:"hidden"},children:[e.jsx("div",{style:{padding:"8px",borderBottom:`1px solid ${oe}`},children:e.jsx("input",{ref:f,type:"text",value:T,onChange:R=>b(R.target.value),placeholder:"Search...",onClick:R=>R.stopPropagation(),className:"metakyc-searchable-select-search w-full",style:{display:"block",width:"100%",padding:"6px 8px",fontSize:"13px",borderRadius:"6px",border:`1px solid ${oe}`,backgroundColor:ke,color:de,outline:"none",boxSizing:"border-box"},onFocus:R=>{const te=getComputedStyle(document.querySelector(".metakyc-sdk")||document.documentElement),me=te.getPropertyValue("--metakyc-input-border-focus").trim()||te.getPropertyValue("--metakyc-primary").trim()||"#2563eb";R.currentTarget.style.backgroundColor=ke,R.currentTarget.style.color=de,R.currentTarget.style.borderColor=me,R.currentTarget.style.outline="none",R.currentTarget.style.boxShadow=`0 0 0 2px ${me}33`},onBlur:R=>{R.currentTarget.style.backgroundColor=ke,R.currentTarget.style.color=de,R.currentTarget.style.borderColor=oe,R.currentTarget.style.outline="none",R.currentTarget.style.boxShadow="none"}})}),e.jsx("ul",{style:{listStyle:"none",margin:0,padding:"4px 0",maxHeight:"208px",overflowY:"auto"},children:V.length===0?e.jsx("li",{style:{padding:"8px 12px",fontSize:"13px",color:ge},children:"No results"}):V.map(R=>{const te=R.value===l;return e.jsx("li",{className:"metakyc-searchable-select-option",onClick:()=>K(R.value,R.disabled),style:{padding:"8px 12px",fontSize:"13px",cursor:R.disabled?"not-allowed":"pointer",opacity:R.disabled?.4:1,backgroundColor:te?W:"transparent",color:te?A:de,userSelect:"none"},onMouseEnter:me=>{!te&&!R.disabled&&(me.currentTarget.style.backgroundColor=$)},onMouseLeave:me=>{te||(me.currentTarget.style.backgroundColor="transparent")},children:R.label},R.value)})})]});return e.jsxs("div",{className:Ce("w-full metakyc-searchable-select",k),ref:X,children:[t&&e.jsxs("label",{className:"block text-sm font-medium mb-1",style:{color:"var(--metakyc-text-primary, #374151)"},children:[t,p&&e.jsx("span",{style:{color:"var(--metakyc-error, #ef4444)",marginLeft:"4px"},children:"*"})]}),e.jsxs("div",{ref:re,role:"button",tabIndex:I?-1:0,onClick:B,onKeyDown:R=>{(R.key==="Enter"||R.key===" ")&&(R.preventDefault(),B()),R.key==="Escape"&&Y()},className:Ce("metakyc-searchable-select-trigger","w-full px-3 py-2 rounded-lg border text-sm transition-colors text-left","flex items-center justify-between gap-2","focus:outline-none",I?"opacity-60 cursor-not-allowed":"cursor-pointer"),style:{backgroundColor:"var(--metakyc-input-bg, #ffffff)",color:ae?"var(--metakyc-input-text, var(--metakyc-text-primary, #111827))":"var(--metakyc-input-placeholder, var(--metakyc-text-muted, #9ca3af))",borderColor:r?"var(--metakyc-danger, #ef4444)":w?"var(--metakyc-input-border-focus, var(--metakyc-primary, #2563eb))":"var(--metakyc-input-border, var(--metakyc-border, #d1d5db))",minHeight:"38px",outline:w?"2px solid var(--metakyc-input-border-focus, var(--metakyc-primary, #2563eb))":"none",outlineOffset:"-1px"},children:[e.jsx("span",{className:"truncate flex-1",children:ae||n}),e.jsx("span",{className:"flex-shrink-0 text-xs pointer-events-none",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:w?"▲":"▼"})]}),typeof document<"u"&&_?pt.createPortal(_,document.body):null,r&&e.jsx("p",{className:"mt-1 text-sm",style:{color:"var(--metakyc-error, #ef4444)"},children:r}),!r&&a&&e.jsx("p",{className:"mt-1 text-sm",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:a})]})};ze.displayName="SearchableSelect";function ya(t){const r=t.type;return r.startsWith("image/")?"image":r==="application/pdf"?"pdf":"file"}const Pr=({label:t,subtitle:r,error:a,accept:s,multiple:n=!1,maxSize:l,required:c,onChange:d,value:y=[],className:p})=>{const[k,I]=i.useState(!1),[w,E]=i.useState(null),T=i.useRef(null),b=i.useCallback(N=>{if(!N)return;E(null);const f=Array.from(N);if(l&&f.filter(G=>G.size>l).length>0){E(`File exceeds the maximum size of ${mt(l)}`);return}d==null||d(n?[...y,...f]:[f[0]])},[l,n,d,y]),C=i.useCallback(N=>{N.preventDefault(),N.stopPropagation(),I(!0)},[]),O=i.useCallback(N=>{N.preventDefault(),N.stopPropagation(),I(!1)},[]),q=i.useCallback(N=>{N.preventDefault(),N.stopPropagation(),I(!1),b(N.dataTransfer.files)},[b]),F=()=>{var N;(N=T.current)==null||N.click()},D=N=>{E(null);const f=y.filter((z,G)=>G!==N);d==null||d(f)},X=a||w,re=y.length>0;return e.jsxs("div",{className:Ce("metakyc-file-upload",p),style:{width:"100%"},children:[t&&e.jsxs("div",{style:{marginBottom:"8px"},children:[e.jsxs("label",{style:{display:"block",fontSize:"14px",fontWeight:600,color:"var(--metakyc-text-primary, #111827)"},children:[t,c&&e.jsx("span",{style:{color:"var(--metakyc-danger, #ef4444)",marginLeft:"2px"},children:"*"})]}),r&&e.jsx("p",{style:{fontSize:"13px",color:"var(--metakyc-text-muted, #9ca3af)",marginTop:"2px"},children:r})]}),e.jsxs("div",{className:"metakyc-file-dropzone",onClick:F,onDragOver:C,onDragLeave:O,onDrop:q,style:{border:`2px dashed ${X?"var(--metakyc-danger, #ef4444)":k?"var(--metakyc-primary, #2563eb)":"var(--metakyc-border, #d1d5db)"}`,borderRadius:"12px",padding:re?"20px":"32px 20px",textAlign:"center",cursor:"pointer",transition:"all 0.2s ease",backgroundColor:k?"color-mix(in srgb, var(--metakyc-primary, #2563eb) 5%, var(--metakyc-background, #ffffff))":"var(--metakyc-background, #ffffff)"},children:[e.jsx("input",{ref:T,type:"file",style:{display:"none"},accept:s,multiple:n,onChange:N=>{b(N.target.files),N.target.value=""}}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"12px"},children:[e.jsx("div",{style:{width:"48px",height:"48px",borderRadius:"12px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:k?"color-mix(in srgb, var(--metakyc-primary, #2563eb) 15%, transparent)":"var(--metakyc-surface, #f9fafb)",transition:"background-color 0.2s ease"},children:e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:k?"var(--metakyc-primary, #2563eb)":"var(--metakyc-text-muted, #9ca3af)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{transition:"stroke 0.2s ease"},children:[e.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),e.jsx("polyline",{points:"17 8 12 3 7 8"}),e.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]})}),e.jsxs("div",{children:[e.jsxs("p",{style:{fontSize:"14px",color:"var(--metakyc-text-secondary, #6b7280)",margin:0},children:[e.jsx("span",{style:{fontWeight:600,color:"var(--metakyc-primary, #2563eb)"},children:"Click to upload"})," ","or drag and drop"]}),(s||l)&&e.jsxs("p",{style:{fontSize:"12px",color:"var(--metakyc-text-muted, #9ca3af)",marginTop:"4px"},children:[s&&e.jsx("span",{children:s}),s&&l&&e.jsx("span",{children:" · "}),l&&e.jsxs("span",{children:["Max ",mt(l)]})]})]})]})]}),re&&e.jsx("div",{style:{marginTop:"12px",display:"flex",flexDirection:"column",gap:"8px"},children:y.map((N,f)=>{const z=ya(N),G=z==="image",Y=G?URL.createObjectURL(N):null;return e.jsxs("div",{className:"metakyc-file-item",style:{display:"flex",alignItems:"center",gap:"12px",padding:"10px 12px",borderRadius:"10px",backgroundColor:"var(--metakyc-surface, #f9fafb)",border:"1px solid var(--metakyc-border, #e5e7eb)",transition:"background-color 0.15s ease"},children:[e.jsx("div",{style:{width:"40px",height:"40px",borderRadius:"8px",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",backgroundColor:G?"transparent":"color-mix(in srgb, var(--metakyc-primary, #2563eb) 10%, transparent)"},children:G&&Y?e.jsx("img",{src:Y,alt:N.name,style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:"8px"}}):z==="pdf"?e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--metakyc-danger, #ef4444)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("polyline",{points:"14 2 14 8 20 8"}),e.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),e.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),e.jsx("polyline",{points:"10 9 9 9 8 9"})]}):e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--metakyc-primary, #2563eb)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("polyline",{points:"14 2 14 8 20 8"})]})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("p",{style:{fontSize:"13px",fontWeight:500,color:"var(--metakyc-text-primary, #111827)",margin:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:N.name}),e.jsx("p",{style:{fontSize:"12px",color:"var(--metakyc-text-muted, #9ca3af)",margin:0,marginTop:"2px"},children:mt(N.size)})]}),e.jsx("button",{type:"button",onClick:B=>{B.stopPropagation(),D(f)},style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"6px",border:"none",backgroundColor:"transparent",color:"var(--metakyc-text-muted, #9ca3af)",cursor:"pointer",flexShrink:0,transition:"all 0.15s ease",padding:0},onMouseEnter:B=>{B.currentTarget.style.backgroundColor="color-mix(in srgb, var(--metakyc-danger, #ef4444) 10%, transparent)",B.currentTarget.style.color="var(--metakyc-danger, #ef4444)"},onMouseLeave:B=>{B.currentTarget.style.backgroundColor="transparent",B.currentTarget.style.color="var(--metakyc-text-muted, #9ca3af)"},children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},`${N.name}-${f}`)})}),X&&e.jsx("p",{style:{fontSize:"13px",color:"var(--metakyc-danger, #ef4444)",marginTop:"6px"},children:X})]})},Lr=i.forwardRef(({countryCode:t="+1",onCountryCodeChange:r,className:a,...s},n)=>e.jsxs("div",{className:"w-full",children:[s.label&&e.jsxs("label",{className:"block text-sm font-medium mb-1",style:{color:"var(--metakyc-text-primary, #374151)"},children:[s.label,s.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:l=>r==null?void 0:r(l.target.value),className:Ce("w-20 rounded-lg border px-3 py-2 text-sm","focus:outline-none focus:ring-2 focus:ring-offset-0"),style:{minHeight:"38px",backgroundColor:"var(--metakyc-input-bg, #ffffff)",color:"var(--metakyc-text-primary, #111827)",borderColor:"var(--metakyc-border, #d1d5db)"},placeholder:"+1"}),e.jsx(xe,{ref:n,type:"tel",className:Ce("flex-1",a),...s,label:""})]}),s.error&&e.jsx("p",{className:"mt-1 text-sm text-danger-500",children:s.error})]}));Lr.displayName="PhoneInput";/**
74
+ `;this.themeStyleElement=document.createElement("style"),this.themeStyleElement.id="metakyc-theme-vars",this.themeStyleElement.textContent=c,(d=this.customStyleElement)!=null&&d.parentNode?document.head.insertBefore(this.themeStyleElement,this.customStyleElement):document.head.appendChild(this.themeStyleElement)}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 a;return{name:r.name||je.name,title:r.title||je.title,logo:{...je.logo,...r.logo},colors:{...je.colors,...r.colors},typography:r.typography?{...je.typography,...r.typography}:je.typography,spacing:r.spacing?{...je.spacing,...r.spacing}:je.spacing,customCSS:r.customCSS,darkMode:r.darkMode?{colors:{...(a=je.darkMode)==null?void 0:a.colors,...r.darkMode.colors}}:je.darkMode,applicantFormVisibleFields:r.applicantFormVisibleFields,applicantFormRequiredFields:r.applicantFormRequiredFields,allowedLanguages:r.allowedLanguages,applicantFormPages:r.applicantFormPages,reviewPageFields:r.reviewPageFields,reviewPageDisabled:r.reviewPageDisabled,fieldLabelMode:r.fieldLabelMode,companyFormVisibleFields:r.companyFormVisibleFields,companyFormRequiredFields:r.companyFormRequiredFields,companyFormPages:r.companyFormPages,companyReviewPageFields:r.companyReviewPageFields}}getCurrentTheme(){return this.currentTheme}resetTheme(){this.applyTheme(je)}cleanup(){this.themeStyleElement&&(this.themeStyleElement.remove(),this.themeStyleElement=null),this.customStyleElement&&(this.customStyleElement.remove(),this.customStyleElement=null)}kebabCase(r){return r.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}}const bt=i.createContext(null),kr="1.0.21",ra='.metakyc-sdk .pointer-events-none{pointer-events:none}.metakyc-sdk .visible{visibility:visible}.metakyc-sdk .static{position:static}.metakyc-sdk .fixed{position:fixed}.metakyc-sdk .absolute{position:absolute}.metakyc-sdk .relative{position:relative}.metakyc-sdk .inset-y-0{top:0;bottom:0}.metakyc-sdk .left-0{left:0}.metakyc-sdk .right-0{right:0}.metakyc-sdk .right-3{right:.75rem}.metakyc-sdk .top-1\\/2{top:50%}.metakyc-sdk .mx-4{margin-left:1rem;margin-right:1rem}.metakyc-sdk .mx-6{margin-left:1.5rem;margin-right:1.5rem}.metakyc-sdk .mx-auto{margin-left:auto;margin-right:auto}.metakyc-sdk .my-8{margin-top:2rem;margin-bottom:2rem}.metakyc-sdk .-ml-1{margin-left:-.25rem}.metakyc-sdk .mb-0\\.5{margin-bottom:.125rem}.metakyc-sdk .mb-1{margin-bottom:.25rem}.metakyc-sdk .mb-2{margin-bottom:.5rem}.metakyc-sdk .mb-3{margin-bottom:.75rem}.metakyc-sdk .mb-4{margin-bottom:1rem}.metakyc-sdk .mb-6{margin-bottom:1.5rem}.metakyc-sdk .ml-0\\.5{margin-left:.125rem}.metakyc-sdk .ml-1{margin-left:.25rem}.metakyc-sdk .ml-3{margin-left:.75rem}.metakyc-sdk .mr-2{margin-right:.5rem}.metakyc-sdk .mr-3{margin-right:.75rem}.metakyc-sdk .mt-0\\.5{margin-top:.125rem}.metakyc-sdk .mt-1{margin-top:.25rem}.metakyc-sdk .mt-2{margin-top:.5rem}.metakyc-sdk .mt-3{margin-top:.75rem}.metakyc-sdk .mt-4{margin-top:1rem}.metakyc-sdk .mt-6{margin-top:1.5rem}.metakyc-sdk .block{display:block}.metakyc-sdk .inline-block{display:inline-block}.metakyc-sdk .inline{display:inline}.metakyc-sdk .flex{display:flex}.metakyc-sdk .inline-flex{display:inline-flex}.metakyc-sdk .grid{display:grid}.metakyc-sdk .hidden{display:none}.metakyc-sdk .h-12{height:3rem}.metakyc-sdk .h-16{height:4rem}.metakyc-sdk .h-24{height:6rem}.metakyc-sdk .h-4{height:1rem}.metakyc-sdk .h-6{height:1.5rem}.metakyc-sdk .h-8{height:2rem}.metakyc-sdk .h-full{height:100%}.metakyc-sdk .max-h-52{max-height:13rem}.metakyc-sdk .min-h-\\[400px\\]{min-height:400px}.metakyc-sdk .w-12{width:3rem}.metakyc-sdk .w-16{width:4rem}.metakyc-sdk .w-20{width:5rem}.metakyc-sdk .w-24{width:6rem}.metakyc-sdk .w-4{width:1rem}.metakyc-sdk .w-6{width:1.5rem}.metakyc-sdk .w-8{width:2rem}.metakyc-sdk .w-full{width:100%}.metakyc-sdk .max-w-md{max-width:28rem}.metakyc-sdk .flex-1{flex:1 1 0%}.metakyc-sdk .flex-shrink-0{flex-shrink:0}.metakyc-sdk .-translate-y-1\\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.metakyc-sdk .transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes spin{to{transform:rotate(360deg)}}.metakyc-sdk .animate-spin{animation:spin 1s linear infinite}.metakyc-sdk .cursor-not-allowed{cursor:not-allowed}.metakyc-sdk .cursor-pointer{cursor:pointer}.metakyc-sdk .resize{resize:both}.metakyc-sdk .list-inside{list-style-position:inside}.metakyc-sdk .list-disc{list-style-type:disc}.metakyc-sdk .list-none{list-style-type:none}.metakyc-sdk .grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.metakyc-sdk .grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.metakyc-sdk .flex-col{flex-direction:column}.metakyc-sdk .flex-wrap{flex-wrap:wrap}.metakyc-sdk .items-start{align-items:flex-start}.metakyc-sdk .items-center{align-items:center}.metakyc-sdk .justify-center{justify-content:center}.metakyc-sdk .justify-between{justify-content:space-between}.metakyc-sdk .gap-1{gap:.25rem}.metakyc-sdk .gap-1\\.5{gap:.375rem}.metakyc-sdk .gap-2{gap:.5rem}.metakyc-sdk .gap-4{gap:1rem}.metakyc-sdk :is(.space-x-3>:not([hidden])~:not([hidden])){--tw-space-x-reverse: 0;margin-right:calc(.75rem * var(--tw-space-x-reverse));margin-left:calc(.75rem * calc(1 - var(--tw-space-x-reverse)))}.metakyc-sdk :is(.space-y-1>:not([hidden])~:not([hidden])){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.metakyc-sdk :is(.space-y-1\\.5>:not([hidden])~:not([hidden])){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.metakyc-sdk :is(.space-y-2>:not([hidden])~:not([hidden])){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.metakyc-sdk :is(.space-y-4>:not([hidden])~:not([hidden])){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.metakyc-sdk :is(.space-y-6>:not([hidden])~:not([hidden])){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.metakyc-sdk :is(.space-y-8>:not([hidden])~:not([hidden])){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.metakyc-sdk .truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.metakyc-sdk .rounded{border-radius:.25rem}.metakyc-sdk .rounded-full{border-radius:9999px}.metakyc-sdk .rounded-lg{border-radius:.5rem}.metakyc-sdk .rounded-xl{border-radius:.75rem}.metakyc-sdk .border{border-width:1px}.metakyc-sdk .border-0{border-width:0px}.metakyc-sdk .border-2{border-width:2px}.metakyc-sdk .border-b{border-bottom-width:1px}.metakyc-sdk .border-t{border-top-width:1px}.metakyc-sdk .border-blue-200{--tw-border-opacity: 1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1))}.metakyc-sdk .border-danger-500{border-color:var(--metakyc-danger, #EF4444)}.metakyc-sdk .border-green-200{--tw-border-opacity: 1;border-color:rgb(187 247 208 / var(--tw-border-opacity, 1))}.metakyc-sdk .border-red-200{--tw-border-opacity: 1;border-color:rgb(254 202 202 / var(--tw-border-opacity, 1))}.metakyc-sdk .border-yellow-200{--tw-border-opacity: 1;border-color:rgb(254 240 138 / var(--tw-border-opacity, 1))}.metakyc-sdk .bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.metakyc-sdk .bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.metakyc-sdk .bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.metakyc-sdk .bg-green-50{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.metakyc-sdk .bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.metakyc-sdk .bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.metakyc-sdk .bg-yellow-100{--tw-bg-opacity: 1;background-color:rgb(254 249 195 / var(--tw-bg-opacity, 1))}.metakyc-sdk .bg-yellow-50{--tw-bg-opacity: 1;background-color:rgb(254 252 232 / var(--tw-bg-opacity, 1))}.metakyc-sdk .p-3{padding:.75rem}.metakyc-sdk .p-4{padding:1rem}.metakyc-sdk .px-2{padding-left:.5rem;padding-right:.5rem}.metakyc-sdk .px-2\\.5{padding-left:.625rem;padding-right:.625rem}.metakyc-sdk .px-3{padding-left:.75rem;padding-right:.75rem}.metakyc-sdk .px-4{padding-left:1rem;padding-right:1rem}.metakyc-sdk .px-6{padding-left:1.5rem;padding-right:1.5rem}.metakyc-sdk .py-0\\.5{padding-top:.125rem;padding-bottom:.125rem}.metakyc-sdk .py-1\\.5{padding-top:.375rem;padding-bottom:.375rem}.metakyc-sdk .py-12{padding-top:3rem;padding-bottom:3rem}.metakyc-sdk .py-2{padding-top:.5rem;padding-bottom:.5rem}.metakyc-sdk .py-3{padding-top:.75rem;padding-bottom:.75rem}.metakyc-sdk .py-4{padding-top:1rem;padding-bottom:1rem}.metakyc-sdk .py-8{padding-top:2rem;padding-bottom:2rem}.metakyc-sdk .pb-4{padding-bottom:1rem}.metakyc-sdk .pl-10{padding-left:2.5rem}.metakyc-sdk .pl-3{padding-left:.75rem}.metakyc-sdk .pr-10{padding-right:2.5rem}.metakyc-sdk .pr-3{padding-right:.75rem}.metakyc-sdk .pr-6{padding-right:1.5rem}.metakyc-sdk .pt-6{padding-top:1.5rem}.metakyc-sdk .text-left{text-align:left}.metakyc-sdk .text-center{text-align:center}.metakyc-sdk .text-right{text-align:right}.metakyc-sdk .text-2xl{font-size:1.5rem;line-height:2rem}.metakyc-sdk .text-3xl{font-size:1.875rem;line-height:2.25rem}.metakyc-sdk .text-5xl{font-size:3rem;line-height:1}.metakyc-sdk .text-base{font-size:1rem;line-height:1.5rem}.metakyc-sdk .text-lg{font-size:1.125rem;line-height:1.75rem}.metakyc-sdk .text-sm{font-size:.875rem;line-height:1.25rem}.metakyc-sdk .text-xl{font-size:1.25rem;line-height:1.75rem}.metakyc-sdk .text-xs{font-size:.75rem;line-height:1rem}.metakyc-sdk .font-bold{font-weight:700}.metakyc-sdk .font-medium{font-weight:500}.metakyc-sdk .font-semibold{font-weight:600}.metakyc-sdk .uppercase{text-transform:uppercase}.metakyc-sdk .lowercase{text-transform:lowercase}.metakyc-sdk .tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.metakyc-sdk .leading-6{line-height:1.5rem}.metakyc-sdk .text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.metakyc-sdk .text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.metakyc-sdk .text-blue-900{--tw-text-opacity: 1;color:rgb(30 58 138 / var(--tw-text-opacity, 1))}.metakyc-sdk .text-danger-500{color:var(--metakyc-danger, #EF4444)}.metakyc-sdk .text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.metakyc-sdk .text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.metakyc-sdk .text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.metakyc-sdk .text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.metakyc-sdk .text-green-800{--tw-text-opacity: 1;color:rgb(22 101 52 / var(--tw-text-opacity, 1))}.metakyc-sdk .text-green-900{--tw-text-opacity: 1;color:rgb(20 83 45 / var(--tw-text-opacity, 1))}.metakyc-sdk .text-primary,.metakyc-sdk .text-primary-500{color:var(--metakyc-primary, #3B82F6)}.metakyc-sdk .text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.metakyc-sdk .text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.metakyc-sdk .text-red-800{--tw-text-opacity: 1;color:rgb(153 27 27 / var(--tw-text-opacity, 1))}.metakyc-sdk .text-red-900{--tw-text-opacity: 1;color:rgb(127 29 29 / var(--tw-text-opacity, 1))}.metakyc-sdk .text-secondary{color:var(--metakyc-secondary, #64748b)}.metakyc-sdk .text-yellow-700{--tw-text-opacity: 1;color:rgb(161 98 7 / var(--tw-text-opacity, 1))}.metakyc-sdk .text-yellow-800{--tw-text-opacity: 1;color:rgb(133 77 14 / var(--tw-text-opacity, 1))}.metakyc-sdk .underline{text-decoration-line:underline}.metakyc-sdk .opacity-25{opacity:.25}.metakyc-sdk .opacity-50{opacity:.5}.metakyc-sdk .opacity-60{opacity:.6}.metakyc-sdk .opacity-75{opacity:.75}.metakyc-sdk .shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.metakyc-sdk .outline{outline-style:solid}.metakyc-sdk .blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.metakyc-sdk .filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.metakyc-sdk .transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.metakyc-sdk .transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.metakyc-sdk .transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.metakyc-sdk .transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.metakyc-sdk .duration-200{transition-duration:.2s}.metakyc-sdk .grid{display:grid!important}.metakyc-sdk .flex{display:flex!important}.metakyc-sdk .inline-flex{display:inline-flex!important}.metakyc-sdk .hidden{display:none!important}.metakyc-sdk .block{display:block!important}.metakyc-sdk .grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))!important}.metakyc-sdk .grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))!important}.metakyc-sdk .grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))!important}.metakyc-sdk .grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))!important}.metakyc-sdk .col-span-1{grid-column:span 1 / span 1!important}.metakyc-sdk .col-span-2{grid-column:span 2 / span 2!important}.metakyc-sdk .col-span-3{grid-column:span 3 / span 3!important}.metakyc-sdk .col-span-4{grid-column:span 4 / span 4!important}.metakyc-sdk .gap-1{gap:.25rem!important}.metakyc-sdk .gap-2{gap:.5rem!important}.metakyc-sdk .gap-3{gap:.75rem!important}.metakyc-sdk .gap-4{gap:1rem!important}.metakyc-sdk .gap-6{gap:1.5rem!important}.metakyc-sdk .gap-8{gap:2rem!important}.metakyc-sdk .flex-col{flex-direction:column!important}.metakyc-sdk .flex-row{flex-direction:row!important}.metakyc-sdk .flex-wrap{flex-wrap:wrap!important}.metakyc-sdk .flex-1{flex:1 1 0%!important}.metakyc-sdk .flex-shrink-0{flex-shrink:0!important}.metakyc-sdk .items-center{align-items:center!important}.metakyc-sdk .items-start{align-items:flex-start!important}.metakyc-sdk .items-end{align-items:flex-end!important}.metakyc-sdk .justify-between{justify-content:space-between!important}.metakyc-sdk .justify-center{justify-content:center!important}.metakyc-sdk .justify-end{justify-content:flex-end!important}.metakyc-sdk .justify-start{justify-content:flex-start!important}.metakyc-sdk .space-y-1>*+*{margin-top:.25rem!important}.metakyc-sdk .space-y-1\\.5>*+*{margin-top:.375rem!important}.metakyc-sdk .space-y-2>*+*{margin-top:.5rem!important}.metakyc-sdk .space-y-3>*+*{margin-top:.75rem!important}.metakyc-sdk .space-y-4>*+*{margin-top:1rem!important}.metakyc-sdk .space-y-6>*+*{margin-top:1.5rem!important}.metakyc-sdk .w-full{width:100%!important}.metakyc-sdk .relative{position:relative!important}.metakyc-sdk .absolute{position:absolute!important}.metakyc-sdk .overflow-hidden{overflow:hidden!important}.metakyc-sdk .overflow-auto{overflow:auto!important}.metakyc-sdk .overflow-x-auto{overflow-x:auto!important}@media (min-width: 768px){.metakyc-sdk .md\\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))!important}.metakyc-sdk .md\\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))!important}}.metakyc-sdk *,.metakyc-sdk *:before,.metakyc-sdk *:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:var(--metakyc-border, #e5e7eb)}.metakyc-sdk{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4}.metakyc-sdk img,.metakyc-sdk video{max-width:100%;height:auto}.metakyc-sdk h1,.metakyc-sdk h2,.metakyc-sdk h3,.metakyc-sdk h4,.metakyc-sdk h5,.metakyc-sdk h6,.metakyc-sdk p{margin:0}.metakyc-sdk ol,.metakyc-sdk ul{list-style:none;margin:0;padding:0}.metakyc-sdk button,.metakyc-sdk input,.metakyc-sdk optgroup,.metakyc-sdk select,.metakyc-sdk textarea{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}.metakyc-sdk button,.metakyc-sdk [role=button]{cursor:pointer}.metakyc-sdk a{color:inherit;text-decoration:inherit}.metakyc-sdk input:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=range]),.metakyc-sdk select,.metakyc-sdk textarea,.metakyc-sdk .metakyc-searchable-select-trigger,.metakyc-sdk .metakyc-multiselect-trigger{background-color:var(--metakyc-input-bg, var(--metakyc-background, #ffffff))!important;color:var(--metakyc-input-text, var(--metakyc-text-primary, #111827))!important;border-color:var(--metakyc-input-border, var(--metakyc-border, #d1d5db))!important}.metakyc-sdk input::-moz-placeholder,.metakyc-sdk textarea::-moz-placeholder{color:var(--metakyc-input-placeholder, var(--metakyc-text-muted, #9ca3af))!important;opacity:1!important}.metakyc-sdk input::placeholder,.metakyc-sdk textarea::placeholder{color:var(--metakyc-input-placeholder, var(--metakyc-text-muted, #9ca3af))!important;opacity:1!important}.metakyc-sdk input:not([type=checkbox]):not([type=radio]):focus,.metakyc-sdk select:focus,.metakyc-sdk textarea:focus{outline:none!important;border-color:var(--metakyc-input-border-focus, var(--metakyc-primary, #2563eb))!important;box-shadow:0 0 0 2px color-mix(in srgb,var(--metakyc-input-border-focus, var(--metakyc-primary, #2563eb)) 20%,transparent)!important}.metakyc-sdk input[type=checkbox],.metakyc-sdk input[type=radio]{appearance:none!important;-webkit-appearance:none!important;-moz-appearance:none!important;width:16px!important;height:16px!important;min-width:16px!important;min-height:16px!important;max-width:16px!important;max-height:16px!important;flex-shrink:0!important;cursor:pointer!important;background-color:var(--metakyc-input-bg, var(--metakyc-background, #ffffff))!important;border:1.5px solid var(--metakyc-input-border, var(--metakyc-border, #d1d5db))!important;position:relative!important;transition:background-color .15s,border-color .15s!important;vertical-align:middle!important;display:inline-block!important;padding:0!important;margin:0!important;color-scheme:light!important}.metakyc-sdk input[type=checkbox]{border-radius:4px!important}.metakyc-sdk input[type=radio]{border-radius:50%!important}.metakyc-sdk input[type=checkbox]:checked,.metakyc-sdk input[type=radio]:checked{background-color:var(--metakyc-primary, #2563eb)!important;border-color:var(--metakyc-primary, #2563eb)!important}.metakyc-sdk input[type=checkbox]:checked:after{content:""!important;display:block!important;position:absolute!important;left:4px!important;top:1px!important;width:5px!important;height:9px!important;border:2px solid #ffffff!important;border-top:none!important;border-left:none!important;transform:rotate(45deg)!important}.metakyc-sdk input[type=radio]:checked:after{content:""!important;display:block!important;position:absolute!important;left:50%!important;top:50%!important;transform:translate(-50%,-50%)!important;width:6px!important;height:6px!important;border-radius:50%!important;background:#fff!important}.metakyc-sdk input[type=checkbox]:focus,.metakyc-sdk input[type=radio]:focus{outline:none!important;box-shadow:0 0 0 2px color-mix(in srgb,var(--metakyc-primary, #2563eb) 30%,transparent)!important}.metakyc-searchable-select-dropdown,.metakyc-multiselect-dropdown{background-color:var(--metakyc-input-bg, var(--metakyc-background, #ffffff))!important;border-color:var(--metakyc-input-border, var(--metakyc-border, #d1d5db))!important;color:var(--metakyc-input-text, var(--metakyc-text-primary, #111827))!important}.metakyc-searchable-select-dropdown input,.metakyc-multiselect-dropdown input{background-color:var(--metakyc-input-bg, var(--metakyc-background, #ffffff))!important;color:var(--metakyc-input-text, var(--metakyc-text-primary, #111827))!important;border-color:var(--metakyc-input-border, var(--metakyc-border, #d1d5db))!important}.metakyc-searchable-select-dropdown input::-moz-placeholder,.metakyc-multiselect-dropdown input::-moz-placeholder{color:var(--metakyc-input-placeholder, var(--metakyc-text-muted, #9ca3af))!important;opacity:1!important}.metakyc-searchable-select-dropdown input::placeholder,.metakyc-multiselect-dropdown input::placeholder{color:var(--metakyc-input-placeholder, var(--metakyc-text-muted, #9ca3af))!important;opacity:1!important}.metakyc-searchable-select-dropdown input:focus,.metakyc-multiselect-dropdown input:focus{outline:none!important;background-color:var(--metakyc-input-bg, var(--metakyc-background, #ffffff))!important;color:var(--metakyc-input-text, var(--metakyc-text-primary, #111827))!important;border-color:var(--metakyc-input-border-focus, var(--metakyc-primary, #2563eb))!important;box-shadow:0 0 0 2px color-mix(in srgb,var(--metakyc-input-border-focus, var(--metakyc-primary, #2563eb)) 20%,transparent)!important}.metakyc-searchable-select-dropdown li:hover,.metakyc-multiselect-dropdown li:hover{background-color:var(--metakyc-surface, var(--metakyc-background, #f9fafb))!important}.metakyc-sdk .metakyc-help-btn{color:var(--metakyc-primary, #2563eb)!important;border-color:var(--metakyc-primary, #2563eb)!important;background:transparent!important;position:relative!important;z-index:2!important}.metakyc-sdk .metakyc-overview-step-item,.metakyc-sdk .metakyc-overview-step-item *,.metakyc-sdk .metakyc-step-content,.metakyc-sdk .metakyc-step-content *,.metakyc-sdk .metakyc-step-title,.metakyc-sdk .metakyc-step-title *,.metakyc-sdk .metakyc-step-icon,.metakyc-sdk .metakyc-step-icon *,.metakyc-sdk .metakyc-step-description,.metakyc-sdk .metakyc-step-description *{border-top-width:0!important;border-bottom-width:0!important;border-left-width:0!important;border-right-width:0!important;border-top-style:none!important;border-bottom-style:none!important;border-left-style:none!important;border-right-style:none!important;border-top-color:transparent!important;border-bottom-color:transparent!important;border-left-color:transparent!important;border-right-color:transparent!important;border:0!important;box-shadow:none!important;outline:none!important;outline-width:0!important;outline-style:none!important;text-decoration:none!important;text-decoration-line:none!important}.metakyc-sdk .metakyc-overview-step-item:before,.metakyc-sdk .metakyc-overview-step-item:after,.metakyc-sdk .metakyc-overview-step-item *:before,.metakyc-sdk .metakyc-overview-step-item *:after,.metakyc-sdk .metakyc-step-content:before,.metakyc-sdk .metakyc-step-content:after,.metakyc-sdk .metakyc-step-content *:before,.metakyc-sdk .metakyc-step-content *:after,.metakyc-sdk .metakyc-step-title:before,.metakyc-sdk .metakyc-step-title:after,.metakyc-sdk .metakyc-step-description:before,.metakyc-sdk .metakyc-step-description:after{content:none!important;display:none!important;visibility:hidden!important;border:none!important;box-shadow:none!important;outline:none!important;background:none!important;height:0!important;width:0!important}.metakyc-sdk .metakyc-overview-step-item{border-width:0!important;border-style:none!important;border:0!important;box-shadow:none!important;outline:none!important}.metakyc-sdk .metakyc-step-content{border-width:0!important;border-style:none!important;border:0!important;padding-top:0!important;margin-top:0!important;box-shadow:none!important;outline:none!important}.metakyc-sdk .metakyc-step-title{border-width:0!important;border-style:none!important;border:0!important;padding-top:0!important;margin-top:0!important;box-shadow:none!important;outline:none!important;text-decoration:none!important}.metakyc-sdk hr,.metakyc-sdk .metakyc-overview-step-item hr,.metakyc-sdk .metakyc-overview-step-item * hr,.metakyc-sdk .metakyc-step-content hr,.metakyc-sdk .metakyc-step-content * hr{display:block!important;height:0!important;border:0!important;border-top:1px solid var(--metakyc-primary, #2563eb)!important;opacity:.25!important;margin:1rem 0!important;overflow:visible!important}.metakyc-sdk{background-color:var(--metakyc-background, #ffffff)!important;color:var(--metakyc-text-primary, #111827)!important;font-family:var(--metakyc-font-family, inherit)!important;padding:1.5rem!important;border-radius:.75rem!important}.metakyc-sdk h1,.metakyc-sdk h2,.metakyc-sdk h3,.metakyc-sdk h4,.metakyc-sdk h5,.metakyc-sdk h6{color:var(--metakyc-text-primary, #111827);letter-spacing:normal}.metakyc-sdk .text-gray-900{color:var(--metakyc-text-primary, #111827)!important}.metakyc-sdk .text-gray-800{color:var(--metakyc-text-primary, #1f2937)!important}.metakyc-sdk .text-gray-700{color:var(--metakyc-text-secondary, #374151)!important}.metakyc-sdk .text-gray-600{color:var(--metakyc-text-secondary, #6b7280)!important}.metakyc-sdk .text-gray-500{color:var(--metakyc-text-muted, #6b7280)!important}.metakyc-sdk .text-gray-400{color:var(--metakyc-text-muted, #9ca3af)!important}.metakyc-sdk .text-gray-300{color:var(--metakyc-text-muted, #d1d5db)!important}.metakyc-sdk .text-white{color:#fff!important}.metakyc-sdk .bg-white{background-color:var(--metakyc-background, #ffffff)!important}.metakyc-sdk .bg-gray-50{background-color:var(--metakyc-surface, #f9fafb)!important}.metakyc-sdk .bg-gray-100{background-color:var(--metakyc-surface, #f3f4f6)!important}.metakyc-sdk .bg-gray-200{background-color:var(--metakyc-border, #e5e7eb)!important}.metakyc-sdk .bg-gray-800{background-color:var(--metakyc-surface, #1f2937)!important}.metakyc-sdk .border-gray-100,.metakyc-sdk .border-gray-200,.metakyc-sdk .border-gray-300{border-color:var(--metakyc-border, #e5e7eb)!important}.metakyc-sdk .border-t{border-top-color:var(--metakyc-border, #e5e7eb)!important}.metakyc-sdk .border-b{border-bottom-color:var(--metakyc-border, #e5e7eb)!important}.metakyc-sdk .divide-gray-200>*{border-color:var(--metakyc-border, #e5e7eb)!important}.metakyc-sdk .bg-primary-500,.metakyc-sdk .bg-primary-600{background-color:var(--metakyc-primary, #2563eb)!important}.metakyc-sdk .bg-primary-50,.metakyc-sdk .bg-primary-100{background-color:var(--metakyc-primary-light, #dbeafe)!important}.metakyc-sdk .text-primary-500,.metakyc-sdk .text-primary-600,.metakyc-sdk .text-primary-800{color:var(--metakyc-primary, #2563eb)!important}.metakyc-sdk .text-primary-900{color:var(--metakyc-primary-dark, #1e40af)!important}.metakyc-sdk .border-primary-500,.metakyc-sdk .border-primary-600{border-color:var(--metakyc-primary, #2563eb)!important}.metakyc-sdk .hover\\:bg-primary-50:hover{background-color:var(--metakyc-primary-light, #dbeafe)!important}.metakyc-sdk .hover\\:bg-primary-600:hover{background-color:var(--metakyc-primary-hover, #1d4ed8)!important}.metakyc-sdk .bg-blue-600{background-color:var(--metakyc-primary, #2563eb)!important}.metakyc-sdk .bg-blue-100{background-color:var(--metakyc-primary-light, #dbeafe)!important}.metakyc-sdk .text-blue-600,.metakyc-sdk .text-blue-400{color:var(--metakyc-primary, #2563eb)!important}.metakyc-sdk .hover\\:bg-blue-700:hover{background-color:var(--metakyc-primary-hover, #1d4ed8)!important}.metakyc-sdk .metakyc-overview-steps h3:before,.metakyc-sdk .metakyc-overview-steps h3:after{content:none!important;display:none!important}.metakyc-sdk .metakyc-overview-steps *:before,.metakyc-sdk .metakyc-overview-steps *:after{content:none!important;display:none!important}.metakyc-sdk .metakyc-stepper-scroll::-webkit-scrollbar{display:none!important;height:0!important;width:0!important}.metakyc-sdk .metakyc-file-dropzone:hover{border-color:var(--metakyc-primary, #2563eb)!important;background-color:color-mix(in srgb,var(--metakyc-primary, #2563eb) 3%,var(--metakyc-background, #ffffff))!important}.metakyc-sdk .metakyc-file-item:hover{background-color:color-mix(in srgb,var(--metakyc-surface, #f9fafb) 80%,var(--metakyc-border, #e5e7eb))!important}.metakyc-sdk .metakyc-file-upload label{color:var(--metakyc-text-primary, #111827)!important}.metakyc-sdk .metakyc-file-upload p{margin:0!important;line-height:1.4!important}.metakyc-sdk .metakyc-file-item button{background:transparent!important;border:none!important;box-shadow:none!important;outline:none!important}.metakyc-sdk .metakyc-file-dropzone{box-shadow:none!important;outline:none!important}.metakyc-sdk .hover\\:opacity-90:hover{opacity:.9}.metakyc-sdk .focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.metakyc-sdk .focus\\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.metakyc-sdk .focus\\:ring-offset-0:focus{--tw-ring-offset-width: 0px}.metakyc-sdk .focus\\:ring-offset-1:focus{--tw-ring-offset-width: 1px}.metakyc-sdk .disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.metakyc-sdk .disabled\\:opacity-50:disabled{opacity:.5}.metakyc-sdk .disabled\\:opacity-60:disabled{opacity:.6}.metakyc-sdk .dark\\:border-blue-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(30 64 175 / var(--tw-border-opacity, 1))}.metakyc-sdk .dark\\:border-green-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(22 101 52 / var(--tw-border-opacity, 1))}.metakyc-sdk .dark\\:border-red-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(153 27 27 / var(--tw-border-opacity, 1))}.metakyc-sdk .dark\\:border-yellow-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(133 77 14 / var(--tw-border-opacity, 1))}.metakyc-sdk .dark\\:bg-blue-900\\/20:is(.dark *){background-color:#1e3a8a33}.metakyc-sdk .dark\\:bg-blue-900\\/30:is(.dark *){background-color:#1e3a8a4d}.metakyc-sdk .dark\\:bg-green-900\\/20:is(.dark *){background-color:#14532d33}.metakyc-sdk .dark\\:bg-green-900\\/30:is(.dark *){background-color:#14532d4d}.metakyc-sdk .dark\\:bg-red-900\\/20:is(.dark *){background-color:#7f1d1d33}.metakyc-sdk .dark\\:bg-red-900\\/30:is(.dark *){background-color:#7f1d1d4d}.metakyc-sdk .dark\\:bg-yellow-900\\/20:is(.dark *){background-color:#713f1233}.metakyc-sdk .dark\\:bg-yellow-900\\/30:is(.dark *){background-color:#713f124d}.metakyc-sdk .dark\\:text-blue-100:is(.dark *){--tw-text-opacity: 1;color:rgb(219 234 254 / var(--tw-text-opacity, 1))}.metakyc-sdk .dark\\:text-blue-200:is(.dark *){--tw-text-opacity: 1;color:rgb(191 219 254 / var(--tw-text-opacity, 1))}.metakyc-sdk .dark\\:text-blue-400:is(.dark *){--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.metakyc-sdk .dark\\:text-gray-400:is(.dark *){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.metakyc-sdk .dark\\:text-gray-500:is(.dark *){--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.metakyc-sdk .dark\\:text-green-100:is(.dark *){--tw-text-opacity: 1;color:rgb(220 252 231 / var(--tw-text-opacity, 1))}.metakyc-sdk .dark\\:text-green-200:is(.dark *){--tw-text-opacity: 1;color:rgb(187 247 208 / var(--tw-text-opacity, 1))}.metakyc-sdk .dark\\:text-green-400:is(.dark *){--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.metakyc-sdk .dark\\:text-red-100:is(.dark *){--tw-text-opacity: 1;color:rgb(254 226 226 / var(--tw-text-opacity, 1))}.metakyc-sdk .dark\\:text-red-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 202 202 / var(--tw-text-opacity, 1))}.metakyc-sdk .dark\\:text-red-400:is(.dark *){--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.metakyc-sdk .dark\\:text-white:is(.dark *){--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.metakyc-sdk .dark\\:text-yellow-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 240 138 / var(--tw-text-opacity, 1))}.metakyc-sdk .dark\\:text-yellow-400:is(.dark *){--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}@media (min-width: 768px){.metakyc-sdk .md\\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}',Ct="metakyc-sdk-styles";let yt=!1;function aa(){if(yt||typeof document>"u")return;if(document.getElementById(Ct)){yt=!0;return}const t=document.createElement("style");t.id=Ct,t.textContent=ra,document.head.appendChild(t),yt=!0}const Nt="metakyc-theme-cache",sa=({config:t,children:r})=>{aa();const[a,s]=i.useState(null),n=i.useRef(!1),l=i.useRef(!1),c=i.useMemo(()=>{const y=new Vt(t),p=new Qt(y),k=new Gt(y),I=new Jt(y),w=new Xt(y),A=new Zt(y),T=new er(y),b=new tr(y),S=new rr(y),O=new ar(y),q=new dr(y),F=new fr;if(typeof document<"u")if(t.theme)F.applyTheme(t.theme);else try{const D=localStorage.getItem(Nt);F.applyTheme(D?JSON.parse(D):je)}catch{F.applyTheme(je)}return{httpClient:y,applicantService:p,questionnaireService:k,uploadDocumentService:I,appropriatenessTestService:w,overviewService:A,riskScoringService:T,identityService:b,baseInformationService:S,investorCategorizationService:O,themeService:q,themeManager:F}},[t]),d=i.useMemo(()=>({config:t,...c,currentTheme:a,createOrchestrator:()=>new yr(c.applicantService,c.questionnaireService,c.uploadDocumentService,c.appropriatenessTestService,c.overviewService,c.riskScoringService,c.identityService,c.investorCategorizationService)}),[t,c,a]);return i.useEffect(()=>((async()=>{if(n.current||l.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"),c.themeManager.applyTheme(t.theme),s(c.themeManager.getCurrentTheme()),l.current=!0;return}console.log("[MetaKYC] Fetching theme from backend...");const p=await c.themeService.getThemeConfiguration();c.themeManager.applyTheme(p),s(c.themeManager.getCurrentTheme()),l.current=!0;try{localStorage.setItem(Nt,JSON.stringify(p))}catch{}console.log("[MetaKYC] Theme loaded and applied",p)}catch(p){console.warn("[MetaKYC] Failed to load theme, using default:",p),s(c.themeManager.getCurrentTheme()),l.current=!0}finally{n.current=!1}})(),()=>{c.themeManager.cleanup()}),[]),e.jsxs(bt.Provider,{value:d,children:[t.showVersion&&e.jsxs("div",{style:{fontSize:"0.625rem",color:"var(--metakyc-text-muted, #9ca3af)",opacity:.5,textAlign:"right",padding:"2px 8px",userSelect:"none",pointerEvents:"none",letterSpacing:"0.02em",lineHeight:1},children:["SDK v",kr]}),r]})};function Re(){const t=i.useContext(bt);if(!t)throw new Error("useMetaKYC must be used within a MetaKYCProvider");return t}async function br(t){return new Promise((r,a)=>{const s=new FileReader;s.readAsDataURL(t),s.onload=()=>{const l=s.result.split(",")[1];r(l)},s.onerror=n=>a(n)})}function na(t,r){return t.size<=r}function ia(t,r){return r.split(",").map(s=>s.trim()).some(s=>{if(s.endsWith("/*")){const n=s.slice(0,-2);return t.type.startsWith(n)}return t.type===s})}function mt(t){if(t===0)return"0 Bytes";const r=1024,a=["Bytes","KB","MB","GB"],s=Math.floor(Math.log(t)/Math.log(r));return Math.round(t/Math.pow(r,s)*100)/100+" "+a[s]}function oa(t){return t}function Ce(...t){return t.filter(Boolean).join(" ")}const it={APPLICANT_ID:"metakyc_applicant_id",WORKFLOW_STATE:"metakyc_workflow_state"};function vr(t){try{localStorage.setItem(it.APPLICANT_ID,t.toString())}catch(r){console.warn("Failed to save applicant ID to storage:",r)}}function wr(){try{const t=localStorage.getItem(it.APPLICANT_ID);return t?parseInt(t,10):null}catch(t){return console.warn("Failed to retrieve applicant ID from storage:",t),null}}function jr(){try{localStorage.removeItem(it.APPLICANT_ID)}catch(t){console.warn("Failed to clear applicant ID from storage:",t)}}function Sr(t){try{localStorage.setItem(it.WORKFLOW_STATE,JSON.stringify(t))}catch(r){console.warn("Failed to save workflow state to storage:",r)}}function la(){try{const t=localStorage.getItem(it.WORKFLOW_STATE);return t?JSON.parse(t):null}catch(t){return console.warn("Failed to retrieve workflow state from storage:",t),null}}function Cr(){try{localStorage.removeItem(it.WORKFLOW_STATE)}catch(t){console.warn("Failed to clear workflow state from storage:",t)}}function ca(){jr(),Cr()}function Nr(t){const{createOrchestrator:r}=Re(),[a,s]=i.useState(null),[n,l]=i.useState(!1),[c,d]=i.useState(null),y=i.useRef(null),p=t||wr();i.useEffect(()=>{y.current||(y.current=r())},[r]),i.useEffect(()=>{var F;a&&p&&(vr(p),Sr({applicantId:p,currentStepOrder:(F=a.currentStep)==null?void 0:F.order,status:a.status,lastUpdated:new Date().toISOString(),workflowKey:a.workFlowKey,nextWorkflowKey:a.nextWorkflowKey}))},[a,p]);const k=i.useRef(!1),I=i.useRef(!1),w=i.useCallback(async()=>{if(!(!p||!y.current)){if(k.current){console.log("[Workflow] Load already in progress, skipping...");return}k.current=!0,l(!0),d(null);try{const F=await y.current.initialize(p);s(F),I.current=!0}catch(F){d(F)}finally{l(!1),k.current=!1}}},[p]);i.useEffect(()=>{p&&!I.current&&w()},[p,w]);const A=i.useCallback(async()=>{if(y.current){if(k.current){console.log("[Workflow] Refresh already in progress, skipping...");return}k.current=!0,l(!0),d(null);try{const F=await y.current.refreshProgress();s(F)}catch(F){d(F)}finally{l(!1),k.current=!1}}},[]),T=i.useCallback(async()=>{if(y.current){l(!0),d(null);try{const F=await y.current.moveToNextStep();s(F)}catch(F){d(F)}finally{l(!1)}}},[]),b=i.useCallback(async()=>{if(y.current){l(!0),d(null);try{const F=await y.current.moveToPreviousStep();s(F)}catch(F){d(F)}finally{l(!1)}}},[]),S=i.useCallback(async F=>{if(y.current){l(!0),d(null);try{await y.current.submitCurrentStep(F);const D=await y.current.refreshProgress();s(D)}catch(D){throw d(D),D}finally{l(!1)}}},[]),O=St.useMemo(()=>a!=null&&a.stepInfoList?[...a.stepInfoList].sort((F,D)=>F.order-D.order):[],[a==null?void 0:a.stepInfoList]),q=St.useMemo(()=>a?a.nextWorkflowKey&&a.nextWorkflowKey!==a.workFlowKey:!1,[a]);return{progress:a,applicantId:p,currentStep:(a==null?void 0:a.currentStep)||null,steps:O,status:(a==null?void 0:a.status)||Te.None,workflowResult:(a==null?void 0:a.workflowResult)||null,workflowKey:a==null?void 0:a.workFlowKey,nextWorkflowKey:a==null?void 0:a.nextWorkflowKey,hasWorkflowChanged:q,isLoading:n,error:c,isComplete:(a==null?void 0:a.status)===Te.Finished,isOnHold:(a==null?void 0:a.status)===Te.OnHold,refreshProgress:A,moveToNext:T,moveBack:b,submitCurrentStep:S,orchestrator:y.current}}function Rr(t){const{questionnaireService:r,applicantService:a}=Re(),[s,n]=i.useState(null),[l,c]=i.useState({}),[d,y]=i.useState(!1),[p,k]=i.useState(!1),[I,w]=i.useState(null),A=i.useRef(!1),T=i.useRef(null),b=i.useCallback(async()=>{var O,q;if(t){if(A.current){console.log("[Questionnaire] Load already in progress, skipping...");return}A.current=!0,y(!0),w(null);try{const[F,D]=await Promise.all([r.getQuestionnaire(t),a.getApplicantData(t).catch(()=>null)]);if(n(F),(O=D==null?void 0:D.questionnaireResults)!=null&&O.length&&F){const X=new Map;for(const h of D.questionnaireResults)h.question&&((q=h.answers)!=null&&q.length)&&X.set(h.question.trim().toLowerCase(),h.answers);const re={},N=F.questionGroups.flatMap(h=>h.questions??[]);for(const h of N){const z=h.text.trim().toLowerCase();X.has(z)&&(re[h.id]=X.get(z))}c(re)}T.current=t}catch(F){w(F)}finally{y(!1),A.current=!1}}},[t,r,a]);i.useEffect(()=>{t&&T.current!==t&&b()},[t]);const S=i.useCallback(async O=>{k(!0),w(null);try{return await r.fillQuestionnaire(O)}catch(q){throw w(q),q}finally{k(!1)}},[r]);return{questionnaire:s,initialAnswers:l,isLoading:d,isSubmitting:p,error:I,load:b,submit:S}}function Ir(t){const{uploadDocumentService:r}=Re(),[a,s]=i.useState(null),[n,l]=i.useState(!1),[c,d]=i.useState(!1),[y,p]=i.useState(0),[k,I]=i.useState(null),w=i.useRef(!1),A=i.useRef(null),T=i.useCallback(async()=>{if(t){if(w.current){console.log("[UploadDocument] Load already in progress, skipping...");return}w.current=!0,l(!0),I(null);try{const S=await r.getUploadDocument(t);s(S),A.current=t}catch(S){I(S)}finally{l(!1),w.current=!1}}},[t,r]);i.useEffect(()=>{t&&A.current!==t&&T()},[t]);const b=i.useCallback(async S=>{d(!0),p(0),I(null);try{await r.fillUploadDocument(S),p(100)}catch(O){throw I(O),O}finally{d(!1)}},[r]);return{uploadDocument:a,isLoading:n,isSubmitting:c,uploadProgress:y,error:k,load:T,submit:b}}function da(t){const{appropriatenessTestService:r}=Re(),[a,s]=i.useState(null),[n,l]=i.useState(!1),[c,d]=i.useState(!1),[y,p]=i.useState(null),[k,I]=i.useState(null),w=i.useRef(!1),A=i.useRef(null),T=i.useCallback(async()=>{if(t){if(w.current){console.log("[AppropriatenessTest] Load already in progress, skipping...");return}w.current=!0,l(!0),p(null);try{const S=await r.getAppropriatenessTest(t);s(S),A.current=t}catch(S){p(S)}finally{l(!1),w.current=!1}}},[t,r]);i.useEffect(()=>{t&&A.current!==t&&T()},[t]);const b=i.useCallback(async S=>{d(!0),p(null);try{const O=await r.fillAppropriatenessTest(S);return I(O),O}catch(O){throw p(O),O}finally{d(!1)}},[r]);return{test:a,result:k,isLoading:n,isSubmitting:c,error:y,load:T,submit:b}}function Er(t){const{overviewService:r}=Re(),[a,s]=i.useState(null),[n,l]=i.useState(!1),[c,d]=i.useState(!1),[y,p]=i.useState(null),k=i.useRef(!1),I=i.useRef(null),w=i.useCallback(async()=>{if(t){if(k.current){console.log("[Overview] Load already in progress, skipping...");return}k.current=!0,l(!0),p(null);try{const T=await r.getOverviewData(t);s(T),I.current=t}catch(T){p(T)}finally{l(!1),k.current=!1}}},[t,r]);i.useEffect(()=>{t&&I.current!==t&&w()},[t]);const A=i.useCallback(async()=>{if(t){d(!0),p(null);try{await r.passOverview(t)}catch(T){throw p(T),T}finally{d(!1)}}},[t,r]);return{overview:a,isLoading:n,isSubmitting:c,error:y,load:w,passOverview:A}}function Ar(t){const{identityService:r}=Re(),[a,s]=i.useState(null),[n,l]=i.useState(!1),[c,d]=i.useState(null),y=i.useRef(!1),p=i.useCallback(async(w,A)=>{if(t){if(y.current){console.log("[Identity] Request already in progress, skipping...");return}y.current=!0,l(!0),d(null);try{const T={applicantId:t,restart:!1,redirectUrl:w||"",ttl:A||604800};console.log("Identity request input:",T);const b=await r.identityRequest(T);return console.log("Identity request result:",b),s(b),b}catch(T){throw d(T),T}finally{l(!1),y.current=!1}}},[t,r]),k=i.useCallback(async(w,A)=>{if(t){l(!0),d(null);try{const T={applicantId:t,restart:!1,redirectUrl:w,ttl:A},b=await r.identityCompanyRequest(T);return s(b),b}catch(T){throw d(T),T}finally{l(!1)}}},[t,r]),I=i.useCallback(async()=>{if(t){if(y.current){console.log("[Identity] Restart already in progress, skipping...");return}y.current=!0,l(!0),d(null);try{const w={applicantId:t,restart:!0,redirectUrl:"",ttl:604800};console.log("Restarting identity with input:",w);const A=await r.identityRequest(w);return console.log("Restart identity result:",A),s(A),A}catch(w){throw d(w),w}finally{l(!1),y.current=!1}}},[t,r]);return{identityData:a,provider:(a==null?void 0:a.provider)||null,token:(a==null?void 0:a.publicProviderTokenObject)||null,isLoading:n,error:c,requestIdentity:p,requestCompanyIdentity:k,restartIdentity:I}}function Tr(t){const{riskScoringService:r,applicantService:a}=Re(),[s,n]=i.useState(null),[l,c]=i.useState({}),[d,y]=i.useState(!1),[p,k]=i.useState(!1),[I,w]=i.useState(null),[A,T]=i.useState(null),b=i.useRef(!1),S=i.useRef(null),O=i.useCallback(async()=>{var F;if(t){if(b.current){console.log("[RiskScoring] Load already in progress, skipping...");return}b.current=!0,y(!0),w(null);try{const[D,X]=await Promise.all([r.getRiskCriterias(t),a.getApplicantData(t).catch(()=>null)]);if(n(D),(F=X==null?void 0:X.riskScoringResults)!=null&&F.length){const re=X.riskScoringResults[0],N={};for(const h of re.riskCriteriaResults??[])if(h.riskCriteriaId!=null&&h.answer!=null&&h.answer!==""){const z=[...new Set(h.answer.split(",").map(G=>G.trim()).filter(G=>G!==""))];z.length>0&&(N[h.riskCriteriaId]=z)}c(N)}S.current=t}catch(D){w(D)}finally{y(!1),b.current=!1}}},[t,r,a]);i.useEffect(()=>{t&&S.current!==t&&O()},[t]);const q=i.useCallback(async F=>{k(!0),w(null);try{const D=await r.submitRiskScoring(F);return T(D),D}catch(D){throw w(D),D}finally{k(!1)}},[r]);return{criteria:s,initialAnswers:l,result:A,isLoading:d,isSubmitting:p,error:I,load:O,submit:q}}function vt(){const{applicantService:t,config:r}=Re(),[a,s]=i.useState(!1),[n,l]=i.useState(null),c=i.useRef(!1),d=i.useRef(!1),y=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(A){const T=Math.random()*16|0;return(A==="x"?T:T&3|8).toString(16)}),p=i.useCallback(async A=>{var T;if(c.current)throw console.log("[Applicant] Create already in progress, skipping..."),new Error("Creation already in progress");c.current=!0,s(!0),l(null);try{if(A.applicantAdditionalDatas||(A.applicantAdditionalDatas=[]),(T=r.identityProviders)!=null&&T.sardinai){const S=y();console.log("[SardinAI] Generated session key:",S),A.applicantAdditionalDatas.push({paramName:"sessionKey",value:S})}return await t.createApplicant(A)}catch(b){throw l(b),b}finally{s(!1),c.current=!1}},[t,r]),k=i.useCallback(async A=>{s(!0),l(null);try{return await t.createCompanyApplicant(A)}catch(T){throw l(T),T}finally{s(!1)}},[t]),I=i.useCallback(async A=>{if(d.current)throw console.log("[Applicant] Data load already in progress, skipping..."),new Error("Data load already in progress");d.current=!0,s(!0),l(null);try{return await t.getApplicantData(A)}catch(T){throw l(T),T}finally{s(!1),d.current=!1}},[t]),w=i.useCallback(async A=>{s(!0),l(null);try{await t.stopProgress(A)}catch(T){throw l(T),T}finally{s(!1)}},[t]);return{isLoading:a,error:n,createApplicant:p,createCompanyApplicant:k,getApplicantData:I,stopProgress:w}}const ma={primary:{backgroundColor:"var(--metakyc-primary, #2563eb)",color:"#ffffff",borderColor:"transparent"},secondary:{backgroundColor:"var(--metakyc-surface, #f3f4f6)",color:"var(--metakyc-text-primary, #111827)",borderColor:"var(--metakyc-border, #e5e7eb)"},outline:{backgroundColor:"transparent",color:"var(--metakyc-primary, #2563eb)",borderColor:"var(--metakyc-primary, #2563eb)"},danger:{backgroundColor:"var(--metakyc-danger, #ef4444)",color:"#ffffff",borderColor:"transparent"},ghost:{backgroundColor:"transparent",color:"var(--metakyc-text-secondary, #6b7280)",borderColor:"transparent"}},Q=({children:t,variant:r="primary",size:a="md",isLoading:s=!1,disabled:n,className:l,style:c,...d})=>{const y="inline-flex items-center justify-center rounded-lg font-medium transition-opacity border focus:outline-none focus:ring-2 focus:ring-offset-1 disabled:opacity-50 disabled:cursor-not-allowed",p={sm:"px-3 py-1.5 text-sm",md:"px-4 py-2 text-sm",lg:"px-6 py-3 text-base"},k={sm:{padding:"0.375rem 0.75rem",fontSize:"0.875rem"},md:{padding:"0.5rem 1rem",fontSize:"0.875rem"},lg:{padding:"0.75rem 1.5rem",fontSize:"1rem"}};return e.jsxs("button",{className:Ce(y,p[a],l),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",borderRadius:"0.5rem",fontWeight:500,borderWidth:"1px",borderStyle:"solid",cursor:n||s?"not-allowed":"pointer",opacity:n||s?.5:1,lineHeight:"1.25rem",...k[a],...ma[r],...c},disabled:n||s,...d,children:[s&&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]})},ye=i.forwardRef(({label:t,error:r,helperText:a,leftIcon:s,rightIcon:n,className:l,style:c,...d},y)=>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,d.required&&e.jsx("span",{className:"text-danger-500 ml-1",children:"*"})]}),e.jsxs("div",{className:"relative",children:[s&&e.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:s}),e.jsx("input",{ref:y,className:Ce("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",s?"pl-10":"",n?"pr-10":"",l),style:{minHeight:"38px",backgroundColor:d.readOnly?"var(--metakyc-surface, #f3f4f6)":"var(--metakyc-input-bg, #ffffff)",color:"var(--metakyc-input-text, var(--metakyc-text-primary, #111827))",borderColor:r?"var(--metakyc-danger, #ef4444)":"var(--metakyc-input-border, var(--metakyc-border, #d1d5db))",cursor:d.readOnly?"default":void 0,...c},...d}),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",style:{color:"var(--metakyc-danger, #ef4444)"},children:r}),!r&&a&&e.jsx("p",{className:"mt-1 text-sm",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:a})]}));ye.displayName="Input";const Z=({children:t,className:r,style:a,...s})=>e.jsx("div",{className:Ce("metakyc-card rounded-xl shadow-sm border",r),style:{backgroundColor:"var(--metakyc-surface, #ffffff)",borderColor:"var(--metakyc-border, #e5e7eb)",borderWidth:"1px",borderStyle:"solid",borderRadius:"0.75rem",overflow:"hidden",...a},...s,children:t}),he=({children:t,className:r,style:a,...s})=>e.jsx("div",{className:Ce("px-6 py-4 border-b",r),style:{padding:"1rem 1.5rem",borderBottomWidth:"1px",borderBottomStyle:"solid",borderBottomColor:"var(--metakyc-border, #e5e7eb)",...a},...s,children:t}),ee=({children:t,className:r,style:a,...s})=>e.jsx("div",{className:Ce("px-6 py-4",r),style:{padding:"1rem 1.5rem",...a},...s,children:t}),fe=({children:t,className:r,style:a,...s})=>e.jsx("div",{className:Ce("px-6 py-4 border-t",r),style:{padding:"1rem 1.5rem",borderTopWidth:"1px",borderTopStyle:"solid",borderTopColor:"var(--metakyc-border, #e5e7eb)",...a},...s,children:t}),pa={display:"inline-flex",alignItems:"center",justifyContent:"center",width:16,height:16,minWidth:16,minHeight:16,maxWidth:16,maxHeight:16,borderRadius:4,borderWidth:"1.5px",borderStyle:"solid",cursor:"pointer",flexShrink:0,position:"relative",transition:"background-color 0.15s, border-color 0.15s",boxSizing:"border-box",padding:0,margin:0,verticalAlign:"middle"},Fe=({checked:t,onChange:r,disabled:a,style:s})=>{const n="var(--metakyc-input-border, var(--metakyc-border, #d1d5db))",l="var(--metakyc-input-bg, var(--metakyc-background, #ffffff))",c="var(--metakyc-primary, #2563eb)";return e.jsx("span",{role:"checkbox","aria-checked":t,tabIndex:0,onClick:()=>!a&&r(!t),onKeyDown:d=>{(d.key===" "||d.key==="Enter")&&(d.preventDefault(),a||r(!t))},style:{...pa,backgroundColor:t?c:l,borderColor:t?c:n,opacity:a?.5:1,cursor:a?"not-allowed":"pointer",...s},children:t&&e.jsx("svg",{width:"10",height:"8",viewBox:"0 0 10 8",fill:"none",style:{display:"block",flexShrink:0},children:e.jsx("path",{d:"M1 4L3.5 6.5L9 1",stroke:"#ffffff",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})},ua={default:{backgroundColor:"var(--metakyc-surface, #f3f4f6)",color:"var(--metakyc-text-secondary, #6b7280)"},info:{backgroundColor:"var(--metakyc-input-bg, var(--metakyc-surface, #f9fafb))",color:"var(--metakyc-input-text, var(--metakyc-text-secondary, #6b7280))",border:"1px solid var(--metakyc-input-border, var(--metakyc-border, #e5e7eb))"},success:{backgroundColor:"var(--metakyc-input-bg, var(--metakyc-surface, #f9fafb))",color:"var(--metakyc-input-text, var(--metakyc-text-secondary, #6b7280))",border:"1px solid var(--metakyc-input-border, var(--metakyc-border, #e5e7eb))"},danger:{backgroundColor:"#fee2e2",color:"#991b1b"},warning:{backgroundColor:"#fef3c7",color:"#92400e"}},wt=({children:t,variant:r="default",className:a,style:s,...n})=>e.jsx("span",{className:Ce("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium",a),style:{...ua[r],...s},...n,children:t}),Ee=({size:t="md",className:r,...a})=>{const s={sm:"h-4 w-4",md:"h-8 w-8",lg:"h-12 w-12"};return e.jsx("div",{className:Ce("flex items-center justify-center",r),...a,children:e.jsxs("svg",{className:Ce("animate-spin text-primary-500",s[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"})]})})},ut=i.forwardRef(({label:t,error:r,helperText:a,options:s,placeholder:n,className:l,style:c,...d},y)=>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,d.required&&e.jsx("span",{className:"text-danger-500 ml-1",children:"*"})]}),e.jsxs("select",{ref:y,className:Ce("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":"",l),style:{minHeight:"38px",backgroundColor:"var(--metakyc-input-bg, #ffffff)",color:"var(--metakyc-input-text, var(--metakyc-text-primary, #111827))",borderColor:r?"var(--metakyc-danger, #ef4444)":"var(--metakyc-input-border, var(--metakyc-border, #d1d5db))",...c},...d,children:[n&&e.jsx("option",{value:"",disabled:!0,style:{backgroundColor:"var(--metakyc-input-bg, #ffffff)",color:"var(--metakyc-text-secondary, #6b7280)"},children:n},"__placeholder__"),s.map((p,k)=>e.jsx("option",{value:p.value,disabled:p.disabled,style:{backgroundColor:"var(--metakyc-input-bg, #ffffff)",color:p.disabled?"var(--metakyc-text-muted, #9ca3af)":"var(--metakyc-input-text, var(--metakyc-text-primary, #111827))"},children:p.label},p.value||`option-${k}`))]}),r&&e.jsx("p",{className:"mt-1 text-sm",style:{color:"var(--metakyc-error, #ef4444)"},children:r}),!r&&a&&e.jsx("p",{className:"mt-1 text-sm",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:a})]}));ut.displayName="Select";const Rt=280,Fr=({label:t,value:r,onChange:a,options:s,placeholder:n="Select...",disabled:l=!1,readOnly:c=!1,required:d=!1})=>{const y=l||c,[p,k]=i.useState(!1),[I,w]=i.useState(""),[A,T]=i.useState(null),[b,S]=i.useState({bg:"#ffffff",borderColor:"#d1d5db",textPrimary:"#111827",textSecondary:"#6b7280",primaryColor:"#2563eb",primaryLight:"#eff6ff",hoverBg:"#f9fafb"}),O=i.useRef(null),q=i.useRef(null),F=i.useRef(null),D=i.useCallback(()=>{if(!q.current)return null;const E=q.current.getBoundingClientRect(),$=window.innerHeight-E.bottom<Rt&&E.top>Rt;return{top:$?E.top:E.bottom+4,left:E.left,width:E.width,openUp:$}},[]),X=i.useCallback(()=>{const E=getComputedStyle(document.querySelector(".metakyc-sdk")||document.documentElement),W=(_,ue)=>E.getPropertyValue(_).trim()||ue,$=W("--metakyc-input-bg",W("--metakyc-background","#ffffff"));S({bg:$,borderColor:W("--metakyc-input-border",W("--metakyc-border","#d1d5db")),textPrimary:W("--metakyc-input-text",W("--metakyc-text-primary","#111827")),textSecondary:W("--metakyc-text-secondary","#6b7280"),primaryColor:W("--metakyc-primary","#2563eb"),primaryLight:W("--metakyc-primary-light","#eff6ff"),hoverBg:W("--metakyc-surface",$)})},[]),re=i.useCallback(()=>{if(y)return;X();const E=D();E&&T(E),k(!0)},[y,D,X]),N=i.useCallback(()=>{k(!1),w("")},[]);i.useEffect(()=>{if(!p)return;const E=W=>{var _,ue;const $=W.target;!((_=O.current)!=null&&_.contains($))&&!((ue=F.current)!=null&&ue.contains($))&&N()};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[p,N]),i.useEffect(()=>{if(!p)return;const E=()=>{const W=D();W&&T(W)};return window.addEventListener("scroll",E,!0),window.addEventListener("resize",E),()=>{window.removeEventListener("scroll",E,!0),window.removeEventListener("resize",E)}},[p,D]);const h=s.filter(E=>E.label.toLowerCase().includes(I.toLowerCase())),z=E=>{y||a(r.includes(E)?r.filter(W=>W!==E):[...r,E])},G=(E,W)=>{W.stopPropagation(),y||a(r.filter($=>$!==E))},Y=E=>{var W;return((W=s.find($=>$.value===E))==null?void 0:W.label)||E},{bg:B,borderColor:V,textPrimary:ae,textSecondary:K,primaryColor:ke,primaryLight:ce,hoverBg:de}=b,ge=p&&A&&e.jsxs("div",{ref:F,className:"metakyc-multiselect-dropdown",style:{position:"fixed",top:A.openUp?void 0:A.top,bottom:A.openUp?window.innerHeight-A.top+4:void 0,left:A.left,width:A.width,zIndex:99999,borderRadius:"8px",boxShadow:"0 4px 16px rgba(0,0,0,0.18)",border:`1px solid ${V}`,backgroundColor:B,overflow:"hidden"},children:[e.jsx("div",{style:{padding:"8px",borderBottom:`1px solid ${V}`},children:e.jsx("input",{type:"text",value:I,onChange:E=>w(E.target.value),placeholder:"Search...",autoFocus:!0,onClick:E=>E.stopPropagation(),className:"metakyc-multiselect-search w-full",style:{display:"block",width:"100%",padding:"6px 8px",fontSize:"13px",borderRadius:"6px",border:`1px solid ${V}`,backgroundColor:B,color:ae,outline:"none",boxSizing:"border-box"},onFocus:E=>{const W=getComputedStyle(document.querySelector(".metakyc-sdk")||document.documentElement),$=W.getPropertyValue("--metakyc-input-border-focus").trim()||W.getPropertyValue("--metakyc-primary").trim()||"#2563eb";E.currentTarget.style.backgroundColor=B,E.currentTarget.style.color=ae,E.currentTarget.style.borderColor=$,E.currentTarget.style.outline="none",E.currentTarget.style.boxShadow=`0 0 0 2px ${$}33`},onBlur:E=>{E.currentTarget.style.backgroundColor=B,E.currentTarget.style.color=ae,E.currentTarget.style.borderColor=V,E.currentTarget.style.outline="none",E.currentTarget.style.boxShadow="none"}})}),e.jsx("ul",{style:{listStyle:"none",margin:0,padding:"4px 0",maxHeight:"192px",overflowY:"auto"},children:h.length===0?e.jsx("li",{style:{padding:"8px 12px",fontSize:"13px",color:K},children:"No results"}):h.map(E=>{const W=r.includes(E.value);return e.jsxs("li",{onClick:()=>z(E.value),className:"metakyc-multiselect-option",style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 12px",fontSize:"13px",cursor:"pointer",backgroundColor:W?ce:"transparent",color:W?ke:ae,userSelect:"none"},onMouseEnter:$=>{W||($.currentTarget.style.backgroundColor=de)},onMouseLeave:$=>{W||($.currentTarget.style.backgroundColor="transparent")},children:[e.jsx(Fe,{checked:W,onChange:()=>{}}),e.jsx("span",{children:E.label})]},E.value)})}),r.length>0&&e.jsx("div",{style:{padding:"6px 12px",borderTop:`1px solid ${V}`},children:e.jsxs("button",{type:"button",onClick:()=>{a([]),w("")},style:{fontSize:"12px",color:"#ef4444",background:"none",border:"none",cursor:"pointer",padding:0},children:["Clear all (",r.length," selected)"]})})]});return e.jsxs("div",{className:"w-full metakyc-multiselect",ref:O,children:[t&&e.jsxs("label",{className:"block text-sm font-medium mb-1",style:{color:"var(--metakyc-text-primary, #374151)"},children:[t,d&&e.jsx("span",{style:{color:"var(--metakyc-error, #ef4444)",marginLeft:"4px"},children:"*"})]}),e.jsxs("div",{ref:q,onClick:()=>p?N():re(),className:Ce("metakyc-multiselect-trigger","w-full px-3 py-2 rounded-lg border text-sm transition-colors relative",y?"opacity-50 cursor-not-allowed":"cursor-pointer"),style:{minHeight:"38px",backgroundColor:"var(--metakyc-input-bg, #ffffff)",borderColor:p?"var(--metakyc-input-border-focus, var(--metakyc-primary, #2563eb))":"var(--metakyc-input-border, var(--metakyc-border, #d1d5db))",outline:p?"2px solid var(--metakyc-input-border-focus, var(--metakyc-primary, #2563eb))":"none",outlineOffset:"-1px"},children:[r.length===0?e.jsx("span",{className:"metakyc-multiselect-placeholder leading-6",style:{color:"var(--metakyc-text-secondary, #9ca3af)"},children:n}):e.jsx("div",{className:"flex flex-wrap gap-1 pr-6",children:r.map(E=>e.jsxs("span",{className:"metakyc-multiselect-chip inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-medium",style:{backgroundColor:"var(--metakyc-primary-light, #eff6ff)",color:"var(--metakyc-primary, #2563eb)"},children:[Y(E),!y&&e.jsx("button",{type:"button",onClick:W=>G(E,W),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:"×"})]},E))}),e.jsx("span",{className:"metakyc-multiselect-arrow absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none text-xs",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:p?"▲":"▼"})]}),typeof document<"u"&&ge?pt.createPortal(ge,document.body):null]})},It=260,ze=({label:t,error:r,helperText:a,options:s,placeholder:n="Select...",value:l,onChange:c,disabled:d=!1,readOnly:y=!1,required:p=!1,className:k})=>{var ue;const I=d||y,[w,A]=i.useState(!1),[T,b]=i.useState(""),[S,O]=i.useState(null),[q,F]=i.useState({bg:"#ffffff",border:"#d1d5db",text:"#111827",textSecondary:"#6b7280",primary:"#2563eb",primaryLight:"#eff6ff",hoverBg:"#f9fafb"}),D=i.useCallback(()=>{const R=getComputedStyle(document.querySelector(".metakyc-sdk")||document.documentElement),te=(se,be)=>R.getPropertyValue(se).trim()||be,me=te("--metakyc-input-bg",te("--metakyc-background","#ffffff"));F({bg:me,border:te("--metakyc-input-border",te("--metakyc-border","#d1d5db")),text:te("--metakyc-input-text",te("--metakyc-text-primary","#111827")),textSecondary:te("--metakyc-text-secondary","#6b7280"),primary:te("--metakyc-primary","#2563eb"),primaryLight:te("--metakyc-primary-light","#eff6ff"),hoverBg:te("--metakyc-surface",me)})},[]),X=i.useRef(null),re=i.useRef(null),N=i.useRef(null),h=i.useRef(null),z=i.useCallback(()=>{if(!re.current)return null;const R=re.current.getBoundingClientRect(),me=window.innerHeight-R.bottom<It&&R.top>It;return{top:me?R.top:R.bottom+4,left:R.left,width:R.width,openUp:me}},[]),G=i.useCallback(()=>{if(I)return;D();const R=z();R&&O(R),A(!0)},[I,z,D]),Y=i.useCallback(()=>{A(!1),b("")},[]),B=()=>w?Y():G();i.useEffect(()=>{if(!w)return;const R=te=>{var se,be;const me=te.target;!((se=X.current)!=null&&se.contains(me))&&!((be=N.current)!=null&&be.contains(me))&&Y()};return document.addEventListener("mousedown",R),()=>document.removeEventListener("mousedown",R)},[w,Y]),i.useEffect(()=>{if(!w)return;const R=()=>{const te=z();te&&O(te)};return window.addEventListener("scroll",R,!0),window.addEventListener("resize",R),()=>{window.removeEventListener("scroll",R,!0),window.removeEventListener("resize",R)}},[w,z]),i.useEffect(()=>{w&&h.current&&setTimeout(()=>{var R;return(R=h.current)==null?void 0:R.focus()},0)},[w]);const V=s.filter(R=>R.label.toLowerCase().includes(T.toLowerCase())||R.value.toLowerCase().includes(T.toLowerCase())),ae=(ue=s.find(R=>R.value===l))==null?void 0:ue.label,K=(R,te)=>{I||te||(c(R),Y())},{bg:ke,border:ce,text:de,textSecondary:ge,primary:E,primaryLight:W,hoverBg:$}=q,_=w&&S&&e.jsxs("div",{ref:N,className:"metakyc-searchable-select-dropdown",style:{position:"fixed",top:S.openUp?void 0:S.top,bottom:S.openUp?window.innerHeight-S.top+4:void 0,left:S.left,width:S.width,zIndex:99999,borderRadius:"8px",boxShadow:"0 4px 16px rgba(0,0,0,0.18)",border:`1px solid ${ce}`,backgroundColor:ke,overflow:"hidden"},children:[e.jsx("div",{style:{padding:"8px",borderBottom:`1px solid ${ce}`},children:e.jsx("input",{ref:h,type:"text",value:T,onChange:R=>b(R.target.value),placeholder:"Search...",onClick:R=>R.stopPropagation(),className:"metakyc-searchable-select-search w-full",style:{display:"block",width:"100%",padding:"6px 8px",fontSize:"13px",borderRadius:"6px",border:`1px solid ${ce}`,backgroundColor:ke,color:de,outline:"none",boxSizing:"border-box"},onFocus:R=>{const te=getComputedStyle(document.querySelector(".metakyc-sdk")||document.documentElement),me=te.getPropertyValue("--metakyc-input-border-focus").trim()||te.getPropertyValue("--metakyc-primary").trim()||"#2563eb";R.currentTarget.style.backgroundColor=ke,R.currentTarget.style.color=de,R.currentTarget.style.borderColor=me,R.currentTarget.style.outline="none",R.currentTarget.style.boxShadow=`0 0 0 2px ${me}33`},onBlur:R=>{R.currentTarget.style.backgroundColor=ke,R.currentTarget.style.color=de,R.currentTarget.style.borderColor=ce,R.currentTarget.style.outline="none",R.currentTarget.style.boxShadow="none"}})}),e.jsx("ul",{style:{listStyle:"none",margin:0,padding:"4px 0",maxHeight:"208px",overflowY:"auto"},children:V.length===0?e.jsx("li",{style:{padding:"8px 12px",fontSize:"13px",color:ge},children:"No results"}):V.map(R=>{const te=R.value===l;return e.jsx("li",{className:"metakyc-searchable-select-option",onClick:()=>K(R.value,R.disabled),style:{padding:"8px 12px",fontSize:"13px",cursor:R.disabled?"not-allowed":"pointer",opacity:R.disabled?.4:1,backgroundColor:te?W:"transparent",color:te?E:de,userSelect:"none"},onMouseEnter:me=>{!te&&!R.disabled&&(me.currentTarget.style.backgroundColor=$)},onMouseLeave:me=>{te||(me.currentTarget.style.backgroundColor="transparent")},children:R.label},R.value)})})]});return e.jsxs("div",{className:Ce("w-full metakyc-searchable-select",k),ref:X,children:[t&&e.jsxs("label",{className:"block text-sm font-medium mb-1",style:{color:"var(--metakyc-text-primary, #374151)"},children:[t,p&&e.jsx("span",{style:{color:"var(--metakyc-error, #ef4444)",marginLeft:"4px"},children:"*"})]}),e.jsxs("div",{ref:re,role:"button",tabIndex:I?-1:0,onClick:B,onKeyDown:R=>{(R.key==="Enter"||R.key===" ")&&(R.preventDefault(),B()),R.key==="Escape"&&Y()},className:Ce("metakyc-searchable-select-trigger","w-full px-3 py-2 rounded-lg border text-sm transition-colors text-left","flex items-center justify-between gap-2","focus:outline-none",I?"opacity-60 cursor-not-allowed":"cursor-pointer"),style:{backgroundColor:"var(--metakyc-input-bg, #ffffff)",color:ae?"var(--metakyc-input-text, var(--metakyc-text-primary, #111827))":"var(--metakyc-input-placeholder, var(--metakyc-text-muted, #9ca3af))",borderColor:r?"var(--metakyc-danger, #ef4444)":w?"var(--metakyc-input-border-focus, var(--metakyc-primary, #2563eb))":"var(--metakyc-input-border, var(--metakyc-border, #d1d5db))",minHeight:"38px",outline:w?"2px solid var(--metakyc-input-border-focus, var(--metakyc-primary, #2563eb))":"none",outlineOffset:"-1px"},children:[e.jsx("span",{className:"truncate flex-1",children:ae||n}),e.jsx("span",{className:"flex-shrink-0 text-xs pointer-events-none",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:w?"▲":"▼"})]}),typeof document<"u"&&_?pt.createPortal(_,document.body):null,r&&e.jsx("p",{className:"mt-1 text-sm",style:{color:"var(--metakyc-error, #ef4444)"},children:r}),!r&&a&&e.jsx("p",{className:"mt-1 text-sm",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:a})]})};ze.displayName="SearchableSelect";function ya(t){const r=t.type;return r.startsWith("image/")?"image":r==="application/pdf"?"pdf":"file"}const Pr=({label:t,subtitle:r,error:a,accept:s,multiple:n=!1,maxSize:l,required:c,onChange:d,value:y=[],className:p})=>{const[k,I]=i.useState(!1),[w,A]=i.useState(null),T=i.useRef(null),b=i.useCallback(N=>{if(!N)return;A(null);const h=Array.from(N);if(l&&h.filter(G=>G.size>l).length>0){A(`File exceeds the maximum size of ${mt(l)}`);return}d==null||d(n?[...y,...h]:[h[0]])},[l,n,d,y]),S=i.useCallback(N=>{N.preventDefault(),N.stopPropagation(),I(!0)},[]),O=i.useCallback(N=>{N.preventDefault(),N.stopPropagation(),I(!1)},[]),q=i.useCallback(N=>{N.preventDefault(),N.stopPropagation(),I(!1),b(N.dataTransfer.files)},[b]),F=()=>{var N;(N=T.current)==null||N.click()},D=N=>{A(null);const h=y.filter((z,G)=>G!==N);d==null||d(h)},X=a||w,re=y.length>0;return e.jsxs("div",{className:Ce("metakyc-file-upload",p),style:{width:"100%"},children:[t&&e.jsxs("div",{style:{marginBottom:"8px"},children:[e.jsxs("label",{style:{display:"block",fontSize:"14px",fontWeight:600,color:"var(--metakyc-text-primary, #111827)"},children:[t,c&&e.jsx("span",{style:{color:"var(--metakyc-danger, #ef4444)",marginLeft:"2px"},children:"*"})]}),r&&e.jsx("p",{style:{fontSize:"13px",color:"var(--metakyc-text-muted, #9ca3af)",marginTop:"2px"},children:r})]}),e.jsxs("div",{className:"metakyc-file-dropzone",onClick:F,onDragOver:S,onDragLeave:O,onDrop:q,style:{border:`2px dashed ${X?"var(--metakyc-danger, #ef4444)":k?"var(--metakyc-primary, #2563eb)":"var(--metakyc-border, #d1d5db)"}`,borderRadius:"12px",padding:re?"20px":"32px 20px",textAlign:"center",cursor:"pointer",transition:"all 0.2s ease",backgroundColor:k?"color-mix(in srgb, var(--metakyc-primary, #2563eb) 5%, var(--metakyc-background, #ffffff))":"var(--metakyc-background, #ffffff)"},children:[e.jsx("input",{ref:T,type:"file",style:{display:"none"},accept:s,multiple:n,onChange:N=>{b(N.target.files),N.target.value=""}}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"12px"},children:[e.jsx("div",{style:{width:"48px",height:"48px",borderRadius:"12px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:k?"color-mix(in srgb, var(--metakyc-primary, #2563eb) 15%, transparent)":"var(--metakyc-surface, #f9fafb)",transition:"background-color 0.2s ease"},children:e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:k?"var(--metakyc-primary, #2563eb)":"var(--metakyc-text-muted, #9ca3af)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{transition:"stroke 0.2s ease"},children:[e.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),e.jsx("polyline",{points:"17 8 12 3 7 8"}),e.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]})}),e.jsxs("div",{children:[e.jsxs("p",{style:{fontSize:"14px",color:"var(--metakyc-text-secondary, #6b7280)",margin:0},children:[e.jsx("span",{style:{fontWeight:600,color:"var(--metakyc-primary, #2563eb)"},children:"Click to upload"})," ","or drag and drop"]}),(s||l)&&e.jsxs("p",{style:{fontSize:"12px",color:"var(--metakyc-text-muted, #9ca3af)",marginTop:"4px"},children:[s&&e.jsx("span",{children:s}),s&&l&&e.jsx("span",{children:" · "}),l&&e.jsxs("span",{children:["Max ",mt(l)]})]})]})]})]}),re&&e.jsx("div",{style:{marginTop:"12px",display:"flex",flexDirection:"column",gap:"8px"},children:y.map((N,h)=>{const z=ya(N),G=z==="image",Y=G?URL.createObjectURL(N):null;return e.jsxs("div",{className:"metakyc-file-item",style:{display:"flex",alignItems:"center",gap:"12px",padding:"10px 12px",borderRadius:"10px",backgroundColor:"var(--metakyc-surface, #f9fafb)",border:"1px solid var(--metakyc-border, #e5e7eb)",transition:"background-color 0.15s ease"},children:[e.jsx("div",{style:{width:"40px",height:"40px",borderRadius:"8px",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",backgroundColor:G?"transparent":"color-mix(in srgb, var(--metakyc-primary, #2563eb) 10%, transparent)"},children:G&&Y?e.jsx("img",{src:Y,alt:N.name,style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:"8px"}}):z==="pdf"?e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--metakyc-danger, #ef4444)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("polyline",{points:"14 2 14 8 20 8"}),e.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),e.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),e.jsx("polyline",{points:"10 9 9 9 8 9"})]}):e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--metakyc-primary, #2563eb)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("polyline",{points:"14 2 14 8 20 8"})]})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("p",{style:{fontSize:"13px",fontWeight:500,color:"var(--metakyc-text-primary, #111827)",margin:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:N.name}),e.jsx("p",{style:{fontSize:"12px",color:"var(--metakyc-text-muted, #9ca3af)",margin:0,marginTop:"2px"},children:mt(N.size)})]}),e.jsx("button",{type:"button",onClick:B=>{B.stopPropagation(),D(h)},style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"6px",border:"none",backgroundColor:"transparent",color:"var(--metakyc-text-muted, #9ca3af)",cursor:"pointer",flexShrink:0,transition:"all 0.15s ease",padding:0},onMouseEnter:B=>{B.currentTarget.style.backgroundColor="color-mix(in srgb, var(--metakyc-danger, #ef4444) 10%, transparent)",B.currentTarget.style.color="var(--metakyc-danger, #ef4444)"},onMouseLeave:B=>{B.currentTarget.style.backgroundColor="transparent",B.currentTarget.style.color="var(--metakyc-text-muted, #9ca3af)"},children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},`${N.name}-${h}`)})}),X&&e.jsx("p",{style:{fontSize:"13px",color:"var(--metakyc-danger, #ef4444)",marginTop:"6px"},children:X})]})},Lr=i.forwardRef(({countryCode:t="+1",onCountryCodeChange:r,className:a,...s},n)=>e.jsxs("div",{className:"w-full",children:[s.label&&e.jsxs("label",{className:"block text-sm font-medium mb-1",style:{color:"var(--metakyc-text-primary, #374151)"},children:[s.label,s.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:l=>r==null?void 0:r(l.target.value),className:Ce("w-20 rounded-lg border px-3 py-2 text-sm","focus:outline-none focus:ring-2 focus:ring-offset-0"),style:{minHeight:"38px",backgroundColor:"var(--metakyc-input-bg, #ffffff)",color:"var(--metakyc-text-primary, #111827)",borderColor:"var(--metakyc-border, #d1d5db)"},placeholder:"+1"}),e.jsx(ye,{ref:n,type:"tel",className:Ce("flex-1",a),...s,label:""})]}),s.error&&e.jsx("p",{className:"mt-1 text-sm text-danger-500",children:s.error})]}));Lr.displayName="PhoneInput";/**
75
75
  * @license lucide-react v0.574.0 - ISC
76
76
  *
77
77
  * This source code is licensed under the ISC license.
@@ -121,5 +121,5 @@ ${Object.entries(n).filter(([,y])=>!!y).map(([y,p])=>` --metakyc-${y}: ${p} !im
121
121
  *
122
122
  * This source code is licensed under the ISC license.
123
123
  * See the LICENSE file in the root directory of this source tree.
124
- */const va=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Or=Mr("chevron-right",va);function wa(t,r){const a=!r||r.length===0||r.every(s=>!s||!s.trim());if(t.isRequired&&a)return t.errorMessage||"This field is required";if(!a){const s=r[0]??"";if(s&&t.regex)try{if(!new RegExp(t.regex).test(s))return t.errorMessage||"Invalid format"}catch{}if(s!==""){const n=Number(s);if(!isNaN(n)&&s.trim()!==""){if(t.min!==void 0&&t.min!==null&&n<t.min)return`Minimum value is ${t.min}`;if(t.max!==void 0&&t.max!==null&&n>t.max)return`Maximum value is ${t.max}`}else{if(t.min!==void 0&&t.min!==null&&s.length<t.min)return`Minimum length is ${t.min} characters`;if(t.max!==void 0&&t.max!==null&&s.length>t.max)return`Maximum length is ${t.max} characters`}}}return null}function ja(t){const r=t.flatMap((s,n)=>(s.questions??[]).map((l,c)=>({question:l,groupIndex:n,qIdx:c}))),a=new Map;for(const s of r){const n=s.question.pageNumber!=null&&s.question.pageNumber>0?s.question.pageNumber:1;a.has(n)||a.set(n,[]),a.get(n).push(s)}return Array.from(a.entries()).sort(([s],[n])=>s-n).map(([,s])=>s)}const $r=({applicantId:t,onComplete:r,onBack:a})=>{const{questionnaire:s,initialAnswers:n,isLoading:l,isSubmitting:c,error:d,submit:y}=Rr(t),[p,k]=i.useState({}),[I,w]=i.useState({}),[E,T]=i.useState(0);i.useEffect(()=>{n&&Object.keys(n).length>0&&Object.keys(p).length===0&&k(n)},[n]);const b=i.useMemo(()=>s?ja(s.questionGroups):[],[s]),C=E===b.length-1,O=b[E]??[],q=i.useCallback((N,f)=>{k(z=>({...z,[N]:f})),w(z=>{const G={...z};return delete G[N],G})},[]),F=i.useCallback(()=>{const N={};for(const{question:f}of O){const z=wa(f,p[f.id]??[]);z&&(N[f.id]=z)}return w(f=>({...f,...N})),Object.keys(N).length===0},[O,p]),D=()=>{F()&&T(N=>N+1)},X=()=>{E>0?T(N=>N-1):a==null||a()},re=async()=>{if(!(!F()||!s))try{const N=s.questionGroups.flatMap(z=>(z.questions??[]).map(G=>({questionId:G.id,values:p[G.id]??[]}))),f={applicantId:t,questionnarieId:s.id,questionResults:N};await y(f),r==null||r()}catch(N){console.error("Questionnaire submit error:",N)}};return l?e.jsx(Z,{children:e.jsx(ee,{children:e.jsx(Ee,{className:"my-8"})})}):d?e.jsx(Z,{children:e.jsx(ee,{children:e.jsxs("p",{className:"text-danger-500",children:["Error loading questionnaire: ",d.message]})})}):s?e.jsxs(Z,{children:[e.jsxs(he,{children:[e.jsx("h2",{className:"text-lg font-bold",children:s.displayName}),s.subtitle&&e.jsx("p",{className:"text-sm",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:s.subtitle}),b.length>1&&e.jsxs("div",{className:"flex items-center justify-between mt-3",children:[e.jsxs("span",{className:"text-xs",style:{color:"var(--metakyc-text-muted, #9ca3af)"},children:["Page ",E+1," of ",b.length]}),e.jsx("div",{className:"flex items-center gap-1.5",children:b.map((N,f)=>e.jsx("div",{className:"rounded-full transition-all duration-200",style:{height:"6px",width:f===E?"20px":"6px",backgroundColor:f<=E?"var(--metakyc-primary, #2563eb)":"var(--metakyc-border, #e5e7eb)"}},f))})]})]}),e.jsx(ee,{className:"space-y-6",children:O.map(({question:N})=>e.jsx(Sa,{question:N,value:p[N.id]??[],error:I[N.id],onChange:f=>q(N.id,f)},N.id))}),e.jsxs(fe,{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs(Q,{type:"button",variant:"outline",onClick:X,style:{display:"flex",alignItems:"center",gap:"4px"},children:[e.jsx(zr,{size:14}),E>0?"Previous":"Back"]}),C?e.jsx(Q,{type:"button",isLoading:c,onClick:re,children:"Continue"}):e.jsxs(Q,{type:"button",onClick:D,style:{display:"flex",alignItems:"center",gap:"4px"},children:["Next",e.jsx(Or,{size:14})]})]}),d&&e.jsx("div",{className:"mx-6 mb-4 p-3 bg-red-50 border border-red-200 rounded",children:e.jsx("p",{className:"text-red-600 text-sm",children:d.message})})]}):null},Sa=({question:t,value:r,error:a,onChange:s})=>{var c;const l=(((c=t.defaultAnswers)==null?void 0:c.length)??0)>0?t.showAsDropdown?t.canMultipleAnswer?"multi-select":"single-select":t.canMultipleAnswer?"checkbox":"radio":"text";return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{className:"block text-sm font-medium",style:{color:"var(--metakyc-text-primary, #111827)"},children:[t.text,t.isRequired&&e.jsx("span",{className:"text-danger-500 ml-1",children:"*"})]}),t.subtitle&&e.jsx("p",{className:"text-xs",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:t.subtitle}),t.description&&e.jsx("p",{className:"text-xs",style:{color:"var(--metakyc-text-muted, #9ca3af)"},children:t.description}),l==="text"&&e.jsx(xe,{value:r[0]??"",onChange:d=>s([d.target.value]),placeholder:t.subtitle?void 0:"Enter your answer…",error:a,required:t.isRequired}),l==="single-select"&&e.jsx(ut,{value:r[0]??"",onChange:d=>s([d.target.value]),options:(t.defaultAnswers??[]).map(d=>({value:d,label:d})),placeholder:"Select an option…",error:a,required:t.isRequired}),l==="radio"&&e.jsxs("div",{className:"metakyc-options-group",style:{display:"flex",flexDirection:"column",gap:"8px"},children:[(t.defaultAnswers??[]).map(d=>e.jsxs("label",{className:"metakyc-option-label",style:{display:"flex",alignItems:"center",gap:"10px",cursor:"pointer",margin:0,padding:0},children:[e.jsx("input",{type:"radio",checked:r[0]===d,onChange:()=>s([d]),className:"metakyc-option-input",style:{width:"16px",height:"16px",minWidth:"16px",flexShrink:0,flexGrow:0,accentColor:"var(--metakyc-primary, #2563eb)",cursor:"pointer",margin:0,padding:0,display:"inline-block",verticalAlign:"middle"}}),e.jsx("span",{className:"metakyc-option-text",style:{fontSize:"14px",color:"var(--metakyc-text-primary, #111827)",lineHeight:"1.4",marginLeft:0},children:d})]},d)),a&&e.jsx("p",{className:"text-sm text-danger-500",children:a})]}),(l==="checkbox"||l==="multi-select")&&e.jsxs("div",{className:"metakyc-options-group",style:{display:"flex",flexDirection:"column",gap:"8px"},children:[(t.defaultAnswers??[]).map(d=>e.jsxs("label",{className:"metakyc-option-label",style:{display:"flex",alignItems:"center",gap:"10px",cursor:"pointer",margin:0,padding:0},children:[e.jsx(Fe,{checked:r.includes(d),onChange:y=>{s(y?[...r,d]:r.filter(p=>p!==d))}}),e.jsx("span",{className:"metakyc-option-text",style:{fontSize:"14px",color:"var(--metakyc-text-primary, #111827)",lineHeight:"1.4",marginLeft:0},children:d})]},d)),a&&e.jsx("p",{className:"text-sm text-danger-500",children:a})]}),a&&l==="text"&&null]})};function Ca(t){const r=new Map;for(const a of t){const s=a.pageNumber!=null&&a.pageNumber>0?a.pageNumber:1;r.has(s)||r.set(s,[]),r.get(s).push(a)}return Array.from(r.entries()).sort(([a],[s])=>a-s).map(([,a])=>a)}const Br=({applicantId:t,onComplete:r,onBack:a})=>{const{uploadDocument:s,isLoading:n,isSubmitting:l,error:c,submit:d}=Ir(t),[y,p]=i.useState({}),[k,I]=i.useState(null),[w,E]=i.useState(0),[T,b]=i.useState({}),C=i.useMemo(()=>s?Ca(s.uploadDocumentFiles):[],[s]),O=C[w]??[],q=w===C.length-1,F=C.length,D=i.useCallback(()=>{const f={};for(const z of O)z.isRequired&&(y[z.id]||[]).length===0&&(f[z.id]=`${z.displayName} is required`);return b(f),Object.keys(f).length===0},[O,y]),X=()=>{D()&&(E(f=>f+1),b({}))},re=()=>{w>0?(E(f=>f-1),b({})):a==null||a()},N=async()=>{if(!(!D()||!s)){I(null);try{const f=await Promise.all(s.uploadDocumentFiles.map(async G=>{const Y=y[G.id]||[],B=await Promise.all(Y.map(async V=>({fileName:V.name,fileData:await br(V)})));return{uploadDocumentFileId:G.id,valueList:B}})),z={applicantId:t,uploadDocumentId:s.id,uploadDocumentResults:f};await d(z),r==null||r()}catch(f){I((f==null?void 0:f.message)||"Failed to submit documents. Please try again.")}}};return n?e.jsx(Z,{children:e.jsx(ee,{children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"48px 0",gap:"16px"},children:[e.jsx(Ee,{className:"my-8"}),e.jsx("p",{style:{fontSize:"14px",color:"var(--metakyc-text-muted, #9ca3af)"},children:"Loading document requirements..."})]})})}):c?e.jsx(Z,{children:e.jsx(ee,{children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"32px 0",gap:"12px",textAlign:"center"},children:[e.jsx("div",{style:{width:"48px",height:"48px",borderRadius:"50%",backgroundColor:"color-mix(in srgb, var(--metakyc-danger, #ef4444) 10%, transparent)",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--metakyc-danger, #ef4444)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),e.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]})}),e.jsx("p",{style:{fontSize:"14px",color:"var(--metakyc-danger, #ef4444)",fontWeight:500},children:"Error loading document requirements"}),e.jsx("p",{style:{fontSize:"13px",color:"var(--metakyc-text-muted, #9ca3af)"},children:c.message})]})})}):s?e.jsxs(Z,{children:[e.jsxs(he,{children:[e.jsx("h2",{style:{fontSize:"18px",fontWeight:700,color:"var(--metakyc-text-primary, #111827)",margin:0},children:s.displayName||"Upload Documents"}),s.subtitle&&e.jsx("p",{style:{fontSize:"14px",color:"var(--metakyc-text-secondary, #6b7280)",marginTop:"4px"},children:s.subtitle}),F>1&&e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginTop:"12px"},children:[e.jsxs("span",{style:{fontSize:"12px",color:"var(--metakyc-text-muted, #9ca3af)"},children:["Page ",w+1," of ",F]}),e.jsx("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:C.map((f,z)=>e.jsx("div",{style:{height:"6px",width:z===w?"20px":"6px",borderRadius:"999px",transition:"all 0.2s ease",backgroundColor:z<=w?"var(--metakyc-primary, #2563eb)":"var(--metakyc-border, #e5e7eb)"}},z))})]})]}),s.description&&w===0&&e.jsxs("div",{style:{margin:"0 24px",marginTop:"4px",display:"flex",gap:"10px",padding:"12px 14px",borderRadius:"10px",backgroundColor:"color-mix(in srgb, var(--metakyc-primary, #2563eb) 5%, var(--metakyc-background, #ffffff))",border:"1px solid color-mix(in srgb, var(--metakyc-primary, #2563eb) 15%, transparent)"},children:[e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"var(--metakyc-primary, #2563eb)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0,marginTop:"1px"},children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),e.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]}),e.jsx("p",{style:{fontSize:"13px",color:"var(--metakyc-text-secondary, #374151)",margin:0,lineHeight:1.5},children:s.description})]}),e.jsx(ee,{children:e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"24px"},children:O.map(f=>e.jsx(Pr,{label:f.displayName,subtitle:f.subtitle,accept:f.allowedTypes,multiple:f.multipleFile,maxSize:f.maxEachFileSizeByte,required:f.isRequired,error:T[f.id],value:y[f.id]||[],onChange:z=>{I(null),b(G=>{const Y={...G};return delete Y[f.id],Y}),p(G=>({...G,[f.id]:z}))}},f.id))})}),k&&e.jsxs("div",{style:{margin:"0 24px",padding:"10px 14px",borderRadius:"8px",backgroundColor:"color-mix(in srgb, var(--metakyc-danger, #ef4444) 8%, transparent)",border:"1px solid color-mix(in srgb, var(--metakyc-danger, #ef4444) 20%, transparent)",display:"flex",alignItems:"center",gap:"8px"},children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--metakyc-danger, #ef4444)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[e.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),e.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),e.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),e.jsx("p",{style:{fontSize:"13px",color:"var(--metakyc-danger, #ef4444)",margin:0},children:k})]}),e.jsx(fe,{children:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"},children:[e.jsx(Q,{type:"button",variant:"outline",onClick:re,children:w>0?"Previous":"Back"}),q?e.jsx(Q,{type:"button",isLoading:l,onClick:N,children:l?"Uploading...":"Continue"}):e.jsx(Q,{type:"button",onClick:X,children:"Next"})]})})]}):null},_r=({applicantId:t,onComplete:r,onBack:a})=>{const{overview:s,isLoading:n,isSubmitting:l,error:c,passOverview:d}=Er(t),y=async()=>{await d(),r==null||r()};return n?e.jsx(Z,{children:e.jsx(ee,{children:e.jsx(Ee,{className:"my-8"})})}):c?e.jsx(Z,{children:e.jsx(ee,{children:e.jsxs("p",{className:"text-danger-500",children:["Error loading overview: ",c.message]})})}):s?e.jsxs(Z,{children:[e.jsxs(he,{children:[e.jsx("h2",{className:"text-lg font-bold",children:s.title||"Overview"}),s.description&&e.jsx("p",{className:"mt-1",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:s.description})]}),e.jsx(ee,{className:"space-y-8",children:s.steps&&s.steps.length>0?s.steps.sort((p,k)=>p.order-k.order).map(p=>e.jsxs("div",{className:"metakyc-overview-step-item flex items-center space-x-3",children:[e.jsx("div",{className:"metakyc-step-icon flex-shrink-0",children:e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center font-medium text-sm",style:{backgroundColor:"var(--metakyc-primary, #2563eb)",color:"#ffffff"},children:p.order+1})}),e.jsxs("div",{className:"metakyc-step-content",style:{flex:1,border:"none",height:"auto",background:"transparent"},children:[e.jsx("span",{className:"metakyc-step-title text-sm font-semibold",style:{color:"var(--metakyc-text-primary, #111827)"},children:p.title}),p.description&&e.jsx("p",{className:"metakyc-step-description text-sm",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:p.description})]})]},p.order)):e.jsx("div",{className:"text-center py-8",children:e.jsx("p",{style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:"Loading overview data..."})})}),e.jsxs(fe,{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a&&e.jsx(Q,{type:"button",variant:"outline",onClick:a,children:"Back"}),e.jsx(Q,{onClick:y,isLoading:l,children:"Continue"})]})]}):null};function Na(t){const r=(t??"en").toLowerCase().replace("_","-");try{return Intl.NumberFormat.supportedLocalesOf([r]),r}catch{return"en"}}function Ra(t){return t.valueDataType===Me.Money&&Array.isArray(t.defaultValues)&&t.defaultValues.length>0}function Ia(t,r){const a=new Intl.NumberFormat(Na(r),{minimumFractionDigits:0,maximumFractionDigits:2});return t.replace(/([\d]+(?:\.\d+)?)/g,s=>{const n=parseFloat(s);return isNaN(n)?s:a.format(n)})}function Ea(t,r){const a=!r||r.length===0||r.every(s=>!s||!s.trim());if(t.isRequired&&a)return t.errorMessage||`${t.displayName} is required`;if(!a){const s=r[0]??"";if(s&&t.regex)try{if(!new RegExp(t.regex).test(s))return t.errorMessage||"Invalid format"}catch{}const n=t.valueDataType===Me.Integer||t.valueDataType===Me.Money||t.valueDataType===Me.DigitOnly;if(n&&s.trim()!==""){const l=Number(s);if(!isNaN(l)){if(t.min!==void 0&&t.min!==null&&l<t.min)return`Minimum value is ${t.min}`;if(t.max!==void 0&&t.max!==null&&l>t.max)return`Maximum value is ${t.max}`}}else if(!n&&s!==""){if(t.min!==void 0&&t.min!==null&&s.length<t.min)return`Minimum length is ${t.min} characters`;if(t.max!==void 0&&t.max!==null&&s.length>t.max)return`Maximum length is ${t.max} characters`}}return null}function Aa(t){const r=new Map;return t.forEach((a,s)=>{const n=a.pageNumber!=null&&a.pageNumber>0?a.pageNumber:1;r.has(n)||r.set(n,[]),r.get(n).push({criterion:a,idx:s})}),Array.from(r.entries()).sort(([a],[s])=>a-s).map(([,a])=>a)}function Ta(t){return t.builtInType===1?"country":!t.defaultValues||t.defaultValues.length===0?"text":t.multipleValue?"checkbox":"radio"}const Hr=({applicantId:t,onComplete:r,onBack:a})=>{const{config:s}=Re(),n=s.locale??"en",{criteria:l,initialAnswers:c,isLoading:d,isSubmitting:y,error:p,submit:k}=Tr(t),[I,w]=i.useState({}),[E,T]=i.useState({}),[b,C]=i.useState(0),[O,q]=i.useState(!1);i.useEffect(()=>{c&&Object.keys(c).length>0&&Object.keys(I).length===0&&w(c)},[c]);const F=i.useMemo(()=>l&&l.length>0?Aa(l):[],[l]),D=b===F.length-1,X=F[b]??[];i.useEffect(()=>{!d&&l&&l.length===0&&!O&&!y&&(q(!0),k({applicantId:t,criteriaValueInputs:[]}).then(()=>r==null?void 0:r()).catch(console.error))},[d,l,O,y,k,t,r]);const re=i.useCallback((Y,B)=>{w(V=>({...V,[Y]:B})),T(V=>{const ae={...V};return delete ae[Y],ae})},[]),N=i.useCallback(()=>{const Y={};for(const{criterion:B}of X){const V=Ea(B,I[B.id]??[]);V&&(Y[B.id]=V)}return T(B=>({...B,...Y})),Object.keys(Y).length===0},[X,I]),f=()=>{N()&&C(Y=>Y+1)},z=()=>{b>0?C(Y=>Y-1):a==null||a()},G=async()=>{if(!(!N()||!l))try{const Y=l.map(V=>{const ae=(I[V.id]??[]).filter(K=>K&&K.trim());return ae.length>0?{riskCriteriaId:V.id,values:ae}:null}).filter(V=>V!==null);await k({applicantId:t,criteriaValueInputs:Y}),r==null||r()}catch(Y){console.error("Risk scoring submit error:",Y)}};return d?e.jsx(Z,{children:e.jsxs(ee,{children:[e.jsx(Ee,{className:"my-8"}),e.jsx("p",{className:"text-center text-sm mt-4",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:"Loading risk scoring criteria…"})]})}):!d&&l&&l.length===0?e.jsx(Z,{children:e.jsxs(ee,{children:[e.jsx(Ee,{className:"my-8"}),e.jsx("p",{className:"text-center text-sm mt-4",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:"No criteria required. Moving to next step…"})]})}):p?e.jsx(Z,{children:e.jsx(ee,{children:e.jsxs("p",{className:"text-danger-500",children:["Error loading criteria: ",p.message]})})}):l?e.jsxs(Z,{children:[e.jsxs(he,{children:[e.jsx("h2",{className:"text-lg font-bold",children:"Risk Assessment"}),e.jsx("p",{className:"text-sm",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:"Please answer the following questions for risk evaluation"}),F.length>1&&e.jsxs("div",{className:"flex items-center justify-between mt-3",children:[e.jsxs("span",{className:"text-xs",style:{color:"var(--metakyc-text-muted, #9ca3af)"},children:["Page ",b+1," of ",F.length]}),e.jsx("div",{className:"flex items-center gap-1.5",children:F.map((Y,B)=>e.jsx("div",{className:"rounded-full transition-all duration-200",style:{height:"6px",width:B===b?"20px":"6px",backgroundColor:B<=b?"var(--metakyc-primary, #2563eb)":"var(--metakyc-border, #e5e7eb)"}},B))})]})]}),e.jsx(ee,{className:"space-y-6",children:X.map(({criterion:Y})=>e.jsx(Fa,{criterion:Y,value:I[Y.id]??[],error:E[Y.id],locale:n,onChange:B=>re(Y.id,B)},Y.id))}),e.jsxs(fe,{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs(Q,{type:"button",variant:"outline",onClick:z,style:{display:"flex",alignItems:"center",gap:"4px"},children:[e.jsx(zr,{size:14}),b>0?"Previous":"Back"]}),D?e.jsx(Q,{type:"button",isLoading:y,onClick:G,children:"Continue"}):e.jsxs(Q,{type:"button",onClick:f,style:{display:"flex",alignItems:"center",gap:"4px"},children:["Next",e.jsx(Or,{size:14})]})]}),p&&e.jsx("div",{className:"mx-6 mb-4 p-3 bg-red-50 border border-red-200 rounded",children:e.jsx("p",{className:"text-red-600 text-sm",children:p.message})})]}):null},Fa=({criterion:t,value:r,error:a,locale:s,onChange:n})=>{const l=Ta(t),c=t.valueDataType===Me.Integer||t.valueDataType===Me.Money||t.valueDataType===Me.DigitOnly,d=Ra(t),y=p=>d?Ia(p,s):p;return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{className:"block text-sm font-medium",style:{color:"var(--metakyc-text-primary, #111827)"},children:[t.displayName,t.isRequired&&e.jsx("span",{className:"text-danger-500 ml-1",children:"*"})]}),t.description&&e.jsx("p",{className:"text-xs",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:t.description}),c&&(t.min!==void 0||t.max!==void 0)&&e.jsx("p",{className:"text-xs",style:{color:"var(--metakyc-text-muted, #9ca3af)"},children:t.min!==void 0&&t.max!==void 0?`Range: ${t.min} – ${t.max}`:t.min!==void 0?`Minimum: ${t.min}`:`Maximum: ${t.max}`}),l==="text"&&e.jsx(xe,{value:r[0]??"",onChange:p=>n([p.target.value]),type:c?"number":"text",placeholder:"Enter your answer…",error:a,required:t.isRequired,min:t.min,max:t.max,onKeyDown:p=>{t.valueDataType===Me.DigitOnly&&["e","E","+","-","."].includes(p.key)&&p.preventDefault()}}),l==="radio"&&e.jsxs("div",{className:"metakyc-options-group",style:{display:"flex",flexDirection:"column",gap:"8px"},children:[(t.defaultValues??[]).map(p=>e.jsxs("label",{className:"metakyc-option-label",style:{display:"flex",alignItems:"center",gap:"10px",cursor:"pointer",margin:0,padding:0},children:[e.jsx("input",{type:"radio",checked:r[0]===p,onChange:()=>n([p]),className:"metakyc-option-input",style:{width:"16px",height:"16px",minWidth:"16px",flexShrink:0,flexGrow:0,accentColor:"var(--metakyc-primary, #2563eb)",cursor:"pointer",margin:0,padding:0,display:"inline-block",verticalAlign:"middle"}}),e.jsx("span",{className:"metakyc-option-text",style:{fontSize:"14px",color:"var(--metakyc-text-primary, #111827)",lineHeight:"1.4",marginLeft:0},children:y(p)})]},p)),a&&e.jsx("p",{className:"text-sm text-danger-500",children:a})]}),l==="checkbox"&&e.jsxs("div",{className:"metakyc-options-group",style:{display:"flex",flexDirection:"column",gap:"8px"},children:[(t.defaultValues??[]).map(p=>e.jsxs("label",{className:"metakyc-option-label",style:{display:"flex",alignItems:"center",gap:"10px",cursor:"pointer",margin:0,padding:0},children:[e.jsx(Fe,{checked:r.includes(p),onChange:k=>{n(k?[...r,p]:r.filter(I=>I!==p))}}),e.jsx("span",{className:"metakyc-option-text",style:{fontSize:"14px",color:"var(--metakyc-text-primary, #111827)",lineHeight:"1.4",marginLeft:0},children:y(p)})]},p)),a&&e.jsx("p",{className:"text-sm text-danger-500",children:a})]}),l==="country"&&e.jsx(ut,{value:r[0]??"",onChange:p=>n([p.target.value]),options:[{value:"US",label:"United States"},{value:"GB",label:"United Kingdom"},{value:"DE",label:"Germany"},{value:"FR",label:"France"},{value:"AE",label:"United Arab Emirates"}],placeholder:"Select a country…",error:a,required:t.isRequired})]})},Wr=({applicantId:t,onComplete:r,onBack:a})=>{const{investorCategorizationService:s}=Re(),[n,l]=i.useState(null),[c,d]=i.useState(!1),[y,p]=i.useState(null),k=async I=>{if(I.preventDefault(),n===null){p("Please select an investor type");return}d(!0),p(null);try{const w={applicantId:t,investorType:n};console.log("Submitting investor categorization:",w);const E=await s.setInvestorCategorization(w);console.log("Investor categorization result:",E),r==null||r()}catch(w){console.error("Error submitting investor categorization:",w),p(w.message||"Failed to submit investor categorization")}finally{d(!1)}};return e.jsx("form",{onSubmit:k,children:e.jsxs(Z,{children:[e.jsxs(he,{children:[e.jsx("h2",{className:"text-lg font-bold",style:{color:"var(--metakyc-text-primary, #111827)"},children:"Which statement best describes you?"}),e.jsx("p",{className:"mt-2",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:"All Tokenise clients are treated as Retail Investors under EU regulation, which gives you the highest level of investor protection. For our internal purposes, we ask you to select the description that best matches your situation"})]}),e.jsxs(ee,{className:"space-y-4",children:[e.jsx("p",{className:"text-sm font-medium mb-3",style:{color:"var(--metakyc-text-secondary, #374151)"},children:"Choose one"}),e.jsx("label",{className:"block p-4 border-2 rounded-lg cursor-pointer transition-all",style:{borderColor:n===we.Individual?"var(--metakyc-primary, #2563eb)":"var(--metakyc-border, #e5e7eb)",backgroundColor:n===we.Individual?"var(--metakyc-primary-light, #dbeafe)":"transparent"},children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("input",{type:"radio",name:"investorType",value:we.Individual,checked:n===we.Individual,onChange:()=>l(we.Individual),className:"mt-1"}),e.jsxs("div",{className:"ml-3",children:[e.jsx("div",{className:"text-base font-semibold",style:{color:"var(--metakyc-text-primary, #111827)"},children:"Individual investor"}),e.jsx("div",{className:"text-sm mt-1",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:"(Recommended) Most of our clients choose this option. Provides the strongest protection and aligns with our mission to make investing accessible to everyone."})]})]})}),e.jsx("label",{className:"block p-4 border-2 rounded-lg cursor-pointer transition-all",style:{borderColor:n===we.Sophisticated?"var(--metakyc-primary, #2563eb)":"var(--metakyc-border, #e5e7eb)",backgroundColor:n===we.Sophisticated?"var(--metakyc-primary-light, #dbeafe)":"transparent"},children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("input",{type:"radio",name:"investorType",value:we.Sophisticated,checked:n===we.Sophisticated,onChange:()=>l(we.Sophisticated),className:"mt-1"}),e.jsxs("div",{className:"ml-3",children:[e.jsx("div",{className:"text-base font-semibold",style:{color:"var(--metakyc-text-primary, #111827)"},children:"Sophisticated investor"}),e.jsx("div",{className:"text-sm mt-1",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:"In the last 2 years, I have done one or more of the following:"}),e.jsxs("ul",{className:"text-sm mt-2 space-y-1 list-none",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:[e.jsx("li",{children:"Worked in private equity or provided capital to small and medium enterprises, and/or"}),e.jsx("li",{children:"Been the director of a company with an annual turnover of at least (USD) $2m million, and/or"}),e.jsx("li",{children:"Invested directly in at least 2 private (not listed) companies."})]})]})]})}),e.jsx("label",{className:"block p-4 border-2 rounded-lg cursor-pointer transition-all",style:{borderColor:n===we.HighNetWorth?"var(--metakyc-primary, #2563eb)":"var(--metakyc-border, #e5e7eb)",backgroundColor:n===we.HighNetWorth?"var(--metakyc-primary-light, #dbeafe)":"transparent"},children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("input",{type:"radio",name:"investorType",value:we.HighNetWorth,checked:n===we.HighNetWorth,onChange:()=>l(we.HighNetWorth),className:"mt-1"}),e.jsxs("div",{className:"ml-3",children:[e.jsx("div",{className:"text-base font-semibold",style:{color:"var(--metakyc-text-primary, #111827)"},children:"High networth investor"}),e.jsxs("div",{className:"text-sm mt-1",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:["I earn more than (USD/EUR) $150,000 per year, and/or",e.jsx("br",{}),"I have net assets (excluding my main property) of at least $/EUR 300,000"]})]})]})}),y&&e.jsx("div",{className:"p-4 rounded-lg",style:{backgroundColor:"#fee2e2",border:"1px solid #fca5a5"},children:e.jsxs("p",{className:"text-sm",style:{color:"#991b1b"},children:[e.jsx("strong",{children:"Error:"})," ",y]})})]}),e.jsxs(fe,{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a&&e.jsx(Q,{type:"button",variant:"outline",onClick:a,children:"Back"}),e.jsx(Q,{type:"submit",isLoading:c,disabled:n===null,children:"Submit"})]})]})})};function At(t){const r=t.split(":").map(Number);return r.length===3?r[0]*3600+r[1]*60+r[2]:0}function xt(t){const r=Math.floor(t/60),a=t%60;return`${r.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}`}const Ur=({applicantId:t,onComplete:r,onBack:a})=>{const{appropriatenessTestService:s}=Re(),[n,l]=i.useState(null),[c,d]=i.useState(!0),[y,p]=i.useState(!1),[k,I]=i.useState(null),[w,E]=i.useState({}),[T,b]=i.useState(0),[C,O]=i.useState(!1),[q,F]=i.useState(!1),[D,X]=i.useState(0),[re,N]=i.useState(0),[f,z]=i.useState(null);i.useEffect(()=>{(async()=>{try{d(!0),I(null);const $=await s.getAppropriatenessTest(t);if(l($),$.waitTimeSpanForNextTry&&$.waitTimeSpanForNextTry!=="00:00:00"){const _=At($.waitTimeSpanForNextTry);_>0&&X(_)}}catch($){I($.message||"Failed to load appropriateness test")}finally{d(!1)}})()},[t,s]),i.useEffect(()=>{if(!C||T<=0)return;const $=setInterval(()=>{b(_=>_<=1?(F(!0),0):_-1)},1e3);return()=>clearInterval($)},[C,T]),i.useEffect(()=>{if(D<=0)return;const $=setInterval(()=>{X(_=>_<=1?0:_-1)},1e3);return()=>clearInterval($)},[D]),i.useEffect(()=>{q&&!y&&V()},[q]);const G=()=>{n&&(O(!0),b(n.testDurationSec),N(0),E({}),I(null))},Y=($,_)=>{E(ue=>({...ue,[$]:_}))},B=i.useCallback(async()=>{try{const $=await s.getAppropriatenessTest(t);if(l($),$.waitTimeSpanForNextTry&&$.waitTimeSpanForNextTry!=="00:00:00"){const _=At($.waitTimeSpanForNextTry);_>0&&X(_)}}catch{}},[t,s]),V=async $=>{if(n){if(!q){const _=n.appropriatenessQuestions.length-Object.keys(w).length;if(_>0){I(`Please answer all questions. ${_} remaining.`);return}}p(!0),I(null);try{const _=n.appropriatenessQuestions.map(R=>({appropriatenessQuestionId:R.id,value:w[R.id]||""})),ue={applicantId:t,appropriatenessTestId:n.id,appropriatenessQuestionResults:_};try{const R=await s.fillAppropriatenessTest(ue);R.isSuccess?z({success:!0,message:R.message||"Congratulations! You have passed the test."}):(z({success:!1,message:R.message||"You did not pass the test."}),setTimeout(()=>B(),1e3))}catch(R){if(R.code===400&&R.message)z({success:!1,message:R.message}),setTimeout(()=>B(),1500);else throw R}}catch(_){I(_.message||"Failed to submit test. Please try again."),ae()}finally{p(!1)}}},ae=()=>{O(!1),F(!1),E({}),N(0)};if(c)return e.jsx(Z,{children:e.jsx(ee,{children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"48px 0",gap:"16px"},children:[e.jsx(Ee,{className:"my-8"}),e.jsx("p",{style:{fontSize:"14px",color:"var(--metakyc-text-muted, #9ca3af)"},children:"Loading test..."})]})})});if(!n)return e.jsx(Z,{children:e.jsx(ee,{children:e.jsxs("div",{style:{textAlign:"center",padding:"48px 0"},children:[e.jsx("p",{style:{fontSize:"16px",fontWeight:600,color:"var(--metakyc-danger, #ef4444)"},children:"No test data available"}),k&&e.jsx("p",{style:{fontSize:"14px",color:"var(--metakyc-text-muted, #9ca3af)",marginTop:"8px"},children:k})]})})});const K=n.testAllowedMaxTry-n.totalFailedTries,ke=n.appropriatenessQuestions.length,oe=Object.keys(w).length;if(D>0)return e.jsxs(Z,{children:[e.jsx(he,{children:e.jsx("h2",{style:{fontSize:"18px",fontWeight:700,color:"var(--metakyc-text-primary, #111827)",margin:0},children:n.displayName})}),e.jsx(ee,{children:e.jsxs("div",{style:{textAlign:"center",padding:"32px 0"},children:[e.jsx("div",{style:{width:"100px",height:"100px",borderRadius:"50%",margin:"0 auto 20px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"color-mix(in srgb, var(--metakyc-primary, #2563eb) 8%, transparent)"},children:e.jsx("span",{style:{fontSize:"28px",fontWeight:700,color:"var(--metakyc-primary, #2563eb)",fontVariantNumeric:"tabular-nums"},children:xt(D)})}),e.jsx("p",{style:{fontSize:"15px",fontWeight:500,color:"var(--metakyc-text-primary, #111827)"},children:"Please wait before retrying"}),e.jsx("p",{style:{fontSize:"13px",color:"var(--metakyc-text-muted, #9ca3af)",marginTop:"4px"},children:"You can attempt the test again once the timer expires"}),k&&e.jsx("div",{style:{marginTop:"20px",padding:"12px 16px",borderRadius:"10px",backgroundColor:"color-mix(in srgb, var(--metakyc-danger, #ef4444) 8%, transparent)",border:"1px solid color-mix(in srgb, var(--metakyc-danger, #ef4444) 20%, transparent)"},children:e.jsx("p",{style:{fontSize:"13px",color:"var(--metakyc-danger, #ef4444)",margin:0},children:k})})]})})]});if(f){const $=()=>{z(null),ae(),I(null)};return e.jsxs(Z,{children:[e.jsx(ee,{children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",textAlign:"center",padding:"40px 16px",gap:"16px"},children:[e.jsx("div",{style:{width:"72px",height:"72px",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:f.success?"color-mix(in srgb, var(--metakyc-success, #10b981) 12%, transparent)":"color-mix(in srgb, var(--metakyc-danger, #ef4444) 10%, transparent)"},children:f.success?e.jsxs("svg",{width:"36",height:"36",viewBox:"0 0 24 24",fill:"none",stroke:"var(--metakyc-success, #10b981)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),e.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}):e.jsxs("svg",{width:"36",height:"36",viewBox:"0 0 24 24",fill:"none",stroke:"var(--metakyc-danger, #ef4444)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),e.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]})}),e.jsx("h2",{style:{fontSize:"20px",fontWeight:700,color:f.success?"var(--metakyc-success, #10b981)":"var(--metakyc-danger, #ef4444)",margin:0},children:f.success?"Test Passed":"Test Failed"}),e.jsx("p",{style:{fontSize:"14px",color:"var(--metakyc-text-secondary, #6b7280)",margin:0,lineHeight:1.6,maxWidth:"400px",whiteSpace:"pre-line"},children:f.message}),!f.success&&K>0&&e.jsx("div",{style:{marginTop:"4px",padding:"10px 20px",borderRadius:"10px",backgroundColor:"var(--metakyc-surface, #f9fafb)",border:"1px solid var(--metakyc-border, #e5e7eb)"},children:e.jsxs("p",{style:{fontSize:"13px",color:"var(--metakyc-text-muted, #9ca3af)",margin:0},children:["You have ",e.jsx("strong",{style:{color:"var(--metakyc-text-primary, #111827)"},children:K})," attempt",K!==1?"s":""," remaining"]})}),!f.success&&K<=0&&e.jsx("div",{style:{marginTop:"4px",padding:"10px 20px",borderRadius:"10px",backgroundColor:"color-mix(in srgb, var(--metakyc-danger, #ef4444) 8%, transparent)",border:"1px solid color-mix(in srgb, var(--metakyc-danger, #ef4444) 20%, transparent)"},children:e.jsx("p",{style:{fontSize:"13px",color:"var(--metakyc-danger, #ef4444)",margin:0},children:"No attempts remaining. Please contact support for assistance."})})]})}),e.jsx(fe,{children:e.jsx("div",{style:{display:"flex",justifyContent:"center",width:"100%",gap:"12px"},children:f.success?e.jsx(Q,{type:"button",onClick:()=>r==null?void 0:r(),children:"Continue"}):e.jsxs(e.Fragment,{children:[K>0&&D<=0&&e.jsx(Q,{type:"button",onClick:$,children:"Retake Test"}),K>0&&D>0&&e.jsx(Q,{type:"button",onClick:$,children:"OK"}),K<=0&&a&&e.jsx(Q,{type:"button",variant:"outline",onClick:a,children:"Back"})]})})})]})}if(!C)return e.jsxs(Z,{children:[e.jsxs(he,{children:[e.jsx("h2",{style:{fontSize:"18px",fontWeight:700,color:"var(--metakyc-text-primary, #111827)",margin:0},children:n.displayName}),n.subtitle&&e.jsx("p",{style:{fontSize:"14px",color:"var(--metakyc-text-secondary, #6b7280)",marginTop:"4px"},children:n.subtitle})]}),e.jsxs(ee,{children:[n.description&&e.jsxs("div",{style:{marginBottom:"20px",padding:"12px 14px",borderRadius:"10px",backgroundColor:"color-mix(in srgb, var(--metakyc-primary, #2563eb) 5%, var(--metakyc-background, #ffffff))",border:"1px solid color-mix(in srgb, var(--metakyc-primary, #2563eb) 15%, transparent)",display:"flex",gap:"10px"},children:[e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"var(--metakyc-primary, #2563eb)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0,marginTop:"1px"},children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),e.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]}),e.jsx("p",{style:{fontSize:"13px",color:"var(--metakyc-text-secondary, #374151)",margin:0,lineHeight:1.5},children:n.description})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px",marginBottom:"20px"},children:[e.jsx(ct,{icon:"questions",label:"Questions",value:String(n.totalQuestionCount)}),e.jsx(ct,{icon:"time",label:"Time Limit",value:xt(n.testDurationSec)}),e.jsx(ct,{icon:"target",label:"Pass Requirement",value:`${n.testCorrectAnswerPassLimit} correct`}),e.jsx(ct,{icon:"retry",label:"Attempts Left",value:String(K),variant:K<=1?"warning":"default"})]}),k&&e.jsxs("div",{style:{marginBottom:"16px",padding:"12px 14px",borderRadius:"10px",backgroundColor:"color-mix(in srgb, var(--metakyc-danger, #ef4444) 8%, transparent)",border:"1px solid color-mix(in srgb, var(--metakyc-danger, #ef4444) 20%, transparent)",display:"flex",gap:"10px"},children:[e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"var(--metakyc-danger, #ef4444)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0,marginTop:"1px"},children:[e.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),e.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),e.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),e.jsxs("p",{style:{fontSize:"13px",color:"var(--metakyc-danger, #ef4444)",margin:0,lineHeight:1.5},children:[e.jsx("strong",{children:"Previous attempt:"})," ",k]})]}),K<=0&&e.jsx("div",{style:{padding:"12px 14px",borderRadius:"10px",backgroundColor:"color-mix(in srgb, var(--metakyc-danger, #ef4444) 8%, transparent)",border:"1px solid color-mix(in srgb, var(--metakyc-danger, #ef4444) 20%, transparent)"},children:e.jsx("p",{style:{fontSize:"13px",color:"var(--metakyc-danger, #ef4444)",margin:0},children:"You have used all your attempts. Please contact support for assistance."})})]}),e.jsx(fe,{children:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:a?"space-between":"flex-end",width:"100%"},children:[a&&e.jsx(Q,{type:"button",variant:"outline",onClick:a,children:"Back"}),e.jsx(Q,{type:"button",onClick:G,disabled:K<=0,children:"Start Test"})]})})]});const de=n.appropriatenessQuestions[re],ge=re===ke-1,A=oe===ke,W=T<=60;return e.jsxs(Z,{children:[e.jsxs(he,{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs("div",{children:[e.jsx("h2",{style:{fontSize:"18px",fontWeight:700,color:"var(--metakyc-text-primary, #111827)",margin:0},children:n.displayName}),e.jsxs("p",{style:{fontSize:"12px",color:"var(--metakyc-text-muted, #9ca3af)",marginTop:"2px"},children:["Question ",re+1," of ",ke]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"6px 14px",borderRadius:"999px",backgroundColor:W?"color-mix(in srgb, var(--metakyc-danger, #ef4444) 10%, transparent)":"var(--metakyc-surface, #f3f4f6)",transition:"all 0.3s ease"},children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:W?"var(--metakyc-danger, #ef4444)":"var(--metakyc-text-muted, #9ca3af)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("polyline",{points:"12 6 12 12 16 14"})]}),e.jsx("span",{style:{fontSize:"16px",fontWeight:700,fontVariantNumeric:"tabular-nums",color:W?"var(--metakyc-danger, #ef4444)":"var(--metakyc-text-primary, #111827)",transition:"color 0.3s ease"},children:xt(T)})]})]}),e.jsxs("div",{style:{marginTop:"12px"},children:[e.jsx("div",{style:{height:"4px",borderRadius:"999px",backgroundColor:"var(--metakyc-border, #e5e7eb)",overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",borderRadius:"999px",backgroundColor:"var(--metakyc-primary, #2563eb)",width:`${oe/ke*100}%`,transition:"width 0.3s ease"}})}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginTop:"4px"},children:[e.jsxs("span",{style:{fontSize:"11px",color:"var(--metakyc-text-muted, #9ca3af)"},children:[oe," answered"]}),e.jsxs("span",{style:{fontSize:"11px",color:"var(--metakyc-text-muted, #9ca3af)"},children:[K," attempt",K!==1?"s":""," left"]})]})]})]}),e.jsxs(ee,{children:[de&&e.jsx(La,{question:de,index:re,selectedAnswer:w[de.id],onSelect:$=>Y(de.id,$),disabled:y}),ke>1&&e.jsx("div",{style:{display:"flex",justifyContent:"center",gap:"6px",marginTop:"20px",flexWrap:"wrap"},children:n.appropriatenessQuestions.map(($,_)=>e.jsx("button",{type:"button",onClick:()=>N(_),style:{width:"28px",height:"28px",borderRadius:"8px",border:_===re?"2px solid var(--metakyc-primary, #2563eb)":"1px solid var(--metakyc-border, #e5e7eb)",backgroundColor:w[$.id]?_===re?"color-mix(in srgb, var(--metakyc-primary, #2563eb) 15%, transparent)":"color-mix(in srgb, var(--metakyc-primary, #2563eb) 8%, transparent)":_===re?"var(--metakyc-surface, #f9fafb)":"var(--metakyc-background, #ffffff)",color:w[$.id]?"var(--metakyc-primary, #2563eb)":"var(--metakyc-text-muted, #9ca3af)",fontSize:"12px",fontWeight:600,cursor:"pointer",transition:"all 0.15s ease",padding:0,display:"flex",alignItems:"center",justifyContent:"center"},children:_+1},$.id))}),q&&e.jsxs("div",{style:{marginTop:"16px",padding:"12px 14px",borderRadius:"10px",backgroundColor:"color-mix(in srgb, #f59e0b 10%, transparent)",border:"1px solid color-mix(in srgb, #f59e0b 25%, transparent)",display:"flex",alignItems:"center",gap:"10px"},children:[e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"#f59e0b",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("polyline",{points:"12 6 12 12 16 14"})]}),e.jsx("p",{style:{fontSize:"13px",color:"#b45309",margin:0,fontWeight:500},children:"Time's up! Your answers are being submitted."})]}),k&&!q&&e.jsx("div",{style:{marginTop:"16px",padding:"12px 14px",borderRadius:"10px",backgroundColor:"color-mix(in srgb, var(--metakyc-danger, #ef4444) 8%, transparent)",border:"1px solid color-mix(in srgb, var(--metakyc-danger, #ef4444) 20%, transparent)"},children:e.jsx("p",{style:{fontSize:"13px",color:"var(--metakyc-danger, #ef4444)",margin:0},children:k})})]}),e.jsx(fe,{children:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"},children:[e.jsx(Q,{type:"button",variant:"outline",onClick:()=>{re>0?N($=>$-1):a==null||a()},disabled:y,children:re>0?"Previous":"Cancel"}),e.jsxs("div",{style:{display:"flex",gap:"8px"},children:[!ge&&e.jsx(Q,{type:"button",onClick:()=>N($=>$+1),children:"Next"}),(ge||A)&&e.jsx(Q,{type:"button",isLoading:y,onClick:()=>V(),disabled:!A&&!q,style:{opacity:A||q?1:.5},children:q?"Submitting...":"Submit Test"})]})]})})]})},Pa={questions:e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M9 11l3 3L22 4"}),e.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]}),time:e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("polyline",{points:"12 6 12 12 16 14"})]}),target:e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("circle",{cx:"12",cy:"12",r:"6"}),e.jsx("circle",{cx:"12",cy:"12",r:"2"})]}),retry:e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"23 4 23 10 17 10"}),e.jsx("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"})]})},ct=({icon:t,label:r,value:a,variant:s="default"})=>{const n=s==="warning";return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",padding:"14px",borderRadius:"10px",backgroundColor:n?"color-mix(in srgb, #f59e0b 8%, transparent)":"var(--metakyc-surface, #f9fafb)",border:n?"1px solid color-mix(in srgb, #f59e0b 20%, transparent)":"1px solid var(--metakyc-border, #e5e7eb)"},children:[e.jsx("div",{style:{color:n?"#f59e0b":"var(--metakyc-primary, #2563eb)",flexShrink:0},children:Pa[t]}),e.jsxs("div",{children:[e.jsx("p",{style:{fontSize:"12px",color:"var(--metakyc-text-muted, #9ca3af)",margin:0},children:r}),e.jsx("p",{style:{fontSize:"15px",fontWeight:600,color:n?"#b45309":"var(--metakyc-text-primary, #111827)",margin:0,marginTop:"1px"},children:a})]})]})},La=({question:t,selectedAnswer:r,onSelect:a,disabled:s})=>e.jsxs("div",{children:[e.jsxs("div",{style:{marginBottom:"16px"},children:[t.groupName&&e.jsx("span",{style:{display:"inline-block",fontSize:"11px",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:"var(--metakyc-primary, #2563eb)",marginBottom:"8px"},children:t.groupName}),e.jsx("h3",{style:{fontSize:"16px",fontWeight:600,color:"var(--metakyc-text-primary, #111827)",margin:0,lineHeight:1.5},children:t.question})]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:t.answers.map((n,l)=>{const c=r===n;return e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"12px",padding:"14px 16px",borderRadius:"10px",border:`2px solid ${c?"var(--metakyc-primary, #2563eb)":"var(--metakyc-border, #e5e7eb)"}`,backgroundColor:c?"color-mix(in srgb, var(--metakyc-primary, #2563eb) 5%, var(--metakyc-background, #ffffff))":"var(--metakyc-background, #ffffff)",cursor:s?"default":"pointer",transition:"all 0.15s ease",opacity:s?.6:1},onMouseEnter:d=>{!s&&!c&&(d.currentTarget.style.borderColor="color-mix(in srgb, var(--metakyc-primary, #2563eb) 50%, var(--metakyc-border, #e5e7eb))")},onMouseLeave:d=>{c||(d.currentTarget.style.borderColor="var(--metakyc-border, #e5e7eb)")},children:[e.jsx("div",{style:{width:"20px",height:"20px",borderRadius:"50%",border:`2px solid ${c?"var(--metakyc-primary, #2563eb)":"var(--metakyc-border, #d1d5db)"}`,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"border-color 0.15s ease"},children:c&&e.jsx("div",{style:{width:"10px",height:"10px",borderRadius:"50%",backgroundColor:"var(--metakyc-primary, #2563eb)"}})}),e.jsx("input",{type:"radio",name:`q-${t.id}`,value:n,checked:c,onChange:()=>a(n),disabled:s,style:{position:"absolute",opacity:0,width:0,height:0}}),e.jsx("span",{style:{fontSize:"14px",color:c?"var(--metakyc-text-primary, #111827)":"var(--metakyc-text-secondary, #6b7280)",fontWeight:c?500:400,transition:"color 0.15s ease"},children:n})]},l)})})]}),Kr=({applicantId:t,onComplete:r,onBack:a})=>{var Je,$e,tt,Ke;const{applicantService:s,baseInformationService:n,identityService:l,config:c,currentTheme:d}=Re(),{identityData:y,provider:p,token:k,isLoading:I,error:w,requestIdentity:E,restartIdentity:T}=Ar(t),[b,C]=i.useState(null),[O,q]=i.useState(null),[F,D]=i.useState([]),[X,re]=i.useState([]),[N,f]=i.useState(!0),[z,G]=i.useState(!1),[Y,B]=i.useState(null),[V,ae]=i.useState(!1),K=i.useRef(!1),[ke,oe]=i.useState({}),[de,ge]=i.useState({}),A=d!=null&&d.reviewPageFields&&d.reviewPageFields.length>0?d.reviewPageFields[0]:null,W=!!(d!=null&&d.reviewPageDisabled),$=i.useRef(!1);$.current=W;const _=Ye.useForm({defaultValues:{street:"",streetNumber:"",city:"",zip:"",country:"",nationality:"",phonenumber:""}});i.useEffect(()=>{if(W){K.current||(K.current=!0,E().then(()=>G(!0)).catch(M=>console.error("[Identity] Auto-request failed:",M)).finally(()=>f(!1)));return}(async()=>{try{const[M,U,H]=await Promise.all([s.getApplicantData(t),n.getCountries("","en"),n.getCountries("","en",40)]);q(M);const J=new Set,u=U.map(g=>({value:g.abbreviation3||g.abbreviation,label:g.name})).filter(g=>!g.value||J.has(g.value)?!1:(J.add(g.value),!0));D(u);const S=new Set,P=H.filter(g=>g.countryCode).map(g=>({value:g.countryCode,label:`${g.countryCode} – ${g.name}`})).filter(g=>S.has(g.value)?!1:(S.add(g.value),!0));re(P);const m=M.applicantRequestData;if(oe({firstName:(m==null?void 0:m.firstName)||"",lastName:(m==null?void 0:m.lastName)||"",email:(m==null?void 0:m.email)||"",dateOfBirth:(m==null?void 0:m.dateOfBirth)||"",title:(m==null?void 0:m.title)||"",salutation:(m==null?void 0:m.salutation)||"",phonenumber:(m==null?void 0:m.phonenumber)||"",mobileCountryCode:(m==null?void 0:m.mobileCountryCode)||"",street:(m==null?void 0:m.street)||"",streetNumber:(m==null?void 0:m.streetNumber)||"",city:(m==null?void 0:m.city)||"",zip:(m==null?void 0:m.zip)||"",country:(m==null?void 0:m.country)||"",nationality:(m==null?void 0:m.nationality)||"",taxCountry:(m==null?void 0:m.taxCountry)||"",countryOfBirth:(m==null?void 0:m.countryOfBirth)||"",placeOfBirth:(m==null?void 0:m.placeOfBirth)||"",educationLevel:(m==null?void 0:m.educationLevel)||"",occupation:(m==null?void 0:m.occupation)||"",taxNumber:(m==null?void 0:m.taxNumber)||"",defaultLanguage:(m==null?void 0:m.defaultLanguage)||""}),_.reset({street:(m==null?void 0:m.street)||"",streetNumber:(m==null?void 0:m.streetNumber)||"",city:(m==null?void 0:m.city)||"",zip:(m==null?void 0:m.zip)||"",country:(m==null?void 0:m.country)||"",nationality:(m==null?void 0:m.nationality)||"",phonenumber:(m==null?void 0:m.phonenumber)||""}),M.kycRecords&&M.kycRecords.length>0&&M.kycRecords[0].providerTokenObject!==null&&!K.current&&$.current){console.log("[Identity] Review page disabled + existing identity — auto-requesting..."),K.current=!0;try{await E(),G(!0)}catch(g){console.error("[Identity] Auto-request failed:",g)}}}catch(M){console.error("Error loading applicant data:",M)}finally{f(!1)}})()},[t]),i.useEffect(()=>{y&&!z&&$.current&&(console.log("[Identity] Review page disabled — showing cached provider"),G(!0))},[y,z]),i.useEffect(()=>{if(k){if(k.expiresAt){const x=new Date(k.expiresAt).getTime();if(Date.now()>=x){console.warn("[Identity] Token has expired (expiresAt)"),ae(!0),B("Your verification session has expired. Please restart.");return}}if(k.url)try{const M=new URL(k.url).toString().toLowerCase();if(M.includes("expired")||M.includes("invalid")||M.includes("error")){console.warn("[Identity] Token URL indicates expiration"),ae(!0),B("Your verification link has expired. Please restart.");return}}catch{console.error("[Identity] Invalid token URL")}if(k.status==="expired"||k.error==="expired"||k.expired===!0){console.warn("[Identity] Token object indicates expiration"),ae(!0),B("Your verification session has expired. Please restart.");return}}},[k]);const ue=p!==null&&p===Ae.Sumsub;i.useEffect(()=>{if(p!==null&&k&&!b&&z&&!V){const x=p;if(ue){console.log("[Sumsub] Fetching access token for Web SDK…"),B(null),(async()=>{try{const M=await l.refreshSumsubToken(t),U=He.parseProviderConfig(p,k,c);U.accessToken=M,U.onTokenRefresh=()=>l.refreshSumsubToken(t);const H=He.createProvider(p,U);H.onComplete(J=>{console.log("[Sumsub] Verification complete:",J),r==null||r()}),H.onError(J=>{console.error("[Sumsub] SDK error:",J),(typeof J=="string"?J:(J==null?void 0:J.message)||"Unknown error").toLowerCase().includes("expired")&&(ae(!0),B("Session expired. Please restart."))}),await H.initialize("sumsub-websdk-container"),console.log("[Sumsub] Web SDK launched"),C(H)}catch(M){console.error("[Sumsub] Initialization error:",M),B(`Failed to initialize: ${M.message||M}`),String(M.message||M).toLowerCase().includes("expired")&&ae(!0)}})();return}if(k.url){console.log("[Identity] Loading provider URL for user verification:",k.url),B(null);try{if(new URL(k.url),x===Ae.SardinAI){console.log("[SardinAI] Initializing Risk SDK in background...");try{const M=He.parseProviderConfig(p,k,c);He.createProvider(p,M).initialize().then(()=>console.log("[SardinAI] Risk SDK initialized in background")).catch(H=>console.warn("[SardinAI] Risk SDK init failed (non-blocking):",H))}catch(M){console.warn("[SardinAI] Risk SDK setup failed (non-blocking):",M)}}C({type:"url",url:k.url})}catch(M){console.error("[Identity] Invalid URL:",M),B("Invalid verification URL. Please restart."),ae(!0)}return}if(x===Ae.SardinAI){console.log("[SardinAI] No URL provided - initializing Risk SDK only..."),B(null);try{const M=He.parseProviderConfig(p,k,c),U=He.createProvider(p,M);U.initialize().then(()=>{console.log("[SardinAI] Risk SDK initialized successfully"),C(U),setTimeout(()=>r==null?void 0:r(),2e3)}).catch(H=>{var u;console.error("[SardinAI] Failed to initialize:",H);const J=((u=H.message)==null?void 0:u.toLowerCase())||"";J.includes("expired")||J.includes("invalid")||J.includes("401")||J.includes("400")?(ae(!0),B("Session expired or invalid. Please restart verification.")):B(`Failed to initialize: ${H.message}`)})}catch(M){console.error("[SardinAI] Error creating provider:",M),B(`Configuration error: ${M.message}`)}return}try{B(null);const M=He.parseProviderConfig(p,k,c),U=He.createProvider(p,M);x===Ae.Onfido&&U.initialize("identity-container").catch(H=>{console.error("[Onfido] Initialization error:",H),B(`Failed to initialize: ${H.message}`)}),C(U)}catch(M){console.error("[Identity] Provider setup error:",M),B(`Setup error: ${M.message}`)}}return()=>{if(b&&b.destroy)try{b.destroy()}catch(x){console.error("[Identity] Error destroying provider:",x)}}},[p,k,b,z,r,V,ue,t,c,l]);const R=async()=>{try{B(null),ae(!1),await E(),G(!0)}catch(x){console.error("Error starting identity verification:",x)}},te=async()=>{try{B(null),ae(!1),C(null),console.log("[Identity] Restarting verification..."),await T(),G(!0)}catch(x){console.error("Error restarting identity verification:",x),B(x.message||"Failed to restart verification")}};if(N||I)return e.jsx(Z,{children:e.jsxs(ee,{children:[e.jsx(Ee,{className:"my-8"}),e.jsx("p",{className:"text-center text-gray-600 dark:text-gray-400 mt-4",children:"Loading identity verification..."})]})});if(w)return e.jsx(Z,{children:e.jsx(ee,{children:e.jsxs("p",{className:"text-danger-500",children:["Error: ",w.message]})})});if(z&&(Y||V))return e.jsxs(Z,{children:[e.jsx(he,{children:e.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:"Verification Session Issue"})}),e.jsxs(ee,{children:[e.jsx("div",{className:"p-4 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg mb-6",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("svg",{className:"h-6 w-6 text-red-600 dark:text-red-400 mr-3 mt-0.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-red-900 dark:text-red-100 mb-1",children:V?"Session Expired":"Verification Error"}),e.jsx("p",{className:"text-red-800 dark:text-red-200 text-sm",children:Y||"Your verification session has expired and needs to be restarted."})]})]})}),e.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:[e.jsx("h3",{className:"font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"What to do next:"}),e.jsxs("ul",{className:"text-blue-800 dark:text-blue-200 text-sm space-y-1 list-disc list-inside",children:[e.jsx("li",{children:'Click "Restart Verification" below to generate a new session'}),e.jsx("li",{children:"Complete the verification process without delays"}),e.jsx("li",{children:"If issues persist, contact support"})]})]})]}),e.jsxs(fe,{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a&&e.jsx(Q,{type:"button",variant:"outline",onClick:a,children:"Back"}),e.jsx(Q,{type:"button",onClick:te,disabled:I,children:I?"Restarting...":"Restart Verification"})]})]});if(z&&y){const x=p;return ue?e.jsxs("div",{style:{background:"var(--metakyc-background, #ffffff)",borderRadius:"12px",border:"1px solid var(--metakyc-border, #e5e7eb)",overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"20px 24px",borderBottom:"1px solid var(--metakyc-border, #e5e7eb)"},children:[e.jsxs("div",{children:[e.jsx("h2",{style:{margin:0,fontSize:"20px",fontWeight:700,color:"var(--metakyc-text-primary, #111827)"},children:"Identity Verification"}),e.jsx("p",{style:{margin:"4px 0 0",fontSize:"14px",color:"var(--metakyc-text-secondary, #6b7280)"},children:"Please complete the identity verification process"})]}),e.jsx("button",{type:"button",onClick:te,disabled:I,style:{padding:"6px 14px",fontSize:"13px",fontWeight:500,borderRadius:"8px",border:"1px solid var(--metakyc-border, #d1d5db)",background:"var(--metakyc-background, #ffffff)",color:"var(--metakyc-text-primary, #111827)",cursor:I?"not-allowed":"pointer",opacity:I?.5:1},children:I?"Restarting…":"Restart"})]}),e.jsx("div",{id:"sumsub-websdk-container",style:{minHeight:"520px",width:"100%",padding:"16px 24px",background:"var(--metakyc-background, #ffffff)"}}),a&&e.jsx("div",{style:{padding:"16px 24px",borderTop:"1px solid var(--metakyc-border, #e5e7eb)"},children:e.jsx(Q,{variant:"outline",onClick:a,children:"Back"})})]}):k!=null&&k.url?e.jsxs(Z,{children:[e.jsx(he,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold",children:"Identity Verification"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:"Please complete the identity verification process"})]}),e.jsx(Q,{type:"button",variant:"outline",size:"sm",onClick:te,disabled:I,children:"Restart"})]})}),e.jsxs(ee,{children:[e.jsx("div",{className:"mb-4 p-3 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg",children:e.jsxs("p",{className:"text-yellow-800 dark:text-yellow-200 text-sm",children:[e.jsx("strong",{children:"Important:"}),' If you see an "expired" or "invalid link" message below, click the "Restart" button above to generate a new verification session.']})}),e.jsx("div",{className:"w-full",style:{height:"600px"},children:e.jsx("iframe",{src:k.url,className:"w-full h-full border-0 rounded-lg",allow:"camera; microphone; geolocation",title:"Identity Verification",onLoad:M=>{var U,H,J;console.log("[Identity] Iframe loaded");try{const u=M.target,S=u.contentDocument||((U=u.contentWindow)==null?void 0:U.document);if(S){const P=((J=(H=S.body)==null?void 0:H.textContent)==null?void 0:J.toLowerCase())||"";(P.includes("expired")||P.includes("invalid")||P.includes("error"))&&(console.warn("[Identity] Iframe shows expiration message"),ae(!0),B("Your verification link has expired."))}}catch{console.log("[Identity] Cannot check iframe content (CORS)")}}})})]}),a&&e.jsx(fe,{children:e.jsx(Q,{variant:"outline",onClick:a,children:"Back"})})]}):x===Ae.SardinAI?e.jsxs(Z,{children:[e.jsxs(he,{children:[e.jsx("h2",{className:"text-2xl font-bold",children:"Device Risk Assessment"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:"Analyzing device security and behavioral patterns..."})]}),e.jsx(ee,{children:e.jsxs("div",{className:"text-center py-12",children:[e.jsx(Ee,{className:"mb-4"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Please wait while we verify your device security"}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-500 mt-2",children:"This process is automatic and will complete in a few seconds"})]})})]}):e.jsxs(Z,{children:[e.jsxs(he,{children:[e.jsx("h2",{className:"text-2xl font-bold",children:"Identity Verification"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:"Please complete the identity verification process"})]}),e.jsx(ee,{children:e.jsx("div",{id:"identity-container",className:"min-h-[400px]"})}),a&&e.jsx(fe,{children:e.jsx(Q,{variant:"outline",onClick:a,children:"Back"})})]})}const me=new Set(["country","nationality","taxCountry","countryOfBirth","mobileCountryCode","otherNationality"]),se=(x=4)=>{const M=Math.min(4,Math.max(1,Number(x)||4));return{gridColumn:`span ${M} / span ${M}`}},be=(x,M)=>{if(!M&&M!==0)return"—";if(me.has(x)&&x!=="mobileCountryCode"){const U=F.find(H=>H.value===M);return U?U.label:String(M)}return String(M)},Pe=({helpText:x})=>{const[M,U]=i.useState(!1),H=i.useRef(null),[,J]=i.useState({top:0,left:0}),u=()=>{if(H.current){const S=H.current.getBoundingClientRect();J({top:S.bottom+window.scrollY+6,left:S.left+window.scrollX})}U(!0)};return e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"metakyc-help-btn",ref:H,onClick:u,style:{width:18,height:18,borderRadius:"50%",border:"1.5px solid var(--metakyc-primary, #2563eb)",background:"transparent",color:"var(--metakyc-primary, #2563eb)",fontSize:11,fontWeight:700,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,lineHeight:1,position:"relative",zIndex:2},children:"?"}),M&&pt.createPortal(e.jsx("div",{style:{position:"fixed",inset:0,zIndex:99999,background:"rgba(0,0,0,0.55)",backdropFilter:"blur(6px)",WebkitBackdropFilter:"blur(6px)",display:"flex",alignItems:"center",justifyContent:"center"},onClick:()=>U(!1),children:e.jsxs("div",{onClick:S=>S.stopPropagation(),style:{background:"var(--metakyc-surface, var(--metakyc-background, #ffffff))",border:"1px solid var(--metakyc-border, #e5e7eb)",borderRadius:"var(--metakyc-border-radius, 8px)",padding:"20px 24px",maxWidth:400,width:"90%",boxShadow:"0 24px 64px rgba(0,0,0,0.4)"},children:[e.jsx("div",{dangerouslySetInnerHTML:{__html:x},style:{fontSize:13,color:"var(--metakyc-text-primary, #111827)",lineHeight:1.6}}),e.jsx("button",{type:"button",onClick:()=>U(!1),style:{marginTop:12,padding:"4px 12px",fontSize:12,border:"1px solid var(--metakyc-border, #e5e7eb)",borderRadius:"var(--metakyc-border-radius, 6px)",background:"transparent",cursor:"pointer",color:"var(--metakyc-text-secondary, #6b7280)"},children:"Close"})]})}),document.body)]})},ve=(x,M)=>M?e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:5,flexWrap:"nowrap"},children:[e.jsx("div",{style:{flex:1,minWidth:0},children:x}),e.jsx("div",{style:{paddingTop:24},children:e.jsx(Pe,{helpText:M})})]}):x,Oe=(x,M)=>{const U=`cf-${M}`,H=x.paramName??"",J=de[H];if(x.customType==="br")return e.jsx("div",{style:{...se(x.colSpan),minHeight:"0.5rem"}},U);if(x.customType==="paragraph")return e.jsx("div",{style:se(x.colSpan),children:e.jsx("div",{className:"text-sm",style:{color:"var(--metakyc-text-secondary, #6b7280)"},dangerouslySetInnerHTML:{__html:x.label||""}})},U);if(x.customType==="html")return e.jsx("div",{style:se(x.colSpan),dangerouslySetInnerHTML:{__html:x.label||""}},U);if(x.customType==="link")return e.jsx("div",{style:se(x.colSpan),children:ve(e.jsx("a",{href:x.linkUrl??"#",target:"_blank",rel:"noopener noreferrer",className:"text-sm underline",style:{color:"var(--metakyc-primary, #6366f1)"},children:x.displayText||x.label||x.linkText||x.linkUrl}),x.helpText)},U);if(x.customType==="checkbox"||x.customType==="link_checkbox"){const u=J==="true"||J===!0;return e.jsx("div",{style:se(x.colSpan),children:ve(e.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:8,cursor:"pointer"},children:[e.jsx(Fe,{checked:!!u,onChange:S=>ge(P=>({...P,[H]:String(S)})),style:{marginTop:2}}),e.jsx("span",{className:"text-sm",style:{color:"var(--metakyc-text-primary, #111827)"},children:x.customType==="link_checkbox"&&x.linkUrl?e.jsxs(e.Fragment,{children:[e.jsx("a",{href:x.linkUrl,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--metakyc-primary, #6366f1)",textDecoration:"underline"},children:x.linkText||x.label}),x.label&&x.linkText?` ${x.label}`:""]}):x.displayText||x.label})]}),x.helpText)},U)}if(x.customType==="group_checkbox"){const u=Array.isArray(J)?J:J?[J]:[],S=P=>{x.singleSelect?ge(m=>({...m,[H]:u[0]===P?[]:[P]})):ge(m=>({...m,[H]:u.includes(P)?u.filter(o=>o!==P):[...u,P]}))};return e.jsx("div",{style:se(x.colSpan),children:ve(e.jsxs("div",{className:"space-y-1.5",children:[x.label&&e.jsx("p",{className:"text-sm font-medium",style:{color:"var(--metakyc-text-primary, #111827)"},children:x.displayText||x.label}),(x.options||[]).map(P=>e.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:8,cursor:"pointer"},children:[e.jsx(Fe,{checked:u.includes(P.value),onChange:()=>S(P.value),style:{marginTop:2}}),e.jsx("span",{className:"text-sm",style:{color:"var(--metakyc-text-primary, #111827)"},children:P.label})]},P.value))]}),x.helpText)},U)}return x.customType==="radio_group"?e.jsx("div",{style:se(x.colSpan),children:ve(e.jsxs("div",{className:"space-y-1.5",children:[x.label&&e.jsx("p",{className:"text-sm font-medium",style:{color:"var(--metakyc-text-primary, #111827)"},children:x.displayText||x.label}),(x.options||[]).map(u=>e.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"radio",name:`rg-${H}`,value:u.value,checked:J===u.value,onChange:()=>ge(S=>({...S,[H]:u.value})),style:{width:16,height:16,flexShrink:0,marginTop:2,accentColor:"var(--metakyc-primary, #6366f1)"}}),e.jsx("span",{className:"text-sm",style:{color:"var(--metakyc-text-primary, #111827)"},children:u.label})]},u.value))]}),x.helpText)},U):e.jsx("div",{style:se(x.colSpan),children:ve(e.jsx(xe,{label:x.displayText||x.label||H,value:String(J??""),onChange:u=>ge(S=>({...S,[H]:u.target.value}))}),x.helpText)},U)},et=(x,M)=>{if(x.isCustom)return Oe(x,M);const U=x.name??"",H=Ge[U],J=x.displayText||(H==null?void 0:H.label)||U,u=ke[U]??"",S=U==="mobileCountryCode",P=!!(H!=null&&H.countriesType)&&!S;return x.editable?S?e.jsx("div",{style:se(x.colSpan??2),children:ve(e.jsx(ze,{label:J,value:String(u),onChange:m=>oe(o=>({...o,[U]:m})),options:[{value:"",label:"Select country code…"},...X]}),x.helpText)},`epc-${M}`):P?e.jsx("div",{style:se(x.colSpan??2),children:ve(e.jsx(ze,{label:J,value:String(u),onChange:m=>oe(o=>({...o,[U]:m})),options:[{value:"",label:`Select ${J.toLowerCase()}…`},...F]}),x.helpText)},`ec-${M}`):e.jsx("div",{style:se(x.colSpan??2),children:ve(e.jsx(xe,{label:J,type:(H==null?void 0:H.type)==="date"?"date":(H==null?void 0:H.type)==="email"?"email":"text",value:String(u),onChange:m=>oe(o=>({...o,[U]:m.target.value}))}),x.helpText)},`ei-${M}`):e.jsx("div",{style:se(x.colSpan??2),children:ve(e.jsxs(e.Fragment,{children:[e.jsx("label",{className:"block text-sm font-medium mb-0.5",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:J}),e.jsx("p",{className:"text-sm",style:{color:"var(--metakyc-text-primary, #111827)",minHeight:"1.5rem"},children:be(U,u)})]}),x.helpText)},`ro-${M}`)};if(A){const x=A.title||"Review Your Information",M=A.subtitle||"Please review and confirm your information before starting identity verification";return e.jsx("form",{onSubmit:U=>{U.preventDefault(),R()},children:e.jsxs(Z,{children:[e.jsxs(he,{children:[e.jsx("h2",{className:"text-lg font-bold",style:{color:"var(--metakyc-text-primary, #111827)"},children:x}),e.jsx("p",{className:"mt-1 text-sm",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:M})]}),e.jsx(ee,{children:e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, minmax(0, 1fr))",gap:"1rem"},children:A.fields.map((U,H)=>et(U,H))})}),e.jsxs(fe,{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a&&e.jsx(Q,{type:"button",variant:"outline",onClick:a,children:"Back"}),e.jsx(Q,{type:"submit",isLoading:I,children:"Confirm and Start Verification"})]})]})})}return e.jsx("form",{onSubmit:_.handleSubmit(R),children:e.jsxs(Z,{children:[e.jsxs(he,{children:[e.jsx("h2",{className:"text-lg font-bold",style:{color:"var(--metakyc-text-primary, #111827)"},children:"Review Your Information"}),e.jsx("p",{className:"mt-1 text-sm",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:"Please review and confirm your information before starting identity verification"})]}),e.jsxs(ee,{className:"space-y-6",children:[e.jsx("div",{className:"space-y-4 pb-4",style:{borderBottom:"1px solid var(--metakyc-border, #e5e7eb)"},children:[{label:"Name",value:`${((Je=O==null?void 0:O.applicantRequestData)==null?void 0:Je.firstName)||""} ${(($e=O==null?void 0:O.applicantRequestData)==null?void 0:$e.lastName)||""}`.trim()},{label:"Email",value:(tt=O==null?void 0:O.applicantRequestData)==null?void 0:tt.email},{label:"Date of Birth",value:((Ke=O==null?void 0:O.applicantRequestData)==null?void 0:Ke.dateOfBirth)||"Not provided"}].map(({label:x,value:M})=>e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:x}),e.jsx("p",{className:"mt-1 text-base",style:{color:"var(--metakyc-text-primary, #111827)"},children:M})]},x))}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-base font-semibold",style:{color:"var(--metakyc-text-primary, #111827)"},children:"Address Information"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsx(Ye.Controller,{control:_.control,name:"country",render:({field:x})=>e.jsx(ze,{label:"Country",value:x.value,onChange:x.onChange,options:[{value:"",label:"Select country…"},...F]})}),e.jsx(Ye.Controller,{control:_.control,name:"nationality",render:({field:x})=>e.jsx(ze,{label:"Nationality",value:x.value,onChange:x.onChange,options:[{value:"",label:"Select nationality…"},...F]})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsx(Ye.Controller,{control:_.control,name:"street",render:({field:x})=>e.jsx(xe,{...x,label:"Street"})}),e.jsx(Ye.Controller,{control:_.control,name:"streetNumber",render:({field:x})=>e.jsx(xe,{...x,label:"Street Number"})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsx(Ye.Controller,{control:_.control,name:"city",render:({field:x})=>e.jsx(xe,{...x,label:"City"})}),e.jsx(Ye.Controller,{control:_.control,name:"zip",render:({field:x})=>e.jsx(xe,{...x,label:"ZIP / Postal Code"})})]}),e.jsx(Ye.Controller,{control:_.control,name:"phonenumber",render:({field:x})=>e.jsx(xe,{...x,label:"Phone Number",type:"tel"})})]})]}),e.jsxs(fe,{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a&&e.jsx(Q,{type:"button",variant:"outline",onClick:a,children:"Back"}),e.jsx(Q,{type:"submit",isLoading:I,children:"Confirm and Start Verification"})]})]})})},ft=({kycStatus:t,reviewStatus:r,workflowResult:a,customMessage:s,onContinue:n,onContactSupport:l})=>{const d=t===Ve.Approved?{type:"success",title:"Verification Approved",icon:"✓",iconBg:"bg-green-100 dark:bg-green-900/30",iconColor:"text-green-600 dark:text-green-400",message:"Your identity verification has been successfully approved."}:t===Ve.Rejected?{type:"error",title:"Verification Rejected",icon:"✕",iconBg:"bg-red-100 dark:bg-red-900/30",iconColor:"text-red-600 dark:text-red-400",message:"Unfortunately, your identity verification was not approved."}:t===Ve.Pending||t===Ve.InProgress?{type:"pending",title:"Verification Pending",icon:"⏱",iconBg:"bg-blue-100 dark:bg-blue-900/30",iconColor:"text-blue-600 dark:text-blue-400",message:"Your identity verification is currently being processed."}:r===Qe.Approved?{type:"success",title:"Application Approved",icon:"✓",iconBg:"bg-green-100 dark:bg-green-900/30",iconColor:"text-green-600 dark:text-green-400",message:"Your application has been approved."}:r===Qe.Reject?{type:"error",title:"Application Rejected",icon:"✕",iconBg:"bg-red-100 dark:bg-red-900/30",iconColor:"text-red-600 dark:text-red-400",message:"Your application has been rejected."}:r===Qe.UnderReview||r===Qe.AdminReview?{type:"pending",title:"Under Review",icon:"📋",iconBg:"bg-yellow-100 dark:bg-yellow-900/30",iconColor:"text-yellow-700 dark:text-yellow-400",message:"Your application is currently under manual review."}:a===ot.Success?{type:"success",title:"Process Complete",icon:"✓",iconBg:"bg-green-100 dark:bg-green-900/30",iconColor:"text-green-600 dark:text-green-400",message:"Your verification process has been completed successfully."}:a===ot.Failed?{type:"error",title:"Process Failed",icon:"✕",iconBg:"bg-red-100 dark:bg-red-900/30",iconColor:"text-red-600 dark:text-red-400",message:"The verification process could not be completed."}:a===ot.AdminReview?{type:"pending",title:"Admin Review Required",icon:"📋",iconBg:"bg-yellow-100 dark:bg-yellow-900/30",iconColor:"text-yellow-700 dark:text-yellow-400",message:"Your application requires administrator review."}:{type:"pending",title:"Processing",icon:"⏱",iconBg:"bg-blue-100 dark:bg-blue-900/30",iconColor:"text-blue-600 dark:text-blue-400",message:"Your application is being reviewed."};return e.jsxs(Z,{children:[e.jsxs(ee,{className:"py-12",children:[e.jsx("div",{className:"flex justify-center mb-6",children:e.jsx("div",{className:`w-24 h-24 rounded-full flex items-center justify-center ${d.iconBg}`,children:e.jsx("span",{className:`text-5xl ${d.iconColor}`,children:d.icon})})}),e.jsx("h2",{className:"text-3xl font-bold text-center mb-4",style:{color:"var(--metakyc-text-primary, #111827)"},children:d.title}),e.jsx("div",{className:"flex justify-center mb-6",children:e.jsx(wt,{variant:d.type==="success"?"success":d.type==="error"?"danger":d.type==="pending"?"warning":"info",children:t!=null?Ve[t]:Qe[r]})}),e.jsx("p",{className:"text-center mb-6 max-w-md mx-auto",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:s||d.message}),d.type==="success"&&e.jsxs("div",{className:"bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg p-4 mb-6",children:[e.jsx("h3",{className:"font-semibold text-green-900 dark:text-green-100 mb-2",children:"What's Next?"}),e.jsxs("ul",{className:"text-sm text-green-800 dark:text-green-200 space-y-1",children:[e.jsx("li",{children:"✓ Your identity has been verified"}),e.jsx("li",{children:"✓ You can now proceed with your application"}),e.jsx("li",{children:"✓ All features are now accessible"})]})]}),d.type==="error"&&e.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4 mb-6",children:[e.jsx("h3",{className:"font-semibold text-red-900 dark:text-red-100 mb-2",children:"What Can You Do?"}),e.jsxs("ul",{className:"text-sm text-red-800 dark:text-red-200 space-y-2",children:[e.jsx("li",{children:"• Review the requirements and ensure all information is correct"}),e.jsx("li",{children:"• Contact our support team for assistance"}),e.jsx("li",{children:"• You may be able to resubmit your application"})]})]}),d.type==="pending"&&e.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4 mb-6",children:[e.jsx("h3",{className:"font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"What Happens Next?"}),e.jsxs("ul",{className:"text-sm text-blue-800 dark:text-blue-200 space-y-2",children:[e.jsx("li",{children:"• Our team is reviewing your information"}),e.jsx("li",{children:"• You will be notified via email once the review is complete"}),e.jsx("li",{children:"• This typically takes 24-48 hours"}),e.jsx("li",{children:"• No action is required from you at this time"})]})]}),e.jsx("div",{className:"mt-6 pt-6",style:{borderTop:"1px solid var(--metakyc-border, #e5e7eb)"},children:e.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{style:{color:"var(--metakyc-text-muted, #9ca3af)"},children:"KYC Status:"}),e.jsx("div",{className:"font-medium mt-1",style:{color:"var(--metakyc-text-primary, #111827)"},children:t!=null?Ve[t]:"Not Available"})]}),e.jsxs("div",{children:[e.jsx("span",{style:{color:"var(--metakyc-text-muted, #9ca3af)"},children:"Review Status:"}),e.jsx("div",{className:"font-medium mt-1",style:{color:"var(--metakyc-text-primary, #111827)"},children:Qe[r]})]})]})})]}),e.jsxs(fe,{style:{display:"flex",justifyContent:"center",gap:"1rem"},children:[d.type==="success"&&n&&e.jsx(Q,{onClick:n,size:"lg",children:"Continue"}),d.type==="error"&&e.jsxs(e.Fragment,{children:[l&&e.jsx(Q,{variant:"outline",onClick:l,children:"Contact Support"}),n&&e.jsx(Q,{onClick:n,children:"Try Again"})]}),d.type==="pending"&&e.jsx("div",{className:"text-center",children:e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Please check back later or wait for our email notification"})})]})]})},qr=({config:t,className:r=""})=>!(t!=null&&t.visible)||!(t!=null&&t.url)?null:e.jsx("div",{className:`metakyc-logo ${r}`,children:e.jsx("img",{src:t.url,alt:t.alt||"Company Logo",style:{width:t.width||"auto",height:t.height||"40px",maxWidth:"100%",objectFit:"contain"},onError:a=>{console.warn("[Logo] Failed to load logo:",t.url),a.target.style.display="none"}})}),nt=({title:t,subtitle:r,className:a=""})=>{const{currentTheme:s}=Re(),n=t||(s==null?void 0:s.title)||"",l=!!(s!=null&&s.logo&&s.logo.visible&&s.logo.url),c=!!n;return!l&&!c?null:e.jsxs("div",{className:`metakyc-header ${a}`,children:[e.jsxs("div",{className:"metakyc-header-title flex items-center text-xl font-bold",style:{color:"var(--metakyc-text-primary, #111827)"},children:[l&&e.jsx(qr,{config:s.logo}),l&&c&&e.jsx("span",{style:{fontSize:"1.5rem",fontWeight:300,color:"var(--metakyc-text-muted, #9ca3af)",margin:"0 12px"},children:"|"}),c&&e.jsx("span",{style:{color:"var(--metakyc-text-primary, #111827)"},children:n})]}),r&&e.jsx("p",{className:"text-sm mt-1",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:r})]})},dt=["firstName","lastName","email","phonenumber","dateOfBirth"];function rt(t){return t==null||t===""||Array.isArray(t)&&t.length===0}const Da={width:"16px",height:"16px",minWidth:"16px",flexShrink:0,flexGrow:0,accentColor:"var(--metakyc-primary, #2563eb)",cursor:"pointer",margin:0,padding:0,display:"inline-block",verticalAlign:"middle"},Tt=({helpText:t,children:r})=>{const[a,s]=i.useState(!1);if(!t)return e.jsx(e.Fragment,{children:r});const n=a?e.jsx("div",{role:"dialog","aria-modal":"true",onClick:()=>s(!1),style:{position:"fixed",inset:0,zIndex:999999,background:"rgba(0, 0, 0, 0.55)",backdropFilter:"blur(6px)",WebkitBackdropFilter:"blur(6px)",display:"flex",alignItems:"center",justifyContent:"center",padding:"16px"},children:e.jsxs("div",{onClick:l=>l.stopPropagation(),style:{background:"var(--metakyc-surface, var(--metakyc-background, #ffffff))",border:"1px solid var(--metakyc-border, #e5e7eb)",borderRadius:"12px",padding:"28px 24px 24px",maxWidth:"480px",width:"100%",maxHeight:"80vh",overflowY:"auto",boxShadow:"0 24px 64px rgba(0,0,0,0.4)",position:"relative"},children:[e.jsx("button",{type:"button",onClick:()=>s(!1),"aria-label":"Close",style:{position:"absolute",top:"12px",right:"12px",width:"28px",height:"28px",borderRadius:"50%",border:"1px solid var(--metakyc-border, #e5e7eb)",background:"var(--metakyc-input-bg, #f3f4f6)",color:"var(--metakyc-text-secondary, #6b7280)",fontSize:"16px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",lineHeight:1},children:"×"}),e.jsx("div",{style:{color:"var(--metakyc-text-primary, #111827)",fontSize:"14px",lineHeight:1.75},dangerouslySetInnerHTML:{__html:t}})]})}):null;return e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"5px",flexWrap:"nowrap"},children:[r,e.jsx("button",{type:"button",className:"metakyc-help-btn",onClick:()=>s(!0),"aria-label":"Help",style:{flexShrink:0,marginTop:"2px",width:"18px",height:"18px",borderRadius:"50%",border:"1.5px solid var(--metakyc-primary, #2563eb)",background:"transparent",color:"var(--metakyc-primary, #2563eb)",fontSize:"10px",fontWeight:"700",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",lineHeight:1,padding:0,position:"relative",zIndex:2,transition:"background 0.15s, color 0.15s"},onMouseEnter:l=>{l.currentTarget.style.background="var(--metakyc-primary, #2563eb)",l.currentTarget.style.color="#ffffff"},onMouseLeave:l=>{l.currentTarget.style.background="transparent",l.currentTarget.style.color="var(--metakyc-primary, #2563eb)"},children:"?"}),typeof document<"u"&&n?pt.createPortal(n,document.body):null]})},Ma=({workflowKey:t,externalRefId:r,onSuccess:a,onCancel:s})=>{var U,H,J,u,S,P,m;const{config:n,baseInformationService:l,currentTheme:c}=Re(),{createApplicant:d,isLoading:y}=vt(),p=t||((U=n.applicantForm)==null?void 0:U.workflowKey);if(!p)throw new Error("workflowKey is required. Provide it either as a prop to CreateApplicantForm or set it in config.applicantForm.workflowKey");const k=r||((H=n.applicantForm)==null?void 0:H.externalRefId)||"",I=((J=n.applicantForm)==null?void 0:J.email)||"",w=((u=n.applicantForm)==null?void 0:u.hiddenValues)||{},E=((S=n.applicantForm)==null?void 0:S.initialValues)||{},b=(((P=n.applicantForm)==null?void 0:P.fieldLabelMode)||(c==null?void 0:c.fieldLabelMode)||"label")!=="placeholder",C=i.useMemo(()=>c!=null&&c.applicantFormPages&&c.applicantFormPages.length>0?c.applicantFormPages:null,[c==null?void 0:c.applicantFormPages]),O=i.useMemo(()=>{const o=new Set(dt),g=c==null?void 0:c.applicantFormRequiredFields;if(g)for(const L of g)o.add(L);if(C)for(const L of C)for(const h of L.fields)!h.isCustom&&h.name&&h.required&&o.add(h.name);return Array.from(o)},[c==null?void 0:c.applicantFormRequiredFields,C]),q=i.useMemo(()=>{var L;if(C){const h=C.flatMap(v=>v.fields).filter(v=>!v.isCustom&&v.name).map(v=>v.name),j=new Set(h);for(const v of dt)j.add(v);return Array.from(j)}let o;(L=n.applicantForm)!=null&&L.visibleFields?o=n.applicantForm.visibleFields:c!=null&&c.applicantFormVisibleFields&&c.applicantFormVisibleFields.length>0?o=c.applicantFormVisibleFields:o=Kt;const g=new Set(o);for(const h of dt)g.add(h);return Array.from(g)},[(m=n.applicantForm)==null?void 0:m.visibleFields,c==null?void 0:c.applicantFormVisibleFields,C]),F=new Set(["country","nationality","taxCountry","countryOfBirth","mobileCountryCode","otherNationality"]),D=i.useMemo(()=>{var g,L;const o=new Set;if(C)for(const h of C)for(const j of h.fields)!j.isCustom&&j.name&&F.has(j.name)&&o.add(j.countriesType??((g=Ge[j.name])==null?void 0:g.countriesType));else for(const h of q)F.has(h)&&o.add((L=Ge[h])==null?void 0:L.countriesType);return o.size===0&&o.add(void 0),Array.from(o)},[q,C]),[X,re]=i.useState({}),[N,f]=i.useState(!0),z=i.useRef(new Set),G=i.useRef(new Set);i.useEffect(()=>{if(!c)return;const o=D.filter(h=>{const j=h!=null?String(h):"all";return!G.current.has(j)&&!z.current.has(j)});if(o.length===0){D.every(j=>{const v=j!=null?String(j):"all";return G.current.has(v)})&&f(!1);return}f(!0);const g=o.map(h=>h!=null?String(h):"all");g.forEach(h=>z.current.add(h)),(async()=>{try{const h=await Promise.all(o.map(async j=>{const v=j!=null?String(j):"all",le=await l.getCountries("",n.locale||"en",j),ce=j===40,ye=new Set,Ie=le.map(ne=>ce&&ne.countryCode?{value:ne.countryCode,label:`${ne.countryCode} – ${ne.name}`}:{value:ne.abbreviation3||ne.abbreviation,label:ne.name}).filter(ne=>!ne.value||ye.has(ne.value)?!1:(ye.add(ne.value),!0));return G.current.add(v),z.current.delete(v),[v,Ie]}));re(j=>({...j,...Object.fromEntries(h)}))}catch(h){g.forEach(j=>z.current.delete(j)),console.error("Failed to load countries:",h)}finally{D.every(j=>{const v=j!=null?String(j):"all";return G.current.has(v)})&&f(!1)}})()},[D,c]);const Y=(o,g)=>{var j;const L=g??((j=Ge[o])==null?void 0:j.countriesType),h=L!=null?String(L):"all";return X[h]||[]},B={firstName:1,lastName:1,title:1,email:1,dateOfBirth:1,phonenumber:1,mobileCountryCode:1,street:1,streetNumber:1,zip:1,city:1,country:1,nationality:1,otherNationality:1,defaultLanguage:1,taxCountry:1,placeOfBirth:1,countryOfBirth:1,salutation:1,educationLevel:1,occupation:1,taxNumber:1},V=Object.fromEntries(Object.entries(w).filter(([o])=>o in B)),ae=Object.fromEntries(Object.entries(E).filter(([o])=>o in B)),[K,ke]=i.useState({workflowKey:p,firstName:"",lastName:"",title:"",email:I,dateOfBirth:"",phonenumber:"",externalRefId:k,mobileCountryCode:"",street:"",streetNumber:"",zip:"",city:"",country:"",nationality:"",otherNationality:[],defaultLanguage:"EN",taxCountry:"",placeOfBirth:"",countryOfBirth:"",salutation:null,educationLevel:"",occupation:"",taxNumber:"",...V,...ae}),oe=Object.fromEntries(Object.entries(w).filter(([o])=>!(o in V)&&o!=="externalRefId"&&o!=="workflowKey")),[de,ge]=i.useState({...oe}),[A,W]=i.useState(0),[$,_]=i.useState({}),[ue,R]=i.useState(null),[te,me]=i.useState(!1),se=(o,g)=>ke(L=>({...L,[o]:g})),be=(o,g)=>ge(L=>({...L,[o]:g})),Pe=o=>!o.conditionalOn||de[o.conditionalOn]==="true",ve=C&&A<C.length-1?A+1:-1,Oe=C&&A>0?A-1:-1,et=o=>{var L;const g={};for(const h of o.fields)if(h.isCustom){if(h.customType==="paragraph"||h.customType==="html"||h.customType==="br"||h.customType==="link")continue;if(h.required&&h.paramName){const j=de[h.paramName],v=h.displayText||h.label||h.paramName;h.customType==="checkbox"||h.customType==="link_checkbox"?j!=="true"&&(g[h.paramName]=`${v} is required.`):(!j||j.trim()==="")&&(g[h.paramName]=`${v} is required.`)}}else if(h.name){const j=h.name;if(O.includes(j)&&rt(K[j])){const v=h.displayText||((L=Ge[j])==null?void 0:L.label)||j;g[j]=`${v} is required.`}}return g},Je=async()=>{if(!C)return;const o=C[A];if(o.conditionalOn&&!Pe(o)){_({}),ve>=0?W(ve):await $e();return}const g=et(o);if(Object.keys(g).length>0){_(g);return}_({}),ve>=0?W(ve):await $e()},$e=async()=>{if(C){let o={};for(const g of C)Pe(g)&&(o={...o,...et(g)});if(Object.keys(o).length>0){_(o);return}}me(!0),R(null);try{if(!K.externalRefId||K.externalRefId.trim()===""){R("External Reference ID is required. Please pass it via config.applicantForm.externalRefId.");return}const o={workflowKey:K.workflowKey,externalRefId:K.externalRefId.trim()};if(C){for(const j of C)if(Pe(j)){for(const v of j.fields)if(!v.isCustom&&v.name){const le=v.name,ce=K[le];rt(ce)||(o[le]=ce)}}for(const j of dt)if(o[j]===void 0){const v=K[j];rt(v)||(o[j]=v)}}else q.forEach(j=>{if(j==="externalRefId")return;const v=K[j];rt(v)||(o[j]=v)});const g=[];if(C){for(const j of C)if(Pe(j))for(const v of j.fields){if(!v.isCustom||!v.paramName||v.customType==="paragraph"||v.customType==="html"||v.customType==="br"||v.customType==="link")continue;const le=de[v.paramName]??"";let ce;if(v.customType==="checkbox"||v.customType==="link_checkbox")ce=le==="true"?"yes":"no";else if(ce=le,!ce&&!v.required)continue;g.push({paramName:v.paramName,value:ce})}}for(const[j,v]of Object.entries(V))o[j]===void 0&&!rt(v)&&(o[j]=v);const L=new Set(g.map(j=>j.paramName));for(const[j,v]of Object.entries(oe))!L.has(j)&&v&&g.push({paramName:j,value:v});g.length>0&&(o.applicantAdditionalDatas=g);const h=await d(o);a(h.applicantId)}catch(o){console.error("Error creating applicant:",o),R(o.message||"Failed to create applicant")}finally{me(!1)}},tt=async o=>{var g;o.preventDefault();for(const L of O)if(rt(K[L])){const h=((g=Ge[L])==null?void 0:g.label)||L;R(`${h} is required.`);return}await $e()},Ke=(o,g,L,h,j)=>{var jt;const v=Ge[o];if(!v)return null;const le=O.includes(o),ce=$[o],ye=L||v.label,Ie=o in ae,ne=g??o,Le={required:le},Be=j?j!=="placeholder":b,qe=Be?ye:void 0,Yr=Be?"...":ye;switch(v.type){case"select":if(o==="country"||o==="nationality"||o==="taxCountry"||o==="countryOfBirth"||o==="mobileCountryCode"){const Ne=Y(o,h);return e.jsx(ze,{...Le,label:qe,value:K[o]||"",onChange:Xe=>se(o,Xe),options:[{value:"",label:`Select ${Yr.toLowerCase()}`},...Ne],disabled:N,readOnly:Ie,error:ce},ne)}if(o==="salutation")return e.jsx(ze,{...Le,label:qe,value:((jt=K[o])==null?void 0:jt.toString())||"",onChange:Ne=>se(o,Ne?Number(Ne):null),options:[{value:"",label:Be?"Select salutation...":ye},{value:lt.Male.toString(),label:"Male"},{value:lt.Female.toString(),label:"Female"},{value:lt.Other.toString(),label:"Other"}],readOnly:Ie,error:ce},ne);if(o==="defaultLanguage"){const Ne=c!=null&&c.allowedLanguages&&c.allowedLanguages.length>0?ht.filter(Xe=>c.allowedLanguages.includes(Xe.value)):ht;return e.jsx(ze,{...Le,label:qe,value:K[o]||"",onChange:Xe=>se(o,Xe),options:[{value:"",label:Be?"Select language...":ye},...Ne],readOnly:Ie,error:ce},ne)}return null;case"multiselect":if(o==="otherNationality"){const Ne=Y(o,h);return e.jsx(Fr,{...Le,label:qe,value:K[o]||[],onChange:Xe=>se(o,Xe),options:Ne,placeholder:Be?"Select other nationalities...":ye,disabled:N,readOnly:Ie},ne)}return null;case"date":return e.jsx(xe,{...Le,type:"date",label:qe,placeholder:Be?void 0:ye,value:K[o]||"",onChange:Ne=>se(o,Ne.target.value),readOnly:Ie,error:ce},ne);case"email":return e.jsx(xe,{...Le,type:"email",label:qe,placeholder:Be?void 0:ye,value:K[o]||"",onChange:Ne=>se(o,Ne.target.value),readOnly:Ie,error:ce},ne);case"tel":return e.jsx(xe,{...Le,type:"tel",label:qe,placeholder:Be?void 0:ye,value:K[o]||"",onChange:Ne=>se(o,Ne.target.value),readOnly:Ie,error:ce},ne);default:return e.jsx(xe,{...Le,type:"text",label:qe,placeholder:Be?void 0:ye,value:K[o]||"",onChange:Ne=>se(o,Ne.target.value),readOnly:Ie,error:ce},ne)}},x=(o,g)=>{const L=o.labelMode?o.labelMode!=="placeholder":b;if(o.customType==="paragraph"){const v=o.displayText||o.label||"";return e.jsx("p",{className:"metakyc-paragraph",style:{fontSize:"14px",lineHeight:"1.7",margin:0,color:"var(--metakyc-text-secondary, #6b7280)"},dangerouslySetInnerHTML:{__html:v}},`custom-${g}`)}if(o.customType==="html")return e.jsx("div",{dangerouslySetInnerHTML:{__html:o.label||""}},`custom-${g}`);if(o.customType==="br")return e.jsx("div",{style:{height:"12px"}},`custom-${g}`);if(o.customType==="link"){const v=o.displayText||o.label||o.linkText||o.linkUrl||"";return e.jsx("div",{className:"metakyc-link-field",children:e.jsxs("a",{href:o.linkUrl||"#",target:"_blank",rel:"noopener noreferrer",style:{display:"inline-flex",alignItems:"center",gap:"4px",color:"var(--metakyc-primary, #2563eb)",fontSize:"14px",textDecoration:"underline",cursor:"pointer"},children:[v,e.jsx("span",{style:{fontSize:"10px",opacity:.7},children:"↗"})]})},`custom-${g}`)}if(!o.paramName)return null;const h=$[o.paramName],j=o.displayText||o.label||o.paramName;if(o.customType==="checkbox")return e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("label",{className:"metakyc-option-label",style:{display:"flex",alignItems:"center",gap:"10px",cursor:"pointer",margin:0,padding:0},children:[e.jsx(Fe,{checked:de[o.paramName]==="true",onChange:v=>be(o.paramName,v?"true":"false")}),e.jsxs("span",{className:"metakyc-option-text",style:{fontSize:"14px",color:"var(--metakyc-text-primary, #111827)",lineHeight:"1.4"},children:[j,o.required&&e.jsx("span",{className:"text-red-500 ml-0.5",children:"*"})]})]}),h&&e.jsx("p",{className:"text-red-500 text-xs mt-0.5",children:h})]},`custom-${g}`);if(o.customType==="link_checkbox")return e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("label",{className:"metakyc-option-label",style:{display:"flex",alignItems:"center",gap:"10px",cursor:"pointer",margin:0,padding:0},children:[e.jsx(Fe,{checked:de[o.paramName]==="true",onChange:v=>be(o.paramName,v?"true":"false")}),e.jsxs("span",{className:"metakyc-option-text",style:{fontSize:"14px",color:"var(--metakyc-text-primary, #111827)",lineHeight:"1.4"},children:[j," ",o.linkUrl&&e.jsx("a",{href:o.linkUrl,target:"_blank",rel:"noopener noreferrer",className:"underline",style:{color:"var(--metakyc-primary, #2563eb)"},onClick:v=>v.stopPropagation(),children:o.linkText||o.linkUrl}),o.required&&e.jsx("span",{className:"text-red-500 ml-0.5",children:"*"})]})]}),h&&e.jsx("p",{className:"text-red-500 text-xs mt-0.5",children:h})]},`custom-${g}`);if(o.customType==="group_checkbox"){const v=(de[o.paramName]||"").split(",").filter(Boolean);return e.jsxs("div",{className:"flex flex-col gap-1.5",children:[L&&e.jsxs("div",{className:"text-sm font-medium",style:{color:"var(--metakyc-text-primary, #111827)"},children:[j,o.required&&e.jsx("span",{className:"text-red-500 ml-0.5",children:"*"})]}),e.jsx("div",{className:"metakyc-options-group",style:{display:"flex",flexDirection:"column",gap:"8px"},children:(o.options||[]).map(le=>{const ce=o.singleSelect?de[o.paramName]===le.value:v.includes(le.value);return e.jsxs("label",{className:"metakyc-option-label",style:{display:"flex",alignItems:"center",gap:"10px",cursor:"pointer",margin:0,padding:0},children:[e.jsx(Fe,{checked:ce,onChange:ye=>{if(o.singleSelect)be(o.paramName,ye?le.value:"");else{const Ie=ye?[...v,le.value]:v.filter(ne=>ne!==le.value);be(o.paramName,Ie.join(","))}}}),e.jsx("span",{className:"metakyc-option-text",style:{fontSize:"14px",color:"var(--metakyc-text-primary, #111827)",lineHeight:"1.4"},children:le.label})]},le.value)})}),h&&e.jsx("p",{className:"text-red-500 text-xs",children:h})]},`custom-${g}`)}return o.customType==="radio_group"?e.jsxs("div",{className:"flex flex-col gap-1.5",children:[L&&e.jsxs("div",{className:"text-sm font-medium",style:{color:"var(--metakyc-text-primary, #111827)"},children:[j,o.required&&e.jsx("span",{className:"text-red-500 ml-0.5",children:"*"})]}),e.jsx("div",{className:"metakyc-options-group",style:{display:"flex",flexDirection:"column",gap:"8px"},children:(o.options||[]).map(v=>e.jsxs("label",{className:"metakyc-option-label",style:{display:"flex",alignItems:"center",gap:"10px",cursor:"pointer",margin:0,padding:0},children:[e.jsx("input",{type:"radio",checked:de[o.paramName]===v.value,onChange:()=>be(o.paramName,v.value),name:`radio-group-${o.paramName}-${g}`,className:"metakyc-option-input",style:Da}),e.jsx("span",{className:"metakyc-option-text",style:{fontSize:"14px",color:"var(--metakyc-text-primary, #111827)",lineHeight:"1.4"},children:v.label})]},v.value))}),h&&e.jsx("p",{className:"text-red-500 text-xs",children:h})]},`custom-${g}`):e.jsx(xe,{type:"text",label:L?`${j}${o.required?" *":""}`:void 0,placeholder:L?void 0:j,value:de[o.paramName]||"",onChange:v=>be(o.paramName,v.target.value),required:o.required,error:h},`custom-${g}`)},M=(o,g)=>{const L=Pe(o);return e.jsxs("div",{className:"space-y-4",children:[o.conditionalOn&&e.jsx(Tt,{helpText:o.conditionalHelpText,children:e.jsxs("label",{className:"metakyc-option-label",style:{display:"flex",alignItems:"center",gap:"10px",cursor:"pointer",margin:0,padding:0},children:[e.jsx(Fe,{checked:L,onChange:h=>be(o.conditionalOn,h?"true":"false")}),e.jsx("span",{className:"metakyc-option-text",style:{fontSize:"14px",color:"var(--metakyc-text-primary, #111827)",lineHeight:"1.4",fontWeight:500},children:o.conditionalOn})]})}),L&&e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, minmax(0, 1fr))",gap:"1rem"},children:o.fields.map((h,j)=>{const v=Math.min(4,Math.max(1,Number(h.colSpan)||4)),le=h.isCustom?`custom-${j}-${h.paramName}`:`builtin-${h.name}-${j}`;return e.jsx("div",{style:{gridColumn:`span ${v} / span ${v}`},children:e.jsx(Tt,{helpText:h.helpText,children:h.isCustom?x(h,j):Ke(h.name,le,h.displayText,h.countriesType,h.labelMode)})},le)})})]})};if(!c||N)return e.jsx("div",{className:"metakyc-sdk",children:e.jsx(Z,{children:e.jsxs(ee,{children:[e.jsx(Ee,{className:"my-8"}),e.jsx("p",{className:"text-center mt-4",style:{color:"var(--metakyc-text-secondary, #6b7280)",fontSize:"0.875rem"},children:"Loading form…"})]})})});if(C){const o=C[A]??C[0],g=Oe===-1,L=ve===-1,h=C.length,j=Pe(o),v=Object.values($),le=h>1?(A+1)/h*100:100;return e.jsx("div",{className:"metakyc-sdk",children:e.jsxs(Z,{children:[h>1&&e.jsxs("div",{style:{position:"relative",height:"4px",borderRadius:"0.75rem 0.75rem 0 0",overflow:"hidden"},children:[e.jsx("div",{style:{position:"absolute",inset:0,backgroundColor:"var(--metakyc-primary, #2563eb)",opacity:.3}}),e.jsx("div",{style:{position:"absolute",top:0,left:0,bottom:0,backgroundColor:"var(--metakyc-primary, #2563eb)",width:`${le}%`,transition:"width 0.4s ease"}})]}),e.jsx(he,{children:e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between"},children:[e.jsx(nt,{title:(c==null?void 0:c.title)||"Create Applicant"}),h>1&&e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",padding:"2px 10px",borderRadius:"9999px",fontSize:"0.75rem",fontWeight:500,whiteSpace:"nowrap",backgroundColor:"var(--metakyc-input-bg, var(--metakyc-surface, #f9fafb))",color:"var(--metakyc-input-text, var(--metakyc-text-secondary, #6b7280))",border:"1px solid var(--metakyc-input-border, var(--metakyc-border, #e5e7eb))"},children:["Page ",A+1," of ",h]})]})}),e.jsxs(ee,{children:[(o.title||o.subtitle||o.description)&&e.jsxs("div",{className:"mb-4",children:[o.title&&e.jsx("h3",{className:"font-semibold text-base",style:{color:"var(--metakyc-text-primary, #111827)"},children:o.title}),o.subtitle&&e.jsx("p",{className:"text-sm mt-0.5",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:o.subtitle}),o.description&&o.description!==o.subtitle&&e.jsx("p",{className:"text-xs mt-1",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:o.description})]}),(ue||v.length>0)&&e.jsxs("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-lg",children:[ue&&e.jsxs("p",{className:"text-red-600 text-sm",children:[e.jsx("strong",{children:"Error:"})," ",ue]}),v.map((ce,ye)=>e.jsx("p",{className:"text-red-600 text-sm",children:ce},ye))]}),M(o)]}),e.jsxs(fe,{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsxs("div",{children:[!g&&e.jsx(Q,{type:"button",variant:"outline",onClick:()=>{W(Oe),_({})},disabled:te||y,children:"Previous"}),g&&s&&e.jsx(Q,{type:"button",variant:"outline",onClick:s,disabled:te||y,children:"Cancel"})]}),e.jsx(Q,{type:"button",isLoading:te||y,onClick:L?$e:Je,children:L?o.conditionalOn&&!j?"Skip & Submit":"Submit":o.conditionalOn&&!j?"Skip":"Next"})]})]})})}return e.jsx("div",{className:"metakyc-sdk",children:e.jsx("form",{onSubmit:tt,children:e.jsxs(Z,{children:[e.jsx(he,{children:e.jsx(nt,{title:(c==null?void 0:c.title)||"Create Applicant"})}),e.jsxs(ee,{children:[ue&&e.jsx("div",{className:"mb-6 p-4 bg-red-50 border border-red-200 rounded-lg",children:e.jsxs("p",{className:"text-red-600 text-sm",children:[e.jsx("strong",{children:"Error:"})," ",ue]})}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, minmax(0, 1fr))",gap:"1rem"},children:q.map(o=>e.jsx("div",{style:{gridColumn:"span 4 / span 4"},children:Ke(o)},o))})]}),e.jsxs(fe,{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[s&&e.jsx(Q,{type:"button",variant:"outline",onClick:s,disabled:te||y,children:"Cancel"}),e.jsx(Q,{type:"submit",isLoading:te||y,children:"Create Applicant"})]})]})})})},Ft=["companyName","email"];function gt(t){return t==null||t===""||Array.isArray(t)&&t.length===0}const za=({workflowKey:t,externalRefId:r,onSuccess:a,onCancel:s})=>{var Ke,x,M,U,H,J;const{config:n,baseInformationService:l,currentTheme:c}=Re(),{createCompanyApplicant:d,isLoading:y}=vt(),p=t||((Ke=n.applicantForm)==null?void 0:Ke.workflowKey);if(!p)throw new Error("workflowKey is required. Provide it either as a prop to CreateCompanyApplicantForm or set it in config.applicantForm.workflowKey");const k=r||((x=n.applicantForm)==null?void 0:x.externalRefId)||"",I=((M=n.applicantForm)==null?void 0:M.email)||"",w=((U=n.applicantForm)==null?void 0:U.initialValues)||{},T=(((H=n.applicantForm)==null?void 0:H.fieldLabelMode)||(c==null?void 0:c.fieldLabelMode)||"label")!=="placeholder",b=i.useMemo(()=>c!=null&&c.companyFormPages&&c.companyFormPages.length>0?c.companyFormPages:null,[c==null?void 0:c.companyFormPages]),C=i.useMemo(()=>{const u=new Set(Ft),S=c==null?void 0:c.companyFormRequiredFields;if(S)for(const P of S)u.add(P);if(b)for(const P of b)for(const m of P.fields)!m.isCustom&&m.name&&m.required&&u.add(m.name);return Array.from(u)},[c==null?void 0:c.companyFormRequiredFields,b]),O=i.useMemo(()=>{var u;if(b){const S=b.flatMap(m=>m.fields).filter(m=>!m.isCustom&&m.name).map(m=>m.name),P=new Set(S);for(const m of Ft)P.add(m);return Array.from(P)}return(u=n.applicantForm)!=null&&u.visibleFields?n.applicantForm.visibleFields:c!=null&&c.companyFormVisibleFields&&c.companyFormVisibleFields.length>0?c.companyFormVisibleFields:Ut},[(J=n.applicantForm)==null?void 0:J.visibleFields,c==null?void 0:c.companyFormVisibleFields,b]),q=new Set(["countryResidence","addressCountry"]),F=i.useMemo(()=>{var S,P;const u=new Set;if(b)for(const m of b)for(const o of m.fields)!o.isCustom&&o.name&&q.has(o.name)&&u.add(o.countriesType??((S=Ze[o.name])==null?void 0:S.countriesType));else for(const m of O)q.has(m)&&u.add((P=Ze[m])==null?void 0:P.countriesType);return u.size===0&&u.add(void 0),Array.from(u)},[O,b]),[D,X]=i.useState({}),[re,N]=i.useState(!0),f=i.useRef(new Set),z=i.useRef(new Set);i.useEffect(()=>{if(!c)return;const u=F.filter(m=>{const o=m!=null?String(m):"all";return!z.current.has(o)&&!f.current.has(o)});if(u.length===0){F.every(o=>z.current.has(o!=null?String(o):"all"))&&N(!1);return}N(!0);const S=u.map(m=>m!=null?String(m):"all");S.forEach(m=>f.current.add(m)),(async()=>{try{const m=await Promise.all(u.map(async o=>{const g=o!=null?String(o):"all",L=await l.getCountries("",n.locale||"en",o),h=new Set,j=L.map(v=>({value:v.abbreviation3||v.abbreviation,label:v.name})).filter(v=>!v.value||h.has(v.value)?!1:(h.add(v.value),!0));return z.current.add(g),f.current.delete(g),[g,j]}));X(o=>({...o,...Object.fromEntries(m)}))}catch(m){S.forEach(o=>f.current.delete(o)),console.error("Failed to load countries:",m)}finally{F.every(o=>z.current.has(o!=null?String(o):"all"))&&N(!1)}})()},[F,c]);const G=(u,S)=>{var o;const P=S??((o=Ze[u])==null?void 0:o.countriesType),m=P!=null?String(P):"all";return D[m]||[]},Y={companyName:1,registrationNumber:1,email:1,phone:1,countryResidence:1,legalAddress:1,incorporatedOn:1,controlScheme:1,taxId:1,registrationLocation:1,website:1,postalAddress:1,street:1,streetNumber:1,city:1,state:1,postalCode:1,addressCountry:1,lei:1},B=Object.fromEntries(Object.entries(w).filter(([u])=>u in Y)),[V,ae]=i.useState({workflowKey:p,companyName:"",email:I,phone:"",registrationNumber:"",countryResidence:"",legalAddress:"",incorporatedOn:"",controlScheme:"",taxId:"",registrationLocation:"",website:"",postalAddress:"",street:"",streetNumber:"",city:"",state:"",postalCode:"",addressCountry:"",lei:"",externalRefId:k,...B}),[K,ke]=i.useState({}),[oe,de]=i.useState(0),[ge,A]=i.useState({}),[W,$]=i.useState(null),[_,ue]=i.useState(!1),R=(u,S)=>ae(P=>({...P,[u]:S})),te=(u,S)=>ke(P=>({...P,[u]:S})),me=u=>!u.conditionalOn||K[u.conditionalOn]==="true",se=b&&oe<b.length-1?oe+1:-1,be=b&&oe>0?oe-1:-1,Pe=u=>{var P;const S={};for(const m of u.fields)if(m.isCustom){if(m.customType==="paragraph"||m.customType==="html"||m.customType==="br"||m.customType==="link")continue;if(m.required&&m.paramName){const o=K[m.paramName],g=m.displayText||m.label||m.paramName;m.customType==="checkbox"||m.customType==="link_checkbox"?o!=="true"&&(S[m.paramName]=`${g} is required.`):(!o||o.trim()==="")&&(S[m.paramName]=`${g} is required.`)}}else if(m.name){const o=m.name;if(C.includes(o)&&gt(V[o])){const g=m.displayText||((P=Ze[o])==null?void 0:P.label)||o;S[o]=`${g} is required.`}}return S},ve=async()=>{if(!b)return;const u=b[oe];if(u.conditionalOn&&!me(u)){A({}),se>=0?de(se):await Oe();return}const S=Pe(u);if(Object.keys(S).length>0){A(S);return}A({}),se>=0?de(se):await Oe()},Oe=async()=>{var u;if(b){let S={};for(const P of b)me(P)&&(S={...S,...Pe(P)});if(Object.keys(S).length>0){A(S);return}}ue(!0),$(null);try{const S={workflowKey:V.workflowKey,externalRefId:((u=V.externalRefId)==null?void 0:u.trim())||void 0},P=b?b.filter(g=>me(g)).flatMap(g=>g.fields).filter(g=>!g.isCustom&&g.name).map(g=>g.name):O;for(const g of P){const L=V[g];if(!gt(L))switch(g){case"companyName":S.companyName=L;break;case"email":S.companyEmail=L;break;case"phone":S.companyPhone=L;break;case"registrationNumber":S.companyRegistrationNumber=L;break;case"countryResidence":S.companyCountry=L;break;case"city":S.companyCity=L;break;case"street":S.companyStreet=L;break;case"postalCode":S.companyZip=L;break;default:S[g]=L;break}}const m=[];if(b){for(const g of b)if(me(g))for(const L of g.fields){if(!L.isCustom||!L.paramName||L.customType==="paragraph"||L.customType==="html"||L.customType==="br"||L.customType==="link")continue;const h=K[L.paramName]??"";let j;if(L.customType==="checkbox"||L.customType==="link_checkbox")j=h==="true"?"yes":"no";else if(j=h,!j&&!L.required)continue;m.push({paramName:L.paramName,value:j})}}m.length>0&&(S.applicantAdditionalDatas=m);const o=await d(S);a(o.applicantId)}catch(S){console.error("Error creating company applicant:",S),$(S.message||"Failed to create company applicant")}finally{ue(!1)}},et=async u=>{var S;u.preventDefault();for(const P of C)if(gt(V[P])){const m=((S=Ze[P])==null?void 0:S.label)||P;$(`${m} is required.`);return}await Oe()},Je=(u,S,P,m,o)=>{const g=Ze[u];if(!g)return null;const L=C.includes(u),h=ge[u],j=P||g.label,v=u in B,le=S??u,ce=o?o!=="placeholder":T,ye=ce?j:void 0,Ie=ce?"...":j;switch(g.type){case"select":if(u==="countryResidence"||u==="addressCountry"){const ne=G(u,m);return e.jsx(ze,{required:L,label:ye,value:V[u]||"",onChange:Le=>R(u,Le),options:[{value:"",label:`Select ${Ie.toLowerCase()}`},...ne],disabled:re,readOnly:v,error:h},le)}return null;case"date":return e.jsx(xe,{required:L,type:"date",label:ye,placeholder:ce?void 0:j,value:V[u]||"",onChange:ne=>R(u,ne.target.value),readOnly:v,error:h},le);case"email":return e.jsx(xe,{required:L,type:"email",label:ye,placeholder:ce?void 0:j,value:V[u]||"",onChange:ne=>R(u,ne.target.value),readOnly:v,error:h},le);case"tel":return e.jsx(xe,{required:L,type:"tel",label:ye,placeholder:ce?void 0:j,value:V[u]||"",onChange:ne=>R(u,ne.target.value),readOnly:v,error:h},le);default:return e.jsx(xe,{required:L,type:"text",label:ye,placeholder:ce?void 0:j,value:V[u]||"",onChange:ne=>R(u,ne.target.value),readOnly:v,error:h},le)}},$e=(u,S)=>{if(u.customType==="paragraph")return e.jsx("p",{style:{fontSize:"14px",lineHeight:"1.7",margin:0,color:"var(--metakyc-text-secondary, #6b7280)"},dangerouslySetInnerHTML:{__html:u.displayText||u.label||""}},`custom-${S}`);if(u.customType==="html")return e.jsx("div",{dangerouslySetInnerHTML:{__html:u.label||""}},`custom-${S}`);if(u.customType==="br")return e.jsx("div",{style:{height:"12px"}},`custom-${S}`);if(u.customType==="link")return e.jsx("div",{children:e.jsx("a",{href:u.linkUrl||"#",target:"_blank",rel:"noopener noreferrer",style:{color:"var(--metakyc-primary, #2563eb)",fontSize:"14px",textDecoration:"underline"},children:u.displayText||u.label||u.linkText||u.linkUrl||""})},`custom-${S}`);if(!u.paramName)return null;const P=ge[u.paramName],m=u.displayText||u.label||u.paramName,o=u.labelMode?u.labelMode!=="placeholder":T;return u.customType==="checkbox"?e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"10px",cursor:"pointer"},children:[e.jsx(Fe,{checked:K[u.paramName]==="true",onChange:g=>te(u.paramName,g?"true":"false")}),e.jsxs("span",{style:{fontSize:"14px",color:"var(--metakyc-text-primary, #111827)"},children:[m,u.required&&e.jsx("span",{className:"text-red-500 ml-0.5",children:"*"})]})]}),P&&e.jsx("p",{className:"text-red-500 text-xs mt-0.5",children:P})]},`custom-${S}`):e.jsx(xe,{type:"text",label:o?`${m}${u.required?" *":""}`:void 0,placeholder:o?void 0:m,value:K[u.paramName]||"",onChange:g=>te(u.paramName,g.target.value),required:u.required,error:P},`custom-${S}`)},tt=u=>{const S=me(u);return e.jsxs("div",{className:"space-y-4",children:[u.conditionalOn&&e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"10px",cursor:"pointer"},children:[e.jsx(Fe,{checked:S,onChange:P=>te(u.conditionalOn,P?"true":"false")}),e.jsx("span",{style:{fontSize:"14px",fontWeight:500},children:u.conditionalOn})]}),S&&e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, minmax(0, 1fr))",gap:"1rem"},children:u.fields.map((P,m)=>{const o=Math.min(4,Math.max(1,Number(P.colSpan)||4)),g=P.isCustom?`custom-${m}-${P.paramName}`:`builtin-${P.name}-${m}`;return e.jsx("div",{style:{gridColumn:`span ${o} / span ${o}`},children:P.isCustom?$e(P,m):Je(P.name,g,P.displayText,P.countriesType,P.labelMode)},g)})})]})};if(!c||re)return e.jsx("div",{className:"metakyc-sdk",children:e.jsx(Z,{children:e.jsxs(ee,{children:[e.jsx(Ee,{className:"my-8"}),e.jsx("p",{className:"text-center mt-4",style:{color:"var(--metakyc-text-secondary, #6b7280)",fontSize:"0.875rem"},children:"Loading form…"})]})})});if(b){const u=b[oe]??b[0],S=be===-1,P=se===-1,m=b.length,o=me(u),g=Object.values(ge);return e.jsx("div",{className:"metakyc-sdk",children:e.jsxs(Z,{children:[e.jsx(he,{children:e.jsx(nt,{title:(c==null?void 0:c.title)||"Company Registration"})}),e.jsxs(ee,{children:[(u.title||u.subtitle)&&e.jsxs("div",{className:"mb-4",children:[u.title&&e.jsx("h3",{className:"font-semibold text-base",style:{color:"var(--metakyc-text-primary, #111827)"},children:u.title}),u.subtitle&&e.jsx("p",{className:"text-sm mt-0.5",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:u.subtitle})]}),(W||g.length>0)&&e.jsxs("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-lg",children:[W&&e.jsxs("p",{className:"text-red-600 text-sm",children:[e.jsx("strong",{children:"Error:"})," ",W]}),g.map((L,h)=>e.jsx("p",{className:"text-red-600 text-sm",children:L},h))]}),m>1&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",marginBottom:"1rem"},children:[b.map((L,h)=>e.jsx("div",{style:{height:"0.375rem",borderRadius:"9999px",transition:"all 150ms",...h===oe?{flex:"1 1 0%",backgroundColor:"var(--metakyc-primary, #2563eb)"}:h<oe?{width:"2rem",backgroundColor:"var(--metakyc-primary-light, #93c5fd)",opacity:.7}:{width:"2rem",backgroundColor:"#e5e7eb"}}},h)),e.jsxs("span",{style:{fontSize:"0.75rem",color:"var(--metakyc-text-muted, #9ca3af)",flexShrink:0},children:[oe+1," / ",m]})]}),tt(u)]}),e.jsxs(fe,{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsxs("div",{children:[!S&&e.jsx(Q,{type:"button",variant:"outline",onClick:()=>{de(be),A({})},disabled:_||y,children:"Previous"}),S&&s&&e.jsx(Q,{type:"button",variant:"outline",onClick:s,disabled:_||y,children:"Cancel"})]}),e.jsx(Q,{type:"button",isLoading:_||y,onClick:P?Oe:ve,children:P?u.conditionalOn&&!o?"Skip & Submit":"Submit":u.conditionalOn&&!o?"Skip":"Next"})]})]})})}return e.jsx("div",{className:"metakyc-sdk",children:e.jsx("form",{onSubmit:et,children:e.jsxs(Z,{children:[e.jsx(he,{children:e.jsx(nt,{title:(c==null?void 0:c.title)||"Company Registration"})}),e.jsxs(ee,{children:[W&&e.jsx("div",{className:"mb-6 p-4 bg-red-50 border border-red-200 rounded-lg",children:e.jsxs("p",{className:"text-red-600 text-sm",children:[e.jsx("strong",{children:"Error:"})," ",W]})}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, minmax(0, 1fr))",gap:"1rem"},children:O.map(u=>e.jsx("div",{style:{gridColumn:"span 4 / span 4"},children:Je(u)},u))})]}),e.jsxs(fe,{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[s&&e.jsx(Q,{type:"button",variant:"outline",onClick:s,disabled:_||y,children:"Cancel"}),e.jsx(Q,{type:"submit",isLoading:_||y,children:"Register Company"})]})]})})})},Oa=({applicantId:t,onComplete:r,onError:a,className:s})=>{const{progress:n,currentStep:l,steps:c,workflowKey:d,nextWorkflowKey:y,hasWorkflowChanged:p,isLoading:k,error:I,moveBack:w,refreshProgress:E}=Nr(t),[T,b]=i.useState(!1),C=i.useRef(null);if(i.useEffect(()=>{I&&a&&a(I)},[I,a]),i.useEffect(()=>{n!=null&&n.workflowResult&&r&&r(n.workflowResult)},[n==null?void 0:n.workflowResult,r]),i.useEffect(()=>{p&&b(!1)},[p]),k||!n)return e.jsx("div",{className:`metakyc-sdk ${s||""}`,children:e.jsx(Z,{children:e.jsxs(ee,{children:[e.jsx(Ee,{className:"my-8"}),e.jsx("p",{className:"text-center mt-4",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:"Loading workflow..."})]})})});if(I)return e.jsx("div",{className:`metakyc-sdk ${s||""}`,children:e.jsx(Z,{children:e.jsx(ee,{children:e.jsxs("div",{className:"text-center py-8",children:[e.jsx("p",{className:"text-lg mb-4",style:{color:"var(--metakyc-danger, #ef4444)"},children:"An error occurred"}),e.jsx("p",{style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:I.message})]})})})});if(p&&!T)return e.jsx("div",{className:`metakyc-sdk ${s||""}`,children:e.jsx(Z,{children:e.jsx(ee,{children:e.jsxs("div",{className:"text-center py-8",children:[e.jsx("div",{className:"mb-6",children:e.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full mb-4",style:{backgroundColor:"var(--metakyc-primary-light, #dbeafe)"},children:e.jsx("svg",{className:"w-8 h-8",style:{color:"var(--metakyc-primary, #2563eb)"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})})}),e.jsx("h3",{className:"text-xl font-semibold mb-2",style:{color:"var(--metakyc-text-primary, #111827)"},children:"Workflow Transition"}),e.jsx("p",{className:"mb-6",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:"Your application workflow has been updated based on your progress."}),e.jsxs("div",{className:"rounded-lg p-4 mb-6 max-w-md mx-auto",style:{backgroundColor:"var(--metakyc-surface, #f9fafb)"},children:[e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsxs("div",{className:"text-left",children:[e.jsx("p",{className:"mb-1",style:{color:"var(--metakyc-text-muted, #9ca3af)"},children:"Previous Workflow"}),e.jsx("p",{className:"font-medium",style:{color:"var(--metakyc-text-primary, #111827)"},children:d})]}),e.jsx("svg",{className:"w-6 h-6 mx-4",style:{color:"var(--metakyc-text-muted, #9ca3af)"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 7l5 5m0 0l-5 5m5-5H6"})}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"mb-1",style:{color:"var(--metakyc-text-muted, #9ca3af)"},children:"New Workflow"}),e.jsx("p",{className:"font-medium",style:{color:"var(--metakyc-primary, #2563eb)"},children:y})]})]}),n.nextWorkflowName&&e.jsx("p",{className:"text-center mt-2 text-xs",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:n.nextWorkflowName})]}),e.jsx("button",{onClick:()=>b(!0),className:"px-6 py-3 font-medium rounded-lg transition-opacity hover:opacity-90",style:{backgroundColor:"var(--metakyc-primary, #2563eb)",color:"#ffffff"},children:"Continue with New Workflow"})]})})})});if(n.status===Te.Finished||n.status===Te.OnHold)return e.jsx("div",{className:`metakyc-sdk ${s||""}`,children:e.jsx(ft,{kycStatus:n.kycStatus,reviewStatus:n.reviewStatus,workflowResult:n.workflowResult,customMessage:n.customMessage,onContinue:r&&n.workflowResult?()=>r(n.workflowResult):void 0,onContactSupport:()=>{typeof window<"u"&&(window.location.href="mailto:support@example.com")}})});if(!l)return e.jsx("div",{className:`metakyc-sdk ${s||""}`,children:e.jsx(Z,{children:e.jsxs(ee,{children:[e.jsx(Ee,{className:"my-8"}),e.jsx("p",{className:"text-center mt-4",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:n.status===Te.IdentityPending?"Loading identity verification...":"Loading current step..."})]})})});const O=D=>{switch(D){case ie.Overview:return"Overview";case ie.Questionaries:return"Questionnaire";case ie.UploadDocument:return"Documents";case ie.IdentitySdk:return"Identity";case ie.RiskScoring:return"Risk Assessment";case ie.InvestorCategorization:return"Investor Categorization";case ie.AppropriatenessTest:return"Appropriateness Test";case ie.AdditionalData:return"Additional Data";case ie.ManualReview:return"Review";default:return""}},q=()=>{const D=c.filter(z=>z.visibility!==!1),X=D.findIndex(z=>z.order===l.order),re=X>=0?X+1:1,N=D.length,f=N>1?(X+1)/N*100:100;return e.jsxs("div",{style:{marginBottom:"24px",backgroundColor:"var(--metakyc-surface, var(--metakyc-background, #ffffff))",borderRadius:"0.75rem",border:"1px solid var(--metakyc-border, #e5e7eb)",overflow:"hidden"},children:[e.jsxs("div",{style:{position:"relative",height:"4px"},children:[e.jsx("div",{style:{position:"absolute",inset:0,backgroundColor:"var(--metakyc-primary, #2563eb)",opacity:.3}}),e.jsx("div",{style:{position:"absolute",top:0,left:0,bottom:0,backgroundColor:"var(--metakyc-primary, #2563eb)",width:`${f}%`,transition:"width 0.4s ease"}})]}),e.jsxs("div",{style:{padding:"1rem 1.5rem"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",marginBottom:"16px"},children:[e.jsx(nt,{}),e.jsxs(wt,{variant:n.status===1?"info":"success",children:["Step ",re," of ",N]})]}),e.jsx($a,{ref:C,visibleSteps:D,currentVisibleStepIndex:X,getStepFallbackName:O})]})]})},F=()=>{const D={applicantId:t,onComplete:async()=>{await E()},onBack:l.order>0?w:void 0};switch(l.action){case ie.Questionaries:return e.jsx($r,{...D});case ie.UploadDocument:return e.jsx(Br,{...D});case ie.Overview:return e.jsx(_r,{...D});case ie.IdentitySdk:return e.jsx(Kr,{...D});case ie.RiskScoring:return e.jsx(Hr,{...D});case ie.AdditionalData:case ie.InvestorCategorization:return e.jsx(Wr,{...D});case ie.AppropriatenessTest:return e.jsx(Ur,{...D});case ie.ManualReview:return e.jsx(ft,{kycStatus:n.kycStatus,reviewStatus:n.reviewStatus,workflowResult:n.workflowResult,customMessage:n.customMessage});default:return e.jsx(Z,{children:e.jsxs(ee,{className:"py-12 text-center",children:[e.jsx("div",{className:"mb-4",children:e.jsx(Ee,{})}),e.jsxs("p",{className:"text-gray-600 dark:text-gray-400 mb-2",children:["Processing step: ",l.title||l.name]}),e.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Action type: ",ie[l.action]]})]})})}};return e.jsxs("div",{className:`metakyc-sdk ${s||""}`,children:[q(),F()]})},$a=i.forwardRef(({visibleSteps:t,currentVisibleStepIndex:r,getStepFallbackName:a},s)=>{const n=i.useRef(null),l=i.useRef(null);return i.useImperativeHandle(s,()=>n.current),i.useEffect(()=>{if(l.current&&n.current){const c=n.current,d=l.current,y=d.offsetLeft-c.offsetWidth/2+d.offsetWidth/2;c.scrollTo({left:Math.max(0,y),behavior:"smooth"})}},[r]),e.jsx("div",{ref:n,className:"metakyc-stepper-scroll",style:{display:"flex",alignItems:"center",width:"100%",overflowX:"auto",overflowY:"hidden",scrollbarWidth:"none",msOverflowStyle:"none",WebkitOverflowScrolling:"touch",padding:"4px 0",gap:"0"},children:t.map((c,d)=>{const y=d<r,p=d===r,k=y||p,I=c.displayName||c.name||a(c.action)||`Step ${d+1}`;return e.jsxs(i.Fragment,{children:[e.jsxs("div",{ref:p?l:void 0,style:{display:"flex",alignItems:"center",flexShrink:0},children:[e.jsx("div",{style:{width:"28px",height:"28px",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"12px",fontWeight:600,flexShrink:0,transition:"all 0.2s ease",...k?{backgroundColor:"var(--metakyc-primary, #2563eb)",color:"#ffffff",border:"none"}:{backgroundColor:"transparent",color:"var(--metakyc-text-muted, #9ca3af)",border:"2px solid var(--metakyc-border, #e5e7eb)"}},children:y?e.jsx("svg",{width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:2.5,viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}):d+1}),e.jsx("span",{style:{marginLeft:"6px",fontSize:"13px",whiteSpace:"nowrap",fontWeight:p?600:400,color:p?"var(--metakyc-text-primary, #111827)":y?"var(--metakyc-primary, #2563eb)":"var(--metakyc-text-muted, #9ca3af)",transition:"color 0.2s ease"},children:I})]}),d<t.length-1&&e.jsx("div",{style:{flex:"1 1 0%",minWidth:"16px",height:"2px",margin:"0 8px",borderRadius:"999px",backgroundColor:"var(--metakyc-primary, #2563eb)",opacity:y?1:.25,transition:"opacity 0.2s ease"}})]},c.order)})})});function Ba(t){return Ue.z.object({questionResults:Ue.z.any()}).passthrough()}function _a(t){let r=Ue.z.array(Ue.z.instanceof(File));if(t.isRequired?r=r.min(1,`${t.displayName} is required`):r=r.optional(),t.multipleFile||(r=r.refine(a=>!a||a.length<=1,{message:"Only one file is allowed"})),t.maxEachFileSizeByte>0&&(r=r.refine(a=>!a||a.every(s=>s.size<=t.maxEachFileSizeByte),{message:`File size must not exceed ${Math.round(t.maxEachFileSizeByte/1024/1024)}MB`})),t.allowedTypes){const a=t.allowedTypes.split(",").map(s=>s.trim());r=r.refine(s=>s?s.every(n=>a.some(l=>l.endsWith("/*")?n.type.startsWith(l.slice(0,-2)):n.type===l)):!0,{message:"Invalid file type"})}return r}function Ha(t){const r={};return t.uploadDocumentFiles.forEach(a=>{const s=`file_${a.id}`;r[s]=_a(a)}),Ue.z.object(r)}function Wa(t){return Ue.z.any()}function Ua(t){return Ue.z.string().min(1,"This question is required")}function Ka(t){const r={};return t.appropriatenessQuestions.forEach(a=>{const s=`question_${a.id}`;r[s]=Ua()}),Ue.z.object(r)}const qa=Ue.z.any();exports.ALLOWED_LANGUAGES=ht;exports.ApplicantProgressOnHoldReason=Pt;exports.ApplicantProgressStatus=Te;exports.ApplicantService=Qt;exports.ApplicantStatus=Dt;exports.AppropriatenessQuestionType=Bt;exports.AppropriatenessTestService=Xt;exports.AppropriatenessTestStep=Ur;exports.Badge=wt;exports.BaseInformationService=rr;exports.Button=Q;exports.COMPANY_FIELD_METADATA=Ze;exports.Card=Z;exports.CardContent=ee;exports.CardFooter=fe;exports.CardHeader=he;exports.Checkbox=Fe;exports.CountriesType=We;exports.CreateApplicantForm=Ma;exports.CreateCompanyApplicantForm=za;exports.CriteriaBuiltInType=Ht;exports.DEFAULT_COMPANY_VISIBLE_FIELDS=Ut;exports.DEFAULT_VISIBLE_FIELDS=Kt;exports.DocumentReviewStatus=$t;exports.EndpointBuilder=Yt;exports.ErrorHandler=at;exports.EventEmitter=mr;exports.FIELD_METADATA=Ge;exports.FileType=Ot;exports.FileUpload=Pr;exports.GenderType=lt;exports.Header=nt;exports.HttpClient=Vt;exports.IdentityProviderManager=He;exports.IdentityService=tr;exports.IdentityVerificationProvider=Ae;exports.IdentityVerificationStep=Kr;exports.Input=xe;exports.InvestorCategorizationService=ar;exports.InvestorCategorizationStep=Wr;exports.InvestorCategorizationType=we;exports.InvestorCategoryType=Wt;exports.KycProcessStatus=Mt;exports.KycStatus=Ve;exports.KycStatusDisplay=ft;exports.KycWorkflow=Oa;exports.Logo=qr;exports.MetaKYCContext=bt;exports.MetaKYCError=De;exports.MetaKYCProvider=sa;exports.MultiSelect=Fr;exports.OnfidoProvider=gr;exports.OverviewService=Zt;exports.OverviewStep=_r;exports.PhoneInput=Lr;exports.QuestionnaireService=Gt;exports.QuestionnaireStep=$r;exports.ReviewStatus=Qe;exports.RiskCriteriaType=_t;exports.RiskLevel=Lt;exports.RiskScoringService=er;exports.RiskScoringStep=Hr;exports.SDK_VERSION=kr;exports.SardinAIProvider=hr;exports.SearchableSelect=ze;exports.Select=ut;exports.Spinner=Ee;exports.StepRouter=ur;exports.SumsubProvider=xr;exports.ThemeManager=fr;exports.ThemePreset=Se;exports.ThemeService=dr;exports.UploadDocumentService=Jt;exports.UploadDocumentStep=Br;exports.UserType=zt;exports.ValueDataType=Me;exports.WorkflowOrchestrator=yr;exports.WorkflowResultType=ot;exports.WorkflowState=pr;exports.WorkflowStepAction=ie;exports.appropriatenessTestSchema=qa;exports.clearAllStorage=ca;exports.clearApplicantId=jr;exports.clearWorkflowState=Cr;exports.cn=Ce;exports.corporateTheme=sr;exports.defaultConfig=qt;exports.defaultTheme=je;exports.fileToBase64=br;exports.fintechTheme=nr;exports.formatFileSize=mt;exports.generateAppropriatenessSchema=Ka;exports.generateQuestionnaireSchema=Ba;exports.generateRiskScoringSchema=Wa;exports.generateUploadDocumentSchema=Ha;exports.getAcceptString=oa;exports.getApplicantId=wr;exports.getThemePreset=st;exports.getWorkflowState=la;exports.healthcareTheme=ir;exports.isScriptLoaded=Xr;exports.loadScript=kt;exports.minimalTheme=lr;exports.modernTheme=or;exports.removeScript=Zr;exports.saveApplicantId=vr;exports.saveWorkflowState=Sr;exports.themePresets=cr;exports.useApplicant=vt;exports.useAppropriatenessTest=da;exports.useIdentityVerification=Ar;exports.useKycWorkflow=Nr;exports.useMetaKYC=Re;exports.useOverview=Er;exports.useQuestionnaire=Rr;exports.useRiskScoring=Tr;exports.useUploadDocument=Ir;exports.validateFileSize=na;exports.validateFileType=ia;
124
+ */const va=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Or=Mr("chevron-right",va);function wa(t,r){const a=!r||r.length===0||r.every(s=>!s||!s.trim());if(t.isRequired&&a)return t.errorMessage||"This field is required";if(!a){const s=r[0]??"";if(s&&t.regex)try{if(!new RegExp(t.regex).test(s))return t.errorMessage||"Invalid format"}catch{}if(s!==""){const n=Number(s);if(!isNaN(n)&&s.trim()!==""){if(t.min!==void 0&&t.min!==null&&n<t.min)return`Minimum value is ${t.min}`;if(t.max!==void 0&&t.max!==null&&n>t.max)return`Maximum value is ${t.max}`}else{if(t.min!==void 0&&t.min!==null&&s.length<t.min)return`Minimum length is ${t.min} characters`;if(t.max!==void 0&&t.max!==null&&s.length>t.max)return`Maximum length is ${t.max} characters`}}}return null}function ja(t){const r=t.flatMap((s,n)=>(s.questions??[]).map((l,c)=>({question:l,groupIndex:n,qIdx:c}))),a=new Map;for(const s of r){const n=s.question.pageNumber!=null&&s.question.pageNumber>0?s.question.pageNumber:1;a.has(n)||a.set(n,[]),a.get(n).push(s)}return Array.from(a.entries()).sort(([s],[n])=>s-n).map(([,s])=>s)}const $r=({applicantId:t,onComplete:r,onBack:a})=>{const{questionnaire:s,initialAnswers:n,isLoading:l,isSubmitting:c,error:d,submit:y}=Rr(t),[p,k]=i.useState({}),[I,w]=i.useState({}),[A,T]=i.useState(0);i.useEffect(()=>{n&&Object.keys(n).length>0&&Object.keys(p).length===0&&k(n)},[n]);const b=i.useMemo(()=>s?ja(s.questionGroups):[],[s]),S=A===b.length-1,O=b[A]??[],q=i.useCallback((N,h)=>{k(z=>({...z,[N]:h})),w(z=>{const G={...z};return delete G[N],G})},[]),F=i.useCallback(()=>{const N={};for(const{question:h}of O){const z=wa(h,p[h.id]??[]);z&&(N[h.id]=z)}return w(h=>({...h,...N})),Object.keys(N).length===0},[O,p]),D=()=>{F()&&T(N=>N+1)},X=()=>{A>0?T(N=>N-1):a==null||a()},re=async()=>{if(!(!F()||!s))try{const N=s.questionGroups.flatMap(z=>(z.questions??[]).map(G=>({questionId:G.id,values:p[G.id]??[]}))),h={applicantId:t,questionnarieId:s.id,questionResults:N};await y(h),r==null||r()}catch(N){console.error("Questionnaire submit error:",N)}};return l?e.jsx(Z,{children:e.jsx(ee,{children:e.jsx(Ee,{className:"my-8"})})}):d?e.jsx(Z,{children:e.jsx(ee,{children:e.jsxs("p",{className:"text-danger-500",children:["Error loading questionnaire: ",d.message]})})}):s?e.jsxs(Z,{children:[e.jsxs(he,{children:[e.jsx("h2",{className:"text-lg font-bold",children:s.displayName}),s.subtitle&&e.jsx("p",{className:"text-sm",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:s.subtitle}),b.length>1&&e.jsxs("div",{className:"flex items-center justify-between mt-3",children:[e.jsxs("span",{className:"text-xs",style:{color:"var(--metakyc-text-muted, #9ca3af)"},children:["Page ",A+1," of ",b.length]}),e.jsx("div",{className:"flex items-center gap-1.5",children:b.map((N,h)=>e.jsx("div",{className:"rounded-full transition-all duration-200",style:{height:"6px",width:h===A?"20px":"6px",backgroundColor:h<=A?"var(--metakyc-primary, #2563eb)":"var(--metakyc-border, #e5e7eb)"}},h))})]})]}),e.jsx(ee,{className:"space-y-6",children:O.map(({question:N})=>e.jsx(Sa,{question:N,value:p[N.id]??[],error:I[N.id],onChange:h=>q(N.id,h)},N.id))}),e.jsxs(fe,{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs(Q,{type:"button",variant:"outline",onClick:X,style:{display:"flex",alignItems:"center",gap:"4px"},children:[e.jsx(zr,{size:14}),A>0?"Previous":"Back"]}),S?e.jsx(Q,{type:"button",isLoading:c,onClick:re,children:"Continue"}):e.jsxs(Q,{type:"button",onClick:D,style:{display:"flex",alignItems:"center",gap:"4px"},children:["Next",e.jsx(Or,{size:14})]})]}),d&&e.jsx("div",{className:"mx-6 mb-4 p-3 bg-red-50 border border-red-200 rounded",children:e.jsx("p",{className:"text-red-600 text-sm",children:d.message})})]}):null},Sa=({question:t,value:r,error:a,onChange:s})=>{var c;const l=(((c=t.defaultAnswers)==null?void 0:c.length)??0)>0?t.showAsDropdown?t.canMultipleAnswer?"multi-select":"single-select":t.canMultipleAnswer?"checkbox":"radio":"text";return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{className:"block text-sm font-medium",style:{color:"var(--metakyc-text-primary, #111827)"},children:[t.text,t.isRequired&&e.jsx("span",{className:"text-danger-500 ml-1",children:"*"})]}),t.subtitle&&e.jsx("p",{className:"text-xs",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:t.subtitle}),t.description&&e.jsx("p",{className:"text-xs",style:{color:"var(--metakyc-text-muted, #9ca3af)"},children:t.description}),l==="text"&&e.jsx(ye,{value:r[0]??"",onChange:d=>s([d.target.value]),placeholder:t.subtitle?void 0:"Enter your answer…",error:a,required:t.isRequired}),l==="single-select"&&e.jsx(ut,{value:r[0]??"",onChange:d=>s([d.target.value]),options:(t.defaultAnswers??[]).map(d=>({value:d,label:d})),placeholder:"Select an option…",error:a,required:t.isRequired}),l==="radio"&&e.jsxs("div",{className:"metakyc-options-group",style:{display:"flex",flexDirection:"column",gap:"8px"},children:[(t.defaultAnswers??[]).map(d=>e.jsxs("label",{className:"metakyc-option-label",style:{display:"flex",alignItems:"center",gap:"10px",cursor:"pointer",margin:0,padding:0},children:[e.jsx("input",{type:"radio",checked:r[0]===d,onChange:()=>s([d]),className:"metakyc-option-input",style:{width:"16px",height:"16px",minWidth:"16px",flexShrink:0,flexGrow:0,accentColor:"var(--metakyc-primary, #2563eb)",cursor:"pointer",margin:0,padding:0,display:"inline-block",verticalAlign:"middle"}}),e.jsx("span",{className:"metakyc-option-text",style:{fontSize:"14px",color:"var(--metakyc-text-primary, #111827)",lineHeight:"1.4",marginLeft:0},children:d})]},d)),a&&e.jsx("p",{className:"text-sm text-danger-500",children:a})]}),(l==="checkbox"||l==="multi-select")&&e.jsxs("div",{className:"metakyc-options-group",style:{display:"flex",flexDirection:"column",gap:"8px"},children:[(t.defaultAnswers??[]).map(d=>e.jsxs("label",{className:"metakyc-option-label",style:{display:"flex",alignItems:"center",gap:"10px",cursor:"pointer",margin:0,padding:0},children:[e.jsx(Fe,{checked:r.includes(d),onChange:y=>{s(y?[...r,d]:r.filter(p=>p!==d))}}),e.jsx("span",{className:"metakyc-option-text",style:{fontSize:"14px",color:"var(--metakyc-text-primary, #111827)",lineHeight:"1.4",marginLeft:0},children:d})]},d)),a&&e.jsx("p",{className:"text-sm text-danger-500",children:a})]}),a&&l==="text"&&null]})};function Ca(t){const r=new Map;for(const a of t){const s=a.pageNumber!=null&&a.pageNumber>0?a.pageNumber:1;r.has(s)||r.set(s,[]),r.get(s).push(a)}return Array.from(r.entries()).sort(([a],[s])=>a-s).map(([,a])=>a)}const Br=({applicantId:t,onComplete:r,onBack:a})=>{const{uploadDocument:s,isLoading:n,isSubmitting:l,error:c,submit:d}=Ir(t),[y,p]=i.useState({}),[k,I]=i.useState(null),[w,A]=i.useState(0),[T,b]=i.useState({}),S=i.useMemo(()=>s?Ca(s.uploadDocumentFiles):[],[s]),O=S[w]??[],q=w===S.length-1,F=S.length,D=i.useCallback(()=>{const h={};for(const z of O)z.isRequired&&(y[z.id]||[]).length===0&&(h[z.id]=`${z.displayName} is required`);return b(h),Object.keys(h).length===0},[O,y]),X=()=>{D()&&(A(h=>h+1),b({}))},re=()=>{w>0?(A(h=>h-1),b({})):a==null||a()},N=async()=>{if(!(!D()||!s)){I(null);try{const h=await Promise.all(s.uploadDocumentFiles.map(async G=>{const Y=y[G.id]||[],B=await Promise.all(Y.map(async V=>({fileName:V.name,fileData:await br(V)})));return{uploadDocumentFileId:G.id,valueList:B}})),z={applicantId:t,uploadDocumentId:s.id,uploadDocumentResults:h};await d(z),r==null||r()}catch(h){I((h==null?void 0:h.message)||"Failed to submit documents. Please try again.")}}};return n?e.jsx(Z,{children:e.jsx(ee,{children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"48px 0",gap:"16px"},children:[e.jsx(Ee,{className:"my-8"}),e.jsx("p",{style:{fontSize:"14px",color:"var(--metakyc-text-muted, #9ca3af)"},children:"Loading document requirements..."})]})})}):c?e.jsx(Z,{children:e.jsx(ee,{children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"32px 0",gap:"12px",textAlign:"center"},children:[e.jsx("div",{style:{width:"48px",height:"48px",borderRadius:"50%",backgroundColor:"color-mix(in srgb, var(--metakyc-danger, #ef4444) 10%, transparent)",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--metakyc-danger, #ef4444)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),e.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]})}),e.jsx("p",{style:{fontSize:"14px",color:"var(--metakyc-danger, #ef4444)",fontWeight:500},children:"Error loading document requirements"}),e.jsx("p",{style:{fontSize:"13px",color:"var(--metakyc-text-muted, #9ca3af)"},children:c.message})]})})}):s?e.jsxs(Z,{children:[e.jsxs(he,{children:[e.jsx("h2",{style:{fontSize:"18px",fontWeight:700,color:"var(--metakyc-text-primary, #111827)",margin:0},children:s.displayName||"Upload Documents"}),s.subtitle&&e.jsx("p",{style:{fontSize:"14px",color:"var(--metakyc-text-secondary, #6b7280)",marginTop:"4px"},children:s.subtitle}),F>1&&e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginTop:"12px"},children:[e.jsxs("span",{style:{fontSize:"12px",color:"var(--metakyc-text-muted, #9ca3af)"},children:["Page ",w+1," of ",F]}),e.jsx("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:S.map((h,z)=>e.jsx("div",{style:{height:"6px",width:z===w?"20px":"6px",borderRadius:"999px",transition:"all 0.2s ease",backgroundColor:z<=w?"var(--metakyc-primary, #2563eb)":"var(--metakyc-border, #e5e7eb)"}},z))})]})]}),s.description&&w===0&&e.jsxs("div",{style:{margin:"0 24px",marginTop:"4px",display:"flex",gap:"10px",padding:"12px 14px",borderRadius:"10px",backgroundColor:"color-mix(in srgb, var(--metakyc-primary, #2563eb) 5%, var(--metakyc-background, #ffffff))",border:"1px solid color-mix(in srgb, var(--metakyc-primary, #2563eb) 15%, transparent)"},children:[e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"var(--metakyc-primary, #2563eb)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0,marginTop:"1px"},children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),e.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]}),e.jsx("p",{style:{fontSize:"13px",color:"var(--metakyc-text-secondary, #374151)",margin:0,lineHeight:1.5},children:s.description})]}),e.jsx(ee,{children:e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"24px"},children:O.map(h=>e.jsx(Pr,{label:h.displayName,subtitle:h.subtitle,accept:h.allowedTypes,multiple:h.multipleFile,maxSize:h.maxEachFileSizeByte,required:h.isRequired,error:T[h.id],value:y[h.id]||[],onChange:z=>{I(null),b(G=>{const Y={...G};return delete Y[h.id],Y}),p(G=>({...G,[h.id]:z}))}},h.id))})}),k&&e.jsxs("div",{style:{margin:"0 24px",padding:"10px 14px",borderRadius:"8px",backgroundColor:"color-mix(in srgb, var(--metakyc-danger, #ef4444) 8%, transparent)",border:"1px solid color-mix(in srgb, var(--metakyc-danger, #ef4444) 20%, transparent)",display:"flex",alignItems:"center",gap:"8px"},children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--metakyc-danger, #ef4444)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[e.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),e.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),e.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),e.jsx("p",{style:{fontSize:"13px",color:"var(--metakyc-danger, #ef4444)",margin:0},children:k})]}),e.jsx(fe,{children:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"},children:[e.jsx(Q,{type:"button",variant:"outline",onClick:re,children:w>0?"Previous":"Back"}),q?e.jsx(Q,{type:"button",isLoading:l,onClick:N,children:l?"Uploading...":"Continue"}):e.jsx(Q,{type:"button",onClick:X,children:"Next"})]})})]}):null},_r=({applicantId:t,onComplete:r,onBack:a})=>{const{overview:s,isLoading:n,isSubmitting:l,error:c,passOverview:d}=Er(t),y=async()=>{await d(),r==null||r()};return n?e.jsx(Z,{children:e.jsx(ee,{children:e.jsx(Ee,{className:"my-8"})})}):c?e.jsx(Z,{children:e.jsx(ee,{children:e.jsxs("p",{className:"text-danger-500",children:["Error loading overview: ",c.message]})})}):s?e.jsxs(Z,{children:[e.jsxs(he,{children:[e.jsx("h2",{className:"text-lg font-bold",children:s.title||"Overview"}),s.description&&e.jsx("p",{className:"mt-1",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:s.description})]}),e.jsx(ee,{className:"space-y-8",children:s.steps&&s.steps.length>0?s.steps.sort((p,k)=>p.order-k.order).map(p=>e.jsxs("div",{className:"metakyc-overview-step-item flex items-center space-x-3",children:[e.jsx("div",{className:"metakyc-step-icon flex-shrink-0",children:e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center font-medium text-sm",style:{backgroundColor:"var(--metakyc-primary, #2563eb)",color:"#ffffff"},children:p.order+1})}),e.jsxs("div",{className:"metakyc-step-content",style:{flex:1,border:"none",height:"auto",background:"transparent"},children:[e.jsx("span",{className:"metakyc-step-title text-sm font-semibold",style:{color:"var(--metakyc-text-primary, #111827)"},children:p.title}),p.description&&e.jsx("p",{className:"metakyc-step-description text-sm",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:p.description})]})]},p.order)):e.jsx("div",{className:"text-center py-8",children:e.jsx("p",{style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:"Loading overview data..."})})}),e.jsxs(fe,{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a&&e.jsx(Q,{type:"button",variant:"outline",onClick:a,children:"Back"}),e.jsx(Q,{onClick:y,isLoading:l,children:"Continue"})]})]}):null};function Na(t){const r=(t??"en").toLowerCase().replace("_","-");try{return Intl.NumberFormat.supportedLocalesOf([r]),r}catch{return"en"}}function Ra(t){return t.valueDataType===Me.Money&&Array.isArray(t.defaultValues)&&t.defaultValues.length>0}function Ia(t,r){const a=new Intl.NumberFormat(Na(r),{minimumFractionDigits:0,maximumFractionDigits:2});return t.replace(/([\d]+(?:\.\d+)?)/g,s=>{const n=parseFloat(s);return isNaN(n)?s:a.format(n)})}function Ea(t,r){const a=!r||r.length===0||r.every(s=>!s||!s.trim());if(t.isRequired&&a)return t.errorMessage||`${t.displayName} is required`;if(!a){const s=r[0]??"";if(s&&t.regex)try{if(!new RegExp(t.regex).test(s))return t.errorMessage||"Invalid format"}catch{}const n=t.valueDataType===Me.Integer||t.valueDataType===Me.Money||t.valueDataType===Me.DigitOnly;if(n&&s.trim()!==""){const l=Number(s);if(!isNaN(l)){if(t.min!==void 0&&t.min!==null&&l<t.min)return`Minimum value is ${t.min}`;if(t.max!==void 0&&t.max!==null&&l>t.max)return`Maximum value is ${t.max}`}}else if(!n&&s!==""){if(t.min!==void 0&&t.min!==null&&s.length<t.min)return`Minimum length is ${t.min} characters`;if(t.max!==void 0&&t.max!==null&&s.length>t.max)return`Maximum length is ${t.max} characters`}}return null}function Aa(t){const r=new Map;return t.forEach((a,s)=>{const n=a.pageNumber!=null&&a.pageNumber>0?a.pageNumber:1;r.has(n)||r.set(n,[]),r.get(n).push({criterion:a,idx:s})}),Array.from(r.entries()).sort(([a],[s])=>a-s).map(([,a])=>a)}function Ta(t){return t.builtInType===1?"country":!t.defaultValues||t.defaultValues.length===0?"text":t.multipleValue?"checkbox":"radio"}const Hr=({applicantId:t,onComplete:r,onBack:a})=>{const{config:s}=Re(),n=s.locale??"en",{criteria:l,initialAnswers:c,isLoading:d,isSubmitting:y,error:p,submit:k}=Tr(t),[I,w]=i.useState({}),[A,T]=i.useState({}),[b,S]=i.useState(0),[O,q]=i.useState(!1);i.useEffect(()=>{c&&Object.keys(c).length>0&&Object.keys(I).length===0&&w(c)},[c]);const F=i.useMemo(()=>l&&l.length>0?Aa(l):[],[l]),D=b===F.length-1,X=F[b]??[];i.useEffect(()=>{!d&&l&&l.length===0&&!O&&!y&&(q(!0),k({applicantId:t,criteriaValueInputs:[]}).then(()=>r==null?void 0:r()).catch(console.error))},[d,l,O,y,k,t,r]);const re=i.useCallback((Y,B)=>{w(V=>({...V,[Y]:B})),T(V=>{const ae={...V};return delete ae[Y],ae})},[]),N=i.useCallback(()=>{const Y={};for(const{criterion:B}of X){const V=Ea(B,I[B.id]??[]);V&&(Y[B.id]=V)}return T(B=>({...B,...Y})),Object.keys(Y).length===0},[X,I]),h=()=>{N()&&S(Y=>Y+1)},z=()=>{b>0?S(Y=>Y-1):a==null||a()},G=async()=>{if(!(!N()||!l))try{const Y=l.map(V=>{const ae=(I[V.id]??[]).filter(K=>K&&K.trim());return ae.length>0?{riskCriteriaId:V.id,values:ae}:null}).filter(V=>V!==null);await k({applicantId:t,criteriaValueInputs:Y}),r==null||r()}catch(Y){console.error("Risk scoring submit error:",Y)}};return d?e.jsx(Z,{children:e.jsxs(ee,{children:[e.jsx(Ee,{className:"my-8"}),e.jsx("p",{className:"text-center text-sm mt-4",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:"Loading risk scoring criteria…"})]})}):!d&&l&&l.length===0?e.jsx(Z,{children:e.jsxs(ee,{children:[e.jsx(Ee,{className:"my-8"}),e.jsx("p",{className:"text-center text-sm mt-4",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:"No criteria required. Moving to next step…"})]})}):p?e.jsx(Z,{children:e.jsx(ee,{children:e.jsxs("p",{className:"text-danger-500",children:["Error loading criteria: ",p.message]})})}):l?e.jsxs(Z,{children:[e.jsxs(he,{children:[e.jsx("h2",{className:"text-lg font-bold",children:"Risk Assessment"}),e.jsx("p",{className:"text-sm",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:"Please answer the following questions for risk evaluation"}),F.length>1&&e.jsxs("div",{className:"flex items-center justify-between mt-3",children:[e.jsxs("span",{className:"text-xs",style:{color:"var(--metakyc-text-muted, #9ca3af)"},children:["Page ",b+1," of ",F.length]}),e.jsx("div",{className:"flex items-center gap-1.5",children:F.map((Y,B)=>e.jsx("div",{className:"rounded-full transition-all duration-200",style:{height:"6px",width:B===b?"20px":"6px",backgroundColor:B<=b?"var(--metakyc-primary, #2563eb)":"var(--metakyc-border, #e5e7eb)"}},B))})]})]}),e.jsx(ee,{className:"space-y-6",children:X.map(({criterion:Y})=>e.jsx(Fa,{criterion:Y,value:I[Y.id]??[],error:A[Y.id],locale:n,onChange:B=>re(Y.id,B)},Y.id))}),e.jsxs(fe,{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs(Q,{type:"button",variant:"outline",onClick:z,style:{display:"flex",alignItems:"center",gap:"4px"},children:[e.jsx(zr,{size:14}),b>0?"Previous":"Back"]}),D?e.jsx(Q,{type:"button",isLoading:y,onClick:G,children:"Continue"}):e.jsxs(Q,{type:"button",onClick:h,style:{display:"flex",alignItems:"center",gap:"4px"},children:["Next",e.jsx(Or,{size:14})]})]}),p&&e.jsx("div",{className:"mx-6 mb-4 p-3 bg-red-50 border border-red-200 rounded",children:e.jsx("p",{className:"text-red-600 text-sm",children:p.message})})]}):null},Fa=({criterion:t,value:r,error:a,locale:s,onChange:n})=>{const l=Ta(t),c=t.valueDataType===Me.Integer||t.valueDataType===Me.Money||t.valueDataType===Me.DigitOnly,d=Ra(t),y=p=>d?Ia(p,s):p;return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{className:"block text-sm font-medium",style:{color:"var(--metakyc-text-primary, #111827)"},children:[t.displayName,t.isRequired&&e.jsx("span",{className:"text-danger-500 ml-1",children:"*"})]}),t.description&&e.jsx("p",{className:"text-xs",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:t.description}),c&&(t.min!==void 0||t.max!==void 0)&&e.jsx("p",{className:"text-xs",style:{color:"var(--metakyc-text-muted, #9ca3af)"},children:t.min!==void 0&&t.max!==void 0?`Range: ${t.min} – ${t.max}`:t.min!==void 0?`Minimum: ${t.min}`:`Maximum: ${t.max}`}),l==="text"&&e.jsx(ye,{value:r[0]??"",onChange:p=>n([p.target.value]),type:c?"number":"text",placeholder:"Enter your answer…",error:a,required:t.isRequired,min:t.min,max:t.max,onKeyDown:p=>{t.valueDataType===Me.DigitOnly&&["e","E","+","-","."].includes(p.key)&&p.preventDefault()}}),l==="radio"&&e.jsxs("div",{className:"metakyc-options-group",style:{display:"flex",flexDirection:"column",gap:"8px"},children:[(t.defaultValues??[]).map(p=>e.jsxs("label",{className:"metakyc-option-label",style:{display:"flex",alignItems:"center",gap:"10px",cursor:"pointer",margin:0,padding:0},children:[e.jsx("input",{type:"radio",checked:r[0]===p,onChange:()=>n([p]),className:"metakyc-option-input",style:{width:"16px",height:"16px",minWidth:"16px",flexShrink:0,flexGrow:0,accentColor:"var(--metakyc-primary, #2563eb)",cursor:"pointer",margin:0,padding:0,display:"inline-block",verticalAlign:"middle"}}),e.jsx("span",{className:"metakyc-option-text",style:{fontSize:"14px",color:"var(--metakyc-text-primary, #111827)",lineHeight:"1.4",marginLeft:0},children:y(p)})]},p)),a&&e.jsx("p",{className:"text-sm text-danger-500",children:a})]}),l==="checkbox"&&e.jsxs("div",{className:"metakyc-options-group",style:{display:"flex",flexDirection:"column",gap:"8px"},children:[(t.defaultValues??[]).map(p=>e.jsxs("label",{className:"metakyc-option-label",style:{display:"flex",alignItems:"center",gap:"10px",cursor:"pointer",margin:0,padding:0},children:[e.jsx(Fe,{checked:r.includes(p),onChange:k=>{n(k?[...r,p]:r.filter(I=>I!==p))}}),e.jsx("span",{className:"metakyc-option-text",style:{fontSize:"14px",color:"var(--metakyc-text-primary, #111827)",lineHeight:"1.4",marginLeft:0},children:y(p)})]},p)),a&&e.jsx("p",{className:"text-sm text-danger-500",children:a})]}),l==="country"&&e.jsx(ut,{value:r[0]??"",onChange:p=>n([p.target.value]),options:[{value:"US",label:"United States"},{value:"GB",label:"United Kingdom"},{value:"DE",label:"Germany"},{value:"FR",label:"France"},{value:"AE",label:"United Arab Emirates"}],placeholder:"Select a country…",error:a,required:t.isRequired})]})},Wr=({applicantId:t,onComplete:r,onBack:a})=>{const{investorCategorizationService:s}=Re(),[n,l]=i.useState(null),[c,d]=i.useState(!1),[y,p]=i.useState(null),k=async I=>{if(I.preventDefault(),n===null){p("Please select an investor type");return}d(!0),p(null);try{const w={applicantId:t,investorType:n};console.log("Submitting investor categorization:",w);const A=await s.setInvestorCategorization(w);console.log("Investor categorization result:",A),r==null||r()}catch(w){console.error("Error submitting investor categorization:",w),p(w.message||"Failed to submit investor categorization")}finally{d(!1)}};return e.jsx("form",{onSubmit:k,children:e.jsxs(Z,{children:[e.jsxs(he,{children:[e.jsx("h2",{className:"text-lg font-bold",style:{color:"var(--metakyc-text-primary, #111827)"},children:"Which statement best describes you?"}),e.jsx("p",{className:"mt-2",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:"All Tokenise clients are treated as Retail Investors under EU regulation, which gives you the highest level of investor protection. For our internal purposes, we ask you to select the description that best matches your situation"})]}),e.jsxs(ee,{className:"space-y-4",children:[e.jsx("p",{className:"text-sm font-medium mb-3",style:{color:"var(--metakyc-text-secondary, #374151)"},children:"Choose one"}),e.jsx("label",{className:"block p-4 border-2 rounded-lg cursor-pointer transition-all",style:{borderColor:n===we.Individual?"var(--metakyc-primary, #2563eb)":"var(--metakyc-border, #e5e7eb)",backgroundColor:n===we.Individual?"var(--metakyc-primary-light, #dbeafe)":"transparent"},children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("input",{type:"radio",name:"investorType",value:we.Individual,checked:n===we.Individual,onChange:()=>l(we.Individual),className:"mt-1"}),e.jsxs("div",{className:"ml-3",children:[e.jsx("div",{className:"text-base font-semibold",style:{color:"var(--metakyc-text-primary, #111827)"},children:"Individual investor"}),e.jsx("div",{className:"text-sm mt-1",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:"(Recommended) Most of our clients choose this option. Provides the strongest protection and aligns with our mission to make investing accessible to everyone."})]})]})}),e.jsx("label",{className:"block p-4 border-2 rounded-lg cursor-pointer transition-all",style:{borderColor:n===we.Sophisticated?"var(--metakyc-primary, #2563eb)":"var(--metakyc-border, #e5e7eb)",backgroundColor:n===we.Sophisticated?"var(--metakyc-primary-light, #dbeafe)":"transparent"},children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("input",{type:"radio",name:"investorType",value:we.Sophisticated,checked:n===we.Sophisticated,onChange:()=>l(we.Sophisticated),className:"mt-1"}),e.jsxs("div",{className:"ml-3",children:[e.jsx("div",{className:"text-base font-semibold",style:{color:"var(--metakyc-text-primary, #111827)"},children:"Sophisticated investor"}),e.jsx("div",{className:"text-sm mt-1",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:"In the last 2 years, I have done one or more of the following:"}),e.jsxs("ul",{className:"text-sm mt-2 space-y-1 list-none",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:[e.jsx("li",{children:"Worked in private equity or provided capital to small and medium enterprises, and/or"}),e.jsx("li",{children:"Been the director of a company with an annual turnover of at least (USD) $2m million, and/or"}),e.jsx("li",{children:"Invested directly in at least 2 private (not listed) companies."})]})]})]})}),e.jsx("label",{className:"block p-4 border-2 rounded-lg cursor-pointer transition-all",style:{borderColor:n===we.HighNetWorth?"var(--metakyc-primary, #2563eb)":"var(--metakyc-border, #e5e7eb)",backgroundColor:n===we.HighNetWorth?"var(--metakyc-primary-light, #dbeafe)":"transparent"},children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("input",{type:"radio",name:"investorType",value:we.HighNetWorth,checked:n===we.HighNetWorth,onChange:()=>l(we.HighNetWorth),className:"mt-1"}),e.jsxs("div",{className:"ml-3",children:[e.jsx("div",{className:"text-base font-semibold",style:{color:"var(--metakyc-text-primary, #111827)"},children:"High networth investor"}),e.jsxs("div",{className:"text-sm mt-1",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:["I earn more than (USD/EUR) $150,000 per year, and/or",e.jsx("br",{}),"I have net assets (excluding my main property) of at least $/EUR 300,000"]})]})]})}),y&&e.jsx("div",{className:"p-4 rounded-lg",style:{backgroundColor:"#fee2e2",border:"1px solid #fca5a5"},children:e.jsxs("p",{className:"text-sm",style:{color:"#991b1b"},children:[e.jsx("strong",{children:"Error:"})," ",y]})})]}),e.jsxs(fe,{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a&&e.jsx(Q,{type:"button",variant:"outline",onClick:a,children:"Back"}),e.jsx(Q,{type:"submit",isLoading:c,disabled:n===null,children:"Submit"})]})]})})};function At(t){const r=t.split(":").map(Number);return r.length===3?r[0]*3600+r[1]*60+r[2]:0}function xt(t){const r=Math.floor(t/60),a=t%60;return`${r.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}`}const Ur=({applicantId:t,onComplete:r,onBack:a})=>{const{appropriatenessTestService:s}=Re(),[n,l]=i.useState(null),[c,d]=i.useState(!0),[y,p]=i.useState(!1),[k,I]=i.useState(null),[w,A]=i.useState({}),[T,b]=i.useState(0),[S,O]=i.useState(!1),[q,F]=i.useState(!1),[D,X]=i.useState(0),[re,N]=i.useState(0),[h,z]=i.useState(null);i.useEffect(()=>{(async()=>{try{d(!0),I(null);const $=await s.getAppropriatenessTest(t);if(l($),$.waitTimeSpanForNextTry&&$.waitTimeSpanForNextTry!=="00:00:00"){const _=At($.waitTimeSpanForNextTry);_>0&&X(_)}}catch($){I($.message||"Failed to load appropriateness test")}finally{d(!1)}})()},[t,s]),i.useEffect(()=>{if(!S||T<=0)return;const $=setInterval(()=>{b(_=>_<=1?(F(!0),0):_-1)},1e3);return()=>clearInterval($)},[S,T]),i.useEffect(()=>{if(D<=0)return;const $=setInterval(()=>{X(_=>_<=1?0:_-1)},1e3);return()=>clearInterval($)},[D]),i.useEffect(()=>{q&&!y&&V()},[q]);const G=()=>{n&&(O(!0),b(n.testDurationSec),N(0),A({}),I(null))},Y=($,_)=>{A(ue=>({...ue,[$]:_}))},B=i.useCallback(async()=>{try{const $=await s.getAppropriatenessTest(t);if(l($),$.waitTimeSpanForNextTry&&$.waitTimeSpanForNextTry!=="00:00:00"){const _=At($.waitTimeSpanForNextTry);_>0&&X(_)}}catch{}},[t,s]),V=async $=>{if(n){if(!q){const _=n.appropriatenessQuestions.length-Object.keys(w).length;if(_>0){I(`Please answer all questions. ${_} remaining.`);return}}p(!0),I(null);try{const _=n.appropriatenessQuestions.map(R=>({appropriatenessQuestionId:R.id,value:w[R.id]||""})),ue={applicantId:t,appropriatenessTestId:n.id,appropriatenessQuestionResults:_};try{const R=await s.fillAppropriatenessTest(ue);R.isSuccess?z({success:!0,message:R.message||"Congratulations! You have passed the test."}):(z({success:!1,message:R.message||"You did not pass the test."}),setTimeout(()=>B(),1e3))}catch(R){if(R.code===400&&R.message)z({success:!1,message:R.message}),setTimeout(()=>B(),1500);else throw R}}catch(_){I(_.message||"Failed to submit test. Please try again."),ae()}finally{p(!1)}}},ae=()=>{O(!1),F(!1),A({}),N(0)};if(c)return e.jsx(Z,{children:e.jsx(ee,{children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"48px 0",gap:"16px"},children:[e.jsx(Ee,{className:"my-8"}),e.jsx("p",{style:{fontSize:"14px",color:"var(--metakyc-text-muted, #9ca3af)"},children:"Loading test..."})]})})});if(!n)return e.jsx(Z,{children:e.jsx(ee,{children:e.jsxs("div",{style:{textAlign:"center",padding:"48px 0"},children:[e.jsx("p",{style:{fontSize:"16px",fontWeight:600,color:"var(--metakyc-danger, #ef4444)"},children:"No test data available"}),k&&e.jsx("p",{style:{fontSize:"14px",color:"var(--metakyc-text-muted, #9ca3af)",marginTop:"8px"},children:k})]})})});const K=n.testAllowedMaxTry-n.totalFailedTries,ke=n.appropriatenessQuestions.length,ce=Object.keys(w).length;if(D>0)return e.jsxs(Z,{children:[e.jsx(he,{children:e.jsx("h2",{style:{fontSize:"18px",fontWeight:700,color:"var(--metakyc-text-primary, #111827)",margin:0},children:n.displayName})}),e.jsx(ee,{children:e.jsxs("div",{style:{textAlign:"center",padding:"32px 0"},children:[e.jsx("div",{style:{width:"100px",height:"100px",borderRadius:"50%",margin:"0 auto 20px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"color-mix(in srgb, var(--metakyc-primary, #2563eb) 8%, transparent)"},children:e.jsx("span",{style:{fontSize:"28px",fontWeight:700,color:"var(--metakyc-primary, #2563eb)",fontVariantNumeric:"tabular-nums"},children:xt(D)})}),e.jsx("p",{style:{fontSize:"15px",fontWeight:500,color:"var(--metakyc-text-primary, #111827)"},children:"Please wait before retrying"}),e.jsx("p",{style:{fontSize:"13px",color:"var(--metakyc-text-muted, #9ca3af)",marginTop:"4px"},children:"You can attempt the test again once the timer expires"}),k&&e.jsx("div",{style:{marginTop:"20px",padding:"12px 16px",borderRadius:"10px",backgroundColor:"color-mix(in srgb, var(--metakyc-danger, #ef4444) 8%, transparent)",border:"1px solid color-mix(in srgb, var(--metakyc-danger, #ef4444) 20%, transparent)"},children:e.jsx("p",{style:{fontSize:"13px",color:"var(--metakyc-danger, #ef4444)",margin:0},children:k})})]})})]});if(h){const $=()=>{z(null),ae(),I(null)};return e.jsxs(Z,{children:[e.jsx(ee,{children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",textAlign:"center",padding:"40px 16px",gap:"16px"},children:[e.jsx("div",{style:{width:"72px",height:"72px",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:h.success?"color-mix(in srgb, var(--metakyc-success, #10b981) 12%, transparent)":"color-mix(in srgb, var(--metakyc-danger, #ef4444) 10%, transparent)"},children:h.success?e.jsxs("svg",{width:"36",height:"36",viewBox:"0 0 24 24",fill:"none",stroke:"var(--metakyc-success, #10b981)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),e.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}):e.jsxs("svg",{width:"36",height:"36",viewBox:"0 0 24 24",fill:"none",stroke:"var(--metakyc-danger, #ef4444)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),e.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]})}),e.jsx("h2",{style:{fontSize:"20px",fontWeight:700,color:h.success?"var(--metakyc-success, #10b981)":"var(--metakyc-danger, #ef4444)",margin:0},children:h.success?"Test Passed":"Test Failed"}),e.jsx("p",{style:{fontSize:"14px",color:"var(--metakyc-text-secondary, #6b7280)",margin:0,lineHeight:1.6,maxWidth:"400px",whiteSpace:"pre-line"},children:h.message}),!h.success&&K>0&&e.jsx("div",{style:{marginTop:"4px",padding:"10px 20px",borderRadius:"10px",backgroundColor:"var(--metakyc-surface, #f9fafb)",border:"1px solid var(--metakyc-border, #e5e7eb)"},children:e.jsxs("p",{style:{fontSize:"13px",color:"var(--metakyc-text-muted, #9ca3af)",margin:0},children:["You have ",e.jsx("strong",{style:{color:"var(--metakyc-text-primary, #111827)"},children:K})," attempt",K!==1?"s":""," remaining"]})}),!h.success&&K<=0&&e.jsx("div",{style:{marginTop:"4px",padding:"10px 20px",borderRadius:"10px",backgroundColor:"color-mix(in srgb, var(--metakyc-danger, #ef4444) 8%, transparent)",border:"1px solid color-mix(in srgb, var(--metakyc-danger, #ef4444) 20%, transparent)"},children:e.jsx("p",{style:{fontSize:"13px",color:"var(--metakyc-danger, #ef4444)",margin:0},children:"No attempts remaining. Please contact support for assistance."})})]})}),e.jsx(fe,{children:e.jsx("div",{style:{display:"flex",justifyContent:"center",width:"100%",gap:"12px"},children:h.success?e.jsx(Q,{type:"button",onClick:()=>r==null?void 0:r(),children:"Continue"}):e.jsxs(e.Fragment,{children:[K>0&&D<=0&&e.jsx(Q,{type:"button",onClick:$,children:"Retake Test"}),K>0&&D>0&&e.jsx(Q,{type:"button",onClick:$,children:"OK"}),K<=0&&a&&e.jsx(Q,{type:"button",variant:"outline",onClick:a,children:"Back"})]})})})]})}if(!S)return e.jsxs(Z,{children:[e.jsxs(he,{children:[e.jsx("h2",{style:{fontSize:"18px",fontWeight:700,color:"var(--metakyc-text-primary, #111827)",margin:0},children:n.displayName}),n.subtitle&&e.jsx("p",{style:{fontSize:"14px",color:"var(--metakyc-text-secondary, #6b7280)",marginTop:"4px"},children:n.subtitle})]}),e.jsxs(ee,{children:[n.description&&e.jsxs("div",{style:{marginBottom:"20px",padding:"12px 14px",borderRadius:"10px",backgroundColor:"color-mix(in srgb, var(--metakyc-primary, #2563eb) 5%, var(--metakyc-background, #ffffff))",border:"1px solid color-mix(in srgb, var(--metakyc-primary, #2563eb) 15%, transparent)",display:"flex",gap:"10px"},children:[e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"var(--metakyc-primary, #2563eb)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0,marginTop:"1px"},children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),e.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]}),e.jsx("p",{style:{fontSize:"13px",color:"var(--metakyc-text-secondary, #374151)",margin:0,lineHeight:1.5},children:n.description})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px",marginBottom:"20px"},children:[e.jsx(ct,{icon:"questions",label:"Questions",value:String(n.totalQuestionCount)}),e.jsx(ct,{icon:"time",label:"Time Limit",value:xt(n.testDurationSec)}),e.jsx(ct,{icon:"target",label:"Pass Requirement",value:`${n.testCorrectAnswerPassLimit} correct`}),e.jsx(ct,{icon:"retry",label:"Attempts Left",value:String(K),variant:K<=1?"warning":"default"})]}),k&&e.jsxs("div",{style:{marginBottom:"16px",padding:"12px 14px",borderRadius:"10px",backgroundColor:"color-mix(in srgb, var(--metakyc-danger, #ef4444) 8%, transparent)",border:"1px solid color-mix(in srgb, var(--metakyc-danger, #ef4444) 20%, transparent)",display:"flex",gap:"10px"},children:[e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"var(--metakyc-danger, #ef4444)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0,marginTop:"1px"},children:[e.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),e.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),e.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),e.jsxs("p",{style:{fontSize:"13px",color:"var(--metakyc-danger, #ef4444)",margin:0,lineHeight:1.5},children:[e.jsx("strong",{children:"Previous attempt:"})," ",k]})]}),K<=0&&e.jsx("div",{style:{padding:"12px 14px",borderRadius:"10px",backgroundColor:"color-mix(in srgb, var(--metakyc-danger, #ef4444) 8%, transparent)",border:"1px solid color-mix(in srgb, var(--metakyc-danger, #ef4444) 20%, transparent)"},children:e.jsx("p",{style:{fontSize:"13px",color:"var(--metakyc-danger, #ef4444)",margin:0},children:"You have used all your attempts. Please contact support for assistance."})})]}),e.jsx(fe,{children:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:a?"space-between":"flex-end",width:"100%"},children:[a&&e.jsx(Q,{type:"button",variant:"outline",onClick:a,children:"Back"}),e.jsx(Q,{type:"button",onClick:G,disabled:K<=0,children:"Start Test"})]})})]});const de=n.appropriatenessQuestions[re],ge=re===ke-1,E=ce===ke,W=T<=60;return e.jsxs(Z,{children:[e.jsxs(he,{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs("div",{children:[e.jsx("h2",{style:{fontSize:"18px",fontWeight:700,color:"var(--metakyc-text-primary, #111827)",margin:0},children:n.displayName}),e.jsxs("p",{style:{fontSize:"12px",color:"var(--metakyc-text-muted, #9ca3af)",marginTop:"2px"},children:["Question ",re+1," of ",ke]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"6px 14px",borderRadius:"999px",backgroundColor:W?"color-mix(in srgb, var(--metakyc-danger, #ef4444) 10%, transparent)":"var(--metakyc-surface, #f3f4f6)",transition:"all 0.3s ease"},children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:W?"var(--metakyc-danger, #ef4444)":"var(--metakyc-text-muted, #9ca3af)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("polyline",{points:"12 6 12 12 16 14"})]}),e.jsx("span",{style:{fontSize:"16px",fontWeight:700,fontVariantNumeric:"tabular-nums",color:W?"var(--metakyc-danger, #ef4444)":"var(--metakyc-text-primary, #111827)",transition:"color 0.3s ease"},children:xt(T)})]})]}),e.jsxs("div",{style:{marginTop:"12px"},children:[e.jsx("div",{style:{height:"4px",borderRadius:"999px",backgroundColor:"var(--metakyc-border, #e5e7eb)",overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",borderRadius:"999px",backgroundColor:"var(--metakyc-primary, #2563eb)",width:`${ce/ke*100}%`,transition:"width 0.3s ease"}})}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginTop:"4px"},children:[e.jsxs("span",{style:{fontSize:"11px",color:"var(--metakyc-text-muted, #9ca3af)"},children:[ce," answered"]}),e.jsxs("span",{style:{fontSize:"11px",color:"var(--metakyc-text-muted, #9ca3af)"},children:[K," attempt",K!==1?"s":""," left"]})]})]})]}),e.jsxs(ee,{children:[de&&e.jsx(La,{question:de,index:re,selectedAnswer:w[de.id],onSelect:$=>Y(de.id,$),disabled:y}),ke>1&&e.jsx("div",{style:{display:"flex",justifyContent:"center",gap:"6px",marginTop:"20px",flexWrap:"wrap"},children:n.appropriatenessQuestions.map(($,_)=>e.jsx("button",{type:"button",onClick:()=>N(_),style:{width:"28px",height:"28px",borderRadius:"8px",border:_===re?"2px solid var(--metakyc-primary, #2563eb)":"1px solid var(--metakyc-border, #e5e7eb)",backgroundColor:w[$.id]?_===re?"color-mix(in srgb, var(--metakyc-primary, #2563eb) 15%, transparent)":"color-mix(in srgb, var(--metakyc-primary, #2563eb) 8%, transparent)":_===re?"var(--metakyc-surface, #f9fafb)":"var(--metakyc-background, #ffffff)",color:w[$.id]?"var(--metakyc-primary, #2563eb)":"var(--metakyc-text-muted, #9ca3af)",fontSize:"12px",fontWeight:600,cursor:"pointer",transition:"all 0.15s ease",padding:0,display:"flex",alignItems:"center",justifyContent:"center"},children:_+1},$.id))}),q&&e.jsxs("div",{style:{marginTop:"16px",padding:"12px 14px",borderRadius:"10px",backgroundColor:"color-mix(in srgb, #f59e0b 10%, transparent)",border:"1px solid color-mix(in srgb, #f59e0b 25%, transparent)",display:"flex",alignItems:"center",gap:"10px"},children:[e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"#f59e0b",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("polyline",{points:"12 6 12 12 16 14"})]}),e.jsx("p",{style:{fontSize:"13px",color:"#b45309",margin:0,fontWeight:500},children:"Time's up! Your answers are being submitted."})]}),k&&!q&&e.jsx("div",{style:{marginTop:"16px",padding:"12px 14px",borderRadius:"10px",backgroundColor:"color-mix(in srgb, var(--metakyc-danger, #ef4444) 8%, transparent)",border:"1px solid color-mix(in srgb, var(--metakyc-danger, #ef4444) 20%, transparent)"},children:e.jsx("p",{style:{fontSize:"13px",color:"var(--metakyc-danger, #ef4444)",margin:0},children:k})})]}),e.jsx(fe,{children:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"},children:[e.jsx(Q,{type:"button",variant:"outline",onClick:()=>{re>0?N($=>$-1):a==null||a()},disabled:y,children:re>0?"Previous":"Cancel"}),e.jsxs("div",{style:{display:"flex",gap:"8px"},children:[!ge&&e.jsx(Q,{type:"button",onClick:()=>N($=>$+1),children:"Next"}),(ge||E)&&e.jsx(Q,{type:"button",isLoading:y,onClick:()=>V(),disabled:!E&&!q,style:{opacity:E||q?1:.5},children:q?"Submitting...":"Submit Test"})]})]})})]})},Pa={questions:e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M9 11l3 3L22 4"}),e.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]}),time:e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("polyline",{points:"12 6 12 12 16 14"})]}),target:e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("circle",{cx:"12",cy:"12",r:"6"}),e.jsx("circle",{cx:"12",cy:"12",r:"2"})]}),retry:e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"23 4 23 10 17 10"}),e.jsx("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"})]})},ct=({icon:t,label:r,value:a,variant:s="default"})=>{const n=s==="warning";return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",padding:"14px",borderRadius:"10px",backgroundColor:n?"color-mix(in srgb, #f59e0b 8%, transparent)":"var(--metakyc-surface, #f9fafb)",border:n?"1px solid color-mix(in srgb, #f59e0b 20%, transparent)":"1px solid var(--metakyc-border, #e5e7eb)"},children:[e.jsx("div",{style:{color:n?"#f59e0b":"var(--metakyc-primary, #2563eb)",flexShrink:0},children:Pa[t]}),e.jsxs("div",{children:[e.jsx("p",{style:{fontSize:"12px",color:"var(--metakyc-text-muted, #9ca3af)",margin:0},children:r}),e.jsx("p",{style:{fontSize:"15px",fontWeight:600,color:n?"#b45309":"var(--metakyc-text-primary, #111827)",margin:0,marginTop:"1px"},children:a})]})]})},La=({question:t,selectedAnswer:r,onSelect:a,disabled:s})=>e.jsxs("div",{children:[e.jsxs("div",{style:{marginBottom:"16px"},children:[t.groupName&&e.jsx("span",{style:{display:"inline-block",fontSize:"11px",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:"var(--metakyc-primary, #2563eb)",marginBottom:"8px"},children:t.groupName}),e.jsx("h3",{style:{fontSize:"16px",fontWeight:600,color:"var(--metakyc-text-primary, #111827)",margin:0,lineHeight:1.5},children:t.question})]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:t.answers.map((n,l)=>{const c=r===n;return e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"12px",padding:"14px 16px",borderRadius:"10px",border:`2px solid ${c?"var(--metakyc-primary, #2563eb)":"var(--metakyc-border, #e5e7eb)"}`,backgroundColor:c?"color-mix(in srgb, var(--metakyc-primary, #2563eb) 5%, var(--metakyc-background, #ffffff))":"var(--metakyc-background, #ffffff)",cursor:s?"default":"pointer",transition:"all 0.15s ease",opacity:s?.6:1},onMouseEnter:d=>{!s&&!c&&(d.currentTarget.style.borderColor="color-mix(in srgb, var(--metakyc-primary, #2563eb) 50%, var(--metakyc-border, #e5e7eb))")},onMouseLeave:d=>{c||(d.currentTarget.style.borderColor="var(--metakyc-border, #e5e7eb)")},children:[e.jsx("div",{style:{width:"20px",height:"20px",borderRadius:"50%",border:`2px solid ${c?"var(--metakyc-primary, #2563eb)":"var(--metakyc-border, #d1d5db)"}`,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"border-color 0.15s ease"},children:c&&e.jsx("div",{style:{width:"10px",height:"10px",borderRadius:"50%",backgroundColor:"var(--metakyc-primary, #2563eb)"}})}),e.jsx("input",{type:"radio",name:`q-${t.id}`,value:n,checked:c,onChange:()=>a(n),disabled:s,style:{position:"absolute",opacity:0,width:0,height:0}}),e.jsx("span",{style:{fontSize:"14px",color:c?"var(--metakyc-text-primary, #111827)":"var(--metakyc-text-secondary, #6b7280)",fontWeight:c?500:400,transition:"color 0.15s ease"},children:n})]},l)})})]}),Kr=({applicantId:t,onComplete:r,onBack:a})=>{var Je,$e,tt,Ke;const{applicantService:s,baseInformationService:n,identityService:l,config:c,currentTheme:d}=Re(),{identityData:y,provider:p,token:k,isLoading:I,error:w,requestIdentity:A,restartIdentity:T}=Ar(t),[b,S]=i.useState(null),[O,q]=i.useState(null),[F,D]=i.useState([]),[X,re]=i.useState([]),[N,h]=i.useState(!0),[z,G]=i.useState(!1),[Y,B]=i.useState(null),[V,ae]=i.useState(!1),K=i.useRef(!1),[ke,ce]=i.useState({}),[de,ge]=i.useState({}),E=d!=null&&d.reviewPageFields&&d.reviewPageFields.length>0?d.reviewPageFields[0]:null,W=!!(d!=null&&d.reviewPageDisabled),$=i.useRef(!1);$.current=W;const _=Ye.useForm({defaultValues:{street:"",streetNumber:"",city:"",zip:"",country:"",nationality:"",phonenumber:""}});i.useEffect(()=>{if(W){K.current||(K.current=!0,A().then(()=>G(!0)).catch(M=>console.error("[Identity] Auto-request failed:",M)).finally(()=>h(!1)));return}(async()=>{try{const[M,U,H]=await Promise.all([s.getApplicantData(t),n.getCountries("","en"),n.getCountries("","en",40)]);q(M);const J=new Set,u=U.map(g=>({value:g.abbreviation3||g.abbreviation,label:g.name})).filter(g=>!g.value||J.has(g.value)?!1:(J.add(g.value),!0));D(u);const C=new Set,P=H.filter(g=>g.countryCode).map(g=>({value:g.countryCode,label:`${g.countryCode} – ${g.name}`})).filter(g=>C.has(g.value)?!1:(C.add(g.value),!0));re(P);const m=M.applicantRequestData;if(ce({firstName:(m==null?void 0:m.firstName)||"",lastName:(m==null?void 0:m.lastName)||"",email:(m==null?void 0:m.email)||"",dateOfBirth:(m==null?void 0:m.dateOfBirth)||"",title:(m==null?void 0:m.title)||"",salutation:(m==null?void 0:m.salutation)||"",phonenumber:(m==null?void 0:m.phonenumber)||"",mobileCountryCode:(m==null?void 0:m.mobileCountryCode)||"",street:(m==null?void 0:m.street)||"",streetNumber:(m==null?void 0:m.streetNumber)||"",city:(m==null?void 0:m.city)||"",zip:(m==null?void 0:m.zip)||"",country:(m==null?void 0:m.country)||"",nationality:(m==null?void 0:m.nationality)||"",taxCountry:(m==null?void 0:m.taxCountry)||"",countryOfBirth:(m==null?void 0:m.countryOfBirth)||"",placeOfBirth:(m==null?void 0:m.placeOfBirth)||"",educationLevel:(m==null?void 0:m.educationLevel)||"",occupation:(m==null?void 0:m.occupation)||"",taxNumber:(m==null?void 0:m.taxNumber)||"",defaultLanguage:(m==null?void 0:m.defaultLanguage)||""}),_.reset({street:(m==null?void 0:m.street)||"",streetNumber:(m==null?void 0:m.streetNumber)||"",city:(m==null?void 0:m.city)||"",zip:(m==null?void 0:m.zip)||"",country:(m==null?void 0:m.country)||"",nationality:(m==null?void 0:m.nationality)||"",phonenumber:(m==null?void 0:m.phonenumber)||""}),M.kycRecords&&M.kycRecords.length>0&&M.kycRecords[0].providerTokenObject!==null&&!K.current&&$.current){console.log("[Identity] Review page disabled + existing identity — auto-requesting..."),K.current=!0;try{await A(),G(!0)}catch(g){console.error("[Identity] Auto-request failed:",g)}}}catch(M){console.error("Error loading applicant data:",M)}finally{h(!1)}})()},[t]),i.useEffect(()=>{y&&!z&&$.current&&(console.log("[Identity] Review page disabled — showing cached provider"),G(!0))},[y,z]),i.useEffect(()=>{if(k){if(k.expiresAt){const x=new Date(k.expiresAt).getTime();if(Date.now()>=x){console.warn("[Identity] Token has expired (expiresAt)"),ae(!0),B("Your verification session has expired. Please restart.");return}}if(k.url)try{const M=new URL(k.url).toString().toLowerCase();if(M.includes("expired")||M.includes("invalid")||M.includes("error")){console.warn("[Identity] Token URL indicates expiration"),ae(!0),B("Your verification link has expired. Please restart.");return}}catch{console.error("[Identity] Invalid token URL")}if(k.status==="expired"||k.error==="expired"||k.expired===!0){console.warn("[Identity] Token object indicates expiration"),ae(!0),B("Your verification session has expired. Please restart.");return}}},[k]);const ue=p!==null&&p===Ae.Sumsub;i.useEffect(()=>{if(p!==null&&k&&!b&&z&&!V){const x=p;if(ue){console.log("[Sumsub] Fetching access token for Web SDK…"),B(null),(async()=>{try{const M=await l.refreshSumsubToken(t),U=He.parseProviderConfig(p,k,c);U.accessToken=M,U.onTokenRefresh=()=>l.refreshSumsubToken(t);const H=He.createProvider(p,U);H.onComplete(J=>{console.log("[Sumsub] Verification complete:",J),r==null||r()}),H.onError(J=>{console.error("[Sumsub] SDK error:",J),(typeof J=="string"?J:(J==null?void 0:J.message)||"Unknown error").toLowerCase().includes("expired")&&(ae(!0),B("Session expired. Please restart."))}),await H.initialize("sumsub-websdk-container"),console.log("[Sumsub] Web SDK launched"),S(H)}catch(M){console.error("[Sumsub] Initialization error:",M),B(`Failed to initialize: ${M.message||M}`),String(M.message||M).toLowerCase().includes("expired")&&ae(!0)}})();return}if(k.url){console.log("[Identity] Loading provider URL for user verification:",k.url),B(null);try{if(new URL(k.url),x===Ae.SardinAI){console.log("[SardinAI] Initializing Risk SDK in background...");try{const M=He.parseProviderConfig(p,k,c);He.createProvider(p,M).initialize().then(()=>console.log("[SardinAI] Risk SDK initialized in background")).catch(H=>console.warn("[SardinAI] Risk SDK init failed (non-blocking):",H))}catch(M){console.warn("[SardinAI] Risk SDK setup failed (non-blocking):",M)}}S({type:"url",url:k.url})}catch(M){console.error("[Identity] Invalid URL:",M),B("Invalid verification URL. Please restart."),ae(!0)}return}if(x===Ae.SardinAI){console.log("[SardinAI] No URL provided - initializing Risk SDK only..."),B(null);try{const M=He.parseProviderConfig(p,k,c),U=He.createProvider(p,M);U.initialize().then(()=>{console.log("[SardinAI] Risk SDK initialized successfully"),S(U),setTimeout(()=>r==null?void 0:r(),2e3)}).catch(H=>{var u;console.error("[SardinAI] Failed to initialize:",H);const J=((u=H.message)==null?void 0:u.toLowerCase())||"";J.includes("expired")||J.includes("invalid")||J.includes("401")||J.includes("400")?(ae(!0),B("Session expired or invalid. Please restart verification.")):B(`Failed to initialize: ${H.message}`)})}catch(M){console.error("[SardinAI] Error creating provider:",M),B(`Configuration error: ${M.message}`)}return}try{B(null);const M=He.parseProviderConfig(p,k,c),U=He.createProvider(p,M);x===Ae.Onfido&&U.initialize("identity-container").catch(H=>{console.error("[Onfido] Initialization error:",H),B(`Failed to initialize: ${H.message}`)}),S(U)}catch(M){console.error("[Identity] Provider setup error:",M),B(`Setup error: ${M.message}`)}}return()=>{if(b&&b.destroy)try{b.destroy()}catch(x){console.error("[Identity] Error destroying provider:",x)}}},[p,k,b,z,r,V,ue,t,c,l]);const R=async()=>{try{B(null),ae(!1),await A(),G(!0)}catch(x){console.error("Error starting identity verification:",x)}},te=async()=>{try{B(null),ae(!1),S(null),console.log("[Identity] Restarting verification..."),await T(),G(!0)}catch(x){console.error("Error restarting identity verification:",x),B(x.message||"Failed to restart verification")}};if(N||I)return e.jsx(Z,{children:e.jsxs(ee,{children:[e.jsx(Ee,{className:"my-8"}),e.jsx("p",{className:"text-center text-gray-600 dark:text-gray-400 mt-4",children:"Loading identity verification..."})]})});if(w)return e.jsx(Z,{children:e.jsx(ee,{children:e.jsxs("p",{className:"text-danger-500",children:["Error: ",w.message]})})});if(z&&(Y||V))return e.jsxs(Z,{children:[e.jsx(he,{children:e.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:"Verification Session Issue"})}),e.jsxs(ee,{children:[e.jsx("div",{className:"p-4 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg mb-6",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("svg",{className:"h-6 w-6 text-red-600 dark:text-red-400 mr-3 mt-0.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-red-900 dark:text-red-100 mb-1",children:V?"Session Expired":"Verification Error"}),e.jsx("p",{className:"text-red-800 dark:text-red-200 text-sm",children:Y||"Your verification session has expired and needs to be restarted."})]})]})}),e.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:[e.jsx("h3",{className:"font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"What to do next:"}),e.jsxs("ul",{className:"text-blue-800 dark:text-blue-200 text-sm space-y-1 list-disc list-inside",children:[e.jsx("li",{children:'Click "Restart Verification" below to generate a new session'}),e.jsx("li",{children:"Complete the verification process without delays"}),e.jsx("li",{children:"If issues persist, contact support"})]})]})]}),e.jsxs(fe,{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a&&e.jsx(Q,{type:"button",variant:"outline",onClick:a,children:"Back"}),e.jsx(Q,{type:"button",onClick:te,disabled:I,children:I?"Restarting...":"Restart Verification"})]})]});if(z&&y){const x=p;return ue?e.jsxs("div",{style:{background:"var(--metakyc-background, #ffffff)",borderRadius:"12px",border:"1px solid var(--metakyc-border, #e5e7eb)",overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"20px 24px",borderBottom:"1px solid var(--metakyc-border, #e5e7eb)"},children:[e.jsxs("div",{children:[e.jsx("h2",{style:{margin:0,fontSize:"20px",fontWeight:700,color:"var(--metakyc-text-primary, #111827)"},children:"Identity Verification"}),e.jsx("p",{style:{margin:"4px 0 0",fontSize:"14px",color:"var(--metakyc-text-secondary, #6b7280)"},children:"Please complete the identity verification process"})]}),e.jsx("button",{type:"button",onClick:te,disabled:I,style:{padding:"6px 14px",fontSize:"13px",fontWeight:500,borderRadius:"8px",border:"1px solid var(--metakyc-border, #d1d5db)",background:"var(--metakyc-background, #ffffff)",color:"var(--metakyc-text-primary, #111827)",cursor:I?"not-allowed":"pointer",opacity:I?.5:1},children:I?"Restarting…":"Restart"})]}),e.jsx("div",{id:"sumsub-websdk-container",style:{minHeight:"520px",width:"100%",padding:"16px 24px",background:"var(--metakyc-background, #ffffff)"}}),a&&e.jsx("div",{style:{padding:"16px 24px",borderTop:"1px solid var(--metakyc-border, #e5e7eb)"},children:e.jsx(Q,{variant:"outline",onClick:a,children:"Back"})})]}):k!=null&&k.url?e.jsxs(Z,{children:[e.jsx(he,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold",children:"Identity Verification"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:"Please complete the identity verification process"})]}),e.jsx(Q,{type:"button",variant:"outline",size:"sm",onClick:te,disabled:I,children:"Restart"})]})}),e.jsxs(ee,{children:[e.jsx("div",{className:"mb-4 p-3 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg",children:e.jsxs("p",{className:"text-yellow-800 dark:text-yellow-200 text-sm",children:[e.jsx("strong",{children:"Important:"}),' If you see an "expired" or "invalid link" message below, click the "Restart" button above to generate a new verification session.']})}),e.jsx("div",{className:"w-full",style:{height:"600px"},children:e.jsx("iframe",{src:k.url,className:"w-full h-full border-0 rounded-lg",allow:"camera; microphone; geolocation",title:"Identity Verification",onLoad:M=>{var U,H,J;console.log("[Identity] Iframe loaded");try{const u=M.target,C=u.contentDocument||((U=u.contentWindow)==null?void 0:U.document);if(C){const P=((J=(H=C.body)==null?void 0:H.textContent)==null?void 0:J.toLowerCase())||"";(P.includes("expired")||P.includes("invalid")||P.includes("error"))&&(console.warn("[Identity] Iframe shows expiration message"),ae(!0),B("Your verification link has expired."))}}catch{console.log("[Identity] Cannot check iframe content (CORS)")}}})})]}),a&&e.jsx(fe,{children:e.jsx(Q,{variant:"outline",onClick:a,children:"Back"})})]}):x===Ae.SardinAI?e.jsxs(Z,{children:[e.jsxs(he,{children:[e.jsx("h2",{className:"text-2xl font-bold",children:"Device Risk Assessment"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:"Analyzing device security and behavioral patterns..."})]}),e.jsx(ee,{children:e.jsxs("div",{className:"text-center py-12",children:[e.jsx(Ee,{className:"mb-4"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Please wait while we verify your device security"}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-500 mt-2",children:"This process is automatic and will complete in a few seconds"})]})})]}):e.jsxs(Z,{children:[e.jsxs(he,{children:[e.jsx("h2",{className:"text-2xl font-bold",children:"Identity Verification"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:"Please complete the identity verification process"})]}),e.jsx(ee,{children:e.jsx("div",{id:"identity-container",className:"min-h-[400px]"})}),a&&e.jsx(fe,{children:e.jsx(Q,{variant:"outline",onClick:a,children:"Back"})})]})}const me=new Set(["country","nationality","taxCountry","countryOfBirth","mobileCountryCode","otherNationality"]),se=(x=4)=>{const M=Math.min(4,Math.max(1,Number(x)||4));return{gridColumn:`span ${M} / span ${M}`}},be=(x,M)=>{if(!M&&M!==0)return"—";if(me.has(x)&&x!=="mobileCountryCode"){const U=F.find(H=>H.value===M);return U?U.label:String(M)}return String(M)},Pe=({helpText:x})=>{const[M,U]=i.useState(!1),H=i.useRef(null),[,J]=i.useState({top:0,left:0}),u=()=>{if(H.current){const C=H.current.getBoundingClientRect();J({top:C.bottom+window.scrollY+6,left:C.left+window.scrollX})}U(!0)};return e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"metakyc-help-btn",ref:H,onClick:u,style:{width:18,height:18,borderRadius:"50%",border:"1.5px solid var(--metakyc-primary, #2563eb)",background:"transparent",color:"var(--metakyc-primary, #2563eb)",fontSize:11,fontWeight:700,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,lineHeight:1,position:"relative",zIndex:2},children:"?"}),M&&pt.createPortal(e.jsx("div",{style:{position:"fixed",inset:0,zIndex:99999,background:"rgba(0,0,0,0.55)",backdropFilter:"blur(6px)",WebkitBackdropFilter:"blur(6px)",display:"flex",alignItems:"center",justifyContent:"center"},onClick:()=>U(!1),children:e.jsxs("div",{onClick:C=>C.stopPropagation(),style:{background:"var(--metakyc-surface, var(--metakyc-background, #ffffff))",border:"1px solid var(--metakyc-border, #e5e7eb)",borderRadius:"var(--metakyc-border-radius, 8px)",padding:"20px 24px",maxWidth:400,width:"90%",boxShadow:"0 24px 64px rgba(0,0,0,0.4)"},children:[e.jsx("div",{dangerouslySetInnerHTML:{__html:x},style:{fontSize:13,color:"var(--metakyc-text-primary, #111827)",lineHeight:1.6}}),e.jsx("button",{type:"button",onClick:()=>U(!1),style:{marginTop:12,padding:"4px 12px",fontSize:12,border:"1px solid var(--metakyc-border, #e5e7eb)",borderRadius:"var(--metakyc-border-radius, 6px)",background:"transparent",cursor:"pointer",color:"var(--metakyc-text-secondary, #6b7280)"},children:"Close"})]})}),document.body)]})},ve=(x,M)=>M?e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:5,flexWrap:"nowrap"},children:[e.jsx("div",{style:{flex:1,minWidth:0},children:x}),e.jsx("div",{style:{paddingTop:24},children:e.jsx(Pe,{helpText:M})})]}):x,Oe=(x,M)=>{const U=`cf-${M}`,H=x.paramName??"",J=de[H];if(x.customType==="br")return e.jsx("div",{style:{...se(x.colSpan),minHeight:"0.5rem"}},U);if(x.customType==="paragraph")return e.jsx("div",{style:se(x.colSpan),children:e.jsx("div",{className:"text-sm",style:{color:"var(--metakyc-text-secondary, #6b7280)"},dangerouslySetInnerHTML:{__html:x.label||""}})},U);if(x.customType==="html")return e.jsx("div",{style:se(x.colSpan),dangerouslySetInnerHTML:{__html:x.label||""}},U);if(x.customType==="link")return e.jsx("div",{style:se(x.colSpan),children:ve(e.jsx("a",{href:x.linkUrl??"#",target:"_blank",rel:"noopener noreferrer",className:"text-sm underline",style:{color:"var(--metakyc-primary, #6366f1)"},children:x.displayText||x.label||x.linkText||x.linkUrl}),x.helpText)},U);if(x.customType==="checkbox"||x.customType==="link_checkbox"){const u=J==="true"||J===!0;return e.jsx("div",{style:se(x.colSpan),children:ve(e.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:8,cursor:"pointer"},children:[e.jsx(Fe,{checked:!!u,onChange:C=>ge(P=>({...P,[H]:String(C)})),style:{marginTop:2}}),e.jsx("span",{className:"text-sm",style:{color:"var(--metakyc-text-primary, #111827)"},children:x.customType==="link_checkbox"&&x.linkUrl?e.jsxs(e.Fragment,{children:[e.jsx("a",{href:x.linkUrl,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--metakyc-primary, #6366f1)",textDecoration:"underline"},children:x.linkText||x.label}),x.label&&x.linkText?` ${x.label}`:""]}):x.displayText||x.label})]}),x.helpText)},U)}if(x.customType==="group_checkbox"){const u=Array.isArray(J)?J:J?[J]:[],C=P=>{x.singleSelect?ge(m=>({...m,[H]:u[0]===P?[]:[P]})):ge(m=>({...m,[H]:u.includes(P)?u.filter(o=>o!==P):[...u,P]}))};return e.jsx("div",{style:se(x.colSpan),children:ve(e.jsxs("div",{className:"space-y-1.5",children:[x.label&&e.jsx("p",{className:"text-sm font-medium",style:{color:"var(--metakyc-text-primary, #111827)"},children:x.displayText||x.label}),(x.options||[]).map(P=>e.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:8,cursor:"pointer"},children:[e.jsx(Fe,{checked:u.includes(P.value),onChange:()=>C(P.value),style:{marginTop:2}}),e.jsx("span",{className:"text-sm",style:{color:"var(--metakyc-text-primary, #111827)"},children:P.label})]},P.value))]}),x.helpText)},U)}return x.customType==="radio_group"?e.jsx("div",{style:se(x.colSpan),children:ve(e.jsxs("div",{className:"space-y-1.5",children:[x.label&&e.jsx("p",{className:"text-sm font-medium",style:{color:"var(--metakyc-text-primary, #111827)"},children:x.displayText||x.label}),(x.options||[]).map(u=>e.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"radio",name:`rg-${H}`,value:u.value,checked:J===u.value,onChange:()=>ge(C=>({...C,[H]:u.value})),style:{width:16,height:16,flexShrink:0,marginTop:2,accentColor:"var(--metakyc-primary, #6366f1)"}}),e.jsx("span",{className:"text-sm",style:{color:"var(--metakyc-text-primary, #111827)"},children:u.label})]},u.value))]}),x.helpText)},U):e.jsx("div",{style:se(x.colSpan),children:ve(e.jsx(ye,{label:x.displayText||x.label||H,value:String(J??""),onChange:u=>ge(C=>({...C,[H]:u.target.value}))}),x.helpText)},U)},et=(x,M)=>{if(x.isCustom)return Oe(x,M);const U=x.name??"",H=Ge[U],J=x.displayText||(H==null?void 0:H.label)||U,u=ke[U]??"",C=U==="mobileCountryCode",P=!!(H!=null&&H.countriesType)&&!C;return x.editable?C?e.jsx("div",{style:se(x.colSpan??2),children:ve(e.jsx(ze,{label:J,value:String(u),onChange:m=>ce(o=>({...o,[U]:m})),options:[{value:"",label:"Select country code…"},...X]}),x.helpText)},`epc-${M}`):P?e.jsx("div",{style:se(x.colSpan??2),children:ve(e.jsx(ze,{label:J,value:String(u),onChange:m=>ce(o=>({...o,[U]:m})),options:[{value:"",label:`Select ${J.toLowerCase()}…`},...F]}),x.helpText)},`ec-${M}`):e.jsx("div",{style:se(x.colSpan??2),children:ve(e.jsx(ye,{label:J,type:(H==null?void 0:H.type)==="date"?"date":(H==null?void 0:H.type)==="email"?"email":"text",value:String(u),onChange:m=>ce(o=>({...o,[U]:m.target.value}))}),x.helpText)},`ei-${M}`):e.jsx("div",{style:se(x.colSpan??2),children:ve(e.jsxs(e.Fragment,{children:[e.jsx("label",{className:"block text-sm font-medium mb-0.5",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:J}),e.jsx("p",{className:"text-sm",style:{color:"var(--metakyc-text-primary, #111827)",minHeight:"1.5rem"},children:be(U,u)})]}),x.helpText)},`ro-${M}`)};if(E){const x=E.title||"Review Your Information",M=E.subtitle||"Please review and confirm your information before starting identity verification";return e.jsx("form",{onSubmit:U=>{U.preventDefault(),R()},children:e.jsxs(Z,{children:[e.jsxs(he,{children:[e.jsx("h2",{className:"text-lg font-bold",style:{color:"var(--metakyc-text-primary, #111827)"},children:x}),e.jsx("p",{className:"mt-1 text-sm",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:M})]}),e.jsx(ee,{children:e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, minmax(0, 1fr))",gap:"1rem"},children:E.fields.map((U,H)=>et(U,H))})}),e.jsxs(fe,{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a&&e.jsx(Q,{type:"button",variant:"outline",onClick:a,children:"Back"}),e.jsx(Q,{type:"submit",isLoading:I,children:"Confirm and Start Verification"})]})]})})}return e.jsx("form",{onSubmit:_.handleSubmit(R),children:e.jsxs(Z,{children:[e.jsxs(he,{children:[e.jsx("h2",{className:"text-lg font-bold",style:{color:"var(--metakyc-text-primary, #111827)"},children:"Review Your Information"}),e.jsx("p",{className:"mt-1 text-sm",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:"Please review and confirm your information before starting identity verification"})]}),e.jsxs(ee,{className:"space-y-6",children:[e.jsx("div",{className:"space-y-4 pb-4",style:{borderBottom:"1px solid var(--metakyc-border, #e5e7eb)"},children:[{label:"Name",value:`${((Je=O==null?void 0:O.applicantRequestData)==null?void 0:Je.firstName)||""} ${(($e=O==null?void 0:O.applicantRequestData)==null?void 0:$e.lastName)||""}`.trim()},{label:"Email",value:(tt=O==null?void 0:O.applicantRequestData)==null?void 0:tt.email},{label:"Date of Birth",value:((Ke=O==null?void 0:O.applicantRequestData)==null?void 0:Ke.dateOfBirth)||"Not provided"}].map(({label:x,value:M})=>e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:x}),e.jsx("p",{className:"mt-1 text-base",style:{color:"var(--metakyc-text-primary, #111827)"},children:M})]},x))}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-base font-semibold",style:{color:"var(--metakyc-text-primary, #111827)"},children:"Address Information"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsx(Ye.Controller,{control:_.control,name:"country",render:({field:x})=>e.jsx(ze,{label:"Country",value:x.value,onChange:x.onChange,options:[{value:"",label:"Select country…"},...F]})}),e.jsx(Ye.Controller,{control:_.control,name:"nationality",render:({field:x})=>e.jsx(ze,{label:"Nationality",value:x.value,onChange:x.onChange,options:[{value:"",label:"Select nationality…"},...F]})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsx(Ye.Controller,{control:_.control,name:"street",render:({field:x})=>e.jsx(ye,{...x,label:"Street"})}),e.jsx(Ye.Controller,{control:_.control,name:"streetNumber",render:({field:x})=>e.jsx(ye,{...x,label:"Street Number"})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsx(Ye.Controller,{control:_.control,name:"city",render:({field:x})=>e.jsx(ye,{...x,label:"City"})}),e.jsx(Ye.Controller,{control:_.control,name:"zip",render:({field:x})=>e.jsx(ye,{...x,label:"ZIP / Postal Code"})})]}),e.jsx(Ye.Controller,{control:_.control,name:"phonenumber",render:({field:x})=>e.jsx(ye,{...x,label:"Phone Number",type:"tel"})})]})]}),e.jsxs(fe,{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a&&e.jsx(Q,{type:"button",variant:"outline",onClick:a,children:"Back"}),e.jsx(Q,{type:"submit",isLoading:I,children:"Confirm and Start Verification"})]})]})})},ft=({kycStatus:t,reviewStatus:r,workflowResult:a,customMessage:s,onContinue:n,onContactSupport:l})=>{const d=t===Ve.Approved?{type:"success",title:"Verification Approved",icon:"✓",iconBg:"bg-green-100 dark:bg-green-900/30",iconColor:"text-green-600 dark:text-green-400",message:"Your identity verification has been successfully approved."}:t===Ve.Rejected?{type:"error",title:"Verification Rejected",icon:"✕",iconBg:"bg-red-100 dark:bg-red-900/30",iconColor:"text-red-600 dark:text-red-400",message:"Unfortunately, your identity verification was not approved."}:t===Ve.Pending||t===Ve.InProgress?{type:"pending",title:"Verification Pending",icon:"⏱",iconBg:"bg-blue-100 dark:bg-blue-900/30",iconColor:"text-blue-600 dark:text-blue-400",message:"Your identity verification is currently being processed."}:r===Qe.Approved?{type:"success",title:"Application Approved",icon:"✓",iconBg:"bg-green-100 dark:bg-green-900/30",iconColor:"text-green-600 dark:text-green-400",message:"Your application has been approved."}:r===Qe.Reject?{type:"error",title:"Application Rejected",icon:"✕",iconBg:"bg-red-100 dark:bg-red-900/30",iconColor:"text-red-600 dark:text-red-400",message:"Your application has been rejected."}:r===Qe.UnderReview||r===Qe.AdminReview?{type:"pending",title:"Under Review",icon:"📋",iconBg:"bg-yellow-100 dark:bg-yellow-900/30",iconColor:"text-yellow-700 dark:text-yellow-400",message:"Your application is currently under manual review."}:a===ot.Success?{type:"success",title:"Process Complete",icon:"✓",iconBg:"bg-green-100 dark:bg-green-900/30",iconColor:"text-green-600 dark:text-green-400",message:"Your verification process has been completed successfully."}:a===ot.Failed?{type:"error",title:"Process Failed",icon:"✕",iconBg:"bg-red-100 dark:bg-red-900/30",iconColor:"text-red-600 dark:text-red-400",message:"The verification process could not be completed."}:a===ot.AdminReview?{type:"pending",title:"Admin Review Required",icon:"📋",iconBg:"bg-yellow-100 dark:bg-yellow-900/30",iconColor:"text-yellow-700 dark:text-yellow-400",message:"Your application requires administrator review."}:{type:"pending",title:"Processing",icon:"⏱",iconBg:"bg-blue-100 dark:bg-blue-900/30",iconColor:"text-blue-600 dark:text-blue-400",message:"Your application is being reviewed."};return e.jsxs(Z,{children:[e.jsxs(ee,{className:"py-12",children:[e.jsx("div",{className:"flex justify-center mb-6",children:e.jsx("div",{className:`w-24 h-24 rounded-full flex items-center justify-center ${d.iconBg}`,children:e.jsx("span",{className:`text-5xl ${d.iconColor}`,children:d.icon})})}),e.jsx("h2",{className:"text-3xl font-bold text-center mb-4",style:{color:"var(--metakyc-text-primary, #111827)"},children:d.title}),e.jsx("div",{className:"flex justify-center mb-6",children:e.jsx(wt,{variant:d.type==="success"?"success":d.type==="error"?"danger":d.type==="pending"?"warning":"info",children:t!=null?Ve[t]:Qe[r]})}),e.jsx("p",{className:"text-center mb-6 max-w-md mx-auto",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:s||d.message}),d.type==="success"&&e.jsxs("div",{className:"bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg p-4 mb-6",children:[e.jsx("h3",{className:"font-semibold text-green-900 dark:text-green-100 mb-2",children:"What's Next?"}),e.jsxs("ul",{className:"text-sm text-green-800 dark:text-green-200 space-y-1",children:[e.jsx("li",{children:"✓ Your identity has been verified"}),e.jsx("li",{children:"✓ You can now proceed with your application"}),e.jsx("li",{children:"✓ All features are now accessible"})]})]}),d.type==="error"&&e.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4 mb-6",children:[e.jsx("h3",{className:"font-semibold text-red-900 dark:text-red-100 mb-2",children:"What Can You Do?"}),e.jsxs("ul",{className:"text-sm text-red-800 dark:text-red-200 space-y-2",children:[e.jsx("li",{children:"• Review the requirements and ensure all information is correct"}),e.jsx("li",{children:"• Contact our support team for assistance"}),e.jsx("li",{children:"• You may be able to resubmit your application"})]})]}),d.type==="pending"&&e.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4 mb-6",children:[e.jsx("h3",{className:"font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"What Happens Next?"}),e.jsxs("ul",{className:"text-sm text-blue-800 dark:text-blue-200 space-y-2",children:[e.jsx("li",{children:"• Our team is reviewing your information"}),e.jsx("li",{children:"• You will be notified via email once the review is complete"}),e.jsx("li",{children:"• This typically takes 24-48 hours"}),e.jsx("li",{children:"• No action is required from you at this time"})]})]}),e.jsx("div",{className:"mt-6 pt-6",style:{borderTop:"1px solid var(--metakyc-border, #e5e7eb)"},children:e.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{style:{color:"var(--metakyc-text-muted, #9ca3af)"},children:"KYC Status:"}),e.jsx("div",{className:"font-medium mt-1",style:{color:"var(--metakyc-text-primary, #111827)"},children:t!=null?Ve[t]:"Not Available"})]}),e.jsxs("div",{children:[e.jsx("span",{style:{color:"var(--metakyc-text-muted, #9ca3af)"},children:"Review Status:"}),e.jsx("div",{className:"font-medium mt-1",style:{color:"var(--metakyc-text-primary, #111827)"},children:Qe[r]})]})]})})]}),e.jsxs(fe,{style:{display:"flex",justifyContent:"center",gap:"1rem"},children:[d.type==="success"&&n&&e.jsx(Q,{onClick:n,size:"lg",children:"Continue"}),d.type==="error"&&e.jsxs(e.Fragment,{children:[l&&e.jsx(Q,{variant:"outline",onClick:l,children:"Contact Support"}),n&&e.jsx(Q,{onClick:n,children:"Try Again"})]}),d.type==="pending"&&e.jsx("div",{className:"text-center",children:e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Please check back later or wait for our email notification"})})]})]})},qr=({config:t,className:r=""})=>!(t!=null&&t.visible)||!(t!=null&&t.url)?null:e.jsx("div",{className:`metakyc-logo ${r}`,children:e.jsx("img",{src:t.url,alt:t.alt||"Company Logo",style:{width:t.width||"auto",height:t.height||"40px",maxWidth:"100%",objectFit:"contain"},onError:a=>{console.warn("[Logo] Failed to load logo:",t.url),a.target.style.display="none"}})}),nt=({title:t,subtitle:r,className:a=""})=>{const{currentTheme:s}=Re(),n=t||(s==null?void 0:s.title)||"",l=!!(s!=null&&s.logo&&s.logo.visible&&s.logo.url),c=!!n;return!l&&!c?null:e.jsxs("div",{className:`metakyc-header ${a}`,children:[e.jsxs("div",{className:"metakyc-header-title flex items-center text-xl font-bold",style:{color:"var(--metakyc-text-primary, #111827)"},children:[l&&e.jsx(qr,{config:s.logo}),l&&c&&e.jsx("span",{style:{fontSize:"1.5rem",fontWeight:300,color:"var(--metakyc-text-muted, #9ca3af)",margin:"0 12px"},children:"|"}),c&&e.jsx("span",{style:{color:"var(--metakyc-text-primary, #111827)"},children:n})]}),r&&e.jsx("p",{className:"text-sm mt-1",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:r})]})},dt=["firstName","lastName","email","phonenumber","dateOfBirth"];function rt(t){return t==null||t===""||Array.isArray(t)&&t.length===0}const Da={width:"16px",height:"16px",minWidth:"16px",flexShrink:0,flexGrow:0,accentColor:"var(--metakyc-primary, #2563eb)",cursor:"pointer",margin:0,padding:0,display:"inline-block",verticalAlign:"middle"},Tt=({helpText:t,children:r})=>{const[a,s]=i.useState(!1);if(!t)return e.jsx(e.Fragment,{children:r});const n=a?e.jsx("div",{role:"dialog","aria-modal":"true",onClick:()=>s(!1),style:{position:"fixed",inset:0,zIndex:999999,background:"rgba(0, 0, 0, 0.55)",backdropFilter:"blur(6px)",WebkitBackdropFilter:"blur(6px)",display:"flex",alignItems:"center",justifyContent:"center",padding:"16px"},children:e.jsxs("div",{onClick:l=>l.stopPropagation(),style:{background:"var(--metakyc-surface, var(--metakyc-background, #ffffff))",border:"1px solid var(--metakyc-border, #e5e7eb)",borderRadius:"12px",padding:"28px 24px 24px",maxWidth:"480px",width:"100%",maxHeight:"80vh",overflowY:"auto",boxShadow:"0 24px 64px rgba(0,0,0,0.4)",position:"relative"},children:[e.jsx("button",{type:"button",onClick:()=>s(!1),"aria-label":"Close",style:{position:"absolute",top:"12px",right:"12px",width:"28px",height:"28px",borderRadius:"50%",border:"1px solid var(--metakyc-border, #e5e7eb)",background:"var(--metakyc-input-bg, #f3f4f6)",color:"var(--metakyc-text-secondary, #6b7280)",fontSize:"16px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",lineHeight:1},children:"×"}),e.jsx("div",{style:{color:"var(--metakyc-text-primary, #111827)",fontSize:"14px",lineHeight:1.75},dangerouslySetInnerHTML:{__html:t}})]})}):null;return e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"5px",flexWrap:"nowrap"},children:[r,e.jsx("button",{type:"button",className:"metakyc-help-btn",onClick:()=>s(!0),"aria-label":"Help",style:{flexShrink:0,marginTop:"2px",width:"18px",height:"18px",borderRadius:"50%",border:"1.5px solid var(--metakyc-primary, #2563eb)",background:"transparent",color:"var(--metakyc-primary, #2563eb)",fontSize:"10px",fontWeight:"700",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",lineHeight:1,padding:0,position:"relative",zIndex:2,transition:"background 0.15s, color 0.15s"},onMouseEnter:l=>{l.currentTarget.style.background="var(--metakyc-primary, #2563eb)",l.currentTarget.style.color="#ffffff"},onMouseLeave:l=>{l.currentTarget.style.background="transparent",l.currentTarget.style.color="var(--metakyc-primary, #2563eb)"},children:"?"}),typeof document<"u"&&n?pt.createPortal(n,document.body):null]})},Ma=({workflowKey:t,externalRefId:r,onSuccess:a,onCancel:s})=>{var U,H,J,u,C,P,m;const{config:n,baseInformationService:l,currentTheme:c}=Re(),{createApplicant:d,isLoading:y}=vt(),p=t||((U=n.applicantForm)==null?void 0:U.workflowKey);if(!p)throw new Error("workflowKey is required. Provide it either as a prop to CreateApplicantForm or set it in config.applicantForm.workflowKey");const k=r||((H=n.applicantForm)==null?void 0:H.externalRefId)||"",I=((J=n.applicantForm)==null?void 0:J.email)||"",w=((u=n.applicantForm)==null?void 0:u.hiddenValues)||{},A=((C=n.applicantForm)==null?void 0:C.initialValues)||{},b=(((P=n.applicantForm)==null?void 0:P.fieldLabelMode)||(c==null?void 0:c.fieldLabelMode)||"label")!=="placeholder",S=i.useMemo(()=>c!=null&&c.applicantFormPages&&c.applicantFormPages.length>0?c.applicantFormPages:null,[c==null?void 0:c.applicantFormPages]),O=i.useMemo(()=>{const o=new Set(dt),g=c==null?void 0:c.applicantFormRequiredFields;if(g)for(const L of g)o.add(L);if(S)for(const L of S)for(const f of L.fields)!f.isCustom&&f.name&&f.required&&o.add(f.name);return Array.from(o)},[c==null?void 0:c.applicantFormRequiredFields,S]),q=i.useMemo(()=>{var L;if(S){const f=S.flatMap(v=>v.fields).filter(v=>!v.isCustom&&v.name).map(v=>v.name),j=new Set(f);for(const v of dt)j.add(v);return Array.from(j)}let o;(L=n.applicantForm)!=null&&L.visibleFields?o=n.applicantForm.visibleFields:c!=null&&c.applicantFormVisibleFields&&c.applicantFormVisibleFields.length>0?o=c.applicantFormVisibleFields:o=Kt;const g=new Set(o);for(const f of dt)g.add(f);return Array.from(g)},[(m=n.applicantForm)==null?void 0:m.visibleFields,c==null?void 0:c.applicantFormVisibleFields,S]),F=new Set(["country","nationality","taxCountry","countryOfBirth","mobileCountryCode","otherNationality"]),D=i.useMemo(()=>{var g,L;const o=new Set;if(S)for(const f of S)for(const j of f.fields)!j.isCustom&&j.name&&F.has(j.name)&&o.add(j.countriesType??((g=Ge[j.name])==null?void 0:g.countriesType));else for(const f of q)F.has(f)&&o.add((L=Ge[f])==null?void 0:L.countriesType);return o.size===0&&o.add(void 0),Array.from(o)},[q,S]),[X,re]=i.useState({}),[N,h]=i.useState(!0),z=i.useRef(new Set),G=i.useRef(new Set);i.useEffect(()=>{if(!c)return;const o=D.filter(f=>{const j=f!=null?String(f):"all";return!G.current.has(j)&&!z.current.has(j)});if(o.length===0){D.every(j=>{const v=j!=null?String(j):"all";return G.current.has(v)})&&h(!1);return}h(!0);const g=o.map(f=>f!=null?String(f):"all");g.forEach(f=>z.current.add(f)),(async()=>{try{const f=await Promise.all(o.map(async j=>{const v=j!=null?String(j):"all",le=await l.getCountries("",n.locale||"en",j),ne=j===40,xe=new Set,Ie=le.map(ie=>ne&&ie.countryCode?{value:ie.countryCode,label:`${ie.countryCode} – ${ie.name}`}:{value:ie.abbreviation3||ie.abbreviation,label:ie.name}).filter(ie=>!ie.value||xe.has(ie.value)?!1:(xe.add(ie.value),!0));return G.current.add(v),z.current.delete(v),[v,Ie]}));re(j=>({...j,...Object.fromEntries(f)}))}catch(f){g.forEach(j=>z.current.delete(j)),console.error("Failed to load countries:",f)}finally{D.every(j=>{const v=j!=null?String(j):"all";return G.current.has(v)})&&h(!1)}})()},[D,c]);const Y=(o,g)=>{var j;const L=g??((j=Ge[o])==null?void 0:j.countriesType),f=L!=null?String(L):"all";return X[f]||[]},B={firstName:1,lastName:1,title:1,email:1,dateOfBirth:1,phonenumber:1,mobileCountryCode:1,street:1,streetNumber:1,zip:1,city:1,country:1,nationality:1,otherNationality:1,defaultLanguage:1,taxCountry:1,placeOfBirth:1,countryOfBirth:1,salutation:1,educationLevel:1,occupation:1,taxNumber:1},V=Object.fromEntries(Object.entries(w).filter(([o])=>o in B)),ae=Object.fromEntries(Object.entries(A).filter(([o])=>o in B)),[K,ke]=i.useState({workflowKey:p,firstName:"",lastName:"",title:"",email:I,dateOfBirth:"",phonenumber:"",externalRefId:k,mobileCountryCode:"",street:"",streetNumber:"",zip:"",city:"",country:"",nationality:"",otherNationality:[],defaultLanguage:"EN",taxCountry:"",placeOfBirth:"",countryOfBirth:"",salutation:null,educationLevel:"",occupation:"",taxNumber:"",...V,...ae}),ce=Object.fromEntries(Object.entries(w).filter(([o])=>!(o in V)&&o!=="externalRefId"&&o!=="workflowKey")),[de,ge]=i.useState({...ce}),[E,W]=i.useState(0),[$,_]=i.useState({}),[ue,R]=i.useState(null),[te,me]=i.useState(!1),se=(o,g)=>ke(L=>({...L,[o]:g})),be=(o,g)=>ge(L=>({...L,[o]:g})),Pe=o=>!o.conditionalOn||de[o.conditionalOn]==="true",ve=S&&E<S.length-1?E+1:-1,Oe=S&&E>0?E-1:-1,et=o=>{var L;const g={};for(const f of o.fields)if(f.isCustom){if(f.customType==="paragraph"||f.customType==="html"||f.customType==="br"||f.customType==="link")continue;if(f.required&&f.paramName){const j=de[f.paramName],v=f.displayText||f.label||f.paramName;f.customType==="checkbox"||f.customType==="link_checkbox"?j!=="true"&&(g[f.paramName]=`${v} is required.`):(!j||j.trim()==="")&&(g[f.paramName]=`${v} is required.`)}}else if(f.name){const j=f.name;if(O.includes(j)&&rt(K[j])){const v=f.displayText||((L=Ge[j])==null?void 0:L.label)||j;g[j]=`${v} is required.`}}return g},Je=async()=>{if(!S)return;const o=S[E];if(o.conditionalOn&&!Pe(o)){_({}),ve>=0?W(ve):await $e();return}const g=et(o);if(Object.keys(g).length>0){_(g);return}_({}),ve>=0?W(ve):await $e()},$e=async()=>{if(S){let o={};for(const g of S)Pe(g)&&(o={...o,...et(g)});if(Object.keys(o).length>0){_(o);return}}me(!0),R(null);try{if(!K.externalRefId||K.externalRefId.trim()===""){R("External Reference ID is required. Please pass it via config.applicantForm.externalRefId.");return}const o={workflowKey:K.workflowKey,externalRefId:K.externalRefId.trim()};if(S){for(const j of S)if(Pe(j)){for(const v of j.fields)if(!v.isCustom&&v.name){const le=v.name,ne=K[le];rt(ne)||(o[le]=ne)}}for(const j of dt)if(o[j]===void 0){const v=K[j];rt(v)||(o[j]=v)}}else q.forEach(j=>{if(j==="externalRefId")return;const v=K[j];rt(v)||(o[j]=v)});const g=[];if(S){for(const j of S)if(Pe(j))for(const v of j.fields){if(!v.isCustom||!v.paramName||v.customType==="paragraph"||v.customType==="html"||v.customType==="br"||v.customType==="link")continue;const le=de[v.paramName]??"";let ne;if(v.customType==="checkbox"||v.customType==="link_checkbox")ne=le==="true"?"yes":"no";else if(ne=le,!ne&&!v.required)continue;g.push({paramName:v.paramName,value:ne})}}for(const[j,v]of Object.entries(V))o[j]===void 0&&!rt(v)&&(o[j]=v);const L=new Set(g.map(j=>j.paramName));for(const[j,v]of Object.entries(ce))!L.has(j)&&v&&g.push({paramName:j,value:v});g.length>0&&(o.applicantAdditionalDatas=g);const f=await d(o);a(f.applicantId)}catch(o){console.error("Error creating applicant:",o),R(o.message||"Failed to create applicant")}finally{me(!1)}},tt=async o=>{var g;o.preventDefault();for(const L of O)if(rt(K[L])){const f=((g=Ge[L])==null?void 0:g.label)||L;R(`${f} is required.`);return}await $e()},Ke=(o,g,L,f,j)=>{var jt;const v=Ge[o];if(!v)return null;const le=O.includes(o),ne=$[o],xe=L||v.label,Ie=o in ae,ie=g??o,Le={required:le},Be=j?j!=="placeholder":b,qe=Be?xe:void 0,Yr=Be?"...":xe;switch(v.type){case"select":if(o==="country"||o==="nationality"||o==="taxCountry"||o==="countryOfBirth"||o==="mobileCountryCode"){const Ne=Y(o,f);return e.jsx(ze,{...Le,label:qe,value:K[o]||"",onChange:Xe=>se(o,Xe),options:[{value:"",label:`Select ${Yr.toLowerCase()}`},...Ne],disabled:N,readOnly:Ie,error:ne},ie)}if(o==="salutation")return e.jsx(ze,{...Le,label:qe,value:((jt=K[o])==null?void 0:jt.toString())||"",onChange:Ne=>se(o,Ne?Number(Ne):null),options:[{value:"",label:Be?"Select salutation...":xe},{value:lt.Male.toString(),label:"Male"},{value:lt.Female.toString(),label:"Female"},{value:lt.Other.toString(),label:"Other"}],readOnly:Ie,error:ne},ie);if(o==="defaultLanguage"){const Ne=c!=null&&c.allowedLanguages&&c.allowedLanguages.length>0?ht.filter(Xe=>c.allowedLanguages.includes(Xe.value)):ht;return e.jsx(ze,{...Le,label:qe,value:K[o]||"",onChange:Xe=>se(o,Xe),options:[{value:"",label:Be?"Select language...":xe},...Ne],readOnly:Ie,error:ne},ie)}return null;case"multiselect":if(o==="otherNationality"){const Ne=Y(o,f);return e.jsx(Fr,{...Le,label:qe,value:K[o]||[],onChange:Xe=>se(o,Xe),options:Ne,placeholder:Be?"Select other nationalities...":xe,disabled:N,readOnly:Ie},ie)}return null;case"date":return e.jsx(ye,{...Le,type:"date",label:qe,placeholder:Be?void 0:xe,value:K[o]||"",onChange:Ne=>se(o,Ne.target.value),readOnly:Ie,error:ne},ie);case"email":return e.jsx(ye,{...Le,type:"email",label:qe,placeholder:Be?void 0:xe,value:K[o]||"",onChange:Ne=>se(o,Ne.target.value),readOnly:Ie,error:ne},ie);case"tel":return e.jsx(ye,{...Le,type:"tel",label:qe,placeholder:Be?void 0:xe,value:K[o]||"",onChange:Ne=>se(o,Ne.target.value),readOnly:Ie,error:ne},ie);default:return e.jsx(ye,{...Le,type:"text",label:qe,placeholder:Be?void 0:xe,value:K[o]||"",onChange:Ne=>se(o,Ne.target.value),readOnly:Ie,error:ne},ie)}},x=(o,g)=>{const L=o.labelMode?o.labelMode!=="placeholder":b;if(o.customType==="paragraph"){const v=o.displayText||o.label||"";return e.jsx("p",{className:"metakyc-paragraph",style:{fontSize:"14px",lineHeight:"1.7",margin:0,color:"var(--metakyc-text-secondary, #6b7280)"},dangerouslySetInnerHTML:{__html:v}},`custom-${g}`)}if(o.customType==="html")return e.jsx("div",{dangerouslySetInnerHTML:{__html:o.label||""}},`custom-${g}`);if(o.customType==="br")return e.jsx("div",{style:{height:"12px"}},`custom-${g}`);if(o.customType==="link"){const v=o.displayText||o.label||o.linkText||o.linkUrl||"";return e.jsx("div",{className:"metakyc-link-field",children:e.jsxs("a",{href:o.linkUrl||"#",target:"_blank",rel:"noopener noreferrer",style:{display:"inline-flex",alignItems:"center",gap:"4px",color:"var(--metakyc-primary, #2563eb)",fontSize:"14px",textDecoration:"underline",cursor:"pointer"},children:[v,e.jsx("span",{style:{fontSize:"10px",opacity:.7},children:"↗"})]})},`custom-${g}`)}if(!o.paramName)return null;const f=$[o.paramName],j=o.displayText||o.label||o.paramName;if(o.customType==="checkbox")return e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("label",{className:"metakyc-option-label",style:{display:"flex",alignItems:"center",gap:"10px",cursor:"pointer",margin:0,padding:0},children:[e.jsx(Fe,{checked:de[o.paramName]==="true",onChange:v=>be(o.paramName,v?"true":"false")}),e.jsxs("span",{className:"metakyc-option-text",style:{fontSize:"14px",color:"var(--metakyc-text-primary, #111827)",lineHeight:"1.4"},children:[j,o.required&&e.jsx("span",{className:"text-red-500 ml-0.5",children:"*"})]})]}),f&&e.jsx("p",{className:"text-red-500 text-xs mt-0.5",children:f})]},`custom-${g}`);if(o.customType==="link_checkbox")return e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("label",{className:"metakyc-option-label",style:{display:"flex",alignItems:"center",gap:"10px",cursor:"pointer",margin:0,padding:0},children:[e.jsx(Fe,{checked:de[o.paramName]==="true",onChange:v=>be(o.paramName,v?"true":"false")}),e.jsxs("span",{className:"metakyc-option-text",style:{fontSize:"14px",color:"var(--metakyc-text-primary, #111827)",lineHeight:"1.4"},children:[j," ",o.linkUrl&&e.jsx("a",{href:o.linkUrl,target:"_blank",rel:"noopener noreferrer",className:"underline",style:{color:"var(--metakyc-primary, #2563eb)"},onClick:v=>v.stopPropagation(),children:o.linkText||o.linkUrl}),o.required&&e.jsx("span",{className:"text-red-500 ml-0.5",children:"*"})]})]}),f&&e.jsx("p",{className:"text-red-500 text-xs mt-0.5",children:f})]},`custom-${g}`);if(o.customType==="group_checkbox"){const v=(de[o.paramName]||"").split(",").filter(Boolean);return e.jsxs("div",{className:"flex flex-col gap-1.5",children:[L&&e.jsxs("div",{className:"text-sm font-medium",style:{color:"var(--metakyc-text-primary, #111827)"},children:[j,o.required&&e.jsx("span",{className:"text-red-500 ml-0.5",children:"*"})]}),e.jsx("div",{className:"metakyc-options-group",style:{display:"flex",flexDirection:"column",gap:"8px"},children:(o.options||[]).map(le=>{const ne=o.singleSelect?de[o.paramName]===le.value:v.includes(le.value);return e.jsxs("label",{className:"metakyc-option-label",style:{display:"flex",alignItems:"center",gap:"10px",cursor:"pointer",margin:0,padding:0},children:[e.jsx(Fe,{checked:ne,onChange:xe=>{if(o.singleSelect)be(o.paramName,xe?le.value:"");else{const Ie=xe?[...v,le.value]:v.filter(ie=>ie!==le.value);be(o.paramName,Ie.join(","))}}}),e.jsx("span",{className:"metakyc-option-text",style:{fontSize:"14px",color:"var(--metakyc-text-primary, #111827)",lineHeight:"1.4"},children:le.label})]},le.value)})}),f&&e.jsx("p",{className:"text-red-500 text-xs",children:f})]},`custom-${g}`)}return o.customType==="radio_group"?e.jsxs("div",{className:"flex flex-col gap-1.5",children:[L&&e.jsxs("div",{className:"text-sm font-medium",style:{color:"var(--metakyc-text-primary, #111827)"},children:[j,o.required&&e.jsx("span",{className:"text-red-500 ml-0.5",children:"*"})]}),e.jsx("div",{className:"metakyc-options-group",style:{display:"flex",flexDirection:"column",gap:"8px"},children:(o.options||[]).map(v=>e.jsxs("label",{className:"metakyc-option-label",style:{display:"flex",alignItems:"center",gap:"10px",cursor:"pointer",margin:0,padding:0},children:[e.jsx("input",{type:"radio",checked:de[o.paramName]===v.value,onChange:()=>be(o.paramName,v.value),name:`radio-group-${o.paramName}-${g}`,className:"metakyc-option-input",style:Da}),e.jsx("span",{className:"metakyc-option-text",style:{fontSize:"14px",color:"var(--metakyc-text-primary, #111827)",lineHeight:"1.4"},children:v.label})]},v.value))}),f&&e.jsx("p",{className:"text-red-500 text-xs",children:f})]},`custom-${g}`):e.jsx(ye,{type:"text",label:L?`${j}${o.required?" *":""}`:void 0,placeholder:L?void 0:j,value:de[o.paramName]||"",onChange:v=>be(o.paramName,v.target.value),required:o.required,error:f},`custom-${g}`)},M=(o,g)=>{const L=Pe(o);return e.jsxs("div",{className:"space-y-4",children:[o.conditionalOn&&e.jsx(Tt,{helpText:o.conditionalHelpText,children:e.jsxs("label",{className:"metakyc-option-label",style:{display:"flex",alignItems:"center",gap:"10px",cursor:"pointer",margin:0,padding:0},children:[e.jsx(Fe,{checked:L,onChange:f=>be(o.conditionalOn,f?"true":"false")}),e.jsx("span",{className:"metakyc-option-text",style:{fontSize:"14px",color:"var(--metakyc-text-primary, #111827)",lineHeight:"1.4",fontWeight:500},children:o.conditionalOn})]})}),L&&e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, minmax(0, 1fr))",gap:"1rem"},children:o.fields.map((f,j)=>{const v=Math.min(4,Math.max(1,Number(f.colSpan)||4)),le=f.isCustom?`custom-${j}-${f.paramName}`:`builtin-${f.name}-${j}`;return e.jsx("div",{style:{gridColumn:`span ${v} / span ${v}`},children:e.jsx(Tt,{helpText:f.helpText,children:f.isCustom?x(f,j):Ke(f.name,le,f.displayText,f.countriesType,f.labelMode)})},le)})})]})};if(!c||N)return e.jsx("div",{className:"metakyc-sdk",children:e.jsx(Z,{children:e.jsxs(ee,{children:[e.jsx(Ee,{className:"my-8"}),e.jsx("p",{className:"text-center mt-4",style:{color:"var(--metakyc-text-secondary, #6b7280)",fontSize:"0.875rem"},children:"Loading form…"})]})})});if(S){const o=S[E]??S[0],g=Oe===-1,L=ve===-1,f=S.length,j=Pe(o),v=Object.values($);return e.jsx("div",{className:"metakyc-sdk",children:e.jsxs(Z,{children:[e.jsx(he,{children:e.jsx(nt,{title:(c==null?void 0:c.title)||"Create Applicant"})}),e.jsxs(ee,{children:[(o.title||o.subtitle||o.description)&&e.jsxs("div",{className:"mb-4",children:[o.title&&e.jsx("h3",{className:"font-semibold text-base",style:{color:"var(--metakyc-text-primary, #111827)"},children:o.title}),o.subtitle&&e.jsx("p",{className:"text-sm mt-0.5",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:o.subtitle}),o.description&&o.description!==o.subtitle&&e.jsx("p",{className:"text-xs mt-1",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:o.description})]}),f>1&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",marginBottom:"1rem"},children:[S.map((le,ne)=>e.jsx("div",{style:{height:"0.375rem",borderRadius:"9999px",transition:"all 150ms",...ne===E?{flex:"1 1 0%",backgroundColor:"var(--metakyc-primary, #2563eb)"}:ne<E?{width:"2rem",backgroundColor:"var(--metakyc-primary-light, #93c5fd)",opacity:.7}:{width:"2rem",backgroundColor:"var(--metakyc-border, #e5e7eb)",opacity:.3}}},ne)),e.jsxs("span",{style:{fontSize:"0.75rem",color:"var(--metakyc-text-muted, #9ca3af)",flexShrink:0},children:[E+1," / ",f]})]}),(ue||v.length>0)&&e.jsxs("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-lg",children:[ue&&e.jsxs("p",{className:"text-red-600 text-sm",children:[e.jsx("strong",{children:"Error:"})," ",ue]}),v.map((le,ne)=>e.jsx("p",{className:"text-red-600 text-sm",children:le},ne))]}),M(o)]}),e.jsxs(fe,{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsxs("div",{children:[!g&&e.jsx(Q,{type:"button",variant:"outline",onClick:()=>{W(Oe),_({})},disabled:te||y,children:"Previous"}),g&&s&&e.jsx(Q,{type:"button",variant:"outline",onClick:s,disabled:te||y,children:"Cancel"})]}),e.jsx(Q,{type:"button",isLoading:te||y,onClick:L?$e:Je,children:L?o.conditionalOn&&!j?"Skip & Submit":"Submit":o.conditionalOn&&!j?"Skip":"Next"})]})]})})}return e.jsx("div",{className:"metakyc-sdk",children:e.jsx("form",{onSubmit:tt,children:e.jsxs(Z,{children:[e.jsx(he,{children:e.jsx(nt,{title:(c==null?void 0:c.title)||"Create Applicant"})}),e.jsxs(ee,{children:[ue&&e.jsx("div",{className:"mb-6 p-4 bg-red-50 border border-red-200 rounded-lg",children:e.jsxs("p",{className:"text-red-600 text-sm",children:[e.jsx("strong",{children:"Error:"})," ",ue]})}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, minmax(0, 1fr))",gap:"1rem"},children:q.map(o=>e.jsx("div",{style:{gridColumn:"span 4 / span 4"},children:Ke(o)},o))})]}),e.jsxs(fe,{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[s&&e.jsx(Q,{type:"button",variant:"outline",onClick:s,disabled:te||y,children:"Cancel"}),e.jsx(Q,{type:"submit",isLoading:te||y,children:"Create Applicant"})]})]})})})},Ft=["companyName","email"];function gt(t){return t==null||t===""||Array.isArray(t)&&t.length===0}const za=({workflowKey:t,externalRefId:r,onSuccess:a,onCancel:s})=>{var Ke,x,M,U,H,J;const{config:n,baseInformationService:l,currentTheme:c}=Re(),{createCompanyApplicant:d,isLoading:y}=vt(),p=t||((Ke=n.applicantForm)==null?void 0:Ke.workflowKey);if(!p)throw new Error("workflowKey is required. Provide it either as a prop to CreateCompanyApplicantForm or set it in config.applicantForm.workflowKey");const k=r||((x=n.applicantForm)==null?void 0:x.externalRefId)||"",I=((M=n.applicantForm)==null?void 0:M.email)||"",w=((U=n.applicantForm)==null?void 0:U.initialValues)||{},T=(((H=n.applicantForm)==null?void 0:H.fieldLabelMode)||(c==null?void 0:c.fieldLabelMode)||"label")!=="placeholder",b=i.useMemo(()=>c!=null&&c.companyFormPages&&c.companyFormPages.length>0?c.companyFormPages:null,[c==null?void 0:c.companyFormPages]),S=i.useMemo(()=>{const u=new Set(Ft),C=c==null?void 0:c.companyFormRequiredFields;if(C)for(const P of C)u.add(P);if(b)for(const P of b)for(const m of P.fields)!m.isCustom&&m.name&&m.required&&u.add(m.name);return Array.from(u)},[c==null?void 0:c.companyFormRequiredFields,b]),O=i.useMemo(()=>{var u;if(b){const C=b.flatMap(m=>m.fields).filter(m=>!m.isCustom&&m.name).map(m=>m.name),P=new Set(C);for(const m of Ft)P.add(m);return Array.from(P)}return(u=n.applicantForm)!=null&&u.visibleFields?n.applicantForm.visibleFields:c!=null&&c.companyFormVisibleFields&&c.companyFormVisibleFields.length>0?c.companyFormVisibleFields:Ut},[(J=n.applicantForm)==null?void 0:J.visibleFields,c==null?void 0:c.companyFormVisibleFields,b]),q=new Set(["countryResidence","addressCountry"]),F=i.useMemo(()=>{var C,P;const u=new Set;if(b)for(const m of b)for(const o of m.fields)!o.isCustom&&o.name&&q.has(o.name)&&u.add(o.countriesType??((C=Ze[o.name])==null?void 0:C.countriesType));else for(const m of O)q.has(m)&&u.add((P=Ze[m])==null?void 0:P.countriesType);return u.size===0&&u.add(void 0),Array.from(u)},[O,b]),[D,X]=i.useState({}),[re,N]=i.useState(!0),h=i.useRef(new Set),z=i.useRef(new Set);i.useEffect(()=>{if(!c)return;const u=F.filter(m=>{const o=m!=null?String(m):"all";return!z.current.has(o)&&!h.current.has(o)});if(u.length===0){F.every(o=>z.current.has(o!=null?String(o):"all"))&&N(!1);return}N(!0);const C=u.map(m=>m!=null?String(m):"all");C.forEach(m=>h.current.add(m)),(async()=>{try{const m=await Promise.all(u.map(async o=>{const g=o!=null?String(o):"all",L=await l.getCountries("",n.locale||"en",o),f=new Set,j=L.map(v=>({value:v.abbreviation3||v.abbreviation,label:v.name})).filter(v=>!v.value||f.has(v.value)?!1:(f.add(v.value),!0));return z.current.add(g),h.current.delete(g),[g,j]}));X(o=>({...o,...Object.fromEntries(m)}))}catch(m){C.forEach(o=>h.current.delete(o)),console.error("Failed to load countries:",m)}finally{F.every(o=>z.current.has(o!=null?String(o):"all"))&&N(!1)}})()},[F,c]);const G=(u,C)=>{var o;const P=C??((o=Ze[u])==null?void 0:o.countriesType),m=P!=null?String(P):"all";return D[m]||[]},Y={companyName:1,registrationNumber:1,email:1,phone:1,countryResidence:1,legalAddress:1,incorporatedOn:1,controlScheme:1,taxId:1,registrationLocation:1,website:1,postalAddress:1,street:1,streetNumber:1,city:1,state:1,postalCode:1,addressCountry:1,lei:1},B=Object.fromEntries(Object.entries(w).filter(([u])=>u in Y)),[V,ae]=i.useState({workflowKey:p,companyName:"",email:I,phone:"",registrationNumber:"",countryResidence:"",legalAddress:"",incorporatedOn:"",controlScheme:"",taxId:"",registrationLocation:"",website:"",postalAddress:"",street:"",streetNumber:"",city:"",state:"",postalCode:"",addressCountry:"",lei:"",externalRefId:k,...B}),[K,ke]=i.useState({}),[ce,de]=i.useState(0),[ge,E]=i.useState({}),[W,$]=i.useState(null),[_,ue]=i.useState(!1),R=(u,C)=>ae(P=>({...P,[u]:C})),te=(u,C)=>ke(P=>({...P,[u]:C})),me=u=>!u.conditionalOn||K[u.conditionalOn]==="true",se=b&&ce<b.length-1?ce+1:-1,be=b&&ce>0?ce-1:-1,Pe=u=>{var P;const C={};for(const m of u.fields)if(m.isCustom){if(m.customType==="paragraph"||m.customType==="html"||m.customType==="br"||m.customType==="link")continue;if(m.required&&m.paramName){const o=K[m.paramName],g=m.displayText||m.label||m.paramName;m.customType==="checkbox"||m.customType==="link_checkbox"?o!=="true"&&(C[m.paramName]=`${g} is required.`):(!o||o.trim()==="")&&(C[m.paramName]=`${g} is required.`)}}else if(m.name){const o=m.name;if(S.includes(o)&&gt(V[o])){const g=m.displayText||((P=Ze[o])==null?void 0:P.label)||o;C[o]=`${g} is required.`}}return C},ve=async()=>{if(!b)return;const u=b[ce];if(u.conditionalOn&&!me(u)){E({}),se>=0?de(se):await Oe();return}const C=Pe(u);if(Object.keys(C).length>0){E(C);return}E({}),se>=0?de(se):await Oe()},Oe=async()=>{var u;if(b){let C={};for(const P of b)me(P)&&(C={...C,...Pe(P)});if(Object.keys(C).length>0){E(C);return}}ue(!0),$(null);try{const C={workflowKey:V.workflowKey,externalRefId:((u=V.externalRefId)==null?void 0:u.trim())||void 0},P=b?b.filter(g=>me(g)).flatMap(g=>g.fields).filter(g=>!g.isCustom&&g.name).map(g=>g.name):O;for(const g of P){const L=V[g];if(!gt(L))switch(g){case"companyName":C.companyName=L;break;case"email":C.companyEmail=L;break;case"phone":C.companyPhone=L;break;case"registrationNumber":C.companyRegistrationNumber=L;break;case"countryResidence":C.companyCountry=L;break;case"city":C.companyCity=L;break;case"street":C.companyStreet=L;break;case"postalCode":C.companyZip=L;break;default:C[g]=L;break}}const m=[];if(b){for(const g of b)if(me(g))for(const L of g.fields){if(!L.isCustom||!L.paramName||L.customType==="paragraph"||L.customType==="html"||L.customType==="br"||L.customType==="link")continue;const f=K[L.paramName]??"";let j;if(L.customType==="checkbox"||L.customType==="link_checkbox")j=f==="true"?"yes":"no";else if(j=f,!j&&!L.required)continue;m.push({paramName:L.paramName,value:j})}}m.length>0&&(C.applicantAdditionalDatas=m);const o=await d(C);a(o.applicantId)}catch(C){console.error("Error creating company applicant:",C),$(C.message||"Failed to create company applicant")}finally{ue(!1)}},et=async u=>{var C;u.preventDefault();for(const P of S)if(gt(V[P])){const m=((C=Ze[P])==null?void 0:C.label)||P;$(`${m} is required.`);return}await Oe()},Je=(u,C,P,m,o)=>{const g=Ze[u];if(!g)return null;const L=S.includes(u),f=ge[u],j=P||g.label,v=u in B,le=C??u,ne=o?o!=="placeholder":T,xe=ne?j:void 0,Ie=ne?"...":j;switch(g.type){case"select":if(u==="countryResidence"||u==="addressCountry"){const ie=G(u,m);return e.jsx(ze,{required:L,label:xe,value:V[u]||"",onChange:Le=>R(u,Le),options:[{value:"",label:`Select ${Ie.toLowerCase()}`},...ie],disabled:re,readOnly:v,error:f},le)}return null;case"date":return e.jsx(ye,{required:L,type:"date",label:xe,placeholder:ne?void 0:j,value:V[u]||"",onChange:ie=>R(u,ie.target.value),readOnly:v,error:f},le);case"email":return e.jsx(ye,{required:L,type:"email",label:xe,placeholder:ne?void 0:j,value:V[u]||"",onChange:ie=>R(u,ie.target.value),readOnly:v,error:f},le);case"tel":return e.jsx(ye,{required:L,type:"tel",label:xe,placeholder:ne?void 0:j,value:V[u]||"",onChange:ie=>R(u,ie.target.value),readOnly:v,error:f},le);default:return e.jsx(ye,{required:L,type:"text",label:xe,placeholder:ne?void 0:j,value:V[u]||"",onChange:ie=>R(u,ie.target.value),readOnly:v,error:f},le)}},$e=(u,C)=>{if(u.customType==="paragraph")return e.jsx("p",{style:{fontSize:"14px",lineHeight:"1.7",margin:0,color:"var(--metakyc-text-secondary, #6b7280)"},dangerouslySetInnerHTML:{__html:u.displayText||u.label||""}},`custom-${C}`);if(u.customType==="html")return e.jsx("div",{dangerouslySetInnerHTML:{__html:u.label||""}},`custom-${C}`);if(u.customType==="br")return e.jsx("div",{style:{height:"12px"}},`custom-${C}`);if(u.customType==="link")return e.jsx("div",{children:e.jsx("a",{href:u.linkUrl||"#",target:"_blank",rel:"noopener noreferrer",style:{color:"var(--metakyc-primary, #2563eb)",fontSize:"14px",textDecoration:"underline"},children:u.displayText||u.label||u.linkText||u.linkUrl||""})},`custom-${C}`);if(!u.paramName)return null;const P=ge[u.paramName],m=u.displayText||u.label||u.paramName,o=u.labelMode?u.labelMode!=="placeholder":T;return u.customType==="checkbox"?e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"10px",cursor:"pointer"},children:[e.jsx(Fe,{checked:K[u.paramName]==="true",onChange:g=>te(u.paramName,g?"true":"false")}),e.jsxs("span",{style:{fontSize:"14px",color:"var(--metakyc-text-primary, #111827)"},children:[m,u.required&&e.jsx("span",{className:"text-red-500 ml-0.5",children:"*"})]})]}),P&&e.jsx("p",{className:"text-red-500 text-xs mt-0.5",children:P})]},`custom-${C}`):e.jsx(ye,{type:"text",label:o?`${m}${u.required?" *":""}`:void 0,placeholder:o?void 0:m,value:K[u.paramName]||"",onChange:g=>te(u.paramName,g.target.value),required:u.required,error:P},`custom-${C}`)},tt=u=>{const C=me(u);return e.jsxs("div",{className:"space-y-4",children:[u.conditionalOn&&e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"10px",cursor:"pointer"},children:[e.jsx(Fe,{checked:C,onChange:P=>te(u.conditionalOn,P?"true":"false")}),e.jsx("span",{style:{fontSize:"14px",fontWeight:500},children:u.conditionalOn})]}),C&&e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, minmax(0, 1fr))",gap:"1rem"},children:u.fields.map((P,m)=>{const o=Math.min(4,Math.max(1,Number(P.colSpan)||4)),g=P.isCustom?`custom-${m}-${P.paramName}`:`builtin-${P.name}-${m}`;return e.jsx("div",{style:{gridColumn:`span ${o} / span ${o}`},children:P.isCustom?$e(P,m):Je(P.name,g,P.displayText,P.countriesType,P.labelMode)},g)})})]})};if(!c||re)return e.jsx("div",{className:"metakyc-sdk",children:e.jsx(Z,{children:e.jsxs(ee,{children:[e.jsx(Ee,{className:"my-8"}),e.jsx("p",{className:"text-center mt-4",style:{color:"var(--metakyc-text-secondary, #6b7280)",fontSize:"0.875rem"},children:"Loading form…"})]})})});if(b){const u=b[ce]??b[0],C=be===-1,P=se===-1,m=b.length,o=me(u),g=Object.values(ge);return e.jsx("div",{className:"metakyc-sdk",children:e.jsxs(Z,{children:[e.jsx(he,{children:e.jsx(nt,{title:(c==null?void 0:c.title)||"Company Registration"})}),e.jsxs(ee,{children:[(u.title||u.subtitle)&&e.jsxs("div",{className:"mb-4",children:[u.title&&e.jsx("h3",{className:"font-semibold text-base",style:{color:"var(--metakyc-text-primary, #111827)"},children:u.title}),u.subtitle&&e.jsx("p",{className:"text-sm mt-0.5",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:u.subtitle})]}),(W||g.length>0)&&e.jsxs("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-lg",children:[W&&e.jsxs("p",{className:"text-red-600 text-sm",children:[e.jsx("strong",{children:"Error:"})," ",W]}),g.map((L,f)=>e.jsx("p",{className:"text-red-600 text-sm",children:L},f))]}),m>1&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",marginBottom:"1rem"},children:[b.map((L,f)=>e.jsx("div",{style:{height:"0.375rem",borderRadius:"9999px",transition:"all 150ms",...f===ce?{flex:"1 1 0%",backgroundColor:"var(--metakyc-primary, #2563eb)"}:f<ce?{width:"2rem",backgroundColor:"var(--metakyc-primary-light, #93c5fd)",opacity:.7}:{width:"2rem",backgroundColor:"#e5e7eb"}}},f)),e.jsxs("span",{style:{fontSize:"0.75rem",color:"var(--metakyc-text-muted, #9ca3af)",flexShrink:0},children:[ce+1," / ",m]})]}),tt(u)]}),e.jsxs(fe,{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsxs("div",{children:[!C&&e.jsx(Q,{type:"button",variant:"outline",onClick:()=>{de(be),E({})},disabled:_||y,children:"Previous"}),C&&s&&e.jsx(Q,{type:"button",variant:"outline",onClick:s,disabled:_||y,children:"Cancel"})]}),e.jsx(Q,{type:"button",isLoading:_||y,onClick:P?Oe:ve,children:P?u.conditionalOn&&!o?"Skip & Submit":"Submit":u.conditionalOn&&!o?"Skip":"Next"})]})]})})}return e.jsx("div",{className:"metakyc-sdk",children:e.jsx("form",{onSubmit:et,children:e.jsxs(Z,{children:[e.jsx(he,{children:e.jsx(nt,{title:(c==null?void 0:c.title)||"Company Registration"})}),e.jsxs(ee,{children:[W&&e.jsx("div",{className:"mb-6 p-4 bg-red-50 border border-red-200 rounded-lg",children:e.jsxs("p",{className:"text-red-600 text-sm",children:[e.jsx("strong",{children:"Error:"})," ",W]})}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, minmax(0, 1fr))",gap:"1rem"},children:O.map(u=>e.jsx("div",{style:{gridColumn:"span 4 / span 4"},children:Je(u)},u))})]}),e.jsxs(fe,{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[s&&e.jsx(Q,{type:"button",variant:"outline",onClick:s,disabled:_||y,children:"Cancel"}),e.jsx(Q,{type:"submit",isLoading:_||y,children:"Register Company"})]})]})})})},Oa=({applicantId:t,onComplete:r,onError:a,className:s})=>{const{progress:n,currentStep:l,steps:c,workflowKey:d,nextWorkflowKey:y,hasWorkflowChanged:p,isLoading:k,error:I,moveBack:w,refreshProgress:A}=Nr(t),[T,b]=i.useState(!1),S=i.useRef(null);if(i.useEffect(()=>{I&&a&&a(I)},[I,a]),i.useEffect(()=>{n!=null&&n.workflowResult&&r&&r(n.workflowResult)},[n==null?void 0:n.workflowResult,r]),i.useEffect(()=>{p&&b(!1)},[p]),k||!n)return e.jsx("div",{className:`metakyc-sdk ${s||""}`,children:e.jsx(Z,{children:e.jsxs(ee,{children:[e.jsx(Ee,{className:"my-8"}),e.jsx("p",{className:"text-center mt-4",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:"Loading workflow..."})]})})});if(I)return e.jsx("div",{className:`metakyc-sdk ${s||""}`,children:e.jsx(Z,{children:e.jsx(ee,{children:e.jsxs("div",{className:"text-center py-8",children:[e.jsx("p",{className:"text-lg mb-4",style:{color:"var(--metakyc-danger, #ef4444)"},children:"An error occurred"}),e.jsx("p",{style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:I.message})]})})})});if(p&&!T)return e.jsx("div",{className:`metakyc-sdk ${s||""}`,children:e.jsx(Z,{children:e.jsx(ee,{children:e.jsxs("div",{className:"text-center py-8",children:[e.jsx("div",{className:"mb-6",children:e.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full mb-4",style:{backgroundColor:"var(--metakyc-primary-light, #dbeafe)"},children:e.jsx("svg",{className:"w-8 h-8",style:{color:"var(--metakyc-primary, #2563eb)"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})})}),e.jsx("h3",{className:"text-xl font-semibold mb-2",style:{color:"var(--metakyc-text-primary, #111827)"},children:"Workflow Transition"}),e.jsx("p",{className:"mb-6",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:"Your application workflow has been updated based on your progress."}),e.jsxs("div",{className:"rounded-lg p-4 mb-6 max-w-md mx-auto",style:{backgroundColor:"var(--metakyc-surface, #f9fafb)"},children:[e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsxs("div",{className:"text-left",children:[e.jsx("p",{className:"mb-1",style:{color:"var(--metakyc-text-muted, #9ca3af)"},children:"Previous Workflow"}),e.jsx("p",{className:"font-medium",style:{color:"var(--metakyc-text-primary, #111827)"},children:d})]}),e.jsx("svg",{className:"w-6 h-6 mx-4",style:{color:"var(--metakyc-text-muted, #9ca3af)"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 7l5 5m0 0l-5 5m5-5H6"})}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"mb-1",style:{color:"var(--metakyc-text-muted, #9ca3af)"},children:"New Workflow"}),e.jsx("p",{className:"font-medium",style:{color:"var(--metakyc-primary, #2563eb)"},children:y})]})]}),n.nextWorkflowName&&e.jsx("p",{className:"text-center mt-2 text-xs",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:n.nextWorkflowName})]}),e.jsx("button",{onClick:()=>b(!0),className:"px-6 py-3 font-medium rounded-lg transition-opacity hover:opacity-90",style:{backgroundColor:"var(--metakyc-primary, #2563eb)",color:"#ffffff"},children:"Continue with New Workflow"})]})})})});if(n.status===Te.Finished||n.status===Te.OnHold)return e.jsx("div",{className:`metakyc-sdk ${s||""}`,children:e.jsx(ft,{kycStatus:n.kycStatus,reviewStatus:n.reviewStatus,workflowResult:n.workflowResult,customMessage:n.customMessage,onContinue:r&&n.workflowResult?()=>r(n.workflowResult):void 0,onContactSupport:()=>{typeof window<"u"&&(window.location.href="mailto:support@example.com")}})});if(!l)return e.jsx("div",{className:`metakyc-sdk ${s||""}`,children:e.jsx(Z,{children:e.jsxs(ee,{children:[e.jsx(Ee,{className:"my-8"}),e.jsx("p",{className:"text-center mt-4",style:{color:"var(--metakyc-text-secondary, #6b7280)"},children:n.status===Te.IdentityPending?"Loading identity verification...":"Loading current step..."})]})})});const O=D=>{switch(D){case oe.Overview:return"Overview";case oe.Questionaries:return"Questionnaire";case oe.UploadDocument:return"Documents";case oe.IdentitySdk:return"Identity";case oe.RiskScoring:return"Risk Assessment";case oe.InvestorCategorization:return"Investor Categorization";case oe.AppropriatenessTest:return"Appropriateness Test";case oe.AdditionalData:return"Additional Data";case oe.ManualReview:return"Review";default:return""}},q=()=>{const D=c.filter(z=>z.visibility!==!1),X=D.findIndex(z=>z.order===l.order),re=X>=0?X+1:1,N=D.length,h=N>1?(X+1)/N*100:100;return e.jsxs("div",{style:{marginBottom:"24px",backgroundColor:"var(--metakyc-surface, var(--metakyc-background, #ffffff))",borderRadius:"0.75rem",border:"1px solid var(--metakyc-border, #e5e7eb)",padding:"1rem 1.5rem",overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",marginBottom:"16px"},children:[e.jsx(nt,{}),e.jsxs(wt,{variant:n.status===1?"info":"success",children:["Step ",re," of ",N]})]}),e.jsxs("div",{style:{position:"relative",height:"4px",borderRadius:"999px",overflow:"hidden",marginBottom:"16px"},children:[e.jsx("div",{style:{position:"absolute",inset:0,backgroundColor:"var(--metakyc-border, #e5e7eb)",opacity:.3}}),e.jsx("div",{style:{position:"absolute",top:0,left:0,bottom:0,backgroundColor:"var(--metakyc-primary, #2563eb)",width:`${h}%`,transition:"width 0.4s ease"}})]}),e.jsx($a,{ref:S,visibleSteps:D,currentVisibleStepIndex:X,getStepFallbackName:O})]})},F=()=>{const D={applicantId:t,onComplete:async()=>{await A()},onBack:l.order>0?w:void 0};switch(l.action){case oe.Questionaries:return e.jsx($r,{...D});case oe.UploadDocument:return e.jsx(Br,{...D});case oe.Overview:return e.jsx(_r,{...D});case oe.IdentitySdk:return e.jsx(Kr,{...D});case oe.RiskScoring:return e.jsx(Hr,{...D});case oe.AdditionalData:case oe.InvestorCategorization:return e.jsx(Wr,{...D});case oe.AppropriatenessTest:return e.jsx(Ur,{...D});case oe.ManualReview:return e.jsx(ft,{kycStatus:n.kycStatus,reviewStatus:n.reviewStatus,workflowResult:n.workflowResult,customMessage:n.customMessage});default:return e.jsx(Z,{children:e.jsxs(ee,{className:"py-12 text-center",children:[e.jsx("div",{className:"mb-4",children:e.jsx(Ee,{})}),e.jsxs("p",{className:"text-gray-600 dark:text-gray-400 mb-2",children:["Processing step: ",l.title||l.name]}),e.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Action type: ",oe[l.action]]})]})})}};return e.jsxs("div",{className:`metakyc-sdk ${s||""}`,children:[q(),F()]})},$a=i.forwardRef(({visibleSteps:t,currentVisibleStepIndex:r,getStepFallbackName:a},s)=>{const n=i.useRef(null),l=i.useRef(null);return i.useImperativeHandle(s,()=>n.current),i.useEffect(()=>{if(l.current&&n.current){const c=n.current,d=l.current,y=d.offsetLeft-c.offsetWidth/2+d.offsetWidth/2;c.scrollTo({left:Math.max(0,y),behavior:"smooth"})}},[r]),e.jsx("div",{ref:n,className:"metakyc-stepper-scroll",style:{display:"flex",alignItems:"center",width:"100%",overflowX:"auto",overflowY:"hidden",scrollbarWidth:"none",msOverflowStyle:"none",WebkitOverflowScrolling:"touch",padding:"4px 0",gap:"0"},children:t.map((c,d)=>{const y=d<r,p=d===r,k=y||p,I=c.displayName||c.name||a(c.action)||`Step ${d+1}`;return e.jsxs(i.Fragment,{children:[e.jsxs("div",{ref:p?l:void 0,style:{display:"flex",alignItems:"center",flexShrink:0},children:[e.jsx("div",{style:{width:"28px",height:"28px",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"12px",fontWeight:600,flexShrink:0,transition:"all 0.2s ease",...k?{backgroundColor:"var(--metakyc-primary, #2563eb)",color:"#ffffff",border:"none"}:{backgroundColor:"transparent",color:"var(--metakyc-text-muted, #9ca3af)",border:"2px solid var(--metakyc-border, #e5e7eb)"}},children:y?e.jsx("svg",{width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:2.5,viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}):d+1}),e.jsx("span",{style:{marginLeft:"6px",fontSize:"13px",whiteSpace:"nowrap",fontWeight:p?600:400,color:p?"var(--metakyc-text-primary, #111827)":y?"var(--metakyc-primary, #2563eb)":"var(--metakyc-text-muted, #9ca3af)",transition:"color 0.2s ease"},children:I})]}),d<t.length-1&&e.jsx("div",{style:{flex:"1 1 0%",minWidth:"16px",height:"2px",margin:"0 8px",borderRadius:"999px",backgroundColor:"var(--metakyc-primary, #2563eb)",opacity:y?1:.25,transition:"opacity 0.2s ease"}})]},c.order)})})});function Ba(t){return Ue.z.object({questionResults:Ue.z.any()}).passthrough()}function _a(t){let r=Ue.z.array(Ue.z.instanceof(File));if(t.isRequired?r=r.min(1,`${t.displayName} is required`):r=r.optional(),t.multipleFile||(r=r.refine(a=>!a||a.length<=1,{message:"Only one file is allowed"})),t.maxEachFileSizeByte>0&&(r=r.refine(a=>!a||a.every(s=>s.size<=t.maxEachFileSizeByte),{message:`File size must not exceed ${Math.round(t.maxEachFileSizeByte/1024/1024)}MB`})),t.allowedTypes){const a=t.allowedTypes.split(",").map(s=>s.trim());r=r.refine(s=>s?s.every(n=>a.some(l=>l.endsWith("/*")?n.type.startsWith(l.slice(0,-2)):n.type===l)):!0,{message:"Invalid file type"})}return r}function Ha(t){const r={};return t.uploadDocumentFiles.forEach(a=>{const s=`file_${a.id}`;r[s]=_a(a)}),Ue.z.object(r)}function Wa(t){return Ue.z.any()}function Ua(t){return Ue.z.string().min(1,"This question is required")}function Ka(t){const r={};return t.appropriatenessQuestions.forEach(a=>{const s=`question_${a.id}`;r[s]=Ua()}),Ue.z.object(r)}const qa=Ue.z.any();exports.ALLOWED_LANGUAGES=ht;exports.ApplicantProgressOnHoldReason=Pt;exports.ApplicantProgressStatus=Te;exports.ApplicantService=Qt;exports.ApplicantStatus=Dt;exports.AppropriatenessQuestionType=Bt;exports.AppropriatenessTestService=Xt;exports.AppropriatenessTestStep=Ur;exports.Badge=wt;exports.BaseInformationService=rr;exports.Button=Q;exports.COMPANY_FIELD_METADATA=Ze;exports.Card=Z;exports.CardContent=ee;exports.CardFooter=fe;exports.CardHeader=he;exports.Checkbox=Fe;exports.CountriesType=We;exports.CreateApplicantForm=Ma;exports.CreateCompanyApplicantForm=za;exports.CriteriaBuiltInType=Ht;exports.DEFAULT_COMPANY_VISIBLE_FIELDS=Ut;exports.DEFAULT_VISIBLE_FIELDS=Kt;exports.DocumentReviewStatus=$t;exports.EndpointBuilder=Yt;exports.ErrorHandler=at;exports.EventEmitter=mr;exports.FIELD_METADATA=Ge;exports.FileType=Ot;exports.FileUpload=Pr;exports.GenderType=lt;exports.Header=nt;exports.HttpClient=Vt;exports.IdentityProviderManager=He;exports.IdentityService=tr;exports.IdentityVerificationProvider=Ae;exports.IdentityVerificationStep=Kr;exports.Input=ye;exports.InvestorCategorizationService=ar;exports.InvestorCategorizationStep=Wr;exports.InvestorCategorizationType=we;exports.InvestorCategoryType=Wt;exports.KycProcessStatus=Mt;exports.KycStatus=Ve;exports.KycStatusDisplay=ft;exports.KycWorkflow=Oa;exports.Logo=qr;exports.MetaKYCContext=bt;exports.MetaKYCError=De;exports.MetaKYCProvider=sa;exports.MultiSelect=Fr;exports.OnfidoProvider=gr;exports.OverviewService=Zt;exports.OverviewStep=_r;exports.PhoneInput=Lr;exports.QuestionnaireService=Gt;exports.QuestionnaireStep=$r;exports.ReviewStatus=Qe;exports.RiskCriteriaType=_t;exports.RiskLevel=Lt;exports.RiskScoringService=er;exports.RiskScoringStep=Hr;exports.SDK_VERSION=kr;exports.SardinAIProvider=hr;exports.SearchableSelect=ze;exports.Select=ut;exports.Spinner=Ee;exports.StepRouter=ur;exports.SumsubProvider=xr;exports.ThemeManager=fr;exports.ThemePreset=Se;exports.ThemeService=dr;exports.UploadDocumentService=Jt;exports.UploadDocumentStep=Br;exports.UserType=zt;exports.ValueDataType=Me;exports.WorkflowOrchestrator=yr;exports.WorkflowResultType=ot;exports.WorkflowState=pr;exports.WorkflowStepAction=oe;exports.appropriatenessTestSchema=qa;exports.clearAllStorage=ca;exports.clearApplicantId=jr;exports.clearWorkflowState=Cr;exports.cn=Ce;exports.corporateTheme=sr;exports.defaultConfig=qt;exports.defaultTheme=je;exports.fileToBase64=br;exports.fintechTheme=nr;exports.formatFileSize=mt;exports.generateAppropriatenessSchema=Ka;exports.generateQuestionnaireSchema=Ba;exports.generateRiskScoringSchema=Wa;exports.generateUploadDocumentSchema=Ha;exports.getAcceptString=oa;exports.getApplicantId=wr;exports.getThemePreset=st;exports.getWorkflowState=la;exports.healthcareTheme=ir;exports.isScriptLoaded=Xr;exports.loadScript=kt;exports.minimalTheme=lr;exports.modernTheme=or;exports.removeScript=Zr;exports.saveApplicantId=vr;exports.saveWorkflowState=Sr;exports.themePresets=cr;exports.useApplicant=vt;exports.useAppropriatenessTest=da;exports.useIdentityVerification=Ar;exports.useKycWorkflow=Nr;exports.useMetaKYC=Re;exports.useOverview=Er;exports.useQuestionnaire=Rr;exports.useRiskScoring=Tr;exports.useUploadDocument=Ir;exports.validateFileSize=na;exports.validateFileType=ia;
125
125
  //# sourceMappingURL=index.cjs.map