openplanr 3.0.1 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (223) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/cli/commands/init-deterministic.d.ts.map +1 -1
  3. package/dist/cli/commands/init-deterministic.js +49 -6
  4. package/dist/cli/commands/init-deterministic.js.map +1 -1
  5. package/dist/dashboard/.vite/manifest.json +2 -2
  6. package/dist/dashboard/assets/{index-Bk8DyO_2.css → index-BU5fzjyz.css} +1 -1
  7. package/dist/dashboard/assets/index-G7ygVDGg.js +572 -0
  8. package/dist/dashboard/assets/index-G7ygVDGg.js.map +1 -0
  9. package/dist/dashboard/dashboard-manifest.json +14 -14
  10. package/dist/dashboard/index.html +2 -2
  11. package/dist/models/types.d.ts +0 -46
  12. package/dist/models/types.d.ts.map +1 -1
  13. package/dist/services/capability-map-service.d.ts +4 -0
  14. package/dist/services/capability-map-service.d.ts.map +1 -1
  15. package/dist/services/capability-map-service.js +7 -1
  16. package/dist/services/capability-map-service.js.map +1 -1
  17. package/dist/services/claude-plugin-service.d.ts +6 -1
  18. package/dist/services/claude-plugin-service.d.ts.map +1 -1
  19. package/dist/services/claude-plugin-service.js +54 -15
  20. package/dist/services/claude-plugin-service.js.map +1 -1
  21. package/dist/services/config-service.d.ts +24 -1
  22. package/dist/services/config-service.d.ts.map +1 -1
  23. package/dist/services/config-service.js +69 -2
  24. package/dist/services/config-service.js.map +1 -1
  25. package/dist/services/git-service.d.ts +5 -0
  26. package/dist/services/git-service.d.ts.map +1 -1
  27. package/dist/services/git-service.js +27 -0
  28. package/dist/services/git-service.js.map +1 -1
  29. package/dist/services/linear-pull-service.d.ts.map +1 -1
  30. package/dist/services/linear-pull-service.js +1 -2
  31. package/dist/services/linear-pull-service.js.map +1 -1
  32. package/dist/services/pipeline-package-service.d.ts +2 -0
  33. package/dist/services/pipeline-package-service.d.ts.map +1 -1
  34. package/dist/services/pipeline-package-service.js +2 -1
  35. package/dist/services/pipeline-package-service.js.map +1 -1
  36. package/dist/services/runtime-change-summary.d.ts.map +1 -1
  37. package/dist/services/runtime-change-summary.js +4 -0
  38. package/dist/services/runtime-change-summary.js.map +1 -1
  39. package/dist/services/runtime-manager-service.d.ts.map +1 -1
  40. package/dist/services/runtime-manager-service.js +14 -3
  41. package/dist/services/runtime-manager-service.js.map +1 -1
  42. package/dist/services/spec-service.d.ts.map +1 -1
  43. package/dist/services/spec-service.js +11 -22
  44. package/dist/services/spec-service.js.map +1 -1
  45. package/dist/services/upgrade-service.d.ts.map +1 -1
  46. package/dist/services/upgrade-service.js +3 -1
  47. package/dist/services/upgrade-service.js.map +1 -1
  48. package/dist/templates/rules/shared/capability-map.md.hbs +2 -2
  49. package/lib/host-packages/adapter-registry.json +5 -5
  50. package/lib/host-packages/capability-map.json +89 -29
  51. package/lib/host-packages/claude/.claude-plugin/marketplace.json +2 -2
  52. package/lib/host-packages/claude/openplanr/.claude-plugin/plugin.json +1 -1
  53. package/lib/host-packages/claude/openplanr/.openplanr-content.json +69 -37
  54. package/lib/host-packages/claude/openplanr/CONNECTORS.md +62 -0
  55. package/lib/host-packages/claude/openplanr/README.md +1 -1
  56. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-share.mjs +1 -1
  57. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-shared-protocol-contracts-31a760fc.mjs +259 -36
  58. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +54 -54
  59. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/lib/artifact/ui/studio-shell.css +1 -1
  60. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/03-protocol-contracts.js +259 -36
  61. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources.json +4 -4
  62. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/package.json +3 -3
  63. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/02-react.js +43 -24
  64. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/03-react-dom-client-fiber-foundations.js +279 -58
  65. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/04-react-dom-client-reconciliation-hooks.js +50 -42
  66. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/05-react-dom-client-render-phases.js +282 -146
  67. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/06-react-dom-client-commit-effects.js +949 -316
  68. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/07-react-dom-client-work-loop-scheduling.js +143 -87
  69. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/08-react-dom-client-dom-events-properties-hydration.js +930 -183
  70. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/09-react-dom-client-public-roots.js +17 -15
  71. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/14-interface-primitives.js +375 -191
  72. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/15-interface-primitives.js +140 -105
  73. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources.json +23 -23
  74. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/package.json +4 -4
  75. package/lib/host-packages/claude/openplanr/runtime/plan/scripts/design-protocol-contracts.mjs +259 -36
  76. package/lib/host-packages/claude/openplanr/runtime/plan/scripts/runtime/packages/protocol/package.json +4 -4
  77. package/lib/host-packages/claude/openplanr/skills/connect/SKILL.md +60 -0
  78. package/lib/host-packages/claude/openplanr/skills/connect/references/connectors.md +62 -0
  79. package/lib/host-packages/claude/openplanr/skills/openplanr/SKILL.md +4 -0
  80. package/lib/host-packages/claude/openplanr/skills/plan/SKILL.md +4 -1
  81. package/lib/host-packages/claude/openplanr/skills/plan/scripts/planning-ids.mjs +49 -3
  82. package/lib/host-packages/claude/openplanr/skills/share/SKILL.md +87 -0
  83. package/lib/host-packages/claude/openplanr/skills/share/references/connectors.md +62 -0
  84. package/lib/host-packages/claude/openplanr/skills/ship/SKILL.md +6 -3
  85. package/lib/host-packages/claude/openplanr/skills/ship/scripts/discover-verification.mjs +2 -1
  86. package/lib/host-packages/claude/openplanr/skills/sprint/SKILL.md +15 -6
  87. package/lib/host-packages/claude/openplanr/skills/sprint/references/connectors.md +62 -0
  88. package/lib/host-packages/claude/openplanr/skills/sprint/references/tracker-connections.md +9 -13
  89. package/lib/host-packages/claude/openplanr/skills/status/SKILL.md +14 -3
  90. package/lib/host-packages/claude/openplanr/skills/status/references/connectors.md +62 -0
  91. package/lib/host-packages/claude/openplanr/skills/status/references/tracker-connections.md +9 -13
  92. package/lib/host-packages/claude/openplanr/skills/sync/SKILL.md +25 -10
  93. package/lib/host-packages/claude/openplanr/skills/sync/references/connectors.md +62 -0
  94. package/lib/host-packages/claude/openplanr/skills/sync/references/tracker-connections.md +9 -13
  95. package/lib/host-packages/cursor/openplanr/.openplanr-content.json +68 -36
  96. package/lib/host-packages/cursor/openplanr/CONNECTORS.md +62 -0
  97. package/lib/host-packages/cursor/openplanr/manifest.json +4 -2
  98. package/lib/host-packages/cursor/openplanr/rules/planr-connect/references/connectors.md +62 -0
  99. package/lib/host-packages/cursor/openplanr/rules/planr-connect.mdc +58 -0
  100. package/lib/host-packages/cursor/openplanr/rules/planr-openplanr.mdc +4 -0
  101. package/lib/host-packages/cursor/openplanr/rules/planr-plan/scripts/planning-ids.mjs +49 -3
  102. package/lib/host-packages/cursor/openplanr/rules/planr-plan.mdc +4 -1
  103. package/lib/host-packages/cursor/openplanr/rules/planr-share/references/connectors.md +62 -0
  104. package/lib/host-packages/cursor/openplanr/rules/planr-share.mdc +85 -0
  105. package/lib/host-packages/cursor/openplanr/rules/planr-ship/scripts/discover-verification.mjs +2 -1
  106. package/lib/host-packages/cursor/openplanr/rules/planr-ship.mdc +6 -3
  107. package/lib/host-packages/cursor/openplanr/rules/planr-sprint/references/connectors.md +62 -0
  108. package/lib/host-packages/cursor/openplanr/rules/planr-sprint/references/tracker-connections.md +9 -13
  109. package/lib/host-packages/cursor/openplanr/rules/planr-sprint.mdc +15 -6
  110. package/lib/host-packages/cursor/openplanr/rules/planr-status/references/connectors.md +62 -0
  111. package/lib/host-packages/cursor/openplanr/rules/planr-status/references/tracker-connections.md +9 -13
  112. package/lib/host-packages/cursor/openplanr/rules/planr-status.mdc +14 -3
  113. package/lib/host-packages/cursor/openplanr/rules/planr-sync/references/connectors.md +62 -0
  114. package/lib/host-packages/cursor/openplanr/rules/planr-sync/references/tracker-connections.md +9 -13
  115. package/lib/host-packages/cursor/openplanr/rules/planr-sync.mdc +25 -10
  116. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-share.mjs +1 -1
  117. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-shared-protocol-contracts-31a760fc.mjs +259 -36
  118. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +54 -54
  119. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/lib/artifact/ui/studio-shell.css +1 -1
  120. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/03-protocol-contracts.js +259 -36
  121. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources.json +4 -4
  122. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/package.json +3 -3
  123. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/02-react.js +43 -24
  124. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/03-react-dom-client-fiber-foundations.js +279 -58
  125. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/04-react-dom-client-reconciliation-hooks.js +50 -42
  126. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/05-react-dom-client-render-phases.js +282 -146
  127. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/06-react-dom-client-commit-effects.js +949 -316
  128. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/07-react-dom-client-work-loop-scheduling.js +143 -87
  129. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/08-react-dom-client-dom-events-properties-hydration.js +930 -183
  130. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/09-react-dom-client-public-roots.js +17 -15
  131. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/14-interface-primitives.js +375 -191
  132. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/15-interface-primitives.js +140 -105
  133. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources.json +23 -23
  134. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/package.json +4 -4
  135. package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/design-protocol-contracts.mjs +259 -36
  136. package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/runtime/packages/protocol/package.json +4 -4
  137. package/lib/host-packages/openai/.claude-plugin/marketplace.json +2 -2
  138. package/lib/host-packages/openai/openplanr/.codex-plugin/plugin.json +1 -1
  139. package/lib/host-packages/openai/openplanr/.openplanr-content.json +87 -39
  140. package/lib/host-packages/openai/openplanr/CONNECTORS.md +62 -0
  141. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-share.mjs +1 -1
  142. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-shared-protocol-contracts-31a760fc.mjs +259 -36
  143. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +54 -54
  144. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/lib/artifact/ui/studio-shell.css +1 -1
  145. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/03-protocol-contracts.js +259 -36
  146. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources.json +4 -4
  147. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/package.json +3 -3
  148. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/02-react.js +43 -24
  149. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/03-react-dom-client-fiber-foundations.js +279 -58
  150. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/04-react-dom-client-reconciliation-hooks.js +50 -42
  151. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/05-react-dom-client-render-phases.js +282 -146
  152. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/06-react-dom-client-commit-effects.js +949 -316
  153. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/07-react-dom-client-work-loop-scheduling.js +143 -87
  154. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/08-react-dom-client-dom-events-properties-hydration.js +930 -183
  155. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/09-react-dom-client-public-roots.js +17 -15
  156. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/14-interface-primitives.js +375 -191
  157. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/15-interface-primitives.js +140 -105
  158. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources.json +23 -23
  159. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/package.json +4 -4
  160. package/lib/host-packages/openai/openplanr/runtime/plan/scripts/design-protocol-contracts.mjs +259 -36
  161. package/lib/host-packages/openai/openplanr/runtime/plan/scripts/runtime/packages/protocol/package.json +4 -4
  162. package/lib/host-packages/openai/openplanr/skills/connect/SKILL.md +59 -0
  163. package/lib/host-packages/openai/openplanr/skills/connect/agents/openai.yaml +6 -0
  164. package/lib/host-packages/openai/openplanr/skills/connect/openplanr.skill.json +37 -0
  165. package/lib/host-packages/openai/openplanr/skills/connect/references/connectors.md +62 -0
  166. package/lib/host-packages/openai/openplanr/skills/openplanr/SKILL.md +4 -0
  167. package/lib/host-packages/openai/openplanr/skills/plan/SKILL.md +4 -1
  168. package/lib/host-packages/openai/openplanr/skills/plan/scripts/planning-ids.mjs +49 -3
  169. package/lib/host-packages/openai/openplanr/skills/share/SKILL.md +86 -0
  170. package/lib/host-packages/openai/openplanr/skills/share/agents/openai.yaml +6 -0
  171. package/lib/host-packages/openai/openplanr/skills/share/openplanr.skill.json +37 -0
  172. package/lib/host-packages/openai/openplanr/skills/share/references/connectors.md +62 -0
  173. package/lib/host-packages/openai/openplanr/skills/ship/SKILL.md +6 -3
  174. package/lib/host-packages/openai/openplanr/skills/ship/scripts/discover-verification.mjs +2 -1
  175. package/lib/host-packages/openai/openplanr/skills/sprint/SKILL.md +15 -6
  176. package/lib/host-packages/openai/openplanr/skills/sprint/openplanr.skill.json +11 -0
  177. package/lib/host-packages/openai/openplanr/skills/sprint/references/connectors.md +62 -0
  178. package/lib/host-packages/openai/openplanr/skills/sprint/references/tracker-connections.md +9 -13
  179. package/lib/host-packages/openai/openplanr/skills/status/SKILL.md +14 -3
  180. package/lib/host-packages/openai/openplanr/skills/status/openplanr.skill.json +11 -0
  181. package/lib/host-packages/openai/openplanr/skills/status/references/connectors.md +62 -0
  182. package/lib/host-packages/openai/openplanr/skills/status/references/tracker-connections.md +9 -13
  183. package/lib/host-packages/openai/openplanr/skills/sync/SKILL.md +25 -10
  184. package/lib/host-packages/openai/openplanr/skills/sync/openplanr.skill.json +11 -0
  185. package/lib/host-packages/openai/openplanr/skills/sync/references/connectors.md +62 -0
  186. package/lib/host-packages/openai/openplanr/skills/sync/references/tracker-connections.md +9 -13
  187. package/lib/json-schema.mjs +313 -36
  188. package/lib/schemas/v1.0.0/spec.schema.json +120 -0
  189. package/lib/schemas/v1.0.0/story.schema.json +95 -0
  190. package/lib/schemas/v1.0.0/task.schema.json +171 -0
  191. package/lib/schemas/v1.7.0/spec.schema.json +117 -0
  192. package/lib/schemas/v1.7.0/story.schema.json +107 -0
  193. package/lib/schemas/v1.7.0/task.schema.json +217 -0
  194. package/package.json +31 -31
  195. package/dist/dashboard/assets/index-n08LJ6bK.js +0 -557
  196. package/dist/dashboard/assets/index-n08LJ6bK.js.map +0 -1
  197. package/dist/services/audit-log-service.d.ts +0 -47
  198. package/dist/services/audit-log-service.d.ts.map +0 -1
  199. package/dist/services/audit-log-service.js +0 -211
  200. package/dist/services/audit-log-service.js.map +0 -1
  201. package/dist/services/delta-apply-service.d.ts +0 -16
  202. package/dist/services/delta-apply-service.d.ts.map +0 -1
  203. package/dist/services/delta-apply-service.js +0 -74
  204. package/dist/services/delta-apply-service.js.map +0 -1
  205. package/dist/services/evidence-verifier.d.ts +0 -71
  206. package/dist/services/evidence-verifier.d.ts.map +0 -1
  207. package/dist/services/evidence-verifier.js +0 -174
  208. package/dist/services/evidence-verifier.js.map +0 -1
  209. package/dist/services/revise-apply-service.d.ts +0 -55
  210. package/dist/services/revise-apply-service.d.ts.map +0 -1
  211. package/dist/services/revise-apply-service.js +0 -265
  212. package/dist/services/revise-apply-service.js.map +0 -1
  213. package/dist/services/revise-cache-service.d.ts +0 -46
  214. package/dist/services/revise-cache-service.d.ts.map +0 -1
  215. package/dist/services/revise-cache-service.js +0 -89
  216. package/dist/services/revise-cache-service.js.map +0 -1
  217. package/dist/services/revise-plan-service.d.ts +0 -38
  218. package/dist/services/revise-plan-service.d.ts.map +0 -1
  219. package/dist/services/revise-plan-service.js +0 -153
  220. package/dist/services/revise-plan-service.js.map +0 -1
  221. /package/lib/host-packages/claude/openplanr/runtime/design/scripts/{design-runtime-support-336900df0d39.mjs → design-runtime-support-e34c388a8e59.mjs} +0 -0
  222. /package/lib/host-packages/cursor/openplanr/runtime/design/scripts/{design-runtime-support-336900df0d39.mjs → design-runtime-support-e34c388a8e59.mjs} +0 -0
  223. /package/lib/host-packages/openai/openplanr/runtime/design/scripts/{design-runtime-support-336900df0d39.mjs → design-runtime-support-e34c388a8e59.mjs} +0 -0
