@webority/ui-elements 0.179.0 → 0.180.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 (249) hide show
  1. package/README.md +10 -0
  2. package/THIRD-PARTY-NOTICES.txt +3 -3
  3. package/dist/WuiCalendarViews-Dg9yRY1I.js +1 -0
  4. package/dist/{WuiCommandPalette-u1XD5WMv.js → WuiCommandPalette-CpmlKjzH.js} +2 -2
  5. package/dist/{WuiCommentThread-e5t7HceL.js → WuiCommentThread-Cp7AVHvt.js} +1 -1
  6. package/dist/WuiDashboardGrid-DFpX8Vx0.js +1 -0
  7. package/dist/WuiDataTable-CSgcwxU5.js +1 -0
  8. package/dist/WuiDatePicker-CRqjwyf2.js +1 -0
  9. package/dist/WuiDateRange-BBm_Q69p.js +1 -0
  10. package/dist/WuiEntryGrid-Z69-1YBh.js +3 -0
  11. package/dist/WuiGantt-DvmVKJX2.js +1 -0
  12. package/dist/WuiInlineEdit-JT83k3Nk.js +1 -0
  13. package/dist/WuiMentionInput-DPCCSQRZ.js +1 -0
  14. package/dist/WuiMiniCalendar-BhUTIGwe.js +1 -0
  15. package/dist/WuiNotificationCenter-D5bBM8Lp.js +1 -0
  16. package/dist/WuiOfflineBanner-DGTFCtyM.js +1 -0
  17. package/dist/{WuiPhone--w-taM5Q.js → WuiPhone-B5ZLabTY.js} +1 -1
  18. package/dist/{WuiSavedViews-BR6ZHd9Y.js → WuiSavedViews-CH7IvwgZ.js} +1 -1
  19. package/dist/WuiSelect-DIW_WXH7.js +1 -0
  20. package/dist/WuiTimePicker-BKFPf8Fn.js +1 -0
  21. package/dist/{WuiTree-BjtuCasB.js → WuiTree-Db83Uztv.js} +1 -1
  22. package/dist/WuiWizardStep-BBkw94dD.js +1 -0
  23. package/dist/{chips-BdpsN50B.js → chips-paLEDoxn.js} +1 -1
  24. package/dist/commandPalette.g-DP-Zl8SU.js +1 -0
  25. package/dist/dashboardGrid.g-vkCZGw6G.js +1 -0
  26. package/dist/{dataTable-VB3nBucm.js → dataTable-C0q14bkP.js} +1 -1
  27. package/dist/{dataTable.g-DazoWWps.js → dataTable.g-1PsmN1Nj.js} +1 -1
  28. package/dist/drawerDiscard-D_LMpaFv.js +1 -0
  29. package/dist/elements/calendar-views.js +1 -0
  30. package/dist/elements/command-palette.js +1 -1
  31. package/dist/elements/comment-thread.js +1 -1
  32. package/dist/elements/dashboard-grid.js +1 -0
  33. package/dist/elements/data-table.js +1 -1
  34. package/dist/elements/date-range.js +1 -1
  35. package/dist/elements/datepicker.js +1 -1
  36. package/dist/elements/entry-grid.js +1 -1
  37. package/dist/elements/gantt.js +1 -1
  38. package/dist/elements/inline-edit.js +1 -1
  39. package/dist/elements/kanban.js +1 -1
  40. package/dist/elements/mention-input.js +1 -1
  41. package/dist/elements/mini-calendar.js +1 -0
  42. package/dist/elements/notification-center.js +1 -1
  43. package/dist/elements/offline-banner.js +1 -0
  44. package/dist/elements/phone.js +1 -1
  45. package/dist/elements/saved-views.js +1 -1
  46. package/dist/elements/select.js +1 -1
  47. package/dist/elements/timepicker.js +1 -1
  48. package/dist/elements/tree.js +1 -1
  49. package/dist/elements/wizard.js +1 -1
  50. package/dist/gantt.g-CWvMXwBR.js +1 -0
  51. package/dist/helpers.js +1 -1
  52. package/dist/initials-DKg3IeUa.js +1 -0
  53. package/dist/inlineEdit.g-DKIhYoPF.js +1 -0
  54. package/dist/{kanban-jQCTLG3Q.js → kanban-Dayig7ic.js} +1 -1
  55. package/dist/loader-DUCcKxjq.js +1 -0
  56. package/dist/{notificationCentre.g-UsAurkUz.js → notificationCentre.g-Cees-vKg.js} +1 -1
  57. package/dist/{notificationDays-wMr8rZko.js → notificationDays-B1R0RFAY.js} +1 -1
  58. package/dist/refreshAfter-DhYgWXmQ.js +1 -0
  59. package/dist/{search-Dl07KqWw.js → search-C46tnoPd.js} +1 -1
  60. package/dist/server.js +1 -1
  61. package/dist/shell.g-BhC11Oe3.js +1 -0
  62. package/dist/tableSelect-juA3KcQh.js +1 -0
  63. package/dist/tableSelect.g-DwI5_9Nw.js +1 -0
  64. package/dist/testing.js +1 -0
  65. package/dist/text/en.json +119 -10
  66. package/dist/text.js +1 -1
  67. package/dist/themeTransition-C5nAlClG.js +1 -0
  68. package/dist/toast.g-CJ8c0BNZ.js +1 -0
  69. package/dist/ui-calendar.global.js +1 -1
  70. package/dist/ui-calendar.js +1 -1
  71. package/dist/ui-chart.global.js +15 -15
  72. package/dist/ui-chart.js +2 -2
  73. package/dist/ui-elements/calendar-views.global.js +1 -0
  74. package/dist/ui-elements/carousel.global.js +1 -1
  75. package/dist/ui-elements/code-block.global.js +1 -1
  76. package/dist/ui-elements/command-palette.global.js +2 -2
  77. package/dist/ui-elements/comment-thread.global.js +1 -1
  78. package/dist/ui-elements/consent-banner.global.js +1 -1
  79. package/dist/ui-elements/context-menu.global.js +1 -1
  80. package/dist/ui-elements/dashboard-grid.global.js +1 -0
  81. package/dist/ui-elements/data-table.global.js +1 -1
  82. package/dist/ui-elements/date-range.global.js +1 -1
  83. package/dist/ui-elements/date-time.global.js +1 -1
  84. package/dist/ui-elements/datepicker.global.js +1 -1
  85. package/dist/ui-elements/dock.global.js +1 -1
  86. package/dist/ui-elements/drawer.global.js +1 -1
  87. package/dist/ui-elements/dropdown.global.js +1 -1
  88. package/dist/ui-elements/entry-grid.global.js +2 -2
  89. package/dist/ui-elements/gantt.global.js +1 -1
  90. package/dist/ui-elements/glyphs.global.js +1 -1
  91. package/dist/ui-elements/hover-card.global.js +1 -1
  92. package/dist/ui-elements/image-crop.global.js +1 -1
  93. package/dist/ui-elements/inline-edit.global.js +1 -1
  94. package/dist/ui-elements/kanban.global.js +1 -1
  95. package/dist/ui-elements/lead-popup.global.js +1 -1
  96. package/dist/ui-elements/lightbox.global.js +1 -1
  97. package/dist/ui-elements/markdown.global.js +1 -1
  98. package/dist/ui-elements/mini-calendar.global.js +1 -0
  99. package/dist/ui-elements/navigation-menu.global.js +1 -1
  100. package/dist/ui-elements/notification-center.global.js +1 -1
  101. package/dist/ui-elements/offline-banner.global.js +1 -0
  102. package/dist/ui-elements/onboarding-checklist.global.js +1 -1
  103. package/dist/ui-elements/org-tree.global.js +1 -1
  104. package/dist/ui-elements/otp.global.js +1 -1
  105. package/dist/ui-elements/overflow.global.js +1 -1
  106. package/dist/ui-elements/phone.global.js +1 -1
  107. package/dist/ui-elements/popover.global.js +1 -1
  108. package/dist/ui-elements/rating.global.js +1 -1
  109. package/dist/ui-elements/record-pager.global.js +1 -1
  110. package/dist/ui-elements/relative-time.global.js +1 -1
  111. package/dist/ui-elements/saved-views.global.js +1 -1
  112. package/dist/ui-elements/select-chips.global.js +1 -1
  113. package/dist/ui-elements/select-recents.global.js +1 -1
  114. package/dist/ui-elements/select-search.global.js +1 -1
  115. package/dist/ui-elements/select-window.global.js +1 -1
  116. package/dist/ui-elements/server.global.js +1 -0
  117. package/dist/ui-elements/shell.global.js +1 -0
  118. package/dist/ui-elements/shortcuts.global.js +1 -1
  119. package/dist/ui-elements/show-more.global.js +1 -1
  120. package/dist/ui-elements/slider.global.js +1 -1
  121. package/dist/ui-elements/sortable.global.js +1 -1
  122. package/dist/ui-elements/status-icon.global.js +1 -1
  123. package/dist/ui-elements/table-export.global.js +1 -1
  124. package/dist/ui-elements/timepicker.global.js +1 -1
  125. package/dist/ui-elements/tour.global.js +1 -1
  126. package/dist/ui-elements/tree-picker.global.js +1 -1
  127. package/dist/ui-elements/tree.global.js +1 -1
  128. package/dist/ui-elements/truncate.global.js +1 -1
  129. package/dist/ui-elements/whats-new.global.js +1 -1
  130. package/dist/ui-elements/wizard.global.js +1 -1
  131. package/dist/ui-elements.global.js +1 -1
  132. package/dist/ui-elements.js +1 -1
  133. package/dist/ui-file-viewer.global.js +1 -1
  134. package/dist/ui-file-viewer.js +1 -1
  135. package/dist/wizard.g-UKG1dMs_.js +1 -0
  136. package/dist/wuiHttp-8CYWEbRz.js +1 -0
  137. package/package.json +25 -5
  138. package/types/WuiCalendar.d.ts +9 -1
  139. package/types/WuiCalendarViews.d.ts +34 -0
  140. package/types/WuiDashboardGrid.d.ts +35 -0
  141. package/types/WuiDataTable.d.ts +1 -0
  142. package/types/WuiEntryGrid.d.ts +4 -0
  143. package/types/WuiFileViewer.d.ts +7 -0
  144. package/types/WuiGantt.d.ts +6 -1
  145. package/types/WuiInlineEdit.d.ts +2 -1
  146. package/types/WuiMiniCalendar.d.ts +27 -0
  147. package/types/WuiNotificationCenter.d.ts +1 -0
  148. package/types/WuiOfflineBanner.d.ts +35 -0
  149. package/types/WuiSelect.d.ts +1 -0
  150. package/types/WuiTimePicker.d.ts +1 -0
  151. package/types/WuiWizard.d.ts +13 -0
  152. package/types/calendarAdapter.d.ts +9 -0
  153. package/types/calendarModel.d.ts +11 -0
  154. package/types/chartSpec.d.ts +3 -0
  155. package/types/dataTable.d.ts +10 -1
  156. package/types/elements/calendar-views.d.ts +2 -0
  157. package/types/elements/dashboard-grid.d.ts +1 -0
  158. package/types/elements/mini-calendar.d.ts +2 -0
  159. package/types/elements/offline-banner.d.ts +2 -0
  160. package/types/ganttLayout.d.ts +41 -7
  161. package/types/ganttTypes.d.ts +15 -0
  162. package/types/global/chunkChecks.d.ts +1 -0
  163. package/types/global/chunks.d.ts +4 -0
  164. package/types/global/core.d.ts +3 -2
  165. package/types/global/glyphs.d.ts +2 -0
  166. package/types/global/loader.d.ts +9 -2
  167. package/types/global/parts/server.d.ts +1 -0
  168. package/types/global/parts/shell.d.ts +1 -0
  169. package/types/global/server.d.ts +18 -0
  170. package/types/global/serverGuard.d.ts +2 -0
  171. package/types/global/shared.d.ts +22 -0
  172. package/types/global/tableExport.d.ts +2 -0
  173. package/types/globals.d.ts +8 -0
  174. package/types/helpers.d.ts +2 -1
  175. package/types/index.d.ts +5 -1
  176. package/types/razor-js/modules/api.d.ts +10 -5
  177. package/types/razor-js/modules/serverBridge.d.ts +1 -0
  178. package/types/razor-js/modules/stickyStack.d.ts +1 -0
  179. package/types/razor-js/webority-ui.d.ts +4 -1
  180. package/types/select/list.d.ts +2 -0
  181. package/types/server/behaviours.d.ts +6 -0
  182. package/types/server/core.d.ts +10 -0
  183. package/types/server/flash.d.ts +16 -0
  184. package/types/server/flashToasts.d.ts +2 -0
  185. package/types/server/index.d.ts +2 -10
  186. package/types/server/postError.d.ts +17 -0
  187. package/types/server/refreshAfter.d.ts +45 -0
  188. package/types/server/regions.d.ts +5 -0
  189. package/types/server/serverActions.d.ts +18 -10
  190. package/types/server/serverMessage.d.ts +5 -0
  191. package/types/server/serverTable.d.ts +0 -2
  192. package/types/server/serverTableRegistry.d.ts +7 -0
  193. package/types/server/shellParts.d.ts +1 -3
  194. package/types/server/shellRegistry.d.ts +7 -0
  195. package/types/server/toastAction.d.ts +7 -3
  196. package/types/server/wuiHost.d.ts +1 -0
  197. package/types/server/wuiHttp.d.ts +9 -2
  198. package/types/stickyStack.d.ts +6 -0
  199. package/types/tableSelect.d.ts +10 -0
  200. package/types/testing.d.ts +4 -0
  201. package/types/text/web/agenda.g.d.ts +7 -0
  202. package/types/text/web/asyncBlock.g.d.ts +3 -0
  203. package/types/text/web/calendar.g.d.ts +2 -0
  204. package/types/text/web/catalogue.g.d.ts +20 -0
  205. package/types/text/web/changeList.g.d.ts +5 -0
  206. package/types/text/web/chart.g.d.ts +1 -0
  207. package/types/text/web/commandPalette.g.d.ts +1 -0
  208. package/types/text/web/dashboardGrid.g.d.ts +18 -0
  209. package/types/text/web/dashboardHeader.g.d.ts +6 -0
  210. package/types/text/web/dataTable.g.d.ts +4 -0
  211. package/types/text/web/entryGrid.g.d.ts +2 -0
  212. package/types/text/web/formActions.g.d.ts +9 -0
  213. package/types/text/web/gantt.g.d.ts +2 -0
  214. package/types/text/web/index.g.d.ts +10 -0
  215. package/types/text/web/kpiTile.g.d.ts +1 -0
  216. package/types/text/web/miniCalendar.g.d.ts +4 -0
  217. package/types/text/web/notificationCentre.g.d.ts +4 -0
  218. package/types/text/web/offlineBanner.g.d.ts +8 -0
  219. package/types/text/web/queueBundle.g.d.ts +11 -0
  220. package/types/text/web/resultBlock.g.d.ts +6 -0
  221. package/types/text/web/routeError.g.d.ts +14 -0
  222. package/types/text/web/settingRow.g.d.ts +10 -0
  223. package/types/text/web/shell.g.d.ts +0 -7
  224. package/types/text/web/tableSelect.g.d.ts +1 -0
  225. package/types/text/web/unsavedChanges.g.d.ts +1 -0
  226. package/types/text/web/wizard.g.d.ts +6 -0
  227. package/types/toastTypes.d.ts +1 -1
  228. package/dist/WuiDataTable-Ble3hl5L.js +0 -1
  229. package/dist/WuiDatePicker-3D33rzH4.js +0 -1
  230. package/dist/WuiDateRange-BnEJ2WpL.js +0 -1
  231. package/dist/WuiEntryGrid-DkW0tIDy.js +0 -3
  232. package/dist/WuiGantt-BqNhYIr6.js +0 -1
  233. package/dist/WuiInlineEdit-D7AuEv1R.js +0 -1
  234. package/dist/WuiMentionInput-DPpEVL2s.js +0 -1
  235. package/dist/WuiNotificationCenter-DuvGrqwr.js +0 -1
  236. package/dist/WuiSelect-CNff3FNi.js +0 -1
  237. package/dist/WuiTimePicker-DYLFaWDc.js +0 -1
  238. package/dist/WuiWizardStep-gFtuUzsL.js +0 -1
  239. package/dist/commandPalette.g-DFWnCufa.js +0 -1
  240. package/dist/drawerDiscard-APy8TZxi.js +0 -1
  241. package/dist/gantt.g-TdTxeruW.js +0 -1
  242. package/dist/initials-Qb6ITcri.js +0 -1
  243. package/dist/inlineEdit.g-DLDVospu.js +0 -1
  244. package/dist/loader-A38-PdcB.js +0 -1
  245. package/dist/shell.g-C2Ht5xl2.js +0 -1
  246. package/dist/tableSelect.g-Bmd-ExRE.js +0 -1
  247. package/dist/themeTransition-TF0BqM20.js +0 -1
  248. package/dist/wizard.g-DOZSBUc5.js +0 -1
  249. package/dist/wuiHttp-Cw7V8u2w.js +0 -1
