1import{p as e,M as a,o as t,C as o,h as r,u as n,t as i,y as s,v as l,w as c,g as u,V as d,k as v,m as p,z as h}from"./2c1ab0fe.qpvfywqb.js";import{H as m}from"./f8eac2fc.BHf_mfkp.js";import{bD as b,v as f,bE as y,bF as g,bG as k,S,a9 as _,aa as C,az as j,i as w,bH as E}from"./164ad2e3.DcJn775M.js";import{I as L,bh as V,b8 as B,al as O,e as q,bi as x,a2 as z,bj as D,ba as R,bb as P}from"./4b4bc88f.DkycdxSK.js";import{P as I}from"./01973ac7.CzRJWXtH.js";import"./d0bb51ec.CWfbNPnY.js";import"./app.DH8n-1bp.js";import"./f67abd2c.CNaB0QaR.js";import"./e12db40c.DhbHW8sF.js";import"./9dba8418.4R19B40l.js";import"./60a453ce.DBFo6PRx.js";import"./58314944.CL_6FNuP.js";function J(e,a){return"failed"===e?.status&&a===e.id}function F(){const{i18n:e}=q(),{progressing:a}=f(),{hasError:t,error:i}=y(x),s=function(){const[e,a]=b(B.LastSeenCaptchaRequestedErrorReceiptId),t=O(),{checkout:n}=q(),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 G=!1;const H=i(e=>{const{appContext:{i18n:t,observability:o},captchaSignal:r,errorSignal:n,lastJourneyProgression:i,negotiate:u,onViolation:d}=e,v=s(a(()=>r.value?.sitekey)),p=s(G),h=s(a(()=>Boolean(r.value?.token))),m=l(()=>Boolean(n.value)),b=Date.now(),f=G,y=t.translate("captcha.errors.not_solved");c(()=>{const e=r.value;e?e.sitekey&&(v.value=e.sitekey):v.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=y):t?.token&&(n.value=void 0)});const g=l(()=>Boolean(v.value));return{errorSignal:n,hasError:m,hasSiteKey:g,isLoaded:p,sitekey:v,solvedOnLoad:h,handleVerify(e){const a=r.value;a&&(r.value={...a,token:e,violationCode:void 0},u({silenceViolations:z(["captcha"]),skipStateUpdates:!0}))},handleLoad(){f||o.histogram({name:"captcha_load_time",value:Date.now()-b,attributes:{provider:r.value?.provider,success:!0}}),G=!0,p.value=!0},handleError(e){f||o.histogram({name:"captcha_load_time",value:Date.now()-b,attributes:{provider:r.peek()?.provider,success:!1,error:String(e)}})},validate(e){if(e)return e.token?void 0:y}}});function K(){const o=q(),{client:r,i18n:i}=o,s="fast"!==r.unstable_getSerialization("workerVersion"),l=g(),c=D(),{lastJourneyProgression:b}=o.checkout.negotiator,{captcha:y}=o.checkout.negotiator.parts,{negotiate:B}=f(),O=u(null),{onOpen:x,onClose:z}=function({embed:o},r){const n=L(o?.embedder),i=t(!1);return function({embed:t},o){e(()=>{if(!o.value||!L(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,y),I=d(()=>new H({appContext:o,captchaSignal:y,errorSignal:c,lastJourneyProgression:b,negotiate:B,onViolation:()=>{z(),O.current?.resetCaptcha()}}));R(y,c,I.validate,P.InvalidCaptcha);const J=u(null),G=k({active:I.hasError.value});e(()=>{y.value&&I.isLoaded.value&&J.current&&(G.current=J.current.querySelector("iframe"))});const K=v(()=>I.isLoaded.value?void 0:"none"),M=v(()=>I.hasError.value?p("MTtRU"):void 0);return n(h,{when:()=>{const e=I.solvedOnLoad.value&&!y.value?.sitekey;return Boolean("hcaptcha"===y.value?.provider&&!e&&Boolean(I.sitekey.value))},children:n(S,{gap:"large-100",children:[n(h,{when:()=>l.value&&I.isLoaded.value&&I.hasSiteKey.value,children:n(_,{tone:"critical",errorType:C.CheckoutError,children:i.translate("payment_errors.captcha_required_without_payment_information")})}),n(h,{when:()=>!I.isLoaded.value,children:n(j,{delay:s,contentDisplay:"block",inlineSize:"302px",blockSize:"83px"})}),n(w,{accessibilityLabel:i.translate("captcha.title"),display:K.value,children:n(S,{gap:"small-400",children:[n(F,{}),n("div",{className:M.value,ref:J,children:n(m,{sitekey:I.sitekey.value,onVerify:e=>{z(),I.handleVerify(e)},languageOverride:i.locale,ref:O,onLoad:I.handleLoad,onError:e=>{z(),I.handleError(e)},onOpen:x,onClose:z,onChalExpired:z})}),n(h,{when:I.errorSignal,children:e=>n(E,{children:e?.message??e})})]})})]})})}export{K 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.