@@ -59,15 +59,13 @@
59
59
  let slottableElement = null;
60
60
  let hasSlottable = false;
61
61
  const newChildren = [];
62
- if (isLazyComponent(children) && typeof use === "function") {
63
- children = use(children._payload);
64
- }
62
+ children = useUnwrappedLazy(children);
65
63
  React2.Children.forEach(children, (maybeSlottable) => {
66
64
  if (isSlottable(maybeSlottable)) {
67
65
  hasSlottable = true;
68
66
  const slottable = maybeSlottable;
69
67
  let child = "child" in slottable.props ? slottable.props.child : slottable.props.children;
70
- if (isLazyComponent(child) && typeof use === "function") {
68
+ while (isLazyComponent(child) && typeof use === "function") {
71
69
  child = use(child._payload);
72
70
  }
73
71
  slottableElement = getSlottableElementFromSlottable(slottable, child);
@@ -118,9 +116,8 @@
118
116
  __name2(createSlottable, "createSlottable");
119
117
  var getSlottableElementFromSlottable = /* @__PURE__ */ __name2((slottable, child) => {
120
118
  if ("child" in slottable.props) {
121
- const child2 = slottable.props.child;
122
- if (!React2.isValidElement(child2)) return null;
123
- return React2.cloneElement(child2, void 0, slottable.props.children(child2.props.children));
119
+ if (!React2.isValidElement(child)) return null;
120
+ return React2.cloneElement(child, void 0, slottable.props.children(child.props.children));
124
121
  }
125
122
  return React2.isValidElement(child) ? child : null;
126
123
  }, "getSlottableElementFromSlottable");
@@ -144,6 +141,8 @@
144
141
  overrideProps[propName] = { ...slotPropValue, ...childPropValue };
145
142
  } else if (propName === "className") {
146
143
  overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
144
+ } else if (propName === "aria-describedby") {
145
+ overrideProps[propName] = concatAriaDescribedby(childPropValue, slotPropValue);
147
146
  }
148
147
  }
149
148
  return { ...slotProps, ...overrideProps };
@@ -176,6 +175,25 @@
176
175
  return typeof value === "object" && value !== null && "then" in value;
177
176
  }
178
177
  __name2(isPromiseLike, "isPromiseLike");
178
+ function useUnwrappedLazy(value) {
179
+ let unwrapped = value;
180
+ while (isLazyComponent(unwrapped) && typeof use === "function") {
181
+ unwrapped = use(unwrapped._payload);
182
+ }
183
+ return unwrapped;
184
+ }
185
+ __name2(useUnwrappedLazy, "useUnwrappedLazy");
186
+ function concatAriaDescribedby(...values) {
187
+ const ids = /* @__PURE__ */ new Set();
188
+ for (const value of values) {
189
+ if (typeof value !== "string") continue;
190
+ for (const id of String(value).trim().split(/\s+/)) {
191
+ if (id) ids.add(id);
192
+ }
193
+ }
194
+ return ids.size > 0 ? Array.from(ids).join(" ") : void 0;
195
+ }
196
+ __name2(concatAriaDescribedby, "concatAriaDescribedby");
179
197
  var createSlotError = /* @__PURE__ */ __name2((ownerName) => {
180
198
  return `${ownerName} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`;
181
199
  }, "createSlotError");
@@ -319,9 +337,16 @@
319
337
  __name4(composeContextScopes, "composeContextScopes");
320
338
 
321
339
  // ../../node_modules/@radix-ui/react-collection/dist/index.mjs
322
- var React5 = __toESM(require_react(), 1);
340
+ var React6 = __toESM(require_react(), 1);
323
341
  var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
324
342
  var React22 = __toESM(require_react(), 1);
343
+
344
+ // ../../node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs
345
+ var React5 = __toESM(require_react(), 1);
346
+ var useLayoutEffect2 = globalThis?.document ? React5.useLayoutEffect : () => {
347
+ };
348
+
349
+ // ../../node_modules/@radix-ui/react-collection/dist/index.mjs
325
350
  var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
326
351
  var __defProp6 = Object.defineProperty;
327
352
  var __name5 = (target, value) => __defProp6(target, "name", { value, configurable: true });
@@ -335,14 +360,14 @@
335
360
  );
