import{r as j,j as e,L as ae}from"./vendor-react-BwKDLVNL.js";import{T as le}from"./ToolPageSEO-D_-zlz_4.js";import{T as ne}from"./toolsMeta-CeuNOhcH.js";import{v as S,w,x as c,B as v,A as oe,D as re,z as l,F as x,K as A,L as C,V as M,I as u,_ as U,$ as D,a0 as H,a1 as B,c5 as O,c6 as I,a2 as G,ab as K,ax as R,W as V,J as z,G as _,b1 as E,H as J}from"./index-C1ye5P3I.js";import"./vendor-dayjs-5tvLiZdS.js";import{M as ce,a as ie}from"./MarketingShell-pJlumM7K.js";import{u as me}from"./vendor-i18n-C6wqqoou.js";import{A as de}from"./arrow-left-Em93IgUy.js";import{R as T}from"./ruler-BuPsYC3U.js";import{A as F}from"./anchor-BaOQfk8c.js";import{R as xe}from"./rotate-ccw-B1NaTLYd.js";import"./vendor-query-D-sr233n.js";import"./vendor-sentry-B6ofghpF.js";import"./vendor-antd-core-4y2ghozH.js";import"./zap-Bd320S-h.js";import"./globe-C6LFgqFt.js";import"./shield-check-CUe1YrFZ.js";import"./users-BQu_O3JR.js";import"./file-text-cRwgk8Y4.js";import"./SiteFooter-CMa-vyJL.js";import"./send-BPZS28JS.js";import"./building-2-BaHHBpzk.js";function ue(s,n,i,o){const m=(i-s)*Math.PI/180,d=(o-n)*Math.PI/180,g=Math.sin(m/2)**2+Math.cos(s*Math.PI/180)*Math.cos(i*Math.PI/180)*Math.sin(d/2)**2;return 6371*2*Math.atan2(Math.sqrt(g),Math.sqrt(1-g))}const Z=[{locode:"RUOVB",name:"Владивосток",country:"Россия",region:"Россия",lat:43.11,lng:131.88},{locode:"RULED",name:"Санкт-Петербург",country:"Россия",region:"Россия",lat:59.87,lng:30.27},{locode:"RUNVS",name:"Новороссийск",country:"Россия",region:"Россия",lat:44.72,lng:37.77},{locode:"RUNAK",name:"Находка",country:"Россия",region:"Россия",lat:42.83,lng:132.88},{locode:"CNSHA",name:"Шанхай",country:"Китай",region:"Китай",lat:31.23,lng:121.47},{locode:"CNNGB",name:"Нинбо",country:"Китай",region:"Китай",lat:29.87,lng:121.55},{locode:"CNSZX",name:"Шэньчжэнь",country:"Китай",region:"Китай",lat:22.54,lng:114.07},{locode:"CNTAO",name:"Циндао",country:"Китай",region:"Китай",lat:36.07,lng:120.33},{locode:"CNTJN",name:"Тяньцзинь",country:"Китай",region:"Китай",lat:39.02,lng:117.7},{locode:"SGSIN",name:"Сингапур",country:"Сингапур",region:"Азия–Пасифик",lat:1.29,lng:103.85},{locode:"KRPUS",name:"Пусан",country:"Южная Корея",region:"Азия–Пасифик",lat:35.18,lng:129.08},{locode:"HKHKG",name:"Гонконг",country:"Гонконг",region:"Азия–Пасифик",lat:22.29,lng:114.16},{locode:"JPTYO",name:"Токио",country:"Япония",region:"Азия–Пасифик",lat:35.49,lng:139.79},{locode:"JPYOK",name:"Иокогама",country:"Япония",region:"Азия–Пасифик",lat:35.44,lng:139.64},{locode:"MYPKG",name:"Порт-Кланг",country:"Малайзия",region:"Азия–Пасифик",lat:3,lng:101.37},{locode:"VNCPG",name:"Хошимин",country:"Вьетнам",region:"Азия–Пасифик",lat:10.75,lng:106.7},{locode:"THLCH",name:"Лаем-Чабанг",country:"Таиланд",region:"Азия–Пасифик",lat:13.07,lng:100.88},{locode:"INNSA",name:"Мумбаи (JNPT)",country:"Индия",region:"Азия–Пасифик",lat:18.95,lng:72.95},{locode:"LKCMB",name:"Коломбо",country:"Шри-Ланка",region:"Азия–Пасифик",lat:6.93,lng:79.85},{locode:"AEJEA",name:"Джебель-Али",country:"ОАЭ",region:"Ближний Восток",lat:24.98,lng:55.06},{locode:"EGPSD",name:"Порт-Саид",country:"Египет",region:"Ближний Восток",lat:31.26,lng:32.3},{locode:"NLRTM",name:"Роттердам",country:"Нидерланды",region:"Европа",lat:51.92,lng:4.48},{locode:"BEANR",name:"Антверпен",country:"Бельгия",region:"Европа",lat:51.22,lng:4.4},{locode:"DEHAM",name:"Гамбург",country:"Германия",region:"Европа",lat:53.55,lng:10},{locode:"GBFXT",name:"Феликстоу",country:"Великобритания",region:"Европа",lat:51.96,lng:1.35},{locode:"GRPIR",name:"Пирей",country:"Греция",region:"Европа",lat:37.94,lng:23.63},{locode:"ESVLC",name:"Валенсия",country:"Испания",region:"Европа",lat:39.47,lng:-.33},{locode:"ESALG",name:"Альхесирас",country:"Испания",region:"Европа",lat:36.13,lng:-5.46},{locode:"FRLEA",name:"Гавр",country:"Франция",region:"Европа",lat:49.49,lng:.11},{locode:"ITGOA",name:"Генуя",country:"Италия",region:"Европа",lat:44.41,lng:8.93},{locode:"TRAMB",name:"Стамбул",country:"Турция",region:"Европа",lat:40.97,lng:28.72},{locode:"USLAX",name:"Лос-Анджелес",country:"США",region:"Северная Америка",lat:33.73,lng:-118.26},{locode:"USLGB",name:"Лонг-Бич",country:"США",region:"Северная Америка",lat:33.77,lng:-118.19},{locode:"USNYC",name:"Нью-Йорк",country:"США",region:"Северная Америка",lat:40.71,lng:-74.01},{locode:"USSAV",name:"Саванна",country:"США",region:"Северная Америка",lat:32.08,lng:-81.09},{locode:"USHOU",name:"Хьюстон",country:"США",region:"Северная Америка",lat:29.74,lng:-95.27},{locode:"PACOL",name:"Колон",country:"Панама",region:"Северная Америка",lat:9.36,lng:-79.91},{locode:"BRSSZ",name:"Сантос",country:"Бразилия",region:"Южная Америка",lat:-23.95,lng:-46.32},{locode:"AREZE",name:"Буэнос-Айрес",country:"Аргентина",region:"Южная Америка",lat:-34.59,lng:-58.37},{locode:"CLVAP",name:"Вальпараисо",country:"Чили",region:"Южная Америка",lat:-33.03,lng:-71.63},{locode:"ZACPT",name:"Кейптаун",country:"ЮАР",region:"Африка",lat:-33.92,lng:18.42},{locode:"ZAABD",name:"Дурбан",country:"ЮАР",region:"Африка",lat:-29.87,lng:31.03},{locode:"NGLOS",name:"Лагос",country:"Нигерия",region:"Африка",lat:6.45,lng:3.42},{locode:"KEMBA",name:"Момбаса",country:"Кения",region:"Африка",lat:-4.04,lng:39.66}],L=["Россия","Китай","Азия–Пасифик","Ближний Восток","Европа","Северная Америка","Южная Америка","Африка"],he=[{label:"Шанхай → Роттердам",from:"CNSHA",to:"NLRTM"},{label:"Владивосток → Новороссийск",from:"RUOVB",to:"RUNVS"},{label:"Шанхай → Санкт-Петербург",from:"CNSHA",to:"RULED"},{label:"Сингапур → Гамбург",from:"SGSIN",to:"DEHAM"},{label:"Шанхай → Лос-Анджелес",from:"CNSHA",to:"USLAX"},{label:"Мумбаи → Роттердам",from:"INNSA",to:"NLRTM"},{label:"Пусан → Владивосток",from:"KRPUS",to:"RUOVB"},{label:"Джебель-Али → Новороссийск",from:"AEJEA",to:"RUNVS"}],ge=22,je=15,pe=new Set(["Европа","Северная Америка","Южная Америка"]);function h(s){return pe.has(s.region)?48:36}function $(s,n){const i=Math.floor(s/24),o=Math.round(s%24);return o===0?n("tools.distance.transitDays","{{days}} дн.",{days:i}):n("tools.distance.transitDaysHours","{{days}} дн. {{hours}} ч.",{days:i,hours:o})}function Ge(){const{t:s}=me(),[n,i]=j.useState(""),[o,p]=j.useState(""),[m,d]=j.useState(null),g=j.useMemo(()=>{var r;const t=new Map;for(const a of L)t.set(a,[]);for(const a of Z)(r=t.get(a.region))==null||r.push(a);return t},[]),N=j.useMemo(()=>{const t=new Map;for(const r of Z)t.set(r.locode,r);return t},[]),P=n!==""&&o!==""&&n!==o;function W(){if(!P)return;const t=N.get(n),r=N.get(o),b=ue(t.lat,t.lng,r.lat,r.lng)*1.25,q=b/1.852,Q=h(t),ee=h(r),k=Q+ee,se=b/ge+k,te=b/je+k;d({km:b,nm:q,containerHours:se,bulkHours:te})}function X(){i(o),p(n),d(null)}function Y(t){i(t.from),p(t.to),d(null)}const f=n?N.get(n):void 0,y=o?N.get(o):void 0;return e.jsxs(ce,{active:"tools",children:[e.jsx(le,{...ne.distance}),e.jsx(S,{py:"lg",bg:"surface",children:e.jsx(w,{size:"base",children:e.jsxs(c,{gap:6,children:[e.jsx("div",{children:e.jsx(v,{variant:"ghost",size:"sm",asChild:!0,className:"-ml-2 text-text-muted",children:e.jsxs(ae,{to:"/tools",children:[e.jsx(de,{className:"h-4 w-4"}),s("tools.distance.allTools","Все инструменты")]})})}),e.jsxs(c,{gap:4,align:"center",className:"text-center max-w-3xl mx-auto",children:[e.jsx("div",{className:"h-14 w-14 rounded-2xl bg-primary-light flex items-center justify-center mx-auto",children:e.jsx(T,{className:"h-7 w-7 text-primary"})}),e.jsx(oe,{variant:"default",children:s("tools.distance.freeBadge","Бесплатно · без регистрации")}),e.jsx(re,{size:"lg",children:s("tools.distance.heroTitle","Расстояние и время в море")}),e.jsx(l,{variant:"lead",className:"max-w-2xl",children:s("tools.distance.heroLead","Морское расстояние между портами, время транзита по типу судна и ETA-оценка с учётом швартовки. 50 портов мира.")})]})]})})}),e.jsx(S,{py:"lg",children:e.jsx(w,{size:"base",children:e.jsxs("div",{className:"max-w-2xl mx-auto",children:[e.jsxs(x,{className:"shadow-sm",children:[e.jsxs(A,{children:[e.jsxs(C,{className:"flex items-center gap-2",children:[e.jsx(F,{className:"h-5 w-5 text-primary"}),s("tools.distance.selectPortsTitle","Выберите порты")]}),e.jsx(M,{children:s("tools.distance.selectPortsDesc","Расстояние рассчитывается по формуле гаверсинуса с коэффициентом морского маршрута ×1,25")})]}),e.jsx(u,{children:e.jsxs(c,{gap:6,children:[e.jsxs("div",{className:"flex items-end gap-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx(l,{variant:"muted",className:"text-xs font-medium uppercase tracking-wide mb-1.5 block",children:s("tools.distance.fromLabel","Порт отправления")}),e.jsxs(U,{value:n,onValueChange:t=>{i(t),d(null)},children:[e.jsx(D,{className:"w-full",children:e.jsx(H,{placeholder:s("tools.distance.portPlaceholder","Выберите порт…")})}),e.jsx(B,{className:"max-h-72",children:L.map(t=>{const r=g.get(t)??[];return r.length===0?null:e.jsxs(O,{children:[e.jsx(I,{children:t}),r.map(a=>e.jsxs(G,{value:a.locode,children:[e.jsx("span",{className:"font-mono text-xs text-text-muted mr-2",children:a.locode}),a.name,e.jsxs("span",{className:"text-text-muted ml-1",children:["· ",a.country]})]},a.locode))]},t)})})]})]}),e.jsx("div",{className:"flex flex-col items-center gap-1 pb-0.5",children:e.jsx(v,{variant:"outline",size:"icon",onClick:X,disabled:!n&&!o,title:s("tools.distance.swapTitle","Поменять местами"),className:"h-9 w-9 shrink-0",children:e.jsx(xe,{className:"h-4 w-4"})})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx(l,{variant:"muted",className:"text-xs font-medium uppercase tracking-wide mb-1.5 block",children:s("tools.distance.toLabel","Порт назначения")}),e.jsxs(U,{value:o,onValueChange:t=>{p(t),d(null)},children:[e.jsx(D,{className:"w-full",children:e.jsx(H,{placeholder:s("tools.distance.portPlaceholder","Выберите порт…")})}),e.jsx(B,{className:"max-h-72",children:L.map(t=>{const r=g.get(t)??[];return r.length===0?null:e.jsxs(O,{children:[e.jsx(I,{children:t}),r.map(a=>e.jsxs(G,{value:a.locode,children:[e.jsx("span",{className:"font-mono text-xs text-text-muted mr-2",children:a.locode}),a.name,e.jsxs("span",{className:"text-text-muted ml-1",children:["· ",a.country]})]},a.locode))]},t)})})]})]})]}),n&&o&&n===o&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-amber-600 bg-amber-50 border border-amber-200 rounded-lg px-3 py-2",children:[e.jsx(K,{className:"h-4 w-4 shrink-0"}),s("tools.distance.samePortWarning","Порт отправления и назначения совпадают. Выберите разные порты.")]}),e.jsxs(v,{size:"lg",className:"w-full",disabled:!P,onClick:W,children:[e.jsx(R,{className:"h-5 w-5"}),s("tools.distance.calculateBtn","Рассчитать"),e.jsx(V,{className:"h-4 w-4 ml-auto"})]})]})})]}),m&&f&&y&&e.jsxs(c,{gap:6,className:"mt-8",children:[e.jsxs("div",{className:"flex items-center gap-2 justify-center text-text-muted",children:[e.jsx("span",{className:"font-semibold text-text",children:f.name}),e.jsx(V,{className:"h-4 w-4"}),e.jsx("span",{className:"font-semibold text-text",children:y.name})]}),e.jsx(x,{className:"bg-primary/5 border-primary/20",children:e.jsx(u,{className:"pt-6",children:e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-around gap-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsxs("div",{className:"flex items-center justify-center gap-2 mb-1",children:[e.jsx(T,{className:"h-4 w-4 text-primary"}),e.jsx(l,{variant:"muted",className:"text-xs uppercase tracking-wide font-medium",children:s("tools.distance.nauticalMiles","Морские мили")})]}),e.jsx("p",{className:"text-4xl font-bold text-primary tabular-nums",children:Math.round(m.nm).toLocaleString("ru-RU")}),e.jsx(l,{variant:"muted",className:"text-xs mt-0.5",children:s("tools.distance.nmUnit","нм (nautical miles)")})]}),e.jsx(z,{orientation:"vertical",className:"hidden sm:block h-16"}),e.jsx(z,{className:"sm:hidden"}),e.jsxs("div",{className:"text-center",children:[e.jsxs("div",{className:"flex items-center justify-center gap-2 mb-1",children:[e.jsx(T,{className:"h-4 w-4 text-text-muted"}),e.jsx(l,{variant:"muted",className:"text-xs uppercase tracking-wide font-medium",children:s("tools.distance.kilometers","Километры")})]}),e.jsx("p",{className:"text-4xl font-bold tabular-nums",children:Math.round(m.km).toLocaleString("ru-RU")}),e.jsx(l,{variant:"muted",className:"text-xs mt-0.5",children:s("tools.distance.kmUnit","км (с коэф. маршрута ×1,25)")})]})]})})}),e.jsxs(_,{cols:2,gap:4,children:[e.jsxs(x,{children:[e.jsxs(A,{className:"pb-3",children:[e.jsx("div",{className:"h-10 w-10 rounded-lg bg-blue-50 flex items-center justify-center mb-2",children:e.jsx(R,{className:"h-5 w-5 text-blue-600"})}),e.jsx(C,{className:"text-base",children:s("tools.distance.containerVessel","Контейнеровоз")}),e.jsx(M,{className:"text-xs",children:s("tools.distance.containerSpeed","Скорость 22 км/ч · feeder / liner")})]}),e.jsxs(u,{children:[e.jsxs("div",{className:"flex items-end gap-1.5",children:[e.jsx(E,{className:"h-4 w-4 text-text-muted mb-1"}),e.jsx("p",{className:"text-2xl font-bold tabular-nums",children:$(m.containerHours,s)})]}),e.jsx(l,{variant:"muted",className:"text-xs mt-1",children:s("tools.distance.portStayNote","в т.ч. стоянка в портах: {{hours}} ч.",{hours:h(f)+h(y)})})]})]}),e.jsxs(x,{children:[e.jsxs(A,{className:"pb-3",children:[e.jsx("div",{className:"h-10 w-10 rounded-lg bg-amber-50 flex items-center justify-center mb-2",children:e.jsx(F,{className:"h-5 w-5 text-amber-600"})}),e.jsx(C,{className:"text-base",children:s("tools.distance.generalCargo","Генеральный груз")}),e.jsx(M,{className:"text-xs",children:s("tools.distance.bulkSpeed","Скорость 15 км/ч · bulk / general cargo")})]}),e.jsxs(u,{children:[e.jsxs("div",{className:"flex items-end gap-1.5",children:[e.jsx(E,{className:"h-4 w-4 text-text-muted mb-1"}),e.jsx("p",{className:"text-2xl font-bold tabular-nums",children:$(m.bulkHours,s)})]}),e.jsx(l,{variant:"muted",className:"text-xs mt-1",children:s("tools.distance.portStayNote","в т.ч. стоянка в портах: {{hours}} ч.",{hours:h(f)+h(y)})})]})]})]}),e.jsxs("div",{className:"flex items-start gap-2 text-sm text-text-muted bg-surface border border-border rounded-lg px-4 py-3",children:[e.jsx(K,{className:"h-4 w-4 shrink-0 mt-0.5"}),e.jsxs("span",{children:[e.jsx("span",{className:"font-medium text-text",children:s("tools.distance.accuracyLabel","Точность ±15%.")})," ",s("tools.distance.accuracyNote","Расчёт основан на ортодромическом расстоянии с коэффициентом морского маршрута. Реальный transit-time зависит от линии, загрузки в портах, погодных условий и наличия транзитных перевалок.")]})]})]})]})})}),e.jsx(S,{py:"lg",bg:"surface",children:e.jsx(w,{size:"base",children:e.jsxs(c,{gap:6,children:[e.jsxs(c,{gap:2,className:"text-center max-w-xl mx-auto",children:[e.jsx(J,{size:"h3",children:s("tools.distance.popularRoutesTitle","Популярные маршруты")}),e.jsx(l,{variant:"muted",children:s("tools.distance.popularRoutesDesc","Нажмите на маршрут, чтобы быстро заполнить форму")})]}),e.jsx("div",{className:"flex flex-wrap gap-3 justify-center max-w-2xl mx-auto",children:he.map(t=>e.jsxs(v,{variant:"outline",size:"sm",onClick:()=>Y(t),className:"gap-1.5",children:[e.jsx(R,{className:"h-3.5 w-3.5 text-primary"}),s(`tools.distance.preset.${t.from}_${t.to}`,t.label)]},`${t.from}-${t.to}`))})]})})}),e.jsx(S,{py:"lg",children:e.jsx(w,{size:"base",children:e.jsxs(c,{gap:6,children:[e.jsxs(c,{gap:2,className:"text-center max-w-xl mx-auto",children:[e.jsx(J,{size:"h3",children:s("tools.distance.howItWorksTitle","Как работает расчёт")}),e.jsx(l,{variant:"muted",children:s("tools.distance.howItWorksDesc","Открытая методология — никаких чёрных ящиков")})]}),e.jsxs(_,{cols:3,gap:4,className:"max-w-3xl mx-auto",children:[e.jsx(x,{children:e.jsx(u,{className:"pt-6",children:e.jsxs(c,{gap:2,children:[e.jsx("div",{className:"h-8 w-8 rounded-lg bg-primary-light flex items-center justify-center",children:e.jsx(T,{className:"h-4 w-4 text-primary"})}),e.jsx(l,{weight:"semibold",children:s("tools.distance.haversineTitle","Гаверсинус")}),e.jsx(l,{variant:"muted",className:"text-sm",children:s("tools.distance.haversineDesc","Ортодромическое расстояние по сфере Земли между координатами портов.")})]})})}),e.jsx(x,{children:e.jsx(u,{className:"pt-6",children:e.jsxs(c,{gap:2,children:[e.jsx("div",{className:"h-8 w-8 rounded-lg bg-primary-light flex items-center justify-center",children:e.jsx(R,{className:"h-4 w-4 text-primary"})}),e.jsx(l,{weight:"semibold",children:s("tools.distance.factorTitle","Коэффициент ×1,25")}),e.jsx(l,{variant:"muted",className:"text-sm",children:s("tools.distance.factorDesc","Морской маршрут длиннее прямой линии — учитываются проливы, мысы и каналы.")})]})})}),e.jsx(x,{children:e.jsx(u,{className:"pt-6",children:e.jsxs(c,{gap:2,children:[e.jsx("div",{className:"h-8 w-8 rounded-lg bg-primary-light flex items-center justify-center",children:e.jsx(E,{className:"h-4 w-4 text-primary"})}),e.jsx(l,{weight:"semibold",children:s("tools.distance.portStayTitle","Стоянка в порту")}),e.jsx(l,{variant:"muted",className:"text-sm",children:s("tools.distance.portStayDesc","Для портов Европы и Америк +48 ч., для Азии +36 ч. на обработку в каждом порту.")})]})})})]})]})})}),e.jsx(ie,{})]})}export{Ge as default};