import{js as e,Y as t}from"./4b4bc88f.z1yoAwwH.js";function o(e,t){return"phone"===e&&t.user.isUnauthenticatedUser.value}function n(e,t){let o=e;const n=t.split(".");for(const r of n){if(null==o)return;o=o[r]}return o}function r(e,t,o){const n={...e},r=t.split("."),s=r.pop();if(!s)return e;let a=n;for(const c of r)a[c]={...a[c]},a=a[c];return null==o?delete a[s]:a[s]=o,n}function s(e,...t){const o={...e};for(const n of t)for(const e of Object.keys(n)){const t=o[e],r=n[e];a(t)&&a(r)?o[e]=s(t,r):null!=r&&(o[e]=r)}return o}function a(e){if(null==e||"object"!=typeof e||Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function c(o){return e(o)?o.map(e=>"not_required"===e.status||e.availableOn!==t?e:{...e,methods:e.methods.map(e=>({...e,deliveryPromisePresentmentTitle:null,estimatedTimeInTransit:void 0}))}):o}const i=[/Internal error\. Looks like something went wrong on our end/,/Session source not found/,/Country [A-Z]{0,2} is not supported/,/Invalid session token/,/Invalid query string parameter\./,/server_unavailable/];function u(e){return i.some(t=>t.test(e))}class l extends Error{constructor(){super(...arguments),this.name="UnactionableGraphQLExecutionError"}}function d(e){"graphql_unsupported_argument_error"!==e.groupingHash&&"graphql_undefined_field_error"!==e.groupingHash&&"graphql_undefined_input_type_error"!==e.groupingHash||"tophat"!==e.app.releaseStage||(e.groupingHash=`${e.groupingHash}_tophat`)}const p=e=>{const t=e??("undefined"==typeof window?void 0:window.location.href);if(!t)return;let o;try{o="string"==typeof t?new URL(t).pathname:t.pathname}catch{return}const n=o.match(/checkout\/([^/]+)\/([a-z]{2,3})/)?.[1];if(!n)return;const r=parseInt(n,10);return isNaN(r)?void 0:r};function h(e,t,o){const n=window.webkit?.messageHandlers?.CheckoutSheetProtocolConsumer,r=[n,window.CheckoutSheetProtocolConsumer,o];for(const a of r)if(a&&"function"==typeof a?.postMessage)try{const o={name:t.handlerId,body:JSON.stringify(t.body)};return e.log("checkout_sheet_protocol_client_message_posted","Posting message to checkout sheet protocol consumer.",{handlerId:t.handlerId}),a.postMessage(JSON.stringify(o)),e.counter({name:"checkout_sheet_protocol_event_emitted",value:1,exportImmediately:!0,attributes:{event:String(t.handlerId),status:"success"}}),!0}catch(s){return e.log("checkout_sheet_protocol_client_message_posting_failed","Error posting message to checkout sheet protocol consumer",{handlerId:t.handlerId,error:s instanceof Error?s.message:String(s)}),e.counter({name:"checkout_sheet_protocol_event_emitted",value:1,exportImmediately:!0,attributes:{event:String(t.handlerId),status:"failed"}}),console.info("Error received when posting message to checkout sheet protocol consumer",t,s),!1}return e.log("checkout_sheet_protocol_client_no_consumer_found","No checkout sheet protocol consumer found",{handlerId:t.handlerId}),e.counter({name:"checkout_sheet_protocol_event_emitted",value:1,exportImmediately:!0,attributes:{event:String(t.handlerId),status:"no_consumer"}}),!1}function f(){const e=window.opener||(window.parent===window?void 0:window.parent);return e?{postMessage(t){e.postMessage({_ecp:"2025-10",data:t},"*")}}:void 0}export{i as U,n as a,c as b,d as c,s as d,l as e,f,p as g,u as i,h as p,o as s,r as u};