1;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="bf142960-085e-6125-0025-a50342457ea8")}catch(e){}}(); 2(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,225485,e=>{"use strict";var t=e.i(843476),a=e.i(271645),r=e.i(657688),s=e.i(401851),i=e.i(974875),n=e.i(826514),l=e.i(585890),d=e.i(146387),o=e.i(926805),c=e.i(810818),u=e.i(632781),m=e.i(255664);e.i(986823);var p=e.i(113827),h=e.i(268531),x=e.i(499971),g=e.i(645636),f=e.i(35695);e.i(632821);var y=e.i(559528),b=e.i(362474);e.i(924856);var v=e.i(876765),N=e.i(884567);e.i(787129);var S=e.i(66237),_=e.i(747925),w=e.i(594249),j=e.i(171869);function C({options:e,isLoading:a,selectedId:s,onSelect:i,productName:n}){return a?(0,t.jsxs)("div",{className:"grid gap-3","aria-busy":"true",children:[(0,t.jsx)(j.Skeleton,{className:"h-4 w-40"}),[0,1,2].map(e=>(0,t.jsx)(j.Skeleton,{className:"h-16 w-full rounded-lg"},e))]}):(0,t.jsxs)("div",{className:"grid min-w-0 gap-3",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:"Add an attachment"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground text-pretty",children:n?`Choose an attachment for your ${n}. It's added to your order as its own line so your supplier has it ready.`:"Choose an attachment. It's added to your order as its own line so your supplier has it ready."})]}),(0,t.jsxs)(w.RadioGroup,{value:s,onValueChange:i,className:"min-w-0 gap-2",children:[(0,t.jsxs)("label",{htmlFor:`attachment-${S.NO_ATTACHMENT_ID}`,className:(0,p.cn)("flex min-w-0 cursor-pointer items-center gap-3 rounded-lg border p-3 transition-colors",s===S.NO_ATTACHMENT_ID?"border-primary bg-primary/5":"border-input bg-background hover:bg-muted"),children:[(0,t.jsx)(w.RadioGroupItem,{value:S.NO_ATTACHMENT_ID,id:`attachment-${S.NO_ATTACHMENT_ID}`}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("span",{className:"block text-sm font-medium text-foreground",children:"No attachment"}),(0,t.jsx)("span",{className:"block text-xs text-muted-foreground",children:"Continue with just the equipment"})]})]}),e.map(e=>{let a=e.mainProductId===s;return(0,t.jsxs)("label",{htmlFor:`attachment-${e.mainProductId}`,className:(0,p.cn)("flex min-w-0 cursor-pointer items-center gap-3 rounded-lg border p-3 transition-colors",a?"border-primary bg-primary/5":"border-input bg-background hover:bg-muted"),children:[(0,t.jsx)(w.RadioGroupItem,{value:e.mainProductId,id:`attachment-${e.mainProductId}`}),(0,t.jsx)("div",{className:"flex h-11 w-11 flex-shrink-0 items-center justify-center overflow-hidden rounded-md border border-border bg-muted",children:e.imageUrl?(0,t.jsx)(r.default,{src:e.imageUrl,alt:e.name,width:44,height:44,className:"h-full w-full object-cover",unoptimized:!0}):(0,t.jsx)(_.Wrench,{className:"h-5 w-5 text-muted-foreground","aria-hidden":"true"})}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("span",{className:"block truncate text-sm font-medium text-foreground",children:e.name}),(0,t.jsx)("span",{className:"block text-xs text-muted-foreground",children:(0,S.formatAttachmentCostLabel)(e)})]})]},e.mainProductId)})]})]})}e.i(35979);var T=e.i(539507),E=e.i(197589),A=e.i(954616),D=e.i(538691);e.i(556651);var I=e.i(960554),P=e.i(108526);e.i(467541);var O=e.i(819858),M=e.i(5740);e.s(["SupplierSelectionDrawer",0,function({open:e,onOpenChange:_,result:w,productName:j,productSummary:k=null,quantity:R,wasteTypeName:L,isDelivery:q,showRemovalDate:U,timeSlots:B,selectedTimeSlotId:Q,onSelectTimeSlot:K,startDate:F,endDate:G,onStartDateChange:$,onEndDateChange:H,userAddressId:V,latitude:Y,longitude:W,wasteTypeId:z,timesPerWeek:J,shiftCount:X,submitDisabledReason:Z=null,onAddToCart:ee,isSubmitting:et,canSubmit:ea,canBackdateOrders:er,attachmentStepEnabled:es=!1,attachmentOptions:ei=[],attachmentLoading:en=!1,selectedAttachmentId:el=S.NO_ATTACHMENT_ID,onSelectAttachment:ed}){let[eo,ec]=(0,a.useState)(!1),[eu,em]=(0,a.useState)(!1),[ep,eh]=(0,a.useState)("dates"),[ex,eg]=(0,a.useState)(e);ex!==e&&(eg(e),e||eh("dates"));let ef=(0,a.useMemo)(()=>
2{if(F)try{return(0,n.parseISO)(F)}catch{return}},[F]),ey=(0,a.useMemo)(()=>{if(G)try{return(0,n.parseISO)(G)}catch{return}},[G]),eb=w?(0,M.toSellerProductSellerLocationEntity)(w.spsl):null,ev=eb?.productExpanded?.mainProductExpanded??null,eN=(0,T.isMultiStepEquipmentProduct)(ev),eS=(0,a.useMemo)(()=>(0,l.startOfDay)(new Date),[]),e_=(0,T.resolveOrderDateFloor)({orderType:q?E.OrderOrderType.DELIVERY:E.OrderOrderType.PICKUP,isEquipment:eN,canBackdate:er}),ew=!!ef&&(!e_||!(0,i.isBefore)((0,l.startOfDay)(ef),e_)),ej=!!ef&&!!ey&&!(0,i.isBefore)(ey,ef),eC=ew&&(ej||!U),eT=!!ef&&!!e_&&(0,i.isBefore)((0,l.startOfDay)(ef),e_),eE=eT&&(0,T.requiresEquipmentLeadTime)(q?E.OrderOrderType.DELIVERY:E.OrderOrderType.PICKUP,eN),eA=ef?eE?(0,T.formatEquipmentLeadTimeMessage)(e_):eT?e_&&e_.getTime()>eS.getTime()?T.SAME_DAY_ORDER_CUTOFF_MESSAGE:"Start date must be today or later.":null:"Select a start date.",eD=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(!e||!eE||!ef){e||(eD.current=null);return}let t=(0,N.formatLocalDateToDateOnly)(ef);eD.current!==t&&(eD.current=t,(0,y.track)(v.EQUIPMENT_LEAD_TIME_BLOCKED,{surface:"add_to_cart",product_name:j,attempted_date:t,earliest_allowed_date:(0,N.formatLocalDateToDateOnly)(e_)}))},[e,eE,ef,j,e_]);let eI=U?ey?ef&&(0,i.isBefore)(ey,ef)?"End date must be after start date.":null:"Select an end date.":null,eP=U?G:F,{pricingResponse:eO}=function(e){let[t,r]=(0,a.useState)(null),[s,i]=(0,a.useState)(!1),{mutate:n,isPending:l}=(0,A.useMutation)({mutationFn:D.fetchSupplierSelectionPricing,onMutate:()=>{r(null),i(!1)},onSuccess:e=>{r(e)},onError:()=>{i(!0)}});return(0,a.useEffect)(()=>{if(!e.enabled)return;let t=e.sellerProductSellerLocationId;if(!t)return;let a=null!==e.latitude&&null!==e.longitude;(e.userAddressId||a)&&n({sellerProductSellerLocationId:t,userAddressId:e.userAddressId,latitude:e.latitude,longitude:e.longitude,wasteTypeId:e.wasteTypeId,startDate:e.startDate,endDate:e.endDate,timesPerWeek:e.timesPerWeek,shiftCount:e.shiftCount,isPickup:e.isPickup})},[n,e.enabled,e.endDate,e.latitude,e.longitude,e.sellerProductSellerLocationId,e.shiftCount,e.startDate,e.timesPerWeek,e.userAddressId,e.wasteTypeId,e.isPickup]),{pricingResponse:t,pricingError:s,pricingLoading:l}}({enabled:e&&eC,sellerProductSellerLocationId:w?.spsl.id??null,userAddressId:V,latitude:Y,longitude:W,wasteTypeId:z,startDate:F,endDate:eP,timesPerWeek:J,shiftCount:X,isPickup:!q}),eM=!!F&&(!U||!!G),ek=B.some(e=>e.id===Q&&/morning/i.test(e.name)),eR=eM?eC?Z||(V?Q?ea?null:"Complete required fields":"Select time slot":"Select address"):"Select valid dates":"Select dates to continue",eL="Sign in to continue"===eR,eq=eO?.total!=null?eO.total*R:null,eU=et?"Adding to cart...":"Add to cart",eB=eb?.sellerLocationExpanded??null,eQ=eB?.id??void 0,{data:eK}=(0,I.useLocationAvailabilityBlocks)(eQ,void 0,{enabled:e&&!!eQ}),eF=(0,a.useMemo)(()=>(0,P.expandBlockedDays)(eK).days,[eK]),eG=(0,a.useCallback)(e=>eF.has((0,s.format)(e,"yyyy-MM-dd")),[eF]),e$=eB?(0,O.toSellerLocationEntity)(eB).sellerExpanded:null,eH=eB&&(eB.name||e$?.marketplace_display_name||e$?.name)||"Supplier",eV=eB&&(eB.location_logo_image||e$?.location_logo_url||e$?.logo)||null,eY=[j,...k?[k]:[L,R>1?`Qty ${R}`:null]].filter(Boolean).join(" · "),eW=es&&(en||ei.length>0),ez=ei.find(e=>e.mainProductId===el)??null,eJ=()=>{(0,y.track)(b.ADDED_TO_CART,{product_name:j,supplier_name:eH,quantity:R,is_delivery:q,start_date:F}),ez&&(0,y.track)(b.ADDED_TO_CART,{product_name:ez.name,supplier_name:eH,quantity:1,is_delivery:q,start_date:F,[S.ATTACHMENT_ANALYTICS_PROPS.isAttachment]:!0,[S.ATTACHMENT_ANALYTICS_PROPS.parentProduct]:j}),ee(eq,eO?.pricing_snapshot_token??w?.pricing?.pricing_snapshot_token)},eX=(0,t.jsxs)("div",{className:"grid min-h-0 flex-1 gap-6 overflow-y-auto px-5 py-6",children:[(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsxs)("label",{className:"text-sm font-semibold text-foreground",children:[q?"Delivery date":"Pickup date"," ",(0,t.jsx)("span",{className:"text-destructive","aria-hidden":"true",children:"*"}),(0,t.jsx)("span",{className:"sr-only",children:"(required)"})]}),(0,t.jsxs)(f.Popover,{open:eo,onOpenChange:ec,children:[(0,t.jsx)(f.PopoverTrigger,{asChild:!0,children:(0,t.jsxs)(x.Button,{variant:"outline",className:(0,p.cn)("h-11 w-full justify-start text-left font-normal",!ef&&"text-muted-foreground"),children:[(0,t.jsx)(o.CalendarIcon,{className:"mr-2 h-4 w-4"}),ef?(0,s.format)(ef,"MMM d, yyyy"):"Select date"]})}),(0,t.jsx)(f.PopoverContent,{className:"w-auto p-0",align:"start",children:(0,t.jsx)(g.Calendar,{mode:"single",selected:ef,onSelect:e=>{e&&$((0,s.format)(e,"yyyy-MM-dd")),ec(!1)},disabled:e=>!!(e_&&(0,i.isBefore)((0,l.startOfDay)(e),e_))||eG(e),className:"pointer-events-auto"})})]}),ef&&eA?(0,t.jsx)("p",{className:"text-xs text-destructive",children:eA}):null]}),U?(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsxs)("label",{className:"text-sm font-semibold text-foreground",children:["Est. Removal Date ",(0,t.jsx)("span",{className:"text-destructive","aria-hidden":"true",children:"*"}),(0,t.jsx)("span",{className:"sr-only",children:"(required)"})]}),(0,t.jsx)(m.TooltipProvider,{delayDuration:200,children:(0,t.jsxs)(m.Tooltip,{children:[(0,t.jsx)(m.TooltipTrigger,{asChild:!0,children:(0,t.jsx)(c.Info,{className:"h-3.5 w-3.5 cursor-pointer text-muted-foreground"})}),(0,t.jsx)(m.TooltipContent,{side:"top",className:"max-w-64 text-xs leading-relaxed",children:"This is an estimated length of rental. You will need to request the date for removal later via the control tower."})]})})]}),(0,t.jsxs)(f.Popover,{open:eu,onOpenChange:em,children:[(0,t.jsx)(f.PopoverTrigger,{asChild:!0,children:(0,t.jsxs)(x.Button,{variant:"outline",className:(0,p.cn)("h-11 w-full justify-start text-left font-normal",!ey&&"text-muted-foreground"),children:[(0,t.jsx)(o.CalendarIcon,{className:"mr-2 h-4 w-4"}),ey?(0,s.format)(ey,"MMM d, yyyy"):"Select date"]})}),(0,t.jsx)(f.PopoverContent,{className:"w-auto p-0",align:"start",children:(0,t.jsx)(g.Calendar,{mode:"single",selected:ey,onSelect:e=>{e&&H((0,s.format)(e,"yyyy-MM-dd")),em(!1)},disabled:e=>(ef?e<ef:!!(e_&&(0,i.isBefore)((0,l.startOfDay)(e),e_)))||eG(e),className:"pointer-events-auto"})})]}),ey&&eI?(0,t.jsx)("p",{className:"text-xs text-destructive",children:eI}
2):null]}):null]}),eF.size>0?(0,t.jsx)("p",{className:"-mt-2 text-xs text-muted-foreground",children:"Greyed-out dates are unavailable at this branch."}):null,B.length>0?(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-semibold text-foreground",children:q?"Delivery time":"Pickup time"}),(0,t.jsx)("div",{className:"flex w-full gap-2",children:B.map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>K(e.id),className:(0,p.cn)("flex-1 rounded-lg border px-3 py-2.5 text-center text-sm font-medium transition-colors",Q===e.id?"border-primary bg-primary text-primary-foreground":"border-input bg-background text-muted-foreground hover:bg-muted"),children:e.name},e.id))}),ek?(0,t.jsx)("p",{className:"text-xs text-destructive",children:"Morning delivery is not guaranteed. It's recommended to schedule delivery the day before."}):null]}):null]}),eZ=(0,t.jsx)("div",{className:"grid min-h-0 min-w-0 flex-1 gap-6 overflow-y-auto px-5 pt-4 pb-6",children:(0,t.jsx)(C,{options:ei,isLoading:en,selectedId:el,onSelect:e=>ed?.(e),productName:j})}),e0=(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"flex h-10 w-10 flex-shrink-0 items-center justify-center overflow-hidden rounded-lg border border-border bg-muted",children:eV?(0,t.jsx)(r.default,{src:eV,alt:eH,width:40,height:40,className:"h-full w-full object-cover",unoptimized:!0}):(0,t.jsx)(d.Building2,{className:"h-5 w-5 text-muted-foreground"})}),(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("span",{className:"block truncate font-semibold",children:eH}),eY?(0,t.jsx)("p",{className:"truncate text-sm font-normal text-muted-foreground",children:eY}):null]})]}),e1=!eL&&(!ea||et||!eC||!eM),e2=eW?(0,t.jsxs)(x.Button,{className:"h-12 w-full text-base font-semibold",onClick:()=>{en||eh("attachments")},disabled:e1||en,children:[en?(0,t.jsx)(u.Loader2,{className:"mr-2 h-5 w-5 animate-spin"}):null,"Continue"]}):(0,t.jsxs)(x.Button,{className:"h-12 w-full text-base font-semibold",onClick:eJ,disabled:e1,children:[et?(0,t.jsx)(u.Loader2,{className:"mr-2 h-5 w-5 animate-spin"}):null,eU]}),e5=(0,t.jsxs)("div",{className:"flex w-full gap-3",children:[(0,t.jsx)(x.Button,{variant:"outline",className:"h-12 flex-1 text-base font-semibold",onClick:()=>eh("dates"),disabled:et,children:"Back"}),(0,t.jsxs)(x.Button,{className:"h-12 flex-[2] text-base font-semibold",onClick:eJ,disabled:!ea||et||!eC||!eM,children:[et?(0,t.jsx)(u.Loader2,{className:"mr-2 h-5 w-5 animate-spin"}):null,eU]})]}),e4=eR&&!eL?(0,t.jsx)("p",{className:"mb-2 text-center text-xs font-medium text-muted-foreground",role:"status",children:eR}):null,e6=(0,t.jsxs)("div",{className:"w-full",children:[e4,"attachments"===ep&&eW?e5:e2]});return(0,t.jsx)(h.ResponsiveModal,{open:e,onOpenChange:e=>{e||(eh("dates"),_(!1))},title:e0,description:void 0,dialogContentProps:{className:"max-w-md max-h-[85vh] flex flex-col p-0"},dialogHeaderProps:{className:"border-b border-border px-5 pt-4 pb-4 text-left"},drawerContentProps:{className:"max-h-[90vh] p-0"},drawerHeaderProps:{className:"border-b border-border px-5 pt-4 pb-4 text-left"},dialogFooterProps:{className:"border-t border-border bg-background px-5 pt-4 pb-4"},drawerFooterProps:{className:"border-t border-border bg-background px-5 pt-4 pb-[calc(env(safe-area-inset-bottom)+1rem)]"},footer:e6,children:"attachments"===ep&&eW?eZ:eX})}],225485)},273160,716223,896930,293553,e=>{"use strict";var t=e.i(271645),a=e.i(912598),r=e.i(130691);e.i(197792);var s=e.i(870361);e.i(787129);var i=e.i(884638);e.i(35979);var n=e.i(242644),l=e.i(567254),d=e.i(756202);e.s(["useAddToCart",0,function(e){let o=(0,a.useQueryClient)(),{toast:c}=(0,d.useToast)(),[u,m]=(0,t.useState)(!1),p=(0,t.useCallback)(async(t,a)=>{if(!u){m(!0);try{let{addedCount:r,orderGroups:d}=await (0,i.addAssetToCart)(t,e);r>0&&((0,s.addOrderGroupsToCartListCaches)(o,d),(0,n.addOrderGroupsToOrderGroupListCaches)(o,d),(0,l.invalidateAfterCartChange)(o,{userAddressId:t.userAddressId})),r===t.quantity?(c({title:"Added to cart",description:1===r?"The item was added to your cart.":`${r} items were added to your cart.`}),a?.onSuccess?.(r)):r>0?(c({title:"Partially added to cart",description:`${r} of ${t.quantity} items were added. Please try again for the remaining item(s).`,variant:"destructive"}),a?.onSuccess?.(r)):c({title:"Unable to add to cart",description:"Something went wrong while adding this to your cart. Please try again.",variant:"destructive"})}catch(e){c({title:"Unable to add to cart",description:(0,r.getApiErrorMessage)(e,"Something went wrong while adding this to your cart. Please try again."),variant:"destructive"})}finally{m(!1),a?.onSettled?.()}}},[u,o,e,c]),h=(0,t.useCallback)(async(t,a)=>{if(!u&&0!==t.length){if(1===t.length)return void await p(t[0],a);m(!0);try{let r=t.reduce((e,t)=>
2e+t.quantity,0),{addedCount:d,orderGroups:u}=await (0,i.addAssetsToCart)(t,e);u.length>0&&((0,s.addOrderGroupsToCartListCaches)(o,u),(0,n.addOrderGroupsToOrderGroupListCaches)(o,u),(0,l.invalidateAfterCartChange)(o,{userAddressId:t[0].userAddressId})),d>=r?(c({title:"Added to cart",description:`${d} items were added to your cart.`}),a?.onSuccess?.(d)):d>0?(c({title:"Partially added to cart",description:`${d} of ${r} items were added. Please try again for the remaining item(s).`,variant:"destructive"}),a?.onSuccess?.(d)):c({title:"Unable to add to cart",description:"Something went wrong while adding these to your cart. Please try again.",variant:"destructive"})}catch(e){c({title:"Unable to add to cart",description:(0,r.getApiErrorMessage)(e,"Something went wrong while adding these to your cart. Please try again."),variant:"destructive"})}finally{m(!1),a?.onSettled?.()}}},[p,u,o,e,c]);return{addToCart:p,addToCartBatch:h,isSubmitting:u}}],273160);var o=e.i(266027),c=e.i(66237);e.s(["useAttachmentOptions",0,function({enabled:e,options:a,sellerLocationId:r,latitude:s,longitude:i,startDate:n,endDate:l,userAddressId:d,isPickup:u}){let m=(0,t.useMemo)(()=>a.map(e=>e.mainProductId),[a]),p=e&&!!r&&m.length>0,h=(0,o.useQuery)({queryKey:(0,c.getAttachmentSpslQueryKey)({relatedMainProductIds:m,sellerLocationId:r??""}),queryFn:()=>(0,c.fetchAttachmentSupplierSpsls)({relatedMainProductIds:m,sellerLocationId:r}),enabled:p,staleTime:6e4}),x=(0,t.useMemo)(()=>h.data?(0,c.buildResolvedAttachmentOptions)(a,h.data):[],[a,h.data]),g=(0,t.useMemo)(()=>x.map(e=>({mainProductId:e.mainProductId,spslId:e.spslId})),[x]),f=p&&x.length>0&&!!n&&!!l,y=(0,o.useQuery)({queryKey:(0,c.getAttachmentPricingQueryKey)({resolvedOptions:g,userAddressId:d,latitude:s,longitude:i,startDate:n??"",endDate:l??"",isPickup:u}),queryFn:()=>(0,c.fetchAttachmentPricing)({resolvedOptions:x,userAddressId:d,latitude:s,longitude:i,startDate:n,endDate:l,isPickup:u}),enabled:f,staleTime:6e4});return{resolvedOptions:(0,t.useMemo)(()=>y.data?(0,c.mergeAttachmentPricing)(x,y.data):x,[x,y.data]),isLoading:p&&(h.isLoading||f&&y.isLoading)}}],716223);var u=e.i(586448);e.s(["useSupplierAttachmentAvailability",0,function({enabled:e,options:a,results:r}){let s=(0,t.useMemo)(()=>a.map(e=>e.mainProductId),[a]),i=(0,t.useMemo)(()=>e?(0,c.buildSupplierAttachmentAvailabilityRequests)(r,s):[],[e,r,s]),n=(0,u.useQueries)({queries:i.map(t=>({queryKey:(0,c.getAttachmentSpslQueryKey)({relatedMainProductIds:s,sellerLocationId:t.sellerLocationId}),queryFn:()=>(0,c.fetchAttachmentSupplierSpsls)({relatedMainProductIds:s,sellerLocationId:t.sellerLocationId}),enabled:e,staleTime:6e4}))});return(0,t.useMemo)(()=>{let e=new Set;return i.forEach((t,a)=>{let r=n[a]?.data;r&&r.size>0&&e.add(t.resultId)}),e},[i,n])}],896930);var m=e.i(600222),p=e.i(538691);e.s(["useSupplierSelectionResults",0,function(e,r){let s=(0,a.useQueryClient)(),i=!!e&&(r?.enabled??!0),n=e?(0,p.getSupplierSelectionQueryKey)(e):["supplier-selection"],l=e?JSON.stringify(n):null,d=(0,o.useQuery)({queryKey:n,queryFn:async()=>{if(!e)return null;let t=await (0,p.fetchSupplierSelectionResults)(e);return(0,p.preserveSupplierSelectionPricing)(s.getQueryData(n),t)},enabled:i,staleTime:6e4}),[c,u]=(0,t.useState)(new Map),[h,x]=(0,t.useState)(new Map),g=(0,t.useRef)(new Map),f=(0,t.useCallback)((e,t,a)=>{u(r=>{let s=new Map(r),i=new Set(s.get(e)??[]);return a?i.add(t):i.delete(t),s.set(e,i),s})},[]),y=(d.data?.results??[]).map(e=>e.id).sort().join(","),b=(d.data?.results??[]).some(e=>null===e.pricing),v=(0,o.useQuery)({queryKey:e?[...n,"pricing-merge",y]:["supplier-selection","pricing-merge"],queryFn:async()=>{if(!e||!l)return null;let t=s.getQueryData(n),a=t?.results??[],r=g.current.get(l)??new Set;g.current.set(l,r);let i=a.filter(e=>null===e.pricing&&!r.has(e.id));for(let e of i)r.add(e.id);return x(e=>{let t=new Map(e);return t.set(l,new Set(i.map(e=>e.id))),t}),u(e=>{if(!e.has(l))return e;let t=new Map(e);return t.delete(l),t}),0===i.length||await (0,m.fetchAndMergePricing)(s,n,e,i,(e,t)=>f(l,e,t)),null},enabled:i&&"success"===d.status&&b,staleTime:1/0,retry:!1,refetchOnWindowFocus:!1}),N=l?c.get(l)??new Set:new Set,S=l?h.get(l)??new Set:new Set,_=new Set((d.data?.results??[]).filter(e=>"fetching"===v.fetchStatus&&S.has(e.id)&&null===e.pricing&&!N.has(e.id)).map(e=>e.id)),w=!!(e?.userAddressId&&d.data&&!d.data.marketInsights&&S.size>0&&"fetching"===v.fetchStatus);return{...d,pricingLoadingIds:_,pricingErrorIds:N,marketInsightsLoading:w}}],293553)},490262,e=>{"use strict";var t=e.i(843476),a=e.i(271645),r=e.i(635416),s=e.i(96892),i=e.i(499971),n=e.i(289954);e.i(787129);var l=e.i(538691);let d=["recommended","price","distance","name"];e.s(["SupplierSortControls",0,function({sortAttribute:e,sortDirection:a,onSortAttributeChange:l,onToggleSortDirection:d,disabled:o=!1}){return(0,t.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[(0,t.jsxs)(n.Select,{value:e,onValueChange:l,disabled:o,children:[(0,t.jsx)(n.SelectTrigger,{className:"h-8 w-auto min-w-[100px] text-xs",children:(0,t.jsx)(n.SelectValue,{})}),(0,t.jsxs)(n.SelectContent,{children:[(0,t.jsx)(n.SelectItem,{value:"recommended",children:"Recommended"}),(0,t.jsx)(n.SelectItem,{value:"price",children:"Price"}),(0,t.jsx)(n.SelectItem,{value:"distance",children:"Distance"}),(0,t.jsx)(n.SelectItem,{value:"name",children:"Name"})]})]}),(0,t.jsx)(i.Button,{variant:"outline",size:"icon",className:"h-8 w-8 rounded-full",onClick:d,disabled:o,"aria-label":"asc"===a?"Sort ascending":"Sort descending",children:"asc"===a?(0,t.jsx)(s.ArrowUp,{className:"h-4 w-4"}):(0,t.jsx)(r.ArrowDown,{className:"h-4 w-4"})})]})},"useSupplierResultsSort",0,function({recommended:e,alternatives:t}){let[r,s]=(0,a.useState)("recommended"),[i,n]=(0,a.useState)("asc"),o=(0,a.useCallback)(e=>{d.includes(e)&&s(e)},[]),c=(0,a.useCallback)(()=>{n(e=>"asc"===e?"desc":"asc")},[]),u=(0,a.useMemo)(()=>(0,l.sortSupplierResults)(e??[],r,i),[e,r,i]),m=(0,a.useMemo)(()=>(0,l.sortSupplierResults)(t??[],r,i),[t,r,i]);return{sortAttribute:r,sortDirection:i,sortedRecommended:u,sortedAlternatives:m,handleSortAttributeChange:o,toggleSortDirection:c}}])},922824,e=>{"use strict";var t=e.i(271645);e.i(35979),e.i(162441);var a=e.i(884653);e.i(165267);var r=e.i(559615);e.s(["useCanBackdateOrders",0,function(e){let s=(0,r.useOrgChart)({query:{enabled:!!e?.id},request:{headers:a.BypassImpersonationHeader}});return(0,t.useCallback)(t=>(function(e,t,a){if(e?.email?.toLowerCase()==="[email protected]")return!0;
2if(!e?.id||!t)return!1;let r=new Set(t.assignments.filter(t=>t.user.id===e.id).map(e=>e.org_unit_id));return t.org_units.some(e=>r.has(e.id)&&("Finance"===e.name||"Dispatch"===e.name&&null!=a))})(e,s.data,t),[s.data,e])}],922824)},75183,e=>{"use strict";let t=(0,e.i(456420).default)("store",[["path",{d:"M15 21v-5a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v5",key:"slp6dd"}],["path",{d:"M17.774 10.31a1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.451 0 1.12 1.12 0 0 0-1.548 0 2.5 2.5 0 0 1-3.452 0 1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.77-3.248l2.889-4.184A2 2 0 0 1 7 2h10a2 2 0 0 1 1.653.873l2.895 4.192a2.5 2.5 0 0 1-3.774 3.244",key:"o0xfot"}],["path",{d:"M4 10.95V19a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8.05",key:"wn3emo"}]]);e.s(["Store",0,t],75183)},876765,e=>{"use strict";e.s(["BUTTON_CLICKED",0,"button_clicked","CART_LINE_QUANTITY_DECREASED",0,"cart_line_quantity_decreased","CART_LINE_QUANTITY_INCREASED",0,"cart_line_quantity_increased","EQUIPMENT_LEAD_TIME_BLOCKED",0,"equipment_lead_time_blocked","PRODUCT_NEED_ARCHIVED",0,"product_need_archived","PRODUCT_NEED_CONFIGURED",0,"product_need_configured","PRODUCT_NEED_CONVERTED",0,"product_need_converted","PRODUCT_NEED_CREATED",0,"product_need_created","PRODUCT_NEED_MARKET_PREVIEW_VIEWED",0,"product_need_market_preview_viewed","PRODUCT_NEED_QUOTE_GENERATED",0,"product_need_quote_generated","PRODUCT_NEED_SUPPLIERS_COMPARED",0,"product_need_suppliers_compared"])}]); 3 4//# debugId=bf142960-085e-6125-0025-a50342457ea8
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.