@sekyro/elements 0.1.0-rc.12 → 0.1.0-rc.13

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.
Files changed (42) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cdn/chunks/{capture-session-doc-FAMDLRRZ-QPOFTNTG.js → capture-session-doc-GCL2FYQH-X7QTUFGI.js} +1 -1
  3. package/dist/cdn/chunks/{chunk-SDK2YXFV.js → chunk-26HXTRWG.js} +1 -1
  4. package/dist/cdn/chunks/{chunk-XDRH4VWV.js → chunk-3I6AVO6X.js} +1 -1
  5. package/dist/cdn/chunks/chunk-3NOBU7TE.js +1 -0
  6. package/dist/cdn/chunks/chunk-A5SXWFOO.js +1 -0
  7. package/dist/cdn/chunks/{chunk-CVFJQIMW.js → chunk-CK3CQAFP.js} +1 -1
  8. package/dist/cdn/chunks/{chunk-YFJBTK3L.js → chunk-CPVOHNLU.js} +1 -1
  9. package/dist/cdn/chunks/{chunk-LBZCFEU4.js → chunk-CSPTLSJY.js} +2 -2
  10. package/dist/cdn/chunks/{chunk-JI5WT66H.js → chunk-CX52FPYW.js} +1 -1
  11. package/dist/cdn/chunks/chunk-DEGFGNRM.js +3 -0
  12. package/dist/cdn/chunks/{chunk-GPGK6XZM.js → chunk-DKZUKWGP.js} +1 -1
  13. package/dist/cdn/chunks/{chunk-4YBL75VD.js → chunk-F7DKVXQW.js} +1 -1
  14. package/dist/cdn/chunks/chunk-FZXXMIZ4.js +1 -0
  15. package/dist/cdn/chunks/{chunk-UN4V3UNQ.js → chunk-LHEWQFCZ.js} +1 -1
  16. package/dist/cdn/chunks/{chunk-BMUUDLFA.js → chunk-PYUD6W3P.js} +1 -1
  17. package/dist/cdn/chunks/chunk-QTPSRWXY.js +1 -0
  18. package/dist/cdn/chunks/{chunk-VHNWBOKW.js → chunk-SHOVUF5C.js} +1 -1
  19. package/dist/cdn/chunks/chunk-VXXXAUQD.js +1 -0
  20. package/dist/cdn/chunks/{chunk-7JUL7AKT.js → chunk-ZPSZDTDP.js} +1 -1
  21. package/dist/cdn/chunks/{create-document-capture-WFTNVMCE-QOCPJSAU.js → create-document-capture-IMDGCTMM-TBX7G2XG.js} +1 -1
  22. package/dist/cdn/chunks/{detector-scanic-S4PB2RNW-3KSM3MW5.js → detector-scanic-QVQVJI3C-K3ZARXJR.js} +1 -1
  23. package/dist/cdn/chunks/{document-capture-view-GENB535Z-YBRM7NWN.js → document-capture-view-GENB535Z-J72QDPT4.js} +1 -1
  24. package/dist/cdn/chunks/{eid-view-IQRZGEMP-SPGYQDQP.js → eid-view-IQRZGEMP-RHLNP5ZM.js} +1 -1
  25. package/dist/cdn/chunks/{email-otp-view-CL76K5TY-TJMSLYLZ.js → email-otp-view-CL76K5TY-ZSNIDTY3.js} +1 -1
  26. package/dist/cdn/chunks/{flow-views-C3EIMXME-ODOF67JZ.js → flow-views-C3EIMXME-U7PKRKNU.js} +1 -1
  27. package/dist/cdn/chunks/{form-view-MEYCK437-JBO5DNG5.js → form-view-MEYCK437-HDYDY2QI.js} +1 -1
  28. package/dist/cdn/chunks/plan-runner-HBUVNDGH-6DM4PNGI.js +1 -0
  29. package/dist/cdn/chunks/{portrait-capture-view-VTN2VU3E-JH34ISLI.js → portrait-capture-view-VTN2VU3E-WCQNHK3E.js} +1 -1
  30. package/dist/cdn/chunks/{portrait-review-view-JTRGDYNV-C2O6OFYY.js → portrait-review-view-JTRGDYNV-25TZW6WY.js} +1 -1
  31. package/dist/cdn/chunks/{proof-of-address-view-UQOZZXQO-T3QOIQNE.js → proof-of-address-view-UQOZZXQO-DITYLW35.js} +1 -1
  32. package/dist/cdn/define.js +1 -1
  33. package/dist/cdn/index.js +1 -1
  34. package/package.json +2 -2
  35. package/sbom.cdx.json +4 -4
  36. package/dist/cdn/chunks/chunk-2FETDQV5.js +0 -1
  37. package/dist/cdn/chunks/chunk-FVWYONHZ.js +0 -1
  38. package/dist/cdn/chunks/chunk-K4BLQMYZ.js +0 -1
  39. package/dist/cdn/chunks/chunk-Q5BUNNRN.js +0 -3
  40. package/dist/cdn/chunks/chunk-XSGZY4JI.js +0 -1
  41. package/dist/cdn/chunks/chunk-YLH3WX7Y.js +0 -1
  42. package/dist/cdn/chunks/plan-runner-LSQTIO6L-XZJIKXPZ.js +0 -1
