1import{f as e,p as t}from"./datetime-C0_YGcyG.js";import{T as n,g as r,j as i,p as a}from"./mapbox-DRlg22pk.js";import{a as o,i as s,t as c}from"./polishHolidays-DRSVWZUX.js";var l=1.5,u=20,d=20,f=40;function p(){let e=r();u=e.combi,d=e.pets,f=e.childSeat}p(),i(p),a();function m(e,t){return e.isHotelRyczalt||!C(e)||t!==void 0&&t>=200?0:10*Math.max(1,e.vehicleCount||1)}function ee(e){return e.isHotelRyczalt||!C(e)?0:20*Math.max(1,e.vehicleCount||1)}function h(e){return(e.vehicleCount||1)*2}function te(e){let t=0,n=0;for(let r of e??[])r.kind===`booster`?n++:t++;return{seats:t,boosters:n}}function g(e,t,n){let r=Math.max(1,n||1),{seats:i,boosters:a}=te(e);return t===`seat`?i+1<=r&&i+1+a<=2*r:i+(a+1)<=2*r}var _=1440*60*1e3,v=e=>Date.parse(`${e}T00:00:00Z`),ne=e=>new Date(e).toISOString().slice(0,10);function re(e,n){if(!e||!n)return!1;let r=t(e,n);return Number.isFinite(r)?r>Date.now()+24*3600*1e3:!1}function ie(e){let t=null;for(let n of e){let e=n.date;e&&(t===null||e>t)&&(t=e)}return t}function y(t){if(!t)return null;let n=v(t);return!Number.isFinite(n)||n<=v(e())+7*_?null:ne(n-7*_)}function b(e){return y(ie(e))}function ae(e){return e.passengers>8&&e.vehicleCount||1}function oe(e){return e.vehicleCount||1}function x(e,t){return t?120+(e>120?e:0):Math.max(50,e)}function S(e,t){if(!e||e.isParcel)return 0;let n=t?.childSeatUnitPrice??f,r=t?.includesCombiInPrice?0:e.combi*u,i=t?.includesPetsInPrice?0:e.pets*d;return e.childSeats*n+r+i}function C(e){return s(e.destination)||e.destinationLat!=null&&e.destinationLon!=null&&o({lat:e.destinationLat,lon:e.destinationLon},e.destination)?!1:s(e.pickup)?!0:e.pickupLat!=null&&e.pickupLon!=null?o({lat:e.pickupLat,lon:e.pickupLon},e.pickup):!1}function se(e){return C({...e,pickup:e.destination,destination:e.pickup,pickupLat:e.destinationLat,pickupLon:e.destinationLon,destinationLat:e.pickupLat,destinationLon:e.pickupLon})}function ce(e,t,r=!1){if(t){let e=new Date(`${t}T00:00:00`);if(!Number.isNaN(e.getTime())&&c(e))return!0}let[i,a]=e.split(`:`).map(Number);return n(i*60+a,{airportPickup:r})}function w(e,t,n,r){return ce(t,n,r)?e.nightPrice:e.dayPrice}var T=`cart-items`;function E(e){let n=e=>{if(e.itemExtras?.dateLater)return 1/0;let n=t(e.date,e.time);return Number.isFinite(n)?n:1/0};return e.map((e,t)=>({it:e,idx:t,key:n(e)})).sort((e,t)=>e.key===t.key?e.idx-t.idx:e.key<t.key?-1:1).map(e=>e.it)}function D(){try{return E(JSON.parse(localStorage.getItem(T)||`[]`).map(e=>({...e,dayPrice:e.dayPrice??e.price,nightPrice:e.nightPrice??e.price,vehicleCount:e.vehicleCount??1,vehicleLabel:e.vehicleLabel||(e.passengers>8?`Bus 8`:e.passengers>4?`Bus ${e.passengers}`:`Samochód osobowy`)})))}catch{return[]}}function O(e){let t=E(e);return localStorage.setItem(T,JSON.stringify(t)),t}function le(e,t){let n=(e,t)=>{for(let n of e){let e=n.match(t);if(e)return Number(e[1])||0}return 0},r=-1;return t&&t.pickupLat!=null&&t.pickupLon!=null&&(r=e.findIndex(e=>!e.isReturn),r<0&&e.length>0&&(r=0)),e.map((e,i)=>{let a=Array.isArray(e.extras)?e.extras.map(String):[],o=n(a,/^(\d+)\s*[Ãx]\s*fotelik/i),s=n(a,/^(\d+)\s*[Ãx]\s*combi/i),c=n(a,/^(\d+)\s*[Ãx]\s*zwierz/i),l=Array.isArray(e.childSeatDetails)?e.childSeatDetails.filter(e=>e&&(e.kind===`seat`||e.kind===`booster`)):[],u=l.length>0?l:o>0?Array.from({length:o},()=>({kind:`seat`,age:``})):void 0,d=u?.length??o,p=Number(e.price??0);return{id:typeof crypto<`u`&&crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).slice(2)+Date.now().toString(36),pickup:String(e.pickup??``),destination:String(e.destination??``),pickupPlaceId:typeof e.pickupPlaceId==`string`?e.pickupPlaceId:null,destinationPlaceId:typeof e.destinationPlaceId==`string`?e.destinationPlaceId:null,date:String(e.date??``),time:String(e.time??``),passengers:Number(e.passengers??1),price:p,priceBase:p,dayPrice:p,nightPrice:p,vehicleLabel:String(e.vehicleLabel??`Samochód osobowy`),vehicleCount:Number(e.vehicleCount??1),extras:a,itemExtras:{childSeats:d,childSeatDetails:u,combi:s,pets:c>0?c:0,isParcel:!1,isJumpStart:!1,isOrganizedRoute:!1},isReturn:!!e.isReturn,signText:e.signText??void 0,flightNumber:e.flightNumber??void 0,driverMessage:e.driverMessage??void 0,vehicleBreakdown:e.vehicleBreakdown??void 0,isHotelRyczalt:!!e.isHotelRyczalt,sourceLegIndex:i,childSeatUnitPrice:typeof e.childSeatUnitPrice==`number`?e.childSeatUnitPrice:f,includesCombiInPrice:!!e.includesCombiInPrice,includesPetsInPrice:!!e.includesPetsInPrice,priceCalculatedAt:0,...i===r&&t?{pickupLat:t.pickupLat??null,pickupLon:t.pickupLon??null,pickupNote:t.pickupNote??null}:{}}})}var k=`edit-order-id`,A=`edit-order-paid`;function ue(){try{let e=sessionStorage.getItem(k);if(!e)return null;let t=Number(e);return Number.isFinite(t)&&t>0?t:null}catch{return null}}function j(e){try{e===null?sessionStorage.removeItem(k):sessionStorage.setItem(k,String(e))}catch{}}function de(){try{return sessionStorage.getItem(A)===`1`}catch{return!1}}function M(e){try{e?sessionStorage.setItem(A,`1`):sessionStorage.removeItem(A)}catch{}}var N=`edit-order-price-locked`;function fe(){try{return sessionStorage.getItem(N)===`1`}catch{return!1}}function P(e){try{e?sessionStorage.setItem(N,`1`):sessionStorage.removeItem(N)}catch{}}var F=`edit-order-can-cancel`;function pe(){try{return sessionStorage.getItem(F)===`1`}catch{return!1}}function I(e){try{e?sessionStorage.setItem(F,`1`):sessionStorage.removeItem(F)}catch{}}var L=`edit-order-orig-total`;function R(){try{let e=sessionStorage.getItem(L);if(!e)return null;let t=Number(e);return Number.isFinite(t)?t:null}catch{return null}}function z(e){try{e===null?sessionStorage.removeItem(L):sessionStorage.setItem(L,String(e))}catch{}}var B=`edit-order-paid-amount`,V=`edit-order-paid-method`;function me(){try{let e=sessionStorage.getItem(B);if(!e)return null;let t=Number(e);return Number.isFinite(t)?t:null}catch{return null}}function H(e){try{e===null?sessionStorage.removeItem(B):sessionStorage.setItem(B,String(e))}catch{}}function he(){try{return sessionStorage.getItem(V)}catch{return null}}function U(e){try{e?sessionStorage.setItem(V,e):sessionStorage.removeItem(V)}catch{}}var W=`edit-order-contact`;function ge(){try{let e=sessionStorage.getItem(W);if(!e)return null;let t=JSON.parse(e);return t&&typeof t==`object`?t:null}catch{return null}}function G(e){try{e===null?sessionStorage.removeItem(W):sessionStorage.setItem(W,JSON.stringify(e))}catch{}}var K=`edit-order-token`;function _e(){try{return sessionStorage.getItem(K)}catch{return null}}function q(e){try{e?sessionStorage.setItem(K,e):sessionStorage.removeItem(K)}catch{}}var J=`edit-order-requested-fields`;function ve(){try{let e=sessionStorage.getItem(J),t=e?JSON.parse(e):null;return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}function Y(e){try{!e||e.length===0?sessionStorage.removeItem(J):sessionStorage.setItem(J,JSON.stringify(e))}catch{}}function ye(){j(null),M(!1),P(!1),I(!1),z(null),H(null),U(null),G(null),q(null),Y(null)}function be(e){let t=D(),n=typeof crypto<`u`&&crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).slice(2)+Date.now().toString(36),r={...e,id:n,priceCalculatedAt:Date.now()};return t.push(r),O(t)}function xe(e,t){let n=`price`in t&&t.price!==void 0?{...t,priceCalculatedAt:Date.now()}:t;return O(D().map(t=>
1t.id===e?{...t,...n}:t))}function Se(e){return O(D().filter(t=>t.id!==e))}function Ce(){localStorage.removeItem(T)}function we(e,t){let n=e.itemExtras?.organizedRouteId;return!n||!t?{pickup:e.pickup,destination:e.destination}:{pickup:e.itemExtras?.organizedRoutePickupCustom?e.pickup:t(`routesData.${n}.pickup`,{defaultValue:e.pickup}),destination:t(`routesData.${n}.destination`,{defaultValue:e.destination})}}function Te(e){let n=Date.now(),r=[],i=[];for(let a of e){if(a.itemExtras?.dateLater){r.push(a);continue}let e=t(a.date,a.time);Number.isFinite(e)&&e<n?i.push(a):r.push(a)}let a=[];for(let e of r){if(!e.isReturn){a.push(e);continue}r.some(t=>!t.isReturn&&t.pickup===e.destination&&t.destination===e.pickup)?a.push(e):i.push(e)}return{kept:a,removed:i}}var Ee=new Set([`online`,`stripe`,`card`,`blik`,`paypo`,`payu`]),X=1.08;function De(e){return e.reduce((e,t)=>{let n=t.itemExtras;return n?.isJumpStart?e+50:n?.isParcel?e+x(t.price,!!n.isParcelOversized):e+(n?.isBusService?Math.round(t.price*l):t.price)+S(n,t)},0)}function Z(e){return e.reduce((e,t)=>{let n=t.itemExtras;if(n?.isJumpStart)return e+50;if(n?.isParcel)return e+x(t.price,!!n.isParcelOversized);let r=n?.isBusService?Math.round(t.price*l):t.price;if(!n)return e+r;let i=t.childSeatUnitPrice??f,a=t.includesPetsInPrice?0:n.pets*d;return e+r+n.childSeats*i+a},0)}function Q(e){let t=De(e),n=Z(e);return t+e.reduce((e,t)=>e+m(t,n),0)}function Oe(e,t){let n=Q(e);return t&&Ee.has(t)?Math.round(n*X*100)/100:n}var $={stripe:{percent:.02,flat:.4},payu:{percent:.02,flat:.39}};function ke(e,t=`stripe`){let n=Math.round(e*X*100)/100;if(e<=0)return{subtotal:n,serviceFee:0,total:n};let{percent:r,flat:i}=$[t],a=Math.ceil((n*r+i)/(1-r)*100)/100;return{subtotal:n,serviceFee:a,total:Math.round((n+a)*100)/100}}var Ae=(()=>{let e=`false`;return e===`true`||e===`1`})();function je(e){return e.some(e=>(e.itemExtras?.childSeats??0)>0)}function Me(e,t,n=`stripe`){if(e.length===0||t===`driver-card`||t===`cash`)return 0;let r=Q(e);if(r<=0)return 0;let{percent:i,flat:a}=$[n],o=(Math.round(r*X*100)/100*i+a)/(1-i);return Math.ceil(o*100)/100}export{xe as $,Me as A,Te as B,S as C,we as D,oe as E,de as F,z as G,O as H,fe as I,U as J,M as K,se as L,ee as M,C as N,x as O,pe as P,q as Q,y as R,_e as S,ae as T,G as U,Se as V,j as W,Y as X,P as Y,I as Z,ue as _,be as a,he as b,b as c,Ce as d,ye as f,ge as g,Oe as h,d as i,m as j,w as k,je as l,D as m,u as n,g as o,Z as p,H as q,Ae as r,le as s,f as t,re as u,R as v,h as w,ve as x,me as y,ke as z};
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.