efficient-shell 15.2.0 → 15.3.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 (254) hide show
  1. package/README.md +10 -0
  2. package/dist/{Browser-42QAXKYW.js → Browser-SJKIWRIF.js} +19 -19
  3. package/dist/Calculator-NS2NGCHN.js +29 -0
  4. package/dist/{CurrencyConverter-VFTDSYQ3.js → CurrencyConverter-ES5SWCOZ.js} +9 -9
  5. package/dist/{Files-OAVWF6EW.js → Files-KM3OX5LC.js} +76 -76
  6. package/dist/{Notepad-LNNSVEFG.js → Notepad-VZ2Y3NAY.js} +9 -9
  7. package/dist/PdfViewer-AIAVQYZ6.js +1 -0
  8. package/dist/PomodoroTimer-BRSRBMEG.js +91 -0
  9. package/dist/{Preview-GDNUQKGN.js → Preview-YWS265UV.js} +24 -24
  10. package/dist/Sidebar-KAALEIIX.js +44 -0
  11. package/dist/{Stock-NNDDNQBJ.js → Stock-GMWRXTKR.js} +2 -2
  12. package/dist/{Weather-NGQALCXO.js → Weather-QSQ2TZKG.js} +17 -17
  13. package/dist/{WorldClock-LX4BQPZJ.js → WorldClock-YPP2KHIV.js} +7 -7
  14. package/dist/ai/index.js +42 -42
  15. package/dist/apps/index.js +1 -1
  16. package/dist/bin/browser-check.js +1 -1
  17. package/dist/bin/media-host-check.js +1 -1
  18. package/dist/bin/ui-check.js +1 -1
  19. package/dist/brand.css +1 -1
  20. package/dist/charts/ChordChart.js +1 -1
  21. package/dist/charts/FlowChart.js +1 -1
  22. package/dist/charts/RadarChart.js +1 -1
  23. package/dist/charts/SankeyChart.js +1 -1
  24. package/dist/charts/SpecChart.js +1 -1
  25. package/dist/charts/SunburstChart.js +1 -1
  26. package/dist/charts/TreemapChart.js +1 -1
  27. package/dist/{chunk-ZC2FZLYX.js → chunk-345FP3IX.js} +4 -4
  28. package/dist/chunk-35Q7ZMQD.js +8 -0
  29. package/dist/{chunk-ZYWLX5EK.js → chunk-3AVXNZY5.js} +1 -1
  30. package/dist/chunk-3FININUU.js +1 -0
  31. package/dist/chunk-3H476JWK.js +4 -0
  32. package/dist/{chunk-TWSROAS7.js → chunk-4MDSZSLC.js} +1 -1
  33. package/dist/{chunk-DXTRHNP4.js → chunk-4NTAZLT3.js} +2 -2
  34. package/dist/{chunk-TVMDDQJP.js → chunk-52RSW6TO.js} +1 -1
  35. package/dist/{chunk-26I3OTGP.js → chunk-5B7CLXHC.js} +1 -1
  36. package/dist/{chunk-MDGM5NUO.js → chunk-5CGGHE2O.js} +9 -9
  37. package/dist/{chunk-SXNT73VT.js → chunk-5LB7LCEG.js} +19 -19
  38. package/dist/{chunk-CMC25URA.js → chunk-5LG6TOV6.js} +6 -6
  39. package/dist/{chunk-IIUFCTT6.js → chunk-5OXQ5M5S.js} +1 -1
  40. package/dist/{chunk-AVUH35GW.js → chunk-5QHNDAZ6.js} +1 -1
  41. package/dist/{chunk-52YTUQW3.js → chunk-5QRHQCRG.js} +1 -1
  42. package/dist/{chunk-T43ATI2N.js → chunk-5RCKE4X2.js} +6 -6
  43. package/dist/{chunk-LFGJUJRZ.js → chunk-5Y2JZL3I.js} +13 -13
  44. package/dist/{chunk-QIAJ3QNV.js → chunk-62UNBUTU.js} +1 -1
  45. package/dist/{chunk-NBV3XK3Q.js → chunk-7533CPNQ.js} +3 -3
  46. package/dist/{chunk-HBAATSUS.js → chunk-75NYUMNV.js} +1 -1
  47. package/dist/{chunk-BMZL5BHA.js → chunk-A3RD7AQ2.js} +1 -1
  48. package/dist/chunk-A4ROXNUF.js +2 -0
  49. package/dist/{chunk-2QUACZ6O.js → chunk-A7GOVTCI.js} +1 -1
  50. package/dist/{chunk-PAD65HG7.js → chunk-ABIWAS5K.js} +1 -1
  51. package/dist/{chunk-3TVMQCYR.js → chunk-AKEED2BC.js} +1 -1
  52. package/dist/chunk-APFDZ2HG.js +1 -0
  53. package/dist/{chunk-S3F2TY7X.js → chunk-ASNRA3ZL.js} +1 -1
  54. package/dist/chunk-B36ZROD7.js +8 -0
  55. package/dist/{chunk-QI2LJ7OL.js → chunk-B4Y5NGHR.js} +9 -9
  56. package/dist/{chunk-ZZKBCNK6.js → chunk-BTMZ5MUY.js} +11 -11
  57. package/dist/{chunk-NXPIX7NO.js → chunk-C75ICYHF.js} +1 -1
  58. package/dist/{chunk-JJ5W4BRW.js → chunk-CGX2IGQO.js} +1 -1
  59. package/dist/{chunk-HKXP3JJ5.js → chunk-CHWZGSYG.js} +1 -1
  60. package/dist/{chunk-2MUZFHZW.js → chunk-CIZAUBWA.js} +6 -6
  61. package/dist/{chunk-5JQCWXIQ.js → chunk-CMEPDSYB.js} +1 -1
  62. package/dist/{chunk-JHEHW5BE.js → chunk-D7MRZZVV.js} +3 -3
  63. package/dist/chunk-DEV3ZHPP.js +8 -0
  64. package/dist/chunk-DVKOVZJ2.js +13 -0
  65. package/dist/{chunk-7ZJ7VK2N.js → chunk-EJ5NIA42.js} +1 -1
  66. package/dist/{chunk-M5JEYZ3A.js → chunk-EJMCK7E3.js} +4 -4
  67. package/dist/{chunk-GBCLIWUQ.js → chunk-EULBBS5L.js} +1 -1
  68. package/dist/{chunk-7FYTL6SD.js → chunk-FAPZFMS3.js} +1 -1
  69. package/dist/chunk-FGP2IOFN.js +15 -0
  70. package/dist/{chunk-ABRCV7DQ.js → chunk-FHTL7ZZR.js} +1 -1
  71. package/dist/{chunk-JVITCC65.js → chunk-GGLS6JZ3.js} +1 -1
  72. package/dist/{chunk-KWBYE5MN.js → chunk-GGNQEZ2D.js} +8 -8
  73. package/dist/chunk-GML6FVPA.js +6 -0
  74. package/dist/{chunk-VQ3OSYTA.js → chunk-GUOAPXUY.js} +4 -4
  75. package/dist/{chunk-IJWRJPX6.js → chunk-HU5FTTW2.js} +7 -7
  76. package/dist/{chunk-SKPAIZSC.js → chunk-INQQUAIO.js} +4 -4
  77. package/dist/{chunk-ZQWKVLSY.js → chunk-JGN27L4Q.js} +12 -12
  78. package/dist/{chunk-BN37AISA.js → chunk-JIHDUZJZ.js} +3 -3
  79. package/dist/chunk-JRKD7SD3.js +24 -0
  80. package/dist/{chunk-FYHUCRLU.js → chunk-JWS77LQE.js} +1 -1
  81. package/dist/{chunk-6F3XQJR6.js → chunk-KERCZSIA.js} +1 -1
  82. package/dist/{chunk-ECZEJ6BE.js → chunk-KIIZNION.js} +6 -6
  83. package/dist/{chunk-L664TIIV.js → chunk-KJ4CHRRC.js} +7 -7
  84. package/dist/{chunk-HMTZP7NJ.js → chunk-KTI4ZJVX.js} +1 -1
  85. package/dist/{chunk-VIBGF2HJ.js → chunk-L2WQOJ3T.js} +1 -1
  86. package/dist/{chunk-3CIJFWB4.js → chunk-LFUXWZV7.js} +1 -1
  87. package/dist/{chunk-OCKOZV46.js → chunk-LGVVXYW7.js} +1 -1
  88. package/dist/{chunk-ZS36DB4X.js → chunk-MF7OELXP.js} +2 -2
  89. package/dist/{chunk-OCITNQGF.js → chunk-MQNSKFZY.js} +10 -10
  90. package/dist/{chunk-M6ODRWTM.js → chunk-NJY4HPNB.js} +5 -5
  91. package/dist/{chunk-QBR73AJX.js → chunk-OEWBWKKD.js} +11 -11
  92. package/dist/chunk-OHPDB4UN.js +14 -0
  93. package/dist/{chunk-LKNDLXL3.js → chunk-OHWP24DL.js} +1 -1
  94. package/dist/{chunk-VNKLIWNQ.js → chunk-OK2J6WSC.js} +1 -1
  95. package/dist/{chunk-3HPCQMYH.js → chunk-P56YLT73.js} +12 -12
  96. package/dist/{chunk-VTYALYW4.js → chunk-PCNFY6EK.js} +12 -12
  97. package/dist/{chunk-FM5ASDVN.js → chunk-PM6HY5BH.js} +1 -1
  98. package/dist/{chunk-ABAUJLI4.js → chunk-PO2KNVCC.js} +1 -1
  99. package/dist/chunk-PRN2QDX6.js +7 -0
  100. package/dist/{chunk-7M7GKYHS.js → chunk-QE2F4YQQ.js} +9 -9
  101. package/dist/chunk-QGWUZAG7.js +28 -0
  102. package/dist/{chunk-QJY52ZHG.js → chunk-QSFQTMWV.js} +1 -1
  103. package/dist/{chunk-YVI2XJCB.js → chunk-QSOBETAI.js} +5 -5
  104. package/dist/chunk-QXEZBS3H.js +6 -0
  105. package/dist/{chunk-32HTOZFT.js → chunk-QYOIS4BN.js} +3 -3
  106. package/dist/chunk-R6YVKP6D.js +3 -0
  107. package/dist/chunk-R72SBGYR.js +9 -0
  108. package/dist/{chunk-QMUW35QL.js → chunk-RIA6KKIB.js} +6 -6
  109. package/dist/{chunk-D3L2QCGF.js → chunk-RTZFWH5U.js} +1 -1
  110. package/dist/{chunk-HVWRF7N4.js → chunk-S6C7X6CR.js} +19 -19
  111. package/dist/{chunk-7T6NWAPG.js → chunk-SJUEGYT2.js} +1 -1
  112. package/dist/chunk-T5TKMIV2.js +1 -0
  113. package/dist/{chunk-JE4BGFDJ.js → chunk-TAB3K2WF.js} +1 -1
  114. package/dist/{chunk-4H4HJIWI.js → chunk-TAIH2VIW.js} +1 -1
  115. package/dist/{chunk-NTVACRKD.js → chunk-TALQMTCE.js} +3 -3
  116. package/dist/{chunk-KKZXGWSX.js → chunk-TEYG2W7A.js} +2 -2
  117. package/dist/{chunk-FZZBBZXZ.js → chunk-TMXMIRWG.js} +8 -8
  118. package/dist/{chunk-J43RRDEP.js → chunk-TSZPGDU3.js} +1 -1
  119. package/dist/{chunk-T65TAQLW.js → chunk-TXGVSWH6.js} +13 -13
  120. package/dist/{chunk-UA7SWROJ.js → chunk-U7PA4KNZ.js} +3 -3
  121. package/dist/{chunk-2M3KB4RH.js → chunk-UYM7562M.js} +2 -2
  122. package/dist/{chunk-JFTLFF52.js → chunk-V62FEHS4.js} +3 -3
  123. package/dist/{chunk-QQ6TGD7K.js → chunk-VANF2TL3.js} +47 -47
  124. package/dist/{chunk-PYGXSGXC.js → chunk-VB4ZPIZF.js} +1 -1
  125. package/dist/{chunk-K3OLOLFT.js → chunk-VHBRVW5O.js} +3 -3
  126. package/dist/chunk-W7HTHKN2.js +19 -0
  127. package/dist/{chunk-5R25GNE2.js → chunk-WNHDYTTI.js} +2 -2
  128. package/dist/{chunk-WHHHECBC.js → chunk-WSQ73CRR.js} +2 -2
  129. package/dist/{chunk-M4NT6HGJ.js → chunk-YEDAXZYO.js} +1 -1
  130. package/dist/{chunk-ILH7RDAD.js → chunk-YGNJIOOH.js} +10 -10
  131. package/dist/{chunk-C5Q4AKXO.js → chunk-YXMXATYP.js} +1 -1
  132. package/dist/{chunk-OEZC5N6J.js → chunk-ZVKUOJNS.js} +1 -1
  133. package/dist/data/DataTable.js +1 -1
  134. package/dist/data/EntityList.js +1 -1
  135. package/dist/data/Gantt.js +1 -1
  136. package/dist/data/ListLoadError.js +1 -1
  137. package/dist/data/ListToolbar.js +1 -1
  138. package/dist/data/ResizableTable.js +1 -1
  139. package/dist/data/statusColumn.js +1 -1
  140. package/dist/forms/AlignmentGrid.js +1 -1
  141. package/dist/forms/BorderInput.js +1 -1
  142. package/dist/forms/BrandAssetEditor.js +1 -1
  143. package/dist/forms/Button.js +1 -1
  144. package/dist/forms/ColorPicker.js +1 -1
  145. package/dist/forms/ComposerAttachments.js +1 -1
  146. package/dist/forms/CornersInput.js +1 -1
  147. package/dist/forms/DatePicker.js +1 -1
  148. package/dist/forms/DateRangePicker.js +1 -1
  149. package/dist/forms/DisplayChips.js +1 -1
  150. package/dist/forms/FilePicker.js +1 -1
  151. package/dist/forms/IconButton.js +1 -1
  152. package/dist/forms/IconPicker.js +1 -1
  153. package/dist/forms/Input.js +1 -1
  154. package/dist/forms/InputNumber.js +1 -1
  155. package/dist/forms/LinkPicker.js +1 -1
  156. package/dist/forms/MediaLibrary.js +1 -1
  157. package/dist/forms/MediaUploadField.js +1 -1
  158. package/dist/forms/MediaUploadGrid.js +1 -1
  159. package/dist/forms/MediaUsedInList.js +1 -1
  160. package/dist/forms/NumericKeypad.js +1 -1
  161. package/dist/forms/PictureTiles.js +1 -1
  162. package/dist/forms/PositionInput.js +1 -1
  163. package/dist/forms/RenameField.js +1 -1
  164. package/dist/forms/SearchInput.js +1 -1
  165. package/dist/forms/Segmented.js +1 -1
  166. package/dist/forms/Select.d.ts +6 -5
  167. package/dist/forms/Select.js +1 -1
  168. package/dist/forms/SidesInput.js +1 -1
  169. package/dist/forms/Slider.js +1 -1
  170. package/dist/forms/Snippet.js +1 -1
  171. package/dist/forms/SplitButton.js +1 -1
  172. package/dist/forms/TagInput.js +1 -1
  173. package/dist/forms/TextToolbar.js +1 -1
  174. package/dist/forms/UnitMenu.js +1 -1
  175. package/dist/forms/WidthsBar.js +1 -1
  176. package/dist/index.d.ts +1 -0
  177. package/dist/index.js +381 -381
  178. package/dist/map/index.js +5 -5
  179. package/dist/optionItems-Cxd85rTy.d.ts +26 -0
  180. package/dist/page-tabs/index.js +5 -5
  181. package/dist/pdf/index.js +1 -1
  182. package/dist/routine-index.json +1 -1
  183. package/dist/shell/AppUpdateBanner.js +1 -1
  184. package/dist/shell/ColoredBadge.js +1 -1
  185. package/dist/shell/ConfirmDialog.js +1 -1
  186. package/dist/shell/ContextMenu.js +1 -1
  187. package/dist/shell/Dialog.js +1 -1
  188. package/dist/shell/Drawer.js +1 -1
  189. package/dist/shell/DropdownMenu.js +1 -1
  190. package/dist/shell/EditableGrid.js +1 -1
  191. package/dist/shell/FloatingBar.js +1 -1
  192. package/dist/shell/GlobalSearch.js +1 -1
  193. package/dist/shell/HelpCenter.js +1 -1
  194. package/dist/shell/IconRail.js +1 -1
  195. package/dist/shell/ImageLightbox.js +1 -1
  196. package/dist/shell/ItemCount.js +1 -1
  197. package/dist/shell/LanguageSelect.js +1 -1
  198. package/dist/shell/Markdown.js +1 -1
  199. package/dist/shell/Popover.js +1 -1
  200. package/dist/shell/PopupMenu.js +1 -1
  201. package/dist/shell/ResizeHandle.js +1 -1
  202. package/dist/shell/SearchableSelect.d.ts +3 -9
  203. package/dist/shell/SearchableSelect.js +1 -1
  204. package/dist/shell/SettingReset.js +1 -1
  205. package/dist/shell/SidebarLayout.js +1 -1
  206. package/dist/shell/SidebarNav.js +1 -1
  207. package/dist/shell/SortableList.js +1 -1
  208. package/dist/shell/StatusBadge.js +1 -1
  209. package/dist/shell/Tabs.js +1 -1
  210. package/dist/shell/Tooltip.js +1 -1
  211. package/dist/shell/TopNav.js +1 -1
  212. package/dist/shell/TransferProgress.js +1 -1
  213. package/dist/shell/Tree.js +1 -1
  214. package/dist/shell/discardGuard.js +1 -1
  215. package/dist/telemetry/index.js +1 -1
  216. package/dist/templates/AuthScreen.js +1 -1
  217. package/dist/templates/ChatTemplate.js +1 -1
  218. package/dist/templates/CheckoutTemplate.js +1 -1
  219. package/dist/templates/DashboardTemplate.js +1 -1
  220. package/dist/templates/DataTablePage.js +1 -1
  221. package/dist/templates/EmailTemplate.js +1 -1
  222. package/dist/templates/ErrorBoundary.js +1 -1
  223. package/dist/templates/FormLayoutPage.js +1 -1
  224. package/dist/templates/GalleryTemplate.js +1 -1
  225. package/dist/ui/index.d.ts +1 -0
  226. package/dist/ui/index.js +1 -1
  227. package/dist/ui.css +0 -1
  228. package/dist/value-index.json +1 -1
  229. package/dist/version.js +1 -1
  230. package/package.json +1 -1
  231. package/dist/Calculator-C7APPCLE.js +0 -29
  232. package/dist/PdfViewer-ADPTYOAO.js +0 -1
  233. package/dist/PomodoroTimer-AGSHX2JO.js +0 -91
  234. package/dist/Sidebar-SWLVNJ6L.js +0 -44
  235. package/dist/chunk-7QFXUNFA.js +0 -8
  236. package/dist/chunk-7YJBWOQG.js +0 -2
  237. package/dist/chunk-CIT4YPEO.js +0 -8
  238. package/dist/chunk-DTZDOXK3.js +0 -19
  239. package/dist/chunk-EQDYCSUX.js +0 -13
  240. package/dist/chunk-IBPJJO4N.js +0 -28
  241. package/dist/chunk-K5YT5PMJ.js +0 -5
  242. package/dist/chunk-M6T7N4SN.js +0 -14
  243. package/dist/chunk-MQERW3QR.js +0 -3
  244. package/dist/chunk-NJJG2VAW.js +0 -24
  245. package/dist/chunk-QVGASI5H.js +0 -9
  246. package/dist/chunk-QZYV4TDD.js +0 -1
  247. package/dist/chunk-S6IW2F4J.js +0 -8
  248. package/dist/chunk-TB7BO2XS.js +0 -6
  249. package/dist/chunk-UMLXFQVC.js +0 -1
  250. package/dist/chunk-XQMVECQM.js +0 -15
  251. package/dist/chunk-YX4QGW7Z.js +0 -4
  252. package/dist/chunk-Z2MP46QJ.js +0 -1
  253. package/dist/chunk-ZUQ72WER.js +0 -7
  254. /package/dist/{chunk-LPQQNPH5.js → chunk-TEQ5ZPAL.js} +0 -0
