1import{p as e,L as a,o as t,z as o,h as r,u as n,U as i,y as s,I as l,t as c,g as u,V as d,k as p,m as v,w as h}from"./2c1ab0fe.XVnTovwp.js";import{H as m}from"./f8eac2fc.DUMGak_P.js";import{bv as f,r as y,bw as g,bx as b,by as k,S as _,a8 as S,a9 as C,at as w,h as L,bz as j}from"./164ad2e3.hrg71Gqs.js";import{z as E,b5 as V,aY as x,a8 as z,a as B,b6 as q,N as O,b7 as R,a_ as D,a$ as P}from"./f67abd2c.DYpmk7mw.js";import{P as I}from"./01973ac7.Dzv797oi.js";import"./d0bb51ec.Bel_y502.js";import"./app.Bke-0Cv3.js";import"./60a453ce.Al5ISuVm.js";import"./e12db40c.D-IRYT_x.js";import"./9dba8418.C8BcPjk_.js";import"./58314944.DulCe-h4.js";function J(e,a){return"failed"===e?.status&&a===e.id}function U(){const{i18n:e}=B(),{progressing:a}=y(),{hasError:t,error:i}=g(q),s=function(){const[e,a]=f(x.LastSeenCaptchaRequestedErrorReceiptId),t=z(),{checkout:n}=B(),i=n.latestReceipt.value,[s,l]=o(()=>!t.peek()||J(i,e));return r(()=>{const t=J(i,e);l(t),"failed"===i?.status&&e!==i.id&&a(i.id),"failed"!==i?.status&&a(void 0)},[i?.id,i?.status]),s}();return a.value?null:t&&i&&!s?n(I,{identifier:"CaptchaRequiredBanner",tone:"critical",children:e.translate("payment_errors.captcha_required_without_payment_information")}):null}let K=!1;const N=i(e=>{const{appContext:{i18n:t,observability:o},captchaSignal:r,errorSignal:n,lastJourneyProgression:i,negotiate:u,onViolation:d}=e,p=s(a(()=>r.value?.sitekey)),v=s(K),h=s(a(()=>Boolean(r.value?.token))),m=l(()=>Boolean(n.value)),f=Date.now(),y=K,g=t.translate("captcha.errors.not_solved");c(()=>{const e=r.value;e?e.sitekey&&(p.value=e.sitekey):p.value=void 0}),c(()=>{const e=i.value,a="error"===e.type?e.violations.map(e=>e.code):[],t=r.value;t&&t.violationCode&&a.includes(t.violationCode)?(d?.(),n.value=g):t?.token&&(n.value=void 0)});const b=l(()=>Boolean(p.value));return{errorSignal:n,hasError:m,hasSiteKey:b,isLoaded:v,sitekey:p,solvedOnLoad:h,handleVerify(e){const a=r.value;a&&(r.value={...a,token:e,violationCode:void 0},u({legacyFiltering:{include:["captcha"]},silenceViolations:O(["captcha"]),skipStateUpdates:!0}))},handleLoad(){y||o.histogram({name:"captcha_load_time",value:Date.now()-f,attributes:{provider:r.value?.provider,success:!0}}),K=!0,v.value=!0},handleError(e){y||o.histogram({name:"captcha_load_time",value:Date.now()-f,attributes:{provider:r.peek()?.provider,success:!1,error:String(e)}})},validate(e){if(e)return e.token?void 0:g}}});function T(){const o=B(),{client:r,i18n:i}=o,s="fast"!==r.unstable_getSerialization("workerVersion"),l=b(),c=R(),{lastJourneyProgression:f}=o.checkout.negotiator,{captcha:g}=o.checkout.negotiator.parts,{negotiate:x}=y(),z=u(null),{onOpen:q,onClose:O}=function({embed:o},r){const n=E(o?.embedder),i=t(!1);return function({embed:t},o){e(()=>{if(!o.value||!E(t?.embedder))return;const e=a(()=>t?.presentation?.acquire());return()=>a(()=>e?.())})}({embed:o},i),e(()=>{r.value?n&&a(()=>V(o,"captcha")):i.value=!1}),{onOpen:()=>{i.value=n&&Boolean(r.value)},onClose:()=>{i.value=!1}}}(o,g),I=d(()=>new N({appContext:o,captchaSignal:g,errorSignal:c,lastJourneyProgression:f,negotiate:x,onViolation:()=>{O(),z.current?.resetCaptcha()}}));D(g,c,I.validate,P.InvalidCaptcha);const J=u(null),K=k({active:I.hasError.value});e(()=>{g.value&&I.isLoaded.value&&J.current&&(K.current=J.current.querySelector("iframe"))});const T=p(()=>I.isLoaded.value?void 0:"none"),F=p(()=>I.hasError.value?v("MTtRU"):void 0);return n(h,{when:()=>{const e=I.solvedOnLoad.value&&!g.value?.sitekey;return Boolean("hcaptcha"===g.value?.provider&&!e&&Boolean(I.sitekey.value))},children:n(_,{gap:"large-100",children:[n(h,{when:()=>l.value&&I.isLoaded.value&&I.hasSiteKey.value,children:n(S,{tone:"critical",errorType:C.CheckoutError,children:i.translate("payment_errors.captcha_required_without_payment_information")})}),n(h,{when:()=>!I.isLoaded.value,children:n(w,{delay:s,contentDisplay:"block",inlineSize:"302px",blockSize:"83px"})}),n(L,{accessibilityLabel:i.translate("captcha.title"),display:T.value,children:n(_,{gap:"small-400",children:[n(U,{}),n("div",{className:F.value,ref:J,children:n(m,{sitekey:I.sitekey.value,onVerify:e=>{O(),I.handleVerify(e)},languageOverride:i.locale,ref:z,onLoad:I.handleLoad,onError:e=>{O(),I.handleError(e)},onOpen:q,onClose:O,onChalExpired:O})}),n(h,{when:I.errorSignal,children:e=>n(j,{children:e?.message??e})})]})})]})})}export{T as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.