PageSourceSearch

https://www.thegreatbritishbookshop.co.uk/cdn/shopifycloud/checkout-web/assets/c1/0cd5b134.CMZlizdg.js

js thegreatbritishbookshop.co.uk collected 2026-10-01 10:27:32 UTC 7,639 bytes, 1 lines download raw bytes

1import{T as e,k as a,q as t,h as r,u as n}from"./2c1ab0fe.D_oO1jU7.js";import{h as l,K as s,br as i,M as c,c8 as o,c9 as u,bq as d,bt as p,l as h,c as b,I as m,n as _,bu as g,A as f,H as y,P as k,_ as v,ak as U,ah as I,ai as w,aa as q,aj as x,ae as P,ab as j,af as C,ag as L,L as T,N as B,ar as S,bY as O,y as Q}from"./164ad2e3.DgUUtBtV.js";import{C as A}from"./611e718a.CfTWiRtv.js";import{P as z,a as M,b as $,d as E,c as H}from"./a25deb9a.XIOr6b3K.js";import{T as N}from"./65f3d4da.8ZfwXSRH.js";import{O as R,P as D,bb as F,Q as K,aU as V,bx as W,by as Y}from"./4c290a1e.D9lE9kmU.js";import{U as G}from"./5c5c2e96.baUTlEFa.js";import{u as J,S as X}from"./ca5e9c49.BL-l7mUG.js";import{u as Z,N as ee}from"./f5a7bb50.C28TwZsi.js";import"./app.bDJ3v-8C.js";import"./60a453ce.BIyixFcg.js";import"./0a7dffce.BMM606kb.js";import"./bb728e1c.BObJOhlA.js";import"./f78726c8.K7FaLIh2.js";function ae(){const{i18n:O,observability:Q,shop:ae,url:ne,source:le,router:se,embed:ie}=R(),{value:ce}=D().allViolations,{value:oe}=D().merchandiseLines,ue=F("merchandiseLines").value,{progress:de}=l(),{previousPage:pe}=s(),he=K().merchandiseLines,be=i(),me=Z(),_e=me.type,{value:ge}=V();c("stock_problems");const fe=e((()=>oe?.lines??[]),[oe]),[ye]=a(he.peek()),ke=o(ye,ce),ve=u(ye,fe,ce),Ue="draftOrder"===le.type,Ie=W(ie?.embedder),{hasStorefront:we}=ae,{isAppLayout:qe}=d(),xe=me.cartEmpty,Pe=xe||!ye?0:ye.length,je=we||Pe>1,Ce=e((()=>fe.reduce(((e,a)=>({...e,[a.stableId]:a})),{})),[fe]),Le=t((({removeUnavailableMerchandise:e=!1}={})=>{const a=he.value,t=a.flatMap((a=>{const t=Ce[a.stableId];return!e||t&&0!==t.quantity&&!ke.has(a.stableId)?!t||0===t.quantity||ke.has(a.stableId)||a.quantity===t.quantity&&a.totalPrice===t.totalPrice?[a]:[{...a,quantity:t.quantity,totalPrice:t.totalPrice}]:[]}));t.length===a.length&&t.every(((e,t)=>e===a[t]))||(he.value=t)}),[Ce,he,ke]),Te=t((()=>{Y(ie,G)}),[ie]),Be=t((()=>{Le({removeUnavailableMerchandise:!0}),de("stock-problems-submit")}),[de,Le]),Se=p(),Oe=t((async()=>{await Se(me.lineItems),window.location.replace(ne.cart())}),[Se,me.lineItems,ne]);r((()=>{be.notify({checkout_in_progress:!1})}),[be]),J({stage:ue?X.Loading:X.Complete,id:"StockProblems"}),r((()=>{let e=se.currentUrl.value;return se.currentUrl.subscribe((a=>{e!==a&&(e=a,Le())}))}),[se,Le]);const Qe=e((()=>_e===q.Unfulfillable?S([...ke],ge):null),[ge,_e,ke]),Ae=()=>
1{if(!me.showLineItems)return me.title;switch(_e){case q.Unavailable:return O.translate("contextual_availability.title",{count:ve.length});case q.UnpurchasableB2B:return O.translate("stock.unpurchasable_product.title");case q.Unpurchasable:return O.translate("stock.unpurchasable_product_generic.title");case q.QuantityChange:return O.translate("stock.quantity_update.title");case q.Unshippable:return O.translate("stock.unshippable_product.title");case q.Unfulfillable:return O.translate("stock.unfulfillable_product.title");default:return O.translate("stock.title")}},ze=we&&(!qe||!xe)||Ie?n(z,{children:n(h,{variant:"primary",size:"large",inlineSize:"fill",onClick:xe&&Ie?Te:Be,loading:ue,children:Ue||xe&&!Ie?O.translate("stock.return_to_store_label"):O.translate("general.continue_button_label")})}):null,Me=!we||!pe.route||qe||xe||Ie?null:n(M,{children:n(h,{onClick:async()=>{await Oe()},variant:"plain",inlineSize:"fill",textDecoration:"none",children:n(b,{direction:"inline",gap:"small-200",alignItems:"center",children:[n(m,{type:"chevron-left",size:"small"}),n(_,{children:O.translate("general.back_to_cart")})]})})}),$e=()=>
1{if(!me.showLineItems)return me.subtitle;switch(_e){case q.Unavailable:return xe?O.translate("contextual_availability.all_products_in_cart_unavailable",{count:ve.length}):O.translate("contextual_availability.products_not_available",{count:ve.length});case q.UnpurchasableB2B:return O.translate("stock.unpurchasable_product.message");case q.Unpurchasable:return O.translate("stock.unpurchasable_product_generic.message");case q.QuantityChange:return O.translate("stock.quantity_update.description");case q.Unshippable:return O.translate("stock.unshippable_product.message",{count:ve.length});case q.Unfulfillable:return Qe?O.translate("stock.unfulfillable_product.message",{delivery_method:Qe,count:ve.length}):(Q.error(new ee),O.translate("stock.unfulfillable_product.default_message",{count:ve.length}));default:return O.translate("stock.items_unavailable_notice")}};return n(B,{section:"stock-problems",children:[n(N,{children:Ae()}),n(g,{message:$e(),errorType:f.InventoryError,children:n(b,{gap:"large-500",children:[n(A,{status:"warning",children:[n(y,{children:(()=>
1{if(!me.showLineItems)return me.title;switch(_e){case q.UnpurchasableB2B:return O.translate("stock.unpurchasable_product.header");case q.Unpurchasable:return O.translate("stock.unpurchasable_product_generic.header");case q.Unshippable:return O.translate("stock.unshippable_product.header",{count:ve.length});case q.Unfulfillable:return O.translate("stock.unfulfillable_product.title");default:return Ae()}})()}),n(k,{color:"subdued",children:$e()})]}),n($,{children:[ve.length>0&&me.showLineItems?n(E,{children:n(v,{children:n(U,{titleHidden:!0,border:"outer",spacing:"none",title:_e===q.QuantityChange?O.translate("stock.quantity_update.page_title"):Ae(),children:[n(I,{blockPadding:"base",children:[n(w,{hidden:!0,children:O.translate("order_summary.product_image_label")}),n(w,{primary:!0,children:n(_,{type:"strong",children:O.translate("order_summary.description_label")})}),n(w,{hidden:_e!==q.OutOfStock,children:n(_,{type:"strong",children:_e===q.OutOfStock?O.translate("order_summary.quantity_label"):O.translate("order_summary.description_label")})})]}),n(x,{children:ve.map((({proposed:e,negotiated:a})=>{const t=a??e,r=e?.quantity,l=a?.quantity,{stableId:s,image:i,title:c}=t;return n(P,{spacing:"base",blockPadding:"base",children:[n(j,{children:n(C,{src:i?.one,srcSet:i?`${i.one} 1x, ${i.two} 2x, ${i.four} 4x`:void 0,alt:i?.altText})}),n(j,{primary:!0,children:n(L,{id:null,deferredAmount:t.deferredAmount,options:t.options,properties:t.properties,recurringTotal:t.recurringTotal,sellingPlan:t.sellingPlan,subtitle:t.subtitle,title:c,totalPrice:t.totalPrice})}),n(j,{noWrap:!0,children:null!=l&&l>0&&!ke.has(s)?n(b,{alignItems:"end",gap:"small-400",children:[n(re,{quantity:l,previousQuantity:r??0}),je?n(T,{id:`remove-${s}`,onClick:()=>(e=>{const a=he.peek();he.value=a.filter((({stableId:a,quantity:t})=>a!==e&&t>0)),de("stock-problems-remove-item")})(s),children:O.translate("stock.remove")}):null]}):n(te,{merchandiseIssueType:_e})})]},s)}))})]})})}):null,ze||Me?n(H,{children:[ze,Me]}):null]})]})})]})}function te({merchandiseIssueType:e}){const{i18n:a}=R();return n(Q,{gridAutoFlow:"column",gridAutoColumns:"minmax(auto, max-content)",gridTemplateColumns:"minmax(auto, max-content)",gridTemplateRows:"minmax(0, 1fr)",gap:"small-400",alignItems:"center",alignContent:"center",children:[n(m,{type:"disabled",tone:"critical",size:"small"}),n(O,{children:(()=>{switch(e){case q.Unfulfillable:case q.Unavailable:return a.translate("contextual_availability.unavailable_label");case q.UnpurchasableB2B:return a.translate("stock.unpurchasable_product.status_column_header");case q.Unpurchasable:return a.translate("stock.unpurchasable_product_generic.status_column_header");case q.Unshippable:return a.translate("stock.unshippable_product.status_column_header");default:return a.translate("stock.sold_out_label")}})()})]})}function re({quantity:e,previousQuantity:a}){return n(b,{direction:"inline",gap:"small-200",children:[n(_,{color:"subdued",children:a}),n(_,{color:"subdued",children:"→"}),n(_,{type:"strong",children:e})]})}export{ae 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.