import{A as h,T as y,u as t,k as A,q as v}from"./dist-vendor.DBR6g02j.js";import{kl as P,r as u,a as U,ap as N,c as b}from"./shop-pay-FullScreenBackground.C1_sL6Wu.js";import{k as f,ao as x,h as E,R,dS as I}from"./shop-pay-ButtonWithRegisterWebPixel.Tzqfwpmo.js";const K="stored-session-token",C=({client:s,persistence:e,shopPay:o})=>{const a=P(),i=s.unstable_getSerialization("paySessionToken"),r={scope:()=>({shopPaySessionTokenKey:a})},l=i===K?void 0:i,S=u.ShopPaySessionToken,p=()=>o.shouldUseSessionToken?e?.get(u.ShopPaySessionToken,r):void 0,k=()=>o.sessionToken||p();let c;const T=()=>(c||(c=e?.createUpdate(u.ShopPaySessionToken,r)??(()=>{})),c),g=n=>{if(o.updateSessionToken(n),!o.shouldUseSessionToken){n==null&&e?.remove(S,r);return}if(n){T()(n);return}e?.remove(S,r)},m=()=>{o.shouldUseSessionToken&&l&&g(l)};return{get:k,set:g,load:()=>{if(!o.shouldUseSessionToken)return;m();const n=p();n!==void 0&&o.updateSessionToken(n)}}},M=()=>{const s=h(!1),e=U(),o=y(()=>C(e),[e]),{sessionToken:a}=e.shopPay;return s.current||(o.load(),s.current=!0),[a,o.set]},O="MV9Am",d={Actions:O};function V({children:s}){return t(x,{containerName:"s-shell-section",accessibilityRole:"presentation",children:t(f,{gap:"large-300",children:s})})}function Y({grouped:s,children:e}){return t(f,{gap:s?"base":"large-400",children:e})}function q({children:s}){const e=E("Checkout::Actions::RenderBefore");return t(A,{children:[t(R,{extensions:e,gap:"base"}),t("div",{className:d.Actions,children:s})]})}function F({children:s}){const e=N({base:!0,medium:!1}),{triggerNode:o}=I("chat"),{currentDetour:a}=b().value,i=v(r=>{o.value=e&&a?.type!=="thankYou"&&r?r:null},[e,a,o]);return t("div",{className:d.PrimaryAction,ref:i,children:s})}function H({children:s}){return t("div",{className:d.SecondaryAction,children:s})}export{V as P,Y as a,q as b,F as c,H as d,M as u};