@@ -1 +1 @@
1
- import{n as e}from"./elementBase-Cxeyx0tU.js";import{n as ee}from"./filterPopover-DskHFNLi.js";import{t}from"./kanban-jQCTLG3Q.js";import{n}from"./statusIcons-Cd3GJcBR.js";import{t as r}from"./WuiCarousel-B0yPDH5I.js";import{t as i}from"./WuiCodeBlock-BWYZ1S70.js";import{t as a}from"./WuiCommandPalette-u1XD5WMv.js";import{t as o}from"./WuiCommentThread-e5t7HceL.js";import{t as s}from"./WuiConsentBanner-nTua-kEd.js";import{t as c}from"./WuiContextMenu-DEWYYFRG.js";import{t as l}from"./WuiDataTable-Ble3hl5L.js";import{t as u}from"./WuiDatePicker-3D33rzH4.js";import{t as d}from"./WuiDateRange-BnEJ2WpL.js";import{t as f}from"./WuiDateTime-Vimu6grS.js";import{t as p}from"./WuiDock-2LGlbEFx.js";import{t as m}from"./WuiDrawer-BsY0fs_u.js";import{t as h}from"./WuiDropdown-6g074v1T.js";import{t as g}from"./WuiEntryGrid-DkW0tIDy.js";import{t as _}from"./WuiGantt-BqNhYIr6.js";import{t as v}from"./WuiHoverCard-DhJcIIM1.js";import{t as y}from"./WuiImageCrop-UakcSM2k.js";import{t as b}from"./WuiInlineEdit-D7AuEv1R.js";import{t as x}from"./WuiLeadPopup-DaYZ2zCJ.js";import{t as S}from"./WuiLightbox-DpHJAMO3.js";import{t as C}from"./WuiMarkdown-DRtGPxQX.js";import{r as w}from"./WuiMentionInput-DPpEVL2s.js";import{t as T}from"./WuiModal-DQbVJGUo.js";import{t as E}from"./WuiNavigationMenu-KdW7yuLn.js";import{t as D}from"./WuiNotificationCenter-DuvGrqwr.js";import{t as O}from"./WuiOnboardingChecklist-C-nllg2h.js";import{t as k}from"./WuiOrgTree-DWSk_LHd.js";import{t as A}from"./WuiOtp-Cc0formv.js";import{t as j}from"./WuiOverflow-fZKqdsr-.js";import{t as M}from"./WuiPhone--w-taM5Q.js";import{t as N}from"./WuiPopover-BvWKRNQY.js";import{t as P}from"./WuiRating-DIQfif9x.js";import{t as F}from"./WuiRecordPager-BXoe4KfU.js";import{t as I}from"./WuiRelativeTime-CSg9vzfk.js";import{t as L}from"./WuiSavedViews-BR6ZHd9Y.js";import{t as R}from"./WuiSelect-CNff3FNi.js";import{t as z}from"./WuiShortcuts-CRCctX82.js";import{t as B}from"./WuiShowMore-BoYCrYYf.js";import{t as V}from"./WuiSlider-CK7_l_R5.js";import{t as H}from"./WuiSortable-x8Mg0tOv.js";import{t as U}from"./WuiTimePicker-DYLFaWDc.js";import{t as W}from"./WuiTour-BgpMa8J5.js";import{t as G}from"./WuiTree-BjtuCasB.js";import{t as K}from"./WuiTreePicker-DLddmEgG.js";import{t as q}from"./WuiTruncate-BB4i8wHE.js";import{n as J,t as Y}from"./WuiWhatsNew-Dm4Yl68x.js";import{n as X,t as Z}from"./WuiWizardStep-gFtuUzsL.js";import{c as Q,f as te,l as ne,m as re,p as ie,s as ae,u as oe}from"./formatters-DTW53DjY.js";import{_ as se,r as ce}from"./themeTransition-TF0BqM20.js";import{t as le}from"./drawerDiscard-APy8TZxi.js";import{n as ue}from"./shortcutKeys-BMTWgV2g.js";function $(){ee(),e(`wui-select`,R),e(`wui-saved-views`,L),e(`wui-phone`,M),e(`wui-datepicker`,u),e(`wui-date-range`,d),e(`wui-date-time`,f),e(`wui-dock`,p),e(`wui-image-crop`,y),e(`wui-kanban`,t),e(`wui-lead-popup`,x),e(`wui-inline-edit`,b),e(`wui-consent-banner`,s),e(`wui-slider`,V),e(`wui-sortable`,H),e(`wui-timepicker`,U),e(`wui-tour`,W),e(`wui-tree`,G),e(`wui-tree-picker`,K),e(`wui-org-tree`,k),e(`wui-command-palette`,a),e(`wui-context-menu`,c),e(`wui-otp`,A),e(`wui-status-icon`,n),e(`wui-shortcuts`,z),e(`wui-record-pager`,F),e(`wui-carousel`,r),e(`wui-code-block`,i),e(`wui-markdown`,C),e(`wui-modal`,T),e(`wui-data-table`,l),e(`wui-drawer`,m),e(`wui-dropdown`,h),e(`wui-entry-grid`,g),e(`wui-gantt`,_),e(`wui-hover-card`,v),e(`wui-lightbox`,S),e(`wui-navigation-menu`,E),e(`wui-notification-center`,D),e(`wui-onboarding-checklist`,O),e(`wui-overflow`,j),e(`wui-popover`,N),e(`wui-rating`,P),e(`wui-relative-time`,I),e(`wui-show-more`,B),e(`wui-truncate`,q),e(`wui-whats-new`,J),e(`wui-mention-input`,w),e(`wui-comment-thread`,o),e(`wui-wizard-step`,Z),e(`wui-wizard`,X)}$();export{le as DISCARD_EVENT,se as ROW_DROP_EVENT,ue as SHORTCUT_EVENT,ce as THEME_CHANGE_EVENT,Y as WHATS_NEW_READ_EVENT,r as WuiCarousel,i as WuiCodeBlock,a as WuiCommandPalette,o as WuiCommentThread,s as WuiConsentBanner,c as WuiContextMenu,l as WuiDataTable,u as WuiDatePicker,d as WuiDateRange,f as WuiDateTime,p as WuiDock,m as WuiDrawer,h as WuiDropdown,g as WuiEntryGrid,_ as WuiGantt,v as WuiHoverCard,y as WuiImageCrop,b as WuiInlineEdit,t as WuiKanban,x as WuiLeadPopup,S as WuiLightbox,C as WuiMarkdown,w as WuiMentionInput,T as WuiModal,E as WuiNavigationMenu,D as WuiNotificationCenter,O as WuiOnboardingChecklist,k as WuiOrgTree,A as WuiOtp,j as WuiOverflow,M as WuiPhone,N as WuiPopover,P as WuiRating,F as WuiRecordPager,I as WuiRelativeTime,L as WuiSavedViews,R as WuiSelect,z as WuiShortcuts,B as WuiShowMore,V as WuiSlider,H as WuiSortable,n as WuiStatusIcon,U as WuiTimePicker,W as WuiTour,G as WuiTree,K as WuiTreePicker,q as WuiTruncate,J as WuiWhatsNew,X as WuiWizard,Z as WuiWizardStep,$ as defineWeborityElements,ae as formatCompact,Q as formatCurrency,ne as formatDate,oe as formatDateTime,te as formatNumber,ie as formatPercent,re as formatValue};
1
+ import{n as e}from"./elementBase-Cxeyx0tU.js";import{n as ee}from"./filterPopover-DskHFNLi.js";import{t}from"./kanban-Dayig7ic.js";import{n}from"./statusIcons-Cd3GJcBR.js";import{t as r}from"./WuiCalendarViews-Dg9yRY1I.js";import{t as i}from"./WuiCarousel-B0yPDH5I.js";import{t as te}from"./WuiCodeBlock-BWYZ1S70.js";import{t as a}from"./WuiCommandPalette-CpmlKjzH.js";import{t as o}from"./WuiCommentThread-Cp7AVHvt.js";import{t as s}from"./WuiConsentBanner-nTua-kEd.js";import{t as c}from"./WuiContextMenu-DEWYYFRG.js";import{r as l}from"./WuiDashboardGrid-DFpX8Vx0.js";import{t as u}from"./WuiDataTable-CSgcwxU5.js";import{t as d}from"./WuiDatePicker-CRqjwyf2.js";import{t as f}from"./WuiDateRange-BBm_Q69p.js";import{t as p}from"./WuiDateTime-Vimu6grS.js";import{t as m}from"./WuiDock-2LGlbEFx.js";import{t as h}from"./WuiDrawer-BsY0fs_u.js";import{t as g}from"./WuiDropdown-6g074v1T.js";import{t as _}from"./WuiEntryGrid-Z69-1YBh.js";import{t as v}from"./WuiGantt-DvmVKJX2.js";import{t as y}from"./WuiHoverCard-DhJcIIM1.js";import{t as b}from"./WuiImageCrop-UakcSM2k.js";import{t as x}from"./WuiInlineEdit-JT83k3Nk.js";import{t as S}from"./WuiLeadPopup-DaYZ2zCJ.js";import{t as C}from"./WuiLightbox-DpHJAMO3.js";import{t as w}from"./WuiMarkdown-DRtGPxQX.js";import{r as T}from"./WuiMentionInput-DPCCSQRZ.js";import{t as E}from"./WuiMiniCalendar-BhUTIGwe.js";import{t as D}from"./WuiModal-DQbVJGUo.js";import{t as O}from"./WuiNavigationMenu-KdW7yuLn.js";import{t as k}from"./WuiNotificationCenter-D5bBM8Lp.js";import{t as A}from"./WuiOfflineBanner-DGTFCtyM.js";import{t as j}from"./WuiOnboardingChecklist-C-nllg2h.js";import{t as M}from"./WuiOrgTree-DWSk_LHd.js";import{t as N}from"./WuiOtp-Cc0formv.js";import{t as P}from"./WuiOverflow-fZKqdsr-.js";import{t as F}from"./WuiPhone-B5ZLabTY.js";import{t as I}from"./WuiPopover-BvWKRNQY.js";import{t as L}from"./WuiRating-DIQfif9x.js";import{t as R}from"./WuiRecordPager-BXoe4KfU.js";import{t as z}from"./WuiRelativeTime-CSg9vzfk.js";import{t as B}from"./WuiSavedViews-CH7IvwgZ.js";import{t as V}from"./WuiSelect-DIW_WXH7.js";import{t as H}from"./WuiShortcuts-CRCctX82.js";import{t as U}from"./WuiShowMore-BoYCrYYf.js";import{t as W}from"./WuiSlider-CK7_l_R5.js";import{t as G}from"./WuiSortable-x8Mg0tOv.js";import{t as K}from"./WuiTimePicker-BKFPf8Fn.js";import{t as q}from"./WuiTour-BgpMa8J5.js";import{t as J}from"./WuiTree-Db83Uztv.js";import{t as Y}from"./WuiTreePicker-DLddmEgG.js";import{t as X}from"./WuiTruncate-BB4i8wHE.js";import{n as Z,t as ne}from"./WuiWhatsNew-Dm4Yl68x.js";import{n as Q,t as $}from"./WuiWizardStep-BBkw94dD.js";import{c as re,f as ie,l as ae,m as oe,p as se,s as ce,u as le}from"./formatters-DTW53DjY.js";import{_ as ue,r as de}from"./themeTransition-C5nAlClG.js";import{t as fe}from"./drawerDiscard-D_LMpaFv.js";import{n as pe}from"./shortcutKeys-BMTWgV2g.js";function me(){ee(),e(`wui-select`,V),e(`wui-saved-views`,B),e(`wui-phone`,F),e(`wui-datepicker`,d),e(`wui-mini-calendar`,E),e(`wui-date-range`,f),e(`wui-date-time`,p),e(`wui-dock`,m),e(`wui-image-crop`,b),e(`wui-kanban`,t),e(`wui-dashboard-grid`,l),e(`wui-lead-popup`,S),e(`wui-inline-edit`,x),e(`wui-consent-banner`,s),e(`wui-slider`,W),e(`wui-sortable`,G),e(`wui-timepicker`,K),e(`wui-tour`,q),e(`wui-tree`,J),e(`wui-tree-picker`,Y),e(`wui-org-tree`,M),e(`wui-command-palette`,a),e(`wui-context-menu`,c),e(`wui-otp`,N),e(`wui-status-icon`,n),e(`wui-shortcuts`,H),e(`wui-record-pager`,R),e(`wui-carousel`,i),e(`wui-code-block`,te),e(`wui-markdown`,w),e(`wui-modal`,D),e(`wui-data-table`,u),e(`wui-drawer`,h),e(`wui-dropdown`,g),e(`wui-entry-grid`,_),e(`wui-gantt`,v),e(`wui-hover-card`,y),e(`wui-lightbox`,C),e(`wui-navigation-menu`,O),e(`wui-notification-center`,k),e(`wui-onboarding-checklist`,j),e(`wui-overflow`,P),e(`wui-popover`,I),e(`wui-rating`,L),e(`wui-relative-time`,z),e(`wui-show-more`,U),e(`wui-calendar-views`,r),e(`wui-truncate`,X),e(`wui-whats-new`,Z),e(`wui-offline-banner`,A),e(`wui-mention-input`,T),e(`wui-comment-thread`,o),e(`wui-wizard-step`,$),e(`wui-wizard`,Q)}me();export{fe as DISCARD_EVENT,ue as ROW_DROP_EVENT,pe as SHORTCUT_EVENT,de as THEME_CHANGE_EVENT,ne as WHATS_NEW_READ_EVENT,r as WuiCalendarViews,i as WuiCarousel,te as WuiCodeBlock,a as WuiCommandPalette,o as WuiCommentThread,s as WuiConsentBanner,c as WuiContextMenu,l as WuiDashboardGrid,u as WuiDataTable,d as WuiDatePicker,f as WuiDateRange,p as WuiDateTime,m as WuiDock,h as WuiDrawer,g as WuiDropdown,_ as WuiEntryGrid,v as WuiGantt,y as WuiHoverCard,b as WuiImageCrop,x as WuiInlineEdit,t as WuiKanban,S as WuiLeadPopup,C as WuiLightbox,w as WuiMarkdown,T as WuiMentionInput,E as WuiMiniCalendar,D as WuiModal,O as WuiNavigationMenu,k as WuiNotificationCenter,A as WuiOfflineBanner,j as WuiOnboardingChecklist,M as WuiOrgTree,N as WuiOtp,P as WuiOverflow,F as WuiPhone,I as WuiPopover,L as WuiRating,R as WuiRecordPager,z as WuiRelativeTime,B as WuiSavedViews,V as WuiSelect,H as WuiShortcuts,U as WuiShowMore,W as WuiSlider,G as WuiSortable,n as WuiStatusIcon,K as WuiTimePicker,q as WuiTour,J as WuiTree,Y as WuiTreePicker,X as WuiTruncate,Z as WuiWhatsNew,Q as WuiWizard,$ as WuiWizardStep,me as defineWeborityElements,ce as formatCompact,re as formatCurrency,ae as formatDate,le as formatDateTime,ie as formatNumber,se as formatPercent,oe as formatValue};
@@ -16,4 +16,4 @@ html, body { margin: 0; padding: 0; }
16
16
  img { display: block; break-after: page; }
