PageSourceSearch

https://cdn2.pickyourtrail.com/images/assets/veho-web-next/2609242…/static/chunks/1986-bf49e65cb466ff16.js

js pickyourtrail.com collected 2026-09-24 09:35:36 UTC 45,768 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1986],{2709:(e,a,l)=>{l.d(a,{D:()=>o});var t=l(59475),r=l(18730);let i=async(e,a)=>await e({url:"data/inr-conversion-rates",method:"GET",signal:a});var n=l(79446);let o=e=>{let a=(0,t.useFetcher)();return(0,r.useQuery)({queryKey:[n.kl],cacheTime:0,staleTime:0,...e,queryFn:e=>{let{signal:l}=e;return i(a,l)},select:e=>e.data})}},54401:(e,a,l)=>{l.d(a,{O:()=>o});var t=l(59475),r=l(18730);let i=async(e,a)=>await e({url:"misc/airlines",method:"GET",signal:a});var n=l(79446);let o=e=>{let a=(0,t.useFetcher)();return(0,r.useQuery)({queryKey:[n.Q4],cacheTime:3e5,staleTime:3e5,...e,queryFn:e=>{let{signal:l}=e;return i(a,l)}})}},76993:(e,a,l)=>{l.d(a,{T:()=>o});var t=l(59475),r=l(18730);let i=async(e,a)=>await e({url:"city/airports",method:"GET",signal:a});var n=l(79446);let o=e=>{let a=(0,t.useFetcher)();return(0,r.useQuery)({queryKey:[n.Y7],cacheTime:3e5,staleTime:3e5,...e,queryFn:e=>{let{signal:l}=e;return i(a,l)}})}},87360:(e,a,l)=>{l.d(a,{b:()=>n});var t=l(59475),r=l(18730);let i=async(e,a,l)=>{let{authToken:t,airLineCode:r,flightNumber:i,departureDate:n,...o}=e;return await a({url:"flight/flight-details?airline-code=".concat(r,"&flight-number=").concat(i,"&departure-date=").concat(n),method:"GET",authToken:t,query:o,signal:l})},n=e=>{let a=(0,t.useFetcher)(),{mutate:l,mutateAsync:n,...o}=(0,r.useMutation)(e=>i(e,a,void 0),e);return{getFlightName:l,getFlightNameAsync:n,...o}}},4066:(e,a,l)=>{l.d(a,{B:()=>s});var t=l(95155),r=l(69606),i=l(68376),n=l(83153),o=l(64296);let s=e=>{let{name:a,label:l,options:s,className:c="",itemClassName:d=""}=e,{field:{value:u,onChange:m}}=(0,r.as)({name:a});return(0,t.jsxs)(i.VP,{className:"space-y-2 gap-0",children:[(0,t.jsx)(n.Typography,{className:"font-normal text-md",children:l}),(0,t.jsx)(o.ToggleGroup,{type:"single",value:u||"",onValueChange:e=>{e&&e!==u&&m(e)},className:"w-full h-8 rounded-lg ".concat(c),children:s.map(e=>(0,t.jsx)(o.ToggleGroupItem,{value:e.value,className:"text-sm data-[state=on]:text-green-400 ".concat(d),children:e.label},e.value))})]})}},11986:(e,a,l)=>{l.d(a,{A:()=>Q});var t=l(95155),r=l(12115),i=l(85060),n=l(21455),o=l.n(n),s=l(94928),c=l(69606),d=l(55037),u=l(33941),m=l(24343),p=l(2709),v=l(59475),b=l(18730),y=l(44549);let g=async(e,a,l)=>{let{itineraryId:t,configKey:r,...i}=e;return await a({url:"offline/".concat(t,"/flight/").concat(r),method:"POST",body:{...i,configKey:(0,y.A)(r||"")},signal:l})},h=e=>{let a=(0,v.useFetcher)(),{mutate:l,mutateAsync:t,...r}=(0,b.useMutation)(e=>g(e,a,void 0),e);return{fetchFlight:l,fetchFlightAsync:t,...r}},f=async(e,a,l)=>{let{authToken:t,configKey:r,itineraryId:i,...n}=e;return await a({url:"offline/".concat(i,"/flight/").concat(r),method:"GET",authToken:t,query:n,signal:l})},x=e=>{let a=(0,v.useFetcher)(),{mutateAsync:l,...t}=(0,b.useMutation)(e=>f(e,a,void 0),e);return{fetchFlightRouteAsync:l,...t}};var C=l(76993),T=l(4066),N=l(61049),j=l(68376),D=l(53356),I=l(52562),A=l(83153),Y=l(47062),M=l(44474),E=l(77980),k=l(25571),S=l(33473),P=l(62570),R=l(44078),O=l(45686),B=l(91902),w=l(93059),F=l(54401),L=l(87360);let V=e=>{let{open:a,flightData:l,onSelect:i,onClose:n}=e,[s,c]=(0,r.useState)(0),d=(e,a)=>{c(a),i(e),n()},u=()=>{l.length>0&&i(l[0]),n()};return(0,t.jsx)(A.Dialog,{open:a,onOpenChange:e=>!e&&u(),children:(0,t.jsxs)(A.DialogContent,{className:"sm:max-w-[560px]",children:[(0,t.jsx)(A.DialogHeader,{children:(0,t.jsx)(A.DialogTitle,{children:"Select Flight"})}),(0,t.jsx)("div",{className:"flex flex-col gap-4 py-2",children:l.map((e,a)=>(0,t.jsxs)("button",{type:"button",onClick:()=>
1d(e,a),className:"flex items-center gap-4 rounded-lg border p-4 text-left transition-colors cursor-pointer ".concat(s===a?"border-green-600 bg-green-50":"border-gray-200 hover:border-gray-300 hover:bg-gray-50"),children:[(0,t.jsx)("div",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-full border-2 ".concat(s===a?"border-green-600 bg-green-600":"border-gray-300"),children:s===a&&(0,t.jsx)("div",{className:"h-2 w-2 rounded-full bg-white"})}),(0,t.jsxs)("div",{className:"flex flex-1 items-center gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(A.Typography,{className:"text-xs text-gray-500",children:"Departure City"}),(0,t.jsxs)(A.Typography,{className:"text-xs font-bold text-black",children:[e.departureAirportCity," (",e.departureAirportFsCode,")"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(A.Typography,{className:"text-xs text-gray-500",children:"Departure Date"}),(0,t.jsxs)(A.Typography,{className:"text-xs font-bold text-black",children:[o()(e.departureTime).format("DD/MMM/YYYY")," -"," ",o()(e.departureTime).format("HH:mm")]})]}),(0,t.jsx)(A.Typography,{className:"text-black text-lg",children:"→"}),(0,t.jsxs)("div",{children:[(0,t.jsx)(A.Typography,{className:"text-xs text-gray-500",children:"Arrival City"}),(0,t.jsxs)(A.Typography,{className:"text-xs font-bold text-black",children:[e.arrivalAirportCity," (",e.arrivalAirportFsCode,")"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(A.Typography,{className:"text-xs text-gray-500",children:"Arrival Date"}),(0,t.jsxs)(A.Typography,{className:"text-xs font-bold text-black",children:[o()(e.arrivalTime).format("DD/MMM/YYYY")," -"," ",o()(e.arrivalTime).format("HH:mm")]})]})]})]},"".concat(e.carrierFsCode,"-").concat(e.flightNumber,"-").concat(e.departureTime,"-").concat(e.arrivalTime)))})]})})},K=e=>{var a;let{tripIdx:l,routeIdx:i}=e,{control:n,setValue:s}=(0,c.xW)(),{getFlightNameAsync:u}=(0,L.b)(),{data:m}=(0,F.O)(),{data:p}=(0,C.T)(),[v,b]=(0,r.useState)([]),[y,g]=(0,r.useState)(!1),h=(0,r.useMemo)(()=>(null==m?void 0:m.data)?m.data.map(e=>({label:"".concat(e.airlineName," - ").concat(e.airlineCode),value:"".concat(e.airlineName," - ").concat(e.airlineCode)})):[],[m]),f=(0,r.useMemo)(()=>(null==p?void 0:p.data)?p.data.map(e=>({label:"".concat(e.cityName," (").concat(e.airportCode,")"),value:e.cityName,id:String(e.planningid),airportCode:e.airportCode})):[],[p]),x=(0,c.FH)({control:n,name:"tripDetails.".concat(l,".routes.").concat(i,".carrierName")}),T=(0,c.FH)({control:n,name:"tripDetails.".concat(l,".routes.").concat(i,".flightNumber")}),N=(0,c.FH)({control:n,name:"tripDetails.".concat(l,".routes.").concat(i,".departureDate")}),D=(0,c.FH)({control:n,name:"tripDetails.".concat(l,".routes")}),Y=(0,r.useMemo)(()=>{if(i>0&&Array.isArray(D)){let e=D[i-1];return null==e?void 0:e.departureDate}},[i,D]),M=(0,r.useMemo)(()=>{if(Y)return o()(Y).format("YYYY-MM-DD")},[Y]),E=(0,r.useMemo)(()=>{if(Y)return o()(Y).add(2,"day").format("YYYY-MM-DD")},[Y]),k=null==x?void 0:null===(a=x.split(" - ").pop())||void 0===a?void 0:a.trim();(0,r.useEffect)(()=>{if(x){var e;let a=(null===(e=x.split(" - ").pop())||void 0===e?void 0:e.trim())||"";s("tripDetails.".concat(l,".routes.").concat(i,".carrierCode"),a,{shouldValidate:!1,shouldDirty:!1})}},[x,s,l,i]);let S=(e,a)=>{var l;let t=null==p?void 0:null===(l=p.data)||void 0===l?void 0:l.filter(a=>a.airportCode.toLowerCase()===e.toLowerCase());if(t&&t.length>0){let e=t.find(e=>e.cityName.toLowerCase().includes(a.toLowerCase())||a.toLowerCase().includes(e.cityName.toLowerCase()))||t[0];return{airportCode:e.airportCode,cityName:e.cityName,planningid:String(e.planningid)}}return{airportCode:e,cityName:a,planningid:""}},P=async()=>{try{let e=await u({airLineCode:k||"",flightNumber:T||"",departureDate:(0,w.GP)(N,"dd/MMM/yyyy")||""});if("SUCCESS"===e.status){let a=null==e?void 0:e.data;a&&a.length>0&&(a.length>1?(b(a),g(!0)):R(a[0]))}else d.default.error(e.message||"Failed to fetch flight data")}catch(t){var e,a;let l=(null==t?void 0:null===(a=t.response)||void 0===a?void 0:null===(e=a.data)||void 0===e?void 0:e.message)||(null==t?void 0:t.message)||"Failed to fetch flight data";d.default.error("".concat(l,", please check the flight number and airline code.")),console.error("Error fetching flight data",t)}},R=e=>{let[a,t]=e.arrivalTime.split("T"),r=t.slice(0,5),[n,o]=e.departureTime.split("T"),c=o.slice(0,5),d=S(e.departureAirportFsCode,e.departureAirportCity),u=S(e.arrivalAirportFsCode,e.arrivalAirportCity);s("tripDetails.".concat(l,".routes.").concat(i,".departureCity"),d.cityName),s("tripDetails.".concat(l,".routes.").concat(i,".departureAirportCode"),d.airportCode),s("tripDetails.".concat(l,".routes.").concat(i,".departureCityId"),d.planningid),s("tripDetails.".concat(l,".routes.").concat(i,".carrierCode"),e.carrierFsCode),s("tripDetails.".concat(l,".routes.").concat(i,".arrivalCity"),u.cityName),s("tripDetails.".concat(l,".routes.").concat(i,".arrivalAirportCode"),u.airportCode),s("tripDetails.".concat(l,".routes.").concat(i,".arrivalCityId"),u.planningid),s("tripDetails.".concat(l,".routes.").concat(i,".arrivalDate"),a),s("tripDetails.".concat(l,".routes.").concat(i,".arrivalTime"),r),s("tripDetails.".concat(l,".routes.").concat(i,".departureDate"),n),s("tripDetails.".concat(l,".routes.").concat(i,".departureTime"),c),s("tripDetails.".concat(l,".routes.").concat(i,".flightNumber"),e.flightNumber)};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(j.fI,{className:"px-5 justify-between pb-3",children:[(0,t.jsx)(I.b9,{name:"tripDetails.".concat(l,".routes.").concat(i,".carrierName"),label:"Airline Code",options:h,control:n,enableSearch:!0}),(0,t.jsx)(I.CC,{name:"tripDetails.".concat(l,".routes.").concat(i,".flightNumber"),label:"Flight Number",type:"text",control:n}),(0,t.jsx)(A.Button,{type:"button",className:"w-32 bg-green-600 hover:bg-green-700 text-white",onClick:P,disabled:!x||!T||!N,children:"Fetch"})]}),(0,t.jsx)(j.fI,{className:"border-t border-dashed border-gray-400 w-full"}),(0,t.jsxs)(j.VP,{className:"p-5 bg-white",children:[(0,t.jsx)(A.Typography,{className:"font-semibold",children:"Below Data will be prefilled based on flight number"}),(0,t.jsxs)(j.fI,{className:"gap-3",children:[(0,t.jsx)(I.b9,{name:"tripDetails.".concat(l,".routes.").concat(i,".departureCity"),label:"Departure City",options:f,control:n,disabled:!0}),(0,t.jsx)(I.CC,{name:"tripDetails.".concat(l,".routes.").concat(i,".departureDate"),label:"Departure Date",type:"date",control:n,min:M,max:E}),(0,t.jsx)(I.CC,{name:"tripDetails.".concat(l,".routes.").concat(i,".departureTime"),label:"Departure Time",type:"text",control:n})]}),(0,t.jsxs)(j.fI,{className:"gap-3",children:[(0,t.jsx)(I.b9,{name:"tripDetails.".concat(l,".routes.").concat(i,".arrivalCity"),label:"Arrival City",options:f,control:n,disabled:!0}),(0,t.jsx)(I.CC,{name:"tripDetails.".concat(l,".routes.").concat(i,".arrivalDate"),label:"Arrival Date",type:"date",control:n,min:N||void 0}),(0,t.jsx)(I.CC,{name:"tripDetails.".concat(l,".routes.").concat(i,".arrivalTime"),label:"Arrival Time",type:"text",control:n})]})]}),(0,t.jsx)(V,{open:y,flightData:v,onSelect:R,onClose:()=>g(!1)})]})},q=0,H=e=>({key:"Route_".concat(++q),flightNumber:"",departureTime:"",departureDate:e||"",departureCityId:"",departureCity:"",departureAirportCode:"",carrierName:"",carrierCode:"",arrivalTime:"",arr
1ivalDate:"",arrivalCityId:"",arrivalAirportCode:"",arrivalCity:""}),U=e=>{let{tripIdx:a,removeTripDetails:l,control:r,data:i,tripType:n,deptDate:o}=e,{fields:s,append:d,remove:u}=(0,c.jz)({control:r,name:"tripDetails.".concat(a,".routes")}),m=("MULTI CITY"===n||"ROUND TRIP"===n)&&i.length>1;return(0,t.jsxs)(j.VP,{className:"border border-dashed border-gray-400 p-2 rounded-lg bg-white relative",children:[(0,t.jsxs)(A.Typography,{className:"absolute -top-2 left-4 bg-white px-2 text-xs font-bold text-gray-600",children:["Trip ",a+1]}),m&&(0,t.jsx)("button",{type:"button",className:"absolute top-2 right-2 text-red-400 hover:text-red-600",onClick:()=>l(a),disabled:i.length<=1,title:"Remove Trip",children:(0,t.jsx)(O.A,{size:16})}),(0,t.jsxs)(j.VP,{className:"p-1",children:[s.map((e,l)=>(0,t.jsxs)(j.fI,{className:"items-start",children:[(0,t.jsx)(R.bL,{className:"flex-1",children:(0,t.jsxs)(j.VP,{className:"border border-gray-200 rounded-lg bg-white",children:[(0,t.jsx)(R.l9,{asChild:!0,children:(0,t.jsxs)(j.fI,{className:"bg-gray-50 rounded-t-lg px-4 py-3 cursor-pointer hover:bg-gray-100 transition-colors justify-between items-center",children:[(0,t.jsxs)(A.Typography,{className:"font-medium text-gray-700",children:["Route ",l+1]}),(0,t.jsx)(B.A,{className:"h-5 w-5 text-gray-500"})]})}),(0,t.jsx)(R.UC,{children:(0,t.jsx)(K,{tripIdx:a,routeIdx:l})})]})}),(0,t.jsx)(A.Button,{type:"button",variant:"ghost",size:"sm",onClick:()=>u(l),disabled:s.length<=1,className:"h-8 w-8 p-0 text-red-500 hover:text-red-700 hover:bg-red-50 mt-3",children:(0,t.jsx)(O.A,{className:"h-4 w-4"})})]},e.id||l)),(0,t.jsx)(j.fI,{className:"justify-end mt-4 h-8",children:(0,t.jsxs)(A.Typography,{onClick:()=>d(H(o)),className:"flex items-center text-gray-700 text-sm font-bold cursor-pointer",children:[(0,t.jsx)(S.A,{className:"h-2 w-4"}),"Add Route"]})})]})]})},_=e=>{let{data:a,appendTripDetails:l,removeTripDetails:r,tripType:i,tab:n,deptDate:o}=e,{control:s}=(0,c.xW)();return(0,t.jsxs)(j.VP,{className:"gap-1 mt-2",children:[a.map((e,l)=>(0,t.jsx)(U,{tripIdx:l,removeTripDetails:r,control:s,data:a,tripType:i,deptDate:o},e.id||l)),("MULTI CITY"===i||"customerflight"===n)&&(0,t.jsx)(j.fI,{className:"justify-end h-8 gap-0 mr-5",children:(0,t.jsxs)(P.o,{onClick:()=>l({routes:[H()]}),className:"flex items-center gap-1 text-gray-700 p-2 text-sm font-bold cursor-pointer",children:[(0,t.jsx)(S.A,{className:"h-2 w-4"}),"Add Trip"]})})]})},G=e=>{if(!e||!e.trim())return"";try{if(5===e.length&&e.includes(":"))return o()("2000-01-01 ".concat(e,":00")).format("HH:mm:ss");let a=o()("2000-01-01 ".concat(e));return a.isValid()?a.format("HH:mm:ss"):e}catch(a){return e}},z=u.Ik({tab:u.Yj(),classType:u.Yj().trim().min(1,"Class type is required"),flightrefundable:u.Yj().min(1,"Refundable selection is required"),tripType:u.Yj().min(1,"Trip type is required"),pytCost:u.Yj().optional(),ourSource:u.Yj().optional(),blockCardReason:u.Yj().optional(),checkBox:u.zM().optional(),internetCost:u.Yj().optional(),currency:u.Yj().optional(),checkinKg:u.Yj().optional(),checkinPax:u.Yj().optional(),cabinKg:u.Yj().optional(),cabinPax:u.Yj().optional(),tripDetails:u.YO(u.Ik({routes:u.YO(u.Ik({key:u.Yj().optional(),flightNumber:u.Yj().min(1,"Flight number is required"),carrierName:u.Yj().min(1,"Airline name is required"),departureDate:u.Yj().min(1,"Departure date is required"),departureCity:u.Yj().min(1,"Departure city is required"),departureTime:u.Yj().min(1,"Departure time is required"),arrivalCity:u.Yj().min(1,"Arrival city is required"),arrivalTime:u.Yj().min(1,"Arrival time is required"),arrivalDate:u.Yj().min(1,"Arrival date is required"),departureCityId:u.Yj().optional(),departureAirportCode:u.Yj().optional(),carrierCode:u.Yj().optional(),arrivalCityId:u.Yj().optional(),arrivalAirportCode:u.Yj().optional()}))})).min(1,"At least one trip is required"),cancellationType:u.k5(["refund","no-refund","partial-refund"],{required_error:"Cancellation policy is required",invalid_type_error:"Cancellation policy is required"}),cancellationNum:u.Yj().or(u.ch()).optional(),cancellationDate:u.Yj().or(u.ch()).optional(),cancellationTimelineList:u.YO(u.Ik({fromTimeMillis:u.Yj().min(1,"Start date is required"),toTimeMillis:u.Yj().min(1,"End date is required"),fee:u.Yj().min(1,"Fee is required")}))}).superRefine((e,a)=>{if("flight"!==e.tab||(e.pytCost&&""!==e.pytCost.trim()||a.addIssue({code:m.eq.custom,message:"PYT cost is required",path:["pytCost"]}),e.ourSource&&""!==e.ourSource.trim()||a.addIssue({code:m.eq.custom,message:"Source provider is required",path:["ourSource"]}),e.currency&&""!==e.currency.trim()||a.addIssue({code:m.eq.custom,message:"Currency is required",path:["currency"]}),e.blockCardReason&&""!==e.blockCardReason.trim()||a.addIssue({code:m.eq.custom,message:"Block card reason is required",path:["blockCardReason"]}),e.checkBox&&(!e.internetCost||""===e.internetCost.trim())&&a.addIssue({code:m.eq.custom,message:"Internet cost is required",path:["internetCost"]}),e.checkinKg&&""!==e.checkinKg.trim()||a.addIssue({code:m.eq.custom,message:"Check-in baggage kg is required",path:["checkinKg"]}),e.checkinPax&&""!==e.checkinPax.trim()||a.addIssue({code:m.eq.custom,message:"Check-in baggage pax is required",path:["checkinPax"]}),e.cabinKg&&""!==e.cabinKg.trim()||a.addIssue({code:m.eq.custom,message:"Cabin baggage kg is required",path:["cabinKg"]}),e.cabinPax&&""!==e.cabinPax.trim()||a.addIssue({code:m.eq.custom,message:"Cabin baggage pax is required",path:["cabinPax"]})),"flight"===e.tab){if("refund"===e.cancellationType){let l=void 0!==e.cancellationNum&&null!==e.cancellationNum&&""!==e.cancellationNum,t="string"==typeof e.cancellationDate&&""!==e.cancellationDate.trim();l||t||a.addIssue({code:m.eq.custom,message:"Provide either number of days or a cancellation date",path:["cancellationNum"]})}if("partial-refund"===e.cancellationType){let l=e.cancellationTimelineList;l&&0!==l.length?l.forEach((e,l)=>{e.fee&&""!==e.fee.trim()||a.addIssue({code:m.eq.custom,message:"Fee is required",path:["cancellationTimelineList",l,"fee"]})}):a.addIssue({code:m.eq.custom,message:"Cancellation timeline is required for partial refund",path:["cancellationTimelineList"]})}}}),W=e=>{if(!e)return 0;if(e instanceof Date)return e.getTime();if("string"==typeof e){if(/^\d{4}-\d{2}-\d{2}$/.test(e)){let[a,l,t]=e.split("-").map(Number);return Date.UTC(a,l-1,t)}return o()(e).valueOf()}return Number(e||0)},Z=e=>{var a,l,n;let{flightCosting:u,isEdit:m=!1,itineraryId:v,departureDateMillis:b,onClose:y}=e,g=(0,s.md)(M.JC),f=(0,r.useMemo)(()=>!!(0,k.Y)({permissions:null==g?void 0:g.permissions,key:"addCustomerBookedFlight"}),[g]),S=(0,r.useMemo)(()=>!!(null==u?void 0:u.offline),[u]),P=(0,r.useMemo)(()=>S&&(null==u?void 0:u.userBooked)?"customerflight":"flight",[S,null==u?void 0:u.userBooked]),[R,O]=(0,r.useState)(P),[B,w]=(0,r.useState)(!1),{fetchFlightAsync:F}=h(),{fetchFlightRouteAsync:L}=x(),{data:V}=(0,p.D)(),{data:K}=(0,C.T)(),[q,U]=(0,r.useState)(),Z=(0,r.useMemo)(()=>
1{if(!(null==K?void 0:K.data))return new Map;let e=new Map;return K.data.forEach(a=>{e.has(a.airportCode)||e.set(a.airportCode,a.cityName)}),e},[null==K?void 0:K.data]),Q="flight"===R,J="customerflight"===R,X=(0,r.useMemo)(()=>{let e=null==u?void 0:u.configKey;return e&&e.indexOf("###")>-1?(0,E.A)(e):e},[null==u?void 0:u.configKey]),$=(0,r.useMemo)(()=>{if(J)return"MULTI CITY";if(null==u?void 0:u.trips){let a=Object.keys(u.trips);if(a.length>1)return"MULTI CITY";if(1===a.length){var e;if((null===(e=u.trips[a[0]].routes)||void 0===e?void 0:e.length)>1)return"ROUND TRIP"}}return"ONE WAY"},[J,u]),ee=(0,r.useCallback)(()=>{v&&X&&L({configKey:X,itineraryId:v}).then(e=>{"SUCCESS"===e.status&&U(e.data)})},[X,L,v]);(0,r.useEffect)(()=>{m&&ee()},[ee,m]);let ea=e=>{if(!e)return{kg:"",pax:""};let a=e.split(" ");return{kg:a[0]||"",pax:a[3]||""}},el=(0,r.useMemo)(()=>{if(q){var e,a,l,t,r,i,n,s,c,d;let m=ea(q.freeCheckInBaggage),p=ea(q.freeCabinBaggage),v=q.trip||q.offlineTrips||[],b=Object.values(null!==(a=null==q?void 0:q.trip)&&void 0!==a?a:{}),y=v.length>1?"MULTI CITY":"ONE WAY",g=null!==(l=null===(e=(Array.isArray(q.cancellationTimelineList)&&q.cancellationTimelineList.length>0?q.cancellationTimelineList:[])[0])||void 0===e?void 0:e.tripKey)&&void 0!==l?l:"refund",h=q.markupPercent?((null==q?void 0:q.costInContractCurrency)||0)*(1+q.markupPercent/100):0;return{tab:q.userBooked?"customerflight":"flight",classType:null!==(t=q.flightClass)&&void 0!==t?t:"ECONOMY",flightrefundable:q.refundable?"true":"false",tripType:y,pytCost:String(null!==(r=null==q?void 0:q.costInContractCurrency)&&void 0!==r?r:""),ourSource:null!==(n=null!==(i=null==q?void 0:q.sourceProvider)&&void 0!==i?i:null==u?void 0:u.sourceProvider)&&void 0!==n?n:"",internetCost:String(h),checkBox:!!q.markupPercent,blockCardReason:null!==(s=q.reasonForBlockCard)&&void 0!==s?s:"",tripDetails:b.map((e,a)=>({routes:e.routes.map((e,l)=>{var t,r,i,n,s,c,d,u,m,p,v;return{key:"$route_".concat(a,"_").concat(l),flightNumber:null!==(t=e.flightNumber)&&void 0!==t?t:"",departureTime:null!==(r=e.departureTime)&&void 0!==r?r:"",departureDate:o()(e.departureDate).format("YYYY-MM-DD"),departureCityId:String(null!==(i=e.departureCityId)&&void 0!==i?i:""),departureCity:null!==(n=e.departureCity)&&void 0!==n?n:"",departureAirportCode:null!==(s=e.departureAirportCode)&&void 0!==s?s:"",carrierName:null!==(c=e.carrierName)&&void 0!==c?c:"",carrierCode:null!==(d=e.carrierCode)&&void 0!==d?d:"",arrivalTime:null!==(u=e.arrivalTime)&&void 0!==u?u:"",arrivalDate:o()(e.arrivalDate).format("YYYY-MM-DD"),arrivalCityId:String(null!==(m=e.arrivalCityId)&&void 0!==m?m:""),arrivalCity:null!==(p=e.arrivalCity)&&void 0!==p?p:"",arrivalAirportCode:null!==(v=e.arrivalAirportCode)&&void 0!==v?v:""}})})),cancellationTimelineList:(null!==(c=q.cancellationTimelineList)&&void 0!==c?c:[]).map(e=>({fromTimeMillis:e.fromTimeMillis?o()(e.fromTimeMillis).format("YYYY-MM-DD"):"",toTimeMillis:e.toTimeMillis?o()(e.toTimeMillis).format("YYYY-MM-DD"):"",fee:String(e.fee)})),checkinKg:m.kg,checkinPax:m.pax,cabinKg:p.kg,cabinPax:p.pax,cancellationType:g,currency:null!==(d=q.currency)&&void 0!==d?d:""}}},[q,null==u?void 0:u.sourceProvider]);(0,r.useEffect)(()=>{m&&el&&er.reset(el,{keepDirtyValues:!0})},[el]);let et=(0,r.useMemo)(()=>{let e=null==u?void 0:u.trips;if(e){let t=Object.keys(e);if(t.length>0){var a,l;let r=null===(l=e[t[0]])||void 0===l?void 0:null===(a=l.routes)||void 0===a?void 0:a[0];if(null==r?void 0:r.departureDate){let e=o()(r.departureDate,"DD/MMM/YYYY");if(e.isValid())return e.format("YYYY-MM-DD")}}}return o()(b).format("YYYY-MM-DD")},[null==u?void 0:u.trips,b]),er=(0,c.mN)({resolver:(0,i.u)(z),defaultValues:null!=el?el:{tab:P,classType:"ECONOMY",flightrefundable:"false",tripType:$,pytCost:"",ourSource:"",blockCardReason:"",checkBox:!1,internetCost:"",currency:"",checkinKg:"",checkinPax:"",cabinKg:"",cabinPax:"",tripDetails:[{routes:[{key:"Route_".concat(Date.now()),flightNumber:"",departureTime:"",departureDate:et,departureCityId:"",departureCity:"",departureAirportCode:"",carrierName:"",carrierCode:"",arrivalTime:"",arr
1ivalDate:"",arrivalCityId:"",arrivalAirportCode:"",arrivalCity:""}]}],cancellationType:void 0,cancellationNum:null,cancellationDate:null,cancellationTimelineList:[]},mode:"onBlur",reValidateMode:"onBlur"}),{handleSubmit:ei,control:en,setValue:eo,getValues:es,clearErrors:ec,formState:{isSubmitting:ed}}=er;(0,r.useRef)(er.reset).current=er.reset;let{fields:eu,append:em,remove:ep}=(0,c.jz)({control:en,name:"tripDetails"}),ev=(0,c.FH)({control:en,name:"checkBox"}),eb=(0,c.FH)({control:en,name:"currency"}),ey=(0,c.FH)({control:en,name:"tripType"}),eg=(0,r.useRef)(eu.length);eg.current=eu.length,(0,r.useEffect)(()=>{if(!ey)return;let e=eg.current;if("ROUND TRIP"===ey&&1===e){var a,l,t,r,i,n,o,s,c,d,u,m,p,v,b,y,g,h;let e=es("tripDetails.0"),f=null!==(p=null==e?void 0:null===(l=e.routes)||void 0===l?void 0:null===(a=l[0])||void 0===a?void 0:a.arrivalCity)&&void 0!==p?p:"",x=null!==(v=null==e?void 0:null===(r=e.routes)||void 0===r?void 0:null===(t=r[0])||void 0===t?void 0:t.arrivalCityId)&&void 0!==v?v:"",C=null!==(b=null==e?void 0:null===(n=e.routes)||void 0===n?void 0:null===(i=n[0])||void 0===i?void 0:i.arrivalAirportCode)&&void 0!==b?b:"",T=null!==(y=null==e?void 0:null===(s=e.routes)||void 0===s?void 0:null===(o=s[0])||void 0===o?void 0:o.departureCity)&&void 0!==y?y:"",N=null!==(g=null==e?void 0:null===(d=e.routes)||void 0===d?void 0:null===(c=d[0])||void 0===c?void 0:c.departureCityId)&&void 0!==g?g:"",j=null!==(h=null==e?void 0:null===(m=e.routes)||void 0===m?void 0:null===(u=m[0])||void 0===u?void 0:u.departureAirportCode)&&void 0!==h?h:"";em({routes:[{...H(et),departureCity:f,departureCityId:x,departureAirportCode:C,arrivalCity:T,arrivalCityId:N,arrivalAirportCode:j}]})}else("ONE WAY"===ey||"MULTI CITY"===ey)&&e>1&&"flight"===R&&ep(e-1)},[ey]);let eh=(0,r.useCallback)((e,a,l)=>{let t=o()().valueOf(),r=+(e.pytCost||0)*l;if("partial-refund"===e.cancellationType&&e.cancellationTimelineList&&e.cancellationTimelineList.length>0)return e.cancellationTimelineList.map(a=>({fromTimeMillis:W(a.fromTimeMillis),toTimeMillis:W(a.toTimeMillis),fee:Number(a.fee)||0,tripKey:e.cancellationType}));if("no-refund"===e.cancellationType)return[{fromTimeMillis:t,toTimeMillis:a,fee:r,tripKey:e.cancellationType}];let i=Number(e.cancellationNum)||0,n=e.cancellationDate&&"string"==typeof e.cancellationDate&&""!==e.cancellationDate.trim()?W(e.cancellationDate):o()(a).subtract(i,"days").valueOf();return[{fromTimeMillis:t,toTimeMillis:n,fee:0,tripKey:e.cancellationType},{fromTimeMillis:n,toTimeMillis:a,fee:r,tripKey:e.cancellationType}]},[]),ef=(0,r.useCallback)(e=>{var a,l;let t=b?o()(b).valueOf():o()().add(2,"day").valueOf(),r=(null==V?void 0:V[(null===(a=e.currency)||void 0===a?void 0:a.toUpperCase())||""])||1;return{configKey:X,itineraryId:v||"",cost:+(e.pytCost||0)*r,costInContractCurrency:+(e.pytCost||0),currency:(null===(l=e.currency)||void 0===l?void 0:l.toUpperCase())||"",sourceProvider:J?null:e.ourSource,reasonForBlockCard:J?null:e.blockCardReason,flightClass:e.classType,refundable:!!Q&&"true"===e.flightrefundable,freeCheckInBaggage:"".concat(e.checkinKg," Kg/person for ").concat(e.checkinPax," pax"),freeCabinBaggage:"".concat(e.cabinKg," Kg/person for ").concat(e.cabinPax," pax"),userBooked:J,trip:e.tripDetails.map(e=>({routes:e.routes.map(e=>({carrierName:e.carrierName,carrierCode:e.carrierCode,flightNumber:e.flightNumber,departureCity:Z.get(e.departureCity)||e.departureCity,departureAirportCode:e.departureAirportCode,departureDate:e.departureDate,departureTime:G(e.departureTime),arrivalCity:Z.get(e.arrivalCity)||e.arrivalCity,arrivalAirportCode:e.arrivalAirportCode,arrivalDate:e.arrivalDate,arrivalTime:G(e.arrivalTime),departureCityId:+(e.departureCityId||""),arrivalCityId:+(e.arrivalCityId||"")}))})),cancellationTimelineList:Q?eh(e,t,r):void 0,...Q&&e.checkBox&&e.internetCost&&e.pytCost?{markupPercent:(parseFloat(e.internetCost)-parseFloat(e.pytCost))/parseFloat(e.pytCost)*100}:{}}},[v,Q,J,b,X,eh,V,Z]),ex=async e=>{if(J){w(!0);return}let a=ef(e);try{let e=await F(a);(null==e?void 0:e.status)==="SUCCESS"?(d.default.success(m?"Flight block card updated successfully":"Flight block card added successfully"),null==y||y()):d.default.error("Failed to save flight block card")}catch(a){var l,t;let e=(null==a?void 0:null===(t=a.response)||void 0===t?void 0:null===(l=t.data)||void 0===l?void 0:l.message)||(null==a?void 0:a.message)||"Failed to fetch flight data";d.default.error("".concat(e)),console.error("Error fetching flight data",a)}},eC=async()=>{w(!1);let e=ef(es());try{var a;let l=await F(e);(null==l?void 0:null===(a=l.data)||void 0===a?void 0:a.status)==="SUCCESS"?(d.default.success("Customer booked flight added successfully"),null==y||y()):d.default.error("Failed to save customer booked flight")}catch(e){console.error(e),d.default.error("Failed to save customer booked flight")}},eT=e=>{O(e),eo("tab",e),"customerflight"===e?eo("tripType","MULTI CITY"):eo("tripType","ONE WAY")};return(0,t.jsx)(j.VP,{className:"overflow-auto",children:(0,t.jsxs)(c.Op,{...er,children:[(0,t.jsxs)("form",{onSubmit:ei(ex),className:"flex flex-col h-full",children:[(0,t.jsx)(j.VP,{className:"flex-1 overflow-auto px-1",children:(0,t.jsxs)(j.VP,{className:"gap-4 p-5",children:[f?(0,t.jsxs)(j.fI,{className:"gap-2 items-center justify-center",style:S?{cursor:"not-allowed",opacity:.6}:void 0,children:[(0,t.jsx)(A.Button,{type:"button",variant:"flight"===R?"default":"outline",onClick:()=>!S&&eT("flight"),disabled:S,children:"Add Flight Block Card"}),(0,t.jsx)(A.Button,{type:"button",variant:"customerflight"===R?"default":"outline",onClick:()=>!S&&eT("customerflight"),disabled:S,children:"Add Customer Booked Flight"})]}):null,(0,t.jsxs)(j.fI,{className:"gap-4",children:[(0,t.jsx)(T.B,{name:"classType",label:"Class Type",options:[{value:"ECONOMY",label:"Economy"},{value:"BUSINESS",label:"Business"},{value:"FIRST",label:"First"}]}),J?null:(0,t.jsx)(T.B,{name:"flightrefundable",label:"Refundable",options:[{value:"true",label:"Yes"},{value:"false",label:"No"}]})]}),J?null:(0,t.jsx)(j.fI,{className:"gap-4",children:(0,t.jsx)(T.B,{name:"tripType",label:"Trip Type",options:[{value:"ONE WAY",label:"One Way"},{value:"ROUND TRIP",label:"Round Trip"},{value:"MULTI CITY",label:"Multi City"}]})}),J?null:(0,t.jsxs)(j.fI,{className:"gap-4",children:[(0,t.jsx)(j.VP,{className:"md:w-2/5",children:(0,t.jsx)(I.b9,{control:en,name:"currency",label:"Currency",options:Y.Pi})}),(0,t.jsx)(j.VP,{className:"md:w-2/5",children:(0,t.jsx)(I.CC,{name:"pytCost",label:ev?"PYT Cost (Margin will be added automatically)":"PYT Cost",type:"text",control:en})}),(0,t.jsx)(j.VP,{className:"md:w-2/5",children:(0,t.jsx)(I.b9,{control:en,name:"ourSource",label:"Our Source",options:N.y1,enableSearch:!0})})]}),!J&&V?(0,t.jsx)(I.mP,{control:en,currency:eb,currencyData:V,fieldName:"pytCost",label:"Converted PYT Cost (INR)",isEditMode:S,initialCurrency:null!==(a=null==u?void 0:u.contractCurrency)&&void 0!==a?a:void 0,initialValue:null!==(l=null==u?void 0:u.ourCostInContractCurrency)&&void 0!==l?l:void 0}):null,J?null:(0,t.jsxs)(j.VP,{className:"md:w-1/2 gap-1",children:[(0,t.jsx)(A.Checkbox,{checked:ev||!1,onCheckedChange:e=>{eo("checkBox",!0===e,{shouldValidate:!0}),!0!==e&&eo("internetCost","")},children:"I know Internet Cost with me"}),(0,t.jsx)(A.Typography,{className:"text-sm text-gray-600 pl-7",children:"(This excludes baggage fee)"}),ev?(0,t.jsxs)(j.VP,{className:"mt-3 md:w-4/5",children:[(0,t.jsx)(I.CC,{name:"internetCost",label:"Internet Cost",type:"text",control:en}),V?(0,t.jsx)(I.mP,{control:en,currency:eb,currencyData:V,fieldName:"internetCost",label:"Converted Internet Cost (INR)",isEditMode:S,initialCurrency:null!==(n=null==u?void 0:u.contractCurrency)&&void 0!==n?n:void 0,initialValue:void 0}):null]}):null]}),J?null:(0,t.jsx)(j.VP,{children:(0,t.jsx)(I.b9,{control:en,name:"blockCardReason",label:"Block Card Reason",options:N.pU})}),(0,t.jsx)(j.VP,{className:"flex-1 overflow-auto px-1",children:(0,t.jsx)(_,{data:eu,appendTripDetails:em,removeTripDetails:ep,tripType:ey||"ONE WAY",tab:R,deptDate:et})}),J?null:(0,t.jsx)(D.G,{departureDateMillis:b,control:en,setValue:eo,getValues:es,clearErrors:ec,cancellationTypeFieldName:"
1cancellationType",cancellationNumFieldName:"cancellationNum",cancellationDateFieldName:"cancellationDate",timelineFieldName:"cancellationTimelineList"}),J?null:(0,t.jsxs)(j.fI,{className:"gap-4 items-center",children:[(0,t.jsxs)(j.VP,{className:"md:w-1/2",children:[(0,t.jsx)(A.Typography,{className:"text-sm font-medium text-gray-700 mb-1",children:"Check in baggage"}),(0,t.jsxs)(j.fI,{className:"gap-2 items-end",children:[(0,t.jsx)(j.VP,{className:"flex-1",children:(0,t.jsx)(I.CC,{control:en,name:"checkinKg",label:"kg/person for",type:"number"})}),(0,t.jsx)(j.VP,{className:"flex-1",children:(0,t.jsx)(I.CC,{control:en,name:"checkinPax",label:"pax",type:"number"})})]})]}),(0,t.jsxs)(j.VP,{className:"md:w-1/2",children:[(0,t.jsx)(A.Typography,{className:"text-sm font-medium text-gray-700 mb-1",children:"Cabin baggage"}),(0,t.jsxs)(j.fI,{className:"gap-2 items-end",children:[(0,t.jsx)(j.VP,{className:"flex-1",children:(0,t.jsx)(I.CC,{control:en,name:"cabinKg",label:"kg/person for",type:"number"})}),(0,t.jsx)(j.VP,{className:"flex-1",children:(0,t.jsx)(I.CC,{control:en,name:"cabinPax",label:"pax",type:"number"})})]})]})]})]})}),(0,t.jsx)(j.fI,{className:"px-5 py-4 border-t border-blue-100 flex justify-end",children:(0,t.jsx)(A.Button,{type:"submit",disabled:ed,isLoading:ed,children:ed?"Saving...":"Save & Create"})})]}),B&&(0,t.jsx)(j.VP,{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:(0,t.jsxs)(j.VP,{className:"bg-white rounded-lg p-6 max-w-md mx-4 shadow-xl",children:[(0,t.jsx)(A.Typography,{className:"text-lg font-bold mb-2",children:"Alert"}),(0,t.jsx)(A.Typography,{className:"text-gray-600 mb-6",children:"Are you sure? This cannot be reversed"}),(0,t.jsxs)(j.fI,{className:"gap-3 justify-end",children:[(0,t.jsx)(A.Button,{type:"button",variant:"outline",onClick:()=>w(!1),children:"No, take me back"}),(0,t.jsx)(A.Button,{type:"button",onClick:eC,disabled:ed,isLoading:ed,children:"Yes, I'm sure"})]})]})})]})})};Z.displayName="FlightForm";let Q=Z},61049:(e,a,l)=>{l.d(a,{MB:()=>i,ZU:()=>s,bA:()=>o,cZ:()=>n,pU:()=>c,tH:()=>r,y1:()=>t});let t=[{value:"EXPEDIA",label:"EXPEDIA"},{value:"HOTELBEDS",label:"HOTELBEDS"},{value:"TBO",label:"TBO"},{value:"QPX",label:"QPX"},{value:"VIATOR",label:"VIATOR"},{value:"VIATOR_API",label:"VIATOR_API"},{value:"WELTRAVEL",label:"WELTRAVEL"},{value:"SKYPICKER",label:"SKYPICKER"},{value:"AMADEUS",label:"AMADEUS"},{value:"ITALO",label:"ITALO"},{value:"THRIFTY",label:"THRIFTY"},{value:"GO_RENTAL",label:"GO_RENTAL"},{value:"Travelbullz",label:"Travelbullz"},{value:"AKQUASUN",label:"AKQUASUN"},{value:"GORENTAL",label:"GORENTAL"},{value:"ISLANDHOPPER",label:"ISLANDHOPPER"},{value:"swisspasses",label:"swisspasses"},{value:"SNCF",label:"SNCF"},{value:"OEBB",label:"OEBB"},{value:"Renfe",label:"Renfe"},{value:"Sbb",label:"Sbb"},{value:"cd_cz",label:"cd_cz"},{value:"Trenitalia",label:"Trenitalia"},{value:"Bahn_de",label:"Bahn_de"},{value:"Go_Euro",label:"Go_Euro"},{value:"Suntransfers",label:"Suntransfers"},{value:"Jayride",label:"Jayride"},{value:"Con_x_ion",label:"Con_x_ion"},{value:"Kiwitaxi",label:"Kiwitaxi"},{value:"KIWI",label:"KIWI"},{value:"Getyourguide",label:"Getyourguide"},{value:"Experience_OZ",label:"Experience_OZ"},{value:"Suta",label:"Suta"},{value:"Klook",label:"Klook"},{value:"Jeya_NanayamTravels",label:"Jeya_NanayamTravels"},{value:"Threeland_Travels",label:"Threeland_Travels"},{value:"Travinno",label:"Travinno"},{value:"Rocketbird",label:"Rocketbird"},{value:"Greyline",label:"Greyline"},{value:"viva_gr",label:"viva_gr"},{value:"seajets_gr",label:"seajets_gr"},{value:"flixbus",label:"flixbus"},{value:"getbybus",label:"getbybus"},{value:"bookmebus",label:"bookmebus"},{value:"nettbus",label:"nettbus"},{value:"shuttledirect",label:"shuttledirect"},{value:"alsa",label:"alsa"},{value:"PYTON",label:"PYTON"},{value:"ROME2RIO",label:"ROME2RIO"},{value:"AOT",label:"AOT"},{value:"ACE",label:"ACE"},{value:"RAILS",label:"RAILS"},{value:"DATABASE",label:"DATABASE"},{value:"SELF",label:"SELF"},{value:"NONE",label:"NONE"},{value:"MGBEDBANKS",label:"MGBEDBANKS"},{value:"AGODA",label:"AGODA"},{value:"TRIPLAZE",label:"TRIPLAZE"}],r=[{value:"Specific hotel NA on product",label:"Specific hotel NA on product"},{value:"Want split stay in same city",label:"Want split stay in same city"},{value:"Adding cruise",label:"Adding cruise"},{value:"Diff room configuraion in diff cities",label:"Diff room configuraion in diff cities"},{value:"Extra night costed for early check-in, late check-out",label:"Extra night costed for early check-in, late check-out"},{value:"Adding an inclusion in Product",label:"Adding an inclusion in Product"}],i=[{value:"SPEEDBOAT",label:"Speedboat"},{value:"SEAPLANE",label:"Seaplane"},{value:"INTERNAL_FLIGHT",label:"Internal flight"}],n=[{value:"AI",label:"AI (All Inclusive)"},{value:"FB",label:"FB (Full Board)"},{value:"HB",label:"HB (Half Board)"},{value:"BB",label:"BB (Breakfast only)"},{value:"RO",label:"RO (Room Only)"}],o=[{value:1,label:"1 Adult"},{value:2,label:"2 Adults"},{value:3,label:"3 Adults"},{value:4,label:"4 Adults"},{value:5,label:"5 Adults"},{value:6,label:"6 Adults"},{value:7,label:"7 Adults"},{value:8,label:"8 Adults"},{value:9,label:"9 Adults"}],s={ANNIVERSARY:[{value:"Anniversary Inclusions",label:"Anniversary Inclusions"}],BIRTHDAY:[{value:"Birthday Inclusions",label:"Birthday Inclusions"}],HONEYMOON:[{value:"Honeymoon Inclusions",label:"Honeymoon Inclusions"}],VACATION:[{value:"Pyt Special Inclusions",label:"Pyt Special Inclusions"},{value:"Standard Inclusions",label:"Standard Inclusions"},{value:"Dynamic Inclusions",label:"Dynamic Inclusions"},{value:"Special Inclusions",label:"Special Inclusions"}]},c=[{value:"Not available on our product",label:"Not available on our product"},{value:"Diff customer - diff flights",label:"Diff customer - diff flights"},{value:"Business Class or Premium Economy",label:"Business Class or Premium Economy"},{value:"Flights booked by customers",label:"Flights booked by customers"},{value:"International & Internal flights on the same day",label:"International & Internal flights on the same day"},{value:"Two one way flights instead of round trip",label:"Two one way flights instead of round trip"},{value:"Spending extra day in transit",label:"Spending extra day in transit"},{value:"All passengers not taking flights",label:"All passengers not taking flights"}]},53356:(e,a,l)=>{l.d(a,{G:()=>f});var t=l(95155),r=l(12115),i=l(21455),n=l.n(i),o=l(94928),s=l(61594),c=l(45686),d=l(33473),u=l(69606),m=l(68376),p=l(48575),v=l(83153),b=l(62570),y=l(33455),g=l(30810),h=l(52562);let f=e=>{let{isEdit:a=!1,departureDateMillis:l=Date.now()+2592e6,cancellationTypeValue:i,control:f,setValue:x,getValues:C,clearErrors:T,cancellationTypeFieldName:N="cancellationType",cancellationNumFieldName:j="cancellationNum",cancellationDateFieldName:D="cancellationDate",timelineFieldName:I="cancellationTimelineList",currencyFieldName:A="currency",currencyData:Y,initialCurrency:M}=e,E=(0,o.md)(g.pX),k=(0,u.FH)({control:f,name:N}),{fields:S,append:P,remove:R}=(0,u.jz)({name:I,control:f}),{fieldState:{error:O}}=(0,u.as)({name:N,control:f}),[B,w]=(0,r.useState)(k||i||void 0),F=(0,u.FH)({control:f,name:A}),L=function(e){let a=!(arguments.length>1)||void 0===arguments[1]||arguments[1];w(e),x(N,e,{shouldValidate:!0,shouldDirty:!0}),a&&(x(j,"",{shouldValidate:!1,shouldDirty:!1}),x(D,null,{shouldValidate:!1,shouldDirty:!1}),"partial-refund"===e?x(I,[{fromTimeMillis:n()().format("YYYY-MM-DD"),toT
1imeMillis:n()(l).format("YYYY-MM-DD"),fee:"",tripKey:e}]):x(I,[],{shouldValidate:!1,shouldDirty:!1}))};(0,r.useEffect)(()=>{k&&k!==B&&L(k,!1)},[k]);let V=e=>{let a=C("".concat(I,".").concat(e,".toTimeMillis"));if(!a)return;let l=n()(a).add(1,"day").format("YYYY-MM-DD");S.length-1>e&&(x("".concat(I,".").concat(e+1,".fromTimeMillis"),l),T("".concat(I,".").concat(e+1,".fromTimeMillis")))},K=e=>{let a=S.length-1;x("".concat(I,".").concat(a-1,".toTimeMillis"),C("".concat(I,".").concat(a,".toTimeMillis"))),S.length-1>e&&x("".concat(I,".").concat(e+1,".fromTimeMillis"),n()(C("".concat(I,".").concat(e-1,".toTimeMillis"))).format("YYYY-MM-DD")),R(e),T(I)},q=(0,r.useMemo)(()=>{var e;return(null==E?void 0:null===(e=E.displayCurrency)||void 0===e?void 0:e.toUpperCase())||"INR"},[null==E?void 0:E.displayCurrency]);return(0,t.jsxs)(m.VP,{children:[(0,t.jsx)(b.o,{className:"text-normal font-bold my-1 text-neutral-800 pl-2",children:"Cancellation Policy"}),(0,t.jsxs)(m.VP,{className:(0,y.cn)("border border-dashed border-neutral-400 rounded-lg p-4 relative",O&&"border-destructive"),children:[(0,t.jsx)(b.o,{className:(0,y.cn)("absolute -top-2 left-4 px-2 text-xs font-bold text-neutral-600 bg-white",O&&"text-destructive"),children:"Timeslot Configuration"}),(0,t.jsxs)(v.Tabs,{value:B,onValueChange:e=>L(e,!0),className:"w-full mt-2",children:[(0,t.jsxs)(v.TabsList,{className:"gap-2",children:[(0,t.jsx)(v.TabsTrigger,{value:"refund",className:"text-neutral-600 border border-neutral-400 data-[state=active]:bg-primary-50 data-[state=active]:text-primary-600 data-[state=active]:border-primary",children:"Refundable"}),(0,t.jsx)(v.TabsTrigger,{value:"no-refund",className:"text-neutral-600 border border-neutral-400 data-[state=active]:bg-primary-50 data-[state=active]:text-primary-600 data-[state=active]:border-primary",children:"Non-Refundable"}),(0,t.jsx)(v.TabsTrigger,{value:"partial-refund",className:"text-neutral-600 border border-neutral-400 data-[state=active]:bg-primary-50 data-[state=active]:text-primary-600 data-[state=active]:border-primary",children:"Partially-Refundable"})]}),(null==O?void 0:O.message)&&(0,t.jsxs)(m.fI,{gap:2,className:"mt-2",children:[(0,t.jsx)(s.A,{width:18,height:18,className:"text-destructive"}),(0,t.jsx)(b.o,{role:"alert",className:"text-destructive text-sm font-medium",children:O.message})]}),(0,t.jsx)(v.TabsContent,{value:"refund",className:"mt-4",children:(0,t.jsxs)(m.VP,{className:"gap-2",children:[(0,t.jsx)(b.o,{className:"text-gray-600 text-xs font-bold uppercase",children:"Supplier Cancellation Policy"}),(0,t.jsxs)(m.fI,{className:"items-center gap-3 flex-wrap",children:[(0,t.jsx)(b.o,{className:"text-gray-500 text-sm",children:"Departure -"}),(0,t.jsx)(m.fI,{className:"w-[120px]",children:(0,t.jsx)(p.C,{type:"number",name:j,size:"sm",control:f,className:"w-full  border border-gray-300 p-2 ",hideErrorMsg:!0,hideClear:!0,onChange:()=>{x(D,null)}})}),(0,t.jsxs)(m.fI,{className:"items-center gap-4 flex-1",children:[(0,t.jsx)(b.o,{className:"text-gray-500 text-sm",children:"days"}),(0,t.jsx)(b.o,{className:"text-gray-900 text-sm font-bold",children:"(or)"}),(0,t.jsx)(b.o,{className:"text-green-500 text-sm",children:"Add Date"}),(0,t.jsx)(m.fI,{children:(0,t.jsx)(p.C,{name:D,type:"date",size:"sm",control:f,className:"w-full p-2 border border-gray-300  bg-gray-100 text-sm text-gray-700",hideErrorMsg:!0,onChange:()=>{x(j,"")}})})]})]})]})}),(0,t.jsx)(v.TabsContent,{value:"no-refund",className:"mt-4",children:(0,t.jsx)(m.VP,{className:"gap-2 py-4",children:(0,t.jsx)(b.o,{className:"text-gray-600 text-sm text-center",children:"No cancellation allowed - Non-refundable booking"})})}),(0,t.jsx)(v.TabsContent,{value:"partial-refund",className:"mt-4",children:(0,t.jsxs)(m.VP,{children:[S.map((e,l)=>{let r=e.fromTimeMillis;return(0,t.jsxs)(m.fI,{className:"items-start p-3 border border-neutral-100 rounded-xl",children:[(0,t.jsxs)(m.VP,{gap:2,className:"flex-1",children:[(0,t.jsx)(b.o,{className:"text-gray-700 text-sm font-semibold mb-1",children:"Start Date"}),(0,t.jsx)(p.C,{name:"".concat(I,".").concat(l,".fromTimeMillis"),type:"date",size:"sm",control:f,hideClear:!0,className:"p-2 border border-gray-300 bg-gray-100 text-sm text-gray-700"})]}),(0,t.jsxs)(m.VP,{gap:2,className:"flex-1",children:[(0,t.jsx)(b.o,{className:"text-gray-700 text-sm font-semibold mb-1",children:"End Date"}),(0,t.jsx)(p.C,{name:"".concat(I,".").concat(l,".toTimeMillis"),type:"date",size:"sm",control:f,onChange:()=>V(l),min:r?n()(r).add(1,"day").format("YYYY-MM-DD"):void 0,max:n()(C("".concat(I,".").concat(S.length-1,".toTimeMillis"))).subtract(1,"day").format("YYYY-MM-DD"),disabled:S.length<=1||S.length-1===l,hideClear:!0,className:"w-full p-2 border border-gray-300  bg-gray-100 text-sm text-gray-700 disabled:cursor-not-allowed"})]}),(0,t.jsxs)(m.VP,{gap:2,className:"flex-1",children:[(0,t.jsxs)(b.o,{className:"text-gray-700 text-sm font-semibold mb-1",children:["Fee ",F?"- (".concat(F.toUpperCase(),")"):""]}),(0,t.jsx)(p.C,{size:"sm",name:"".concat(I,".").concat(l,".fee"),type:"number",control:f,className:"w-full p-2 border border-gray-300  bg-gray-100 text-sm text-gray-700"}),(0,t.jsx)(h.mP,{control:f,currency:F,currencyData:Y,fieldName:"".concat(I,".").concat(l,".fee"),label:"Converted PYT Cost (".concat(q,")"),valuePrefix:q,targetCurrency:q,isEditMode:a,initialCurrency:M,alwaysShowInEditMode:!0})]}),(0,t.jsx)(v.Button,{danger:!0,type:"button",variant:"ghost",size:"icon",onClick:()=>K(l),disabled:0===l,className:"h-8 w-8",children:(0,t.jsx)(c.A,{className:"h-4 w-4"})})]},e.id)}),(0,t.jsx)(m.fI,{className:"justify-end",children:(0,t.jsxs)(b.o,{className:"flex items-center gap-2 text-gray-600 font-bold text-sm cursor-pointer hover:text-gray-900",onClick:()=>{let e=S.length-1;P({fromTimeMillis:"",toTimeMillis:C("".concat(I,".").concat(e,".toTimeMillis")),fee:"",tripKey:C(N)}),x("".concat(I,".").concat(e,".toTimeMillis"),""),T(I)},children:[(0,t.jsx)(d.A,{className:"h-4 w-4"}),"Add Timeslot Configuration"]})})]})})]})]})]})}},47062:(e,a,l)=>{l.d(a,{Al:()=>s,Iu:()=>o,Nb:()=>i,OH:()=>n,Pi:()=>t,Pm:()=>c,nu:()=>r,vK:()=>d});let t=[{label:"INR",value:"INR"},{label:"EUR",value:"EUR"},{label:"AED",value:"AED"},{label:"AUD",value:"AUD"},{label:"CHF",value:"CHF"},{label:"GBP",value:"GBP"},{label:"HRK",value:"HRK"},{label:"IDR",value:"IDR"},{label:"JPY",value:"JPY"},{label:"LKR",value:"LKR"},{label:"MYR",value:"MYR"},{label:"NZD",value:"NZD"},{label:"SGD",value:"SGD"},{label:"THB",value:"THB"},{label:"ZAR",value:"ZAR"},{label:"USD",value:"USD"}],r=[{value:"Adding Baggage/Seat Selection/Extra services",label:"Adding Baggage/Seat Selection/Extra services"},{value:"Not in product",label:"Not in product"},{value:"Extra pax",label:"Extra pax"}],i=[{value:"Transit Visa",label:"Transit Visa"}
1,{value:"Transport Card",label:"Transport Card"},{value:"Complimentary services",label:"Complimentary services"},{value:"Adding Cruise/Ferry",label:"Adding Cruise/Ferry"},{value:"Point to point SIC transfer",label:"Point to point SIC transfer"},{value:"Car Rentals",label:"Car Rentals"},{value:"Extra transfers",label:"Extra transfers"},{value:"Adding Baggage/Seat Selection/Extra services",label:"Adding Baggage/Seat Selection/Extra services"},{value:"Not in product",label:"Not in product"},{value:"Few pax",label:"Few pax"},{value:"Extra pax",label:"Extra pax"},{value:"Tourgrade not available",label:"Tourgrade not available"},{value:"DMC",label:"DMC"}],n=[{label:"PYT Cost",value:"PYT_COST"},{label:"PYT Cost & Internet Cost",value:"PYT_COST&INTERNET_COST"},{label:"PYT Cost & Total Dealsize",value:"PYT_COST&TOTAL_DEALSIZE"}],o=[{label:"DIRECT WEBSITE",value:"DIRECT WEBSITE"},{label:"DIRECT HOTEL",value:"DIRECT HOTEL"},{label:"DMC",value:"DMC"},{label:"BOOKING.COM",value:"BOOKING.COM"},{label:"AGODA",value:"AGODA"},{label:"TBO",value:"TBO"},{label:"TRANSFERZ",value:"TRANSFERZ"},{label:"EXPEDIA",value:"EXPEDIA"},{label:"GETYOURGUIDE",value:"GETYOURGUIDE"}],s=/^-?\d+(\.\d+)?$/,c=/<[^>]+>/g,d=e=>e.replace(c,"").trim()}}]);

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.