@acorex-platform/module-workplacesafety-management-client 0.0.38 → 0.0.46

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 (125) hide show
  1. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-acorex-platform-module-workplacesafety-management-client-Ds0Fkspp.mjs → acorex-platform-module-workplacesafety-management-client-acorex-platform-module-workplacesafety-management-client-C3a08xjg.mjs} +79 -32
  2. package/fesm2022/acorex-platform-module-workplacesafety-management-client-acorex-platform-module-workplacesafety-management-client-C3a08xjg.mjs.map +1 -0
  3. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-control-hierarchy-levels.mjs +19 -5
  4. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-control-hierarchy-levels.mjs.map +1 -1
  5. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-control-measure.mjs +19 -5
  6. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-control-measure.mjs.map +1 -1
  7. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-hazard-ppe-rule.mjs +19 -5
  8. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-hazard-ppe-rule.mjs.map +1 -1
  9. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-hazard-register.mjs +19 -5
  10. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-hazard-register.mjs.map +1 -1
  11. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-hazard-risk.mjs +22 -72
  12. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-hazard-risk.mjs.map +1 -1
  13. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-hazard.mjs +20 -6
  14. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-hazard.mjs.map +1 -1
  15. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-ppe-item.mjs +19 -5
  16. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-ppe-item.mjs.map +1 -1
  17. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan-activity.mjs +1516 -0
  18. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan-activity.mjs.map +1 -0
  19. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan-section.mjs +82 -12
  20. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan-section.mjs.map +1 -1
  21. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan-type-section.mjs +82 -12
  22. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan-type-section.mjs.map +1 -1
  23. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan-type.mjs +19 -5
  24. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan-type.mjs.map +1 -1
  25. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan.mjs +39 -6
  26. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan.mjs.map +1 -1
  27. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-template.mjs +20 -5
  28. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-template.mjs.map +1 -1
  29. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-section-type.mjs +19 -5
  30. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-section-type.mjs.map +1 -1
  31. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-work-step-type.mjs +82 -12
  32. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-work-step-type.mjs.map +1 -1
  33. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-BI4TLvSE.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-C46YEBVd.mjs} +21 -21
  34. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-C46YEBVd.mjs.map +1 -0
  35. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-control-hierarchy-levels.entity-COlCNnyK.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-control-hierarchy-levels.entity-oylKTsgJ.mjs} +16 -2
  36. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-control-hierarchy-levels.entity-oylKTsgJ.mjs.map +1 -0
  37. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-control-measure.entity-BrXGzqZU.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-control-measure.entity-DHm1nRwW.mjs} +16 -2
  38. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-control-measure.entity-DHm1nRwW.mjs.map +1 -0
  39. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-ppe-rule.entity-DHJus7OP.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-ppe-rule.entity-DH-hPuAD.mjs} +16 -2
  40. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-ppe-rule.entity-DH-hPuAD.mjs.map +1 -0
  41. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-register.entity-CogjoDox.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-register.entity-g4AT_IiT.mjs} +16 -2
  42. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-register.entity-g4AT_IiT.mjs.map +1 -0
  43. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-risk.entity-9UWHmIXV.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-risk.entity-BwNlWbnC.mjs} +18 -72
  44. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-risk.entity-BwNlWbnC.mjs.map +1 -0
  45. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard.entity-CNPbxULL.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard.entity-Cogwbd1P.mjs} +17 -3
  46. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard.entity-Cogwbd1P.mjs.map +1 -0
  47. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-ppe-item.entity-D5iOBl3P.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-ppe-item.entity-0xqGaPnk.mjs} +16 -2
  48. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-ppe-item.entity-0xqGaPnk.mjs.map +1 -0
  49. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-risk-management.integration-CUZIl8zt.mjs +7 -0
  50. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-risk-management.integration-CUZIl8zt.mjs.map +1 -0
  51. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-activity.entity-CZCYupQT.mjs +324 -0
  52. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-activity.entity-CZCYupQT.mjs.map +1 -0
  53. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-section-dependency-TdIMIkM7.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-section-dependency-D0fzHV_L.mjs} +62 -10
  54. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-section-dependency-D0fzHV_L.mjs.map +1 -0
  55. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-section.entity-DJAI-7lB.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-section.entity-BpziBgGf.mjs} +17 -3
  56. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-section.entity-DJAI-7lB.mjs.map → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-section.entity-BpziBgGf.mjs.map} +1 -1
  57. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-type-section.entity-BGZ1VAW3.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-type-section.entity-D8wL0ned.mjs} +17 -3
  58. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-type-section.entity-D8wL0ned.mjs.map +1 -0
  59. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-type.entity-B6NYL4xi.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-type.entity-DrqQDYn9.mjs} +16 -2
  60. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-type.entity-DrqQDYn9.mjs.map +1 -0
  61. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan.entity-BSUR9jqs.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan.entity-DaRnWCin.mjs} +36 -3
  62. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan.entity-DaRnWCin.mjs.map +1 -0
  63. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-template.entity-CIHy_hLh.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-template.entity-Coj5Rzry.mjs} +17 -2
  64. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-template.entity-Coj5Rzry.mjs.map +1 -0
  65. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-section-type.entity-Cs4nIHou.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-section-type.entity-BU5roQ5-.mjs} +16 -2
  66. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-section-type.entity-BU5roQ5-.mjs.map +1 -0
  67. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-work-step-type.entity-CJFWDOoh.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-work-step-type.entity-DijGV30H.mjs} +17 -3
  68. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-work-step-type.entity-DijGV30H.mjs.map +1 -0
  69. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog.mjs +1 -1
  70. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts.mjs +144 -168
  71. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts.mjs.map +1 -1
  72. package/fesm2022/acorex-platform-module-workplacesafety-management-client-fill-safety-plan.command-lJl0qpvT.mjs +165 -0
  73. package/fesm2022/acorex-platform-module-workplacesafety-management-client-fill-safety-plan.command-lJl0qpvT.mjs.map +1 -0
  74. package/fesm2022/acorex-platform-module-workplacesafety-management-client-hydrate-safety-plan-activity-sections-TrVl3-T6.mjs +240 -0
  75. package/fesm2022/acorex-platform-module-workplacesafety-management-client-hydrate-safety-plan-activity-sections-TrVl3-T6.mjs.map +1 -0
  76. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-index-gbDgxqrV.mjs → acorex-platform-module-workplacesafety-management-client-index-CInaiEjw.mjs} +130 -398
  77. package/fesm2022/acorex-platform-module-workplacesafety-management-client-index-CInaiEjw.mjs.map +1 -0
  78. package/fesm2022/acorex-platform-module-workplacesafety-management-client-load-safety-plan-preview-structure-Ce67NSIZ.mjs +136 -0
  79. package/fesm2022/acorex-platform-module-workplacesafety-management-client-load-safety-plan-preview-structure-Ce67NSIZ.mjs.map +1 -0
  80. package/fesm2022/acorex-platform-module-workplacesafety-management-client-local-entities.mjs +1 -1
  81. package/fesm2022/acorex-platform-module-workplacesafety-management-client-local-entities.mjs.map +1 -1
  82. package/fesm2022/acorex-platform-module-workplacesafety-management-client-preview-safety-plan.command-DJqqiYlD.mjs +102 -0
  83. package/fesm2022/acorex-platform-module-workplacesafety-management-client-preview-safety-plan.command-DJqqiYlD.mjs.map +1 -0
  84. package/fesm2022/acorex-platform-module-workplacesafety-management-client-safety-plan-fill-values.util-RLOdySf7.mjs +33 -0
  85. package/fesm2022/acorex-platform-module-workplacesafety-management-client-safety-plan-fill-values.util-RLOdySf7.mjs.map +1 -0
  86. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-safety-plan-preview-modal.component-CQ2xB7Va.mjs → acorex-platform-module-workplacesafety-management-client-safety-plan-preview-modal.component-B9lElhxc.mjs} +252 -72
  87. package/fesm2022/acorex-platform-module-workplacesafety-management-client-safety-plan-preview-modal.component-B9lElhxc.mjs.map +1 -0
  88. package/fesm2022/acorex-platform-module-workplacesafety-management-client-safety-plan-section-builder.types-C0SEJsVM.mjs +185 -0
  89. package/fesm2022/acorex-platform-module-workplacesafety-management-client-safety-plan-section-builder.types-C0SEJsVM.mjs.map +1 -0
  90. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-save-safety-plan-sections.command-CLj3y_JD.mjs → acorex-platform-module-workplacesafety-management-client-save-safety-plan-sections.command-D0aRQHWk.mjs} +30 -94
  91. package/fesm2022/acorex-platform-module-workplacesafety-management-client-save-safety-plan-sections.command-D0aRQHWk.mjs.map +1 -0
  92. package/fesm2022/acorex-platform-module-workplacesafety-management-client.mjs +1 -1
  93. package/package.json +6 -6
  94. package/types/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan-activity.d.ts +5 -0
  95. package/types/acorex-platform-module-workplacesafety-management-client-contracts.d.ts +133 -157
  96. package/fesm2022/acorex-platform-module-workplacesafety-management-client-acorex-platform-module-workplacesafety-management-client-Ds0Fkspp.mjs.map +0 -1
  97. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan-work-step.mjs +0 -542
  98. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan-work-step.mjs.map +0 -1
  99. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-BI4TLvSE.mjs.map +0 -1
  100. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-control-hierarchy-levels.entity-COlCNnyK.mjs.map +0 -1
  101. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-control-measure.entity-BrXGzqZU.mjs.map +0 -1
  102. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-ppe-rule.entity-DHJus7OP.mjs.map +0 -1
  103. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-register.entity-CogjoDox.mjs.map +0 -1
  104. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-risk.entity-9UWHmIXV.mjs.map +0 -1
  105. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard.entity-CNPbxULL.mjs.map +0 -1
  106. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-ppe-item.entity-D5iOBl3P.mjs.map +0 -1
  107. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-section-dependency-TdIMIkM7.mjs.map +0 -1
  108. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-type-section.entity-BGZ1VAW3.mjs.map +0 -1
  109. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-type.entity-B6NYL4xi.mjs.map +0 -1
  110. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-work-step.entity-BlCbf5qP.mjs +0 -405
  111. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-work-step.entity-BlCbf5qP.mjs.map +0 -1
  112. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan.entity-BSUR9jqs.mjs.map +0 -1
  113. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-template.entity-CIHy_hLh.mjs.map +0 -1
  114. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-section-type.entity-Cs4nIHou.mjs.map +0 -1
  115. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-work-step-type.entity-CJFWDOoh.mjs.map +0 -1
  116. package/fesm2022/acorex-platform-module-workplacesafety-management-client-index-gbDgxqrV.mjs.map +0 -1
  117. package/fesm2022/acorex-platform-module-workplacesafety-management-client-preview-safety-plan.command-BU95c4xb.mjs +0 -254
  118. package/fesm2022/acorex-platform-module-workplacesafety-management-client-preview-safety-plan.command-BU95c4xb.mjs.map +0 -1
  119. package/fesm2022/acorex-platform-module-workplacesafety-management-client-safety-plan-preview-modal.component-CQ2xB7Va.mjs.map +0 -1
  120. package/fesm2022/acorex-platform-module-workplacesafety-management-client-safety-plan-preview.service-DJP41MuL.mjs +0 -36
  121. package/fesm2022/acorex-platform-module-workplacesafety-management-client-safety-plan-preview.service-DJP41MuL.mjs.map +0 -1
  122. package/fesm2022/acorex-platform-module-workplacesafety-management-client-safety-plan-section-builder.types-LaN1NIgc.mjs +0 -204
  123. package/fesm2022/acorex-platform-module-workplacesafety-management-client-safety-plan-section-builder.types-LaN1NIgc.mjs.map +0 -1
  124. package/fesm2022/acorex-platform-module-workplacesafety-management-client-save-safety-plan-sections.command-CLj3y_JD.mjs.map +0 -1
  125. package/types/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan-work-step.d.ts +0 -5
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan-activity.mjs","sources":["../../../../libs/modules/workplacesafety-management/contracts/src/root-config.ts","../../../../libs/modules/workplacesafety-management/contracts/src/risk-management.integration.ts","../../../../libs/modules/workplacesafety-management/contracts/src/section-type-entity-map.ts","../../../../libs/modules/workplacesafety-management/contracts/src/safety-plan-section-unique-type.util.ts","../../../../libs/modules/workplacesafety-management/contracts/src/safety-plan-section-structure.util.ts","../../../../libs/modules/workplacesafety-management/contracts/src/safety-plan-section-dependency.ts","../../../../libs/modules/workplacesafety-management/contracts/src/entities/safety-plan-activity/safety-plan-activity.entity.ts","../../../../libs/modules/workplacesafety-management/contracts/src/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan-activity.ts"],"sourcesContent":["const config = {\n i18n: 'workplacesafety-management',\n module: 'WorkplaceSafetyManagement',\n} as const;\n\nexport const RootConfig = {\n config,\n module: {\n name: config.module,\n title: `@${config.i18n}:module.title`,\n icon: 'fa-light fa-building-shield',\n },\n entities: {\n hazard: {\n name: 'Hazard',\n source: `${config.module}.Hazard`,\n title: `@${config.i18n}:hazards.entities.hazard.title`,\n titlePlural: `@${config.i18n}:hazards.entities.hazard.plural`,\n icon: 'fa-light fa-triangle-exclamation',\n },\n hazardRegister: {\n name: 'HazardRegister',\n source: `${config.module}.HazardRegister`,\n title: `@${config.i18n}:hazard-registers.entities.hazard-register.title`,\n titlePlural: `@${config.i18n}:hazard-registers.entities.hazard-register.plural`,\n icon: 'fa-light fa-clipboard-list',\n },\n ppeItem: {\n name: 'PpeItem',\n source: `${config.module}.PpeItem`,\n title: `@${config.i18n}:ppe-items.entities.ppe-item.title`,\n titlePlural: `@${config.i18n}:ppe-items.entities.ppe-item.plural`,\n icon: 'fa-light fa-helmet-safety',\n },\n hazardPpeRule: {\n name: 'HazardPpeRule',\n source: `${config.module}.HazardPpeRule`,\n title: `@${config.i18n}:hazard-ppe-rules.entities.hazard-ppe-rule.title`,\n titlePlural: `@${config.i18n}:hazard-ppe-rules.entities.hazard-ppe-rule.plural`,\n icon: 'fa-light fa-user-helmet-safety',\n },\n hazardRisk: {\n name: 'HazardRisk',\n source: `${config.module}.HazardRisk`,\n title: `@${config.i18n}:hazard-risks.entities.hazard-risk.title`,\n titlePlural: `@${config.i18n}:hazard-risks.entities.hazard-risk.plural`,\n icon: 'fa-light fa-shield-exclamation',\n },\n controlHierarchyLevels: {\n name: 'ControlHierarchyLevels',\n source: `${config.module}.ControlHierarchyLevels`,\n title: `@${config.i18n}:control-measure-types.entities.control-measure-type.title`,\n titlePlural: `@${config.i18n}:control-measure-types.entities.control-measure-type.plural`,\n icon: 'fa-light fa-layer-group',\n },\n controlMeasure: {\n name: 'ControlMeasure',\n source: `${config.module}.ControlMeasure`,\n title: `@${config.i18n}:control-measures.entities.control-measure.title`,\n titlePlural: `@${config.i18n}:control-measures.entities.control-measure.plural`,\n icon: 'fa-light fa-shield-check',\n },\n safetyPlan: {\n name: 'SafetyPlan',\n source: `${config.module}.SafetyPlan`,\n title: `@${config.i18n}:safety-plans.entities.safety-plan.title`,\n titlePlural: `@${config.i18n}:safety-plans.entities.safety-plan.plural`,\n icon: 'fa-light fa-file-shield',\n },\n safetyPlanType: {\n name: 'SafetyPlanType',\n source: `${config.module}.SafetyPlanType`,\n title: `@${config.i18n}:safety-plan-types.entities.safety-plan-type.title`,\n titlePlural: `@${config.i18n}:safety-plan-types.entities.safety-plan-type.plural`,\n icon: 'fa-light fa-file-lines',\n },\n safetyPlanTypeSection: {\n name: 'SafetyPlanTypeSection',\n source: `${config.module}.SafetyPlanTypeSection`,\n title: `@${config.i18n}:safety-plan-type-sections.entities.safety-plan-type-section.title`,\n titlePlural: `@${config.i18n}:safety-plan-type-sections.entities.safety-plan-type-section.plural`,\n icon: 'fa-light fa-list-ol',\n },\n sectionType: {\n name: 'SectionType',\n source: `${config.module}.SectionType`,\n title: `@${config.i18n}:section-types.entities.section-type.title`,\n titlePlural: `@${config.i18n}:section-types.entities.section-type.plural`,\n icon: 'fa-light fa-list-tree',\n },\n safetyTemplate: {\n name: 'SafetyTemplate',\n source: `${config.module}.SafetyTemplate`,\n title: `@${config.i18n}:safety-templates.entities.safety-template.title`,\n titlePlural: `@${config.i18n}:safety-templates.entities.safety-template.plural`,\n icon: 'fa-light fa-file-lines',\n },\n safetyPlanSection: {\n name: 'SafetyPlanSection',\n source: `${config.module}.SafetyPlanSection`,\n title: `@${config.i18n}:safety-plan-sections.entities.safety-plan-section.title`,\n titlePlural: `@${config.i18n}:safety-plan-sections.entities.safety-plan-section.plural`,\n icon: 'fa-light fa-list-ol',\n },\n workStepType: {\n name: 'WorkStepType',\n source: `${config.module}.WorkStepType`,\n title: `@${config.i18n}:work-step-types.entities.work-step-type.title`,\n titlePlural: `@${config.i18n}:work-step-types.entities.work-step-type.plural`,\n icon: 'fa-light fa-list-tree',\n },\n safetyPlanActivity: {\n name: 'SafetyPlanActivity',\n source: `${config.module}.SafetyPlanActivity`,\n title: `@${config.i18n}:safety-plan-activities.entities.safety-plan-activity.title`,\n titlePlural: `@${config.i18n}:safety-plan-activities.entities.safety-plan-activity.plural`,\n icon: 'fa-light fa-list-check',\n },\n },\n queries: {\n dashboard: {\n openHazardsKpi: `${config.module}:Dashboard:OpenHazardsKpi`,\n highRisksKpi: `${config.module}:Dashboard:HighRisksKpi`,\n activeSafetyPlansKpi: `${config.module}:Dashboard:ActiveSafetyPlansKpi`,\n take5ChecklistsKpi: `${config.module}:Dashboard:Take5ChecklistsKpi`,\n take5CompletedKpi: `${config.module}:Dashboard:Take5CompletedKpi`,\n hazardsByCategoryDonut: `${config.module}:Dashboard:HazardsByCategoryDonut`,\n risksByRatingBar: `${config.module}:Dashboard:RisksByRatingBar`,\n plansByTypeBar: `${config.module}:Dashboard:PlansByTypeBar`,\n hazardsByStatusBar: `${config.module}:Dashboard:HazardsByStatusBar`,\n ppeCoverageDonut: `${config.module}:Dashboard:PpeCoverageDonut`,\n },\n },\n};\n","/** Risk matrix entity key in the risk-management module. */\nexport const RISK_MANAGEMENT_RISK_MATRIX_ENTITY = 'RiskManagement.RiskMatrix';\n\n/** Hazard catalog scope for risk matrix lookup filtering. */\nexport const RISK_MANAGEMENT_HAZARD_CATALOG_SCOPE = 'risk-management.hazard';\n","//#region ---- Imports ----\n\nimport type {\n AXMSectionTypeCode,\n AXMSectionTypeSnapshot,\n} from './entities/section-type/section-type.types';\n\nimport { RISK_MANAGEMENT_RISK_MATRIX_ENTITY } from './risk-management.integration';\nimport { RootConfig } from './root-config';\n\n//#endregion\n\n//#region ---- Built-in section type IDs ----\n\n/** Stable IDs for seeded built-in section types (shared by server mocks and client lookups). */\n\nexport const WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS = {\n hazard: 'c1d2e3f4-a5b6-4789-c001-000000000001',\n\n hazardRisk: 'c1d2e3f4-a5b6-4789-c001-000000000002',\n\n ppe: 'c1d2e3f4-a5b6-4789-c001-000000000003',\n\n control: 'c1d2e3f4-a5b6-4789-c001-000000000004',\n\n hierarchyLevel: 'c1d2e3f4-a5b6-4789-c001-000000000005',\n\n custom: 'c1d2e3f4-a5b6-4789-c001-000000000006',\n\n ppeHazards: 'c1d2e3f4-a5b6-4789-c001-000000000007',\n\n riskMatrix: 'c1d2e3f4-a5b6-4789-c001-000000000008',\n\n hazardRiskPpe: 'c1d2e3f4-a5b6-4789-c001-000000000009',\n\n activity: 'c1d2e3f4-a5b6-4789-c001-00000000000a',\n} as const;\n\nexport interface AXMBuiltInSectionTypeMeta {\n sectionTypeKey: AXMSectionTypeCode;\n\n itemEntityName?: string;\n\n /** When true, a safety plan may include this section type more than once. */\n isRepeatable?: boolean;\n}\n\nconst moduleName = RootConfig.module.name;\n\n/** Maps section type codes to the entity that supplies selectable items. */\n\nexport const WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_BY_CODE: Readonly<\n Record<AXMSectionTypeCode, string | undefined>\n> = {\n Hazard: `${moduleName}.${RootConfig.entities.hazard.name}`,\n\n HazardRisk: `${moduleName}.${RootConfig.entities.hazardRisk.name}`,\n\n Ppe: `${moduleName}.${RootConfig.entities.ppeItem.name}`,\n\n PpeHazards: `${moduleName}.${RootConfig.entities.hazardPpeRule.name}`,\n\n HazardRiskPpe: undefined,\n\n Control: `${moduleName}.${RootConfig.entities.controlMeasure.name}`,\n\n HierarchyLevel: `${moduleName}.${RootConfig.entities.controlHierarchyLevels.name}`,\n\n RiskMatrix: RISK_MANAGEMENT_RISK_MATRIX_ENTITY,\n\n Custom: undefined,\n\n /** Host section for Activity rows (managed by the section builder, not a catalog picker). */\n Activity: undefined,\n};\n\n/** Built-in section types resolved by stable section type id. */\n\nexport const WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_BY_ID: Readonly<\n Record<string, AXMBuiltInSectionTypeMeta>\n> = {\n [WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.hazard]: {\n sectionTypeKey: 'Hazard',\n\n itemEntityName: WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_BY_CODE.Hazard,\n },\n\n [WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.hazardRisk]: {\n sectionTypeKey: 'HazardRisk',\n\n itemEntityName: WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_BY_CODE.HazardRisk,\n },\n\n [WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.ppe]: {\n sectionTypeKey: 'Ppe',\n\n itemEntityName: WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_BY_CODE.Ppe,\n },\n\n [WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.ppeHazards]: {\n sectionTypeKey: 'PpeHazards',\n\n itemEntityName: WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_BY_CODE.PpeHazards,\n },\n\n [WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.hazardRiskPpe]: {\n sectionTypeKey: 'HazardRiskPpe',\n\n itemEntityName: WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_BY_CODE.HazardRiskPpe,\n },\n\n [WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.control]: {\n sectionTypeKey: 'Control',\n\n itemEntityName: WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_BY_CODE.Control,\n },\n\n [WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.hierarchyLevel]: {\n sectionTypeKey: 'HierarchyLevel',\n\n itemEntityName: WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_BY_CODE.HierarchyLevel,\n },\n\n [WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.riskMatrix]: {\n sectionTypeKey: 'RiskMatrix',\n\n itemEntityName: WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_BY_CODE.RiskMatrix,\n },\n\n [WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.custom]: {\n sectionTypeKey: 'Custom',\n\n itemEntityName: WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_BY_CODE.Custom,\n\n isRepeatable: true,\n },\n\n [WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.activity]: {\n sectionTypeKey: 'Activity',\n\n itemEntityName: WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_BY_CODE.Activity,\n\n isRepeatable: true,\n },\n};\n\n/** Default entity so the lookup widget mounts before a section type is chosen. */\n\nexport const WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_FALLBACK = `${moduleName}.${RootConfig.entities.hazard.name}`;\n\n//#endregion\n\n//#region ---- Snapshot helpers ----\n\nexport function resolveSectionTypeKey(\n sectionTypeId: string | undefined,\n\n snapshot?: AXMSectionTypeSnapshot,\n): AXMSectionTypeCode | undefined {\n const fromSnapshot = snapshot?.sectionTypeKey;\n\n if (typeof fromSnapshot === 'string' && fromSnapshot.length > 0) {\n return fromSnapshot as AXMSectionTypeCode;\n }\n\n if (!sectionTypeId) {\n return undefined;\n }\n\n return WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_BY_ID[sectionTypeId]\n ?.sectionTypeKey;\n}\n\n/**\n * Human-readable titles for built-in section type keys (matches seeded SectionType titles).\n * Used when snapshots lack `title` (common after id-only enrichment).\n */\nconst SECTION_TYPE_KEY_DISPLAY_TITLES: Readonly<Record<AXMSectionTypeCode, string>> = {\n Hazard: 'Hazard',\n HazardRisk: 'Hazard Risk',\n Ppe: 'PPE',\n PpeHazards: 'Hazard PPE Items',\n HazardRiskPpe: 'Hazard Risk PPE',\n Control: 'Control',\n HierarchyLevel: 'Hierarchy Level',\n RiskMatrix: 'Risk Matrix',\n Custom: 'Custom',\n Activity: 'Activity',\n};\n\n/** Formats a section type key for display (e.g. `HierarchyLevel` → `Hierarchy Level`). */\nexport function formatSectionTypeKeyAsTitle(key: string | undefined | null): string {\n if (!key) {\n return '';\n }\n const known = SECTION_TYPE_KEY_DISPLAY_TITLES[key as AXMSectionTypeCode];\n if (known) {\n return known;\n }\n return key.replace(/([a-z\\d])([A-Z])/g, '$1 $2').trim();\n}\n\n/**\n * Resolves a section type label for UI/preview: snapshot title → key display title → spaced code.\n */\nexport function resolveSectionTypeDisplayTitle(\n sectionTypeId?: string,\n snapshot?: AXMSectionTypeSnapshot | null,\n): string {\n if (typeof snapshot?.title === 'string' && snapshot.title.trim()) {\n return snapshot.title.trim();\n }\n const key = resolveSectionTypeKey(sectionTypeId, snapshot ?? undefined);\n const fromKey = formatSectionTypeKeyAsTitle(key);\n if (fromKey) {\n return fromKey;\n }\n if (typeof snapshot?.code === 'string' && snapshot.code.trim()) {\n return formatSectionTypeKeyAsTitle(snapshot.code.trim()) || snapshot.code.trim();\n }\n return '';\n}\n\nexport function resolveSectionItemEntityName(\n sectionTypeId: string | undefined,\n\n snapshot?: AXMSectionTypeSnapshot,\n): string | undefined {\n const fromSnapshot = snapshot?.itemEntityName;\n\n if (typeof fromSnapshot === 'string' && fromSnapshot.length > 0) {\n return fromSnapshot;\n }\n\n if (!sectionTypeId) {\n return undefined;\n }\n\n return WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_BY_ID[sectionTypeId]\n ?.itemEntityName;\n}\n\n/** Adds runtime lookup metadata (`sectionTypeKey`, `itemEntityName`) from built-in id map. */\n\nexport function enrichSectionTypeSnapshot(\n sectionTypeId: string | undefined,\n\n snapshot?: AXMSectionTypeSnapshot,\n): AXMSectionTypeSnapshot | undefined {\n if (!sectionTypeId) {\n return snapshot;\n }\n\n return {\n ...snapshot,\n\n id: sectionTypeId,\n\n sectionTypeKey: resolveSectionTypeKey(sectionTypeId, snapshot),\n\n itemEntityName: resolveSectionItemEntityName(sectionTypeId, snapshot),\n\n isRepeatable:\n snapshot?.isRepeatable ??\n WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_BY_ID[sectionTypeId]?.isRepeatable,\n };\n}\n\n//#endregion\n\n//#region ---- Dynamic entity expressions ----\n\nfunction buildSectionTypeEntityExpressionById(\n sectionTypeIdPath: string,\n): string {\n const parts = Object.entries(WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_BY_ID)\n\n .filter(([, meta]) => meta.itemEntityName)\n\n .map(\n ([id, meta]) =>\n `context.eval('${sectionTypeIdPath}') === '${id}' ? '${meta.itemEntityName}'`,\n );\n\n return `{{ ${parts.join(' : ')} : '${WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_FALLBACK}' }}`;\n}\n\nfunction buildSectionTypeEntityExpressionWithSnapshotFallback(\n sectionTypeIdPath: string,\n itemEntityNamePath: string,\n): string {\n const byId = buildSectionTypeEntityExpressionById(sectionTypeIdPath).slice(3, -2);\n return `{{ context.eval('${itemEntityNamePath}') || (${byId}) }}`;\n}\n\n/**\n * For repeater / nested FormField widgets — `>` walks up to the row where `sectionType` is exposed.\n */\n\nexport const WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_EXPRESSION =\n buildSectionTypeEntityExpressionWithSnapshotFallback(\n '>sectionType.id',\n\n '>sectionType.itemEntityName',\n );\n\n/**\n * Entity expression keyed by the bound `sectionTypeId` field (repeater-safe).\n * Prefer this when expose snapshots may not live on the same path the lookup evaluates.\n */\nexport function buildWorkplaceSafetySectionTypeEntityExpression(sectionTypeIdPath: string): string {\n return buildSectionTypeEntityExpressionById(sectionTypeIdPath);\n}\n\n/**\n * For flat dialog / dynamic forms — sibling fields share the same context (no parent path).\n */\nexport const WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_EXPRESSION_SIBLING =\n buildSectionTypeEntityExpressionWithSnapshotFallback(\n 'sectionType.id',\n 'sectionType.itemEntityName',\n );\n\n//#endregion\n","/**\n * Shared helpers for Safety Plan Section type identity (repeatable vs one-off).\n * Leaf module — imports only other contract leaves (no client/server layers).\n */\n\nimport { WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_BY_ID } from './section-type-entity-map';\n\n//#region ---- Helpers ----\n\nfunction resolveRefId(raw: unknown): string {\n if (typeof raw === 'string' && raw.trim().length > 0) {\n return raw.trim();\n }\n if (typeof raw === 'number' && Number.isFinite(raw)) {\n return String(raw);\n }\n if (raw && typeof raw === 'object') {\n const id = (raw as { id?: unknown }).id;\n if (typeof id === 'string' && id.trim().length > 0) {\n return id.trim();\n }\n }\n return '';\n}\n\n/**\n * True when this section type may appear more than once in a Safety Plan.\n * Checks (in order): snapshot flag, explicit allow-list, built-in section type meta.\n */\nexport function isSafetyPlanSectionTypeRepeatable(\n sectionTypeId: string,\n options?: {\n repeatableSectionTypeIds?: readonly string[];\n sectionType?: { isRepeatable?: boolean };\n },\n): boolean {\n const id = resolveRefId(sectionTypeId);\n if (!id) {\n return false;\n }\n if (options?.sectionType?.isRepeatable === true) {\n return true;\n }\n const allowList = new Set(\n (options?.repeatableSectionTypeIds ?? []).map((entry) => resolveRefId(entry)).filter(Boolean),\n );\n if (allowList.has(id)) {\n return true;\n }\n return WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_BY_ID[id]?.isRepeatable === true;\n}\n\n/** Built-in section type ids that are always treated as repeatable. */\nexport function collectBuiltInRepeatableSectionTypeIds(): string[] {\n return Object.entries(WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_BY_ID)\n .filter(([, meta]) => meta.isRepeatable === true)\n .map(([id]) => id);\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { createRandomUuid } from '@acorex-platform/framework-shared/core';\nimport type {\n AXMSafetyPlanSectionBuilderSectionValue,\n AXMSafetyPlanSectionBuilderValue,\n} from './safety-plan-section-builder.types';\nimport type {\n AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel,\n AXMWorkplaceSafetyManagementSafetyPlanTypeSectionTypeItemModel,\n} from './entities/safety-plan-type-section/safety-plan-type-section.types';\nimport type { AXMSectionTypeSnapshot } from './entities/section-type/section-type.types';\nimport { WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_BY_ID } from './section-type-entity-map';\nimport { isSafetyPlanSectionTypeRepeatable } from './safety-plan-section-unique-type.util';\n\n//#endregion\n\n//#region ---- Types ----\n\nexport interface AXMSafetyPlanSectionStructureItem {\n id: string;\n sectionTypeId: string;\n sectionType?: AXMSectionTypeSnapshot;\n title: string;\n description?: string;\n /** Links the plan section back to the type template it was created from. */\n sourceSafetyPlanTypeSectionId?: string;\n /** Display / persistence order (1-based). */\n sortOrder: number;\n /** True when sourced from an `isDefault` type section — must remain on the plan. */\n required?: boolean;\n items: Array<{\n id: string;\n itemIds: string[];\n items?: { id: string; title?: string; code?: string }[];\n }>;\n safetyPlanId?: string;\n code?: string;\n}\n\nexport interface AXMSafetyPlanSectionStructureValue {\n sections: AXMSafetyPlanSectionStructureItem[];\n}\n\nexport interface AXMSafetyPlanSectionStructureValidationContext {\n /** Section type ids allowed for this plan type (from its type-section config). */\n allowedSectionTypeIds: readonly string[];\n /** Source type-section ids that must remain present. */\n requiredSourceTypeSectionIds: readonly string[];\n /** Section type ids that may appear more than once on a plan. */\n repeatableSectionTypeIds?: readonly string[];\n}\n\nexport type AXMSafetyPlanSectionStructureValidationIssueCode =\n | 'REQUIRED_SECTION_MISSING'\n | 'SECTION_TYPE_NOT_ALLOWED'\n | 'INVALID_TYPE_SECTION_TEMPLATE'\n | 'INVALID_SORT_ORDER';\n\nexport interface AXMSafetyPlanSectionStructureValidationIssue {\n code: AXMSafetyPlanSectionStructureValidationIssueCode;\n messageKey: string;\n details?: Record<string, unknown>;\n}\n\n//#endregion\n\n//#region ---- Display helpers ----\n\n/** Coerces a stored string or locale map into a single display string. */\nexport function asSafetyPlanDisplayText(value: unknown): string {\n if (typeof value === 'string') {\n return value.trim();\n }\n if (value && typeof value === 'object' && !Array.isArray(value)) {\n const rec = value as Record<string, unknown>;\n for (const locale of ['en-US', 'en-AU', 'en', 'fa-IR']) {\n const part = rec[locale];\n if (typeof part === 'string' && part.trim()) {\n return part.trim();\n }\n }\n for (const part of Object.values(rec)) {\n if (typeof part === 'string' && part.trim()) {\n return part.trim();\n }\n }\n }\n return '';\n}\n\nexport function buildSectionTypeRelationSnapshot(\n sectionTypeId: string,\n snapshot?: {\n title?: unknown;\n code?: unknown;\n description?: unknown;\n isRepeatable?: unknown;\n } | null,\n): AXMSectionTypeSnapshot {\n const title = asSafetyPlanDisplayText(snapshot?.title);\n const code = asSafetyPlanDisplayText(snapshot?.code);\n const description = asSafetyPlanDisplayText(snapshot?.description);\n return {\n id: sectionTypeId,\n ...(title ? { title } : {}),\n ...(code ? { code } : {}),\n ...(description ? { description } : {}),\n ...(snapshot?.isRepeatable === true ? { isRepeatable: true } : {}),\n };\n}\n\nfunction resolveSectionTypeTitle(\n sectionTypeId: string,\n sectionType?: { title?: unknown; code?: unknown } | null,\n): string {\n const title = asSafetyPlanDisplayText(sectionType?.title);\n if (title) {\n return title;\n }\n const code = asSafetyPlanDisplayText(sectionType?.code);\n if (code) {\n return code;\n }\n const builtIn = WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_BY_ID[sectionTypeId]?.sectionTypeKey;\n if (builtIn) {\n return builtIn;\n }\n return sectionTypeId;\n}\n\n/**\n * Title persisted on SafetyPlanSection. Never stores a bare UUID — the UI translate\n * pipe treats unknown keys as empty, which made seeded section headers blank.\n */\nexport function resolveSafetyPlanSectionPersistedTitle(\n sectionTitle: unknown,\n sectionTypeId: string,\n snapshot?: { title?: unknown; code?: unknown } | null,\n): string {\n const explicit = asSafetyPlanDisplayText(sectionTitle);\n if (explicit && explicit !== sectionTypeId) {\n return explicit;\n }\n const fromType = resolveSectionTypeTitle(sectionTypeId, snapshot);\n if (fromType && fromType !== sectionTypeId) {\n return fromType;\n }\n return 'Section';\n}\n\n//#endregion\n\n//#region ---- Ref helpers ----\n\n/** True when a type-section row is marked as the plan-type default template. */\nexport function isSafetyPlanTypeSectionDefault(row: { isDefault?: unknown } | null | undefined): boolean {\n const value = row?.isDefault;\n return value === true || value === 1 || value === 'true';\n}\n\n/**\n * Returns the default Safety Plan Type Section (structure) for a plan type.\n * Prefers `isDefault: true`; otherwise the first active row by sortOrder/title.\n */\nexport function resolveDefaultSafetyPlanTypeSection(\n typeSections: readonly AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel[],\n): AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel | null {\n const active = typeSections\n .filter((row) => row && row.isArchived !== true)\n .slice()\n .sort(\n (a, b) =>\n (a.sortOrder ?? 0) - (b.sortOrder ?? 0) || String(a.title ?? '').localeCompare(String(b.title ?? '')),\n );\n if (!active.length) {\n return null;\n }\n return active.find((row) => isSafetyPlanTypeSectionDefault(row)) ?? active[0] ?? null;\n}\n\n/**\n * Narrows type-section rows to the selected structure when `structureId` is set.\n * Falls back to all active rows (caller / build still applies isDefault rules).\n */\nexport function pickSafetyPlanTypeSectionsForStructure(\n typeSections: readonly AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel[],\n structureId?: string | null,\n): AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel[] {\n const active = typeSections.filter((row) => row && row.isArchived !== true);\n const id = typeof structureId === 'string' ? structureId.trim() : '';\n if (!id) {\n return active;\n }\n const selected = active.filter((row) => resolveEntityRefId(row.id) === id);\n return selected.length ? selected : active;\n}\n\n/** Extracts a stable entity id from a raw lookup / context value. */\nexport function resolveEntityRefId(raw: unknown): string | null {\n if (typeof raw === 'string' && raw.trim().length > 0) {\n return raw.trim();\n }\n if (typeof raw === 'number' && Number.isFinite(raw)) {\n return String(raw);\n }\n if (raw && typeof raw === 'object') {\n const id = (raw as { id?: unknown }).id;\n if (typeof id === 'string' && id.trim().length > 0) {\n return id.trim();\n }\n }\n return null;\n}\n\nfunction resolveSectionTypeId(\n typeRow: AXMWorkplaceSafetyManagementSafetyPlanTypeSectionTypeItemModel | null | undefined,\n): string {\n if (!typeRow) {\n return '';\n }\n return (\n resolveEntityRefId(typeRow.sectionTypeId) ??\n resolveEntityRefId(typeRow.sectionType) ??\n resolveEntityRefId(typeRow.sectionType?.id) ??\n ''\n );\n}\n\n//#endregion\n\n//#region ---- Build from type sections ----\n\nlet structureIdSeq = 0;\nfunction nextStructureId(prefix: string): string {\n structureIdSeq += 1;\n const rand = createRandomUuid();\n return prefix ? `${prefix}-${rand}` : rand;\n}\n\n/**\n * Builds an empty editable section structure from SafetyPlanTypeSection rows for one plan type.\n *\n * Uses `isDefault` rows when present; otherwise falls back to all active rows for that type\n * (so a mis-flagged template still produces a structure). One plan section per `sectionTypeIds`\n * entry, titled from the Section Type, ordered by type-section `sortOrder` then repeater order.\n */\nexport function buildSectionStructureFromTypeSections(\n typeSections: readonly AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel[],\n options?: { createId?: () => string },\n): AXMSafetyPlanSectionStructureValue {\n const createId = options?.createId ?? (() => nextStructureId(''));\n const active = typeSections\n .filter((row) => row && row.isArchived !== true)\n .slice()\n .sort((a, b) => (a.sortOrder ?? 0) - (b.sortOrder ?? 0) || String(a.title ?? '').localeCompare(String(b.title ?? '')));\n\n const defaults = active.filter((row) => isSafetyPlanTypeSectionDefault(row));\n const sourceRows = defaults.length > 0 ? defaults : active;\n\n const sections: AXMSafetyPlanSectionStructureItem[] = [];\n const seenSourceTypePairs = new Set<string>();\n let sortOrder = 1;\n\n for (const typeSection of sourceRows) {\n const typeRows = Array.isArray(typeSection.sectionTypeIds) ? typeSection.sectionTypeIds : [];\n if (!typeRows.length) {\n continue;\n }\n\n for (const typeRow of typeRows) {\n const sectionTypeId = resolveSectionTypeId(typeRow);\n if (!sectionTypeId) {\n continue;\n }\n\n // One plan section per (type-section source, section type) — prevents\n // accidental double expansion when the same type is listed twice.\n const sourceId = typeof typeSection.id === 'string' ? typeSection.id : '';\n const pairKey = sourceId ? `${sourceId}|${sectionTypeId}` : sectionTypeId;\n if (seenSourceTypePairs.has(pairKey)) {\n continue;\n }\n seenSourceTypePairs.add(pairKey);\n\n const sectionType = buildSectionTypeRelationSnapshot(sectionTypeId, typeRow.sectionType);\n const sectionId = createId();\n sections.push({\n id: sectionId,\n sectionTypeId,\n sectionType,\n title: resolveSafetyPlanSectionPersistedTitle(undefined, sectionTypeId, sectionType),\n description: asSafetyPlanDisplayText(sectionType.description),\n sourceSafetyPlanTypeSectionId: typeSection.id,\n sortOrder: sortOrder++,\n required: isSafetyPlanTypeSectionDefault(typeSection) || defaults.length === 0,\n items: [\n {\n id: `${sectionId}__item_1`,\n itemIds: [],\n items: [],\n },\n ],\n });\n }\n }\n\n return { sections };\n}\n\n/**\n * Removes accidental ghost rows from double materialization of the same type-section\n * source. Distinct sections of the same type are kept. Reassigns contiguous 1-based\n * `sortOrder` to preserve display order.\n */\nexport function dedupeSafetyPlanSectionStructure<\n T extends AXMSafetyPlanSectionStructureValue | AXMSafetyPlanSectionBuilderValue,\n>(\n structure: T,\n _options?: { repeatableSectionTypeIds?: readonly string[] },\n): T {\n type Section = AXMSafetyPlanSectionStructureItem | AXMSafetyPlanSectionBuilderSectionValue;\n\n const sections: readonly Section[] = Array.isArray(structure?.sections)\n ? (structure.sections as readonly Section[])\n : [];\n const seenSourceTypePairs = new Set<string>();\n const deduped: Section[] = [];\n\n for (const section of sections) {\n const sectionTypeId = resolveEntityRefId(section.sectionTypeId) ?? String(section.sectionTypeId ?? '').trim();\n if (!sectionTypeId) {\n continue;\n }\n\n const sourceId = String(section.sourceSafetyPlanTypeSectionId ?? '').trim();\n const sourcePairKey = sourceId ? `${sourceId}|${sectionTypeId}` : '';\n\n // Same type-section source + section type must never appear twice (double materialization).\n if (sourcePairKey && seenSourceTypePairs.has(sourcePairKey)) {\n continue;\n }\n\n if (sourcePairKey) {\n seenSourceTypePairs.add(sourcePairKey);\n }\n deduped.push(section);\n }\n\n return {\n ...structure,\n sections: deduped.map((section, index) => ({\n ...section,\n sortOrder: index + 1,\n })),\n } as T;\n}\n\nexport function collectAllowedSectionTypeIds(\n typeSections: readonly AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel[],\n): string[] {\n const ids = new Set<string>();\n for (const typeSection of typeSections) {\n if (typeSection.isArchived === true) {\n continue;\n }\n for (const row of typeSection.sectionTypeIds ?? []) {\n const id = resolveSectionTypeId(row);\n if (id) {\n ids.add(id);\n }\n }\n }\n return [...ids];\n}\n\nexport function collectRequiredSourceTypeSectionIds(\n typeSections: readonly AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel[],\n options?: { structureId?: string | null },\n): string[] {\n const structureId =\n typeof options?.structureId === 'string' && options.structureId.trim()\n ? options.structureId.trim()\n : '';\n if (structureId) {\n const selected = typeSections.find(\n (row) => row.isArchived !== true && resolveEntityRefId(row.id) === structureId,\n );\n return selected?.id && typeof selected.id === 'string' ? [selected.id] : [structureId];\n }\n\n return typeSections\n .filter((row) => row.isArchived !== true && isSafetyPlanTypeSectionDefault(row))\n .map((row) => row.id)\n .filter((id): id is string => typeof id === 'string' && id.length > 0);\n}\n\n/**\n * Validates that a plan-type section template does not list the same\n * non-repeatable section type more than once (across rows and within a single row's repeater).\n */\nexport function validateSafetyPlanTypeSectionTemplate(\n typeSections: readonly AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel[],\n repeatableSectionTypeIds: readonly string[] = [],\n): AXMSafetyPlanSectionStructureValidationIssue[] {\n const seen = new Map<string, { title: string; sourceSafetyPlanTypeSectionId?: string }>();\n const issues: AXMSafetyPlanSectionStructureValidationIssue[] = [];\n\n for (const typeSection of typeSections) {\n if (typeSection.isArchived === true) {\n continue;\n }\n for (const row of typeSection.sectionTypeIds ?? []) {\n const sectionTypeId = resolveSectionTypeId(row);\n if (\n !sectionTypeId ||\n isSafetyPlanSectionTypeRepeatable(sectionTypeId, {\n repeatableSectionTypeIds,\n sectionType: row.sectionType as { isRepeatable?: boolean } | undefined,\n })\n ) {\n continue;\n }\n const sectionTypeTitle = resolveSafetyPlanSectionPersistedTitle(\n undefined,\n sectionTypeId,\n row.sectionType,\n );\n if (seen.has(sectionTypeId)) {\n issues.push({\n code: 'INVALID_TYPE_SECTION_TEMPLATE',\n messageKey:\n '@workplacesafety-management:safety-plans.messages.section-structure.invalid-type-template-duplicate',\n details: {\n sectionTypeId,\n sectionTypeTitle,\n sourceSafetyPlanTypeSectionId: typeSection.id,\n previousSourceSafetyPlanTypeSectionId: seen.get(sectionTypeId)?.sourceSafetyPlanTypeSectionId,\n },\n });\n continue;\n }\n seen.set(sectionTypeId, {\n title: sectionTypeTitle,\n sourceSafetyPlanTypeSectionId: typeSection.id,\n });\n }\n }\n\n return issues;\n}\n\n//#endregion\n\n//#region ---- Validation ----\n\nexport function validateSafetyPlanSectionStructure(\n structure: AXMSafetyPlanSectionStructureValue | AXMSafetyPlanSectionBuilderValue | null | undefined,\n context: AXMSafetyPlanSectionStructureValidationContext,\n): AXMSafetyPlanSectionStructureValidationIssue[] {\n const sections = Array.isArray(structure?.sections) ? structure!.sections : [];\n const issues: AXMSafetyPlanSectionStructureValidationIssue[] = [];\n\n const presentSourceIds = new Set(\n sections\n .map((s) => (s as AXMSafetyPlanSectionStructureItem).sourceSafetyPlanTypeSectionId)\n .filter((id): id is string => typeof id === 'string' && id.length > 0),\n );\n\n for (const requiredSourceId of context.requiredSourceTypeSectionIds) {\n if (!presentSourceIds.has(requiredSourceId)) {\n issues.push({\n code: 'REQUIRED_SECTION_MISSING',\n messageKey:\n '@workplacesafety-management:safety-plans.messages.section-structure.required-section-missing',\n details: { sourceSafetyPlanTypeSectionId: requiredSourceId },\n });\n }\n }\n\n const allowed = new Set(context.allowedSectionTypeIds);\n\n const sortOrders: number[] = [];\n for (const section of sections) {\n const sectionTypeId =\n resolveEntityRefId((section as { sectionTypeId?: unknown }).sectionTypeId) ??\n String((section as { sectionTypeId?: string }).sectionTypeId ?? '').trim();\n if (!sectionTypeId) {\n continue;\n }\n\n const sectionType = (section as { sectionType?: { title?: string; code?: string; isRepeatable?: boolean } })\n .sectionType;\n const sectionTypeTitle = resolveSafetyPlanSectionPersistedTitle(\n undefined,\n sectionTypeId,\n sectionType,\n );\n\n if (allowed.size > 0 && !allowed.has(sectionTypeId)) {\n issues.push({\n code: 'SECTION_TYPE_NOT_ALLOWED',\n messageKey:\n '@workplacesafety-management:safety-plans.messages.section-structure.section-type-not-allowed',\n details: { sectionTypeId, sectionTypeTitle, sectionId: (section as { id?: string }).id },\n });\n }\n\n const sortOrder = (section as AXMSafetyPlanSectionStructureItem).sortOrder;\n if (typeof sortOrder === 'number' && Number.isFinite(sortOrder)) {\n sortOrders.push(sortOrder);\n }\n }\n\n if (sortOrders.length !== sections.length) {\n issues.push({\n code: 'INVALID_SORT_ORDER',\n messageKey: '@workplacesafety-management:safety-plans.messages.section-structure.invalid-sort-order',\n });\n } else {\n const unique = new Set(sortOrders);\n if (unique.size !== sortOrders.length) {\n issues.push({\n code: 'INVALID_SORT_ORDER',\n messageKey: '@workplacesafety-management:safety-plans.messages.section-structure.invalid-sort-order',\n details: { reason: 'duplicate' },\n });\n }\n }\n\n return issues;\n}\n\nexport function toBuilderValueFromStructure(\n structure: AXMSafetyPlanSectionStructureValue,\n): AXMSafetyPlanSectionBuilderValue {\n return {\n sections: structure.sections.map((section) => ({\n id: section.id,\n sectionTypeId: section.sectionTypeId,\n sectionType: section.sectionType,\n title: section.title,\n description: section.description ?? '',\n safetyPlanId: section.safetyPlanId,\n code: section.code,\n sourceSafetyPlanTypeSectionId: section.sourceSafetyPlanTypeSectionId,\n sortOrder: section.sortOrder,\n required: section.required,\n items: section.items.map((item) => ({\n id: item.id,\n itemIds: [...(item.itemIds ?? [])],\n items: item.items ? [...item.items] : [],\n })),\n })),\n };\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport type { AXMSectionTypeCode, AXMSectionTypeSnapshot } from './entities/section-type/section-type.types';\nimport type {\n AXMSafetyPlanSectionBuilderItemValue,\n AXMSafetyPlanSectionBuilderSectionValue,\n AXMSafetyPlanSectionBuilderValue,\n} from './safety-plan-section-builder.types';\nimport {\n resolveSectionItemEntityName,\n resolveSectionTypeKey,\n WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_BY_ID,\n WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS,\n} from './section-type-entity-map';\nimport { asSafetyPlanDisplayText } from './safety-plan-section-structure.util';\n\n//#endregion\n\n//#region ---- Dependency config ----\n\n/** Parent section type whose selected item IDs constrain the child lookup. */\nexport interface AXMSectionTypeParentFilterDependency {\n kind: 'parentFilter';\n parentSectionTypeKey: AXMSectionTypeCode;\n /** Field on the child lookup entity used for filtering (e.g. `hazardId`). */\n filterField: string;\n}\n\n/** Child lookup is filtered by IDs derived from parent entity records (e.g. `riskMatrixId` on HazardRisk). */\nexport interface AXMSectionTypeDerivedFilterDependency {\n kind: 'derivedFromParent';\n parentSectionTypeKey: AXMSectionTypeCode;\n /** Field path on the parent entity record used to resolve filter values. */\n resolveField: 'riskMatrixId';\n /** Field on the child lookup entity (typically `id`). */\n filterField: string;\n}\n\nexport type AXMSectionTypeDependency =\n | AXMSectionTypeParentFilterDependency\n | AXMSectionTypeDerivedFilterDependency;\n\n/** Declarative section-type dependencies resolved from prior sections in plan order. */\nexport const WORKPLACE_SAFETY_SECTION_TYPE_DEPENDENCIES: Partial<\n Record<AXMSectionTypeCode, AXMSectionTypeDependency>\n> = {\n HazardRisk: {\n kind: 'parentFilter',\n parentSectionTypeKey: 'Hazard',\n filterField: 'hazardId',\n },\n PpeHazards: {\n kind: 'parentFilter',\n parentSectionTypeKey: 'Hazard',\n filterField: 'hazardId',\n },\n HazardRiskPpe: {\n kind: 'parentFilter',\n parentSectionTypeKey: 'HazardRisk',\n filterField: 'hazardRiskId',\n },\n RiskMatrix: {\n kind: 'derivedFromParent',\n parentSectionTypeKey: 'HazardRisk',\n resolveField: 'riskMatrixId',\n filterField: 'id',\n },\n};\n\n/** Section types cleared when upstream hazard selections change. */\nexport const WORKPLACE_SAFETY_DOWNSTREAM_FROM_HAZARD: readonly AXMSectionTypeCode[] = [\n 'HazardRisk',\n 'PpeHazards',\n 'HazardRiskPpe',\n 'RiskMatrix',\n];\n\n/** Section types cleared when upstream hazard-risk selections change. */\nexport const WORKPLACE_SAFETY_DOWNSTREAM_FROM_HAZARD_RISK: readonly AXMSectionTypeCode[] = [\n 'HazardRiskPpe',\n 'RiskMatrix',\n];\n\nexport type AXMHazardRiskRecordLoader = (hazardRiskIds: string[]) => Promise<Record<string, unknown>[]>;\n\n//#endregion\n\n//#region ---- Lookup helpers ----\n\nexport const PARENT_HAZARD_IDS_CONTEXT_KEY = 'parentHazardIds';\n\nexport const PARENT_HAZARD_RISK_IDS_CONTEXT_KEY = 'parentHazardRiskIds';\n\n/** Expose paths when a section type is selected (shared by entity repeater and builder dialog). */\nexport const WORKPLACE_SAFETY_SECTION_TYPE_LOOKUP_EXPOSE = [\n { source: 'id', target: 'sectionType.id' },\n { source: 'title', target: 'sectionType.title' },\n { source: 'code', target: 'sectionType.code' },\n { source: 'description', target: 'sectionType.description' },\n { source: 'isRepeatable', target: 'sectionType.isRepeatable' },\n];\n\n/** Auto-fill section description when section type is selected. */\nexport const WORKPLACE_SAFETY_SECTION_TYPE_DESCRIPTION_SYNC_TRIGGERS = [\n {\n event: \"{{ events.context('sectionTypeId') }}\",\n action:\n \"{{ const items = widget.output('selectedItems'); const selectedDescription = Array.isArray(items) ? items[0]?.description : undefined; const d = selectedDescription || context.eval('sectionType.description') || ''; context.set('sectionTypeDescription', d); const descriptionWidget = widget.find('sectionTypeDescription'); if (descriptionWidget) { descriptionWidget.setValue(d); } }}\",\n },\n {\n event: \"{{ events.context('sectionType.description') }}\",\n action:\n \"{{ const d = context.eval('sectionType.description') || ''; context.set('sectionTypeDescription', d); const descriptionWidget = widget.find('sectionTypeDescription'); if (descriptionWidget) { descriptionWidget.setValue(d); } }}\",\n },\n];\n\n/** Auto-fill section title when section type is selected. */\nexport const WORKPLACE_SAFETY_SECTION_TYPE_TITLE_SYNC_TRIGGERS = [\n {\n event: \"{{ events.context('sectionTypeId') }}\",\n action:\n \"{{ const items = widget.output('selectedItems'); const selectedTitle = Array.isArray(items) ? items[0]?.title : undefined; const t = selectedTitle || context.eval('sectionType.title') || ''; if (t) { context.set('title', t); const titleWidget = widget.find('title'); if (titleWidget) { titleWidget.setValue(t); } } }}\",\n },\n {\n event: \"{{ events.context('sectionType.title') }}\",\n action:\n \"{{ const t = context.eval('sectionType.title') || ''; if (t) { context.set('title', t); const titleWidget = widget.find('title'); if (titleWidget) { titleWidget.setValue(t); } } }}\",\n },\n];\n\n/** Shared lookup widget options for section type pickers (builder dialog and entity forms). */\nexport const WORKPLACE_SAFETY_SECTION_TYPE_LOOKUP_WIDGET_OPTIONS: Record<string, unknown> = {\n look: 'select',\n allowSearch: true,\n textField: 'code',\n textTemplate: '{code} — {description}',\n valueField: 'id',\n columns: ['code', 'title', 'description'],\n expose: WORKPLACE_SAFETY_SECTION_TYPE_LOOKUP_EXPOSE,\n triggers: [\n ...WORKPLACE_SAFETY_SECTION_TYPE_TITLE_SYNC_TRIGGERS,\n ...WORKPLACE_SAFETY_SECTION_TYPE_DESCRIPTION_SYNC_TRIGGERS,\n ],\n};\n\n//#endregion\n\n//#region ---- Resolver API ----\n\nexport function getSectionTypeDependency(\n sectionTypeKey: string | undefined,\n): AXMSectionTypeDependency | undefined {\n if (!sectionTypeKey) {\n return undefined;\n }\n return WORKPLACE_SAFETY_SECTION_TYPE_DEPENDENCIES[sectionTypeKey as AXMSectionTypeCode];\n}\n\nexport function sectionTypeKeyFromSection(\n section: Pick<AXMSafetyPlanSectionBuilderSectionValue, 'sectionType' | 'sectionTypeId'>,\n): AXMSectionTypeCode | undefined {\n const sectionTypeId = section.sectionTypeId || section.sectionType?.id;\n const key = resolveSectionTypeKey(sectionTypeId, section.sectionType);\n return key;\n}\n\nfunction collectSectionItemIds(\n section: AXMSafetyPlanSectionBuilderSectionValue | undefined,\n sectionTypeKey: AXMSectionTypeCode,\n): string[] {\n if (!section?.items?.length || sectionTypeKeyFromSection(section) !== sectionTypeKey) {\n return [];\n }\n const ids = new Set<string>();\n for (const item of section.items) {\n for (const id of item.itemIds ?? []) {\n if (typeof id === 'string' && id.length > 0) {\n ids.add(id);\n }\n }\n }\n return [...ids];\n}\n\n/** Collects item IDs from sections up to `sectionIndex` whose type matches `parentSectionTypeKey`. */\nexport function resolveParentItemIds(\n sections: AXMSafetyPlanSectionBuilderSectionValue[],\n sectionIndex: number,\n parentSectionTypeKey: AXMSectionTypeCode,\n): string[] {\n const ids = new Set<string>();\n const lastIndex = Math.min(sectionIndex, sections.length - 1);\n for (let index = 0; index <= lastIndex; index += 1) {\n collectSectionItemIds(sections[index], parentSectionTypeKey).forEach((id) => ids.add(id));\n }\n return [...ids];\n}\n\n/** Collects hazard IDs from earlier sections and Hazard rows in the current section. */\nexport function resolveParentHazardIds(\n sections: AXMSafetyPlanSectionBuilderSectionValue[],\n sectionIndex: number,\n parentSectionTypeKey: AXMSectionTypeCode = 'Hazard',\n): string[] {\n return resolveParentItemIds(sections, sectionIndex, parentSectionTypeKey);\n}\n\n/** Collects hazard-risk IDs from prior HazardRisk sections up to `sectionIndex`. */\nexport function resolveParentHazardRiskIds(\n sections: AXMSafetyPlanSectionBuilderSectionValue[],\n sectionIndex: number,\n): string[] {\n return resolveParentItemIds(sections, sectionIndex, 'HazardRisk');\n}\n\nfunction parentItemSignature(\n sections: AXMSafetyPlanSectionBuilderSectionValue[],\n sectionIndex: number,\n parentSectionTypeKey: AXMSectionTypeCode,\n): string {\n return resolveParentItemIds(sections, sectionIndex, parentSectionTypeKey).sort().join('|');\n}\n\nfunction shouldClearSectionOnParentChange(\n section: AXMSafetyPlanSectionBuilderSectionValue,\n sectionIndex: number,\n changeIndex: number,\n parentTypeKey: AXMSectionTypeCode,\n downstreamTypes: readonly AXMSectionTypeCode[],\n): boolean {\n if (sectionIndex < changeIndex) {\n return false;\n }\n const sectionKey = sectionTypeKeyFromSection(section);\n if (!sectionKey || !downstreamTypes.includes(sectionKey)) {\n return false;\n }\n if (sectionIndex === changeIndex && sectionKey === parentTypeKey) {\n return false;\n }\n return section.items.some((item) => (item.itemIds?.length ?? 0) > 0);\n}\n\nfunction clearSectionItems(\n section: AXMSafetyPlanSectionBuilderSectionValue,\n): AXMSafetyPlanSectionBuilderSectionValue {\n return {\n ...section,\n items: section.items.map((item) => ({ ...item, itemIds: [], items: [] })),\n };\n}\n\n/**\n * When upstream hazard or hazard-risk selections change, clears item rows in later dependent sections.\n */\nexport function clearDependentItemsOnParentChange(\n previous: AXMSafetyPlanSectionBuilderValue,\n next: AXMSafetyPlanSectionBuilderValue,\n): AXMSafetyPlanSectionBuilderValue {\n if (!next.sections.length) {\n return next;\n }\n\n let changeIndex = next.sections.length;\n let hazardChanged = false;\n let hazardRiskChanged = false;\n\n for (let index = 0; index < next.sections.length; index += 1) {\n const prevHazardSig = parentItemSignature(previous.sections, index, 'Hazard');\n const nextHazardSig = parentItemSignature(next.sections, index, 'Hazard');\n if (prevHazardSig !== nextHazardSig) {\n changeIndex = Math.min(changeIndex, index);\n hazardChanged = true;\n }\n\n const prevRiskSig = parentItemSignature(previous.sections, index, 'HazardRisk');\n const nextRiskSig = parentItemSignature(next.sections, index, 'HazardRisk');\n if (prevRiskSig !== nextRiskSig) {\n changeIndex = Math.min(changeIndex, index);\n hazardRiskChanged = true;\n }\n }\n\n if (changeIndex === next.sections.length) {\n return next;\n }\n\n return {\n sections: next.sections.map((section, sectionIndex) => {\n const clearFromHazard =\n hazardChanged &&\n shouldClearSectionOnParentChange(\n section,\n sectionIndex,\n changeIndex,\n 'Hazard',\n WORKPLACE_SAFETY_DOWNSTREAM_FROM_HAZARD,\n );\n const clearFromHazardRisk =\n hazardRiskChanged &&\n shouldClearSectionOnParentChange(\n section,\n sectionIndex,\n changeIndex,\n 'HazardRisk',\n WORKPLACE_SAFETY_DOWNSTREAM_FROM_HAZARD_RISK,\n );\n\n if (!clearFromHazard && !clearFromHazardRisk) {\n return section;\n }\n return clearSectionItems(section);\n }),\n };\n}\n\nexport function extractRiskMatrixIdsFromHazardRisks(records: Record<string, unknown>[]): string[] {\n const ids = new Set<string>();\n for (const record of records) {\n const id = record['riskMatrixId'];\n if (typeof id === 'string' && id.length > 0) {\n ids.add(id);\n }\n }\n return [...ids];\n}\n\nfunction buildInFilter(field: string, values: string[]): Record<string, unknown> | null {\n const unique = [...new Set(values.filter((id) => id.length > 0))];\n if (!unique.length) {\n return null;\n }\n return {\n field,\n operator: { type: 'in' },\n value: unique,\n };\n}\n\n/** Filter that matches no records when parent context exists but derived IDs are empty. */\nfunction buildEmptyResultFilter(field: string): Record<string, unknown> {\n return {\n field,\n operator: { type: 'in' },\n value: ['00000000-0000-0000-0000-000000000000'],\n };\n}\n\nexport function resolveSafetyPlanSectionItemFilter(\n sectionTypeId: string,\n parentHazardIds: string[],\n parentHazardRiskIds: string[] = [],\n): Record<string, unknown> | null {\n const sectionTypeKey = resolveSectionTypeKey(sectionTypeId);\n const dependency = getSectionTypeDependency(sectionTypeKey);\n if (!dependency || dependency.kind !== 'parentFilter') {\n return null;\n }\n\n const parentIds =\n dependency.parentSectionTypeKey === 'Hazard' ? parentHazardIds : parentHazardRiskIds;\n if (!parentIds.length) {\n return null;\n }\n\n return buildInFilter(dependency.filterField, parentIds);\n}\n\nexport async function resolveSafetyPlanSectionItemFilterAsync(\n sectionTypeId: string,\n sections: AXMSafetyPlanSectionBuilderSectionValue[],\n sectionIndex: number,\n loadHazardRisks: AXMHazardRiskRecordLoader,\n): Promise<Record<string, unknown> | null> {\n const sectionTypeKey = resolveSectionTypeKey(sectionTypeId);\n const dependency = getSectionTypeDependency(sectionTypeKey);\n if (!dependency) {\n return null;\n }\n\n if (dependency.kind === 'parentFilter') {\n const parentIds = resolveParentItemIds(sections, sectionIndex, dependency.parentSectionTypeKey);\n if (!parentIds.length) {\n return null;\n }\n return buildInFilter(dependency.filterField, parentIds);\n }\n\n const parentIds = resolveParentItemIds(sections, sectionIndex, dependency.parentSectionTypeKey);\n if (!parentIds.length) {\n return null;\n }\n\n const records = await loadHazardRisks(parentIds);\n const derivedIds = extractRiskMatrixIdsFromHazardRisks(records);\n\n if (!derivedIds.length) {\n return buildEmptyResultFilter(dependency.filterField);\n }\n\n return buildInFilter(dependency.filterField, derivedIds);\n}\n\nconst defaultItemIdsPlaceholderKey =\n '@workplacesafety-management:safety-plan-sections.entities.safety-plan-section.fields.item-ids.placeholder';\n\n/** Clears item selection when section type changes in item dialog context. */\nexport const WORKPLACE_SAFETY_SECTION_ITEM_LOOKUP_CLEAR_ON_SECTION_TYPE_TRIGGERS = [\n {\n event: \"{{ events.context('sectionType.id') }}\",\n action: \"{{ widget.setValue([]); context.set('items', []); }}\",\n },\n {\n event: \"{{ events.context('sectionTypeId') }}\",\n action: \"{{ widget.setValue([]); context.set('items', []); }}\",\n },\n];\n\n/**\n * Reloads lookup data after section type is resolved (`sectionType.id`, `itemEntityName`).\n */\nexport const WORKPLACE_SAFETY_SECTION_ITEM_LOOKUP_REFRESH_ON_SECTION_TYPE_EXPOSE_TRIGGERS = [\n {\n event: \"{{ events.context('sectionType.id') }}\",\n action: '{{ widget.refresh(); }}',\n },\n {\n event: \"{{ events.context('sectionType.itemEntityName') }}\",\n action: '{{ widget.refresh(); }}',\n },\n {\n event: \"{{ events.context('sectionTypeId') }}\",\n action: '{{ widget.refresh(); }}',\n },\n];\n\nexport const WORKPLACE_SAFETY_SECTION_ITEM_LOOKUP_SECTION_TYPE_TRIGGERS = [\n ...WORKPLACE_SAFETY_SECTION_ITEM_LOOKUP_CLEAR_ON_SECTION_TYPE_TRIGGERS,\n ...WORKPLACE_SAFETY_SECTION_ITEM_LOOKUP_REFRESH_ON_SECTION_TYPE_EXPOSE_TRIGGERS,\n];\n\nfunction isPpeRuleSectionType(sectionTypeId: string): boolean {\n return (\n sectionTypeId === WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.ppeHazards ||\n sectionTypeId === WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.hazardRiskPpe\n );\n}\n\nfunction buildSectionTypeItemTextFieldExpression(sectionTypeIdPath: string): string {\n const ppeHazardsId = WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.ppeHazards;\n const hazardRiskPpeId = WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.hazardRiskPpe;\n return `{{ [ '${ppeHazardsId}', '${hazardRiskPpeId}' ].includes(context.eval('${sectionTypeIdPath}')) ? 'ppeItem.title' : 'title' }}`;\n}\n\nfunction buildSectionTypeItemColumnsExpression(sectionTypeIdPath: string): string {\n const ppeHazardsId = WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.ppeHazards;\n const hazardRiskPpeId = WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.hazardRiskPpe;\n const riskMatrixId = WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.riskMatrix;\n return `{{ context.eval('${sectionTypeIdPath}') === '${riskMatrixId}' ? ['code', 'title', 'matrix'] : [ '${ppeHazardsId}', '${hazardRiskPpeId}' ].includes(context.eval('${sectionTypeIdPath}')) ? ['code', 'ppeItem.title', 'requirementType'] : ['code', 'title'] }}`;\n}\n\nfunction buildSectionTypeDependentParentFilter(\n sectionTypeIdPath: string,\n parentIdsContextKey: string,\n parentSectionTypeKey: AXMSectionTypeCode,\n): Record<string, unknown> {\n const dependentSectionTypeIds = (\n Object.entries(WORKPLACE_SAFETY_SECTION_TYPE_DEPENDENCIES) as Array<\n [AXMSectionTypeCode, AXMSectionTypeDependency]\n >\n )\n .filter(([, config]) => config.kind === 'parentFilter' && config.parentSectionTypeKey === parentSectionTypeKey)\n .map(([key]) => {\n const id = Object.entries(WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_BY_ID).find(\n ([, meta]) => meta.sectionTypeKey === key,\n )?.[0];\n return id ? `'${id}'` : undefined;\n })\n .filter((id): id is string => Boolean(id))\n .join(',');\n\n return {\n field: parentSectionTypeKey === 'Hazard' ? 'hazardId' : 'hazardRiskId',\n operator: { type: 'in' },\n value: `{{ [${dependentSectionTypeIds}].includes(context.eval('${sectionTypeIdPath}')) ? ((context.eval('${parentIdsContextKey}') || []).length ? context.eval('${parentIdsContextKey}') : undefined) : undefined }}`,\n };\n}\n\nfunction buildSectionTypeDependentHazardFilter(\n sectionTypeIdPath: string,\n parentHazardIdsContextKey: string,\n): Record<string, unknown> {\n return buildSectionTypeDependentParentFilter(sectionTypeIdPath, parentHazardIdsContextKey, 'Hazard');\n}\n\nconst sectionItemLookupExpose = [\n { source: 'id', target: 'items.{id}' },\n { source: 'title', target: 'items.{title}' },\n { source: 'code', target: 'items.{code}' },\n { source: 'ppeItem.id', target: 'items.{id}' },\n { source: 'ppeItem.title', target: 'items.{title}' },\n { source: 'ppeItem.code', target: 'items.{code}' },\n];\n\n/** Shared item lookup options for builder item dialog (`sectionType.*` in dialog context). */\nexport function buildSafetyPlanSectionItemLookupOptions(\n entityExpression: string,\n options?: {\n /** Context path to section type id, e.g. `sectionType.id`. */\n sectionTypeIdPath?: string;\n /** Dialog context key for upstream hazard IDs (read at runtime; do not embed IDs in options). */\n parentHazardIdsContextKey?: string;\n /** Dialog context key for upstream hazard-risk IDs. */\n parentHazardRiskIdsContextKey?: string;\n defaultPlaceholderKey?: string;\n },\n): Record<string, unknown> {\n const sectionTypeIdPath = options?.sectionTypeIdPath ?? 'sectionType.id';\n const lookup: Record<string, unknown> = {\n entity: entityExpression,\n look: 'lookup',\n multiple: true,\n allowSearch: true,\n textField: buildSectionTypeItemTextFieldExpression(sectionTypeIdPath),\n columns: buildSectionTypeItemColumnsExpression(sectionTypeIdPath),\n placeholder: options?.defaultPlaceholderKey ?? defaultItemIdsPlaceholderKey,\n expose: sectionItemLookupExpose,\n triggers: WORKPLACE_SAFETY_SECTION_ITEM_LOOKUP_SECTION_TYPE_TRIGGERS,\n };\n\n const filters: Record<string, unknown>[] = [];\n if (options?.parentHazardIdsContextKey) {\n filters.push(\n buildSectionTypeDependentHazardFilter(sectionTypeIdPath, options.parentHazardIdsContextKey),\n );\n }\n if (options?.parentHazardRiskIdsContextKey) {\n filters.push(\n buildSectionTypeDependentParentFilter(\n sectionTypeIdPath,\n options.parentHazardRiskIdsContextKey,\n 'HazardRisk',\n ),\n );\n }\n if (filters.length === 1) {\n lookup['filter'] = filters[0];\n } else if (filters.length > 1) {\n lookup['filter'] = { logic: 'and', filters };\n }\n\n return lookup;\n}\n\n/** Lookup options with entity data-selector popup UI (`look: 'lookup'`). */\nexport function buildSafetyPlanSectionItemSelectorOptions(\n entityExpression: string,\n options?: Parameters<typeof buildSafetyPlanSectionItemLookupOptions>[1],\n): Record<string, unknown> {\n return {\n ...buildSafetyPlanSectionItemLookupOptions(entityExpression, options),\n look: 'lookup',\n };\n}\n\n/** Selector column: string names are visible; `{ visible: false }` is queried for widget context only. */\nexport type AXMSafetyPlanSectionItemColumn = string | { name: string; visible?: boolean };\n\nexport function resolveSafetyPlanSectionItemColumns(sectionTypeId: string): AXMSafetyPlanSectionItemColumn[] {\n if (sectionTypeId === WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.ppeHazards) {\n return ['code', 'ppeItem.title', 'requirementType'];\n }\n if (sectionTypeId === WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.hazardRiskPpe) {\n return ['code', 'hazardRisk.title', 'ppeItem.title', 'requirementType'];\n }\n if (sectionTypeId === WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.riskMatrix) {\n return [\n 'code',\n 'title',\n 'matrix',\n { name: 'likelihoodIds', visible: false },\n { name: 'severityIds', visible: false },\n { name: 'likelihoodId', visible: false },\n { name: 'severityId', visible: false },\n { name: 'matrixOrientation', visible: false },\n ];\n }\n return ['code', 'title'];\n}\n\nexport function resolveSafetyPlanSectionItemEntityKey(\n sectionTypeId: string,\n sectionType?: AXMSectionTypeSnapshot,\n): string | undefined {\n return resolveSectionItemEntityName(sectionTypeId, sectionType);\n}\n\nexport function mapSafetyPlanSectionSelectedItems(\n sectionTypeId: string,\n selectedItems: Array<Record<string, unknown>>,\n): Array<{ id: string; title?: string; code?: string }> {\n const isPpeHazards = sectionTypeId === WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.ppeHazards;\n const isHazardRiskPpe = sectionTypeId === WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.hazardRiskPpe;\n\n return selectedItems\n .map((item) => {\n if (isPpeHazards || isHazardRiskPpe) {\n const ppeItem = item['ppeItem'] as Record<string, unknown> | undefined;\n const id = String(ppeItem?.['id'] ?? item['id'] ?? '');\n return {\n id,\n title: asSafetyPlanDisplayText(ppeItem?.['title']) || undefined,\n code: asSafetyPlanDisplayText(ppeItem?.['code']) || undefined,\n };\n }\n return {\n id: String(item['id'] ?? ''),\n title: asSafetyPlanDisplayText(item['title']) || undefined,\n code: asSafetyPlanDisplayText(item['code']) || undefined,\n };\n })\n .filter((item) => item.id.length > 0);\n}\n\nexport function dedupeSafetyPlanSectionItemSelection(\n item: AXMSafetyPlanSectionBuilderItemValue,\n): AXMSafetyPlanSectionBuilderItemValue {\n const seen = new Set<string>();\n const itemIds: string[] = [];\n const items: NonNullable<AXMSafetyPlanSectionBuilderItemValue['items']> = [];\n\n for (let index = 0; index < (item.itemIds?.length ?? 0); index += 1) {\n const id = item.itemIds?.[index];\n if (typeof id !== 'string' || !id || seen.has(id)) {\n continue;\n }\n seen.add(id);\n itemIds.push(id);\n const snapshot =\n item.items?.find((entry) => entry?.id === id) ??\n (item.items?.[index]?.id === id || !item.items?.[index]?.id ? item.items?.[index] : undefined);\n items.push({\n id,\n title: asSafetyPlanDisplayText(snapshot?.title) || undefined,\n code: asSafetyPlanDisplayText(snapshot?.code) || undefined,\n });\n }\n\n return { ...item, itemIds, items };\n}\n\nexport function isPpeRuleSectionTypeId(sectionTypeId: string): boolean {\n return isPpeRuleSectionType(sectionTypeId);\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { AXPWidgetsList } from '@acorex-platform/framework-shared/core';\nimport {\n AXPEntity,\n createAllQueryView,\n entityMasterCrudActions,\n entityMasterRecordActions,\n} from '@acorex-platform/framework-shared/entity';\n\nimport { RootConfig } from '../../root-config';\nimport {\n buildSafetyPlanSectionItemSelectorOptions,\n WORKPLACE_SAFETY_SECTION_TYPE_LOOKUP_WIDGET_OPTIONS,\n} from '../../safety-plan-section-dependency';\nimport {\n buildWorkplaceSafetySectionTypeEntityExpression,\n WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS,\n} from '../../section-type-entity-map';\n\n//#endregion\n\n//#region ---- Constants ----\n\nconst listSortAndFilterOptions = {\n sort: { enabled: true },\n filter: { advance: { enabled: true }, inline: { enabled: true } },\n};\n\n/**\n * Section-type picker for activity item rows — no title/description sync (those would\n * write onto the parent SafetyPlanActivity fields), and Activity itself is excluded.\n * Keep `expose` so `sectionType.id` updates and itemIds cascade can react.\n */\nconst ACTIVITY_ITEMS_SECTION_TYPE_LOOKUP_OPTIONS: Record<string, unknown> = {\n ...WORKPLACE_SAFETY_SECTION_TYPE_LOOKUP_WIDGET_OPTIONS,\n triggers: [],\n filter: {\n logic: 'and',\n filters: [\n {\n field: 'id',\n operator: { type: 'notEqual' },\n value: WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.activity,\n },\n ],\n },\n};\n\n/**\n * Bound sectionTypeId on the repeater row (parent of the itemIds lookup).\n * `>` is required at eval time for the correct row value.\n */\nconst ACTIVITY_ITEM_SECTION_TYPE_ID_PATH = '>sectionTypeId';\n\n/** Maps row sectionTypeId → catalog entity (Hazard, Ppe, Control, …). */\nconst ACTIVITY_ITEM_ENTITY_EXPRESSION = buildWorkplaceSafetySectionTypeEntityExpression(\n ACTIVITY_ITEM_SECTION_TYPE_ID_PATH,\n);\n\n/**\n * Enable itemIds once the row has a section type.\n *\n * `>sectionTypeId` alone does not re-trigger option updates for nested paths like\n * `items.[n].sectionTypeId` (renderer dependency matching ignores the `>` prefix).\n * Including bare `sectionTypeId` makes `isSegmentSuffix` treat the nested change as\n * relevant so disabled/entity expressions re-evaluate after selection.\n */\nconst ACTIVITY_ITEM_IDS_DISABLED_EXPRESSION =\n \"{{ !(context.eval('>sectionTypeId') || context.eval('sectionTypeId')) }}\";\n\n/**\n * Activity-only cascade: clear selection + refresh entity/data when section type changes.\n * Do not use the shared section triggers — they call `context.set('items', [])`, which\n * would wipe this entity's `items` repeater (same key as the lookup expose parent).\n */\nconst ACTIVITY_ITEM_IDS_SECTION_TYPE_TRIGGERS = [\n {\n event: \"{{ events.context('sectionType.id') }}\",\n action: '{{ widget.setValue([]); widget.refresh(); }}',\n },\n {\n event: \"{{ events.context('sectionTypeId') }}\",\n action: '{{ widget.setValue([]); widget.refresh(); }}',\n },\n];\n\n/** Same repeater widget tree as {@link safetyPlanSectionEntityFactory} `items`. */\nconst ITEMS_REPEATER_CHILDREN = [\n {\n type: AXPWidgetsList.Layouts.GridLayout,\n mode: 'edit' as const,\n name: 'itemRow',\n options: {\n grid: {\n default: {\n columns: 12,\n gap: '1rem',\n },\n },\n },\n children: [\n {\n type: AXPWidgetsList.Layouts.GridItemLayout,\n mode: 'edit' as const,\n options: { colSpan: 4 },\n children: [\n {\n type: AXPWidgetsList.Layouts.FormField,\n mode: 'edit' as const,\n options: {\n label:\n '@workplacesafety-management:safety-plan-sections.entities.safety-plan-section.fields.section-type.title',\n showLabel: true,\n },\n children: [\n {\n type: AXPWidgetsList.Editors.LookupBox,\n mode: 'edit' as const,\n path: 'sectionTypeId',\n name: 'sectionTypeId',\n options: {\n entity: `${RootConfig.module.name}.${RootConfig.entities.sectionType.name}`,\n ...ACTIVITY_ITEMS_SECTION_TYPE_LOOKUP_OPTIONS,\n },\n },\n ],\n },\n ],\n },\n {\n type: AXPWidgetsList.Layouts.GridItemLayout,\n mode: 'edit' as const,\n options: { colSpan: 8 },\n children: [\n {\n type: AXPWidgetsList.Layouts.FormField,\n mode: 'edit' as const,\n options: {\n label:\n '@workplacesafety-management:safety-plan-sections.entities.safety-plan-section.fields.item-ids.title',\n showLabel: true,\n },\n children: [\n {\n type: AXPWidgetsList.Editors.LookupBox,\n mode: 'edit' as const,\n path: 'itemIds',\n name: 'itemIds',\n triggers: ACTIVITY_ITEM_IDS_SECTION_TYPE_TRIGGERS,\n options: {\n ...buildSafetyPlanSectionItemSelectorOptions(ACTIVITY_ITEM_ENTITY_EXPRESSION, {\n sectionTypeIdPath: ACTIVITY_ITEM_SECTION_TYPE_ID_PATH,\n }),\n // Shared options expose into `items.*` — that key is this entity's repeater.\n expose: [],\n triggers: ACTIVITY_ITEM_IDS_SECTION_TYPE_TRIGGERS,\n valueField: 'id',\n disabled: ACTIVITY_ITEM_IDS_DISABLED_EXPRESSION,\n },\n },\n ],\n },\n ],\n },\n ],\n },\n];\n\nconst itemsPropertyLayout = {\n name: 'items',\n layout: { label: { visible: false }, order: 1, positions: { lg: { colSpan: 12 } } },\n};\n\n//#endregion\n\n//#region ---- Entity factory ----\n\nexport async function safetyPlanActivityEntityFactory(): Promise<AXPEntity | null> {\n const entityDef: AXPEntity = {\n module: RootConfig.module.name,\n name: RootConfig.entities.safetyPlanActivity.name,\n title: RootConfig.entities.safetyPlanActivity.title,\n icon: RootConfig.entities.safetyPlanActivity.icon,\n searchTags: [\n 'safety-plan-activity',\n 'safety plan activity',\n 'activity',\n 'work activity',\n 'plan activity',\n 'فعالیت برنامه ایمنی',\n 'فعالیت',\n 'برنامه ایمنی',\n 'ایمنی محیط کار',\n ],\n formats: {\n individual: RootConfig.entities.safetyPlanActivity.title,\n plural: RootConfig.entities.safetyPlanActivity.titlePlural,\n searchResult: {\n title: '{{ code }}',\n description: '{{ description }}',\n },\n },\n plugins: [\n { name: 'identifier', options: { field: 'code', rule: 'safety-plan-activity-code' } },\n { name: 'unique-fields', options: { fields: 'code', scope: 'global' } },\n { name: 'archive' },\n {\n name: 'attachments',\n options: {\n accept: '.jpg,.jpeg,.png,.pdf,.doc,.docx',\n fileEditable: true,\n display: 'page',\n },\n },\n ],\n relatedEntities: [],\n groups: [\n {\n id: 'basic-info',\n title:\n '@workplacesafety-management:safety-plan-activities.entities.safety-plan-activity.groups.basic-info',\n },\n {\n id: 'items',\n title: '@workplacesafety-management:safety-plan-activities.entities.safety-plan-activity.groups.items',\n },\n ],\n properties: [\n {\n name: 'id',\n title: '@general:terms.common.id',\n groupId: 'basic-info',\n schema: { dataType: 'uuid', visible: false, nullable: false, readonly: true, unique: { enabled: true } },\n },\n {\n name: 'code',\n title: '@workplacesafety-management:safety-plan-activities.entities.safety-plan-activity.fields.code.title',\n groupId: 'basic-info',\n options: listSortAndFilterOptions,\n schema: {\n dataType: 'string',\n unique: { enabled: true },\n interface: {\n type: AXPWidgetsList.Editors.TextBox,\n options: {\n disabled: true,\n placeholder:\n '@workplacesafety-management:safety-plan-activities.entities.safety-plan-activity.fields.code.placeholder',\n },\n },\n },\n validations: [{ rule: 'required' }],\n },\n {\n name: 'title',\n title: '@workplacesafety-management:safety-plan-activities.entities.safety-plan-activity.fields.title.title',\n groupId: 'basic-info',\n options: listSortAndFilterOptions,\n schema: {\n dataType: 'string',\n interface: {\n type: AXPWidgetsList.Editors.TextBox,\n options: {\n placeholder:\n '@workplacesafety-management:safety-plan-activities.entities.safety-plan-activity.fields.title.placeholder',\n },\n },\n },\n validations: [{ rule: 'required' }],\n },\n {\n name: 'description',\n title:\n '@workplacesafety-management:safety-plan-activities.entities.safety-plan-activity.fields.description.title',\n groupId: 'basic-info',\n options: {\n sort: { enabled: false },\n filter: { advance: { enabled: true }, inline: { enabled: false } },\n },\n schema: {\n dataType: 'string',\n interface: {\n type: AXPWidgetsList.Editors.LargeTextBox,\n options: {\n rows: 2,\n placeholder:\n '@workplacesafety-management:safety-plan-activities.entities.safety-plan-activity.fields.description.placeholder',\n },\n },\n },\n },\n {\n name: 'items',\n title: '',\n groupId: 'items',\n schema: {\n defaultValue: [],\n dataType: 'array',\n nullable: true,\n interface: {\n type: AXPWidgetsList.Layouts.RepeaterLayout,\n options: { hasControls: true, allowReorder: true },\n children: [...ITEMS_REPEATER_CHILDREN],\n },\n },\n },\n ],\n columns: [\n { name: 'code', options: { width: '120px', order: 1 } },\n { name: 'title', options: { width: '200px', order: 2 } },\n { name: 'description', options: { width: '280px', order: 3 } },\n ],\n interfaces: {\n master: {\n create: {\n sections: [{ id: 'basic-info' }, { id: 'items' }],\n properties: [\n { name: 'code', layout: { positions: { lg: { colSpan: 6, order: 1 } } } },\n { name: 'title', layout: { positions: { lg: { colSpan: 12, order: 2 } } } },\n { name: 'description', layout: { positions: { lg: { colSpan: 12, order: 3 } } } },\n itemsPropertyLayout,\n ],\n },\n update: {\n sections: [{ id: 'basic-info' }, { id: 'items' }],\n properties: [\n { name: 'code', layout: { positions: { lg: { colSpan: 6, order: 1 } } } },\n { name: 'title', layout: { positions: { lg: { colSpan: 12, order: 2 } } } },\n { name: 'description', layout: { positions: { lg: { colSpan: 12, order: 3 } } } },\n itemsPropertyLayout,\n ],\n },\n single: {\n title: '{{ title }}',\n sections: [\n { id: 'basic-info', layout: { positions: { lg: { colSpan: 12 } } } },\n { id: 'items', layout: { positions: { lg: { colSpan: 12 } } } },\n ],\n properties: [\n { name: 'code', layout: { positions: { lg: { colSpan: 6, order: 1 } } } },\n { name: 'title', layout: { positions: { lg: { colSpan: 12, order: 2 } } } },\n { name: 'description', layout: { positions: { lg: { colSpan: 12, order: 3 } } } },\n itemsPropertyLayout,\n ],\n actions: [...entityMasterRecordActions()],\n },\n list: {\n actions: [...entityMasterCrudActions()],\n views: [createAllQueryView({ sorts: [{ name: 'code', dir: 'asc' }] })],\n },\n },\n },\n };\n\n return entityDef;\n}\n\n//#endregion\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './entity-entry.safety-plan-activity';\n"],"names":[],"mappings":";;;AAAA,MAAM,MAAM,GAAG;AACb,IAAA,IAAI,EAAE,4BAA4B;AAClC,IAAA,MAAM,EAAE,2BAA2B;CAC3B;AAEH,MAAM,UAAU,GAAG;IACxB,MAAM;AACN,IAAA,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC,MAAM;AACnB,QAAA,KAAK,EAAE,CAAA,CAAA,EAAI,MAAM,CAAC,IAAI,CAAA,aAAA,CAAe;AACrC,QAAA,IAAI,EAAE,6BAA6B;AACpC,KAAA;AACD,IAAA,QAAQ,EAAE;AACR,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,QAAQ;AACd,YAAA,MAAM,EAAE,CAAA,EAAG,MAAM,CAAC,MAAM,CAAA,OAAA,CAAS;AACjC,YAAA,KAAK,EAAE,CAAA,CAAA,EAAI,MAAM,CAAC,IAAI,CAAA,8BAAA,CAAgC;AACtD,YAAA,WAAW,EAAE,CAAA,CAAA,EAAI,MAAM,CAAC,IAAI,CAAA,+BAAA,CAAiC;AAC7D,YAAA,IAAI,EAAE,kCAAkC;AACzC,SAAA;AACD,QAAA,cAAc,EAAE;AACd,YAAA,IAAI,EAAE,gBAAgB;AACtB,YAAA,MAAM,EAAE,CAAA,EAAG,MAAM,CAAC,MAAM,CAAA,eAAA,CAAiB;AACzC,YAAA,KAAK,EAAE,CAAA,CAAA,EAAI,MAAM,CAAC,IAAI,CAAA,gDAAA,CAAkD;AACxE,YAAA,WAAW,EAAE,CAAA,CAAA,EAAI,MAAM,CAAC,IAAI,CAAA,iDAAA,CAAmD;AAC/E,YAAA,IAAI,EAAE,4BAA4B;AACnC,SAAA;AACD,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AAK,EAAE,CAAC,kBAAkB,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;AACvE,iBAAA;AACF,aAAA;AACF,SAAA;KACF;AAED,IAAA,OAAO,SAAS;AAClB;AAEA;;ACtWA;;AAEG;;"}
@@ -111,11 +111,11 @@ const RootConfig = {
111
111
  titlePlural: `@${config.i18n}:work-step-types.entities.work-step-type.plural`,
112
112
  icon: 'fa-light fa-list-tree',
113
113
  },
