1import{j as e,r}from"./vendor-react-DioNwH4B.js";import s from"./Icon-DwHeWCwO.js";import{LegTimeline as a,FareOptions as l}from"./Trip-BvaqiiM8.js";import{m as n,t}from"./format-D9pXzpPR.js";import"./normalise-KS3LBr1A.js";const i=[["legs","Journey"],["fares","Fares"],["price","Price breakdown"],["bags","Baggage"],["rules","Fare rules"]],c={YQ:"Airline fuel and carrier charge",YR:"Carrier-imposed fee",OT:"Airport, security and statutory taxes",AGST:"GST",MF:"Management fee",MFT:"Tax on management fee"},d={CANCELLATION:"Cancellation",DATECHANGE:"Date change",NO_SHOW:"No show",SEAT_CHARGEABLE:"Seats",BAGGAGE:"Baggage",MEAL:"Meals"};function o({fare:r,currency:s,travellers:a}){const l=r?.breakdown||[];if(!l.length)return e.jsxs("p",{className:"mrd-leg__sub",children:["The airline did not itemise this fare. The total below is what it quoted:"," ",e.jsx("b",{children:n(r?.total,s)}),"."]});const i=e=>l.reduce((r,s)=>r+(t(s[e])||0)*(t(s.PassengerCount)||1),0),d=i("BaseFare"),o={};l.forEach(e=>{const r=t(e.PassengerCount)||1,s=e.TaxBR||{};Object.keys(s).forEach(e=>{const a=(t(s[e])||0)*r;a&&(o[e]=(o[e]||0)+a)})});const h=Object.values(o).reduce((e,r)=>e+r,0),m=i("Tax"),u=i("FixedMarkUp")+i("ServiceFixedMarkUp")+i("GSTOnMarkUp")+i("ProcessingAmount")+i("GSTOnProcessing"),j=Math.max(0,Math.round(m-h));return e.jsxs("div",{children:[e.jsx("div",{className:"mrd-tablewrap",children:e.jsxs("table",{className:"mrd-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"What"}),e.jsx("th",{children:"Who"}),e.jsx("th",{className:"mrd-table__num",children:"Amount"})]})}),e.jsxs("tbody",{children:[l.map((r,a)=>e.jsxs("tr",{children:[e.jsx("td",{children:"Base fare"}),e.jsxs("td",{children:[r.PaxType||"Traveller"," Ã ",r.PassengerCount||1]}),e.jsx("td",{className:"mrd-table__num",children:n((t(r.BaseFare)||0)*(t(r.PassengerCount)||1),s)})]},`base-${a}`)),Object.entries(o).map(([r,a])=>e.jsxs("tr",{children:[e.jsx("td",{children:c[r]||r}),e.jsx("td",{className:"mrd-leg__sub",children:r}),e.jsx("td",{className:"mrd-table__num",children:n(a,s)})]},r)),j?e.jsxs("tr",{children:[e.jsx("td",{children:"Other taxes and surcharges"}),e.jsx("td",{className:"mrd-leg__sub",children:"not itemised by the airline"}),e.jsx("td",{className:"mrd-table__num",children:n(j,s)})]}):null,u?e.jsxs("tr",{children:[e.jsx("td",{children:"Booking and service fee"}),e.jsx("td",{className:"mrd-leg__sub",children:"charged by us, not the airline"}),e.jsx("td",{className:"mrd-table__num",children:n(u,s)})]}):null]}),e.jsx("tfoot",{children:e.jsxs("tr",{children:[e.jsxs("th",{colSpan:2,children:["Total for ",a>1?`${a} travellers`:"1 traveller"]}),e.jsx("th",{className:"mrd-table__num",children:n(r.total,s)})]})})]})}),d&&Math.abs(d+m+u-r.total)>2?e.jsxs("p",{className:"mrd-leg__sub",style:{marginTop:8},children:["The parts above come to ",n(d+m+u,s),"; the airline is charging"," ",n(r.total,s),". The total is what you pay."]}):null]})}function h({fare:r}){const s=r?.tripInfo,a=s&&"object"==typeof s?Object.entries(s):[];if(!a.length)return e.jsxs("p",{className:"mrd-leg__sub",children:["The airline gave one allowance for the whole journey:"," ","cabin ",r?.cabinBag||"not stated",", check-in ",r?.checkedBag||"not stated","."]});const l=[...new Set(a.flatMap(([,e])=>Object.keys(e||{})))];return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mrd-tablewrap",children:e.jsxs("table",{className:"mrd-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Sector"}),e.jsx("th",{children:"Traveller"}),e.jsx("th",{children:"Cabin"}),e.jsx("th",{children:"Check-in"})]})}),e.jsx("tbody",{children:a.map(([r,s])=>l.filter(e=>s?.[e]).map(a=>e.jsxs("tr",{children:[e.jsx("td",{children:r}),e.jsx("td",{children:a}),e.jsx("td",{children:s[a].cabin||"â"}),e.jsx("td",{children:s[a].checkin||"â"})]},`${r}-${a}`)))})]})}),e.jsx("p",{className:"mrd-leg__sub",style:{marginTop:10},children:"Hand baggage is normally one piece up to the weight shown plus one personal article. Infants are usually allowed one piece. Extra baggage can be added on the next screen where the airline sells it."})]})}function m({policy:a,loading:l,error:i,currency:c}){const o=r.useMemo(()=>{const e=a?.NewFareRules;return e&&"object"==typeof e?Object.entries(e).filter(([,e])=>Array.isArray(e)&&e.length):[]}
1,[a]);if(l)return e.jsx("p",{className:"mrd-leg__sub",children:"Asking the airline for its rulesâ¦"});if(i)return e.jsxs("div",{className:"mrd-note mrd-note--warn",children:[e.jsx(s,{name:"warn",size:15}),"The airline did not return its fare rules just now. They are shown in full before you pay."]});if(!a)return e.jsx("p",{className:"mrd-leg__sub",children:"Open this tab to load the rules."});if(!o.length){const r=a?.results?.fareRule||a?.FareRules;return e.jsx("pre",{className:"mrd-raw",children:"string"==typeof r?r:JSON.stringify(r??a,null,2)})}return e.jsxs(e.Fragment,{children:[o.map(([r,s])=>e.jsxs("div",{style:{marginBottom:16},children:[e.jsx("h4",{style:{marginBottom:8},children:d[r]||r.replace(/_/g," ").toLowerCase()}),e.jsx("div",{className:"mrd-tablewrap",children:e.jsxs("table",{className:"mrd-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"When"}),e.jsx("th",{children:"Sector"}),e.jsx("th",{className:"mrd-table__num",children:"Airline fee"}),e.jsx("th",{className:"mrd-table__num",children:"Our fee"})]})}),e.jsx("tbody",{children:s.map((s,a)=>e.jsxs("tr",{children:[e.jsxs("td",{children:[s.TimeFrame||`${s.st}â${s.et} hrs before departure`,Array.isArray(s.policyInfo)&&s.policyInfo.length?e.jsx("div",{className:"mrd-leg__sub",children:s.policyInfo.join(" ")}):"string"==typeof s.policyInfo&&s.policyInfo?e.jsx("div",{className:"mrd-leg__sub",children:s.policyInfo}):null]}),e.jsx("td",{className:"mrd-leg__sub",children:s.sector||"â"}),e.jsx("td",{className:"mrd-table__num",children:t(s.amount)?n(s.amount,s.CurrencyTitle||c):"â"}),e.jsx("td",{className:"mrd-table__num",children:t(s.additionalFee)?n(s.additionalFee,s.CurrencyTitle||c):"â"})]},`${r}-${a}`))})]})})]},r)),e.jsx("p",{className:"mrd-leg__sub",children:"Fees are per traveller and are charged on top of any fare difference. Where a fare is refundable, the refund is the fare you paid minus the fees above."})]})}function u({trip:r,tab:s,onTab:n,onPick:t,onHold:c,busyKey:d,paxCount:u,currency:j,directionLabels:x,actionLabel:b,policy:p,policyLoading:f,policyError:g,onNeedPolicy:y}){const _=r.cheapest;return e.jsxs("div",{className:"mrd-row__more",children:[e.jsx("div",{className:"mrd-tabs",role:"tablist",children:i.map(([a,l])=>e.jsxs("button",{role:"tab","aria-selected":s===a,className:"mrd-tab"+(s===a?" is-on":""),type:"button",onClick:()=>{n(a),"rules"===a&&y?.(r)},children:[l,"fares"===a&&r.fares.length>1?` (${r.fares.length})`:""]},a))}),e.jsxs("div",{className:"mrd-detail",children:["legs"===s?e.jsx(a,{trip:r,labels:x}):null,"fares"===s?e.jsx(l,{trip:r,onPick:t,onHold:c,busyKey:d,paxCount:u,currency:j,actionLabel:b}):null,"price"===s?e.jsx(o,{fare:_,currency:j,travellers:u}):null,"bags"===s?e.jsx(h,{fare:_}):null,"rules"===s?e.jsx(m,{policy:p,loading:f,error:g,currency:j}):null]})]})}export{u as default};
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.