17
17
  img:last-child { break-after: auto; }`,pages:e.map(e=>({url:e.url,width:e.width,height:e.height,page:`s${n.indexOf(t(e))}`}))}}function Lo(e,t,n){let r=e.textContent??``,i=[],a=0;for(let{from:e,to:o,n:s}of t){e>a&&i.push(document.createTextNode(r.slice(a,e)));let t=document.createElement(`mark`);t.className=s===n?`wui-file-viewer-hit wui-file-viewer-hit-current`:`wui-file-viewer-hit`,t.textContent=r.slice(e,o),i.push(t),a=o}a<r.length&&i.push(document.createTextNode(r.slice(a))),e.replaceChildren(...i)}function Z(e,t){let n=e[t];if(n===void 0)throw RangeError(`No item at index ${t}.`);return n}function Ro(e){let t=[...e].sort((e,t)=>e-t);return Z(t,Math.floor(t.length/2))}var Q,zo,Bo,Vo,Ho,Uo,Wo,Go,Ko,qo,Jo,Yo,Xo,Zo,Qo,$o,es,ts,ns,rs,is,as,os,ss,cs,ls,us=n((()=>{_o(),yo(),Do(),We(),O(),Ao(),tt(),rt(),Q=()=>Ge(`fileViewer`,nt),zo=[.5,.75,1,1.25,1.5,2,3],Bo=[.5,.75,1,1.25,1.5,2],Vo=[{key:`fit-width`,textKey:`fitWidthLabel`},{key:`fit-page`,textKey:`fitPageLabel`}],Ho=96/72,Uo=12,Wo=10,Go=168,Ko=150,qo=2,Jo=2e3,Yo=5,Xo=150,Zo=16777216,Qo=null,$o=e=>Vo.some(t=>t.key===e),es=e=>{if($o(e))return e;let t=Number(e);return zo.includes(t)?t:`fit-width`},ts=e=>e instanceof Element&&e.closest(`input, textarea, select, [contenteditable='true'], .dropdown-menu`),ns=e=>/^(https?:|mailto:)/i.test(e),rs=class{constructor(e,t){this.shell=e,this.source=t;let n=e.prefs;this.zoom=es(n.zoom),this.twoPage=n.twoPage===!0,this.showThumbs=n.thumbnails===!0,this.sizes=[],this.rows=[],this.rowOf=[],this.scale=0,this.drawnScale=0,this.pages=new Map,this.thumbsDrawn=new Set,this.area={width:0,height:0},this.scrollPos={top:0,left:0},this.jumpTarget=null,this.search={open:!1,query:``,index:null,indexing:!1,hits:[],current:-1,marked:new Map},this.printRun=null,this.destroyed=!1,this._timers=new Set}load(){return this._loading=this._load(),this._loading}async _load(){Mo(this.source.workerSrc),this.task=yn({url:this.source.src,...No(this.source.assetBase)});let e;try{e=await this.task.promise}catch(e){this.destroyed||this.shell.fail(e);return}if(this.destroyed){e.destroy();return}this.pdf=e;let t=await Promise.all(Array.from({length:e.numPages},(t,n)=>e.getPage(n+1)));this.destroyed||(this.sizes=t.map(e=>{let t=e.getViewport({scale:Ho});return{width:t.width,height:t.height}}),this._buildToolbar(),this._buildBody(),this._layout(),this.shell.loaded({kind:`pdf`,pages:e.numPages}))}destroy(){this.destroyed=!0,this.zoomMenu?.close();for(let e of this._timers)window.clearTimeout(e);this._scrollFrame!==void 0&&window.cancelAnimationFrame(this._scrollFrame),this._resizeObserver?.disconnect(),this._onKeyDown&&this.shell.host.removeEventListener(`keydown`,this._onKeyDown),this._thumbObserver?.disconnect();for(let e of[...this.pages.keys()])this._release(e);this._releasePrint();let e=this.task;e&&(this._loading??Promise.resolve()).catch(e=>{p(`PDF load failed before the viewer closed.`,e)}).finally(()=>e.destroy())}_buildToolbar(){let{start:e,center:t,end:n,host:r}=this.shell;this.thumbsButton=A(`menu`,``,{size:17}),this.thumbsButton.addEventListener(`click`,()=>this._setThumbs(!this.showThumbs)),e.prepend(this.thumbsButton),this.prevButton=A(`chevron-up`,Q().previousPageLabel),this.prevButton.addEventListener(`click`,()=>this.goToPage(this.current()-this.cols()));let i=document.createElement(`span`);i.className=`wui-file-viewer-page`,this.pageInput=document.createElement(`input`),this.pageInput.className=`wui-file-viewer-page-input`,this.pageInput.setAttribute(`aria-label`,Q().pageNumberLabel),this.pageInput.inputMode=`numeric`,this.pageInput.addEventListener(`input`,()=>{this.pageInput.value=this.pageInput.value.replace(/[^\d]/g,``)}),this.pageInput.addEventListener(`keydown`,e=>{ko(e)&&this.pageInput.blur()}),this.pageInput.addEventListener(`blur`,()=>this._commitPageInput());let a=document.createElement(`span`);a.className=`wui-file-viewer-page-total`,a.textContent=`/ ${this.pdf.numPages}`,i.append(this.pageInput,a),this.nextButton=A(`chevron-down`,Q().nextPageLabel),this.nextButton.addEventListener(`click`,()=>this.goToPage(this.current()+this.cols())),t.append(this.prevButton,i,this.nextButton),this.searchButton=A(`search`,Q().searchDocumentLabel,{className:`wui-file-viewer-search-toggle`}),this.searchButton.setAttribute(`aria-controls`,`${r.uid}-search`),this.searchButton.addEventListener(`click`,()=>this.search.open?this._closeSearch():this._openSearch()),this.zoomOutButton=A(`zoom-out`,Q().zoomOutLabel),this.zoomOutButton.addEventListener(`click`,()=>this._stepZoom(-1)),this.zoomButton=document.createElement(`button`),this.zoomButton.type=`button`,this.zoomButton.className=`wui-file-viewer-zoom`,this.zoomMenu=Ue(this.zoomButton,{label:Q().zoomLabel,items:()=>[...Bo.map(e=>({key:String(e),label:`${Math.round(e*100)}%`,checked:this.zoom===e})),{key:`fit-divider`,divider:!0},...Vo.map(e=>({key:e.key,label:Q()[e.textKey],checked:this.zoom===e.key}))],onPick:e=>this._setZoom(es(e))}),this.zoomInButton=A(`zoom-in`,Q().zoomInLabel),this.zoomInButton.addEventListener(`click`,()=>this._stepZoom(1));let o=document.createElement(`span`);o.className=`wui-file-viewer-divider`,this.twoPageButton=A(`two-page`,Q().twoPageViewLabel),this.twoPageButton.addEventListener(`click`,()=>this._setTwoPage(!this.twoPage)),this.printButton=A(`printer`,Q().printLabel,{className:`wui-file-viewer-print`}),this.printButton.addEventListener(`click`,()=>this.print()),this.printButton.hidden=!this.shell.print(),n.prepend(this.searchButton,this.zoomOutButton,this.zoomButton,this.zoomInButton,o,this.twoPageButton,this.printButton),this._buildSearchRow(),this._syncToolbar()}_buildSearchRow(){let e=this.shell.search;e.id=`${this.shell.host.uid}-search`;let t=document.createElement(`div`);t.className=`wui-file-viewer-search-field`,this.searchInput=document.createElement(`input`),this.searchInput.type=`search`,this.searchInput.className=`form-control wui-input-sm`,this.searchInput.placeholder=Q().searchDocumentLabel,this.searchInput.setAttribute(`aria-label`,Q().searchDocumentLabel),this.searchInput.addEventListener(`input`,()=>this._setQuery(this.searchInput.value)),this.searchInput.addEventListener(`keydown`,e=>{ko(e)?(e.preventDefault(),this._goToHit(this.search.current+(e.shiftKey?-1:1))):e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),this._closeSearch())}),t.append(this.searchInput),this.searchStatus=document.createElement(`span`),this.searchStatus.className=`wui-file-viewer-search-count`,this.searchStatus.setAttribute(`aria-live`,`polite`),this.prevHitButton=A(`chevron-up`,Q().previousMatchLabel),this.prevHitButton.addEventListener(`click`,()=>this._goToHit(this.search.current-1)),this.nextHitButton=A(`chevron-down`,Q().nextMatchLabel),this.nextHitButton.addEventListener(`click`,()=>this._goToHit(this.search.current+1));let n=A(`x`,Q().closeSearchLabel);n.addEventListener(`click`,()=>this._closeSearch()),e.append(t,this.searchStatus,this.prevHitButton,this.nextHitButton,n)}_syncToolbar(){let e=this.current(),t=this.rows.length-1;document.activeElement!==this.pageInput&&(this.pageInput.value=String(e)),this.prevButton.disabled=e<=1,this.nextButton.disabled=(this.rowOf[e]??0)>=t,this.zoomOutButton.disabled=this._zoomStep(-1)==null,this.zoomInButton.disabled=this._zoomStep(1)==null;let n=Math.round((this.scale||1)*100);this._shownPercent!==n&&(this._shownPercent=n,this.zoomButton.replaceChildren(`${n}%`,D(`chevron-down`,{size:12})??``),this.zoomButton.setAttribute(`aria-label`,Ke(Q().zoomText,{percent:n}))),He(this.thumbsButton,this.showThumbs?Q().hideThumbnailsLabel:Q().showThumbnailsLabel),this.thumbsButton.setAttribute(`aria-pressed`,String(this.showThumbs)),this.twoPageButton.setAttribute(`aria-pressed`,String(this.twoPage)),this.printButton.disabled=this.printRun!=null&&!this.printRun.ready,He(this.printButton,this.printButton.disabled?Q().preparingPrintLabel:Q().printLabel),He(this.searchButton,this.search.open?Q().closeSearchLabel:Q().searchDocumentLabel),this.searchButton.setAttribute(`aria-expanded`,String(this.search.open)),this._syncSearchStatus()}_buildBody(){let e=this.shell.body;this.thumbRail=document.createElement(`div`),this.thumbRail.className=`wui-file-viewer-thumbs wui-scroll${this.showThumbs?` open`:``}`,this.scroller=document.createElement(`div`),this.scroller.className=`wui-file-viewer-scroll wui-scroll`,this.scroller.tabIndex=0,this.scroller.setAttribute(`role`,`region`),this.scroller.setAttribute(`aria-label`,Q().documentPagesLabel),this.pagesEl=document.createElement(`div`),this.pagesEl.className=`wui-file-viewer-pages`,this.scroller.append(this.pagesEl),e.replaceChildren(this.thumbRail,this.scroller),this.pageEls=[];for(let e=1;e<=this.pdf.numPages;e++){let t=document.createElement(`div`);t.className=`wui-file-viewer-sheet`,t.dataset.page=String(e),this.pageEls[e]=t}this.showThumbs&&this._buildThumbs(),this.scroller.addEventListener(`scroll`,()=>this._onScroll(),{passive:!0}),this.scroller.addEventListener(`pointerdown`,e=>this._panStart(e)),this.scroller.addEventListener(`pointermove`,e=>this._panMove(e));for(let e of[`pointerup`,`pointercancel`,`lostpointercapture`])this.scroller.addEventListener(e,()=>this._panEnd());this.scroller.addEventListener(`wheel`,e=>{if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault();let t=performance.now();t-(this._lastWheelZoom??0)<120||(this._lastWheelZoom=t,this._stepZoom(e.deltaY<0?1:-1))},{passive:!1}),this._onKeyDown=e=>this._keyDown(e),this.shell.host.addEventListener(`keydown`,this._onKeyDown),this._resizeObserver=new ResizeObserver(()=>{let e=this.scroller.clientWidth,t=this.scroller.clientHeight;(e!==this.area.width||t!==this.area.height)&&(this.area={width:e,height:t},this._layout())}),this._resizeObserver.observe(this.scroller),this.area={width:this.scroller.clientWidth,height:this.scroller.clientHeight}}cols(){return this.twoPage?2:1}_targetScale(){if(typeof this.zoom==`number`)return this.zoom;let e=this.cols(),t=Ro(this.sizes.map(e=>e.width)),n=Ro(this.sizes.map(e=>e.height)),r=(this.area.width-24-(e-1)*Wo)/(t*e);return this.zoom===`fit-page`&&(r=Math.min(r,(this.area.height-24)/n)),Math.max(r,.1)}_layout(){if(!this.pdf||!this.area.width)return;let e=this._anchor();this.scale=this._targetScale();let t=this.cols();this.rows=[],this.rowOf=[];let n=Uo,r=document.createDocumentFragment();for(let e=1;e<=this.pdf.numPages;e+=t){let i=[];for(let n=e;n<e+t&&n<=this.pdf.numPages;n++)i.push(n);let a=document.createElement(`div`);a.className=`wui-file-viewer-row`;let o=0;for(let e of i){let{width:t,height:n}=Z(this.sizes,e-1),r=Z(this.pageEls,e);r.style.width=`${Math.floor(t*this.scale)}px`,r.style.height=`${Math.floor(n*this.scale)}px`,r.style.setProperty(`--scale-factor`,String(this.scale*Ho)),o=Math.max(o,Math.floor(n*this.scale)),a.append(r),this.rowOf[e]=this.rows.length}this.rows.push({pages:i,top:n,height:o}),n+=o+Wo,r.append(a)}let i=this.scroller.scrollWidth;this.pagesEl.replaceChildren(r),this._restore(e,i),this._scheduleRedraw(),this._update()}_anchor(){if(!this.rows.length)return null;let e=this._rowAt(this.scrollPos.top),t=Z(this.rows,e);return{page:Z(t.pages,0),within:(this.scrollPos.top-t.top)/Math.max(t.height+Wo,1),left:this.scrollPos.left}}_restore(e,t){let n=this.scroller;if(e){let r=Z(this.rows,Z(this.rowOf,e.page));n.scrollTop=r.top+e.within*(r.height+Wo),n.scrollLeft=(t?(e.left+n.clientWidth/2)/t:.5)*n.scrollWidth-n.clientWidth/2}this.scrollPos={top:n.scrollTop,left:n.scrollLeft}}_rowAt(e){let t=0,n=this.rows.length-1;for(;t<n;){let r=t+n+1>>1;Z(this.rows,r).top<=e+1?t=r:n=r-1}return t}current(){if(this.jumpTarget!=null)return this.jumpTarget;if(!this.rows.length)return 1;let e=this.scrollPos.top,t=e+this.area.height,n=this._rowAt(e),r=-1;for(let i=n;i<this.rows.length&&Z(this.rows,i).top<t;i++){let{top:a,height:o}=Z(this.rows,i),s=Math.min(a+o,t)-Math.max(a,e);s>r&&(r=s,n=i)}return Z(Z(this.rows,n).pages,0)}_onScroll(){this.scrollPos={top:this.scroller.scrollTop,left:this.scroller.scrollLeft},this._scrollFrame!==void 0&&window.cancelAnimationFrame(this._scrollFrame),this._scrollFrame=window.requestAnimationFrame(()=>this._update())}_update(){if(!this.rows.length||this.destroyed)return;let e=Math.max(0,this._rowAt(this.scrollPos.top)-qo),t=Math.min(this.rows.length-1,this._rowAt(this.scrollPos.top+this.area.height)+qo),n=new Set;for(let r=e;r<=t;r++)for(let e of Z(this.rows,r).pages)n.add(e);for(let e of[...this.pages.keys()])n.has(e)||this._release(e);this.visibleRow=this._rowAt(this.scrollPos.top);for(let e of n)this.pages.has(e)||this._mount(e);this._pump(),this._syncToolbar(),this.showThumbs&&this._followThumb()}_scheduleRedraw(){if(this.scale===this.drawnScale)return;window.clearTimeout(this._redrawTimer),this._timers.delete(this._redrawTimer);let e=this.drawnScale?Ko:0;this._redrawTimer=window.setTimeout(()=>{this._timers.delete(this._redrawTimer),this.drawnScale=this.scale,this._pump()},e),this._timers.add(this._redrawTimer)}_mount(e){let t=Z(this.pageEls,e),n={n:e,drawnAt:0,task:null,canvas:null,text:null,textLayer:null,links:null};this.pages.set(e,n);let r=document.createElement(`div`);r.className=`wui-file-viewer-skeleton`,t.replaceChildren(r),this._drawText(n),this._drawLinks(n)}_release(e){let t=this.pages.get(e);t&&(t.released=!0,t.task?.cancel(),t.textLayer?.cancel(),t.canvas&&(t.canvas.width=0,t.canvas.height=0),this.pages.delete(e),this.search.marked.delete(e),Z(this.pageEls,e).replaceChildren())}_pump(){if(this._drawing||!this.drawnScale||this.destroyed)return;let e=this.visibleRow??0,t=null,n=1/0;for(let r of this.pages.values()){if(r.drawnAt===this.drawnScale)continue;let i=Math.abs((this.rowOf[r.n]??NaN)-e);i<n&&(n=i,t=r)}t&&(this._drawing=!0,this._drawCanvas(t).finally(()=>{this._drawing=!1,this._pump()}))}async _drawCanvas(e){let t=this.drawnScale,n=await this.pdf.getPage(e.n);if(e.released||this.destroyed)return;let r=n.getViewport({scale:t*Ho}),i=window.devicePixelRatio||1,a=Math.sqrt(Zo/(r.width*r.height)),o=Math.min(i,a),s=document.createElement(`canvas`);s.className=`wui-file-viewer-canvas`,s.width=Math.floor(r.width*o),s.height=Math.floor(r.height*o),s.setAttribute(`aria-hidden`,`true`),e.task=n.render({canvas:s,viewport:r,transform:o===1?void 0:[o,0,0,o,0,0]});try{await e.task.promise}catch(e){s.width=0,s.height=0,os(e)!==`RenderingCancelledException`&&this._warn(`page draw failed`,e);return}finally{e.task=null}if(e.released||this.destroyed){s.width=0,s.height=0;return}let c=Z(this.pageEls,e.n);e.canvas?(e.canvas.replaceWith(s),e.canvas.width=0,e.canvas.height=0):(c.querySelector(`.wui-file-viewer-skeleton`)?.remove(),c.prepend(s)),e.canvas=s,e.drawnAt=t,this.showThumbs&&!this.thumbsDrawn.has(e.n)&&this._thumbFromCanvas(e.n,s)}async _drawText(e){let t=await this.pdf.getPage(e.n);if(e.released||this.destroyed)return;let n=document.createElement(`div`);n.className=`wui-file-viewer-text`,e.text=n,e.textLayer=new Zi({textContentSource:t.streamTextContent({includeMarkedContent:!0,disableNormalization:!0}),container:n,viewport:t.getViewport({scale:this.scale*Ho})});try{await e.textLayer.render()}catch(e){os(e)!==`AbortException`&&this._warn(`text layer failed`,e);return}e.released||this.destroyed||(Z(this.pageEls,e.n).append(n),this._markPage(e.n),this._revealHit(e.n))}async _drawLinks(e){let t=await this.pdf.getPage(e.n),n=await t.getAnnotations({intent:`display`});if(e.released||this.destroyed)return;let r=n.filter(e=>e.subtype===`Link`&&(e.dest||e.url&&ns(e.url))),i=(await Promise.all(r.map(async e=>e.url?{link:e,target:void 0}:{link:e,target:await this._destPage(e.dest)}))).filter(({link:e,target:t})=>e.url||t);if(!i.length||e.released||this.destroyed)return;let a=t.getViewport({scale:1}),o=document.createElement(`div`);o.className=`wui-file-viewer-links`;for(let{link:e,target:t}of i){let[n=NaN,r=NaN,i=NaN,s=NaN]=a.convertToViewportRectangle(e.rect),c=document.createElement(`a`);if(c.style.left=`${Math.min(n,i)/a.width*100}%`,c.style.top=`${Math.min(r,s)/a.height*100}%`,c.style.width=`${Math.abs(i-n)/a.width*100}%`,c.style.height=`${Math.abs(s-r)/a.height*100}%`,e.url)c.href=e.url,c.target=`_blank`,c.rel=`noopener noreferrer`,c.title=e.url,c.setAttribute(`aria-label`,e.url);else if(t){let e=t;c.href=`#page=${e}`,c.setAttribute(`aria-label`,Ke(Q().goToPageText,{targetPage:e})),c.addEventListener(`click`,t=>{t.preventDefault(),this.goToPage(e)})}o.append(c)}e.links=o,Z(this.pageEls,e.n).append(o)}async _destPage(e){try{let t=(typeof e==`string`?await this.pdf.getDestination(e):e)?.[0];if(t==null)return null;let n=is(t)?await this.pdf.getPageIndex(t):t;if(typeof n!=`number`)throw TypeError(`The link destination is not a page.`);return n+1}catch(e){return this._warn(`link target not found`,e),null}}goToPage(e){let t=Math.min(Math.max(1,e),this.pdf.numPages),n=Math.min(Z(this.rows,Z(this.rowOf,t)).top-Uo,this.scroller.scrollHeight-this.scroller.clientHeight);window.clearTimeout(this._jumpTimer);let r=this._endJump;r&&this.scroller.removeEventListener(`scrollend`,r),this._endJump=()=>{window.clearTimeout(this._jumpTimer);let e=this._endJump;e&&this.scroller.removeEventListener(`scrollend`,e),this.jumpTarget=null,this._syncToolbar()},Math.abs(n-this.scroller.scrollTop)>=1&&(this.jumpTarget=t,this.scroller.addEventListener(`scrollend`,this._endJump),this._jumpTimer=window.setTimeout(this._endJump,Jo),this._timers.add(this._jumpTimer),this.scroller.scrollTo({top:n,behavior:ls()})),this._syncToolbar()}_commitPageInput(){let e=Number.parseInt(this.pageInput.value,10);Number.isNaN(e)?this.pageInput.value=String(this.current()):this.goToPage(e)}_zoomStep(e){let t=Math.round((this.scale||1)*100);return e>0?zo.find(e=>Math.round(e*100)>t)??null:[...zo].reverse().find(e=>Math.round(e*100)<t)??null}_stepZoom(e){let t=this._zoomStep(e);t!=null&&this._setZoom(t)}_setZoom(e){this.zoom=e,this.shell.savePrefs({zoom:String(e)}),this._layout()}_setTwoPage(e){this.twoPage=e,this.shell.savePrefs({twoPage:e}),this._layout()}_setThumbs(e){this.showThumbs=e,this.shell.savePrefs({thumbnails:e}),this.thumbRail.classList.toggle(`open`,e),e&&!this.thumbRail.childElementCount&&this._buildThumbs(),this._syncToolbar(),e&&(this._activeThumb=void 0,this._followThumb())}_buildThumbs(){this.thumbEls=[],this._thumbObserver=new IntersectionObserver(e=>{for(let t of e)t.isIntersecting&&t.target instanceof HTMLElement&&this._drawThumb(Number(t.target.dataset.page))},{root:this.thumbRail,rootMargin:`200px 0px`});for(let e=1;e<=this.pdf.numPages;e++){let t=document.createElement(`button`);t.type=`button`,t.className=`wui-file-viewer-thumb`,t.dataset.page=String(e),t.setAttribute(`aria-label`,Ke(Q().goToPageText,{targetPage:e}));let{width:n,height:r}=Z(this.sizes,e-1),i=document.createElement(`span`);i.className=`wui-file-viewer-thumb-frame`,i.style.aspectRatio=`${n} / ${r}`;let a=document.createElement(`span`);a.className=`wui-file-viewer-thumb-no`,a.textContent=String(e),t.append(i,a),t.addEventListener(`click`,()=>this.goToPage(e)),this.thumbRail.append(t),this.thumbEls[e]=t,this._thumbObserver.observe(t)}}async _drawThumb(e){if(this.thumbsDrawn.has(e))return;this.thumbsDrawn.add(e);let t=this.pages.get(e)?.canvas;if(t){this._thumbFromCanvas(e,t);return}let n=await this.pdf.getPage(e);if(this.destroyed)return;let r=window.devicePixelRatio||1,i=n.getViewport({scale:Go*r/n.getViewport({scale:1}).width}),a=document.createElement(`canvas`);a.width=Math.floor(i.width),a.height=Math.floor(i.height);try{await n.render({canvas:a,viewport:i}).promise}catch(t){this.thumbsDrawn.delete(e),os(t)!==`RenderingCancelledException`&&this._warn(`thumbnail draw failed`,t);return}this._setThumbImage(e,a)}_thumbFromCanvas(e,t){this.thumbsDrawn.add(e);let n=window.devicePixelRatio||1,r=document.createElement(`canvas`);r.width=Math.floor(Go*n),r.height=Math.floor(r.width*t.height/t.width),r.getContext(`2d`)?.drawImage(t,0,0,r.width,r.height),this._setThumbImage(e,r)}_setThumbImage(e,t){let n=this.thumbEls?.[e]?.querySelector(`.wui-file-viewer-thumb-frame`);n&&(t.setAttribute(`aria-hidden`,`true`),n.replaceChildren(t))}_followThumb(){let e=this.current();e!==this._activeThumb&&this.thumbEls&&(this._activeThumb!==void 0&&this.thumbEls[this._activeThumb]?.classList.remove(`active`),this._activeThumb=e,this.thumbEls[e]?.classList.add(`active`),this.thumbEls[e]?.scrollIntoView({behavior:ls(),block:`nearest`}))}_openSearch(){this.search.open=!0,this.shell.search.hidden=!1,this._syncToolbar(),this.searchInput.focus(),this.searchInput.select(),!this.search.index&&!this.search.indexing&&(this.search.indexing=!0,this._syncSearchStatus(),xo(this.pdf).then(e=>{this.search.index=e}).catch(e=>{this._warn(`text index failed`,e),this.search.index=!1}).finally(()=>{this.search.indexing=!1,this.destroyed||this._setQuery(this.search.query)}))}_closeSearch(){this.search.open=!1,this.shell.search.hidden=!0,this._applyHits([],-1),this._syncToolbar(),this.searchButton.focus()}_setQuery(e){this.search.query=e;let t=this.search.index?Co(this.search.index,e):[],n=this.current(),r=t.findIndex(e=>e.page>=n);this._applyHits(t,t.length?Math.max(r,0):-1),this._revealPending=t.length>0,t.length&&this._bringHitIntoView()}_goToHit(e){let{hits:t}=this.search;t.length&&(this._applyHits(t,(e+t.length)%t.length),this._revealPending=!0,this._bringHitIntoView())}_applyHits(e,t){let n=e!==this.search.hits,r=this.search;if(this.search={...r,hits:e,current:t},n){let t=new Map;e.forEach((e,n)=>{let r=t.get(e.page)??[];r.push({...e,n}),t.set(e.page,r)}),this.search.byPage=t}let i=n?new Set([...r.marked.keys(),...this.search.byPage?.keys()??[]]):new Set([r.hits[r.current]?.page,e[t]?.page].filter(e=>e!==void 0));for(let e of i)this._markPage(e);this._syncSearchStatus()}_markPage(e){let t=this.pages.get(e),n=t?.textLayer?.textDivs;if(!n||!t?.text?.isConnected)return;let r=this.search.index,i=Array.isArray(r)?r[e-1]?.items:void 0,a=this.search.open?this.search.byPage?.get(e)??[]:[],o=this.search.marked.get(e)??new Set,s=new Set;i&&a.length&&i.forEach((e,t)=>{let r=wo(e,a),i=n[t];r.length&&i&&(s.add(t),Lo(i,r,this.search.current))});for(let e of o){let t=n[e];!s.has(e)&&t&&t.replaceChildren(t.textContent??``)}s.size?this.search.marked.set(e,s):this.search.marked.delete(e)}_bringHitIntoView(){let e=this.search.hits[this.search.current];if(!e)return;let t=Z(this.rows,Z(this.rowOf,e.page)),n=this.scrollPos.top;(t.top+t.height<n||t.top>n+this.area.height)&&(this.scroller.scrollTop=t.top-Uo),this._revealHit(e.page)}_revealHit(e){let t=this.search.hits[this.search.current];if(!this._revealPending||!t||t.page!==e)return;let n=Z(this.pageEls,e).querySelector(`.wui-file-viewer-hit-current`);if(!n)return;this._revealPending=!1;let r=this.scroller.getBoundingClientRect(),i=n.getBoundingClientRect();(i.top<r.top||i.bottom>r.bottom)&&(this.scroller.scrollTop+=i.top-r.top-this.scroller.clientHeight/2),(i.left<r.left||i.right>r.right)&&(this.scroller.scrollLeft+=i.left-r.left-this.scroller.clientWidth/2)}_syncSearchStatus(){this.searchStatus&&(this.searchStatus.textContent=bo(this.search),this.prevHitButton.disabled=!this.search.hits.length,this.nextHitButton.disabled=!this.search.hits.length)}_keyDown(e){if(e.defaultPrevented||e.altKey)return;if(e.ctrlKey||e.metaKey){if(e.key===`f`||e.key===`F`)this._openSearch();else if(e.key===`+`||e.key===`=`)this._stepZoom(1);else if(e.key===`-`||e.key===`_`)this._stepZoom(-1);else if(e.key===`0`)this._setZoom(`fit-width`);else return;e.preventDefault();return}if(e.shiftKey||ts(e.target))return;let t=this.cols();if(e.key===`PageDown`)this.goToPage(this.current()+t);else if(e.key===`PageUp`)this.goToPage(this.current()-t);else if(e.key===`Home`)this.goToPage(1);else if(e.key===`End`)this.goToPage(this.pdf.numPages);else return;e.preventDefault()}_panStart(e){let t=this.scroller;e.button!==0||t.scrollWidth<=t.clientWidth&&t.scrollHeight<=t.clientHeight||e.target instanceof Element&&e.target.closest(`a`)||(this._pan={id:e.pointerId,x:e.clientX,y:e.clientY,left:t.scrollLeft,top:t.scrollTop,active:!1})}_panMove(e){let t=this._pan;if(!t)return;let n=e.clientX-t.x,r=e.clientY-t.y;if(!t.active){if(Math.abs(n)<Yo&&Math.abs(r)<Yo)return;t.active=!0,this.scroller.setPointerCapture(t.id),this.scroller.classList.add(`wui-file-viewer-panning`)}this.scroller.scrollLeft=t.left-n,this.scroller.scrollTop=t.top-r}_panEnd(){let e=this._pan;e?.active&&(this.scroller.hasPointerCapture(e.id)&&this.scroller.releasePointerCapture(e.id),this.scroller.classList.remove(`wui-file-viewer-panning`)),this._pan=null}async print(){this._releasePrint();let e={ready:!1,urls:[]};this.printRun=e,this._syncToolbar();try{let t=[];for(let n=1;n<=this.pdf.numPages;n++){let r=await this.pdf.getPage(n),i=r.getViewport({scale:Xo/72}),a=document.createElement(`canvas`);a.width=Math.floor(i.width),a.height=Math.floor(i.height),await r.render({canvas:a,viewport:i,intent:`print`}).promise;let o=await new Promise((e,t)=>a.toBlob(n=>n?e(n):t(Error(`Page image failed`)),`image/png`));a.width=0,a.height=0;let s=URL.createObjectURL(o);if(e.urls.push(s),t.push({url:s,width:i.width/Xo*25.4,height:i.height/Xo*25.4}),this.printRun!==e)throw new DOMException(`Print replaced`,`AbortError`)}let n=document.createElement(`iframe`);n.className=`wui-file-viewer-print-frame`,n.title=Q().documentPrintingTitle,n.tabIndex=-1,n.setAttribute(`aria-hidden`,`true`),e.frame=n,n.srcdoc=Fo(this.shell.name()),n.addEventListener(`load`,async()=>{if(this.printRun===e)try{let{css:r,pages:i}=Io(t),a=n.contentWindow,o=n.contentDocument;if(!a||!o)throw TypeError(`The print frame has no document.`);let s=`CSSStyleSheet`in a?a.CSSStyleSheet:void 0;if(!as(s))throw TypeError(`The print frame has no CSSStyleSheet.`);let c=new s;c.replaceSync(r),o.adoptedStyleSheets=[c];let l=i.map(e=>{let t=o.createElement(`img`);return t.src=e.url,t.alt=``,t.style.setProperty(`width`,`${e.width}mm`),t.style.setProperty(`height`,`${e.height}mm`),t.style.setProperty(`page`,e.page),t});if(o.body.append(...l),await Promise.all(l.map(ss)),this.printRun!==e)return;e.ready=!0,this._syncToolbar(),a.addEventListener(`afterprint`,()=>{this.printRun===e&&this._releasePrint()},{once:!0}),a.focus(),a.print()}catch(e){this._printFallback(e)}},{once:!0}),document.body.append(n)}catch(t){if(this.printRun!==e){for(let t of e.urls)URL.revokeObjectURL(t);return}this._printFallback(t)}}_printFallback(e){this._releasePrint(),this._warn(`print failed`,e),window.open(this.source.src,`_blank`,`noopener`)}_releasePrint(){let e=this.printRun;if(this.printRun=null,e){e.frame?.remove();for(let t of e.urls)URL.revokeObjectURL(t)}this.printButton&&this._syncToolbar()}_warn(e,t){f(`[wui-file-viewer] ${e}:`,t instanceof Error?t.message:t)}},is=e=>typeof e==`object`&&!!e,as=e=>typeof e==`function`,os=e=>e instanceof Error?e.name:void 0,ss=e=>e.complete?null:new Promise(t=>{e.addEventListener(`load`,t,{once:!0}),e.addEventListener(`error`,t,{once:!0})}),cs=e=>String(e??``).replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`),ls=()=>window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches?`auto`:`smooth`})),ds=r({ImageView:()=>gs}),fs,ps,ms,hs,gs,_s,vs,ys=n((()=>{m(),We(),O(),tt(),rt(),fs=()=>Ge(`fileViewer`,nt),ps=[.1,.25,.5,.75,1,1.5,2,3,4],ms=[.25,.5,1,2,4],hs=5,gs=class{constructor(e,t){this.shell=e,this.source=t,this.zoom=`fit`,this.rotation=0,this.area={width:0,height:0},this.destroyed=!1}load(){let e=document.createElement(`img`);e.className=`wui-file-viewer-image`,e.alt=this.shell.name(),e.decoding=`async`,e.draggable=!1,e.addEventListener(`load`,()=>{this.destroyed||(this.natural={width:e.naturalWidth||300,height:e.naturalHeight||150},this._build(e),this.shell.loaded({kind:`image`,pages:1}))}),e.addEventListener(`error`,()=>{this.destroyed||this.shell.fail(Error(`The image could not be decoded.`))}),e.src=this.source.src,this.img=e}destroy(){this.destroyed=!0,this.zoomMenu?.close(),this._resizeObserver?.disconnect(),this._onKeyDown&&this.shell.host.removeEventListener(`keydown`,this._onKeyDown),this._printFrame?.remove(),this.img?.removeAttribute(`src`)}_build(e){let{center:t,end:n,body:r,host:i}=this.shell;this.zoomOutButton=A(`zoom-out`,fs().zoomOutLabel),this.zoomOutButton.addEventListener(`click`,()=>this._stepZoom(-1)),this.zoomButton=document.createElement(`button`),this.zoomButton.type=`button`,this.zoomButton.className=`wui-file-viewer-zoom`,this.zoomMenu=Ue(this.zoomButton,{label:fs().zoomLabel,items:()=>[...ms.map(e=>({key:String(e),label:`${Math.round(e*100)}%`,checked:this.zoom===e})),{key:`fit-divider`,divider:!0},{key:`fit`,label:fs().fitLabel,checked:this.zoom===`fit`}],onPick:e=>this._setZoom(e===`fit`?`fit`:Number(e))}),this.zoomInButton=A(`zoom-in`,fs().zoomInLabel),this.zoomInButton.addEventListener(`click`,()=>this._stepZoom(1));let a=A(`rotate-ccw`,fs().rotateLeftLabel);a.addEventListener(`click`,()=>this._rotate(-90));let o=A(`rotate-cw`,fs().rotateRightLabel);o.addEventListener(`click`,()=>this._rotate(90));let s=document.createElement(`span`);s.className=`wui-file-viewer-divider wui-file-viewer-print`;let c=A(`printer`,fs().printLabel,{className:`wui-file-viewer-print`});c.addEventListener(`click`,()=>this.print()),s.hidden=c.hidden=!this.shell.print(),t.append(this.zoomOutButton,this.zoomButton,this.zoomInButton),n.prepend(a,o,s,c),this.scroller=document.createElement(`div`),this.scroller.className=`wui-file-viewer-scroll wui-file-viewer-image-scroll wui-scroll`,this.scroller.tabIndex=0,this.scroller.setAttribute(`role`,`region`),this.scroller.setAttribute(`aria-label`,fs().imageLabel),this.stage=document.createElement(`div`),this.stage.className=`wui-file-viewer-image-stage`,this.stage.append(e),this.scroller.append(this.stage),r.replaceChildren(this.scroller),this.scroller.addEventListener(`pointerdown`,e=>this._panStart(e)),this.scroller.addEventListener(`pointermove`,e=>this._panMove(e));for(let e of[`pointerup`,`pointercancel`,`lostpointercapture`])this.scroller.addEventListener(e,()=>this._panEnd());this.scroller.addEventListener(`wheel`,e=>{if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault();let t=performance.now();t-(this._lastWheelZoom??0)<120||(this._lastWheelZoom=t,this._stepZoom(e.deltaY<0?1:-1))},{passive:!1}),this._onKeyDown=e=>this._keyDown(e),i.addEventListener(`keydown`,this._onKeyDown),this._resizeObserver=new ResizeObserver(()=>{let e=this.scroller.clientWidth,t=this.scroller.clientHeight;(e!==this.area.width||t!==this.area.height)&&(this.area={width:e,height:t},this._layout())}),this._resizeObserver.observe(this.scroller),this.area={width:this.scroller.clientWidth,height:this.scroller.clientHeight},this._layout()}_turned(){let{width:e,height:t}=this.natural;return this.rotation%180==0?{width:e,height:t}:{width:t,height:e}}scale(){if(typeof this.zoom==`number`)return this.zoom;let{width:e,height:t}=this._turned(),n=Math.min((this.area.width-32)/e,(this.area.height-32)/t);return Math.max(n,.01)}_layout(){if(!this.stage)return;let e=this.scale(),t=this._turned();this.stage.style.width=`${Math.round(t.width*e)}px`,this.stage.style.height=`${Math.round(t.height*e)}px`,this.img.style.width=`${Math.round(this.natural.width*e)}px`,this.img.style.height=`${Math.round(this.natural.height*e)}px`,this.img.style.transform=`translate(-50%, -50%) rotate(${this.rotation}deg)`;let n=Math.round(e*100);this.zoomButton.replaceChildren(`${n}%`,D(`chevron-down`,{size:12})??``),this.zoomButton.setAttribute(`aria-label`,Ke(fs().zoomText,{percent:n})),this.zoomOutButton.disabled=this._zoomStep(-1)==null,this.zoomInButton.disabled=this._zoomStep(1)==null}_zoomStep(e){let t=Math.round(this.scale()*100);return e>0?ps.find(e=>Math.round(e*100)>t)??null:[...ps].reverse().find(e=>Math.round(e*100)<t)??null}_stepZoom(e){let t=this._zoomStep(e);t!=null&&this._setZoom(t)}_setZoom(e){let t=this.scroller,n=(t.scrollLeft+t.clientWidth/2)/Math.max(t.scrollWidth,1),r=(t.scrollTop+t.clientHeight/2)/Math.max(t.scrollHeight,1);this.zoom=e,this._layout(),t.scrollLeft=n*t.scrollWidth-t.clientWidth/2,t.scrollTop=r*t.scrollHeight-t.clientHeight/2}_rotate(e){this.rotation=(this.rotation+e+360)%360,this._setZoom(this.zoom)}_keyDown(e){if(!(e.defaultPrevented||e.altKey||!(e.ctrlKey||e.metaKey))){if(e.key===`+`||e.key===`=`)this._stepZoom(1);else if(e.key===`-`||e.key===`_`)this._stepZoom(-1);else if(e.key===`0`)this._setZoom(`fit`);else return;e.preventDefault()}}_panStart(e){let t=this.scroller;e.button!==0||t.scrollWidth<=t.clientWidth&&t.scrollHeight<=t.clientHeight||(this._pan={id:e.pointerId,x:e.clientX,y:e.clientY,left:t.scrollLeft,top:t.scrollTop,active:!1})}_panMove(e){let t=this._pan;if(!t)return;let n=e.clientX-t.x,r=e.clientY-t.y;if(!t.active){if(Math.abs(n)<hs&&Math.abs(r)<hs)return;t.active=!0,this.scroller.setPointerCapture(t.id),this.scroller.classList.add(`wui-file-viewer-panning`)}this.scroller.scrollLeft=t.left-n,this.scroller.scrollTop=t.top-r}_panEnd(){let e=this._pan;e?.active&&(this.scroller.hasPointerCapture(e.id)&&this.scroller.releasePointerCapture(e.id),this.scroller.classList.remove(`wui-file-viewer-panning`)),this._pan=null}print(){this._printFrame?.remove();let e=document.createElement(`iframe`);e.className=`wui-file-viewer-print-frame`,e.title=fs().imagePrintingTitle,e.tabIndex=-1,e.setAttribute(`aria-hidden`,`true`);let t=this.rotation%180!=0,n=new URL(this.source.src,document.baseURI).href;e.srcdoc=`<!doctype html><html><head><title>${vs(this.shell.name())}</title></head><body></body></html>`,e.addEventListener(`load`,async()=>{try{let r=e.contentWindow,i=e.contentDocument;if(!r||!i)throw TypeError(`The print frame has no document.`);let a=`CSSStyleSheet`in r?r.CSSStyleSheet:void 0;if(!_s(a))throw TypeError(`The print frame has no CSSStyleSheet.`);let o=new a;o.replaceSync(`@page { margin: 10mm; }