114
- safetyPlanWorkStep: {
115
- name: 'SafetyPlanWorkStep',
116
- source: `${config.module}.SafetyPlanWorkStep`,
117
- title: `@${config.i18n}:safety-plan-work-steps.entities.safety-plan-work-step.title`,
118
- titlePlural: `@${config.i18n}:safety-plan-work-steps.entities.safety-plan-work-step.plural`,
114
+ safetyPlanActivity: {
115
+ name: 'SafetyPlanActivity',
116
+ source: `${config.module}.SafetyPlanActivity`,
117
+ title: `@${config.i18n}:safety-plan-activities.entities.safety-plan-activity.title`,
118
+ titlePlural: `@${config.i18n}:safety-plan-activities.entities.safety-plan-activity.plural`,
119
119
  icon: 'fa-light fa-list-check',
120
120
  },
121
121
  },
@@ -135,6 +135,11 @@ const RootConfig = {
135
135
  },
136
136
  };
137
137
 
138
+ /** Risk matrix entity key in the risk-management module. */
139
+ const RISK_MANAGEMENT_RISK_MATRIX_ENTITY = 'RiskManagement.RiskMatrix';
140
+ /** Hazard catalog scope for risk matrix lookup filtering. */
141
+ const RISK_MANAGEMENT_HAZARD_CATALOG_SCOPE = 'risk-management.hazard';
142
+
138
143
  //#region ---- Imports ----
