PageSourceSearch

https://store.sirui.com/cdn/shopifycloud/checkout-web/assets/c1/page-Throttle.BnP7eR_7.js

js sirui.com collected 2026-09-24 22:13:43 UTC 10,635 bytes, 1 lines download raw bytes

1import{k as L,h as S,$ as ie,M as oe,l as J,f as w,A as x,u as e,g as se,T as ce,p as ue,i as T}from"./esnext-vendor.BBoIVOQW.js";import{cF as X,cG as q,n as M,P as m,L as de,k as p,B as A,Y,A as he,l as E,W as me,I as Z,a8 as fe,f as pe,o as ge,X as ve,G as U,cH as be,b as ye,ap as _e,am as Te,an as z,ao as we,aj as xe,ag as H,ak as Se,cI as Ie}from"./hydrate.Tsur0pib.js";import{S as ke}from"./Section-SectionStyleOverride.DC78UZTk.js";import{a5 as K,T as v,I as Ae,cQ as Ee,bC as Pe}from"./addresses-is-address-empty.ZJ1ThpFy.js";import{u as Re,S as Ve}from"./Page.B9pV9lua.js";import{S as ee}from"./app.CUBUOQtX.js";import{d as Le}from"./shared-report-graphql-error.DXFM-a8I.js";import"./shared-permissions.DW7FOCqf.js";import"./hooks-useShopPayExternalAppContext.YLtTu3k6.js";import"./shared-negotiation-input-redeemable.DoYPkwkm.js";function te(){const[t,n]=L(typeof document>"u"?"visible":document.visibilityState);return S(()=>{const r=()=>n(document.visibilityState);return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}},[]),t}function qe(t){return t.length===0?"empty":t.every(G)?"unavailable":t.some(G)?"partially_available":"available"}function G(t){return t.available===!1}const Me={id:"186ea50e2b37f36013ff760cddcee64b27d2785edc79d3078d8bb95e4186410b",type:"query",name:"ThrottlePoll",source:"query ThrottlePoll($token:String!,$variantIdsV2:[Int!]){poll(token:$token,variantIdsV2:$variantIdsV2){...on PollContinue{token pollAfter queueEtaSeconds productVariantAvailabilityV2{available id __typename}__typename}...on PollComplete{token __typename}__typename}}"};class k extends ee{constructor(){super(...arguments),this.name="ThrottleError",this.defaultGroupingHash="ThrottleError::Exiting::Status"}}class O extends ee{constructor(){super(...arguments),this.name="UnactionableThrottleError",this.unactionable=!0}}function Be(){const[t,n]=L(null),r=X(),a=ie(),[i,o]=L(),{throttle:s,setThrottle:_}=q(),{value:I}=K().merchandiseLines,{graphql:{throttleGraphql:b},observability:P}=v();if(S(()=>{n(u=>u??new Date)},[]),Ce(async()=>{if(s.status==="queued")try{const u=I?I.lines.filter(h=>h.variantId).map(h=>re(h.variantId)):[],{data:d,error:g}=await b.staticQuery(Me,{cache:!1,variables:{token:s.token,variantIdsV2:u}});if(!r.current)return;if(g)throw g;if(!d)throw new k("Throttle poll did not return data",{groupingHash:"ThrottleError::PollMissingReturnData"});const c=$e(d,s);c.status==="queued"&&s?.pollAfter===c.pollAfter&&(c.pollAfter=Date.now()+1e3),_(c),n(new Date),a.reset()}catch(u){const d=a.next(),g=d.done,c=Le(u),h=u instanceof oe?u.response.status:void 0;if(g){o(new(c.actionable?k:O)("Throttle exited on maximum retries",{cause:u})),P.counter({name:"throttle_exited_on_maximum_retries",value:1});return}else if(h&&h<500){o(new(c.actionable?k:O)(`Throttle exiting on ${h} status`,{cause:u}));return}_({...s,pollAfter:Date.now()+d.value})}},s.status==="queued"?s.pollAfter:void 0),i)throw i;return{throttle:s,lastUpdated:t}}function Ce(t,n){const r=x(t);r.current=t;const a=te();S(()=>{if(!n)return;const i=Math.max(n-Date.now(),0);if(i===0)r.current();else{const o=setTimeout(r.current,i);return()=>clearTimeout(o)}},[n,a])}function $e({poll:t},n){if(t.__typename==="PollContinue")return{status:"queued",pollAfter:new Date(t.pollAfter).getTime(),token:t.token,queueEtaSeconds:t.queueEtaSeconds??void 0,productVariantAvailabilityV2:t.productVariantAvailabilityV2,pollUrl:n.pollUrl};if(t.__typename==="PollComplete")return{status:"complete",token:t.token,productVariantAvailabilityV2:n.productVariantAvailabilityV2};throw new k("unable to handle Throttle type",{groupingHash:"ThrottleError::ThrottleType"})}function De(){const{throttle:t}=q(),n=J(t),r=K().merchandiseLines;return w(()=>{const a=n.value;if(a.status==="inactive"||a.status==="loading"||!r.value)return[];const i=new Map(a.productVariantAvailabilityV2.map(({id:o,available:s})=>[o,s]));return r.value.lines.filter(o=>o.variantId).map(o=>({...o,available:i.get(re(o.variantId))}))})}function re(t){return parseInt(Ae(t),10)}function Q({inventoryStatus:t}){const{i18n:n,shop:{hasStorefront:r},url:a,checkout:{configuration:i}}=v(),o=t==="empty"?n.translate("stock.empty_cart_label"):n.translate("throttle.inventory.sold_out.heading"),s=t==="empty"?n.translate("stock.return_to_store_label"):n.translate("throttle.inventory.sold_out.link");return e(p,{gap:"small-200",alignItems:"center",padding:"large-300",children:[e(M,{level:1,children:o}),r&&t==="unavailable"&&e(m,{size:"large",textAlign:"center",children:n.translate("throttle.inventory.sold_out.storefront_body")}),r&&i.allowRedirectToStorefront&&e(m,{textAlign:"center",children:e(de,{href:a.storefront(),children:s})}),!r&&t==="unavailable"&&e(m,{size:"large",textAlign:"center",children:n.translate("throttle.inventory.sold_out.no_storefront_body")})]})}function Fe({heading:t,details:n,children:r}){return e(Y,{borderRadius:"base",border:"base",children:[e(A,{padding:"large-200",accessibilityRole:"header",children:e(p,{direction:"inline",gap:"small-200",alignItems:"baseline",children:[e(M,{level:2,children:t}),n?e(m,{color:"subdued",type:"small",children:n}):null]})}),e(A,{borderWidth:"base none none none",padding:"large-200",children:r})]})}function Ne(){const{i18n:t}=v();return e(me,{tone:"warning",errorType:he.InventoryError,children:e(m,{type:"small",children:e(E,{type:"strong",children:t.translate("throttle.inventory.partial_inventory_banner")})})})}const Ue="NMORO",W={ProgressBar:Ue,"ProgressBar-line":"zetxR"};function ze({barCount:t=7}){const r={"--ProgressBar-width":`${t*13}px`},a=[];for(let i=0;i<t;i++)a.push(e("div",{className:se(W["ProgressBar-line"])},i));return e("div",{className:W.ProgressBar,style:r,children:a})}const j=60;function He(){const{i18n:t}=v(),{throttle:n}=q(),r=n.status==="queued"?n.queueEtaSeconds:0,a=ce(()=>r==null?t.translate("throttle.estimated_wait_time.calculating"):r<j?t.translate("throttle.estimated_wait_time.less_than_one"):t.translate("throttle.estimated_wait_time",{count:Math.round(r/j)}),[r,t]);return e(p,{alignItems:"center",gap:"large-200",padding:"large-200",children:[e(ze,{}),e(p,{gap:"small-200",alignItems:"center",children:[e(M,{level:1,textAlign:"center",children:t.translate("throttle.line_to_check_out")}),e(m,{size:"base",children:a})]})]})}const Ge="broxv",Oe={Text:Ge};function Qe(){const{i18n:t}=v(),n=t.translate("throttle.merchandise.available").trim();return n.length===0?null:e(m,{children:e(p,{direction:"inline",gap:"small-400",alignItems:"center",children:[e(Z,{size:"small-200",tone:"success",type:"check"}),e(E,{type:"strong",tone:"success",size:"small",children:e("span",{className:Oe.Text,children:n})})]})})}const We="hG8Tu",je={Text:We};function Je(){const{i18n:t}=v(),n=t.translate("throttle.merchandise.sold_out").trim();return n.length===0?null:e(fe,{children:e(p,{direction:"inline",gap:"small-400",alignItems:"center",children:[e(Z,{size:"small-200",tone:"critical",type:"disabled"}),e(E,{size:"small",children:e("span",{className:je.Text,children:n})})]})})}function Xe(t){return t.endsWith("status: 429")}function ct(){const{progress:t}=pe(),n=J(Be()),{i18n:r,shop:a,url:i,observability:o,embed:s,router:_}=v(),I=te(),b=De(),P=w(()=>b.value.length>0?b.value:null),u=X(),d=w(()=>n.value.throttle.status),g=w(()=>n.value.lastUpdated),c=w(()=>d.value==="complete"||d.value==="queued"?qe(b.value):null),h=x(t),{currentPage:ne}=ge().value;h.current=t;const B=x(!1);ue(()=>{if(B.current)return;const y=c.value;if(!y)return;const f=b.value;o.counter({name:"throttle_rendered",value:1,attributes:{throttle_status:d.value,inventory_status:y,merchandise_available:f.filter(({available:l})=>l).length,merchandise_unavailable:f.filter(({available:l})=>!l).length,has_storefront:a.hasStorefront}}),B.current=!0});const C=x(!1);S(()=>{C.current||(C.current=!0,Pe(s,"throttle"))},[s]),Ee(d.value==="complete"&&I==="hidden"?r.translate("throttle.time_to_checkout_title",{shopName:a.name}):d.value==="loading"?r.translate("general.loading_title",{shopName:a.name}):r.translate("general.full_title",{pageTitle:r.translate("throttle.title"),shopName:a.name}));const R=ne?.route,V=x(!1);S(()=>{function y(l){return l.status==="fetch_failed"&&Xe(l.reason)&&!V.current&&u.current}function f(){h.current("throttle-run",l=>{l.status==="throttled"&&u.current?(V.current=!1,f()):y(l)?(V.current=!0,f()):(l.status==="error"||l.status==="fetch_failed")&&(R?_.navigate(R,{replace:!0}):window.location.assign(i.cart()))})}f()},[h,u,i,R,_]),Re({stage:Ve.Usable,id:"Throttle"});const{header:{logo:$}}=ve();return d.value==="inactive"?null:e(U,{placeItems:"center",minBlockSize:"100vh",background:"base",children:e(A,{maxInlineSize:"450px",padding:"base",children:e(ke,{target:"card",children:e(Y,{accessibilityLabel:r.translate("throttle.title"),children:e(p,{gap:"base",children:[$&&e(U,{gridAutoFlow:"column",gridTemplateColumns:"minmax(0, 1fr)",gridTemplateRows:"minmax(0, 1fr)",justifyContent:"center",justifyItems:"center",children:e(be,{width:$.maxWidth})}),e(T,{when:()=>c.value==="empty",fallback:e(T,{when:()=>c.value==="unavailable",fallback:e(He,{}),children:e(Q,{inventoryStatus:"unavailable"})}),children:e(Q,{inventoryStatus:"empty"})}),e(T,{when:P,children:y=>e(Fe,{heading:r.translate("throttle.cart_summary_heading"),details:g.value?r.translate("throttle.last_checked",{time:r.formatDate(g.value,{hour:"numeric",minute:"numeric",timeZoneName:"short"})}):void 0,children:[e(T,{when:()=>c.value==="partially_available",children:[e(Ne,{}),e(ye,{blockSize:"large-200"})]}),e(_e,{children:[e(Te,{hidden:!0,children:[e(z,{hidden:!0,children:r.translate("order_summary.product_image_label")}),e(z,{hidden:!0,children:r.translate("order_summary.description_label")})]}),e(we,{children:y.map(({digest:f,image:l,available:D,title:ae,subtitle:F,quantity:le,properties:N})=>e(xe,{children:[e(H,{children:e(Se,{src:l?.one,srcSet:l?`${l.one} 1x, ${l.two} 2x, ${l.four} 4x`:void 0,alt:l?.altText,totalItems:le})}),e(H,{primary:!0,children:[e(m,{children:e(E,{type:"strong",children:ae})}),F?e(m,{color:"subdued",children:F}):null,N?e(Ie,{properties:N}):null,D==null?null:e(Ye,{available:D})]})]},f))})]})]})}),e(T,{when:()=>c.value!=="empty"&&c.value!=="unavailable",children:e(A,{padding:"large-200 none",children:e(p,{alignItems:"center",gap:"small-200",accessibilityRole:"footer",children:[e(m,{color:"subdued",textAlign:"center",children:r.translate("throttle.footer.heading")}),e(m,{color:"subdued",textAlign:"center",children:r.translate("throttle.footer.body")})]})})})]})})})})})}function Ye({available:t}){return t?e(Qe,{}):e(Je,{})}export{ct 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.