@collabdt/core 0.6.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/dist/core/components/AppSidebarContent.d.ts.map +1 -1
  2. package/dist/core/components/AppSidebarContent.js +3 -2
  3. package/dist/core/components/AppSidebarContent.js.map +1 -1
  4. package/dist/core/components/authentication/AuthPage.d.ts.map +1 -1
  5. package/dist/core/components/authentication/AuthPage.js +33 -13
  6. package/dist/core/components/authentication/AuthPage.js.map +1 -1
  7. package/dist/core/components/viewers/map/MapViewer.d.ts.map +1 -1
  8. package/dist/core/components/viewers/map/MapViewer.js +4 -2
  9. package/dist/core/components/viewers/map/MapViewer.js.map +1 -1
  10. package/dist/core/components/viewers/map/src/MapLayers/index.js +1 -1
  11. package/dist/core/components/viewers/map/src/MapLayers/index.js.map +1 -1
  12. package/dist/core/components/viewers/map/src/MapLayers/src/BuildingLayers/index.d.ts +3 -1
  13. package/dist/core/components/viewers/map/src/MapLayers/src/BuildingLayers/index.d.ts.map +1 -1
  14. package/dist/core/components/viewers/map/src/MapLayers/src/BuildingLayers/index.js +27 -7
  15. package/dist/core/components/viewers/map/src/MapLayers/src/BuildingLayers/index.js.map +1 -1
  16. package/dist/core/components/viewers/map/src/MapLayers/src/CountryLayer/countryLayerUtils.d.ts +6 -0
  17. package/dist/core/components/viewers/map/src/MapLayers/src/CountryLayer/countryLayerUtils.d.ts.map +1 -1
  18. package/dist/core/components/viewers/map/src/MapLayers/src/CountryLayer/countryLayerUtils.js +10 -1
  19. package/dist/core/components/viewers/map/src/MapLayers/src/CountryLayer/countryLayerUtils.js.map +1 -1
  20. package/dist/core/components/viewers/map/src/MapLayers/src/CountryLayer/index.d.ts.map +1 -1
  21. package/dist/core/components/viewers/map/src/MapLayers/src/CountryLayer/index.js +67 -68
  22. package/dist/core/components/viewers/map/src/MapLayers/src/CountryLayer/index.js.map +1 -1
  23. package/dist/core/components/viewers/map/src/MapLayers/src/CountryLayer/useCameraSubdivision.d.ts +16 -0
  24. package/dist/core/components/viewers/map/src/MapLayers/src/CountryLayer/useCameraSubdivision.d.ts.map +1 -0
  25. package/dist/core/components/viewers/map/src/MapLayers/src/CountryLayer/useCameraSubdivision.js +44 -0
  26. package/dist/core/components/viewers/map/src/MapLayers/src/CountryLayer/useCameraSubdivision.js.map +1 -0
  27. package/dist/core/components/viewers/map/src/MapLayers/src/CountryLayer/useSubdivisionHover.d.ts +11 -0
  28. package/dist/core/components/viewers/map/src/MapLayers/src/CountryLayer/useSubdivisionHover.d.ts.map +1 -0
  29. package/dist/core/components/viewers/map/src/MapLayers/src/CountryLayer/useSubdivisionHover.js +38 -0
  30. package/dist/core/components/viewers/map/src/MapLayers/src/CountryLayer/useSubdivisionHover.js.map +1 -0
  31. package/dist/core/components/viewers/map/utils/mapStyleCatalog.d.ts +2 -1
  32. package/dist/core/components/viewers/map/utils/mapStyleCatalog.d.ts.map +1 -1
  33. package/dist/core/components/viewers/map/utils/mapStyleCatalog.js +3 -2
  34. package/dist/core/components/viewers/map/utils/mapStyleCatalog.js.map +1 -1
  35. package/dist/core/components/viewers/map/utils/mapStyleSpec.d.ts +21 -0
  36. package/dist/core/components/viewers/map/utils/mapStyleSpec.d.ts.map +1 -0
  37. package/dist/core/components/viewers/map/utils/mapStyleSpec.js +125 -0
  38. package/dist/core/components/viewers/map/utils/mapStyleSpec.js.map +1 -0
  39. package/dist/core/components/viewers/plugins/src/PluginCard.d.ts.map +1 -1
  40. package/dist/core/components/viewers/plugins/src/PluginCard.js +19 -36
  41. package/dist/core/components/viewers/plugins/src/PluginCard.js.map +1 -1
  42. package/dist/core/plugins/hello-bim/src/components/SpaceDialog.d.ts.map +1 -0
  43. package/dist/core/plugins/hello-bim/{components → src/components}/SpaceDialog.js +3 -3
  44. package/dist/core/plugins/hello-bim/src/components/SpaceDialog.js.map +1 -0
  45. package/dist/core/plugins/hello-bim/{components → src/components}/SpacesLegend.d.ts +1 -1
  46. package/dist/core/plugins/hello-bim/src/components/SpacesLegend.d.ts.map +1 -0
  47. package/dist/core/plugins/hello-bim/{components → src/components}/SpacesLegend.js +1 -1
  48. package/dist/core/plugins/hello-bim/src/components/SpacesLegend.js.map +1 -0
  49. package/dist/core/plugins/hello-bim/src/components/SpacesTab.d.ts.map +1 -0
  50. package/dist/core/plugins/hello-bim/{components → src/components}/SpacesTab.js +5 -5
  51. package/dist/core/plugins/hello-bim/src/components/SpacesTab.js.map +1 -0
  52. package/dist/core/plugins/hello-bim/{components → src/components}/SpacesTool.d.ts +1 -2
  53. package/dist/core/plugins/hello-bim/src/components/SpacesTool.d.ts.map +1 -0
  54. package/dist/core/plugins/hello-bim/{components → src/components}/SpacesTool.js +2 -2
  55. package/dist/core/plugins/hello-bim/src/components/SpacesTool.js.map +1 -0
  56. package/dist/core/plugins/hello-bim/src/components/icons.d.ts.map +1 -0
  57. package/dist/core/plugins/hello-bim/src/components/icons.js.map +1 -0
  58. package/dist/core/plugins/hello-bim/src/index.d.ts +10 -0
  59. package/dist/core/plugins/hello-bim/src/index.d.ts.map +1 -0
  60. package/dist/core/plugins/hello-bim/{index.js → src/index.js} +2 -3
  61. package/dist/core/plugins/hello-bim/src/index.js.map +1 -0
  62. package/dist/core/plugins/hello-bim/{spaces.d.ts → src/spaces.d.ts} +1 -1
  63. package/dist/core/plugins/hello-bim/src/spaces.d.ts.map +1 -0
  64. package/dist/core/plugins/hello-bim/{spaces.js → src/spaces.js} +4 -4
  65. package/dist/core/plugins/hello-bim/src/spaces.js.map +1 -0
  66. package/dist/core/plugins/hello-map/{components → src/components}/MapTool.d.ts +1 -2
  67. package/dist/core/plugins/hello-map/src/components/MapTool.d.ts.map +1 -0
  68. package/dist/core/plugins/hello-map/{components → src/components}/MapTool.js +3 -3
  69. package/dist/core/plugins/hello-map/src/components/MapTool.js.map +1 -0
  70. package/dist/core/plugins/hello-map/src/components/MarkerDialog.d.ts.map +1 -0
  71. package/dist/core/plugins/hello-map/{components → src/components}/MarkerDialog.js +2 -2
  72. package/dist/core/plugins/hello-map/src/components/MarkerDialog.js.map +1 -0
  73. package/dist/core/plugins/hello-map/{components → src/components}/MarkersLayer.d.ts +1 -1
  74. package/dist/core/plugins/hello-map/src/components/MarkersLayer.d.ts.map +1 -0
  75. package/dist/core/plugins/hello-map/{components → src/components}/MarkersLayer.js +1 -1
  76. package/dist/core/plugins/hello-map/src/components/MarkersLayer.js.map +1 -0
  77. package/dist/core/plugins/hello-map/{components → src/components}/MarkersLegend.d.ts +1 -1
  78. package/dist/core/plugins/hello-map/src/components/MarkersLegend.d.ts.map +1 -0
  79. package/dist/core/plugins/hello-map/{components → src/components}/MarkersLegend.js +1 -1
  80. package/dist/core/plugins/hello-map/src/components/MarkersLegend.js.map +1 -0
  81. package/dist/core/plugins/hello-map/{components → src/components}/MarkersPage.d.ts +1 -1
  82. package/dist/core/plugins/hello-map/src/components/MarkersPage.d.ts.map +1 -0
  83. package/dist/core/plugins/hello-map/{components → src/components}/MarkersPage.js +1 -1
  84. package/dist/core/plugins/hello-map/src/components/MarkersPage.js.map +1 -0
  85. package/dist/core/plugins/hello-map/src/components/MarkersTab.d.ts.map +1 -0
  86. package/dist/core/plugins/hello-map/{components → src/components}/MarkersTab.js +4 -4
  87. package/dist/core/plugins/hello-map/src/components/MarkersTab.js.map +1 -0
  88. package/dist/core/plugins/hello-map/src/index.d.ts +10 -0
  89. package/dist/core/plugins/hello-map/src/index.d.ts.map +1 -0
  90. package/dist/core/plugins/hello-map/{index.js → src/index.js} +2 -3
  91. package/dist/core/plugins/hello-map/src/index.js.map +1 -0
  92. package/dist/core/plugins/hello-map/src/markers.d.ts.map +1 -0
  93. package/dist/core/plugins/hello-map/{markers.js → src/markers.js} +3 -3
  94. package/dist/core/plugins/hello-map/src/markers.js.map +1 -0
  95. package/dist/core/plugins/host/context.js.map +1 -1
  96. package/dist/core/plugins/host/pluginIcon.js.map +1 -1
  97. package/dist/core/plugins/host/runtimeShims.js.map +1 -1
  98. package/dist/core/plugins/installed.js +2 -2
  99. package/dist/core/plugins/installed.js.map +1 -1
  100. package/dist/core/plugins/manifests.js.map +1 -1
  101. package/dist/core/plugins/sdk/types.d.ts +9 -4
  102. package/dist/core/plugins/sdk/types.d.ts.map +1 -1
  103. package/dist/core/plugins/sdk/types.js.map +1 -1
  104. package/package.json +2 -1
  105. package/dist/core/plugins/hello-bim/components/SpaceDialog.d.ts.map +0 -1
  106. package/dist/core/plugins/hello-bim/components/SpaceDialog.js.map +0 -1
  107. package/dist/core/plugins/hello-bim/components/SpacesLegend.d.ts.map +0 -1
  108. package/dist/core/plugins/hello-bim/components/SpacesLegend.js.map +0 -1
  109. package/dist/core/plugins/hello-bim/components/SpacesTab.d.ts.map +0 -1
  110. package/dist/core/plugins/hello-bim/components/SpacesTab.js.map +0 -1
  111. package/dist/core/plugins/hello-bim/components/SpacesTool.d.ts.map +0 -1
  112. package/dist/core/plugins/hello-bim/components/SpacesTool.js.map +0 -1
  113. package/dist/core/plugins/hello-bim/components/icons.d.ts.map +0 -1
  114. package/dist/core/plugins/hello-bim/components/icons.js.map +0 -1
  115. package/dist/core/plugins/hello-bim/index.d.ts +0 -7
  116. package/dist/core/plugins/hello-bim/index.d.ts.map +0 -1
  117. package/dist/core/plugins/hello-bim/index.js.map +0 -1
  118. package/dist/core/plugins/hello-bim/spaces.d.ts.map +0 -1
  119. package/dist/core/plugins/hello-bim/spaces.js.map +0 -1
  120. package/dist/core/plugins/hello-map/components/MapTool.d.ts.map +0 -1
  121. package/dist/core/plugins/hello-map/components/MapTool.js.map +0 -1
  122. package/dist/core/plugins/hello-map/components/MarkerDialog.d.ts.map +0 -1
  123. package/dist/core/plugins/hello-map/components/MarkerDialog.js.map +0 -1
  124. package/dist/core/plugins/hello-map/components/MarkersLayer.d.ts.map +0 -1
  125. package/dist/core/plugins/hello-map/components/MarkersLayer.js.map +0 -1
  126. package/dist/core/plugins/hello-map/components/MarkersLegend.d.ts.map +0 -1
  127. package/dist/core/plugins/hello-map/components/MarkersLegend.js.map +0 -1
  128. package/dist/core/plugins/hello-map/components/MarkersPage.d.ts.map +0 -1
  129. package/dist/core/plugins/hello-map/components/MarkersPage.js.map +0 -1
  130. package/dist/core/plugins/hello-map/components/MarkersTab.d.ts.map +0 -1
  131. package/dist/core/plugins/hello-map/components/MarkersTab.js.map +0 -1
  132. package/dist/core/plugins/hello-map/index.d.ts +0 -7
  133. package/dist/core/plugins/hello-map/index.d.ts.map +0 -1
  134. package/dist/core/plugins/hello-map/index.js.map +0 -1
  135. package/dist/core/plugins/hello-map/markers.d.ts.map +0 -1
  136. package/dist/core/plugins/hello-map/markers.js.map +0 -1
  137. /package/dist/core/plugins/hello-bim/{components → src/components}/SpaceDialog.d.ts +0 -0
  138. /package/dist/core/plugins/hello-bim/{components → src/components}/SpacesTab.d.ts +0 -0
  139. /package/dist/core/plugins/hello-bim/{components → src/components}/icons.d.ts +0 -0
  140. /package/dist/core/plugins/hello-bim/{components → src/components}/icons.js +0 -0
  141. /package/dist/core/plugins/hello-map/{components → src/components}/MarkerDialog.d.ts +0 -0
  142. /package/dist/core/plugins/hello-map/{components → src/components}/MarkersTab.d.ts +0 -0
  143. /package/dist/core/plugins/hello-map/{markers.d.ts → src/markers.d.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/core/components/viewers/map/utils/mapStyleCatalog.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport type { MapStyle } from '../../../../types/map'\r\n\r\n/**\r\n * Built-in map style catalog that is always available.\r\n * These are the default base styles available to all organizations.\r\n */\r\nexport const BUILT_IN_MAP_STYLES: MapStyle[] = [\r\n { name: 'Satellite', url: '/mapStyles/satellite.json' },\r\n// { name: 'Streets', url: '/mapStyles/streets.json' },\r\n { name: 'Dark', url: 'https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json' },\r\n { name: 'Positron', url: 'https://basemaps.cartocdn.com/gl/positron-gl-style/style.json' },\r\n { name: 'Maplibre', url: 'https://demotiles.maplibre.org/style.json' },\r\n]\r\n\r\n/**\r\n * The default/fallback map style used when no style is selected or organization config is unavailable.\r\n */\r\nexport const DEFAULT_MAP_STYLE: MapStyle = BUILT_IN_MAP_STYLES[0]; // Satellite\r\n\r\n/**\r\n * Type guard to check if a value is a valid map style object.\r\n */\r\nconst isValidMapStyle = (value: unknown): value is MapStyle => {\r\n return (\r\n value !== null\r\n && typeof value === 'object'\r\n && typeof (value as any).url === 'string'\r\n && typeof (value as any).name === 'string'\r\n )\r\n}\r\n\r\n/**\r\n * Type guard to check if a string is a valid style URL format.\r\n */\r\nconst isValidStyleUrl = (url: string): boolean => {\r\n try {\r\n new URL(url)\r\n return /\\.(json|geojson)$/i.test(url) || url.includes('://')\r\n } catch {\r\n return false\r\n }\r\n}\r\n\r\n/**\r\n * Normalizes and validates a single style entry from organization config.\r\n * Returns a valid MapStyle or null if the entry is invalid.\r\n *\r\n * @param style - Raw style data from organization config\r\n * @returns Valid MapStyle or null\r\n */\r\nfunction normalizeStyleEntry(style: unknown): MapStyle | null {\r\n if (isValidMapStyle(style)) {\r\n const url = style.url.trim()\r\n if (isValidStyleUrl(url)) {\r\n return {\r\n name: String(style.name).substring(0, 100).trim(),\r\n url,\r\n }\r\n }\r\n }\r\n\r\n // Attempt recovery: if it's just a URL string, generate a name\r\n if (typeof style === 'string') {\r\n const url = style.trim()\r\n if (isValidStyleUrl(url)) {\r\n const styleName = url.replace('.json', '').split('/').pop() || 'Custom'\r\n return {\r\n name: styleName.charAt(0).toUpperCase() + styleName.slice(1),\r\n url,\r\n }\r\n }\r\n }\r\n\r\n return null\r\n}\r\n\r\n/**\r\n * Builds the complete map styles array by merging built-in styles with validated organization styles.\r\n * Deduplicates by URL, always keeps built-ins, and appends validated org styles.\r\n *\r\n * @param organizationStyles - Raw styles from organization config (unknown[])\r\n * @returns Array of valid MapStyle objects, always includes built-in styles\r\n */\r\nexport function buildMapStylesCatalog(organizationStyles: unknown): MapStyle[] {\r\n const catalog: MapStyle[] = [...BUILT_IN_MAP_STYLES]\r\n\r\n if (!Array.isArray(organizationStyles) || organizationStyles.length === 0) {\r\n return catalog\r\n }\r\n\r\n const invalidEntries: unknown[] = []\r\n\r\n organizationStyles.forEach((style) => {\r\n const normalized = normalizeStyleEntry(style)\r\n\r\n if (normalized) {\r\n // Deduplicate by URL\r\n if (!catalog.some((s) => s.url === normalized.url)) {\r\n catalog.push(normalized)\r\n }\r\n } else {\r\n invalidEntries.push(style)\r\n }\r\n })\r\n\r\n // Log a warning if any entries were invalid (non-blocking)\r\n if (invalidEntries.length > 0) {\r\n console.warn(\r\n `[Map Styles] Dropped ${invalidEntries.length} invalid organization style entries:`,\r\n invalidEntries\r\n )\r\n }\r\n\r\n return catalog\r\n}\r\n\r\n/**\r\n * Resolves the current map style safely.\r\n * If the current style URL is not in the catalog, falls back to the default.\r\n *\r\n * @param currentStyle - The currently selected map style\r\n * @param catalog - Available map styles\r\n * @returns Valid MapStyle from catalog or default\r\n */\r\nexport function resolveMapStyle(\r\n currentStyle: MapStyle | null | undefined,\r\n catalog: MapStyle[]\r\n): MapStyle {\r\n if (!currentStyle) {\r\n return DEFAULT_MAP_STYLE\r\n }\r\n\r\n // Check if current style is in catalog by URL\r\n const found = catalog.find((s) => s.url === currentStyle.url)\r\n return found || DEFAULT_MAP_STYLE\r\n}\r\n"],"mappings":"AASO,MAAM,sBAAmC;AAAA,EAC9C,EAAE,MAAM,aAAa,KAAK,4BAA4B;AAAA;AAAA,EAEtD,EAAE,MAAM,QAAQ,KAAK,mEAAmE;AAAA,EACxF,EAAE,MAAM,YAAY,KAAK,gEAAgE;AAAA,EACzF,EAAE,MAAM,YAAY,KAAK,4CAA4C;AACvE;AAKO,MAAM,oBAA8B,oBAAoB,CAAC;AAKhE,MAAM,kBAAkB,CAAC,UAAsC;AAC7D,SACE,UAAU,QACP,OAAO,UAAU,YACjB,OAAQ,MAAc,QAAQ,YAC9B,OAAQ,MA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I,eAAe,SAAS,GAAG;AAC7B,YAAQ;AAAA,MACN,wBAAwB,eAAe,MAAM;AAAA,MAC7C;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;AAUO,SAAS,gBACd,cACA,SACU;AACV,MAAI,CAAC,cAAc;AACjB,WAAO;AAAA,EACT;AAGA,QAAM,QAAQ,QAAQ,KAAK,CAAC,MAAM,EAAE,QAAQ,aAAa,GAAG;AAC5D,SAAO,SAAS;AAClB;","names":[]}
1
+ {"version":3,"sources":["../../../../../../src/core/components/viewers/map/utils/mapStyleCatalog.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport { SATELLITE_STYLE_URL, STREETS_STYLE_URL } from './mapStyleSpec'\r\n\r\nimport type { MapStyle } from '../../../../types/map'\r\n\r\n/**\r\n * Built-in map style catalog that is always available.\r\n * The two `cdt:` entries are sentinels resolved by `resolveStyleSpec` against the\r\n * deployment's own MapTiler key, so no key ever reaches React state or the URL.\r\n */\r\nexport const BUILT_IN_MAP_STYLES: MapStyle[] = [\r\n { name: 'Satellite', url: SATELLITE_STYLE_URL },\r\n { name: 'Streets', url: STREETS_STYLE_URL },\r\n { name: 'Dark', url: 'https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json' },\r\n { name: 'Positron', url: 'https://basemaps.cartocdn.com/gl/positron-gl-style/style.json' },\r\n { name: 'Maplibre', url: 'https://demotiles.maplibre.org/style.json' },\r\n]\r\n\r\n/**\r\n * The default/fallback map style used when no style is selected or organization config is unavailable.\r\n */\r\nexport const DEFAULT_MAP_STYLE: MapStyle = BUILT_IN_MAP_STYLES[0]; // Satellite\r\n\r\n/**\r\n * Type guard to check if a value is a valid map style object.\r\n */\r\nconst isValidMapStyle = (value: unknown): value is MapStyle => {\r\n return (\r\n value !== null\r\n && typeof value === 'object'\r\n && typeof (value as any).url === 'string'\r\n && typeof (value as any).name === 'string'\r\n )\r\n}\r\n\r\n/**\r\n * Type guard to check if a string is a valid style URL format.\r\n */\r\nconst isValidStyleUrl = (url: string): boolean => {\r\n try {\r\n new URL(url)\r\n return /\\.(json|geojson)$/i.test(url) || url.includes('://')\r\n } catch {\r\n return false\r\n }\r\n}\r\n\r\n/**\r\n * Normalizes and validates a single style entry from organization config.\r\n * Returns a valid MapStyle or null if the entry is invalid.\r\n *\r\n * @param style - Raw style data from organization config\r\n * @returns Valid MapStyle or null\r\n */\r\nfunction normalizeStyleEntry(style: unknown): MapStyle | null {\r\n if (isValidMapStyle(style)) {\r\n const url = style.url.trim()\r\n if (isValidStyleUrl(url)) {\r\n return {\r\n name: String(style.name).substring(0, 100).trim(),\r\n url,\r\n }\r\n }\r\n }\r\n\r\n // Attempt recovery: if it's just a URL string, generate a name\r\n if (typeof style === 'string') {\r\n const url = style.trim()\r\n if (isValidStyleUrl(url)) {\r\n const styleName = url.replace('.json', '').split('/').pop() || 'Custom'\r\n return {\r\n name: styleName.charAt(0).toUpperCase() + styleName.slice(1),\r\n url,\r\n }\r\n }\r\n }\r\n\r\n return null\r\n}\r\n\r\n/**\r\n * Builds the complete map styles array by merging built-in styles with validated organization styles.\r\n * Deduplicates by URL, always keeps built-ins, and appends validated org styles.\r\n *\r\n * @param organizationStyles - Raw styles from organization config (unknown[])\r\n * @returns Array of valid MapStyle objects, always includes built-in styles\r\n */\r\nexport function buildMapStylesCatalog(organizationStyles: unknown): MapStyle[] {\r\n const catalog: MapStyle[] = [...BUILT_IN_MAP_STYLES]\r\n\r\n if (!Array.isArray(organizationStyles) || organizationStyles.length === 0) {\r\n return catalog\r\n }\r\n\r\n const invalidEntries: unknown[] = []\r\n\r\n organizationStyles.forEach((style) => {\r\n const normalized = normalizeStyleEntry(style)\r\n\r\n if (normalized) {\r\n // Deduplicate by URL\r\n if (!catalog.some((s) => s.url === normalized.url)) {\r\n catalog.push(normalized)\r\n }\r\n } else {\r\n invalidEntries.push(style)\r\n }\r\n })\r\n\r\n // Log a warning if any entries were invalid (non-blocking)\r\n if (invalidEntries.length > 0) {\r\n console.warn(\r\n `[Map Styles] Dropped ${invalidEntries.length} invalid organization style entries:`,\r\n invalidEntries\r\n )\r\n }\r\n\r\n return catalog\r\n}\r\n\r\n/**\r\n * Resolves the current map style safely.\r\n * If the current style URL is not in the catalog, falls back to the default.\r\n *\r\n * @param currentStyle - The currently selected map style\r\n * @param catalog - Available map styles\r\n * @returns Valid MapStyle from catalog or default\r\n */\r\nexport function resolveMapStyle(\r\n currentStyle: MapStyle | null | undefined,\r\n catalog: MapStyle[]\r\n): MapStyle {\r\n if (!currentStyle) {\r\n return DEFAULT_MAP_STYLE\r\n }\r\n\r\n // Check if current style is in catalog by URL\r\n const found = catalog.find((s) => s.url === currentStyle.url)\r\n return found || DEFAULT_MAP_STYLE\r\n}\r\n"],"mappings":"AAGA,SAAS,qBAAqB,yBAAyB;AAShD,MAAM,sBAAmC;AAAA,EAC9C,EAAE,MAAM,aAAa,KAAK,oBAAoB;AAAA,EAC9C,EAAE,MAAM,WAAW,KAAK,kBAAkB;AAAA,EAC1C,EAAE,MAAM,QAAQ,KAAK,mEAAmE;AAAA,EACxF,EAAE,MAAM,YAAY,KAAK,gEAAgE;AAAA,EACzF,EAAE,MAAM,YAAY,KAAK,4CAA4C;AACvE;AAKO,MAAM,oBAA8B,oBAAoB,CAAC;AAKhE,MAAM,kBAAkB,CAAC,UAAsC;AAC7D,SACE,UAAU,QACP,OAAO,UAAU,YACjB,OAAQ,MAAc,QAAQ,YAC9B,OAAQ,MAAc,SAAS;AAEtC;AAKA,MAAM,kBAAkB,CAAC,QAAyB;AAChD,MAAI;AACF,QAAI,IAAI,GAAG;AACX,WAAO,qBAAqB,KAAK,GAAG,KAAK,IAAI,SAAS,KAAK;AAAA,EAC7D,SAAQ;AACN,WAAO;AAAA,EACT;AACF;AASA,SAAS,oBAAoB,OAAiC;AAC5D,MAAI,gBAAgB,KAAK,GAAG;AAC1B,UAAM,MAAM,MAAM,IAAI,KAAK;AAC3B,QAAI,gB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,0 +1,21 @@
1
+ import type { MapStyle } from '../../../../types/map';
2
+ import type { StyleSpecification } from 'maplibre-gl';
3
+ /** MapTiler's public demo key. Honoured on localhost only, so dev works without an account. */
4
+ export declare const MAPTILER_PLACEHOLDER_KEY = "get_your_own_OpIi9ZULNHzrESv6T2vL";
5
+ export declare const SATELLITE_STYLE_URL = "cdt:satellite";
6
+ export declare const STREETS_STYLE_URL = "cdt:streets";
7
+ /** Falls back to the placeholder so a missing key degrades the map instead of breaking it. */
8
+ export declare function maptilerKeyOrPlaceholder(key?: string | null): string;
9
+ /**
10
+ * Build the Satellite base style for a deployment's own MapTiler key.
11
+ * Without a key it falls back to Esri imagery, terrarium elevation and the
12
+ * OpenMapTiles font CDN, so nothing is billed to another account.
13
+ */
14
+ export declare function buildSatelliteStyle(key?: string | null): StyleSpecification;
15
+ /**
16
+ * Resolve a catalog entry into something `<Map mapStyle>` accepts: a built style
17
+ * object for the built-in Satellite, a keyed URL for Streets, and any other URL
18
+ * (organization-supplied styles included) unchanged.
19
+ */
20
+ export declare function resolveStyleSpec(style: MapStyle, key?: string | null): string | StyleSpecification;
21
+ //# sourceMappingURL=mapStyleSpec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mapStyleSpec.d.ts","sourceRoot":"","sources":["../../../../../../src/core/components/viewers/map/utils/mapStyleSpec.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AACrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAErD,+FAA+F;AAC/F,eAAO,MAAM,wBAAwB,sCAAsC,CAAA;AAE3E,eAAO,MAAM,mBAAmB,kBAAkB,CAAA;AAClD,eAAO,MAAM,iBAAiB,gBAAgB,CAAA;AAU9C,8FAA8F;AAC9F,wBAAgB,wBAAwB,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAGpE;AAyCD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,kBAAkB,CAmD3E;AAYD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,QAAQ,EACf,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,GAClB,MAAM,GAAG,kBAAkB,CAQ7B"}
@@ -0,0 +1,125 @@
1
+ const MAPTILER_PLACEHOLDER_KEY = "get_your_own_OpIi9ZULNHzrESv6T2vL";
2
+ const SATELLITE_STYLE_URL = "cdt:satellite";
3
+ const STREETS_STYLE_URL = "cdt:streets";
4
+ const MAPTILER_ATTRIBUTION = '<a href="https://www.maptiler.com/copyright/" target="_blank">&copy; MapTiler</a> <a href="https://www.openstreetmap.org/copyright" target="_blank">&copy; OpenStreetMap contributors</a>';
5
+ const ESRI_ATTRIBUTION = 'Imagery &copy; <a href="https://www.esri.com/" target="_blank">Esri</a>, Maxar, Earthstar Geographics';
6
+ const TERRARIUM_ATTRIBUTION = '<a href="https://registry.opendata.aws/terrain-tiles/" target="_blank">Terrain Tiles</a>, <a href="https://earth.jaxa.jp/en/data/policy/" target="_blank">AW3D30 (JAXA)</a>';
7
+ const ESRI_IMAGERY_TILES = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}";
8
+ const TERRARIUM_TILES = "https://s3.amazonaws.com/elevation-tiles-prod/terrarium/{z}/{x}/{y}.png";
9
+ const OPENMAPTILES_GLYPHS = "https://fonts.openmaptiles.org/{fontstack}/{range}.pbf";
10
+ function maptilerKeyOrPlaceholder(key) {
11
+ const trimmed = (key != null ? key : "").trim();
12
+ return trimmed || MAPTILER_PLACEHOLDER_KEY;
13
+ }
14
+ const hasOwnKey = (key) => Boolean((key != null ? key : "").trim());
15
+ function satelliteImagerySource(key) {
16
+ if (!hasOwnKey(key)) {
17
+ return {
18
+ type: "raster",
19
+ tiles: [ESRI_IMAGERY_TILES],
20
+ tileSize: 256,
21
+ maxzoom: 19,
22
+ attribution: ESRI_ATTRIBUTION
23
+ };
24
+ }
25
+ return {
26
+ type: "raster",
27
+ tiles: [`https://api.maptiler.com/tiles/satellite-v2/{z}/{x}/{y}.jpg?key=${(key != null ? key : "").trim()}`],
28
+ tileSize: 256,
29
+ maxzoom: 16,
30
+ attribution: MAPTILER_ATTRIBUTION
31
+ };
32
+ }
33
+ function elevationSource(key) {
34
+ if (!hasOwnKey(key)) {
35
+ return {
36
+ type: "raster-dem",
37
+ tiles: [TERRARIUM_TILES],
38
+ encoding: "terrarium",
39
+ tileSize: 256,
40
+ maxzoom: 12,
41
+ attribution: TERRARIUM_ATTRIBUTION
42
+ };
43
+ }
44
+ return {
45
+ type: "raster-dem",
46
+ url: `https://api.maptiler.com/tiles/terrain-rgb-v2/tiles.json?key=${(key != null ? key : "").trim()}`,
47
+ tileSize: 256
48
+ };
49
+ }
50
+ function buildSatelliteStyle(key) {
51
+ return {
52
+ version: 8,
53
+ id: "satellite",
54
+ name: "Satellite",
55
+ glyphs: hasOwnKey(key) ? `https://api.maptiler.com/fonts/{fontstack}/{range}.pbf?key=${(key != null ? key : "").trim()}` : OPENMAPTILES_GLYPHS,
56
+ sources: {
57
+ "raster-tiles": satelliteImagerySource(key),
58
+ terrainSource: elevationSource(key),
59
+ hillshadeSource: elevationSource(key)
60
+ },
61
+ layers: [
62
+ {
63
+ id: "background",
64
+ type: "background",
65
+ layout: { visibility: "visible" },
66
+ paint: { "background-color": "#1a1a1a" }
67
+ },
68
+ {
69
+ id: "simple-tiles",
70
+ type: "raster",
71
+ source: "raster-tiles",
72
+ minzoom: 0,
73
+ maxzoom: 24,
74
+ paint: { "raster-brightness-min": 0.15 }
75
+ },
76
+ {
77
+ id: "hillshade",
78
+ type: "hillshade",
79
+ source: "hillshadeSource",
80
+ layout: { visibility: "visible" },
81
+ paint: {
82
+ "hillshade-shadow-color": "rgba(0, 0, 0, 0.3)",
83
+ "hillshade-highlight-color": "rgba(255, 255, 255, 0.3)",
84
+ "hillshade-exaggeration": 0.5
85
+ }
86
+ }
87
+ ],
88
+ sky: {
89
+ "atmosphere-blend": ["interpolate", ["linear"], ["zoom"], 0, 1, 5, 1, 7, 0]
90
+ },
91
+ light: {
92
+ anchor: "viewport",
93
+ color: "#ffffff",
94
+ intensity: 0.6,
95
+ position: [1.15, 0, 0]
96
+ },
97
+ terrain: { source: "terrainSource", exaggeration: 0.6 }
98
+ };
99
+ }
100
+ const LEGACY_STATIC_STYLES = {
101
+ "mapStyles/satellite.json": SATELLITE_STYLE_URL,
102
+ "mapStyles/streets.json": STREETS_STYLE_URL
103
+ };
104
+ function normalizeStyleUrl(url) {
105
+ const legacy = Object.keys(LEGACY_STATIC_STYLES).find((path) => url.endsWith(path));
106
+ return legacy ? LEGACY_STATIC_STYLES[legacy] : url;
107
+ }
108
+ function resolveStyleSpec(style, key) {
109
+ var _a;
110
+ const url = normalizeStyleUrl(((_a = style == null ? void 0 : style.url) != null ? _a : "").trim());
111
+ if (url === SATELLITE_STYLE_URL) return buildSatelliteStyle(key);
112
+ if (url === STREETS_STYLE_URL) {
113
+ return `https://api.maptiler.com/maps/streets-v2/style.json?key=${maptilerKeyOrPlaceholder(key)}`;
114
+ }
115
+ return url;
116
+ }
117
+ export {
118
+ MAPTILER_PLACEHOLDER_KEY,
119
+ SATELLITE_STYLE_URL,
120
+ STREETS_STYLE_URL,
121
+ buildSatelliteStyle,
122
+ maptilerKeyOrPlaceholder,
123
+ resolveStyleSpec
124
+ };
125
+ //# sourceMappingURL=mapStyleSpec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../src/core/components/viewers/map/utils/mapStyleSpec.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport type { MapStyle } from '../../../../types/map'\nimport type { StyleSpecification } from 'maplibre-gl'\n\n/** MapTiler's public demo key. Honoured on localhost only, so dev works without an account. */\nexport const MAPTILER_PLACEHOLDER_KEY = 'get_your_own_OpIi9ZULNHzrESv6T2vL'\n\nexport const SATELLITE_STYLE_URL = 'cdt:satellite'\nexport const STREETS_STYLE_URL = 'cdt:streets'\n\nconst MAPTILER_ATTRIBUTION = '<a href=\"https://www.maptiler.com/copyright/\" target=\"_blank\">&copy; MapTiler</a> <a href=\"https://www.openstreetmap.org/copyright\" target=\"_blank\">&copy; OpenStreetMap contributors</a>'\nconst ESRI_ATTRIBUTION = 'Imagery &copy; <a href=\"https://www.esri.com/\" target=\"_blank\">Esri</a>, Maxar, Earthstar Geographics'\nconst TERRARIUM_ATTRIBUTION = '<a href=\"https://registry.opendata.aws/terrain-tiles/\" target=\"_blank\">Terrain Tiles</a>, <a href=\"https://earth.jaxa.jp/en/data/policy/\" target=\"_blank\">AW3D30 (JAXA)</a>'\n\nconst ESRI_IMAGERY_TILES = 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}'\nconst TERRARIUM_TILES = 'https://s3.amazonaws.com/elevation-tiles-prod/terrarium/{z}/{x}/{y}.png'\nconst OPENMAPTILES_GLYPHS = 'https://fonts.openmaptiles.org/{fontstack}/{range}.pbf'\n\n/** Falls back to the placeholder so a missing key degrades the map instead of breaking it. */\nexport function maptilerKeyOrPlaceholder(key?: string | null): string {\n const trimmed = (key ?? '').trim()\n return trimmed || MAPTILER_PLACEHOLDER_KEY\n}\n\nconst hasOwnKey = (key?: string | null): boolean => Boolean((key ?? '').trim())\n\nfunction satelliteImagerySource(key?: string | null) {\n if (!hasOwnKey(key)) {\n return {\n type: 'raster' as const,\n tiles: [ESRI_IMAGERY_TILES],\n tileSize: 256,\n maxzoom: 19,\n attribution: ESRI_ATTRIBUTION,\n }\n }\n return {\n type: 'raster' as const,\n tiles: [`https://api.maptiler.com/tiles/satellite-v2/{z}/{x}/{y}.jpg?key=${(key ?? '').trim()}`],\n tileSize: 256,\n maxzoom: 16,\n attribution: MAPTILER_ATTRIBUTION,\n }\n}\n\nfunction elevationSource(key?: string | null) {\n if (!hasOwnKey(key)) {\n return {\n type: 'raster-dem' as const,\n tiles: [TERRARIUM_TILES],\n encoding: 'terrarium' as const,\n tileSize: 256,\n maxzoom: 12,\n attribution: TERRARIUM_ATTRIBUTION,\n }\n }\n return {\n type: 'raster-dem' as const,\n url: `https://api.maptiler.com/tiles/terrain-rgb-v2/tiles.json?key=${(key ?? '').trim()}`,\n tileSize: 256,\n }\n}\n\n/**\n * Build the Satellite base style for a deployment's own MapTiler key.\n * Without a key it falls back to Esri imagery, terrarium elevation and the\n * OpenMapTiles font CDN, so nothing is billed to another account.\n */\nexport function buildSatelliteStyle(key?: string | null): StyleSpecification {\n return {\n version: 8,\n id: 'satellite',\n name: 'Satellite',\n glyphs: hasOwnKey(key)\n ? `https://api.maptiler.com/fonts/{fontstack}/{range}.pbf?key=${(key ?? '').trim()}`\n : OPENMAPTILES_GLYPHS,\n sources: {\n 'raster-tiles': satelliteImagerySource(key),\n terrainSource: elevationSource(key),\n hillshadeSource: elevationSource(key),\n },\n layers: [\n {\n id: 'background',\n type: 'background',\n layout: { visibility: 'visible' },\n paint: { 'background-color': '#1a1a1a' },\n },\n {\n id: 'simple-tiles',\n type: 'raster',\n source: 'raster-tiles',\n minzoom: 0,\n maxzoom: 24,\n paint: { 'raster-brightness-min': 0.15 },\n },\n {\n id: 'hillshade',\n type: 'hillshade',\n source: 'hillshadeSource',\n layout: { visibility: 'visible' },\n paint: {\n 'hillshade-shadow-color': 'rgba(0, 0, 0, 0.3)',\n 'hillshade-highlight-color': 'rgba(255, 255, 255, 0.3)',\n 'hillshade-exaggeration': 0.5,\n },\n },\n ],\n sky: {\n 'atmosphere-blend': ['interpolate', ['linear'], ['zoom'], 0, 1, 5, 1, 7, 0],\n },\n light: {\n anchor: 'viewport',\n color: '#ffffff',\n intensity: 0.6,\n position: [1.15, 0, 0],\n },\n terrain: { source: 'terrainSource', exaggeration: 0.6 },\n } as StyleSpecification\n}\n\nconst LEGACY_STATIC_STYLES: Record<string, string> = {\n 'mapStyles/satellite.json': SATELLITE_STYLE_URL,\n 'mapStyles/streets.json': STREETS_STYLE_URL,\n}\n\nfunction normalizeStyleUrl(url: string): string {\n const legacy = Object.keys(LEGACY_STATIC_STYLES).find((path) => url.endsWith(path))\n return legacy ? LEGACY_STATIC_STYLES[legacy] : url\n}\n\n/**\n * Resolve a catalog entry into something `<Map mapStyle>` accepts: a built style\n * object for the built-in Satellite, a keyed URL for Streets, and any other URL\n * (organization-supplied styles included) unchanged.\n */\nexport function resolveStyleSpec(\n style: MapStyle,\n key?: string | null\n): string | StyleSpecification {\n const url = normalizeStyleUrl((style?.url ?? '').trim())\n\n if (url === SATELLITE_STYLE_URL) return buildSatelliteStyle(key)\n if (url === STREETS_STYLE_URL) {\n return `https://api.maptiler.com/maps/streets-v2/style.json?key=${maptilerKeyOrPlaceholder(key)}`\n }\n return url\n}\n"],"mappings":"AAOO,MAAM,2BAA2B;AAEjC,MAAM,sBAAsB;AAC5B,MAAM,oBAAoB;AAEjC,MAAM,uBAAuB;AAC7B,MAAM,mBAAmB;AACzB,MAAM,wBAAwB;AAE9B,MAAM,qBAAqB;AAC3B,MAAM,kBAAkB;AACxB,MAAM,sBAAsB;AAGrB,SAAS,yBAAyB,KAA6B;AACpE,QAAM,WAAW,oBAAO,IAAI,KAAK;AACjC,SAAO,WAAW;AACpB;AAEA,MAAM,YAAY,CAAC,QAAiC,SAAS,oBAAO,IAAI,KAAK,CAAC;AAE9E,SAAS,uBAAuB,KAAqB;AACnD,MAAI,CAAC,UAAU,GAAG,GAAG;AACnB,WAAO;AAAA,MACL,MAAM;AAAA,MACN,OAAO,CAAC,kBAAkB;AAAA,MAC1B,UAAU;AAAA,MACV,SAAS;AAAA,MACT,aAAa;AAAA,IACf;AAAA,EACF;AACA,SAAO;AAAA,IACL,MAAM;AAAA,IACN,OAAO,CAAC,oEAAoE,oBAAO,IAAI,KAAK,CAAC,EAAE;AAAA,IAC/F,UAAU;AAAA,IACV,SAAS;AAAA,IACT,aAAa;AAAA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AG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAAA,IAC5E;AAAA,IACA,OAAO;AAAA,MACL,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,WAAW;AAAA,MACX,UAAU,CAAC,MAAM,GAAG,CAAC;AAAA,IACvB;AAAA,IACA,SAAS,EAAE,QAAQ,iBAAiB,cAAc,IAAI;AAAA,EACxD;AACF;AAEA,MAAM,uBAA+C;AAAA,EACnD,4BAA4B;AAAA,EAC5B,0BAA0B;AAC5B;AAEA,SAAS,kBAAkB,KAAqB;AAC9C,QAAM,SAAS,OAAO,KAAK,oBAAoB,EAAE,KAAK,CAAC,SAAS,IAAI,SAAS,IAAI,CAAC;AAClF,SAAO,SAAS,qBAAqB,MAAM,IAAI;AACjD;AAOO,SAAS,iBACd,OACA,KAC6B;AA7I/B;AA8IE,QAAM,MAAM,oBAAmB,oCAAO,QAAP,YAAc,IAAI,KAAK,CAAC;AAEvD,MAAI,QAAQ,oBAAqB,QAAO,oBAAoB,GAAG;AAC/D,MAAI,QAAQ,mBAAmB;AAC7B,WAAO,2DAA2D,yBAAyB,GAAG,CAAC;AAAA,EACjG;AACA,SAAO;AACT;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"PluginCard.d.ts","sourceRoot":"","sources":["../../../../../../src/core/components/viewers/plugins/src/PluginCard.tsx"],"names":[],"mappings":"AAwBA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAY9B,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAmC7D,UAAU,KAAK;IACb,OAAO,EAAE,aAAa,CAAA;IACtB,OAAO,EAAE,cAAc,CAAA;IACvB,cAAc,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAA;IAC5C,eAAe,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;IAC3C,sBAAsB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;IAChD,gBAAgB,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;IAC5C,WAAW,EAAE,MAAM,IAAI,CAAA;CACxB;AAED,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,OAAO,EACP,cAAc,EACd,eAAe,EACf,sBAAsB,EACtB,gBAAgB,EAChB,WAAW,GACZ,EAAE,KAAK,qBAoKP"}
1
+ {"version":3,"file":"PluginCard.d.ts","sourceRoot":"","sources":["../../../../../../src/core/components/viewers/plugins/src/PluginCard.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAY9B,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAmC7D,UAAU,KAAK;IACb,OAAO,EAAE,aAAa,CAAA;IACtB,OAAO,EAAE,cAAc,CAAA;IACvB,cAAc,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAA;IAC5C,eAAe,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;IAC3C,sBAAsB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;IAChD,gBAAgB,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;IAC5C,WAAW,EAAE,MAAM,IAAI,CAAA;CACxB;AAED,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,OAAO,EACP,cAAc,EACd,eAAe,EACf,sBAAsB,EACtB,gBAAgB,EAChB,WAAW,GACZ,EAAE,KAAK,qBAoKP"}
@@ -1,23 +1,6 @@
1
1
  "use client";
2
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
- import {
4
- AlertTriangle,
5
- Box,
6
- CheckCircle2,
7
- CircleSlash,
8
- Eye,
9
- Lock,
10
- MapPin,
11
- Layers,
12
- Minus,
13
- PackagePlus,
14
- PanelLeft,
15
- PanelRight,
16
- Puzzle,
17
- Scan,
18
- SquareMenu,
19
- SquareStack
20
- } from "lucide-react";
3
+ import * as LR from "lucide-react";
21
4
  import { useTranslations } from "next-intl";
22
5
  import { resolvePluginIcon } from "../../../../plugins/host/pluginIcon";
23
6
  import { usePluginMessage } from "../../../../plugins/sdk/messages";
@@ -29,31 +12,31 @@ import { Switch } from "../../../ui/Switch";
29
12
  import { effectiveStatus } from "./pluginStatus";
30
13
  const STATUS_STYLE = {
31
14
  running: {
32
- icon: CheckCircle2,
15
+ icon: LR.CheckCircle2,
33
16
  className: "border-green-600/40 bg-green-600/10 text-green-700 dark:text-green-400"
34
17
  },
35
18
  off: {
36
- icon: CircleSlash,
19
+ icon: LR.CircleSlash,
37
20
  className: "border-muted-foreground/40 bg-muted text-muted-foreground"
38
21
  },
39
22
  error: {
40
- icon: AlertTriangle,
23
+ icon: LR.AlertTriangle,
41
24
  className: "border-destructive/40 bg-destructive/10 text-destructive"
42
25
  },
43
26
  available: {
44
- icon: PackagePlus,
27
+ icon: LR.PackagePlus,
45
28
  className: "border-sky-600/40 bg-sky-600/10 text-sky-700 dark:text-sky-400"
46
29
  }
47
30
  };
48
31
  const CAPABILITY_ICON = {
49
- "map.tools": MapPin,
50
- "viewer.legends": SquareMenu,
51
- "map.layers": Layers,
52
- "bim.tools": Box,
53
- "pointcloud.tools": Scan,
54
- "data.pages": PanelLeft,
55
- "viewer.tabs": PanelRight,
56
- "ui.dialogs": SquareStack
32
+ "map.tools": LR.Map,
33
+ "viewer.legends": LR.SquareMenu,
34
+ "map.layers": LR.Layers,
35
+ "bim.tools": LR.Box,
36
+ "pointcloud.tools": LR.Grip,
37
+ "data.pages": LR.Table2,
38
+ "viewer.tabs": LR.PanelLeft,
39
+ "ui.dialogs": LR.SquareStack
57
40
  };
58
41
  function PluginCard({
59
42
  listing,
@@ -111,7 +94,7 @@ function PluginCard({
111
94
  ] }),
112
95
  status === "error" && listing.error && /* @__PURE__ */ jsxs("div", { className: "mt-3 rounded-xl border border-destructive/50 bg-destructive/5 p-3", children: [
113
96
  /* @__PURE__ */ jsxs("p", { className: "flex items-center gap-1.5 text-sm font-medium text-destructive", children: [
114
- /* @__PURE__ */ jsx(AlertTriangle, { className: "h-4 w-4 shrink-0" }),
97
+ /* @__PURE__ */ jsx(LR.AlertTriangle, { className: "h-4 w-4 shrink-0" }),
115
98
  t("errorHeading")
116
99
  ] }),
117
100
  /* @__PURE__ */ jsx("p", { className: "mt-1.5 overflow-x-auto text-xs", children: /* @__PURE__ */ jsx("code", { children: listing.error }) }),
@@ -127,7 +110,7 @@ function PluginCard({
127
110
  ] })
128
111
  ] }),
129
112
  /* @__PURE__ */ jsx("div", { className: "flex min-w-0 flex-col gap-2.5 md:w-[270px]", children: status === "available" ? ability.canInstall && /* @__PURE__ */ jsxs(Button, { size: "sm", onClick: () => onSetInstalled(true), children: [
130
- /* @__PURE__ */ jsx(PackagePlus, { className: "mr-1.5 h-4 w-4" }),
113
+ /* @__PURE__ */ jsx(LR.PackagePlus, { className: "mr-1.5 h-4 w-4" }),
131
114
  t("addToOrg")
132
115
  ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
133
116
  isAdmin ? /* @__PURE__ */ jsxs(ControlGroup, { label: t("orgGroup"), who: t("orgGroupWho"), children: [
@@ -165,7 +148,7 @@ function PluginCard({
165
148
  )
166
149
  ] })
167
150
  ] }) : /* @__PURE__ */ jsx(ControlGroup, { label: t("orgGroup"), children: /* @__PURE__ */ jsx("p", { className: "py-1 text-sm text-muted-foreground", children: orgSummary(listing, t) }) }),
168
- /* @__PURE__ */ jsx(ControlGroup, { label: t("userGroup"), children: status === "error" ? /* @__PURE__ */ jsx(Note, { icon: Minus, text: t("userNothingToRun") }) : userMayChoose ? /* @__PURE__ */ jsx(ControlRow, { label: t("userRun"), children: /* @__PURE__ */ jsx(
151
+ /* @__PURE__ */ jsx(ControlGroup, { label: t("userGroup"), children: status === "error" ? /* @__PURE__ */ jsx(Note, { icon: LR.Minus, text: t("userNothingToRun") }) : userMayChoose ? /* @__PURE__ */ jsx(ControlRow, { label: t("userRun"), children: /* @__PURE__ */ jsx(
169
152
  Switch,
170
153
  {
171
154
  checked: userEnabled,
@@ -175,8 +158,8 @@ function PluginCard({
175
158
  ) }) : !ability.canChooseForSelf ? (
176
159
  // Not the admin lock below: nothing is locked, this reader just may
177
160
  // not change what runs.
178
- /* @__PURE__ */ jsx(Note, { icon: Eye, text: t("userReadOnly") })
179
- ) : /* @__PURE__ */ jsx(Note, { icon: Lock, text: listing.orgEnabled ? t("userLockedOn") : t("userLockedOff") }) }),
161
+ /* @__PURE__ */ jsx(Note, { icon: LR.Eye, text: t("userReadOnly") })
162
+ ) : /* @__PURE__ */ jsx(Note, { icon: LR.Lock, text: listing.orgEnabled ? t("userLockedOn") : t("userLockedOff") }) }),
180
163
  status === "error" && /* @__PURE__ */ jsx(Button, { size: "sm", variant: "outline", onClick: onCopyError, children: t("copyError") })
181
164
  ] }) })
182
165
  ]
@@ -199,7 +182,7 @@ function StatusBadge({ status }) {
199
182
  }
200
183
  function CapabilityBadge({ capability }) {
201
184
  var _a;
202
- const Icon = (_a = CAPABILITY_ICON[capability]) != null ? _a : Puzzle;
185
+ const Icon = (_a = CAPABILITY_ICON[capability]) != null ? _a : LR.Puzzle;
203
186
  return /* @__PURE__ */ jsxs(Badge, { variant: "secondary", className: "gap-1 font-normal", children: [
204
187
  /* @__PURE__ */ jsx(Icon, { className: "h-3.5 w-3.5" }),
205
188
  /* @__PURE__ */ jsx("code", { children: capability })
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/core/components/viewers/plugins/src/PluginCard.tsx"],"sourcesContent":["'use client'\n\n// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport {\n AlertTriangle,\n Box,\n CheckCircle2,\n CircleSlash,\n Eye,\n Lock,\n MapPin,\n Layers,\n Minus,\n PackagePlus,\n PanelLeft,\n PanelRight,\n Puzzle,\n Scan,\n SquareMenu,\n SquareStack,\n} from 'lucide-react'\nimport { useTranslations } from 'next-intl'\nimport * as React from 'react'\n\nimport { resolvePluginIcon } from '../../../../plugins/host/pluginIcon'\nimport { usePluginMessage } from '../../../../plugins/sdk/messages'\nimport { cn } from '../../../../utils/utils'\nimport { Badge } from '../../../ui/Badge'\nimport { Button } from '../../../ui/Button'\nimport { Separator } from '../../../ui/Separator'\nimport { Switch } from '../../../ui/Switch'\n\nimport { effectiveStatus } from './pluginStatus'\n\nimport type { PluginListing, PluginsAbility } from '../types'\nimport type { LucideIcon } from 'lucide-react'\n\n// Icon and colour both, so status survives a quick scan and colour-blindness.\nconst STATUS_STYLE: Record<PluginListing['status'], { icon: LucideIcon; className: string }> = {\n running: {\n icon: CheckCircle2,\n className: 'border-green-600/40 bg-green-600/10 text-green-700 dark:text-green-400',\n },\n off: {\n icon: CircleSlash,\n className: 'border-muted-foreground/40 bg-muted text-muted-foreground',\n },\n error: {\n icon: AlertTriangle,\n className: 'border-destructive/40 bg-destructive/10 text-destructive',\n },\n available: {\n icon: PackagePlus,\n className: 'border-sky-600/40 bg-sky-600/10 text-sky-700 dark:text-sky-400',\n },\n}\n\n// Which surface a capability contributes to: an icon reads faster than the dotted key.\nconst CAPABILITY_ICON: Record<string, LucideIcon> = {\n 'map.tools': MapPin,\n 'viewer.legends': SquareMenu,\n 'map.layers': Layers,\n 'bim.tools': Box,\n 'pointcloud.tools': Scan,\n 'data.pages': PanelLeft,\n 'viewer.tabs': PanelRight,\n 'ui.dialogs': SquareStack,\n}\n\ninterface Props {\n listing: PluginListing\n ability: PluginsAbility\n onSetInstalled: (installed: boolean) => void\n onSetOrgEnabled: (enabled: boolean) => void\n onSetAllowUserOverride: (allow: boolean) => void\n onSetUserEnabled: (enabled: boolean) => void\n onCopyError: () => void\n}\n\nexport function PluginCard({\n listing,\n ability,\n onSetInstalled,\n onSetOrgEnabled,\n onSetAllowUserOverride,\n onSetUserEnabled,\n onCopyError,\n}: Props) {\n const t = useTranslations('PluginsPage')\n const { manifest } = listing\n // From the switches, not the host: otherwise turning a plugin off leaves the badge\n // reading \"Running\".\n const status = effectiveStatus(listing)\n\n const Icon = resolvePluginIcon(manifest.icon ?? 'Puzzle')\n\n // The plugin's catalog when it ships one, its manifest when it does not — never a\n // raw message key.\n const name = usePluginMessage(manifest.slug, 'name', manifest.name)\n const description = usePluginMessage(manifest.slug, 'description', manifest.description ?? '')\n\n const isAdmin = ability.canConfigureOrg || ability.canInstall\n const userMayChoose = listing.allowUserOverride && ability.canChooseForSelf && status !== 'error'\n const userEnabled = listing.userEnabled ?? listing.orgEnabled\n\n return (\n <article\n className=\"grid gap-4 rounded-xl border bg-background p-5 md:grid-cols-[minmax(0,1fr)_auto]\"\n data-testid={`plugin-${manifest.slug}`}\n >\n <div className=\"min-w-0\">\n <div className=\"flex flex-wrap items-center gap-2\">\n <Icon\n aria-hidden\n className=\"h-5 w-5 shrink-0 text-muted-foreground\"\n data-testid={`plugin-icon-${manifest.slug}`}\n />\n <h2 className=\"text-lg text-foreground\">{name}</h2>\n <StatusBadge status={status} />\n {listing.bundled && (\n <Badge variant=\"outline\" className=\"font-normal text-muted-foreground\">\n {t('bundled')}\n </Badge>\n )}\n </div>\n\n <p className=\"mt-1 text-sm text-muted-foreground\">\n <code>{manifest.slug}</code>\n <span className=\"mx-1.5 opacity-40\">·</span>\n <span className=\"tabular-nums\">v{manifest.version}</span>\n <span className=\"mx-1.5 opacity-40\">·</span>\n {manifest.author || t('unknownAuthor')}\n </p>\n\n {description && <p className=\"mt-2 max-w-[60ch] text-sm\">{description}</p>}\n\n <div className=\"mt-3 flex flex-wrap items-center gap-1.5\">\n <span className=\"text-xs text-muted-foreground\">{t('capabilities')}</span>\n {manifest.capabilities.map(capability => (\n <CapabilityBadge key={capability} capability={capability} />\n ))}\n </div>\n\n {status === 'error' && listing.error && (\n <div className=\"mt-3 rounded-xl border border-destructive/50 bg-destructive/5 p-3\">\n <p className=\"flex items-center gap-1.5 text-sm font-medium text-destructive\">\n <AlertTriangle className=\"h-4 w-4 shrink-0\" />\n {t('errorHeading')}\n </p>\n <p className=\"mt-1.5 overflow-x-auto text-xs\"><code>{listing.error}</code></p>\n <p className=\"mt-1.5 text-xs text-muted-foreground\">{t('errorHint')}</p>\n </div>\n )}\n\n {status === 'available' && (\n <div className=\"mt-3 rounded-xl border border-dashed p-3\">\n <p className=\"text-sm font-medium\">{t('trustHeading')}</p>\n <ul className=\"mt-1.5 list-disc pl-4 text-xs text-muted-foreground\">\n {listing.mountPath && <li>{t('trustMount', { path: listing.mountPath })}</li>}\n <li>\n {manifest.requiredPermissions?.length\n ? t('trustPermissions', { permissions: manifest.requiredPermissions.join(', ') })\n : t('trustNoPermissions')}\n </li>\n <li>{t('trustWarning')}</li>\n </ul>\n </div>\n )}\n </div>\n\n <div className=\"flex min-w-0 flex-col gap-2.5 md:w-[270px]\">\n {status === 'available' ? (\n ability.canInstall && (\n <Button size=\"sm\" onClick={() => onSetInstalled(true)}>\n <PackagePlus className=\"mr-1.5 h-4 w-4\" />\n {t('addToOrg')}\n </Button>\n )\n ) : (\n <>\n {isAdmin ? (\n <ControlGroup label={t('orgGroup')} who={t('orgGroupWho')}>\n {ability.canInstall && (\n <ControlRow label={t('orgInstalled')}>\n <Switch\n checked={listing.installed}\n onCheckedChange={onSetInstalled}\n aria-label={t('orgInstalled')}\n />\n </ControlRow>\n )}\n {ability.canConfigureOrg && (\n <>\n <ControlRow label={t('orgEnabled')}>\n <Switch\n checked={listing.orgEnabled}\n onCheckedChange={onSetOrgEnabled}\n aria-label={t('orgEnabled')}\n />\n </ControlRow>\n <ControlRow\n label={t('orgAllowOverride')}\n hint={listing.allowUserOverride\n ? t('orgAllowOverrideOnHint')\n : t('orgAllowOverrideOffHint')}\n >\n <Switch\n checked={listing.allowUserOverride}\n onCheckedChange={onSetAllowUserOverride}\n aria-label={t('orgAllowOverride')}\n />\n </ControlRow>\n </>\n )}\n </ControlGroup>\n ) : (\n <ControlGroup label={t('orgGroup')}>\n <p className=\"py-1 text-sm text-muted-foreground\">{orgSummary(listing, t)}</p>\n </ControlGroup>\n )}\n\n <ControlGroup label={t('userGroup')}>\n {status === 'error' ? (\n <Note icon={Minus} text={t('userNothingToRun')} />\n ) : userMayChoose ? (\n <ControlRow label={t('userRun')}>\n <Switch\n checked={userEnabled}\n onCheckedChange={onSetUserEnabled}\n aria-label={t('userRun')}\n />\n </ControlRow>\n ) : !ability.canChooseForSelf ? (\n // Not the admin lock below: nothing is locked, this reader just may\n // not change what runs.\n <Note icon={Eye} text={t('userReadOnly')} />\n ) : (\n <Note icon={Lock} text={listing.orgEnabled ? t('userLockedOn') : t('userLockedOff')} />\n )}\n </ControlGroup>\n\n {status === 'error' && (\n <Button size=\"sm\" variant=\"outline\" onClick={onCopyError}>\n {t('copyError')}\n </Button>\n )}\n </>\n )}\n </div>\n </article>\n )\n}\n\nfunction StatusBadge({ status }: { status: PluginListing['status'] }) {\n const t = useTranslations('PluginsPage')\n const { icon: Icon, className } = STATUS_STYLE[status]\n\n const label: Record<PluginListing['status'], string> = {\n running: t('statusRunning'),\n off: t('statusOff'),\n error: t('statusError'),\n available: t('statusAvailable'),\n }\n\n return (\n <Badge variant=\"outline\" className={cn('gap-1 font-medium', className)}>\n <Icon className=\"h-3.5 w-3.5\" />\n {label[status]}\n </Badge>\n )\n}\n\nfunction CapabilityBadge({ capability }: { capability: string }) {\n const Icon = CAPABILITY_ICON[capability] ?? Puzzle\n\n return (\n <Badge variant=\"secondary\" className=\"gap-1 font-normal\">\n <Icon className=\"h-3.5 w-3.5\" />\n <code>{capability}</code>\n </Badge>\n )\n}\n\n// A bordered, faintly-tinted box so the controls read as a panel rather than loose\n// text, borrowing the muted token the app uses for inset surfaces.\nfunction ControlGroup({\n label,\n who,\n children,\n}: {\n label: string\n who?: string\n children: React.ReactNode\n}) {\n return (\n <div className=\"rounded-xl border bg-muted/30 px-3 py-2.5\">\n <div className=\"flex items-center gap-1.5 text-xs text-muted-foreground\">\n {label}\n {who && (\n <Badge variant=\"outline\" className=\"bg-background px-1.5 py-0 text-[10px] font-normal\">\n {who}\n </Badge>\n )}\n </div>\n <Separator className=\"my-2\" />\n {children}\n </div>\n )\n}\n\n/** Rows inside a group are separated, so three switches do not run together. */\nfunction ControlRow({\n label,\n hint,\n children,\n}: {\n label: string\n hint?: string\n children: React.ReactNode\n}) {\n return (\n <div className=\"flex items-center justify-between gap-3 py-1.5 [&+&]:border-t [&+&]:border-border/60\">\n <span className=\"text-sm leading-tight\">\n {label}\n {hint && <small className=\"mt-0.5 block text-xs text-muted-foreground\">{hint}</small>}\n </span>\n {children}\n </div>\n )\n}\n\nfunction Note({ icon: Icon, text }: { icon: LucideIcon; text: string }) {\n return (\n <p className=\"flex items-start gap-1.5 py-1 text-sm text-muted-foreground\">\n <Icon className=\"mt-0.5 h-4 w-4 shrink-0\" />\n <span>{text}</span>\n </p>\n )\n}\n\n/** What a non-admin is told about the organization's decision. */\nfunction orgSummary(\n listing: PluginListing,\n t: ReturnType<typeof useTranslations<'PluginsPage'>>,\n): string {\n if (!listing.allowUserOverride) {\n return listing.orgEnabled ? t('orgReadOnlyForced') : t('orgReadOnlyBlocked')\n }\n return listing.orgEnabled ? t('orgReadOnlyOnOptional') : t('orgReadOnlyOffOptional')\n}\n"],"mappings":";AAiHQ,SAiFU,UAhFR,KADF;AA5GR;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,uBAAuB;AAGhC,SAAS,yBAAyB;AAClC,SAAS,wBAAwB;AACjC,SAAS,UAAU;AACnB,SAAS,aAAa;AACtB,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAC1B,SAAS,cAAc;AAEvB,SAAS,uBAAuB;AAMhC,MAAM,eAAyF;AAAA,EAC7F,SAAS;AAAA,IACP,MAAM;AAAA,IACN,WAAW;AAAA,EACb;AAAA,EACA,KAAK;AAAA,IACH,MAAM;A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;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AACF,GAIG;AACD,SACE,qBAAC,SAAI,WAAU,6CACb;AAAA,yBAAC,SAAI,WAAU,2DACZ;AAAA;AAAA,MACA,OACC,oBAAC,SAAM,SAAQ,WAAU,WAAU,qDAChC,eACH;AAAA,OAEJ;AAAA,IACA,oBAAC,aAAU,WAAU,QAAO;AAAA,IAC3B;AAAA,KACH;AAEJ;AAGA,SAAS,WAAW;AAAA,EAClB;AAAA,EACA;AAAA,EACA;AACF,GAIG;AACD,SACE,qBAAC,SAAI,WAAU,wFACb;AAAA,yBAAC,UAAK,WAAU,yBACb;AAAA;AAAA,MACA,QAAQ,oBAAC,WAAM,WAAU,8CAA8C,gBAAK;AAAA,OAC/E;AAAA,IACC;AAAA,KACH;AAEJ;AAEA,SAAS,KAAK,EAAE,MAAM,MAAM,KAAK,GAAuC;AACtE,SACE,qBAAC,OAAE,WAAU,+DACX;AAAA,wBAAC,QAAK,WAAU,2BAA0B;AAAA,IAC1C,oBAAC,UAAM,gBAAK;AAAA,KACd;AAEJ;AAGA,SAAS,WACP,SACA,GACQ;AACR,MAAI,CAAC,QAAQ,mBAAmB;AAC9B,WAAO,QAAQ,aAAa,EAAE,mBAAmB,IAAI,EAAE,oBAAoB;AAAA,EAC7E;AACA,SAAO,QAAQ,aAAa,EAAE,uBAAuB,IAAI,EAAE,wBAAwB;AACrF;","names":[]}
1
+ {"version":3,"sources":["../../../../../../src/core/components/viewers/plugins/src/PluginCard.tsx"],"sourcesContent":["'use client'\r\n\r\n// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport * as LR from 'lucide-react'\r\nimport { useTranslations } from 'next-intl'\r\nimport * as React from 'react'\r\n\r\nimport { resolvePluginIcon } from '../../../../plugins/host/pluginIcon'\r\nimport { usePluginMessage } from '../../../../plugins/sdk/messages'\r\nimport { cn } from '../../../../utils/utils'\r\nimport { Badge } from '../../../ui/Badge'\r\nimport { Button } from '../../../ui/Button'\r\nimport { Separator } from '../../../ui/Separator'\r\nimport { Switch } from '../../../ui/Switch'\r\n\r\nimport { effectiveStatus } from './pluginStatus'\r\n\r\nimport type { PluginListing, PluginsAbility } from '../types'\r\nimport type { LucideIcon } from 'lucide-react'\r\n\r\n// Icon and colour both, so status survives a quick scan and colour-blindness.\r\nconst STATUS_STYLE: Record<PluginListing['status'], { icon: LucideIcon; className: string }> = {\r\n running: {\r\n icon: LR.CheckCircle2,\r\n className: 'border-green-600/40 bg-green-600/10 text-green-700 dark:text-green-400',\r\n },\r\n off: {\r\n icon: LR.CircleSlash,\r\n className: 'border-muted-foreground/40 bg-muted text-muted-foreground',\r\n },\r\n error: {\r\n icon: LR.AlertTriangle,\r\n className: 'border-destructive/40 bg-destructive/10 text-destructive',\r\n },\r\n available: {\r\n icon: LR.PackagePlus,\r\n className: 'border-sky-600/40 bg-sky-600/10 text-sky-700 dark:text-sky-400',\r\n },\r\n}\r\n\r\n// Which surface a capability contributes to: an icon reads faster than the dotted key.\r\nconst CAPABILITY_ICON: Record<string, LucideIcon> = {\r\n 'map.tools': LR.Map,\r\n 'viewer.legends': LR.SquareMenu,\r\n 'map.layers': LR.Layers,\r\n 'bim.tools': LR.Box,\r\n 'pointcloud.tools': LR.Grip,\r\n 'data.pages': LR.Table2,\r\n 'viewer.tabs': LR.PanelLeft,\r\n 'ui.dialogs': LR.SquareStack,\r\n}\r\n\r\ninterface Props {\r\n listing: PluginListing\r\n ability: PluginsAbility\r\n onSetInstalled: (installed: boolean) => void\r\n onSetOrgEnabled: (enabled: boolean) => void\r\n onSetAllowUserOverride: (allow: boolean) => void\r\n onSetUserEnabled: (enabled: boolean) => void\r\n onCopyError: () => void\r\n}\r\n\r\nexport function PluginCard({\r\n listing,\r\n ability,\r\n onSetInstalled,\r\n onSetOrgEnabled,\r\n onSetAllowUserOverride,\r\n onSetUserEnabled,\r\n onCopyError,\r\n}: Props) {\r\n const t = useTranslations('PluginsPage')\r\n const { manifest } = listing\r\n // From the switches, not the host: otherwise turning a plugin off leaves the badge\r\n // reading \"Running\".\r\n const status = effectiveStatus(listing)\r\n\r\n const Icon = resolvePluginIcon(manifest.icon ?? 'Puzzle')\r\n\r\n // The plugin's catalog when it ships one, its manifest when it does not — never a\r\n // raw message key.\r\n const name = usePluginMessage(manifest.slug, 'name', manifest.name)\r\n const description = usePluginMessage(manifest.slug, 'description', manifest.description ?? '')\r\n\r\n const isAdmin = ability.canConfigureOrg || ability.canInstall\r\n const userMayChoose = listing.allowUserOverride && ability.canChooseForSelf && status !== 'error'\r\n const userEnabled = listing.userEnabled ?? listing.orgEnabled\r\n\r\n return (\r\n <article\r\n className=\"grid gap-4 rounded-xl border bg-background p-5 md:grid-cols-[minmax(0,1fr)_auto]\"\r\n data-testid={`plugin-${manifest.slug}`}\r\n >\r\n <div className=\"min-w-0\">\r\n <div className=\"flex flex-wrap items-center gap-2\">\r\n <Icon\r\n aria-hidden\r\n className=\"h-5 w-5 shrink-0 text-muted-foreground\"\r\n data-testid={`plugin-icon-${manifest.slug}`}\r\n />\r\n <h2 className=\"text-lg text-foreground\">{name}</h2>\r\n <StatusBadge status={status} />\r\n {listing.bundled && (\r\n <Badge variant=\"outline\" className=\"font-normal text-muted-foreground\">\r\n {t('bundled')}\r\n </Badge>\r\n )}\r\n </div>\r\n\r\n <p className=\"mt-1 text-sm text-muted-foreground\">\r\n <code>{manifest.slug}</code>\r\n <span className=\"mx-1.5 opacity-40\">·</span>\r\n <span className=\"tabular-nums\">v{manifest.version}</span>\r\n <span className=\"mx-1.5 opacity-40\">·</span>\r\n {manifest.author || t('unknownAuthor')}\r\n </p>\r\n\r\n {description && <p className=\"mt-2 max-w-[60ch] text-sm\">{description}</p>}\r\n\r\n <div className=\"mt-3 flex flex-wrap items-center gap-1.5\">\r\n <span className=\"text-xs text-muted-foreground\">{t('capabilities')}</span>\r\n {manifest.capabilities.map(capability => (\r\n <CapabilityBadge key={capability} capability={capability} />\r\n ))}\r\n </div>\r\n\r\n {status === 'error' && listing.error && (\r\n <div className=\"mt-3 rounded-xl border border-destructive/50 bg-destructive/5 p-3\">\r\n <p className=\"flex items-center gap-1.5 text-sm font-medium text-destructive\">\r\n <LR.AlertTriangle className=\"h-4 w-4 shrink-0\" />\r\n {t('errorHeading')}\r\n </p>\r\n <p className=\"mt-1.5 overflow-x-auto text-xs\"><code>{listing.error}</code></p>\r\n <p className=\"mt-1.5 text-xs text-muted-foreground\">{t('errorHint')}</p>\r\n </div>\r\n )}\r\n\r\n {status === 'available' && (\r\n <div className=\"mt-3 rounded-xl border border-dashed p-3\">\r\n <p className=\"text-sm font-medium\">{t('trustHeading')}</p>\r\n <ul className=\"mt-1.5 list-disc pl-4 text-xs text-muted-foreground\">\r\n {listing.mountPath && <li>{t('trustMount', { path: listing.mountPath })}</li>}\r\n <li>\r\n {manifest.requiredPermissions?.length\r\n ? t('trustPermissions', { permissions: manifest.requiredPermissions.join(', ') })\r\n : t('trustNoPermissions')}\r\n </li>\r\n <li>{t('trustWarning')}</li>\r\n </ul>\r\n </div>\r\n )}\r\n </div>\r\n\r\n <div className=\"flex min-w-0 flex-col gap-2.5 md:w-[270px]\">\r\n {status === 'available' ? (\r\n ability.canInstall && (\r\n <Button size=\"sm\" onClick={() => onSetInstalled(true)}>\r\n <LR.PackagePlus className=\"mr-1.5 h-4 w-4\" />\r\n {t('addToOrg')}\r\n </Button>\r\n )\r\n ) : (\r\n <>\r\n {isAdmin ? (\r\n <ControlGroup label={t('orgGroup')} who={t('orgGroupWho')}>\r\n {ability.canInstall && (\r\n <ControlRow label={t('orgInstalled')}>\r\n <Switch\r\n checked={listing.installed}\r\n onCheckedChange={onSetInstalled}\r\n aria-label={t('orgInstalled')}\r\n />\r\n </ControlRow>\r\n )}\r\n {ability.canConfigureOrg && (\r\n <>\r\n <ControlRow label={t('orgEnabled')}>\r\n <Switch\r\n checked={listing.orgEnabled}\r\n onCheckedChange={onSetOrgEnabled}\r\n aria-label={t('orgEnabled')}\r\n />\r\n </ControlRow>\r\n <ControlRow\r\n label={t('orgAllowOverride')}\r\n hint={listing.allowUserOverride\r\n ? t('orgAllowOverrideOnHint')\r\n : t('orgAllowOverrideOffHint')}\r\n >\r\n <Switch\r\n checked={listing.allowUserOverride}\r\n onCheckedChange={onSetAllowUserOverride}\r\n aria-label={t('orgAllowOverride')}\r\n />\r\n </ControlRow>\r\n </>\r\n )}\r\n </ControlGroup>\r\n ) : (\r\n <ControlGroup label={t('orgGroup')}>\r\n <p className=\"py-1 text-sm text-muted-foreground\">{orgSummary(listing, t)}</p>\r\n </ControlGroup>\r\n )}\r\n\r\n <ControlGroup label={t('userGroup')}>\r\n {status === 'error' ? (\r\n <Note icon={LR.Minus} text={t('userNothingToRun')} />\r\n ) : userMayChoose ? (\r\n <ControlRow label={t('userRun')}>\r\n <Switch\r\n checked={userEnabled}\r\n onCheckedChange={onSetUserEnabled}\r\n aria-label={t('userRun')}\r\n />\r\n </ControlRow>\r\n ) : !ability.canChooseForSelf ? (\r\n // Not the admin lock below: nothing is locked, this reader just may\r\n // not change what runs.\r\n <Note icon={LR.Eye} text={t('userReadOnly')} />\r\n ) : (\r\n <Note icon={LR.Lock} text={listing.orgEnabled ? t('userLockedOn') : t('userLockedOff')} />\r\n )}\r\n </ControlGroup>\r\n\r\n {status === 'error' && (\r\n <Button size=\"sm\" variant=\"outline\" onClick={onCopyError}>\r\n {t('copyError')}\r\n </Button>\r\n )}\r\n </>\r\n )}\r\n </div>\r\n </article>\r\n )\r\n}\r\n\r\nfunction StatusBadge({ status }: { status: PluginListing['status'] }) {\r\n const t = useTranslations('PluginsPage')\r\n const { icon: Icon, className } = STATUS_STYLE[status]\r\n\r\n const label: Record<PluginListing['status'], string> = {\r\n running: t('statusRunning'),\r\n off: t('statusOff'),\r\n error: t('statusError'),\r\n available: t('statusAvailable'),\r\n }\r\n\r\n return (\r\n <Badge variant=\"outline\" className={cn('gap-1 font-medium', className)}>\r\n <Icon className=\"h-3.5 w-3.5\" />\r\n {label[status]}\r\n </Badge>\r\n )\r\n}\r\n\r\nfunction CapabilityBadge({ capability }: { capability: string }) {\r\n const Icon = CAPABILITY_ICON[capability] ?? LR.Puzzle\r\n\r\n return (\r\n <Badge variant=\"secondary\" className=\"gap-1 font-normal\">\r\n <Icon className=\"h-3.5 w-3.5\" />\r\n <code>{capability}</code>\r\n </Badge>\r\n )\r\n}\r\n\r\n// A bordered, faintly-tinted box so the controls read as a panel rather than loose\r\n// text, borrowing the muted token the app uses for inset surfaces.\r\nfunction ControlGroup({\r\n label,\r\n who,\r\n children,\r\n}: {\r\n label: string\r\n who?: string\r\n children: React.ReactNode\r\n}) {\r\n return (\r\n <div className=\"rounded-xl border bg-muted/30 px-3 py-2.5\">\r\n <div className=\"flex items-center gap-1.5 text-xs text-muted-foreground\">\r\n {label}\r\n {who && (\r\n <Badge variant=\"outline\" className=\"bg-background px-1.5 py-0 text-[10px] font-normal\">\r\n {who}\r\n </Badge>\r\n )}\r\n </div>\r\n <Separator className=\"my-2\" />\r\n {children}\r\n </div>\r\n )\r\n}\r\n\r\n/** Rows inside a group are separated, so three switches do not run together. */\r\nfunction ControlRow({\r\n label,\r\n hint,\r\n children,\r\n}: {\r\n label: string\r\n hint?: string\r\n children: React.ReactNode\r\n}) {\r\n return (\r\n <div className=\"flex items-center justify-between gap-3 py-1.5 [&+&]:border-t [&+&]:border-border/60\">\r\n <span className=\"text-sm leading-tight\">\r\n {label}\r\n {hint && <small className=\"mt-0.5 block text-xs text-muted-foreground\">{hint}</small>}\r\n </span>\r\n {children}\r\n </div>\r\n )\r\n}\r\n\r\nfunction Note({ icon: Icon, text }: { icon: LucideIcon; text: string }) {\r\n return (\r\n <p className=\"flex items-start gap-1.5 py-1 text-sm text-muted-foreground\">\r\n <Icon className=\"mt-0.5 h-4 w-4 shrink-0\" />\r\n <span>{text}</span>\r\n </p>\r\n )\r\n}\r\n\r\n/** What a non-admin is told about the organization's decision. */\r\nfunction orgSummary(\r\n listing: PluginListing,\r\n t: ReturnType<typeof useTranslations<'PluginsPage'>>,\r\n): string {\r\n if (!listing.allowUserOverride) {\r\n return listing.orgEnabled ? t('orgReadOnlyForced') : t('orgReadOnlyBlocked')\r\n }\r\n return listing.orgEnabled ? t('orgReadOnlyOnOptional') : t('orgReadOnlyOffOptional')\r\n}\r\n"],"mappings":";AAgGQ,SAiFU,UAhFR,KADF;AA3FR,YAAY,QAAQ;AACpB,SAAS,uBAAuB;AAGhC,SAAS,yBAAyB;AAClC,SAAS,wBAAwB;AACjC,SAAS,UAAU;AACnB,SAAS,aAAa;AACtB,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAC1B,SAAS,cAAc;AAEvB,SAAS,uBAAuB;AAMhC,MAAM,eAAyF;AAAA,EAC7F,SAAS;AAAA,IACP,MAAM,GAAG;AAAA,IACT,WAAW;AAAA,EACb;AAAA,EACA,KAAK;AAAA,IACH,MAAM,GAAG;AAAA,IACT,WAAW;AAAA,EACb;AAAA,EACA,OAAO;AAAA,IACL,MAAM,GAAG;AAAA,IACT,WAAW;AAAA,EACb;AAAA,EACA,WAAW;AAAA,IACT,MAAM,GAAG;AAAA,IACT,WAAW;AAAA,EACb;AACF;AAGA,MAAM,kBAA8C;AAAA,EAClD,aAAa,GAAG;AAAA,EAChB,kBAAkB,GAAG;AAAA,EACrB,cAAc,GAAG;AAAA,EACjB,aAAa,GAAG;AAAA,EAChB,oBAAoB,GAAG;AAAA,EACvB,cAAc,GAAG;AAAA,EACjB,eAAe,GAAG;AAAA,EAClB,cAAc,GAAG;AACnB;AAYO,SAAS,WAAW;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAU;AAxEV;AAyEE,QAAM,IAAI,gBAAgB,aAAa;AACvC,QAAM,EAAE,SAAS,IAAI;AAGrB,QAAM,SAAS,gBAAgB,OAAO;AAEtC,QAAM,OAAO,mBAAkB,cAAS,SAAT,YAAiB,QAAQ;AAIxD,QAAM,OAAO,iBAAiB,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,+DACX;AAAA,wBAAC,QAAK,WAAU,2BAA0B;AAAA,IAC1C,oBAAC,UAAM,gBAAK;AAAA,KACd;AAEJ;AAGA,SAAS,WACP,SACA,GACQ;AACR,MAAI,CAAC,QAAQ,mBAAmB;AAC9B,WAAO,QAAQ,aAAa,EAAE,mBAAmB,IAAI,EAAE,oBAAoB;AAAA,EAC7E;AACA,SAAO,QAAQ,aAAa,EAAE,uBAAuB,IAAI,EAAE,wBAAwB;AACrF;","names":[]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SpaceDialog.d.ts","sourceRoot":"","sources":["../../../../../../src/core/plugins/hello-bim/src/components/SpaceDialog.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAQ9B,UAAU,KAAK;IACb,KAAK,EAAE,MAAM,IAAI,CAAA;IACjB,yFAAyF;IACzF,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,KAAK,qBAyErD"}
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import * as React from "react";
4
- import { useBimViewer } from "../../sdk/bimViewer";
5
- import { Button } from "../../sdk/components";
6
- import { usePluginTranslations } from "../../sdk/messages";
4
+ import { useBimViewer } from "@collabdt/core/plugins-sdk/bimViewer";
5
+ import { Button } from "@collabdt/core/plugins-sdk/components";
6
+ import { usePluginTranslations } from "@collabdt/core/plugins-sdk/messages";
7
7
  import { toModelIdMap, useSpaces } from "../spaces";
8
8
  function SpaceDialog({ close, spaceKey }) {
9
9
  var _a;
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../src/core/plugins/hello-bim/src/components/SpaceDialog.tsx"],"sourcesContent":["'use client'\r\n\r\n// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport * as React from 'react'\r\n\r\nimport { useBimViewer } from '@collabdt/core/plugins-sdk/bimViewer'\r\nimport { Button } from '@collabdt/core/plugins-sdk/components'\r\nimport { usePluginTranslations } from '@collabdt/core/plugins-sdk/messages'\r\n\r\nimport { toModelIdMap, useSpaces } from '../spaces'\r\n\r\ninterface Props {\r\n close: () => void\r\n /** Supplied by whichever surface opened this — the sidebar tab, or the toolbar panel. */\r\n spaceKey?: string\r\n}\r\n\r\n/**\r\n * One space in full, including the IFC attributes the plugin does not store. Core owns the\r\n * overlay and Escape; this renders the body, and outlives whatever opened it.\r\n */\r\nexport function SpaceDialog({ close, spaceKey }: Props) {\r\n const t = usePluginTranslations()\r\n const { getProperties } = useBimViewer()\r\n const { spaces, selected } = useSpaces()\r\n\r\n const space = spaceKey\r\n ? spaces.find(candidate => candidate.key === spaceKey) ?? null\r\n : selected\r\n\r\n const [attributes, setAttributes] = React.useState<Record<string, unknown> | null>(null)\r\n\r\n React.useEffect(() => {\r\n if (!space) return\r\n let cancelled = false\r\n\r\n void getProperties(toModelIdMap([space]))\r\n .then((results) => {\r\n if (!cancelled) setAttributes(results[0] ?? {})\r\n })\r\n .catch(() => {\r\n if (!cancelled) setAttributes({})\r\n })\r\n\r\n return () => {\r\n cancelled = true\r\n }\r\n }, [space, getProperties])\r\n\r\n if (!space) {\r\n return (\r\n <div className=\"flex flex-col gap-4\">\r\n <p className=\"text-sm text-muted-foreground\">{t('gone', 'That space is no longer loaded.')}</p>\r\n <Button className=\"self-end\" onClick={close}>{t('close', 'Close')}</Button>\r\n </div>\r\n )\r\n }\r\n\r\n return (\r\n <div className=\"flex flex-col gap-4\">\r\n <div className=\"flex items-center gap-2\">\r\n <span\r\n aria-hidden=\"true\"\r\n className=\"inline-block h-4 w-4 rounded-full border border-white\"\r\n style={{ backgroundColor: space.colour }}\r\n />\r\n <p className=\"font-medium\">{space.name}</p>\r\n </div>\r\n\r\n <dl className=\"text-sm\">\r\n <Row label={t('ifcNameLabel', 'Name in the model')} value={space.ifcName} />\r\n <Row label={t('modelLabel', 'Model')} value={space.modelId} />\r\n <Row label={t('idLabel', 'Element id')} value={String(space.localId)} />\r\n <Row label={t('colour', 'Colour')} value={space.colour} />\r\n </dl>\r\n\r\n <div>\r\n <p className=\"mb-1 text-xs font-medium\">{t('attributes', 'IFC attributes')}</p>\r\n {attributes === null ? (\r\n <p className=\"text-xs text-muted-foreground\">{t('loading', 'Reading the model…')}</p>\r\n ) : (\r\n <dl className=\"max-h-48 overflow-y-auto text-xs\">\r\n {Object.entries(attributes)\r\n .filter(([key]) => key !== 'modelId' && key !== 'localId')\r\n .map(([key, value]) => (\r\n <Row key={key} label={key} value={readable(value)} />\r\n ))}\r\n </dl>\r\n )}\r\n </div>\r\n\r\n <Button className=\"self-end\" onClick={close}>{t('close', 'Close')}</Button>\r\n </div>\r\n )\r\n}\r\n\r\n/** Only primitives render; nested objects would come out as `[object Object]`. */\r\nfunction readable(value: unknown): string {\r\n const unwrapped = value && typeof value === 'object' && 'value' in value\r\n ? (value as { value: unknown }).value\r\n : value\r\n\r\n switch (typeof unwrapped) {\r\n case 'string': return unwrapped\r\n case 'number':\r\n case 'boolean': return String(unwrapped)\r\n default: return ''\r\n }\r\n}\r\n\r\nfunction Row({ label, value }: { label: string; value: string }) {\r\n return (\r\n <div className=\"flex items-baseline justify-between gap-3 py-0.5\">\r\n <dt className=\"shrink-0 text-muted-foreground\">{label}</dt>\r\n <dd className=\"truncate text-right\">{value}</dd>\r\n </div>\r\n )\r\n}\r\n"],"mappings":";AAqDM,SACE,KADF;AAhDN,YAAY,WAAW;AAEvB,SAAS,oBAAoB;AAC7B,SAAS,cAAc;AACvB,SAAS,6BAA6B;AAEtC,SAAS,cAAc,iBAAiB;AAYjC,SAAS,YAAY,EAAE,OAAO,SAAS,GAAU;AAvBxD;AAwBE,QAAM,IAAI,sBAAsB;AAChC,QAAM,EAAE,cAAc,IAAI,aAAa;AACvC,QAAM,EAAE,QAAQ,SAAS,IAAI,UAAU;AAEvC,QAAM,QA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AAE,WAAW,YAAY,GAAG,OAAO,OAAO,MAAM,OAAO,GAAG;AAAA,MACtE,oBAAC,OAAI,OAAO,EAAE,UAAU,QAAQ,GAAG,OAAO,MAAM,QAAQ;AAAA,OAC1D;AAAA,IAEA,qBAAC,SACC;AAAA,0BAAC,OAAE,WAAU,4BAA4B,YAAE,cAAc,gBAAgB,GAAE;AAAA,MAC1E,eAAe,OACd,oBAAC,OAAE,WAAU,iCAAiC,YAAE,WAAW,yBAAoB,GAAE,IAEjF,oBAAC,QAAG,WAAU,oCACX,iBAAO,QAAQ,UAAU,EACvB,OAAO,CAAC,CAAC,GAAG,MAAM,QAAQ,aAAa,QAAQ,SAAS,EACxD,IAAI,CAAC,CAAC,KAAK,KAAK,MACf,oBAAC,OAAc,OAAO,KAAK,OAAO,SAAS,KAAK,KAAtC,GAAyC,CACpD,GACL;AAAA,OAEJ;AAAA,IAEA,oBAAC,UAAO,WAAU,YAAW,SAAS,OAAQ,YAAE,SAAS,OAAO,GAAE;AAAA,KACpE;AAEJ;AAGA,SAAS,SAAS,OAAwB;AACxC,QAAM,YAAY,SAAS,OAAO,UAAU,YAAY,WAAW,QAC9D,MAA6B,QAC9B;AAEJ,UAAQ,OAAO,WAAW;AAAA,IACxB,KAAK;AAAU,aAAO;AAAA,IACtB,KAAK;AAAA,IACL,KAAK;AAAW,aAAO,OAAO,SAAS;AAAA,IACvC;AAAS,aAAO;AAAA,EAClB;AACF;AAEA,SAAS,IAAI,EAAE,OAAO,MAAM,GAAqC;AAC/D,SACE,qBAAC,SAAI,WAAU,oDACb;AAAA,wBAAC,QAAG,WAAU,kCAAkC,iBAAM;AAAA,IACtD,oBAAC,QAAG,WAAU,uBAAuB,iBAAM;AAAA,KAC7C;AAEJ;","names":["_a"]}
@@ -1,4 +1,4 @@
1
- import type { LegendRow } from '../../sdk/types';
1
+ import type { LegendRow } from '@collabdt/plugin-kit/types/legend';
2
2
  /**
3
3
  * One row per space, live as they are renamed and recoloured. The legend probe is mounted for
4
4
  * as long as the viewer, so this is also what discovers the model's spaces.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SpacesLegend.d.ts","sourceRoot":"","sources":["../../../../../../src/core/plugins/hello-bim/src/components/SpacesLegend.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAA;AAElE;;;GAGG;AACH,wBAAgB,eAAe,IAAI;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,SAAS,EAAE,CAAA;CAAE,CASxF"}
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { usePluginTranslations } from "../../sdk/messages";
2
+ import { usePluginTranslations } from "@collabdt/core/plugins-sdk/messages";
3
3
  import { useSpaces } from "../spaces";
4
4
  function useSpacesLegend() {
5
5
  const t = usePluginTranslations();
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../src/core/plugins/hello-bim/src/components/SpacesLegend.ts"],"sourcesContent":["'use client'\r\n\r\n// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport { usePluginTranslations } from '@collabdt/core/plugins-sdk/messages'\r\n\r\nimport { useSpaces } from '../spaces'\r\n\r\nimport type { LegendRow } from '@collabdt/plugin-kit/types/legend'\r\n\r\n/**\r\n * One row per space, live as they are renamed and recoloured. The legend probe is mounted for\r\n * as long as the viewer, so this is also what discovers the model's spaces.\r\n */\r\nexport function useSpacesLegend(): { active: boolean; title?: string; rows: LegendRow[] } {\r\n const t = usePluginTranslations()\r\n const { spaces } = useSpaces()\r\n\r\n return {\r\n active: spaces.length > 0,\r\n title: t('legendTitle', 'Spaces'),\r\n rows: spaces.map<LegendRow>(space => ({ label: space.name, color: space.colour })),\r\n }\r\n}\r\n"],"mappings":";AAKA,SAAS,6BAA6B;AAEtC,SAAS,iBAAiB;AAQnB,SAAS,kBAA0E;AACxF,QAAM,IAAI,sBAAsB;AAChC,QAAM,EAAE,OAAO,IAAI,UAAU;AAE7B,SAAO;AAAA,IACL,QAAQ,OAAO,SAAS;AAAA,IACxB,OAAO,EAAE,eAAe,QAAQ;AAAA,IAChC,MAAM,OAAO,IAAe,YAAU,EAAE,OAAO,MAAM,MAAM,OAAO,MAAM,OAAO,EAAE;AAAA,EACnF;AACF;","names":[]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SpacesTab.d.ts","sourceRoot":"","sources":["../../../../../../src/core/plugins/hello-bim/src/components/SpacesTab.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAe9B,4FAA4F;AAC5F,wBAAgB,SAAS,sBAgJxB"}
@@ -1,11 +1,11 @@
1
1
  "use client";
2
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
3
  import * as React from "react";
4
- import { MAP_COLOUR_PALETTE } from "../../sdk";
5
- import { useBimViewer } from "../../sdk/bimViewer";
6
- import { Button, Input, Separator } from "../../sdk/components";
7
- import { usePluginTranslations } from "../../sdk/messages";
8
- import { usePluginDialogs } from "../../sdk/ui";
4
+ import { MAP_COLOUR_PALETTE } from "@collabdt/core/plugins-sdk";
5
+ import { useBimViewer } from "@collabdt/core/plugins-sdk/bimViewer";
6
+ import { Button, Input, Separator } from "@collabdt/core/plugins-sdk/components";
7
+ import { usePluginTranslations } from "@collabdt/core/plugins-sdk/messages";
8
+ import { usePluginDialogs } from "@collabdt/core/plugins-sdk/ui";
9
9
  import { toModelIdMap, useSpacePainting, useSpaces } from "../spaces";
10
10
  import { CheckIcon, Glyph, PlusIcon, XIcon } from "./icons";
11
11
  const SWATCHES = 8;
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../src/core/plugins/hello-bim/src/components/SpacesTab.tsx"],"sourcesContent":["'use client'\r\n\r\n// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport * as React from 'react'\r\n\r\nimport { MAP_COLOUR_PALETTE } from '@collabdt/core/plugins-sdk'\r\nimport { useBimViewer } from '@collabdt/core/plugins-sdk/bimViewer'\r\nimport { Button, Input, Separator } from '@collabdt/core/plugins-sdk/components'\r\nimport { usePluginTranslations } from '@collabdt/core/plugins-sdk/messages'\r\nimport { usePluginDialogs } from '@collabdt/core/plugins-sdk/ui'\r\n\r\nimport { toModelIdMap, useSpacePainting, useSpaces } from '../spaces'\r\n\r\nimport { CheckIcon, Glyph, PlusIcon, XIcon } from './icons'\r\n\r\n/** How many palette entries to offer as swatches before the free colour input. */\r\nconst SWATCHES = 8\r\n\r\n/** The spaces in the BIM sidebar. Renaming and colouring live here, not in the dropdown. */\r\nexport function SpacesTab() {\r\n const t = usePluginTranslations()\r\n const { select, isolate, showAll, fitToSelection, setItemsVisible } = useBimViewer()\r\n const { spaces, isLoading, lastError, selected, select: choose, rename, setColour, reset } = useSpaces()\r\n const { open: openDialog } = usePluginDialogs()\r\n const { painted, setPainted } = useSpacePainting()\r\n\r\n const showOnly = async (key: string) => {\r\n const space = spaces.find(candidate => candidate.key === key)\r\n if (!space) return\r\n\r\n const items = toModelIdMap([space])\r\n await setItemsVisible(items, true)\r\n await isolate(items)\r\n await select(items)\r\n await fitToSelection()\r\n }\r\n\r\n if (isLoading && spaces.length === 0) {\r\n return <p className=\"p-4 text-sm text-muted-foreground\">{t('loading', 'Reading the model…')}</p>\r\n }\r\n\r\n if (spaces.length === 0) {\r\n return (\r\n <p className=\"p-4 text-sm text-muted-foreground\">\r\n {t('empty', 'This model has no IfcSpaces.')}\r\n </p>\r\n )\r\n }\r\n\r\n return (\r\n <div className=\"flex flex-col gap-3 p-4\">\r\n <div className=\"flex gap-2\">\r\n <Button\r\n size=\"sm\"\r\n variant={painted ? 'default' : 'outline'}\r\n aria-pressed={painted}\r\n className=\"flex-1\"\r\n onClick={() => setPainted(current => !current)}\r\n >\r\n {painted ? t('clearColours', 'Clear colours') : t('colourSpaces', 'Colour the spaces')}\r\n </Button>\r\n </div>\r\n\r\n <Button size=\"sm\" variant=\"outline\" onClick={() => { void showAll() }}>\r\n {t('showAllElements', 'Show all elements')}\r\n </Button>\r\n\r\n {lastError && (\r\n <p className=\"rounded-md bg-destructive/10 px-2 py-1 text-xs text-destructive\">\r\n {t('saveFailed', 'Could not save: ')}{lastError}\r\n </p>\r\n )}\r\n\r\n <ul className=\"flex flex-col gap-1\">\r\n {spaces.map(space => (\r\n <li key={space.key}>\r\n <button\r\n type=\"button\"\r\n onClick={() => { choose(space.key); void select(toModelIdMap([space])) }}\r\n className={`flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm ${\r\n selected?.key === space.key ? 'bg-accent' : 'hover:bg-accent/50'\r\n }`}\r\n >\r\n <span\r\n aria-hidden=\"true\"\r\n className=\"inline-block h-3 w-3 shrink-0 rounded-full border border-white\"\r\n style={{ backgroundColor: space.colour }}\r\n />\r\n <span className=\"flex-1 truncate\">{space.name}</span>\r\n </button>\r\n </li>\r\n ))}\r\n </ul>\r\n\r\n {selected && (\r\n <>\r\n <Separator />\r\n\r\n <NameField\r\n key={selected.key}\r\n name={selected.name}\r\n label={t('nameLabel', 'Name')}\r\n saveLabel={t('saveName', 'Save name')}\r\n revertLabel={t('revertName', 'Discard the change')}\r\n onCommit={name => { void rename(selected.key, name) }}\r\n />\r\n\r\n <p className=\"text-xs text-muted-foreground\">\r\n {t('ifcName', 'In the model: ')}{selected.ifcName}\r\n </p>\r\n\r\n <div className=\"flex flex-col gap-2\">\r\n <p className=\"text-xs font-medium\">{t('colour', 'Colour')}</p>\r\n\r\n <div className=\"flex flex-wrap items-center gap-1\">\r\n {MAP_COLOUR_PALETTE.slice(0, SWATCHES).map(colour => (\r\n <button\r\n key={colour}\r\n type=\"button\"\r\n aria-label={colour}\r\n aria-pressed={selected.colour === colour}\r\n onClick={() => { void setColour(selected.key, colour) }}\r\n className={`h-6 w-6 rounded-full border-2 ${\r\n selected.colour === colour ? 'border-foreground' : 'border-transparent'\r\n }`}\r\n style={{ backgroundColor: colour }}\r\n />\r\n ))}\r\n\r\n <label\r\n title={t('customColour', 'Pick any colour')}\r\n className=\"relative ml-1 flex h-6 w-6 shrink-0 cursor-pointer items-center justify-center rounded-full border border-input bg-background text-muted-foreground hover:text-foreground\"\r\n >\r\n <PlusIcon />\r\n <input\r\n type=\"color\"\r\n value={selected.colour}\r\n onChange={event => { void setColour(selected.key, event.target.value) }}\r\n className=\"absolute inset-0 h-full w-full cursor-pointer opacity-0\"\r\n />\r\n <span className=\"sr-only\">{t('customColour', 'Pick any colour')}</span>\r\n </label>\r\n </div>\r\n </div>\r\n\r\n <div className=\"flex gap-2\">\r\n <Button size=\"sm\" variant=\"outline\" className=\"flex-1\" onClick={() => { void showOnly(selected.key) }}>\r\n {t('isolateSpace', 'Isolate space')}\r\n </Button>\r\n <Button size=\"sm\" variant=\"outline\" onClick={() => openDialog('detail', { spaceKey: selected.key })}>\r\n {t('details', 'Details')}\r\n </Button>\r\n </div>\r\n\r\n {selected.annotated && (\r\n <Button size=\"sm\" variant=\"ghost\" className=\"self-start\" onClick={() => { void reset(selected.key) }}>\r\n {t('reset', 'Reset to the model\\'s name and colour')}\r\n </Button>\r\n )}\r\n </>\r\n )}\r\n </div>\r\n )\r\n}\r\n\r\n/**\r\n * The name, edited locally and saved only when confirmed. Laid out like the app's other\r\n * inline text edits: the field takes the row, then a confirm and a revert.\r\n */\r\nfunction NameField({\r\n name,\r\n label,\r\n saveLabel,\r\n revertLabel,\r\n onCommit,\r\n}: {\r\n name: string\r\n label: string\r\n saveLabel: string\r\n revertLabel: string\r\n onCommit: (name: string) => void\r\n}) {\r\n const [draft, setDraft] = React.useState(name)\r\n const inputId = React.useId()\r\n\r\n const trimmed = draft.trim()\r\n const canSave = trimmed.length > 0 && trimmed !== name\r\n\r\n const commit = () => {\r\n if (!canSave) return\r\n onCommit(trimmed)\r\n }\r\n\r\n return (\r\n <div className=\"flex flex-col gap-1\">\r\n <label className=\"text-xs font-medium\" htmlFor={inputId}>{label}</label>\r\n\r\n <div className=\"flex items-center gap-1\">\r\n <Input\r\n id={inputId}\r\n value={draft}\r\n onChange={event => setDraft(event.target.value)}\r\n onKeyDown={(event) => {\r\n if (event.key === 'Enter') { event.preventDefault(); commit() }\r\n if (event.key === 'Escape') setDraft(name)\r\n }}\r\n className=\"h-8 flex-1\"\r\n />\r\n\r\n <Button\r\n size=\"icon\"\r\n className=\"h-8 w-8 shrink-0 p-0\"\r\n disabled={!canSave}\r\n aria-label={saveLabel}\r\n title={saveLabel}\r\n onClick={commit}\r\n >\r\n <Glyph><CheckIcon /></Glyph>\r\n </Button>\r\n\r\n <Button\r\n size=\"icon\"\r\n variant=\"ghost\"\r\n className=\"h-8 w-8 shrink-0 p-0\"\r\n disabled={!canSave}\r\n aria-label={revertLabel}\r\n title={revertLabel}\r\n onClick={() => setDraft(name)}\r\n >\r\n <Glyph><XIcon /></Glyph>\r\n </Button>\r\n </div>\r\n </div>\r\n )\r\n}\r\n"],"mappings":";AAwCW,SAyDH,UAzDG,KA8BH,YA9BG;AAnCX,YAAY,WAAW;AAEvB,SAAS,0BAA0B;AACnC,SAAS,oBAAoB;AAC7B,SAAS,QAAQ,OAAO,iBAAiB;AACzC,SAAS,6BAA6B;AACtC,SAAS,wBAAwB;AAEjC,SAAS,cAAc,kBAAkB,iBAAiB;AAE1D,SAAS,WAAW,OAAO,UAAU,aAAa;AAGlD,MAAM,WAAW;AAGV,SAAS,YAAY;AAC1B,QAAM,IAAI,sBAAsB;AAChC,QAAM,EAAE,QAAQ,SAAS,SAAS,gBAAgB,gBAAgB,IAAI,aAAa;AACnF,QAAM,EAAE,QAAQ,WAAW,WAAW,UAAU,QAAQ,QAAQ,QAAQ,WAAW,MAAM,IAAI,UAAU;AACvG,QAAM,EAAE,MAAM,WAAW,IAAI,iBAAiB;AAC9C,QAAM,EAAE,SAAS,WAAW,IAAI,iBAAiB;AAEjD,QAAM,WAAW,OAAO,QAAgB;AACtC,UAAM,QAAQ,OAAO,KAAK,eAAa,UAAU,Q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AAU,iBAAM;AAAA,IAEhE,qBAAC,SAAI,WAAU,2BACb;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,IAAI;AAAA,UACJ,OAAO;AAAA,UACP,UAAU,WAAS,SAAS,MAAM,OAAO,KAAK;AAAA,UAC9C,WAAW,CAAC,UAAU;AACpB,gBAAI,MAAM,QAAQ,SAAS;AAAE,oBAAM,eAAe;AAAG,qBAAO;AAAA,YAAE;AAC9D,gBAAI,MAAM,QAAQ,SAAU,UAAS,IAAI;AAAA,UAC3C;AAAA,UACA,WAAU;AAAA;AAAA,MACZ;AAAA,MAEA;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,WAAU;AAAA,UACV,UAAU,CAAC;AAAA,UACX,cAAY;AAAA,UACZ,OAAO;AAAA,UACP,SAAS;AAAA,UAET,8BAAC,SAAM,8BAAC,aAAU,GAAE;AAAA;AAAA,MACtB;AAAA,MAEA;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,SAAQ;AAAA,UACR,WAAU;AAAA,UACV,UAAU,CAAC;AAAA,UACX,cAAY;AAAA,UACZ,OAAO;AAAA,UACP,SAAS,MAAM,SAAS,IAAI;AAAA,UAE5B,8BAAC,SAAM,8BAAC,SAAM,GAAE;AAAA;AAAA,MAClB;AAAA,OACF;AAAA,KACF;AAEJ;","names":[]}
@@ -1,5 +1,4 @@
1
- import type { BimToolProps } from '../../sdk/bimViewer';
2
- import type { ToolbarToolProps } from '../../sdk/types';
1
+ import type { BimToolProps, ToolbarToolProps } from '@collabdt/plugin-kit/types/bim';
3
2
  /**
4
3
  * Three things worth one click. Renaming and colouring live in the sidebar tab: this panel is
5
4
  * a dropdown that closes on the next click. The viewer arrives as props, as the host intends.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SpacesTool.d.ts","sourceRoot":"","sources":["../../../../../../src/core/plugins/hello-bim/src/components/SpacesTool.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AAEpF;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,OAAO,EACP,eAAe,EACf,OAAO,EACP,cAAc,EACd,MAAM,GACP,EAAE,gBAAgB,GAAG,YAAY,+BAsDjC"}
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
- import { Button, Separator } from "../../sdk/components";
4
- import { usePluginTranslations } from "../../sdk/messages";
3
+ import { Button, Separator } from "@collabdt/core/plugins-sdk/components";
4
+ import { usePluginTranslations } from "@collabdt/core/plugins-sdk/messages";
5
5
  import { toModelIdMap, useSpacePainting, useSpaces } from "../spaces";
6
6
  function SpacesTool({
7
7
  modelIds,
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../src/core/plugins/hello-bim/src/components/SpacesTool.tsx"],"sourcesContent":["'use client'\r\n\r\n// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport { Button, Separator } from '@collabdt/core/plugins-sdk/components'\r\nimport { usePluginTranslations } from '@collabdt/core/plugins-sdk/messages'\r\n\r\nimport { toModelIdMap, useSpacePainting, useSpaces } from '../spaces'\r\n\r\nimport type { BimToolProps, ToolbarToolProps } from '@collabdt/plugin-kit/types/bim'\r\n\r\n/**\r\n * Three things worth one click. Renaming and colouring live in the sidebar tab: this panel is\r\n * a dropdown that closes on the next click. The viewer arrives as props, as the host intends.\r\n */\r\nexport function SpacesTool({\r\n modelIds,\r\n isolate,\r\n setItemsVisible,\r\n showAll,\r\n fitToSelection,\r\n select,\r\n}: ToolbarToolProps & BimToolProps) {\r\n const t = usePluginTranslations()\r\n const { spaces, isLoading } = useSpaces()\r\n const { painted, setPainted } = useSpacePainting()\r\n\r\n const items = () => toModelIdMap(spaces)\r\n\r\n const isolateSpaces = async () => {\r\n if (spaces.length === 0) return\r\n\r\n await setItemsVisible(items(), true)\r\n await isolate(items())\r\n await select(items())\r\n await fitToSelection()\r\n }\r\n\r\n const reset = async () => {\r\n setPainted(false)\r\n await showAll()\r\n }\r\n\r\n return (\r\n <div className=\"w-60 p-1\">\r\n <p className=\"px-2 py-1 text-sm font-medium\">{t('title', 'Spaces')}</p>\r\n <Separator className=\"my-1\" />\r\n\r\n {modelIds.length === 0 ? (\r\n <p className=\"px-2 py-1 text-sm text-muted-foreground\">\r\n {t('noModel', 'Load a model to see its spaces.')}\r\n </p>\r\n ) : isLoading && spaces.length === 0 ? (\r\n <p className=\"px-2 py-1 text-sm text-muted-foreground\">\r\n {t('loading', 'Reading the model…')}\r\n </p>\r\n ) : spaces.length === 0 ? (\r\n <p className=\"px-2 py-1 text-sm text-muted-foreground\">\r\n {t('empty', 'This model has no IfcSpaces.')}\r\n </p>\r\n ) : (\r\n <>\r\n <p className=\"px-2 pb-1 text-xs text-muted-foreground\">\r\n {t('count', 'Spaces in this model: ')}{spaces.length}\r\n </p>\r\n\r\n <Item\r\n label={painted ? t('clearColours', 'Clear colours') : t('colourSpaces', 'Colour the spaces')}\r\n onClick={() => setPainted(current => !current)}\r\n />\r\n <Item label={t('isolateSpaces', 'Isolate spaces')} onClick={() => { void isolateSpaces() }} />\r\n <Item label={t('resetView', 'Reset the view')} onClick={() => { void reset() }} />\r\n </>\r\n )}\r\n </div>\r\n )\r\n}\r\n\r\nfunction Item({ label, onClick }: { label: string; onClick: () => void }) {\r\n return (\r\n <Button\r\n size=\"sm\"\r\n variant=\"ghost\"\r\n className=\"w-full justify-start truncate font-normal\"\r\n onClick={onClick}\r\n >\r\n {label}\r\n </Button>\r\n )\r\n}\r\n"],"mappings":";AA8CM,SAgBE,UAhBF,KAiBI,YAjBJ;AAzCN,SAAS,QAAQ,iBAAiB;AAClC,SAAS,6BAA6B;AAEtC,SAAS,cAAc,kBAAkB,iBAAiB;AAQnD,SAAS,WAAW;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAC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,SAAS,MAAM;AAAE,aAAK,MAAM;AAAA,MAAE,GAAG;AAAA,OAClF;AAAA,KAEJ;AAEJ;AAEA,SAAS,KAAK,EAAE,OAAO,QAAQ,GAA2C;AACxE,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL,SAAQ;AAAA,MACR,WAAU;AAAA,MACV;AAAA,MAEC;AAAA;AAAA,EACH;AAEJ;","names":[]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../../../../../src/core/plugins/hello-bim/src/components/icons.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B;;;GAGG;AACH,wBAAgB,KAAK,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,qBAehE;AAED,wBAAgB,SAAS,sBAExB;AAED,wBAAgB,KAAK,sBAEpB;AAED,wFAAwF;AACxF,wBAAgB,QAAQ,sBAevB"}
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../src/core/plugins/hello-bim/src/components/icons.tsx"],"sourcesContent":["'use client'\r\n\r\n// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport * as React from 'react'\r\n\r\n/**\r\n * Drawn here: `lucide-react` is unshimmed, so a plugin cannot import it. Icon *names* work in\r\n * registrations, where the host resolves them. Labels live on each button's aria-label.\r\n */\r\nexport function Glyph({ children }: { children: React.ReactNode }) {\r\n return (\r\n <svg\r\n viewBox=\"0 0 24 24\"\r\n className=\"h-4 w-4\"\r\n fill=\"none\"\r\n stroke=\"currentColor\"\r\n strokeWidth=\"2\"\r\n strokeLinecap=\"round\"\r\n strokeLinejoin=\"round\"\r\n aria-hidden=\"true\"\r\n >\r\n {children}\r\n </svg>\r\n )\r\n}\r\n\r\nexport function CheckIcon() {\r\n return <path d=\"M20 6 9 17l-5-5\" />\r\n}\r\n\r\nexport function XIcon() {\r\n return <><path d=\"M18 6 6 18\" /><path d=\"m6 6 12 12\" /></>\r\n}\r\n\r\n/** Smaller than the button glyphs — it sits inside a 24px swatch, not a 32px button. */\r\nexport function PlusIcon() {\r\n return (\r\n <svg\r\n viewBox=\"0 0 24 24\"\r\n className=\"h-3 w-3\"\r\n fill=\"none\"\r\n stroke=\"currentColor\"\r\n strokeWidth=\"2.5\"\r\n strokeLinecap=\"round\"\r\n aria-hidden=\"true\"\r\n >\r\n <path d=\"M5 12h14\" />\r\n <path d=\"M12 5v14\" />\r\n </svg>\r\n )\r\n}\r\n"],"mappings":";AAaI,SAoBK,UApBL,KAoBK,YApBL;AAFG,SAAS,MAAM,EAAE,SAAS,GAAkC;AACjE,SACE;AAAA,IAAC;AAAA;AAAA,MACC,SAAQ;AAAA,MACR,WAAU;AAAA,MACV,MAAK;AAAA,MACL,QAAO;AAAA,MACP,aAAY;AAAA,MACZ,eAAc;AAAA,MACd,gBAAe;AAAA,MACf,eAAY;AAAA,MAEX;AAAA;AAAA,EACH;AAEJ;AAEO,SAAS,YAAY;AAC1B,SAAO,oBAAC,UAAK,GAAE,mBAAkB;AACnC;AAEO,SAAS,QAAQ;AACtB,SAAO,iCAAE;AAAA,wBAAC,UAAK,GAAE,cAAa;AAAA,IAAE,oBAAC,UAAK,GAAE,cAAa;AAAA,KAAE;AACzD;AAGO,SAAS,WAAW;AACzB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,SAAQ;AAAA,MACR,WAAU;AAAA,MACV,MAAK;AAAA,MACL,QAAO;AAAA,MACP,aAAY;AAAA,MACZ,eAAc;AAAA,MACd,eAAY;AAAA,MAEZ;AAAA,4BAAC,UAAK,GAAE,YAAW;AAAA,QACnB,oBAAC,UAAK,GAAE,YAAW;AAAA;AAAA;AAAA,EACrB;AAEJ;","names":[]}