package/dist/map/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import{useRootIsDark as e}from"../chunk-UPXDDO3U.js";import{Button_default as t}from"../chunk-7YJBWOQG.js";import"../chunk-J43RRDEP.js";import{Icon as n}from"../chunk-ISVODSRP.js";import"../chunk-J75ZT2JQ.js";import{SpinnerRing as r}from"../chunk-R2VKEMZH.js";import"../chunk-2MUZFHZW.js";import"../chunk-PGN5ME7B.js";import{createShellPortal as o}from"../chunk-52YTUQW3.js";import"../chunk-62LW225J.js";import"../chunk-TAHHZGRH.js";import"../chunk-KEFNQEXZ.js";import"../chunk-PU2GJVMG.js";import"../chunk-UMLXFQVC.js";import"../chunk-UQYNPYF4.js";import"../chunk-MRJKZWWV.js";import"../chunk-TWVUQUUD.js";import"../chunk-5FYDNH4Y.js";import"../chunk-LNXBTK7Q.js";import{useShellStrings as a}from"../chunk-NRHG4R2Q.js";import"../chunk-C3QOHMR6.js";import{useRef as l,useState as s,useEffect as i,useCallback as c,useMemo as u}from"react";import{jsxs as d,jsx as p,Fragment as m}from"react/jsx-runtime";import{useQuery as h}from"@tanstack/react-query";var g="maplibregl-compact-show";function f(e){if(!e)return()=>{};const t=()=>!!e.classList.contains(g)&&(e.classList.remove(g),!0);if(t())return()=>{};const n=new MutationObserver(()=>{t()&&n.disconnect()});return n.observe(e,{attributes:!0,attributeFilter:["class"]}),()=>n.disconnect()}var b="https://tiles.openfreemap.org",y={connect:[b]},x={light:`${b}/styles/positron`,dark:`${b}/styles/dark`},k=20,v=12,w=480,N={center:[0,0],left:[k,0],right:[-20,0],top:[0,k],"top-left":[0,k],"top-right":[0,k],bottom:[0,-20],"bottom-left":[0,-20],"bottom-right":[0,-20]},M=(e,t=12)=>Math.max(0,Math.floor(e-t-v-k-10-16));function C(e,t,n,r=12){const o=e.y-k-r,a=n.height-e.y-k-v,l=t.height<=o||t.height>a&&o>=a,s=l?Math.max(0,t.height-o):-Math.max(0,t.height-a);let i="",c=0;return e.x-t.width/2<v?(i="-left",c=Math.max(0,v-e.x)):e.x+t.width/2>n.width-v&&(i="-right",c=-Math.max(0,e.x-(n.width-v))),{anchor:`${l?"bottom":"top"}${i}`,move:{x:c,y:s}}}var j="maplibre-gl-worker.mjs",L=e=>`/maplibre-gl/${e}/${j}`,E=null;function $(){return E??=Promise.all([import("maplibre-gl"),import("maplibre-gl/dist/maplibre-gl.css")]).then(([e])=>(e.setWorkerUrl(L(e.getVersion())),e)).catch(e=>{throw E=null,e}),E}var S=null;var R=24,B=28,A=29;function z(e){const t=[...e].sort((e,t)=>e-t),n=[];for(let e=0;e<t.length;){let r=e;for(;r+1<t.length&&t[r+1]===t[r]+1;)r++;n.push(r===e?String(t[e]):`${t[e]}–${t[r]}`),e=r+1}return n.join(", ")}function T(e){const t=Math.max(B,12+8*e.length);return t+t%2}var W=(e,t,n,r)=>({left:e-n/2,top:t-r/2,right:e+n/2,bottom:t+r/2});function F(e,t){return e.left<t.right+1&&t.left<e.right+1&&e.top<t.bottom+1&&t.top<e.bottom+1}var O=e=>W(e.x,e.y,e.width,e.height);function H(e){for(let t=0;t<e.length;t++)for(let n=t+1;n<e.length;n++)if(F(O(e[t]),O(e[n])))return[e[t],e[n]];return null}function K(e,t=[]){const n=[],r=e=>t.some(t=>F(t,e));let o=e.filter(e=>null!==e.stop).sort((e,t)=>e.stop-t.stop).map(e=>({keys:[e.key],stops:[e.stop],x:e.x,y:e.y,width:B,height:B,under:0}));for(let e=H(o);e;e=H(o)){const[t,n]=e;t.keys.push(...n.keys),t.stops.push(...n.stops),t.stops.sort((e,t)=>e-t),t.width=T(z(t.stops)),o=o.filter(e=>e!==n)}o=o.filter(e=>!r(O(e))||(n.push(...e.keys),!1));const a=[];for(const t of e){if(null!==t.stop)continue;const e=W(t.x,t.y,R,R),l=o.find(t=>F(O(t),e));if(l||r(e)){n.push(t.key),l&&l.under++;continue}const s=a.find(t=>F(O(t),e));s?s.keys.push(t.key):a.push({keys:[t.key],stops:[],x:t.x,y:t.y,width:R,height:R,under:0})}return{groups:[...o,...a],hidden:n}}function P(e,t,n){let r=-1/0;for(const o of t){const t=Math.max(Math.abs(o.x-e.x),Math.abs(o.y-e.y));r=Math.max(r,0===t?1/0:n+Math.log2(29/t))}return r}var q=(...e)=>e.filter(Boolean).join(" "),D=/^(?:\d+|[xytrblse](?:-\d+)?|solid|dashed|dotted|double|hidden|none)$/;function _(e){return e.split(/\s+/).some(e=>{const t=e.search(/[[(]/),n=t<0?e:e.slice(0,t),r=e.slice(n.lastIndexOf(":")+1);return r.startsWith("border-")&&!D.test(r.slice(7))})}var U="ring-2 ring-gray-900 ring-offset-2",Z={portal:{frame:e=>q("relative min-h-72 overflow-hidden rounded-lg border border-line bg-gray-100",e&&"[&_canvas]:cursor-crosshair"),fill:"absolute inset-0",box:"h-full w-full",failed:"absolute inset-0 grid place-items-center p-6 text-center text-sm text-ink-faint",cardInline:"absolute bottom-3 left-3 right-3 z-10 max-h-[calc(100%-1.5rem)] max-w-md overflow-y-auto overscroll-contain",cardFloating:"w-[26rem] overflow-y-auto overscroll-contain",ring:"pointer-events-none rounded-full border-2 border-gray-900 bg-gray-900/15 shadow-[0_0_0_2px_var(--color-white,#fff)]",pinButton:(e,t)=>q("relative grid place-items-center rounded-full cursor-pointer",t&&(null!=e.stop?"h-7 w-7":"h-6 w-6")),pinMark:(e,t,n,r)=>{const o=t&&!r&&null==e.stop&&!e.dot;return q("grid place-items-center rounded-full border-2 font-semibold leading-none shadow-sm transition-transform motion-reduce:transition-none",!_(e.tone)&&"border-white",e.tone,e.dot?"h-4 w-4 opacity-80":null!=e.stop?"h-7 w-7 text-xs ring-2 ring-gray-900":o?"h-8 w-8 text-xs [&_svg]:h-4 [&_svg]:w-4":"h-6 w-6 text-2xs [&_svg]:h-3.5 [&_svg]:w-3.5",t&&(o?"ring-2 ring-gray-900 ring-offset-1":U),e.approximate&&"border-dashed opacity-80",e.faded&&!t&&"opacity-40",n&&"scale-125 opacity-100")},mark:e=>q("grid place-items-center border-2 px-0.5 text-xs font-semibold leading-none shadow-sm",e.stop?"h-7 min-w-7":"h-6 min-w-6",!_(e.tone??"")&&"border-white",e.tone??"bg-gray-900 text-on-accent"),groupButton:"grid place-items-center rounded-full cursor-pointer",groupDisc:(e,t,n)=>q("grid place-items-center rounded-full border-2 border-gray-700 bg-surface font-semibold leading-none text-ink-strongest shadow-sm",e?"h-7 w-full px-1 text-xs ring-2 ring-gray-900":t?"h-5 w-5 text-3xs":"h-6 w-6 text-2xs",n&&U),badge:e=>q("absolute -right-2 -top-2 grid h-4 min-w-4 place-items-center rounded-full px-0.5 text-3xs font-semibold leading-none shadow",e??"bg-surface text-ink-strongest"),iconHost:"contents"},site:{frame:e=>q("rosh-map-frame",e&&"rosh-map-frame--picking"),fill:"rosh-map-fill",box:"rosh-map-box",failed:"rosh-map-failed",cardInline:"rosh-map-card-inline",cardFloating:"rosh-map-card-floating",ring:"rosh-map-ring",pinButton:(e,t)=>q("rosh-map-target",t&&(null!=e.stop?"rosh-map-target--stop":"rosh-map-target--sized")),pinMark:(e,t,n,r)=>q("rosh-map-pin",e.dot?"rosh-map-pin--dot":null!=e.stop?"rosh-map-pin--stop":null,t&&!r&&null==e.stop&&!e.dot&&"rosh-map-pin--grown",t&&"rosh-map-pin--chosen",e.approximate&&"rosh-map-pin--approximate",e.faded&&!t&&"rosh-map-pin--faded",n&&"rosh-map-pin--pointed"),mark:e=>q("rosh-map-mark",e.stop&&"rosh-map-mark--stop"),groupButton:"rosh-map-target",groupDisc:(e,t,n)=>q("rosh-map-group",e?"rosh-map-group--stops":t?"rosh-map-group--dots":null,n&&"rosh-map-group--chosen"),badge:()=>"rosh-map-badge",iconHost:"rosh-map-icon",sheet:function(){return S??=import("efficient-shell/map-site.css").catch(e=>{throw S=null,e}),S}}},I="routes",Q=["routes-road","routes-estimate"];function G(e){const t=document.createElement("span");t.style.display="none",t.style.color=e,document.body.appendChild(t);const n=getComputedStyle(t).color||"#2563eb";return t.remove(),V(n)}function V(e){const t=document.createElement("canvas").getContext("2d");if(!t)return"#2563eb";t.fillStyle="#2563eb",t.fillStyle=e,t.fillRect(0,0,1,1);const[n,r,o]=t.getImageData(0,0,1,1).data;return`rgb(${n}, ${r}, ${o})`}var J={center:[30,20],zoom:1};var Y="http://www.w3.org/2000/svg",X=()=>window.matchMedia("(prefers-reduced-motion: reduce)").matches,ee=(...e)=>e.filter(Boolean).join(" ");function te(e){const t=document.createElementNS(Y,"svg");t.setAttribute("viewBox","0 0 24 24"),t.setAttribute("fill","none"),t.setAttribute("stroke","currentColor"),t.setAttribute("stroke-width","2"),t.setAttribute("aria-hidden","true");for(const n of e){const e=document.createElementNS(Y,"path");e.setAttribute("stroke-linecap","round"),e.setAttribute("stroke-linejoin","round"),e.setAttribute("d",n),t.appendChild(e)}return t}function ne(e,t){for(const[n,r]of Object.entries(t??{}))e.dataset[n]=r}function re({pins:n,selectedKey:r,focus:u,onSelect:m,ariaLabel:h,className:g="",children:b,routes:y,fitTo:k,attribution:v,marks:w,groupCrowded:j=!1,noun:L,highlightKey:E=null,picking:S=!1,onPick:A,card:T,cardMinMapWidth:W=480,fullScreen:F,initialView:O=J,cooperativeGestures:H=!1,look:q="portal",theme:D}){const _=a().map,U=l(null),Y=l(null),re=l(null),le=l(null),se=l([]),ie=l(/* @__PURE__ */new Map),ce=l(/* @__PURE__ */new Map),ue=l(/* @__PURE__ */new Map),de=l(null),pe=l(/* @__PURE__ */new Map),me=l(""),[he,ge]=s(!1),[fe,be]=s(!1),ye=e(),xe=D??(ye?"dark":"light"),ke=Z[q],ve=l({onSelect:m,onPick:A,picking:S,pins:n,selectedKey:r,highlightKey:E,groupCrowded:j,strings:_,noun:L,looks:ke});i(()=>{ve.current={onSelect:m,onPick:A,picking:S,pins:n,selectedKey:r,highlightKey:E,groupCrowded:j,strings:_,noun:L,looks:ke}}),i(()=>{ke.sheet?.().catch(e=>console.warn("[map] could not load the look's stylesheet",e))},[ke]);const we=c(()=>{const e=re.current,{pins:t,selectedKey:n}=ve.current,r=n?t.find(e=>e.key===n):void 0;e&&r&&!e.getBounds().contains([r.lng,r.lat])&&e.easeTo({center:[r.lng,r.lat],duration:X()?0:400})},[]),Ne=l(!1),Me=c((e,t)=>{const n=re.current,r=le.current;if(!n||!r)return;const o=n.getZoom();if(o>=17.5){const t=e.indexOf(ve.current.selectedKey??"");return void ve.current.onSelect(e[(t+1)%e.length])}const a=e.map(e=>ie.current.get(e).pin),l=new r.LngLatBounds([a[0].lng,a[0].lat],[a[0].lng,a[0].lat]);for(const e of a)l.extend([e.lng,e.lat]);const s=a.map(e=>n.project([e.lng,e.lat])),i=Math.max(...s.map((e,t)=>P(e,s.filter((e,n)=>n!==t),o))),{clientWidth:c,clientHeight:u}=n.getContainer(),d=n.cameraForBounds(l,{padding:Math.min(64,c/4,u/4)})?.zoom??18,p=document.activeElement===t;Ne.current=!0,n.once("moveend",()=>{if(Ne.current=!1,!p)return;const e=a[0].key,t=ie.current.get(e)?.button,n=t&&"none"!==t.style.display?t:[...ce.current.values()].find(t=>t.keys.includes(e))?.button;n?.focus({preventScroll:!0})}),n.easeTo({center:l.getCenter(),zoom:Math.min(18,Math.max(o+1,Math.min(d,i))),duration:X()?0:600})},[]),Ce=c(()=>{const e=re.current,t=le.current;if(!e||!t||!U.current||Ne.current&&e.isMoving())return;const{selectedKey:n,highlightKey:r,groupCrowded:o,strings:a,noun:l,looks:s}=ve.current;for(const[e,t]of ie.current){const a=s.pinMark(t.pin,e===n,e===r,o);t.mark.className!==a&&(t.mark.className=a);const l=e===n?"1":"";t.button.style.zIndex!==l&&(t.button.style.zIndex=l)}let i=null;if(o){const r=e.getContainer().getBoundingClientRect(),o=[...U.current.querySelectorAll("a[href], button, input, select, textarea, summary, [role='button'], [tabindex]:not([tabindex='-1'])")].filter(e=>!e.closest("[data-pin], [data-pin-group], .maplibregl-canvas")).map(e=>{const t=e.getBoundingClientRect(),n=e.closest("[data-map-card]")?.getBoundingClientRect()??t;return{left:Math.max(t.left,n.left)-r.left,top:Math.max(t.top,n.top)-r.top,right:Math.min(t.right,n.right)-r.left,bottom:Math.min(t.bottom,n.bottom)-r.top}}).filter(e=>e.right>e.left&&e.bottom>e.top);i=K([...ie.current.values()].map(({pin:t})=>{const n=e.project([t.lng,t.lat]);return{key:t.key,x:n.x,y:n.y,stop:t.stop??null}}),o);const c=e=>(l??a.places)(e),u=e.getZoom()<17.5?a.spread:a.cycle,d=(e,t)=>{const n=t?"":"none";e.style.display!==n&&(e.style.display=n)},p=/* @__PURE__ */new Map;for(const r of i.groups){const o=r.under>0?a.closeBy(r.under,c(r.under)):null,l=1===r.keys.length?ie.current.get(r.keys[0]):null;if(l){d(l.button,!0),l.button.setAttribute("aria-label",o?`${l.name}; ${o}`:l.name),l.button.title=o?`${l.title}\n${o}`:l.title;continue}for(const e of r.keys)d(ie.current.get(e).button,!1);const i=r.keys.join(" ");let m=ce.current.get(i);if(!m){const n=document.createElement("button");n.type="button",n.dataset.pinGroup="",n.className=s.groupButton,n.append(document.createElement("span"));const o=ie.current.get(r.keys[0]).pin,a={button:n,keys:r.keys,marker:new t.Marker({element:n,anchor:"center"}).setLngLat([o.lng,o.lat]).addTo(e)};n.addEventListener("click",e=>{e.stopPropagation(),Me(a.keys,n)}),m=a}m.keys=r.keys;const h=r.keys.map(e=>ie.current.get(e)),g=r.stops.length>0?z(r.stops):String(h.length),f=r.stops.length>0?a.stops(g):a.group(h.length,c(h.length));m.button.style.width=`${r.width}px`,m.button.style.height=`${r.height}px`,m.button.setAttribute("aria-label",`${f}: ${h.map(e=>e.pin.label).join("; ")}. ${u}${o?`; ${o}`:""}.`),m.button.title=[`${f}:`,...h.map(e=>e.title),...o?[o]:[],u].join("\n");const b=m.button.firstElementChild;b.textContent=g;const y=s.groupDisc(r.stops.length>0,h.every(e=>e.pin.dot),null!=n&&r.keys.includes(n));b.className!==y&&(b.className=y),p.set(i,m)}for(const e of i.hidden)d(ie.current.get(e).button,!1);for(const[e,t]of ce.current)p.has(e)||t.marker.remove();ce.current=p}if(de.current){const e=r&&i?i.groups.find(e=>e.keys.includes(r)&&e.keys.length>1):void 0,t=r?ie.current.get(r):void 0,n=r?ue.current.get(r):void 0,o=e?{at:ie.current.get(e.keys[0]).pin,width:e.width,height:e.height}:t?{at:t.pin,width:t.button.offsetWidth||(null!=t.pin.stop?B:R),height:t.button.offsetHeight||(null!=t.pin.stop?B:R)}:n?{at:n.mark,width:n.element.offsetWidth||B,height:n.element.offsetHeight||B}:null,a=de.current.getElement();a.style.display=o?"":"none",o&&(de.current.setLngLat([o.at.lng,o.at.lat]),a.style.width=`${o.width+22}px`,a.style.height=`${o.height+22}px`)}},[Me]);i(()=>{if(Ce(),!U.current)return;const e=new ResizeObserver(()=>Ce());e.observe(U.current);for(const t of U.current.children)t.contains(Y.current)||e.observe(t);return()=>e.disconnect()}),i(()=>{let e=!1,t=null,n=null,r=()=>{};return(async()=>{try{const o=await $();if(e||!Y.current)return;le.current=o,t=new o.Map({container:Y.current,style:x[xe],center:O.center,zoom:O.zoom,attributionControl:v?{compact:!0,customAttribution:v}:{compact:!0},dragRotate:!1,pitchWithRotate:!1,touchPitch:!1,maxPitch:0,cooperativeGestures:"coarse"===H?window.matchMedia("(pointer: coarse)").matches:H}),t.touchZoomRotate.disableRotation(),t.keyboard.disableRotation(),t.addControl(new o.NavigationControl({showCompass:!1}),"top-right");const a=document.createElement("div");a.dataset.pinRing="",a.setAttribute("aria-hidden","true"),a.className=ve.current.looks.ring,a.style.display="none",de.current=new o.Marker({element:a,anchor:"center"}).setLngLat(O.center).addTo(t),t.on("click",e=>{ve.current.picking&&ve.current.onPick?.({lat:e.lngLat.lat,lng:e.lngLat.lng})}),t.on("move",Ce),t.on("moveend",Ce),t.on("resize",Ce),t.on("error",e=>console.warn("[map]",e.error?.message)),r=f(Y.current.querySelector(".maplibregl-ctrl-attrib"));const l=t;n=new ResizeObserver(()=>{l.resize(),we()}),n.observe(Y.current),re.current=t,ge(!0)}catch(t){console.error("[map] could not start",t),e||be(!0)}})(),()=>{e=!0,n?.disconnect(),r(),se.current.forEach(e=>e.remove()),se.current=[],ce.current.forEach(e=>e.marker.remove()),ce.current.clear(),de.current?.remove(),de.current=null,t?.remove(),re.current=null}},[]);const je=l(xe);i(()=>{he&&re.current&&je.current!==xe&&(je.current=xe,re.current.setStyle(x[xe]))},[he,xe]),i(()=>{const e=re.current,t=le.current;if(!he||!e||!t)return;se.current.forEach(e=>e.remove()),se.current=[],ce.current.forEach(e=>e.marker.remove()),ce.current.clear(),ie.current.clear(),ue.current.clear();for(const e of pe.current.keys())n.some(t=>t.key===e)||pe.current.delete(e);const r=ve.current.strings;for(const o of n){const n=document.createElement("button");n.type="button",n.dataset.pin=o.key,n.className=ke.pinButton(o,j);const a=o.approximate?r.approximate(o.label):o.label,l=o.title??(o.approximate?r.approximateTitle(o.label):o.label);n.setAttribute("aria-label",a),n.title=l;const s=document.createElement("span");if(ne(s,o.data),o.dot);else if(null!=o.iconNode){const e=pe.current.get(o.key);e&&s.append(e)}else o.icon?.length?s.append(te(o.icon)):s.textContent=null!=o.stop?String(o.stop):o.glyph;if(n.append(s),o.badge){const e=document.createElement("span");e.setAttribute("aria-hidden","true"),e.className=ke.badge(o.badgeTone),e.textContent=o.badge,n.appendChild(e)}n.addEventListener("click",e=>{e.stopPropagation(),ve.current.onSelect(o.key)}),se.current.push(new t.Marker({element:n,anchor:"center"}).setLngLat([o.lng,o.lat]).addTo(e)),ie.current.set(o.key,{pin:o,button:n,mark:s,name:a,title:l})}for(const n of w??[]){const r=document.createElement("div");r.dataset.mapMark=n.key,ne(r,n.data),r.className=ke.mark(n),r.textContent=n.text,r.title=n.title??n.label,r.setAttribute("role","img"),r.setAttribute("aria-label",n.label),se.current.push(new t.Marker({element:r,anchor:"center"}).setLngLat([n.lng,n.lat]).addTo(e)),ue.current.set(n.key,{mark:n,element:r})}Ce()},[he,n,w,j,Ce,q]),i(()=>{he&&Ce()},[he,r,E,Ce]),i(()=>{if(!he||!r)return;const e=requestAnimationFrame(we);return()=>cancelAnimationFrame(e)},[he,r,we]),i(()=>{const e=re.current,t=le.current,r=k?[...n,...w??[]].filter(e=>k.includes(e.key)):n;if(!he||!e||!t||0===r.length)return;const o=r.map(e=>`${e.key}@${e.lat},${e.lng}`).sort().join("|");if(me.current===o)return;const a=""===me.current;if(me.current=o,1===r.length)return void e.jumpTo({center:[r[0].lng,r[0].lat],zoom:13});const l=new t.LngLatBounds([r[0].lng,r[0].lat],[r[0].lng,r[0].lat]);for(const e of r)l.extend([e.lng,e.lat]);e.fitBounds(l,{padding:48,maxZoom:14,animate:!a})},[he,n,w,k]),i(()=>{const e=re.current;if(!he||!e)return;const t=(y??[]).filter(e=>e.coordinates.length>=2),n=[...new Set(t.flatMap(e=>e.attribution?[e.attribution]:[]))].join(" · "),r=()=>{const r=function(){const e=document.createElement("span");e.className="text-blue-600",e.style.display="none",document.body.appendChild(e);const t=getComputedStyle(e).color||"#2563eb";return e.remove(),V(t)}(),o={type:"FeatureCollection",features:t.map(e=>({type:"Feature",properties:{key:e.key,estimate:e.estimate,faded:!!e.faded,color:e.color?G(e.color):r},geometry:{type:"LineString",coordinates:e.coordinates}}))},a=["case",["get","faded"],.25,.85],l=["get","color"],s=e.getSource(I);if(s&&(s.attribution||"")!==n){for(const t of Q)e.getLayer(t)&&e.removeLayer(t);e.removeSource(I)}const i=e.getSource(I);i?i.setData(o):e.addSource(I,{type:"geojson",data:o,...n?{attribution:n}:{}}),e.getLayer("routes-road")||e.addLayer({id:"routes-road",type:"line",source:I,filter:["!",["get","estimate"]],layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":l,"line-width":4,"line-opacity":a}}),e.getLayer("routes-estimate")||e.addLayer({id:"routes-estimate",type:"line",source:I,filter:["get","estimate"],layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":l,"line-width":3,"line-dasharray":[1.5,1.5],"line-opacity":a}})},o=()=>{try{r()}catch(e){console.debug("[map] routes wait for the style",e)}};return o(),e.on("style.load",o),e.once("idle",o),()=>{e.off("style.load",o),e.off("idle",o)}},[he,y,xe]),i(()=>{const e=re.current;if(!he||!e||!u)return;const t=n.find(e=>e.key===u.key);if(!t)return;const r=e.getZoom(),o=j?P(e.project([t.lng,t.lat]),n.filter(e=>e.key!==t.key).map(t=>e.project([t.lng,t.lat])),r):-1/0,a={center:[t.lng,t.lat],zoom:Math.min(18,Math.max(r,13,o))};X()?e.jumpTo(a):e.flyTo({...a,duration:600})},[he,u?.n]);const[Le,Ee]=s(!1);i(()=>{const e=U.current;if(!e)return;const t=()=>Ee(e.clientWidth<W);t();const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[W]);const $e=r?n.find(e=>e.key===r)??null:null,Se=$e?.key??null,Re=$e?.lng??0,Be=$e?.lat??0,Ae=he&&!Le&&null!=T&&!!$e,[ze,Te]=s(null);i(()=>{const e=re.current,t=le.current;if(!(Ae&&e&&t&&Se))return;const n=document.createElement("div");n.dataset.mapCard="",n.className=ve.current.looks.cardFloating;const r=new t.Popup({anchor:"bottom",offset:N,className:"rosh-map-card",maxWidth:"none",closeButton:!1,closeOnClick:!1,closeOnMove:!1,focusAfterOpen:!1}).setLngLat([Re,Be]).setDOMContent(n).addTo(e),o=r.getElement(),a=o.querySelector(".maplibregl-popup-content");a&&Object.assign(a.style,{padding:"0",background:"transparent",borderRadius:"0",boxShadow:"none"});const l=o.querySelector(".maplibregl-popup-tip"),s=ve.current.looks===Z.site?"var(--rosh-map-pin, #111)":"var(--color-gray-600, #4b5563)";l&&Object.assign(l.style,{borderTopColor:s,borderBottomColor:s}),Te(n);let i=!1,c=!1;const u=(t=!0)=>{if(c)return;if(e.isMoving())return void(i||(i=!0,e.once("moveend",()=>{i=!1,u()})));const{clientWidth:o,clientHeight:a}=e.getContainer(),l=function(e,t){const n=e.getBoundingClientRect().top,r=[...e.querySelectorAll(".maplibregl-ctrl-top-left > *, .maplibregl-ctrl-top-right > *"),...t?.querySelectorAll(":scope > [data-map-control]")??[]];let o=0;for(const e of r){const t=e.getBoundingClientRect();t.height>0&&(o=Math.max(o,t.bottom-n))}return o}(e.getContainer(),U.current)+8,s=`${M(a,l)}px`;n.style.maxHeight!==s&&(n.style.maxHeight=s);const d=r.getElement(),p=r.getLngLat(),{anchor:m,move:h}=C(e.project(p),{width:d.offsetWidth,height:d.offsetHeight},{width:o,height:a},l);r.options.anchor!==m&&(r.options.anchor=m,r.setLngLat(p)),!t||0===h.x&&0===h.y||e.panBy([-h.x,-h.y],{duration:X()?0:250}),Ce()},d=new ResizeObserver(()=>u());d.observe(n);const p=()=>u(),m=()=>{i||u(!1)};e.on("resize",p),e.on("moveend",m);let h=!1;const g=ie.current,f=e=>{h=n.contains(e.target)};return document.addEventListener("focusin",f),()=>{if(c=!0,d.disconnect(),e.off("resize",p),e.off("moveend",m),document.removeEventListener("focusin",f),r.remove(),Te(null),h&&(!document.activeElement||document.activeElement===document.body)){const e=g.get(Se)?.button;e&&"none"!==e.style.display&&e.focus({preventScroll:!0})}}},[Ae,Se,Re,Be,Ce]);const We=F?.active??!1,Fe=l(F?.onChange);i(()=>{Fe.current=F?.onChange}),i(()=>{if(!F)return;const e=document.documentElement;We&&!document.fullscreenElement&&e.requestFullscreen&&e.requestFullscreen().catch(()=>{}),!We&&document.fullscreenElement&&document.exitFullscreen().catch(()=>{})},[We]);const Oe=!!F;return i(()=>{if(!Oe)return;const e=()=>{document.fullscreenElement||Fe.current?.(!1)};return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[Oe]),/* @__PURE__ */d("div",{ref:U,className:ee(ke.frame(S),g),children:[
3
- /* @__PURE__ */p("div",{className:ke.fill,children:/* @__PURE__ */p("div",{ref:Y,className:ke.box,role:"region","aria-label":h})}),fe&&/* @__PURE__ */p("p",{className:ke.failed,children:_.failed}),F&&/* @__PURE__ */p(t,{"data-map-control":"",variant:"secondary",size:"sm",className:"absolute left-3 top-3 z-10",onClick:()=>F.onChange(!F.active),leftIcon:/* @__PURE__ */p(ae,{leave:F.active}),children:F.active?_.leaveFullScreen:_.fullScreen}),b,null!=T&&!Ae&&/* @__PURE__ */p("div",{"data-map-card":"",className:ke.cardInline,children:T}),Ae&&ze?o(T,ze):null,he&&/* @__PURE__ */p(oe,{pins:n,hosts:pe.current,hostClass:ke.iconHost})]})}function oe({pins:e,hosts:t,hostClass:n}){/* @__PURE__ */
2
+ import{useRootIsDark as e}from"../chunk-UPXDDO3U.js";import{Button_default as t}from"../chunk-A4ROXNUF.js";import"../chunk-TSZPGDU3.js";import{Icon as n}from"../chunk-ISVODSRP.js";import"../chunk-J75ZT2JQ.js";import{SpinnerRing as r}from"../chunk-R2VKEMZH.js";import"../chunk-CIZAUBWA.js";import"../chunk-PGN5ME7B.js";import{createShellPortal as o}from"../chunk-5QRHQCRG.js";import"../chunk-62LW225J.js";import"../chunk-TAHHZGRH.js";import"../chunk-KEFNQEXZ.js";import"../chunk-PU2GJVMG.js";import"../chunk-3FININUU.js";import"../chunk-UQYNPYF4.js";import"../chunk-MRJKZWWV.js";import"../chunk-TWVUQUUD.js";import"../chunk-5FYDNH4Y.js";import"../chunk-LNXBTK7Q.js";import{useShellStrings as a}from"../chunk-NRHG4R2Q.js";import"../chunk-C3QOHMR6.js";import{useRef as l,useState as s,useEffect as i,useCallback as c,useMemo as u}from"react";import{jsxs as d,jsx as p,Fragment as m}from"react/jsx-runtime";import{useQuery as h}from"@tanstack/react-query";var g="maplibregl-compact-show";function f(e){if(!e)return()=>{};const t=()=>!!e.classList.contains(g)&&(e.classList.remove(g),!0);if(t())return()=>{};const n=new MutationObserver(()=>{t()&&n.disconnect()});return n.observe(e,{attributes:!0,attributeFilter:["class"]}),()=>n.disconnect()}var b="https://tiles.openfreemap.org",y={connect:[b]},x={light:`${b}/styles/positron`,dark:`${b}/styles/dark`},k=20,v=12,w=480,N={center:[0,0],left:[k,0],right:[-20,0],top:[0,k],"top-left":[0,k],"top-right":[0,k],bottom:[0,-20],"bottom-left":[0,-20],"bottom-right":[0,-20]},M=(e,t=12)=>Math.max(0,Math.floor(e-t-v-k-10-16));function C(e,t,n,r=12){const o=e.y-k-r,a=n.height-e.y-k-v,l=t.height<=o||t.height>a&&o>=a,s=l?Math.max(0,t.height-o):-Math.max(0,t.height-a);let i="",c=0;return e.x-t.width/2<v?(i="-left",c=Math.max(0,v-e.x)):e.x+t.width/2>n.width-v&&(i="-right",c=-Math.max(0,e.x-(n.width-v))),{anchor:`${l?"bottom":"top"}${i}`,move:{x:c,y:s}}}var j="maplibre-gl-worker.mjs",L=e=>`/maplibre-gl/${e}/${j}`,$=null;function E(){return $??=Promise.all([import("maplibre-gl"),import("maplibre-gl/dist/maplibre-gl.css")]).then(([e])=>(e.setWorkerUrl(L(e.getVersion())),e)).catch(e=>{throw $=null,e}),$}var S=null;var A=24,R=28,B=29;function z(e){const t=[...e].sort((e,t)=>e-t),n=[];for(let e=0;e<t.length;){let r=e;for(;r+1<t.length&&t[r+1]===t[r]+1;)r++;n.push(r===e?String(t[e]):`${t[e]}–${t[r]}`),e=r+1}return n.join(", ")}function T(e){const t=Math.max(R,12+8*e.length);return t+t%2}var F=(e,t,n,r)=>({left:e-n/2,top:t-r/2,right:e+n/2,bottom:t+r/2});function O(e,t){return e.left<t.right+1&&t.left<e.right+1&&e.top<t.bottom+1&&t.top<e.bottom+1}var W=e=>F(e.x,e.y,e.width,e.height);function H(e){for(let t=0;t<e.length;t++)for(let n=t+1;n<e.length;n++)if(O(W(e[t]),W(e[n])))return[e[t],e[n]];return null}function K(e,t=[]){const n=[],r=e=>t.some(t=>O(t,e));let o=e.filter(e=>null!==e.stop).sort((e,t)=>e.stop-t.stop).map(e=>({keys:[e.key],stops:[e.stop],x:e.x,y:e.y,width:R,height:R,under:0}));for(let e=H(o);e;e=H(o)){const[t,n]=e;t.keys.push(...n.keys),t.stops.push(...n.stops),t.stops.sort((e,t)=>e-t),t.width=T(z(t.stops)),o=o.filter(e=>e!==n)}o=o.filter(e=>!r(W(e))||(n.push(...e.keys),!1));const a=[];for(const t of e){if(null!==t.stop)continue;const e=F(t.x,t.y,A,A),l=o.find(t=>O(W(t),e));if(l||r(e)){n.push(t.key),l&&l.under++;continue}const s=a.find(t=>O(W(t),e));s?s.keys.push(t.key):a.push({keys:[t.key],stops:[],x:t.x,y:t.y,width:A,height:A,under:0})}return{groups:[...o,...a],hidden:n}}function P(e,t,n){let r=-1/0;for(const o of t){const t=Math.max(Math.abs(o.x-e.x),Math.abs(o.y-e.y));r=Math.max(r,0===t?1/0:n+Math.log2(29/t))}return r}var q=(...e)=>e.filter(Boolean).join(" "),D=/^(?:\d+|[xytrblse](?:-\d+)?|solid|dashed|dotted|double|hidden|none)$/;function I(e){return e.split(/\s+/).some(e=>{const t=e.search(/[[(]/),n=t<0?e:e.slice(0,t),r=e.slice(n.lastIndexOf(":")+1);return r.startsWith("border-")&&!D.test(r.slice(7))})}var U="ring-2 ring-gray-900 ring-offset-2",_={portal:{frame:e=>q("relative min-h-72 overflow-hidden rounded-lg border border-line bg-gray-100",e&&"[&_canvas]:cursor-crosshair"),fill:"absolute inset-0",box:"h-full w-full",failed:"absolute inset-0 grid place-items-center p-6 text-center text-sm text-ink-faint",cardInline:"absolute bottom-3 left-3 right-3 z-10 max-h-[calc(100%-1.5rem)] max-w-md overflow-y-auto overscroll-contain",cardFloating:"w-[26rem] overflow-y-auto overscroll-contain",ring:"pointer-events-none rounded-full border-2 border-gray-900 bg-gray-900/15 shadow-[0_0_0_2px_var(--color-white,#fff)]",pinButton:(e,t)=>q("relative grid place-items-center rounded-full cursor-pointer",t&&(null!=e.stop?"h-7 w-7":"h-6 w-6")),pinMark:(e,t,n,r)=>{const o=t&&!r&&null==e.stop&&!e.dot;return q("grid place-items-center rounded-full border-2 font-semibold leading-none shadow-sm transition-transform motion-reduce:transition-none",!I(e.tone)&&"border-white",e.tone,e.dot?"h-4 w-4 opacity-80":null!=e.stop?"h-7 w-7 text-xs ring-2 ring-gray-900":o?"h-8 w-8 text-xs [&_svg]:h-4 [&_svg]:w-4":"h-6 w-6 text-2xs [&_svg]:h-3.5 [&_svg]:w-3.5",t&&(o?"ring-2 ring-gray-900 ring-offset-1":U),e.approximate&&"border-dashed opacity-80",e.faded&&!t&&"opacity-40",n&&"scale-125 opacity-100")},mark:e=>q("grid place-items-center border-2 px-0.5 text-xs font-semibold leading-none shadow-sm",e.stop?"h-7 min-w-7":"h-6 min-w-6",!I(e.tone??"")&&"border-white",e.tone??"bg-gray-900 text-on-accent"),groupButton:"grid place-items-center rounded-full cursor-pointer",groupDisc:(e,t,n)=>q("grid place-items-center rounded-full border-2 border-gray-700 bg-surface font-semibold leading-none text-ink-strongest shadow-sm",e?"h-7 w-full px-1 text-xs ring-2 ring-gray-900":t?"h-5 w-5 text-3xs":"h-6 w-6 text-2xs",n&&U),badge:e=>q("absolute -right-2 -top-2 grid h-4 min-w-4 place-items-center rounded-full px-0.5 text-3xs font-semibold leading-none shadow",e??"bg-surface text-ink-strongest"),iconHost:"contents"},site:{frame:e=>q("rosh-map-frame",e&&"rosh-map-frame--picking"),fill:"rosh-map-fill",box:"rosh-map-box",failed:"rosh-map-failed",cardInline:"rosh-map-card-inline",cardFloating:"rosh-map-card-floating",ring:"rosh-map-ring",pinButton:(e,t)=>q("rosh-map-target",t&&(null!=e.stop?"rosh-map-target--stop":"rosh-map-target--sized")),pinMark:(e,t,n,r)=>q("rosh-map-pin",e.dot?"rosh-map-pin--dot":null!=e.stop?"rosh-map-pin--stop":null,t&&!r&&null==e.stop&&!e.dot&&"rosh-map-pin--grown",t&&"rosh-map-pin--chosen",e.approximate&&"rosh-map-pin--approximate",e.faded&&!t&&"rosh-map-pin--faded",n&&"rosh-map-pin--pointed"),mark:e=>q("rosh-map-mark",e.stop&&"rosh-map-mark--stop"),groupButton:"rosh-map-target",groupDisc:(e,t,n)=>q("rosh-map-group",e?"rosh-map-group--stops":t?"rosh-map-group--dots":null,n&&"rosh-map-group--chosen"),badge:()=>"rosh-map-badge",iconHost:"rosh-map-icon",sheet:function(){return S??=import("efficient-shell/map-site.css").catch(e=>{throw S=null,e}),S}}},Z="routes",G=["routes-road","routes-estimate"];function Q(e){const t=document.createElement("span");t.style.display="none",t.style.color=e,document.body.appendChild(t);const n=getComputedStyle(t).color||"#2563eb";return t.remove(),V(n)}function V(e){const t=document.createElement("canvas").getContext("2d");if(!t)return"#2563eb";t.fillStyle="#2563eb",t.fillStyle=e,t.fillRect(0,0,1,1);const[n,r,o]=t.getImageData(0,0,1,1).data;return`rgb(${n}, ${r}, ${o})`}var J={center:[30,20],zoom:1};var X="http://www.w3.org/2000/svg",Y=()=>window.matchMedia("(prefers-reduced-motion: reduce)").matches,ee=(...e)=>e.filter(Boolean).join(" ");function te(e){const t=document.createElementNS(X,"svg");t.setAttribute("viewBox","0 0 24 24"),t.setAttribute("fill","none"),t.setAttribute("stroke","currentColor"),t.setAttribute("stroke-width","2"),t.setAttribute("aria-hidden","true");for(const n of e){const e=document.createElementNS(X,"path");e.setAttribute("stroke-linecap","round"),e.setAttribute("stroke-linejoin","round"),e.setAttribute("d",n),t.appendChild(e)}return t}function ne(e,t){for(const[n,r]of Object.entries(t??{}))e.dataset[n]=r}function re({pins:n,selectedKey:r,focus:u,onSelect:m,ariaLabel:h,className:g="",children:b,routes:y,fitTo:k,attribution:v,marks:w,groupCrowded:j=!1,noun:L,highlightKey:$=null,picking:S=!1,onPick:B,card:T,cardMinMapWidth:F=480,fullScreen:O,initialView:W=J,cooperativeGestures:H=!1,look:q="portal",theme:D}){const I=a().map,U=l(null),X=l(null),re=l(null),le=l(null),se=l([]),ie=l(/* @__PURE__ */new Map),ce=l(/* @__PURE__ */new Map),ue=l(/* @__PURE__ */new Map),de=l(null),pe=l(/* @__PURE__ */new Map),me=l(""),[he,ge]=s(!1),[fe,be]=s(!1),ye=e(),xe=D??(ye?"dark":"light"),ke=_[q],ve=l({onSelect:m,onPick:B,picking:S,pins:n,selectedKey:r,highlightKey:$,groupCrowded:j,strings:I,noun:L,looks:ke});i(()=>{ve.current={onSelect:m,onPick:B,picking:S,pins:n,selectedKey:r,highlightKey:$,groupCrowded:j,strings:I,noun:L,looks:ke}}),i(()=>{ke.sheet?.().catch(e=>console.warn("[map] could not load the look's stylesheet",e))},[ke]);const we=c(()=>{const e=re.current,{pins:t,selectedKey:n}=ve.current,r=n?t.find(e=>e.key===n):void 0;e&&r&&!e.getBounds().contains([r.lng,r.lat])&&e.easeTo({center:[r.lng,r.lat],duration:Y()?0:400})},[]),Ne=l(!1),Me=c((e,t)=>{const n=re.current,r=le.current;if(!n||!r)return;const o=n.getZoom();if(o>=17.5){const t=e.indexOf(ve.current.selectedKey??"");return void ve.current.onSelect(e[(t+1)%e.length])}const a=e.map(e=>ie.current.get(e).pin),l=new r.LngLatBounds([a[0].lng,a[0].lat],[a[0].lng,a[0].lat]);for(const e of a)l.extend([e.lng,e.lat]);const s=a.map(e=>n.project([e.lng,e.lat])),i=Math.max(...s.map((e,t)=>P(e,s.filter((e,n)=>n!==t),o))),{clientWidth:c,clientHeight:u}=n.getContainer(),d=n.cameraForBounds(l,{padding:Math.min(64,c/4,u/4)})?.zoom??18,p=document.activeElement===t;Ne.current=!0,n.once("moveend",()=>{if(Ne.current=!1,!p)return;const e=a[0].key,t=ie.current.get(e)?.button,n=t&&"none"!==t.style.display?t:[...ce.current.values()].find(t=>t.keys.includes(e))?.button;n?.focus({preventScroll:!0})}),n.easeTo({center:l.getCenter(),zoom:Math.min(18,Math.max(o+1,Math.min(d,i))),duration:Y()?0:600})},[]),Ce=c(()=>{const e=re.current,t=le.current;if(!e||!t||!U.current||Ne.current&&e.isMoving())return;const{selectedKey:n,highlightKey:r,groupCrowded:o,strings:a,noun:l,looks:s}=ve.current;for(const[e,t]of ie.current){const a=s.pinMark(t.pin,e===n,e===r,o);t.mark.className!==a&&(t.mark.className=a);const l=e===n?"1":"";t.button.style.zIndex!==l&&(t.button.style.zIndex=l)}let i=null;if(o){const r=e.getContainer().getBoundingClientRect(),o=[...U.current.querySelectorAll("a[href], button, input, select, textarea, summary, [role='button'], [tabindex]:not([tabindex='-1'])")].filter(e=>!e.closest("[data-pin], [data-pin-group], .maplibregl-canvas")).map(e=>{const t=e.getBoundingClientRect(),n=e.closest("[data-map-card]")?.getBoundingClientRect()??t;return{left:Math.max(t.left,n.left)-r.left,top:Math.max(t.top,n.top)-r.top,right:Math.min(t.right,n.right)-r.left,bottom:Math.min(t.bottom,n.bottom)-r.top}}).filter(e=>e.right>e.left&&e.bottom>e.top);i=K([...ie.current.values()].map(({pin:t})=>{const n=e.project([t.lng,t.lat]);return{key:t.key,x:n.x,y:n.y,stop:t.stop??null}}),o);const c=e=>(l??a.places)(e),u=e.getZoom()<17.5?a.spread:a.cycle,d=(e,t)=>{const n=t?"":"none";e.style.display!==n&&(e.style.display=n)},p=/* @__PURE__ */new Map;for(const r of i.groups){const o=r.under>0?a.closeBy(r.under,c(r.under)):null,l=1===r.keys.length?ie.current.get(r.keys[0]):null;if(l){d(l.button,!0),l.button.setAttribute("aria-label",o?`${l.name}; ${o}`:l.name),l.button.title=o?`${l.title}\n${o}`:l.title;continue}for(const e of r.keys)d(ie.current.get(e).button,!1);const i=r.keys.join(" ");let m=ce.current.get(i);if(!m){const n=document.createElement("button");n.type="button",n.dataset.pinGroup="",n.className=s.groupButton,n.append(document.createElement("span"));const o=ie.current.get(r.keys[0]).pin,a={button:n,keys:r.keys,marker:new t.Marker({element:n,anchor:"center"}).setLngLat([o.lng,o.lat]).addTo(e)};n.addEventListener("click",e=>{e.stopPropagation(),Me(a.keys,n)}),m=a}m.keys=r.keys;const h=r.keys.map(e=>ie.current.get(e)),g=r.stops.length>0?z(r.stops):String(h.length),f=r.stops.length>0?a.stops(g):a.group(h.length,c(h.length));m.button.style.width=`${r.width}px`,m.button.style.height=`${r.height}px`,m.button.setAttribute("aria-label",`${f}: ${h.map(e=>e.pin.label).join("; ")}. ${u}${o?`; ${o}`:""}.`),m.button.title=[`${f}:`,...h.map(e=>e.title),...o?[o]:[],u].join("\n");const b=m.button.firstElementChild;b.textContent=g;const y=s.groupDisc(r.stops.length>0,h.every(e=>e.pin.dot),null!=n&&r.keys.includes(n));b.className!==y&&(b.className=y),p.set(i,m)}for(const e of i.hidden)d(ie.current.get(e).button,!1);for(const[e,t]of ce.current)p.has(e)||t.marker.remove();ce.current=p}if(de.current){const e=r&&i?i.groups.find(e=>e.keys.includes(r)&&e.keys.length>1):void 0,t=r?ie.current.get(r):void 0,n=r?ue.current.get(r):void 0,o=e?{at:ie.current.get(e.keys[0]).pin,width:e.width,height:e.height}:t?{at:t.pin,width:t.button.offsetWidth||(null!=t.pin.stop?R:A),height:t.button.offsetHeight||(null!=t.pin.stop?R:A)}:n?{at:n.mark,width:n.element.offsetWidth||R,height:n.element.offsetHeight||R}:null,a=de.current.getElement();a.style.display=o?"":"none",o&&(de.current.setLngLat([o.at.lng,o.at.lat]),a.style.width=`${o.width+22}px`,a.style.height=`${o.height+22}px`)}},[Me]);i(()=>{if(Ce(),!U.current)return;const e=new ResizeObserver(()=>Ce());e.observe(U.current);for(const t of U.current.children)t.contains(X.current)||e.observe(t);return()=>e.disconnect()}),i(()=>{let e=!1,t=null,n=null,r=()=>{};return(async()=>{try{const o=await E();if(e||!X.current)return;le.current=o,t=new o.Map({container:X.current,style:x[xe],center:W.center,zoom:W.zoom,attributionControl:v?{compact:!0,customAttribution:v}:{compact:!0},dragRotate:!1,pitchWithRotate:!1,touchPitch:!1,maxPitch:0,cooperativeGestures:"coarse"===H?window.matchMedia("(pointer: coarse)").matches:H}),t.touchZoomRotate.disableRotation(),t.keyboard.disableRotation(),t.addControl(new o.NavigationControl({showCompass:!1}),"top-right");const a=document.createElement("div");a.dataset.pinRing="",a.setAttribute("aria-hidden","true"),a.className=ve.current.looks.ring,a.style.display="none",de.current=new o.Marker({element:a,anchor:"center"}).setLngLat(W.center).addTo(t),t.on("click",e=>{ve.current.picking&&ve.current.onPick?.({lat:e.lngLat.lat,lng:e.lngLat.lng})}),t.on("move",Ce),t.on("moveend",Ce),t.on("resize",Ce),t.on("error",e=>console.warn("[map]",e.error?.message)),r=f(X.current.querySelector(".maplibregl-ctrl-attrib"));const l=t;n=new ResizeObserver(()=>{l.resize(),we()}),n.observe(X.current),re.current=t,ge(!0)}catch(t){console.error("[map] could not start",t),e||be(!0)}})(),()=>{e=!0,n?.disconnect(),r(),se.current.forEach(e=>e.remove()),se.current=[],ce.current.forEach(e=>e.marker.remove()),ce.current.clear(),de.current?.remove(),de.current=null,t?.remove(),re.current=null}},[]);const je=l(xe);i(()=>{he&&re.current&&je.current!==xe&&(je.current=xe,re.current.setStyle(x[xe]))},[he,xe]),i(()=>{const e=re.current,t=le.current;if(!he||!e||!t)return;se.current.forEach(e=>e.remove()),se.current=[],ce.current.forEach(e=>e.marker.remove()),ce.current.clear(),ie.current.clear(),ue.current.clear();for(const e of pe.current.keys())n.some(t=>t.key===e)||pe.current.delete(e);const r=ve.current.strings;for(const o of n){const n=document.createElement("button");n.type="button",n.dataset.pin=o.key,n.className=ke.pinButton(o,j);const a=o.approximate?r.approximate(o.label):o.label,l=o.title??(o.approximate?r.approximateTitle(o.label):o.label);n.setAttribute("aria-label",a),n.title=l;const s=document.createElement("span");if(ne(s,o.data),o.dot);else if(null!=o.iconNode){const e=pe.current.get(o.key);e&&s.append(e)}else o.icon?.length?s.append(te(o.icon)):s.textContent=null!=o.stop?String(o.stop):o.glyph;if(n.append(s),o.badge){const e=document.createElement("span");e.setAttribute("aria-hidden","true"),e.className=ke.badge(o.badgeTone),e.textContent=o.badge,n.appendChild(e)}n.addEventListener("click",e=>{e.stopPropagation(),ve.current.onSelect(o.key)}),se.current.push(new t.Marker({element:n,anchor:"center"}).setLngLat([o.lng,o.lat]).addTo(e)),ie.current.set(o.key,{pin:o,button:n,mark:s,name:a,title:l})}for(const n of w??[]){const r=document.createElement("div");r.dataset.mapMark=n.key,ne(r,n.data),r.className=ke.mark(n),r.textContent=n.text,r.title=n.title??n.label,r.setAttribute("role","img"),r.setAttribute("aria-label",n.label),se.current.push(new t.Marker({element:r,anchor:"center"}).setLngLat([n.lng,n.lat]).addTo(e)),ue.current.set(n.key,{mark:n,element:r})}Ce()},[he,n,w,j,Ce,q]),i(()=>{he&&Ce()},[he,r,$,Ce]),i(()=>{if(!he||!r)return;const e=requestAnimationFrame(we);return()=>cancelAnimationFrame(e)},[he,r,we]),i(()=>{const e=re.current,t=le.current,r=k?[...n,...w??[]].filter(e=>k.includes(e.key)):n;if(!he||!e||!t||0===r.length)return;const o=r.map(e=>`${e.key}@${e.lat},${e.lng}`).sort().join("|");if(me.current===o)return;const a=""===me.current;if(me.current=o,1===r.length)return void e.jumpTo({center:[r[0].lng,r[0].lat],zoom:13});const l=new t.LngLatBounds([r[0].lng,r[0].lat],[r[0].lng,r[0].lat]);for(const e of r)l.extend([e.lng,e.lat]);e.fitBounds(l,{padding:48,maxZoom:14,animate:!a})},[he,n,w,k]),i(()=>{const e=re.current;if(!he||!e)return;const t=(y??[]).filter(e=>e.coordinates.length>=2),n=[...new Set(t.flatMap(e=>e.attribution?[e.attribution]:[]))].join(" · "),r=()=>{const r=function(){const e=document.createElement("span");e.className="text-blue-600",e.style.display="none",document.body.appendChild(e);const t=getComputedStyle(e).color||"#2563eb";return e.remove(),V(t)}(),o={type:"FeatureCollection",features:t.map(e=>({type:"Feature",properties:{key:e.key,estimate:e.estimate,faded:!!e.faded,color:e.color?Q(e.color):r},geometry:{type:"LineString",coordinates:e.coordinates}}))},a=["case",["get","faded"],.25,.85],l=["get","color"],s=e.getSource(Z);if(s&&(s.attribution||"")!==n){for(const t of G)e.getLayer(t)&&e.removeLayer(t);e.removeSource(Z)}const i=e.getSource(Z);i?i.setData(o):e.addSource(Z,{type:"geojson",data:o,...n?{attribution:n}:{}}),e.getLayer("routes-road")||e.addLayer({id:"routes-road",type:"line",source:Z,filter:["!",["get","estimate"]],layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":l,"line-width":4,"line-opacity":a}}),e.getLayer("routes-estimate")||e.addLayer({id:"routes-estimate",type:"line",source:Z,filter:["get","estimate"],layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":l,"line-width":3,"line-dasharray":[1.5,1.5],"line-opacity":a}})},o=()=>{try{r()}catch(e){console.debug("[map] routes wait for the style",e)}};return o(),e.on("style.load",o),e.once("idle",o),()=>{e.off("style.load",o),e.off("idle",o)}},[he,y,xe]),i(()=>{const e=re.current;if(!he||!e||!u)return;const t=n.find(e=>e.key===u.key);if(!t)return;const r=e.getZoom(),o=j?P(e.project([t.lng,t.lat]),n.filter(e=>e.key!==t.key).map(t=>e.project([t.lng,t.lat])),r):-1/0,a={center:[t.lng,t.lat],zoom:Math.min(18,Math.max(r,13,o))};Y()?e.jumpTo(a):e.flyTo({...a,duration:600})},[he,u?.n]);const[Le,$e]=s(!1);i(()=>{const e=U.current;if(!e)return;const t=()=>$e(e.clientWidth<F);t();const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[F]);const Ee=r?n.find(e=>e.key===r)??null:null,Se=Ee?.key??null,Ae=Ee?.lng??0,Re=Ee?.lat??0,Be=he&&!Le&&null!=T&&!!Ee,[ze,Te]=s(null);i(()=>{const e=re.current,t=le.current;if(!(Be&&e&&t&&Se))return;const n=document.createElement("div");n.dataset.mapCard="",n.className=ve.current.looks.cardFloating;const r=new t.Popup({anchor:"bottom",offset:N,className:"rosh-map-card",maxWidth:"none",closeButton:!1,closeOnClick:!1,closeOnMove:!1,focusAfterOpen:!1}).setLngLat([Ae,Re]).setDOMContent(n).addTo(e),o=r.getElement(),a=o.querySelector(".maplibregl-popup-content");a&&Object.assign(a.style,{padding:"0",background:"transparent",borderRadius:"0",boxShadow:"none"});const l=o.querySelector(".maplibregl-popup-tip"),s=ve.current.looks===_.site?"var(--rosh-map-pin, #111)":"var(--color-gray-600, #4b5563)";l&&Object.assign(l.style,{borderTopColor:s,borderBottomColor:s}),Te(n);let i=!1,c=!1;const u=(t=!0)=>{if(c)return;if(e.isMoving())return void(i||(i=!0,e.once("moveend",()=>{i=!1,u()})));const{clientWidth:o,clientHeight:a}=e.getContainer(),l=function(e,t){const n=e.getBoundingClientRect().top,r=[...e.querySelectorAll(".maplibregl-ctrl-top-left > *, .maplibregl-ctrl-top-right > *"),...t?.querySelectorAll(":scope > [data-map-control]")??[]];let o=0;for(const e of r){const t=e.getBoundingClientRect();t.height>0&&(o=Math.max(o,t.bottom-n))}return o}(e.getContainer(),U.current)+8,s=`${M(a,l)}px`;n.style.maxHeight!==s&&(n.style.maxHeight=s);const d=r.getElement(),p=r.getLngLat(),{anchor:m,move:h}=C(e.project(p),{width:d.offsetWidth,height:d.offsetHeight},{width:o,height:a},l);r.options.anchor!==m&&(r.options.anchor=m,r.setLngLat(p)),!t||0===h.x&&0===h.y||e.panBy([-h.x,-h.y],{duration:Y()?0:250}),Ce()},d=new ResizeObserver(()=>u());d.observe(n);const p=()=>u(),m=()=>{i||u(!1)};e.on("resize",p),e.on("moveend",m);let h=!1;const g=ie.current,f=e=>{h=n.contains(e.target)};return document.addEventListener("focusin",f),()=>{if(c=!0,d.disconnect(),e.off("resize",p),e.off("moveend",m),document.removeEventListener("focusin",f),r.remove(),Te(null),h&&(!document.activeElement||document.activeElement===document.body)){const e=g.get(Se)?.button;e&&"none"!==e.style.display&&e.focus({preventScroll:!0})}}},[Be,Se,Ae,Re,Ce]);const Fe=O?.active??!1,Oe=l(O?.onChange);i(()=>{Oe.current=O?.onChange}),i(()=>{if(!O)return;const e=document.documentElement;Fe&&!document.fullscreenElement&&e.requestFullscreen&&e.requestFullscreen().catch(()=>{}),!Fe&&document.fullscreenElement&&document.exitFullscreen().catch(()=>{})},[Fe]);const We=!!O;return i(()=>{if(!We)return;const e=()=>{document.fullscreenElement||Oe.current?.(!1)};return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[We]),/* @__PURE__ */d("div",{ref:U,className:ee(ke.frame(S),g),children:[
3
+ /* @__PURE__ */p("div",{className:ke.fill,children:/* @__PURE__ */p("div",{ref:X,className:ke.box,role:"region","aria-label":h})}),fe&&/* @__PURE__ */p("p",{className:ke.failed,children:I.failed}),O&&/* @__PURE__ */p(t,{"data-map-control":"",variant:"secondary",size:"sm",className:"absolute left-3 top-3 z-10",onClick:()=>O.onChange(!O.active),leftIcon:/* @__PURE__ */p(ae,{leave:O.active}),children:O.active?I.leaveFullScreen:I.fullScreen}),b,null!=T&&!Be&&/* @__PURE__ */p("div",{"data-map-card":"",className:ke.cardInline,children:T}),Be&&ze?o(T,ze):null,he&&/* @__PURE__ */p(oe,{pins:n,hosts:pe.current,hostClass:ke.iconHost})]})}function oe({pins:e,hosts:t,hostClass:n}){/* @__PURE__ */
4
4
  return p(m,{children:e.map(e=>{if(null==e.iconNode||e.dot)return null;let r=t.get(e.key);return r||(r=document.createElement("span"),r.className=n,t.set(e.key,r)),o(e.iconNode,r,e.key)})})}function ae({leave:e}){/* @__PURE__ */
5
5
  return p(n,e?{name:"collapse","aria-hidden":"true",className:"h-4 w-4",strokeWidth:2}:{name:"expand","aria-hidden":"true",className:"h-4 w-4",strokeWidth:2})}function le(){const[e,t]=s(null);return{highlightKey:e,pointAt:c(e=>{const n=()=>t(e),r=()=>t(t=>t===e?null:t);return{onMouseEnter:n,onMouseLeave:r,onFocus:n,onBlur:r}},[])}}var se=3e3,ie=e=>!!e?.pending&&3e3,ce=e=>`${e.kind}:${e.id}`,ue=e=>("located"===e.placement||"approximate"===e.placement)&&null!=e.lat&&null!=e.lng;function de(e){switch(e){case"located":return null;case"approximate":return"Approximate: only the suburb or postcode matched";case"pending":return"Locating";case"not_found":return"Not on the map: address not found";case"failed":return"Not on the map: the map service could not be reached";case"no_address":return"Not on the map: no city or postcode"}}var pe={importer:{label:"Importer",tone:"bg-sky-600 text-white"},dealer:{label:"Dealer",tone:"bg-purple-600 text-white"},retail:{label:"Retail",tone:"bg-green-600 text-white"},supplier:{label:"Supplier",tone:"bg-sky-600 text-white"},delivery_location:{label:"Delivery location",tone:"bg-amber-600 text-white"},warehouse:{label:"Warehouse",tone:"bg-amber-600 text-white"}},me=["importer","dealer","retail","supplier","delivery_location","warehouse"];function he(e){return"supplier"===e.kind?"supplier":"customer"===e.kind?e.category||"importer":e.kind}var ge=(e,t=pe)=>t[e]?.tone??"bg-gray-700 text-white",fe=(e,t=pe)=>t[e]?.label??e,be=(e,t)=>ge(he(e),t);function ye(e,t,n=pe){return null!=t?String(t):(n[he(e)]?.label??"").charAt(0).toUpperCase()}var xe=["delivery_location","warehouse"];function ke(e,t=xe){const n=/* @__PURE__ */new Map;let r=0;for(const o of e)t.includes(o.kind)&&n.set(ce(o),++r);return n}function ve(e){const t={onMap:0,approximate:0,pending:0,off:0};for(const n of e)ue(n)?(t.onMap+=1,"approximate"===n.placement&&(t.approximate+=1)):"pending"===n.placement?t.pending+=1:t.off+=1;return t}function we(e){const t=[`${e.onMap} on the map`];return e.approximate&&t.push(`${e.approximate} approximate`),e.pending&&t.push(`${e.pending} locating`),e.off&&t.push(`${e.off} not on the map`),t.join(" · ")}function Ne(e){const t=[...new Set(e.filter(ue).map(he))];return[...me.filter(e=>t.includes(e)),...t.filter(e=>!me.includes(e))]}function Me(e,t){return e.filter(e=>!ue(e)&&"pending"!==e.placement).map(e=>{const n=t?.get(ce(e)),r=de(e.placement)?.replace(/^Not on the map: /,"")??"";return{key:ce(e),text:`${null!=n?`${n}. `:""}${e.label}: ${r}`}})}function Ce({categories:e,palette:t=pe,floating:n=!0}){return e.length<2?null:/* @__PURE__ */p("div",{className:(n?"absolute left-3 top-3 z-10 ":"")+"flex flex-wrap gap-x-3 gap-y-1 rounded-lg border border-line bg-surface px-3 py-2 text-xs text-gray-600 shadow-sm",children:e.map(e=>/* @__PURE__ */d("span",{className:"inline-flex items-center gap-2",children:[
6
6
  /* @__PURE__ */p("span",{"aria-hidden":!0,className:`h-2.5 w-2.5 rounded-full ${ge(e,t)}`}),fe(e,t)]},e))})}function je({point:e,number:r,onOpen:o,onClose:l,palette:s=pe}){const i=de(e.placement),c=he(e),u=a().map;/* @__PURE__ */
@@ -10,12 +10,12 @@ return d("section",{"aria-label":u.chosen(e.label),className:"absolute bottom-3
10
10
  /* @__PURE__ */d("h3",{className:"text-sm font-semibold text-gray-900 [overflow-wrap:anywhere]",children:[null!=r&&/* @__PURE__ */d("span",{className:"mr-1 text-gray-400",children:[r,"."]}),e.label,e.code&&/* @__PURE__ */p("span",{className:"ml-2 text-xs font-normal text-ink-faintest",children:e.code})]}),
11
11
  /* @__PURE__ */p("p",{className:"text-xs text-gray-500",children:s[c]?fe(c,s):e.category})]}),
12
12
  /* @__PURE__ */p("button",{type:"button",onClick:l,"aria-label":u.closeCard,className:"rounded p-0.5 text-gray-400 hover:text-gray-600",children:/* @__PURE__ */p(n,{name:"close","aria-hidden":!0,className:"h-4 w-4",strokeWidth:2})})]}),
13
- /* @__PURE__ */p("p",{className:"text-sm text-gray-700 [overflow-wrap:anywhere]",children:e.address||"—"}),i&&/* @__PURE__ */p("p",{className:"text-xs text-gray-500",children:i}),e.matched&&"approximate"===e.placement&&/* @__PURE__ */d("p",{className:"text-xs text-gray-400 [overflow-wrap:anywhere]",children:["Placed at: ",e.matched]}),o&&/* @__PURE__ */p("div",{className:"flex justify-end",children:/* @__PURE__ */p(t,{variant:"secondary",size:"sm",onClick:o,children:u.openRecord})})]})}function Le(e,t,{staleTime:n}={}){return h({queryKey:e,queryFn:t,staleTime:n,refetchInterval:e=>ie(e.state.data)})}function Ee({queryKey:e,queryFn:t,refreshSignal:n,onOpen:o,ariaLabel:a,title:c="Locations",palette:m=pe,numbers:h,className:g="",mapClassName:f="min-h-[240px] flex-1"}){const{data:b,isError:y,refetch:x}=Le(e,t,{staleTime:0}),k=l(!1);i(()=>{k.current?x():k.current=!0},[n]);const[v,w]=s(null),N=u(()=>b?.points??[],[b]),M=u(()=>h??ke(N),[h,N]),C=u(()=>N.filter(ue).map(e=>({key:ce(e),label:e.label,lat:e.lat,lng:e.lng,glyph:ye(e,M.get(ce(e))??null,m),tone:be(e,m),approximate:"approximate"===e.placement})),[N,M,m]),j=u(()=>Me(N,M),[N,M]),L=u(()=>Ne(N),[N]),E=b?.pending??0,$=N.find(e=>ce(e)===v)??null,S=$&&o?o($):null;/* @__PURE__ */
13
+ /* @__PURE__ */p("p",{className:"text-sm text-gray-700 [overflow-wrap:anywhere]",children:e.address||"—"}),i&&/* @__PURE__ */p("p",{className:"text-xs text-gray-500",children:i}),e.matched&&"approximate"===e.placement&&/* @__PURE__ */d("p",{className:"text-xs text-gray-400 [overflow-wrap:anywhere]",children:["Placed at: ",e.matched]}),o&&/* @__PURE__ */p("div",{className:"flex justify-end",children:/* @__PURE__ */p(t,{variant:"secondary",size:"sm",onClick:o,children:u.openRecord})})]})}function Le(e,t,{staleTime:n}={}){return h({queryKey:e,queryFn:t,staleTime:n,refetchInterval:e=>ie(e.state.data)})}function $e({queryKey:e,queryFn:t,refreshSignal:n,onOpen:o,ariaLabel:a,title:c="Locations",palette:m=pe,numbers:h,className:g="",mapClassName:f="min-h-[240px] flex-1"}){const{data:b,isError:y,refetch:x}=Le(e,t,{staleTime:0}),k=l(!1);i(()=>{k.current?x():k.current=!0},[n]);const[v,w]=s(null),N=u(()=>b?.points??[],[b]),M=u(()=>h??ke(N),[h,N]),C=u(()=>N.filter(ue).map(e=>({key:ce(e),label:e.label,lat:e.lat,lng:e.lng,glyph:ye(e,M.get(ce(e))??null,m),tone:be(e,m),approximate:"approximate"===e.placement})),[N,M,m]),j=u(()=>Me(N,M),[N,M]),L=u(()=>Ne(N),[N]),$=b?.pending??0,E=N.find(e=>ce(e)===v)??null,S=E&&o?o(E):null;/* @__PURE__ */
14
14
  return d("section",{"aria-label":c,className:`flex min-w-0 flex-col ${g}`,children:[
15
15
  /* @__PURE__ */d("div",{className:"flex min-h-[30px] items-center justify-between mb-2",children:[
16
16
  /* @__PURE__ */p("h3",{className:"text-sm font-semibold text-gray-900",children:c}),b&&/* @__PURE__ */p("span",{className:"text-xs text-gray-500",children:we(ve(N))})]}),
17
17
  /* @__PURE__ */d(re,{pins:C,selectedKey:v,focus:null,onSelect:w,ariaLabel:a,className:f,children:[
18
18
  /* @__PURE__ */d("div",{className:"absolute left-3 top-3 z-10 flex max-w-[70%] flex-col items-start gap-2",children:[
19
19
  /* @__PURE__ */p(Ce,{categories:L,palette:m,floating:!1}),y&&/* @__PURE__ */d("div",{className:"flex items-center gap-2 rounded-lg border border-line bg-surface px-3 min-h-8 py-1 text-xs text-gray-600 shadow-sm",children:["Couldn’t load the locations.",
20
- /* @__PURE__ */p("button",{type:"button",onClick:()=>{x()},className:"font-medium text-blue-600 hover:text-blue-800 hover:underline",children:"Try again"})]}),!y&&(E>0||j.length>0)&&/* @__PURE__ */d("div",{className:"max-w-full space-y-0.5 rounded-lg border border-line bg-surface px-3 py-2 text-xs shadow-sm","aria-live":"polite",children:[E>0&&/* @__PURE__ */d("p",{className:"flex items-center gap-2 text-ink-faint",children:[
21
- /* @__PURE__ */p(r,{}),"Locating ",E," address",1===E?"":"es"]}),j.slice(0,3).map(e=>/* @__PURE__ */p("p",{className:"truncate text-amber-700",title:e.text,children:e.text},e.key)),j.length>3&&/* @__PURE__ */d("p",{className:"text-gray-500",children:["+",j.length-3," more not on the map"]})]})]}),$&&/* @__PURE__ */p(je,{point:$,number:M.get(ce($))??null,onOpen:S,onClose:()=>w(null),palette:m})]})]})}export{w as CARD_MIN_MAP_WIDTH,g as COMPACT_SHOW,re as EntityMap,Ee as LocationsMap,j as MAPLIBRE_WORKER_FILE,A as MAP_APART_PX,pe as MAP_CATEGORIES,y as MAP_CSP_SOURCES,Z as MAP_LOOKS,B as MAP_STOP_PX,x as MAP_STYLE_URLS,R as MAP_TARGET_PX,b as MAP_TILE_ORIGIN,Ce as MapLegend,se as PENDING_POLL_MS,xe as SECONDARY_KINDS,je as SelectedCard,M as cardMaxHeight,fe as categoryLabel,ge as categoryTone,f as foldAttributionOnce,ue as isOnMap,K as layoutPins,Ne as legendCategories,$ as loadMapLibre,ke as locationNumbers,L as mapLibreWorkerUrl,ie as mapPointsRefetchInterval,Me as offMapNotes,he as pinCategory,ye as pinGlyph,be as pinTone,C as placeCard,de as placementNote,ce as pointKey,z as stopsLabel,ve as summarize,we as summaryText,le as useMapHighlight,Le as useMapPoints,P as zoomApart};
20
+ /* @__PURE__ */p("button",{type:"button",onClick:()=>{x()},className:"font-medium text-blue-600 hover:text-blue-800 hover:underline",children:"Try again"})]}),!y&&($>0||j.length>0)&&/* @__PURE__ */d("div",{className:"max-w-full space-y-0.5 rounded-lg border border-line bg-surface px-3 py-2 text-xs shadow-sm","aria-live":"polite",children:[$>0&&/* @__PURE__ */d("p",{className:"flex items-center gap-2 text-ink-faint",children:[
21
+ /* @__PURE__ */p(r,{}),"Locating ",$," address",1===$?"":"es"]}),j.slice(0,3).map(e=>/* @__PURE__ */p("p",{className:"truncate text-amber-700",title:e.text,children:e.text},e.key)),j.length>3&&/* @__PURE__ */d("p",{className:"text-gray-500",children:["+",j.length-3," more not on the map"]})]})]}),E&&/* @__PURE__ */p(je,{point:E,number:M.get(ce(E))??null,onOpen:S,onClose:()=>w(null),palette:m})]})]})}export{w as CARD_MIN_MAP_WIDTH,g as COMPACT_SHOW,re as EntityMap,$e as LocationsMap,j as MAPLIBRE_WORKER_FILE,B as MAP_APART_PX,pe as MAP_CATEGORIES,y as MAP_CSP_SOURCES,_ as MAP_LOOKS,R as MAP_STOP_PX,x as MAP_STYLE_URLS,A as MAP_TARGET_PX,b as MAP_TILE_ORIGIN,Ce as MapLegend,se as PENDING_POLL_MS,xe as SECONDARY_KINDS,je as SelectedCard,M as cardMaxHeight,fe as categoryLabel,ge as categoryTone,f as foldAttributionOnce,ue as isOnMap,K as layoutPins,Ne as legendCategories,E as loadMapLibre,ke as locationNumbers,L as mapLibreWorkerUrl,ie as mapPointsRefetchInterval,Me as offMapNotes,he as pinCategory,ye as pinGlyph,be as pinTone,C as placeCard,de as placementNote,ce as pointKey,z as stopsLabel,ve as summarize,we as summaryText,le as useMapHighlight,Le as useMapPoints,P as zoomApart};
@@ -0,0 +1,26 @@
1
+ /** A run of options under a heading. Groups do not nest. */
2
+ interface OptionGroup<T> {
3
+ /**
4
+ * The group's name: its heading, and what a screen reader calls the
5
+ * `role="group"`. With `hideHeading` only the second.
6
+ */
7
+ label: string;
8
+ options: T[];
9
+ /**
10
+ * Draw no heading. The group keeps its name for a screen reader
11
+ * (`aria-label` from `label`), and when an option comes before it in the
12
+ * list, a thin line (`PopupMenuDivider`) is drawn above its first option in
13
+ * place of the words. The line is decorative: no option, no key stop. A
14
+ * group with a heading gets no line, since the heading divides already. A
15
+ * group with no heading and no options draws nothing, and the line is drawn
16
+ * only when an option comes before the group, so no line is ever first or
17
+ * last, nor two together (a search that empties a group drops it the same
18
+ * way). The native list (`<optgroup>`, a `Select` on touch)
19
+ * cannot hide a label and shows it.
20
+ */
21
+ hideHeading?: boolean;
22
+ }
23
+ /** One entry of a list: an option, or a group of them. */
24
+ type OptionItem<T> = T | OptionGroup<T>;
25
+
26
+ export type { OptionGroup as O, OptionItem as a };
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import{TabStrip as e}from"../chunk-SXNT73VT.js";import{useShellLanguage as t}from"../chunk-GKYGPCGL.js";import"../chunk-TJ5YMXVB.js";import{confirm as n}from"../chunk-NJJG2VAW.js";import"../chunk-T43ATI2N.js";import"../chunk-ABAUJLI4.js";import"../chunk-CJ4OEY3T.js";import"../chunk-AVUH35GW.js";import"../chunk-LPQQNPH5.js";import"../chunk-VWGWZY7A.js";import"../chunk-DBQNYJZ6.js";import"../chunk-F3ZOO23R.js";import"../chunk-DWGYC7OD.js";import"../chunk-QZYV4TDD.js";import"../chunk-3HPCQMYH.js";import"../chunk-URHGHXDN.js";import"../chunk-5QFPTDQF.js";import"../chunk-J43RRDEP.js";import"../chunk-ISVODSRP.js";import"../chunk-J75ZT2JQ.js";import"../chunk-BWJZTHZ6.js";import"../chunk-2MUZFHZW.js";import"../chunk-PGN5ME7B.js";import"../chunk-52YTUQW3.js";import"../chunk-62LW225J.js";import"../chunk-TAHHZGRH.js";import"../chunk-KEFNQEXZ.js";import{useBrowserLayoutEffect as r}from"../chunk-PU2GJVMG.js";import"../chunk-UMLXFQVC.js";import"../chunk-UQYNPYF4.js";import"../chunk-TWVUQUUD.js";import"../chunk-5FYDNH4Y.js";import"../chunk-LNXBTK7Q.js";import{useShellStrings as i}from"../chunk-NRHG4R2Q.js";import"../chunk-C3QOHMR6.js";import*as c from"react";import{createContext as s,memo as l,useRef as o,useEffect as a,useMemo as u,useId as y,useCallback as d,useReducer as p,useState as k,useContext as f}from"react";import{useLocation as m,useNavigate as h}from"react-router-dom";import{jsx as b,Fragment as v,jsxs as g}from"react/jsx-runtime";var j=s(null),T=s(null),N=12;var F=(e,t)=>e.filter(e=>e!==t);function K(e,t){return[...t.map(t=>e.find(e=>e.key===t)).filter(e=>Boolean(e)),...e.filter(e=>!t.includes(e.key))]}function A(e,t,n=12){const r=e.clock+1;let i;i=e.tabs.find(e=>e.key===t.key)?e.tabs.map(e=>e.key===t.key?{...e,path:t.path,title:"page"===e.titleFrom?e.title:t.title||e.title,lastActive:r}:e):[...e.tabs,{key:t.key,path:t.path,title:t.title,titleFrom:"route",pinned:!1,lastActive:r}];let c={...e,tabs:i,activeKey:t.key,mounted:(s=e.mounted,l=t.key,s.includes(l)?s:[...s,l]),clock:r};var s,l;return c.closing&&c.closing!==t.key?c=C(c,c.closing):c.closing===t.key&&(c={...c,closing:null}),function(e,t){let n=e;for(;n.tabs.length>t;){const e=n.tabs.filter(e=>!e.pinned&&e.key!==n.activeKey&&!n.dirty.includes(e.key)&&e.key!==n.closing).sort((e,t)=>e.lastActive-t.lastActive);if(0===e.length)break;n=C(n,e[0].key)}return n}(c,n)}function M(e){let t={...e,activeKey:null};return t.closing&&(t=C(t,t.closing)),t}function C(e,t){return{...e,tabs:e.tabs.filter(e=>e.key!==t),mounted:F(e.mounted,t),dirty:F(e.dirty,t),activeKey:e.activeKey===t?null:e.activeKey,closing:e.closing===t?null:e.closing}}function Q(e,t){switch(t.type){case"visit":return A(e,t.entry,t.maxTabs);case"transient":return M(e);case"close":{let n=e;for(const e of t.keys)n=C(n,e);return t.closing?function(e,t){return{...e,closing:t}}(n,t.closing):n}case"title":return function(e,t,n){const r=e.tabs.find(e=>e.key===t);return!r||!n||r.title===n&&"page"===r.titleFrom?e:{...e,tabs:e.tabs.map(e=>e.key===t?{...e,title:n,titleFrom:"page"}:e)}}(e,t.key,t.title);case"dirty":return function(e,t,n){return n===e.dirty.includes(t)?e:{...e,dirty:n?[...e.dirty,t]:F(e.dirty,t)}}(e,t.key,t.dirty)}}var D=e=>`${e.pathname}${e.search}`;function I(e){const t=e.indexOf("#"),n=t>=0?e.slice(t):"",r=t>=0?e.slice(0,t):e,i=r.indexOf("?");return{pathname:i>=0?r.slice(0,i):r,search:i>=0?r.slice(i):"",hash:n}}function H({children:e,resolve:c,pinned:s=[],storageKey:l,maxTabs:f=12,enabled:v=!0,confirmDiscard:g}){const T=m(),N=h(),F=i().pageTabs,C=y(),H=o(c);H.current=c;const J=d(e=>{const t=H.current(e);return t?{key:t.key??e.pathname,path:D(e),title:t.title}:null},[]),{language:L}=t(),[O,w]=p(Q,void 0,()=>{const e=function(e,t,n){if(!e)return[];let r;try{r=JSON.parse(e)}catch{return[]}const i=r;if(!i||1!==i.v||!Array.isArray(i.tabs))return[];const c=Boolean(n&&"string"==typeof i.lang&&i.lang!==n),s=[];for(const e of i.tabs){if(!e||"string"!=typeof e.path||!e.path.startsWith("/")||e.path.startsWith("//"))continue;const n=e.path.indexOf("#"),r=n>=0?e.path.slice(0,n):e.path,i=t(r);if(!i||s.some(e=>e.key===i.key))continue;const l=!c&&"page"===e.titleFrom&&"string"==typeof e.title&&e.title;s.push({key:i.key,path:r,title:l||i.title,titleFrom:l?"page":"route",pinned:!1,lastActive:0})}return s}(function(e){if(!e)return null;try{return localStorage.getItem(e)}catch{return null}}(l),e=>J(I(e)),L);let t=function(e,t){const n=t.map(e=>e.key);let r=e.tabs.map(e=>({...e,pinned:n.includes(e.key)}));for(const e of t)r.some(t=>t.key===e.key)||(r=[...r,{key:e.key,path:e.path,title:e.title,titleFrom:"route",pinned:!0,lastActive:0}]);return{...e,tabs:K(r,n)}}({tabs:[],activeKey:null,mounted:[],dirty:[],closing:null,clock:0,tabs:e},s.map(e=>J(I(e))).filter(e=>Boolean(e)));const n=v?J(T):null;return t=n?A(t,n,f):M(t),t}),G=o(O);G.current=O;const R=o(/* @__PURE__ */new Map),Y=v?J(T):null,P=Y?.key??null;r(()=>{if(!v)return;const e=J(T);e?(R.current.set(e.key,T),w({type:"visit",entry:e,maxTabs:f})):w({type:"transient"})},[T,v,f,J]),a(()=>{const e=new Set(O.tabs.map(e=>e.key));for(const t of R.current.keys())e.has(t)||R.current.delete(t)},[O.tabs]);const W=u(()=>function(e,t){const n={v:1,...t?{lang:t}:{},tabs:e.tabs.filter(t=>t.key!==e.closing).map(({key:e,path:t,title:n,titleFrom:r})=>({key:e,path:t,title:n,titleFrom:r}))};return JSON.stringify(n)}(O,L),[O,L]);a(()=>{if(l)try{localStorage.setItem(l,W)}catch{}},[W,l]);const U=O.dirty.length>0;a(()=>{if(!U)return;const e=e=>{e.preventDefault(),e.returnValue=""};return window.addEventListener("beforeunload",e),()=>window.removeEventListener("beforeunload",e)},[U]);const V=o(/* @__PURE__ */new Map),Z=d((e,t)=>{let n=V.current.get(e);return void 0===n&&(n=V.current.size,V.current.set(e,n)),`${C}-page-${t}-${n}`},[C]),x=d(e=>g?g(e):n({title:F.discardTitle,message:1===e.length?F.discardOne:F.discardCount?.(e.length)??`${e.length} ${F.discardMany}`,confirmLabel:F.discardConfirm,cancelLabel:F.keepEditing,variant:"warning"}),[g,F]),B=d(()=>{const e=G.current;return e.tabs.find(e=>e.pinned)?.path??"/"},[]),E=d((e,t,n)=>{const r=G.current,i=r.activeKey;if(!i||!e.includes(i))return void w({type:"close",keys:e,closing:null});let c=t;if(!c){const t={...r,tabs:r.tabs.filter(t=>t.key===i||!e.includes(t.key))},s=n?r.tabs.find(t=>t.key===n&&!e.includes(t.key)):void 0;c=(s??function(e,t){const n=e.tabs.filter(n=>n.key!==e.closing||n.key===t),r=n.findIndex(e=>e.key===t);return r<0?null:n[r+1]??n[r-1]??null}(t,i))?.path??B()}w({type:"close",keys:e.filter(e=>e!==i),closing:i}),N(c)},[N,B]),S=d(async(e,t={})=>{const n=G.current.tabs.find(t=>t.key===e);return!n||n.pinned?(t.to&&N(t.to),!1):!(!t.force&&G.current.dirty.includes(e)&&!await x([n]))&&(!!G.current.tabs.some(t=>t.key===e)&&(E([e],t.to),!0))},[x,E,N]),$=d(async(e,t)=>{let n=function(e,t,n){const r=e.tabs.filter(e=>!e.pinned);if("all"===t)return r.map(e=>e.key);if("others"===t)return r.filter(e=>e.key!==n).map(e=>e.key);const i=e.tabs.findIndex(e=>e.key===n);return i<0?[]:e.tabs.slice(i+1).filter(e=>!e.pinned).map(e=>e.key)}(G.current,e,t);const r=G.current.tabs.filter(e=>n.includes(e.key)&&G.current.dirty.includes(e.key));r.length&&!await x(r)&&(n=n.filter(e=>!r.some(t=>t.key===e)));const i=new Set(G.current.tabs.map(e=>e.key));n=n.filter(e=>i.has(e)),n.length&&E(n,void 0,"all"===e?null:t)},[x,E]),X=d(e=>{const t=G.current.tabs.find(t=>t.key===e);t&&e!==G.current.activeKey&&N(t.path)},[N]),z=d((e,t)=>w({type:"title",key:e,title:t}),[]),q=d((e,t)=>w({type:"dirty",key:e,dirty:t}),[]),[_,ee]=k({}),te=d((e,t)=>{ee(n=>{if((n[e]??null)===t)return n;const r={...n};return t?r[e]=t:delete r[e],r})},[]),ne=d(e=>J(e)?.key??null,[J]),re=d(e=>R.current.get(e),[]),ie=u(()=>v?O.tabs.filter(e=>e.key!==O.closing):[],[v,O.tabs,O.closing]),ce=u(()=>({enabled:v,state:O,currentKey:P,resolve:c,keyFor:ne,locationFor:re,idFor:Z,activate:X,close:S,closeMany:$,setTitle:z,setDirty:q,copies:_,setCopy:te,visibleTabs:ie}),[v,O,P,c,ne,re,Z,X,S,$,z,q,_,te,ie]);/* @__PURE__ */
3
- return b(j.Provider,{value:ce,children:e})}var J=c.Activity,L=Boolean(J);function O({active:e,children:t}){return J?/* @__PURE__ */b(J,{mode:e?"visible":"hidden",children:t}):/* @__PURE__ */b(v,{children:t})}var w=l(function({tabKey:e,active:t,location:n,render:i,className:c,panelId:s,tabId:l}){const y=o(null),d=o(t),p=o(/* @__PURE__ */new Map);r(()=>{const e=d.current;if(d.current=t,t&&!e)for(const[e,[t,n]]of p.current)e.isConnected?(e.scrollTop=t,e.scrollLeft=n):p.current.delete(e)},[t]),a(()=>{const e=y.current;if(!e)return;const t=e=>{if(!d.current)return;const t=e.target;t&&"number"==typeof t.scrollTop&&p.current.set(t,[t.scrollTop,t.scrollLeft])};return e.addEventListener("scroll",t,!0),()=>e.removeEventListener("scroll",t,!0)},[]);const k=u(()=>({key:e,activeRef:d}),[e]);/* @__PURE__ */
4
- return b("div",{ref:y,role:s?"tabpanel":void 0,id:s,"aria-labelledby":l,hidden:!t,style:t?void 0:{display:"none"},className:c,"data-page-tab":e,children:/* @__PURE__ */b(T.Provider,{value:k,children:/* @__PURE__ */b(O,{active:t,children:i(n)})})})},(e,t)=>e.active===t.active&&e.location===t.location&&e.className===t.className&&e.panelId===t.panelId&&e.tabId===t.tabId&&(!t.active||e.render===t.render)),G="\0transient";function R({children:e,frameClassName:t}){const n=f(j),r=m();if(!n||!n.enabled)/* @__PURE__ */
5
- return b("div",{className:t,children:e(r)},G);const{state:i,currentKey:c,locationFor:s,idFor:l}=n,o=i.tabs.filter(e=>i.mounted.includes(e.key)).map(e=>e.key);return c&&!o.includes(c)&&o.push(c),/* @__PURE__ */g(v,{children:[o.map(n=>{const i=n===c,o=i?r:s(n);return o?/* @__PURE__ */b(w,{tabKey:n,active:i,location:o,render:e,className:t,panelId:l(n,"panel"),tabId:l(n,"tab")},n):null}),!c&&/* @__PURE__ */b(w,{tabKey:G,active:!0,location:r,render:e,className:t},G)]})}function Y({className:t,activeClassName:n,end:r}){const c=f(j),s=i().pageTabs;if(!c||!c.enabled)return null;const{visibleTabs:l,state:o,idFor:a,activate:u,close:y,closeMany:d,resolve:p}=c;/* @__PURE__ */
6
- return b(e,{tabs:l.map(e=>({key:e.key,title:e.title,pinned:e.pinned,dirty:o.dirty.includes(e.key),copy:c.copies[e.key],icon:p(I(e.path))?.icon})),activeKey:c.currentKey??null,idFor:a,panelMounted:e=>o.mounted.includes(e),onActivate:u,onClose:e=>{y(e)},onCloseMany:(e,t)=>{d(e,t)},label:s.label,className:t,activeClassName:n,end:r})}var P={enabled:!1,tabs:[],activeKey:null,activate:()=>{},close:async()=>!1,closeOthers:async()=>{},closeRight:async()=>{},closeAll:async()=>{}};function W(){const e=f(j);return e&&e.enabled?{enabled:!0,tabs:e.visibleTabs,activeKey:e.currentKey,activate:e.activate,close:e.close,closeOthers:t=>e.closeMany("others",t),closeRight:t=>e.closeMany("right",t),closeAll:()=>e.closeMany("all",null)}:P}function U(){const e=f(j),t=f(T),n=h();return{key:e?.enabled&&t?t.key:null,close:d(async(r={})=>e?.enabled&&t&&e.state.tabs.some(e=>e.key===t.key)?e.close(t.key,r):(r.to&&n(r.to),!1),[e,t,n])}}function V(e){const t=f(j),n=f(T),r=t?.enabled?t.setTitle:void 0,i=n?.key;a(()=>{r&&i&&e&&r(i,e)},[r,i,e])}function Z(e){const t=f(j),n=f(T),r=t?.enabled?t.setCopy:void 0,i=n?.key;a(()=>{if(r&&i)return r(i,e||null),()=>r(i,null)},[r,i,e])}function x(e){const t=f(j),n=f(T),r=t?.enabled?t.setDirty:void 0;a(()=>{if(r&&n)return r(n.key,e),()=>{n.activeRef.current&&r(n.key,!1)}},[r,n,e])}export{N as DEFAULT_MAX_TABS,L as PAGE_TABS_PAUSE_HIDDEN,Y as PageTabBar,R as PageTabsOutlet,H as PageTabsProvider,I as parseTabPath,U as usePageTab,Z as usePageTabCopy,x as usePageTabDirty,V as usePageTabTitle,W as usePageTabs};
2
+ import{TabStrip as e}from"../chunk-5LB7LCEG.js";import{useShellLanguage as t}from"../chunk-GKYGPCGL.js";import"../chunk-TJ5YMXVB.js";import{confirm as n}from"../chunk-JRKD7SD3.js";import"../chunk-5RCKE4X2.js";import"../chunk-PO2KNVCC.js";import"../chunk-CJ4OEY3T.js";import"../chunk-5QHNDAZ6.js";import"../chunk-TEQ5ZPAL.js";import"../chunk-VWGWZY7A.js";import"../chunk-DBQNYJZ6.js";import"../chunk-F3ZOO23R.js";import"../chunk-DWGYC7OD.js";import"../chunk-APFDZ2HG.js";import"../chunk-P56YLT73.js";import"../chunk-URHGHXDN.js";import"../chunk-5QFPTDQF.js";import"../chunk-TSZPGDU3.js";import"../chunk-ISVODSRP.js";import"../chunk-J75ZT2JQ.js";import"../chunk-BWJZTHZ6.js";import"../chunk-CIZAUBWA.js";import"../chunk-PGN5ME7B.js";import"../chunk-5QRHQCRG.js";import"../chunk-62LW225J.js";import"../chunk-TAHHZGRH.js";import"../chunk-KEFNQEXZ.js";import{useBrowserLayoutEffect as r}from"../chunk-PU2GJVMG.js";import"../chunk-3FININUU.js";import"../chunk-UQYNPYF4.js";import"../chunk-TWVUQUUD.js";import"../chunk-5FYDNH4Y.js";import"../chunk-LNXBTK7Q.js";import{useShellStrings as i}from"../chunk-NRHG4R2Q.js";import"../chunk-C3QOHMR6.js";import*as c from"react";import{createContext as s,memo as l,useRef as o,useEffect as a,useMemo as u,useId as y,useCallback as d,useReducer as p,useState as k,useContext as f}from"react";import{useLocation as m,useNavigate as h}from"react-router-dom";import{jsx as b,Fragment as v,jsxs as g}from"react/jsx-runtime";var j=s(null),K=s(null),N=12;var T=(e,t)=>e.filter(e=>e!==t);function F(e,t){return[...t.map(t=>e.find(e=>e.key===t)).filter(e=>Boolean(e)),...e.filter(e=>!t.includes(e.key))]}function C(e,t,n=12){const r=e.clock+1;let i;i=e.tabs.find(e=>e.key===t.key)?e.tabs.map(e=>e.key===t.key?{...e,path:t.path,title:"page"===e.titleFrom?e.title:t.title||e.title,lastActive:r}:e):[...e.tabs,{key:t.key,path:t.path,title:t.title,titleFrom:"route",pinned:!1,lastActive:r}];let c={...e,tabs:i,activeKey:t.key,mounted:(s=e.mounted,l=t.key,s.includes(l)?s:[...s,l]),clock:r};var s,l;return c.closing&&c.closing!==t.key?c=D(c,c.closing):c.closing===t.key&&(c={...c,closing:null}),function(e,t){let n=e;for(;n.tabs.length>t;){const e=n.tabs.filter(e=>!e.pinned&&e.key!==n.activeKey&&!n.dirty.includes(e.key)&&e.key!==n.closing).sort((e,t)=>e.lastActive-t.lastActive);if(0===e.length)break;n=D(n,e[0].key)}return n}(c,n)}function A(e){let t={...e,activeKey:null};return t.closing&&(t=D(t,t.closing)),t}function D(e,t){return{...e,tabs:e.tabs.filter(e=>e.key!==t),mounted:T(e.mounted,t),dirty:T(e.dirty,t),activeKey:e.activeKey===t?null:e.activeKey,closing:e.closing===t?null:e.closing}}function I(e,t){switch(t.type){case"visit":return C(e,t.entry,t.maxTabs);case"transient":return A(e);case"close":{let n=e;for(const e of t.keys)n=D(n,e);return t.closing?function(e,t){return{...e,closing:t}}(n,t.closing):n}case"title":return function(e,t,n){const r=e.tabs.find(e=>e.key===t);return!r||!n||r.title===n&&"page"===r.titleFrom?e:{...e,tabs:e.tabs.map(e=>e.key===t?{...e,title:n,titleFrom:"page"}:e)}}(e,t.key,t.title);case"dirty":return function(e,t,n){return n===e.dirty.includes(t)?e:{...e,dirty:n?[...e.dirty,t]:T(e.dirty,t)}}(e,t.key,t.dirty)}}var G=e=>`${e.pathname}${e.search}`;function L(e){const t=e.indexOf("#"),n=t>=0?e.slice(t):"",r=t>=0?e.slice(0,t):e,i=r.indexOf("?");return{pathname:i>=0?r.slice(0,i):r,search:i>=0?r.slice(i):"",hash:n}}function M({children:e,resolve:c,pinned:s=[],storageKey:l,maxTabs:f=12,enabled:v=!0,confirmDiscard:g}){const K=m(),N=h(),T=i().pageTabs,D=y(),M=o(c);M.current=c;const O=d(e=>{const t=M.current(e);return t?{key:t.key??e.pathname,path:G(e),title:t.title}:null},[]),{language:R}=t(),[Q,w]=p(I,void 0,()=>{const e=function(e,t,n){if(!e)return[];let r;try{r=JSON.parse(e)}catch{return[]}const i=r;if(!i||1!==i.v||!Array.isArray(i.tabs))return[];const c=Boolean(n&&"string"==typeof i.lang&&i.lang!==n),s=[];for(const e of i.tabs){if(!e||"string"!=typeof e.path||!e.path.startsWith("/")||e.path.startsWith("//"))continue;const n=e.path.indexOf("#"),r=n>=0?e.path.slice(0,n):e.path,i=t(r);if(!i||s.some(e=>e.key===i.key))continue;const l=!c&&"page"===e.titleFrom&&"string"==typeof e.title&&e.title;s.push({key:i.key,path:r,title:l||i.title,titleFrom:l?"page":"route",pinned:!1,lastActive:0})}return s}(function(e){if(!e)return null;try{return localStorage.getItem(e)}catch{return null}}(l),e=>O(L(e)),R);let t=function(e,t){const n=t.map(e=>e.key);let r=e.tabs.map(e=>({...e,pinned:n.includes(e.key)}));for(const e of t)r.some(t=>t.key===e.key)||(r=[...r,{key:e.key,path:e.path,title:e.title,titleFrom:"route",pinned:!0,lastActive:0}]);return{...e,tabs:F(r,n)}}({tabs:[],activeKey:null,mounted:[],dirty:[],closing:null,clock:0,tabs:e},s.map(e=>O(L(e))).filter(e=>Boolean(e)));const n=v?O(K):null;return t=n?C(t,n,f):A(t),t}),P=o(Q);P.current=Q;const Z=o(/* @__PURE__ */new Map),E=v?O(K):null,H=E?.key??null;r(()=>{if(!v)return;const e=O(K);e?(Z.current.set(e.key,K),w({type:"visit",entry:e,maxTabs:f})):w({type:"transient"})},[K,v,f,O]),a(()=>{const e=new Set(Q.tabs.map(e=>e.key));for(const t of Z.current.keys())e.has(t)||Z.current.delete(t)},[Q.tabs]);const B=u(()=>function(e,t){const n={v:1,...t?{lang:t}:{},tabs:e.tabs.filter(t=>t.key!==e.closing).map(({key:e,path:t,title:n,titleFrom:r})=>({key:e,path:t,title:n,titleFrom:r}))};return JSON.stringify(n)}(Q,R),[Q,R]);a(()=>{if(l)try{localStorage.setItem(l,B)}catch{}},[B,l]);const J=Q.dirty.length>0;a(()=>{if(!J)return;const e=e=>{e.preventDefault(),e.returnValue=""};return window.addEventListener("beforeunload",e),()=>window.removeEventListener("beforeunload",e)},[J]);const Y=o(/* @__PURE__ */new Map),x=d((e,t)=>{let n=Y.current.get(e);return void 0===n&&(n=Y.current.size,Y.current.set(e,n)),`${D}-page-${t}-${n}`},[D]),S=d(e=>g?g(e):n({title:T.discardTitle,message:1===e.length?T.discardOne:T.discardCount?.(e.length)??`${e.length} ${T.discardMany}`,confirmLabel:T.discardConfirm,cancelLabel:T.keepEditing,variant:"warning"}),[g,T]),U=d(()=>{const e=P.current;return e.tabs.find(e=>e.pinned)?.path??"/"},[]),W=d((e,t,n)=>{const r=P.current,i=r.activeKey;if(!i||!e.includes(i))return void w({type:"close",keys:e,closing:null});let c=t;if(!c){const t={...r,tabs:r.tabs.filter(t=>t.key===i||!e.includes(t.key))},s=n?r.tabs.find(t=>t.key===n&&!e.includes(t.key)):void 0;c=(s??function(e,t){const n=e.tabs.filter(n=>n.key!==e.closing||n.key===t),r=n.findIndex(e=>e.key===t);return r<0?null:n[r+1]??n[r-1]??null}(t,i))?.path??U()}w({type:"close",keys:e.filter(e=>e!==i),closing:i}),N(c)},[N,U]),V=d(async(e,t={})=>{const n=P.current.tabs.find(t=>t.key===e);return!n||n.pinned?(t.to&&N(t.to),!1):!(!t.force&&P.current.dirty.includes(e)&&!await S([n]))&&(!!P.current.tabs.some(t=>t.key===e)&&(W([e],t.to),!0))},[S,W,N]),$=d(async(e,t)=>{let n=function(e,t,n){const r=e.tabs.filter(e=>!e.pinned);if("all"===t)return r.map(e=>e.key);if("others"===t)return r.filter(e=>e.key!==n).map(e=>e.key);const i=e.tabs.findIndex(e=>e.key===n);return i<0?[]:e.tabs.slice(i+1).filter(e=>!e.pinned).map(e=>e.key)}(P.current,e,t);const r=P.current.tabs.filter(e=>n.includes(e.key)&&P.current.dirty.includes(e.key));r.length&&!await S(r)&&(n=n.filter(e=>!r.some(t=>t.key===e)));const i=new Set(P.current.tabs.map(e=>e.key));n=n.filter(e=>i.has(e)),n.length&&W(n,void 0,"all"===e?null:t)},[S,W]),X=d(e=>{const t=P.current.tabs.find(t=>t.key===e);t&&e!==P.current.activeKey&&N(t.path)},[N]),z=d((e,t)=>w({type:"title",key:e,title:t}),[]),q=d((e,t)=>w({type:"dirty",key:e,dirty:t}),[]),[_,ee]=k({}),te=d((e,t)=>{ee(n=>{if((n[e]??null)===t)return n;const r={...n};return t?r[e]=t:delete r[e],r})},[]),ne=d(e=>O(e)?.key??null,[O]),re=d(e=>Z.current.get(e),[]),ie=u(()=>v?Q.tabs.filter(e=>e.key!==Q.closing):[],[v,Q.tabs,Q.closing]),ce=u(()=>({enabled:v,state:Q,currentKey:H,resolve:c,keyFor:ne,locationFor:re,idFor:x,activate:X,close:V,closeMany:$,setTitle:z,setDirty:q,copies:_,setCopy:te,visibleTabs:ie}),[v,Q,H,c,ne,re,x,X,V,$,z,q,_,te,ie]);/* @__PURE__ */
3
+ return b(j.Provider,{value:ce,children:e})}var O=c.Activity,R=Boolean(O);function Q({active:e,children:t}){return O?/* @__PURE__ */b(O,{mode:e?"visible":"hidden",children:t}):/* @__PURE__ */b(v,{children:t})}var w=l(function({tabKey:e,active:t,location:n,render:i,className:c,panelId:s,tabId:l}){const y=o(null),d=o(t),p=o(/* @__PURE__ */new Map);r(()=>{const e=d.current;if(d.current=t,t&&!e)for(const[e,[t,n]]of p.current)e.isConnected?(e.scrollTop=t,e.scrollLeft=n):p.current.delete(e)},[t]),a(()=>{const e=y.current;if(!e)return;const t=e=>{if(!d.current)return;const t=e.target;t&&"number"==typeof t.scrollTop&&p.current.set(t,[t.scrollTop,t.scrollLeft])};return e.addEventListener("scroll",t,!0),()=>e.removeEventListener("scroll",t,!0)},[]);const k=u(()=>({key:e,activeRef:d}),[e]);/* @__PURE__ */
4
+ return b("div",{ref:y,role:s?"tabpanel":void 0,id:s,"aria-labelledby":l,hidden:!t,style:t?void 0:{display:"none"},className:c,"data-page-tab":e,children:/* @__PURE__ */b(K.Provider,{value:k,children:/* @__PURE__ */b(Q,{active:t,children:i(n)})})})},(e,t)=>e.active===t.active&&e.location===t.location&&e.className===t.className&&e.panelId===t.panelId&&e.tabId===t.tabId&&(!t.active||e.render===t.render)),P="\0transient";function Z({children:e,frameClassName:t}){const n=f(j),r=m();if(!n||!n.enabled)/* @__PURE__ */
5
+ return b("div",{className:t,children:e(r)},P);const{state:i,currentKey:c,locationFor:s,idFor:l}=n,o=i.tabs.filter(e=>i.mounted.includes(e.key)).map(e=>e.key);return c&&!o.includes(c)&&o.push(c),/* @__PURE__ */g(v,{children:[o.map(n=>{const i=n===c,o=i?r:s(n);return o?/* @__PURE__ */b(w,{tabKey:n,active:i,location:o,render:e,className:t,panelId:l(n,"panel"),tabId:l(n,"tab")},n):null}),!c&&/* @__PURE__ */b(w,{tabKey:P,active:!0,location:r,render:e,className:t},P)]})}function E({className:t,activeClassName:n,end:r}){const c=f(j),s=i().pageTabs;if(!c||!c.enabled)return null;const{visibleTabs:l,state:o,idFor:a,activate:u,close:y,closeMany:d,resolve:p}=c;/* @__PURE__ */
6
+ return b(e,{tabs:l.map(e=>({key:e.key,title:e.title,pinned:e.pinned,dirty:o.dirty.includes(e.key),copy:c.copies[e.key],icon:p(L(e.path))?.icon})),activeKey:c.currentKey??null,idFor:a,panelMounted:e=>o.mounted.includes(e),onActivate:u,onClose:e=>{y(e)},onCloseMany:(e,t)=>{d(e,t)},label:s.label,className:t,activeClassName:n,end:r})}var H={enabled:!1,tabs:[],activeKey:null,activate:()=>{},close:async()=>!1,closeOthers:async()=>{},closeRight:async()=>{},closeAll:async()=>{}};function B(){const e=f(j);return e&&e.enabled?{enabled:!0,tabs:e.visibleTabs,activeKey:e.currentKey,activate:e.activate,close:e.close,closeOthers:t=>e.closeMany("others",t),closeRight:t=>e.closeMany("right",t),closeAll:()=>e.closeMany("all",null)}:H}function J(){const e=f(j),t=f(K),n=h();return{key:e?.enabled&&t?t.key:null,close:d(async(r={})=>e?.enabled&&t&&e.state.tabs.some(e=>e.key===t.key)?e.close(t.key,r):(r.to&&n(r.to),!1),[e,t,n])}}function Y(e){const t=f(j),n=f(K),r=t?.enabled?t.setTitle:void 0,i=n?.key;a(()=>{r&&i&&e&&r(i,e)},[r,i,e])}function x(e){const t=f(j),n=f(K),r=t?.enabled?t.setCopy:void 0,i=n?.key;a(()=>{if(r&&i)return r(i,e||null),()=>r(i,null)},[r,i,e])}function S(e){const t=f(j),n=f(K),r=t?.enabled?t.setDirty:void 0;a(()=>{if(r&&n)return r(n.key,e),()=>{n.activeRef.current&&r(n.key,!1)}},[r,n,e])}export{N as DEFAULT_MAX_TABS,R as PAGE_TABS_PAUSE_HIDDEN,E as PageTabBar,Z as PageTabsOutlet,M as PageTabsProvider,L as parseTabPath,J as usePageTab,x as usePageTabCopy,S as usePageTabDirty,Y as usePageTabTitle,B as usePageTabs};
package/dist/pdf/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{lazy as r}from"react";var e=r(()=>import("../PdfViewer-ADPTYOAO.js"));export{e as PdfViewer};
2
+ import{lazy as r}from"react";var e=r(()=>import("../PdfViewer-AIAVQYZ6.js"));export{e as PdfViewer};