@unchainedshop/admin-ui 4.8.29 → 5.0.0-alpha.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 (728) hide show
  1. package/README.md +136 -16
  2. package/dist/chunk-3L6EZQ6P.js +135 -0
  3. package/dist/chunk-5WPFHQZN.js +388 -0
  4. package/dist/chunk-AE5LOZGH.js +3350 -0
  5. package/dist/{chunk-JAVEZY3Q.js → chunk-AOR2B5N5.js} +14 -5
  6. package/dist/chunk-DTJ2DTKS.js +314 -0
  7. package/dist/{chunk-2RTX42IE.js → chunk-E7BVYJ3R.js} +2 -2
  8. package/dist/{chunk-XHOCXPD5.js → chunk-F6LBNV3H.js} +1 -1
  9. package/dist/chunk-FDHXLNZQ.js +44 -0
  10. package/dist/{chunk-MSPWYMDY.js → chunk-H6G4UTZ5.js} +83 -48
  11. package/dist/{chunk-XJBPMIC4.js → chunk-HERLM47Z.js} +81 -56
  12. package/dist/chunk-HTPSKUXQ.js +22476 -0
  13. package/dist/{chunk-7PPOGX7R.js → chunk-I64TXIE7.js} +48 -11
  14. package/dist/{chunk-QNLGYFV7.js → chunk-IYKPRAWC.js} +4 -0
  15. package/dist/chunk-J23QSWDL.js +8 -0
  16. package/dist/{chunk-SRAAKMWY.js → chunk-JED6SHHG.js} +4 -2
  17. package/dist/chunk-KRIRF7F6.js +76 -0
  18. package/dist/chunk-OTXM2UCD.js +19 -0
  19. package/dist/chunk-QHR23GVH.js +1099 -0
  20. package/dist/chunk-VBO377AY.js +14 -0
  21. package/dist/{chunk-4VNS5WPM.js → chunk-WPLOTFGW.js} +7 -8
  22. package/dist/components/ui/form/ChoicesField.d.ts.map +1 -1
  23. package/dist/components/ui/form/index.d.ts +1 -0
  24. package/dist/components/ui/form/index.d.ts.map +1 -1
  25. package/dist/components/ui/index.d.ts +5 -0
  26. package/dist/components/ui/index.d.ts.map +1 -1
  27. package/dist/form.js +1792 -27496
  28. package/dist/gql/operation-types.d.ts +20 -0
  29. package/dist/gql/operation-types.d.ts.map +1 -1
  30. package/dist/gql/schema-types.d.ts +1 -0
  31. package/dist/gql/schema-types.d.ts.map +1 -1
  32. package/dist/hooks.js +13 -6
  33. package/dist/modal.js +11 -78
  34. package/dist/modules/Auth/AuthContext.d.ts +9 -0
  35. package/dist/modules/Auth/AuthContext.d.ts.map +1 -0
  36. package/dist/modules/Auth/useAuth.d.ts +6 -0
  37. package/dist/modules/Auth/useAuth.d.ts.map +1 -0
  38. package/dist/modules/accounts.js +1 -1
  39. package/dist/modules/assortment.js +3 -3
  40. package/dist/modules/common/components/AppContext.d.ts.map +1 -1
  41. package/dist/modules/common/components/FormWrapper.d.ts.map +1 -1
  42. package/dist/modules/common/components/LocaleWrapper.d.ts +7 -0
  43. package/dist/modules/common/components/LocaleWrapper.d.ts.map +1 -0
  44. package/dist/modules/common/components/MediaAvatar.d.ts +6 -0
  45. package/dist/modules/common/components/MediaAvatar.d.ts.map +1 -0
  46. package/dist/modules/common/components/SelectOptions.d.ts +17 -0
  47. package/dist/modules/common/components/SelectOptions.d.ts.map +1 -0
  48. package/dist/modules/common/components/Table.d.ts +25 -0
  49. package/dist/modules/common/components/Table.d.ts.map +1 -0
  50. package/dist/modules/common/components/TableCell.d.ts +12 -0
  51. package/dist/modules/common/components/TableCell.d.ts.map +1 -0
  52. package/dist/modules/common/components/TableRow.d.ts +10 -0
  53. package/dist/modules/common/components/TableRow.d.ts.map +1 -0
  54. package/dist/modules/common/components/ThemeWrapper.d.ts.map +1 -1
  55. package/dist/modules/common/utils/sharedContext.d.ts +9 -0
  56. package/dist/modules/common/utils/sharedContext.d.ts.map +1 -0
  57. package/dist/modules/country.js +1 -1
  58. package/dist/modules/currency.js +1 -1
  59. package/dist/modules/delivery-provider.js +1 -1
  60. package/dist/modules/enrollment.js +1 -1
  61. package/dist/modules/event.js +1 -1
  62. package/dist/modules/filter.js +1 -1
  63. package/dist/modules/forms/lib/FormContext.d.ts.map +1 -1
  64. package/dist/modules/language.js +1 -1
  65. package/dist/modules/modal/hooks/useModal.d.ts.map +1 -1
  66. package/dist/modules/modal/utils/ModalContext.d.ts.map +1 -1
  67. package/dist/modules/order.js +1 -1
  68. package/dist/modules/payment-providers.js +1 -1
  69. package/dist/modules/product-review.js +3 -3
  70. package/dist/modules/product.js +4748 -7
  71. package/dist/modules/quotation.js +1 -1
  72. package/dist/modules/token.js +2 -2
  73. package/dist/modules/warehousing-providers.js +1 -1
  74. package/dist/modules/work.js +6 -10
  75. package/dist/plugins.js +1 -1
  76. package/dist/providers.js +8 -5
  77. package/dist/sdk/hooks.d.ts +3 -0
  78. package/dist/sdk/hooks.d.ts.map +1 -1
  79. package/dist/shims/admin-ui-plugins.js +1 -1
  80. package/dist/shims/apollo-client-react.js +1 -1
  81. package/dist/shims/apollo-client.js +1 -1
  82. package/dist/shims/next-head.js +1 -1
  83. package/dist/shims/next-image.js +1 -1
  84. package/dist/shims/next-link.js +1 -1
  85. package/dist/shims/next-router.js +1 -1
  86. package/dist/shims/react-dom-client.js +1 -1
  87. package/dist/shims/react-dom.js +1 -1
  88. package/dist/shims/react-hook-form.js +1 -1
  89. package/dist/shims/react-intl.js +1 -1
  90. package/dist/shims/react-jsx-runtime.js +1 -1
  91. package/dist/shims/react-toastify.js +1 -1
  92. package/dist/shims/react.js +1 -1
  93. package/dist/theme.js +1 -1
  94. package/dist/ui.js +3397 -3055
  95. package/out/403/index.html +2 -2
  96. package/out/404/index.html +2 -2
  97. package/out/404.html +2 -2
  98. package/out/423/index.html +2 -2
  99. package/out/500/index.html +2 -2
  100. package/out/_next/static/chunks/0-2b37ubdpy0o.js +7 -0
  101. package/out/_next/static/chunks/012cafv-4m7rj.js +807 -0
  102. package/out/_next/static/chunks/02dnhll1bce87.js +46 -0
  103. package/out/_next/static/chunks/02ptvddfjlsxb.js +1 -0
  104. package/out/_next/static/chunks/03ebenjfvoj8n.js +1 -0
  105. package/out/_next/static/chunks/03r347235l6c4.js +7 -0
  106. package/out/_next/static/chunks/05au-xyt__0f2.js +3 -0
  107. package/out/_next/static/chunks/05nn5xr3ufcsh.js +1 -0
  108. package/out/_next/static/chunks/05o_q7jg8wucs.js +44 -0
  109. package/out/_next/static/chunks/05scroolqe8fu.js +234 -0
  110. package/out/_next/static/chunks/072qxdqjtqvn9.js +11 -0
  111. package/out/_next/static/chunks/0752goe9_9g2s.js +110 -0
  112. package/out/_next/static/chunks/07e-sk6v9u-qh.js +807 -0
  113. package/out/_next/static/chunks/07evy5u8ldd1y.js +50 -0
  114. package/out/_next/static/chunks/083ylavob4a8d.js +3 -0
  115. package/out/_next/static/chunks/08jrw03_vxllg.js +54 -0
  116. package/out/_next/static/chunks/08pag0k09j2b3.js +807 -0
  117. package/out/_next/static/chunks/09n6h-_l73rez.js +13 -0
  118. package/out/_next/static/chunks/0_b5faks_mrvi.js +14 -0
  119. package/out/_next/static/chunks/0a_bg-ub3r2eo.js +60 -0
  120. package/out/_next/static/chunks/0aqxsjssb0dh9.js +21 -0
  121. package/out/_next/static/chunks/0aw4jxe6zcc0c.js +32 -0
  122. package/out/_next/static/chunks/0b0hrx3sbbs70.js +807 -0
  123. package/out/_next/static/chunks/0bg4_y1qh5y5h.js +47 -0
  124. package/out/_next/static/chunks/0bgz44wi1lidl.js +13 -0
  125. package/out/_next/static/chunks/0dcpvidzyamvk.js +100 -0
  126. package/out/_next/static/chunks/{19y4w6_d_qiou.js → 0dnh0kr83_tj0.js} +1 -1
  127. package/out/_next/static/chunks/0dxp17sbyy_dr.js +22 -0
  128. package/out/_next/static/chunks/0dxu94yin5gdn.js +35 -0
  129. package/out/_next/static/chunks/0e2c-jlh2q_eq.js +74 -0
  130. package/out/_next/static/chunks/0el7gr-83bm5j.js +3 -0
  131. package/out/_next/static/chunks/0f_ofo__wyqsp.js +22 -0
  132. package/out/_next/static/chunks/0gx9t6j5kx_ho.js +9 -0
  133. package/out/_next/static/chunks/0i9ymn9xxs0nx.js +18 -0
  134. package/out/_next/static/chunks/0iy11ws57hzzr.js +99 -0
  135. package/out/_next/static/chunks/0j8_uikfyrn1f.js +1 -0
  136. package/out/_next/static/chunks/0jeddko6bac8h.js +1 -0
  137. package/out/_next/static/chunks/0jzx7vxh13cpi.js +15 -0
  138. package/out/_next/static/chunks/0kody3217__os.js +16 -0
  139. package/out/_next/static/chunks/0kwo-m1-mo-s-.js +31 -0
  140. package/out/_next/static/chunks/0lp_pnq1t06sl.js +104 -0
  141. package/out/_next/static/chunks/0mez27zlo26ni.js +103 -0
  142. package/out/_next/static/chunks/0nj8vn3509oe-.js +9 -0
  143. package/out/_next/static/chunks/0np9pcbt6dmxe.js +25 -0
  144. package/out/_next/static/chunks/0o7k5vanq57ch.js +807 -0
  145. package/out/_next/static/chunks/0rqjr_lmrk4pz.js +5 -0
  146. package/out/_next/static/chunks/0swe0fkt4vyzn.js +136 -0
  147. package/out/_next/static/chunks/0u4st428hgv1v.js +27 -0
  148. package/out/_next/static/chunks/0u7--d8_-qyne.js +83 -0
  149. package/out/_next/static/chunks/0ubzi2s1spm4e.js +342 -0
  150. package/out/_next/static/chunks/0uecw_5mn0zvr.js +110 -0
  151. package/out/_next/static/chunks/0uxwblyj0htyb.js +1 -0
  152. package/out/_next/static/chunks/0uyhr7vs9ltp0.js +141 -0
  153. package/out/_next/static/chunks/0vr19nswhvt2-.js +14 -0
  154. package/out/_next/static/chunks/0vyvc19p87f_r.js +234 -0
  155. package/out/_next/static/chunks/0wznlnzc2xsbz.js +16 -0
  156. package/out/_next/static/chunks/0ycu-q8fcc8ta.js +1 -0
  157. package/out/_next/static/chunks/0ytserk6fuf71.js +175 -0
  158. package/out/_next/static/chunks/0zoum0jzrtu0s.js +145 -0
  159. package/out/_next/static/chunks/1-6s62fsl_z_7.js +126 -0
  160. package/out/_next/static/chunks/10b6et0qn-pa0.js +59 -0
  161. package/out/_next/static/chunks/13m7st62a61df.js +25 -0
  162. package/out/_next/static/chunks/13u_a5l2xngm4.js +1 -0
  163. package/out/_next/static/chunks/15vz50rks0o2-.js +238 -0
  164. package/out/_next/static/chunks/1647yxi4ymq0z.js +14 -0
  165. package/out/_next/static/chunks/16hd7xvkocqxs.js +807 -0
  166. package/out/_next/static/chunks/16t18hhd4ax36.js +2 -0
  167. package/out/_next/static/chunks/17wle25pg9jkp.js +11 -0
  168. package/out/_next/static/chunks/18juy_eauk94g.js +58 -0
  169. package/out/_next/static/chunks/19eflki8bmivb.js +81 -0
  170. package/out/_next/static/chunks/19eu5d-wm2hfr.js +23 -0
  171. package/out/_next/static/chunks/19izcjxrrapb3.js +9 -0
  172. package/out/_next/static/chunks/1_jbj-c1d2606.js +21 -0
  173. package/out/_next/static/chunks/1_pwqdjxb6oou.js +226 -0
  174. package/out/_next/static/chunks/1bftmuhck_-7b.js +1 -0
  175. package/out/_next/static/chunks/1bww_2og01jxh.js +807 -0
  176. package/out/_next/static/chunks/1c0cemuv_tf6i.js +16 -0
  177. package/out/_next/static/chunks/1c4a2qxtb3r4_.js +16 -0
  178. package/out/_next/static/chunks/1cjd95y23a9qx.js +1 -0
  179. package/out/_next/static/chunks/1cy-2yb5j5_9b.js +157 -0
  180. package/out/_next/static/chunks/1dkv555kaccbl.js +13 -0
  181. package/out/_next/static/chunks/1dt9_bzfioi8a.js +24 -0
  182. package/out/_next/static/chunks/1fd7ewfb7bi_g.js +234 -0
  183. package/out/_next/static/chunks/1gncrqljnmqjn.js +43 -0
  184. package/out/_next/static/chunks/1iewktf-9h_n8.js +15 -0
  185. package/out/_next/static/chunks/1l7p7exnzd0c2.js +12 -0
  186. package/out/_next/static/chunks/1nqu3ymv6lgev.js +3 -0
  187. package/out/_next/static/chunks/1o_8g-kpuqi9h.js +1 -0
  188. package/out/_next/static/chunks/1oent0-9-0rgb.js +20 -0
  189. package/out/_next/static/chunks/1og09fg689_nc.js +180 -0
  190. package/out/_next/static/chunks/1pj279k5ntty3.js +13 -0
  191. package/out/_next/static/chunks/1q_sewe1wbxsk.js +54 -0
  192. package/out/_next/static/chunks/1qvs4gd4rbhb2.js +15 -0
  193. package/out/_next/static/chunks/1rtv3c_klo0jk.js +1 -0
  194. package/out/_next/static/chunks/1sdqr2_r6o46f.js +16 -0
  195. package/out/_next/static/chunks/1vti949e9wuhz.js +15 -0
  196. package/out/_next/static/chunks/1x-yucftdml28.js +1 -0
  197. package/out/_next/static/chunks/1ylgjha1c0ua_.js +124 -0
  198. package/out/_next/static/chunks/1yp98n-n4gxwy.js +15 -0
  199. package/out/_next/static/chunks/1zcm_9oew7412.js +14 -0
  200. package/out/_next/static/chunks/2-e0d1qpp7rk9.js +14 -0
  201. package/out/_next/static/chunks/20ubrczdsehfm.js +879 -0
  202. package/out/_next/static/chunks/23m--gc-gjenm.js +3 -0
  203. package/out/_next/static/chunks/24-pobk4qjjvp.js +3 -0
  204. package/out/_next/static/chunks/24jptulqn322i.js +15 -0
  205. package/out/_next/static/chunks/24jyi7e2pq4gy.js +15 -0
  206. package/out/_next/static/chunks/26eux546aoag5.js +58 -0
  207. package/out/_next/static/chunks/270ua9t85a7ev.js +5 -0
  208. package/out/_next/static/chunks/28r_j2kquxrjn.js +807 -0
  209. package/out/_next/static/chunks/2_ccruvok3u8j.js +16 -0
  210. package/out/_next/static/chunks/2_ojfjgg8do9t.js +1 -0
  211. package/out/_next/static/chunks/2aj5aq_c0b4r_.js +13 -0
  212. package/out/_next/static/chunks/2ba3n9zx9e9q9.js +807 -0
  213. package/out/_next/static/chunks/2d-hxb31pgpn7.js +13 -0
  214. package/out/_next/static/chunks/2df2cqwidgpan.js +15 -0
  215. package/out/_next/static/chunks/2djnsowjy3p8y.js +1 -0
  216. package/out/_next/static/chunks/2dyj8q92_k5el.js +708 -0
  217. package/out/_next/static/chunks/2e0k9dt1emjfm.js +1 -0
  218. package/out/_next/static/chunks/2e3gba1n-yyuj.js +15 -0
  219. package/out/_next/static/chunks/2e_p1vqr0g_-_.js +7 -0
  220. package/out/_next/static/chunks/2e_te6sbs_5uw.js +1 -0
  221. package/out/_next/static/chunks/2f16josk9b_cl.js +8 -0
  222. package/out/_next/static/chunks/2fo2ki1egxbah.js +39 -0
  223. package/out/_next/static/chunks/2g8gzs8wpsofk.js +2 -0
  224. package/out/_next/static/chunks/2gh355-kh19zx.js +13 -0
  225. package/out/_next/static/chunks/2gr4t5xe0atdr.js +15 -0
  226. package/out/_next/static/chunks/2ib6fee-nqe-z.js +23 -0
  227. package/out/_next/static/chunks/2kjux30i3gg-c.js +5 -0
  228. package/out/_next/static/chunks/2ll_mqee86g8c.js +1 -0
  229. package/out/_next/static/chunks/2lx_iig9xewfj.js +52 -0
  230. package/out/_next/static/chunks/2lylr4-3tu1_t.js +15 -0
  231. package/out/_next/static/chunks/2n1v8ph2nt43w.js +17 -0
  232. package/out/_next/static/chunks/2o9hdz0gk1-s7.js +165 -0
  233. package/out/_next/static/chunks/2oadogfqpak51.js +1 -0
  234. package/out/_next/static/chunks/2oogwntgnu9rf.js +17 -0
  235. package/out/_next/static/chunks/2p4e3kh8sa8iq.js +13 -0
  236. package/out/_next/static/chunks/2q-mpau-4gsvd.js +1 -0
  237. package/out/_next/static/chunks/2rddaar-ns45d.js +116 -0
  238. package/out/_next/static/chunks/2s3qhuh87mu_w.js +126 -0
  239. package/out/_next/static/chunks/2s6u8274_jzk2.js +105 -0
  240. package/out/_next/static/chunks/2skfzjx2g9hkk.js +134 -0
  241. package/out/_next/static/chunks/2u6jwsqz0uhes.js +24 -0
  242. package/out/_next/static/chunks/2v4k4vpb2id7m.js +44 -0
  243. package/out/_next/static/chunks/2xctb084h1lyg.js +329 -0
  244. package/out/_next/static/chunks/2xgpwzpd6-tdb.js +234 -0
  245. package/out/_next/static/chunks/3-soz24u9483h.js +15 -0
  246. package/out/_next/static/chunks/30_ns6urg1dkn.js +41 -0
  247. package/out/_next/static/chunks/30nxkqu5mcga3.js +1 -0
  248. package/out/_next/static/chunks/{0gurfn3nhm859.js → 313i1x81q2xj1.js} +1 -1
  249. package/out/_next/static/chunks/31qwglme02a_r.js +807 -0
  250. package/out/_next/static/chunks/31sk60zzj3bc5.js +17 -0
  251. package/out/_next/static/chunks/325a7n__tfxy_.js +61 -0
  252. package/out/_next/static/chunks/33emlry70k-lv.js +2 -0
  253. package/out/_next/static/chunks/33v8la4hkia7j.js +1 -0
  254. package/out/_next/static/chunks/34ar-34flu6bu.js +43 -0
  255. package/out/_next/static/chunks/34z48lfdm9u0l.js +9 -0
  256. package/out/_next/static/chunks/351jscvbk_wb9.js +13 -0
  257. package/out/_next/static/chunks/357odtev0t245.js +59 -0
  258. package/out/_next/static/chunks/360g4b1clnt45.js +142 -0
  259. package/out/_next/static/chunks/360uyru28azf6.js +20 -0
  260. package/out/_next/static/chunks/366apf6d0xh2u.js +30 -0
  261. package/out/_next/static/chunks/36_zbuqpk5cpj.js +14 -0
  262. package/out/_next/static/chunks/36aqs7u7s-lb1.js +119 -0
  263. package/out/_next/static/chunks/36beon3q8orx2.js +1 -0
  264. package/out/_next/static/chunks/37703j9_zf5_h.js +13 -0
  265. package/out/_next/static/chunks/37rwzuocwsv_k.js +16 -0
  266. package/out/_next/static/chunks/37w6b3h04uc4c.js +19 -0
  267. package/out/_next/static/chunks/38ffn8gazqz8_.js +3 -0
  268. package/out/_next/static/chunks/38xse6_r51yqp.js +234 -0
  269. package/out/_next/static/chunks/39s8xbnm9f08v.js +14 -0
  270. package/out/_next/static/chunks/39x-p8r_sl0ng.js +15 -0
  271. package/out/_next/static/chunks/39zisxvmik0t_.js +34 -0
  272. package/out/_next/static/chunks/3_97tge0xvvon.js +11 -0
  273. package/out/_next/static/chunks/3aw-ri7876ngd.js +39 -0
  274. package/out/_next/static/chunks/3bv7gi3o6-41h.js +11 -0
  275. package/out/_next/static/chunks/3cdfuacs4_0d-.js +1 -0
  276. package/out/_next/static/chunks/3cxpx38ycu7u2.js +9 -0
  277. package/out/_next/static/chunks/3d1ofcqmlbg-5.js +52 -0
  278. package/out/_next/static/chunks/3e3i3qqkv_my7.js +15 -0
  279. package/out/_next/static/chunks/3ex71q3pp_ekc.js +247 -0
  280. package/out/_next/static/chunks/3g1lpkudwo8kg.js +1 -0
  281. package/out/_next/static/chunks/3h68t22714to5.js +3 -0
  282. package/out/_next/static/chunks/3jpzhwqgdnobq.js +103 -0
  283. package/out/_next/static/chunks/3jxuqt_2-j_uc.js +18 -0
  284. package/out/_next/static/chunks/3kqqv33l7ssn0.js +16 -0
  285. package/out/_next/static/chunks/3l-9xxd1i1sya.js +1 -0
  286. package/out/_next/static/chunks/3mancxzz8c7hl.js +51 -0
  287. package/out/_next/static/chunks/3mq2s9rfy78je.js +27 -0
  288. package/out/_next/static/chunks/3om1fkw-lrmng.js +1 -0
  289. package/out/_next/static/chunks/3oynij37wfjb2.js +119 -0
  290. package/out/_next/static/chunks/3pbyo5kkko3wh.js +1 -0
  291. package/out/_next/static/chunks/3pjja1obml896.js +15 -0
  292. package/out/_next/static/chunks/3qaiz-jwi7q2x.js +1 -0
  293. package/out/_next/static/chunks/3rh3nigvg06yu.js +337 -0
  294. package/out/_next/static/chunks/3rppjab6j3_k9.js +1 -0
  295. package/out/_next/static/chunks/3t_3vlnk1ntkb.js +95 -0
  296. package/out/_next/static/chunks/3tpo2ho54vtth.js +807 -0
  297. package/out/_next/static/chunks/3tqspv0ggt8j0.js +17 -0
  298. package/out/_next/static/chunks/3um54w4ca27n_.js +17 -0
  299. package/out/_next/static/chunks/3vet2a9q9rf2c.js +61 -0
  300. package/out/_next/static/chunks/3vjgbl76cgrmt.js +1 -0
  301. package/out/_next/static/chunks/3vz3gqmojh7sx.js +4 -0
  302. package/out/_next/static/chunks/3w2e5xa061qou.js +9 -0
  303. package/out/_next/static/chunks/3w9xrlkiztuwi.js +23 -0
  304. package/out/_next/static/chunks/3x4xfy_av3o0d.js +1 -0
  305. package/out/_next/static/chunks/3x9k13s5fam4j.js +22 -0
  306. package/out/_next/static/chunks/{3a7wm2331v13r.js → 3xmtbqm0gddn8.js} +3 -3
  307. package/out/_next/static/chunks/3z5uyt9mc9_fd.js +2 -0
  308. package/out/_next/static/chunks/3zlwp96x3hoy9.js +16 -0
  309. package/out/_next/static/chunks/3zr_sumh1g7il.js +22 -0
  310. package/out/_next/static/chunks/40jl8yfmy6tp6.js +234 -0
  311. package/out/_next/static/chunks/40xhwnc_48o73.js +297 -0
  312. package/out/_next/static/chunks/41-iysd7qkyg1.js +16 -0
  313. package/out/_next/static/chunks/4105a9rejv_p4.js +1 -0
  314. package/out/_next/static/chunks/41e2wlkp9_pvk.js +28 -0
  315. package/out/_next/static/chunks/41g7mv3yuhz6k.js +68 -0
  316. package/out/_next/static/chunks/43jyzccx6x0lw.js +1 -0
  317. package/out/_next/static/chunks/43vuxh3wdo567.js +10 -0
  318. package/out/_next/static/chunks/44daaafswok67.css +1 -0
  319. package/out/_next/static/chunks/452fv7r-tie6t.js +1 -0
  320. package/out/_next/static/chunks/{164wr2-2gfnlb.js → 457j51b69odrw.js} +1 -1
  321. package/out/_next/static/chunks/{turbopack-3pgmc-lv74ewz.js → turbopack-02vysfmmbped5.js} +1 -1
  322. package/out/_next/static/chunks/{turbopack-1o1rar8ouv6h9.js → turbopack-03fj2scz_09ul.js} +1 -1
  323. package/out/_next/static/chunks/turbopack-07wtduwtfqsl_.js +1 -0
  324. package/out/_next/static/chunks/turbopack-0_zihh5ueb_wj.js +1 -0
  325. package/out/_next/static/chunks/{turbopack-2yekm5ij2g-aw.js → turbopack-0b8-ww_z1vgvn.js} +1 -1
  326. package/out/_next/static/chunks/{turbopack-431y1sh-m_0mp.js → turbopack-0beql_u-wc_3e.js} +1 -1
  327. package/out/_next/static/chunks/{turbopack-3_mmmbs60vr14.js → turbopack-0dxdn-gyy3_qj.js} +1 -1
  328. package/out/_next/static/chunks/turbopack-0hqw81t-42tbj.js +1 -0
  329. package/out/_next/static/chunks/turbopack-0jsdrr-oq87lm.js +1 -0
  330. package/out/_next/static/chunks/turbopack-0jxa33q3ikjqg.js +1 -0
  331. package/out/_next/static/chunks/turbopack-0k9zths9zte_8.js +1 -0
  332. package/out/_next/static/chunks/turbopack-0pa42wgwsv141.js +1 -0
  333. package/out/_next/static/chunks/{turbopack-19vr9o5829d-f.js → turbopack-0te09_mp07k1x.js} +1 -1
  334. package/out/_next/static/chunks/turbopack-0xsxl45thi-35.js +1 -0
  335. package/out/_next/static/chunks/{turbopack-2fuk9oepxr5n0.js → turbopack-10-8q-q2zomxa.js} +1 -1
  336. package/out/_next/static/chunks/turbopack-142w-8owzbg7_.js +1 -0
  337. package/out/_next/static/chunks/{turbopack-23u97wxsuqiqb.js → turbopack-18tezl3vagvil.js} +1 -1
  338. package/out/_next/static/chunks/turbopack-1_1a-_v7vml72.js +1 -0
  339. package/out/_next/static/chunks/{turbopack-1zn9gl4fpayoc.js → turbopack-1_k-7s9lmntml.js} +1 -1
  340. package/out/_next/static/chunks/turbopack-1a47di2tss4e-.js +1 -0
  341. package/out/_next/static/chunks/turbopack-1c60gn7g-uduw.js +1 -0
  342. package/out/_next/static/chunks/turbopack-1e1yk3pkaodr5.js +1 -0
  343. package/out/_next/static/chunks/{turbopack-3v4nxmdavly34.js → turbopack-1jtk1c9w2axlk.js} +1 -1
  344. package/out/_next/static/chunks/turbopack-1k2ukl9u-7ovo.js +1 -0
  345. package/out/_next/static/chunks/{turbopack-39nctu3yv9iv4.js → turbopack-1lkz81ntcp1zv.js} +1 -1
  346. package/out/_next/static/chunks/{turbopack-2dk8ur1fvwxzj.js → turbopack-1pkw_r5dvv20d.js} +1 -1
  347. package/out/_next/static/chunks/turbopack-1pu2s2k3szn0s.js +1 -0
  348. package/out/_next/static/chunks/turbopack-1rxz_6lqtls5b.js +1 -0
  349. package/out/_next/static/chunks/turbopack-1uf07pugrv1fy.js +1 -0
  350. package/out/_next/static/chunks/turbopack-1uobzdn2r7ebw.js +1 -0
  351. package/out/_next/static/chunks/{turbopack-1od_4a7nj02l4.js → turbopack-1wv610ktbtzka.js} +1 -1
  352. package/out/_next/static/chunks/{turbopack-3w26eu86co02z.js → turbopack-1wz4te1fj20zp.js} +1 -1
  353. package/out/_next/static/chunks/{turbopack-0s4b5r_1d8yqv.js → turbopack-1zi2ss8eiiyfx.js} +1 -1
  354. package/out/_next/static/chunks/turbopack-207p7bsc5wea7.js +1 -0
  355. package/out/_next/static/chunks/{turbopack-2ga09m38zacev.js → turbopack-21zngkzhonfcm.js} +1 -1
  356. package/out/_next/static/chunks/turbopack-23y20ll8n-nwk.js +1 -0
  357. package/out/_next/static/chunks/{turbopack-19e_bi5k2rqyy.js → turbopack-26wtylwa4_s95.js} +1 -1
  358. package/out/_next/static/chunks/turbopack-27l7xplqpifq6.js +1 -0
  359. package/out/_next/static/chunks/turbopack-285oyoobdo21x.js +1 -0
  360. package/out/_next/static/chunks/turbopack-28b0zyhf3uqaq.js +1 -0
  361. package/out/_next/static/chunks/{turbopack-0ga3wfg-oyyst.js → turbopack-28m_9eg3draop.js} +1 -1
  362. package/out/_next/static/chunks/{turbopack-23nr2ioaqw90j.js → turbopack-29h9fgcal-fng.js} +1 -1
  363. package/out/_next/static/chunks/turbopack-2a84kh6nmf_78.js +1 -0
  364. package/out/_next/static/chunks/turbopack-2b73dx1bsdg5f.js +1 -0
  365. package/out/_next/static/chunks/{turbopack-2u_328z53ed9p.js → turbopack-2bslf96g-y1vv.js} +1 -1
  366. package/out/_next/static/chunks/turbopack-2d-2wg8-_f9-v.js +1 -0
  367. package/out/_next/static/chunks/{turbopack-30qkgccwlkv7n.js → turbopack-2ez-mfb63qve0.js} +1 -1
  368. package/out/_next/static/chunks/{turbopack-0m3lvbvrn923g.js → turbopack-2g7u83j1wlswz.js} +1 -1
  369. package/out/_next/static/chunks/{turbopack-3uj40sz7i7jg0.js → turbopack-2m4gns1_64-7_.js} +1 -1
  370. package/out/_next/static/chunks/{turbopack-0anbjm4c1j4u4.js → turbopack-2n4ba44aafc4x.js} +1 -1
  371. package/out/_next/static/chunks/turbopack-2t3zb47_j-ahd.js +1 -0
  372. package/out/_next/static/chunks/{turbopack-2rz_y4ejrvafp.js → turbopack-2tf6rdek5zvm6.js} +1 -1
  373. package/out/_next/static/chunks/{turbopack-0a3j0ezn8okfg.js → turbopack-2vb0p2htqo4nd.js} +1 -1
  374. package/out/_next/static/chunks/{turbopack-0sihqflu4qpvw.js → turbopack-30-bi-9_7jd01.js} +1 -1
  375. package/out/_next/static/chunks/turbopack-32pjcar5xpn1o.js +1 -0
  376. package/out/_next/static/chunks/{turbopack-3cv3hgsoo_z1k.js → turbopack-3a3skasosq9-4.js} +1 -1
  377. package/out/_next/static/chunks/{turbopack-0w2rzh4i3j2og.js → turbopack-3d2rk8-5wcgrs.js} +1 -1
  378. package/out/_next/static/chunks/{turbopack-4166pmk5_y_4x.js → turbopack-3i91g2le3tkne.js} +1 -1
  379. package/out/_next/static/chunks/turbopack-3j4bdo8-ldea5.js +1 -0
  380. package/out/_next/static/chunks/{turbopack-2qbfd_-7v5dbo.js → turbopack-3m47jybfw85nc.js} +1 -1
  381. package/out/_next/static/chunks/{turbopack-24ylsu2au7hg1.js → turbopack-3yfksvslbm14s.js} +1 -1
  382. package/out/_next/static/chunks/{turbopack-21vayl2_q4r5u.js → turbopack-414roft8p92hp.js} +1 -1
  383. package/out/_next/static/chunks/{turbopack-1r_0o22d_puxo.js → turbopack-424slv1lqxh_5.js} +1 -1
  384. package/out/_next/static/chunks/turbopack-444yt6auyioxn.js +1 -0
  385. package/out/_next/static/{4-xf4wPkZc5rcBq3jUTDg → z5KrmhOz2mLscINN5EbUf}/_buildManifest.js +66 -62
  386. package/out/_offline/index.html +2 -2
  387. package/out/account/forgot-password/index.html +2 -2
  388. package/out/account/index.html +2 -2
  389. package/out/assortments/AssortmentDetailPage/index.html +2 -2
  390. package/out/assortments/index.html +2 -2
  391. package/out/assortments/new/index.html +2 -2
  392. package/out/copilot/index.html +2 -2
  393. package/out/country/CountryDetailPage/index.html +2 -2
  394. package/out/country/index.html +2 -2
  395. package/out/country/new/index.html +2 -2
  396. package/out/currency/CurrencyDetailPage/index.html +2 -2
  397. package/out/currency/index.html +2 -2
  398. package/out/currency/new/index.html +2 -2
  399. package/out/delivery-provider/DeliveryProviderDetailPage/index.html +2 -2
  400. package/out/delivery-provider/index.html +2 -2
  401. package/out/delivery-provider/new/index.html +2 -2
  402. package/out/enrollments/EnrollmentDetailPage/index.html +2 -2
  403. package/out/enrollments/index.html +2 -2
  404. package/out/events/EventDetailPage/index.html +2 -2
  405. package/out/events/index.html +2 -2
  406. package/out/exports/index.html +2 -2
  407. package/out/ext/[[...slug]]/index.html +11 -0
  408. package/out/external/index.html +2 -2
  409. package/out/filters/FilterDetailPage/index.html +2 -2
  410. package/out/filters/index.html +2 -2
  411. package/out/filters/new/index.html +2 -2
  412. package/out/index.html +2 -2
  413. package/out/install/index.html +2 -2
  414. package/out/language/LanguageDetailPage/index.html +2 -2
  415. package/out/language/index.html +2 -2
  416. package/out/language/new/index.html +2 -2
  417. package/out/log-in/index.html +2 -2
  418. package/out/orders/OrderDetailPage/index.html +2 -2
  419. package/out/orders/index.html +2 -2
  420. package/out/payment-provider/PaymentProviderDetailPage/index.html +2 -2
  421. package/out/payment-provider/index.html +2 -2
  422. package/out/payment-provider/new/index.html +2 -2
  423. package/out/products/ProductDetailPage/index.html +2 -2
  424. package/out/products/index.html +2 -2
  425. package/out/products/new/index.html +2 -2
  426. package/out/quotations/QuotationDetailPage/index.html +2 -2
  427. package/out/quotations/index.html +2 -2
  428. package/out/reset-password/index.html +2 -2
  429. package/out/sign-up/index.html +2 -2
  430. package/out/styleguide/index.html +2 -2
  431. package/out/tokens/TokenDetailPage/index.html +2 -2
  432. package/out/tokens/index.html +2 -2
  433. package/out/users/UserDetailPage/index.html +2 -2
  434. package/out/users/index.html +2 -2
  435. package/out/users/new/index.html +2 -2
  436. package/out/verify-email/index.html +2 -2
  437. package/out/warehousing-provider/WarehousingProviderDetailPage/index.html +2 -2
  438. package/out/warehousing-provider/index.html +2 -2
  439. package/out/warehousing-provider/new/index.html +2 -2
  440. package/out/works/WorkDetailPage/index.html +2 -2
  441. package/out/works/WorkQueueListView/index.html +2 -2
  442. package/out/works/index.html +2 -2
  443. package/out/works/management/index.html +2 -2
  444. package/package.json +130 -26
  445. package/src/modules/accounts/index.ts +34 -0
  446. package/src/modules/assortment/index.ts +29 -0
  447. package/src/modules/copilot/index.ts +4 -0
  448. package/src/modules/country/index.ts +5 -0
  449. package/src/modules/currency/index.ts +5 -0
  450. package/src/modules/delivery-provider/index.ts +7 -0
  451. package/src/modules/enrollment/index.ts +6 -0
  452. package/src/modules/event/index.ts +3 -0
  453. package/src/modules/filter/index.ts +13 -0
  454. package/src/modules/language/index.ts +5 -0
  455. package/src/modules/order/index.ts +8 -0
  456. package/src/modules/payment-providers/index.ts +7 -0
  457. package/src/modules/product/index.ts +49 -0
  458. package/src/modules/product-review/index.ts +6 -0
  459. package/src/modules/quotation/index.ts +6 -0
  460. package/src/modules/token/index.ts +3 -0
  461. package/src/modules/warehousing-providers/index.ts +7 -0
  462. package/src/modules/work/index.ts +7 -0
  463. package/src/sdk/README.md +226 -0
  464. package/src/sdk/form-entry.test.mjs +11 -0
  465. package/src/sdk/hooks.ts +15 -0
  466. package/src/sdk/modal.ts +6 -0
  467. package/src/sdk/plugin-build.mjs +97 -0
  468. package/src/sdk/plugin-build.test.mjs +46 -0
  469. package/src/sdk/plugin-runtime.cjs +66 -0
  470. package/src/sdk/plugin-runtime.d.mts +11 -0
  471. package/src/sdk/plugin-runtime.mjs +27 -0
  472. package/src/sdk/plugin-runtime.test.mjs +32 -0
  473. package/src/sdk/plugins.mjs +17 -0
  474. package/src/sdk/plugins.ts +105 -0
  475. package/src/sdk/providers.ts +4 -0
  476. package/src/sdk/shared-context.test.mjs +40 -0
  477. package/src/sdk/shims/admin-ui-plugins.ts +3 -0
  478. package/src/sdk/shims/apollo-client-react.ts +3 -0
  479. package/src/sdk/shims/apollo-client.ts +3 -0
  480. package/src/sdk/shims/host.ts +61 -0
  481. package/src/sdk/shims/next-head.ts +3 -0
  482. package/src/sdk/shims/next-image.ts +3 -0
  483. package/src/sdk/shims/next-link.ts +3 -0
  484. package/src/sdk/shims/next-router.ts +3 -0
  485. package/src/sdk/shims/react-dom-client.ts +3 -0
  486. package/src/sdk/shims/react-dom.ts +3 -0
  487. package/src/sdk/shims/react-hook-form.ts +3 -0
  488. package/src/sdk/shims/react-intl.ts +3 -0
  489. package/src/sdk/shims/react-jsx-runtime.ts +3 -0
  490. package/src/sdk/shims/react-toastify.ts +3 -0
  491. package/src/sdk/shims/react.ts +3 -0
  492. package/src/sdk/tailwind-preset.mjs +94 -0
  493. package/src/sdk/theme.ts +61 -0
  494. package/src/styles/globals.css +291 -0
  495. package/dist/chunk-F2TCVEQX.js +0 -514
  496. package/dist/chunk-KCN7DDPH.js +0 -1116
  497. package/dist/chunk-RORNAN2J.js +0 -12
  498. package/dist/chunk-RVG6IOFC.js +0 -11
  499. package/dist/chunk-YZGQJJCD.js +0 -37
  500. package/out/_next/static/chunks/0-mytn4v5bu5h.js +0 -12
  501. package/out/_next/static/chunks/0-uh133eqcz6n.js +0 -60
  502. package/out/_next/static/chunks/0060t3kg_i0lf.js +0 -10
  503. package/out/_next/static/chunks/0186bg0b60cid.js +0 -13
  504. package/out/_next/static/chunks/018n9pot9f5uf.js +0 -90
  505. package/out/_next/static/chunks/01h4ept18s-ns.js +0 -807
  506. package/out/_next/static/chunks/02cdoh48sex9m.js +0 -1
  507. package/out/_next/static/chunks/03-z1yl608b56.js +0 -807
  508. package/out/_next/static/chunks/030bzkeke0edz.js +0 -7
  509. package/out/_next/static/chunks/037vsiy28s6dg.js +0 -41
  510. package/out/_next/static/chunks/049clkw76lm67.js +0 -16
  511. package/out/_next/static/chunks/04bb4k67x398t.js +0 -1
  512. package/out/_next/static/chunks/057evs7qr5y-t.js +0 -17
  513. package/out/_next/static/chunks/05qpw6q8uiz3l.js +0 -15
  514. package/out/_next/static/chunks/062myzj-2ehu-.js +0 -52
  515. package/out/_next/static/chunks/06l-rqlf4bp81.js +0 -108
  516. package/out/_next/static/chunks/06tejx8u1_0kg.js +0 -1
  517. package/out/_next/static/chunks/07nffhr51vke6.js +0 -59
  518. package/out/_next/static/chunks/08tyybz20igty.js +0 -15
  519. package/out/_next/static/chunks/0989pcuje2j55.js +0 -66
  520. package/out/_next/static/chunks/0_02skyivjqh6.js +0 -14
  521. package/out/_next/static/chunks/0_ngi84ak813x.js +0 -288
  522. package/out/_next/static/chunks/0bc02hascgv7z.js +0 -1
  523. package/out/_next/static/chunks/0c9ruqj2wf3n6.js +0 -905
  524. package/out/_next/static/chunks/0cblqqpscyy7w.js +0 -12
  525. package/out/_next/static/chunks/0cotrfgh1n2cx.js +0 -346
  526. package/out/_next/static/chunks/0d6_opzy2p6ik.js +0 -807
  527. package/out/_next/static/chunks/0e2e0srgvkzk9.js +0 -144
  528. package/out/_next/static/chunks/0g6hr3dmen536.js +0 -7
  529. package/out/_next/static/chunks/0ht2wu-61vq9v.js +0 -807
  530. package/out/_next/static/chunks/0ibp5q64hnd88.js +0 -18
  531. package/out/_next/static/chunks/0ichlp5c67dko.js +0 -12
  532. package/out/_next/static/chunks/0iui_zfuxfa45.js +0 -12
  533. package/out/_next/static/chunks/0k6z6zl_zxqp7.js +0 -13
  534. package/out/_next/static/chunks/0kkky_8vhaeaz.js +0 -227
  535. package/out/_next/static/chunks/0lutmpv07icdg.js +0 -8
  536. package/out/_next/static/chunks/0mzh9-epgepi1.js +0 -119
  537. package/out/_next/static/chunks/0n0uzfbkfb7e5.js +0 -12
  538. package/out/_next/static/chunks/0nhczsa2mm354.js +0 -16
  539. package/out/_next/static/chunks/0pecsk3c09b19.js +0 -3
  540. package/out/_next/static/chunks/0prynyrvhm7ef.js +0 -2
  541. package/out/_next/static/chunks/0q-14a7j6afh3.js +0 -1
  542. package/out/_next/static/chunks/0razrbxeai797.js +0 -807
  543. package/out/_next/static/chunks/0ryqvctymlr3k.js +0 -12
  544. package/out/_next/static/chunks/0se09klbk8drd.js +0 -68
  545. package/out/_next/static/chunks/0sh5256hzmj3b.js +0 -14
  546. package/out/_next/static/chunks/0srpqs12m-bwy.js +0 -13
  547. package/out/_next/static/chunks/0ukyxgmnqos6o.js +0 -1
  548. package/out/_next/static/chunks/0uv4d5f9o8wu1.js +0 -10
  549. package/out/_next/static/chunks/0vls1lbu_rh78.js +0 -342
  550. package/out/_next/static/chunks/0vx_1vxljh4tn.js +0 -13
  551. package/out/_next/static/chunks/0vxe9bw7ffqy2.js +0 -15
  552. package/out/_next/static/chunks/0w0zigi7aws2m.js +0 -1
  553. package/out/_next/static/chunks/0w2zoz_fn_wha.js +0 -137
  554. package/out/_next/static/chunks/0xuevvy5i5d12.js +0 -138
  555. package/out/_next/static/chunks/0xxvsq70e4xn0.js +0 -1
  556. package/out/_next/static/chunks/0yxc1yy1eq4u3.js +0 -149
  557. package/out/_next/static/chunks/1-uz_5-063kh9.js +0 -188
  558. package/out/_next/static/chunks/10h7lznd10mmp.js +0 -384
  559. package/out/_next/static/chunks/10os1s66nimmi.js +0 -110
  560. package/out/_next/static/chunks/12_5-baf13q49.js +0 -195
  561. package/out/_next/static/chunks/12qzh85d5on4y.js +0 -44
  562. package/out/_next/static/chunks/12ukdi5bzlbeo.js +0 -596
  563. package/out/_next/static/chunks/1398hevtpl_69.js +0 -1
  564. package/out/_next/static/chunks/13qk8ukzu1snm.js +0 -288
  565. package/out/_next/static/chunks/16ey81skn09dz.js +0 -1
  566. package/out/_next/static/chunks/18kae_yjyhjwf.js +0 -16
  567. package/out/_next/static/chunks/1_quktgfhf40v.js +0 -31
  568. package/out/_next/static/chunks/1aegvtb5jv57q.js +0 -12
  569. package/out/_next/static/chunks/1cgxgd2cf8u3j.js +0 -157
  570. package/out/_next/static/chunks/1cp4-dvxowp4c.js +0 -24
  571. package/out/_next/static/chunks/1d951b6ed8oqn.js +0 -110
  572. package/out/_next/static/chunks/1d_puhcn8lg6q.js +0 -51
  573. package/out/_next/static/chunks/1drrou5kp4qdz.js +0 -1
  574. package/out/_next/static/chunks/1e4_28-3u5o85.js +0 -30
  575. package/out/_next/static/chunks/1f3mflnvp8_7-.js +0 -31
  576. package/out/_next/static/chunks/1f5-j4f3irx0j.js +0 -147
  577. package/out/_next/static/chunks/1fzbon-ih4_3j.js +0 -1
  578. package/out/_next/static/chunks/1g57y7cq7tjcb.js +0 -9
  579. package/out/_next/static/chunks/1g8f6jrb9cp9v.js +0 -13
  580. package/out/_next/static/chunks/1gksg35fivk0-.js +0 -224
  581. package/out/_next/static/chunks/1gy9ae4fpd6jm.js +0 -17
  582. package/out/_next/static/chunks/1hq9yt63076pk.js +0 -16
  583. package/out/_next/static/chunks/1ikm9qcx--k3u.js +0 -807
  584. package/out/_next/static/chunks/1izpxynqp99t4.js +0 -193
  585. package/out/_next/static/chunks/1j2ko85jp-5wy.js +0 -807
  586. package/out/_next/static/chunks/1k-cn_5ey1u62.js +0 -15
  587. package/out/_next/static/chunks/1k0mvn915uz76.js +0 -14
  588. package/out/_next/static/chunks/1l4snbkce_jb6.js +0 -15
  589. package/out/_next/static/chunks/1lbsdlf5h6ojc.js +0 -16
  590. package/out/_next/static/chunks/1mwvnv71bl7mc.js +0 -1
  591. package/out/_next/static/chunks/1n7i2rp59o9o8.js +0 -384
  592. package/out/_next/static/chunks/1pklei2ds10d2.js +0 -66
  593. package/out/_next/static/chunks/1pxor-3_vf3du.js +0 -31
  594. package/out/_next/static/chunks/1qp68765j1aiv.js +0 -61
  595. package/out/_next/static/chunks/1r-cvj3mpr-7x.js +0 -87
  596. package/out/_next/static/chunks/1sivy8bkkmwxl.js +0 -5
  597. package/out/_next/static/chunks/1vk6h4qps69vq.js +0 -12
  598. package/out/_next/static/chunks/1vx8_u7-f7q8u.js +0 -28
  599. package/out/_next/static/chunks/1weq9keqxiqpy.js +0 -73
  600. package/out/_next/static/chunks/1wvicoevgxhkk.js +0 -14
  601. package/out/_next/static/chunks/1ziicn0eb_yji.js +0 -16
  602. package/out/_next/static/chunks/1zza9faw4t3b_.js +0 -46
  603. package/out/_next/static/chunks/1zzpf1xbmchcj.js +0 -132
  604. package/out/_next/static/chunks/2-4ng9fxftmld.js +0 -1
  605. package/out/_next/static/chunks/201rx84kyo8ag.js +0 -1
  606. package/out/_next/static/chunks/20rtv8f0brb0n.js +0 -43
  607. package/out/_next/static/chunks/21a19t2pe0fpg.js +0 -81
  608. package/out/_next/static/chunks/21o2yfegozc0m.js +0 -16
  609. package/out/_next/static/chunks/22w2ovaffle-i.js +0 -21
  610. package/out/_next/static/chunks/234pfdqctlnyt.js +0 -100
  611. package/out/_next/static/chunks/25d8wr34sbm__.js +0 -15
  612. package/out/_next/static/chunks/275o3ly3svw4p.js +0 -1
  613. package/out/_next/static/chunks/28z1z7in8-kbg.js +0 -26
  614. package/out/_next/static/chunks/29w1exzy704_7.js +0 -8
  615. package/out/_next/static/chunks/2bb7696udjx6k.js +0 -44
  616. package/out/_next/static/chunks/2bm5aw8hqlgf2.js +0 -50
  617. package/out/_next/static/chunks/2c4vy8ofex0ti.js +0 -14
  618. package/out/_next/static/chunks/2c7gw8ronvu-c.js +0 -807
  619. package/out/_next/static/chunks/2cbr3ybo4xsrv.js +0 -43
  620. package/out/_next/static/chunks/2eh6ku1a1zbs4.js +0 -135
  621. package/out/_next/static/chunks/2fed4-6c0ghqp.js +0 -99
  622. package/out/_next/static/chunks/2g39exixp92yf.js +0 -13
  623. package/out/_next/static/chunks/2gil5igdermzh.js +0 -36
  624. package/out/_next/static/chunks/2hm0mbq0vtqmw.js +0 -5
  625. package/out/_next/static/chunks/2hvt_8j6jkd_n.js +0 -14
  626. package/out/_next/static/chunks/2i5uj5i4z-xu8.js +0 -188
  627. package/out/_next/static/chunks/2ismth22knujm.js +0 -1
  628. package/out/_next/static/chunks/2iuznbar_ttrh.js +0 -18
  629. package/out/_next/static/chunks/2j6cph79-th54.js +0 -7
  630. package/out/_next/static/chunks/2jln1kjysf99p.js +0 -1
  631. package/out/_next/static/chunks/2jtk4-i4e9lug.js +0 -1
  632. package/out/_next/static/chunks/2k020ab3luqev.js +0 -1
  633. package/out/_next/static/chunks/2kbieaechn8m8.js +0 -1
  634. package/out/_next/static/chunks/2lwxs_ly4bz1o.js +0 -12
  635. package/out/_next/static/chunks/2mr2k4sb6i021.js +0 -32
  636. package/out/_next/static/chunks/2na27-e8gs0-f.js +0 -171
  637. package/out/_next/static/chunks/2nn3_f04lnr0b.js +0 -807
  638. package/out/_next/static/chunks/2ocwu5vbc5r34.js +0 -73
  639. package/out/_next/static/chunks/2qprgjhjl8d4c.js +0 -807
  640. package/out/_next/static/chunks/2rtyphk0o1hbr.js +0 -5
  641. package/out/_next/static/chunks/2skxi0oqka3ef.js +0 -26
  642. package/out/_next/static/chunks/2sukt9l-1md8_.js +0 -25
  643. package/out/_next/static/chunks/2t3t6gm5vlg_0.js +0 -58
  644. package/out/_next/static/chunks/2vt52_i-6cdbh.js +0 -10
  645. package/out/_next/static/chunks/2w5y5xf0nriwx.js +0 -1
  646. package/out/_next/static/chunks/2we4fnghpvprw.js +0 -190
  647. package/out/_next/static/chunks/30g-s0ioynhjx.js +0 -224
  648. package/out/_next/static/chunks/31y7dx6ytab7h.js +0 -3
  649. package/out/_next/static/chunks/363ng2l8o_bee.js +0 -101
  650. package/out/_next/static/chunks/36jick0alh9oa.js +0 -50
  651. package/out/_next/static/chunks/36pa0vs0telmp.js +0 -1
  652. package/out/_next/static/chunks/36yth4lm03_j8.js +0 -1
  653. package/out/_next/static/chunks/37phwvegpccj0.js +0 -217
  654. package/out/_next/static/chunks/38b7m-s26ciug.js +0 -137
  655. package/out/_next/static/chunks/38ipj45w-tqay.js +0 -21
  656. package/out/_next/static/chunks/38pz7fmyf6ay0.js +0 -1
  657. package/out/_next/static/chunks/39634va9fx9s2.js +0 -13
  658. package/out/_next/static/chunks/3a0hqx7ohm5lh.js +0 -23
  659. package/out/_next/static/chunks/3dr_oa5hx41is.js +0 -14
  660. package/out/_next/static/chunks/3e7w6ko5psik7.js +0 -17
  661. package/out/_next/static/chunks/3ebh4y7h6y1vq.js +0 -58
  662. package/out/_next/static/chunks/3eow7lw1727kt.js +0 -13
  663. package/out/_next/static/chunks/3f1gb4_hyhtho.js +0 -20
  664. package/out/_next/static/chunks/3g4qj6_qh97q_.js +0 -12
  665. package/out/_next/static/chunks/3gfjdynb9mg8h.js +0 -23
  666. package/out/_next/static/chunks/3gx4smk7pb27x.js +0 -119
  667. package/out/_next/static/chunks/3jcf4ei6zgnca.js +0 -17
  668. package/out/_next/static/chunks/3kisw9hre44e5.js +0 -807
  669. package/out/_next/static/chunks/3mnt471ayfsvh.js +0 -22
  670. package/out/_next/static/chunks/3ondw3-zthjz5.js +0 -15
  671. package/out/_next/static/chunks/3opuxnw_w3yb5.js +0 -101
  672. package/out/_next/static/chunks/3oxv1fo564rrf.js +0 -142
  673. package/out/_next/static/chunks/3ra_41-fw410n.js +0 -14
  674. package/out/_next/static/chunks/3s22ovhmk-4h7.js +0 -1
  675. package/out/_next/static/chunks/3sktz8258so64.js +0 -2
  676. package/out/_next/static/chunks/3tq-bb0j1_lpu.js +0 -14
  677. package/out/_next/static/chunks/3v1dxn4rp-o3v.js +0 -315
  678. package/out/_next/static/chunks/3w_wwl_hd91od.js +0 -1
  679. package/out/_next/static/chunks/3ww_p-agyd9u-.js +0 -14
  680. package/out/_next/static/chunks/3wzzh45yillzb.js +0 -1
  681. package/out/_next/static/chunks/3xfj8_2nd5d_1.js +0 -1
  682. package/out/_next/static/chunks/3xhmfg-981n_5.js +0 -61
  683. package/out/_next/static/chunks/3yz34q3ulli7q.js +0 -12
  684. package/out/_next/static/chunks/3z_c5kpm-e1ty.js +0 -15
  685. package/out/_next/static/chunks/3zqfchpzqxd92.css +0 -1
  686. package/out/_next/static/chunks/3zs002htik_8l.js +0 -21
  687. package/out/_next/static/chunks/4079hjuumfmm2.js +0 -31
  688. package/out/_next/static/chunks/40922jbr_e5ug.js +0 -51
  689. package/out/_next/static/chunks/40zy6mxa-be0m.js +0 -1
  690. package/out/_next/static/chunks/41fbmiggueudh.js +0 -13
  691. package/out/_next/static/chunks/43e0fp97w800k.js +0 -13
  692. package/out/_next/static/chunks/43gv4x1sfyb5l.js +0 -9
  693. package/out/_next/static/chunks/44nj9c766dqvc.js +0 -807
  694. package/out/_next/static/chunks/44r51e87s4z_d.js +0 -8
  695. package/out/_next/static/chunks/458tg2eg5h8j5.js +0 -324
  696. package/out/_next/static/chunks/45cd4ypk94sw2.js +0 -807
  697. package/out/_next/static/chunks/turbopack-01866gjdddrxa.js +0 -1
  698. package/out/_next/static/chunks/turbopack-08ttg7vxsdnsj.js +0 -1
  699. package/out/_next/static/chunks/turbopack-0pmjdjcdx7cqp.js +0 -1
  700. package/out/_next/static/chunks/turbopack-0tc31uax4buqq.js +0 -1
  701. package/out/_next/static/chunks/turbopack-10ldzl5n31zl-.js +0 -1
  702. package/out/_next/static/chunks/turbopack-19i6-4a5o4fil.js +0 -1
  703. package/out/_next/static/chunks/turbopack-19yw5qwon7l57.js +0 -1
  704. package/out/_next/static/chunks/turbopack-1cx5i7_gdoz5k.js +0 -1
  705. package/out/_next/static/chunks/turbopack-1d-c7awe26kf5.js +0 -1
  706. package/out/_next/static/chunks/turbopack-1l1aen9tojmq4.js +0 -1
  707. package/out/_next/static/chunks/turbopack-1rmdtpi005n_6.js +0 -1
  708. package/out/_next/static/chunks/turbopack-1wx5785osz26z.js +0 -1
  709. package/out/_next/static/chunks/turbopack-28_dvdmt6lvhn.js +0 -1
  710. package/out/_next/static/chunks/turbopack-2bo7hmw4eirxu.js +0 -1
  711. package/out/_next/static/chunks/turbopack-2e_wy0ffi64id.js +0 -1
  712. package/out/_next/static/chunks/turbopack-2g2viapamsvwe.js +0 -1
  713. package/out/_next/static/chunks/turbopack-2pxtve7lryqre.js +0 -1
  714. package/out/_next/static/chunks/turbopack-2u0ls0liblo_9.js +0 -1
  715. package/out/_next/static/chunks/turbopack-2xfom16ggx1i3.js +0 -1
  716. package/out/_next/static/chunks/turbopack-2ycfwit0p-fkf.js +0 -1
  717. package/out/_next/static/chunks/turbopack-3-w-v8og1lok2.js +0 -1
  718. package/out/_next/static/chunks/turbopack-36bl9-rerhcfg.js +0 -1
  719. package/out/_next/static/chunks/turbopack-37a6lyjyz7fts.js +0 -1
  720. package/out/_next/static/chunks/turbopack-37lb9ujef-ujm.js +0 -1
  721. package/out/_next/static/chunks/turbopack-3_o3qz69ih0uu.js +0 -1
  722. package/out/_next/static/chunks/turbopack-3cv39r7v3s2gr.js +0 -1
  723. package/out/_next/static/chunks/turbopack-3vfm6fp92up6y.js +0 -1
  724. package/out/_next/static/chunks/turbopack-3vyi51cuxeowy.js +0 -1
  725. package/out/_next/static/chunks/turbopack-3zc0h1216mtm2.js +0 -1
  726. package/out/admin-ui-permissions.js +0 -129
  727. /package/out/_next/static/{4-xf4wPkZc5rcBq3jUTDg → z5KrmhOz2mLscINN5EbUf}/_clientMiddlewareManifest.js +0 -0
  728. /package/out/_next/static/{4-xf4wPkZc5rcBq3jUTDg → z5KrmhOz2mLscINN5EbUf}/_ssgManifest.js +0 -0