336
361
  const CollectionProvider = /* @__PURE__ */ __name5((props) => {
337
362
  const { scope, children } = props;
338
- const ref = React5.useRef(null);
339
- const itemMap = React5.useRef(/* @__PURE__ */ new Map()).current;
363
+ const ref = React6.useRef(null);
364
+ const itemMap = React6.useRef(/* @__PURE__ */ new Map()).current;
340
365
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
341
366
  }, "CollectionProvider");
342
367
  CollectionProvider.displayName = PROVIDER_NAME;
343
368
  const COLLECTION_SLOT_NAME = name + "CollectionSlot";
344
369
  const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);
345
- const CollectionSlot = React5.forwardRef(
370
+ const CollectionSlot = React6.forwardRef(
346
371
  (props, forwardedRef) => {
347
372
  const { scope, children } = props;
348
373
  const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
@@ -354,13 +379,13 @@
354
379
  const ITEM_SLOT_NAME = name + "CollectionItemSlot";
355
380
  const ITEM_DATA_ATTR = "data-radix-collection-item";
356
381
  const CollectionItemSlotImpl = createSlot(ITEM_SLOT_NAME);
357
- const CollectionItemSlot = React5.forwardRef(
382
+ const CollectionItemSlot = React6.forwardRef(
358
383
  (props, forwardedRef) => {
359
384
  const { scope, children, ...itemData } = props;
360
- const ref = React5.useRef(null);
385
+ const ref = React6.useRef(null);
361
386
  const composedRefs = useComposedRefs(forwardedRef, ref);
362
387
  const context = useCollectionContext(ITEM_SLOT_NAME, scope);
363
- React5.useEffect(() => {
388
+ React6.useEffect(() => {
364
389
  context.itemMap.set(ref, { ref, ...itemData });
365
390
  return () => void context.itemMap.delete(ref);
366
391
  });
@@ -370,7 +395,7 @@
370
395
  CollectionItemSlot.displayName = ITEM_SLOT_NAME;
371
396
  function useCollection3(scope) {
372
397
  const context = useCollectionContext(name + "CollectionConsumer", scope);
373
- const getItems = React5.useCallback(() => {
398
+ const getItems = React6.useCallback(() => {
374
399
  const collectionNode = context.collectionRef.current;
375
400
  if (!collectionNode) return [];
376
401
  const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
@@ -402,54 +427,37 @@
402
427
  __instanciated.set(this, true);
403
428
  }
404
429
  set(key, value) {
405
- if (__instanciated.get(this)) {
406
- if (this.has(key)) {
407
- this.#keys[this.#keys.indexOf(key)] = key;
408
- } else {
409
- this.#keys.push(key);
410
- }
430
+ if (__instanciated.get(this) && !this.has(key)) {
431
+ this.#keys.push(key);
411
432
  }
412
433
  super.set(key, value);
413
434
  return this;
414
435
  }
436
+ /**
437
+ * Sets a key-value pair so that it ends up at the given index.
438
+ * - Existing keys are moved
439
+ * - Negative indices count from the end of the resulting dictionary, so
440
+ * inserting at -1 makes the item the last one, -2 the second to last, etc.
441
+ * - Out-of-range indices are clamped
442
+ */
415
443
  insert(index2, key, value) {
416
444
  const has = this.has(key);
417
- const length = this.#keys.length;
445
+ const finalSize = has ? this.size : this.size + 1;
418
446
  const relativeIndex = toSafeInteger(index2);
419
- let actualIndex = relativeIndex >= 0 ? relativeIndex : length + relativeIndex;
420
- const safeIndex = actualIndex < 0 || actualIndex >= length ? -1 : actualIndex;
421
- if (safeIndex === this.size || has && safeIndex === this.size - 1 || safeIndex === -1) {
447
+ const targetIndex = relativeIndex >= 0 ? Math.min(relativeIndex, finalSize - 1) : Math.max(finalSize + relativeIndex, 0);
448
+ if (has ? this.#keys.indexOf(key) === targetIndex : targetIndex === this.size) {
422
449
  this.set(key, value);
423
450
  return this;
424
451
  }
425
- const size4 = this.size + (has ? 0 : 1);
426
- if (relativeIndex < 0) {
427
- actualIndex++;
428
- }
429
- const keys = [...this.#keys];
430
- let nextValue;
431
- let shouldSkip = false;
432
- for (let i = actualIndex; i < size4; i++) {
433
- if (actualIndex === i) {
434
- let nextKey = keys[i];
435
- if (keys[i] === key) {
436
- nextKey = keys[i + 1];
437
- }
438
- if (has) {
439
- this.delete(key);
440
- }
441
- nextValue = this.get(nextKey);
442
- this.set(key, value);
443
- } else {
444
- if (!shouldSkip && keys[i - 1] === key) {
445
- shouldSkip = true;
446
- }
447
- const currentKey = keys[shouldSkip ? i : i - 1];
448
- const currentValue = nextValue;
449
- nextValue = this.get(currentKey);
450
- this.delete(currentKey);
451
- this.set(currentKey, currentValue);
452
- }
452
+ const keys = this.#keys.filter((existingKey) => existingKey !== key);
453
+ keys.splice(targetIndex, 0, key);
454
+ const entries = keys.map((entryKey) => [
455
+ entryKey,
456
+ entryKey === key ? value : this.get(entryKey)
457
+ ]);
458
+ this.clear();
459
+ for (const [entryKey, entryValue] of entries) {
460
+ this.set(entryKey, entryValue);
453
461
  }
454
462
  return this;
455
463
  }
@@ -473,7 +481,9 @@
473
481
  if (index2 === -1) {
474
482
  return this;
475
483
  }
476
- return this.insert(index2, newKey, value);
484
+ const currentIndex = this.#keys.indexOf(newKey);
485
+ const targetIndex = currentIndex !== -1 && currentIndex < index2 ? index2 - 1 : index2;
486
+ return this.insert(targetIndex, newKey, value);
477
487
  }
478
488
  after(key) {
479
489
  let index2 = this.#keys.indexOf(key);
@@ -491,7 +501,9 @@
491
501
  if (index2 === -1) {
492
502
  return this;
493
503
  }
494
- return this.insert(index2 + 1, newKey, value);
504
+ const currentIndex = this.#keys.indexOf(newKey);
505
+ const targetIndex = currentIndex !== -1 && currentIndex <= index2 ? index2 : index2 + 1;
506
+ return this.insert(targetIndex, newKey, value);
495
507
  }
496
508
  first() {
497
509
  return this.entryAt(0);
@@ -597,10 +609,14 @@
597
609
  }
598
610
  reduce(...args) {
599
611
  const [callbackfn, initialValue] = args;
612
+ const hasInitialValue = args.length > 1;
613
+ if (!hasInitialValue && this.size === 0) {
614
+ throw new TypeError("Reduce of empty OrderedDict with no initial value");
615
+ }
600
616
  let index2 = 0;
601
- let accumulator = initialValue ?? this.at(0);
617
+ let accumulator = initialValue;
602
618
  for (const entry of this) {
603
- if (index2 === 0 && args.length === 1) {
619
+ if (index2 === 0 && !hasInitialValue) {
604
620
  accumulator = entry;
605
621
  } else {
606
622
  accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index2, this]);
@@ -611,10 +627,14 @@
611
627
  }
612
628
  reduceRight(...args) {
613
629
  const [callbackfn, initialValue] = args;
614
- let accumulator = initialValue ?? this.at(-1);
630
+ const hasInitialValue = args.length > 1;
631
+ if (!hasInitialValue && this.size === 0) {
632
+ throw new TypeError("Reduce of empty OrderedDict with no initial value");
633
+ }
634
+ let accumulator = initialValue;
615
635
  for (let index2 = this.size - 1; index2 >= 0; index2--) {
616
- const entry = this.at(index2);
617
- if (index2 === this.size - 1 && args.length === 1) {
636
+ const entry = this.entryAt(index2);
637
+ if (index2 === this.size - 1 && !hasInitialValue) {
618
638
  accumulator = entry;
619
639
  } else {
620
640
  accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index2, this]);
@@ -622,7 +642,36 @@
622
642
  }
623
643
  return accumulator;
624
644
  }
645
+ /**
646
+ * Sorts the dictionary in place. This method mutates the dictionary and
647
+ * returns a reference to the same object
648
+ *
649
+ * @param compareFn Function used to determine the order of the elements. It
650
+ * is expected to return a negative value if the first argument is less than
651
+ * the second argument, zero if they're equal, and a positive value otherwise.
652
+ */
653
+ sort(compareFn) {
654
+ if (typeof compareFn !== "function") {
655
+ throw new TypeError(`OrderedDict.sort requires a compare function`);
656
+ }
657
+ const entries = [...this.entries()].sort(compareFn);
658
+ this.clear();
659
+ for (const [key, value] of entries) {
660
+ this.set(key, value);
661
+ }
662
+ return this;
663
+ }
664
+ /**
665
+ * Returns a copy of the dictionary with its elements sorted.
666
+ *
667
+ * @param compareFn Function used to determine the order of the elements. It
668
+ * is expected to return a negative value if the first argument is less than
669
+ * the second argument, zero if they're equal, and a positive value otherwise.
670
+ */
625
671
  toSorted(compareFn) {
672
+ if (typeof compareFn !== "function") {
673
+ throw new TypeError(`OrderedDict.toSorted requires a compare function`);
674
+ }
626
675
  const entries = [...this.entries()].sort(compareFn);
627
676
  return new _OrderedDict(entries);
628
677
  }
@@ -642,20 +691,8 @@
642
691
  }
643
692
  slice(start2, end) {
644
693
  const result = new _OrderedDict();
645
- let stop = this.size - 1;
646
- if (start2 === void 0) {
647
- return result;
648
- }
649
- if (start2 < 0) {
650
- start2 = start2 + this.size;
651
- }
652
- if (end !== void 0 && end > 0) {
653
- stop = end - 1;
654
- }
655
- for (let index2 = start2; index2 <= stop; index2++) {
656
- const key = this.keyAt(index2);
657
- const element = this.get(key);
658
- result.set(key, element);
694
+ for (const key of this.#keys.slice(start2, end)) {
695
+ result.set(key, this.get(key));
659
696
  }
660
697
  return result;
661
698
  }
@@ -703,16 +740,10 @@
703
740
  function createCollection2(name) {
704
741
  const PROVIDER_NAME = name + "CollectionProvider";
705
742
  const [createCollectionContext, createCollectionScope3] = createContextScope(PROVIDER_NAME);
706
- const [CollectionContextProvider, useCollectionContext] = createCollectionContext(
707
- PROVIDER_NAME,
708
- {
709
- collectionElement: null,
710
- collectionRef: { current: null },
711
- collectionRefObject: { current: null },
712
- itemMap: new OrderedDict(),
713
- setItemMap: /* @__PURE__ */ __name5(() => void 0, "setItemMap")
714
- }
715
- );
743
+ const [CollectionStableContextProvider, useStableCollectionContext] = createCollectionContext(PROVIDER_NAME);
744
+ CollectionStableContextProvider.displayName = name + "CollectionStableContextProvider";
745
+ const [CollectionStatefulContextProvider, useStatefulCollectionContext] = createCollectionContext(PROVIDER_NAME);
746
+ CollectionStatefulContextProvider.displayName = name + "CollectionStatefulContextProvider";
716
747
  const CollectionProvider = /* @__PURE__ */ __name5(({ state, ...props }) => {
717
748
  return state ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CollectionProviderImpl, { ...props, state }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CollectionInit, { ...props });
718
749
  }, "CollectionProvider");
@@ -721,7 +752,7 @@
721
752
  const state = useInitCollection();
722
753
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CollectionProviderImpl, { ...props, state });
723
754
  }, "CollectionInit");
724
- CollectionInit.displayName = PROVIDER_NAME + "Init";
755
+ CollectionInit.displayName = name + "CollectionInit";
725
756
  const CollectionProviderImpl = /* @__PURE__ */ __name5((props) => {
726
757
  const { scope, children, state } = props;
727
758
  const ref = React22.useRef(null);
@@ -729,10 +760,27 @@
729
760
  null
730
761
  );
731
762
  const composeRefs2 = useComposedRefs(ref, setCollectionElement);
732
- const [itemMap, setItemMap] = state;
763
+ const [collection, setCollection] = state;
764
+ const registryRef = React22.useRef(
765
+ new OrderedDict()
766
+ );
767
+ const getCollection = React22.useCallback(() => {
768
+ const registry = registryRef.current;
769
+ if (!isInDocumentOrder(registry)) {
770
+ registry.sort(sortByDocumentPosition);
771
+ }
772
+ return registry;
773
+ }, []);
733
774
  React22.useEffect(() => {
734
- if (!collectionElement) return;
775
+ if (!collectionElement) {
776
+ return;
777
+ }
735
778
  const observer = getChildListObserver(() => {
779
+ setCollection((map) => {
780
+ const sorted = map.toSorted(sortByDocumentPosition);
781
+ const orderChanged = sorted.some(([key], index2) => map.keyAt(index2) !== key);
782
+ return orderChanged ? sorted : map;
783
+ });
736
784
  });
737
785
  observer.observe(collectionElement, {
738
786
  childList: true,
@@ -741,28 +789,36 @@
741
789
  return () => {
742
790
  observer.disconnect();
743
791
  };
744
- }, [collectionElement]);
792
+ }, [collectionElement, setCollection]);
745
793
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
746
- CollectionContextProvider,
794
+ CollectionStableContextProvider,
747
795
  {
748
796
  scope,
749
- itemMap,
750
- setItemMap,
751
- collectionRef: composeRefs2,
752
- collectionRefObject: ref,
753
- collectionElement,
754
- children
797
+ collectionElementRef: composeRefs2,
798
+ collectionElementRefObject: ref,
799
+ getCollection,
800
+ setCollection,
801
+ registryRef,
802
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
803
+ CollectionStatefulContextProvider,
804
+ {
805
+ scope,
806
+ collectionElement,
807
+ collection,
808
+ children
809
+ }
810
+ )
755
811
  }
756
812
  );
757
813
  }, "CollectionProviderImpl");
758
- CollectionProviderImpl.displayName = PROVIDER_NAME + "Impl";
814
+ CollectionProviderImpl.displayName = name + "CollectionProviderImpl";
759
815
  const COLLECTION_SLOT_NAME = name + "CollectionSlot";
760
816
  const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);
761
817
  const CollectionSlot = React22.forwardRef(
762
818
  (props, forwardedRef) => {
763
819
  const { scope, children } = props;
764
- const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
765
- const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);
820
+ const context = useStableCollectionContext(COLLECTION_SLOT_NAME, scope);
821
+ const composedRefs = useComposedRefs(forwardedRef, context.collectionElementRef);
766
822
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CollectionSlotImpl, { ref: composedRefs, children });
767
823
  }
768
824
  );
@@ -774,37 +830,71 @@
774
830
  (props, forwardedRef) => {
775
831
  const { scope, children, ...itemData } = props;
776
832
  const ref = React22.useRef(null);
777
- const [element, setElement] = React22.useState(null);
778
- const composedRefs = useComposedRefs(forwardedRef, ref, setElement);
779
- const context = useCollectionContext(ITEM_SLOT_NAME, scope);
780
- const { setItemMap } = context;
833
+ const context = useStableCollectionContext(ITEM_SLOT_NAME, scope);
834
+ const { setCollection, registryRef } = context;
781
835
  const itemDataRef = React22.useRef(itemData);
782
836
  if (!shallowEqual(itemDataRef.current, itemData)) {
783
837
  itemDataRef.current = itemData;
784
838
  }
785
839
  const memoizedItemData = itemDataRef.current;
840
+ const registerElement = React22.useCallback(
841
+ (node) => {
842
+ const registry = registryRef.current;
843
+ if (node) {
844
+ registry.set(node, {
845
+ ...itemDataRef.current,
846
+ element: node
847
+ });
848
+ } else if (ref.current) {
849
+ registry.delete(ref.current);
850
+ }
851
+ },
852
+ [registryRef]
853
+ );
854
+ const composedRefs = useComposedRefs(forwardedRef, registerElement, ref);
855
+ useLayoutEffect2(() => {
856
+ const node = ref.current;
857
+ const registry = registryRef.current;
858
+ if (node && registry.has(node)) {
859
+ registry.set(node, { ...memoizedItemData, element: node });
860
+ }
861
+ }, [memoizedItemData, registryRef]);
862
+ const registeredRef = React22.useRef(null);
786
863
  React22.useEffect(() => {
787
- const itemData2 = memoizedItemData;
788
- setItemMap((map) => {
789
- if (!element) {
790
- return map;
864
+ const element = ref.current;
865
+ const registered = registeredRef.current;
866
+ if ((registered?.element ?? null) === element && (!element || registered?.itemData === memoizedItemData)) {
867
+ return;
868
+ }
869
+ registeredRef.current = element ? { element, itemData: memoizedItemData } : null;
870
+ setCollection((map) => {
871
+ const next = new OrderedDict(map);
872
+ if (registered && registered.element !== element) {
873
+ next.delete(registered.element);
791
874
  }
792
- if (!map.has(element)) {
793
- map.set(element, { ...itemData2, element });
794
- return map.toSorted(sortByDocumentPosition);
875
+ if (element) {
876
+ next.set(element, { ...memoizedItemData, element });
795
877
  }
796
- return map.set(element, { ...itemData2, element }).toSorted(sortByDocumentPosition);
878
+ return next.sort(sortByDocumentPosition);
797
879
  });
880
+ });
881
+ React22.useEffect(() => {
798
882
  return () => {
799
- setItemMap((map) => {
800
- if (!element || !map.has(element)) {
883
+ const registered = registeredRef.current;
884
+ registeredRef.current = null;
885
+ if (!registered) {
886
+ return;
887
+ }
888
+ setCollection((map) => {
889
+ if (!map.has(registered.element)) {
801
890
  return map;
802
891
  }
803
- map.delete(element);
804
- return new OrderedDict(map);
892
+ const next = new OrderedDict(map);
893
+ next.delete(registered.element);
894
+ return next;
805
895
  });
806
896
  };
807
- }, [element, memoizedItemData, setItemMap]);
897
+ }, [setCollection]);
808
898
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children });
809
899
  }
810
900
  );
@@ -814,13 +904,19 @@
814
904
  }
815
905
  __name5(useInitCollection, "useInitCollection");
816
906
  function useCollection3(scope) {
817
- const { itemMap } = useCollectionContext(name + "CollectionConsumer", scope);
818
- return itemMap;
907
+ const { collection } = useStatefulCollectionContext(name + "CollectionConsumer", scope);
908
+ return collection;
819
909
  }
820
910
  __name5(useCollection3, "useCollection");
911
+ function useGetCollection(scope) {
912
+ const { getCollection } = useStableCollectionContext(name + "CollectionConsumer", scope);
913
+ return getCollection;
914
+ }
915
+ __name5(useGetCollection, "useGetCollection");
821
916
  const functions = {
822
917
  createCollectionScope: createCollectionScope3,
823
918
  useCollection: useCollection3,
919
+ useGetCollection,
824
920
  useInitCollection
825
921
  };
826
922
  return [
@@ -847,6 +943,20 @@
847
943
  return !!(b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING);
848
944
  }
849
945
  __name5(isElementPreceding, "isElementPreceding");
946
+ function isInDocumentOrder(dict) {
947
+ let previous;
948
+ for (const element of dict.keys()) {
949
+ if (previous) {
950
+ const position = previous.compareDocumentPosition(element);
951
+ if (!(position & Node.DOCUMENT_POSITION_DISCONNECTED) && position & Node.DOCUMENT_POSITION_PRECEDING) {
952
+ return false;
953
+ }
954
+ }
955
+ previous = element;
956
+ }
957
+ return true;
958
+ }
959
+ __name5(isInDocumentOrder, "isInDocumentOrder");
850
960
  function sortByDocumentPosition(a, b) {
851
961
  return !a[1].element || !b[1].element ? 0 : isElementPreceding(a[1].element, b[1].element) ? -1 : 1;
852
962
  }
@@ -922,11 +1032,6 @@
922
1032
  // ../../node_modules/@radix-ui/primitive/dist/internal/is-development.false.mjs
923
1033
  var IS_DEVELOPMENT = false;
924
1034
 
925
- // ../../node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs
926
- var React6 = __toESM(require_react(), 1);
927
- var useLayoutEffect2 = globalThis?.document ? React6.useLayoutEffect : () => {
928
- };
929
-
930
1035
  // ../../node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs
931
1036
  var React23 = __toESM(require_react(), 1);
932
1037
 
@@ -1287,10 +1392,14 @@
1287
1392
  var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
1288
1393
  var __defProp12 = Object.defineProperty;
1289
1394
  var __name11 = (target, value) => __defProp12(target, "name", { value, configurable: true });
1395
+ var Direction = {
1396
+ LTR: "ltr",
1397
+ RTL: "rtl"
1398
+ };
1290
1399
  var DirectionContext = React11.createContext(void 0);
1291
1400
  function useDirection(localDir) {
1292
1401
  const globalDir = React11.useContext(DirectionContext);
1293
- return localDir || globalDir || "ltr";
1402
+ return localDir || globalDir || Direction.LTR;
1294
1403
  }
1295
1404
  __name11(useDirection, "useDirection");
1296
1405
 
@@ -1325,11 +1434,18 @@
1325
1434
  var React12 = __toESM(require_react(), 1);
1326
1435
  var __defProp13 = Object.defineProperty;
1327
1436
  var __name12 = (target, value) => __defProp13(target, "name", { value, configurable: true });
1437
+ var useReactInsertionEffect2 = React12[" useInsertionEffect ".trim().toString()];
1328
1438
  function useCallbackRef(callback) {
1329
1439
  const callbackRef = React12.useRef(callback);
1330
- React12.useEffect(() => {
1331
- callbackRef.current = callback;
1332
- });
1440
+ if (typeof useReactInsertionEffect2 === "function") {
1441
+ useReactInsertionEffect2(() => {
1442
+ callbackRef.current = callback;
1443
+ });
1444
+ } else {
1445
+ useLayoutEffect2(() => {
1446
+ callbackRef.current = callback;
1447
+ });
1448
+ }
1333
1449
  return React12.useMemo(() => ((...args) => callbackRef.current?.(...args)), []);
1334
1450
  }
1335
1451
  __name12(useCallbackRef, "useCallbackRef");
@@ -1680,6 +1796,7 @@
1680
1796
  const {
1681
1797
  loop = false,
1682
1798
  trapped = false,
1799
+ branches,
1683
1800
  onMountAutoFocus: onMountAutoFocusProp,
1684
1801
  onUnmountAutoFocus: onUnmountAutoFocusProp,
1685
1802
  ...scopeProps
@@ -1689,6 +1806,18 @@
1689
1806
  const onUnmountAutoFocus = useCallbackRef(onUnmountAutoFocusProp);
1690
1807
  const lastFocusedElementRef = React14.useRef(null);
1691
1808
  const composedRefs = useComposedRefs(forwardedRef, setContainer);
1809
+ const branchesRef = React14.useRef(branches);
1810
+ React14.useEffect(() => {
1811
+ branchesRef.current = branches;
1812
+ });
1813
+ const isTargetInScope = React14.useCallback(
1814
+ (target) => {
1815
+ if (!target) return false;
1816
+ if (container?.contains(target)) return true;
1817
+ return Boolean(branchesRef.current?.some((branch) => branch.contains(target)));
1818
+ },
1819
+ [container]
1820
+ );
1692
1821
  const focusScope = React14.useRef({
1693
1822
  paused: false,
1694
1823
  pause() {
@@ -1703,7 +1832,7 @@
1703
1832
  let handleFocusIn2 = function(event) {
1704
1833
  if (focusScope.paused || !container) return;
1705
1834
  const target = event.target;
1706
- if (container.contains(target)) {
1835
+ if (isTargetInScope(target)) {
1707
1836
  lastFocusedElementRef.current = target;
1708
1837
  } else {
1709
1838
  focus(lastFocusedElementRef.current, { select: true });
@@ -1712,7 +1841,7 @@
1712
1841
  if (focusScope.paused || !container) return;
1713
1842
  const relatedTarget = event.relatedTarget;
1714
1843
  if (relatedTarget === null) return;
1715
- if (!container.contains(relatedTarget)) {
1844
+ if (!isTargetInScope(relatedTarget)) {
1716
1845
  focus(lastFocusedElementRef.current, { select: true });
1717
1846
  }
1718
1847
  }, handleMutations2 = function(mutations) {
@@ -1736,7 +1865,7 @@
1736
1865
  mutationObserver.disconnect();
1737
1866
  };
1738
1867
  }
1739
- }, [trapped, container, focusScope.paused]);
1868
+ }, [trapped, container, focusScope.paused, isTargetInScope]);
1740
1869
  React14.useEffect(() => {
1741
1870
  if (container) {
1742
1871
  focusScopesStack.add(focusScope);
@@ -1755,12 +1884,14 @@
1755
1884
  }
1756
1885
  return () => {
1757
1886
  container.removeEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
1887
+ const ownerDocument = container.ownerDocument;
1888
+ const UnmountEvent = CustomEvent;
1758
1889
  setTimeout(() => {
1759
- const unmountEvent = new CustomEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS);
1890
+ const unmountEvent = new UnmountEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS);
1760
1891
  container.addEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
1761
1892
  container.dispatchEvent(unmountEvent);
1762
1893
  if (!unmountEvent.defaultPrevented) {
1763
- focus(previouslyFocusedElement ?? document.body, { select: true });
1894
+ focus(previouslyFocusedElement ?? ownerDocument.body, { select: true });
1764
1895
  }
1765
1896
  container.removeEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
1766
1897
  focusScopesStack.remove(focusScope);
@@ -1796,6 +1927,35 @@
1796
1927
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Primitive.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown });
1797
1928
  }, "FocusScope")
1798
1929
  );
1930
+ var FocusScopeBranchContext = React14.createContext(null);
1931
+ function FocusScopeBranchProvider({ registry, children }) {
1932
+ if (!registry) {
1933
+ return children;
1934
+ }
1935
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(FocusScopeBranchContext.Provider, { value: registry, children });
1936
+ }
1937
+ __name14(FocusScopeBranchProvider, "FocusScopeBranchProvider");
1938
+ function useFocusScopeBranchRegistry() {
1939
+ const [nodes, setNodes] = React14.useState([]);
1940
+ const registry = React14.useMemo(
1941
+ () => ({
1942
+ add: /* @__PURE__ */ __name14((node) => setNodes((prev) => prev.includes(node) ? prev : [...prev, node]), "add"),
1943
+ remove: /* @__PURE__ */ __name14((node) => setNodes((prev) => prev.filter((current) => current !== node)), "remove")
1944
+ }),
1945
+ []
1946
+ );
1947
+ return { nodes, registry };
1948
+ }
1949
+ __name14(useFocusScopeBranchRegistry, "useFocusScopeBranchRegistry");
1950
+ function useFocusScopeBranch(node) {
1951
+ const registry = React14.useContext(FocusScopeBranchContext);
1952
+ React14.useEffect(() => {
1953
+ if (!node || !registry) return;
1954
+ registry.add(node);
1955
+ return () => registry.remove(node);
1956
+ }, [node, registry]);
1957
+ }
1958
+ __name14(useFocusScopeBranch, "useFocusScopeBranch");
1799
1959
  function focusFirst(candidates, { select = false } = {}) {
1800
1960
  const previouslyFocusedElement = document.activeElement;
1801
1961
  for (const candidate of candidates) {
@@ -1813,14 +1973,19 @@
1813
1973
  __name14(getTabbableEdges, "getTabbableEdges");
1814
1974
  function getTabbableCandidates(container) {
1815
1975
  const nodes = [];
1816
- const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
1976
+ const document2 = container.ownerDocument;
1977
+ const walker = document2.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
1817
1978
  acceptNode: /* @__PURE__ */ __name14((node) => {
1818
1979
  const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
1819
- if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;
1980
+ if (node.disabled || node.hidden || isHiddenInput) {
1981
+ return NodeFilter.FILTER_SKIP;
1982
+ }
1820
1983
  return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
1821
1984
  }, "acceptNode")
1822
1985
  });
1823
- while (walker.nextNode()) nodes.push(walker.currentNode);
1986
+ while (walker.nextNode()) {
1987
+ nodes.push(walker.currentNode);
1988
+ }
1824
1989
  return nodes;
1825
1990
  }
1826
1991
  __name14(getTabbableCandidates, "getTabbableCandidates");
@@ -1845,12 +2010,13 @@
1845
2010
  }
1846
2011
  __name14(isHidden, "isHidden");
1847
2012
  function isSelectableInput(element) {
1848
- return element instanceof HTMLInputElement && "select" in element;
2013
+ return element.tagName === "INPUT" && typeof element.select === "function";
1849
2014
  }
1850
2015
  __name14(isSelectableInput, "isSelectableInput");
1851
2016
  function focus(element, { select = false } = {}) {
1852
2017
  if (element && element.focus) {
1853
- const previouslyFocusedElement = document.activeElement;
2018
+ const ownerDocument = element.ownerDocument ?? document;
2019
+ const previouslyFocusedElement = ownerDocument.activeElement;
1854
2020
  element.focus({ preventScroll: true });
1855
2021
  if (element !== previouslyFocusedElement && isSelectableInput(element) && select)
1856
2022
  element.select();
@@ -2812,6 +2978,7 @@
2812
2978
  } = props;
2813
2979
  const triggerRef = React27.useRef(null);
2814
2980
  const contentRef = React27.useRef(null);
2981
+ const { nodes: branchNodes, registry: branchRegistry } = useFocusScopeBranchRegistry();
2815
2982
  const [open, setOpen] = useControllableState({
2816
2983
  prop: openProp,
2817
2984
  defaultProp: defaultOpen ?? false,
@@ -2837,6 +3004,8 @@
2837
3004
  onOpenChange: setOpen,
2838
3005
  onOpenToggle: React27.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
2839
3006
  modal,
3007
+ branchNodes,
3008
+ branchRegistry,
2840
3009
  children
2841
3010
  }
2842
3011
  );
@@ -2889,17 +3058,30 @@
2889
3058
  const registerDismissableSurface = useDismissableLayerSurface();
2890
3059
  const composedRefs = useComposedRefs(forwardedRef, registerDismissableSurface);
2891
3060
  return (
2892
- // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
2893
- // ie. when `Overlay` and `Content` are siblings
2894
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Combination_default, { as: Slot, allowPinchZoom: true, shards: [context.contentRef], children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2895
- Primitive.div,
3061
+ // Make sure `Content` is scrollable even when it doesn't live inside
3062
+ // `RemoveScroll` (eg. when `Overlay` and `Content` are siblings). Nested
3063
+ // layers are registered as branches and added as shards so they remain
3064
+ // scrollable too. See https://github.com/radix-ui/primitives/issues/3423
3065
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3066
+ Combination_default,
2896
3067
  {
2897
- "data-state": getState(context.open),
2898
- ...overlayProps,
2899
- ref: composedRefs,
2900
- style: { pointerEvents: "auto", ...overlayProps.style }
3068
+ as: Slot,
3069
+ allowPinchZoom: true,
3070
+ shards: React27.useMemo(
3071
+ () => [context.contentRef, ...context.branchNodes.map((node) => ({ current: node }))],
3072
+ [context.contentRef, context.branchNodes]
3073
+ ),
3074
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3075
+ Primitive.div,
3076
+ {
3077
+ "data-state": getState(context.open),
3078
+ ...overlayProps,
3079
+ ref: composedRefs,
3080
+ style: { pointerEvents: "auto", ...overlayProps.style }
3081
+ }
3082
+ )
2901
3083
  }
2902
- ) })
3084
+ )
2903
3085
  );
2904
3086
  }, "DialogOverlayImpl")
2905
3087
  );
@@ -2991,15 +3173,24 @@
2991
3173
  var DialogContentImpl = /* @__PURE__ */ React27.forwardRef(
2992
3174
  // blank line to reduce diff noise
2993
3175
  /* @__PURE__ */ __name17(function DialogContentImpl2(props, forwardedRef) {
2994
- const { __scopeDialog, trapFocus, onOpenAutoFocus, onCloseAutoFocus, ...contentProps } = props;
3176
+ const {
3177
+ __scopeDialog,
3178
+ trapFocus,
3179
+ onOpenAutoFocus,
3180
+ onCloseAutoFocus,
3181
+ "aria-describedby": ariaDescribedby,
3182
+ children,
3183
+ ...contentProps
3184
+ } = props;
2995
3185
  const context = useDialogContext(CONTENT_NAME, __scopeDialog);
2996
3186
  useFocusGuards();
2997
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3187
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(FocusScopeBranchProvider, { registry: context.branchRegistry, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2998
3188
  FocusScope,
2999
3189
  {
3000
3190
  asChild: true,
3001
3191
  loop: true,
3002
3192
  trapped: trapFocus,
3193
+ branches: context.branchNodes,
3003
3194
  onMountAutoFocus: onOpenAutoFocus,
3004
3195
  onUnmountAutoFocus: onCloseAutoFocus,
3005
3196
  children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
@@ -3007,24 +3198,24 @@
3007
3198
  {
3008
3199
  role: "dialog",
3009
3200
  id: context.contentId,
3010
- "aria-describedby": context.descriptionPresent ? context.descriptionId : void 0,
3011
3201
  "aria-labelledby": context.titlePresent ? context.titleId : void 0,
3202
+ "aria-describedby": context.descriptionPresent ? concatAriaDescribedby2(ariaDescribedby, context.descriptionId) : ariaDescribedby,
3012
3203
  "data-state": getState(context.open),
3013
3204
  ...contentProps,
3014
3205
  ref: forwardedRef,
3015
3206
  deferPointerDownOutside: true,
3016
- onDismiss: () => context.onOpenChange(false)
3207
+ onDismiss: () => context.onOpenChange(false),
3208
+ children
3017
3209
  }
3018
3210
  )
3019
3211
  }
3020
3212
  ) });
3021
3213
  }, "DialogContentImpl")
