efficient-shell 8.22.0 → 8.23.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.
- package/README.md +31 -0
- package/dist/{Browser-VZU2MTSA.js → Browser-6DBCKZYW.js} +14 -14
- package/dist/Calculator-WZIBSVDK.js +29 -0
- package/dist/{CurrencyConverter-BSQCX3HS.js → CurrencyConverter-BX5HDEX6.js} +8 -8
- package/dist/{Documents-NR3T434J.js → Documents-YPOCP5OP.js} +10 -10
- package/dist/Files-33ONRECZ.js +87 -0
- package/dist/{Notepad-M5MCY5DV.js → Notepad-MOWWMSOT.js} +10 -10
- package/dist/{PdfViewer-OODU3XIT.js → PdfViewer-67VBUIRD.js} +1 -1
- package/dist/PomodoroTimer-LBFYGZHA.js +91 -0
- package/dist/{Preview-QTDCPMCL.js → Preview-OUCMOCOE.js} +26 -26
- package/dist/Sidebar-OIWVKYUU.js +43 -0
- package/dist/{Spreadsheet-V2EWOJML.js → Spreadsheet-GC7GNZ7C.js} +12 -12
- package/dist/{Stock-U3G45T36.js → Stock-5TKATE4I.js} +3 -3
- package/dist/{Weather-GEC4VHLM.js → Weather-NQJCUUUN.js} +17 -17
- package/dist/{WorldClock-6ORV4NHF.js → WorldClock-QYZF2JCO.js} +6 -6
- package/dist/ai/index.js +13 -13
- package/dist/apps/index.d.ts +1 -1
- package/dist/apps/index.js +1 -1
- package/dist/bin/media-host-check.js +1 -1
- package/dist/bin/ui-check.js +1 -1
- package/dist/charts/BoxPlotChart.js +1 -1
- package/dist/charts/CandlestickChart.js +1 -1
- package/dist/charts/CartesianPlot.js +1 -1
- package/dist/charts/ChartBrush.js +1 -1
- package/dist/charts/ChartFrame.js +1 -1
- package/dist/charts/ChartSkeleton.js +1 -1
- package/dist/charts/ChordChart.js +1 -1
- package/dist/charts/ColumnChart.js +1 -1
- package/dist/charts/FunnelChart.js +1 -1
- package/dist/charts/HeatmapChart.js +1 -1
- package/dist/charts/HistogramChart.js +1 -1
- package/dist/charts/Meter.js +1 -1
- package/dist/charts/PieChart.js +1 -1
- package/dist/charts/RadarChart.js +1 -1
- package/dist/charts/RadialBarChart.js +1 -1
- package/dist/charts/RangeChart.js +1 -1
- package/dist/charts/RankedBars.js +1 -1
- package/dist/charts/SankeyChart.js +1 -1
- package/dist/charts/ScatterChart.js +1 -1
- package/dist/charts/StatTile.js +1 -1
- package/dist/charts/SunburstChart.js +1 -1
- package/dist/charts/TimeSeriesChart.js +1 -1
- package/dist/charts/TreemapChart.js +1 -1
- package/dist/charts/WaterfallChart.js +1 -1
- package/dist/chunk-3EKWDVBV.js +29 -0
- package/dist/{chunk-W7ZAFS7C.js → chunk-3GHBY2FP.js} +7 -7
- package/dist/{chunk-WXIEWJF7.js → chunk-3PGK3VFS.js} +1 -1
- package/dist/{chunk-I2FHDMIN.js → chunk-3PNKI44X.js} +6 -6
- package/dist/{chunk-KFSNSDTW.js → chunk-3V5Z2BJY.js} +12 -12
- package/dist/chunk-3WC6ITJ3.js +11 -0
- package/dist/{chunk-Q6A6W3DI.js → chunk-3XQGEILM.js} +1 -1
- package/dist/{chunk-QSN7X27F.js → chunk-4CFOKYVR.js} +7 -7
- package/dist/{chunk-D3BDPSVV.js → chunk-4F3IKYUO.js} +6 -6
- package/dist/{chunk-QUS3C264.js → chunk-4NXMMWL6.js} +1 -1
- package/dist/{chunk-PHYI7M45.js → chunk-4VLKDANH.js} +1 -1
- package/dist/{chunk-6AJM3QNG.js → chunk-4YUCXIRP.js} +1 -1
- package/dist/{chunk-C3ZZDCBU.js → chunk-5FTHHLJH.js} +16 -16
- package/dist/{chunk-VWMTQLVS.js → chunk-5PY4H4ZJ.js} +1 -1
- package/dist/{chunk-R4JU7MU2.js → chunk-64FIE4SX.js} +7 -7
- package/dist/chunk-6NMDKOQA.js +7 -0
- package/dist/{chunk-PFB2NSSS.js → chunk-6WSTN5A3.js} +5 -5
- package/dist/{chunk-R5FFVK2W.js → chunk-72YFU346.js} +1 -1
- package/dist/{chunk-SDORX5C2.js → chunk-77FLITYM.js} +6 -6
- package/dist/{chunk-DIZW2GZP.js → chunk-7CFH6Y4T.js} +1 -1
- package/dist/{chunk-3UL7IB25.js → chunk-BI6ZLD4X.js} +7 -7
- package/dist/chunk-BIYL7CEI.js +2 -0
- package/dist/{chunk-X2U5XB7J.js → chunk-BMZSMXE6.js} +1 -1
- package/dist/chunk-BOBUSE33.js +2 -0
- package/dist/{chunk-VNYFGNHO.js → chunk-BRHIRE4D.js} +4 -4
- package/dist/{chunk-QZRH7L2E.js → chunk-BSNWVZHW.js} +1 -1
- package/dist/{chunk-74HUZZPT.js → chunk-BY2OWWKC.js} +1 -1
- package/dist/chunk-CRLSG5AY.js +9 -0
- package/dist/{chunk-F6YMKW5G.js → chunk-CZ25A5RS.js} +1 -1
- package/dist/{chunk-V4WNEJ63.js → chunk-D2AUUIKG.js} +1 -1
- package/dist/{chunk-RIGW3E5M.js → chunk-D7FT2PXG.js} +5 -5
- package/dist/{chunk-SSOLRTVS.js → chunk-DFDDRKIJ.js} +1 -1
- package/dist/{chunk-5EK4DFB5.js → chunk-DISSJYKV.js} +7 -7
- package/dist/{chunk-BUWOFJGM.js → chunk-DITCVBR7.js} +10 -10
- package/dist/chunk-DODH46ZQ.js +8 -0
- package/dist/{chunk-IMDLBXO3.js → chunk-DTSCO7VM.js} +1 -1
- package/dist/{chunk-ZY62UQI2.js → chunk-DZNG34DC.js} +19 -19
- package/dist/{chunk-YF7A3BWA.js → chunk-E5ALJIXV.js} +4 -4
- package/dist/chunk-E6UCGCOC.js +1 -0
- package/dist/{chunk-TSOBVLV5.js → chunk-ECWSWLQR.js} +1 -1
- package/dist/{chunk-PZFETJAG.js → chunk-EJUR35JG.js} +1 -1
- package/dist/{chunk-DIW6WT5L.js → chunk-ERMZ75FO.js} +1 -1
- package/dist/{chunk-F6YIUCIJ.js → chunk-EYKUKN32.js} +4 -4
- package/dist/{chunk-XUQQCKKD.js → chunk-EYX6KLCZ.js} +1 -1
- package/dist/{chunk-NYLXA2EG.js → chunk-EZ3BQ6PK.js} +7 -7
- package/dist/{chunk-SFWIYB4T.js → chunk-FL2PUQX7.js} +1 -1
- package/dist/chunk-FRPNTDP4.js +8 -0
- package/dist/{chunk-X7JK22X2.js → chunk-GATKJSGL.js} +5 -5
- package/dist/{chunk-56C5SEZ7.js → chunk-GIM2422N.js} +1 -1
- package/dist/{chunk-HLZZ5Q5E.js → chunk-GQACKEKW.js} +16 -16
- package/dist/{chunk-TCN7XUCY.js → chunk-GWIPZKZJ.js} +4 -4
- package/dist/{chunk-GVNDUNQL.js → chunk-H3BC4KDE.js} +1 -1
- package/dist/{chunk-IUBWN3OA.js → chunk-HVX37PKU.js} +1 -1
- package/dist/{chunk-OPFCLDVM.js → chunk-IHQX4GYD.js} +1 -1
- package/dist/{chunk-6PWLY2LQ.js → chunk-IZCODCSC.js} +1 -1
- package/dist/{chunk-KBLMTCTD.js → chunk-JEXXJK7H.js} +1 -1
- package/dist/{chunk-MRLQH2GZ.js → chunk-JNDBRSYZ.js} +2 -2
- package/dist/{chunk-ONEF47LG.js → chunk-JPP7UWQA.js} +3 -3
- package/dist/{chunk-SH6ZLK4K.js → chunk-JWIKHVF4.js} +8 -8
- package/dist/{chunk-SO4WAMVA.js → chunk-K7KQDPLW.js} +5 -5
- package/dist/{chunk-5OGWWBJY.js → chunk-KDZUWQEG.js} +1 -1
- package/dist/{chunk-CJKDYVNE.js → chunk-KKSW5IZ7.js} +6 -6
- package/dist/{chunk-POMS7YQN.js → chunk-KZHPX4FM.js} +2 -2
- package/dist/{chunk-TYZ4IY7F.js → chunk-LBLV64XG.js} +2 -2
- package/dist/{chunk-35VA5UFB.js → chunk-LK2SICMI.js} +1 -1
- package/dist/{chunk-3APQ5V6P.js → chunk-LLLAIPFX.js} +1 -1
- package/dist/{chunk-WBU7NZBP.js → chunk-M5P6A7KS.js} +1 -1
- package/dist/{chunk-52L6IBTN.js → chunk-MAOJENIB.js} +1 -1
- package/dist/{chunk-ZLGU4VYO.js → chunk-MEYYQC43.js} +5 -5
- package/dist/{chunk-7AINUMUA.js → chunk-MMFJBWJC.js} +1 -1
- package/dist/{chunk-MIZO6SQ3.js → chunk-MTXTJLFK.js} +2 -2
- package/dist/{chunk-BJKZYQFA.js → chunk-MXHEREC6.js} +3 -3
- package/dist/chunk-N3GETPME.js +1 -0
- package/dist/{chunk-BBYHBN3R.js → chunk-NHCRQ7SW.js} +1 -1
- package/dist/chunk-NID6MGGC.js +13 -0
- package/dist/{chunk-SLORZA7W.js → chunk-NMK4UQXZ.js} +12 -12
- package/dist/{chunk-QLAQ6ASB.js → chunk-NT26CWMZ.js} +5 -5
- package/dist/{chunk-GTKNEJ3X.js → chunk-NVE6L27I.js} +8 -8
- package/dist/{chunk-CQZEO4UV.js → chunk-NWP6IJYK.js} +9 -9
- package/dist/{chunk-AXQBQH55.js → chunk-OFOLUFNB.js} +15 -15
- package/dist/chunk-OSA24YH6.js +19 -0
- package/dist/{chunk-IOESXYEI.js → chunk-OVVXSAGE.js} +8 -8
- package/dist/{chunk-Z4UKLPGE.js → chunk-PDXD6DT7.js} +1 -1
- package/dist/{chunk-ALYBCDHU.js → chunk-PNGL4ZW2.js} +6 -6
- package/dist/{chunk-2TBC254V.js → chunk-PNQ4EYYM.js} +3 -3
- package/dist/{chunk-JXGYIV44.js → chunk-PPFMXLEX.js} +9 -9
- package/dist/{chunk-IJICE6KT.js → chunk-Q3OCGLW7.js} +2 -2
- package/dist/{chunk-D7AA5WE2.js → chunk-QFA5COE6.js} +1 -1
- package/dist/{chunk-ZI7P5YGF.js → chunk-QQCHLRKG.js} +1 -1
- package/dist/{chunk-XCHY6QVH.js → chunk-QQK3XS6H.js} +8 -8
- package/dist/{chunk-46M6AYFJ.js → chunk-R6DGLGB3.js} +1 -1
- package/dist/chunk-RGBX3EVC.js +11 -0
- package/dist/chunk-RSO67DWS.js +8 -0
- package/dist/{chunk-GKTCCPME.js → chunk-RUQEB2ZC.js} +3 -3
- package/dist/{chunk-5LNFW5E4.js → chunk-RYBJ6MMM.js} +1 -1
- package/dist/{chunk-2RJKMYON.js → chunk-S7VSXUKS.js} +3 -3
- package/dist/{chunk-O3NLPJH2.js → chunk-SB7OTZI4.js} +19 -19
- package/dist/{chunk-5B73MLXV.js → chunk-SBHFEWR6.js} +1 -1
- package/dist/chunk-SG2MTCA2.js +100 -0
- package/dist/chunk-SXORVKIZ.js +9 -0
- package/dist/{chunk-CREVU3AF.js → chunk-TW7TA2AB.js} +1 -1
- package/dist/{chunk-JLPTSC66.js → chunk-TXS6JKFV.js} +1 -1
- package/dist/{chunk-DQB3ORB7.js → chunk-UB4BTRSB.js} +5 -5
- package/dist/{chunk-4ELYV3L6.js → chunk-UKB2I3UK.js} +1 -1
- package/dist/{chunk-LQHWFL5Y.js → chunk-UQZWPA5M.js} +2 -2
- package/dist/{chunk-XFIMTNUH.js → chunk-UVUBZL7K.js} +1 -1
- package/dist/{chunk-JGZLLQAN.js → chunk-UX6HNRFV.js} +7 -7
- package/dist/chunk-VTVOQS5L.js +20 -0
- package/dist/{chunk-V23TPYHO.js → chunk-VU6VPKM3.js} +6 -6
- package/dist/{chunk-F3AROMIU.js → chunk-W5M6P4DZ.js} +6 -6
- package/dist/{chunk-L2JOLPJR.js → chunk-WGSK7HEY.js} +1 -1
- package/dist/{chunk-WQKGBPOQ.js → chunk-WJ3XSJ6B.js} +1 -1
- package/dist/{chunk-TJPPV7KZ.js → chunk-WTY3SXO7.js} +1 -1
- package/dist/{chunk-2IV4XF3Y.js → chunk-WYN5KVU4.js} +3 -3
- package/dist/chunk-X6PPP6NX.js +14 -0
- package/dist/{chunk-6DT7HG3F.js → chunk-XHBQPVNG.js} +1 -1
- package/dist/{chunk-5BBDUKQP.js → chunk-Y2D2YMFY.js} +12 -12
- package/dist/{chunk-ZVTOB4RE.js → chunk-Y4MI6NRI.js} +1 -1
- package/dist/{chunk-ZMLRNHMS.js → chunk-Y5T257HX.js} +3 -3
- package/dist/{chunk-FW2EEIDB.js → chunk-YCQVEJOT.js} +2 -2
- package/dist/{chunk-JACPHDTK.js → chunk-YDYDR72S.js} +1 -1
- package/dist/chunk-YSFLXPUS.js +7 -0
- package/dist/{chunk-BJEBOXTR.js → chunk-YW2DH6YQ.js} +3 -3
- package/dist/{chunk-74QAQXSB.js → chunk-Z2YGQBLZ.js} +1 -1
- package/dist/{chunk-U4QZIU7X.js → chunk-ZEKM6HAA.js} +2 -2
- package/dist/{chunk-352MVBF7.js → chunk-ZN3O2KJ7.js} +18 -18
- package/dist/{chunk-FDENTKSM.js → chunk-ZOSIPTXM.js} +5 -5
- package/dist/{chunk-SRMRRJ5K.js → chunk-ZSRRV44J.js} +1 -1
- package/dist/{chunk-2JYQF3PJ.js → chunk-ZTB6EMC7.js} +1 -1
- package/dist/data/DataTable.js +1 -1
- package/dist/data/Kanban.js +1 -1
- package/dist/data/ListFooter.js +1 -1
- package/dist/data/ListLoadError.js +1 -1
- package/dist/data/Pagination.js +1 -1
- package/dist/file-intake/index.js +1 -1
- package/dist/forms/BorderInput.js +1 -1
- package/dist/forms/BrandAssetEditor.js +1 -1
- package/dist/forms/Calendar.js +1 -1
- package/dist/forms/ColorPicker.js +1 -1
- package/dist/forms/ComposerAttachments.js +1 -1
- package/dist/forms/CornersInput.js +1 -1
- package/dist/forms/DatePicker.js +1 -1
- package/dist/forms/DateRangePicker.js +1 -1
- package/dist/forms/DateTimePicker.js +1 -1
- package/dist/forms/DisplayChips.js +1 -1
- package/dist/forms/FilePicker.js +1 -1
- package/dist/forms/FormErrorSummary.js +1 -1
- package/dist/forms/IconPicker.js +1 -1
- package/dist/forms/ImageFocusPoint.js +1 -1
- package/dist/forms/InputNumber.js +1 -1
- package/dist/forms/LinkPicker.js +1 -1
- package/dist/forms/MediaLibrary.js +1 -1
- package/dist/forms/MediaUploadField.js +1 -1
- package/dist/forms/MediaUploadGrid.js +1 -1
- package/dist/forms/MediaUsedInList.js +1 -1
- package/dist/forms/NumericKeypad.js +1 -1
- package/dist/forms/PositionInput.js +1 -1
- package/dist/forms/Select.js +1 -1
- package/dist/forms/SidesInput.js +1 -1
- package/dist/forms/Slider.js +1 -1
- package/dist/forms/Snippet.js +1 -1
- package/dist/forms/TagInput.js +1 -1
- package/dist/forms/TextToolbar.js +1 -1
- package/dist/forms/TimePicker.js +1 -1
- package/dist/forms/WidthsBar.js +1 -1
- package/dist/forms/mediaLibraryMenu.js +1 -1
- package/dist/forms/mediaMoveItems.js +1 -1
- package/dist/forms/useFileIntake.js +1 -1
- package/dist/index.d.ts +18 -4
- package/dist/index.js +380 -380
- package/dist/locales/zh-Hans.js +1 -1
- package/dist/map/index.js +2 -2
- package/dist/page-tabs/index.js +5 -5
- package/dist/pdf/index.js +1 -1
- package/dist/shell/Accordion.js +1 -1
- package/dist/shell/AppUpdateBanner.js +1 -1
- package/dist/shell/Avatar.js +1 -1
- package/dist/shell/Banner.js +1 -1
- package/dist/shell/Breadcrumbs.js +1 -1
- package/dist/shell/BudgetBar.js +1 -1
- package/dist/shell/Card.js +1 -1
- package/dist/shell/ColoredBadge.js +1 -1
- package/dist/shell/ConfirmDialog.js +1 -1
- package/dist/shell/ContainerFillChart.js +1 -1
- package/dist/shell/CountBadge.js +1 -1
- package/dist/shell/Dialog.js +1 -1
- package/dist/shell/Drawer.js +1 -1
- package/dist/shell/EditableGrid.js +1 -1
- package/dist/shell/EmptyState.js +1 -1
- package/dist/shell/GlobalSearch.js +1 -1
- package/dist/shell/HelpCenter.js +1 -1
- package/dist/shell/IconRail.js +1 -1
- package/dist/shell/ImageLightbox.js +1 -1
- package/dist/shell/LanguageSelect.js +1 -1
- package/dist/shell/Markdown.js +1 -1
- package/dist/shell/MetricBar.js +1 -1
- package/dist/shell/MetricBarLegend.js +1 -1
- package/dist/shell/MilestoneTimeline.js +1 -1
- package/dist/shell/PageHeader.js +1 -1
- package/dist/shell/ProductionTimeline.js +1 -1
- package/dist/shell/ResizeHandle.js +1 -1
- package/dist/shell/Result.js +1 -1
- package/dist/shell/SearchableSelect.js +1 -1
- package/dist/shell/SettingReset.js +1 -1
- package/dist/shell/SettingRow.js +1 -1
- package/dist/shell/SidebarLayout.js +1 -1
- package/dist/shell/SidebarNav.js +1 -1
- package/dist/shell/SortableList.js +1 -1
- package/dist/shell/Statistic.js +1 -1
- package/dist/shell/TimeAgo.js +1 -1
- package/dist/shell/TimelineTrack.js +1 -1
- package/dist/shell/TransferProgress.js +1 -1
- package/dist/shell/Tree.js +1 -1
- package/dist/shell/language.js +1 -1
- package/dist/shell/strings.d.ts +5 -0
- package/dist/shell/strings.js +1 -1
- package/dist/shell/toast.js +1 -1
- package/dist/telemetry/index.js +1 -1
- package/dist/templates/AuthScreen.js +1 -1
- package/dist/templates/ChatTemplate.js +1 -1
- package/dist/templates/CheckoutTemplate.js +1 -1
- package/dist/templates/DashboardTemplate.js +1 -1
- package/dist/templates/DataTablePage.js +1 -1
- package/dist/templates/EmailTemplate.js +1 -1
- package/dist/templates/ErrorBoundary.js +1 -1
- package/dist/templates/ErrorPage.js +1 -1
- package/dist/templates/FormLayoutPage.js +1 -1
- package/dist/templates/GalleryTemplate.js +1 -1
- package/dist/{types-BOinJXUf.d.ts → types-ClT92-8Z.d.ts} +13 -1
- package/dist/ui/index.js +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/dist/Calculator-DKZHOHOD.js +0 -29
- package/dist/Files-QMV2E74S.js +0 -87
- package/dist/PomodoroTimer-I423ZZOQ.js +0 -91
- package/dist/Sidebar-UVBEI4DQ.js +0 -43
- package/dist/chunk-6JCIQ7XL.js +0 -8
- package/dist/chunk-6UBBY54N.js +0 -2
- package/dist/chunk-B73YLHD2.js +0 -99
- package/dist/chunk-CPM3BQGV.js +0 -14
- package/dist/chunk-DSYIKLOK.js +0 -11
- package/dist/chunk-EUOFKZI3.js +0 -19
- package/dist/chunk-LVAGFIWK.js +0 -2
- package/dist/chunk-MWNZY33B.js +0 -13
- package/dist/chunk-NE42BDQX.js +0 -9
- package/dist/chunk-NHFLTKPK.js +0 -11
- package/dist/chunk-O5KDTFK5.js +0 -8
- package/dist/chunk-PMOGQHYX.js +0 -20
- package/dist/chunk-RPK3U2K2.js +0 -9
- package/dist/chunk-RPTQCFLR.js +0 -29
- package/dist/chunk-URFWJZTV.js +0 -7
- package/dist/chunk-VKMEQKYT.js +0 -1
- package/dist/chunk-W7NZKU27.js +0 -7
- package/dist/chunk-YPXVOPL4.js +0 -1
- package/dist/chunk-Z5TCGLCM.js +0 -8
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import{computeMaximizedBox as e,isSidebarStripReserved as t,boxFillsWorkArea as n,readAlwaysMaximizedFlag as r,WORK_AREA_CHANGED_EVENT as o,useShellAuth as i,scrollerIsFluid as a,growBoxToWidth as s,widthToFit as l,navIcons as c}from"./chunk-CY5N5OA3.js";import{ROW_HEIGHTS as u}from"./chunk-AW7TOB6N.js";import{isStaleChunkError as d}from"./chunk-JDCM2VHG.js";import{reportBoundaryError as h}from"./chunk-KNUR2UEG.js";import{Result as m}from"./chunk-HVX37PKU.js";import{CMD_Z as p,CMD_SHIFT_Z as f}from"./chunk-Y53KNQKL.js";import{CopyButton as w}from"./chunk-FL2PUQX7.js";import{confirm as y}from"./chunk-ZN3O2KJ7.js";import{useShellPrefs as g}from"./chunk-KC3EX26K.js";import{dialogA11y as v}from"./chunk-VWGWZY7A.js";import{PopupMenu as b,PopupMenuItem as x,PopupMenuDivider as k,PopupMenuLabel as E}from"./chunk-O6JX6RDX.js";import{ColoredBadge as C}from"./chunk-BY2OWWKC.js";import{useIsMobile as M,useIsPhone as N}from"./chunk-UGTRSRIW.js";import{StatusBadge as S}from"./chunk-D323R2FT.js";import{focusableIn as L}from"./chunk-CDAJKLGL.js";import{Button_default as T}from"./chunk-4IU5BSVE.js";import{Icon as z}from"./chunk-KIBL6M3T.js";import{LoadingSpinner as A}from"./chunk-Q5MD3VY6.js";import{Z_LAYERS as D}from"./chunk-62LW225J.js";import{runEscapeInterceptors as P}from"./chunk-TWVUQUUD.js";import{useShellStrings as I}from"./chunk-E6UCGCOC.js";import{createContext as K,useContext as W,Component as R,useLayoutEffect as O,useRef as $,useEffect as j,useState as F,useSyncExternalStore as q,useCallback as B,isValidElement as H,Fragment as U,Children as Y,cloneElement as X,useMemo as V,useId as _,useReducer as G,Suspense as J}from"react";import{jsxs as Q,jsx as Z,Fragment as ee}from"react/jsx-runtime";import{createPortal as te}from"react-dom";import{useLocation as ne}from"react-router-dom";import{useQueryClient as re,useQuery as oe}from"@tanstack/react-query";function ie(e){return"component"in e}function ae(e){return"endpoint"in e}var se={};function le(e){se=e}var ce=new Proxy({},{get:(e,t)=>se[t],has:(e,t)=>t in se,ownKeys:()=>Object.keys(se),getOwnPropertyDescriptor(e,t){if(t in se)return{configurable:!0,enumerable:!0,value:se[t]}}}),ue=null;function de(e){ue=e}function he(){return null!==ue}var me=/* @__PURE__ */new Set(["get","post","put","patch","delete","head","options","request"]),pe=new Proxy({},{get:(e,t)=>ue?ue[t]:"string"==typeof t&&me.has(t)?()=>Promise.resolve({data:null,status:0,statusText:"",headers:{},config:{}}):void 0}),fe=K(null);function we(){return W(fe)?.pageSearch??""}var ye=null,ge=/* @__PURE__ */new Set;function ve(e){ye!==e&&(ye=e,ge.forEach(e=>e()))}function be(){return ye}function xe(e){return ge.add(e),()=>{ge.delete(e)}}var ke=null;function Ee(e){ke=e}function Ce({error:e,onReload:t}){const n=d(e);/* @__PURE__ */
|
|
2
|
+
return Q("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-6 py-12 text-center",children:[
|
|
3
|
+
/* @__PURE__ */Z(z,{name:"warning",className:"h-8 w-8 text-amber-500",strokeWidth:1.5}),
|
|
4
|
+
/* @__PURE__ */Q("div",{className:"min-w-0",children:[
|
|
5
|
+
/* @__PURE__ */Z("p",{className:"text-sm font-medium text-gray-700",children:n?"This window needs the latest version of the app":"This window crashed"}),
|
|
6
|
+
/* @__PURE__ */Z("p",{className:"mt-1 text-xs text-gray-400 max-w-sm break-words",children:n?"A new version was deployed while this tab was open. Reload the page to pick it up.":e.message||String(e)})]}),
|
|
7
|
+
/* @__PURE__ */Z("button",{type:"button",onClick:n?()=>window.location.reload():t,className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 text-sm font-medium rounded-lg",children:n?"Reload page":"Reload window"})]})}var Me=class extends R{state={error:null};static getDerivedStateFromError(e){return{error:e instanceof Error?e:new Error(String(e))}}componentDidCatch(e,t){console.error("[efficient-shell] window content crashed:",e,t.componentStack),h(e)}reset=()=>this.setState({error:null});render(){const{error:e}=this.state;return e?this.props.fallback?this.props.fallback(e,this.reset):/* @__PURE__ */Z(Ce,{error:e,onReload:this.reset}):this.props.children}},Ne=K(null),Se="text-xs text-gray-500 hover:text-gray-700 disabled:opacity-40 disabled:hover:text-gray-500 disabled:cursor-default";function Le({className:e="",auto:t=!1}){const n=W(Ne),r=I().undo,o=n?.claimOwnMount;if(O(()=>{if(!t&&o)return o(!0),()=>o(!1)},[t,o]),!n||!n.enabled)return null;const{undo:i,redo:a,canUndo:s,canRedo:l,undoLabel:c,redoLabel:u}=n;/* @__PURE__ */
|
|
8
|
+
return Q("div",{className:`flex items-center gap-2 ${e}`,"data-undo-controls":t?"shell":"form",children:[
|
|
9
|
+
/* @__PURE__ */Z("button",{type:"button",onClick:i,disabled:!s,title:s?r.undoStep(c??"",p):r.nothingToUndo,className:Se,children:r.undo}),
|
|
10
|
+
/* @__PURE__ */Z("button",{type:"button",onClick:a,disabled:!l,title:l?r.redoStep(u??"",f):r.nothingToRedo,className:Se,children:r.redo})]})}var Te=/* @__PURE__ */new Set([408,429]);function ze(e){const t=e?.response?.status;return"number"==typeof t?t:void 0}function Ae(e){const t=ze(e);return null!=t&&(t>=400&&t<500&&!Te.has(t))}function De(e,t){return!Ae(t)&&e<3}function Pe(e){if("page"!==e.type)return!0;const t=e.route?ce[e.route]:void 0;if(!t||!ie(t))return!0;const n=t;return!n.widget&&!n.utility}function Ie(e){const t=e.route?ce[e.route]:void 0;if(!t||!ie(t))return;const n=t;return n.taskbarGroup?n.taskbarGroup:{key:e.route,label:n.label,icon:e.route}}var Ke=(e,t)=>!!t&&"page"===e.type&&e.route===t;function We(){const e=I().loading;/* @__PURE__ */
|
|
11
|
+
return Z(A,{size:"sm",padding:"p-8",label:e.label})}var Re="flex-1 min-h-0";function Oe(){const e=I().record;/* @__PURE__ */
|
|
12
|
+
return Z(A,{label:e.loading,padding:"",className:Re})}function $e(e){return e??void 0}function je({isPending:e,isFetching:t,enabled:n=!0,error:r,onRetry:o}){const i=I().record;if(t||e&&n)/* @__PURE__ */return Z(Oe,{});if(r){const e=ze(r);if(401===e)/* @__PURE__ */
|
|
13
|
+
return Z(m,{status:"warning",title:i.signInRequired,subTitle:i.signInBody,className:Re});if(403===e)/* @__PURE__ */
|
|
14
|
+
return Z(m,{status:"403",className:Re});if(404===e||410===e)/* @__PURE__ */
|
|
15
|
+
return Z(m,{status:"404",title:i.notFound,className:Re});const t=null==e||408===e||429===e||e>=500;/* @__PURE__ */
|
|
16
|
+
return Z(m,{status:"500",title:i.loadFailed,subTitle:t?i.checkConnection:i.rejected,extra:t?/* @__PURE__ */Z(T,{variant:"secondary",size:"sm",onClick:o,children:i.retry}):void 0,className:Re})}/* @__PURE__ */
|
|
17
|
+
return Z(m,{status:"404",title:i.notFound,className:Re})}function Fe({entity:e,children:t,...n}){return null!=e?/* @__PURE__ */Z(ee,{children:t(e)}):/* @__PURE__ */Z(je,{...n})}var qe=/^[a-z]+(?:-[a-z]+)*-\d{13}$/;function Be(e){return"string"==typeof e&&(e.startsWith("new-")||qe.test(e))}function He(e){if(Be(e.entityId))return!0;const t=e.entitySnapshot;return!(!t||"object"!=typeof t||!t._new&&!t._duplicate)}var Ue=K({openWindows:[],openEntity:()=>{},openPage:()=>{},reorderWindows:()=>{},closeEntity:()=>{},minimize:()=>{},items:[],restore:()=>{},remove:()=>{},restoreIfMinimized:()=>!1,openItems:[]}),Ye=K(null);function Xe(e){const t=W(Ye),n=$(null);null===n.current&&(n.current=/* @__PURE__ */Symbol("window-dirty")),O(()=>{if(t)return t(n.current,e)},[t,e]),j(()=>{if(!t||!e)return;const n=e=>{e.preventDefault(),e.returnValue=""};return window.addEventListener("beforeunload",n),()=>window.removeEventListener("beforeunload",n)},[t,e])}function Ve(){const e=$(/* @__PURE__ */new Map),[t,n]=F(!1);return{dirty:t,registerDirty:B((t,r)=>{const o=()=>{const t=Array.from(e.current.values()).some(Boolean);n(e=>e===t?e:t)};return e.current.set(t,r),o(),()=>{e.current.delete(t),o()}},[])}}function _e(){return W(Ue)}function Ge(e){if("page"!==e.type&&He(e))return null;const t="page"===e.type?"page":e.entityType||"",n="page"===e.type?e.route||"":e.entityId||"";return t&&n?{entityType:t,entityId:n,label:e.label}:null}function Je({item:e,onClose:t,accentRgb:n}){const{dirty:r,registerDirty:o}=Ve(),i=ce[e.route];if(!i||!ie(i))return null;const a=i,s=a.component;/* @__PURE__ */
|
|
18
|
+
return Z(Xr,{open:!0,onClose:t,icon:c[e.route],title:a.label,size:a.size||"2xl",dirty:r,allowPinOnTop:a.allowPinOnTop,initialPosition:a.initialPosition,widget:a.widget,compact:a.compact,appStyle:a.appStyle,flushBody:a.flushBody,autoHeight:a.autoHeight,autoMinHeight:a.autoMinHeight,autoWidth:a.autoWidth,dimensions:a.dimensions,windowKey:e.id,openedFromKey:e.openedFrom,accentRgb:n,children:/* @__PURE__ */Z(Ye.Provider,{value:o,children:/* @__PURE__ */Z(J,{fallback:/* @__PURE__ */Z("div",{className:"flex items-center justify-center py-12",children:/* @__PURE__ */Z(We,{})}),children:/* @__PURE__ */Z(s,{})})})})}function Qe({entityType:e,entityId:t,label:n}){const r=I(),o=re(),{data:i}=oe({queryKey:["my-profile-sidebar"],enabled:he(),queryFn:()=>pe.get("/auth/me/").then(e=>e.data)}),a=(i?.preferences||{}).favorite_documents||[],s=a.some(n=>n.entityType===e&&n.entityId===t);/* @__PURE__ */
|
|
19
|
+
return Z("button",{onClick:()=>{const r=s?a.filter(n=>!(n.entityType===e&&n.entityId===t)):[...a,{entityType:e,entityId:t,label:n}];pe.patch("/auth/me/",{preferences:{favorite_documents:r}}).then(()=>{o.invalidateQueries({queryKey:["my-profile-sidebar"]})})},title:s?r.taskbar.removeFromDesktop:r.taskbar.addToDesktop,className:"shrink-0 transition-colors "+(s?"text-yellow-500 hover:text-yellow-600":"text-gray-300 hover:text-yellow-400"),children:/* @__PURE__ */Z(z,{name:"star",className:"h-4 w-4",fill:s?"currentColor":"none",strokeWidth:1.5})})}var Ze=/* @__PURE__ */new Set,et=()=>"hidden";function tt({item:e,onClose:t,onMinimize:n,accentRgb:r}){const o=ce[e.entityType];if(!o||!ae(o))return null;const i=o,[a,s]=F(!1),{dirty:l,registerDirty:u}=Ve(),d=i.queryKey||i.endpoint.replace(/^\/|\/$/g,"").split("/").pop()||e.entityType,h=e.entitySnapshot?._duplicate,m=Be(e.entityId),p=!i.selfFetching&&!h&&!m&&he(),f=oe({queryKey:[d,e.entityId],queryFn:()=>{return pe.get((t=i.endpoint,n=String(e.entityId),`${t}${encodeURIComponent(n)}/`)).then(e=>e.data);var t,n},initialData:$e(e.entitySnapshot),initialDataUpdatedAt:0,enabled:p,staleTime:0,refetchOnWindowFocus:!0,refetchOnMount:"always",refetchInterval:e=>!Ae(e.state.error)&&6e4,refetchIntervalInBackground:!1,retry:De}),w=f.data,y=f.refetch;j(()=>{var t;if(p)return t=t=>{t!==e.id||Ze.has(t)||y({cancelRefetch:!1})},Jn.add(t),()=>{Jn.delete(t)}},[y,e.id,p]);const g=B(()=>{a&&!l?s(!1):t()},[a,l,t]),v=(i.useEdit??et)(w??null),b=!i.useEdit||m||h?void 0:{state:v,editing:a,onEdit:()=>s(!0),onDiscard:()=>s(!1)},x=i.selfFetching?e.label:w?i.title(w,a,s):e.label,k=i.icon,E=k?c[k]:null,C=x,M=!i.selfFetching&&w&&i.footer&&!h?i.footer(w):void 0;return i.rendersOwnModal?i.selfFetching?/* @__PURE__ */Z(J,{fallback:/* @__PURE__ */Z(We,{}),children:i.render(w??e.entitySnapshot,t,e.entityId,a,s)}):null!=w?/* @__PURE__ */Z(J,{fallback:/* @__PURE__ */Z(Xr,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */Z(Oe,{})}),children:i.render(w,t,e.entityId,a,s)}):/* @__PURE__ */Z(Xr,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */Z(je,{isPending:f.isPending,isFetching:f.isFetching,enabled:p,error:f.error,onRetry:y})}):/* @__PURE__ */Z(Xr,{open:!0,onClose:g,onMinimize:n,initialBox:e.savedBox,icon:E,title:C,footer:M,copyText:e.label,windowKey:e.id,openedFromKey:e.openedFrom,size:i.size||"2xl",dirty:l,editing:a||m||h,edit:b,dimensions:i.dimensions,autoHeight:i.autoHeight,autoMinHeight:i.autoMinHeight,autoWidth:i.autoWidth,appStyle:i.appStyle,flushBody:i.flushBody,accentRgb:r,children:/* @__PURE__ */Z(Ye.Provider,{value:u,children:/* @__PURE__ */Z(J,{fallback:/* @__PURE__ */Z(Oe,{}),children:i.selfFetching?i.render(null,t,e.entityId,a,s):/* @__PURE__ */Z(Fe,{entity:w,isPending:f.isPending,isFetching:f.isFetching,enabled:p,error:f.error,onRetry:y,children:n=>i.render(n,t,e.entityId,a,s)})})})})}function nt(e){return document.querySelector(`[data-modal-panel][data-window-key="${e}"]`)}function rt(e){return document.querySelector(`[data-modal-panel][data-window-root][data-window-owner="${e}"]`)}function ot(e){const t=nt(e),n=t??rt(e);if(!n)return;if(t&&!cr(t))return r=e,void window.dispatchEvent(new CustomEvent("modal-reveal",{detail:{windowKey:r}}));var r;const o=n.getAttribute("data-modal-id");o&&Qn(o)}function it(){const e=Er();if(!e)return;const t=document.querySelector(`[data-modal-panel][data-modal-id="${e}"]`);return t?.getAttribute("data-window-key")??void 0}var at=/* @__PURE__ */new Map;function st(){const e=it();if(e)return at.get(e)}function lt(e){const t=document.querySelectorAll("[data-modal-panel]");for(const n of Array.from(t)){const t=n.querySelector("[data-window-title]");if(t?.textContent?.includes(e))return n}return null}var ct="rosh-peek-style",ut=D.peek,dt=D.taskbarPreview;function ht(e){"undefined"!=typeof document&&(!function(){if("undefined"==typeof document||document.getElementById(ct))return;const e=document.createElement("style");e.id=ct,e.textContent=`body.rosh-peeking [data-modal-panel]{transition:opacity .18s ease}body.rosh-peeking [data-modal-panel]:not([data-peek-focus]){opacity:.4}body.rosh-peeking [data-modal-panel][data-peek-focus]{opacity:1}body.rosh-peeking [data-modal-panel][data-peek-focus]:not([data-pinned-top]){z-index:${ut}!important}html.rosh-reduce-transparency body.rosh-peeking [data-modal-panel]:not([data-peek-focus]){opacity:.92}@media (prefers-reduced-motion:reduce){body.rosh-peeking [data-modal-panel]{transition:none}}`,document.head.appendChild(e)}(),document.querySelectorAll("[data-modal-panel][data-peek-focus]").forEach(e=>e.removeAttribute("data-peek-focus")),e&&e.setAttribute("data-peek-focus",""),document.body.classList.toggle("rosh-peeking",!!e))}function mt(){"undefined"!=typeof document&&(document.body.classList.remove("rosh-peeking"),document.querySelectorAll("[data-modal-panel][data-peek-focus]").forEach(e=>e.removeAttribute("data-peek-focus")))}function pt({id:e,label:t,maxW:n,maxH:r,titleAbove:o=!1,onClick:i,onClose:a}){const s=I(),l=$(null),[c,u]=F({w:n,h:Math.round(.75*r)}),[d,h]=F(!1);return O(()=>{const o=l.current;if(!o)return;const i=nt(e)??lt(t);if(!i)return void h(!1);const a=i.getBoundingClientRect();if(0===a.width||0===a.height)return void h(!1);const s=Math.min(n/a.width,r/a.height),c=Math.max(80,Math.round(a.width*s)),d=Math.max(60,Math.round(a.height*s));u({w:c,h:d}),h(!0);const m=i.cloneNode(!0);return m.style.position="absolute",m.style.top="0",m.style.left="0",m.style.right="auto",m.style.bottom="auto",m.style.width=a.width+"px",m.style.height=a.height+"px",m.style.transform=`scale(${s})`,m.style.transformOrigin="top left",m.style.pointerEvents="none",m.style.animation="none",m.style.zIndex="auto",m.removeAttribute("data-modal-panel"),m.removeAttribute("data-modal-id"),m.removeAttribute("data-window-key"),m.removeAttribute("role"),m.removeAttribute("aria-labelledby"),m.removeAttribute("aria-label"),m.querySelectorAll('[role="dialog"], [data-portal]').forEach(e=>{e.style.display="none"}),o.innerHTML="",o.appendChild(m),()=>{o.innerHTML=""}},[e,t,n,r]),/* @__PURE__ */Q("div",{style:{width:c.w,height:c.h},className:"relative rounded-md overflow-hidden bg-white/95 border border-gray-300 shadow-(--elevation-panel) cursor-pointer ring-2 ring-transparent group-hover:ring-blue-400 transition shrink-0",onClick:i,children:[
|
|
20
|
+
/* @__PURE__ */Z("div",{ref:l,className:"absolute inset-0 z-0 overflow-hidden"}),!d&&/* @__PURE__ */Q("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-gray-400 bg-gray-50",children:[
|
|
21
|
+
/* @__PURE__ */Z(z,{name:"window",className:"h-6 w-6",strokeWidth:1.5}),
|
|
22
|
+
/* @__PURE__ */Z("span",{className:"mt-1 text-3xs uppercase tracking-wide",children:"Hidden"})]}),!o&&/* @__PURE__ */Z("div",{className:"absolute bottom-0 left-0 right-0 z-10 px-2 py-1 text-2xs font-medium text-white bg-gradient-to-t from-black/80 to-transparent truncate pointer-events-none",children:t}),a&&/* @__PURE__ */Z("button",{onClick:e=>{e.stopPropagation(),a()},className:"absolute top-1 right-1 z-20 h-5 w-5 rounded-full bg-gray-900/90 ring-1 ring-white/80 shadow-sm hover:bg-red-500 text-white flex items-center justify-center",title:s.taskbar.closeWindow,children:/* @__PURE__ */Z(z,{name:"close",className:"h-3 w-3",strokeWidth:3})})]})}function ft({items:e,anchorEl:t,onActivate:n,onClose:r,onMouseEnter:o,onMouseLeave:i}){const a=I(),s=e.length>1,l=$(null),[c,u]=F({left:-9999,top:-9999,ready:!1}),[d,h]=F(()=>"undefined"!=typeof document&&getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom");O(()=>{const e=l.current;if(!e)return;const n=()=>{const n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),o=getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom";h(o);let i,a=n.left+n.width/2-r.width/2;"top"===o?i=n.bottom+8:"left"===o?(a=n.right+8,i=n.top+n.height/2-r.height/2):"right"===o?(a=n.left-r.width-8,i=n.top+n.height/2-r.height/2):i=n.top-r.height-8,a=Math.max(8,Math.min(a,window.innerWidth-r.width-8)),i=Math.max(8,Math.min(i,window.innerHeight-r.height-8)),u({left:a,top:i,ready:!0})};n();const r=new ResizeObserver(n);return r.observe(e),()=>r.disconnect()},[t,e.length]),j(()=>mt,[]);const m="top"===d,p=(m?"mt-1":"mb-1")+" max-w-[240px] truncate text-2xs font-medium text-gray-900 bg-white/80 px-2 py-0.5 rounded shadow-sm ring-2 ring-transparent transition group-hover:ring-blue-400";return te(
|
|
23
|
+
/* @__PURE__ */Z("div",{ref:l,"data-taskbar-preview":"",style:{position:"fixed",left:c.left,top:c.top,zIndex:dt,maxWidth:"calc(100vw - 16px)",opacity:c.ready?1:0},className:s?"flex gap-2 flex-wrap":"",onMouseEnter:o,onMouseLeave:()=>{mt(),i()},children:e.map(e=>{const t=nt(e.id)??lt(e.label),o=t?function(e){if(cr(e))return null;const t=e.getBoundingClientRect(),n=rr(),r=t.left+t.width/2-(n.x+n.w/2),o=t.top+t.height/2-(n.y+n.h/2);return 180*Math.atan2(o,r)/Math.PI}(t):null;/* @__PURE__ */
|
|
24
|
+
return Q("div",{className:"group flex flex-col items-center",onMouseEnter:()=>ht(t),children:[!m&&/* @__PURE__ */Z("span",{className:p,children:e.label}),
|
|
25
|
+
/* @__PURE__ */Z(pt,{id:e.id,label:e.label,maxW:240,maxH:160,titleAbove:!0,onClick:()=>n(e.id),onClose:()=>r(e.id)}),m&&/* @__PURE__ */Z("span",{className:p,children:e.label}),null!==o&&/* @__PURE__ */Q("span",{title:a.taskbar.offscreenHint,className:"mt-1 inline-flex items-center gap-1 rounded bg-amber-500 px-2 py-0.5 text-2xs font-semibold text-white shadow-sm",children:[
|
|
26
|
+
/* @__PURE__ */Z(z,{name:"arrow-right",className:"h-3 w-3",style:{transform:`rotate(${o}deg)`},strokeWidth:3}),"Off screen"]})]},e.id)})}),document.body)}function wt(e,t){const n=getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom";return"top"===n?{left:Math.min(e,window.innerWidth-220),top:t+4}:"left"===n?{left:e+4,top:Math.min(t,window.innerHeight-160)}:"right"===n?{right:window.innerWidth-e+4,top:Math.min(t,window.innerHeight-160)}:{left:Math.min(e,window.innerWidth-220),bottom:window.innerHeight-t+4}}function yt({openWindows:e,onRemove:t,onSplitView:n,onActivate:r,onActivateById:o}){const i=I(),[a,s]=F(null);j(()=>{let e,t;const n=()=>{clearInterval(e),clearTimeout(t),e=void 0},r=()=>{const e=document.getElementById("taskbar-windows");return s(t=>t===e?t:e),!!e},o=()=>{n(),r()||(e=setInterval(()=>{r()&&n()},100),t=setTimeout(n,5e3))};return o(),window.addEventListener("react-os-shell:layout-mode-changed",o),()=>{n(),window.removeEventListener("react-os-shell:layout-mode-changed",o)}},[]);const l=q(Cr,Er),[,u]=F(0);j(()=>{const e=()=>u(e=>e+1);return window.addEventListener("modal-geometry",e),window.addEventListener("resize",e),()=>{window.removeEventListener("modal-geometry",e),window.removeEventListener("resize",e)}},[]);const[,d]=F(0);j(()=>{const e=()=>d(e=>e+1);return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[]);const h=e=>{const t=lt(e),n=t?.querySelector("[data-window-title]");return n?.textContent?.trim()||e},[m,p]=F(null),[f,w]=F(null),[y,g]=F(null),v=$(null),C=()=>{v.current&&(clearTimeout(v.current),v.current=null),v.current=setTimeout(()=>{p(null),w(null)},150)},M=e.filter(e=>!e.route||!ce[e.route]?.utility);if(!a||!a.isConnected||0===M.length)return null;const N=[],S=/* @__PURE__ */new Map;for(const e of M){const t=e.route?ce[e.route]:void 0,n=t?.taskbarGroup,r=n?.key??e.route??`entity:${e.id}`,o=S.get(r);if(void 0!==o)N[o].items.push(e);else{S.set(r,N.length);const o=n?.label??t?.label??e.label;N.push({key:r,route:n?.icon??e.route,label:o,items:[e]})}}return te(
|
|
27
|
+
/* @__PURE__ */Q(ee,{children:[N.map(e=>{const n=e.route?c[e.route]:null,r=e.items[e.items.length-1];let a=!1;if(l){const t=document.querySelector(`[data-modal-id="${l}"]`);if(t){const n=t.querySelector("[data-window-title]"),r=n?.textContent??"";a=e.items.some(e=>r.includes(e.label))}}const s=e.items.length>1,u=e.items.some(e=>{const t=nt(e.id)??lt(e.label);return!!t&&!cr(t)});/* @__PURE__ */
|
|
28
|
+
return Q("button",{onClick:()=>o(r.id),onMouseEnter:t=>{return n=e.items,r=t.currentTarget,void(y||(v.current&&(clearTimeout(v.current),v.current=null),v.current=setTimeout(()=>{p(n),w(r)},350)));var n,r},onMouseLeave:C,onDoubleClick:e=>{e.stopPropagation(),window.dispatchEvent(new CustomEvent("modal-center",{detail:{windowKey:r.id,label:r.label}}))},onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),v.current&&(clearTimeout(v.current),v.current=null),p(null),w(null),s?g({x:t.clientX,y:t.clientY,items:e.items,label:e.label}):window.dispatchEvent(new CustomEvent("modal-context-menu",{detail:{windowKey:r.id,label:r.label,x:t.clientX,y:t.clientY}}))},style:{width:"var(--window-tab-width, 200px)",fontSize:"var(--window-tab-font-size, 12px)"},"data-tab-group":e.key,className:"group relative flex items-center gap-2 rounded-lg px-3 py-2 font-medium transition-all min-w-0 shrink "+(a?"bg-blue-100/60 border border-blue-400/60 text-blue-700":"bg-gray-50/40 border border-gray-200/40 text-gray-700 hover:bg-gray-200/40"),children:[n&&H(n)?X(n,{className:"h-3.5 w-3.5 shrink-0"}):/* @__PURE__ */Z(z,{name:"expand",className:"h-3.5 w-3.5 shrink-0",strokeWidth:2}),
|
|
29
|
+
/* @__PURE__ */Z("span",{className:"truncate flex-1",children:s?e.label:h(r.label)}),u&&/* @__PURE__ */Z("span",{title:i.taskbar.offscreenDot,className:"shrink-0 h-1.5 w-1.5 rounded-full bg-amber-500"}),s&&/* @__PURE__ */Z("span",{className:"shrink-0 px-2 py-0.5 rounded-full bg-blue-500/80 text-white text-2xs font-bold leading-none",children:e.items.length}),!s&&/* @__PURE__ */Z("span",{role:"button",onClick:e=>{e.stopPropagation(),t(r.id)},className:"ml-auto text-gray-400 hover:text-red-500 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",children:/* @__PURE__ */Z(z,{name:"close",className:"h-3 w-3",strokeWidth:2})})]},e.key)}),
|
|
30
|
+
/* @__PURE__ */Z("div",{className:"flex-1"}),M.length>=2&&/* @__PURE__ */Q("button",{onClick:n,title:i.taskbar.expose,className:"flex items-center gap-1 rounded px-2 py-1 text-2xs font-medium text-blue-600 border border-blue-300 hover:bg-blue-50 transition-colors shrink-0",children:[
|
|
31
|
+
/* @__PURE__ */Z(z,{name:"grid",className:"h-3 w-3",strokeWidth:2}),"Exposé"]}),y&&/* @__PURE__ */Q(b,{portal:!0,minWidth:200,style:wt(y.x,y.y),onClose:()=>g(null),children:[
|
|
32
|
+
/* @__PURE__ */Z(E,{children:y.label}),
|
|
33
|
+
/* @__PURE__ */Q(x,{onClick:()=>{g(null),y.items.forEach(e=>function(e){const t=Wn.get(e);t&&Zn(t)}(e.id))},children:[
|
|
34
|
+
/* @__PURE__ */Z(z,{name:"remove",className:"h-4 w-4",strokeWidth:1.5}),i.taskbar.minimizeAllWindows]}),
|
|
35
|
+
/* @__PURE__ */Q(x,{onClick:()=>{g(null),y.items.forEach(e=>o(e.id))},children:[
|
|
36
|
+
/* @__PURE__ */Z("svg",{className:"h-4 w-4 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */Z("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 3.75h6.5v6.5h-6.5zM13.75 8.75h6.5v6.5h-6.5z"})}),i.taskbar.restoreAllWindows]}),
|
|
37
|
+
/* @__PURE__ */Z(k,{}),
|
|
38
|
+
/* @__PURE__ */Q(x,{danger:!0,onClick:()=>{g(null),y.items.forEach(e=>t(e.id))},children:[
|
|
39
|
+
/* @__PURE__ */Z(z,{name:"close",className:"h-4 w-4",strokeWidth:2}),`${i.taskbar.closeAllWindows} (${y.items.length})`]})]}),m&&f&&/* @__PURE__ */Z(ft,{items:m,anchorEl:f,onActivate:e=>{o(e),p(null),w(null)},onClose:e=>{t(e),p(null),w(null)},onMouseEnter:()=>{v.current&&(clearTimeout(v.current),v.current=null)},onMouseLeave:C})]}),a)}var gt=["/login","/forgot-password","/reset-password","/force-change-password"];function vt({children:e,windowAccentForRoute:t}){const n=ne(),r=gt.some(e=>n.pathname.startsWith(e)),[o,i]=F([]),a=$(o);O(()=>{a.current=o},[o]);const s=q(xe,be,be),l=$(/* @__PURE__ */new Map),c=e=>{const t=Pe(e),n=!!s&&"page"===e.type&&e.route===s,r=e.pageSearch||void 0,o=l.current.get(e.id);if(o&&o.tab===t&&o.home===n&&o.pageSearch===r)return o;const i={key:e.id,tab:t,home:n,...r?{pageSearch:r}:{}};return l.current.set(e.id,i),i};j(()=>{at.clear();for(const e of o)e.route&&at.set(e.id,e.route)},[o]);const u=B(e=>{i(t=>t.filter(t=>t.id!==e))},[]),d=B(e=>{var t;nt(e)||rt(e)?(t=e,window.dispatchEvent(new CustomEvent(Mr,{detail:{windowKey:t}}))):u(e)},[u]),h=(e,t=!1)=>{const n=An;t&&Ze.add(e),setTimeout(()=>{const r=document.querySelector(`[data-modal-panel][data-window-key="${e}"]`),o=r?.getAttribute("data-modal-id");var i,a;!o||(i=o,a=n,(Dn.get(i)??-1)>a)||Qn(o),t&&Ze.delete(e)},50)},m=(e,t,n)=>{const r=ke;if(n||!r)return[...e,t];const o=function(e,t,n){if(!Pe(t))return e.length;if(t.shellOwned&&Ke(t,n.home))return 0;const r=Ke(t,n.home)?void 0:Ie(t)?.key;if(r){let t=-1;if(e.forEach((e,o)=>{Pe(e)&&!Ke(e,n.home)&&Ie(e)?.key===r&&(t=o)}),t>=0)return t+1}if("page"===t.type&&t.route&&!Ke(t,n.home)&&n.favorites.includes(t.route))return e.length>0&&Ke(e[0],n.home)?1:0;const o=t.openedFrom?e.findIndex(e=>e.id===t.openedFrom):-1;if(o>=0){const t=/* @__PURE__ */new Set([e[o].id]);let r=o+1;for(;r<e.length&&e[r].openedFrom&&t.has(e[r].openedFrom);)t.add(e[r].id),r++;const i=t=>Pe(e[t])&&!Ke(e[t],n.home)?Ie(e[t])?.key:void 0;for(;r>0&&r<e.length&&void 0!==i(r)&&i(r)===i(r-1);)r++;return r}return e.length}(e,t,{home:be(),favorites:r.favorites});return[...e.slice(0,o),t,...e.slice(o)]},p=B(e=>{i(t=>function(e,t){const n=new Set(t),r=new Map(e.map(e=>[e.id,e])),o=t.map(e=>r.get(e)).filter(e=>!!e);if(o.length!==n.size)return e;let i=0;const a=e.map(e=>n.has(e.id)?o[i++]:e);return a.every((t,n)=>t===e[n])?e:a}(t,e))},[]),f=B((e,t,n,r,o,a={})=>{if(!ce[e]||!ae(ce[e]))return;const s=`${e}:${t}`,l=it();i(i=>{const c=i.find(n=>n.entityType===e&&String(n.entityId)===String(t));return c?(h(c.id),i):(h(s,!0),m(i,{id:s,type:"modal",label:r||t,route:o||window.location.pathname,entityType:e,entityId:t,entitySnapshot:$e(n),openedFrom:l},!!a.append))})},[]),w=B((e,t={})=>{if(!ce[e]||!ie(ce[e]))return;const n=ce[e],{reuse:r=!1,background:o=!1,shellOwned:s,search:l,append:c=!1}=t,u=e=>{var t;o?(t=e,Fn.add(t)):h(e)};if(n.widget){const t=a.current.find(t=>"page"===t.type&&t.route===e);if(t)return void d(t.id)}const p=it();i(t=>{if(n.multiInstance){const i=t.filter(t=>"page"===t.type&&t.route===e);if(r&&!l&&i.length>0)return o||h(i[i.length-1].id),t;const a=`page:${e}:${Math.random().toString(36).slice(2,8)}`;return u(a),m(t,{id:a,type:"page",label:n.label,route:e,openedFrom:p,...s?{shellOwned:s}:{},...l?{pageSearch:l}:{}},c)}const i=t.find(t=>"page"===t.type&&t.route===e);if(i)return n.widget?t:(o||h(i.id),l&&i.pageSearch!==l?t.map(e=>e===i?{...e,pageSearch:l}:e):t);const a=`page:${e}`;return u(a),m(t,{id:a,type:"page",label:n.label,route:e,openedFrom:p,...s?{shellOwned:s}:{},...l?{pageSearch:l}:{}},c)})},[d]),y=B(()=>{},[]),g=B(()=>{},[]),v=d,b=d;/* @__PURE__ */
|
|
40
|
+
return Q(Ue.Provider,{value:{openWindows:o,openEntity:f,openPage:w,reorderWindows:p,closeEntity:v,minimize:y,items:[],openItems:o,restore:g,remove:b,restoreIfMinimized:()=>!1},children:[e,
|
|
41
|
+
/* @__PURE__ */Z(yt,{openWindows:o,onRemove:d,onSplitView:Ur,onActivate:e=>{document.querySelectorAll("[data-modal-panel]").forEach(t=>{const n=t.querySelector("[data-window-title]");if(n?.textContent?.includes(e)){const e=t.getAttribute("data-modal-id");e&&Qn(e)}})},onActivateById:ot}),
|
|
42
|
+
/* @__PURE__ */Z(Yr,{}),!r&&o.map(e=>{const n=e.route?t?.(e.route):void 0;
|
|
43
|
+
/* @__PURE__ */
|
|
44
|
+
return Z(fe.Provider,{value:c(e),children:/* @__PURE__ */Z(Me,{fallback:(t,n)=>/* @__PURE__ */Z(Xr,{open:!0,onClose:()=>u(e.id),title:e.label,size:"md",autoHeight:!0,windowKey:e.id,children:/* @__PURE__ */Z(Ce,{error:t,onReload:n})}),children:/* @__PURE__ */Z(_t,{spec:Ge(e),children:/* @__PURE__ */Z(eo,{windowId:e.id,children:"page"===e.type?/* @__PURE__ */Z(Je,{item:e,onClose:()=>u(e.id),accentRgb:n}):/* @__PURE__ */Z(tt,{item:e,onClose:()=>u(e.id),onMinimize:()=>{},accentRgb:n})})})})},e.id)})]})}var bt=400;function xt({panelRef:e,bodyRef:t,open:n,widget:r,active:o,minimized:i}){const a=$(null),s=$(!1);n&&!s.current&&(a.current="undefined"==typeof document?null:document.activeElement),s.current=n;const l=$(!1),c=$(void 0),u=$(i),d=u.current&&!i;u.current=i;const h=()=>{l.current=!0,clearTimeout(c.current),c.current=setTimeout(()=>{l.current=!1},bt)};j(()=>{n&&!r&&h()},[n,r]),j(()=>{d&&n&&!r&&h()},[d]),j(()=>()=>clearTimeout(c.current),[]),j(()=>{if(!n||r||!o||i||!l.current)return;l.current=!1;const a=e.current;if(!a||a.contains(document.activeElement))return;const s=t.current?L(t.current)[0]:void 0;s?s.focus():(a.hasAttribute("tabindex")||a.setAttribute("tabindex","-1"),a.focus())},[n,r,o,i,e,t]),O(()=>{if(!n||r)return;const t=e.current;return()=>{const e=a.current,n=document.activeElement;(!n||n===document.body||!!t?.contains(n))&&e&&e.isConnected&&!t?.contains(e)&&e.focus?.()}},[n,r,e])}var kt=null,Et=/* @__PURE__ */new Set;function Ct(){return kt}function Mt(e){if(kt!==e){kt=e;for(const e of Et)e()}}function Nt(e){return Et.add(e),()=>{Et.delete(e)}}var St=!1,Lt={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},Tt=()=>{};function zt(e){St=e,Lt={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0}}function At(e,t){St&&("submenu"===e?Lt.submenus++:Lt.menus++,Lt.menuKey=t)}function Dt(e){if(!St)return Tt;const t=performance.now();let n=!1;return()=>{if(n)return;if(n=!0,!St)return;const r=performance.now()-t;"move"===e?Lt.moveMs+=r:Lt.resizeMs+=r}}function Pt(){const e=Lt;return Lt={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},e}var It=/* @__PURE__ */new Set([S,C]),Kt=e=>It.has(e)||"function"==typeof e&&"badge"===e.titleRole,Wt=/* @__PURE__ */new Set(["button","a","input","select","textarea","kbd"]),Rt=/* @__PURE__ */new Set(["svg"]);function Ot(e){const t=[],n={text:"",accessories:[],badges:[],actions:[]};return $t(e,n,t),n.text=t.join("").replace(/\s+/g," ").trim(),n}function $t(e,t,n){if(null==e||"boolean"==typeof e)return;if("string"==typeof e||"number"==typeof e)return void n.push(String(e));if(Array.isArray(e))return void e.forEach(e=>$t(e,t,n));if(!H(e))return;const r=e;if(r.type===w)return void(void 0===t.copy&&"string"==typeof r.props.text&&r.props.text&&(t.copy=r.props.text));if(r.type===U)return void Y.toArray(r.props.children).forEach(e=>$t(e,t,n));if("string"==typeof r.type){if(Rt.has(r.type))return;if(!Wt.has(r.type))return n.push(" "),Y.toArray(r.props.children).forEach(e=>$t(e,t,n)),void n.push(" ")}const o=X(r,{key:`title-part-${t.accessories.length}`});t.accessories.push(o),(Kt(r.type)?t.badges:t.actions).push(o)}var jt=/* @__PURE__ */new Map,Ft=/* @__PURE__ */new Set,qt=0;function Bt(){qt++,Ft.forEach(e=>e())}function Ht(e){return jt.get(e)}function Ut(e){return Ft.add(e),()=>{Ft.delete(e)}}function Yt(){return qt}var Xt=K(""),Vt=K(null);function _t({spec:e,children:t}){/* @__PURE__ */
|
|
45
|
+
return Z(Vt.Provider,{value:e,children:t})}var Gt=/* @__PURE__ */new Set(["button","input","textarea","select","kbd","svg"]),Jt='button[type="submit"], button[data-submit], button.btn-submit, button.bg-green-600, button.bg-blue-600',Qt='button, a[href], summary, [role="button"], [role="link"], [role="menuitem"], select';function Zt(e){return en(e).replace(/\s+/g," ").trim()}function en(e){if(null==e||"boolean"==typeof e)return"";if("string"==typeof e)return e;if("number"==typeof e)return String(e);if(Array.isArray(e))return e.map(en).join("");if(H(e)){const t=e,n="string"==typeof t.type?t.type:"";return Gt.has(n)?"":` ${en(t.props?.children)} `}return""}function tn(e){const t=W(Xt);j(()=>{if(!t)return;const n=n=>{n.detail===t&&e()};return window.addEventListener("widget-open-settings",n),()=>window.removeEventListener("widget-open-settings",n)},[e,t])}var nn={};function rn(e,t,n){const r=W(Xt);j(()=>{if(!r)return;nn[r]||(nn[r]=[]);const o={label:e,icon:n,onClick:t};return nn[r].push(o),()=>{nn[r]=(nn[r]||[]).filter(e=>e!==o)}},[r,e,t,n])}function on({title:e}){const t=$(null);return j(()=>{const n=setTimeout(()=>{const n=t.current?.closest("[data-modal-id]"),r=n?.getAttribute("data-modal-id");r&&window.dispatchEvent(new CustomEvent("window-title-update",{detail:{id:r,title:e}}))},0);return()=>clearTimeout(n)},[e]),/* @__PURE__ */Z("span",{ref:t,style:{display:"none"},"aria-hidden":"true"})}function an(e){}var sn=K(null);function ln(){return W(Xt)}function cn(){const e=q(Cr,Er),t=W(sn);return t?.active??(Ln.length<=1||null!=e)}function un({children:e,position:t="right",quiet:n=!1}){const r=W(sn),[o,i]=F(null);return j(()=>{if(!r)return;const e="left"===t?r.leftRef:r.rightRef,o=()=>!!e.current&&(i(e.current),n||r.notify(),!0);if(o())return;const a=setInterval(()=>{o()&&clearInterval(a)},50),s=setTimeout(()=>clearInterval(a),2e3);return()=>{clearInterval(a),clearTimeout(s)}},[r,t,n]),o?te(e,o):null}function dn({onClick:e,children:t,className:n}){const r=W(sn);/* @__PURE__ */
|
|
46
|
+
return Z("button",{type:"button",onClick:async()=>{if(r?.isDirty){const{confirm:e}=await(import("./shell/ConfirmDialog.js"));if(!await e({title:"Discard changes?",message:"You have unsaved changes. Are you sure you want to cancel? All changes will be lost.",confirmLabel:"Discard",cancelLabel:"Keep Editing",variant:"warning"}))return}e()},className:n||"bg-white text-gray-700 border border-gray-300 px-4 py-2 text-sm font-medium rounded-lg hover:bg-gray-50",children:t||"Cancel"})}var hn="erp_window_positions",mn={};try{const e=localStorage.getItem(hn);e&&(mn=JSON.parse(e))}catch{}var pn=null;function fn(){pn&&clearTimeout(pn),pn=setTimeout(()=>{try{localStorage.setItem(hn,JSON.stringify(mn))}catch{}},500)}var wn="erp_activation_order",yn=[];try{const e=localStorage.getItem(wn),t=e?JSON.parse(e):null;Array.isArray(t)&&t.every(e=>"string"==typeof e)&&(yn=t)}catch{}var gn=null;function vn(){gn&&clearTimeout(gn),gn=setTimeout(()=>{try{localStorage.setItem(wn,JSON.stringify(yn))}catch{}},500)}function bn(e,t){mn[e]||(mn[e]=t,fn())}function xn(e){return mn[e]?{...mn[e]}:null}function kn(e,t){mn[e]=t,fn()}function En(){const r=e(),o=t();let i=!1;for(const e of Object.keys(mn))n(mn[e],r,o)&&(delete mn[e],i=!0);i&&fn()}var Cn={sm:384,md:512,lg:672,xl:896,"2xl":1152,"3xl":1408},Mn=4e3,Nn=()=>{if("undefined"==typeof document)return"large";const e=getComputedStyle(document.documentElement).getPropertyValue("--default-window-size")?.trim();return"small"===e||"medium"===e||"maximized"===e?e:"large"},Sn={small:.8,medium:1,large:1.25,maximized:1.25},Ln=[],Tn=/* @__PURE__ */new Set,zn=/* @__PURE__ */new Set,An=0,Dn=/* @__PURE__ */new Map;var Pn=0;function In(){return Pn}function Kn(){Pn++,Tn.forEach(e=>e())}var Wn=/* @__PURE__ */new Map,Rn=/* @__PURE__ */new Map,On=/* @__PURE__ */new Map;function $n(){for(let e=Ln.length-1;e>=0;e--){const t=On.get(Ln[e]);if(t?.tab)return t.owner}return null}function jn(){return q(Cr,$n,()=>null)}var Fn=/* @__PURE__ */new Set;var qn=null;function Bn(e){qn=null,Qn(e)}function Hn(e){qn=e;const t=Wn.get(e);t&&Bn(t)}var Un=/* @__PURE__ */new Map;function Yn(e){return Un.get(e)?.holdsChanges()??!1}function Xn(e){const t=Un.get(e);return t?t.ask():Promise.resolve(!0)}function Vn(e){qn===e&&(qn=null)}function _n(e,t,n){if(n&&On.set(e,n),t)if(Wn.set(t,e),Rn.set(e,t),Fn.delete(t)){Ln.unshift(e);const n=yn.indexOf(t);-1!==n&&yn.splice(n,1),yn.unshift(t),vn()}else!function(e,t){const n=yn.indexOf(t);if(-1===n)return void Ln.push(e);let r=Ln.length;for(let e=0;e<Ln.length;e++){const t=Rn.get(Ln[e]);if(t&&yn.indexOf(t)>n){r=e;break}}Ln.splice(r,0,e)}(e,t),-1===yn.indexOf(t)&&(yn.push(t),vn());else Ln.push(e);Kn(),window.dispatchEvent(new CustomEvent("modal-reorder")),t&&qn===t&&Bn(e)}function Gn(e){return e?On.get(e)?.owner??Rn.get(e)??null:null}var Jn=/* @__PURE__ */new Set;function Qn(e){const t=Gn(Er()),n=Ln.indexOf(e);-1!==n&&Ln.splice(n,1),Ln.push(e);const o=On.get(e);if(o?.root&&o.tab&&r()){const e=Ln.filter(e=>{const t=On.get(e);return!!t&&!t.root&&t.owner===o.owner});for(const t of e)Ln.splice(Ln.indexOf(t),1),Ln.push(t)}zn.delete(e);const i=Rn.get(e);if(i){const e=yn.indexOf(i);-1!==e&&yn.splice(e,1),yn.push(i),vn(),qn&&qn!==i&&(qn=null)}Kn(),window.dispatchEvent(new CustomEvent("modal-reorder"));const a=Gn(Er());a&&a!==t&&Jn.forEach(e=>e(a))}function Zn(e){const t=Ln.indexOf(e);-1!==t&&Ln.splice(t,1),zn.add(e),Dn.set(e,++An);const n=Rn.get(e);if(n){const e=yn.indexOf(n);-1!==e&&(yn.splice(e,1),vn())}Kn(),window.dispatchEvent(new CustomEvent("modal-reorder"))}var er=/* @__PURE__ */new Set;var tr=8,nr=32;function rr(){return e()}var or=u.windowBar,ir=80,ar=384,sr=400;function lr(e,t=rr()){const n=Math.min(Math.max(e.x,t.x+ir-e.w),t.x+t.w-ir),r=Math.min(Math.max(e.y,t.y),t.y+t.h-or);return n===e.x&&r===e.y?e:{...e,x:n,y:r}}function cr(e){const t=e.getBoundingClientRect();if(0===t.width||0===t.height)return!0;const n=rr();return t.left>=n.x-1&&t.top>=n.y-1&&t.right<=n.x+n.w+1&&t.bottom<=n.y+n.h+1}function ur(e){const t=rr(),n=Math.floor(t.w/2),r=Math.floor(t.h/2);switch(e){case"top":return{x:t.x,y:t.y,w:t.w,h:t.h};case"left":return{x:t.x,y:t.y,w:n,h:t.h};case"right":return{x:t.x+n,y:t.y,w:t.w-n,h:t.h};case"tl":return{x:t.x,y:t.y,w:n,h:r};case"tr":return{x:t.x+n,y:t.y,w:t.w-n,h:r};case"bl":return{x:t.x,y:t.y+r,w:n,h:t.h-r};case"br":return{x:t.x+n,y:t.y+r,w:t.w-n,h:t.h-r}}}var dr=null;function hr(e){const t=(dr||((dr=document.createElement("div")).style.cssText=["position: fixed","pointer-events: none",`z-index: ${D.snapPreview}`,"border-radius: 8px","background: rgba(59, 130, 246, 0.18)","border: 2px solid rgb(59, 130, 246)","transition: left 120ms ease, top 120ms ease, width 120ms ease, height 120ms ease, opacity 120ms ease","opacity: 0","display: none"].join(";"),document.body.appendChild(dr)),dr);t.style.display="block",t.style.left=`${e.x}px`,t.style.top=`${e.y}px`,t.style.width=`${e.w}px`,t.style.height=`${e.h}px`,t.style.opacity="1"}function mr(){dr&&(dr.style.opacity="0",dr.style.display="none")}var pr=[{zone:"left",labelKey:"snapLeft",region:"inset-y-0 left-0 w-1/2"},{zone:"right",labelKey:"snapRight",region:"inset-y-0 right-0 w-1/2"},{zone:"tl",labelKey:"snapTopLeft",region:"top-0 left-0 h-1/2 w-1/2"},{zone:"tr",labelKey:"snapTopRight",region:"top-0 right-0 h-1/2 w-1/2"},{zone:"bl",labelKey:"snapBottomLeft",region:"bottom-0 left-0 h-1/2 w-1/2"},{zone:"br",labelKey:"snapBottomRight",region:"bottom-0 right-0 h-1/2 w-1/2"}],fr=350,wr=200;function yr({maximized:e,onToggleMax:t,onSnap:n,buttonClassName:r,strings:o}){const[i,a]=F(!1),s=$(void 0),l=$(void 0);j(()=>()=>{clearTimeout(s.current),clearTimeout(l.current)},[]);const c=()=>{clearTimeout(l.current),s.current=setTimeout(()=>a(!0),fr)},u=()=>{clearTimeout(s.current),l.current=setTimeout(()=>a(!1),wr)};/* @__PURE__ */
|
|
47
|
+
return Q("span",{className:"relative inline-flex",onMouseEnter:c,onMouseLeave:u,children:[
|
|
48
|
+
/* @__PURE__ */Z("button",{onClick:t,onFocus:c,onBlur:u,title:e?o.windowed:o.maximize,className:r,children:e?"❐":"⤢"}),i&&/* @__PURE__ */Z("div",{role:"group","aria-label":o.snapLayouts,onMouseEnter:()=>clearTimeout(l.current),onMouseLeave:u,className:"absolute right-0 top-full z-30 mt-1 grid w-max grid-cols-2 gap-1 rounded-lg border border-gray-200 bg-white p-2 shadow-lg",children:pr.map(({zone:e,labelKey:t,region:r})=>/* @__PURE__ */Z("button",{type:"button","aria-label":o[t],title:o[t],onClick:()=>{a(!1),n(e)},onFocus:()=>clearTimeout(l.current),onBlur:u,className:"relative h-7 w-11 rounded border border-gray-300 bg-gray-50 hover:border-blue-400 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-400",children:/* @__PURE__ */Z("span",{"aria-hidden":"true",className:`absolute rounded-sm bg-blue-500/70 ${r}`,style:{margin:2}})},e))})]})}var gr="rosh-gesture-style";var vr={se:"nwse-resize",nw:"nwse-resize",sw:"nesw-resize",ne:"nesw-resize",n:"ns-resize",s:"ns-resize",e:"ew-resize",w:"ew-resize"},br=4;function xr(e,t,n,r){!function(){if("undefined"==typeof document||document.getElementById(gr))return;const e=document.createElement("style");e.id=gr,e.textContent="body.rosh-gesturing [data-modal-panel]{will-change:transform}",document.head.appendChild(e)}();try{e.setPointerCapture(t)}catch{}document.body.classList.add("rosh-gesturing");const o=document.createElement("div");o.setAttribute("data-drag-shield",""),o.style.cssText=`position:fixed;inset:0;z-index:2147483647;cursor:${n};background:transparent;touch-action:none`,document.body.appendChild(o);const i=Dt(r);let a=!1;return()=>{if(!a){a=!0,i();try{e.releasePointerCapture(t)}catch{}o.remove(),document.body.classList.remove("rosh-gesturing")}}}function kr(e){const t=Ln.indexOf(e);if(-1===t)return-1;const n=D.window+t*D.windowStep,o=On.get(e);if(!o||o.root||!o.tab||!r())return n;let i=-1;for(const[e,t]of On){if(!t.root||t.owner!==o.owner)continue;const n=Ln.indexOf(e);-1!==n&&(i=Math.max(i,D.window+n*D.windowStep))}return i>=n?i+2+Math.min(t,7):n}function Er(){return Ln[Ln.length-1]||null}function Cr(e){return Tn.add(e),()=>{Tn.delete(e)}}"undefined"!=typeof window&&window.addEventListener("deactivate-all-modals",function(){for(let e=Ln.length-1;e>=0;e--)er.has(Ln[e])||Ln.splice(e,1);yn=yn.filter(e=>{const t=Wn.get(e);return null!=t&&er.has(t)}),vn(),Kn(),window.dispatchEvent(new CustomEvent("modal-reorder"))});var Mr="modal-close-request";function Nr(e){q(Cr,In);const t=W(sn);if(Ln.length<=1)return!0;if(e){const t=Wn.get(e);if(null!=t)return Er()===t}return t?.active??null!=Er()}var Sr=!1,Lr=/* @__PURE__ */new Set;function Tr(e){return Lr.add(e),()=>Lr.delete(e)}function zr(){return Sr}function Ar(e){Sr!==e&&(Sr=e,Lr.forEach(e=>e()))}function Dr(){Ar(!Sr)}function Pr(){Ar(!1)}var Ir=null,Kr=/* @__PURE__ */new Set;function Wr(e){return Kr.add(e),()=>Kr.delete(e)}function Rr(){return Ir}function Or(e){Ir!==e&&(Ir=e,Kr.forEach(e=>e()))}var $r=null,jr=/* @__PURE__ */new Set;function Fr(e){return jr.add(e),()=>jr.delete(e)}function qr(){return $r}function Br(e){$r!==e&&($r=e,jr.forEach(e=>e()))}function Hr(){if(!$r)return void Ar(!1);Or($r),Br(null),Ar(!1)}function Ur(){Ar(!Sr),window.dispatchEvent(new CustomEvent("modal-split-view"))}function Yr(){const e=q(Tr,zr),[t,n]=F(e),[r,o]=F(e);return j(()=>{if(e){n(!0);const e=requestAnimationFrame(()=>o(!0));return()=>cancelAnimationFrame(e)}o(!1);const t=setTimeout(()=>n(!1),280);return()=>clearTimeout(t)},[e]),t&&"undefined"!=typeof document?te(
|
|
49
|
+
/* @__PURE__ */Z("div",{onMouseDown:e=>{e.stopPropagation(),Ar(!1)},style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.55)",backdropFilter:"blur(2px)",WebkitBackdropFilter:"blur(2px)",zIndex:D.expose,cursor:"pointer",opacity:r?1:0,transition:"opacity 260ms cubic-bezier(0.2, 0.8, 0.2, 1)",pointerEvents:r?"auto":"none"}}),document.body):null}function Xr({open:t,onClose:i,title:c,icon:u,copyText:d,size:h="lg",dirty:m=!1,onNext:p,onPrev:f,footer:w,bodyScroll:E,onMinimize:C,initialBox:S,actions:L,actionsLeft:A,editing:K=!1,edit:R,allowPinOnTop:U,initialPosition:Y,widget:G,compact:J,appStyle:ne,flushBody:re,autoHeight:oe,autoMinHeight:ie,autoWidth:ae,widgetMenu:se,dimensions:le,windowKey:ce,openedFromKey:ue,accentRgb:de,children:he}){const[me,pe]=F(()=>r()),we=M()&&!me,ye=N()&&!!G,[ge,ve]=F(0),[be,xe]=F(!1),ke=$(null),Ee=$(0);j(()=>{Ee.current=ge},[ge]);const Ce=B(e=>{we&&(ke.current={startX:e.clientX,startY:e.clientY,pointerId:e.pointerId},xe(!0),Mt(ue??null))},[we,ue]),Se=q(Nt,Ct);j(()=>{if(!be)return;const e=e=>{if(!ke.current)return;const t=e.clientX-ke.current.startX;if(Math.abs(e.clientY-ke.current.startY)>Math.abs(t)+12)return ke.current=null,xe(!1),ve(0),void Mt(null);ve(Math.max(0,t))},t=()=>{if(!ke.current)return;const e=.3*window.innerWidth,t=Ee.current>e;ke.current=null,xe(!1),t?(ve(window.innerWidth),setTimeout(()=>{i(),ve(0),Mt(null)},180)):(ve(0),Mt(null))};return window.addEventListener("pointermove",e),window.addEventListener("pointerup",t),window.addEventListener("pointercancel",t),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",t),window.removeEventListener("pointercancel",t)}},[be]);const[Te,ze]=F(c),Ae=I(),De=Ae.window;j(()=>{ze(c)},[c]);const Pe=V(()=>Zt(Te).trim()||void 0,[Te]),Ie=_(),[Ke,We]=F(!1),Re=$(!1),[Oe,$e]=F(!1),[je,Fe]=F(null),qe=W(Vt),Be=W(fe),{prefs:He,save:Ue}=g(),Ye=!!He.window_accent_stripe,Ve=He.favorite_documents||[],Ge=!!qe&&Ve.some(e=>e.entityType===qe.entityType&&e.entityId===qe.entityId),Je=B(()=>{if(!qe)return;const e=Ge?Ve.filter(e=>!(e.entityType===qe.entityType&&e.entityId===qe.entityId)):[...Ve,{entityType:qe.entityType,entityId:qe.entityId,label:qe.label}];Ue({favorite_documents:e})},[qe,Ge,Ve,Ue]),[Qe,Ze]=F(null),[et,tt]=F("top-right"===Y?"right":"left"),nt=$(!1),rt=$(null);O(()=>{const e=rt.current;e&&(de?e.style.setProperty("--window-accent-rgb",de):e.style.removeProperty("--window-accent-rgb"))},[de]);const ot=$(!1),it=$(null),at=$(null),st=$(null),[lt,ct]=F(!1),ut=$(null),dt=$(null),ht=$(null),[mt,pt]=F(!1);O(()=>{const e=dt.current,t=ht.current;if(!e||!t)return;const n=()=>pt(function(e,t){return e.scrollWidth>t.clientWidth}(t,e));if(n(),"undefined"==typeof ResizeObserver)return;const r=new ResizeObserver(n);return r.observe(e),r.observe(t),()=>r.disconnect()},[null!=w&&!1!==w]);const ft=!!R&&!G&&!J&&!ne&&(R.editing||"hidden"!==R.state),wt=!!(w||L||A)||lt||ft,yt=W(Ne),gt=""!==W(Xt),vt=$(null);vt.current=Be?{owner:Be.key,tab:Be.tab,root:!gt}:null;const bt=ce||(Be&&!gt?Be.key:null),kt=!!yt&&!gt&&yt.enabled&&yt.hasState&&(K||yt.declaredEditable)&&!yt.handMounted&&wt&&!G&&!J&&!ne&&!we,Et=/* @__PURE__ */Z(z,{name:"window",className:"h-4 w-4",strokeWidth:1.5}),St=u&&H(u)?X(u,{className:`h-4 w-4 ${u.props?.className??""}`.trim()}):u??Et,Lt=()=>/* @__PURE__ */Z("button",{onPointerDown:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation();const t=e.currentTarget.getBoundingClientRect();Fe(e=>e?null:{x:t.left,y:t.bottom+4})},className:"shrink-0 p-0.5 rounded hover:bg-gray-200/50 transition-colors",title:"Window menu",children:St}),Tt=40,{minimize:zt,items:At,restoreIfMinimized:Dt,openWindows:Pt}=_e(),It=$(`modal-${Math.random().toString(36).slice(2,8)}`).current;j(()=>{if(G)return er.add(It),()=>{er.delete(It)}},[G,It]),j(()=>{const e=e=>{const t=e.detail;t?.id===It&&ze(t.title)};return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[It]);const[Kt,Wt]=F(D.window),Rt=function(e){const t=q(Cr,Er);return Ln.length<=1||t===e}(It),$t=$(R);$t.current=R;const Ft=!!R&&!R.editing&&"enabled"===R.state;j(()=>{if(!t||!Rt||!Ft)return;const e=e=>{("KeyE"===e.code||"E"===e.key||"e"===e.key)&&e.altKey&&e.shiftKey&&!e.metaKey&&!e.ctrlKey&&(e.preventDefault(),e.stopPropagation(),$t.current?.onEdit())};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,Rt,Ft]);const qt=function(e){return q(Cr,()=>zn.has(e))}(It);xt({panelRef:rt,bodyRef:it,open:t,widget:!!G,active:Rt,minimized:qt});const Ht=q(Tr,zr),Ut=q(Wr,Rr),Yt=q(Fr,qr),_t=!U&&!G,Gt=Ht&&_t,[en,tn]=F(!1),rn=Gt&&Yt===It,[on,an]=F(!1),ln=on&&_t&&Ut===It?"picked":null,cn=$(Gt);j(()=>{if(cn.current&&!Gt){an(!0);const e=setTimeout(()=>{an(!1),Ir===It&&Or(null)},700);return cn.current=Gt,()=>clearTimeout(e)}cn.current=Gt},[Gt,It]),j(()=>{Gt||tn(!1)},[Gt]),j(()=>{const e=at.current,t=st.current;if(!e&&!t)return;const n=e=>e?Array.from(e.children).filter(e=>"shell"!==e.dataset.undoControls).length:0,r=()=>ct(n(e)+n(t)>0);r();const o=new MutationObserver(r);return e&&o.observe(e,{childList:!0}),t&&o.observe(t,{childList:!0}),()=>o.disconnect()},[t]),j(()=>{const e=e=>{if(e.target.closest('button[type="submit"]')&&rt.current){const t=rt.current.querySelector("form");t&&(e.preventDefault(),t.requestSubmit())}},t=at.current,n=st.current;return t&&t.addEventListener("click",e),n&&n.addEventListener("click",e),()=>{t&&t.removeEventListener("click",e),n&&n.removeEventListener("click",e)}},[t]);const un=$(!1),dn=B(e,[]),hn=B(()=>{const t=e(),n=le?le[0]:Cn[h]||672,o=t.w-80,i=t.h-80,a=Math.min(n,o),s=Sn[Nn()],l=le?Math.min(le[1],i):(()=>{const e=("sm"===h?500:"md"===h?600:"lg"===h?700:"xl"===h?800:920)*s;return Math.max(320,Math.min(e,t.h-80))})(),c="cascade"!==(getComputedStyle(document.documentElement).getPropertyValue("--window-position")?.trim()||"cascade")||r()?0:30*(Ln.length-1),u=Math.max(Tt,(i-l)/2),d=(o-a)/2,m=t.h-Tt-l-u;return"top-right"===Y?{x:t.x+t.w-a-Tt,y:t.y+Tt,w:a,h:l}:"top-left"===Y?{x:t.x+Tt,y:t.y+Tt,w:a,h:l}:{x:t.x+Math.max(Tt,(o-a)/2+Tt)+Math.min(c,Math.max(0,d)),y:t.y+u+Math.min(c,Math.max(0,m)),w:a,h:l}},[h]),pn=$(!1);t||(pn.current=!1);const wn=ce||d||null;j(()=>{if(!t)return;_n(It,wn,vt.current??void 0),ce||Qn(It),un.current=!1,Wt(kr(It));const e=()=>{Wt(kr(It))},n=()=>{},r=e=>{if(!e)return!1;if(e.windowKey)return e.windowKey===ce;if(!e.label)return!1;const t=rt.current?.querySelector("[data-window-title]");return!!t?.textContent?.includes(e.label)},o=e=>{if(!r(e.detail))return;if(Qn(It),Pn.current)return;const t=rr(),n=Math.min(Hn.current.w,t.w-40),o=Math.min(Hn.current.h,t.h-40),i=t.x+(t.w-n)/2,a=t.y+(t.h-o)/2;vn({x:i,y:a,w:n,h:o}),Bn(!1)},i=e=>{const t=e.detail;r(t)&&(Qn(It),Fe({x:t.x,y:t.y}))},a=e=>{if(e.detail?.windowKey!==ce)return;Qn(It);const t=Hn.current,n=function(e,t=rr()){const n=Math.min(e.w,t.w),r=Math.min(e.h,t.h);return{w:n,h:r,x:Math.min(Math.max(e.x,t.x),t.x+t.w-n),y:Math.min(Math.max(e.y,t.y),t.y+t.h-r)}}(t);if(n.x===t.x&&n.y===t.y&&n.w===t.w&&n.h===t.h)return;const r=rt.current,o="function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(r&&!o){let e=!1;const t=()=>{e||(e=!0,r.style.transition="",window.dispatchEvent(new CustomEvent("modal-geometry")))};r.style.transition="left .28s ease, top .28s ease, width .28s ease, height .28s ease",r.addEventListener("transitionend",t,{once:!0}),window.setTimeout(t,400)}vn(n)};return window.addEventListener("modal-reorder",e),window.addEventListener("modal-split-view",n),window.addEventListener("modal-center",o),window.addEventListener("modal-reveal",a),window.addEventListener("modal-context-menu",i),()=>{!function(e){const t=Ln.indexOf(e);-1!==t&&(Ln.splice(t,1),Kn()),zn.delete(e),Dn.delete(e),On.delete(e);const n=Rn.get(e);n&&(Rn.delete(e),Wn.delete(n))}(It),window.removeEventListener("modal-reorder",e),window.removeEventListener("modal-split-view",n),window.removeEventListener("modal-center",o),window.removeEventListener("modal-reveal",a),window.removeEventListener("modal-context-menu",i),window.dispatchEvent(new CustomEvent("modal-reorder"))}},[t,It,wn,dn]);const yn=!G&&"maximized"===Nn(),[gn,vn]=F(()=>{if(wn&&mn[wn]){const e={...mn[wn]};return le&&(e.w=le[0],oe||(e.h=le[1])),lr(e)}return S?{x:S.x,y:S.y,w:S.w,h:S.h}:yn?dn():hn()}),[bn,xn]=F(()=>!oe),kn=$(me),En=$(null);j(()=>{const e=()=>{const e=r();e!==kn.current&&En.current?.(e),kn.current=e,pe(e),Wt(kr(It))};return window.addEventListener("react-os-shell:layout-mode-changed",e),()=>window.removeEventListener("react-os-shell:layout-mode-changed",e)},[It]);const Tn=me&&!!Be?.tab&&!gt&&!G&&!we,An=Tn,Pn=$(An);Pn.current=An;const In=jn(),$n=me&&!!Be?.tab&&!G&&!we&&!Ht&&In!==Be.key,Fn=!!G&&me&&!Ht&&null!==In,[qn,Bn]=F(()=>wn&&mn[wn]||S?An:An||yn),Hn=$(gn);Hn.current=gn;const Yn=$(qn);O(()=>{Yn.current=qn},[qn]),O(()=>{if(bn||Tn)return;const e=rt.current,t=it.current;if(!e||!t)return;const n=ie??(G?0:240),r=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0;let o=0,i=null,a=null;const s=()=>{const c=t.firstElementChild;if(!c||e.offsetHeight<=0)return;c!==a&&(a&&l.unobserve(a),l.observe(c),a=c);const u=e.offsetHeight-t.offsetHeight,d=t.style.flex,h=t.style.overflowY,m=t.style.height;t.style.flex="0 0 auto",t.style.height="auto",t.style.overflowY="visible";const p=t.offsetHeight,f=c.offsetHeight;t.style.flex=d,t.style.height=m,t.style.overflowY=h;const w=c.offsetHeight>f+4,y=Math.max(n,window.innerHeight-r-Math.max(0,Hn.current.y)-24),g=w?Math.min(Hn.current.h,y):Math.min(Math.max(n,u+p),y),v=Math.abs(g-o)>1;v&&(o=g,vn(e=>Math.abs(e.h-g)>1?{...e,h:g}:e)),G||(g<=n?i&&(clearTimeout(i),i=null):(v||null===i)&&(i&&clearTimeout(i),i=setTimeout(()=>{const e=o;s(),o===e&&xn(!0)},160)))},l=new ResizeObserver(s);s(),ut.current&&l.observe(ut.current);const c=new MutationObserver(s);return c.observe(t,{childList:!0,subtree:!0,characterData:!0}),()=>{l.disconnect(),c.disconnect(),i&&clearTimeout(i)}},[bn,G,ie,wt,Tn]),O(()=>{if(!oe||!bn||G||!t)return;const e=ut.current;if(!e)return;let n=e.offsetHeight;const r=new ResizeObserver(()=>{if(!e.isConnected)return;const t=e.offsetHeight,r=t-n,o=t>0!=n>0;if(n=t,!o||0===r||qn)return;if(document.body.classList.contains("rosh-gesturing"))return;const i=ie??240,a=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0,s=Math.max(i,window.innerHeight-a-Math.max(0,Hn.current.y)-24);vn(e=>({...e,h:Math.min(Math.max(i,e.h+r),s)}))});return r.observe(e),()=>r.disconnect()},[oe,bn,G,t,qn,ie]);const Xn=!1!==ae&&!G&&!ne&&!we,[Vn,Gn]=F(()=>!Xn);O(()=>{if(Vn||!t)return;if(!Xn||qn)return void Gn(!0);const n=rt.current,r=it.current;if(!n||!r)return;const o=/* @__PURE__ */new WeakSet;let i=Hn.current.w,c=0;const u=()=>Gn(!0),d=()=>{c=0;const t=Hn.current;if(Math.abs(t.w-i)>1||document.body.classList.contains("rosh-gesturing"))return void u();const d=e(),h=d.w-80;if(t.w>=h)return void u();const m=[],p=[];for(const e of[r,...Array.from(r.querySelectorAll("*"))]){const t=e.scrollWidth-e.clientWidth;if(t<=4||o.has(e))continue;const n=getComputedStyle(e).overflowX;"auto"!==n&&"scroll"!==n||(m.push(e),p.push(t))}if(!m.length)return;const f=Math.min(h,t.w+Math.max(...p)),w=f-t.w,y=n.style.width;n.style.width=`${f}px`;const g=m.map((e,t)=>({over:p[t],residual:e.scrollWidth-e.clientWidth}));n.style.width=y,g.forEach((e,t)=>{a(e,w)||o.add(m[t])});const v=s(t,l(t.w,w,g),d,Tt);v!==t&&(i=v.w,vn(v))};d();const h=new MutationObserver(()=>{c||(c=requestAnimationFrame(d))});h.observe(r,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["style","class","hidden"]});const m=setTimeout(u,Mn);return()=>{h.disconnect(),c&&cancelAnimationFrame(c),clearTimeout(m)}},[Vn,t,Xn,qn]);const Jn=$(null),or=!(!Be?.tab||gt||G||we);En.current=t=>{if(!or)return;if(t)return Jn.current||(Jn.current={box:{...Hn.current},maximized:Yn.current}),void(Yn.current=!0);const r=Jn.current;Jn.current=null;const o=e();if(r?.maximized)return Yn.current=!0,Bn(!0),void vn(o);const i=r?.box??(wn?mn[wn]:void 0);if(Yn.current=!1,Bn(!1),i&&!n(i,o,!1)){const e={...i};le&&(e.w=le[0],oe||(e.h=le[1])),vn(lr(e))}else vn(hn())},j(()=>{An&&(Yn.current=!0,Bn(!0),vn(dn()))},[An,dn]),j(()=>{if(G)return;const e=()=>{const e=wn?mn[wn]:void 0;if(Yn.current=!1,Bn(!1),e){const t={...e};le&&(t.w=le[0],oe||(t.h=le[1])),vn(lr(t))}else vn(hn())};return window.addEventListener("react-os-shell:restore-windowed",e),()=>window.removeEventListener("react-os-shell:restore-windowed",e)},[G,hn,wn]),j(()=>{t&&wn&&!Tn&&(mn[wn]=gn,fn()),t&&window.dispatchEvent(new CustomEvent("modal-geometry"))},[gn,t,wn,Tn]),j(()=>{if(!t)return;const e=()=>{Yn.current?vn(dn()):document.body.classList.contains("rosh-gesturing")||vn(lr)};window.addEventListener("resize",e),window.addEventListener(o,e);let n=null;return qn&&(n=new MutationObserver(e),n.observe(document.body,{childList:!0,subtree:!1,attributes:!0,attributeFilter:["class"]})),()=>{window.removeEventListener("resize",e),window.removeEventListener(o,e),n?.disconnect()}},[t,qn,dn]),j(()=>{if(t&&(We(!1),Re.current=!1,nt.current=!1,Gn(!Xn),!Pn.current)){if(wn&&mn[wn]){const e=mn[wn];return void vn(t=>lr({...e,...oe?{h:t.h}:{},...Xn?{x:t.x,w:t.w}:{}}))}S&&(vn({x:S.x,y:S.y,w:S.w,h:S.h}),Bn(S.maximized))}},[t]),j(()=>{if(!t||"auto"!==m)return;let e;const n=t=>{rt.current?.contains(t.target)&&!Re.current&&(Re.current=!0,e=setTimeout(()=>We(!0),0))};return document.addEventListener("input",n,!0),document.addEventListener("change",n,!0),()=>{clearTimeout(e),document.removeEventListener("input",n,!0),document.removeEventListener("change",n,!0)}},[t,m]);const ir="auto"===m?Ke:!0===m,cr=Be&&!gt?Be.key:null,dr=V(()=>Ot(Te),[Te]),pr=$({shortcutSpec:qe,isOnDesktop:Ge,toggleDesktopShortcut:Je,taskbarStrings:Ae.taskbar});O(()=>{pr.current={shortcutSpec:qe,isOnDesktop:Ge,toggleDesktopShortcut:Je,taskbarStrings:Ae.taskbar}});const fr=$(null);fr.current||(fr.current={open:(e,t)=>Fe({x:e,y:t}),items:()=>{const e=pr.current,t=[];e.shortcutSpec&&t.push({label:e.isOnDesktop?e.taskbarStrings.removeFromDesktop:e.taskbarStrings.addToDesktop,onSelect:e.toggleDesktopShortcut});for(const e of nn[It]||[])t.push({label:e.label,icon:e.icon,onSelect:e.onClick});return t}}),j(()=>{if(t&&cr)return()=>{return e=cr,void(jt.delete(e)&&Bt());var e}},[t,cr]),Xe(!(ce||!t)&&ir);const wr=B(()=>ir||"auto"===m&&Re.current,[ir,m]),gr=B(async e=>{if(nt.current)return!1;if(!wr())return!0;nt.current=!0;const t=Pe,n="close"===e?"Are you sure you want to close?":"discard"===e?"Are you sure you want to stop editing?":"Are you sure you want to continue?",r=await y({title:"Discard changes?",message:t?`“${t}” has unsaved changes. ${n} All changes will be lost.`:`You have unsaved changes. ${n} All changes will be lost.`,confirmLabel:"Discard",cancelLabel:"Keep Editing",variant:"warning"});return nt.current=!1,r},[wr,Pe]),Nr=B(()=>nt.current?Promise.resolve():wr()?gr("close").then(e=>{e&&i()}):(i(),Promise.resolve()),[wr,gr,i]),Sr=B(async()=>{await gr("discard")&&(Re.current=!1,We(!1),$t.current?.onDiscard())},[gr]),Lr=B(async()=>{const e=await gr("switch");return e&&(Re.current=!1,We(!1)),e},[gr]),Dr=$(()=>!1);O(()=>{Dr.current=wr}),O(()=>{if(!t||!ce)return;const e={holdsChanges:()=>Dr.current(),ask:Lr};return Un.set(ce,e),()=>{Un.get(ce)===e&&Un.delete(ce)}},[t,ce,Lr]),O(()=>{if(!t||!bt)return;const e=e=>{e.detail?.windowKey===bt&&Nr()};return window.addEventListener(Mr,e),()=>window.removeEventListener(Mr,e)},[t,bt,Nr]);const Pr=$(null),Kr=B(e=>{if(0!==e.button)return;if(e.target.closest("button, input, a, kbd, select, textarea"))return;if(Fe(null),Qn(It),Pn.current)return void e.preventDefault();e.preventDefault();const t=e.currentTarget,n=e.pointerId;let r=null;const o=e.clientX,i=e.clientY,a=rt.current,s=a?.getBoundingClientRect();let l,c,u,d;if(Pr.current){const t=Pr.current;Pr.current=null,d=t.w,u=t.h;const n=s?Math.min(Math.max(20,e.clientX-s.left),t.w-20):t.w/2;l=e.clientX-n,c=e.clientY-12,a&&(a.style.width=`${d}px`,a.style.height=`${u}px`,a.style.left=`${l}px`,a.style.top=`${c}px`)}else l=s?s.left:Hn.current.x,c=s?s.top:Hn.current.y,u=s?s.height:Hn.current.h,d=s?s.width:Hn.current.w;Bn(!1),vn(e=>({...e,x:l,y:c,w:d,h:u}));let h=null;const m=e=>{if(!r){if(Math.abs(e.clientX-o)<br&&Math.abs(e.clientY-i)<br)return;r=xr(t,n,"move","move"),a&&(a.style.transition="none")}const s=l+e.clientX-o,u=Math.max(0,c+e.clientY-i);if(a&&(a.style.transform=`translate(${s-l}px, ${u-c}px)`),Hn.current={...Hn.current,x:s,y:u},!G){const t=function(e,t){const n=rr(),r=e<=n.x+tr,o=e>=n.x+n.w-tr,i=t<=n.y+tr,a=t>=n.y+n.h-tr,s=e<=n.x+nr,l=e>=n.x+n.w-nr,c=t<=n.y+nr,u=t>=n.y+n.h-nr;return i&&s?"tl":i&&l?"tr":a&&s?"bl":a&&l?"br":c&&r?"tl":c&&o?"tr":u&&r?"bl":u&&o?"br":i?"top":r?"left":o?"right":null}(e.clientX,e.clientY);t!==h&&(h=t,t?hr(ur(t)):mr())}},p=()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",p),r?.(),mr();const e=lr({...Hn.current});if(Hn.current=e,!G&&h){Pr.current={x:l,y:c,w:d,h:u};const e=ur(h);return a&&(a.style.left=`${e.x}px`,a.style.top=`${e.y}px`,a.style.width=`${e.w}px`,a.style.height=`${e.h}px`,a.style.transform="",a.style.transition=""),void vn(e)}if(G){const t=e.x+e.w/2,n=window.innerWidth/2;tt(t>n?"right":"left")}a&&(a.style.left=`${e.x}px`,a.style.top=`${e.y}px`,a.style.transform="",a.style.transition=""),vn(e)};window.addEventListener("pointermove",m),window.addEventListener("pointerup",p)},[]),$r=B((e,t)=>{if(0!==e.button)return;e.preventDefault(),e.stopPropagation();const n=e.currentTarget,r=e.pointerId;let o=null;const i=e.clientX,a=e.clientY,s=rt.current,l=s?.getBoundingClientRect(),c=l?l.left:Hn.current.x,u=l?l.top:Hn.current.y,d=l?l.width:Hn.current.w,h=l?l.height:Hn.current.h,m="sw"===t||"nw"===t||"w"===t,p="ne"===t||"nw"===t||"n"===t,f="se"===t||"ne"===t||"e"===t,w="se"===t||"sw"===t||"s"===t;Bn(!1),vn({x:c,y:u,w:d,h:h}),Hn.current={x:c,y:u,w:d,h:h};let y=0,g=null;const v=()=>{if(y=0,!g)return;const e=g;g=null,Hn.current=e,s&&(s.style.left=`${e.x}px`,s.style.top=`${e.y}px`,s.style.width=`${e.w}px`,s.style.height=`${e.h}px`)},b=e=>{if(!o){if(Math.abs(e.clientX-i)<br&&Math.abs(e.clientY-a)<br)return;o=xr(n,r,vr[t],"resize")}g=((e,t)=>{let n=c,r=u,o=d,i=h;if(f&&(o=Math.max(ar,d+e)),w&&(i=Math.max(sr,h+t)),m){const t=Math.max(ar,d-e);n=c+d-t,o=t}if(p){const e=Math.max(sr,h-t);r=u+h-e,i=e}return{x:n,y:r,w:o,h:i}})(e.clientX-i,e.clientY-a),y||(y=requestAnimationFrame(v))},x=()=>{window.removeEventListener("pointermove",b),window.removeEventListener("pointerup",x),y&&cancelAnimationFrame(y),v(),o?.(),vn({...Hn.current})};window.addEventListener("pointermove",b),window.addEventListener("pointerup",x)},[]),jr=B(e=>{if(e.target.closest("button, input, a, kbd, select, textarea"))return;const t={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]}[e.key];if(!t&&"Enter"!==e.key)return;if(e.preventDefault(),e.stopPropagation(),Qn(It),"Enter"===e.key)return void(qn?(Bn(!1),vn(hn())):(Bn(!0),vn(dn())));const[n,r]=t;if(e.ctrlKey||e.metaKey){const e=()=>{Pr.current||(Pr.current={...Hn.current})};if(r<0)return e(),Bn(!0),void vn(dn());if(r>0){if(qn)return Bn(!1),void vn(hn());if(Pr.current){const e=lr(Pr.current);return Pr.current=null,Hn.current=e,void vn(e)}return void Zn(It)}e(),Bn(!1);const t=ur(n<0?"left":"right");return Hn.current=t,void vn(t)}if(qn)return;const o=Hn.current,i=e.shiftKey?{...o,w:Math.max(ar,o.w+24*n),h:Math.max(sr,o.h+24*r)}:lr({...o,x:o.x+24*n,y:Math.max(0,o.y+24*r)});Hn.current=i,vn(i)},[It,qn,hn,dn]),Br=B(e=>{Pr.current||(Pr.current={...Hn.current}),Bn(!1);const t=ur(e);Hn.current=t,vn(t),Qn(It)},[It]),Hr=An||Gt?{}:{tabIndex:0,role:"group","aria-label":Pe?`${Pe} — ${De.windowSuffix}`:De.windowSuffix,"aria-keyshortcuts":"ArrowUp ArrowDown ArrowLeft ArrowRight Shift+ArrowUp Shift+ArrowDown Shift+ArrowLeft Shift+ArrowRight Control+ArrowUp Control+ArrowDown Control+ArrowLeft Control+ArrowRight Enter",onKeyDown:jr},Ur=()=>{Bn(!0),vn(dn())},Yr=B(()=>{const e=rt.current;if(!e)return;const t=e.querySelector("form");if(t)t.requestSubmit();else{const t=e.querySelector(Jt);t&&!t.disabled&&t.click()}},[]);j(()=>{if(!t)return;if(G)return;const e=e=>{if(Ln[Ln.length-1]===It&&"Enter"===e.key){const t=e.target;if("TEXTAREA"===t.tagName||t.isContentEditable)return;if(e.metaKey||e.ctrlKey)e.preventDefault(),Yr();else{if("INPUT"===t.tagName&&t.closest("form"))return;if(!(t instanceof Element&&rt.current?.contains(t)))return;if(t.closest(Qt))return;e.preventDefault()}}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,Yr,It,G]),j(()=>{if(!t)return;const e=e=>{Ln[Ln.length-1]===It&&((e.metaKey||e.ctrlKey)&&"s"===e.key?(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-save",{detail:{modalId:It}})),Re.current=!1,We(!1)):e.altKey&&e.shiftKey&&("KeyD"===e.code||"D"===e.key||"d"===e.key)&&(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-duplicate",{detail:{modalId:It}}))))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t]),j(()=>{if(!t)return;if(G)return;const e=e=>{if("Escape"===e.key&&Ln[Ln.length-1]===It){if(P(e))return e.preventDefault(),void e.stopPropagation();if(Tn&&!K)return;e.preventDefault(),e.stopPropagation(),Nr()}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,Nr,It,G,Tn,K]);const Xr=t&&(void 0!==p||void 0!==f),[Vr]=F(()=>{if("undefined"==typeof document)return null;const e=document.createElement("span");return e.className="flex shrink-0 items-center gap-2",e.setAttribute("data-tab-actions",""),e}),_r=Tn&&!Be?.home&&dr.actions.length>0;j(()=>{t&&cr&&function(e,t){const n=jt.get(e);n&&n.title===t.title&&n.dirty===t.dirty&&n.copy===t.copy&&n.actions===t.actions&&n.menu===t.menu||(jt.set(e,t),Bt())}(cr,{title:dr.text||Pe,dirty:ir,copy:dr.copy,actions:_r&&Vr?Vr:void 0,menu:fr.current??void 0})},[t,cr,Pe,ir,dr.text,dr.copy,_r,Vr]);const Gr=B(e=>{const t=document.getElementById("nav-boundary-toast");t&&t.remove();const n="bottom"===e?["That's the last one, chief.","You've hit rock bottom... of the list.","End of the line, buddy.","Nothing left. Go outside.","Congratulations, you scrolled to the void.","There's no more. I checked.","You've reached the edge of the known universe.","Plot twist: there is no next one.","Even scrolling has limits. Unlike your ambition.","Last one. Time to touch grass."]:["Already at the top. Overachiever.","There is no item above this. Trust me.","You're #1. Literally.","Can't go higher. You've peaked.","This is it. The summit. The top.","First item. No VIP lounge above this.","Going up? Nope. Elevator's broken.","You want negative indexes? Bold.","Top of the list. Top of the world.","The only way is down from here."],r=n[Math.floor(Math.random()*n.length)],o=document.createElement("div");o.id="nav-boundary-toast",o.className="fixed bottom-6 left-1/2 -translate-x-1/2 z-(--z-toast) bg-gray-900 text-white flex min-h-10 items-center px-5 py-3 rounded-lg shadow-lg text-sm font-medium transition-opacity duration-300",o.textContent=r,document.body.appendChild(o),setTimeout(()=>{o.style.opacity="0",setTimeout(()=>o.remove(),300)},2e3)},[]);if(j(()=>{if(!t)return;const e=e=>{if(Ln[Ln.length-1]!==It)return;const t=e.target.tagName;"INPUT"!==t&&"TEXTAREA"!==t&&"SELECT"!==t&&(e.target.isContentEditable||("j"===e.key&&Xr&&(e.preventDefault(),p?p():Gr("bottom")),"k"===e.key&&Xr&&(e.preventDefault(),f?f():Gr("top"))))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,p,f,Xr,Gr,It]),!t||pn.current)return null;const Jr=Gt?function(e){if("undefined"==typeof document)return null;const t=Array.from(document.querySelectorAll("[data-modal-panel]")).filter(e=>{const t=e;return!t.hasAttribute("data-utility")&&!t.hasAttribute("data-widget")&&"none"!==t.style.display});t.sort((e,t)=>(e.getAttribute("data-modal-id")||"").localeCompare(t.getAttribute("data-modal-id")||""));const n=t.findIndex(t=>t.getAttribute("data-modal-id")===e),r=t.length;if(n<0||r<1)return null;const o=Math.ceil(Math.sqrt(r)),i=Math.ceil(r/o),a=Math.floor(n/o),s=n%o,l=r-o*(i-1),c=a===i-1&&l<o,u=rr(),d=(u.w-20*(o+1))/o,h=(u.h-14*(i+1)-22*i)/i,m=c?(o-l)*(d+20)/2:0;return{x:u.x+20+s*(d+20)+m,y:u.y+14+a*(h+14+22),w:d,h:h}}(It):null,Qr=Gt&&Jr?Math.min(Jr.w/gn.w,Jr.h/gn.h):1,Zr=(()=>{if(Gt&&Jr){const e=Qr,t=gn.w*e,n=gn.h*e,r=Jr.x+(Jr.w-t)/2-gn.x,o=Jr.y+(Jr.h-n)/2-gn.y,i=en||rn;return{transform:`translate(${r}px, ${o}px) scale(${e})`,transformOrigin:"top left",transition:"transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 280ms",cursor:"pointer",zIndex:D.expose+(i?20:10),boxShadow:i?"0 24px 72px rgba(0,0,0,0.6), 0 0 0 2px rgba(255,255,255,0.55), 0 0 36px 12px rgba(96,165,250,0.85), 0 0 96px 28px rgba(96,165,250,0.55)":"0 16px 48px rgba(0,0,0,0.55)",pointerEvents:"auto"}}if(on&&_t){const e="picked"===ln;return{transition:e?"transform 640ms cubic-bezier(0.34, 1.42, 0.64, 1), box-shadow 600ms":"transform 600ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 600ms",...e?{zIndex:D.expose+30}:{}}}return null})(),eo=v({modal:!1,titleId:!G&&(Tn?!Be?.home:!we)?Ie:void 0,label:dr.text||Pe}),to=/* @__PURE__ */Q("div",{children:[
|
|
50
|
+
/* @__PURE__ */Q("div",{ref:rt,"data-modal-panel":!0,"data-modal-id":It,"data-window-key":ce||void 0,...U?{"data-utility":""}:{},...Oe?{"data-pinned-top":""}:{},...G?{"data-widget":""}:{},...Be?{"data-window-owner":Be.key}:{},...Be&&!gt?{"data-window-root":""}:{},...Tn?{"data-window-tab":""}:{},...eo,className:Tn?"fixed flex flex-col overflow-hidden":"fixed rounded-(--radius-window) flex flex-col overflow-hidden "+(G?Rt?"shadow-xl":"shadow-lg":"border "+(Rt?"shadow-xl border-gray-200":"shadow-lg border-gray-300")),onMouseDownCapture:e=>{if(ot.current=!1,Gt){if(e.target.closest("[data-expose-close]"))return;return e.preventDefault(),e.stopPropagation(),Or(It),Ar(!1),void Qn(It)}if(!Rt&&!G&&!Oe&&0===e.button){const t=e.target;t.closest("[data-modal-panel]")===rt.current&&t.closest("button, input, a, select, textarea")&&!t.closest("[data-window-chrome]")&&(e.preventDefault(),e.stopPropagation(),ot.current=!0,Fe(null),Qn(It),window.addEventListener("mouseup",()=>{setTimeout(()=>{ot.current=!1},0)},{once:!0}))}},onClickCapture:e=>{ot.current&&(ot.current=!1,e.preventDefault(),e.stopPropagation())},onMouseDown:e=>{if(Gt)return;Fe(null);e.target.closest("[data-modal-panel]")===rt.current&&(e.target.closest("button, input, a, select, textarea")||Qn(It))},style:we?{zIndex:Kt+1,top:0,left:0,right:0,bottom:"var(--mobile-bottom-nav, 56px)",width:"auto",height:"auto",transform:`translateX(${ge}px)`,transition:be?"none":"transform 180ms ease-out",...G?{display:"none"}:{},...Kt<0?{display:"none"}:{},...Rt||Oe||Se&&ce===Se?{}:{display:"none"}}:{zIndex:Oe?D.pinnedWindow:Kt+1,width:gn.w,height:gn.h,top:gn.y,...G&&"right"===et?{right:window.innerWidth-gn.x-gn.w}:{left:gn.x},...Kt<0&&!Oe?{display:"none"}:{},...ye?{display:"none"}:{},...$n||Fn?{visibility:"hidden",pointerEvents:"none"}:{},...Zr??{}},children:[we&&!G&&/* @__PURE__ */Z("div",{onPointerDown:Ce,className:"absolute top-0 bottom-0 left-0 w-[22px] z-[5]",style:{touchAction:"pan-y"},"aria-hidden":"true"}),G?null:Tn?Be?.home?null:/* @__PURE__ */Q(ee,{children:[
|
|
51
|
+
/* @__PURE__ */Z("h2",{id:Ie,"data-window-title":!0,className:"sr-only",children:dr.text||Pe}),_r&&Vr&&te(
|
|
52
|
+
/* @__PURE__ */Z(ee,{children:dr.actions}),Vr),dr.badges.length>0&&/* @__PURE__ */Z("div",{"data-window-chrome":"","data-record-bar":"",className:"flex h-9 shrink-0 select-none items-center gap-2 overflow-hidden border-b border-gray-200 px-4",style:{backgroundColor:"rgb(var(--window-content-rgb))"},children:dr.badges})]}):we?null:
|
|
53
|
+
/* @__PURE__ */Q("div",J?{onPointerDown:Kr,"data-window-chrome":"",...Hr,className:"flex items-center justify-between h-(--row-height-compact-bar) px-3 border-b border-gray-200 shrink-0 cursor-move select-none rounded-t-(--radius-window) focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400 "+(Rt?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:Rt?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
|
|
54
|
+
/* @__PURE__ */Q("div",{"data-window-title":!0,title:Pe,className:"text-sm font-medium min-w-0 flex-1 truncate flex items-center gap-2",style:{color:Rt?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!Gt&&Lt(),
|
|
55
|
+
/* @__PURE__ */Z("span",{id:Ie,className:"truncate",children:Gt?Zt(Te):Te})]}),!Gt&&/* @__PURE__ */Q("div",{className:"flex items-center gap-2 shrink-0 ml-2",children:[U&&/* @__PURE__ */Z("button",{onClick:()=>$e(e=>!e),title:Oe?De.unpin:De.pinOnTop,className:"p-0.5 rounded hover:bg-gray-200 "+(Oe?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */Z(z,{name:"bookmark-square",className:"h-3 w-3",fill:Oe?"currentColor":"none",strokeWidth:1.5})}),
|
|
56
|
+
/* @__PURE__ */Z("button",{type:"button",onClick:Nr,className:"rounded p-0.5 text-gray-400 hover:text-gray-600 hover:bg-gray-200",children:/* @__PURE__ */Z(z,{name:"close",className:"h-4 w-4"})})]})]}:ne?{onPointerDown:Kr,"data-window-chrome":"",...Hr,className:"flex items-center justify-between h-(--row-height-compact-bar) px-3 border-b border-gray-200 shrink-0 cursor-move select-none rounded-t-(--radius-window) focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400 "+(Rt?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:Rt?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
|
|
57
|
+
/* @__PURE__ */Q("div",{"data-window-title":!0,title:Pe,className:"text-sm font-medium min-w-0 flex-1 truncate flex items-center gap-2",style:{color:Rt?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!Gt&&Lt(),
|
|
58
|
+
/* @__PURE__ */Z("span",{id:Ie,className:"truncate",children:Gt?Zt(Te):Te})]}),!Gt&&/* @__PURE__ */Q("div",{className:"flex items-center gap-2 shrink-0 ml-2",children:[U&&/* @__PURE__ */Z("button",{onClick:()=>$e(e=>!e),title:Oe?De.unpin:De.pinOnTop,className:"p-0.5 rounded hover:bg-gray-200 "+(Oe?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */Z(z,{name:"bookmark-square",className:"h-3 w-3",fill:Oe?"currentColor":"none",strokeWidth:1.5})}),
|
|
59
|
+
/* @__PURE__ */Z("button",{onClick:()=>Zn(It),title:De.minimize,className:"text-gray-400 hover:text-gray-600 px-1 py-0.5 rounded hover:bg-gray-200 text-xs leading-none",children:"─"}),!An&&/* @__PURE__ */Z(yr,{maximized:qn,onToggleMax:()=>{qn?(Bn(!1),vn(hn())):Ur()},onSnap:Br,buttonClassName:"text-gray-400 hover:text-gray-600 px-1 py-0.5 rounded hover:bg-gray-200 text-xs leading-none",strings:De}),
|
|
60
|
+
/* @__PURE__ */Z("button",{type:"button",onClick:Nr,className:"rounded p-0.5 text-gray-400 hover:text-gray-600 hover:bg-gray-200",children:/* @__PURE__ */Z(z,{name:"close",className:"h-4 w-4"})})]})]}:{onPointerDown:Kr,"data-window-chrome":"",...Hr,className:"flex items-center justify-between h-(--row-height-window-bar) px-3 border-b border-gray-200 shrink-0 cursor-move select-none rounded-t-(--radius-window) focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400 "+(Rt?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:Rt?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
|
|
61
|
+
/* @__PURE__ */Q("div",{"data-window-title":!0,title:Pe,className:"text-sm font-medium min-w-0 flex-1 truncate flex items-center gap-2",style:{color:Rt?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!Gt&&Lt(),
|
|
62
|
+
/* @__PURE__ */Z("span",{id:Ie,className:"truncate",children:Gt?Zt(Te):Te})]}),!Gt&&/* @__PURE__ */Q("div",{className:"flex items-center gap-3 shrink-0 ml-4",children:[U&&/* @__PURE__ */Z("button",{onClick:()=>$e(e=>!e),title:Oe?De.unpin:De.pinOnTop,className:"text-xs px-2 py-1 rounded hover:bg-gray-200 "+(Oe?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */Z(z,{name:"bookmark-square",className:"h-3.5 w-3.5",fill:Oe?"currentColor":"none",strokeWidth:1.5})}),
|
|
63
|
+
/* @__PURE__ */Z("button",{onClick:()=>Zn(It),title:De.minimize,className:"text-gray-400 hover:text-gray-600 text-xs px-2 py-1 rounded hover:bg-gray-200",children:"─"}),!An&&/* @__PURE__ */Z(yr,{maximized:qn,onToggleMax:()=>{qn?(Bn(!1),vn(hn())):Ur()},onSnap:Br,buttonClassName:"text-gray-400 hover:text-gray-600 text-xs px-2 py-1 rounded hover:bg-gray-200",strings:De}),
|
|
64
|
+
/* @__PURE__ */Z("button",{type:"button",onClick:Nr,className:"rounded-(--radius-control) text-gray-400 hover:text-gray-600",children:/* @__PURE__ */Z(z,{name:"close",className:"h-5 w-5"})})]})]}),de&&Ye&&!G&&!we&&/* @__PURE__ */Z("div",{"aria-hidden":"true",className:"h-[3px] shrink-0 pointer-events-none",style:{backgroundColor:`rgb(var(--window-accent-rgb) / ${Rt?.9:.55})`}}),
|
|
65
|
+
/* @__PURE__ */Z(Xt.Provider,{value:It,children:/* @__PURE__ */Z(sn.Provider,{value:{rightRef:at,leftRef:st,notify:()=>ct(!0),active:Rt,isDirty:ir,footerOpen:wt&&!G&&!J&&!ne&&!we},children:/* @__PURE__ */Z("div",{ref:it,...G?{onPointerDown:Kr,onContextMenu:e=>{e.preventDefault(),Ze({x:e.clientX,y:e.clientY})}}:{},className:`flex-1 min-h-0 flex flex-col ${G?"p-0 cursor-move":ne||re?"p-0":J?"p-2":"p-4"} ${G||Tn?"":"backdrop-blur-sm"} ${!1===E||ne||re?"overflow-hidden":"overflow-y-auto overscroll-contain"} ${G?"rounded-2xl select-none":""}`,style:{...G?{touchAction:"none"}:{},backgroundColor:G?"transparent":Tn?"rgb(var(--window-content-rgb))":Rt?"rgb(var(--window-content-rgb) / var(--active-content-opacity, 0.9))":"rgb(var(--window-content-rgb) / var(--inactive-content-opacity, 0.8))"},children:/* @__PURE__ */Z(Me,{children:he})})})}),G&&Qe&&/* @__PURE__ */Q(b,{minWidth:160,style:{left:Qe.x,top:Qe.y},onClose:()=>Ze(null),children:[
|
|
66
|
+
/* @__PURE__ */Z(x,{onClick:()=>{Ze(null),window.dispatchEvent(new CustomEvent("widget-open-settings",{detail:It}))},children:"Settings"}),
|
|
67
|
+
/* @__PURE__ */Z(k,{}),se&&/* @__PURE__ */Q(ee,{children:[se,
|
|
68
|
+
/* @__PURE__ */Z(k,{})]}),
|
|
69
|
+
/* @__PURE__ */Q(x,{onClick:()=>{Ze(null),$e(e=>!e)},children:[
|
|
70
|
+
/* @__PURE__ */Z("span",{className:"flex-1",children:"Always on Top"}),Oe&&/* @__PURE__ */Z(z,{name:"check",className:"h-4 w-4 text-blue-600 shrink-0",strokeWidth:2})]}),
|
|
71
|
+
/* @__PURE__ */Z(k,{}),
|
|
72
|
+
/* @__PURE__ */Z(x,{onClick:()=>{Ze(null),Nr()},children:"Close"})]}),
|
|
73
|
+
/* @__PURE__ */Q("div",{onPointerDown:Kr,ref:ut,"data-modal-footer":"",className:`px-4 py-2 border-t border-gray-200 shrink-0 flex items-center justify-between text-xs select-none${Tn?"":" cursor-move"}${Rt&&!Tn?" backdrop-blur-sm":""}${G||J||ne||we||!wt?" hidden":""}`,style:{touchAction:"none",backgroundColor:Tn?"rgb(var(--window-footer-rgb))":Rt?"rgb(var(--window-footer-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-footer-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
|
|
74
|
+
/* @__PURE__ */Q("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[kt&&/* @__PURE__ */Z(Le,{auto:!0}),A,
|
|
75
|
+
/* @__PURE__ */Z("div",{ref:st,"data-modal-actions-left":!0,className:"flex items-center gap-2 shrink-0"}),null!=w&&!1!==w&&
|
|
76
|
+
/* @__PURE__ */Z("div",{ref:dt,"data-modal-footer-facts":"",className:"min-w-0 flex-1 overflow-hidden",children:/* @__PURE__ */Z("div",{ref:ht,className:"inline-flex items-center gap-2 whitespace-nowrap"+(mt?" invisible":""),children:w})})]}),
|
|
77
|
+
/* @__PURE__ */Q("div",{"data-modal-footer-right":"",className:"flex items-center gap-2 ml-auto shrink-0",children:[ft&&R&&(R.editing?/* @__PURE__ */Z(T,{variant:"secondary",size:"sm","data-modal-discard":"",onClick:()=>{Sr()},children:De.discard}):"object"==typeof R.state?/* @__PURE__ */Z(T,{variant:"secondary",size:"sm","data-modal-edit":"","aria-disabled":!0,disabledReason:R.state.disabledReason,children:De.edit}):/* @__PURE__ */Z(T,{variant:"secondary",size:"sm","data-modal-edit":"",onClick:()=>R.onEdit(),children:De.edit})),
|
|
78
|
+
/* @__PURE__ */Z("div",{ref:at,"data-modal-actions":!0,className:"flex items-center gap-2"}),L]})]}),!G&&!we&&!Gt&&Rt&&!An&&/* @__PURE__ */Q(ee,{children:[
|
|
79
|
+
/* @__PURE__ */Z("div",{onPointerDown:e=>$r(e,"se"),className:"absolute bottom-0 right-0 w-3 h-3 cursor-nwse-resize z-10"}),
|
|
80
|
+
/* @__PURE__ */Z("div",{onPointerDown:e=>$r(e,"sw"),className:"absolute bottom-0 left-0 w-3 h-3 cursor-nesw-resize z-10"}),
|
|
81
|
+
/* @__PURE__ */Z("div",{onPointerDown:e=>$r(e,"ne"),className:"absolute top-0 right-0 w-3 h-3 cursor-nesw-resize z-10"}),
|
|
82
|
+
/* @__PURE__ */Z("div",{onPointerDown:e=>$r(e,"nw"),className:"absolute top-0 left-0 w-3 h-3 cursor-nwse-resize z-10"}),
|
|
83
|
+
/* @__PURE__ */Z("div",{onPointerDown:e=>$r(e,"n"),className:"absolute top-0 left-3 right-3 h-1 cursor-ns-resize"}),
|
|
84
|
+
/* @__PURE__ */Z("div",{onPointerDown:e=>$r(e,"s"),className:"absolute bottom-0 left-3 right-3 h-1 cursor-ns-resize"}),
|
|
85
|
+
/* @__PURE__ */Z("div",{onPointerDown:e=>$r(e,"e"),className:"absolute top-3 bottom-3 right-0 w-1 cursor-ew-resize"}),
|
|
86
|
+
/* @__PURE__ */Z("div",{onPointerDown:e=>$r(e,"w"),className:"absolute top-3 bottom-3 left-0 w-1 cursor-ew-resize"})]}),Gt&&/* @__PURE__ */Z("div",{className:"absolute inset-0",style:{zIndex:D.hint,cursor:"pointer",background:"transparent"},onMouseEnter:()=>tn(!0),onMouseLeave:()=>tn(!1),onMouseDown:e=>{e.stopPropagation(),e.preventDefault(),Qn(It),Ar(!1)},onClick:e=>{e.stopPropagation(),e.preventDefault()},children:en&&/* @__PURE__ */Z("button",{type:"button","data-expose-close":!0,"aria-label":Ae.taskbar.closeWindow,title:"Close",className:"absolute flex items-center justify-center rounded-full bg-black/55 text-white shadow-lg ring-1 ring-white/40 transition-colors hover:bg-red-500",style:{top:8,right:8,width:30,height:30,transform:`scale(${1/Qr})`,transformOrigin:"top right",zIndex:D.raised},onMouseDown:e=>{e.stopPropagation(),e.preventDefault()},onClick:e=>{e.stopPropagation(),e.preventDefault(),Nr()},children:/* @__PURE__ */Z(z,{name:"close",className:"h-4 w-4",strokeWidth:2.2})})})]}),Gt&&Jr&&/* @__PURE__ */Z("div",{className:"fixed pointer-events-none select-none truncate text-center",style:{left:Jr.x,top:Jr.y+Jr.h+4,width:Jr.w,zIndex:D.expose+(en?21:11),color:"white",fontSize:"var(--text-xs)",fontWeight:500,textShadow:"0 1px 2px rgba(0,0,0,0.6)"},children:Zt(Te)})]}),no=je&&/* @__PURE__ */Q(b,{style:{left:je.x,top:je.y},onClose:()=>Fe(null),minWidth:160,children:[!G&&!J&&!Tn&&/* @__PURE__ */Q(ee,{children:[
|
|
87
|
+
/* @__PURE__ */Q(x,{onClick:()=>{Zn(It),Fe(null)},children:[
|
|
88
|
+
/* @__PURE__ */Z(z,{name:"remove",className:"h-4 w-4",strokeWidth:1.5}),De.minimize]}),!An&&/* @__PURE__ */Q(x,qn?{onClick:()=>{Bn(!1),vn(hn()),Fe(null)},children:[
|
|
89
|
+
/* @__PURE__ */Z("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */Z("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 4.5v15m6-15v15M4.5 9h15M4.5 15h15"})}),De.windowed]}:{onClick:()=>{Ur(),Fe(null)},children:[
|
|
90
|
+
/* @__PURE__ */Z(z,{name:"expand",className:"h-4 w-4",strokeWidth:1.5}),De.maximize]})]}),U&&!Tn&&/* @__PURE__ */Q(x,{onClick:()=>{$e(e=>!e),Fe(null)},children:[
|
|
91
|
+
/* @__PURE__ */Z(z,{name:"bookmark-square",className:"h-4 w-4 "+(Oe?"text-blue-600":""),fill:Oe?"currentColor":"none",strokeWidth:1.5}),Oe?De.unpin:De.pinOnTop]}),qe&&/* @__PURE__ */Q(x,{onClick:()=>{Fe(null),Je()},children:[
|
|
92
|
+
/* @__PURE__ */Z(z,{name:"star",className:"h-4 w-4",fill:Ge?"currentColor":"none",strokeWidth:1.5}),Ge?Ae.taskbar.removeFromDesktop:Ae.taskbar.addToDesktop]}),(nn[It]||[]).length>0&&/* @__PURE__ */Z(ee,{children:(nn[It]||[]).map((e,t)=>/* @__PURE__ */Q(x,{onClick:()=>{Fe(null),e.onClick()},children:[e.icon,e.label]},t))}),!(Tn&&Be?.home)&&/* @__PURE__ */Q(ee,{children:[
|
|
93
|
+
/* @__PURE__ */Z(k,{}),
|
|
94
|
+
/* @__PURE__ */Q(x,{danger:!0,onClick:()=>{Fe(null),Nr()},children:[
|
|
95
|
+
/* @__PURE__ */Z(z,{name:"close",className:"h-4 w-4"}),De.close]})]})]}),ro=!!ce&&Pt.some(e=>e.id===ce),oo=!qt||ro||G?null:/* @__PURE__ */Q("div",{"data-modal-restore-tab":!0,"data-modal-id":It,className:"fixed left-1/2 z-(--z-restore-tab) flex -translate-x-1/2 items-center gap-1 rounded-lg border border-gray-300 bg-white px-2 py-1 shadow-lg",style:{bottom:"calc(var(--taskbar-height, 0px) + 12px)"},children:[
|
|
96
|
+
/* @__PURE__ */Z("button",{type:"button",onClick:()=>Qn(It),title:De.restore,className:"max-w-[16rem] truncate rounded px-2 py-0.5 text-sm font-medium text-gray-700 hover:bg-gray-100 hover:text-gray-900",children:Pe||De.windowSuffix}),
|
|
97
|
+
/* @__PURE__ */Z("button",{type:"button",onClick:()=>Qn(It),title:De.restore,"aria-label":De.restore,className:"rounded px-2 py-0.5 text-xs leading-none text-gray-400 hover:bg-gray-100 hover:text-gray-600",children:"▴"}),
|
|
98
|
+
/* @__PURE__ */Z("button",{type:"button",onClick:()=>{Nr()},title:De.close,"aria-label":De.close,className:"rounded px-2 py-0.5 text-xs leading-none text-gray-400 hover:bg-gray-100 hover:text-gray-600",children:"✕"})]});return te(
|
|
99
|
+
/* @__PURE__ */Q(Vt.Provider,{value:null,children:[to,no,oo]}),document.body)}"undefined"!=typeof window&&window.addEventListener("keydown",e=>{Sr&&"Escape"===e.key&&(Br(null),Ar(!1))});var Vr=100,_r={past:[],future:[]};function Gr(e,t){switch(t.type){case"record":{const n=e.past[e.past.length-1];if(null!==t.step.coalesceKey&&n?.coalesceKey===t.step.coalesceKey)return 0===e.future.length?e:{...e,future:[]};const r=[...e.past,t.step];return{past:r.length>Vr?r.slice(r.length-Vr):r,future:[]}}case"undo":return 0===e.past.length?e:{past:e.past.slice(0,-1),future:[t.redoStep,...e.future]};case"redo":return 0===e.future.length?e:{past:[...e.past,t.undoStep],future:e.future.slice(1)};case"clear":return 0===e.past.length&&0===e.future.length?e:_r}}var Jr=/* @__PURE__ */new Set(["INPUT","TEXTAREA","SELECT"]);var Qr=500,Zr=250;function eo({children:e,canEdit:t=!0,perms:n,windowId:r}){const[o,a]=G(Gr,_r),s=$(/* @__PURE__ */new Map),[l,c]=F(0),u=l>0,[d,h]=F(0),[m,p]=F(0),f=m>0,{hasAnyPerm:w}=i(),y=t&&0===d&&(!(n&&n.length>0)||w(n)),g=$(null),v=$(!1),b=B(()=>{const e={};for(const[t,n]of s.current)e[t]=n.getLast();return e},[]),x=B((e,t)=>{s.current.has(e)||c(e=>e+1),s.current.set(e,t)},[]),k=B(e=>{s.current.delete(e)&&c(e=>e-1)},[]),E=B(e=>{h(t=>t+(e?1:-1))},[]),C=B(e=>{p(t=>t+(e?1:-1))},[]),[M,N]=F(0),S=M>0,L=B(e=>{N(t=>t+(e?1:-1))},[]),T=W(Ne),z=T?.claimReadOnly;j(()=>{if(z&&!y)return z(!0),()=>z(!1)},[z,y]);const A=T?.claimOwnMount;j(()=>{if(A&&S)return A(!0),()=>A(!1)},[A,S]);const D=$({last:0,count:0,tripped:!1}),P=$(!1),I=B((e,t,n)=>{if(v.current)return void(n&&function(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(Array.isArray(e)!==Array.isArray(t))return!1;try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}(n.prev,n.next)||(P.current=!0));if(!y||g.current)return;const r=D.current;if(r.tripped)return;const o=Date.now();if(o-r.last>Zr&&(r.count=0),r.last=o,++r.count>Qr)return r.tripped=!0,void console.error(`[efficient-shell] UndoProvider: "${e}" recorded ${Qr} undo steps with no pause between them, which no user action can do. The value passed to useUndoable for this slice is almost certainly rebuilt on every render (a .map/.filter/object literal in the call) rather than held in state, so it reads as changed every time — and since recording a step re-renders the form, that is a loop. Undo recording is now off for this form to keep the tab responsive.`);g.current={values:b(),label:e,coalesceKey:t},queueMicrotask(()=>{const e=g.current;g.current=null,e&&a({type:"record",step:e})})},[y,b]),K=B(e=>{for(const[t,n]of Object.entries(e)){const e=s.current.get(t);e&&(e.setLast(n),e.apply(n))}},[]),R=B(()=>{const e=o.past[o.past.length-1];if(!e)return;const t={values:b(),label:e.label,coalesceKey:null};K(e.values),a({type:"undo",redoStep:t})},[o.past,b,K]),O=B(()=>{const e=o.future[0];if(!e)return;const t={values:b(),label:e.label,coalesceKey:null};K(e.values),a({type:"redo",undoStep:t})},[o.future,b,K]),[q,H]=F(0),U=$(0),Y=$(0),X=$(!1),_=B(()=>{v.current=!0,P.current=!1,g.current=null,U.current+=1,Y.current=U.current,H(U.current)},[]),J=$(void 0),ee=B(e=>{void 0!==e&&(void 0!==J.current&&e!==J.current&&(X.current=!0),J.current=e),_()},[_]);j(()=>{v.current&&q===Y.current&&(v.current=!1,g.current=null,(P.current||X.current)&&a({type:"clear"}),P.current=!1,X.current=!1)},[q]);const te=B(()=>{X.current=!0,a({type:"clear"}),_()},[_]),ne=y&&o.past.length>0,re=y&&o.future.length>0,oe=Nr(r),ie=$({undo:R,redo:O,canUndo:ne,canRedo:re});ie.current={undo:R,redo:O,canUndo:ne,canRedo:re},j(()=>{if(!oe||!y)return;const e=e=>{const t=function(e){if(!e.metaKey&&!e.ctrlKey||e.altKey)return null;const t=e.key.toLowerCase(),n="z"===t?e.shiftKey?"redo":"undo":"y"!==t||!e.ctrlKey||e.metaKey||e.shiftKey?null:"redo";if(!n)return null;const r=e.target;return r?.isContentEditable||r?.tagName&&Jr.has(r.tagName.toUpperCase())?null:n}(e);if(!t)return;const n=ie.current;("undo"===t?n.canUndo:n.canRedo)&&(e.preventDefault(),"undo"===t?n.undo():n.redo())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[oe,y]);const ae=V(()=>({register:x,unregister:k,record:I,undo:R,redo:O,clear:te,baseline:ee,canUndo:ne,canRedo:re,enabled:y,hasState:u,handMounted:S,claimOwnMount:L,claimReadOnly:E,declaredEditable:f,claimEditable:C,undoLabel:ne?o.past[o.past.length-1].label:null,redoLabel:re?o.future[0].label:null}),[x,k,I,R,O,te,ee,ne,re,y,u,S,L,E,f,C,o.past,o.future]),se=""!==ln(),le=W(sn)?.footerOpen??!1,ce=se&&y&&u&&!S&≤/* @__PURE__ */
|
|
100
|
+
return Q(Ne.Provider,{value:ae,children:[ce&&/* @__PURE__ */Z(un,{position:"left",quiet:!0,children:/* @__PURE__ */Z(Le,{auto:!0})}),e]})}function to(){const e=W(Ne),t=B(()=>{},[]);return{undo:e?.undo??t,redo:e?.redo??t,clear:e?.clear??t,baseline:e?.baseline??t,canUndo:e?.canUndo??!1,canRedo:e?.canRedo??!1,undoLabel:e?.undoLabel??null,redoLabel:e?.redoLabel??null,enabled:e?.enabled??!1,hasState:e?.hasState??!1}}function no(e){const t=W(Ne),n=t?.claimReadOnly,r=t?.claimEditable;j(()=>{const t=e?r:n;if(t)return t(!0),()=>t(!1)},[n,r,e])}function ro(e,t,n){const r=W(Ne),o=_(),i=$(e),a=$(t);a.current=t,j(()=>{if(r)return r.register(o,{getLast:()=>i.current,setLast:e=>{i.current=e},apply:e=>a.current(e)}),()=>r.unregister(o)},[r,o]);const{label:s,coalesceKey:l=null}=n,c=$(r);c.current=r;const u=$({label:s,coalesceKey:l});u.current={label:s,coalesceKey:l},j(()=>{const t=c.current;t&&(Object.is(e,i.current)||(t.record(u.current.label,u.current.coalesceKey,{prev:i.current,next:e}),i.current=e))},[e])}function oo(e,t){const[n,r]=F(e);return ro(n,e=>r(()=>e),t),[n,r]}export{dn as CancelButton,Qe as DocFavStar,je as EntityWindowFallback,Oe as EntityWindowLoading,Fe as EntityWindowState,Qt as KEY_ACTIVATED_SELECTOR,We as LoadingSpinner,Jt as MODAL_SUBMIT_SELECTOR,Xr as Modal,un as ModalActions,Le as UndoControls,eo as UndoProvider,ce as WINDOW_REGISTRY,Ce as WindowCrashedFallback,Me as WindowErrorBoundary,vt as WindowManagerProvider,on as WindowTitle,ot as activateWindowById,Dt as beginWindowGesture,Vn as cancelWindowFront,pe as client_default,Hr as commitExposeHighlight,Xn as confirmWindowDiscard,Pt as drainPerfEvents,Pr as exitExposeMode,En as forgetMaximizedWindowBoxes,Er as getActiveModalId,st as getActiveWindowRoute,qr as getExposeHighlight,Yt as getWindowChromeVersion,xn as getWindowPosition,Be as isDraftEntityId,He as isDraftEntityWindow,ae as isEntityEntry,ie as isPageEntry,he as isShellApiClientConfigured,Pe as isTabWindow,At as markMenuOpen,Ht as readWindowChrome,Hn as requestWindowFront,Br as setExposeHighlight,zt as setPerfCollecting,de as setShellApiClient,ve as setShellHomeRoute,Ee as setShellTabStrip,le as setShellWindowRegistry,bn as setWindowDefaultPosition,kn as setWindowPosition,Ot as splitTitle,Fr as subscribeExposeHighlight,Ut as subscribeWindowChrome,Ie as tabGroupOf,Dr as toggleExposeMode,jn as useCurrentTabKey,ln as useEnclosingModalId,Nr as useIsActiveWindow,cn as useModalActive,we as usePageSearch,to as useUndo,no as useUndoCanEdit,ro as useUndoable,oo as useUndoableState,tn as useWidgetSettings,Xe as useWindowDirty,_e as useWindowManager,rn as useWindowMenuItem,an as useWindowTitle,Yn as windowHoldsChanges};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{ImageFocusPoint as e}from"./chunk-GATKJSGL.js";import{FormField as a}from"./chunk-MVQBVPWP.js";import{isVideoUrl as i,mediaPromptLine as t,mediaFileName as r,FilenameBadge as o,BusyOverlay as n,UploadGlyph as l,dropzoneClass as s,zoneFocusClass as c}from"./chunk-DTSCO7VM.js";import{TransferProgress as d}from"./chunk-S7VSXUKS.js";import{Segmented as u}from"./chunk-N6DTTOB6.js";import{useFileIntake as m,FileIntakeAlert as h}from"./chunk-YDYDR72S.js";import{Icon as p}from"./chunk-KIBL6M3T.js";import{useShellStrings as b}from"./chunk-E6UCGCOC.js";import{useState as g,useRef as v,useEffect as f,useId as y}from"react";import{jsxs as k,jsx as j,Fragment as x}from"react/jsx-runtime";var N=["flex h-8 items-center justify-center rounded-(--radius-control) text-(--status-on-solid)","not-disabled:hover:bg-white/10 disabled:cursor-not-allowed disabled:opacity-60","rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]"].join(" ");function w({value:w,onChange:L,onPick:C,onFile:R,label:U,hint:F,error:O,required:S,className:P,accept:$="image/*",maxSizeBytes:z,fit:B="cover",height:T=112,placeholder:V,cta:D,acceptHint:K,showFilename:q=!0,allowReplace:G=!0,allowRemove:H=!0,replaceLabel:I,removeLabel:M,busy:A=!1,busyLabel:W,choosingLabel:Y,pickFailedLabel:_,progress:E,disabled:J=!1,kind:Q,onKindChange:X,focus:Z,onFocusChange:ee,focusLabel:ae}){const ie=b().media,te=D??ie.cta,re=Q??(/video/.test($)&&!/image/.test($)?"video":"image"),oe="string"==typeof M&&M?M:ie.remove,[ne,le]=g(!1),[se,ce]=g(!1),de=v(!0);f(()=>()=>{de.current=!1},[]);const ue=A||ne,me=ne&&!A?Y??ie.choosing:W??ie.uploading,he=O??(se?_??ie.pickFailed:void 0),pe=e=>{if(!C)return;ce(!1);const a=C(e);a&&"function"==typeof a.then&&(le(!0),a.then(e=>{de.current&&(le(!1),"string"==typeof e&&e&&L(e))},()=>{de.current&&(le(!1),ce(!0))}))},be=y(),ge=v(null),[ve,fe]=g(null);f(()=>()=>{ge.current&&URL.revokeObjectURL(ge.current)},[]);const ye=J||ue,ke=!!w&&(i(w,$)||w===ve),je=V??t($,ie),xe=I??(ke||"video"===re?ie.changeVideo:ie.changeImage),Ne=e=>{C?pe(e):R?R(e):(e=>{ge.current&&URL.revokeObjectURL(ge.current);const a=URL.createObjectURL(e);ge.current=a,fe(e.type.startsWith("video/")?a:null),L(a)})(e)},we=m({accept:$,maxSizeBytes:z,acceptHint:K,multiple:!1,disabled:ye,onAccept:([e])=>Ne(e)}),{dragOver:Le}=we,Ce=()=>{ye||(C?pe():we.open())},Re=w?r(w):"",Ue=!ke&&!!ee,Fe=J||!G&&!H?null:/* @__PURE__ */k("div",{"data-media-bar":"",className:["absolute inset-x-0 bottom-0 flex items-center gap-1 p-1 text-(--status-on-solid)","opacity-0 transition-opacity duration-(--motion-fast)","group-hover/media:opacity-100 group-focus-within/media:opacity-100 [@media(hover:none)]:opacity-100"].join(" "),style:{background:"var(--rosh-media-scrim-button)"},children:[G&&/* @__PURE__ */k("button",{id:Ue?void 0:be,type:"button","aria-labelledby":`${be}-change`,onClick:()=>Ce(),disabled:ue,className:`min-w-0 flex-1 gap-1 px-2 text-sm font-medium ${N}`,children:[
|
|
2
|
+
/* @__PURE__ */j(p,{name:"swap","aria-hidden":"true",className:"h-4 w-4 shrink-0"}),
|
|
3
|
+
/* @__PURE__ */j("span",{id:`${be}-change`,className:"truncate",children:xe})]}),H&&/* @__PURE__ */j("button",{type:"button","aria-label":oe,onClick:()=>{ge.current&&(URL.revokeObjectURL(ge.current),ge.current=null),fe(null),L("")},disabled:ue,className:`ml-auto w-8 shrink-0 ${N}`,children:/* @__PURE__ */j(p,{name:"trash","aria-hidden":"true",className:"h-4 w-4"})})]}),Oe=/* @__PURE__ */k("div",{...we.zoneProps,"data-media-frame":"",className:["group/media relative overflow-hidden rounded-(--radius-control) border transition-colors",Ue?"":"bg-gray-100",Le?"border-blue-500":"border-gray-200"].join(" "),style:Ue?void 0:{height:T},children:[Ue?
|
|
4
|
+
/* @__PURE__ */j(e,{value:Z??"",onChange:e=>ee?.(e),label:ae??ie.focus,image:w,hint:null,id:be,disabled:ye,className:"[&_[data-image-focus-picture]]:rounded-none [&_[data-image-focus-picture]]:border-0"}):ke?/* @__PURE__ */j("video",{src:w??void 0,muted:!0,playsInline:!0,preload:"metadata","aria-label":Re||void 0,className:"h-full w-full",style:{objectFit:B}}):/* @__PURE__ */j("img",{src:w??void 0,alt:Re,className:"h-full w-full",style:{objectFit:B,objectPosition:Z||void 0}}),q&&w&&/* @__PURE__ */j(o,{children:Re}),Fe,ue&&/* @__PURE__ */j(n,{label:me,progress:E,rounded:"rounded-md"})]}),Se=/* @__PURE__ */j("button",{type:"button",id:be,onClick:()=>Ce(),disabled:ye,"aria-label":"string"==typeof je?je:ie.upload,"aria-busy":ue||void 0,"aria-invalid":!!he||void 0,"aria-required":S||void 0,"aria-describedby":he?`${be}-error`:F?`${be}-hint`:void 0,...we.zoneProps,className:s(Le,ye,c(ye)),style:{minHeight:T},children:ue?/* @__PURE__ */j(d,{state:"busy",verb:me,pct:E}):/* @__PURE__ */k(x,{children:[
|
|
5
|
+
/* @__PURE__ */j("span",{className:"text-gray-400",children:/* @__PURE__ */j(l,{})}),
|
|
6
|
+
/* @__PURE__ */j("span",{className:"px-3 text-xs text-gray-500",children:je}),
|
|
7
|
+
/* @__PURE__ */j("span",{className:"text-sm font-medium text-blue-600",children:te}),K&&/* @__PURE__ */j("span",{className:"text-xs text-gray-400",children:K})]})});/* @__PURE__ */
|
|
8
|
+
return k(a,{label:U,htmlFor:be,hint:F,error:he,required:S,className:P,children:[X&&/* @__PURE__ */j("div",{"data-media-kind":"",className:"mb-2",children:/* @__PURE__ */j(u,{value:re,onChange:e=>X(e),options:[{value:"image",label:ie.image,icon:/* @__PURE__ */j(p,{name:"image","aria-hidden":"true",className:"h-4 w-4"}),disabled:ye},{value:"video",label:ie.video,icon:/* @__PURE__ */j(p,{name:"play","aria-hidden":"true",className:"h-4 w-4"}),disabled:ye}],block:!0,size:"md",label:"string"==typeof U&&U?U:ie.upload})}),w?Oe:Se,!C&&/* @__PURE__ */j("input",{...we.inputProps}),
|
|
9
|
+
/* @__PURE__ */j(h,{rejections:we.rejections})]})}export{w as MediaUploadField};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Tabs as e}from"./chunk-SXSMIMFY.js";import{Card as a}from"./chunk-
|
|
1
|
+
import{Tabs as e}from"./chunk-SXSMIMFY.js";import{Card as a}from"./chunk-VU6VPKM3.js";import{StatusBadgeProvider as r,StatusBadge as t}from"./chunk-D323R2FT.js";import{Button_default as l}from"./chunk-4IU5BSVE.js";import{useState as i}from"react";import{jsx as d,jsxs as s}from"react/jsx-runtime";var n={featured:"success",new:"active",draft:"draft"},c=["linear-gradient(135deg,#60a5fa,#a78bfa)","linear-gradient(135deg,#34d399,#10b981)","linear-gradient(135deg,#fbbf24,#f59e0b)","linear-gradient(135deg,#f472b6,#ec4899)","linear-gradient(135deg,#38bdf8,#6366f1)","linear-gradient(135deg,#fb7185,#ef4444)","linear-gradient(135deg,#4ade80,#22c55e)","linear-gradient(135deg,#c084fc,#8b5cf6)"].map((e,a)=>({id:a,title:["Sunrise","Forest","Desert","Bloom","Ocean","Ember","Meadow","Dusk"][a],tag:["featured","new","draft"][a%3],bg:e}));function m(){const[m,g]=i("all"),f="all"===m?c:c.filter(e=>e.tag===m);/* @__PURE__ */
|
|
2
2
|
return d(r,{groups:n,children:/* @__PURE__ */d("div",{className:"h-full overflow-auto bg-gray-50 p-6",children:/* @__PURE__ */s("div",{className:"mx-auto max-w-5xl space-y-4",children:[
|
|
3
3
|
/* @__PURE__ */s("div",{className:"flex items-center justify-between gap-4",children:[
|
|
4
4
|
/* @__PURE__ */d("h1",{className:"text-xl font-semibold text-gray-900",children:"Gallery"}),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{useShellLanguage as e}from"./chunk-
|
|
1
|
+
import{useShellLanguage as e}from"./chunk-QQCHLRKG.js";import{RadioGroup as a}from"./chunk-TZSPJIP4.js";import{Select_default as n}from"./chunk-VTVOQS5L.js";import{Icon as t}from"./chunk-KIBL6M3T.js";import{useShellStrings as l}from"./chunk-E6UCGCOC.js";import{jsxs as s,jsx as i}from"react/jsx-runtime";function r(e){const a=Math.max(0,...e.map(e=>[...e].reduce((e,a)=>e+((a.codePointAt(0)??0)>=11904?1:.62),0)));return Math.round(10*(a+3.5))/10}function m({size:a="sm",className:m=""}){const{language:o,languages:c,setLanguage:g}=e(),u=l().language;return c.length<2?null:/* @__PURE__ */s("span",{className:`inline-flex items-center gap-2 text-gray-500 ${m}`.trim(),children:[
|
|
2
2
|
/* @__PURE__ */i(t,{name:"globe","aria-hidden":!0,className:"h-4 w-4 shrink-0"}),
|
|
3
3
|
/* @__PURE__ */i("span",{className:"block",style:{width:`${r(c.map(e=>e.name))}em`},children:/* @__PURE__ */i(n,{size:a,touchSize:a,"aria-label":u.title,value:o,onChange:e=>{g(e)},options:c.map(({tag:e,name:a})=>({value:e,label:a,lang:e}))})})]})}function o({description:n,className:t=""}){const{language:r,languages:m,setLanguage:o}=e(),c=l().language;return m.length<2?null:/* @__PURE__ */s("div",{className:`space-y-4 ${t}`.trim(),children:[
|
|
4
4
|
/* @__PURE__ */s("div",{children:[
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{CloseGlyph as e}from"./chunk-
|
|
1
|
+
import{CloseGlyph as e}from"./chunk-DTSCO7VM.js";import{humanSize as t,useFileIntake as n,FileIntakeAlert as r}from"./chunk-YDYDR72S.js";import{IconButton_default as a}from"./chunk-4CANQ3B3.js";import{Button_default as s}from"./chunk-4IU5BSVE.js";import{Icon as i}from"./chunk-KIBL6M3T.js";import{useShellStrings as c}from"./chunk-E6UCGCOC.js";import{useRef as o,useEffect as l}from"react";import{jsx as d,jsxs as u}from"react/jsx-runtime";function m({className:e="h-4 w-4"}){/* @__PURE__ */
|
|
2
2
|
return d(i,{name:"attach",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:e})}function p({className:e="h-4 w-4"}){/* @__PURE__ */
|
|
3
3
|
return d(i,{name:"page",strokeWidth:1.6,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:e})}function h({intake:e,dropLabel:t,className:n="",children:r}){const a=c().files;/* @__PURE__ */
|
|
4
4
|
return u("div",{...e.zoneProps,...e.pasteProps,className:`relative ${n}`,children:[r,
|
|
@@ -6,8 +6,8 @@ return u("div",{...e.zoneProps,...e.pasteProps,className:`relative ${n}`,childre
|
|
|
6
6
|
return u("li",{className:"flex max-w-full items-center gap-2 rounded-md border border-gray-200 bg-gray-50 py-1 pl-2 pr-1 text-xs text-gray-700",children:[c?/* @__PURE__ */d("img",{src:c,alt:"",className:"h-6 w-6 shrink-0 rounded object-cover"}):/* @__PURE__ */d("span",{className:"text-gray-400",children:/* @__PURE__ */d(p,{})}),
|
|
7
7
|
/* @__PURE__ */d("span",{className:"min-w-0 truncate",title:n.name,children:n.name}),
|
|
8
8
|
/* @__PURE__ */d("span",{className:"shrink-0 tabular-nums text-gray-400",children:t(n.size,i)}),r&&/* @__PURE__ */d("button",{type:"button",disabled:a,onClick:()=>r(s),"aria-label":i.remove(n.name),className:"shrink-0 rounded p-0.5 text-gray-400 hover:bg-gray-200 hover:text-gray-600 disabled:cursor-not-allowed",children:/* @__PURE__ */d(e,{className:"h-3.5 w-3.5"})})]},`${n.name}-${n.size}-${s}`)})})}function f({onClick:e,count:t=0,variant:n="button",label:r,disabled:i=!1}){const o=c().files,l=r??o.attach,p=t>0?`${l} (${t})`:l;return"icon"===n?/* @__PURE__ */u("span",{className:"relative inline-flex",children:[
|
|
9
|
-
/* @__PURE__ */d(a,{"aria-label":p,onClick:e,disabled:i,size:"sm",children:/* @__PURE__ */d(m,{})}),t>0&&/* @__PURE__ */d("span",{"aria-hidden":"true",className:"pointer-events-none absolute -right-1 -top-1 min-w-[1rem] rounded-full bg-blue-600 px-1 text-center text-2xs font-semibold leading-4 text-white",children:t})]}):/* @__PURE__ */d(s,{type:"button",variant:"secondary",size:"sm",onClick:e,disabled:i,leftIcon:/* @__PURE__ */d(m,{}),children:p})}function g({files:e,onChange:t,accept:a,maxSizeBytes:s,maxFiles:i,acceptHint:c,disabled:m=!1,dropLabel:p,attachLabel:g,trigger:x="button",actions:j,onReject:k,className:N="",children:v}){const
|
|
10
|
-
/* @__PURE__ */d(b,{files:e,disabled:m,onRemove:n=>{
|
|
9
|
+
/* @__PURE__ */d(a,{"aria-label":p,onClick:e,disabled:i,size:"sm",children:/* @__PURE__ */d(m,{})}),t>0&&/* @__PURE__ */d("span",{"aria-hidden":"true",className:"pointer-events-none absolute -right-1 -top-1 min-w-[1rem] rounded-full bg-blue-600 px-1 text-center text-2xs font-semibold leading-4 text-white",children:t})]}):/* @__PURE__ */d(s,{type:"button",variant:"secondary",size:"sm",onClick:e,disabled:i,leftIcon:/* @__PURE__ */d(m,{}),children:p})}function g({files:e,onChange:t,accept:a,maxSizeBytes:s,maxFiles:i,acceptHint:c,disabled:m=!1,dropLabel:p,attachLabel:g,trigger:x="button",actions:j,onReject:k,className:N="",children:v}){const y=n({accept:a,maxSizeBytes:s,maxFiles:i,acceptHint:c,disabled:m,multiple:!0,currentCount:e.length,onAccept:n=>t([...e,...n])}),L=o([]);return l(()=>{k&&y.rejections.length>0&&y.rejections!==L.current&&(L.current=y.rejections,k(y.rejections))},[y.rejections,k]),/* @__PURE__ */u(h,{intake:y,dropLabel:p,className:N,children:[v,
|
|
10
|
+
/* @__PURE__ */d(b,{files:e,disabled:m,onRemove:n=>{y.clearRejections(),t(e.filter((e,t)=>t!==n))},className:"mt-2"}),
|
|
11
11
|
/* @__PURE__ */u("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[
|
|
12
|
-
/* @__PURE__ */d(f,{onClick:
|
|
13
|
-
/* @__PURE__ */d(r,{rejections:
|
|
12
|
+
/* @__PURE__ */d(f,{onClick:y.open,count:e.length,variant:x,label:g,disabled:m}),j]}),
|
|
13
|
+
/* @__PURE__ */d(r,{rejections:y.rejections})]})}export{f as AttachButton,h as AttachmentDropZone,b as AttachmentList,g as ComposerAttachments,m as PaperclipGlyph};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{isSafeLinkHref as e}from"./chunk-PJPK2ADX.js";import{Icon as r}from"./chunk-KIBL6M3T.js";import{useShellStrings as t}from"./chunk-
|
|
1
|
+
import{isSafeLinkHref as e}from"./chunk-PJPK2ADX.js";import{Icon as r}from"./chunk-KIBL6M3T.js";import{useShellStrings as t}from"./chunk-E6UCGCOC.js";import{jsx as n,jsxs as s}from"react/jsx-runtime";var a=/!\[([^\]]*)\]\(([^)]+)\)|\[([^\]]+)\]\(([^)]+)\)|\*\*([^*]+)\*\*|`([^`]+)`|\*([^*]+)\*/g,l=r=>e(r.trim());function c(e){const r=[];let t,c=0,o=0;for(a.lastIndex=0;null!==(t=a.exec(e));)t.index>c&&r.push(e.slice(c,t.index)),void 0!==t[1]?r.push(
|
|
2
2
|
/* @__PURE__ */s("span",{className:"text-gray-400",children:["[",t[1],"]"]},o++)):void 0!==t[3]?r.push(
|
|
3
3
|
/* @__PURE__ */n("a",{href:l(t[4])?t[4]:void 0,target:"_blank",rel:"noreferrer",className:"text-blue-600 hover:underline",children:t[3]},o++)):void 0!==t[5]?r.push(
|
|
4
4
|
/* @__PURE__ */n("strong",{className:"font-semibold text-gray-900",children:t[5]},o++)):void 0!==t[6]?r.push(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{useWindowMenuItem as e,Modal as t}from"./chunk-
|
|
1
|
+
import{useWindowMenuItem as e,Modal as t}from"./chunk-SG2MTCA2.js";import{navIcons as r}from"./chunk-CY5N5OA3.js";import{VERSION as s}from"./chunk-N3GETPME.js";import{Icon as o}from"./chunk-KIBL6M3T.js";import{DEFAULT_SHELL_STRINGS as n,useShellStrings as i,splitAround as a}from"./chunk-E6UCGCOC.js";import{useState as m,useCallback as c,isValidElement as l,cloneElement as d}from"react";import{jsx as p,jsxs as h}from"react/jsx-runtime";var u=n.aboutApp,f={spreadsheet:{name:"Spreadsheets",version:"1.1.3",route:"/spreadsheet",description:u.spreadsheet},notepad:{name:"Notepad",version:"1.0.2",route:"/notepad",description:u.notepad},documents:{name:"Documents",version:"1.1.1",route:"/documents",description:u.documents},preview:{name:"Preview",version:"1.4.3",route:"/preview",description:u.preview},files:{name:"Files",version:"1.1.3",route:"/files",description:u.files},browser:{name:"Browser",version:"1.0.2",route:"/browser",description:u.browser}},x=/* @__PURE__ */p(o,{name:"info",className:"h-4 w-4",strokeWidth:1.5}),v=/* @__PURE__ */p(o,{name:"window",className:"h-9 w-9",strokeWidth:1.5});function w({app:o}){const n=f[o],[u,w]=m(!1),N=c(()=>w(!0),[]),g=i().aboutApp,b=g.title(n.name);if(e(b,N,x),!u)return null;const y=r[n.route],k=l(y)?d(y,{className:"h-9 w-9"}):v,[j,C]=a(g.partOf);/* @__PURE__ */
|
|
2
2
|
return p(t,{open:!0,onClose:()=>w(!1),title:b,size:"sm",compact:!0,bodyScroll:!1,autoHeight:!0,dimensions:[320,320],children:/* @__PURE__ */h("div",{className:"flex flex-col items-center text-center px-5 pt-5 pb-4",children:[
|
|
3
3
|
/* @__PURE__ */p("div",{className:"flex h-16 w-16 items-center justify-center rounded-2xl bg-gray-100 text-gray-600 shrink-0",children:k}),
|
|
4
4
|
/* @__PURE__ */p("h2",{className:"mt-3 text-lg font-bold text-gray-900",children:n.name}),
|
|
@@ -6,4 +6,4 @@ return p(t,{open:!0,onClose:()=>w(!1),title:b,size:"sm",compact:!0,bodyScroll:!1
|
|
|
6
6
|
/* @__PURE__ */p("p",{className:"mt-2 text-xs text-gray-500 leading-relaxed",children:g[o]}),
|
|
7
7
|
/* @__PURE__ */h("div",{className:"mt-4 pt-3 border-t border-gray-200 w-full",children:[
|
|
8
8
|
/* @__PURE__ */h("p",{className:"text-2xs text-gray-500",children:[j,
|
|
9
|
-
/* @__PURE__ */p("span",{className:"font-medium text-gray-700",children:"efficient-shell"}),
|
|
9
|
+
/* @__PURE__ */p("span",{className:"font-medium text-gray-700",children:"efficient-shell"}),C]}),s&&/* @__PURE__ */p("p",{className:"mt-0.5 text-2xs font-mono text-gray-400",children:g.shellVersion(s)})]})]})})}export{w as AboutApp,f as BUILTIN_APP_INFO};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{railLabelsShown as e}from"./chunk-FQEALPZJ.js";import{CountBadge as t}from"./chunk-
|
|
1
|
+
import{railLabelsShown as e}from"./chunk-FQEALPZJ.js";import{CountBadge as t}from"./chunk-MAOJENIB.js";import{Tooltip as n}from"./chunk-22S6LG6D.js";import{useBrowserLayoutEffect as r}from"./chunk-D65T4H6J.js";import{createContext as o,useRef as a,useState as i,useEffect as l,useContext as s}from"react";import{jsx as c,jsxs as d,Fragment as u}from"react/jsx-runtime";var h=o({labels:"none",shown:"none"}),b="button[data-icon-rail-button]:not([disabled])";function f(e,t,n){const r=getComputedStyle(e),o=(parseFloat(r.paddingLeft)||0)+(parseFloat(r.paddingRight)||0)+(parseFloat(r.borderLeftWidth)||0)+(parseFloat(r.borderRightWidth)||0),a="horizontal"===t?(parseFloat(r.columnGap)||0)*Math.max(0,n-1):0,i=e.parentElement;let l=1/0;if(i){const e=getComputedStyle(i);l=i.clientWidth-(parseFloat(e.paddingLeft)||0)-(parseFloat(e.paddingRight)||0)}return{chrome:o+a,room:l}}function m({"aria-label":t,orientation:n="vertical",children:o,className:s="",labels:d="none",labelsFit:u=!1,onLabelsShown:m}){const p=a(null),g="none"!==d&&u,[y,v]=i(null),w="none"===d?"none":g?y??"none":"all",x=a(()=>{});x.current=()=>{const t=p.current;if(!t||!g)return;const r=function(e,t){return[...e.querySelectorAll("button[data-icon-rail-button]")].map(e=>{const n=getComputedStyle(e),r=(parseFloat(n.paddingLeft)||0)+(parseFloat(n.paddingRight)||0)+(parseFloat(n.borderLeftWidth)||0)+(parseFloat(n.borderRightWidth)||0),o=parseFloat(n.minWidth)||0,a=e.querySelector("[data-icon-rail-glyph]")?.getBoundingClientRect().width??0,i=e.querySelector("[data-icon-rail-word]")?.scrollWidth??0;return{bare:Math.max(o,r+a),worded:"below"===t?Math.max(o,r+Math.max(a,i)):Math.max(o,r+a+8+i),active:"true"===e.getAttribute("aria-pressed")}})}(t,d);v(e({buttons:r,orientation:n,...f(t,n,r.length)}))},r(()=>{x.current()}),l(()=>{const e=p.current?.parentElement;if(!g||!e)return;let t=!0;const n=()=>{t&&x.current()},r="undefined"==typeof ResizeObserver?void 0:ResizeObserver,o=r?new r(n):null;return o?.observe(e),document.fonts?.ready.then(n,()=>{}),()=>{t=!1,o?.disconnect()}},[g]);const F=a(null),k=a(m);k.current=m,l(()=>{g&&null!==y&&F.current!==y&&(F.current=y,k.current?.(y))},[g,y]),r(()=>{const e=p.current;if(!e)return;const t=[...e.querySelectorAll(b)];if(0===t.length)return;const n=t.find(e=>e===document.activeElement)??t.find(e=>"true"===e.getAttribute("aria-pressed"))??t[0];for(const t of e.querySelectorAll("button[data-icon-rail-button]"))t.tabIndex=t===n?0:-1});/* @__PURE__ */
|
|
2
2
|
return c("div",{ref:p,role:"toolbar","aria-label":t,"aria-orientation":n,"data-orientation":n,onKeyDown:e=>{const t=p.current;if(!t)return;const r=[...t.querySelectorAll(b)],o=r.indexOf(e.target);if(o<0)return;const a="vertical"===n?"ArrowUp":"ArrowLeft",i="vertical"===n?"ArrowDown":"ArrowRight",l=e.key===i?(o+1)%r.length:e.key===a?(o-1+r.length)%r.length:"Home"===e.key?0:"End"===e.key?r.length-1:-1;if(!(l<0)){e.preventDefault();for(const e of r)e.tabIndex=e===r[l]?0:-1;r[l].focus()}},"data-labels":"none"===d?void 0:d,"data-labels-shown":"none"===d?void 0:w,className:`flex gap-1 ${"vertical"===n?"flex-col items-center":"flex-row items-center"} ${s}`.trim(),children:/* @__PURE__ */c(h.Provider,{value:{labels:d,shown:w},children:o})})}function p({label:e,icon:r,active:o,disabled:a,onClick:i,badge:l,tooltipSide:b="right",className:f=""}){const m=!0===o,{labels:p,shown:g}=s(h),y=void 0===l||!1===l||0===l?r:/* @__PURE__ */c(t,{count:"number"==typeof l?l:void 0,dot:!0===l,max:99,children:r}),v="none"!==p,w=v&&("all"===g||"chosen"===g&&m),x=/* @__PURE__ */c("button",{type:"button","data-icon-rail-button":"","aria-label":e,"aria-pressed":"boolean"==typeof o?o:void 0,disabled:a,onClick:a?void 0:i,className:[`relative inline-flex ${v?"beside"===p?"h-9 min-w-9 justify-center px-2":"min-h-9 min-w-9 flex-col justify-center px-1 py-1":"h-9 w-9 justify-center"} shrink-0 items-center rounded-lg transition-colors`,"rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]","disabled:cursor-not-allowed disabled:opacity-40",m?"bg-blue-50 text-blue-700":"text-gray-600 not-disabled:not-aria-disabled:hover:bg-gray-100 not-disabled:not-aria-disabled:hover:text-gray-900",f].filter(Boolean).join(" "),children:v?/* @__PURE__ */d(u,{children:[
|
|
3
3
|
/* @__PURE__ */c("span",{"data-icon-rail-glyph":"",className:"inline-flex shrink-0 items-center justify-center",children:y}),
|
|
4
4
|
/* @__PURE__ */c("span",{"data-icon-rail-word":"","aria-hidden":"true",className:["overflow-hidden whitespace-nowrap text-xs font-medium leading-none",w?"beside"===p?"ml-2":"mt-1":"max-h-0 max-w-0"].join(" "),children:e})]}):y});/* @__PURE__ */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{resolveColumnShares as e,COLUMN_SHARES_EQUAL as t,COLUMN_SHARE_MIN as r,COLUMN_COUNT_MAX as n}from"./chunk-PLGJOHEG.js";import{InputNumber_default as o}from"./chunk-
|
|
2
|
-
return f("div",{role:"group","aria-label":P?void 0:N,"aria-labelledby":P,"aria-describedby":
|
|
1
|
+
import{resolveColumnShares as e,COLUMN_SHARES_EQUAL as t,COLUMN_SHARE_MIN as r,COLUMN_COUNT_MAX as n}from"./chunk-PLGJOHEG.js";import{InputNumber_default as o}from"./chunk-MTXTJLFK.js";import{Button_default as i}from"./chunk-4IU5BSVE.js";import{Tooltip as l}from"./chunk-22S6LG6D.js";import{useShellStrings as a}from"./chunk-E6UCGCOC.js";import{useId as s,useRef as c,useState as d,useEffect as u,Fragment as h}from"react";import{jsxs as f,jsx as m}from"react/jsx-runtime";var p=(e,t,r)=>Math.min(r,Math.max(t,e)),v=e=>e.reduce((e,t)=>e+t,0),g=(e,t)=>e.length===t.length&&e.every((e,r)=>e===t[r]);var y,b="w-0.5",w=`${b} group-hover/widths:w-1 group-focus-visible/widths:w-1`;var x=["text-blue-700","text-gray-600"];function k({count:k,value:C,onChange:$,label:N,"aria-labelledby":P,readOnly:j=!1,disabled:M=!1,footer:z=!0,className:R=""}){const S=a().widths,B=s(),T=p(Math.round(k)||1,1,n),A=e(C,T),D=A??[...t[T]??[]],E=[...D,100-v(D)],K=j||M,O=c(null),L=c({onChange:$,shown:D,locked:K,n:T,stored:A});L.current={onChange:$,shown:D,locked:K,n:T,stored:A};const G=t=>{const{onChange:r,shown:n,locked:o,n:i}=L.current;if(o)return!1;const l=e(t,i);return!(!l||g(l,n))&&(r(l),!0)},I=(e,t,n)=>{const o=e[t]+e[t+1],i=[...e];i[t]=p(Math.round(n),r,o-r),i[t+1]=o-i[t],G(i.slice(0,-1))&&(ie.current=null)},U=e=>t=>{if(t.altKey||t.ctrlKey||t.metaKey)return;const n=t.shiftKey?10:1,o=E[e]+E[e+1],i="ArrowRight"===t.key?E[e]+n:"ArrowLeft"===t.key?E[e]-n:"PageUp"===t.key?E[e]+10:"PageDown"===t.key?E[e]-10:"Home"===t.key?r:"End"===t.key?o-r:null;null!==i&&(t.preventDefault(),I(E,e,i))},F=c(null),[H,X]=d(null),J=()=>{F.current=null,X(null),document.body.style.removeProperty("cursor"),document.body.style.removeProperty("user-select")};u(()=>J,[]);const V=e=>t=>{if(0!==t.button||K)return;t.preventDefault();const r=O.current?.getBoundingClientRect().width??0;r<=0||(F.current={i:e,x:t.clientX,width:r,from:E,moved:!1,pointer:t.pointerId},X(e),t.currentTarget.setPointerCapture?.(t.pointerId),document.body.style.cursor="col-resize",document.body.style.userSelect="none")},W=e=>{const t=F.current;if(!t)return;if(0===e.buttons)return void J();const r=e.clientX-t.x;if(!t.moved){if(Math.abs(r)<3)return;t.moved=!0}I(t.from,t.i,t.from[t.i]+r/t.width*100)},q=e=>{const t=F.current;t&&(e.currentTarget.hasPointerCapture?.(t.pointer)&&e.currentTarget.releasePointerCapture(t.pointer),J())},Q=(e,t)=>{const{shown:n}=L.current,o=function(e,t,n){const o=e.length,i=[...e];if(o<2)return i;const l=p(Math.round(n),r,100-(o-1)*r);let a=l-i[t];i[t]=l;const s=[...Array.from({length:o-1-t},(e,r)=>t+1+r),...Array.from({length:t},(e,r)=>t-1-r)];if(a<0)return i[s[0]]-=a,i;for(const e of s){if(a<=0)break;const t=Math.min(a,i[e]-r);i[e]-=t,a-=t}return i}([...n,100-v(n)],e,t);return G(o.slice(0,-1))?o:null},[Y,Z]=d(0);u(()=>{const e=O.current;if(!e||"undefined"==typeof ResizeObserver)return;const t=new ResizeObserver(()=>Z(e.getBoundingClientRect().width));return t.observe(e),()=>t.disconnect()},[]);const _=c(null),[ee,te]=d(null),[re,ne]=d([]),oe=(e,t)=>te(r=>t?e:r===e?null:r),ie=c(null),le=(e,t)=>{const r=ie.current;if(!r||r.column!==e||r.share!==t)return!1;const{onChange:n,locked:o,stored:i}=L.current;var l,a;return o||(l=i,a=r.stored,void 0===l||void 0===a?l===a:g(l,a))||n(r.stored),!0},ae=E.join(",");u(()=>{const e=null===ee?[]:function(e,t){if(!e)return[];const r=Array.from(e.querySelectorAll("input[data-widths-label]")),n=r[t]?.getBoundingClientRect();if(!n||0===n.width)return[];if(void 0===y&&(y=document.createElement("canvas").getContext("2d")),!y)return[];const o=y;return r.flatMap((e,r)=>{if(r===t)return[];const i=e.getBoundingClientRect(),l=getComputedStyle(e);o.font=`${l.fontWeight} ${l.fontSize} ${l.fontFamily}`;const a=o.measureText(e.value).width/2,s=(i.left+i.right)/2;return s+a>n.left&&s-a<n.right?[r]:[]})}(_.current,ee);ne(t=>g(t,e)?t:e)},[ee,ae,Y]);const se=E.slice(0,-1).map((e,t)=>v(E.slice(0,t+1)));/* @__PURE__ */
|
|
2
|
+
return f("div",{role:"group","aria-label":P?void 0:N,"aria-labelledby":P,"aria-describedby":T>1?B:void 0,className:`flex w-full min-w-0 flex-col gap-2 ${M?"opacity-60":""} ${R}`.trim(),children:[
|
|
3
3
|
/* @__PURE__ */f("div",{ref:_,"data-widths-bar":"",className:"relative h-8",children:[
|
|
4
|
-
/* @__PURE__ */m("div",{ref:
|
|
5
|
-
/* @__PURE__ */m("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 rounded-(--radius-control) border border-gray-300"}),
|
|
6
|
-
return m("div",{className:"absolute inset-y-0 "+(n?"z-20":""),style:{left:`clamp(0px, calc(${i+e/2}% - ${l} / 2), calc(100% - ${l}))`,width:l},children:/* @__PURE__ */m(o,{appearance:"bare",value:e,display:()=>(e=>Y>0&&Y*e/100<36?String(e):`${e}%`)(e),suffix:"%",min:r,max:100-(
|
|
7
|
-
/* @__PURE__ */m("span",{id:B,"data-widths-hint":"",className:"text-2xs leading-tight text-gray-500 @max-[264px]:self-stretch",children:
|
|
8
|
-
/* @__PURE__ */m(i,{variant:"secondary",size:"sm",disabled:
|
|
4
|
+
/* @__PURE__ */m("div",{ref:O,"data-widths-track":"",className:"flex h-full w-full overflow-hidden rounded-(--radius-control) bg-white",children:E.map((e,t)=>/* @__PURE__ */m("div",{"data-widths-segment":"",style:{flexBasis:`${e}%`},className:`flex min-w-0 shrink-0 grow-0 items-center justify-center overflow-hidden whitespace-nowrap text-xs font-medium tabular-nums ${x[t%2]} ${t%2==0?"bg-blue-50":""}`,children:1===T&&/* @__PURE__ */m("span",{"data-widths-label":"",children:`${e}%`})},t))}),
|
|
5
|
+
/* @__PURE__ */m("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 rounded-(--radius-control) border border-gray-300"}),T>1&&E.map((e,t)=>/* @__PURE__ */f(h,{children:[(()=>{const n=ee===t,i=v(E.slice(0,t)),l=n?`max(${e}%, 40px)`:`${e}%`;/* @__PURE__ */
|
|
6
|
+
return m("div",{className:"absolute inset-y-0 "+(n?"z-20":""),style:{left:`clamp(0px, calc(${i+e/2}% - ${l} / 2), calc(100% - ${l}))`,width:l},children:/* @__PURE__ */m(o,{appearance:"bare",value:e,display:()=>(e=>Y>0&&Y*e/100<36?String(e):`${e}%`)(e),suffix:"%",min:r,max:100-(T-1)*r,step:1,shiftStep:10,precision:0,allowEmpty:!1,reportWhileTyping:!1,readOnly:j,disabled:M,"aria-label":S.column(t+1),"aria-describedby":B,"data-widths-label":"",onChange:e=>{null===e||le(t,e)||Q(t,e)},onRevert:e=>((e,t)=>{L.current.locked||null===t||le(e,t)||Q(e,t)})(t,e),onFocus:()=>{ie.current={column:t,share:e,stored:L.current.stored},oe(t,!0)},onBlur:()=>oe(t,!1),className:`absolute inset-0 text-xs font-medium ${x[t%2]} ${re.includes(t)&&!n?"opacity-0":""}`})})})(),t<T-1&&/* @__PURE__ */m("div",{className:"absolute inset-y-0 z-10 w-3 -translate-x-1/2",style:{left:`${se[t]}%`},children:/* @__PURE__ */m(l,{content:S.dragHint,delay:600,className:"relative flex h-full w-full",children:/* @__PURE__ */m("div",{role:"separator",tabIndex:M?-1:0,"aria-orientation":"vertical","aria-label":S.divider(t+1,t+2),"aria-valuenow":E[t],"aria-valuemin":r,"aria-valuemax":E[t]+E[t+1]-r,"aria-valuetext":S.dividerValue(t+1,E[t],t+2,E[t+1]),"aria-disabled":K||void 0,onKeyDown:K?void 0:U(t),onPointerDown:V(t),onPointerMove:W,onPointerUp:q,onPointerCancel:q,onLostPointerCapture:()=>{F.current&&J()},className:"group/widths flex h-full w-full touch-none justify-center rounded-(--radius-control) rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)] "+(K?"cursor-default":"cursor-col-resize"),children:/* @__PURE__ */m("span",{"aria-hidden":"true","data-widths-line":"",className:"h-full rounded-full "+(K?`${b} bg-gray-300`:`bg-blue-600 transition-[width,background-color] duration-(--motion-fast) group-hover/widths:bg-blue-700 ${H===t?"w-1":w}`)})})})})]},t))]}),T>1&&!z&&/* @__PURE__ */m("span",{id:B,className:"sr-only",children:S.hint(T,r)}),T>1&&z&&/* @__PURE__ */m("div",{"data-widths-footer":"",className:"@container",children:/* @__PURE__ */f("div",{className:"flex items-center justify-between gap-2 @max-[264px]:flex-col @max-[264px]:items-end",children:[
|
|
7
|
+
/* @__PURE__ */m("span",{id:B,"data-widths-hint":"",className:"text-2xs leading-tight text-gray-500 @max-[264px]:self-stretch",children:S.hint(T,r)}),
|
|
8
|
+
/* @__PURE__ */m(i,{variant:"secondary",size:"sm",disabled:K,onClick:()=>{K||void 0===C||$(void 0)},className:"shrink-0",children:S.reset})]})})]})}export{k as WidthsBar};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import{firstEnabledIndex as e,matchTypeahead as t,lastEnabledIndex as r,nextEnabledIndex as n}from"./chunk-EO5RLFRX.js";import{flattenOptionItems as i,groupedRows as a,isOptionGroup as l,OptionCheck as o}from"./chunk-UQBPKZUR.js";import{useSettingAuto as d}from"./chunk-E4Z5OXBI.js";import{inputClasses as s,PLACEHOLDER_INK as c}from"./chunk-JFSYWEHD.js";import{useIsMobile as u}from"./chunk-UGTRSRIW.js";import{optionNoteClass as p}from"./chunk-QR4RM7PO.js";import{Icon as m}from"./chunk-KIBL6M3T.js";import{onOverlayOpen as v}from"./chunk-PGN5ME7B.js";import{Z_LAYERS as h}from"./chunk-62LW225J.js";import{useDropdownPosition as f,MENU_MAX_HEIGHT as b}from"./chunk-GLUJS42B.js";import{solidSurfaceStyle as g}from"./chunk-DTJRIWFR.js";import{registerModalEscapeInterceptor as y}from"./chunk-TWVUQUUD.js";import{useShellStrings as x}from"./chunk-E6UCGCOC.js";import{forwardRef as w,useId as k,useState as N,useRef as $,useMemo as D,useCallback as j,useEffect as E,useLayoutEffect as T}from"react";import{createPortal as C}from"react-dom";import{jsxs as I,jsx as O,Fragment as S}from"react/jsx-runtime";var H=w(function({value:e,onChange:t,options:r,placeholder:n,invalid:i,className:a="",size:l,touchSize:o,renderOption:c,renderValue:u,valueText:p,readOnly:m,footer:v,changed:h,auto:f,multiple:b,"aria-describedby":g,...y},w){const N=t,$=x(),D=d(),j=f??D,E=k(),T=/* @__PURE__ */I("select",{ref:w,value:e,multiple:b||void 0,onChange:e=>N(b?Array.from(e.target.selectedOptions,e=>e.value):e.target.value),"aria-invalid":i||void 0,"aria-describedby":[g,j?E:void 0].filter(Boolean).join(" ")||void 0,className:s({invalid:i,size:l,auto:j,className:`pr-8 ${a}`.trim()}),...y,children:[void 0!==n&&!b&&/* @__PURE__ */O("option",{value:"",disabled:!0,children:n}),
|
|
2
|
+
/* @__PURE__ */O(R,{items:r})]});return j?/* @__PURE__ */I(S,{children:[T,
|
|
3
|
+
/* @__PURE__ */O("span",{id:E,hidden:!0,children:$.settingView.auto})]}):T});function R({items:e}){const t=e=>/* @__PURE__ */O("option",{value:e.value,disabled:e.disabled,lang:e.lang,children:e.label},e.value);/* @__PURE__ */
|
|
4
|
+
return O(S,{children:e.map((e,r)=>(e=>l(e))(e)?/* @__PURE__ */O("optgroup",{label:e.label,children:e.options.map(t)},`group-${r}`):t(e))})}var z=w(function({value:l,onChange:u,options:w,placeholder:H,invalid:z,className:B="",id:U,disabled:K,size:A,touchSize:P,title:V,multiple:W,renderOption:F,renderValue:L,valueText:M,readOnly:G=!1,footer:J,changed:Q=!1,auto:q,"aria-describedby":X,"aria-label":Y,"aria-labelledby":Z,..._},ee){const[te,re]=N(!1),[ne,ie]=N(-1),ae=$(null),le=$(null),oe=$(null),de=$(null),se=$([]),ce=()=>de.current??oe.current,ue=!!J?.length,pe="sm"===A,me=pe?"min-h-7 px-3 py-1 text-xs leading-4":"min-h-(--row-height-menu) px-3 py-2 text-sm leading-5",ve=p(pe),[he,fe]=N(null),be=x(),ge=$(te);ge.current=te;const ye=$({buffer:"",timer:null}),xe=k(),we=`${xe}-listbox`,ke=U??`${xe}-trigger`,Ne=e=>`${xe}-opt-${e}`,$e=`${xe}-changed`,De=d(),je=q??De,Ee=`${xe}-auto`,Te=[X,Q?$e:void 0,je?Ee:void 0].filter(Boolean).join(" ")||void 0,Ce=D(()=>i(w),[w]),Ie=W?l:[],Oe=u,Se=f(le,te,{matchTriggerWidth:!0,...J?.length?{preferredMaxHeight:Number.POSITIVE_INFINITY}:{}}),He="undefined"==typeof window?E:T,Re=`${te}|${Se?.top}|${Se?.bottom}|${Se?.maxHeight}|${w.length}`;He(()=>{fe(null)},[Re]),He(()=>{const e=oe.current;if(!te||!e||null!==he)return;if(e.scrollHeight<=e.clientHeight+1)return;const t=getComputedStyle(e),r=parseFloat(t.paddingTop)||0;parseFloat(t.paddingBottom);const n=e.getBoundingClientRect().top;let i=0;for(const t of e.querySelectorAll('[role="option"]')){const r=t.getBoundingClientRect().bottom-n+e.scrollTop;if(!(r<=e.clientHeight+.5))break;i=r}i>r&&fe(Math.floor(i))},[te,he,Re]);const ze=W?Ce.findIndex(e=>Ie.includes(e.value)):Ce.findIndex(e=>e.value===l),Be=W?Ce.filter(e=>Ie.includes(e.value)).map(e=>e.label).join(", ")||void 0:ze>=0?Ce[ze].label:void 0,Ue=!W&&ze>=0?Ce[ze].lang:void 0,Ke=W?Ce.filter(e=>Ie.includes(e.value)):ze>=0?[Ce[ze]]:[],Ae=L&&Ke.length?L(Ke):void 0,Pe=void 0!==Ae&&M?M(Ke):void 0,Ve=j((e=!0)=>{re(!1),ie(-1),e&&le.current?.focus()},[]),We=j(()=>{K||G||(ie(ze>=0?ze:e(Ce)),re(!0))},[K,G,Ce,ze]),Fe=j(e=>{const t=Ce[e];if(t&&!t.disabled){if(W){const r=l;return Oe(r.includes(t.value)?r.filter(e=>e!==t.value):[...r,t.value]),void ie(e)}Oe(t.value),Ve()}},[Ce,W,l,Oe,Ve]);E(()=>{if(!te)return;return y(e=>!("Escape"!==e.key||!ge.current)&&(Ve(),!0),ce)},[te,Ve]),E(()=>{if(!te)return;const e=e=>{const t=e.target;ae.current?.contains(t)||ce()?.contains(t)||Ve(!1)};document.addEventListener("pointerdown",e);const t=v(()=>Ve(!1));return()=>{document.removeEventListener("pointerdown",e),t()}},[te,Ve]),E(()=>{!te||ne<0||oe.current?.querySelector(`#${CSS.escape(Ne(ne))}`)?.scrollIntoView({block:"nearest"})},[te,ne]);const Le=j(e=>{const r=ye.current;r.timer&&clearTimeout(r.timer),r.buffer+=e,r.timer=setTimeout(()=>{r.buffer="",r.timer=null},500);const n=te?ne:ze,i=t(Ce,r.buffer,n);i<0||(te?ie(i):W?(ie(i),re(!0)):Fe(i))},[te,ne,ze,Ce,Fe,W]),Me=te?a(w,(e,t)=>{const r=(n=e.value,W?Ie.includes(n):l===n);var n;const i=t===ne;/* @__PURE__ */
|
|
5
|
+
return I("div",{id:Ne(t),role:"option",lang:e.description||F?void 0:e.lang,"aria-selected":r,"aria-disabled":e.disabled||void 0,onPointerEnter:()=>{e.disabled||ie(t)},onClick:()=>Fe(t),className:`mx-1 cursor-pointer truncate rounded-lg ${me}${W?" flex items-center gap-2":""}\n ${e.disabled?"cursor-not-allowed text-gray-400":i?"bg-blue-50 text-blue-700":r?"font-medium text-blue-600":"text-gray-700"}`,children:[W&&/* @__PURE__ */O(o,{selected:r}),F?/* @__PURE__ */O("span",{className:"block min-w-0 flex-1 truncate",children:F(e,{selected:r,active:i})}):W?/* @__PURE__ */I("span",{className:"block min-w-0 flex-1",children:[
|
|
6
|
+
/* @__PURE__ */O("span",{lang:e.lang,className:"block truncate",children:e.label}),e.description&&/* @__PURE__ */O("span",{className:ve,children:e.description})]}):e.description?
|
|
7
|
+
/* @__PURE__ */I(S,{children:[
|
|
8
|
+
/* @__PURE__ */O("span",{lang:e.lang,className:"block truncate",children:e.label}),
|
|
9
|
+
/* @__PURE__ */O("span",{className:ve,children:e.description})]}):e.label]},e.value)},xe,"mx-1"):null,Ge=void 0!==Ae?
|
|
10
|
+
/* @__PURE__ */I("span",{className:"relative block min-w-0 truncate",children:[
|
|
11
|
+
/* @__PURE__ */O("span",{"aria-hidden":"true","data-select-value":"",className:"flex min-w-0 items-center gap-2 truncate",children:Ae}),
|
|
12
|
+
/* @__PURE__ */O("span",{lang:void 0===Pe?Ue:void 0,className:"sr-only",children:Pe??Be})]}):/* @__PURE__ */O("span",{lang:Ue,className:"block truncate "+(void 0===Be?"text-gray-400":""),children:Be??H??" "}),Je={zIndex:h.popup,left:Se?.left,top:Se?.top,bottom:Se?.bottom,width:Se?.width,maxHeight:Se?.maxHeight??b,visibility:Se?void 0:"hidden",...g()},Qe=/* @__PURE__ */O("div",{ref:oe,id:we,role:"listbox","aria-labelledby":Z??(Y?void 0:ke),"aria-label":Z?void 0:Y,"aria-multiselectable":W||void 0,className:ue?"min-h-0 shrink overflow-y-auto py-1":"fixed overflow-y-auto rounded-(--radius-popup) py-1",style:ue?null!==he?{maxHeight:he}:void 0:null!==he?{...Je,maxHeight:he}:Je,children:Me}),qe=ue?/* @__PURE__ */I("div",{ref:de,className:"fixed flex flex-col overflow-hidden rounded-(--radius-popup)",style:Je,children:[Qe,
|
|
13
|
+
/* @__PURE__ */O("div",{className:"shrink-0 border-t border-(--rosh-glass-solid-border) px-1 py-1",children:J.map((e,t)=>/* @__PURE__ */I("button",{ref:e=>{se.current[t]=e},type:"button","data-select-action":"","aria-disabled":e.disabled||void 0,onClick:()=>(e=>{e.disabled||(Ve(),e.onSelect())})(e),onKeyDown:e=>((e,t)=>{const r=(J?.length??0)-1,n=t=>{e.preventDefault(),se.current[t]?.focus()},i=()=>{e.preventDefault(),le.current?.focus()};switch(e.key){case"ArrowDown":return void n(Math.min(t+1,r));case"ArrowUp":return void(0===t?i():n(t-1));case"Home":return void n(0);case"End":return void n(r);case"Tab":return e.shiftKey?void(0===t?i():n(t-1)):t<r?void n(t+1):(e.preventDefault(),void Ve());case"Escape":return e.preventDefault(),e.stopPropagation(),void Ve()}})(e,t),className:`flex w-full items-center gap-2 rounded-lg ${me} text-left rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)] ${e.disabled?"cursor-not-allowed text-gray-400":"cursor-pointer text-gray-700 hover:bg-blue-50 hover:text-blue-700"}`,children:[e.icon&&/* @__PURE__ */O(m,{name:e.icon,"aria-hidden":"true",className:"h-4 w-4 shrink-0"}),
|
|
14
|
+
/* @__PURE__ */O("span",{className:"min-w-0 flex-1 truncate",children:e.label})]},e.label))})]}):Qe;/* @__PURE__ */
|
|
15
|
+
return I("div",{ref:ae,className:"relative",children:[
|
|
16
|
+
/* @__PURE__ */O("button",{ref:le,id:ke,type:"button",role:"combobox","aria-haspopup":"listbox","aria-expanded":te,"aria-controls":te?we:void 0,"aria-activedescendant":te&&ne>=0?Ne(ne):void 0,"aria-invalid":z||void 0,"aria-describedby":Te,"aria-label":Y,"aria-labelledby":Z,title:V,disabled:K,"aria-readonly":G||void 0,onClick:()=>te?Ve():We(),onKeyDown:t=>{if(!K&&!G)switch(t.key){case"ArrowDown":return t.preventDefault(),void(te?ie(e=>n(Ce,e,1)):We());case"ArrowUp":return t.preventDefault(),void(te?ie(e=>n(Ce,e,-1)):We());case"Home":return void(te&&(t.preventDefault(),ie(e(Ce))));case"End":return void(te&&(t.preventDefault(),ie(r(Ce))));case"Enter":return void(te&&(t.preventDefault(),Fe(ne)));case" ":return t.preventDefault(),void(te?Fe(ne):We());case"Escape":return void(te&&(t.preventDefault(),t.stopPropagation(),Ve()));case"Tab":return te&&ue&&!t.shiftKey?(t.preventDefault(),void se.current[0]?.focus()):void(te&&Ve(!1));default:1!==t.key.length||t.metaKey||t.ctrlKey||t.altKey||(t.preventDefault(),Le(t.key))}},className:s({invalid:z,size:A,readOnly:G,auto:je,className:`${G?"":"pr-8 "}text-left ${B}`.trim()}),children:Q?
|
|
17
|
+
/* @__PURE__ */I("span",{className:"flex min-w-0 items-center gap-1",children:[Ge,
|
|
18
|
+
/* @__PURE__ */O("span",{"aria-hidden":"true","data-select-changed":"",className:"shrink-0",children:"*"})]}):Ge}),Q&&/* @__PURE__ */O("span",{id:$e,hidden:!0,children:be.select.changed}),je&&/* @__PURE__ */O("span",{id:Ee,hidden:!0,children:be.settingView.auto}),!G&&/* @__PURE__ */O(m,{name:"chevron-up-down","aria-hidden":"true",className:`pointer-events-none absolute right-2.5 top-1/2 h-4 w-4 -translate-y-1/2 ${c}`,strokeWidth:2}),
|
|
19
|
+
/* @__PURE__ */I("select",{ref:ee,value:l,multiple:W||void 0,onChange:e=>Oe(W?Array.from(e.target.selectedOptions,e=>e.value):e.target.value),disabled:K,"aria-hidden":"true",tabIndex:-1,className:"sr-only",..._,children:[void 0!==H&&!W&&/* @__PURE__ */O("option",{value:"",disabled:!0,children:H}),
|
|
20
|
+
/* @__PURE__ */O(R,{items:w})]}),te&&C(qe,document.body)]})}),B=w(function({touchSize:e="touch",...t},r){const n=u();return!n||void 0===t.footer&&void 0===t.changed||t.readOnly?n&&!t.readOnly?/* @__PURE__ */O(H,{ref:r,...t,size:e}):/* @__PURE__ */O(z,{ref:r,...t}):/* @__PURE__ */O(z,{ref:r,...t,size:e})});export{H as NativeSelect,B as Select_default};
|