139
144
  //#endregion
140
145
  //#region ---- Built-in section type IDs ----
@@ -149,7 +154,7 @@ const WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS = {
149
154
  ppeHazards: 'c1d2e3f4-a5b6-4789-c001-000000000007',
150
155
  riskMatrix: 'c1d2e3f4-a5b6-4789-c001-000000000008',
151
156
  hazardRiskPpe: 'c1d2e3f4-a5b6-4789-c001-000000000009',
152
- stepTable: 'c1d2e3f4-a5b6-4789-c001-00000000000a',
157
+ activity: 'c1d2e3f4-a5b6-4789-c001-00000000000a',
153
158
  };
154
159
  const moduleName = RootConfig.module.name;
155
160
  /** Maps section type codes to the entity that supplies selectable items. */
@@ -161,10 +166,10 @@ const WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_BY_CODE = {
161
166
  HazardRiskPpe: undefined,
162
167
  Control: `${moduleName}.${RootConfig.entities.controlMeasure.name}`,
163
168
  HierarchyLevel: `${moduleName}.${RootConfig.entities.controlHierarchyLevels.name}`,
164
- RiskMatrix: 'RiskManagement.RiskMatrixCell',
169
+ RiskMatrix: RISK_MANAGEMENT_RISK_MATRIX_ENTITY,
165
170
  Custom: undefined,
166
- /** Host section for SafetyPlanWorkStep rows (managed by the section builder, not a catalog picker). */
167
- StepTable: undefined,
171
+ /** Host section for Activity rows (managed by the section builder, not a catalog picker). */
172
+ Activity: undefined,
168
173
  };