3022
3214
  );
3023
- var TITLE_NAME = "DialogTitle";
3024
3215
  var DialogTitle = /* @__PURE__ */ React27.forwardRef(
3025
3216
  /* @__PURE__ */ __name17(function DialogTitle2(props, forwardedRef) {
3026
3217
  const { __scopeDialog, ...titleProps } = props;
3027
- const context = useDialogContext(TITLE_NAME, __scopeDialog);
3218
+ const context = useDialogContext("DialogTitle", __scopeDialog);
3028
3219
  const { setTitleCount } = context;
3029
3220
  useLayoutEffect2(() => {
3030
3221
  setTitleCount((count3) => count3 + 1);
@@ -3033,12 +3224,11 @@
3033
3224
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Primitive.h2, { id: context.titleId, ...titleProps, ref: forwardedRef });
3034
3225
  }, "DialogTitle")
3035
3226
  );
3036
- var DESCRIPTION_NAME = "DialogDescription";
3037
3227
  var DialogDescription = /* @__PURE__ */ React27.forwardRef(
3038
3228
  // blank line to reduce diff noise
3039
3229
  /* @__PURE__ */ __name17(function DialogDescription2(props, forwardedRef) {
3040
3230
  const { __scopeDialog, ...descriptionProps } = props;
3041
- const context = useDialogContext(DESCRIPTION_NAME, __scopeDialog);
3231
+ const context = useDialogContext("DialogDescription", __scopeDialog);
3042
3232
  const { setDescriptionCount } = context;
3043
3233
  useLayoutEffect2(() => {
3044
3234
  setDescriptionCount((count3) => count3 + 1);
@@ -3066,6 +3256,17 @@
3066
3256
  var WarningProvider = /* @__PURE__ */ __name17((props) => {
3067
3257
  return props.children;
3068
3258
  }, "WarningProvider");
3259
+ function concatAriaDescribedby2(...values) {
3260
+ const ids = /* @__PURE__ */ new Set();
3261
+ for (const value of values) {
3262
+ if (typeof value !== "string") continue;
3263
+ for (const id of String(value).trim().split(/\s+/)) {
3264
+ if (id) ids.add(id);
3265
+ }
3266
+ }
3267
+ return ids.size > 0 ? Array.from(ids).join(" ") : void 0;
3268
+ }
3269
+ __name17(concatAriaDescribedby2, "concatAriaDescribedby");
3069
3270
  function getState(open) {
3070
3271
  return open ? "open" : "closed";
3071
3272
  }
@@ -3080,6 +3281,7 @@
3080
3281
  useLayoutEffect2(() => {
3081
3282
  if (element) {
3082
3283
  setSize({ width: element.offsetWidth, height: element.offsetHeight });
3284
+ let rAF = 0;
3083
3285
  const resizeObserver = new ResizeObserver((entries) => {
3084
3286
  if (!Array.isArray(entries)) {
3085
3287
  return;
@@ -3088,21 +3290,27 @@
3088
3290
  return;
3089
3291
  }
3090
3292
  const entry = entries[0];
3091
- let width;
3092
- let height;
3093
- if ("borderBoxSize" in entry) {
3094
- const borderSizeEntry = entry["borderBoxSize"];
3095
- const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;
3096
- width = borderSize["inlineSize"];
3097
- height = borderSize["blockSize"];
3098
- } else {
3099
- width = element.offsetWidth;
3100
- height = element.offsetHeight;
3101
- }
3102
- setSize({ width, height });
3293
+ window.cancelAnimationFrame(rAF);
3294
+ rAF = window.requestAnimationFrame(() => {
3295
+ let width;
3296
+ let height;
3297
+ if ("borderBoxSize" in entry) {
3298
+ const borderSizeEntry = entry["borderBoxSize"];
3299
+ const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;
3300
+ width = borderSize["inlineSize"];
3301
+ height = borderSize["blockSize"];
3302
+ } else {
3303
+ width = element.offsetWidth;
3304
+ height = element.offsetHeight;
3305
+ }
3306
+ setSize({ width, height });
3307
+ });
3103
3308
  });
3104
3309
  resizeObserver.observe(element, { box: "border-box" });
3105
- return () => resizeObserver.unobserve(element);
3310
+ return () => {
3311
+ window.cancelAnimationFrame(rAF);
3312
+ resizeObserver.unobserve(element);
3313
+ };
3106
3314
  } else {
3107
3315
  setSize(void 0);
3108
3316
  }
@@ -5018,28 +5226,4 @@
5018
5226
  fn: result.fn,
5019
5227
  options: [options2, deps]
5020
5228
  };
5021
- };
5022
-
5023
- // ../../node_modules/@radix-ui/react-arrow/dist/index.mjs
5024
- var React30 = __toESM(require_react(), 1);
5025
- var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1);
5026
- var __defProp20 = Object.defineProperty;
5027
- var __name19 = (target, value) => __defProp20(target, "name", { value, configurable: true });
5028
- var Arrow = /* @__PURE__ */ React30.forwardRef(
5029
- /* @__PURE__ */ __name19(function Arrow2(props, forwardedRef) {
5030
- const { children, width = 10, height = 5, ...arrowProps } = props;
5031
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
5032
- Primitive.svg,
5033
- {
5034
- ...arrowProps,
5035
- ref: forwardedRef,
5036
- width,
5037
- height,
5038
- viewBox: "0 0 30 10",
5039
- preserveAspectRatio: "none",
5040
- children: props.asChild ? children : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("polygon", { points: "0,0 30,0 15,10" })
5041
- }
5042
- );
5043
- }, "Arrow")
5044
- );
5045
- var Root = Arrow;
5229
+ };