@aglyn/plugins-ai 1.0.0-beta.143

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 (717) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +25 -0
  3. package/package.json +60 -0
  4. package/src/index.d.ts +21 -0
  5. package/src/index.js +22 -0
  6. package/src/index.js.map +1 -0
  7. package/src/lib/activity/ai-activity-actions.d.ts +106 -0
  8. package/src/lib/activity/ai-activity-actions.js +209 -0
  9. package/src/lib/activity/ai-activity-actions.js.map +1 -0
  10. package/src/lib/activity/ai-activity.d.ts +219 -0
  11. package/src/lib/activity/ai-activity.js +251 -0
  12. package/src/lib/activity/ai-activity.js.map +1 -0
  13. package/src/lib/billing/ai-overage-charge.d.ts +102 -0
  14. package/src/lib/billing/ai-overage-charge.js +258 -0
  15. package/src/lib/billing/ai-overage-charge.js.map +1 -0
  16. package/src/lib/billing/ai-overage-close.d.ts +62 -0
  17. package/src/lib/billing/ai-overage-close.js +129 -0
  18. package/src/lib/billing/ai-overage-close.js.map +1 -0
  19. package/src/lib/billing/ai-overage-cutover.d.ts +63 -0
  20. package/src/lib/billing/ai-overage-cutover.js +114 -0
  21. package/src/lib/billing/ai-overage-cutover.js.map +1 -0
  22. package/src/lib/billing/ai-overage-events.d.ts +77 -0
  23. package/src/lib/billing/ai-overage-events.js +174 -0
  24. package/src/lib/billing/ai-overage-events.js.map +1 -0
  25. package/src/lib/billing/ai-overage-gate.d.ts +147 -0
  26. package/src/lib/billing/ai-overage-gate.js +177 -0
  27. package/src/lib/billing/ai-overage-gate.js.map +1 -0
  28. package/src/lib/billing/ai-overage-ledger.d.ts +135 -0
  29. package/src/lib/billing/ai-overage-ledger.js +278 -0
  30. package/src/lib/billing/ai-overage-ledger.js.map +1 -0
  31. package/src/lib/billing/ai-overage-standing-writes.d.ts +110 -0
  32. package/src/lib/billing/ai-overage-standing-writes.js +205 -0
  33. package/src/lib/billing/ai-overage-standing-writes.js.map +1 -0
  34. package/src/lib/billing/ai-overage-standing.d.ts +168 -0
  35. package/src/lib/billing/ai-overage-standing.js +215 -0
  36. package/src/lib/billing/ai-overage-standing.js.map +1 -0
  37. package/src/lib/billing/ai-overage-trigger.d.ts +30 -0
  38. package/src/lib/billing/ai-overage-trigger.js +76 -0
  39. package/src/lib/billing/ai-overage-trigger.js.map +1 -0
  40. package/src/lib/components/ai-allotment-editor.component.d.ts +40 -0
  41. package/src/lib/components/ai-allotment-editor.component.js +213 -0
  42. package/src/lib/components/ai-allotment-editor.component.js.map +1 -0
  43. package/src/lib/components/ai-assist-actions-context.d.ts +13 -0
  44. package/src/lib/components/ai-assist-actions-context.js +21 -0
  45. package/src/lib/components/ai-assist-actions-context.js.map +1 -0
  46. package/src/lib/components/ai-assist-provider.component.d.ts +51 -0
  47. package/src/lib/components/ai-assist-provider.component.js +519 -0
  48. package/src/lib/components/ai-assist-provider.component.js.map +1 -0
  49. package/src/lib/components/ai-brief-dialog.component.d.ts +56 -0
  50. package/src/lib/components/ai-brief-dialog.component.js +319 -0
  51. package/src/lib/components/ai-brief-dialog.component.js.map +1 -0
  52. package/src/lib/components/ai-collaborator-permissions-column.component.d.ts +32 -0
  53. package/src/lib/components/ai-collaborator-permissions-column.component.js +132 -0
  54. package/src/lib/components/ai-collaborator-permissions-column.component.js.map +1 -0
  55. package/src/lib/components/ai-credits-card.component.d.ts +34 -0
  56. package/src/lib/components/ai-credits-card.component.js +131 -0
  57. package/src/lib/components/ai-credits-card.component.js.map +1 -0
  58. package/src/lib/components/ai-credits-columns.component.d.ts +56 -0
  59. package/src/lib/components/ai-credits-columns.component.js +118 -0
  60. package/src/lib/components/ai-credits-columns.component.js.map +1 -0
  61. package/src/lib/components/ai-crm-email-draft.component.d.ts +17 -0
  62. package/src/lib/components/ai-crm-email-draft.component.js +159 -0
  63. package/src/lib/components/ai-crm-email-draft.component.js.map +1 -0
  64. package/src/lib/components/ai-crm-import-mapping.component.d.ts +20 -0
  65. package/src/lib/components/ai-crm-import-mapping.component.js +167 -0
  66. package/src/lib/components/ai-crm-import-mapping.component.js.map +1 -0
  67. package/src/lib/components/ai-crm-record-card.component.d.ts +27 -0
  68. package/src/lib/components/ai-crm-record-card.component.js +263 -0
  69. package/src/lib/components/ai-crm-record-card.component.js.map +1 -0
  70. package/src/lib/components/ai-describe-automation.component.d.ts +31 -0
  71. package/src/lib/components/ai-describe-automation.component.js +226 -0
  72. package/src/lib/components/ai-describe-automation.component.js.map +1 -0
  73. package/src/lib/components/ai-describe-button.component.d.ts +39 -0
  74. package/src/lib/components/ai-describe-button.component.js +87 -0
  75. package/src/lib/components/ai-describe-button.component.js.map +1 -0
  76. package/src/lib/components/ai-describe-page.component.d.ts +26 -0
  77. package/src/lib/components/ai-describe-page.component.js +18 -0
  78. package/src/lib/components/ai-describe-page.component.js.map +1 -0
  79. package/src/lib/components/ai-experiment-cards.component.d.ts +75 -0
  80. package/src/lib/components/ai-experiment-cards.component.js +573 -0
  81. package/src/lib/components/ai-experiment-cards.component.js.map +1 -0
  82. package/src/lib/components/ai-explain-automation.component.d.ts +31 -0
  83. package/src/lib/components/ai-explain-automation.component.js +265 -0
  84. package/src/lib/components/ai-explain-automation.component.js.map +1 -0
  85. package/src/lib/components/ai-insight-dialog.component.d.ts +37 -0
  86. package/src/lib/components/ai-insight-dialog.component.js +441 -0
  87. package/src/lib/components/ai-insight-dialog.component.js.map +1 -0
  88. package/src/lib/components/ai-job-plan.component.d.ts +46 -0
  89. package/src/lib/components/ai-job-plan.component.js +192 -0
  90. package/src/lib/components/ai-job-plan.component.js.map +1 -0
  91. package/src/lib/components/ai-model-selector.component.d.ts +21 -0
  92. package/src/lib/components/ai-model-selector.component.js +109 -0
  93. package/src/lib/components/ai-model-selector.component.js.map +1 -0
  94. package/src/lib/components/ai-page-brief-dialog.component.d.ts +29 -0
  95. package/src/lib/components/ai-page-brief-dialog.component.js +27 -0
  96. package/src/lib/components/ai-page-brief-dialog.component.js.map +1 -0
  97. package/src/lib/components/ai-permissions-on-host.component.d.ts +55 -0
  98. package/src/lib/components/ai-permissions-on-host.component.js +91 -0
  99. package/src/lib/components/ai-permissions-on-host.component.js.map +1 -0
  100. package/src/lib/components/ai-product-copy-card.component.d.ts +25 -0
  101. package/src/lib/components/ai-product-copy-card.component.js +328 -0
  102. package/src/lib/components/ai-product-copy-card.component.js.map +1 -0
  103. package/src/lib/components/ai-product-import-option.component.d.ts +14 -0
  104. package/src/lib/components/ai-product-import-option.component.js +58 -0
  105. package/src/lib/components/ai-product-import-option.component.js.map +1 -0
  106. package/src/lib/components/ai-products-hub-card.component.d.ts +15 -0
  107. package/src/lib/components/ai-products-hub-card.component.js +418 -0
  108. package/src/lib/components/ai-products-hub-card.component.js.map +1 -0
  109. package/src/lib/components/ai-products-proposals.component.d.ts +19 -0
  110. package/src/lib/components/ai-products-proposals.component.js +547 -0
  111. package/src/lib/components/ai-products-proposals.component.js.map +1 -0
  112. package/src/lib/components/ai-save-as-component.component.d.ts +38 -0
  113. package/src/lib/components/ai-save-as-component.component.js +231 -0
  114. package/src/lib/components/ai-save-as-component.component.js.map +1 -0
  115. package/src/lib/components/ai-seo-audit-card.component.d.ts +9 -0
  116. package/src/lib/components/ai-seo-audit-card.component.js +620 -0
  117. package/src/lib/components/ai-seo-audit-card.component.js.map +1 -0
  118. package/src/lib/components/ai-seo-fields-card.component.d.ts +10 -0
  119. package/src/lib/components/ai-seo-fields-card.component.js +453 -0
  120. package/src/lib/components/ai-seo-fields-card.component.js.map +1 -0
  121. package/src/lib/components/ai-site-batch-card.component.d.ts +32 -0
  122. package/src/lib/components/ai-site-batch-card.component.js +531 -0
  123. package/src/lib/components/ai-site-batch-card.component.js.map +1 -0
  124. package/src/lib/components/ai-site-seo-start-card.component.d.ts +26 -0
  125. package/src/lib/components/ai-site-seo-start-card.component.js +178 -0
  126. package/src/lib/components/ai-site-seo-start-card.component.js.map +1 -0
  127. package/src/lib/components/ai-site-start-card.component.d.ts +19 -0
  128. package/src/lib/components/ai-site-start-card.component.js +348 -0
  129. package/src/lib/components/ai-site-start-card.component.js.map +1 -0
  130. package/src/lib/components/ai-template-collection-field.component.d.ts +32 -0
  131. package/src/lib/components/ai-template-collection-field.component.js +63 -0
  132. package/src/lib/components/ai-template-collection-field.component.js.map +1 -0
  133. package/src/lib/components/ai-theme-proposal-card.component.d.ts +6 -0
  134. package/src/lib/components/ai-theme-proposal-card.component.js +619 -0
  135. package/src/lib/components/ai-theme-proposal-card.component.js.map +1 -0
  136. package/src/lib/components/ai-usage-strip.component.d.ts +27 -0
  137. package/src/lib/components/ai-usage-strip.component.js +145 -0
  138. package/src/lib/components/ai-usage-strip.component.js.map +1 -0
  139. package/src/lib/components/assist-edit-canvas.d.ts +169 -0
  140. package/src/lib/components/assist-edit-canvas.js +636 -0
  141. package/src/lib/components/assist-edit-canvas.js.map +1 -0
  142. package/src/lib/components/assist-edit-card.component.d.ts +16 -0
  143. package/src/lib/components/assist-edit-card.component.js +181 -0
  144. package/src/lib/components/assist-edit-card.component.js.map +1 -0
  145. package/src/lib/components/assist-jobs-drawer.component.d.ts +72 -0
  146. package/src/lib/components/assist-jobs-drawer.component.js +626 -0
  147. package/src/lib/components/assist-jobs-drawer.component.js.map +1 -0
  148. package/src/lib/components/assist-panel.component.d.ts +136 -0
  149. package/src/lib/components/assist-panel.component.js +1099 -0
  150. package/src/lib/components/assist-panel.component.js.map +1 -0
  151. package/src/lib/components/assist-signals-page.component.d.ts +3 -0
  152. package/src/lib/components/assist-signals-page.component.js +1017 -0
  153. package/src/lib/components/assist-signals-page.component.js.map +1 -0
  154. package/src/lib/components/besigner-ai-controls.component.d.ts +29 -0
  155. package/src/lib/components/besigner-ai-controls.component.js +81 -0
  156. package/src/lib/components/besigner-ai-controls.component.js.map +1 -0
  157. package/src/lib/components/billing-ai-allotments.component.d.ts +36 -0
  158. package/src/lib/components/billing-ai-allotments.component.js +486 -0
  159. package/src/lib/components/billing-ai-allotments.component.js.map +1 -0
  160. package/src/lib/components/billing-ai-top-users.component.d.ts +44 -0
  161. package/src/lib/components/billing-ai-top-users.component.js +304 -0
  162. package/src/lib/components/billing-ai-top-users.component.js.map +1 -0
  163. package/src/lib/components/billing-assist-overage-card.component.d.ts +69 -0
  164. package/src/lib/components/billing-assist-overage-card.component.js +437 -0
  165. package/src/lib/components/billing-assist-overage-card.component.js.map +1 -0
  166. package/src/lib/components/host-ai-allotments.component.d.ts +40 -0
  167. package/src/lib/components/host-ai-allotments.component.js +239 -0
  168. package/src/lib/components/host-ai-allotments.component.js.map +1 -0
  169. package/src/lib/components/member-ai-allotment-card.component.d.ts +28 -0
  170. package/src/lib/components/member-ai-allotment-card.component.js +172 -0
  171. package/src/lib/components/member-ai-allotment-card.component.js.map +1 -0
  172. package/src/lib/components/member-ai-usage-card.component.d.ts +28 -0
  173. package/src/lib/components/member-ai-usage-card.component.js +240 -0
  174. package/src/lib/components/member-ai-usage-card.component.js.map +1 -0
  175. package/src/lib/components/staff-org-ai-card.component.d.ts +17 -0
  176. package/src/lib/components/staff-org-ai-card.component.js +739 -0
  177. package/src/lib/components/staff-org-ai-card.component.js.map +1 -0
  178. package/src/lib/components/staff-org-usage-ai-columns.component.d.ts +41 -0
  179. package/src/lib/components/staff-org-usage-ai-columns.component.js +65 -0
  180. package/src/lib/components/staff-org-usage-ai-columns.component.js.map +1 -0
  181. package/src/lib/components/staff-orgs-ai-spend-column.component.d.ts +28 -0
  182. package/src/lib/components/staff-orgs-ai-spend-column.component.js +89 -0
  183. package/src/lib/components/staff-orgs-ai-spend-column.component.js.map +1 -0
  184. package/src/lib/components/staff-user-ai-usage-card.component.d.ts +27 -0
  185. package/src/lib/components/staff-user-ai-usage-card.component.js +183 -0
  186. package/src/lib/components/staff-user-ai-usage-card.component.js.map +1 -0
  187. package/src/lib/components/use-ai-allotments.d.ts +49 -0
  188. package/src/lib/components/use-ai-allotments.js +171 -0
  189. package/src/lib/components/use-ai-allotments.js.map +1 -0
  190. package/src/lib/components/use-ai-crm-answer.d.ts +50 -0
  191. package/src/lib/components/use-ai-crm-answer.js +220 -0
  192. package/src/lib/components/use-ai-crm-answer.js.map +1 -0
  193. package/src/lib/components/use-ai-job-run.d.ts +51 -0
  194. package/src/lib/components/use-ai-job-run.js +176 -0
  195. package/src/lib/components/use-ai-job-run.js.map +1 -0
  196. package/src/lib/components/use-ai-model-choice.d.ts +47 -0
  197. package/src/lib/components/use-ai-model-choice.js +150 -0
  198. package/src/lib/components/use-ai-model-choice.js.map +1 -0
  199. package/src/lib/components/use-ai-products-jobs.d.ts +36 -0
  200. package/src/lib/components/use-ai-products-jobs.js +190 -0
  201. package/src/lib/components/use-ai-products-jobs.js.map +1 -0
  202. package/src/lib/components/use-ai-usage-meter.d.ts +11 -0
  203. package/src/lib/components/use-ai-usage-meter.js +96 -0
  204. package/src/lib/components/use-ai-usage-meter.js.map +1 -0
  205. package/src/lib/components/use-org-ai-usage.d.ts +42 -0
  206. package/src/lib/components/use-org-ai-usage.js +181 -0
  207. package/src/lib/components/use-org-ai-usage.js.map +1 -0
  208. package/src/lib/components/use-staff-orgs-ai-spend.d.ts +18 -0
  209. package/src/lib/components/use-staff-orgs-ai-spend.js +127 -0
  210. package/src/lib/components/use-staff-orgs-ai-spend.js.map +1 -0
  211. package/src/lib/constants.d.ts +24 -0
  212. package/src/lib/constants.js +23 -0
  213. package/src/lib/constants.js.map +1 -0
  214. package/src/lib/declarations.d.ts +48 -0
  215. package/src/lib/declarations.js +129 -0
  216. package/src/lib/declarations.js.map +1 -0
  217. package/src/lib/declarations.server.d.ts +35 -0
  218. package/src/lib/declarations.server.js +138 -0
  219. package/src/lib/declarations.server.js.map +1 -0
  220. package/src/lib/insights/ai-figure-readers.d.ts +90 -0
  221. package/src/lib/insights/ai-figure-readers.js +863 -0
  222. package/src/lib/insights/ai-figure-readers.js.map +1 -0
  223. package/src/lib/insights/ai-insight-digest.d.ts +165 -0
  224. package/src/lib/insights/ai-insight-digest.js +363 -0
  225. package/src/lib/insights/ai-insight-digest.js.map +1 -0
  226. package/src/lib/insights/ai-insight-readers.d.ts +71 -0
  227. package/src/lib/insights/ai-insight-readers.js +141 -0
  228. package/src/lib/insights/ai-insight-readers.js.map +1 -0
  229. package/src/lib/jobs/ai-crm-access.d.ts +61 -0
  230. package/src/lib/jobs/ai-crm-access.js +94 -0
  231. package/src/lib/jobs/ai-crm-access.js.map +1 -0
  232. package/src/lib/jobs/ai-email-bindings.d.ts +97 -0
  233. package/src/lib/jobs/ai-email-bindings.js +147 -0
  234. package/src/lib/jobs/ai-email-bindings.js.map +1 -0
  235. package/src/lib/jobs/ai-job-admission.d.ts +82 -0
  236. package/src/lib/jobs/ai-job-admission.js +45 -0
  237. package/src/lib/jobs/ai-job-admission.js.map +1 -0
  238. package/src/lib/jobs/ai-job-budget.d.ts +167 -0
  239. package/src/lib/jobs/ai-job-budget.js +161 -0
  240. package/src/lib/jobs/ai-job-budget.js.map +1 -0
  241. package/src/lib/jobs/ai-job-campaign-step.d.ts +108 -0
  242. package/src/lib/jobs/ai-job-campaign-step.js +340 -0
  243. package/src/lib/jobs/ai-job-campaign-step.js.map +1 -0
  244. package/src/lib/jobs/ai-job-component-checks.d.ts +74 -0
  245. package/src/lib/jobs/ai-job-component-checks.js +442 -0
  246. package/src/lib/jobs/ai-job-component-checks.js.map +1 -0
  247. package/src/lib/jobs/ai-job-component-step.d.ts +75 -0
  248. package/src/lib/jobs/ai-job-component-step.js +262 -0
  249. package/src/lib/jobs/ai-job-component-step.js.map +1 -0
  250. package/src/lib/jobs/ai-job-crm-step.d.ts +192 -0
  251. package/src/lib/jobs/ai-job-crm-step.js +734 -0
  252. package/src/lib/jobs/ai-job-crm-step.js.map +1 -0
  253. package/src/lib/jobs/ai-job-draft-ids.d.ts +62 -0
  254. package/src/lib/jobs/ai-job-draft-ids.js +132 -0
  255. package/src/lib/jobs/ai-job-draft-ids.js.map +1 -0
  256. package/src/lib/jobs/ai-job-drafts.d.ts +304 -0
  257. package/src/lib/jobs/ai-job-drafts.js +557 -0
  258. package/src/lib/jobs/ai-job-drafts.js.map +1 -0
  259. package/src/lib/jobs/ai-job-email-step.d.ts +195 -0
  260. package/src/lib/jobs/ai-job-email-step.js +547 -0
  261. package/src/lib/jobs/ai-job-email-step.js.map +1 -0
  262. package/src/lib/jobs/ai-job-experiment-step.d.ts +105 -0
  263. package/src/lib/jobs/ai-job-experiment-step.js +445 -0
  264. package/src/lib/jobs/ai-job-experiment-step.js.map +1 -0
  265. package/src/lib/jobs/ai-job-form-step.d.ts +250 -0
  266. package/src/lib/jobs/ai-job-form-step.js +634 -0
  267. package/src/lib/jobs/ai-job-form-step.js.map +1 -0
  268. package/src/lib/jobs/ai-job-generation.d.ts +114 -0
  269. package/src/lib/jobs/ai-job-generation.js +384 -0
  270. package/src/lib/jobs/ai-job-generation.js.map +1 -0
  271. package/src/lib/jobs/ai-job-insight-budget.d.ts +41 -0
  272. package/src/lib/jobs/ai-job-insight-budget.js +46 -0
  273. package/src/lib/jobs/ai-job-insight-budget.js.map +1 -0
  274. package/src/lib/jobs/ai-job-insight-step.d.ts +58 -0
  275. package/src/lib/jobs/ai-job-insight-step.js +350 -0
  276. package/src/lib/jobs/ai-job-insight-step.js.map +1 -0
  277. package/src/lib/jobs/ai-job-layout-step.d.ts +103 -0
  278. package/src/lib/jobs/ai-job-layout-step.js +340 -0
  279. package/src/lib/jobs/ai-job-layout-step.js.map +1 -0
  280. package/src/lib/jobs/ai-job-page-budget.d.ts +57 -0
  281. package/src/lib/jobs/ai-job-page-budget.js +60 -0
  282. package/src/lib/jobs/ai-job-page-budget.js.map +1 -0
  283. package/src/lib/jobs/ai-job-page-sections.d.ts +150 -0
  284. package/src/lib/jobs/ai-job-page-sections.js +450 -0
  285. package/src/lib/jobs/ai-job-page-sections.js.map +1 -0
  286. package/src/lib/jobs/ai-job-page-step.d.ts +198 -0
  287. package/src/lib/jobs/ai-job-page-step.js +667 -0
  288. package/src/lib/jobs/ai-job-page-step.js.map +1 -0
  289. package/src/lib/jobs/ai-job-plan-conformance.d.ts +107 -0
  290. package/src/lib/jobs/ai-job-plan-conformance.js +164 -0
  291. package/src/lib/jobs/ai-job-plan-conformance.js.map +1 -0
  292. package/src/lib/jobs/ai-job-plan-step.d.ts +196 -0
  293. package/src/lib/jobs/ai-job-plan-step.js +458 -0
  294. package/src/lib/jobs/ai-job-plan-step.js.map +1 -0
  295. package/src/lib/jobs/ai-job-plugin-drafts.d.ts +76 -0
  296. package/src/lib/jobs/ai-job-plugin-drafts.js +91 -0
  297. package/src/lib/jobs/ai-job-plugin-drafts.js.map +1 -0
  298. package/src/lib/jobs/ai-job-products-step.d.ts +106 -0
  299. package/src/lib/jobs/ai-job-products-step.js +436 -0
  300. package/src/lib/jobs/ai-job-products-step.js.map +1 -0
  301. package/src/lib/jobs/ai-job-seo-budget.d.ts +52 -0
  302. package/src/lib/jobs/ai-job-seo-budget.js +63 -0
  303. package/src/lib/jobs/ai-job-seo-budget.js.map +1 -0
  304. package/src/lib/jobs/ai-job-seo-step.d.ts +145 -0
  305. package/src/lib/jobs/ai-job-seo-step.js +809 -0
  306. package/src/lib/jobs/ai-job-seo-step.js.map +1 -0
  307. package/src/lib/jobs/ai-job-site-step.d.ts +252 -0
  308. package/src/lib/jobs/ai-job-site-step.js +538 -0
  309. package/src/lib/jobs/ai-job-site-step.js.map +1 -0
  310. package/src/lib/jobs/ai-job-template-step.d.ts +105 -0
  311. package/src/lib/jobs/ai-job-template-step.js +391 -0
  312. package/src/lib/jobs/ai-job-template-step.js.map +1 -0
  313. package/src/lib/jobs/ai-job-text-step.d.ts +125 -0
  314. package/src/lib/jobs/ai-job-text-step.js +128 -0
  315. package/src/lib/jobs/ai-job-text-step.js.map +1 -0
  316. package/src/lib/jobs/ai-job-theme-budget.d.ts +38 -0
  317. package/src/lib/jobs/ai-job-theme-budget.js +43 -0
  318. package/src/lib/jobs/ai-job-theme-budget.js.map +1 -0
  319. package/src/lib/jobs/ai-job-theme-step.d.ts +115 -0
  320. package/src/lib/jobs/ai-job-theme-step.js +337 -0
  321. package/src/lib/jobs/ai-job-theme-step.js.map +1 -0
  322. package/src/lib/jobs/ai-job-workflow-step.d.ts +139 -0
  323. package/src/lib/jobs/ai-job-workflow-step.js +530 -0
  324. package/src/lib/jobs/ai-job-workflow-step.js.map +1 -0
  325. package/src/lib/jobs/ai-jobs-beat.d.ts +78 -0
  326. package/src/lib/jobs/ai-jobs-beat.js +93 -0
  327. package/src/lib/jobs/ai-jobs-beat.js.map +1 -0
  328. package/src/lib/jobs/ai-jobs-pause.d.ts +38 -0
  329. package/src/lib/jobs/ai-jobs-pause.js +45 -0
  330. package/src/lib/jobs/ai-jobs-pause.js.map +1 -0
  331. package/src/lib/jobs/ai-jobs.d.ts +558 -0
  332. package/src/lib/jobs/ai-jobs.js +1410 -0
  333. package/src/lib/jobs/ai-jobs.js.map +1 -0
  334. package/src/lib/jobs/ai-media-asset-server.d.ts +34 -0
  335. package/src/lib/jobs/ai-media-asset-server.js +34 -0
  336. package/src/lib/jobs/ai-media-asset-server.js.map +1 -0
  337. package/src/lib/jobs/ai-media-asset.d.ts +59 -0
  338. package/src/lib/jobs/ai-media-asset.js +86 -0
  339. package/src/lib/jobs/ai-media-asset.js.map +1 -0
  340. package/src/lib/jobs/ai-product-image.d.ts +78 -0
  341. package/src/lib/jobs/ai-product-image.js +113 -0
  342. package/src/lib/jobs/ai-product-image.js.map +1 -0
  343. package/src/lib/jobs/ai-theme-brand-inputs.d.ts +125 -0
  344. package/src/lib/jobs/ai-theme-brand-inputs.js +378 -0
  345. package/src/lib/jobs/ai-theme-brand-inputs.js.map +1 -0
  346. package/src/lib/jobs/ai-theme-brand-server.d.ts +33 -0
  347. package/src/lib/jobs/ai-theme-brand-server.js +33 -0
  348. package/src/lib/jobs/ai-theme-brand-server.js.map +1 -0
  349. package/src/lib/jobs/ai-workflow-records.d.ts +84 -0
  350. package/src/lib/jobs/ai-workflow-records.js +158 -0
  351. package/src/lib/jobs/ai-workflow-records.js.map +1 -0
  352. package/src/lib/jobs/fixtures/ai-free-page-built-recording.d.ts +31 -0
  353. package/src/lib/jobs/fixtures/ai-free-page-built-recording.js +367 -0
  354. package/src/lib/jobs/fixtures/ai-free-page-built-recording.js.map +1 -0
  355. package/src/lib/jobs/fixtures/ai-free-page-recording.d.ts +69 -0
  356. package/src/lib/jobs/fixtures/ai-free-page-recording.js +442 -0
  357. package/src/lib/jobs/fixtures/ai-free-page-recording.js.map +1 -0
  358. package/src/lib/jobs/fixtures/ai-page-briefs.d.ts +146 -0
  359. package/src/lib/jobs/fixtures/ai-page-briefs.js +1850 -0
  360. package/src/lib/jobs/fixtures/ai-page-briefs.js.map +1 -0
  361. package/src/lib/model/ai-allotments.d.ts +208 -0
  362. package/src/lib/model/ai-allotments.js +269 -0
  363. package/src/lib/model/ai-allotments.js.map +1 -0
  364. package/src/lib/model/ai-automation-draft.d.ts +74 -0
  365. package/src/lib/model/ai-automation-draft.js +310 -0
  366. package/src/lib/model/ai-automation-draft.js.map +1 -0
  367. package/src/lib/model/ai-automation-outline.d.ts +50 -0
  368. package/src/lib/model/ai-automation-outline.js +262 -0
  369. package/src/lib/model/ai-automation-outline.js.map +1 -0
  370. package/src/lib/model/ai-build-plan.d.ts +197 -0
  371. package/src/lib/model/ai-build-plan.js +438 -0
  372. package/src/lib/model/ai-build-plan.js.map +1 -0
  373. package/src/lib/model/ai-crm.d.ts +237 -0
  374. package/src/lib/model/ai-crm.js +225 -0
  375. package/src/lib/model/ai-crm.js.map +1 -0
  376. package/src/lib/model/ai-experiment-proposal.d.ts +68 -0
  377. package/src/lib/model/ai-experiment-proposal.js +146 -0
  378. package/src/lib/model/ai-experiment-proposal.js.map +1 -0
  379. package/src/lib/model/ai-experiment.d.ts +309 -0
  380. package/src/lib/model/ai-experiment.js +395 -0
  381. package/src/lib/model/ai-experiment.js.map +1 -0
  382. package/src/lib/model/ai-insight.d.ts +178 -0
  383. package/src/lib/model/ai-insight.js +201 -0
  384. package/src/lib/model/ai-insight.js.map +1 -0
  385. package/src/lib/model/ai-jobs.types.d.ts +412 -0
  386. package/src/lib/model/ai-jobs.types.js +42 -0
  387. package/src/lib/model/ai-jobs.types.js.map +1 -0
  388. package/src/lib/model/ai-page-job.d.ts +92 -0
  389. package/src/lib/model/ai-page-job.js +159 -0
  390. package/src/lib/model/ai-page-job.js.map +1 -0
  391. package/src/lib/model/ai-permissions.d.ts +49 -0
  392. package/src/lib/model/ai-permissions.js +97 -0
  393. package/src/lib/model/ai-permissions.js.map +1 -0
  394. package/src/lib/model/ai-plan-capabilities.d.ts +139 -0
  395. package/src/lib/model/ai-plan-capabilities.js +149 -0
  396. package/src/lib/model/ai-plan-capabilities.js.map +1 -0
  397. package/src/lib/model/ai-products.d.ts +251 -0
  398. package/src/lib/model/ai-products.js +253 -0
  399. package/src/lib/model/ai-products.js.map +1 -0
  400. package/src/lib/model/ai-seo.d.ts +208 -0
  401. package/src/lib/model/ai-seo.js +150 -0
  402. package/src/lib/model/ai-seo.js.map +1 -0
  403. package/src/lib/model/ai-site-inventory.d.ts +164 -0
  404. package/src/lib/model/ai-site-inventory.js +145 -0
  405. package/src/lib/model/ai-site-inventory.js.map +1 -0
  406. package/src/lib/model/ai-site-job.d.ts +247 -0
  407. package/src/lib/model/ai-site-job.js +314 -0
  408. package/src/lib/model/ai-site-job.js.map +1 -0
  409. package/src/lib/model/ai-site-start-seo.d.ts +103 -0
  410. package/src/lib/model/ai-site-start-seo.js +154 -0
  411. package/src/lib/model/ai-site-start-seo.js.map +1 -0
  412. package/src/lib/model/ai-site-start.d.ts +122 -0
  413. package/src/lib/model/ai-site-start.js +159 -0
  414. package/src/lib/model/ai-site-start.js.map +1 -0
  415. package/src/lib/model/ai-site-switch.d.ts +56 -0
  416. package/src/lib/model/ai-site-switch.js +73 -0
  417. package/src/lib/model/ai-site-switch.js.map +1 -0
  418. package/src/lib/model/ai-storefront-claims.d.ts +70 -0
  419. package/src/lib/model/ai-storefront-claims.js +130 -0
  420. package/src/lib/model/ai-storefront-claims.js.map +1 -0
  421. package/src/lib/model/ai-template-subjects.d.ts +82 -0
  422. package/src/lib/model/ai-template-subjects.js +136 -0
  423. package/src/lib/model/ai-template-subjects.js.map +1 -0
  424. package/src/lib/model/ai-theme-proposal.d.ts +210 -0
  425. package/src/lib/model/ai-theme-proposal.js +506 -0
  426. package/src/lib/model/ai-theme-proposal.js.map +1 -0
  427. package/src/lib/model/ai-tokens.d.ts +96 -0
  428. package/src/lib/model/ai-tokens.js +117 -0
  429. package/src/lib/model/ai-tokens.js.map +1 -0
  430. package/src/lib/model/ai-usage-by-user.d.ts +120 -0
  431. package/src/lib/model/ai-usage-by-user.js +139 -0
  432. package/src/lib/model/ai-usage-by-user.js.map +1 -0
  433. package/src/lib/model/ai-workflow-job.d.ts +111 -0
  434. package/src/lib/model/ai-workflow-job.js +183 -0
  435. package/src/lib/model/ai-workflow-job.js.map +1 -0
  436. package/src/lib/model/assist-edit.d.ts +261 -0
  437. package/src/lib/model/assist-edit.js +175 -0
  438. package/src/lib/model/assist-edit.js.map +1 -0
  439. package/src/lib/plugin-config.d.ts +33 -0
  440. package/src/lib/plugin-config.js +118 -0
  441. package/src/lib/plugin-config.js.map +1 -0
  442. package/src/lib/plugin.d.ts +30 -0
  443. package/src/lib/plugin.js +525 -0
  444. package/src/lib/plugin.js.map +1 -0
  445. package/src/lib/providers/anthropic.d.ts +84 -0
  446. package/src/lib/providers/anthropic.js +432 -0
  447. package/src/lib/providers/anthropic.js.map +1 -0
  448. package/src/lib/providers/catalog.d.ts +197 -0
  449. package/src/lib/providers/catalog.js +312 -0
  450. package/src/lib/providers/catalog.js.map +1 -0
  451. package/src/lib/providers/contract.d.ts +464 -0
  452. package/src/lib/providers/contract.js +274 -0
  453. package/src/lib/providers/contract.js.map +1 -0
  454. package/src/lib/providers/model-choice.d.ts +119 -0
  455. package/src/lib/providers/model-choice.js +416 -0
  456. package/src/lib/providers/model-choice.js.map +1 -0
  457. package/src/lib/providers/openai-compatible.d.ts +58 -0
  458. package/src/lib/providers/openai-compatible.js +361 -0
  459. package/src/lib/providers/openai-compatible.js.map +1 -0
  460. package/src/lib/providers/registry.d.ts +49 -0
  461. package/src/lib/providers/registry.js +71 -0
  462. package/src/lib/providers/registry.js.map +1 -0
  463. package/src/lib/providers/routing.d.ts +98 -0
  464. package/src/lib/providers/routing.js +450 -0
  465. package/src/lib/providers/routing.js.map +1 -0
  466. package/src/lib/runtime/ai-abuse-guards.d.ts +113 -0
  467. package/src/lib/runtime/ai-abuse-guards.js +148 -0
  468. package/src/lib/runtime/ai-abuse-guards.js.map +1 -0
  469. package/src/lib/runtime/ai-component-bindings.d.ts +67 -0
  470. package/src/lib/runtime/ai-component-bindings.js +106 -0
  471. package/src/lib/runtime/ai-component-bindings.js.map +1 -0
  472. package/src/lib/runtime/ai-device-audit.d.ts +109 -0
  473. package/src/lib/runtime/ai-device-audit.js +97 -0
  474. package/src/lib/runtime/ai-device-audit.js.map +1 -0
  475. package/src/lib/runtime/ai-doctrine-validators.d.ts +720 -0
  476. package/src/lib/runtime/ai-doctrine-validators.js +3133 -0
  477. package/src/lib/runtime/ai-doctrine-validators.js.map +1 -0
  478. package/src/lib/runtime/ai-doctrine.d.ts +372 -0
  479. package/src/lib/runtime/ai-doctrine.js +944 -0
  480. package/src/lib/runtime/ai-doctrine.js.map +1 -0
  481. package/src/lib/runtime/ai-eval-live.d.ts +321 -0
  482. package/src/lib/runtime/ai-eval-live.js +1257 -0
  483. package/src/lib/runtime/ai-eval-live.js.map +1 -0
  484. package/src/lib/runtime/ai-eval-memory-firestore.d.ts +51 -0
  485. package/src/lib/runtime/ai-eval-memory-firestore.js +183 -0
  486. package/src/lib/runtime/ai-eval-memory-firestore.js.map +1 -0
  487. package/src/lib/runtime/ai-eval.d.ts +441 -0
  488. package/src/lib/runtime/ai-eval.js +1151 -0
  489. package/src/lib/runtime/ai-eval.js.map +1 -0
  490. package/src/lib/runtime/ai-gate.d.ts +130 -0
  491. package/src/lib/runtime/ai-gate.js +272 -0
  492. package/src/lib/runtime/ai-gate.js.map +1 -0
  493. package/src/lib/runtime/ai-generation-bounds.d.ts +24 -0
  494. package/src/lib/runtime/ai-generation-bounds.js +23 -0
  495. package/src/lib/runtime/ai-generation-bounds.js.map +1 -0
  496. package/src/lib/runtime/ai-insight-check.d.ts +76 -0
  497. package/src/lib/runtime/ai-insight-check.js +281 -0
  498. package/src/lib/runtime/ai-insight-check.js.map +1 -0
  499. package/src/lib/runtime/ai-node-tree.d.ts +181 -0
  500. package/src/lib/runtime/ai-node-tree.js +931 -0
  501. package/src/lib/runtime/ai-node-tree.js.map +1 -0
  502. package/src/lib/runtime/ai-page-links.d.ts +79 -0
  503. package/src/lib/runtime/ai-page-links.js +135 -0
  504. package/src/lib/runtime/ai-page-links.js.map +1 -0
  505. package/src/lib/runtime/ai-palette.d.ts +252 -0
  506. package/src/lib/runtime/ai-palette.generated.d.ts +34 -0
  507. package/src/lib/runtime/ai-palette.generated.js +5263 -0
  508. package/src/lib/runtime/ai-palette.generated.js.map +1 -0
  509. package/src/lib/runtime/ai-palette.js +187 -0
  510. package/src/lib/runtime/ai-palette.js.map +1 -0
  511. package/src/lib/runtime/ai-products-generation.d.ts +107 -0
  512. package/src/lib/runtime/ai-products-generation.js +250 -0
  513. package/src/lib/runtime/ai-products-generation.js.map +1 -0
  514. package/src/lib/runtime/ai-repeated-items.d.ts +95 -0
  515. package/src/lib/runtime/ai-repeated-items.js +397 -0
  516. package/src/lib/runtime/ai-repeated-items.js.map +1 -0
  517. package/src/lib/runtime/ai-runtime.d.ts +148 -0
  518. package/src/lib/runtime/ai-runtime.js +237 -0
  519. package/src/lib/runtime/ai-runtime.js.map +1 -0
  520. package/src/lib/runtime/ai-template-examples.d.ts +71 -0
  521. package/src/lib/runtime/ai-template-examples.js +135 -0
  522. package/src/lib/runtime/ai-template-examples.js.map +1 -0
  523. package/src/lib/runtime/assist-answer-cache.d.ts +80 -0
  524. package/src/lib/runtime/assist-answer-cache.js +184 -0
  525. package/src/lib/runtime/assist-answer-cache.js.map +1 -0
  526. package/src/lib/runtime/seo-audit.d.ts +93 -0
  527. package/src/lib/runtime/seo-audit.js +260 -0
  528. package/src/lib/runtime/seo-audit.js.map +1 -0
  529. package/src/lib/runtime/seo-content-fixes.d.ts +41 -0
  530. package/src/lib/runtime/seo-content-fixes.js +168 -0
  531. package/src/lib/runtime/seo-content-fixes.js.map +1 -0
  532. package/src/lib/runtime/seo-fields.d.ts +152 -0
  533. package/src/lib/runtime/seo-fields.js +215 -0
  534. package/src/lib/runtime/seo-fields.js.map +1 -0
  535. package/src/lib/runtime/seo-page-facts.d.ts +61 -0
  536. package/src/lib/runtime/seo-page-facts.js +150 -0
  537. package/src/lib/runtime/seo-page-facts.js.map +1 -0
  538. package/src/lib/runtime/site-inventory.d.ts +63 -0
  539. package/src/lib/runtime/site-inventory.js +230 -0
  540. package/src/lib/runtime/site-inventory.js.map +1 -0
  541. package/src/lib/server/ai-admin-org.d.ts +33 -0
  542. package/src/lib/server/ai-admin-org.js +381 -0
  543. package/src/lib/server/ai-admin-org.js.map +1 -0
  544. package/src/lib/server/ai-admin-orgs-spend.d.ts +40 -0
  545. package/src/lib/server/ai-admin-orgs-spend.js +129 -0
  546. package/src/lib/server/ai-admin-orgs-spend.js.map +1 -0
  547. package/src/lib/server/ai-admin-overage.d.ts +19 -0
  548. package/src/lib/server/ai-admin-overage.js +246 -0
  549. package/src/lib/server/ai-admin-overage.js.map +1 -0
  550. package/src/lib/server/ai-admin-signals.d.ts +34 -0
  551. package/src/lib/server/ai-admin-signals.js +330 -0
  552. package/src/lib/server/ai-admin-signals.js.map +1 -0
  553. package/src/lib/server/ai-admin-user.d.ts +27 -0
  554. package/src/lib/server/ai-admin-user.js +128 -0
  555. package/src/lib/server/ai-admin-user.js.map +1 -0
  556. package/src/lib/server/ai-allotments.d.ts +27 -0
  557. package/src/lib/server/ai-allotments.js +544 -0
  558. package/src/lib/server/ai-allotments.js.map +1 -0
  559. package/src/lib/server/ai-assist-prompts.d.ts +102 -0
  560. package/src/lib/server/ai-assist-prompts.js +207 -0
  561. package/src/lib/server/ai-assist-prompts.js.map +1 -0
  562. package/src/lib/server/ai-assist.d.ts +119 -0
  563. package/src/lib/server/ai-assist.js +517 -0
  564. package/src/lib/server/ai-assist.js.map +1 -0
  565. package/src/lib/server/ai-crm-answer.d.ts +30 -0
  566. package/src/lib/server/ai-crm-answer.js +98 -0
  567. package/src/lib/server/ai-crm-answer.js.map +1 -0
  568. package/src/lib/server/ai-generate-component.d.ts +111 -0
  569. package/src/lib/server/ai-generate-component.js +643 -0
  570. package/src/lib/server/ai-generate-component.js.map +1 -0
  571. package/src/lib/server/ai-host-permissions.d.ts +46 -0
  572. package/src/lib/server/ai-host-permissions.js +204 -0
  573. package/src/lib/server/ai-host-permissions.js.map +1 -0
  574. package/src/lib/server/ai-insight-answer.d.ts +30 -0
  575. package/src/lib/server/ai-insight-answer.js +83 -0
  576. package/src/lib/server/ai-insight-answer.js.map +1 -0
  577. package/src/lib/server/ai-insight-digest-route.d.ts +30 -0
  578. package/src/lib/server/ai-insight-digest-route.js +156 -0
  579. package/src/lib/server/ai-insight-digest-route.js.map +1 -0
  580. package/src/lib/server/ai-jobs-batch.d.ts +48 -0
  581. package/src/lib/server/ai-jobs-batch.js +306 -0
  582. package/src/lib/server/ai-jobs-batch.js.map +1 -0
  583. package/src/lib/server/ai-jobs-beat-route.d.ts +36 -0
  584. package/src/lib/server/ai-jobs-beat-route.js +86 -0
  585. package/src/lib/server/ai-jobs-beat-route.js.map +1 -0
  586. package/src/lib/server/ai-jobs-cancel.d.ts +30 -0
  587. package/src/lib/server/ai-jobs-cancel.js +74 -0
  588. package/src/lib/server/ai-jobs-cancel.js.map +1 -0
  589. package/src/lib/server/ai-jobs-events-route.d.ts +31 -0
  590. package/src/lib/server/ai-jobs-events-route.js +51 -0
  591. package/src/lib/server/ai-jobs-events-route.js.map +1 -0
  592. package/src/lib/server/ai-jobs-events.d.ts +55 -0
  593. package/src/lib/server/ai-jobs-events.js +144 -0
  594. package/src/lib/server/ai-jobs-events.js.map +1 -0
  595. package/src/lib/server/ai-jobs-gate.d.ts +47 -0
  596. package/src/lib/server/ai-jobs-gate.js +106 -0
  597. package/src/lib/server/ai-jobs-gate.js.map +1 -0
  598. package/src/lib/server/ai-jobs-resume.d.ts +23 -0
  599. package/src/lib/server/ai-jobs-resume.js +209 -0
  600. package/src/lib/server/ai-jobs-resume.js.map +1 -0
  601. package/src/lib/server/ai-jobs-route.d.ts +32 -0
  602. package/src/lib/server/ai-jobs-route.js +307 -0
  603. package/src/lib/server/ai-jobs-route.js.map +1 -0
  604. package/src/lib/server/ai-models.d.ts +18 -0
  605. package/src/lib/server/ai-models.js +134 -0
  606. package/src/lib/server/ai-models.js.map +1 -0
  607. package/src/lib/server/ai-seo-apply.d.ts +53 -0
  608. package/src/lib/server/ai-seo-apply.js +294 -0
  609. package/src/lib/server/ai-seo-apply.js.map +1 -0
  610. package/src/lib/server/ai-usage.d.ts +18 -0
  611. package/src/lib/server/ai-usage.js +220 -0
  612. package/src/lib/server/ai-usage.js.map +1 -0
  613. package/src/lib/server/assist-chat.d.ts +234 -0
  614. package/src/lib/server/assist-chat.js +1446 -0
  615. package/src/lib/server/assist-chat.js.map +1 -0
  616. package/src/lib/server/assist-edit-applied.d.ts +22 -0
  617. package/src/lib/server/assist-edit-applied.js +239 -0
  618. package/src/lib/server/assist-edit-applied.js.map +1 -0
  619. package/src/lib/server/assist-edit.d.ts +124 -0
  620. package/src/lib/server/assist-edit.js +1000 -0
  621. package/src/lib/server/assist-edit.js.map +1 -0
  622. package/src/lib/server/assist-feedback.d.ts +31 -0
  623. package/src/lib/server/assist-feedback.js +115 -0
  624. package/src/lib/server/assist-feedback.js.map +1 -0
  625. package/src/lib/server/assist-view-context.d.ts +343 -0
  626. package/src/lib/server/assist-view-context.js +690 -0
  627. package/src/lib/server/assist-view-context.js.map +1 -0
  628. package/src/lib/server/billing-credits.d.ts +59 -0
  629. package/src/lib/server/billing-credits.js +146 -0
  630. package/src/lib/server/billing-credits.js.map +1 -0
  631. package/src/lib/server/billing-overage.d.ts +19 -0
  632. package/src/lib/server/billing-overage.js +337 -0
  633. package/src/lib/server/billing-overage.js.map +1 -0
  634. package/src/lib/server.d.ts +32 -0
  635. package/src/lib/server.js +265 -0
  636. package/src/lib/server.js.map +1 -0
  637. package/src/lib/subprocessors.d.ts +18 -0
  638. package/src/lib/subprocessors.js +52 -0
  639. package/src/lib/subprocessors.js.map +1 -0
  640. package/src/lib/tools/ai-component-tool.d.ts +99 -0
  641. package/src/lib/tools/ai-component-tool.js +369 -0
  642. package/src/lib/tools/ai-component-tool.js.map +1 -0
  643. package/src/lib/tools/ai-crm-tool.d.ts +106 -0
  644. package/src/lib/tools/ai-crm-tool.js +488 -0
  645. package/src/lib/tools/ai-crm-tool.js.map +1 -0
  646. package/src/lib/tools/ai-duplicate-resource-tool.d.ts +71 -0
  647. package/src/lib/tools/ai-duplicate-resource-tool.js +164 -0
  648. package/src/lib/tools/ai-duplicate-resource-tool.js.map +1 -0
  649. package/src/lib/tools/ai-experiment-tool.d.ts +40 -0
  650. package/src/lib/tools/ai-experiment-tool.js +155 -0
  651. package/src/lib/tools/ai-experiment-tool.js.map +1 -0
  652. package/src/lib/tools/ai-insight-tool.d.ts +46 -0
  653. package/src/lib/tools/ai-insight-tool.js +200 -0
  654. package/src/lib/tools/ai-insight-tool.js.map +1 -0
  655. package/src/lib/tools/ai-inventory-lookup-tool.d.ts +86 -0
  656. package/src/lib/tools/ai-inventory-lookup-tool.js +164 -0
  657. package/src/lib/tools/ai-inventory-lookup-tool.js.map +1 -0
  658. package/src/lib/tools/ai-products-tool.d.ts +65 -0
  659. package/src/lib/tools/ai-products-tool.js +644 -0
  660. package/src/lib/tools/ai-products-tool.js.map +1 -0
  661. package/src/lib/tools/ai-seo-tool.d.ts +162 -0
  662. package/src/lib/tools/ai-seo-tool.js +546 -0
  663. package/src/lib/tools/ai-seo-tool.js.map +1 -0
  664. package/src/lib/tools/ai-theme-tool.d.ts +101 -0
  665. package/src/lib/tools/ai-theme-tool.js +562 -0
  666. package/src/lib/tools/ai-theme-tool.js.map +1 -0
  667. package/src/lib/tools/ai-workflow-tool.d.ts +166 -0
  668. package/src/lib/tools/ai-workflow-tool.js +860 -0
  669. package/src/lib/tools/ai-workflow-tool.js.map +1 -0
  670. package/src/lib/usage/ai-allotment-alerts.d.ts +72 -0
  671. package/src/lib/usage/ai-allotment-alerts.js +157 -0
  672. package/src/lib/usage/ai-allotment-alerts.js.map +1 -0
  673. package/src/lib/usage/ai-allotments.d.ts +125 -0
  674. package/src/lib/usage/ai-allotments.js +239 -0
  675. package/src/lib/usage/ai-allotments.js.map +1 -0
  676. package/src/lib/usage/ai-model-sample.d.ts +36 -0
  677. package/src/lib/usage/ai-model-sample.js +68 -0
  678. package/src/lib/usage/ai-model-sample.js.map +1 -0
  679. package/src/lib/usage/ai-usage-alerts.d.ts +55 -0
  680. package/src/lib/usage/ai-usage-alerts.js +114 -0
  681. package/src/lib/usage/ai-usage-alerts.js.map +1 -0
  682. package/src/lib/usage/ai-usage-by-user.d.ts +161 -0
  683. package/src/lib/usage/ai-usage-by-user.js +211 -0
  684. package/src/lib/usage/ai-usage-by-user.js.map +1 -0
  685. package/src/lib/usage/ai-usage-eraser.d.ts +29 -0
  686. package/src/lib/usage/ai-usage-eraser.js +40 -0
  687. package/src/lib/usage/ai-usage-eraser.js.map +1 -0
  688. package/src/lib/usage/ai-usage-meter.d.ts +39 -0
  689. package/src/lib/usage/ai-usage-meter.js +85 -0
  690. package/src/lib/usage/ai-usage-meter.js.map +1 -0
  691. package/src/lib/usage/ai-usage-wire.d.ts +184 -0
  692. package/src/lib/usage/ai-usage-wire.js +98 -0
  693. package/src/lib/usage/ai-usage-wire.js.map +1 -0
  694. package/src/lib/usage/assist-ceiling.d.ts +87 -0
  695. package/src/lib/usage/assist-ceiling.js +110 -0
  696. package/src/lib/usage/assist-ceiling.js.map +1 -0
  697. package/src/lib/usage/assist-free-taste.d.ts +225 -0
  698. package/src/lib/usage/assist-free-taste.js +308 -0
  699. package/src/lib/usage/assist-free-taste.js.map +1 -0
  700. package/src/lib/usage/assist-refusals.d.ts +69 -0
  701. package/src/lib/usage/assist-refusals.js +79 -0
  702. package/src/lib/usage/assist-refusals.js.map +1 -0
  703. package/src/lib/usage/assist-signal-mining.d.ts +375 -0
  704. package/src/lib/usage/assist-signal-mining.js +344 -0
  705. package/src/lib/usage/assist-signal-mining.js.map +1 -0
  706. package/src/lib/usage/assist-usage.d.ts +571 -0
  707. package/src/lib/usage/assist-usage.js +978 -0
  708. package/src/lib/usage/assist-usage.js.map +1 -0
  709. package/src/lib/usage/staff-org-ai.d.ts +242 -0
  710. package/src/lib/usage/staff-org-ai.js +173 -0
  711. package/src/lib/usage/staff-org-ai.js.map +1 -0
  712. package/src/lib/usage/staff-org-usage-ai.d.ts +83 -0
  713. package/src/lib/usage/staff-org-usage-ai.js +59 -0
  714. package/src/lib/usage/staff-org-usage-ai.js.map +1 -0
  715. package/src/lib/usage/staff-orgs-ai-spend.d.ts +83 -0
  716. package/src/lib/usage/staff-orgs-ai-spend.js +114 -0
  717. package/src/lib/usage/staff-orgs-ai-spend.js.map +1 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/runtime/ai-node-tree.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n AI_TEXT_LIMITS,\n isHeadlineVariant,\n nodeCapabilityProps,\n type AiPaletteEntry,\n type AiPropSchema,\n type AiSurface,\n} from './ai-palette'\nimport {\n AI_NODE_CAPABILITIES,\n AI_PALETTE,\n AI_SURFACES,\n AI_SX_TOKENS,\n} from './ai-palette.generated'\nimport { linealRelationshipPermits } from '@aglyn/aglyn/app-utils/lineal-order'\nimport {\n NODE_MAP_MAX_BYTES,\n nodeMapBytes,\n} from '@aglyn/aglyn/app-utils/measure-node-map'\nimport { parseMediaRef } from '@aglyn/aglyn/app-utils/media-ref'\nimport {\n COMPONENT_PROP_NAME_PATTERN,\n REUSABLE_INSTANCE_COMPONENT_ID,\n REUSABLE_INSTANCE_PROP_VALUES_KEY,\n} from '@aglyn/aglyn/app-utils/reusable-component-keys'\nimport { createIdUrlSafe } from '@aglyn/aglyn/foundation/constants/app'\nimport { CANVAS_ROOT_ELEMENT_ID } from '@aglyn/aglyn/foundation/constants/canvas'\nimport { NodeType, type NodesMap } from '@aglyn/aglyn/types/nodes'\nimport type { AiComponentPropTypes } from '../model/ai-site-inventory'\nimport {\n AI_COMPONENT_VISIBILITY_PROPS,\n isAiComponentPropToken,\n} from './ai-component-bindings'\n\nimport { sanitizeMarketplaceDefinition } from '@aglyn/aglyn/app-utils/node-definition-sanitizer'\n\n/**\n * The one path an AI-emitted node tree takes into storage (AGL-2905).\n *\n * A model answers with a flat node map in the shape the canvas persists.\n * Nothing about that map is trusted: the component ids, the parent/child\n * pairs, every prop and every `sx` key are what the model chose to write,\n * and the renderer spreads props onto the DOM. So the tree is first held to\n * the same sanitizer a marketplace install passes — reachability from the\n * root, the surface's component allowlist, the persisted node keys, `href`\n * and `src` protocols, a size cap — and then to what a listing never needed\n * checking because a human authored it in the editor:\n *\n * - the parent/child restrictions the besigner enforces on drop\n * (`restrictChildren` / `restrictParent`), and whether an element can hold\n * children at all;\n * - every prop against the generated palette's schema — unknown props are\n * dropped, enum values coerced case-insensitively, a required prop that is\n * missing refuses the tree;\n * - `sx` against a fixed key set and a value grammar of theme tokens, numbers\n * and CSS lengths or keywords, with nothing that can reach a URL or a\n * stylesheet;\n * - copy length by role — a headline, a paragraph, a button label;\n * - links to a screen the host has, a root-relative path or an `https:` URL,\n * and media to a DAM reference or an `https:` URL;\n * - the stored-node-map byte ceiling, measured the way the save measures it.\n *\n * ## The site's own records, when the caller names them (AGL-2935)\n *\n * A reusable-component instance, a form picked on the Forms page and a\n * dataset are each \"a reference into another document\", which is why the\n * palette leaves them off: from a description alone a model can only invent\n * an id. A generator that has read the site's inventory can name real ones,\n * and the building doctrine requires it to — a repeat is placed as\n * instances of one component, and a form is bound by id rather than drawn\n * inline. So the three are admitted exactly as screen links are: only\n * against the ids the caller supplies. With no `componentIds` an instance is\n * still refused; with no `formIds` or `datasetIds` the binding is dropped.\n *\n * What comes out is the flat `NodesMap` `encodeStoredNodes` takes, with every\n * id minted fresh the way a preset graft mints them, so nothing the model\n * wrote can collide with a node already on the canvas. `sourceIds` maps each\n * minted id back to the id the model wrote, so a caller can quote a refused\n * subtree in the model's own words. Every drop is listed in `repairs`; every\n * refusal names its `code`. The function never throws.\n */\n\nexport type AiNodeTreeRefusalCode =\n /** Not an object with a `rootId` and a `nodes` map, or an unknown surface. */\n | 'invalid-input'\n /** The root node carries a component the surface does not start with. */\n | 'root'\n /** A structural failure the sanitizer named: missing node, empty tree. */\n | 'structure'\n /** A component id outside the surface's allowlist. */\n | 'component'\n /** A parent/child pair the besigner would refuse on drop. */\n | 'lineage'\n /** A prop the palette marks required is absent. */\n | 'required-prop'\n /** Over the sanitizer's or the stored-node-map's byte ceiling. */\n | 'too-large'\n /** A component instance naming a component the site does not have. */\n | 'reference'\n\nexport type AiNodeTreeResult =\n | {\n ok: true\n rootId: string\n nodes: NodesMap\n repairs: string[]\n /** Each minted id → the id the model wrote for that node. */\n sourceIds: Record<string, string>\n }\n | { ok: false; error: string; code: AiNodeTreeRefusalCode }\n\nexport interface AiNodeTreeContext {\n /** Screen ids a `screen` prop may name. Absent: any well-formed id. */\n screenIds?: Iterable<string>\n /** DAM media ids a `media` prop may reference. Absent: any well-formed reference. */\n assetIds?: Iterable<string>\n /**\n * Reusable components an instance may place. Absent: no instance is\n * admitted, which is the palette's own rule for a tree nobody grounded.\n */\n componentIds?: Iterable<string>\n /** Declared props per component id, which an instance's values are held to. */\n componentProps?: Record<string, AiComponentPropTypes>\n /** Forms on the Forms page a Form element may bind by `formId`. */\n formIds?: Iterable<string>\n /** Datasets a Form element may write to by `datasetId`. */\n datasetIds?: Iterable<string>\n /**\n * Binding tokens a `url` or `media` prop may hold whole — an Image whose\n * `src` is `{{entry.coverImage}}` on a page template, filled per record\n * when the page renders (AGL-2909). Absent: a token in either role is\n * dropped like any other value that is not an address.\n */\n bindingTokens?: Iterable<string>\n /**\n * The tree defines a reusable component (AGL-2908). A field that is not\n * copy — a switch, a dropdown, a screen, an address, a picture, a number —\n * and the `hideIf` and `hideUnless` directives may then hold one of the\n * component's own `{{prop.<name>}}` tokens as their whole value, and a\n * placed component may be handed one in its `propValues`; each is kept as\n * written. Which property a token names, and whether its kind binds to that\n * field, is the component step's check (`ai-component-bindings.ts`).\n * Absent: such a token is dropped like any value the field cannot hold.\n */\n definesComponent?: boolean\n}\n\n/**\n * `sx` keys a model may set: spacing, color, typography, layout, borders,\n * display, flex and grid. Fixed rather than derived — MUI's system accepts\n * far more (pseudo-selectors, nested selectors, arbitrary CSS properties)\n * and every one of those is a way to reach outside the element.\n */\nexport const AI_SX_ALLOWED_KEYS: ReadonlySet<string> = new Set([\n // spacing\n 'm',\n 'mt',\n 'mr',\n 'mb',\n 'ml',\n 'mx',\n 'my',\n 'margin',\n 'marginTop',\n 'marginRight',\n 'marginBottom',\n 'marginLeft',\n 'p',\n 'pt',\n 'pr',\n 'pb',\n 'pl',\n 'px',\n 'py',\n 'padding',\n 'paddingTop',\n 'paddingRight',\n 'paddingBottom',\n 'paddingLeft',\n 'gap',\n 'rowGap',\n 'columnGap',\n // color\n 'color',\n 'bgcolor',\n 'backgroundColor',\n 'borderColor',\n 'opacity',\n // typography\n 'typography',\n 'fontSize',\n 'fontWeight',\n 'fontFamily',\n 'fontStyle',\n 'lineHeight',\n 'letterSpacing',\n 'textAlign',\n 'textTransform',\n 'textDecoration',\n 'whiteSpace',\n 'textOverflow',\n 'overflowWrap',\n 'wordBreak',\n // layout\n 'width',\n 'minWidth',\n 'maxWidth',\n 'height',\n 'minHeight',\n 'maxHeight',\n 'boxSizing',\n 'overflow',\n 'overflowX',\n 'overflowY',\n 'position',\n 'top',\n 'right',\n 'bottom',\n 'left',\n 'zIndex',\n 'aspectRatio',\n 'objectFit',\n // borders\n 'border',\n 'borderTop',\n 'borderRight',\n 'borderBottom',\n 'borderLeft',\n 'borderWidth',\n 'borderStyle',\n 'borderRadius',\n 'boxShadow',\n // display\n 'display',\n 'visibility',\n // flex\n 'flexDirection',\n 'flexWrap',\n 'justifyContent',\n 'alignItems',\n 'alignContent',\n 'alignSelf',\n 'justifySelf',\n 'flex',\n 'flexGrow',\n 'flexShrink',\n 'flexBasis',\n 'order',\n // grid\n 'gridTemplateColumns',\n 'gridTemplateRows',\n 'gridColumn',\n 'gridRow',\n 'gridArea',\n 'gridAutoFlow',\n 'gridAutoColumns',\n 'gridAutoRows',\n 'justifyItems',\n 'placeItems',\n 'placeContent',\n])\n\n/**\n * Substrings no string a model wrote may carry, in a prop or an `sx` value.\n * Exported for the theme tool's component style values (AGL-2938), which are\n * the same kind of CSS value written into a theme instead of a node.\n */\nexport const HOSTILE_TEXT =\n /<\\s*\\/?\\s*(script|iframe|object|embed|svg|style|link|meta|base|frame|form|input|img)\\b|javascript:|vbscript:|data:text\\/html|expression\\s*\\(|url\\s*\\(|@import|!important|\\bon[a-z]+\\s*=/i\n\n/**\n * A CSS value a model may write into `sx`: lengths, numbers, keywords,\n * shorthands (`1px solid`), functions with plain arguments (`repeat(3, 1fr)`,\n * `rgba(0, 0, 0, 0.2)`), hex colors and theme tokens. No quotes, no\n * semicolons, no braces, no angle brackets, no colons — which is what keeps\n * a `url(`, a selector or a second declaration out.\n */\nexport const SX_VALUE = /^[A-Za-z0-9#.,%()\\s\\-_/+*]{1,100}$/\n\n/**\n * Node fields the sanitizer strips that a model has no business writing —\n * each is a way to reach past the node's own box, and each is named in\n * `repairs` so a route can tell the model what it lost.\n */\nconst STRIPPED_NODE_KEYS = [\n 'className',\n 'interactions',\n 'styleOverrides',\n 'attrOverrides',\n 'presetRef',\n] as const\n\nconst SCREEN_ID = /^[A-Za-z0-9_-]{1,64}$/\n/** The field an icon is picked with; its value carries a drawing no model can write. */\nconst ICON_PICKER_FIELD = 'icon-picker'\nconst MAX_SX_KEYS = 40\n/** A string prop with no role of its own — a color, a CSS length, an icon id. */\nconst PLAIN_STRING_MAX = 500\n\nconst paletteTokens = new Set<string>(AI_SX_TOKENS.palette)\nconst breakpoints = new Set<string>(AI_SX_TOKENS.breakpoints)\nconst typographyVariants = new Set<string>(AI_SX_TOKENS.typographyVariants)\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\n/** An `https:` address that parses as one. */\nexport function isHttpsUrl(value: string): boolean {\n if (!/^https:\\/\\//i.test(value)) return false\n try {\n return new URL(value).protocol === 'https:'\n } catch {\n return false\n }\n}\n\n/** A path on this site: one leading slash, never a scheme-relative `//`. */\nexport function isRootRelativePath(value: string): boolean {\n return /^\\/(?!\\/)[^\\s<>\"'`\\\\]*$/.test(value)\n}\n\nfunction sxValueAllowed(key: string, value: unknown): boolean {\n if (typeof value === 'number') return Number.isFinite(value)\n if (typeof value !== 'string') return false\n const trimmed = value.trim()\n if (!trimmed || HOSTILE_TEXT.test(trimmed)) return false\n if (paletteTokens.has(trimmed)) return true\n if (key === 'typography' && typographyVariants.has(trimmed)) return true\n return SX_VALUE.test(trimmed)\n}\n\n/**\n * The allowed slice of an `sx` object, with a line per key or value dropped.\n * Responsive objects keep only breakpoint keys; anything deeper — a\n * pseudo-selector, a nested selector, an array — is not a value at all.\n */\nfunction sanitizeSx(\n nodeId: string,\n sx: unknown,\n repairs: string[],\n): Record<string, unknown> | undefined {\n if (!isRecord(sx)) {\n if (sx !== undefined)\n repairs.push(`${nodeId}: sx is not an object; dropped`)\n return undefined\n }\n const out: Record<string, unknown> = {}\n let kept = 0\n for (const [key, value] of Object.entries(sx)) {\n if (!AI_SX_ALLOWED_KEYS.has(key)) {\n repairs.push(`${nodeId}: sx.${key} is not an allowed style; dropped`)\n continue\n }\n if (kept >= MAX_SX_KEYS) {\n repairs.push(\n `${nodeId}: sx.${key} is past the ${MAX_SX_KEYS}-key ceiling; dropped`,\n )\n continue\n }\n if (isRecord(value)) {\n const responsive: Record<string, unknown> = {}\n for (const [breakpoint, inner] of Object.entries(value)) {\n if (!breakpoints.has(breakpoint)) {\n repairs.push(\n `${nodeId}: sx.${key}.${breakpoint} is not a breakpoint; dropped`,\n )\n continue\n }\n if (!sxValueAllowed(key, inner)) {\n repairs.push(\n `${nodeId}: sx.${key}.${breakpoint} is not an allowed value; dropped`,\n )\n continue\n }\n responsive[breakpoint] =\n typeof inner === 'string' ? inner.trim() : inner\n }\n if (Object.keys(responsive).length) {\n out[key] = responsive\n kept += 1\n }\n continue\n }\n if (!sxValueAllowed(key, value)) {\n repairs.push(`${nodeId}: sx.${key} is not an allowed value; dropped`)\n continue\n }\n out[key] = typeof value === 'string' ? value.trim() : value\n kept += 1\n }\n return kept ? out : undefined\n}\n\nfunction coerceEnum(schema: AiPropSchema, value: unknown): string | undefined {\n if (typeof value !== 'string' || !schema.enum) return undefined\n const wanted = value.trim().toLowerCase()\n return schema.enum.find((option) => option.toLowerCase() === wanted)\n}\n\nfunction coerceBoolean(value: unknown): boolean | undefined {\n if (typeof value === 'boolean') return value\n if (value === 'true') return true\n if (value === 'false') return false\n return undefined\n}\n\nfunction coerceNumber(\n schema: AiPropSchema,\n value: unknown,\n): number | undefined {\n const parsed =\n typeof value === 'number'\n ? value\n : typeof value === 'string' && value.trim() !== ''\n ? Number(value)\n : NaN\n if (!Number.isFinite(parsed)) return undefined\n if (schema.type === 'integer' && !Number.isInteger(parsed)) return undefined\n if (schema.minimum !== undefined && parsed < schema.minimum) return undefined\n if (schema.maximum !== undefined && parsed > schema.maximum) return undefined\n return parsed\n}\n\nfunction textLimitFor(\n entry: AiPaletteEntry,\n name: string,\n props: Record<string, unknown>,\n): number {\n const declared = entry.textLimits[name]\n // A heading's copy is held to the headline ceiling, decided by the variant\n // the same node carries; anything else keeps the ceiling the palette\n // assigned to the prop.\n if (name === 'children' && isHeadlineVariant(props.variant)) {\n return Math.min(declared ?? AI_TEXT_LIMITS.body, AI_TEXT_LIMITS.headline)\n }\n return declared ?? AI_TEXT_LIMITS.body\n}\n\n/**\n * One string prop against its role. Returns the value to store, or\n * `undefined` with the reason pushed to `repairs`. A binding token the\n * caller admitted passes a `url` or `media` role whole.\n */\nfunction sanitizeString(\n nodeId: string,\n entry: AiPaletteEntry,\n name: string,\n schema: AiPropSchema,\n raw: string,\n props: Record<string, unknown>,\n screenIds: Set<string> | null,\n assetIds: Set<string> | null,\n repairs: string[],\n bindingTokens: ReadonlySet<string> | null = null,\n): string | undefined {\n let value = raw.trim()\n if (HOSTILE_TEXT.test(value)) {\n repairs.push(`${nodeId}.${name} carried markup or script; dropped`)\n return undefined\n }\n // An icon is drawn from the path its picker stores beside the id, which a\n // model can never supply, so an icon a model names draws nothing where the\n // page is published (AGL-3054). The site owner picks it.\n if (entry.propFields[name] === ICON_PICKER_FIELD) {\n repairs.push(`${nodeId}.${name} is an icon, which the site owner picks from the library; dropped`)\n return undefined\n }\n const role = entry.propRoles[name]\n switch (role) {\n case 'text': {\n const limit = textLimitFor(entry, name, props)\n if (value.length > limit) {\n value = value.slice(0, limit).trimEnd()\n repairs.push(\n `${nodeId}.${name} was over ${limit} characters; truncated`,\n )\n }\n break\n }\n case 'url': {\n if (bindingTokens?.has(value)) break\n if (!isHttpsUrl(value) && !isRootRelativePath(value)) {\n repairs.push(\n `${nodeId}.${name} is neither an https: URL nor a path on this site; dropped`,\n )\n return undefined\n }\n break\n }\n case 'screen': {\n if (screenIds ? !screenIds.has(value) : !SCREEN_ID.test(value)) {\n repairs.push(\n `${nodeId}.${name} names a screen this site does not have; dropped`,\n )\n return undefined\n }\n break\n }\n case 'media': {\n if (bindingTokens?.has(value)) break\n if (isHttpsUrl(value)) break\n const ref = parseMediaRef(value)\n if (!ref || (assetIds && !assetIds.has(ref.mediaId))) {\n repairs.push(\n `${nodeId}.${name} is neither a media reference this site holds nor an https: URL; dropped`,\n )\n return undefined\n }\n break\n }\n default: {\n if (value.length > PLAIN_STRING_MAX) {\n repairs.push(\n `${nodeId}.${name} is over ${PLAIN_STRING_MAX} characters; dropped`,\n )\n return undefined\n }\n }\n }\n if (schema.pattern && !new RegExp(schema.pattern).test(value)) {\n repairs.push(`${nodeId}.${name} does not match its pattern; dropped`)\n return undefined\n }\n if (schema.minLength !== undefined && value.length < schema.minLength) {\n repairs.push(\n `${nodeId}.${name} is shorter than ${schema.minLength} characters; dropped`,\n )\n return undefined\n }\n if (schema.maxLength !== undefined && value.length > schema.maxLength) {\n value = value.slice(0, schema.maxLength).trimEnd()\n repairs.push(\n `${nodeId}.${name} was over ${schema.maxLength} characters; truncated`,\n )\n }\n return value\n}\n\n/**\n * The element's own declarations plus the node capabilities every element\n * carries (AGL-3156) — repeating, today. Two shapes only, so they are built\n * once each rather than per node: a capability prop is the same on every\n * element with the same child contract.\n *\n * The element wins a name collision. A component that declared a prop of its\n * own under a capability's name would be describing its own attribute, and the\n * validator has to hold it to that.\n */\nconst CAPABLE_ENTRIES = new WeakMap<AiPaletteEntry, AiPaletteEntry>()\n\nfunction withNodeCapabilities(entry: AiPaletteEntry): AiPaletteEntry {\n const cached = CAPABLE_ENTRIES.get(entry)\n if (cached) return cached\n const capability = nodeCapabilityProps(\n AI_NODE_CAPABILITIES,\n entry.acceptsChildren,\n )\n const merged: AiPaletteEntry = {\n ...entry,\n propsSchema: {\n ...entry.propsSchema,\n properties: {\n ...capability.properties,\n ...entry.propsSchema.properties,\n },\n },\n propRoles: { ...capability.propRoles, ...entry.propRoles },\n textLimits: { ...capability.textLimits, ...entry.textLimits },\n }\n CAPABLE_ENTRIES.set(entry, merged)\n return merged\n}\n\nfunction sanitizeProps(\n nodeId: string,\n paletteEntry: AiPaletteEntry,\n raw: unknown,\n screenIds: Set<string> | null,\n assetIds: Set<string> | null,\n repairs: string[],\n bindingTokens: ReadonlySet<string> | null = null,\n): { props: Record<string, unknown> } | { missing: string } {\n const entry = withNodeCapabilities(paletteEntry)\n const source = isRecord(raw) ? raw : {}\n const props: Record<string, unknown> = {}\n const declared = entry.propsSchema.properties\n for (const [name, value] of Object.entries(source)) {\n // `sx` is read off the node instead; a model that put it here meant the\n // same thing, and the caller has already moved it.\n if (name === 'sx' || value === undefined || value === null) continue\n const schema = declared[name]\n if (!schema) {\n repairs.push(\n `${nodeId}.${name} is not a prop of ${entry.displayName}; dropped`,\n )\n continue\n }\n if (schema.enum) {\n const coerced = coerceEnum(schema, value)\n if (coerced === undefined) {\n repairs.push(\n `${nodeId}.${name} is not one of ${schema.enum.join('|')}; dropped`,\n )\n continue\n }\n if (coerced !== value) {\n repairs.push(\n `${nodeId}.${name} was spelled \"${String(value)}\"; normalized to \"${coerced}\"`,\n )\n }\n props[name] = coerced\n continue\n }\n switch (schema.type) {\n case 'boolean': {\n const coerced = coerceBoolean(value)\n if (coerced === undefined) {\n repairs.push(`${nodeId}.${name} is not a boolean; dropped`)\n continue\n }\n props[name] = coerced\n break\n }\n case 'number':\n case 'integer': {\n const coerced = coerceNumber(schema, value)\n if (coerced === undefined) {\n repairs.push(`${nodeId}.${name} is not a number in range; dropped`)\n continue\n }\n props[name] = coerced\n break\n }\n default: {\n const text =\n typeof value === 'string'\n ? value\n : typeof value === 'number' || typeof value === 'boolean'\n ? String(value)\n : undefined\n if (text === undefined) {\n repairs.push(`${nodeId}.${name} is not text; dropped`)\n continue\n }\n const cleaned = sanitizeString(\n nodeId,\n entry,\n name,\n schema,\n text,\n source,\n screenIds,\n assetIds,\n repairs,\n bindingTokens,\n )\n if (cleaned === undefined) continue\n props[name] = cleaned\n }\n }\n }\n for (const name of entry.propsSchema.required) {\n if (props[name] === undefined) return { missing: name }\n }\n return { props }\n}\n\n/** Surfaces that compose page elements, and so may place a component instance. */\nconst INSTANCE_SURFACES: ReadonlySet<AiSurface> = new Set([\n 'screen',\n 'layout',\n 'component',\n])\n\nconst FORM_COMPONENT_ID = 'form'\n\n/** The instance prop naming the component it places; stored on every instance node. */\nexport const AI_INSTANCE_REF_PROP = 'refId'\n\ninterface ReferenceSets {\n componentIds: Set<string> | null\n componentProps: Record<string, AiComponentPropTypes>\n formIds: Set<string> | null\n datasetIds: Set<string> | null\n assetIds: Set<string> | null\n /** The tree defines a reusable component, which may hand its own property tokens on. */\n definesComponent: boolean\n}\n\n/**\n * One value an instance fills in for a declared prop, held to what the\n * declaration's type can hold: a picture from the library, a link, a number,\n * a switch, or copy.\n */\nfunction instancePropValue(\n nodeId: string,\n name: string,\n type: string,\n raw: unknown,\n assetIds: Set<string> | null,\n repairs: string[],\n): unknown {\n if (type === 'number') {\n const parsed = typeof raw === 'number' ? raw : Number(raw)\n if (raw === '' || !Number.isFinite(parsed)) {\n repairs.push(`${nodeId}.propValues.${name} is not a number; dropped`)\n return undefined\n }\n return parsed\n }\n if (type === 'boolean') {\n const coerced = coerceBoolean(raw)\n if (coerced === undefined) {\n repairs.push(`${nodeId}.propValues.${name} is not a boolean; dropped`)\n }\n return coerced\n }\n if (type === 'icon') {\n // A page cannot fill an icon: the pick is an id and the path drawn from\n // it, and a word in its place draws nothing (AGL-3054). The property is\n // left for the site owner to pick.\n repairs.push(`${nodeId}.propValues.${name} is an icon, which the site owner picks from the library; dropped`)\n return undefined\n }\n if (typeof raw !== 'string' && typeof raw !== 'number' && typeof raw !== 'boolean') {\n repairs.push(`${nodeId}.propValues.${name} is not a value; dropped`)\n return undefined\n }\n const value = String(raw).trim()\n if (HOSTILE_TEXT.test(value)) {\n repairs.push(`${nodeId}.propValues.${name} carried markup or script; dropped`)\n return undefined\n }\n if (type === 'image') {\n if (isHttpsUrl(value)) return value\n const ref = parseMediaRef(value)\n if (!ref || (assetIds && !assetIds.has(ref.mediaId))) {\n repairs.push(\n `${nodeId}.propValues.${name} is neither a media reference this site holds nor an https: URL; dropped`,\n )\n return undefined\n }\n return value\n }\n if (type === 'href') {\n if (isHttpsUrl(value) || isRootRelativePath(value)) return value\n repairs.push(\n `${nodeId}.propValues.${name} is neither an https: URL nor a path on this site; dropped`,\n )\n return undefined\n }\n if (value.length > AI_TEXT_LIMITS.body) {\n repairs.push(\n `${nodeId}.propValues.${name} was over ${AI_TEXT_LIMITS.body} characters; truncated`,\n )\n return value.slice(0, AI_TEXT_LIMITS.body).trimEnd()\n }\n return value\n}\n\n/**\n * The site-record props of one node — an instance's `refId` and\n * `propValues`, a Form's `formId` and `datasetId` — checked against the ids\n * the caller supplied. They leave `props` before the palette pass, which\n * would drop them as undeclared, and come back in `kept` once checked.\n */\nfunction sanitizeReferenceProps(\n nodeId: string,\n componentId: string,\n props: Record<string, unknown>,\n refs: ReferenceSets,\n repairs: string[],\n): { props: Record<string, unknown>; kept: Record<string, unknown> } | { refusal: string } {\n const rest: Record<string, unknown> = { ...props }\n const kept: Record<string, unknown> = {}\n if (componentId === REUSABLE_INSTANCE_COMPONENT_ID) {\n const refId = typeof rest[AI_INSTANCE_REF_PROP] === 'string' ? String(rest[AI_INSTANCE_REF_PROP]).trim() : ''\n delete rest[AI_INSTANCE_REF_PROP]\n if (!refId || !refs.componentIds?.has(refId)) {\n return {\n refusal: `Reusable Component (${nodeId}) names a component this site does not have`,\n }\n }\n kept[AI_INSTANCE_REF_PROP] = refId\n const rawValues = rest[REUSABLE_INSTANCE_PROP_VALUES_KEY]\n delete rest[REUSABLE_INSTANCE_PROP_VALUES_KEY]\n if (rawValues !== undefined && !isRecord(rawValues)) {\n repairs.push(`${nodeId}.propValues is not an object; dropped`)\n }\n const declared = refs.componentProps[refId]\n const values: Record<string, unknown> = {}\n for (const [name, raw] of Object.entries(isRecord(rawValues) ? rawValues : {})) {\n if (raw === undefined || raw === null) continue\n if (!COMPONENT_PROP_NAME_PATTERN.test(name)) {\n repairs.push(`${nodeId}.propValues.${name} is not a prop name; dropped`)\n continue\n }\n if (declared && !(name in declared)) {\n repairs.push(`${nodeId}.propValues.${name} is not a prop of that component; dropped`)\n continue\n }\n if (refs.definesComponent && isAiComponentPropToken(raw)) {\n // A property of the component being defined, handed on whole; the\n // component step's check holds it to the kind this prop declares.\n values[name] = raw.trim()\n continue\n }\n const value = instancePropValue(\n nodeId,\n name,\n declared?.[name] ?? 'text',\n raw,\n refs.assetIds,\n repairs,\n )\n if (value !== undefined) values[name] = value\n }\n if (Object.keys(values).length) kept[REUSABLE_INSTANCE_PROP_VALUES_KEY] = values\n return { props: rest, kept }\n }\n if (componentId === FORM_COMPONENT_ID) {\n const bindings: Array<[prop: string, ids: Set<string> | null, record: string]> = [\n ['formId', refs.formIds, 'form'],\n ['datasetId', refs.datasetIds, 'dataset'],\n ]\n for (const [prop, ids, record] of bindings) {\n const raw = rest[prop]\n delete rest[prop]\n if (raw === undefined || raw === null || raw === '') continue\n const id = typeof raw === 'string' ? raw.trim() : ''\n if (id && ids?.has(id)) {\n kept[prop] = id\n } else {\n repairs.push(`${nodeId}.${prop} names a ${record} this site does not have; dropped`)\n }\n }\n }\n return { props: rest, kept }\n}\n\nfunction refusalCode(error: string): AiNodeTreeRefusalCode {\n if (/too large/i.test(error)) return 'too-large'\n if (/cannot be published/i.test(error)) return 'component'\n return 'structure'\n}\n\n/**\n * Whether the root the model wrote is the surface's root: the canvas wrapper\n * for a document surface (which the sanitizer exempts by the same shape), or\n * the named component otherwise.\n */\nfunction rootMatches(surfaceRoot: string, componentId: unknown): boolean {\n if (surfaceRoot === 'div') {\n return componentId == null || componentId === '' || componentId === 'div'\n }\n return componentId === surfaceRoot\n}\n\nexport function validateAiNodeTree(\n input: unknown,\n surface: AiSurface,\n context?: AiNodeTreeContext,\n): AiNodeTreeResult {\n try {\n return validate(input, surface, context)\n } catch (error) {\n return {\n ok: false,\n code: 'invalid-input',\n error: `The tree could not be read: ${error instanceof Error ? error.message : String(error)}`,\n }\n }\n}\n\nexport type AiNodePatchResult =\n | {\n ok: true\n props: Record<string, unknown>\n sx: Record<string, unknown> | undefined\n repairs: string[]\n }\n | { ok: false; error: string; code: AiNodeTreeRefusalCode }\n\n/**\n * One element's prop and style patch, held to the rules `validateAiNodeTree`\n * holds an element it places — for an edit to an element already on the\n * canvas, where there is no tree to validate.\n *\n * The same passes run: unknown props dropped, enums coerced, every string\n * held to its role and screened for markup, `sx` held to the key set and the\n * value grammar. The one difference is `required`: a patch is merged over the\n * props the element already has, so a required prop the patch does not name\n * is not missing.\n */\nexport function validateAiNodePatch(\n componentId: string,\n patch: { props?: unknown; sx?: unknown },\n context?: AiNodeTreeContext,\n): AiNodePatchResult {\n const entry = AI_PALETTE[componentId]\n if (!entry) {\n return {\n ok: false,\n code: 'component',\n error: `Component \"${componentId}\" is not in the palette`,\n }\n }\n const repairs: string[] = []\n const props = sanitizeProps(\n componentId,\n { ...entry, propsSchema: { ...entry.propsSchema, required: [] } },\n patch.props,\n context?.screenIds ? new Set(context.screenIds) : null,\n context?.assetIds ? new Set(context.assetIds) : null,\n repairs,\n )\n const sx =\n patch.sx === undefined ? undefined : sanitizeSx(componentId, patch.sx, repairs)\n return {\n ok: true,\n props: 'props' in props ? props.props : {},\n sx,\n repairs,\n }\n}\n\nfunction validate(\n input: unknown,\n surface: AiSurface,\n context: AiNodeTreeContext | undefined,\n): AiNodeTreeResult {\n const definition = AI_SURFACES[surface]\n if (!definition) {\n return {\n ok: false,\n code: 'invalid-input',\n error: `Unknown surface \"${surface}\"`,\n }\n }\n if (\n !isRecord(input) ||\n typeof input.rootId !== 'string' ||\n !isRecord(input.nodes)\n ) {\n return {\n ok: false,\n code: 'invalid-input',\n error: 'Expected an object with a string rootId and a nodes map',\n }\n }\n const rootId = input.rootId\n const nodes = input.nodes as Record<string, unknown>\n const root = nodes[rootId]\n if (!isRecord(root)) {\n return {\n ok: false,\n code: 'structure',\n error: 'Definition has no root node',\n }\n }\n if (!rootMatches(definition.root, root.componentId)) {\n return {\n ok: false,\n code: 'root',\n error: `A ${surface} starts with ${definition.root === 'div' ? 'the document wrapper' : `\"${definition.root}\"`}, not \"${String(root.componentId)}\"`,\n }\n }\n\n // The sanitizer keeps only the persisted node keys, and `sx` is not one of\n // them for a listing. Read it off every node first — from the node field\n // or from `props.sx`, which a model writes just as readily — and put it\n // back, checked, on the nodes that survive.\n const sxByNodeId = new Map<string, unknown>()\n const hiddenByNodeId = new Set<string>()\n for (const [id, node] of Object.entries(nodes)) {\n if (!isRecord(node)) continue\n const sx =\n node.sx !== undefined\n ? node.sx\n : isRecord(node.props)\n ? node.props.sx\n : undefined\n if (sx !== undefined) sxByNodeId.set(id, sx)\n if (node.hidden === true) hiddenByNodeId.add(id)\n }\n\n // A DAM reference (a `media:` value) is not a URL the sanitizer's\n // `src` policy admits — a listing must not carry another tenant's asset —\n // but on the tenant's own page it is exactly what an image should name.\n // Lift those values out before sanitizing and hand them back to the prop\n // pass, which holds them to the asset set the caller supplied.\n // A binding token the caller admitted (AGL-2909) is lifted the same way:\n // `{{entry.coverImage}}` is no address the sanitizer knows, and the prop\n // pass holds it to the tokens the caller named.\n const bindingTokens = context?.bindingTokens ? new Set(context.bindingTokens) : null\n // A reusable component's own property tokens (AGL-2908) are lifted too, and\n // kept as written rather than handed back to the prop pass: `{{prop.variant}}`\n // is no value a dropdown, a switch, an address or a visibility directive\n // admits. Copy keeps its tokens without lifting, as the text they are.\n const definesComponent = context?.definesComponent === true\n const mediaByNodeId = new Map<string, Record<string, string>>()\n const boundByNodeId = new Map<string, Record<string, string>>()\n const forSanitizer: Record<string, unknown> = {}\n for (const [id, node] of Object.entries(nodes)) {\n if (!isRecord(node) || !isRecord(node.props)) {\n forSanitizer[id] = node\n continue\n }\n const entry = AI_PALETTE[String(node.componentId)]\n const roles = entry?.propRoles ?? {}\n const props: Record<string, unknown> = { ...node.props }\n const lifted: Record<string, string> = {}\n const bound: Record<string, string> = {}\n for (const [key, value] of Object.entries(props)) {\n if (typeof value !== 'string') continue\n const role = roles[key]\n if (\n definesComponent &&\n isAiComponentPropToken(value) &&\n (AI_COMPONENT_VISIBILITY_PROPS.includes(key) ||\n (entry?.propsSchema.properties[key] !== undefined && role !== 'text'))\n ) {\n bound[key] = value.trim()\n delete props[key]\n continue\n }\n if (\n (role === 'media' && parseMediaRef(value.trim())) ||\n ((role === 'media' || role === 'url') && bindingTokens?.has(value.trim()))\n ) {\n lifted[key] = value\n delete props[key]\n }\n }\n if (Object.keys(lifted).length) mediaByNodeId.set(id, lifted)\n if (Object.keys(bound).length) boundByNodeId.set(id, bound)\n forSanitizer[id] = { ...node, props }\n }\n\n const refs: ReferenceSets = {\n componentIds: context?.componentIds ? new Set(context.componentIds) : null,\n componentProps: context?.componentProps ?? {},\n formIds: context?.formIds ? new Set(context.formIds) : null,\n datasetIds: context?.datasetIds ? new Set(context.datasetIds) : null,\n assetIds: context?.assetIds ? new Set(context.assetIds) : null,\n definesComponent,\n }\n // An instance is admitted only where the caller grounded it in the site's\n // components; the reference itself is checked on the node below.\n const allow =\n refs.componentIds && INSTANCE_SURFACES.has(surface)\n ? [...definition.allow, REUSABLE_INSTANCE_COMPONENT_ID]\n : definition.allow\n const sanitized = sanitizeMarketplaceDefinition(\n { rootId, nodes: forSanitizer },\n { componentIds: allow },\n )\n if (sanitized.ok === false) {\n return {\n ok: false,\n code: refusalCode(sanitized.error),\n error: sanitized.error,\n }\n }\n\n const screenIds = context?.screenIds ? new Set(context.screenIds) : null\n const assetIds = refs.assetIds\n const repairs: string[] = []\n const output: NodesMap = {}\n const rootIsWrapper =\n rootMatches('div', root.componentId) && definition.root === 'div'\n const minted = new Map<string, string>()\n const mint = (id: string): string => {\n const fresh =\n id === rootId && rootIsWrapper\n ? CANVAS_ROOT_ELEMENT_ID\n : createIdUrlSafe()\n minted.set(id, fresh)\n return fresh\n }\n\n /** Each visited node's parent by the model's own ids, for the parentId check. */\n const parentOf = new Map<string, string>()\n const queue: Array<{ id: string; parentId: string | null }> = [\n { id: rootId, parentId: null },\n ]\n mint(rootId)\n while (queue.length) {\n const { id, parentId } = queue.shift() as {\n id: string\n parentId: string | null\n }\n const node = sanitized.nodes[id]\n const entry = AI_PALETTE[node.componentId]\n if (!entry) {\n return {\n ok: false,\n code: 'component',\n error: `Component \"${node.componentId}\" is not in the palette`,\n }\n }\n const newId = minted.get(id) as string\n const raw = nodes[id]\n if (isRecord(raw)) {\n // The sanitizer drops silently; the model is told what went.\n for (const key of STRIPPED_NODE_KEYS) {\n if (raw[key] !== undefined) {\n repairs.push(\n `${id}.${key} is not something a generated node may set; dropped`,\n )\n }\n }\n if (raw.hidden !== undefined && typeof raw.hidden !== 'boolean') {\n repairs.push(`${id}.hidden is not a boolean; dropped`)\n }\n if (raw.nodes !== undefined && !Array.isArray(raw.nodes)) {\n repairs.push(\n `${id}.nodes is not a list of child ids; its children were dropped`,\n )\n }\n if (\n raw.parentId !== undefined &&\n raw.parentId !== null &&\n raw.parentId !== (parentId === null ? null : parentOf.get(id))\n ) {\n repairs.push(\n `${id}.parentId disagreed with where the tree places it; recomputed`,\n )\n }\n if (isRecord(raw.props)) {\n const lifted = mediaByNodeId.get(id) ?? {}\n const kept = boundByNodeId.get(id) ?? {}\n for (const key of Object.keys(raw.props)) {\n if (\n key !== 'sx' &&\n lifted[key] === undefined &&\n kept[key] === undefined &&\n node.props?.[key] === undefined &&\n raw.props[key] !== undefined\n ) {\n repairs.push(\n `${id}.${key} was an unsafe handler, address or markup; dropped`,\n )\n }\n }\n }\n }\n const children: string[] = []\n for (const childId of node.nodes ?? []) {\n if (minted.has(childId)) {\n repairs.push(\n `${childId} was listed under more than one parent; the later listing was dropped`,\n )\n continue\n }\n const child = sanitized.nodes[childId]\n if (!child) continue\n const childEntry = AI_PALETTE[child.componentId]\n if (!childEntry) {\n return {\n ok: false,\n code: 'component',\n error: `Component \"${child.componentId}\" is not in the palette`,\n }\n }\n if (!entry.acceptsChildren) {\n return {\n ok: false,\n code: 'lineage',\n error: `${entry.displayName} (${id}) cannot hold other elements, but lists ${childId}`,\n }\n }\n if (\n !linealRelationshipPermits(\n {\n componentId: child.componentId,\n pluginId: childEntry.pluginId,\n restrictParent: childEntry.restrictParent,\n },\n {\n componentId: node.componentId,\n pluginId: entry.pluginId,\n restrictChildren: entry.restrictChildren,\n },\n )\n ) {\n return {\n ok: false,\n code: 'lineage',\n error: `${childEntry.displayName} (${childId}) cannot be placed inside ${entry.displayName} (${id})`,\n }\n }\n children.push(mint(childId))\n parentOf.set(childId, id)\n queue.push({ id: childId, parentId: newId })\n }\n\n const reference = sanitizeReferenceProps(\n id,\n node.componentId,\n { ...node.props, ...mediaByNodeId.get(id) },\n refs,\n repairs,\n )\n if ('refusal' in reference) {\n return { ok: false, code: 'reference', error: reference.refusal }\n }\n // A required prop the component binds is present: its value is the token.\n const boundProps = boundByNodeId.get(id)\n const propsResult = sanitizeProps(\n id,\n boundProps\n ? {\n ...entry,\n propsSchema: {\n ...entry.propsSchema,\n required: entry.propsSchema.required.filter((name) => boundProps[name] === undefined),\n },\n }\n : entry,\n reference.props,\n screenIds,\n assetIds,\n repairs,\n bindingTokens,\n )\n if ('missing' in propsResult) {\n return {\n ok: false,\n code: 'required-prop',\n error: `${entry.displayName} (${id}) is missing its required \"${propsResult.missing}\" prop`,\n }\n }\n const sx = sanitizeSx(id, sxByNodeId.get(id), repairs)\n output[newId] = {\n $id: newId,\n type: NodeType.NODE,\n componentId: node.componentId,\n pluginId: entry.pluginId,\n parentId,\n nodes: children,\n props: { ...propsResult.props, ...reference.kept, ...boundProps },\n ...(sx ? { sx } : {}),\n ...(hiddenByNodeId.has(id) ? { hidden: true } : {}),\n }\n }\n\n // The save's own measurement (msgpack), not a JSON string length: the\n // ceiling is stated in those bytes, and a UTF-16 length reads multi-byte\n // copy as smaller than the document the save will refuse.\n const bytes = nodeMapBytes(output)\n if (bytes > NODE_MAP_MAX_BYTES) {\n return {\n ok: false,\n code: 'too-large',\n error: `The tree is ${bytes} bytes; the stored ceiling is ${NODE_MAP_MAX_BYTES}`,\n }\n }\n const sourceIds: Record<string, string> = {}\n for (const [source, fresh] of minted) sourceIds[fresh] = source\n return {\n ok: true,\n rootId: minted.get(rootId) as string,\n nodes: output,\n repairs,\n sourceIds,\n }\n}\n"],"names":["AI_TEXT_LIMITS","isHeadlineVariant","nodeCapabilityProps","AI_NODE_CAPABILITIES","AI_PALETTE","AI_SURFACES","AI_SX_TOKENS","linealRelationshipPermits","NODE_MAP_MAX_BYTES","nodeMapBytes","parseMediaRef","COMPONENT_PROP_NAME_PATTERN","REUSABLE_INSTANCE_COMPONENT_ID","REUSABLE_INSTANCE_PROP_VALUES_KEY","createIdUrlSafe","CANVAS_ROOT_ELEMENT_ID","NodeType","AI_COMPONENT_VISIBILITY_PROPS","isAiComponentPropToken","sanitizeMarketplaceDefinition","AI_SX_ALLOWED_KEYS","Set","HOSTILE_TEXT","SX_VALUE","STRIPPED_NODE_KEYS","SCREEN_ID","ICON_PICKER_FIELD","MAX_SX_KEYS","PLAIN_STRING_MAX","paletteTokens","palette","breakpoints","typographyVariants","isRecord","value","Array","isArray","isHttpsUrl","test","URL","protocol","isRootRelativePath","sxValueAllowed","key","Number","isFinite","trimmed","trim","has","sanitizeSx","nodeId","sx","repairs","undefined","push","out","kept","Object","entries","responsive","breakpoint","inner","keys","length","coerceEnum","schema","enum","wanted","toLowerCase","find","option","coerceBoolean","coerceNumber","parsed","NaN","type","isInteger","minimum","maximum","textLimitFor","entry","name","props","declared","textLimits","variant","Math","min","body","headline","sanitizeString","raw","screenIds","assetIds","bindingTokens","propFields","role","propRoles","limit","slice","trimEnd","ref","mediaId","pattern","RegExp","minLength","maxLength","CAPABLE_ENTRIES","WeakMap","withNodeCapabilities","cached","get","capability","acceptsChildren","merged","propsSchema","properties","set","sanitizeProps","paletteEntry","source","displayName","coerced","join","String","text","cleaned","required","missing","INSTANCE_SURFACES","FORM_COMPONENT_ID","AI_INSTANCE_REF_PROP","instancePropValue","sanitizeReferenceProps","componentId","refs","rest","refId","componentIds","refusal","rawValues","componentProps","values","definesComponent","bindings","formIds","datasetIds","prop","ids","record","id","refusalCode","error","rootMatches","surfaceRoot","validateAiNodeTree","input","surface","context","validate","ok","code","Error","message","validateAiNodePatch","patch","definition","rootId","nodes","root","sxByNodeId","Map","hiddenByNodeId","node","hidden","add","mediaByNodeId","boundByNodeId","forSanitizer","roles","lifted","bound","includes","allow","sanitized","output","rootIsWrapper","minted","mint","fresh","parentOf","queue","parentId","shift","newId","children","childId","child","childEntry","pluginId","restrictParent","restrictChildren","reference","boundProps","propsResult","filter","$id","NODE","bytes","sourceIds"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,SACEA,cAAc,EACdC,iBAAiB,EACjBC,mBAAmB,QAId,kBAAc;AACrB,SACEC,oBAAoB,EACpBC,UAAU,EACVC,WAAW,EACXC,YAAY,QACP,4BAAwB;AAC/B,SAASC,yBAAyB,QAAQ,sCAAqC;AAC/E,SACEC,kBAAkB,EAClBC,YAAY,QACP,0CAAyC;AAChD,SAASC,aAAa,QAAQ,mCAAkC;AAChE,SACEC,2BAA2B,EAC3BC,8BAA8B,EAC9BC,iCAAiC,QAC5B,iDAAgD;AACvD,SAASC,eAAe,QAAQ,wCAAuC;AACvE,SAASC,sBAAsB,QAAQ,2CAA0C;AACjF,SAASC,QAAQ,QAAuB,2BAA0B;AAElE,SACEC,6BAA6B,EAC7BC,sBAAsB,QACjB,6BAAyB;AAEhC,SAASC,6BAA6B,QAAQ,mDAAkD;AAiHhG;;;;;CAKC,GACD,OAAO,MAAMC,qBAA0C,IAAIC,IAAI;IAC7D,UAAU;IACV;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,QAAQ;IACR;IACA;IACA;IACA;IACA;IACA,aAAa;IACb;IACA;IACA;IACA;IACA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,CAAC;YAC7F;QACF;QACA,MAAM7E,KAAKF,WAAWqG,IAAIoB,WAAW3D,GAAG,CAACuC,KAAKlG;QAC9CqI,MAAM,CAACS,MAAM,GAAG;YACdY,KAAKZ;YACLvH,MAAM3D,SAAS+L,IAAI;YACnBzE,aAAauC,KAAKvC,WAAW;YAC7BiE,UAAUvH,MAAMuH,QAAQ;YACxBP;YACAxB,OAAO2B;YACPjH,OAAO,aAAK0H,YAAY1H,KAAK,EAAKwH,UAAUlJ,IAAI,EAAKmJ;WACjDxJ,KAAK;YAAEA;QAAG,IAAI,CAAC,GACfyH,eAAe5H,GAAG,CAACsG,MAAM;YAAEwB,QAAQ;QAAK,IAAI,CAAC;IAErD;IAEA,sEAAsE;IACtE,yEAAyE;IACzE,0DAA0D;IAC1D,MAAMkC,QAAQvM,aAAagL;IAC3B,IAAIuB,QAAQxM,oBAAoB;QAC9B,OAAO;YACLwJ,IAAI;YACJC,MAAM;YACNT,OAAO,CAAC,YAAY,EAAEwD,MAAM,8BAA8B,EAAExM,oBAAoB;QAClF;IACF;IACA,MAAMyM,YAAoC,CAAC;IAC3C,KAAK,MAAM,CAACzF,QAAQqE,MAAM,IAAIF,OAAQsB,SAAS,CAACpB,MAAM,GAAGrE;IACzD,OAAO;QACLwC,IAAI;QACJO,QAAQoB,OAAO5E,GAAG,CAACwD;QACnBC,OAAOiB;QACPrI;QACA6J;IACF;AACF"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { type NodeInteraction } from '@aglyn/aglyn/app-utils/node-interactions';
18
+ /**
19
+ * A link to a section of the same page (AGL-3097).
20
+ *
21
+ * A call to action often belongs on the page it is on: a hero's "Request a
22
+ * Consultation" takes the visitor to the consultation form further down. The
23
+ * platform does that with the Scroll to element interaction (AGL-2867), never
24
+ * with an anchor: a placed element carries no id an `href` fragment could
25
+ * name, and the palette validator drops a bare fragment. A generated node may
26
+ * not write an interaction either, and when a page's first section is written
27
+ * the section it points at does not exist yet.
28
+ *
29
+ * So a page's link names a section of the page by its name in the plan, with
30
+ * `scrollTo`, or with an `href` fragment made of that name's words, and the
31
+ * page step writes the interaction for it. Every section's root id is minted
32
+ * from the job and the section's place in the plan before any is built, so
33
+ * the interaction can name its target on the pass that writes the link.
34
+ */
35
+ /** The prop a link names a section of its own page with, by the section's name in the plan. */
36
+ export declare const AI_PAGE_SCROLL_TO_PROP = "scrollTo";
37
+ /** The id of the interaction a link scrolling to a section of its page carries. */
38
+ export declare const AI_PAGE_SCROLL_INTERACTION_ID = "ai-scroll-to-section";
39
+ /**
40
+ * The section of the page a link names, by its place in the plan, or `null`
41
+ * when it names none, or more than one. A name matches a section whose name
42
+ * has the same words in any case and spacing, as "consultation-request-form"
43
+ * matches "consultation request form"; failing that, the one section whose
44
+ * name holds every word of it, as "#consultation-form" names that section. An
45
+ * `href` is read as a fragment, `#` and all.
46
+ */
47
+ export declare function aiPageLinkSection(text: string, sections: readonly string[]): number | null;
48
+ /** An `href` that is only a fragment: `#consultation-form`, and never `#` alone. */
49
+ export declare function isAiFragmentHref(value: unknown): value is string;
50
+ /** Where a written link says it goes on its own page: a section, or a name no section has. */
51
+ export type AiPageLinkTarget = {
52
+ kind: 'section';
53
+ section: number;
54
+ } | {
55
+ kind: 'unknown';
56
+ value: string;
57
+ via: 'scrollTo' | 'href';
58
+ };
59
+ /**
60
+ * Where a link node, as the model wrote it, goes on its own page: the section
61
+ * its `scrollTo` names, or else the one its `href` fragment names, by its
62
+ * place in the plan; the name it wrote when no section has it; `null` when it
63
+ * names no section of the page at all.
64
+ */
65
+ export declare function aiPageLinkTarget(written: unknown, sections: readonly string[]): AiPageLinkTarget | null;
66
+ /**
67
+ * The Scroll to element interaction a link carries to a section of its page,
68
+ * in the shape the interactions editor stores on a node: a click, every time,
69
+ * scrolling smoothly to the section's root with no offset, which are the
70
+ * editor's own defaults. The selector is the one the renderer stamps.
71
+ */
72
+ export declare function aiPageScrollInteraction(sectionRootId: string, sectionName: string): NodeInteraction;
73
+ /**
74
+ * The nodes a stored node scrolls to when it is clicked: every enabled click
75
+ * interaction's Scroll to element steps, by the ids their selectors name.
76
+ * Read only from a page as the page step stores it, where the palette
77
+ * validator has already dropped every interaction a model wrote.
78
+ */
79
+ export declare function aiStoredScrollTargets(node: unknown): string[];
@@ -0,0 +1,135 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */ import { nodeIdFromInteractionSelector, nodeInteractionSelector } from "@aglyn/aglyn/app-utils/node-interactions";
17
+ /**
18
+ * A link to a section of the same page (AGL-3097).
19
+ *
20
+ * A call to action often belongs on the page it is on: a hero's "Request a
21
+ * Consultation" takes the visitor to the consultation form further down. The
22
+ * platform does that with the Scroll to element interaction (AGL-2867), never
23
+ * with an anchor: a placed element carries no id an `href` fragment could
24
+ * name, and the palette validator drops a bare fragment. A generated node may
25
+ * not write an interaction either, and when a page's first section is written
26
+ * the section it points at does not exist yet.
27
+ *
28
+ * So a page's link names a section of the page by its name in the plan, with
29
+ * `scrollTo`, or with an `href` fragment made of that name's words, and the
30
+ * page step writes the interaction for it. Every section's root id is minted
31
+ * from the job and the section's place in the plan before any is built, so
32
+ * the interaction can name its target on the pass that writes the link.
33
+ */ /** The prop a link names a section of its own page with, by the section's name in the plan. */ export const AI_PAGE_SCROLL_TO_PROP = 'scrollTo';
34
+ /** The id of the interaction a link scrolling to a section of its page carries. */ export const AI_PAGE_SCROLL_INTERACTION_ID = 'ai-scroll-to-section';
35
+ /** The words of a name or an anchor, as they are compared: lowercase, letters and digits. */ function wordsOf(text) {
36
+ return text.toLowerCase().split(RegExp("[^\\u0041-\\u005A\\u0061-\\u007A\\u00AA\\u00B5\\u00BA\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376-\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0560-\\u0588\\u05D0-\\u05EA\\u05EF-\\u05F2\\u0620-\\u064A\\u066E-\\u066F\\u0671-\\u06D3\\u06D5\\u06E5-\\u06E6\\u06EE-\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4-\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u0860-\\u086A\\u0870-\\u0887\\u0889-\\u088F\\u08A0-\\u08C9\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F-\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC-\\u09DD\\u09DF-\\u09E1\\u09F0-\\u09F1\\u09FC\\u0A05-\\u0A0A\\u0A0F-\\u0A10\\u0A13-\\u0A28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C-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065-\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F5\\u13F8-\\u13FD\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16F1-\\u16F8\\u1700-\\u1711\\u171F-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1878\\u1880-\\u1884\\u1887-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4C\\u1B83-\\u1BA0\\u1BAE-\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1C80-\\u1C8A\\u1C90-\\u1CBA\\u1CBD-\\u1CBF\\u1CE9-\\u1CEC\\u1CEE-\\u1CF3\\u1CF5-\\u1CF6\\u1CFA\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2183-\\u2184\\u2C00-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3006\\u3031-\\u3035\\u303B-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312F\\u3131-\\u318E\\u31A0-\\u31BF\\u31F0-\\u31FF\\u3400-\\u4DBF\\u4E00-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A-\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6E5\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA7DC\\uA7F1-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA8FD-\\uA8FE\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5-\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB69\\uAB70-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40-\\uFB41\\uFB43-\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC\\u{10000}-\\u{1000B}\\u{1000D}-\\u{10026}\\u{10028}-\\u{1003A}\\u{1003C}-\\u{1003D}\\u{1003F}-\\u{1004D}\\u{10050}-\\u{1005D}\\u{10080}-\\u{100FA}\\u{10280}-\\u{1029C}\\u{102A0}-\\u{102D0}\\u{10300}-\\u{1031F}\\u{1032D}-\\u{10340}\\u{10342}-\\u{10349}\\u{10350}-\\u{10375}\\u{10380}-\\u{1039D}\\u{103A0}-\\u{103C3}\\u{103C8}-\\u{103CF}\\u{10400}-\\u{1049D}\\u{104B0}-\\u{104D3}\\u{104D8}-\\u{104FB}\\u{10500}-\\u{10527}\\u{10530}-\\u{10563}\\u{10570}-\\u{1057A}\\u{1057C}-\\u{1058A}\\u{1058C}-\\u{10592}\\u{10594}-\\u{10595}\\u{10597}-\\u{105A1}\\u{105A3}-\\u{105B1}\\u{105B3}-\\u{105B9}\\u{105BB}-\\u{105BC}\\u{105C0}-\\u{105F3}\\u{10600}-\\u{10736}\\u{10740}-\\u{10755}\\u{10760}-\\u{10767}\\u{10780}-\\u{10785}\\u{10787}-\\u{107B0}\\u{107B2}-\\u{107BA}\\u{10800}-\\u{10805}\\u{10808}\\u{1080A}-\\u{10835}\\u{10837}-\\u{10838}\\u{1083C}\\u{1083F}-\\u{10855}\\u{10860}-\\u{10876}\\u{10880}-\\u{1089E}\\u{108E0}-\\u{108F2}\\u{108F4}-\\u{108F5}\\u{10900}-\\u{10915}\\u{10920}-\\u{10939}\\u{10940}-\\u{10959}\\u{10980}-\\u{109B7}\\u{109BE}-\\u{109BF}\\u{10A00}\\u{10A10}-\\u{10A13}\\u{10A15}-\\u{10A17}\\u{10A19}-\\u{10A35}\\u{10A60}-\\u{10A7C}\\u{10A80}-\\u{10A9C}\\u{10AC0}-\\u{10AC7}\\u{10AC9}-\\u{10AE4}\\u{10B00}-\\u{10B35}\\u{10B40}-\\u{10B55}\\u{10B60}-\\u{10B72}\\u{10B80}-\\u{10B91}\\u{10C00}-\\u{10C48}\\u{10C80}-\\u{10CB2}\\u{10CC0}-\\u{10CF2}\\u{10D00}-\\u{10D23}\\u{10D4A}-\\u{10D65}\\u{10D6F}-\\u{10D85}\\u{10E80}-\\u{10EA9}\\u{10EB0}-\\u{10EB1}\\u{10EC2}-\\u{10EC7}\\u{10F00}-\\u{10F1C}\\u{10F27}\\u{10F30}-\\u{10F45}\\u{10F70}-\\u{10F81}\\u{10FB0}-\\u{10FC4}\\u{10FE0}-\\u{10FF6}\\u{11003}-\\u{11037}\\u{11071}-\\u{11072}\\u{11075}\\u{11083}-\\u{110AF}\\u{110D0}-\\u{110E8}\\u{11103}-\\u{11126}\\u{11144}\\u{11147}\\u{11150}-\\u{11172}\\u{11176}\\u{11183}-\\u{111B2}\\u{111C1}-\\u{111C4}\\u{111DA}\\u{111DC}\\u{11200}-\\u{11211}\\u{11213}-\\u{1122B}\\u{1123F}-\\u{11240}\\u{11280}-\\u{11286}\\u{11288}\\u{1128A}-\\u{1128D}\\u{1128F}-\\u{1129D}\\u{1129F}-\\u{112A8}\\u{112B0}-\\u{112DE}\\u{11305}-\\u{1130C}\\u{1130F}-\\u{11310}\\u{11313}-\\u{11328}\\u{1132A}-\\u{11330}\\u{11332}-\\u{11333}\\u{11335}-\\u{11339}\\u{1133D}\\u{11350}\\u{1135D}-\\u{11361}\\u{11380}-\\u{11389}\\u{1138B}\\u{1138E}\\u{11390}-\\u{113B5}\\u{113B7}\\u{113D1}\\u{113D3}\\u{11400}-\\u{11434}\\u{11447}-\\u{1144A}\\u{1145F}-\\u{11461}\\u{11480}-\\u{114AF}\\u{114C4}-\\u{114C5}\\u{114C7}\\u{11580}-\\u{115AE}\\u{115D8}-\\u{115DB}\\u{11600}-\\u{1162F}\\u{11644}\\u{11680}-\\u{116AA}\\u{116B8}\\u{11700}-\\u{1171A}\\u{11740}-\\u{11746}\\u{11800}-\\u{1182B}\\u{118A0}-\\u{118DF}\\u{118FF}-\\u{11906}\\u{11909}\\u{1190C}-\\u{11913}\\u{11915}-\\u{11916}\\u{11918}-\\u{1192F}\\u{1193F}\\u{11941}\\u{119A0}-\\u{119A7}\\u{119AA}-\\u{119D0}\\u{119E1}\\u{119E3}\\u{11A00}\\u{11A0B}-\\u{11A32}\\u{11A3A}\\u{11A50}\\u{11A5C}-\\u{11A89}\\u{11A9D}\\u{11AB0}-\\u{11AF8}\\u{11BC0}-\\u{11BE0}\\u{11C00}-\\u{11C08}\\u{11C0A}-\\u{11C2E}\\u{11C40}\\u{11C72}-\\u{11C8F}\\u{11D00}-\\u{11D06}\\u{11D08}-\\u{11D09}\\u{11D0B}-\\u{11D30}\\u{11D46}\\u{11D60}-\\u{11D65}\\u{11D67}-\\u{11D68}\\u{11D6A}-\\u{11D89}\\u{11D98}\\u{11DB0}-\\u{11DDB}\\u{11EE0}-\\u{11EF2}\\u{11F02}\\u{11F04}-\\u{11F10}\\u{11F12}-\\u{11F33}\\u{11FB0}\\u{12000}-\\u{12399}\\u{12480}-\\u{12543}\\u{12F90}-\\u{12FF0}\\u{13000}-\\u{1342F}\\u{13441}-\\u{13446}\\u{13460}-\\u{143FA}\\u{14400}-\\u{14646}\\u{16100}-\\u{1611D}\\u{16800}-\\u{16A38}\\u{16A40}-\\u{16A5E}\\u{16A70}-\\u{16ABE}\\u{16AD0}-\\u{16AED}\\u{16B00}-\\u{16B2F}\\u{16B40}-\\u{16B43}\\u{16B63}-\\u{16B77}\\u{16B7D}-\\u{16B8F}\\u{16D40}-\\u{16D6C}\\u{16E40}-\\u{16E7F}\\u{16EA0}-\\u{16EB8}\\u{16EBB}-\\u{16ED3}\\u{16F00}-\\u{16F4A}\\u{16F50}\\u{16F93}-\\u{16F9F}\\u{16FE0}-\\u{16FE1}\\u{16FE3}\\u{16FF2}-\\u{16FF3}\\u{17000}-\\u{18CD5}\\u{18CFF}-\\u{18D1E}\\u{18D80}-\\u{18DF2}\\u{1AFF0}-\\u{1AFF3}\\u{1AFF5}-\\u{1AFFB}\\u{1AFFD}-\\u{1AFFE}\\u{1B000}-\\u{1B122}\\u{1B132}\\u{1B150}-\\u{1B152}\\u{1B155}\\u{1B164}-\\u{1B167}\\u{1B170}-\\u{1B2FB}\\u{1BC00}-\\u{1BC6A}\\u{1BC70}-\\u{1BC7C}\\u{1BC80}-\\u{1BC88}\\u{1BC90}-\\u{1BC99}\\u{1D400}-\\u{1D454}\\u{1D456}-\\u{1D49C}\\u{1D49E}-\\u{1D49F}\\u{1D4A2}\\u{1D4A5}-\\u{1D4A6}\\u{1D4A9}-\\u{1D4AC}\\u{1D4AE}-\\u{1D4B9}\\u{1D4BB}\\u{1D4BD}-\\u{1D4C3}\\u{1D4C5}-\\u{1D505}\\u{1D507}-\\u{1D50A}\\u{1D50D}-\\u{1D514}\\u{1D516}-\\u{1D51C}\\u{1D51E}-\\u{1D539}\\u{1D53B}-\\u{1D53E}\\u{1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}-\\u{1EE6A}\\u{1EE6C}-\\u{1EE72}\\u{1EE74}-\\u{1EE77}\\u{1EE79}-\\u{1EE7C}\\u{1EE7E}\\u{1EE80}-\\u{1EE89}\\u{1EE8B}-\\u{1EE9B}\\u{1EEA1}-\\u{1EEA3}\\u{1EEA5}-\\u{1EEA9}\\u{1EEAB}-\\u{1EEBB}\\u{20000}-\\u{2A6DF}\\u{2A700}-\\u{2B81D}\\u{2B820}-\\u{2CEAD}\\u{2CEB0}-\\u{2EBE0}\\u{2EBF0}-\\u{2EE5D}\\u{2F800}-\\u{2FA1D}\\u{30000}-\\u{3134A}\\u{31350}-\\u{33479}\\u0030-\\u0039\\u00B2-\\u00B3\\u00B9\\u00BC-\\u00BE\\u0660-\\u0669\\u06F0-\\u06F9\\u07C0-\\u07C9\\u0966-\\u096F\\u09E6-\\u09EF\\u09F4-\\u09F9\\u0A66-\\u0A6F\\u0AE6-\\u0AEF\\u0B66-\\u0B6F\\u0B72-\\u0B77\\u0BE6-\\u0BF2\\u0C66-\\u0C6F\\u0C78-\\u0C7E\\u0CE6-\\u0CEF\\u0D58-\\u0D5E\\u0D66-\\u0D78\\u0DE6-\\u0DEF\\u0E50-\\u0E59\\u0ED0-\\u0ED9\\u0F20-\\u0F33\\u1040-\\u1049\\u1090-\\u1099\\u1369-\\u137C\\u16EE-\\u16F0\\u17E0-\\u17E9\\u17F0-\\u17F9\\u1810-\\u1819\\u1946-\\u194F\\u19D0-\\u19DA\\u1A80-\\u1A89\\u1A90-\\u1A99\\u1B50-\\u1B59\\u1BB0-\\u1BB9\\u1C40-\\u1C49\\u1C50-\\u1C59\\u2070\\u2074-\\u2079\\u2080-\\u2089\\u2150-\\u2182\\u2185-\\u2189\\u2460-\\u249B\\u24EA-\\u24FF\\u2776-\\u2793\\u2CFD\\u3007\\u3021-\\u3029\\u3038-\\u303A\\u3192-\\u3195\\u3220-\\u3229\\u3248-\\u324F\\u3251-\\u325F\\u3280-\\u3289\\u32B1-\\u32BF\\uA620-\\uA629\\uA6E6-\\uA6EF\\uA830-\\uA835\\uA8D0-\\uA8D9\\uA900-\\uA909\\uA9D0-\\uA9D9\\uA9F0-\\uA9F9\\uAA50-\\uAA59\\uABF0-\\uABF9\\uFF10-\\uFF19\\u{10107}-\\u{10133}\\u{10140}-\\u{10178}\\u{1018A}-\\u{1018B}\\u{102E1}-\\u{102FB}\\u{10320}-\\u{10323}\\u{10341}\\u{1034A}\\u{103D1}-\\u{103D5}\\u{104A0}-\\u{104A9}\\u{10858}-\\u{1085F}\\u{10879}-\\u{1087F}\\u{108A7}-\\u{108AF}\\u{108FB}-\\u{108FF}\\u{10916}-\\u{1091B}\\u{109BC}-\\u{109BD}\\u{109C0}-\\u{109CF}\\u{109D2}-\\u{109FF}\\u{10A40}-\\u{10A48}\\u{10A7D}-\\u{10A7E}\\u{10A9D}-\\u{10A9F}\\u{10AEB}-\\u{10AEF}\\u{10B58}-\\u{10B5F}\\u{10B78}-\\u{10B7F}\\u{10BA9}-\\u{10BAF}\\u{10CFA}-\\u{10CFF}\\u{10D30}-\\u{10D39}\\u{10D40}-\\u{10D49}\\u{10E60}-\\u{10E7E}\\u{10F1D}-\\u{10F26}\\u{10F51}-\\u{10F54}\\u{10FC5}-\\u{10FCB}\\u{11052}-\\u{1106F}\\u{110F0}-\\u{110F9}\\u{11136}-\\u{1113F}\\u{111D0}-\\u{111D9}\\u{111E1}-\\u{111F4}\\u{112F0}-\\u{112F9}\\u{11450}-\\u{11459}\\u{114D0}-\\u{114D9}\\u{11650}-\\u{11659}\\u{116C0}-\\u{116C9}\\u{116D0}-\\u{116E3}\\u{11730}-\\u{1173B}\\u{118E0}-\\u{118F2}\\u{11950}-\\u{11959}\\u{11BF0}-\\u{11BF9}\\u{11C50}-\\u{11C6C}\\u{11D50}-\\u{11D59}\\u{11DA0}-\\u{11DA9}\\u{11DE0}-\\u{11DE9}\\u{11F50}-\\u{11F59}\\u{11FC0}-\\u{11FD4}\\u{12400}-\\u{1246E}\\u{16130}-\\u{16139}\\u{16A60}-\\u{16A69}\\u{16AC0}-\\u{16AC9}\\u{16B50}-\\u{16B59}\\u{16B5B}-\\u{16B61}\\u{16D70}-\\u{16D79}\\u{16E80}-\\u{16E96}\\u{16FF4}-\\u{16FF6}\\u{1CCF0}-\\u{1CCF9}\\u{1D2C0}-\\u{1D2D3}\\u{1D2E0}-\\u{1D2F3}\\u{1D360}-\\u{1D378}\\u{1D7CE}-\\u{1D7FF}\\u{1E140}-\\u{1E149}\\u{1E2F0}-\\u{1E2F9}\\u{1E4F0}-\\u{1E4F9}\\u{1E5F1}-\\u{1E5FA}\\u{1E8C7}-\\u{1E8CF}\\u{1E950}-\\u{1E959}\\u{1EC71}-\\u{1ECAB}\\u{1ECAD}-\\u{1ECAF}\\u{1ECB1}-\\u{1ECB4}\\u{1ED01}-\\u{1ED2D}\\u{1ED2F}-\\u{1ED3D}\\u{1F100}-\\u{1F10C}\\u{1FBF0}-\\u{1FBF9}]+", "u")).filter(Boolean);
37
+ }
38
+ /**
39
+ * The section of the page a link names, by its place in the plan, or `null`
40
+ * when it names none, or more than one. A name matches a section whose name
41
+ * has the same words in any case and spacing, as "consultation-request-form"
42
+ * matches "consultation request form"; failing that, the one section whose
43
+ * name holds every word of it, as "#consultation-form" names that section. An
44
+ * `href` is read as a fragment, `#` and all.
45
+ */ export function aiPageLinkSection(text, sections) {
46
+ const words = wordsOf(text.trim().replace(/^#/, ''));
47
+ if (!words.length) return null;
48
+ const named = sections.map(wordsOf);
49
+ const exact = named.flatMap((section, index)=>section.join(' ') === words.join(' ') ? [
50
+ index
51
+ ] : []);
52
+ if (exact.length) return exact.length === 1 ? exact[0] : null;
53
+ const holding = named.flatMap((section, index)=>words.every((word)=>section.includes(word)) ? [
54
+ index
55
+ ] : []);
56
+ return holding.length === 1 ? holding[0] : null;
57
+ }
58
+ /** An `href` that is only a fragment: `#consultation-form`, and never `#` alone. */ export function isAiFragmentHref(value) {
59
+ return typeof value === 'string' && /^#\S+$/.test(value.trim());
60
+ }
61
+ /**
62
+ * Where a link node, as the model wrote it, goes on its own page: the section
63
+ * its `scrollTo` names, or else the one its `href` fragment names, by its
64
+ * place in the plan; the name it wrote when no section has it; `null` when it
65
+ * names no section of the page at all.
66
+ */ export function aiPageLinkTarget(written, sections) {
67
+ const props = isRecord(written) && isRecord(written['props']) ? written['props'] : {};
68
+ const scrollTo = props[AI_PAGE_SCROLL_TO_PROP];
69
+ const [value, via] = typeof scrollTo === 'string' && scrollTo.trim() ? [
70
+ scrollTo.trim(),
71
+ 'scrollTo'
72
+ ] : isAiFragmentHref(props['href']) ? [
73
+ props['href'].trim(),
74
+ 'href'
75
+ ] : [
76
+ null,
77
+ null
78
+ ];
79
+ if (value === null || via === null) return null;
80
+ const section = aiPageLinkSection(value, sections);
81
+ return section === null ? {
82
+ kind: 'unknown',
83
+ value,
84
+ via
85
+ } : {
86
+ kind: 'section',
87
+ section
88
+ };
89
+ }
90
+ /**
91
+ * The Scroll to element interaction a link carries to a section of its page,
92
+ * in the shape the interactions editor stores on a node: a click, every time,
93
+ * scrolling smoothly to the section's root with no offset, which are the
94
+ * editor's own defaults. The selector is the one the renderer stamps.
95
+ */ export function aiPageScrollInteraction(sectionRootId, sectionName) {
96
+ return {
97
+ id: AI_PAGE_SCROLL_INTERACTION_ID,
98
+ name: `Scroll to the ${sectionName} section`,
99
+ enabled: true,
100
+ trigger: {
101
+ event: 'elementClick',
102
+ everyTime: true
103
+ },
104
+ steps: [
105
+ {
106
+ type: 'scrollTo',
107
+ selector: nodeInteractionSelector(sectionRootId)
108
+ }
109
+ ]
110
+ };
111
+ }
112
+ function isRecord(value) {
113
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
114
+ }
115
+ /**
116
+ * The nodes a stored node scrolls to when it is clicked: every enabled click
117
+ * interaction's Scroll to element steps, by the ids their selectors name.
118
+ * Read only from a page as the page step stores it, where the palette
119
+ * validator has already dropped every interaction a model wrote.
120
+ */ export function aiStoredScrollTargets(node) {
121
+ const interactions = isRecord(node) && Array.isArray(node['interactions']) ? node['interactions'] : [];
122
+ return interactions.flatMap((interaction)=>{
123
+ if (!isRecord(interaction) || interaction['enabled'] === false) return [];
124
+ const trigger = isRecord(interaction['trigger']) ? interaction['trigger'] : {};
125
+ if (trigger['event'] !== 'elementClick' || !Array.isArray(interaction['steps'])) return [];
126
+ return interaction['steps'].flatMap((step)=>{
127
+ const target = isRecord(step) && step['type'] === 'scrollTo' ? nodeIdFromInteractionSelector(step['selector']) : undefined;
128
+ return target ? [
129
+ target
130
+ ] : [];
131
+ });
132
+ });
133
+ }
134
+
135
+ //# sourceMappingURL=ai-page-links.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/runtime/ai-page-links.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n nodeIdFromInteractionSelector,\n nodeInteractionSelector,\n type NodeInteraction,\n} from '@aglyn/aglyn/app-utils/node-interactions'\n\n/**\n * A link to a section of the same page (AGL-3097).\n *\n * A call to action often belongs on the page it is on: a hero's \"Request a\n * Consultation\" takes the visitor to the consultation form further down. The\n * platform does that with the Scroll to element interaction (AGL-2867), never\n * with an anchor: a placed element carries no id an `href` fragment could\n * name, and the palette validator drops a bare fragment. A generated node may\n * not write an interaction either, and when a page's first section is written\n * the section it points at does not exist yet.\n *\n * So a page's link names a section of the page by its name in the plan, with\n * `scrollTo`, or with an `href` fragment made of that name's words, and the\n * page step writes the interaction for it. Every section's root id is minted\n * from the job and the section's place in the plan before any is built, so\n * the interaction can name its target on the pass that writes the link.\n */\n\n/** The prop a link names a section of its own page with, by the section's name in the plan. */\nexport const AI_PAGE_SCROLL_TO_PROP = 'scrollTo'\n\n/** The id of the interaction a link scrolling to a section of its page carries. */\nexport const AI_PAGE_SCROLL_INTERACTION_ID = 'ai-scroll-to-section'\n\n/** The words of a name or an anchor, as they are compared: lowercase, letters and digits. */\nfunction wordsOf(text: string): string[] {\n return text\n .toLowerCase()\n .split(/[^\\p{L}\\p{N}]+/u)\n .filter(Boolean)\n}\n\n/**\n * The section of the page a link names, by its place in the plan, or `null`\n * when it names none, or more than one. A name matches a section whose name\n * has the same words in any case and spacing, as \"consultation-request-form\"\n * matches \"consultation request form\"; failing that, the one section whose\n * name holds every word of it, as \"#consultation-form\" names that section. An\n * `href` is read as a fragment, `#` and all.\n */\nexport function aiPageLinkSection(text: string, sections: readonly string[]): number | null {\n const words = wordsOf(text.trim().replace(/^#/, ''))\n if (!words.length) return null\n const named = sections.map(wordsOf)\n const exact = named.flatMap((section, index) => (section.join(' ') === words.join(' ') ? [index] : []))\n if (exact.length) return exact.length === 1 ? exact[0] : null\n const holding = named.flatMap((section, index) => (words.every((word) => section.includes(word)) ? [index] : []))\n return holding.length === 1 ? holding[0] : null\n}\n\n/** An `href` that is only a fragment: `#consultation-form`, and never `#` alone. */\nexport function isAiFragmentHref(value: unknown): value is string {\n return typeof value === 'string' && /^#\\S+$/.test(value.trim())\n}\n\n/** Where a written link says it goes on its own page: a section, or a name no section has. */\nexport type AiPageLinkTarget =\n | { kind: 'section'; section: number }\n | { kind: 'unknown'; value: string; via: 'scrollTo' | 'href' }\n\n/**\n * Where a link node, as the model wrote it, goes on its own page: the section\n * its `scrollTo` names, or else the one its `href` fragment names, by its\n * place in the plan; the name it wrote when no section has it; `null` when it\n * names no section of the page at all.\n */\nexport function aiPageLinkTarget(written: unknown, sections: readonly string[]): AiPageLinkTarget | null {\n const props = isRecord(written) && isRecord(written['props']) ? written['props'] : {}\n const scrollTo = props[AI_PAGE_SCROLL_TO_PROP]\n const [value, via] =\n typeof scrollTo === 'string' && scrollTo.trim()\n ? [scrollTo.trim(), 'scrollTo' as const]\n : isAiFragmentHref(props['href'])\n ? [props['href'].trim(), 'href' as const]\n : [null, null]\n if (value === null || via === null) return null\n const section = aiPageLinkSection(value, sections)\n return section === null ? { kind: 'unknown', value, via } : { kind: 'section', section }\n}\n\n/**\n * The Scroll to element interaction a link carries to a section of its page,\n * in the shape the interactions editor stores on a node: a click, every time,\n * scrolling smoothly to the section's root with no offset, which are the\n * editor's own defaults. The selector is the one the renderer stamps.\n */\nexport function aiPageScrollInteraction(sectionRootId: string, sectionName: string): NodeInteraction {\n return {\n id: AI_PAGE_SCROLL_INTERACTION_ID,\n name: `Scroll to the ${sectionName} section`,\n enabled: true,\n trigger: { event: 'elementClick', everyTime: true },\n steps: [{ type: 'scrollTo', selector: nodeInteractionSelector(sectionRootId) }],\n }\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\n/**\n * The nodes a stored node scrolls to when it is clicked: every enabled click\n * interaction's Scroll to element steps, by the ids their selectors name.\n * Read only from a page as the page step stores it, where the palette\n * validator has already dropped every interaction a model wrote.\n */\nexport function aiStoredScrollTargets(node: unknown): string[] {\n const interactions = isRecord(node) && Array.isArray(node['interactions']) ? node['interactions'] : []\n return interactions.flatMap((interaction: unknown) => {\n if (!isRecord(interaction) || interaction['enabled'] === false) return []\n const trigger = isRecord(interaction['trigger']) ? interaction['trigger'] : {}\n if (trigger['event'] !== 'elementClick' || !Array.isArray(interaction['steps'])) return []\n return interaction['steps'].flatMap((step: unknown) => {\n const target = isRecord(step) && step['type'] === 'scrollTo' ? nodeIdFromInteractionSelector(step['selector']) : undefined\n return target ? [target] : []\n })\n })\n}\n"],"names":["nodeIdFromInteractionSelector","nodeInteractionSelector","AI_PAGE_SCROLL_TO_PROP","AI_PAGE_SCROLL_INTERACTION_ID","wordsOf","text","toLowerCase","split","filter","Boolean","aiPageLinkSection","sections","words","trim","replace","length","named","map","exact","flatMap","section","index","join","holding","every","word","includes","isAiFragmentHref","value","test","aiPageLinkTarget","written","props","isRecord","scrollTo","via","kind","aiPageScrollInteraction","sectionRootId","sectionName","id","name","enabled","trigger","event","everyTime","steps","type","selector","Array","isArray","aiStoredScrollTargets","node","interactions","interaction","step","target","undefined"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SACEA,6BAA6B,EAC7BC,uBAAuB,QAElB,2CAA0C;AAEjD;;;;;;;;;;;;;;;;CAgBC,GAED,6FAA6F,GAC7F,OAAO,MAAMC,yBAAyB,WAAU;AAEhD,iFAAiF,GACjF,OAAO,MAAMC,gCAAgC,uBAAsB;AAEnE,2FAA2F,GAC3F,SAASC,QAAQC,IAAY;IAC3B,OAAOA,KACJC,WAAW,GACXC,KAAK,CAAC,8maACNC,MAAM,CAACC;AACZ;AAEA;;;;;;;CAOC,GACD,OAAO,SAASC,kBAAkBL,IAAY,EAAEM,QAA2B;IACzE,MAAMC,QAAQR,QAAQC,KAAKQ,IAAI,GAAGC,OAAO,CAAC,MAAM;IAChD,IAAI,CAACF,MAAMG,MAAM,EAAE,OAAO;IAC1B,MAAMC,QAAQL,SAASM,GAAG,CAACb;IAC3B,MAAMc,QAAQF,MAAMG,OAAO,CAAC,CAACC,SAASC,QAAWD,QAAQE,IAAI,CAAC,SAASV,MAAMU,IAAI,CAAC,OAAO;YAACD;SAAM,GAAG,EAAE;IACrG,IAAIH,MAAMH,MAAM,EAAE,OAAOG,MAAMH,MAAM,KAAK,IAAIG,KAAK,CAAC,EAAE,GAAG;IACzD,MAAMK,UAAUP,MAAMG,OAAO,CAAC,CAACC,SAASC,QAAWT,MAAMY,KAAK,CAAC,CAACC,OAASL,QAAQM,QAAQ,CAACD,SAAS;YAACJ;SAAM,GAAG,EAAE;IAC/G,OAAOE,QAAQR,MAAM,KAAK,IAAIQ,OAAO,CAAC,EAAE,GAAG;AAC7C;AAEA,kFAAkF,GAClF,OAAO,SAAS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