@travel-match/ui 0.5.1 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (282) hide show
  1. package/README.md +26 -0
  2. package/dist/components/ArmeniaRouteMap/ArmeniaRouteMap.cjs +2 -0
  3. package/dist/components/ArmeniaRouteMap/ArmeniaRouteMap.cjs.map +1 -0
  4. package/dist/components/ArmeniaRouteMap/ArmeniaRouteMap.js +106 -0
  5. package/dist/components/ArmeniaRouteMap/ArmeniaRouteMap.js.map +1 -0
  6. package/dist/components/ArmeniaRouteMap/regionNames.cjs +2 -0
  7. package/dist/components/ArmeniaRouteMap/regionNames.cjs.map +1 -0
  8. package/dist/components/ArmeniaRouteMap/regionNames.js +49 -0
  9. package/dist/components/ArmeniaRouteMap/regionNames.js.map +1 -0
  10. package/dist/components/GlobeMap/GlobeMap.cjs +2 -0
  11. package/dist/components/GlobeMap/GlobeMap.cjs.map +1 -0
  12. package/dist/components/GlobeMap/GlobeMap.js +202 -0
  13. package/dist/components/GlobeMap/GlobeMap.js.map +1 -0
  14. package/dist/components/GlobeMap/geo.cjs +2 -0
  15. package/dist/components/GlobeMap/geo.cjs.map +1 -0
  16. package/dist/components/GlobeMap/geo.js +150 -0
  17. package/dist/components/GlobeMap/geo.js.map +1 -0
  18. package/dist/components/GlobeMap/world.json.cjs +2 -0
  19. package/dist/components/GlobeMap/world.json.cjs.map +1 -0
  20. package/dist/components/GlobeMap/world.json.js +28990 -0
  21. package/dist/components/GlobeMap/world.json.js.map +1 -0
  22. package/dist/countries/ad.webp +0 -0
  23. package/dist/countries/ae.webp +0 -0
  24. package/dist/countries/af.webp +0 -0
  25. package/dist/countries/al.webp +0 -0
  26. package/dist/countries/am.webp +0 -0
  27. package/dist/countries/at.webp +0 -0
  28. package/dist/countries/az.webp +0 -0
  29. package/dist/countries/ba.webp +0 -0
  30. package/dist/countries/bd.webp +0 -0
  31. package/dist/countries/be.webp +0 -0
  32. package/dist/countries/bg.webp +0 -0
  33. package/dist/countries/bn.webp +0 -0
  34. package/dist/countries/bt.webp +0 -0
  35. package/dist/countries/by.webp +0 -0
  36. package/dist/countries/ch.webp +0 -0
  37. package/dist/countries/cn.webp +0 -0
  38. package/dist/countries/cy.webp +0 -0
  39. package/dist/countries/cz.webp +0 -0
  40. package/dist/countries/de.webp +0 -0
  41. package/dist/countries/dk.webp +0 -0
  42. package/dist/countries/ee.webp +0 -0
  43. package/dist/countries/es.webp +0 -0
  44. package/dist/countries/fi.webp +0 -0
  45. package/dist/countries/fr.webp +0 -0
  46. package/dist/countries/gb.webp +0 -0
  47. package/dist/countries/ge.webp +0 -0
  48. package/dist/countries/gr.webp +0 -0
  49. package/dist/countries/hr.webp +0 -0
  50. package/dist/countries/hu.webp +0 -0
  51. package/dist/countries/id.webp +0 -0
  52. package/dist/countries/ie.webp +0 -0
  53. package/dist/countries/il.webp +0 -0
  54. package/dist/countries/in.webp +0 -0
  55. package/dist/countries/iq.webp +0 -0
  56. package/dist/countries/ir.webp +0 -0
  57. package/dist/countries/is.webp +0 -0
  58. package/dist/countries/it.webp +0 -0
  59. package/dist/countries/jo.webp +0 -0
  60. package/dist/countries/jp.webp +0 -0
  61. package/dist/countries/kg.webp +0 -0
  62. package/dist/countries/kh.webp +0 -0
  63. package/dist/countries/kp.webp +0 -0
  64. package/dist/countries/kr.webp +0 -0
  65. package/dist/countries/kz.webp +0 -0
  66. package/dist/countries/la.webp +0 -0
  67. package/dist/countries/lb.webp +0 -0
  68. package/dist/countries/li.webp +0 -0
  69. package/dist/countries/lk.webp +0 -0
  70. package/dist/countries/lt.webp +0 -0
  71. package/dist/countries/lu.webp +0 -0
  72. package/dist/countries/lv.webp +0 -0
  73. package/dist/countries/mc.webp +0 -0
  74. package/dist/countries/md.webp +0 -0
  75. package/dist/countries/me.webp +0 -0
  76. package/dist/countries/mk.webp +0 -0
  77. package/dist/countries/mm.webp +0 -0
  78. package/dist/countries/mn.webp +0 -0
  79. package/dist/countries/mt.webp +0 -0
  80. package/dist/countries/mv.webp +0 -0
  81. package/dist/countries/my.webp +0 -0
  82. package/dist/countries/nl.webp +0 -0
  83. package/dist/countries/no.webp +0 -0
  84. package/dist/countries/np.webp +0 -0
  85. package/dist/countries/om.webp +0 -0
  86. package/dist/countries/ph.webp +0 -0
  87. package/dist/countries/pk.webp +0 -0
  88. package/dist/countries/pl.webp +0 -0
  89. package/dist/countries/ps.webp +0 -0
  90. package/dist/countries/pt.webp +0 -0
  91. package/dist/countries/ro.webp +0 -0
  92. package/dist/countries/rs.webp +0 -0
  93. package/dist/countries/ru.webp +0 -0
  94. package/dist/countries/sa.webp +0 -0
  95. package/dist/countries/se.webp +0 -0
  96. package/dist/countries/sg.webp +0 -0
  97. package/dist/countries/si.webp +0 -0
  98. package/dist/countries/sk.webp +0 -0
  99. package/dist/countries/sm.webp +0 -0
  100. package/dist/countries/th.webp +0 -0
  101. package/dist/countries/tj.webp +0 -0
  102. package/dist/countries/tl.webp +0 -0
  103. package/dist/countries/tm.webp +0 -0
  104. package/dist/countries/tr.webp +0 -0
  105. package/dist/countries/tw.webp +0 -0
  106. package/dist/countries/ua.webp +0 -0
  107. package/dist/countries/us.webp +0 -0
  108. package/dist/countries/uz.webp +0 -0
  109. package/dist/countries/va.webp +0 -0
  110. package/dist/countries/vn.webp +0 -0
  111. package/dist/countries.cjs +2 -0
  112. package/dist/countries.cjs.map +1 -0
  113. package/dist/countries.d.cts +101 -0
  114. package/dist/countries.d.ts +101 -0
  115. package/dist/countries.js +9 -0
  116. package/dist/countries.js.map +1 -0
  117. package/dist/index.cjs +1 -1
  118. package/dist/index.d.cts +80 -0
  119. package/dist/index.d.ts +80 -0
  120. package/dist/index.js +34 -31
  121. package/dist/node_modules/d3-array/dist/d3-array.cjs +2 -0
  122. package/dist/node_modules/d3-array/dist/d3-array.cjs.map +1 -0
  123. package/dist/node_modules/d3-array/dist/d3-array.js +90 -0
  124. package/dist/node_modules/d3-array/dist/d3-array.js.map +1 -0
  125. package/dist/node_modules/d3-geo/src/area.cjs +2 -0
  126. package/dist/node_modules/d3-geo/src/area.cjs.map +1 -0
  127. package/dist/node_modules/d3-geo/src/area.js +41 -0
  128. package/dist/node_modules/d3-geo/src/area.js.map +1 -0
  129. package/dist/node_modules/d3-geo/src/cartesian.cjs +2 -0
  130. package/dist/node_modules/d3-geo/src/cartesian.cjs.map +1 -0
  131. package/dist/node_modules/d3-geo/src/cartesian.js +41 -0
  132. package/dist/node_modules/d3-geo/src/cartesian.js.map +1 -0
  133. package/dist/node_modules/d3-geo/src/centroid.cjs +2 -0
  134. package/dist/node_modules/d3-geo/src/centroid.cjs.map +1 -0
  135. package/dist/node_modules/d3-geo/src/centroid.js +66 -0
  136. package/dist/node_modules/d3-geo/src/centroid.js.map +1 -0
  137. package/dist/node_modules/d3-geo/src/circle.cjs +2 -0
  138. package/dist/node_modules/d3-geo/src/circle.cjs.map +1 -0
  139. package/dist/node_modules/d3-geo/src/circle.js +23 -0
  140. package/dist/node_modules/d3-geo/src/circle.js.map +1 -0
  141. package/dist/node_modules/d3-geo/src/clip/antimeridian.cjs +2 -0
  142. package/dist/node_modules/d3-geo/src/clip/antimeridian.cjs.map +1 -0
  143. package/dist/node_modules/d3-geo/src/clip/antimeridian.js +40 -0
  144. package/dist/node_modules/d3-geo/src/clip/antimeridian.js.map +1 -0
  145. package/dist/node_modules/d3-geo/src/clip/buffer.cjs +2 -0
  146. package/dist/node_modules/d3-geo/src/clip/buffer.cjs.map +1 -0
  147. package/dist/node_modules/d3-geo/src/clip/buffer.js +29 -0
  148. package/dist/node_modules/d3-geo/src/clip/buffer.js.map +1 -0
  149. package/dist/node_modules/d3-geo/src/clip/circle.cjs +2 -0
  150. package/dist/node_modules/d3-geo/src/clip/circle.cjs.map +1 -0
  151. package/dist/node_modules/d3-geo/src/clip/circle.js +69 -0
  152. package/dist/node_modules/d3-geo/src/clip/circle.js.map +1 -0
  153. package/dist/node_modules/d3-geo/src/clip/index.cjs +2 -0
  154. package/dist/node_modules/d3-geo/src/clip/index.cjs.map +1 -0
  155. package/dist/node_modules/d3-geo/src/clip/index.js +67 -0
  156. package/dist/node_modules/d3-geo/src/clip/index.js.map +1 -0
  157. package/dist/node_modules/d3-geo/src/clip/line.cjs +2 -0
  158. package/dist/node_modules/d3-geo/src/clip/line.cjs.map +1 -0
  159. package/dist/node_modules/d3-geo/src/clip/line.js +45 -0
  160. package/dist/node_modules/d3-geo/src/clip/line.js.map +1 -0
  161. package/dist/node_modules/d3-geo/src/clip/rectangle.cjs +2 -0
  162. package/dist/node_modules/d3-geo/src/clip/rectangle.cjs.map +1 -0
  163. package/dist/node_modules/d3-geo/src/clip/rectangle.js +73 -0
  164. package/dist/node_modules/d3-geo/src/clip/rectangle.js.map +1 -0
  165. package/dist/node_modules/d3-geo/src/clip/rejoin.cjs +2 -0
  166. package/dist/node_modules/d3-geo/src/clip/rejoin.cjs.map +1 -0
  167. package/dist/node_modules/d3-geo/src/clip/rejoin.js +52 -0
  168. package/dist/node_modules/d3-geo/src/clip/rejoin.js.map +1 -0
  169. package/dist/node_modules/d3-geo/src/compose.cjs +2 -0
  170. package/dist/node_modules/d3-geo/src/compose.cjs.map +1 -0
  171. package/dist/node_modules/d3-geo/src/compose.js +13 -0
  172. package/dist/node_modules/d3-geo/src/compose.js.map +1 -0
  173. package/dist/node_modules/d3-geo/src/distance.cjs +2 -0
  174. package/dist/node_modules/d3-geo/src/distance.cjs.map +1 -0
  175. package/dist/node_modules/d3-geo/src/distance.js +13 -0
  176. package/dist/node_modules/d3-geo/src/distance.js.map +1 -0
  177. package/dist/node_modules/d3-geo/src/identity.cjs +2 -0
  178. package/dist/node_modules/d3-geo/src/identity.cjs.map +1 -0
  179. package/dist/node_modules/d3-geo/src/identity.js +6 -0
  180. package/dist/node_modules/d3-geo/src/identity.js.map +1 -0
  181. package/dist/node_modules/d3-geo/src/interpolate.cjs +2 -0
  182. package/dist/node_modules/d3-geo/src/interpolate.cjs.map +1 -0
  183. package/dist/node_modules/d3-geo/src/interpolate.js +15 -0
  184. package/dist/node_modules/d3-geo/src/interpolate.js.map +1 -0
  185. package/dist/node_modules/d3-geo/src/length.cjs +2 -0
  186. package/dist/node_modules/d3-geo/src/length.cjs.map +1 -0
  187. package/dist/node_modules/d3-geo/src/length.js +34 -0
  188. package/dist/node_modules/d3-geo/src/length.js.map +1 -0
  189. package/dist/node_modules/d3-geo/src/math.cjs +2 -0
  190. package/dist/node_modules/d3-geo/src/math.cjs.map +1 -0
  191. package/dist/node_modules/d3-geo/src/math.js +17 -0
  192. package/dist/node_modules/d3-geo/src/math.js.map +1 -0
  193. package/dist/node_modules/d3-geo/src/noop.cjs +2 -0
  194. package/dist/node_modules/d3-geo/src/noop.cjs.map +1 -0
  195. package/dist/node_modules/d3-geo/src/noop.js +6 -0
  196. package/dist/node_modules/d3-geo/src/noop.js.map +1 -0
  197. package/dist/node_modules/d3-geo/src/path/area.cjs +2 -0
  198. package/dist/node_modules/d3-geo/src/path/area.cjs.map +1 -0
  199. package/dist/node_modules/d3-geo/src/path/area.js +35 -0
  200. package/dist/node_modules/d3-geo/src/path/area.js.map +1 -0
  201. package/dist/node_modules/d3-geo/src/path/bounds.cjs +2 -0
  202. package/dist/node_modules/d3-geo/src/path/bounds.cjs.map +1 -0
  203. package/dist/node_modules/d3-geo/src/path/bounds.js +20 -0
  204. package/dist/node_modules/d3-geo/src/path/bounds.js.map +1 -0
  205. package/dist/node_modules/d3-geo/src/path/centroid.cjs +2 -0
  206. package/dist/node_modules/d3-geo/src/path/centroid.cjs.map +1 -0
  207. package/dist/node_modules/d3-geo/src/path/centroid.js +50 -0
  208. package/dist/node_modules/d3-geo/src/path/centroid.js.map +1 -0
  209. package/dist/node_modules/d3-geo/src/path/context.cjs +2 -0
  210. package/dist/node_modules/d3-geo/src/path/context.cjs.map +1 -0
  211. package/dist/node_modules/d3-geo/src/path/context.js +40 -0
  212. package/dist/node_modules/d3-geo/src/path/context.js.map +1 -0
  213. package/dist/node_modules/d3-geo/src/path/index.cjs +2 -0
  214. package/dist/node_modules/d3-geo/src/path/index.cjs.map +1 -0
  215. package/dist/node_modules/d3-geo/src/path/index.js +43 -0
  216. package/dist/node_modules/d3-geo/src/path/index.js.map +1 -0
  217. package/dist/node_modules/d3-geo/src/path/measure.cjs +2 -0
  218. package/dist/node_modules/d3-geo/src/path/measure.cjs.map +1 -0
  219. package/dist/node_modules/d3-geo/src/path/measure.js +33 -0
  220. package/dist/node_modules/d3-geo/src/path/measure.js.map +1 -0
  221. package/dist/node_modules/d3-geo/src/path/string.cjs +2 -0
  222. package/dist/node_modules/d3-geo/src/path/string.cjs.map +1 -0
  223. package/dist/node_modules/d3-geo/src/path/string.js +64 -0
  224. package/dist/node_modules/d3-geo/src/path/string.js.map +1 -0
  225. package/dist/node_modules/d3-geo/src/pointEqual.cjs +2 -0
  226. package/dist/node_modules/d3-geo/src/pointEqual.cjs.map +1 -0
  227. package/dist/node_modules/d3-geo/src/pointEqual.js +9 -0
  228. package/dist/node_modules/d3-geo/src/pointEqual.js.map +1 -0
  229. package/dist/node_modules/d3-geo/src/polygonContains.cjs +2 -0
  230. package/dist/node_modules/d3-geo/src/polygonContains.cjs.map +1 -0
  231. package/dist/node_modules/d3-geo/src/polygonContains.js +31 -0
  232. package/dist/node_modules/d3-geo/src/polygonContains.js.map +1 -0
  233. package/dist/node_modules/d3-geo/src/projection/azimuthal.cjs +2 -0
  234. package/dist/node_modules/d3-geo/src/projection/azimuthal.cjs.map +1 -0
  235. package/dist/node_modules/d3-geo/src/projection/azimuthal.js +12 -0
  236. package/dist/node_modules/d3-geo/src/projection/azimuthal.js.map +1 -0
  237. package/dist/node_modules/d3-geo/src/projection/fit.cjs +2 -0
  238. package/dist/node_modules/d3-geo/src/projection/fit.cjs.map +1 -0
  239. package/dist/node_modules/d3-geo/src/projection/fit.js +32 -0
  240. package/dist/node_modules/d3-geo/src/projection/fit.js.map +1 -0
  241. package/dist/node_modules/d3-geo/src/projection/index.cjs +2 -0
  242. package/dist/node_modules/d3-geo/src/projection/index.cjs.map +1 -0
  243. package/dist/node_modules/d3-geo/src/projection/index.js +105 -0
  244. package/dist/node_modules/d3-geo/src/projection/index.js.map +1 -0
  245. package/dist/node_modules/d3-geo/src/projection/orthographic.cjs +2 -0
  246. package/dist/node_modules/d3-geo/src/projection/orthographic.cjs.map +1 -0
  247. package/dist/node_modules/d3-geo/src/projection/orthographic.js +15 -0
  248. package/dist/node_modules/d3-geo/src/projection/orthographic.js.map +1 -0
  249. package/dist/node_modules/d3-geo/src/projection/resample.cjs +2 -0
  250. package/dist/node_modules/d3-geo/src/projection/resample.cjs.map +1 -0
  251. package/dist/node_modules/d3-geo/src/projection/resample.js +62 -0
  252. package/dist/node_modules/d3-geo/src/projection/resample.js.map +1 -0
  253. package/dist/node_modules/d3-geo/src/rotation.cjs +2 -0
  254. package/dist/node_modules/d3-geo/src/rotation.cjs.map +1 -0
  255. package/dist/node_modules/d3-geo/src/rotation.js +34 -0
  256. package/dist/node_modules/d3-geo/src/rotation.js.map +1 -0
  257. package/dist/node_modules/d3-geo/src/stream.cjs +2 -0
  258. package/dist/node_modules/d3-geo/src/stream.cjs.map +1 -0
  259. package/dist/node_modules/d3-geo/src/stream.js +54 -0
  260. package/dist/node_modules/d3-geo/src/stream.js.map +1 -0
  261. package/dist/node_modules/d3-geo/src/transform.cjs +2 -0
  262. package/dist/node_modules/d3-geo/src/transform.cjs.map +1 -0
  263. package/dist/node_modules/d3-geo/src/transform.js +34 -0
  264. package/dist/node_modules/d3-geo/src/transform.js.map +1 -0
  265. package/dist/node_modules/topojson-client/src/feature.cjs +2 -0
  266. package/dist/node_modules/topojson-client/src/feature.cjs.map +1 -0
  267. package/dist/node_modules/topojson-client/src/feature.js +89 -0
  268. package/dist/node_modules/topojson-client/src/feature.js.map +1 -0
  269. package/dist/node_modules/topojson-client/src/identity.cjs +2 -0
  270. package/dist/node_modules/topojson-client/src/identity.cjs.map +1 -0
  271. package/dist/node_modules/topojson-client/src/identity.js +8 -0
  272. package/dist/node_modules/topojson-client/src/identity.js.map +1 -0
  273. package/dist/node_modules/topojson-client/src/reverse.cjs +2 -0
  274. package/dist/node_modules/topojson-client/src/reverse.cjs.map +1 -0
  275. package/dist/node_modules/topojson-client/src/reverse.js +8 -0
  276. package/dist/node_modules/topojson-client/src/reverse.js.map +1 -0
  277. package/dist/node_modules/topojson-client/src/transform.cjs +2 -0
  278. package/dist/node_modules/topojson-client/src/transform.cjs.map +1 -0
  279. package/dist/node_modules/topojson-client/src/transform.js +16 -0
  280. package/dist/node_modules/topojson-client/src/transform.js.map +1 -0
  281. package/dist/styles.css +1 -1
  282. package/package.json +22 -2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geo.cjs","names":["feature","geoArea","geoCentroid","geoDistance","geoOrthographic","geoInterpolate","require_area","require_centroid","require_distance","require_interpolate","require_orthographic","require_feature","worldPromise","loadWorld","buildWorld","module","features","topology","largest","shape","polygons","coordinates","polygon","area","code","anchor","EARTH_KM","placeKey","country","place","placePoint","world","samePlace","a","b","pa","pb","HOME_VIEW","PLACE_RADIUS","MIN_RADIUS","fitView","points","centre","lon","lat","unit","projected","point","xs","x","ys","y","minX","maxX","minY","maxY","r","interpolateView","rotate","t","projectionFor","view","isFacing","BOW","f","n","lerp","routeArc","dx","p1","p0","dy","c","arcAt","arcPathTo","arc","end","DRAW_MS","PAUSE_MS","FLY_MS","FADE","easeInOutSine","legFrame","local","elapsed","index","p","loop","q","drawnAfter","legs"],"sources":["../../../src/components/GlobeMap/geo.ts"],"sourcesContent":["import { geoArea, geoCentroid, geoDistance, geoInterpolate, geoOrthographic, type GeoProjection } from 'd3-geo';\nimport type { Feature, MultiPolygon, Polygon, Position } from 'geojson';\nimport { feature } from 'topojson-client';\nimport type { GeometryCollection, Topology } from 'topojson-specification';\n\n/** [longitude, latitude] in degrees. */\nexport type LonLat = readonly [number, number];\n\n/** A country picked as a whole: its shape is filled and the pin sits in its middle. */\nexport interface GlobeCountryPlace {\n kind: 'country';\n /** ISO 3166-1 alpha-2, e.g. `\"FR\"`. */\n countryCode: string;\n /** Label text; defaults to the country name in `locale`. */\n label?: string;\n}\n\n/** A city or an airport: its country is filled and the pin sits on its coordinates. */\nexport interface GlobePointPlace {\n kind: 'city' | 'airport';\n /** ISO 3166-1 alpha-2 of the country it is in, e.g. `\"FR\"`. */\n countryCode: string;\n /** From the airport data (`latitude` / `longitude` of the reference-data airports). Without them the pin sits in the middle of the country. */\n latitude?: number;\n longitude?: number;\n /** IATA code of an airport, e.g. `\"CDG\"`; identifies the place when it comes back later in the route. */\n code?: string;\n /** Label text, e.g. the city name `\"Paris\"`. Defaults to `code`, then the country name. */\n label?: string;\n}\n\nexport type GlobePlace = GlobeCountryPlace | GlobePointPlace;\n\n/** One leg of the trip, drawn as a dotted arc from `from` to `to`. */\nexport interface GlobeSegment {\n from: GlobePlace;\n to: GlobePlace;\n}\n\n/* ── World data ───────────────────────────────────────────────────────── */\n\nexport interface World {\n /** Every country shape; `id` is the ISO alpha-2 code (null for a few disputed or uninhabited areas). */\n features: Feature<Polygon | MultiPolygon>[];\n /** Pin position for a whole country: the centroid of its largest outline (mainland France, not French Guiana). */\n anchors: Map<string, LonLat>;\n /** Country names per language (`en`, `hy`, `ru`), keyed by alpha-2 code. */\n names: Readonly<Record<string, Readonly<Record<string, string>>>>;\n}\n\nlet worldPromise: Promise<World> | null = null;\n\n/** Loads the country shapes once (a separate chunk, ~100 KB gzipped) the first time a globe is shown. */\nexport function loadWorld(): Promise<World> {\n worldPromise ??= import('./world.json').then((module) => buildWorld(module.default as unknown as Topology & { names: World['names'] }));\n return worldPromise;\n}\n\nexport function buildWorld(topology: Topology & { names?: World['names'] }): World {\n const collection = feature(topology, topology.objects.countries as GeometryCollection);\n const features = collection.features as Feature<Polygon | MultiPolygon>[];\n const largest = new Map<string, { area: number; anchor: LonLat }>();\n for (const shape of features) {\n if (typeof shape.id !== 'string') continue;\n const polygons: Position[][][] = shape.geometry.type === 'Polygon' ? [shape.geometry.coordinates] : shape.geometry.coordinates;\n for (const coordinates of polygons) {\n const polygon: Polygon = { type: 'Polygon', coordinates };\n const area = geoArea(polygon);\n if (area >= (largest.get(shape.id)?.area ?? 0)) largest.set(shape.id, { area, anchor: geoCentroid(polygon) as unknown as LonLat });\n }\n }\n return { features, anchors: new Map([...largest].map(([code, { anchor }]) => [code, anchor])), names: topology.names ?? {} };\n}\n\n/* ── Places ───────────────────────────────────────────────────────────── */\n\nexport interface ResolvedPlace {\n key: string;\n place: GlobePlace;\n countryCode: string;\n point: LonLat | null;\n}\n\nconst EARTH_KM = 6371;\n\nexport function placeKey(place: GlobePlace): string {\n const country = place.countryCode.trim().toUpperCase();\n if (place.kind === 'country') return `country:${country}`;\n if (place.code) return `airport:${place.code.trim().toUpperCase()}`;\n if (place.latitude != null && place.longitude != null) return `point:${place.latitude.toFixed(3)},${place.longitude.toFixed(3)}`;\n return `city:${country}:${(place.label ?? '').trim().toLowerCase()}`;\n}\n\nexport function placePoint(place: GlobePlace, world: World | null): LonLat | null {\n if (place.kind !== 'country' && place.latitude != null && place.longitude != null) return [place.longitude, place.latitude];\n return world?.anchors.get(place.countryCode.trim().toUpperCase()) ?? null;\n}\n\n/** Whether two places are the same stop: same airport code, same country pick, or points within 50 km in one country. */\nexport function samePlace(a: GlobePlace, b: GlobePlace): boolean {\n if (placeKey(a) === placeKey(b)) return true;\n if (a.kind === 'country' || b.kind === 'country') return false;\n if (a.countryCode.trim().toUpperCase() !== b.countryCode.trim().toUpperCase()) return false;\n const pa = placePoint(a, null);\n const pb = placePoint(b, null);\n if (pa && pb) return geoDistance(pa as [number, number], pb as [number, number]) * EARTH_KM < 50;\n return !!a.label && !!b.label && a.label.trim().toLowerCase() === b.label.trim().toLowerCase();\n}\n\n/* ── View ─────────────────────────────────────────────────────────────── */\n\n/** Figma \"Map area\": 390×255. Everything is laid out in these units and scaled to the real width. */\nexport const FRAME_WIDTH = 390;\nexport const FRAME_HEIGHT = 255;\n\n/** Rotation centre (degrees), globe radius and globe centre, in frame units. */\nexport interface GlobeView {\n lon: number;\n lat: number;\n r: number;\n x: number;\n y: number;\n}\n\n/** Figma \"Map / Globe\" in the empty map (2966:17945): 235.8 px across, centred, facing 30°E 38°N. */\nexport const HOME_VIEW: GlobeView = { lon: 30, lat: 38, r: 117.9, x: FRAME_WIDTH / 2, y: FRAME_HEIGHT / 2 };\n\n/** Figma 2966:18002 (only the departure chosen): the globe at 2160 px, the departure in the middle. */\nexport const PLACE_RADIUS = 1080;\n\n/* Room kept around the pins for labels (below the pins) and the route arcs. */\nconst PAD_X = 80;\nconst PAD_TOP = 48;\nconst PAD_BOTTOM = 52;\nconst MIN_RADIUS = 90;\n\n/** The view that shows every point: rotated to their middle and zoomed in as far as the frame allows. */\nexport function fitView(points: readonly LonLat[]): GlobeView {\n if (points.length === 0) return HOME_VIEW;\n const centre = points.length === 1 ? points[0] : (geoCentroid({ type: 'MultiPoint', coordinates: points as unknown as Position[] }) as unknown as LonLat);\n const [lon, lat] = Number.isFinite(centre[0]) && Number.isFinite(centre[1]) ? centre : points[0];\n const unit = geoOrthographic().rotate([-lon, -lat]).scale(1).translate([0, 0]);\n const projected = points.map((point) => unit(point as [number, number]) ?? [0, 0]);\n const xs = projected.map(([x]) => x);\n const ys = projected.map(([, y]) => y);\n const [minX, maxX, minY, maxY] = [Math.min(...xs), Math.max(...xs), Math.min(...ys), Math.max(...ys)];\n const width = FRAME_WIDTH - 2 * PAD_X;\n const height = FRAME_HEIGHT - PAD_TOP - PAD_BOTTOM;\n const r = Math.max(MIN_RADIUS, Math.min(PLACE_RADIUS, width / Math.max(maxX - minX, 1e-6), height / Math.max(maxY - minY, 1e-6)));\n return {\n lon,\n lat,\n r,\n x: FRAME_WIDTH / 2 - r * ((minX + maxX) / 2),\n y: PAD_TOP + height / 2 - r * ((minY + maxY) / 2),\n };\n}\n\n/** Rotates along the great circle between the two centres and zooms geometrically, so the motion feels even. */\nexport function interpolateView(a: GlobeView, b: GlobeView): (t: number) => GlobeView {\n const rotate = geoInterpolate([a.lon, a.lat], [b.lon, b.lat]);\n return (t) => {\n const [lon, lat] = rotate(t);\n return { lon, lat, r: a.r * Math.pow(b.r / a.r, t), x: a.x + (b.x - a.x) * t, y: a.y + (b.y - a.y) * t };\n };\n}\n\nexport function projectionFor(view: GlobeView): GeoProjection {\n return geoOrthographic()\n .rotate([-view.lon, -view.lat])\n .scale(view.r)\n .translate([view.x, view.y])\n .clipAngle(90)\n .clipExtent([\n [-2, -2],\n [FRAME_WIDTH + 2, FRAME_HEIGHT + 2],\n ])\n .precision(0.4);\n}\n\n/** Whether a point is on the side of the globe facing the viewer. */\nexport function isFacing(point: LonLat, view: GlobeView): boolean {\n return geoDistance(point as [number, number], [view.lon, view.lat]) < Math.PI / 2 - 0.01;\n}\n\n/* ── Routes ───────────────────────────────────────────────────────────── */\n\n/** Figma routes bow to the right of the direction of travel (west → over the top, east → underneath) by 12% of their length. */\nconst BOW = 0.12;\n\ntype XY = readonly [number, number];\n\nexport interface RouteArc {\n /** The whole arc as an SVG path. */\n d: string;\n /** Start, control point and end of the quadratic curve. */\n p0: XY;\n c: XY;\n p1: XY;\n /** Middle of the arc and the direction of travel there, in degrees (0 = east, 90 = south): the Figma plane spot. */\n mid: XY;\n angle: number;\n}\n\nconst f = (n: number) => n.toFixed(2);\nconst lerp = (a: XY, b: XY, t: number): XY => [a[0] + (b[0] - a[0]) * t, a[1] + (b[1] - a[1]) * t];\n\nexport function routeArc(p0: XY, p1: XY): RouteArc {\n const dx = p1[0] - p0[0];\n const dy = p1[1] - p0[1];\n // Control point: the chord's middle pushed along its right-hand normal (-dy, dx) by twice the bow.\n const c: XY = [(p0[0] + p1[0]) / 2 - dy * BOW * 2, (p0[1] + p1[1]) / 2 + dx * BOW * 2];\n return {\n d: `M${f(p0[0])} ${f(p0[1])}Q${f(c[0])} ${f(c[1])} ${f(p1[0])} ${f(p1[1])}`,\n p0,\n c,\n p1,\n mid: [(p0[0] + p1[0]) / 2 - dy * BOW, (p0[1] + p1[1]) / 2 + dx * BOW],\n angle: (Math.atan2(dy, dx) * 180) / Math.PI,\n };\n}\n\n/** Point on the arc at `t` (0…1) and the direction of travel there, in degrees. */\nexport function arcAt({ p0, c, p1 }: RouteArc, t: number): { at: XY; angle: number } {\n const a = lerp(p0, c, t);\n const b = lerp(c, p1, t);\n return { at: lerp(a, b, t), angle: (Math.atan2(b[1] - a[1], b[0] - a[0]) * 180) / Math.PI };\n}\n\n/** The first part of the arc, from the start to `t` (0…1), as an SVG path. */\nexport function arcPathTo(arc: RouteArc, t: number): string {\n if (t >= 1) return arc.d;\n const a = lerp(arc.p0, arc.c, t);\n const end = arcAt(arc, t).at;\n return `M${f(arc.p0[0])} ${f(arc.p0[1])}Q${f(a[0])} ${f(a[1])} ${f(end[0])} ${f(end[1])}`;\n}\n\n/* ── Flight animation ─────────────────────────────────────────────────── */\n\n/** Each leg draws itself in this long, with its plane at the tip; legs start one after another. */\nexport const DRAW_MS = 1100;\nexport const STAGGER_MS = 500;\n/** Then the plane keeps flying the leg: a pause on the ground, then the flight. */\nexport const PAUSE_MS = 1400;\nexport const FLY_MS = 3200;\n/** Part of a flight over which the plane fades in after take-off and out before landing. */\nconst FADE = 0.12;\n\nconst easeInOutSine = (t: number) => -(Math.cos(Math.PI * t) - 1) / 2;\n\nexport interface LegFrame {\n /** How much of the route is drawn, 0…1. */\n drawn: number;\n /** Where the plane is on the arc, 0…1, or null when it is on the ground (hidden). */\n plane: number | null;\n opacity: number;\n}\n\n/** Where leg `index` is, `elapsed` ms after the globe stopped. */\nexport function legFrame(index: number, elapsed: number): LegFrame {\n const local = elapsed - index * STAGGER_MS;\n if (local <= 0) return { drawn: 0, plane: null, opacity: 0 };\n if (local < DRAW_MS) {\n const p = easeInOutSine(local / DRAW_MS);\n return { drawn: p, plane: p, opacity: Math.min(1, p / FADE, (1 - p) / FADE) };\n }\n const loop = (local - DRAW_MS) % (PAUSE_MS + FLY_MS);\n if (loop < PAUSE_MS) return { drawn: 1, plane: null, opacity: 0 };\n const q = easeInOutSine((loop - PAUSE_MS) / FLY_MS);\n return { drawn: 1, plane: q, opacity: Math.min(1, q / FADE, (1 - q) / FADE) };\n}\n\n/** Time until every route is drawn, for maps without planes. */\nexport const drawnAfter = (legs: number) => (legs - 1) * STAGGER_MS + DRAW_MS;\n"],"mappings":"A,yXAkDA,IAAIY,EAAsC,KAG1C,SAAgBC,GAA4B,CAE1C,OADAD,IAAA,EAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAiB,kBAAA,CAAA,CAAA,CAAuB,KAAM,GAAWE,EAAWC,EAAO,OAA0D,CAAC,GAC/HH,CACT,CAEA,SAAgBE,EAAW,EAAwD,CAEjF,IAAME,EADahB,EAAAA,QAAQiB,EAAUA,EAAS,QAAQ,SACrC,CAAA,CAAW,SACtBC,EAAU,IAAI,IACpB,IAAK,IAAMC,KAASH,EAAU,CAC5B,GAAI,OAAOG,EAAM,IAAO,SAAU,SAClC,IAAMC,EAA2BD,EAAM,SAAS,OAAS,UAAY,CAACA,EAAM,SAAS,WAAW,EAAIA,EAAM,SAAS,YACnH,IAAK,IAAME,KAAeD,EAAU,CAClC,IAAME,EAAmB,CAAE,KAAM,UAAW,aAAY,EAClDC,EAAOtB,EAAAA,QAAQqB,CAAO,EACxBC,IAASL,EAAQ,IAAIC,EAAM,EAAE,CAAC,EAAE,MAAQ,IAAID,EAAQ,IAAIC,EAAM,GAAI,CAAE,OAAM,OAAQjB,EAAAA,QAAYoB,CAAO,CAAuB,CAAC,CACnI,CACF,CACA,MAAO,CAAE,WAAU,QAAS,IAAI,IAAI,CAAC,GAAGJ,CAAO,CAAC,CAAC,KAAK,CAACM,EAAM,CAAE,aAAc,CAACA,EAAMC,CAAM,CAAC,CAAC,EAAG,MAAOR,EAAS,OAAS,CAAC,CAAE,CAC7H,CAWA,IAAMS,EAAW,KAEjB,SAAgBC,EAAS,EAA2B,CAClD,IAAMC,EAAUC,EAAM,YAAY,KAAK,CAAC,CAAC,YAAY,EAIrD,OAHIA,EAAM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C3D,GAAIA,EAAA,KAAiB,CACnB,IAAMG,EAAIL,EAAcE,EAAQN,CAAO,EACvC,MAAO,CAAE,MAAOS,EAAG,MAAOA,EAAG,QAAS,KAAK,IAAI,EAAGA,EAAIN,GAAO,EAAIM,GAAKN,CAAI,CAAE,CAC9E,CACA,IAAMO,GAAQJ,EAAQN,GAAY,KAClC,GAAIU,EAAA,KAAiB,MAAO,CAAE,MAAO,EAAG,MAAO,KAAM,QAAS,CAAE,EAChE,IAAMC,EAAIP,GAAeM,EAAOT,GAAYC,CAAM,EAClD,MAAO,CAAE,MAAO,EAAG,MAAOS,EAAG,QAAS,KAAK,IAAI,EAAGA,EAAIR,GAAO,EAAIQ,GAAKR,CAAI,CAAE,CAC9E,CAGA,IAAaS,EAAc,IAAkBC,EAAO,GAAA,IAAkBb,E"}
@@ -0,0 +1,150 @@
1
+ "use client";
2
+ import e from "../../node_modules/d3-geo/src/area.js";
3
+ import t from "../../node_modules/d3-geo/src/centroid.js";
4
+ import n from "../../node_modules/d3-geo/src/distance.js";
5
+ import r from "../../node_modules/d3-geo/src/interpolate.js";
6
+ import i from "../../node_modules/d3-geo/src/projection/orthographic.js";
7
+ import a from "../../node_modules/topojson-client/src/feature.js";
8
+ // src/components/GlobeMap/geo.ts
9
+ var o = null;
10
+ function s() {
11
+ return o ?? (o = import("./world.json.js").then((e) => c(e.default))), o;
12
+ }
13
+ function c(n) {
14
+ let r = a(n, n.objects.countries).features, i = /* @__PURE__ */ new Map();
15
+ for (let n of r) {
16
+ if (typeof n.id != "string") continue;
17
+ let r = n.geometry.type === "Polygon" ? [n.geometry.coordinates] : n.geometry.coordinates;
18
+ for (let a of r) {
19
+ let r = {
20
+ type: "Polygon",
21
+ coordinates: a
22
+ }, o = e(r);
23
+ o >= (i.get(n.id)?.area ?? 0) && i.set(n.id, {
24
+ area: o,
25
+ anchor: t(r)
26
+ });
27
+ }
28
+ }
29
+ return {
30
+ features: r,
31
+ anchors: new Map([...i].map(([e, { anchor: t }]) => [e, t])),
32
+ names: n.names ?? {}
33
+ };
34
+ }
35
+ var l = 6371;
36
+ function u(e) {
37
+ let t = e.countryCode.trim().toUpperCase();
38
+ return e.kind === "country" ? `country:${t}` : e.code ? `airport:${e.code.trim().toUpperCase()}` : e.latitude != null && e.longitude != null ? `point:${e.latitude.toFixed(3)},${e.longitude.toFixed(3)}` : `city:${t}:${(e.label ?? "").trim().toLowerCase()}`;
39
+ }
40
+ function d(e, t) {
41
+ return e.kind !== "country" && e.latitude != null && e.longitude != null ? [e.longitude, e.latitude] : t?.anchors.get(e.countryCode.trim().toUpperCase()) ?? null;
42
+ }
43
+ function f(e, t) {
44
+ if (u(e) === u(t)) return !0;
45
+ if (e.kind === "country" || t.kind === "country" || e.countryCode.trim().toUpperCase() !== t.countryCode.trim().toUpperCase()) return !1;
46
+ let r = d(e, null), i = d(t, null);
47
+ return r && i ? n(r, i) * l < 50 : !!e.label && !!t.label && e.label.trim().toLowerCase() === t.label.trim().toLowerCase();
48
+ }
49
+ var p = {
50
+ lon: 30,
51
+ lat: 38,
52
+ r: 117.9,
53
+ x: 195,
54
+ y: 255 / 2
55
+ }, m = 1080, h = 90;
56
+ function g(e) {
57
+ if (e.length === 0) return p;
58
+ let n = e.length === 1 ? e[0] : t({
59
+ type: "MultiPoint",
60
+ coordinates: e
61
+ }), [r, a] = Number.isFinite(n[0]) && Number.isFinite(n[1]) ? n : e[0], o = i().rotate([-r, -a]).scale(1).translate([0, 0]), s = e.map((e) => o(e) ?? [0, 0]), c = s.map(([e]) => e), l = s.map(([, e]) => e), [u, d, f, g] = [
62
+ Math.min(...c),
63
+ Math.max(...c),
64
+ Math.min(...l),
65
+ Math.max(...l)
66
+ ], _ = Math.max(h, Math.min(m, 230 / Math.max(d - u, 1e-6), 155 / Math.max(g - f, 1e-6)));
67
+ return {
68
+ lon: r,
69
+ lat: a,
70
+ r: _,
71
+ x: 195 - _ * ((u + d) / 2),
72
+ y: 125.5 - _ * ((f + g) / 2)
73
+ };
74
+ }
75
+ function _(e, t) {
76
+ let n = r([e.lon, e.lat], [t.lon, t.lat]);
77
+ return (r) => {
78
+ let [i, a] = n(r);
79
+ return {
80
+ lon: i,
81
+ lat: a,
82
+ r: e.r * (t.r / e.r) ** +r,
83
+ x: e.x + (t.x - e.x) * r,
84
+ y: e.y + (t.y - e.y) * r
85
+ };
86
+ };
87
+ }
88
+ function v(e) {
89
+ return i().rotate([-e.lon, -e.lat]).scale(e.r).translate([e.x, e.y]).clipAngle(90).clipExtent([[-2, -2], [392, 257]]).precision(.4);
90
+ }
91
+ function y(e, t) {
92
+ return n(e, [t.lon, t.lat]) < Math.PI / 2 - .01;
93
+ }
94
+ var b = .12, x = (e) => e.toFixed(2), S = (e, t, n) => [e[0] + (t[0] - e[0]) * n, e[1] + (t[1] - e[1]) * n];
95
+ function C(e, t) {
96
+ let n = t[0] - e[0], r = t[1] - e[1], i = [(e[0] + t[0]) / 2 - r * b * 2, (e[1] + t[1]) / 2 + n * b * 2];
97
+ return {
98
+ d: `M${x(e[0])} ${x(e[1])}Q${x(i[0])} ${x(i[1])} ${x(t[0])} ${x(t[1])}`,
99
+ p0: e,
100
+ c: i,
101
+ p1: t,
102
+ mid: [(e[0] + t[0]) / 2 - r * b, (e[1] + t[1]) / 2 + n * b],
103
+ angle: Math.atan2(r, n) * 180 / Math.PI
104
+ };
105
+ }
106
+ function w({ p0: e, c: t, p1: n }, r) {
107
+ let i = S(e, t, r), a = S(t, n, r);
108
+ return {
109
+ at: S(i, a, r),
110
+ angle: Math.atan2(a[1] - i[1], a[0] - i[0]) * 180 / Math.PI
111
+ };
112
+ }
113
+ function T(e, t) {
114
+ if (t >= 1) return e.d;
115
+ let n = S(e.p0, e.c, t), r = w(e, t).at;
116
+ return `M${x(e.p0[0])} ${x(e.p0[1])}Q${x(n[0])} ${x(n[1])} ${x(r[0])} ${x(r[1])}`;
117
+ }
118
+ var E = 1100, D = 1400, O = 3200, k = .12, A = (e) => -(Math.cos(Math.PI * e) - 1) / 2;
119
+ function j(e, t) {
120
+ let n = t - e * 500;
121
+ if (n <= 0) return {
122
+ drawn: 0,
123
+ plane: null,
124
+ opacity: 0
125
+ };
126
+ if (n < 1100) {
127
+ let e = A(n / E);
128
+ return {
129
+ drawn: e,
130
+ plane: e,
131
+ opacity: Math.min(1, e / k, (1 - e) / k)
132
+ };
133
+ }
134
+ let r = (n - E) % 4600;
135
+ if (r < 1400) return {
136
+ drawn: 1,
137
+ plane: null,
138
+ opacity: 0
139
+ };
140
+ let i = A((r - D) / O);
141
+ return {
142
+ drawn: 1,
143
+ plane: i,
144
+ opacity: Math.min(1, i / k, (1 - i) / k)
145
+ };
146
+ }
147
+ var M = (e) => (e - 1) * 500 + E;
148
+ export { E as DRAW_MS, O as FLY_MS, p as HOME_VIEW, D as PAUSE_MS, m as PLACE_RADIUS, w as arcAt, T as arcPathTo, c as buildWorld, M as drawnAfter, g as fitView, _ as interpolateView, y as isFacing, j as legFrame, s as loadWorld, u as placeKey, d as placePoint, v as projectionFor, C as routeArc, f as samePlace };
149
+
150
+ //# sourceMappingURL=geo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geo.js","names":["feature","geoArea","geoCentroid","geoDistance","geoOrthographic","geoInterpolate","area_default","centroid_default","distance_default","interpolate_default","orthographic_default","feature_default","worldPromise","loadWorld","buildWorld","module","features","topology","largest","shape","polygons","coordinates","polygon","area","code","anchor","EARTH_KM","placeKey","country","place","placePoint","world","samePlace","a","b","pa","pb","HOME_VIEW","PLACE_RADIUS","MIN_RADIUS","fitView","points","centre","lon","lat","unit","projected","point","xs","x","ys","y","minX","maxX","minY","maxY","r","interpolateView","rotate","t","projectionFor","view","isFacing","BOW","f","n","lerp","routeArc","dx","p1","p0","dy","c","arcAt","arcPathTo","arc","end","DRAW_MS","PAUSE_MS","FLY_MS","FADE","easeInOutSine","legFrame","local","elapsed","index","p","loop","q","drawnAfter","legs"],"sources":["../../../src/components/GlobeMap/geo.ts"],"sourcesContent":["import { geoArea, geoCentroid, geoDistance, geoInterpolate, geoOrthographic, type GeoProjection } from 'd3-geo';\nimport type { Feature, MultiPolygon, Polygon, Position } from 'geojson';\nimport { feature } from 'topojson-client';\nimport type { GeometryCollection, Topology } from 'topojson-specification';\n\n/** [longitude, latitude] in degrees. */\nexport type LonLat = readonly [number, number];\n\n/** A country picked as a whole: its shape is filled and the pin sits in its middle. */\nexport interface GlobeCountryPlace {\n kind: 'country';\n /** ISO 3166-1 alpha-2, e.g. `\"FR\"`. */\n countryCode: string;\n /** Label text; defaults to the country name in `locale`. */\n label?: string;\n}\n\n/** A city or an airport: its country is filled and the pin sits on its coordinates. */\nexport interface GlobePointPlace {\n kind: 'city' | 'airport';\n /** ISO 3166-1 alpha-2 of the country it is in, e.g. `\"FR\"`. */\n countryCode: string;\n /** From the airport data (`latitude` / `longitude` of the reference-data airports). Without them the pin sits in the middle of the country. */\n latitude?: number;\n longitude?: number;\n /** IATA code of an airport, e.g. `\"CDG\"`; identifies the place when it comes back later in the route. */\n code?: string;\n /** Label text, e.g. the city name `\"Paris\"`. Defaults to `code`, then the country name. */\n label?: string;\n}\n\nexport type GlobePlace = GlobeCountryPlace | GlobePointPlace;\n\n/** One leg of the trip, drawn as a dotted arc from `from` to `to`. */\nexport interface GlobeSegment {\n from: GlobePlace;\n to: GlobePlace;\n}\n\n/* ── World data ───────────────────────────────────────────────────────── */\n\nexport interface World {\n /** Every country shape; `id` is the ISO alpha-2 code (null for a few disputed or uninhabited areas). */\n features: Feature<Polygon | MultiPolygon>[];\n /** Pin position for a whole country: the centroid of its largest outline (mainland France, not French Guiana). */\n anchors: Map<string, LonLat>;\n /** Country names per language (`en`, `hy`, `ru`), keyed by alpha-2 code. */\n names: Readonly<Record<string, Readonly<Record<string, string>>>>;\n}\n\nlet worldPromise: Promise<World> | null = null;\n\n/** Loads the country shapes once (a separate chunk, ~100 KB gzipped) the first time a globe is shown. */\nexport function loadWorld(): Promise<World> {\n worldPromise ??= import('./world.json').then((module) => buildWorld(module.default as unknown as Topology & { names: World['names'] }));\n return worldPromise;\n}\n\nexport function buildWorld(topology: Topology & { names?: World['names'] }): World {\n const collection = feature(topology, topology.objects.countries as GeometryCollection);\n const features = collection.features as Feature<Polygon | MultiPolygon>[];\n const largest = new Map<string, { area: number; anchor: LonLat }>();\n for (const shape of features) {\n if (typeof shape.id !== 'string') continue;\n const polygons: Position[][][] = shape.geometry.type === 'Polygon' ? [shape.geometry.coordinates] : shape.geometry.coordinates;\n for (const coordinates of polygons) {\n const polygon: Polygon = { type: 'Polygon', coordinates };\n const area = geoArea(polygon);\n if (area >= (largest.get(shape.id)?.area ?? 0)) largest.set(shape.id, { area, anchor: geoCentroid(polygon) as unknown as LonLat });\n }\n }\n return { features, anchors: new Map([...largest].map(([code, { anchor }]) => [code, anchor])), names: topology.names ?? {} };\n}\n\n/* ── Places ───────────────────────────────────────────────────────────── */\n\nexport interface ResolvedPlace {\n key: string;\n place: GlobePlace;\n countryCode: string;\n point: LonLat | null;\n}\n\nconst EARTH_KM = 6371;\n\nexport function placeKey(place: GlobePlace): string {\n const country = place.countryCode.trim().toUpperCase();\n if (place.kind === 'country') return `country:${country}`;\n if (place.code) return `airport:${place.code.trim().toUpperCase()}`;\n if (place.latitude != null && place.longitude != null) return `point:${place.latitude.toFixed(3)},${place.longitude.toFixed(3)}`;\n return `city:${country}:${(place.label ?? '').trim().toLowerCase()}`;\n}\n\nexport function placePoint(place: GlobePlace, world: World | null): LonLat | null {\n if (place.kind !== 'country' && place.latitude != null && place.longitude != null) return [place.longitude, place.latitude];\n return world?.anchors.get(place.countryCode.trim().toUpperCase()) ?? null;\n}\n\n/** Whether two places are the same stop: same airport code, same country pick, or points within 50 km in one country. */\nexport function samePlace(a: GlobePlace, b: GlobePlace): boolean {\n if (placeKey(a) === placeKey(b)) return true;\n if (a.kind === 'country' || b.kind === 'country') return false;\n if (a.countryCode.trim().toUpperCase() !== b.countryCode.trim().toUpperCase()) return false;\n const pa = placePoint(a, null);\n const pb = placePoint(b, null);\n if (pa && pb) return geoDistance(pa as [number, number], pb as [number, number]) * EARTH_KM < 50;\n return !!a.label && !!b.label && a.label.trim().toLowerCase() === b.label.trim().toLowerCase();\n}\n\n/* ── View ─────────────────────────────────────────────────────────────── */\n\n/** Figma \"Map area\": 390×255. Everything is laid out in these units and scaled to the real width. */\nexport const FRAME_WIDTH = 390;\nexport const FRAME_HEIGHT = 255;\n\n/** Rotation centre (degrees), globe radius and globe centre, in frame units. */\nexport interface GlobeView {\n lon: number;\n lat: number;\n r: number;\n x: number;\n y: number;\n}\n\n/** Figma \"Map / Globe\" in the empty map (2966:17945): 235.8 px across, centred, facing 30°E 38°N. */\nexport const HOME_VIEW: GlobeView = { lon: 30, lat: 38, r: 117.9, x: FRAME_WIDTH / 2, y: FRAME_HEIGHT / 2 };\n\n/** Figma 2966:18002 (only the departure chosen): the globe at 2160 px, the departure in the middle. */\nexport const PLACE_RADIUS = 1080;\n\n/* Room kept around the pins for labels (below the pins) and the route arcs. */\nconst PAD_X = 80;\nconst PAD_TOP = 48;\nconst PAD_BOTTOM = 52;\nconst MIN_RADIUS = 90;\n\n/** The view that shows every point: rotated to their middle and zoomed in as far as the frame allows. */\nexport function fitView(points: readonly LonLat[]): GlobeView {\n if (points.length === 0) return HOME_VIEW;\n const centre = points.length === 1 ? points[0] : (geoCentroid({ type: 'MultiPoint', coordinates: points as unknown as Position[] }) as unknown as LonLat);\n const [lon, lat] = Number.isFinite(centre[0]) && Number.isFinite(centre[1]) ? centre : points[0];\n const unit = geoOrthographic().rotate([-lon, -lat]).scale(1).translate([0, 0]);\n const projected = points.map((point) => unit(point as [number, number]) ?? [0, 0]);\n const xs = projected.map(([x]) => x);\n const ys = projected.map(([, y]) => y);\n const [minX, maxX, minY, maxY] = [Math.min(...xs), Math.max(...xs), Math.min(...ys), Math.max(...ys)];\n const width = FRAME_WIDTH - 2 * PAD_X;\n const height = FRAME_HEIGHT - PAD_TOP - PAD_BOTTOM;\n const r = Math.max(MIN_RADIUS, Math.min(PLACE_RADIUS, width / Math.max(maxX - minX, 1e-6), height / Math.max(maxY - minY, 1e-6)));\n return {\n lon,\n lat,\n r,\n x: FRAME_WIDTH / 2 - r * ((minX + maxX) / 2),\n y: PAD_TOP + height / 2 - r * ((minY + maxY) / 2),\n };\n}\n\n/** Rotates along the great circle between the two centres and zooms geometrically, so the motion feels even. */\nexport function interpolateView(a: GlobeView, b: GlobeView): (t: number) => GlobeView {\n const rotate = geoInterpolate([a.lon, a.lat], [b.lon, b.lat]);\n return (t) => {\n const [lon, lat] = rotate(t);\n return { lon, lat, r: a.r * Math.pow(b.r / a.r, t), x: a.x + (b.x - a.x) * t, y: a.y + (b.y - a.y) * t };\n };\n}\n\nexport function projectionFor(view: GlobeView): GeoProjection {\n return geoOrthographic()\n .rotate([-view.lon, -view.lat])\n .scale(view.r)\n .translate([view.x, view.y])\n .clipAngle(90)\n .clipExtent([\n [-2, -2],\n [FRAME_WIDTH + 2, FRAME_HEIGHT + 2],\n ])\n .precision(0.4);\n}\n\n/** Whether a point is on the side of the globe facing the viewer. */\nexport function isFacing(point: LonLat, view: GlobeView): boolean {\n return geoDistance(point as [number, number], [view.lon, view.lat]) < Math.PI / 2 - 0.01;\n}\n\n/* ── Routes ───────────────────────────────────────────────────────────── */\n\n/** Figma routes bow to the right of the direction of travel (west → over the top, east → underneath) by 12% of their length. */\nconst BOW = 0.12;\n\ntype XY = readonly [number, number];\n\nexport interface RouteArc {\n /** The whole arc as an SVG path. */\n d: string;\n /** Start, control point and end of the quadratic curve. */\n p0: XY;\n c: XY;\n p1: XY;\n /** Middle of the arc and the direction of travel there, in degrees (0 = east, 90 = south): the Figma plane spot. */\n mid: XY;\n angle: number;\n}\n\nconst f = (n: number) => n.toFixed(2);\nconst lerp = (a: XY, b: XY, t: number): XY => [a[0] + (b[0] - a[0]) * t, a[1] + (b[1] - a[1]) * t];\n\nexport function routeArc(p0: XY, p1: XY): RouteArc {\n const dx = p1[0] - p0[0];\n const dy = p1[1] - p0[1];\n // Control point: the chord's middle pushed along its right-hand normal (-dy, dx) by twice the bow.\n const c: XY = [(p0[0] + p1[0]) / 2 - dy * BOW * 2, (p0[1] + p1[1]) / 2 + dx * BOW * 2];\n return {\n d: `M${f(p0[0])} ${f(p0[1])}Q${f(c[0])} ${f(c[1])} ${f(p1[0])} ${f(p1[1])}`,\n p0,\n c,\n p1,\n mid: [(p0[0] + p1[0]) / 2 - dy * BOW, (p0[1] + p1[1]) / 2 + dx * BOW],\n angle: (Math.atan2(dy, dx) * 180) / Math.PI,\n };\n}\n\n/** Point on the arc at `t` (0…1) and the direction of travel there, in degrees. */\nexport function arcAt({ p0, c, p1 }: RouteArc, t: number): { at: XY; angle: number } {\n const a = lerp(p0, c, t);\n const b = lerp(c, p1, t);\n return { at: lerp(a, b, t), angle: (Math.atan2(b[1] - a[1], b[0] - a[0]) * 180) / Math.PI };\n}\n\n/** The first part of the arc, from the start to `t` (0…1), as an SVG path. */\nexport function arcPathTo(arc: RouteArc, t: number): string {\n if (t >= 1) return arc.d;\n const a = lerp(arc.p0, arc.c, t);\n const end = arcAt(arc, t).at;\n return `M${f(arc.p0[0])} ${f(arc.p0[1])}Q${f(a[0])} ${f(a[1])} ${f(end[0])} ${f(end[1])}`;\n}\n\n/* ── Flight animation ─────────────────────────────────────────────────── */\n\n/** Each leg draws itself in this long, with its plane at the tip; legs start one after another. */\nexport const DRAW_MS = 1100;\nexport const STAGGER_MS = 500;\n/** Then the plane keeps flying the leg: a pause on the ground, then the flight. */\nexport const PAUSE_MS = 1400;\nexport const FLY_MS = 3200;\n/** Part of a flight over which the plane fades in after take-off and out before landing. */\nconst FADE = 0.12;\n\nconst easeInOutSine = (t: number) => -(Math.cos(Math.PI * t) - 1) / 2;\n\nexport interface LegFrame {\n /** How much of the route is drawn, 0…1. */\n drawn: number;\n /** Where the plane is on the arc, 0…1, or null when it is on the ground (hidden). */\n plane: number | null;\n opacity: number;\n}\n\n/** Where leg `index` is, `elapsed` ms after the globe stopped. */\nexport function legFrame(index: number, elapsed: number): LegFrame {\n const local = elapsed - index * STAGGER_MS;\n if (local <= 0) return { drawn: 0, plane: null, opacity: 0 };\n if (local < DRAW_MS) {\n const p = easeInOutSine(local / DRAW_MS);\n return { drawn: p, plane: p, opacity: Math.min(1, p / FADE, (1 - p) / FADE) };\n }\n const loop = (local - DRAW_MS) % (PAUSE_MS + FLY_MS);\n if (loop < PAUSE_MS) return { drawn: 1, plane: null, opacity: 0 };\n const q = easeInOutSine((loop - PAUSE_MS) / FLY_MS);\n return { drawn: 1, plane: q, opacity: Math.min(1, q / FADE, (1 - q) / FADE) };\n}\n\n/** Time until every route is drawn, for maps without planes. */\nexport const drawnAfter = (legs: number) => (legs - 1) * STAGGER_MS + DRAW_MS;\n"],"mappings":";;;;;;;;AAkDA,IAAIY,IAAsC;AAG1C,SAAgBC,IAA4B;CAE1C,OADAD,MAAA,IAAiB,OAAO,kBAAe,CAAC,MAAM,MAAWE,EAAWC,EAAO,OAA0D,CAAC,IAC/HH;AACT;AAEA,SAAgBE,EAAW,GAAwD;CAEjF,IAAME,IADahB,EAAQiB,GAAUA,EAAS,QAAQ,SACrC,CAAA,CAAW,UACtBC,oBAAU,IAAI,IAA8C;CAClE,KAAK,IAAMC,KAASH,GAAU;EAC5B,IAAI,OAAOG,EAAM,MAAO,UAAU;EAClC,IAAMC,IAA2BD,EAAM,SAAS,SAAS,YAAY,CAACA,EAAM,SAAS,WAAW,IAAIA,EAAM,SAAS;EACnH,KAAK,IAAME,KAAeD,GAAU;GAClC,IAAME,IAAmB;IAAE,MAAM;IAAW;GAAY,GAClDC,IAAOtB,EAAQqB,CAAO;GAC5B,AAAIC,MAASL,EAAQ,IAAIC,EAAM,EAAE,CAAC,EAAE,QAAQ,MAAID,EAAQ,IAAIC,EAAM,IAAI;IAAE;IAAM,QAAQjB,EAAYoB,CAAO;GAAuB,CAAC;EACnI;CACF;CACA,OAAO;EAAE;EAAU,SAAS,IAAI,IAAI,CAAC,GAAGJ,CAAO,CAAC,CAAC,KAAK,C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