18
18
  html, body { margin: 0; height: 100%; }
19
- body { display: flex; align-items: center; justify-content: center; }`),i.adoptedStyleSheets=[o];let s=i.createElement(`img`);s.src=n,s.alt=``,s.style.setProperty(`max-width`,t?`100vh`:`100vw`),s.style.setProperty(`max-height`,t?`100vw`:`100vh`),s.style.setProperty(`transform`,`rotate(${this.rotation}deg)`),i.body.append(s),s.complete||await new Promise(e=>{s.addEventListener(`load`,e,{once:!0}),s.addEventListener(`error`,e,{once:!0})}),r.focus(),r.print()}catch(e){f(`[wui-file-viewer] print failed:`,e instanceof Error?e.message:void 0),window.open(this.source.src,`_blank`,`noopener`)}},{once:!0}),this._printFrame=e,document.body.append(e)}},_s=e=>typeof e==`function`,vs=e=>String(e??``).replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`)})),bs=r({MediaView:()=>Ds,formatTime:()=>xs});function xs(e){if(!Number.isFinite(e)||e<0)return`0:00`;let t=Math.floor(e),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=String(t%60).padStart(2,`0`);return n?`${n}:${String(r).padStart(2,`0`)}:${i}`:`${r}:${i}`}var $,Ss,Cs,ws,Ts,Es,Ds,Os=n((()=>{m(),We(),O(),tt(),rt(),$=()=>Ge(`fileViewer`,nt),Ss=[.5,.75,1,1.25,1.5,2],Cs=5,ws=.1,Ts=e=>typeof e==`number`&&Ss.includes(e),Es=e=>e instanceof Element&&e.closest(`input, textarea, select, button, a, .dropdown-menu`),Ds=class{constructor(e,t){this.shell=e,this.source=t,this.destroyed=!1}load(){let{kind:e,src:t,captions:n}=this.source,r=e===`video`?document.createElement(`video`):document.createElement(`audio`);if(r.className=`wui-file-viewer-${e}`,r.preload=`metadata`,Object.assign(r,{playsInline:!0}),e===`video`&&n){let e=document.createElement(`track`);e.kind=`captions`,e.label=$().captionsLabel,e.srclang=`en`,e.src=n,r.append(e)}let i=this.shell.prefs;typeof i.volume==`number`&&(r.volume=Math.min(Math.max(i.volume,0),1)),r.muted=i.muted===!0,r.addEventListener(`loadedmetadata`,()=>{this.destroyed||(r.playbackRate=Ts(i.speed)?i.speed:1,this._build(),this.shell.loaded({kind:e,pages:1}))},{once:!0}),r.addEventListener(`error`,()=>{this.destroyed||this.shell.fail(Error(`The file could not be played.`))}),r.src=t,this.media=r}destroy(){this.destroyed=!0,this.speedMenu?.close(),this._onKeyDown&&this.shell.host.removeEventListener(`keydown`,this._onKeyDown),this.media&&(this.media.pause(),this.media.removeAttribute(`src`),this.media.load())}_build(){let{body:e,host:t}=this.shell,n=this.media,r=this.source.kind,i=document.createElement(`div`);i.className=`wui-file-viewer-player wui-file-viewer-player-${r}`;let a=document.createElement(`div`);if(a.className=`wui-file-viewer-stage`,a.tabIndex=0,a.setAttribute(`role`,`group`),a.setAttribute(`aria-label`,r===`video`?$().videoLabel:$().audioLabel),r===`audio`){let e=document.createElement(`div`);e.className=`wui-file-viewer-audio-art`,e.replaceChildren(...[D(`music`,{size:40})].filter(e=>e!==null)),a.append(e,n)}else a.append(n),n.addEventListener(`click`,()=>this.togglePlay());let o=document.createElement(`div`);o.className=`wui-file-viewer-controls`,this.playButton=A(`play`,$().playLabel,{size:18}),this.playButton.addEventListener(`click`,()=>this.togglePlay()),this.timeNow=document.createElement(`span`),this.timeNow.className=`wui-file-viewer-time`,this.seek=document.createElement(`input`),this.seek.type=`range`,this.seek.className=`form-range wui-file-viewer-seek`,this.seek.min=`0`,this.seek.step=`any`,this.seek.setAttribute(`aria-label`,$().seekLabel),this.seek.addEventListener(`input`,()=>{n.currentTime=Number(this.seek.value)}),this.timeTotal=document.createElement(`span`),this.timeTotal.className=`wui-file-viewer-time`,this.muteButton=A(`volume-high`,$().muteLabel,{size:18}),this.muteButton.addEventListener(`click`,()=>this._setMuted(!n.muted)),this.volume=document.createElement(`input`),this.volume.type=`range`,this.volume.className=`form-range wui-file-viewer-volume`,this.volume.min=`0`,this.volume.max=`1`,this.volume.step=`0.05`,this.volume.setAttribute(`aria-label`,$().volumeLabel),this.volume.addEventListener(`input`,()=>this._setVolume(Number(this.volume.value))),this.speedButton=document.createElement(`button`),this.speedButton.type=`button`,this.speedButton.className=`wui-file-viewer-zoom wui-file-viewer-speed`,this.speedMenu=Ue(this.speedButton,{label:$().playbackSpeedLabel,items:()=>Ss.map(e=>({key:String(e),label:`${e}x`,checked:n.playbackRate===e})),onPick:e=>this._setSpeed(Number(e))}),o.append(this.playButton,this.timeNow,this.seek,this.timeTotal,this.muteButton,this.volume,this.speedButton),r===`video`&&this.source.captions&&(this.captionsButton=A(`subtitle`,$().showCaptionsLabel,{size:18}),this.captionsButton.addEventListener(`click`,()=>this._setCaptions(!this._captionsOn())),o.append(this.captionsButton)),i.append(a,o),e.replaceChildren(i);for(let e of[`play`,`pause`,`ended`])n.addEventListener(e,()=>this._syncPlay());n.addEventListener(`timeupdate`,()=>this._syncTime()),n.addEventListener(`durationchange`,()=>this._syncTime()),n.addEventListener(`volumechange`,()=>this._syncVolume()),n.addEventListener(`ratechange`,()=>this._syncSpeed()),this._onKeyDown=e=>this._keyDown(e),t.addEventListener(`keydown`,this._onKeyDown),this._syncPlay(),this._syncTime(),this._syncVolume(),this._syncSpeed(),this._syncCaptions()}seekTo(e){let t=this.media.duration;this.media.currentTime=Math.min(Math.max(e,0),Number.isFinite(t)?t:1/0)}togglePlay(){this.media.paused||this.media.ended?this.media.play().catch(e=>{f(`[wui-file-viewer] play refused:`,e instanceof Error?e.message:void 0)}):this.media.pause()}_setMuted(e){this.media.muted=e,!e&&this.media.volume===0&&(this.media.volume=.5),this.shell.savePrefs({muted:this.media.muted,volume:this.media.volume})}_setVolume(e){this.media.volume=Math.min(Math.max(e,0),1),this.media.muted=this.media.volume===0,this.shell.savePrefs({muted:this.media.muted,volume:this.media.volume})}_setSpeed(e){this.media.playbackRate=e,this.shell.savePrefs({speed:e})}_captionsOn(){return this.media.textTracks?.[0]?.mode===`showing`}_setCaptions(e){let t=this.media.textTracks?.[0];t&&(t.mode=e?`showing`:`hidden`),this._syncCaptions()}_syncPlay(){let e=!this.media.paused&&!this.media.ended;Ve(this.playButton,e?`pause`:`play`,18),He(this.playButton,e?$().pauseLabel:$().playLabel),this.shell.host.classList.toggle(`wui-file-viewer-playing`,e)}_syncTime(){let e=this.media.currentTime,t=this.media.duration;this.timeNow.textContent=xs(e),this.timeTotal.textContent=xs(t),this.seek.max=String(Number.isFinite(t)?t:0),this.seek.value=String(e),this.seek.setAttribute(`aria-valuetext`,Ke($().seekValueText,{now:xs(e),total:xs(t)}))}_syncVolume(){let e=this.media.muted||this.media.volume===0;Ve(this.muteButton,e?`volume-mute`:`volume-high`,18),He(this.muteButton,e?$().unmuteLabel:$().muteLabel),this.volume.value=String(this.media.muted?0:this.media.volume)}_syncSpeed(){let e=`${this.media.playbackRate}x`;this.speedButton.textContent=e,this.speedButton.setAttribute(`aria-label`,Ke($().playbackSpeedText,{label:e}))}_syncCaptions(){if(!this.captionsButton)return;let e=this._captionsOn();this.captionsButton.setAttribute(`aria-pressed`,String(e)),He(this.captionsButton,e?$().hideCaptionsLabel:$().showCaptionsLabel)}_keyDown(e){if(e.defaultPrevented||e.altKey||e.ctrlKey||e.metaKey||Es(e.target))return;let t=this.media,n=e.key.toLowerCase();if(n===` `||n===`k`)this.togglePlay();else if(n===`arrowleft`)t.currentTime=Math.max(0,t.currentTime-Cs);else if(n===`arrowright`)t.currentTime=Math.min(t.duration||0,t.currentTime+Cs);else if(n===`arrowup`)this._setVolume(t.volume+ws);else if(n===`arrowdown`)this._setVolume(t.volume-ws);else if(n===`m`)this._setMuted(!t.muted);else if(n===`c`&&this.captionsButton)this._setCaptions(!this._captionsOn());else return;e.preventDefault()}}}));m(),_(),We(),o(),tt(),rt();var ks=()=>Ge(`fileViewer`,nt),As={pdf:`pdf`,jpg:`image`,jpeg:`image`,png:`image`,webp:`image`,gif:`image`,avif:`image`,bmp:`image`,svg:`image`,mp4:`video`,m4v:`video`,webm:`video`,ogv:`video`,mp3:`audio`,m4a:`audio`,aac:`audio`,wav:`audio`,ogg:`audio`,oga:`audio`,opus:`audio`,flac:`audio`},js={"application/pdf":`pdf`,"image/jpeg":`image`,"image/png":`image`,"image/webp":`image`,"image/gif":`image`,"image/avif":`image`,"image/bmp":`image`,"image/svg+xml":`image`,"video/mp4":`video`,"video/webm":`video`,"video/ogg":`video`,"audio/mpeg":`audio`,"audio/mp4":`audio`,"audio/aac":`audio`,"audio/wav":`audio`,"audio/x-wav":`audio`,"audio/ogg":`audio`,"audio/opus":`audio`,"audio/webm":`audio`,"audio/flac":`audio`},Ms=`wui-file-viewer:load`,Ns=`wui-file-viewer:error`,Ps=`wui-file-viewer:prefs-change`;function Fs(e,t){let n=(String(e??``).split(`;`)[0]??``).trim().toLowerCase();if(n)return js[n]??null;let r=String(t??``).split(/[?#]/)[0]??``;return As[r.includes(`.`)?(r.split(`.`).pop()??``).toLowerCase():``]??null}function Is(e){let t=(String(e??``).split(/[?#]/)[0]??``).split(`/`).filter(Boolean).pop()??``;try{return decodeURIComponent(t)}catch{return t}}var Ls={pdf:()=>Promise.resolve().then(()=>(us(),jo)).then(e=>e.PdfView),image:()=>Promise.resolve().then(()=>(ys(),ds)).then(e=>e.ImageView),video:()=>Promise.resolve().then(()=>(Os(),bs)).then(e=>e.MediaView),audio:()=>Promise.resolve().then(()=>(Os(),bs)).then(e=>e.MediaView)},Rs=0,zs=class e extends y{static defaultAssetBase=``;static get observedAttributes(){return[`src`,`name`,`type`,`download`,`print`,`worker-src`,`asset-base`,`captions`]}uid;_prefs;_hostPrefs;_onFullscreen;_view;_loadId;_actionsBox;constructor(){super(),Rs+=1,this.uid=`wui-file-viewer-${Rs}`,this._prefs={},this._onFullscreen=()=>this._syncFullscreen()}get src(){return this.getAttribute(`src`)??``}set src(e){this.setAttribute(`src`,String(e??``))}get name(){return this.getAttribute(`name`)??``}set name(e){this.setAttribute(`name`,String(e??``))}get type(){return this.getAttribute(`type`)??``}set type(e){this.setAttribute(`type`,String(e??``))}get viewKey(){return this.getAttribute(`view-key`)??``}set viewKey(e){this.setAttribute(`view-key`,String(e??``))}get download(){return this.hasAttribute(`download`)}set download(e){this.toggleAttribute(`download`,e===!0||e===``||e===`true`)}get print(){return this.getAttribute(`print`)!==`false`}set print(e){this.setAttribute(`print`,e===!1||e===`false`?`false`:`true`)}get workerSrc(){return this.getAttribute(`worker-src`)??``}set workerSrc(e){this.setAttribute(`worker-src`,String(e??``))}get captions(){return this.getAttribute(`captions`)??``}set captions(e){this.setAttribute(`captions`,String(e??``))}get assetBase(){return this.getAttribute(`asset-base`)??``}set assetBase(e){this.setAttribute(`asset-base`,String(e??``))}get prefs(){return{...this._prefs}}set prefs(e){this._hostPrefs=!0,this._prefs=e&&typeof e==`object`?{...e}:{}}get actionsContainer(){return this._actionsBox??null}seekTo(e){if(typeof e!=`number`||!Number.isFinite(e))throw TypeError(`[wui-file-viewer] seekTo takes a number of seconds; got ${String(e)}.`);return this._view?.seekTo?(this._view.seekTo(e),!0):!1}displayName(){return this.name||Is(this.src)||ks().documentLabel}connectedCallback(){if(a(this,`prefs`)){let e=this.prefs;Reflect.deleteProperty(this,`prefs`),this.prefs=e}document.addEventListener(`fullscreenchange`,this._onFullscreen),this._open()}disconnectedCallback(){document.removeEventListener(`fullscreenchange`,this._onFullscreen),this._close()}attributeChangedCallback(e,t,n){this.isConnected&&this._parts&&t!==n&&(e===`name`?this._parts.name.textContent=this.displayName():e===`download`?this._syncDownload():e===`print`?this._syncPrint():this._open())}_close(){this._view?.destroy(),this._view=null,this._loadId=(this._loadId??0)+1}async _open(){this._close();let t=this._loadId;this._render(),this._prefs=this._readPrefs();let n=Fs(this.type,this.name||this.src);if(!this.src){this._settle(ks().noFileText);return}if(!n){this._settle(ks().unsupportedFileText,{offerDownload:!0});return}this._status(ks().loadingText);let r;try{r=await Ls[n]()}catch(e){t===this._loadId&&this._fail(e);return}t===this._loadId&&(this._view=new r(this._shell(t),{src:this.src,kind:n,captions:this.captions,workerSrc:this.workerSrc,assetBase:Vs(this.assetBase||e.defaultAssetBase)}),this._view.load())}_shell(e){let t=()=>e===this._loadId,n=this._parts;return{host:this,start:n.start,center:n.center,end:n.viewEnd,search:n.search,body:n.body,prefs:{...this._prefs},name:()=>this.displayName(),print:()=>this.print,savePrefs:e=>{t()&&this._savePrefs(e)},loaded:e=>{t()&&(n.body.removeAttribute(`aria-busy`),this.dispatchEvent(new CustomEvent(Ms,{bubbles:!0,detail:e})))},fail:e=>{t()&&this._fail(e)}}}_render(){let e=g(`div`,{class:`wui-file-viewer-toolbar`}),t=g(`div`,{class:`wui-file-viewer-group wui-file-viewer-start`}),n=g(`span`,{class:`wui-file-viewer-name`});n.textContent=this.displayName(),n.title=this.displayName(),t.append(n);let r=g(`div`,{class:`wui-file-viewer-group wui-file-viewer-center`}),i=g(`div`,{class:`wui-file-viewer-group wui-file-viewer-end`}),a=g(`div`,{class:`wui-file-viewer-group wui-file-viewer-view-end`}),o=document.createElement(`a`);o.className=`u-action wui-file-viewer-download`,o.style.setProperty(`--wui-action-size`,`32px`),Ve(o,`download`),He(o,ks().downloadLabel);let s=A(`maximize-4`,ks().fullScreenLabel,{className:`wui-file-viewer-fullscreen`});s.addEventListener(`click`,()=>this.toggleFullscreen()),s.hidden=!document.fullscreenEnabled,this._actionsBox??=g(`div`,{class:`wui-file-viewer-actions`});let c=this._actionsBox;c.append(...this.querySelectorAll(`:scope > [slot="actions"]`)),i.append(a,o,s,c);let l=g(`search`,{class:`wui-file-viewer-search`});l.hidden=!0,e.append(t,r,i,l);let u=g(`div`,{class:`wui-file-viewer-body`,"aria-busy":`true`});this.replaceChildren(e,u),this._parts={toolbar:e,start:t,name:n,center:r,end:i,viewEnd:a,downloadLink:o,fullscreen:s,actionsBox:c,search:l,body:u},this._syncDownload(),this._syncFullscreen()}_syncDownload(){let e=this._parts.downloadLink;e.hidden=!this.download||!this.src,e.href=this.src,e.setAttribute(`download`,this.displayName())}_syncPrint(){for(let e of this._parts.toolbar.querySelectorAll(`.wui-file-viewer-print`))e instanceof HTMLElement&&(e.hidden=!this.print)}_status(e,{offerDownload:t=!1}={}){let n=document.createElement(`div`);n.className=`wui-file-viewer-status`;let r=document.createElement(`p`);if(r.textContent=e,n.append(r),t&&this.src){let e=document.createElement(`a`);e.className=d(`neutral`,`outline`,`sm`),e.dataset.wui=s,e.href=this.src,e.setAttribute(`download`,this.displayName()),e.textContent=ks().downloadLabel,n.append(e)}this._parts.body.replaceChildren(n)}_settle(e,t){this._parts.body.removeAttribute(`aria-busy`),this._status(e,t)}_fail(e){this._view?.destroy(),this._view=null,this._settle(ks().openFailedText,{offerDownload:!0});let t=typeof e==`object`&&e&&`message`in e?e.message:void 0;this.dispatchEvent(new CustomEvent(Ns,{bubbles:!0,detail:{message:t??String(e)}}))}toggleFullscreen(){document.fullscreenElement?document.exitFullscreen():this.requestFullscreen().catch(e=>{f(`[wui-file-viewer] full screen refused:`,e?.message)})}_syncFullscreen(){if(!this._parts)return;let e=document.fullscreenElement===this,t=this._parts.fullscreen;Ve(t,e?`x`:`maximize-4`),He(t,e?ks().exitFullScreenLabel:ks().fullScreenLabel),this._parts.actionsBox.hidden=e}_readPrefs(){if(this._hostPrefs||!this.viewKey)return{...this._prefs};try{let e=JSON.parse(window.localStorage.getItem(`wui-view:${this.viewKey}`)??`{}`);return Bs(e)?e:{}}catch{return{}}}_savePrefs(e){if(this._prefs={...this._prefs,...e},this.dispatchEvent(new CustomEvent(Ps,{bubbles:!0,detail:{...this._prefs}})),!this._hostPrefs&&this.viewKey)try{window.localStorage.setItem(`wui-view:${this.viewKey}`,JSON.stringify(this._prefs))}catch(e){if(!(e instanceof DOMException))throw e}}};function Bs(e){return typeof e==`object`&&!!e}function Vs(e){return e&&new URL(e,document.baseURI).href}var Hs=typeof document>`u`?null:document.currentScript;return Hs instanceof HTMLScriptElement&&Hs.src&&(zs.defaultAssetBase=new URL(`pdfjs/`,Hs.src).href),i(`wui-file-viewer`,zs),e.WuiFileViewer=zs,e.fileKind=Fs,e.fileNameFromUrl=Is,e.renderPdfFirstPage=(e,t)=>Promise.resolve().then(()=>(us(),jo)).then(n=>n.renderFirstPage(e,{assetBase:zs.defaultAssetBase||void 0,...t})),e})({});
19
+ body { display: flex; align-items: center; justify-content: center; }`),i.adoptedStyleSheets=[o];let s=i.createElement(`img`);s.src=n,s.alt=``,s.style.setProperty(`max-width`,t?`100vh`:`100vw`),s.style.setProperty(`max-height`,t?`100vw`:`100vh`),s.style.setProperty(`transform`,`rotate(${this.rotation}deg)`),i.body.append(s),s.complete||await new Promise(e=>{s.addEventListener(`load`,e,{once:!0}),s.addEventListener(`error`,e,{once:!0})}),r.focus(),r.print()}catch(e){f(`[wui-file-viewer] print failed:`,e instanceof Error?e.message:void 0),window.open(this.source.src,`_blank`,`noopener`)}},{once:!0}),this._printFrame=e,document.body.append(e)}},_s=e=>typeof e==`function`,vs=e=>String(e??``).replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`)})),bs=r({MediaView:()=>Ds,formatTime:()=>xs});function xs(e){if(!Number.isFinite(e)||e<0)return`0:00`;let t=Math.floor(e),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=String(t%60).padStart(2,`0`);return n?`${n}:${String(r).padStart(2,`0`)}:${i}`:`${r}:${i}`}var $,Ss,Cs,ws,Ts,Es,Ds,Os=n((()=>{m(),We(),O(),tt(),rt(),$=()=>Ge(`fileViewer`,nt),Ss=[.5,.75,1,1.25,1.5,2],Cs=5,ws=.1,Ts=e=>typeof e==`number`&&Ss.includes(e),Es=e=>e instanceof Element&&e.closest(`input, textarea, select, button, a, .dropdown-menu`),Ds=class{constructor(e,t){this.shell=e,this.source=t,this.destroyed=!1}load(){let{kind:e,src:t,captions:n}=this.source,r=e===`video`?document.createElement(`video`):document.createElement(`audio`);if(r.className=`wui-file-viewer-${e}`,r.preload=`metadata`,Object.assign(r,{playsInline:!0}),e===`video`&&n){let e=document.createElement(`track`);e.kind=`captions`,e.label=$().captionsLabel,e.srclang=`en`,e.src=n,r.append(e)}let i=this.shell.prefs;typeof i.volume==`number`&&(r.volume=Math.min(Math.max(i.volume,0),1)),r.muted=i.muted===!0,r.addEventListener(`loadedmetadata`,()=>{this.destroyed||(r.playbackRate=Ts(i.speed)?i.speed:1,this._build(),this.shell.loaded({kind:e,pages:1}))},{once:!0}),r.addEventListener(`error`,()=>{this.destroyed||this.shell.fail(Error(`The file could not be played.`))}),r.src=t,this.media=r}destroy(){this.destroyed=!0,this.speedMenu?.close(),this._onKeyDown&&this.shell.host.removeEventListener(`keydown`,this._onKeyDown),this.media&&(this.media.pause(),this.media.removeAttribute(`src`),this.media.load())}_build(){let{body:e,host:t}=this.shell,n=this.media,r=this.source.kind,i=document.createElement(`div`);i.className=`wui-file-viewer-player wui-file-viewer-player-${r}`;let a=document.createElement(`div`);if(a.className=`wui-file-viewer-stage`,a.tabIndex=0,a.setAttribute(`role`,`group`),a.setAttribute(`aria-label`,r===`video`?$().videoLabel:$().audioLabel),r===`audio`){let e=document.createElement(`div`);e.className=`wui-file-viewer-audio-art`,e.replaceChildren(...[D(`music`,{size:40})].filter(e=>e!==null)),a.append(e,n)}else a.append(n),n.addEventListener(`click`,()=>this.togglePlay());let o=document.createElement(`div`);o.className=`wui-file-viewer-controls`,this.playButton=A(`play`,$().playLabel,{size:18}),this.playButton.addEventListener(`click`,()=>this.togglePlay()),this.timeNow=document.createElement(`span`),this.timeNow.className=`wui-file-viewer-time`,this.seek=document.createElement(`input`),this.seek.type=`range`,this.seek.className=`form-range wui-file-viewer-seek`,this.seek.min=`0`,this.seek.step=`any`,this.seek.setAttribute(`aria-label`,$().seekLabel),this.seek.addEventListener(`input`,()=>{n.currentTime=Number(this.seek.value)}),this.timeTotal=document.createElement(`span`),this.timeTotal.className=`wui-file-viewer-time`,this.muteButton=A(`volume-high`,$().muteLabel,{size:18}),this.muteButton.addEventListener(`click`,()=>this._setMuted(!n.muted)),this.volume=document.createElement(`input`),this.volume.type=`range`,this.volume.className=`form-range wui-file-viewer-volume`,this.volume.min=`0`,this.volume.max=`1`,this.volume.step=`0.05`,this.volume.setAttribute(`aria-label`,$().volumeLabel),this.volume.addEventListener(`input`,()=>this._setVolume(Number(this.volume.value))),this.speedButton=document.createElement(`button`),this.speedButton.type=`button`,this.speedButton.className=`wui-file-viewer-zoom wui-file-viewer-speed`,this.speedMenu=Ue(this.speedButton,{label:$().playbackSpeedLabel,items:()=>Ss.map(e=>({key:String(e),label:`${e}x`,checked:n.playbackRate===e})),onPick:e=>this._setSpeed(Number(e))}),o.append(this.playButton,this.timeNow,this.seek,this.timeTotal,this.muteButton,this.volume,this.speedButton),r===`video`&&this.source.captions&&(this.captionsButton=A(`subtitle`,$().showCaptionsLabel,{size:18}),this.captionsButton.addEventListener(`click`,()=>this._setCaptions(!this._captionsOn())),o.append(this.captionsButton)),i.append(a,o),e.replaceChildren(i);for(let e of[`play`,`pause`,`ended`])n.addEventListener(e,()=>this._syncPlay());n.addEventListener(`timeupdate`,()=>this._syncTime()),n.addEventListener(`durationchange`,()=>this._syncTime()),n.addEventListener(`volumechange`,()=>this._syncVolume()),n.addEventListener(`ratechange`,()=>this._syncSpeed()),this._onKeyDown=e=>this._keyDown(e),t.addEventListener(`keydown`,this._onKeyDown),this._syncPlay(),this._syncTime(),this._syncVolume(),this._syncSpeed(),this._syncCaptions()}seekTo(e){let t=this.media.duration;this.media.currentTime=Math.min(Math.max(e,0),Number.isFinite(t)?t:1/0)}togglePlay(){this.media.paused||this.media.ended?this.media.play().catch(e=>{f(`[wui-file-viewer] play refused:`,e instanceof Error?e.message:void 0)}):this.media.pause()}_setMuted(e){this.media.muted=e,!e&&this.media.volume===0&&(this.media.volume=.5),this.shell.savePrefs({muted:this.media.muted,volume:this.media.volume})}_setVolume(e){this.media.volume=Math.min(Math.max(e,0),1),this.media.muted=this.media.volume===0,this.shell.savePrefs({muted:this.media.muted,volume:this.media.volume})}_setSpeed(e){this.media.playbackRate=e,this.shell.savePrefs({speed:e})}_captionsOn(){return this.media.textTracks?.[0]?.mode===`showing`}_setCaptions(e){let t=this.media.textTracks?.[0];t&&(t.mode=e?`showing`:`hidden`),this._syncCaptions()}_syncPlay(){let e=!this.media.paused&&!this.media.ended;Ve(this.playButton,e?`pause`:`play`,18),He(this.playButton,e?$().pauseLabel:$().playLabel),this.shell.host.classList.toggle(`wui-file-viewer-playing`,e)}_syncTime(){let e=this.media.currentTime,t=this.media.duration;this.timeNow.textContent=xs(e),this.timeTotal.textContent=xs(t),this.seek.max=String(Number.isFinite(t)?t:0),this.seek.value=String(e),this.seek.setAttribute(`aria-valuetext`,Ke($().seekValueText,{now:xs(e),total:xs(t)}))}_syncVolume(){let e=this.media.muted||this.media.volume===0;Ve(this.muteButton,e?`volume-mute`:`volume-high`,18),He(this.muteButton,e?$().unmuteLabel:$().muteLabel),this.volume.value=String(this.media.muted?0:this.media.volume)}_syncSpeed(){let e=`${this.media.playbackRate}x`;this.speedButton.textContent=e,this.speedButton.setAttribute(`aria-label`,Ke($().playbackSpeedText,{label:e}))}_syncCaptions(){if(!this.captionsButton)return;let e=this._captionsOn();this.captionsButton.setAttribute(`aria-pressed`,String(e)),He(this.captionsButton,e?$().hideCaptionsLabel:$().showCaptionsLabel)}_keyDown(e){if(e.defaultPrevented||e.altKey||e.ctrlKey||e.metaKey||Es(e.target))return;let t=this.media,n=e.key.toLowerCase();if(n===` `||n===`k`)this.togglePlay();else if(n===`arrowleft`)t.currentTime=Math.max(0,t.currentTime-Cs);else if(n===`arrowright`)t.currentTime=Math.min(t.duration||0,t.currentTime+Cs);else if(n===`arrowup`)this._setVolume(t.volume+ws);else if(n===`arrowdown`)this._setVolume(t.volume-ws);else if(n===`m`)this._setMuted(!t.muted);else if(n===`c`&&this.captionsButton)this._setCaptions(!this._captionsOn());else return;e.preventDefault()}}}));m(),_(),We(),o(),tt(),rt();var ks=()=>Ge(`fileViewer`,nt),As={pdf:`pdf`,jpg:`image`,jpeg:`image`,png:`image`,webp:`image`,gif:`image`,avif:`image`,bmp:`image`,svg:`image`,mp4:`video`,m4v:`video`,webm:`video`,ogv:`video`,mp3:`audio`,m4a:`audio`,aac:`audio`,wav:`audio`,ogg:`audio`,oga:`audio`,opus:`audio`,flac:`audio`},js={"application/pdf":`pdf`,"image/jpeg":`image`,"image/png":`image`,"image/webp":`image`,"image/gif":`image`,"image/avif":`image`,"image/bmp":`image`,"image/svg+xml":`image`,"video/mp4":`video`,"video/webm":`video`,"video/ogg":`video`,"audio/mpeg":`audio`,"audio/mp4":`audio`,"audio/aac":`audio`,"audio/wav":`audio`,"audio/x-wav":`audio`,"audio/ogg":`audio`,"audio/opus":`audio`,"audio/webm":`audio`,"audio/flac":`audio`},Ms=`wui-file-viewer:load`,Ns=`wui-file-viewer:error`,Ps=`wui-file-viewer:prefs-change`;function Fs(e,t){let n=(String(e??``).split(`;`)[0]??``).trim().toLowerCase();if(n)return js[n]??null;let r=String(t??``).split(/[?#]/)[0]??``;return As[r.includes(`.`)?(r.split(`.`).pop()??``).toLowerCase():``]??null}function Is(e){let t=(String(e??``).split(/[?#]/)[0]??``).split(`/`).filter(Boolean).pop()??``;try{return decodeURIComponent(t)}catch{return t}}var Ls={pdf:()=>Promise.resolve().then(()=>(us(),jo)).then(e=>e.PdfView),image:()=>Promise.resolve().then(()=>(ys(),ds)).then(e=>e.ImageView),video:()=>Promise.resolve().then(()=>(Os(),bs)).then(e=>e.MediaView),audio:()=>Promise.resolve().then(()=>(Os(),bs)).then(e=>e.MediaView)},Rs=`--wui-file-viewer-fill-height`,zs=420,Bs=0,Vs=class e extends y{static defaultAssetBase=``;static get observedAttributes(){return[`src`,`name`,`type`,`download`,`fill`,`print`,`worker-src`,`asset-base`,`captions`]}uid;_prefs;_hostPrefs;_onFullscreen;_onFill;_fillWatch;_view;_loadId;_actionsBox;constructor(){super(),Bs+=1,this.uid=`wui-file-viewer-${Bs}`,this._prefs={},this._onFullscreen=()=>this._syncFullscreen(),this._onFill=()=>{requestAnimationFrame(()=>this._fitFill())}}get src(){return this.getAttribute(`src`)??``}set src(e){this.setAttribute(`src`,String(e??``))}get name(){return this.getAttribute(`name`)??``}set name(e){this.setAttribute(`name`,String(e??``))}get type(){return this.getAttribute(`type`)??``}set type(e){this.setAttribute(`type`,String(e??``))}get viewKey(){return this.getAttribute(`view-key`)??``}set viewKey(e){this.setAttribute(`view-key`,String(e??``))}get download(){return this.hasAttribute(`download`)}set download(e){this.toggleAttribute(`download`,e===!0||e===``||e===`true`)}get fill(){return this.hasAttribute(`fill`)}set fill(e){this.toggleAttribute(`fill`,e===!0||e===``||e===`true`)}get print(){return this.getAttribute(`print`)!==`false`}set print(e){this.setAttribute(`print`,e===!1||e===`false`?`false`:`true`)}get workerSrc(){return this.getAttribute(`worker-src`)??``}set workerSrc(e){this.setAttribute(`worker-src`,String(e??``))}get captions(){return this.getAttribute(`captions`)??``}set captions(e){this.setAttribute(`captions`,String(e??``))}get assetBase(){return this.getAttribute(`asset-base`)??``}set assetBase(e){this.setAttribute(`asset-base`,String(e??``))}get prefs(){return{...this._prefs}}set prefs(e){this._hostPrefs=!0,this._prefs=e&&typeof e==`object`?{...e}:{}}get actionsContainer(){return this._actionsBox??null}seekTo(e){if(typeof e!=`number`||!Number.isFinite(e))throw TypeError(`[wui-file-viewer] seekTo takes a number of seconds; got ${String(e)}.`);return this._view?.seekTo?(this._view.seekTo(e),!0):!1}displayName(){return this.name||Is(this.src)||ks().documentLabel}connectedCallback(){if(a(this,`prefs`)){let e=this.prefs;Reflect.deleteProperty(this,`prefs`),this.prefs=e}document.addEventListener(`fullscreenchange`,this._onFullscreen),this._syncFill(),this._open()}disconnectedCallback(){document.removeEventListener(`fullscreenchange`,this._onFullscreen),this._unwatchFill(),this._close()}attributeChangedCallback(e,t,n){e===`fill`?this._syncFill():this.isConnected&&this._parts&&t!==n&&(e===`name`?this._parts.name.textContent=this.displayName():e===`download`?this._syncDownload():e===`print`?this._syncPrint():this._open())}_syncFill(){!this.fill||!this.isConnected?this._unwatchFill():(window.addEventListener(`resize`,this._onFill),typeof ResizeObserver<`u`&&(this._fillWatch??=new ResizeObserver(this._onFill),this._fillWatch.observe(document.body)),this._fitFill())}_unwatchFill(){window.removeEventListener(`resize`,this._onFill),this._fillWatch?.disconnect(),this._fillWatch=void 0,this.style.removeProperty(Rs)}_fitFill(){if(!this.fill||!this.isConnected)return;let e=this.getBoundingClientRect().top;this.style.setProperty(Rs,`${Math.max(zs,window.innerHeight-e)}px`)}_close(){this._view?.destroy(),this._view=null,this._loadId=(this._loadId??0)+1}async _open(){this._close();let t=this._loadId;this._render(),this._prefs=this._readPrefs();let n=Fs(this.type,this.name||this.src);if(!this.src){this._settle(ks().noFileText);return}if(!n){this._settle(ks().unsupportedFileText,{offerDownload:!0});return}this._status(ks().loadingText);let r;try{r=await Ls[n]()}catch(e){t===this._loadId&&this._fail(e);return}t===this._loadId&&(this._view=new r(this._shell(t),{src:this.src,kind:n,captions:this.captions,workerSrc:this.workerSrc,assetBase:Us(this.assetBase||e.defaultAssetBase)}),this._view.load())}_shell(e){let t=()=>e===this._loadId,n=this._parts;return{host:this,start:n.start,center:n.center,end:n.viewEnd,search:n.search,body:n.body,prefs:{...this._prefs},name:()=>this.displayName(),print:()=>this.print,savePrefs:e=>{t()&&this._savePrefs(e)},loaded:e=>{t()&&(n.body.removeAttribute(`aria-busy`),this.dispatchEvent(new CustomEvent(Ms,{bubbles:!0,detail:e})))},fail:e=>{t()&&this._fail(e)}}}_render(){let e=g(`div`,{class:`wui-file-viewer-toolbar`}),t=g(`div`,{class:`wui-file-viewer-group wui-file-viewer-start`}),n=g(`span`,{class:`wui-file-viewer-name`});n.textContent=this.displayName(),n.title=this.displayName(),t.append(n);let r=g(`div`,{class:`wui-file-viewer-group wui-file-viewer-center`}),i=g(`div`,{class:`wui-file-viewer-group wui-file-viewer-end`}),a=g(`div`,{class:`wui-file-viewer-group wui-file-viewer-view-end`}),o=document.createElement(`a`);o.className=`u-action wui-file-viewer-download`,o.style.setProperty(`--wui-action-size`,`32px`),Ve(o,`download`),He(o,ks().downloadLabel);let s=A(`maximize-4`,ks().fullScreenLabel,{className:`wui-file-viewer-fullscreen`});s.addEventListener(`click`,()=>this.toggleFullscreen()),s.hidden=!document.fullscreenEnabled,this._actionsBox??=g(`div`,{class:`wui-file-viewer-actions`});let c=this._actionsBox;c.append(...this.querySelectorAll(`:scope > [slot="actions"]`)),i.append(a,o,s,c);let l=g(`search`,{class:`wui-file-viewer-search`});l.hidden=!0,e.append(t,r,i,l);let u=g(`div`,{class:`wui-file-viewer-body`,"aria-busy":`true`});this.replaceChildren(e,u),this._parts={toolbar:e,start:t,name:n,center:r,end:i,viewEnd:a,downloadLink:o,fullscreen:s,actionsBox:c,search:l,body:u},this._syncDownload(),this._syncFullscreen()}_syncDownload(){let e=this._parts.downloadLink;e.hidden=!this.download||!this.src,e.href=this.src,e.setAttribute(`download`,this.displayName())}_syncPrint(){for(let e of this._parts.toolbar.querySelectorAll(`.wui-file-viewer-print`))e instanceof HTMLElement&&(e.hidden=!this.print)}_status(e,{offerDownload:t=!1}={}){let n=document.createElement(`div`);n.className=`wui-file-viewer-status`;let r=document.createElement(`p`);if(r.textContent=e,n.append(r),t&&this.src){let e=document.createElement(`a`);e.className=d(`neutral`,`outline`,`sm`),e.dataset.wui=s,e.href=this.src,e.setAttribute(`download`,this.displayName()),e.textContent=ks().downloadLabel,n.append(e)}this._parts.body.replaceChildren(n)}_settle(e,t){this._parts.body.removeAttribute(`aria-busy`),this._status(e,t)}_fail(e){this._view?.destroy(),this._view=null,this._settle(ks().openFailedText,{offerDownload:!0});let t=typeof e==`object`&&e&&`message`in e?e.message:void 0;this.dispatchEvent(new CustomEvent(Ns,{bubbles:!0,detail:{message:t??String(e)}}))}toggleFullscreen(){document.fullscreenElement?document.exitFullscreen():this.requestFullscreen().catch(e=>{f(`[wui-file-viewer] full screen refused:`,e?.message)})}_syncFullscreen(){if(!this._parts)return;let e=document.fullscreenElement===this,t=this._parts.fullscreen;Ve(t,e?`x`:`maximize-4`),He(t,e?ks().exitFullScreenLabel:ks().fullScreenLabel),this._parts.actionsBox.hidden=e}_readPrefs(){if(this._hostPrefs||!this.viewKey)return{...this._prefs};try{let e=JSON.parse(window.localStorage.getItem(`wui-view:${this.viewKey}`)??`{}`);return Hs(e)?e:{}}catch{return{}}}_savePrefs(e){if(this._prefs={...this._prefs,...e},this.dispatchEvent(new CustomEvent(Ps,{bubbles:!0,detail:{...this._prefs}})),!this._hostPrefs&&this.viewKey)try{window.localStorage.setItem(`wui-view:${this.viewKey}`,JSON.stringify(this._prefs))}catch(e){if(!(e instanceof DOMException))throw e}}};function Hs(e){return typeof e==`object`&&!!e}function Us(e){return e&&new URL(e,document.baseURI).href}var Ws=typeof document>`u`?null:document.currentScript;return Ws instanceof HTMLScriptElement&&Ws.src&&(Vs.defaultAssetBase=new URL(`pdfjs/`,Ws.src).href),i(`wui-file-viewer`,Vs),e.WuiFileViewer=Vs,e.fileKind=Fs,e.fileNameFromUrl=Is,e.renderPdfFirstPage=(e,t)=>Promise.resolve().then(()=>(us(),jo)).then(n=>n.renderFirstPage(e,{assetBase:Vs.defaultAssetBase||void 0,...t})),e})({});
@@ -1 +1 @@
1
- import{d as e,f as t,i as n,l as r,o as i,r as a,s as o,t as s}from"./fileViewer.g-D_zLw_p-.js";function c(e,t){if(typeof customElements>`u`||customElements.get(e))return;let n=[];if(typeof document<`u`)for(let r of document.querySelectorAll(e))for(let i of Object.keys(r)){let a=Object.getOwnPropertyDescriptor(t.prototype,i);if(a&&(a.set||a.get)&&(n.push([r,i,Reflect.get(r,i)]),!Reflect.deleteProperty(r,i)))throw Error(`defineElement: could not clear the early "${i}" property on <${e}>.`)}customElements.define(e,t);for(let[t,r,i]of n)if(!Reflect.set(t,r,i))throw Error(`defineElement: could not restore the "${r}" property on <${e}>.`)}var l=`AppButton`,u=/* @__PURE__ */ new Set([`primary`,`success`,`warning`,`danger`,`info`,`neutral`]),d={solid:e=>`btn-${e}`,soft:e=>`btn-soft-${e}`,outline:e=>`btn-outline-${e}`,ghost:e=>`btn-ghost-${e}`,link:e=>`btn-link-${e}`,glass:()=>`btn-glass`};function f(e){return t(d,e)}function p(e=`primary`,t=`solid`,n=`md`){if(!u.has(e))throw RangeError(`buttonClass: unknown tone "${e}"`);if(!f(t))throw RangeError(`buttonClass: unknown variant "${t}"`);let r=d[t](e);return n===`md`?`btn ${r}`:`btn ${r} btn-${n}`}var m=`@webority/ui-elements needs a browser DOM; import its types or helpers entry on the server`;if(typeof HTMLElement>`u`)throw Error(m);var h=HTMLElement,g=()=>a(`fileViewer`,s),_={pdf:`pdf`,jpg:`image`,jpeg:`image`,png:`image`,webp:`image`,gif:`image`,avif:`image`,bmp:`image`,svg:`image`,mp4:`video`,m4v:`video`,webm:`video`,ogv:`video`,mp3:`audio`,m4a:`audio`,aac:`audio`,wav:`audio`,ogg:`audio`,oga:`audio`,opus:`audio`,flac:`audio`},v={"application/pdf":`pdf`,"image/jpeg":`image`,"image/png":`image`,"image/webp":`image`,"image/gif":`image`,"image/avif":`image`,"image/bmp":`image`,"image/svg+xml":`image`,"video/mp4":`video`,"video/webm":`video`,"video/ogg":`video`,"audio/mpeg":`audio`,"audio/mp4":`audio`,"audio/aac":`audio`,"audio/wav":`audio`,"audio/x-wav":`audio`,"audio/ogg":`audio`,"audio/opus":`audio`,"audio/webm":`audio`,"audio/flac":`audio`},y=`wui-file-viewer:load`,b=`wui-file-viewer:error`,x=`wui-file-viewer:prefs-change`;function S(e,t){let n=(String(e??``).split(`;`)[0]??``).trim().toLowerCase();if(n)return v[n]??null;let r=String(t??``).split(/[?#]/)[0]??``;return _[r.includes(`.`)?(r.split(`.`).pop()??``).toLowerCase():``]??null}function C(e){let t=(String(e??``).split(/[?#]/)[0]??``).split(`/`).filter(Boolean).pop()??``;try{return decodeURIComponent(t)}catch{return t}}var w={pdf:()=>import(`./fileViewerPdf-BET_tiP6.js`).then(e=>e.PdfView),image:()=>import(`./fileViewerImage-DnzDd-rQ.js`).then(e=>e.ImageView),video:()=>import(`./fileViewerMedia-Dm99qAjY.js`).then(e=>e.MediaView),audio:()=>import(`./fileViewerMedia-Dm99qAjY.js`).then(e=>e.MediaView)},T=0,E=class a extends h{static defaultAssetBase=``;static get observedAttributes(){return[`src`,`name`,`type`,`download`,`print`,`worker-src`,`asset-base`,`captions`]}uid;_prefs;_hostPrefs;_onFullscreen;_view;_loadId;_actionsBox;constructor(){super(),T+=1,this.uid=`wui-file-viewer-${T}`,this._prefs={},this._onFullscreen=()=>this._syncFullscreen()}get src(){return this.getAttribute(`src`)??``}set src(e){this.setAttribute(`src`,String(e??``))}get name(){return this.getAttribute(`name`)??``}set name(e){this.setAttribute(`name`,String(e??``))}get type(){return this.getAttribute(`type`)??``}set type(e){this.setAttribute(`type`,String(e??``))}get viewKey(){return this.getAttribute(`view-key`)??``}set viewKey(e){this.setAttribute(`view-key`,String(e??``))}get download(){return this.hasAttribute(`download`)}set download(e){this.toggleAttribute(`download`,e===!0||e===``||e===`true`)}get print(){return this.getAttribute(`print`)!==`false`}set print(e){this.setAttribute(`print`,e===!1||e===`false`?`false`:`true`)}get workerSrc(){return this.getAttribute(`worker-src`)??``}set workerSrc(e){this.setAttribute(`worker-src`,String(e??``))}get captions(){return this.getAttribute(`captions`)??``}set captions(e){this.setAttribute(`captions`,String(e??``))}get assetBase(){return this.getAttribute(`asset-base`)??``}set assetBase(e){this.setAttribute(`asset-base`,String(e??``))}get prefs(){return{...this._prefs}}set prefs(e){this._hostPrefs=!0,this._prefs=e&&typeof e==`object`?{...e}:{}}get actionsContainer(){return this._actionsBox??null}seekTo(e){if(typeof e!=`number`||!Number.isFinite(e))throw TypeError(`[wui-file-viewer] seekTo takes a number of seconds; got ${String(e)}.`);return this._view?.seekTo?(this._view.seekTo(e),!0):!1}displayName(){return this.name||C(this.src)||g().documentLabel}connectedCallback(){if(t(this,`prefs`)){let e=this.prefs;Reflect.deleteProperty(this,`prefs`),this.prefs=e}document.addEventListener(`fullscreenchange`,this._onFullscreen),this._open()}disconnectedCallback(){document.removeEventListener(`fullscreenchange`,this._onFullscreen),this._close()}attributeChangedCallback(e,t,n){this.isConnected&&this._parts&&t!==n&&(e===`name`?this._parts.name.textContent=this.displayName():e===`download`?this._syncDownload():e===`print`?this._syncPrint():this._open())}_close(){this._view?.destroy(),this._view=null,this._loadId=(this._loadId??0)+1}async _open(){this._close();let e=this._loadId;this._render(),this._prefs=this._readPrefs();let t=S(this.type,this.name||this.src);if(!this.src){this._settle(g().noFileText);return}if(!t){this._settle(g().unsupportedFileText,{offerDownload:!0});return}this._status(g().loadingText);let n;try{n=await w[t]()}catch(t){e===this._loadId&&this._fail(t);return}e===this._loadId&&(this._view=new n(this._shell(e),{src:this.src,kind:t,captions:this.captions,workerSrc:this.workerSrc,assetBase:O(this.assetBase||a.defaultAssetBase)}),this._view.load())}_shell(e){let t=()=>e===this._loadId,n=this._parts;return{host:this,start:n.start,center:n.center,end:n.viewEnd,search:n.search,body:n.body,prefs:{...this._prefs},name:()=>this.displayName(),print:()=>this.print,savePrefs:e=>{t()&&this._savePrefs(e)},loaded:e=>{t()&&(n.body.removeAttribute(`aria-busy`),this.dispatchEvent(new CustomEvent(y,{bubbles:!0,detail:e})))},fail:e=>{t()&&this._fail(e)}}}_render(){let e=r(`div`,{class:`wui-file-viewer-toolbar`}),t=r(`div`,{class:`wui-file-viewer-group wui-file-viewer-start`}),a=r(`span`,{class:`wui-file-viewer-name`});a.textContent=this.displayName(),a.title=this.displayName(),t.append(a);let s=r(`div`,{class:`wui-file-viewer-group wui-file-viewer-center`}),c=r(`div`,{class:`wui-file-viewer-group wui-file-viewer-end`}),l=r(`div`,{class:`wui-file-viewer-group wui-file-viewer-view-end`}),u=document.createElement(`a`);u.className=`u-action wui-file-viewer-download`,u.style.setProperty(`--wui-action-size`,`32px`),i(u,`download`),o(u,g().downloadLabel);let d=n(`maximize-4`,g().fullScreenLabel,{className:`wui-file-viewer-fullscreen`});d.addEventListener(`click`,()=>this.toggleFullscreen()),d.hidden=!document.fullscreenEnabled,this._actionsBox??=r(`div`,{class:`wui-file-viewer-actions`});let f=this._actionsBox;f.append(...this.querySelectorAll(`:scope > [slot="actions"]`)),c.append(l,u,d,f);let p=r(`search`,{class:`wui-file-viewer-search`});p.hidden=!0,e.append(t,s,c,p);let m=r(`div`,{class:`wui-file-viewer-body`,"aria-busy":`true`});this.replaceChildren(e,m),this._parts={toolbar:e,start:t,name:a,center:s,end:c,viewEnd:l,downloadLink:u,fullscreen:d,actionsBox:f,search:p,body:m},this._syncDownload(),this._syncFullscreen()}_syncDownload(){let e=this._parts.downloadLink;e.hidden=!this.download||!this.src,e.href=this.src,e.setAttribute(`download`,this.displayName())}_syncPrint(){for(let e of this._parts.toolbar.querySelectorAll(`.wui-file-viewer-print`))e instanceof HTMLElement&&(e.hidden=!this.print)}_status(e,{offerDownload:t=!1}={}){let n=document.createElement(`div`);n.className=`wui-file-viewer-status`;let r=document.createElement(`p`);if(r.textContent=e,n.append(r),t&&this.src){let e=document.createElement(`a`);e.className=p(`neutral`,`outline`,`sm`),e.dataset.wui=l,e.href=this.src,e.setAttribute(`download`,this.displayName()),e.textContent=g().downloadLabel,n.append(e)}this._parts.body.replaceChildren(n)}_settle(e,t){this._parts.body.removeAttribute(`aria-busy`),this._status(e,t)}_fail(e){this._view?.destroy(),this._view=null,this._settle(g().openFailedText,{offerDownload:!0});let t=typeof e==`object`&&e&&`message`in e?e.message:void 0;this.dispatchEvent(new CustomEvent(b,{bubbles:!0,detail:{message:t??String(e)}}))}toggleFullscreen(){document.fullscreenElement?document.exitFullscreen():this.requestFullscreen().catch(t=>{e(`[wui-file-viewer] full screen refused:`,t?.message)})}_syncFullscreen(){if(!this._parts)return;let e=document.fullscreenElement===this,t=this._parts.fullscreen;i(t,e?`x`:`maximize-4`),o(t,e?g().exitFullScreenLabel:g().fullScreenLabel),this._parts.actionsBox.hidden=e}_readPrefs(){if(this._hostPrefs||!this.viewKey)return{...this._prefs};try{let e=JSON.parse(window.localStorage.getItem(`wui-view:${this.viewKey}`)??`{}`);return D(e)?e:{}}catch{return{}}}_savePrefs(e){if(this._prefs={...this._prefs,...e},this.dispatchEvent(new CustomEvent(x,{bubbles:!0,detail:{...this._prefs}})),!this._hostPrefs&&this.viewKey)try{window.localStorage.setItem(`wui-view:${this.viewKey}`,JSON.stringify(this._prefs))}catch(e){if(!(e instanceof DOMException))throw e}}};function D(e){return typeof e==`object`&&!!e}function O(e){return e&&new URL(e,document.baseURI).href}var k=typeof document>`u`?null:document.currentScript;k instanceof HTMLScriptElement&&k.src&&(E.defaultAssetBase=new URL(`pdfjs/`,k.src).href),c(`wui-file-viewer`,E);var A=(e,t)=>import(`./fileViewerPdf-BET_tiP6.js`).then(n=>n.renderFirstPage(e,{assetBase:E.defaultAssetBase||void 0,...t}));export{E as WuiFileViewer,S as fileKind,C as fileNameFromUrl,A as renderPdfFirstPage};
1
+ import{d as e,f as t,i as n,l as r,o as i,r as a,s as o,t as s}from"./fileViewer.g-D_zLw_p-.js";function c(e,t){if(typeof customElements>`u`||customElements.get(e))return;let n=[];if(typeof document<`u`)for(let r of document.querySelectorAll(e))for(let i of Object.keys(r)){let a=Object.getOwnPropertyDescriptor(t.prototype,i);if(a&&(a.set||a.get)&&(n.push([r,i,Reflect.get(r,i)]),!Reflect.deleteProperty(r,i)))throw Error(`defineElement: could not clear the early "${i}" property on <${e}>.`)}customElements.define(e,t);for(let[t,r,i]of n)if(!Reflect.set(t,r,i))throw Error(`defineElement: could not restore the "${r}" property on <${e}>.`)}var l=`AppButton`,u=/* @__PURE__ */ new Set([`primary`,`success`,`warning`,`danger`,`info`,`neutral`]),d={solid:e=>`btn-${e}`,soft:e=>`btn-soft-${e}`,outline:e=>`btn-outline-${e}`,ghost:e=>`btn-ghost-${e}`,link:e=>`btn-link-${e}`,glass:()=>`btn-glass`};function f(e){return t(d,e)}function p(e=`primary`,t=`solid`,n=`md`){if(!u.has(e))throw RangeError(`buttonClass: unknown tone "${e}"`);if(!f(t))throw RangeError(`buttonClass: unknown variant "${t}"`);let r=d[t](e);return n===`md`?`btn ${r}`:`btn ${r} btn-${n}`}var m=`@webority/ui-elements needs a browser DOM; import its types or helpers entry on the server`;if(typeof HTMLElement>`u`)throw Error(m);var h=HTMLElement,g=()=>a(`fileViewer`,s),_={pdf:`pdf`,jpg:`image`,jpeg:`image`,png:`image`,webp:`image`,gif:`image`,avif:`image`,bmp:`image`,svg:`image`,mp4:`video`,m4v:`video`,webm:`video`,ogv:`video`,mp3:`audio`,m4a:`audio`,aac:`audio`,wav:`audio`,ogg:`audio`,oga:`audio`,opus:`audio`,flac:`audio`},v={"application/pdf":`pdf`,"image/jpeg":`image`,"image/png":`image`,"image/webp":`image`,"image/gif":`image`,"image/avif":`image`,"image/bmp":`image`,"image/svg+xml":`image`,"video/mp4":`video`,"video/webm":`video`,"video/ogg":`video`,"audio/mpeg":`audio`,"audio/mp4":`audio`,"audio/aac":`audio`,"audio/wav":`audio`,"audio/x-wav":`audio`,"audio/ogg":`audio`,"audio/opus":`audio`,"audio/webm":`audio`,"audio/flac":`audio`},y=`wui-file-viewer:load`,b=`wui-file-viewer:error`,x=`wui-file-viewer:prefs-change`;function S(e,t){let n=(String(e??``).split(`;`)[0]??``).trim().toLowerCase();if(n)return v[n]??null;let r=String(t??``).split(/[?#]/)[0]??``;return _[r.includes(`.`)?(r.split(`.`).pop()??``).toLowerCase():``]??null}function C(e){let t=(String(e??``).split(/[?#]/)[0]??``).split(`/`).filter(Boolean).pop()??``;try{return decodeURIComponent(t)}catch{return t}}var w={pdf:()=>import(`./fileViewerPdf-BET_tiP6.js`).then(e=>e.PdfView),image:()=>import(`./fileViewerImage-DnzDd-rQ.js`).then(e=>e.ImageView),video:()=>import(`./fileViewerMedia-Dm99qAjY.js`).then(e=>e.MediaView),audio:()=>import(`./fileViewerMedia-Dm99qAjY.js`).then(e=>e.MediaView)},T=`--wui-file-viewer-fill-height`,E=420,D=0,O=class a extends h{static defaultAssetBase=``;static get observedAttributes(){return[`src`,`name`,`type`,`download`,`fill`,`print`,`worker-src`,`asset-base`,`captions`]}uid;_prefs;_hostPrefs;_onFullscreen;_onFill;_fillWatch;_view;_loadId;_actionsBox;constructor(){super(),D+=1,this.uid=`wui-file-viewer-${D}`,this._prefs={},this._onFullscreen=()=>this._syncFullscreen(),this._onFill=()=>{requestAnimationFrame(()=>this._fitFill())}}get src(){return this.getAttribute(`src`)??``}set src(e){this.setAttribute(`src`,String(e??``))}get name(){return this.getAttribute(`name`)??``}set name(e){this.setAttribute(`name`,String(e??``))}get type(){return this.getAttribute(`type`)??``}set type(e){this.setAttribute(`type`,String(e??``))}get viewKey(){return this.getAttribute(`view-key`)??``}set viewKey(e){this.setAttribute(`view-key`,String(e??``))}get download(){return this.hasAttribute(`download`)}set download(e){this.toggleAttribute(`download`,e===!0||e===``||e===`true`)}get fill(){return this.hasAttribute(`fill`)}set fill(e){this.toggleAttribute(`fill`,e===!0||e===``||e===`true`)}get print(){return this.getAttribute(`print`)!==`false`}set print(e){this.setAttribute(`print`,e===!1||e===`false`?`false`:`true`)}get workerSrc(){return this.getAttribute(`worker-src`)??``}set workerSrc(e){this.setAttribute(`worker-src`,String(e??``))}get captions(){return this.getAttribute(`captions`)??``}set captions(e){this.setAttribute(`captions`,String(e??``))}get assetBase(){return this.getAttribute(`asset-base`)??``}set assetBase(e){this.setAttribute(`asset-base`,String(e??``))}get prefs(){return{...this._prefs}}set prefs(e){this._hostPrefs=!0,this._prefs=e&&typeof e==`object`?{...e}:{}}get actionsContainer(){return this._actionsBox??null}seekTo(e){if(typeof e!=`number`||!Number.isFinite(e))throw TypeError(`[wui-file-viewer] seekTo takes a number of seconds; got ${String(e)}.`);return this._view?.seekTo?(this._view.seekTo(e),!0):!1}displayName(){return this.name||C(this.src)||g().documentLabel}connectedCallback(){if(t(this,`prefs`)){let e=this.prefs;Reflect.deleteProperty(this,`prefs`),this.prefs=e}document.addEventListener(`fullscreenchange`,this._onFullscreen),this._syncFill(),this._open()}disconnectedCallback(){document.removeEventListener(`fullscreenchange`,this._onFullscreen),this._unwatchFill(),this._close()}attributeChangedCallback(e,t,n){e===`fill`?this._syncFill():this.isConnected&&this._parts&&t!==n&&(e===`name`?this._parts.name.textContent=this.displayName():e===`download`?this._syncDownload():e===`print`?this._syncPrint():this._open())}_syncFill(){!this.fill||!this.isConnected?this._unwatchFill():(window.addEventListener(`resize`,this._onFill),typeof ResizeObserver<`u`&&(this._fillWatch??=new ResizeObserver(this._onFill),this._fillWatch.observe(document.body)),this._fitFill())}_unwatchFill(){window.removeEventListener(`resize`,this._onFill),this._fillWatch?.disconnect(),this._fillWatch=void 0,this.style.removeProperty(T)}_fitFill(){if(!this.fill||!this.isConnected)return;let e=this.getBoundingClientRect().top;this.style.setProperty(T,`${Math.max(E,window.innerHeight-e)}px`)}_close(){this._view?.destroy(),this._view=null,this._loadId=(this._loadId??0)+1}async _open(){this._close();let e=this._loadId;this._render(),this._prefs=this._readPrefs();let t=S(this.type,this.name||this.src);if(!this.src){this._settle(g().noFileText);return}if(!t){this._settle(g().unsupportedFileText,{offerDownload:!0});return}this._status(g().loadingText);let n;try{n=await w[t]()}catch(t){e===this._loadId&&this._fail(t);return}e===this._loadId&&(this._view=new n(this._shell(e),{src:this.src,kind:t,captions:this.captions,workerSrc:this.workerSrc,assetBase:A(this.assetBase||a.defaultAssetBase)}),this._view.load())}_shell(e){let t=()=>e===this._loadId,n=this._parts;return{host:this,start:n.start,center:n.center,end:n.viewEnd,search:n.search,body:n.body,prefs:{...this._prefs},name:()=>this.displayName(),print:()=>this.print,savePrefs:e=>{t()&&this._savePrefs(e)},loaded:e=>{t()&&(n.body.removeAttribute(`aria-busy`),this.dispatchEvent(new CustomEvent(y,{bubbles:!0,detail:e})))},fail:e=>{t()&&this._fail(e)}}}_render(){let e=r(`div`,{class:`wui-file-viewer-toolbar`}),t=r(`div`,{class:`wui-file-viewer-group wui-file-viewer-start`}),a=r(`span`,{class:`wui-file-viewer-name`});a.textContent=this.displayName(),a.title=this.displayName(),t.append(a);let s=r(`div`,{class:`wui-file-viewer-group wui-file-viewer-center`}),c=r(`div`,{class:`wui-file-viewer-group wui-file-viewer-end`}),l=r(`div`,{class:`wui-file-viewer-group wui-file-viewer-view-end`}),u=document.createElement(`a`);u.className=`u-action wui-file-viewer-download`,u.style.setProperty(`--wui-action-size`,`32px`),i(u,`download`),o(u,g().downloadLabel);let d=n(`maximize-4`,g().fullScreenLabel,{className:`wui-file-viewer-fullscreen`});d.addEventListener(`click`,()=>this.toggleFullscreen()),d.hidden=!document.fullscreenEnabled,this._actionsBox??=r(`div`,{class:`wui-file-viewer-actions`});let f=this._actionsBox;f.append(...this.querySelectorAll(`:scope > [slot="actions"]`)),c.append(l,u,d,f);let p=r(`search`,{class:`wui-file-viewer-search`});p.hidden=!0,e.append(t,s,c,p);let m=r(`div`,{class:`wui-file-viewer-body`,"aria-busy":`true`});this.replaceChildren(e,m),this._parts={toolbar:e,start:t,name:a,center:s,end:c,viewEnd:l,downloadLink:u,fullscreen:d,actionsBox:f,search:p,body:m},this._syncDownload(),this._syncFullscreen()}_syncDownload(){let e=this._parts.downloadLink;e.hidden=!this.download||!this.src,e.href=this.src,e.setAttribute(`download`,this.displayName())}_syncPrint(){for(let e of this._parts.toolbar.querySelectorAll(`.wui-file-viewer-print`))e instanceof HTMLElement&&(e.hidden=!this.print)}_status(e,{offerDownload:t=!1}={}){let n=document.createElement(`div`);n.className=`wui-file-viewer-status`;let r=document.createElement(`p`);if(r.textContent=e,n.append(r),t&&this.src){let e=document.createElement(`a`);e.className=p(`neutral`,`outline`,`sm`),e.dataset.wui=l,e.href=this.src,e.setAttribute(`download`,this.displayName()),e.textContent=g().downloadLabel,n.append(e)}this._parts.body.replaceChildren(n)}_settle(e,t){this._parts.body.removeAttribute(`aria-busy`),this._status(e,t)}_fail(e){this._view?.destroy(),this._view=null,this._settle(g().openFailedText,{offerDownload:!0});let t=typeof e==`object`&&e&&`message`in e?e.message:void 0;this.dispatchEvent(new CustomEvent(b,{bubbles:!0,detail:{message:t??String(e)}}))}toggleFullscreen(){document.fullscreenElement?document.exitFullscreen():this.requestFullscreen().catch(t=>{e(`[wui-file-viewer] full screen refused:`,t?.message)})}_syncFullscreen(){if(!this._parts)return;let e=document.fullscreenElement===this,t=this._parts.fullscreen;i(t,e?`x`:`maximize-4`),o(t,e?g().exitFullScreenLabel:g().fullScreenLabel),this._parts.actionsBox.hidden=e}_readPrefs(){if(this._hostPrefs||!this.viewKey)return{...this._prefs};try{let e=JSON.parse(window.localStorage.getItem(`wui-view:${this.viewKey}`)??`{}`);return k(e)?e:{}}catch{return{}}}_savePrefs(e){if(this._prefs={...this._prefs,...e},this.dispatchEvent(new CustomEvent(x,{bubbles:!0,detail:{...this._prefs}})),!this._hostPrefs&&this.viewKey)try{window.localStorage.setItem(`wui-view:${this.viewKey}`,JSON.stringify(this._prefs))}catch(e){if(!(e instanceof DOMException))throw e}}};function k(e){return typeof e==`object`&&!!e}function A(e){return e&&new URL(e,document.baseURI).href}var j=typeof document>`u`?null:document.currentScript;j instanceof HTMLScriptElement&&j.src&&(O.defaultAssetBase=new URL(`pdfjs/`,j.src).href),c(`wui-file-viewer`,O);var M=(e,t)=>import(`./fileViewerPdf-BET_tiP6.js`).then(n=>n.renderFirstPage(e,{assetBase:O.defaultAssetBase||void 0,...t}));export{O as WuiFileViewer,S as fileKind,C as fileNameFromUrl,M as renderPdfFirstPage};
@@ -0,0 +1 @@
1
+ var e={activeLabel:`Current`,backLabel:`Back`,closeLabel:`Close`,doneLabel:`Done`,errorCountText:`{count} to fix`,errorLabel:`Error`,finishLabel:`Finish`,label:`Progress`,leaveDiscardLabel:`Discard draft`,leaveKeepLabel:`Keep editing`,leaveMessage:`Your changes have not been saved.`,leaveSaveLabel:`Save draft and leave`,leaveTitle:`Leave this form?`,nextLabel:`Next`,pendingLabel:`To do`,skipLabel:`Skip`,skippedLabel:`Skipped`,stepOfText:`Step {position} of {total}`,stepText:`Step {position}`};export{e as t};
@@ -0,0 +1 @@
1
+ import{n as e}from"./devWarn-DXdRWZs3.js";var t=Object.freeze([`POST`,`PUT`,`PATCH`,`DELETE`]),n=t=>(e(`[@webority/ui-elements] Wui-Toast-Action: ${t}; the toast shows no action.`),null),r=e=>typeof e==`object`&&!!e;function i(e){if(e==null||e===``)return null;let i;try{i=JSON.parse(e)}catch{return n(`the value is not JSON`)}let a=r(i)?i:{},o=a.label,s=a.url,c=String(a.method??`POST`).toUpperCase();return typeof o!=`string`||o===``||typeof s!=`string`||s===``?n(`label and url must be non-empty strings`):t.includes(c)?{label:o,url:s,method:c}:n(`method must be one of ${t.join(`, `)}`)}var a=`wui-csrf`,o=`RequestVerificationToken`,s={metaName:a,header:o};function c({metaName:e=a,header:t=o}={}){s={metaName:e,header:t}}var l=`Wui-Request`,u=Object.freeze({fragment:`Wui-Fragment`,message:`Wui-Message`,redirect:`Wui-Redirect`,result:`Wui-Result`,keepOpen:`Wui-Keep-Open`,toastVariant:`Wui-Toast-Variant`,toastAction:`Wui-Toast-Action`,refresh:`Wui-Refresh`,next:`Wui-Next`}),d=Object.freeze([`ok`,`validation`,`forbidden`,`networkCheck`,`client`,`server`,`network`,`timeout`,`aborted`,`stale`,`session`]),f=/* @__PURE__ */ new Set([`GET`,`HEAD`]);function p(e=document){let t=[...e.querySelectorAll(`meta`)].find(e=>e.getAttribute(`name`)===s.metaName),n=t?.getAttribute(`content`);return!t||!n?null:{header:t.getAttribute(`data-header`)||s.header,token:n}}var m=e=>{try{return new URL(e,window.location.href).origin===window.location.origin}catch{return!1}};function h(e,t=null){return e>=200&&e<300?`ok`:e===401?`session`:e===403?t?.get(`cf-mitigated`)===`challenge`?`networkCheck`:`forbidden`:e===422?`validation`:e>=400&&e<500?`client`:`server`}var g=e=>typeof e==`object`&&!!e&&`name`in e&&e.name===`AbortError`,_=3e4;function v(e){let t=e?.trim()??``;return/^\d+$/.test(t)?Number(t):void 0}var y=`The ${u.refresh} response header must be {tables, regions, reloadPage}.`,b=e=>e===`all`||Array.isArray(e)&&e.every(e=>typeof e==`string`),x=e=>{if(e==null||e===``)return null;let t;try{t=JSON.parse(e)}catch(e){throw TypeError(`The ${u.refresh} response header is not JSON: ${e instanceof Error?e.message:String(e)}`,{cause:e})}if(typeof t!=`object`||!t||!(`tables`in t)||!(`regions`in t)||!(`reloadPage`in t))throw TypeError(y);let{tables:n,regions:r,reloadPage:i}=t;if(!b(n)||!b(r)||typeof i!=`boolean`)throw TypeError(y);return{tables:n,regions:r,reloadPage:i}},S=(e,t)=>{if(!/json/i.test(e?.headers.get(`Content-Type`)??``)||t.trim()===``)return null;try{return JSON.parse(t)}catch(e){throw TypeError(`The JSON answer body is not JSON: ${e instanceof Error?e.message:String(e)}`,{cause:e})}},C=e=>{if(e==null)return null;try{return decodeURIComponent(e)}catch{return e}};function w(e,t=null,n=``){let r=e=>t?.headers.get(e)??null;return{kind:e,ok:e===`ok`,status:t?.status??0,html:n,response:t,message:C(r(u.message)),redirect:r(u.redirect),result:r(u.result),keepOpen:r(u.keepOpen)===`1`,toastVariant:r(u.toastVariant),toastAction:i(r(u.toastAction)),fragment:r(u.fragment)===`1`,data:S(t,n),next:r(u.next),refresh:x(C(r(u.refresh)))}}async function T(e,t={}){let n=(t.method||`GET`).toUpperCase(),r=t.navigate||(e=>window.location.assign(e)),i={Accept:`text/html`,"X-Requested-With":`XMLHttpRequest`,[l]:`1`,...t.headers};if(!f.has(n)&&m(e)){let e=p();e&&(i[e.header]=e.token)}let a=new AbortController,o=()=>a.abort(),s=t.signal;s?.aborted&&a.abort(),s?.addEventListener(`abort`,o,{once:!0});let c=t.timeoutMs??0,d=!1,_=c>0?setTimeout(()=>{d=!0,a.abort()},c):void 0,v=e=>s?.aborted?`aborted`:d?`timeout`:g(e)?`aborted`:`network`;try{let o;try{o=await fetch(e,{method:n,...t.body===void 0?{}:{body:t.body},headers:i,signal:a.signal,credentials:`same-origin`})}catch(e){return w(v(e))}let s=h(o.status,o.headers);if(s===`ok`&&o.redirected&&o.headers.get(u.fragment)!==`1`&&(s=`session`),s===`session`)return r(o.status===401?o.headers.get(`Location`)||window.location.href:o.url),w(s,o);let c=``;if(s===`ok`||s===`validation`)try{c=await o.text()}catch(e){return w(v(e),o)}return w(s,o,c)}finally{clearTimeout(_),s?.removeEventListener(`abort`,o)}}function E(){let e=null,t=0;return{async run(n,r={}){e?.abort();let i=new AbortController;e=i;let a=++t,o=r.signal;o&&(o.aborted?i.abort():o.addEventListener(`abort`,()=>i.abort(),{once:!0}));let s;try{s=await T(n,{...r,signal:i.signal})}finally{e===i&&(e=null)}return a!==t&&s.kind!==`aborted`?{...s,kind:`stale`,ok:!1}:s},abort(){e?.abort(),e=null}}}export{u as a,c,p as d,w as f,i as g,t as h,d as i,E as l,T as m,o as n,l as o,v as p,_ as r,h as s,a as t,m as u};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webority/ui-elements",
3
- "version": "0.179.0",
3
+ "version": "0.180.0",
4
4
  "description": "Webority framework-agnostic UI custom elements (<wui-*>): the single implementation of the interactive components, styled by @webority/theme. Used natively in Razor and wrapped by @webority/ui-react.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",
@@ -27,6 +27,10 @@
27
27
  "types": "./types/helpers.d.ts",
28
28
  "default": "./dist/helpers.js"
29
29
  },
30
+ "./testing": {
31
+ "types": "./types/testing.d.ts",
32
+ "default": "./dist/testing.js"
33
+ },
30
34
  "./text": {
31
35
  "types": "./types/text/index.d.ts",
32
36
  "default": "./dist/text.js"
@@ -228,6 +232,22 @@
228
232
  "types": "./types/elements/truncate.d.ts",
229
233
  "default": "./dist/elements/truncate.js"
230
234
  },
235
+ "./elements/calendar-views": {
236
+ "types": "./types/elements/calendar-views.d.ts",
237
+ "default": "./dist/elements/calendar-views.js"
238
+ },
239
+ "./elements/dashboard-grid": {
240
+ "types": "./types/elements/dashboard-grid.d.ts",
241
+ "default": "./dist/elements/dashboard-grid.js"
242
+ },
243
+ "./elements/mini-calendar": {
244
+ "types": "./types/elements/mini-calendar.d.ts",
245
+ "default": "./dist/elements/mini-calendar.js"
246
+ },
247
+ "./elements/offline-banner": {
248
+ "types": "./types/elements/offline-banner.d.ts",
249
+ "default": "./dist/elements/offline-banner.js"
250
+ },
231
251
  "./elements/whats-new": {
232
252
  "types": "./types/elements/whats-new.d.ts",
233
253
  "default": "./dist/elements/whats-new.js"
@@ -275,10 +295,10 @@
275
295
  "@tiptap/starter-kit": "3.31.4",
276
296
  "@types/node": "25.6.0",
277
297
  "@vitest/coverage-v8": "5.1.0",
278
- "@webority/biome-config": "0.179.0",
279
- "@webority/markdown-core": "0.179.0",
280
- "@webority/theme": "0.179.0",
281
- "@webority/web-core": "0.179.0",
298
+ "@webority/biome-config": "0.180.0",
299
+ "@webority/markdown-core": "0.180.0",
300
+ "@webority/theme": "0.180.0",
301
+ "@webority/web-core": "0.180.0",
282
302
  "echarts": "6.1.0",
283
303
  "jsdom": "30.1.1",
284
304
  "libphonenumber-js": "^1.13.9",
@@ -1,4 +1,4 @@
1
- import type { CalendarEngine, ViewName } from "./calendarAdapter.ts";
1
+ import type { CalendarEngine, CalendarMarker, ViewName } from "./calendarAdapter.ts";
2
2
  import { type CalendarEvent } from "./calendarModel.ts";
3
3
  import { ElementBase } from "./elementBase.ts";
4
4
  import type { RequestQueue } from "./server/wuiHttp.ts";
@@ -37,6 +37,7 @@ export declare class WuiCalendar extends ElementBase {
37
37
  _parts: CalendarParts | null;
38
38
  _width: number | undefined;
39
39
  _resizeObserver: ResizeObserver | null;
40
+ _markers: CalendarMarker[] | null;
40
41
  static get observedAttributes(): string[];
41
42
  constructor();
42
43
  get events(): object[] | null;
@@ -45,16 +46,23 @@ export declare class WuiCalendar extends ElementBase {
45
46
  set view(v: unknown);
46
47
  get date(): string;
47
48
  set date(v: unknown);
49
+ /** Days with a marker: `{ date, tone, label }`, tone neutral or warning. */
50
+ get markers(): CalendarMarker[];
51
+ set markers(v: unknown);
48
52
  /** Ask `events-url` again. */
49
53
  refetch(): void;
50
54
  connectedCallback(): void;
51
55
  disconnectedCallback(): void;
52
56
  attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
57
+ _selectedDate(): string | undefined;
58
+ _markersFromAttribute(): CalendarMarker[];
53
59
  _zone(): string;
54
60
  _readScript(): object[] | null;
55
61
  _requestedView(): ViewName | null;
56
62
  _initialView(): ViewName;
63
+ _monthParam(): string | null;
57
64
  _initialDate(): string;
65
+ _writeMonth(day: string): void;
58
66
  _build(): void;
59
67
  _load(range: CalendarRange): Promise<CalendarEvent[]>;
60
68
  _setError(on: boolean): void;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * <wui-calendar-views>: the calendar header (period navigation, the Agenda, Timeline and Month
3
+ * switcher) and one body per view. React AppCalendarViews and Razor <app-calendar-views> author
4
+ * the same markup and this element wires it:
5
+ *
6
+ * <wui-calendar-views class="wui-cal-views" view="agenda" [data-controlled]>
7
+ * <div class="wui-cal-views-header">
8
+ * <div class="wui-cal-views-nav"> Previous / period / Next / Today buttons with data-step
9
+ * <div class="wui-cal-views-switch" role="radiogroup"> radio inputs with a label each
10
+ * </div>
11
+ * <div class="wui-cal-views-body" data-view="agenda"> one body per view, a direct child
12
+ * </wui-calendar-views>
13
+ *
14
+ * The switcher is radio buttons, so the arrow keys and the single tab stop come from the browser.
15
+ * A choice writes the address as #view=<name> (replaceState, so no history entry) and fires
16
+ * wui-calendar-views:view-change { view }. The address is read once on mount, unless the element
17
+ * is data-controlled: then the page decides the view, and a choice only fires the event and the
18
+ * switch goes back to the view the page holds. Previous, Next and Today fire
19
+ * wui-calendar-views:period-change { step }. Bodies that are not the current view are hidden.
20
+ */
21
+ import { ElementBase } from "./elementBase.ts";
22
+ export declare class WuiCalendarViews extends ElementBase {
23
+ _onChange: (event: Event) => void;
24
+ _onClick: (event: Event) => void;
25
+ constructor();
26
+ static get observedAttributes(): string[];
27
+ connectedCallback(): void;
28
+ disconnectedCallback(): void;
29
+ attributeChangedCallback(): void;
30
+ _views(): string[];
31
+ _sync(): void;
32
+ _choose(event: Event): void;
33
+ _step(event: Event): void;
34
+ }
@@ -0,0 +1,35 @@
1
+ import { ElementBase } from "./elementBase.ts";
2
+ export interface DashboardLayoutItem {
3
+ id: string;
4
+ span: number;
5
+ hidden: boolean;
6
+ }
7
+ export declare const LAYOUT_CHANGE_EVENT = "wui:layoutchange";
8
+ export declare const LAYOUT_RESET_EVENT = "wui:reset";
9
+ export declare class WuiDashboardGrid extends ElementBase {
10
+ private tools;
11
+ private live;
12
+ private menu;
13
+ private add;
14
+ private observer;
15
+ private menuKey;
16
+ private focusId;
17
+ connectedCallback(): void;
18
+ disconnectedCallback(): void;
19
+ private cells;
20
+ private checkCells;
21
+ private cellById;
22
+ private titleFor;
23
+ private titleOf;
24
+ private build;
25
+ private cellButton;
26
+ private layout;
27
+ private sync;
28
+ private commit;
29
+ private apply;
30
+ private moveBy;
31
+ private setHidden;
32
+ private reset;
33
+ private readonly onClick;
34
+ private readonly onKeydown;
35
+ }
@@ -52,6 +52,7 @@ export declare class WuiDataTable extends ElementBase {
52
52
  _rowHeight: number;
53
53
  constructor();
54
54
  connectedCallback(): void;
55
+ _paintSaves(): void;
55
56
  disconnectedCallback(): void;
56
57
  /** Re-reads the table now: after a page script changed its header or rows outside a mutation. */
57
58
  refresh(): void;
@@ -12,6 +12,8 @@ export declare class WuiEntryGrid extends ElementBase {
12
12
  private _onClick;
13
13
  private _pendingCell;
14
14
  private _ready;
15
+ private _rowActionsObserver;
16
+ private _onMouseDown;
15
17
  private _onPointerDown;
16
18
  private _onPaste;
17
19
  constructor();
@@ -24,6 +26,8 @@ export declare class WuiEntryGrid extends ElementBase {
24
26
  _ownRow(target: EventTarget | null): HTMLElement | null;
25
27
  _emit(name: string, detail: object): void;
26
28
  _focusActiveRow(): void;
29
+ _rowAction(button: Element, target: EventTarget | null): void;
30
+ _syncRowActions(): void;
27
31
  _keyDown(e: KeyboardEvent): void;
28
32
  _focusIn(e: FocusEvent): void;
29
33
  }
@@ -49,6 +49,8 @@ export declare class WuiFileViewer extends ElementBase {
49
49
  _prefs: FileViewerPrefs;
50
50
  _hostPrefs: boolean | undefined;
51
51
  _onFullscreen: () => void;
52
+ _onFill: () => void;
53
+ _fillWatch: ResizeObserver | undefined;
52
54
  _view: FileView | null | undefined;
53
55
  _loadId: number | undefined;
54
56
  _actionsBox: HTMLElement | undefined;
@@ -64,6 +66,8 @@ export declare class WuiFileViewer extends ElementBase {
64
66
  set viewKey(v: string | null | undefined);
65
67
  get download(): boolean;
66
68
  set download(v: boolean | string);
69
+ get fill(): boolean;
70
+ set fill(v: boolean | string);
67
71
  get print(): boolean;
68
72
  set print(v: boolean | string);
69
73
  get workerSrc(): string;
@@ -90,6 +94,9 @@ export declare class WuiFileViewer extends ElementBase {
90
94
  connectedCallback(): void;
91
95
  disconnectedCallback(): void;
92
96
  attributeChangedCallback(attr: string, oldValue: string | null, newValue: string | null): void;
97
+ _syncFill(): void;
98
+ _unwatchFill(): void;
99
+ _fitFill(): void;
93
100
  _close(): void;
94
101
  _open(): Promise<void>;
95
102
  _shell(loadId: number | undefined): ViewShell;
@@ -1,6 +1,6 @@
1
1
  import { ElementBase } from "./elementBase.ts";
2
2
  import { type Axis, type Layout, type LayoutGeometry, type PlacedRow } from "./ganttLayout.ts";
3
- import type { GanttLayout, GanttRow, GanttSpec, GanttZoom } from "./ganttTypes.ts";
3
+ import type { GanttLayout, GanttRow, GanttSpec, GanttWeeks, GanttZoom } from "./ganttTypes.ts";
4
4
  export declare class WuiGantt extends ElementBase {
5
5
  uid: string;
6
6
  _spec: unknown;
@@ -18,6 +18,7 @@ export declare class WuiGantt extends ElementBase {
18
18
  zoom: GanttZoom;
19
19
  fromMs: number;
20
20
  todayMs: number;
21
+ weeks?: GanttWeeks | undefined;
21
22
  } | null;
22
23
  _specRows: GanttRow[];
23
24
  _card: HTMLElement | null;
@@ -47,6 +48,10 @@ export declare class WuiGantt extends ElementBase {
47
48
  _focusToken(): string | null;
48
49
  _draw(): void;
49
50
  _compose(): HTMLElement[];
51
+ _nameColumn(lay: Layout, spec: GanttSpec): HTMLElement | null;
52
+ _nameCell(top: number, height: number, text: string): HTMLElement;
53
+ _countRow(lay: Layout, spec: GanttSpec): HTMLElement;
54
+ _drawLane(item: HTMLElement, placed: PlacedRow, spec: GanttSpec): void;
50
55
  _toolbar(spec: GanttSpec, counted: boolean): HTMLElement;
51
56
  _countText(rows: GanttRow[]): string;
52
57
  _scale(): HTMLElement;
@@ -1,7 +1,7 @@
1
1
  import { type DigitGrouping } from "./digitGrouping.ts";
2
2
  import { ElementBase } from "./elementBase.ts";
3
3
  import { type InlineEditFailedDetail, type InlineEditSavedDetail, type InlineEditType } from "./inlineEditText.ts";
4
- import { type HttpKind } from "./server/wuiHttp.ts";
4
+ import { type HttpKind, type WuiResult } from "./server/wuiHttp.ts";
5
5
  type SelectRow = {
6
6
  value: string;
7
7
  label: string;
@@ -9,6 +9,7 @@ type SelectRow = {
9
9
  type SaveOutcome = {
10
10
  ok: true;
11
11
  text?: string;
12
+ result?: WuiResult;
12
13
  } | {
13
14
  ok: false;
14
15
  kind: HttpKind;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * <wui-mini-calendar>: the keyboard and the picks of a month navigator. React AppMiniCalendar and
3
+ * Razor <app-mini-calendar> render the same markup: a root carrying data-month (YYYY-MM), two nav
4
+ * buttons with data-nav (-1 or 1), and one day button per day carrying data-date (YYYY-MM-DD). The
5
+ * element moves focus between the days, pages the month, keeps one day in the tab order and reports
6
+ * a pick or a month change. It never draws a day: the page answers with the markup of the new month.
7
+ */
8
+ import { ElementBase } from "./elementBase.ts";
9
+ export declare class WuiMiniCalendar extends ElementBase {
10
+ private _pending;
11
+ private readonly _onClick;
12
+ private readonly _onKeyDown;
13
+ private readonly _onFocusIn;
14
+ private readonly _observer;
15
+ constructor();
16
+ connectedCallback(): void;
17
+ disconnectedCallback(): void;
18
+ _key(event: KeyboardEvent): void;
19
+ _pick(value: string): void;
20
+ _goTo(iso: string): void;
21
+ _page(iso: string, delta: number): void;
22
+ _changeMonth(month: string): void;
23
+ _month(): string;
24
+ _dayAt(iso: string): HTMLButtonElement | null;
25
+ _days(): HTMLButtonElement[];
26
+ _sync(): void;
27
+ }
@@ -38,5 +38,6 @@ export declare class WuiNotificationCenter extends ElementBase {
38
38
  _setBusy(busy: boolean): void;
39
39
  _render(): void;
40
40
  _say(text: string): void;
41
+ _emitRetry(): void;
41
42
  _emitRead(ids: string[], all: boolean): void;
42
43
  }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * <wui-offline-banner>: the strip under the top bar that says the browser is offline and when the
3
+ * content last loaded, then says the connection is back for a few seconds. React AppOfflineBanner
4
+ * and Razor <app-offline-banner> author the same markup and this element wires it:
5
+ *
6
+ * <wui-offline-banner class="wui-offline-banner" role="status" hidden>
7
+ * <span class="wui-offline-banner-icon">...</span>
8
+ * <div class="wui-offline-banner-body">
9
+ * <span class="wui-offline-banner-offline">...</span>
10
+ * <span class="wui-offline-banner-back">...</span>
11
+ * </div>
12
+ * [<div class="wui-offline-banner-action"><button class="wui-offline-banner-check">...</button></div>]
13
+ * </wui-offline-banner>
14
+ *
15
+ * The `offline` attribute forces the state ("true" or "false"). Without it the banner follows the
16
+ * browser's online and offline events. The element sets `data-state` to "offline" or "back" and
17
+ * unhides itself while either shows; the back-online state hides again after BACK_ONLINE_MS. A press
18
+ * of the check button fires a bubbling `wui:offline-banner:check-again` on the element.
19
+ */
20
+ import { ElementBase } from "./elementBase.ts";
21
+ export declare class WuiOfflineBanner extends ElementBase {
22
+ _offline: boolean;
23
+ _timer: ReturnType<typeof setTimeout> | null;
24
+ _onBrowser: () => void;
25
+ _onClick: (event: Event) => void;
26
+ static get observedAttributes(): string[];
27
+ constructor();
28
+ connectedCallback(): void;
29
+ disconnectedCallback(): void;
30
+ attributeChangedCallback(_name: string, _old: string | null, _value: string | null): void;
31
+ _sync(): void;
32
+ _show(state: string): void;
33
+ _hide(): void;
34
+ _clearTimer(): void;
35
+ }
@@ -85,6 +85,7 @@ export declare class WuiSelect extends ElementBase {
85
85
  _syncValueAvatar(): void;
86
86
  _syncValidity(): void;
87
87
  _syncReset(): void;
88
+ _syncUnderline(): void;
88
89
  _syncInvalid(): void;
89
90
  _syncError(): void;
90
91
  _refs(): Refs;