@chaibuilder/sdk 3.2.13 → 4.0.0-beta.10

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 (193) hide show
  1. package/README.md +88 -61
  2. package/dist/2SSKDMRQ-CfHqXEo6.cjs +1 -0
  3. package/dist/2SSKDMRQ-KxbQMSQF.js +42 -0
  4. package/dist/AP7HFJJL-B3bVbF4b.cjs +1228 -0
  5. package/dist/AP7HFJJL-DJe0zNfP.js +9214 -0
  6. package/dist/IconPicker-7YKi0cvf.cjs +1 -0
  7. package/dist/IconPicker-CaEjFuuU.js +60 -0
  8. package/dist/STRINGS-BExFecZW.js +8 -0
  9. package/dist/STRINGS-FNnfjF5H.cjs +1 -0
  10. package/dist/WDYDFRGG-4MvQxrrE.cjs +1 -0
  11. package/dist/WDYDFRGG-DesO-YVt.js +33 -0
  12. package/dist/_commonjsHelpers-C6fGbg64.js +6 -0
  13. package/dist/_commonjsHelpers-DwGv2jUC.cjs +1 -0
  14. package/dist/actions-registery-BRgseJas.cjs +418 -0
  15. package/dist/actions-registery-DRV8xywr.js +15540 -0
  16. package/dist/actions.cjs +1 -0
  17. package/dist/actions.d.ts +3229 -0
  18. package/dist/actions.js +216 -0
  19. package/dist/active-in-another-tab-BraPCVHD.js +35 -0
  20. package/dist/active-in-another-tab-DmiLcoHl.cjs +1 -0
  21. package/dist/add-new-language-page-BiS0BJFh.cjs +1 -0
  22. package/dist/add-new-language-page-DaNJhujm.js +402 -0
  23. package/dist/add-new-page-BavGPTWz.js +31 -0
  24. package/dist/add-new-page-dbDUyekW.cjs +1 -0
  25. package/dist/ai-panel-content-4Cv-ufXL.js +62 -0
  26. package/dist/ai-panel-content-ClQ5alrF.cjs +1 -0
  27. package/dist/ai-panel-default-lang-BVgCW7Iu.cjs +3 -0
  28. package/dist/ai-panel-default-lang-CByGoNp5.js +341 -0
  29. package/dist/ai-panel-other-lang-BXuiVjMR.cjs +1 -0
  30. package/dist/ai-panel-other-lang-DznZUrL7.js +162 -0
  31. package/dist/ai-prompt-input--MqeAtTu.cjs +1 -0
  32. package/dist/ai-prompt-input-DbNqAJmK.js +656 -0
  33. package/dist/ai-translation-prompt-CqZE5xvG.js +28 -0
  34. package/dist/ai-translation-prompt-yU9T98gu.cjs +1 -0
  35. package/dist/{apply-binding-DLaiD20q.js → apply-binding-CLU6Xp4K.js} +251 -257
  36. package/dist/apply-binding-NvZX_rJe.cjs +1 -0
  37. package/dist/code-display-9Onx6RCq.cjs +1 -0
  38. package/dist/{code-display-DuH-UOhl.js → code-display-oa1j0ri7.js} +1 -1
  39. package/dist/code-editor-DI5chGQy.js +51 -0
  40. package/dist/code-editor-eJ-ha21X.cjs +1 -0
  41. package/dist/continue-editing-in-this-client-BIPyGnqp.cjs +1 -0
  42. package/dist/continue-editing-in-this-client-Bs9Q2ase.js +25 -0
  43. package/dist/core-8lkXy4lC.cjs +1 -0
  44. package/dist/core-BvsZwF26.js +52 -0
  45. package/dist/core.cjs +1 -1
  46. package/dist/core.d.ts +145 -565
  47. package/dist/core.js +24 -103
  48. package/dist/css-import-modal-Cwq__qKK.cjs +13 -0
  49. package/dist/{css-import-modal-CFB2YjDT.js → css-import-modal-D-_jby_w.js} +40 -38
  50. package/dist/{delete-design-token-BjMakV-b.js → delete-design-token-BowiWJOb.js} +3 -3
  51. package/dist/delete-design-token-DjHXH5dg.cjs +1 -0
  52. package/dist/delete-page-Cs0cenoN.js +71 -0
  53. package/dist/delete-page-DqBuzcBW.cjs +1 -0
  54. package/dist/design-token-usage-DDqd3J3T.cjs +1 -0
  55. package/dist/design-token-usage-cjJe9KUU.js +114 -0
  56. package/dist/digital-asset-manager-DjPTwqCP.cjs +1 -0
  57. package/dist/digital-asset-manager-rw_FW-e4.js +877 -0
  58. package/dist/duplicate-page-B19XZEEh.js +134 -0
  59. package/dist/duplicate-page-CpgDT34h.cjs +1 -0
  60. package/dist/dynamic-page-selector-CJXMaEu0.cjs +1 -0
  61. package/dist/dynamic-page-selector-D1pcyyIi.js +86 -0
  62. package/dist/fonts-B-Xt29pe.cjs +1 -0
  63. package/dist/fonts-DRly3Wzd.js +78 -0
  64. package/dist/get-chai-builder-tailwind-config-DNp8Vhme.cjs +1 -0
  65. package/dist/{get-chai-builder-tailwind-config-BqaIvg8p.js → get-chai-builder-tailwind-config-k8l5sdcw.js} +14 -11
  66. package/dist/get-chai-builder-theme-BApShjRz.cjs +1 -0
  67. package/dist/get-chai-builder-theme-DDVRJQ6Z.js +24 -0
  68. package/dist/get-seo-defaults-9zHebckY.js +65 -0
  69. package/dist/get-seo-defaults-Cw7vFt-B.cjs +1 -0
  70. package/dist/image-compression-DZ9WMmyn.cjs +1 -0
  71. package/dist/image-compression-DsZ1oqpb.js +37 -0
  72. package/dist/image-editor-BihtCpkn.cjs +1 -0
  73. package/dist/image-editor-lztBulYI.js +108 -0
  74. package/dist/index-BEldAI1n.cjs +160 -0
  75. package/dist/index-BqlDf5fg.js +18418 -0
  76. package/dist/index-CsChke2B.js +4741 -0
  77. package/dist/index-DTz1hNwi.cjs +5 -0
  78. package/dist/json-diff-viewer-BDbS64LG.cjs +8 -0
  79. package/dist/json-diff-viewer-DI6nPbs8.js +259 -0
  80. package/dist/lang-panel-B51V4-PX.js +216 -0
  81. package/dist/lang-panel-DFttT_MB.cjs +1 -0
  82. package/dist/manage-design-tokens-D8GDkdB2.cjs +1 -0
  83. package/dist/{manage-design-tokens-BHCCrWFS.js → manage-design-tokens-DCPswHMS.js} +24 -24
  84. package/dist/mark-as-template-DBF2r7aW.js +157 -0
  85. package/dist/mark-as-template-rI-cx5-B.cjs +1 -0
  86. package/dist/models-5gOsRC56.cjs +1 -0
  87. package/dist/models-D95ZYr_x.js +70 -0
  88. package/dist/nested-path-selector-content-BQhK20BE.js +88 -0
  89. package/dist/nested-path-selector-content-o7k86m-q.cjs +1 -0
  90. package/dist/no-language-page-content-C2hLFt7A.js +43 -0
  91. package/dist/no-language-page-content-DmgQLhac.cjs +1 -0
  92. package/dist/no-language-page-dialog-BmB5fz92.js +10 -0
  93. package/dist/no-language-page-dialog-D2Ijv2V4.cjs +1 -0
  94. package/dist/page-creator-CGxrkmut.js +796 -0
  95. package/dist/page-creator-jlPEOhfz.cjs +1 -0
  96. package/dist/page-lock-CnOS_qxc.js +30 -0
  97. package/dist/page-lock-CoAmLhTA.cjs +1 -0
  98. package/dist/page-locked-dialog-B2L9yqX1.js +136 -0
  99. package/dist/page-locked-dialog-BNHr0OAi.cjs +1 -0
  100. package/dist/page-manager-new-CkNowPYt.cjs +1 -0
  101. package/dist/page-manager-new-D_TxW1yk.js +395 -0
  102. package/dist/page-manager-search-and-filter-Bme84N1w.js +202 -0
  103. package/dist/page-manager-search-and-filter-CpjNOQqF.cjs +1 -0
  104. package/dist/page-revisions-content-B_EkI6eN.js +456 -0
  105. package/dist/page-revisions-content-DYt-0IJ3.cjs +1 -0
  106. package/dist/pages.cjs +1 -0
  107. package/dist/pages.d.ts +545 -0
  108. package/dist/pages.js +27 -0
  109. package/dist/plugin-BGlQf0iy.cjs +22 -0
  110. package/dist/{plugin-BOcGV_IY.js → plugin-C-ht41UZ.js} +31 -45
  111. package/dist/publish-pages-content-1_-8jO3C.cjs +1 -0
  112. package/dist/publish-pages-content-Ct-rYFXD.js +179 -0
  113. package/dist/register-chai-top-bar-CX_JkRJn.js +237 -0
  114. package/dist/register-chai-top-bar-DWTuRU53.cjs +1 -0
  115. package/dist/register-partial-type-BjtdfKHE.js +36 -0
  116. package/dist/register-partial-type-ig9fUWIJ.cjs +1 -0
  117. package/dist/render.cjs +2 -2
  118. package/dist/render.d.ts +25 -23
  119. package/dist/render.js +108 -103
  120. package/dist/rte-widget-modal-88x3Ag4b.cjs +1 -0
  121. package/dist/rte-widget-modal-BpjTwrAJ.js +39 -0
  122. package/dist/runtime-client.cjs +1 -0
  123. package/dist/runtime-client.d.ts +158 -0
  124. package/dist/runtime-client.js +32 -0
  125. package/dist/runtime.cjs +1 -1
  126. package/dist/runtime.d.ts +322 -7
  127. package/dist/runtime.js +74 -1
  128. package/dist/save-to-lib-B5ggugo6.js +423 -0
  129. package/dist/save-to-lib-BSCJSBw9.cjs +1 -0
  130. package/dist/sdk.css +1 -1
  131. package/dist/selected-block-display-DrMFz5_U.js +320 -0
  132. package/dist/selected-block-display-wHwP16Pz.cjs +16 -0
  133. package/dist/seo-panel-Bktda7aV.cjs +2 -0
  134. package/dist/seo-panel-Dzx-sUAi.js +799 -0
  135. package/dist/shared-json-ld-BMt3lSVf.js +566 -0
  136. package/dist/shared-json-ld-RDvoItXK.cjs +1 -0
  137. package/dist/slug-input-BtbW6w7B.cjs +1 -0
  138. package/dist/slug-input-CyKRaEV_.js +87 -0
  139. package/dist/supabase-actions.cjs +1 -0
  140. package/dist/supabase-actions.d.ts +289 -0
  141. package/dist/supabase-actions.js +524 -0
  142. package/dist/take-over-request-BA_e938L.js +64 -0
  143. package/dist/take-over-request-DsDWVplQ.cjs +1 -0
  144. package/dist/theme-panel-footer-6iHKSeON.cjs +1 -0
  145. package/dist/theme-panel-footer-v8PRUzwR.js +26 -0
  146. package/dist/translation-warning-modal-B1tAPMx7.js +27 -0
  147. package/dist/translation-warning-modal-DA7Vj_9F.cjs +1 -0
  148. package/dist/types.cjs +1 -0
  149. package/dist/types.d.ts +598 -0
  150. package/dist/types.js +1 -0
  151. package/dist/unmark-as-template-Bdg5nLBS.cjs +1 -0
  152. package/dist/unmark-as-template-C6pllRk5.js +40 -0
  153. package/dist/unpublish-page-BOrfamLs.cjs +1 -0
  154. package/dist/unpublish-page-C3Wub7gR.js +28 -0
  155. package/dist/use-page-expand-manager-B6XTvk0E.cjs +1 -0
  156. package/dist/use-page-expand-manager-Cf4MUEJw.js +85 -0
  157. package/dist/utils.cjs +1 -0
  158. package/dist/{tailwind.d.ts → utils.d.ts} +12 -12
  159. package/dist/utils.js +7 -0
  160. package/dist/web-blocks.cjs +1 -1
  161. package/dist/web-blocks.d.ts +0 -6
  162. package/dist/web-blocks.js +240 -239
  163. package/dist/web-preview-869kgvNU.cjs +1 -0
  164. package/dist/web-preview-CVAQ53g_.js +73 -0
  165. package/package.json +152 -76
  166. package/dist/IconPicker-6JSublJp.js +0 -64
  167. package/dist/IconPicker-DpQQDK_Q.cjs +0 -1
  168. package/dist/apply-binding-Bn1KC8uC.cjs +0 -1
  169. package/dist/code-display-Dw1tAwiJ.cjs +0 -1
  170. package/dist/code-editor-CEsA4Nlq.cjs +0 -1
  171. package/dist/code-editor-DPr4HDOV.js +0 -59
  172. package/dist/css-import-modal-bGWZSlqv.cjs +0 -13
  173. package/dist/delete-design-token-Bzxspf8D.cjs +0 -1
  174. package/dist/design-token-usage-DyQcFypc.cjs +0 -1
  175. package/dist/design-token-usage-_FBnvL92.js +0 -120
  176. package/dist/get-chai-builder-tailwind-config-C6MHaUM0.cjs +0 -1
  177. package/dist/get-chai-builder-theme-B1tr_NJB.cjs +0 -1
  178. package/dist/get-chai-builder-theme-BarMkcGH.js +0 -12
  179. package/dist/index-CIez6R-d.js +0 -18327
  180. package/dist/index-zLw6cVaV.cjs +0 -160
  181. package/dist/manage-design-tokens-Cfjg_at9.cjs +0 -1
  182. package/dist/mockServiceWorker.js +0 -349
  183. package/dist/plugin-CSgw-f78.cjs +0 -22
  184. package/dist/rte-widget-modal-CsBCpJSY.js +0 -41
  185. package/dist/rte-widget-modal-Dif3ZoFQ.cjs +0 -1
  186. package/dist/tailwind.cjs +0 -1
  187. package/dist/tailwind.js +0 -8
  188. package/dist/tooltip-Ba1-8jmj.cjs +0 -1
  189. package/dist/tooltip-DUosa-uC.js +0 -1067
  190. package/dist/ui.cjs +0 -1
  191. package/dist/ui.d.ts +0 -415
  192. package/dist/ui.js +0 -129
  193. package/dist/vite.svg +0 -1