169
174
  /** Built-in section types resolved by stable section type id. */
170
175
  const WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_BY_ID = {
@@ -205,9 +210,9 @@ const WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_BY_ID = {
205
210
  itemEntityName: WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_BY_CODE.Custom,
206
211
  isRepeatable: true,
207
212
  },
208
- [WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.stepTable]: {
209
- sectionTypeKey: 'StepTable',
210
- itemEntityName: WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_BY_CODE.StepTable,
213
+ [WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.activity]: {
214
+ sectionTypeKey: 'Activity',
215
+ itemEntityName: WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_BY_CODE.Activity,
211
216
  isRepeatable: true,
212
217
  },
213
218
  };
@@ -226,6 +231,50 @@ function resolveSectionTypeKey(sectionTypeId, snapshot) {
226
231
  return WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_BY_ID[sectionTypeId]
227
232
  ?.sectionTypeKey;
228
233
  }
234
+ /**
235
+ * Human-readable titles for built-in section type keys (matches seeded SectionType titles).
236
+ * Used when snapshots lack `title` (common after id-only enrichment).
237
+ */
238
+ const SECTION_TYPE_KEY_DISPLAY_TITLES = {
239
+ Hazard: 'Hazard',
240
+ HazardRisk: 'Hazard Risk',
241
+ Ppe: 'PPE',
242
+ PpeHazards: 'Hazard PPE Items',
243
+ HazardRiskPpe: 'Hazard Risk PPE',
244
+ Control: 'Control',
245
+ HierarchyLevel: 'Hierarchy Level',
246
+ RiskMatrix: 'Risk Matrix',
247
+ Custom: 'Custom',
248
+ Activity: 'Activity',
249
+ };
250
+ /** Formats a section type key for display (e.g. `HierarchyLevel` → `Hierarchy Level`). */
251
+ function formatSectionTypeKeyAsTitle(key) {
252
+ if (!key) {
253
+ return '';
254
+ }
255
+ const known = SECTION_TYPE_KEY_DISPLAY_TITLES[key];
256
+ if (known) {
257
+ return known;
258
+ }
259
+ return key.replace(/([a-z\d])([A-Z])/g, '$1 $2').trim();
260
+ }
261
+ /**
262
+ * Resolves a section type label for UI/preview: snapshot title → key display title → spaced code.
263
+ */
264
+ function resolveSectionTypeDisplayTitle(sectionTypeId, snapshot) {
265
+ if (typeof snapshot?.title === 'string' && snapshot.title.trim()) {
266
+ return snapshot.title.trim();
267
+ }
268
+ const key = resolveSectionTypeKey(sectionTypeId, snapshot ?? undefined);
269
+ const fromKey = formatSectionTypeKeyAsTitle(key);
270
+ if (fromKey) {
271
+ return fromKey;
272
+ }
273
+ if (typeof snapshot?.code === 'string' && snapshot.code.trim()) {
274
+ return formatSectionTypeKeyAsTitle(snapshot.code.trim()) || snapshot.code.trim();
275
+ }
276
+ return '';
277
+ }
229
278
  function resolveSectionItemEntityName(sectionTypeId, snapshot) {
230
279
  const fromSnapshot = snapshot?.itemEntityName;
231
280
  if (typeof fromSnapshot === 'string' && fromSnapshot.length > 0) {
@@ -267,6 +316,13 @@ function buildSectionTypeEntityExpressionWithSnapshotFallback(sectionTypeIdPath,
267
316
  * For repeater / nested FormField widgets — `>` walks up to the row where `sectionType` is exposed.
268
317
  */
269
318
  const WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_EXPRESSION = buildSectionTypeEntityExpressionWithSnapshotFallback('>sectionType.id', '>sectionType.itemEntityName');
319
+ /**
320
+ * Entity expression keyed by the bound `sectionTypeId` field (repeater-safe).
321
+ * Prefer this when expose snapshots may not live on the same path the lookup evaluates.
322
+ */
323
+ function buildWorkplaceSafetySectionTypeEntityExpression(sectionTypeIdPath) {
324
+ return buildSectionTypeEntityExpressionById(sectionTypeIdPath);
325
+ }
270
326
  /**
271
327
  * For flat dialog / dynamic forms — sibling fields share the same context (no parent path).
272
328
  */
@@ -1237,6 +1293,20 @@ async function safetyPlanSectionEntityFactory() {
1237
1293
  name: RootConfig.entities.safetyPlanSection.name,
1238
1294
  title: RootConfig.entities.safetyPlanSection.title,
1239
1295
  icon: RootConfig.entities.safetyPlanSection.icon,
1296
+ searchTags: [
1297
+ 'safety-plan-section',
1298
+ 'safety plan section',
1299
+ 'plan section',
1300
+ 'section content',
1301
+ 'work step section',
1302
+ 'safety plan',
1303
+ 'section type',
1304
+ 'بخش برنامه ایمنی',
1305
+ 'بخش‌های برنامه ایمنی',
1306
+ 'برنامه ایمنی',
1307
+ 'نوع بخش',
1308
+ 'گام کاری',
1309
+ ],
1240
1310
  relatedEntities: [],
1241
1311
  formats: {
1242
1312
  individual: RootConfig.entities.safetyPlanSection.title,