@nodehive/nextjs 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (777) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +102 -0
  3. package/dist/auth/index.d.ts +6 -0
  4. package/dist/auth/index.d.ts.map +1 -0
  5. package/dist/auth/index.js +7 -0
  6. package/dist/auth/index.js.map +1 -0
  7. package/dist/auth/internal/config.d.ts +24 -0
  8. package/dist/auth/internal/config.d.ts.map +1 -0
  9. package/dist/auth/internal/config.js +2 -0
  10. package/dist/auth/internal/config.js.map +1 -0
  11. package/dist/auth/internal/draft-mode.d.ts +17 -0
  12. package/dist/auth/internal/draft-mode.d.ts.map +1 -0
  13. package/dist/auth/internal/draft-mode.js +73 -0
  14. package/dist/auth/internal/draft-mode.js.map +1 -0
  15. package/dist/auth/internal/editor-locale.d.ts +4 -0
  16. package/dist/auth/internal/editor-locale.d.ts.map +1 -0
  17. package/dist/auth/internal/editor-locale.js +14 -0
  18. package/dist/auth/internal/editor-locale.js.map +1 -0
  19. package/dist/auth/internal/handoff.d.ts +11 -0
  20. package/dist/auth/internal/handoff.d.ts.map +1 -0
  21. package/dist/auth/internal/handoff.js +44 -0
  22. package/dist/auth/internal/handoff.js.map +1 -0
  23. package/dist/auth/internal/has-session.d.ts +7 -0
  24. package/dist/auth/internal/has-session.d.ts.map +1 -0
  25. package/dist/auth/internal/has-session.js +11 -0
  26. package/dist/auth/internal/has-session.js.map +1 -0
  27. package/dist/auth/internal/logout.d.ts +12 -0
  28. package/dist/auth/internal/logout.d.ts.map +1 -0
  29. package/dist/auth/internal/logout.js +48 -0
  30. package/dist/auth/internal/logout.js.map +1 -0
  31. package/dist/auth/internal/next-cookie-storage.d.ts +28 -0
  32. package/dist/auth/internal/next-cookie-storage.d.ts.map +1 -0
  33. package/dist/auth/internal/next-cookie-storage.js +103 -0
  34. package/dist/auth/internal/next-cookie-storage.js.map +1 -0
  35. package/dist/auth/internal/nodehive-client.d.ts +6 -0
  36. package/dist/auth/internal/nodehive-client.d.ts.map +1 -0
  37. package/dist/auth/internal/nodehive-client.js +64 -0
  38. package/dist/auth/internal/nodehive-client.js.map +1 -0
  39. package/dist/auth/internal/oauth-config.d.ts +37 -0
  40. package/dist/auth/internal/oauth-config.d.ts.map +1 -0
  41. package/dist/auth/internal/oauth-config.js +70 -0
  42. package/dist/auth/internal/oauth-config.js.map +1 -0
  43. package/dist/auth/internal/proxy-helpers.d.ts +15 -0
  44. package/dist/auth/internal/proxy-helpers.d.ts.map +1 -0
  45. package/dist/auth/internal/proxy-helpers.js +43 -0
  46. package/dist/auth/internal/proxy-helpers.js.map +1 -0
  47. package/dist/auth/internal/refresh.d.ts +13 -0
  48. package/dist/auth/internal/refresh.d.ts.map +1 -0
  49. package/dist/auth/internal/refresh.js +170 -0
  50. package/dist/auth/internal/refresh.js.map +1 -0
  51. package/dist/auth/internal/require-auth.d.ts +2 -0
  52. package/dist/auth/internal/require-auth.d.ts.map +1 -0
  53. package/dist/auth/internal/require-auth.js +11 -0
  54. package/dist/auth/internal/require-auth.js.map +1 -0
  55. package/dist/auth/internal/return-to.d.ts +16 -0
  56. package/dist/auth/internal/return-to.d.ts.map +1 -0
  57. package/dist/auth/internal/return-to.js +31 -0
  58. package/dist/auth/internal/return-to.js.map +1 -0
  59. package/dist/auth/internal/routes/callback.d.ts +11 -0
  60. package/dist/auth/internal/routes/callback.d.ts.map +1 -0
  61. package/dist/auth/internal/routes/callback.js +93 -0
  62. package/dist/auth/internal/routes/callback.js.map +1 -0
  63. package/dist/auth/internal/routes/chips-exchange.d.ts +4 -0
  64. package/dist/auth/internal/routes/chips-exchange.d.ts.map +1 -0
  65. package/dist/auth/internal/routes/chips-exchange.js +64 -0
  66. package/dist/auth/internal/routes/chips-exchange.js.map +1 -0
  67. package/dist/auth/internal/routes/draft.d.ts +4 -0
  68. package/dist/auth/internal/routes/draft.d.ts.map +1 -0
  69. package/dist/auth/internal/routes/draft.js +34 -0
  70. package/dist/auth/internal/routes/draft.js.map +1 -0
  71. package/dist/auth/internal/routes/index.d.ts +25 -0
  72. package/dist/auth/internal/routes/index.d.ts.map +1 -0
  73. package/dist/auth/internal/routes/index.js +66 -0
  74. package/dist/auth/internal/routes/index.js.map +1 -0
  75. package/dist/auth/internal/routes/login.d.ts +3 -0
  76. package/dist/auth/internal/routes/login.d.ts.map +1 -0
  77. package/dist/auth/internal/routes/login.js +47 -0
  78. package/dist/auth/internal/routes/login.js.map +1 -0
  79. package/dist/auth/internal/routes/popup-done.d.ts +3 -0
  80. package/dist/auth/internal/routes/popup-done.d.ts.map +1 -0
  81. package/dist/auth/internal/routes/popup-done.js +24 -0
  82. package/dist/auth/internal/routes/popup-done.js.map +1 -0
  83. package/dist/auth/internal/routes/refresh.d.ts +6 -0
  84. package/dist/auth/internal/routes/refresh.d.ts.map +1 -0
  85. package/dist/auth/internal/routes/refresh.js +44 -0
  86. package/dist/auth/internal/routes/refresh.js.map +1 -0
  87. package/dist/auth/internal/same-origin.d.ts +8 -0
  88. package/dist/auth/internal/same-origin.d.ts.map +1 -0
  89. package/dist/auth/internal/same-origin.js +9 -0
  90. package/dist/auth/internal/same-origin.js.map +1 -0
  91. package/dist/auth/internal/session-gates.d.ts +7 -0
  92. package/dist/auth/internal/session-gates.d.ts.map +1 -0
  93. package/dist/auth/internal/session-gates.js +12 -0
  94. package/dist/auth/internal/session-gates.js.map +1 -0
  95. package/dist/auth/internal/update-session.d.ts +17 -0
  96. package/dist/auth/internal/update-session.d.ts.map +1 -0
  97. package/dist/auth/internal/update-session.js +39 -0
  98. package/dist/auth/internal/update-session.js.map +1 -0
  99. package/dist/auth/internal/use-editor-login.d.ts +33 -0
  100. package/dist/auth/internal/use-editor-login.d.ts.map +1 -0
  101. package/dist/auth/internal/use-editor-login.js +143 -0
  102. package/dist/auth/internal/use-editor-login.js.map +1 -0
  103. package/dist/auth/proxy.d.ts +8 -0
  104. package/dist/auth/proxy.d.ts.map +1 -0
  105. package/dist/auth/proxy.js +8 -0
  106. package/dist/auth/proxy.js.map +1 -0
  107. package/dist/auth/react.d.ts +2 -0
  108. package/dist/auth/react.d.ts.map +1 -0
  109. package/dist/auth/react.js +3 -0
  110. package/dist/auth/react.js.map +1 -0
  111. package/dist/auth/routes.d.ts +3 -0
  112. package/dist/auth/routes.d.ts.map +1 -0
  113. package/dist/auth/routes.js +3 -0
  114. package/dist/auth/routes.js.map +1 -0
  115. package/dist/auth/server.d.ts +23 -0
  116. package/dist/auth/server.d.ts.map +1 -0
  117. package/dist/auth/server.js +61 -0
  118. package/dist/auth/server.js.map +1 -0
  119. package/dist/puck-editor/fields.d.ts +7 -0
  120. package/dist/puck-editor/fields.d.ts.map +1 -0
  121. package/dist/puck-editor/fields.js +4 -0
  122. package/dist/puck-editor/fields.js.map +1 -0
  123. package/dist/puck-editor/index.d.ts +14 -0
  124. package/dist/puck-editor/index.d.ts.map +1 -0
  125. package/dist/puck-editor/index.js +12 -0
  126. package/dist/puck-editor/index.js.map +1 -0
  127. package/dist/puck-editor/internal/api/client.d.ts +32 -0
  128. package/dist/puck-editor/internal/api/client.d.ts.map +1 -0
  129. package/dist/puck-editor/internal/api/client.js +128 -0
  130. package/dist/puck-editor/internal/api/client.js.map +1 -0
  131. package/dist/puck-editor/internal/api/config.d.ts +29 -0
  132. package/dist/puck-editor/internal/api/config.d.ts.map +1 -0
  133. package/dist/puck-editor/internal/api/config.js +2 -0
  134. package/dist/puck-editor/internal/api/config.js.map +1 -0
  135. package/dist/puck-editor/internal/api/create-puck-api.d.ts +26 -0
  136. package/dist/puck-editor/internal/api/create-puck-api.d.ts.map +1 -0
  137. package/dist/puck-editor/internal/api/create-puck-api.js +124 -0
  138. package/dist/puck-editor/internal/api/create-puck-api.js.map +1 -0
  139. package/dist/puck-editor/internal/api/handlers/create-page.d.ts +13 -0
  140. package/dist/puck-editor/internal/api/handlers/create-page.d.ts.map +1 -0
  141. package/dist/puck-editor/internal/api/handlers/create-page.js +125 -0
  142. package/dist/puck-editor/internal/api/handlers/create-page.js.map +1 -0
  143. package/dist/puck-editor/internal/api/handlers/entities.d.ts +17 -0
  144. package/dist/puck-editor/internal/api/handlers/entities.d.ts.map +1 -0
  145. package/dist/puck-editor/internal/api/handlers/entities.js +166 -0
  146. package/dist/puck-editor/internal/api/handlers/entities.js.map +1 -0
  147. package/dist/puck-editor/internal/api/handlers/publish.d.ts +6 -0
  148. package/dist/puck-editor/internal/api/handlers/publish.d.ts.map +1 -0
  149. package/dist/puck-editor/internal/api/handlers/publish.js +115 -0
  150. package/dist/puck-editor/internal/api/handlers/publish.js.map +1 -0
  151. package/dist/puck-editor/internal/api/handlers/template.d.ts +15 -0
  152. package/dist/puck-editor/internal/api/handlers/template.d.ts.map +1 -0
  153. package/dist/puck-editor/internal/api/handlers/template.js +222 -0
  154. package/dist/puck-editor/internal/api/handlers/template.js.map +1 -0
  155. package/dist/puck-editor/internal/api/handlers/upload.d.ts +13 -0
  156. package/dist/puck-editor/internal/api/handlers/upload.d.ts.map +1 -0
  157. package/dist/puck-editor/internal/api/handlers/upload.js +129 -0
  158. package/dist/puck-editor/internal/api/handlers/upload.js.map +1 -0
  159. package/dist/puck-editor/internal/api/media-params.d.ts +4 -0
  160. package/dist/puck-editor/internal/api/media-params.d.ts.map +1 -0
  161. package/dist/puck-editor/internal/api/media-params.js +38 -0
  162. package/dist/puck-editor/internal/api/media-params.js.map +1 -0
  163. package/dist/puck-editor/internal/api/media-upload.d.ts +24 -0
  164. package/dist/puck-editor/internal/api/media-upload.d.ts.map +1 -0
  165. package/dist/puck-editor/internal/api/media-upload.js +171 -0
  166. package/dist/puck-editor/internal/api/media-upload.js.map +1 -0
  167. package/dist/puck-editor/internal/api/space.d.ts +4 -0
  168. package/dist/puck-editor/internal/api/space.d.ts.map +1 -0
  169. package/dist/puck-editor/internal/api/space.js +11 -0
  170. package/dist/puck-editor/internal/api/space.js.map +1 -0
  171. package/dist/puck-editor/internal/content-model.d.ts +55 -0
  172. package/dist/puck-editor/internal/content-model.d.ts.map +1 -0
  173. package/dist/puck-editor/internal/content-model.js +73 -0
  174. package/dist/puck-editor/internal/content-model.js.map +1 -0
  175. package/dist/puck-editor/internal/editor/allowed-types.d.ts +4 -0
  176. package/dist/puck-editor/internal/editor/allowed-types.d.ts.map +1 -0
  177. package/dist/puck-editor/internal/editor/allowed-types.js +6 -0
  178. package/dist/puck-editor/internal/editor/allowed-types.js.map +1 -0
  179. package/dist/puck-editor/internal/editor/canvas-add-picker.d.ts +9 -0
  180. package/dist/puck-editor/internal/editor/canvas-add-picker.d.ts.map +1 -0
  181. package/dist/puck-editor/internal/editor/canvas-add-picker.js +231 -0
  182. package/dist/puck-editor/internal/editor/canvas-add-picker.js.map +1 -0
  183. package/dist/puck-editor/internal/editor/canvas-empty-state.d.ts +6 -0
  184. package/dist/puck-editor/internal/editor/canvas-empty-state.d.ts.map +1 -0
  185. package/dist/puck-editor/internal/editor/canvas-empty-state.js +85 -0
  186. package/dist/puck-editor/internal/editor/canvas-empty-state.js.map +1 -0
  187. package/dist/puck-editor/internal/editor/canvas-quick-add.d.ts +2 -0
  188. package/dist/puck-editor/internal/editor/canvas-quick-add.d.ts.map +1 -0
  189. package/dist/puck-editor/internal/editor/canvas-quick-add.js +844 -0
  190. package/dist/puck-editor/internal/editor/canvas-quick-add.js.map +1 -0
  191. package/dist/puck-editor/internal/editor/canvas-scroll.d.ts +3 -0
  192. package/dist/puck-editor/internal/editor/canvas-scroll.d.ts.map +1 -0
  193. package/dist/puck-editor/internal/editor/canvas-scroll.js +16 -0
  194. package/dist/puck-editor/internal/editor/canvas-scroll.js.map +1 -0
  195. package/dist/puck-editor/internal/editor/component-icons.d.ts +14 -0
  196. package/dist/puck-editor/internal/editor/component-icons.d.ts.map +1 -0
  197. package/dist/puck-editor/internal/editor/component-icons.js +35 -0
  198. package/dist/puck-editor/internal/editor/component-icons.js.map +1 -0
  199. package/dist/puck-editor/internal/editor/component-item.d.ts +6 -0
  200. package/dist/puck-editor/internal/editor/component-item.d.ts.map +1 -0
  201. package/dist/puck-editor/internal/editor/component-item.js +42 -0
  202. package/dist/puck-editor/internal/editor/component-item.js.map +1 -0
  203. package/dist/puck-editor/internal/editor/editor-action-bar.d.ts +6 -0
  204. package/dist/puck-editor/internal/editor/editor-action-bar.d.ts.map +1 -0
  205. package/dist/puck-editor/internal/editor/editor-action-bar.js +249 -0
  206. package/dist/puck-editor/internal/editor/editor-action-bar.js.map +1 -0
  207. package/dist/puck-editor/internal/editor/editor-header-actions.d.ts +7 -0
  208. package/dist/puck-editor/internal/editor/editor-header-actions.d.ts.map +1 -0
  209. package/dist/puck-editor/internal/editor/editor-header-actions.js +120 -0
  210. package/dist/puck-editor/internal/editor/editor-header-actions.js.map +1 -0
  211. package/dist/puck-editor/internal/editor/find-missing-required-fields.d.ts +15 -0
  212. package/dist/puck-editor/internal/editor/find-missing-required-fields.d.ts.map +1 -0
  213. package/dist/puck-editor/internal/editor/find-missing-required-fields.js +61 -0
  214. package/dist/puck-editor/internal/editor/find-missing-required-fields.js.map +1 -0
  215. package/dist/puck-editor/internal/editor/grouped-drawer-panel.d.ts +15 -0
  216. package/dist/puck-editor/internal/editor/grouped-drawer-panel.d.ts.map +1 -0
  217. package/dist/puck-editor/internal/editor/grouped-drawer-panel.js +147 -0
  218. package/dist/puck-editor/internal/editor/grouped-drawer-panel.js.map +1 -0
  219. package/dist/puck-editor/internal/editor/grouped-entry-list.d.ts +17 -0
  220. package/dist/puck-editor/internal/editor/grouped-entry-list.d.ts.map +1 -0
  221. package/dist/puck-editor/internal/editor/grouped-entry-list.js +125 -0
  222. package/dist/puck-editor/internal/editor/grouped-entry-list.js.map +1 -0
  223. package/dist/puck-editor/internal/editor/header-save-button.d.ts +5 -0
  224. package/dist/puck-editor/internal/editor/header-save-button.d.ts.map +1 -0
  225. package/dist/puck-editor/internal/editor/header-save-button.js +60 -0
  226. package/dist/puck-editor/internal/editor/header-save-button.js.map +1 -0
  227. package/dist/puck-editor/internal/editor/page-template-picker.d.ts +4 -0
  228. package/dist/puck-editor/internal/editor/page-template-picker.d.ts.map +1 -0
  229. package/dist/puck-editor/internal/editor/page-template-picker.js +140 -0
  230. package/dist/puck-editor/internal/editor/page-template-picker.js.map +1 -0
  231. package/dist/puck-editor/internal/editor/picker-entry-item.d.ts +6 -0
  232. package/dist/puck-editor/internal/editor/picker-entry-item.d.ts.map +1 -0
  233. package/dist/puck-editor/internal/editor/picker-entry-item.js +79 -0
  234. package/dist/puck-editor/internal/editor/picker-entry-item.js.map +1 -0
  235. package/dist/puck-editor/internal/editor/picker-model.d.ts +62 -0
  236. package/dist/puck-editor/internal/editor/picker-model.d.ts.map +1 -0
  237. package/dist/puck-editor/internal/editor/picker-model.js +489 -0
  238. package/dist/puck-editor/internal/editor/picker-model.js.map +1 -0
  239. package/dist/puck-editor/internal/editor/publish-puck-data.d.ts +30 -0
  240. package/dist/puck-editor/internal/editor/publish-puck-data.d.ts.map +1 -0
  241. package/dist/puck-editor/internal/editor/publish-puck-data.js +30 -0
  242. package/dist/puck-editor/internal/editor/publish-puck-data.js.map +1 -0
  243. package/dist/puck-editor/internal/editor/puck-editor.d.ts +15 -0
  244. package/dist/puck-editor/internal/editor/puck-editor.d.ts.map +1 -0
  245. package/dist/puck-editor/internal/editor/puck-editor.js +333 -0
  246. package/dist/puck-editor/internal/editor/puck-editor.js.map +1 -0
  247. package/dist/puck-editor/internal/editor/section-template-modal.d.ts +4 -0
  248. package/dist/puck-editor/internal/editor/section-template-modal.d.ts.map +1 -0
  249. package/dist/puck-editor/internal/editor/section-template-modal.js +71 -0
  250. package/dist/puck-editor/internal/editor/section-template-modal.js.map +1 -0
  251. package/dist/puck-editor/internal/editor/use-scroll-lock-outside.d.ts +15 -0
  252. package/dist/puck-editor/internal/editor/use-scroll-lock-outside.d.ts.map +1 -0
  253. package/dist/puck-editor/internal/editor/use-scroll-lock-outside.js +93 -0
  254. package/dist/puck-editor/internal/editor/use-scroll-lock-outside.js.map +1 -0
  255. package/dist/puck-editor/internal/editor-config.d.ts +30 -0
  256. package/dist/puck-editor/internal/editor-config.d.ts.map +1 -0
  257. package/dist/puck-editor/internal/editor-config.js +57 -0
  258. package/dist/puck-editor/internal/editor-config.js.map +1 -0
  259. package/dist/puck-editor/internal/editor-query-client.d.ts +4 -0
  260. package/dist/puck-editor/internal/editor-query-client.d.ts.map +1 -0
  261. package/dist/puck-editor/internal/editor-query-client.js +8 -0
  262. package/dist/puck-editor/internal/editor-query-client.js.map +1 -0
  263. package/dist/puck-editor/internal/fields/checkbox-group/checkbox-group-field.d.ts +14 -0
  264. package/dist/puck-editor/internal/fields/checkbox-group/checkbox-group-field.d.ts.map +1 -0
  265. package/dist/puck-editor/internal/fields/checkbox-group/checkbox-group-field.js +120 -0
  266. package/dist/puck-editor/internal/fields/checkbox-group/checkbox-group-field.js.map +1 -0
  267. package/dist/puck-editor/internal/fields/checkbox-group/create-checkbox-group-field.d.ts +21 -0
  268. package/dist/puck-editor/internal/fields/checkbox-group/create-checkbox-group-field.d.ts.map +1 -0
  269. package/dist/puck-editor/internal/fields/checkbox-group/create-checkbox-group-field.js +24 -0
  270. package/dist/puck-editor/internal/fields/checkbox-group/create-checkbox-group-field.js.map +1 -0
  271. package/dist/puck-editor/internal/fields/date-picker/create-date-picker-field.d.ts +16 -0
  272. package/dist/puck-editor/internal/fields/date-picker/create-date-picker-field.d.ts.map +1 -0
  273. package/dist/puck-editor/internal/fields/date-picker/create-date-picker-field.js +20 -0
  274. package/dist/puck-editor/internal/fields/date-picker/create-date-picker-field.js.map +1 -0
  275. package/dist/puck-editor/internal/fields/date-picker/date-picker.d.ts +8 -0
  276. package/dist/puck-editor/internal/fields/date-picker/date-picker.d.ts.map +1 -0
  277. package/dist/puck-editor/internal/fields/date-picker/date-picker.js +151 -0
  278. package/dist/puck-editor/internal/fields/date-picker/date-picker.js.map +1 -0
  279. package/dist/puck-editor/internal/fields/index.d.ts +10 -0
  280. package/dist/puck-editor/internal/fields/index.d.ts.map +1 -0
  281. package/dist/puck-editor/internal/fields/index.js +10 -0
  282. package/dist/puck-editor/internal/fields/index.js.map +1 -0
  283. package/dist/puck-editor/internal/fields/link-picker/anchor.d.ts +33 -0
  284. package/dist/puck-editor/internal/fields/link-picker/anchor.d.ts.map +1 -0
  285. package/dist/puck-editor/internal/fields/link-picker/anchor.js +83 -0
  286. package/dist/puck-editor/internal/fields/link-picker/anchor.js.map +1 -0
  287. package/dist/puck-editor/internal/fields/link-picker/create-link-field.d.ts +24 -0
  288. package/dist/puck-editor/internal/fields/link-picker/create-link-field.d.ts.map +1 -0
  289. package/dist/puck-editor/internal/fields/link-picker/create-link-field.js +31 -0
  290. package/dist/puck-editor/internal/fields/link-picker/create-link-field.js.map +1 -0
  291. package/dist/puck-editor/internal/fields/link-picker/humanize.d.ts +2 -0
  292. package/dist/puck-editor/internal/fields/link-picker/humanize.d.ts.map +1 -0
  293. package/dist/puck-editor/internal/fields/link-picker/humanize.js +4 -0
  294. package/dist/puck-editor/internal/fields/link-picker/humanize.js.map +1 -0
  295. package/dist/puck-editor/internal/fields/link-picker/link-picker-control.d.ts +27 -0
  296. package/dist/puck-editor/internal/fields/link-picker/link-picker-control.d.ts.map +1 -0
  297. package/dist/puck-editor/internal/fields/link-picker/link-picker-control.js +564 -0
  298. package/dist/puck-editor/internal/fields/link-picker/link-picker-control.js.map +1 -0
  299. package/dist/puck-editor/internal/fields/link-picker/link-picker-field.d.ts +9 -0
  300. package/dist/puck-editor/internal/fields/link-picker/link-picker-field.d.ts.map +1 -0
  301. package/dist/puck-editor/internal/fields/link-picker/link-picker-field.js +189 -0
  302. package/dist/puck-editor/internal/fields/link-picker/link-picker-field.js.map +1 -0
  303. package/dist/puck-editor/internal/fields/link-picker/link-value.d.ts +72 -0
  304. package/dist/puck-editor/internal/fields/link-picker/link-value.d.ts.map +1 -0
  305. package/dist/puck-editor/internal/fields/link-picker/link-value.js +114 -0
  306. package/dist/puck-editor/internal/fields/link-picker/link-value.js.map +1 -0
  307. package/dist/puck-editor/internal/fields/link-picker/rich-text-link-button.d.ts +14 -0
  308. package/dist/puck-editor/internal/fields/link-picker/rich-text-link-button.d.ts.map +1 -0
  309. package/dist/puck-editor/internal/fields/link-picker/rich-text-link-button.js +667 -0
  310. package/dist/puck-editor/internal/fields/link-picker/rich-text-link-button.js.map +1 -0
  311. package/dist/puck-editor/internal/fields/link-picker/richtext-extensions.d.ts +11 -0
  312. package/dist/puck-editor/internal/fields/link-picker/richtext-extensions.d.ts.map +1 -0
  313. package/dist/puck-editor/internal/fields/link-picker/richtext-extensions.js +34 -0
  314. package/dist/puck-editor/internal/fields/link-picker/richtext-extensions.js.map +1 -0
  315. package/dist/puck-editor/internal/fields/link-picker/segmented-control.d.ts +40 -0
  316. package/dist/puck-editor/internal/fields/link-picker/segmented-control.d.ts.map +1 -0
  317. package/dist/puck-editor/internal/fields/link-picker/segmented-control.js +146 -0
  318. package/dist/puck-editor/internal/fields/link-picker/segmented-control.js.map +1 -0
  319. package/dist/puck-editor/internal/fields/link-picker/types.d.ts +34 -0
  320. package/dist/puck-editor/internal/fields/link-picker/types.d.ts.map +1 -0
  321. package/dist/puck-editor/internal/fields/link-picker/types.js +2 -0
  322. package/dist/puck-editor/internal/fields/link-picker/types.js.map +1 -0
  323. package/dist/puck-editor/internal/fields/media-array/create-media-array-field.d.ts +27 -0
  324. package/dist/puck-editor/internal/fields/media-array/create-media-array-field.d.ts.map +1 -0
  325. package/dist/puck-editor/internal/fields/media-array/create-media-array-field.js +32 -0
  326. package/dist/puck-editor/internal/fields/media-array/create-media-array-field.js.map +1 -0
  327. package/dist/puck-editor/internal/fields/media-array/media-array-field.d.ts +13 -0
  328. package/dist/puck-editor/internal/fields/media-array/media-array-field.d.ts.map +1 -0
  329. package/dist/puck-editor/internal/fields/media-array/media-array-field.js +372 -0
  330. package/dist/puck-editor/internal/fields/media-array/media-array-field.js.map +1 -0
  331. package/dist/puck-editor/internal/fields/media-array/reorder.d.ts +2 -0
  332. package/dist/puck-editor/internal/fields/media-array/reorder.d.ts.map +1 -0
  333. package/dist/puck-editor/internal/fields/media-array/reorder.js +8 -0
  334. package/dist/puck-editor/internal/fields/media-array/reorder.js.map +1 -0
  335. package/dist/puck-editor/internal/fields/media-selector/create-media-selector-field.d.ts +27 -0
  336. package/dist/puck-editor/internal/fields/media-selector/create-media-selector-field.d.ts.map +1 -0
  337. package/dist/puck-editor/internal/fields/media-selector/create-media-selector-field.js +32 -0
  338. package/dist/puck-editor/internal/fields/media-selector/create-media-selector-field.js.map +1 -0
  339. package/dist/puck-editor/internal/fields/media-selector/crop-editor-dialog.d.ts +11 -0
  340. package/dist/puck-editor/internal/fields/media-selector/crop-editor-dialog.d.ts.map +1 -0
  341. package/dist/puck-editor/internal/fields/media-selector/crop-editor-dialog.js +219 -0
  342. package/dist/puck-editor/internal/fields/media-selector/crop-editor-dialog.js.map +1 -0
  343. package/dist/puck-editor/internal/fields/media-selector/crop-types.d.ts +24 -0
  344. package/dist/puck-editor/internal/fields/media-selector/crop-types.d.ts.map +1 -0
  345. package/dist/puck-editor/internal/fields/media-selector/crop-types.js +8 -0
  346. package/dist/puck-editor/internal/fields/media-selector/crop-types.js.map +1 -0
  347. package/dist/puck-editor/internal/fields/media-selector/extract-fields.d.ts +8 -0
  348. package/dist/puck-editor/internal/fields/media-selector/extract-fields.d.ts.map +1 -0
  349. package/dist/puck-editor/internal/fields/media-selector/extract-fields.js +51 -0
  350. package/dist/puck-editor/internal/fields/media-selector/extract-fields.js.map +1 -0
  351. package/dist/puck-editor/internal/fields/media-selector/image-upload-form.d.ts +7 -0
  352. package/dist/puck-editor/internal/fields/media-selector/image-upload-form.d.ts.map +1 -0
  353. package/dist/puck-editor/internal/fields/media-selector/image-upload-form.js +147 -0
  354. package/dist/puck-editor/internal/fields/media-selector/image-upload-form.js.map +1 -0
  355. package/dist/puck-editor/internal/fields/media-selector/media-selector-field.d.ts +30 -0
  356. package/dist/puck-editor/internal/fields/media-selector/media-selector-field.d.ts.map +1 -0
  357. package/dist/puck-editor/internal/fields/media-selector/media-selector-field.js +358 -0
  358. package/dist/puck-editor/internal/fields/media-selector/media-selector-field.js.map +1 -0
  359. package/dist/puck-editor/internal/fields/media-selector/media-selector-modal.d.ts +14 -0
  360. package/dist/puck-editor/internal/fields/media-selector/media-selector-modal.d.ts.map +1 -0
  361. package/dist/puck-editor/internal/fields/media-selector/media-selector-modal.js +355 -0
  362. package/dist/puck-editor/internal/fields/media-selector/media-selector-modal.js.map +1 -0
  363. package/dist/puck-editor/internal/fields/media-selector/use-debounced-value.d.ts +2 -0
  364. package/dist/puck-editor/internal/fields/media-selector/use-debounced-value.d.ts.map +1 -0
  365. package/dist/puck-editor/internal/fields/media-selector/use-debounced-value.js +55 -0
  366. package/dist/puck-editor/internal/fields/media-selector/use-debounced-value.js.map +1 -0
  367. package/dist/puck-editor/internal/fields/media-selector/use-media-library.d.ts +24 -0
  368. package/dist/puck-editor/internal/fields/media-selector/use-media-library.d.ts.map +1 -0
  369. package/dist/puck-editor/internal/fields/media-selector/use-media-library.js +229 -0
  370. package/dist/puck-editor/internal/fields/media-selector/use-media-library.js.map +1 -0
  371. package/dist/puck-editor/internal/fields/media-selector/video-upload-form.d.ts +7 -0
  372. package/dist/puck-editor/internal/fields/media-selector/video-upload-form.d.ts.map +1 -0
  373. package/dist/puck-editor/internal/fields/media-selector/video-upload-form.js +120 -0
  374. package/dist/puck-editor/internal/fields/media-selector/video-upload-form.js.map +1 -0
  375. package/dist/puck-editor/internal/fields/node-selector/create-node-selector-field.d.ts +31 -0
  376. package/dist/puck-editor/internal/fields/node-selector/create-node-selector-field.d.ts.map +1 -0
  377. package/dist/puck-editor/internal/fields/node-selector/create-node-selector-field.js +39 -0
  378. package/dist/puck-editor/internal/fields/node-selector/create-node-selector-field.js.map +1 -0
  379. package/dist/puck-editor/internal/fields/required-field-label.d.ts +16 -0
  380. package/dist/puck-editor/internal/fields/required-field-label.d.ts.map +1 -0
  381. package/dist/puck-editor/internal/fields/required-field-label.js +89 -0
  382. package/dist/puck-editor/internal/fields/required-field-label.js.map +1 -0
  383. package/dist/puck-editor/internal/fields/required.d.ts +19 -0
  384. package/dist/puck-editor/internal/fields/required.d.ts.map +1 -0
  385. package/dist/puck-editor/internal/fields/required.js +20 -0
  386. package/dist/puck-editor/internal/fields/required.js.map +1 -0
  387. package/dist/puck-editor/internal/fields/rich-text/create-rich-text-field.d.ts +37 -0
  388. package/dist/puck-editor/internal/fields/rich-text/create-rich-text-field.d.ts.map +1 -0
  389. package/dist/puck-editor/internal/fields/rich-text/create-rich-text-field.js +26 -0
  390. package/dist/puck-editor/internal/fields/rich-text/create-rich-text-field.js.map +1 -0
  391. package/dist/puck-editor/internal/i18n.d.ts +188 -0
  392. package/dist/puck-editor/internal/i18n.d.ts.map +1 -0
  393. package/dist/puck-editor/internal/i18n.js +414 -0
  394. package/dist/puck-editor/internal/i18n.js.map +1 -0
  395. package/dist/puck-editor/internal/locale.d.ts +13 -0
  396. package/dist/puck-editor/internal/locale.d.ts.map +1 -0
  397. package/dist/puck-editor/internal/locale.js +20 -0
  398. package/dist/puck-editor/internal/locale.js.map +1 -0
  399. package/dist/puck-editor/internal/localize.d.ts +11 -0
  400. package/dist/puck-editor/internal/localize.d.ts.map +1 -0
  401. package/dist/puck-editor/internal/localize.js +42 -0
  402. package/dist/puck-editor/internal/localize.js.map +1 -0
  403. package/dist/puck-editor/internal/plugins/agent-plugin/agent-bridge.d.ts +21 -0
  404. package/dist/puck-editor/internal/plugins/agent-plugin/agent-bridge.d.ts.map +1 -0
  405. package/dist/puck-editor/internal/plugins/agent-plugin/agent-bridge.js +197 -0
  406. package/dist/puck-editor/internal/plugins/agent-plugin/agent-bridge.js.map +1 -0
  407. package/dist/puck-editor/internal/plugins/agent-plugin/agent-info-panel.d.ts +2 -0
  408. package/dist/puck-editor/internal/plugins/agent-plugin/agent-info-panel.d.ts.map +1 -0
  409. package/dist/puck-editor/internal/plugins/agent-plugin/agent-info-panel.js +131 -0
  410. package/dist/puck-editor/internal/plugins/agent-plugin/agent-info-panel.js.map +1 -0
  411. package/dist/puck-editor/internal/plugins/agent-plugin/agent-plugin.d.ts +20 -0
  412. package/dist/puck-editor/internal/plugins/agent-plugin/agent-plugin.d.ts.map +1 -0
  413. package/dist/puck-editor/internal/plugins/agent-plugin/agent-plugin.js +46 -0
  414. package/dist/puck-editor/internal/plugins/agent-plugin/agent-plugin.js.map +1 -0
  415. package/dist/puck-editor/internal/plugins/agent-plugin/apply-patch-to-puck.d.ts +46 -0
  416. package/dist/puck-editor/internal/plugins/agent-plugin/apply-patch-to-puck.d.ts.map +1 -0
  417. package/dist/puck-editor/internal/plugins/agent-plugin/apply-patch-to-puck.js +176 -0
  418. package/dist/puck-editor/internal/plugins/agent-plugin/apply-patch-to-puck.js.map +1 -0
  419. package/dist/puck-editor/internal/plugins/agent-plugin/catalog.d.ts +20 -0
  420. package/dist/puck-editor/internal/plugins/agent-plugin/catalog.d.ts.map +1 -0
  421. package/dist/puck-editor/internal/plugins/agent-plugin/catalog.js +39 -0
  422. package/dist/puck-editor/internal/plugins/agent-plugin/catalog.js.map +1 -0
  423. package/dist/puck-editor/internal/plugins/agent-plugin/constants.d.ts +5 -0
  424. package/dist/puck-editor/internal/plugins/agent-plugin/constants.d.ts.map +1 -0
  425. package/dist/puck-editor/internal/plugins/agent-plugin/constants.js +3 -0
  426. package/dist/puck-editor/internal/plugins/agent-plugin/constants.js.map +1 -0
  427. package/dist/puck-editor/internal/plugins/agent-plugin/create-page.d.ts +17 -0
  428. package/dist/puck-editor/internal/plugins/agent-plugin/create-page.d.ts.map +1 -0
  429. package/dist/puck-editor/internal/plugins/agent-plugin/create-page.js +35 -0
  430. package/dist/puck-editor/internal/plugins/agent-plugin/create-page.js.map +1 -0
  431. package/dist/puck-editor/internal/plugins/agent-plugin/find-component-location.d.ts +19 -0
  432. package/dist/puck-editor/internal/plugins/agent-plugin/find-component-location.d.ts.map +1 -0
  433. package/dist/puck-editor/internal/plugins/agent-plugin/find-component-location.js +79 -0
  434. package/dist/puck-editor/internal/plugins/agent-plugin/find-component-location.js.map +1 -0
  435. package/dist/puck-editor/internal/plugins/agent-plugin/help.d.ts +2 -0
  436. package/dist/puck-editor/internal/plugins/agent-plugin/help.d.ts.map +1 -0
  437. package/dist/puck-editor/internal/plugins/agent-plugin/help.js +243 -0
  438. package/dist/puck-editor/internal/plugins/agent-plugin/help.js.map +1 -0
  439. package/dist/puck-editor/internal/plugins/agent-plugin/index.d.ts +2 -0
  440. package/dist/puck-editor/internal/plugins/agent-plugin/index.d.ts.map +1 -0
  441. package/dist/puck-editor/internal/plugins/agent-plugin/index.js +2 -0
  442. package/dist/puck-editor/internal/plugins/agent-plugin/index.js.map +1 -0
  443. package/dist/puck-editor/internal/plugins/agent-plugin/list-media.d.ts +19 -0
  444. package/dist/puck-editor/internal/plugins/agent-plugin/list-media.d.ts.map +1 -0
  445. package/dist/puck-editor/internal/plugins/agent-plugin/list-media.js +31 -0
  446. package/dist/puck-editor/internal/plugins/agent-plugin/list-media.js.map +1 -0
  447. package/dist/puck-editor/internal/plugins/agent-plugin/templates.d.ts +23 -0
  448. package/dist/puck-editor/internal/plugins/agent-plugin/templates.d.ts.map +1 -0
  449. package/dist/puck-editor/internal/plugins/agent-plugin/templates.js +72 -0
  450. package/dist/puck-editor/internal/plugins/agent-plugin/templates.js.map +1 -0
  451. package/dist/puck-editor/internal/plugins/agent-plugin/upload-media.d.ts +20 -0
  452. package/dist/puck-editor/internal/plugins/agent-plugin/upload-media.d.ts.map +1 -0
  453. package/dist/puck-editor/internal/plugins/agent-plugin/upload-media.js +34 -0
  454. package/dist/puck-editor/internal/plugins/agent-plugin/upload-media.js.map +1 -0
  455. package/dist/puck-editor/internal/plugins/agent-plugin/use-agent-handle.d.ts +17 -0
  456. package/dist/puck-editor/internal/plugins/agent-plugin/use-agent-handle.d.ts.map +1 -0
  457. package/dist/puck-editor/internal/plugins/agent-plugin/use-agent-handle.js +70 -0
  458. package/dist/puck-editor/internal/plugins/agent-plugin/use-agent-handle.js.map +1 -0
  459. package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-panel.d.ts +2 -0
  460. package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-panel.d.ts.map +1 -0
  461. package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-panel.js +37 -0
  462. package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-panel.js.map +1 -0
  463. package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-plugin.d.ts +7 -0
  464. package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-plugin.d.ts.map +1 -0
  465. package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-plugin.js +18 -0
  466. package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-plugin.js.map +1 -0
  467. package/dist/puck-editor/internal/plugins/blocks-plugin/index.d.ts +2 -0
  468. package/dist/puck-editor/internal/plugins/blocks-plugin/index.d.ts.map +1 -0
  469. package/dist/puck-editor/internal/plugins/blocks-plugin/index.js +2 -0
  470. package/dist/puck-editor/internal/plugins/blocks-plugin/index.js.map +1 -0
  471. package/dist/puck-editor/internal/plugins/outline-plugin/index.d.ts +2 -0
  472. package/dist/puck-editor/internal/plugins/outline-plugin/index.d.ts.map +1 -0
  473. package/dist/puck-editor/internal/plugins/outline-plugin/index.js +2 -0
  474. package/dist/puck-editor/internal/plugins/outline-plugin/index.js.map +1 -0
  475. package/dist/puck-editor/internal/plugins/outline-plugin/outline-panel.d.ts +2 -0
  476. package/dist/puck-editor/internal/plugins/outline-plugin/outline-panel.d.ts.map +1 -0
  477. package/dist/puck-editor/internal/plugins/outline-plugin/outline-panel.js +861 -0
  478. package/dist/puck-editor/internal/plugins/outline-plugin/outline-panel.js.map +1 -0
  479. package/dist/puck-editor/internal/plugins/outline-plugin/outline-plugin.d.ts +5 -0
  480. package/dist/puck-editor/internal/plugins/outline-plugin/outline-plugin.d.ts.map +1 -0
  481. package/dist/puck-editor/internal/plugins/outline-plugin/outline-plugin.js +16 -0
  482. package/dist/puck-editor/internal/plugins/outline-plugin/outline-plugin.js.map +1 -0
  483. package/dist/puck-editor/internal/plugins/outline-plugin/outline-tree.d.ts +53 -0
  484. package/dist/puck-editor/internal/plugins/outline-plugin/outline-tree.d.ts.map +1 -0
  485. package/dist/puck-editor/internal/plugins/outline-plugin/outline-tree.js +145 -0
  486. package/dist/puck-editor/internal/plugins/outline-plugin/outline-tree.js.map +1 -0
  487. package/dist/puck-editor/internal/plugins/sections-plugin/index.d.ts +2 -0
  488. package/dist/puck-editor/internal/plugins/sections-plugin/index.d.ts.map +1 -0
  489. package/dist/puck-editor/internal/plugins/sections-plugin/index.js +2 -0
  490. package/dist/puck-editor/internal/plugins/sections-plugin/index.js.map +1 -0
  491. package/dist/puck-editor/internal/plugins/sections-plugin/sections-panel.d.ts +2 -0
  492. package/dist/puck-editor/internal/plugins/sections-plugin/sections-panel.d.ts.map +1 -0
  493. package/dist/puck-editor/internal/plugins/sections-plugin/sections-panel.js +69 -0
  494. package/dist/puck-editor/internal/plugins/sections-plugin/sections-panel.js.map +1 -0
  495. package/dist/puck-editor/internal/plugins/sections-plugin/sections-plugin.d.ts +7 -0
  496. package/dist/puck-editor/internal/plugins/sections-plugin/sections-plugin.d.ts.map +1 -0
  497. package/dist/puck-editor/internal/plugins/sections-plugin/sections-plugin.js +18 -0
  498. package/dist/puck-editor/internal/plugins/sections-plugin/sections-plugin.js.map +1 -0
  499. package/dist/puck-editor/internal/plugins/templates-plugin/ai-options-fields.d.ts +6 -0
  500. package/dist/puck-editor/internal/plugins/templates-plugin/ai-options-fields.d.ts.map +1 -0
  501. package/dist/puck-editor/internal/plugins/templates-plugin/ai-options-fields.js +178 -0
  502. package/dist/puck-editor/internal/plugins/templates-plugin/ai-options-fields.js.map +1 -0
  503. package/dist/puck-editor/internal/plugins/templates-plugin/apply-vehicle-slot-constraints.d.ts +3 -0
  504. package/dist/puck-editor/internal/plugins/templates-plugin/apply-vehicle-slot-constraints.d.ts.map +1 -0
  505. package/dist/puck-editor/internal/plugins/templates-plugin/apply-vehicle-slot-constraints.js +55 -0
  506. package/dist/puck-editor/internal/plugins/templates-plugin/apply-vehicle-slot-constraints.js.map +1 -0
  507. package/dist/puck-editor/internal/plugins/templates-plugin/component-template-modal.d.ts +12 -0
  508. package/dist/puck-editor/internal/plugins/templates-plugin/component-template-modal.d.ts.map +1 -0
  509. package/dist/puck-editor/internal/plugins/templates-plugin/component-template-modal.js +125 -0
  510. package/dist/puck-editor/internal/plugins/templates-plugin/component-template-modal.js.map +1 -0
  511. package/dist/puck-editor/internal/plugins/templates-plugin/custom-template-list.d.ts +8 -0
  512. package/dist/puck-editor/internal/plugins/templates-plugin/custom-template-list.d.ts.map +1 -0
  513. package/dist/puck-editor/internal/plugins/templates-plugin/custom-template-list.js +582 -0
  514. package/dist/puck-editor/internal/plugins/templates-plugin/custom-template-list.js.map +1 -0
  515. package/dist/puck-editor/internal/plugins/templates-plugin/index.d.ts +6 -0
  516. package/dist/puck-editor/internal/plugins/templates-plugin/index.d.ts.map +1 -0
  517. package/dist/puck-editor/internal/plugins/templates-plugin/index.js +6 -0
  518. package/dist/puck-editor/internal/plugins/templates-plugin/index.js.map +1 -0
  519. package/dist/puck-editor/internal/plugins/templates-plugin/root-drop-zone.d.ts +4 -0
  520. package/dist/puck-editor/internal/plugins/templates-plugin/root-drop-zone.d.ts.map +1 -0
  521. package/dist/puck-editor/internal/plugins/templates-plugin/root-drop-zone.js +54 -0
  522. package/dist/puck-editor/internal/plugins/templates-plugin/root-drop-zone.js.map +1 -0
  523. package/dist/puck-editor/internal/plugins/templates-plugin/template-form.d.ts +11 -0
  524. package/dist/puck-editor/internal/plugins/templates-plugin/template-form.d.ts.map +1 -0
  525. package/dist/puck-editor/internal/plugins/templates-plugin/template-form.js +92 -0
  526. package/dist/puck-editor/internal/plugins/templates-plugin/template-form.js.map +1 -0
  527. package/dist/puck-editor/internal/plugins/templates-plugin/template-vehicles.d.ts +7 -0
  528. package/dist/puck-editor/internal/plugins/templates-plugin/template-vehicles.d.ts.map +1 -0
  529. package/dist/puck-editor/internal/plugins/templates-plugin/template-vehicles.js +30 -0
  530. package/dist/puck-editor/internal/plugins/templates-plugin/template-vehicles.js.map +1 -0
  531. package/dist/puck-editor/internal/plugins/templates-plugin/templates-panel.d.ts +2 -0
  532. package/dist/puck-editor/internal/plugins/templates-plugin/templates-panel.d.ts.map +1 -0
  533. package/dist/puck-editor/internal/plugins/templates-plugin/templates-panel.js +471 -0
  534. package/dist/puck-editor/internal/plugins/templates-plugin/templates-panel.js.map +1 -0
  535. package/dist/puck-editor/internal/plugins/templates-plugin/templates-plugin.d.ts +5 -0
  536. package/dist/puck-editor/internal/plugins/templates-plugin/templates-plugin.d.ts.map +1 -0
  537. package/dist/puck-editor/internal/plugins/templates-plugin/templates-plugin.js +16 -0
  538. package/dist/puck-editor/internal/plugins/templates-plugin/templates-plugin.js.map +1 -0
  539. package/dist/puck-editor/internal/plugins/templates-plugin/templates.d.ts +43 -0
  540. package/dist/puck-editor/internal/plugins/templates-plugin/templates.d.ts.map +1 -0
  541. package/dist/puck-editor/internal/plugins/templates-plugin/templates.js +115 -0
  542. package/dist/puck-editor/internal/plugins/templates-plugin/templates.js.map +1 -0
  543. package/dist/puck-editor/internal/plugins/templates-plugin/use-template-dnd.d.ts +9 -0
  544. package/dist/puck-editor/internal/plugins/templates-plugin/use-template-dnd.d.ts.map +1 -0
  545. package/dist/puck-editor/internal/plugins/templates-plugin/use-template-dnd.js +152 -0
  546. package/dist/puck-editor/internal/plugins/templates-plugin/use-template-dnd.js.map +1 -0
  547. package/dist/puck-editor/internal/plugins/templates-plugin/use-templates.d.ts +16 -0
  548. package/dist/puck-editor/internal/plugins/templates-plugin/use-templates.d.ts.map +1 -0
  549. package/dist/puck-editor/internal/plugins/templates-plugin/use-templates.js +134 -0
  550. package/dist/puck-editor/internal/plugins/templates-plugin/use-templates.js.map +1 -0
  551. package/dist/puck-editor/internal/puck-augmentation.d.ts +28 -0
  552. package/dist/puck-editor/internal/puck-augmentation.d.ts.map +1 -0
  553. package/dist/puck-editor/internal/puck-augmentation.js +7 -0
  554. package/dist/puck-editor/internal/puck-augmentation.js.map +1 -0
  555. package/dist/puck-editor/internal/puck-editor-provider.d.ts +12 -0
  556. package/dist/puck-editor/internal/puck-editor-provider.d.ts.map +1 -0
  557. package/dist/puck-editor/internal/puck-editor-provider.js +69 -0
  558. package/dist/puck-editor/internal/puck-editor-provider.js.map +1 -0
  559. package/dist/puck-editor/internal/puck-node.d.ts +29 -0
  560. package/dist/puck-editor/internal/puck-node.d.ts.map +1 -0
  561. package/dist/puck-editor/internal/puck-node.js +2 -0
  562. package/dist/puck-editor/internal/puck-node.js.map +1 -0
  563. package/dist/puck-editor/internal/puck-wrapper.d.ts +19 -0
  564. package/dist/puck-editor/internal/puck-wrapper.d.ts.map +1 -0
  565. package/dist/puck-editor/internal/puck-wrapper.js +270 -0
  566. package/dist/puck-editor/internal/puck-wrapper.js.map +1 -0
  567. package/dist/puck-editor/internal/render/cropped-image.d.ts +19 -0
  568. package/dist/puck-editor/internal/render/cropped-image.d.ts.map +1 -0
  569. package/dist/puck-editor/internal/render/cropped-image.js +126 -0
  570. package/dist/puck-editor/internal/render/cropped-image.js.map +1 -0
  571. package/dist/puck-editor/internal/smart-actions/index.d.ts +13 -0
  572. package/dist/puck-editor/internal/smart-actions/index.d.ts.map +1 -0
  573. package/dist/puck-editor/internal/smart-actions/index.js +29 -0
  574. package/dist/puck-editor/internal/smart-actions/index.js.map +1 -0
  575. package/dist/puck-editor/internal/smart-actions/new-page.d.ts +13 -0
  576. package/dist/puck-editor/internal/smart-actions/new-page.d.ts.map +1 -0
  577. package/dist/puck-editor/internal/smart-actions/new-page.js +80 -0
  578. package/dist/puck-editor/internal/smart-actions/new-page.js.map +1 -0
  579. package/dist/puck-editor/internal/smart-actions/open-puck-editor.d.ts +2 -0
  580. package/dist/puck-editor/internal/smart-actions/open-puck-editor.d.ts.map +1 -0
  581. package/dist/puck-editor/internal/smart-actions/open-puck-editor.js +65 -0
  582. package/dist/puck-editor/internal/smart-actions/open-puck-editor.js.map +1 -0
  583. package/dist/puck-editor/internal/ui/calendar.d.ts +9 -0
  584. package/dist/puck-editor/internal/ui/calendar.d.ts.map +1 -0
  585. package/dist/puck-editor/internal/ui/calendar.js +147 -0
  586. package/dist/puck-editor/internal/ui/calendar.js.map +1 -0
  587. package/dist/puck-editor/internal/ui/component-list-accordion.d.ts +13 -0
  588. package/dist/puck-editor/internal/ui/component-list-accordion.d.ts.map +1 -0
  589. package/dist/puck-editor/internal/ui/component-list-accordion.js +93 -0
  590. package/dist/puck-editor/internal/ui/component-list-accordion.js.map +1 -0
  591. package/dist/puck-editor/internal/ui/dialog.d.ts +20 -0
  592. package/dist/puck-editor/internal/ui/dialog.d.ts.map +1 -0
  593. package/dist/puck-editor/internal/ui/dialog.js +286 -0
  594. package/dist/puck-editor/internal/ui/dialog.js.map +1 -0
  595. package/dist/puck-editor/internal/ui/drawer-item-content.d.ts +11 -0
  596. package/dist/puck-editor/internal/ui/drawer-item-content.d.ts.map +1 -0
  597. package/dist/puck-editor/internal/ui/drawer-item-content.js +109 -0
  598. package/dist/puck-editor/internal/ui/drawer-item-content.js.map +1 -0
  599. package/dist/puck-editor/internal/ui/icon-button.d.ts +10 -0
  600. package/dist/puck-editor/internal/ui/icon-button.d.ts.map +1 -0
  601. package/dist/puck-editor/internal/ui/icon-button.js +72 -0
  602. package/dist/puck-editor/internal/ui/icon-button.js.map +1 -0
  603. package/dist/puck-editor/internal/ui/popover.d.ts +9 -0
  604. package/dist/puck-editor/internal/ui/popover.d.ts.map +1 -0
  605. package/dist/puck-editor/internal/ui/popover.js +165 -0
  606. package/dist/puck-editor/internal/ui/popover.js.map +1 -0
  607. package/dist/puck-editor/internal/ui/required-mark.d.ts +2 -0
  608. package/dist/puck-editor/internal/ui/required-mark.d.ts.map +1 -0
  609. package/dist/puck-editor/internal/ui/required-mark.js +12 -0
  610. package/dist/puck-editor/internal/ui/required-mark.js.map +1 -0
  611. package/dist/puck-editor/internal/ui/search-control.d.ts +20 -0
  612. package/dist/puck-editor/internal/ui/search-control.d.ts.map +1 -0
  613. package/dist/puck-editor/internal/ui/search-control.js +156 -0
  614. package/dist/puck-editor/internal/ui/search-control.js.map +1 -0
  615. package/dist/puck-editor/internal/ui/use-panel-search-focus.d.ts +2 -0
  616. package/dist/puck-editor/internal/ui/use-panel-search-focus.d.ts.map +1 -0
  617. package/dist/puck-editor/internal/ui/use-panel-search-focus.js +40 -0
  618. package/dist/puck-editor/internal/ui/use-panel-search-focus.js.map +1 -0
  619. package/dist/puck-editor/internal/use-puck-overlay.d.ts +16 -0
  620. package/dist/puck-editor/internal/use-puck-overlay.d.ts.map +1 -0
  621. package/dist/puck-editor/internal/use-puck-overlay.js +121 -0
  622. package/dist/puck-editor/internal/use-puck-overlay.js.map +1 -0
  623. package/dist/puck-editor/internal/utils.d.ts +6 -0
  624. package/dist/puck-editor/internal/utils.d.ts.map +1 -0
  625. package/dist/puck-editor/internal/utils.js +57 -0
  626. package/dist/puck-editor/internal/utils.js.map +1 -0
  627. package/dist/puck-editor/puck-theme.css +110 -0
  628. package/dist/puck-editor/render.d.ts +3 -0
  629. package/dist/puck-editor/render.d.ts.map +1 -0
  630. package/dist/puck-editor/render.js +2 -0
  631. package/dist/puck-editor/render.js.map +1 -0
  632. package/dist/puck-editor/server.d.ts +4 -0
  633. package/dist/puck-editor/server.d.ts.map +1 -0
  634. package/dist/puck-editor/server.js +4 -0
  635. package/dist/puck-editor/server.js.map +1 -0
  636. package/dist/puck-editor/smart-actions.d.ts +2 -0
  637. package/dist/puck-editor/smart-actions.d.ts.map +1 -0
  638. package/dist/puck-editor/smart-actions.js +2 -0
  639. package/dist/puck-editor/smart-actions.js.map +1 -0
  640. package/dist/shared/cn.d.ts +3 -0
  641. package/dist/shared/cn.d.ts.map +1 -0
  642. package/dist/shared/cn.js +9 -0
  643. package/dist/shared/cn.js.map +1 -0
  644. package/dist/shared/i18n.d.ts +5 -0
  645. package/dist/shared/i18n.d.ts.map +1 -0
  646. package/dist/shared/i18n.js +18 -0
  647. package/dist/shared/i18n.js.map +1 -0
  648. package/dist/shared/toolbar-action.d.ts +9 -0
  649. package/dist/shared/toolbar-action.d.ts.map +1 -0
  650. package/dist/shared/toolbar-action.js +2 -0
  651. package/dist/shared/toolbar-action.js.map +1 -0
  652. package/dist/smart-actions/internal/get-smart-actions-context.d.ts +19 -0
  653. package/dist/smart-actions/internal/get-smart-actions-context.d.ts.map +1 -0
  654. package/dist/smart-actions/internal/get-smart-actions-context.js +24 -0
  655. package/dist/smart-actions/internal/get-smart-actions-context.js.map +1 -0
  656. package/dist/smart-actions/internal/i18n.d.ts +20 -0
  657. package/dist/smart-actions/internal/i18n.d.ts.map +1 -0
  658. package/dist/smart-actions/internal/i18n.js +35 -0
  659. package/dist/smart-actions/internal/i18n.js.map +1 -0
  660. package/dist/smart-actions/internal/logout-form.d.ts +8 -0
  661. package/dist/smart-actions/internal/logout-form.d.ts.map +1 -0
  662. package/dist/smart-actions/internal/logout-form.js +88 -0
  663. package/dist/smart-actions/internal/logout-form.js.map +1 -0
  664. package/dist/smart-actions/internal/refresh-page.d.ts +2 -0
  665. package/dist/smart-actions/internal/refresh-page.d.ts.map +1 -0
  666. package/dist/smart-actions/internal/refresh-page.js +126 -0
  667. package/dist/smart-actions/internal/refresh-page.js.map +1 -0
  668. package/dist/smart-actions/internal/smart-actions-button.d.ts +24 -0
  669. package/dist/smart-actions/internal/smart-actions-button.d.ts.map +1 -0
  670. package/dist/smart-actions/internal/smart-actions-button.js +41 -0
  671. package/dist/smart-actions/internal/smart-actions-button.js.map +1 -0
  672. package/dist/smart-actions/internal/smart-actions-config.d.ts +13 -0
  673. package/dist/smart-actions/internal/smart-actions-config.d.ts.map +1 -0
  674. package/dist/smart-actions/internal/smart-actions-config.js +101 -0
  675. package/dist/smart-actions/internal/smart-actions-config.js.map +1 -0
  676. package/dist/smart-actions/internal/smart-actions-toolbar-client.d.ts +15 -0
  677. package/dist/smart-actions/internal/smart-actions-toolbar-client.d.ts.map +1 -0
  678. package/dist/smart-actions/internal/smart-actions-toolbar-client.js +71 -0
  679. package/dist/smart-actions/internal/smart-actions-toolbar-client.js.map +1 -0
  680. package/dist/smart-actions/internal/toolbar/smart-actions-toolbar.d.ts +13 -0
  681. package/dist/smart-actions/internal/toolbar/smart-actions-toolbar.d.ts.map +1 -0
  682. package/dist/smart-actions/internal/toolbar/smart-actions-toolbar.js +323 -0
  683. package/dist/smart-actions/internal/toolbar/smart-actions-toolbar.js.map +1 -0
  684. package/dist/smart-actions/internal/toolbar/storage.d.ts +7 -0
  685. package/dist/smart-actions/internal/toolbar/storage.d.ts.map +1 -0
  686. package/dist/smart-actions/internal/toolbar/storage.js +29 -0
  687. package/dist/smart-actions/internal/toolbar/storage.js.map +1 -0
  688. package/dist/smart-actions/internal/toolbar/types.d.ts +4 -0
  689. package/dist/smart-actions/internal/toolbar/types.d.ts.map +1 -0
  690. package/dist/smart-actions/internal/toolbar/types.js +2 -0
  691. package/dist/smart-actions/internal/toolbar/types.js.map +1 -0
  692. package/dist/smart-actions/internal/toolbar/use-smart-actions-toolbar-mode.d.ts +6 -0
  693. package/dist/smart-actions/internal/toolbar/use-smart-actions-toolbar-mode.d.ts.map +1 -0
  694. package/dist/smart-actions/internal/toolbar/use-smart-actions-toolbar-mode.js +43 -0
  695. package/dist/smart-actions/internal/toolbar/use-smart-actions-toolbar-mode.js.map +1 -0
  696. package/dist/smart-actions/internal/ui/tooltip.d.ts +8 -0
  697. package/dist/smart-actions/internal/ui/tooltip.d.ts.map +1 -0
  698. package/dist/smart-actions/internal/ui/tooltip.js +156 -0
  699. package/dist/smart-actions/internal/ui/tooltip.js.map +1 -0
  700. package/dist/smart-actions/internal/user-profile.d.ts +8 -0
  701. package/dist/smart-actions/internal/user-profile.d.ts.map +1 -0
  702. package/dist/smart-actions/internal/user-profile.js +30 -0
  703. package/dist/smart-actions/internal/user-profile.js.map +1 -0
  704. package/dist/smart-actions/server.d.ts +4 -0
  705. package/dist/smart-actions/server.d.ts.map +1 -0
  706. package/dist/smart-actions/server.js +4 -0
  707. package/dist/smart-actions/server.js.map +1 -0
  708. package/dist/theme.css +2 -0
  709. package/dist/visual-editor/index.d.ts +4 -0
  710. package/dist/visual-editor/index.d.ts.map +1 -0
  711. package/dist/visual-editor/index.js +4 -0
  712. package/dist/visual-editor/index.js.map +1 -0
  713. package/dist/visual-editor/internal/bridge/connector.d.ts +7 -0
  714. package/dist/visual-editor/internal/bridge/connector.d.ts.map +1 -0
  715. package/dist/visual-editor/internal/bridge/connector.js +72 -0
  716. package/dist/visual-editor/internal/bridge/connector.js.map +1 -0
  717. package/dist/visual-editor/internal/bridge/draft-mode-self-heal.d.ts +8 -0
  718. package/dist/visual-editor/internal/bridge/draft-mode-self-heal.d.ts.map +1 -0
  719. package/dist/visual-editor/internal/bridge/draft-mode-self-heal.js +44 -0
  720. package/dist/visual-editor/internal/bridge/draft-mode-self-heal.js.map +1 -0
  721. package/dist/visual-editor/internal/bridge/editor-auth-gate-server.d.ts +16 -0
  722. package/dist/visual-editor/internal/bridge/editor-auth-gate-server.d.ts.map +1 -0
  723. package/dist/visual-editor/internal/bridge/editor-auth-gate-server.js +43 -0
  724. package/dist/visual-editor/internal/bridge/editor-auth-gate-server.js.map +1 -0
  725. package/dist/visual-editor/internal/bridge/editor-auth-gate.d.ts +15 -0
  726. package/dist/visual-editor/internal/bridge/editor-auth-gate.d.ts.map +1 -0
  727. package/dist/visual-editor/internal/bridge/editor-auth-gate.js +146 -0
  728. package/dist/visual-editor/internal/bridge/editor-auth-gate.js.map +1 -0
  729. package/dist/visual-editor/internal/i18n.d.ts +29 -0
  730. package/dist/visual-editor/internal/i18n.d.ts.map +1 -0
  731. package/dist/visual-editor/internal/i18n.js +51 -0
  732. package/dist/visual-editor/internal/i18n.js.map +1 -0
  733. package/dist/visual-editor/internal/overlays/drupal-origin.d.ts +7 -0
  734. package/dist/visual-editor/internal/overlays/drupal-origin.d.ts.map +1 -0
  735. package/dist/visual-editor/internal/overlays/drupal-origin.js +15 -0
  736. package/dist/visual-editor/internal/overlays/drupal-origin.js.map +1 -0
  737. package/dist/visual-editor/internal/overlays/edit-button.d.ts +10 -0
  738. package/dist/visual-editor/internal/overlays/edit-button.d.ts.map +1 -0
  739. package/dist/visual-editor/internal/overlays/edit-button.js +138 -0
  740. package/dist/visual-editor/internal/overlays/edit-button.js.map +1 -0
  741. package/dist/visual-editor/internal/overlays/edit-icon.d.ts +3 -0
  742. package/dist/visual-editor/internal/overlays/edit-icon.d.ts.map +1 -0
  743. package/dist/visual-editor/internal/overlays/edit-icon.js +19 -0
  744. package/dist/visual-editor/internal/overlays/edit-icon.js.map +1 -0
  745. package/dist/visual-editor/internal/overlays/fragment/fragment-wrapper.d.ts +15 -0
  746. package/dist/visual-editor/internal/overlays/fragment/fragment-wrapper.d.ts.map +1 -0
  747. package/dist/visual-editor/internal/overlays/fragment/fragment-wrapper.js +52 -0
  748. package/dist/visual-editor/internal/overlays/fragment/fragment-wrapper.js.map +1 -0
  749. package/dist/visual-editor/internal/overlays/iframe-wrapper.d.ts +6 -0
  750. package/dist/visual-editor/internal/overlays/iframe-wrapper.d.ts.map +1 -0
  751. package/dist/visual-editor/internal/overlays/iframe-wrapper.js +42 -0
  752. package/dist/visual-editor/internal/overlays/iframe-wrapper.js.map +1 -0
  753. package/dist/visual-editor/internal/overlays/menu/menu-wrapper.d.ts +9 -0
  754. package/dist/visual-editor/internal/overlays/menu/menu-wrapper.d.ts.map +1 -0
  755. package/dist/visual-editor/internal/overlays/menu/menu-wrapper.js +33 -0
  756. package/dist/visual-editor/internal/overlays/menu/menu-wrapper.js.map +1 -0
  757. package/dist/visual-editor/internal/overlays/node/node-metadata.d.ts +13 -0
  758. package/dist/visual-editor/internal/overlays/node/node-metadata.d.ts.map +1 -0
  759. package/dist/visual-editor/internal/overlays/node/node-metadata.js +17 -0
  760. package/dist/visual-editor/internal/overlays/node/node-metadata.js.map +1 -0
  761. package/dist/visual-editor/internal/overlays/node/node-wrapper.d.ts +8 -0
  762. package/dist/visual-editor/internal/overlays/node/node-wrapper.d.ts.map +1 -0
  763. package/dist/visual-editor/internal/overlays/node/node-wrapper.js +25 -0
  764. package/dist/visual-editor/internal/overlays/node/node-wrapper.js.map +1 -0
  765. package/dist/visual-editor/internal/overlays/paragraph/paragraph-wrapper.d.ts +18 -0
  766. package/dist/visual-editor/internal/overlays/paragraph/paragraph-wrapper.d.ts.map +1 -0
  767. package/dist/visual-editor/internal/overlays/paragraph/paragraph-wrapper.js +58 -0
  768. package/dist/visual-editor/internal/overlays/paragraph/paragraph-wrapper.js.map +1 -0
  769. package/dist/visual-editor/internal/revalidate-route.d.ts +19 -0
  770. package/dist/visual-editor/internal/revalidate-route.d.ts.map +1 -0
  771. package/dist/visual-editor/internal/revalidate-route.js +51 -0
  772. package/dist/visual-editor/internal/revalidate-route.js.map +1 -0
  773. package/dist/visual-editor/server.d.ts +7 -0
  774. package/dist/visual-editor/server.d.ts.map +1 -0
  775. package/dist/visual-editor/server.js +8 -0
  776. package/dist/visual-editor/server.js.map +1 -0
  777. package/package.json +154 -0