@@ -1 +1 @@
1
- "use client";import{a as Z}from"./chunk-SIBJ56BG.js";import{a as W,b as me,c as ue,d as fe,e as he}from"./chunk-UN4V3UNQ.js";import{a as ce}from"./chunk-3DDOCOIB.js";import"./chunk-Q5BUNNRN.js";import"./chunk-AARN2MG7.js";import{K as de,a as te,b as ae,c as ie,w as se,y as le}from"./chunk-JJ3Q52P3.js";import{C as ne}from"./chunk-YLH3WX7Y.js";import"./chunk-GPGK6XZM.js";import"./chunk-4YBL75VD.js";import"./chunk-P7K7ELYZ.js";import{a as c}from"./chunk-5QL6W6FW.js";import"./chunk-6MYG4HWP.js";import"./chunk-JS2IXPNL.js";import{a as d,c as Y}from"./chunk-4FHWXBOB.js";var x=Y(te(),1),$=Y(te(),1),m=Y(ae(),1),i=Y(ae(),1);var we={"form.title":"بضعة أسئلة","form.lead":"تطلب منك {org} الإجابة عن هذه الأسئلة.","form.optional":"اختياري","form.continue":"متابعة","form.sending":"جارٍ إرسال إجاباتك…","form.yes":"نعم","form.no":"لا","form.chooseAny":"اختر كل ما ينطبق","form.choose":"اختر","form.openLink":"يُفتح في علامة تبويب جديدة","form.consents":"موافقتك","form.date.day":"اليوم","form.date.month":"الشهر","form.date.year":"السنة","form.fields.full_name.label":"الاسم الكامل","form.fields.full_name.help":"اسمك واسم عائلتك كما تكتبهما عادةً","form.fields.birth_date.label":"تاريخ الميلاد","form.fields.email.label":"البريد الإلكتروني","form.fields.phone.label":"رقم الهاتف","form.fields.address.label":"العنوان","form.fields.address.help":"مكان سكنك الحالي","form.fields.country.label":"البلد","form.fields.occupation.label":"المهنة","form.address.line1":"الشارع والرقم","form.address.line2":"تفاصيل إضافية للعنوان","form.address.city":"المدينة","form.address.postcode":"الرمز البريدي","form.address.country":"البلد","form.address.addLine":"أضف سطرًا","form.phoneCountry":"رمز البلد","form.errors.summary":"راجع الإجابات المشار إليها أدناه.","form.errors.required":"أجب عن هذا السؤال للمتابعة","form.errors.choiceRequired":"اختر إجابة للمتابعة","form.errors.consentRequired":"حدّد هذا المربع للمتابعة","form.errors.tooLong":"اختصر إجابتك إلى {max} حرفًا أو أقل","form.errors.tooShort":"أدخل {min} أحرف على الأقل","form.errors.email":"أدخل عنوان بريد إلكتروني كاملًا يتضمن @ ونطاقًا","form.errors.phone":"أدخل الرقم دون رمز البلد، بالأرقام فقط","form.errors.date":"أدخل تاريخًا صحيحًا: اليوم والشهر والسنة","form.errors.datePast":"أدخل تاريخًا في الماضي","form.errors.dateFuture":"أدخل تاريخًا في المستقبل","form.errors.dateMin":"أدخل تاريخًا في {date} أو بعده","form.errors.dateMax":"أدخل تاريخًا في {date} أو قبله","form.errors.number":"أدخل عددًا بالأرقام","form.errors.numberInteger":"أدخل عددًا صحيحًا","form.errors.numberDecimals":"استخدم منزلتين عشريتين على الأكثر","form.errors.numberMin":"أدخل {min} أو أكثر","form.errors.numberMax":"أدخل {max} أو أقل","form.errors.choice":"اختر إحدى الإجابات المعروضة","form.errors.cardNumber":"لا تُدخل رقم بطاقة هنا.","form.errors.address":"أدخل الشارع والمدينة والبلد","form.errors.failed":"تعذّر إرسال إجاباتك. تحقّق من اتصالك وحاول مرة أخرى"},U={"form.title":"A few questions","form.lead":"{org} asks you to answer these questions.","form.optional":"optional","form.continue":"Continue","form.sending":"Sending your answers…","form.yes":"Yes","form.no":"No","form.chooseAny":"Choose all that apply","form.choose":"Choose","form.openLink":"Opens in a new tab","form.consents":"Your consent","form.date.day":"Day","form.date.month":"Month","form.date.year":"Year","form.fields.full_name.label":"Full name","form.fields.full_name.help":"Your first and last names, as you usually write them","form.fields.birth_date.label":"Date of birth","form.fields.email.label":"Email address","form.fields.phone.label":"Phone number","form.fields.address.label":"Address","form.fields.address.help":"Where you live now","form.fields.country.label":"Country","form.fields.occupation.label":"Occupation","form.address.line1":"Street and number","form.address.line2":"More address details","form.address.city":"City or town","form.address.postcode":"Postal code","form.address.country":"Country","form.address.addLine":"Add a line","form.phoneCountry":"Country code","form.errors.summary":"Check the answers marked below.","form.errors.required":"Answer this question to continue","form.errors.choiceRequired":"Choose an answer to continue","form.errors.consentRequired":"Tick this box to continue","form.errors.tooLong":"Shorten your answer to {max} characters or fewer","form.errors.tooShort":"Enter at least {min} characters","form.errors.email":"Enter a full email address, with @ and a domain","form.errors.phone":"Enter the number without the country code, digits only","form.errors.date":"Enter a real date: day, month and year","form.errors.datePast":"Enter a date in the past","form.errors.dateFuture":"Enter a date in the future","form.errors.dateMin":"Enter a date on or after {date}","form.errors.dateMax":"Enter a date on or before {date}","form.errors.number":"Enter a number, using digits","form.errors.numberInteger":"Enter a whole number","form.errors.numberDecimals":"Use at most 2 decimals","form.errors.numberMin":"Enter {min} or more","form.errors.numberMax":"Enter {max} or less","form.errors.choice":"Choose one of the answers listed","form.errors.cardNumber":"Do not enter a card number here.","form.errors.address":"Enter the street, the city and the country","form.errors.failed":"We could not send your answers. Check your connection and try again"},Se={"form.title":"Quelques questions","form.lead":"{org} vous demande de répondre à ces questions.","form.optional":"facultatif","form.continue":"Continuer","form.sending":"Envoi de vos réponses…","form.yes":"Oui","form.no":"Non","form.chooseAny":"Choisissez toutes les réponses qui s’appliquent","form.choose":"Choisir","form.openLink":"S’ouvre dans un nouvel onglet","form.consents":"Votre consentement","form.date.day":"Jour","form.date.month":"Mois","form.date.year":"Année","form.fields.full_name.label":"Nom complet","form.fields.full_name.help":"Vos prénoms et nom, comme vous les écrivez d’habitude","form.fields.birth_date.label":"Date de naissance","form.fields.email.label":"Adresse e-mail","form.fields.phone.label":"Numéro de téléphone","form.fields.address.label":"Adresse","form.fields.address.help":"Là où vous habitez aujourd’hui","form.fields.country.label":"Pays","form.fields.occupation.label":"Profession","form.address.line1":"Rue et numéro","form.address.line2":"Complément d’adresse","form.address.city":"Ville","form.address.postcode":"Code postal","form.address.country":"Pays","form.address.addLine":"Ajouter une ligne","form.phoneCountry":"Indicatif du pays","form.errors.summary":"Vérifiez les réponses signalées ci-dessous.","form.errors.required":"Répondez à cette question pour continuer","form.errors.choiceRequired":"Choisissez une réponse pour continuer","form.errors.consentRequired":"Cochez cette case pour continuer","form.errors.tooLong":"Raccourcissez votre réponse à {max} caractères au plus","form.errors.tooShort":"Saisissez au moins {min} caractères","form.errors.email":"Saisissez une adresse e-mail complète, avec @ et un domaine","form.errors.phone":"Saisissez le numéro sans l’indicatif, en chiffres seulement","form.errors.date":"Saisissez une date réelle : jour, mois et année","form.errors.datePast":"Saisissez une date passée","form.errors.dateFuture":"Saisissez une date à venir","form.errors.dateMin":"Saisissez une date à partir du {date}","form.errors.dateMax":"Saisissez une date jusqu’au {date}","form.errors.number":"Saisissez un nombre, en chiffres","form.errors.numberInteger":"Saisissez un nombre entier","form.errors.numberDecimals":"Utilisez au plus 2 décimales","form.errors.numberMin":"Saisissez {min} ou plus","form.errors.numberMax":"Saisissez {max} ou moins","form.errors.choice":"Choisissez une des réponses proposées","form.errors.cardNumber":"N’indiquez pas de numéro de carte ici.","form.errors.address":"Indiquez la rue, la ville et le pays","form.errors.failed":"Nous n’avons pas pu envoyer vos réponses. Vérifiez votre connexion et réessayez"};function V(r){return r.replace(/[٠-٩۰-۹]/g,e=>String((e.charCodeAt(0)&15)%10))}d(V,"B");c(V,"westernDigits");function re(){let r=(0,$.useId)();return{control:`${r}-c`,help:`${r}-h`,error:`${r}-e`}}d(re,"W");c(re,"useFieldIds");function E(r,e,o){return[e?r.help:null,o?r.error:null].filter(n=>n!==null).join(" ")||void 0}d(E,"E");c(E,"describedBy");function G({text:r,lang:e,optional:o}){return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("span",{lang:e?.lang,dir:e?.dir,children:r}),o!==null?(0,m.jsx)("span",{className:"sekyro-form-optional",children:` (${o})`}):null]})}d(G,"j");c(G,"LabelText");function oe({ids:r,help:e,helpLang:o,error:n}){return(0,m.jsxs)(m.Fragment,{children:[e!==void 0?(0,m.jsx)("span",{className:"sekyro-help",id:r.help,lang:o?.lang,dir:o?.dir,children:e}):null,n?(0,m.jsx)("span",{className:"sekyro-help is-danger",id:r.error,role:"alert",children:n}):null]})}d(oe,"Z");c(oe,"FieldNotes");function z({ids:r,label:e,children:o,notes:n}){return(0,m.jsxs)("div",{className:"sekyro-field sekyro-form-q",children:[(0,m.jsx)("label",{className:"sekyro-label",id:`${r.control}-l`,htmlFor:r.control,children:e}),o,n]})}d(z,"P");c(z,"Field");function T({legend:r,children:e,notes:o,invalid:n,describedby:t}){return(0,m.jsxs)("fieldset",{className:`sekyro-form-q sekyro-form-group${n?" is-invalid":""}`,"aria-describedby":t,children:[(0,m.jsx)("legend",{className:"sekyro-label",children:r}),e,o]})}d(T,"z");c(T,"Group");function pe(r){let e={ArrowDown:1,ArrowUp:-1,ArrowRight:1,ArrowLeft:-1}[r.key];if(e===void 0)return;getComputedStyle(r.currentTarget).direction==="rtl"&&(r.key==="ArrowRight"||r.key==="ArrowLeft")&&(e=-e);let o=r.currentTarget.closest("fieldset"),n=o===null?[]:Array.from(o.querySelectorAll('input[type="checkbox"]')),t=n.indexOf(r.currentTarget),a=n[(t+e+n.length)%n.length];a!==void 0&&(r.preventDefault(),a.focus())}d(pe,"Ce");c(pe,"moveInGroup");function J({name:r,type:e,options:o,value:n,onChange:t,required:a,invalid:u,describedby:C}){let q=Array.isArray(n)?n:n===null?[]:[n];return(0,m.jsx)("div",{className:"sekyro-form-choices",children:o.map(h=>{let l=q.includes(h.value);return(0,m.jsxs)("label",{className:"sekyro-form-choice",children:[(0,m.jsx)("input",{type:e,name:r,value:h.value,checked:l,required:e==="radio"?a:void 0,"aria-invalid":u||void 0,"aria-describedby":C,onKeyDown:e==="checkbox"?pe:void 0,onChange:d(()=>{t(e==="radio"?h.value:l?q.filter(f=>f!==h.value):[...q,h.value])},"onChange")}),(0,m.jsx)("span",{lang:h.lang?.lang,dir:h.lang?.dir,children:h.label})]},h.value)})})}d(J,"J");c(J,"ChoiceList");function H(r){let[e,o,n]=[r.day,r.month,r.year].map(t=>V(t).trim());if(!(e===""&&o===""&&n===""))return`${(n??"").padStart(4,"0")}-${(o??"").padStart(2,"0")}-${(e??"").padStart(2,"0")}`}d(H,"X");c(H,"dateValue");function Q(r){let e=typeof r=="string"?/^(\d{4})-(\d{2})-(\d{2})$/.exec(r):null;return e===null?{day:"",month:"",year:""}:{day:String(Number(e[3])),month:String(Number(e[2])),year:e[1]}}d(Q,"ee");c(Q,"dateParts");function ye(r,e,o,n=new Date().getUTCFullYear()){if(e==="")return!1;let t=Number(e);return r==="day"?!(t>=1&&t<=31):r==="month"?!(t>=1&&t<=12):e.length!==4||t<1900||t>(o?n:2100)}d(ye,"be");c(ye,"datePartBad");function X({ids:r,parts:e,onChange:o,labels:n,required:t,invalid:a,birthday:u,onPartBlur:C,onLeave:q}){let h=c(f=>{let v=f.target.dataset.part;v!==void 0&&C(v),f.currentTarget.contains(f.relatedTarget)||q()},"onBlur"),l=c((f,v)=>(0,m.jsxs)("div",{className:`sekyro-form-date__${f}`,children:[(0,m.jsx)("label",{className:"sekyro-help",htmlFor:`${r.control}-${f}`,children:n[f]}),(0,m.jsx)("input",{id:`${r.control}-${f}`,"data-part":f,className:"sekyro-input",type:"text",inputMode:"numeric",dir:"ltr",maxLength:v,autoComplete:u?`bday-${f}`:"off",required:t,"aria-invalid":a||void 0,"aria-describedby":E(r,!1,a),value:e[f],onChange:d(S=>o({...e,[f]:V(S.target.value).replace(/\D/g,"")}),"onChange")})]}),"cell");return(0,m.jsxs)("div",{className:"sekyro-form-date",onBlur:h,children:[l("day",2),l("month",2),l("year",4)]})}d(X,"re");c(X,"DateInputs");function be(r){return(0,$.useMemo)(()=>{let e=[];for(let n=65;n<=90;n++)for(let t=65;t<=90;t++){let a=String.fromCharCode(n,t);W(a)!==void 0&&a!=="AC"&&a!=="TA"&&e.push(a)}let o=new Intl.Collator(r);return e.map(n=>({code:n,name:Z(n,r)})).sort((n,t)=>o.compare(n.name,t.name))},[r])}d(be,"Fe");c(be,"useCountries");function ee({id:r,labelId:e,value:o,onChange:n,locale:t,placeholder:a,searchLabel:u,searchPlaceholder:C,noMatch:q,invalid:h,describedby:l}){let f=be(t),[v,S]=(0,$.useState)(!1),I=(0,$.useRef)(null),P=(0,$.useRef)(null),p=(0,$.useId)(),A=`${r}-v`,L=f.find(b=>b.code===o),D=c(()=>{S(!1),requestAnimationFrame(()=>I.current?.focus())},"close");return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("button",{ref:I,id:r,type:"button",className:"sekyro-input sekyro-form-country","aria-labelledby":`${e} ${A}`,"aria-expanded":v,"aria-controls":v?p:void 0,"aria-invalid":h||void 0,"aria-describedby":l,onClick:d(()=>{S(b=>!b),v||requestAnimationFrame(()=>P.current?.focus())},"onClick"),children:L!==void 0?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("span",{className:"sekyro-row-btn__flag","aria-hidden":"true",children:ue(L.code)}),(0,m.jsx)("span",{className:"sekyro-form-country__name",id:A,children:L.name})]}):(0,m.jsx)("span",{className:"sekyro-form-country__name is-empty",id:A,children:a})}),v?(0,m.jsx)("div",{id:p,className:"sekyro-form-country__list",onKeyDown:d(b=>{b.key==="Escape"&&(b.preventDefault(),D())},"onKeyDown"),children:(0,m.jsx)(me,{countries:f,label:(0,m.jsx)("span",{className:"sekyro-visually-hidden",children:u}),searchPlaceholder:C,noMatch:q,selected:o,searchRef:P,scroll:!0,onPick:d(b=>{n(b),D()},"onPick")})}):null]})}d(ee,"oe");c(ee,"CountryField");var Ae={en:U,fr:Se,ar:we,es:U,pt:U,de:U};function ge(r){let e=r.strings,o=Ae[r.locale];return(n,t)=>ce(e[n]??o[n]??"",t)}d(ge,"De");c(ge,"formCopy");var Me=new Set(["single_choice","multiple_choice","yes_no"]),$e=c(r=>r.kind==="field"?r.field==="country":Me.has(r.type),"isChoice");function ve(r,e,o){if(r.kind==="field")switch(r.field){case"birth_date":return Q(e);case"phone":return typeof e=="string"?e:"";case"address":{let n=typeof e=="object"&&e!==null&&!Array.isArray(e)?e:{};return{line1:n.lines?.[0]??"",line2:n.lines?.slice(1).join(", ")??"",city:n.city??"",postcode:n.postcode??"",country:n.country??o}}default:return typeof e=="string"?e:""}switch(r.type){case"multiple_choice":return Array.isArray(e)?e:[];case"yes_no":return typeof e=="boolean"?e:null;case"single_choice":return typeof e=="string"?e:null;case"date":return Q(e);case"number":return typeof e=="number"?String(e):"";default:return typeof e=="string"?e:""}}d(ve,"Ae");c(ve,"draftOf");function ke(r,e){if(r.kind==="field")switch(r.field){case"birth_date":return H(e);case"phone":return e||void 0;case"address":{let o=e,n=[o.line1,o.line2].map(t=>t.trim()).filter(t=>t!=="");return n.length===0&&o.city.trim()===""&&o.postcode.trim()===""?void 0:{country:o.country,city:o.city.trim(),lines:n,...o.postcode.trim()!==""?{postcode:o.postcode.trim()}:{}}}case"email":return e.trim().toLowerCase()||void 0;default:return e.trim()||void 0}switch(r.type){case"multiple_choice":return e.length>0?e:void 0;case"yes_no":return typeof e=="boolean"?e:void 0;case"single_choice":return typeof e=="string"?e:void 0;case"date":return H(e);case"number":{let o=V(e).replace(/[\s  ]/g,"").replace(/[,٫]/g,".");if(o==="")return;let n=Number(o);return Number.isFinite(n)&&/^-?\d+(\.\d+)?$/.test(o)?n:Number.NaN}default:return e.trim()||void 0}}d(ke,"Ie");c(ke,"answerOf");function Ce(r,e,o,n){let t=c(u=>{try{return new Intl.DateTimeFormat(n,{dateStyle:"long",timeZone:"UTC"}).format(new Date(`${String(u)}T00:00:00Z`))}catch{return String(u)}},"date"),a=r.params??{};switch(r.code){case"required":return o(e!==void 0&&$e(e)?"form.errors.choiceRequired":"form.errors.required");case"consent_required":return o("form.errors.consentRequired");case"too_long":return o("form.errors.tooLong",{max:Number(a.max??0)});case"too_short":return o("form.errors.tooShort",{min:Number(a.min??0)});case"email_invalid":return o("form.errors.email");case"phone_invalid":return o("form.errors.phone");case"date_invalid":return o("form.errors.date");case"date_not_past":return o("form.errors.datePast");case"date_not_future":return o("form.errors.dateFuture");case"date_too_early":return o("form.errors.dateMin",{date:t(a.date)});case"date_too_late":return o("form.errors.dateMax",{date:t(a.date)});case"number_invalid":return o("form.errors.number");case"number_not_integer":return o("form.errors.numberInteger");case"number_decimals":return o("form.errors.numberDecimals");case"number_too_small":return o("form.errors.numberMin",{min:new Intl.NumberFormat(n).format(Number(a.min??0))});case"number_too_large":return o("form.errors.numberMax",{max:new Intl.NumberFormat(n).format(Number(a.max??0))});case"address_invalid":return o("form.errors.address");case"card_number":return o("form.errors.cardNumber");default:return o("form.errors.choice")}}d(Ce,"Me");c(Ce,"issueText");var O={full_name:200,occupation:120,email:254,short_text:120,long_text:1e3};function Le({step:r,i18n:e,onError:o}){let n=ge(e),{form:t}=r,a={lang:t.locale,dir:r.dir},u=typeof t.prefill?.country=="string"?t.prefill.country:"",[C,q]=(0,x.useState)(()=>Object.fromEntries(t.questions.map(s=>[s.id,ve(s,t.prefill?.[s.id],u)]))),[h,l]=(0,x.useState)({}),[f,v]=(0,x.useState)([]),[S,I]=(0,x.useState)(!1),[P,p]=(0,x.useState)(!1),[A,L]=(0,x.useState)(0),D=(0,x.useRef)(null),b=(0,x.useId)();(0,x.useEffect)(()=>{A!==0&&D.current?.querySelector('[aria-invalid="true"]')?.focus()},[A]);let N=c(s=>{let k=f.find(g=>g.id===s);return k===void 0?null:Ce(k,t.questions.find(g=>g.id===s),n,e.locale)},"errorOf"),M=c((s,k)=>{q(g=>({...g,[s]:k})),v(g=>g.filter(w=>w.id!==s))},"set"),F=c(()=>{let s={};for(let k of t.questions){let g=ke(k,C[k.id]??null);g!==void 0&&(s[k.id]=g)}return{answers:s,consents:Object.fromEntries(t.consents.map(k=>[k.id,h[k.id]===!0]))}},"input"),j=c(s=>{let k=r.validate(F()).filter(g=>g.id===s&&g.code!=="required");v(g=>[...g.filter(w=>w.id!==s),...k])},"checkOne"),y=c(s=>{if(s.preventDefault(),S)return;let k=F(),g=r.validate(k);if(g.length>0){v(g),L(w=>w+1);return}I(!0),p(!1),r.submit(k).catch(w=>{o?.(w);let R=(w instanceof ne||w?.name==="FormAnswersError"?w.issues:null)?.filter(B=>t.questions.some(K=>K.id===B.id)||t.consents.some(K=>K.id===B.id))??[];R.length>0?(v(R),L(B=>B+1)):p(!0)}).finally(()=>I(!1))},"onSubmit"),_=c(s=>s?null:n("form.optional"),"optional");return(0,i.jsxs)("form",{ref:D,className:"sekyro-step sekyro-form","aria-labelledby":b,onSubmit:y,noValidate:!0,"data-testid":"sekyro-form-step",children:[(0,i.jsx)(se,{id:b,title:t.title??n("form.title"),lead:t.intro??n("form.lead",{org:r.context.orgName}),lang:{...t.title!==void 0?{title:t.locale}:{},...t.intro!==void 0?{lead:t.locale}:{},dir:r.dir}}),P?(0,i.jsx)(de,{tone:"danger",children:(0,i.jsx)("span",{children:n("form.errors.failed")})}):null,(0,i.jsx)("div",{className:"sekyro-form-questions",children:t.questions.map(s=>(0,i.jsx)(qe,{q:s,draft:C[s.id]??null,onChange:d(k=>M(s.id,k),"onChange"),error:N(s.id),optional:_(s.required),c:n,locale:e.locale,client:a,fallbackCountry:u,onCheck:d(()=>j(s.id),"onCheck")},s.id))}),t.consents.length>0?(0,i.jsxs)("fieldset",{className:"sekyro-form-q sekyro-form-group sekyro-form-consents",children:[(0,i.jsx)("legend",{className:"sekyro-label",children:n("form.consents")}),t.consents.map(s=>(0,i.jsx)(_e,{id:s.id,text:s.text,link:s.link,required:s.required,checked:h[s.id]===!0,onChange:d(k=>{l(g=>({...g,[s.id]:k})),v(g=>g.filter(w=>w.id!==s.id))},"onChange"),error:N(s.id),optional:_(s.required),openLink:n("form.openLink"),client:a},s.id))]}):null,(0,i.jsxs)(le,{children:[(0,i.jsx)(ie,{type:"submit",full:!0,disabled:S,"aria-busy":S||void 0,"data-testid":"sekyro-form-continue",children:n(S?"form.sending":"form.continue")}),(0,i.jsx)("span",{className:"sekyro-visually-hidden",role:"status","aria-live":"polite",children:S?n("form.sending"):""})]})]})}d(Le,"ur");c(Le,"FormView");function _e({id:r,text:e,link:o,required:n,checked:t,onChange:a,error:u,optional:C,openLink:q,client:h}){let l=re();return(0,i.jsxs)("div",{className:"sekyro-form-consent","data-consent":r,children:[(0,i.jsxs)("div",{className:"sekyro-form-choice sekyro-form-consent__row",children:[(0,i.jsx)("input",{id:l.control,type:"checkbox",checked:t,required:n,"aria-invalid":u!==null||void 0,"aria-describedby":E(l,!1,u!==null),onChange:d(f=>a(f.target.checked),"onChange")}),(0,i.jsxs)("span",{className:"sekyro-form-consent__text",children:[(0,i.jsx)("label",{htmlFor:l.control,children:(0,i.jsx)(G,{text:e,lang:h,optional:C})}),o!==void 0?(0,i.jsxs)("a",{className:"sekyro-link sekyro-form-consent__link",href:o.url,target:"_blank",rel:"noopener noreferrer",lang:h.lang,dir:h.dir,children:[o.label,(0,i.jsxs)("span",{className:"sekyro-visually-hidden",children:[" (",q,")"]})]}):null]})]}),(0,i.jsx)(oe,{ids:l,error:u})]})}d(_e,"Ee");c(_e,"Consent");function qe({q:r,draft:e,onChange:o,error:n,optional:t,c:a,locale:u,client:C,fallbackCountry:q,onCheck:h}){let l=re(),[f,v]=(0,x.useState)(()=>new Set),S=r.kind==="field"&&r.field==="birth_date",I=(S||r.kind==="custom"&&r.type==="date")&&[...f].some(y=>ye(y,V(e[y]??""),S)),P=n??(I?a("form.errors.date"):null),p=P!==null,A=r.kind==="custom"?r:null,L=A!==null?A.help:r.kind==="field"&&(r.field==="full_name"||r.field==="address")?a(`form.fields.${r.field}.help`):void 0,D=A!==null?C:void 0,b=A!==null?(0,i.jsx)(G,{text:A.label,lang:C,optional:t}):(0,i.jsx)(G,{text:a(`form.fields.${r.kind==="field"?r.field:""}.label`),optional:t}),N=(0,i.jsx)(oe,{ids:l,help:L,helpLang:D,error:P}),M=E(l,L!==void 0,p),F=c(y=>y.long===!0?(0,i.jsx)("textarea",{id:l.control,className:"sekyro-input sekyro-form-textarea",rows:4,maxLength:y.max,required:r.required,"aria-invalid":p||void 0,"aria-describedby":M,value:e,onChange:d(_=>o(_.target.value),"onChange")}):(0,i.jsx)("input",{id:l.control,className:"sekyro-input",type:y.type??"text",inputMode:y.inputMode,autoComplete:y.autoComplete??"off",dir:y.dir,maxLength:y.max,required:r.required,"aria-invalid":p||void 0,"aria-describedby":M,value:e,onChange:d(_=>o(_.target.value),"onChange")}),"text");if(r.kind==="field")switch(r.field){case"full_name":return(0,i.jsx)(z,{ids:l,label:b,notes:N,children:F({autoComplete:"name",max:O.full_name})});case"occupation":return(0,i.jsx)(z,{ids:l,label:b,notes:N,children:F({autoComplete:"organization-title",max:O.occupation})});case"email":return(0,i.jsx)(z,{ids:l,label:b,notes:N,children:F({type:"email",inputMode:"email",autoComplete:"email",dir:"ltr",max:O.email})});case"country":return(0,i.jsx)(z,{ids:l,label:b,notes:N,children:(0,i.jsx)(ee,{id:l.control,labelId:`${l.control}-l`,value:e??"",onChange:o,locale:u,placeholder:a("form.choose"),searchLabel:a("doc.countrySearch"),searchPlaceholder:a("doc.countrySearch"),noMatch:a("doc.noCountryMatch"),invalid:p,describedby:M})});case"phone":return(0,i.jsx)(z,{ids:l,label:b,notes:N,children:(0,i.jsx)(Ne,{id:l.control,value:e,onChange:o,locale:u,c:a,fallbackCountry:q,required:r.required,invalid:p,describedby:M})});case"birth_date":return(0,i.jsx)(T,{legend:b,notes:N,invalid:p,describedby:M,children:(0,i.jsx)(X,{ids:l,parts:e,onChange:o,labels:{day:a("form.date.day"),month:a("form.date.month"),year:a("form.date.year")},required:r.required,invalid:p,birthday:!0,onPartBlur:d(y=>v(_=>new Set(_).add(y)),"onPartBlur"),onLeave:h})});case"address":{let y=e,_=c((s,k,g,w)=>(0,i.jsxs)("div",{className:"sekyro-field",children:[(0,i.jsx)("label",{className:"sekyro-help",id:`${l.control}-${s}-l`,htmlFor:`${l.control}-${s}`,children:a(k)}),s==="country"?(0,i.jsx)(ee,{id:`${l.control}-${s}`,labelId:`${l.control}-${s}-l`,value:y.country,onChange:d(R=>o({...y,country:R}),"onChange"),locale:u,placeholder:a("form.choose"),searchLabel:a("doc.countrySearch"),searchPlaceholder:a("doc.countrySearch"),noMatch:a("doc.noCountryMatch"),invalid:p,describedby:E(l,!1,p)}):(0,i.jsx)("input",{id:`${l.control}-${s}`,className:"sekyro-input",type:"text",autoComplete:g,maxLength:w,required:r.required&&s!=="line2"&&s!=="postcode","aria-invalid":p||void 0,"aria-describedby":E(l,!1,p),value:y[s],onChange:d(R=>o({...y,[s]:R.target.value}),"onChange")})]}),"part");return(0,i.jsx)(T,{legend:b,notes:N,invalid:p,describedby:M,children:(0,i.jsxs)("div",{className:"sekyro-form-address",children:[_("line1","form.address.line1","address-line1",120),_("line2","form.address.line2","address-line2",120),_("city","form.address.city","address-level2",80),_("postcode","form.address.postcode","postal-code",16),_("country","form.address.country","country",2)]})})}default:return null}let j=r;switch(j.type){case"short_text":return(0,i.jsx)(z,{ids:l,label:b,notes:N,children:F({max:O.short_text})});case"long_text":return(0,i.jsx)(z,{ids:l,label:b,notes:N,children:F({max:O.long_text,long:!0})});case"number":return(0,i.jsx)(z,{ids:l,label:b,notes:N,children:F({inputMode:"decimal",dir:"ltr",max:20})});case"date":return(0,i.jsx)(T,{legend:b,notes:N,invalid:p,describedby:M,children:(0,i.jsx)(X,{ids:l,parts:e,onChange:o,labels:{day:a("form.date.day"),month:a("form.date.month"),year:a("form.date.year")},required:r.required,invalid:p,birthday:!1,onPartBlur:d(y=>v(_=>new Set(_).add(y)),"onPartBlur"),onLeave:h})});case"yes_no":return(0,i.jsx)(T,{legend:b,notes:N,invalid:p,describedby:M,children:(0,i.jsx)(J,{name:l.control,type:"radio",options:[{value:"yes",label:a("form.yes")},{value:"no",label:a("form.no")}],value:e===!0?"yes":e===!1?"no":null,onChange:d(y=>o(y==="yes"),"onChange"),required:r.required,invalid:p,describedby:E(l,!1,p)})});case"single_choice":case"multiple_choice":{let y=j.type==="multiple_choice";return(0,i.jsx)(T,{legend:b,notes:(0,i.jsxs)(i.Fragment,{children:[y?(0,i.jsx)("span",{className:"sekyro-help",children:a("form.chooseAny")}):null,N]}),invalid:p,describedby:M,children:(0,i.jsx)(J,{name:l.control,type:y?"checkbox":"radio",options:(j.choices??[]).map(_=>({value:_.value,label:_.label,lang:C})),value:e,onChange:o,required:r.required,invalid:p,describedby:E(l,!1,p)})})}default:return null}}d(qe,"qe");c(qe,"Question");function xe(r,e){let o=[];for(let a=65;a<=90;a++)for(let u=65;u<=90;u++){let C=String.fromCharCode(a,u),q=W(C);q!==void 0&&C!=="AC"&&C!=="TA"&&o.push({code:C,dial:`+${q}`})}let n=new Intl.Collator(e),t=new Map(o.map(a=>[a.code,Z(a.code,e)]));return o.sort((a,u)=>a.code===r?-1:u.code===r?1:n.compare(t.get(a.code)??"",t.get(u.code)??"")),o}d(xe,"Te");c(xe,"phoneCountries");function Ne({id:r,value:e,onChange:o,locale:n,c:t,fallbackCountry:a,required:u,invalid:C,describedby:q}){let h=(0,x.useMemo)(()=>xe(a||"MR",n),[a,n]),[l]=(0,x.useState)(()=>e||(h[0]?.dial??"")),f=fe({countries:h,international:!1,closed:!1,defaultPhone:l}),v=f.empty?"":f.typed??f.phone;return(0,x.useEffect)(()=>{v!==e&&o(v)},[v]),(0,i.jsx)(he,{field:f,id:r,locale:n,t,required:u,invalid:C,describedby:q,compact:!0})}d(Ne,"Re");c(Ne,"FormPhone");export{Le as FormView,ge as formCopy};
1
+ "use client";import{a as Z}from"./chunk-SIBJ56BG.js";import{a as W,b as me,c as ue,d as fe,e as he}from"./chunk-LHEWQFCZ.js";import{a as ce}from"./chunk-3DDOCOIB.js";import"./chunk-DEGFGNRM.js";import"./chunk-AARN2MG7.js";import{K as de,a as te,b as ae,c as ie,w as se,y as le}from"./chunk-JJ3Q52P3.js";import{C as ne}from"./chunk-A5SXWFOO.js";import"./chunk-DKZUKWGP.js";import"./chunk-F7DKVXQW.js";import"./chunk-P7K7ELYZ.js";import{a as c}from"./chunk-5QL6W6FW.js";import"./chunk-6MYG4HWP.js";import"./chunk-JS2IXPNL.js";import{a as d,c as Y}from"./chunk-4FHWXBOB.js";var x=Y(te(),1),$=Y(te(),1),m=Y(ae(),1),i=Y(ae(),1);var we={"form.title":"بضعة أسئلة","form.lead":"تطلب منك {org} الإجابة عن هذه الأسئلة.","form.optional":"اختياري","form.continue":"متابعة","form.sending":"جارٍ إرسال إجاباتك…","form.yes":"نعم","form.no":"لا","form.chooseAny":"اختر كل ما ينطبق","form.choose":"اختر","form.openLink":"يُفتح في علامة تبويب جديدة","form.consents":"موافقتك","form.date.day":"اليوم","form.date.month":"الشهر","form.date.year":"السنة","form.fields.full_name.label":"الاسم الكامل","form.fields.full_name.help":"اسمك واسم عائلتك كما تكتبهما عادةً","form.fields.birth_date.label":"تاريخ الميلاد","form.fields.email.label":"البريد الإلكتروني","form.fields.phone.label":"رقم الهاتف","form.fields.address.label":"العنوان","form.fields.address.help":"مكان سكنك الحالي","form.fields.country.label":"البلد","form.fields.occupation.label":"المهنة","form.address.line1":"الشارع والرقم","form.address.line2":"تفاصيل إضافية للعنوان","form.address.city":"المدينة","form.address.postcode":"الرمز البريدي","form.address.country":"البلد","form.address.addLine":"أضف سطرًا","form.phoneCountry":"رمز البلد","form.errors.summary":"راجع الإجابات المشار إليها أدناه.","form.errors.required":"أجب عن هذا السؤال للمتابعة","form.errors.choiceRequired":"اختر إجابة للمتابعة","form.errors.consentRequired":"حدّد هذا المربع للمتابعة","form.errors.tooLong":"اختصر إجابتك إلى {max} حرفًا أو أقل","form.errors.tooShort":"أدخل {min} أحرف على الأقل","form.errors.email":"أدخل عنوان بريد إلكتروني كاملًا يتضمن @ ونطاقًا","form.errors.phone":"أدخل الرقم دون رمز البلد، بالأرقام فقط","form.errors.date":"أدخل تاريخًا صحيحًا: اليوم والشهر والسنة","form.errors.datePast":"أدخل تاريخًا في الماضي","form.errors.dateFuture":"أدخل تاريخًا في المستقبل","form.errors.dateMin":"أدخل تاريخًا في {date} أو بعده","form.errors.dateMax":"أدخل تاريخًا في {date} أو قبله","form.errors.number":"أدخل عددًا بالأرقام","form.errors.numberInteger":"أدخل عددًا صحيحًا","form.errors.numberDecimals":"استخدم منزلتين عشريتين على الأكثر","form.errors.numberMin":"أدخل {min} أو أكثر","form.errors.numberMax":"أدخل {max} أو أقل","form.errors.choice":"اختر إحدى الإجابات المعروضة","form.errors.cardNumber":"لا تُدخل رقم بطاقة هنا.","form.errors.address":"أدخل الشارع والمدينة والبلد","form.errors.failed":"تعذّر إرسال إجاباتك. تحقّق من اتصالك وحاول مرة أخرى"},U={"form.title":"A few questions","form.lead":"{org} asks you to answer these questions.","form.optional":"optional","form.continue":"Continue","form.sending":"Sending your answers…","form.yes":"Yes","form.no":"No","form.chooseAny":"Choose all that apply","form.choose":"Choose","form.openLink":"Opens in a new tab","form.consents":"Your consent","form.date.day":"Day","form.date.month":"Month","form.date.year":"Year","form.fields.full_name.label":"Full name","form.fields.full_name.help":"Your first and last names, as you usually write them","form.fields.birth_date.label":"Date of birth","form.fields.email.label":"Email address","form.fields.phone.label":"Phone number","form.fields.address.label":"Address","form.fields.address.help":"Where you live now","form.fields.country.label":"Country","form.fields.occupation.label":"Occupation","form.address.line1":"Street and number","form.address.line2":"More address details","form.address.city":"City or town","form.address.postcode":"Postal code","form.address.country":"Country","form.address.addLine":"Add a line","form.phoneCountry":"Country code","form.errors.summary":"Check the answers marked below.","form.errors.required":"Answer this question to continue","form.errors.choiceRequired":"Choose an answer to continue","form.errors.consentRequired":"Tick this box to continue","form.errors.tooLong":"Shorten your answer to {max} characters or fewer","form.errors.tooShort":"Enter at least {min} characters","form.errors.email":"Enter a full email address, with @ and a domain","form.errors.phone":"Enter the number without the country code, digits only","form.errors.date":"Enter a real date: day, month and year","form.errors.datePast":"Enter a date in the past","form.errors.dateFuture":"Enter a date in the future","form.errors.dateMin":"Enter a date on or after {date}","form.errors.dateMax":"Enter a date on or before {date}","form.errors.number":"Enter a number, using digits","form.errors.numberInteger":"Enter a whole number","form.errors.numberDecimals":"Use at most 2 decimals","form.errors.numberMin":"Enter {min} or more","form.errors.numberMax":"Enter {max} or less","form.errors.choice":"Choose one of the answers listed","form.errors.cardNumber":"Do not enter a card number here.","form.errors.address":"Enter the street, the city and the country","form.errors.failed":"We could not send your answers. Check your connection and try again"},Se={"form.title":"Quelques questions","form.lead":"{org} vous demande de répondre à ces questions.","form.optional":"facultatif","form.continue":"Continuer","form.sending":"Envoi de vos réponses…","form.yes":"Oui","form.no":"Non","form.chooseAny":"Choisissez toutes les réponses qui s’appliquent","form.choose":"Choisir","form.openLink":"S’ouvre dans un nouvel onglet","form.consents":"Votre consentement","form.date.day":"Jour","form.date.month":"Mois","form.date.year":"Année","form.fields.full_name.label":"Nom complet","form.fields.full_name.help":"Vos prénoms et nom, comme vous les écrivez d’habitude","form.fields.birth_date.label":"Date de naissance","form.fields.email.label":"Adresse e-mail","form.fields.phone.label":"Numéro de téléphone","form.fields.address.label":"Adresse","form.fields.address.help":"Là où vous habitez aujourd’hui","form.fields.country.label":"Pays","form.fields.occupation.label":"Profession","form.address.line1":"Rue et numéro","form.address.line2":"Complément d’adresse","form.address.city":"Ville","form.address.postcode":"Code postal","form.address.country":"Pays","form.address.addLine":"Ajouter une ligne","form.phoneCountry":"Indicatif du pays","form.errors.summary":"Vérifiez les réponses signalées ci-dessous.","form.errors.required":"Répondez à cette question pour continuer","form.errors.choiceRequired":"Choisissez une réponse pour continuer","form.errors.consentRequired":"Cochez cette case pour continuer","form.errors.tooLong":"Raccourcissez votre réponse à {max} caractères au plus","form.errors.tooShort":"Saisissez au moins {min} caractères","form.errors.email":"Saisissez une adresse e-mail complète, avec @ et un domaine","form.errors.phone":"Saisissez le numéro sans l’indicatif, en chiffres seulement","form.errors.date":"Saisissez une date réelle : jour, mois et année","form.errors.datePast":"Saisissez une date passée","form.errors.dateFuture":"Saisissez une date à venir","form.errors.dateMin":"Saisissez une date à partir du {date}","form.errors.dateMax":"Saisissez une date jusqu’au {date}","form.errors.number":"Saisissez un nombre, en chiffres","form.errors.numberInteger":"Saisissez un nombre entier","form.errors.numberDecimals":"Utilisez au plus 2 décimales","form.errors.numberMin":"Saisissez {min} ou plus","form.errors.numberMax":"Saisissez {max} ou moins","form.errors.choice":"Choisissez une des réponses proposées","form.errors.cardNumber":"N’indiquez pas de numéro de carte ici.","form.errors.address":"Indiquez la rue, la ville et le pays","form.errors.failed":"Nous n’avons pas pu envoyer vos réponses. Vérifiez votre connexion et réessayez"};function V(r){return r.replace(/[٠-٩۰-۹]/g,e=>String((e.charCodeAt(0)&15)%10))}d(V,"B");c(V,"westernDigits");function re(){let r=(0,$.useId)();return{control:`${r}-c`,help:`${r}-h`,error:`${r}-e`}}d(re,"W");c(re,"useFieldIds");function E(r,e,o){return[e?r.help:null,o?r.error:null].filter(n=>n!==null).join(" ")||void 0}d(E,"E");c(E,"describedBy");function G({text:r,lang:e,optional:o}){return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("span",{lang:e?.lang,dir:e?.dir,children:r}),o!==null?(0,m.jsx)("span",{className:"sekyro-form-optional",children:` (${o})`}):null]})}d(G,"j");c(G,"LabelText");function oe({ids:r,help:e,helpLang:o,error:n}){return(0,m.jsxs)(m.Fragment,{children:[e!==void 0?(0,m.jsx)("span",{className:"sekyro-help",id:r.help,lang:o?.lang,dir:o?.dir,children:e}):null,n?(0,m.jsx)("span",{className:"sekyro-help is-danger",id:r.error,role:"alert",children:n}):null]})}d(oe,"Z");c(oe,"FieldNotes");function z({ids:r,label:e,children:o,notes:n}){return(0,m.jsxs)("div",{className:"sekyro-field sekyro-form-q",children:[(0,m.jsx)("label",{className:"sekyro-label",id:`${r.control}-l`,htmlFor:r.control,children:e}),o,n]})}d(z,"P");c(z,"Field");function T({legend:r,children:e,notes:o,invalid:n,describedby:t}){return(0,m.jsxs)("fieldset",{className:`sekyro-form-q sekyro-form-group${n?" is-invalid":""}`,"aria-describedby":t,children:[(0,m.jsx)("legend",{className:"sekyro-label",children:r}),e,o]})}d(T,"z");c(T,"Group");function pe(r){let e={ArrowDown:1,ArrowUp:-1,ArrowRight:1,ArrowLeft:-1}[r.key];if(e===void 0)return;getComputedStyle(r.currentTarget).direction==="rtl"&&(r.key==="ArrowRight"||r.key==="ArrowLeft")&&(e=-e);let o=r.currentTarget.closest("fieldset"),n=o===null?[]:Array.from(o.querySelectorAll('input[type="checkbox"]')),t=n.indexOf(r.currentTarget),a=n[(t+e+n.length)%n.length];a!==void 0&&(r.preventDefault(),a.focus())}d(pe,"Ce");c(pe,"moveInGroup");function J({name:r,type:e,options:o,value:n,onChange:t,required:a,invalid:u,describedby:C}){let q=Array.isArray(n)?n:n===null?[]:[n];return(0,m.jsx)("div",{className:"sekyro-form-choices",children:o.map(h=>{let l=q.includes(h.value);return(0,m.jsxs)("label",{className:"sekyro-form-choice",children:[(0,m.jsx)("input",{type:e,name:r,value:h.value,checked:l,required:e==="radio"?a:void 0,"aria-invalid":u||void 0,"aria-describedby":C,onKeyDown:e==="checkbox"?pe:void 0,onChange:d(()=>{t(e==="radio"?h.value:l?q.filter(f=>f!==h.value):[...q,h.value])},"onChange")}),(0,m.jsx)("span",{lang:h.lang?.lang,dir:h.lang?.dir,children:h.label})]},h.value)})})}d(J,"J");c(J,"ChoiceList");function H(r){let[e,o,n]=[r.day,r.month,r.year].map(t=>V(t).trim());if(!(e===""&&o===""&&n===""))return`${(n??"").padStart(4,"0")}-${(o??"").padStart(2,"0")}-${(e??"").padStart(2,"0")}`}d(H,"X");c(H,"dateValue");function Q(r){let e=typeof r=="string"?/^(\d{4})-(\d{2})-(\d{2})$/.exec(r):null;return e===null?{day:"",month:"",year:""}:{day:String(Number(e[3])),month:String(Number(e[2])),year:e[1]}}d(Q,"ee");c(Q,"dateParts");function ye(r,e,o,n=new Date().getUTCFullYear()){if(e==="")return!1;let t=Number(e);return r==="day"?!(t>=1&&t<=31):r==="month"?!(t>=1&&t<=12):e.length!==4||t<1900||t>(o?n:2100)}d(ye,"be");c(ye,"datePartBad");function X({ids:r,parts:e,onChange:o,labels:n,required:t,invalid:a,birthday:u,onPartBlur:C,onLeave:q}){let h=c(f=>{let v=f.target.dataset.part;v!==void 0&&C(v),f.currentTarget.contains(f.relatedTarget)||q()},"onBlur"),l=c((f,v)=>(0,m.jsxs)("div",{className:`sekyro-form-date__${f}`,children:[(0,m.jsx)("label",{className:"sekyro-help",htmlFor:`${r.control}-${f}`,children:n[f]}),(0,m.jsx)("input",{id:`${r.control}-${f}`,"data-part":f,className:"sekyro-input",type:"text",inputMode:"numeric",dir:"ltr",maxLength:v,autoComplete:u?`bday-${f}`:"off",required:t,"aria-invalid":a||void 0,"aria-describedby":E(r,!1,a),value:e[f],onChange:d(S=>o({...e,[f]:V(S.target.value).replace(/\D/g,"")}),"onChange")})]}),"cell");return(0,m.jsxs)("div",{className:"sekyro-form-date",onBlur:h,children:[l("day",2),l("month",2),l("year",4)]})}d(X,"re");c(X,"DateInputs");function be(r){return(0,$.useMemo)(()=>{let e=[];for(let n=65;n<=90;n++)for(let t=65;t<=90;t++){let a=String.fromCharCode(n,t);W(a)!==void 0&&a!=="AC"&&a!=="TA"&&e.push(a)}let o=new Intl.Collator(r);return e.map(n=>({code:n,name:Z(n,r)})).sort((n,t)=>o.compare(n.name,t.name))},[r])}d(be,"Fe");c(be,"useCountries");function ee({id:r,labelId:e,value:o,onChange:n,locale:t,placeholder:a,searchLabel:u,searchPlaceholder:C,noMatch:q,invalid:h,describedby:l}){let f=be(t),[v,S]=(0,$.useState)(!1),I=(0,$.useRef)(null),P=(0,$.useRef)(null),p=(0,$.useId)(),A=`${r}-v`,L=f.find(b=>b.code===o),D=c(()=>{S(!1),requestAnimationFrame(()=>I.current?.focus())},"close");return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("button",{ref:I,id:r,type:"button",className:"sekyro-input sekyro-form-country","aria-labelledby":`${e} ${A}`,"aria-expanded":v,"aria-controls":v?p:void 0,"aria-invalid":h||void 0,"aria-describedby":l,onClick:d(()=>{S(b=>!b),v||requestAnimationFrame(()=>P.current?.focus())},"onClick"),children:L!==void 0?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("span",{className:"sekyro-row-btn__flag","aria-hidden":"true",children:ue(L.code)}),(0,m.jsx)("span",{className:"sekyro-form-country__name",id:A,children:L.name})]}):(0,m.jsx)("span",{className:"sekyro-form-country__name is-empty",id:A,children:a})}),v?(0,m.jsx)("div",{id:p,className:"sekyro-form-country__list",onKeyDown:d(b=>{b.key==="Escape"&&(b.preventDefault(),D())},"onKeyDown"),children:(0,m.jsx)(me,{countries:f,label:(0,m.jsx)("span",{className:"sekyro-visually-hidden",children:u}),searchPlaceholder:C,noMatch:q,selected:o,searchRef:P,scroll:!0,onPick:d(b=>{n(b),D()},"onPick")})}):null]})}d(ee,"oe");c(ee,"CountryField");var Ae={en:U,fr:Se,ar:we,es:U,pt:U,de:U};function ge(r){let e=r.strings,o=Ae[r.locale];return(n,t)=>ce(e[n]??o[n]??"",t)}d(ge,"De");c(ge,"formCopy");var Me=new Set(["single_choice","multiple_choice","yes_no"]),$e=c(r=>r.kind==="field"?r.field==="country":Me.has(r.type),"isChoice");function ve(r,e,o){if(r.kind==="field")switch(r.field){case"birth_date":return Q(e);case"phone":return typeof e=="string"?e:"";case"address":{let n=typeof e=="object"&&e!==null&&!Array.isArray(e)?e:{};return{line1:n.lines?.[0]??"",line2:n.lines?.slice(1).join(", ")??"",city:n.city??"",postcode:n.postcode??"",country:n.country??o}}default:return typeof e=="string"?e:""}switch(r.type){case"multiple_choice":return Array.isArray(e)?e:[];case"yes_no":return typeof e=="boolean"?e:null;case"single_choice":return typeof e=="string"?e:null;case"date":return Q(e);case"number":return typeof e=="number"?String(e):"";default:return typeof e=="string"?e:""}}d(ve,"Ae");c(ve,"draftOf");function ke(r,e){if(r.kind==="field")switch(r.field){case"birth_date":return H(e);case"phone":return e||void 0;case"address":{let o=e,n=[o.line1,o.line2].map(t=>t.trim()).filter(t=>t!=="");return n.length===0&&o.city.trim()===""&&o.postcode.trim()===""?void 0:{country:o.country,city:o.city.trim(),lines:n,...o.postcode.trim()!==""?{postcode:o.postcode.trim()}:{}}}case"email":return e.trim().toLowerCase()||void 0;default:return e.trim()||void 0}switch(r.type){case"multiple_choice":return e.length>0?e:void 0;case"yes_no":return typeof e=="boolean"?e:void 0;case"single_choice":return typeof e=="string"?e:void 0;case"date":return H(e);case"number":{let o=V(e).replace(/[\s  ]/g,"").replace(/[,٫]/g,".");if(o==="")return;let n=Number(o);return Number.isFinite(n)&&/^-?\d+(\.\d+)?$/.test(o)?n:Number.NaN}default:return e.trim()||void 0}}d(ke,"Ie");c(ke,"answerOf");function Ce(r,e,o,n){let t=c(u=>{try{return new Intl.DateTimeFormat(n,{dateStyle:"long",timeZone:"UTC"}).format(new Date(`${String(u)}T00:00:00Z`))}catch{return String(u)}},"date"),a=r.params??{};switch(r.code){case"required":return o(e!==void 0&&$e(e)?"form.errors.choiceRequired":"form.errors.required");case"consent_required":return o("form.errors.consentRequired");case"too_long":return o("form.errors.tooLong",{max:Number(a.max??0)});case"too_short":return o("form.errors.tooShort",{min:Number(a.min??0)});case"email_invalid":return o("form.errors.email");case"phone_invalid":return o("form.errors.phone");case"date_invalid":return o("form.errors.date");case"date_not_past":return o("form.errors.datePast");case"date_not_future":return o("form.errors.dateFuture");case"date_too_early":return o("form.errors.dateMin",{date:t(a.date)});case"date_too_late":return o("form.errors.dateMax",{date:t(a.date)});case"number_invalid":return o("form.errors.number");case"number_not_integer":return o("form.errors.numberInteger");case"number_decimals":return o("form.errors.numberDecimals");case"number_too_small":return o("form.errors.numberMin",{min:new Intl.NumberFormat(n).format(Number(a.min??0))});case"number_too_large":return o("form.errors.numberMax",{max:new Intl.NumberFormat(n).format(Number(a.max??0))});case"address_invalid":return o("form.errors.address");case"card_number":return o("form.errors.cardNumber");default:return o("form.errors.choice")}}d(Ce,"Me");c(Ce,"issueText");var O={full_name:200,occupation:120,email:254,short_text:120,long_text:1e3};function Le({step:r,i18n:e,onError:o}){let n=ge(e),{form:t}=r,a={lang:t.locale,dir:r.dir},u=typeof t.prefill?.country=="string"?t.prefill.country:"",[C,q]=(0,x.useState)(()=>Object.fromEntries(t.questions.map(s=>[s.id,ve(s,t.prefill?.[s.id],u)]))),[h,l]=(0,x.useState)({}),[f,v]=(0,x.useState)([]),[S,I]=(0,x.useState)(!1),[P,p]=(0,x.useState)(!1),[A,L]=(0,x.useState)(0),D=(0,x.useRef)(null),b=(0,x.useId)();(0,x.useEffect)(()=>{A!==0&&D.current?.querySelector('[aria-invalid="true"]')?.focus()},[A]);let N=c(s=>{let k=f.find(g=>g.id===s);return k===void 0?null:Ce(k,t.questions.find(g=>g.id===s),n,e.locale)},"errorOf"),M=c((s,k)=>{q(g=>({...g,[s]:k})),v(g=>g.filter(w=>w.id!==s))},"set"),F=c(()=>{let s={};for(let k of t.questions){let g=ke(k,C[k.id]??null);g!==void 0&&(s[k.id]=g)}return{answers:s,consents:Object.fromEntries(t.consents.map(k=>[k.id,h[k.id]===!0]))}},"input"),j=c(s=>{let k=r.validate(F()).filter(g=>g.id===s&&g.code!=="required");v(g=>[...g.filter(w=>w.id!==s),...k])},"checkOne"),y=c(s=>{if(s.preventDefault(),S)return;let k=F(),g=r.validate(k);if(g.length>0){v(g),L(w=>w+1);return}I(!0),p(!1),r.submit(k).catch(w=>{o?.(w);let R=(w instanceof ne||w?.name==="FormAnswersError"?w.issues:null)?.filter(B=>t.questions.some(K=>K.id===B.id)||t.consents.some(K=>K.id===B.id))??[];R.length>0?(v(R),L(B=>B+1)):p(!0)}).finally(()=>I(!1))},"onSubmit"),_=c(s=>s?null:n("form.optional"),"optional");return(0,i.jsxs)("form",{ref:D,className:"sekyro-step sekyro-form","aria-labelledby":b,onSubmit:y,noValidate:!0,"data-testid":"sekyro-form-step",children:[(0,i.jsx)(se,{id:b,title:t.title??n("form.title"),lead:t.intro??n("form.lead",{org:r.context.orgName}),lang:{...t.title!==void 0?{title:t.locale}:{},...t.intro!==void 0?{lead:t.locale}:{},dir:r.dir}}),P?(0,i.jsx)(de,{tone:"danger",children:(0,i.jsx)("span",{children:n("form.errors.failed")})}):null,(0,i.jsx)("div",{className:"sekyro-form-questions",children:t.questions.map(s=>(0,i.jsx)(qe,{q:s,draft:C[s.id]??null,onChange:d(k=>M(s.id,k),"onChange"),error:N(s.id),optional:_(s.required),c:n,locale:e.locale,client:a,fallbackCountry:u,onCheck:d(()=>j(s.id),"onCheck")},s.id))}),t.consents.length>0?(0,i.jsxs)("fieldset",{className:"sekyro-form-q sekyro-form-group sekyro-form-consents",children:[(0,i.jsx)("legend",{className:"sekyro-label",children:n("form.consents")}),t.consents.map(s=>(0,i.jsx)(_e,{id:s.id,text:s.text,link:s.link,required:s.required,checked:h[s.id]===!0,onChange:d(k=>{l(g=>({...g,[s.id]:k})),v(g=>g.filter(w=>w.id!==s.id))},"onChange"),error:N(s.id),optional:_(s.required),openLink:n("form.openLink"),client:a},s.id))]}):null,(0,i.jsxs)(le,{children:[(0,i.jsx)(ie,{type:"submit",full:!0,disabled:S,"aria-busy":S||void 0,"data-testid":"sekyro-form-continue",children:n(S?"form.sending":"form.continue")}),(0,i.jsx)("span",{className:"sekyro-visually-hidden",role:"status","aria-live":"polite",children:S?n("form.sending"):""})]})]})}d(Le,"ur");c(Le,"FormView");function _e({id:r,text:e,link:o,required:n,checked:t,onChange:a,error:u,optional:C,openLink:q,client:h}){let l=re();return(0,i.jsxs)("div",{className:"sekyro-form-consent","data-consent":r,children:[(0,i.jsxs)("div",{className:"sekyro-form-choice sekyro-form-consent__row",children:[(0,i.jsx)("input",{id:l.control,type:"checkbox",checked:t,required:n,"aria-invalid":u!==null||void 0,"aria-describedby":E(l,!1,u!==null),onChange:d(f=>a(f.target.checked),"onChange")}),(0,i.jsxs)("span",{className:"sekyro-form-consent__text",children:[(0,i.jsx)("label",{htmlFor:l.control,children:(0,i.jsx)(G,{text:e,lang:h,optional:C})}),o!==void 0?(0,i.jsxs)("a",{className:"sekyro-link sekyro-form-consent__link",href:o.url,target:"_blank",rel:"noopener noreferrer",lang:h.lang,dir:h.dir,children:[o.label,(0,i.jsxs)("span",{className:"sekyro-visually-hidden",children:[" (",q,")"]})]}):null]})]}),(0,i.jsx)(oe,{ids:l,error:u})]})}d(_e,"Ee");c(_e,"Consent");function qe({q:r,draft:e,onChange:o,error:n,optional:t,c:a,locale:u,client:C,fallbackCountry:q,onCheck:h}){let l=re(),[f,v]=(0,x.useState)(()=>new Set),S=r.kind==="field"&&r.field==="birth_date",I=(S||r.kind==="custom"&&r.type==="date")&&[...f].some(y=>ye(y,V(e[y]??""),S)),P=n??(I?a("form.errors.date"):null),p=P!==null,A=r.kind==="custom"?r:null,L=A!==null?A.help:r.kind==="field"&&(r.field==="full_name"||r.field==="address")?a(`form.fields.${r.field}.help`):void 0,D=A!==null?C:void 0,b=A!==null?(0,i.jsx)(G,{text:A.label,lang:C,optional:t}):(0,i.jsx)(G,{text:a(`form.fields.${r.kind==="field"?r.field:""}.label`),optional:t}),N=(0,i.jsx)(oe,{ids:l,help:L,helpLang:D,error:P}),M=E(l,L!==void 0,p),F=c(y=>y.long===!0?(0,i.jsx)("textarea",{id:l.control,className:"sekyro-input sekyro-form-textarea",rows:4,maxLength:y.max,required:r.required,"aria-invalid":p||void 0,"aria-describedby":M,value:e,onChange:d(_=>o(_.target.value),"onChange")}):(0,i.jsx)("input",{id:l.control,className:"sekyro-input",type:y.type??"text",inputMode:y.inputMode,autoComplete:y.autoComplete??"off",dir:y.dir,maxLength:y.max,required:r.required,"aria-invalid":p||void 0,"aria-describedby":M,value:e,onChange:d(_=>o(_.target.value),"onChange")}),"text");if(r.kind==="field")switch(r.field){case"full_name":return(0,i.jsx)(z,{ids:l,label:b,notes:N,children:F({autoComplete:"name",max:O.full_name})});case"occupation":return(0,i.jsx)(z,{ids:l,label:b,notes:N,children:F({autoComplete:"organization-title",max:O.occupation})});case"email":return(0,i.jsx)(z,{ids:l,label:b,notes:N,children:F({type:"email",inputMode:"email",autoComplete:"email",dir:"ltr",max:O.email})});case"country":return(0,i.jsx)(z,{ids:l,label:b,notes:N,children:(0,i.jsx)(ee,{id:l.control,labelId:`${l.control}-l`,value:e??"",onChange:o,locale:u,placeholder:a("form.choose"),searchLabel:a("doc.countrySearch"),searchPlaceholder:a("doc.countrySearch"),noMatch:a("doc.noCountryMatch"),invalid:p,describedby:M})});case"phone":return(0,i.jsx)(z,{ids:l,label:b,notes:N,children:(0,i.jsx)(Ne,{id:l.control,value:e,onChange:o,locale:u,c:a,fallbackCountry:q,required:r.required,invalid:p,describedby:M})});case"birth_date":return(0,i.jsx)(T,{legend:b,notes:N,invalid:p,describedby:M,children:(0,i.jsx)(X,{ids:l,parts:e,onChange:o,labels:{day:a("form.date.day"),month:a("form.date.month"),year:a("form.date.year")},required:r.required,invalid:p,birthday:!0,onPartBlur:d(y=>v(_=>new Set(_).add(y)),"onPartBlur"),onLeave:h})});case"address":{let y=e,_=c((s,k,g,w)=>(0,i.jsxs)("div",{className:"sekyro-field",children:[(0,i.jsx)("label",{className:"sekyro-help",id:`${l.control}-${s}-l`,htmlFor:`${l.control}-${s}`,children:a(k)}),s==="country"?(0,i.jsx)(ee,{id:`${l.control}-${s}`,labelId:`${l.control}-${s}-l`,value:y.country,onChange:d(R=>o({...y,country:R}),"onChange"),locale:u,placeholder:a("form.choose"),searchLabel:a("doc.countrySearch"),searchPlaceholder:a("doc.countrySearch"),noMatch:a("doc.noCountryMatch"),invalid:p,describedby:E(l,!1,p)}):(0,i.jsx)("input",{id:`${l.control}-${s}`,className:"sekyro-input",type:"text",autoComplete:g,maxLength:w,required:r.required&&s!=="line2"&&s!=="postcode","aria-invalid":p||void 0,"aria-describedby":E(l,!1,p),value:y[s],onChange:d(R=>o({...y,[s]:R.target.value}),"onChange")})]}),"part");return(0,i.jsx)(T,{legend:b,notes:N,invalid:p,describedby:M,children:(0,i.jsxs)("div",{className:"sekyro-form-address",children:[_("line1","form.address.line1","address-line1",120),_("line2","form.address.line2","address-line2",120),_("city","form.address.city","address-level2",80),_("postcode","form.address.postcode","postal-code",16),_("country","form.address.country","country",2)]})})}default:return null}let j=r;switch(j.type){case"short_text":return(0,i.jsx)(z,{ids:l,label:b,notes:N,children:F({max:O.short_text})});case"long_text":return(0,i.jsx)(z,{ids:l,label:b,notes:N,children:F({max:O.long_text,long:!0})});case"number":return(0,i.jsx)(z,{ids:l,label:b,notes:N,children:F({inputMode:"decimal",dir:"ltr",max:20})});case"date":return(0,i.jsx)(T,{legend:b,notes:N,invalid:p,describedby:M,children:(0,i.jsx)(X,{ids:l,parts:e,onChange:o,labels:{day:a("form.date.day"),month:a("form.date.month"),year:a("form.date.year")},required:r.required,invalid:p,birthday:!1,onPartBlur:d(y=>v(_=>new Set(_).add(y)),"onPartBlur"),onLeave:h})});case"yes_no":return(0,i.jsx)(T,{legend:b,notes:N,invalid:p,describedby:M,children:(0,i.jsx)(J,{name:l.control,type:"radio",options:[{value:"yes",label:a("form.yes")},{value:"no",label:a("form.no")}],value:e===!0?"yes":e===!1?"no":null,onChange:d(y=>o(y==="yes"),"onChange"),required:r.required,invalid:p,describedby:E(l,!1,p)})});case"single_choice":case"multiple_choice":{let y=j.type==="multiple_choice";return(0,i.jsx)(T,{legend:b,notes:(0,i.jsxs)(i.Fragment,{children:[y?(0,i.jsx)("span",{className:"sekyro-help",children:a("form.chooseAny")}):null,N]}),invalid:p,describedby:M,children:(0,i.jsx)(J,{name:l.control,type:y?"checkbox":"radio",options:(j.choices??[]).map(_=>({value:_.value,label:_.label,lang:C})),value:e,onChange:o,required:r.required,invalid:p,describedby:E(l,!1,p)})})}default:return null}}d(qe,"qe");c(qe,"Question");function xe(r,e){let o=[];for(let a=65;a<=90;a++)for(let u=65;u<=90;u++){let C=String.fromCharCode(a,u),q=W(C);q!==void 0&&C!=="AC"&&C!=="TA"&&o.push({code:C,dial:`+${q}`})}let n=new Intl.Collator(e),t=new Map(o.map(a=>[a.code,Z(a.code,e)]));return o.sort((a,u)=>a.code===r?-1:u.code===r?1:n.compare(t.get(a.code)??"",t.get(u.code)??"")),o}d(xe,"Te");c(xe,"phoneCountries");function Ne({id:r,value:e,onChange:o,locale:n,c:t,fallbackCountry:a,required:u,invalid:C,describedby:q}){let h=(0,x.useMemo)(()=>xe(a||"MR",n),[a,n]),[l]=(0,x.useState)(()=>e||(h[0]?.dial??"")),f=fe({countries:h,international:!1,closed:!1,defaultPhone:l}),v=f.empty?"":f.typed??f.phone;return(0,x.useEffect)(()=>{v!==e&&o(v)},[v]),(0,i.jsx)(he,{field:f,id:r,locale:n,t,required:u,invalid:C,describedby:q,compact:!0})}d(Ne,"Re");c(Ne,"FormPhone");export{Le as FormView,ge as formCopy};
@@ -0,0 +1 @@
1
+ import{a as Ke,b as $e,i as Ge}from"./chunk-VXXXAUQD.js";import"./chunk-CX52FPYW.js";import"./chunk-YZWLMKXA.js";import{d as He}from"./chunk-FZXXMIZ4.js";import"./chunk-3NOBU7TE.js";import"./chunk-QTPSRWXY.js";import{e as qe}from"./chunk-5JSOPXYS.js";import"./chunk-IO7MUUC6.js";import"./chunk-Q5ZVLMKQ.js";import"./chunk-L244IUB3.js";import"./chunk-Y6PC7FZV.js";import"./chunk-KHSYTJ46.js";import"./chunk-L22GFJQV.js";import{B as Ne,C as me,D as W,E as se,F as Oe,G as Ve,I as De,J as Fe,a as G,d as ie,e as ae,g as ue,h as Te,i as oe,j as Se,k as Pe,l as Ce,n as Ie,o as pe,q as le,r as fe,t as Ee,u as Re,v as X,y as je}from"./chunk-A5SXWFOO.js";import"./chunk-DKZUKWGP.js";import{a as de}from"./chunk-F7DKVXQW.js";import{b as Ue,c as Be,d as Le}from"./chunk-P7K7ELYZ.js";import{m as ze}from"./chunk-6MYG4HWP.js";import"./chunk-JS2IXPNL.js";import{a as r}from"./chunk-4FHWXBOB.js";var te={fp12:"936b9c4ccc4a",engine:"sekyro-ocr-1",precision:"fp32",files:{"sekyro-ocr.wasm":{bytes:3550687,sha256:"00d6b1a4e42da8146e662ab0283b97485397811acc806299046933ce1943fb09",tier:"live",contentType:"application/wasm"},"sekyro-ocr.mjs":{bytes:4270,sha256:"209a78d96ca53344996a0c2300aed4ff8a5c69e142713216975a2840eec08cac",tier:"bundled",contentType:"text/javascript"},"det.param":{bytes:24252,sha256:"c39ba0b1195e8ad37cfc5bdd7acedcfc1d9cb901e7b8eb1c9c4f6e5a66c04eb3",tier:"live",contentType:"text/plain"},"det.bin":{bytes:4685856,sha256:"652bafe366565109a1a5766caf482bc46f01481f8044d3a785bd9a1be67c63bb",tier:"live",contentType:"application/octet-stream"},"mrz-rec.param":{bytes:3510,sha256:"bc69b1b9683e35f6605b21001fadeb81468063459c00c0fc83c67c139f23df01",tier:"live",contentType:"text/plain"},"mrz-rec.bin":{bytes:494196,sha256:"de93a2aa2f08670cc7dedd17ba378d2f5d7cf6ae409054a9eac863a02c2febae",tier:"live",contentType:"application/octet-stream"},"mrz_dict.txt":{bytes:73,sha256:"b19858a4de2ccbbbdd4b53982188ea2c7664013183bbd1ae9d20ab52c661f97f",tier:"live",contentType:"text/plain"},"v5-latin-fp16.param":{bytes:19800,sha256:"843964335e9863681bb17d876c69e7315844e0850e3c04f91b11a3f0c2a57bc6",tier:"lazy",group:"latin",contentType:"text/plain"},"v5-latin-fp16.bin":{bytes:3995900,sha256:"0516474d30cff75a6365869992699d27fbc03f00fcf3d7274c3eed651ee6ea90",tier:"lazy",group:"latin",contentType:"application/octet-stream"},"latin.dict.txt":{bytes:2615,sha256:"c3ab00106e4a4d151a8575b1129b91901a68a35b79a81fd63faab00418b87d75",tier:"lazy",group:"latin",contentType:"text/plain"},"v5-arabic-fp16.param":{bytes:19791,sha256:"1d1e219d277bb1a76909741573f56cfae465f11b61a9be4ca4c29580758c8760",tier:"lazy",group:"arabic",contentType:"text/plain"},"v5-arabic-fp16.bin":{bytes:3974364,sha256:"4ced47b32ab4e7ad16ddebc074f31594eb42b912465a8ed7458bb2842af9efe1",tier:"lazy",group:"arabic",contentType:"application/octet-stream"},"arabic.dict.txt":{bytes:2368,sha256:"8f239c13f6c8b1bdf15f332a65a05002ddd4d99b9286a4bfaf6f0327c36ebbec",tier:"lazy",group:"arabic",contentType:"text/plain"},"v5-cyrillic-fp16.param":{bytes:19806,sha256:"c87b42bfa343509b319dd193dcca4c0e20bb13b1d07bfbf4925a9f5d045966d4",tier:"lazy",group:"cyrillic",contentType:"text/plain"},"v5-cyrillic-fp16.bin":{bytes:3999288,sha256:"97446e221c0d2d84cb76dca6d4217a850efad4d5ec85e3fadc78db353cf97afa",tier:"lazy",group:"cyrillic",contentType:"application/octet-stream"},"cyrillic.dict.txt":{bytes:2780,sha256:"2de016b31edd687acfc1bf72170f4feff9f0c4893edac87cef30b2c5a82443ec",tier:"lazy",group:"cyrillic",contentType:"text/plain"},"v5-greek-fp16.param":{bytes:19815,sha256:"1cc1d47d3aa3fce86d3dbe901a553fd29412f44934a4919d986c155d23f63207",tier:"lazy",group:"greek",contentType:"text/plain"},"v5-greek-fp16.bin":{bytes:3879256,sha256:"04190cd4ee2b023665346d4cd239ee118965f837812108869d3d9894d30c4db3",tier:"lazy",group:"greek",contentType:"application/octet-stream"},"greek.dict.txt":{bytes:1102,sha256:"60e017885fd98fd0fb5c402da86179f1fe24ae229b374b3b96d313f99a09de59",tier:"lazy",group:"greek",contentType:"text/plain"},"v5-devanagari-fp16.param":{bytes:19807,sha256:"c6540a818cbb46c5b511dc4dd20ebfeae9038ec64e5cf175cd2d25f1b9f95c51",tier:"lazy",group:"devanagari",contentType:"text/plain"},"v5-devanagari-fp16.bin":{bytes:3931044,sha256:"d3086391eb2298c4d4e5a6d20a7fc58a8d0f3ce0a12395c88e9d485c5d595828",tier:"lazy",group:"devanagari",contentType:"application/octet-stream"},"devanagari.dict.txt":{bytes:1942,sha256:"c66d17ef6ced6fbfb4413810e75f0f788cfde37d4192bd17af7923fa190066c8",tier:"lazy",group:"devanagari",contentType:"text/plain"},"v5-thai-fp16.param":{bytes:19786,sha256:"4422df9dcc960e42082166adcca42da2aa6df62abebc75daf0c887e89381c039",tier:"lazy",group:"thai",contentType:"text/plain"},"v5-thai-fp16.bin":{bytes:3920396,sha256:"3458d7c5f0a7f88cb804d084c6596dea3f67c5ea99082654938d71a4eb72a079",tier:"lazy",group:"thai",contentType:"application/octet-stream"},"thai.dict.txt":{bytes:1766,sha256:"e0f32101004cc828ed4505bba80126be06e282700c4c79175ed2b21a4d454dfa",tier:"lazy",group:"thai",contentType:"text/plain"},"v5-hangul-fp16.param":{bytes:19804,sha256:"8daec1a4aa09d3bc92a476438330921c910263b8e61d62334d79e2d1dd14247c",tier:"lazy",group:"hangul",contentType:"text/plain"},"v5-hangul-fp16.bin":{bytes:6684280,sha256:"1d38192b59765cf71c1909ea4b972ee3c8588537a53844e6830f57fbf47976a4",tier:"lazy",group:"hangul",contentType:"application/octet-stream"},"hangul.dict.txt":{bytes:47450,sha256:"a7872c929cd25cf615cdfea08579cf800db1943900fe683468df4dcff6f848bb",tier:"lazy",group:"hangul",contentType:"text/plain"}},scripts:{latin:{classes:838,rtl:!1,param:"v5-latin-fp16.param",bin:"v5-latin-fp16.bin",dict:"latin.dict.txt"},arabic:{classes:749,rtl:!0,param:"v5-arabic-fp16.param",bin:"v5-arabic-fp16.bin",dict:"arabic.dict.txt"},cyrillic:{classes:852,rtl:!1,param:"v5-cyrillic-fp16.param",bin:"v5-cyrillic-fp16.bin",dict:"cyrillic.dict.txt"},greek:{classes:356,rtl:!1,param:"v5-greek-fp16.param",bin:"v5-greek-fp16.bin",dict:"greek.dict.txt"},devanagari:{classes:570,rtl:!1,param:"v5-devanagari-fp16.param",bin:"v5-devanagari-fp16.bin",dict:"devanagari.dict.txt"},thai:{classes:526,rtl:!1,param:"v5-thai-fp16.param",bin:"v5-thai-fp16.bin",dict:"thai.dict.txt"},hangul:{classes:11947,rtl:!1,param:"v5-hangul-fp16.param",bin:"v5-hangul-fp16.bin",dict:"hangul.dict.txt"}}};var Sn=Object.keys(te.files).filter(e=>te.files[e].tier==="live"),Pn=Object.keys(te.files).filter(e=>te.files[e].tier==="lazy");function Ze(e,t){return e==="hosted"?"/models-ocr":t==="live"?"https://assets.sekyro.ai/sdk/web/ocr":"https://assets-staging.sekyro.ai/sdk/web/ocr"}r(Ze,"E");var vt=["AD","AE","AF","AG","AI","AL","AM","AO","AQ","AR","AS","AT","AU","AW","AX","AZ","BA","BB","BD","BE","BF","BG","BH","BI","BJ","BL","BM","BN","BO","BQ","BR","BS","BT","BV","BW","BY","BZ","CA","CC","CD","CF","CG","CH","CI","CK","CL","CM","CN","CO","CR","CU","CV","CW","CX","CY","CZ","DE","DJ","DK","DM","DO","DZ","EC","EE","EG","EH","ER","ES","ET","FI","FJ","FK","FM","FO","FR","GA","GB","GD","GE","GF","GG","GH","GI","GL","GM","GN","GP","GQ","GR","GS","GT","GU","GW","GY","HK","HM","HN","HR","HT","HU","ID","IE","IL","IM","IN","IO","IQ","IR","IS","IT","JE","JM","JO","JP","KE","KG","KH","KI","KM","KN","KP","KR","KW","KY","KZ","LA","LB","LC","LI","LK","LR","LS","LT","LU","LV","LY","MA","MC","MD","ME","MF","MG","MH","MK","ML","MM","MN","MO","MP","MQ","MR","MS","MT","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NF","NG","NI","NL","NO","NP","NR","NU","NZ","OM","PA","PE","PF","PG","PH","PK","PL","PM","PN","PR","PS","PT","PW","PY","QA","RE","RO","RS","RU","RW","SA","SB","SC","SD","SE","SG","SH","SI","SJ","SK","SL","SM","SN","SO","SR","SS","ST","SV","SX","SY","SZ","TC","TD","TF","TG","TH","TJ","TK","TL","TM","TN","TO","TR","TT","TV","TW","TZ","UA","UG","UM","US","UY","UZ","VA","VC","VE","VG","VI","VN","VU","WF","WS","XK","YE","YT","ZA","ZM","ZW"],_t=["carte_identite","passport","residence_permit","drivers_license"],wt=["carte_identite","passport","residence_permit"];function ve(e,t){let n=e.byIssuer?.[t]??e.default;return _t.filter(a=>n==="*"?wt.includes(a):n.includes(a))}r(ve,"dt");function rt(e,t=vt){return[...new Set([...t,...Object.keys(e.byIssuer??{})])].filter(n=>ve(e,n).length>0).sort()}r(rt,"Nn");function kt(e){if(e.acceptedDocuments)return e.acceptedDocuments;let t=e.acceptedDocumentTypes?.length?[...e.acceptedDocumentTypes]:["carte_identite","passport"];return{default:[],byIssuer:{MR:t}}}r(kt,"Le");var xt=640,At=new Set(["network_error","timeout","upload_failed","unknown_error","rate_limit_exceeded"]),We=6,Qe=1500,Ye={sharpness:1,exposure:1,meanLuma:128},he=null;function Mt(e,t){try{he??(he=document.createElement("canvas"));let n=he,a=96/Math.max(1,t.width);n.width=Math.max(1,Math.round(t.width*a)),n.height=Math.max(1,Math.round(t.height*a));let i=n.getContext("2d");if(i===null)return Ye;i.drawImage(e,t.x,t.y,t.width,t.height,0,0,n.width,n.height);let l=i.getImageData(0,0,n.width,n.height);return{sharpness:Be(l),exposure:Le(l),meanLuma:Ue(l)}}catch{return Ye}}r(Mt,"ft");async function Tt(e,t){let n=e.source;return"convertToBlob"in n?n.convertToBlob({type:"image/jpeg",quality:t}):new Promise((a,i)=>{n.toBlob(l=>l===null?i(new Error("encode failed")):a(l),"image/jpeg",t)})}r(Tt,"mt");function nt(e,t={}){let n=t.now??(()=>performance.now()),a=t.setTimer??((m,T)=>setTimeout(m,T)),i=t.clearTimer??(m=>clearTimeout(m)),l=t.encode??Tt,s=t.quality??Mt,c=e.tuningVersion??null,b=new Set,A=!1,f=e.video??null,y=null,u=t.grabFrame??null,w=null,P=1e3/We,M=null,O=null,I=!1,R=!1,F=Number.NEGATIVE_INFINITY,V=null,Z=0,g=null,S=null,v=Promise.all([import("./icao-gate-T3BTOKFJ-BWMLKL7A.js"),import("./icao-tuning-4ETMF53W-FRBTB5R7.js"),import("./create-portrait-capture-5VGYZUOK-KTCFCHTN.js"),import("./landmarker-KB7LVXAU-F7BQTP3H.js"),import("./background-monitor-A7FKJOAG-K3WF3C2D.js")]).then(async([m,T,D,C,B])=>{let N=T.resolveIcaoTuning(e.tuning,e.tuningVersion??void 0);N.background.required&&(O=B.createBackgroundMonitor({tuning:N.backgroundCheck,assetBaseUrl:e.assetBaseUrl??"/models-v3",...t.createSegmenter!==void 0?{createSegmenter:t.createSegmenter}:{},now:n})),y=m.createIcaoGate(N,{policy:e.policy??"reject"}),u??(u=D.defaultGrabber()),w=D.observe,P=1e3/Math.min(We,N.cadenceHz);let H=(t.createLandmarker??C.createFaceLandmarker)(e.assetBaseUrl??"/models-v3"),z=await new Promise((o,d)=>{let p=setTimeout(()=>{d(new Error("landmarker init timeout")),H.then(k=>k.close(),()=>{})},C.LANDMARKER_INIT_TIMEOUT_MS);H.then(k=>{clearTimeout(p),o(k)},k=>{clearTimeout(p),d(k)})});A?z.close():M=z}).catch(()=>{I=!0}),_=r(m=>{for(let T of b)T({holding:R||I,update:m})},"Z"),h=r(()=>{if(V=null,!(A||M===null||y===null||u===null||w===null||f===null)){if(n()-F>Qe){_(null);return}try{let m=u(f,xt);if(m!==null){let T=Math.max(n(),Z+1);Z=T;let D=M.detect(m.source,T),C=f.videoWidth||m.width,B=f.videoHeight||m.height,N=w(D,m,C,B);N.geometry!==null&&O!==null&&(N.backgroundCheck=O.measure(m,N.geometry.box,C,B));let H=y.push(N,n());R=H.ready,_(H)}}catch{}V=a(h,P)}},"G"),x=r(()=>{let m=n()-F>Qe;F=n(),m&&(y?.reset(),R=!1,g=null,S=null),V===null&&M!==null&&!A&&(V=a(h,0))},"ne"),j=r(()=>{let m=u===null||f===null?null:u(f,null);if(m===null||y===null||Math.max(m.width,m.height)<e.still.minLongSidePx)return Promise.resolve(null);let T=y.summary();return l(m,e.still.jpegQuality).then(D=>({image:D,width:m.width,height:m.height,gate:T}),()=>null)},"W"),U=null;return{engineOptions:{measureQuality:r((m,T)=>{f=m,x();let D=s(m,T);return R||I?D:{...D,sharpness:0}},"measureQuality"),telemetry:r(m=>{if(m.type!=="fired"||A)return;g=j();let T=U;T!==null&&g.then(D=>D===null?void 0:T(D).catch(()=>{})),R=!1,V!==null&&i(V),V=null,F=Number.NEGATIVE_INFINITY},"telemetry")},decorate:r(m=>{let T=new WeakMap,D=new Map,C=r(z=>{let o=T.get(z);return o===void 0&&(o=(async()=>{let d=await X(m,"image","image/jpeg",z.image.size,{engine:"portrait"});return await m.uploadToSpaces(d.uploadUrl,z.image,"image/jpeg"),(await m.completeMedia(d.key)).key})(),o.catch(()=>T.delete(z)),T.set(z,o)),o},"T");U=C;let B=r(async z=>{let o;try{o=await C(z)}catch(d){let p=d?.code;if(typeof p=="string"&&At.has(p))throw d;return null}return{media:{portrait:o},gate:ae(z.gate),...c!==null?{tuningVersion:c}:{}}},"H"),N=m.submitCheck.bind(m),H=r((async(z,o,d)=>{if(z!=="liveness")return N(z,o,d);let p=d?.idempotencyKey,k=p===void 0?void 0:D.get(p);if(k===void 0){let K=g;k=K===null?Promise.resolve(null):K.then(q=>q===null?null:B(q)),p!==void 0&&(D.set(p,k),k.catch(()=>D.delete(p)))}let E=await k;if(E===null)return N("liveness",o,d);let L=await N("liveness",{...o,portraitIcao:E},d);return S=E,L}),"M");return new Proxy(m,{get(z,o){if(o==="submitCheck")return H;let d=Reflect.get(z,o);return typeof d=="function"?d.bind(z):d}})},"decorate"),onGate:r(m=>(b.add(m),()=>b.delete(m)),"onGate"),lastPortraitInput:r(()=>S,"lastPortraitInput"),destroy:r(()=>{A=!0,g=null,S=null,V!==null&&i(V),V=null,b.clear(),v.then(()=>{M?.close(),M=null,O?.close(),O=null})},"destroy")}}r(nt,"Dn");function St(e){return e.idNumberBound??e.nniBound}r(St,"Ge");function Pt(e){return e===void 0?void 0:e.idNumberFromDocument??e.nniFromDocument}r(Pt,"Be");function Ct(e){let t=e.idNumberMasked??e.nniMasked;return typeof t=="string"&&t!==""?t:void 0}r(Ct,"Ue");var it=Object.freeze({nni_invalid:"id_number_invalid",nni_not_found:"registry_record_not_found",nni_recheck:"id_number_recheck",document_nni_mismatch:"document_id_number_mismatch",nni_locked:"id_number_locked",nni_unbound:"id_number_unbound",missing_nni:"missing_id_number",registry_needs_nni_source:"registry_needs_id_number_source"}),It=new Map(Object.entries(it)),Nn=new Map(Object.entries(it).map(([e,t])=>[t,e]));function Et(e){return It.get(e)??e}r(Et,"je");var $={fullNameMin:2,fullName:200,email:254,occupation:120,shortText:120,longText:1e3,addressLine:120,addressLines:4,city:80,postcode:16,number:1e12,dateMin:"1900-01-01",dateMax:"2100-12-31"},Rt=new Set(["full_name","birth_date","email","phone","address","country","occupation"]),jt=new Set(["short_text","long_text","single_choice","multiple_choice","yes_no","date","number"]),Nt=new Set(["ar","fa","he","ur"]);function Ot(e){return Nt.has(e.split("-")[0]?.toLowerCase()??"")?"rtl":"ltr"}r(Ot,"qe");function Vt(e){if(typeof e!="object"||e===null)return null;let t=e;if(typeof t.locale!="string"||!Array.isArray(t.questions)||t.questions.length===0)return null;let n=t.consents??[];if(!Array.isArray(n))return null;for(let i of t.questions)if(!Dt(i))return null;for(let i of n)if(!Ft(i))return null;let a={locale:t.locale,questions:t.questions,consents:n};return typeof t.title=="string"&&t.title.trim()!==""&&(a.title=t.title),typeof t.intro=="string"&&t.intro.trim()!==""&&(a.intro=t.intro),typeof t.prefill=="object"&&t.prefill!==null&&!Array.isArray(t.prefill)&&(a.prefill=t.prefill),a}r(Vt,"Ye");function Dt(e){if(typeof e!="object"||e===null)return!1;let t=e;return typeof t.id!="string"||typeof t.required!="boolean"?!1:t.kind==="field"?typeof t.field=="string"&&Rt.has(t.field):t.kind!=="custom"||typeof t.type!="string"||!jt.has(t.type)||typeof t.label!="string"?!1:t.type==="single_choice"||t.type==="multiple_choice"?Array.isArray(t.choices)&&t.choices.length>=2&&t.choices.every(n=>typeof n=="object"&&n!==null&&typeof n.value=="string"&&typeof n.label=="string"):!0}r(Dt,"_t");function Ft(e){if(typeof e!="object"||e===null)return!1;let t=e;if(typeof t.id!="string"||typeof t.required!="boolean"||typeof t.text!="string")return!1;if(t.link===void 0)return!0;let n=t.link;return typeof n=="object"&&n!==null&&typeof n.url=="string"&&/^https:\/\//.test(n.url)&&typeof n.label=="string"}r(Ft,"bt");var zt=/^(\d{4})-(\d{2})-(\d{2})$/;function Ut(e){if(typeof e!="string")return!1;let t=zt.exec(e);return t===null?!1:new Date(Date.UTC(Number(t[1]),Number(t[2])-1,Number(t[3]))).toISOString().slice(0,10)===e&&e>=$.dateMin&&e<=$.dateMax}r(Ut,"Ct");function Bt(e){return typeof e=="number"&&Number.isFinite(e)&&Math.abs(e)<$.number&&Math.round(e*100)/100===e}r(Bt,"Pt");function at(e){for(let t of e.matchAll(/\d[\d -]{11,}\d/g)){let n=t[0].replace(/[ -]/g,"");if(n.length>=13&&n.length<=19&&Lt(n))return!0}return!1}r(at,"Ze");function Lt(e){let t=0;for(let n=0;n<e.length;n++){let a=Number(e[e.length-1-n]);n%2===1&&(a*=2,a>9&&(a-=9)),t+=a}return t%10===0}r(Lt,"At");var qt=/^[^\s@]+@[^\s@.]+(\.[^\s@.]+)+$/,Kt=/^\+[1-9]\d{6,14}$/,ot=/^[A-Z]{2}$/,$t=r(e=>e===void 0||typeof e=="string"&&e.trim()===""||Array.isArray(e)&&e.length===0,"xt");function lt(e=Date.now()){return new Date(e).toISOString().slice(0,10)}r(lt,"Qe");function ge(e,t,n=lt()){let a=[];for(let i of e.questions){let l=t.answers[i.id];if($t(l)){i.required&&a.push({id:i.id,code:"required"});continue}let s=i.kind==="field"?Gt(i.field,l,n):Zt(i,l,n);s!==null&&a.push({id:i.id,...s})}for(let i of e.consents)i.required&&t.consents[i.id]!==!0&&a.push({id:i.id,code:"consent_required"});return a}r(ge,"X");function ce(e,t,n=1){if(typeof e!="string")return{code:"required"};let a=e.trim();return[...a].length>t?{code:"too_long",params:{max:t}}:[...a].length<n?{code:"too_short",params:{min:n}}:at(a)?{code:"card_number"}:null}r(ce,"z");function st(e,t,n={}){return Ut(e)?n.period==="past"&&e>=t?{code:"date_not_past"}:n.period==="future"&&e<=t?{code:"date_not_future"}:n.min!==void 0&&e<n.min?{code:"date_too_early",params:{date:n.min}}:n.max!==void 0&&e>n.max?{code:"date_too_late",params:{date:n.max}}:null:{code:"date_invalid"}}r(st,"$e");function Gt(e,t,n){switch(e){case"full_name":return ce(t,$.fullName,$.fullNameMin);case"occupation":return ce(t,$.occupation);case"birth_date":return st(t,n,{period:"past"});case"email":return typeof t=="string"&&t.trim().length<=$.email&&qt.test(t.trim())?null:{code:"email_invalid"};case"phone":return typeof t=="string"&&Kt.test(t)?null:{code:"phone_invalid"};case"country":return typeof t=="string"&&ot.test(t)?null:{code:"choice_invalid"};case"address":return Ht(t)?null:{code:"address_invalid"};default:return null}}r(Gt,"Et");function Ht(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=e,n=Array.isArray(t.lines)?t.lines.filter(a=>typeof a=="string"&&a.trim()!==""):[];return typeof t.country=="string"&&ot.test(t.country)&&typeof t.city=="string"&&t.city.trim()!==""&&t.city.trim().length<=$.city&&n.length>=1&&n.length<=$.addressLines&&n.every(a=>a.trim().length<=$.addressLine&&!at(a))&&(t.postcode===void 0||typeof t.postcode=="string"&&t.postcode.trim().length<=$.postcode)}r(Ht,"It");function Zt(e,t,n){let a=new Set((e.choices??[]).map(i=>i.value));switch(e.type){case"short_text":return ce(t,$.shortText);case"long_text":return ce(t,$.longText);case"single_choice":return typeof t=="string"&&a.has(t)?null:{code:"choice_invalid"};case"multiple_choice":return Array.isArray(t)&&t.length>0&&new Set(t).size===t.length&&t.every(i=>a.has(i))?null:{code:"choice_invalid"};case"yes_no":return typeof t=="boolean"?null:{code:"choice_invalid"};case"date":{let i=e.options??{};return st(t,n,{...typeof i.min=="string"?{min:i.min}:{},...typeof i.max=="string"?{max:i.max}:{},...i.period==="past"||i.period==="future"?{period:i.period}:{}})}case"number":{if(typeof t!="number"||!Number.isFinite(t)||Math.abs(t)>=$.number)return{code:"number_invalid"};let i=e.options??{};return i.integer===!0&&!Number.isInteger(t)?{code:"number_not_integer"}:Bt(t)?typeof i.min=="number"&&t<i.min?{code:"number_too_small",params:{min:i.min}}:typeof i.max=="number"&&t>i.max?{code:"number_too_large",params:{max:i.max}}:null:{code:"number_decimals"}}default:return null}}r(Zt,"Mt");function Wt(e,t,n,a=lt()){let i=e?.errors;return Array.isArray(i)?i.flatMap(l=>{if(typeof l!="object"||l===null)return[];let{id:s,code:c}=l;return typeof s!="string"||typeof c!="string"?[]:[Yt(s,c,t,n)]}):ge(t,n,a)}r(Wt,"Je");var Qt={full_name:$.fullName,occupation:$.occupation,email:$.email,short_text:$.shortText,long_text:$.longText};function Yt(e,t,n,a){let i=n.questions.find(b=>b.id===e),l=i===void 0?void 0:i.kind==="field"?i.field:i.type,s=a.answers[e],c=i!==void 0&&i.kind==="custom"?i.options??{}:{};switch(t){case"required":case"card_number":return{id:e,code:t};case"consent_required":return{id:e,code:"consent_required"};case"too_short":return{id:e,code:t,params:{min:l==="full_name"?$.fullNameMin:1}};case"too_long":{let b=l===void 0?void 0:Qt[l];return b===void 0?{id:e,code:t}:{id:e,code:t,params:{max:b}}}case"not_a_choice":return{id:e,code:"choice_invalid"};case"not_in_past":return{id:e,code:"date_not_past"};case"not_in_future":return{id:e,code:"date_not_future"};case"not_an_integer":return{id:e,code:"number_not_integer"};case"out_of_range":return Jt(e,l,s,c);case"invalid":return i===void 0?n.consents.some(b=>b.id===e)?{id:e,code:"consent_required"}:{id:e,code:t}:{id:e,code:Xt(l,s)};default:return{id:e,code:t}}}r(Yt,"vt");function Jt(e,t,n,a){if(t==="date"){let s=typeof a.min=="string"?a.min:void 0,c=typeof a.max=="string"?a.max:void 0;return c!==void 0&&(s===void 0||typeof n=="string"&&n>c)?{id:e,code:"date_too_late",params:{date:c}}:s!==void 0?{id:e,code:"date_too_early",params:{date:s}}:{id:e,code:"date_invalid"}}let i=typeof a.min=="number"?a.min:void 0,l=typeof a.max=="number"?a.max:void 0;return l!==void 0&&(i===void 0||typeof n=="number"&&n>l)?{id:e,code:"number_too_large",params:{max:l}}:i!==void 0?{id:e,code:"number_too_small",params:{min:i}}:{id:e,code:"number_invalid"}}r(Jt,"Tt");function Xt(e,t){switch(e){case"email":return"email_invalid";case"phone":return"phone_invalid";case"birth_date":case"date":return"date_invalid";case"number":return typeof t=="number"&&Number.isFinite(t)&&Math.abs(t)<$.number?"number_decimals":"number_invalid";case"address":return"address_invalid";case"full_name":case"occupation":case"short_text":case"long_text":return"required";default:return"choice_invalid"}}r(Xt,"Nt");var er=new Set(["phone_otp","email_otp","national_eid","document","nfc","population_registry","supplied_identity","summary_confirm","liveness","portrait","face_match","aml_screening","face_dedup","age_estimation","proof_of_address","form"]),tr=new Set(["supplied_identity","aml_screening","face_dedup","age_estimation"]),_e=["document","population_registry","national_eid"],we=["phone_otp","email_otp"],ct={identity_method:_e,contact:we},rr=["population_registry","document"],ke="platform_unsupported",nr=new Set(["prefilled","user_entered","prefilled_or_entered"]),ir={phone_otp:"contact",email_otp:"contact",eid_auth:"identity",doc_ocr:"identity",nfc_chip:"identity",population_registry:"identity",liveness:"live_photo",portrait_icao:"live_photo",face_match:"live_photo",poa:"documents",form:"form"};function Q(e){return e.section??ir[e.checkType]??null}r(Q,"L");function dt(e,t){let n=e.plan?.choice;if(n===void 0||n.locked)return;let a=n.options.find(i=>i.id!==n.selected&&i.available!==!1&&t.includes(i.service));return a===void 0?void 0:{nodeId:n.nodeId,option:a}}r(dt,"de");function xe(e){let t=e.plan,n=t?.choice;if(t===void 0||n===void 0||n.locked||t.current===null||t.current===n.nodeId||pe(e))return null;let a=ct[n.kind]??[..._e,...we],i=n.options.flatMap(c=>c.available===!1||!a.includes(c.service)?[]:[c.nationalEid!=null?{id:c.id,service:c.service,nationalEid:c.nationalEid}:{id:c.id,service:c.service}]),l=t.steps.find(c=>c.id===t.current)?.service,s=n.selected??i.find(c=>c.service===l)?.id??null;return i.some(c=>c.id!==s)?{nodeId:n.nodeId,kind:n.kind,current:s,options:i}:null}r(xe,"le");function ut(e){return e==null?[]:e.options.filter(t=>t.id!==e.current)}r(ut,"tt");function ar(e){let t=e.simulation;if(typeof t!="object"||t===null)return;let{otpCode:n,skipCapture:a}=t;if(typeof n!="string"||n===""||typeof a!="boolean")return;let i=Re(e);return i!==void 0?{otpCode:n,skipCapture:a,reason:i}:{otpCode:n,skipCapture:a}}r(ar,"Gt");function or(e){let t=(e.plan?.sections??[]).map(s=>({id:s.id,state:s.state})),n={sessionId:fe(e.sessionId),orgName:e.orgName,sandbox:e.sandbox===!0,returning:e.returning===!0,consentRecorded:e.consentRecorded,expiresAt:e.expiresAt,sections:t.map(s=>s.id),progress:t,purpose:e.purpose??"identity"};e.branding!==void 0&&(n.branding=e.branding),e.cameraUnavailableHandled===!0&&(n.cameraUnavailableHandled=!0);let a=ar(e);a!==void 0&&(n.simulation=a);let i=e.testerGate;i?.offered===!0&&typeof i.attemptsLeft=="number"&&i.attemptsLeft>0&&(n.testerGate={attemptsLeft:i.attemptsLeft});let l=xe(e);return l!==null&&(n.switchable=l),n}r(or,"Bt");function lr(e){let t={attemptsRemaining:Pe(e),attemptsExhausted:e.attempts.used>=e.attempts.max};return e.reason!==void 0&&(t.reason=e.reason),e.retakeHint!==void 0&&(t.retakeHint=e.retakeHint),t}r(lr,"Ut");var pt={phone_otp:"phone",email_otp:"email"};function sr(e,t){let n=dt(e,[t==="phone_otp"?"email_otp":"phone_otp"]);return n===void 0?void 0:pt[n.option.service]}r(sr,"Kt");function cr(e,t,n,a){let i=t.checkType==="email_otp",l=(i?t.emailOtp:t.otp)??{},s=i?t.emailOtp?.emailSource:t.otp?.numberSource,c=s!==void 0&&nr.has(s)?s:i?"prefilled_or_entered":"user_entered",b=typeof l.sentToMasked=="string"&&l.sentToMasked.length>0,A=l.prefilled===!0,f=sr(e,i?"email_otp":"phone_otp"),y={key:t.checkType,context:n,section:Q(t),phase:b?"verify":"send",canSwitch:f!==void 0,...a},u=i?{kind:"email_otp",...y,emailSource:c,needsEmail:c!=="prefilled"&&!A}:{kind:"phone_otp",...y,numberSource:c,needsPhone:c!=="prefilled"&&!A,channels:(t.otp?.channels??[]).filter(w=>w==="whatsapp"||w==="sms")};if(f!==void 0&&(u.switchChannel=f),A&&(u.prefilled=!0),b&&(u.sentToMasked=l.sentToMasked),!i&&t.otp?.channel!==void 0&&(u.channel=t.otp.channel),!i&&Array.isArray(t.phoneCountries)&&(u.phoneCountries=t.phoneCountries.filter(w=>typeof w=="string"&&/^[A-Z]{2}$/.test(w))),!i&&Array.isArray(t.phoneRules)){let w=u.phoneCountries??[];u.phoneRules=t.phoneRules.flatMap(P=>{let M=pr(P);return M!==void 0&&w.includes(M.code)?[M]:[]})}return!i&&t.phoneInternational===!0&&(u.phoneInternational=!0),l.expiresAt!==void 0&&(u.codeExpiresAt=l.expiresAt),l.resendAvailableAt!==void 0&&(u.resendAvailableAt=l.resendAvailableAt),u}r(cr,"jt");var dr=/^[\d[\]\-|()?:^]{1,64}$/;function ur(e){try{return typeof e=="string"&&dr.test(e)&&new RegExp(e)!==null}catch{return!1}}r(ur,"Yt");var Je=r(e=>typeof e=="number"&&Number.isInteger(e)&&e>=1&&e<=15,"ze");function pr(e){let{code:t,dial:n,trunk:a,lengths:i,formats:l}=e??{};if(typeof t!="string"||typeof n!="string"||!/^\d{1,3}$/.test(n)||a!==void 0&&(typeof a!="string"||!/^\d{1,3}$/.test(a))||!Array.isArray(i)||i.length===0||!i.every(Je))return;let s={code:t,dial:n,lengths:[...i].sort((c,b)=>c-b)};if(a!==void 0&&(s.trunk=a),l!==void 0){if(!(Array.isArray(l)&&l.length<=8&&l.every(c=>ur(c?.leading)&&Array.isArray(c.groups)&&c.groups.every(Je)&&i.includes(c.groups.reduce((b,A)=>b+A,0)))))return;s.formats=l.map(c=>({leading:c.leading,groups:[...c.groups]}))}return s}r(pr,"Zt");function fr(e,t,n,a){let i=St(e)===!0?"bound":Pt(t)===!0?"document":"typed",l=i==="typed"&&t.state==="input_required"&&t.reason!==void 0&&Et(t.reason)==="id_number_recheck",s=ut(xe(e)),c=!a.attemptsExhausted&&s.length===1&&s[0]?.service==="document";return{kind:"registry",key:"registry",context:n,section:Q(t),state:t.state==="input_required"?"input_required":"pending",source:i,recheck:l,canUseDocument:c,...a}}r(fr,"Wt");function mr(e,t,n,a,i){let l=[...t.acceptedSides??[]],s={kind:"document",key:"document",context:n,section:Q(t),side:l.includes("recto")?"verso":"recto",acceptedSides:l,documents:kt(e),photo:Me(Ae(e.documents),i),...a};return e.detectedCountry!==void 0&&(s.detectedCountry=e.detectedCountry),gr(e)&&(s.ageStepUp=!0),s}r(mr,"Qt");function Ae(e,t=!0){let n=e?.source==="upload"||e?.source==="choice"?e.source:"camera",a=e?.sourcePick==="camera"||e?.sourcePick==="upload"?e.sourcePick:null;return{source:n,pick:a,uploadOffered:t&&e?.uploadOffered===!0}}r(Ae,"pe");function Me(e,t){return t?{...e,cameraOnPhone:!0}:e}r(Me,"fe");var hr=10*1024*1024;function yr(e,t,n,a,i){let l=e.proofOfAddress,s=l?.pdf?.maxBytes,c=l?.phase==="holder_letter"?"holder_letter":"document";return{kind:"proof_of_address",key:"proof_of_address",context:n,section:Q(t),phase:c,rule:l?.rule??{country:null,countryFrom:"global",source:"preset_global",kinds:[]},nameMatch:l?.nameMatch??"exact_person",photo:Me(Ae(l),i),maxPages:3,pdf:{maxBytes:typeof s=="number"&&s>0?s:hr,maxPages:3},licenceAddressAccepted:c==="document"&&l?.licenceAddressAccepted===!0,...a}}r(yr,"Jt");function gr(e){let t=Se(e).find(a=>a.checkType==="age_estimation"),n=t?.reason;return t?.state==="failed"&&(n==="age_uncertain"||n==="age_unavailable")}r(gr,"zt");function br(e){let t=le(e,"liveness");return t?.state==="passed"||t?.state==="review"}r(br,"Xt");function Xe(e,t,n,a,i,l=!1){let s=t.icao?.report,c=e.portrait,b=i==="capture"?c?.pendingFix??null:null;b!==null&&(i="review");let A=re(e);return{kind:"portrait",key:`portrait:${i}`,context:n,section:Q(t),phase:i,report:Array.isArray(s)?s:null,review:t.state==="review",tuning:e.capture?.icao??null,tuningVersion:e.capture?.tuningVersion??null,icao:ie(e),retakeOnly:i==="capture"&&t.state==="input_required"&&A===void 0&&e.capture?.livePhoto?.oneCapture===!0&&br(e),photo:Me(Ae(c,i==="capture"),l&&i==="capture"),pendingFix:b,...A!==void 0?{captureMode:A}:{},...c?.reuse?.pending===!0?{reuse:!0}:{},...a}}r(Xe,"Xe");function re(e){let t=e.portrait?.captureMode;return t==="self"||t==="assisted"||t==="choice"?t:void 0}r(re,"rt");var ye={minLongSidePx:1280,jpegQuality:.95};function vr(e,t){let n=e.capture?.livePhoto;if(n?.oneCapture!==!0)return null;let a=le(e,"portrait_icao"),i=n.still??ye;return{icao:t==="liveness"&&ie(e)!==null&&re(e)===void 0&&a!==void 0&&a.state==="pending"&&a.reason===void 0,still:{minLongSidePx:i.minLongSidePx??ye.minLongSidePx,jpegQuality:i.jpegQuality??ye.jpegQuality}}}r(vr,"en");function _r(e,t,n,a){let i=t.eid,l=Q(t);if(i===void 0||i.challenge!=="app_code")return{kind:"unsupported",key:"unsupported:eid_auth",context:n,section:l,checkType:"eid_auth",reason:"update_required"};let s=ut(xe(e)),c=s.length===1&&rr.includes(s[0]?.service??"")?s[0]:void 0,b=c===void 0?void 0:oe[c.service],A=b!==void 0,f={kind:"eid",key:"eid",context:n,section:l,provider:i.provider,providerName:i.providerName,country:i.country,challenge:"app_code",phase:i.awaiting==="code"?"code":"identifier",identifierBound:i.identifierBound===!0,canUseCamera:A,afterPass:i.afterPass==="continue"?"continue":"end",...a};return A&&(f.cameraMethod=b),i.expiresAt!==void 0&&(f.codeExpiresAt=i.expiresAt),i.resendAvailableAt!==void 0&&(f.resendAvailableAt=i.resendAvailableAt),i.resendsRemaining!==void 0&&(f.resendsRemaining=i.resendsRemaining),i.codeAttemptsRemaining!==void 0&&(f.codeAttemptsRemaining=i.codeAttemptsRemaining),f}r(_r,"tn");function wr(e,t){if(t.checkType!=="face_match"||t.reason!==void 0)return null;let n=le(e,"portrait_icao");return n!==void 0&&(n.state==="passed"||n.state==="review")?n:null}r(wr,"nn");var kr={rejected:"rejected",inconclusive:"inconclusive",unavailable:"unavailable",abandoned:"expired",not_opened:"expired",cancelled:"expired",superseded:"expired",policy:"policy"};function xr(e){return e.reasonCode===ke?"platform_unsupported":e.status==="review_pending"?"review":e.status==="verified"?"verified":e.reasonCode==="device_cooldown"?"cooldown":e.reasonCode==="starter_credit_claimed"?"policy":(e.status==="not_verified"&&e.reason!==void 0?kr[e.reason]:void 0)??"rejected"}r(xr,"on");function Ar(e,t){let n=xr(e),a=n==="platform_unsupported"?{sessionId:fe(e.sessionId),status:"unavailable",reasonCode:ke}:Ee(e,{autoRetry:!1}),i={kind:"result",key:"result",context:t,section:null,display:n,result:a};return e.status==="not_verified"&&e.reason!==void 0&&(i.reason=e.reason),e.reasonCode!==void 0&&(i.reasonCode=e.reasonCode),e.status==="not_verified"&&e.step!==void 0&&(i.step=e.step),e.retryAfter!==void 0&&(i.retryAfter=e.retryAfter),i}r(Ar,"sn");function Mr(e,t,n){let a=e.identitySummary;if(a==null)return null;let i={kind:"identity_summary",key:"identity_summary",context:t,section:n??"identity",summaryKind:a.kind==="partial"?"partial":a.kind??"full",source:a.source,portraitAvailable:a.portrait?.available===!0,retakeAvailable:a.retakeAvailable===!0};for(let s of Tr){let c=a[s];typeof c=="string"&&c!==""&&(i[s]=c)}let l=Ct(a);return l!==void 0&&(i.idNumberMasked=l,i.nniMasked=l),i}r(Mr,"an");var Tr=["fullName","birthDate","birthYear","nationality","documentType","documentNumberMasked","expiryDate","retakeTarget"];function J(e,t,n,a){return{kind:"unsupported",key:`unsupported:${n}`,context:e,section:t,checkType:n,reason:a}}r(J,"B");function Sr(e){return e.kind==="contact"?"contact":(e.kind,"identity")}r(Sr,"cn");function Pr(e,t){let n=ct[e.kind]??[..._e,...we],a=Sr(e),i=e.options.flatMap(s=>{if(s.available===!1||!n.includes(s.service))return[];let c={id:s.id,service:s.service};s.nationalEid!=null&&(c.nationalEid=s.nationalEid);let b=(s.channels??[]).filter(A=>A==="whatsapp"||A==="sms");return s.service==="phone_otp"&&b.length>0&&(c.channels=b),[c]});if(i.length===0){let s=e.options.length>0&&e.options.every(c=>c.service==="nfc");return J(t,a,"choice",s?"platform_unsupported":"update_required")}let l={nodeId:e.nodeId,kind:e.kind,selected:e.selected,options:i};if(e.kind==="identity_method"){let s={kind:"method",key:"method",context:t,section:a,options:i.map(b=>oe[b.service]),choice:l},c=i.find(b=>b.nationalEid!==void 0)?.nationalEid;return c!==void 0&&(s.nationalEid=c),s}return e.kind==="contact"?{kind:"contact_choice",key:"contact_choice",context:t,section:a,options:i.map(s=>pt[s.service]),selected:null,locked:!1,choice:l}:{kind:"choice",key:`choice:${e.nodeId}`,context:t,section:a,choice:l}}r(Pr,"dn");function Cr(e,t,n,a){let i=e.nativeApp,l=typeof i=="object"&&i!==null?i:{},s={sekyroApp:l.sekyroApp===!0};return typeof l.link=="string"&&l.link!==""&&(s.link=l.link),s.sekyroApp&&typeof l.sekyroAppLink=="string"&&l.sekyroAppLink.startsWith("sekyro://")&&(s.sekyroAppLink=l.sekyroAppLink),{kind:"native_app_required",key:`native_app_required:${a}`,context:t,section:n,checkType:a,nativeApp:s}}r(Cr,"ln");function Y(e,t={}){let n=or(e);if(pe(e)||e.reasonCode===ke)return Ar(e,n);let a=e.plan;if(a===void 0||!Array.isArray(a.sections))return J(n,null,"plan","update_required");let i=Ce(e);if(i!==null)return Pr(i,n);let l=a.current===null?void 0:a.steps.find(u=>u.id===a.current),s=r(u=>{let w={kind:"processing",key:"processing",context:n,section:u!==void 0?Q(u):a.sections.find(P=>P.state==="current")?.id??null,stalled:!1};return typeof u?.service=="string"&&u.service!==""&&(w.service=u.service),w},"d");if(a.current===null)return s(a.steps.find(u=>u.state==="processing"));if(l===void 0)return J(n,null,"step","update_required");if(!er.has(l.service))return l.interaction==="server"?s(l):J(n,Q(l),l.service,"update_required");if(tr.has(l.service)||!Ie(l))return s(l);let c=l,b=lr(c),A=c.checkType,f=Q(c);if(c.requiresNativeApp===!0)return Cr(e,n,f,A);let y=t.isMobile===!1?Oe(e,c):null;if(y==="phone")return{kind:"mobile_required",key:"mobile_required",context:n,section:f,checkType:A};switch(A){case"phone_otp":case"email_otp":return cr(e,c,n,b);case"population_registry":return fr(e,c,n,b);case"eid_auth":return _r(e,c,n,b);case"doc_ocr":return mr(e,c,n,b,y==="upload_or_phone");case"identity_confirm":return Mr(e,n,f)??s(c);case"portrait_icao":return Xe(e,c,n,b,"capture",y==="upload_or_phone");case"liveness":case"face_match":{let u=wr(e,c);if(u!==null)return Xe(e,u,n,b,"match");let w=c.requiresMobile===!0,P=ie(e);return{kind:"liveness",key:"biometric",context:n,section:f,mode:A==="face_match"?"selfie":"liveness",requiresMobile:w,instructions:P===null?"standard":"icao",icao:P,livePhoto:vr(e,A),...b}}case"poa":return yr(e,c,n,b,y==="upload_or_phone");case"form":{let u=Vt(c.form);return u===null?J(n,f,A,"update_required"):{kind:"form",key:"form",context:n,section:f,form:u,dir:Ot(u.locale),...b}}case"nfc_chip":return J(n,f,A,"platform_unsupported");default:return J(n,f,A,"update_required")}}r(Y,"ee");var Ir=/^[A-Z0-9][A-Z0-9 -]{0,39}$/,Er=Object.freeze({normalize:r(e=>e.trim().toUpperCase().replace(/\s+/g," "),"normalize"),check:r(e=>Ir.test(e),"check"),registrySources:Object.freeze([]),describe:"number must be 1 to 40 letters, digits, spaces or hyphens"}),Rr=/^[A-Z0-9]{4,20}$/,be=r(e=>e.trim().toUpperCase().replace(/[\s-]+/g,""),"me"),jr=Object.freeze({normalize:be,check:r(e=>Rr.test(be(e)),"check"),registrySources:Object.freeze([]),describe:"number must be 4 to 20 letters or digits"});function Nr(e){return typeof e=="string"&&/^\d{10}$/.test(e)&&Number(e)%97===1}r(Nr,"Sn");var Or={trim:r(e=>e.trim(),"trim"),upper_single_space:r(e=>e.trim().toUpperCase().replace(/\s+/g," "),"upper_single_space"),upper_no_space_or_hyphen:be},Vr={mr_nni_mod97:r(e=>Nr(e),"mr_nni_mod97")};function Dr(e){let t=new RegExp(e.pattern,"u"),n=e.check===null?void 0:Vr[e.check];return Object.freeze({normalize:Or[e.normalize],check:r(a=>t.test(a.trim())&&(n===void 0||n(a)),"check"),registrySources:Object.freeze([...e.registrySources]),describe:e.describe})}r(Dr,"_n");var Fr=Object.freeze(Object.fromEntries(Object.entries(Fe).map(([e,t])=>[e,Dr(t)])));function ft(e,t){return Fr[`${e.toUpperCase()}:${t}`]??(t==="drivers_license"?jr:Er)}r(ft,"he");var zr=Object.freeze({MRT:"MR"});function Ur(e,t){let n=e.trim().toUpperCase();return ft(zr[n]??n,t)}r(Ur,"ot");function Br(e){let t=Ur(e.issuingCountry,e.type);return t.check(t.normalize(e.number))}r(Br,"it");function Lr(e){return ft("MR","national_id").check(e)}r(Lr,"st");function et(e){let t="";for(let n of e){let a=n.codePointAt(0)??0;a>=1632&&a<=1641?t+=String(a-1632):a>=1776&&a<=1785?t+=String(a-1776):n!==" "&&n!=="-"&&n!==" "&&(t+=n)}return t}r(et,"Se");var qr=[1e3,2e3,4e3,8e3,15e3],Kr=3e4,$r=/^\+[1-9]\d{6,14}$/,Gr=/^\d{6}$/,Hr=/^\d{6}$/,Zr=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,tt=new Set(["session_not_active","check_not_found","check_already_finalized","check_out_of_order","identity_confirm_required","identity_confirm_locked","choice_locked","choice_option_unavailable","choice_not_found","step_not_on_path","check_not_active","native_app_required"]),Wr={simulatedCapture:!0},Qr=new Set(["network_error","timeout","upload_failed","unknown_error","rate_limit_exceeded"]);function mt(e){let t=!1,n=null,a="",i=!1,l=!1,s=!1,c={},b={},A=new Set,f=!1,y=!1,u=null,w="idle",P=new Map,M=new Map,O=r((o,d,p)=>{let k=`${o}.${d}`,E=P.get(k);if(E!==void 0)return E;let L=M.get(o),K=(L===void 0?p():L.then(p)).finally(()=>{P.delete(k)});P.set(k,K);let q=K.then(()=>{},()=>{});return M.set(o,q),q.then(()=>{M.get(o)===q&&M.delete(o)}),K},"I"),I=r(async(o,d,p)=>{await e.ensureConsent();let k;try{k=await je(e.runtime,d)}catch(L){if(L instanceof G&&tt.has(L.code)){await e.refreshView();return}throw L}if(p?.(k),e.destroyed())return;let E=k;E.plan!==void 0&&e.setView!==void 0?e.setView(E):await e.refreshView()},"v"),R=r(async o=>{await e.ensureConsent();let d;try{try{d=await o(e.runtime.client)}catch(p){if(!(p instanceof G)||p.code!=="consent_required")throw p;await e.runtime.ensureConsent({force:!0}),d=await o(e.runtime.client)}}catch(p){if(p instanceof G&&tt.has(p.code)){await e.refreshView();return}throw p}e.destroyed()||(d!==void 0&&e.setView!==void 0?e.setView(d):await e.refreshView())},"V"),F=r((o,d)=>O("choice",`${o}:${d}`,()=>R(p=>p.choose(o,d))),"D"),V=r((o,d)=>o.options.some(p=>p.id===d)?F(o.nodeId,d):Promise.reject(new RangeError(`option ${String(d)} is not offered`)),"x"),Z=r((o,d)=>{let p=e.currentView(),k=p===null?void 0:dt(p,o);return k===void 0?Promise.reject(new RangeError(`the ${d} is not offered`)):F(k.nodeId,k.option.id)},"U"),g=r(o=>O("identity",o,()=>R(d=>d.confirmIdentity===void 0?Promise.reject(new Error("identity confirmation is not available in this build")):d.confirmIdentity(o))),"F"),S=r((o,d)=>{let p=ge(o.form,d);if(p.length>0)return Promise.reject(new me(p,"client"));let k={answers:{...d.answers},consents:{}};for(let E of o.form.consents)k.consents[E.id]=d.consents[E.id]===!0;return O("form","submit",()=>I("form",(E,L)=>E.submitCheck("form",k,{idempotencyKey:L})).catch(E=>{throw E instanceof G&&E.code===Ne?new me(Wt(E.details,o.form,k),"server"):E}))},"K"),v=r((o,d)=>{let p=o.kind,k=p==="phone_otp",E=k?"phone":"email",L={action:"send"};if(k?o.needsPhone:o.needsEmail){let K=d[E]??b[p],q=k?K?.replace(/[\s().-]/g,""):K?.trim();if(q!==void 0||o.phase!=="verify"){if(q===void 0||!(k?$r:Zr).test(q))return Promise.reject(k?new W("phone","format"):new se("email","format"));L[E]=q}}if(k){let K=o.channels,q=d.channel??(K.length===1?K[0]:void 0);if(K.length>0){if(q===void 0)return Promise.reject(new se("channel","required"));if(!K.includes(q))return Promise.reject(new se("channel","unavailable"))}q!==void 0&&(L.channel=q),L.phoneRules=1}return O(p,"send",()=>I(p,(K,q)=>K.submitCheck(p,L,{idempotencyKey:q}),K=>{Jr(K,p)||(c[p]=e.now(),L[E]!==void 0&&(b[p]=L[E]))}))},"te"),_=r((o,d)=>Gr.test(d)?O(o,"verify",()=>I(o,(p,k)=>p.submitCheck(o,{action:"verify",code:d},{idempotencyKey:k}))):Promise.reject(new W("code","format")),"Z"),h=r((o,d)=>O("eid_auth",o,()=>I("eid_auth",(p,k)=>p.submitCheck("eid_auth",d,{idempotencyKey:k}))),"G"),x=r((o,d)=>{if(o.identifierBound)return h("start",{action:"start"});let p=et(d??"");if(o.country==="MR"){if(!/^\d{10}$/.test(p))return Promise.reject(new W("nni","format"));if(!Lr(p))return Promise.reject(new W("nni","check_digit"))}else if(p==="")return Promise.reject(new W("nni","format"));return h("start",{action:"start",identifier:p})},"ne"),j=r((o,d,p)=>{if(o.source!=="typed")return Promise.reject(new RangeError("this session already holds the ID number"));let k=et(d);return/^\d{10}$/.test(k)?Br({type:"national_id",issuingCountry:"MR",number:k})?O("population_registry","submitIdNumber",()=>I("population_registry",(E,L)=>E.submitCheck("population_registry",{idNumber:k,nni:k},{idempotencyKey:L}),()=>{u=`••••••${k.slice(-4)}`})):Promise.reject(new W(p,"check_digit")):Promise.reject(new W(p,"format"))},"W"),U=r(o=>(e.stopCameras?.(),O(o,"skipCapture",()=>I(o,(d,p)=>d.submitCheck(o,Wr,{idempotencyKey:p}),()=>{(o==="liveness"||o==="portrait_icao")&&(f=!0)}))),"Q"),m=r(o=>{if(o.kind==="result"||o.context.simulation?.skipCapture!==!0)return o;let d=Yr(o);return d===null?o:{...o,skipCapture:r(()=>U(d),"skipCapture")}},"ge"),T=r(o=>((o.kind==="document"||o.kind==="portrait"||o.kind==="proof_of_address")&&o.photo?.cameraOnPhone===!0&&(o.refresh=async()=>{await e.refreshView()}),o),"m"),D=r(o=>{switch(o.kind){case"phone_otp":case"email_otp":{let d={...o,send:r((k={})=>v(o,k),"send"),verify:r(k=>_(o.kind,k),"verify"),switchTo:r(()=>o.canSwitch&&o.switchChannel!==void 0?Z([o.switchChannel==="email"?"email_otp":"phone_otp"],"other contact option"):Promise.reject(new RangeError("this session has no other contact option")),"switchTo")},p=c[o.kind];return d.resendAvailableAt===void 0&&p!==void 0&&(d.resendAvailableAt=new Date(p+Kr).toISOString()),d}case"eid":return{...o,start:r(d=>x(o,d),"start"),verify:r(d=>Hr.test(d)?h("verify",{action:"verify",code:d}):Promise.reject(new W("code","format")),"verify"),resend:r(()=>o.resendsRemaining===0?Promise.reject(new RangeError("no new code can be sent for this session")):h("resend",{action:"resend"}),"resend"),useCamera:r(()=>o.canUseCamera&&o.cameraMethod!==void 0?Z(o.cameraMethod==="document_photo"?["document"]:["population_registry"],"camera path"):Promise.reject(new RangeError("the camera path is not offered")),"useCamera")};case"method":return{...o,select:r(d=>{let p=o.choice.options.find(k=>oe[k.service]===d);return p!==void 0?V(o.choice,p.id):Promise.reject(new RangeError(`method ${String(d)} is not offered`))},"select"),choose:r(d=>V(o.choice,d),"choose")};case"choice":return{...o,choose:r(d=>V(o.choice,d),"choose")};case"registry":return{...o,submitIdNumber:r(d=>j(o,d,"idNumber"),"submitIdNumber"),submitNni:r(d=>j(o,d,"nni"),"submitNni"),confirm:r(()=>O("population_registry","confirm",()=>I("population_registry",(d,p)=>d.submitCheck("population_registry",{},{idempotencyKey:p}))),"confirm"),useDocument:r(()=>o.canUseDocument?Z(["document"],"document method"):Promise.reject(new RangeError("the document method is not offered")),"useDocument")};case"document":return e.bindDocument!==void 0?T(e.bindDocument(o,z)):{...o,issuer:null,documentType:null,captureSide:null,selectDocument:r(()=>{throw new Error("document capture is not available in this build")},"selectDocument"),capture:r(()=>{throw new Error("document capture is not available in this build")},"capture"),uploadDocument:r(()=>Promise.reject(new Error("document upload is not available in this build")),"uploadDocument")};case"portrait":return e.bindPortrait!==void 0?T(e.bindPortrait(o,z)):{...o,uploadFailed:!1,resubmit:r(()=>Promise.resolve(),"resubmit"),capture:r(()=>{throw new Error("portrait capture is not available in this build")},"capture"),uploadPortrait:r(()=>Promise.reject(new Error("portrait upload is not available in this build")),"uploadPortrait"),confirmFix:r(()=>Promise.reject(new Error("portrait review is not available in this build")),"confirmFix")};case"proof_of_address":return e.bindProofOfAddress!==void 0?T(e.bindProofOfAddress(o,z)):{...o,uploadPages:r(()=>Promise.reject(new Error("proof of address upload is not available in this build")),"uploadPages"),uploadHolderLetter:r(()=>Promise.reject(new Error("proof of address upload is not available in this build")),"uploadHolderLetter"),capturePage:r(()=>{throw new Error("proof of address capture is not available in this build")},"capturePage")};case"form":return{...o,validate:r(d=>ge(o.form,d),"validate"),submit:r(d=>S(o,d),"submit")};case"contact_choice":return{...o,select:r(d=>{let p=d==="phone"?"phone_otp":d==="email"?"email_otp":void 0,k=o.choice.options.find(E=>E.service===p);return k!==void 0?V(o.choice,k.id):Promise.reject(new RangeError(`contact ${String(d)} is not offered`))},"select"),choose:r(d=>V(o.choice,d),"choose")};case"identity_summary":return{...o,...o.idNumberMasked===void 0&&o.summaryKind==="partial"&&u!==null?{idNumberMasked:u,nniMasked:u}:{},portrait:r(async()=>{let d=e.runtime.client;if(!o.portraitAvailable||d.identityPortrait===void 0)return null;try{return await d.identityPortrait()}catch{return null}},"portrait"),confirm:r(()=>g("confirm"),"confirm"),retake:r(()=>o.retakeAvailable?g("retake"):Promise.reject(new RangeError("no retake is left")),"retake")};case"liveness":return{...o,capture:r(d=>e.liveness(d),"capture"),onLivePhoto:r(d=>o.livePhoto?.icao===!0&&e.onLivePhoto!==void 0?e.onLivePhoto(d):()=>{},"onLivePhoto")};case"mobile_required":case"native_app_required":case"processing":return{...o,refresh:r(async()=>{i=!1,await e.refreshView()},"refresh")};case"unsupported":case"result":return{...o};default:{let d=o;throw new Error(`runner: unhandled step ${JSON.stringify(d)}`)}}},"k"),C=r(o=>m(D(o)),"A"),B=r(async()=>{if(!l){l=!0;try{for(let o of qr){if(await e.sleep(o),!t||e.destroyed())return;let d=await e.refreshView().catch(()=>null);if(d!==null&&Y(d,{isMobile:e.isMobile()}).kind!=="processing")return}i=!0,z()}finally{l=!1}}},"T"),N=r(o=>{if(o.kind!=="liveness"||o.mode!=="selfie")return null;let d={kind:"processing",key:"processing",context:o.context,section:o.section,stalled:!1};if(w==="inflight")return d;if(!y||w==="done")return null;let p=e.keptFaceKey?.()??null;return p===null?null:(w="inflight",I("face_match",(k,E)=>k.submitCheck("face_match",{imageKey:p},{idempotencyKey:E}),()=>{w="done"}).then(()=>{w==="inflight"&&(w="done",z())},()=>{w="done",z()}),d)},"H"),H=r((o,d=!1)=>{if(!t||e.destroyed()||e.chainBusy())return;let p=Y(o,{isMobile:e.isMobile()});p.kind==="registry"&&p.recheck&&(y=!0,w="idle"),p=N(p)??p,p.kind==="processing"?p.stalled=i:i=!1;let k=C(p),E=p.kind==="result"?void 0:p.context.switchable,L=E===void 0?k:{...k,chooseOption:r(q=>V({nodeId:E.nodeId,kind:E.kind,selected:E.current,options:E.options},q),"chooseOption")},K=JSON.stringify(L);p.kind==="registry"&&p.source==="document"&&p.state==="pending"&&!A.has("registry")&&(A.add("registry"),L.confirm().catch(q=>{(!(q instanceof G)||Qr.has(q.code))&&A.delete("registry")})),!(!d&&K===a)&&(a=K,n=L,e.emitStep(L),p.kind==="processing"&&!i&&w!=="inflight"&&B(),p.kind==="result"&&!s&&(s=!0,e.emitResult(p.result)))},"R");function z(){let o=e.currentView();o!==null&&H(o,!0)}return r(z,"M"),{run:r(async()=>{if(e.destroyed())throw new Error("verification destroyed");t=!0;let o=await e.ensureView();return n===null&&H(o),n??C(Y(o,{isMobile:e.isMobile()}))},"run"),current:r(()=>n,"current"),onView:r(o=>H(o),"onView"),onChainIdle:r(()=>{let o=e.currentView();o!==null&&H(o)},"onChainIdle"),republish:z,submit:I,faceProbeSkipped:r(()=>f,"faceProbeSkipped")}}r(mt,"lr");function Yr(e){switch(e.kind){case"document":return"doc_ocr";case"liveness":return e.mode==="selfie"?"face_match":"liveness";case"portrait":return e.phase==="capture"?"portrait_icao":null;case"proof_of_address":return"poa";case"mobile_required":case"native_app_required":return e.checkType;case"unsupported":return e.checkType==="nfc_chip"?"nfc_chip":null;default:return null}}r(Yr,"Mn");function Jr(e,t){let n=e,a=n?.plan?.steps??n?.steps;return Array.isArray(a)?a.some(i=>i.checkType===t&&typeof i.reason=="string"):!1}r(Jr,"On");var Xr=2e4,en=new Set(["media_type_unsupported","media_type_mismatch"]),ht=new Set(["document_upload_not_allowed","portrait_source_not_allowed","uploaded_media_not_allowed"]);function tn(e){let t=null,n=Promise.resolve(),a=!1,i=null,l=null,s=!1,c=null,b=!1,A=!1,f=r(()=>{t?.controller.handle.destroy(),t=null},"M"),y=r(()=>{let g=e.currentView(),S=g===null?null:Y(g,{isMobile:e.isMobile()});return S?.kind==="portrait"?S:null},"n"),u=r(()=>{if(e.destroyed())return"self";let g=e.currentView(),S=g===null?void 0:re(g);return S==="self"||S==="assisted"?S:S==="choice"&&e.captureModeSwitch!==void 0?e.captureModeSwitch.pick()??"self":e.cameraMode?.()??De(S??Ve(g),null)},"l"),w=e.captureModeSwitch,P=w===void 0?void 0:{session:r(()=>{let g=e.currentView();return g!==null&&re(g)==="choice"?"choice":u()},"session"),onModeChange:r(g=>w.choose(g),"onModeChange")},M=r(async(g,S)=>{if(e.destroyed())return;let v=u();S.setFlowState("uploading"),a=!1;let _=null;try{await e.runner().submit("portrait_icao",async(x,j)=>{if(_===null){let m=await X(x,"image","image/jpeg",g.image.size,{engine:"portrait"});await x.uploadToSpaces(m.uploadUrl,g.image,"image/jpeg"),_=(await x.completeMedia(m.key)).key}S.setFlowState("checking");let U={media:{portrait:_},gate:ae(g.gate),...g.tuningVersion!==void 0?{tuningVersion:g.tuningVersion}:{},source:"camera",capture:{mode:v,facingMode:g.facingMode}};return x.submitCheck("portrait_icao",U,{idempotencyKey:j})})}catch(x){a=!0,x instanceof G&&ht.has(x.code)&&await e.refreshView?.().catch(()=>{})}if(S.setFlowState("done"),e.destroyed())return;let h=y();(h===null||h.phase!=="capture")&&t?.controller===S&&f(),e.runner().republish()},"v"),O=r(g=>e.runner().submit("face_match",(S,v)=>S.submitCheck("face_match",e.runner().faceProbeSkipped()?{simulatedCapture:!0}:{},{idempotencyKey:v})).then(()=>{},()=>{a=!0,g()}),"F"),I=null,R=r(async g=>{let S=y();if(S===null||S.phase!=="capture"||!S.photo.uploadOffered)throw new RangeError("upload_not_offered");let{prepareUploadFile:v}=await import("./upload-file-EGXXM6TQ-NNVVB5QQ.js"),_=await v(g,e.uploadInternals);if(e.destroyed())return;f(),a=!1;let h=null;try{await e.runner().submit("portrait_icao",async(x,j)=>{if(h===null){let m=await x.presign("image",_.contentType,_.blob.size,{source:"upload"});await x.uploadToSpaces(m.uploadUrl,_.blob,_.contentType),h=(await x.completeMedia(m.key)).key}let U={media:{portrait:h},source:"upload"};return x.submitCheck("portrait_icao",U,{idempotencyKey:j})})}catch(x){throw x instanceof G&&en.has(x.code)?new TypeError("unsupported_file"):(x instanceof G&&ht.has(x.code)&&await e.refreshView?.().catch(()=>{}),x)}},"k"),F=null,V=r(g=>{if(F!==null)return F;let S=y();if(S===null||S.phase!=="review")return Promise.reject(new RangeError("no_pending_fix"));let v={fixReview:{accept:g}},_=e.runner().submit("portrait_icao",(h,x)=>h.submitCheck("portrait_icao",v,{idempotencyKey:x})).catch(async h=>{throw h instanceof G&&h.code==="portrait_no_pending_fix"&&await e.refreshView?.().catch(()=>{}),h}).finally(()=>{F=null});return F=_,_},"T"),Z=r(g=>{let S=r(()=>R(g),"t"),v=(I===null?S():I.then(S,S)).finally(()=>{I===v&&(I=null)});return I=v,v},"B");return{bind:r((g,S)=>{if(g.phase==="review")return f(),{...g,uploadFailed:a,resubmit:r(()=>Promise.resolve(),"resubmit"),capture:r(()=>{throw new Error("the adjusted photo waits for confirmFix()")},"capture"),uploadPortrait:r(()=>Promise.reject(new RangeError("upload_not_offered")),"uploadPortrait"),confirmFix:V};if(g.phase==="match")return f(),i!==g.attemptsRemaining&&!a&&(i=g.attemptsRemaining,O(S)),{...g,uploadFailed:a,resubmit:r(()=>(a=!1,i=g.attemptsRemaining,S(),O(S)),"resubmit"),capture:r(()=>{throw new Error("the portrait was already accepted")},"capture"),uploadPortrait:r(()=>Promise.reject(new RangeError("upload_not_offered")),"uploadPortrait"),confirmFix:V};if(i=null,g.reuse===!0&&g.phase==="capture")return f(),!b&&c!==g.attemptsRemaining&&(c=g.attemptsRemaining,b=!0,e.runner().submit("portrait_icao",(_,h)=>_.submitCheck("portrait_icao",{},{idempotencyKey:h})).then(()=>{A=!1},()=>{A=!0}).finally(()=>{b=!1,S()})),{kind:"processing",key:"processing",context:g.context,section:g.section,stalled:A&&!b,refresh:r(()=>(A=!1,c=null,S(),Promise.resolve()),"refresh")};let v=e.keptPortraitInput?.()??null;return v!==null&&(s||v!==l&&g.report===null&&g.reason===void 0&&!g.retakeOnly)?(s||(l=v,s=!0,e.runner().submit("portrait_icao",(_,h)=>_.submitCheck("portrait_icao",v,{idempotencyKey:h})).catch(()=>{}).finally(()=>{s=!1,S()})),{kind:"processing",key:"processing",context:g.context,section:g.section,stalled:!1,refresh:r(()=>Promise.resolve(),"refresh")}):{...g,uploadFailed:a,resubmit:r(()=>Promise.resolve(),"resubmit"),capture:r(_=>{if(t!==null&&t.video===_.video)return t.controller.handle;f(),a=!1;let h=qe({video:_.video,tuning:g.tuning,tuningVersion:g.tuningVersion,...g.icao!=null?{policy:g.icao.policy}:{},..._.keepScreenAwake!==void 0?{keepScreenAwake:_.keepScreenAwake}:{},..._.assetBaseUrl!==void 0?{assetBaseUrl:_.assetBaseUrl}:{}},e.internals,u,P);t={video:_.video,controller:h};let x=h.handle.destroy;h.handle.destroy=()=>{t?.controller===h&&(t=null),x()},h.handle.on("error",m=>{e.reportCaptureIssue?.(ue("portrait",m,0))});let j=!1,U=r((m,T)=>{let D=h.gateScores();D!==null&&e.reportGate?.({kind:"portrait_gate",platform:"web",outcome:m,...T!==null?{failing:T}:{},...D})},"P");return h.handle.on("gate",m=>{!j&&!m.ready&&(h.gateScores()?.elapsedMs??0)>=Xr&&(j=!0,U("stuck",m.failing))}),h.handle.on("captured",m=>{U("captured",null),j=!1,n=n.then(()=>M(m,h)).catch(()=>{})}),h.handle},"capture"),uploadPortrait:Z,confirmFix:V}},"bind"),destroy:f}}r(tn,"se");var rn=.92,nn=r(()=>ze("environment",{width:{ideal:1920},height:{ideal:1080}},{getUserMedia:r(e=>navigator.mediaDevices.getUserMedia(e),"getUserMedia"),enumerateDevices:r(()=>navigator.mediaDevices.enumerateDevices(),"enumerateDevices")}),"Pe"),an=r(e=>{let t=document.createElement("canvas");t.width=e.videoWidth,t.height=e.videoHeight;let n=t.getContext("2d");return n===null||t.width===0||t.height===0?Promise.reject(new Error("the camera has no frame yet")):(n.drawImage(e,0,0,t.width,t.height),new Promise((a,i)=>t.toBlob(l=>l===null?i(new Error("the still could not be encoded")):a(l),"image/jpeg",rn)))},"be"),on=r((e,t)=>{try{e.muted=!0,e.playsInline=!0,e.srcObject=t,e.play().catch(()=>{})}catch{}},"ke");function ln(e){let t=null,n=null,a=r(y=>{let u=(n===null?y():n.then(y,y)).finally(()=>{n===u&&(n=null)});return n=u,u},"c"),i=r(()=>{t?.handle.destroy(),t=null},"m"),l=r(()=>{let y=e.currentView(),u=y===null?null:Y(y,{isMobile:e.isMobile()});return u?.kind==="proof_of_address"?u:null},"y"),s=r(async(y,u)=>{if(u.length===0)throw new RangeError("no_pages");if(u.length>y.maxPages)throw new RangeError("too_many_pages");let{pdfFileKind:w,prepareUploadFile:P}=await import("./upload-file-EGXXM6TQ-NNVVB5QQ.js"),M=await Promise.all(u.map(I=>w(I)));if(M.includes("bad"))throw new TypeError("unsupported_file");if(M.includes("pdf")){if(u.length>1)throw new RangeError("too_many_pages");let I=u[0];if(I.size>y.pdf.maxBytes)throw new RangeError("file_too_large");return[{kind:"document_file",blob:I,contentType:"application/pdf"}]}let O=[];for(let I of u){let R=await P(I,e.uploadInternals);O.push({kind:"image",blob:R.blob,contentType:R.contentType})}return O},"w"),c=r(async(y,u,w)=>{let P=null;try{await e.runner().submit("poa",async(M,O)=>{if(P===null){let R=[];for(let F of w){let V=u==="upload"?await M.presign(F.kind,F.contentType,F.blob.size,{source:"upload"}):await X(M,F.kind,F.contentType,F.blob.size,{engine:"poa_page"});await M.uploadToSpaces(V.uploadUrl,F.blob,F.contentType),R.push((await M.completeMedia(V.key)).key)}P=R}let I=w[0]?.kind==="document_file"?{part:y,source:"upload",pdfKey:P[0]}:{part:y,source:u,imageKeys:P};return M.submitCheck("poa",I,{idempotencyKey:O})})}catch(M){throw M instanceof G&&(M.code==="media_type_unsupported"||M.code==="media_type_mismatch")?new TypeError("unsupported_file"):(M instanceof G&&(M.code==="document_upload_not_allowed"||M.code==="uploaded_media_not_allowed")&&await e.refreshView?.().catch(()=>{}),M)}},"C"),b=r(async(y,u)=>{let w=l();if(w===null||!w.photo.uploadOffered)throw new RangeError("upload_not_offered");if(y==="holder_letter"&&w.phase!=="holder_letter")throw new RangeError("holder_letter_not_requested");let P=await s(w,u);e.destroyed()||(i(),await c(y,"upload",P))},"I"),A=r((y,u)=>{let w=null,P=[],M=!0,O=r(()=>{for(let R of w?.getTracks()??[])R.stop();w=null},"F"),I={get pages(){return P},start:r(async()=>{if(!M||w!==null)return;let R=await(e.pageCamera?.open??nn)();if(!M){for(let F of R.getTracks())F.stop();return}w=R,(e.pageCamera?.attach??on)(y,R)},"start"),takePage:r(async()=>{if(P.length>=u)throw new RangeError("too_many_pages");let R=await(e.pageCamera?.grab??an)(y);if(P.length>=u)throw new RangeError("too_many_pages");return P=[...P,R],R},"takePage"),removePage:r(R=>{P=P.filter((F,V)=>V!==R)},"removePage"),submitPages:r(()=>a(async()=>{if(P.length===0)throw new RangeError("no_pages");let R=l();if(R===null)throw new RangeError("camera_not_offered");let F=R.phase==="holder_letter"?"holder_letter":"document";await c(F,"camera",P.map(V=>({kind:"image",blob:V,contentType:"image/jpeg"}))),t?.handle===I?i():I.destroy()}),"submitPages"),destroy:r(()=>{M=!1,P=[],O(),t?.handle===I&&(t=null)},"destroy")};return I},"D"),f=r(async()=>{let y=l();if(y===null||!y.licenceAddressAccepted)throw new RangeError("licence_address_not_accepted");if(e.destroyed())return;i();let u={part:"document"};await e.runner().submit("poa",(w,P)=>w.submitCheck("poa",u,{idempotencyKey:P}))},"M");return{bind:r(y=>({...y,...y.licenceAddressAccepted?{useLicenceAddress:r(()=>a(f),"useLicenceAddress")}:{},uploadPages:r(u=>a(()=>b("document",u)),"uploadPages"),uploadHolderLetter:r(u=>a(()=>b("holder_letter",u)),"uploadHolderLetter"),capturePage:r(u=>{if(y.photo.source==="upload")throw new RangeError("camera_not_offered");if(t!==null&&t.video===u.video)return t.handle;i();let w=A(u.video,y.maxPages);return t={video:u.video,handle:w},w},"capturePage")}),"bind"),destroy:i}}r(ln,"ue");function sn(e,t){let n=null,a=null,i=!1,l=null,s=null,c=[],b=r((f,y)=>{f.off=y.on(f.event,f.handler)},"I"),A=r(()=>(a??(a=e.then(f=>{if(i)return null;let y=t(f),u=y.handle;for(let w of c)w.removed||b(w,u);return l!==null&&u.setSide(l),s!==null&&u.setGuide(s.guide),n=y,u}).catch(()=>{if(a=null,!i)for(let f of c)!f.removed&&f.event==="error"&&f.handler({kind:"generic",retryable:!0});return null})),a),"D");return{handle:{get state(){return n?.handle.state??"idle"},on:r((f,y)=>{let u={event:f,handler:y,off:null,removed:!1};return c.push(u),n!==null&&b(u,n.handle),()=>{u.removed=!0,u.off?.()}},"on"),start:r(async()=>{let f=await A();f!==null&&!i&&await f.start()},"start"),retry:r(()=>{n!==null?n.handle.retry():A().then(f=>f?.start())},"retry"),setSide:r(f=>{n!==null?n.handle.setSide(f):l=f},"setSide"),shutter:r(()=>n?.handle.shutter(),"shutter"),setTorch:r(f=>n?.handle.setTorch(f),"setTorch"),focusAt:r((f,y)=>n?.handle.focusAt(f,y),"focusAt"),setGuide:r(f=>{n!==null?n.handle.setGuide(f):s={guide:f}},"setGuide"),destroy:r(()=>{i=!0,n?.handle.destroy(),c.length=0},"destroy")},get plan(){return n?.plan??null},setFlowState:r(f=>n?.setFlowState(f),"setFlowState"),settle:r((f,y)=>n?.settle(f,y),"settle"),takeDeviceRead:r(f=>n?.takeDeviceRead(f)??null,"takeDeviceRead")}}r(sn,"ce");var cn=1500,dn=["ID-1","ID-2","ID-3"],un=["recto","verso","single"],pn=["td1","td2","td3"],fn=["pdf417","qr","datamatrix","aztec"],mn=["yes","no","some"],hn=["dmy","mdy","ymd"],yn=["gregorian","hijri","solar_hijri","thai_buddhist"],gn=24,ne=r(e=>typeof e=="object"&&e!==null&&!Array.isArray(e),"H"),ee=r((e,t)=>typeof e=="string"&&t.includes(e),"V"),yt=r((e,t)=>e===null||ee(e,t),"de");function bn(e){if(!ne(e))return null;let{side:t,portrait:n,mrz:a,barcode:i,scripts:l}=e;return!ee(t,un)||typeof n!="boolean"||!yt(a,pn)||!yt(i,fn)||!Array.isArray(l)||!l.every(s=>typeof s=="string")?null:{side:t,portrait:n,mrz:a,barcode:i,scripts:[...l]}}r(bn,"Ae");function vn(e){if(!ne(e))return null;let{id:t,format:n,mrzCode:a,chip:i,dates:l,sides:s}=e;if(typeof t!="string"||!ee(n,dn)||!(a===null||typeof a=="string")||!ee(i,mn)||!ne(l)||!ee(l.order,hn)||!ee(l.calendar,yn)||!Array.isArray(s)||s.length<1||s.length>2)return null;let c=s.map(bn);return c.some(b=>b===null)?null:{id:t,format:n,mrzCode:a,chip:i,dates:{order:l.order,calendar:l.calendar},sides:c}}r(vn,"Ee");function _n(e,t,n){if(!ne(e)||e.country!==t||e.documentType!==n)return null;let{version:a,series:i}=e;if(typeof a!="number"||!Number.isInteger(a)||!Array.isArray(i)||i.length>gn)return null;let l=i.map(vn);return l.some(s=>s===null)?null:{country:t,documentType:n,version:a,series:l}}r(_n,"xe");function wn(e){return e.series.map(t=>({format:t.format,sides:t.sides}))}r(wn,"pe");function kn(e){return ne(e)&&"success"in e&&"data"in e?e.data:e}r(kn,"Oe");function xn(e,t={}){let n=e;if(n===null||typeof n.apiOrigin!="string"||typeof n.sessionToken!="string")return;let a=n.apiOrigin,i=n.sessionToken,l=t.timeoutMs??cn;return(s,c)=>{let b=t.fetchImpl??(typeof fetch=="function"?fetch:void 0);if(b===void 0)return Promise.resolve(null);let A=typeof AbortController=="function"?new AbortController:void 0,f,y=new Promise(w=>{f=setTimeout(()=>{A?.abort(),w(null)},l)}),u=(async()=>{let w=`country=${encodeURIComponent(s)}&type=${encodeURIComponent(c)}`,P=await b(`${a}/api/v2/hosted/document-facts?${w}`,{method:"GET",headers:{"x-session-token":i,"x-sekyro-sdk":`@sekyro/web/${de}`},cache:"default",...A!==void 0?{signal:A.signal}:{}});return P.ok?_n(kn(await P.json()),s,c):null})().catch(()=>null);return Promise.race([u,y]).finally(()=>clearTimeout(f))}}r(xn,"me");function gt(e){let t=e;if(typeof t.apiOrigin!="string"||typeof t.sessionToken!="string")return;let n=`${t.apiOrigin}/api/v2/hosted/capture-reports`,a=t.sessionToken;return i=>{try{fetch(n,{method:"POST",headers:{"content-type":"application/json","x-session-token":a,"x-sekyro-sdk":`@sekyro/web/${de}`},body:JSON.stringify({reports:i}),keepalive:!0}).catch(()=>{})}catch{}}}r(gt,"fe");function bt(e){let t=e.apiOrigin;return Ze("sdk",typeof t=="string"&&/staging|sandbox|localhost/.test(t)?"sandbox":"live")}r(bt,"ge");function An(e){return bt(e).replace(/\/ocr$/,"/barcode")}r(An,"Le");function Gn(e){let t=null,n=null,a=null,i=Te(),l=Promise.resolve(),s=r(()=>{a?.flow.handle.destroy(),a=null},"w"),c=null,b=r(()=>e.documentInternals?.catalogCapture??e.currentView()?.capture?.document?.catalog===!0,"I"),A=r((v,_)=>{let h=`${v}:${_}`;if(c?.key===h)return c;if(c=null,!b()||e.documentInternals?.captureSeries!==void 0)return null;let x=e.documentFacts??xn(e.runtime.client);if(x===void 0)return null;let j={key:h,promise:Promise.resolve(null),settled:!1,value:null};return j.promise=x(v,_).catch(()=>null).then(U=>(j.value=U,j.settled=!0,U)),c=j,j},"D"),f=r(v=>v===null?{}:{documentType:v.documentType,documentCountry:v.issuer},"M"),y=r(async(v,_,h)=>{if(e.destroyed())return;_.setFlowState("uploading");let x=null,j=f(h),U,m=!1,T=e.currentView()?.documents!==void 0;try{await t.submit("doc_ocr",async(N,H)=>{if(x===null){let z=await X(N,"image","image/jpeg",v.image.size,{engine:"document"});await N.uploadToSpaces(z.uploadUrl,v.image,"image/jpeg"),x=(await N.completeMedia(z.key)).key}return _.setFlowState("checking"),U===void 0&&(U=_.takeDeviceRead(v)),N.submitCheck("doc_ocr",{imageKey:x,side:v.side,...U!==null?{deviceRead:U}:{},...T?{source:"camera"}:{},...j},{idempotencyKey:H})})}catch{m=!0}finally{_.setFlowState("done")}if(e.destroyed())return;if(m){_.settle(v.side,{ok:!1,issue:"technical"});return}let D=e.currentView(),C=D===null?null:Y(D,{isMobile:e.isMobile()});if(C?.kind!=="document"){_.settle(v.side,{ok:!0}),a?.flow===_?s():_.handle.destroy();return}if(C.reason==="document_type_not_accepted"||C.reason==="document_type_not_supported"){n=null,a?.flow===_&&s(),t.republish();return}let B=C.acceptedSides;v.side!=="single"&&(B.includes(v.side)||C.reason==="side_missing")&&!(B.includes("recto")&&B.includes("verso"))?(_.settle(v.side,{ok:!0}),n?.documentType!=="passport"&&_.handle.setSide(C.side)):C.reason==="document_sides_mismatch"&&B.length===0?(_.settle(v.side,{ok:!1,issue:"reread"}),_.handle.retry()):_.settle(v.side,{ok:!1,issue:"reread"})},"n"),u=null,w=r(async v=>{let _=e.currentView(),h=_===null?null:Y(_,{isMobile:e.isMobile()});if(_===null||h?.kind!=="document")throw new RangeError("upload_not_offered");if(!h.photo.uploadOffered)throw new RangeError("upload_not_offered");let x=n,j=x?.documentType==="passport"?"single":h.side,{prepareUploadFile:U}=await import("./upload-file-EGXXM6TQ-NNVVB5QQ.js"),m=await U(v,e.uploadInternals);if(e.destroyed())return;s();let T=null,D=f(x);try{await t.submit("doc_ocr",async(C,B)=>{if(T===null){let N=await C.presign("image",m.contentType,m.blob.size,{source:"upload"});await C.uploadToSpaces(N.uploadUrl,m.blob,m.contentType),T=(await C.completeMedia(N.key)).key}return C.submitCheck("doc_ocr",{imageKey:T,side:j,source:"upload",...D},{idempotencyKey:B})})}catch(C){throw C instanceof G&&(C.code==="media_type_unsupported"||C.code==="media_type_mismatch")?new TypeError("unsupported_file"):(C instanceof G&&(C.code==="document_upload_not_allowed"||C.code==="uploaded_media_not_allowed")&&await e.refreshView().catch(()=>{}),C)}},"p"),P=r((v,_)=>({...v,uploadDocument:r(h=>{let x=r(()=>w(h),"i"),j=(u===null?x():u.then(x,x)).finally(()=>{u===j&&(u=null)});return u=j,j},"uploadDocument"),issuer:n?.issuer??null,documentType:n?.documentType??null,captureSide:n===null?null:n.documentType==="passport"?"single":v.side,selectDocument:r((h,x)=>{if(!rt(v.documents).includes(h)||!ve(v.documents,h).includes(x))throw new RangeError(`${x} from ${h} is not accepted`);(n?.issuer!==h||n.documentType!==x)&&s(),n={issuer:h,documentType:x},A(h,x),_()},"selectDocument"),capture:r(h=>{if(n===null)throw new Error("selectDocument() first");if(a!==null&&a.video===h.video)return a.flow.handle;s();let x=n,j=x.documentType==="passport"?"single":v.acceptedSides.length>0?v.side:void 0,U=r(C=>He({video:h.video,documentType:x.documentType,issuer:x.issuer,...j!==void 0?{side:j}:{},...h.keepScreenAwake!==void 0?{keepScreenAwake:h.keepScreenAwake}:{},...h.liveMrz!==void 0?{liveMrz:h.liveMrz}:{},...h.barcodeAssetBaseUrl!==void 0?{barcodeAssetBaseUrl:h.barcodeAssetBaseUrl}:{}},{...e.documentInternals??{},...(()=>{let B=e.currentView()?.capture?.document,N=e.documentInternals?.blurRefuseSharpnessMax??B?.scan?.blurRefuseSharpnessMax;return{engineOptions:{camera:Ke(B?.camera),shutter:Ge(B?.scan),guideLock:$e(B?.guide),...e.documentInternals?.engineOptions??{}},...typeof N=="number"&&Number.isFinite(N)&&N>=0&&N<=1?{blurRefuseSharpnessMax:N}:{},catalogCapture:e.documentInternals?.catalogCapture??B?.catalog===!0,...C!==null&&e.documentInternals?.captureSeries===void 0?{captureSeries:wn(C)}:{}}})(),deferRead:!0,...e.documentInternals?.barcode!==void 0?{}:{barcode:{assetBaseUrl:An(e.runtime.client)}},...(()=>{let B=e.currentView();if(B===null||e.documentInternals?.webOcr!==void 0)return{};let N=gt(e.runtime.client);return{webOcr:{captureDocument:B.capture?.document,salt:B.sessionId,baseUrl:bt(e.runtime.client),...N!==void 0?{reports:N}:{}}}})()}),"S"),m=A(x.issuer,x.documentType),T=m===null||m.settled?U(m?.value??null):sn(m.promise,U);a={video:h.video,flow:T};let D=T.handle.destroy;return T.handle.destroy=()=>{a?.flow===T&&(a=null),D()},i.newHandle(),T.handle.on("state",C=>i.note(C)),T.handle.on("error",C=>{i.noteError(),e.reportCaptureIssue?.(ue("document",C,i.value))}),T.handle.on("captured",C=>{l=l.then(()=>y(C,T,x)).catch(()=>{})}),T.handle},"capture")}),"h"),M=null,O=null,I=new Set,R=e.runtime.client;e.runtime.client=new Proxy(R,{get(v,_){if(_==="submitCheck")return(O??v).submitCheck.bind(O??v);let h=Reflect.get(v,_);return typeof h=="function"?h.bind(v):h}});let F=r(()=>{M?.destroy(),M=null,O=null},"_"),V=r(v=>{let _=e.currentView(),h=_===null?null:Y(_,{isMobile:e.isMobile()});if(_===null||h?.kind!=="liveness"||h.livePhoto?.icao!==!0)return;if(M===null){let m=nt({tuning:_.capture?.icao??null,tuningVersion:_.capture?.tuningVersion??null,...h.icao!=null?{policy:h.icao.policy}:{},still:h.livePhoto.still,...v.assetBaseUrl!==void 0?{assetBaseUrl:v.assetBaseUrl}:{}},e.livePhotoInternals);M=m,O=m.decorate(R),m.onGate(T=>{for(let D of I)D(T)})}let x=M,j=e.baseCapture??{},U=j.engineOptions?.telemetry;return{...j,engineOptions:{...j.engineOptions??{},measureQuality:x.engineOptions.measureQuality,telemetry:r(m=>{U?.(m),x.engineOptions.telemetry(m)},"telemetry")}}},"T"),Z=tn({keptPortraitInput:r(()=>M?.lastPortraitInput()??null,"keptPortraitInput"),runner:r(()=>t,"runner"),currentView:e.currentView,...e.cameraMode!==void 0?{cameraMode:e.cameraMode}:{},...e.captureModeSwitch!==void 0?{captureModeSwitch:e.captureModeSwitch}:{},destroyed:e.destroyed,isMobile:e.isMobile,...e.portraitInternals!==void 0?{internals:e.portraitInternals}:{},...e.uploadInternals!==void 0?{uploadInternals:e.uploadInternals}:{},refreshView:r(()=>e.refreshView(),"refreshView"),...e.reportCaptureIssue!==void 0?{reportCaptureIssue:e.reportCaptureIssue}:{},reportGate:r(v=>gt(e.runtime.client)?.([v]),"reportGate")}),g=ln({runner:r(()=>t,"runner"),currentView:e.currentView,destroyed:e.destroyed,isMobile:e.isMobile,...e.uploadInternals!==void 0?{uploadInternals:e.uploadInternals}:{},...e.pageCameraInternals!==void 0?{pageCamera:e.pageCameraInternals}:{},refreshView:r(()=>e.refreshView(),"refreshView")}),S=mt({...e,bindDocument:P,bindPortrait:Z.bind,bindProofOfAddress:g.bind,stopCameras:r(()=>{s(),Z.destroy(),g.destroy(),F(),e.stopLiveness?.()},"stopCameras"),onLivePhoto:r(v=>(I.add(v),()=>I.delete(v)),"onLivePhoto")});return t=S,{...S,captureInternals:V,destroy:r(()=>{s(),Z.destroy(),g.destroy(),F(),I.clear()},"destroy")}}r(Gn,"yt");export{An as barcodeAssetBase,Gn as createPlanRunner,gt as reportSink,bt as sdkAssetBase};
@@ -1 +1 @@
1
- "use client";import{a as N}from"./chunk-YFJBTK3L.js";import"./chunk-CSKOH7QX.js";import{a as te}from"./chunk-VHNWBOKW.js";import{c as X}from"./chunk-BMUUDLFA.js";import"./chunk-Q5BUNNRN.js";import{a as ae,b as re,c as ie}from"./chunk-GZOBS7KG.js";import"./chunk-AARN2MG7.js";import"./chunk-SDK2YXFV.js";import"./chunk-5JWGGQBH.js";import{B as Y,G as Z,K as f,L as ee,a as ke,b as ye,c as C,t as Q}from"./chunk-JJ3Q52P3.js";import"./chunk-YLH3WX7Y.js";import"./chunk-GPGK6XZM.js";import"./chunk-4YBL75VD.js";import"./chunk-P7K7ELYZ.js";import{a as n}from"./chunk-5QL6W6FW.js";import"./chunk-6MYG4HWP.js";import"./chunk-JS2IXPNL.js";import{a as S,c as O}from"./chunk-4FHWXBOB.js";var i=O(ke(),1),e=O(ye(),1);var x=["pose","eyes","mouth","lighting","background","resolution"],se="occlusion";function le(r){return r?.startsWith("icao_")===!0?r.slice(5):null}S(le,"Se");n(le,"reasonCriterion");function ve({step:r,i18n:c,assetBaseUrl:M,onUpload:P}){let{t:a}=c,B=(0,i.useRef)(null),p=(0,i.useRef)(null),[s,oe]=(0,i.useState)("idle"),[k,L]=(0,i.useState)(null),[_,y]=(0,i.useState)(null),[$,E]=(0,i.useState)({facing:"user",assisted:!1}),[F,ne]=(0,i.useState)(!1),[de,I]=(0,i.useState)(!1),[j,ce]=(0,i.useState)(!1),pe=Q(),T=(0,i.useContext)(Y),U=(0,i.useContext)(ae),A=(0,i.useRef)(U);A.current=U,(0,i.useEffect)(()=>{let t=B.current;if(t===null)return;let l=r.capture({video:t,...M!==void 0?{assetBaseUrl:M}:{}});p.current=l;let g=n(()=>E({facing:l.facingMode??"user",assisted:l.captureMode==="assisted"}),"readCamera");g();let fe=[l.on("state",o=>{g(),o==="mode_switch"?I(!0):o!=="starting"&&o!=="gating"&&I(!1),oe(o)}),l.on("gate",L),l.on("error",o=>{y(o);let K=A.current;K!==null&&ie(K,re("portrait",o,0))})],J=!0;return Promise.resolve(l.canSwitchCaptureMode?.()??!1).catch(()=>!1).then(o=>{J&&ne(o===!0)}),l.start().catch(()=>{}),()=>{J=!1;for(let o of fe)o();l.destroy(),p.current=null}},[]);let u=s==="uploading"||s==="checking",h=s==="done",v=h&&r.reason!==void 0&&!r.uploadFailed,ue=s==="starting"||s==="idle"||s==="mode_switch"?"portrait.starting":s==="captured"?"portrait.taken":s==="uploading"?"portrait.uploading":s==="checking"?"portrait.checking":`portrait.coach.${k?.coach??"no_face"}`,R=(r.report??[]).filter(t=>!t.pass),V=r.reason!==void 0?`reasons.${r.reason}`:null,m=le(r.reason),q=R.filter(t=>t.criterion!==m),H=new Set([...R.map(t=>t.criterion),...m!==null?[m]:[]]),he=H.has(se),W=n(()=>{y(null),p.current?.retry()},"retake"),w=n(t=>{let l=k?.criteria.find(g=>g.criterion===t);return l!==void 0&&(l.held||l.waived)},"met"),me=k?.ready||s==="captured"||u?1:x.filter(w).length/x.length;v&&!j&&ce(!0);let z=V!==null&&(v||s==="gating"&&(m===null||!j)),ge=!v,D=s==="starting"||s==="gating"||s==="error"||s==="mode_switch",d=$.assisted?"self":"assisted",G=F&&D?{to:d,label:a(d==="assisted"?"capture.modeSwitch.toAssisted":"capture.modeSwitch.toSelfPhoto"),description:a(d==="assisted"?"capture.modeSwitch.toAssistedLabelPhoto":"capture.modeSwitch.toSelfLabelPhoto"),onSwitch:n(()=>{let t=p.current;t?.setCaptureMode(d).then(l=>{l&&(y(null),L(null),E({facing:t.facingMode??"user",assisted:d==="assisted"}))})},"onSwitch")}:null,b=de&&D?a("capture.modeSwitch.restarted"):null;return(0,e.jsxs)(te,{testId:"sekyro-portrait",video:(0,e.jsx)("video",{ref:B,className:`sekyro-lm-video sekyro-fc-video${$.facing==="environment"?" is-rear":""}`,playsInline:!0,muted:!0,autoPlay:!0,"aria-hidden":"true"}),instruction:a(ue),...b!==null?{note:b}:{},...F?{status:b}:{},progress:me,closeLabel:a("native.close"),...T!==void 0?{onClose:T}:{},...G!==null?{end:(0,e.jsx)(X,{view:G,className:"sekyro-glass sekyro-glass--label"})}:{},children:[(0,e.jsx)("h2",{ref:pe,tabIndex:-1,className:"sekyro-visually-hidden",children:a(r.reason!==void 0?"portrait.retryTitle":"session.steps.portrait.title")}),z||_!==null||h&&(r.uploadFailed||!r.attemptsExhausted)?(0,e.jsxs)("div",{className:"sekyro-fc-panel",children:[z?(0,e.jsxs)(f,{tone:"warning",children:[(0,e.jsx)("span",{children:N(c)(V)||a("portrait.retryTitle")}),q.length>0?(0,e.jsxs)("span",{children:[a("portrait.reportTitle"),": ",q.map(t=>a(`portrait.report.${t.criterion}`)).join(", ")]}):null,(0,e.jsx)("span",{children:ee(c,r.attemptsRemaining,r.attemptsExhausted)})]}):null,_!==null?(0,e.jsxs)(f,{tone:"danger",children:[(0,e.jsx)("span",{children:a("portrait.cameraBlocked")}),(0,e.jsx)("span",{children:a("portrait.cameraBlockedHint")}),(0,e.jsx)(C,{kind:"secondary",onClick:W,children:a("portrait.retryCamera")})]}):null,r.uploadFailed&&h?(0,e.jsx)(f,{tone:"danger",children:(0,e.jsx)("span",{children:a("portrait.uploadFailed")})}):null,h&&!r.attemptsExhausted?(0,e.jsx)(C,{full:!0,onClick:W,disabled:u,children:a("portrait.retake")}):null]}):null,ge?(0,e.jsxs)("ul",{className:"sekyro-fc-checks","aria-label":a("portrait.checksLabel"),children:[x.map(t=>(0,e.jsxs)("li",{className:w(t)?"is-met":H.has(t)?"is-flagged":void 0,"data-criterion":t,children:[(0,e.jsx)("span",{className:"sekyro-fc-mark","aria-hidden":"true",children:(0,e.jsx)("svg",{viewBox:"0 0 18 18",children:(0,e.jsx)("path",{d:"M5 9.2l2.6 2.6L13 6.4"})})}),(0,e.jsx)("span",{children:a(`portrait.criteria.${t}`)}),(0,e.jsx)("span",{className:"sekyro-visually-hidden",children:a(w(t)?"portrait.met":"portrait.notMet")})]},t)),he?(0,e.jsxs)("li",{className:"is-flagged","data-criterion":se,children:[(0,e.jsx)("span",{className:"sekyro-fc-mark","aria-hidden":"true",children:(0,e.jsx)("svg",{viewBox:"0 0 18 18",children:(0,e.jsx)("path",{d:"M5 9.2l2.6 2.6L13 6.4"})})}),(0,e.jsx)("span",{children:a("portrait.report.occlusion")}),(0,e.jsx)("span",{className:"sekyro-visually-hidden",children:a("portrait.notMet")})]}):null]}):null,P!==void 0&&!u?(0,e.jsx)("button",{type:"button",className:"sekyro-lm-upload",onClick:P,"data-testid":"sekyro-portrait-upload-instead",children:N(c)("portrait.source.uploadInstead")}):null,u?null:(0,e.jsx)(Z,{})]})}S(ve,"Le");n(ve,"PortraitCaptureView");export{ve as PortraitCaptureView};
1
+ "use client";import{a as N}from"./chunk-CPVOHNLU.js";import"./chunk-CSKOH7QX.js";import{a as te}from"./chunk-SHOVUF5C.js";import{c as X}from"./chunk-PYUD6W3P.js";import"./chunk-DEGFGNRM.js";import{a as ae,b as re,c as ie}from"./chunk-GZOBS7KG.js";import"./chunk-AARN2MG7.js";import"./chunk-26HXTRWG.js";import"./chunk-5JWGGQBH.js";import{B as Y,G as Z,K as f,L as ee,a as ke,b as ye,c as C,t as Q}from"./chunk-JJ3Q52P3.js";import"./chunk-A5SXWFOO.js";import"./chunk-DKZUKWGP.js";import"./chunk-F7DKVXQW.js";import"./chunk-P7K7ELYZ.js";import{a as n}from"./chunk-5QL6W6FW.js";import"./chunk-6MYG4HWP.js";import"./chunk-JS2IXPNL.js";import{a as S,c as O}from"./chunk-4FHWXBOB.js";var i=O(ke(),1),e=O(ye(),1);var x=["pose","eyes","mouth","lighting","background","resolution"],se="occlusion";function le(r){return r?.startsWith("icao_")===!0?r.slice(5):null}S(le,"Se");n(le,"reasonCriterion");function ve({step:r,i18n:c,assetBaseUrl:M,onUpload:P}){let{t:a}=c,B=(0,i.useRef)(null),p=(0,i.useRef)(null),[s,oe]=(0,i.useState)("idle"),[k,L]=(0,i.useState)(null),[_,y]=(0,i.useState)(null),[$,E]=(0,i.useState)({facing:"user",assisted:!1}),[F,ne]=(0,i.useState)(!1),[de,I]=(0,i.useState)(!1),[j,ce]=(0,i.useState)(!1),pe=Q(),T=(0,i.useContext)(Y),U=(0,i.useContext)(ae),A=(0,i.useRef)(U);A.current=U,(0,i.useEffect)(()=>{let t=B.current;if(t===null)return;let l=r.capture({video:t,...M!==void 0?{assetBaseUrl:M}:{}});p.current=l;let g=n(()=>E({facing:l.facingMode??"user",assisted:l.captureMode==="assisted"}),"readCamera");g();let fe=[l.on("state",o=>{g(),o==="mode_switch"?I(!0):o!=="starting"&&o!=="gating"&&I(!1),oe(o)}),l.on("gate",L),l.on("error",o=>{y(o);let K=A.current;K!==null&&ie(K,re("portrait",o,0))})],J=!0;return Promise.resolve(l.canSwitchCaptureMode?.()??!1).catch(()=>!1).then(o=>{J&&ne(o===!0)}),l.start().catch(()=>{}),()=>{J=!1;for(let o of fe)o();l.destroy(),p.current=null}},[]);let u=s==="uploading"||s==="checking",h=s==="done",v=h&&r.reason!==void 0&&!r.uploadFailed,ue=s==="starting"||s==="idle"||s==="mode_switch"?"portrait.starting":s==="captured"?"portrait.taken":s==="uploading"?"portrait.uploading":s==="checking"?"portrait.checking":`portrait.coach.${k?.coach??"no_face"}`,R=(r.report??[]).filter(t=>!t.pass),V=r.reason!==void 0?`reasons.${r.reason}`:null,m=le(r.reason),q=R.filter(t=>t.criterion!==m),H=new Set([...R.map(t=>t.criterion),...m!==null?[m]:[]]),he=H.has(se),W=n(()=>{y(null),p.current?.retry()},"retake"),w=n(t=>{let l=k?.criteria.find(g=>g.criterion===t);return l!==void 0&&(l.held||l.waived)},"met"),me=k?.ready||s==="captured"||u?1:x.filter(w).length/x.length;v&&!j&&ce(!0);let z=V!==null&&(v||s==="gating"&&(m===null||!j)),ge=!v,D=s==="starting"||s==="gating"||s==="error"||s==="mode_switch",d=$.assisted?"self":"assisted",G=F&&D?{to:d,label:a(d==="assisted"?"capture.modeSwitch.toAssisted":"capture.modeSwitch.toSelfPhoto"),description:a(d==="assisted"?"capture.modeSwitch.toAssistedLabelPhoto":"capture.modeSwitch.toSelfLabelPhoto"),onSwitch:n(()=>{let t=p.current;t?.setCaptureMode(d).then(l=>{l&&(y(null),L(null),E({facing:t.facingMode??"user",assisted:d==="assisted"}))})},"onSwitch")}:null,b=de&&D?a("capture.modeSwitch.restarted"):null;return(0,e.jsxs)(te,{testId:"sekyro-portrait",video:(0,e.jsx)("video",{ref:B,className:`sekyro-lm-video sekyro-fc-video${$.facing==="environment"?" is-rear":""}`,playsInline:!0,muted:!0,autoPlay:!0,"aria-hidden":"true"}),instruction:a(ue),...b!==null?{note:b}:{},...F?{status:b}:{},progress:me,closeLabel:a("native.close"),...T!==void 0?{onClose:T}:{},...G!==null?{end:(0,e.jsx)(X,{view:G,className:"sekyro-glass sekyro-glass--label"})}:{},children:[(0,e.jsx)("h2",{ref:pe,tabIndex:-1,className:"sekyro-visually-hidden",children:a(r.reason!==void 0?"portrait.retryTitle":"session.steps.portrait.title")}),z||_!==null||h&&(r.uploadFailed||!r.attemptsExhausted)?(0,e.jsxs)("div",{className:"sekyro-fc-panel",children:[z?(0,e.jsxs)(f,{tone:"warning",children:[(0,e.jsx)("span",{children:N(c)(V)||a("portrait.retryTitle")}),q.length>0?(0,e.jsxs)("span",{children:[a("portrait.reportTitle"),": ",q.map(t=>a(`portrait.report.${t.criterion}`)).join(", ")]}):null,(0,e.jsx)("span",{children:ee(c,r.attemptsRemaining,r.attemptsExhausted)})]}):null,_!==null?(0,e.jsxs)(f,{tone:"danger",children:[(0,e.jsx)("span",{children:a("portrait.cameraBlocked")}),(0,e.jsx)("span",{children:a("portrait.cameraBlockedHint")}),(0,e.jsx)(C,{kind:"secondary",onClick:W,children:a("portrait.retryCamera")})]}):null,r.uploadFailed&&h?(0,e.jsx)(f,{tone:"danger",children:(0,e.jsx)("span",{children:a("portrait.uploadFailed")})}):null,h&&!r.attemptsExhausted?(0,e.jsx)(C,{full:!0,onClick:W,disabled:u,children:a("portrait.retake")}):null]}):null,ge?(0,e.jsxs)("ul",{className:"sekyro-fc-checks","aria-label":a("portrait.checksLabel"),children:[x.map(t=>(0,e.jsxs)("li",{className:w(t)?"is-met":H.has(t)?"is-flagged":void 0,"data-criterion":t,children:[(0,e.jsx)("span",{className:"sekyro-fc-mark","aria-hidden":"true",children:(0,e.jsx)("svg",{viewBox:"0 0 18 18",children:(0,e.jsx)("path",{d:"M5 9.2l2.6 2.6L13 6.4"})})}),(0,e.jsx)("span",{children:a(`portrait.criteria.${t}`)}),(0,e.jsx)("span",{className:"sekyro-visually-hidden",children:a(w(t)?"portrait.met":"portrait.notMet")})]},t)),he?(0,e.jsxs)("li",{className:"is-flagged","data-criterion":se,children:[(0,e.jsx)("span",{className:"sekyro-fc-mark","aria-hidden":"true",children:(0,e.jsx)("svg",{viewBox:"0 0 18 18",children:(0,e.jsx)("path",{d:"M5 9.2l2.6 2.6L13 6.4"})})}),(0,e.jsx)("span",{children:a("portrait.report.occlusion")}),(0,e.jsx)("span",{className:"sekyro-visually-hidden",children:a("portrait.notMet")})]}):null]}):null,P!==void 0&&!u?(0,e.jsx)("button",{type:"button",className:"sekyro-lm-upload",onClick:P,"data-testid":"sekyro-portrait-upload-instead",children:N(c)("portrait.source.uploadInstead")}):null,u?null:(0,e.jsx)(Z,{})]})}S(ve,"Le");n(ve,"PortraitCaptureView");export{ve as PortraitCaptureView};
@@ -1 +1 @@
1
- "use client";import{a as r,b as t,c as i,d as o,e as a}from"./chunk-YFJBTK3L.js";import"./chunk-CSKOH7QX.js";import"./chunk-SDK2YXFV.js";import"./chunk-5JWGGQBH.js";import"./chunk-JJ3Q52P3.js";import"./chunk-5QL6W6FW.js";import"./chunk-4FHWXBOB.js";export{o as PortraitReviewView,a as PortraitScreens,t as PortraitSourceView,i as PortraitUploadView,r as portraitCopy};
1
+ "use client";import{a as r,b as t,c as i,d as o,e as a}from"./chunk-CPVOHNLU.js";import"./chunk-CSKOH7QX.js";import"./chunk-26HXTRWG.js";import"./chunk-5JWGGQBH.js";import"./chunk-JJ3Q52P3.js";import"./chunk-5QL6W6FW.js";import"./chunk-4FHWXBOB.js";export{o as PortraitReviewView,a as PortraitScreens,t as PortraitSourceView,i as PortraitUploadView,r as portraitCopy};
@@ -1 +1 @@
1
- "use client";import{a as J}from"./chunk-SIBJ56BG.js";import{a as S}from"./chunk-CSKOH7QX.js";import{a as q}from"./chunk-3DDOCOIB.js";import"./chunk-AARN2MG7.js";import{d as M}from"./chunk-SDK2YXFV.js";import"./chunk-5JWGGQBH.js";import{K as b,L as G,a as O,b as j,c as k,v as N,w as D,y as R}from"./chunk-JJ3Q52P3.js";import{a as p}from"./chunk-5QL6W6FW.js";import{a as l,c as x}from"./chunk-4FHWXBOB.js";var v=x(O(),1),f=x(O(),1),o=x(j(),1),t=x(j(),1);var ee={"poa.title":"إثبات العنوان","poa.lead":"ارفع وثيقة حديثة تُظهر اسمك وعنوانك الحالي.","poa.accepted":"الوثائق المقبولة","poa.acceptedFor":"مقبول في {country}","poa.kindDated":"{kind}، صادر خلال آخر {days} يومًا","poa.kinds.utility_bill":"فاتورة كهرباء أو ماء أو غاز","poa.kinds.telecom_bill":"فاتورة هاتف أو إنترنت","poa.kinds.bank_statement":"كشف حساب بنكي","poa.kinds.tax_notice":"إشعار ضريبي","poa.kinds.rental_agreement":"عقد إيجار","poa.kinds.government_certificate":"شهادة السكن","poa.kinds.insurance_statement":"وثيقة تأمين","poa.source.camera":"التقاط صورة","poa.source.upload":"رفع ملف","poa.source.lead":"صورة للوثيقة، أو ملف PDF أو صورة من جهازك","poa.upload.hint":"PDF أو JPEG أو PNG، بحد أقصى 3 صفحات و10 ميغابايت","poa.upload.choose":"اختيار ملف","poa.upload.addPage":"إضافة صفحة","poa.upload.pages":"{count} من 3 صفحات","poa.upload.send":"إرسال الوثيقة","poa.upload.sending":"جارٍ إرسال وثيقتك…","poa.upload.unsupported":"نوع الملف هذا غير مقبول. اختر ملف PDF أو JPEG أو PNG","poa.upload.tooManyPages":"أرسل 3 صفحات على الأكثر. احذف صفحة أو اختر ملفًا أقصر","poa.upload.tooLarge":"حجم الملف يتجاوز 10 ميغابايت. اختر ملفًا أصغر","poa.upload.failed":"تعذّر إرسال الوثيقة. تحقّق من اتصالك وحاول مرة أخرى","poa.camera.lead":"ضع الوثيقة بشكل مسطّح واملأ الإطار. التقط صورة واحدة لكل صفحة","poa.camera.capture":"التقاط الصورة","poa.camera.retake":"إعادة الالتقاط","poa.camera.next":"الصفحة التالية","poa.camera.page":"الصفحة {number}","poa.letter.title":"رسالة من صاحب الفاتورة","poa.letter.lead":"الوثيقة باسم شخص آخر. أضف رسالة موقّعة من هذا الشخص تفيد بأنك تسكن في هذا العنوان","poa.letter.send":"إرسال الرسالة","poa.licence.use":"استخدام العنوان المذكور في رخصة القيادة","poa.licence.note":"قرأنا هذا العنوان من رخصتك. لا تحتاج إلى وثيقة أخرى.","poa.retry.document_too_old":"هذه الوثيقة أقدم من المسموح. ارفع وثيقة أحدث من القائمة أدناه","poa.retry.document_date_invalid":"تاريخ الوثيقة في المستقبل. ارفع وثيقة بتاريخ اليوم أو قبله","poa.retry.document_kind_not_accepted":"نوع هذه الوثيقة غير مقبول. ارفع إحدى الوثائق المذكورة أدناه","poa.retry.name_mismatch":"الاسم في الوثيقة لا يطابق اسمك. ارفع وثيقة باسمك","poa.retry.address_mismatch":"العنوان في الوثيقة لا يطابق العنوان الذي وصلنا. ارفع وثيقة لهذا العنوان","poa.retry.holder_letter_missing":"يجب أن تكون الرسالة موقّعة وأن تذكر اسمك واسم صاحب الفاتورة. ارفع رسالة كاملة","poa.retry.unreadable":"تعذّرت قراءة الوثيقة. ارفع نسخة كاملة وأكثر وضوحًا","poa.retry.pdf_protected":"أزل كلمة المرور من ملف PDF وحاول مرة أخرى","poa.retry.provider_unavailable":"تعذّر فحص الوثيقة حاليًا. حاول مرة أخرى بعد قليل","poa.hint.blurry":"الصورة غير واضحة","poa.hint.cropped":"جزء من الوثيقة مقطوع","poa.hint.glare":"يوجد انعكاس ضوء على الوثيقة","reasons.provider_unavailable":"تعذّر فحص الوثيقة حاليًا","reasons.pdf_protected":"ملف PDF محمي بكلمة مرور أو يحتوي على محتوى نشط","reasons.document_kind_not_accepted":"نوع الوثيقة غير مقبول","reasons.document_date_invalid":"تاريخ الوثيقة في المستقبل","reasons.document_too_old":"الوثيقة قديمة جدًا","reasons.document_tampered":"يبدو أن الوثيقة قد عُدّلت","reasons.holder_letter_required":"يلزم تقديم رسالة من صاحب الفاتورة","reasons.holder_letter_missing":"رسالة صاحب الفاتورة مفقودة أو غير مكتملة","reasons.address_mismatch":"العنوان لا يطابق العنوان المقدَّم"},U={"poa.title":"Proof of address","poa.lead":"Upload a recent document that shows your name and your current address.","poa.accepted":"Accepted documents","poa.acceptedFor":"Accepted for {country}","poa.kindDated":"{kind}, dated within the last {days} days","poa.kinds.utility_bill":"Electricity, water or gas bill","poa.kinds.telecom_bill":"Phone or internet bill","poa.kinds.bank_statement":"Bank statement","poa.kinds.tax_notice":"Tax notice","poa.kinds.rental_agreement":"Rental agreement","poa.kinds.government_certificate":"Residence certificate","poa.kinds.insurance_statement":"Insurance statement","poa.source.camera":"Take a photo","poa.source.upload":"Upload a file","poa.source.lead":"A photo of the document, or a PDF or image from your device","poa.upload.hint":"PDF, JPEG or PNG, up to 3 pages and 10 MB","poa.upload.choose":"Choose a file","poa.upload.addPage":"Add a page","poa.upload.pages":"{count} of 3 pages","poa.upload.send":"Send document","poa.upload.sending":"Sending your document…","poa.upload.unsupported":"This file type is not accepted. Choose a PDF, JPEG or PNG","poa.upload.tooManyPages":"Send at most 3 pages. Remove a page or choose a shorter file","poa.upload.tooLarge":"The file is over 10 MB. Choose a smaller file","poa.upload.failed":"We could not send the document. Check your connection and try again","poa.camera.lead":"Lay the document flat and fill the frame. Take one photo per page","poa.camera.capture":"Take photo","poa.camera.retake":"Retake","poa.camera.next":"Next page","poa.camera.page":"Page {number}","poa.letter.title":"Letter from the bill holder","poa.letter.lead":"The document is in another person's name. Add a signed letter from that person saying that you live at this address","poa.letter.send":"Send letter","poa.licence.use":"Use the address on my driver's license","poa.licence.note":"We read this address from your license. You don't need another document.","poa.retry.document_too_old":"This document is older than allowed. Upload a more recent one from the list below","poa.retry.document_date_invalid":"The date on the document is in the future. Upload a document with today's date or earlier","poa.retry.document_kind_not_accepted":"This document type is not accepted. Upload one of the documents listed below","poa.retry.name_mismatch":"The name on the document does not match yours. Upload a document in your name","poa.retry.address_mismatch":"The address on the document does not match the one we were given. Upload a document for that address","poa.retry.holder_letter_missing":"The letter must be signed and name both you and the bill holder. Upload a complete letter","poa.retry.unreadable":"We could not read the document. Upload a sharper, complete copy","poa.retry.pdf_protected":"Remove the password from the PDF and try again","poa.retry.provider_unavailable":"The document could not be checked right now. Try again in a moment","poa.hint.blurry":"The image is blurry","poa.hint.cropped":"Part of the document is cut off","poa.hint.glare":"There is glare on the document","reasons.provider_unavailable":"The document could not be checked right now","reasons.pdf_protected":"The PDF is password-protected or contains active content","reasons.document_kind_not_accepted":"The document type is not accepted","reasons.document_date_invalid":"The document date is in the future","reasons.document_too_old":"The document is too old","reasons.document_tampered":"The document appears to have been edited","reasons.holder_letter_required":"A letter from the bill holder is needed","reasons.holder_letter_missing":"The letter from the bill holder is missing or incomplete","reasons.address_mismatch":"The address does not match the one supplied"},ae={"poa.title":"Justificatif de domicile","poa.lead":"Importez un document récent qui indique votre nom et votre adresse actuelle.","poa.accepted":"Documents acceptés","poa.acceptedFor":"Accepté pour {country}","poa.kindDated":"{kind}, daté des {days} derniers jours","poa.kinds.utility_bill":"Facture d'électricité, d'eau ou de gaz","poa.kinds.telecom_bill":"Facture de téléphone ou d'internet","poa.kinds.bank_statement":"Relevé bancaire","poa.kinds.tax_notice":"Avis d'imposition","poa.kinds.rental_agreement":"Bail ou quittance de loyer","poa.kinds.government_certificate":"Certificat de résidence","poa.kinds.insurance_statement":"Attestation d'assurance","poa.source.camera":"Prendre une photo","poa.source.upload":"Importer un fichier","poa.source.lead":"Une photo du document, ou un PDF ou une image depuis votre appareil","poa.upload.hint":"PDF, JPEG ou PNG, 3 pages et 10 Mo au maximum","poa.upload.choose":"Choisir un fichier","poa.upload.addPage":"Ajouter une page","poa.upload.pages":"{count} sur 3 pages","poa.upload.send":"Envoyer le document","poa.upload.sending":"Envoi de votre document…","poa.upload.unsupported":"Ce type de fichier n'est pas accepté. Choisissez un PDF, un JPEG ou un PNG","poa.upload.tooManyPages":"Envoyez 3 pages au maximum. Retirez une page ou choisissez un fichier plus court","poa.upload.tooLarge":"Le fichier dépasse 10 Mo. Choisissez un fichier plus léger","poa.upload.failed":"Nous n'avons pas pu envoyer le document. Vérifiez votre connexion et réessayez","poa.camera.lead":"Posez le document à plat et remplissez le cadre. Prenez une photo par page","poa.camera.capture":"Prendre la photo","poa.camera.retake":"Reprendre","poa.camera.next":"Page suivante","poa.camera.page":"Page {number}","poa.letter.title":"Lettre du titulaire de la facture","poa.letter.lead":"Le document est au nom d'une autre personne. Ajoutez une lettre signée de cette personne attestant que vous habitez à cette adresse","poa.letter.send":"Envoyer la lettre","poa.licence.use":"Utiliser l'adresse de mon permis de conduire","poa.licence.note":"Nous avons lu cette adresse sur votre permis. Vous n'avez pas besoin d'un autre document.","poa.retry.document_too_old":"Ce document est plus ancien que la limite. Importez un document plus récent parmi ceux de la liste ci-dessous","poa.retry.document_date_invalid":"La date du document est dans le futur. Importez un document daté d'aujourd'hui ou d'avant","poa.retry.document_kind_not_accepted":"Ce type de document n'est pas accepté. Importez l'un des documents de la liste ci-dessous","poa.retry.name_mismatch":"Le nom sur le document ne correspond pas au vôtre. Importez un document à votre nom","poa.retry.address_mismatch":"L'adresse du document ne correspond pas à celle qui nous a été transmise. Importez un document pour cette adresse","poa.retry.holder_letter_missing":"La lettre doit être signée et nommer à la fois vous et le titulaire de la facture. Importez une lettre complète","poa.retry.unreadable":"Nous n'avons pas pu lire le document. Importez une copie plus nette et complète","poa.retry.pdf_protected":"Retirez le mot de passe du PDF et réessayez","poa.retry.provider_unavailable":"Le document n'a pas pu être vérifié pour le moment. Réessayez dans un instant","poa.hint.blurry":"L'image est floue","poa.hint.cropped":"Une partie du document est coupée","poa.hint.glare":"Il y a un reflet sur le document","reasons.provider_unavailable":"Le document n'a pas pu être vérifié pour le moment","reasons.pdf_protected":"Le PDF est protégé par un mot de passe ou contient du contenu actif","reasons.document_kind_not_accepted":"Ce type de document n'est pas accepté","reasons.document_date_invalid":"La date du document est dans le futur","reasons.document_too_old":"Le document est trop ancien","reasons.document_tampered":"Le document semble avoir été modifié","reasons.holder_letter_required":"Une lettre du titulaire de la facture est nécessaire","reasons.holder_letter_missing":"La lettre du titulaire de la facture est absente ou incomplète","reasons.address_mismatch":"L'adresse ne correspond pas à celle qui a été transmise"};function B({blob:a,label:n}){let[e,r]=(0,f.useState)(void 0);return(0,f.useEffect)(()=>{if(typeof URL.createObjectURL!="function")return;let d=URL.createObjectURL(a);return r(d),()=>URL.revokeObjectURL(d)},[a]),(0,o.jsx)("img",{src:e,alt:n})}l(B,"Q");p(B,"PageThumb");function $({step:a,i18n:n,c:e,title:r,notice:d,intro:m,onUpload:i}){let y=(0,f.useRef)(null),s=(0,f.useRef)(null),[c,_]=(0,f.useState)([]),[h,P]=(0,f.useState)(!1),[L,C]=(0,f.useState)("idle"),[K,F]=(0,f.useState)(!1),A=p(u=>{P(!1),u.start().catch(()=>P(!0))},"open");(0,f.useEffect)(()=>{let u=y.current;if(u===null)return;let g;try{g=a.capturePage({video:u})}catch{P(!0);return}return s.current=g,A(g),()=>{g.destroy(),s.current=null}},[]);let E=c.length>=a.maxPages,Q=p(async()=>{let u=s.current;if(!(u===null||E)){C("taking"),F(!1);try{await u.takePage()}catch{}_([...u.pages]),C("idle")}},"take"),X=p(u=>{let g=s.current;g!==null&&(g.removePage(u),_([...g.pages]))},"retake"),Z=p(async()=>{let u=s.current;if(!(u===null||c.length===0)){C("sending"),F(!1);try{await u.submitPages()}catch{F(!0)}C("idle")}},"send"),T=L==="sending";return(0,o.jsxs)("section",{className:"sekyro-step","data-testid":"sekyro-poa-camera",children:[(0,o.jsx)(D,{title:r,lead:e("poa.camera.lead")}),d,K?(0,o.jsx)(b,{tone:"danger",children:(0,o.jsx)("span",{children:e("poa.upload.failed")})}):null,h?(0,o.jsxs)(b,{tone:"danger",children:[(0,o.jsx)("span",{children:e("doc.cameraBlocked")}),(0,o.jsx)("span",{children:e("doc.cameraBlockedHint")}),s.current!==null?(0,o.jsx)(k,{kind:"secondary",onClick:l(()=>s.current!==null&&A(s.current),"onClick"),children:e("doc.retryCamera")}):null]}):null,c.length===0?m:null,(0,o.jsx)("video",{ref:y,className:"sekyro-poa-video",playsInline:!0,muted:!0,autoPlay:!0,"aria-hidden":"true"}),c.length>0?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("p",{className:"sekyro-text-muted",role:"status",children:e("poa.upload.pages",{count:c.length})}),(0,o.jsx)("ul",{className:"sekyro-poa-pages",children:c.map((u,g)=>{let I=e("poa.camera.page",{number:g+1});return(0,o.jsxs)("li",{children:[(0,o.jsx)(B,{blob:u,label:I}),(0,o.jsx)(k,{kind:"ghost",onClick:l(()=>X(g),"onClick"),disabled:T,"aria-label":`${e("poa.camera.retake")} ${I}`,children:e("poa.camera.retake")})]},g)})})]}):null,T?(0,o.jsx)("p",{className:"sekyro-text-muted",role:"status","aria-busy":"true",children:e("poa.upload.sending")}):null,(0,o.jsxs)(R,{children:[(0,o.jsxs)(k,{full:!0,kind:c.length>0?"secondary":"primary",onClick:l(()=>{Q()},"onClick"),disabled:E||h||L!=="idle"||a.attemptsExhausted,"aria-busy":L==="taking"||void 0,children:[(0,o.jsx)(N,{name:"camera"}),e("poa.camera.capture")]}),c.length>0?(0,o.jsx)(k,{full:!0,onClick:l(()=>{Z()},"onClick"),disabled:L!=="idle","aria-busy":T||void 0,children:e("poa.upload.send")}):null,i!==void 0?(0,o.jsx)(k,{full:!0,kind:"ghost",onClick:i,disabled:T,children:e("poa.source.upload")}):null]})]})}l($,"J");p($,"PageCamera");var te={en:U,fr:ae,ar:ee,es:U,pt:U,de:U},oe="image/jpeg,image/png,image/heic,image/heif,application/pdf";function V(a){let n=a.strings,e=te[a.locale];return(r,d)=>q(n[r]??e[r]??"",d)}l(V,"ae");p(V,"poaCopy");function z({step:a,i18n:n,c:e}){if(a.reason===void 0)return null;let r=e(`poa.retry.${a.reason}`)||e(`reasons.${a.reason}`)||e("poa.retry.unreadable");return(0,t.jsxs)(b,{tone:"warning",children:[(0,t.jsx)("span",{children:r}),(0,t.jsx)("span",{children:G(n,a.attemptsRemaining,a.attemptsExhausted)})]})}l(z,"U");p(z,"RetryNotice");function w({step:a,i18n:n,c:e}){let r=(0,v.useId)(),{country:d}=a.rule,m=d===null?e("poa.accepted"):e("poa.acceptedFor",{country:J(d,n.locale)});return(0,t.jsxs)("div",{className:"sekyro-poa-accepted",children:[(0,t.jsx)("p",{id:r,className:"sekyro-poa-accepted__title",children:m}),(0,t.jsx)("ul",{className:"sekyro-poa-list","aria-labelledby":r,children:a.rule.kinds.map(i=>(0,t.jsx)("li",{children:e("poa.kindDated",{kind:e(`poa.kinds.${i.kind}`)||i.kind,days:i.maxAgeDays})},i.kind))})]})}l(w,"j");p(w,"AcceptedList");var re={unsupported:"poa.upload.unsupported",tooMany:"poa.upload.tooManyPages",tooLarge:"poa.upload.tooLarge",failed:"poa.upload.failed"};function W(a){return a instanceof TypeError&&a.message==="unsupported_file"?"unsupported":a instanceof RangeError&&a.message==="file_too_large"?"tooLarge":a instanceof RangeError&&(a.message==="too_many_pages"||a.message==="no_pages")?"tooMany":"failed"}l(W,"re");p(W,"refusalOf");function H({step:a,i18n:n,c:e,letter:r,onCamera:d}){let m=(0,v.useRef)(null),[i,y]=(0,v.useState)("idle"),s=i==="sending",c=p(async _=>{let h=Array.from(_.currentTarget.files??[]);if(_.currentTarget.value="",h.length!==0){if(h.length>a.maxPages){y("tooMany");return}y("sending");try{await(r?a.uploadHolderLetter(h):a.uploadPages(h)),y("idle")}catch(P){y(W(P))}}},"onFiles");return(0,t.jsxs)("section",{className:"sekyro-step","data-testid":r?"sekyro-poa-letter":"sekyro-poa-upload",children:[(0,t.jsx)(D,{title:e(r?"poa.letter.title":"poa.title"),lead:e(r?"poa.letter.lead":"poa.lead")}),i==="idle"||s?(0,t.jsx)(z,{step:a,i18n:n,c:e}):null,i!=="idle"&&!s?(0,t.jsx)(b,{tone:"danger",children:(0,t.jsx)("span",{children:e(re[i])})}):null,r?null:(0,t.jsx)(w,{step:a,i18n:n,c:e}),(0,t.jsx)("p",{className:"sekyro-text-muted",children:e("poa.upload.hint")}),s?(0,t.jsx)("p",{className:"sekyro-text-muted",role:"status","aria-busy":"true",children:e("poa.upload.sending")}):null,(0,t.jsx)("input",{ref:m,type:"file",accept:oe,multiple:!0,hidden:!0,"data-testid":"sekyro-poa-file","aria-label":e(r?"poa.letter.title":"poa.title"),onChange:l(_=>{c(_)},"onChange")}),(0,t.jsxs)(R,{children:[(0,t.jsx)(k,{full:!0,onClick:l(()=>m.current?.click(),"onClick"),disabled:s||!a.photo.uploadOffered||a.attemptsExhausted,"aria-busy":s||void 0,children:e("poa.upload.choose")}),d!==void 0?(0,t.jsxs)(k,{full:!0,kind:"ghost",onClick:d,disabled:s,children:[(0,t.jsx)(N,{name:a.photo.cameraOnPhone===!0?"smartphone":"camera"}),a.photo.cameraOnPhone===!0?e("capture.source.phone"):e("poa.source.camera")]}):null]})]})}l(H,"se");p(H,"UploadScreen");function Y({step:a,c:n}){let[e,r]=(0,v.useState)("idle"),d=a.useLicenceAddress;if(d===void 0)return null;let m=p(async()=>{r("sending");try{await d(),r("idle")}catch{r("failed")}},"onUse");return(0,t.jsxs)("div",{className:"sekyro-poa-licence","data-testid":"sekyro-poa-licence",children:[(0,t.jsx)("p",{className:"sekyro-text-muted",children:n("poa.licence.note")}),e==="failed"?(0,t.jsx)(b,{tone:"danger",children:(0,t.jsx)("span",{children:n("poa.upload.failed")})}):null,(0,t.jsx)(k,{full:!0,kind:"secondary",onClick:l(()=>{m()},"onClick"),disabled:e==="sending"||a.attemptsExhausted,"aria-busy":e==="sending"||void 0,children:n("poa.licence.use")})]})}l(Y,"de");p(Y,"LicenceShortcut");function ne({step:a,i18n:n}){let e=V(n),[r,d]=(0,v.useState)(null),m=a.phase==="holder_letter",i=a.photo.source,y=i==="choice"?r??a.photo.pick:i,s=a.photo.cameraOnPhone===!0,c=a.photo.uploadOffered?()=>d("upload"):void 0,_=e(m?"poa.letter.title":"poa.title"),h;return y===null?h=(0,t.jsx)(S,{testId:"sekyro-poa-source",title:_,lead:e("poa.source.lead"),cameraLabel:e(s?"capture.source.phone":"poa.source.camera"),uploadLabel:e("poa.source.upload"),onPhone:s,notice:(0,t.jsx)(z,{step:a,i18n:n,c:e}),onCamera:l(()=>d("camera"),"onCamera"),onUpload:l(()=>d("upload"),"onUpload")}):y==="camera"&&s?h=(0,t.jsx)(M,{i18n:n,lead:e("handoff.lead.poa"),refresh:a.refresh,actions:c!==void 0?(0,t.jsx)(k,{kind:"ghost",full:!0,onClick:c,children:e("poa.source.upload")}):null}):y==="camera"?h=(0,t.jsx)($,{step:a,i18n:n,c:e,title:_,notice:(0,t.jsx)(z,{step:a,i18n:n,c:e}),intro:m?null:(0,t.jsx)(w,{step:a,i18n:n,c:e}),...i==="choice"&&c!==void 0?{onUpload:c}:{}}):h=(0,t.jsx)(H,{step:a,i18n:n,c:e,letter:m,...i==="choice"?{onCamera:p(()=>d("camera"),"onCamera")}:{}}),(0,t.jsxs)(t.Fragment,{children:[m?null:(0,t.jsx)(Y,{step:a,c:e}),h]})}l(ne,"we");p(ne,"ProofOfAddressView");export{oe as POA_UPLOAD_ACCEPT,ne as ProofOfAddressView,V as poaCopy};
1
+ "use client";import{a as J}from"./chunk-SIBJ56BG.js";import{a as S}from"./chunk-CSKOH7QX.js";import{a as q}from"./chunk-3DDOCOIB.js";import"./chunk-AARN2MG7.js";import{d as M}from"./chunk-26HXTRWG.js";import"./chunk-5JWGGQBH.js";import{K as b,L as G,a as O,b as j,c as k,v as N,w as D,y as R}from"./chunk-JJ3Q52P3.js";import{a as p}from"./chunk-5QL6W6FW.js";import{a as l,c as x}from"./chunk-4FHWXBOB.js";var v=x(O(),1),f=x(O(),1),o=x(j(),1),t=x(j(),1);var ee={"poa.title":"إثبات العنوان","poa.lead":"ارفع وثيقة حديثة تُظهر اسمك وعنوانك الحالي.","poa.accepted":"الوثائق المقبولة","poa.acceptedFor":"مقبول في {country}","poa.kindDated":"{kind}، صادر خلال آخر {days} يومًا","poa.kinds.utility_bill":"فاتورة كهرباء أو ماء أو غاز","poa.kinds.telecom_bill":"فاتورة هاتف أو إنترنت","poa.kinds.bank_statement":"كشف حساب بنكي","poa.kinds.tax_notice":"إشعار ضريبي","poa.kinds.rental_agreement":"عقد إيجار","poa.kinds.government_certificate":"شهادة السكن","poa.kinds.insurance_statement":"وثيقة تأمين","poa.source.camera":"التقاط صورة","poa.source.upload":"رفع ملف","poa.source.lead":"صورة للوثيقة، أو ملف PDF أو صورة من جهازك","poa.upload.hint":"PDF أو JPEG أو PNG، بحد أقصى 3 صفحات و10 ميغابايت","poa.upload.choose":"اختيار ملف","poa.upload.addPage":"إضافة صفحة","poa.upload.pages":"{count} من 3 صفحات","poa.upload.send":"إرسال الوثيقة","poa.upload.sending":"جارٍ إرسال وثيقتك…","poa.upload.unsupported":"نوع الملف هذا غير مقبول. اختر ملف PDF أو JPEG أو PNG","poa.upload.tooManyPages":"أرسل 3 صفحات على الأكثر. احذف صفحة أو اختر ملفًا أقصر","poa.upload.tooLarge":"حجم الملف يتجاوز 10 ميغابايت. اختر ملفًا أصغر","poa.upload.failed":"تعذّر إرسال الوثيقة. تحقّق من اتصالك وحاول مرة أخرى","poa.camera.lead":"ضع الوثيقة بشكل مسطّح واملأ الإطار. التقط صورة واحدة لكل صفحة","poa.camera.capture":"التقاط الصورة","poa.camera.retake":"إعادة الالتقاط","poa.camera.next":"الصفحة التالية","poa.camera.page":"الصفحة {number}","poa.letter.title":"رسالة من صاحب الفاتورة","poa.letter.lead":"الوثيقة باسم شخص آخر. أضف رسالة موقّعة من هذا الشخص تفيد بأنك تسكن في هذا العنوان","poa.letter.send":"إرسال الرسالة","poa.licence.use":"استخدام العنوان المذكور في رخصة القيادة","poa.licence.note":"قرأنا هذا العنوان من رخصتك. لا تحتاج إلى وثيقة أخرى.","poa.retry.document_too_old":"هذه الوثيقة أقدم من المسموح. ارفع وثيقة أحدث من القائمة أدناه","poa.retry.document_date_invalid":"تاريخ الوثيقة في المستقبل. ارفع وثيقة بتاريخ اليوم أو قبله","poa.retry.document_kind_not_accepted":"نوع هذه الوثيقة غير مقبول. ارفع إحدى الوثائق المذكورة أدناه","poa.retry.name_mismatch":"الاسم في الوثيقة لا يطابق اسمك. ارفع وثيقة باسمك","poa.retry.address_mismatch":"العنوان في الوثيقة لا يطابق العنوان الذي وصلنا. ارفع وثيقة لهذا العنوان","poa.retry.holder_letter_missing":"يجب أن تكون الرسالة موقّعة وأن تذكر اسمك واسم صاحب الفاتورة. ارفع رسالة كاملة","poa.retry.unreadable":"تعذّرت قراءة الوثيقة. ارفع نسخة كاملة وأكثر وضوحًا","poa.retry.pdf_protected":"أزل كلمة المرور من ملف PDF وحاول مرة أخرى","poa.retry.provider_unavailable":"تعذّر فحص الوثيقة حاليًا. حاول مرة أخرى بعد قليل","poa.hint.blurry":"الصورة غير واضحة","poa.hint.cropped":"جزء من الوثيقة مقطوع","poa.hint.glare":"يوجد انعكاس ضوء على الوثيقة","reasons.provider_unavailable":"تعذّر فحص الوثيقة حاليًا","reasons.pdf_protected":"ملف PDF محمي بكلمة مرور أو يحتوي على محتوى نشط","reasons.document_kind_not_accepted":"نوع الوثيقة غير مقبول","reasons.document_date_invalid":"تاريخ الوثيقة في المستقبل","reasons.document_too_old":"الوثيقة قديمة جدًا","reasons.document_tampered":"يبدو أن الوثيقة قد عُدّلت","reasons.holder_letter_required":"يلزم تقديم رسالة من صاحب الفاتورة","reasons.holder_letter_missing":"رسالة صاحب الفاتورة مفقودة أو غير مكتملة","reasons.address_mismatch":"العنوان لا يطابق العنوان المقدَّم"},U={"poa.title":"Proof of address","poa.lead":"Upload a recent document that shows your name and your current address.","poa.accepted":"Accepted documents","poa.acceptedFor":"Accepted for {country}","poa.kindDated":"{kind}, dated within the last {days} days","poa.kinds.utility_bill":"Electricity, water or gas bill","poa.kinds.telecom_bill":"Phone or internet bill","poa.kinds.bank_statement":"Bank statement","poa.kinds.tax_notice":"Tax notice","poa.kinds.rental_agreement":"Rental agreement","poa.kinds.government_certificate":"Residence certificate","poa.kinds.insurance_statement":"Insurance statement","poa.source.camera":"Take a photo","poa.source.upload":"Upload a file","poa.source.lead":"A photo of the document, or a PDF or image from your device","poa.upload.hint":"PDF, JPEG or PNG, up to 3 pages and 10 MB","poa.upload.choose":"Choose a file","poa.upload.addPage":"Add a page","poa.upload.pages":"{count} of 3 pages","poa.upload.send":"Send document","poa.upload.sending":"Sending your document…","poa.upload.unsupported":"This file type is not accepted. Choose a PDF, JPEG or PNG","poa.upload.tooManyPages":"Send at most 3 pages. Remove a page or choose a shorter file","poa.upload.tooLarge":"The file is over 10 MB. Choose a smaller file","poa.upload.failed":"We could not send the document. Check your connection and try again","poa.camera.lead":"Lay the document flat and fill the frame. Take one photo per page","poa.camera.capture":"Take photo","poa.camera.retake":"Retake","poa.camera.next":"Next page","poa.camera.page":"Page {number}","poa.letter.title":"Letter from the bill holder","poa.letter.lead":"The document is in another person's name. Add a signed letter from that person saying that you live at this address","poa.letter.send":"Send letter","poa.licence.use":"Use the address on my driver's license","poa.licence.note":"We read this address from your license. You don't need another document.","poa.retry.document_too_old":"This document is older than allowed. Upload a more recent one from the list below","poa.retry.document_date_invalid":"The date on the document is in the future. Upload a document with today's date or earlier","poa.retry.document_kind_not_accepted":"This document type is not accepted. Upload one of the documents listed below","poa.retry.name_mismatch":"The name on the document does not match yours. Upload a document in your name","poa.retry.address_mismatch":"The address on the document does not match the one we were given. Upload a document for that address","poa.retry.holder_letter_missing":"The letter must be signed and name both you and the bill holder. Upload a complete letter","poa.retry.unreadable":"We could not read the document. Upload a sharper, complete copy","poa.retry.pdf_protected":"Remove the password from the PDF and try again","poa.retry.provider_unavailable":"The document could not be checked right now. Try again in a moment","poa.hint.blurry":"The image is blurry","poa.hint.cropped":"Part of the document is cut off","poa.hint.glare":"There is glare on the document","reasons.provider_unavailable":"The document could not be checked right now","reasons.pdf_protected":"The PDF is password-protected or contains active content","reasons.document_kind_not_accepted":"The document type is not accepted","reasons.document_date_invalid":"The document date is in the future","reasons.document_too_old":"The document is too old","reasons.document_tampered":"The document appears to have been edited","reasons.holder_letter_required":"A letter from the bill holder is needed","reasons.holder_letter_missing":"The letter from the bill holder is missing or incomplete","reasons.address_mismatch":"The address does not match the one supplied"},ae={"poa.title":"Justificatif de domicile","poa.lead":"Importez un document récent qui indique votre nom et votre adresse actuelle.","poa.accepted":"Documents acceptés","poa.acceptedFor":"Accepté pour {country}","poa.kindDated":"{kind}, daté des {days} derniers jours","poa.kinds.utility_bill":"Facture d'électricité, d'eau ou de gaz","poa.kinds.telecom_bill":"Facture de téléphone ou d'internet","poa.kinds.bank_statement":"Relevé bancaire","poa.kinds.tax_notice":"Avis d'imposition","poa.kinds.rental_agreement":"Bail ou quittance de loyer","poa.kinds.government_certificate":"Certificat de résidence","poa.kinds.insurance_statement":"Attestation d'assurance","poa.source.camera":"Prendre une photo","poa.source.upload":"Importer un fichier","poa.source.lead":"Une photo du document, ou un PDF ou une image depuis votre appareil","poa.upload.hint":"PDF, JPEG ou PNG, 3 pages et 10 Mo au maximum","poa.upload.choose":"Choisir un fichier","poa.upload.addPage":"Ajouter une page","poa.upload.pages":"{count} sur 3 pages","poa.upload.send":"Envoyer le document","poa.upload.sending":"Envoi de votre document…","poa.upload.unsupported":"Ce type de fichier n'est pas accepté. Choisissez un PDF, un JPEG ou un PNG","poa.upload.tooManyPages":"Envoyez 3 pages au maximum. Retirez une page ou choisissez un fichier plus court","poa.upload.tooLarge":"Le fichier dépasse 10 Mo. Choisissez un fichier plus léger","poa.upload.failed":"Nous n'avons pas pu envoyer le document. Vérifiez votre connexion et réessayez","poa.camera.lead":"Posez le document à plat et remplissez le cadre. Prenez une photo par page","poa.camera.capture":"Prendre la photo","poa.camera.retake":"Reprendre","poa.camera.next":"Page suivante","poa.camera.page":"Page {number}","poa.letter.title":"Lettre du titulaire de la facture","poa.letter.lead":"Le document est au nom d'une autre personne. Ajoutez une lettre signée de cette personne attestant que vous habitez à cette adresse","poa.letter.send":"Envoyer la lettre","poa.licence.use":"Utiliser l'adresse de mon permis de conduire","poa.licence.note":"Nous avons lu cette adresse sur votre permis. Vous n'avez pas besoin d'un autre document.","poa.retry.document_too_old":"Ce document est plus ancien que la limite. Importez un document plus récent parmi ceux de la liste ci-dessous","poa.retry.document_date_invalid":"La date du document est dans le futur. Importez un document daté d'aujourd'hui ou d'avant","poa.retry.document_kind_not_accepted":"Ce type de document n'est pas accepté. Importez l'un des documents de la liste ci-dessous","poa.retry.name_mismatch":"Le nom sur le document ne correspond pas au vôtre. Importez un document à votre nom","poa.retry.address_mismatch":"L'adresse du document ne correspond pas à celle qui nous a été transmise. Importez un document pour cette adresse","poa.retry.holder_letter_missing":"La lettre doit être signée et nommer à la fois vous et le titulaire de la facture. Importez une lettre complète","poa.retry.unreadable":"Nous n'avons pas pu lire le document. Importez une copie plus nette et complète","poa.retry.pdf_protected":"Retirez le mot de passe du PDF et réessayez","poa.retry.provider_unavailable":"Le document n'a pas pu être vérifié pour le moment. Réessayez dans un instant","poa.hint.blurry":"L'image est floue","poa.hint.cropped":"Une partie du document est coupée","poa.hint.glare":"Il y a un reflet sur le document","reasons.provider_unavailable":"Le document n'a pas pu être vérifié pour le moment","reasons.pdf_protected":"Le PDF est protégé par un mot de passe ou contient du contenu actif","reasons.document_kind_not_accepted":"Ce type de document n'est pas accepté","reasons.document_date_invalid":"La date du document est dans le futur","reasons.document_too_old":"Le document est trop ancien","reasons.document_tampered":"Le document semble avoir été modifié","reasons.holder_letter_required":"Une lettre du titulaire de la facture est nécessaire","reasons.holder_letter_missing":"La lettre du titulaire de la facture est absente ou incomplète","reasons.address_mismatch":"L'adresse ne correspond pas à celle qui a été transmise"};function B({blob:a,label:n}){let[e,r]=(0,f.useState)(void 0);return(0,f.useEffect)(()=>{if(typeof URL.createObjectURL!="function")return;let d=URL.createObjectURL(a);return r(d),()=>URL.revokeObjectURL(d)},[a]),(0,o.jsx)("img",{src:e,alt:n})}l(B,"Q");p(B,"PageThumb");function $({step:a,i18n:n,c:e,title:r,notice:d,intro:m,onUpload:i}){let y=(0,f.useRef)(null),s=(0,f.useRef)(null),[c,_]=(0,f.useState)([]),[h,P]=(0,f.useState)(!1),[L,C]=(0,f.useState)("idle"),[K,F]=(0,f.useState)(!1),A=p(u=>{P(!1),u.start().catch(()=>P(!0))},"open");(0,f.useEffect)(()=>{let u=y.current;if(u===null)return;let g;try{g=a.capturePage({video:u})}catch{P(!0);return}return s.current=g,A(g),()=>{g.destroy(),s.current=null}},[]);let E=c.length>=a.maxPages,Q=p(async()=>{let u=s.current;if(!(u===null||E)){C("taking"),F(!1);try{await u.takePage()}catch{}_([...u.pages]),C("idle")}},"take"),X=p(u=>{let g=s.current;g!==null&&(g.removePage(u),_([...g.pages]))},"retake"),Z=p(async()=>{let u=s.current;if(!(u===null||c.length===0)){C("sending"),F(!1);try{await u.submitPages()}catch{F(!0)}C("idle")}},"send"),T=L==="sending";return(0,o.jsxs)("section",{className:"sekyro-step","data-testid":"sekyro-poa-camera",children:[(0,o.jsx)(D,{title:r,lead:e("poa.camera.lead")}),d,K?(0,o.jsx)(b,{tone:"danger",children:(0,o.jsx)("span",{children:e("poa.upload.failed")})}):null,h?(0,o.jsxs)(b,{tone:"danger",children:[(0,o.jsx)("span",{children:e("doc.cameraBlocked")}),(0,o.jsx)("span",{children:e("doc.cameraBlockedHint")}),s.current!==null?(0,o.jsx)(k,{kind:"secondary",onClick:l(()=>s.current!==null&&A(s.current),"onClick"),children:e("doc.retryCamera")}):null]}):null,c.length===0?m:null,(0,o.jsx)("video",{ref:y,className:"sekyro-poa-video",playsInline:!0,muted:!0,autoPlay:!0,"aria-hidden":"true"}),c.length>0?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("p",{className:"sekyro-text-muted",role:"status",children:e("poa.upload.pages",{count:c.length})}),(0,o.jsx)("ul",{className:"sekyro-poa-pages",children:c.map((u,g)=>{let I=e("poa.camera.page",{number:g+1});return(0,o.jsxs)("li",{children:[(0,o.jsx)(B,{blob:u,label:I}),(0,o.jsx)(k,{kind:"ghost",onClick:l(()=>X(g),"onClick"),disabled:T,"aria-label":`${e("poa.camera.retake")} ${I}`,children:e("poa.camera.retake")})]},g)})})]}):null,T?(0,o.jsx)("p",{className:"sekyro-text-muted",role:"status","aria-busy":"true",children:e("poa.upload.sending")}):null,(0,o.jsxs)(R,{children:[(0,o.jsxs)(k,{full:!0,kind:c.length>0?"secondary":"primary",onClick:l(()=>{Q()},"onClick"),disabled:E||h||L!=="idle"||a.attemptsExhausted,"aria-busy":L==="taking"||void 0,children:[(0,o.jsx)(N,{name:"camera"}),e("poa.camera.capture")]}),c.length>0?(0,o.jsx)(k,{full:!0,onClick:l(()=>{Z()},"onClick"),disabled:L!=="idle","aria-busy":T||void 0,children:e("poa.upload.send")}):null,i!==void 0?(0,o.jsx)(k,{full:!0,kind:"ghost",onClick:i,disabled:T,children:e("poa.source.upload")}):null]})]})}l($,"J");p($,"PageCamera");var te={en:U,fr:ae,ar:ee,es:U,pt:U,de:U},oe="image/jpeg,image/png,image/heic,image/heif,application/pdf";function V(a){let n=a.strings,e=te[a.locale];return(r,d)=>q(n[r]??e[r]??"",d)}l(V,"ae");p(V,"poaCopy");function z({step:a,i18n:n,c:e}){if(a.reason===void 0)return null;let r=e(`poa.retry.${a.reason}`)||e(`reasons.${a.reason}`)||e("poa.retry.unreadable");return(0,t.jsxs)(b,{tone:"warning",children:[(0,t.jsx)("span",{children:r}),(0,t.jsx)("span",{children:G(n,a.attemptsRemaining,a.attemptsExhausted)})]})}l(z,"U");p(z,"RetryNotice");function w({step:a,i18n:n,c:e}){let r=(0,v.useId)(),{country:d}=a.rule,m=d===null?e("poa.accepted"):e("poa.acceptedFor",{country:J(d,n.locale)});return(0,t.jsxs)("div",{className:"sekyro-poa-accepted",children:[(0,t.jsx)("p",{id:r,className:"sekyro-poa-accepted__title",children:m}),(0,t.jsx)("ul",{className:"sekyro-poa-list","aria-labelledby":r,children:a.rule.kinds.map(i=>(0,t.jsx)("li",{children:e("poa.kindDated",{kind:e(`poa.kinds.${i.kind}`)||i.kind,days:i.maxAgeDays})},i.kind))})]})}l(w,"j");p(w,"AcceptedList");var re={unsupported:"poa.upload.unsupported",tooMany:"poa.upload.tooManyPages",tooLarge:"poa.upload.tooLarge",failed:"poa.upload.failed"};function W(a){return a instanceof TypeError&&a.message==="unsupported_file"?"unsupported":a instanceof RangeError&&a.message==="file_too_large"?"tooLarge":a instanceof RangeError&&(a.message==="too_many_pages"||a.message==="no_pages")?"tooMany":"failed"}l(W,"re");p(W,"refusalOf");function H({step:a,i18n:n,c:e,letter:r,onCamera:d}){let m=(0,v.useRef)(null),[i,y]=(0,v.useState)("idle"),s=i==="sending",c=p(async _=>{let h=Array.from(_.currentTarget.files??[]);if(_.currentTarget.value="",h.length!==0){if(h.length>a.maxPages){y("tooMany");return}y("sending");try{await(r?a.uploadHolderLetter(h):a.uploadPages(h)),y("idle")}catch(P){y(W(P))}}},"onFiles");return(0,t.jsxs)("section",{className:"sekyro-step","data-testid":r?"sekyro-poa-letter":"sekyro-poa-upload",children:[(0,t.jsx)(D,{title:e(r?"poa.letter.title":"poa.title"),lead:e(r?"poa.letter.lead":"poa.lead")}),i==="idle"||s?(0,t.jsx)(z,{step:a,i18n:n,c:e}):null,i!=="idle"&&!s?(0,t.jsx)(b,{tone:"danger",children:(0,t.jsx)("span",{children:e(re[i])})}):null,r?null:(0,t.jsx)(w,{step:a,i18n:n,c:e}),(0,t.jsx)("p",{className:"sekyro-text-muted",children:e("poa.upload.hint")}),s?(0,t.jsx)("p",{className:"sekyro-text-muted",role:"status","aria-busy":"true",children:e("poa.upload.sending")}):null,(0,t.jsx)("input",{ref:m,type:"file",accept:oe,multiple:!0,hidden:!0,"data-testid":"sekyro-poa-file","aria-label":e(r?"poa.letter.title":"poa.title"),onChange:l(_=>{c(_)},"onChange")}),(0,t.jsxs)(R,{children:[(0,t.jsx)(k,{full:!0,onClick:l(()=>m.current?.click(),"onClick"),disabled:s||!a.photo.uploadOffered||a.attemptsExhausted,"aria-busy":s||void 0,children:e("poa.upload.choose")}),d!==void 0?(0,t.jsxs)(k,{full:!0,kind:"ghost",onClick:d,disabled:s,children:[(0,t.jsx)(N,{name:a.photo.cameraOnPhone===!0?"smartphone":"camera"}),a.photo.cameraOnPhone===!0?e("capture.source.phone"):e("poa.source.camera")]}):null]})]})}l(H,"se");p(H,"UploadScreen");function Y({step:a,c:n}){let[e,r]=(0,v.useState)("idle"),d=a.useLicenceAddress;if(d===void 0)return null;let m=p(async()=>{r("sending");try{await d(),r("idle")}catch{r("failed")}},"onUse");return(0,t.jsxs)("div",{className:"sekyro-poa-licence","data-testid":"sekyro-poa-licence",children:[(0,t.jsx)("p",{className:"sekyro-text-muted",children:n("poa.licence.note")}),e==="failed"?(0,t.jsx)(b,{tone:"danger",children:(0,t.jsx)("span",{children:n("poa.upload.failed")})}):null,(0,t.jsx)(k,{full:!0,kind:"secondary",onClick:l(()=>{m()},"onClick"),disabled:e==="sending"||a.attemptsExhausted,"aria-busy":e==="sending"||void 0,children:n("poa.licence.use")})]})}l(Y,"de");p(Y,"LicenceShortcut");function ne({step:a,i18n:n}){let e=V(n),[r,d]=(0,v.useState)(null),m=a.phase==="holder_letter",i=a.photo.source,y=i==="choice"?r??a.photo.pick:i,s=a.photo.cameraOnPhone===!0,c=a.photo.uploadOffered?()=>d("upload"):void 0,_=e(m?"poa.letter.title":"poa.title"),h;return y===null?h=(0,t.jsx)(S,{testId:"sekyro-poa-source",title:_,lead:e("poa.source.lead"),cameraLabel:e(s?"capture.source.phone":"poa.source.camera"),uploadLabel:e("poa.source.upload"),onPhone:s,notice:(0,t.jsx)(z,{step:a,i18n:n,c:e}),onCamera:l(()=>d("camera"),"onCamera"),onUpload:l(()=>d("upload"),"onUpload")}):y==="camera"&&s?h=(0,t.jsx)(M,{i18n:n,lead:e("handoff.lead.poa"),refresh:a.refresh,actions:c!==void 0?(0,t.jsx)(k,{kind:"ghost",full:!0,onClick:c,children:e("poa.source.upload")}):null}):y==="camera"?h=(0,t.jsx)($,{step:a,i18n:n,c:e,title:_,notice:(0,t.jsx)(z,{step:a,i18n:n,c:e}),intro:m?null:(0,t.jsx)(w,{step:a,i18n:n,c:e}),...i==="choice"&&c!==void 0?{onUpload:c}:{}}):h=(0,t.jsx)(H,{step:a,i18n:n,c:e,letter:m,...i==="choice"?{onCamera:p(()=>d("camera"),"onCamera")}:{}}),(0,t.jsxs)(t.Fragment,{children:[m?null:(0,t.jsx)(Y,{step:a,c:e}),h]})}l(ne,"we");p(ne,"ProofOfAddressView");export{oe as POA_UPLOAD_ACCEPT,ne as ProofOfAddressView,V as poaCopy};
@@ -1 +1 @@
1
- import{g as e}from"./chunks/chunk-LBZCFEU4.js";import"./chunks/chunk-UN4V3UNQ.js";import"./chunks/chunk-XDRH4VWV.js";import"./chunks/chunk-7JUL7AKT.js";import"./chunks/chunk-CVFJQIMW.js";import"./chunks/chunk-3DDOCOIB.js";import"./chunks/chunk-VHNWBOKW.js";import"./chunks/chunk-BMUUDLFA.js";import"./chunks/chunk-Q5BUNNRN.js";import"./chunks/chunk-GZOBS7KG.js";import"./chunks/chunk-AARN2MG7.js";import"./chunks/chunk-SDK2YXFV.js";import"./chunks/chunk-5JWGGQBH.js";import"./chunks/chunk-JJ3Q52P3.js";import"./chunks/chunk-YLH3WX7Y.js";import"./chunks/chunk-GPGK6XZM.js";import"./chunks/chunk-4YBL75VD.js";import"./chunks/chunk-P7K7ELYZ.js";import"./chunks/chunk-5QL6W6FW.js";import"./chunks/chunk-6MYG4HWP.js";import"./chunks/chunk-JS2IXPNL.js";import"./chunks/chunk-4FHWXBOB.js";e();export{e as defineSekyroElements};
1
+ import{g as e}from"./chunks/chunk-CSPTLSJY.js";import"./chunks/chunk-LHEWQFCZ.js";import"./chunks/chunk-3I6AVO6X.js";import"./chunks/chunk-ZPSZDTDP.js";import"./chunks/chunk-CK3CQAFP.js";import"./chunks/chunk-3DDOCOIB.js";import"./chunks/chunk-SHOVUF5C.js";import"./chunks/chunk-PYUD6W3P.js";import"./chunks/chunk-DEGFGNRM.js";import"./chunks/chunk-GZOBS7KG.js";import"./chunks/chunk-AARN2MG7.js";import"./chunks/chunk-26HXTRWG.js";import"./chunks/chunk-5JWGGQBH.js";import"./chunks/chunk-JJ3Q52P3.js";import"./chunks/chunk-A5SXWFOO.js";import"./chunks/chunk-DKZUKWGP.js";import"./chunks/chunk-F7DKVXQW.js";import"./chunks/chunk-P7K7ELYZ.js";import"./chunks/chunk-5QL6W6FW.js";import"./chunks/chunk-6MYG4HWP.js";import"./chunks/chunk-JS2IXPNL.js";import"./chunks/chunk-4FHWXBOB.js";e();export{e as defineSekyroElements};
package/dist/cdn/index.js CHANGED
@@ -1 +1 @@
1
- import{a as e,b as r,c as t,d as o,e as i,f as a,g as f}from"./chunks/chunk-LBZCFEU4.js";import"./chunks/chunk-UN4V3UNQ.js";import"./chunks/chunk-XDRH4VWV.js";import"./chunks/chunk-7JUL7AKT.js";import"./chunks/chunk-CVFJQIMW.js";import"./chunks/chunk-3DDOCOIB.js";import"./chunks/chunk-VHNWBOKW.js";import"./chunks/chunk-BMUUDLFA.js";import{a as n}from"./chunks/chunk-Q5BUNNRN.js";import"./chunks/chunk-GZOBS7KG.js";import"./chunks/chunk-AARN2MG7.js";import"./chunks/chunk-SDK2YXFV.js";import"./chunks/chunk-5JWGGQBH.js";import"./chunks/chunk-JJ3Q52P3.js";import"./chunks/chunk-YLH3WX7Y.js";import"./chunks/chunk-GPGK6XZM.js";import"./chunks/chunk-4YBL75VD.js";import"./chunks/chunk-P7K7ELYZ.js";import"./chunks/chunk-5QL6W6FW.js";import"./chunks/chunk-6MYG4HWP.js";import"./chunks/chunk-JS2IXPNL.js";import"./chunks/chunk-4FHWXBOB.js";export{r as ATTRIBUTES,i as EVENTS,t as PROPERTIES,o as SLOTS,a as SekyroVerificationElement,e as TAG_NAME,n as createVerification,f as defineSekyroElements};
1
+ import{a as e,b as r,c as t,d as o,e as i,f as a,g as f}from"./chunks/chunk-CSPTLSJY.js";import"./chunks/chunk-LHEWQFCZ.js";import"./chunks/chunk-3I6AVO6X.js";import"./chunks/chunk-ZPSZDTDP.js";import"./chunks/chunk-CK3CQAFP.js";import"./chunks/chunk-3DDOCOIB.js";import"./chunks/chunk-SHOVUF5C.js";import"./chunks/chunk-PYUD6W3P.js";import{a as n}from"./chunks/chunk-DEGFGNRM.js";import"./chunks/chunk-GZOBS7KG.js";import"./chunks/chunk-AARN2MG7.js";import"./chunks/chunk-26HXTRWG.js";import"./chunks/chunk-5JWGGQBH.js";import"./chunks/chunk-JJ3Q52P3.js";import"./chunks/chunk-A5SXWFOO.js";import"./chunks/chunk-DKZUKWGP.js";import"./chunks/chunk-F7DKVXQW.js";import"./chunks/chunk-P7K7ELYZ.js";import"./chunks/chunk-5QL6W6FW.js";import"./chunks/chunk-6MYG4HWP.js";import"./chunks/chunk-JS2IXPNL.js";import"./chunks/chunk-4FHWXBOB.js";export{r as ATTRIBUTES,i as EVENTS,t as PROPERTIES,o as SLOTS,a as SekyroVerificationElement,e as TAG_NAME,n as createVerification,f as defineSekyroElements};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sekyro/elements",
3
- "version": "0.1.0-rc.12",
3
+ "version": "0.1.0-rc.13",
4
4
  "description": "Sekyro AI custom elements: <sekyro-verification> for Vue, Angular, Svelte and plain HTML, the @sekyro/react flow with React bundled inside",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "repository": {
@@ -94,7 +94,7 @@
94
94
  "api:check": "api-extractor run"
95
95
  },
96
96
  "peerDependencies": {
97
- "@sekyro/web": "^0.1.0-rc.33 || ^0.2.0-rc.0"
97
+ "@sekyro/web": "^0.1.0-rc.34 || ^0.2.0-rc.0"
98
98
  },
99
99
  "devDependencies": {
100
100
  "@microsoft/api-extractor": "^7.59.4",