1import{r as g}from"./index-U_Q2k23_.js";import{f as M,c as Q,q as le,A as ie,d as ae,n as ce,B as ue,C as de,D as fe,u as he,b as D,a as ge,E as me}from"./proxy-DuAL8J8W.js";import{r as pe}from"./resolve-elements-CzAI3m4J.js";import{j as o}from"./jsx-runtime-BNY8D6fq.js";import{t as b,F as H}from"./FkaTypography-B8HACK7K.js";import{f as xe,k as ve,g as ye}from"./chunk-JZWAC4HX-DH_2qxrt.js";import{u as Z,a as we}from"./StoreContext-TejGl15R.js";import{D as Se,u as ee,a as be,i as je}from"./index-DL2o6e1J.js";import{u as A}from"./ScreenContext-EMcuVjBA.js";import{i as O,h as V}from"./inventoryStatusUtils-DymS-_80.js";import{F as Ie,E as ke}from"./regular-Cd48J45z.js";import{L as Ce}from"./LocationPinIcon-BOJPmBOS.js";import{F as P}from"./FkaButton-CX9qFQFr.js";import{C as Ee}from"./Checkbox-BR5PUjaF.js";import{I as $}from"./Icon-xwZJVLOl.js";import{F as He}from"./FkaInput-o0kJRQKI.js";import{C as Le}from"./useCartFetcherSubmit-D0EMgrfA.js";import{S as I}from"./Sheet-DNatXs62.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"felleskjopet-web@db2b0462a3eb2da9ee89aae961df6c97cc3c4cb1"}}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=(function(t){for(var s=1;s<arguments.length;s++){var n=arguments[s];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(t[r]=n[r])}return t})({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:felleskjopet-web":!0})}catch{}})();try{(function(){var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="95a6ed71-a08c-4073-b350-fe6e9f242336",e._sentryDebugIdIdentifier="sentry-dbid-95a6ed71-a08c-4073-b350-fe6e9f242336")})()}catch{}function Et(e,t,s){g.useInsertionEffect(()=>e.on(t,s),[e,t,s])}function te(e,t){let s;const n=()=>{const{currentTime:r}=t,i=(r===null?0:r.value)/100;s!==i&&e(i),s=i};return M.update(n,!0),()=>Q(n)}const T=new WeakMap;let S;function Me(e,t){if(t){const{inlineSize:s,blockSize:n}=t[0];return{width:s,height:n}}else return e instanceof SVGElement&&"getBBox"in e?e.getBBox():{width:e.offsetWidth,height:e.offsetHeight}}function We({target:e,contentRect:t,borderBoxSize:s}){var n;(n=T.get(e))===null||n===void 0||n.forEach(r=>{r({target:e,contentSize:t,get size(){return Me(e,s)}})})}function De(e){e.forEach(We)}function Te(){typeof ResizeObserver>"u"||(S=new ResizeObserver(De))}function Be(e,t){S||Te();const s=pe(e);return s.forEach(n=>{let r=T.get(n);r||(r=new Set,T.set(n,r)),r.add(t),S?.observe(n)}),()=>{s.forEach(n=>{const r=T.get(n);r?.delete(t),r?.size||S?.unobserve(n)})}}const B=new Set;let W;function Oe(){W=()=>{const e={width:window.innerWidth,height:window.innerHeight},t={target:window,size:e,contentSize:e};B.forEach(s=>s(t))},window.addEventListener("resize",W)}function Ve(e){return B.add(e),W||Oe(),()=>{B.delete(e),!B.size&&W&&(W=void 0)}}function Ne(e,t){return typeof e=="function"?Ve(e):Be(e,t)}const ze=50,q=()=>({current:0,offset:[],progress:0,scrollLength:0,targetOffset:0,targetLength:0,containerLength:0,velocity:0}),Fe=()=>({time:0,x:q(),y:q()}),Re={x:{length:"Width",position:"Left"},y:{length:"Height",position:"Top"}};function G(e,t,s,n){const r=s[t],{length:l,position:i}=Re[t],a=r.current,u=s.time;r.current=e[`scroll${i}`],r.scrollLength=e[`scroll${l}`]-e[`client${l}`],r.offset.length=0,r.offset[0]=0,r.offset[1]=r.scrollLength,r.progress=le(0,r.scrollLength,r.current);const d=n-u;r.velocity=d>ze?0:ie(r.current-a,d)}function Pe(e,t,s){G(e,"x",t,s),G(e,"y",t,s),t.time=s}function _e(e,t){const s={x:0,y:0};let n=e;for(;n&&n!==t;)if(n instanceof HTMLElement)s.x+=n.offsetLeft,s.y+=n.offsetTop,n=n.offsetParent;else if(n.tagName==="svg"){const r=n.getBoundingClientRect();n=n.parentElement;const l=n.getBoundingClientRect();s.x+=r.left-l.left,s.y+=r.top-l.top}else if(n instanceof SVGGraphicsElement){const{x:r,y:l}=n.getBBox();s.x+=r,s.y+=l;let i=null,a=n.parentNode;for(;!i;)a.tagName==="svg"&&(i=a),a=n.parentNode;n=i}else break;return s}const Ze={All:[[0,0],[1,1]]},_={start:0,center:.5,end:1};function X(e,t,s=0){let n=0;if(e in _&&(e=_[e]),typeof e=="string"){const r=parseFloat(e);e.endsWith("px")?n=r:e.endsWith("%")?e=r/100:e.endsWith("vw")?n=r/100*document.documentElement.clientWidth:e.endsWith("vh")?n=r/100*document.documentElement.clientHeight:e=r}return typeof e=="number"&&(n=t*e),s+n}const Ae=[0,0];function Ye(e,t,s,n){let r=Array.isArray(e)?e:Ae,l=0,i=0;return typeof e=="number"?r=[e,e]:typeof e=="string"&&(e=e.trim(),e.includes(" ")?r=e.split(" "):r=[e,_[e]?e:"0"]),l=X(r[0],s,n),i=X(r[1],t),l-i}const $e={x:0,y:0};function qe(e){return"getBBox"in e&&e.tagName!=="svg"?e.getBBox():{width:e.clientWidth,height:e.clientHeight}}function Ge(e,t,s){const{offset:n=Ze.All}
1=s,{target:r=e,axis:l="y"}=s,i=l==="y"?"height":"width",a=r!==e?_e(r,e):$e,u=r===e?{width:e.scrollWidth,height:e.scrollHeight}:qe(r),d={width:e.clientWidth,height:e.clientHeight};t[l].offset.length=0;let c=!t[l].interpolate;const m=n.length;for(let f=0;f<m;f++){const p=Ye(n[f],d[i],u[i],a[l]);!c&&p!==t[l].interpolatorOffsets[f]&&(c=!0),t[l].offset[f]=p}c&&(t[l].interpolate=ae(t[l].offset,ce(n)),t[l].interpolatorOffsets=[...t[l].offset]),t[l].progress=t[l].interpolate(t[l].current)}function Xe(e,t=e,s){if(s.x.targetOffset=0,s.y.targetOffset=0,t!==e){let n=t;for(;n&&n!==e;)s.x.targetOffset+=n.offsetLeft,s.y.targetOffset+=n.offsetTop,n=n.offsetParent}s.x.targetLength=t===e?t.scrollWidth:t.clientWidth,s.y.targetLength=t===e?t.scrollHeight:t.clientHeight,s.x.containerLength=e.clientWidth,s.y.containerLength=e.clientHeight}function Ue(e,t,s,n={}){return{measure:()=>Xe(e,n.target,s),update:r=>{Pe(e,s,r),(n.offset||n.target)&&Ge(e,s,n)},notify:()=>t(s)}}const L=new WeakMap,U=new WeakMap,z=new WeakMap,J=e=>e===document.documentElement?window:e;function Y(e,{container:t=document.documentElement,...s}={}){let n=z.get(t);n||(n=new Set,z.set(t,n));const r=Fe(),l=Ue(t,e,r,s);if(n.add(l),!L.has(t)){const a=()=>{for(const f of n)f.measure()},u=()=>{for(const f of n)f.update(ue.timestamp)},d=()=>{for(const f of n)f.notify()},c=()=>{M.read(a,!1,!0),M.read(u,!1,!0),M.update(d,!1,!0)};L.set(t,c);const m=J(t);window.addEventListener("resize",c,{passive:!0}
1),t!==document.documentElement&&U.set(t,Ne(t,c)),m.addEventListener("scroll",c,{passive:!0})}const i=L.get(t);return M.read(i,!1,!0),()=>{var a;Q(i);const u=z.get(t);if(!u||(u.delete(l),u.size))return;const d=L.get(t);L.delete(t),d&&(J(t).removeEventListener("scroll",d),(a=U.get(t))===null||a===void 0||a(),window.removeEventListener("resize",d))}}function Je({source:e,container:t,axis:s="y"}){e&&(t=e);const n={value:0},r=Y(l=>{n.value=l[s].progress*100},{container:t,axis:s});return{currentTime:n,cancel:r}}const F=new Map;function ne({source:e,container:t=document.documentElement,axis:s="y"}={}){e&&(t=e),F.has(t)||F.set(t,{});const n=F.get(t);return n[s]||(n[s]=fe()?new ScrollTimeline({source:t,axis:s}):Je({source:t,axis:s})),n[s]}function Ke(e){return e.length===2}function se(e){return e&&(e.target||e.offset)}function Qe(e,t){return Ke(e)||se(t)?Y(s=>{e(s[t.axis].progress,s)},t):te(e,ne(t))}function et(e,t){if(e.flatten(),se(t))return e.pause(),Y(s=>{e.time=e.duration*s[t.axis].progress},t);{const s=ne(t);return e.attachTimeline?e.attachTimeline(s,n=>(n.pause(),te(r=>{n.time=n.duration*r},s))):de}}function tt(e,{axis:t="y",...s}={}){const n={axis:t,...s};return typeof e=="function"?Qe(e,n):et(e,n)}function K(e,t){me(!!(!t||t.current))}const nt=()=>({scrollX:D(0),scrollY:D(0),scrollXProgress:D(0),scrollYProgress:D(0)});function Ht({container:e,target:t,layoutEffect:s=!0,...n}={}){const r=he(nt);return(s?ge:g.useEffect)(()=>(K("target",t),K("container",e),tt((i,{x:a,y:u})=>{r.scrollX.set(a.current),r.scrollXProgress.set(a.progress),r.scrollY.set(u.current),r.scrollYProgress.set(u.progress)},{...n,container:e?.current||void 0,target:t?.current||void 0})),[e,t,JSON.stringify(n.offset)]),r}const st=()=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:o.jsx("path",{d:"M12 4.375C9.07031 4.375 6.41406 5.9375 4.92969 8.4375C3.48438 10.9766 3.48438 14.0625 4.92969 16.5625C6.41406 19.1016 9.07031 20.625 12 20.625C14.8906 20.625 17.5469 19.1016 19.0312 16.5625C20.4766 14.0625 20.4766 10.9766 19.0312 8.4375C17.5469 5.9375 14.8906 4.375 12 4.375ZM12 22.5C8.40625 22.5 5.125 20.625 3.32812 17.5C1.53125 14.4141 1.53125 10.625 3.32812 7.5C5.125 4.41406 8.40625 2.5 12 2.5C15.5547 2.5 18.8359 4.41406 20.6328 7.5C22.4297 10.625 22.4297 14.4141 20.6328 17.5C18.8359 20.625 15.5547 22.5 12 22.5ZM12.9375 7.5V8.4375V12.8125V13.75H11.0625V12.8125V8.4375V7.5H12.9375ZM11.0625 16.875V15H12.9375V16.875H11.0625Z",fill:"currentColor"})}),rt=()=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:o.jsx("path",{d:"M12 4.375C9.07031 4.375 6.41406 5.9375 4.92969 8.4375C3.48438 10.9766 3.48438 14.0625 4.92969 16.5625C6.41406 19.1016 9.07031 20.625 12 20.625C14.8906 20.625 17.5469 19.1016 19.0312 16.5625C20.4766 14.0625 20.4766 10.9766 19.0312 8.4375C17.5469 5.9375 14.8906 4.375 12 4.375ZM12 22.5C8.40625 22.5 5.125 20.625 3.32812 17.5C1.53125 14.4141 1.53125 10.625 3.32812 7.5C5.125 4.41406 8.40625 2.5 12 2.5C15.5547 2.5 18.8359 4.41406 20.6328 7.5C22.4297 10.625 22.4297 14.4141 20.6328 17.5C18.8359 20.625 15.5547 22.5 12 22.5ZM10.4375 15.625H11.375V13.125H10.4375H9.5V11.25H10.4375H12.3125H13.25V12.1875V15.625H13.5625H14.5V17.5H13.5625H10.4375H9.5V15.625H10.4375ZM13.25 10H10.75V7.5H13.25V10Z",fill:"currentColor"})}),ot=()=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:o.jsx("path",{d:"M3.05469 19.375L10.9062 5.66406L12 3.75L13.0547 5.66406L20.9062 19.375L22 21.25H19.8125H4.14844H2L3.05469 19.375ZM18.7578 19.375L12 7.53906L5.20312 19.375H18.7578ZM11.0625 14.0625V10.625H12.9375V14.0625V15H11.0625V14.0625ZM12.9375 18.125H11.0625V16.25H12.9375V18.125Z",fill:"currentColor"})}),Lt=({severity:e,message:t,className:s})=>{const n={info:"bg-surface-info text-text-on-info",attention:"bg-surface-attention-soft text-text-on-attention",warning:"bg-surface-warning-soft text-text-on-warning"},r={warning:o.jsx(ot,{}),attention:o.jsx(st,{}),info:o.jsx(rt,{})};return o.jsxs("div",{className:b(s,n[e],"flex min-h-7 items-center gap-2 px-2 py-1"),children:[o.jsx("span",{className:"text-[1.25em]",children:r[e]}),o.jsx(H,{variant:"long-sm-regular",color:"inherit",children:t})]})},R="drawer",Mt=e=>{const t=g.useRef(!1),s=g.useRef(!1),[n,r]=xe(),l=ve(),i=g.useMemo(()=>n.get(R)===e,[e,n]),a=ye(),u=g.useCallback(()=>
1{if(l.state==="idle"){if(t.current&&!s.current){a(-1),s.current=!0;return}r(c=>(c.delete(R),c),{preventScrollReset:!0,replace:!0})}},[a,l.state,r]),d=g.useCallback(()=>{t.current=!0,s.current=!1,r(c=>(c.set(R,e),c),{preventScrollReset:!0,replace:!1})},[e,r]);return{onClose:u,open:i,onOpen:d}},re=e=>{const{stores:t}=Z();return g.useMemo(()=>{if(e)return t.map(n=>{const r=e.find(({departmentNumber:l})=>l===n.departmentId);return{...n,availableInventory:r?.quantity??null,statusMessage:r?.statusMessage}})},[e,t])},oe=({position:e="right",search:t,onSearchChange:s,onSortByDistanceChange:n,geolocationMessage:r,isSortDisabled:l,showInventoryToggle:i=!1,showOnlyStoresWithInventory:a,onShowOnlyStoresWithInventoryChange:u,stores:d,onStoreAction:c})=>{const m=g.useRef(null);g.useEffect(()=>{m.current&&"scroll"in m.current&&m.current.scroll({top:0})},[d]);const f=d.find(h=>h.selected),p=d.filter(h=>h.departmentId!==f?.departmentId),x=e==="bottom",w=(h,j,k)=>o.jsx("li",{"aria-label":h.name||"Butikk",className:k,children:o.jsx(Se,{...h,selected:h.selected,deliveryTimeBadge:h.deliveryTimeBadge,children:o.jsx(P,{variant:"secondary",onClick:j,className:"self-end",children:h.actionLabel})})},h.departmentId);return o.jsxs("div",{className:b("flex h-full min-h-0 flex-col",!x&&"gap-4"),children:[o.jsxs("section",{className:b("flex flex-col gap-4",x?"p-4":"px-4 pt-4"),children:[o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx(He,{className:"[&>input::placeholder]:text-text-highlight-primary",icon:{icon:o.jsx($,{icon:Ie}),color:"primary"},"aria-label":"Søk etter butikk",name:"Søk etter butikk",value:t,onChange:s,placeholder:"Søk"}),o.jsxs(H,{variant:"short-xs-regular",color:"subtle",className:"flex gap-1",children:[o.jsx($,{icon:ke,size:"xxSmall",className:"pt-0.5"}),o.jsx("span",{children:"Velg din nærmeste butikk for å kunne se lagerstatus raskt og enkelt."})]})]}),o.jsxs("div",{className:x?"flex gap-3":"flex justify-between gap-3",children:[o.jsxs("span",{className:x&&!i?"w-full":"",children:[o.jsx(P,{onClick:n,variant:"secondary",disabled:l,fullWidth:x,adornmentLeft:o.jsx("span",{className:"text-lg",children:o.jsx(Ce,{})}),children:"Finn nærmeste butikk"}),r&&o.jsx(H,{variant:"long-xs-regular",color:"warning",className:"mt-1",children:r})]}),i&&u&&o.jsx(Ee,{isSelected:a,onChange:u,size:"small",id:"show-only-available",children:o.jsx(H,{children:"Vis kun på lager"})})]})]}),o.jsx("section",{className:b("min-h-0 flex-1 overflow-y-auto overscroll-contain md:pr-0",x?"p-4":"px-4 pb-4","scroll-smooth"),ref:m,children:o.jsx("div",{children:o.jsxs("ul",{"aria-label":"butikk liste",className:b(x?"space-y-4":"bg-surface-neutral-soft space-y-2 rounded-lg px-2 py-2"),children:[f&&o.jsxs(o.Fragment,{children:[o.jsx("li",{children:o.jsx(H,{variant:"long-sm-regular",color:"subtle",children:"Valgt butikk"})}),w(f,()=>c(void 0),"-mt-1")]}),f&&p.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("li",{className:"mt-4",children:o.jsx(H,{variant:"long-sm-regular",color:"subtle",children:"Alle butikker"})}),p.map((h,j)=>w(h,()=>c(h.departmentId),j===0?"-mt-1":void 0))]}),!f&&p.map(h=>w(h,()=>c(h.departmentId)))]})})})]})},lt=(e,t)=>{const s=be(e)?e.availableInventory:null;return V(O(s))?"ready":t?"backorder":void 0},it=({withAvailability:e=!1,isAvailableOnWeb:t=!1,onClose:s})=>{const r=A().lg?"right":"bottom",l=!!e,{stores:i,myStore:a,setMyStore:u,deleteMyStore:d}=Z(),c=re(e&&e.status==="fetched"?e.quantityList:null),[m,f]=g.useState(!0),p=g.useMemo(()=>c?.some(({availableInventory:v})=>{const E=O(v);return V(E)})??!1,[c]);g.useEffect(()=>{p||f(!1)},[p]);const x=g.useMemo(()=>m?c?.filter(({availableInventory:v})=>{const E=O(v);return V(E)}):c,[m,c]),{result:w,search:h,onSearchChange:j,geolocationPosition:k,onSortByDistanceChange:N}=ee((e?x:i)||[],a?.departmentId),y=g.useMemo(()=>w.map(v=>{const E=v.departmentId===a?.departmentId;return{...v,selected:E,actionLabel:E?"Fjern butikk":"Velg butikk",deliveryTimeBadge:e?lt(v,t):void 0}}),[t,a?.departmentId,w,e]),C=g.useCallback(v=>{v?(u(v),s()):d()},[d,s,u]);return o.jsx(oe,{position:r,search:h,onSearchChange:j,onSortByDistanceChange:N,geolocationMessage:k?.message,isSortDisabled:!!k?.isDenied,showInventoryToggle:l,showOnlyStoresWithInventory:m,onShowOnlyStoresWithInventoryChange:f,stores:y,onStoreAction:C})},at=({withAvailability:e=!1,onClose:t})=>{const n=A().lg?"right":"bottom",r=!!e,{stores:l,myStore:i,setMyStore:a,deleteMyStore:u}=Z(),d=re(e&&e.status==="fetched"?e.quantityList:null),[c,m]=g.useState(!0),f=g.useMemo(()=>c?d?.filter(({availableInventory:y})=>{const C=O(y);return V(C)}):d,[c,d]),{result:p,search:x,onSearchChange:w,geolocationPosition:h,onSortByDistanceChange:j}=ee((e?f:l)||[],i?.departmentId),k=g.useMemo(()=>p.map(y=>{const C=y.departmentId===i?.departmentId;return{...y,selected:C,actionLabel:C?"Fjern butikk":"Velg butikk"}}),[i?.departmentId,p]),N=g.useCallback(y=>{y?(a(y),t()):u()},[u,t,a]);return o.jsx(oe,{position:n,search:x,onSearchChange:w,onSortByDistanceChange:j,geolocationMessage:h?.message,isSortDisabled:!!h?.isDenied,showInventoryToggle:r,showOnlyStoresWithInventory:c,onShowOnlyStoresWithInventoryChange:m,stores:k,onStoreAction:N})}
1,Wt=e=>{const t=we();return je(t)?o.jsx(it,{...e}):o.jsx(at,{...e})},Dt=({open:e,onClose:t,dialogId:s,title:n,children:r})=>{const i=A().lg?"right":"bottom",a=g.useCallback(u=>{u||t()},[t]);return o.jsx(I,{draggable:!0,isOpen:e,onOpenChange:a,position:i,className:b(i==="right"&&"w-full max-w-[449px]"),children:o.jsxs(I.Dialog,{id:s,className:b("bg-bg grid grid-rows-[auto_1fr_auto] overflow-hidden",i==="bottom"&&"min-h-[calc(100svh-5rem)] rounded-t-2xl"),children:[o.jsx(I.Header,{className:b("z-header",i==="right"&&"border-border-neutral-soft mr-8 ml-4 flex h-[54px] items-center justify-between border-b"),children:i==="bottom"?o.jsxs(I.DragArea,{className:"flex flex-col items-center justify-center gap-3 rounded-t-2xl pt-4",children:[o.jsx(I.DragPill,{}),o.jsx(I.Title,{color:"highlight-primary-strong",variant:"short-base-bold",textAlign:"center",children:n})]}):o.jsxs(o.Fragment,{children:[o.jsx(I.Title,{variant:"heading-2xl-bold",textAlign:"center",color:"highlight-primary-strong",children:n}),o.jsxs(P,{variant:"tertiary",adornmentRight:o.jsx(Le,{className:"h-[18px] w-[18px]"}),onClick:t,className:"mr-1.5 ml-auto",children:["Lukk ",o.jsx("span",{className:"sr-only",children:n.toLowerCase()})]})]})}),o.jsx("section",{className:"min-h-0 overflow-hidden",children:r})]})},i)};export{Lt as C,R as D,Dt as S,Wt as a,Ht as b,Mt as c,re as d,Et as u}; 2//# sourceMappingURL=StoreDrawerShell-CPNIi5YV.js.map
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.