@@ -0,0 +1,219 @@
1
+ 'use client';
2
+
3
+ import { useState } from 'react';
4
+ import { Button } from '@puckeditor/core';
5
+ import Cropper from 'react-easy-crop';
6
+ import { cn } from '../../../../shared/cn';
7
+ import { usePuckDictionary } from '../../i18n';
8
+ import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from '../../ui/dialog';
9
+ import { DEFAULT_ASPECT_RATIOS, parseAspectRatio } from './crop-types';
10
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
11
+ const BASE_TAB = 'base';
12
+ const round = n => Math.round(n * 10000) / 10000;
13
+ export function CropEditorDialog({
14
+ imageSrc,
15
+ config,
16
+ value,
17
+ onSave,
18
+ onClose
19
+ }) {
20
+ const t = usePuckDictionary().crop;
21
+ const aspectRatios = config.aspectRatios?.length ? config.aspectRatios : DEFAULT_ASPECT_RATIOS;
22
+ const breakpoints = config.breakpoints ?? [];
23
+ const [draft, setDraft] = useState(value);
24
+ const [tab, setTab] = useState(BASE_TAB);
25
+ const [ratio, setRatio] = useState(value?.base.ratio && aspectRatios.includes(value.base.ratio) ? value.base.ratio : aspectRatios[0]);
26
+ const [position, setPosition] = useState({
27
+ x: 0,
28
+ y: 0
29
+ });
30
+ const [zoom, setZoom] = useState(1);
31
+ const [mediaSize, setMediaSize] = useState(null);
32
+ const activeRegion = tab === BASE_TAB ? draft?.base : draft?.overrides?.[tab];
33
+ const isOverrideTab = tab !== BASE_TAB;
34
+ const showCropper = !isOverrideTab || !!activeRegion;
35
+ const aspect = ratio === 'original' ? mediaSize ? mediaSize.naturalWidth / mediaSize.naturalHeight : 1 : parseAspectRatio(ratio) ?? 1;
36
+ const initialArea = activeRegion && activeRegion.ratio === ratio ? {
37
+ x: activeRegion.x * 100,
38
+ y: activeRegion.y * 100,
39
+ width: activeRegion.width * 100,
40
+ height: activeRegion.height * 100
41
+ } : undefined;
42
+ const resetCropper = nextRatio => {
43
+ setRatio(nextRatio);
44
+ setPosition({
45
+ x: 0,
46
+ y: 0
47
+ });
48
+ setZoom(1);
49
+ };
50
+ const switchTab = key => {
51
+ setTab(key);
52
+ const region = key === BASE_TAB ? draft?.base : draft?.overrides?.[key];
53
+ resetCropper(region?.ratio && aspectRatios.includes(region.ratio) ? region.ratio : draft?.base.ratio ?? aspectRatios[0]);
54
+ };
55
+ const handleCropComplete = (area, areaPixels) => {
56
+ const region_0 = {
57
+ x: round(area.x / 100),
58
+ y: round(area.y / 100),
59
+ width: round(area.width / 100),
60
+ height: round(area.height / 100),
61
+ aspect: round(areaPixels.width / areaPixels.height) || 1,
62
+ ratio
63
+ };
64
+ setDraft(prev => tab === BASE_TAB ? {
65
+ base: region_0,
66
+ ...(prev?.overrides && {
67
+ overrides: prev.overrides
68
+ })
69
+ } : prev ? {
70
+ ...prev,
71
+ overrides: {
72
+ ...prev.overrides,
73
+ [tab]: region_0
74
+ }
75
+ } : prev);
76
+ };
77
+ const defineOverride = () => {
78
+ if (!draft?.base) return;
79
+ setDraft({
80
+ ...draft,
81
+ overrides: {
82
+ ...draft.overrides,
83
+ [tab]: {
84
+ ...draft.base
85
+ }
86
+ }
87
+ });
88
+ resetCropper(aspectRatios.includes(draft.base.ratio) ? draft.base.ratio : aspectRatios[0]);
89
+ };
90
+ const removeOverride = () => {
91
+ setDraft(prev_0 => {
92
+ if (!prev_0?.overrides) return prev_0;
93
+ const {
94
+ [tab]: _removed,
95
+ ...rest
96
+ } = prev_0.overrides;
97
+ return {
98
+ base: prev_0.base,
99
+ ...(Object.keys(rest).length && {
100
+ overrides: rest
101
+ })
102
+ };
103
+ });
104
+ };
105
+ return /*#__PURE__*/_jsx(Dialog, {
106
+ open: true,
107
+ onOpenChange: open => !open && onClose(),
108
+ children: /*#__PURE__*/_jsxs(DialogContent, {
109
+ className: "nh:max-w-2xl",
110
+ children: [/*#__PURE__*/_jsx(DialogHeader, {
111
+ children: /*#__PURE__*/_jsx(DialogTitle, {
112
+ children: t.title
113
+ })
114
+ }), breakpoints.length > 0 && /*#__PURE__*/_jsx("div", {
115
+ className: "nh:flex nh:items-center nh:gap-1 nh:border-b nh:border-gray-200",
116
+ children: [{
117
+ key: BASE_TAB,
118
+ label: t.desktop
119
+ }, ...breakpoints.map(bp => ({
120
+ key: bp.key,
121
+ label: bp.label ?? bp.key
122
+ }))].map(({
123
+ key: key_0,
124
+ label
125
+ }) => /*#__PURE__*/_jsxs("button", {
126
+ type: "button",
127
+ onClick: () => switchTab(key_0),
128
+ className: cn('nh:flex nh:cursor-pointer nh:items-center nh:gap-1.5 nh:border-b-2 nh:px-3 nh:py-1.5 nh:text-sm nh:capitalize', {
129
+ 'nh:border-(--nh-primary) nh:font-semibold': tab === key_0,
130
+ 'nh:border-transparent nh:text-gray-500 nh:hover:text-gray-900': tab !== key_0
131
+ }),
132
+ children: [label, key_0 !== BASE_TAB && draft?.overrides?.[key_0] && /*#__PURE__*/_jsx("span", {
133
+ className: "nh:size-1.5 nh:rounded-full nh:bg-(--nh-primary)"
134
+ })]
135
+ }, key_0))
136
+ }), showCropper ? /*#__PURE__*/_jsxs(_Fragment, {
137
+ children: [/*#__PURE__*/_jsxs("div", {
138
+ className: "nh:flex nh:flex-wrap nh:items-center nh:gap-4",
139
+ children: [/*#__PURE__*/_jsxs("label", {
140
+ className: "nh:flex nh:items-center nh:gap-2 nh:text-sm",
141
+ children: [t.format, /*#__PURE__*/_jsx("select", {
142
+ value: ratio,
143
+ onChange: e => resetCropper(e.target.value),
144
+ className: "nh:block nh:rounded-md nh:border nh:border-gray-300 nh:px-3 nh:py-1.5 nh:text-sm nh:shadow-sm",
145
+ children: aspectRatios.map(r => /*#__PURE__*/_jsx("option", {
146
+ value: r,
147
+ children: r === 'original' ? t.original : r.replace('/', ':')
148
+ }, r))
149
+ })]
150
+ }), /*#__PURE__*/_jsxs("label", {
151
+ className: "nh:flex nh:grow nh:items-center nh:gap-2 nh:text-sm",
152
+ children: [t.zoom, /*#__PURE__*/_jsx("input", {
153
+ type: "range",
154
+ min: 1,
155
+ max: 3,
156
+ step: 0.01,
157
+ value: zoom,
158
+ onChange: e_0 => setZoom(Number(e_0.target.value)),
159
+ className: "nh:grow nh:accent-(--nh-primary)"
160
+ })]
161
+ })]
162
+ }), /*#__PURE__*/_jsx("div", {
163
+ className: "nh:relative nh:h-80 nh:w-full nh:overflow-hidden nh:rounded-md nh:bg-neutral-900",
164
+ children: /*#__PURE__*/_jsx(Cropper, {
165
+ image: imageSrc,
166
+ crop: position,
167
+ zoom: zoom,
168
+ aspect: aspect,
169
+ onCropChange: setPosition,
170
+ onZoomChange: setZoom,
171
+ onCropComplete: handleCropComplete,
172
+ onMediaLoaded: setMediaSize,
173
+ initialCroppedAreaPercentages: initialArea,
174
+ showGrid: true
175
+ }, `${tab}:${ratio}`)
176
+ })]
177
+ }) : /*#__PURE__*/_jsxs("div", {
178
+ className: "nh:flex nh:h-80 nh:flex-col nh:items-center nh:justify-center nh:gap-3 nh:rounded-md nh:border nh:border-dashed nh:border-gray-300 nh:text-sm nh:text-gray-500",
179
+ children: [/*#__PURE__*/_jsx("p", {
180
+ children: t.usesDesktop
181
+ }), /*#__PURE__*/_jsx(Button, {
182
+ type: "button",
183
+ variant: "secondary",
184
+ onClick: defineOverride,
185
+ children: t.defineOverride
186
+ })]
187
+ }), /*#__PURE__*/_jsxs(DialogFooter, {
188
+ className: "nh:sm:justify-between",
189
+ children: [/*#__PURE__*/_jsx("div", {
190
+ children: isOverrideTab ? activeRegion && /*#__PURE__*/_jsx(Button, {
191
+ type: "button",
192
+ variant: "secondary",
193
+ onClick: removeOverride,
194
+ children: t.removeOverride
195
+ }) : value && /*#__PURE__*/_jsx(Button, {
196
+ type: "button",
197
+ variant: "secondary",
198
+ onClick: () => onSave(undefined),
199
+ children: t.removeCrop
200
+ })
201
+ }), /*#__PURE__*/_jsxs("div", {
202
+ className: "nh:flex nh:gap-2",
203
+ children: [/*#__PURE__*/_jsx(Button, {
204
+ type: "button",
205
+ variant: "secondary",
206
+ onClick: onClose,
207
+ children: t.cancel
208
+ }), /*#__PURE__*/_jsx(Button, {
209
+ type: "button",
210
+ onClick: () => onSave(draft),
211
+ disabled: !draft?.base,
212
+ children: t.apply
213
+ })]
214
+ })]
215
+ })]
216
+ })
217
+ });
218
+ }
219
+ //# sourceMappingURL=crop-editor-dialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crop-editor-dialog.js","names":["useState","Button","Cropper","cn","usePuckDictionary","Dialog","DialogContent","DialogFooter","DialogHeader","DialogTitle","DEFAULT_ASPECT_RATIOS","parseAspectRatio","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","BASE_TAB","round","n","Math","CropEditorDialog","imageSrc","config","value","onSave","onClose","t","crop","aspectRatios","length","breakpoints","draft","setDraft","tab","setTab","ratio","setRatio","base","includes","position","setPosition","x","y","zoom","setZoom","mediaSize","setMediaSize","activeRegion","overrides","isOverrideTab","showCropper","aspect","naturalWidth","naturalHeight","initialArea","width","height","undefined","resetCropper","nextRatio","switchTab","key","region","handleCropComplete","area","areaPixels","prev","defineOverride","removeOverride","_removed","rest","Object","keys","open","onOpenChange","children","className","title","label","desktop","map","bp","type","onClick","format","onChange","e","target","r","original","replace","min","max","step","Number","image","onCropChange","onZoomChange","onCropComplete","onMediaLoaded","initialCroppedAreaPercentages","showGrid","usesDesktop","variant","removeCrop","cancel","disabled","apply"],"sources":["../../../../../src/puck-editor/internal/fields/media-selector/crop-editor-dialog.tsx"],"sourcesContent":["'use client';\n\nimport { useState } from 'react';\nimport { Button } from '@puckeditor/core';\nimport Cropper, { type Area, type MediaSize } from 'react-easy-crop';\n\nimport { cn } from '../../../../shared/cn';\nimport { usePuckDictionary } from '../../i18n';\nimport {\n Dialog,\n DialogContent,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n} from '../../ui/dialog';\nimport {\n CropRegion,\n DEFAULT_ASPECT_RATIOS,\n MediaCrop,\n MediaCropConfig,\n parseAspectRatio,\n} from './crop-types';\n\nconst BASE_TAB = 'base';\nconst round = (n: number) => Math.round(n * 10000) / 10000;\n\ntype CropEditorDialogProps = {\n imageSrc: string;\n config: MediaCropConfig;\n value: MediaCrop | undefined;\n onSave: (crop: MediaCrop | undefined) => void;\n onClose: () => void;\n};\n\nexport function CropEditorDialog({\n imageSrc,\n config,\n value,\n onSave,\n onClose,\n}: CropEditorDialogProps) {\n const t = usePuckDictionary().crop;\n const aspectRatios = config.aspectRatios?.length\n ? config.aspectRatios\n : DEFAULT_ASPECT_RATIOS;\n const breakpoints = config.breakpoints ?? [];\n\n const [draft, setDraft] = useState<MediaCrop | undefined>(value);\n const [tab, setTab] = useState(BASE_TAB);\n const [ratio, setRatio] = useState(\n value?.base.ratio && aspectRatios.includes(value.base.ratio)\n ? value.base.ratio\n : aspectRatios[0]\n );\n const [position, setPosition] = useState({ x: 0, y: 0 });\n const [zoom, setZoom] = useState(1);\n const [mediaSize, setMediaSize] = useState<MediaSize | null>(null);\n\n const activeRegion = tab === BASE_TAB ? draft?.base : draft?.overrides?.[tab];\n const isOverrideTab = tab !== BASE_TAB;\n const showCropper = !isOverrideTab || !!activeRegion;\n\n const aspect =\n ratio === 'original'\n ? mediaSize\n ? mediaSize.naturalWidth / mediaSize.naturalHeight\n : 1\n : (parseAspectRatio(ratio) ?? 1);\n\n const initialArea =\n activeRegion && activeRegion.ratio === ratio\n ? {\n x: activeRegion.x * 100,\n y: activeRegion.y * 100,\n width: activeRegion.width * 100,\n height: activeRegion.height * 100,\n }\n : undefined;\n\n const resetCropper = (nextRatio: string) => {\n setRatio(nextRatio);\n setPosition({ x: 0, y: 0 });\n setZoom(1);\n };\n\n const switchTab = (key: string) => {\n setTab(key);\n const region = key === BASE_TAB ? draft?.base : draft?.overrides?.[key];\n resetCropper(\n region?.ratio && aspectRatios.includes(region.ratio)\n ? region.ratio\n : (draft?.base.ratio ?? aspectRatios[0])\n );\n };\n\n const handleCropComplete = (area: Area, areaPixels: Area) => {\n const region: CropRegion = {\n x: round(area.x / 100),\n y: round(area.y / 100),\n width: round(area.width / 100),\n height: round(area.height / 100),\n aspect: round(areaPixels.width / areaPixels.height) || 1,\n ratio,\n };\n setDraft((prev) =>\n tab === BASE_TAB\n ? {\n base: region,\n ...(prev?.overrides && { overrides: prev.overrides }),\n }\n : prev\n ? { ...prev, overrides: { ...prev.overrides, [tab]: region } }\n : prev\n );\n };\n\n const defineOverride = () => {\n if (!draft?.base) return;\n setDraft({\n ...draft,\n overrides: { ...draft.overrides, [tab]: { ...draft.base } },\n });\n resetCropper(\n aspectRatios.includes(draft.base.ratio)\n ? draft.base.ratio\n : aspectRatios[0]\n );\n };\n\n const removeOverride = () => {\n setDraft((prev) => {\n if (!prev?.overrides) return prev;\n const { [tab]: _removed, ...rest } = prev.overrides;\n return {\n base: prev.base,\n ...(Object.keys(rest).length && { overrides: rest }),\n };\n });\n };\n\n return (\n <Dialog open onOpenChange={(open) => !open && onClose()}>\n <DialogContent className=\"nh:max-w-2xl\">\n <DialogHeader>\n <DialogTitle>{t.title}</DialogTitle>\n </DialogHeader>\n\n {breakpoints.length > 0 && (\n <div className=\"nh:flex nh:items-center nh:gap-1 nh:border-b nh:border-gray-200\">\n {[\n { key: BASE_TAB, label: t.desktop },\n ...breakpoints.map((bp) => ({\n key: bp.key,\n label: bp.label ?? bp.key,\n })),\n ].map(({ key, label }) => (\n <button\n key={key}\n type=\"button\"\n onClick={() => switchTab(key)}\n className={cn(\n 'nh:flex nh:cursor-pointer nh:items-center nh:gap-1.5 nh:border-b-2 nh:px-3 nh:py-1.5 nh:text-sm nh:capitalize',\n {\n 'nh:border-(--nh-primary) nh:font-semibold': tab === key,\n 'nh:border-transparent nh:text-gray-500 nh:hover:text-gray-900':\n tab !== key,\n }\n )}\n >\n {label}\n {key !== BASE_TAB && draft?.overrides?.[key] && (\n <span className=\"nh:size-1.5 nh:rounded-full nh:bg-(--nh-primary)\" />\n )}\n </button>\n ))}\n </div>\n )}\n\n {showCropper ? (\n <>\n <div className=\"nh:flex nh:flex-wrap nh:items-center nh:gap-4\">\n <label className=\"nh:flex nh:items-center nh:gap-2 nh:text-sm\">\n {t.format}\n <select\n value={ratio}\n onChange={(e) => resetCropper(e.target.value)}\n className=\"nh:block nh:rounded-md nh:border nh:border-gray-300 nh:px-3 nh:py-1.5 nh:text-sm nh:shadow-sm\"\n >\n {aspectRatios.map((r) => (\n <option key={r} value={r}>\n {r === 'original' ? t.original : r.replace('/', ':')}\n </option>\n ))}\n </select>\n </label>\n <label className=\"nh:flex nh:grow nh:items-center nh:gap-2 nh:text-sm\">\n {t.zoom}\n <input\n type=\"range\"\n min={1}\n max={3}\n step={0.01}\n value={zoom}\n onChange={(e) => setZoom(Number(e.target.value))}\n className=\"nh:grow nh:accent-(--nh-primary)\"\n />\n </label>\n </div>\n <div className=\"nh:relative nh:h-80 nh:w-full nh:overflow-hidden nh:rounded-md nh:bg-neutral-900\">\n <Cropper\n key={`${tab}:${ratio}`}\n image={imageSrc}\n crop={position}\n zoom={zoom}\n aspect={aspect}\n onCropChange={setPosition}\n onZoomChange={setZoom}\n onCropComplete={handleCropComplete}\n onMediaLoaded={setMediaSize}\n initialCroppedAreaPercentages={initialArea}\n showGrid\n />\n </div>\n </>\n ) : (\n <div className=\"nh:flex nh:h-80 nh:flex-col nh:items-center nh:justify-center nh:gap-3 nh:rounded-md nh:border nh:border-dashed nh:border-gray-300 nh:text-sm nh:text-gray-500\">\n <p>{t.usesDesktop}</p>\n <Button type=\"button\" variant=\"secondary\" onClick={defineOverride}>\n {t.defineOverride}\n </Button>\n </div>\n )}\n\n <DialogFooter className=\"nh:sm:justify-between\">\n <div>\n {isOverrideTab\n ? activeRegion && (\n <Button\n type=\"button\"\n variant=\"secondary\"\n onClick={removeOverride}\n >\n {t.removeOverride}\n </Button>\n )\n : value && (\n <Button\n type=\"button\"\n variant=\"secondary\"\n onClick={() => onSave(undefined)}\n >\n {t.removeCrop}\n </Button>\n )}\n </div>\n <div className=\"nh:flex nh:gap-2\">\n <Button type=\"button\" variant=\"secondary\" onClick={onClose}>\n {t.cancel}\n </Button>\n <Button\n type=\"button\"\n onClick={() => onSave(draft)}\n disabled={!draft?.base}\n >\n {t.apply}\n </Button>\n </div>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":"AAAA,YAAY;;AAEZ,SAASA,QAAQ,QAAQ,OAAO;AAChC,SAASC,MAAM,QAAQ,kBAAkB;AACzC,OAAOC,OAAO,MAAqC,iBAAiB;AAEpE,SAASC,EAAE,QAAQ,uBAAuB;AAC1C,SAASC,iBAAiB,QAAQ,YAAY;AAC9C,SACEC,MAAM,EACNC,aAAa,EACbC,YAAY,EACZC,YAAY,EACZC,WAAW,QACN,iBAAiB;AACxB,SAEEC,qBAAqB,EAGrBC,gBAAgB,QACX,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA,EAAAC,QAAA,IAAAC,SAAA;AA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O,EAAEf,cAAe;YAAAO,QAAA,EAEvBjD,CAAC,CAAC0C;UAAc,CACX,CACT,GACD7C,KAAK,iBACHZ,IAAA,CAACZ,MAAM;YACLmF,IAAI,EAAC,QAAQ;YACbqB,OAAO,EAAC,WAAW;YACnBpB,OAAO,EAAEA,CAAA,KAAM3D,MAAM,CAACiC,SAAS,CAAE;YAAAkB,QAAA,EAEhCjD,CAAC,CAAC8E;UAAU,CACP;QACT,CACF,CAAC,eACN3F,KAAA;UAAK+D,SAAS,EAAC,kBAAkB;UAAAD,QAAA,gBAC/BhE,IAAA,CAACZ,MAAM;YAACmF,IAAI,EAAC,QAAQ;YAACqB,OAAO,EAAC,WAAW;YAACpB,OAAO,EAAE1D,OAAQ;YAAAkD,QAAA,EACxDjD,CAAC,CAAC+E;UAAM,CACH,CAAC,eACT9F,IAAA,CAACZ,MAAM;YACLmF,IAAI,EAAC,QAAQ;YACbC,OAAO,EAAEA,CAAA,KAAM3D,MAAM,CAACO,KAAK,CAAE;YAC7B2E,QAAQ,EAAE,CAAC3E,KAAK,EAAEM,IAAK;YAAAsC,QAAA,EAEtBjD,CAAC,CAACiF;UAAK,CACF,CAAC;QAAA,CACN,CAAC;MAAA,CACM,CAAC;IAAA,CACF;EAAC,CACV,CAAC;AAEb","ignoreList":[]}
@@ -0,0 +1,24 @@
1
+ export type CropRegion = {
2
+ x: number;
3
+ y: number;
4
+ width: number;
5
+ height: number;
6
+ aspect: number;
7
+ ratio: string;
8
+ };
9
+ export type MediaCrop = {
10
+ base: CropRegion;
11
+ overrides?: Record<string, CropRegion>;
12
+ };
13
+ export type CropBreakpoint = {
14
+ key: string;
15
+ maxWidth: number;
16
+ label?: string;
17
+ };
18
+ export type MediaCropConfig = {
19
+ aspectRatios?: string[];
20
+ breakpoints?: CropBreakpoint[];
21
+ };
22
+ export declare const DEFAULT_ASPECT_RATIOS: string[];
23
+ export declare function parseAspectRatio(ratio: string): number | undefined;
24
+ //# sourceMappingURL=crop-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crop-types.d.ts","sourceRoot":"","sources":["../../../../../src/puck-editor/internal/fields/media-selector/crop-types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG;IACvB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,UAAU,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,WAAW,CAAC,EAAE,cAAc,EAAE,CAAC;CAChC,CAAC;AAEF,eAAO,MAAM,qBAAqB,UAAqC,CAAC;AAExE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAKlE"}
@@ -0,0 +1,8 @@
1
+ export const DEFAULT_ASPECT_RATIOS = ['16/9', '4/3', '1/1', 'original'];
2
+ export function parseAspectRatio(ratio) {
3
+ if (ratio === 'original') return undefined;
4
+ const [w, h] = ratio.split('/').map(Number);
5
+ if (!w || !h) return undefined;
6
+ return w / h;
7
+ }
8
+ //# sourceMappingURL=crop-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crop-types.js","names":["DEFAULT_ASPECT_RATIOS","parseAspectRatio","ratio","undefined","w","h","split","map","Number"],"sources":["../../../../../src/puck-editor/internal/fields/media-selector/crop-types.ts"],"sourcesContent":["export type CropRegion = {\n x: number;\n y: number;\n width: number;\n height: number;\n aspect: number;\n ratio: string;\n};\n\nexport type MediaCrop = {\n base: CropRegion;\n overrides?: Record<string, CropRegion>;\n};\n\nexport type CropBreakpoint = {\n key: string;\n maxWidth: number;\n label?: string;\n};\n\nexport type MediaCropConfig = {\n aspectRatios?: string[];\n breakpoints?: CropBreakpoint[];\n};\n\nexport const DEFAULT_ASPECT_RATIOS = ['16/9', '4/3', '1/1', 'original'];\n\nexport function parseAspectRatio(ratio: string): number | undefined {\n if (ratio === 'original') return undefined;\n const [w, h] = ratio.split('/').map(Number);\n if (!w || !h) return undefined;\n return w / h;\n}\n"],"mappings":"AAyBA,OAAO,MAAMA,qBAAqB,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC;AAEvE,OAAO,SAASC,gBAAgBA,CAACC,KAAa,EAAsB;EAClE,IAAIA,KAAK,KAAK,UAAU,EAAE,OAAOC,SAAS;EAC1C,MAAM,CAACC,CAAC,EAAEC,CAAC,CAAC,GAAGH,KAAK,CAACI,KAAK,CAAC,GAAG,CAAC,CAACC,GAAG,CAACC,MAAM,CAAC;EAC3C,IAAI,CAACJ,CAAC,IAAI,CAACC,CAAC,EAAE,OAAOF,SAAS;EAC9B,OAAOC,CAAC,GAAGC,CAAC;AACd","ignoreList":[]}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Extracts specified fields from an object using dot notation paths
3
+ * @param obj - The source object
4
+ * @param fields - Array of property paths to extract (e.g., ['id', 'field_media_image.meta.alt'])
5
+ * @returns Object containing only the specified fields, or the original object if no fields specified
6
+ */
7
+ export declare function extractFields(obj: any, fields?: string[]): any;
8
+ //# sourceMappingURL=extract-fields.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract-fields.d.ts","sourceRoot":"","sources":["../../../../../src/puck-editor/internal/fields/media-selector/extract-fields.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,GAAG,CAgB9D"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Extracts specified fields from an object using dot notation paths
3
+ * @param obj - The source object
4
+ * @param fields - Array of property paths to extract (e.g., ['id', 'field_media_image.meta.alt'])
5
+ * @returns Object containing only the specified fields, or the original object if no fields specified
6
+ */
7
+ export function extractFields(obj, fields) {
8
+ // If no fields specified, return the entire object
9
+ if (!fields || fields.length === 0) {
10
+ return obj;
11
+ }
12
+ const result = {};
13
+ for (const field of fields) {
14
+ const value = getNestedProperty(obj, field);
15
+ if (value !== undefined) {
16
+ setNestedProperty(result, field, value);
17
+ }
18
+ }
19
+ return result;
20
+ }
21
+
22
+ /**
23
+ * Gets a nested property from an object using dot notation
24
+ * @param obj - The source object
25
+ * @param path - The property path (e.g., 'field_media_image.meta.alt')
26
+ * @returns The property value or undefined if not found
27
+ */
28
+ function getNestedProperty(obj, path) {
29
+ return path.split('.').reduce((current, key) => {
30
+ return current && current[key] !== undefined ? current[key] : undefined;
31
+ }, obj);
32
+ }
33
+
34
+ /**
35
+ * Sets a nested property in an object using dot notation
36
+ * @param obj - The target object
37
+ * @param path - The property path (e.g., 'field_media_image.meta.alt')
38
+ * @param value - The value to set
39
+ */
40
+ function setNestedProperty(obj, path, value) {
41
+ const keys = path.split('.');
42
+ const lastKey = keys.pop();
43
+ const target = keys.reduce((current, key) => {
44
+ if (!current[key] || typeof current[key] !== 'object') {
45
+ current[key] = {};
46
+ }
47
+ return current[key];
48
+ }, obj);
49
+ target[lastKey] = value;
50
+ }
51
+ //# sourceMappingURL=extract-fields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract-fields.js","names":["extractFields","obj","fields","length","result","field","value","getNestedProperty","undefined","setNestedProperty","path","split","reduce","current","key","keys","lastKey","pop","target"],"sources":["../../../../../src/puck-editor/internal/fields/media-selector/extract-fields.ts"],"sourcesContent":["/**\n * Extracts specified fields from an object using dot notation paths\n * @param obj - The source object\n * @param fields - Array of property paths to extract (e.g., ['id', 'field_media_image.meta.alt'])\n * @returns Object containing only the specified fields, or the original object if no fields specified\n */\nexport function extractFields(obj: any, fields?: string[]): any {\n // If no fields specified, return the entire object\n if (!fields || fields.length === 0) {\n return obj;\n }\n\n const result: any = {};\n\n for (const field of fields) {\n const value = getNestedProperty(obj, field);\n if (value !== undefined) {\n setNestedProperty(result, field, value);\n }\n }\n\n return result;\n}\n\n/**\n * Gets a nested property from an object using dot notation\n * @param obj - The source object\n * @param path - The property path (e.g., 'field_media_image.meta.alt')\n * @returns The property value or undefined if not found\n */\nfunction getNestedProperty(obj: any, path: string): any {\n return path.split('.').reduce((current, key) => {\n return current && current[key] !== undefined ? current[key] : undefined;\n }, obj);\n}\n\n/**\n * Sets a nested property in an object using dot notation\n * @param obj - The target object\n * @param path - The property path (e.g., 'field_media_image.meta.alt')\n * @param value - The value to set\n */\nfunction setNestedProperty(obj: any, path: string, value: any): void {\n const keys = path.split('.');\n const lastKey = keys.pop()!;\n\n const target = keys.reduce((current, key) => {\n if (!current[key] || typeof current[key] !== 'object') {\n current[key] = {};\n }\n return current[key];\n }, obj);\n\n target[lastKey] = value;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,aAAaA,CAACC,GAAQ,EAAEC,MAAiB,EAAO;EAC9D;EACA,IAAI,CAACA,MAAM,IAAIA,MAAM,CAACC,MAAM,KAAK,CAAC,EAAE;IAClC,OAAOF,GAAG;EACZ;EAEA,MAAMG,MAAW,GAAG,CAAC,CAAC;EAEtB,KAAK,MAAMC,KAAK,IAAIH,MAAM,EAAE;IAC1B,MAAMI,KAAK,GAAGC,iBAAiB,CAACN,GAAG,EAAEI,KAAK,CAAC;IAC3C,IAAIC,KAAK,KAAKE,SAAS,EAAE;MACvBC,iBAAiB,CAACL,MAAM,EAAEC,KAAK,EAAEC,KAAK,CAAC;IACzC;EACF;EAEA,OAAOF,MAAM;AACf;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAASG,iBAAiBA,CAACN,GAAQ,EAAES,IAAY,EAAO;EACtD,OAAOA,IAAI,CAACC,KAAK,CAAC,GAAG,CAAC,CAACC,MAAM,CAAC,CAACC,OAAO,EAAEC,GAAG,KAAK;IAC9C,OAAOD,OAAO,IAAIA,OAAO,CAACC,GAAG,CAAC,KAAKN,SAAS,GAAGK,OAAO,CAACC,GAAG,CAAC,GAAGN,SAAS;EACzE,CAAC,EAAEP,GAAG,CAAC;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAASQ,iBAAiBA,CAACR,GAAQ,EAAES,IAAY,EAAEJ,KAAU,EAAQ;EACnE,MAAMS,IAAI,GAAGL,IAAI,CAACC,KAAK,CAAC,GAAG,CAAC;EAC5B,MAAMK,OAAO,GAAGD,IAAI,CAACE,GAAG,CAAC,CAAE;EAE3B,MAAMC,MAAM,GAAGH,IAAI,CAACH,MAAM,CAAC,CAACC,OAAO,EAAEC,GAAG,KAAK;IAC3C,IAAI,CAACD,OAAO,CAACC,GAAG,CAAC,IAAI,OAAOD,OAAO,CAACC,GAAG,CAAC,KAAK,QAAQ,EAAE;MACrDD,OAAO,CAACC,GAAG,CAAC,GAAG,CAAC,CAAC;IACnB;IACA,OAAOD,OAAO,CAACC,GAAG,CAAC;EACrB,CAAC,EAAEb,GAAG,CAAC;EAEPiB,MAAM,CAACF,OAAO,CAAC,GAAGV,KAAK;AACzB","ignoreList":[]}
@@ -0,0 +1,7 @@
1
+ interface ImageUploadFormProps {
2
+ onCancel?: () => void;
3
+ onMediaAdded?: () => void;
4
+ }
5
+ export declare function ImageUploadForm({ onMediaAdded, onCancel, }: ImageUploadFormProps): import("react").JSX.Element;
6
+ export {};
7
+ //# sourceMappingURL=image-upload-form.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-upload-form.d.ts","sourceRoot":"","sources":["../../../../../src/puck-editor/internal/fields/media-selector/image-upload-form.tsx"],"names":[],"mappings":"AAaA,UAAU,oBAAoB;IAC5B,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,wBAAgB,eAAe,CAAC,EAC9B,YAAY,EACZ,QAAQ,GACT,EAAE,oBAAoB,+BA4JtB"}
@@ -0,0 +1,147 @@
1
+ 'use client';
2
+
3
+ import { useState } from 'react';
4
+ import { Button } from '@puckeditor/core';
5
+ import { uploadImageMedia } from '../../api/client';
6
+ import { usePuckDictionary } from '../../i18n';
7
+ import { RequiredMark } from '../../ui/required-mark';
8
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
+ const MAX_IMAGE_FILE_SIZE_BYTES = 5 * 1024 * 1024;
10
+ export function ImageUploadForm({
11
+ onMediaAdded,
12
+ onCancel
13
+ }) {
14
+ const {
15
+ mediaSelector
16
+ } = usePuckDictionary();
17
+ const [isPending, setIsPending] = useState(false);
18
+ const [message, setMessage] = useState('');
19
+ const [messageType, setMessageType] = useState(null);
20
+ const [formData, setFormData] = useState({
21
+ alt: '',
22
+ name: ''
23
+ });
24
+ const handleSubmit = async e => {
25
+ e.preventDefault();
26
+ setIsPending(true);
27
+ setMessage('');
28
+ setMessageType(null);
29
+ try {
30
+ const formElement = e.currentTarget;
31
+ const formData_0 = new FormData(formElement);
32
+ const result = await uploadImageMedia(formData_0);
33
+ if (result) {
34
+ setMessage(result.message);
35
+ if (result.success) {
36
+ setMessageType('success');
37
+ formElement.reset();
38
+ setFormData({
39
+ alt: '',
40
+ name: ''
41
+ });
42
+ if (onMediaAdded) {
43
+ onMediaAdded();
44
+ }
45
+ } else {
46
+ setMessageType('error');
47
+ }
48
+ }
49
+ } catch (error) {
50
+ setMessage(mediaSelector.uploadImageFailed);
51
+ setMessageType('error');
52
+ console.error(error);
53
+ } finally {
54
+ setIsPending(false);
55
+ }
56
+ };
57
+ const handleChange = e_0 => {
58
+ const {
59
+ name,
60
+ value
61
+ } = e_0.target;
62
+ setFormData(prev => ({
63
+ ...prev,
64
+ [name]: value
65
+ }));
66
+ };
67
+ return /*#__PURE__*/_jsxs("form", {
68
+ onSubmit: handleSubmit,
69
+ className: "nh:space-y-4",
70
+ children: [message && /*#__PURE__*/_jsx("div", {
71
+ className: `nh:rounded nh:p-2 nh:text-sm nh:font-medium ${messageType === 'success' ? 'nh:border nh:border-green-200 nh:bg-green-100 text-green-700' : 'nh:border nh:border-red-200 nh:bg-red-100 text-red-700'}`,
72
+ children: message
73
+ }), /*#__PURE__*/_jsxs("div", {
74
+ children: [/*#__PURE__*/_jsxs("label", {
75
+ htmlFor: "name",
76
+ className: "nh:block nh:text-sm nh:font-medium nh:text-gray-700",
77
+ children: [mediaSelector.name, /*#__PURE__*/_jsx(RequiredMark, {})]
78
+ }), /*#__PURE__*/_jsx("input", {
79
+ type: "text",
80
+ id: "name",
81
+ name: "name",
82
+ value: formData.name,
83
+ onChange: handleChange,
84
+ className: "nh:mt-1 nh:block nh:w-full nh:max-w-3xl nh:rounded-md nh:border-gray-300 nh:shadow-sm",
85
+ required: true
86
+ })]
87
+ }), /*#__PURE__*/_jsxs("div", {
88
+ children: [/*#__PURE__*/_jsxs("label", {
89
+ htmlFor: "file",
90
+ className: "nh:block nh:text-sm nh:font-medium nh:text-gray-700",
91
+ children: [mediaSelector.chooseImage, /*#__PURE__*/_jsx(RequiredMark, {})]
92
+ }), /*#__PURE__*/_jsx("input", {
93
+ type: "file",
94
+ id: "file",
95
+ name: "file",
96
+ accept: "image/*",
97
+ className: "nh:mt-1 nh:block nh:w-full nh:max-w-3xl nh:rounded-md nh:border nh:border-gray-300 nh:p-2 nh:shadow-sm",
98
+ required: true,
99
+ onChange: e_1 => {
100
+ const file = e_1.target.files?.[0];
101
+ if (!file) return;
102
+ if (file.size > MAX_IMAGE_FILE_SIZE_BYTES) {
103
+ e_1.target.setCustomValidity(mediaSelector.imageTooLarge);
104
+ e_1.target.reportValidity();
105
+ return;
106
+ }
107
+ e_1.target.setCustomValidity('');
108
+ },
109
+ onClick: e_2 => {
110
+ e_2.stopPropagation();
111
+ }
112
+ }), /*#__PURE__*/_jsx("p", {
113
+ className: "nh:mt-1 nh:text-sm nh:text-gray-500",
114
+ children: mediaSelector.maxFileSize
115
+ })]
116
+ }), /*#__PURE__*/_jsxs("div", {
117
+ children: [/*#__PURE__*/_jsx("label", {
118
+ htmlFor: "alt",
119
+ className: "nh:block nh:text-sm nh:font-medium nh:text-gray-700",
120
+ children: mediaSelector.altText
121
+ }), /*#__PURE__*/_jsx("input", {
122
+ type: "text",
123
+ id: "alt",
124
+ name: "alt",
125
+ value: formData.alt,
126
+ onChange: handleChange,
127
+ className: "nh:mt-1 nh:block nh:w-full nh:max-w-3xl nh:rounded-md nh:border-gray-300 nh:shadow-sm"
128
+ })]
129
+ }), /*#__PURE__*/_jsxs("div", {
130
+ className: "nh:mt-6 nh:flex nh:justify-between nh:gap-2",
131
+ children: [/*#__PURE__*/_jsx(Button, {
132
+ type: "button",
133
+ variant: "secondary",
134
+ onClick: onCancel,
135
+ children: mediaSelector.cancel
136
+ }), /*#__PURE__*/_jsx(Button, {
137
+ type: "submit",
138
+ disabled: isPending,
139
+ onClick: e_3 => {
140
+ e_3.stopPropagation();
141
+ },
142
+ children: isPending ? mediaSelector.uploading : mediaSelector.uploadImage
143
+ })]
144
+ })]
145
+ });
146
+ }
147
+ //# sourceMappingURL=image-upload-form.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-upload-form.js","names":["useState","Button","uploadImageMedia","usePuckDictionary","RequiredMark","jsx","_jsx","jsxs","_jsxs","MAX_IMAGE_FILE_SIZE_BYTES","ImageUploadForm","onMediaAdded","onCancel","mediaSelector","isPending","setIsPending","message","setMessage","messageType","setMessageType","formData","setFormData","alt","name","handleSubmit","e","preventDefault","formElement","currentTarget","FormData","result","success","reset","error","uploadImageFailed","console","handleChange","value","target","prev","onSubmit","className","children","htmlFor","type","id","onChange","required","chooseImage","accept","file","files","size","setCustomValidity","imageTooLarge","reportValidity","onClick","stopPropagation","maxFileSize","altText","variant","cancel","disabled","uploading","uploadImage"],"sources":["../../../../../src/puck-editor/internal/fields/media-selector/image-upload-form.tsx"],"sourcesContent":["'use client';\n\nimport { FormEvent, useState } from 'react';\nimport { Button } from '@puckeditor/core';\n\nimport { uploadImageMedia } from '../../api/client';\nimport { usePuckDictionary } from '../../i18n';\nimport { RequiredMark } from '../../ui/required-mark';\n\nconst MAX_IMAGE_FILE_SIZE_BYTES = 5 * 1024 * 1024;\n\ntype MessageType = 'success' | 'error' | null;\n\ninterface ImageUploadFormProps {\n onCancel?: () => void;\n onMediaAdded?: () => void;\n}\n\nexport function ImageUploadForm({\n onMediaAdded,\n onCancel,\n}: ImageUploadFormProps) {\n const { mediaSelector } = usePuckDictionary();\n const [isPending, setIsPending] = useState(false);\n const [message, setMessage] = useState('');\n const [messageType, setMessageType] = useState<MessageType>(null);\n const [formData, setFormData] = useState({\n alt: '',\n name: '',\n });\n\n const handleSubmit = async (e: FormEvent<HTMLFormElement>) => {\n e.preventDefault();\n setIsPending(true);\n setMessage('');\n setMessageType(null);\n\n try {\n const formElement = e.currentTarget;\n const formData = new FormData(formElement);\n\n const result = await uploadImageMedia(formData);\n\n if (result) {\n setMessage(result.message);\n if (result.success) {\n setMessageType('success');\n formElement.reset();\n setFormData({ alt: '', name: '' });\n if (onMediaAdded) {\n onMediaAdded();\n }\n } else {\n setMessageType('error');\n }\n }\n } catch (error) {\n setMessage(mediaSelector.uploadImageFailed);\n setMessageType('error');\n console.error(error);\n } finally {\n setIsPending(false);\n }\n };\n\n const handleChange = (\n e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>\n ) => {\n const { name, value } = e.target;\n setFormData((prev) => ({\n ...prev,\n [name]: value,\n }));\n };\n\n return (\n <form onSubmit={handleSubmit} className=\"nh:space-y-4\">\n {message && (\n <div\n className={`nh:rounded nh:p-2 nh:text-sm nh:font-medium ${\n messageType === 'success'\n ? 'nh:border nh:border-green-200 nh:bg-green-100 text-green-700'\n : 'nh:border nh:border-red-200 nh:bg-red-100 text-red-700'\n }`}\n >\n {message}\n </div>\n )}\n\n <div>\n <label\n htmlFor=\"name\"\n className=\"nh:block nh:text-sm nh:font-medium nh:text-gray-700\"\n >\n {mediaSelector.name}\n <RequiredMark />\n </label>\n <input\n type=\"text\"\n id=\"name\"\n name=\"name\"\n value={formData.name}\n onChange={handleChange}\n className=\"nh:mt-1 nh:block nh:w-full nh:max-w-3xl nh:rounded-md nh:border-gray-300 nh:shadow-sm\"\n required\n />\n </div>\n\n <div>\n <label\n htmlFor=\"file\"\n className=\"nh:block nh:text-sm nh:font-medium nh:text-gray-700\"\n >\n {mediaSelector.chooseImage}\n <RequiredMark />\n </label>\n <input\n type=\"file\"\n id=\"file\"\n name=\"file\"\n accept=\"image/*\"\n className=\"nh:mt-1 nh:block nh:w-full nh:max-w-3xl nh:rounded-md nh:border nh:border-gray-300 nh:p-2 nh:shadow-sm\"\n required\n onChange={(e) => {\n const file = e.target.files?.[0];\n if (!file) return;\n\n if (file.size > MAX_IMAGE_FILE_SIZE_BYTES) {\n e.target.setCustomValidity(mediaSelector.imageTooLarge);\n e.target.reportValidity();\n return;\n }\n\n e.target.setCustomValidity('');\n }}\n onClick={(e) => {\n e.stopPropagation();\n }}\n />\n <p className=\"nh:mt-1 nh:text-sm nh:text-gray-500\">\n {mediaSelector.maxFileSize}\n </p>\n </div>\n\n <div>\n <label\n htmlFor=\"alt\"\n className=\"nh:block nh:text-sm nh:font-medium nh:text-gray-700\"\n >\n {mediaSelector.altText}\n </label>\n <input\n type=\"text\"\n id=\"alt\"\n name=\"alt\"\n value={formData.alt}\n onChange={handleChange}\n className=\"nh:mt-1 nh:block nh:w-full nh:max-w-3xl nh:rounded-md nh:border-gray-300 nh:shadow-sm\"\n />\n </div>\n\n <div className=\"nh:mt-6 nh:flex nh:justify-between nh:gap-2\">\n <Button type=\"button\" variant=\"secondary\" onClick={onCancel}>\n {mediaSelector.cancel}\n </Button>\n <Button\n type=\"submit\"\n disabled={isPending}\n onClick={(e) => {\n e.stopPropagation();\n }}\n >\n {isPending ? mediaSelector.uploading : mediaSelector.uploadImage}\n </Button>\n </div>\n </form>\n );\n}\n"],"mappings":"AAAA,YAAY;;AAEZ,SAAoBA,QAAQ,QAAQ,OAAO;AAC3C,SAASC,MAAM,QAAQ,kBAAkB;AAEzC,SAASC,gBAAgB,QAAQ,kBAAkB;AACnD,SAASC,iBAAiB,QAAQ,YAAY;AAC9C,SAASC,YAAY,QAAQ,wBAAwB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEtD,MAAMC,yBAAyB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI;AASjD,OAAO,SAASC,eAAeA,CAAC;EAC9BC,YAAY;EACZC;AACoB,CAAC,EAAE;EACvB,MAAM;IAAEC;EAAc,CAAC,GAAGV,iBAAiB,CAAC,CAAC;EAC7C,MAAM,CAACW,SAAS,EAAEC,YAAY,CAAC,GAAGf,QAAQ,CAAC,KAAK,CAAC;EACjD,MAAM,CAACgB,OAAO,EAAEC,UAAU,CAAC,GAAGjB,QAAQ,CAAC,EAAE,CAAC;EAC1C,MAAM,CAACkB,WAAW,EAAEC,cAAc,CAAC,GAAGnB,QAAQ,CAAc,IAAI,CAAC;EACjE,MAAM,CAACoB,QAAQ,EAAEC,WAAW,CAAC,GAAGrB,QAAQ,CAAC;IACvCsB,GAAG,EAAE,EAAE;IACPC,IAAI,EAAE;EACR,CAAC,CAAC;EAEF,MAAMC,YAAY,GAAG,MAAOC,CAA6B,IAAK;IAC5DA,CAAC,CAACC,cAAc,CAAC,CAAC;IAClBX,YAAY,CAAC,IAAI,CAAC;IAClBE,UAAU,CAAC,EAAE,CAAC;IACdE,cAAc,CAAC,IAAI,CAAC;IAEpB,IAAI;MACF,MAAMQ,WAAW,GAAGF,CAAC,CAACG,aAAa;MACnC,MAAMR,UAAQ,GAAG,IAAIS,QAAQ,CAACF,WAAW,CAAC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6C;MAAW,CACzB,CAAC;IAAA,CACD,CAAC,eAENlD,KAAA;MAAAkC,QAAA,gBACEpC,IAAA;QACEqC,OAAO,EAAC,KAAK;QACbF,SAAS,EAAC,qDAAqD;QAAAC,QAAA,EAE9D7B,aAAa,CAAC8C;MAAO,CACjB,CAAC,eACRrD,IAAA;QACEsC,IAAI,EAAC,MAAM;QACXC,EAAE,EAAC,KAAK;QACRtB,IAAI,EAAC,KAAK;QACVc,KAAK,EAAEjB,QAAQ,CAACE,GAAI;QACpBwB,QAAQ,EAAEV,YAAa;QACvBK,SAAS,EAAC;MAAuF,CAClG,CAAC;IAAA,CACC,CAAC,eAENjC,KAAA;MAAKiC,SAAS,EAAC,6CAA6C;MAAAC,QAAA,gBAC1DpC,IAAA,CAACL,MAAM;QAAC2C,IAAI,EAAC,QAAQ;QAACgB,OAAO,EAAC,WAAW;QAACJ,OAAO,EAAE5C,QAAS;QAAA8B,QAAA,EACzD7B,aAAa,CAACgD;MAAM,CACf,CAAC,eACTvD,IAAA,CAACL,MAAM;QACL2C,IAAI,EAAC,QAAQ;QACbkB,QAAQ,EAAEhD,SAAU;QACpB0C,OAAO,EAAG/B,GAAC,IAAK;UACdA,GAAC,CAACgC,eAAe,CAAC,CAAC;QACrB,CAAE;QAAAf,QAAA,EAED5B,SAAS,GAAGD,aAAa,CAACkD,SAAS,GAAGlD,aAAa,CAACmD;MAAW,CAC1D,CAAC;IAAA,CACN,CAAC;EAAA,CACF,CAAC;AAEX","ignoreList":[]}
@@ -0,0 +1,30 @@
1
+ import type { MediaCrop, MediaCropConfig } from './crop-types';
2
+ export type MediaItem = {
3
+ id: string;
4
+ type: string;
5
+ name?: string;
6
+ thumbnailImage?: string;
7
+ thumbnail?: {
8
+ uri?: {
9
+ url?: string;
10
+ };
11
+ };
12
+ field_media_image?: {
13
+ uri?: {
14
+ url?: string;
15
+ };
16
+ };
17
+ crop?: MediaCrop;
18
+ };
19
+ export declare function deriveThumbnailImage(value: MediaItem | null, drupalBaseUrl: string): string | undefined;
20
+ type MediaSelectorFieldProps = {
21
+ onChange: (value: MediaItem | null) => void;
22
+ value: MediaItem | null;
23
+ mediaTypes: string[];
24
+ label?: string;
25
+ fields?: string[];
26
+ cropConfig?: MediaCropConfig;
27
+ };
28
+ export declare function MediaSelectorField({ onChange, value, mediaTypes, label, fields, cropConfig, }: MediaSelectorFieldProps): import("react").JSX.Element;
29
+ export {};
30
+ //# sourceMappingURL=media-selector-field.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media-selector-field.d.ts","sourceRoot":"","sources":["../../../../../src/puck-editor/internal/fields/media-selector/media-selector-field.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAI/D,MAAM,MAAM,SAAS,GAAG;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE;YAAE,GAAG,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC;IACvC,iBAAiB,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE;YAAE,GAAG,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC;IAC/C,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB,CAAC;AAEF,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,SAAS,GAAG,IAAI,EACvB,aAAa,EAAE,MAAM,GACpB,MAAM,GAAG,SAAS,CAMpB;AAED,KAAK,uBAAuB,GAAG;IAC7B,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,KAAK,IAAI,CAAC;IAC5C,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;IACxB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,CAAC,EAAE,eAAe,CAAC;CAC9B,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,EACjC,QAAQ,EACR,KAAK,EACL,UAAU,EACV,KAAK,EACL,MAAM,EACN,UAAU,GACX,EAAE,uBAAuB,+BAkYzB"}