@objectstack/console 17.5.0 → 17.6.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/CHANGELOG.md +378 -0
- package/dist/.objectstack-injection.json +2 -2
- package/dist/.objectui-sha +1 -1
- package/dist/assets/{ActionResultDialog-CLdIyOW6.js → ActionResultDialog-4kHDGnT3.js} +3 -3
- package/dist/assets/{AiPendingActionsPage-OKYz66yR.js → AiPendingActionsPage-JjOddm0h.js} +1 -1
- package/dist/assets/{ApiConsolePage-CcrKovu8.js → ApiConsolePage-BgS26lbp.js} +1 -1
- package/dist/assets/AppDocsIndex-BDoH5ECM.js +1 -0
- package/dist/assets/{AppManagementPage-D_xz8cTZ.js → AppManagementPage-CCgKmNTj.js} +1 -1
- package/dist/assets/ApprovalsInboxPage-C6S1vk0X.js +1 -0
- package/dist/assets/AuditLogPage-v2dKXMuk.js +1 -0
- package/dist/assets/BookPage-DwFMcTSN.js +1 -0
- package/dist/assets/{ComponentNavView-BxsixSU9.js → ComponentNavView-B5g9c6fx.js} +1 -1
- package/dist/assets/{CreateViewDialog-xyKlpLEW.js → CreateViewDialog-D3l-tYHM.js} +1 -1
- package/dist/assets/DashboardView-BOcovpPd.js +1 -0
- package/dist/assets/DocPage-B6AkH5WI.js +1 -0
- package/dist/assets/{DocsIndex-B2zw_HAp.js → DocsIndex-DwW2QsYY.js} +1 -1
- package/dist/assets/{DocsLayout-DezZ8x7_.js → DocsLayout-D63StSgd.js} +1 -1
- package/dist/assets/DocsSlug-CP9fcabi.js +1 -0
- package/dist/assets/ExpressionProvider-CrL6jhVq.js +1 -0
- package/dist/assets/{FlowRunsPage-CvY3nJMF.js → FlowRunsPage-CxdaiUyk.js} +1 -1
- package/dist/assets/{IntegrationsPage-2leVkVDH.js → IntegrationsPage-DvG0x0Nb.js} +2 -2
- package/dist/assets/{InterfaceListPage-BdECC_i3.js → InterfaceListPage-C4wPYohR.js} +1 -1
- package/dist/assets/{MarketplaceInstalledPage-EPPHSitW.js → MarketplaceInstalledPage-B7KETQG2.js} +1 -1
- package/dist/assets/MarketplacePackagePage-CfgKDpNH.js +4 -0
- package/dist/assets/{MarketplacePage-BnQKykgv.js → MarketplacePage-DNEyU5AE.js} +1 -1
- package/dist/assets/{MetadataInspector-BWxLkr0O.js → MetadataInspector-EP0I3-Kq.js} +1 -1
- package/dist/assets/{ObjectDataPage-BIzp65Mo.js → ObjectDataPage-CykEm9MD.js} +1 -1
- package/dist/assets/PageView-C6u86tni.js +1 -0
- package/dist/assets/{ProfilePage-D2qGgxPK.js → ProfilePage-C3SjXMzi.js} +1 -1
- package/dist/assets/{PublicFormsPage-DlE6tck_.js → PublicFormsPage-D3uCTR-8.js} +1 -1
- package/dist/assets/RecordDetailView-DgR_zhP4.js +3 -0
- package/dist/assets/RecordFormPage-kiJI-ieF.js +1 -0
- package/dist/assets/ReportDefaultInspector-BIinF0EQ.js +1 -0
- package/dist/assets/{ReportView-GIdKJdOt.js → ReportView-BREO-ADE.js} +1 -1
- package/dist/assets/{RuntimeDraftBar-BbMdi3Kp.js → RuntimeDraftBar-BCWfd2yS.js} +1 -1
- package/dist/assets/SchemaForm-C4uMMZ13.js +3 -0
- package/dist/assets/SearchResultsPage-C6Hw_Lpn.js +1 -0
- package/dist/assets/{SettingsHub-BGKIj-Zq.js → SettingsHub-DP1mrzEN.js} +1 -1
- package/dist/assets/SettingsView-u7mc6pcc.js +1 -0
- package/dist/assets/{SkeletonDetail-C8fMI-Mu.js → SkeletonDetail-DIwlbHTr.js} +1 -1
- package/dist/assets/{af-BfSmLD34.js → af-DPUgkQl0.js} +1 -1
- package/dist/assets/ai-DPBykF2N.js +3 -0
- package/dist/assets/{app-shell-eager-leaves-CDVclng4.js → app-shell-eager-leaves-Cf2bM6uT.js} +1 -1
- package/dist/assets/{ar-B9ttrM75.js → ar-B-6GTIRU.js} +1 -1
- package/dist/assets/{ar-DZ-C1rn-cyl.js → ar-DZ-wEl298ti.js} +1 -1
- package/dist/assets/{ar-EG-BaDxKP_o.js → ar-EG-YBT90_S0.js} +1 -1
- package/dist/assets/{ar-MA-DbxNEcmd.js → ar-MA-3uT-EYh6.js} +1 -1
- package/dist/assets/{ar-SA-DeC5LXcX.js → ar-SA-SiQsjhhc.js} +1 -1
- package/dist/assets/{ar-TN-C9KpTFJz.js → ar-TN-CfzXjKzS.js} +1 -1
- package/dist/assets/{az-cMerDwRO.js → az-BqAfcNza.js} +1 -1
- package/dist/assets/{be-ZTSbszQh.js → be-CQgWXa9_.js} +1 -1
- package/dist/assets/{be-tarask-BXZEUrgX.js → be-tarask-BmNg0Sir.js} +1 -1
- package/dist/assets/{bg-BDogpmn5.js → bg-D3evgRuS.js} +1 -1
- package/dist/assets/{bn-Cz04uxmh.js → bn-uItkARwm.js} +1 -1
- package/dist/assets/{bs-CpFnCl-j.js → bs-DueReOpO.js} +1 -1
- package/dist/assets/{ca-CHC4M52Z.js → ca-Cr3AHktR.js} +1 -1
- package/dist/assets/{ckb-Dxw-RNm8.js → ckb-CTi5BET7.js} +1 -1
- package/dist/assets/contracts-DieHW666.js +1 -0
- package/dist/assets/{createDerive-DvA_JGNq.js → createDerive-CjN1i5vn.js} +1 -1
- package/dist/assets/{cs-DsFaJ5Z7.js → cs-43mFX9jr.js} +1 -1
- package/dist/assets/{cy-FH4JFDTs.js → cy-BBSkg3F8.js} +1 -1
- package/dist/assets/{da-D1pVjaAq.js → da-C5oA5qcs.js} +1 -1
- package/dist/assets/data-adapter-Cymvlczj.js +1 -0
- package/dist/assets/{de-AT-DUMQCisj.js → de-AT-CApxwJzu.js} +1 -1
- package/dist/assets/{de-DKrxSvnP.js → de-CPtbLlAf.js} +1 -1
- package/dist/assets/default-inspector-registry-Bs6GBn00.js +1 -0
- package/dist/assets/dist-BF-ssUpn.js +14 -0
- package/dist/assets/{el-l3-bHySV.js → el-Dto2xBQU.js} +1 -1
- package/dist/assets/en-AU-FVwCiDJO.js +1 -0
- package/dist/assets/{en-CA-DGH5NF0a.js → en-CA-DKuJPN1U.js} +1 -1
- package/dist/assets/en-GB-DQ_y5VbJ.js +1 -0
- package/dist/assets/en-IE-DaXOhsZW.js +1 -0
- package/dist/assets/en-IN-CnRZnAom.js +1 -0
- package/dist/assets/en-NZ-CBZLEToK.js +1 -0
- package/dist/assets/en-ZA-BE59v0wZ.js +1 -0
- package/dist/assets/{eo-CL6CXHZx.js → eo-BL8JXIWd.js} +1 -1
- package/dist/assets/{es-BIJ0rksI.js → es-BnoaNxsu.js} +1 -1
- package/dist/assets/{et-BGgMzjm1.js → et-tPYLNenO.js} +1 -1
- package/dist/assets/{eu-CqvAoRrX.js → eu-CUBG6bT0.js} +1 -1
- package/dist/assets/{fa-IR-DNz3oA1-.js → fa-IR-Rr2d9xSs.js} +1 -1
- package/dist/assets/{fi-DNSfKWuW.js → fi-B0NVIZsV.js} +1 -1
- package/dist/assets/{formatLong-CHb9WA3O.js → formatLong-1-gt9bpo.js} +1 -1
- package/dist/assets/{fr-DYRJCirJ.js → fr-BbhHek8e.js} +1 -1
- package/dist/assets/{fr-CA-CotiswPx.js → fr-CA-CBDvLXFg.js} +1 -1
- package/dist/assets/{fr-CH-CpiEYWpc.js → fr-CH-WPNmwPn7.js} +1 -1
- package/dist/assets/framework-DFR4HNtj.js +35 -0
- package/dist/assets/{fy-B69yM3FE.js → fy-DvOBbvEF.js} +1 -1
- package/dist/assets/{gd-BAy8AsX6.js → gd-BQPiTPX5.js} +1 -1
- package/dist/assets/getIcon-Cfwf-Egt.js +1 -0
- package/dist/assets/{gl-soLn_weL.js → gl-BJCXK8uO.js} +1 -1
- package/dist/assets/{gu-B19Yo9yC.js → gu-CctPRz3V.js} +1 -1
- package/dist/assets/{he-DYTPo33p.js → he-CVFMk6p2.js} +1 -1
- package/dist/assets/{hi-D2dIK7Oy.js → hi-Ba30-RwS.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-CExufvVt.js → highlighted-body-OFNGDK62-BQ57IrBV.js} +1 -1
- package/dist/assets/{hr-BV-VOPMu.js → hr-BZUqTbZs.js} +1 -1
- package/dist/assets/{ht-C7MM4qkS.js → ht-BLe05tPx.js} +1 -1
- package/dist/assets/{hu-Rha1m2Ym.js → hu-2CQ_Mkww.js} +1 -1
- package/dist/assets/{hy-CiTNgbdV.js → hy-CclcPG4H.js} +1 -1
- package/dist/assets/i18n-BnUsCaSC.js +17 -0
- package/dist/assets/i18n-locale-ar-92O_xtDZ.js +4 -0
- package/dist/assets/i18n-locale-de-T5ic3yH9.js +4 -0
- package/dist/assets/i18n-locale-en-rxr7WJYl.js +4 -0
- package/dist/assets/i18n-locale-es-D_WOifJ_.js +4 -0
- package/dist/assets/i18n-locale-fr-3cvyjMkp.js +4 -0
- package/dist/assets/i18n-locale-ja-DXlIkB8I.js +4 -0
- package/dist/assets/i18n-locale-ko-DngRpS45.js +4 -0
- package/dist/assets/i18n-locale-pt-BkPaFCqZ.js +4 -0
- package/dist/assets/i18n-locale-ru-E5wLh-y6.js +4 -0
- package/dist/assets/i18n-locale-zh-BL4_Yand.js +4 -0
- package/dist/assets/{i18n-runtime-CTgAQF4N.js → i18n-runtime-97_bDVjP.js} +1 -1
- package/dist/assets/{id-Cijsfjt-.js → id-6JLB8s-f.js} +1 -1
- package/dist/assets/index-Cadlh4t_.css +2 -0
- package/dist/assets/index-D98sa5GF.js +20 -0
- package/dist/assets/{infrastructure-BHSync5f.js → infrastructure-Cc34lEqb.js} +2 -2
- package/dist/assets/integration-CeAF4JFT.js +1 -0
- package/dist/assets/{is-xS1WTyeC.js → is-to0CWzm1.js} +1 -1
- package/dist/assets/isSameWeek-DBXaA1Gd.js +1 -0
- package/dist/assets/{it-CH-l516ZNXj.js → it-CH-DhdfjP5Z.js} +1 -1
- package/dist/assets/{it-C2i_c9sd.js → it-ea0B8Ujp.js} +1 -1
- package/dist/assets/{ja-D9_ewLny.js → ja-B1bzkgDW.js} +1 -1
- package/dist/assets/{ja-Hira-D_6ExgHw.js → ja-Hira-CMrY5hXO.js} +1 -1
- package/dist/assets/{ka-BYHGyees.js → ka-DKSXLnXP.js} +1 -1
- package/dist/assets/{kk-CbTFtuqb.js → kk-DHwMv8Dn.js} +1 -1
- package/dist/assets/{km-Dr2gwhIn.js → km-tpLG1xNr.js} +1 -1
- package/dist/assets/{kn-CprH8JD7.js → kn-MLreVnHA.js} +1 -1
- package/dist/assets/{ko-CsFS2u5i.js → ko-CI0DBazn.js} +1 -1
- package/dist/assets/{lb-CbFKN7Ob.js → lb-CmL572Xe.js} +1 -1
- package/dist/assets/{lt-Bq0xkLp0.js → lt-DRtUOLdw.js} +1 -1
- package/dist/assets/{lv-Cj6vg6Qo.js → lv-COSHgkOP.js} +1 -1
- package/dist/assets/{match-C_jFGO9e.js → match-B-ergJQb.js} +1 -1
- package/dist/assets/{match-CiPp9BME.js → match-BQoOW8Cj.js} +1 -1
- package/dist/assets/{match-Co4ivumx.js → match-dfBS0YSQ.js} +1 -1
- package/dist/assets/mermaid-GHXKKRXX-Bb17TtNP.js +1 -0
- package/dist/assets/metadata-admin-CABUxbJl.js +9 -0
- package/dist/assets/{mk-MXFM99YL.js → mk-B0IH_YL_.js} +1 -1
- package/dist/assets/{mn-D5Q9B6Jt.js → mn-P-QdQ2n3.js} +1 -1
- package/dist/assets/{ms-CCzPRldx.js → ms-CtyEOINy.js} +1 -1
- package/dist/assets/{mt-mjJpN6xW.js → mt-DfuZ2HRm.js} +1 -1
- package/dist/assets/{nb-BIlNqdEb.js → nb-2Hp-5Tnt.js} +1 -1
- package/dist/assets/{nl-BE-FwXjQsmV.js → nl-BE-mmxbfNoR.js} +1 -1
- package/dist/assets/{nl-D2uBtIxG.js → nl-CZ_nLREz.js} +1 -1
- package/dist/assets/{nn-B0loJ7SV.js → nn-ccWhYsNa.js} +1 -1
- package/dist/assets/{oc-U7-yH1sO.js → oc-z504BFRV.js} +1 -1
- package/dist/assets/{pl-mTy0JYgi.js → pl-DeQ7ASt-.js} +1 -1
- package/dist/assets/plugin-calendar-Cn5HaZU8.js +1 -0
- package/dist/assets/plugin-charts-B6RcFWbo.js +7 -0
- package/dist/assets/plugin-chatbot-Ck47EhDX.js +122 -0
- package/dist/assets/plugin-dashboard-DjEx8e5Y.js +6 -0
- package/dist/assets/plugin-form-CLDvL0up.js +1 -0
- package/dist/assets/plugin-gantt-CrVrxVdi.js +63 -0
- package/dist/assets/plugin-grid-D2rmQEW_.js +11 -0
- package/dist/assets/plugin-kanban-BUNHFfIC.js +1 -0
- package/dist/assets/plugin-map-y-7RQQC5.js +1 -0
- package/dist/assets/{plugin-markdown-D1nTQc1T.js → plugin-markdown-BOkHcir_.js} +1 -1
- package/dist/assets/plugin-report-mT3jpna0.js +59 -0
- package/dist/assets/plugin-timeline-B1EF83D3.js +1 -0
- package/dist/assets/plugin-tree-MTHUt3_S.js +1 -0
- package/dist/assets/plugin-view-DHJI-ahf.js +1 -0
- package/dist/assets/plugins-views-CfkgqD30.js +3 -0
- package/dist/assets/{pt-BR-2KtO5Js1.js → pt-BR-D80_lPYF.js} +1 -1
- package/dist/assets/{pt-Bet5OOQf.js → pt-CJJ1RmXd.js} +1 -1
- package/dist/assets/{ro-37U6sgzi.js → ro-EuFb2TCj.js} +1 -1
- package/dist/assets/{ru-CyuAY-5E.js → ru-CMaVQScp.js} +1 -1
- package/dist/assets/{runtime-metadata-persistence-afAW-MeD.js → runtime-metadata-persistence-ClOTznqa.js} +1 -1
- package/dist/assets/{se-DeJabuC6.js → se-DsfdKLdF.js} +1 -1
- package/dist/assets/{sk-DWEpjfkR.js → sk-BNV9omI8.js} +1 -1
- package/dist/assets/{sl-4oSvNhIR.js → sl-DJS_nINU.js} +1 -1
- package/dist/assets/{sq-BjkBCaXW.js → sq-HEgjcbHe.js} +1 -1
- package/dist/assets/{sr-Dxm1DsRS.js → sr-CO0CFu4X.js} +1 -1
- package/dist/assets/{sr-Latn-Dawg6oP2.js → sr-Latn-eE1Idzey.js} +1 -1
- package/dist/assets/{src-C8NYjdVm.js → src-BU7L2v4J.js} +1 -1
- package/dist/assets/src-BUtIBFDA.js +1 -0
- package/dist/assets/src-C0eXlKtx.js +16 -0
- package/dist/assets/{studioEntry-nXQP3iL0.js → studioEntry-WeMfaSGn.js} +1 -1
- package/dist/assets/{submitRedirect-jK-cEIbP.js → submitRedirect-C2lfZSHt.js} +1 -1
- package/dist/assets/{sv-CROOGJGz.js → sv-5uTzgQT3.js} +1 -1
- package/dist/assets/{ta-BZnTmFI_.js → ta-BzgdkBZG.js} +1 -1
- package/dist/assets/{te-BN0v0x5t.js → te-Ct_pl7ZJ.js} +1 -1
- package/dist/assets/{th-CBjKhp_U.js → th-DouAlk0-.js} +1 -1
- package/dist/assets/{tr-x0Ne4N4H.js → tr-3XNBsI40.js} +1 -1
- package/dist/assets/types-zod-DXpXw10W.js +1 -0
- package/dist/assets/{ug-sgzNhsKo.js → ug-B9n24h9G.js} +1 -1
- package/dist/assets/ui-components-D6cEVg0T.js +37 -0
- package/dist/assets/ui-layout-DgVDuPEM.js +1 -0
- package/dist/assets/{uk-o_DQ5VHJ.js → uk-DCAenByf.js} +1 -1
- package/dist/assets/use-book-data-CwRldFxP.js +1 -0
- package/dist/assets/{useActionModal-CSvbHkQ7.js → useActionModal-Blp4rhOk.js} +1 -1
- package/dist/assets/useCanAuthorMetadata-BxCMgFRf.js +1 -0
- package/dist/assets/useNavSelDeepLink-67Y4qCNO.js +1 -0
- package/dist/assets/useNavTargetLabel-BOJncjIb.js +1 -0
- package/dist/assets/{useOpenRecordList-B5-qaFUx.js → useOpenRecordList-BrwJFojQ.js} +1 -1
- package/dist/assets/{usePackageL10n-CMx66am-.js → usePackageL10n-Ci9uVkRZ.js} +1 -1
- package/dist/assets/{useSettingsLabel-Kkr2q0Oo.js → useSettingsLabel-CeMnMWsh.js} +1 -1
- package/dist/assets/{uz-Cyrl-DbtkQtz_.js → uz-Cyrl-JSeHEqu-.js} +1 -1
- package/dist/assets/{uz-Be41d4jl.js → uz-DT3s9bZS.js} +1 -1
- package/dist/assets/vendor-objectstack-DFqu45yM.js +138 -0
- package/dist/assets/{vi-84mZmklk.js → vi-D2p-h6bY.js} +1 -1
- package/dist/assets/{zh-CN-DD1reegJ.js → zh-CN-DHOKqAit.js} +1 -1
- package/dist/assets/{zh-HK-B05u30WI.js → zh-HK-D4iIPY7I.js} +1 -1
- package/dist/assets/{zh-TW-Bb-WimPD.js → zh-TW-gORQ_tZh.js} +1 -1
- package/dist/chunk-membership.json +100 -90
- package/dist/eager-closure.json +110 -110
- package/dist/index.html +4 -4
- package/dist/sdui.manifest.json +520 -60
- package/package.json +1 -1
- package/dist/assets/AppDocsIndex-F4zDq2zz.js +0 -1
- package/dist/assets/ApprovalsInboxPage-DrEUmaDb.js +0 -1
- package/dist/assets/AuditLogPage-CoghqsZb.js +0 -1
- package/dist/assets/DashboardView-CGC-_Om8.js +0 -1
- package/dist/assets/DocPage-CIZE5kdj.js +0 -1
- package/dist/assets/DocsSlug-DXdFdwlS.js +0 -1
- package/dist/assets/ExpressionProvider-DZfMwyMs.js +0 -1
- package/dist/assets/MarketplacePackagePage-C7NOu2Ir.js +0 -4
- package/dist/assets/PageView-CVLgCRSF.js +0 -1
- package/dist/assets/RecordDetailView-DQKydU7X.js +0 -3
- package/dist/assets/RecordFormPage-BTjwxJIA.js +0 -1
- package/dist/assets/ReportDefaultInspector-DdsQAkd7.js +0 -1
- package/dist/assets/SchemaForm-C8X1ve4p.js +0 -3
- package/dist/assets/SearchResultsPage-Jwhqsdyo.js +0 -1
- package/dist/assets/SettingsView-D8SMKdrc.js +0 -1
- package/dist/assets/appRoute-DbnWDEa1.js +0 -1
- package/dist/assets/data-adapter-DMbe6Njk.js +0 -1
- package/dist/assets/default-inspector-registry-CpL3fFhl.js +0 -1
- package/dist/assets/dist-BXrEV1ag.js +0 -13
- package/dist/assets/en-AU-C6x7mDhH.js +0 -1
- package/dist/assets/en-GB-0-nho2eK.js +0 -1
- package/dist/assets/en-IE-2fC3BkfV.js +0 -1
- package/dist/assets/en-IN-C1QcFhxn.js +0 -1
- package/dist/assets/en-NZ-C80ptZT7.js +0 -1
- package/dist/assets/en-ZA-ByZDrjeb.js +0 -1
- package/dist/assets/framework-DcWkeiND.js +0 -35
- package/dist/assets/getIcon-BEVyC4y3.js +0 -1
- package/dist/assets/i18n-CEKxYdmD.js +0 -9
- package/dist/assets/i18n-locale-ar-DN7sl3GF.js +0 -4
- package/dist/assets/i18n-locale-de-C40JErvb.js +0 -4
- package/dist/assets/i18n-locale-en-CITPDIHy.js +0 -4
- package/dist/assets/i18n-locale-es-C8DdWN6c.js +0 -4
- package/dist/assets/i18n-locale-fr-COIdEZZl.js +0 -4
- package/dist/assets/i18n-locale-ja-DYF_rU_s.js +0 -4
- package/dist/assets/i18n-locale-ko-B-ODYAtX.js +0 -4
- package/dist/assets/i18n-locale-pt-CK1SyBIm.js +0 -4
- package/dist/assets/i18n-locale-ru-jLzvShMO.js +0 -4
- package/dist/assets/i18n-locale-zh-Bf9Gbbvl.js +0 -4
- package/dist/assets/index-CLyvpiGc.css +0 -2
- package/dist/assets/index-CfnfGw5W.js +0 -20
- package/dist/assets/isSameWeek-DWYeNyh8.js +0 -1
- package/dist/assets/mermaid-GHXKKRXX-DVLc_uym.js +0 -1
- package/dist/assets/metadata-admin-CybaOCdO.js +0 -9
- package/dist/assets/nav-selection-Dzm_mA3C.js +0 -1
- package/dist/assets/plugin-calendar-CKRBcML7.js +0 -1
- package/dist/assets/plugin-charts-DGTJxXCB.js +0 -7
- package/dist/assets/plugin-chatbot-DwtwNA-y.js +0 -122
- package/dist/assets/plugin-dashboard-C1AYKmGX.js +0 -6
- package/dist/assets/plugin-form-CV8ZY04-.js +0 -1
- package/dist/assets/plugin-gantt-BRIb2_8G.js +0 -63
- package/dist/assets/plugin-grid-C9h7mRVv.js +0 -11
- package/dist/assets/plugin-kanban-BcJ0Dhys.js +0 -1
- package/dist/assets/plugin-map-D24ZUOUj.js +0 -1
- package/dist/assets/plugin-report-BfGintAq.js +0 -59
- package/dist/assets/plugin-timeline-CbBRq_qt.js +0 -1
- package/dist/assets/plugin-tree-BNX2A5J5.js +0 -1
- package/dist/assets/plugin-view-DzWQWYyH.js +0 -1
- package/dist/assets/plugins-views-DraK4xz0.js +0 -3
- package/dist/assets/src-B8lv0plz.js +0 -18
- package/dist/assets/src-DoDvT77T.js +0 -1
- package/dist/assets/types-zod-Y2RwUUeJ.js +0 -1
- package/dist/assets/ui-components-BTB1NkUW.js +0 -37
- package/dist/assets/ui-layout-bZfafwJa.js +0 -1
- package/dist/assets/use-book-data-C3eyZJSG.js +0 -1
- package/dist/assets/vendor-objectstack-XuWC71M9.js +0 -266
- package/dist/assets/vendor-zod-CHLW1iCr.js +0 -64
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e,r as t}from"./rolldown-runtime-C0FnF6B9.js";import{h as n,t as r,v as i}from"./vendor-react-BggL7APJ.js";import{$ as a,A as o,Ar as s,Br as c,Fr as l,Hr as u,Jn as d,Mr as f,Nr as p,On as m,Pr as h,St as g,Ur as _,Vn as v,Vr as y,Wr as b,bt as ee,d as x,f as S,ft as C,j as w,jr as T,nt as te,p as E,ri as D,v as O,xt as ne,yi as k,yt as re}from"./ui-components-D6cEVg0T.js";import{Ai as A,At as ie,Ei as ae,Ft as j,Ir as M,Ji as N,Ni as oe,Ui as P,X as F,Xi as se,Y as I,Yi as L,_ as ce,dt as le,i as ue,jt as de,kr as fe,lt as pe,o as me,pt as he,s as ge,u as R,vr as _e,y as ve,zr as ye}from"./framework-DFR4HNtj.js";import{g as be,h as z,p as xe}from"./i18n-runtime-97_bDVjP.js";import{r as Se}from"./vendor-ui-utils-DIUdEYii.js";import{t as Ce}from"./vendor-icon-check-vpu9Zukp.js";import{t as B}from"./vendor-icon-chevron-down-BEf_jTEE.js";import{t as we}from"./vendor-icon-file-text-7BKAVNof.js";import{t as V}from"./vendor-icon-plus-BlfcDDsa.js";import{t as Te}from"./vendor-icon-x-CcLtgRNL.js";import{_ as H,c as U,d as W,f as Ee,l as De,m as Oe,o as G,s as K,t as q,v as ke,y as J}from"./vendor-dndkit-CqQIoA27.js";import{c as Ae,o as je}from"./plugin-grid-D2rmQEW_.js";var Y=e(i(),1),Me=(0,Y.createContext)(!0);function Ne(){return(0,Y.useContext)(Me)}var Pe=t({default:()=>Je}),X=r(),Z=(...e)=>e.filter(Boolean).join(` `),Q=z({"kanban.addCard":`Add card`,"kanban.noCards":`No cards`,"kanban.cardTitlePlaceholder":`Enter card title…`},`kanban.noCards`),Fe=`Uncategorized`,Ie=`data-swimlane-scroll-row`,Le=`px-2 pl-36 sm:pl-44`;function Re(e,t,n,r){return _e(e,t,n,r)}function ze({card:e,onCardClick:t,conditionalFormatting:n,objectFields:r}){let{attributes:i,listeners:a,setNodeRef:o,transform:s,transition:l,isDragging:d}=G({id:e.id}),f={transform:J.Transform.toString(s),transition:l,opacity:d?.5:void 0},p=Re(e,n,j(),r);return(0,X.jsx)(`div`,{ref:o,style:f,...i,...a,role:`listitem`,"aria-label":e.title,onClick:n=>t?.(e,n),children:(0,X.jsxs)(c,{className:`mb-2 cursor-grab active:cursor-grabbing border-border border-l-4 border-l-primary/40 bg-card/60 hover:border-primary/40 hover:shadow-lg hover:shadow-primary/10 transition-all duration-300 group touch-manipulation`,style:p,children:[e.coverImage&&(0,X.jsx)(`div`,{className:`w-full h-32 overflow-hidden rounded-t-lg`,children:(0,X.jsx)(`img`,{src:e.coverImage,alt:``,className:`w-full h-full object-cover`,loading:`lazy`})}),(0,X.jsxs)(_,{className:`p-2 sm:p-4 pb-2`,children:[(0,X.jsx)(b,{className:`text-xs sm:text-sm font-semibold tracking-tight text-foreground group-hover:text-primary transition-colors leading-snug line-clamp-2`,children:e.title}),!(e.cardFieldCells&&e.cardFieldCells.length>0)&&(e.cardSubtitle??e.description)&&(0,X.jsx)(u,{className:`text-xs text-muted-foreground line-clamp-2 sm:line-clamp-none`,children:e.cardSubtitle??e.description})]}),(e.cardFieldCells&&e.cardFieldCells.length>0||e.badges&&e.badges.length>0)&&(0,X.jsxs)(y,{className:`p-2 sm:p-4 pt-0 space-y-1.5`,children:[e.cardFieldCells&&e.cardFieldCells.length>0&&(0,X.jsx)(`dl`,{className:`space-y-1 text-xs`,children:e.cardFieldCells.map(e=>(0,X.jsxs)(`div`,{className:`min-w-0 truncate text-foreground/85`,title:e.label||e.field,children:[(0,X.jsx)(`dt`,{className:`sr-only`,children:e.label||e.field}),(0,X.jsx)(`dd`,{className:`min-w-0 truncate`,children:e.node})]},e.field))}),e.badges&&e.badges.length>0&&(0,X.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.badges.map((e,t)=>(0,X.jsx)(D,{variant:e.colorClass?`outline`:e.variant||`default`,className:Z(`text-xs font-normal`,e.colorClass),style:e.colorStyle,children:e.label},t))})]})]})})}function Be({columnId:e,onAdd:t}){let{t:n}=Q(),[r,i]=Y.useState(!1),[a,o]=Y.useState(``),s=Y.useRef(null),c=()=>{let n=a.trim();n&&(t(e,n),o(``)),i(!1)};return r?(0,X.jsx)(`div`,{className:`mt-2 space-y-2`,children:(0,X.jsx)(d,{ref:s,value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),c()):e.key===`Escape`&&(o(``),i(!1))},onBlur:c,placeholder:n(`kanban.cardTitlePlaceholder`),className:`text-sm`,autoFocus:!0})}):(0,X.jsxs)(k,{variant:`ghost`,size:`sm`,className:`w-full mt-2 text-muted-foreground hover:text-foreground`,onClick:()=>{i(!0),setTimeout(()=>s.current?.focus(),0)},children:[(0,X.jsx)(V,{className:`h-4 w-4 mr-1`}),n(`kanban.addCard`)]})}function Ve(e){return e&&e.width!=null?`shrink-0`:`w-[85vw] sm:w-80 shrink-0`}var He=56;function Ue(e,t){return t?{className:`shrink-0`,style:{...e,width:He}}:{className:Ve(e),style:e}}function We({column:e,collapsed:t,collapsible:n,onToggle:r,className:i}){return n?(0,X.jsxs)(`button`,{type:`button`,className:Z(`inline-flex items-center gap-1 min-w-0 hover:text-foreground transition-colors`,t&&`flex-col`,i),"aria-expanded":!t,onClick:r,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:Z(`text-[10px] transition-transform shrink-0`,t?``:`rotate-90`),children:`▶`}),(0,X.jsx)(`span`,{className:Z(`truncate`,t&&`[writing-mode:vertical-rl] rotate-180`),children:e.title})]}):i?(0,X.jsx)(`span`,{className:i,children:e.title}):(0,X.jsx)(X.Fragment,{children:e.title})}function Ge(e,t){return t?`${e}+`:String(e)}function Ke({column:e,cards:t,onCardClick:n,quickAdd:r,onQuickAdd:i,conditionalFormatting:a,objectFields:o,columnStyle:s,suppressEmptyPlaceholder:c,countsAreWindowed:l,collapsed:u,onToggleCollapse:d}){let{t:f}=Q(),p=t||[],{setNodeRef:m,isOver:h}=G({id:e.id,data:{type:`column`}}),g=e.limit&&p.length>=e.limit,_=u===!0,y=Ue(s,_);return(0,X.jsxs)(`div`,{ref:m,role:`group`,"aria-label":e.title,style:y.style,className:Z(`relative flex flex-col rounded-xl border border-border/60 bg-muted/15 snap-start max-h-full min-h-0 transition-all duration-200 shadow-sm hover:shadow-md overflow-hidden`,y.className,h&&`ring-2 ring-primary/60 bg-primary/5`,e.className),children:[(0,X.jsx)(`div`,{className:Z(`border-b border-border/40`,_?`px-1 py-3`:`px-3 sm:px-4 pt-3 pb-2.5`),children:(0,X.jsxs)(`div`,{className:Z(`flex gap-2`,_?`flex-col items-center`:`items-center justify-between`),children:[(0,X.jsx)(`h3`,{id:`kanban-col-${e.id}`,className:Z(`text-xs sm:text-[13px] font-semibold tracking-tight truncate text-foreground/85 uppercase`,_&&`min-w-0`),children:(0,X.jsx)(We,{column:e,collapsed:_,collapsible:d!=null,onToggle:()=>d?.()})}),(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,X.jsxs)(`span`,{className:Z(`inline-flex items-center justify-center min-w-[22px] h-[20px] px-1.5 rounded-md text-[11px] font-medium tabular-nums`,g?`bg-destructive/10 text-destructive ring-1 ring-inset ring-destructive/30`:`bg-muted/70 text-muted-foreground`),children:[Ge(p.length,l),e.limit&&(0,X.jsx)(`span`,{className:`text-muted-foreground/70 font-normal`,children:` / ${e.limit}`})]}),g&&(0,X.jsx)(D,{variant:`destructive`,className:`text-[10px] h-[20px] px-1.5`,children:`Full`})]})]})}),!_&&(0,X.jsxs)(v,{className:`flex-1 p-4`,children:[(0,X.jsx)(q,{items:p.map(e=>e.id),strategy:K,children:(0,X.jsxs)(`div`,{className:`space-y-2`,role:`list`,"aria-label":`${e.title} cards`,children:[p.length===0&&!c&&(0,X.jsxs)(`div`,{className:Z(`flex flex-col items-center justify-center py-6 rounded-md border-2 border-dashed transition-colors gap-1`,h?`border-primary/60 bg-primary/10 text-primary`:`border-border/40 text-muted-foreground/60`),children:[!h&&r&&i&&(0,X.jsx)(V,{className:`h-3.5 w-3.5 opacity-60`,"aria-hidden":!0}),(0,X.jsxs)(`span`,{className:`text-xs`,children:[h?`↓ `:``,f(`kanban.noCards`)]})]}),p.map(e=>(0,X.jsx)(ze,{card:e,onCardClick:n,conditionalFormatting:a,objectFields:o},e.id))]})}),r&&i&&(0,X.jsx)(Be,{columnId:e.id,onAdd:i})]})]})}function qe({children:e}){let t=I();return(0,X.jsx)(X.Fragment,{children:e(t)})}function Je({columns:e,onCardMove:t,onCardClick:n,className:r,quickAdd:i,onQuickAdd:a,coverImageField:o,conditionalFormatting:s,objectFields:c,swimlaneField:l,countsAreWindowed:u}){return F()?(0,X.jsx)(qe,{children:d=>(0,X.jsx)(Ye,{columns:e,onCardMove:t,onCardClick:n,className:r,dnd:d,quickAdd:i,onQuickAdd:a,coverImageField:o,conditionalFormatting:s,objectFields:c,swimlaneField:l,countsAreWindowed:u})}):(0,X.jsx)(Ye,{columns:e,onCardMove:t,onCardClick:n,className:r,dnd:null,quickAdd:i,onQuickAdd:a,coverImageField:o,conditionalFormatting:s,objectFields:c,swimlaneField:l,countsAreWindowed:u})}function Ye({columns:e,onCardMove:t,onCardClick:n,className:r,dnd:i,quickAdd:a,onQuickAdd:o,coverImageField:s,conditionalFormatting:c,objectFields:l,swimlaneField:u,countsAreWindowed:d}){let{t:f}=Q(),[p,m]=Y.useState(null),h=Ne(),g=Y.useRef(null),{width:_}=te(g),v=Y.useMemo(()=>_?_<480?{width:Math.max(_-32,220)}:_<720?{width:280}:{width:320}:{},[_]),y=u?`objectui:kanban-collapsed:${u}`:null,[b,ee]=Y.useState(()=>{if(!y)return new Set;try{let e=localStorage.getItem(y);if(e){let t=JSON.parse(e);if(Array.isArray(t))return new Set(t.filter(e=>typeof e==`string`))}}catch{}return new Set}),[x,S]=Y.useState(()=>new Map),w=Y.useCallback(e=>x.get(String(e.id))??e.collapsed===!0,[x]),T=Y.useCallback((e,t)=>{S(n=>{let r=new Map(n);return r.set(String(e),t),r})},[]),E=Y.useMemo(()=>(e||[]).map(e=>({...e,cards:e.cards||[]})),[e]),[D,O]=Y.useState(E),[ne,k]=Y.useState(E);ne!==E&&(k(E),O(E));let re=Y.useMemo(()=>{if(!u)return null;let e=D.flatMap(e=>e.cards),t=new Set;return e.forEach(e=>{let n=e[u];t.add(n==null?Fe:String(n))}),Array.from(t).sort()},[D,u]),A=Y.useCallback(e=>{ee(t=>{let n=new Set(t);if(n.has(e)?n.delete(e):n.add(e),y)try{localStorage.setItem(y,JSON.stringify([...n]))}catch{}return n})},[y]),ie=ke(H(W,{activationConstraint:{distance:5}}),H(Ee,{activationConstraint:{delay:200,tolerance:5}})),ae=e=>{let{active:t}=e,n=M(t.id);if(m(n),i&&n){let e=N(n.id);e&&i.startDrag({id:n.id,type:`kanban-card`,data:n,sourceId:e.id})}},j=e=>{let{active:n,over:r}=e;if(m(null),!r){i&&i.endDrag();return}let a=n.id,o=r.id;if(a===o){i&&i.endDrag();return}let s=N(a),c=N(o)||oe(o);if(!s||!c){i&&i.endDrag();return}if(s.id!==c.id){let e=[...s.cards],n=[...c.cards],r=e.findIndex(e=>e.id===a),i=o===c.id?n.length:n.findIndex(e=>e.id===o),[l]=e.splice(r,1);n.push(l),O(t=>t.map(t=>t.id===s.id?{...t,cards:e}:t.id===c.id?{...t,cards:n}:t)),t&&t(a,s.id,c.id,i)}i&&i.endDrag(c.id)},M=Y.useCallback(e=>{for(let t of D){let n=t.cards.find(t=>t.id===e);if(n)return n}return null},[D]),N=Y.useCallback(e=>D.find(t=>t.cards.some(t=>t.id===e))||null,[D]),oe=Y.useCallback(e=>D.find(t=>t.id===e)||null,[D]),P=Y.useRef(null),[F,se]=Y.useState(0);Y.useEffect(()=>{let e=P.current;if(!e)return;let t=()=>{let t=e.clientWidth;if(t<=0)return;let n=Math.round(e.scrollLeft/t);se(Math.max(0,Math.min(D.length-1,n)))};return t(),e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)},[D.length]);let I=Y.useRef(0),L=Y.useCallback(e=>{let t=e.currentTarget,n=t.scrollLeft;if(n===I.current)return;I.current=n;let r=g.current;if(r)for(let e of r.querySelectorAll(`[${Ie}]`))e!==t&&e.scrollLeft!==n&&(e.scrollLeft=n)},[]),ce=Y.useCallback(e=>{e&&e.scrollLeft!==I.current&&(e.scrollLeft=I.current)},[]);return(0,X.jsxs)(U,{sensors:ie,collisionDetection:Oe,onDragStart:ae,onDragEnd:j,children:[(0,X.jsxs)(`div`,{ref:g,className:`flex flex-col min-w-0 min-h-0 h-full`,children:[D.length>1&&(0,X.jsx)(`div`,{className:`flex sm:hidden items-center justify-center gap-1.5 px-3 pb-2`,"aria-hidden":!0,children:D.map((e,t)=>(0,X.jsx)(`span`,{className:Z(`h-1.5 rounded-full transition-all`,t===F?`w-4 bg-foreground/70`:`w-1.5 bg-muted-foreground/30`)},e.id))}),(()=>{let e=D.reduce((e,t)=>e+(t.cards?.length||0),0)===0;return(0,X.jsxs)(X.Fragment,{children:[e&&h&&(0,X.jsx)(`div`,{className:`px-4 sm:px-6 pt-3`,children:(0,X.jsx)(C,{role:`status`,"aria-live":`polite`,showIcon:!1,className:`rounded-lg border border-dashed border-border/60 bg-muted/10 py-8 gap-2 [&>h3]:text-sm [&>h3]:font-medium [&>h3]:text-foreground/80`,title:f(`kanban.noCards`)})}),re?(0,X.jsxs)(`div`,{className:Z(`flex flex-col gap-2 px-4 sm:px-6 pb-3 sm:pb-4 min-w-0 overflow-x-hidden overflow-y-auto`,r),role:`region`,"aria-label":`Kanban board with swimlanes`,children:[(0,X.jsx)(`div`,{className:`flex shrink-0 gap-3 sm:gap-4 ${Le} pt-3 sm:pt-4 overflow-x-auto sticky top-0 z-10 bg-background`,ref:ce,onScroll:L,"data-swimlane-scroll-row":``,children:D.map(e=>{let t=w(e),n=Ue(v,t);return(0,X.jsxs)(`div`,{style:n.style,className:Z(n.className,`text-center`),children:[(0,X.jsx)(We,{column:e,collapsed:t,collapsible:e.collapsed===!0,onToggle:()=>T(e.id,!t),className:` text-xs sm:text-sm font-semibold tracking-wider text-primary/90 uppercase`}),!t&&(0,X.jsxs)(`span`,{className:`ml-2 text-xs text-muted-foreground`,children:[`(`,Ge(e.cards.length,d),`)`]})]},e.id)})}),re.map(e=>{let t=b.has(e),r=D.reduce((t,n)=>t+n.cards.filter(t=>(t[u]==null?Fe:String(t[u]))===e).length,0);return(0,X.jsxs)(`div`,{className:`border rounded-lg bg-muted/10`,children:[(0,X.jsxs)(`button`,{type:`button`,className:`w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-muted/30 transition-colors`,onClick:()=>A(e),"aria-expanded":!t,children:[(0,X.jsx)(`span`,{className:Z(`transition-transform text-xs`,t?``:`rotate-90`),children:`▶`}),(0,X.jsx)(`span`,{className:` text-xs font-semibold text-muted-foreground uppercase tracking-wider`,children:e}),(0,X.jsxs)(`span`,{className:` text-xs text-muted-foreground`,children:[`(`,Ge(r,d),`)`]})]}),!t&&(0,X.jsx)(`div`,{className:`flex gap-3 sm:gap-4 overflow-x-auto ${Le} pb-3`,ref:ce,onScroll:L,"data-swimlane-scroll-row":``,children:D.map(t=>{let r=t.cards.filter(t=>(t[u]==null?Fe:String(t[u]))===e),i=w(t),a=Ue(v,i);return(0,X.jsx)(`div`,{style:a.style,className:Z(a.className,`min-h-[60px] rounded-md bg-card/20 p-2`),children:!i&&(0,X.jsx)(q,{items:r.map(e=>e.id),strategy:K,children:(0,X.jsx)(`div`,{className:`space-y-2`,role:`list`,"aria-label":`${t.title} - ${e} cards`,children:r.map(e=>(0,X.jsx)(ze,{card:e,onCardClick:n,conditionalFormatting:c,objectFields:l},e.id))})})},t.id)})})]},e)})]}):(0,X.jsx)(`div`,{ref:P,className:Z(`flex gap-3 sm:gap-4 overflow-x-auto snap-x snap-mandatory px-4 sm:px-6 py-3 sm:py-4 [-webkit-overflow-scrolling:touch] min-w-0 min-h-0 h-full`,r),role:`region`,"aria-label":`Kanban board`,children:D.map(t=>(0,X.jsx)(Ke,{column:t,cards:t.cards,onCardClick:n,quickAdd:a,onQuickAdd:o,conditionalFormatting:c,objectFields:l,columnStyle:v,suppressEmptyPlaceholder:e||!h,countsAreWindowed:d,collapsed:w(t),onToggleCollapse:t.collapsed===!0?()=>T(t.id,!w(t)):void 0},t.id))})]})})()]}),(0,X.jsx)(De,{dropAnimation:{duration:200,easing:`cubic-bezier(0.18, 0.67, 0.6, 1.22)`},children:(0,X.jsx)(`div`,{"aria-live":`assertive`,"aria-label":p?`Dragging ${p.title}`:void 0,className:Z(p&&`motion-safe:rotate-2 motion-safe:scale-[1.03] motion-safe:transition-transform shadow-2xl shadow-primary/25 ring-1 ring-primary/40 rounded-xl cursor-grabbing`),children:p?(0,X.jsx)(ze,{card:p,conditionalFormatting:c,objectFields:l}):null})})]})}var Xe=z({"kanban.uncategorized":`Uncategorized`},`kanban.uncategorized`),Ze=Y.lazy(()=>n(()=>Promise.resolve().then(()=>Pe),void 0,import.meta.url)),Qe=({schema:e,objectFields:t,onCardMove:n,quickAdd:r,onQuickAdd:i})=>{let{t:a}=Xe(),o=Y.useMemo(()=>yt(e.columns??[],e.data,e.groupBy,e.coverImageField,a(`kanban.uncategorized`)),[e,a]);return(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(m,{className:`w-full h-[600px]`}),children:(0,X.jsx)(Ze,{columns:o,onCardMove:n,onCardClick:e.onCardClick,className:e.className,quickAdd:r,onQuickAdd:i,coverImageField:e.coverImageField,conditionalFormatting:e.conditionalFormatting,objectFields:t,swimlaneField:e.swimlaneField,countsAreWindowed:e.countsAreWindowed})})};function $e(e,t,n,r){if(!e||!t)return[];let i={...t,[n]:r},a=[];for(let[r,o]of Object.entries(e)){if(r===n||!o||typeof o!=`object`)continue;let e=o;if(e.requiredWhen==null||!N(t[r]))continue;let s=P({visibleWhen:e.visibleWhen,readonlyWhen:e.readonlyWhen,requiredWhen:e.requiredWhen},i,{required:e.required===!0,readonly:e.readonly===!0},t,void 0,`field '${r}'`);s.required&&s.visible&&!s.readonly&&w(e.type)&&a.push({name:r,def:{name:r,...e}})}return a}function et({open:e,fields:t,submitting:n,onCancel:r,onSubmit:i}){let a=be(),[c,u]=Y.useState({}),[d,m]=Y.useState(!1),g=t.filter(e=>N(c[e.name]));return(0,X.jsx)(s,{open:e,onOpenChange:e=>{e||r()},children:(0,X.jsxs)(T,{className:`sm:max-w-md`,children:[(0,X.jsxs)(h,{children:[(0,X.jsx)(l,{children:a(`kanban.requiredFieldsTitle`,`Complete required fields`)}),(0,X.jsx)(f,{children:a(`kanban.requiredFieldsDescription`,`This move makes the fields below required. Fill them in to continue.`)})]}),(0,X.jsx)(`div`,{className:`flex flex-col gap-4 py-2`,children:t.map(e=>{let t=N(c[e.name]);return(0,X.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsxs)(`span`,{className:`text-sm font-medium`,children:[e.label,(0,X.jsx)(`span`,{className:`text-destructive ml-0.5`,"aria-hidden":`true`,children:`*`})]}),(0,X.jsx)(o,{field:e.def,value:c[e.name],onChange:t=>u(n=>({...n,[e.name]:t})),readonly:n,error:d&&t?a(`common.required`,`Required`):void 0}),d&&t&&(0,X.jsx)(`span`,{className:`text-xs text-destructive`,children:a(`common.required`,`Required`)})]},e.name)})}),(0,X.jsxs)(p,{children:[(0,X.jsx)(k,{variant:`outline`,onClick:r,disabled:n,children:a(`common.cancel`,`Cancel`)}),(0,X.jsx)(k,{onClick:()=>{if(g.length>0){m(!0);return}i(c)},disabled:n,children:a(`kanban.moveCard`,`Move card`)})]})]})})}var tt={"detail.recordDetail":`Record Detail`,"detail.recordDetailWithLabel":`{{label}} Detail`};function nt(e){return typeof e==`number`&&Number.isInteger(e)&&e>0}function rt(e,t){return nt(e)?e:t}function it(e,t){return e==null||nt(e)?null:`[ObjectUI] ObjectKanban fetch batch: ${typeof t==`string`&&t?`object-kanban on ${t}`:`object-kanban`} declared limit: ${String(e)}, which is not a positive integer. A fetch batch must be a positive integer (the spec refuses zero and negative values), so it was ignored and this board fell back to its default fetch batch (100).`}var at=z(tt,`detail.recordDetail`);function ot(e,t){if(Array.isArray(e)&&e.length>0)return e;let n=t?.highlightFields;return Array.isArray(n)?n.filter(e=>!!t?.fields?.[e]):[]}function st(e){if(e?.cardTitle)return e.cardTitle;if(e?.titleField)return e.titleField}var $=({schema:e,dataSource:t,className:n,data:r,loading:i,onRowClick:o,onCardClick:s,...c})=>{let{translateOptions:l,fieldLabel:u}=xe(),d=be(),{t:f}=at(),p=Array.isArray(r),[m,h]=(0,Y.useState)([]),[_,v]=(0,Y.useState)(!1),y=e.objectName??``,{ready:b,def:C}=ve(y,t),[w,T]=(0,Y.useState)(p?i??!1:!1),[te,D]=(0,Y.useState)(null),[k,j]=(0,Y.useState)(0),N=ie(e.bind),P=a(),[F,se]=(0,Y.useState)(null),I=!(!p&&!N&&!e.data&&e.objectName&&t&&typeof t.find==`function`)||F!==null&&F.key===y;(0,Y.useEffect)(()=>{if(!p&&t?.onMutation&&e.objectName)return t.onMutation(t=>{t.resource===e.objectName&&j(e=>e+1)})},[t,e.objectName,p]),(0,Y.useEffect)(()=>{p&&i!==void 0&&T(i)},[i,p]),(0,Y.useEffect)(()=>{let t=it(e.limit,e.objectName);t&&console.warn(t)},[e.limit,e.objectName]);let L=JSON.stringify(e.sort??null),de=he(),R=le(e.filter,de),_e=ce(!p&&!N&&!e.data&&e.objectName||void 0);(0,Y.useEffect)(()=>{if(p||!b)return;let n=!0,r=()=>{n&&se(e=>e!==null&&e.key===y?e:{key:y})};return e.objectName&&!N&&!e.data&&(async()=>{if(!t||typeof t.find!=`function`||!e.objectName){r();return}n&&T(!0);try{let r=ae(C?.fields),i=P?.isLoaded?r.filter(t=>P.checkField(e.objectName,t,`read`)):r,a={$filter:R,$orderby:fe(e.sort),$top:rt(e.limit,100),...i.length>0?{$expand:i}:{}},o=await t.find(e.objectName,a),s=oe(o);n&&(h(s),v(s.length>=a.$top),D(null))}catch(e){console.error(`[ObjectKanban] Fetch error:`,e),n&&D(e)}finally{n&&T(!1),r()}})(),()=>{n=!1}},[e.objectName,y,t,N,e.data,R,L,e.limit,p,b,C,k,P,_e]);let z=(p?r:void 0)||N||e.data||m,Ce=_&&z===m,B=(0,Y.useMemo)(()=>{if(!Array.isArray(z))return[];let t=st(e),n=ye(C);return z.map(r=>{let i;if(t&&(i=r[t],typeof i==`string`&&(i=i.trim())),!i){let e=M(C,r),t=r.id??r._id;e===`Untitled`||t!=null&&e===`Record #${t}`||(i=e)}let a=e=>e>=1e6?`$${(e/1e6).toFixed(1).replace(/\.0$/,``)}M`:e>=1e3?`$${Math.round(e/1e3)}K`:`$${e}`,o=/^[A-Za-z0-9_-]{12,32}$/,s=e=>{if(typeof e!=`string`||!o.test(e))return!1;let t=/[A-Z]/.test(e),n=/[a-z]/.test(e),r=/[0-9_-]/.test(e);return t&&n||t&&r||n&&r},c=e=>{let t=r[e];if(!A(t)){if(typeof t==`object`){let e=t;for(let t of[`name`,`full_name`,`display_name`,`label`,`title`,`username`]){let n=e[t];if(typeof n==`string`&&n.trim())return n.trim()}return}if(typeof t!=`string`)return String(t);if(!s(t))return t}},d=[],f=ot(e.cardFields,C),p=new Set([...t?[t]:[],...n?[n]:[],`name`,`full_name`,`title`,`subject`,`display_name`]),m=[],h=[];if(f.length>0)for(let t of f){if(p.has(t))continue;let n=C?.fields?.[t],i=r[t];if(!A(i)){if(n?.type===`picklist`||n?.type===`multipicklist`||Array.isArray(n?.options)&&n.options.length>0){let r=n?.options?.find(e=>String(e.value).toLowerCase()===String(i).toLowerCase()),a=r?.label||String(i),o=C?.name||e.objectName,s=o?l(o,t,[{value:String(r?.value??i),label:a}])[0]?.label??a:a,c=S(r?.color),u=c?c.className:x(r?.color,i);if(s===``)continue;m.push({label:s,colorClass:u,colorStyle:c?.style})}else{let r=O(n??{type:`text`}),a=E(r),o=(0,X.jsx)(a,{value:i,field:n??{name:t,type:r}});h.push({field:t,label:u(C?.name||e.objectName||``,t,n?.label||t),node:o})}}}else{let e=[`amount`,`value`,`deal_value`,`expected_value`,`opportunity_value`].find(e=>typeof r[e]==`number`);e&&d.push(a(r[e]));let t=[`company`,`company_name`,`account`,`account_name`,`organization`],n;for(let e of t){let t=c(e);if(t){n=t;break}}n&&(!i||!String(i).includes(n))&&d.push(n);let o=[`owner`,`owner_name`,`assignee`,`assignee_name`],s;for(let e of o){let t=c(e);if(t){s=t;break}}s&&d.push(`@${s}`);for(let e of[`priority`,`severity`,`industry`,`rating`]){let t=r[e];if(t!=null&&t!==``){let n=(C?.fields?.[e])?.options?.find(e=>String(e.value).toLowerCase()===String(t).toLowerCase()),r=n?.label||String(t),i=S(n?.color),a=i?i.className:x(n?.color,t);if(r===``)continue;if(m.push({label:r,colorClass:a,colorStyle:i?.style}),m.length>=2)break}}}let g=r.description,_=(A(g)||typeof g==`string`&&s(g))&&d.length>0?d.join(` · `):void 0;return{...r,id:r.id||r._id,title:i||M(C,r),..._?{cardSubtitle:_}:{},...h.length>0?{cardFieldCells:h}:{},...!Array.isArray(r.badges)&&m.length>0?{badges:m}:{}}})},[z,e,C]),we=(0,Y.useMemo)(()=>{let t=t=>{if(!e.objectName||!e.groupBy)return t;let n=l(e.objectName,e.groupBy,[{value:String(t.id),label:t.title}])[0];return n?.label?{...t,title:n.label}:t};if(e.columns&&e.columns.length>0){if(typeof e.columns[0]==`string`){if(!e.groupBy)return e.columns.map(e=>({id:e,title:e}))}else return e.columns.map(t)}if(e.groupBy&&C?.fields?.[e.groupBy]?.options){let t=C.fields[e.groupBy].options.map(e=>({value:e.value,label:e.label}));return(e.objectName?l(e.objectName,e.groupBy,t):t).map(e=>({id:e.value,title:e.label}))}if(e.groupBy&&B.length>0){let t=new Set(B.map(t=>t[e.groupBy]));return Array.from(t).map(e=>({id:String(e),title:String(e)}))}return[]},[e.columns,e.groupBy,e.objectName,B,C,l]),V=e.swimlaneField||e.grouping?.fields?.[0]?.field,Te={...e,data:B,columns:we,className:n||e.className,...V?{swimlaneField:V}:{}},H=e.navigation??{mode:`drawer`},U=o??s;!U&&(H.mode===`drawer`||H.mode===`modal`||H.mode===`split`||H.mode);let W=pe({navigation:H,objectName:e.objectName,onRowClick:U}),{anchorRef:Ee,captureAnchor:De}=g(),Oe=e.objectName?f(`detail.recordDetailWithLabel`,{label:e.objectName.charAt(0).toUpperCase()+e.objectName.slice(1).replace(/_/g,` `)}):f(`detail.recordDetail`),G=Y.useCallback(async(n,r,i,a)=>{let o=e.groupBy,s=e.objectName;if(o&&(p||h(e=>e.map(e=>String(e.id??e._id)===String(n)?{...e,[o]:i}:e)),s&&t?.update))try{await t.update(s,String(n),{[o]:i,...a??{}}),a&&!p&&h(e=>e.map(e=>String(e.id??e._id)===String(n)?{...e,...a}:e))}catch(e){console.warn(`[ObjectKanban] Failed to persist card move`,e),Se.error(ue(e)??(ge(e)?d(`errors.unauthorized`,`You are not authorized to perform this action.`):me(e)??d(`table.saveFailed`,`Save failed`))),h(e=>e.map(e=>String(e.id??e._id)===String(n)?{...e,[o]:r}:e))}},[e.groupBy,e.objectName,t,p,d]),[K,q]=(0,Y.useState)(null),[ke,J]=(0,Y.useState)(!1),Ne=Y.useCallback(async(t,n,r,i)=>{let a=e.groupBy;if(!a||n===r||r===`__uncolumned__`)return;let o=(Array.isArray(z)?z:[]).find(e=>String(e?.id??e?._id)===String(t)),s=$e(C?.fields,o,a,r);if(s.length>0){q({cardId:t,fromColumnId:n,toColumnId:r,fields:s});return}await G(t,n,r)},[e.groupBy,z,C,G]),Pe=(0,Y.useMemo)(()=>{if(!K)return[];let t=C?.name||e.objectName||``;return K.fields.map(e=>{let n=e.def.options,r=t&&Array.isArray(n)?l(t,e.name,n):n,i=typeof e.def.label==`string`?e.def.label:``;return{...e,def:{...e.def,...r?{options:r}:{}},label:u(t,e.name,i||e.name)}})},[K,C,e.objectName,l,u]);if(te)return(0,X.jsxs)(`div`,{className:`p-4 border border-destructive/50 rounded bg-destructive/10 text-destructive`,children:[`Error loading kanban data: `,te.message]});let Z=n=>{if(!W.isOverlay||!W.isOpen||!W.selectedRecord)return null;let r=e.objectName,i=W.selectedRecord,a=i.id??i._id;if(!r||a==null)return null;let o=st(e),s=o&&i[o]?String(i[o]):Oe;return(0,X.jsx)(re,{...W,title:s,mainContent:n,popoverAnchorRef:Ee,storageKey:ne(r),legacyStorageKey:ee(r),width:W.width??`min(960px, 60vw)`,children:()=>(0,X.jsx)(`div`,{className:`px-6 pt-6 pb-6`,children:(0,X.jsx)(Ae,{record:i,objectName:r,recordId:a,dataSource:t,objectSchema:C,onClose:W.close,fullPageHref:je(r,a)??void 0,onFieldSave:async(e,n)=>{t?.update&&(await t.update(r,String(a),{[e]:n}),h(t=>t.map(t=>String(t.id??t._id)===String(a)?{...t,[e]:n}:t)))},onDelete:async()=>{t?.delete&&(await t.delete(r,String(a)),h(e=>e.filter(e=>String(e.id??e._id)!==String(a))))}})})})},Q=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Me.Provider,{value:I,children:(0,X.jsx)(Qe,{objectFields:C?.fields,onCardMove:Ne,schema:{...Te,countsAreWindowed:Ce,onCardClick:(e,t)=>{De(t),W.handleClick(e,t)}}})}),K&&(0,X.jsx)(et,{open:!0,fields:Pe,submitting:ke,onCancel:()=>q(null),onSubmit:async e=>{let t=K;J(!0);try{await G(t.cardId,t.fromColumnId,t.toColumnId,e)}finally{J(!1),q(null)}}})]});if(W.isOverlay&&W.mode===`split`&&W.isOpen&&W.selectedRecord){let e=Z(Q);if(e)return(0,X.jsx)(X.Fragment,{children:e})}return(0,X.jsxs)(X.Fragment,{children:[Q,Z()]})},ct=(...e)=>e.filter(Boolean).join(` `),lt=({columnId:e,fields:t,onSubmit:n,onCancel:r,defaultValues:i})=>{let[a,o]=Y.useState(()=>{let e={};for(let n of t)e[n.name]=i?.[n.name]??n.defaultValue??``;return e}),s=Y.useRef(null);Y.useEffect(()=>{let e=setTimeout(()=>s.current?.focus(),0);return()=>clearTimeout(e)},[]);let c=Y.useCallback((e,t)=>{o(n=>({...n,[e]:t}))},[]),l=Y.useCallback(()=>{Object.values(a).some(e=>typeof e==`string`?e.trim().length>0:e!=null)&&n(e,a)},[e,a,n]),u=Y.useCallback(e=>{e.key===`Enter`?(e.preventDefault(),l()):e.key===`Escape`&&(e.preventDefault(),r())},[l,r]);return(0,X.jsxs)(`div`,{className:`mt-2 rounded-lg border border-primary/30 bg-card p-3 space-y-2 shadow-sm`,onKeyDown:u,role:`form`,"aria-label":`Quick add card`,children:[t.map((t,n)=>(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(`label`,{htmlFor:`qa-${e}-${t.name}`,className:`text-xs text-muted-foreground`,children:t.label??t.name}),ut(t,a[t.name],c,n===0?s:void 0,`qa-${e}-${t.name}`)]},t.name)),(0,X.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,X.jsxs)(k,{type:`button`,size:`sm`,className:`h-7 text-xs gap-1`,onClick:l,children:[(0,X.jsx)(Ce,{className:`h-3 w-3`}),`Save`]}),(0,X.jsxs)(k,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 text-xs gap-1`,onClick:r,children:[(0,X.jsx)(Te,{className:`h-3 w-3`}),`Cancel`]})]})]})};function ut(e,t,n,r,i){let a=`text-sm h-8`;switch(e.type){case`select`:return(0,X.jsxs)(`select`,{ref:r,id:i,value:t??``,onChange:t=>n(e.name,t.target.value),className:ct(a,`w-full rounded-md border border-input bg-background px-2 py-1 text-sm ring-offset-background`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`),children:[(0,X.jsx)(`option`,{value:``,children:e.placeholder??`Select ${e.label??e.name}...`}),(e.options??[]).map(e=>(0,X.jsx)(`option`,{value:e.value,children:e.label},e.value))]});case`number`:return(0,X.jsx)(d,{ref:r,id:i,type:`number`,value:t??``,onChange:t=>n(e.name,t.target.value===``?``:Number(t.target.value)),placeholder:e.placeholder??`Enter ${e.label??e.name}...`,className:a});default:return(0,X.jsx)(d,{ref:r,id:i,type:`text`,value:t??``,onChange:t=>n(e.name,t.target.value),placeholder:e.placeholder??`Enter ${e.label??e.name}...`,className:a})}}var dt=(...e)=>e.filter(Boolean).join(` `),ft=({templates:e,onSelect:t,columnId:n})=>{let[r,i]=Y.useState(!1),a=Y.useRef(null);Y.useEffect(()=>{if(!r)return;let e=e=>{a.current&&!a.current.contains(e.target)&&i(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[r]);let o=Y.useCallback(e=>{e.key===`Escape`&&i(!1)},[]);return(0,X.jsxs)(`div`,{ref:a,className:`relative`,onKeyDown:o,children:[(0,X.jsxs)(k,{variant:`ghost`,size:`sm`,className:`w-full mt-2 text-muted-foreground hover:text-foreground gap-1`,onClick:()=>i(e=>!e),"aria-haspopup":`listbox`,"aria-expanded":r,"aria-label":`Add card to ${n}`,children:[(0,X.jsx)(V,{className:`h-4 w-4`}),`Add Card`,(0,X.jsx)(B,{className:dt(`h-3 w-3 transition-transform`,r?`rotate-180`:``)})]}),r&&(0,X.jsxs)(`div`,{className:`absolute z-50 mt-1 w-full rounded-md border border-border bg-popover p-1 shadow-md`,role:`listbox`,"aria-label":`Card templates`,children:[(0,X.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground transition-colors`,role:`option`,"aria-selected":!1,onClick:()=>{t(null),i(!1)},children:[(0,X.jsx)(V,{className:`h-4 w-4 text-muted-foreground`}),(0,X.jsx)(`span`,{className:`font-mono text-xs`,children:`Custom`})]}),e.length>0&&(0,X.jsx)(`div`,{className:`my-1 h-px bg-border`,role:`separator`}),e.map(e=>(0,X.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground transition-colors`,role:`option`,"aria-selected":!1,onClick:()=>{t(e),i(!1)},children:[(0,X.jsx)(we,{className:`h-4 w-4 text-muted-foreground`}),(0,X.jsx)(`span`,{className:`font-mono text-xs truncate`,children:e.name})]},e.id))]})]})};function pt({swimlanes:e,onCardMove:t}){let[n,r]=(0,Y.useState)(null),i=(0,Y.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.id,n);return t},[e]),a=(0,Y.useCallback)((e,t)=>{if(e===t)return!0;let n=i.get(t);return n?!n.acceptFrom||n.acceptFrom.includes(e):!1},[i]),o=(0,Y.useCallback)((e,n,i,o)=>a(n,i)?(t?.({cardId:e,fromSwimlane:n,toSwimlane:i,columnId:o}),r(null),!0):!1,[a,t]),s=(0,Y.useCallback)(e=>{r(e)},[]),c=(0,Y.useCallback)(()=>{r(null)},[]);return{handleCrossSwimlaneMove:o,isDraggingAcrossSwimlanes:n!==null,startCrossSwimlaneDrag:s,endCrossSwimlaneDrag:c,canMoveTo:a}}function mt({cards:e,onReorderComplete:t}){let[n,r]=(0,Y.useState)(e),[i,a]=(0,Y.useState)(!1);!ht(n,e)&&!i&&r(e);let o=(0,Y.useCallback)(()=>{r(e),a(!1)},[e]);return{reorderedCards:n,onReorder:(0,Y.useCallback)((e,t)=>{r(n=>{if(e<0||t<0||e>=n.length||t>=n.length)return n;let r=[...n],[i]=r.splice(e,1);return r.splice(t,0,i),r})},[]),isDragging:i,startDrag:(0,Y.useCallback)(()=>{a(!0)},[]),endDrag:(0,Y.useCallback)(()=>{a(!1),r(e=>(t?.(e),e))},[t]),reset:o}}function ht(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n].id!==t[n].id)return!1;return!0}var gt=t({CardTemplates:()=>ft,InlineQuickAdd:()=>lt,KANBAN_UNCOLUMNED_ID:()=>_t,KanbanRenderer:()=>bt,ObjectKanban:()=>$,ObjectKanbanRenderer:()=>Ct,bucketCardsIntoColumns:()=>yt,kanbanComponents:()=>xt,useCrossSwimlaneMove:()=>pt,useQuickAddReorder:()=>mt}),_t=`__uncolumned__`;function vt(e,t,n,r){let i=e.filter(e=>e!==``);if(i.length===0)return;let a=e=>typeof e==`string`?JSON.stringify(e):String(e),o=n.map(e=>a(e.id)).join(`, `);for(let e of i)console.warn(`[plugin-kanban] ${t[e].length} record(s) with ${JSON.stringify(r)} = ${JSON.stringify(e)} match no lane id and are shown in the trailing "Uncategorized" lane. Lanes match the stored option value by lane id only, never by lane title (objectui#10069). Available lane ids: [${o}].`)}function yt(e,t,n,r,i){let a=e=>{if(!r)return e;let t=e[r];if(!t)return e;let n=typeof t==`string`?t:t?.url;return n?{...e,coverImage:n}:e};if(!t||!n||!Array.isArray(t))return e.map(e=>({...e,cards:(e.cards||[]).map(a)}));let o=Object.create(null);e.forEach(e=>{e.id&&(o[String(e.id).toLowerCase()]=e.id)});let s=t.reduce((e,t)=>{let r=String(t[n]??``),i=o[r.toLowerCase()]??r;return e[i]||(e[i]=[]),e[i].push(a(t)),e},Object.create(null)),c=e.map(e=>({...e,cards:[...(e.cards||[]).map(a),...s[e.id]||[]]})),l=new Set(e.map(e=>typeof e.id==`symbol`?e.id:String(e.id))),u=Object.keys(s).filter(e=>!l.has(e)),d=u.flatMap(e=>s[e]);return vt(u,s,e,n),d.length>0&&c.push({id:_t,title:i,cards:d}),c}var bt=({schema:e,objectFields:t,onCardMove:n})=>(0,X.jsx)(Qe,{schema:e,objectFields:t,onCardMove:n,quickAdd:e.quickAdd,onQuickAdd:e.onQuickAdd}),xt={"object-kanban":$},St={filter:!0,sort:!0,limit:`limit`},Ct=se(({schema:e,...t})=>{let{dataSource:n}=de()||{},r=n??void 0;return(0,X.jsx)(R,{schema:e,mapping:St,dataSource:r,testId:`object-kanban`,errorTitle:`This board’s data source could not be resolved`,children:e=>(0,X.jsx)($,{schema:e,dataSource:r,...t})})});L.register(`object-kanban`,Ct,{namespace:`plugin-kanban`,label:`Object Kanban`,category:`view`,inputs:[{name:`objectName`,type:`string`,required:!0},{name:`columns`,type:`array`},{name:`filter`,type:`array`,description:"Filter criteria in JSON-rules form, narrowing the records the board fetches. Lowered to `$filter` on the query."},{name:`limit`,type:`number`,description:"Row cap — the most records the board fetches, lowered to the query’s top-level `$top` (renderer default 100). The board renders every fetched record into a lane and offers no pagination, so this is the author’s window on the object rather than a page size. PRECEDENCE: a node-level `dataSource` binding’s own `limit` wins outright; the `pagination.pageSize` of a view that binding names fills this key only when the node leaves it unset."},{name:`groupBy`,type:`string`,description:"Record field whose value buckets cards into lanes. Its picklist options become the lanes when `columns` is absent, and a drag between lanes writes the target lane’s value back to the record. A value matching no lane lands in the trailing “Uncategorized” lane rather than disappearing."},{name:`cardTitle`,type:`string`,description:"Record field rendered as the card title. Read AHEAD of `titleField`, which is the legacy spelling of the same choice; when neither yields a value the shared record-display resolver names the card."},{name:`titleField`,type:`string`,description:"Legacy spelling of `cardTitle` — the record field rendered as the card title. `cardTitle` wins when both are authored."},{name:`swimlaneField`,type:`string`,description:"Record field that splits the board into horizontal swimlanes. When absent the board falls back to `grouping.fields[0].field`."},{name:`coverImageField`,type:`string`,description:"Record field holding a card cover image — a URL string, or a file object carrying a `url`. Any other value leaves the card without a cover."},{name:`data`,type:`array`,description:"Inline records to render instead of fetching. Authoring it SUPPRESSES the board’s own query entirely. Members are records: the board reads `id` (or `_id`) as the card identity, the `groupBy` field’s value as the lane, the card-title field, `coverImageField`, and every `cardFields` entry. Records handed down by a parent view and a `bind` expression both take priority over it."},{name:`cardFields`,type:`array`,description:"Record field NAMES rendered as cells on each card, in the order written. Members are bare names, not entry objects. An explicit list wins over the object’s `highlightFields` role; unlike that fallback it is NOT filtered against the object definition, so a name the object no longer declares simply renders no cell. An empty array reads as omitted."},{name:`grouping`,type:`object`,description:"Only `grouping.fields[0].field` is read, and only as the FALLBACK for `swimlaneField`: it names the record field that splits the board into horizontal swimlanes when no `swimlaneField` is authored. An explicit `swimlaneField` wins. Every other position inside `grouping`, later `fields` entries included, is inert on this board."},{name:`conditionalFormatting`,type:`array`,description:"Per-card style rules, each evaluated against that card’s own record. Two member dialects are accepted: the native `{ field, operator, value, backgroundColor?, borderColor? }` and the spec CEL `{ condition, backgroundColor?, borderColor? }`. A matching rule colours that card alone. A rule comparing a relation field sees the stored foreign key rather than the expanded record."},{name:`navigation`,type:`object`,description:"What a card click opens — the `{ mode, size, openNewTab, preventNavigation }` block a list view declares. With the key ABSENT a click opens the record in a drawer. `mode` is an overlay (`drawer`, `modal`, `split`, `popover`), `new_window`, `page` or `none`; write it whenever the block is written, because a block without `mode` takes the spec’s `page` default and `page` opens nothing on a board no parent view navigates for. `openNewTab: true` opens the record page in a new tab and outranks the mode, `preventNavigation: true` opens nothing, and `size` sets the overlay width. A click handler from a parent view outranks the whole key."}]});export{gt as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e,r as t}from"./rolldown-runtime-C0FnF6B9.js";import{_ as n,h as r,t as i,v as a}from"./vendor-react-BggL7APJ.js";import{$ as o,kn as s,xi as c,yt as l}from"./ui-components-D6cEVg0T.js";import{$n as ee,Bt as u,Ei as te,Ir as ne,Mi as d,Rr as re,Xi as f,Yi as p,_ as ie,dt as ae,ji as oe,jt as se,kr as ce,lt as le,n as ue,pt as de,u as fe,y as pe,zt as me}from"./framework-DFR4HNtj.js";import{t as he}from"./types-zod-DXpXw10W.js";var m=e(a(),1),ge=m.createContext(null);function h(e,t){let n=Array.isArray(e)?e[0]:e?e.x:0,r=Array.isArray(e)?e[1]:e?e.y:0,i=Array.isArray(t)?t[0]:t?t.x:0,a=Array.isArray(t)?t[1]:t?t.y:0;return n===i&&r===a}function g(e,t){if(e===t)return!0;if(!e||!t)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!g(e[n],t[n]))return!1;return!0}if(Array.isArray(t))return!1;if(typeof e==`object`&&typeof t==`object`){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!t.hasOwnProperty(r)||!g(e[r],t[r]))return!1;return!0}return!1}function _(e){return{center:e.getCenter(),zoom:e.getZoom(),bearing:e.getBearing(),pitch:e.getPitch(),elevation:e.getCenterElevation?.()??0,padding:e.getPadding()}}function v(e){return{longitude:e.center.lng,latitude:e.center.lat,zoom:e.zoom,pitch:e.pitch,bearing:e.bearing,padding:e.padding}}function _e(e,t){let n=t.viewState||t,r={};if(`longitude`in n&&`latitude`in n&&(n.longitude!==e.center.lng||n.latitude!==e.center.lat)){let t=e.center.constructor;r.center=new t(n.longitude,n.latitude)}return`zoom`in n&&n.zoom!==e.zoom&&(r.zoom=n.zoom),`bearing`in n&&n.bearing!==e.bearing&&(r.bearing=n.bearing),`pitch`in n&&n.pitch!==e.pitch&&(r.pitch=n.pitch),n.padding&&e.padding&&!g(n.padding,e.padding)&&(r.padding=n.padding),r}function y(e,t,n,r){return e.min===t.min&&e.max===t.max?!1:(e.min>=t.min?(e.max!==t.max&&r(e.max),e.min!==t.min&&n(e.min)):(e.min!==t.min&&n(e.min),e.max!==t.max&&r(e.max)),!0)}function ve(e,t,n){return y(t,n,t=>e.setMinZoom(t),t=>e.setMaxZoom(t))}function b(e,t,n){return y(t,n,t=>e.setMinPitch(t),t=>e.setMaxPitch(t))}var ye=[`type`,`source`,`source-layer`,`minzoom`,`maxzoom`,`filter`,`layout`];function x(e){if(!e)return null;if(typeof e==`string`||(`toJS`in e&&(e=e.toJS()),!e.layers))return e;let t={};for(let n of e.layers)t[n.id]=n;let n=e.layers.map(e=>{let n=null;`interactive`in e&&(n=Object.assign({},e),delete n.interactive);let r=t[e.ref];if(r){n||=Object.assign({},e),delete n.ref;for(let e of ye)e in r&&(n[e]=r[e])}return n||e});return{...e,layers:n}}var S={version:8,sources:{},layers:[]},C={minZoom:0,maxZoom:22,minPitch:0,maxPitch:85,maxBounds:[-180,-85.051129,180,85.051129],projection:`mercator`,renderWorldCopies:!0},be={mousedown:`onMouseDown`,mouseup:`onMouseUp`,mouseover:`onMouseOver`,mousemove:`onMouseMove`,click:`onClick`,dblclick:`onDblClick`,mouseenter:`onMouseEnter`,mouseleave:`onMouseLeave`,mouseout:`onMouseOut`,contextmenu:`onContextMenu`,touchstart:`onTouchStart`,touchend:`onTouchEnd`,touchmove:`onTouchMove`,touchcancel:`onTouchCancel`},w={movestart:`onMoveStart`,move:`onMove`,moveend:`onMoveEnd`,dragstart:`onDragStart`,drag:`onDrag`,dragend:`onDragEnd`,zoomstart:`onZoomStart`,zoom:`onZoom`,zoomend:`onZoomEnd`,rotatestart:`onRotateStart`,rotate:`onRotate`,rotateend:`onRotateEnd`,pitchstart:`onPitchStart`,pitch:`onPitch`,pitchend:`onPitchEnd`},T={wheel:`onWheel`,boxzoomstart:`onBoxZoomStart`,boxzoomend:`onBoxZoomEnd`,boxzoomcancel:`onBoxZoomCancel`,resize:`onResize`,load:`onLoad`,render:`onRender`,idle:`onIdle`,remove:`onRemove`,data:`onData`,styledata:`onStyleData`,sourcedata:`onSourceData`,error:`onError`},xe=[`maxBounds`,`projection`,`renderWorldCopies`],E=[`scrollZoom`,`boxZoom`,`dragRotate`,`dragPan`,`keyboard`,`doubleClickZoom`,`touchZoomRotate`,`touchPitch`],D=class e{constructor(e,t,n){this._map=null,this._internalUpdate=!1,this._hoveredFeatures=null,this._propsedCameraUpdate=null,this._styleComponents={},this._onEvent=e=>{let t=this.props[T[e.type]];t?t(e):e.type===`error`&&console.error(e.error)},this._onCameraEvent=e=>{if(this._internalUpdate)return;e.viewState=this._propsedCameraUpdate||v(_(this._map));let t=this.props[w[e.type]];t&&t(e)},this._onCameraUpdate=e=>this._internalUpdate?e:(this._propsedCameraUpdate=v(e),_e(e,this.props)),this._onPointerEvent=e=>{(e.type===`mousemove`||e.type===`mouseout`)&&this._updateHover(e);let t=this.props[be[e.type]];t&&(this.props.interactiveLayerIds&&e.type!==`mouseover`&&e.type!==`mouseout`&&(e.features=this._hoveredFeatures||this._queryRenderedFeatures(e.point)),t(e),delete e.features)},this._MapClass=e,this.props=t,this._initialize(n)}get map(){return this._map}setProps(e){let t=this.props;this.props=e;let n=this._updateSettings(e,t),r=this._updateSize(e),i=this._updateViewState(e);this._updateStyle(e,t),this._updateStyleComponents(e),this._updateHandlers(e,t),(n||r||i&&!this._map.isMoving())&&this.redraw()}static reuse(t,n){let r=e.savedMaps.pop();if(!r)return null;let i=r.map,a=i.getContainer();for(n.className=a.className;a.childNodes.length>0;)n.appendChild(a.childNodes[0]);i._container=n;let o=i._resizeObserver;o&&(o.disconnect(),o.observe(n)),r.setProps({...t,styleDiffing:!1}),i.resize();let{initialViewState:s}=t;return s&&(s.bounds?i.fitBounds(s.bounds,{...s.fitBoundsOptions,duration:0}):r._updateViewState(s)),i.isStyleLoaded()?i.fire(`load`):i.once(`style.load`,()=>i.fire(`load`)),i._update(),r}_initialize(e){let{props:t}=this,{mapStyle:n=S}=t,r={...t,...t.initialViewState,container:e,style:x(n)},i=r.initialViewState||r.viewState||r;if(Object.assign(r,{center:[i.longitude||0,i.latitude||0],zoom:i.zoom||0,pitch:i.pitch||0,bearing:i.bearing||0}),t.gl){let e=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=e,t.gl)}let a=new this._MapClass(r);i.padding&&a.setPadding(i.padding),t.cursor&&(a.getCanvas().style.cursor=t.cursor);let o=a;typeof o.setTransformCameraUpdate==`function`?o.setTransformCameraUpdate(this._onCameraUpdate):o.transformCameraUpdate=this._onCameraUpdate,a.on(`style.load`,()=>{this._styleComponents={light:a.getLight(),sky:a.getSky(),projection:a.getProjection?.(),terrain:a.getTerrain()},this._updateStyleComponents(this.props)}),a.on(`sourcedata`,()=>{this._updateStyleComponents(this.props)});for(let e in be)a.on(e,this._onPointerEvent);for(let e in w)a.on(e,this._onCameraEvent);for(let e in T)a.on(e,this._onEvent);this._map=a}recycle(){this.map.getContainer().querySelector(`[mapboxgl-children]`)?.remove(),e.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){let e=this._map;e.style&&(e._frame&&=(e._frame.cancel(),null),e._render())}_updateSize(e){let{viewState:t}=e;if(t){let e=this._map,n=e.getCanvas();if(t.width!==n.clientWidth||t.height!==n.clientHeight)return e.resize(),!0}return!1}_updateViewState(e){let t=this._map,n=_(t);if(!t.isMoving()){let r=_e(n,e);if(Object.keys(r).length>0)return this._internalUpdate=!0,t.jumpTo(r),this._internalUpdate=!1,!0}return!1}_updateConstraints(e,t){let n=ve(this._map,{min:e.minZoom??C.minZoom,max:e.maxZoom??C.maxZoom},{min:t.minZoom??C.minZoom,max:t.maxZoom??C.maxZoom}),r=b(this._map,{min:e.minPitch??C.minPitch,max:e.maxPitch??C.maxPitch},{min:t.minPitch??C.minPitch,max:t.maxPitch??C.maxPitch});return n||r}_updateSettings(e,t){let n=this._map,r=!1;for(let i of xe)if((i in e||i in t)&&!g(e[i],t[i])){r=!0;let t=i in e?e[i]:C[i];n[`set${i[0].toUpperCase()}${i.slice(1)}`]?.call(n,t)}let i=this._updateConstraints(e,t);return r||i}_updateStyle(e,t){if(e.cursor!==t.cursor&&(this._map.getCanvas().style.cursor=e.cursor||``),e.mapStyle!==t.mapStyle){let{mapStyle:t=S,styleDiffing:n=!0}=e,r={diff:n};`localIdeographFontFamily`in e&&(r.localIdeographFontFamily=e.localIdeographFontFamily),this._map.setStyle(x(t),r)}}_updateStyleComponents({light:e,projection:t,sky:n,terrain:r}){let i=this._map,a=this._styleComponents;i.style?._loaded&&(e&&!g(e,a.light)&&(a.light=e,i.setLight(e)),t&&!g(t,a.projection)&&t!==a.projection?.type&&(a.projection=typeof t==`string`?{type:t}:t,i.setProjection?.(a.projection)),n&&!g(n,a.sky)&&(a.sky=n,i.setSky(n)),r!==void 0&&!g(r,a.terrain)&&(!r||i.getSource(r.source))&&(a.terrain=r,i.setTerrain(r)))}_updateHandlers(e,t){let n=this._map;for(let r of E){let i=e[r]??!0;g(i,t[r]??!0)||(i?n[r].enable(i):n[r].disable())}}_queryRenderedFeatures(e){let t=this._map,{interactiveLayerIds:n=[]}=this.props;try{return t.queryRenderedFeatures(e,{layers:n.filter(t.getLayer.bind(t))})}catch{return[]}}_updateHover(e){let{props:t}=this;if(t.interactiveLayerIds&&(t.onMouseMove||t.onMouseEnter||t.onMouseLeave)){let t=e.type,n=this._hoveredFeatures?.length>0,r=this._queryRenderedFeatures(e.point),i=r.length>0;!i&&n&&(e.type=`mouseleave`,this._onPointerEvent(e)),this._hoveredFeatures=r,i&&!n&&(e.type=`mouseenter`,this._onPointerEvent(e)),e.type=t}else this._hoveredFeatures=null}};D.savedMaps=[];var Se=[`setMaxBounds`,`setMinZoom`,`setMaxZoom`,`setMinPitch`,`setMaxPitch`,`setRenderWorldCopies`,`setProjection`,`setStyle`,`addSource`,`removeSource`,`addLayer`,`removeLayer`,`setLayerZoomRange`,`setFilter`,`setPaintProperty`,`setLayoutProperty`,`setLight`,`setTerrain`,`setFog`,`remove`];function Ce(e){if(!e)return null;let t=e.map,n={getMap:()=>t};for(let e of we(t))!(e in n)&&!Se.includes(e)&&(n[e]=t[e].bind(t));return n}function we(e){let t=new Set,n=e;for(;n;){for(let r of Object.getOwnPropertyNames(n))r[0]!==`_`&&typeof e[r]==`function`&&r!==`fire`&&r!==`setEventedParent`&&t.add(r);n=Object.getPrototypeOf(n)}return Array.from(t)}var O=typeof document<`u`?m.useLayoutEffect:m.useEffect;function k(e,t){let{RTLTextPlugin:n,maxParallelImageRequests:r,workerCount:i,workerUrl:a}=t;if(n&&e.getRTLTextPluginStatus&&e.getRTLTextPluginStatus()===`unavailable`){let{pluginUrl:t,lazy:r=!0}=typeof n==`string`?{pluginUrl:n}:n;e.setRTLTextPlugin(t,e=>{e&&console.error(e)},r)}r!==void 0&&e.setMaxParallelImageRequests(r),i!==void 0&&e.setWorkerCount(i),a!==void 0&&e.setWorkerUrl(a)}var A=m.createContext(null);function j(e,t){let n=(0,m.useContext)(ge),[i,a]=(0,m.useState)(null),o=(0,m.useRef)(),{current:s}=(0,m.useRef)({mapLib:null,map:null});(0,m.useEffect)(()=>{let t=e.mapLib,i=!0,c;return Promise.resolve(t||r(()=>import(`./maplibre-gl-Dw-skPj7.js`),[],import.meta.url)).then(t=>{if(!i)return;if(!t)throw Error(`Invalid mapLib`);let r=`Map`in t?t:t.default;if(!r.Map)throw Error(`Invalid mapLib`);k(r,e),e.reuseMaps&&(c=D.reuse(e,o.current)),c||=new D(r.Map,e,o.current),s.map=Ce(c),s.mapLib=r,a(c),n?.onMapMount(s.map,e.id)}).catch(t=>{let{onError:n}=e;n?n({type:`error`,target:null,originalEvent:null,error:t}):console.error(t)}),()=>{i=!1,c&&(n?.onMapUnmount(e.id),e.reuseMaps?c.recycle():c.destroy())}},[]),O(()=>{i&&i.setProps(e)}),(0,m.useImperativeHandle)(t,()=>s.map,[i]);let c=(0,m.useMemo)(()=>({position:`relative`,width:`100%`,height:`100%`,...e.style}),[e.style]);return m.createElement(`div`,{id:e.id,ref:o,style:c},i&&m.createElement(A.Provider,{value:s},m.createElement(`div`,{"mapboxgl-children":``,style:{height:`100%`}},e.children)))}var Te=m.forwardRef(j),M=e(n(),1),N=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function P(e,t){if(!e||!t)return;let n=e.style;for(let e in t){let r=t[e];n[e]=Number.isFinite(r)&&!N.test(e)?`${r}px`:r}}function F(e,t){if(e===t)return null;let n=I(e),r=I(t),i=[];for(let e of r)n.has(e)||i.push(e);for(let e of n)r.has(e)||i.push(e);return i.length===0?null:i}function I(e){return new Set(e?e.trim().split(/\s+/):[])}var Ee=(0,m.memo)((0,m.forwardRef)((e,t)=>{let{map:n,mapLib:r}=(0,m.useContext)(A),i=(0,m.useRef)({props:e}),a=(0,m.useMemo)(()=>{let t=!1;m.Children.forEach(e.children,e=>{e&&(t=!0)});let n={...e,element:t?document.createElement(`div`):void 0},o=new r.Marker(n);return o.setLngLat([e.longitude,e.latitude]),o.getElement().addEventListener(`click`,e=>{i.current.props.onClick?.({type:`click`,target:o,originalEvent:e})}),o.on(`dragstart`,e=>{let t=e;t.lngLat=a.getLngLat(),i.current.props.onDragStart?.(t)}),o.on(`drag`,e=>{let t=e;t.lngLat=a.getLngLat(),i.current.props.onDrag?.(t)}),o.on(`dragend`,e=>{let t=e;t.lngLat=a.getLngLat(),i.current.props.onDragEnd?.(t)}),o},[]);(0,m.useEffect)(()=>(a.addTo(n.getMap()),()=>{a.remove()}),[]);let{longitude:o,latitude:s,offset:c,style:l,draggable:ee=!1,popup:u=null,rotation:te=0,rotationAlignment:ne=`auto`,pitchAlignment:d=`auto`}=e;(0,m.useEffect)(()=>{P(a.getElement(),l)},[l]),(0,m.useImperativeHandle)(t,()=>a,[]);let re=i.current.props;(a.getLngLat().lng!==o||a.getLngLat().lat!==s)&&a.setLngLat([o,s]),c&&!h(a.getOffset(),c)&&a.setOffset(c),a.isDraggable()!==ee&&a.setDraggable(ee),a.getRotation()!==te&&a.setRotation(te),a.getRotationAlignment()!==ne&&a.setRotationAlignment(ne),a.getPitchAlignment()!==d&&a.setPitchAlignment(d),a.getPopup()!==u&&a.setPopup(u);let f=F(re.className,e.className);if(f)for(let e of f)a.toggleClassName(e);return i.current.props=e,(0,M.createPortal)(e.children,a.getElement())})),De=(0,m.memo)((0,m.forwardRef)((e,t)=>{let{map:n,mapLib:r}=(0,m.useContext)(A),i=(0,m.useMemo)(()=>document.createElement(`div`),[]),a=(0,m.useRef)({props:e}),o=(0,m.useMemo)(()=>{let t={...e},n=new r.Popup(t);return n.setLngLat([e.longitude,e.latitude]),n.once(`open`,e=>{a.current.props.onOpen?.(e)}),n},[]);if((0,m.useEffect)(()=>{let e=e=>{a.current.props.onClose?.(e)};return o.on(`close`,e),o.setDOMContent(i).addTo(n.getMap()),()=>{o.off(`close`,e),o.isOpen()&&o.remove()}},[]),(0,m.useEffect)(()=>{P(o.getElement(),e.style)},[e.style]),(0,m.useImperativeHandle)(t,()=>o,[]),o.isOpen()){let t=a.current.props;(o.getLngLat().lng!==e.longitude||o.getLngLat().lat!==e.latitude)&&o.setLngLat([e.longitude,e.latitude]),e.offset&&!g(t.offset,e.offset)&&o.setOffset(e.offset),(t.anchor!==e.anchor||t.maxWidth!==e.maxWidth)&&(o.options.anchor=e.anchor,o.setMaxWidth(e.maxWidth));let n=F(t.className,e.className);if(n)for(let e of n)o.toggleClassName(e);a.current.props=e}return(0,M.createPortal)(e.children,i)}));function L(e,t,n,r){let i=(0,m.useContext)(A),a=(0,m.useMemo)(()=>e(i),[]);return(0,m.useEffect)(()=>{let e=r||n||t,o=typeof t==`function`&&typeof n==`function`?t:null,s=typeof n==`function`?n:typeof t==`function`?t:null,{map:c}=i;return c.hasControl(a)||(c.addControl(a,e?.position),o&&o(i)),()=>{s&&s(i),c.hasControl(a)&&c.removeControl(a)}},[]),a}function R(e){let t=L(({mapLib:t})=>new t.AttributionControl(e),{position:e.position});return(0,m.useEffect)(()=>{P(t._container,e.style)},[e.style]),null}(0,m.memo)(R);function z(e){let t=L(({mapLib:t})=>new t.FullscreenControl({container:e.containerId&&document.getElementById(e.containerId)}),{position:e.position});return(0,m.useEffect)(()=>{P(t._controlContainer,e.style)},[e.style]),null}(0,m.memo)(z);function Oe(e,t){let n=(0,m.useRef)({props:e}),r=L(({mapLib:t})=>{let r=new t.GeolocateControl(e),i=r._setupUI;return r._setupUI=()=>{r._container.hasChildNodes()||i()},r.on(`geolocate`,e=>{n.current.props.onGeolocate?.(e)}),r.on(`error`,e=>{n.current.props.onError?.(e)}),r.on(`outofmaxbounds`,e=>{n.current.props.onOutOfMaxBounds?.(e)}),r.on(`trackuserlocationstart`,e=>{n.current.props.onTrackUserLocationStart?.(e)}),r.on(`trackuserlocationend`,e=>{n.current.props.onTrackUserLocationEnd?.(e)}),r},{position:e.position});return n.current.props=e,(0,m.useImperativeHandle)(t,()=>r,[]),(0,m.useEffect)(()=>{P(r._container,e.style)},[e.style]),null}(0,m.memo)((0,m.forwardRef)(Oe));function ke(e){let t=L(({mapLib:t})=>new t.NavigationControl(e),{position:e.position});return(0,m.useEffect)(()=>{P(t._container,e.style)},[e.style]),null}var Ae=(0,m.memo)(ke);function B(e){let t=L(({mapLib:t})=>new t.ScaleControl(e),{position:e.position}),n=(0,m.useRef)(e),r=n.current;n.current=e;let{style:i}=e;return e.maxWidth!==void 0&&e.maxWidth!==r.maxWidth&&(t.options.maxWidth=e.maxWidth),e.unit!==void 0&&e.unit!==r.unit&&t.setUnit(e.unit),(0,m.useEffect)(()=>{P(t._container,i)},[i]),null}(0,m.memo)(B);function je(e){let t=L(({mapLib:t})=>new t.TerrainControl(e),{position:e.position});return(0,m.useEffect)(()=>{P(t._container,e.style)},[e.style]),null}(0,m.memo)(je);function V(e){let t=L(({mapLib:t})=>new t.LogoControl(e),{position:e.position});return(0,m.useEffect)(()=>{P(t._container,e.style)},[e.style]),null}(0,m.memo)(V);function H(e){let t=L(({mapLib:t})=>{let n=t.GlobeControl;if(!n)throw Error(`GlobeControl is not supported by this version of MapLibre GL JS`);return new n(e)},{position:e.position});return(0,m.useEffect)(()=>{P(t._container,e.style)},[e.style]),null}(0,m.memo)(H);function U(e){return e>=-180&&e<180?e:((e+180)%360+360)%360-180}var W=e=>Math.min(85,Math.max(-85,e));function Me(e){if(e.length===0)return null;let t=e.map(([e])=>U(e)).sort((e,t)=>e-t),n=e.map(([,e])=>W(e)),r=t.length,i=t[0]+360-t[r-1],a=0;for(let e=1;e<r;e++){let n=t[e]-t[e-1];n>i&&(i=n,a=e)}let o=t[a],s=t[(a+r-1)%r],c=a===0?s:s+360;return[[o,Math.min(...n)],[c,Math.max(...n)]]}function Ne(e){let[[t,n],[r,i]]=e;return{longitude:U((t+r)/2),latitude:(n+i)/2}}var G=i(),Pe=`https://demotiles.maplibre.org/style.json`,K=Object.keys(he.shape).filter(e=>e!==`style`);function Fe(e){return me(e,`view-data`)}var q=()=>!1,Ie=new Set;function J(e){if(!q())return;let t=e.filter;if(!t||typeof t!=`object`||Array.isArray(t)||!Object.prototype.hasOwnProperty.call(t,`map`))return;let n=t.map;if(!n||typeof n!=`object`)return;let r;try{r=`${e.type??`map`}::${e.objectName??``}::${JSON.stringify(n)}`}catch{r=`${e.type??`map`}::${e.objectName??``}::<unserializable>`}Ie.has(r)||(Ie.add(r),console.warn("[ObjectMap] `filter.map` is no longer read as map configuration, so this map has NO coordinate binding and renders the \"Map configuration required\" refusal (objectui#8169 — the `latitude` / `longitude` / `location` defaults are gone). `filter` is the query filter; the map config belongs under the declared `map` input — move it to `schema.map` (`{ type: 'object-map', map: { latitudeField, longitudeField, titleField } }`). The old spelling was never documented and could not survive a `dataSource` binding, whose merged filter is an `and` node with no `map` key at all (objectstack#7121). If `map` is genuinely a field you are filtering on, ignore this — the filter itself is passed through untouched. objectui#4034."))}var Y=new Set;function Le(e){if(!q())return;let t=e.style;if(typeof t!=`string`||t===``)return;let n=`${e.type??`map`}::${e.objectName??``}::${t}`;Y.has(n)||(Y.add(n),console.warn(`[ObjectMap] A top-level \`style\` is NOT read as a map style, so this map is rendering with the DEFAULT public demo tiles and \`${t}\` was dropped. \`style\` is the base schema's INLINE CSS key (a record of CSS properties), which every node may carry; the map style is \`mapStyle\` — named that way precisely to avoid this collision. Write \`mapStyle: '${t}'\` at the top level, or \`map: { style: '${t}' }\` in the declared config block. On a view, write that same declared \`map: { style: ... }\`: ObjectView / ListView flatten \`options.map\` through a whitelist of the keys \`ObjectMapConfigSchema\` declares, and that whitelist carries \`style\` out under the flat spelling \`mapStyle\` (objectui#9950), so the declared block arrives and is read. \`mapStyle\` is the TOP-LEVEL spelling only — inside the \`map\` block it is undeclared, and the flatten drops it. objectui#5017.`))}var X=new Set;function Z(e){if(!q())return;let t=K.filter(t=>e[t]!==void 0);if(t.length===0)return;let n=`${e.type??`map`}::${e.objectName??``}::${t.join(`,`)}`;X.has(n)||(X.add(n),console.warn(`[ObjectMap] The \`map\` block configures this map, so these top-level keys are IGNORED: ${t.map(e=>`\`${e}\``).join(`, `)}. The \`map\` block is the authoring shape; the flat top-level spelling is the internal form ObjectView/ListView produce when they flatten \`options.map\`, and what the author wrote outranks it. Move anything you still need into \`map\`, or drop the \`map\` block. objectui#5018.`))}function Re(e){J(e),Le(e);let t=e.mapStyle||e.map?.style,n=e.map??null;if(n){let r=he.safeParse(n);return r.success||console.warn(`[ObjectMap] Invalid map configuration:`,r.error.format()),Z(e),{...n,style:n.style||t}}return e.locationField||e.latitudeField?{locationField:e.locationField,latitudeField:e.latitudeField,longitudeField:e.longitudeField,titleField:e.titleField,descriptionField:e.descriptionField,zoom:e.zoom,center:e.center,style:t}:{style:t}}function ze(e){return!!e.locationField||!!(e.latitudeField&&e.longitudeField)}function Be(e,t){if(t.latitudeField&&t.longitudeField){let n=e[t.latitudeField],r=e[t.longitudeField];if(typeof n==`number`&&typeof r==`number`)return[n,r]}if(t.locationField){let n=e[t.locationField];if(typeof n==`object`&&n){let e=n.lat||n.latitude,t=n.lng||n.lon||n.longitude;if(typeof e==`number`&&typeof t==`number`)return[e,t]}if(typeof n==`string`){let e=n.split(`,`).map(e=>parseFloat(e.trim()));if(e.length===2&&!isNaN(e[0])&&!isNaN(e[1]))return[e[0],e[1]]}if(Array.isArray(n)&&n.length===2){let e=parseFloat(n[0]),t=parseFloat(n[1]);if(!isNaN(e)&&!isNaN(t))return[e,t]}}return null}function Ve(e,t,n=50){if(e.length<=1||t>=15)return e.map(e=>({id:e.id,coordinates:e.coordinates,markers:[e],isCluster:!1}));let r=n/2**t,i=new Map;e.forEach(e=>{let t=`${Math.floor(e.coordinates[0]/r)}:${Math.floor(e.coordinates[1]/r)}`;i.has(t)||i.set(t,[]),i.get(t).push(e)});let a=[];return i.forEach((e,t)=>{if(e.length===1)a.push({id:e[0].id,coordinates:e[0].coordinates,markers:e,isCluster:!1});else{let n=e.reduce((e,t)=>e+t.coordinates[0],0)/e.length,r=e.reduce((e,t)=>e+t.coordinates[1],0)/e.length;a.push({id:`cluster-${t}`,coordinates:[n,r],markers:e,isCluster:!0})}}),a}var Q=({schema:e,dataSource:t,className:n,data:r,onMarkerClick:i,onRowClick:a,onEdit:f,onDelete:p,enableClustering:se,clusterRadius:fe=50})=>{let[me,he]=(0,m.useState)([]),[ge,h]=(0,m.useState)(!0),[g,_]=(0,m.useState)(null),[v,_e]=(0,m.useState)(null),[y,ve]=(0,m.useState)(null),[b,ye]=(0,m.useState)(``),x=s(),S=(0,m.useRef)(null),[C,be]=(0,m.useState)(null),[w,T]=(0,m.useState)(null),[xe,E]=(0,m.useState)(!1),[D,Se]=(0,m.useState)(null),Ce=(0,m.useCallback)(e=>{Se(e?.error?.message||`Failed to load the map style/tiles.`)},[]),we=(0,m.useCallback)(()=>{if(typeof navigator>`u`||!navigator.geolocation){T(`Geolocation is not available in this browser.`);return}E(!0),T(null),navigator.geolocation.getCurrentPosition(e=>{let{longitude:t,latitude:n}=e.coords;be({lng:t,lat:n}),E(!1);try{S.current?.flyTo({center:[t,n],zoom:12,duration:800})}catch{}},e=>{E(!1),T(e.message||`Unable to retrieve location.`)},{enableHighAccuracy:!1,timeout:8e3,maximumAge:6e4})},[]),O=(0,m.useMemo)(()=>Fe(e),[e]),k=(0,m.useMemo)(()=>Re(e),[e]),A=O?.provider===`value`,j=O?.provider,M=O?.provider===`object`?O.object:void 0,N=O?.provider===`value`?O.items:void 0,P=u(e,O),{ready:F,def:I}=pe(P??``,A?void 0:t),L=o(),R=!Array.isArray(r)&&j===`object`,z=ie(R?M:void 0),Oe=(0,m.useRef)(z),ke=(0,m.useRef)(null),B=(0,m.useRef)(0),je=de(),V=ae(e.filter,je);(0,m.useEffect)(()=>{if(R&&!F){h(!0);return}let n=[r,j,M,N,t,A,V,e.sort,I,L],i=ke.current,a=i!==null&&i.length===n.length&&n.every((e,t)=>Object.is(e,i[t])),o=z!==Oe.current;Oe.current=z;let s=o&&a,c=++B.current,l=()=>B.current===c,u=(e,t)=>{l()&&(he(e),_e(t),_(null),ke.current=n)};return(async()=>{try{if(s||h(!0),Array.isArray(r)){u(r,null);return}if(A&&j===`value`){let t=await new ee({items:N??[]}).find(``,{$filter:V,$orderby:ce(e.sort),...d()}),n=oe(t);u(n.rows,n);return}if(!t||typeof t.find!=`function`)throw Error(`DataSource required for object/api providers`);if(j===`object`){let n=M,r=te(I?.fields),i=L?.isLoaded?r.filter(e=>L.checkField(n,e,`read`)):r,a=await t.find(n,{$filter:V,$orderby:ce(e.sort),...d(),...i.length>0?{$expand:i}:{}}),o=oe(a);u(o.rows,o)}else j===`api`&&(console.warn(`API provider not yet implemented for ObjectMap`),u([],null))}catch(e){s?console.error(`[ObjectMap] Failed to refresh data:`,e):l()&&_(e)}finally{l()&&h(!1)}})(),()=>{B.current+=1}},[r,j,M,N,t,A,V,e.sort,F,I,L,z,R]);let{markers:H,invalidCount:U}=(0,m.useMemo)(()=>{let e=0;return{markers:me.map((t,n)=>{let r=Be(t,k);if(!r)return e++,null;let i=ne(I,t,{titleField:k.titleField,fallback:`Marker`}),a=re(t,k.descriptionField),[o,s]=r;return!isFinite(o)||!isFinite(s)||o<-90||o>90||s<-180||s>180?(e++,null):{id:t.id||t._id||`marker-${n}`,title:i,description:a,coordinates:[s,o],data:t}}).filter(e=>e!==null),invalidCount:e}},[me,k,I]),W=(0,m.useMemo)(()=>H.find(e=>e.id===y),[H,y]),[K,q]=(0,m.useState)(k.zoom||3),Ie=(0,m.useCallback)(e=>{try{let t=e?.target?.getZoom?.();typeof t==`number`&&Number.isFinite(t)&&q(Math.round(t))}catch{}},[]),J=le({navigation:e.navigation,objectName:e.objectName,onRowClick:a}),Y=(0,m.useMemo)(()=>{if(!b.trim())return H;let e=b.toLowerCase();return H.filter(t=>t.title?.toLowerCase().includes(e)||t.description?.toLowerCase().includes(e))},[H,b]),Le=(0,m.useMemo)(()=>se??(e.enableClustering||Y.length>100)?Ve(Y,K,fe):Y.map(e=>({id:e.id,coordinates:e.coordinates,markers:[e],isCluster:!1})),[Y,K,se,fe,e]),X=(0,m.useMemo)(()=>Me(Y.map(e=>e.coordinates)),[Y]),Z=typeof k.center?.[0]==`number`?k.center[0]:void 0,Q=typeof k.center?.[1]==`number`?k.center[1]:void 0,$=typeof k.zoom==`number`?k.zoom:void 0,He=Z!==void 0||Q!==void 0||$!==void 0,Ue=(0,m.useMemo)(()=>{if(X&&!He)return{bounds:X,fitBoundsOptions:{padding:48,maxZoom:12}};let e=X?Ne(X):{longitude:0,latitude:0};return{longitude:Q??e.longitude,latitude:Z??e.latitude,zoom:$??(X?3:2)}},[X,He,Q,Z,$]);return ze(k)?ge?(0,G.jsx)(`div`,{className:c(`min-w-0 overflow-hidden`,n),children:(0,G.jsx)(`div`,{className:`flex items-center justify-center h-96 bg-muted rounded-lg border`,children:(0,G.jsx)(`div`,{className:`text-muted-foreground`,children:`Loading map...`})})}):g?(0,G.jsx)(`div`,{className:c(`min-w-0 overflow-hidden`,n),children:(0,G.jsx)(`div`,{className:`flex items-center justify-center h-96 bg-muted rounded-lg border`,children:(0,G.jsxs)(`div`,{className:`text-destructive`,children:[`Error: `,g.message]})})}):(0,G.jsxs)(`div`,{className:c(`min-w-0 overflow-hidden`,n),children:[U>0&&(0,G.jsx)(`div`,{className:`mb-2 p-2 text-sm text-yellow-800 bg-yellow-50 border border-yellow-200 rounded`,children:`${U} record${U===1?``:`s`} with missing or invalid coordinates excluded from the map.`}),H.length>0&&(0,G.jsx)(`div`,{className:`mb-2`,children:(0,G.jsx)(`input`,{type:`text`,value:b,onChange:e=>ye(e.target.value),placeholder:`Search locations…`,className:`w-full px-3 py-2 text-sm border rounded-md bg-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring`})}),(0,G.jsxs)(`div`,{className:`relative border rounded-lg overflow-hidden bg-muted h-[300px] sm:h-[400px] md:h-[500px] lg:h-[600px] w-full`,children:[(0,G.jsxs)(Te,{ref:e=>{S.current=e},initialViewState:Ue,style:{width:`100%`,height:`100%`},mapStyle:k.style||Pe,touchZoomRotate:!0,dragRotate:!0,touchPitch:!0,onLoad:Ie,onZoom:e=>q(Math.round(e.viewState.zoom)),onError:Ce,children:[D&&(0,G.jsxs)(`div`,{role:`alert`,className:`absolute inset-x-0 top-0 z-20 p-2 text-sm text-center text-amber-900 bg-amber-50 border-b border-amber-200`,children:[`Map failed to load (`,D,`). Markers below are still listed in the search box;`,` `,k.style?`check the configured map style URL.`:`configure a custom map style for production use.`]}),(0,G.jsx)(Ae,{position:`top-right`,showCompass:!0,showZoom:!0}),(0,G.jsx)(`button`,{type:`button`,onClick:we,disabled:xe,className:`absolute top-2 left-2 z-10 inline-flex items-center justify-center size-9 rounded-md bg-background/95 border shadow-sm hover:bg-background disabled:opacity-50`,"aria-label":`Show my location`,"data-testid":`map-geolocate`,children:(0,G.jsx)(`span`,{"aria-hidden":`true`,children:xe?`⏳`:`🧭`})}),C&&(0,G.jsx)(Ee,{longitude:C.lng,latitude:C.lat,anchor:`center`,children:(0,G.jsx)(`div`,{className:`size-3 rounded-full bg-blue-500 ring-4 ring-blue-500/30 shadow`,"aria-label":`Your location`,"data-testid":`map-user-location`})}),Le.map(e=>e.isCluster?(0,G.jsx)(Ee,{longitude:e.coordinates[0],latitude:e.coordinates[1],anchor:`center`,onClick:t=>{t.originalEvent.stopPropagation();try{let t=Math.min(20,Math.max(K+2,8));S.current?.flyTo({center:[e.coordinates[0],e.coordinates[1]],zoom:t,duration:600})}catch{}},children:(0,G.jsx)(`div`,{className:`flex items-center justify-center rounded-full bg-primary text-primary-foreground font-bold text-xs cursor-pointer hover:scale-110 transition-transform shadow-md`,style:{width:Math.min(48,24+e.markers.length*2),height:Math.min(48,24+e.markers.length*2)},title:`${e.markers.length} markers`,"data-testid":`map-cluster`,children:e.markers.length})},e.id):(0,G.jsx)(Ee,{longitude:e.coordinates[0],latitude:e.coordinates[1],anchor:`bottom`,onClick:t=>{t.originalEvent.stopPropagation();let n=e.markers[0];ve(n.id),J.handleClick(n.data),i?.(n.data)},children:(0,G.jsx)(`div`,{className:`text-2xl cursor-pointer hover:scale-110 transition-transform`,children:`📍`})},e.id)),W&&!x&&(0,G.jsx)(De,{longitude:W.coordinates[0],latitude:W.coordinates[1],anchor:`top`,onClose:()=>ve(null),closeOnClick:!1,children:(0,G.jsxs)(`div`,{className:`p-2 min-w-[150px] sm:min-w-[200px]`,children:[(0,G.jsx)(`h3`,{className:`font-bold text-sm mb-1`,children:W.title}),W.description&&(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:W.description}),(0,G.jsxs)(`div`,{className:`mt-2 text-xs flex gap-2`,children:[f&&(0,G.jsx)(`button`,{type:`button`,className:`text-blue-500 hover:underline`,onClick:()=>f(W.data),children:`Edit`}),p&&(0,G.jsx)(`button`,{type:`button`,className:`text-red-500 hover:underline`,onClick:()=>p(W.data),children:`Delete`})]})]})})]}),W&&x&&(0,G.jsxs)(`div`,{className:`absolute inset-x-0 bottom-0 z-30 bg-background border-t shadow-lg rounded-t-2xl p-4 pb-[max(env(safe-area-inset-bottom),1rem)]`,role:`dialog`,"aria-label":`Location details`,"data-testid":`map-mobile-record-sheet`,children:[(0,G.jsx)(`div`,{className:`mx-auto mb-2 h-1 w-10 rounded-full bg-muted`,"aria-hidden":`true`}),(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`h3`,{className:`text-sm font-semibold truncate`,children:W.title}),W.description&&(0,G.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground line-clamp-3`,children:W.description})]}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>ve(null),className:`text-muted-foreground hover:text-foreground text-lg leading-none px-2`,"aria-label":`Close details`,"data-testid":`map-mobile-record-close`,children:`×`})]}),(0,G.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 text-xs`,children:[f&&(0,G.jsx)(`button`,{type:`button`,className:`px-3 py-1.5 rounded-md border bg-card hover:bg-accent`,onClick:()=>f(W.data),children:`Edit`}),p&&(0,G.jsx)(`button`,{type:`button`,className:`px-3 py-1.5 rounded-md border border-destructive/30 text-destructive hover:bg-destructive/10`,onClick:()=>p(W.data),children:`Delete`})]})]}),w&&(0,G.jsx)(`div`,{className:`absolute top-2 left-14 right-2 z-10 text-xs px-3 py-1.5 rounded-md bg-destructive/10 text-destructive border border-destructive/30`,children:w})]}),v&&(0,G.jsx)(ue,{result:v}),J.isOverlay&&(0,G.jsx)(l,{...J,title:`Location Details`,children:e=>(0,G.jsx)(`div`,{className:`space-y-3`,children:Object.entries(e).map(([e,t])=>(0,G.jsxs)(`div`,{className:`flex flex-col`,children:[(0,G.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:e.replace(/_/g,` `)}),(0,G.jsx)(`span`,{className:`text-sm`,children:String(t??`—`)})]},e))})})]}):(0,G.jsx)(`div`,{className:c(`min-w-0 overflow-hidden`,n),children:(0,G.jsx)(`div`,{className:`flex items-center justify-center h-96 bg-muted rounded-lg border p-4 text-center`,"data-testid":`map-missing-location-binding`,role:`alert`,children:(0,G.jsxs)(`div`,{className:`text-destructive`,children:[`Map configuration required — declare `,(0,G.jsx)(`code`,{className:`font-mono`,children:`map.locationField`}),` `,`or `,(0,G.jsx)(`code`,{className:`font-mono`,children:`map.latitudeField`}),` +`,` `,(0,G.jsx)(`code`,{className:`font-mono`,children:`map.longitudeField`})]})})})},$=t({ObjectMap:()=>Q,ObjectMapRenderer:()=>Ue}),He={filter:!0,sort:!0},Ue=f(({schema:e,...t})=>{let{dataSource:n}=se()||{};return(0,G.jsx)(fe,{schema:e,mapping:He,dataSource:n,testId:`object-map`,errorTitle:`This map’s data source could not be resolved`,children:e=>(0,G.jsx)(Q,{schema:e,dataSource:n,...t})})});p.register(`object-map`,Ue,{namespace:`plugin-map`,label:`Object Map`,category:`view`,inputs:[{name:`objectName`,type:`string`,description:"ObjectQL object name. The record source is one of `data`, `staticData` and `objectName`, or the node’s `dataSource` binding; the `object-map` schema refuses a block that declares none of them."},{name:`map`,type:`object`,description:`latitudeField, longitudeField, titleField`},{name:`data`,type:`object`,description:"A `{ provider, … }` data-source configuration, read FIRST on the record-source ladder: a map carrying one never reaches `staticData` and never queries `objectName`. `{ provider: 'value', items }` plots those rows and `{ provider: 'object', object }` queries that object, both narrowed by `filter` and ordered by `sort`. The `api` provider is not implemented on the map and plots no markers. A bare array is not this key’s shape and is not a record source: the map falls through to `staticData`, then `objectName`, so inline rows belong under `staticData`."},{name:`staticData`,type:`array`,description:"Inline records, read SECOND on the record-source ladder: a `data` configuration wins and this key is then never reached, while `objectName` is read AFTER it, so a map carrying both plots these rows and never queries that object. `filter` and `sort` narrow and order these rows exactly as they do fetched ones."},{name:`filter`,type:`array`,description:"Base query filter in the rule-array form `[{ field, operator, value }, ...]`, narrowing the markers the map plots — fetched rows and inline (`staticData`, `{ provider: 'value' }`) rows alike. Context tokens such as `{current_user_id}` are resolved first, then the filter is lowered to `$filter` on the query. The MongoDB-style record form is not this key’s shape."},{name:`sort`,type:`array`,description:"Marker order in `[{ field, order }]` form, ordering the rows the map plots. Lowered to `$orderby` on the same query."}]});export{$ as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e,r as t}from"./rolldown-runtime-C0FnF6B9.js";import{h as n,t as r,v as i}from"./vendor-react-BggL7APJ.js";import{
|
|
1
|
+
import{o as e,r as t}from"./rolldown-runtime-C0FnF6B9.js";import{h as n,t as r,v as i}from"./vendor-react-BggL7APJ.js";import{On as a}from"./ui-components-D6cEVg0T.js";import{Yi as o}from"./framework-DFR4HNtj.js";import{a as s,h as c,i as l,m as u,n as d,o as f,p,r as m,t as h}from"./vendor-markdown-COJFQ_GI.js";var g=e(i(),1),_=r(),v=``,y=``,b=/\uE000(\d+)\uE001/g,x=/[\uE000\uE001]/g,S=/(?<![^\s\p{P}\p{S}])(?<!_)(_+)(?!\s)(.+?)(?<!\s)(_+)(?!_)(?![^\s\p{P}\p{S}])/gu;function C(e){let t=[];return e.replace(x,``).replace(/`([^`]+)`/g,(e,n)=>(t.push(n),`${v}${t.length-1}${y}`)).replace(/!\[[^\]]*\]\([^)]*\)/g,``).replace(/\[([^\]]+)\]\([^)]*\)/g,`$1`).replace(/\*\*(.*?)\*\*/g,`$1`).replace(/\*(.*?)\*/g,`$1`).replace(S,`$2`).replace(/<[^>]+>/g,``).replace(b,(e,n)=>t[Number(n)]).trim()}function w(e,t){let n=t?.minDepth??2,r=t?.maxDepth??3,i=new f,a=[],o=null;for(let t of(e??``).split(/\r?\n/)){let e=t.match(/^\s{0,3}(`{3,}|~{3,})/);if(e){let t=e[1][0];o===null?o=t:t===o&&(o=null);continue}if(o!==null)continue;let s=t.match(/^(#{1,6})\s+(.+?)\s*#*\s*$/);if(!s)continue;let c=s[1].length,l=C(s[2]);if(!l)continue;let u=i.slug(l);c>=n&&c<=r&&a.push({depth:c,text:l,id:u})}return a}var T=null;function E(){return T||=n(()=>import(`./mermaid.core-DigK-8rw.js`).then(e=>e.default),[],import.meta.url),T}var D=0;function O(){return typeof document<`u`&&document.documentElement.classList.contains(`dark`)}function k({chart:e}){let[t,n]=g.useState(``),[r,i]=g.useState(null),[a,o]=g.useState(O);return g.useEffect(()=>{if(typeof document>`u`)return;let e=document.documentElement,t=new MutationObserver(()=>o(O()));return t.observe(e,{attributes:!0,attributeFilter:[`class`]}),()=>t.disconnect()},[]),g.useEffect(()=>{let t=!1,r=e.trim();if(!r){n(``),i(null);return}return E().then(async e=>{e.initialize({startOnLoad:!1,securityLevel:`strict`,theme:a?`dark`:`default`});let o=`os-mermaid-${D+=1}`,{svg:s}=await e.render(o,r);t||(n(s),i(null))}).catch(e=>{t||i(e instanceof Error?e.message:String(e))}),()=>{t=!0}},[e,a]),r?(0,_.jsx)(`pre`,{"data-mermaid":!0,"data-mermaid-error":!0,className:`my-4 overflow-auto rounded border border-destructive/40 bg-muted p-3 text-xs`,children:(0,_.jsx)(`code`,{children:e})}):t?(0,_.jsx)(`div`,{"data-mermaid":!0,role:`img`,className:`my-4 flex justify-center overflow-auto [&_svg]:h-auto [&_svg]:max-w-full`,dangerouslySetInnerHTML:{__html:t}}):(0,_.jsx)(`div`,{"data-mermaid":!0,"data-mermaid-pending":!0,className:`my-4 text-sm text-muted-foreground`,children:(0,_.jsx)(`pre`,{className:`sr-only`,children:e})})}var A=t({MarkdownRenderer:()=>M,Mermaid:()=>k,extractToc:()=>w,markdownComponents:()=>N}),j=g.lazy(()=>n(()=>Promise.resolve().then(()=>L),void 0,import.meta.url)),M=({schema:e})=>(0,_.jsx)(g.Suspense,{fallback:(0,_.jsx)(a,{className:`w-full h-[200px]`}),children:(0,_.jsx)(j,{content:e.content||``,className:e.className})});o.register(`markdown`,M,{namespace:`plugin-markdown`,label:`Markdown`,category:`plugin`,inputs:[{name:`content`,type:`string`,required:!0},{name:`className`,type:`string`}],defaultProps:{content:`# Hello World
|
|
2
2
|
|
|
3
3
|
This is a **markdown** component with *formatting* support.
|
|
4
4
|
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import{o as e,r as t}from"./rolldown-runtime-C0FnF6B9.js";import{t as n,v as r}from"./vendor-react-BggL7APJ.js";import{Br as i,Ci as a,Hr as o,On as s,Ur as c,Vr as l,Wr as u,p as d,ri as f,v as p,yi as m}from"./ui-components-D6cEVg0T.js";import{$i as h,$r as g,C as _,Cn as v,En as y,Er as b,Fn as x,In as S,Mn as C,Nn as w,On as T,Ot as E,Pn as D,Qr as ee,S as O,Tn as te,Yi as k,_ as ne,an as re,cn as A,gt as j,hn as ie,kn as ae,mt as M,on as N,sn as P,vn as oe,zn as F}from"./framework-DFR4HNtj.js";import{g as I,m as L,o as se,p as R,t as z,w as ce}from"./i18n-runtime-97_bDVjP.js";import{t as B}from"./vendor-icon-download-C3csYSaD.js";import{t as le}from"./vendor-icon-loader-circle-D3PsuVaD.js";import{t as ue}from"./vendor-icon-printer-VcYhF59P.js";import{t as de}from"./vendor-icon-refresh-cw-BGjSPEfJ.js";import{t as fe}from"./vendor-icon-table-2-DMQ6UahM.js";import{t as pe}from"./vendor-icon-triangle-alert-D5n0T3q_.js";var V=e(r(),1),H=n(),me=({schema:e})=>{let{title:t,description:n,data:r,columns:a}=e;e.chart?.type;let s=!!e.chart;return(0,H.jsxs)(i,{className:`h-full flex flex-col ${e.className||``}`,children:[(0,H.jsxs)(c,{children:[t&&(0,H.jsx)(u,{children:t}),n&&(0,H.jsx)(o,{children:n})]}),(0,H.jsxs)(l,{className:`flex-1 overflow-auto space-y-4`,children:[s&&(()=>{let t=e.chart?.type,n=t?k.get(t):null;return n||=k.get(`chart`),n?(0,H.jsx)(`div`,{className:`min-h-[300px] border rounded-lg p-4 bg-background/50`,children:(0,H.jsx)(n,{schema:{...e.chart,data:e.chart.data||r}})}):(0,H.jsxs)(`div`,{className:`min-h-[100px] border rounded-md p-4 bg-muted/20 text-muted-foreground flex items-center justify-center`,children:[`Unknown component type: `,t||`chart`]})})(),r&&r.length>0&&(0,H.jsx)(`div`,{className:`border rounded-lg`,children:(()=>{let e=k.get(`grid`)||k.get(`table`);return e?(0,H.jsx)(e,{schema:{type:`grid`,rowData:r,columnDefs:a,domLayout:`autoHeight`}}):(0,H.jsx)(`div`,{className:`overflow-x-auto`,children:(0,H.jsxs)(`table`,{className:`w-full text-sm text-left`,children:[(0,H.jsx)(`thead`,{className:`text-xs uppercase bg-muted`,children:(0,H.jsx)(`tr`,{children:a?.map(e=>(0,H.jsx)(`th`,{className:`px-6 py-3`,children:e.headerName||e.label||e.field},e.field))})}),(0,H.jsx)(`tbody`,{children:r.map((e,t)=>(0,H.jsx)(`tr`,{className:`bg-background border-b`,children:a?.map(t=>(0,H.jsx)(`td`,{className:`px-6 py-4`,children:e[t.field]},t.field))},t))})]})})})()})]})]})};function U(e,t,n){try{return e.toLocaleString(t,n)}catch{return e.toLocaleString(`en`,n)}}function he(e,t,n){let r=e.fields||[],i=r.map(e=>e.label||e.name),a=t.map(e=>r.map(t=>{let n=e[t.name];return n=ye(n),typeof n==`string`&&(n.includes(`,`)||n.includes(`"`)||n.includes(`
|
|
2
|
+
`))?`"${n.replace(/"/g,`""`)}"`:n??``}));q([...n?.includeHeaders===!1?[]:[i.join(`,`)],...a.map(e=>e.join(`,`))].join(`
|
|
3
|
+
`),n?.filename||`${e.title||`report`}.csv`,`text/csv`)}function ge(e,t,n){let r={title:e.title,description:e.description,generatedAt:new Date().toISOString(),data:t};q(JSON.stringify(r,null,2),n?.filename||`${e.title||`report`}.json`,`application/json`)}function W(e,t,n,r=`en`){let i=e.fields||[],a=xe(n?.orientation),o=be(n?.pageSize);q(`<!DOCTYPE html>
|
|
4
|
+
<html>
|
|
5
|
+
<head>
|
|
6
|
+
<meta charset="utf-8">
|
|
7
|
+
<title>${K(e.title||`Report`)}</title>
|
|
8
|
+
<style>
|
|
9
|
+
@page { size: ${o} ${a}; margin: 20mm; }
|
|
10
|
+
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; color: #333; }
|
|
11
|
+
h1 { font-size: 24px; margin-bottom: 8px; }
|
|
12
|
+
.description { color: #666; margin-bottom: 24px; }
|
|
13
|
+
.meta { color: #999; font-size: 12px; margin-bottom: 16px; }
|
|
14
|
+
table { width: 100%; border-collapse: collapse; margin-top: 16px; }
|
|
15
|
+
th { background: #f5f5f5; text-align: left; padding: 8px 12px; border: 1px solid #ddd; font-weight: 600; }
|
|
16
|
+
td { padding: 8px 12px; border: 1px solid #ddd; }
|
|
17
|
+
tr:nth-child(even) { background: #fafafa; }
|
|
18
|
+
</style>
|
|
19
|
+
</head>
|
|
20
|
+
<body>
|
|
21
|
+
<h1>${K(e.title||`Report`)}</h1>
|
|
22
|
+
${e.description?`<p class="description">${K(e.description)}</p>`:``}
|
|
23
|
+
<p class="meta">Generated: ${new Date().toLocaleString(r)}</p>
|
|
24
|
+
<table>
|
|
25
|
+
<thead><tr>${i.map(e=>`<th>${K(e.label||e.name)}</th>`).join(``)}</tr></thead>
|
|
26
|
+
<tbody>${t.map(e=>`<tr>${i.map(t=>`<td>${K(String(e[t.name]??``))}</td>`).join(``)}</tr>`).join(``)}</tbody>
|
|
27
|
+
</table>
|
|
28
|
+
</body>
|
|
29
|
+
</html>`,n?.filename||`${e.title||`report`}.html`,`text/html`)}function _e(e,t,n,r=`en`){let i=e.fields||[],a=xe(n?.orientation),o=be(n?.pageSize),s=window.open(``,`_blank`);if(!s){W(e,t,{...n,format:`html`,filename:n?.filename?.replace(/\.pdf$/,`.html`)||`${e.title||`report`}.html`},r);return}s.document.write(`<!DOCTYPE html>
|
|
30
|
+
<html>
|
|
31
|
+
<head>
|
|
32
|
+
<meta charset="utf-8">
|
|
33
|
+
<title>${K(e.title||`Report`)}</title>
|
|
34
|
+
<style>
|
|
35
|
+
@page { size: ${o} ${a}; margin: 20mm; }
|
|
36
|
+
@media print { .no-print { display: none; } }
|
|
37
|
+
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; color: #333; }
|
|
38
|
+
h1 { font-size: 24px; margin-bottom: 8px; }
|
|
39
|
+
.description { color: #666; margin-bottom: 24px; }
|
|
40
|
+
.meta { color: #999; font-size: 12px; margin-bottom: 16px; }
|
|
41
|
+
table { width: 100%; border-collapse: collapse; margin-top: 16px; }
|
|
42
|
+
th { background: #f5f5f5; text-align: left; padding: 8px 12px; border: 1px solid #ddd; font-weight: 600; }
|
|
43
|
+
td { padding: 8px 12px; border: 1px solid #ddd; }
|
|
44
|
+
tr:nth-child(even) { background: #fafafa; }
|
|
45
|
+
</style>
|
|
46
|
+
</head>
|
|
47
|
+
<body>
|
|
48
|
+
<h1>${K(e.title||`Report`)}</h1>
|
|
49
|
+
${e.description?`<p class="description">${K(e.description)}</p>`:``}
|
|
50
|
+
<p class="meta">Generated: ${new Date().toLocaleString(r)}</p>
|
|
51
|
+
<table>
|
|
52
|
+
<thead><tr>${i.map(e=>`<th>${K(e.label||e.name)}</th>`).join(``)}</tr></thead>
|
|
53
|
+
<tbody>${t.map(e=>`<tr>${i.map(t=>`<td>${K(String(e[t.name]??``))}</td>`).join(``)}</tr>`).join(``)}</tbody>
|
|
54
|
+
</table>
|
|
55
|
+
</body>
|
|
56
|
+
</html>`),s.document.close(),s.onload=()=>{s.print()}}function ve(e,t,n){let r=e.fields||[],i=r.map(e=>e.label||e.name),a=t.map(e=>r.map(t=>{let n=e[t.name];return n=ye(n),typeof n==`string`&&(n.includes(`,`)||n.includes(`"`)||n.includes(`
|
|
57
|
+
`)||n.includes(` `))?`"${n.replace(/"/g,`""`)}"`:n??``}));q(``+[...n?.includeHeaders===!1?[]:[i.join(` `)],...a.map(e=>e.join(` `))].join(`
|
|
58
|
+
`),n?.filename||`${e.title||`report`}.tsv`,`text/tab-separated-values`)}function G(e,t,n,r,i=`en`){switch(e){case`csv`:he(t,n,r);break;case`json`:ge(t,n,r);break;case`html`:W(t,n,r,i);break;case`pdf`:_e(t,n,r,i);break;case`excel`:ve(t,n,r);break;default:console.warn(`Unsupported export format: ${e}`)}}function K(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function ye(e){if(typeof e==`string`&&e.length>0){let t=e.charAt(0);if(t===`=`||t===`+`||t===`-`||t===`@`||t===`|`)return`\t${e}`}return e}function be(e){return[`A4`,`A3`,`Letter`,`Legal`].includes(e||``)?e:`A4`}function xe(e){return e===`landscape`?`landscape`:`portrait`}function q(e,t,n){let r=new Blob([e],{type:`${n};charset=utf-8`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=t,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)}function J(e,t,n=`en`){if(e==null||e===``)return``;let r=t?.type,i=t?.format;if(r===`date`||i===`date`||Se(e))return Ce(e);if(r===`number`||typeof e==`number`){let t=typeof e==`number`?e:Number(e);return isNaN(t)?String(e):i===`currency`||i===`currency_cny`?`¥${U(t,n,{minimumFractionDigits:0,maximumFractionDigits:0})}`:i===`currency_usd`?`$${U(t,n,{minimumFractionDigits:0,maximumFractionDigits:0})}`:i===`percent`?`${U(t,n,{minimumFractionDigits:1,maximumFractionDigits:1})}%`:U(t,n)}return String(e)}function Se(e){return typeof e==`string`&&/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2})?/.test(e)}function Ce(e){try{let t=b(e);return isNaN(t.getTime())?String(e):`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}catch{return String(e)}}function we(e,t){if(!t||t.length===0||!e||e.length===0)return null;let n=t[0],r=n.field,i=new Map;for(let t of e){let e=String(t[r]??`(empty)`);i.has(e)||i.set(e,[]),i.get(e).push(t)}let a=[];for(let[e,t]of i)a.push({key:e,label:`${n.label||r}: ${e}`,rows:t});let o=n.sort===`desc`?-1:1;return a.sort((e,t)=>e.key.localeCompare(t.key)*o),a}function Te(e,t,n){if(!e)return 0;let r=e.map(e=>Number(e[t])||0);switch(n){case`count`:return e.length;case`sum`:return r.reduce((e,t)=>e+t,0);case`avg`:return r.length>0?(r.reduce((e,t)=>e+t,0)/r.length).toFixed(2):0;case`min`:return r.length>0?Math.min(...r):0;case`max`:return r.length>0?Math.max(...r):0;case`distinct`:return new Set(e.map(e=>e[t])).size;default:return``}}var Y=({schema:e,onRefresh:t})=>{let{report:n,data:r,showToolbar:h=!0,allowExport:g=!0,allowPrint:_=!0,loading:v=!1}=e,y=I(),b=z(),x=e=>{if(!n){console.warn(`ReportViewer: Cannot export, no report defined`);return}G(e,n,r||[],n.exportConfigs?.[e],b)},S=y(`common.printDialogHint`,`Opens your browser’s print dialog (not a PDF export)`),C=()=>{window.print()},w=()=>{t?.()},T=(e,t)=>Te(r,e,t),E=(e,t)=>{let r=n?.conditionalFormatting;if(r&&Array.isArray(r))for(let n of r){if(n.field!==e)continue;let r=String(t??``),i=String(n.value??``),a=!1;switch(n.operator){case`equals`:a=r===i;break;case`not_equals`:a=r!==i;break;case`contains`:a=r.includes(i);break;case`greater_than`:a=Number(t)>Number(n.value);break;case`less_than`:a=Number(t)<Number(n.value)}if(a){let e={};return n.backgroundColor&&(e.backgroundColor=n.backgroundColor),n.textColor&&(e.color=n.textColor),e}}},D=(e,t)=>{if(e==null||e===``)return``;if(t.renderAs===`badge`&&(!t.type||t.type===`string`||t.type===`text`)){let n=t.colorMap?.[String(e)]||``;return(0,H.jsx)(f,{className:n,children:String(e)})}if(t.aggregation)return J(e,t,b);if(t.type){let n={...t};t.colorMap&&!n.options&&(n.options=Object.entries(t.colorMap).map(([e,t])=>({value:e,label:e,color:t})));let r=d(p(n));return(0,H.jsx)(r,{value:e,field:n})}return J(e,t,b)};return n?(0,H.jsxs)(`div`,{className:`space-y-4`,children:[h&&(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2 p-4 bg-card rounded-lg border`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h2`,{className:`text-lg font-semibold`,children:n.title}),n.description&&(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n.description})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,"data-print-hide":!0,children:[n.refreshInterval&&(0,H.jsxs)(m,{variant:`outline`,size:`sm`,onClick:w,children:[(0,H.jsx)(de,{className:`h-4 w-4 mr-2`}),`Refresh`]}),_&&(0,H.jsxs)(m,{variant:`outline`,size:`sm`,onClick:C,"aria-label":`Print: ${S}`,title:S,children:[(0,H.jsx)(ue,{className:`h-4 w-4 mr-2`}),`Print`]}),g&&n.showExportButtons&&(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,H.jsxs)(m,{variant:`outline`,size:`sm`,onClick:()=>x(`pdf`),children:[(0,H.jsx)(B,{className:`h-4 w-4 mr-2`}),`PDF`]}),(0,H.jsxs)(m,{variant:`outline`,size:`sm`,onClick:()=>x(`excel`),children:[(0,H.jsx)(B,{className:`h-4 w-4 mr-2`}),`Excel`]}),(0,H.jsxs)(m,{variant:`outline`,size:`sm`,onClick:()=>x(`csv`),children:[(0,H.jsx)(B,{className:`h-4 w-4 mr-2`}),`CSV`]})]})]})]}),(0,H.jsxs)(i,{children:[(0,H.jsxs)(c,{children:[!h&&n.title&&(0,H.jsx)(u,{children:n.title}),!h&&n.description&&(0,H.jsx)(o,{children:n.description})]}),(0,H.jsxs)(l,{className:`space-y-6`,children:[v&&(0,H.jsxs)(`div`,{className:`space-y-6`,children:[(0,H.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-3 gap-4`,children:[1,2,3].map(e=>(0,H.jsx)(i,{children:(0,H.jsxs)(l,{className:`p-4 space-y-2`,children:[(0,H.jsx)(s,{className:`h-4 w-20`}),(0,H.jsx)(s,{className:`h-8 w-28`})]})},e))}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(s,{className:`h-10 w-full`}),[1,2,3,4,5].map(e=>(0,H.jsx)(s,{className:`h-8 w-full`},e))]})]}),!v&&n.sections?.map((e,t)=>e.visible===!1?null:(0,H.jsxs)(`div`,{className:`space-y-2`,children:[e.title&&e.type!==`header`&&(0,H.jsx)(`h3`,{className:`text-lg font-semibold border-b pb-2`,children:e.title}),e.type===`header`&&e.title&&(0,H.jsx)(`div`,{className:`text-2xl font-bold py-4`,children:e.title}),e.type===`summary`&&(0,H.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-3 gap-4`,children:n.fields?.filter(e=>e.showInSummary).map((e,t)=>(0,H.jsx)(i,{children:(0,H.jsxs)(l,{className:`p-4`,children:[(0,H.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:e.label||e.name}),(0,H.jsx)(`div`,{className:`text-2xl font-bold`,children:J(T(e.name,e.aggregation),e,b)})]})},t))}),e.type===`table`&&(0,H.jsx)(`div`,{className:`border rounded-lg overflow-x-auto`,children:(0,H.jsxs)(`table`,{className:`w-full text-sm min-w-[600px]`,children:[(0,H.jsx)(`thead`,{className:`bg-muted`,children:(0,H.jsx)(`tr`,{children:e.columns?.map((e,t)=>(0,H.jsx)(`th`,{className:`px-4 py-2 font-medium ${e.type===`number`?`text-right`:`text-left`}`,children:e.label||e.name},t))})}),(0,H.jsx)(`tbody`,{children:(()=>{let t=we(r||[],n.groupBy||[]);return t?t.map(t=>(0,H.jsxs)(V.Fragment,{children:[(0,H.jsx)(`tr`,{className:`bg-muted/60`,children:(0,H.jsxs)(`td`,{colSpan:e.columns?.length||1,className:`px-4 py-2 font-semibold text-sm`,children:[t.label,` (`,t.rows.length,`)`]})}),t.rows.map((t,n)=>(0,H.jsx)(`tr`,{className:`border-t hover:bg-muted/50 even:bg-muted/20`,children:e.columns?.map((e,n)=>(0,H.jsx)(`td`,{className:`px-4 py-2 ${e.type===`number`?`text-right tabular-nums`:``}`,style:E(e.name,t[e.name]),children:D(t[e.name],e)},n))},n))]},t.key)):r?.map((t,n)=>(0,H.jsx)(`tr`,{className:`border-t hover:bg-muted/50 even:bg-muted/20`,children:e.columns?.map((e,n)=>(0,H.jsx)(`td`,{className:`px-4 py-2 ${e.type===`number`?`text-right tabular-nums`:``}`,style:E(e.name,t[e.name]),children:D(t[e.name],e)},n))},n))})()})]})}),e.type===`text`&&e.text&&(0,H.jsx)(`div`,{className:`prose max-w-none`,children:(0,H.jsx)(`p`,{children:e.text})}),e.type===`page-break`&&(0,H.jsx)(`div`,{className:`border-t-2 border-dashed my-8 print:page-break-after-always`}),Array.isArray(e.content)?e.content.map((e,t)=>(0,H.jsx)(j,{schema:M(e)},t)):a(e.content,e=>(0,H.jsx)(j,{schema:M(e)}))]},t)),!n.sections&&r&&r.length>0&&(0,H.jsx)(`div`,{className:`border rounded-lg overflow-x-auto`,children:(0,H.jsxs)(`table`,{className:`w-full text-sm min-w-[600px]`,children:[(0,H.jsx)(`thead`,{className:`bg-muted`,children:(0,H.jsx)(`tr`,{children:n.fields?.map((e,t)=>(0,H.jsx)(`th`,{className:`px-4 py-2 font-medium ${e.type===`number`?`text-right`:`text-left`}`,children:e.label||e.name},t))})}),(0,H.jsx)(`tbody`,{children:r.map((e,t)=>(0,H.jsx)(`tr`,{className:`border-t hover:bg-muted/50 even:bg-muted/20`,children:n.fields?.map((t,n)=>(0,H.jsx)(`td`,{className:`px-4 py-2 ${t.type===`number`?`text-right tabular-nums`:``}`,style:E(t.name,e[t.name]),children:D(e[t.name],t)},n))},t))})]})})]})]})]}):(0,H.jsx)(i,{children:(0,H.jsx)(l,{className:`p-8 text-center text-muted-foreground`,children:`No report to display`})})};function Ee(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.dataset==`string`&&t.dataset.length>0||t.type===`joined`&&Array.isArray(t.blocks)&&t.blocks.some(e=>typeof e?.dataset==`string`)}var De=new Set,Oe=()=>!1;function ke(e,t){if(!Oe())return;let n=e.filter;if(n===void 0)return;let r=`${t}:${n&&typeof n==`object`?Object.keys(n).sort().join(`,`):String(n)}`;De.has(r)||(De.add(r),console.warn(`[ObjectUI] ${t} carries \`filter\`, which is not an authorable key. Did you mean \`filter\` → \`runtimeFilter\`? NO filter was applied — it renders UNFILTERED, showing rows the report was scoped to exclude. \`ReportSchema\` (\`@objectstack/spec\`) is strict and rejects \`filter\`, so this document did not come through the validated path; the renderer no longer reads it either. Fix the producer: rename \`filter\` to \`runtimeFilter\`. (objectui#5137)`))}function Ae(e){return`Report \`${e.name??`(unnamed)`}\``}function je(e,t){return e?typeof e==`string`?e:typeof e==`object`&&typeof e.default==`string`?e.default:t:t}function X(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`&&!!e):[]}function Me(e){if(!Array.isArray(e))return;let t={};for(let n of e){let e=n&&typeof n==`object`?n.by:void 0;typeof e==`string`&&e&&(t[e]=n.direction===`desc`?`desc`:`asc`)}return Object.keys(t).length>0?t:void 0}function Ne(e,t,n){if(!e)return;let r=new Set([...t,...n]),i={};for(let[t,n]of Object.entries(e))r.has(t)&&(i[t]=n);return Object.keys(i).length>0?i:void 0}function Z(e,t,n,r,i,a,o){let[s,c]=V.useState({status:`idle`,rows:[]}),l=Ne(o,t,n),u=JSON.stringify(r??null),d=JSON.stringify(a??null),f=JSON.stringify(l??null),p=`${e}|${t.join(`,`)}|${n.join(`,`)}|${u}|${d}|${f}`,[m,h]=V.useState(void 0),g=ne(m),_=V.useRef(null);return V.useEffect(()=>{let o=i;if(!o||typeof o.queryDataset!=`function`){_.current=null,h(void 0),c({status:`error`,rows:[],error:`This data source does not support dataset queries.`});return}if(!e||n.length===0){_.current=null,h(void 0),c({status:`idle`,rows:[]});return}let s=!1,u=_.current===p;return _.current=p,u||(h(void 0),c({status:`loading`,rows:[]})),o.queryDataset(e,{dimensions:t,measures:n,...r&&Object.keys(r).length>0?{runtimeFilter:r}:{},...a?{totals:{groupings:a}}:{},...l?{order:l}:{}}).then(e=>{s||(h(typeof e?.object==`string`&&e.object?e.object:void 0),c({status:`ok`,rows:Array.isArray(e?.rows)?e.rows:[],fields:Array.isArray(e?.fields)?e.fields:[],object:e?.object,dimensionFields:e?.dimensionFields,drillRawRows:Array.isArray(e?.drillRawRows)?e.drillRawRows:void 0,drillRanges:Array.isArray(e?.drillRanges)?e.drillRanges:void 0,totals:Array.isArray(e?.totals)?e.totals:void 0}))}).catch(e=>{s||c({status:`error`,rows:[],error:String(e?.message??e)})}),()=>{s=!0}},[p,g]),s}function Pe(...e){try{return re(...e)}catch(e){if(!(e instanceof h))throw e;return console.warn(`[DatasetReportRenderer] drill-down refused — the drilled list cannot be scoped: ${e.message}`),null}}function Fe({dataset:e}){return(0,H.jsxs)(`div`,{className:`flex items-center justify-center rounded-md border border-dashed bg-muted/20 p-4 text-xs text-muted-foreground`,children:[`This report binds the “`,e,`” dataset — choose at least one measure (values) to render.`]})}function Q({status:e,error:t}){return e===`error`?(0,H.jsxs)(`div`,{role:`alert`,className:`flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/5 px-3 py-2 text-xs text-destructive`,children:[(0,H.jsx)(pe,{className:`h-3.5 w-3.5 mt-0.5 shrink-0`}),(0,H.jsx)(`span`,{className:`break-words`,children:t})]}):(0,H.jsxs)(`div`,{className:`flex items-center gap-2 p-4 text-xs text-muted-foreground`,children:[(0,H.jsx)(le,{className:`h-4 w-4 animate-spin`}),` Running report…`]})}function Ie(){return(0,H.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 rounded-md border border-dashed bg-muted/20 p-6 text-xs text-muted-foreground`,children:[(0,H.jsx)(fe,{className:`h-6 w-6`}),` The dataset returned no rows for this report’s scope.`]})}var Le=`cursor-pointer hover:bg-accent/40`;function Re({dataset:e,rows:t,values:n,runtimeFilter:r,dataSource:i,onDrill:a,order:o,withTotals:s}){let c=Z(e,t,n,r,i,s&&t.length>0?[[]]:void 0,o),{fieldLabel:l}=R(),u=I(),d=z(),f=O(c.object,c.dimensionFields,t);if(n.length===0)return(0,H.jsx)(Fe,{dataset:e});if(c.status===`loading`||c.status===`idle`)return(0,H.jsx)(Q,{status:c.status});if(c.status===`error`)return(0,H.jsx)(Q,{status:`error`,error:c.error});if(c.rows.length===0)return(0,H.jsx)(Ie,{});let p=!!a&&t.length>0,m=c.dimensionFields?t.filter(e=>e in c.dimensionFields):[],h=(n,i)=>{let o={};for(let e of t)o[e]=n[e];let s=c.drillRanges?.[i],l=!!s&&Object.keys(s).length>0,u;if(c.object&&(m.length>0||l)){let e=Pe(c.drillRawRows?.[i],m,c.dimensionFields??{},r,s);if(e===null)return;u=e}a({dataset:e,groupKey:o,runtimeFilter:r,object:c.object,objectFilter:u})},{measureField:g,headerLabel:_}=N(c.fields,c.object,l,L(u)),v=[...t,...n],y=w(c.rows,f),b=s?c.totals?.find(e=>Array.isArray(e.dimensions)&&e.dimensions.length===0)?.rows?.[0]:void 0,x=u(`report.total`,`Total`);return(0,H.jsx)(`div`,{className:`overflow-auto max-h-[70vh] rounded-md border`,children:(0,H.jsxs)(`table`,{className:`w-full text-xs`,children:[(0,H.jsx)(`thead`,{className:`bg-muted/40`,children:(0,H.jsx)(`tr`,{children:v.map(e=>(0,H.jsx)(`th`,{className:`px-2 py-1.5 text-left font-medium whitespace-nowrap`,children:_(e)},e))})}),(0,H.jsxs)(`tbody`,{children:[y.map((e,t)=>(0,H.jsx)(`tr`,{className:`border-t${p?` ${Le}`:``}`,"data-testid":p?`dataset-drill-row`:void 0,onClick:p?()=>h(c.rows[t],t):void 0,children:v.map(t=>(0,H.jsx)(`td`,{className:`px-2 py-1 tabular-nums whitespace-nowrap`,children:n.includes(t)?A(e[t],g(t)?.format,g(t)?.currency,g(t)?.percentScale,d):P(e[t],d)},t))},t)),b&&(0,H.jsxs)(`tr`,{className:`border-t bg-muted/30 font-medium`,"data-testid":`dataset-report-total-row`,children:[t.length>0&&(0,H.jsx)(`td`,{colSpan:t.length,className:`px-2 py-1 whitespace-nowrap`,children:x}),n.map(e=>(0,H.jsx)(`td`,{className:`px-2 py-1 tabular-nums whitespace-nowrap`,children:A(b[e],g(e)?.format,g(e)?.currency,g(e)?.percentScale,d)},e))]})]})]})})}function ze(e){switch(e){case`summary`:return`summary`;case`matrix`:return`matrix`;case`joined`:return`joined`;default:return`tabular`}}function Be(e){switch(e){case`bar`:case`column`:case`horizontal-bar`:case`line`:case`area`:case`pie`:case`donut`:case`funnel`:case`scatter`:case`treemap`:case`sankey`:case`radar`:case`combo`:return{kind:`series`,chartType:e};case`gauge`:case`solid-gauge`:case`metric`:case`kpi`:case`bullet`:return{kind:`single_value`};case`table`:case`pivot`:return{kind:`tabular`};default:return{kind:`unsupported`,type:String(e)}}}function Ve(e){let[,t]=V.useReducer(e=>e+1,0);return V.useEffect(()=>{if(k.get(e))return;let n=typeof k.subscribe==`function`?k.subscribe(()=>{k.get(e)&&t()}):void 0,r=k.loadLazy?.(e);return r&&typeof r.then==`function`&&r.then(()=>t()).catch(()=>{}),n},[e]),k.get(e)}function He(e,t,n){if(Array.isArray(e)&&t)for(let r of e){if(!r||typeof r!=`object`)continue;let{name:e,label:i}=r;if(e===t)return se(i,n)||void 0}}function Ue({dataset:e,chart:t,runtimeFilter:n,dataSource:r,order:i}){let a=typeof t.xAxis==`string`?t.xAxis:``,o=typeof t.yAxis==`string`?t.yAxis:``,s=Be(t.type),c=s.kind===`series`||s.kind===`single_value`,l=Z(e,s.kind===`series`&&a?[a]:[],c&&o?[o]:[],n,r,void 0,i),u=Ve(`chart`),{fieldLabel:d,fieldOptionLabel:f}=R(),p=I(),m=z(),{language:h}=ce(),g=V.useMemo(()=>a?[a]:[],[a]),b=_(l.object,l.dimensionFields,g),{categoryColors:x,dimensionLabels:S,categoryOrder:E}=V.useMemo(()=>{if(!b)return{categoryColors:null,dimensionLabels:null,categoryOrder:null};let{metaByPath:e,relabel:t}=b,n=t[0]?.path,r=n?e[n]:void 0,i=n?C(r?.options,ae(r,f)):void 0;return{categoryColors:y(i),dimensionLabels:T(e,t,f),categoryOrder:v(i)}},[b,f]),D=se(t.title,h)||void 0;if(s.kind===`tabular`)return null;if(s.kind===`unsupported`)return(0,H.jsxs)(`div`,{className:`rounded-md border border-dashed bg-muted/20 px-3 py-2 text-xs text-muted-foreground`,"data-testid":`dataset-report-chart-unsupported`,children:[`Chart type “`,s.type,`” is not a spec chart type — the report’s table carries its numbers.`]});if(s.kind===`series`&&!a||!o)return null;if(l.status===`loading`||l.status===`idle`)return(0,H.jsxs)(`div`,{className:`flex items-center gap-2 p-4 text-xs text-muted-foreground`,children:[(0,H.jsx)(le,{className:`h-4 w-4 animate-spin`}),` Loading chart…`]});if(l.status===`error`||l.rows.length===0)return null;let{measureField:ee,headerLabel:O}=N(l.fields,l.object,d,L(p)),k=He(t.series,o,h)??O(o);if(s.kind===`single_value`){let e=ee(o);return(0,H.jsxs)(`div`,{className:`rounded-md border bg-card p-3`,"data-testid":`dataset-report-metric`,children:[D?(0,H.jsx)(`h3`,{className:`mb-2 text-sm font-semibold`,children:D}):null,(0,H.jsxs)(`div`,{className:`flex flex-col gap-0.5 py-2`,children:[(0,H.jsx)(`span`,{className:`text-2xl font-semibold tabular-nums`,children:A(l.rows[0]?.[o],e?.format,e?.currency,e?.percentScale,m)}),(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:k})]})]})}if(!u)return null;let{data:ne,xAxisKey:re,series:j}=te(w(l.rows,S),[a],[o],l.fields,{nullCategoryLabel:p(`chart.nullCategory`,`(None)`),builtinAggregateLabels:L(p)}),M=oe(j,t.series).map(e=>e.dataKey===o?{...e,label:k}:e),{title:P,...F}=ie(t,x);return(0,H.jsxs)(`div`,{className:`rounded-md border bg-card p-3`,"data-testid":`dataset-report-chart`,children:[D?(0,H.jsx)(`h3`,{className:`mb-2 text-sm font-semibold`,children:D}):null,(0,H.jsx)(u,{schema:{chartType:s.chartType,data:ne,xAxisKey:re,series:M,height:280,isAnimationActive:!1,...F,...E?{categoryOrder:E}:{}}})]})}function $(e,t){return D(e.map(e=>S(t[e])))}function We(e,t,n){return e.map(e=>P(t[e],n)).join(` / `)}function Ge({dataset:e,rows:t,columnsAcross:n,values:r,runtimeFilter:i,dataSource:a,onDrill:o,order:s}){let c=Z(e,[...t,...n],r,i,a,[t,n,[]],s),l=I(),{fieldLabel:u}=R(),d=z(),f=O(c.object,c.dimensionFields,[...t,...n]),p=V.useMemo(()=>{if(c.status!==`ok`)return null;let e=[],r=[],i=new Set,a=new Set,o=new Map;return w(c.rows,f).forEach((s,l)=>{let u=c.rows[l],f=$(t,s),p=$(n,s);if(!i.has(f)){i.add(f);let n={},r={};for(let e of t)n[e]=u[e],r[e]=s[e];e.push({id:f,label:We(t,s,d),key:n,display:r})}if(!a.has(p)){a.add(p);let e={},t={};for(let r of n)e[r]=u[r],t[r]=s[r];r.push({id:p,label:We(n,s,d),key:e,display:t})}o.set(x(f,p),{row:u,index:l})}),{rowHeaders:e,colHeaders:r,cells:o}},[c,t,n,f,d]);if(r.length===0)return(0,H.jsx)(Fe,{dataset:e});if(c.status===`loading`||c.status===`idle`)return(0,H.jsx)(Q,{status:c.status});if(c.status===`error`)return(0,H.jsx)(Q,{status:`error`,error:c.error});if(!p||p.rowHeaders.length===0)return(0,H.jsx)(Ie,{});let{measureField:m,headerLabel:h}=N(c.fields,c.object,u,L(l)),g=l(`report.total`,`Total`),_=!!o,v=c.dimensionFields?[...t,...n].filter(e=>e in c.dimensionFields):[],y=(t,n,r)=>{let a=c.drillRanges?.[r],s=!!a&&Object.keys(a).length>0,l;if(c.object&&(v.length>0||s)){let e=Pe(c.drillRawRows?.[r],v,c.dimensionFields??{},i,a);if(e===null)return;l=e}o({dataset:e,groupKey:{...t,...n},runtimeFilter:i,object:c.object,objectFilter:l})},b=p.colHeaders.flatMap(e=>r.map(t=>({col:e,measure:t,header:r.length===1?e.label:`${e.label} · ${h(t)}`}))),S=e=>{let t=c.totals?.find(t=>Array.isArray(t.dimensions)&&t.dimensions.join(`,`)===e.join(`,`))?.rows;return t&&w(t,f)},C=new Map;for(let e of S(t)??[])C.set($(t,e),e);let T=new Map;for(let e of S(n)??[])T.set($(n,e),e);let E=S([])?.[0],D=C.size>0,ee=T.size>0;return(0,H.jsx)(`div`,{className:`overflow-auto max-h-[70vh] rounded-md border`,"data-testid":`dataset-matrix`,children:(0,H.jsxs)(`table`,{className:`w-full text-xs`,children:[(0,H.jsx)(`thead`,{className:`bg-muted/40`,children:(0,H.jsxs)(`tr`,{children:[t.map(e=>(0,H.jsx)(`th`,{className:`px-2 py-1.5 text-left font-medium whitespace-nowrap`,children:h(e)},e)),b.map(e=>(0,H.jsx)(`th`,{className:`px-2 py-1.5 text-right font-medium whitespace-nowrap`,children:e.header},`${e.col.id}-${e.measure}`)),D&&r.map(e=>(0,H.jsx)(`th`,{className:`px-2 py-1.5 text-right font-medium whitespace-nowrap`,"data-testid":`matrix-total-col-header`,children:r.length===1?g:`${g} · ${h(e)}`},`total-${e}`))]})}),(0,H.jsxs)(`tbody`,{children:[p.rowHeaders.map(e=>(0,H.jsxs)(`tr`,{className:`border-t`,children:[t.map(t=>(0,H.jsx)(`td`,{className:`px-2 py-1 whitespace-nowrap font-medium`,children:P(e.display[t],d)},t)),b.map(t=>{let n=p.cells.get(x(e.id,t.col.id)),r=n?.row[t.measure],i=_&&n!=null;return(0,H.jsx)(`td`,{className:`px-2 py-1 text-right tabular-nums whitespace-nowrap${i?` ${Le}`:``}`,"data-testid":i?`dataset-drill-cell`:void 0,onClick:i?()=>y(e.key,t.col.key,n.index):void 0,children:A(r,m(t.measure)?.format,m(t.measure)?.currency,m(t.measure)?.percentScale,d)},`${t.col.id}-${t.measure}`)}),D&&r.map(t=>(0,H.jsx)(`td`,{className:`px-2 py-1 text-right tabular-nums whitespace-nowrap font-medium`,"data-testid":`matrix-row-total`,children:A(C.get(e.id)?.[t],m(t)?.format,m(t)?.currency,m(t)?.percentScale,d)},`total-${t}`))]},e.id)),ee&&(0,H.jsxs)(`tr`,{className:`border-t bg-muted/30 font-medium`,"data-testid":`matrix-total-row`,children:[t.length>0&&(0,H.jsx)(`td`,{colSpan:t.length,className:`px-2 py-1 whitespace-nowrap`,children:g}),b.map(e=>(0,H.jsx)(`td`,{className:`px-2 py-1 text-right tabular-nums whitespace-nowrap`,children:A(T.get(e.col.id)?.[e.measure],m(e.measure)?.format,m(e.measure)?.currency,m(e.measure)?.percentScale,d)},`${e.col.id}-${e.measure}`)),D&&r.map(e=>(0,H.jsx)(`td`,{className:`px-2 py-1 text-right tabular-nums whitespace-nowrap`,"data-testid":`matrix-grand-total`,children:A(E?.[e],m(e)?.format,m(e)?.currency,m(e)?.percentScale,d)},`grand-${e}`))]})]})]})})}var Ke=({report:e,dataSource:t,runtimeFilter:n,onDrill:r,className:i})=>{let a=Ae(e);ke(e,a);let o=F(e.runtimeFilter,n),s=e.drilldown===!1?void 0:r,c=ze(e.type);if(c===`joined`&&Array.isArray(e.blocks))return(0,H.jsx)(`div`,{className:i,"data-testid":`dataset-joined-report`,"data-report-name":e.name,style:{display:`flex`,flexDirection:`column`,gap:24},children:e.blocks.map((e,n)=>{ke(e,`${a} block \`${e.name??n}\``);let r=F(o,e.runtimeFilter),i=X(e.columns),c=Me(e.order),l=ze(e.type),u=l===`matrix`&&i.length>0?(0,H.jsx)(Ge,{dataset:String(e.dataset??``),rows:X(e.rows),columnsAcross:i,values:X(e.values),runtimeFilter:r,dataSource:t,onDrill:s,order:c}):(0,H.jsx)(Re,{dataset:String(e.dataset??``),rows:X(e.rows),values:X(e.values),runtimeFilter:r,dataSource:t,onDrill:s,order:c,withTotals:l===`summary`||l===`matrix`});return(0,H.jsxs)(`section`,{"data-testid":`dataset-report-block`,"data-block-id":e.name??`block-${n}`,className:`flex flex-col gap-2 rounded-lg border bg-card p-4`,children:[(0,H.jsxs)(`header`,{className:`flex flex-col gap-0.5`,children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold`,children:je(e.label,e.name??`Block ${n+1}`)}),e.description?(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:je(e.description,``)}):null]}),u]},e.name??`block-${n}`)})});let l=X(e.columns),u=Me(e.order),d=c===`matrix`&&l.length>0,f=e.chart&&typeof e.chart==`object`&&e.chart.type?e.chart:null,p=f?(0,H.jsx)(Ue,{dataset:String(e.dataset??``),chart:f,runtimeFilter:o,dataSource:t,order:u}):null,m=d?(0,H.jsx)(Ge,{dataset:String(e.dataset??``),rows:X(e.rows),columnsAcross:l,values:X(e.values),runtimeFilter:o,dataSource:t,onDrill:s,order:u}):(0,H.jsx)(Re,{dataset:String(e.dataset??``),rows:X(e.rows),values:X(e.values),runtimeFilter:o,dataSource:t,onDrill:s,order:u,withTotals:c===`summary`||c===`matrix`});return(0,H.jsxs)(`div`,{className:`${i??``} flex flex-col gap-3`,"data-testid":`dataset-report`,"data-report-name":e.name,"data-report-presentation":c,children:[d?m:p,d?p:m]})},qe=e=>{let{dataSource:t,rows:n,runtimeFilter:r,onDrill:i,className:a}=e,o=V.useContext(E),s=t??o?.dataSource,c=e.schema;if(c&&typeof c==`object`&&c.type===`spec-report`&&c.report&&typeof c.report==`object`&&(c=c.report),Ee(c))return(0,H.jsx)(Ke,{report:c,dataSource:s,runtimeFilter:r,onDrill:i,className:a});if(ee(c)){let e={type:`report-viewer`,report:g(c),data:n??[],showToolbar:!1};return(0,H.jsx)(`div`,{className:a,"data-testid":`report-presentation-bridge`,children:(0,H.jsx)(Y,{schema:e})})}return(0,H.jsx)(me,{schema:c})};async function Je(e,t){let{dataSource:n,resource:r,queryParams:i,format:a,exportConfig:o,locale:s}=t,c=a||e.defaultExportFormat||`pdf`;try{let t=(await n.find(r,i)).data||[];return G(c,e,t,{format:c,...e.exportConfigs?.[c],...o},s),{success:!0,recordCount:t.length,format:c}}catch(e){return{success:!1,recordCount:0,format:c,error:e.message}}}function Ye(e,t,n={}){let{columns:r,filename:i,includeAggregationRow:a=!1,locale:o=`en`}=n,s=r||(e.fields||[]).map(Ze),c=s.map(e=>e.header),l=t.map((e,t)=>s.map(n=>{if(n.formula)return n.formula.replace(/\{ROW\}/g,String(t+2));let r=e[n.name];return Qe(r,n.numberFormat,o)}));if(a&&t.length>0){let n=s.map((n,r)=>{let i=(e.fields||[]).find(e=>e.name===n.name);if(i?.aggregation){let e=et(r),n=t.length+1;switch(i.aggregation){case`sum`:return`=SUM(${e}2:${e}${n})`;case`avg`:return`=AVERAGE(${e}2:${e}${n})`;case`count`:return`=COUNTA(${e}2:${e}${n})`;case`min`:return`=MIN(${e}2:${e}${n})`;case`max`:return`=MAX(${e}2:${e}${n})`;default:return``}}return``});l.push(n)}nt(``+[c.join(` `),...l.map(e=>e.join(` `))].join(`
|
|
59
|
+
`),i||`${e.title||`report`}.tsv`,`text/tab-separated-values`)}function Xe(e,t,n,r){return async()=>{let i=e.schedule;if(!i?.enabled)return[];let a=i.formats||[e.defaultExportFormat||`pdf`],o=[];for(let r of a){let i=await Je(e,{dataSource:t,resource:n,format:r});o.push(i)}return r(e,i),o}}function Ze(e){return{name:e.name,header:e.label||e.name}}function Qe(e,t,n=`en`){return e==null?``:typeof e==`number`&&t?U(e,n,$e(t)):tt(String(e))}function $e(e){if(e.includes(`%`))return{style:`percent`,minimumFractionDigits:0};let t=(e.match(/0/g)||[]).length;return{minimumFractionDigits:Math.max(0,t-1),maximumFractionDigits:Math.max(0,t-1)}}function et(e){let t=``,n=e;for(;n>=0;)t=String.fromCharCode(n%26+65)+t,n=Math.floor(n/26)-1;return t}function tt(e){if(e.length>0){let t=e.charAt(0);if(t===`=`||t===`+`||t===`-`||t===`@`||t===`|`)return`'${e}`}return e}function nt(e,t,n){let r=new Blob([e],{type:`${n};charset=utf-8`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=t,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)}var rt=t({DatasetReportRenderer:()=>Ke,LegacyReportRenderer:()=>me,ReportRenderer:()=>qe,ReportViewer:()=>Y,createScheduleTrigger:()=>Xe,exportAsCSV:()=>he,exportAsExcel:()=>ve,exportAsHTML:()=>W,exportAsJSON:()=>ge,exportAsPDF:()=>_e,exportExcelWithFormulas:()=>Ye,exportReport:()=>G,exportWithLiveData:()=>Je,formatValue:()=>J,isDatasetReport:()=>Ee,mergeFilters:()=>F});k.register(`report`,qe,{namespace:`plugin-report`,label:`Report`,category:`Report`,inputs:[{name:`title`,type:`string`},{name:`description`,type:`string`},{name:`chart`,type:`code`}]}),k.register(`spec-report`,qe,{namespace:`plugin-report`,label:`Spec Report`,category:`Report`,inputs:[{name:`dataset`,type:`string`},{name:`type`,type:`string`}]}),k.register(`report-viewer`,Y,{namespace:`plugin-report`,label:`Report Viewer`,category:`Report`,inputs:[{name:`report`,type:`code`},{name:`showToolbar`,type:`boolean`}]});export{rt as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e,r as t}from"./rolldown-runtime-C0FnF6B9.js";import{t as n,v as r}from"./vendor-react-BggL7APJ.js";import{ra as i,ta as a,wa as o,ya as s}from"./vendor-objectstack-DFqu45yM.js";import{$ as c,Si as l,xi as u,yt as d}from"./ui-components-D6cEVg0T.js";import{At as f,Dr as p,Ei as m,Er as h,Ni as g,Rr as ee,Tr as _,Xi as v,Yi as y,_ as te,dt as ne,fn as b,in as re,jt as x,kr as ie,lt as ae,pt as oe,u as S,y as se,zi as C}from"./framework-DFR4HNtj.js";import{h as w,p as ce,t as T}from"./i18n-runtime-97_bDVjP.js";import{i as E}from"./vendor-ui-utils-DIUdEYii.js";import{v as le}from"./plugin-grid-D2rmQEW_.js";var D={"timeline.bucket.overdue":`Overdue`,"timeline.bucket.today":`Today`,"timeline.bucket.tomorrow":`Tomorrow`,"timeline.bucket.thisWeek":`This week`,"timeline.bucket.nextWeek":`Next week`,"timeline.bucket.later":`Later`,"timeline.bucket.noDate":`No date`,"timeline.bucket.unassigned":`Unassigned`,"timeline.scale.week":`Week {{n}}`,"timeline.scale.quarter":`Q{{quarter}} {{year}}`,"timeline.gantt.rowLabel":`Items`,"timeline.gantt.unusableRange.malformedDate":`Unusable gantt date range — {{path}} is {{value}}, which is not a valid date. Every gantt date has to parse: the startDate and endDate on every row item, plus any minDate / maxDate pinned on the schema.`,"timeline.gantt.unusableRange.inverted":`Unusable gantt date range — minDate {{minDate}} is after maxDate {{maxDate}}. A pinned minDate / maxDate overrides the range computed from the rows, so this axis has no columns and no bar can be placed on it; swap the two values.`,"timeline.gantt.unusableRange.malformedRow":`Unusable gantt rows — {{path}} is {{value}}, which is not a row shape. A gantt draws items as a list of rows, every row as an object with a label and its own items, and every row's items as a list of bars; a null, a number, a string or a plain object in any of those places cannot be drawn.`,"timeline.unsupported.objectBoundGantt":`Unsupported variant "gantt" — an object-bound timeline renders the feed variants ({{variants}}). Gantt needs literal rows, each with its own nested items, so the gantt axis (scale) has no effect here.`,"timeline.unconfigured.noDateAxis":`Timeline date axis required — this view declares no date field, and an object-bound timeline will not invent one. Declare one of: {{fields}}. The first is the spec spelling; the rest are legacy aliases.`},ue=`timeline.bucket.today`,de=(e,t)=>Object.entries(t??{}).reduce((e,[t,n])=>e.split(`{{${t}}}`).join(String(n)),D[e]||e),fe=w(D,ue),O=e(r(),1),k=n(),A=new Set([`hour`,`day`,`week`,`month`,`quarter`,`year`]);function pe(e){let t=e.scale;return typeof t==`string`&&A.has(t)?t:`month`}function j(e){return typeof e==`string`?h(e):new Date(e)}function M(e){let t=new Date(e);return t.setHours(0,0,0,0),t}var me=36e5,he={floor:e=>{let t=new Date(e);return t.setMinutes(0,0,0),t},step:e=>{e.setTime(e.getTime()+me)},label:(e,t,n)=>e.toLocaleString(n,{month:`short`,day:`numeric`,hour:`numeric`})},N={floor:M,step:e=>{e.setDate(e.getDate()+1)},label:(e,t,n)=>e.toLocaleDateString(n,{month:`short`,day:`numeric`})},ge={floor:M,step:e=>{e.setDate(e.getDate()+7)},label:(e,t,n,r)=>r(`timeline.scale.week`,{n:t+1})},P={floor:e=>{let t=M(e);return t.setDate(1),t},step:e=>{e.setMonth(e.getMonth()+1)},label:(e,t,n)=>e.toLocaleDateString(n,{month:`short`,year:`numeric`})},F={floor:e=>{let t=M(e);return t.setMonth(Math.floor(t.getMonth()/3)*3,1),t},step:e=>{e.setMonth(e.getMonth()+3)},label:(e,t,n,r)=>r(`timeline.scale.quarter`,{quarter:Math.floor(e.getMonth()/3)+1,year:e.getFullYear()})},I={floor:e=>{let t=M(e);return t.setMonth(0,1),t},step:e=>{e.setFullYear(e.getFullYear()+1)},label:e=>String(e.getFullYear())};function L(e){switch(e){case`hour`:return he;case`day`:return N;case`week`:return ge;case`quarter`:return F;case`year`:return I;default:return P}}function R(e){return typeof e==`string`?p(e):j(e)}function z(e,t,n,r,i,a){let o=j(t).getTime(),s=j(n).getTime();if(Number.isNaN(o)||Number.isNaN(s)||o>s)return;let c=a===void 0?s:Math.max(s,a),l=L(e),u=[],d=l.floor(new Date(o));for(;d.getTime()<=c;){let e=d.getTime(),t=l.label(new Date(e),u.length,r,i);l.step(d),u.push({start:e,end:d.getTime(),label:t})}return{start:u[0].start,end:u[u.length-1].end,units:u}}function B(e,t,n){let r=e.end-e.start;return{start:(t-e.start)/r*100,width:(n-t)/r*100}}function _e(e,t,n,r=`en`,i=de){let a=z(e,t,n,r,i);return a?a.units.map(e=>e.label):[]}function ve(){let e=b(new Date);return{minDate:e,maxDate:e}}function V(e){if(!Array.isArray(e))return{ok:!1,path:`items`,value:e};let t=[];for(let n=0;n<e.length;n++){let r=e[n];if(typeof r!=`object`||!r||Array.isArray(r))return{ok:!1,path:`items[${n}]`,value:r};let i=r.items;if(i&&!Array.isArray(i))return{ok:!1,path:`items[${n}].items`,value:i};t.push({authored:r,label:r.label,items:i||[]})}return{ok:!0,rows:t}}function ye(e){let t=e.flatMap(e=>e.items.flatMap(e=>[e.startDate,e.endDate]));if(t.length===0)return ve();let n=Math.min(...t.map(e=>j(e).getTime())),r=Math.max(...t.map(e=>j(e).getTime())),i=Math.max(...e.flatMap(e=>e.items.map(e=>{let t=j(e.startDate).getTime(),n=R(e.endDate).getTime();return n>t?n-1:t})));return{minDate:b(new Date(n)),maxDate:b(new Date(r)),through:i}}var H=e=>{try{return Date.prototype.getTime.call(e),!0}catch{return!1}};function U(e){return typeof e==`string`?JSON.stringify(e):e===void 0?`undefined`:e===null?`null`:typeof e==`symbol`?e.toString():typeof e==`bigint`?`${e}n`:typeof e==`number`||typeof e==`boolean`?String(e):H(e)?Date.prototype.toString.call(e):Array.isArray(e)?`an array`:typeof e==`function`?`a function`:`an object`}var be=e=>typeof e==`string`||typeof e==`number`&&Number.isFinite(e)||H(e);function xe(e,t,n){let r=e=>!be(e)||Number.isNaN(j(e).getTime());for(let t=0;t<e.length;t++){let n=e[t].items;for(let e=0;e<n.length;e++)for(let i of[`startDate`,`endDate`]){let a=n[e]?.[i];if(r(a))return{path:`items[${t}].items[${e}].${i}`,value:a}}}for(let[e,i]of[[`minDate`,t],[`maxDate`,n]])if(i&&r(i))return{path:e,value:i}}function Se(e,t,n){return B(n,j(e).getTime(),R(t).getTime())}function W(e,t,n){let r=h(e);return t===`short`?r.toLocaleDateString(n):t===`long`?r.toLocaleDateString(n,{year:`numeric`,month:`long`,day:`numeric`}):Number.isNaN(r.getTime())?String(e):_(e)?b(r):r.toISOString().split(`T`)[0]}function Ce({label:e,color:t}){let n=t?{backgroundColor:`${t}22`,color:t,borderColor:`${t}55`}:void 0;return(0,k.jsx)(`span`,{className:u(`inline-flex items-center rounded-full border px-2 py-0.5 text-xs font-medium`,!t&&`bg-muted text-muted-foreground border-transparent`),style:n,children:e})}function we(e){let t=[];for(let n of e){let e=n.group==null?``:String(n.group),r=t[t.length-1];r&&r.key===e?r.items.push(n):t.push({key:e,items:[n]})}return t}var Te=({schema:e,className:t,style:n,...r})=>{let{variant:i=`vertical`,items:a=[],dateFormat:o=`short`,onItemClick:s}=e,c=T(),{t:d}=fe();if(i===`vertical`){let e=we(a),i=e.some(e=>e.key!==``),d=(e,t)=>{let n=e.color?{backgroundColor:`${e.color}33`,borderColor:e.color}:void 0,r=e.time?W(e.time,o,c):e.startDate?W(e.startDate,o,c):``,i=e.endDate&&e.endDate!==e.startDate?W(e.endDate,o,c):``,a=Array.isArray(e.meta)?e.meta:[];return(0,k.jsxs)(Ie,{density:`compact`,className:u(e.className,s&&`cursor-pointer`),onClick:()=>s?.(e),children:[(0,k.jsx)(K,{variant:e.color?`default`:e.variant||`default`,style:n,children:e.icon&&(0,k.jsx)(`span`,{className:`text-xs`,children:e.icon})}),(0,k.jsxs)(Re,{children:[(r||i)&&(0,k.jsxs)(J,{dateTime:e.time||e.startDate,className:`!mb-1 text-xs`,children:[r,i&&(0,k.jsxs)(`span`,{className:`text-muted-foreground/70`,children:[` → `,i]})]}),e.title&&(0,k.jsx)(q,{className:`text-sm sm:text-base mb-1`,children:e.title}),a.length>0&&(0,k.jsx)(`div`,{className:`flex flex-wrap gap-1.5 mt-1 mb-1`,children:a.map(e=>(0,k.jsx)(Ce,{label:e.label,color:e.color},e.key))}),e.description&&(0,k.jsx)(Y,{className:`text-sm text-muted-foreground line-clamp-2 sm:line-clamp-none`,children:e.description}),l(e.content)]})]},t)};return i?(0,k.jsx)(`div`,{...C(r),className:u(`px-4 sm:px-6 py-2`,t),style:n,children:e.map((e,t)=>(0,k.jsxs)(`section`,{className:`mb-4`,children:[(0,k.jsxs)(`header`,{className:`sticky top-0 z-10 -mx-4 sm:-mx-6 px-4 sm:px-6 py-1.5 backdrop-blur bg-background/90 text-xs font-semibold uppercase tracking-wide text-muted-foreground border-b`,children:[(0,k.jsx)(`span`,{children:e.key}),(0,k.jsx)(`span`,{className:`ml-2 text-muted-foreground/60 font-normal normal-case`,children:e.items.length})]}),(0,k.jsx)(G,{className:`mt-3`,children:e.items.map((e,n)=>d(e,`${t}-${n}`))})]},`${e.key}-${t}`))}):(0,k.jsx)(G,{...C(r),className:t,style:n,children:a.map((e,t)=>d(e,t))})}if(i===`horizontal`)return(0,k.jsx)(ze,{...C(r),className:u(`overflow-x-auto [-webkit-overflow-scrolling:touch]`,t),style:n,children:a.map((e,t)=>(0,k.jsxs)(Be,{className:u(e.className,s&&`cursor-pointer`),onClick:()=>s?.(e),children:[(0,k.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,k.jsx)(K,{variant:e.variant||`default`,children:e.icon&&(0,k.jsx)(`span`,{className:`text-xs`,children:e.icon})}),(0,k.jsxs)(`div`,{className:`mt-4 text-center`,children:[e.time&&(0,k.jsx)(J,{dateTime:e.time,children:W(e.time,o,c)}),e.title&&(0,k.jsx)(q,{children:e.title}),e.description&&(0,k.jsx)(Y,{className:`text-center line-clamp-2 sm:line-clamp-none`,children:e.description}),l(e.content)]})]}),t<a.length-1&&(0,k.jsx)(`div`,{className:`absolute left-full w-16 border-t-2 border-gray-200 top-3`})]},t))});if(i===`gantt`){let i=V(a);if(!i.ok)return(0,k.jsx)(`div`,{className:`p-4 text-destructive`,"data-testid":`timeline-unusable-date-range`,role:`alert`,children:d(`timeline.gantt.unusableRange.malformedRow`,{path:i.path,value:U(i.value)})});let l=i.rows,f=xe(l,e.minDate,e.maxDate);if(f)return(0,k.jsx)(`div`,{className:`p-4 text-destructive`,"data-testid":`timeline-unusable-date-range`,role:`alert`,children:d(`timeline.gantt.unusableRange.malformedDate`,{path:f.path,value:U(f.value)})});let p=ye(l),m=e.minDate||p.minDate,h=e.maxDate||p.maxDate,g=z(pe(e),m,h,c,d,e.maxDate?void 0:p.through);return g?(0,k.jsxs)(Ve,{...C(r),className:u(`overflow-x-auto [-webkit-overflow-scrolling:touch]`,t),style:n,children:[(0,k.jsxs)(He,{children:[(0,k.jsx)(X,{className:`flex items-center px-2 sm:px-4 py-2 sm:py-3`,children:(0,k.jsx)(`span`,{className:`font-semibold text-xs sm:text-sm`,children:e.rowLabel||d(`timeline.gantt.rowLabel`)})}),(0,k.jsx)(Z,{children:(0,k.jsx)(`div`,{className:`flex h-full`,children:g.units.map((e,t)=>(0,k.jsx)(`div`,{className:`shrink-0 min-w-0 overflow-hidden px-1 sm:px-2 py-2 sm:py-3 border-r text-xs font-medium text-center`,style:{width:`${B(g,e.start,e.end).width}%`},children:e.label},t))})})]}),(0,k.jsx)(`div`,{children:(0,k.jsxs)(`div`,{className:`flex`,children:[(0,k.jsx)(X,{children:l.map((e,t)=>(0,k.jsx)(Q,{children:(0,k.jsx)(Ue,{title:e.label,className:`truncate`,children:e.label})},t))}),(0,k.jsx)(Z,{className:`relative`,children:l.map((e,t)=>(0,k.jsx)(Q,{className:`relative`,children:e.items.map((n,r)=>{let i=Se(n.startDate,n.endDate,g);return(0,k.jsx)(We,{start:i.start,width:i.width,variant:n.variant||`default`,onClick:()=>s?.(n,e.authored,t,r),title:`${n.title||``}\n${W(n.startDate,o,c)} - ${W(n.endDate,o,c)}`,children:(0,k.jsx)($,{children:n.title})},r)})},t))})]})})]}):(0,k.jsx)(`div`,{className:`p-4 text-destructive`,"data-testid":`timeline-unusable-date-range`,role:`alert`,children:d(`timeline.gantt.unusableRange.inverted`,{minDate:U(m),maxDate:U(h)})})}return null};y.register(`timeline`,Te,{namespace:`plugin-timeline`,skipFallback:!0,label:`Timeline`,category:`data-display`,inputs:[{name:`variant`,type:`enum`,enum:[`vertical`,`horizontal`,`gantt`]},{name:`items`,type:`array`,description:`For vertical/horizontal: Array of { time, title, description, variant, icon, content }. For gantt: Array of { label, items: [{ title, startDate, endDate, variant }] }`},{name:`dateFormat`,type:`enum`,enum:[`short`,`long`,`iso`]},{name:`scale`,type:`enum`,enum:[...A]},{name:`rowLabel`,type:`string`},{name:`minDate`,type:`string`,description:`Override auto-calculated min date (YYYY-MM-DD)`},{name:`maxDate`,type:`string`,description:`Override auto-calculated max date (YYYY-MM-DD)`},{name:`className`,type:`string`}],defaultProps:{variant:`vertical`,dateFormat:`short`,items:[{time:`2024-01-15`,title:`Project Started`,description:`Kickoff meeting and initial planning`,variant:`success`,icon:`🚀`},{time:`2024-02-01`,title:`First Milestone`,description:`Completed initial design phase`,variant:`info`,icon:`🎨`},{time:`2024-03-15`,title:`Beta Release`,description:`Released beta version to testers`,variant:`warning`,icon:`⚡`},{time:`2024-04-01`,title:`Launch`,description:`Official product launch`,variant:`success`,icon:`🎉`}]},examples:{vertical:{variant:`vertical`,dateFormat:`long`,items:[{time:`2024-01-15`,title:`Project Started`,description:`Kickoff meeting and initial planning`,variant:`success`},{time:`2024-02-01`,title:`First Milestone`,description:`Completed initial design phase`,variant:`info`}]},horizontal:{variant:`horizontal`,dateFormat:`short`,items:[{time:`2024-01-01`,title:`Q1`,description:`First quarter`,variant:`default`},{time:`2024-04-01`,title:`Q2`,description:`Second quarter`,variant:`info`},{time:`2024-07-01`,title:`Q3`,description:`Third quarter`,variant:`warning`},{time:`2024-10-01`,title:`Q4`,description:`Fourth quarter`,variant:`success`}]},gantt:{variant:`gantt`,dateFormat:`short`,scale:`month`,rowLabel:`Projects`,items:[{label:`Backend Development`,items:[{title:`API Design`,startDate:`2024-01-01`,endDate:`2024-01-31`,variant:`success`},{title:`Implementation`,startDate:`2024-02-01`,endDate:`2024-03-31`,variant:`info`}]},{label:`Frontend Development`,items:[{title:`UI Design`,startDate:`2024-01-15`,endDate:`2024-02-15`,variant:`warning`},{title:`Component Dev`,startDate:`2024-02-15`,endDate:`2024-04-15`,variant:`default`}]},{label:`Testing`,items:[{title:`QA Phase`,startDate:`2024-03-01`,endDate:`2024-04-30`,variant:`danger`}]}]}}}),a();function Ee(e){return typeof e==`number`&&Number.isInteger(e)&&e>0}function De(e,t){return Ee(e)?e:t}function Oe(e,t){return e==null||Ee(e)?null:`[ObjectUI] ObjectTimeline row cap: ${typeof t==`string`&&t?`object-timeline on ${t}`:`object-timeline`} declared limit: ${String(e)}, which is not a positive integer. A row cap must be a positive integer (the spec refuses zero and negative values), so it was ignored and this timeline fell back to its default row cap (100).`}var ke=[`vertical`,`horizontal`],Ae=[`timeline.startDateField`,`timeline.dateField`,`mapping.date`,`startDateField`,`dateField`],je=s({title:o().optional(),date:o().optional(),description:o().optional(),variant:o().optional()}),Me=s({mapping:je.optional(),objectName:o().optional(),titleField:o().optional(),dateField:o().optional(),startDateField:o().optional(),endDateField:o().optional(),descriptionField:o().optional(),groupByField:o().optional(),colorField:o().optional(),scale:i([`hour`,`day`,`week`,`month`,`quarter`,`year`]).optional()}),Ne=({schema:e,dataSource:t,className:n,onRowClick:r,onItemClick:i,...a})=>{let[o,s]=(0,O.useState)([]),[l,u]=(0,O.useState)(()=>{let t=Array.isArray(e.items)&&e.items.length>0,n=Array.isArray(a.data)&&a.data.length>0;return!t&&!n&&!!e.objectName}),[p,_]=(0,O.useState)(null),v=(0,O.useRef)(0),[y,b]=(0,O.useState)(0),x=e.timeline;(0,O.useEffect)(()=>{let t=Me.safeParse(e);t.success||console.warn(`[ObjectTimeline] Invalid timeline configuration:`,t.error.format())},[e]),(0,O.useEffect)(()=>{let t=Oe(e.limit,e.objectName);t&&console.warn(t)},[e.limit,e.objectName]);let S=f(e.bind),{ready:C,def:w}=se(e.objectName??``,t),T=c(),E=oe(),D=ne(e.filter,E),ue=JSON.stringify(D??null),de=JSON.stringify(e.sort??null),A=!!e.objectName&&!S&&!e.items&&!a.data,pe=te(A?e.objectName:void 0);(0,O.useEffect)(()=>{let n=++v.current,r=()=>v.current===n,i=async()=>{if(!t||typeof t.find!=`function`||!e.objectName){u(!1);return}u(!0);try{let n=m(w?.fields),i=T?.isLoaded?n.filter(t=>T.checkField(e.objectName,t,`read`)):n,a=await t.find(e.objectName,{$filter:D,$orderby:ie(e.sort),$top:De(e.limit,100),...i.length>0?{$expand:i}:{}}),o=g(a);r()&&(s(o),_(null))}catch(e){console.error(e),r()&&_(e)}finally{r()&&u(!1)}};if(A){if(!C)return;i()}else u(!1)},[e.objectName,t,S,e.items,a.data,y,C,w,ue,de,e.limit,T,pe]);let j=a.data||S||o,{t:M}=fe(),{fieldOptionLabel:me}=ce(),he=x?.titleField??e.mapping?.title??e.titleField??`name`,N=x?.startDateField??x?.dateField??e.mapping?.date??e.startDateField??e.dateField,ge=x?.endDateField??e.endDateField??N,P=e.mapping?.description??e.descriptionField??`description`,F=e.mapping?.variant??`variant`,I=x?.groupByField??e.groupByField,L=x?.colorField??e.colorField,R=(0,O.useMemo)(()=>{if(e.items)return e.items;if(!j||!Array.isArray(j)||!N)return[];let t=N,n=ge??N,r=w?.fields??{},i=e.objectName||``,a=e=>{if(!e||!r[e]?.options)return{};let t={};for(let n of r[e].options)n&&n.value!=null&&(t[String(n.value)]=n);return t},o=[`status`,`priority`].filter(e=>r[e]),s={};for(let e of o)s[e]=a(e);let c=re(r[L??``]),l=(e,t,n)=>{if(t==null||t===``)return null;let r=n[String(t)];return{label:r?.label?me(i,e,String(t),r.label):String(t),color:r?.color}},u=j.map(e=>{let r=e[t],a=e[n],u=L?e[L]:void 0,d=I?e[I]:void 0,f=[];if(i)for(let t of o){let n=l(t,e[t],s[t]||{});n&&f.push({key:t,label:n.label,color:n.color})}return{title:ee(e,he),time:r,startDate:r,endDate:a,description:ee(e,P),variant:e[F]||`default`,color:c(u),group:d,meta:f,_data:e}}),d=e=>{if(!e)return 1/0;let t=h(e).getTime();return Number.isNaN(t)?1/0:t};u.sort((e,t)=>d(e.startDate)-d(t.startDate));let f=new Date,p=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime(),m=p(f),g=864e5,_=m-(f.getDay()+6)%7*g+7*g,v=_+7*g,y=e=>{if(!e)return M(`timeline.bucket.noDate`);let t=p(h(e));return Number.isNaN(t)?M(`timeline.bucket.noDate`):t<m?M(`timeline.bucket.overdue`):t===m?M(`timeline.bucket.today`):t===m+g?M(`timeline.bucket.tomorrow`):M(t<_?`timeline.bucket.thisWeek`:t<v?`timeline.bucket.nextWeek`:`timeline.bucket.later`)};if(I&&!u.every(e=>e.group==null||e.group===``)){let e=a(I);return u.map(t=>{let n=l(I,t.group,e);return{...t,group:n?n.label:t.group!=null&&t.group!==``?String(t.group):M(`timeline.bucket.unassigned`)}})}return u.map(e=>({...e,group:y(e.startDate)}))},[e.items,j,w,e.objectName,he,N,ge,P,F,L,I,M,me]),z=(0,O.useCallback)(async()=>{b(e=>e+1)},[]),{ref:B,isRefreshing:_e,pullDistance:ve}=le({onRefresh:z,enabled:!!e.objectName&&!!t}),V=ae({navigation:e.navigation,objectName:e.objectName,onRowClick:r??i}),ye=x?.scale??e.scale,H=!!e.items;if(!H&&e.variant===`gantt`)return(0,k.jsx)(`div`,{className:`p-4 text-destructive`,"data-testid":`timeline-unsupported-variant`,role:`alert`,children:M(`timeline.unsupported.objectBoundGantt`,{variants:ke.join(`, `)})});if(!H&&!N)return(0,k.jsx)(`div`,{className:`p-4 text-destructive`,"data-testid":`timeline-missing-date-axis`,role:`alert`,children:M(`timeline.unconfigured.noDateAxis`,{fields:Ae.join(`, `)})});let U={...e,items:R||[],className:n||e.className,...ye?{scale:ye}:{},onItemClick:e=>{let t=e._data||e;V.handleClick(t),i?.(t)}};return p?(0,k.jsxs)(`div`,{className:`p-4 text-destructive`,"data-testid":`timeline-error`,role:`alert`,children:[`Error loading timeline: `,p.message]}):l&&(!R||R.length===0)?(0,k.jsxs)(`div`,{className:`flex flex-col h-full min-h-[200px] p-4 gap-3`,"data-testid":`timeline-loading`,role:`status`,"aria-live":`polite`,"aria-busy":`true`,children:[(0,k.jsx)(`span`,{className:`sr-only`,children:`Loading timeline…`}),[0,1,2,3].map(e=>(0,k.jsxs)(`div`,{className:`flex items-start gap-3`,style:{opacity:Math.max(.3,1-e*.18)},children:[(0,k.jsx)(`div`,{className:`h-3 w-3 rounded-full bg-muted/70 animate-pulse mt-1.5 shrink-0`}),(0,k.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,k.jsx)(`div`,{className:`h-4 w-1/3 rounded bg-muted/70 animate-pulse`}),(0,k.jsx)(`div`,{className:`h-3 w-2/3 rounded bg-muted/50 animate-pulse`})]})]},e))]}):(0,k.jsxs)(`div`,{ref:B,className:`relative overflow-auto h-full min-w-0`,"data-testid":`timeline-canvas`,children:[ve>0&&(0,k.jsx)(`div`,{className:`flex items-center justify-center text-xs text-muted-foreground`,style:{height:ve},children:_e?`Refreshing…`:`Pull to refresh`}),(0,k.jsx)(Te,{schema:U}),V.isOverlay&&(0,k.jsx)(d,{...V,title:`Timeline Item`,children:e=>(0,k.jsx)(`div`,{className:`space-y-3`,children:Object.entries(e).map(([e,t])=>(0,k.jsxs)(`div`,{className:`flex flex-col`,children:[(0,k.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:e.replace(/_/g,` `)}),(0,k.jsx)(`span`,{className:`text-sm`,children:String(t??`—`)})]},e))})})]})},Pe=t({ObjectTimeline:()=>Ne,ObjectTimelineRenderer:()=>Ke,TIMELINE_SCALES:()=>A,Timeline:()=>G,TimelineContent:()=>Re,TimelineDescription:()=>Y,TimelineGantt:()=>Ve,TimelineGanttBar:()=>We,TimelineGanttBarContent:()=>$,TimelineGanttGrid:()=>Z,TimelineGanttHeader:()=>He,TimelineGanttLabel:()=>Ue,TimelineGanttRow:()=>Q,TimelineGanttRowLabels:()=>X,TimelineHorizontal:()=>ze,TimelineHorizontalItem:()=>Be,TimelineItem:()=>Ie,TimelineMarker:()=>K,TimelineRenderer:()=>Te,TimelineTime:()=>J,TimelineTitle:()=>q,generateTimeScaleHeaders:()=>_e,resolveTimelineScale:()=>pe,timelineItemVariants:()=>Fe,timelineMarkerVariants:()=>Le}),G=O.forwardRef(({className:e,...t},n)=>(0,k.jsx)(`ol`,{ref:n,className:u(`relative ml-3 border-l border-gray-200`,e),...t}));G.displayName=`Timeline`;var Fe=E(`ml-6`,{variants:{density:{default:`mb-10`,compact:`mb-3`,comfortable:`mb-6`}},defaultVariants:{density:`default`}}),Ie=O.forwardRef(({className:e,density:t,...n},r)=>(0,k.jsx)(`li`,{ref:r,className:u(Fe({density:t}),e),...n}));Ie.displayName=`TimelineItem`;var Le=E(`absolute -left-3 w-6 h-6 rounded-full border-2 flex items-center justify-center`,{variants:{variant:{default:`bg-blue-200 border-blue-400`,success:`bg-emerald-200 border-emerald-500`,warning:`bg-amber-200 border-amber-500`,danger:`bg-red-200 border-red-500`,info:`bg-purple-200 border-purple-500`,todo:`bg-slate-200 border-slate-400`,"in-progress":`bg-blue-200 border-blue-500`,done:`bg-emerald-200 border-emerald-500`}},defaultVariants:{variant:`default`}}),K=O.forwardRef(({className:e,variant:t=`default`,...n},r)=>(0,k.jsx)(`div`,{ref:r,className:u(Le({variant:t}),e),...n}));K.displayName=`TimelineMarker`;var Re=O.forwardRef(({className:e,...t},n)=>(0,k.jsx)(`div`,{ref:n,className:e,...t}));Re.displayName=`TimelineContent`;var q=O.forwardRef(({className:e,...t},n)=>(0,k.jsx)(`h3`,{ref:n,className:u(`font-semibold text-lg mb-1`,e),...t}));q.displayName=`TimelineTitle`;var J=O.forwardRef(({className:e,...t},n)=>(0,k.jsx)(`time`,{ref:n,className:u(`text-sm font-normal text-gray-500 mb-2 block`,e),...t}));J.displayName=`TimelineTime`;var Y=O.forwardRef(({className:e,...t},n)=>(0,k.jsx)(`p`,{ref:n,className:u(`text-base text-gray-700`,e),...t}));Y.displayName=`TimelineDescription`;var ze=O.forwardRef(({className:e,...t},n)=>(0,k.jsx)(`div`,{ref:n,className:u(`relative flex overflow-x-auto py-8`,e),...t}));ze.displayName=`TimelineHorizontal`;var Be=O.forwardRef(({className:e,...t},n)=>(0,k.jsx)(`div`,{ref:n,className:u(`shrink-0 w-64 relative`,e),...t}));Be.displayName=`TimelineHorizontalItem`;var Ve=O.forwardRef(({className:e,...t},n)=>(0,k.jsx)(`div`,{ref:n,className:u(`relative w-full border rounded-lg overflow-hidden`,e),...t}));Ve.displayName=`TimelineGantt`;var He=O.forwardRef(({className:e,...t},n)=>(0,k.jsx)(`div`,{ref:n,className:u(`flex border-b bg-gray-50`,e),...t}));He.displayName=`TimelineGanttHeader`;var X=O.forwardRef(({className:e,...t},n)=>(0,k.jsx)(`div`,{ref:n,className:u(`w-48 border-r bg-white`,e),...t}));X.displayName=`TimelineGanttRowLabels`;var Z=O.forwardRef(({className:e,...t},n)=>(0,k.jsx)(`div`,{ref:n,className:u(`flex-1 overflow-x-auto`,e),...t}));Z.displayName=`TimelineGanttGrid`;var Q=O.forwardRef(({className:e,...t},n)=>(0,k.jsx)(`div`,{ref:n,className:u(`flex items-center border-b min-h-12`,e),...t}));Q.displayName=`TimelineGanttRow`;var Ue=O.forwardRef(({className:e,...t},n)=>(0,k.jsx)(`div`,{ref:n,className:u(`px-4 py-2 font-medium text-sm truncate`,e),...t}));Ue.displayName=`TimelineGanttLabel`;var We=O.forwardRef(({className:e,start:t=0,width:n=100,variant:r=`default`,...i},a)=>(0,k.jsx)(`div`,{ref:a,className:u(`absolute h-8 rounded-md transition-colors cursor-pointer`,{default:`bg-blue-500 hover:bg-blue-600`,success:`bg-green-500 hover:bg-green-600`,warning:`bg-yellow-500 hover:bg-yellow-600`,danger:`bg-red-500 hover:bg-red-600`,info:`bg-purple-500 hover:bg-purple-600`}[r],e),style:{left:`${t}%`,width:`${n}%`},...i}));We.displayName=`TimelineGanttBar`;var $=O.forwardRef(({className:e,...t},n)=>(0,k.jsx)(`div`,{ref:n,className:u(`px-2 py-1 text-white text-xs font-medium truncate`,e),...t}));$.displayName=`TimelineGanttBarContent`;var Ge={filter:!0,sort:!0,limit:`limit`},Ke=v(({schema:e,...t})=>{let{dataSource:n}=x()||{};return(0,k.jsx)(S,{schema:e,mapping:Ge,dataSource:n,testId:`object-timeline`,errorTitle:`This timeline’s data source could not be resolved`,children:e=>(0,k.jsx)(Ne,{schema:e,dataSource:n,...t})})}),qe="Base query filter in the rule-array form `[{ field, operator, value }, ...]`, narrowing the records the timeline fetches. Context tokens such as `{current_user_id}` are resolved first, then the filter is lowered to `$filter` on the query. Authored `items` or `data` suppress that query, so the key then narrows nothing. The MongoDB-style record form is not this key’s shape.",Je="Entry order in `[{ field, order }]` form, ordering the records the timeline fetches. Lowered to `$orderby` on the same query.",Ye="What an entry click opens — the `{ mode, size, openNewTab, preventNavigation }` block a list view declares. Write it with `mode`: with the key ABSENT, or with a block that omits `mode` (it takes the spec’s `page` default), a click opens nothing on a timeline no parent view navigates for. `drawer`, `modal` and `popover` open the entry’s record in that overlay; `new_window` opens the record page in a new tab; `page`, `none` and `split` open nothing here, because the timeline hands the split shell no main panel. `openNewTab: true` opens the record page in a new tab and outranks the mode, `preventNavigation: true` opens nothing, and `size` sets the overlay width. A click handler from a parent view outranks the whole key.";y.register(`object-timeline`,Ke,{namespace:`plugin-timeline`,label:`Object Timeline`,category:`view`,inputs:[{name:`objectName`,type:`string`,required:!0},{name:`variant`,type:`enum`,enum:[`vertical`,`horizontal`,`gantt`]},{name:`filter`,type:`array`,description:qe},{name:`sort`,type:`array`,description:Je},{name:`navigation`,type:`object`,description:Ye}]}),y.register(`timeline`,Ke,{namespace:`view`,label:`Timeline View`,category:`view`,inputs:[{name:`objectName`,type:`string`,required:!0},{name:`variant`,type:`enum`,enum:[`vertical`,`horizontal`,`gantt`]},{name:`filter`,type:`array`,description:qe},{name:`sort`,type:`array`,description:Je},{name:`navigation`,type:`object`,description:Ye}]});export{Pe as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e,r as t}from"./rolldown-runtime-C0FnF6B9.js";import{t as n,v as r}from"./vendor-react-BggL7APJ.js";import{$ as i,St as a,bt as o,mt as ee,xi as s,xt as te,yt as ne}from"./ui-components-D6cEVg0T.js";import{$n as c,Bt as l,Di as u,Ei as re,Ir as d,Mi as f,Rt as p,Yi as m,_ as h,dt as g,ji as _,jt as v,ki as y,lt as ie,n as ae,pt as oe,y as b,zt as se}from"./framework-DFR4HNtj.js";import{h as x,p as ce}from"./i18n-runtime-97_bDVjP.js";import{t as le}from"./vendor-icon-chevron-down-BEf_jTEE.js";import{t as S}from"./vendor-icon-chevron-right-DbnKwHYQ.js";import{c as ue}from"./plugin-grid-D2rmQEW_.js";var C=e(r(),1),w=n(),de=x({"detail.recordDetail":`Record Detail`,"grid.refreshing":`Refreshing…`},`detail.recordDetail`),T=[];function E(e){return y(e)||(e&&typeof e==`object`?e.key:void 0)||void 0}function fe(e){let t=e.tree||{},n=Array.isArray(e.fields)?e.fields:Array.isArray(t.fields)?t.fields:[];return{parentField:E(e.parentField??t.parentField),labelField:E(e.labelField??t.labelField)??`name`,fields:n.map(E).filter(e=>!!e),defaultExpandedDepth:e.defaultExpandedDepth??t.defaultExpandedDepth}}function D(e,t){let n=e?.fields;if(!n||typeof n!=`object`)return;let r;for(let[e,i]of Object.entries(n)){let n=i?.reference;if(i?.type===`tree`&&(n===void 0||t&&n===t))return e;!r&&(i?.type===`lookup`||i?.type===`master_detail`)&&n&&t&&n===t&&(r=e)}return r}function O(e){let t=e?.id??e?._id;return t==null?void 0:String(t)}function k(e,t){if(!t)return;let n=e?.[t];if(n!=null){if(typeof n==`object`){let e=n.id??n._id;return e==null?void 0:String(e)}return String(n)}}function pe(e,t){let n=new Map,r=[];for(let t of e){let e=O(t);e!=null&&(n.set(e,{id:e,record:t,depth:0,children:[]}),r.push(e))}let i=[];for(let e of r){let r=n.get(e),a=k(r.record,t),o=a==null?void 0:n.get(a);o&&o!==r?o.children.push(r):i.push(r)}let a=(e,t)=>{for(let n of e)n.depth=t,a(n.children,t+1)};return a(i,0),i}function me(e,t){let n=[],r=e=>{for(let i of e)n.push(i),i.children.length>0&&t.has(i.id)&&r(i.children)};return r(e),n}function A(e,t){let n=new Set,r=e=>{for(let i of e)i.children.length!==0&&(t==null||i.depth<t)&&(n.add(i.id),r(i.children))};return r(e),n}function he(e,t,n){let r=A(e,t);if(n.size===0)return r;let i=e=>{for(let t of e){let e=n.get(t.id);e===!0?r.add(t.id):e===!1&&r.delete(t.id),i(t.children)}};return i(e),r}function j(e,t){if(e==null)return``;let n=Array.isArray(t?.fieldDef?.options)?t.fieldDef.options:null;if(n&&n.length>0){let r=t.objectName?t.translateOptions(t.objectName,t.fieldName,n):n,i=e=>{let t=r.find(t=>t?.value===e);if(t)return String(t.label??e);let n=String(e).toLowerCase(),i=r.find(e=>String(e?.value).toLowerCase()===n);return i?String(i.label??e):p(String(e))};return Array.isArray(e)?e.filter(e=>e!=null).map(i).join(`, `):i(e)}return typeof e==`object`&&u(t?.fieldDef)?d(void 0,e):String(typeof e==`object`?e.name??e.label??e.id??e._id??``:e)}var M=({schema:e,dataSource:t,className:n,onRowClick:r,...u})=>{let[d,p]=(0,C.useState)(null),[m,v]=(0,C.useState)(null),[y,x]=(0,C.useState)(!0),[E,O]=(0,C.useState)(null),k=(0,C.useMemo)(()=>se(e,`view-data`),[e]),A=l(e,k)??``,{ready:M,def:N}=b(A,t),P=k?.provider,F=k?.provider===`object`?k.object:void 0,I=k?.provider===`value`?k.items:void 0,L=i(),ge=oe(),R=g(e.filter,ge),z=h(t?F:void 0);(0,C.useEffect)(()=>{let e=!1;return(async()=>{try{if(x(!0),O(null),P===`object`&&t&&typeof t.find==`function`){if(!M)return;let n=re(N?.fields),r=L?.isLoaded?n.filter(e=>L.checkField(F,e,`read`)):n,i=await t.find(F,{$filter:R,...f(),...r.length>0?{$expand:r}:{}}),a=_(i);e||(p({provider:P,object:F,rows:a.rows}),v(a),x(!1));return}let n=u.data;if(Array.isArray(n)){e||(p({provider:P,object:F,rows:n}),v(null),x(!1));return}if(P===`value`){let t=await new c({items:I??[]}).find(``,{$filter:R,...f()}),n=_(t);e||(p({provider:P,object:F,rows:n.rows}),v(n),x(!1));return}e||(p({provider:P,object:F,rows:[]}),x(!1))}catch(t){e||(O(t),x(!1))}})(),()=>{e=!0}},[P,F,I,t,R,N,M,u.data,L,z]);let B=(0,C.useMemo)(()=>fe(e),[e]),V=(0,C.useMemo)(()=>B.parentField??D(N,e.objectName),[B.parentField,N,e.objectName]),H=d&&d.provider===P&&d.object===F?d.rows:null,U=(0,C.useMemo)(()=>pe(H??T,V),[H,V]),[W,_e]=(0,C.useState)(()=>new Map),G=(0,C.useMemo)(()=>he(U,B.defaultExpandedDepth,W),[U,B.defaultExpandedDepth,W]),ve=(e,t)=>_e(n=>{let r=new Map(n);return r.set(e,!t),r}),ye=(0,C.useMemo)(()=>me(U,G),[U,G]),K=ce(),q=l(e,k)??e.objectName,J=e=>{let t=N?.fields?.[e]?.label||e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase());return q?K.fieldLabel(q,e,t):t},Y=e=>({fieldDef:N?.fields?.[e],fieldName:e,objectName:q,translateOptions:K.translateOptions}),X=ie({navigation:e.navigation,objectName:l(e,k)??e.objectName,onRowClick:r}),{anchorRef:be,captureAnchor:xe}=a(),{t:Z}=de();if(E)return(0,w.jsx)(`div`,{className:s(`flex items-center justify-center h-40 text-destructive`,n),children:(0,w.jsxs)(`p`,{children:[`Failed to load tree: `,E.message]})});if(H===null||y&&H.length===0)return(0,w.jsx)(`div`,{className:s(`flex items-center justify-center h-40 text-muted-foreground`,n),children:(0,w.jsx)(`p`,{children:`Loading…`})});if(H.length===0)return(0,w.jsx)(`div`,{className:s(`flex items-center justify-center h-40 text-muted-foreground`,n),children:(0,w.jsx)(`p`,{children:`No records`})});let Q=n=>{if(!X.isOverlay)return null;let r=l(e,k)??e.objectName;return(0,w.jsx)(ne,{...X,title:Z(`detail.recordDetail`),mainContent:n,popoverAnchorRef:be,storageKey:r?te(r):void 0,legacyStorageKey:r?o(r):void 0,width:X.width??`min(960px, 60vw)`,children:e=>{let n=e,i=n.id??n._id,a=!!N?.fields&&Object.keys(N.fields).length>0;return!r||i==null||!a?(0,w.jsx)(`div`,{className:`space-y-3 p-4`,children:Object.entries(n).map(([e,t])=>(0,w.jsxs)(`div`,{className:`flex flex-col`,children:[(0,w.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:e.replace(/_/g,` `)}),(0,w.jsx)(`span`,{className:`text-sm`,children:j(t,Y(e))||`—`})]},e))}):(0,w.jsx)(`div`,{className:`px-6 pt-6 pb-6`,children:(0,w.jsx)(ue,{record:n,objectName:r,recordId:i,dataSource:t,objectSchema:N,onClose:X.close})})}})},$=(0,w.jsxs)(`div`,{className:s(`w-full overflow-auto`,n),"data-testid":`object-tree`,children:[(0,w.jsx)(ee,{active:y&&H.length>0,ariaLabel:Z(`grid.refreshing`),className:`sticky -mb-0.5`}),(0,w.jsxs)(`table`,{className:`w-full border-collapse text-sm`,children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{className:`border-b text-left text-muted-foreground`,children:[(0,w.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:J(B.labelField)}),B.fields.filter(e=>e!==B.labelField).map(e=>(0,w.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:J(e)},e))]})}),(0,w.jsx)(`tbody`,{children:ye.map(e=>{let t=e.children.length>0,n=G.has(e.id);return(0,w.jsxs)(`tr`,{className:`border-b hover:bg-accent/50 cursor-pointer`,"data-testid":`object-tree-row`,"data-depth":e.depth,onClick:t=>{xe(t),X.handleClick(e.record,t)},children:[(0,w.jsx)(`td`,{className:`px-3 py-2`,children:(0,w.jsxs)(`div`,{className:`flex items-center gap-1`,style:{paddingLeft:`${e.depth*20}px`},children:[t?(0,w.jsx)(`button`,{type:`button`,"aria-label":n?`Collapse`:`Expand`,className:`flex h-5 w-5 items-center justify-center rounded-sm text-muted-foreground hover:bg-muted`,onClick:t=>{t.stopPropagation(),ve(e.id,n)},children:n?(0,w.jsx)(le,{className:`h-4 w-4`}):(0,w.jsx)(S,{className:`h-4 w-4`})}):(0,w.jsx)(`span`,{className:`inline-block h-5 w-5`}),(0,w.jsx)(`span`,{className:`truncate`,children:j(e.record[B.labelField],Y(B.labelField))||`—`})]})}),B.fields.filter(e=>e!==B.labelField).map(t=>(0,w.jsx)(`td`,{className:`px-3 py-2 text-muted-foreground`,children:j(e.record[t],Y(t))},t))]},e.id)})})]}),m&&(0,w.jsx)(ae,{result:m})]});if(X.isOverlay&&X.mode===`split`&&X.isOpen&&X.selectedRecord){let e=Q($);if(e)return(0,w.jsx)(w.Fragment,{children:e})}return(0,w.jsxs)(w.Fragment,{children:[$,Q()]})},N=t({ObjectTree:()=>M,ObjectTreeRenderer:()=>P}),P=({schema:e,...t})=>{let{dataSource:n}=v()||{};return(0,w.jsx)(M,{schema:e,dataSource:n,...t})},F=[{name:`objectName`,type:`string`,required:!0},{name:`tree`,type:`object`,description:`parentField, labelField, fields, defaultExpandedDepth`}];m.register(`object-tree`,P,{namespace:`plugin-tree`,label:`Object Tree`,category:`view`,inputs:F}),m.register(`tree`,P,{namespace:`view`,label:`Tree View`,category:`view`,inputs:F});export{N as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{t,v as n}from"./vendor-react-BggL7APJ.js";import{Vi as r,_i as i,hn as a,un as o,vi as s,vn as c}from"./vendor-objectstack-DFqu45yM.js";import{$ as l,$n as u,$t as d,Ar as f,Bn as p,Dn as m,En as h,Fr as g,Gn as _,In as v,Jn as y,Kn as b,Ln as x,Mr as ee,Mt as S,Nr as C,Pr as w,Qn as T,Rn as E,Tn as D,Zt as O,_i as k,_r as A,ar as te,br as j,cr as M,di as ne,dr as N,en as re,er as P,fi as ie,fr as F,gi as ae,gr as I,hi as oe,hr as se,ir as ce,jr as le,kn as ue,lr as de,mi as fe,mr as pe,nr as L,or as me,pi as he,pr as ge,qn as _e,qt as R,ri as z,sr as ve,ui as B,ur as ye,vr as be,wn as V,xi as H,xr as U,yi as W,yr as xe,yt as Se,zn as Ce,zr as G}from"./ui-components-D6cEVg0T.js";import{Ci as we,Ei as Te,Ot as Ee,Wn as K,Wt as De,Yi as q,_ as Oe,gt as J,h as ke,ki as Ae,kr as je,mt as Me,na as Ne,nr as Pe,pt as Fe,wi as Ie,y as Le}from"./framework-DFR4HNtj.js";import{h as Re,o as ze,t as Be,w as Ve}from"./i18n-runtime-97_bDVjP.js";import{i as He,r as Ue}from"./vendor-ui-utils-DIUdEYii.js";import{t as We}from"./vendor-icon-activity-CkniytwY.js";import{t as Y}from"./vendor-icon-arrow-up-down-DdDqplfV.js";import{t as Ge}from"./vendor-icon-arrow-up-CzdjEQwQ.js";import{t as Ke}from"./vendor-icon-calendar-BsoUBIef.js";import{t as qe}from"./vendor-icon-chart-column-DicJIApF.js";import{t as Je}from"./vendor-icon-chart-gantt-DT-shh3t.js";import{t as Ye}from"./vendor-icon-check-vpu9Zukp.js";import{t as Xe}from"./vendor-icon-chevron-down-BEf_jTEE.js";import{t as X}from"./vendor-icon-copy-B5M-KdZo.js";import{t as Ze}from"./vendor-icon-ellipsis-BjiiCS3N.js";import{t as Qe}from"./vendor-icon-file-text-7BKAVNof.js";import{t as $e}from"./vendor-icon-funnel-CtmEg9FH.js";import{t as et}from"./vendor-icon-globe-BaOanPH5.js";import{t as tt}from"./vendor-icon-grid-3x3-Dyc1xp4z.js";import{t as nt}from"./vendor-icon-grip-vertical-B01-ovq0.js";import{t as rt}from"./vendor-icon-images-qaVnL5yL.js";import{t as it}from"./vendor-icon-layout-grid-B3quJ1GF.js";import{t as at}from"./vendor-icon-layout-template-BSsyv3fX.js";import{t as ot}from"./vendor-icon-list-ordered-DaaRBYov.js";import{t as st}from"./vendor-icon-list-tree-Br55vyL9.js";import{t as ct}from"./vendor-icon-list-TLz-7vfa.js";import{t as lt}from"./vendor-icon-lock-B_psRnly.js";import{t as ut}from"./vendor-icon-map-DsFP3Vmp.js";import{t as dt}from"./vendor-icon-pencil-CMubUBjW.js";import{t as ft}from"./vendor-icon-pin-off-C5gX5GZ0.js";import{t as pt}from"./vendor-icon-pin-BWwVcO2t.js";import{t as mt}from"./vendor-icon-plus-BlfcDDsa.js";import{t as ht}from"./vendor-icon-save-CuavGNuU.js";import{t as gt}from"./vendor-icon-search-B2Uqtp_W.js";import{t as _t}from"./vendor-icon-settings-2-BHIWdy1J.js";import{t as vt}from"./vendor-icon-settings-CYQ7xc_F.js";import{t as yt}from"./vendor-icon-share-2-D3bdPyHy.js";import{t as bt}from"./vendor-icon-sliders-horizontal-BsnKXU0c.js";import{t as Z}from"./vendor-icon-star-DfusowFE.js";import{t as xt}from"./vendor-icon-table-CeQhi8NL.js";import{t as St}from"./vendor-icon-trash-BLsWkwB9.js";import{t as Ct}from"./vendor-icon-x-CcLtgRNL.js";import{t as wt}from"./plugin-form-CLDvL0up.js";import{_ as Tt,a as Et,c as Dt,d as Ot,n as kt,o as At,p as jt,r as Mt,s as Nt,t as Pt,u as Ft,v as It,y as Lt}from"./vendor-dndkit-CqQIoA27.js";import{r as Rt}from"./plugin-grid-D2rmQEW_.js";var Q=e(n(),1);function zt(e,t,n,r){typeof e==`function`&&e(n),t&&typeof window<`u`&&window.dispatchEvent(new CustomEvent(t,{detail:r}))}var $=t(),Bt={list:`List`,detail:`Detail`,grid:`Grid`,kanban:`Kanban`,calendar:`Calendar`,timeline:`Timeline`,map:`Map`,gallery:`Gallery`,gantt:`Gantt`,chart:`Chart`,tree:`Tree`,page:`Page`},Vt={list:ct,detail:Qe,grid:tt,kanban:it,calendar:Ke,timeline:We,map:ut,gallery:rt,gantt:Je,chart:qe,tree:st,page:at},Ht=He(`flex gap-4`,{variants:{position:{top:`flex-col`,bottom:`flex-col-reverse`,left:`flex-row`,right:`flex-row-reverse`}},defaultVariants:{position:`top`}}),Ut=He(`w-full`,{variants:{orientation:{horizontal:`w-full`,vertical:`w-48`}},defaultVariants:{orientation:`horizontal`}}),Wt=He(`flex gap-2`,{variants:{orientation:{horizontal:`flex-row flex-wrap`,vertical:`flex-col`}},defaultVariants:{orientation:`horizontal`}}),Gt=He(``,{variants:{orientation:{horizontal:``,vertical:`flex h-auto flex-col items-stretch`}},defaultVariants:{orientation:`horizontal`}});function Kt(e){return e.label?e.label:Bt[e.type]||e.type}function qt(e){return e.icon?R(e.icon):Vt[e.type]||null}function Jt(e){return e.activeView?e.activeView:e.defaultView?e.defaultView:e.views?.[0]?.type}var Yt={share:yt,settings:vt,duplicate:X,delete:St},Xt={share:`Share`,settings:`Settings`,duplicate:`Duplicate`,delete:`Delete`},Zt=({schema:e,className:t,onViewChange:n,onCreateView:r,onViewAction:i,createViewLabel:a=`Create view`,...o})=>{let s=Q.useMemo(()=>e.storageKey?e.storageKey:`view-switcher${e.id?`-${e.id}`:``}`,[e.id,e.storageKey]),[c,l]=Q.useState(()=>Jt(e));Q.useEffect(()=>{if(e.activeView){l(e.activeView);return}if(e.persistPreference)try{let t=localStorage.getItem(s);if(t){let n=e.views.find(e=>e.type===t)?.type;n&&l(n)}}catch{}},[e.activeView,e.persistPreference,e.views,s]),Q.useEffect(()=>{if(e.persistPreference&&c&&!e.activeView)try{localStorage.setItem(s,c)}catch{}},[c,e.activeView,e.persistPreference,s]);let u=Q.useCallback(t=>{zt(n,e.onViewChange,t,{view:t})},[n,e.onViewChange]),f=Q.useCallback(e=>{l(e),u(e)},[u]),m=c||e.views?.[0]?.type,h=m||``,g=e.views.find(e=>e.type===m)||e.views?.[0],_=e.variant||`tabs`,y=e.position||`top`,b=y===`left`||y===`right`,ee=b?`vertical`:`horizontal`,S=e.viewActions&&e.viewActions.length>0?(0,$.jsx)(`div`,{className:`flex items-center gap-1`,children:e.viewActions.map((e,t)=>{let n=e.icon&&R(e.icon)||Yt[e.type];return(0,$.jsx)(W,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>i?.(e.type,m),title:Xt[e.type]||e.type,children:n?(0,$.jsx)(n,{className:`h-3.5 w-3.5`}):null},`action-${e.type}-${t}`)})}):null,C=e.allowCreateView?(0,$.jsx)(W,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>r?.(),title:a,children:(0,$.jsx)(mt,{className:`h-3.5 w-3.5`})}):null,w=(0,$.jsxs)(`div`,{className:H(Ut({orientation:ee}),`flex items-center gap-1`),children:[_===`dropdown`&&(0,$.jsxs)(v,{value:h,onValueChange:e=>f(e),children:[(0,$.jsx)(Ce,{className:H(`w-full`,b?`h-10`:`h-9`),children:(0,$.jsx)(p,{placeholder:`Select view`})}),(0,$.jsx)(x,{children:e.views.map((e,t)=>(0,$.jsx)(E,{value:e.type,children:Kt(e)},`${e.type}-${t}`))})]}),_===`buttons`&&(0,$.jsx)(`div`,{className:H(Wt({orientation:ee})),children:e.views.map((e,t)=>{let n=e.type===m,r=qt(e);return(0,$.jsxs)(W,{type:`button`,size:`sm`,variant:n?`secondary`:`ghost`,className:H(`justify-start gap-2`,b?`w-full`:``),onClick:()=>f(e.type),children:[r?(0,$.jsx)(r,{className:`h-4 w-4`}):null,(0,$.jsx)(`span`,{children:Kt(e)})]},`${e.type}-${t}`)})}),_===`tabs`&&(0,$.jsx)(O,{value:h,onValueChange:e=>f(e),children:(0,$.jsx)(d,{className:H(Gt({orientation:ee})),children:e.views.map((e,t)=>{let n=qt(e);return(0,$.jsxs)(re,{value:e.type,className:H(`gap-2`,b?`justify-start`:``),children:[n?(0,$.jsx)(n,{className:`h-4 w-4`}):null,(0,$.jsx)(`span`,{children:Kt(e)})]},`${e.type}-${t}`)})})}),S,C]}),T=g?.schema?Array.isArray(g.schema)?(0,$.jsx)(`div`,{className:`space-y-4`,children:g.schema.map((e,t)=>(0,$.jsx)(J,{schema:e,...o},`${g.type}-${t}`))}):(0,$.jsx)(J,{schema:Me(g.schema),...o}):null;return(0,$.jsxs)(`div`,{className:H(Ht({position:y}),t),children:[(0,$.jsx)(`div`,{className:H(`shrink-0`,b?`flex flex-col`:`flex`),children:w}),(0,$.jsx)(`div`,{className:`flex-1 min-w-0`,children:T})]})};c();var Qt={sm:480,md:720,lg:960,xl:1200,full:1600};function $t(e){let t=o(e);return t<=3?`sm`:t<=8?`md`:t<=15?`lg`:`xl`}function en(e,t){return`min(92vw, ${Qt[!e||e===`auto`?$t(t):e]}px)`}var tn=12;function nn(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function rn(e,t,n=0){if(Object.is(e,t))return!0;if(n>=tn)return!1;if(e instanceof Date||t instanceof Date)return e instanceof Date&&t instanceof Date&&e.getTime()===t.getTime();if(Array.isArray(e)||Array.isArray(t)){if(!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!rn(e[r],t[r],n+1))return!1;return!0}if(nn(e)&&nn(t)){let r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(let i of r)if(!Object.prototype.hasOwnProperty.call(t,i)||!rn(e[i],t[i],n+1))return!1;return!0}return!1}function an(e){let t=(0,Q.useRef)(e),n=rn(t.current,e)?t.current:e;return t.current=n,n}var on=J,sn={latitudeField:`latitudeField`,longitudeField:`longitudeField`,locationField:`locationField`,titleField:`titleField`,descriptionField:`descriptionField`,zoom:`zoom`,center:`center`,style:`mapStyle`};function cn(e){if(!e||typeof e!=`object`)return{};let t=e;return Object.fromEntries(Object.entries(sn).filter(([e])=>e in t).map(([e,n])=>[n,t[e]]))}function ln(e){if(!Array.isArray(e)||e.length===0)return;let t=e.map(Ae).filter(e=>!!e);return t.length>0?t:void 0}function un(e){if(Array.isArray(e))return e.map(Ae).filter(e=>!!e)}function dn(e,t){if(!Array.isArray(e)||!Array.isArray(t)||t.length===0)return e;let n=new Set(t);return e.filter(e=>{let t=Ae(e);return!t||!n.has(t)})}function fn(e,t){if(!Array.isArray(e)||!Array.isArray(t)||t.length===0)return e;let n=new Map(t.map((e,t)=>[e,t])),r=e=>n.get(Ae(e))??1/0;return[...e].sort((e,t)=>r(e)-r(t))}function pn(e){return Array.isArray(e)?{formats:e}:e}var mn=[`aggregations`,`bulkActionDefs`,`bulkActions`,`conditionalFormatting`,`editable`,`exportOptions`,`frozenColumns`,`grouping`,`label`,`reorderableColumns`,`resizable`,`rowActions`,`rowColor`,`rowHeight`,`searchableFields`,`showColumnTypeIcons`,`showPagination`,`showSearch`,`singleClickEdit`];function hn(e,t,n){t[n]!==void 0&&(e[n]=t[n])}function gn(e){let t={};if(!e)return t;for(let n of mn)hn(t,e,n);return t}function _n(e,t){let[n,r]=(0,Q.useState)(()=>vn(e,t));if(n.currentUserId!==t.currentUserId||n.currentOrgId!==t.currentOrgId||n.recordId!==t.recordId||n.onUnresolved!==t.onUnresolved||!rn(n.segments,e)){let n=vn(e,t);return r(n),n.resolved}return n.resolved}function vn(e,t){return{segments:e,currentUserId:t.currentUserId,currentOrgId:t.currentOrgId,recordId:t.recordId,onUnresolved:t.onUnresolved,resolved:K(e,t)}}function yn(){let{t:e}=Ve(),t=e(`console.objectView.new`);return t===`console.objectView.new`?`New`:t}var bn=Re({"detail.recordDetailWithLabel":`{{label}} Detail`,"form.createTitle":`Create {{object}}`,"form.editTitle":`Edit {{object}}`,"form.viewTitle":`View {{object}}`,"actionConfirm.title":`Confirm Action`,"actionConfirm.confirm":`Continue`,"actionConfirm.cancel":`Cancel`,"objectActions.deleteConfirm":`Are you sure you want to delete this record?`,"console.objectView.bulkDeleteConfirm":`Delete {{count}} selected records? This cannot be undone.`,"objectActions.deleteSuccess":`{{label}} deleted successfully`,"objectActions.deleteFailed":`Failed to delete {{label}}`,"objectActions.bulkDeleteSuccess":`Deleted {{count}} {{label}} records`,"objectActions.bulkDeletePartial":`{{succeeded}} deleted, {{failed}} failed`},`detail.recordDetailWithLabel`),xn=new Set([`kanban`,`calendar`,`gallery`,`timeline`,`map`]),Sn=({schema:e,dataSource:t,className:n,views:i,activeViewId:o,onViewChange:s,onRowClick:c,onEdit:u,renderListView:p,hideNamedViewTabs:m,toolbarAddon:h,onCreateView:_,onViewAction:v})=>{let y=yn(),{t:b}=bn(),{language:x}=Ve(),S=Be(),C=e.objectName??``,{ready:T,def:E}=Le(C,t),[D,A]=(0,Q.useState)(!1),[te,j]=(0,Q.useState)(`create`),[M,P]=(0,Q.useState)(null),[I,se]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{if(t?.onMutation&&e.objectName&&!p)return t.onMutation(t=>{t.resource===e.objectName&&(se(e=>e+1),ke({objectName:t.resource,recordId:t.id==null?void 0:String(t.id)}))})},[t,e.objectName,p]);let[ce,pe]=(0,Q.useState)([]),[L,me]=(0,Q.useState)(!1),_e=(0,Q.useRef)(null),R=e.listViews,z=R!=null&&Object.keys(R).length>0,[ve,be]=(0,Q.useState)(()=>e.defaultListView&&R?.[e.defaultListView]?e.defaultListView:R&&Object.keys(R)[0]||``),V=(0,Q.useMemo)(()=>!z||!ve?null:R[ve]||null,[z,ve,R]),U=(0,Q.useMemo)(()=>i&&i.length>0?i:null,[i]),xe=U!=null&&U.length>0,Ce=o||U?.[0]?.id,G=U?.find(e=>e.id===Ce)||U?.[0],we=an(G?{id:G.id,filter:G.filter,sort:G.sort}:void 0),Ee=Fe(),K=_n({view:V?.filter||we?.filter,table:e.table?.filter,tableDefaults:e.table?.defaultFilters},Ee),q=(0,Q.useMemo)(()=>V?.type?V.type:G?.type?G.type:e.defaultViewType||`grid`,[V,G,e.defaultViewType]),J=V?.navigation??e.navigation,Ae=l(),Me=JSON.stringify(e.table?.sort??null),Ie=!p&&xn.has(q),Re=Oe(Ie&&t&&e.objectName||void 0);(0,Q.useEffect)(()=>{let n=!0;return(async()=>{if(Ie&&t&&e.objectName&&T)try{let r=Ne(K.view||K.table||K.tableDefaults),i=V?.sort||we?.sort||e.table?.sort,a=Te(E?.fields),o=Ae?.isLoaded?a.filter(t=>Ae.checkField(e.objectName,t,`read`)):a,s=JSON.stringify([e.objectName,r,i,o]);me(_e.current!==s);let c=await t.find(e.objectName,{$filter:r,$orderby:je(i),$top:100,...o.length>0?{$expand:o}:{}}),l=[];Array.isArray(c)?l=c:c&&typeof c==`object`&&Array.isArray(c.data)&&(l=c.data),n&&(pe(l),_e.current=s)}catch(e){console.error(`ObjectView data fetch error:`,e)}finally{n&&me(!1)}})(),()=>{n=!1}},[e.objectName,t,q,I,V,we,p,T,E,Ae,K,Me,Re,Ie]);let He=ue(),We=e.layout||a(E,{viewport:He?`mobile`:`desktop`}),Y=We===`page`&&!e.onNavigate?`drawer`:We,Ge=e.operations||e.table?.operations||{create:!0,read:!0,update:!0,delete:!0},Ke=(0,Q.useCallback)(()=>{Y===`page`&&e.onNavigate?e.onNavigate(`new`,`edit`):(j(`create`),P(null),A(!0))},[Y,e]),qe=(0,Q.useCallback)(t=>{if(u){u(t);return}if(Y===`page`&&e.onNavigate){let n=t.id||t._id;e.onNavigate(n,`edit`)}else j(`edit`),P(t),A(!0)},[Y,e,u]),Je=(0,Q.useCallback)(t=>{if(Y===`page`&&e.onNavigate){let n=t.id||t._id;e.onNavigate(n,`view`)}else j(`view`),P(t),A(!0)},[Y,e]),Ye=(0,Q.useCallback)(t=>{let n=t.id||t._id,r=`/${e.objectName}/${encodeURIComponent(String(n))}`;window.open(r,`_blank`)},[e.objectName]),Xe=(0,Q.useCallback)((t,n)=>{if(c){c(t,n);return}let r=n,i=!!(r&&(r.metaKey||r.ctrlKey||r.button===1))&&(t.id||t._id)!=null;if(J){if(J.mode===`none`||J.preventNavigation)return;if(J.mode===`new_window`||J.openNewTab||i){Ye(t);return}if(J.mode===`drawer`){j(`view`),P(t),A(!0);return}if(J.mode===`modal`){j(`view`),P(t),A(!0);return}if(J.mode===`page`){let n=t.id||t._id;e.onNavigate&&e.onNavigate(n,`view`);return}if(J.mode===`split`||J.mode===`popover`){j(`view`),P(t),A(!0);return}}if(Ge.read!==!1){if(i){Ye(t);return}Je(t)}},[c,J,Ge.read,Je,Ye,e]),[X,Ze]=(0,Q.useState)(null),Qe=(0,Q.useCallback)(e=>{e?.id!=null&&Ze({open:!0,records:[e],bulk:!1})},[]),$e=(0,Q.useCallback)(e=>{let t=e.filter(e=>e?.id!=null);t.length!==0&&Ze({open:!0,records:t,bulk:!0})},[]),et=(0,Q.useCallback)(()=>{se(e=>e+1),e.objectName&&ke({objectName:e.objectName})},[e.objectName]),tt=(0,Q.useCallback)(()=>{A(!1),P(null),et()},[et]),nt=(0,Q.useCallback)(()=>{A(!1),P(null)},[]),rt=(0,Q.useMemo)(()=>!xe||!U||U.length<=1?null:{type:`view-switcher`,variant:`tabs`,position:`top`,persistPreference:!0,storageKey:`view-pref-${e.objectName}`,defaultView:G?.type||`grid`,activeView:G?.type||`grid`,views:U.map(e=>({type:e.type,label:e.label,icon:{kanban:`kanban`,calendar:`calendar`,map:`map`,gallery:`layout-grid`,timeline:`activity`,gantt:`chart-gantt`,grid:`table`,list:`list`,detail:`file-text`,chart:`chart-column`,tree:`list-tree`,page:`layout-template`}[e.type]||`table`})),allowCreateView:e.allowCreateView,viewActions:e.viewActions},[xe,U,G,e.objectName,e.allowCreateView,e.viewActions]),it=(0,Q.useCallback)(e=>{if(!U)return;let t=U.find(t=>t.type===e);t&&s&&s(t.id)},[U,s]),at=(0,Q.useCallback)(e=>{be(e)},[]),ot=(0,Q.useCallback)(t=>{let n=De(G??{}).userActions,r={objectName:e.objectName,fields:un(V?.columns)||G?.columns||ln(e.table?.columns)||e.table?.fields,className:`h-full w-full`,showSearch:n?.search??e.showSearch??!1,showSort:n?.sort??e.showSort??!1,showFilters:n?.filter??e.showFilters??!1,color:G?.color},i=G||{},a={kanban:V?.kanban,calendar:V?.calendar,gallery:V?.gallery,timeline:V?.timeline,gantt:V?.gantt,map:V?.map,chart:V?.chart,tree:V?.tree},o=Object.keys(a).filter(e=>a[e]!=null),s=o.length===0?i:o.reduce((e,t)=>({...e,[t]:{...i[t]??{},...a[t]}}),{...i});switch(t){case`kanban`:{let e=s.kanban||{},t=e.groupByField||e.groupField||`status`,n=(Array.isArray(e.columns)&&e.columns.length>0?e.columns:r.fields)||[],{columns:i,groupByField:a,groupField:o,titleField:c,conditionalFormatting:l,groupBy:u,...d}=e,f=e.conditionalFormatting??G?.conditionalFormatting;return{type:`object-kanban`,...r,groupBy:t,titleField:e.titleField||`name`,cardFields:n,...d,...f?{conditionalFormatting:f}:{}}}case`calendar`:{let{dateField:e,endField:t,...n}=s.calendar||{};return{type:`object-calendar`,...r,...s.calendar?.startDateField?{startDateField:s.calendar.startDateField}:{},...s.calendar?.endDateField?{endDateField:s.calendar.endDateField}:{},...s.calendar?.titleField?{titleField:s.calendar.titleField}:{},...n}}case`gallery`:return{type:`object-gallery`,...r,imageField:s.gallery?.coverField||s.gallery?.imageField,titleField:s.gallery?.titleField||`name`,...s.gallery||{}};case`timeline`:{let e=s.timeline?.startDateField||s.timeline?.dateField;return{type:`object-timeline`,...r,...e?{startDateField:e}:{},titleField:s.timeline?.titleField||`name`,...s.timeline||{}}}case`gantt`:return{type:`object-gantt`,...r,...s.gantt?.startDateField?{startDateField:s.gantt.startDateField}:{},...s.gantt?.endDateField?{endDateField:s.gantt.endDateField}:{},...s.gantt||{}};case`map`:return{type:`object-map`,...r,...cn(s.map)};case`tree`:return{type:`object-tree`,...r,parentField:s.tree?.parentField,labelField:s.tree?.labelField||s.tree?.titleField||`name`,fields:s.tree?.fields||r.fields,defaultExpandedDepth:s.tree?.defaultExpandedDepth,...s.tree||{}};case`chart`:{let t=s.chart||{};if(t.dataset){let e=Array.isArray(t.dimensions)?t.dimensions:[],n=Array.isArray(t.values)?t.values:[];return{type:`object-chart`,dataset:t.dataset,dimensions:e,values:n,chartType:t.chartType||`bar`,xAxisKey:e[0],series:n.map(e=>({dataKey:e,label:e})),className:`h-[400px] w-full`}}let n=Array.isArray(t.yAxisFields)&&t.yAxisFields[0]||t.valueField||`value`,r=t.xAxisField||t.categoryField||`name`;return{type:`object-chart`,objectName:e.objectName,chartType:t.chartType||`bar`,aggregate:{field:n,function:t.aggregation||`count`,groupBy:r},xAxisKey:r,series:[{dataKey:n,label:n}],className:`h-[400px] w-full`}}default:return null}},[e.objectName,e.table?.columns,e.table?.fields,V,G]),st=(0,Q.useMemo)(()=>{let t=K.view,n=V?.sort||G?.sort,r=V?.hiddenFields,i=V?.fieldOrder,a=gn(e.table);return{type:`object-grid`,objectName:e.objectName,title:e.table?.title,fields:fn(dn(un(V?.columns)||G?.columns||e.table?.fields,r),i),columns:fn(dn(V?.columns||G?.columns||e.table?.columns,r),i),operations:{...Ge,create:!1},defaultFilters:t||K.tableDefaults,filter:t?void 0:K.table,sort:n||e.table?.sort,...a,pagination:V?.pagination??e.table?.pagination,selection:V?.selection??e.table?.selection,rowHeight:V?.rowHeight??a.rowHeight,resizable:V?.resizable??a.resizable,searchableFields:V?.searchableFields??a.searchableFields,conditionalFormatting:V?.conditionalFormatting??a.conditionalFormatting,rowActions:V?.rowActions??a.rowActions,bulkActions:V?.bulkActions??a.bulkActions,bulkActionDefs:V?.bulkActionDefs??a.bulkActionDefs,exportOptions:pn(V?.exportOptions)??a.exportOptions,editable:V?.inlineEdit??a.editable,grouping:V?.grouping??a.grouping,rowColor:V?.rowColor??a.rowColor,pageSize:e.table?.pageSize,selectable:e.table?.selectable,className:e.table?.className}},[e,Ge,V,G,K]),ct=()=>{let t=M?M.id||M._id:void 0;return{type:`object-form`,objectName:e.objectName,mode:te,recordId:t,title:e.form?.title,description:e.form?.description,fields:e.form?.fields,customFields:e.form?.customFields,sections:e.form?.sections,groups:e.form?.groups,layout:e.form?.layout,columns:e.form?.columns,showSubmit:e.form?.showSubmit,submitText:e.form?.submitText,showCancel:e.form?.showCancel,cancelText:e.form?.cancelText,showReset:e.form?.showReset,initialValues:e.form?.initialValues,buttons:e.form?.buttons,defaults:e.form?.defaults,readOnly:e.form?.readOnly||te===`view`,className:e.form?.className,subforms:e.form?.subforms,onSuccess:tt,onCancel:nt}},lt=ze(e.form?.title,x),ut=ze(e.form?.description,x),dt=()=>{if(lt)return lt;let t=E?.label||e.objectName;switch(te){case`create`:return b(`form.createTitle`,{object:t});case`edit`:return b(`form.editTitle`,{object:t});case`view`:return b(`form.viewTitle`,{object:t});default:return t}},ft=(0,Q.useMemo)(()=>{let e=J?.width;return e?typeof e==`number`?`max-w-[${e}px]`:`max-w-[${e}]`:``},[J]),pt=()=>(0,$.jsx)(de,{open:D,onOpenChange:A,direction:`right`,children:(0,$.jsxs)(ye,{className:H(`w-full sm:max-w-2xl`,ft),children:[(0,$.jsxs)(F,{children:[(0,$.jsx)(ge,{children:dt()}),ut&&(0,$.jsx)(N,{children:ut})]}),(0,$.jsx)(`div`,{className:`flex-1 overflow-y-auto px-4 pb-4`,children:(0,$.jsx)(wt,{schema:ct(),dataSource:t})})]})}),ht=()=>(0,$.jsx)(f,{open:D,onOpenChange:A,children:(0,$.jsxs)(le,{className:H(`max-w-2xl max-h-[90vh] overflow-y-auto`,ft),children:[(0,$.jsxs)(w,{children:[(0,$.jsx)(g,{children:dt()}),ut&&(0,$.jsx)(ee,{children:ut})]}),(0,$.jsx)(wt,{schema:ct(),dataSource:t})]})}),gt=K.view||K.table||K.tableDefaults,_t=V?.sort||G?.sort||e.table?.sort,vt=()=>{let n=`${e.objectName}-${ve||G?.id||`default`}-${q}`;if(p)return p({schema:{type:`list-view`,objectName:e.objectName,viewType:q,label:V?.label??G?.label,description:V?.description??G?.description,columns:V?.columns||G?.columns||e.table?.columns||e.table?.fields,filter:gt,sort:_t,rowHeight:V?.rowHeight??De(G??{}).rowHeight,groupBy:G?.groupBy,groupBy2:G?.groupBy2,grouping:V?.grouping??G?.grouping,options:G,userActions:{...De(e??{}).userActions,...De(G??{}).userActions,...V?.userActions},compactToolbar:V?.compactToolbar??G?.compactToolbar??e.compactToolbar,allowExport:e.allowExport,exportOptions:V?.exportOptions??G?.exportOptions,color:G?.color??e.color,rowColor:V?.rowColor??G?.rowColor,inlineEdit:V?.inlineEdit??G?.inlineEdit??e.inlineEdit,wrapHeaders:e.wrapHeaders,clickIntoRecordDetails:e.clickIntoRecordDetails,addRecordViaForm:e.addRecordViaForm,addDeleteRecordsInline:e.addDeleteRecordsInline,collapseAllByDefault:e.collapseAllByDefault,fieldTextColor:e.fieldTextColor,prefixField:e.prefixField,showDescription:G?.showDescription??e.showDescription,data:V?.data??G?.data??e.data,navigation:V?.navigation??G?.navigation??e.navigation,selection:V?.selection??G?.selection??e.selection,pagination:V?.pagination??G?.pagination??e.pagination,searchableFields:V?.searchableFields??G?.searchableFields??e.searchableFields,filterableFields:V?.filterableFields??G?.filterableFields??e.filterableFields,resizable:V?.resizable??G?.resizable??e.resizable,hiddenFields:V?.hiddenFields??G?.hiddenFields??e.hiddenFields,fieldOrder:V?.fieldOrder,appearance:V?.appearance??G?.appearance,rowActions:V?.rowActions??G?.rowActions??e.rowActions,rowActionDefs:G?.rowActionDefs??e.rowActionDefs,bulkActions:V?.bulkActions??G?.bulkActions??e.bulkActions,bulkActionDefs:V?.bulkActionDefs??G?.bulkActionDefs,sharing:V?.sharing??G?.sharing??e.sharing,addRecord:V?.addRecord??G?.addRecord??e.addRecord,conditionalFormatting:V?.conditionalFormatting??G?.conditionalFormatting??e.conditionalFormatting,userFilters:V?.userFilters??G?.userFilters??e.userFilters,showRecordCount:V?.showRecordCount??G?.showRecordCount??e.showRecordCount,allowPrinting:V?.allowPrinting??G?.allowPrinting??e.allowPrinting,emptyState:V?.emptyState??G?.emptyState??e.emptyState,aria:V?.aria??G?.aria??e.aria,refreshTrigger:I},dataSource:t,onEdit:qe,onRowClick:Xe,className:`h-full`,refreshKey:I,onAddRecord:Ke});if(q!==`grid`){let e=ot(q);if(e&&on)return(0,$.jsx)(on,{schema:e,dataSource:t,data:ce,loading:L},n);if(!on)return(0,$.jsx)(`div`,{className:`flex items-center justify-center h-40 text-muted-foreground`,children:(0,$.jsxs)(`p`,{children:[`SchemaRenderer not available. Install @object-ui/react to render `,q,` views.`]})})}return(0,$.jsx)(Rt,{schema:st,dataSource:t,onRowClick:Xe,onEdit:Ge.update===!1?void 0:qe,onDelete:Ge.delete===!1?void 0:Qe,onBulkDelete:Ge.delete===!1?void 0:$e},n)},yt=()=>{if(m||!z)return null;let e=Object.entries(R);return e.length<=1?null:(0,$.jsx)(O,{value:ve,onValueChange:at,className:`w-full`,children:(0,$.jsx)(d,{className:`w-auto`,children:e.map(([e,t])=>(0,$.jsx)(re,{value:e,className:`text-sm`,children:r(t.label,S)||t.name||e},e))})})},bt=()=>{let t=e.showCreate!==!1&&Ge.create!==!1,n=e.showViewSwitcher===!0,r=yt();return!r&&!n&&!t&&!h?null:(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[r,(n||t||h)&&(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,$.jsx)(`div`,{className:`flex items-center gap-2`,children:n&&rt&&(0,$.jsx)(Zt,{schema:rt,onViewChange:it,onCreateView:_,onViewAction:v,className:`overflow-x-auto`})}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[h,t&&(0,$.jsxs)(W,{size:`sm`,onClick:Ke,children:[(0,$.jsx)(mt,{className:`h-4 w-4`}),y]})]})]})]})},Z=J?.mode===`modal`?`modal`:J?.mode===`drawer`?`drawer`:J?.mode===`split`?`split`:J?.mode===`popover`?`popover`:Y,xt=()=>te===`create`?Y===`modal`?ht():pt():null,St=e=>(0,$.jsx)(`div`,{className:`space-y-3`,children:(0,$.jsx)(wt,{schema:ct(),dataSource:t})}),Ct=(0,Q.useCallback)(e=>{e||nt()},[nt]),Tt=bt(),Et=(0,$.jsx)(B,{open:X?.open??!1,onOpenChange:e=>{e||Ze(e=>e&&{...e,open:!1})},children:(0,$.jsxs)(he,{children:[(0,$.jsxs)(ae,{children:[(0,$.jsx)(k,{children:b(`actionConfirm.title`)}),(0,$.jsx)(fe,{children:X?.bulk?b(`console.objectView.bulkDeleteConfirm`,{count:X.records.length}):Pe.confirmText({objectName:e.objectName,t:b},X?.records[0])})]}),(0,$.jsxs)(oe,{children:[(0,$.jsx)(ie,{children:b(`actionConfirm.cancel`)}),(0,$.jsx)(ne,{onClick:()=>{if(!X?.open)return;let{records:n,bulk:r}=X;Ze({...X,open:!1}),Pe.run({objectName:e.objectName,label:E?.label||e.objectName,dataSource:t,t:b,toast:Ue,onRefresh:et},r?{params:{records:n}}:{params:{recordId:String(n[0].id),record:n[0]}})},children:b(`actionConfirm.confirm`)})]})]})});if(Z===`split`){let t=E?.label||e.objectName;return(0,$.jsxs)(`div`,{className:H(`flex flex-col h-full min-w-0 overflow-hidden`,n),children:[(e.title||e.description)&&(0,$.jsxs)(`div`,{className:`mb-4 shrink-0`,children:[e.title&&(0,$.jsx)(`h2`,{className:`text-2xl font-bold tracking-tight`,children:e.title}),e.description&&(0,$.jsx)(`p`,{className:`text-muted-foreground mt-1`,children:e.description})]}),Tt&&(0,$.jsx)(`div`,{className:`mb-4 shrink-0`,children:Tt}),(0,$.jsx)(`div`,{className:`flex-1 min-h-0 min-w-0 overflow-hidden`,children:D&&M?(0,$.jsx)(Se,{isOpen:D,selectedRecord:M,mode:`split`,close:nt,setIsOpen:Ct,width:J?.width,isOverlay:!0,title:b(`detail.recordDetailWithLabel`,{label:t}),mainContent:(0,$.jsx)(`div`,{className:`h-full overflow-auto`,children:vt()}),children:St}):vt()}),xt(),Et]})}return(0,$.jsxs)(`div`,{className:H(`flex flex-col h-full min-w-0 overflow-hidden`,n),children:[(e.title||e.description)&&(0,$.jsxs)(`div`,{className:`mb-4 shrink-0`,children:[e.title&&(0,$.jsx)(`h2`,{className:`text-2xl font-bold tracking-tight`,children:e.title}),e.description&&(0,$.jsx)(`p`,{className:`text-muted-foreground mt-1`,children:e.description})]}),Tt&&(0,$.jsx)(`div`,{className:`mb-4 shrink-0`,children:Tt}),(0,$.jsx)(`div`,{className:`flex-1 min-h-0 min-w-0 overflow-hidden`,children:vt()}),Z===`drawer`&&pt(),Z===`modal`&&ht(),Z===`popover`&&D&&M&&(0,$.jsx)(Se,{isOpen:D,selectedRecord:M,mode:`popover`,close:nt,setIsOpen:Ct,width:J?.width,isOverlay:!0,title:dt(),children:St}),Z===`popover`&&xt(),Et]})},Cn=He(`flex`,{variants:{layout:{inline:`flex-col space-y-4`,popover:`items-center`,drawer:`items-center`}},defaultVariants:{layout:`inline`}}),wn=e=>e==null||e===``?!0:Array.isArray(e)?e.length===0:typeof e==`object`&&Object.values(e).every(e=>e==null||e===``),Tn=e=>Array.isArray(e)?{start:e[0]||``,end:e[1]||``}:e&&typeof e==`object`?{start:e.start||``,end:e.end||``}:{start:``,end:``},En=({schema:e,className:t,onChange:n})=>{let[r,i]=Q.useState(e.values||{}),[a,o]=Q.useState(!1);Q.useEffect(()=>{e.values&&i(e.values)},[e.values]);let s=Q.useCallback(t=>{zt(n,e.onChange,t,{values:t})},[n,e.onChange]),c=Q.useCallback((t,n)=>{let a={...r,[t]:n};i(a),e.showApply||s(a)},[s,e.showApply,r]),l=Q.useCallback(()=>{let t={};if(i(t),e.showApply){s(t);return}s(t)},[s,e.showApply]),u=Q.useCallback(()=>{s(r),o(!1)},[s,r]),d=Q.useMemo(()=>Object.values(r).filter(e=>!wn(e)).length,[r]),f=e=>{let t=e.label||e.field,n=e.placeholder||`Filter by ${t}`;switch(e.type){case`number`:return(0,$.jsx)(y,{type:`number`,value:r[e.field]??``,placeholder:n,onChange:t=>{let n=t.target.value,r=n===``?``:Number(n);c(e.field,r)}});case`select`:return(0,$.jsxs)(v,{value:r[e.field]===void 0?``:String(r[e.field]),onValueChange:t=>{let n=e.options?.find(e=>String(e.value)===t);c(e.field,n?n.value:t)},children:[(0,$.jsx)(Ce,{children:(0,$.jsx)(p,{placeholder:n})}),(0,$.jsx)(x,{children:e.options?.map(e=>(0,$.jsx)(E,{value:String(e.value),children:e.label},String(e.value)))})]});case`multi-select`:{let t=r[e.field],n=Array.isArray(t)?t:t?[t]:[];return(0,$.jsx)(`div`,{className:`max-h-40 overflow-y-auto space-y-0.5 border rounded-md p-2`,children:e.options?.map(t=>{let r=n.map(String).includes(String(t.value));return(0,$.jsxs)(`label`,{className:H(`flex items-center gap-2 text-sm py-1 px-1.5 rounded cursor-pointer`,r?`bg-primary/5 text-primary`:`hover:bg-muted`),children:[(0,$.jsx)(G,{checked:r,onCheckedChange:r=>{let i=r?[...n,t.value]:n.filter(e=>String(e)!==String(t.value));c(e.field,i)}}),(0,$.jsx)(`span`,{className:`truncate`,children:t.label})]},String(t.value))})})}case`date`:return(0,$.jsx)(y,{type:`date`,value:r[e.field]??``,onChange:t=>c(e.field,t.target.value)});case`date-range`:{let t=Tn(r[e.field]);return(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(y,{type:`date`,value:t.start??``,onChange:n=>{c(e.field,{...t,start:n.target.value})}}),(0,$.jsx)(y,{type:`date`,value:t.end??``,onChange:n=>{c(e.field,{...t,end:n.target.value})}})]})}case`boolean`:return(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(G,{checked:!!r[e.field],onCheckedChange:t=>c(e.field,!!t)}),(0,$.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Enabled`})]});default:return(0,$.jsx)(y,{value:r[e.field]??``,placeholder:n,onChange:t=>c(e.field,t.target.value)})}},m=(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:e.filters.map(e=>(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(T,{className:`text-xs text-muted-foreground`,children:e.label||e.field}),f(e)]},e.field))}),(e.showApply||e.showClear)&&(0,$.jsxs)(`div`,{className:`flex items-center justify-end gap-2 border-t pt-3`,children:[e.showClear&&(0,$.jsx)(W,{type:`button`,variant:`ghost`,size:`sm`,onClick:l,children:`Clear`}),e.showApply&&(0,$.jsx)(W,{type:`button`,size:`sm`,onClick:u,children:`Apply`})]})]}),h=e.layout||`inline`;return h===`popover`?(0,$.jsx)(`div`,{className:H(Cn({layout:h}),t),children:(0,$.jsxs)(_,{open:a,onOpenChange:o,children:[(0,$.jsx)(_e,{asChild:!0,children:(0,$.jsxs)(W,{type:`button`,variant:d>0?`secondary`:`outline`,size:`sm`,className:`gap-2`,children:[(0,$.jsx)(bt,{className:`h-4 w-4`}),`Filters`,d>0&&(0,$.jsx)(`span`,{className:`inline-flex h-5 min-w-[20px] items-center justify-center rounded-full bg-primary/10 px-1 text-xs font-medium text-primary`,children:d})]})}),(0,$.jsx)(b,{align:`start`,className:`w-[520px] p-4`,children:m})]})}):h===`drawer`?(0,$.jsxs)(`div`,{className:H(Cn({layout:h}),t),children:[(0,$.jsxs)(W,{type:`button`,variant:d>0?`secondary`:`outline`,size:`sm`,className:`gap-2`,onClick:()=>o(!0),children:[(0,$.jsx)(bt,{className:`h-4 w-4`}),`Filters`,d>0&&(0,$.jsx)(`span`,{className:`inline-flex h-5 min-w-[20px] items-center justify-center rounded-full bg-primary/10 px-1 text-xs font-medium text-primary`,children:d})]}),(0,$.jsx)(de,{open:a,onOpenChange:o,children:(0,$.jsxs)(ye,{children:[(0,$.jsxs)(F,{children:[(0,$.jsx)(ge,{children:`Filters`}),(0,$.jsx)(N,{children:`Refine the data with advanced filters.`})]}),(0,$.jsx)(`div`,{className:`px-4 pb-6`,children:m})]})})]}):(0,$.jsxs)(`div`,{className:H(Cn({layout:h}),t),children:[m,!e.showApply&&e.showClear&&(0,$.jsxs)(W,{type:`button`,variant:`ghost`,size:`sm`,className:`gap-2`,onClick:l,children:[(0,$.jsx)(Ct,{className:`h-3.5 w-3.5`}),`Clear filters`]})]})},Dn=He(``,{variants:{variant:{buttons:`flex flex-wrap gap-2`,dropdown:`flex flex-wrap items-center gap-3`,builder:`space-y-3`}},defaultVariants:{variant:`dropdown`}}),On=e=>e?e.map(e=>({field:e.field,direction:e.direction})):[],kn=e=>e.map(e=>({id:`${e.field}-${e.direction}`,field:e.field,order:e.direction})),An=e=>e.filter(e=>e.field).map(e=>({field:e.field,direction:e.order})),jn=({schema:e,className:t,onChange:n})=>{let[r,i]=Q.useState(()=>On(e.sort)),[a,o]=Q.useState(()=>kn(On(e.sort)));Q.useEffect(()=>{let t=On(e.sort);i(t),o(kn(t))},[e.sort]);let s=Q.useCallback(t=>{i(t),zt(n,e.onChange,t,{sort:t})},[n,e.onChange]),c=Q.useCallback(t=>{let n=r.find(e=>e.field===t),i=!!e.multiple;if(!n){let e=i?[...r,{field:t,direction:`asc`}]:[{field:t,direction:`asc`}];s(e);return}if(n.direction===`asc`){let e=r.map(e=>e.field===t?{...e,direction:`desc`}:e);s(e);return}let a=r.filter(e=>e.field!==t);s(a)},[s,e.multiple,r]);if((e.variant||`dropdown`)===`buttons`)return(0,$.jsx)(`div`,{className:H(Dn({variant:`buttons`}),t),children:e.fields.map(e=>{let t=r.find(t=>t.field===e.field);return(0,$.jsxs)(W,{type:`button`,variant:t?`secondary`:`outline`,size:`sm`,onClick:()=>c(e.field),className:`gap-2`,children:[(0,$.jsx)(`span`,{children:e.label||e.field}),t&&(0,$.jsx)(Ge,{className:H(`h-3.5 w-3.5 motion-safe:transition-transform motion-safe:duration-200`,t.direction===`desc`&&`rotate-180`),"aria-label":t.direction===`asc`?`ascending`:`descending`})]},e.field)})});if(e.multiple)return(0,$.jsx)(`div`,{className:H(Dn({variant:`builder`}),t),children:(0,$.jsx)(S,{fields:e.fields.map(e=>({value:e.field,label:e.label||e.field})),value:a,onChange:e=>{o(e),s(An(e))}})});let l=r[0];return(0,$.jsxs)(`div`,{className:H(Dn({variant:`dropdown`}),t),children:[(0,$.jsxs)(v,{value:l?.field||``,onValueChange:e=>{if(!e){s([]);return}s([{field:e,direction:l?.direction||`asc`}])},children:[(0,$.jsx)(Ce,{className:`w-56`,children:(0,$.jsx)(p,{placeholder:`Select field`})}),(0,$.jsx)(x,{children:e.fields.map(e=>(0,$.jsx)(E,{value:e.field,children:e.label||e.field},e.field))})]}),(0,$.jsxs)(v,{value:l?.direction||`asc`,onValueChange:e=>{l?.field&&s([{field:l.field,direction:e}])},children:[(0,$.jsx)(Ce,{className:`w-36`,children:(0,$.jsx)(p,{})}),(0,$.jsxs)(x,{children:[(0,$.jsx)(E,{value:`asc`,children:`Ascending`}),(0,$.jsx)(E,{value:`desc`,children:`Descending`})]})]})]})};function Mn(){if(typeof crypto<`u`&&typeof crypto.randomUUID==`function`)return crypto.randomUUID();if(typeof crypto<`u`&&typeof crypto.getRandomValues==`function`){let e=new Uint8Array(16);return crypto.getRandomValues(e),Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)}return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)}function Nn(e,t,n,r){return`${e}/share/${t}/${n}?mode=readonly&token=${r}`}var Pn=({objectName:e,viewId:t=`default`,baseUrl:n,onShare:r,className:i})=>{let[a,o]=Q.useState(null),[s,c]=Q.useState(!1),[l,u]=Q.useState(!1),[d,f]=Q.useState(``),[p,m]=Q.useState(``),h=n??(typeof window<`u`?window.location.origin:``),g=Q.useCallback(()=>{let n=Mn(),i=Nn(h,e,t,n);o(i),c(!1);let a=p?new Date(Date.now()+parseInt(p,10)*864e5).toISOString():void 0;r?.(i,{password:d||void 0,expiresAt:a})},[h,e,t,r,d,p]),v=Q.useCallback(async()=>{if(a)try{await navigator.clipboard.writeText(a),c(!0),setTimeout(()=>c(!1),2e3)}catch{let e=document.createElement(`textarea`);e.value=a,document.body.appendChild(e),e.select(),document.execCommand(`copy`),document.body.removeChild(e),c(!0),setTimeout(()=>c(!1),2e3)}},[a]);return(0,$.jsxs)(_,{open:l,onOpenChange:u,children:[(0,$.jsx)(_e,{asChild:!0,children:(0,$.jsxs)(W,{variant:`outline`,size:`sm`,className:H(`gap-2`,i),children:[(0,$.jsx)(yt,{className:`h-4 w-4`}),`Share`]})}),(0,$.jsxs)(b,{className:`w-96 space-y-4`,align:`end`,children:[(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`h4`,{className:`text-sm font-medium`,children:`Share View`}),(0,$.jsx)(z,{variant:`secondary`,className:`text-xs`,children:`Read-only`})]}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Generate a public link to share this view. Recipients can view data without logging in.`})]}),a?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(y,{value:a,readOnly:!0,className:`h-8 text-xs`,onClick:e=>e.target.select()}),(0,$.jsx)(W,{variant:`outline`,size:`sm`,onClick:v,className:`shrink-0 gap-1`,children:s?(0,$.jsx)(Ye,{className:`h-4 w-4 text-green-500`}):(0,$.jsx)(X,{className:`h-4 w-4`})})]}),(d||p)&&(0,$.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[d&&(0,$.jsxs)(z,{variant:`outline`,className:`text-xs gap-1`,children:[(0,$.jsx)(lt,{className:`h-3 w-3`}),`Password protected`]}),p&&(0,$.jsxs)(z,{variant:`outline`,className:`text-xs gap-1`,children:[(0,$.jsx)(Ke,{className:`h-3 w-3`}),`Expires in `,p,` day`,p===`1`?``:`s`]})]})]}):(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs font-medium text-foreground`,children:[(0,$.jsx)(lt,{className:`h-3.5 w-3.5`}),`Password protection (optional)`]}),(0,$.jsx)(y,{type:`password`,value:d,onChange:e=>f(e.target.value),placeholder:`Enter password...`,className:`h-8 text-xs`})]}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs font-medium text-foreground`,children:[(0,$.jsx)(Ke,{className:`h-3.5 w-3.5`}),`Expires after (optional)`]}),(0,$.jsxs)(`select`,{value:p,onChange:e=>m(e.target.value),className:`w-full h-8 text-xs rounded-md border border-input bg-background px-3`,children:[(0,$.jsx)(`option`,{value:``,children:`Never`}),(0,$.jsx)(`option`,{value:`1`,children:`1 day`}),(0,$.jsx)(`option`,{value:`7`,children:`7 days`}),(0,$.jsx)(`option`,{value:`30`,children:`30 days`}),(0,$.jsx)(`option`,{value:`90`,children:`90 days`})]})]}),(0,$.jsxs)(W,{onClick:g,className:`w-full gap-2`,size:`sm`,children:[(0,$.jsx)(yt,{className:`h-4 w-4`}),`Generate Link`]})]})]})]})};function Fn(){let{t:e}=Ve();return(t,n,r)=>{let i=e(t,r);return!i||i===t?n:String(i)}}var In={private:0,team:1,organization:2,public:3},Ln=8,Rn=({id:e,disabled:t,children:n})=>{let{attributes:r,listeners:i,setNodeRef:a,transform:o,transition:s,isDragging:c}=At({id:e,disabled:t,attributes:{role:`tab`,roleDescription:`view tab`,tabIndex:0}}),l={transform:Lt.Transform.toString(o),transition:s,zIndex:c?10:void 0,opacity:c?.5:void 0};return(0,$.jsx)($.Fragment,{children:n({setNodeRef:a,style:l,listeners:i,attributes:r,isDragging:c})})},zn=({views:e,activeViewId:t,onViewChange:n,viewTypeIcons:r={},config:i={},onAddView:a,onRenameView:o,onDuplicateView:s,onDeleteView:c,onSetDefaultView:l,onShareView:d,onSaveAsView:f,onPinView:p,onReorderViews:g,onChangeViewType:_,onConfigView:v,onManageViews:b,availableViewTypes:x,hasUnsavedChanges:ee=!1,onResetChanges:S,className:C})=>{let{showAddButton:w=!0,inlineRename:T=!0,contextMenu:E=!0,reorderable:O=!1,maxVisibleTabs:k=4,showIndicators:ne=!0,showSaveAsView:N=!0,showPinnedSection:re=!0,showVisibilityGroups:ie=!1}=i,F=Fn(),[ae,oe]=(0,Q.useState)(null),[le,ue]=(0,Q.useState)(``),de=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{ae&&de.current&&(de.current.focus(),de.current.select())},[ae]);let fe=(0,Q.useCallback)(t=>{if(!T||!o)return;let n=e.find(e=>e.id===t);n&&(n.readonly||(oe(t),ue(n.label)))},[T,o,e]),he=(0,Q.useCallback)(()=>{ae&&le.trim()&&o&&o(ae,le.trim()),oe(null),ue(``)},[ae,le,o]),ge=(0,Q.useCallback)(()=>{oe(null),ue(``)},[]),_e=(0,Q.useMemo)(()=>e.length>0&&e.every(e=>!!e.readonly),[e]),R=(0,Q.useMemo)(()=>{let t=[...e];return t.sort((e,t)=>{if(re){let n=+!!e.isPinned,r=+!!t.isPinned;if(n!==r)return r-n}if(ie){let n=In[e.visibility||`public`]??In.public,r=In[t.visibility||`public`]??In.public;if(n!==r)return n-r}return 0}),t},[e,re,ie]),{visibleViews:z,overflowViews:B}=(0,Q.useMemo)(()=>{let e=R.slice(0,k),n=R.slice(k),r=n.findIndex(e=>e.id===t);if(r===-1)return{visibleViews:e,overflowViews:n};let i=n[r],a=e.length>0?[...e.slice(0,-1),i]:[i],o=e.length>0?e[e.length-1]:null,s=n.filter((e,t)=>t!==r);return o&&s.unshift(o),{visibleViews:a,overflowViews:s}},[R,k,t]),ye=It(Tt(Ot,{activationConstraint:{distance:Ln}}),Tt(Ft)),Se=(0,Q.useCallback)(e=>{let{active:t,over:n}=e;if(!n||t.id===n.id||!g)return;let r=R.findIndex(e=>e.id===t.id),i=R.findIndex(e=>e.id===n.id);r!==-1&&i!==-1&&g(kt(R,r,i).map(e=>e.id))},[R,g]),Ce=xt,G=(0,Q.useCallback)(e=>{if(!ie||e===0)return!1;let t=z[e-1],n=z[e],r=e=>e.visibility===`private`;return r(t)&&!r(n)},[ie,z]),we=(e,i)=>{let a=e.id===t,f=r[e.type]||Ce,h=ae===e.id,ee=ne&&(e.hasActiveFilters||e.hasActiveSort),S=G(i),C=!!e.readonly,w=C?void 0:v,T=o&&!C?fe:void 0,k=s,N=d,oe=C?void 0:l,R=C?void 0:p,z=!C&&_&&x&&x.length>0?{run:_,types:x}:void 0,B=C?void 0:c,ye=b,W=!!(T||k||N||oe||R),Se=!!w||W||!!z,we=Se||!!B,Te=we||!!ye,Ee=W||!!z,K=Ee||!!B,De=K||!!ye,q=(e=>ie?e.visibility===`private`?(0,$.jsx)(lt,{"data-testid":`view-tab-visibility-${e.id}`,className:`h-3 w-3 text-muted-foreground shrink-0`}):e.visibility?(0,$.jsx)(et,{"data-testid":`view-tab-visibility-${e.id}`,className:`h-3 w-3 text-muted-foreground shrink-0`}):null:null)(e),Oe=t=>(0,$.jsxs)(`div`,{"data-testid":`view-tab-${e.id}`,role:`tab`,tabIndex:0,"aria-selected":a,onClick:()=>!h&&n(e.id),onDoubleClick:()=>fe(e.id),onKeyDown:t=>{!h&&(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),n(e.id))},...t?.listeners??{},...t?.attributes??{},className:H(`group/tab inline-flex items-center gap-1.5 px-3 py-2 text-sm font-medium border-b-2 transition-colors whitespace-nowrap relative outline-none focus-visible:ring-2 focus-visible:ring-ring`,t?.isDragging?`cursor-grabbing`:`cursor-pointer`,a?`border-primary text-primary`:`border-transparent text-muted-foreground hover:text-foreground hover:border-border`),children:[O&&g&&(0,$.jsx)(`span`,{"data-testid":`view-tab-drag-handle-${e.id}`,"aria-hidden":`true`,className:H(`text-muted-foreground transition-opacity pointer-events-none`,`opacity-0 group-hover/tab:opacity-100`,t?.isDragging&&`opacity-100`),children:(0,$.jsx)(nt,{className:`h-3 w-3`})}),re&&e.isPinned&&(0,$.jsx)(pt,{"data-testid":`view-tab-pin-indicator-${e.id}`,className:`h-3 w-3 text-primary shrink-0`}),q,(0,$.jsx)(f,{className:`h-3.5 w-3.5`}),h?(0,$.jsx)(y,{ref:de,"data-testid":`view-tab-rename-input-${e.id}`,value:le,onChange:e=>ue(e.target.value),onBlur:he,onKeyDown:e=>{e.key===`Enter`&&he(),e.key===`Escape`&&ge()},className:`h-5 w-24 px-1 py-0 text-sm border-none focus-visible:ring-1`,onClick:e=>e.stopPropagation()}):(0,$.jsx)(`span`,{children:e.label}),C&&!_e&&(0,$.jsxs)(V,{children:[(0,$.jsx)(m,{asChild:!0,children:(0,$.jsx)(lt,{"data-testid":`view-tab-readonly-${e.id}`,"aria-label":F(`view.readonlyAriaLabel`,`Read-only view`),className:`h-3 w-3 text-muted-foreground shrink-0`})}),(0,$.jsx)(D,{side:`bottom`,className:`text-xs`,children:e.readonlyReason||F(`view.readonlyTooltip`,`System view — defined in code, read-only.`)})]}),ee&&(0,$.jsxs)(V,{children:[(0,$.jsx)(m,{asChild:!0,children:(0,$.jsxs)(`span`,{"data-testid":`view-tab-indicator-${e.id}`,className:`ml-1 inline-flex items-center gap-0.5 h-4 px-1 rounded-full bg-primary/10 text-primary shrink-0`,children:[e.hasActiveFilters&&(0,$.jsx)($e,{className:`h-2.5 w-2.5`}),e.hasActiveSort&&(0,$.jsx)(Y,{className:`h-2.5 w-2.5`})]})}),(0,$.jsx)(D,{side:`bottom`,className:`text-xs`,children:[e.hasActiveFilters&&`Active filters`,e.hasActiveSort&&`Active sort`].filter(Boolean).join(`, `)})]}),e.isDefault&&(0,$.jsx)(Z,{className:`h-3 w-3 text-amber-500 fill-amber-500 shrink-0`}),a&&Te&&(0,$.jsxs)(u,{children:[(0,$.jsx)(M,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,"data-testid":`view-tab-actions-${e.id}`,className:`ml-0.5 h-4 w-4 flex items-center justify-center rounded hover:bg-accent shrink-0 opacity-70 hover:opacity-100 transition-opacity`,onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),"aria-label":F(`view.tabActionsFor`,`View actions for ${e.label}`,{name:e.label}),children:(0,$.jsx)(Xe,{className:`h-3 w-3`})})}),(0,$.jsxs)(P,{align:`start`,className:`min-w-[180px]`,onClick:e=>e.stopPropagation(),children:[w&&(0,$.jsxs)(L,{"data-testid":`view-tab-menu-config-${e.id}`,onClick:()=>w(e.id),children:[(0,$.jsx)(_t,{className:`h-4 w-4 mr-2`}),` `,F(`view.editViewConfig`,`Edit view config`)]}),T&&(0,$.jsxs)(L,{"data-testid":`view-tab-menu-rename-${e.id}`,onClick:()=>T(e.id),children:[(0,$.jsx)(dt,{className:`h-4 w-4 mr-2`}),` `,F(`view.rename`,`Rename`)]}),k&&(0,$.jsxs)(L,{"data-testid":`view-tab-menu-duplicate-${e.id}`,onClick:()=>k(e.id),children:[(0,$.jsx)(X,{className:`h-4 w-4 mr-2`}),` `,F(`view.duplicateView`,`Duplicate view`)]}),N&&(0,$.jsxs)(L,{"data-testid":`view-tab-menu-share-${e.id}`,onClick:()=>N(e.id),children:[(0,$.jsx)(yt,{className:`h-4 w-4 mr-2`}),` `,F(`view.shareView`,`Share view`)]}),oe&&(0,$.jsxs)(L,{"data-testid":`view-tab-menu-default-${e.id}`,onClick:()=>oe(e.id),children:[(0,$.jsx)(Z,{className:`h-4 w-4 mr-2`}),` `,F(`view.setAsDefault`,`Set as default`)]}),R&&(0,$.jsx)(L,{"data-testid":`view-tab-menu-pin-${e.id}`,onClick:()=>R(e.id,!e.isPinned),children:e.isPinned?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ft,{className:`h-4 w-4 mr-2`}),` `,F(`view.unpinView`,`Unpin view`)]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(pt,{className:`h-4 w-4 mr-2`}),` `,F(`view.pinView`,`Pin view`)]})}),z&&(0,$.jsxs)(te,{children:[(0,$.jsxs)(ve,{"data-testid":`view-tab-menu-change-type-${e.id}`,children:[(0,$.jsx)(it,{className:`h-4 w-4 mr-2`}),` `,F(`view.changeViewType`,`Change view type`)]}),(0,$.jsx)(me,{children:z.types.map(t=>{let n=r[t.type]||Ce;return(0,$.jsxs)(L,{"data-testid":`view-tab-menu-type-${e.id}-${t.type}`,disabled:t.type===e.type,onClick:()=>z.run(e.id,t.type),children:[(0,$.jsx)(n,{className:`h-4 w-4 mr-2`}),(0,$.jsx)(`span`,{children:t.label})]},t.type)})})]}),B&&(0,$.jsxs)($.Fragment,{children:[Se&&(0,$.jsx)(ce,{}),(0,$.jsxs)(L,{"data-testid":`view-tab-menu-delete-${e.id}`,onClick:()=>B(e.id),className:`text-destructive focus:text-destructive`,children:[(0,$.jsx)(St,{className:`h-4 w-4 mr-2`}),` `,F(`view.deleteView`,`Delete view`)]})]}),ye&&(0,$.jsxs)($.Fragment,{children:[we&&(0,$.jsx)(ce,{}),(0,$.jsxs)(L,{"data-testid":`view-tab-menu-manage-${e.id}`,onClick:ye,children:[(0,$.jsx)(ot,{className:`h-4 w-4 mr-2`}),` `,F(`view.manageAllViews`,`Manage all views…`)]})]})]})]})]}),J=t=>!E||h||!De?t:(0,$.jsxs)(pe,{children:[(0,$.jsx)(U,{asChild:!0,children:t}),(0,$.jsxs)(se,{children:[T&&(0,$.jsxs)(I,{"data-testid":`context-menu-rename-${e.id}`,onClick:()=>T(e.id),children:[(0,$.jsx)(dt,{className:`h-4 w-4 mr-2`}),` `,F(`view.rename`,`Rename`)]}),k&&(0,$.jsxs)(I,{"data-testid":`context-menu-duplicate-${e.id}`,onClick:()=>k(e.id),children:[(0,$.jsx)(X,{className:`h-4 w-4 mr-2`}),` `,F(`view.duplicateView`,`Duplicate view`)]}),N&&(0,$.jsxs)(I,{"data-testid":`context-menu-share-${e.id}`,onClick:()=>N(e.id),children:[(0,$.jsx)(yt,{className:`h-4 w-4 mr-2`}),` `,F(`view.shareView`,`Share view`)]}),oe&&(0,$.jsxs)(I,{"data-testid":`context-menu-default-${e.id}`,onClick:()=>oe(e.id),children:[(0,$.jsx)(Z,{className:`h-4 w-4 mr-2`}),` `,F(`view.setAsDefault`,`Set as default`)]}),R&&(0,$.jsx)(I,{"data-testid":`context-menu-pin-${e.id}`,onClick:()=>R(e.id,!e.isPinned),children:e.isPinned?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ft,{className:`h-4 w-4 mr-2`}),` `,F(`view.unpinView`,`Unpin view`)]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(pt,{className:`h-4 w-4 mr-2`}),` `,F(`view.pinView`,`Pin view`)]})}),z&&(0,$.jsxs)($.Fragment,{children:[W&&(0,$.jsx)(A,{}),(0,$.jsxs)(be,{children:[(0,$.jsxs)(j,{"data-testid":`context-menu-change-type-${e.id}`,children:[(0,$.jsx)(it,{className:`h-4 w-4 mr-2`}),` `,F(`view.changeViewType`,`Change view type`)]}),(0,$.jsx)(xe,{"data-testid":`context-menu-type-submenu-${e.id}`,children:z.types.map(t=>{let n=r[t.type]||Ce;return(0,$.jsxs)(I,{"data-testid":`context-menu-type-${e.id}-${t.type}`,disabled:t.type===e.type,onClick:()=>z.run(e.id,t.type),children:[(0,$.jsx)(n,{className:`h-4 w-4 mr-2`}),(0,$.jsxs)(`div`,{className:`flex flex-col`,children:[(0,$.jsx)(`span`,{children:t.label}),t.description&&(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t.description})]})]},t.type)})})]})]}),B&&(0,$.jsxs)($.Fragment,{children:[Ee&&(0,$.jsx)(A,{}),(0,$.jsxs)(I,{"data-testid":`context-menu-delete-${e.id}`,onClick:()=>B(e.id),className:`text-destructive focus:text-destructive`,children:[(0,$.jsx)(St,{className:`h-4 w-4 mr-2`}),` `,F(`view.deleteView`,`Delete view`)]})]}),ye&&(0,$.jsxs)($.Fragment,{children:[K&&(0,$.jsx)(A,{}),(0,$.jsxs)(I,{"data-testid":`context-menu-manage-${e.id}`,onClick:ye,children:[(0,$.jsx)(ot,{className:`h-4 w-4 mr-2`}),` `,F(`view.manageAllViews`,`Manage all views…`)]})]})]})]});return O&&g?(0,$.jsxs)(Q.Fragment,{children:[S&&(0,$.jsx)(`div`,{"data-testid":`view-tab-visibility-separator`,className:`w-px h-5 bg-border mx-1 self-center shrink-0`}),(0,$.jsx)(Rn,{id:e.id,children:({setNodeRef:e,style:t,listeners:n,attributes:r,isDragging:i})=>(0,$.jsx)(`div`,{ref:e,style:t,className:H(`flex`,i&&`z-10`),children:J(Oe({listeners:n,attributes:r,isDragging:i}))})})]},e.id):(0,$.jsxs)(Q.Fragment,{children:[S&&(0,$.jsx)(`div`,{"data-testid":`view-tab-visibility-separator`,className:`w-px h-5 bg-border mx-1 self-center shrink-0`}),J(Oe())]},e.id)},Te=(0,$.jsx)($.Fragment,{children:z.map((e,t)=>we(e,t))});return(0,$.jsx)(h,{children:(0,$.jsxs)(`div`,{"data-testid":`view-tab-bar`,className:H(`flex items-center gap-0.5 -mb-px`,C),children:[O&&g?(0,$.jsx)(Dt,{sensors:ye,collisionDetection:jt,onDragEnd:Se,children:(0,$.jsx)(Pt,{items:z.map(e=>e.id),strategy:Mt,children:(0,$.jsx)(`div`,{"data-testid":`view-tab-sortable-container`,className:`flex items-center gap-0.5`,children:Te})})}):Te,B.length>0&&(0,$.jsxs)(u,{children:[(0,$.jsx)(M,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,"data-testid":`view-tab-overflow`,className:`inline-flex items-center gap-1 px-2 py-2 text-sm text-muted-foreground hover:text-foreground transition-colors`,children:[(0,$.jsx)(Ze,{className:`h-4 w-4`}),(0,$.jsx)(`span`,{className:`text-xs`,children:F(`view.moreViews`,`${B.length} more`,{count:B.length})})]})}),(0,$.jsxs)(P,{align:`end`,children:[b&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(L,{"data-testid":`view-tab-overflow-manage`,onClick:b,className:`font-medium`,children:[(0,$.jsx)(ot,{className:`h-4 w-4 mr-2`}),` `,F(`view.manageAllViews`,`Manage all views…`)]}),(0,$.jsx)(ce,{})]}),B.map(e=>{let t=r[e.type]||Ce;return(0,$.jsxs)(L,{"data-testid":`view-tab-overflow-${e.id}`,onClick:()=>n(e.id),children:[e.isPinned&&(0,$.jsx)(pt,{className:`h-3 w-3 mr-1 text-primary shrink-0`}),(0,$.jsx)(t,{className:`h-4 w-4 mr-2`}),e.label,ne&&(e.hasActiveFilters||e.hasActiveSort)&&(0,$.jsxs)(`span`,{className:`ml-auto inline-flex items-center gap-0.5 h-4 px-1 rounded-full bg-primary/10 text-primary`,children:[e.hasActiveFilters&&(0,$.jsx)($e,{className:`h-2.5 w-2.5`}),e.hasActiveSort&&(0,$.jsx)(Y,{className:`h-2.5 w-2.5`})]})]},e.id)})]})]}),w&&a&&(0,$.jsxs)(V,{children:[(0,$.jsx)(m,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,"data-testid":`view-tab-add`,onClick:a,className:`inline-flex items-center px-2 py-2 text-muted-foreground hover:text-foreground transition-colors`,children:(0,$.jsx)(mt,{className:`h-4 w-4`})})}),(0,$.jsx)(D,{children:`Add View`})]}),N&&ee&&(0,$.jsxs)(`div`,{"data-testid":`view-tab-save-as`,className:`flex items-center gap-1 ml-2 text-xs text-amber-600 dark:text-amber-400`,children:[(0,$.jsx)(ht,{className:`h-3.5 w-3.5`}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:`Unsaved changes`}),f&&(0,$.jsx)(W,{variant:`ghost`,size:`sm`,"data-testid":`view-tab-save-as-btn`,className:`h-6 px-2 text-xs`,onClick:f,children:`Save as View`}),S&&(0,$.jsx)(W,{variant:`ghost`,size:`sm`,"data-testid":`view-tab-reset-btn`,className:`h-6 px-2 text-xs`,onClick:S,children:`Reset`})]})]})})};function Bn(){let{t:e}=Ve();return(t,n,r)=>{let i=e(t,r);return!i||i===t?n:String(i)}}var Vn=xt,Hn=({view:e,isActive:t,Icon:n,isRenaming:r,onStartRename:i,onCommitRename:a,onCancelRename:o,onRowClick:s,onDelete:c,onDuplicate:l,onSetDefault:d,onSetPinned:f,onConfigView:p})=>{let g=Bn(),{attributes:_,listeners:v,setNodeRef:b,transform:x,transition:ee,isDragging:S}=At({id:e.id}),C={transform:Lt.Transform.toString(x),transition:ee,opacity:S?.5:1},w=(0,Q.useRef)(null),[T,E]=(0,Q.useState)(e.label),O=!!e.readonly,k=O?void 0:i,A=l,te=O?void 0:p,j=O||e.isDefault?void 0:d,ne=O?void 0:f,N=O?void 0:c,re=!!(k||A||te||j||ne),ie=re||!!N;(0,Q.useEffect)(()=>{r&&(E(e.label),requestAnimationFrame(()=>{w.current?.focus(),w.current?.select()}))},[r,e.label]);let F=(0,Q.useCallback)(()=>{let t=T.trim();t&&t!==e.label?a(e.id,t):o()},[T,e.id,e.label,a,o]);return(0,$.jsxs)(`li`,{ref:b,style:C,"data-testid":`manage-views-row-${e.id}`,className:H(`group/row flex items-center gap-2 px-2 py-2 rounded-md border border-transparent`,`hover:bg-accent/50 transition-colors`,t&&`bg-accent/40 border-border`,S&&`shadow-md bg-background border-border z-10`),children:[(0,$.jsx)(`button`,{type:`button`,..._,...v,"aria-label":g(`view.dragToReorder`,`Drag to reorder`),"data-testid":`manage-views-drag-${e.id}`,className:`shrink-0 h-6 w-5 flex items-center justify-center text-muted-foreground/40 hover:text-muted-foreground cursor-grab active:cursor-grabbing rounded hover:bg-accent`,onClick:e=>e.stopPropagation(),children:(0,$.jsx)(nt,{className:`h-4 w-4`})}),(0,$.jsx)(n,{className:`shrink-0 h-4 w-4 text-muted-foreground`}),(0,$.jsx)(`div`,{className:`flex-1 min-w-0`,onClick:()=>{r||s?.(e.id)},children:r?(0,$.jsx)(y,{ref:w,value:T,onChange:e=>E(e.target.value),onBlur:F,onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),F()):e.key===`Escape`&&(e.preventDefault(),o())},onClick:e=>e.stopPropagation(),className:`h-7 text-sm`,"data-testid":`manage-views-rename-input-${e.id}`}):(0,$.jsxs)(`button`,{type:`button`,className:`w-full text-left text-sm font-medium truncate cursor-pointer flex items-center gap-1.5`,onDoubleClick:t=>{t.stopPropagation(),k?.(e.id)},title:e.label,children:[(0,$.jsx)(`span`,{className:`truncate`,children:e.label}),O&&(0,$.jsx)(lt,{"aria-label":g(`view.readonlyAriaLabel`,`Read-only view`),"data-testid":`manage-views-readonly-${e.id}`,className:`h-3 w-3 text-muted-foreground shrink-0`}),e.isDefault&&(0,$.jsxs)(`span`,{className:`ml-1 inline-flex items-center text-[10px] uppercase tracking-wide text-muted-foreground`,title:g(`view.defaultView`,`Default view`),children:[(0,$.jsx)(Z,{className:`h-3 w-3 mr-0.5 fill-current`}),` `,g(`view.defaultBadge`,`default`)]})]})}),f&&!r&&!O&&(0,$.jsx)(h,{delayDuration:300,children:(0,$.jsxs)(V,{children:[(0,$.jsx)(m,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,"aria-label":e.isPinned?g(`view.unpinView`,`Unpin View`):g(`view.pinView`,`Pin View`),"data-testid":`manage-views-pin-${e.id}`,onClick:t=>{t.stopPropagation(),f(e.id,!e.isPinned)},className:H(`shrink-0 h-7 w-7 inline-flex items-center justify-center rounded hover:bg-accent transition-colors`,e.isPinned?`text-amber-500`:`text-muted-foreground/40 opacity-0 group-hover/row:opacity-100`),children:e.isPinned?(0,$.jsx)(pt,{className:`h-4 w-4 fill-current`}):(0,$.jsx)(pt,{className:`h-4 w-4`})})}),(0,$.jsx)(D,{side:`top`,children:e.isPinned?g(`view.unpinView`,`Unpin View`):g(`view.pinView`,`Pin View`)})]})}),d&&!r&&!e.isDefault&&!O&&(0,$.jsx)(h,{delayDuration:300,children:(0,$.jsxs)(V,{children:[(0,$.jsx)(m,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,"aria-label":g(`view.setAsDefault`,`Set as Default`),"data-testid":`manage-views-default-${e.id}`,onClick:t=>{t.stopPropagation(),d(e.id)},className:`shrink-0 h-7 w-7 inline-flex items-center justify-center rounded hover:bg-accent text-muted-foreground/40 hover:text-foreground opacity-0 group-hover/row:opacity-100 transition-colors`,children:(0,$.jsx)(Z,{className:`h-4 w-4`})})}),(0,$.jsx)(D,{side:`top`,children:g(`view.setAsDefault`,`Set as Default`)})]})}),!r&&ie&&(0,$.jsxs)(u,{children:[(0,$.jsx)(M,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,"aria-label":g(`view.tabActionsFor`,`View actions for ${e.label}`,{name:e.label}),"data-testid":`manage-views-actions-${e.id}`,onClick:e=>e.stopPropagation(),className:`shrink-0 h-7 w-7 inline-flex items-center justify-center rounded hover:bg-accent text-muted-foreground opacity-60 group-hover/row:opacity-100 transition-opacity`,children:(0,$.jsx)(Ze,{className:`h-4 w-4`})})}),(0,$.jsxs)(P,{align:`end`,className:`min-w-[180px]`,children:[k&&(0,$.jsxs)(L,{"data-testid":`manage-views-action-rename-${e.id}`,onClick:()=>k(e.id),children:[(0,$.jsx)(dt,{className:`h-4 w-4 mr-2`}),` `,g(`view.rename`,`Rename`)]}),A&&(0,$.jsxs)(L,{"data-testid":`manage-views-action-duplicate-${e.id}`,onClick:()=>A(e.id),children:[(0,$.jsx)(X,{className:`h-4 w-4 mr-2`}),` `,g(`view.duplicateView`,`Duplicate View`)]}),te&&(0,$.jsxs)(L,{"data-testid":`manage-views-action-config-${e.id}`,onClick:()=>te(e.id),children:[(0,$.jsx)(dt,{className:`h-4 w-4 mr-2`}),` `,g(`view.editViewConfig`,`Edit view config`)]}),j&&(0,$.jsxs)(L,{"data-testid":`manage-views-action-default-${e.id}`,onClick:()=>j(e.id),children:[(0,$.jsx)(Z,{className:`h-4 w-4 mr-2`}),` `,g(`view.setAsDefault`,`Set as Default`)]}),ne&&(0,$.jsx)(L,{"data-testid":`manage-views-action-pin-${e.id}`,onClick:()=>ne(e.id,!e.isPinned),children:e.isPinned?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ft,{className:`h-4 w-4 mr-2`}),` `,g(`view.unpinView`,`Unpin View`)]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(pt,{className:`h-4 w-4 mr-2`}),` `,g(`view.pinView`,`Pin View`)]})}),N&&(0,$.jsxs)($.Fragment,{children:[re&&(0,$.jsx)(ce,{}),(0,$.jsxs)(L,{"data-testid":`manage-views-action-delete-${e.id}`,onClick:()=>N(e.id),className:`text-destructive focus:text-destructive`,children:[(0,$.jsx)(St,{className:`h-4 w-4 mr-2`}),` `,g(`view.deleteView`,`Delete View`)]})]})]})]}),r&&(0,$.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,$.jsx)(`button`,{type:`button`,"aria-label":g(`common.save`,`Save`),onMouseDown:e=>e.preventDefault(),onClick:F,className:`h-7 w-7 inline-flex items-center justify-center rounded hover:bg-accent text-emerald-600`,children:(0,$.jsx)(Ye,{className:`h-4 w-4`})}),(0,$.jsx)(`button`,{type:`button`,"aria-label":g(`common.cancel`,`Cancel`),onMouseDown:e=>e.preventDefault(),onClick:o,className:`h-7 w-7 inline-flex items-center justify-center rounded hover:bg-accent text-muted-foreground`,children:(0,$.jsx)(Ct,{className:`h-4 w-4`})})]})]})},Un=({open:e,onOpenChange:t,views:n,activeViewId:r,viewTypeIcons:i={},onRename:a,onDelete:o,onDuplicate:s,onSetDefault:c,onSetPinned:l,onReorder:u,onAddView:d,onConfigView:p})=>{let m=Bn(),[h,_]=(0,Q.useState)(``),[v,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(()=>n.map(e=>e.id));(0,Q.useEffect)(()=>{S(n.map(e=>e.id))},[n]),(0,Q.useEffect)(()=>{e||(b(null),_(``))},[e]);let T=(0,Q.useMemo)(()=>{let e=new Map(n.map(e=>[e.id,e]));return x.map(t=>e.get(t)).filter(Boolean)},[x,n]),E=(0,Q.useMemo)(()=>{if(!h.trim())return T;let e=h.toLowerCase();return T.filter(t=>t.label.toLowerCase().includes(e))},[T,h]),D=It(Tt(Ot,{activationConstraint:{distance:5}}),Tt(Ft,{coordinateGetter:Et})),O=e=>{let{active:t,over:n}=e;if(!n||t.id===n.id)return;let r=x.indexOf(String(t.id)),i=x.indexOf(String(n.id));if(r<0||i<0)return;let a=kt(x,r,i);S(a),u?.(a)},k=e=>{t(!1),requestAnimationFrame(()=>p?.(e))};return(0,$.jsx)(f,{open:e,onOpenChange:t,children:(0,$.jsxs)(le,{className:`sm:max-w-[560px] p-0 gap-0 overflow-hidden`,"data-testid":`manage-views-dialog`,children:[(0,$.jsxs)(w,{className:`px-5 pt-5 pb-3`,children:[(0,$.jsx)(g,{className:`text-base`,children:m(`view.manageViews`,`Manage views`)}),(0,$.jsx)(ee,{className:`text-xs`,children:m(`view.manageViewsDescription`,`Reorder, rename, pin, or delete every view in this object.`)})]}),(0,$.jsx)(`div`,{className:`px-5 pb-3`,children:(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(gt,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none`}),(0,$.jsx)(y,{value:h,onChange:e=>_(e.target.value),placeholder:m(`view.searchViews`,`Search views`),className:`pl-8 h-9`,"data-testid":`manage-views-search`})]})}),(0,$.jsx)(`div`,{className:`px-3 pb-3 max-h-[55vh] overflow-y-auto`,"data-testid":`manage-views-list`,children:E.length===0?(0,$.jsx)(`div`,{className:`text-center text-sm text-muted-foreground py-10`,children:m(`view.noViewsFound`,`No views match your search.`)}):(0,$.jsx)(Dt,{sensors:D,collisionDetection:jt,onDragEnd:O,children:(0,$.jsx)(Pt,{items:E.map(e=>e.id),strategy:Nt,children:(0,$.jsx)(`ul`,{className:`space-y-0.5`,children:E.map(e=>{let t=i[e.type]||Vn;return(0,$.jsx)(Hn,{view:e,Icon:t,isActive:e.id===r,isRenaming:v===e.id,onStartRename:a?e=>b(e):void 0,onCancelRename:()=>b(null),onCommitRename:(e,t)=>{b(null),a?.(e,t)},onDelete:o,onDuplicate:s,onSetDefault:c,onSetPinned:l,onConfigView:p?k:void 0},e.id)})})})})}),(0,$.jsxs)(C,{className:`border-t bg-muted/30 px-5 py-3 flex sm:justify-between gap-2`,children:[d?(0,$.jsxs)(W,{variant:`ghost`,size:`sm`,onClick:()=>{t(!1),requestAnimationFrame(()=>d())},"data-testid":`manage-views-add`,className:`text-sm`,children:[(0,$.jsx)(mt,{className:`h-4 w-4 mr-1.5`}),` `,m(`view.addNewView`,`Add new view`)]}):(0,$.jsx)(`span`,{}),(0,$.jsx)(W,{size:`sm`,onClick:()=>t(!1),"data-testid":`manage-views-done`,children:m(`view.done`,`Done`)})]})]})})},Wn=e=>e.toLowerCase().replace(/[\s_-]+/g,``);new Map([...i.map(e=>[Wn(e),e]),...Object.entries(s).map(([e,t])=>[Wn(e),t])]);function Gn(e){let t=(e||``).toLowerCase();return we(t)?(Ie(t),`text`):[`integer`,`int`,`float`,`double`,`number`,`currency`,`money`,`percent`,`rating`].includes(t)?`number`:[`date`,`datetime`,`datetime_tz`,`timestamp`,`time`].includes(t)?`date`:[`boolean`,`bool`,`checkbox`,`switch`].includes(t)?`boolean`:[`select`,`picklist`,`single_select`,`multi_select`,`enum`,`status`,`lookup`,`master_detail`,`user`].includes(t)?`select`:`text`}function Kn(e){return e.fields?Object.entries(e.fields).filter(([e,t])=>!(e.startsWith(`_`)||t?.hidden)).map(([e,t])=>({value:e,label:t.label||e,type:Gn(t.type),options:t.options,rawType:t.type,rawName:e})):[]}var qn=new Set([`image`,`image_url`,`photo`,`picture`,`avatar`,`file`,`attachment`,`attachments`,`media`,`url`,`link`]),Jn=[`image`,`photo`,`picture`,`avatar`,`thumbnail`,`thumb`,`logo`,`cover`,`banner`,`icon`,`attachment`];function Yn(e){if(!e)return!1;let t=(e.rawType||e.type||``).toLowerCase();if(qn.has(t))return!0;let n=(e.rawName||e.name||e.key||e.value||``).toLowerCase();return n?Jn.some(e=>n.includes(e)):!1}var Xn=new Set([`geolocation`,`geo`,`geo_point`,`geopoint`,`location`,`latlng`,`lnglat`]);function Zn(e,t){if(!e)return!1;let n=(e.rawType||e.type||``).toLowerCase();if(Xn.has(n))return!0;let r=(e.rawName||e.name||e.key||e.value||``).toLowerCase();return r?t===`latitude`?/(^|[_-])lat([^a-z]|itude)?($|[_-])/.test(r)||r===`lat`:/(^|[_-])(lng|lon|long)([^a-z]|gitude)?($|[_-])/.test(r)||r===`lng`||r===`lon`:!1}function Qn(e,t){if(e.length!==0){for(let n of t){let t=e.find(e=>e.value.toLowerCase().includes(n));if(t)return t.value}return e[0]?.value}}var $n=[`status`,`stage`,`state`,`priority`,`category`,`type`],er=[`start_date`,`startdate`,`due_date`,`duedate`,`event_date`,`date`,`created_at`,`createdat`,`created`],tr=[`end_date`,`enddate`,`finish_date`,`completion_date`,`closed_at`],nr=({schema:e})=>{let t=(0,Q.useContext)(Ee)?.dataSource??null;return(0,$.jsx)(Sn,{schema:e,dataSource:t})};q.register(`object-view`,nr,{namespace:`plugin-view`,label:`Object View`,category:`view`,icon:`LayoutDashboard`,inputs:[{name:`objectName`,type:`string`,required:!0},{name:`title`,type:`string`},{name:`description`,type:`string`},{name:`layout`,type:`enum`,enum:[`drawer`,`modal`,`page`]},{name:`defaultViewType`,type:`enum`,enum:[`grid`,`kanban`,`gallery`,`calendar`,`timeline`,`gantt`,`map`]},{name:`defaultListView`,type:`string`},{name:`showSearch`,type:`boolean`},{name:`showFilters`,type:`boolean`},{name:`showCreate`,type:`boolean`},{name:`showViewSwitcher`,type:`boolean`},{name:`listViews`,type:`object`},{name:`navigation`,type:`object`},{name:`searchableFields`,type:`array`},{name:`filterableFields`,type:`array`}],defaultProps:{layout:`drawer`,defaultViewType:`grid`,showSearch:!0,showFilters:!0,showCreate:!0,showViewSwitcher:!0}}),q.register(`view`,nr,{namespace:`plugin-view`,label:`View`,category:`view`}),q.register(`view-switcher`,Zt,{namespace:`view`,label:`View Switcher`,category:`view`,icon:`LayoutGrid`,inputs:[{name:`views`,type:`array`,required:!0},{name:`defaultView`,type:`string`},{name:`activeView`,type:`string`},{name:`variant`,type:`enum`,enum:[`tabs`,`buttons`,`dropdown`]},{name:`position`,type:`enum`,enum:[`top`,`bottom`,`left`,`right`]},{name:`persistPreference`,type:`boolean`},{name:`storageKey`,type:`string`},{name:`onViewChange`,type:`string`}],defaultProps:{variant:`tabs`,position:`top`,defaultView:`grid`,views:[{type:`grid`,label:`Grid`,schema:{type:`text`,content:`Grid view`}},{type:`list`,label:`List`,schema:{type:`text`,content:`List view`}}]}}),q.register(`filter-ui`,En,{namespace:`view`,label:`Filter UI`,category:`view`,icon:`SlidersHorizontal`,inputs:[{name:`filters`,type:`array`,required:!0},{name:`values`,type:`object`},{name:`onChange`,type:`string`},{name:`showClear`,type:`boolean`},{name:`showApply`,type:`boolean`},{name:`layout`,type:`enum`,enum:[`inline`,`popover`,`drawer`]}],defaultProps:{layout:`inline`,showApply:!1,showClear:!0,filters:[{field:`name`,label:`Name`,type:`text`,placeholder:`Search name`},{field:`status`,label:`Status`,type:`select`,options:[{label:`Open`,value:`open`},{label:`Closed`,value:`closed`}]},{field:`created_at`,label:`Created`,type:`date`}]}}),q.register(`sort-ui`,jn,{namespace:`view`,label:`Sort UI`,category:`view`,icon:`ArrowUpDown`,inputs:[{name:`fields`,type:`array`,required:!0},{name:`sort`,type:`array`},{name:`onChange`,type:`string`},{name:`multiple`,type:`boolean`},{name:`variant`,type:`enum`,enum:[`dropdown`,`buttons`]}],defaultProps:{variant:`dropdown`,multiple:!0,fields:[{field:`name`,label:`Name`},{field:`created_at`,label:`Created At`}],sort:[{field:`name`,direction:`asc`}]}}),q.register(`shared-view-link`,Pn,{namespace:`view`,label:`Shared View Link`,category:`view`,icon:`Share2`,inputs:[{name:`objectName`,type:`string`,required:!0},{name:`viewId`,type:`string`},{name:`baseUrl`,type:`string`}],defaultProps:{objectName:`objects`,viewId:`default`}}),q.register(`view:simple`,({schema:e,className:t,children:n,dataSource:r,...i})=>{let a=e.props?.columns?{display:`grid`,gridTemplateColumns:`repeat(${e.props.columns}, 1fr)`,gap:`1rem`}:void 0;return(0,$.jsx)(`div`,{className:t,style:a,...i,children:n})},{namespace:`plugin-view`,label:`Simple View`,category:`view`});export{Zn as a,Un as c,en as d,Kn as i,zn as l,$n as n,Yn as o,er as r,Qn as s,tr as t,Sn as u};
|