1/*! For license information please see 5340.chunk.c057c8b48fe6a595af05.js.LICENSE.txt */ 2"use strict";(globalThis.webpackChunknitro5_app=globalThis.webpackChunknitro5_app||[]).push([[5340],{5340:(e,t,n)=>{n.d(t,{default:()=>O});var i=n(3696),o=n(774),r=n(2364),a=n(5007),d=n(2708),l=n(1659),s=n(380),c=n(3782);function u(){return u=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},u.apply(null,arguments)}const p=(0,o.I4)((0,o.jg)(e=>{var t,n;const o=(0,r.Vy)(),a=(0,r.ju)(),d=null===(t=o.checkoutData.additional)||void 0===t?void 0:t.selectedDropPointIdByWarehouseCode[e.warehouseCode];return e.dropPoints&&(null===(n=e.dropPoints)||void 0===n?void 0:n.length)>0&&i.createElement(m,u({css:e.compose(),value:d,options:e.dropPoints,onChangeOption:function(t){a.setSelectedDropPointId(Object.assign(Object.assign({},o.checkoutData.additional.selectedDropPointIdByWarehouseCode),{[e.warehouseCode]:t}))}},"MyPack Collect"===e.testElement?c.GB.CheckoutDropPointMyPackDropdown:1===e.warehouseCount?c.GB.CheckoutDropPointStoreDropdownOne:c.GB.CheckoutDropPointStoreDropdownTwo))})),m=(0,o.I4)(s.A,{width:({isCompact:e})=>e?"16.5rem":"330px",maxWidth:"100%",backgroundColor:l.ONy});var g=n(9540),h=n(4702),v=n(6166),y=n(667),b=n(7062),f=n(6739),k=n(7539),w=n(992),C=n(726);const I=(0,o.I4)(({parcels:e,cost:t})=>{var n,o;const a=(0,k.d)(e=>e.appShellData.siteSettings.porterbuddyToken),d=(0,k.d)(e=>e.appShellData.siteSettings.porterbuddyUrl),l=(0,k.d)(e=>e.appShellData.siteSettings.porterbuddyWidgetUrl),{stores:s,storeId:c}=(0,C.z)(),u=s.find(e=>e.storeId.toString()===c);if(!a||!d)return null;const{checkoutData:{billingAddress:p}}=(0,r.Vy)(),m=e.reduce((e,t)=>[{description:null==t?void 0:t.displayName},...e],[]),g=(0,i.useMemo)(()=>({originAddress:{streetName:u.street,postalCode:u.postalCode,city:u.city,country:"Norway"},destinationAddress:{streetName:p.line1,postalCode:p.postalCode,city:p.city,country:"Norway"},products:["delivery"],parcels:m}),[u,p,m]),h=null===(o=null===(n=(0,f.Z)({requestValues:g}))||void 0===n?void 0:n.current)||void 0===o?void 0:o.requestValues,[I,j]=(0,i.useState)(void 0),S=(0,i.useRef)(null),{setPorterBuddyWindow:D}=(0,r.ju)();function x(e,t){return e.city===t.city&&e.country===t.country&&e.postalCode===t.postalCode&&e.streetName===t.streetName}return(0,w.N)(()=>{const e=h,t=g,n=x(e.originAddress,t.originAddress),i=x(e.destinationAddress,t.destinationAddress),o=e.parcels.length===t.parcels.length&&e.parcels.every((e,n)=>e.description===t.parcels[n].description);n&&i&&o&&I||!g||j(g)},[I,h,g]),(0,w.N)(()=>{(0,y.BdH)()&&I&&((0,b.A)(`${l}porterbuddy-widget.css`),(0,y.k07)(`${l}porterbuddy-widget.js`,e=>(e.async=!0,e)).then(()=>fetch(`${d}/availability`,{method:"POST",headers:{"content-type":"application/json",accept:"application/json","x-public-token":a},body:JSON.stringify(I)}).then(e=>{e.json().then(e=>{var{deliveryWindows:n}=e,i=(0,v.__rest)(e,["deliveryWindows"]);const o=Object.assign(Object.assign({},i),{deliveryWindows:n.map(e=>Object.assign(Object.assign({},e),{price:Object.assign(Object.assign({},e.price),{fractionalDenomination:`${t.inclVat}00`})}))});window.porterbuddy={token:a,view:"checkout",availabilityResponse:o,onSelectDeliveryWindow:function(e){D({start:JSON.stringify(e.start),end:JSON.stringify(e.end),token:e.token,price:e.price.fractionalDenomination})},onSetCallbacks:function(e){S.current=e}}})}).then(()=>{const e=setInterval(()=>{var t;(null===(t=null==S?void 0:S.current)||void 0===t?void 0:t.setSelectedDeliveryWindow)&&(S.current.setSelectedDeliveryWindow(void 0,!0),clearInterval(e))},200)})))},[I,t.inclVat,a,d,l,D]),i.createElement(E,{id:"porterbuddy-widget","data-border":!0})}),E=o.I4.div({minHeight:250,backgroundColor:l.ONy});var j=n(7600),S=n(2833),D=n(1794);function x(e,t){let n=e.toLowerCase();return n=n.replace(/æ/g,"a"),n=n.replace(/ø/g,"o"),n=n.replace(/å/g,"a"),n=n.replace(/\s+/g,"-"),`${n}-${t}`}const O=e=>{var t;const n=(0,g.tO)(),o=(0,r.Vy)(),d=(0,r.ju)(),{warehouseCode:s,isPorterbuddy:c,name:u,serviceToCustomer:m}=e,h=e.id===o.checkoutData.additional.selectedShippingMethodIdByWarehouseCode[s],[v,y]=(0,i.useState)({}),b=(0,j.i)("display_estimated_delivery_time",e.experimentationData);(0,i.useEffect)(()=>{var t,n;d.setSelectedServiceToCustomerId(Object.assign(Object.assign({},null===(n=null===(t=o.checkoutData)||void 0===t?void 0:t.additional)||void 0===n?void 0:n.selectedServicesToCustomerByShippingMethodCode[s]),{[e.id]:Object.keys(v).filter(e=>v[e])}))},[e.id,v]);const f=(0,D.t)("toggleShippingMethodAdditionalInfo"),k=e=>{y(Object.assign(Object.assign({},v),{[e.target.name]:e.target.checked}))},w=(h||f)&&i.createElement(R,{css:e.orderLength>1&&{width:"80%"}},e.deliveryText),C=h&&f&&i.createElement(R,{css:e.orderLength>1&&{width:"80%"}},e.additionalInfoText),E=i.createElement(T,{css:e.orderLength>1&&{width:"85%"}},!!h&&i.createElement(p,{dropPoints:e.dropPointSelectOptions,warehouseCode:s,css:J,testElement:u,warehouseCount:e.warehouseCount})),S=i.createElement(N,null,i.createElement(W,null,i.createElement(_,null,i.createElement(H,null,e.name," -"),i.createElement("div",null,i.createElement(a.R,{current:{inclVat:e.cost.inclVat,exclVat:e.cost.exclVat},css:K}))),"variation_1"===b&&i.createElement(G,null,function(e){let t="";if(/Porterbuddy/.test(e))return"Du vil motta en melding fra Porterbuddy når pakken er klar for levering";if(/henting innen 24 timer/.test(e))return"Normalt er varene klare for henting innen 24 timer innenfor butikkens åpningtid";const n=e.match(/(\d+(?:-\d+)?)\s*virkedager|virkedager\s*(\d+(?:-\d+)?)/);n&&(t=`Normal leveringstid er ${n[1]?n[1]:n[2]} virkedager`);const i=e.match(/(\d+)\s*timer|timer\s*(\d+)/);
2i&&(t=`Normalt klar for henting etter ${i[1]?i[1]:i[2]} timer`);return t}(e.deliveryText)),n?i.createElement(i.Fragment,null,w,C,E):i.createElement(U,null,w,C,E)),(null==m?void 0:m.length)>0&&!!h&&i.createElement(A,null,i.createElement(M,null,"Tilleggstjenester for ",e.name),null==m?void 0:m.map((e,t)=>i.createElement(Y,{key:t},i.createElement(X,{name:e.consignorID,checked:!!v[e.consignorID],onChange:k},i.createElement(_,null,i.createElement(H,null,e.name),i.createElement(a.R,{css:q,current:e.price}))),i.createElement(V,null,i.createElement($,null,e.description)))))),O=(0,i.useCallback)(()=>{h||d.selectedShippingMethodId(Object.assign(Object.assign({},o.checkoutData.additional.selectedShippingMethodIdByWarehouseCode),{[s]:e.id}))},[d,h,e.id,o.checkoutData.additional.selectedShippingMethodIdByWarehouseCode,s]);return i.createElement(P,null,i.createElement(B,{tabIndex:h?-1:0,key:e.id,onClick:O,onKeyDown:e=>{"Enter"===e.key&&O()},css:!!(null===(t=e.dropPointSelectOptions)||void 0===t?void 0:t.length)&&{paddingBottom:l.YaY},"data-test-id":x(e.name,e.id)},i.createElement(z,{tabIndex:-1,name:"shippingmethod",value:e.id,checked:h,css:F},S),!!c&&!!h&&i.createElement(I,{parcels:e.shippingGroupItems,cost:e.cost})))},P=o.I4.div(Object.assign({},(0,h.gD)(":not(:last-child)",{borderBottom:{color:l.rjy,style:"solid",width:"thin"}}))),N=o.I4.div({display:"flex",flexDirection:"column"}),B=o.I4.li((0,S.k)({}),{cursor:"pointer",padding:{x:l.EXj,top:l.YaY,bottom:l.YaY},borderRadius:4,marginTop:4.5}),W=o.I4.div({display:"flex",flexDirection:"column",marginLeft:l.EXj,marginTop:-l.nU9,lineHeight:1.7}),T=o.I4.div({width:({isCompact:e})=>e?"85%":"inherit",display:"block"}),A=o.I4.div({display:"flex",flexDirection:"column",marginLeft:l.EXj}),Y=o.I4.div({position:"relative",margin:{bottom:l.YaY,left:l.nU9}}),M=o.I4.p({margin:{top:l.asY,bottom:l.YaY}}),V=o.I4.div({width:"100%",padding:{x:26},margin:{bottom:l.EXj}}),$=o.I4.p({margin:{xy:0}}),_=(0,o.I4)(T,{display:"flex",flexWrap:"wrap",width:288}),R=(0,o.I4)(T,{width:"auto",maxWidth:({isCompact:e})=>e?"16rem":"20rem",fontSize:l.pU_}),U=o.I4.div({display:"flex",flexDirection:"column",minWidth:350}),H=o.I4.span({marginRight:l.EXj}),X=(0,o.I4)(d.Sc,{alignItems:"center",margin:{bottom:0}}),L=(0,o.I4)({marginBottom:0,flexBasis:e=>e.isCompact?"auto":250}),z=(0,o.I4)(d.sx,L),G=o.I4.p({margin:{xy:0}}),J={marginTop:l.EXj,width:"100%"},K={fontSize:9.142857},q={fontSize:10},F={position:"relative"}},7062:(e,t,n)=>{n.d(t,{A:()=>r});const i={},o={},r=(e,t)=>{if(!(e in i)){let n=document.createElement("link");n.href=e,n.type="text/css",n.rel="stylesheet",t&&(n=t(n)),i[e]=new Promise((t,i)=>{n.onload=()=>{o[e]=n,t()},n.onerror=i,document.body.appendChild(n)})}return i[e]}},7600:(e,t,n)=>{n.d(t,{i:()=>o});var i=n(3696);function o(e,t){var n;const o=null===(n=null==t?void 0:t.experiments)||void 0===n?void 0:n[e],r=null==o?void 0:o.variation;return(0,i.useEffect)(()=>{if(!r)return;const t=`kameleoon-tracking-script-${e}`;if(document.getElementById(t))return;const n=document.createElement("script");n.id=t,n.type="text/javascript",n.textContent=o.trackingCode,document.head.appendChild(n)},[e,null==o?void 0:o.trackingCode,r]),r}}},e=>{Object.assign(e.sriHashes,{6013:"sha384-FXCqpGkDTrjieenYCKKMmLE0D1zprZ+xPYePrqf5ToKSXEN8OldSSuHlWF++Tq6y"})}]); 3//# sourceMappingURL=5340.chunk.c057c8b48fe6a595af05.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.