@@ -1,23 +1,37 @@
1
1
  import { ProductReviewDetailFragment_default } from '../chunk-ILYPJE4N.js';
2
- import { TokenFragment_default } from '../chunk-QNLGYFV7.js';
2
+ import { TokenFragment_default } from '../chunk-IYKPRAWC.js';
3
3
  import { useCurrencies_default } from '../chunk-NT7RB7AK.js';
4
+ import { FormWrapper_default, NoData_default, ImageWithFallback_default, SaveAndCancelButtons_default, Button_default, DraggableIcon_default } from '../chunk-DTJ2DTKS.js';
5
+ import { TextField_default, MarkdownTextAreaField_default, FormErrors_default } from '../chunk-HTPSKUXQ.js';
6
+ import { Form_default, TagInputField_default, HelpText_default, SubmitButton_default, clsx_default, PencilSquareIcon_default, TrashIcon_default } from '../chunk-H6G4UTZ5.js';
7
+ import '../chunk-VDKQGOMV.js';
8
+ import { useAuth_default } from '../chunk-OTXM2UCD.js';
9
+ import { useForm_default } from '../chunk-Q6S3LBUF.js';
10
+ import '../chunk-I64TXIE7.js';
11
+ import { DangerMessage_default } from '../chunk-KRIRF7F6.js';
12
+ import { UserCircleIcon_default } from '../chunk-HERLM47Z.js';
13
+ import { useModal_default } from '../chunk-F6LBNV3H.js';
14
+ import '../chunk-VBO377AY.js';
4
15
  import '../chunk-QWQ3WJJN.js';
5
16
  import { parseUniqueId } from '../chunk-IXBMHOB5.js';
6
- import { useApp_default } from '../chunk-RORNAN2J.js';
7
17
  import { ProductBriefFragment_default } from '../chunk-EJDZRZSZ.js';
8
18
  import { parseMeta_default } from '../chunk-YO6PT7KD.js';
9
- import '../chunk-JAVEZY3Q.js';
19
+ import { useApp_default, useShopInfo_default } from '../chunk-AOR2B5N5.js';
10
20
  import '../chunk-ELPURWDC.js';
11
21
  import '../chunk-RAQV2GYF.js';
12
22
  import '../chunk-54DKBWXV.js';
23
+ import '../chunk-J23QSWDL.js';
13
24
  import { useConfirmMediaUpload_default, PUTMedia_default } from '../chunk-COV7BREX.js';
14
25
  import '../chunk-GY2DRQGW.js';
15
26
  import { useUnchainedContext_default } from '../chunk-IAQPLRXZ.js';
16
- import '../chunk-4VNS5WPM.js';
27
+ import '../chunk-WPLOTFGW.js';
17
28
  import { gql } from '@apollo/client';