@@ -1,6 +1,7 @@
1
- import { getAllRegisteredFonts as b } from "@chaibuilder/runtime";
2
- import { uniqBy as l, keys as h, flatten as v, get as B } from "lodash-es";
3
- const O = {
1
+ import { uniqBy as s, get as b, flatten as v, keys as B } from "lodash-es";
2
+ import { a as _ } from "./fonts-DRly3Wzd.js";
3
+ import { g as h } from "./_commonjsHelpers-C6fGbg64.js";
4
+ const x = {
4
5
  fontFamily: {
5
6
  "font-heading": "Inter",
6
7
  "font-body": "Inter"
@@ -100,7 +101,7 @@ const O = {
100
101
  "popover-foreground": ["#09090B", "#FFFFFF"]
101
102
  }
102
103
  }, q = (r) => ({
103
- fontFamily: r.fontFamily ? h(r.fontFamily).reduce(
104
+ fontFamily: r.fontFamily ? B(r.fontFamily).reduce(
104
105
  (e, n) => ({
105
106
  ...e,
106
107
  [n.replace("font-", "")]: `var(--${n})`
@@ -117,12 +118,12 @@ const O = {
117
118
  {}
118
119
  ) : {}
119
120
  });
120
- function p(r) {
121
+ function m(r) {
121
122
  const t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(r);
122
123
  let e = parseInt(t[1], 16), n = parseInt(t[2], 16), F = parseInt(t[3], 16);
123
124
  e /= 255, n /= 255, F /= 255;
124
125
  const o = Math.max(e, n, F), u = Math.min(e, n, F);
125
- let a, d;
126
+ let a = 0, d = 0;
126
127
  const g = (o + u) / 2;
127
128
  if (o == u)
128
129
  a = d = 0;
@@ -143,22 +144,22 @@ function p(r) {
143
144
  }
144
145
  return `${Math.round(a * 360)} ${Math.round(d * 100)}% ${Math.round(g * 100)}%`;
145
146
  }
146
- const _ = (r) => {
147
- const e = b().find((n) => n.family === r);
148
- return `"${r}", ${B(e, "fallback", "")}`;
149
- }, S = (r) => `:root {
150
- ${r.fontFamily && Object.entries(r.fontFamily).map(([t, e]) => `--font-${t}: ${_(e)};`).join(`
147
+ const E = (r) => {
148
+ const e = _().find((n) => n.family === r);
149
+ return `"${r}", ${b(e, "fallback", "")}`;
150
+ }, O = (r) => `:root {
151
+ ${r.fontFamily && Object.entries(r.fontFamily).map(([t, e]) => `--font-${t}: ${E(e)};`).join(`
151
152
  `)}
152
153
  ${r.borderRadius && `--radius: ${r.borderRadius};`}
153
- ${r.colors && Object.entries(r.colors).map(([t, e]) => `--${t}: ${p(e[0])};`).join(`
154
+ ${r.colors && Object.entries(r.colors).map(([t, e]) => `--${t}: ${m(e[0])};`).join(`
154
155
  `)}
155
156
  }
156
157
  .dark {
157
- ${r.colors && Object.entries(r.colors).map(([t, e]) => `--${t}: ${p(e[1])};`).join(`
158
+ ${r.colors && Object.entries(r.colors).map(([t, e]) => `--${t}: ${m(e[1])};`).join(`
158
159
  `)}
159
- }`, w = (r) => !r || r.length === 0 ? "" : l(r, "family").map((t) => `<link rel="stylesheet" href="${t.url}" />`).join(`
160
- `), x = (r) => !r || r.length === 0 ? [] : l(r, "family").map((t) => t.url), D = (r) => !r || r.length === 0 ? "" : l(r, "family").map((t) => `@import url("${t.url}");`).join(`
161
- `), L = (r) => !r || r.length === 0 ? "" : l(r, "family").map(
160
+ }`, S = (r) => !r || r.length === 0 ? "" : s(r, "family").map((t) => `<link rel="stylesheet" href="${t.url}" />`).join(`
161
+ `), D = (r) => !r || r.length === 0 ? [] : s(r, "family").map((t) => t.url), w = (r) => !r || r.length === 0 ? "" : s(r, "family").map((t) => `@import url("${t.url}");`).join(`
162
+ `), L = (r) => !r || r.length === 0 ? "" : s(r, "family").map(
162
163
  (t) => t.src.map(
163
164
  (e) => `@font-face {
164
165
  font-family: "${t.family}";
@@ -172,12 +173,9 @@ const _ = (r) => {
172
173
  `)
173
174
  ).join(`
174
175
  `);
175
- function E(r) {
176
- return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
177
- }
178
- var s = {}, c = {}, m;
176
+ var l = {}, c = {}, p;
179
177
  function P() {
180
- return m || (m = 1, function(r) {
178
+ return p || (p = 1, (function(r) {
181
179
  Object.defineProperty(r, "__esModule", {
182
180
  value: !0
183
181
  }), Object.defineProperty(r, "default", {
@@ -203,11 +201,11 @@ function P() {
203
201
  return o.__isOptionsFunction = !0, o.__pluginFunction = n, o.__configFunction = F, o;
204
202
  };
205
203
  const e = t;
206
- }(c)), c;
204
+ })(c)), c;
207
205
  }
208
206
  var y;
209
207
  function A() {
210
- return y || (y = 1, function(r) {
208
+ return y || (y = 1, (function(r) {
211
209
  Object.defineProperty(r, "__esModule", {
212
210
  value: !0
213
211
  }), Object.defineProperty(r, "default", {
@@ -223,7 +221,7 @@ function A() {
223
221
  };
224
222
  }
225
223
  const n = t.default;
226
- }(s)), s;
224
+ })(l)), l;
227
225
  }
228
226
  var f, $;
229
227
  function j() {
@@ -233,27 +231,15 @@ function j() {
233
231
  return f = (r.__esModule ? r : { default: r }).default, f;
234
232
  }
235
233
  var C = j();
236
- const M = /* @__PURE__ */ E(C), V = M(function({ addBase: r, theme: t }) {
237
- r({
238
- "h1,h2,h3,h4,h5,h6": {
239
- fontFamily: t("fontFamily.heading")
240
- },
241
- body: {
242
- fontFamily: t("fontFamily.body"),
243
- color: t("colors.foreground"),
244
- backgroundColor: t("colors.background")
245
- }
246
- });
247
- });
234
+ const V = /* @__PURE__ */ h(C);
248
235
  export {
249
- S as a,
250
- D as b,
251
- V as c,
252
- O as d,
253
- w as e,
254
- I as f,
236
+ O as a,
237
+ w as b,
238
+ S as c,
239
+ x as d,
240
+ I as e,
241
+ D as f,
255
242
  q as g,
256
- x as h,
257
- L as i,
258
- M as p
243
+ L as h,
244
+ V as p
259
245
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),q=require("./register-chai-top-bar-DWTuRU53.cjs"),f=require("./index-BEldAI1n.cjs"),r=require("./index-DTz1hNwi.cjs"),U=require("./page-manager-search-and-filter-CpjNOQqF.cjs"),F=require("@tanstack/react-query"),t=require("lodash-es"),b=require("lucide-react"),a=require("react"),M=()=>{const l=r.useApiUrl(),d=r.useFetch();return F.useQuery({queryKey:[r.ACTIONS.GET_CHANGES],queryFn:async()=>d(l,{action:r.ACTIONS.GET_CHANGES})})},G=({page:l,selectedPages:d,handleCheckboxChange:N,getPageType:y,hasSlug:h,currentOwnerId:c})=>{const x=r.useUserId(),{data:u}=r.useChaiUserInfo(c),o=c===x?null:u==null?void 0:u.name;return e.jsxs("tr",{className:"group relative border-b last:border-b-0 hover:bg-gray-50",children:[e.jsxs("td",{scope:"row",className:`flex items-center gap-x-1 whitespace-nowrap px-6 py-2 text-gray-900 dark:text-white ${o?"opacity-50":""}`,children:[o?e.jsx(b.Lock,{className:"h-4 w-4 fill-red-200 text-red-500"}):e.jsx("input",{checked:t.includes(d,l==null?void 0:l.id),onClick:p=>{p.stopPropagation(),N(l==null?void 0:l.id)},type:"checkbox",className:"cursor-pointer rounded focus:outline-none focus:ring-0"})," ",h(l.pageType)?e.jsx(b.File,{className:"h-4 w-4"}):e.jsx(b.GlobeIcon,{className:"h-4 w-4"}),e.jsx(r.Tooltip,{content:l.name,side:"top",showTooltip:l.name.length>25,children:e.jsx("span",{className:"max-w-[200px] truncate font-medium text-black",children:l.name})}),l.slug&&e.jsx(r.Tooltip,{content:l.slug,side:"top",showTooltip:l.slug.length>25,children:e.jsx("span",{className:"max-w-[200px] truncate font-mono text-xs text-muted-foreground",children:l.slug})})]}),e.jsx("td",{className:"px-2",children:y(l==null?void 0:l.pageType)}),e.jsx("td",{className:"px-4 text-right",children:t.first(l.changes)||""}),e.jsx(e.Fragment,{children:o&&e.jsxs("button",{className:"absolute right-0 top-0 flex h-full items-center gap-x-1 rounded bg-red-50 px-2 py-0.5 text-xs font-light text-red-500 opacity-0 group-hover:opacity-100",children:[e.jsx(b.Edit,{size:12,className:"stroke-[3]"})," ",e.jsx("span",{className:"font-medium",children:o})," is editing this page"]})})]},l==null?void 0:l.id)},O=({onClose:l=()=>{},isPending:d,publishPage:N})=>{const y=r.useUserId(),{pageToUser:h}=r.usePageToUser(),[c,x]=a.useState([]),u=r.useFallbackLang(),[o,p]=a.useState(u),{data:T,isFetching:C}=M(),{data:m}=r.usePageTypes(),k=a.useCallback(s=>{var n;return(n=t.find(m,{key:s}))==null?void 0:n.hasSlug},[m]),j=a.useMemo(()=>t.filter(m,s=>!k(s.key)).map(s=>s.key),[k,m]),P=t.uniq(t.map(T,"lang")).filter(Boolean),i=a.useMemo(()=>t.filter(T,s=>s.pageType==="theme"?!1:o===u?s.lang===o||s.lang==="":s.lang===o),[T,o,u]),w=a.useMemo(()=>t.filter(i,s=>!j.includes(s.pageType)),[i,j]),S=a.useMemo(()=>t.filter(i,s=>j.includes(s.pageType)),[i,j]);a.useEffect(()=>{const s=t.map(t.filter(i,{online:!0}),"id");a.startTransition(()=>x(s))},[i]),a.useEffect(()=>{const s=t.filter(t.keys(h),n=>t.get(h,[n,"userId"])!==y);a.startTransition(()=>x(n=>t.filter(n,g=>!t.includes(s,g))))},[h,y]);const v=c.length===(i==null?void 0:i.length),E=s=>{x(n=>t.includes(n,s)?t.filter(n,g=>g!==s):t.concat(n,s))},B=()=>{x(v?[]:t.map(i,"id"))},I=()=>{N({ids:t.uniq(c)},{onSuccess:()=>{l(),r.throwConfetti("CENTER_CENTER"),p(u)}})},A=s=>{if(s==="theme")return"Theme";const n=t.find(m,{key:s});return n?n==null?void 0:n.name:s},L=a.useMemo(()=>{const s=[{label:"Updated",top:"pt-2"},...t.orderBy(t.filter(w,{online:!0}),"pageType"),...t.orderBy(t.filter(S,{online:!0}),"pageType")].filter(g=>g.pageType!=="theme"),n=[{label:"Offline",top:"pt-6"},...t.orderBy(t.filter(w,{online:!1}),"pageType"),...t.orderBy(t.filter(S,{online:!1}),"pageType")];return[...s,...n]},[w,S]);return e.jsxs(f.DialogContent,{className:"flex max-h-[80%] max-w-4xl flex-col",children:[e.jsxs(f.DialogHeader,{children:[e.jsx(f.DialogTitle,{children:"Publish changes"}),e.jsx(f.DialogDescription,{className:"text-xs",children:"Select the pages you want to publish. Click publish when you're done."})]}),P.length>0&&e.jsx("div",{className:"my-[2px] mt-0",children:e.jsx(U.LanguageSelector,{languages:[u,...P],selectedLanguage:o,setSelectedLanguage:p})}),e.jsx("div",{className:"no-scrollbar relative -mx-4 -mt-4 h-full max-h-full overflow-y-auto",children:C?e.jsxs("div",{className:"space-y-2 px-1",children:[e.jsx("div",{className:"mt-2 h-6 w-full animate-pulse rounded bg-gray-200"}),e.jsx("div",{className:"h-6 w-full animate-pulse rounded bg-gray-200"}),e.jsx("div",{className:"h-6 w-full animate-pulse rounded bg-gray-200"}),e.jsx("div",{className:"h-6 w-full animate-pulse rounded bg-gray-200"})]}):e.jsxs("table",{className:"w-full text-left text-xs text-gray-500 dark:text-gray-400 rtl:text-right",children:[e.jsx("thead",{className:"sticky top-0 z-10 border-b bg-gray-50 text-gray-700 dark:bg-gray-700 dark:text-gray-400",children:e.jsxs("tr",{children:[e.jsxs("th",{scope:"col",className:"w-[1 50px] flex items-center gap-x-2 px-6 py-3",children:[e.jsx("input",{checked:v,onClick:s=>{s.stopPropagation(),B()},type:"checkbox",className:"mt-1 cursor-pointer rounded focus:outline-none focus:ring-0"}),"Name"]}),e.jsx("th",{scope:"col",className:"w-[150px] px-2 py-3",children:"Type"}),e.jsx("th",{scope:"col",className:"w-[150px] px-4 py-3 text-right",children:"Status"})]})}),e.jsx("tbody",{children:t.map(L,s=>s.label?e.jsx("tr",{children:e.jsxs("td",{colSpan:3,className:`relative px-6 py-2 text-xs font-medium text-gray-800 ${s.top}`,children:[e.jsx("div",{className:"absolute inset-0 left-6 flex items-center",children:e.jsx("div",{className:"order-gray-300 w-full"})}),e.jsx("div",{className:"relative flex justify-start",children:e.jsx("span",{className:"bg-gray-50 pr-2",children:s.label})})]})},"separator"):e.jsx(G,{page:s,selectedPages:c,handleCheckboxChange:E,getPageType:A,hasSlug:k,currentOwnerId:t.get(h,[(s==null?void 0:s.primaryPage)||(s==null?void 0:s.id),"userId"])}))})]})}),e.jsxs(f.DialogFooter,{className:"mt-10 flex items-center justify-center",children:[c.length>0&&e.jsxs("span",{className:"text-center text-sm text-muted-foreground",children:[c.length," Page",c.length!==1?"s":""," Selected"]}),e.jsx(q.Button,{disabled:d,variant:"outline",onClick:l,children:"Cancel"}),e.jsx(q.Button,{disabled:d||C||t.isEmpty(c),onClick:I,children:d?"Publishing...":"Publish Selected"})]})]})};exports.default=O;
@@ -0,0 +1,179 @@
1
+ import { jsxs as n, jsx as t, Fragment as $ } from "react/jsx-runtime";
2
+ import { B as L } from "./register-chai-top-bar-CX_JkRJn.js";
3
+ import { d as K, e as Q, f as J, p as V, q as W } from "./index-BqlDf5fg.js";
4
+ import { ar as X, as as Y, A as I, aA as O, aB as Z, k as ee, m as te, ap as se, T as U, t as le } from "./index-CsChke2B.js";
5
+ import { LanguageSelector as ae } from "./page-manager-search-and-filter-Bme84N1w.js";
6
+ import { useQuery as ne } from "@tanstack/react-query";
7
+ import { find as B, filter as a, map as b, keys as re, get as F, includes as C, orderBy as N, isEmpty as oe, uniq as G, first as ce, concat as ie } from "lodash-es";
8
+ import { Lock as de, GlobeIcon as ue, File as me, Edit as he } from "lucide-react";
9
+ import { useState as D, useCallback as pe, useMemo as g, useEffect as j, startTransition as q } from "react";
10
+ const ge = () => {
11
+ const s = X(), d = Y();
12
+ return ne({
13
+ queryKey: [I.GET_CHANGES],
14
+ queryFn: async () => d(s, { action: I.GET_CHANGES })
15
+ });
16
+ }, fe = ({ page: s, selectedPages: d, handleCheckboxChange: k, getPageType: f, hasSlug: m, currentOwnerId: r }) => {
17
+ const u = O(), { data: i } = se(r), o = r === u ? null : i == null ? void 0 : i.name;
18
+ return /* @__PURE__ */ n("tr", { className: "group relative border-b last:border-b-0 hover:bg-gray-50", children: [
19
+ /* @__PURE__ */ n(
20
+ "td",
21
+ {
22
+ scope: "row",
23
+ className: `flex items-center gap-x-1 whitespace-nowrap px-6 py-2 text-gray-900 dark:text-white ${o ? "opacity-50" : ""}`,
24
+ children: [
25
+ o ? /* @__PURE__ */ t(de, { className: "h-4 w-4 fill-red-200 text-red-500" }) : /* @__PURE__ */ t(
26
+ "input",
27
+ {
28
+ checked: C(d, s == null ? void 0 : s.id),
29
+ onClick: (x) => {
30
+ x.stopPropagation(), k(s == null ? void 0 : s.id);
31
+ },
32
+ type: "checkbox",
33
+ className: "cursor-pointer rounded focus:outline-none focus:ring-0"
34
+ }
35
+ ),
36
+ " ",
37
+ m(s.pageType) ? /* @__PURE__ */ t(me, { className: "h-4 w-4" }) : /* @__PURE__ */ t(ue, { className: "h-4 w-4" }),
38
+ /* @__PURE__ */ t(U, { content: s.name, side: "top", showTooltip: s.name.length > 25, children: /* @__PURE__ */ t("span", { className: "max-w-[200px] truncate font-medium text-black", children: s.name }) }),
39
+ s.slug && /* @__PURE__ */ t(U, { content: s.slug, side: "top", showTooltip: s.slug.length > 25, children: /* @__PURE__ */ t("span", { className: "max-w-[200px] truncate font-mono text-xs text-muted-foreground", children: s.slug }) })
40
+ ]
41
+ }
42
+ ),
43
+ /* @__PURE__ */ t("td", { className: "px-2", children: f(s == null ? void 0 : s.pageType) }),
44
+ /* @__PURE__ */ t("td", { className: "px-4 text-right", children: ce(s.changes) || "" }),
45
+ /* @__PURE__ */ t($, { children: o && /* @__PURE__ */ n("button", { className: "absolute right-0 top-0 flex h-full items-center gap-x-1 rounded bg-red-50 px-2 py-0.5 text-xs font-light text-red-500 opacity-0 group-hover:opacity-100", children: [
46
+ /* @__PURE__ */ t(he, { size: 12, className: "stroke-[3]" }),
47
+ " ",
48
+ /* @__PURE__ */ t("span", { className: "font-medium", children: o }),
49
+ " is editing this page"
50
+ ] }) })
51
+ ] }, s == null ? void 0 : s.id);
52
+ }, ve = ({
53
+ onClose: s = () => {
54
+ },
55
+ isPending: d,
56
+ publishPage: k
57
+ }) => {
58
+ const f = O(), { pageToUser: m } = Z(), [r, u] = D([]), i = ee(), [o, x] = D(i), { data: w, isFetching: v } = ge(), { data: h } = te(), T = pe((e) => {
59
+ var l;
60
+ return (l = B(h, { key: e })) == null ? void 0 : l.hasSlug;
61
+ }, [h]), y = g(
62
+ () => a(h, (e) => !T(e.key)).map((e) => e.key),
63
+ [T, h]
64
+ ), E = G(b(w, "lang")).filter(Boolean), c = g(
65
+ () => a(w, (e) => e.pageType === "theme" ? !1 : o === i ? e.lang === o || e.lang === "" : e.lang === o),
66
+ [w, o, i]
67
+ ), S = g(
68
+ () => a(c, (e) => !y.includes(e.pageType)),
69
+ [c, y]
70
+ ), P = g(
71
+ () => a(c, (e) => y.includes(e.pageType)),
72
+ [c, y]
73
+ );
74
+ j(() => {
75
+ const e = b(a(c, { online: !0 }), "id");
76
+ q(() => u(e));
77
+ }, [c]), j(() => {
78
+ const e = a(re(m), (l) => F(m, [l, "userId"]) !== f);
79
+ q(() => u((l) => a(l, (p) => !C(e, p))));
80
+ }, [m, f]);
81
+ const A = r.length === (c == null ? void 0 : c.length), H = (e) => {
82
+ u((l) => C(l, e) ? a(l, (p) => p !== e) : ie(l, e));
83
+ }, z = () => {
84
+ u(A ? [] : b(c, "id"));
85
+ }, M = () => {
86
+ k(
87
+ { ids: G(r) },
88
+ {
89
+ onSuccess: () => {
90
+ s(), le("CENTER_CENTER"), x(i);
91
+ }
92
+ }
93
+ );
94
+ }, R = (e) => {
95
+ if (e === "theme") return "Theme";
96
+ const l = B(h, { key: e });
97
+ return l ? l == null ? void 0 : l.name : e;
98
+ }, _ = g(() => {
99
+ const e = [
100
+ { label: "Updated", top: "pt-2" },
101
+ ...N(a(S, { online: !0 }), "pageType"),
102
+ ...N(a(P, { online: !0 }), "pageType")
103
+ ].filter((p) => p.pageType !== "theme"), l = [
104
+ { label: "Offline", top: "pt-6" },
105
+ ...N(a(S, { online: !1 }), "pageType"),
106
+ ...N(a(P, { online: !1 }), "pageType")
107
+ ];
108
+ return [...e, ...l];
109
+ }, [S, P]);
110
+ return /* @__PURE__ */ n(K, { className: "flex max-h-[80%] max-w-4xl flex-col", children: [
111
+ /* @__PURE__ */ n(Q, { children: [
112
+ /* @__PURE__ */ t(J, { children: "Publish changes" }),
113
+ /* @__PURE__ */ t(V, { className: "text-xs", children: "Select the pages you want to publish. Click publish when you're done." })
114
+ ] }),
115
+ E.length > 0 && /* @__PURE__ */ t("div", { className: "my-[2px] mt-0", children: /* @__PURE__ */ t(
116
+ ae,
117
+ {
118
+ languages: [i, ...E],
119
+ selectedLanguage: o,
120
+ setSelectedLanguage: x
121
+ }
122
+ ) }),
123
+ /* @__PURE__ */ t("div", { className: "no-scrollbar relative -mx-4 -mt-4 h-full max-h-full overflow-y-auto", children: v ? /* @__PURE__ */ n("div", { className: "space-y-2 px-1", children: [
124
+ /* @__PURE__ */ t("div", { className: "mt-2 h-6 w-full animate-pulse rounded bg-gray-200" }),
125
+ /* @__PURE__ */ t("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" }),
126
+ /* @__PURE__ */ t("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" }),
127
+ /* @__PURE__ */ t("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" })
128
+ ] }) : /* @__PURE__ */ n("table", { className: "w-full text-left text-xs text-gray-500 dark:text-gray-400 rtl:text-right", children: [
129
+ /* @__PURE__ */ t("thead", { className: "sticky top-0 z-10 border-b bg-gray-50 text-gray-700 dark:bg-gray-700 dark:text-gray-400", children: /* @__PURE__ */ n("tr", { children: [
130
+ /* @__PURE__ */ n("th", { scope: "col", className: "w-[1 50px] flex items-center gap-x-2 px-6 py-3", children: [
131
+ /* @__PURE__ */ t(
132
+ "input",
133
+ {
134
+ checked: A,
135
+ onClick: (e) => {
136
+ e.stopPropagation(), z();
137
+ },
138
+ type: "checkbox",
139
+ className: "mt-1 cursor-pointer rounded focus:outline-none focus:ring-0"
140
+ }
141
+ ),
142
+ "Name"
143
+ ] }),
144
+ /* @__PURE__ */ t("th", { scope: "col", className: "w-[150px] px-2 py-3", children: "Type" }),
145
+ /* @__PURE__ */ t("th", { scope: "col", className: "w-[150px] px-4 py-3 text-right", children: "Status" })
146
+ ] }) }),
147
+ /* @__PURE__ */ t("tbody", { children: b(
148
+ _,
149
+ (e) => e.label ? /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ n("td", { colSpan: 3, className: `relative px-6 py-2 text-xs font-medium text-gray-800 ${e.top}`, children: [
150
+ /* @__PURE__ */ t("div", { className: "absolute inset-0 left-6 flex items-center", children: /* @__PURE__ */ t("div", { className: "order-gray-300 w-full" }) }),
151
+ /* @__PURE__ */ t("div", { className: "relative flex justify-start", children: /* @__PURE__ */ t("span", { className: "bg-gray-50 pr-2", children: e.label }) })
152
+ ] }) }, "separator") : /* @__PURE__ */ t(
153
+ fe,
154
+ {
155
+ page: e,
156
+ selectedPages: r,
157
+ handleCheckboxChange: H,
158
+ getPageType: R,
159
+ hasSlug: T,
160
+ currentOwnerId: F(m, [(e == null ? void 0 : e.primaryPage) || (e == null ? void 0 : e.id), "userId"])
161
+ }
162
+ )
163
+ ) })
164
+ ] }) }),
165
+ /* @__PURE__ */ n(W, { className: "mt-10 flex items-center justify-center", children: [
166
+ r.length > 0 && /* @__PURE__ */ n("span", { className: "text-center text-sm text-muted-foreground", children: [
167
+ r.length,
168
+ " Page",
169
+ r.length !== 1 ? "s" : "",
170
+ " Selected"
171
+ ] }),
172
+ /* @__PURE__ */ t(L, { disabled: d, variant: "outline", onClick: s, children: "Cancel" }),
173
+ /* @__PURE__ */ t(L, { disabled: d || v || oe(r), onClick: M, children: d ? "Publishing..." : "Publish Selected" })
174
+ ] })
175
+ ] });
176
+ };
177
+ export {
178
+ ve as default
179
+ };
@@ -0,0 +1,237 @@
1
+ import { has as E, set as N, values as w, filter as V } from "lodash-es";
2
+ import * as o from "react";
3
+ import { useMemo as i, useState as u } from "react";
4
+ import { useAtom as R } from "jotai";
5
+ import { atomWithStorage as U } from "jotai/utils";
6
+ import { jsx as s, jsxs as g } from "react/jsx-runtime";
7
+ import { cva as S } from "class-variance-authority";
8
+ import { clsx as j } from "clsx";
9
+ import { twMerge as H } from "tailwind-merge";
10
+ import { Slot as $ } from "@radix-ui/react-slot";
11
+ import { ExclamationTriangleIcon as z } from "@radix-ui/react-icons";
12
+ import { useTranslation as G } from "react-i18next";
13
+ function l(...e) {
14
+ return H(j(e));
15
+ }
16
+ const _ = o.forwardRef(
17
+ ({ className: e, type: t, ...r }, a) => /* @__PURE__ */ s(
18
+ "input",
19
+ {
20
+ type: t,
21
+ className: l(
22
+ "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
23
+ e
24
+ ),
25
+ ref: a,
26
+ ...r
27
+ }
28
+ )
29
+ );
30
+ _.displayName = "Input";
31
+ const W = S(
32
+ "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
33
+ {
34
+ variants: {
35
+ variant: {
36
+ default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
37
+ destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
38
+ outline: "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
39
+ secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
40
+ ghost: "hover:bg-accent hover:text-accent-foreground",
41
+ link: "text-primary underline-offset-4 hover:underline"
42
+ },
43
+ size: {
44
+ default: "h-9 px-4 py-2",
45
+ sm: "h-8 rounded-md px-3 text-xs",
46
+ lg: "h-10 rounded-md px-8",
47
+ icon: "h-9 w-9"
48
+ }
49
+ },
50
+ defaultVariants: {
51
+ variant: "default",
52
+ size: "default"
53
+ }
54
+ }
55
+ ), y = o.forwardRef(
56
+ ({ className: e, variant: t, size: r, asChild: a = !1, ...n }, h) => /* @__PURE__ */ s(
57
+ a ? $ : "button",
58
+ {
59
+ className: l(W({ variant: t, size: r, className: e })),
60
+ ref: h,
61
+ ...n
62
+ }
63
+ )
64
+ );
65
+ y.displayName = "Button";
66
+ const p = {}, de = (e, t) => {
67
+ p[e] = {
68
+ id: e,
69
+ component: t,
70
+ type: "widget"
71
+ };
72
+ }, ue = (e, t) => {
73
+ p[e] = {
74
+ id: e,
75
+ component: t,
76
+ type: "field"
77
+ };
78
+ }, ge = (e, t) => {
79
+ p[e] = {
80
+ id: e,
81
+ component: t,
82
+ type: "template"
83
+ };
84
+ }, fe = (e) => Object.values(p).filter((t) => t.type === e).reduce(
85
+ (t, r) => (t[r.id] = r.component, t),
86
+ {}
87
+ ), C = {}, me = (e, t) => {
88
+ E(C, e) && console.warn(`Add block tab with id ${e} already registered`), N(C, e, { id: e, ...t });
89
+ }, pe = () => i(() => w(C), []), f = {}, q = (e, t) => {
90
+ if (f[e])
91
+ throw new Error(`Flag ${e} already exists`);
92
+ f[e] = { key: e, value: !1, ...t };
93
+ }, he = (e) => {
94
+ Object.entries(e).forEach(([t, r]) => {
95
+ if (f[t])
96
+ throw new Error(`Flag ${t} already exists`);
97
+ q(t, r);
98
+ });
99
+ }, ve = () => f, B = U("chai-feature-flags", []), J = (e) => {
100
+ const [t] = R(B);
101
+ return t.includes(e);
102
+ }, be = (e) => {
103
+ const [t, r] = R(B);
104
+ return () => {
105
+ t.includes(e) ? r(t.filter((n) => n !== e)) : r([...t, e]);
106
+ };
107
+ }, xe = ({ flagKey: e, children: t }) => J(e) ? t : null;
108
+ let A = {};
109
+ const ye = (e, t) => {
110
+ A[e] = { ...t, id: e };
111
+ }, Ce = (e) => A[e], we = () => w(A), K = S(
112
+ "relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",
113
+ {
114
+ variants: {
115
+ variant: {
116
+ default: "bg-background text-foreground",
117
+ destructive: "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"
118
+ }
119
+ },
120
+ defaultVariants: {
121
+ variant: "default"
122
+ }
123
+ }
124
+ ), L = o.forwardRef(({ className: e, variant: t, ...r }, a) => /* @__PURE__ */ s("div", { ref: a, role: "alert", className: l(K({ variant: t }), e), ...r }));
125
+ L.displayName = "Alert";
126
+ const X = o.forwardRef(
127
+ ({ className: e, ...t }, r) => /* @__PURE__ */ s("h5", { ref: r, className: l("mb-1 font-medium leading-none tracking-tight", e), ...t })
128
+ );
129
+ X.displayName = "AlertTitle";
130
+ const I = o.forwardRef(
131
+ ({ className: e, ...t }, r) => /* @__PURE__ */ s("div", { ref: r, className: l("text-sm [&_p]:leading-relaxed", e), ...t })
132
+ );
133
+ I.displayName = "AlertDescription";
134
+ const Y = ({ close: e, onSelect: t, mode: r = "image" }) => {
135
+ const [a, n] = u(""), [h, v] = u(!1), [P, b] = u(!1), [F, c] = u(null), D = async (x) => {
136
+ if (!x.trim()) {
137
+ b(!1), c("Please enter a URL");
138
+ return;
139
+ }
140
+ try {
141
+ v(!0), c(null), b(!0), c(null);
142
+ } catch {
143
+ b(!1), c("Error validating URL");
144
+ } finally {
145
+ v(!1);
146
+ }
147
+ }, { t: d } = G();
148
+ return /* @__PURE__ */ g("div", { className: "flex w-96 flex-col gap-4 p-4", children: [
149
+ /* @__PURE__ */ s("h2", { className: "text-xl font-semibold", children: d(`${r.charAt(0).toUpperCase() + r.slice(1)} Manager`) }),
150
+ F && /* @__PURE__ */ g(L, { variant: "destructive", children: [
151
+ /* @__PURE__ */ s(z, { className: "h-4 w-4" }),
152
+ /* @__PURE__ */ s(I, { children: F })
153
+ ] }),
154
+ /* @__PURE__ */ g("div", { className: "flex flex-col gap-4", children: [
155
+ /* @__PURE__ */ s(
156
+ _,
157
+ {
158
+ placeholder: d(`Enter ${r} URL`),
159
+ value: a,
160
+ onChange: (x) => n(x.target.value),
161
+ onKeyUp: () => D(a)
162
+ }
163
+ ),
164
+ /* @__PURE__ */ g("div", { className: "flex justify-end gap-2", children: [
165
+ /* @__PURE__ */ s(y, { variant: "outline", onClick: e, children: d("Cancel") }),
166
+ /* @__PURE__ */ s(
167
+ y,
168
+ {
169
+ onClick: () => t({ id: "dam-id", url: a, width: 600, height: 400, description: "This is image description" }),
170
+ disabled: !P || h,
171
+ children: d("Insert")
172
+ }
173
+ )
174
+ ] })
175
+ ] })
176
+ ] });
177
+ }, M = {
178
+ component: Y
179
+ }, Ae = (e) => {
180
+ M.component = e;
181
+ }, Te = () => i(() => M.component, []);
182
+ let k = async (e) => e;
183
+ const Fe = (e) => {
184
+ k = e;
185
+ }, Ee = async (e) => await k(e);
186
+ let T = null;
187
+ const Ne = (e) => {
188
+ T = e;
189
+ }, Re = () => i(() => T, []), Se = () => {
190
+ T = null;
191
+ }, m = {}, _e = (e, t) => {
192
+ E(m, e) && console.warn(`Panel ${e} already registered. Overriding...`), N(m, e, { id: e, ...t });
193
+ }, Be = (e) => i(
194
+ () => V(w(m), (t) => t.position === e),
195
+ [e, m]
196
+ ), Q = () => /* @__PURE__ */ s("div", {}), O = {
197
+ component: Q
198
+ }, Le = (e) => {
199
+ O.component = e;
200
+ }, Ie = () => i(() => O.component, []);
201
+ export {
202
+ C as A,
203
+ y as B,
204
+ m as C,
205
+ L as D,
206
+ l as E,
207
+ I as F,
208
+ W as G,
209
+ xe as I,
210
+ p as R,
211
+ ue as a,
212
+ ge as b,
213
+ me as c,
214
+ pe as d,
215
+ q as e,
216
+ he as f,
217
+ ve as g,
218
+ J as h,
219
+ be as i,
220
+ ye as j,
221
+ Ce as k,
222
+ we as l,
223
+ Ae as m,
224
+ Te as n,
225
+ Ee as o,
226
+ Fe as p,
227
+ Ne as q,
228
+ de as r,
229
+ Re as s,
230
+ Se as t,
231
+ fe as u,
232
+ _e as v,
233
+ Be as w,
234
+ Le as x,
235
+ Ie as y,
236
+ _ as z
237
+ };
@@ -0,0 +1 @@
1
+ "use strict";const i=require("lodash-es"),n=require("react"),B=require("jotai"),P=require("jotai/utils"),s=require("react/jsx-runtime"),L=require("class-variance-authority"),D=require("clsx"),q=require("tailwind-merge"),H=require("@radix-ui/react-slot"),V=require("@radix-ui/react-icons"),U=require("react-i18next");function $(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const u=$(n);function o(...e){return q.twMerge(D.clsx(e))}const y=u.forwardRef(({className:e,type:t,...r},a)=>s.jsx("input",{type:t,className:o("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:a,...r}));y.displayName="Input";const M=L.cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),p=u.forwardRef(({className:e,variant:t,size:r,asChild:a=!1,...l},b)=>{const g=a?H.Slot:"button";return s.jsx(g,{className:o(M({variant:t,size:r,className:e})),ref:b,...l})});p.displayName="Button";const d={},z=(e,t)=>{d[e]={id:e,component:t,type:"widget"}},G=(e,t)=>{d[e]={id:e,component:t,type:"field"}},W=(e,t)=>{d[e]={id:e,component:t,type:"template"}},J=e=>Object.values(d).filter(t=>t.type===e).reduce((t,r)=>(t[r.id]=r.component,t),{}),m={},K=(e,t)=>{i.has(m,e)&&console.warn(`Add block tab with id ${e} already registered`),i.set(m,e,{id:e,...t})},X=()=>n.useMemo(()=>i.values(m),[]),v={},_=(e,t)=>{if(v[e])throw new Error(`Flag ${e} already exists`);v[e]={key:e,value:!1,...t}},Y=e=>{Object.entries(e).forEach(([t,r])=>{if(v[t])throw new Error(`Flag ${t} already exists`);_(t,r)})},Q=()=>v,j=P.atomWithStorage("chai-feature-flags",[]),E=e=>{const[t]=B.useAtom(j);return t.includes(e)},Z=e=>{const[t,r]=B.useAtom(j);return()=>{t.includes(e)?r(t.filter(l=>l!==e)):r([...t,e])}},ee=({flagKey:e,children:t})=>E(e)?t:null;let S={};const te=(e,t)=>{S[e]={...t,id:e}},re=e=>S[e],se=()=>i.values(S),ae=L.cva("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),T=u.forwardRef(({className:e,variant:t,...r},a)=>s.jsx("div",{ref:a,role:"alert",className:o(ae({variant:t}),e),...r}));T.displayName="Alert";const ne=u.forwardRef(({className:e,...t},r)=>s.jsx("h5",{ref:r,className:o("mb-1 font-medium leading-none tracking-tight",e),...t}));ne.displayName="AlertTitle";const A=u.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:o("text-sm [&_p]:leading-relaxed",e),...t}));A.displayName="AlertDescription";const ie=({close:e,onSelect:t,mode:r="image"})=>{const[a,l]=n.useState(""),[b,g]=n.useState(!1),[k,x]=n.useState(!1),[w,f]=n.useState(null),O=async C=>{if(!C.trim()){x(!1),f("Please enter a URL");return}try{g(!0),f(null),x(!0),f(null)}catch{x(!1),f("Error validating URL")}finally{g(!1)}},{t:h}=U.useTranslation();return s.jsxs("div",{className:"flex w-96 flex-col gap-4 p-4",children:[s.jsx("h2",{className:"text-xl font-semibold",children:h(`${r.charAt(0).toUpperCase()+r.slice(1)} Manager`)}),w&&s.jsxs(T,{variant:"destructive",children:[s.jsx(V.ExclamationTriangleIcon,{className:"h-4 w-4"}),s.jsx(A,{children:w})]}),s.jsxs("div",{className:"flex flex-col gap-4",children:[s.jsx(y,{placeholder:h(`Enter ${r} URL`),value:a,onChange:C=>l(C.target.value),onKeyUp:()=>O(a)}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(p,{variant:"outline",onClick:e,children:h("Cancel")}),s.jsx(p,{onClick:()=>t({id:"dam-id",url:a,width:600,height:400,description:"This is image description"}),disabled:!k||b,children:h("Insert")})]})]})]})},I={component:ie},oe=e=>{I.component=e},le=()=>n.useMemo(()=>I.component,[]);let N=async e=>e;const ce=e=>{N=e},ue=async e=>await N(e);let F=null;const de=e=>{F=e},ge=()=>n.useMemo(()=>F,[]),fe=()=>{F=null},c={},he=(e,t)=>{i.has(c,e)&&console.warn(`Panel ${e} already registered. Overriding...`),i.set(c,e,{id:e,...t})},pe=e=>n.useMemo(()=>i.filter(i.values(c),t=>t.position===e),[e,c]),me=()=>s.jsx("div",{}),R={component:me},ve=e=>{R.component=e},be=()=>n.useMemo(()=>R.component,[]);exports.ADD_BLOCK_TABS=m;exports.Alert=T;exports.AlertDescription=A;exports.Button=p;exports.CHAI_BUILDER_PANELS=c;exports.IfChaiFeatureFlag=ee;exports.Input=y;exports.RJSF_EXTENSIONS=d;exports.buttonVariants=M;exports.cn=o;exports.getChaiLibrary=re;exports.getPreImportHTML=ue;exports.registerBlockSettingField=G;exports.registerBlockSettingTemplate=W;exports.registerBlockSettingWidget=z;exports.registerChaiAddBlockTab=K;exports.registerChaiFeatureFlag=_;exports.registerChaiFeatureFlags=Y;exports.registerChaiLibrary=te;exports.registerChaiMediaManager=oe;exports.registerChaiPreImportHTMLHook=ce;exports.registerChaiSaveToLibrary=de;exports.registerChaiSidebarPanel=he;exports.registerChaiTopBar=ve;exports.resetSaveToLibrary=fe;exports.useBlockSettingComponents=J;exports.useChaiAddBlockTabs=X;exports.useChaiFeatureFlag=E;exports.useChaiFeatureFlags=Q;exports.useChaiLibraries=se;exports.useChaiSidebarPanels=pe;exports.useMediaManagerComponent=le;exports.useSaveToLibraryComponent=ge;exports.useToggleChaiFeatureFlag=Z;exports.useTopBarComponent=be;
@@ -0,0 +1,36 @@
1
+ import { get as r, has as c } from "lodash-es";
2
+ const t = {};
3
+ function i(a, e) {
4
+ c(t, a) && console.warn(`Collection ${a} already registered`), t[a] = { ...e, id: a };
5
+ }
6
+ const l = () => Object.values(t), g = (a) => r(t, a);
7
+ let o = async (a) => ({
8
+ ...a
9
+ });
10
+ const C = (a) => {
11
+ o = a;
12
+ }, h = async (a) => {
13
+ try {
14
+ return await o(a);
15
+ } catch (e) {
16
+ return console.error(e), {};
17
+ }
18
+ }, s = {}, P = () => Object.values(s), u = (a) => s[a], T = (a, e) => {
19
+ s[a] = { key: a, ...e, hasSlug: !0 };
20
+ }, p = (a, e) => {
21
+ s[a] = { key: a, ...e, hasSlug: !1 };
22
+ };
23
+ export {
24
+ t as C,
25
+ s as P,
26
+ g as a,
27
+ o as b,
28
+ C as c,
29
+ h as d,
30
+ P as e,
31
+ u as f,
32
+ l as g,
33
+ T as h,
34
+ p as i,
35
+ i as r
36
+ };
@@ -0,0 +1 @@
1
+ "use strict";const i=require("lodash-es"),t={};function o(e,a){i.has(t,e)&&console.warn(`Collection ${e} already registered`),t[e]={...a,id:e}}const s=()=>Object.values(t),l=e=>i.get(t,e);exports.CHAI_GLOBAL_DATA_PROVIDER=async e=>({...e});const C=e=>{exports.CHAI_GLOBAL_DATA_PROVIDER=e},c=async e=>{try{return await exports.CHAI_GLOBAL_DATA_PROVIDER(e)}catch(a){return console.error(a),{}}},r={},g=()=>Object.values(r),n=e=>r[e],h=(e,a)=>{r[e]={key:e,...a,hasSlug:!0}},P=(e,a)=>{r[e]={key:e,...a,hasSlug:!1}};exports.COLLECTIONS=t;exports.PAGE_TYPES=r;exports.getChaiCollection=l;exports.getChaiCollections=s;exports.getChaiGlobalData=c;exports.getChaiPageType=n;exports.getChaiPageTypes=g;exports.registerChaiCollection=o;exports.registerChaiGlobalDataProvider=C;exports.registerChaiPageType=h;exports.registerChaiPartialType=P;