18
29
  import { useMutation, useQuery } from '@apollo/client/react';
19
- import { useRef, useState, useEffect } from 'react';
20
- import { useIntl } from 'react-intl';
30
+ import React3, { createContext, useRef, useState, useEffect, useMemo, memo, useReducer, useCallback, useLayoutEffect, useContext } from 'react';
31
+ import { useIntl, FormattedMessage } from 'react-intl';
32
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
33
+ import { toast } from 'react-toastify';
34
+ import { unstable_batchedUpdates, createPortal } from 'react-dom';
21
35
 
22
36
  var AddProductAssignmentMutation = gql`
23
37
  mutation AddProductAssignment(
@@ -1921,5 +1935,4732 @@ var useUserTokens = ({ userId = null }) => {
1921
1935
  };
1922
1936
  };
1923
1937
  var useUserTokens_default = useUserTokens;
1938
+ var SelfDocumentingView = ({
1939
+ documentationLabel,
1940
+ documentation = null,
1941
+ mainContent = null,
1942
+ sideComponents = null,
1943
+ className = null,
1944
+ children
1945
+ }) => {
1946
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: clsx_default("mt-5 lg:grid lg:grid-cols-3 lg:gap-6", className), children: [
1947
+ /* @__PURE__ */ jsx("div", { className: "lg:col-span-1 mt-10 lg:mt-1", children: /* @__PURE__ */ jsxs("div", { className: "px-4 sm:px-0", children: [
1948
+ /* @__PURE__ */ jsx("h3", { className: "text-lg text-text-primary", children: documentationLabel }),
1949
+ /* @__PURE__ */ jsx("div", { className: "mt-1 text-sm text-slate-600 dark:text-slate-500", children: documentation }),
1950
+ sideComponents
1951
+ ] }) }),
1952
+ /* @__PURE__ */ jsx("div", { className: "lg:col-span-2 lg:mt-0", children: children || mainContent })
1953
+ ] }) });
1954
+ };
1955
+ var SelfDocumentingView_default = SelfDocumentingView;
1956
+ var ProductTextsForm = ({
1957
+ productId,
1958
+ disabled = false
1959
+ }) => {
1960
+ const { selectedLocale, setSelectedLocale, languageDialectList } = useApp_default();
1961
+ const { formatMessage } = useIntl();
1962
+ const { hasRole } = useAuth_default();
1963
+ const { defaultLocale, shopInfo, loading: shopInfoLoading } = useShopInfo_default();
1964
+ const { translatedTexts } = useTranslatedProductTexts_default({ productId });
1965
+ const successMessage = formatMessage({
1966
+ id: "saved",
1967
+ defaultMessage: "Saved"
1968
+ });
1969
+ const { updateProductTexts } = useUpdateProductTexts_default();
1970
+ const onSubmit = async ({
1971
+ slug,
1972
+ title,
1973
+ subtitle,
1974
+ vendor,
1975
+ description,
1976
+ brand,
1977
+ labels
1978
+ }) => {
1979
+ await updateProductTexts({
1980
+ productId,
1981
+ texts: [
1982
+ {
1983
+ locale: selectedLocale,
1984
+ slug,
1985
+ title,
1986
+ subtitle,
1987
+ vendor,
1988
+ description,
1989
+ brand,
1990
+ labels
1991
+ }
1992
+ ]
1993
+ });
1994
+ return { success: true };
1995
+ };
1996
+ const form = useForm_default({
1997
+ disabled,
1998
+ submit: onSubmit,
1999
+ successMessage,
2000
+ initialValues: {
2001
+ slug: "",
2002
+ title: "",
2003
+ subtitle: "",
2004
+ vendor: "",
2005
+ description: "",
2006
+ brand: "",
2007
+ labels: []
2008
+ }
2009
+ });
2010
+ useEffect(() => {
2011
+ const value = translatedTexts?.find(
2012
+ (text) => text.locale === selectedLocale
2013
+ );
2014
+ form.api.setValues({
2015
+ slug: "",
2016
+ title: "",
2017
+ subtitle: "",
2018
+ vendor: "",
2019
+ description: "",
2020
+ brand: "",
2021
+ labels: [],
2022
+ ...value || {}
2023
+ });
2024
+ }, [translatedTexts, selectedLocale]);
2025
+ useEffect(() => {
2026
+ if (shopInfo && translatedTexts?.length) {
2027
+ if (translatedTexts?.find(({ locale }) => locale === selectedLocale)) {
2028
+ return;
2029
+ }
2030
+ if (defaultLocale && translatedTexts?.find(({ locale }) => locale === defaultLocale)) {
2031
+ setSelectedLocale(defaultLocale);
2032
+ } else if (defaultLocale && translatedTexts?.find(
2033
+ ({ locale }) => locale === defaultLocale.split("-")[0]
2034
+ )) {
2035
+ setSelectedLocale(defaultLocale.split("-")[0]);
2036
+ } else {
2037
+ const firstAvailableText = translatedTexts?.find(
2038
+ ({ locale }) => locale && languageDialectList?.find(({ isoCode }) => isoCode === locale)
2039
+ );
2040
+ setSelectedLocale(firstAvailableText?.locale);
2041
+ }
2042
+ }
2043
+ }, [shopInfoLoading, translatedTexts]);
2044
+ return /* @__PURE__ */ jsx(
2045
+ SelfDocumentingView_default,
2046
+ {
2047
+ documentationLabel: formatMessage({
2048
+ id: "texts",
2049
+ defaultMessage: "Texts"
2050
+ }),
2051
+ className: "mt-2 lg:mt-5",
2052
+ documentation: /* @__PURE__ */ jsx(
2053
+ FormattedMessage,
2054
+ {
2055
+ id: "product_text_form_description",
2056
+ defaultMessage: "<ul> <li><strong>Slug:</strong> The unique part of your product URL (e.g., 'my-awesome-product'). Keep it short and descriptive.</li>\n <li><strong>Localization:</strong> Switch languages using the dropdown at the top left to translate content for different markets.</li>\n <li><strong>Description:</strong> Supports Markdown and HTML formatting. Use double backslash (\\\\\\\\) for line breaks.</li>\n <li><strong>Labels:</strong> Eye-catching badges that appear on your product (e.g., 'New Arrival', '50% Off', 'Limited Edition'). Perfect for promotions and highlighting special features. Each language can have unique labels.</li>\n <li><strong>Key Difference:</strong> Labels are customer-facing promotional badges, while Tags are internal keywords for organization and filtering.</li>\n </ul>",
2057
+ values: {
2058
+ ul: (chunk) => /* @__PURE__ */ jsxs("ul", { className: "space-y-2", children: [
2059
+ chunk,
2060
+ " "
2061
+ ] }),
2062
+ li: (chunk) => /* @__PURE__ */ jsxs("li", { className: "text-sm", children: [
2063
+ chunk,
2064
+ " "
2065
+ ] }, Math.random()),
2066
+ strong: (chunk) => /* @__PURE__ */ jsx("strong", { className: "font-semibold text-text-secondary", children: chunk })
2067
+ }
2068
+ }
2069
+ ),
2070
+ children: /* @__PURE__ */ jsx(FormWrapper_default, { children: /* @__PURE__ */ jsxs(Form_default, { form, disabled: !hasRole("manageProducts" /* ManageProducts */), children: [
2071
+ /* @__PURE__ */ jsxs("div", { className: "relative text-text-muted px-4 py-5 sm:p-6", children: [
2072
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-6 gap-6", children: [
2073
+ /* @__PURE__ */ jsx("div", { className: "col-span-6 sm:col-span-3", children: /* @__PURE__ */ jsx(
2074
+ TextField_default,
2075
+ {
2076
+ name: "slug",
2077
+ disabled: !hasRole("manageProducts" /* ManageProducts */),
2078
+ required: true,
2079
+ id: "slug",
2080
+ label: formatMessage({
2081
+ id: "slug",
2082
+ defaultMessage: "Slug"
2083
+ }),
2084
+ autoComplete: "on",
2085
+ className: "text-sm"
2086
+ }
2087
+ ) }),
2088
+ /* @__PURE__ */ jsx("div", { className: "col-span-6 sm:col-span-3", children: /* @__PURE__ */ jsx(
2089
+ TextField_default,
2090
+ {
2091
+ name: "title",
2092
+ disabled: !hasRole("manageProducts" /* ManageProducts */),
2093
+ required: true,
2094
+ id: "title",
2095
+ label: formatMessage({
2096
+ id: "title",
2097
+ defaultMessage: "Title"
2098
+ }),
2099
+ autoComplete: "on",
2100
+ className: "text-sm"
2101
+ }
2102
+ ) }),
2103
+ /* @__PURE__ */ jsx("div", { className: "col-span-6 sm:col-span-3", children: /* @__PURE__ */ jsx(
2104
+ TextField_default,
2105
+ {
2106
+ name: "subtitle",
2107
+ disabled: !hasRole("manageProducts" /* ManageProducts */),
2108
+ id: "subtitle",
2109
+ label: formatMessage({
2110
+ id: "subtitle",
2111
+ defaultMessage: "Subtitle"
2112
+ }),
2113
+ autoComplete: "on",
2114
+ className: "text-sm"
2115
+ }
2116
+ ) }),
2117
+ /* @__PURE__ */ jsx("div", { className: "col-span-6 sm:col-span-3", children: /* @__PURE__ */ jsx(
2118
+ TextField_default,
2119
+ {
2120
+ name: "vendor",
2121
+ disabled: !hasRole("manageProducts" /* ManageProducts */),
2122
+ id: "vendor",
2123
+ label: formatMessage({
2124
+ id: "vendor",
2125
+ defaultMessage: "Vendor"
2126
+ }),
2127
+ autoComplete: "on",
2128
+ className: "text-sm"
2129
+ }
2130
+ ) }),
2131
+ /* @__PURE__ */ jsx("div", { className: "col-span-6 sm:col-span-3", children: /* @__PURE__ */ jsx(
2132
+ TextField_default,
2133
+ {
2134
+ name: "brand",
2135
+ disabled: !hasRole("manageProducts" /* ManageProducts */),
2136
+ id: "brand",
2137
+ label: formatMessage({
2138
+ id: "brand",
2139
+ defaultMessage: "Brand"
2140
+ }),
2141
+ autoComplete: "on",
2142
+ className: "text-sm"
2143
+ }
2144
+ ) }),
2145
+ /* @__PURE__ */ jsxs("div", { className: "col-span-6 sm:col-span-3", children: [
2146
+ /* @__PURE__ */ jsx(
2147
+ TagInputField_default,
2148
+ {
2149
+ name: "labels",
2150
+ id: "labels",
2151
+ disabled: !hasRole("manageProducts" /* ManageProducts */),
2152
+ label: formatMessage({
2153
+ id: "labels",
2154
+ defaultMessage: "Labels"
2155
+ }),
2156
+ placeholder: formatMessage({
2157
+ id: "label",
2158
+ defaultMessage: "Label"
2159
+ }),
2160
+ buttonText: formatMessage({
2161
+ id: "add",
2162
+ defaultMessage: "Add"
2163
+ }),
2164
+ autoComplete: "on",
2165
+ className: "text-sm"
2166
+ }
2167
+ ),
2168
+ /* @__PURE__ */ jsx(
2169
+ HelpText_default,
2170
+ {
2171
+ messageKey: "product_labels_help",
2172
+ defaultMessage: "Add promotional badges like 'New Arrival', '50% Off', or 'Limited Edition' that customers will see on your product. Perfect for highlighting deals and special features.",
2173
+ className: "mt-3"
2174
+ }
2175
+ )
2176
+ ] })
2177
+ ] }),
2178
+ /* @__PURE__ */ jsx("div", { className: "col-span-6 mt-6 sm:col-span-3", children: /* @__PURE__ */ jsx(
2179
+ MarkdownTextAreaField_default,
2180
+ {
2181
+ name: "description",
2182
+ id: "description",
2183
+ disabled: !hasRole("manageProducts" /* ManageProducts */),
2184
+ label: formatMessage({
2185
+ id: "description",
2186
+ defaultMessage: "Description"
2187
+ })
2188
+ }
2189
+ ) })
2190
+ ] }),
2191
+ hasRole("manageProducts" /* ManageProducts */) && /* @__PURE__ */ jsx("div", { className: "border-t-slate-100 border-t border-t-border-subtle bg-surface-subtle px-4 py-5 text-right sm:px-6", children: /* @__PURE__ */ jsx(
2192
+ SubmitButton_default,
2193
+ {
2194
+ label: formatMessage({
2195
+ id: "save",
2196
+ defaultMessage: "Save"
2197
+ })
2198
+ }
2199
+ ) })
2200
+ ] }) })
2201
+ }
2202
+ );
2203
+ };
2204
+ var ProductTextsForm_default = ProductTextsForm;
2205
+ function useCombinedRefs() {
2206
+ for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
2207
+ refs[_key] = arguments[_key];
2208
+ }
2209
+ return useMemo(
2210
+ () => (node) => {
2211
+ refs.forEach((ref) => ref(node));
2212
+ },
2213
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2214
+ refs
2215
+ );
2216
+ }
2217
+ var canUseDOM = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
2218
+ function isWindow(element) {
2219
+ const elementString = Object.prototype.toString.call(element);
2220
+ return elementString === "[object Window]" || // In Electron context the Window object serializes to [object global]
2221
+ elementString === "[object global]";
2222
+ }
2223
+ function isNode(node) {
2224
+ return "nodeType" in node;
2225
+ }
2226
+ function getWindow(target) {
2227
+ var _target$ownerDocument, _target$ownerDocument2;
2228
+ if (!target) {
2229
+ return window;
2230
+ }
2231
+ if (isWindow(target)) {
2232
+ return target;
2233
+ }
2234
+ if (!isNode(target)) {
2235
+ return window;
2236
+ }
2237
+ return (_target$ownerDocument = (_target$ownerDocument2 = target.ownerDocument) == null ? void 0 : _target$ownerDocument2.defaultView) != null ? _target$ownerDocument : window;
2238
+ }
2239
+ function isDocument(node) {
2240
+ const {
2241
+ Document
2242
+ } = getWindow(node);
2243
+ return node instanceof Document;
2244
+ }
2245
+ function isHTMLElement(node) {
2246
+ if (isWindow(node)) {
2247
+ return false;
2248
+ }
2249
+ return node instanceof getWindow(node).HTMLElement;
2250
+ }
2251
+ function isSVGElement(node) {
2252
+ return node instanceof getWindow(node).SVGElement;
2253
+ }
2254
+ function getOwnerDocument(target) {
2255
+ if (!target) {
2256
+ return document;
2257
+ }
2258
+ if (isWindow(target)) {
2259
+ return target.document;
2260
+ }
2261
+ if (!isNode(target)) {
2262
+ return document;
2263
+ }
2264
+ if (isDocument(target)) {
2265
+ return target;
2266
+ }
2267
+ if (isHTMLElement(target) || isSVGElement(target)) {
2268
+ return target.ownerDocument;
2269
+ }
2270
+ return document;
2271
+ }
2272
+ var useIsomorphicLayoutEffect = canUseDOM ? useLayoutEffect : useEffect;
2273
+ function useEvent(handler) {
2274
+ const handlerRef = useRef(handler);
2275
+ useIsomorphicLayoutEffect(() => {
2276
+ handlerRef.current = handler;
2277
+ });
2278
+ return useCallback(function() {
2279
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2280
+ args[_key] = arguments[_key];
2281
+ }
2282
+ return handlerRef.current == null ? void 0 : handlerRef.current(...args);
2283
+ }, []);
2284
+ }
2285
+ function useInterval() {
2286
+ const intervalRef = useRef(null);
2287
+ const set = useCallback((listener, duration) => {
2288
+ intervalRef.current = setInterval(listener, duration);
2289
+ }, []);
2290
+ const clear = useCallback(() => {
2291
+ if (intervalRef.current !== null) {
2292
+ clearInterval(intervalRef.current);
2293
+ intervalRef.current = null;
2294
+ }
2295
+ }, []);
2296
+ return [set, clear];
2297
+ }
2298
+ function useLatestValue(value, dependencies) {
2299
+ if (dependencies === void 0) {
2300
+ dependencies = [value];
2301
+ }
2302
+ const valueRef = useRef(value);
2303
+ useIsomorphicLayoutEffect(() => {
2304
+ if (valueRef.current !== value) {
2305
+ valueRef.current = value;
2306
+ }
2307
+ }, dependencies);
2308
+ return valueRef;
2309
+ }
2310
+ function useLazyMemo(callback, dependencies) {
2311
+ const valueRef = useRef();
2312
+ return useMemo(
2313
+ () => {
2314
+ const newValue = callback(valueRef.current);
2315
+ valueRef.current = newValue;
2316
+ return newValue;
2317
+ },
2318
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2319
+ [...dependencies]
2320
+ );
2321
+ }
2322
+ function useNodeRef(onChange) {
2323
+ const onChangeHandler = useEvent(onChange);
2324
+ const node = useRef(null);
2325
+ const setNodeRef = useCallback(
2326
+ (element) => {
2327
+ if (element !== node.current) {
2328
+ onChangeHandler == null ? void 0 : onChangeHandler(element, node.current);
2329
+ }
2330
+ node.current = element;
2331
+ },
2332
+ //eslint-disable-next-line
2333
+ []
2334
+ );
2335
+ return [node, setNodeRef];
2336
+ }
2337
+ function usePrevious(value) {
2338
+ const ref = useRef();
2339
+ useEffect(() => {
2340
+ ref.current = value;
2341
+ }, [value]);
2342
+ return ref.current;
2343
+ }
2344
+ var ids = {};
2345
+ function useUniqueId(prefix, value) {
2346
+ return useMemo(() => {
2347
+ if (value) {
2348
+ return value;
2349
+ }
2350
+ const id = ids[prefix] == null ? 0 : ids[prefix] + 1;
2351
+ ids[prefix] = id;
2352
+ return prefix + "-" + id;
2353
+ }, [prefix, value]);
2354
+ }
2355
+ function createAdjustmentFn(modifier) {
2356
+ return function(object) {
2357
+ for (var _len = arguments.length, adjustments = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
2358
+ adjustments[_key - 1] = arguments[_key];
2359
+ }
2360
+ return adjustments.reduce((accumulator, adjustment) => {
2361
+ const entries = Object.entries(adjustment);
2362
+ for (const [key, valueAdjustment] of entries) {
2363
+ const value = accumulator[key];
2364
+ if (value != null) {
2365
+ accumulator[key] = value + modifier * valueAdjustment;
2366
+ }
2367
+ }
2368
+ return accumulator;
2369
+ }, {
2370
+ ...object
2371
+ });
2372
+ };
2373
+ }
2374
+ var add = /* @__PURE__ */ createAdjustmentFn(1);
2375
+ var subtract = /* @__PURE__ */ createAdjustmentFn(-1);
2376
+ function hasViewportRelativeCoordinates(event) {
2377
+ return "clientX" in event && "clientY" in event;
2378
+ }
2379
+ function isKeyboardEvent(event) {
2380
+ if (!event) {
2381
+ return false;
2382
+ }
2383
+ const {
2384
+ KeyboardEvent
2385
+ } = getWindow(event.target);
2386
+ return KeyboardEvent && event instanceof KeyboardEvent;
2387
+ }
2388
+ function isTouchEvent(event) {
2389
+ if (!event) {
2390
+ return false;
2391
+ }
2392
+ const {
2393
+ TouchEvent
2394
+ } = getWindow(event.target);
2395
+ return TouchEvent && event instanceof TouchEvent;
2396
+ }
2397
+ function getEventCoordinates(event) {
2398
+ if (isTouchEvent(event)) {
2399
+ if (event.touches && event.touches.length) {
2400
+ const {
2401
+ clientX: x,
2402
+ clientY: y
2403
+ } = event.touches[0];
2404
+ return {
2405
+ x,
2406
+ y
2407
+ };
2408
+ } else if (event.changedTouches && event.changedTouches.length) {
2409
+ const {
2410
+ clientX: x,
2411
+ clientY: y
2412
+ } = event.changedTouches[0];
2413
+ return {
2414
+ x,
2415
+ y
2416
+ };
2417
+ }
2418
+ }
2419
+ if (hasViewportRelativeCoordinates(event)) {
2420
+ return {
2421
+ x: event.clientX,
2422
+ y: event.clientY
2423
+ };
2424
+ }
2425
+ return null;
2426
+ }
2427
+ var CSS = /* @__PURE__ */ Object.freeze({
2428
+ Translate: {
2429
+ toString(transform) {
2430
+ if (!transform) {
2431
+ return;
2432
+ }
2433
+ const {
2434
+ x,
2435
+ y
2436
+ } = transform;
2437
+ return "translate3d(" + (x ? Math.round(x) : 0) + "px, " + (y ? Math.round(y) : 0) + "px, 0)";
2438
+ }
2439
+ },
2440
+ Scale: {
2441
+ toString(transform) {
2442
+ if (!transform) {
2443
+ return;
2444
+ }
2445
+ const {
2446
+ scaleX,
2447
+ scaleY
2448
+ } = transform;
2449
+ return "scaleX(" + scaleX + ") scaleY(" + scaleY + ")";
2450
+ }
2451
+ },
2452
+ Transform: {
2453
+ toString(transform) {
2454
+ if (!transform) {
2455
+ return;
2456
+ }
2457
+ return [CSS.Translate.toString(transform), CSS.Scale.toString(transform)].join(" ");
2458
+ }
2459
+ },
2460
+ Transition: {
2461
+ toString(_ref) {
2462
+ let {
2463
+ property,
2464
+ duration,
2465
+ easing
2466
+ } = _ref;
2467
+ return property + " " + duration + "ms " + easing;
2468
+ }
2469
+ }
2470
+ });
2471
+ var SELECTOR = "a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";
2472
+ function findFirstFocusableNode(element) {
2473
+ if (element.matches(SELECTOR)) {
2474
+ return element;
2475
+ }
2476
+ return element.querySelector(SELECTOR);
2477
+ }
2478
+ var hiddenStyles = {
2479
+ display: "none"
2480
+ };
2481
+ function HiddenText(_ref) {
2482
+ let {
2483
+ id,
2484
+ value
2485
+ } = _ref;
2486
+ return React3.createElement("div", {
2487
+ id,
2488
+ style: hiddenStyles
2489
+ }, value);
2490
+ }
2491
+ function LiveRegion(_ref) {
2492
+ let {
2493
+ id,
2494
+ announcement,
2495
+ ariaLiveType = "assertive"
2496
+ } = _ref;
2497
+ const visuallyHidden = {
2498
+ position: "fixed",
2499
+ top: 0,
2500
+ left: 0,
2501
+ width: 1,
2502
+ height: 1,
2503
+ margin: -1,
2504
+ border: 0,
2505
+ padding: 0,
2506
+ overflow: "hidden",
2507
+ clip: "rect(0 0 0 0)",
2508
+ clipPath: "inset(100%)",
2509
+ whiteSpace: "nowrap"
2510
+ };
2511
+ return React3.createElement("div", {
2512
+ id,
2513
+ style: visuallyHidden,
2514
+ role: "status",
2515
+ "aria-live": ariaLiveType,
2516
+ "aria-atomic": true
2517
+ }, announcement);
2518
+ }
2519
+ function useAnnouncement() {
2520
+ const [announcement, setAnnouncement] = useState("");
2521
+ const announce = useCallback((value) => {
2522
+ if (value != null) {
2523
+ setAnnouncement(value);
2524
+ }
2525
+ }, []);
2526
+ return {
2527
+ announce,
2528
+ announcement
2529
+ };
2530
+ }
2531
+
2532
+ // ../node_modules/@dnd-kit/core/dist/core.esm.js
2533
+ var DndMonitorContext = /* @__PURE__ */ createContext(null);
2534
+ function useDndMonitor(listener) {
2535
+ const registerListener = useContext(DndMonitorContext);
2536
+ useEffect(() => {
2537
+ if (!registerListener) {
2538
+ throw new Error("useDndMonitor must be used within a children of <DndContext>");
2539
+ }
2540
+ const unsubscribe = registerListener(listener);
2541
+ return unsubscribe;
2542
+ }, [listener, registerListener]);
2543
+ }
2544
+ function useDndMonitorProvider() {
2545
+ const [listeners] = useState(() => /* @__PURE__ */ new Set());
2546
+ const registerListener = useCallback((listener) => {
2547
+ listeners.add(listener);
2548
+ return () => listeners.delete(listener);
2549
+ }, [listeners]);
2550
+ const dispatch = useCallback((_ref) => {
2551
+ let {
2552
+ type,
2553
+ event
2554
+ } = _ref;
2555
+ listeners.forEach((listener) => {
2556
+ var _listener$type;
2557
+ return (_listener$type = listener[type]) == null ? void 0 : _listener$type.call(listener, event);
2558
+ });
2559
+ }, [listeners]);
2560
+ return [dispatch, registerListener];
2561
+ }
2562
+ var defaultScreenReaderInstructions = {
2563
+ draggable: "\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "
2564
+ };
2565
+ var defaultAnnouncements = {
2566
+ onDragStart(_ref) {
2567
+ let {
2568
+ active
2569
+ } = _ref;
2570
+ return "Picked up draggable item " + active.id + ".";
2571
+ },
2572
+ onDragOver(_ref2) {
2573
+ let {
2574
+ active,
2575
+ over
2576
+ } = _ref2;
2577
+ if (over) {
2578
+ return "Draggable item " + active.id + " was moved over droppable area " + over.id + ".";
2579
+ }
2580
+ return "Draggable item " + active.id + " is no longer over a droppable area.";
2581
+ },
2582
+ onDragEnd(_ref3) {
2583
+ let {
2584
+ active,
2585
+ over
2586
+ } = _ref3;
2587
+ if (over) {
2588
+ return "Draggable item " + active.id + " was dropped over droppable area " + over.id;
2589
+ }
2590
+ return "Draggable item " + active.id + " was dropped.";
2591
+ },
2592
+ onDragCancel(_ref4) {
2593
+ let {
2594
+ active
2595
+ } = _ref4;
2596
+ return "Dragging was cancelled. Draggable item " + active.id + " was dropped.";
2597
+ }
2598
+ };
2599
+ function Accessibility(_ref) {
2600
+ let {
2601
+ announcements = defaultAnnouncements,
2602
+ container,
2603
+ hiddenTextDescribedById,
2604
+ screenReaderInstructions = defaultScreenReaderInstructions
2605
+ } = _ref;
2606
+ const {
2607
+ announce,
2608
+ announcement
2609
+ } = useAnnouncement();
2610
+ const liveRegionId = useUniqueId("DndLiveRegion");
2611
+ const [mounted, setMounted] = useState(false);
2612
+ useEffect(() => {
2613
+ setMounted(true);
2614
+ }, []);
2615
+ useDndMonitor(useMemo(() => ({
2616
+ onDragStart(_ref2) {
2617
+ let {
2618
+ active
2619
+ } = _ref2;
2620
+ announce(announcements.onDragStart({
2621
+ active
2622
+ }));
2623
+ },
2624
+ onDragMove(_ref3) {
2625
+ let {
2626
+ active,
2627
+ over
2628
+ } = _ref3;
2629
+ if (announcements.onDragMove) {
2630
+ announce(announcements.onDragMove({
2631
+ active,
2632
+ over
2633
+ }));
2634
+ }
2635
+ },
2636
+ onDragOver(_ref4) {
2637
+ let {
2638
+ active,
2639
+ over
2640
+ } = _ref4;
2641
+ announce(announcements.onDragOver({
2642
+ active,
2643
+ over
2644
+ }));
2645
+ },
2646
+ onDragEnd(_ref5) {
2647
+ let {
2648
+ active,
2649
+ over
2650
+ } = _ref5;
2651
+ announce(announcements.onDragEnd({
2652
+ active,
2653
+ over
2654
+ }));
2655
+ },
2656
+ onDragCancel(_ref6) {
2657
+ let {
2658
+ active,
2659
+ over
2660
+ } = _ref6;
2661
+ announce(announcements.onDragCancel({
2662
+ active,
2663
+ over
2664
+ }));
2665
+ }
2666
+ }), [announce, announcements]));
2667
+ if (!mounted) {
2668
+ return null;
2669
+ }
2670
+ const markup = React3.createElement(React3.Fragment, null, React3.createElement(HiddenText, {
2671
+ id: hiddenTextDescribedById,
2672
+ value: screenReaderInstructions.draggable
2673
+ }), React3.createElement(LiveRegion, {
2674
+ id: liveRegionId,
2675
+ announcement
2676
+ }));
2677
+ return container ? createPortal(markup, container) : markup;
2678
+ }
2679
+ var Action;
2680
+ (function(Action2) {
2681
+ Action2["DragStart"] = "dragStart";
2682
+ Action2["DragMove"] = "dragMove";
2683
+ Action2["DragEnd"] = "dragEnd";
2684
+ Action2["DragCancel"] = "dragCancel";
2685
+ Action2["DragOver"] = "dragOver";
2686
+ Action2["RegisterDroppable"] = "registerDroppable";
2687
+ Action2["SetDroppableDisabled"] = "setDroppableDisabled";
2688
+ Action2["UnregisterDroppable"] = "unregisterDroppable";
2689
+ })(Action || (Action = {}));
2690
+ function noop() {
2691
+ }
2692
+ function useSensor(sensor, options) {
2693
+ return useMemo(
2694
+ () => ({
2695
+ sensor,
2696
+ options: options != null ? options : {}
2697
+ }),
2698
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2699
+ [sensor, options]
2700
+ );
2701
+ }
2702
+ function useSensors() {
2703
+ for (var _len = arguments.length, sensors = new Array(_len), _key = 0; _key < _len; _key++) {
2704
+ sensors[_key] = arguments[_key];
2705
+ }
2706
+ return useMemo(
2707
+ () => [...sensors].filter((sensor) => sensor != null),
2708
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2709
+ [...sensors]
2710
+ );
2711
+ }
2712
+ var defaultCoordinates = /* @__PURE__ */ Object.freeze({
2713
+ x: 0,
2714
+ y: 0
2715
+ });
2716
+ function distanceBetween(p1, p2) {
2717
+ return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2));
2718
+ }
2719
+ function sortCollisionsAsc(_ref, _ref2) {
2720
+ let {
2721
+ data: {
2722
+ value: a
2723
+ }
2724
+ } = _ref;
2725
+ let {
2726
+ data: {
2727
+ value: b
2728
+ }
2729
+ } = _ref2;
2730
+ return a - b;
2731
+ }
2732
+ function sortCollisionsDesc(_ref3, _ref4) {
2733
+ let {
2734
+ data: {
2735
+ value: a
2736
+ }
2737
+ } = _ref3;
2738
+ let {
2739
+ data: {
2740
+ value: b
2741
+ }
2742
+ } = _ref4;
2743
+ return b - a;
2744
+ }
2745
+ function cornersOfRectangle(_ref5) {
2746
+ let {
2747
+ left,
2748
+ top,
2749
+ height,
2750
+ width
2751
+ } = _ref5;
2752
+ return [{
2753
+ x: left,
2754
+ y: top
2755
+ }, {
2756
+ x: left + width,
2757
+ y: top
2758
+ }, {
2759
+ x: left,
2760
+ y: top + height
2761
+ }, {
2762
+ x: left + width,
2763
+ y: top + height
2764
+ }];
2765
+ }
2766
+ function getFirstCollision(collisions, property) {
2767
+ if (!collisions || collisions.length === 0) {
2768
+ return null;
2769
+ }
2770
+ const [firstCollision] = collisions;
2771
+ return firstCollision[property] ;
2772
+ }
2773
+ function centerOfRectangle(rect, left, top) {
2774
+ if (left === void 0) {
2775
+ left = rect.left;
2776
+ }
2777
+ if (top === void 0) {
2778
+ top = rect.top;
2779
+ }
2780
+ return {
2781
+ x: left + rect.width * 0.5,
2782
+ y: top + rect.height * 0.5
2783
+ };
2784
+ }
2785
+ var closestCenter = (_ref) => {
2786
+ let {
2787
+ collisionRect,
2788
+ droppableRects,
2789
+ droppableContainers
2790
+ } = _ref;
2791
+ const centerRect = centerOfRectangle(collisionRect, collisionRect.left, collisionRect.top);
2792
+ const collisions = [];
2793
+ for (const droppableContainer of droppableContainers) {
2794
+ const {
2795
+ id
2796
+ } = droppableContainer;
2797
+ const rect = droppableRects.get(id);
2798
+ if (rect) {
2799
+ const distBetween = distanceBetween(centerOfRectangle(rect), centerRect);
2800
+ collisions.push({
2801
+ id,
2802
+ data: {
2803
+ droppableContainer,
2804
+ value: distBetween
2805
+ }
2806
+ });
2807
+ }
2808
+ }
2809
+ return collisions.sort(sortCollisionsAsc);
2810
+ };
2811
+ var closestCorners = (_ref) => {
2812
+ let {
2813
+ collisionRect,
2814
+ droppableRects,
2815
+ droppableContainers
2816
+ } = _ref;
2817
+ const corners = cornersOfRectangle(collisionRect);
2818
+ const collisions = [];
2819
+ for (const droppableContainer of droppableContainers) {
2820
+ const {
2821
+ id
2822
+ } = droppableContainer;
2823
+ const rect = droppableRects.get(id);
2824
+ if (rect) {
2825
+ const rectCorners = cornersOfRectangle(rect);
2826
+ const distances = corners.reduce((accumulator, corner, index) => {
2827
+ return accumulator + distanceBetween(rectCorners[index], corner);
2828
+ }, 0);
2829
+ const effectiveDistance = Number((distances / 4).toFixed(4));
2830
+ collisions.push({
2831
+ id,
2832
+ data: {
2833
+ droppableContainer,
2834
+ value: effectiveDistance
2835
+ }
2836
+ });
2837
+ }
2838
+ }
2839
+ return collisions.sort(sortCollisionsAsc);
2840
+ };
2841
+ function getIntersectionRatio(entry, target) {
2842
+ const top = Math.max(target.top, entry.top);
2843
+ const left = Math.max(target.left, entry.left);
2844
+ const right = Math.min(target.left + target.width, entry.left + entry.width);
2845
+ const bottom = Math.min(target.top + target.height, entry.top + entry.height);
2846
+ const width = right - left;
2847
+ const height = bottom - top;
2848
+ if (left < right && top < bottom) {
2849
+ const targetArea = target.width * target.height;
2850
+ const entryArea = entry.width * entry.height;
2851
+ const intersectionArea = width * height;
2852
+ const intersectionRatio = intersectionArea / (targetArea + entryArea - intersectionArea);
2853
+ return Number(intersectionRatio.toFixed(4));
2854
+ }
2855
+ return 0;
2856
+ }
2857
+ var rectIntersection = (_ref) => {
2858
+ let {
2859
+ collisionRect,
2860
+ droppableRects,
2861
+ droppableContainers
2862
+ } = _ref;
2863
+ const collisions = [];
2864
+ for (const droppableContainer of droppableContainers) {
2865
+ const {
2866
+ id
2867
+ } = droppableContainer;
2868
+ const rect = droppableRects.get(id);
2869
+ if (rect) {
2870
+ const intersectionRatio = getIntersectionRatio(rect, collisionRect);
2871
+ if (intersectionRatio > 0) {
2872
+ collisions.push({
2873
+ id,
2874
+ data: {
2875
+ droppableContainer,
2876
+ value: intersectionRatio
2877
+ }
2878
+ });
2879
+ }
2880
+ }
2881
+ }
2882
+ return collisions.sort(sortCollisionsDesc);
2883
+ };
2884
+ function adjustScale(transform, rect1, rect2) {
2885
+ return {
2886
+ ...transform,
2887
+ scaleX: rect1 && rect2 ? rect1.width / rect2.width : 1,
2888
+ scaleY: rect1 && rect2 ? rect1.height / rect2.height : 1
2889
+ };
2890
+ }
2891
+ function getRectDelta(rect1, rect2) {
2892
+ return rect1 && rect2 ? {
2893
+ x: rect1.left - rect2.left,
2894
+ y: rect1.top - rect2.top
2895
+ } : defaultCoordinates;
2896
+ }
2897
+ function createRectAdjustmentFn(modifier) {
2898
+ return function adjustClientRect(rect) {
2899
+ for (var _len = arguments.length, adjustments = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
2900
+ adjustments[_key - 1] = arguments[_key];
2901
+ }
2902
+ return adjustments.reduce((acc, adjustment) => ({
2903
+ ...acc,
2904
+ top: acc.top + modifier * adjustment.y,
2905
+ bottom: acc.bottom + modifier * adjustment.y,
2906
+ left: acc.left + modifier * adjustment.x,
2907
+ right: acc.right + modifier * adjustment.x
2908
+ }), {
2909
+ ...rect
2910
+ });
2911
+ };
2912
+ }
2913
+ var getAdjustedRect = /* @__PURE__ */ createRectAdjustmentFn(1);
2914
+ function parseTransform(transform) {
2915
+ if (transform.startsWith("matrix3d(")) {
2916
+ const transformArray = transform.slice(9, -1).split(/, /);
2917
+ return {
2918
+ x: +transformArray[12],
2919
+ y: +transformArray[13],
2920
+ scaleX: +transformArray[0],
2921
+ scaleY: +transformArray[5]
2922
+ };
2923
+ } else if (transform.startsWith("matrix(")) {
2924
+ const transformArray = transform.slice(7, -1).split(/, /);
2925
+ return {
2926
+ x: +transformArray[4],
2927
+ y: +transformArray[5],
2928
+ scaleX: +transformArray[0],
2929
+ scaleY: +transformArray[3]
2930
+ };
2931
+ }
2932
+ return null;
2933
+ }
2934
+ function inverseTransform(rect, transform, transformOrigin) {
2935
+ const parsedTransform = parseTransform(transform);
2936
+ if (!parsedTransform) {
2937
+ return rect;
2938
+ }
2939
+ const {
2940
+ scaleX,
2941
+ scaleY,
2942
+ x: translateX,
2943
+ y: translateY
2944
+ } = parsedTransform;
2945
+ const x = rect.left - translateX - (1 - scaleX) * parseFloat(transformOrigin);
2946
+ const y = rect.top - translateY - (1 - scaleY) * parseFloat(transformOrigin.slice(transformOrigin.indexOf(" ") + 1));
2947
+ const w = scaleX ? rect.width / scaleX : rect.width;
2948
+ const h = scaleY ? rect.height / scaleY : rect.height;
2949
+ return {
2950
+ width: w,
2951
+ height: h,
2952
+ top: y,
2953
+ right: x + w,
2954
+ bottom: y + h,
2955
+ left: x
2956
+ };
2957
+ }
2958
+ var defaultOptions = {
2959
+ ignoreTransform: false
2960
+ };
2961
+ function getClientRect(element, options) {
2962
+ if (options === void 0) {
2963
+ options = defaultOptions;
2964
+ }
2965
+ let rect = element.getBoundingClientRect();
2966
+ if (options.ignoreTransform) {
2967
+ const {
2968
+ transform,
2969
+ transformOrigin
2970
+ } = getWindow(element).getComputedStyle(element);
2971
+ if (transform) {
2972
+ rect = inverseTransform(rect, transform, transformOrigin);
2973
+ }
2974
+ }
2975
+ const {
2976
+ top,
2977
+ left,
2978
+ width,
2979
+ height,
2980
+ bottom,
2981
+ right
2982
+ } = rect;
2983
+ return {
2984
+ top,
2985
+ left,
2986
+ width,
2987
+ height,
2988
+ bottom,
2989
+ right
2990
+ };
2991
+ }
2992
+ function getTransformAgnosticClientRect(element) {
2993
+ return getClientRect(element, {
2994
+ ignoreTransform: true
2995
+ });
2996
+ }
2997
+ function getWindowClientRect(element) {
2998
+ const width = element.innerWidth;
2999
+ const height = element.innerHeight;
3000
+ return {
3001
+ top: 0,
3002
+ left: 0,
3003
+ right: width,
3004
+ bottom: height,
3005
+ width,
3006
+ height
3007
+ };
3008
+ }
3009
+ function isFixed(node, computedStyle) {
3010
+ if (computedStyle === void 0) {
3011
+ computedStyle = getWindow(node).getComputedStyle(node);
3012
+ }
3013
+ return computedStyle.position === "fixed";
3014
+ }
3015
+ function isScrollable(element, computedStyle) {
3016
+ if (computedStyle === void 0) {
3017
+ computedStyle = getWindow(element).getComputedStyle(element);
3018
+ }
3019
+ const overflowRegex = /(auto|scroll|overlay)/;
3020
+ const properties2 = ["overflow", "overflowX", "overflowY"];
3021
+ return properties2.some((property) => {
3022
+ const value = computedStyle[property];
3023
+ return typeof value === "string" ? overflowRegex.test(value) : false;
3024
+ });
3025
+ }
3026
+ function getScrollableAncestors(element, limit) {
3027
+ const scrollParents = [];
3028
+ function findScrollableAncestors(node) {
3029
+ if (limit != null && scrollParents.length >= limit) {
3030
+ return scrollParents;
3031
+ }
3032
+ if (!node) {
3033
+ return scrollParents;
3034
+ }
3035
+ if (isDocument(node) && node.scrollingElement != null && !scrollParents.includes(node.scrollingElement)) {
3036
+ scrollParents.push(node.scrollingElement);
3037
+ return scrollParents;
3038
+ }
3039
+ if (!isHTMLElement(node) || isSVGElement(node)) {
3040
+ return scrollParents;
3041
+ }
3042
+ if (scrollParents.includes(node)) {
3043
+ return scrollParents;
3044
+ }
3045
+ const computedStyle = getWindow(element).getComputedStyle(node);
3046
+ if (node !== element) {
3047
+ if (isScrollable(node, computedStyle)) {
3048
+ scrollParents.push(node);
3049
+ }
3050
+ }
3051
+ if (isFixed(node, computedStyle)) {
3052
+ return scrollParents;
3053
+ }
3054
+ return findScrollableAncestors(node.parentNode);
3055
+ }
3056
+ if (!element) {
3057
+ return scrollParents;
3058
+ }
3059
+ return findScrollableAncestors(element);
3060
+ }
3061
+ function getFirstScrollableAncestor(node) {
3062
+ const [firstScrollableAncestor] = getScrollableAncestors(node, 1);
3063
+ return firstScrollableAncestor != null ? firstScrollableAncestor : null;
3064
+ }
3065
+ function getScrollableElement(element) {
3066
+ if (!canUseDOM || !element) {
3067
+ return null;
3068
+ }
3069
+ if (isWindow(element)) {
3070
+ return element;
3071
+ }
3072
+ if (!isNode(element)) {
3073
+ return null;
3074
+ }
3075
+ if (isDocument(element) || element === getOwnerDocument(element).scrollingElement) {
3076
+ return window;
3077
+ }
3078
+ if (isHTMLElement(element)) {
3079
+ return element;
3080
+ }
3081
+ return null;
3082
+ }
3083
+ function getScrollXCoordinate(element) {
3084
+ if (isWindow(element)) {
3085
+ return element.scrollX;
3086
+ }
3087
+ return element.scrollLeft;
3088
+ }
3089
+ function getScrollYCoordinate(element) {
3090
+ if (isWindow(element)) {
3091
+ return element.scrollY;
3092
+ }
3093
+ return element.scrollTop;
3094
+ }
3095
+ function getScrollCoordinates(element) {
3096
+ return {
3097
+ x: getScrollXCoordinate(element),
3098
+ y: getScrollYCoordinate(element)
3099
+ };
3100
+ }
3101
+ var Direction;
3102
+ (function(Direction2) {
3103
+ Direction2[Direction2["Forward"] = 1] = "Forward";
3104
+ Direction2[Direction2["Backward"] = -1] = "Backward";
3105
+ })(Direction || (Direction = {}));
3106
+ function isDocumentScrollingElement(element) {
3107
+ if (!canUseDOM || !element) {
3108
+ return false;
3109
+ }
3110
+ return element === document.scrollingElement;
3111
+ }
3112
+ function getScrollPosition(scrollingContainer) {
3113
+ const minScroll = {
3114
+ x: 0,
3115
+ y: 0
3116
+ };
3117
+ const dimensions = isDocumentScrollingElement(scrollingContainer) ? {
3118
+ height: window.innerHeight,
3119
+ width: window.innerWidth
3120
+ } : {
3121
+ height: scrollingContainer.clientHeight,
3122
+ width: scrollingContainer.clientWidth
3123
+ };
3124
+ const maxScroll = {
3125
+ x: scrollingContainer.scrollWidth - dimensions.width,
3126
+ y: scrollingContainer.scrollHeight - dimensions.height
3127
+ };
3128
+ const isTop = scrollingContainer.scrollTop <= minScroll.y;
3129
+ const isLeft = scrollingContainer.scrollLeft <= minScroll.x;
3130
+ const isBottom = scrollingContainer.scrollTop >= maxScroll.y;
3131
+ const isRight = scrollingContainer.scrollLeft >= maxScroll.x;
3132
+ return {
3133
+ isTop,
3134
+ isLeft,
3135
+ isBottom,
3136
+ isRight,
3137
+ maxScroll,
3138
+ minScroll
3139
+ };
3140
+ }
3141
+ var defaultThreshold = {
3142
+ x: 0.2,
3143
+ y: 0.2
3144
+ };
3145
+ function getScrollDirectionAndSpeed(scrollContainer, scrollContainerRect, _ref, acceleration, thresholdPercentage) {
3146
+ let {
3147
+ top,
3148
+ left,
3149
+ right,
3150
+ bottom
3151
+ } = _ref;
3152
+ if (acceleration === void 0) {
3153
+ acceleration = 10;
3154
+ }
3155
+ if (thresholdPercentage === void 0) {
3156
+ thresholdPercentage = defaultThreshold;
3157
+ }
3158
+ const {
3159
+ isTop,
3160
+ isBottom,
3161
+ isLeft,
3162
+ isRight
3163
+ } = getScrollPosition(scrollContainer);
3164
+ const direction = {
3165
+ x: 0,
3166
+ y: 0
3167
+ };
3168
+ const speed = {
3169
+ x: 0,
3170
+ y: 0
3171
+ };
3172
+ const threshold = {
3173
+ height: scrollContainerRect.height * thresholdPercentage.y,
3174
+ width: scrollContainerRect.width * thresholdPercentage.x
3175
+ };
3176
+ if (!isTop && top <= scrollContainerRect.top + threshold.height) {
3177
+ direction.y = Direction.Backward;
3178
+ speed.y = acceleration * Math.abs((scrollContainerRect.top + threshold.height - top) / threshold.height);
3179
+ } else if (!isBottom && bottom >= scrollContainerRect.bottom - threshold.height) {
3180
+ direction.y = Direction.Forward;
3181
+ speed.y = acceleration * Math.abs((scrollContainerRect.bottom - threshold.height - bottom) / threshold.height);
3182
+ }
3183
+ if (!isRight && right >= scrollContainerRect.right - threshold.width) {
3184
+ direction.x = Direction.Forward;
3185
+ speed.x = acceleration * Math.abs((scrollContainerRect.right - threshold.width - right) / threshold.width);
3186
+ } else if (!isLeft && left <= scrollContainerRect.left + threshold.width) {
3187
+ direction.x = Direction.Backward;
3188
+ speed.x = acceleration * Math.abs((scrollContainerRect.left + threshold.width - left) / threshold.width);
3189
+ }
3190
+ return {
3191
+ direction,
3192
+ speed
3193
+ };
3194
+ }
3195
+ function getScrollElementRect(element) {
3196
+ if (element === document.scrollingElement) {
3197
+ const {
3198
+ innerWidth,
3199
+ innerHeight
3200
+ } = window;
3201
+ return {
3202
+ top: 0,
3203
+ left: 0,
3204
+ right: innerWidth,
3205
+ bottom: innerHeight,
3206
+ width: innerWidth,
3207
+ height: innerHeight
3208
+ };
3209
+ }
3210
+ const {
3211
+ top,
3212
+ left,
3213
+ right,
3214
+ bottom
3215
+ } = element.getBoundingClientRect();
3216
+ return {
3217
+ top,
3218
+ left,
3219
+ right,
3220
+ bottom,
3221
+ width: element.clientWidth,
3222
+ height: element.clientHeight
3223
+ };
3224
+ }
3225
+ function getScrollOffsets(scrollableAncestors) {
3226
+ return scrollableAncestors.reduce((acc, node) => {
3227
+ return add(acc, getScrollCoordinates(node));
3228
+ }, defaultCoordinates);
3229
+ }
3230
+ function getScrollXOffset(scrollableAncestors) {
3231
+ return scrollableAncestors.reduce((acc, node) => {
3232
+ return acc + getScrollXCoordinate(node);
3233
+ }, 0);
3234
+ }
3235
+ function getScrollYOffset(scrollableAncestors) {
3236
+ return scrollableAncestors.reduce((acc, node) => {
3237
+ return acc + getScrollYCoordinate(node);
3238
+ }, 0);
3239
+ }
3240
+ function scrollIntoViewIfNeeded(element, measure) {
3241
+ if (measure === void 0) {
3242
+ measure = getClientRect;
3243
+ }
3244
+ if (!element) {
3245
+ return;
3246
+ }
3247
+ const {
3248
+ top,
3249
+ left,
3250
+ bottom,
3251
+ right
3252
+ } = measure(element);
3253
+ const firstScrollableAncestor = getFirstScrollableAncestor(element);
3254
+ if (!firstScrollableAncestor) {
3255
+ return;
3256
+ }
3257
+ if (bottom <= 0 || right <= 0 || top >= window.innerHeight || left >= window.innerWidth) {
3258
+ element.scrollIntoView({
3259
+ block: "center",
3260
+ inline: "center"
3261
+ });
3262
+ }
3263
+ }
3264
+ var properties = [["x", ["left", "right"], getScrollXOffset], ["y", ["top", "bottom"], getScrollYOffset]];
3265
+ var Rect = class {
3266
+ constructor(rect, element) {
3267
+ this.rect = void 0;
3268
+ this.width = void 0;
3269
+ this.height = void 0;
3270
+ this.top = void 0;
3271
+ this.bottom = void 0;
3272
+ this.right = void 0;
3273
+ this.left = void 0;
3274
+ const scrollableAncestors = getScrollableAncestors(element);
3275
+ const scrollOffsets = getScrollOffsets(scrollableAncestors);
3276
+ this.rect = {
3277
+ ...rect
3278
+ };
3279
+ this.width = rect.width;
3280
+ this.height = rect.height;
3281
+ for (const [axis, keys, getScrollOffset] of properties) {
3282
+ for (const key of keys) {
3283
+ Object.defineProperty(this, key, {
3284
+ get: () => {
3285
+ const currentOffsets = getScrollOffset(scrollableAncestors);
3286
+ const scrollOffsetsDeltla = scrollOffsets[axis] - currentOffsets;
3287
+ return this.rect[key] + scrollOffsetsDeltla;
3288
+ },
3289
+ enumerable: true
3290
+ });
3291
+ }
3292
+ }
3293
+ Object.defineProperty(this, "rect", {
3294
+ enumerable: false
3295
+ });
3296
+ }
3297
+ };
3298
+ var Listeners = class {
3299
+ constructor(target) {
3300
+ this.target = void 0;
3301
+ this.listeners = [];
3302
+ this.removeAll = () => {
3303
+ this.listeners.forEach((listener) => {
3304
+ var _this$target;
3305
+ return (_this$target = this.target) == null ? void 0 : _this$target.removeEventListener(...listener);
3306
+ });
3307
+ };
3308
+ this.target = target;
3309
+ }
3310
+ add(eventName, handler, options) {
3311
+ var _this$target2;
3312
+ (_this$target2 = this.target) == null ? void 0 : _this$target2.addEventListener(eventName, handler, options);
3313
+ this.listeners.push([eventName, handler, options]);
3314
+ }
3315
+ };
3316
+ function getEventListenerTarget(target) {
3317
+ const {
3318
+ EventTarget
3319
+ } = getWindow(target);
3320
+ return target instanceof EventTarget ? target : getOwnerDocument(target);
3321
+ }
3322
+ function hasExceededDistance(delta, measurement) {
3323
+ const dx = Math.abs(delta.x);
3324
+ const dy = Math.abs(delta.y);
3325
+ if (typeof measurement === "number") {
3326
+ return Math.sqrt(dx ** 2 + dy ** 2) > measurement;
3327
+ }
3328
+ if ("x" in measurement && "y" in measurement) {
3329
+ return dx > measurement.x && dy > measurement.y;
3330
+ }
3331
+ if ("x" in measurement) {
3332
+ return dx > measurement.x;
3333
+ }
3334
+ if ("y" in measurement) {
3335
+ return dy > measurement.y;
3336
+ }
3337
+ return false;
3338
+ }
3339
+ var EventName;
3340
+ (function(EventName2) {
3341
+ EventName2["Click"] = "click";
3342
+ EventName2["DragStart"] = "dragstart";
3343
+ EventName2["Keydown"] = "keydown";
3344
+ EventName2["ContextMenu"] = "contextmenu";
3345
+ EventName2["Resize"] = "resize";
3346
+ EventName2["SelectionChange"] = "selectionchange";
3347
+ EventName2["VisibilityChange"] = "visibilitychange";
3348
+ })(EventName || (EventName = {}));
3349
+ function preventDefault(event) {
3350
+ event.preventDefault();
3351
+ }
3352
+ function stopPropagation(event) {
3353
+ event.stopPropagation();
3354
+ }
3355
+ var KeyboardCode;
3356
+ (function(KeyboardCode2) {
3357
+ KeyboardCode2["Space"] = "Space";
3358
+ KeyboardCode2["Down"] = "ArrowDown";
3359
+ KeyboardCode2["Right"] = "ArrowRight";
3360
+ KeyboardCode2["Left"] = "ArrowLeft";
3361
+ KeyboardCode2["Up"] = "ArrowUp";
3362
+ KeyboardCode2["Esc"] = "Escape";
3363
+ KeyboardCode2["Enter"] = "Enter";
3364
+ KeyboardCode2["Tab"] = "Tab";
3365
+ })(KeyboardCode || (KeyboardCode = {}));
3366
+ var defaultKeyboardCodes = {
3367
+ start: [KeyboardCode.Space, KeyboardCode.Enter],
3368
+ cancel: [KeyboardCode.Esc],
3369
+ end: [KeyboardCode.Space, KeyboardCode.Enter, KeyboardCode.Tab]
3370
+ };
3371
+ var defaultKeyboardCoordinateGetter = (event, _ref) => {
3372
+ let {
3373
+ currentCoordinates
3374
+ } = _ref;
3375
+ switch (event.code) {
3376
+ case KeyboardCode.Right:
3377
+ return {
3378
+ ...currentCoordinates,
3379
+ x: currentCoordinates.x + 25
3380
+ };
3381
+ case KeyboardCode.Left:
3382
+ return {
3383
+ ...currentCoordinates,
3384
+ x: currentCoordinates.x - 25
3385
+ };
3386
+ case KeyboardCode.Down:
3387
+ return {
3388
+ ...currentCoordinates,
3389
+ y: currentCoordinates.y + 25
3390
+ };
3391
+ case KeyboardCode.Up:
3392
+ return {
3393
+ ...currentCoordinates,
3394
+ y: currentCoordinates.y - 25
3395
+ };
3396
+ }
3397
+ return void 0;
3398
+ };
3399
+ var KeyboardSensor = class {
3400
+ constructor(props) {
3401
+ this.props = void 0;
3402
+ this.autoScrollEnabled = false;
3403
+ this.referenceCoordinates = void 0;
3404
+ this.listeners = void 0;
3405
+ this.windowListeners = void 0;
3406
+ this.props = props;
3407
+ const {
3408
+ event: {
3409
+ target
3410
+ }
3411
+ } = props;
3412
+ this.props = props;
3413
+ this.listeners = new Listeners(getOwnerDocument(target));
3414
+ this.windowListeners = new Listeners(getWindow(target));
3415
+ this.handleKeyDown = this.handleKeyDown.bind(this);
3416
+ this.handleCancel = this.handleCancel.bind(this);
3417
+ this.attach();
3418
+ }
3419
+ attach() {
3420
+ this.handleStart();
3421
+ this.windowListeners.add(EventName.Resize, this.handleCancel);
3422
+ this.windowListeners.add(EventName.VisibilityChange, this.handleCancel);
3423
+ setTimeout(() => this.listeners.add(EventName.Keydown, this.handleKeyDown));
3424
+ }
3425
+ handleStart() {
3426
+ const {
3427
+ activeNode,
3428
+ onStart
3429
+ } = this.props;
3430
+ const node = activeNode.node.current;
3431
+ if (node) {
3432
+ scrollIntoViewIfNeeded(node);
3433
+ }
3434
+ onStart(defaultCoordinates);
3435
+ }
3436
+ handleKeyDown(event) {
3437
+ if (isKeyboardEvent(event)) {
3438
+ const {
3439
+ active,
3440
+ context,
3441
+ options
3442
+ } = this.props;
3443
+ const {
3444
+ keyboardCodes = defaultKeyboardCodes,
3445
+ coordinateGetter = defaultKeyboardCoordinateGetter,
3446
+ scrollBehavior = "smooth"
3447
+ } = options;
3448
+ const {
3449
+ code
3450
+ } = event;
3451
+ if (keyboardCodes.end.includes(code)) {
3452
+ this.handleEnd(event);
3453
+ return;
3454
+ }
3455
+ if (keyboardCodes.cancel.includes(code)) {
3456
+ this.handleCancel(event);
3457
+ return;
3458
+ }
3459
+ const {
3460
+ collisionRect
3461
+ } = context.current;
3462
+ const currentCoordinates = collisionRect ? {
3463
+ x: collisionRect.left,
3464
+ y: collisionRect.top
3465
+ } : defaultCoordinates;
3466
+ if (!this.referenceCoordinates) {
3467
+ this.referenceCoordinates = currentCoordinates;
3468
+ }
3469
+ const newCoordinates = coordinateGetter(event, {
3470
+ active,
3471
+ context: context.current,
3472
+ currentCoordinates
3473
+ });
3474
+ if (newCoordinates) {
3475
+ const coordinatesDelta = subtract(newCoordinates, currentCoordinates);
3476
+ const scrollDelta = {
3477
+ x: 0,
3478
+ y: 0
3479
+ };
3480
+ const {
3481
+ scrollableAncestors
3482
+ } = context.current;
3483
+ for (const scrollContainer of scrollableAncestors) {
3484
+ const direction = event.code;
3485
+ const {
3486
+ isTop,
3487
+ isRight,
3488
+ isLeft,
3489
+ isBottom,
3490
+ maxScroll,
3491
+ minScroll
3492
+ } = getScrollPosition(scrollContainer);
3493
+ const scrollElementRect = getScrollElementRect(scrollContainer);
3494
+ const clampedCoordinates = {
3495
+ x: Math.min(direction === KeyboardCode.Right ? scrollElementRect.right - scrollElementRect.width / 2 : scrollElementRect.right, Math.max(direction === KeyboardCode.Right ? scrollElementRect.left : scrollElementRect.left + scrollElementRect.width / 2, newCoordinates.x)),
3496
+ y: Math.min(direction === KeyboardCode.Down ? scrollElementRect.bottom - scrollElementRect.height / 2 : scrollElementRect.bottom, Math.max(direction === KeyboardCode.Down ? scrollElementRect.top : scrollElementRect.top + scrollElementRect.height / 2, newCoordinates.y))
3497
+ };
3498
+ const canScrollX = direction === KeyboardCode.Right && !isRight || direction === KeyboardCode.Left && !isLeft;
3499
+ const canScrollY = direction === KeyboardCode.Down && !isBottom || direction === KeyboardCode.Up && !isTop;
3500
+ if (canScrollX && clampedCoordinates.x !== newCoordinates.x) {
3501
+ const newScrollCoordinates = scrollContainer.scrollLeft + coordinatesDelta.x;
3502
+ const canScrollToNewCoordinates = direction === KeyboardCode.Right && newScrollCoordinates <= maxScroll.x || direction === KeyboardCode.Left && newScrollCoordinates >= minScroll.x;
3503
+ if (canScrollToNewCoordinates && !coordinatesDelta.y) {
3504
+ scrollContainer.scrollTo({
3505
+ left: newScrollCoordinates,
3506
+ behavior: scrollBehavior
3507
+ });
3508
+ return;
3509
+ }
3510
+ if (canScrollToNewCoordinates) {
3511
+ scrollDelta.x = scrollContainer.scrollLeft - newScrollCoordinates;
3512
+ } else {
3513
+ scrollDelta.x = direction === KeyboardCode.Right ? scrollContainer.scrollLeft - maxScroll.x : scrollContainer.scrollLeft - minScroll.x;
3514
+ }
3515
+ if (scrollDelta.x) {
3516
+ scrollContainer.scrollBy({
3517
+ left: -scrollDelta.x,
3518
+ behavior: scrollBehavior
3519
+ });
3520
+ }
3521
+ break;
3522
+ } else if (canScrollY && clampedCoordinates.y !== newCoordinates.y) {
3523
+ const newScrollCoordinates = scrollContainer.scrollTop + coordinatesDelta.y;
3524
+ const canScrollToNewCoordinates = direction === KeyboardCode.Down && newScrollCoordinates <= maxScroll.y || direction === KeyboardCode.Up && newScrollCoordinates >= minScroll.y;
3525
+ if (canScrollToNewCoordinates && !coordinatesDelta.x) {
3526
+ scrollContainer.scrollTo({
3527
+ top: newScrollCoordinates,
3528
+ behavior: scrollBehavior
3529
+ });
3530
+ return;
3531
+ }
3532
+ if (canScrollToNewCoordinates) {
3533
+ scrollDelta.y = scrollContainer.scrollTop - newScrollCoordinates;
3534
+ } else {
3535
+ scrollDelta.y = direction === KeyboardCode.Down ? scrollContainer.scrollTop - maxScroll.y : scrollContainer.scrollTop - minScroll.y;
3536
+ }
3537
+ if (scrollDelta.y) {
3538
+ scrollContainer.scrollBy({
3539
+ top: -scrollDelta.y,
3540
+ behavior: scrollBehavior
3541
+ });
3542
+ }
3543
+ break;
3544
+ }
3545
+ }
3546
+ this.handleMove(event, add(subtract(newCoordinates, this.referenceCoordinates), scrollDelta));
3547
+ }
3548
+ }
3549
+ }
3550
+ handleMove(event, coordinates) {
3551
+ const {
3552
+ onMove
3553
+ } = this.props;
3554
+ event.preventDefault();
3555
+ onMove(coordinates);
3556
+ }
3557
+ handleEnd(event) {
3558
+ const {
3559
+ onEnd
3560
+ } = this.props;
3561
+ event.preventDefault();
3562
+ this.detach();
3563
+ onEnd();
3564
+ }
3565
+ handleCancel(event) {
3566
+ const {
3567
+ onCancel
3568
+ } = this.props;
3569
+ event.preventDefault();
3570
+ this.detach();
3571
+ onCancel();
3572
+ }
3573
+ detach() {
3574
+ this.listeners.removeAll();
3575
+ this.windowListeners.removeAll();
3576
+ }
3577
+ };
3578
+ KeyboardSensor.activators = [{
3579
+ eventName: "onKeyDown",
3580
+ handler: (event, _ref, _ref2) => {
3581
+ let {
3582
+ keyboardCodes = defaultKeyboardCodes,
3583
+ onActivation
3584
+ } = _ref;
3585
+ let {
3586
+ active
3587
+ } = _ref2;
3588
+ const {
3589
+ code
3590
+ } = event.nativeEvent;
3591
+ if (keyboardCodes.start.includes(code)) {
3592
+ const activator = active.activatorNode.current;
3593
+ if (activator && event.target !== activator) {
3594
+ return false;
3595
+ }
3596
+ event.preventDefault();
3597
+ onActivation == null ? void 0 : onActivation({
3598
+ event: event.nativeEvent
3599
+ });
3600
+ return true;
3601
+ }
3602
+ return false;
3603
+ }
3604
+ }];
3605
+ function isDistanceConstraint(constraint) {
3606
+ return Boolean(constraint && "distance" in constraint);
3607
+ }
3608
+ function isDelayConstraint(constraint) {
3609
+ return Boolean(constraint && "delay" in constraint);
3610
+ }
3611
+ var AbstractPointerSensor = class {
3612
+ constructor(props, events2, listenerTarget) {
3613
+ var _getEventCoordinates;
3614
+ if (listenerTarget === void 0) {
3615
+ listenerTarget = getEventListenerTarget(props.event.target);
3616
+ }
3617
+ this.props = void 0;
3618
+ this.events = void 0;
3619
+ this.autoScrollEnabled = true;
3620
+ this.document = void 0;
3621
+ this.activated = false;
3622
+ this.initialCoordinates = void 0;
3623
+ this.timeoutId = null;
3624
+ this.listeners = void 0;
3625
+ this.documentListeners = void 0;
3626
+ this.windowListeners = void 0;
3627
+ this.props = props;
3628
+ this.events = events2;
3629
+ const {
3630
+ event
3631
+ } = props;
3632
+ const {
3633
+ target
3634
+ } = event;
3635
+ this.props = props;
3636
+ this.events = events2;
3637
+ this.document = getOwnerDocument(target);
3638
+ this.documentListeners = new Listeners(this.document);
3639
+ this.listeners = new Listeners(listenerTarget);
3640
+ this.windowListeners = new Listeners(getWindow(target));
3641
+ this.initialCoordinates = (_getEventCoordinates = getEventCoordinates(event)) != null ? _getEventCoordinates : defaultCoordinates;
3642
+ this.handleStart = this.handleStart.bind(this);
3643
+ this.handleMove = this.handleMove.bind(this);
3644
+ this.handleEnd = this.handleEnd.bind(this);
3645
+ this.handleCancel = this.handleCancel.bind(this);
3646
+ this.handleKeydown = this.handleKeydown.bind(this);
3647
+ this.removeTextSelection = this.removeTextSelection.bind(this);
3648
+ this.attach();
3649
+ }
3650
+ attach() {
3651
+ const {
3652
+ events: events2,
3653
+ props: {
3654
+ options: {
3655
+ activationConstraint,
3656
+ bypassActivationConstraint
3657
+ }
3658
+ }
3659
+ } = this;
3660
+ this.listeners.add(events2.move.name, this.handleMove, {
3661
+ passive: false
3662
+ });
3663
+ this.listeners.add(events2.end.name, this.handleEnd);
3664
+ if (events2.cancel) {
3665
+ this.listeners.add(events2.cancel.name, this.handleCancel);
3666
+ }
3667
+ this.windowListeners.add(EventName.Resize, this.handleCancel);
3668
+ this.windowListeners.add(EventName.DragStart, preventDefault);
3669
+ this.windowListeners.add(EventName.VisibilityChange, this.handleCancel);
3670
+ this.windowListeners.add(EventName.ContextMenu, preventDefault);
3671
+ this.documentListeners.add(EventName.Keydown, this.handleKeydown);
3672
+ if (activationConstraint) {
3673
+ if (bypassActivationConstraint != null && bypassActivationConstraint({
3674
+ event: this.props.event,
3675
+ activeNode: this.props.activeNode,
3676
+ options: this.props.options
3677
+ })) {
3678
+ return this.handleStart();
3679
+ }
3680
+ if (isDelayConstraint(activationConstraint)) {
3681
+ this.timeoutId = setTimeout(this.handleStart, activationConstraint.delay);
3682
+ this.handlePending(activationConstraint);
3683
+ return;
3684
+ }
3685
+ if (isDistanceConstraint(activationConstraint)) {
3686
+ this.handlePending(activationConstraint);
3687
+ return;
3688
+ }
3689
+ }
3690
+ this.handleStart();
3691
+ }
3692
+ detach() {
3693
+ this.listeners.removeAll();
3694
+ this.windowListeners.removeAll();
3695
+ setTimeout(this.documentListeners.removeAll, 50);
3696
+ if (this.timeoutId !== null) {
3697
+ clearTimeout(this.timeoutId);
3698
+ this.timeoutId = null;
3699
+ }
3700
+ }
3701
+ handlePending(constraint, offset) {
3702
+ const {
3703
+ active,
3704
+ onPending
3705
+ } = this.props;
3706
+ onPending(active, constraint, this.initialCoordinates, offset);
3707
+ }
3708
+ handleStart() {
3709
+ const {
3710
+ initialCoordinates
3711
+ } = this;
3712
+ const {
3713
+ onStart
3714
+ } = this.props;
3715
+ if (initialCoordinates) {
3716
+ this.activated = true;
3717
+ this.documentListeners.add(EventName.Click, stopPropagation, {
3718
+ capture: true
3719
+ });
3720
+ this.removeTextSelection();
3721
+ this.documentListeners.add(EventName.SelectionChange, this.removeTextSelection);
3722
+ onStart(initialCoordinates);
3723
+ }
3724
+ }
3725
+ handleMove(event) {
3726
+ var _getEventCoordinates2;
3727
+ const {
3728
+ activated,
3729
+ initialCoordinates,
3730
+ props
3731
+ } = this;
3732
+ const {
3733
+ onMove,
3734
+ options: {
3735
+ activationConstraint
3736
+ }
3737
+ } = props;
3738
+ if (!initialCoordinates) {
3739
+ return;
3740
+ }
3741
+ const coordinates = (_getEventCoordinates2 = getEventCoordinates(event)) != null ? _getEventCoordinates2 : defaultCoordinates;
3742
+ const delta = subtract(initialCoordinates, coordinates);
3743
+ if (!activated && activationConstraint) {
3744
+ if (isDistanceConstraint(activationConstraint)) {
3745
+ if (activationConstraint.tolerance != null && hasExceededDistance(delta, activationConstraint.tolerance)) {
3746
+ return this.handleCancel();
3747
+ }
3748
+ if (hasExceededDistance(delta, activationConstraint.distance)) {
3749
+ return this.handleStart();
3750
+ }
3751
+ }
3752
+ if (isDelayConstraint(activationConstraint)) {
3753
+ if (hasExceededDistance(delta, activationConstraint.tolerance)) {
3754
+ return this.handleCancel();
3755
+ }
3756
+ }
3757
+ this.handlePending(activationConstraint, delta);
3758
+ return;
3759
+ }
3760
+ if (event.cancelable) {
3761
+ event.preventDefault();
3762
+ }
3763
+ onMove(coordinates);
3764
+ }
3765
+ handleEnd() {
3766
+ const {
3767
+ onAbort,
3768
+ onEnd
3769
+ } = this.props;
3770
+ this.detach();
3771
+ if (!this.activated) {
3772
+ onAbort(this.props.active);
3773
+ }
3774
+ onEnd();
3775
+ }
3776
+ handleCancel() {
3777
+ const {
3778
+ onAbort,
3779
+ onCancel
3780
+ } = this.props;
3781
+ this.detach();
3782
+ if (!this.activated) {
3783
+ onAbort(this.props.active);
3784
+ }
3785
+ onCancel();
3786
+ }
3787
+ handleKeydown(event) {
3788
+ if (event.code === KeyboardCode.Esc) {
3789
+ this.handleCancel();
3790
+ }
3791
+ }
3792
+ removeTextSelection() {
3793
+ var _this$document$getSel;
3794
+ (_this$document$getSel = this.document.getSelection()) == null ? void 0 : _this$document$getSel.removeAllRanges();
3795
+ }
3796
+ };
3797
+ var events = {
3798
+ cancel: {
3799
+ name: "pointercancel"
3800
+ },
3801
+ move: {
3802
+ name: "pointermove"
3803
+ },
3804
+ end: {
3805
+ name: "pointerup"
3806
+ }
3807
+ };
3808
+ var PointerSensor = class extends AbstractPointerSensor {
3809
+ constructor(props) {
3810
+ const {
3811
+ event
3812
+ } = props;
3813
+ const listenerTarget = getOwnerDocument(event.target);
3814
+ super(props, events, listenerTarget);
3815
+ }
3816
+ };
3817
+ PointerSensor.activators = [{
3818
+ eventName: "onPointerDown",
3819
+ handler: (_ref, _ref2) => {
3820
+ let {
3821
+ nativeEvent: event
3822
+ } = _ref;
3823
+ let {
3824
+ onActivation
3825
+ } = _ref2;
3826
+ if (!event.isPrimary || event.button !== 0) {
3827
+ return false;
3828
+ }
3829
+ onActivation == null ? void 0 : onActivation({
3830
+ event
3831
+ });
3832
+ return true;
3833
+ }
3834
+ }];
3835
+ var events$1 = {
3836
+ move: {
3837
+ name: "mousemove"
3838
+ },
3839
+ end: {
3840
+ name: "mouseup"
3841
+ }
3842
+ };
3843
+ var MouseButton;
3844
+ (function(MouseButton2) {
3845
+ MouseButton2[MouseButton2["RightClick"] = 2] = "RightClick";
3846
+ })(MouseButton || (MouseButton = {}));
3847
+ var MouseSensor = class extends AbstractPointerSensor {
3848
+ constructor(props) {
3849
+ super(props, events$1, getOwnerDocument(props.event.target));
3850
+ }
3851
+ };
3852
+ MouseSensor.activators = [{
3853
+ eventName: "onMouseDown",
3854
+ handler: (_ref, _ref2) => {
3855
+ let {
3856
+ nativeEvent: event
3857
+ } = _ref;
3858
+ let {
3859
+ onActivation
3860
+ } = _ref2;
3861
+ if (event.button === MouseButton.RightClick) {
3862
+ return false;
3863
+ }
3864
+ onActivation == null ? void 0 : onActivation({
3865
+ event
3866
+ });
3867
+ return true;
3868
+ }
3869
+ }];
3870
+ var events$2 = {
3871
+ cancel: {
3872
+ name: "touchcancel"
3873
+ },
3874
+ move: {
3875
+ name: "touchmove"
3876
+ },
3877
+ end: {
3878
+ name: "touchend"
3879
+ }
3880
+ };
3881
+ var TouchSensor = class extends AbstractPointerSensor {
3882
+ constructor(props) {
3883
+ super(props, events$2);
3884
+ }
3885
+ static setup() {
3886
+ window.addEventListener(events$2.move.name, noop2, {
3887
+ capture: false,
3888
+ passive: false
3889
+ });
3890
+ return function teardown() {
3891
+ window.removeEventListener(events$2.move.name, noop2);
3892
+ };
3893
+ function noop2() {
3894
+ }
3895
+ }
3896
+ };
3897
+ TouchSensor.activators = [{
3898
+ eventName: "onTouchStart",
3899
+ handler: (_ref, _ref2) => {
3900
+ let {
3901
+ nativeEvent: event
3902
+ } = _ref;
3903
+ let {
3904
+ onActivation
3905
+ } = _ref2;
3906
+ const {
3907
+ touches
3908
+ } = event;
3909
+ if (touches.length > 1) {
3910
+ return false;
3911
+ }
3912
+ onActivation == null ? void 0 : onActivation({
3913
+ event
3914
+ });
3915
+ return true;
3916
+ }
3917
+ }];
3918
+ var AutoScrollActivator;
3919
+ (function(AutoScrollActivator2) {
3920
+ AutoScrollActivator2[AutoScrollActivator2["Pointer"] = 0] = "Pointer";
3921
+ AutoScrollActivator2[AutoScrollActivator2["DraggableRect"] = 1] = "DraggableRect";
3922
+ })(AutoScrollActivator || (AutoScrollActivator = {}));
3923
+ var TraversalOrder;
3924
+ (function(TraversalOrder2) {
3925
+ TraversalOrder2[TraversalOrder2["TreeOrder"] = 0] = "TreeOrder";
3926
+ TraversalOrder2[TraversalOrder2["ReversedTreeOrder"] = 1] = "ReversedTreeOrder";
3927
+ })(TraversalOrder || (TraversalOrder = {}));
3928
+ function useAutoScroller(_ref) {
3929
+ let {
3930
+ acceleration,
3931
+ activator = AutoScrollActivator.Pointer,
3932
+ canScroll,
3933
+ draggingRect,
3934
+ enabled,
3935
+ interval = 5,
3936
+ order = TraversalOrder.TreeOrder,
3937
+ pointerCoordinates,
3938
+ scrollableAncestors,
3939
+ scrollableAncestorRects,
3940
+ delta,
3941
+ threshold
3942
+ } = _ref;
3943
+ const scrollIntent = useScrollIntent({
3944
+ delta,
3945
+ disabled: !enabled
3946
+ });
3947
+ const [setAutoScrollInterval, clearAutoScrollInterval] = useInterval();
3948
+ const scrollSpeed = useRef({
3949
+ x: 0,
3950
+ y: 0
3951
+ });
3952
+ const scrollDirection = useRef({
3953
+ x: 0,
3954
+ y: 0
3955
+ });
3956
+ const rect = useMemo(() => {
3957
+ switch (activator) {
3958
+ case AutoScrollActivator.Pointer:
3959
+ return pointerCoordinates ? {
3960
+ top: pointerCoordinates.y,
3961
+ bottom: pointerCoordinates.y,
3962
+ left: pointerCoordinates.x,
3963
+ right: pointerCoordinates.x
3964
+ } : null;
3965
+ case AutoScrollActivator.DraggableRect:
3966
+ return draggingRect;
3967
+ }
3968
+ }, [activator, draggingRect, pointerCoordinates]);
3969
+ const scrollContainerRef = useRef(null);
3970
+ const autoScroll = useCallback(() => {
3971
+ const scrollContainer = scrollContainerRef.current;
3972
+ if (!scrollContainer) {
3973
+ return;
3974
+ }
3975
+ const scrollLeft = scrollSpeed.current.x * scrollDirection.current.x;
3976
+ const scrollTop = scrollSpeed.current.y * scrollDirection.current.y;
3977
+ scrollContainer.scrollBy(scrollLeft, scrollTop);
3978
+ }, []);
3979
+ const sortedScrollableAncestors = useMemo(() => order === TraversalOrder.TreeOrder ? [...scrollableAncestors].reverse() : scrollableAncestors, [order, scrollableAncestors]);
3980
+ useEffect(
3981
+ () => {
3982
+ if (!enabled || !scrollableAncestors.length || !rect) {
3983
+ clearAutoScrollInterval();
3984
+ return;
3985
+ }
3986
+ for (const scrollContainer of sortedScrollableAncestors) {
3987
+ if ((canScroll == null ? void 0 : canScroll(scrollContainer)) === false) {
3988
+ continue;
3989
+ }
3990
+ const index = scrollableAncestors.indexOf(scrollContainer);
3991
+ const scrollContainerRect = scrollableAncestorRects[index];
3992
+ if (!scrollContainerRect) {
3993
+ continue;
3994
+ }
3995
+ const {
3996
+ direction,
3997
+ speed
3998
+ } = getScrollDirectionAndSpeed(scrollContainer, scrollContainerRect, rect, acceleration, threshold);
3999
+ for (const axis of ["x", "y"]) {
4000
+ if (!scrollIntent[axis][direction[axis]]) {
4001
+ speed[axis] = 0;
4002
+ direction[axis] = 0;
4003
+ }
4004
+ }
4005
+ if (speed.x > 0 || speed.y > 0) {
4006
+ clearAutoScrollInterval();
4007
+ scrollContainerRef.current = scrollContainer;
4008
+ setAutoScrollInterval(autoScroll, interval);
4009
+ scrollSpeed.current = speed;
4010
+ scrollDirection.current = direction;
4011
+ return;
4012
+ }
4013
+ }
4014
+ scrollSpeed.current = {
4015
+ x: 0,
4016
+ y: 0
4017
+ };
4018
+ scrollDirection.current = {
4019
+ x: 0,
4020
+ y: 0
4021
+ };
4022
+ clearAutoScrollInterval();
4023
+ },
4024
+ // eslint-disable-next-line react-hooks/exhaustive-deps
4025
+ [
4026
+ acceleration,
4027
+ autoScroll,
4028
+ canScroll,
4029
+ clearAutoScrollInterval,
4030
+ enabled,
4031
+ interval,
4032
+ // eslint-disable-next-line react-hooks/exhaustive-deps
4033
+ JSON.stringify(rect),
4034
+ // eslint-disable-next-line react-hooks/exhaustive-deps
4035
+ JSON.stringify(scrollIntent),
4036
+ setAutoScrollInterval,
4037
+ scrollableAncestors,
4038
+ sortedScrollableAncestors,
4039
+ scrollableAncestorRects,
4040
+ // eslint-disable-next-line react-hooks/exhaustive-deps
4041
+ JSON.stringify(threshold)
4042
+ ]
4043
+ );
4044
+ }
4045
+ var defaultScrollIntent = {
4046
+ x: {
4047
+ [Direction.Backward]: false,
4048
+ [Direction.Forward]: false
4049
+ },
4050
+ y: {
4051
+ [Direction.Backward]: false,
4052
+ [Direction.Forward]: false
4053
+ }
4054
+ };
4055
+ function useScrollIntent(_ref2) {
4056
+ let {
4057
+ delta,
4058
+ disabled
4059
+ } = _ref2;
4060
+ const previousDelta = usePrevious(delta);
4061
+ return useLazyMemo((previousIntent) => {
4062
+ if (disabled || !previousDelta || !previousIntent) {
4063
+ return defaultScrollIntent;
4064
+ }
4065
+ const direction = {
4066
+ x: Math.sign(delta.x - previousDelta.x),
4067
+ y: Math.sign(delta.y - previousDelta.y)
4068
+ };
4069
+ return {
4070
+ x: {
4071
+ [Direction.Backward]: previousIntent.x[Direction.Backward] || direction.x === -1,
4072
+ [Direction.Forward]: previousIntent.x[Direction.Forward] || direction.x === 1
4073
+ },
4074
+ y: {
4075
+ [Direction.Backward]: previousIntent.y[Direction.Backward] || direction.y === -1,
4076
+ [Direction.Forward]: previousIntent.y[Direction.Forward] || direction.y === 1
4077
+ }
4078
+ };
4079
+ }, [disabled, delta, previousDelta]);
4080
+ }
4081
+ function useCachedNode(draggableNodes, id) {
4082
+ const draggableNode = id != null ? draggableNodes.get(id) : void 0;
4083
+ const node = draggableNode ? draggableNode.node.current : null;
4084
+ return useLazyMemo((cachedNode) => {
4085
+ var _ref;
4086
+ if (id == null) {
4087
+ return null;
4088
+ }
4089
+ return (_ref = node != null ? node : cachedNode) != null ? _ref : null;
4090
+ }, [node, id]);
4091
+ }
4092
+ function useCombineActivators(sensors, getSyntheticHandler) {
4093
+ return useMemo(() => sensors.reduce((accumulator, sensor) => {
4094
+ const {
4095
+ sensor: Sensor
4096
+ } = sensor;
4097
+ const sensorActivators = Sensor.activators.map((activator) => ({
4098
+ eventName: activator.eventName,
4099
+ handler: getSyntheticHandler(activator.handler, sensor)
4100
+ }));
4101
+ return [...accumulator, ...sensorActivators];
4102
+ }, []), [sensors, getSyntheticHandler]);
4103
+ }
4104
+ var MeasuringStrategy;
4105
+ (function(MeasuringStrategy2) {
4106
+ MeasuringStrategy2[MeasuringStrategy2["Always"] = 0] = "Always";
4107
+ MeasuringStrategy2[MeasuringStrategy2["BeforeDragging"] = 1] = "BeforeDragging";
4108
+ MeasuringStrategy2[MeasuringStrategy2["WhileDragging"] = 2] = "WhileDragging";
4109
+ })(MeasuringStrategy || (MeasuringStrategy = {}));
4110
+ var MeasuringFrequency;
4111
+ (function(MeasuringFrequency2) {
4112
+ MeasuringFrequency2["Optimized"] = "optimized";
4113
+ })(MeasuringFrequency || (MeasuringFrequency = {}));
4114
+ var defaultValue = /* @__PURE__ */ new Map();
4115
+ function useDroppableMeasuring(containers, _ref) {
4116
+ let {
4117
+ dragging,
4118
+ dependencies,
4119
+ config
4120
+ } = _ref;
4121
+ const [queue, setQueue] = useState(null);
4122
+ const {
4123
+ frequency,
4124
+ measure,
4125
+ strategy
4126
+ } = config;
4127
+ const containersRef = useRef(containers);
4128
+ const disabled = isDisabled();
4129
+ const disabledRef = useLatestValue(disabled);
4130
+ const measureDroppableContainers = useCallback(function(ids2) {
4131
+ if (ids2 === void 0) {
4132
+ ids2 = [];
4133
+ }
4134
+ if (disabledRef.current) {
4135
+ return;
4136
+ }
4137
+ setQueue((value) => {
4138
+ if (value === null) {
4139
+ return ids2;
4140
+ }
4141
+ return value.concat(ids2.filter((id) => !value.includes(id)));
4142
+ });
4143
+ }, [disabledRef]);
4144
+ const timeoutId = useRef(null);
4145
+ const droppableRects = useLazyMemo((previousValue) => {
4146
+ if (disabled && !dragging) {
4147
+ return defaultValue;
4148
+ }
4149
+ if (!previousValue || previousValue === defaultValue || containersRef.current !== containers || queue != null) {
4150
+ const map = /* @__PURE__ */ new Map();
4151
+ for (let container of containers) {
4152
+ if (!container) {
4153
+ continue;
4154
+ }
4155
+ if (queue && queue.length > 0 && !queue.includes(container.id) && container.rect.current) {
4156
+ map.set(container.id, container.rect.current);
4157
+ continue;
4158
+ }
4159
+ const node = container.node.current;
4160
+ const rect = node ? new Rect(measure(node), node) : null;
4161
+ container.rect.current = rect;
4162
+ if (rect) {
4163
+ map.set(container.id, rect);
4164
+ }
4165
+ }
4166
+ return map;
4167
+ }
4168
+ return previousValue;
4169
+ }, [containers, queue, dragging, disabled, measure]);
4170
+ useEffect(() => {
4171
+ containersRef.current = containers;
4172
+ }, [containers]);
4173
+ useEffect(
4174
+ () => {
4175
+ if (disabled) {
4176
+ return;
4177
+ }
4178
+ measureDroppableContainers();
4179
+ },
4180
+ // eslint-disable-next-line react-hooks/exhaustive-deps
4181
+ [dragging, disabled]
4182
+ );
4183
+ useEffect(
4184
+ () => {
4185
+ if (queue && queue.length > 0) {
4186
+ setQueue(null);
4187
+ }
4188
+ },
4189
+ //eslint-disable-next-line react-hooks/exhaustive-deps
4190
+ [JSON.stringify(queue)]
4191
+ );
4192
+ useEffect(
4193
+ () => {
4194
+ if (disabled || typeof frequency !== "number" || timeoutId.current !== null) {
4195
+ return;
4196
+ }
4197
+ timeoutId.current = setTimeout(() => {
4198
+ measureDroppableContainers();
4199
+ timeoutId.current = null;
4200
+ }, frequency);
4201
+ },
4202
+ // eslint-disable-next-line react-hooks/exhaustive-deps
4203
+ [frequency, disabled, measureDroppableContainers, ...dependencies]
4204
+ );
4205
+ return {
4206
+ droppableRects,
4207
+ measureDroppableContainers,
4208
+ measuringScheduled: queue != null
4209
+ };
4210
+ function isDisabled() {
4211
+ switch (strategy) {
4212
+ case MeasuringStrategy.Always:
4213
+ return false;
4214
+ case MeasuringStrategy.BeforeDragging:
4215
+ return dragging;
4216
+ default:
4217
+ return !dragging;
4218
+ }
4219
+ }
4220
+ }
4221
+ function useInitialValue(value, computeFn) {
4222
+ return useLazyMemo((previousValue) => {
4223
+ if (!value) {
4224
+ return null;
4225
+ }
4226
+ if (previousValue) {
4227
+ return previousValue;
4228
+ }
4229
+ return typeof computeFn === "function" ? computeFn(value) : value;
4230
+ }, [computeFn, value]);
4231
+ }
4232
+ function useInitialRect(node, measure) {
4233
+ return useInitialValue(node, measure);
4234
+ }
4235
+ function useMutationObserver(_ref) {
4236
+ let {
4237
+ callback,
4238
+ disabled
4239
+ } = _ref;
4240
+ const handleMutations = useEvent(callback);
4241
+ const mutationObserver = useMemo(() => {
4242
+ if (disabled || typeof window === "undefined" || typeof window.MutationObserver === "undefined") {
4243
+ return void 0;
4244
+ }
4245
+ const {
4246
+ MutationObserver
4247
+ } = window;
4248
+ return new MutationObserver(handleMutations);
4249
+ }, [handleMutations, disabled]);
4250
+ useEffect(() => {
4251
+ return () => mutationObserver == null ? void 0 : mutationObserver.disconnect();
4252
+ }, [mutationObserver]);
4253
+ return mutationObserver;
4254
+ }
4255
+ function useResizeObserver(_ref) {
4256
+ let {
4257
+ callback,
4258
+ disabled
4259
+ } = _ref;
4260
+ const handleResize = useEvent(callback);
4261
+ const resizeObserver = useMemo(
4262
+ () => {
4263
+ if (disabled || typeof window === "undefined" || typeof window.ResizeObserver === "undefined") {
4264
+ return void 0;
4265
+ }
4266
+ const {
4267
+ ResizeObserver
4268
+ } = window;
4269
+ return new ResizeObserver(handleResize);
4270
+ },
4271
+ // eslint-disable-next-line react-hooks/exhaustive-deps
4272
+ [disabled]
4273
+ );
4274
+ useEffect(() => {
4275
+ return () => resizeObserver == null ? void 0 : resizeObserver.disconnect();
4276
+ }, [resizeObserver]);
4277
+ return resizeObserver;
4278
+ }
4279
+ function defaultMeasure(element) {
4280
+ return new Rect(getClientRect(element), element);
4281
+ }
4282
+ function useRect(element, measure, fallbackRect) {
4283
+ if (measure === void 0) {
4284
+ measure = defaultMeasure;
4285
+ }
4286
+ const [rect, setRect] = useState(null);
4287
+ function measureRect() {
4288
+ setRect((currentRect) => {
4289
+ if (!element) {
4290
+ return null;
4291
+ }
4292
+ if (element.isConnected === false) {
4293
+ var _ref;
4294
+ return (_ref = currentRect != null ? currentRect : fallbackRect) != null ? _ref : null;
4295
+ }
4296
+ const newRect = measure(element);
4297
+ if (JSON.stringify(currentRect) === JSON.stringify(newRect)) {
4298
+ return currentRect;
4299
+ }
4300
+ return newRect;
4301
+ });
4302
+ }
4303
+ const mutationObserver = useMutationObserver({
4304
+ callback(records) {
4305
+ if (!element) {
4306
+ return;
4307
+ }
4308
+ for (const record of records) {
4309
+ const {
4310
+ type,
4311
+ target
4312
+ } = record;
4313
+ if (type === "childList" && target instanceof HTMLElement && target.contains(element)) {
4314
+ measureRect();
4315
+ break;
4316
+ }
4317
+ }
4318
+ }
4319
+ });
4320
+ const resizeObserver = useResizeObserver({
4321
+ callback: measureRect
4322
+ });
4323
+ useIsomorphicLayoutEffect(() => {
4324
+ measureRect();
4325
+ if (element) {
4326
+ resizeObserver == null ? void 0 : resizeObserver.observe(element);
4327
+ mutationObserver == null ? void 0 : mutationObserver.observe(document.body, {
4328
+ childList: true,
4329
+ subtree: true
4330
+ });
4331
+ } else {
4332
+ resizeObserver == null ? void 0 : resizeObserver.disconnect();
4333
+ mutationObserver == null ? void 0 : mutationObserver.disconnect();
4334
+ }
4335
+ }, [element]);
4336
+ return rect;
4337
+ }
4338
+ function useRectDelta(rect) {
4339
+ const initialRect = useInitialValue(rect);
4340
+ return getRectDelta(rect, initialRect);
4341
+ }
4342
+ var defaultValue$1 = [];
4343
+ function useScrollableAncestors(node) {
4344
+ const previousNode = useRef(node);
4345
+ const ancestors = useLazyMemo((previousValue) => {
4346
+ if (!node) {
4347
+ return defaultValue$1;
4348
+ }
4349
+ if (previousValue && previousValue !== defaultValue$1 && node && previousNode.current && node.parentNode === previousNode.current.parentNode) {
4350
+ return previousValue;
4351
+ }
4352
+ return getScrollableAncestors(node);
4353
+ }, [node]);
4354
+ useEffect(() => {
4355
+ previousNode.current = node;
4356
+ }, [node]);
4357
+ return ancestors;
4358
+ }
4359
+ function useScrollOffsets(elements) {
4360
+ const [scrollCoordinates, setScrollCoordinates] = useState(null);
4361
+ const prevElements = useRef(elements);
4362
+ const handleScroll = useCallback((event) => {
4363
+ const scrollingElement = getScrollableElement(event.target);
4364
+ if (!scrollingElement) {
4365
+ return;
4366
+ }
4367
+ setScrollCoordinates((scrollCoordinates2) => {
4368
+ if (!scrollCoordinates2) {
4369
+ return null;
4370
+ }
4371
+ scrollCoordinates2.set(scrollingElement, getScrollCoordinates(scrollingElement));
4372
+ return new Map(scrollCoordinates2);
4373
+ });
4374
+ }, []);
4375
+ useEffect(() => {
4376
+ const previousElements = prevElements.current;
4377
+ if (elements !== previousElements) {
4378
+ cleanup(previousElements);
4379
+ const entries = elements.map((element) => {
4380
+ const scrollableElement = getScrollableElement(element);
4381
+ if (scrollableElement) {
4382
+ scrollableElement.addEventListener("scroll", handleScroll, {
4383
+ passive: true
4384
+ });
4385
+ return [scrollableElement, getScrollCoordinates(scrollableElement)];
4386
+ }
4387
+ return null;
4388
+ }).filter((entry) => entry != null);
4389
+ setScrollCoordinates(entries.length ? new Map(entries) : null);
4390
+ prevElements.current = elements;
4391
+ }
4392
+ return () => {
4393
+ cleanup(elements);
4394
+ cleanup(previousElements);
4395
+ };
4396
+ function cleanup(elements2) {
4397
+ elements2.forEach((element) => {
4398
+ const scrollableElement = getScrollableElement(element);
4399
+ scrollableElement == null ? void 0 : scrollableElement.removeEventListener("scroll", handleScroll);
4400
+ });
4401
+ }
4402
+ }, [handleScroll, elements]);
4403
+ return useMemo(() => {
4404
+ if (elements.length) {
4405
+ return scrollCoordinates ? Array.from(scrollCoordinates.values()).reduce((acc, coordinates) => add(acc, coordinates), defaultCoordinates) : getScrollOffsets(elements);
4406
+ }
4407
+ return defaultCoordinates;
4408
+ }, [elements, scrollCoordinates]);
4409
+ }
4410
+ function useScrollOffsetsDelta(scrollOffsets, dependencies) {
4411
+ if (dependencies === void 0) {
4412
+ dependencies = [];
4413
+ }
4414
+ const initialScrollOffsets = useRef(null);
4415
+ useEffect(
4416
+ () => {
4417
+ initialScrollOffsets.current = null;
4418
+ },
4419
+ // eslint-disable-next-line react-hooks/exhaustive-deps
4420
+ dependencies
4421
+ );
4422
+ useEffect(() => {
4423
+ const hasScrollOffsets = scrollOffsets !== defaultCoordinates;
4424
+ if (hasScrollOffsets && !initialScrollOffsets.current) {
4425
+ initialScrollOffsets.current = scrollOffsets;
4426
+ }
4427
+ if (!hasScrollOffsets && initialScrollOffsets.current) {
4428
+ initialScrollOffsets.current = null;
4429
+ }
4430
+ }, [scrollOffsets]);
4431
+ return initialScrollOffsets.current ? subtract(scrollOffsets, initialScrollOffsets.current) : defaultCoordinates;
4432
+ }
4433
+ function useSensorSetup(sensors) {
4434
+ useEffect(
4435
+ () => {
4436
+ if (!canUseDOM) {
4437
+ return;
4438
+ }
4439
+ const teardownFns = sensors.map((_ref) => {
4440
+ let {
4441
+ sensor
4442
+ } = _ref;
4443
+ return sensor.setup == null ? void 0 : sensor.setup();
4444
+ });
4445
+ return () => {
4446
+ for (const teardown of teardownFns) {
4447
+ teardown == null ? void 0 : teardown();
4448
+ }
4449
+ };
4450
+ },
4451
+ // TO-DO: Sensors length could theoretically change which would not be a valid dependency
4452
+ // eslint-disable-next-line react-hooks/exhaustive-deps
4453
+ sensors.map((_ref2) => {
4454
+ let {
4455
+ sensor
4456
+ } = _ref2;
4457
+ return sensor;
4458
+ })
4459
+ );
4460
+ }
4461
+ function useSyntheticListeners(listeners, id) {
4462
+ return useMemo(() => {
4463
+ return listeners.reduce((acc, _ref) => {
4464
+ let {
4465
+ eventName,
4466
+ handler
4467
+ } = _ref;
4468
+ acc[eventName] = (event) => {
4469
+ handler(event, id);
4470
+ };
4471
+ return acc;
4472
+ }, {});
4473
+ }, [listeners, id]);
4474
+ }
4475
+ function useWindowRect(element) {
4476
+ return useMemo(() => element ? getWindowClientRect(element) : null, [element]);
4477
+ }
4478
+ var defaultValue$2 = [];
4479
+ function useRects(elements, measure) {
4480
+ if (measure === void 0) {
4481
+ measure = getClientRect;
4482
+ }
4483
+ const [firstElement] = elements;
4484
+ const windowRect = useWindowRect(firstElement ? getWindow(firstElement) : null);
4485
+ const [rects, setRects] = useState(defaultValue$2);
4486
+ function measureRects() {
4487
+ setRects(() => {
4488
+ if (!elements.length) {
4489
+ return defaultValue$2;
4490
+ }
4491
+ return elements.map((element) => isDocumentScrollingElement(element) ? windowRect : new Rect(measure(element), element));
4492
+ });
4493
+ }
4494
+ const resizeObserver = useResizeObserver({
4495
+ callback: measureRects
4496
+ });
4497
+ useIsomorphicLayoutEffect(() => {
4498
+ resizeObserver == null ? void 0 : resizeObserver.disconnect();
4499
+ measureRects();
4500
+ elements.forEach((element) => resizeObserver == null ? void 0 : resizeObserver.observe(element));
4501
+ }, [elements]);
4502
+ return rects;
4503
+ }
4504
+ function getMeasurableNode(node) {
4505
+ if (!node) {
4506
+ return null;
4507
+ }
4508
+ if (node.children.length > 1) {
4509
+ return node;
4510
+ }
4511
+ const firstChild = node.children[0];
4512
+ return isHTMLElement(firstChild) ? firstChild : node;
4513
+ }
4514
+ function useDragOverlayMeasuring(_ref) {
4515
+ let {
4516
+ measure
4517
+ } = _ref;
4518
+ const [rect, setRect] = useState(null);
4519
+ const handleResize = useCallback((entries) => {
4520
+ for (const {
4521
+ target
4522
+ } of entries) {
4523
+ if (isHTMLElement(target)) {
4524
+ setRect((rect2) => {
4525
+ const newRect = measure(target);
4526
+ return rect2 ? {
4527
+ ...rect2,
4528
+ width: newRect.width,
4529
+ height: newRect.height
4530
+ } : newRect;
4531
+ });
4532
+ break;
4533
+ }
4534
+ }
4535
+ }, [measure]);
4536
+ const resizeObserver = useResizeObserver({
4537
+ callback: handleResize
4538
+ });
4539
+ const handleNodeChange = useCallback((element) => {
4540
+ const node = getMeasurableNode(element);
4541
+ resizeObserver == null ? void 0 : resizeObserver.disconnect();
4542
+ if (node) {
4543
+ resizeObserver == null ? void 0 : resizeObserver.observe(node);
4544
+ }
4545
+ setRect(node ? measure(node) : null);
4546
+ }, [measure, resizeObserver]);
4547
+ const [nodeRef, setRef] = useNodeRef(handleNodeChange);
4548
+ return useMemo(() => ({
4549
+ nodeRef,
4550
+ rect,
4551
+ setRef
4552
+ }), [rect, nodeRef, setRef]);
4553
+ }
4554
+ var defaultSensors = [{
4555
+ sensor: PointerSensor,
4556
+ options: {}
4557
+ }, {
4558
+ sensor: KeyboardSensor,
4559
+ options: {}
4560
+ }];
4561
+ var defaultData = {
4562
+ current: {}
4563
+ };
4564
+ var defaultMeasuringConfiguration = {
4565
+ draggable: {
4566
+ measure: getTransformAgnosticClientRect
4567
+ },
4568
+ droppable: {
4569
+ measure: getTransformAgnosticClientRect,
4570
+ strategy: MeasuringStrategy.WhileDragging,
4571
+ frequency: MeasuringFrequency.Optimized
4572
+ },
4573
+ dragOverlay: {
4574
+ measure: getClientRect
4575
+ }
4576
+ };
4577
+ var DroppableContainersMap = class extends Map {
4578
+ get(id) {
4579
+ var _super$get;
4580
+ return id != null ? (_super$get = super.get(id)) != null ? _super$get : void 0 : void 0;
4581
+ }
4582
+ toArray() {
4583
+ return Array.from(this.values());
4584
+ }
4585
+ getEnabled() {
4586
+ return this.toArray().filter((_ref) => {
4587
+ let {
4588
+ disabled
4589
+ } = _ref;
4590
+ return !disabled;
4591
+ });
4592
+ }
4593
+ getNodeFor(id) {
4594
+ var _this$get$node$curren, _this$get;
4595
+ return (_this$get$node$curren = (_this$get = this.get(id)) == null ? void 0 : _this$get.node.current) != null ? _this$get$node$curren : void 0;
4596
+ }
4597
+ };
4598
+ var defaultPublicContext = {
4599
+ activatorEvent: null,
4600
+ active: null,
4601
+ activeNode: null,
4602
+ activeNodeRect: null,
4603
+ collisions: null,
4604
+ containerNodeRect: null,
4605
+ draggableNodes: /* @__PURE__ */ new Map(),
4606
+ droppableRects: /* @__PURE__ */ new Map(),
4607
+ droppableContainers: /* @__PURE__ */ new DroppableContainersMap(),
4608
+ over: null,
4609
+ dragOverlay: {
4610
+ nodeRef: {
4611
+ current: null
4612
+ },
4613
+ rect: null,
4614
+ setRef: noop
4615
+ },
4616
+ scrollableAncestors: [],
4617
+ scrollableAncestorRects: [],
4618
+ measuringConfiguration: defaultMeasuringConfiguration,
4619
+ measureDroppableContainers: noop,
4620
+ windowRect: null,
4621
+ measuringScheduled: false
4622
+ };
4623
+ var defaultInternalContext = {
4624
+ activatorEvent: null,
4625
+ activators: [],
4626
+ active: null,
4627
+ activeNodeRect: null,
4628
+ ariaDescribedById: {
4629
+ draggable: ""
4630
+ },
4631
+ dispatch: noop,
4632
+ draggableNodes: /* @__PURE__ */ new Map(),
4633
+ over: null,
4634
+ measureDroppableContainers: noop
4635
+ };
4636
+ var InternalContext = /* @__PURE__ */ createContext(defaultInternalContext);
4637
+ var PublicContext = /* @__PURE__ */ createContext(defaultPublicContext);
4638
+ function getInitialState() {
4639
+ return {
4640
+ draggable: {
4641
+ active: null,
4642
+ initialCoordinates: {
4643
+ x: 0,
4644
+ y: 0
4645
+ },
4646
+ nodes: /* @__PURE__ */ new Map(),
4647
+ translate: {
4648
+ x: 0,
4649
+ y: 0
4650
+ }
4651
+ },
4652
+ droppable: {
4653
+ containers: new DroppableContainersMap()
4654
+ }
4655
+ };
4656
+ }
4657
+ function reducer(state, action) {
4658
+ switch (action.type) {
4659
+ case Action.DragStart:
4660
+ return {
4661
+ ...state,
4662
+ draggable: {
4663
+ ...state.draggable,
4664
+ initialCoordinates: action.initialCoordinates,
4665
+ active: action.active
4666
+ }
4667
+ };
4668
+ case Action.DragMove:
4669
+ if (state.draggable.active == null) {
4670
+ return state;
4671
+ }
4672
+ return {
4673
+ ...state,
4674
+ draggable: {
4675
+ ...state.draggable,
4676
+ translate: {
4677
+ x: action.coordinates.x - state.draggable.initialCoordinates.x,
4678
+ y: action.coordinates.y - state.draggable.initialCoordinates.y
4679
+ }
4680
+ }
4681
+ };
4682
+ case Action.DragEnd:
4683
+ case Action.DragCancel:
4684
+ return {
4685
+ ...state,
4686
+ draggable: {
4687
+ ...state.draggable,
4688
+ active: null,
4689
+ initialCoordinates: {
4690
+ x: 0,
4691
+ y: 0
4692
+ },
4693
+ translate: {
4694
+ x: 0,
4695
+ y: 0
4696
+ }
4697
+ }
4698
+ };
4699
+ case Action.RegisterDroppable: {
4700
+ const {
4701
+ element
4702
+ } = action;
4703
+ const {
4704
+ id
4705
+ } = element;
4706
+ const containers = new DroppableContainersMap(state.droppable.containers);
4707
+ containers.set(id, element);
4708
+ return {
4709
+ ...state,
4710
+ droppable: {
4711
+ ...state.droppable,
4712
+ containers
4713
+ }
4714
+ };
4715
+ }
4716
+ case Action.SetDroppableDisabled: {
4717
+ const {
4718
+ id,
4719
+ key,
4720
+ disabled
4721
+ } = action;
4722
+ const element = state.droppable.containers.get(id);
4723
+ if (!element || key !== element.key) {
4724
+ return state;
4725
+ }
4726
+ const containers = new DroppableContainersMap(state.droppable.containers);
4727
+ containers.set(id, {
4728
+ ...element,
4729
+ disabled
4730
+ });
4731
+ return {
4732
+ ...state,
4733
+ droppable: {
4734
+ ...state.droppable,
4735
+ containers
4736
+ }
4737
+ };
4738
+ }
4739
+ case Action.UnregisterDroppable: {
4740
+ const {
4741
+ id,
4742
+ key
4743
+ } = action;
4744
+ const element = state.droppable.containers.get(id);
4745
+ if (!element || key !== element.key) {
4746
+ return state;
4747
+ }
4748
+ const containers = new DroppableContainersMap(state.droppable.containers);
4749
+ containers.delete(id);
4750
+ return {
4751
+ ...state,
4752
+ droppable: {
4753
+ ...state.droppable,
4754
+ containers
4755
+ }
4756
+ };
4757
+ }
4758
+ default: {
4759
+ return state;
4760
+ }
4761
+ }
4762
+ }
4763
+ function RestoreFocus(_ref) {
4764
+ let {
4765
+ disabled
4766
+ } = _ref;
4767
+ const {
4768
+ active,
4769
+ activatorEvent,
4770
+ draggableNodes
4771
+ } = useContext(InternalContext);
4772
+ const previousActivatorEvent = usePrevious(activatorEvent);
4773
+ const previousActiveId = usePrevious(active == null ? void 0 : active.id);
4774
+ useEffect(() => {
4775
+ if (disabled) {
4776
+ return;
4777
+ }
4778
+ if (!activatorEvent && previousActivatorEvent && previousActiveId != null) {
4779
+ if (!isKeyboardEvent(previousActivatorEvent)) {
4780
+ return;
4781
+ }
4782
+ if (document.activeElement === previousActivatorEvent.target) {
4783
+ return;
4784
+ }
4785
+ const draggableNode = draggableNodes.get(previousActiveId);
4786
+ if (!draggableNode) {
4787
+ return;
4788
+ }
4789
+ const {
4790
+ activatorNode,
4791
+ node
4792
+ } = draggableNode;
4793
+ if (!activatorNode.current && !node.current) {
4794
+ return;
4795
+ }
4796
+ requestAnimationFrame(() => {
4797
+ for (const element of [activatorNode.current, node.current]) {
4798
+ if (!element) {
4799
+ continue;
4800
+ }
4801
+ const focusableNode = findFirstFocusableNode(element);
4802
+ if (focusableNode) {
4803
+ focusableNode.focus();
4804
+ break;
4805
+ }
4806
+ }
4807
+ });
4808
+ }
4809
+ }, [activatorEvent, disabled, draggableNodes, previousActiveId, previousActivatorEvent]);
4810
+ return null;
4811
+ }
4812
+ function applyModifiers(modifiers, _ref) {
4813
+ let {
4814
+ transform,
4815
+ ...args
4816
+ } = _ref;
4817
+ return modifiers != null && modifiers.length ? modifiers.reduce((accumulator, modifier) => {
4818
+ return modifier({
4819
+ transform: accumulator,
4820
+ ...args
4821
+ });
4822
+ }, transform) : transform;
4823
+ }
4824
+ function useMeasuringConfiguration(config) {
4825
+ return useMemo(
4826
+ () => ({
4827
+ draggable: {
4828
+ ...defaultMeasuringConfiguration.draggable,
4829
+ ...config == null ? void 0 : config.draggable
4830
+ },
4831
+ droppable: {
4832
+ ...defaultMeasuringConfiguration.droppable,
4833
+ ...config == null ? void 0 : config.droppable
4834
+ },
4835
+ dragOverlay: {
4836
+ ...defaultMeasuringConfiguration.dragOverlay,
4837
+ ...config == null ? void 0 : config.dragOverlay
4838
+ }
4839
+ }),
4840
+ // eslint-disable-next-line react-hooks/exhaustive-deps
4841
+ [config == null ? void 0 : config.draggable, config == null ? void 0 : config.droppable, config == null ? void 0 : config.dragOverlay]
4842
+ );
4843
+ }
4844
+ function useLayoutShiftScrollCompensation(_ref) {
4845
+ let {
4846
+ activeNode,
4847
+ measure,
4848
+ initialRect,
4849
+ config = true
4850
+ } = _ref;
4851
+ const initialized = useRef(false);
4852
+ const {
4853
+ x,
4854
+ y
4855
+ } = typeof config === "boolean" ? {
4856
+ x: config,
4857
+ y: config
4858
+ } : config;
4859
+ useIsomorphicLayoutEffect(() => {
4860
+ const disabled = !x && !y;
4861
+ if (disabled || !activeNode) {
4862
+ initialized.current = false;
4863
+ return;
4864
+ }
4865
+ if (initialized.current || !initialRect) {
4866
+ return;
4867
+ }
4868
+ const node = activeNode == null ? void 0 : activeNode.node.current;
4869
+ if (!node || node.isConnected === false) {
4870
+ return;
4871
+ }
4872
+ const rect = measure(node);
4873
+ const rectDelta = getRectDelta(rect, initialRect);
4874
+ if (!x) {
4875
+ rectDelta.x = 0;
4876
+ }
4877
+ if (!y) {
4878
+ rectDelta.y = 0;
4879
+ }
4880
+ initialized.current = true;
4881
+ if (Math.abs(rectDelta.x) > 0 || Math.abs(rectDelta.y) > 0) {
4882
+ const firstScrollableAncestor = getFirstScrollableAncestor(node);
4883
+ if (firstScrollableAncestor) {
4884
+ firstScrollableAncestor.scrollBy({
4885
+ top: rectDelta.y,
4886
+ left: rectDelta.x
4887
+ });
4888
+ }
4889
+ }
4890
+ }, [activeNode, x, y, initialRect, measure]);
4891
+ }
4892
+ var ActiveDraggableContext = /* @__PURE__ */ createContext({
4893
+ ...defaultCoordinates,
4894
+ scaleX: 1,
4895
+ scaleY: 1
4896
+ });
4897
+ var Status;
4898
+ (function(Status2) {
4899
+ Status2[Status2["Uninitialized"] = 0] = "Uninitialized";
4900
+ Status2[Status2["Initializing"] = 1] = "Initializing";
4901
+ Status2[Status2["Initialized"] = 2] = "Initialized";
4902
+ })(Status || (Status = {}));
4903
+ var DndContext = /* @__PURE__ */ memo(function DndContext2(_ref) {
4904
+ var _sensorContext$curren, _dragOverlay$nodeRef$, _dragOverlay$rect, _over$rect;
4905
+ let {
4906
+ id,
4907
+ accessibility,
4908
+ autoScroll = true,
4909
+ children,
4910
+ sensors = defaultSensors,
4911
+ collisionDetection = rectIntersection,
4912
+ measuring,
4913
+ modifiers,
4914
+ ...props
4915
+ } = _ref;
4916
+ const store = useReducer(reducer, void 0, getInitialState);
4917
+ const [state, dispatch] = store;
4918
+ const [dispatchMonitorEvent, registerMonitorListener] = useDndMonitorProvider();
4919
+ const [status, setStatus] = useState(Status.Uninitialized);
4920
+ const isInitialized = status === Status.Initialized;
4921
+ const {
4922
+ draggable: {
4923
+ active: activeId,
4924
+ nodes: draggableNodes,
4925
+ translate
4926
+ },
4927
+ droppable: {
4928
+ containers: droppableContainers
4929
+ }
4930
+ } = state;
4931
+ const node = activeId != null ? draggableNodes.get(activeId) : null;
4932
+ const activeRects = useRef({
4933
+ initial: null,
4934
+ translated: null
4935
+ });
4936
+ const active = useMemo(() => {
4937
+ var _node$data;
4938
+ return activeId != null ? {
4939
+ id: activeId,
4940
+ // It's possible for the active node to unmount while dragging
4941
+ data: (_node$data = node == null ? void 0 : node.data) != null ? _node$data : defaultData,
4942
+ rect: activeRects
4943
+ } : null;
4944
+ }, [activeId, node]);
4945
+ const activeRef = useRef(null);
4946
+ const [activeSensor, setActiveSensor] = useState(null);
4947
+ const [activatorEvent, setActivatorEvent] = useState(null);
4948
+ const latestProps = useLatestValue(props, Object.values(props));
4949
+ const draggableDescribedById = useUniqueId("DndDescribedBy", id);
4950
+ const enabledDroppableContainers = useMemo(() => droppableContainers.getEnabled(), [droppableContainers]);
4951
+ const measuringConfiguration = useMeasuringConfiguration(measuring);
4952
+ const {
4953
+ droppableRects,
4954
+ measureDroppableContainers,
4955
+ measuringScheduled
4956
+ } = useDroppableMeasuring(enabledDroppableContainers, {
4957
+ dragging: isInitialized,
4958
+ dependencies: [translate.x, translate.y],
4959
+ config: measuringConfiguration.droppable
4960
+ });
4961
+ const activeNode = useCachedNode(draggableNodes, activeId);
4962
+ const activationCoordinates = useMemo(() => activatorEvent ? getEventCoordinates(activatorEvent) : null, [activatorEvent]);
4963
+ const autoScrollOptions = getAutoScrollerOptions();
4964
+ const initialActiveNodeRect = useInitialRect(activeNode, measuringConfiguration.draggable.measure);
4965
+ useLayoutShiftScrollCompensation({
4966
+ activeNode: activeId != null ? draggableNodes.get(activeId) : null,
4967
+ config: autoScrollOptions.layoutShiftCompensation,
4968
+ initialRect: initialActiveNodeRect,
4969
+ measure: measuringConfiguration.draggable.measure
4970
+ });
4971
+ const activeNodeRect = useRect(activeNode, measuringConfiguration.draggable.measure, initialActiveNodeRect);
4972
+ const containerNodeRect = useRect(activeNode ? activeNode.parentElement : null);
4973
+ const sensorContext = useRef({
4974
+ activatorEvent: null,
4975
+ active: null,
4976
+ activeNode,
4977
+ collisionRect: null,
4978
+ collisions: null,
4979
+ droppableRects,
4980
+ draggableNodes,
4981
+ draggingNode: null,
4982
+ draggingNodeRect: null,
4983
+ droppableContainers,
4984
+ over: null,
4985
+ scrollableAncestors: [],
4986
+ scrollAdjustedTranslate: null
4987
+ });
4988
+ const overNode = droppableContainers.getNodeFor((_sensorContext$curren = sensorContext.current.over) == null ? void 0 : _sensorContext$curren.id);
4989
+ const dragOverlay = useDragOverlayMeasuring({
4990
+ measure: measuringConfiguration.dragOverlay.measure
4991
+ });
4992
+ const draggingNode = (_dragOverlay$nodeRef$ = dragOverlay.nodeRef.current) != null ? _dragOverlay$nodeRef$ : activeNode;
4993
+ const draggingNodeRect = isInitialized ? (_dragOverlay$rect = dragOverlay.rect) != null ? _dragOverlay$rect : activeNodeRect : null;
4994
+ const usesDragOverlay = Boolean(dragOverlay.nodeRef.current && dragOverlay.rect);
4995
+ const nodeRectDelta = useRectDelta(usesDragOverlay ? null : activeNodeRect);
4996
+ const windowRect = useWindowRect(draggingNode ? getWindow(draggingNode) : null);
4997
+ const scrollableAncestors = useScrollableAncestors(isInitialized ? overNode != null ? overNode : activeNode : null);
4998
+ const scrollableAncestorRects = useRects(scrollableAncestors);
4999
+ const modifiedTranslate = applyModifiers(modifiers, {
5000
+ transform: {
5001
+ x: translate.x - nodeRectDelta.x,
5002
+ y: translate.y - nodeRectDelta.y,
5003
+ scaleX: 1,
5004
+ scaleY: 1
5005
+ },
5006
+ activatorEvent,
5007
+ active,
5008
+ activeNodeRect,
5009
+ containerNodeRect,
5010
+ draggingNodeRect,
5011
+ over: sensorContext.current.over,
5012
+ overlayNodeRect: dragOverlay.rect,
5013
+ scrollableAncestors,
5014
+ scrollableAncestorRects,
5015
+ windowRect
5016
+ });
5017
+ const pointerCoordinates = activationCoordinates ? add(activationCoordinates, translate) : null;
5018
+ const scrollOffsets = useScrollOffsets(scrollableAncestors);
5019
+ const scrollAdjustment = useScrollOffsetsDelta(scrollOffsets);
5020
+ const activeNodeScrollDelta = useScrollOffsetsDelta(scrollOffsets, [activeNodeRect]);
5021
+ const scrollAdjustedTranslate = add(modifiedTranslate, scrollAdjustment);
5022
+ const collisionRect = draggingNodeRect ? getAdjustedRect(draggingNodeRect, modifiedTranslate) : null;
5023
+ const collisions = active && collisionRect ? collisionDetection({
5024
+ active,
5025
+ collisionRect,
5026
+ droppableRects,
5027
+ droppableContainers: enabledDroppableContainers,
5028
+ pointerCoordinates
5029
+ }) : null;
5030
+ const overId = getFirstCollision(collisions, "id");
5031
+ const [over, setOver] = useState(null);
5032
+ const appliedTranslate = usesDragOverlay ? modifiedTranslate : add(modifiedTranslate, activeNodeScrollDelta);
5033
+ const transform = adjustScale(appliedTranslate, (_over$rect = over == null ? void 0 : over.rect) != null ? _over$rect : null, activeNodeRect);
5034
+ const activeSensorRef = useRef(null);
5035
+ const instantiateSensor = useCallback(
5036
+ (event, _ref2) => {
5037
+ let {
5038
+ sensor: Sensor,
5039
+ options
5040
+ } = _ref2;
5041
+ if (activeRef.current == null) {
5042
+ return;
5043
+ }
5044
+ const activeNode2 = draggableNodes.get(activeRef.current);
5045
+ if (!activeNode2) {
5046
+ return;
5047
+ }
5048
+ const activatorEvent2 = event.nativeEvent;
5049
+ const sensorInstance = new Sensor({
5050
+ active: activeRef.current,
5051
+ activeNode: activeNode2,
5052
+ event: activatorEvent2,
5053
+ options,
5054
+ // Sensors need to be instantiated with refs for arguments that change over time
5055
+ // otherwise they are frozen in time with the stale arguments
5056
+ context: sensorContext,
5057
+ onAbort(id2) {
5058
+ const draggableNode = draggableNodes.get(id2);
5059
+ if (!draggableNode) {
5060
+ return;
5061
+ }
5062
+ const {
5063
+ onDragAbort
5064
+ } = latestProps.current;
5065
+ const event2 = {
5066
+ id: id2
5067
+ };
5068
+ onDragAbort == null ? void 0 : onDragAbort(event2);
5069
+ dispatchMonitorEvent({
5070
+ type: "onDragAbort",
5071
+ event: event2
5072
+ });
5073
+ },
5074
+ onPending(id2, constraint, initialCoordinates, offset) {
5075
+ const draggableNode = draggableNodes.get(id2);
5076
+ if (!draggableNode) {
5077
+ return;
5078
+ }
5079
+ const {
5080
+ onDragPending
5081
+ } = latestProps.current;
5082
+ const event2 = {
5083
+ id: id2,
5084
+ constraint,
5085
+ initialCoordinates,
5086
+ offset
5087
+ };
5088
+ onDragPending == null ? void 0 : onDragPending(event2);
5089
+ dispatchMonitorEvent({
5090
+ type: "onDragPending",
5091
+ event: event2
5092
+ });
5093
+ },
5094
+ onStart(initialCoordinates) {
5095
+ const id2 = activeRef.current;
5096
+ if (id2 == null) {
5097
+ return;
5098
+ }
5099
+ const draggableNode = draggableNodes.get(id2);
5100
+ if (!draggableNode) {
5101
+ return;
5102
+ }
5103
+ const {
5104
+ onDragStart
5105
+ } = latestProps.current;
5106
+ const event2 = {
5107
+ activatorEvent: activatorEvent2,
5108
+ active: {
5109
+ id: id2,
5110
+ data: draggableNode.data,
5111
+ rect: activeRects
5112
+ }
5113
+ };
5114
+ unstable_batchedUpdates(() => {
5115
+ onDragStart == null ? void 0 : onDragStart(event2);
5116
+ setStatus(Status.Initializing);
5117
+ dispatch({
5118
+ type: Action.DragStart,
5119
+ initialCoordinates,
5120
+ active: id2
5121
+ });
5122
+ dispatchMonitorEvent({
5123
+ type: "onDragStart",
5124
+ event: event2
5125
+ });
5126
+ setActiveSensor(activeSensorRef.current);
5127
+ setActivatorEvent(activatorEvent2);
5128
+ });
5129
+ },
5130
+ onMove(coordinates) {
5131
+ dispatch({
5132
+ type: Action.DragMove,
5133
+ coordinates
5134
+ });
5135
+ },
5136
+ onEnd: createHandler(Action.DragEnd),
5137
+ onCancel: createHandler(Action.DragCancel)
5138
+ });
5139
+ activeSensorRef.current = sensorInstance;
5140
+ function createHandler(type) {
5141
+ return async function handler() {
5142
+ const {
5143
+ active: active2,
5144
+ collisions: collisions2,
5145
+ over: over2,
5146
+ scrollAdjustedTranslate: scrollAdjustedTranslate2
5147
+ } = sensorContext.current;
5148
+ let event2 = null;
5149
+ if (active2 && scrollAdjustedTranslate2) {
5150
+ const {
5151
+ cancelDrop
5152
+ } = latestProps.current;
5153
+ event2 = {
5154
+ activatorEvent: activatorEvent2,
5155
+ active: active2,
5156
+ collisions: collisions2,
5157
+ delta: scrollAdjustedTranslate2,
5158
+ over: over2
5159
+ };
5160
+ if (type === Action.DragEnd && typeof cancelDrop === "function") {
5161
+ const shouldCancel = await Promise.resolve(cancelDrop(event2));
5162
+ if (shouldCancel) {
5163
+ type = Action.DragCancel;
5164
+ }
5165
+ }
5166
+ }
5167
+ activeRef.current = null;
5168
+ unstable_batchedUpdates(() => {
5169
+ dispatch({
5170
+ type
5171
+ });
5172
+ setStatus(Status.Uninitialized);
5173
+ setOver(null);
5174
+ setActiveSensor(null);
5175
+ setActivatorEvent(null);
5176
+ activeSensorRef.current = null;
5177
+ const eventName = type === Action.DragEnd ? "onDragEnd" : "onDragCancel";
5178
+ if (event2) {
5179
+ const handler2 = latestProps.current[eventName];
5180
+ handler2 == null ? void 0 : handler2(event2);
5181
+ dispatchMonitorEvent({
5182
+ type: eventName,
5183
+ event: event2
5184
+ });
5185
+ }
5186
+ });
5187
+ };
5188
+ }
5189
+ },
5190
+ // eslint-disable-next-line react-hooks/exhaustive-deps
5191
+ [draggableNodes]
5192
+ );
5193
+ const bindActivatorToSensorInstantiator = useCallback((handler, sensor) => {
5194
+ return (event, active2) => {
5195
+ const nativeEvent = event.nativeEvent;
5196
+ const activeDraggableNode = draggableNodes.get(active2);
5197
+ if (
5198
+ // Another sensor is already instantiating
5199
+ activeRef.current !== null || // No active draggable
5200
+ !activeDraggableNode || // Event has already been captured
5201
+ nativeEvent.dndKit || nativeEvent.defaultPrevented
5202
+ ) {
5203
+ return;
5204
+ }
5205
+ const activationContext = {
5206
+ active: activeDraggableNode
5207
+ };
5208
+ const shouldActivate = handler(event, sensor.options, activationContext);
5209
+ if (shouldActivate === true) {
5210
+ nativeEvent.dndKit = {
5211
+ capturedBy: sensor.sensor
5212
+ };
5213
+ activeRef.current = active2;
5214
+ instantiateSensor(event, sensor);
5215
+ }
5216
+ };
5217
+ }, [draggableNodes, instantiateSensor]);
5218
+ const activators = useCombineActivators(sensors, bindActivatorToSensorInstantiator);
5219
+ useSensorSetup(sensors);
5220
+ useIsomorphicLayoutEffect(() => {
5221
+ if (activeNodeRect && status === Status.Initializing) {
5222
+ setStatus(Status.Initialized);
5223
+ }
5224
+ }, [activeNodeRect, status]);
5225
+ useEffect(
5226
+ () => {
5227
+ const {
5228
+ onDragMove
5229
+ } = latestProps.current;
5230
+ const {
5231
+ active: active2,
5232
+ activatorEvent: activatorEvent2,
5233
+ collisions: collisions2,
5234
+ over: over2
5235
+ } = sensorContext.current;
5236
+ if (!active2 || !activatorEvent2) {
5237
+ return;
5238
+ }
5239
+ const event = {
5240
+ active: active2,
5241
+ activatorEvent: activatorEvent2,
5242
+ collisions: collisions2,
5243
+ delta: {
5244
+ x: scrollAdjustedTranslate.x,
5245
+ y: scrollAdjustedTranslate.y
5246
+ },
5247
+ over: over2
5248
+ };
5249
+ unstable_batchedUpdates(() => {
5250
+ onDragMove == null ? void 0 : onDragMove(event);
5251
+ dispatchMonitorEvent({
5252
+ type: "onDragMove",
5253
+ event
5254
+ });
5255
+ });
5256
+ },
5257
+ // eslint-disable-next-line react-hooks/exhaustive-deps
5258
+ [scrollAdjustedTranslate.x, scrollAdjustedTranslate.y]
5259
+ );
5260
+ useEffect(
5261
+ () => {
5262
+ const {
5263
+ active: active2,
5264
+ activatorEvent: activatorEvent2,
5265
+ collisions: collisions2,
5266
+ droppableContainers: droppableContainers2,
5267
+ scrollAdjustedTranslate: scrollAdjustedTranslate2
5268
+ } = sensorContext.current;
5269
+ if (!active2 || activeRef.current == null || !activatorEvent2 || !scrollAdjustedTranslate2) {
5270
+ return;
5271
+ }
5272
+ const {
5273
+ onDragOver
5274
+ } = latestProps.current;
5275
+ const overContainer = droppableContainers2.get(overId);
5276
+ const over2 = overContainer && overContainer.rect.current ? {
5277
+ id: overContainer.id,
5278
+ rect: overContainer.rect.current,
5279
+ data: overContainer.data,
5280
+ disabled: overContainer.disabled
5281
+ } : null;
5282
+ const event = {
5283
+ active: active2,
5284
+ activatorEvent: activatorEvent2,
5285
+ collisions: collisions2,
5286
+ delta: {
5287
+ x: scrollAdjustedTranslate2.x,
5288
+ y: scrollAdjustedTranslate2.y
5289
+ },
5290
+ over: over2
5291
+ };
5292
+ unstable_batchedUpdates(() => {
5293
+ setOver(over2);
5294
+ onDragOver == null ? void 0 : onDragOver(event);
5295
+ dispatchMonitorEvent({
5296
+ type: "onDragOver",
5297
+ event
5298
+ });
5299
+ });
5300
+ },
5301
+ // eslint-disable-next-line react-hooks/exhaustive-deps
5302
+ [overId]
5303
+ );
5304
+ useIsomorphicLayoutEffect(() => {
5305
+ sensorContext.current = {
5306
+ activatorEvent,
5307
+ active,
5308
+ activeNode,
5309
+ collisionRect,
5310
+ collisions,
5311
+ droppableRects,
5312
+ draggableNodes,
5313
+ draggingNode,
5314
+ draggingNodeRect,
5315
+ droppableContainers,
5316
+ over,
5317
+ scrollableAncestors,
5318
+ scrollAdjustedTranslate
5319
+ };
5320
+ activeRects.current = {
5321
+ initial: draggingNodeRect,
5322
+ translated: collisionRect
5323
+ };
5324
+ }, [active, activeNode, collisions, collisionRect, draggableNodes, draggingNode, draggingNodeRect, droppableRects, droppableContainers, over, scrollableAncestors, scrollAdjustedTranslate]);
5325
+ useAutoScroller({
5326
+ ...autoScrollOptions,
5327
+ delta: translate,
5328
+ draggingRect: collisionRect,
5329
+ pointerCoordinates,
5330
+ scrollableAncestors,
5331
+ scrollableAncestorRects
5332
+ });
5333
+ const publicContext = useMemo(() => {
5334
+ const context = {
5335
+ active,
5336
+ activeNode,
5337
+ activeNodeRect,
5338
+ activatorEvent,
5339
+ collisions,
5340
+ containerNodeRect,
5341
+ dragOverlay,
5342
+ draggableNodes,
5343
+ droppableContainers,
5344
+ droppableRects,
5345
+ over,
5346
+ measureDroppableContainers,
5347
+ scrollableAncestors,
5348
+ scrollableAncestorRects,
5349
+ measuringConfiguration,
5350
+ measuringScheduled,
5351
+ windowRect
5352
+ };
5353
+ return context;
5354
+ }, [active, activeNode, activeNodeRect, activatorEvent, collisions, containerNodeRect, dragOverlay, draggableNodes, droppableContainers, droppableRects, over, measureDroppableContainers, scrollableAncestors, scrollableAncestorRects, measuringConfiguration, measuringScheduled, windowRect]);
5355
+ const internalContext = useMemo(() => {
5356
+ const context = {
5357
+ activatorEvent,
5358
+ activators,
5359
+ active,
5360
+ activeNodeRect,
5361
+ ariaDescribedById: {
5362
+ draggable: draggableDescribedById
5363
+ },
5364
+ dispatch,
5365
+ draggableNodes,
5366
+ over,
5367
+ measureDroppableContainers
5368
+ };
5369
+ return context;
5370
+ }, [activatorEvent, activators, active, activeNodeRect, dispatch, draggableDescribedById, draggableNodes, over, measureDroppableContainers]);
5371
+ return React3.createElement(DndMonitorContext.Provider, {
5372
+ value: registerMonitorListener
5373
+ }, React3.createElement(InternalContext.Provider, {
5374
+ value: internalContext
5375
+ }, React3.createElement(PublicContext.Provider, {
5376
+ value: publicContext
5377
+ }, React3.createElement(ActiveDraggableContext.Provider, {
5378
+ value: transform
5379
+ }, children)), React3.createElement(RestoreFocus, {
5380
+ disabled: (accessibility == null ? void 0 : accessibility.restoreFocus) === false
5381
+ })), React3.createElement(Accessibility, {
5382
+ ...accessibility,
5383
+ hiddenTextDescribedById: draggableDescribedById
5384
+ }));
5385
+ function getAutoScrollerOptions() {
5386
+ const activeSensorDisablesAutoscroll = (activeSensor == null ? void 0 : activeSensor.autoScrollEnabled) === false;
5387
+ const autoScrollGloballyDisabled = typeof autoScroll === "object" ? autoScroll.enabled === false : autoScroll === false;
5388
+ const enabled = isInitialized && !activeSensorDisablesAutoscroll && !autoScrollGloballyDisabled;
5389
+ if (typeof autoScroll === "object") {
5390
+ return {
5391
+ ...autoScroll,
5392
+ enabled
5393
+ };
5394
+ }
5395
+ return {
5396
+ enabled
5397
+ };
5398
+ }
5399
+ });
5400
+ var NullContext = /* @__PURE__ */ createContext(null);
5401
+ var defaultRole = "button";
5402
+ var ID_PREFIX = "Draggable";
5403
+ function useDraggable(_ref) {
5404
+ let {
5405
+ id,
5406
+ data,
5407
+ disabled = false,
5408
+ attributes
5409
+ } = _ref;
5410
+ const key = useUniqueId(ID_PREFIX);
5411
+ const {
5412
+ activators,
5413
+ activatorEvent,
5414
+ active,
5415
+ activeNodeRect,
5416
+ ariaDescribedById,
5417
+ draggableNodes,
5418
+ over
5419
+ } = useContext(InternalContext);
5420
+ const {
5421
+ role = defaultRole,
5422
+ roleDescription = "draggable",
5423
+ tabIndex = 0
5424
+ } = attributes != null ? attributes : {};
5425
+ const isDragging = (active == null ? void 0 : active.id) === id;
5426
+ const transform = useContext(isDragging ? ActiveDraggableContext : NullContext);
5427
+ const [node, setNodeRef] = useNodeRef();
5428
+ const [activatorNode, setActivatorNodeRef] = useNodeRef();
5429
+ const listeners = useSyntheticListeners(activators, id);
5430
+ const dataRef = useLatestValue(data);
5431
+ useIsomorphicLayoutEffect(
5432
+ () => {
5433
+ draggableNodes.set(id, {
5434
+ id,
5435
+ key,
5436
+ node,
5437
+ activatorNode,
5438
+ data: dataRef
5439
+ });
5440
+ return () => {
5441
+ const node2 = draggableNodes.get(id);
5442
+ if (node2 && node2.key === key) {
5443
+ draggableNodes.delete(id);
5444
+ }
5445
+ };
5446
+ },
5447
+ // eslint-disable-next-line react-hooks/exhaustive-deps
5448
+ [draggableNodes, id]
5449
+ );
5450
+ const memoizedAttributes = useMemo(() => ({
5451
+ role,
5452
+ tabIndex,
5453
+ "aria-disabled": disabled,
5454
+ "aria-pressed": isDragging && role === defaultRole ? true : void 0,
5455
+ "aria-roledescription": roleDescription,
5456
+ "aria-describedby": ariaDescribedById.draggable
5457
+ }), [disabled, role, tabIndex, isDragging, roleDescription, ariaDescribedById.draggable]);
5458
+ return {
5459
+ active,
5460
+ activatorEvent,
5461
+ activeNodeRect,
5462
+ attributes: memoizedAttributes,
5463
+ isDragging,
5464
+ listeners: disabled ? void 0 : listeners,
5465
+ node,
5466
+ over,
5467
+ setNodeRef,
5468
+ setActivatorNodeRef,
5469
+ transform
5470
+ };
5471
+ }
5472
+ function useDndContext() {
5473
+ return useContext(PublicContext);
5474
+ }
5475
+ var ID_PREFIX$1 = "Droppable";
5476
+ var defaultResizeObserverConfig = {
5477
+ timeout: 25
5478
+ };
5479
+ function useDroppable(_ref) {
5480
+ let {
5481
+ data,
5482
+ disabled = false,
5483
+ id,
5484
+ resizeObserverConfig
5485
+ } = _ref;
5486
+ const key = useUniqueId(ID_PREFIX$1);
5487
+ const {
5488
+ active,
5489
+ dispatch,
5490
+ over,
5491
+ measureDroppableContainers
5492
+ } = useContext(InternalContext);
5493
+ const previous = useRef({
5494
+ disabled
5495
+ });
5496
+ const resizeObserverConnected = useRef(false);
5497
+ const rect = useRef(null);
5498
+ const callbackId = useRef(null);
5499
+ const {
5500
+ disabled: resizeObserverDisabled,
5501
+ updateMeasurementsFor,
5502
+ timeout: resizeObserverTimeout
5503
+ } = {
5504
+ ...defaultResizeObserverConfig,
5505
+ ...resizeObserverConfig
5506
+ };
5507
+ const ids2 = useLatestValue(updateMeasurementsFor != null ? updateMeasurementsFor : id);
5508
+ const handleResize = useCallback(
5509
+ () => {
5510
+ if (!resizeObserverConnected.current) {
5511
+ resizeObserverConnected.current = true;
5512
+ return;
5513
+ }
5514
+ if (callbackId.current != null) {
5515
+ clearTimeout(callbackId.current);
5516
+ }
5517
+ callbackId.current = setTimeout(() => {
5518
+ measureDroppableContainers(Array.isArray(ids2.current) ? ids2.current : [ids2.current]);
5519
+ callbackId.current = null;
5520
+ }, resizeObserverTimeout);
5521
+ },
5522
+ //eslint-disable-next-line react-hooks/exhaustive-deps
5523
+ [resizeObserverTimeout]
5524
+ );
5525
+ const resizeObserver = useResizeObserver({
5526
+ callback: handleResize,
5527
+ disabled: resizeObserverDisabled || !active
5528
+ });
5529
+ const handleNodeChange = useCallback((newElement, previousElement) => {
5530
+ if (!resizeObserver) {
5531
+ return;
5532
+ }
5533
+ if (previousElement) {
5534
+ resizeObserver.unobserve(previousElement);
5535
+ resizeObserverConnected.current = false;
5536
+ }
5537
+ if (newElement) {
5538
+ resizeObserver.observe(newElement);
5539
+ }
5540
+ }, [resizeObserver]);
5541
+ const [nodeRef, setNodeRef] = useNodeRef(handleNodeChange);
5542
+ const dataRef = useLatestValue(data);
5543
+ useEffect(() => {
5544
+ if (!resizeObserver || !nodeRef.current) {
5545
+ return;
5546
+ }
5547
+ resizeObserver.disconnect();
5548
+ resizeObserverConnected.current = false;
5549
+ resizeObserver.observe(nodeRef.current);
5550
+ }, [nodeRef, resizeObserver]);
5551
+ useEffect(
5552
+ () => {
5553
+ dispatch({
5554
+ type: Action.RegisterDroppable,
5555
+ element: {
5556
+ id,
5557
+ key,
5558
+ disabled,
5559
+ node: nodeRef,
5560
+ rect,
5561
+ data: dataRef
5562
+ }
5563
+ });
5564
+ return () => dispatch({
5565
+ type: Action.UnregisterDroppable,
5566
+ key,
5567
+ id
5568
+ });
5569
+ },
5570
+ // eslint-disable-next-line react-hooks/exhaustive-deps
5571
+ [id]
5572
+ );
5573
+ useEffect(() => {
5574
+ if (disabled !== previous.current.disabled) {
5575
+ dispatch({
5576
+ type: Action.SetDroppableDisabled,
5577
+ id,
5578
+ key,
5579
+ disabled
5580
+ });
5581
+ previous.current.disabled = disabled;
5582
+ }
5583
+ }, [id, key, disabled, dispatch]);
5584
+ return {
5585
+ active,
5586
+ rect,
5587
+ isOver: (over == null ? void 0 : over.id) === id,
5588
+ node: nodeRef,
5589
+ over,
5590
+ setNodeRef
5591
+ };
5592
+ }
5593
+ function arrayMove(array, from, to) {
5594
+ const newArray = array.slice();
5595
+ newArray.splice(to < 0 ? newArray.length + to : to, 0, newArray.splice(from, 1)[0]);
5596
+ return newArray;
5597
+ }
5598
+ function getSortedRects(items, rects) {
5599
+ return items.reduce((accumulator, id, index) => {
5600
+ const rect = rects.get(id);
5601
+ if (rect) {
5602
+ accumulator[index] = rect;
5603
+ }
5604
+ return accumulator;
5605
+ }, Array(items.length));
5606
+ }
5607
+ function isValidIndex(index) {
5608
+ return index !== null && index >= 0;
5609
+ }
5610
+ function itemsEqual(a, b) {
5611
+ if (a === b) {
5612
+ return true;
5613
+ }
5614
+ if (a.length !== b.length) {
5615
+ return false;
5616
+ }
5617
+ for (let i = 0; i < a.length; i++) {
5618
+ if (a[i] !== b[i]) {
5619
+ return false;
5620
+ }
5621
+ }
5622
+ return true;
5623
+ }
5624
+ function normalizeDisabled(disabled) {
5625
+ if (typeof disabled === "boolean") {
5626
+ return {
5627
+ draggable: disabled,
5628
+ droppable: disabled
5629
+ };
5630
+ }
5631
+ return disabled;
5632
+ }
5633
+ var rectSortingStrategy = (_ref) => {
5634
+ let {
5635
+ rects,
5636
+ activeIndex,
5637
+ overIndex,
5638
+ index
5639
+ } = _ref;
5640
+ const newRects = arrayMove(rects, overIndex, activeIndex);
5641
+ const oldRect = rects[index];
5642
+ const newRect = newRects[index];
5643
+ if (!newRect || !oldRect) {
5644
+ return null;
5645
+ }
5646
+ return {
5647
+ x: newRect.left - oldRect.left,
5648
+ y: newRect.top - oldRect.top,
5649
+ scaleX: newRect.width / oldRect.width,
5650
+ scaleY: newRect.height / oldRect.height
5651
+ };
5652
+ };
5653
+ var defaultScale$1 = {
5654
+ scaleX: 1,
5655
+ scaleY: 1
5656
+ };
5657
+ var verticalListSortingStrategy = (_ref) => {
5658
+ var _rects$activeIndex;
5659
+ let {
5660
+ activeIndex,
5661
+ activeNodeRect: fallbackActiveRect,
5662
+ index,
5663
+ rects,
5664
+ overIndex
5665
+ } = _ref;
5666
+ const activeNodeRect = (_rects$activeIndex = rects[activeIndex]) != null ? _rects$activeIndex : fallbackActiveRect;
5667
+ if (!activeNodeRect) {
5668
+ return null;
5669
+ }
5670
+ if (index === activeIndex) {
5671
+ const overIndexRect = rects[overIndex];
5672
+ if (!overIndexRect) {
5673
+ return null;
5674
+ }
5675
+ return {
5676
+ x: 0,
5677
+ y: activeIndex < overIndex ? overIndexRect.top + overIndexRect.height - (activeNodeRect.top + activeNodeRect.height) : overIndexRect.top - activeNodeRect.top,
5678
+ ...defaultScale$1
5679
+ };
5680
+ }
5681
+ const itemGap = getItemGap$1(rects, index, activeIndex);
5682
+ if (index > activeIndex && index <= overIndex) {
5683
+ return {
5684
+ x: 0,
5685
+ y: -activeNodeRect.height - itemGap,
5686
+ ...defaultScale$1
5687
+ };
5688
+ }
5689
+ if (index < activeIndex && index >= overIndex) {
5690
+ return {
5691
+ x: 0,
5692
+ y: activeNodeRect.height + itemGap,
5693
+ ...defaultScale$1
5694
+ };
5695
+ }
5696
+ return {
5697
+ x: 0,
5698
+ y: 0,
5699
+ ...defaultScale$1
5700
+ };
5701
+ };
5702
+ function getItemGap$1(clientRects, index, activeIndex) {
5703
+ const currentRect = clientRects[index];
5704
+ const previousRect = clientRects[index - 1];
5705
+ const nextRect = clientRects[index + 1];
5706
+ if (!currentRect) {
5707
+ return 0;
5708
+ }
5709
+ if (activeIndex < index) {
5710
+ return previousRect ? currentRect.top - (previousRect.top + previousRect.height) : nextRect ? nextRect.top - (currentRect.top + currentRect.height) : 0;
5711
+ }
5712
+ return nextRect ? nextRect.top - (currentRect.top + currentRect.height) : previousRect ? currentRect.top - (previousRect.top + previousRect.height) : 0;
5713
+ }
5714
+ var ID_PREFIX2 = "Sortable";
5715
+ var Context = /* @__PURE__ */ React3.createContext({
5716
+ activeIndex: -1,
5717
+ containerId: ID_PREFIX2,
5718
+ disableTransforms: false,
5719
+ items: [],
5720
+ overIndex: -1,
5721
+ useDragOverlay: false,
5722
+ sortedRects: [],
5723
+ strategy: rectSortingStrategy,
5724
+ disabled: {
5725
+ draggable: false,
5726
+ droppable: false
5727
+ }
5728
+ });
5729
+ function SortableContext(_ref) {
5730
+ let {
5731
+ children,
5732
+ id,
5733
+ items: userDefinedItems,
5734
+ strategy = rectSortingStrategy,
5735
+ disabled: disabledProp = false
5736
+ } = _ref;
5737
+ const {
5738
+ active,
5739
+ dragOverlay,
5740
+ droppableRects,
5741
+ over,
5742
+ measureDroppableContainers
5743
+ } = useDndContext();
5744
+ const containerId = useUniqueId(ID_PREFIX2, id);
5745
+ const useDragOverlay = Boolean(dragOverlay.rect !== null);
5746
+ const items = useMemo(() => userDefinedItems.map((item) => typeof item === "object" && "id" in item ? item.id : item), [userDefinedItems]);
5747
+ const isDragging = active != null;
5748
+ const activeIndex = active ? items.indexOf(active.id) : -1;
5749
+ const overIndex = over ? items.indexOf(over.id) : -1;
5750
+ const previousItemsRef = useRef(items);
5751
+ const itemsHaveChanged = !itemsEqual(items, previousItemsRef.current);
5752
+ const disableTransforms = overIndex !== -1 && activeIndex === -1 || itemsHaveChanged;
5753
+ const disabled = normalizeDisabled(disabledProp);
5754
+ useIsomorphicLayoutEffect(() => {
5755
+ if (itemsHaveChanged && isDragging) {
5756
+ measureDroppableContainers(items);
5757
+ }
5758
+ }, [itemsHaveChanged, items, isDragging, measureDroppableContainers]);
5759
+ useEffect(() => {
5760
+ previousItemsRef.current = items;
5761
+ }, [items]);
5762
+ const contextValue = useMemo(
5763
+ () => ({
5764
+ activeIndex,
5765
+ containerId,
5766
+ disabled,
5767
+ disableTransforms,
5768
+ items,
5769
+ overIndex,
5770
+ useDragOverlay,
5771
+ sortedRects: getSortedRects(items, droppableRects),
5772
+ strategy
5773
+ }),
5774
+ // eslint-disable-next-line react-hooks/exhaustive-deps
5775
+ [activeIndex, containerId, disabled.draggable, disabled.droppable, disableTransforms, items, overIndex, droppableRects, useDragOverlay, strategy]
5776
+ );
5777
+ return React3.createElement(Context.Provider, {
5778
+ value: contextValue
5779
+ }, children);
5780
+ }
5781
+ var defaultNewIndexGetter = (_ref) => {
5782
+ let {
5783
+ id,
5784
+ items,
5785
+ activeIndex,
5786
+ overIndex
5787
+ } = _ref;
5788
+ return arrayMove(items, activeIndex, overIndex).indexOf(id);
5789
+ };
5790
+ var defaultAnimateLayoutChanges = (_ref2) => {
5791
+ let {
5792
+ containerId,
5793
+ isSorting,
5794
+ wasDragging,
5795
+ index,
5796
+ items,
5797
+ newIndex,
5798
+ previousItems,
5799
+ previousContainerId,
5800
+ transition
5801
+ } = _ref2;
5802
+ if (!transition || !wasDragging) {
5803
+ return false;
5804
+ }
5805
+ if (previousItems !== items && index === newIndex) {
5806
+ return false;
5807
+ }
5808
+ if (isSorting) {
5809
+ return true;
5810
+ }
5811
+ return newIndex !== index && containerId === previousContainerId;
5812
+ };
5813
+ var defaultTransition = {
5814
+ duration: 200,
5815
+ easing: "ease"
5816
+ };
5817
+ var transitionProperty = "transform";
5818
+ var disabledTransition = /* @__PURE__ */ CSS.Transition.toString({
5819
+ property: transitionProperty,
5820
+ duration: 0,
5821
+ easing: "linear"
5822
+ });
5823
+ var defaultAttributes = {
5824
+ roleDescription: "sortable"
5825
+ };
5826
+ function useDerivedTransform(_ref) {
5827
+ let {
5828
+ disabled,
5829
+ index,
5830
+ node,
5831
+ rect
5832
+ } = _ref;
5833
+ const [derivedTransform, setDerivedtransform] = useState(null);
5834
+ const previousIndex = useRef(index);
5835
+ useIsomorphicLayoutEffect(() => {
5836
+ if (!disabled && index !== previousIndex.current && node.current) {
5837
+ const initial = rect.current;
5838
+ if (initial) {
5839
+ const current = getClientRect(node.current, {
5840
+ ignoreTransform: true
5841
+ });
5842
+ const delta = {
5843
+ x: initial.left - current.left,
5844
+ y: initial.top - current.top,
5845
+ scaleX: initial.width / current.width,
5846
+ scaleY: initial.height / current.height
5847
+ };
5848
+ if (delta.x || delta.y) {
5849
+ setDerivedtransform(delta);
5850
+ }
5851
+ }
5852
+ }
5853
+ if (index !== previousIndex.current) {
5854
+ previousIndex.current = index;
5855
+ }
5856
+ }, [disabled, index, node, rect]);
5857
+ useEffect(() => {
5858
+ if (derivedTransform) {
5859
+ setDerivedtransform(null);
5860
+ }
5861
+ }, [derivedTransform]);
5862
+ return derivedTransform;
5863
+ }
5864
+ function useSortable(_ref) {
5865
+ let {
5866
+ animateLayoutChanges = defaultAnimateLayoutChanges,
5867
+ attributes: userDefinedAttributes,
5868
+ disabled: localDisabled,
5869
+ data: customData,
5870
+ getNewIndex = defaultNewIndexGetter,
5871
+ id,
5872
+ strategy: localStrategy,
5873
+ resizeObserverConfig,
5874
+ transition = defaultTransition
5875
+ } = _ref;
5876
+ const {
5877
+ items,
5878
+ containerId,
5879
+ activeIndex,
5880
+ disabled: globalDisabled,
5881
+ disableTransforms,
5882
+ sortedRects,
5883
+ overIndex,
5884
+ useDragOverlay,
5885
+ strategy: globalStrategy
5886
+ } = useContext(Context);
5887
+ const disabled = normalizeLocalDisabled(localDisabled, globalDisabled);
5888
+ const index = items.indexOf(id);
5889
+ const data = useMemo(() => ({
5890
+ sortable: {
5891
+ containerId,
5892
+ index,
5893
+ items
5894
+ },
5895
+ ...customData
5896
+ }), [containerId, customData, index, items]);
5897
+ const itemsAfterCurrentSortable = useMemo(() => items.slice(items.indexOf(id)), [items, id]);
5898
+ const {
5899
+ rect,
5900
+ node,
5901
+ isOver,
5902
+ setNodeRef: setDroppableNodeRef
5903
+ } = useDroppable({
5904
+ id,
5905
+ data,
5906
+ disabled: disabled.droppable,
5907
+ resizeObserverConfig: {
5908
+ updateMeasurementsFor: itemsAfterCurrentSortable,
5909
+ ...resizeObserverConfig
5910
+ }
5911
+ });
5912
+ const {
5913
+ active,
5914
+ activatorEvent,
5915
+ activeNodeRect,
5916
+ attributes,
5917
+ setNodeRef: setDraggableNodeRef,
5918
+ listeners,
5919
+ isDragging,
5920
+ over,
5921
+ setActivatorNodeRef,
5922
+ transform
5923
+ } = useDraggable({
5924
+ id,
5925
+ data,
5926
+ attributes: {
5927
+ ...defaultAttributes,
5928
+ ...userDefinedAttributes
5929
+ },
5930
+ disabled: disabled.draggable
5931
+ });
5932
+ const setNodeRef = useCombinedRefs(setDroppableNodeRef, setDraggableNodeRef);
5933
+ const isSorting = Boolean(active);
5934
+ const displaceItem = isSorting && !disableTransforms && isValidIndex(activeIndex) && isValidIndex(overIndex);
5935
+ const shouldDisplaceDragSource = !useDragOverlay && isDragging;
5936
+ const dragSourceDisplacement = shouldDisplaceDragSource && displaceItem ? transform : null;
5937
+ const strategy = localStrategy != null ? localStrategy : globalStrategy;
5938
+ const finalTransform = displaceItem ? dragSourceDisplacement != null ? dragSourceDisplacement : strategy({
5939
+ rects: sortedRects,
5940
+ activeNodeRect,
5941
+ activeIndex,
5942
+ overIndex,
5943
+ index
5944
+ }) : null;
5945
+ const newIndex = isValidIndex(activeIndex) && isValidIndex(overIndex) ? getNewIndex({
5946
+ id,
5947
+ items,
5948
+ activeIndex,
5949
+ overIndex
5950
+ }) : index;
5951
+ const activeId = active == null ? void 0 : active.id;
5952
+ const previous = useRef({
5953
+ activeId,
5954
+ items,
5955
+ newIndex,
5956
+ containerId
5957
+ });
5958
+ const itemsHaveChanged = items !== previous.current.items;
5959
+ const shouldAnimateLayoutChanges = animateLayoutChanges({
5960
+ active,
5961
+ containerId,
5962
+ isDragging,
5963
+ isSorting,
5964
+ id,
5965
+ index,
5966
+ items,
5967
+ newIndex: previous.current.newIndex,
5968
+ previousItems: previous.current.items,
5969
+ previousContainerId: previous.current.containerId,
5970
+ transition,
5971
+ wasDragging: previous.current.activeId != null
5972
+ });
5973
+ const derivedTransform = useDerivedTransform({
5974
+ disabled: !shouldAnimateLayoutChanges,
5975
+ index,
5976
+ node,
5977
+ rect
5978
+ });
5979
+ useEffect(() => {
5980
+ if (isSorting && previous.current.newIndex !== newIndex) {
5981
+ previous.current.newIndex = newIndex;
5982
+ }
5983
+ if (containerId !== previous.current.containerId) {
5984
+ previous.current.containerId = containerId;
5985
+ }
5986
+ if (items !== previous.current.items) {
5987
+ previous.current.items = items;
5988
+ }
5989
+ }, [isSorting, newIndex, containerId, items]);
5990
+ useEffect(() => {
5991
+ if (activeId === previous.current.activeId) {
5992
+ return;
5993
+ }
5994
+ if (activeId != null && previous.current.activeId == null) {
5995
+ previous.current.activeId = activeId;
5996
+ return;
5997
+ }
5998
+ const timeoutId = setTimeout(() => {
5999
+ previous.current.activeId = activeId;
6000
+ }, 50);
6001
+ return () => clearTimeout(timeoutId);
6002
+ }, [activeId]);
6003
+ return {
6004
+ active,
6005
+ activeIndex,
6006
+ attributes,
6007
+ data,
6008
+ rect,
6009
+ index,
6010
+ newIndex,
6011
+ items,
6012
+ isOver,
6013
+ isSorting,
6014
+ isDragging,
6015
+ listeners,
6016
+ node,
6017
+ overIndex,
6018
+ over,
6019
+ setNodeRef,
6020
+ setActivatorNodeRef,
6021
+ setDroppableNodeRef,
6022
+ setDraggableNodeRef,
6023
+ transform: derivedTransform != null ? derivedTransform : finalTransform,
6024
+ transition: getTransition()
6025
+ };
6026
+ function getTransition() {
6027
+ if (
6028
+ // Temporarily disable transitions for a single frame to set up derived transforms
6029
+ derivedTransform || // Or to prevent items jumping to back to their "new" position when items change
6030
+ itemsHaveChanged && previous.current.newIndex === index
6031
+ ) {
6032
+ return disabledTransition;
6033
+ }
6034
+ if (shouldDisplaceDragSource && !isKeyboardEvent(activatorEvent) || !transition) {
6035
+ return void 0;
6036
+ }
6037
+ if (isSorting || shouldAnimateLayoutChanges) {
6038
+ return CSS.Transition.toString({
6039
+ ...transition,
6040
+ property: transitionProperty
6041
+ });
6042
+ }
6043
+ return void 0;
6044
+ }
6045
+ }
6046
+ function normalizeLocalDisabled(localDisabled, globalDisabled) {
6047
+ var _localDisabled$dragga, _localDisabled$droppa;
6048
+ if (typeof localDisabled === "boolean") {
6049
+ return {
6050
+ draggable: localDisabled,
6051
+ // Backwards compatibility
6052
+ droppable: false
6053
+ };
6054
+ }
6055
+ return {
6056
+ draggable: (_localDisabled$dragga = localDisabled == null ? void 0 : localDisabled.draggable) != null ? _localDisabled$dragga : globalDisabled.draggable,
6057
+ droppable: (_localDisabled$droppa = localDisabled == null ? void 0 : localDisabled.droppable) != null ? _localDisabled$droppa : globalDisabled.droppable
6058
+ };
6059
+ }
6060
+ function hasSortableData(entry) {
6061
+ if (!entry) {
6062
+ return false;
6063
+ }
6064
+ const data = entry.data.current;
6065
+ if (data && "sortable" in data && typeof data.sortable === "object" && "containerId" in data.sortable && "items" in data.sortable && "index" in data.sortable) {
6066
+ return true;
6067
+ }
6068
+ return false;
6069
+ }
6070
+ var directions = [KeyboardCode.Down, KeyboardCode.Right, KeyboardCode.Up, KeyboardCode.Left];
6071
+ var sortableKeyboardCoordinates = (event, _ref) => {
6072
+ let {
6073
+ context: {
6074
+ active,
6075
+ collisionRect,
6076
+ droppableRects,
6077
+ droppableContainers,
6078
+ over,
6079
+ scrollableAncestors
6080
+ }
6081
+ } = _ref;
6082
+ if (directions.includes(event.code)) {
6083
+ event.preventDefault();
6084
+ if (!active || !collisionRect) {
6085
+ return;
6086
+ }
6087
+ const filteredContainers = [];
6088
+ droppableContainers.getEnabled().forEach((entry) => {
6089
+ if (!entry || entry != null && entry.disabled) {
6090
+ return;
6091
+ }
6092
+ const rect = droppableRects.get(entry.id);
6093
+ if (!rect) {
6094
+ return;
6095
+ }
6096
+ switch (event.code) {
6097
+ case KeyboardCode.Down:
6098
+ if (collisionRect.top < rect.top) {
6099
+ filteredContainers.push(entry);
6100
+ }
6101
+ break;
6102
+ case KeyboardCode.Up:
6103
+ if (collisionRect.top > rect.top) {
6104
+ filteredContainers.push(entry);
6105
+ }
6106
+ break;
6107
+ case KeyboardCode.Left:
6108
+ if (collisionRect.left > rect.left) {
6109
+ filteredContainers.push(entry);
6110
+ }
6111
+ break;
6112
+ case KeyboardCode.Right:
6113
+ if (collisionRect.left < rect.left) {
6114
+ filteredContainers.push(entry);
6115
+ }
6116
+ break;
6117
+ }
6118
+ });
6119
+ const collisions = closestCorners({
6120
+ collisionRect,
6121
+ droppableRects,
6122
+ droppableContainers: filteredContainers});
6123
+ let closestId = getFirstCollision(collisions, "id");
6124
+ if (closestId === (over == null ? void 0 : over.id) && collisions.length > 1) {
6125
+ closestId = collisions[1].id;
6126
+ }
6127
+ if (closestId != null) {
6128
+ const activeDroppable = droppableContainers.get(active.id);
6129
+ const newDroppable = droppableContainers.get(closestId);
6130
+ const newRect = newDroppable ? droppableRects.get(newDroppable.id) : null;
6131
+ const newNode = newDroppable == null ? void 0 : newDroppable.node.current;
6132
+ if (newNode && newRect && activeDroppable && newDroppable) {
6133
+ const newScrollAncestors = getScrollableAncestors(newNode);
6134
+ const hasDifferentScrollAncestors = newScrollAncestors.some((element, index) => scrollableAncestors[index] !== element);
6135
+ const hasSameContainer = isSameContainer(activeDroppable, newDroppable);
6136
+ const isAfterActive = isAfter(activeDroppable, newDroppable);
6137
+ const offset = hasDifferentScrollAncestors || !hasSameContainer ? {
6138
+ x: 0,
6139
+ y: 0
6140
+ } : {
6141
+ x: isAfterActive ? collisionRect.width - newRect.width : 0,
6142
+ y: isAfterActive ? collisionRect.height - newRect.height : 0
6143
+ };
6144
+ const rectCoordinates = {
6145
+ x: newRect.left,
6146
+ y: newRect.top
6147
+ };
6148
+ const newCoordinates = offset.x && offset.y ? rectCoordinates : subtract(rectCoordinates, offset);
6149
+ return newCoordinates;
6150
+ }
6151
+ }
6152
+ }
6153
+ return void 0;
6154
+ };
6155
+ function isSameContainer(a, b) {
6156
+ if (!hasSortableData(a) || !hasSortableData(b)) {
6157
+ return false;
6158
+ }
6159
+ return a.data.current.sortable.containerId === b.data.current.sortable.containerId;
6160
+ }
6161
+ function isAfter(a, b) {
6162
+ if (!hasSortableData(a) || !hasSortableData(b)) {
6163
+ return false;
6164
+ }
6165
+ if (!isSameContainer(a, b)) {
6166
+ return false;
6167
+ }
6168
+ return a.data.current.sortable.index < b.data.current.sortable.index;
6169
+ }
6170
+ var MediaUploader = ({
6171
+ enableDragAndDrop = true,
6172
+ onlyDragAndDrop,
6173
+ text = null,
6174
+ addMedia
6175
+ }) => {
6176
+ const [dragArea, setDragArea] = useState(false);
6177
+ const { formatMessage } = useIntl();
6178
+ const handleDragOver = (event) => {
6179
+ event.stopPropagation();
6180
+ event.preventDefault();
6181
+ setDragArea(true);
6182
+ };
6183
+ const handleDragEnter = (event) => {
6184
+ event.stopPropagation();
6185
+ event.preventDefault();
6186
+ setDragArea(true);
6187
+ };
6188
+ const handleDragLeave = (event) => {
6189
+ event.stopPropagation();
6190
+ event.preventDefault();
6191
+ setDragArea(false);
6192
+ };
6193
+ const handleDrop = (event) => {
6194
+ event.stopPropagation();
6195
+ event.preventDefault();
6196
+ const { files } = event.dataTransfer;
6197
+ [...files].forEach((file) => {
6198
+ addMedia(file);
6199
+ });
6200
+ setDragArea(false);
6201
+ };
6202
+ const handleSelect = (event) => {
6203
+ event.stopPropagation();
6204
+ event.preventDefault();
6205
+ const { files } = event.target;
6206
+ [...files].forEach((file) => {
6207
+ addMedia(file);
6208
+ });
6209
+ setDragArea(false);
6210
+ };
6211
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
6212
+ !onlyDragAndDrop && /* @__PURE__ */ jsxs("div", { className: "text-text-muted", children: [
6213
+ /* @__PURE__ */ jsx("h3", { className: "text-lg text-text-primary", children: formatMessage({ id: "avatar", defaultMessage: "Avatar" }) }),
6214
+ /* @__PURE__ */ jsxs("div", { className: "my-4 flex items-center", children: [
6215
+ /* @__PURE__ */ jsx("span", { className: "inline-block h-12 w-12 overflow-hidden rounded-full ", children: /* @__PURE__ */ jsx(UserCircleIcon_default, { className: "h-full w-full text-text-secondary" }) }),
6216
+ /* @__PURE__ */ jsx(
6217
+ "button",
6218
+ {
6219
+ type: "button",
6220
+ className: "ml-5 rounded-md border border-slate-300 bg-white py-2 px-3 text-sm font-medium leading-4 text-slate-700 shadow-xs hover:bg-slate-50 focus:outline-hidden focus:ring-2 focus:ring-focus-ring focus:ring-offset-2",
6221
+ children: text || formatMessage({
6222
+ id: "upload",
6223
+ defaultMessage: "Upload"
6224
+ })
6225
+ }
6226
+ )
6227
+ ] })
6228
+ ] }),
6229
+ enableDragAndDrop && /* @__PURE__ */ jsx(
6230
+ "div",
6231
+ {
6232
+ id: "media_uploader",
6233
+ onDrop: handleDrop,
6234
+ onDragOver: handleDragOver,
6235
+ onDragEnter: handleDragEnter,
6236
+ onDragLeave: handleDragLeave,
6237
+ className: "text-slate-500 dark:text-slate-300",
6238
+ children: /* @__PURE__ */ jsxs("label", { htmlFor: "file-upload", className: "block", children: [
6239
+ /* @__PURE__ */ jsx(
6240
+ "div",
6241
+ {
6242
+ className: clsx_default(
6243
+ "flex justify-center rounded-md border-1 border-dashed border-slate-300 px-6 py-10 cursor-pointer hover:border-slate-400 dark:hover:border-slate-500 dark:border-slate-600 dark:text-slate-400 transition-colors",
6244
+ {
6245
+ "border-slate-950": dragArea
6246
+ }
6247
+ ),
6248
+ children: /* @__PURE__ */ jsxs("div", { className: "pl-5 space-y-1 text-center pointer-events-none", children: [
6249
+ /* @__PURE__ */ jsx(
6250
+ "svg",
6251
+ {
6252
+ className: "mx-auto h-12 w-12 text-slate-400 dark:text-slate-400",
6253
+ stroke: "currentColor",
6254
+ fill: "none",
6255
+ viewBox: "0 0 48 48",
6256
+ "aria-hidden": "true",
6257
+ children: /* @__PURE__ */ jsx(
6258
+ "path",
6259
+ {
6260
+ d: "M28 8H12a4 4 0 00-4 4v20m32-12v8m0 0v8a4 4 0 01-4 4H12a4 4 0 01-4-4v-4m32-4l-3.172-3.172a4 4 0 00-5.656 0L28 28M8 32l9.172-9.172a4 4 0 015.656 0L28 28m0 0l4 4m4-24h8m-4-4v8m-12 4h.02",
6261
+ strokeWidth: "2",
6262
+ strokeLinecap: "round",
6263
+ strokeLinejoin: "round"
6264
+ }
6265
+ )
6266
+ }
6267
+ ),
6268
+ /* @__PURE__ */ jsxs("div", { className: "flex text-sm text-text-secondary", children: [
6269
+ /* @__PURE__ */ jsx("span", { className: "px-1 font-medium text-slate-950 dark:text-slate-300", children: formatMessage({
6270
+ id: "upload_file",
6271
+ defaultMessage: "Upload a file"
6272
+ }) }),
6273
+ /* @__PURE__ */ jsx("p", { children: formatMessage({
6274
+ id: "or_drag_and_drop",
6275
+ defaultMessage: "or drag and drop"
6276
+ }) })
6277
+ ] }),
6278
+ /* @__PURE__ */ jsx("p", { className: "text-xs", children: "PNG, JPG, GIF up to 10MB" })
6279
+ ] })
6280
+ }
6281
+ ),
6282
+ /* @__PURE__ */ jsx(
6283
+ "input",
6284
+ {
6285
+ id: "file-upload",
6286
+ name: "file-upload",
6287
+ type: "file",
6288
+ multiple: true,
6289
+ className: "sr-only",
6290
+ onChange: handleSelect
6291
+ }
6292
+ )
6293
+ ] })
6294
+ }
6295
+ )
6296
+ ] });
6297
+ };
6298
+ var MediaUploader_default = MediaUploader;
6299
+ var useDisplayImageInModal = () => {
6300
+ const { setModal } = useModal_default();
6301
+ const { formatMessage } = useIntl();
6302
+ const displayImageInModal = ({ url, closeOnOutsideClick = true }) => {
6303
+ setModal(
6304
+ /* @__PURE__ */ jsx("div", { className: "flex h-96 w-96", children: /* @__PURE__ */ jsx(
6305
+ ImageWithFallback_default,
6306
+ {
6307
+ src: url,
6308
+ alt: formatMessage({
6309
+ id: "image-not-found",
6310
+ defaultMessage: "Image not found"
6311
+ }),
6312
+ className: "absolute top-0 left-0 -z-10 h-full w-full grow object-contain object-center",
6313
+ layout: "fill"
6314
+ }
6315
+ ) }),
6316
+ { closeOnOutsideClick }
6317
+ );
6318
+ };
6319
+ return {
6320
+ displayImageInModal
6321
+ };
6322
+ };
6323
+ var useDisplayImageInModal_default = useDisplayImageInModal;
6324
+ var MediaListItem = ({
6325
+ media,
6326
+ mediaText,
6327
+ onEdit,
6328
+ isEdit,
6329
+ onDelete,
6330
+ onUpdate,
6331
+ id
6332
+ }) => {
6333
+ const { formatMessage } = useIntl();
6334
+ const { displayImageInModal } = useDisplayImageInModal_default();
6335
+ const successMessage = formatMessage({
6336
+ id: "media_updated",
6337
+ defaultMessage: "Media updated"
6338
+ });
6339
+ const form = useForm_default({
6340
+ submit: onUpdate,
6341
+ successMessage,
6342
+ initialValues: {
6343
+ title: mediaText.title || "",
6344
+ subtitle: mediaText.subTitle || ""
6345
+ }
6346
+ });
6347
+ useEffect(() => {
6348
+ if (mediaText) form.api.setValues(mediaText);
6349
+ }, [mediaText]);
6350
+ const { attributes, listeners, setNodeRef, transform, transition } = useSortable({ id });
6351
+ const style = {
6352
+ transform: CSS.Transform.toString(transform),
6353
+ transition
6354
+ };
6355
+ return /* @__PURE__ */ jsxs(
6356
+ "li",
6357
+ {
6358
+ ref: setNodeRef,
6359
+ style,
6360
+ className: "flex flex-wrap gap-4 rounded-sm hover:cursor-pointer",
6361
+ children: [
6362
+ /* @__PURE__ */ jsxs("div", { className: "", children: [
6363
+ /* @__PURE__ */ jsx("a", { onClick: () => displayImageInModal({ url: media?.file?.url }), children: /* @__PURE__ */ jsx(
6364
+ ImageWithFallback_default,
6365
+ {
6366
+ src: media?.file?.url,
6367
+ alt: mediaText?.title || mediaText?.subtitle || formatMessage({
6368
+ id: "error-loading-image-alt",
6369
+ defaultMessage: "Error loading image"
6370
+ }),
6371
+ className: "h-36 w-36 flex-none rounded-md object-cover object-center",
6372
+ width: 100,
6373
+ height: 100
6374
+ }
6375
+ ) }),
6376
+ media?.tags && /* @__PURE__ */ jsx("div", { className: "space-x-2", children: media?.tags.map((tag, i) => /* @__PURE__ */ jsx(
6377
+ "span",
6378
+ {
6379
+ className: "rounded border px-1 text-sm font-light capitalize text-text-primary shadow-xs dark:shadow-none",
6380
+ children: tag
6381
+ },
6382
+ `${tag}${i + 1}`
6383
+ )) })
6384
+ ] }),
6385
+ /* @__PURE__ */ jsx("div", { className: "my-auto flex-1 basis-1/3", children: /* @__PURE__ */ jsx(Form_default, { form, children: /* @__PURE__ */ jsxs("div", { className: "space-y-2 sm:flex sm:flex-col sm:items-start sm:justify-between", children: [
6386
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-auto flex-col justify-center space-y-1 text-sm font-medium text-slate-900 dark:text-slate-500", children: [
6387
+ /* @__PURE__ */ jsx("h3", { children: isEdit ? /* @__PURE__ */ jsx(
6388
+ TextField_default,
6389
+ {
6390
+ name: "title",
6391
+ label: formatMessage({
6392
+ id: "title",
6393
+ defaultMessage: "Title"
6394
+ })
6395
+ }
6396
+ ) : /* @__PURE__ */ jsxs(Fragment, { children: [
6397
+ /* @__PURE__ */ jsx("span", { children: formatMessage({
6398
+ id: "media_title",
6399
+ defaultMessage: "Title:"
6400
+ }) }),
6401
+ /* @__PURE__ */ jsx("span", { className: "ml-2", children: mediaText?.title })
6402
+ ] }) }),
6403
+ /* @__PURE__ */ jsx("p", { className: "sm:block", children: isEdit ? /* @__PURE__ */ jsx(
6404
+ TextField_default,
6405
+ {
6406
+ name: "subtitle",
6407
+ label: formatMessage({
6408
+ id: "subtitle",
6409
+ defaultMessage: "Subtitle"
6410
+ })
6411
+ }
6412
+ ) : /* @__PURE__ */ jsxs(Fragment, { children: [
6413
+ /* @__PURE__ */ jsx("span", { children: formatMessage({
6414
+ id: "media_subtitle",
6415
+ defaultMessage: "Subtitle:"
6416
+ }) }),
6417
+ /* @__PURE__ */ jsx("span", { className: "ml-2", children: mediaText?.subtitle })
6418
+ ] }) })
6419
+ ] }),
6420
+ /* @__PURE__ */ jsx(FormErrors_default, {}),
6421
+ isEdit && onEdit && /* @__PURE__ */ jsx(
6422
+ SaveAndCancelButtons_default,
6423
+ {
6424
+ className: "justify-end",
6425
+ onCancel: () => onEdit(!isEdit)
6426
+ }
6427
+ )
6428
+ ] }) }) }),
6429
+ /* @__PURE__ */ jsxs(
6430
+ "span",
6431
+ {
6432
+ className: "flex items-center gap-5",
6433
+ onClick: (e) => {
6434
+ e.stopPropagation();
6435
+ },
6436
+ children: [
6437
+ !isEdit && onEdit && /* @__PURE__ */ jsx(
6438
+ Button_default,
6439
+ {
6440
+ variant: "ghost",
6441
+ size: "xs",
6442
+ rounded: "full",
6443
+ icon: /* @__PURE__ */ jsx(PencilSquareIcon_default, { className: "h-5 w-5" }),
6444
+ onClick: (e) => {
6445
+ e.stopPropagation();
6446
+ onEdit(!isEdit);
6447
+ }
6448
+ }
6449
+ ),
6450
+ /* @__PURE__ */ jsx(
6451
+ "button",
6452
+ {
6453
+ type: "button",
6454
+ ...attributes,
6455
+ ...listeners,
6456
+ className: "hover:cursor-move",
6457
+ children: /* @__PURE__ */ jsx(DraggableIcon_default, {})
6458
+ }
6459
+ ),
6460
+ onDelete && /* @__PURE__ */ jsx(
6461
+ Button_default,
6462
+ {
6463
+ variant: "danger",
6464
+ size: "xs",
6465
+ rounded: "full",
6466
+ icon: /* @__PURE__ */ jsx(TrashIcon_default, { className: "h-5 w-5" }),
6467
+ onClick: async (e) => {
6468
+ e.stopPropagation();
6469
+ onDelete(media._id);
6470
+ }
6471
+ }
6472
+ )
6473
+ ]
6474
+ }
6475
+ )
6476
+ ]
6477
+ },
6478
+ media._id
6479
+ );
6480
+ };
6481
+ var MediaListItem_default = MediaListItem;
6482
+ var ProductMediaListItem = ({ media, id }) => {
6483
+ const { setModal } = useModal_default();
6484
+ const { removeProductMedia } = useRemoveProductMedia_default();
6485
+ const { formatMessage } = useIntl();
6486
+ const { selectedLocale } = useApp_default();
6487
+ const { updateProductMediaTexts } = useUpdateProductMediaTexts_default();
6488
+ const [isEditing, setIsEditing] = useState(false);
6489
+ const { hasRole } = useAuth_default();
6490
+ const { translatedMediaTexts } = useTranslatedProductMediaTexts_default({
6491
+ productMediaId: media._id
6492
+ });
6493
+ const mediaText = translatedMediaTexts?.find((text) => text.locale === selectedLocale) || {};
6494
+ const onDelete = async (productMediaId) => {
6495
+ await setModal(
6496
+ /* @__PURE__ */ jsx(
6497
+ DangerMessage_default,
6498
+ {
6499
+ onCancelClick: async () => setModal(""),
6500
+ message: formatMessage({
6501
+ id: "delete_product_media_confirmation",
6502
+ defaultMessage: "This action might cause inconsistencies with other data that relates to it. Are you sure you want to delete this media? "
6503
+ }),
6504
+ onOkClick: async () => {
6505
+ setModal("");
6506
+ await removeProductMedia({ productMediaId });
6507
+ toast.success(
6508
+ formatMessage({
6509
+ id: "product_media_deleted",
6510
+ defaultMessage: "Media deleted successfully"
6511
+ })
6512
+ );
6513
+ },
6514
+ okText: formatMessage({
6515
+ id: "delete_product_media",
6516
+ defaultMessage: "Delete media"
6517
+ })
6518
+ }
6519
+ )
6520
+ );
6521
+ };
6522
+ const onUpdateMediaText = async ({ title, subtitle }) => {
6523
+ await updateProductMediaTexts({
6524
+ productMediaId: media._id,
6525
+ texts: [
6526
+ {
6527
+ title,
6528
+ locale: selectedLocale,
6529
+ subtitle
6530
+ }
6531
+ ]
6532
+ });
6533
+ setIsEditing(false);
6534
+ return true;
6535
+ };
6536
+ return /* @__PURE__ */ jsx(
6537
+ MediaListItem_default,
6538
+ {
6539
+ id,
6540
+ media,
6541
+ mediaText,
6542
+ isEdit: isEditing,
6543
+ onDelete: hasRole("manageProducts" /* ManageProducts */) ? onDelete : void 0,
6544
+ onEdit: hasRole("manageProducts" /* ManageProducts */) ? setIsEditing : void 0,
6545
+ onUpdate: hasRole("manageProducts" /* ManageProducts */) ? onUpdateMediaText : void 0
6546
+ }
6547
+ );
6548
+ };
6549
+ var ProductMediaListItem_default = ProductMediaListItem;
6550
+ var ProductMediaList = ({ medias, items }) => {
6551
+ const { formatMessage } = useIntl();
6552
+ return /* @__PURE__ */ jsx("div", { className: "rounded-md lg:col-span-6 px-6", children: /* @__PURE__ */ jsxs("div", { className: "mx-auto overflow-hidden", children: [
6553
+ /* @__PURE__ */ jsx("h2", { className: "sr-only", children: formatMessage({
6554
+ id: "product_media",
6555
+ defaultMessage: "Product Media"
6556
+ }) }),
6557
+ /* @__PURE__ */ jsx("div", { className: "flow-root", children: /* @__PURE__ */ jsx(SortableContext, { items, strategy: verticalListSortingStrategy, children: /* @__PURE__ */ jsx("ul", { className: "flex flex-col gap-3 rounded-md transition-[background-color] ease-in-out delay-200 ", children: medias?.length ? items.map((id) => {
6558
+ const media = Object.values(medias).find(
6559
+ (md) => md._id === id
6560
+ );
6561
+ return /* @__PURE__ */ jsx(
6562
+ ProductMediaListItem_default,
6563
+ {
6564
+ id,
6565
+ media
6566
+ },
6567
+ media._id
6568
+ );
6569
+ }) : /* @__PURE__ */ jsx(
6570
+ NoData_default,
6571
+ {
6572
+ message: formatMessage({
6573
+ id: "media",
6574
+ defaultMessage: "Media"
6575
+ })
6576
+ }
6577
+ ) }) }) })
6578
+ ] }) });
6579
+ };
6580
+ var ProductMediaList_default = ProductMediaList;
6581
+ var ProductMediaForm = ({ productId }) => {
6582
+ const { productMedia } = useProductMedia_default({ productId });
6583
+ const { formatMessage } = useIntl();
6584
+ const { hasRole } = useAuth_default();
6585
+ const { addProductMedia } = useAddProductMedia_default();
6586
+ const { reOrderProductMedia } = useReOrderProductMedia_default();
6587
+ const items = productMedia?.map((media) => media._id);
6588
+ const onAddMedia = async (media) => {
6589
+ try {
6590
+ await addProductMedia({ productId, media });
6591
+ toast.success(
6592
+ formatMessage({
6593
+ id: "product_media_upload",
6594
+ defaultMessage: "Media uploaded successfully"
6595
+ })
6596
+ );
6597
+ } catch (err) {
6598
+ toast.error(
6599
+ formatMessage({
6600
+ id: "fail_upload",
6601
+ defaultMessage: "Media upload failed"
6602
+ })
6603
+ );
6604
+ }
6605
+ };
6606
+ const handleDragEnd = async (event) => {
6607
+ const { active, over } = event;
6608
+ if (active.id !== over.id) {
6609
+ const oldIndex = items.indexOf(active.id);
6610
+ const newIndex = items.indexOf(over.id);
6611
+ const newItems = arrayMove(items, oldIndex, newIndex);
6612
+ const sortedItems = newItems.map((id, index) => ({
6613
+ productMediaId: id,
6614
+ sortKey: index
6615
+ }));
6616
+ try {
6617
+ await reOrderProductMedia({ sortKeys: sortedItems });
6618
+ toast.success(
6619
+ formatMessage({
6620
+ id: "link_reorder",
6621
+ defaultMessage: "Link reorder successfully"
6622
+ })
6623
+ );
6624
+ } catch (error) {
6625
+ toast.error(
6626
+ formatMessage({
6627
+ id: "fail_reorder",
6628
+ defaultMessage: "Reordering failed, Try again!"
6629
+ })
6630
+ );
6631
+ }
6632
+ } else {
6633
+ toast.info(
6634
+ formatMessage({
6635
+ id: "reorder_original",
6636
+ defaultMessage: "Reorder to original location"
6637
+ })
6638
+ );
6639
+ }
6640
+ };
6641
+ const sensors = useSensors(
6642
+ useSensor(PointerSensor, {
6643
+ activationConstraint: {
6644
+ distance: 5
6645
+ }
6646
+ }),
6647
+ useSensor(KeyboardSensor, {
6648
+ coordinateGetter: sortableKeyboardCoordinates
6649
+ })
6650
+ );
6651
+ return /* @__PURE__ */ jsxs("div", { className: "mx-auto mt-5 space-y-5 lg:space-y-0 max-w-full py-6 lg:grid lg:grid-cols-12 lg:gap-4", children: [
6652
+ hasRole("manageProducts" /* ManageProducts */) && /* @__PURE__ */ jsx("div", { className: "mx-auto w-full px-6 lg:col-span-6 lg:col-start-1", children: /* @__PURE__ */ jsx(MediaUploader_default, { onlyDragAndDrop: true, addMedia: onAddMedia }) }),
6653
+ /* @__PURE__ */ jsx(
6654
+ DndContext,
6655
+ {
6656
+ sensors,
6657
+ collisionDetection: closestCenter,
6658
+ onDragEnd: handleDragEnd,
6659
+ children: /* @__PURE__ */ jsx(ProductMediaList_default, { medias: productMedia, items })
6660
+ }
6661
+ )
6662
+ ] });
6663
+ };
6664
+ var ProductMediaForm_default = ProductMediaForm;
1924
6665
 
1925
- export { useAddProductAssignment_default as useAddProductAssignment, useAddProductMedia_default as useAddProductMedia, useCreateProduct_default as useCreateProduct, useCreateProductBundleItem_default as useCreateProductBundleItem, useCreateProductVariation_default as useCreateProductVariation, useCreateProductVariationOption_default as useCreateProductVariationOption, useExportToken_default as useExportToken, useMenuPosition, usePrepareProductImport_default as usePrepareProductImport, useProduct_default as useProduct, useProductAssignments_default as useProductAssignments, useProductBundleItems_default as useProductBundleItems, useProductCatalogPrices_default as useProductCatalogPrices, useProductMedia_default as useProductMedia, useProductPlan_default as useProductPlan, useProductPlanConfigurationOptions_default as useProductPlanConfigurationOptions, useProductReviews_default as useProductReviews, useProductSupply_default as useProductSupply, useProductTokenization_default as useProductTokenization, useProductVariationTypes_default as useProductVariationTypes, useProductVariations_default as useProductVariations, useProductWarehousing_default as useProductWarehousing, useProducts_default as useProducts, useProductsCount_default as useProductsCount, usePublishProduct_default as usePublishProduct, useReOrderProductMedia_default as useReOrderProductMedia, useRemoveBundleItem_default as useRemoveBundleItem, useRemoveProduct_default as useRemoveProduct, useRemoveProductAssignment_default as useRemoveProductAssignment, useRemoveProductMedia_default as useRemoveProductMedia, useRemoveProductVariation_default as useRemoveProductVariation, useRemoveProductVariationOption_default as useRemoveProductVariationOption, useScaffoldBundleItem_default as useScaffoldBundleItem, useSmartContractStandards_default as useSmartContractStandards, useTranslatedProductMediaTexts_default as useTranslatedProductMediaTexts, useTranslatedProductTexts_default as useTranslatedProductTexts, useUnPublishProduct_default as useUnPublishProduct, useUpdateProduct_default as useUpdateProduct, useUpdateProductCommerce_default as useUpdateProductCommerce, useUpdateProductMediaTexts_default as useUpdateProductMediaTexts, useUpdateProductPlan_default as useUpdateProductPlan, useUpdateProductSupply_default as useUpdateProductSupply, useUpdateProductTexts_default as useUpdateProductTexts, useUpdateProductTokenization_default as useUpdateProductTokenization, useUpdateProductVariationTexts_default as useUpdateProductVariationTexts, useUpdateProductWarehousing_default as useUpdateProductWarehousing, useUserTokens_default as useUserTokens };
6666
+ export { ProductMediaForm_default as ProductMediaForm, ProductTextsForm_default as ProductTextsForm, useAddProductAssignment_default as useAddProductAssignment, useAddProductMedia_default as useAddProductMedia, useCreateProduct_default as useCreateProduct, useCreateProductBundleItem_default as useCreateProductBundleItem, useCreateProductVariation_default as useCreateProductVariation, useCreateProductVariationOption_default as useCreateProductVariationOption, useExportToken_default as useExportToken, useMenuPosition, usePrepareProductImport_default as usePrepareProductImport, useProduct_default as useProduct, useProductAssignments_default as useProductAssignments, useProductBundleItems_default as useProductBundleItems, useProductCatalogPrices_default as useProductCatalogPrices, useProductMedia_default as useProductMedia, useProductPlan_default as useProductPlan, useProductPlanConfigurationOptions_default as useProductPlanConfigurationOptions, useProductReviews_default as useProductReviews, useProductSupply_default as useProductSupply, useProductTokenization_default as useProductTokenization, useProductVariationTypes_default as useProductVariationTypes, useProductVariations_default as useProductVariations, useProductWarehousing_default as useProductWarehousing, useProducts_default as useProducts, useProductsCount_default as useProductsCount, usePublishProduct_default as usePublishProduct, useReOrderProductMedia_default as useReOrderProductMedia, useRemoveBundleItem_default as useRemoveBundleItem, useRemoveProduct_default as useRemoveProduct, useRemoveProductAssignment_default as useRemoveProductAssignment, useRemoveProductMedia_default as useRemoveProductMedia, useRemoveProductVariation_default as useRemoveProductVariation, useRemoveProductVariationOption_default as useRemoveProductVariationOption, useScaffoldBundleItem_default as useScaffoldBundleItem, useSmartContractStandards_default as useSmartContractStandards, useTranslatedProductMediaTexts_default as useTranslatedProductMediaTexts, useTranslatedProductTexts_default as useTranslatedProductTexts, useUnPublishProduct_default as useUnPublishProduct, useUpdateProduct_default as useUpdateProduct, useUpdateProductCommerce_default as useUpdateProductCommerce, useUpdateProductMediaTexts_default as useUpdateProductMediaTexts, useUpdateProductPlan_default as useUpdateProductPlan, useUpdateProductSupply_default as useUpdateProductSupply, useUpdateProductTexts_default as useUpdateProductTexts, useUpdateProductTokenization_default as useUpdateProductTokenization, useUpdateProductVariationTexts_default as useUpdateProductVariationTexts, useUpdateProductWarehousing_default as useUpdateProductWarehousing, useUserTokens_default as useUserTokens };