@jackuait/blok 0.4.1-beta.5 → 0.4.1-beta.6

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 (400) hide show
  1. package/README.md +136 -17
  2. package/codemod/README.md +16 -0
  3. package/codemod/migrate-editorjs-to-blok.js +868 -92
  4. package/codemod/test.js +682 -77
  5. package/dist/blok.mjs +5 -2
  6. package/dist/chunks/blok-B5qs7C5l.mjs +12838 -0
  7. package/dist/chunks/i18next-CugVlwWp.mjs +1292 -0
  8. package/dist/chunks/i18next-loader-CTrK3HzG.mjs +43 -0
  9. package/dist/{index-Cl_5rkKS.mjs → chunks/index-DDpzQn-0.mjs} +2 -2
  10. package/dist/chunks/inline-tool-convert-RBcopmCh.mjs +1988 -0
  11. package/dist/chunks/messages-2434tVOK.mjs +47 -0
  12. package/dist/chunks/messages-3DcCwXMF.mjs +47 -0
  13. package/dist/chunks/messages-4kMwVAKY.mjs +47 -0
  14. package/dist/chunks/messages-57uL5htT.mjs +47 -0
  15. package/dist/chunks/messages-76-iJV9Q.mjs +47 -0
  16. package/dist/chunks/messages-8p86Eyf2.mjs +47 -0
  17. package/dist/chunks/messages-BBX0p0Pi.mjs +47 -0
  18. package/dist/chunks/messages-BCm2eudQ.mjs +47 -0
  19. package/dist/chunks/messages-BFiUomgG.mjs +47 -0
  20. package/dist/chunks/messages-BIPNHHAV.mjs +47 -0
  21. package/dist/chunks/messages-BUlwu9mo.mjs +47 -0
  22. package/dist/chunks/messages-BX-DPa-z.mjs +47 -0
  23. package/dist/chunks/messages-BextV3Qh.mjs +47 -0
  24. package/dist/chunks/messages-BiPSFlUG.mjs +47 -0
  25. package/dist/chunks/messages-BiXe9G-O.mjs +47 -0
  26. package/dist/chunks/messages-Bl5z_Igo.mjs +47 -0
  27. package/dist/chunks/messages-BnsE97ku.mjs +47 -0
  28. package/dist/chunks/messages-BoO8gsVD.mjs +47 -0
  29. package/dist/chunks/messages-BqWaOGMn.mjs +47 -0
  30. package/dist/chunks/messages-BqkL2_Ro.mjs +47 -0
  31. package/dist/chunks/messages-BvCkXKX-.mjs +47 -0
  32. package/dist/chunks/messages-C6tbPLoj.mjs +47 -0
  33. package/dist/chunks/messages-CA6T3-gQ.mjs +47 -0
  34. package/dist/chunks/messages-CFFPFdWP.mjs +47 -0
  35. package/dist/chunks/messages-CFrKE-TN.mjs +47 -0
  36. package/dist/chunks/messages-CHz8VlG-.mjs +47 -0
  37. package/dist/chunks/messages-CLixzySl.mjs +47 -0
  38. package/dist/chunks/messages-CV7OM_qk.mjs +47 -0
  39. package/dist/chunks/messages-CXHt3eCC.mjs +47 -0
  40. package/dist/chunks/messages-CbmsBrB0.mjs +47 -0
  41. package/dist/chunks/messages-Ceo1KtFx.mjs +47 -0
  42. package/dist/chunks/messages-Cm0LJLtB.mjs +47 -0
  43. package/dist/chunks/messages-CmymP_Ar.mjs +47 -0
  44. package/dist/chunks/messages-D0ohMB5H.mjs +47 -0
  45. package/dist/chunks/messages-D3GrDwXh.mjs +47 -0
  46. package/dist/chunks/messages-D3vTzIpL.mjs +47 -0
  47. package/dist/chunks/messages-D5WeksbV.mjs +47 -0
  48. package/dist/chunks/messages-DGaab4EP.mjs +47 -0
  49. package/dist/chunks/messages-DKha57ZU.mjs +47 -0
  50. package/dist/chunks/messages-DOaujgMW.mjs +47 -0
  51. package/dist/chunks/messages-DVbPLd_0.mjs +47 -0
  52. package/dist/chunks/messages-D_FCyfW6.mjs +47 -0
  53. package/dist/chunks/messages-Dd5iZN3c.mjs +47 -0
  54. package/dist/chunks/messages-DehM7135.mjs +47 -0
  55. package/dist/chunks/messages-Dg1OHftD.mjs +47 -0
  56. package/dist/chunks/messages-Di6Flq-b.mjs +47 -0
  57. package/dist/chunks/messages-Dqhhex6e.mjs +47 -0
  58. package/dist/chunks/messages-DueVe0F1.mjs +47 -0
  59. package/dist/chunks/messages-Dx3eFwI0.mjs +47 -0
  60. package/dist/chunks/messages-FOtiUoKl.mjs +47 -0
  61. package/dist/chunks/messages-FTOZNhRD.mjs +47 -0
  62. package/dist/chunks/messages-IQxGfQIV.mjs +47 -0
  63. package/dist/chunks/messages-JF2fzCkK.mjs +47 -0
  64. package/dist/chunks/messages-MOGl7I5v.mjs +47 -0
  65. package/dist/chunks/messages-QgYhPL-3.mjs +47 -0
  66. package/dist/chunks/messages-WYWIbQwo.mjs +47 -0
  67. package/dist/chunks/messages-a6A_LgDv.mjs +47 -0
  68. package/dist/chunks/messages-bSf31LJi.mjs +47 -0
  69. package/dist/chunks/messages-diGozhTn.mjs +47 -0
  70. package/dist/chunks/messages-er-kd-VO.mjs +47 -0
  71. package/dist/chunks/messages-ez3w5NBn.mjs +47 -0
  72. package/dist/chunks/messages-f3uXjegd.mjs +47 -0
  73. package/dist/chunks/messages-ohwI1UGv.mjs +47 -0
  74. package/dist/chunks/messages-p9BZJaFV.mjs +47 -0
  75. package/dist/chunks/messages-qIQ4L4rw.mjs +47 -0
  76. package/dist/chunks/messages-qWkXPggi.mjs +47 -0
  77. package/dist/chunks/messages-w5foGze_.mjs +47 -0
  78. package/dist/full.mjs +50 -0
  79. package/dist/locales.mjs +227 -0
  80. package/dist/messages-2434tVOK.mjs +47 -0
  81. package/dist/messages-3DcCwXMF.mjs +47 -0
  82. package/dist/messages-4kMwVAKY.mjs +47 -0
  83. package/dist/messages-57uL5htT.mjs +47 -0
  84. package/dist/messages-76-iJV9Q.mjs +47 -0
  85. package/dist/messages-8p86Eyf2.mjs +47 -0
  86. package/dist/messages-BBX0p0Pi.mjs +47 -0
  87. package/dist/messages-BCm2eudQ.mjs +47 -0
  88. package/dist/messages-BFiUomgG.mjs +47 -0
  89. package/dist/messages-BIPNHHAV.mjs +47 -0
  90. package/dist/messages-BUlwu9mo.mjs +47 -0
  91. package/dist/messages-BX-DPa-z.mjs +47 -0
  92. package/dist/messages-BextV3Qh.mjs +47 -0
  93. package/dist/messages-BiPSFlUG.mjs +47 -0
  94. package/dist/messages-BiXe9G-O.mjs +47 -0
  95. package/dist/messages-Bl5z_Igo.mjs +47 -0
  96. package/dist/messages-BnsE97ku.mjs +47 -0
  97. package/dist/messages-BoO8gsVD.mjs +47 -0
  98. package/dist/messages-BqWaOGMn.mjs +47 -0
  99. package/dist/messages-BqkL2_Ro.mjs +47 -0
  100. package/dist/messages-BvCkXKX-.mjs +47 -0
  101. package/dist/messages-C6tbPLoj.mjs +47 -0
  102. package/dist/messages-CA6T3-gQ.mjs +47 -0
  103. package/dist/messages-CFFPFdWP.mjs +47 -0
  104. package/dist/messages-CFrKE-TN.mjs +47 -0
  105. package/dist/messages-CHz8VlG-.mjs +47 -0
  106. package/dist/messages-CLixzySl.mjs +47 -0
  107. package/dist/messages-CV7OM_qk.mjs +47 -0
  108. package/dist/messages-CXHt3eCC.mjs +47 -0
  109. package/dist/messages-CbmsBrB0.mjs +47 -0
  110. package/dist/messages-Ceo1KtFx.mjs +47 -0
  111. package/dist/messages-Cm0LJLtB.mjs +47 -0
  112. package/dist/messages-CmymP_Ar.mjs +47 -0
  113. package/dist/messages-D0ohMB5H.mjs +47 -0
  114. package/dist/messages-D3GrDwXh.mjs +47 -0
  115. package/dist/messages-D3vTzIpL.mjs +47 -0
  116. package/dist/messages-D5WeksbV.mjs +47 -0
  117. package/dist/messages-DGaab4EP.mjs +47 -0
  118. package/dist/messages-DKha57ZU.mjs +47 -0
  119. package/dist/messages-DOaujgMW.mjs +47 -0
  120. package/dist/messages-DVbPLd_0.mjs +47 -0
  121. package/dist/messages-D_FCyfW6.mjs +47 -0
  122. package/dist/messages-Dd5iZN3c.mjs +47 -0
  123. package/dist/messages-DehM7135.mjs +47 -0
  124. package/dist/messages-Dg1OHftD.mjs +47 -0
  125. package/dist/messages-Di6Flq-b.mjs +47 -0
  126. package/dist/messages-Dqhhex6e.mjs +47 -0
  127. package/dist/messages-DueVe0F1.mjs +47 -0
  128. package/dist/messages-Dx3eFwI0.mjs +47 -0
  129. package/dist/messages-FOtiUoKl.mjs +47 -0
  130. package/dist/messages-FTOZNhRD.mjs +47 -0
  131. package/dist/messages-IQxGfQIV.mjs +47 -0
  132. package/dist/messages-JF2fzCkK.mjs +47 -0
  133. package/dist/messages-MOGl7I5v.mjs +47 -0
  134. package/dist/messages-QgYhPL-3.mjs +47 -0
  135. package/dist/messages-WYWIbQwo.mjs +47 -0
  136. package/dist/messages-a6A_LgDv.mjs +47 -0
  137. package/dist/messages-bSf31LJi.mjs +47 -0
  138. package/dist/messages-diGozhTn.mjs +47 -0
  139. package/dist/messages-er-kd-VO.mjs +47 -0
  140. package/dist/messages-ez3w5NBn.mjs +47 -0
  141. package/dist/messages-f3uXjegd.mjs +47 -0
  142. package/dist/messages-ohwI1UGv.mjs +47 -0
  143. package/dist/messages-p9BZJaFV.mjs +47 -0
  144. package/dist/messages-qIQ4L4rw.mjs +47 -0
  145. package/dist/messages-qWkXPggi.mjs +47 -0
  146. package/dist/messages-w5foGze_.mjs +47 -0
  147. package/dist/tools.mjs +3073 -0
  148. package/dist/vendor.LICENSE.txt +59 -156
  149. package/package.json +48 -16
  150. package/src/blok.ts +267 -0
  151. package/src/components/__module.ts +139 -0
  152. package/src/components/block/api.ts +155 -0
  153. package/src/components/block/index.ts +1427 -0
  154. package/src/components/block-tunes/block-tune-delete.ts +51 -0
  155. package/src/components/blocks.ts +338 -0
  156. package/src/components/constants/data-attributes.ts +342 -0
  157. package/src/components/constants.ts +76 -0
  158. package/src/components/core.ts +392 -0
  159. package/src/components/dom.ts +773 -0
  160. package/src/components/domIterator.ts +189 -0
  161. package/src/components/errors/critical.ts +5 -0
  162. package/src/components/events/BlockChanged.ts +16 -0
  163. package/src/components/events/BlockHovered.ts +21 -0
  164. package/src/components/events/BlockSettingsClosed.ts +12 -0
  165. package/src/components/events/BlockSettingsOpened.ts +12 -0
  166. package/src/components/events/BlokMobileLayoutToggled.ts +15 -0
  167. package/src/components/events/FakeCursorAboutToBeToggled.ts +17 -0
  168. package/src/components/events/FakeCursorHaveBeenSet.ts +17 -0
  169. package/src/components/events/HistoryStateChanged.ts +19 -0
  170. package/src/components/events/RedactorDomChanged.ts +14 -0
  171. package/src/components/events/index.ts +46 -0
  172. package/src/components/flipper.ts +481 -0
  173. package/src/components/i18n/i18next-loader.ts +84 -0
  174. package/src/components/i18n/lightweight-i18n.ts +86 -0
  175. package/src/components/i18n/locales/TRANSLATION_GUIDELINES.md +113 -0
  176. package/src/components/i18n/locales/am/messages.json +44 -0
  177. package/src/components/i18n/locales/ar/messages.json +44 -0
  178. package/src/components/i18n/locales/az/messages.json +44 -0
  179. package/src/components/i18n/locales/bg/messages.json +44 -0
  180. package/src/components/i18n/locales/bn/messages.json +44 -0
  181. package/src/components/i18n/locales/bs/messages.json +44 -0
  182. package/src/components/i18n/locales/cs/messages.json +44 -0
  183. package/src/components/i18n/locales/da/messages.json +44 -0
  184. package/src/components/i18n/locales/de/messages.json +44 -0
  185. package/src/components/i18n/locales/dv/messages.json +44 -0
  186. package/src/components/i18n/locales/el/messages.json +44 -0
  187. package/src/components/i18n/locales/en/messages.json +44 -0
  188. package/src/components/i18n/locales/es/messages.json +44 -0
  189. package/src/components/i18n/locales/et/messages.json +44 -0
  190. package/src/components/i18n/locales/fa/messages.json +44 -0
  191. package/src/components/i18n/locales/fi/messages.json +44 -0
  192. package/src/components/i18n/locales/fil/messages.json +44 -0
  193. package/src/components/i18n/locales/fr/messages.json +44 -0
  194. package/src/components/i18n/locales/gu/messages.json +44 -0
  195. package/src/components/i18n/locales/he/messages.json +44 -0
  196. package/src/components/i18n/locales/hi/messages.json +44 -0
  197. package/src/components/i18n/locales/hr/messages.json +44 -0
  198. package/src/components/i18n/locales/hu/messages.json +44 -0
  199. package/src/components/i18n/locales/hy/messages.json +44 -0
  200. package/src/components/i18n/locales/id/messages.json +44 -0
  201. package/src/components/i18n/locales/index.ts +225 -0
  202. package/src/components/i18n/locales/it/messages.json +44 -0
  203. package/src/components/i18n/locales/ja/messages.json +44 -0
  204. package/src/components/i18n/locales/ka/messages.json +44 -0
  205. package/src/components/i18n/locales/km/messages.json +44 -0
  206. package/src/components/i18n/locales/kn/messages.json +44 -0
  207. package/src/components/i18n/locales/ko/messages.json +44 -0
  208. package/src/components/i18n/locales/ku/messages.json +44 -0
  209. package/src/components/i18n/locales/lo/messages.json +44 -0
  210. package/src/components/i18n/locales/lt/messages.json +44 -0
  211. package/src/components/i18n/locales/lv/messages.json +44 -0
  212. package/src/components/i18n/locales/mk/messages.json +44 -0
  213. package/src/components/i18n/locales/ml/messages.json +44 -0
  214. package/src/components/i18n/locales/mn/messages.json +44 -0
  215. package/src/components/i18n/locales/mr/messages.json +44 -0
  216. package/src/components/i18n/locales/ms/messages.json +44 -0
  217. package/src/components/i18n/locales/my/messages.json +44 -0
  218. package/src/components/i18n/locales/ne/messages.json +44 -0
  219. package/src/components/i18n/locales/nl/messages.json +44 -0
  220. package/src/components/i18n/locales/no/messages.json +44 -0
  221. package/src/components/i18n/locales/pa/messages.json +44 -0
  222. package/src/components/i18n/locales/pl/messages.json +44 -0
  223. package/src/components/i18n/locales/ps/messages.json +44 -0
  224. package/src/components/i18n/locales/pt/messages.json +44 -0
  225. package/src/components/i18n/locales/ro/messages.json +44 -0
  226. package/src/components/i18n/locales/ru/messages.json +44 -0
  227. package/src/components/i18n/locales/sd/messages.json +44 -0
  228. package/src/components/i18n/locales/si/messages.json +44 -0
  229. package/src/components/i18n/locales/sk/messages.json +44 -0
  230. package/src/components/i18n/locales/sl/messages.json +44 -0
  231. package/src/components/i18n/locales/sq/messages.json +44 -0
  232. package/src/components/i18n/locales/sr/messages.json +44 -0
  233. package/src/components/i18n/locales/sv/messages.json +44 -0
  234. package/src/components/i18n/locales/sw/messages.json +44 -0
  235. package/src/components/i18n/locales/ta/messages.json +44 -0
  236. package/src/components/i18n/locales/te/messages.json +44 -0
  237. package/src/components/i18n/locales/th/messages.json +44 -0
  238. package/src/components/i18n/locales/tr/messages.json +44 -0
  239. package/src/components/i18n/locales/ug/messages.json +44 -0
  240. package/src/components/i18n/locales/uk/messages.json +44 -0
  241. package/src/components/i18n/locales/ur/messages.json +44 -0
  242. package/src/components/i18n/locales/vi/messages.json +44 -0
  243. package/src/components/i18n/locales/yi/messages.json +44 -0
  244. package/src/components/i18n/locales/zh/messages.json +44 -0
  245. package/src/components/icons/index.ts +242 -0
  246. package/src/components/inline-tools/inline-tool-bold.ts +2213 -0
  247. package/src/components/inline-tools/inline-tool-convert.ts +141 -0
  248. package/src/components/inline-tools/inline-tool-italic.ts +500 -0
  249. package/src/components/inline-tools/inline-tool-link.ts +539 -0
  250. package/src/components/modules/api/blocks.ts +363 -0
  251. package/src/components/modules/api/caret.ts +125 -0
  252. package/src/components/modules/api/events.ts +51 -0
  253. package/src/components/modules/api/history.ts +73 -0
  254. package/src/components/modules/api/i18n.ts +33 -0
  255. package/src/components/modules/api/index.ts +39 -0
  256. package/src/components/modules/api/inlineToolbar.ts +33 -0
  257. package/src/components/modules/api/listeners.ts +56 -0
  258. package/src/components/modules/api/notifier.ts +46 -0
  259. package/src/components/modules/api/readonly.ts +39 -0
  260. package/src/components/modules/api/sanitizer.ts +30 -0
  261. package/src/components/modules/api/saver.ts +52 -0
  262. package/src/components/modules/api/selection.ts +48 -0
  263. package/src/components/modules/api/styles.ts +72 -0
  264. package/src/components/modules/api/toolbar.ts +79 -0
  265. package/src/components/modules/api/tools.ts +16 -0
  266. package/src/components/modules/api/tooltip.ts +67 -0
  267. package/src/components/modules/api/ui.ts +36 -0
  268. package/src/components/modules/blockEvents.ts +1375 -0
  269. package/src/components/modules/blockManager.ts +1348 -0
  270. package/src/components/modules/blockSelection.ts +708 -0
  271. package/src/components/modules/caret.ts +853 -0
  272. package/src/components/modules/crossBlockSelection.ts +329 -0
  273. package/src/components/modules/dragManager.ts +1141 -0
  274. package/src/components/modules/history.ts +1098 -0
  275. package/src/components/modules/i18n.ts +325 -0
  276. package/src/components/modules/index.ts +139 -0
  277. package/src/components/modules/modificationsObserver.ts +147 -0
  278. package/src/components/modules/paste.ts +1092 -0
  279. package/src/components/modules/readonly.ts +136 -0
  280. package/src/components/modules/rectangleSelection.ts +668 -0
  281. package/src/components/modules/renderer.ts +155 -0
  282. package/src/components/modules/saver.ts +283 -0
  283. package/src/components/modules/toolbar/blockSettings.ts +776 -0
  284. package/src/components/modules/toolbar/index.ts +1311 -0
  285. package/src/components/modules/toolbar/inline.ts +956 -0
  286. package/src/components/modules/tools.ts +589 -0
  287. package/src/components/modules/ui.ts +1179 -0
  288. package/src/components/polyfills.ts +113 -0
  289. package/src/components/selection.ts +1189 -0
  290. package/src/components/tools/base.ts +274 -0
  291. package/src/components/tools/block.ts +291 -0
  292. package/src/components/tools/collection.ts +67 -0
  293. package/src/components/tools/factory.ts +85 -0
  294. package/src/components/tools/inline.ts +71 -0
  295. package/src/components/tools/tune.ts +33 -0
  296. package/src/components/ui/toolbox.ts +497 -0
  297. package/src/components/utils/announcer.ts +205 -0
  298. package/src/components/utils/api.ts +20 -0
  299. package/src/components/utils/bem.ts +26 -0
  300. package/src/components/utils/blocks.ts +284 -0
  301. package/src/components/utils/caret.ts +1067 -0
  302. package/src/components/utils/data-model-transform.ts +382 -0
  303. package/src/components/utils/events.ts +117 -0
  304. package/src/components/utils/keyboard.ts +60 -0
  305. package/src/components/utils/listeners.ts +296 -0
  306. package/src/components/utils/mutations.ts +39 -0
  307. package/src/components/utils/notifier/draw.ts +190 -0
  308. package/src/components/utils/notifier/index.ts +66 -0
  309. package/src/components/utils/notifier/types.ts +1 -0
  310. package/src/components/utils/notifier.ts +77 -0
  311. package/src/components/utils/placeholder.ts +140 -0
  312. package/src/components/utils/popover/components/hint/hint.const.ts +10 -0
  313. package/src/components/utils/popover/components/hint/hint.ts +46 -0
  314. package/src/components/utils/popover/components/hint/index.ts +6 -0
  315. package/src/components/utils/popover/components/popover-header/index.ts +2 -0
  316. package/src/components/utils/popover/components/popover-header/popover-header.const.ts +8 -0
  317. package/src/components/utils/popover/components/popover-header/popover-header.ts +80 -0
  318. package/src/components/utils/popover/components/popover-header/popover-header.types.ts +14 -0
  319. package/src/components/utils/popover/components/popover-item/index.ts +13 -0
  320. package/src/components/utils/popover/components/popover-item/popover-item-default/popover-item-default.const.ts +50 -0
  321. package/src/components/utils/popover/components/popover-item/popover-item-default/popover-item-default.ts +666 -0
  322. package/src/components/utils/popover/components/popover-item/popover-item-html/popover-item-html.const.ts +14 -0
  323. package/src/components/utils/popover/components/popover-item/popover-item-html/popover-item-html.ts +136 -0
  324. package/src/components/utils/popover/components/popover-item/popover-item-separator/popover-item-separator.const.ts +20 -0
  325. package/src/components/utils/popover/components/popover-item/popover-item-separator/popover-item-separator.ts +117 -0
  326. package/src/components/utils/popover/components/popover-item/popover-item.ts +187 -0
  327. package/src/components/utils/popover/components/search-input/index.ts +2 -0
  328. package/src/components/utils/popover/components/search-input/search-input.const.ts +8 -0
  329. package/src/components/utils/popover/components/search-input/search-input.ts +181 -0
  330. package/src/components/utils/popover/components/search-input/search-input.types.ts +30 -0
  331. package/src/components/utils/popover/index.ts +13 -0
  332. package/src/components/utils/popover/popover-abstract.ts +448 -0
  333. package/src/components/utils/popover/popover-desktop.ts +643 -0
  334. package/src/components/utils/popover/popover-inline.ts +338 -0
  335. package/src/components/utils/popover/popover-mobile.ts +201 -0
  336. package/src/components/utils/popover/popover.const.ts +81 -0
  337. package/src/components/utils/popover/utils/popover-states-history.ts +72 -0
  338. package/src/components/utils/promise-queue.ts +43 -0
  339. package/src/components/utils/sanitizer.ts +537 -0
  340. package/src/components/utils/scroll-locker.ts +87 -0
  341. package/src/components/utils/shortcut.ts +231 -0
  342. package/src/components/utils/shortcuts.ts +113 -0
  343. package/src/components/utils/tools.ts +105 -0
  344. package/src/components/utils/tooltip.ts +642 -0
  345. package/src/components/utils/tw.ts +241 -0
  346. package/src/components/utils.ts +1081 -0
  347. package/src/env.d.ts +13 -0
  348. package/src/full.ts +69 -0
  349. package/src/locales.ts +51 -0
  350. package/src/stories/Block.stories.ts +498 -0
  351. package/src/stories/EditorModes.stories.ts +505 -0
  352. package/src/stories/Header.stories.ts +137 -0
  353. package/src/stories/InlineToolbar.stories.ts +498 -0
  354. package/src/stories/List.stories.ts +259 -0
  355. package/src/stories/Notifier.stories.ts +340 -0
  356. package/src/stories/Paragraph.stories.ts +112 -0
  357. package/src/stories/Placeholder.stories.ts +319 -0
  358. package/src/stories/Popover.stories.ts +844 -0
  359. package/src/stories/Selection.stories.ts +250 -0
  360. package/src/stories/StubBlock.stories.ts +156 -0
  361. package/src/stories/Toolbar.stories.ts +223 -0
  362. package/src/stories/Toolbox.stories.ts +166 -0
  363. package/src/stories/Tooltip.stories.ts +198 -0
  364. package/src/stories/helpers.ts +463 -0
  365. package/src/styles/main.css +123 -0
  366. package/src/tools/header/index.ts +570 -0
  367. package/src/tools/index.ts +38 -0
  368. package/src/tools/list/index.ts +1803 -0
  369. package/src/tools/paragraph/index.ts +411 -0
  370. package/src/tools/stub/index.ts +107 -0
  371. package/src/types-internal/blok-modules.d.ts +87 -0
  372. package/src/types-internal/html-janitor.d.ts +28 -0
  373. package/src/types-internal/module-config.d.ts +11 -0
  374. package/src/variants/all-locales.ts +155 -0
  375. package/src/variants/blok-maximum.ts +20 -0
  376. package/src/variants/blok-minimum.ts +243 -0
  377. package/types/api/blocks.d.ts +1 -1
  378. package/types/api/i18n.d.ts +5 -3
  379. package/types/api/selection.d.ts +6 -0
  380. package/types/api/styles.d.ts +0 -5
  381. package/types/configs/blok-config.d.ts +21 -0
  382. package/types/configs/i18n-config.d.ts +52 -2
  383. package/types/configs/i18n-dictionary.d.ts +16 -90
  384. package/types/data-attributes.d.ts +169 -0
  385. package/types/data-formats/output-data.d.ts +15 -0
  386. package/types/full.d.ts +80 -0
  387. package/types/index.d.ts +9 -12
  388. package/types/locales.d.ts +59 -0
  389. package/types/tools/adapters/inline-tool-adapter.d.ts +10 -0
  390. package/types/tools/block-tool.d.ts +9 -0
  391. package/types/tools/header.d.ts +18 -0
  392. package/types/tools/index.d.ts +1 -0
  393. package/types/tools/list.d.ts +91 -0
  394. package/types/tools/paragraph.d.ts +71 -0
  395. package/types/tools/tool-settings.d.ts +16 -2
  396. package/types/tools/tool.d.ts +6 -0
  397. package/types/tools-entry.d.ts +49 -0
  398. package/types/utils/popover/popover-item.d.ts +0 -5
  399. package/dist/blok-DvN73wsH.mjs +0 -19922
  400. package/dist/blok.umd.js +0 -166
package/dist/blok.umd.js DELETED
@@ -1,166 +0,0 @@
1
- (function(Q,G){typeof exports=="object"&&typeof module!="undefined"?module.exports=G():typeof define=="function"&&define.amd?define(G):(Q=typeof globalThis!="undefined"?globalThis:Q||self,Q.Blok=G())})(this,(function(){"use strict";var Gv=Object.defineProperty,$v=Object.defineProperties;var Vv=Object.getOwnPropertyDescriptors;var gn=Object.getOwnPropertySymbols;var mh=Object.prototype.hasOwnProperty,bh=Object.prototype.propertyIsEnumerable;var gh=(Q,G,fe)=>G in Q?Gv(Q,G,{enumerable:!0,configurable:!0,writable:!0,value:fe}):Q[G]=fe,K=(Q,G)=>{for(var fe in G||(G={}))mh.call(G,fe)&&gh(Q,fe,G[fe]);if(gn)for(var fe of gn(G))bh.call(G,fe)&&gh(Q,fe,G[fe]);return Q},Re=(Q,G)=>$v(Q,Vv(G));var vh=(Q,G)=>{var fe={};for(var Ne in Q)mh.call(Q,Ne)&&G.indexOf(Ne)<0&&(fe[Ne]=Q[Ne]);if(Q!=null&&gn)for(var Ne of gn(Q))G.indexOf(Ne)<0&&bh.call(Q,Ne)&&(fe[Ne]=Q[Ne]);return fe};var Ct;var Q=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function G(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var fe,Ne;function kh(){if(Ne)return fe;Ne=1;function r(){}return fe=Object.assign(r,{default:r,register:r,revert:function(){},__esModule:!0}),fe}kh(),typeof Element.prototype.scrollIntoViewIfNeeded=="undefined"&&(Element.prototype.scrollIntoViewIfNeeded=function(r){const e=r!=null?r:!0,t=this.parentElement;if(!t)return;const o=window.getComputedStyle(t,null),n=parseInt(o.getPropertyValue("border-top-width")),i=parseInt(o.getPropertyValue("border-left-width")),s=this.offsetTop-t.offsetTop<t.scrollTop,a=this.offsetTop-t.offsetTop+this.clientHeight-n>t.scrollTop+t.clientHeight,l=this.offsetLeft-t.offsetLeft<t.scrollLeft,c=this.offsetLeft-t.offsetLeft+this.clientWidth-i>t.scrollLeft+t.clientWidth,d=s&&!a;(s||a)&&e&&(t.scrollTop=this.offsetTop-t.offsetTop-t.clientHeight/2-n+this.clientHeight/2),(l||c)&&e&&(t.scrollLeft=this.offsetLeft-t.offsetLeft-t.clientWidth/2-i+this.clientWidth/2),(s||a||l||c)&&!e&&this.scrollIntoView(d)});const yh=globalThis.setTimeout.bind(globalThis),wh=globalThis.clearTimeout.bind(globalThis),mo=new Map,Th=r=>{const e=Number(r);return Number.isFinite(e)&&e>0?e:Date.now()};typeof window.requestIdleCallback=="undefined"&&(window.requestIdleCallback=function(r){const e=Date.now(),t={},o=yh(()=>{const i=t.value;typeof i=="number"&&mo.delete(i),r({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-e))}})},1),n=Th(o);return t.value=n,mo.set(n,o),n}),typeof window.cancelIdleCallback=="undefined"&&(window.cancelIdleCallback=function(r){const e=mo.get(r);e!==void 0&&(mo.delete(r),wh(e)),globalThis.clearTimeout(r)});const Bh="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let xh=(r=21)=>{let e="",t=crypto.getRandomValues(new Uint8Array(r|=0));for(;r--;)e+=Bh[t[r]&63];return e};var mn,ya;function Ch(){if(ya)return mn;ya=1;var r="Expected a function";function e(t,o,n){if(typeof t!="function")throw new TypeError(r);return setTimeout(function(){t.apply(void 0,n)},o)}return mn=e,mn}var bn,wa;function Ta(){if(wa)return bn;wa=1;function r(e){return e}return bn=r,bn}var vn,Ba;function Eh(){if(Ba)return vn;Ba=1;function r(e,t,o){switch(o.length){case 0:return e.call(t);case 1:return e.call(t,o[0]);case 2:return e.call(t,o[0],o[1]);case 3:return e.call(t,o[0],o[1],o[2])}return e.apply(t,o)}return vn=r,vn}var kn,xa;function Sh(){if(xa)return kn;xa=1;var r=Eh(),e=Math.max;function t(o,n,i){return n=e(n===void 0?o.length-1:n,0),function(){for(var s=arguments,a=-1,l=e(s.length-n,0),c=Array(l);++a<l;)c[a]=s[n+a];a=-1;for(var d=Array(n+1);++a<n;)d[a]=s[a];return d[n]=i(c),r(o,this,d)}}return kn=t,kn}var yn,Ca;function Ah(){if(Ca)return yn;Ca=1;function r(e){return function(){return e}}return yn=r,yn}var wn,Ea;function Sa(){if(Ea)return wn;Ea=1;var r=typeof Q=="object"&&Q&&Q.Object===Object&&Q;return wn=r,wn}var Tn,Aa;function He(){if(Aa)return Tn;Aa=1;var r=Sa(),e=typeof self=="object"&&self&&self.Object===Object&&self,t=r||e||Function("return this")();return Tn=t,Tn}var Bn,Ia;function bo(){if(Ia)return Bn;Ia=1;var r=He(),e=r.Symbol;return Bn=e,Bn}var xn,Ra;function Ih(){if(Ra)return xn;Ra=1;var r=bo(),e=Object.prototype,t=e.hasOwnProperty,o=e.toString,n=r?r.toStringTag:void 0;function i(s){var a=t.call(s,n),l=s[n];try{s[n]=void 0;var c=!0}catch(u){}var d=o.call(s);return c&&(a?s[n]=l:delete s[n]),d}return xn=i,xn}var Cn,Na;function Rh(){if(Na)return Cn;Na=1;var r=Object.prototype,e=r.toString;function t(o){return e.call(o)}return Cn=t,Cn}var En,Oa;function Xe(){if(Oa)return En;Oa=1;var r=bo(),e=Ih(),t=Rh(),o="[object Null]",n="[object Undefined]",i=r?r.toStringTag:void 0;function s(a){return a==null?a===void 0?n:o:i&&i in Object(a)?e(a):t(a)}return En=s,En}var Sn,_a;function Ke(){if(_a)return Sn;_a=1;function r(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}return Sn=r,Sn}var An,La;function vo(){if(La)return An;La=1;var r=Xe(),e=Ke(),t="[object AsyncFunction]",o="[object Function]",n="[object GeneratorFunction]",i="[object Proxy]";function s(a){if(!e(a))return!1;var l=r(a);return l==o||l==n||l==t||l==i}return An=s,An}var In,Da;function Nh(){if(Da)return In;Da=1;var r=He(),e=r["__core-js_shared__"];return In=e,In}var Rn,Ma;function Oh(){if(Ma)return Rn;Ma=1;var r=Nh(),e=(function(){var o=/[^.]+$/.exec(r&&r.keys&&r.keys.IE_PROTO||"");return o?"Symbol(src)_1."+o:""})();function t(o){return!!e&&e in o}return Rn=t,Rn}var Nn,Pa;function Fa(){if(Pa)return Nn;Pa=1;var r=Function.prototype,e=r.toString;function t(o){if(o!=null){try{return e.call(o)}catch(n){}try{return o+""}catch(n){}}return""}return Nn=t,Nn}var On,Ha;function _h(){if(Ha)return On;Ha=1;var r=vo(),e=Oh(),t=Ke(),o=Fa(),n=/[\\^$.*+?()[\]{}|]/g,i=/^\[object .+?Constructor\]$/,s=Function.prototype,a=Object.prototype,l=s.toString,c=a.hasOwnProperty,d=RegExp("^"+l.call(c).replace(n,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function u(h){if(!t(h)||e(h))return!1;var p=r(h)?d:i;return p.test(o(h))}return On=u,On}var _n,qa;function Lh(){if(qa)return _n;qa=1;function r(e,t){return e==null?void 0:e[t]}return _n=r,_n}var Ln,za;function ht(){if(za)return Ln;za=1;var r=_h(),e=Lh();function t(o,n){var i=e(o,n);return r(i)?i:void 0}return Ln=t,Ln}var Dn,ja;function Ua(){if(ja)return Dn;ja=1;var r=ht(),e=(function(){try{var t=r(Object,"defineProperty");return t({},"",{}),t}catch(o){}})();return Dn=e,Dn}var Mn,Ka;function Dh(){if(Ka)return Mn;Ka=1;var r=Ah(),e=Ua(),t=Ta(),o=e?function(n,i){return e(n,"toString",{configurable:!0,enumerable:!1,value:r(i),writable:!0})}:t;return Mn=o,Mn}var Pn,Wa;function Mh(){if(Wa)return Pn;Wa=1;var r=800,e=16,t=Date.now;function o(n){var i=0,s=0;return function(){var a=t(),l=e-(a-s);if(s=a,l>0){if(++i>=r)return arguments[0]}else i=0;return n.apply(void 0,arguments)}}return Pn=o,Pn}var Fn,Ga;function Ph(){if(Ga)return Fn;Ga=1;var r=Dh(),e=Mh(),t=e(r);return Fn=t,Fn}var Hn,$a;function Va(){if($a)return Hn;$a=1;var r=Ta(),e=Sh(),t=Ph();function o(n,i){return t(e(n,i,r),n+"")}return Hn=o,Hn}var qn,Xa;function Fh(){if(Xa)return qn;Xa=1;var r=/\s/;function e(t){for(var o=t.length;o--&&r.test(t.charAt(o)););return o}return qn=e,qn}var zn,Ya;function Hh(){if(Ya)return zn;Ya=1;var r=Fh(),e=/^\s+/;function t(o){return o&&o.slice(0,r(o)+1).replace(e,"")}return zn=t,zn}var jn,Za;function We(){if(Za)return jn;Za=1;function r(e){return e!=null&&typeof e=="object"}return jn=r,jn}var Un,Ja;function qh(){if(Ja)return Un;Ja=1;var r=Xe(),e=We(),t="[object Symbol]";function o(n){return typeof n=="symbol"||e(n)&&r(n)==t}return Un=o,Un}var Kn,Qa;function el(){if(Qa)return Kn;Qa=1;var r=Hh(),e=Ke(),t=qh(),o=NaN,n=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,s=/^0o[0-7]+$/i,a=parseInt;function l(c){if(typeof c=="number")return c;if(t(c))return o;if(e(c)){var d=typeof c.valueOf=="function"?c.valueOf():c;c=e(d)?d+"":d}if(typeof c!="string")return c===0?c:+c;c=r(c);var u=i.test(c);return u||s.test(c)?a(c.slice(2),u?2:8):n.test(c)?o:+c}return Kn=l,Kn}var Wn,tl;function zh(){if(tl)return Wn;tl=1;var r=Ch(),e=Va(),t=el(),o=e(function(n,i,s){return r(n,t(i)||0,s)});return Wn=o,Wn}var jh=zh();const Uh=G(jh);var Gn,ol;function Kh(){if(ol)return Gn;ol=1;var r=Xe(),e=We(),t="[object Boolean]";function o(n){return n===!0||n===!1||e(n)&&r(n)==t}return Gn=o,Gn}var Wh=Kh();const Gh=G(Wh);var $n,nl;function ko(){if(nl)return $n;nl=1;var r=Object.prototype;function e(t){var o=t&&t.constructor,n=typeof o=="function"&&o.prototype||r;return t===n}return $n=e,$n}var Vn,rl;function il(){if(rl)return Vn;rl=1;function r(e,t){return function(o){return e(t(o))}}return Vn=r,Vn}var Xn,sl;function $h(){if(sl)return Xn;sl=1;var r=il(),e=r(Object.keys,Object);return Xn=e,Xn}var Yn,al;function ll(){if(al)return Yn;al=1;var r=ko(),e=$h(),t=Object.prototype,o=t.hasOwnProperty;function n(i){if(!r(i))return e(i);var s=[];for(var a in Object(i))o.call(i,a)&&a!="constructor"&&s.push(a);return s}return Yn=n,Yn}var Zn,cl;function Vh(){if(cl)return Zn;cl=1;var r=ht(),e=He(),t=r(e,"DataView");return Zn=t,Zn}var Jn,dl;function Qn(){if(dl)return Jn;dl=1;var r=ht(),e=He(),t=r(e,"Map");return Jn=t,Jn}var er,ul;function Xh(){if(ul)return er;ul=1;var r=ht(),e=He(),t=r(e,"Promise");return er=t,er}var tr,hl;function Yh(){if(hl)return tr;hl=1;var r=ht(),e=He(),t=r(e,"Set");return tr=t,tr}var or,fl;function Zh(){if(fl)return or;fl=1;var r=ht(),e=He(),t=r(e,"WeakMap");return or=t,or}var nr,pl;function rr(){if(pl)return nr;pl=1;var r=Vh(),e=Qn(),t=Xh(),o=Yh(),n=Zh(),i=Xe(),s=Fa(),a="[object Map]",l="[object Object]",c="[object Promise]",d="[object Set]",u="[object WeakMap]",h="[object DataView]",p=s(r),f=s(e),g=s(t),b=s(o),k=s(n),y=i;return(r&&y(new r(new ArrayBuffer(1)))!=h||e&&y(new e)!=a||t&&y(t.resolve())!=c||o&&y(new o)!=d||n&&y(new n)!=u)&&(y=function(x){var T=i(x),R=T==l?x.constructor:void 0,C=R?s(R):"";if(C)switch(C){case p:return h;case f:return a;case g:return c;case b:return d;case k:return u}return T}),nr=y,nr}var ir,gl;function Jh(){if(gl)return ir;gl=1;var r=Xe(),e=We(),t="[object Arguments]";function o(n){return e(n)&&r(n)==t}return ir=o,ir}var sr,ml;function ar(){if(ml)return sr;ml=1;var r=Jh(),e=We(),t=Object.prototype,o=t.hasOwnProperty,n=t.propertyIsEnumerable,i=r((function(){return arguments})())?r:function(s){return e(s)&&o.call(s,"callee")&&!n.call(s,"callee")};return sr=i,sr}var lr,bl;function St(){if(bl)return lr;bl=1;var r=Array.isArray;return lr=r,lr}var cr,vl;function kl(){if(vl)return cr;vl=1;var r=9007199254740991;function e(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=r}return cr=e,cr}var dr,yl;function At(){if(yl)return dr;yl=1;var r=vo(),e=kl();function t(o){return o!=null&&e(o.length)&&!r(o)}return dr=t,dr}var jt={exports:{}},ur,wl;function Qh(){if(wl)return ur;wl=1;function r(){return!1}return ur=r,ur}jt.exports;var Tl;function yo(){return Tl||(Tl=1,(function(r,e){var t=He(),o=Qh(),n=e&&!e.nodeType&&e,i=n&&!0&&r&&!r.nodeType&&r,s=i&&i.exports===n,a=s?t.Buffer:void 0,l=a?a.isBuffer:void 0,c=l||o;r.exports=c})(jt,jt.exports)),jt.exports}var hr,Bl;function ef(){if(Bl)return hr;Bl=1;var r=Xe(),e=kl(),t=We(),o="[object Arguments]",n="[object Array]",i="[object Boolean]",s="[object Date]",a="[object Error]",l="[object Function]",c="[object Map]",d="[object Number]",u="[object Object]",h="[object RegExp]",p="[object Set]",f="[object String]",g="[object WeakMap]",b="[object ArrayBuffer]",k="[object DataView]",y="[object Float32Array]",x="[object Float64Array]",T="[object Int8Array]",R="[object Int16Array]",C="[object Int32Array]",E="[object Uint8Array]",w="[object Uint8ClampedArray]",_="[object Uint16Array]",F="[object Uint32Array]",N={};N[y]=N[x]=N[T]=N[R]=N[C]=N[E]=N[w]=N[_]=N[F]=!0,N[o]=N[n]=N[b]=N[i]=N[k]=N[s]=N[a]=N[l]=N[c]=N[d]=N[u]=N[h]=N[p]=N[f]=N[g]=!1;function X(D){return t(D)&&e(D.length)&&!!N[r(D)]}return hr=X,hr}var fr,xl;function tf(){if(xl)return fr;xl=1;function r(e){return function(t){return e(t)}}return fr=r,fr}var Ut={exports:{}};Ut.exports;var Cl;function of(){return Cl||(Cl=1,(function(r,e){var t=Sa(),o=e&&!e.nodeType&&e,n=o&&!0&&r&&!r.nodeType&&r,i=n&&n.exports===o,s=i&&t.process,a=(function(){try{var l=n&&n.require&&n.require("util").types;return l||s&&s.binding&&s.binding("util")}catch(c){}})();r.exports=a})(Ut,Ut.exports)),Ut.exports}var pr,El;function wo(){if(El)return pr;El=1;var r=ef(),e=tf(),t=of(),o=t&&t.isTypedArray,n=o?e(o):r;return pr=n,pr}var gr,Sl;function nf(){if(Sl)return gr;Sl=1;var r=ll(),e=rr(),t=ar(),o=St(),n=At(),i=yo(),s=ko(),a=wo(),l="[object Map]",c="[object Set]",d=Object.prototype,u=d.hasOwnProperty;function h(p){if(p==null)return!0;if(n(p)&&(o(p)||typeof p=="string"||typeof p.splice=="function"||i(p)||a(p)||t(p)))return!p.length;var f=e(p);if(f==l||f==c)return!p.size;if(s(p))return!r(p).length;for(var g in p)if(u.call(p,g))return!1;return!0}return gr=h,gr}var rf=nf();const sf=G(rf);var mr,Al;function af(){if(Al)return mr;Al=1;function r(){this.__data__=[],this.size=0}return mr=r,mr}var br,Il;function Kt(){if(Il)return br;Il=1;function r(e,t){return e===t||e!==e&&t!==t}return br=r,br}var vr,Rl;function To(){if(Rl)return vr;Rl=1;var r=Kt();function e(t,o){for(var n=t.length;n--;)if(r(t[n][0],o))return n;return-1}return vr=e,vr}var kr,Nl;function lf(){if(Nl)return kr;Nl=1;var r=To(),e=Array.prototype,t=e.splice;function o(n){var i=this.__data__,s=r(i,n);if(s<0)return!1;var a=i.length-1;return s==a?i.pop():t.call(i,s,1),--this.size,!0}return kr=o,kr}var yr,Ol;function cf(){if(Ol)return yr;Ol=1;var r=To();function e(t){var o=this.__data__,n=r(o,t);return n<0?void 0:o[n][1]}return yr=e,yr}var wr,_l;function df(){if(_l)return wr;_l=1;var r=To();function e(t){return r(this.__data__,t)>-1}return wr=e,wr}var Tr,Ll;function uf(){if(Ll)return Tr;Ll=1;var r=To();function e(t,o){var n=this.__data__,i=r(n,t);return i<0?(++this.size,n.push([t,o])):n[i][1]=o,this}return Tr=e,Tr}var Br,Dl;function Bo(){if(Dl)return Br;Dl=1;var r=af(),e=lf(),t=cf(),o=df(),n=uf();function i(s){var a=-1,l=s==null?0:s.length;for(this.clear();++a<l;){var c=s[a];this.set(c[0],c[1])}}return i.prototype.clear=r,i.prototype.delete=e,i.prototype.get=t,i.prototype.has=o,i.prototype.set=n,Br=i,Br}var xr,Ml;function hf(){if(Ml)return xr;Ml=1;var r=Bo();function e(){this.__data__=new r,this.size=0}return xr=e,xr}var Cr,Pl;function ff(){if(Pl)return Cr;Pl=1;function r(e){var t=this.__data__,o=t.delete(e);return this.size=t.size,o}return Cr=r,Cr}var Er,Fl;function pf(){if(Fl)return Er;Fl=1;function r(e){return this.__data__.get(e)}return Er=r,Er}var Sr,Hl;function gf(){if(Hl)return Sr;Hl=1;function r(e){return this.__data__.has(e)}return Sr=r,Sr}var Ar,ql;function xo(){if(ql)return Ar;ql=1;var r=ht(),e=r(Object,"create");return Ar=e,Ar}var Ir,zl;function mf(){if(zl)return Ir;zl=1;var r=xo();function e(){this.__data__=r?r(null):{},this.size=0}return Ir=e,Ir}var Rr,jl;function bf(){if(jl)return Rr;jl=1;function r(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}return Rr=r,Rr}var Nr,Ul;function vf(){if(Ul)return Nr;Ul=1;var r=xo(),e="__lodash_hash_undefined__",t=Object.prototype,o=t.hasOwnProperty;function n(i){var s=this.__data__;if(r){var a=s[i];return a===e?void 0:a}return o.call(s,i)?s[i]:void 0}return Nr=n,Nr}var Or,Kl;function kf(){if(Kl)return Or;Kl=1;var r=xo(),e=Object.prototype,t=e.hasOwnProperty;function o(n){var i=this.__data__;return r?i[n]!==void 0:t.call(i,n)}return Or=o,Or}var _r,Wl;function yf(){if(Wl)return _r;Wl=1;var r=xo(),e="__lodash_hash_undefined__";function t(o,n){var i=this.__data__;return this.size+=this.has(o)?0:1,i[o]=r&&n===void 0?e:n,this}return _r=t,_r}var Lr,Gl;function wf(){if(Gl)return Lr;Gl=1;var r=mf(),e=bf(),t=vf(),o=kf(),n=yf();function i(s){var a=-1,l=s==null?0:s.length;for(this.clear();++a<l;){var c=s[a];this.set(c[0],c[1])}}return i.prototype.clear=r,i.prototype.delete=e,i.prototype.get=t,i.prototype.has=o,i.prototype.set=n,Lr=i,Lr}var Dr,$l;function Tf(){if($l)return Dr;$l=1;var r=wf(),e=Bo(),t=Qn();function o(){this.size=0,this.__data__={hash:new r,map:new(t||e),string:new r}}return Dr=o,Dr}var Mr,Vl;function Bf(){if(Vl)return Mr;Vl=1;function r(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}return Mr=r,Mr}var Pr,Xl;function Co(){if(Xl)return Pr;Xl=1;var r=Bf();function e(t,o){var n=t.__data__;return r(o)?n[typeof o=="string"?"string":"hash"]:n.map}return Pr=e,Pr}var Fr,Yl;function xf(){if(Yl)return Fr;Yl=1;var r=Co();function e(t){var o=r(this,t).delete(t);return this.size-=o?1:0,o}return Fr=e,Fr}var Hr,Zl;function Cf(){if(Zl)return Hr;Zl=1;var r=Co();function e(t){return r(this,t).get(t)}return Hr=e,Hr}var qr,Jl;function Ef(){if(Jl)return qr;Jl=1;var r=Co();function e(t){return r(this,t).has(t)}return qr=e,qr}var zr,Ql;function Sf(){if(Ql)return zr;Ql=1;var r=Co();function e(t,o){var n=r(this,t),i=n.size;return n.set(t,o),this.size+=n.size==i?0:1,this}return zr=e,zr}var jr,ec;function tc(){if(ec)return jr;ec=1;var r=Tf(),e=xf(),t=Cf(),o=Ef(),n=Sf();function i(s){var a=-1,l=s==null?0:s.length;for(this.clear();++a<l;){var c=s[a];this.set(c[0],c[1])}}return i.prototype.clear=r,i.prototype.delete=e,i.prototype.get=t,i.prototype.has=o,i.prototype.set=n,jr=i,jr}var Ur,oc;function Af(){if(oc)return Ur;oc=1;var r=Bo(),e=Qn(),t=tc(),o=200;function n(i,s){var a=this.__data__;if(a instanceof r){var l=a.__data__;if(!e||l.length<o-1)return l.push([i,s]),this.size=++a.size,this;a=this.__data__=new t(l)}return a.set(i,s),this.size=a.size,this}return Ur=n,Ur}var Kr,nc;function rc(){if(nc)return Kr;nc=1;var r=Bo(),e=hf(),t=ff(),o=pf(),n=gf(),i=Af();function s(a){var l=this.__data__=new r(a);this.size=l.size}return s.prototype.clear=e,s.prototype.delete=t,s.prototype.get=o,s.prototype.has=n,s.prototype.set=i,Kr=s,Kr}var Wr,ic;function If(){if(ic)return Wr;ic=1;var r="__lodash_hash_undefined__";function e(t){return this.__data__.set(t,r),this}return Wr=e,Wr}var Gr,sc;function Rf(){if(sc)return Gr;sc=1;function r(e){return this.__data__.has(e)}return Gr=r,Gr}var $r,ac;function Nf(){if(ac)return $r;ac=1;var r=tc(),e=If(),t=Rf();function o(n){var i=-1,s=n==null?0:n.length;for(this.__data__=new r;++i<s;)this.add(n[i])}return o.prototype.add=o.prototype.push=e,o.prototype.has=t,$r=o,$r}var Vr,lc;function Of(){if(lc)return Vr;lc=1;function r(e,t){for(var o=-1,n=e==null?0:e.length;++o<n;)if(t(e[o],o,e))return!0;return!1}return Vr=r,Vr}var Xr,cc;function _f(){if(cc)return Xr;cc=1;function r(e,t){return e.has(t)}return Xr=r,Xr}var Yr,dc;function uc(){if(dc)return Yr;dc=1;var r=Nf(),e=Of(),t=_f(),o=1,n=2;function i(s,a,l,c,d,u){var h=l&o,p=s.length,f=a.length;if(p!=f&&!(h&&f>p))return!1;var g=u.get(s),b=u.get(a);if(g&&b)return g==a&&b==s;var k=-1,y=!0,x=l&n?new r:void 0;for(u.set(s,a),u.set(a,s);++k<p;){var T=s[k],R=a[k];if(c)var C=h?c(R,T,k,a,s,u):c(T,R,k,s,a,u);if(C!==void 0){if(C)continue;y=!1;break}if(x){if(!e(a,function(E,w){if(!t(x,w)&&(T===E||d(T,E,l,c,u)))return x.push(w)})){y=!1;break}}else if(!(T===R||d(T,R,l,c,u))){y=!1;break}}return u.delete(s),u.delete(a),y}return Yr=i,Yr}var Zr,hc;function fc(){if(hc)return Zr;hc=1;var r=He(),e=r.Uint8Array;return Zr=e,Zr}var Jr,pc;function gc(){if(pc)return Jr;pc=1;function r(e){var t=-1,o=Array(e.size);return e.forEach(function(n,i){o[++t]=[i,n]}),o}return Jr=r,Jr}var Qr,mc;function bc(){if(mc)return Qr;mc=1;function r(e){var t=-1,o=Array(e.size);return e.forEach(function(n){o[++t]=n}),o}return Qr=r,Qr}var ei,vc;function Lf(){if(vc)return ei;vc=1;var r=bo(),e=fc(),t=Kt(),o=uc(),n=gc(),i=bc(),s=1,a=2,l="[object Boolean]",c="[object Date]",d="[object Error]",u="[object Map]",h="[object Number]",p="[object RegExp]",f="[object Set]",g="[object String]",b="[object Symbol]",k="[object ArrayBuffer]",y="[object DataView]",x=r?r.prototype:void 0,T=x?x.valueOf:void 0;function R(C,E,w,_,F,N,X){switch(w){case y:if(C.byteLength!=E.byteLength||C.byteOffset!=E.byteOffset)return!1;C=C.buffer,E=E.buffer;case k:return!(C.byteLength!=E.byteLength||!N(new e(C),new e(E)));case l:case c:case h:return t(+C,+E);case d:return C.name==E.name&&C.message==E.message;case p:case g:return C==E+"";case u:var D=n;case f:var J=_&s;if(D||(D=i),C.size!=E.size&&!J)return!1;var ne=X.get(C);if(ne)return ne==E;_|=a,X.set(C,E);var re=o(D(C),D(E),_,F,N,X);return X.delete(C),re;case b:if(T)return T.call(C)==T.call(E)}return!1}return ei=R,ei}var ti,kc;function Df(){if(kc)return ti;kc=1;function r(e,t){for(var o=-1,n=t.length,i=e.length;++o<n;)e[i+o]=t[o];return e}return ti=r,ti}var oi,yc;function Mf(){if(yc)return oi;yc=1;var r=Df(),e=St();function t(o,n,i){var s=n(o);return e(o)?s:r(s,i(o))}return oi=t,oi}var ni,wc;function Pf(){if(wc)return ni;wc=1;function r(e,t){for(var o=-1,n=e==null?0:e.length,i=0,s=[];++o<n;){var a=e[o];t(a,o,e)&&(s[i++]=a)}return s}return ni=r,ni}var ri,Tc;function Ff(){if(Tc)return ri;Tc=1;function r(){return[]}return ri=r,ri}var ii,Bc;function Hf(){if(Bc)return ii;Bc=1;var r=Pf(),e=Ff(),t=Object.prototype,o=t.propertyIsEnumerable,n=Object.getOwnPropertySymbols,i=n?function(s){return s==null?[]:(s=Object(s),r(n(s),function(a){return o.call(s,a)}))}:e;return ii=i,ii}var si,xc;function qf(){if(xc)return si;xc=1;function r(e,t){for(var o=-1,n=Array(e);++o<e;)n[o]=t(o);return n}return si=r,si}var ai,Cc;function Ec(){if(Cc)return ai;Cc=1;var r=9007199254740991,e=/^(?:0|[1-9]\d*)$/;function t(o,n){var i=typeof o;return n=n==null?r:n,!!n&&(i=="number"||i!="symbol"&&e.test(o))&&o>-1&&o%1==0&&o<n}return ai=t,ai}var li,Sc;function Ac(){if(Sc)return li;Sc=1;var r=qf(),e=ar(),t=St(),o=yo(),n=Ec(),i=wo(),s=Object.prototype,a=s.hasOwnProperty;function l(c,d){var u=t(c),h=!u&&e(c),p=!u&&!h&&o(c),f=!u&&!h&&!p&&i(c),g=u||h||p||f,b=g?r(c.length,String):[],k=b.length;for(var y in c)(d||a.call(c,y))&&!(g&&(y=="length"||p&&(y=="offset"||y=="parent")||f&&(y=="buffer"||y=="byteLength"||y=="byteOffset")||n(y,k)))&&b.push(y);return b}return li=l,li}var ci,Ic;function Rc(){if(Ic)return ci;Ic=1;var r=Ac(),e=ll(),t=At();function o(n){return t(n)?r(n):e(n)}return ci=o,ci}var di,Nc;function zf(){if(Nc)return di;Nc=1;var r=Mf(),e=Hf(),t=Rc();function o(n){return r(n,t,e)}return di=o,di}var ui,Oc;function jf(){if(Oc)return ui;Oc=1;var r=zf(),e=1,t=Object.prototype,o=t.hasOwnProperty;function n(i,s,a,l,c,d){var u=a&e,h=r(i),p=h.length,f=r(s),g=f.length;if(p!=g&&!u)return!1;for(var b=p;b--;){var k=h[b];if(!(u?k in s:o.call(s,k)))return!1}var y=d.get(i),x=d.get(s);if(y&&x)return y==s&&x==i;var T=!0;d.set(i,s),d.set(s,i);for(var R=u;++b<p;){k=h[b];var C=i[k],E=s[k];if(l)var w=u?l(E,C,k,s,i,d):l(C,E,k,i,s,d);if(!(w===void 0?C===E||c(C,E,a,l,d):w)){T=!1;break}R||(R=k=="constructor")}if(T&&!R){var _=i.constructor,F=s.constructor;_!=F&&"constructor"in i&&"constructor"in s&&!(typeof _=="function"&&_ instanceof _&&typeof F=="function"&&F instanceof F)&&(T=!1)}return d.delete(i),d.delete(s),T}return ui=n,ui}var hi,_c;function Uf(){if(_c)return hi;_c=1;var r=rc(),e=uc(),t=Lf(),o=jf(),n=rr(),i=St(),s=yo(),a=wo(),l=1,c="[object Arguments]",d="[object Array]",u="[object Object]",h=Object.prototype,p=h.hasOwnProperty;function f(g,b,k,y,x,T){var R=i(g),C=i(b),E=R?d:n(g),w=C?d:n(b);E=E==c?u:E,w=w==c?u:w;var _=E==u,F=w==u,N=E==w;if(N&&s(g)){if(!s(b))return!1;R=!0,_=!1}if(N&&!_)return T||(T=new r),R||a(g)?e(g,b,k,y,x,T):t(g,b,E,k,y,x,T);if(!(k&l)){var X=_&&p.call(g,"__wrapped__"),D=F&&p.call(b,"__wrapped__");if(X||D){var J=X?g.value():g,ne=D?b.value():b;return T||(T=new r),x(J,ne,k,y,T)}}return N?(T||(T=new r),o(g,b,k,y,x,T)):!1}return hi=f,hi}var fi,Lc;function Kf(){if(Lc)return fi;Lc=1;var r=Uf(),e=We();function t(o,n,i,s,a){return o===n?!0:o==null||n==null||!e(o)&&!e(n)?o!==o&&n!==n:r(o,n,i,s,t,a)}return fi=t,fi}var pi,Dc;function Wf(){if(Dc)return pi;Dc=1;var r=Kf();function e(t,o){return r(t,o)}return pi=e,pi}var Gf=Wf();const $f=G(Gf);var Vf=vo();const Xf=G(Vf);var gi,Mc;function Yf(){if(Mc)return gi;Mc=1;var r=Xe(),e=We(),t="[object Number]";function o(n){return typeof n=="number"||e(n)&&r(n)==t}return gi=o,gi}var Zf=Yf();const Jf=G(Zf);var mi,Pc;function Fc(){if(Pc)return mi;Pc=1;var r=il(),e=r(Object.getPrototypeOf,Object);return mi=e,mi}var bi,Hc;function qc(){if(Hc)return bi;Hc=1;var r=Xe(),e=Fc(),t=We(),o="[object Object]",n=Function.prototype,i=Object.prototype,s=n.toString,a=i.hasOwnProperty,l=s.call(Object);function c(d){if(!t(d)||r(d)!=o)return!1;var u=e(d);if(u===null)return!0;var h=a.call(u,"constructor")&&u.constructor;return typeof h=="function"&&h instanceof h&&s.call(h)==l}return bi=c,bi}var Qf=qc();const ep=G(Qf);var vi,zc;function jc(){if(zc)return vi;zc=1;var r=Xe(),e=St(),t=We(),o="[object String]";function n(i){return typeof i=="string"||!e(i)&&t(i)&&r(i)==o}return vi=n,vi}var tp=jc();const op=G(tp);var ki,Uc;function np(){if(Uc)return ki;Uc=1;function r(e){return e===void 0}return ki=r,ki}var rp=np();const ip=G(rp);var yi,Kc;function wi(){if(Kc)return yi;Kc=1;var r=Ua();function e(t,o,n){o=="__proto__"&&r?r(t,o,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[o]=n}return yi=e,yi}var Ti,Wc;function Gc(){if(Wc)return Ti;Wc=1;var r=wi(),e=Kt();function t(o,n,i){(i!==void 0&&!e(o[n],i)||i===void 0&&!(n in o))&&r(o,n,i)}return Ti=t,Ti}var Bi,$c;function sp(){if($c)return Bi;$c=1;function r(e){return function(t,o,n){for(var i=-1,s=Object(t),a=n(t),l=a.length;l--;){var c=a[e?l:++i];if(o(s[c],c,s)===!1)break}return t}}return Bi=r,Bi}var xi,Vc;function ap(){if(Vc)return xi;Vc=1;var r=sp(),e=r();return xi=e,xi}var Wt={exports:{}};Wt.exports;var Xc;function lp(){return Xc||(Xc=1,(function(r,e){var t=He(),o=e&&!e.nodeType&&e,n=o&&!0&&r&&!r.nodeType&&r,i=n&&n.exports===o,s=i?t.Buffer:void 0,a=s?s.allocUnsafe:void 0;function l(c,d){if(d)return c.slice();var u=c.length,h=a?a(u):new c.constructor(u);return c.copy(h),h}r.exports=l})(Wt,Wt.exports)),Wt.exports}var Ci,Yc;function cp(){if(Yc)return Ci;Yc=1;var r=fc();function e(t){var o=new t.constructor(t.byteLength);return new r(o).set(new r(t)),o}return Ci=e,Ci}var Ei,Zc;function dp(){if(Zc)return Ei;Zc=1;var r=cp();function e(t,o){var n=o?r(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}return Ei=e,Ei}var Si,Jc;function Qc(){if(Jc)return Si;Jc=1;function r(e,t){var o=-1,n=e.length;for(t||(t=Array(n));++o<n;)t[o]=e[o];return t}return Si=r,Si}var Ai,ed;function up(){if(ed)return Ai;ed=1;var r=Ke(),e=Object.create,t=(function(){function o(){}return function(n){if(!r(n))return{};if(e)return e(n);o.prototype=n;var i=new o;return o.prototype=void 0,i}})();return Ai=t,Ai}var Ii,td;function hp(){if(td)return Ii;td=1;var r=up(),e=Fc(),t=ko();function o(n){return typeof n.constructor=="function"&&!t(n)?r(e(n)):{}}return Ii=o,Ii}var Ri,od;function fp(){if(od)return Ri;od=1;var r=At(),e=We();function t(o){return e(o)&&r(o)}return Ri=t,Ri}var Ni,nd;function rd(){if(nd)return Ni;nd=1;function r(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}return Ni=r,Ni}var Oi,id;function pp(){if(id)return Oi;id=1;var r=wi(),e=Kt(),t=Object.prototype,o=t.hasOwnProperty;function n(i,s,a){var l=i[s];(!(o.call(i,s)&&e(l,a))||a===void 0&&!(s in i))&&r(i,s,a)}return Oi=n,Oi}var _i,sd;function gp(){if(sd)return _i;sd=1;var r=pp(),e=wi();function t(o,n,i,s){var a=!i;i||(i={});for(var l=-1,c=n.length;++l<c;){var d=n[l],u=s?s(i[d],o[d],d,i,o):void 0;u===void 0&&(u=o[d]),a?e(i,d,u):r(i,d,u)}return i}return _i=t,_i}var Li,ad;function mp(){if(ad)return Li;ad=1;function r(e){var t=[];if(e!=null)for(var o in Object(e))t.push(o);return t}return Li=r,Li}var Di,ld;function bp(){if(ld)return Di;ld=1;var r=Ke(),e=ko(),t=mp(),o=Object.prototype,n=o.hasOwnProperty;function i(s){if(!r(s))return t(s);var a=e(s),l=[];for(var c in s)c=="constructor"&&(a||!n.call(s,c))||l.push(c);return l}return Di=i,Di}var Mi,cd;function dd(){if(cd)return Mi;cd=1;var r=Ac(),e=bp(),t=At();function o(n){return t(n)?r(n,!0):e(n)}return Mi=o,Mi}var Pi,ud;function vp(){if(ud)return Pi;ud=1;var r=gp(),e=dd();function t(o){return r(o,e(o))}return Pi=t,Pi}var Fi,hd;function kp(){if(hd)return Fi;hd=1;var r=Gc(),e=lp(),t=dp(),o=Qc(),n=hp(),i=ar(),s=St(),a=fp(),l=yo(),c=vo(),d=Ke(),u=qc(),h=wo(),p=rd(),f=vp();function g(b,k,y,x,T,R,C){var E=p(b,y),w=p(k,y),_=C.get(w);if(_){r(b,y,_);return}var F=R?R(E,w,y+"",b,k,C):void 0,N=F===void 0;if(N){var X=s(w),D=!X&&l(w),J=!X&&!D&&h(w);F=w,X||D||J?s(E)?F=E:a(E)?F=o(E):D?(N=!1,F=e(w,!0)):J?(N=!1,F=t(w,!0)):F=[]:u(w)||i(w)?(F=E,i(E)?F=f(E):(!d(E)||c(E))&&(F=n(w))):N=!1}N&&(C.set(w,F),T(F,w,x,R,C),C.delete(w)),r(b,y,F)}return Fi=g,Fi}var Hi,fd;function yp(){if(fd)return Hi;fd=1;var r=rc(),e=Gc(),t=ap(),o=kp(),n=Ke(),i=dd(),s=rd();function a(l,c,d,u,h){l!==c&&t(c,function(p,f){if(h||(h=new r),n(p))o(l,c,f,d,a,u,h);else{var g=u?u(s(l,f),p,f+"",l,c,h):void 0;g===void 0&&(g=p),e(l,f,g)}},i)}return Hi=a,Hi}var qi,pd;function wp(){if(pd)return qi;pd=1;var r=Kt(),e=At(),t=Ec(),o=Ke();function n(i,s,a){if(!o(a))return!1;var l=typeof s;return(l=="number"?e(a)&&t(s,a.length):l=="string"&&s in a)?r(a[s],i):!1}return qi=n,qi}var zi,gd;function Tp(){if(gd)return zi;gd=1;var r=Va(),e=wp();function t(o){return r(function(n,i){var s=-1,a=i.length,l=a>1?i[a-1]:void 0,c=a>2?i[2]:void 0;for(l=o.length>3&&typeof l=="function"?(a--,l):void 0,c&&e(i[0],i[1],c)&&(l=a<3?void 0:l,a=1),n=Object(n);++s<a;){var d=i[s];d&&o(n,d,s,l)}return n})}return zi=t,zi}var ji,md;function Bp(){if(md)return ji;md=1;var r=yp(),e=Tp(),t=e(function(o,n,i,s){r(o,n,i,s)});return ji=t,ji}var xp=Bp();const Cp=G(xp);var Ui,bd;function Ep(){if(bd)return Ui;bd=1;var r=He(),e=function(){return r.Date.now()};return Ui=e,Ui}var Ki,vd;function Sp(){if(vd)return Ki;vd=1;var r=Ke(),e=Ep(),t=el(),o="Expected a function",n=Math.max,i=Math.min;function s(a,l,c){var d,u,h,p,f,g,b=0,k=!1,y=!1,x=!0;if(typeof a!="function")throw new TypeError(o);l=t(l)||0,r(c)&&(k=!!c.leading,y="maxWait"in c,h=y?n(t(c.maxWait)||0,l):h,x="trailing"in c?!!c.trailing:x);function T(D){var J=d,ne=u;return d=u=void 0,b=D,p=a.apply(ne,J),p}function R(D){return b=D,f=setTimeout(w,l),k?T(D):p}function C(D){var J=D-g,ne=D-b,re=l-J;return y?i(re,h-ne):re}function E(D){var J=D-g,ne=D-b;return g===void 0||J>=l||J<0||y&&ne>=h}function w(){var D=e();if(E(D))return _(D);f=setTimeout(w,C(D))}function _(D){return f=void 0,x&&d?T(D):(d=u=void 0,p)}function F(){f!==void 0&&clearTimeout(f),b=0,d=g=u=f=void 0}function N(){return f===void 0?p:_(e())}function X(){var D=e(),J=E(D);if(d=arguments,u=this,g=D,J){if(f===void 0)return R(g);if(y)return clearTimeout(f),f=setTimeout(w,l),T(g)}return f===void 0&&(f=setTimeout(w,l)),p}return X.cancel=F,X.flush=N,X}return Ki=s,Ki}var Wi,kd;function Ap(){if(kd)return Wi;kd=1;var r=Sp(),e=Ke(),t="Expected a function";function o(n,i,s){var a=!0,l=!0;if(typeof n!="function")throw new TypeError(t);return e(s)&&(a="leading"in s?!!s.leading:a,l="trailing"in s?!!s.trailing:l),r(n,i,{leading:a,maxWait:i,trailing:l})}return Wi=o,Wi}var Ip=Ap();const Rp=G(Ip);var Gi,yd;function Np(){if(yd)return Gi;yd=1;function r(e){for(var t,o=[];!(t=e.next()).done;)o.push(t.value);return o}return Gi=r,Gi}var $i,wd;function Op(){if(wd)return $i;wd=1;function r(e){return e.split("")}return $i=r,$i}var Vi,Td;function _p(){if(Td)return Vi;Td=1;var r="\\ud800-\\udfff",e="\\u0300-\\u036f",t="\\ufe20-\\ufe2f",o="\\u20d0-\\u20ff",n=e+t+o,i="\\ufe0e\\ufe0f",s="\\u200d",a=RegExp("["+s+r+n+i+"]");function l(c){return a.test(c)}return Vi=l,Vi}var Xi,Bd;function Lp(){if(Bd)return Xi;Bd=1;var r="\\ud800-\\udfff",e="\\u0300-\\u036f",t="\\ufe20-\\ufe2f",o="\\u20d0-\\u20ff",n=e+t+o,i="\\ufe0e\\ufe0f",s="["+r+"]",a="["+n+"]",l="\\ud83c[\\udffb-\\udfff]",c="(?:"+a+"|"+l+")",d="[^"+r+"]",u="(?:\\ud83c[\\udde6-\\uddff]){2}",h="[\\ud800-\\udbff][\\udc00-\\udfff]",p="\\u200d",f=c+"?",g="["+i+"]?",b="(?:"+p+"(?:"+[d,u,h].join("|")+")"+g+f+")*",k=g+f+b,y="(?:"+[d+a+"?",a,u,h,s].join("|")+")",x=RegExp(l+"(?="+l+")|"+y+k,"g");function T(R){return R.match(x)||[]}return Xi=T,Xi}var Yi,xd;function Dp(){if(xd)return Yi;xd=1;var r=Op(),e=_p(),t=Lp();function o(n){return e(n)?t(n):r(n)}return Yi=o,Yi}var Zi,Cd;function Mp(){if(Cd)return Zi;Cd=1;function r(e,t){for(var o=-1,n=e==null?0:e.length,i=Array(n);++o<n;)i[o]=t(e[o],o,e);return i}return Zi=r,Zi}var Ji,Ed;function Pp(){if(Ed)return Ji;Ed=1;var r=Mp();function e(t,o){return r(o,function(n){return t[n]})}return Ji=e,Ji}var Qi,Sd;function Fp(){if(Sd)return Qi;Sd=1;var r=Pp(),e=Rc();function t(o){return o==null?[]:r(o,e(o))}return Qi=t,Qi}var es,Ad;function Hp(){if(Ad)return es;Ad=1;var r=bo(),e=Qc(),t=rr(),o=At(),n=jc(),i=Np(),s=gc(),a=bc(),l=Dp(),c=Fp(),d="[object Map]",u="[object Set]",h=r?r.iterator:void 0;function p(f){if(!f)return[];if(o(f))return n(f)?l(f):e(f);if(h&&f[h])return i(f[h]());var g=t(f),b=g==d?s:g==u?a:c;return b(f)}return es=p,es}var qp=Hp();const zp=G(qp);var Id=(r=>(r.VERBOSE="VERBOSE",r.INFO="INFO",r.WARN="WARN",r.ERROR="ERROR",r))(Id||{});const Eo=()=>"0.4.1-beta.5",I={BACKSPACE:8,TAB:9,ENTER:13,LEFT:37,UP:38,DOWN:40,RIGHT:39,DELETE:46},jp={LEFT:0},Up=1e8,Kp=16,Oe=(()=>{try{return Function("return this")()}catch(r){return}})();Oe&&typeof Oe.window=="undefined"&&(Oe.window=Oe);const So=()=>{if(Oe!=null&&Oe.window)return Oe.window},Rd=()=>{if(Oe!=null&&Oe.navigator)return Oe.navigator;const r=So();return r==null?void 0:r.navigator},Gt=(r,e,t="log",o,n="color: inherit")=>{const i=typeof console=="undefined"?void 0:console;if(!i||typeof i[t]!="function")return;const s=["info","log","warn","error"].includes(t),a=[];switch(Gt.logLevel){case"ERROR":if(t!=="error")return;break;case"WARN":if(!["error","warn"].includes(t))return;break;case"INFO":if(!s||r)return;break}o&&a.push(o);const l=`Blok ${Eo()}`,c=`line-height: 1em;
2
- color: #006FEA;
3
- display: inline-block;
4
- font-size: 11px;
5
- line-height: 1em;
6
- background-color: #fff;
7
- padding: 4px 9px;
8
- border-radius: 30px;
9
- border: 1px solid rgba(56, 138, 229, 0.16);
10
- margin: 4px 5px 4px 0;`,d=r?s?(a.unshift(c,n),`%c${l}%c ${e}`):`( ${l} )${e}`:e,u=s?o!==void 0?[`${d} %o`,...a]:[d,...a]:[d];try{i[t](...u)}catch(h){}};Gt.logLevel="VERBOSE";const Wp=r=>{Gt.logLevel=r},j=(r,e="log",t,o)=>{Gt(!1,r,e,t,o)},_e=(r,e="log",t,o)=>{Gt(!0,r,e,t,o)},V=r=>Xf(r),Z=r=>ep(r),qe=r=>op(r),Nd=r=>Gh(r),Od=r=>Jf(r),Gp=function(r){return ip(r)},le=r=>sf(r),_d=r=>zp(r),Ao=(r,e)=>function(...t){Uh(()=>r.apply(this,t),e)},$p=r=>{var e;return(e=r.name.split(".").pop())!=null?e:""},Vp=r=>/^[-\w]+\/([-+\w]+|\*)$/.test(r),Ld=(r,e,t)=>{const o={timeoutId:null};return function(...n){const i=()=>{o.timeoutId=null,r.apply(this,n)};o.timeoutId!==null&&clearTimeout(o.timeoutId),o.timeoutId=setTimeout(i,e)}},ts=(r,e,t)=>Rp(r,e,t),Dd=()=>{var n,i;const r={win:!1,mac:!1,x11:!1,linux:!1},e=Rd(),t=(i=(n=e==null?void 0:e.userAgent)==null?void 0:n.toLowerCase())!=null?i:"",o=t?Object.keys(r).find(s=>t.indexOf(s)!==-1):void 0;return o!==void 0&&(r[o]=!0),r},Io=r=>r&&r.slice(0,1).toUpperCase()+r.slice(1),Xp=(r,e)=>{if(Array.isArray(e))return e},$t=(r,...e)=>!Z(r)||e.length===0?r:e.reduce((t,o)=>Z(o)?Cp(t,o,Xp):t,r),Md=r=>{const e=Dd(),t=r.replace(/shift/gi,"⇧").replace(/backspace/gi,"⌫").replace(/enter/gi,"⏎").replace(/up/gi,"↑").replace(/left/gi,"→").replace(/down/gi,"↓").replace(/right/gi,"←").replace(/escape/gi,"⎋").replace(/insert/gi,"Ins").replace(/delete/gi,"␡").replace(/\+/gi," + ");return e.mac?t.replace(/ctrl|cmd/gi,"⌘").replace(/alt/gi,"⌥"):t.replace(/cmd/gi,"Ctrl").replace(/windows/gi,"WIN")},Yp=r=>{try{return new URL(r).href}catch(t){}const e=So();return r.substring(0,2)==="//"?e?`${e.location.protocol}${r}`:r:e?`${e.location.origin}${r}`:r},Zp=()=>xh(10),Jp=r=>{const e=So();e&&e.open(r,"_blank")},Qp=(r="")=>`${r}${Math.floor(Math.random()*Up).toString(Kp)}`,Pd=650,rt=()=>{const r=So();return!r||typeof r.matchMedia!="function"?!1:r.matchMedia(`(max-width: ${Pd}px)`).matches},os=(()=>{var l;const r=Rd();if(!r)return!1;const e=r.userAgent||"",t=r.userAgentData,o=t==null?void 0:t.platform;if(/iP(ad|hone|od)/.test(e)||o!==void 0&&o!==""&&/iP(ad|hone|od)/.test(o))return!0;const n=((l=r.maxTouchPoints)!=null?l:0)>1,i=()=>r.platform,s=o!==void 0&&o!==""?o:void 0;return(n?s!=null?s:i():void 0)==="MacIntel"})(),eg=(r,e)=>$f(r,e);class v{static isSingleTag(e){return!!e.tagName&&["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"].includes(e.tagName)}static isLineBreakTag(e){return!!e&&["BR","WBR"].includes(e.tagName)}static isValidClassName(e){if(e===""||/\s/.test(e))return!1;try{return document.createElement("div").classList.add(e),!0}catch(t){return!1}}static safelyAddClasses(e,t){const o=[],n=[];for(const i of t)v.isValidClassName(i)?o.push(i):n.push(i);if(o.length>0&&e.classList.add(...o),n.length>0){const i=e.className,s=i?`${i} ${n.join(" ")}`:n.join(" ");e.setAttribute("class",s)}}static make(e,t=null,o={}){const n=document.createElement(e);if(Array.isArray(t)){const i=t.filter(s=>s!==void 0&&s!=="").flatMap(s=>s.split(" ")).filter(s=>s!=="");v.safelyAddClasses(n,i)}if(typeof t=="string"&&t!==""){const i=t.split(" ").filter(s=>s!=="");v.safelyAddClasses(n,i)}for(const i in o){if(!Object.prototype.hasOwnProperty.call(o,i))continue;const s=o[i];if(s!=null){if(i in n){n[i]=s;continue}n.setAttribute(i,String(s))}}return n}static text(e){return document.createTextNode(e)}static append(e,t){Array.isArray(t)?t.forEach(o=>e.appendChild(o)):e.appendChild(t)}static prepend(e,t){Array.isArray(t)?[...t].reverse().forEach(n=>e.prepend(n)):e.prepend(t)}static find(e=document,t){return e.querySelector(t)}static get(e){return document.getElementById(e)}static findAll(e=document,t){return e.querySelectorAll(t)}static get allInputsSelector(){return"[contenteditable=true], textarea, input:not([type]), "+["text","password","email","number","search","tel","url"].map(t=>`input[type="${t}"]`).join(", ")}static findAllInputs(e){return _d(e.querySelectorAll(v.allInputsSelector)).reduce((t,o)=>v.isNativeInput(o)||v.containsOnlyInlineElements(o)?[...t,o]:[...t,...v.getDeepestBlockElements(o)],[])}static getDeepestNode(e,t=!1){var d;const o=t?"lastChild":"firstChild",n=t?"previousSibling":"nextSibling";if(e===null||e.nodeType!==Node.ELEMENT_NODE)return e;const i=e[o];if(i===null)return e;const s=i;if(!(v.isSingleTag(s)&&!v.isNativeInput(s)&&!v.isLineBreakTag(s)))return this.getDeepestNode(s,t);const l=s[n];if(l)return this.getDeepestNode(l,t);const c=(d=s.parentNode)==null?void 0:d[n];return c?this.getDeepestNode(c,t):s.parentNode}static isElement(e){return Od(e)?!1:e!=null&&e.nodeType!=null&&e.nodeType===Node.ELEMENT_NODE}static isFragment(e){return Od(e)?!1:e!=null&&e.nodeType!=null&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}static isContentEditable(e){return e.contentEditable==="true"}static isNativeInput(e){const t=["INPUT","TEXTAREA"];return e!=null&&typeof e.tagName=="string"?t.includes(e.tagName):!1}static canSetCaret(e){return v.isNativeInput(e)?!new Set(["file","checkbox","radio","hidden","submit","button","image","reset"]).has(e.type):v.isContentEditable(e)}static isNodeEmpty(e,t){var i,s;if(this.isSingleTag(e)&&!this.isLineBreakTag(e))return!1;const o=this.isElement(e)&&this.isNativeInput(e)?e.value:(i=e.textContent)==null?void 0:i.replace("​",""),n=t?o==null?void 0:o.replace(new RegExp(t,"g"),""):o;return((s=n==null?void 0:n.length)!=null?s:0)===0}static isLeaf(e){return e?e.childNodes.length===0:!1}static isEmpty(e,t){const o=[e];for(;o.length>0;){const n=o.shift();if(n){if(this.isLeaf(n)&&!this.isNodeEmpty(n,t))return!1;n.childNodes&&o.push(...Array.from(n.childNodes))}}return!0}static isHTMLString(e){const t=v.make("div");return t.innerHTML=e,t.childElementCount>0}static getContentLength(e){var t,o;return v.isNativeInput(e)?e.value.length:e.nodeType===Node.TEXT_NODE?e.length:(o=(t=e.textContent)==null?void 0:t.length)!=null?o:0}static get blockElements(){return["address","article","aside","blockquote","canvas","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","li","main","nav","noscript","ol","output","p","pre","ruby","section","table","tbody","thead","tr","tfoot","ul","video"]}static containsOnlyInlineElements(e){const t=qe(e)?(()=>{const n=document.createElement("div");return n.innerHTML=e,n})():e,o=n=>!v.blockElements.includes(n.tagName.toLowerCase())&&Array.from(n.children).every(o);return Array.from(t.children).every(o)}static getDeepestBlockElements(e){return v.containsOnlyInlineElements(e)?[e]:Array.from(e.children).reduce((t,o)=>[...t,...v.getDeepestBlockElements(o)],[])}static getHolder(e){if(!qe(e))return e;const t=document.getElementById(e);if(t!==null)return t;throw new Error(`Element with id "${e}" not found`)}static isAnchor(e){return e.tagName.toLowerCase()==="a"}static offset(e){const t=e.getBoundingClientRect(),o=window.scrollX||document.documentElement.scrollLeft,n=window.scrollY||document.documentElement.scrollTop,i=t.top+n,s=t.left+o;return{top:i,left:s,bottom:i+t.height,right:s+t.width}}static getNodeByOffset(e,t){const o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null),n=(c,d,u,h)=>{var b;if(!c&&u){const k=d-h,y=Math.max(t-k,0),x=Math.min(y,h);return{node:u,offset:x}}if(!c)return{node:null,offset:0};const f=((b=c.textContent)!=null?b:"").length;return d+f>=t?{node:c,offset:Math.min(t-d,f)}:n(o.nextNode(),d+f,c,f)},i=o.nextNode(),{node:s,offset:a}=n(i,0,null,0);if(!s)return{node:null,offset:0};const l=s.textContent;return!l||l.length===0?{node:null,offset:0}:{node:s,offset:a}}}const ns=r=>!/[^\t\n\r \u200B]/.test(r),tg=r=>{const e=window.getComputedStyle(r),t=parseFloat(e.fontSize),o=parseFloat(e.lineHeight)||t*1.2,n=parseFloat(e.paddingTop),i=parseFloat(e.borderTopWidth),s=parseFloat(e.marginTop),a=t*.8,l=(o-t)/2;return s+i+n+l+a},Fd=r=>{r.setAttribute("data-blok-empty",v.isEmpty(r)?"true":"false")},Hd={ui:{blockTunes:{toggler:{"Drag to move":"","Click to open the menu":""}},inlineToolbar:{converter:{"Convert to":""}},toolbar:{toolbox:{"Click to add below":"","Option-click to add above":"","Ctrl-click to add above":""}},popover:{Filter:"","Nothing found":"","Convert to":""}},toolNames:{Text:"",Link:"",Bold:"",Italic:""},tools:{link:{"Add a link":""},stub:{"The block can not be displayed correctly.":""}},blockTunes:{delete:{Delete:"","Click to delete":""},moveUp:{"Move up":""},moveDown:{"Move down":""}}},dt=class dt{static ui(e,t){return dt._t(e,t)}static t(e,t){return dt._t(e,t)}static setDictionary(e){dt.currentDictionary=e}static _t(e,t){const o=dt.getNamespace(e);return!o||!o[t]?t:o[t]}static getNamespace(e){return e.split(".").reduce((o,n)=>{if(!o||!Object.keys(o).length)return{};const i=o[n];return typeof i=="string"?{}:i},dt.currentDictionary)}};dt.currentDictionary=Hd;let ie=dt;class Vt extends Error{}class Xt{constructor(){this.subscribers={}}on(e,t){e in this.subscribers||(this.subscribers[e]=[]),this.subscribers[e].push(t)}once(e,t){e in this.subscribers||(this.subscribers[e]=[]);const o=n=>{const i=t(n),s=this.subscribers[e].indexOf(o);return s!==-1&&this.subscribers[e].splice(s,1),i};this.subscribers[e].push(o)}emit(e,t){le(this.subscribers)||!this.subscribers[e]||this.subscribers[e].reduce((o,n)=>{const i=n(o);return i!==void 0?i:o},t)}off(e,t){const o=this.subscribers[e];if(o===void 0){console.warn(`EventDispatcher .off(): there is no subscribers for event "${e.toString()}". Probably, .off() called before .on()`);return}const n=o.indexOf(t);n!==-1&&o.splice(n,1)}destroy(){this.subscribers={}}}const Ye=function(e){return Object.setPrototypeOf(this,{get id(){return e.id},get name(){return e.name},get config(){return e.config},get holder(){return e.holder},get isEmpty(){return e.isEmpty},get selected(){return e.selected},set stretched(o){e.setStretchState(o)},get stretched(){return e.stretched},get focusable(){return e.focusable},call(o,n){return e.call(o,n)},save(){return e.save()},validate(o){return e.validate(o)},dispatchChange(){e.dispatchChange()},getActiveToolboxEntry(){return e.getActiveToolboxEntry()}}),Object.defineProperties(this,{id:{get(){return e.id},enumerable:!0,configurable:!0},name:{get(){return e.name},enumerable:!0,configurable:!0}}),this};class Yt{constructor(){this.allListeners=[]}on(e,t,o,n=!1){if(this.findOne(e,t,o,n))return;const s=Qp("l"),a={id:s,element:e,eventType:t,handler:o,options:n};return this.allListeners.push(a),e.addEventListener(t,o,n),s}off(e,t,o,n){const i=this.findAll(e,t,o,n);i.forEach((s,a)=>{const l=this.allListeners.indexOf(i[a]);l>-1&&(this.allListeners.splice(l,1),s.element.removeEventListener(s.eventType,s.handler,s.options))})}offById(e){const t=this.findById(e);if(!t)return;t.element.removeEventListener(t.eventType,t.handler,t.options);const o=this.allListeners.indexOf(t);o>-1&&this.allListeners.splice(o,1)}findOne(e,t,o,n){var s;return(s=this.findAll(e,t,o,n)[0])!=null?s:null}findAll(e,t,o,n){return e?this.findByEventTarget(e).filter(s=>{const a=t===void 0||s.eventType===t,l=o===void 0||s.handler===o,c=this.areOptionsEqual(s.options,n);return a&&l&&c}):[]}removeAll(){this.allListeners.forEach(e=>{e.element.removeEventListener(e.eventType,e.handler,e.options)}),this.allListeners=[]}destroy(){this.removeAll()}findByEventTarget(e){return this.allListeners.filter(t=>t.element===e)}findByType(e){return this.allListeners.filter(t=>t.eventType===e)}findByHandler(e){return this.allListeners.filter(t=>t.handler===e)}findById(e){return this.allListeners.find(t=>t.id===e)}normalizeListenerOptions(e){var t,o,n;return typeof e=="boolean"?{capture:e,once:!1,passive:!1}:e?{capture:(t=e.capture)!=null?t:!1,once:(o=e.once)!=null?o:!1,passive:(n=e.passive)!=null?n:!1,signal:e.signal}:{capture:!1,once:!1,passive:!1}}areOptionsEqual(e,t){if(t===void 0)return!0;const o=this.normalizeListenerOptions(e),n=this.normalizeListenerOptions(t);return o.capture===n.capture&&o.once===n.once&&o.passive===n.passive&&o.signal===n.signal}}class z{constructor({config:e,eventsDispatcher:t}){if(this.nodes={},this.listeners=new Yt,this.readOnlyMutableListeners={on:(o,n,i,s=!1)=>{const a=this.listeners.on(o,n,i,s);a&&this.mutableListenerIds.push(a)},clearAll:()=>{for(const o of this.mutableListenerIds)this.listeners.offById(o);this.mutableListenerIds=[]}},this.mutableListenerIds=[],new.target===z)throw new TypeError("Constructors for abstract class Module are not allowed.");this.config=e,this.eventsDispatcher=t,this.Blok={}}set state(e){this.Blok=e}removeAllNodes(){for(const e in this.nodes){const t=this.nodes[e];t instanceof HTMLElement&&t.remove()}}get isRtl(){var e;return((e=this.config.i18n)==null?void 0:e.direction)==="rtl"}}const og=(r,e)=>{const t=new Array(r.length+e.length);for(let o=0;o<r.length;o++)t[o]=r[o];for(let o=0;o<e.length;o++)t[r.length+o]=e[o];return t},ng=(r,e)=>({classGroupId:r,validator:e}),qd=(r=new Map,e=null,t)=>({nextPart:r,validators:e,classGroupId:t}),Ro="-",zd=[],rg="arbitrary..",ig=r=>{const e=ag(r),{conflictingClassGroups:t,conflictingClassGroupModifiers:o}=r;return{getClassGroupId:s=>{if(s.startsWith("[")&&s.endsWith("]"))return sg(s);const a=s.split(Ro),l=a[0]===""&&a.length>1?1:0;return jd(a,l,e)},getConflictingClassGroupIds:(s,a)=>{if(a){const l=o[s],c=t[s];return l?c?og(c,l):l:c||zd}return t[s]||zd}}},jd=(r,e,t)=>{if(r.length-e===0)return t.classGroupId;const n=r[e],i=t.nextPart.get(n);if(i){const c=jd(r,e+1,i);if(c)return c}const s=t.validators;if(s===null)return;const a=e===0?r.join(Ro):r.slice(e).join(Ro),l=s.length;for(let c=0;c<l;c++){const d=s[c];if(d.validator(a))return d.classGroupId}},sg=r=>r.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=r.slice(1,-1),t=e.indexOf(":"),o=e.slice(0,t);return o?rg+o:void 0})(),ag=r=>{const{theme:e,classGroups:t}=r;return lg(t,e)},lg=(r,e)=>{const t=qd();for(const o in r){const n=r[o];rs(n,t,o,e)}return t},rs=(r,e,t,o)=>{const n=r.length;for(let i=0;i<n;i++){const s=r[i];cg(s,e,t,o)}},cg=(r,e,t,o)=>{if(typeof r=="string"){dg(r,e,t);return}if(typeof r=="function"){ug(r,e,t,o);return}hg(r,e,t,o)},dg=(r,e,t)=>{const o=r===""?e:Ud(e,r);o.classGroupId=t},ug=(r,e,t,o)=>{if(fg(r)){rs(r(o),e,t,o);return}e.validators===null&&(e.validators=[]),e.validators.push(ng(t,r))},hg=(r,e,t,o)=>{const n=Object.entries(r),i=n.length;for(let s=0;s<i;s++){const[a,l]=n[s];rs(l,Ud(e,a),t,o)}},Ud=(r,e)=>{let t=r;const o=e.split(Ro),n=o.length;for(let i=0;i<n;i++){const s=o[i];let a=t.nextPart.get(s);a||(a=qd(),t.nextPart.set(s,a)),t=a}return t},fg=r=>"isThemeGetter"in r&&r.isThemeGetter===!0,pg=r=>{if(r<1)return{get:()=>{},set:()=>{}};let e=0,t=Object.create(null),o=Object.create(null);const n=(i,s)=>{t[i]=s,e++,e>r&&(e=0,o=t,t=Object.create(null))};return{get(i){let s=t[i];if(s!==void 0)return s;if((s=o[i])!==void 0)return n(i,s),s},set(i,s){i in t?t[i]=s:n(i,s)}}},is="!",Kd=":",gg=[],Wd=(r,e,t,o,n)=>({modifiers:r,hasImportantModifier:e,baseClassName:t,maybePostfixModifierPosition:o,isExternal:n}),mg=r=>{const{prefix:e,experimentalParseClassName:t}=r;let o=n=>{const i=[];let s=0,a=0,l=0,c;const d=n.length;for(let g=0;g<d;g++){const b=n[g];if(s===0&&a===0){if(b===Kd){i.push(n.slice(l,g)),l=g+1;continue}if(b==="/"){c=g;continue}}b==="["?s++:b==="]"?s--:b==="("?a++:b===")"&&a--}const u=i.length===0?n:n.slice(l);let h=u,p=!1;u.endsWith(is)?(h=u.slice(0,-1),p=!0):u.startsWith(is)&&(h=u.slice(1),p=!0);const f=c&&c>l?c-l:void 0;return Wd(i,p,h,f)};if(e){const n=e+Kd,i=o;o=s=>s.startsWith(n)?i(s.slice(n.length)):Wd(gg,!1,s,void 0,!0)}if(t){const n=o;o=i=>t({className:i,parseClassName:n})}return o},bg=r=>{const e=new Map;return r.orderSensitiveModifiers.forEach((t,o)=>{e.set(t,1e6+o)}),t=>{const o=[];let n=[];for(let i=0;i<t.length;i++){const s=t[i],a=s[0]==="[",l=e.has(s);a||l?(n.length>0&&(n.sort(),o.push(...n),n=[]),o.push(s)):n.push(s)}return n.length>0&&(n.sort(),o.push(...n)),o}},vg=r=>K({cache:pg(r.cacheSize),parseClassName:mg(r),sortModifiers:bg(r)},ig(r)),kg=/\s+/,yg=(r,e)=>{const{parseClassName:t,getClassGroupId:o,getConflictingClassGroupIds:n,sortModifiers:i}=e,s=[],a=r.trim().split(kg);let l="";for(let c=a.length-1;c>=0;c-=1){const d=a[c],{isExternal:u,modifiers:h,hasImportantModifier:p,baseClassName:f,maybePostfixModifierPosition:g}=t(d);if(u){l=d+(l.length>0?" "+l:l);continue}let b=!!g,k=o(b?f.substring(0,g):f);if(!k){if(!b){l=d+(l.length>0?" "+l:l);continue}if(k=o(f),!k){l=d+(l.length>0?" "+l:l);continue}b=!1}const y=h.length===0?"":h.length===1?h[0]:i(h).join(":"),x=p?y+is:y,T=x+k;if(s.indexOf(T)>-1)continue;s.push(T);const R=n(k,b);for(let C=0;C<R.length;++C){const E=R[C];s.push(x+E)}l=d+(l.length>0?" "+l:l)}return l},Gd=(...r)=>{let e=0,t,o,n="";for(;e<r.length;)(t=r[e++])&&(o=$d(t))&&(n&&(n+=" "),n+=o);return n},$d=r=>{if(typeof r=="string")return r;let e,t="";for(let o=0;o<r.length;o++)r[o]&&(e=$d(r[o]))&&(t&&(t+=" "),t+=e);return t},wg=(r,...e)=>{let t,o,n,i;const s=l=>{const c=e.reduce((d,u)=>u(d),r());return t=vg(c),o=t.cache.get,n=t.cache.set,i=a,a(l)},a=l=>{const c=o(l);if(c)return c;const d=yg(l,t);return n(l,d),d};return i=s,(...l)=>i(Gd(...l))},Tg=[],ue=r=>{const e=t=>t[r]||Tg;return e.isThemeGetter=!0,e},Vd=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Xd=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Bg=/^\d+\/\d+$/,xg=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Cg=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Eg=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Sg=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Ag=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,It=r=>Bg.test(r),q=r=>!!r&&!Number.isNaN(Number(r)),it=r=>!!r&&Number.isInteger(Number(r)),ss=r=>r.endsWith("%")&&q(r.slice(0,-1)),Ze=r=>xg.test(r),Ig=()=>!0,Rg=r=>Cg.test(r)&&!Eg.test(r),Yd=()=>!1,Ng=r=>Sg.test(r),Og=r=>Ag.test(r),_g=r=>!S(r)&&!A(r),Lg=r=>Rt(r,tu,Yd),S=r=>Vd.test(r),ft=r=>Rt(r,ou,Rg),as=r=>Rt(r,Hg,q),Zd=r=>Rt(r,Qd,Yd),Dg=r=>Rt(r,eu,Og),No=r=>Rt(r,nu,Ng),A=r=>Xd.test(r),Zt=r=>Nt(r,ou),Mg=r=>Nt(r,qg),Jd=r=>Nt(r,Qd),Pg=r=>Nt(r,tu),Fg=r=>Nt(r,eu),Oo=r=>Nt(r,nu,!0),Rt=(r,e,t)=>{const o=Vd.exec(r);return o?o[1]?e(o[1]):t(o[2]):!1},Nt=(r,e,t=!1)=>{const o=Xd.exec(r);return o?o[1]?e(o[1]):t:!1},Qd=r=>r==="position"||r==="percentage",eu=r=>r==="image"||r==="url",tu=r=>r==="length"||r==="size"||r==="bg-size",ou=r=>r==="length",Hg=r=>r==="number",qg=r=>r==="family-name",nu=r=>r==="shadow",$=wg(()=>{const r=ue("color"),e=ue("font"),t=ue("text"),o=ue("font-weight"),n=ue("tracking"),i=ue("leading"),s=ue("breakpoint"),a=ue("container"),l=ue("spacing"),c=ue("radius"),d=ue("shadow"),u=ue("inset-shadow"),h=ue("text-shadow"),p=ue("drop-shadow"),f=ue("blur"),g=ue("perspective"),b=ue("aspect"),k=ue("ease"),y=ue("animate"),x=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],R=()=>[...T(),A,S],C=()=>["auto","hidden","clip","visible","scroll"],E=()=>["auto","contain","none"],w=()=>[A,S,l],_=()=>[It,"full","auto",...w()],F=()=>[it,"none","subgrid",A,S],N=()=>["auto",{span:["full",it,A,S]},it,A,S],X=()=>[it,"auto",A,S],D=()=>["auto","min","max","fr",A,S],J=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ne=()=>["start","end","center","stretch","center-safe","end-safe"],re=()=>["auto",...w()],Fe=()=>[It,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...w()],L=()=>[r,A,S],dn=()=>[...T(),Jd,Zd,{position:[A,S]}],va=()=>["no-repeat",{repeat:["","x","y","space","round"]}],po=()=>["auto","cover","contain",Pg,Lg,{size:[A,S]}],go=()=>[ss,Zt,ft],Te=()=>["","none","full",c,A,S],Ie=()=>["",q,Zt,ft],un=()=>["solid","dashed","dotted","double"],fh=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ge=()=>[q,ss,Jd,Zd],ph=()=>["","none",f,A,S],hn=()=>["none",q,A,S],fn=()=>["none",q,A,S],ka=()=>[q,A,S],pn=()=>[It,"full",...w()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ze],breakpoint:[Ze],color:[Ig],container:[Ze],"drop-shadow":[Ze],ease:["in","out","in-out"],font:[_g],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ze],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ze],shadow:[Ze],spacing:["px",q],text:[Ze],"text-shadow":[Ze],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",It,S,A,b]}],container:["container"],columns:[{columns:[q,S,A,a]}],"break-after":[{"break-after":x()}],"break-before":[{"break-before":x()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:R()}],overflow:[{overflow:C()}],"overflow-x":[{"overflow-x":C()}],"overflow-y":[{"overflow-y":C()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:_()}],"inset-x":[{"inset-x":_()}],"inset-y":[{"inset-y":_()}],start:[{start:_()}],end:[{end:_()}],top:[{top:_()}],right:[{right:_()}],bottom:[{bottom:_()}],left:[{left:_()}],visibility:["visible","invisible","collapse"],z:[{z:[it,"auto",A,S]}],basis:[{basis:[It,"full","auto",a,...w()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[q,It,"auto","initial","none",S]}],grow:[{grow:["",q,A,S]}],shrink:[{shrink:["",q,A,S]}],order:[{order:[it,"first","last","none",A,S]}],"grid-cols":[{"grid-cols":F()}],"col-start-end":[{col:N()}],"col-start":[{"col-start":X()}],"col-end":[{"col-end":X()}],"grid-rows":[{"grid-rows":F()}],"row-start-end":[{row:N()}],"row-start":[{"row-start":X()}],"row-end":[{"row-end":X()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":D()}],"auto-rows":[{"auto-rows":D()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...J(),"normal"]}],"justify-items":[{"justify-items":[...ne(),"normal"]}],"justify-self":[{"justify-self":["auto",...ne()]}],"align-content":[{content:["normal",...J()]}],"align-items":[{items:[...ne(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ne(),{baseline:["","last"]}]}],"place-content":[{"place-content":J()}],"place-items":[{"place-items":[...ne(),"baseline"]}],"place-self":[{"place-self":["auto",...ne()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:re()}],mx:[{mx:re()}],my:[{my:re()}],ms:[{ms:re()}],me:[{me:re()}],mt:[{mt:re()}],mr:[{mr:re()}],mb:[{mb:re()}],ml:[{ml:re()}],"space-x":[{"space-x":w()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":w()}],"space-y-reverse":["space-y-reverse"],size:[{size:Fe()}],w:[{w:[a,"screen",...Fe()]}],"min-w":[{"min-w":[a,"screen","none",...Fe()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[s]},...Fe()]}],h:[{h:["screen","lh",...Fe()]}],"min-h":[{"min-h":["screen","lh","none",...Fe()]}],"max-h":[{"max-h":["screen","lh",...Fe()]}],"font-size":[{text:["base",t,Zt,ft]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,A,as]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ss,S]}],"font-family":[{font:[Mg,S,e]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[n,A,S]}],"line-clamp":[{"line-clamp":[q,"none",A,as]}],leading:[{leading:[i,...w()]}],"list-image":[{"list-image":["none",A,S]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",A,S]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:L()}],"text-color":[{text:L()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...un(),"wavy"]}],"text-decoration-thickness":[{decoration:[q,"from-font","auto",A,ft]}],"text-decoration-color":[{decoration:L()}],"underline-offset":[{"underline-offset":[q,"auto",A,S]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:w()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",A,S]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",A,S]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:dn()}],"bg-repeat":[{bg:va()}],"bg-size":[{bg:po()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},it,A,S],radial:["",A,S],conic:[it,A,S]},Fg,Dg]}],"bg-color":[{bg:L()}],"gradient-from-pos":[{from:go()}],"gradient-via-pos":[{via:go()}],"gradient-to-pos":[{to:go()}],"gradient-from":[{from:L()}],"gradient-via":[{via:L()}],"gradient-to":[{to:L()}],rounded:[{rounded:Te()}],"rounded-s":[{"rounded-s":Te()}],"rounded-e":[{"rounded-e":Te()}],"rounded-t":[{"rounded-t":Te()}],"rounded-r":[{"rounded-r":Te()}],"rounded-b":[{"rounded-b":Te()}],"rounded-l":[{"rounded-l":Te()}],"rounded-ss":[{"rounded-ss":Te()}],"rounded-se":[{"rounded-se":Te()}],"rounded-ee":[{"rounded-ee":Te()}],"rounded-es":[{"rounded-es":Te()}],"rounded-tl":[{"rounded-tl":Te()}],"rounded-tr":[{"rounded-tr":Te()}],"rounded-br":[{"rounded-br":Te()}],"rounded-bl":[{"rounded-bl":Te()}],"border-w":[{border:Ie()}],"border-w-x":[{"border-x":Ie()}],"border-w-y":[{"border-y":Ie()}],"border-w-s":[{"border-s":Ie()}],"border-w-e":[{"border-e":Ie()}],"border-w-t":[{"border-t":Ie()}],"border-w-r":[{"border-r":Ie()}],"border-w-b":[{"border-b":Ie()}],"border-w-l":[{"border-l":Ie()}],"divide-x":[{"divide-x":Ie()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Ie()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...un(),"hidden","none"]}],"divide-style":[{divide:[...un(),"hidden","none"]}],"border-color":[{border:L()}],"border-color-x":[{"border-x":L()}],"border-color-y":[{"border-y":L()}],"border-color-s":[{"border-s":L()}],"border-color-e":[{"border-e":L()}],"border-color-t":[{"border-t":L()}],"border-color-r":[{"border-r":L()}],"border-color-b":[{"border-b":L()}],"border-color-l":[{"border-l":L()}],"divide-color":[{divide:L()}],"outline-style":[{outline:[...un(),"none","hidden"]}],"outline-offset":[{"outline-offset":[q,A,S]}],"outline-w":[{outline:["",q,Zt,ft]}],"outline-color":[{outline:L()}],shadow:[{shadow:["","none",d,Oo,No]}],"shadow-color":[{shadow:L()}],"inset-shadow":[{"inset-shadow":["none",u,Oo,No]}],"inset-shadow-color":[{"inset-shadow":L()}],"ring-w":[{ring:Ie()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:L()}],"ring-offset-w":[{"ring-offset":[q,ft]}],"ring-offset-color":[{"ring-offset":L()}],"inset-ring-w":[{"inset-ring":Ie()}],"inset-ring-color":[{"inset-ring":L()}],"text-shadow":[{"text-shadow":["none",h,Oo,No]}],"text-shadow-color":[{"text-shadow":L()}],opacity:[{opacity:[q,A,S]}],"mix-blend":[{"mix-blend":[...fh(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":fh()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[q]}],"mask-image-linear-from-pos":[{"mask-linear-from":ge()}],"mask-image-linear-to-pos":[{"mask-linear-to":ge()}],"mask-image-linear-from-color":[{"mask-linear-from":L()}],"mask-image-linear-to-color":[{"mask-linear-to":L()}],"mask-image-t-from-pos":[{"mask-t-from":ge()}],"mask-image-t-to-pos":[{"mask-t-to":ge()}],"mask-image-t-from-color":[{"mask-t-from":L()}],"mask-image-t-to-color":[{"mask-t-to":L()}],"mask-image-r-from-pos":[{"mask-r-from":ge()}],"mask-image-r-to-pos":[{"mask-r-to":ge()}],"mask-image-r-from-color":[{"mask-r-from":L()}],"mask-image-r-to-color":[{"mask-r-to":L()}],"mask-image-b-from-pos":[{"mask-b-from":ge()}],"mask-image-b-to-pos":[{"mask-b-to":ge()}],"mask-image-b-from-color":[{"mask-b-from":L()}],"mask-image-b-to-color":[{"mask-b-to":L()}],"mask-image-l-from-pos":[{"mask-l-from":ge()}],"mask-image-l-to-pos":[{"mask-l-to":ge()}],"mask-image-l-from-color":[{"mask-l-from":L()}],"mask-image-l-to-color":[{"mask-l-to":L()}],"mask-image-x-from-pos":[{"mask-x-from":ge()}],"mask-image-x-to-pos":[{"mask-x-to":ge()}],"mask-image-x-from-color":[{"mask-x-from":L()}],"mask-image-x-to-color":[{"mask-x-to":L()}],"mask-image-y-from-pos":[{"mask-y-from":ge()}],"mask-image-y-to-pos":[{"mask-y-to":ge()}],"mask-image-y-from-color":[{"mask-y-from":L()}],"mask-image-y-to-color":[{"mask-y-to":L()}],"mask-image-radial":[{"mask-radial":[A,S]}],"mask-image-radial-from-pos":[{"mask-radial-from":ge()}],"mask-image-radial-to-pos":[{"mask-radial-to":ge()}],"mask-image-radial-from-color":[{"mask-radial-from":L()}],"mask-image-radial-to-color":[{"mask-radial-to":L()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":T()}],"mask-image-conic-pos":[{"mask-conic":[q]}],"mask-image-conic-from-pos":[{"mask-conic-from":ge()}],"mask-image-conic-to-pos":[{"mask-conic-to":ge()}],"mask-image-conic-from-color":[{"mask-conic-from":L()}],"mask-image-conic-to-color":[{"mask-conic-to":L()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:dn()}],"mask-repeat":[{mask:va()}],"mask-size":[{mask:po()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",A,S]}],filter:[{filter:["","none",A,S]}],blur:[{blur:ph()}],brightness:[{brightness:[q,A,S]}],contrast:[{contrast:[q,A,S]}],"drop-shadow":[{"drop-shadow":["","none",p,Oo,No]}],"drop-shadow-color":[{"drop-shadow":L()}],grayscale:[{grayscale:["",q,A,S]}],"hue-rotate":[{"hue-rotate":[q,A,S]}],invert:[{invert:["",q,A,S]}],saturate:[{saturate:[q,A,S]}],sepia:[{sepia:["",q,A,S]}],"backdrop-filter":[{"backdrop-filter":["","none",A,S]}],"backdrop-blur":[{"backdrop-blur":ph()}],"backdrop-brightness":[{"backdrop-brightness":[q,A,S]}],"backdrop-contrast":[{"backdrop-contrast":[q,A,S]}],"backdrop-grayscale":[{"backdrop-grayscale":["",q,A,S]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[q,A,S]}],"backdrop-invert":[{"backdrop-invert":["",q,A,S]}],"backdrop-opacity":[{"backdrop-opacity":[q,A,S]}],"backdrop-saturate":[{"backdrop-saturate":[q,A,S]}],"backdrop-sepia":[{"backdrop-sepia":["",q,A,S]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",A,S]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[q,"initial",A,S]}],ease:[{ease:["linear","initial",k,A,S]}],delay:[{delay:[q,A,S]}],animate:[{animate:["none",y,A,S]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,A,S]}],"perspective-origin":[{"perspective-origin":R()}],rotate:[{rotate:hn()}],"rotate-x":[{"rotate-x":hn()}],"rotate-y":[{"rotate-y":hn()}],"rotate-z":[{"rotate-z":hn()}],scale:[{scale:fn()}],"scale-x":[{"scale-x":fn()}],"scale-y":[{"scale-y":fn()}],"scale-z":[{"scale-z":fn()}],"scale-3d":["scale-3d"],skew:[{skew:ka()}],"skew-x":[{"skew-x":ka()}],"skew-y":[{"skew-y":ka()}],transform:[{transform:[A,S,"","none","gpu","cpu"]}],"transform-origin":[{origin:R()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:pn()}],"translate-x":[{"translate-x":pn()}],"translate-y":[{"translate-y":pn()}],"translate-z":[{"translate-z":pn()}],"translate-none":["translate-none"],accent:[{accent:L()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:L()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",A,S]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",A,S]}],fill:[{fill:["none",...L()]}],"stroke-w":[{stroke:[q,Zt,ft,as]}],stroke:[{stroke:["none",...L()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}}),me=Gd,zg=180,jg=400,Ot="data-blok-interface",Ug="blok",Kg="inline-toolbar",ls="tooltip",ru="[data-blok-interface=blok]",iu="[data-blok-interface=inline-toolbar]";typeof process!="undefined"&&process.platform?process.platform==="darwin"?"Meta":"Control":typeof navigator!="undefined"&&navigator.userAgent.toLowerCase().includes("mac")?"Meta":"Control";const Wg="data-blok-element",cs="[data-blok-element]",Gg="data-blok-element-content",ds="[data-blok-element-content]",$g="data-blok-editor",Ee="[data-blok-editor]",Vg="data-blok-redactor",su="[data-blok-redactor]",Xg="data-blok-narrow",Yg="data-blok-rtl",Zg="data-blok-fake-cursor",au="[data-blok-fake-cursor]",Jg="data-blok-overlay",Qg="data-blok-overlay-container",em="data-blok-overlay-rectangle",tm="data-blok-toolbar",lu="[data-blok-toolbar]",om="data-blok-settings-toggler",nm="data-blok-drag-handle",rm="[data-blok-drag-handle]",us="data-blok-tool",im="data-blok-stub",sm="data-blok-stub-info",am="data-blok-stub-title",lm="data-blok-stub-subtitle",hs="data-blok-selected",fs="data-blok-stretched",cm="data-blok-empty",cu="data-blok-dragging",du="data-blok-toolbox-opened";class O{constructor(){this.instance=null,this.selection=null,this.savedSelectionRange=null,this.isFakeBackgroundEnabled=!1,this.fakeBackgroundElements=[]}static get anchorNode(){const e=window.getSelection();return e?e.anchorNode:null}static get anchorElement(){const e=window.getSelection();if(!e)return null;const t=e.anchorNode;return t?v.isElement(t)?t:t.parentElement:null}static get anchorOffset(){const e=window.getSelection();return e?e.anchorOffset:null}static get isCollapsed(){const e=window.getSelection();return e?e.isCollapsed:null}static get isAtBlok(){return this.isSelectionAtBlok(O.get())}static isSelectionAtBlok(e){if(!e)return!1;const t=e.anchorNode||e.focusNode,o=t&&t.nodeType===Node.TEXT_NODE?t.parentNode:t,n=o&&o instanceof Element?o.closest(su):null;return n?n.nodeType===Node.ELEMENT_NODE:!1}static isRangeAtBlok(e){if(!e)return;const t=e.startContainer&&e.startContainer.nodeType===Node.TEXT_NODE?e.startContainer.parentNode:e.startContainer,o=t&&t instanceof Element?t.closest(su):null;return o?o.nodeType===Node.ELEMENT_NODE:!1}static get isSelectionExists(){const e=O.get();return!!(e!=null&&e.anchorNode)}static get range(){return this.getRangeFromSelection(this.get())}static getRangeFromSelection(e){return e&&e.rangeCount?e.getRangeAt(0):null}static get rect(){const e=document.selection,t={x:0,y:0,width:0,height:0};if(e&&e.type!=="Control"){const a=e.createRange();return t.x=a.boundingLeft,t.y=a.boundingTop,t.width=a.boundingWidth,t.height=a.boundingHeight,t}const o=window.getSelection();if(!o)return j("Method window.getSelection returned null","warn"),t;if(o.rangeCount===null||isNaN(o.rangeCount))return j("Method SelectionUtils.rangeCount is not supported","warn"),t;if(o.rangeCount===0)return t;const n=o.getRangeAt(0).cloneRange(),i=n.getBoundingClientRect();if(i.x===0&&i.y===0){const s=document.createElement("span");s.appendChild(document.createTextNode("​")),n.insertNode(s);const a=s.getBoundingClientRect(),l=s.parentNode;return l==null||l.removeChild(s),l==null||l.normalize(),a}return i}static get text(){var t;const e=window.getSelection();return(t=e==null?void 0:e.toString())!=null?t:""}static get(){return window.getSelection()}static setCursor(e,t=0){const o=document.createRange(),n=window.getSelection(),i=v.isNativeInput(e);if(i&&!v.canSetCaret(e))return e.getBoundingClientRect();if(i){const s=e;return s.focus(),s.selectionStart=t,s.selectionEnd=t,s.getBoundingClientRect()}return o.setStart(e,t),o.setEnd(e,t),n?(n.removeAllRanges(),n.addRange(o),o.getBoundingClientRect()):e.getBoundingClientRect()}static isRangeInsideContainer(e){const t=O.range;return t===null?!1:e.contains(t.startContainer)}static addFakeCursor(){const e=O.range;if(e===null)return;const t=v.make("span");t.setAttribute(Zg,""),t.setAttribute("data-blok-mutation-free","true"),e.collapse(),e.insertNode(t)}static isFakeCursorInsideContainer(e){return v.find(e,au)!==null}static removeFakeCursor(e=document.body){const t=v.find(e,au);t&&t.remove()}removeFakeBackground(){var i;if(!this.fakeBackgroundElements.length){this.isFakeBackgroundEnabled=!1;return}const e=this.fakeBackgroundElements[0],t=this.fakeBackgroundElements[this.fakeBackgroundElements.length-1],o=e.firstChild,n=t.lastChild;if(this.fakeBackgroundElements.forEach(s=>{this.unwrapFakeBackground(s)}),o&&n){const s=document.createRange();s.setStart(o,0),s.setEnd(n,((i=n.textContent)==null?void 0:i.length)||0),this.savedSelectionRange=s}this.fakeBackgroundElements=[],this.isFakeBackgroundEnabled=!1}setFakeBackground(){this.removeFakeBackground();const e=window.getSelection();if(!e||e.rangeCount===0)return;const t=e.getRangeAt(0);if(t.collapsed)return;const o=this.collectTextNodes(t);if(o.length===0)return;const n=t.startContainer,i=t.startOffset,s=t.endContainer,a=t.endOffset;if(this.fakeBackgroundElements=[],o.forEach(c=>{var k,y;const d=document.createRange(),u=c===n,h=c===s,p=u?i:0,f=(y=(k=c.textContent)==null?void 0:k.length)!=null?y:0,g=h?a:f;if(p===g)return;d.setStart(c,p),d.setEnd(c,g);const b=this.wrapRangeWithFakeBackground(d);b&&this.fakeBackgroundElements.push(b)}),!this.fakeBackgroundElements.length)return;const l=document.createRange();l.setStartBefore(this.fakeBackgroundElements[0]),l.setEndAfter(this.fakeBackgroundElements[this.fakeBackgroundElements.length-1]),e.removeAllRanges(),e.addRange(l),this.isFakeBackgroundEnabled=!0}collectTextNodes(e){const t=[],{commonAncestorContainer:o}=e;if(o.nodeType===Node.TEXT_NODE)return t.push(o),t;const n=document.createTreeWalker(o,NodeFilter.SHOW_TEXT,{acceptNode:i=>e.intersectsNode(i)&&i.textContent&&i.textContent.length>0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT});for(;n.nextNode();)t.push(n.currentNode);return t}wrapRangeWithFakeBackground(e){if(e.collapsed)return null;const t=v.make("span");t.setAttribute("data-blok-testid","fake-background"),t.setAttribute("data-blok-fake-background","true"),t.setAttribute("data-blok-mutation-free","true"),t.style.backgroundColor="#a8d6ff",t.style.color="inherit",t.style.display="inline",t.style.padding="0",t.style.margin="0";const o=e.extractContents();return o.childNodes.length===0?null:(t.appendChild(o),e.insertNode(t),t)}unwrapFakeBackground(e){const t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}}save(){this.savedSelectionRange=O.range}restore(){if(!this.savedSelectionRange)return;const e=window.getSelection();e&&(e.removeAllRanges(),e.addRange(this.savedSelectionRange))}clearSaved(){this.savedSelectionRange=null}collapseToEnd(){const e=window.getSelection();if(!e||!e.focusNode)return;const t=document.createRange();t.selectNodeContents(e.focusNode),t.collapse(!1),e.removeAllRanges(),e.addRange(t)}findParentTag(e,t,o=10){const n=window.getSelection();if(!n||!n.anchorNode||!n.focusNode)return null;const i=[n.anchorNode,n.focusNode],s=a=>{const l=(c,d)=>{if(d<=0||!c)return null;const u=c.nodeType===Node.ELEMENT_NODE&&c.tagName===e,h=!t||c.classList&&c.classList.contains(t);if(u&&h)return c;if(!c.parentNode)return null;const p=c.parentNode,f=!t||p.classList&&p.classList.contains(t);return p.tagName===e&&f?p:l(p,d-1)};return l(a,o)};for(const a of i){const l=s(a);if(l)return l}return null}expandToTag(e){const t=window.getSelection();if(!t)return;t.removeAllRanges();const o=document.createRange();o.selectNodeContents(e),t.addRange(o)}}const dm=(r,e)=>{const{type:t,target:o,addedNodes:n,removedNodes:i}=r;return r.type==="attributes"&&r.attributeName==="data-blok-empty"?!1:e.contains(o)?!0:t!=="childList"?!1:Array.from(n).some(l=>l===e)?!0:Array.from(i).some(l=>l===e)},ps="redactor dom changed",gs="block changed",uu="fake cursor is about to be toggled",hu="fake cursor have been set",Jt="blok mobile layout toggled",ms="block-settings-opened",bs="block-settings-closed",um="history:state-changed",vs=(r,e)=>{if(!r.conversionConfig)return!1;const t=r.conversionConfig[e];return V(t)||qe(t)},_o=(r,e)=>vs(r.tool,e),fu=(r,e)=>Object.entries(r).some((([t,o])=>e[t]&&eg(e[t],o))),pu=async(r,e)=>{const o=(await r.save()).data,n=e.find(i=>i.name===r.name);return n!==void 0&&!vs(n,"export")?[]:e.reduce((i,s)=>{if(!vs(s,"import")||s.toolbox===void 0)return i;const a=s.toolbox.filter(l=>{if(le(l)||l.icon===void 0)return!1;const c=l.data!==void 0;return!(c&&fu(l.data,o)||!c&&s.name===r.name)});return i.push(Re(K({},s),{toolbox:a})),i},[])},gu=(r,e)=>r.mergeable?r.name===e.name?!0:_o(e,"export")&&_o(r,"import"):!1,hm=(r,e)=>{const t=e==null?void 0:e.export;return V(t)?t(r):qe(t)?r[t]:(t!==void 0&&j("Conversion «export» property must be a string or function. String means key of saved data object to export. Function should export processed string to export."),"")},mu=(r,e,t)=>{const o=e==null?void 0:e.import;return V(o)?o(r,t):qe(o)?{[o]:r}:(o!==void 0&&j("Conversion «import» property must be a string or function. String means key of tool data to import. Function accepts a imported string and return composed tool data."),{})};var ae=(r=>(r.Default="default",r.Separator="separator",r.Html="html",r))(ae||{}),Je=(r=>(r.RENDERED="rendered",r.MOVED="moved",r.UPDATED="updated",r.REMOVED="removed",r.ON_PASTE="onPaste",r))(Je||{});const Pe=class Pe extends Xt{constructor({id:e=Zp(),data:t,tool:o,readOnly:n,tunesData:i},s){super(),this.cachedInputs=[],this.lastSavedTunes={},this.toolRenderedElement=null,this.contentElement=null,this.tunesInstances=new Map,this.defaultTunesInstances=new Map,this.readyResolver=null,this.unavailableTunesData={},this.inputIndex=0,this.blokEventBus=null,this.redactorDomChangedCallback=()=>{},this.handleFocus=()=>{this.dropInputsCache(),this.updateCurrentInput()},this.didMutated=(l=void 0)=>{const c=l===void 0,d=l instanceof InputEvent;!c&&!d&&this.detectToolRootChange(l),(c||d?!0:!(l.length>0&&l.every(p=>{const{addedNodes:f,removedNodes:g,target:b}=p;return[...Array.from(f),...Array.from(g),b].every(y=>{var T;const x=v.isElement(y)?y:(T=y.parentElement)!=null?T:null;return x===null?!1:x.closest('[data-blok-mutation-free="true"]')!==null})})))&&(this.dropInputsCache(),this.updateCurrentInput(),this.toggleInputsEmptyMark(),this.call("updated"),this.emit("didMutated",this))},this.ready=new Promise(l=>{this.readyResolver=l}),this.name=o.name,this.id=e,this.settings=o.settings,this.config=this.settings,this.blokEventBus=s||null,this.blockAPI=new Ye(this),this.lastSavedData=t!=null?t:{},this.lastSavedTunes=i!=null?i:{},this.tool=o,this.toolInstance=o.create(t,this.blockAPI,n),this.tunes=o.tunes,this.composeTunes(i);const a=this.compose();if(a==null)throw new Error(`Tool "${this.name}" did not return a block holder element during render()`);this.holder=a,window.requestIdleCallback(()=>{this.watchBlockMutations(),this.addInputEvents(),this.toggleInputsEmptyMark()})}call(e,t){const o=this.toolInstance[e];if(V(o))try{o.call(this.toolInstance,t)}catch(n){const i=n instanceof Error?n.message:String(n);j(`Error during '${e}' call: ${i}`,"error")}}async mergeWith(e){if(!V(this.toolInstance.merge))throw new Error(`Block tool "${this.name}" does not support merging`);await this.toolInstance.merge(e)}async save(){const e=await this.extractToolData();if(e===void 0)return;const t=K({},this.unavailableTunesData);[...this.tunesInstances.entries(),...this.defaultTunesInstances.entries()].forEach(([i,s])=>{if(V(s.save))try{t[i]=s.save()}catch(a){j(`Tune ${s.constructor.name} save method throws an Error %o`,"warn",a)}});const o=window.performance.now();this.lastSavedData=e,this.lastSavedTunes=K({},t);const n=window.performance.now();return{id:this.id,tool:this.name,data:e,tunes:t,time:n-o}}async extractToolData(){try{const e=await this.toolInstance.save(this.pluginsContent);if(!this.isEmpty||e===void 0||e===null||typeof e!="object")return e;const t=K({},e),o=n=>{const i=t[n];if(typeof i!="string")return;const s=document.createElement("div");s.innerHTML=i,v.isEmpty(s)&&(t[n]="")};return o("text"),o("html"),t}catch(e){const t=e instanceof Error?e:new Error(String(e));j(`Saving process for ${this.name} tool failed due to the ${t}`,"log",t);return}}async validate(e){return this.toolInstance.validate instanceof Function?await this.toolInstance.validate(e):!0}getTunes(){const e=[],t=[],o=(s,a)=>{if(s){if(v.isElement(s)){a.push({type:ae.Html,element:s});return}if(Array.isArray(s)){a.push(...s);return}a.push(s)}},n=typeof this.toolInstance.renderSettings=="function"?this.toolInstance.renderSettings():[];return o(n,e),[...this.tunesInstances.values(),...this.defaultTunesInstances.values()].map(s=>s.render()).forEach(s=>{o(s,t)}),{toolTunes:e,commonTunes:t}}updateCurrentInput(){var i;const e=O.anchorNode,t=document.activeElement,o=s=>{if(!s)return;const a=s instanceof HTMLElement?s:s.parentElement;if(a===null)return;const l=this.inputs.find(u=>u===a||u.contains(a));if(l!==void 0)return l;const c=a.closest(v.allInputsSelector);if(!(c instanceof HTMLElement))return;const d=this.inputs.find(u=>u===c);if(d!==void 0)return d};if(v.isNativeInput(t)){this.currentInput=t;return}const n=(i=o(e))!=null?i:t instanceof HTMLElement?o(t):void 0;if(n!==void 0){this.currentInput=n;return}t instanceof HTMLElement&&this.inputs.includes(t)&&(this.currentInput=t)}dispatchChange(){this.didMutated()}async setData(e){const t=this.toolInstance.setData;if(typeof t=="function")try{return await t.call(this.toolInstance,e),this.lastSavedData=e,!0}catch(s){return j(`Tool ${this.name} setData failed: ${s instanceof Error?s.message:String(s)}`,"warn"),!1}const o=this.toolRenderedElement;if(!o)return!1;const n="text"in e&&typeof e.text=="string",i=o.getAttribute("contenteditable")==="true";return n&&i?(o.innerHTML=e.text,this.lastSavedData=e,this.dropInputsCache(),this.toggleInputsEmptyMark(),this.call("updated"),!0):!1}destroy(){this.unwatchBlockMutations(),this.removeInputEvents(),super.destroy(),V(this.toolInstance.destroy)&&this.toolInstance.destroy()}async getActiveToolboxEntry(){const e=this.tool.toolbox;if(!e)return;if(e.length===1)return Promise.resolve(e[0]);const t=await this.data;return e.find(o=>fu(o.data,t))}async exportDataAsString(){const e=await this.data;return hm(e,this.tool.conversionConfig)}get inputs(){if(this.cachedInputs.length!==0)return this.cachedInputs;const e=v.findAllInputs(this.holder);return this.inputIndex>e.length-1&&(this.inputIndex=e.length-1),this.cachedInputs=e,e}get currentInput(){return this.inputs[this.inputIndex]}set currentInput(e){if(e===void 0)return;const t=this.inputs.findIndex(o=>o===e||o.contains(e));t!==-1&&(this.inputIndex=t)}get firstInput(){return this.inputs[0]}get lastInput(){const e=this.inputs;return e[e.length-1]}get nextInput(){return this.inputs[this.inputIndex+1]}get previousInput(){return this.inputs[this.inputIndex-1]}get data(){return this.save().then(e=>e&&!le(e.data)?e.data:{})}get preservedData(){var e;return(e=this.lastSavedData)!=null?e:{}}get preservedTunes(){var e;return(e=this.lastSavedTunes)!=null?e:{}}get sanitize(){return this.tool.sanitizeConfig}get mergeable(){return V(this.toolInstance.merge)}get focusable(){return this.inputs.length!==0}get isEmpty(){const e=v.isEmpty(this.pluginsContent,"/"),t=!this.hasMedia;return e&&t}get hasMedia(){const e=["img","iframe","video","audio","source","input","textarea","twitterwidget"];return!!this.holder.querySelector(e.join(","))}set selected(e){var n,i;if(e?this.holder.setAttribute(hs,"true"):this.holder.removeAttribute(hs),this.contentElement){const s=this.stretched?Pe.styles.contentStretched:"";this.contentElement.className=e?$(Pe.styles.content,Pe.styles.contentSelected):$(Pe.styles.content,s)}const t=e===!0&&O.isRangeInsideContainer(this.holder),o=e===!1&&O.isFakeCursorInsideContainer(this.holder);!t&&!o||((n=this.blokEventBus)==null||n.emit(uu,{state:e}),t&&O.addFakeCursor(),o&&O.removeFakeCursor(this.holder),(i=this.blokEventBus)==null||i.emit(hu,{state:e}))}get selected(){return this.holder.getAttribute(hs)==="true"}setStretchState(e){e?this.holder.setAttribute(fs,"true"):this.holder.removeAttribute(fs),this.contentElement&&!this.selected&&(this.contentElement.className=e?$(Pe.styles.content,Pe.styles.contentStretched):Pe.styles.content)}set stretched(e){this.setStretchState(e)}get stretched(){return this.holder.getAttribute(fs)==="true"}get pluginsContent(){if(this.toolRenderedElement===null)throw new Error("Block pluginsContent is not yet initialized");return this.toolRenderedElement}compose(){var i;const e=v.make("div",Pe.styles.wrapper),t=v.make("div",Pe.styles.content);this.contentElement=t,e.setAttribute(Wg,""),t.setAttribute(Gg,""),t.setAttribute("data-blok-testid","block-content");const o=this.toolInstance.render();e.setAttribute("data-blok-testid","block-wrapper"),this.name&&!e.hasAttribute("data-blok-component")&&e.setAttribute("data-blok-component",this.name),e.setAttribute("data-blok-id",this.id),o instanceof Promise?o.then(s=>{var a;this.toolRenderedElement=s,this.addToolDataAttributes(s,e),t.appendChild(s),(a=this.readyResolver)==null||a.call(this)}).catch(s=>{var a;j("Tool render promise rejected: %o","error",s),(a=this.readyResolver)==null||a.call(this)}):(this.toolRenderedElement=o,this.addToolDataAttributes(o,e),t.appendChild(o),(i=this.readyResolver)==null||i.call(this));const n=[...this.tunesInstances.values(),...this.defaultTunesInstances.values()].reduce((s,a)=>{if(V(a.wrap))try{return a.wrap(s)}catch(l){return j(`Tune ${a.constructor.name} wrap method throws an Error %o`,"warn",l),s}return s},t);return e.appendChild(n),e}addToolDataAttributes(e,t){var a;this.name&&!t.hasAttribute("data-blok-component")&&t.setAttribute("data-blok-component",this.name);const o="data-blok-placeholder",n=(a=this.config)==null?void 0:a.placeholder,i=typeof n=="string"?n.trim():"",s=["empty:before:pointer-events-none","empty:before:text-gray-text","empty:before:cursor-text","empty:before:content-[attr(data-blok-placeholder)]","[&[data-blok-empty=true]]:before:pointer-events-none","[&[data-blok-empty=true]]:before:text-gray-text","[&[data-blok-empty=true]]:before:cursor-text","[&[data-blok-empty=true]]:before:content-[attr(data-blok-placeholder)]"];if(i.length>0){e.setAttribute(o,i),e.classList.add(...s);return}n===!1&&e.hasAttribute(o)&&e.removeAttribute(o)}composeTunes(e){Array.from(this.tunes.values()).forEach(t=>{(t.isInternal?this.defaultTunesInstances:this.tunesInstances).set(t.name,t.create(e[t.name],this.blockAPI))}),Object.entries(e).forEach(([t,o])=>{this.tunesInstances.has(t)||(this.unavailableTunesData[t]=o)})}addInputEvents(){this.inputs.forEach(e=>{e.addEventListener("focus",this.handleFocus),v.isNativeInput(e)&&e.addEventListener("input",this.didMutated)})}removeInputEvents(){this.inputs.forEach(e=>{e.removeEventListener("focus",this.handleFocus),v.isNativeInput(e)&&e.removeEventListener("input",this.didMutated)})}watchBlockMutations(){var e;this.redactorDomChangedCallback=t=>{const{mutations:o}=t,n=this.toolRenderedElement;if(n===null)return;const i=o.filter(s=>dm(s,n));i.length>0&&this.didMutated(i)},(e=this.blokEventBus)==null||e.on(ps,this.redactorDomChangedCallback)}unwatchBlockMutations(){var e;(e=this.blokEventBus)==null||e.off(ps,this.redactorDomChangedCallback)}refreshToolRootElement(){const e=this.holder.querySelector(ds);if(!e)return;const t=e.firstElementChild;t&&t!==this.toolRenderedElement&&(this.toolRenderedElement=t,this.dropInputsCache())}detectToolRootChange(e){const t=this.toolRenderedElement;t!==null&&e.forEach(o=>{if(Array.from(o.removedNodes).includes(t)){const i=o.addedNodes[o.addedNodes.length-1];this.toolRenderedElement=i}})}dropInputsCache(){this.cachedInputs=[]}toggleInputsEmptyMark(){this.inputs.forEach(Fd)}};Pe.styles={wrapper:"relative opacity-100 animate-fade-in first:mt-0 [&_a]:cursor-pointer [&_a]:underline [&_a]:text-link [&_b]:font-bold [&_i]:italic",content:"relative mx-auto transition-colors duration-150 ease-out max-w-content",contentSelected:"bg-selection [&_[contenteditable]]:select-none [&_img]:opacity-55 [&_[data-blok-tool=stub]]:opacity-55",contentStretched:"max-w-none"};let Qt=Pe;class fm extends z{constructor(){super(...arguments),this.insert=(e,t={},o={},n,i,s,a)=>{const l=e!=null?e:this.config.defaultBlock,c=this.Blok.BlockManager.insert({id:a,tool:l,data:t,index:n,needToFocus:i,replace:s});return new Ye(c)},this.composeBlockData=async e=>{const t=this.Blok.Tools.blockTools.get(e);if(t===void 0)throw new Error(`Block Tool with type "${e}" not found`);return new Qt({tool:t,api:this.Blok.API,readOnly:!0,data:{},tunesData:{}}).data},this.update=async(e,t,o)=>{const{BlockManager:n}=this.Blok,i=n.getBlockById(e);if(i===void 0)throw new Error(`Block with id "${e}" not found`);const s=await n.update(i,t,o);return new Ye(s)},this.convert=async(e,t,o)=>{var u,h;const{BlockManager:n,Tools:i}=this.Blok,s=n.getBlockById(e);if(!s)throw new Error(`Block with id "${e}" not found`);const a=i.blockTools.get(s.name),l=i.blockTools.get(t);if(!l)throw new Error(`Block Tool with type "${t}" not found`);const c=((u=a==null?void 0:a.conversionConfig)==null?void 0:u.export)!==void 0,d=((h=l.conversionConfig)==null?void 0:h.import)!==void 0;if(c&&d){const p=await n.convert(s,t,o);return new Ye(p)}else{const p=[c?!1:Io(s.name),d?!1:Io(t)].filter(Boolean).join(" and ");throw new Error(`Conversion from "${s.name}" to "${t}" is not possible. ${p} tool(s) should provide a "conversionConfig"`)}},this.insertMany=(e,t=this.Blok.BlockManager.blocks.length-1)=>{this.validateIndex(t);const o=e.map(({id:n,type:i,data:s})=>this.Blok.BlockManager.composeBlock({id:n,tool:i||this.config.defaultBlock,data:s}));return this.Blok.BlockManager.insertMany(o,t),o.map(n=>new Ye(n))}}get methods(){return{clear:()=>this.clear(),render:e=>this.render(e),renderFromHTML:e=>this.renderFromHTML(e),delete:e=>this.delete(e),move:(e,t)=>this.move(e,t),getBlockByIndex:e=>this.getBlockByIndex(e),getById:e=>this.getById(e),getCurrentBlockIndex:()=>this.getCurrentBlockIndex(),getBlockIndex:e=>this.getBlockIndex(e),getBlocksCount:()=>this.getBlocksCount(),getBlockByElement:e=>this.getBlockByElement(e),insert:this.insert,insertMany:this.insertMany,update:this.update,composeBlockData:this.composeBlockData,convert:this.convert,stretchBlock:(e,t=!0)=>this.stretchBlock(e,t)}}getBlocksCount(){return this.Blok.BlockManager.blocks.length}getCurrentBlockIndex(){return this.Blok.BlockManager.currentBlockIndex}getBlockIndex(e){const t=this.Blok.BlockManager.getBlockById(e);if(!t){_e("There is no block with id `"+e+"`","warn");return}return this.Blok.BlockManager.getBlockIndex(t)}getBlockByIndex(e){const t=this.Blok.BlockManager.getBlockByIndex(e);if(t===void 0){_e("There is no block at index `"+e+"`","warn");return}return new Ye(t)}getById(e){const t=this.Blok.BlockManager.getBlockById(e);return t===void 0?(_e("There is no block with id `"+e+"`","warn"),null):new Ye(t)}getBlockByElement(e){const t=this.Blok.BlockManager.getBlock(e);if(t===void 0){_e("There is no block corresponding to element `"+e+"`","warn");return}return new Ye(t)}move(e,t){this.Blok.BlockManager.move(e,t)}delete(e=this.Blok.BlockManager.currentBlockIndex){const t=this.Blok.BlockManager.getBlockByIndex(e);if(t===void 0){_e(`There is no block at index \`${e}\``,"warn");return}try{this.Blok.BlockManager.removeBlock(t)}catch(o){_e(o,"warn");return}this.Blok.BlockManager.blocks.length===0&&this.Blok.BlockManager.insert(),this.Blok.BlockManager.currentBlock&&this.Blok.Caret.setToBlock(this.Blok.BlockManager.currentBlock,this.Blok.Caret.positions.END),this.Blok.Toolbar.close()}async clear(){await this.Blok.BlockManager.clear(!0),this.Blok.InlineToolbar.close()}async render(e){if(e===void 0||e.blocks===void 0)throw new Error("Incorrect data passed to the render() method");this.Blok.ModificationsObserver.disable(),await this.Blok.BlockManager.clear(),await this.Blok.Renderer.render(e.blocks),this.Blok.ModificationsObserver.enable()}async renderFromHTML(e){return await this.Blok.BlockManager.clear(),this.Blok.Paste.processText(e,!0)}stretchBlock(e,t=!0){const o=this.Blok.BlockManager.getBlockByIndex(e);o&&o.setStretchState(t)}validateIndex(e){if(typeof e!="number")throw new Error("Index should be a number");if(e<0)throw new Error("Index should be greater than or equal to 0");if(e===null)throw new Error("Index should be greater than or equal to 0")}}const pm=(r,e)=>typeof r=="number"?e.BlockManager.getBlockByIndex(r):typeof r=="string"?e.BlockManager.getBlockById(r):e.BlockManager.getBlockById(r.id);class gm extends z{constructor(){super(...arguments),this.setToFirstBlock=(e=this.Blok.Caret.positions.DEFAULT,t=0)=>this.Blok.BlockManager.firstBlock?(this.Blok.Caret.setToBlock(this.Blok.BlockManager.firstBlock,e,t),!0):!1,this.setToLastBlock=(e=this.Blok.Caret.positions.DEFAULT,t=0)=>this.Blok.BlockManager.lastBlock?(this.Blok.Caret.setToBlock(this.Blok.BlockManager.lastBlock,e,t),!0):!1,this.setToPreviousBlock=(e=this.Blok.Caret.positions.DEFAULT,t=0)=>this.Blok.BlockManager.previousBlock?(this.Blok.Caret.setToBlock(this.Blok.BlockManager.previousBlock,e,t),!0):!1,this.setToNextBlock=(e=this.Blok.Caret.positions.DEFAULT,t=0)=>this.Blok.BlockManager.nextBlock?(this.Blok.Caret.setToBlock(this.Blok.BlockManager.nextBlock,e,t),!0):!1,this.setToBlock=(e,t=this.Blok.Caret.positions.DEFAULT,o=0)=>{const n=pm(e,this.Blok);return n===void 0?!1:(this.Blok.Caret.setToBlock(n,t,o),!0)},this.focus=(e=!1)=>e?this.setToLastBlock(this.Blok.Caret.positions.END):this.setToFirstBlock(this.Blok.Caret.positions.START)}get methods(){return{setToFirstBlock:this.setToFirstBlock,setToLastBlock:this.setToLastBlock,setToPreviousBlock:this.setToPreviousBlock,setToNextBlock:this.setToNextBlock,setToBlock:this.setToBlock,focus:this.focus}}}class mm extends z{get methods(){return{emit:(e,t)=>this.emit(e,t),off:(e,t)=>this.off(e,t),on:(e,t)=>this.on(e,t)}}on(e,t){this.eventsDispatcher.on(e,t)}emit(e,t){this.eventsDispatcher.emit(e,t)}off(e,t){this.eventsDispatcher.off(e,t)}}class ks extends z{static getNamespace(e,t){return t?`blockTunes.${e}`:`tools.${e}`}get methods(){return{t:e=>(_e("I18n.t() method can be accessed only from Tools","warn"),"")}}getMethodsForTool(e,t){return Object.assign(this.methods,{t:o=>ie.t(ks.getNamespace(e,t),o)})}}class bm extends z{get methods(){return{blocks:this.Blok.BlocksAPI.methods,caret:this.Blok.CaretAPI.methods,tools:this.Blok.ToolsAPI.methods,events:this.Blok.EventsAPI.methods,history:this.Blok.HistoryAPI.methods,listeners:this.Blok.ListenersAPI.methods,notifier:this.Blok.NotifierAPI.methods,sanitizer:this.Blok.SanitizerAPI.methods,saver:this.Blok.SaverAPI.methods,selection:this.Blok.SelectionAPI.methods,styles:this.Blok.StylesAPI.classes,toolbar:this.Blok.ToolbarAPI.methods,inlineToolbar:this.Blok.InlineToolbarAPI.methods,tooltip:this.Blok.TooltipAPI.methods,i18n:this.Blok.I18nAPI.methods,readOnly:this.Blok.ReadOnlyAPI.methods,ui:this.Blok.UiAPI.methods}}getMethodsForTool(e,t){return Object.assign(this.methods,{i18n:this.Blok.I18nAPI.getMethodsForTool(e,t)})}}class vm extends z{get methods(){return{close:()=>this.close(),open:()=>this.open()}}open(){this.Blok.InlineToolbar.tryToShow()}close(){this.Blok.InlineToolbar.close()}}class km extends z{get methods(){return{on:(e,t,o,n)=>this.on(e,t,o,n),off:(e,t,o,n)=>this.off(e,t,o,n),offById:e=>this.offById(e)}}on(e,t,o,n){return this.listeners.on(e,t,o,n)}off(e,t,o,n){this.listeners.off(e,t,o,n)}offById(e){this.listeners.offById(e)}}class ym{constructor(){this.notifierModule=null,this.loadingPromise=null}loadNotifierModule(){return this.notifierModule!==null?Promise.resolve(this.notifierModule):(this.loadingPromise===null&&(this.loadingPromise=Promise.resolve().then(()=>Wv).then(e=>{var o;const t=(o=e==null?void 0:e.default)!=null?o:e;if(!this.isNotifierModule(t))throw new Error('notifier module does not expose a "show" method.');return this.notifierModule=t,t}).catch(e=>{throw this.loadingPromise=null,e})),this.loadingPromise)}show(e){this.loadNotifierModule().then(t=>{t.show(e)}).catch(t=>{console.error("[Blok] Failed to display notification. Reason:",t)})}isNotifierModule(e){return typeof e=="object"&&e!==null&&"show"in e&&typeof e.show=="function"}}class wm extends z{constructor({config:e,eventsDispatcher:t}){super({config:e,eventsDispatcher:t}),this.notifier=new ym}get methods(){return{show:e=>this.show(e)}}show(e){return this.notifier.show(e)}}class Tm extends z{get methods(){const e=()=>this.isEnabled;return{toggle:t=>this.toggle(t),get isEnabled(){return e()}}}toggle(e){return this.Blok.ReadOnly.toggle(e)}get isEnabled(){return this.Blok.ReadOnly.isEnabled}}var Lo={exports:{}},Bm=Lo.exports,bu;function xm(){return bu||(bu=1,(function(r,e){(function(t,o){r.exports=o()})(Bm,function(){function t(u){var h=u.tags,p=Object.keys(h),f=p.map(function(g){return typeof h[g]}).every(function(g){return g==="object"||g==="boolean"||g==="function"});if(!f)throw new Error("The configuration was invalid");this.config=u}var o=["P","LI","TD","TH","DIV","H1","H2","H3","H4","H5","H6","PRE"];function n(u){return o.indexOf(u.nodeName)!==-1}var i=["A","B","STRONG","I","EM","SUB","SUP","U","STRIKE"];function s(u){return i.indexOf(u.nodeName)!==-1}t.prototype.clean=function(u){const h=document.implementation.createHTMLDocument(),p=h.createElement("div");return p.innerHTML=u,this._sanitize(h,p),p.innerHTML},t.prototype._sanitize=function(u,h){var p=a(u,h),f=p.firstChild();if(f)do{if(f.nodeType===Node.TEXT_NODE)if(f.data.trim()===""&&(f.previousElementSibling&&n(f.previousElementSibling)||f.nextElementSibling&&n(f.nextElementSibling))){h.removeChild(f),this._sanitize(u,h);break}else continue;if(f.nodeType===Node.COMMENT_NODE){h.removeChild(f),this._sanitize(u,h);break}var g=s(f),b;g&&(b=Array.prototype.some.call(f.childNodes,n));var k=!!h.parentNode,y=n(h)&&n(f)&&k,x=f.nodeName.toLowerCase(),T=l(this.config,x,f),R=g&&b;if(R||c(f,T)||!this.config.keepNestedBlockElements&&y){if(!(f.nodeName==="SCRIPT"||f.nodeName==="STYLE"))for(;f.childNodes.length>0;)h.insertBefore(f.childNodes[0],f);h.removeChild(f),this._sanitize(u,h);break}for(var C=0;C<f.attributes.length;C+=1){var E=f.attributes[C];d(E,T,f)&&(f.removeAttribute(E.name),C=C-1)}this._sanitize(u,f)}while(f=p.nextSibling())};function a(u,h){return u.createTreeWalker(h,NodeFilter.SHOW_TEXT|NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT,null,!1)}function l(u,h,p){return typeof u.tags[h]=="function"?u.tags[h](p):u.tags[h]}function c(u,h){return typeof h=="undefined"?!0:typeof h=="boolean"?!h:!1}function d(u,h,p){var f=u.name.toLowerCase();return h===!0?!1:typeof h[f]=="function"?!h[f](u.value,p):typeof h[f]=="undefined"||h[f]===!1?!0:typeof h[f]=="string"?h[f]!==u.value:!1}return t})})(Lo)),Lo.exports}var Cm=xm();const Em=G(Cm),Sm=/^\s*(?:javascript\s*:|data\s*:\s*text\s*\/\s*html)/i,Am=/\s*(?:href|src)\s*=\s*(?:"\s*(?:javascript\s*:|data\s*:\s*text\s*\/\s*html)[^"]*"|'\s*(?:javascript\s*:|data\s*:\s*text\s*\/\s*html)[^']*|(?:javascript\s*:|data\s*:\s*text\s*\/\s*html)[^ \t\r\n>]*)/gi,ys=(r,e,t={})=>r.map(o=>{const n=V(e)?e(o.tool):e,i=n!=null?n:{};return Z(i)&&le(i)&&le(t)?o:Re(K({},o),{data:ws(o.data,i,t)})}),Ge=(r,e={})=>{const t={tags:e};return new Em(t).clean(r)},ws=(r,e,t)=>Array.isArray(r)?Im(r,e,t):Z(r)?Rm(r,e,t):qe(r)?Nm(r,e,t):r,Im=(r,e,t)=>r.map(o=>ws(o,e,t)),Rm=(r,e,t)=>{const o={},n=r;for(const i in r){if(!Object.prototype.hasOwnProperty.call(r,i))continue;const s=n[i],a=Z(e)?e:void 0,l=a==null?void 0:a[i],c=l!==void 0&&Om(l)?l:e;o[i]=ws(s,c,t)}return o},Nm=(r,e,t)=>{const o=Fm(e,t);if(o){const n=Ge(r,o);return Ts(ku(n,o))}if(!le(t)){const n=Ge(r,t);return Ts(ku(n,t))}return Ts(r)},Om=r=>Z(r)||Nd(r)||V(r),_m=r=>r?Sm.test(r):!1,Ts=r=>{if(!r||r.indexOf("<")===-1)return r;if(typeof document!="undefined"){const e=document.createElement("template");return e.innerHTML=r,e.content.querySelectorAll("[href],[src]").forEach(o=>{["href","src"].forEach(n=>{const i=o.getAttribute(n);_m(i)&&o.removeAttribute(n)})}),e.innerHTML}return r.replace(Am,"")},Bs=r=>{if(le(r))return{};const e={};for(const t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=pt(r[t]));return e},vu=r=>function(t){const o=r.call(this,t);return o==null?{}:o},Lm=new Set(["class","id","title","role","dir","lang"]),Dm=r=>{const e=r.toLowerCase();return e.startsWith("data-")||e.startsWith("aria-")||Lm.has(e)},Mm=r=>{const e={};return Array.from(r.attributes).forEach(t=>{Dm(t.name)&&(e[t.name]=!0)}),e},pt=r=>r===!0?vu(Mm):r===!1?!1:V(r)?vu(r):qe(r)?r:Z(r)?$t({},r):r,Pm=(r,e)=>{if(le(r))return Bs(e);const t={};for(const o in r){if(!Object.prototype.hasOwnProperty.call(r,o))continue;const n=r[o],i=e?e[o]:void 0;if(V(i)){t[o]=pt(i);continue}if(V(n)){t[o]=pt(n);continue}if(Z(n)&&Z(i)){t[o]=$t({},i,n);continue}if(i!==void 0){t[o]=pt(i);continue}t[o]=pt(n)}return t},Fm=(r,e)=>Z(r)&&!V(r)?Pm(e,r):r===!1?{}:le(e)?null:Bs(e),xs=(r,...e)=>{if(le(r))return Object.assign({},...e);const t=Bs(r);return e.forEach(o=>{if(o)for(const n in o){if(!Object.prototype.hasOwnProperty.call(o,n))continue;const i=o[n];if(!Object.prototype.hasOwnProperty.call(t,n))continue;const s=t[n];if(V(i)){t[n]=i;continue}if(!(i===!0&&V(s))){if(i===!0){const a=Z(s)&&!V(s);t[n]=a?$t({},s):pt(i);continue}if(Z(i)&&Z(s)){t[n]=$t({},s,i);continue}t[n]=pt(i)}}}),t},ku=(r,e)=>{if(typeof document=="undefined"||!r||r.indexOf("<")===-1)return r;const t=Object.entries(e).filter(([,n])=>V(n));if(t.length===0)return r;const o=document.createElement("template");return o.innerHTML=r,t.forEach(([n,i])=>{o.content.querySelectorAll(n).forEach(a=>{const l=i(a);if(!(Nd(l)||V(l)||l==null))for(const[c,d]of Object.entries(l)){if(d===!1){a.removeAttribute(c);continue}d!==!0&&qe(d)&&a.setAttribute(c,d)}})}),o.innerHTML};class Hm extends z{get methods(){return{clean:(e,t)=>this.clean(e,t)}}clean(e,t){return Ge(e,t)}}class qm extends z{get methods(){return{save:()=>this.save()}}async save(){var i,s;const e="Blok's content can not be saved in read-only mode";if(this.Blok.ReadOnly.isEnabled)throw _e(e,"warn"),new Error(e);const t=await this.Blok.Saver.save();if(t!==void 0)return t;const o=(s=(i=this.Blok.Saver).getLastSaveError)==null?void 0:s.call(i);if(o instanceof Error)throw o;const n=o!==void 0?String(o):"Blok's content can not be saved because collecting data failed";throw new Error(n)}}class zm extends z{constructor(){super(...arguments),this.selectionUtils=new O}get methods(){return{findParentTag:(e,t)=>this.findParentTag(e,t),expandToTag:e=>this.expandToTag(e),save:()=>this.selectionUtils.save(),restore:()=>this.selectionUtils.restore(),setFakeBackground:()=>this.selectionUtils.setFakeBackground(),removeFakeBackground:()=>this.selectionUtils.removeFakeBackground()}}findParentTag(e,t){return this.selectionUtils.findParentTag(e,t)}expandToTag(e){this.selectionUtils.expandToTag(e)}}class jm extends z{get methods(){return{getBlockTools:()=>Array.from(this.Blok.Tools.blockTools.values())}}}class Um extends z{get classes(){return{block:"blok-block",inlineToolButton:"blok-inline-tool-button",inlineToolButtonActive:"blok-inline-tool-button--active",input:"blok-input",loader:"blok-loader",button:"blok-button",settingsButton:"blok-settings-button",settingsButtonActive:"blok-settings-button--active",settingsButtonFocused:"blok-settings-button--focused",settingsButtonFocusedAnimated:"blok-settings-button--focused-animated"}}}class Km extends z{get methods(){return{close:()=>this.close(),open:()=>this.open(),toggleBlockSettings:e=>this.toggleBlockSettings(e),toggleToolbox:e=>this.toggleToolbox(e)}}open(){this.Blok.Toolbar.moveAndOpen()}close(){this.Blok.Toolbar.close()}toggleBlockSettings(e){if(this.Blok.BlockManager.currentBlockIndex===-1){_e("Could't toggle the Toolbar because there is no block selected ","warn");return}(e!=null?e:!this.Blok.BlockSettings.opened)?(this.Blok.Toolbar.moveAndOpen(),this.Blok.BlockSettings.open()):this.Blok.BlockSettings.close()}toggleToolbox(e){if(this.Blok.BlockManager.currentBlockIndex===-1){_e("Could't toggle the Toolbox because there is no block selected ","warn");return}(e!=null?e:!this.Blok.Toolbar.toolbox.opened)?(this.Blok.Toolbar.moveAndOpen(),this.Blok.Toolbar.toolbox.open()):this.Blok.Toolbar.toolbox.close()}}const Cs=10,Wm="tooltip",Gm="aria-hidden",$m="false",Vm="true",Xm="visibility",Ym="visible",Zm="hidden",ut=class ut{constructor(){this.nodes={wrapper:null,content:null},this.showed=!1,this.offsetTop=Cs,this.offsetLeft=Cs,this.offsetRight=Cs,this.showingTimeout=null,this.hidingDelay=0,this.hidingTimeout=null,this.ariaObserver=null,this.handleWindowScroll=()=>{this.showed&&this.hide(!0)},this.prepare(),window.addEventListener("scroll",this.handleWindowScroll,{passive:!0})}get CSS(){return{tooltip:me("absolute z-overlay top-0 left-0","bg-tooltip-bg opacity-0","select-none pointer-events-none","transition-[opacity,transform] duration-[50ms,70ms] ease-in","rounded-lg shadow-tooltip","will-change-[opacity,top,left]","before:content-[''] before:absolute before:inset-0 before:bg-tooltip-bg before:-z-10 before:rounded-lg","mobile:hidden").split(" "),tooltipContent:me("px-2.5 py-1.5","text-tooltip-font text-xs text-center","tracking-[0.02em] leading-[1em]").split(" "),tooltipShown:["opacity-100","transform-none"],placement:{left:["-translate-x-[5px]"],bottom:["translate-y-[5px]"],right:["translate-x-[5px]"],top:["-translate-y-[5px]"]}}}static getInstance(){return ut.instance||(ut.instance=new ut),ut.instance}show(e,t,o={}){this.nodes.wrapper||this.prepare(),this.hidingTimeout&&(clearTimeout(this.hidingTimeout),this.hidingTimeout=null);const i=Object.assign({placement:"bottom",marginTop:0,marginLeft:0,marginRight:0,marginBottom:0,delay:70,hidingDelay:0},o);if(i.hidingDelay&&(this.hidingDelay=i.hidingDelay),!this.nodes.content||(this.nodes.content.innerHTML="",this.nodes.content.appendChild(this.createContentNode(t)),!this.nodes.wrapper))return;const s=Object.values(this.CSS.placement).flatMap(a=>Array.isArray(a)?a:[a]);switch(this.nodes.wrapper.classList.remove(...s),i.placement){case"top":this.placeTop(e,i);break;case"left":this.placeLeft(e,i);break;case"right":this.placeRight(e,i);break;case"bottom":default:this.placeBottom(e,i);break}if(i&&i.delay){this.showingTimeout=setTimeout(()=>{if(this.nodes.wrapper){const a=Array.isArray(this.CSS.tooltipShown)?this.CSS.tooltipShown:[this.CSS.tooltipShown];this.nodes.wrapper.classList.add(...a),this.updateTooltipVisibility()}this.showed=!0},i.delay);return}if(this.nodes.wrapper){const a=Array.isArray(this.CSS.tooltipShown)?this.CSS.tooltipShown:[this.CSS.tooltipShown];this.nodes.wrapper.classList.add(...a),this.updateTooltipVisibility()}this.showed=!0}createContentNode(e){if(typeof e=="string")return document.createTextNode(e);if(e instanceof Node)return e;throw Error("[Blok Tooltip] Wrong type of «content» passed. It should be an instance of Node or String. But "+typeof e+" given.")}hide(e=!1){const t=!!this.hidingDelay&&!e;if(t&&this.hidingTimeout&&clearTimeout(this.hidingTimeout),t){this.hidingTimeout=setTimeout(()=>{this.hide(!0)},this.hidingDelay);return}if(this.nodes.wrapper){const o=Array.isArray(this.CSS.tooltipShown)?this.CSS.tooltipShown:[this.CSS.tooltipShown];this.nodes.wrapper.classList.remove(...o),this.updateTooltipVisibility()}this.showed=!1,this.showingTimeout&&(clearTimeout(this.showingTimeout),this.showingTimeout=null)}onHover(e,t,o={}){e.addEventListener("mouseenter",()=>{this.show(e,t,o)}),e.addEventListener("mouseleave",()=>{this.hide()})}destroy(){var e;(e=this.ariaObserver)==null||e.disconnect(),this.ariaObserver=null,this.nodes.wrapper&&this.nodes.wrapper.remove(),window.removeEventListener("scroll",this.handleWindowScroll),ut.instance=null}prepare(){this.nodes.wrapper=this.make("div",this.CSS.tooltip),this.nodes.wrapper.setAttribute(Ot,ls),this.nodes.wrapper.setAttribute("data-blok-testid","tooltip"),this.nodes.content=this.make("div",this.CSS.tooltipContent),this.nodes.content.setAttribute("data-blok-testid","tooltip-content"),this.nodes.wrapper&&this.nodes.content&&(this.append(this.nodes.wrapper,this.nodes.content),this.append(document.body,this.nodes.wrapper),this.ensureTooltipAttributes())}updateTooltipVisibility(){if(!this.nodes.wrapper)return;const e=Array.isArray(this.CSS.tooltipShown)?this.CSS.tooltipShown[0]:this.CSS.tooltipShown,t=this.nodes.wrapper.classList.contains(e);this.nodes.wrapper.style.setProperty(Xm,t?Ym:Zm),this.nodes.wrapper.setAttribute(Gm,t?$m:Vm),this.nodes.wrapper.setAttribute("data-blok-shown",t?"true":"false")}watchTooltipVisibility(){var e;this.nodes.wrapper&&((e=this.ariaObserver)==null||e.disconnect(),this.updateTooltipVisibility(),this.ariaObserver=new MutationObserver(()=>{this.updateTooltipVisibility()}),this.ariaObserver.observe(this.nodes.wrapper,{attributes:!0,attributeFilter:["class"]}))}ensureTooltipAttributes(){this.nodes.wrapper&&((!this.nodes.wrapper.hasAttribute(Ot)||this.nodes.wrapper.getAttribute(Ot)!==ls)&&this.nodes.wrapper.setAttribute(Ot,ls),this.nodes.wrapper.setAttribute("role",Wm),this.watchTooltipVisibility())}placeBottom(e,t){var s;if(!this.nodes.wrapper)return;const o=e.getBoundingClientRect(),n=o.left+e.clientWidth/2-this.nodes.wrapper.offsetWidth/2,i=o.bottom+this.getScrollTop()+this.offsetTop+((s=t.marginTop)!=null?s:0);this.applyPlacement("bottom",n,i)}placeTop(e,t){if(!this.nodes.wrapper)return;const o=e.getBoundingClientRect(),n=o.left+e.clientWidth/2-this.nodes.wrapper.offsetWidth/2,i=o.top+this.getScrollTop()-this.nodes.wrapper.clientHeight-this.offsetTop;this.applyPlacement("top",n,i)}placeLeft(e,t){var s;if(!this.nodes.wrapper)return;const o=e.getBoundingClientRect(),n=o.left-this.nodes.wrapper.offsetWidth-this.offsetLeft-((s=t.marginLeft)!=null?s:0),i=o.top+this.getScrollTop()+e.clientHeight/2-this.nodes.wrapper.offsetHeight/2;this.applyPlacement("left",n,i)}placeRight(e,t){var s;if(!this.nodes.wrapper)return;const o=e.getBoundingClientRect(),n=o.right+this.offsetRight+((s=t.marginRight)!=null?s:0),i=o.top+this.getScrollTop()+e.clientHeight/2-this.nodes.wrapper.offsetHeight/2;this.applyPlacement("right",n,i)}applyPlacement(e,t,o){if(!this.nodes.wrapper)return;const n=Array.isArray(this.CSS.placement[e])?this.CSS.placement[e]:[this.CSS.placement[e]];this.nodes.wrapper.classList.add(...n),this.nodes.wrapper.setAttribute("data-blok-placement",e),this.nodes.wrapper.style.left=`${t}px`,this.nodes.wrapper.style.top=`${o}px`}getScrollTop(){var e,t,o;return typeof window.scrollY=="number"?window.scrollY:(o=(t=(e=document.documentElement)==null?void 0:e.scrollTop)!=null?t:document.body.scrollTop)!=null?o:0}make(e,t=null,o={}){const n=document.createElement(e);Array.isArray(t)&&n.classList.add(...t),typeof t=="string"&&n.classList.add(t);for(const i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i]);return n}append(e,t){Array.isArray(t)?t.forEach(o=>e.appendChild(o)):e.appendChild(t)}prepend(e,t){Array.isArray(t)?t.reverse().forEach(n=>e.prepend(n)):e.prepend(t)}};ut.instance=null;let Es=ut;const Do=()=>Es.getInstance(),Jm=(r,e,t)=>{Do().show(r,e,t!=null?t:{})},eo=(r=!1)=>{Do().hide(r)},Mo=(r,e,t)=>{Do().onHover(r,e,t!=null?t:{})},Qm=()=>{Do().destroy()};class eb extends z{constructor({config:e,eventsDispatcher:t}){super({config:e,eventsDispatcher:t})}get methods(){return{show:(e,t,o)=>this.show(e,t,o),hide:()=>this.hide(),onHover:(e,t,o)=>this.onHover(e,t,o)}}show(e,t,o){Jm(e,t,o)}hide(){eo()}onHover(e,t,o){Mo(e,t,o)}}class tb extends z{get methods(){return{nodes:this.blokNodes}}get blokNodes(){return{wrapper:this.Blok.UI.nodes.wrapper,redactor:this.Blok.UI.nodes.redactor}}}class ob extends z{get methods(){return{undo:()=>this.undo(),redo:()=>this.redo(),canUndo:()=>this.canUndo(),canRedo:()=>this.canRedo(),clear:()=>this.clear(),captureInitialState:()=>this.captureInitialState()}}async undo(){return this.Blok.History.undo()}async redo(){return this.Blok.History.redo()}canUndo(){return this.Blok.History.canUndo()}canRedo(){return this.Blok.History.canRedo()}clear(){this.Blok.History.clear()}async captureInitialState(){return this.Blok.History.captureInitialState()}}const yu=(r,e)=>{const t={};return Object.entries(r).forEach(([o,n])=>{if(!Z(n)){t[o]=n;return}const i=e?`${e}.${o}`:o;if(!Object.values(n).every(a=>qe(a))){t[o]=yu(n,i);return}t[o]=i}),t},pe=yu(Hd),Bt=class Bt{constructor(e,t){this.cursor=-1,this.items=[],this.items=e!=null?e:[],this.focusedCssClass=t}get currentItem(){return this.cursor===-1?null:this.items[this.cursor]}setCursor(e){e<this.items.length&&e>=-1&&(this.dropCursor(),this.cursor=e,this.items[this.cursor].classList.add(this.focusedCssClass),this.items[this.cursor].setAttribute("data-blok-focused","true"))}setItems(e){this.items=e}hasItems(){return this.items.length>0}next(){this.cursor=this.leafNodesAndReturnIndex(Bt.directions.RIGHT)}previous(){this.cursor=this.leafNodesAndReturnIndex(Bt.directions.LEFT)}dropCursor(){this.cursor!==-1&&(this.items[this.cursor].classList.remove(this.focusedCssClass),this.items[this.cursor].removeAttribute("data-blok-focused"),this.cursor=-1)}leafNodesAndReturnIndex(e){if(this.items.length===0)return this.cursor;const t=e===Bt.directions.RIGHT?-1:0,o=this.cursor===-1?t:this.cursor;o!==-1&&(this.items[o].classList.remove(this.focusedCssClass),this.items[o].removeAttribute("data-blok-focused"));const n=e===Bt.directions.RIGHT?(o+1)%this.items.length:(this.items.length+o-1)%this.items.length;return v.canSetCaret(this.items[n])&&Ao(()=>O.setCursor(this.items[n]),50)(),this.items[n].classList.add(this.focusedCssClass),this.items[n].setAttribute("data-blok-focused","true"),n}};Bt.directions={RIGHT:"right",LEFT:"left"};let gt=Bt;class st{constructor(e){var t,o;this.iterator=null,this.activated=!1,this.skipNextTabFocus=!1,this.flipCallbacks=[],this.onKeyDown=n=>{var c,d;const i=n.target;if(this.shouldSkipTarget(i,n))return;const s=this.getKeyCode(n),a=s===I.LEFT||s===I.RIGHT||s===I.UP||s===I.DOWN;if(!(n.shiftKey&&a||!this.isEventReadyForHandling(n))&&!(s===I.ENTER&&!((c=this.iterator)!=null&&c.currentItem)))switch(n.stopPropagation(),n.stopImmediatePropagation(),s!==null&&st.usedKeys.includes(s)&&n.preventDefault(),s){case I.TAB:this.handleTabPress(n);break;case I.LEFT:this.onArrowLeftCallback&&this.onArrowLeftCallback();break;case I.UP:this.flipLeft();break;case I.RIGHT:(d=this.iterator)!=null&&d.currentItem&&this.currentItemHasChildren()&&this.handleEnterPress(n);break;case I.DOWN:this.flipRight();break;case I.ENTER:this.handleEnterPress(n);break}},this.iterator=new gt(e.items||[],(t=e.focusedItemClass)!=null?t:""),this.activateCallback=e.activateCallback,this.allowedKeys=e.allowedKeys||st.usedKeys,this.handleContentEditableTargets=(o=e.handleContentEditableTargets)!=null?o:!1,this.onArrowLeftCallback=e.onArrowLeft}get isActivated(){return this.activated}static get usedKeys(){return[I.TAB,I.LEFT,I.RIGHT,I.ENTER,I.UP,I.DOWN]}activate(e,t){var o,n;this.activated=!0,e&&((o=this.iterator)==null||o.setItems(e)),t!==void 0&&((n=this.iterator)==null||n.setCursor(t)),document.addEventListener("keydown",this.onKeyDown,!0),window.addEventListener("keydown",this.onKeyDown,!0)}deactivate(){this.activated=!1,this.dropCursor(),this.skipNextTabFocus=!1,document.removeEventListener("keydown",this.onKeyDown,!0),window.removeEventListener("keydown",this.onKeyDown,!0)}focusFirst(){this.dropCursor(),this.flipRight()}focusItem(e){const t=this.iterator;if(t&&t.hasItems()){if(e<0){t.dropCursor();return}!t.currentItem&&e===0&&(this.skipNextTabFocus=!0),t.setCursor(e)}}flipLeft(){var e;(e=this.iterator)==null||e.previous(),this.flipCallback()}flipRight(){var e;(e=this.iterator)==null||e.next(),this.flipCallback()}hasFocus(){var e;return!!((e=this.iterator)!=null&&e.currentItem)}currentItemHasChildren(){var t;const e=(t=this.iterator)==null?void 0:t.currentItem;return e?e.hasAttribute("data-blok-has-children"):!1}onFlip(e){this.flipCallbacks.push(e)}removeOnFlip(e){this.flipCallbacks=this.flipCallbacks.filter(t=>t!==e)}dropCursor(){var e;(e=this.iterator)==null||e.dropCursor()}getKeyCode(e){var o;return(o={Tab:I.TAB,Enter:I.ENTER,ArrowLeft:I.LEFT,ArrowRight:I.RIGHT,ArrowUp:I.UP,ArrowDown:I.DOWN}[e.key])!=null?o:null}isEventReadyForHandling(e){const t=this.getKeyCode(e);return this.activated&&t!==null&&this.allowedKeys.includes(t)}setHandleContentEditableTargets(e){this.handleContentEditableTargets=e}handleTabPress(e){const o=e.shiftKey?gt.directions.LEFT:gt.directions.RIGHT;if(this.skipNextTabFocus){this.skipNextTabFocus=!1;return}switch(o){case gt.directions.RIGHT:this.flipRight();break;case gt.directions.LEFT:this.flipLeft();break}}handleExternalKeydown(e){this.onKeyDown(e)}handleEnterPress(e){var t,o;this.activated&&((t=this.iterator)!=null&&t.currentItem&&(e.stopPropagation(),e.preventDefault(),this.iterator.currentItem.click()),V(this.activateCallback)&&((o=this.iterator)!=null&&o.currentItem)&&this.activateCallback(this.iterator.currentItem))}flipCallback(){var e,t,o;(e=this.iterator)!=null&&e.currentItem&&((o=(t=this.iterator.currentItem).scrollIntoViewIfNeeded)==null||o.call(t)),this.flipCallbacks.forEach(n=>n())}shouldSkipTarget(e,t){if(!e)return!1;const o=e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement,n=t.key==="Tab"||t.key==="ArrowUp"||t.key==="ArrowDown"||t.key==="Enter"||t.key==="ArrowRight"||t.key==="ArrowLeft",i=e.getAttribute("data-blok-flipper-navigation-target")==="true"&&n,s=e.isContentEditable,a=e.closest('[data-blok-link-tool-input-opened="true"]')!==null,l=s&&!this.handleContentEditableTargets;return o&&!i||l||a}}const to={root:"",alignedStart:"text-start",alignedCenter:"text-center",title:"",description:"opacity-60 mt-[3px]"};class nb{constructor(e){const t=e.alignment==="center"?"center":"start";this.nodes={root:v.make("div",[to.root,t==="center"?to.alignedCenter:to.alignedStart]),title:v.make("div",to.title,{textContent:e.title})},this.nodes.root.setAttribute("data-alignment",t),this.nodes.root.appendChild(this.nodes.title),e.description!==void 0&&(this.nodes.description=v.make("div",to.description,{textContent:e.description}),this.nodes.root.appendChild(this.nodes.description))}getElement(){return this.nodes.root}}class Ss{constructor(e){this.params=e}get name(){if(this.params!==void 0&&"name"in this.params)return this.params.name}destroy(){eo()}onChildrenOpen(){var e;this.params!==void 0&&"children"in this.params&&typeof((e=this.params.children)==null?void 0:e.onOpen)=="function"&&this.params.children.onOpen()}onChildrenClose(){var e;this.params!==void 0&&"children"in this.params&&typeof((e=this.params.children)==null?void 0:e.onClose)=="function"&&this.params.children.onClose()}handleClick(){var e,t;this.params!==void 0&&"onActivate"in this.params&&((t=(e=this.params).onActivate)==null||t.call(e,this.params))}addHint(e,t){const o=new nb(t);Mo(e,o.getElement(),{placement:t.position,hidingDelay:100})}getMountElement(){return this.getElement()}get children(){var e;return this.params!==void 0&&"children"in this.params&&((e=this.params.children)==null?void 0:e.items)!==void 0?this.params.children.items:[]}get hasChildren(){return this.children.length>0}get isChildrenOpen(){var e;return this.params!==void 0&&"children"in this.params&&((e=this.params.children)==null?void 0:e.isOpen)===!0}get isChevronHidden(){var e;return this.params!==void 0&&"children"in this.params&&((e=this.params.children)==null?void 0:e.hideChevron)===!0}get isChildrenFlippable(){var e;return!(this.params===void 0||!("children"in this.params)||((e=this.params.children)==null?void 0:e.isFlippable)===!1)}get isChildrenSearchable(){var e;return this.params!==void 0&&"children"in this.params&&((e=this.params.children)==null?void 0:e.searchable)===!0}get closeOnActivate(){return this.params!==void 0&&"closeOnActivate"in this.params&&this.params.closeOnActivate}get isActive(){return this.params===void 0||!("isActive"in this.params)?!1:typeof this.params.isActive=="function"?this.params.isActive():this.params.isActive===!0}}const Qe={item:'flex items-center select-none border-none bg-transparent rounded-md p-[var(--item-padding)] text-text-primary mb-px can-hover:hover:cursor-pointer can-hover:hover:bg-item-hover-bg [&[data-blok-force-hover]]:cursor-pointer [&[data-blok-force-hover]]:bg-item-hover-bg [&[data-blok-focused="true"]]:bg-item-focus-bg [&[data-blok-popover-item-no-hover]]:hover:bg-transparent [&[data-blok-popover-item-no-hover]]:cursor-default',itemActive:"bg-icon-active-bg text-icon-active-text",itemDisabled:"cursor-default pointer-events-none text-text-secondary",icon:"flex items-center justify-center w-[26px] h-[26px] [&_svg]:w-icon [&_svg]:h-icon",focused:"is-focused"},rb={item:"rounded p-1"},ib={item:"rounded-md p-[3px] mobile:p-1"},ee={item:"data-blok-popover-item",icon:"data-blok-popover-item-icon",iconTool:"data-blok-tool",iconChevronRight:"data-blok-popover-item-icon-chevron-right",title:"data-blok-popover-item-title",secondaryTitle:"data-blok-popover-item-secondary-title",active:"data-blok-popover-item-active",hidden:"data-blok-hidden",confirmation:"data-blok-popover-item-confirmation",noHover:"data-blok-popover-item-no-hover",noFocus:"data-blok-popover-item-no-focus",focused:"data-blok-focused",wobble:"data-blok-popover-item-wobble",disabled:"data-blok-disabled",hasChildren:"data-blok-has-children"},sb=`
11
- <svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
12
- <path d="m4.5 15 11-11m0 11L4.5 4" stroke="currentColor" stroke-linecap="round"/>
13
- </svg>
14
- `,ab=`
15
- <svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
16
- <path
17
- d="M5.5 11h4.9231c.6528 0 1.2789-.3161 1.7405-.8787.4617-.56259.721-1.32565.721-2.1213 0-.79565-.2593-1.55871-.721-2.12132C11.702 5.31607 11.0759 5 10.4231 5H5.5v6Zm0 0h5.5385c.6528 0 1.2789.3161 1.7405.8787.4617.5626.721 1.3257.721 2.1213 0 .7956-.2593 1.5587-.721 2.1213-.4616.5626-1.0877.8787-1.7405.8787H5.5v-6Z"
18
- stroke="currentColor"
19
- stroke-width="1.25"
20
- stroke-linecap="round"
21
- stroke-linejoin="round"
22
- />
23
- </svg>
24
- `,lb=`
25
- <svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
26
- <path
27
- d="M8.5 5h6m-10 12h6m1-12-4 12"
28
- stroke="currentColor"
29
- stroke-linecap="round"
30
- stroke-linejoin="round"
31
- />
32
- </svg>
33
- `,cb=`
34
- <svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
35
- <path
36
- d="m9.98288 15.0959-.91628.9157c-.29867.3092-.65593.5559-1.05095.7255-.39502.1697-.81987.259-1.24978.2628-.4299.0037-.85625-.0782-1.25415-.241-.39791-.1628-.75941-.4032-1.06341-.7072-.304-.304-.54441-.6655-.70721-1.0634-.16279-.3979-.24471-.8243-.24098-1.2542.00374-.4299.09306-.8547.26274-1.2497.16969-.3951.41635-.7523.72558-1.051l.91499-.9163m8.24197.9156.9163-.9156c.6028-.60809.9402-1.43021.9383-2.28645-.0019-.85625-.3429-1.67688-.9483-2.28234-.6055-.60546-1.4261-.94643-2.2823-.9483-.8563-.00188-1.6784.3355-2.28652.9383l-.91628.91563M7.258 13.2413l4.5328-4.53278"
37
- stroke="currentColor"
38
- stroke-width=".784151"
39
- stroke-linecap="round"
40
- stroke-linejoin="round"
41
- />
42
- </svg>
43
- `,db=`
44
- <svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
45
- <path
46
- d="M15.5 14.003h-3v-3.0004m-9-6.00078h3v3.0004m1.55478-3.80901A5.2170862 5.2170862 0 0 1 9.5 4.00014c1.1682.00058 2.3059.37321 3.2481 1.06388.9422.69067 1.64 1.66348 1.9923 2.77744.3523 1.11396.3407 2.31114-.033 3.41814-.3738 1.1069-1.0903 2.0661-2.0457 2.7384m-1.7165.8088c-.4703.1317-.9568.1967-1.4452.1931-1.16819-.0006-2.30585-.3733-3.24807-1.0639-.94222-.6907-1.64004-1.6635-1.99232-2.7775-.35229-1.1139-.34072-2.31114.03302-3.41808.37375-1.10694 1.09024-2.06608 2.04563-2.73841"
47
- stroke="currentColor"
48
- stroke-miterlimit="10"
49
- stroke-linecap="round"
50
- />
51
- </svg>
52
- `,ub=`
53
- <svg width="24" height="24" fill="none" xmlns="http://www.w3.org/2000/svg">
54
- <path
55
- d="M8 6c0-.55228.44772-1 1-1s1 .44772 1 1-.44772 1-1 1-1-.44772-1-1Zm0 6c0-.5523.44772-1 1-1s1 .4477 1 1-.44772 1-1 1-1-.4477-1-1Zm0 6c0-.5523.44772-1 1-1s1 .4477 1 1-.44772 1-1 1-1-.4477-1-1Zm6-12c0-.55228.4477-1 1-1s1 .44772 1 1-.4477 1-1 1-1-.44772-1-1Zm0 6c0-.5523.4477-1 1-1s1 .4477 1 1-.4477 1-1 1-1-.4477-1-1Zm0 6c0-.5523.4477-1 1-1s1 .4477 1 1-.4477 1-1 1-1-.4477-1-1Z"
56
- fill="currentColor"
57
- />
58
- </svg>
59
- `,hb=`
60
- <svg width="24" height="24" fill="none" xmlns="http://www.w3.org/2000/svg">
61
- <path d="M4.5 11.0711h14.1421m-7.071 7.071V4" stroke="currentColor" stroke-linecap="round"/>
62
- </svg>
63
- `,fb=`
64
- <svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
65
- <path d="m12.5 5-5 5 5 5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
66
- </svg>
67
- `,pb=`
68
- <svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
69
- <path d="m7.5 15 5-5-5-5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
70
- </svg>
71
- `,gb=`
72
- <svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
73
- <path
74
- d="m17.5 17.5-5-5m1.6667-4.16667c0 .76605-.1509 1.52459-.4441 2.23237-.2931.7077-.7228 1.3507-1.2645 1.8924-.5417.5417-1.1847.9714-1.8924 1.2645-.70778.2932-1.46632.4441-2.23237.4441-.76604 0-1.52458-.1509-2.23232-.4441-.70773-.2931-1.35079-.7228-1.89247-1.2645-.54167-.5417-.97135-1.1847-1.2645-1.8924C2.65088 9.85792 2.5 9.09938 2.5 8.33333c0-1.54709.61458-3.03082 1.70854-4.12479C5.30251 3.11458 6.78624 2.5 8.33333 2.5c1.5471 0 3.03087.61458 4.12477 1.70854 1.094 1.09397 1.7086 2.5777 1.7086 4.12479Z"
75
- stroke="currentColor"
76
- stroke-linecap="round"
77
- stroke-linejoin="round"
78
- />
79
- </svg>
80
- `,mb=`
81
- <svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
82
- <path
83
- d="M3.33334 10H10m-6.66666 5V5M10 15V5m4.1667 5 2.5-1.66667V15"
84
- stroke="currentColor"
85
- stroke-linecap="round"
86
- stroke-linejoin="round"
87
- />
88
- </svg>
89
- `,bb=`
90
- <svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
91
- <path
92
- d="M3.33334 10H10m-6.66666 5V5M10 15V5m7.5 10h-3.3333c0-3.3333 3.3333-2.5 3.3333-5 0-1.25-1.6667-2.08333-3.3333-.83333"
93
- stroke="currentColor"
94
- stroke-linecap="round"
95
- stroke-linejoin="round"
96
- />
97
- </svg>
98
- `,vb=`
99
- <svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
100
- <path
101
- d="M3.33334 10H10m-6.66666 5V5M10 15V5m4.5833 3.75C16 7.91667 17.5 8.75 17.5 10c0 .442-.1756.866-.4882 1.1785-.3125.3126-.7364.4882-1.1785.4882.4421 0 .866.1756 1.1785.4881.3126.3126.4882.7365.4882 1.1785 0 1.5-1.6667 2.5-3.3333 1.25"
102
- stroke="currentColor"
103
- stroke-linecap="round"
104
- stroke-linejoin="round"
105
- />
106
- </svg>
107
- `,kb=`
108
- <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
109
- <path
110
- d="M10 15V5M14.1667 8.33333V10.8333C14.1667 11.0543 14.2545 11.2663 14.4107 11.4226C14.567 11.5789 14.779 11.6667 15 11.6667H17.5M17.5 8.33333V15M3.33334 10H10M3.33334 15V5"
111
- stroke="black"
112
- stroke-linecap="round"
113
- stroke-linejoin="round"
114
- />
115
- </svg>
116
- `,yb=`
117
- <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
118
- <path
119
- d="M3.33334 10H10M3.33334 15V5M10 15V5M17.5 8.33333H14.1667V10.8333H15.25C16.5 10.8333 17.5 11.75 17.5 12.9167C17.5 14.0833 16.5 15 15.25 15C14.8333 15 14.5 14.9167 14.1667 14.75"
120
- stroke="black"
121
- stroke-linecap="round"
122
- stroke-linejoin="round"
123
- />
124
- </svg>
125
- `,wb=`
126
- <svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
127
- <path
128
- d="M3.33334 10H10m-6.66666 5V5M10 15V5m4.1667 8.3333c0 .9205.7462 1.6667 1.6666 1.6667.9205 0 1.6667-.7462 1.6667-1.6667 0-.9204-.7462-1.6666-1.6667-1.6666-.9204 0-1.6666.7462-1.6666 1.6666Zm0 0c0-2.0833.8333-3.3333 2.5-4.99997"
129
- stroke="currentColor"
130
- stroke-linecap="round"
131
- stroke-linejoin="round"
132
- />
133
- </svg>
134
- `,Tb=`
135
- <svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
136
- <path
137
- d="M6.5 10h6.6667M6.5 15V5m6.6667 10V5"
138
- stroke="currentColor"
139
- stroke-linecap="round"
140
- stroke-linejoin="round"
141
- />
142
- </svg>
143
- `,Bb=`
144
- <svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
145
- <path
146
- d="M14.5 7.28571V6h-9v1.28571M10 6v9m0 0H8.71429M10 15h1.2857"
147
- stroke="currentColor"
148
- stroke-linecap="round"
149
- stroke-linejoin="round"
150
- />
151
- </svg>
152
- `,xb=`
153
- <svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
154
- <path
155
- d="M18.5667 18H1.5l8.5333-16 8.5334 16Z"
156
- stroke="currentColor"
157
- stroke-width="1.06667"
158
- stroke-linecap="round"
159
- stroke-linejoin="round"
160
- />
161
- <rect x="9.75" y="14.25" width=".5" height=".5" rx=".25" fill="currentColor" stroke="currentColor" stroke-width=".5"/>
162
- <rect x="9.75" y="8.25" width=".5" height="4.5" rx=".25" fill="currentColor" stroke="currentColor" stroke-width=".5"/>
163
- </svg>
164
- `;class et extends Ss{constructor(e,t){super(e),this.params=e,this.nodes={root:null,icon:null,titleEl:null,secondaryLabelEl:null,chevron:null},this.confirmationState=null,this.removeSpecialFocusBehavior=()=>{this.setNoFocus(!1)},this.removeSpecialHoverBehavior=()=>{this.setNoHover(!1)},this.renderParams=t,this.nodes.root=this.createRootElement(e,t)}get isDisabled(){return this.params.isDisabled===!0}get toggle(){return this.params.toggle}get title(){return this.params.title||this.params.label}get isConfirmationStateEnabled(){return this.confirmationState!==null}get isFocused(){return this.nodes.root===null?!1:this.nodes.root.hasAttribute(ee.focused)}getElement(){return this.nodes.root}handleClick(){if(this.isConfirmationStateEnabled&&this.confirmationState!==null){this.activateOrEnableConfirmationMode(this.confirmationState);return}this.activateOrEnableConfirmationMode(this.params)}toggleActive(e){if(this.nodes.root===null)return;const t=this.nodes.root.hasAttribute(ee.active),o=e!==void 0?e:!t;this.setActive(o)}toggleHidden(e){this.setHidden(e)}reset(){this.isConfirmationStateEnabled&&this.disableConfirmationMode()}onFocus(){this.disableSpecialHoverAndFocusBehavior()}createRootElement(e,t){var s,a,l,c;const o=(s=t==null?void 0:t.wrapperTag)!=null?s:"div",n=document.createElement(o);return o==="button"&&n.setAttribute("type","button"),n.className=this.getContainerClass(),n.setAttribute(ee.item,""),n.setAttribute("data-blok-testid","popover-item"),e.name&&n.setAttribute("data-blok-item-name",e.name),e.dataset&&Object.entries(e.dataset).forEach(([d,u])=>{n.setAttribute(`data-${d}`,u)}),e.isDisabled&&n.setAttribute(ee.disabled,"true"),this.isActive&&n.setAttribute(ee.active,"true"),this.hasChildren&&n.setAttribute(ee.hasChildren,"true"),this.createContentElements(n,e,t),e.hint!==void 0&&((a=t==null?void 0:t.hint)==null?void 0:a.enabled)!==!1&&e.hint!==void 0&&this.addHint(n,Re(K({},e.hint),{position:((l=t==null?void 0:t.hint)==null?void 0:l.position)||"right",alignment:((c=t==null?void 0:t.hint)==null?void 0:c.alignment)||"center"})),n}createContentElements(e,t,o){var c,d,u;const n=(c=o==null?void 0:o.iconWithGap)!=null?c:!0,i=(d=o==null?void 0:o.isInline)!=null?d:!1,s=(u=o==null?void 0:o.isNestedInline)!=null?u:!1,a=t.title||t.label;if(t.icon&&(this.nodes.icon=this.createIconElement(t.icon,n,i,s),e.appendChild(this.nodes.icon)),a!==void 0){const h=document.createElement("div");h.className="mr-auto truncate text-sm font-medium leading-5",h.setAttribute(ee.title,""),h.setAttribute("data-blok-testid","popover-item-title"),h.textContent=a,e.appendChild(h),this.nodes.titleEl=h}if(t.secondaryLabel){const h=document.createElement("div");h.className="whitespace-nowrap pr-1.5 text-xs -tracking-widest text-text-secondary opacity-60",h.setAttribute(ee.secondaryTitle,""),h.setAttribute("data-blok-testid","popover-item-secondary-title"),h.textContent=t.secondaryLabel,e.appendChild(h),this.nodes.secondaryLabelEl=h}if(this.hasChildren&&!this.isChevronHidden){const h=document.createElement("div");h.className=this.getChevronClass(i),h.setAttribute(ee.icon,""),h.setAttribute(ee.iconChevronRight,""),h.setAttribute("data-blok-testid","popover-item-chevron-right"),h.innerHTML=pb,e.appendChild(h),this.nodes.chevron=h}}createIconElement(e,t,o,n){const i=document.createElement("div");return i.className=this.getIconClass(t,o,n,!1),i.setAttribute(ee.icon,""),i.setAttribute("data-blok-testid","popover-item-icon"),i.innerHTML=e,t&&i.setAttribute(ee.iconTool,""),i}getContainerClass(){var o,n,i,s;const e=(n=(o=this.renderParams)==null?void 0:o.isInline)!=null?n:!1,t=(s=(i=this.renderParams)==null?void 0:i.isNestedInline)!=null?s:!1;return $(Qe.item,e&&rb.item,t&&ib.item,this.isActive&&Qe.itemActive,this.params.isDisabled&&Qe.itemDisabled)}getIconClass(e,t,o,n){return $(Qe.icon,t&&"w-auto h-auto [&_svg]:w-icon [&_svg]:h-icon mobile:[&_svg]:w-icon-mobile mobile:[&_svg]:h-icon-mobile",o&&"w-toolbox-btn h-toolbox-btn",e&&"mr-2",e&&t&&"shadow-none bg-transparent !mr-0",e&&o&&"!mr-2",n&&"animate-wobble")}getChevronClass(e){return $(Qe.icon,e&&"rotate-90")}setActive(e){this.nodes.root&&(e?(this.nodes.root.setAttribute(ee.active,"true"),this.nodes.root.classList.add(...Qe.itemActive.split(" "))):(this.nodes.root.removeAttribute(ee.active),this.nodes.root.classList.remove(...Qe.itemActive.split(" "))))}setHidden(e){this.nodes.root&&(e?(this.nodes.root.setAttribute(ee.hidden,"true"),this.nodes.root.classList.add("!hidden")):(this.nodes.root.removeAttribute(ee.hidden),this.nodes.root.classList.remove("!hidden")))}setFocused(e){this.nodes.root&&(e?(this.nodes.root.setAttribute(ee.focused,"true"),this.nodes.root.classList.add("!bg-item-focus-bg")):(this.nodes.root.removeAttribute(ee.focused),this.nodes.root.classList.remove("!bg-item-focus-bg")))}setNoHover(e){this.nodes.root&&(e?this.nodes.root.setAttribute(ee.noHover,"true"):this.nodes.root.removeAttribute(ee.noHover))}setNoFocus(e){this.nodes.root&&(e?this.nodes.root.setAttribute(ee.noFocus,"true"):this.nodes.root.removeAttribute(ee.noFocus))}enableConfirmationMode(e){if(this.nodes.root===null)return;const t=Re(K(K({},this.params),e),{confirmation:"confirmation"in e?e.confirmation:void 0});this.setConfirmation(t),this.confirmationState=e,this.enableSpecialHoverAndFocusBehavior()}setConfirmation(e){if(this.nodes.root){if(e===null){this.clearConfirmationState();return}this.applyConfirmationState(e)}}clearConfirmationState(){this.nodes.root&&(this.nodes.root.removeAttribute(ee.confirmation),this.nodes.root.classList.remove("!bg-item-confirm-bg","!text-white"),this.restoreOriginalIcon(),this.restoreOriginalTitle(),this.restoreOriginalSecondaryLabel())}applyConfirmationState(e){this.nodes.root&&(this.nodes.root.setAttribute(ee.confirmation,"true"),this.nodes.root.classList.add("!bg-item-confirm-bg","!text-white"),this.updateIcon(e.icon),this.updateTitle(e),this.updateSecondaryLabel(e.secondaryLabel))}restoreOriginalIcon(){!this.nodes.icon||!this.params.icon||(this.nodes.icon.innerHTML=this.params.icon)}restoreOriginalTitle(){const e=this.params.title||this.params.label;!this.nodes.titleEl||e===void 0||(this.nodes.titleEl.textContent=e)}restoreOriginalSecondaryLabel(){var e;this.nodes.secondaryLabelEl&&(this.nodes.secondaryLabelEl.textContent=(e=this.params.secondaryLabel)!=null?e:"",this.nodes.secondaryLabelEl.style.display=this.params.secondaryLabel?"":"none")}updateIcon(e){!this.nodes.icon||!e||(this.nodes.icon.innerHTML=e)}updateTitle(e){const t=e.title||e.label;!this.nodes.titleEl||t===void 0||(this.nodes.titleEl.textContent=t)}updateSecondaryLabel(e){this.nodes.secondaryLabelEl&&(this.nodes.secondaryLabelEl.textContent=e!=null?e:"",this.nodes.secondaryLabelEl.style.display=e?"":"none")}disableConfirmationMode(){this.nodes.root!==null&&(this.setConfirmation(null),this.confirmationState=null,this.disableSpecialHoverAndFocusBehavior())}enableSpecialHoverAndFocusBehavior(){var e;this.setNoHover(!0),this.setNoFocus(!0),(e=this.nodes.root)==null||e.addEventListener("mouseleave",this.removeSpecialHoverBehavior,{once:!0})}disableSpecialHoverAndFocusBehavior(){var e;this.removeSpecialFocusBehavior(),this.removeSpecialHoverBehavior(),(e=this.nodes.root)==null||e.removeEventListener("mouseleave",this.removeSpecialHoverBehavior)}activateOrEnableConfirmationMode(e){var t;if(!("confirmation"in e)||e.confirmation===void 0)try{(t=e.onActivate)==null||t.call(e,e),this.disableConfirmationMode()}catch(o){this.animateError()}else this.enableConfirmationMode(e.confirmation)}animateError(){this.triggerWobble()}triggerWobble(){var i,s,a,l,c,d;if(!this.nodes.icon)return;const e=(s=(i=this.renderParams)==null?void 0:i.isInline)!=null?s:!1,t=(l=(a=this.renderParams)==null?void 0:a.isNestedInline)!=null?l:!1,o=(d=(c=this.renderParams)==null?void 0:c.iconWithGap)!=null?d:!0;this.nodes.icon.setAttribute(ee.wobble,"true"),this.nodes.icon.className=this.getIconClass(o,e,t,!0);const n=()=>{this.nodes.icon&&(this.nodes.icon.removeAttribute(ee.wobble),this.nodes.icon.className=this.getIconClass(o,e,t,!1))};this.nodes.icon.addEventListener("animationend",n,{once:!0})}getIconElement(){return this.nodes.icon}}const mt={container:"py-1 px-[3px]",containerHidden:"hidden",line:"h-px w-full bg-popover-border"},Po={container:"px-1 py-0",line:"h-full w-px",nestedContainer:"py-1 px-[3px]",nestedLine:"w-full h-px"},Fo={root:"data-blok-popover-item-separator",line:"data-blok-popover-item-separator-line",hidden:"data-blok-hidden"};class wu extends Ss{constructor(e){var t,o;super(),this.nodes={root:null,line:null},this.isInline=(t=e==null?void 0:e.isInline)!=null?t:!1,this.isNestedInline=(o=e==null?void 0:e.isNestedInline)!=null?o:!1,this.nodes.root=this.createRootElement()}getElement(){return this.nodes.root}toggleHidden(e){if(!this.nodes.root)return;const t=this.getContainerClass(!1),o=this.getContainerClass(!0);this.nodes.root.className=e?o:t,e?this.nodes.root.setAttribute(Fo.hidden,"true"):this.nodes.root.removeAttribute(Fo.hidden)}getContainerClass(e){const t=mt.container;return this.isNestedInline?$(t,Po.nestedContainer,e&&mt.containerHidden):this.isInline?$(t,Po.container,e&&mt.containerHidden):$(t,e&&mt.containerHidden)}getLineClass(){return this.isNestedInline?$(mt.line,Po.nestedLine):this.isInline?$(mt.line,Po.line):mt.line}createRootElement(){const e=document.createElement("div");e.className=this.getContainerClass(!1),e.setAttribute(Fo.root,""),e.setAttribute("data-blok-testid","popover-item-separator");const t=document.createElement("div");return t.className=this.getLineClass(),t.setAttribute(Fo.line,""),e.appendChild(t),this.nodes.line=t,e}}var Le=(r=>(r.Closed="closed",r.ClosedOnActivate="closed-on-activate",r))(Le||{});const As={root:"",rootHidden:"hidden"},Tu={root:"flex items-center"},Is={root:"data-blok-popover-item-html",hidden:"data-blok-hidden"};class oo extends Ss{constructor(e,t){var o;super(e),this.nodes={root:null},this.isHidden=!1,this.isInline=(o=t==null?void 0:t.isInline)!=null?o:!1,this.nodes.root=this.createRootElement(e,t)}getElement(){return this.nodes.root}toggleHidden(e){this.isHidden=e,this.updateRootClasses(),this.nodes.root&&(e?this.nodes.root.setAttribute(Is.hidden,"true"):this.nodes.root.removeAttribute(Is.hidden))}getControls(){if(!this.nodes.root)return[];const e=this.nodes.root.querySelectorAll(`button, ${v.allInputsSelector}`);return Array.from(e)}updateRootClasses(){this.nodes.root&&(this.nodes.root.className=$(As.root,this.isInline&&Tu.root,this.isHidden&&As.rootHidden))}createRootElement(e,t){var n,i,s;const o=document.createElement("div");return o.className=$(As.root,this.isInline&&Tu.root),o.setAttribute(Is.root,""),o.setAttribute("data-blok-testid","popover-item-html"),e.name&&o.setAttribute("data-blok-item-name",e.name),o.appendChild(e.element),e.hint!==void 0&&((n=t==null?void 0:t.hint)==null?void 0:n.enabled)!==!1&&this.addHint(o,Re(K({},e.hint),{position:((i=t==null?void 0:t.hint)==null?void 0:i.position)||"right",alignment:((s=t==null?void 0:t.hint)==null?void 0:s.alignment)||"center"})),o}}const he={popoverContainer:"absolute flex flex-col overflow-hidden box-border opacity-0 pointer-events-none p-0 border-none z-[4] max-h-0 min-w-[var(--width)] w-[var(--width)] rounded-lg shadow-[0_3px_15px_-3px_theme(colors.popover-shadow)] left-[var(--popover-left)] top-[var(--popover-top)] bg-popover-bg",popoverContainerMobile:"fixed max-w-none rounded-[10px] min-w-[calc(100%-var(--offset)*2)] inset-[auto_var(--offset)_calc(var(--offset)+env(safe-area-inset-bottom))_var(--offset)]",popoverContainerOpened:"opacity-100 pointer-events-auto p-1 max-h-[var(--max-height)] border border-popover-border animate-[panelShowing_100ms_ease]",popoverOverlay:"hidden bg-dark",items:"overflow-y-auto overscroll-contain"},_t={popover:"relative",popoverContainer:"flex-row top-0 min-w-max w-max p-1 mobile:absolute"},Y={popover:"data-blok-popover",popoverContainer:"data-blok-popover-container",popoverItems:"data-blok-popover-items",popoverOverlay:"data-blok-popover-overlay",popoverInline:"data-blok-popover-inline",nested:"data-blok-nested",nestedLevel:"data-blok-nested-level",opened:"data-blok-popover-opened",openTop:"data-blok-popover-open-top",openLeft:"data-blok-popover-open-left",overlayHidden:"data-blok-overlay-hidden",nothingFoundDisplayed:"data-blok-nothing-found-displayed"},Cb=r=>`level-${r}`;var De=(r=>(r.NestingLevel="--nesting-level",r.PopoverHeight="--popover-height",r.InlinePopoverWidth="--inline-popover-width",r.PopoverTop="--popover-top",r.PopoverLeft="--popover-left",r.TriggerItemLeft="--trigger-item-left",r.TriggerItemTop="--trigger-item-top",r))(De||{});class Bu extends Xt{constructor(e,t={}){super(),this.params=e,this.itemsRenderParams=t,this.listeners=new Yt,this.messages={nothingFound:"Nothing found",search:"Search"},this.items=this.buildItems(e.items),e.messages&&(this.messages=K(K({},this.messages),e.messages)),this.nodes=this.createPopoverDOM(),this.appendItemElements(),this.nodes.popoverContainer&&this.listeners.on(this.nodes.popoverContainer,"click",o=>this.handleClick(o))}get itemsDefault(){return this.items.filter(e=>e instanceof et)}getElement(){return this.nodes.popover}getMountElement(){return this.nodes.popover}show(){const e=this.nodes.popover;e!==null&&!e.isConnected&&document.body.appendChild(e),this.nodes.popover.setAttribute(Y.opened,"true"),this.nodes.popoverContainer.classList.add(...he.popoverContainerOpened.split(" ")),this.itemsDefault.forEach(t=>this.refreshItemActiveState(t)),this.search!==void 0&&this.search.focus()}hide(){this.nodes.popover.removeAttribute(Y.opened),this.nodes.popover.removeAttribute(Y.openTop),this.nodes.popover.removeAttribute(Y.openLeft),this.nodes.popoverContainer.classList.remove(...he.popoverContainerOpened.split(" ")),this.itemsDefault.forEach(e=>e.reset()),this.search!==void 0&&this.search.clear(),this.emit(Le.Closed)}destroy(){var e,t;this.items.forEach(o=>o.destroy()),(e=this.nodes.popover)==null||e.remove(),this.listeners.removeAll(),(t=this.search)==null||t.destroy()}activateItemByName(e){const t=this.items.find(o=>o.name===e);t!==void 0&&this.handleItemClick(t)}buildItems(e){return e.map(t=>{switch(t.type){case ae.Separator:return new wu(this.itemsRenderParams[ae.Separator]);case ae.Html:return new oo(t,this.itemsRenderParams[ae.Html]);default:return new et(t,this.itemsRenderParams[ae.Default])}})}getTargetItem(e){return this.items.filter(t=>t instanceof et||t instanceof oo).find(t=>{const o=t.getElement();return o===null?!1:e.composedPath().includes(o)})}handleItemClick(e){if(!(e instanceof et&&e.isDisabled)){if(e.hasChildren){this.showNestedItems(e),this.callHandleClickIfPresent(e);return}this.itemsDefault.filter(t=>t!==e).forEach(t=>t.reset()),this.callHandleClickIfPresent(e),this.toggleItemActivenessIfNeeded(e),this.refreshItemActiveState(e),e.closeOnActivate===!0&&(this.hide(),this.emit(Le.ClosedOnActivate))}}handleClick(e){const t=this.getTargetItem(e);t!==void 0&&this.handleItemClick(t)}toggleItemActivenessIfNeeded(e){if(!(e instanceof et)||(e.toggle===!0&&e.toggleActive(),typeof e.toggle!="string"))return;const t=this.itemsDefault.filter(o=>o.toggle===e.toggle);if(t.length===1){e.toggleActive();return}t.forEach(o=>{o.toggleActive(o===e)})}refreshItemActiveState(e){e instanceof et&&e.toggle===void 0&&e.toggleActive(e.isActive)}callHandleClickIfPresent(e){"handleClick"in e&&typeof e.handleClick=="function"&&e.handleClick()}toggleNothingFoundMessage(e){e?(this.nodes.nothingFoundMessage.classList.remove("hidden"),this.nodes.nothingFoundMessage.setAttribute(Y.nothingFoundDisplayed,"true")):(this.nodes.nothingFoundMessage.classList.add("hidden"),this.nodes.nothingFoundMessage.removeAttribute(Y.nothingFoundDisplayed))}setOpenTop(e){e?this.nodes.popover.setAttribute(Y.openTop,"true"):this.nodes.popover.removeAttribute(Y.openTop)}setOpenLeft(e){e?this.nodes.popover.setAttribute(Y.openLeft,"true"):this.nodes.popover.removeAttribute(Y.openLeft)}hasNode(e){return this.nodes.popover.contains(e)}createPopoverDOM(){var i;const e=document.createElement("div");this.params.class&&(e.className=this.params.class),e.setAttribute(Y.popover,""),this.params.class&&e.setAttribute("data-blok-popover-custom-class",this.params.class),e.setAttribute("data-blok-testid","popover"),e.style.setProperty("--width","200px"),e.style.setProperty("--item-padding","3px"),e.style.setProperty("--item-height","calc(1.25rem + 2 * var(--item-padding))"),e.style.setProperty("--popover-top","calc(100% + 0.5rem)"),e.style.setProperty("--popover-left","0"),e.style.setProperty("--nested-popover-overlap","0.25rem");const t=document.createElement("div");t.className=he.popoverContainer,t.setAttribute(Y.popoverContainer,""),t.setAttribute("data-blok-testid","popover-container");const o=document.createElement("div");o.className=$("cursor-default text-sm leading-5 font-medium whitespace-nowrap overflow-hidden text-ellipsis text-gray-text p-[3px]","hidden"),o.setAttribute("data-blok-testid","popover-nothing-found"),o.textContent=(i=this.messages.nothingFound)!=null?i:"Nothing found";const n=document.createElement("div");return n.className=he.items,n.setAttribute(Y.popoverItems,""),n.setAttribute("data-blok-testid","popover-items"),t.appendChild(o),t.appendChild(n),e.appendChild(t),{popover:e,popoverContainer:t,nothingFoundMessage:o,items:n}}appendItemElements(){this.items.forEach(e=>{var o,n,i;const t=(n=(o=e.getMountElement)==null?void 0:o.call(e))!=null?n:e.getElement();t!==null&&((i=this.nodes.items)==null||i.appendChild(t))})}}var Rs=(r=>(r.Search="search",r))(Rs||{});const Ns={wrapper:"bg-[#F8F8F8] border border-[rgba(226,226,229,0.20)] rounded p-0.5 grid grid-cols-[auto_auto_1fr] grid-rows-[auto]",icon:"w-toolbox-btn h-toolbox-btn flex items-center justify-center mr-2 [&_svg]:w-icon [&_svg]:h-icon [&_svg]:text-gray-text",input:"text-sm outline-none font-medium font-inherit border-0 bg-transparent m-0 p-0 leading-[22px] min-w-[calc(100%-theme('spacing.6')-10px)] placeholder:text-gray-text placeholder:font-medium"};class Eb extends Xt{constructor({items:e,placeholder:t}){super(),this.searchQuery="",this.handleValueChange=()=>{this.applySearch(this.input.value)},this.listeners=new Yt,this.items=e,this.wrapper=v.make("div",Ns.wrapper),this.wrapper.setAttribute("data-blok-testid","popover-search-field");const o=v.make("div",Ns.icon,{innerHTML:gb});this.input=v.make("input",Ns.input,{type:"search",placeholder:t,tabIndex:-1}),this.input.setAttribute("data-blok-flipper-navigation-target","true"),this.input.setAttribute("data-blok-testid","popover-search-input"),this.wrapper.appendChild(o),this.wrapper.appendChild(this.input),this.overrideValueProperty(),["input","keyup","search","change"].forEach(i=>{this.listeners.on(this.input,i,this.handleValueChange)})}getElement(){return this.wrapper}focus(){this.input.focus()}clear(){this.input.value=""}applySearch(e){this.searchQuery!==e&&(this.searchQuery=e,this.emit(Rs.Search,{query:e,items:this.foundItems}))}overrideValueProperty(){var n,i;const e=Object.getPrototypeOf(this.input),t=Object.getOwnPropertyDescriptor(e,"value");if((t==null?void 0:t.set)===void 0||t.get===void 0)return;const o=this.applySearch.bind(this);Object.defineProperty(this.input,"value",{configurable:(n=t.configurable)!=null?n:!0,enumerable:(i=t.enumerable)!=null?i:!1,get(){var s,a;return(a=(s=t.get)==null?void 0:s.call(this))!=null?a:""},set(s){var a;(a=t.set)==null||a.call(this,s),o(s)}})}destroy(){this.listeners.removeAll()}get foundItems(){return this.items.filter(e=>this.checkItem(e))}checkItem(e){var n,i;const t=((n=e.title)==null?void 0:n.toLowerCase())||"",o=(i=this.searchQuery)==null?void 0:i.toLowerCase();return o!==void 0?t.includes(o):!1}}class bt extends Bu{constructor(e,t){super(e,t),this.nestingLevel=0,this.nestedPopoverTriggerItem=null,this.previouslyHoveredItem=null,this.scopeElement=document.body,this.hide=()=>{var o;super.hide(),this.destroyNestedPopoverIfExists(),(o=this.flipper)==null||o.deactivate(),this.previouslyHoveredItem=null},this.onFlip=()=>{const o=this.itemsDefault.find(n=>n.isFocused);o==null||o.onFocus()},this.onSearch=o=>{var a;const n=o.query==="",i=o.items.length===0;this.items.forEach(l=>{const c=l instanceof et,d=l instanceof wu||l instanceof oo,u=c?!o.items.includes(l):d&&(i||!n);l.toggleHidden(u)}),this.toggleNothingFoundMessage(i);const s=o.query===""?this.flippableElements:o.items.map(l=>l.getElement());(a=this.flipper)!=null&&a.isActivated&&(this.flipper.deactivate(),this.flipper.activate(s))},e.trigger&&(this.trigger=e.trigger),e.nestingLevel!==void 0&&(this.nestingLevel=e.nestingLevel),this.nestingLevel>0&&this.nodes.popover.setAttribute(Y.nested,"true"),e.scopeElement!==void 0&&(this.scopeElement=e.scopeElement),this.nodes.popoverContainer!==null&&this.listeners.on(this.nodes.popoverContainer,"mouseover",o=>this.handleHover(o)),e.searchable&&this.addSearch(),e.flippable!==!1&&(e.flipper!==void 0?(e.flipper.deactivate(),e.flipper.removeOnFlip(this.onFlip),this.flipper=e.flipper):this.flipper=new st({items:this.flippableElements,focusedItemClass:Qe.focused,allowedKeys:[I.TAB,I.UP,I.DOWN,I.ENTER,I.RIGHT,I.LEFT],onArrowLeft:e.onNavigateBack}),this.flipper.onFlip(this.onFlip))}hasFocus(){return this.flipper===void 0?!1:this.flipper.hasFocus()}get scrollTop(){return this.nodes.items===null?0:this.nodes.items.scrollTop}get offsetTop(){return this.nodes.popoverContainer===null?0:this.nodes.popoverContainer.offsetTop}show(){var t;const e=this.getMountElement();if(this.trigger&&e&&document.body.appendChild(e),this.trigger){const{top:o,left:n}=this.calculatePosition();this.nodes.popover.style.position="absolute",this.nodes.popover.style.top=`${o}px`,this.nodes.popover.style.left=`${n}px`,this.nodes.popover.style.setProperty(De.PopoverTop,"0px"),this.nodes.popover.style.setProperty(De.PopoverLeft,"0px")}this.nodes.popover.style.setProperty(De.PopoverHeight,this.size.height+"px"),!this.trigger&&!this.shouldOpenBottom&&(this.setOpenTop(!0),this.nodes.popover.style.setProperty(De.PopoverTop,"calc(-1 * (0.5rem + var(--popover-height)))")),!this.trigger&&!this.shouldOpenRight&&(this.setOpenLeft(!0),this.nodes.popover.style.setProperty(De.PopoverLeft,"calc(-1 * var(--width) + 100%)")),super.show(),(t=this.flipper)==null||t.activate(this.flippableElements),requestAnimationFrame(()=>{this.focusInitialElement()})}focusInitialElement(){var e;if(this.search){this.search.focus();return}(e=this.flipper)==null||e.focusFirst()}calculatePosition(){if(!this.trigger)return{top:0,left:0};const e=this.trigger.getBoundingClientRect(),t=this.size,o=window.innerWidth,n=window.innerHeight,i=8,s=e.bottom+i+window.scrollY,l=e.bottom+i+t.height>n+window.scrollY&&e.top-i-t.height>window.scrollY?e.top-i-t.height+window.scrollY:s,c=e.left+window.scrollX,u=c+t.width>o+window.scrollX?Math.max(0,e.right-t.width+window.scrollX):c;return{top:l,left:u}}destroy(){this.hide(),super.destroy()}hasNode(e){return super.hasNode(e)?!0:this.nestedPopover!==void 0&&this.nestedPopover!==null?this.nestedPopover.hasNode(e):!1}showNestedItems(e){this.nestedPopover!==null&&this.nestedPopover!==void 0||(this.nestedPopoverTriggerItem=e,this.showNestedPopoverForItem(e))}handleHover(e){const t=this.getTargetItem(e);t!==void 0&&this.previouslyHoveredItem!==t&&(this.destroyNestedPopoverIfExists(),this.previouslyHoveredItem=t,t.hasChildren&&this.showNestedPopoverForItem(t))}setTriggerItemPosition(e,t){var a;const o=t.getElement(),n=(o?o.offsetTop:0)-this.scrollTop,i=this.offsetTop+n;((a=e.querySelector(`[${Y.popover}]`))!=null?a:e).style.setProperty(De.TriggerItemTop,i+"px")}destroyNestedPopoverIfExists(){var t,o,n;if(this.nestedPopover===void 0||this.nestedPopover===null)return;const e=(t=this.nestedPopoverTriggerItem)==null?void 0:t.getElement();this.nestedPopover.off(Le.ClosedOnActivate,this.hide),this.nestedPopover.hide(),this.nestedPopover.destroy(),this.nestedPopover.getElement().remove(),this.nestedPopover=null,(o=this.flipper)==null||o.activate(this.flippableElements),requestAnimationFrame(()=>{this.focusAfterNestedPopoverClose(e)}),(n=this.nestedPopoverTriggerItem)==null||n.onChildrenClose()}focusAfterNestedPopoverClose(e){var o;if(!e||!this.flipper){(o=this.flipper)==null||o.focusFirst();return}const t=this.flippableElements.indexOf(e);if(t!==-1){this.flipper.focusItem(t);return}this.flipper.focusFirst()}showNestedPopoverForItem(e){var n;this.nestedPopover=new bt({searchable:e.isChildrenSearchable,items:e.children,nestingLevel:this.nestingLevel+1,flippable:e.isChildrenFlippable,messages:this.messages,onNavigateBack:this.destroyNestedPopoverIfExists.bind(this)}),e.onChildrenOpen(),this.nestedPopover.on(Le.ClosedOnActivate,this.hide);const t=this.nestedPopover.getMountElement(),o=this.nestedPopover.getElement();return this.nodes.popover.appendChild(t),this.setTriggerItemPosition(t,e),o.style.setProperty(De.NestingLevel,this.nestedPopover.nestingLevel.toString()),this.applyNestedPopoverPositioning(t),this.nestedPopover.show(),(n=this.flipper)==null||n.deactivate(),this.nestedPopover}applyNestedPopoverPositioning(e){var s;const t=e.querySelector(`[${Y.popoverContainer}]`);if(!t)return;const o=(s=e.querySelector(`[${Y.popover}]`))!=null?s:e,n=this.nodes.popover.hasAttribute(Y.openTop),i=this.nodes.popover.hasAttribute(Y.openLeft);t.style.position="absolute",i?o.style.setProperty(De.PopoverLeft,"calc(-1 * (var(--nesting-level) + 1) * var(--width) + 100%)"):o.style.setProperty(De.PopoverLeft,"calc(var(--nesting-level) * (var(--width) - var(--nested-popover-overlap)))"),n?t.style.top="calc(var(--trigger-item-top) - var(--popover-height) + var(--item-height) + 0.5rem + var(--nested-popover-overlap))":t.style.top="calc(var(--trigger-item-top) - var(--nested-popover-overlap))"}get shouldOpenBottom(){if(this.nodes.popover===void 0||this.nodes.popover===null)return!1;const e=this.nodes.popoverContainer.getBoundingClientRect(),t=this.scopeElement.getBoundingClientRect(),o=this.size.height,n=e.top+o,i=e.top-o,s=Math.min(window.innerHeight,t.bottom);return i<t.top||n<=s}get shouldOpenRight(){if(this.nodes.popover===void 0||this.nodes.popover===null)return!1;const e=this.nodes.popover.getBoundingClientRect(),t=this.scopeElement.getBoundingClientRect(),o=this.size.width,n=e.right+o,i=e.left-o,s=Math.min(window.innerWidth,t.right);return i<t.left||n<=s}get size(){var n;if(this._size)return this._size;const e={height:0,width:0};if(this.nodes.popover===null)return e;const t=this.nodes.popover.cloneNode(!0);t.style.visibility="hidden",t.style.position="absolute",t.style.top="-1000px",t.setAttribute(Y.opened,"true"),(n=t.querySelector(`[${Y.nested}]`))==null||n.remove(),document.body.appendChild(t);const o=t.querySelector(`[${Y.popoverContainer}]`);return e.height=o.offsetHeight,e.width=o.offsetWidth,t.remove(),this._size=e,e}get flippableElements(){return this.items.flatMap(t=>this.getFlippableElementsForItem(t)).filter(t=>t!=null)}getFlippableElementsForItem(e){if(!(e instanceof et))return e instanceof oo?e.getControls():[];if(e.isDisabled)return[];const t=e.getElement();return t?[t]:[]}addSearch(){this.search=new Eb({items:this.itemsDefault,placeholder:this.messages.search}),this.search.on(Rs.Search,this.onSearch);const e=this.search.getElement();e.classList.add("mb-1.5"),this.nodes.popoverContainer.insertBefore(e,this.nodes.popoverContainer.firstChild)}}const Sb="38px",Ab="46px";class xu extends bt{constructor(e){var o;const t=!rt();super(K({},e),{[ae.Default]:{wrapperTag:"button",hint:{position:"top",alignment:"center",enabled:t},iconWithGap:!1,isInline:!0},[ae.Html]:{hint:{position:"top",alignment:"center",enabled:t},isInline:!0},[ae.Separator]:{isInline:!0}}),this.hide=()=>{var n;this.setOpenTop(!1),this.setOpenLeft(!1),this.itemsDefault.forEach(i=>i.reset()),this.search!==void 0&&this.search.clear(),this.destroyNestedPopoverIfExists(),(n=this.flipper)==null||n.deactivate(),this.nodes.popover.className=$(_t.popover),this.nodes.popoverContainer&&(this.nodes.popoverContainer.className=$(he.popoverContainer,_t.popoverContainer),this.nodes.popoverContainer.style.height=""),this.emit(Le.Closed)},this.nodes.popover.className=$(_t.popover),this.nodes.popoverContainer&&(this.nodes.popoverContainer.className=$(he.popoverContainer,_t.popoverContainer)),this.nodes.items&&(this.nodes.items.className=$(he.items,"flex")),this.nodes.popover.style.setProperty("--height",Sb),this.nodes.popover.style.setProperty("--height-mobile",Ab),this.nodes.popover.setAttribute(Y.popoverInline,""),(o=this.flipper)==null||o.setHandleContentEditableTargets(!0),this.items.forEach(n=>{!(n instanceof et)&&!(n instanceof oo)||n.hasChildren&&n.isChildrenOpen&&this.showNestedItems(n)})}get offsetLeft(){return this.nodes.popoverContainer===null?0:this.nodes.popoverContainer.offsetLeft}show(){var t;if(super.show(),this.nodes.popover.className=$(_t.popover,"inline-block"),this.nodes.popoverContainer){this.nodes.popoverContainer.className=$(he.popoverContainer,he.popoverContainerOpened,_t.popoverContainer,"animate-none");const o=rt()?"var(--height-mobile)":"var(--height)";this.nodes.popoverContainer.style.height=o}const e=this.nestingLevel===0?(t=this.nodes.popoverContainer)==null?void 0:t.getBoundingClientRect():void 0;if(e!==void 0){const o=`${e.width}px`,n=`${e.height}px`;this.nodes.popover.style.setProperty(De.InlinePopoverWidth,o),this.nodes.popover.style.width=o,this.nodes.popover.style.height=n}requestAnimationFrame(()=>{var o,n;(o=this.flipper)==null||o.deactivate(),(n=this.flipper)==null||n.activate(this.flippableElements)})}handleHover(){}setTriggerItemPosition(e,t){const o=t.getElement(),n=o?o.offsetLeft:0,i=this.offsetLeft+n;e.style.setProperty(De.TriggerItemLeft,i+"px")}showNestedItems(e){if(this.nestedPopoverTriggerItem===e){this.destroyNestedPopoverIfExists(),this.nestedPopoverTriggerItem=null;return}super.showNestedItems(e)}showNestedPopoverForItem(e){var a;const t=super.showNestedPopoverForItem(e),o=t.getElement();(a=t.flipper)==null||a.setHandleContentEditableTargets(!0),requestAnimationFrame(()=>{var l;(l=t.flipper)==null||l.focusItem(-1)});const n=o.querySelector(`[${Y.popoverContainer}]`);n&&(n.className=$(n.className,"h-fit p-1.5 flex-col"));const i=o.querySelector(`[${Y.popoverItems}]`);i&&(i.className=$(i.className,"block w-full"));const s=l=>{var c,d;if(!(l.key!=="Tab"||l.shiftKey)){if(this.nestedPopover!==t){document.removeEventListener("keydown",s,!0);return}l.preventDefault(),l.stopPropagation(),(c=t.flipper)==null||c.activate(t.flippableElements),(d=t.flipper)==null||d.focusFirst(),document.removeEventListener("keydown",s,!0)}};if(document.addEventListener("keydown",s,!0),t.on(Le.Closed,()=>{document.removeEventListener("keydown",s,!0)}),o.setAttribute(Y.nestedLevel,Cb(t.nestingLevel)),t.nestingLevel===1&&n){n.className=$(n.className,"left-0");const l=rt()?"calc(var(--height-mobile) + 3px)":"calc(var(--height) + 3px)";n.style.top=l}return t}handleItemClick(e){var t;e!==this.nestedPopoverTriggerItem&&((t=this.nestedPopoverTriggerItem)==null||t.handleClick(),super.destroyNestedPopoverIfExists()),super.handleItemClick(e)}}const ye=class ye{constructor(){this.scrollPosition=null}lock(){os?this.lockHard():(document.body.classList.add(ye.CSS.overflowHidden),document.body.setAttribute(ye.DATA_ATTR.scrollLocked,"true"))}unlock(){os?this.unlockHard():(document.body.classList.remove(ye.CSS.overflowHidden),document.body.removeAttribute(ye.DATA_ATTR.scrollLocked))}lockHard(){this.scrollPosition=window.pageYOffset,document.documentElement.style.setProperty("--window-scroll-offset",`${this.scrollPosition}px`),document.body.classList.add(ye.CSS.overflowHidden,ye.CSS.fixed,ye.CSS.wFull),document.body.style.top="calc(-1 * var(--window-scroll-offset))",document.body.setAttribute(ye.DATA_ATTR.scrollLockedHard,"true")}unlockHard(){document.body.classList.remove(ye.CSS.overflowHidden,ye.CSS.fixed,ye.CSS.wFull),document.body.style.top="",document.body.removeAttribute(ye.DATA_ATTR.scrollLockedHard),this.scrollPosition!==null&&window.scrollTo(0,this.scrollPosition),this.scrollPosition=null}};ye.CSS={overflowHidden:"overflow-hidden",fixed:"fixed",wFull:"w-full"},ye.DATA_ATTR={scrollLocked:"data-blok-scroll-locked",scrollLockedHard:"data-blok-scroll-locked-hard"};let Os=ye;const _s={root:"flex items-center mb-2 mt-1",text:"text-lg font-semibold text-text-primary",backButton:"border-0 bg-transparent w-9 h-9 text-text-primary cursor-pointer [&_svg]:block [&_svg]:w-7 [&_svg]:h-7"},Ls={root:"data-blok-popover-header",text:"data-blok-popover-header-text",backButton:"data-blok-popover-header-back-button"};class Ib{constructor({text:e,onBackButtonClick:t}){this.listeners=new Yt,this.text=e,this.onBackButtonClick=t,this.nodes={root:v.make("div",[_s.root],{"data-blok-testid":"popover-header",[Ls.root]:""}),backButton:v.make("button",[_s.backButton],{"data-blok-testid":"popover-header-back-button",[Ls.backButton]:""}),text:v.make("div",[_s.text],{"data-blok-testid":"popover-header-text",[Ls.text]:""})},this.nodes.backButton.innerHTML=fb,this.nodes.root.appendChild(this.nodes.backButton),this.listeners.on(this.nodes.backButton,"click",this.onBackButtonClick),this.nodes.text.innerText=this.text,this.nodes.root.appendChild(this.nodes.text)}getElement(){return this.nodes.root}destroy(){this.nodes.root.remove(),this.listeners.destroy()}}class Rb{constructor(){this.history=[]}push(e){this.history.push(e)}pop(){return this.history.pop()}get currentTitle(){return this.history.length===0?"":this.history[this.history.length-1].title}get currentItems(){return this.history.length===0?[]:this.history[this.history.length-1].items}reset(){for(;this.history.length>1;)this.pop()}}class Cu extends Bu{constructor(e){super(e,{[ae.Default]:{hint:{enabled:!1}},[ae.Html]:{hint:{enabled:!1}}}),this.scrollLocker=new Os,this.history=new Rb,this.isHidden=!0,this.nodes.overlay=v.make("div",[he.popoverOverlay],{[Y.popoverOverlay]:"",[Y.overlayHidden]:"","data-blok-testid":"popover-overlay"}),this.nodes.popover.insertBefore(this.nodes.overlay,this.nodes.popover.firstChild),this.listeners.on(this.nodes.overlay,"click",()=>{this.hide()}),this.history.push({items:e.items}),this.nodes.popoverContainer.style.setProperty("--offset","5px"),this.nodes.popoverContainer.className=$(he.popoverContainer,he.popoverContainerMobile)}show(){this.nodes.overlay.removeAttribute(Y.overlayHidden),this.nodes.overlay.className=$(he.popoverOverlay,"fixed inset-0 block visible z-[3] opacity-50 transition-opacity duration-[120ms] ease-in will-change-[opacity]"),super.show(),this.nodes.popoverContainer.className=$(he.popoverContainer,he.popoverContainerMobile,he.popoverContainerOpened,"animate-[panelShowingMobile_250ms_ease]"),this.scrollLocker.lock(),this.isHidden=!1}hide(){this.isHidden||(super.hide(),this.nodes.overlay.setAttribute(Y.overlayHidden,""),this.nodes.overlay.className=he.popoverOverlay,this.nodes.popoverContainer.className=$(he.popoverContainer,he.popoverContainerMobile),this.scrollLocker.unlock(),this.history.reset(),this.isHidden=!0)}destroy(){super.destroy(),this.scrollLocker.unlock()}showNestedItems(e){this.updateItemsAndHeader(e.children,e.title),this.history.push({title:e.title,items:e.children})}updateItemsAndHeader(e,t){var i,s;this.header!==null&&this.header!==void 0&&(this.header.destroy(),this.header=null);const o=t!==void 0;o&&(this.header=new Ib({text:t,onBackButtonClick:()=>{this.history.pop(),this.updateItemsAndHeader(this.history.currentItems,this.history.currentTitle)}}));const n=(s=(i=this.header)==null?void 0:i.getElement())!=null?s:null;o&&n!==null&&this.nodes.popoverContainer.insertBefore(n,this.nodes.popoverContainer.firstChild),this.items.forEach(a=>{var l,c;return(c=(l=a.getMountElement)==null?void 0:l.call(a))==null?void 0:c.remove()}),this.items=this.buildItems(e),this.items.forEach(a=>{var c,d,u;const l=(d=(c=a.getMountElement)==null?void 0:c.call(a))!=null?d:a.getElement();l!==null&&((u=this.nodes.items)==null||u.appendChild(l))})}}class Nb extends z{constructor(){super(...arguments),this.opened=!1,this.selection=new O,this.popover=null,this.flipperInstance=new st({focusedItemClass:Qe.focused,allowedKeys:[I.TAB,I.UP,I.DOWN,I.ENTER,I.RIGHT,I.LEFT]}),this.flipperKeydownHandler=null,this.flipperKeydownSource=null,this.close=()=>{this.opened&&(this.opened=!1,O.isAtBlok||this.selection.restore(),this.selection.clearSaved(),this.detachFlipperKeydownListener(),!this.Blok.CrossBlockSelection.isCrossBlockSelectionStarted&&this.Blok.BlockManager.currentBlock&&this.Blok.BlockSelection.unselectBlock(this.Blok.BlockManager.currentBlock),this.eventsDispatcher.emit(this.events.closed),this.popover&&(this.popover.off(Le.Closed,this.onPopoverClose),this.popover.destroy(),this.popover.getElement().remove(),this.popover=null))},this.onPopoverClose=()=>{this.close()}}get events(){return{opened:ms,closed:bs}}get CSS(){return{settings:""}}get flipper(){return this.flipperInstance}make(){this.nodes.wrapper=v.make("div"),this.nodes.wrapper.setAttribute("data-blok-testid","block-tunes-wrapper"),this.eventsDispatcher.on(Jt,this.close)}destroy(){this.detachFlipperKeydownListener(),this.removeAllNodes(),this.listeners.destroy(),this.eventsDispatcher.off(Jt,this.close)}async open(e,t){const o=e!=null?e:this.Blok.BlockManager.currentBlock;if(o===void 0)return;this.opened=!0,this.selection.save(),this.Blok.BlockSelection.selectBlock(o),this.Blok.BlockSelection.clearCache();const{toolTunes:n,commonTunes:i}=o.getTunes();this.eventsDispatcher.emit(this.events.opened);const s=rt()?Cu:bt,a={searchable:!0,trigger:t||this.nodes.wrapper,items:await this.getTunesItems(o,i,n),scopeElement:this.Blok.API.methods.ui.nodes.redactor,messages:{nothingFound:ie.ui(pe.ui.popover,"Nothing found"),search:ie.ui(pe.ui.popover,"Filter")}};s===bt&&(a.flipper=this.flipperInstance),this.popover=new s(a),this.popover.getElement().setAttribute("data-blok-testid","block-tunes-popover"),this.popover.on(Le.Closed,this.onPopoverClose),this.popover.show(),s===bt&&this.flipperInstance.focusItem(0),this.attachFlipperKeydownListener(o)}getElement(){return this.nodes.wrapper}contains(e){var t,o;return!!((t=this.nodes.wrapper)!=null&&t.contains(e)||(o=this.popover)!=null&&o.hasNode(e))}async getTunesItems(e,t,o){const n=[];o!==void 0&&o.length>0&&(n.push(...o),n.push({type:ae.Separator}));const i=Array.from(this.Blok.Tools.blockTools.values()),a=(await pu(e,i)).reduce((l,c)=>(c.toolbox===void 0||c.toolbox.forEach(d=>{var h;const u=(h=d.title)!=null?h:c.name;l.push({icon:d.icon,title:ie.t(pe.toolNames,u),name:c.name,closeOnActivate:!0,onActivate:async()=>{const{BlockManager:p,Caret:f,Toolbar:g}=this.Blok,b=await p.convert(e,c.name,d.data);g.close(),f.setToBlock(b,f.positions.END)}})}),l),[]);return a.length>0&&(n.push({icon:db,name:"convert-to",title:ie.ui(pe.ui.popover,"Convert to"),children:{items:a}}),n.push({type:ae.Separator})),n.push(...t),n}attachFlipperKeydownListener(e){this.detachFlipperKeydownListener();const t=e==null?void 0:e.pluginsContent;t instanceof HTMLElement&&(this.flipperInstance.setHandleContentEditableTargets(!0),this.flipperKeydownHandler=o=>{this.flipperInstance.handleExternalKeydown(o)},t.addEventListener("keydown",this.flipperKeydownHandler,!0),this.flipperKeydownSource=t)}detachFlipperKeydownListener(){this.flipperKeydownSource!==null&&this.flipperKeydownHandler!==null&&this.flipperKeydownSource.removeEventListener("keydown",this.flipperKeydownHandler,!0),this.flipperInstance.setHandleContentEditableTargets(!1),this.flipperKeydownSource=null,this.flipperKeydownHandler=null}}const Eu={SHIFT:["SHIFT"],CMD:["CMD","CONTROL","COMMAND","WINDOWS","CTRL"],ALT:["ALT","OPTION"]},Ob={0:"Digit0",1:"Digit1",2:"Digit2",3:"Digit3",4:"Digit4",5:"Digit5",6:"Digit6",7:"Digit7",8:"Digit8",9:"Digit9",A:"KeyA",B:"KeyB",C:"KeyC",D:"KeyD",E:"KeyE",F:"KeyF",G:"KeyG",H:"KeyH",I:"KeyI",J:"KeyJ",K:"KeyK",L:"KeyL",M:"KeyM",N:"KeyN",O:"KeyO",P:"KeyP",Q:"KeyQ",R:"KeyR",S:"KeyS",T:"KeyT",U:"KeyU",V:"KeyV",W:"KeyW",X:"KeyX",Y:"KeyY",Z:"KeyZ",BACKSPACE:"Backspace",ENTER:"Enter",ESCAPE:"Escape",LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown",INSERT:"Insert",DELETE:"Delete",".":"Period"},_b=r=>Object.keys(Eu).find(t=>Eu[t].includes(r));class Lb{constructor(e){this.commands={SHIFT:!1,CMD:!1,ALT:!1},this.keys={},this.name=e.name,this.element=e.on,this.callback=e.callback,this.parseShortcutName(e.name),this.executeShortcut=t=>{this.execute(t)},this.element.addEventListener("keydown",this.executeShortcut,!1)}remove(){this.element.removeEventListener("keydown",this.executeShortcut)}parseShortcutName(e){const t=e.split("+");for(const o of t){const n=o.toUpperCase(),i=_b(n);i!==void 0?this.commands[i]=!0:this.keys[n]=!0}}checkModifiers(e){const t={CMD:e.ctrlKey||e.metaKey,SHIFT:e.shiftKey,ALT:e.altKey};return Object.keys(this.commands).every(n=>this.commands[n]===t[n])}checkKeys(e){return Object.keys(this.keys).every(o=>{const n=Ob[o];return e.code===n})}execute(e){const t=this.checkModifiers(e),o=this.checkKeys(e);t&&o&&this.callback(e)}}let Db=class{constructor(){this.registeredShortcuts=new Map}add(e){if(this.findShortcut(e.on,e.name))throw Error(`Shortcut ${e.name} is already registered for ${e.on}. Please remove it before add a new handler.`);const o=new Lb({name:e.name,on:e.on,callback:e.handler}),n=this.registeredShortcuts.get(e.on)||[];this.registeredShortcuts.set(e.on,[...n,o])}remove(e,t){const o=this.findShortcut(e,t);if(!o)return;o.remove();const n=this.registeredShortcuts.get(e);if(!n)return;const i=n.filter(s=>s!==o);if(i.length===0){this.registeredShortcuts.delete(e);return}this.registeredShortcuts.set(e,i)}findShortcut(e,t){return(this.registeredShortcuts.get(e)||[]).find(({name:n})=>n===t)}};const ze=new Db;var Ho=(r=>(r.Opened="toolbox-opened",r.Closed="toolbox-closed",r.BlockAdded="toolbox-block-added",r))(Ho||{});class Mb extends Xt{constructor({api:e,tools:t,i18nLabels:o,triggerElement:n}){super(),this.opened=!1,this.listeners=new Yt,this.popover=null,this.handleMobileLayoutToggle=()=>{this.destroyPopover(),this.initPopover()},this.onPopoverClose=()=>{this.opened=!1,this.emit("toolbox-closed")},this.api=e,this.tools=t,this.i18nLabels=o,this.triggerElement=n,this.enableShortcuts(),this.nodes={toolbox:v.make("div")},this.nodes.toolbox.setAttribute("data-blok-testid","toolbox"),this.initPopover(),this.api.events.on(Jt,this.handleMobileLayoutToggle)}get isEmpty(){return this.toolsToBeDisplayed.length===0}static get CSS(){return{toolbox:""}}getElement(){return this.nodes.toolbox}contains(e){var t;return!!(this.nodes.toolbox.contains(e)||(t=this.popover)!=null&&t.getElement().contains(e))}hasFocus(){if(this.popover!==null)return"hasFocus"in this.popover?this.popover.hasFocus():void 0}destroy(){var e;super.destroy(),this.nodes&&this.nodes.toolbox&&this.nodes.toolbox.remove(),this.removeAllShortcuts(),(e=this.popover)==null||e.off(Le.Closed,this.onPopoverClose),this.listeners.destroy(),this.api.events.off(Jt,this.handleMobileLayoutToggle)}async toolButtonActivated(e,t){await this.insertNewBlock(e,t)}open(){var e;this.isEmpty||((e=this.popover)==null||e.show(),this.opened=!0,this.emit("toolbox-opened"))}close(){var e;(e=this.popover)==null||e.hide(),this.opened=!1,this.emit("toolbox-closed")}toggle(){this.opened?this.close():this.open()}initPopover(){const e=rt()?Cu:bt;this.popover=new e({scopeElement:this.api.ui.nodes.redactor,trigger:this.triggerElement||this.nodes.toolbox,messages:{nothingFound:this.i18nLabels.nothingFound,search:this.i18nLabels.filter},items:this.toolboxItemsToBeDisplayed}),this.popover.on(Le.Closed,this.onPopoverClose),this.popover.getElement().setAttribute("data-blok-testid","toolbox-popover")}destroyPopover(){this.popover!==null&&(this.popover.hide(),this.popover.off(Le.Closed,this.onPopoverClose),this.popover.destroy(),this.popover=null),this.nodes.toolbox!==null&&(this.nodes.toolbox.innerHTML="")}get toolsToBeDisplayed(){if(this._toolsToBeDisplayed)return this._toolsToBeDisplayed;const e=[];return this.tools.forEach(t=>{t.toolbox&&e.push(t)}),this._toolsToBeDisplayed=e,e}get toolboxItemsToBeDisplayed(){if(this._toolboxItemsToBeDisplayed)return this._toolboxItemsToBeDisplayed;const e=(o,n,i=!0)=>({icon:o.icon,title:ie.t(pe.toolNames,o.title||Io(n.name)),name:n.name,onActivate:()=>{this.toolButtonActivated(n.name,o.data)},secondaryLabel:n.shortcut&&i?Md(n.shortcut):""}),t=this.toolsToBeDisplayed.reduce((o,n)=>{const{toolbox:i}=n;return i===void 0||(Array.isArray(i)?i:[i]).forEach((a,l)=>{o.push(e(a,n,l===0))}),o},[]);return this._toolboxItemsToBeDisplayed=t,t}enableShortcuts(){this.toolsToBeDisplayed.forEach(e=>{const t=e.shortcut;t&&this.enableShortcutForTool(e.name,t)})}enableShortcutForTool(e,t){ze.add({name:t,on:this.api.ui.nodes.redactor,handler:async o=>{o.preventDefault();const n=this.api.blocks.getCurrentBlockIndex(),i=this.api.blocks.getBlockByIndex(n);if(i)try{const s=await this.api.blocks.convert(i.id,e);this.api.caret.setToBlock(s,"end");return}catch(s){}await this.insertNewBlock(e)}})}removeAllShortcuts(){this.toolsToBeDisplayed.forEach(e=>{const t=e.shortcut;t&&ze.remove(this.api.ui.nodes.redactor,t)})}async insertNewBlock(e,t){const o=this.api.blocks.getCurrentBlockIndex(),n=this.api.blocks.getBlockByIndex(o);if(!n)return;const i=n.isEmpty?o:o+1,a=t!==void 0&&Object.keys(t).length>0?Object.assign(await this.api.blocks.composeBlockData(e),t):void 0,l=this.api.blocks.insert(e,a,void 0,i,void 0,n.isEmpty);this.api.caret.setToBlock(i),this.emit("toolbox-block-added",{block:l}),this.api.toolbar.close()}}const Su="block hovered",Au=1e3;class Pb extends z{constructor({config:e,eventsDispatcher:t}){super({config:e,eventsDispatcher:t}),this.hoveredBlock=null,this.toolboxInstance=null,this.settingsTogglerMouseDownPosition=null,this.onBlockSettingsOpen=()=>{var o;(o=this.nodes.settingsToggler)==null||o.classList.add(this.CSS.settingsTogglerOpened)},this.onBlockSettingsClose=()=>{var o;(o=this.nodes.settingsToggler)==null||o.classList.remove(this.CSS.settingsTogglerOpened)}}get CSS(){return{toolbar:me("absolute left-0 right-0 top-0 transition-opacity duration-100 ease-linear will-change-[opacity,top]"),toolbarOpened:"block",toolbarClosed:"hidden",content:me("relative mx-auto max-w-content"),actions:me("absolute flex opacity-0 pr-[5px]","right-full","mobile:right-auto","group-data-[blok-rtl=true]:right-auto group-data-[blok-rtl=true]:left-[calc(-1*theme(width.toolbox-btn))]","mobile:group-data-[blok-rtl=true]:ml-0 mobile:group-data-[blok-rtl=true]:mr-auto mobile:group-data-[blok-rtl=true]:pr-0 mobile:group-data-[blok-rtl=true]:pl-[10px]"),actionsOpened:"opacity-100",plusButton:me("text-dark cursor-pointer w-toolbox-btn h-toolbox-btn rounded-[7px] inline-flex justify-center items-center select-none","shrink-0","[&_svg]:h-6 [&_svg]:w-6","can-hover:hover:bg-bg-light","mobile:bg-white mobile:border mobile:border-[#e8e8eb] mobile:shadow-overlay-pane mobile:rounded-[6px] mobile:z-[2]","mobile:w-toolbox-btn-mobile mobile:h-toolbox-btn-mobile","group-data-[blok-rtl=true]:right-[calc(-1*theme(width.toolbox-btn))] group-data-[blok-rtl=true]:left-auto","not-mobile:group-data-[blok-narrow=true]:left-[5px]","not-mobile:group-data-[blok-narrow=true]:group-data-[blok-rtl=true]:left-0 not-mobile:group-data-[blok-narrow=true]:group-data-[blok-rtl=true]:right-[5px]"),plusButtonShortcutKey:"text-white",settingsToggler:me("text-dark cursor-pointer w-toolbox-btn h-toolbox-btn rounded-[7px] inline-flex justify-center items-center select-none","cursor-pointer select-none","[&_svg]:h-6 [&_svg]:w-6","active:cursor-grabbing","can-hover:hover:bg-bg-light can-hover:hover:cursor-grab","group-data-[blok-toolbox-opened=true]:can-hover:hover:cursor-pointer","mobile:bg-white mobile:border mobile:border-[#e8e8eb] mobile:shadow-overlay-pane mobile:rounded-[6px] mobile:z-[2]","mobile:w-toolbox-btn-mobile mobile:h-toolbox-btn-mobile","not-mobile:w-6"),settingsTogglerHidden:"hidden",settingsTogglerOpened:me("can-hover:hover:cursor-pointer")}}get opened(){var e,t;return(t=(e=this.nodes.wrapper)==null?void 0:e.classList.contains(this.CSS.toolbarOpened))!=null?t:!1}contains(e){var t,o;return!!((t=this.nodes.wrapper)!=null&&t.contains(e)||(o=this.toolboxInstance)!=null&&o.contains(e)||this.Blok.BlockSettings.contains(e))}get toolbox(){var e;return{opened:(e=this.toolboxInstance)==null?void 0:e.opened,close:()=>{var t;(t=this.toolboxInstance)==null||t.close()},open:()=>{if(this.toolboxInstance===null){j("toolbox.open() called before initialization is finished","warn");return}this.hoveredBlock&&(this.Blok.BlockManager.currentBlock=this.hoveredBlock),this.toolboxInstance.open()},toggle:()=>{if(this.toolboxInstance===null){j("toolbox.toggle() called before initialization is finished","warn");return}this.toolboxInstance.toggle()},hasFocus:()=>{var t;return(t=this.toolboxInstance)==null?void 0:t.hasFocus()}}}get blockActions(){return{hide:()=>{var e,t;(e=this.nodes.actions)==null||e.classList.remove(this.CSS.actionsOpened),(t=this.nodes.actions)==null||t.removeAttribute("data-blok-opened")},show:()=>{var e,t;(e=this.nodes.actions)==null||e.classList.add(this.CSS.actionsOpened),(t=this.nodes.actions)==null||t.setAttribute("data-blok-opened","true")}}}get blockTunesToggler(){return{hide:()=>{var e;return(e=this.nodes.settingsToggler)==null?void 0:e.classList.add(this.CSS.settingsTogglerHidden)},show:()=>{var e;return(e=this.nodes.settingsToggler)==null?void 0:e.classList.remove(this.CSS.settingsTogglerHidden)}}}toggleReadOnly(e){e?(this.destroy(),this.Blok.BlockSettings.destroy(),this.disableModuleBindings()):window.requestIdleCallback(async()=>{await this.drawUI(),this.enableModuleBindings()},{timeout:2e3})}moveAndOpen(e){if(this.toolboxInstance===null){j("Can't open Toolbar since Blok initialization is not finished yet","warn");return}this.toolboxInstance.opened&&this.toolboxInstance.close(),this.Blok.BlockSettings.opened&&this.Blok.BlockSettings.close();const t=e!=null?e:this.Blok.BlockManager.currentBlock;if(!t)return;this.hoveredBlock=t;const{wrapper:o,plusButton:n}=this.nodes;if(!o||!n)return;const i=t.holder,{isMobile:s}=this.Blok.UI,a=20,l=t.firstInput,c=i.getBoundingClientRect(),d=l!==void 0?l.getBoundingClientRect():null,u=d!==null?d.top-c.top:null,h=(()=>{const g=parseInt(window.getComputedStyle(t.pluginsContent).paddingTop,10);if(s){const T=parseInt(window.getComputedStyle(n).height,10);return g-T}if(l===void 0||u===null||u>a)return g;const b=tg(l),k=parseInt(window.getComputedStyle(n).height,10);return b-k+8+u})();o.style.top=`${Math.floor(h)}px`,i.appendChild(o);const p=t.getTunes(),f=p.toolTunes.length>0||p.commonTunes.length>0;this.Blok.BlockManager.blocks.length===1&&t.isEmpty&&!f?this.blockTunesToggler.hide():this.blockTunesToggler.show(),this.open()}close(){var e,t,o,n;this.Blok.ReadOnly.isEnabled||((e=this.nodes.wrapper)==null||e.classList.remove(this.CSS.toolbarOpened),(t=this.nodes.wrapper)==null||t.classList.add(this.CSS.toolbarClosed),(o=this.nodes.wrapper)==null||o.removeAttribute("data-blok-opened"),this.blockActions.hide(),(n=this.toolboxInstance)==null||n.close(),this.Blok.BlockSettings.close(),this.reset())}reset(){this.nodes.wrapper&&(this.nodes.wrapper.style.top="unset",this.Blok.UI.nodes.wrapper.appendChild(this.nodes.wrapper))}open(e=!0){var t,o,n;(t=this.nodes.wrapper)==null||t.classList.remove(this.CSS.toolbarClosed),(o=this.nodes.wrapper)==null||o.classList.add(this.CSS.toolbarOpened),(n=this.nodes.wrapper)==null||n.setAttribute("data-blok-opened","true"),e?this.blockActions.show():this.blockActions.hide()}async make(){const e=v.make("div",[this.CSS.toolbar,this.CSS.toolbarClosed,"group-data-[blok-dragging=true]:pointer-events-none"]);this.nodes.wrapper=e,e.setAttribute(tm,""),e.setAttribute("data-blok-testid","toolbar");const t=v.make("div",this.CSS.content),o=v.make("div",[this.CSS.actions,"not-mobile:group-data-[blok-narrow=true]:right-[calc(-1*theme(spacing.narrow-mode-right-padding)-5px)]","not-mobile:group-data-[blok-narrow=true]:group-data-[blok-rtl=true]:right-auto","not-mobile:group-data-[blok-narrow=true]:group-data-[blok-rtl=true]:left-[calc(-1*theme(spacing.narrow-mode-right-padding)-5px)]","not-mobile:group-data-[blok-narrow=true]:group-data-[blok-rtl=true]:left-[-5px]"]);this.nodes.content=t,this.nodes.actions=o,o.setAttribute("data-blok-testid","toolbar-actions"),v.append(e,t),v.append(t,o);const n=v.make("div",this.CSS.plusButton,{innerHTML:hb});n.setAttribute("data-blok-testid","plus-button"),this.nodes.plusButton=n,v.append(o,n),this.readOnlyMutableListeners.on(n,"click",()=>{eo(!0),this.plusButtonClicked()},!1);const i=v.make("div"),s=g=>{const b=document.createDocumentFragment(),k=g.indexOf(" ");if(k>0){const y=g.substring(0,k),x=g.substring(k);b.appendChild(v.make("span",this.CSS.plusButtonShortcutKey,{textContent:y})),b.appendChild(document.createTextNode(x))}else b.appendChild(document.createTextNode(g));return b};i.appendChild(s(ie.ui(pe.ui.toolbar.toolbox,"Click to add below"))),i.appendChild(v.make("br"));const l=Dd().win?ie.ui(pe.ui.toolbar.toolbox,"Ctrl-click to add above"):ie.ui(pe.ui.toolbar.toolbox,"Option-click to add above");i.appendChild(s(l)),Mo(n,i,{hidingDelay:400});const c=v.make("span",[this.CSS.settingsToggler,"group-data-[blok-dragging=true]:cursor-grabbing"],{innerHTML:ub});c.setAttribute(om,""),c.setAttribute(nm,""),c.setAttribute("data-blok-testid","settings-toggler"),this.nodes.settingsToggler=c,v.append(o,c);const d=v.make("div"),u=g=>{const b=v.make("div"),[k,...y]=g.split(" "),x=v.make("span",null,{textContent:k});return x.style.color="white",b.appendChild(x),y.length>0&&b.appendChild(v.text(" "+y.join(" "))),b},h=ie.ui(pe.ui.blockTunes.toggler,"Drag to move"),p=ie.ui(pe.ui.blockTunes.toggler,"Click to open the menu");d.appendChild(u(h)),d.appendChild(u(p)),Mo(c,d,{hidingDelay:400}),v.append(o,this.makeToolbox());const f=this.Blok.BlockSettings.getElement();if(!f)throw new Error("Block Settings element was not created");v.append(o,f),v.append(this.Blok.UI.nodes.wrapper,e)}makeToolbox(){this.toolboxInstance=new Mb({api:this.Blok.API.methods,tools:this.Blok.Tools.blockTools,i18nLabels:{filter:ie.ui(pe.ui.popover,"Filter"),nothingFound:ie.ui(pe.ui.popover,"Nothing found")},triggerElement:this.nodes.plusButton}),this.toolboxInstance.on(Ho.Opened,()=>{this.Blok.UI.nodes.wrapper.classList.add(this.CSS.openedToolboxHolderModifier),this.Blok.UI.nodes.wrapper.setAttribute(du,"true")}),this.toolboxInstance.on(Ho.Closed,()=>{this.Blok.UI.nodes.wrapper.classList.remove(this.CSS.openedToolboxHolderModifier),this.Blok.UI.nodes.wrapper.removeAttribute(du)}),this.toolboxInstance.on(Ho.BlockAdded,({block:t})=>{const{BlockManager:o,Caret:n}=this.Blok,i=o.getBlockById(t.id);if(!i||i.inputs.length!==0)return;if(i===o.lastBlock){o.insertAtEnd(),n.setToBlock(o.lastBlock);return}const s=o.nextBlock;s&&n.setToBlock(s)});const e=this.toolboxInstance.getElement();if(e===null)throw new Error("Toolbox element was not created");return e}plusButtonClicked(){var e;this.hoveredBlock&&(this.Blok.BlockManager.currentBlock=this.hoveredBlock),this.Blok.BlockSettings.opened&&this.Blok.BlockSettings.close(),(e=this.toolboxInstance)==null||e.toggle()}enableModuleBindings(){const e=this.nodes.settingsToggler;e&&(this.readOnlyMutableListeners.on(e,"mousedown",t=>{t.stopPropagation(),eo(!0);const o=t;this.settingsTogglerMouseDownPosition={x:o.clientX,y:o.clientY}},!0),this.readOnlyMutableListeners.on(e,"click",t=>{var s;t.stopPropagation();const o=t,n=this.settingsTogglerMouseDownPosition;this.settingsTogglerMouseDownPosition=null,!(n!==null&&(Math.abs(o.clientX-n.x)>Au||Math.abs(o.clientY-n.y)>Au))&&(this.settingsTogglerClicked(),(s=this.toolboxInstance)!=null&&s.opened&&this.toolboxInstance.close())},!0)),rt()||this.eventsDispatcher.on(Su,t=>{var n;const o=t.block;o instanceof Qt&&(this.Blok.BlockSettings.opened||(n=this.toolboxInstance)!=null&&n.opened||this.moveAndOpen(o))}),this.eventsDispatcher.on(ms,this.onBlockSettingsOpen),this.eventsDispatcher.on(bs,this.onBlockSettingsClose)}disableModuleBindings(){this.readOnlyMutableListeners.clearAll(),this.eventsDispatcher.off(ms,this.onBlockSettingsOpen),this.eventsDispatcher.off(bs,this.onBlockSettingsClose)}settingsTogglerClicked(){var t;const e=(t=this.hoveredBlock)!=null?t:this.Blok.BlockManager.currentBlock;e&&(this.hoveredBlock=e,this.Blok.BlockManager.currentBlock=e,this.Blok.BlockSettings.opened?this.Blok.BlockSettings.close():this.Blok.BlockSettings.open(e,this.nodes.settingsToggler))}async drawUI(){this.Blok.BlockSettings.make(),await this.make()}destroy(){this.removeAllNodes(),this.toolboxInstance&&this.toolboxInstance.destroy()}}var vt=(r=>(r[r.Block=0]="Block",r[r.Inline=1]="Inline",r[r.Tune=2]="Tune",r))(vt||{}),qo=(r=>(r.Shortcut="shortcut",r.Toolbox="toolbox",r.EnabledInlineTools="inlineToolbar",r.EnabledBlockTunes="tunes",r.Config="config",r))(qo||{}),Iu=(r=>(r.Shortcut="shortcut",r.SanitizeConfig="sanitize",r))(Iu||{}),Lt=(r=>(r.IsEnabledLineBreaks="enableLineBreaks",r.Toolbox="toolbox",r.ConversionConfig="conversionConfig",r.IsReadOnlySupported="isReadOnlySupported",r.PasteConfig="pasteConfig",r))(Lt||{}),Ru=(r=>(r.IsInline="isInline",r.Title="title",r.IsReadOnlySupported="isReadOnlySupported",r))(Ru||{}),Ds=(r=>(r.IsTune="isTune",r))(Ds||{});class Ms{constructor({name:e,constructable:t,config:o,api:n,isDefault:i,isInternal:s=!1,defaultPlaceholder:a}){this.api=n,this.name=e,this.constructable=t,this.config=o,this.isDefault=i,this.isInternal=s,this.defaultPlaceholder=a}get settings(){var t;const e=(t=this.config.config)!=null?t:{};return this.isDefault&&!("placeholder"in e)&&this.defaultPlaceholder&&(e.placeholder=this.defaultPlaceholder),e}reset(){if(V(this.constructable.reset))return this.constructable.reset()}prepare(){const e=this.constructable.prepare;if(!V(e))return;const t={toolName:this.name,config:this.settings};return e.call(this.constructable,t)}get shortcut(){const e=this.constructable.shortcut;return this.config.shortcut||e}get sanitizeConfig(){return this.constructable.sanitize||{}}isInline(){return this.type===vt.Inline}isBlock(){return this.type===vt.Block}isTune(){return this.type===vt.Tune}}class Fb extends z{constructor({config:e,eventsDispatcher:t}){super({config:e,eventsDispatcher:t}),this.opened=!1,this.popover=null,this.toolbarVerticalMargin=rt()?20:6,this.initialized=!1,this.initializationScheduled=!1,this.tools=new Map,this.registeredShortcuts=new Map,this.shortcutsRegistered=!1,this.shortcutRegistrationScheduled=!1,this.listeners.on(document,"keydown",o=>{const n=o;n.shiftKey&&(n.key==="ArrowDown"||n.key==="ArrowUp")&&this.tryToShow()},!0),this.scheduleInitialization(),this.tryRegisterShortcuts()}set state(e){super.state=e,this.tryRegisterShortcuts()}initialize(){var e,t,o;if(!this.initialized){if(!((o=(t=(e=this.Blok)==null?void 0:e.UI)==null?void 0:t.nodes)!=null&&o.wrapper)||this.Blok.Tools===void 0){this.scheduleInitialization();return}this.make(),this.tryRegisterShortcuts(),this.initialized=!0}}tryRegisterShortcuts(){var t;if(this.shortcutsRegistered)return;if(((t=this.Blok)==null?void 0:t.Tools)===void 0){this.scheduleShortcutRegistration();return}this.registerInitialShortcuts()&&(this.shortcutsRegistered=!0)}scheduleShortcutRegistration(){if(this.shortcutsRegistered||this.shortcutRegistrationScheduled)return;this.shortcutRegistrationScheduled=!0;const e=()=>{this.shortcutRegistrationScheduled=!1,this.tryRegisterShortcuts()};typeof window!="undefined"&&typeof window.setTimeout=="function"?window.setTimeout(e,0):e()}scheduleInitialization(){if(this.initialized||this.initializationScheduled)return;this.initializationScheduled=!0;const e=()=>{this.initializationScheduled=!1,this.initialize()},t=()=>{window.setTimeout(e,0)};typeof window!="undefined"&&"requestIdleCallback"in window?window.requestIdleCallback(()=>{t()},{timeout:2e3}):t()}async tryToShow(e=!1){e&&this.close(),this.initialize(),this.allowedToShow()&&(await this.open(),this.Blok.Toolbar.close())}close(){var o,n,i,s,a,l,c,d;if(!this.opened)return;this.tools=new Map,this.opened=!1,this.popover&&((n=(o=this.popover).hide)==null||n.call(o),(s=(i=this.popover).destroy)==null||s.call(i),this.popover=null),this.nodes.wrapper&&(this.nodes.wrapper.innerHTML="");const e=xu.mock,t=(l=(a=e==null?void 0:e.results)==null?void 0:a.at(-1))==null?void 0:l.value;t&&((c=t.hide)==null||c.call(t),(d=t.destroy)==null||d.call(t))}containsNode(e){return this.nodes.wrapper===void 0?!1:this.nodes.wrapper.contains(e)}destroy(){var e,t,o,n;this.popover&&((t=(e=this.popover).hide)==null||t.call(e),(n=(o=this.popover).destroy)==null||n.call(o),this.popover=null),this.removeAllNodes()}make(){this.nodes.wrapper=v.make("div",$("absolute top-0 left-0 z-[3] opacity-100 visible","transition-opacity duration-[250ms] ease-out","will-change-[opacity,left,top]","[&_[hidden]]:!hidden")),this.nodes.wrapper.setAttribute(Ot,Kg),this.nodes.wrapper.setAttribute("data-blok-testid","inline-toolbar"),v.append(this.Blok.UI.nodes.wrapper,this.nodes.wrapper)}async open(){var s,a,l,c,d,u,h,p,f,g,b,k,y,x,T,R,C,E,w,_,F;if(this.opened||(this.initialize(),this.opened=!0,this.popover&&((a=(s=this.popover).hide)==null||a.call(s),(c=(l=this.popover).destroy)==null||c.call(l),this.popover=null),this.createToolsInstances(),!this.nodes.wrapper))return;this.nodes.wrapper.innerHTML="";const e=await this.buildPopoverItems(),t=(f=(p=(h=(u=(d=this.Blok.API)==null?void 0:d.methods)==null?void 0:u.ui)==null?void 0:h.nodes)==null?void 0:p.redactor)!=null?f:this.Blok.UI.nodes.redactor;this.popover=new xu({items:e,scopeElement:t,messages:{nothingFound:ie.ui(pe.ui.popover,"Nothing found"),search:ie.ui(pe.ui.popover,"Filter")}});const o=(x=(b=(g=this.popover).getMountElement)==null?void 0:b.call(g))!=null?x:(y=(k=this.popover).getElement)==null?void 0:y.call(k),n=(R=(T=this.popover).getElement)==null?void 0:R.call(T),i=(w=(E=(C=this.popover.size)==null?void 0:C.width)!=null?E:n==null?void 0:n.getBoundingClientRect().width)!=null?w:0;this.applyPosition(i),o&&this.nodes.wrapper&&this.nodes.wrapper.appendChild(o),(F=(_=this.popover).show)==null||F.call(_)}async buildPopoverItems(){const e=[],t=Array.from(this.tools.entries());for(const[o,[n,i]]of t.entries()){const s=await i.render(),a=this.getToolShortcut(n.name),l=a!==void 0?Md(a):void 0,c=ie.t(pe.toolNames,n.title||Io(n.name)),d=Array.isArray(s)?s:[s],u=o===0;for(const h of d){const p=this.processPopoverItem(h,n.name,c,l,u);e.push(...p)}}return e}processPopoverItem(e,t,o,n,i){const s=[],a={name:t,hint:{title:o,description:n}};if(e instanceof HTMLElement)return s;if(e.type===ae.Html)return s.push(Re(K(K({},a),e),{type:ae.Html})),s;if(e.type===ae.Separator)return s.push({type:ae.Separator}),s;const l=Re(K(K({},a),e),{type:ae.Default});return s.push(l),"children"in l&&i&&s.push({type:ae.Separator}),s}applyPosition(e){if(!this.nodes.wrapper)return;const t=this.Blok.UI.nodes.wrapper.getBoundingClientRect(),o=this.Blok.UI.contentRect,n=O.rect,i={x:n.x-t.x,y:n.y+n.height-t.top+this.toolbarVerticalMargin};i.x+e+t.x>o.right&&(i.x=o.right-e-t.x),this.nodes.wrapper.style.left=Math.floor(i.x)+"px",this.nodes.wrapper.style.top=Math.floor(i.y)+"px"}allowedToShow(){const e=["IMG","INPUT"],t=this.resolveSelection(),o=O.text;if(!t||!t.anchorNode||t.isCollapsed||o.length<1)return!1;const n=v.isElement(t.anchorNode)?t.anchorNode:t.anchorNode.parentElement;if(n===null||t!==null&&e.includes(n.tagName))return!1;const i=v.isElement(t.anchorNode)?t.anchorNode:t.anchorNode.parentElement,s=i?this.Blok.BlockManager.getBlock(i):null,a=s!=null?s:this.Blok.BlockManager.currentBlock;if(a==null||this.getTools().some(f=>a.tool.inlineTools.has(f.name))===!1)return!1;const d="[contenteditable]";if(n.closest(d)!==null)return!0;const h=a.holder;return h&&(h.matches(d)?h:h.closest(d))?!0:this.Blok.ReadOnly.isEnabled?O.isSelectionAtBlok(t):!1}getTools(){var o;const e=(o=this.Blok.BlockManager.currentBlock)!=null?o:(()=>{const n=this.resolveSelection(),i=n==null?void 0:n.anchorNode;if(!i)return null;const s=v.isElement(i)?i:i.parentElement;return s?this.Blok.BlockManager.getBlock(s):null})();return e?Array.from(e.tool.inlineTools.values()).filter(n=>!(this.Blok.ReadOnly.isEnabled&&n.isReadOnlySupported!==!0)):[]}createToolsInstances(){this.tools=new Map,this.getTools().forEach(t=>{const o=t.create();this.tools.set(t,o)})}tryEnableShortcut(e,t){if(t!==void 0)try{this.enableShortcuts(e,t)}catch(o){}}getToolShortcut(e){const{Tools:t}=this.Blok,o=t.inlineTools.get(e),n=t.internal.inlineTools;return Array.from(n.keys()).includes(e)?this.inlineTools[e][Iu.Shortcut]:o==null?void 0:o.shortcut}enableShortcuts(e,t){const o=this.registeredShortcuts.get(e);o!==t&&(this.isShortcutTakenByAnotherTool(e,t)||(o!==void 0&&(ze.remove(document,o),this.registeredShortcuts.delete(e)),ze.add({name:t,handler:n=>{const{currentBlock:i}=this.Blok.BlockManager;i&&i.tool.enabledInlineTools!==!1&&(n.preventDefault(),this.activateToolByShortcut(e))},on:document}),this.registeredShortcuts.set(e,t)))}isShortcutTakenByAnotherTool(e,t){return Array.from(this.registeredShortcuts.entries()).some(([o,n])=>o!==e&&n===t)}async activateToolByShortcut(e){if(this.opened||await this.tryToShow(),this.popover){this.popover.activateItemByName(e);return}this.invokeToolActionDirectly(e)}invokeToolActionDirectly(e){const t=this.Blok.Tools.inlineTools.get(e);if(!t)return;const n=t.create().render(),i=Array.isArray(n)?n:[n];for(const s of i)if("onActivate"in s&&typeof s.onActivate=="function"){s.onActivate(s);return}}get inlineTools(){const e={};return Array.from(this.Blok.Tools.inlineTools.entries()).forEach(([t,o])=>{e[t]=o.create()}),e}registerInitialShortcuts(){var o;const e=(o=this.Blok.Tools)==null?void 0:o.inlineTools;if(!e)return this.scheduleShortcutRegistration(),!1;const t=Array.from(e.keys());return t.length===0?(this.scheduleShortcutRegistration(),!1):(t.forEach(n=>{const i=this.getToolShortcut(n);this.tryEnableShortcut(n,i)}),!0)}resolveSelection(){const e=O.selection;if(e!==void 0)return e;const t=O.instance;return t!==void 0?t:O.get()}}const Ps=" ",Fs=new WeakSet,Hs=()=>{var s,a;const r=window.getSelection();if(r===null)return[null,0];const e=r.focusNode,t=r.focusOffset;if(e===null)return[null,0];if(e.nodeType===Node.TEXT_NODE||e.childNodes.length===0)return[e,t];const o=e.childNodes[t];if(o!==void 0)return[o,0];const n=(s=e.childNodes[t-1])!=null?s:null,i=(a=n==null?void 0:n.textContent)!=null?a:null;return[n,i!==null?i.length:0]},Nu=r=>{var t;if(!(r instanceof HTMLElement)||v.isSingleTag(r)||v.isNativeInput(r))return!1;if(r.childNodes.length===0)return!0;const e=(t=r.textContent)!=null?t:"";return e.includes(Ps)||!ns(e)?!1:Array.from(r.children).every(o=>Nu(o))},Ou=typeof window!="undefined"&&typeof window.MutationObserver!="undefined"?new window.MutationObserver(r=>{for(const e of r){const t=e.nextSibling;e.removedNodes.forEach(o=>{var l,c,d;if(!(o instanceof Element)||!Nu(o))return;const n=t instanceof Text?t:null;if(n===null||!n.isConnected)return;const i=n.parentElement;if(!((l=i==null?void 0:i.isContentEditable)!=null&&l))return;const s=(d=(c=n.textContent)==null?void 0:c[0])!=null?d:null;(s===Ps||s===" ")&&Fs.add(n)})}}):null,_u=new WeakSet,Lu=r=>{if(Ou===null||_u.has(r))return;const e=()=>{r.body!==null&&(Ou.observe(r.body,{childList:!0,subtree:!0}),_u.add(r))};r.readyState==="loading"?r.addEventListener("DOMContentLoaded",e,{once:!0}):e()};typeof window!="undefined"&&typeof window.document!="undefined"&&Lu(window.document);const Hb=r=>{var n,i;Lu(r.ownerDocument);const[e,t]=Hs();if(e===null||!r.contains(e)||e.nodeType===Node.TEXT_NODE&&t<((n=e.textContent)!=null?n:"").length)return null;const o=document.createTreeWalker(r,NodeFilter.SHOW_TEXT);for(o.currentNode=e;;){const s=o.nextNode();if(s===null)return null;const a=(i=s.textContent)!=null?i:"";if(a.length===0)continue;const l=a[0];if(!(l===Ps||l===" ")||s===e)return null;const d=document.createRange();try{d.setStart(e,t),d.setEnd(s,0)}catch(g){return null}const u=d.cloneContents(),h=document.createElement("div");h.appendChild(u);const p=Array.from(h.querySelectorAll("*")).some(g=>{var k;const b=(k=g.textContent)!=null?k:"";return b.length===0||ns(b)}),f=Fs.has(s);if(!(!p&&!f))return f&&Fs.delete(s),{node:s,offset:0}}},Du=(r,e,t,o)=>{const n=document.createRange();o==="left"?(n.selectNodeContents(r),n.setEnd(e,t)):(n.selectNodeContents(r),n.setStart(e,t));const i=n.cloneContents(),s=document.createElement("div");s.appendChild(i);const a=s.textContent||"";if(s.querySelectorAll("img, br, hr, input, area, base, col, embed, link, meta, param, source, track, wbr").length>0)return!1;const c=a.includes(" ")||s.innerHTML.includes("&nbsp;")||n.toString().includes(" "),d=e.nodeType===Node.TEXT_NODE&&(o==="left"?(e.textContent||"").slice(0,t):(e.textContent||"").slice(t)).includes(" ");if(c||d)return!1;s.style.position="absolute",s.style.visibility="hidden",s.style.height="auto",s.style.width="auto",s.style.whiteSpace=window.getComputedStyle(r).whiteSpace,document.body.appendChild(s);const u=s.getBoundingClientRect().width;return document.body.removeChild(s),!(u>0||!ns(a)||window.getComputedStyle(r).whiteSpace.startsWith("pre")&&a.length>0)},zo=r=>{var s;const e=v.getDeepestNode(r);if(e===null||v.isEmpty(r))return!0;if(v.isNativeInput(e))return e.selectionEnd===0;if(v.isEmpty(r))return!0;const[t,o]=Hs();if(t===null)return!1;const n=window.getSelection(),i=(s=n==null?void 0:n.focusNode)!=null?s:null;return i!==null&&i!==r&&!(i.nodeType===Node.TEXT_NODE&&i.parentNode===r)?!1:Du(r,t,o,"left")},jo=r=>{const e=v.getDeepestNode(r,!0);if(e===null)return!0;if(v.isNativeInput(e))return e.selectionEnd===e.value.length;const[t,o]=Hs();return t===null?!1:Du(r,t,o,"right")},qb=(r,e=!0)=>{var u,h,p,f;if(v.isNativeInput(r)){r.focus();const g=e?0:r.value.length;r.setSelectionRange(g,g);return}const t=document.createRange(),o=window.getSelection();if(!o)return;const n=(g,b=!1)=>{const k=document.createTextNode("");b?g.insertBefore(k,g.firstChild):g.appendChild(k),t.setStart(k,0),t.setEnd(k,0)},i=(g,b)=>{if(g===null)return null;if(g.nodeType===Node.TEXT_NODE)return g;const k=b?g.firstChild:g.lastChild;return i(k,b)},s=r.childNodes,a=e?(u=s[0])!=null?u:null:(h=s[s.length-1])!=null?h:null,l=i(a,e);if(a===null){n(r),o.removeAllRanges(),o.addRange(t);return}if(l===null||l.nodeType!==Node.TEXT_NODE){n(r,e),o.removeAllRanges(),o.addRange(t);return}const c=(f=(p=l.textContent)==null?void 0:p.length)!=null?f:0,d=e?0:c;t.setStart(l,d),t.setEnd(l,d),o.removeAllRanges(),o.addRange(t)},Mu={Backspace:I.BACKSPACE,Delete:I.DELETE,Enter:I.ENTER,Tab:I.TAB,ArrowDown:I.DOWN,ArrowRight:I.RIGHT,ArrowUp:I.UP,ArrowLeft:I.LEFT},zb=new Set(["Enter","Process","Spacebar","Space","Dead"]),Uo='[contenteditable="true"], textarea, input';class jb extends z{keydown(e){if(this.beforeKeydownProcessing(e),this.handleSelectedBlocksDeletion(e)||e.defaultPrevented)return;switch(this.getKeyCode(e)){case I.BACKSPACE:this.backspace(e);break;case I.DELETE:this.delete(e);break;case I.ENTER:this.enter(e);break;case I.DOWN:case I.RIGHT:this.arrowRightAndDown(e);break;case I.UP:case I.LEFT:this.arrowLeftAndUp(e);break;case I.TAB:this.tabPressed(e);break}e.key==="/"&&!e.ctrlKey&&!e.metaKey&&this.slashPressed(e),e.code==="Slash"&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),this.commandSlashPressed())}handleSelectedBlocksDeletion(e){const{BlockSelection:t,BlockManager:o,Caret:n,BlockSettings:i}=this.Blok;if(i.contains(e.target))return!1;const s=e.key==="Backspace"||e.key==="Delete",a=O.isSelectionExists,l=O.isCollapsed===!0;if(!(s&&t.anyBlockSelected&&(!a||l)))return!1;const d=o.removeSelectedBlocks();if(d!==void 0){const u=o.insertDefaultBlockAtIndex(d,!0);n.setToBlock(u,n.positions.START)}return t.clearSelection(e),e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation(),!0}beforeKeydownProcessing(e){!this.needToolbarClosing(e)||!this.isPrintableKeyEvent(e)||(this.Blok.Toolbar.close(),e.ctrlKey||e.metaKey||e.altKey||e.shiftKey)||this.Blok.BlockSelection.clearSelection(e)}keyup(e){e.shiftKey||this.Blok.UI.checkEmptiness()}handleCommandC(e){const{BlockSelection:t}=this.Blok;t.anyBlockSelected&&t.copySelectedBlocks(e)}handleCommandX(e){const{BlockSelection:t,BlockManager:o,Caret:n}=this.Blok;t.anyBlockSelected&&t.copySelectedBlocks(e).then(()=>{const i=o.removeSelectedBlocks();if(i!==void 0){const s=o.insertDefaultBlockAtIndex(i,!0);n.setToBlock(s,n.positions.START)}t.clearSelection(e)}).catch(()=>{})}tabPressed(e){const{InlineToolbar:t,Caret:o}=this.Blok;if(t.opened)return;(e.shiftKey?o.navigatePrevious(!0):o.navigateNext(!0))&&e.preventDefault()}commandSlashPressed(){this.Blok.BlockSelection.selectedBlocks.length>1||this.activateBlockSettings()}slashPressed(e){if(!this.Blok.UI.nodes.wrapper.contains(e.target))return;const o=this.Blok.BlockManager.currentBlock;o!=null&&o.isEmpty&&(e.preventDefault(),this.Blok.Caret.insertContentAtCaretPosition("/"),this.activateToolbox())}enter(e){const{BlockManager:t,UI:o}=this.Blok,n=t.currentBlock;if(n===void 0||n.tool.isLineBreaksEnabled||o.someToolbarOpened&&o.someFlipperButtonFocused||e.shiftKey&&!os)return;const i=n.currentInput!==void 0&&zo(n.currentInput)&&!n.hasMedia?(this.Blok.BlockManager.insertDefaultBlockAtIndex(this.Blok.BlockManager.currentBlockIndex),n):n.currentInput&&jo(n.currentInput)?this.Blok.BlockManager.insertDefaultBlockAtIndex(this.Blok.BlockManager.currentBlockIndex+1):this.Blok.BlockManager.split();this.Blok.Caret.setToBlock(i),this.Blok.Toolbar.moveAndOpen(i),e.preventDefault()}backspace(e){const{BlockManager:t,Caret:o}=this.Blok,{currentBlock:n,previousBlock:i}=t;if(n===void 0||!O.isCollapsed||!n.currentInput||!zo(n.currentInput))return;if(e.preventDefault(),this.Blok.Toolbar.close(),!(n.currentInput===n.firstInput)){o.navigatePrevious();return}if(i===null)return;if(i.isEmpty){t.removeBlock(i);return}if(n.isEmpty){t.removeBlock(n);const l=t.currentBlock;l&&o.setToBlock(l,o.positions.END);return}gu(i,n)?this.mergeBlocks(i,n):o.setToBlock(i,o.positions.END)}delete(e){const{BlockManager:t,Caret:o}=this.Blok,{currentBlock:n,nextBlock:i}=t;if(n===void 0||!O.isCollapsed||!n.currentInput||!jo(n.currentInput))return;if(e.preventDefault(),this.Blok.Toolbar.close(),!(n.currentInput===n.lastInput)){o.navigateNext();return}if(i===null)return;if(i.isEmpty){t.removeBlock(i);return}if(n.isEmpty){t.removeBlock(n),o.setToBlock(i,o.positions.START);return}gu(n,i)?this.mergeBlocks(n,i):o.setToBlock(i,o.positions.START)}mergeBlocks(e,t){const{BlockManager:o,Toolbar:n}=this.Blok;e.lastInput!==void 0&&(qb(e.lastInput,!1),o.mergeBlocks(e,t).then(()=>{n.close()}).catch(()=>{}))}arrowRightAndDown(e){var k;const t=this.getKeyCode(e);if(t===null)return;const o=st.usedKeys.includes(t)&&(!e.shiftKey||t===I.TAB);if(this.Blok.UI.someToolbarOpened&&o)return;e.shiftKey||this.Blok.Toolbar.close();const n=O.get();n!=null&&n.anchorNode&&!this.Blok.BlockSelection.anyBlockSelected&&this.Blok.BlockManager.setCurrentBlockByChildNode(n.anchorNode);const{currentBlock:i}=this.Blok.BlockManager,s=e.target,a=document.activeElement instanceof HTMLElement?document.activeElement:null,l=[i==null?void 0:i.inputs.find(y=>s!==null&&y.contains(s)),i==null?void 0:i.inputs.find(y=>a!==null&&y.contains(a)),s==null?void 0:s.closest(Uo),a==null?void 0:a.closest(Uo)],c=(k=i==null?void 0:i.currentInput)!=null?k:l.find(y=>y instanceof HTMLElement),u=(c!==void 0?jo(c):void 0)||this.Blok.BlockSelection.anyBlockSelected,h=e.shiftKey&&t===I.DOWN;if(h&&u){this.Blok.CrossBlockSelection.toggleBlockSelectedState();return}h&&this.Blok.InlineToolbar.tryToShow();const f=t===I.RIGHT&&!e.shiftKey&&!this.isRtl&&c instanceof HTMLElement?Hb(c):null;if(f!==null){O.setCursor(f.node,f.offset),e.preventDefault();return}if(t===I.DOWN||t===I.RIGHT&&!this.isRtl?this.Blok.Caret.navigateNext():this.Blok.Caret.navigatePrevious()){e.preventDefault();return}Ao(()=>{this.Blok.BlockManager.currentBlock&&this.Blok.BlockManager.currentBlock.updateCurrentInput()},20)(),this.Blok.BlockSelection.clearSelection(e)}arrowLeftAndUp(e){var g;const t=this.Blok.UI.someToolbarOpened,o=this.getKeyCode(e);if(o===null||t&&st.usedKeys.includes(o)&&(!e.shiftKey||o===I.TAB))return;t&&this.Blok.UI.closeAllToolbars(),e.shiftKey||this.Blok.Toolbar.close();const n=window.getSelection();n!=null&&n.anchorNode&&!this.Blok.BlockSelection.anyBlockSelected&&this.Blok.BlockManager.setCurrentBlockByChildNode(n.anchorNode);const{currentBlock:i}=this.Blok.BlockManager,s=e.target,a=document.activeElement instanceof HTMLElement?document.activeElement:null,l=[i==null?void 0:i.inputs.find(b=>s!==null&&b.contains(s)),i==null?void 0:i.inputs.find(b=>a!==null&&b.contains(a)),s==null?void 0:s.closest(Uo),a==null?void 0:a.closest(Uo)],c=(g=i==null?void 0:i.currentInput)!=null?g:l.find(b=>b instanceof HTMLElement),u=(c!==void 0?zo(c):void 0)||this.Blok.BlockSelection.anyBlockSelected,h=e.shiftKey&&o===I.UP;if(h&&u){this.Blok.CrossBlockSelection.toggleBlockSelectedState(!1);return}if(h&&this.Blok.InlineToolbar.tryToShow(),o===I.UP||o===I.LEFT&&!this.isRtl?this.Blok.Caret.navigatePrevious():this.Blok.Caret.navigateNext()){e.preventDefault();return}Ao(()=>{this.Blok.BlockManager.currentBlock&&this.Blok.BlockManager.currentBlock.updateCurrentInput()},20)(),this.Blok.BlockSelection.clearSelection(e)}needToolbarClosing(e){const t=this.getKeyCode(e),o=t===I.ENTER,n=t===I.TAB,i=o&&this.Blok.Toolbar.toolbox.opened,s=o&&this.Blok.BlockSettings.opened,a=o&&this.Blok.InlineToolbar.opened,l=n;return!(e.shiftKey||l||i||s||a)}activateToolbox(){this.Blok.Toolbar.opened||this.Blok.Toolbar.moveAndOpen(),this.Blok.Toolbar.toolbox.open()}activateBlockSettings(){this.Blok.Toolbar.opened||this.Blok.Toolbar.moveAndOpen(),this.Blok.BlockSettings.opened||Promise.resolve(this.Blok.BlockSettings.open()).catch(()=>{})}getKeyCode(e){const t=e.key&&Mu[e.key];if(t!==void 0&&typeof t=="number")return t;const o=e.code&&Mu[e.code];return o!==void 0&&typeof o=="number"?o:null}isPrintableKeyEvent(e){return e.key?e.key.length===1||zb.has(e.key):!1}}class qs{constructor(e){this.blocks=[],this.workingArea=e}get length(){return this.blocks.length}get array(){return this.blocks}get nodes(){return _d(this.workingArea.children)}static set(e,t,o){return isNaN(Number(t))?(Reflect.set(e,t,o),!0):(e.insert(+t,o),!0)}static get(e,t){return isNaN(Number(t))?Reflect.get(e,t):e.get(+t)}push(e){this.blocks.push(e),this.insertToDOM(e)}move(e,t,o=!1){const n=this.blocks.splice(t,1)[0];if(!o){const s=e-1,a=Math.max(0,s),l=this.blocks[a],c=e>0?"afterend":"beforebegin";this.insertToDOM(n,c,l)}this.blocks.splice(e,0,n);const i=this.composeBlockEvent("move",{fromIndex:t,toIndex:e});n.call(Je.MOVED,i)}insert(e,t,o=!1){if(!this.length){this.push(t);return}const n=e>this.length?this.length:e;o&&(this.blocks[n].holder.remove(),this.blocks[n].call(Je.REMOVED));const i=o?1:0;if(this.blocks.splice(n,i,t),n>0){const a=this.blocks[n-1];this.insertToDOM(t,"afterend",a);return}const s=this.blocks[n+1];if(s!==void 0){this.insertToDOM(t,"beforebegin",s);return}this.insertToDOM(t)}replace(e,t){if(this.blocks[e]===void 0)throw Error("Incorrect index");this.blocks[e].holder.replaceWith(t.holder),this.blocks[e]=t}insertMany(e,t){const o=new DocumentFragment;for(const n of e)o.appendChild(n.holder);if(!this.length){this.blocks.push(...e),this.workingArea.appendChild(o),e.forEach(n=>n.call(Je.RENDERED));return}if(t>0){const n=Math.min(t-1,this.length-1);this.blocks[n].holder.after(o)}t===0&&this.workingArea.prepend(o),this.blocks.splice(t,0,...e),e.forEach(n=>n.call(Je.RENDERED))}remove(e){const t=isNaN(e)?this.length-1:e;this.blocks[t].holder.remove(),this.blocks[t].call(Je.REMOVED),this.blocks.splice(t,1)}removeAll(){this.workingArea.innerHTML="",this.blocks.forEach(e=>e.call(Je.REMOVED)),this.blocks.length=0}insertAfter(e,t){const o=this.blocks.indexOf(e);this.insert(o+1,t)}get(e){return this.blocks[e]}indexOf(e){return this.blocks.indexOf(e)}insertToDOM(e,t,o){t&&o!==void 0?o.holder.insertAdjacentElement(t,e.holder):this.workingArea.appendChild(e.holder),e.call(Je.RENDERED)}composeBlockEvent(e,t){return new CustomEvent(e,{detail:t})}}function Pu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);e&&(o=o.filter(function(n){return Object.getOwnPropertyDescriptor(r,n).enumerable})),t.push.apply(t,o)}return t}function $e(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Pu(Object(t),!0).forEach(function(o){Ub(r,o,t[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Pu(Object(t)).forEach(function(o){Object.defineProperty(r,o,Object.getOwnPropertyDescriptor(t,o))})}return r}function Ko(r){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ko=function(e){return typeof e}:Ko=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ko(r)}function Ub(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function tt(){return tt=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},tt.apply(this,arguments)}function Kb(r,e){if(r==null)return{};var t={},o=Object.keys(r),n,i;for(i=0;i<o.length;i++)n=o[i],!(e.indexOf(n)>=0)&&(t[n]=r[n]);return t}function Wb(r,e){if(r==null)return{};var t=Kb(r,e),o,n;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(r);for(n=0;n<i.length;n++)o=i[n],!(e.indexOf(o)>=0)&&Object.prototype.propertyIsEnumerable.call(r,o)&&(t[o]=r[o])}return t}var Gb="1.15.6";function ot(r){if(typeof window!="undefined"&&window.navigator)return!!navigator.userAgent.match(r)}var nt=ot(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),no=ot(/Edge/i),Fu=ot(/firefox/i),ro=ot(/safari/i)&&!ot(/chrome/i)&&!ot(/android/i),zs=ot(/iP(ad|od|hone)/i),Hu=ot(/chrome/i)&&ot(/android/i),qu={capture:!1,passive:!1};function W(r,e,t){r.addEventListener(e,t,!nt&&qu)}function U(r,e,t){r.removeEventListener(e,t,!nt&&qu)}function Wo(r,e){if(e){if(e[0]===">"&&(e=e.substring(1)),r)try{if(r.matches)return r.matches(e);if(r.msMatchesSelector)return r.msMatchesSelector(e);if(r.webkitMatchesSelector)return r.webkitMatchesSelector(e)}catch(t){return!1}return!1}}function zu(r){return r.host&&r!==document&&r.host.nodeType?r.host:r.parentNode}function je(r,e,t,o){if(r){t=t||document;do{if(e!=null&&(e[0]===">"?r.parentNode===t&&Wo(r,e):Wo(r,e))||o&&r===t)return r;if(r===t)break}while(r=zu(r))}return null}var ju=/\s+/g;function Se(r,e,t){if(r&&e)if(r.classList)r.classList[t?"add":"remove"](e);else{var o=(" "+r.className+" ").replace(ju," ").replace(" "+e+" "," ");r.className=(o+(t?" "+e:"")).replace(ju," ")}}function M(r,e,t){var o=r&&r.style;if(o){if(t===void 0)return document.defaultView&&document.defaultView.getComputedStyle?t=document.defaultView.getComputedStyle(r,""):r.currentStyle&&(t=r.currentStyle),e===void 0?t:t[e];!(e in o)&&e.indexOf("webkit")===-1&&(e="-webkit-"+e),o[e]=t+(typeof t=="string"?"":"px")}}function Dt(r,e){var t="";if(typeof r=="string")t=r;else do{var o=M(r,"transform");o&&o!=="none"&&(t=o+" "+t)}while(!e&&(r=r.parentNode));var n=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return n&&new n(t)}function Uu(r,e,t){if(r){var o=r.getElementsByTagName(e),n=0,i=o.length;if(t)for(;n<i;n++)t(o[n],n);return o}return[]}function Ve(){var r=document.scrollingElement;return r||document.documentElement}function ce(r,e,t,o,n){if(!(!r.getBoundingClientRect&&r!==window)){var i,s,a,l,c,d,u;if(r!==window&&r.parentNode&&r!==Ve()?(i=r.getBoundingClientRect(),s=i.top,a=i.left,l=i.bottom,c=i.right,d=i.height,u=i.width):(s=0,a=0,l=window.innerHeight,c=window.innerWidth,d=window.innerHeight,u=window.innerWidth),(e||t)&&r!==window&&(n=n||r.parentNode,!nt))do if(n&&n.getBoundingClientRect&&(M(n,"transform")!=="none"||t&&M(n,"position")!=="static")){var h=n.getBoundingClientRect();s-=h.top+parseInt(M(n,"border-top-width")),a-=h.left+parseInt(M(n,"border-left-width")),l=s+i.height,c=a+i.width;break}while(n=n.parentNode);if(o&&r!==window){var p=Dt(n||r),f=p&&p.a,g=p&&p.d;p&&(s/=g,a/=f,u/=f,d/=g,l=s+d,c=a+u)}return{top:s,left:a,bottom:l,right:c,width:u,height:d}}}function Ku(r,e,t){for(var o=at(r,!0),n=ce(r)[e];o;){var i=ce(o)[t],s=void 0;if(s=n>=i,!s)return o;if(o===Ve())break;o=at(o,!1)}return!1}function Mt(r,e,t,o){for(var n=0,i=0,s=r.children;i<s.length;){if(s[i].style.display!=="none"&&s[i]!==P.ghost&&(o||s[i]!==P.dragged)&&je(s[i],t.draggable,r,!1)){if(n===e)return s[i];n++}i++}return null}function js(r,e){for(var t=r.lastElementChild;t&&(t===P.ghost||M(t,"display")==="none"||e&&!Wo(t,e));)t=t.previousElementSibling;return t||null}function Me(r,e){var t=0;if(!r||!r.parentNode)return-1;for(;r=r.previousElementSibling;)r.nodeName.toUpperCase()!=="TEMPLATE"&&r!==P.clone&&(!e||Wo(r,e))&&t++;return t}function Wu(r){var e=0,t=0,o=Ve();if(r)do{var n=Dt(r),i=n.a,s=n.d;e+=r.scrollLeft*i,t+=r.scrollTop*s}while(r!==o&&(r=r.parentNode));return[e,t]}function $b(r,e){for(var t in r)if(r.hasOwnProperty(t)){for(var o in e)if(e.hasOwnProperty(o)&&e[o]===r[t][o])return Number(t)}return-1}function at(r,e){if(!r||!r.getBoundingClientRect)return Ve();var t=r,o=!1;do if(t.clientWidth<t.scrollWidth||t.clientHeight<t.scrollHeight){var n=M(t);if(t.clientWidth<t.scrollWidth&&(n.overflowX=="auto"||n.overflowX=="scroll")||t.clientHeight<t.scrollHeight&&(n.overflowY=="auto"||n.overflowY=="scroll")){if(!t.getBoundingClientRect||t===document.body)return Ve();if(o||e)return t;o=!0}}while(t=t.parentNode);return Ve()}function Vb(r,e){if(r&&e)for(var t in e)e.hasOwnProperty(t)&&(r[t]=e[t]);return r}function Us(r,e){return Math.round(r.top)===Math.round(e.top)&&Math.round(r.left)===Math.round(e.left)&&Math.round(r.height)===Math.round(e.height)&&Math.round(r.width)===Math.round(e.width)}var io;function Gu(r,e){return function(){if(!io){var t=arguments,o=this;t.length===1?r.call(o,t[0]):r.apply(o,t),io=setTimeout(function(){io=void 0},e)}}}function Xb(){clearTimeout(io),io=void 0}function $u(r,e,t){r.scrollLeft+=e,r.scrollTop+=t}function Vu(r){var e=window.Polymer,t=window.jQuery||window.Zepto;return e&&e.dom?e.dom(r).cloneNode(!0):t?t(r).clone(!0)[0]:r.cloneNode(!0)}function Xu(r,e,t){var o={};return Array.from(r.children).forEach(function(n){var i,s,a,l;if(!(!je(n,e.draggable,r,!1)||n.animated||n===t)){var c=ce(n);o.left=Math.min((i=o.left)!==null&&i!==void 0?i:1/0,c.left),o.top=Math.min((s=o.top)!==null&&s!==void 0?s:1/0,c.top),o.right=Math.max((a=o.right)!==null&&a!==void 0?a:-1/0,c.right),o.bottom=Math.max((l=o.bottom)!==null&&l!==void 0?l:-1/0,c.bottom)}}),o.width=o.right-o.left,o.height=o.bottom-o.top,o.x=o.left,o.y=o.top,o}var Be="Sortable"+new Date().getTime();function Yb(){var r=[],e;return{captureAnimationState:function(){if(r=[],!!this.options.animation){var o=[].slice.call(this.el.children);o.forEach(function(n){if(!(M(n,"display")==="none"||n===P.ghost)){r.push({target:n,rect:ce(n)});var i=$e({},r[r.length-1].rect);if(n.thisAnimationDuration){var s=Dt(n,!0);s&&(i.top-=s.f,i.left-=s.e)}n.fromRect=i}})}},addAnimationState:function(o){r.push(o)},removeAnimationState:function(o){r.splice($b(r,{target:o}),1)},animateAll:function(o){var n=this;if(!this.options.animation){clearTimeout(e),typeof o=="function"&&o();return}var i=!1,s=0;r.forEach(function(a){var l=0,c=a.target,d=c.fromRect,u=ce(c),h=c.prevFromRect,p=c.prevToRect,f=a.rect,g=Dt(c,!0);g&&(u.top-=g.f,u.left-=g.e),c.toRect=u,c.thisAnimationDuration&&Us(h,u)&&!Us(d,u)&&(f.top-u.top)/(f.left-u.left)===(d.top-u.top)/(d.left-u.left)&&(l=Jb(f,h,p,n.options)),Us(u,d)||(c.prevFromRect=d,c.prevToRect=u,l||(l=n.options.animation),n.animate(c,f,u,l)),l&&(i=!0,s=Math.max(s,l),clearTimeout(c.animationResetTimer),c.animationResetTimer=setTimeout(function(){c.animationTime=0,c.prevFromRect=null,c.fromRect=null,c.prevToRect=null,c.thisAnimationDuration=null},l),c.thisAnimationDuration=l)}),clearTimeout(e),i?e=setTimeout(function(){typeof o=="function"&&o()},s):typeof o=="function"&&o(),r=[]},animate:function(o,n,i,s){if(s){M(o,"transition",""),M(o,"transform","");var a=Dt(this.el),l=a&&a.a,c=a&&a.d,d=(n.left-i.left)/(l||1),u=(n.top-i.top)/(c||1);o.animatingX=!!d,o.animatingY=!!u,M(o,"transform","translate3d("+d+"px,"+u+"px,0)"),this.forRepaintDummy=Zb(o),M(o,"transition","transform "+s+"ms"+(this.options.easing?" "+this.options.easing:"")),M(o,"transform","translate3d(0,0,0)"),typeof o.animated=="number"&&clearTimeout(o.animated),o.animated=setTimeout(function(){M(o,"transition",""),M(o,"transform",""),o.animated=!1,o.animatingX=!1,o.animatingY=!1},s)}}}}function Zb(r){return r.offsetWidth}function Jb(r,e,t,o){return Math.sqrt(Math.pow(e.top-r.top,2)+Math.pow(e.left-r.left,2))/Math.sqrt(Math.pow(e.top-t.top,2)+Math.pow(e.left-t.left,2))*o.animation}var Pt=[],Ks={initializeByDefault:!0},so={mount:function(e){for(var t in Ks)Ks.hasOwnProperty(t)&&!(t in e)&&(e[t]=Ks[t]);Pt.forEach(function(o){if(o.pluginName===e.pluginName)throw"Sortable: Cannot mount plugin ".concat(e.pluginName," more than once")}),Pt.push(e)},pluginEvent:function(e,t,o){var n=this;this.eventCanceled=!1,o.cancel=function(){n.eventCanceled=!0};var i=e+"Global";Pt.forEach(function(s){t[s.pluginName]&&(t[s.pluginName][i]&&t[s.pluginName][i]($e({sortable:t},o)),t.options[s.pluginName]&&t[s.pluginName][e]&&t[s.pluginName][e]($e({sortable:t},o)))})},initializePlugins:function(e,t,o,n){Pt.forEach(function(a){var l=a.pluginName;if(!(!e.options[l]&&!a.initializeByDefault)){var c=new a(e,t,e.options);c.sortable=e,c.options=e.options,e[l]=c,tt(o,c.defaults)}});for(var i in e.options)if(e.options.hasOwnProperty(i)){var s=this.modifyOption(e,i,e.options[i]);typeof s!="undefined"&&(e.options[i]=s)}},getEventProperties:function(e,t){var o={};return Pt.forEach(function(n){typeof n.eventProperties=="function"&&tt(o,n.eventProperties.call(t[n.pluginName],e))}),o},modifyOption:function(e,t,o){var n;return Pt.forEach(function(i){e[i.pluginName]&&i.optionListeners&&typeof i.optionListeners[t]=="function"&&(n=i.optionListeners[t].call(e[i.pluginName],o))}),n}};function Qb(r){var e=r.sortable,t=r.rootEl,o=r.name,n=r.targetEl,i=r.cloneEl,s=r.toEl,a=r.fromEl,l=r.oldIndex,c=r.newIndex,d=r.oldDraggableIndex,u=r.newDraggableIndex,h=r.originalEvent,p=r.putSortable,f=r.extraEventProperties;if(e=e||t&&t[Be],!!e){var g,b=e.options,k="on"+o.charAt(0).toUpperCase()+o.substr(1);window.CustomEvent&&!nt&&!no?g=new CustomEvent(o,{bubbles:!0,cancelable:!0}):(g=document.createEvent("Event"),g.initEvent(o,!0,!0)),g.to=s||t,g.from=a||t,g.item=n||t,g.clone=i,g.oldIndex=l,g.newIndex=c,g.oldDraggableIndex=d,g.newDraggableIndex=u,g.originalEvent=h,g.pullMode=p?p.lastPutMode:void 0;var y=$e($e({},f),so.getEventProperties(o,e));for(var x in y)g[x]=y[x];t&&t.dispatchEvent(g),b[k]&&b[k].call(e,g)}}var ev=["evt"],xe=function(e,t){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=o.evt,i=Wb(o,ev);so.pluginEvent.bind(P)(e,t,$e({dragEl:B,parentEl:se,ghostEl:H,rootEl:te,nextEl:kt,lastDownEl:Go,cloneEl:oe,cloneHidden:lt,dragStarted:lo,putSortable:be,activeSortable:P.active,originalEvent:n,oldIndex:Ft,oldDraggableIndex:ao,newIndex:Ae,newDraggableIndex:ct,hideGhostForTarget:oh,unhideGhostForTarget:nh,cloneNowHidden:function(){lt=!0},cloneNowShown:function(){lt=!1},dispatchSortableEvent:function(a){we({sortable:t,name:a,originalEvent:n})}},i))};function we(r){Qb($e({putSortable:be,cloneEl:oe,targetEl:B,rootEl:te,oldIndex:Ft,oldDraggableIndex:ao,newIndex:Ae,newDraggableIndex:ct},r))}var B,se,H,te,kt,Go,oe,lt,Ft,Ae,ao,ct,$o,be,Ht=!1,Vo=!1,Xo=[],yt,Ue,Ws,Gs,Yu,Zu,lo,qt,co,uo=!1,Yo=!1,Zo,ve,$s=[],Vs=!1,Jo=[],Qo=typeof document!="undefined",en=zs,Ju=no||nt?"cssFloat":"float",tv=Qo&&!Hu&&!zs&&"draggable"in document.createElement("div"),Qu=(function(){if(Qo){if(nt)return!1;var r=document.createElement("x");return r.style.cssText="pointer-events:auto",r.style.pointerEvents==="auto"}})(),eh=function(e,t){var o=M(e),n=parseInt(o.width)-parseInt(o.paddingLeft)-parseInt(o.paddingRight)-parseInt(o.borderLeftWidth)-parseInt(o.borderRightWidth),i=Mt(e,0,t),s=Mt(e,1,t),a=i&&M(i),l=s&&M(s),c=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+ce(i).width,d=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+ce(s).width;if(o.display==="flex")return o.flexDirection==="column"||o.flexDirection==="column-reverse"?"vertical":"horizontal";if(o.display==="grid")return o.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(i&&a.float&&a.float!=="none"){var u=a.float==="left"?"left":"right";return s&&(l.clear==="both"||l.clear===u)?"vertical":"horizontal"}return i&&(a.display==="block"||a.display==="flex"||a.display==="table"||a.display==="grid"||c>=n&&o[Ju]==="none"||s&&o[Ju]==="none"&&c+d>n)?"vertical":"horizontal"},ov=function(e,t,o){var n=o?e.left:e.top,i=o?e.right:e.bottom,s=o?e.width:e.height,a=o?t.left:t.top,l=o?t.right:t.bottom,c=o?t.width:t.height;return n===a||i===l||n+s/2===a+c/2},nv=function(e,t){var o;return Xo.some(function(n){var i=n[Be].options.emptyInsertThreshold;if(!(!i||js(n))){var s=ce(n),a=e>=s.left-i&&e<=s.right+i,l=t>=s.top-i&&t<=s.bottom+i;if(a&&l)return o=n}}),o},th=function(e){function t(i,s){return function(a,l,c,d){var u=a.options.group.name&&l.options.group.name&&a.options.group.name===l.options.group.name;if(i==null&&(s||u))return!0;if(i==null||i===!1)return!1;if(s&&i==="clone")return i;if(typeof i=="function")return t(i(a,l,c,d),s)(a,l,c,d);var h=(s?a:l).options.group.name;return i===!0||typeof i=="string"&&i===h||i.join&&i.indexOf(h)>-1}}var o={},n=e.group;(!n||Ko(n)!="object")&&(n={name:n}),o.name=n.name,o.checkPull=t(n.pull,!0),o.checkPut=t(n.put),o.revertClone=n.revertClone,e.group=o},oh=function(){!Qu&&H&&M(H,"display","none")},nh=function(){!Qu&&H&&M(H,"display","")};Qo&&!Hu&&document.addEventListener("click",function(r){if(Vo)return r.preventDefault(),r.stopPropagation&&r.stopPropagation(),r.stopImmediatePropagation&&r.stopImmediatePropagation(),Vo=!1,!1},!0);var wt=function(e){if(B){e=e.touches?e.touches[0]:e;var t=nv(e.clientX,e.clientY);if(t){var o={};for(var n in e)e.hasOwnProperty(n)&&(o[n]=e[n]);o.target=o.rootEl=t,o.preventDefault=void 0,o.stopPropagation=void 0,t[Be]._onDragOver(o)}}},rv=function(e){B&&B.parentNode[Be]._isOutsideThisEl(e.target)};function P(r,e){if(!(r&&r.nodeType&&r.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(r));this.el=r,this.options=e=tt({},e),r[Be]=this;var t={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(r.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return eh(r,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(s,a){s.setData("Text",a.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:P.supportPointer!==!1&&"PointerEvent"in window&&(!ro||zs),emptyInsertThreshold:5};so.initializePlugins(this,r,t);for(var o in t)!(o in e)&&(e[o]=t[o]);th(e);for(var n in this)n.charAt(0)==="_"&&typeof this[n]=="function"&&(this[n]=this[n].bind(this));this.nativeDraggable=e.forceFallback?!1:tv,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?W(r,"pointerdown",this._onTapStart):(W(r,"mousedown",this._onTapStart),W(r,"touchstart",this._onTapStart)),this.nativeDraggable&&(W(r,"dragover",this),W(r,"dragenter",this)),Xo.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),tt(this,Yb())}P.prototype={constructor:P,_isOutsideThisEl:function(e){!this.el.contains(e)&&e!==this.el&&(qt=null)},_getDirection:function(e,t){return typeof this.options.direction=="function"?this.options.direction.call(this,e,t,B):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,o=this.el,n=this.options,i=n.preventOnFilter,s=e.type,a=e.touches&&e.touches[0]||e.pointerType&&e.pointerType==="touch"&&e,l=(a||e).target,c=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||l,d=n.filter;if(hv(o),!B&&!(/mousedown|pointerdown/.test(s)&&e.button!==0||n.disabled)&&!c.isContentEditable&&!(!this.nativeDraggable&&ro&&l&&l.tagName.toUpperCase()==="SELECT")&&(l=je(l,n.draggable,o,!1),!(l&&l.animated)&&Go!==l)){if(Ft=Me(l),ao=Me(l,n.draggable),typeof d=="function"){if(d.call(this,e,l,this)){we({sortable:t,rootEl:c,name:"filter",targetEl:l,toEl:o,fromEl:o}),xe("filter",t,{evt:e}),i&&e.preventDefault();return}}else if(d&&(d=d.split(",").some(function(u){if(u=je(c,u.trim(),o,!1),u)return we({sortable:t,rootEl:u,name:"filter",targetEl:l,fromEl:o,toEl:o}),xe("filter",t,{evt:e}),!0}),d)){i&&e.preventDefault();return}n.handle&&!je(c,n.handle,o,!1)||this._prepareDragStart(e,a,l)}}},_prepareDragStart:function(e,t,o){var n=this,i=n.el,s=n.options,a=i.ownerDocument,l;if(o&&!B&&o.parentNode===i){var c=ce(o);if(te=i,B=o,se=B.parentNode,kt=B.nextSibling,Go=o,$o=s.group,P.dragged=B,yt={target:B,clientX:(t||e).clientX,clientY:(t||e).clientY},Yu=yt.clientX-c.left,Zu=yt.clientY-c.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,B.style["will-change"]="all",l=function(){if(xe("delayEnded",n,{evt:e}),P.eventCanceled){n._onDrop();return}n._disableDelayedDragEvents(),!Fu&&n.nativeDraggable&&(B.draggable=!0),n._triggerDragStart(e,t),we({sortable:n,name:"choose",originalEvent:e}),Se(B,s.chosenClass,!0)},s.ignore.split(",").forEach(function(d){Uu(B,d.trim(),Xs)}),W(a,"dragover",wt),W(a,"mousemove",wt),W(a,"touchmove",wt),s.supportPointer?(W(a,"pointerup",n._onDrop),!this.nativeDraggable&&W(a,"pointercancel",n._onDrop)):(W(a,"mouseup",n._onDrop),W(a,"touchend",n._onDrop),W(a,"touchcancel",n._onDrop)),Fu&&this.nativeDraggable&&(this.options.touchStartThreshold=4,B.draggable=!0),xe("delayStart",this,{evt:e}),s.delay&&(!s.delayOnTouchOnly||t)&&(!this.nativeDraggable||!(no||nt))){if(P.eventCanceled){this._onDrop();return}s.supportPointer?(W(a,"pointerup",n._disableDelayedDrag),W(a,"pointercancel",n._disableDelayedDrag)):(W(a,"mouseup",n._disableDelayedDrag),W(a,"touchend",n._disableDelayedDrag),W(a,"touchcancel",n._disableDelayedDrag)),W(a,"mousemove",n._delayedDragTouchMoveHandler),W(a,"touchmove",n._delayedDragTouchMoveHandler),s.supportPointer&&W(a,"pointermove",n._delayedDragTouchMoveHandler),n._dragStartTimer=setTimeout(l,s.delay)}else l()}},_delayedDragTouchMoveHandler:function(e){var t=e.touches?e.touches[0]:e;Math.max(Math.abs(t.clientX-this._lastX),Math.abs(t.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){B&&Xs(B),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;U(e,"mouseup",this._disableDelayedDrag),U(e,"touchend",this._disableDelayedDrag),U(e,"touchcancel",this._disableDelayedDrag),U(e,"pointerup",this._disableDelayedDrag),U(e,"pointercancel",this._disableDelayedDrag),U(e,"mousemove",this._delayedDragTouchMoveHandler),U(e,"touchmove",this._delayedDragTouchMoveHandler),U(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||e.pointerType=="touch"&&e,!this.nativeDraggable||t?this.options.supportPointer?W(document,"pointermove",this._onTouchMove):t?W(document,"touchmove",this._onTouchMove):W(document,"mousemove",this._onTouchMove):(W(B,"dragend",this),W(te,"dragstart",this._onDragStart));try{document.selection?on(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch(o){}},_dragStarted:function(e,t){if(Ht=!1,te&&B){xe("dragStarted",this,{evt:t}),this.nativeDraggable&&W(document,"dragover",rv);var o=this.options;!e&&Se(B,o.dragClass,!1),Se(B,o.ghostClass,!0),P.active=this,e&&this._appendGhost(),we({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(Ue){this._lastX=Ue.clientX,this._lastY=Ue.clientY,oh();for(var e=document.elementFromPoint(Ue.clientX,Ue.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(Ue.clientX,Ue.clientY),e!==t);)t=e;if(B.parentNode[Be]._isOutsideThisEl(e),t)do{if(t[Be]){var o=void 0;if(o=t[Be]._onDragOver({clientX:Ue.clientX,clientY:Ue.clientY,target:e,rootEl:t}),o&&!this.options.dragoverBubble)break}e=t}while(t=zu(t));nh()}},_onTouchMove:function(e){if(yt){var t=this.options,o=t.fallbackTolerance,n=t.fallbackOffset,i=e.touches?e.touches[0]:e,s=H&&Dt(H,!0),a=H&&s&&s.a,l=H&&s&&s.d,c=en&&ve&&Wu(ve),d=(i.clientX-yt.clientX+n.x)/(a||1)+(c?c[0]-$s[0]:0)/(a||1),u=(i.clientY-yt.clientY+n.y)/(l||1)+(c?c[1]-$s[1]:0)/(l||1);if(!P.active&&!Ht){if(o&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))<o)return;this._onDragStart(e,!0)}if(H){s?(s.e+=d-(Ws||0),s.f+=u-(Gs||0)):s={a:1,b:0,c:0,d:1,e:d,f:u};var h="matrix(".concat(s.a,",").concat(s.b,",").concat(s.c,",").concat(s.d,",").concat(s.e,",").concat(s.f,")");M(H,"webkitTransform",h),M(H,"mozTransform",h),M(H,"msTransform",h),M(H,"transform",h),Ws=d,Gs=u,Ue=i}e.cancelable&&e.preventDefault()}},_appendGhost:function(){if(!H){var e=this.options.fallbackOnBody?document.body:te,t=ce(B,!0,en,!0,e),o=this.options;if(en){for(ve=e;M(ve,"position")==="static"&&M(ve,"transform")==="none"&&ve!==document;)ve=ve.parentNode;ve!==document.body&&ve!==document.documentElement?(ve===document&&(ve=Ve()),t.top+=ve.scrollTop,t.left+=ve.scrollLeft):ve=Ve(),$s=Wu(ve)}H=B.cloneNode(!0),Se(H,o.ghostClass,!1),Se(H,o.fallbackClass,!0),Se(H,o.dragClass,!0),M(H,"transition",""),M(H,"transform",""),M(H,"box-sizing","border-box"),M(H,"margin",0),M(H,"top",t.top),M(H,"left",t.left),M(H,"width",t.width),M(H,"height",t.height),M(H,"opacity","0.8"),M(H,"position",en?"absolute":"fixed"),M(H,"zIndex","100000"),M(H,"pointerEvents","none"),P.ghost=H,e.appendChild(H),M(H,"transform-origin",Yu/parseInt(H.style.width)*100+"% "+Zu/parseInt(H.style.height)*100+"%")}},_onDragStart:function(e,t){var o=this,n=e.dataTransfer,i=o.options;if(xe("dragStart",this,{evt:e}),P.eventCanceled){this._onDrop();return}xe("setupClone",this),P.eventCanceled||(oe=Vu(B),oe.removeAttribute("id"),oe.draggable=!1,oe.style["will-change"]="",this._hideClone(),Se(oe,this.options.chosenClass,!1),P.clone=oe),o.cloneId=on(function(){xe("clone",o),!P.eventCanceled&&(o.options.removeCloneOnHide||te.insertBefore(oe,B),o._hideClone(),we({sortable:o,name:"clone"}))}),!t&&Se(B,i.dragClass,!0),t?(Vo=!0,o._loopId=setInterval(o._emulateDragOver,50)):(U(document,"mouseup",o._onDrop),U(document,"touchend",o._onDrop),U(document,"touchcancel",o._onDrop),n&&(n.effectAllowed="move",i.setData&&i.setData.call(o,n,B)),W(document,"drop",o),M(B,"transform","translateZ(0)")),Ht=!0,o._dragStartId=on(o._dragStarted.bind(o,t,e)),W(document,"selectstart",o),lo=!0,window.getSelection().removeAllRanges(),ro&&M(document.body,"user-select","none")},_onDragOver:function(e){var t=this.el,o=e.target,n,i,s,a=this.options,l=a.group,c=P.active,d=$o===l,u=a.sort,h=be||c,p,f=this,g=!1;if(Vs)return;function b(L,dn){xe(L,f,$e({evt:e,isOwner:d,axis:p?"vertical":"horizontal",revert:s,dragRect:n,targetRect:i,canSort:u,fromSortable:h,target:o,completed:y,onMove:function(po,go){return tn(te,t,B,n,po,ce(po),e,go)},changed:x},dn))}function k(){b("dragOverAnimationCapture"),f.captureAnimationState(),f!==h&&h.captureAnimationState()}function y(L){return b("dragOverCompleted",{insertion:L}),L&&(d?c._hideClone():c._showClone(f),f!==h&&(Se(B,be?be.options.ghostClass:c.options.ghostClass,!1),Se(B,a.ghostClass,!0)),be!==f&&f!==P.active?be=f:f===P.active&&be&&(be=null),h===f&&(f._ignoreWhileAnimating=o),f.animateAll(function(){b("dragOverAnimationComplete"),f._ignoreWhileAnimating=null}),f!==h&&(h.animateAll(),h._ignoreWhileAnimating=null)),(o===B&&!B.animated||o===t&&!o.animated)&&(qt=null),!a.dragoverBubble&&!e.rootEl&&o!==document&&(B.parentNode[Be]._isOutsideThisEl(e.target),!L&&wt(e)),!a.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),g=!0}function x(){Ae=Me(B),ct=Me(B,a.draggable),we({sortable:f,name:"change",toEl:t,newIndex:Ae,newDraggableIndex:ct,originalEvent:e})}if(e.preventDefault!==void 0&&e.cancelable&&e.preventDefault(),o=je(o,a.draggable,t,!0),b("dragOver"),P.eventCanceled)return g;if(B.contains(e.target)||o.animated&&o.animatingX&&o.animatingY||f._ignoreWhileAnimating===o)return y(!1);if(Vo=!1,c&&!a.disabled&&(d?u||(s=se!==te):be===this||(this.lastPutMode=$o.checkPull(this,c,B,e))&&l.checkPut(this,c,B,e))){if(p=this._getDirection(e,o)==="vertical",n=ce(B),b("dragOverValid"),P.eventCanceled)return g;if(s)return se=te,k(),this._hideClone(),b("revert"),P.eventCanceled||(kt?te.insertBefore(B,kt):te.appendChild(B)),y(!0);var T=js(t,a.draggable);if(!T||lv(e,p,this)&&!T.animated){if(T===B)return y(!1);if(T&&t===e.target&&(o=T),o&&(i=ce(o)),tn(te,t,B,n,o,i,e,!!o)!==!1)return k(),T&&T.nextSibling?t.insertBefore(B,T.nextSibling):t.appendChild(B),se=t,x(),y(!0)}else if(T&&av(e,p,this)){var R=Mt(t,0,a,!0);if(R===B)return y(!1);if(o=R,i=ce(o),tn(te,t,B,n,o,i,e,!1)!==!1)return k(),t.insertBefore(B,R),se=t,x(),y(!0)}else if(o.parentNode===t){i=ce(o);var C=0,E,w=B.parentNode!==t,_=!ov(B.animated&&B.toRect||n,o.animated&&o.toRect||i,p),F=p?"top":"left",N=Ku(o,"top","top")||Ku(B,"top","top"),X=N?N.scrollTop:void 0;qt!==o&&(E=i[F],uo=!1,Yo=!_&&a.invertSwap||w),C=cv(e,o,i,p,_?1:a.swapThreshold,a.invertedSwapThreshold==null?a.swapThreshold:a.invertedSwapThreshold,Yo,qt===o);var D;if(C!==0){var J=Me(B);do J-=C,D=se.children[J];while(D&&(M(D,"display")==="none"||D===H))}if(C===0||D===o)return y(!1);qt=o,co=C;var ne=o.nextElementSibling,re=!1;re=C===1;var Fe=tn(te,t,B,n,o,i,e,re);if(Fe!==!1)return(Fe===1||Fe===-1)&&(re=Fe===1),Vs=!0,setTimeout(sv,30),k(),re&&!ne?t.appendChild(B):o.parentNode.insertBefore(B,re?ne:o),N&&$u(N,0,X-N.scrollTop),se=B.parentNode,E!==void 0&&!Yo&&(Zo=Math.abs(E-ce(o)[F])),x(),y(!0)}if(t.contains(B))return y(!1)}return!1},_ignoreWhileAnimating:null,_offMoveEvents:function(){U(document,"mousemove",this._onTouchMove),U(document,"touchmove",this._onTouchMove),U(document,"pointermove",this._onTouchMove),U(document,"dragover",wt),U(document,"mousemove",wt),U(document,"touchmove",wt)},_offUpEvents:function(){var e=this.el.ownerDocument;U(e,"mouseup",this._onDrop),U(e,"touchend",this._onDrop),U(e,"pointerup",this._onDrop),U(e,"pointercancel",this._onDrop),U(e,"touchcancel",this._onDrop),U(document,"selectstart",this)},_onDrop:function(e){var t=this.el,o=this.options;if(Ae=Me(B),ct=Me(B,o.draggable),xe("drop",this,{evt:e}),se=B&&B.parentNode,Ae=Me(B),ct=Me(B,o.draggable),P.eventCanceled){this._nulling();return}Ht=!1,Yo=!1,uo=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),Ys(this.cloneId),Ys(this._dragStartId),this.nativeDraggable&&(U(document,"drop",this),U(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),ro&&M(document.body,"user-select",""),M(B,"transform",""),e&&(lo&&(e.cancelable&&e.preventDefault(),!o.dropBubble&&e.stopPropagation()),H&&H.parentNode&&H.parentNode.removeChild(H),(te===se||be&&be.lastPutMode!=="clone")&&oe&&oe.parentNode&&oe.parentNode.removeChild(oe),B&&(this.nativeDraggable&&U(B,"dragend",this),Xs(B),B.style["will-change"]="",lo&&!Ht&&Se(B,be?be.options.ghostClass:this.options.ghostClass,!1),Se(B,this.options.chosenClass,!1),we({sortable:this,name:"unchoose",toEl:se,newIndex:null,newDraggableIndex:null,originalEvent:e}),te!==se?(Ae>=0&&(we({rootEl:se,name:"add",toEl:se,fromEl:te,originalEvent:e}),we({sortable:this,name:"remove",toEl:se,originalEvent:e}),we({rootEl:se,name:"sort",toEl:se,fromEl:te,originalEvent:e}),we({sortable:this,name:"sort",toEl:se,originalEvent:e})),be&&be.save()):Ae!==Ft&&Ae>=0&&(we({sortable:this,name:"update",toEl:se,originalEvent:e}),we({sortable:this,name:"sort",toEl:se,originalEvent:e})),P.active&&((Ae==null||Ae===-1)&&(Ae=Ft,ct=ao),we({sortable:this,name:"end",toEl:se,originalEvent:e}),this.save()))),this._nulling()},_nulling:function(){xe("nulling",this),te=B=se=H=kt=oe=Go=lt=yt=Ue=lo=Ae=ct=Ft=ao=qt=co=be=$o=P.dragged=P.ghost=P.clone=P.active=null,Jo.forEach(function(e){e.checked=!0}),Jo.length=Ws=Gs=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":B&&(this._onDragOver(e),iv(e));break;case"selectstart":e.preventDefault();break}},toArray:function(){for(var e=[],t,o=this.el.children,n=0,i=o.length,s=this.options;n<i;n++)t=o[n],je(t,s.draggable,this.el,!1)&&e.push(t.getAttribute(s.dataIdAttr)||uv(t));return e},sort:function(e,t){var o={},n=this.el;this.toArray().forEach(function(i,s){var a=n.children[s];je(a,this.options.draggable,n,!1)&&(o[i]=a)},this),t&&this.captureAnimationState(),e.forEach(function(i){o[i]&&(n.removeChild(o[i]),n.appendChild(o[i]))}),t&&this.animateAll()},save:function(){var e=this.options.store;e&&e.set&&e.set(this)},closest:function(e,t){return je(e,t||this.options.draggable,this.el,!1)},option:function(e,t){var o=this.options;if(t===void 0)return o[e];var n=so.modifyOption(this,e,t);typeof n!="undefined"?o[e]=n:o[e]=t,e==="group"&&th(o)},destroy:function(){xe("destroy",this);var e=this.el;e[Be]=null,U(e,"mousedown",this._onTapStart),U(e,"touchstart",this._onTapStart),U(e,"pointerdown",this._onTapStart),this.nativeDraggable&&(U(e,"dragover",this),U(e,"dragenter",this)),Array.prototype.forEach.call(e.querySelectorAll("[draggable]"),function(t){t.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),Xo.splice(Xo.indexOf(this.el),1),this.el=e=null},_hideClone:function(){if(!lt){if(xe("hideClone",this),P.eventCanceled)return;M(oe,"display","none"),this.options.removeCloneOnHide&&oe.parentNode&&oe.parentNode.removeChild(oe),lt=!0}},_showClone:function(e){if(e.lastPutMode!=="clone"){this._hideClone();return}if(lt){if(xe("showClone",this),P.eventCanceled)return;B.parentNode==te&&!this.options.group.revertClone?te.insertBefore(oe,B):kt?te.insertBefore(oe,kt):te.appendChild(oe),this.options.group.revertClone&&this.animate(B,oe),M(oe,"display",""),lt=!1}}};function iv(r){r.dataTransfer&&(r.dataTransfer.dropEffect="move"),r.cancelable&&r.preventDefault()}function tn(r,e,t,o,n,i,s,a){var l,c=r[Be],d=c.options.onMove,u;return window.CustomEvent&&!nt&&!no?l=new CustomEvent("move",{bubbles:!0,cancelable:!0}):(l=document.createEvent("Event"),l.initEvent("move",!0,!0)),l.to=e,l.from=r,l.dragged=t,l.draggedRect=o,l.related=n||e,l.relatedRect=i||ce(e),l.willInsertAfter=a,l.originalEvent=s,r.dispatchEvent(l),d&&(u=d.call(c,l,s)),u}function Xs(r){r.draggable=!1}function sv(){Vs=!1}function av(r,e,t){var o=ce(Mt(t.el,0,t.options,!0)),n=Xu(t.el,t.options,H),i=10;return e?r.clientX<n.left-i||r.clientY<o.top&&r.clientX<o.right:r.clientY<n.top-i||r.clientY<o.bottom&&r.clientX<o.left}function lv(r,e,t){var o=ce(js(t.el,t.options.draggable)),n=Xu(t.el,t.options,H),i=10;return e?r.clientX>n.right+i||r.clientY>o.bottom&&r.clientX>o.left:r.clientY>n.bottom+i||r.clientX>o.right&&r.clientY>o.top}function cv(r,e,t,o,n,i,s,a){var l=o?r.clientY:r.clientX,c=o?t.height:t.width,d=o?t.top:t.left,u=o?t.bottom:t.right,h=!1;if(!s){if(a&&Zo<c*n){if(!uo&&(co===1?l>d+c*i/2:l<u-c*i/2)&&(uo=!0),uo)h=!0;else if(co===1?l<d+Zo:l>u-Zo)return-co}else if(l>d+c*(1-n)/2&&l<u-c*(1-n)/2)return dv(e)}return h=h||s,h&&(l<d+c*i/2||l>u-c*i/2)?l>d+c/2?1:-1:0}function dv(r){return Me(B)<Me(r)?1:-1}function uv(r){for(var e=r.tagName+r.className+r.src+r.href+r.textContent,t=e.length,o=0;t--;)o+=e.charCodeAt(t);return o.toString(36)}function hv(r){Jo.length=0;for(var e=r.getElementsByTagName("input"),t=e.length;t--;){var o=e[t];o.checked&&Jo.push(o)}}function on(r){return setTimeout(r,0)}function Ys(r){return clearTimeout(r)}Qo&&W(document,"touchmove",function(r){(P.active||Ht)&&r.cancelable&&r.preventDefault()}),P.utils={on:W,off:U,css:M,find:Uu,is:function(e,t){return!!je(e,t,e,!1)},extend:Vb,throttle:Gu,closest:je,toggleClass:Se,clone:Vu,index:Me,nextTick:on,cancelNextTick:Ys,detectDirection:eh,getChild:Mt,expando:Be},P.get=function(r){return r[Be]},P.mount=function(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];e[0].constructor===Array&&(e=e[0]),e.forEach(function(o){if(!o.prototype||!o.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(o));o.utils&&(P.utils=$e($e({},P.utils),o.utils)),so.mount(o)})},P.create=function(r,e){return new P(r,e)},P.version=Gb;var de=[],ho,Zs,Js=!1,Qs,ea,nn,fo;function fv(){function r(){this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0};for(var e in this)e.charAt(0)==="_"&&typeof this[e]=="function"&&(this[e]=this[e].bind(this))}return r.prototype={dragStarted:function(t){var o=t.originalEvent;this.sortable.nativeDraggable?W(document,"dragover",this._handleAutoScroll):this.options.supportPointer?W(document,"pointermove",this._handleFallbackAutoScroll):o.touches?W(document,"touchmove",this._handleFallbackAutoScroll):W(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(t){var o=t.originalEvent;!this.options.dragOverBubble&&!o.rootEl&&this._handleAutoScroll(o)},drop:function(){this.sortable.nativeDraggable?U(document,"dragover",this._handleAutoScroll):(U(document,"pointermove",this._handleFallbackAutoScroll),U(document,"touchmove",this._handleFallbackAutoScroll),U(document,"mousemove",this._handleFallbackAutoScroll)),rh(),rn(),Xb()},nulling:function(){nn=Zs=ho=Js=fo=Qs=ea=null,de.length=0},_handleFallbackAutoScroll:function(t){this._handleAutoScroll(t,!0)},_handleAutoScroll:function(t,o){var n=this,i=(t.touches?t.touches[0]:t).clientX,s=(t.touches?t.touches[0]:t).clientY,a=document.elementFromPoint(i,s);if(nn=t,o||this.options.forceAutoScrollFallback||no||nt||ro){ta(t,this.options,a,o);var l=at(a,!0);Js&&(!fo||i!==Qs||s!==ea)&&(fo&&rh(),fo=setInterval(function(){var c=at(document.elementFromPoint(i,s),!0);c!==l&&(l=c,rn()),ta(t,n.options,c,o)},10),Qs=i,ea=s)}else{if(!this.options.bubbleScroll||at(a,!0)===Ve()){rn();return}ta(t,this.options,at(a,!1),!1)}}},tt(r,{pluginName:"scroll",initializeByDefault:!0})}function rn(){de.forEach(function(r){clearInterval(r.pid)}),de=[]}function rh(){clearInterval(fo)}var ta=Gu(function(r,e,t,o){if(e.scroll){var n=(r.touches?r.touches[0]:r).clientX,i=(r.touches?r.touches[0]:r).clientY,s=e.scrollSensitivity,a=e.scrollSpeed,l=Ve(),c=!1,d;Zs!==t&&(Zs=t,rn(),ho=e.scroll,d=e.scrollFn,ho===!0&&(ho=at(t,!0)));var u=0,h=ho;do{var p=h,f=ce(p),g=f.top,b=f.bottom,k=f.left,y=f.right,x=f.width,T=f.height,R=void 0,C=void 0,E=p.scrollWidth,w=p.scrollHeight,_=M(p),F=p.scrollLeft,N=p.scrollTop;p===l?(R=x<E&&(_.overflowX==="auto"||_.overflowX==="scroll"||_.overflowX==="visible"),C=T<w&&(_.overflowY==="auto"||_.overflowY==="scroll"||_.overflowY==="visible")):(R=x<E&&(_.overflowX==="auto"||_.overflowX==="scroll"),C=T<w&&(_.overflowY==="auto"||_.overflowY==="scroll"));var X=R&&(Math.abs(y-n)<=s&&F+x<E)-(Math.abs(k-n)<=s&&!!F),D=C&&(Math.abs(b-i)<=s&&N+T<w)-(Math.abs(g-i)<=s&&!!N);if(!de[u])for(var J=0;J<=u;J++)de[J]||(de[J]={});(de[u].vx!=X||de[u].vy!=D||de[u].el!==p)&&(de[u].el=p,de[u].vx=X,de[u].vy=D,clearInterval(de[u].pid),(X!=0||D!=0)&&(c=!0,de[u].pid=setInterval(function(){o&&this.layer===0&&P.active._onTouchMove(nn);var ne=de[this.layer].vy?de[this.layer].vy*a:0,re=de[this.layer].vx?de[this.layer].vx*a:0;typeof d=="function"&&d.call(P.dragged.parentNode[Be],re,ne,r,nn,de[this.layer].el)!=="continue"||$u(de[this.layer].el,re,ne)}.bind({layer:u}),24))),u++}while(e.bubbleScroll&&h!==l&&(h=at(h,!1)));Js=c}},30),ih=function(e){var t=e.originalEvent,o=e.putSortable,n=e.dragEl,i=e.activeSortable,s=e.dispatchSortableEvent,a=e.hideGhostForTarget,l=e.unhideGhostForTarget;if(t){var c=o||i;a();var d=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:t,u=document.elementFromPoint(d.clientX,d.clientY);l(),c&&!c.el.contains(u)&&(s("spill"),this.onSpill({dragEl:n,putSortable:o}))}};function oa(){}oa.prototype={startIndex:null,dragStart:function(e){var t=e.oldDraggableIndex;this.startIndex=t},onSpill:function(e){var t=e.dragEl,o=e.putSortable;this.sortable.captureAnimationState(),o&&o.captureAnimationState();var n=Mt(this.sortable.el,this.startIndex,this.options);n?this.sortable.el.insertBefore(t,n):this.sortable.el.appendChild(t),this.sortable.animateAll(),o&&o.animateAll()},drop:ih},tt(oa,{pluginName:"revertOnSpill"});function na(){}na.prototype={onSpill:function(e){var t=e.dragEl,o=e.putSortable,n=o||this.sortable;n.captureAnimationState(),t.parentNode&&t.parentNode.removeChild(t),n.animateAll()},drop:ih},tt(na,{pluginName:"removeOnSpill"}),P.mount(new fv),P.mount(na,oa);const sh="block-removed",pv="block-added",gv="block-moved",ah="block-changed";class lh{constructor(){this.tail=Promise.resolve()}get completed(){return this.failure?Promise.reject(this.failure):this.tail}add(e){if(this.failure)return Promise.reject(this.failure);const t=this.tail.then(()=>e());return this.tail=t.catch(o=>{this.failure=o}),t}}class mv extends z{constructor(){super(...arguments),this._currentBlockIndex=-1,this._blocks=null,this.sortable=null}get currentBlockIndex(){return this._currentBlockIndex}set currentBlockIndex(e){this._currentBlockIndex=e}get firstBlock(){return this.blocksStore[0]}get lastBlock(){return this.blocksStore[this.blocksStore.length-1]}get currentBlock(){return this.blocksStore[this.currentBlockIndex]}set currentBlock(e){if(e===void 0){this.unsetCurrentBlock();return}this.currentBlockIndex=this.getBlockIndex(e)}get nextBlock(){if(this.currentBlockIndex===this.blocksStore.length-1)return null;const t=this.blocksStore[this.currentBlockIndex+1];return t!=null?t:null}get nextContentfulBlock(){return this.blocks.slice(this.currentBlockIndex+1).find(t=>!!t.inputs.length)}get previousContentfulBlock(){return this.blocks.slice(0,this.currentBlockIndex).reverse().find(t=>!!t.inputs.length)}get previousBlock(){if(this.currentBlockIndex===0)return null;const t=this.blocksStore[this.currentBlockIndex-1];return t!=null?t:null}get blocks(){return this.blocksStore.array}get isBlokEmpty(){return this.blocks.every(e=>e.isEmpty)}prepare(){const e=new qs(this.Blok.UI.nodes.redactor);this._blocks=new Proxy(e,{set:qs.set,get:qs.get}),this.listeners.on(document,"copy",t=>{this.Blok.BlockEvents.handleCommandC(t)}),this.sortable=new P(this.Blok.UI.nodes.redactor,{animation:150,forceFallback:!0,handle:rm,onStart:()=>{this.Blok.UI.nodes.wrapper.setAttribute(cu,"true"),eo(!0)},onEnd:t=>{this.Blok.UI.nodes.wrapper.removeAttribute(cu),!(t.newIndex===void 0||t.oldIndex===void 0)&&this.move(t.newIndex,t.oldIndex,!0)}})}toggleReadOnly(e){e?this.disableModuleBindings():this.enableModuleBindings()}composeBlock({tool:e,data:t={},id:o=void 0,tunes:n={}}){const i=this.Blok.ReadOnly.isEnabled,s=this.Blok.Tools.blockTools.get(e);if(s===void 0)throw new Error(`Could not compose Block. Tool «${e}» not found.`);const a=new Qt({id:o,data:t,tool:s,api:this.Blok.API,readOnly:i,tunesData:n},this.eventsDispatcher);return i||window.requestIdleCallback(()=>{this.bindBlockEvents(a)},{timeout:2e3}),a}insert({id:e=void 0,tool:t,data:o,index:n,needToFocus:i=!0,replace:s=!1,tunes:a}={}){const l=n!=null?n:this.currentBlockIndex+(s?0:1),c=t!=null?t:this.config.defaultBlock;if(c===void 0)throw new Error("Could not insert Block. Tool name is not specified.");const d={tool:c};e!==void 0&&(d.id=e),o!==void 0&&(d.data=o),a!==void 0&&(d.tunes=a);const u=this.composeBlock(d),h=s?this.getBlockByIndex(l):void 0;if(s&&h===void 0)throw new Error(`Could not replace Block at index ${l}. Block not found.`);return s&&h!==void 0&&this.blockDidMutated(sh,h,{index:l}),this.blocksStore.insert(l,u,s),this.blockDidMutated(pv,u,{index:l}),i&&(this.currentBlockIndex=l),!i&&l<=this.currentBlockIndex&&this.currentBlockIndex++,u}insertMany(e,t=0){this.blocksStore.insertMany(e,t)}async update(e,t,o){if(!t&&!o)return e;const n=await e.data,i=this.composeBlock({id:e.id,tool:e.name,data:Object.assign({},n,t!=null?t:{}),tunes:o!=null?o:e.tunes}),s=this.getBlockIndex(e);return this.blocksStore.replace(s,i),this.blockDidMutated(ah,i,{index:s}),i}replace(e,t,o){const n=this.getBlockIndex(e);return this.insert({tool:t,data:o,index:n,replace:!0})}get blocksStore(){if(this._blocks===null)throw new Error("BlockManager: blocks store is not initialized. Call prepare() before accessing blocks.");return this._blocks}async paste(e,t,o=!1){const n=this.insert({tool:e,replace:o});try{await n.ready,n.call(Je.ON_PASTE,t),n.refreshToolRootElement()}catch(i){j(`${e}: onPaste callback call is failed`,"error",i)}return n}insertDefaultBlockAtIndex(e,t=!1){const o=this.config.defaultBlock;if(o===void 0)throw new Error("Could not insert default Block. Default block tool is not defined in the configuration.");return this.insert({tool:o,index:e,needToFocus:t})}insertAtEnd(){return this.currentBlockIndex=this.blocks.length-1,this.insert()}async mergeBlocks(e,t){const o=async s=>{await e.mergeWith(s),await this.removeBlock(t),this.currentBlockIndex=this.blocksStore.indexOf(e)},n=e.name===t.name&&e.mergeable,i=n?await t.data:void 0;if(n&&le(i)){console.error("Could not merge Block. Failed to extract original Block data.");return}if(n&&i!==void 0){const[s]=ys([{data:i,tool:t.name}],e.tool.sanitizeConfig,this.config.sanitizer);await o(s.data);return}if(e.mergeable&&_o(t,"export")&&_o(e,"import")){const s=await t.exportDataAsString(),a=Ge(s,e.tool.sanitizeConfig),l=mu(a,e.tool.conversionConfig);await o(l)}}removeBlock(e,t=!0){return new Promise(o=>{const n=this.blocksStore.indexOf(e);if(!this.validateIndex(n))throw new Error("Can't find a Block to remove");this.blocksStore.remove(n),e.destroy(),this.blockDidMutated(sh,e,{index:n}),this.currentBlockIndex>=n&&this.currentBlockIndex--;const i=this.blocks.length===0;i&&this.unsetCurrentBlock(),i&&t&&this.insert(),!i&&n===0&&(this.currentBlockIndex=0),o()})}removeSelectedBlocks(){const e=this.blocks.map((t,o)=>({block:t,index:o})).filter(({block:t})=>t.selected).sort((t,o)=>o.index-t.index);return e.forEach(({block:t})=>{this.removeBlock(t,!1)}),e.length>0?e[e.length-1].index:void 0}removeAllBlocks(){const e=n=>{n<0||(this.blocksStore.remove(n),e(n-1))};e(this.blocksStore.length-1),this.unsetCurrentBlock(),this.insert();const t=this.currentBlock,o=t==null?void 0:t.firstInput;o!==void 0&&o.focus()}split(){const e=this.Blok.Caret.extractFragmentFromCaretPosition(),t=v.make("div");t.appendChild(e);const o={text:v.isEmpty(t)?"":t.innerHTML};return this.insert({data:o})}getBlockByIndex(e){const t=e===-1?this.blocksStore.length-1:e;return this.blocksStore[t]}getBlockIndex(e){return this.blocksStore.indexOf(e)}getBlockById(e){return this.blocksStore.array.find(t=>t.id===e)}getBlock(e){const t=v.isElement(e)?e:e.parentNode;if(!t)return;const o=this.blocksStore.nodes,n=t.closest(cs);if(!n)return;const i=o.indexOf(n);if(i>=0)return this.blocksStore[i]}setCurrentBlockByChildNode(e){const t=v.isElement(e)?e:e.parentNode;if(!t)return;const o=t.closest(cs);if(!o)return;const n=o.closest(Ee);if(!(n==null?void 0:n.isEqualNode(this.Blok.UI.nodes.wrapper))||!(o instanceof HTMLElement))return;this.currentBlockIndex=this.blocksStore.nodes.indexOf(o);const s=this.currentBlock;return s==null||s.updateCurrentInput(),s}getBlockByChildNode(e){if(!(e instanceof Node))return;const t=v.isElement(e)?e:e.parentNode;if(!t)return;const o=t.closest(cs);if(o)return this.blocks.find(n=>n.holder===o)}move(e,t=this.currentBlockIndex,o=!1){if(isNaN(e)||isNaN(t)){j("Warning during 'move' call: incorrect indices provided.","warn");return}if(!this.validateIndex(e)||!this.validateIndex(t)){j("Warning during 'move' call: indices cannot be lower than 0 or greater than the amount of blocks.","warn");return}this.blocksStore.move(e,t,o),this.currentBlockIndex=e;const n=this.currentBlock;if(n===void 0)throw new Error(`Could not move Block. Block at index ${e} is not available.`);this.blockDidMutated(gv,n,{fromIndex:t,toIndex:e})}async convert(e,t,o){const n=await e.save();if(!n||n.data===void 0)throw new Error("Could not convert Block. Failed to extract original Block data.");const i=this.Blok.Tools.blockTools.get(t);if(!i)throw new Error(`Could not convert Block. Tool «${t}» not found.`);const s=await e.exportDataAsString(),a=Ge(s,xs(this.config.sanitizer,i.sanitizeConfig)),l=mu(a,i.conversionConfig,i.settings),c=o?Object.assign(l,o):l;return this.replace(e,i.name,c)}unsetCurrentBlock(){this.currentBlockIndex=-1}async clear(e=!1){const t=new lh;[...this.blocks].forEach(n=>{t.add(async()=>{await this.removeBlock(n,!1)})}),await t.completed,this.unsetCurrentBlock(),e&&this.insert(),this.Blok.UI.checkEmptiness()}async destroy(){this.sortable&&(this.sortable.destroy(),this.sortable=null),await Promise.all(this.blocks.map(e=>e.destroy()))}bindBlockEvents(e){const{BlockEvents:t}=this.Blok;this.readOnlyMutableListeners.on(e.holder,"keydown",o=>{o instanceof KeyboardEvent&&t.keydown(o)}),this.readOnlyMutableListeners.on(e.holder,"keyup",o=>{o instanceof KeyboardEvent&&t.keyup(o)}),e.on("didMutated",o=>this.blockDidMutated(ah,o,{index:this.getBlockIndex(o)}))}disableModuleBindings(){this.readOnlyMutableListeners.clearAll()}enableModuleBindings(){this.readOnlyMutableListeners.on(document,"cut",e=>{this.Blok.BlockEvents.handleCommandX(e)}),this.blocks.forEach(e=>{this.bindBlockEvents(e)})}validateIndex(e){return!(e<0||e>=this.blocksStore.length)}blockDidMutated(e,t,o){const n=K({target:new Ye(t)},o),i=new CustomEvent(e,{detail:K({},n)});return Object.prototype.propertyIsEnumerable.call(i,"type")||Object.defineProperty(i,"type",{value:e,enumerable:!0,configurable:!0}),Object.prototype.propertyIsEnumerable.call(i,"detail")||Object.defineProperty(i,"detail",{value:n,enumerable:!0,configurable:!0}),this.eventsDispatcher.emit(gs,{event:i}),t}}class bv extends z{constructor(){super(...arguments),this.anyBlockSelectedCache=null,this.needToSelectAll=!1,this.nativeInputSelected=!1,this.readyToBlockSelection=!1,this.selection=new O}get sanitizerConfig(){const e={p:{},h1:{},h2:{},h3:{},h4:{},h5:{},h6:{},ol:{},ul:{},li:{},br:!0,img:{src:!0,width:!0,height:!0},a:{href:!0},b:{},i:{},u:{}};return xs(this.config.sanitizer,e)}get allBlocksSelected(){const{BlockManager:e}=this.Blok;return e.blocks.every(t=>t.selected===!0)}set allBlocksSelected(e){const{BlockManager:t}=this.Blok;for(const o of t.blocks)o.selected=e;this.clearCache()}get anyBlockSelected(){const{BlockManager:e}=this.Blok;return this.anyBlockSelectedCache===null&&(this.anyBlockSelectedCache=e.blocks.some(t=>t.selected===!0)),this.anyBlockSelectedCache}get selectedBlocks(){return this.Blok.BlockManager.blocks.filter(e=>e.selected)}prepare(){this.selection=new O,ze.add({name:"CMD+A",handler:e=>{const{BlockManager:t,ReadOnly:o}=this.Blok;if(o.isEnabled){e.preventDefault(),this.selectAllBlocks();return}t.currentBlock&&this.handleCommandA(e)},on:this.Blok.UI.nodes.redactor})}toggleReadOnly(){const e=O.get();e==null||e.removeAllRanges(),this.allBlocksSelected=!1}unSelectBlockByIndex(e){const{BlockManager:t}=this.Blok,o=typeof e=="number"?t.getBlockByIndex(e):t.currentBlock;o&&(o.selected=!1,this.clearCache())}clearSelection(e,t=!1){const{RectangleSelection:o}=this.Blok;this.needToSelectAll=!1,this.nativeInputSelected=!1,this.readyToBlockSelection=!1;const n=e&&e instanceof KeyboardEvent,i=e,s=n&&i.key&&i.key.length===1;if(this.anyBlockSelected&&n&&s&&!O.isSelectionExists&&this.replaceSelectedBlocksWithPrintableKey(e),this.Blok.CrossBlockSelection.clear(e),t&&this.selection.restore(),!this.anyBlockSelected||o.isRectActivated()){this.Blok.RectangleSelection.clearSelection();return}this.allBlocksSelected=!1}async copySelectedBlocks(e){e.preventDefault();const t=e.clipboardData;if(!t)return;const o=v.make("div"),n=[];this.selectedBlocks.forEach(a=>{var p;const l=Ge(a.holder.innerHTML,this.sanitizerConfig),c=v.make("div");c.innerHTML=l;const d=(p=c.textContent)!=null?p:"";if(n.push(d),!Array.from(c.childNodes).some(f=>f.nodeType===Node.ELEMENT_NODE)&&d.trim().length>0){const f=v.make("p");f.innerHTML=c.innerHTML,o.appendChild(f)}else for(;c.firstChild;)o.appendChild(c.firstChild)});const i=n.join(`
165
-
166
- `),s=o.innerHTML;t.setData("text/plain",i),t.setData("text/html",s);try{const a=await Promise.all(this.selectedBlocks.map(l=>l.save()));t.setData(this.Blok.Paste.MIME_TYPE,JSON.stringify(a))}catch(a){}}selectBlockByIndex(e){const{BlockManager:t}=this.Blok,o=t.getBlockByIndex(e);o!==void 0&&this.selectBlock(o)}selectBlock(e){this.selection.save();const t=O.get();t==null||t.removeAllRanges();const o=e;o.selected=!0,this.clearCache(),this.Blok.InlineToolbar.close()}unselectBlock(e){const t=e;t.selected=!1,this.clearCache()}clearCache(){this.anyBlockSelectedCache=null}destroy(){ze.remove(this.Blok.UI.nodes.redactor,"CMD+A")}handleCommandA(e){if(this.Blok.RectangleSelection.clearSelection(),v.isNativeInput(e.target)&&!this.readyToBlockSelection){this.readyToBlockSelection=!0;return}const t=this.Blok.BlockManager.getBlock(e.target);if(!t)return;const o=t.inputs;if(o.length>1&&!this.readyToBlockSelection){this.readyToBlockSelection=!0;return}if(o.length===1&&!this.needToSelectAll){this.needToSelectAll=!0;return}if(this.needToSelectAll){e.preventDefault(),this.selectAllBlocks(),this.needToSelectAll=!1,this.readyToBlockSelection=!1;return}this.readyToBlockSelection&&(e.preventDefault(),this.selectBlock(t),this.needToSelectAll=!0)}selectAllBlocks(){this.selection.save();const e=O.get();e==null||e.removeAllRanges(),this.allBlocksSelected=!0,this.Blok.InlineToolbar.close()}replaceSelectedBlocksWithPrintableKey(e){const{BlockManager:t,Caret:o}=this.Blok,n=t.removeSelectedBlocks();if(n===void 0)return;t.insertDefaultBlockAtIndex(n,!0);const i=t.currentBlock;i&&o.setToBlock(i),Ao(()=>{const s=e.key;o.insertContentAtCaretPosition(s.length>1?"":s)},20)()}}const vv=127,ch=r=>{for(const e of r){if(e.trim().length===0)continue;if(e>="0"&&e<="9"||e.toLowerCase()!==e.toUpperCase())return!1;const t=e.codePointAt(0);if(typeof t=="number"&&t>vv)return!1}return!0},dh=r=>{var e;return r.nodeType===Node.TEXT_NODE?[r]:(e=r.hasChildNodes)!=null&&e.call(r)?Array.from(r.childNodes).flatMap(t=>dh(t)):[]},kv=r=>{var n,i;const e=dh(r);if(e.length===0)return null;const t=e[e.length-1],o=(n=[...e].reverse().find(s=>{var a;return!ch((a=s.textContent)!=null?a:"")}))!=null?n:null;return o&&o!==t&&ch((i=t.textContent)!=null?i:"")&&o.parentNode!==r?o:t};class ra extends z{get positions(){return{START:"start",END:"end",DEFAULT:"default"}}static get DATA_ATTR(){return{shadowCaret:"data-blok-shadow-caret"}}setToBlock(e,t=this.positions.DEFAULT,o=0){var u;const{BlockManager:n,BlockSelection:i}=this.Blok;if(i.clearSelection(),!e.focusable){(u=window.getSelection())==null||u.removeAllRanges(),i.selectBlock(e),n.currentBlock=e;return}const a=t===this.positions.START?e.firstInput:t===this.positions.END?e.lastInput:e.currentInput;if(!a)return;const l=h=>{if(t===this.positions.START)return{node:v.getDeepestNode(h,!1),offset:0};if(t===this.positions.END)return this.resolveEndPositionNode(h);const{node:p,offset:f}=v.getNodeByOffset(h,o);return p?{node:p,offset:f}:{node:v.getDeepestNode(h,!1),offset:0}},{node:c,offset:d}=l(a);c&&(this.set(c,d),n.setCurrentBlockByChildNode(e.holder),n.currentBlock.currentInput=a)}resolveEndPositionNode(e){const t=v.getDeepestNode(e,!0);if(t instanceof HTMLElement&&v.isNativeInput(t))return{node:t,offset:v.getContentLength(t)};const o=kv(e);return o?{node:o,offset:v.getContentLength(o)}:t?{node:t,offset:v.getContentLength(t)}:{node:null,offset:0}}setToInput(e,t=this.positions.DEFAULT,o=0){const{currentBlock:n}=this.Blok.BlockManager;this.setCaretToInputPosition(e,t,o),n&&(n.currentInput=e)}setCaretToInputPosition(e,t,o){if(t===this.positions.START){this.setCaretToStart(e);return}if(t===this.positions.END){this.setCaretToEnd(e);return}this.setCaretToOffset(e,o)}setCaretToStart(e){const t=v.getDeepestNode(e,!1);t&&this.set(t,0)}setCaretToEnd(e){const t=v.getDeepestNode(e,!0);t&&this.set(t,v.getContentLength(t))}setCaretToOffset(e,t){const{node:o,offset:n}=v.getNodeByOffset(e,t);if(o){this.set(o,n);return}this.setCaretToEnd(e)}set(e,t=0){const{top:n,bottom:i}=O.setCursor(e,t),{innerHeight:s}=window;if(n<0){window.scrollBy(0,n-30);return}i>s&&window.scrollBy(0,i-s+30)}setToTheLastBlock(){const e=this.Blok.BlockManager.lastBlock;if(e)if(e.tool.isDefault&&e.isEmpty)this.setToBlock(e);else{const t=this.Blok.BlockManager.insertAtEnd();this.setToBlock(t)}}extractFragmentFromCaretPosition(){var s;const e=O.get();if(!e||!e.rangeCount)return;const t=e.getRangeAt(0),o=this.Blok.BlockManager.currentBlock;if(!o)return;const n=o.currentInput;if(t.deleteContents(),!n)return;if(v.isNativeInput(n)){const a=n,l=document.createDocumentFragment(),c=(s=a.selectionStart)!=null?s:0,d=a.value.substring(0,c),u=a.value.substring(c);return l.textContent=u,a.value=d,l}const i=t.cloneRange();return i.selectNodeContents(n),i.setStart(t.endContainer,t.endOffset),i.extractContents()}navigateNext(e=!1){const{BlockManager:t}=this.Blok,{currentBlock:o,nextBlock:n}=t;if(o===void 0)return!1;const{nextInput:i,currentInput:s}=o,a=s!==void 0?jo(s):void 0,l=e||a||!o.focusable;if(i&&l)return this.setToInput(i,this.positions.START),!0;const d=n!==null?n:o.tool.isDefault||!l?null:t.insertAtEnd();return d!==null&&l?(this.setToBlock(d,this.positions.START),!0):!1}navigatePrevious(e=!1){const{currentBlock:t,previousBlock:o}=this.Blok.BlockManager;if(!t)return!1;const{previousInput:n,currentInput:i}=t,s=i!==void 0?zo(i):void 0,a=e||s||!t.focusable;return n&&a?(this.setToInput(n,this.positions.END),!0):o!==null&&a?(this.setToBlock(o,this.positions.END),!0):!1}createShadow(e){const t=document.createElement("span");t.setAttribute(ra.DATA_ATTR.shadowCaret,""),t.setAttribute("data-blok-testid","shadow-caret"),e.insertAdjacentElement("beforeend",t)}restoreCaret(e){const t=e.querySelector('[data-blok-testid="shadow-caret"]');if(!t)return;new O().expandToTag(t);const n=document.createRange();n.selectNode(t),n.extractContents()}insertContentAtCaretPosition(e){const t=document.createDocumentFragment(),o=document.createElement("div"),n=O.get(),i=O.range;if(!n||!i)return;o.innerHTML=e,Array.from(o.childNodes).forEach(c=>t.appendChild(c)),t.childNodes.length===0&&t.appendChild(new Text);const s=t.lastChild;i.deleteContents(),i.insertNode(t);const a=document.createRange(),l=s.nodeType===Node.TEXT_NODE?s:s.firstChild;l!==null&&l.textContent!==null&&a.setStart(l,l.textContent.length),n.removeAllRanges(),n.addRange(a)}}class yv extends z{constructor(){super(...arguments),this.firstSelectedBlock=null,this.lastSelectedBlock=null,this.onMouseUp=()=>{this.listeners.off(document,"mouseover",this.onMouseOver),this.listeners.off(document,"mouseup",this.onMouseUp)},this.onMouseOver=e=>{var a;const t=e,{BlockManager:o,BlockSelection:n}=this.Blok;if(t.relatedTarget===null&&t.target===null)return;const i=o.getBlockByChildNode(t.relatedTarget)||this.lastSelectedBlock,s=o.getBlockByChildNode(t.target);if(!(!i||!s)&&s!==i){if(this.firstSelectedBlock&&i===this.firstSelectedBlock){(a=O.get())==null||a.removeAllRanges(),i.selected=!0,s.selected=!0,n.clearCache();return}if(this.firstSelectedBlock&&s===this.firstSelectedBlock){i.selected=!1,s.selected=!1,n.clearCache();return}this.Blok.InlineToolbar.close(),this.toggleBlocksSelectedState(i,s),this.lastSelectedBlock=s}}}async prepare(){this.listeners.on(document,"mousedown",e=>{this.enableCrossBlockSelection(e)})}watchSelection(e){if(e.button!==jp.LEFT)return;const{BlockManager:t}=this.Blok,o=t.getBlock(e.target);o&&(this.firstSelectedBlock=o,this.lastSelectedBlock=o,this.listeners.on(document,"mouseover",this.onMouseOver),this.listeners.on(document,"mouseup",this.onMouseUp))}get isCrossBlockSelectionStarted(){return!!this.firstSelectedBlock&&!!this.lastSelectedBlock&&this.firstSelectedBlock!==this.lastSelectedBlock}toggleBlockSelectedState(e=!0){var a;const{BlockManager:t,BlockSelection:o}=this.Blok,n=t.currentBlock;if(!this.lastSelectedBlock&&!n||(!this.lastSelectedBlock&&n&&(this.lastSelectedBlock=this.firstSelectedBlock=n),this.firstSelectedBlock===this.lastSelectedBlock&&this.firstSelectedBlock&&(this.firstSelectedBlock.selected=!0,o.clearCache(),(a=O.get())==null||a.removeAllRanges(),this.Blok.Toolbar.close()),!this.lastSelectedBlock))return;const i=t.blocks.indexOf(this.lastSelectedBlock)+(e?1:-1),s=t.blocks[i];s&&(this.lastSelectedBlock.selected!==s.selected?(s.selected=!0,o.clearCache(),this.Blok.Toolbar.close()):(this.lastSelectedBlock.selected=!1,o.clearCache(),this.Blok.Toolbar.close()),this.lastSelectedBlock=s,this.Blok.InlineToolbar.close(),s.holder.scrollIntoView({block:"nearest"}))}clear(e){const{BlockManager:t,BlockSelection:o,Caret:n}=this.Blok;if(!this.firstSelectedBlock||!this.lastSelectedBlock)return;const i=t.blocks.indexOf(this.firstSelectedBlock),s=t.blocks.indexOf(this.lastSelectedBlock);if(!o.anyBlockSelected||i===-1||s===-1){this.firstSelectedBlock=this.lastSelectedBlock=null;return}if(e&&e instanceof KeyboardEvent)switch(e.key){case"ArrowDown":case"ArrowRight":n.setToBlock(t.blocks[Math.max(i,s)],n.positions.END);break;case"ArrowUp":case"ArrowLeft":n.setToBlock(t.blocks[Math.min(i,s)],n.positions.START);break;default:n.setToBlock(t.blocks[Math.max(i,s)],n.positions.END)}this.firstSelectedBlock=this.lastSelectedBlock=null}enableCrossBlockSelection(e){const{UI:t}=this.Blok;O.isCollapsed||this.Blok.BlockSelection.clearSelection(e),t.nodes.redactor.contains(e.target)?this.watchSelection(e):this.Blok.BlockSelection.clearSelection(e)}toggleBlocksSelectedState(e,t){const{BlockManager:o,BlockSelection:n}=this.Blok,i=o.blocks.indexOf(e),s=o.blocks.indexOf(t),a=e.selected!==t.selected,l=Math.min(i,s),c=Math.max(i,s);for(const d of Array.from({length:c-l+1},(u,h)=>l+h)){const u=o.blocks[d];u!==this.firstSelectedBlock&&u!==(a?e:t)&&(o.blocks[d].selected=!o.blocks[d].selected,n.clearCache())}this.Blok.Toolbar.close()}}class wv extends z{constructor({config:e,eventsDispatcher:t}){super({config:e,eventsDispatcher:t}),this.disabled=!1,this.batchingTimeout=null,this.batchingOnChangeQueue=new Map,this.batchTime=jg,this.mutationObserver=new MutationObserver(o=>{this.redactorChanged(o)}),this.eventsDispatcher.on(gs,o=>{this.particularBlockChanged(o.event)}),this.eventsDispatcher.on(uu,()=>{this.disable()}),this.eventsDispatcher.on(hu,()=>{this.enable()})}enable(){this.mutationObserver.observe(this.Blok.UI.nodes.redactor,{childList:!0,subtree:!0,characterData:!0,attributes:!0}),this.disabled=!1}disable(){this.mutationObserver.disconnect(),this.disabled=!0}particularBlockChanged(e){this.disabled||!V(this.config.onChange)||(this.batchingOnChangeQueue.set(`block:${e.detail.target.id}:event:${e.type}`,e),this.batchingTimeout&&clearTimeout(this.batchingTimeout),this.batchingTimeout=setTimeout(()=>{const t=Array.from(this.batchingOnChangeQueue.values());if(t.length===0)return;const o=t.length===1?t[0]:t;this.config.onChange&&this.config.onChange(this.Blok.API.methods,o),this.batchingOnChangeQueue.clear()},this.batchTime))}redactorChanged(e){this.eventsDispatcher.emit(ps,{mutations:e})}}const uh=new Set(["table","thead","tbody","tfoot","tr","th","td","caption","colgroup","col","ul","ol","li","dl","dt","dd"]),an=class an extends z{constructor(){super(...arguments),this.MIME_TYPE="application/x-blok",this.toolsTags={},this.tagsByTool={},this.toolsPatterns=[],this.toolsFiles={},this.exceptionList=[],this.handlePasteEventWrapper=e=>{this.handlePasteEvent(e)},this.processTool=e=>{try{if(e.pasteConfig===!1){this.exceptionList.push(e.name);return}if(!e.hasOnPasteHandler)return;this.getTagsConfig(e),this.getFilesConfig(e),this.getPatternsConfig(e)}catch(t){j(`Paste handling for «${e.name}» Tool hasn't been set up because of the error`,"warn",t)}},this.handlePasteEvent=async e=>{const{BlockManager:t,Toolbar:o}=this.Blok,n=t.setCurrentBlockByChildNode(e.target);!n||e.target&&this.isNativeBehaviour(e.target)&&e.clipboardData&&!e.clipboardData.types.includes("Files")||this.exceptionList.includes(n.name)||(e.preventDefault(),e.clipboardData&&await this.processDataTransfer(e.clipboardData),o.close())}}async prepare(){this.processTools()}shouldReplaceCurrentBlockForFile(e){const{BlockManager:t}=this.Blok,o=t.currentBlock;return o?e&&o.name===e?!0:!!o.tool.isDefault&&o.isEmpty:!1}getStructuralTagsSanitizeConfig(e){var n;const t={},o=[e];for(;o.length>0;){const i=o.pop();if(!i)continue;const s=i.tagName.toLowerCase();uh.has(s)&&(t[s]=(n=t[s])!=null?n:{}),o.push(...Array.from(i.children))}return t}toggleReadOnly(e){e?this.unsetCallback():this.setCallback()}containsFiles(e){var o;if(Array.from(e.types).includes("Files")||(o=e.files)!=null&&o.length)return!0;try{const n=e.types;if(typeof(n==null?void 0:n.contains)=="function"&&n.contains("Files"))return!0}catch(n){}return!1}async processDataTransfer(e){const{Tools:t}=this.Blok;if(this.containsFiles(e)&&!le(this.toolsFiles)){await this.processFiles(e.files);return}const n=e.getData(this.MIME_TYPE),i=e.getData("text/plain"),a=e.getData("text/html");if(n)try{this.insertBlokData(JSON.parse(n));return}catch(f){}const l=Object.fromEntries(Object.keys(this.toolsTags).map(f=>{var g;return[f.toLowerCase(),(g=this.toolsTags[f].sanitizationConfig)!=null?g:{}]})),c=t.getAllInlineToolsSanitizeConfig(),d=xs(this.config.sanitizer,l,c,{br:{}}),u=Ge(a,d),h=v.isHTMLString(u);!u.trim()||u.trim()===i||!h?await this.processText(i):await this.processText(u,!0)}async processText(e,t=!1){var a,l;const{Caret:o,BlockManager:n}=this.Blok,i=t?this.processHTML(e):this.processPlain(e);if(!i.length)return;if(i.length>1){const d=!!((a=n.currentBlock)!=null&&a.tool.isDefault)&&!!((l=n.currentBlock)!=null&&l.isEmpty);for(const[u,h]of i.entries())await this.insertBlock(h,u===0&&d);n.currentBlock&&o.setToBlock(n.currentBlock,o.positions.END);return}const[s]=i;if(s.isBlock){await this.processSingleBlock(s);return}await this.processInlinePaste(s)}setCallback(){this.listeners.on(this.Blok.UI.nodes.holder,"paste",this.handlePasteEventWrapper)}unsetCallback(){this.listeners.off(this.Blok.UI.nodes.holder,"paste",this.handlePasteEventWrapper)}processTools(){const e=this.Blok.Tools.blockTools;Array.from(e.values()).forEach(this.processTool)}collectTagNames(e){return qe(e)?[e]:Z(e)?Object.keys(e):[]}getTagsConfig(e){if(e.pasteConfig===!1)return;const t=e.pasteConfig.tags||[],o=[];t.forEach(n=>{const i=this.collectTagNames(n);o.push(...i),i.forEach(s=>{if(Object.prototype.hasOwnProperty.call(this.toolsTags,s)){j(`Paste handler for «${e.name}» Tool on «${s}» tag is skipped because it is already used by «${this.toolsTags[s].tool.name}» Tool.`,"warn");return}const a=Z(n)?n[s]:void 0;this.toolsTags[s.toUpperCase()]={tool:e,sanitizationConfig:a}})}),this.tagsByTool[e.name]=o.map(n=>n.toUpperCase())}getFilesConfig(e){if(e.pasteConfig===!1)return;const{files:t={}}=e.pasteConfig,{extensions:o,mimeTypes:n}=t;if(!o&&!n)return;const i=o==null?[]:Array.isArray(o)?o:(j(`«extensions» property of the paste config for «${e.name}» Tool should be an array`),[]),s=n==null?[]:Array.isArray(n)?n.filter(a=>Vp(a)?!0:(j(`MIME type value «${a}» for the «${e.name}» Tool is not a valid MIME type`,"warn"),!1)):(j(`«mimeTypes» property of the paste config for «${e.name}» Tool should be an array`),[]);this.toolsFiles[e.name]={extensions:i,mimeTypes:s}}getPatternsConfig(e){e.pasteConfig===!1||!e.pasteConfig.patterns||le(e.pasteConfig.patterns)||Object.entries(e.pasteConfig.patterns).forEach(([t,o])=>{o instanceof RegExp||j(`Pattern ${o} for «${e.name}» Tool is skipped because it should be a Regexp instance.`,"warn"),this.toolsPatterns.push({key:t,pattern:o,tool:e})})}isNativeBehaviour(e){return v.isNativeInput(e)}async processFiles(e){var s;const{BlockManager:t}=this.Blok,n=(await Promise.all(Array.from(e).map(a=>this.processFile(a)))).filter(a=>a!=null);if(n.length===0)return;const i=this.shouldReplaceCurrentBlockForFile((s=n[0])==null?void 0:s.type);for(const[a,l]of n.entries())await t.paste(l.type,l.event,a===0&&i)}async processFile(e){const t=$p(e),o=Object.entries(this.toolsFiles).find(([s,{mimeTypes:a,extensions:l}])=>{const[c,d]=e.type.split("/"),u=l.find(p=>p.toLowerCase()===t.toLowerCase()),h=a.find(p=>{const[f,g]=p.split("/");return f===c&&(g===d||g==="*")});return u!==void 0||h!==void 0});if(!o)return;const[n]=o;return{event:this.composePasteEvent("file",{file:e}),type:n}}processHTML(e){const{Tools:t}=this.Blok,o=v.make("DIV");return o.innerHTML=e,this.getNodes(o).map(i=>{var b;const s=(()=>{var k;switch(i.nodeType){case Node.DOCUMENT_FRAGMENT_NODE:{const y=v.make("div");return y.appendChild(i),{content:y,tool:t.defaultTool,isBlock:!1}}case Node.ELEMENT_NODE:{const y=i,x=this.toolsTags[y.tagName];return{content:y,tool:(k=x==null?void 0:x.tool)!=null?k:t.defaultTool,isBlock:!0}}default:return null}})();if(!s)return null;const{content:a,tool:l,isBlock:c}=s,u=(l.pasteConfig===!1?[]:((b=l.pasteConfig)==null?void 0:b.tags)||[]).reduce((k,y)=>{const x=this.collectTagNames(y),T=K({},k);return x.forEach(R=>{const C=Z(y)?y[R]:null;T[R.toLowerCase()]=C!=null?C:{}}),T},{}),h=this.getStructuralTagsSanitizeConfig(a),p=Object.assign({},h,u,l.baseSanitizeConfig),f=(()=>{if(a.tagName.toLowerCase()!=="table")return a.innerHTML=Ge(a.innerHTML,p),a;const k=Ge(a.outerHTML,p),x=v.make("div",void 0,{innerHTML:k}).firstChild;return!x||!(x instanceof HTMLElement)?null:x})();if(!f)return null;const g=this.composePasteEvent("tag",{data:f});return{content:f,isBlock:c,tool:l.name,event:g}}).filter(i=>{if(!i)return!1;const s=v.isEmpty(i.content),a=v.isSingleTag(i.content);return!s||a})}processPlain(e){const{defaultBlock:t}=this.config;if(!e)return[];const o=t;return e.split(/\r?\n/).filter(n=>n.trim()).map(n=>{const i=v.make("div");i.textContent=n;const s=this.composePasteEvent("tag",{data:i});return{content:i,tool:o,isBlock:!1,event:s}})}async processSingleBlock(e){const{Caret:t,BlockManager:o}=this.Blok,{currentBlock:n}=o;if(!n||e.tool!==n.name||!v.containsOnlyInlineElements(e.content.innerHTML)){await this.insertBlock(e,n?n.tool.isDefault&&n.isEmpty:!1);return}t.insertContentAtCaretPosition(e.content.innerHTML)}async processInlinePaste(e){var c,d;const{BlockManager:t,Caret:o}=this.Blok,{content:n}=e,i=(d=(c=t.currentBlock)==null?void 0:c.tool.isDefault)!=null?d:!1,s=n.textContent,l=i&&s!==null&&s.length<an.PATTERN_PROCESSING_MAX_LENGTH&&s!==null?await this.processPattern(s):void 0;if(l){const u=t.currentBlock&&t.currentBlock.tool.isDefault&&t.currentBlock.isEmpty,h=await t.paste(l.tool,l.event,u);o.setToBlock(h,o.positions.END);return}if(t.currentBlock&&t.currentBlock.currentInput){const u=t.currentBlock.tool.baseSanitizeConfig;o.insertContentAtCaretPosition(Ge(n.innerHTML,u))}else await this.insertBlock(e)}async processPattern(e){const t=this.toolsPatterns.find(n=>{const i=n.pattern.exec(e);return i?e===i.shift():!1});return t?{event:this.composePasteEvent("pattern",{key:t.key,data:e}),tool:t.tool.name}:void 0}async insertBlock(e,t=!1){const{BlockManager:o,Caret:n}=this.Blok,{currentBlock:i}=o;if(t&&i&&i.isEmpty){const a=await o.paste(e.tool,e.event,!0);n.setToBlock(a,n.positions.END);return}const s=await o.paste(e.tool,e.event);n.setToBlock(s,n.positions.END)}insertBlokData(e){const{BlockManager:t,Caret:o,Tools:n}=this.Blok;ys(e,s=>{var a,l;return(l=(a=n.blockTools.get(s))==null?void 0:a.sanitizeConfig)!=null?l:{}},this.config.sanitizer).forEach(({tool:s,data:a},l)=>{var u,h;const c=l===0&&!!((u=t.currentBlock)!=null&&u.tool.isDefault)&&!!((h=t.currentBlock)!=null&&h.isEmpty),d=t.insert({tool:s,data:a,replace:c});o.setToBlock(d,o.positions.END)})}processElementNode(e,t,o){var f,g;const n=Object.keys(this.toolsTags),i=e,s=this.toolsTags[i.tagName],a=s==null?void 0:s.tool,l=(g=this.tagsByTool[(f=a==null?void 0:a.name)!=null?f:""])!=null?g:[],c=n.includes(i.tagName),d=v.blockElements.includes(i.tagName.toLowerCase()),u=uh.has(i.tagName.toLowerCase()),h=Array.from(i.children).some(({tagName:b})=>n.includes(b)&&!l.includes(b)),p=Array.from(i.children).some(({tagName:b})=>v.blockElements.includes(b.toLowerCase()));if(!d&&!c&&!h)return o.appendChild(i),[...t,o];if(c&&!h||d&&!p&&!h||u&&!h)return[...t,o,i]}getNodes(e){const t=Array.from(e.childNodes),o=(n,i)=>{if(v.isEmpty(i)&&!v.isSingleTag(i))return n;const s=n[n.length-1],a=s!==void 0&&v.isFragment(s),{destNode:l,remainingNodes:c}=a?{destNode:s,remainingNodes:n.slice(0,-1)}:{destNode:new DocumentFragment,remainingNodes:n};if(i.nodeType===Node.TEXT_NODE)return l.appendChild(i),[...c,l];if(i.nodeType!==Node.ELEMENT_NODE)return[...c,l];const d=this.processElementNode(i,c,l);if(d)return d;const u=Array.from(i.childNodes).reduce(o,[]);return[...c,...u]};return t.reduce(o,[])}composePasteEvent(e,t){return new CustomEvent(e,{detail:t})}};an.PATTERN_PROCESSING_MAX_LENGTH=450;let ia=an;class Tv extends z{constructor(){super(...arguments),this.toolsDontSupportReadOnly=[],this.readOnlyEnabled=!1}get isEnabled(){return this.readOnlyEnabled}async prepare(){const{Tools:e}=this.Blok,{blockTools:t}=e,o=[];Array.from(t.entries()).forEach(([n,i])=>{i.isReadOnlySupported||o.push(n)}),this.toolsDontSupportReadOnly=o,this.config.readOnly===!0&&o.length>0&&this.throwCriticalError(),await this.toggle(this.config.readOnly,!0)}async toggle(e=!this.readOnlyEnabled,t=!1){e&&this.toolsDontSupportReadOnly.length>0&&this.throwCriticalError();const o=this.readOnlyEnabled;this.readOnlyEnabled=e;for(const i of Object.values(this.Blok))i!=null&&typeof i.toggleReadOnly=="function"&&i.toggleReadOnly(e);if(o===e)return this.readOnlyEnabled;if(t)return this.readOnlyEnabled;this.Blok.ModificationsObserver.disable();const n=await this.Blok.Saver.save();return n===void 0?(this.Blok.ModificationsObserver.enable(),this.readOnlyEnabled):(await this.Blok.BlockManager.clear(),await this.Blok.Renderer.render(n.blocks),this.Blok.ModificationsObserver.enable(),this.readOnlyEnabled)}throwCriticalError(){throw new Vt(`To enable read-only mode all connected tools should support it. Tools ${this.toolsDontSupportReadOnly.join(", ")} don't support read-only mode.`)}}class Bv extends z{constructor(){super(...arguments),this.isRectSelectionActivated=!1,this.SCROLL_SPEED=3,this.HEIGHT_OF_SCROLL_ZONE=40,this.BOTTOM_SCROLL_ZONE=1,this.TOP_SCROLL_ZONE=2,this.MAIN_MOUSE_BUTTON=0,this.mousedown=!1,this.isScrolling=!1,this.inScrollZone=null,this.startX=0,this.startY=0,this.mouseX=0,this.mouseY=0,this.stackOfSelected=[],this.rectCrossesBlocks=!1,this.overlayRectangle=null,this.listenerIds=[]}static get CSS(){return{overlay:"",overlayContainer:"",rect:"",topScrollZone:"",bottomScrollZone:""}}prepare(){this.enableModuleBindings()}startSelection(e,t){const o=this.getScrollLeft(),n=this.getScrollTop(),i=document.elementFromPoint(e-o,t-n);if(!i)return;i.closest(lu)||(this.Blok.BlockSelection.allBlocksSelected=!1,this.clearSelection(),this.stackOfSelected=[]);const a=[ds,lu,iu],l=i.closest(Ee),c=a.some(d=>!!i.closest(d));!l||c||(this.mousedown=!0,this.startX=e,this.startY=t)}endSelection(){this.mousedown=!1,this.startX=0,this.startY=0,this.overlayRectangle!==null&&(this.overlayRectangle.style.display="none")}isRectActivated(){return this.isRectSelectionActivated}clearSelection(){this.isRectSelectionActivated=!1}enableModuleBindings(){const{container:e}=this.genHTML();this.listeners.on(e,"mousedown",n=>{this.processMouseDown(n)},!1);const t=ts(n=>{n instanceof MouseEvent&&this.processMouseMove(n)},10);this.listeners.on(document.body,"mousemove",t,{passive:!0}),this.listeners.on(document.body,"mouseleave",()=>{this.processMouseLeave()});const o=ts(n=>{this.processScroll(n)},10);this.listeners.on(window,"scroll",o,{passive:!0}),this.listeners.on(document.body,"mouseup",()=>{this.processMouseUp()},!1)}processMouseDown(e){if(e.button!==this.MAIN_MOUSE_BUTTON)return;e.target.closest(v.allInputsSelector)!==null||this.startSelection(e.pageX,e.pageY)}processMouseMove(e){this.changingRectangle(e),this.scrollByZones(e.clientY)}processMouseLeave(){this.clearSelection(),this.endSelection()}processScroll(e){this.changingRectangle(e)}processMouseUp(){this.clearSelection(),this.endSelection()}scrollByZones(e){if(this.inScrollZone=null,e<=this.HEIGHT_OF_SCROLL_ZONE&&(this.inScrollZone=this.TOP_SCROLL_ZONE),document.documentElement.clientHeight-e<=this.HEIGHT_OF_SCROLL_ZONE&&(this.inScrollZone=this.BOTTOM_SCROLL_ZONE),!this.inScrollZone){this.isScrolling=!1;return}this.isScrolling||(this.scrollVertical(this.inScrollZone===this.TOP_SCROLL_ZONE?-this.SCROLL_SPEED:this.SCROLL_SPEED),this.isScrolling=!0)}genHTML(){const{UI:e}=this.Blok,t=e.nodes.holder.querySelector(Ee),o=v.make("div",["fixed","inset-0","z-overlay","pointer-events-none","overflow-hidden"],{}),n=v.make("div",["relative","pointer-events-auto","z-0"],{}),i=v.make("div",["absolute","pointer-events-none","bg-selection-highlight","border","border-transparent"],{});if(o.setAttribute(Jg,""),n.setAttribute(Qg,""),i.setAttribute(em,""),o.setAttribute("data-blok-testid","overlay"),i.setAttribute("data-blok-testid","overlay-rectangle"),!t)throw new Error("RectangleSelection: blok wrapper not found");return n.appendChild(i),o.appendChild(n),t.appendChild(o),this.overlayRectangle=i,{container:t,overlay:o}}scrollVertical(e){if(!(this.inScrollZone&&this.mousedown))return;const t=this.getScrollTop();window.scrollBy(0,e),this.mouseY+=this.getScrollTop()-t,setTimeout(()=>{this.scrollVertical(e)},0)}changingRectangle(e){if(!this.mousedown)return;const t=this.overlayRectangle;if(t===null)return;e.pageY!==void 0&&(this.mouseX=e.pageX,this.mouseY=e.pageY);const{rightPos:o,leftPos:n,index:i}=this.genInfoForMouseSelection(),s=this.startX>o&&this.mouseX>o,a=this.startX<n&&this.mouseX<n;if(this.rectCrossesBlocks=!(s||a),this.isRectSelectionActivated||(this.rectCrossesBlocks=!1,this.isRectSelectionActivated=!0,this.shrinkRectangleToPoint(),t.style.display="block"),this.updateRectangleSize(),this.Blok.Toolbar.close(),i===void 0)return;this.trySelectNextBlock(i),this.inverseSelection();const l=O.get();l&&l.removeAllRanges()}shrinkRectangleToPoint(){if(this.overlayRectangle===null)return;const e=this.getScrollLeft(),t=this.getScrollTop();this.overlayRectangle.style.left=`${this.startX-e}px`,this.overlayRectangle.style.top=`${this.startY-t}px`,this.overlayRectangle.style.bottom=`calc(100% - ${this.startY-t}px)`,this.overlayRectangle.style.right=`calc(100% - ${this.startX-e}px)`}inverseSelection(){if(this.stackOfSelected.length===0)return;const e=this.Blok.BlockManager.getBlockByIndex(this.stackOfSelected[0]);if(!e)return;const t=e.selected;if(this.rectCrossesBlocks&&!t)for(const o of this.stackOfSelected)this.Blok.BlockSelection.selectBlockByIndex(o);if(!this.rectCrossesBlocks&&t)for(const o of this.stackOfSelected)this.Blok.BlockSelection.unSelectBlockByIndex(o)}updateRectangleSize(){if(this.overlayRectangle===null)return;const e=this.getScrollLeft(),t=this.getScrollTop();this.mouseY>=this.startY?(this.overlayRectangle.style.top=`${this.startY-t}px`,this.overlayRectangle.style.bottom=`calc(100% - ${this.mouseY-t}px)`):(this.overlayRectangle.style.bottom=`calc(100% - ${this.startY-t}px)`,this.overlayRectangle.style.top=`${this.mouseY-t}px`),this.mouseX>=this.startX?(this.overlayRectangle.style.left=`${this.startX-e}px`,this.overlayRectangle.style.right=`calc(100% - ${this.mouseX-e}px)`):(this.overlayRectangle.style.right=`calc(100% - ${this.startX-e}px)`,this.overlayRectangle.style.left=`${this.mouseX-e}px`)}genInfoForMouseSelection(){var f;const t=document.body.offsetWidth/2,o=this.getScrollTop(),n=this.mouseY-o,i=document.elementFromPoint(t,n),s=(f=this.Blok.BlockManager.lastBlock)==null?void 0:f.holder,a=s==null?void 0:s.querySelector(ds),c=(a?Number.parseInt(window.getComputedStyle(a).width,10):0)/2,d=t-c,u=t+c;if(!i)return{index:void 0,leftPos:d,rightPos:u};const h=this.Blok.BlockManager.getBlockByChildNode(i);return{index:h!==void 0?this.Blok.BlockManager.blocks.findIndex(g=>g.holder===h.holder):void 0,leftPos:d,rightPos:u}}getScrollTop(){var e,t,o,n;return typeof window.scrollY=="number"?window.scrollY:(n=(o=(e=document.documentElement)==null?void 0:e.scrollTop)!=null?o:(t=document.body)==null?void 0:t.scrollTop)!=null?n:0}getScrollLeft(){var e,t,o,n;return typeof window.scrollX=="number"?window.scrollX:(n=(o=(e=document.documentElement)==null?void 0:e.scrollLeft)!=null?o:(t=document.body)==null?void 0:t.scrollLeft)!=null?n:0}addBlockInSelection(e){this.rectCrossesBlocks&&this.Blok.BlockSelection.selectBlockByIndex(e),this.stackOfSelected.push(e)}trySelectNextBlock(e){const t=this.stackOfSelected.length,o=this.stackOfSelected[t-1];if(o===e)return;const i=this.stackOfSelected[t-2],s=i!==void 0&&o!==void 0?o-i>0:!1,a=t<=1,l=o!==void 0&&e>o&&s,c=o!==void 0&&e<o&&t>1&&!s,u=!(l||c||a);if(!u&&(o===void 0||e>o)){const f=o!==void 0?o+1:e;Array.from({length:e-f+1},(g,b)=>f+b).forEach(g=>{this.addBlockInSelection(g)});return}if(!u&&o!==void 0&&e<o){Array.from({length:o-e},(f,g)=>o-1-g).forEach(f=>{this.addBlockInSelection(f)});return}if(!u)return;const h=f=>o===void 0?!1:e>o?e>f:e<f,p=[];for(const f of[...this.stackOfSelected].reverse()){if(!h(f))break;this.rectCrossesBlocks&&this.Blok.BlockSelection.unSelectBlockByIndex(f),p.push(f)}p.length>0&&this.stackOfSelected.splice(this.stackOfSelected.length-p.length,p.length)}}class xv extends z{render(e){return new Promise(t=>{const{Tools:o,BlockManager:n}=this.Blok;if(e.length===0)n.insert();else{const i=e.map(s=>{const{tunes:a,id:l}=s,c=s.type,d=o.available.has(c)?{tool:c,data:s.data}:(_e(`Tool «${c}» is not found. Check 'tools' property at the Blok config.`,"warn"),{tool:o.stubTool,data:this.composeStubDataForTool(c,s.data,l)});return((h,p)=>{try{return n.composeBlock({id:l,tool:h,data:p,tunes:a})}catch(f){j(`Block «${h}» skipped because of plugins error`,"error",{data:p,error:f});const g=this.composeStubDataForTool(h,p,l);return n.composeBlock({id:l,tool:o.stubTool,data:g,tunes:a})}})(d.tool,d.data)});n.insertMany(i)}window.requestIdleCallback(()=>{t()},{timeout:2e3})})}composeStubDataForTool(e,t,o){const{Tools:n}=this.Blok,i=(()=>{if(!n.unavailable.has(e))return e;const s=n.unavailable.get(e).toolbox;return s!==void 0&&s[0].title!==void 0?s[0].title:e})();return{savedData:{id:o,type:e,data:t},title:i}}}class Cv extends z{async save(){const{BlockManager:e,Tools:t}=this.Blok,o=e.blocks;if(o.length===1&&o[0].isEmpty)return{time:+new Date,blocks:[],version:Eo()};const n=o.map(i=>this.getSavedData(i));this.lastSaveError=void 0;try{const i=await Promise.all(n),s=this.sanitizeExtractedData(i,a=>{var l;return(l=t.blockTools.get(a))==null?void 0:l.sanitizeConfig},this.config.sanitizer);return this.makeOutput(s)}catch(i){this.lastSaveError=i;const s=i instanceof Error?i:new Error(String(i));_e("Saving failed due to the Error %o","error",s);return}}async getSavedData(e){const t=await e.save(),o=e.name,n=(t==null?void 0:t.data)!==void 0?t:this.getPreservedSavedData(e);if(n===void 0)return{tool:o,isValid:!1};const i=await e.validate(n.data);return Re(K({},n),{isValid:i})}makeOutput(e){const t=[];return e.forEach(({id:o,tool:n,data:i,tunes:s,isValid:a})=>{if(!a){j(`Block «${n}» skipped because saved data is invalid`);return}if(n===void 0||i===void 0){j("Block skipped because saved data is missing required fields");return}if(n===this.Blok.Tools.stubTool&&this.isStubSavedData(i)){t.push(i);return}if(n===this.Blok.Tools.stubTool){j("Stub block data is malformed and was skipped");return}const l=s===void 0||le(s),c=K({id:o,type:n,data:i},!l&&{tunes:s});t.push(c)}),{time:+new Date,blocks:t,version:Eo()}}sanitizeExtractedData(e,t,o){const n=[];if(e.forEach((a,l)=>{this.hasSanitizableData(a)&&n.push({index:l,data:a})}),n.length===0)return e;const i=ys(n.map(({data:a})=>a),t,o),s=e.map(a=>K({},a));return n.forEach(({index:a},l)=>{const c=i[l];s[a]=Re(K({},s[a]),{data:c.data})}),s}hasSanitizableData(e){return e.data!==void 0&&typeof e.tool=="string"}isStubSavedData(e){if(!Z(e))return!1;const t=e;return typeof t.type=="string"&&t.data!==void 0}getLastSaveError(){return this.lastSaveError}getPreservedSavedData(e){const t=e.preservedData;if(le(t))return;const o=e.preservedTunes;return Re(K({id:e.id,tool:e.name,data:t},le(o)?{}:{tunes:o}),{time:0})}}const Ev=r=>{const e=document.createElement("div");e.innerHTML=r.trim();const t=document.createDocumentFragment();return t.append(...Array.from(e.childNodes)),t},xt=class xt{static get DEFAULT_PLACEHOLDER(){return""}constructor({data:e,config:t,api:o,readOnly:n}){var i,s;this.api=o,this.readOnly=n,this.readOnly||(this.onKeyUp=this.onKeyUp.bind(this)),this._placeholder=(i=t==null?void 0:t.placeholder)!=null?i:xt.DEFAULT_PLACEHOLDER,this._data=e!=null?e:{text:""},this._element=null,this._preserveBlank=(s=t==null?void 0:t.preserveBlank)!=null?s:!1}onKeyUp(e){if(e.code!=="Backspace"&&e.code!=="Delete"||!this._element)return;const{textContent:t}=this._element;t===""&&(this._element.innerHTML="")}drawView(){const e=document.createElement("DIV");return e.className=$(this.api.styles.block,xt.WRAPPER_CLASSES,xt.PLACEHOLDER_CLASSES),e.setAttribute(us,"paragraph"),e.contentEditable="false",e.setAttribute("data-placeholder-active",this.api.i18n.t(this._placeholder)),this._data.text&&(e.innerHTML=this._data.text),this.readOnly||(e.contentEditable="true",e.addEventListener("keyup",this.onKeyUp)),e}render(){return this._element=this.drawView(),this._element}merge(e){if(!this._element)return;this._data.text+=e.text;const t=Ev(e.text);this._element.appendChild(t),this._element.normalize()}validate(e){return!(e.text.trim()===""&&!this._preserveBlank)}save(e){return{text:e.innerHTML}}onPaste(e){const t=e.detail;if(!("data"in t))return;const n={text:t.data.innerHTML};this._data=n,window.requestAnimationFrame(()=>{this._element&&(this._element.innerHTML=this._data.text||"")})}static get conversionConfig(){return{export:"text",import:"text"}}static get sanitize(){return{text:{br:!0}}}static get isReadOnlySupported(){return!0}static get pasteConfig(){return{tags:["P"]}}static get toolbox(){return{icon:Bb,title:"Text"}}};xt.WRAPPER_CLASSES=["leading-[1.6em]","outline-none","[&>p:first-of-type]:mt-0","[&>p:last-of-type]:mb-0"],xt.PLACEHOLDER_CLASSES=["empty:before:pointer-events-none","empty:before:text-gray-text","empty:before:cursor-text","empty:before:content-[attr(data-placeholder-active)]","[&[data-empty=true]]:before:pointer-events-none","[&[data-empty=true]]:before:text-gray-text","[&[data-empty=true]]:before:cursor-text","[&[data-empty=true]]:before:content-[attr(data-placeholder-active)]"];let sn=xt;const m=class m{static get sanitize(){return{strong:{},b:{}}}static normalizeAllBoldTags(){if(typeof document=="undefined")return;const e=`${ru} b, ${Ee} b`;document.querySelectorAll(e).forEach(t=>{m.ensureStrongElement(t)})}static normalizeBoldInNode(e){var n;const t=e.nodeType===Node.ELEMENT_NODE?e:e.parentElement;!t||typeof t.closest!="function"||!t.closest(`${ru}, ${Ee}`)||(t.tagName==="B"&&m.ensureStrongElement(t),(n=t.querySelectorAll)==null||n.call(t,"b").forEach(i=>{m.ensureStrongElement(i)}))}constructor(){typeof document!="undefined"&&(m.instances.add(this),m.initializeGlobalListeners())}static initializeGlobalListeners(){return typeof document=="undefined"?!1:(m.shortcutListenerRegistered||(document.addEventListener("keydown",m.handleShortcut,!0),m.shortcutListenerRegistered=!0),m.selectionListenerRegistered||(document.addEventListener("selectionchange",m.handleGlobalSelectionChange,!0),m.selectionListenerRegistered=!0),m.inputListenerRegistered||(document.addEventListener("input",m.handleGlobalInput,!0),m.inputListenerRegistered=!0),m.beforeInputListenerRegistered||(document.addEventListener("beforeinput",m.handleBeforeInput,!0),m.beforeInputListenerRegistered=!0),m.ensureMutationObserver(),!0)}static maintainCollapsedExitState(){var e,t,o,n,i;if(typeof document!="undefined")for(const s of Array.from(m.collapsedExitRecords)){const a=m.resolveBoundary(s);if(!a){m.collapsedExitRecords.delete(s);continue}s.boundary=a.boundary,s.boldElement=a.boldElement;const l=a.boundary,c=a.boldElement,d=s.allowedLength,u=(e=c.textContent)!=null?e:"";if(u.length>d){const C=u.slice(0,d),E=u.slice(d);c.textContent=C,l.textContent=((t=l.textContent)!=null?t:"")+E}const h=(o=l.textContent)!=null?o:"";h.length>1&&h.startsWith("​")&&(l.textContent=h.slice(1));const p=window.getSelection();m.ensureCaretAtBoundary(p,l),m.scheduleBoundaryCaretAdjustment(l);const f=(n=l.textContent)!=null?n:"",g=f.replace(/\u200B/g,""),b=g.match(/^\s+/),k=/\S/.test(g),y=f.startsWith("​");b&&(s.hasLeadingSpace=!0,s.leadingWhitespace=b[0]),k&&(s.hasTypedContent=!0);const x=/^\s/.test(g),T=s.hasTypedContent&&!y&&((i=c.textContent)!=null?i:"").length<=d,R=s.hasLeadingSpace&&s.hasTypedContent&&!x;if(T&&R){const C=f.replace(/^[\u200B\s]+/,""),E=s.leadingWhitespace||" ";l.textContent=`${E}${C}`,m.ensureCaretAtBoundary(p,l)}T&&m.collapsedExitRecords.delete(s)}}static ensureCaretAtBoundary(e,t){!e||!e.isCollapsed||m.setCaretToBoundaryEnd(e,t)}static scheduleBoundaryCaretAdjustment(e){m.pendingBoundaryCaretAdjustments.has(e)||(m.pendingBoundaryCaretAdjustments.add(e),setTimeout(()=>{var i,s,a;m.pendingBoundaryCaretAdjustments.delete(e);const t=(i=e.ownerDocument)!=null?i:typeof document!="undefined"?document:null;if(!t)return;const o=t.getSelection();if(!o||!o.isCollapsed||o.anchorNode!==e)return;const n=(a=(s=e.textContent)==null?void 0:s.length)!=null?a:0;o.anchorOffset!==n&&m.setCaret(o,e,n)},0))}static ensureTextNodeAfter(e){var s;const t=e.nextSibling;if((t==null?void 0:t.nodeType)===Node.TEXT_NODE)return t;const o=e.parentNode;if(!o)return null;const n=(s=e.ownerDocument)!=null?s:typeof document!="undefined"?document:null;if(!n)return null;const i=n.createTextNode("");return o.insertBefore(i,t),i}static resolveBoundary(e){if(!e.boldElement.isConnected)return null;const t=m.ensureStrongElement(e.boldElement),o=e.boundary,i=o.isConnected&&o.previousSibling===t?o:m.ensureTextNodeAfter(t);return i?{boundary:i,boldElement:t}:null}static setCaretToBoundaryEnd(e,t){var i,s;const o=document.createRange(),n=(s=(i=t.textContent)==null?void 0:i.length)!=null?s:0;o.setStart(t,n),o.collapse(!0),e.removeAllRanges(),e.addRange(o)}static hasBoldParent(e){return e?e.nodeType===Node.ELEMENT_NODE&&m.isBoldTag(e)?!0:m.hasBoldParent(e.parentNode):!1}static findBoldElement(e){return e?e.nodeType===Node.ELEMENT_NODE&&m.isBoldTag(e)?m.ensureStrongElement(e):m.findBoldElement(e.parentNode):null}static isBoldTag(e){const t=e.tagName;return t==="B"||t==="STRONG"}static ensureStrongElement(e){if(e.tagName==="STRONG")return e;const t=document.createElement("strong");for(e.hasAttributes()&&Array.from(e.attributes).forEach(o=>{t.setAttribute(o.name,o.value)});e.firstChild;)t.appendChild(e.firstChild);return e.replaceWith(t),t}static mergeStrongNodes(e,t){const o=m.ensureStrongElement(e),n=m.ensureStrongElement(t);for(;n.firstChild;)o.appendChild(n.firstChild);return n.remove(),o}render(){return{icon:ab,name:"bold",onActivate:()=>{this.toggleBold()},isActive:()=>{const e=window.getSelection();return e?this.isSelectionVisuallyBold(e):!1}}}toggleBold(){const e=window.getSelection();if(!e||e.rangeCount===0)return;const t=e.getRangeAt(0);if(t.collapsed){this.toggleCollapsedSelection();return}this.isRangeBold(t,{ignoreWhitespace:!0})?this.unwrapBoldTags(t):this.wrapWithBold(t)}isSelectionVisuallyBold(e){if(!e||e.rangeCount===0)return!1;const t=e.getRangeAt(0);return this.isRangeBold(t,{ignoreWhitespace:!0})}wrapWithBold(e){const t=this.getRangeHtmlWithoutBold(e),o=this.replaceRangeWithHtml(e,`<strong>${t}</strong>`),n=window.getSelection();n&&o&&(n.removeAllRanges(),n.addRange(o)),m.normalizeAllBoldTags();const i=n?m.findBoldElement(n.focusNode):null;if(!i)return;const s=this.mergeAdjacentBold(i);this.normalizeWhitespaceAround(s),this.selectElementContents(s),m.normalizeBoldTagsWithinBlok(window.getSelection()),m.replaceNbspInBlock(window.getSelection()),this.notifySelectionChange()}unwrapBoldTags(e){const t=this.collectBoldAncestors(e),o=window.getSelection();if(!o)return;const n=document.createElement("span"),i=e.extractContents();n.setAttribute("data-blok-bold-marker",`unwrap-${m.markerSequence++}`),n.appendChild(i),this.removeNestedBold(n),e.insertNode(n);const s=document.createRange();for(s.selectNodeContents(n),o.removeAllRanges(),o.addRange(s);;){const d=m.findBoldElement(n);if(!d)break;this.moveMarkerOutOfBold(n,d)}const a=n.firstChild,l=n.lastChild;this.unwrapElement(n);const c=a&&l?(()=>{const d=document.createRange();return d.setStartBefore(a),d.setEndAfter(l),o.removeAllRanges(),o.addRange(d),d})():void 0;c||o.removeAllRanges(),this.replaceNbspWithinRange(c),m.normalizeBoldTagsWithinBlok(o),m.replaceNbspInBlock(o),m.removeEmptyBoldElements(o),t.forEach(d=>{m.isElementEmpty(d)&&d.remove()}),this.notifySelectionChange()}replaceRangeWithHtml(e,t){var a,l;const o=m.createFragmentFromHtml(t),n=(a=o.firstChild)!=null?a:null,i=(l=o.lastChild)!=null?l:null;if(e.deleteContents(),!n||!i)return;e.insertNode(o);const s=document.createRange();return s.setStartBefore(n),s.setEndAfter(i),s}moveMarkerOutOfBold(e,t){const o=t.parentNode;if(!o)return;if(Array.from(t.childNodes).forEach(l=>{var c;l.nodeType===Node.TEXT_NODE&&((c=l.textContent)!=null?c:"").length===0&&l.remove()}),t.childNodes.length===1&&t.firstChild===e){t.replaceWith(e);return}if(t.firstChild===e){o.insertBefore(e,t);return}if(t.lastChild===e){o.insertBefore(e,t.nextSibling);return}const a=t.cloneNode(!1);for(;e.nextSibling;)a.appendChild(e.nextSibling);o.insertBefore(a,t.nextSibling),o.insertBefore(e,a)}selectElementContents(e){const t=window.getSelection();if(!t)return;const o=document.createRange();o.selectNodeContents(e),t.removeAllRanges(),t.addRange(o)}get shortcut(){return"CMD+B"}isRangeBold(e,t){var i;if(e.collapsed)return!!m.findBoldElement(e.startContainer);const o=document.createTreeWalker(e.commonAncestorContainer,NodeFilter.SHOW_TEXT,{acceptNode:s=>{try{return e.intersectsNode(s)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}catch(a){const l=document.createRange();l.selectNodeContents(s);const c=e.compareBoundaryPoints(Range.END_TO_START,l)>0,d=e.compareBoundaryPoints(Range.START_TO_END,l)<0;return c&&d?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}}}),n=[];for(;o.nextNode();){const s=o.currentNode,a=(i=s.textContent)!=null?i:"";t.ignoreWhitespace&&a.trim().length===0||a.length!==0&&n.push(s)}return n.length===0?!!m.findBoldElement(e.startContainer):n.every(s=>m.hasBoldParent(s))}removeNestedBold(e){var o;const t=(o=e.querySelectorAll)==null?void 0:o.call(e,"b,strong");t&&t.forEach(n=>{this.unwrapElement(n)})}unwrapElement(e){const t=e.parentNode;if(!t){e.remove();return}for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}mergeAdjacentBold(e){const t=m.ensureStrongElement(e),o=t.previousSibling,n=o&&o.nodeType===Node.ELEMENT_NODE&&m.isBoldTag(o)?m.mergeStrongNodes(o,t):t,i=n.nextSibling;return i&&i.nodeType===Node.ELEMENT_NODE&&m.isBoldTag(i)?m.mergeStrongNodes(n,i):n}toggleCollapsedSelection(){const e=window.getSelection();if(!e||e.rangeCount===0)return;const t=e.getRangeAt(0),o=m.findBoldElement(t.startContainer),n=(()=>{if(o&&o.getAttribute(m.DATA_ATTR_COLLAPSED_ACTIVE)!=="true")return m.exitCollapsedBold(e,o);const i=o!=null?o:m.getBoundaryBold(t);return i?m.exitCollapsedBold(e,i):this.startCollapsedBold(t)})();document.dispatchEvent(new Event("selectionchange")),n&&(e.removeAllRanges(),e.addRange(n)),m.normalizeBoldTagsWithinBlok(e),m.replaceNbspInBlock(e),m.removeEmptyBoldElements(e),this.notifySelectionChange()}startCollapsedBold(e){if(!e.collapsed)return;const t=document.createElement("strong"),o=document.createTextNode("");t.appendChild(o),t.setAttribute(m.DATA_ATTR_COLLAPSED_ACTIVE,"true");const n=e.startContainer,i=e.startOffset;if(!(n.nodeType===Node.TEXT_NODE?this.insertCollapsedBoldIntoText(n,t,i):n.nodeType===Node.ELEMENT_NODE?(this.insertCollapsedBoldIntoElement(n,t,i),!0):!1))return;const a=window.getSelection(),l=document.createRange();l.setStart(o,0),l.collapse(!0);const c=this.mergeAdjacentBold(t);return m.normalizeBoldTagsWithinBlok(a),m.replaceNbspInBlock(a),m.removeEmptyBoldElements(a),a&&(a.removeAllRanges(),a.addRange(l)),this.notifySelectionChange(),c.firstChild instanceof Text?(()=>{var u,h;const d=document.createRange();return d.setStart(c.firstChild,(h=(u=c.firstChild.textContent)==null?void 0:u.length)!=null?h:0),d.collapse(!0),d})():l}insertCollapsedBoldIntoText(e,t,o){var d;const n=e,i=n.parentNode;if(!i)return!1;const s=(d=n.textContent)!=null?d:"",a=s.slice(0,o),l=s.slice(o);n.textContent=a;const c=l.length?document.createTextNode(l):null;return c&&i.insertBefore(c,n.nextSibling),i.insertBefore(t,c!=null?c:n.nextSibling),t.setAttribute(m.DATA_ATTR_PREV_LENGTH,a.length.toString()),!0}insertCollapsedBoldIntoElement(e,t,o){var i;const n=(i=e.childNodes[o])!=null?i:null;e.insertBefore(t,n),t.setAttribute(m.DATA_ATTR_PREV_LENGTH,"0")}static isElementEmpty(e){var t;return((t=e.textContent)!=null?t:"").length===0}notifySelectionChange(){m.enforceCollapsedBoldLengths(window.getSelection()),document.dispatchEvent(new Event("selectionchange")),this.updateToolbarButtonState()}updateToolbarButtonState(){const e=window.getSelection();if(!e)return;const t=e.anchorNode,o=(t==null?void 0:t.nodeType)===Node.ELEMENT_NODE?t:t==null?void 0:t.parentElement,n=o==null?void 0:o.closest(Ee);if(!n)return;const i=n.querySelector("[data-blok-testid=inline-toolbar]");if(!(i instanceof HTMLElement))return;const s=i.querySelector('[data-blok-item-name="bold"]');if(!(s instanceof HTMLElement))return;this.isSelectionVisuallyBold(e)?s.setAttribute("data-blok-popover-item-active","true"):s.removeAttribute("data-blok-popover-item-active")}normalizeWhitespaceAround(e){m.replaceNbspWithSpace(e.previousSibling),m.replaceNbspWithSpace(e.nextSibling)}static replaceNbspWithSpace(e){var n;if(!e||e.nodeType!==Node.TEXT_NODE)return;const t=e,o=(n=t.textContent)!=null?n:"";o.includes(" ")&&(t.textContent=o.replace(/\u00A0/g," "))}restoreSelectionFromMarkers(e){const t=document.querySelector(`[data-blok-bold-marker="${e}-start"]`),o=document.querySelector(`[data-blok-bold-marker="${e}-end"]`);if(!t||!o){t==null||t.remove(),o==null||o.remove();return}const n=window.getSelection();if(!n){t.remove(),o.remove();return}const i=document.createRange();return i.setStartAfter(t),i.setEndBefore(o),n.removeAllRanges(),n.addRange(i),t.remove(),o.remove(),i}replaceNbspWithinRange(e){if(!e)return;const t=document.createTreeWalker(e.commonAncestorContainer,NodeFilter.SHOW_TEXT,{acceptNode:o=>{try{return e.intersectsNode(o)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}catch(n){const i=document.createRange();i.selectNodeContents(o);const s=e.compareBoundaryPoints(Range.END_TO_START,i)>0,a=e.compareBoundaryPoints(Range.START_TO_END,i)<0;return s&&a?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}}});for(;t.nextNode();)m.replaceNbspWithSpace(t.currentNode)}static normalizeBoldTagsWithinBlok(e){var i;const t=(i=e==null?void 0:e.anchorNode)!=null?i:e==null?void 0:e.focusNode;if(!t)return;const o=t.nodeType===Node.ELEMENT_NODE?t:t.parentElement,n=o==null?void 0:o.closest(Ee);n&&n.querySelectorAll("b").forEach(s=>{m.ensureStrongElement(s)})}static replaceNbspInBlock(e){var s;const t=(s=e==null?void 0:e.anchorNode)!=null?s:e==null?void 0:e.focusNode;if(!t)return;const o=t.nodeType===Node.ELEMENT_NODE?t:t.parentElement,n=o==null?void 0:o.closest('[data-blok-component="paragraph"]');if(!n)return;const i=document.createTreeWalker(n,NodeFilter.SHOW_TEXT);for(;i.nextNode();)m.replaceNbspWithSpace(i.currentNode);n.querySelectorAll("b").forEach(a=>{m.ensureStrongElement(a)})}static removeEmptyBoldElements(e){var s,a;const t=(s=e==null?void 0:e.anchorNode)!=null?s:e==null?void 0:e.focusNode;if(!t)return;const o=t.nodeType===Node.ELEMENT_NODE?t:t.parentElement,n=o==null?void 0:o.closest('[data-blok-component="paragraph"]');if(!n)return;const i=(a=e==null?void 0:e.focusNode)!=null?a:null;n.querySelectorAll("strong").forEach(l=>{var u;const c=l.getAttribute(m.DATA_ATTR_COLLAPSED_ACTIVE)==="true",d=l.hasAttribute(m.DATA_ATTR_COLLAPSED_LENGTH);c||d||((u=l.textContent)!=null?u:"").length===0&&!m.isNodeWithin(i,l)&&l.remove()})}static synchronizeCollapsedBold(e){var s,a;const t=(s=e==null?void 0:e.anchorNode)!=null?s:e==null?void 0:e.focusNode,o=t&&t.nodeType===Node.ELEMENT_NODE?t:t==null?void 0:t.parentElement,n=(a=o==null?void 0:o.closest(Ee))!=null?a:o==null?void 0:o.ownerDocument;if(!n)return;const i=`strong[${m.DATA_ATTR_COLLAPSED_ACTIVE}="true"]`;n.querySelectorAll(i).forEach(l=>{var _,F,N,X,D;const c=l.getAttribute(m.DATA_ATTR_PREV_LENGTH),d=l.previousSibling;if(!c||!d||d.nodeType!==Node.TEXT_NODE)return;const u=Number(c);if(!Number.isFinite(u))return;const h=d,p=(_=h.textContent)!=null?_:"";if(p.length<=u)return;const f=p.slice(0,u),g=p.slice(u);h.textContent=f;const b=g.match(/^[\u00A0\s]+/);if(b&&!l.hasAttribute(m.DATA_ATTR_LEADING_WHITESPACE)&&l.setAttribute(m.DATA_ATTR_LEADING_WHITESPACE,b[0]),g.length===0)return;const k=(F=l.textContent)!=null?F:"",y=k+g,x=(N=l.getAttribute(m.DATA_ATTR_LEADING_WHITESPACE))!=null?N:"",R=x.length>0&&k.length===0&&!y.startsWith(x)?x+y:y,C=document.createTextNode(R);for(;l.firstChild;)l.removeChild(l.firstChild);if(l.appendChild(C),!(e!=null&&e.isCollapsed)||!m.isNodeWithin(e.focusNode,h))return;const E=document.createRange(),w=(D=(X=C.textContent)==null?void 0:X.length)!=null?D:0;E.setStart(C,w),E.collapse(!0),e.removeAllRanges(),e.addRange(E)})}static moveCaretAfterBoundaryBold(e){if(!e.rangeCount)return;const t=e.getRangeAt(0);if(!t.collapsed)return;const o=m.findBoldElement(t.startContainer);(o==null?void 0:o.getAttribute(m.DATA_ATTR_COLLAPSED_ACTIVE))!=="true"&&(m.moveCaretFromElementContainer(e,t)||m.moveCaretFromTextContainer(e,t))}static getAdjacentBold(e){const t=e.startContainer;return t.nodeType===Node.TEXT_NODE?m.getBoldAdjacentToText(e,t):t.nodeType===Node.ELEMENT_NODE?m.getBoldAdjacentToElement(e,t):null}static getBoldAdjacentToText(e,t){var s,a;const o=(a=(s=t.textContent)==null?void 0:s.length)!=null?a:0,n=t.previousSibling;if(e.startOffset===0&&m.isBoldElement(n))return n;if(e.startOffset!==o)return null;const i=t.nextSibling;return m.isBoldElement(i)?i:null}static getBoldAdjacentToElement(e,t){var i,s;const o=e.startOffset>0&&(i=t.childNodes[e.startOffset-1])!=null?i:null;if(m.isBoldElement(o))return o;const n=(s=t.childNodes[e.startOffset])!=null?s:null;return m.isBoldElement(n)?n:null}static exitCollapsedIfNeeded(e,t){var s;if(!!m.findBoldElement(t.startContainer))return;const n=(s=m.getBoundaryBold(t))!=null?s:m.getAdjacentBold(t);if(!n)return;const i=m.exitCollapsedBold(e,n);i&&(e.removeAllRanges(),e.addRange(i))}static moveCaretFromElementContainer(e,t){if(t.startContainer.nodeType!==Node.ELEMENT_NODE)return!1;const o=t.startContainer;return m.moveCaretAfterPreviousBold(e,o,t.startOffset)?!0:m.moveCaretBeforeNextBold(e,o,t.startOffset)}static moveCaretAfterPreviousBold(e,t,o){var a,l,c;const n=o>0&&(a=t.childNodes[o-1])!=null?a:null;if(!m.isBoldElement(n))return!1;const i=m.ensureFollowingTextNode(n,n.nextSibling);if(!i)return!1;const s=(c=(l=i.textContent)==null?void 0:l.length)!=null?c:0;return m.setCaret(e,i,s),!0}static moveCaretBeforeNextBold(e,t,o){var s;const n=(s=t.childNodes[o])!=null?s:null;if(!m.isBoldElement(n))return!1;const i=m.ensureFollowingTextNode(n,n.nextSibling);return i?(m.setCaret(e,i,0),!0):(m.setCaretAfterNode(e,n),!0)}static moveCaretFromTextContainer(e,t){var c,d,u;if(t.startContainer.nodeType!==Node.TEXT_NODE)return;const o=t.startContainer,n=o.previousSibling,i=(c=o.textContent)!=null?c:"",s=/^\s/.test(i);if(t.startOffset===0&&m.isBoldElement(n)&&(i.length===0||s)){m.setCaret(e,o,i.length);return}const a=m.findBoldElement(o);if(!a||t.startOffset!==((u=(d=o.textContent)==null?void 0:d.length)!=null?u:0))return;const l=m.ensureFollowingTextNode(a,a.nextSibling);if(l){m.setCaret(e,l,0);return}m.setCaretAfterNode(e,a)}static guardCollapsedBoundaryKeydown(e){var l;if(e.defaultPrevented||e.metaKey||e.ctrlKey||e.altKey||e.key.length!==1)return;const o=window.getSelection();if(!o||!o.isCollapsed||o.rangeCount===0)return;const n=o.getRangeAt(0);if(n.startContainer.nodeType!==Node.TEXT_NODE)return;const i=n.startContainer,s=(l=i.textContent)!=null?l:"";if(s.length===0||n.startOffset!==0)return;const a=i.previousSibling;m.isBoldElement(a)&&/^\s/.test(s)&&m.setCaret(o,i,s.length)}static isBoldElement(e){return!!(e&&e.nodeType===Node.ELEMENT_NODE&&m.isBoldTag(e))}static setCaret(e,t,o){const n=document.createRange();n.setStart(t,o),n.collapse(!0),e.removeAllRanges(),e.addRange(n)}static setCaretAfterNode(e,t){if(!t)return;const o=document.createRange();o.setStartAfter(t),o.collapse(!0),e.removeAllRanges(),e.addRange(o)}static ensureFollowingTextNode(e,t){const o=e.parentNode;if(!o)return null;if(t&&t.nodeType===Node.TEXT_NODE)return t;const n=document.createTextNode("");return o.insertBefore(n,t),n}static enforceCollapsedBoldLengths(e){var s;const t=(s=e==null?void 0:e.anchorNode)!=null?s:e==null?void 0:e.focusNode;if(!t)return;const o=t.nodeType===Node.ELEMENT_NODE?t:t.parentElement,n=o==null?void 0:o.closest(Ee);if(!n)return;n.querySelectorAll(`strong[${m.DATA_ATTR_COLLAPSED_LENGTH}]`).forEach(a=>{var T,R,C,E,w;const l=a,c=l.getAttribute(m.DATA_ATTR_COLLAPSED_LENGTH);if(!c)return;const d=Number(c),u=(T=l.textContent)!=null?T:"";if(!Number.isFinite(d))return;const h=u.length>d,p=h?m.splitCollapsedBoldText(l,d,u):null,f=l.getAttribute(m.DATA_ATTR_PREV_LENGTH),g=f?Number(f):NaN,b=l.previousSibling,k=(b==null?void 0:b.nodeType)===Node.TEXT_NODE?b:null,y=(R=k==null?void 0:k.textContent)!=null?R:"",x=!!(f&&Number.isFinite(g)&&k&&y.length>g);if(x&&k){const _=y.slice(0,g),F=y.slice(g);k.textContent=_;const N=document.createTextNode(F);(C=l.parentNode)==null||C.insertBefore(N,l.nextSibling)}if(x&&l.removeAttribute(m.DATA_ATTR_PREV_LENGTH),e!=null&&e.isCollapsed&&p&&m.isNodeWithin(e.focusNode,l)){const _=document.createRange(),F=(w=(E=p.textContent)==null?void 0:E.length)!=null?w:0;_.setStart(p,F),_.collapse(!0),e.removeAllRanges(),e.addRange(_)}h&&l.removeAttribute(m.DATA_ATTR_COLLAPSED_LENGTH)})}static splitCollapsedBoldText(e,t,o){const n=e,i=n.parentNode;if(!i)return null;const s=o.slice(0,t),a=o.slice(t);n.textContent=s;const l=document.createTextNode(a);return i.insertBefore(l,n.nextSibling),l}static isNodeWithin(e,t){return e?e===t||t.contains(e):!1}static handleGlobalSelectionChange(){m.refreshSelectionState("selectionchange")}static handleGlobalInput(){m.refreshSelectionState("input")}static refreshSelectionState(e){const t=window.getSelection();m.enforceCollapsedBoldLengths(t),m.maintainCollapsedExitState(),m.synchronizeCollapsedBold(t),m.normalizeBoldTagsWithinBlok(t),m.removeEmptyBoldElements(t),e==="input"&&t&&m.moveCaretAfterBoundaryBold(t),m.normalizeAllBoldTags()}static ensureMutationObserver(){if(typeof MutationObserver=="undefined"||m.mutationObserver)return;const e=new MutationObserver(t=>{if(!m.isProcessingMutation){m.isProcessingMutation=!0;try{t.forEach(o=>{o.addedNodes.forEach(n=>{m.normalizeBoldInNode(n)}),o.type==="characterData"&&o.target&&m.normalizeBoldInNode(o.target)})}finally{m.isProcessingMutation=!1}}});e.observe(document.body,{subtree:!0,childList:!0,characterData:!0}),m.mutationObserver=e}static handleBeforeInput(e){if(e.inputType!=="formatBold")return;const t=window.getSelection(),o=!!(t&&m.isSelectionInsideBlok(t)),n=m.isEventTargetInsideBlok(e.target);!o&&!n||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),m.normalizeAllBoldTags())}static exitCollapsedBold(e,t){const o=m.ensureStrongElement(t),n=o.parentNode;if(n)return m.isElementEmpty(o)?m.removeEmptyBoldElement(e,o,n):m.exitCollapsedBoldWithContent(e,o,n)}static removeEmptyBoldElement(e,t,o){const n=document.createRange();return n.setStartBefore(t),n.collapse(!0),o.removeChild(t),e.removeAllRanges(),e.addRange(n),n}static exitCollapsedBoldWithContent(e,t,o){var h,p,f,g,b,k;t.setAttribute(m.DATA_ATTR_COLLAPSED_LENGTH,((p=(h=t.textContent)==null?void 0:h.length)!=null?p:0).toString()),t.removeAttribute(m.DATA_ATTR_PREV_LENGTH),t.removeAttribute(m.DATA_ATTR_COLLAPSED_ACTIVE),t.removeAttribute(m.DATA_ATTR_LEADING_WHITESPACE);const n=t.nextSibling,i=!n||n.nodeType!==Node.TEXT_NODE,s=i?document.createTextNode("​"):null;s&&o.insertBefore(s,n);const a=s!=null?s:n;!i&&((f=a.textContent)!=null?f:"").length===0&&(a.textContent="​");const l=document.createRange(),d=((g=a.textContent)!=null?g:"").startsWith("​")?1:0;l.setStart(a,d),l.collapse(!0),e.removeAllRanges(),e.addRange(l);const u=m.ensureStrongElement(t);return m.collapsedExitRecords.add({boundary:a,boldElement:u,allowedLength:(k=(b=u.textContent)==null?void 0:b.length)!=null?k:0,hasLeadingSpace:!1,hasTypedContent:!1,leadingWhitespace:""}),l}static getBoundaryBold(e){const t=e.startContainer;return t.nodeType===Node.TEXT_NODE?m.getBoundaryBoldForText(e,t):t.nodeType===Node.ELEMENT_NODE?m.getBoundaryBoldForElement(e,t):null}static getBoundaryBoldForText(e,t){var i,s;const o=(s=(i=t.textContent)==null?void 0:i.length)!=null?s:0;if(e.startOffset===o)return m.findBoldElement(t);if(e.startOffset!==0)return null;const n=t.previousSibling;return m.isBoldElement(n)?n:null}static getBoundaryBoldForElement(e,t){if(e.startOffset<=0)return null;const o=t.childNodes[e.startOffset-1];return m.isBoldElement(o)?o:null}static handleShortcut(e){var n;if(m.guardCollapsedBoundaryKeydown(e),!m.isBoldShortcut(e))return;const t=window.getSelection();if(!t||!t.rangeCount||!m.isSelectionInsideBlok(t))return;const o=(n=m.instances.values().next().value)!=null?n:new m;o&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),o.toggleBold())}static isBoldShortcut(e){return!((typeof navigator!="undefined"?navigator.userAgent.toLowerCase():"").includes("mac")?e.metaKey:e.ctrlKey)||e.altKey?!1:e.key.toLowerCase()==="b"}static isSelectionInsideBlok(e){const t=e.anchorNode;if(!t)return!1;const o=t.nodeType===Node.ELEMENT_NODE?t:t.parentElement;return!!(o!=null&&o.closest(Ee))}static isEventTargetInsideBlok(e){var o;if(!e||typeof Node=="undefined")return!1;if(e instanceof Element)return!!e.closest(Ee);if(e instanceof Text)return!!((o=e.parentElement)!=null&&o.closest(Ee));if(typeof ShadowRoot!="undefined"&&e instanceof ShadowRoot)return m.isEventTargetInsideBlok(e.host);if(!(e instanceof Node))return!1;const t=e.parentNode;return t?t instanceof Element?!!t.closest(Ee):m.isEventTargetInsideBlok(t):!1}getRangeHtmlWithoutBold(e){const t=e.cloneContents();this.removeNestedBold(t);const o=document.createElement("div");return o.appendChild(t),o.innerHTML}static createFragmentFromHtml(e){const t=document.createElement("template");return t.innerHTML=e,t.content}collectBoldAncestors(e){const t=new Set,o=document.createTreeWalker(e.commonAncestorContainer,NodeFilter.SHOW_TEXT,{acceptNode:n=>{try{return e.intersectsNode(n)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}catch(i){const s=document.createRange();s.selectNodeContents(n);const a=e.compareBoundaryPoints(Range.END_TO_START,s)>0,l=e.compareBoundaryPoints(Range.START_TO_END,s)<0;return a&&l?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}}});for(;o.nextNode();){const n=m.findBoldElement(o.currentNode);n&&t.add(n)}return Array.from(t)}};m.isInline=!0,m.title="Bold",m.shortcutListenerRegistered=!1,m.selectionListenerRegistered=!1,m.inputListenerRegistered=!1,m.beforeInputListenerRegistered=!1,m.globalListenersInitialized=m.initializeGlobalListeners(),m.collapsedExitRecords=new Set,m.markerSequence=0,m.isProcessingMutation=!1,m.DATA_ATTR_COLLAPSED_LENGTH="data-blok-bold-collapsed-length",m.DATA_ATTR_COLLAPSED_ACTIVE="data-blok-bold-collapsed-active",m.DATA_ATTR_PREV_LENGTH="data-blok-bold-prev-length",m.DATA_ATTR_LEADING_WHITESPACE="data-blok-bold-leading-ws",m.instances=new Set,m.pendingBoundaryCaretAdjustments=new WeakSet;let sa=m;const ln=class ln{static get sanitize(){return{i:{},em:{}}}render(){return{icon:lb,name:"italic",onActivate:()=>{this.toggleItalic()},isActive:()=>{const e=window.getSelection();return e?this.isSelectionVisuallyItalic(e):!1}}}get shortcut(){return"CMD+I"}toggleItalic(){const e=window.getSelection();if(!e||e.rangeCount===0)return;const t=e.getRangeAt(0);if(t.collapsed){this.toggleCollapsedItalic(t,e);return}this.isRangeItalic(t,{ignoreWhitespace:!0})?this.unwrapItalicTags(t):this.wrapWithItalic(t)}toggleCollapsedItalic(e,t){if(this.isRangeItalic(e,{ignoreWhitespace:!0})){const n=document.createTextNode("​");e.insertNode(n),e.selectNode(n),this.unwrapItalicTags(e);const i=document.createRange();i.setStart(n,1),i.setEnd(n,1),t.removeAllRanges(),t.addRange(i)}else{const n=document.createElement("i"),i=document.createTextNode("​");n.appendChild(i),e.insertNode(n);const s=document.createRange();s.setStart(i,1),s.setEnd(i,1),t.removeAllRanges(),t.addRange(s)}}isSelectionVisuallyItalic(e){if(!e||e.rangeCount===0)return!1;const t=e.getRangeAt(0);return this.isRangeItalic(t,{ignoreWhitespace:!0})}isRangeItalic(e,t){var i;if(e.collapsed)return!!this.findItalicElement(e.startContainer);const o=document.createTreeWalker(e.commonAncestorContainer,NodeFilter.SHOW_TEXT,{acceptNode:s=>{try{return e.intersectsNode(s)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}catch(a){const l=document.createRange();l.selectNodeContents(s);const c=e.compareBoundaryPoints(Range.END_TO_START,l)>0,d=e.compareBoundaryPoints(Range.START_TO_END,l)<0;return c&&d?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}}}),n=[];for(;o.nextNode();){const s=o.currentNode,a=(i=s.textContent)!=null?i:"";t.ignoreWhitespace&&a.trim().length===0||a.length!==0&&n.push(s)}return n.length===0?!!this.findItalicElement(e.startContainer):n.every(s=>this.hasItalicParent(s))}wrapWithItalic(e){const t=this.getRangeHtmlWithoutItalic(e),o=this.replaceRangeWithHtml(e,`<i>${t}</i>`),n=window.getSelection();n&&o&&(n.removeAllRanges(),n.addRange(o))}unwrapItalicTags(e){const t=this.collectItalicAncestors(e),o=window.getSelection();if(!o)return;const n=document.createElement("span"),i=e.extractContents();n.appendChild(i),this.removeNestedItalic(n),e.insertNode(n);const s=document.createRange();for(s.selectNodeContents(n),o.removeAllRanges(),o.addRange(s);;){const d=this.findItalicElement(n);if(!d)break;this.moveMarkerOutOfItalic(n,d)}const a=n.firstChild,l=n.lastChild;this.unwrapElement(n),(a&&l?(()=>{const d=document.createRange();return d.setStartBefore(a),d.setEndAfter(l),o.removeAllRanges(),o.addRange(d),d})():void 0)||o.removeAllRanges(),t.forEach(d=>{var u;((u=d.textContent)!=null?u:"").length===0&&d.remove()})}hasItalicParent(e){return e?e.nodeType===Node.ELEMENT_NODE&&this.isItalicTag(e)?!0:this.hasItalicParent(e.parentNode):!1}findItalicElement(e){return e?e.nodeType===Node.ELEMENT_NODE&&this.isItalicTag(e)?e:this.findItalicElement(e.parentNode):null}isItalicTag(e){const t=e.tagName;return t==="I"||t==="EM"}collectItalicAncestors(e){const t=new Set,o=document.createTreeWalker(e.commonAncestorContainer,NodeFilter.SHOW_TEXT,{acceptNode:n=>{try{return e.intersectsNode(n)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}catch(i){const s=document.createRange();s.selectNodeContents(n);const a=e.compareBoundaryPoints(Range.END_TO_START,s)>0,l=e.compareBoundaryPoints(Range.START_TO_END,s)<0;return a&&l?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}}});for(;o.nextNode();){const n=this.findItalicElement(o.currentNode);n&&t.add(n)}return Array.from(t)}getRangeHtmlWithoutItalic(e){const t=e.cloneContents();this.removeNestedItalic(t);const o=document.createElement("div");return o.appendChild(t),o.innerHTML}removeNestedItalic(e){var o;const t=(o=e.querySelectorAll)==null?void 0:o.call(e,"i,em");t&&t.forEach(n=>{this.unwrapElement(n)})}unwrapElement(e){const t=e.parentNode;if(!t){e.remove();return}for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}replaceRangeWithHtml(e,t){var a,l;const o=this.createFragmentFromHtml(t),n=(a=o.firstChild)!=null?a:null,i=(l=o.lastChild)!=null?l:null;if(e.deleteContents(),!n||!i)return;e.insertNode(o);const s=document.createRange();return s.setStartBefore(n),s.setEndAfter(i),s}createFragmentFromHtml(e){const t=document.createElement("template");return t.innerHTML=e,t.content}moveMarkerOutOfItalic(e,t){const o=t.parentNode;if(!o)return;if(Array.from(t.childNodes).forEach(l=>{var c;l.nodeType===Node.TEXT_NODE&&((c=l.textContent)!=null?c:"").length===0&&l.remove()}),t.childNodes.length===1&&t.firstChild===e){t.replaceWith(e);return}if(t.firstChild===e){o.insertBefore(e,t);return}if(t.lastChild===e){o.insertBefore(e,t.nextSibling);return}const a=t.cloneNode(!1);for(;e.nextSibling;)a.appendChild(e.nextSibling);o.insertBefore(a,t.nextSibling),o.insertBefore(e,a)}};ln.isInline=!0,ln.title="Italic";let aa=ln;const Sv=(Ct=class{constructor({api:e}){this.INPUT_BASE_CLASSES="hidden w-full m-0 px-2 py-1 text-sm leading-[22px] font-medium bg-item-hover-bg border border-[rgba(226,226,229,0.2)] rounded-md outline-none box-border appearance-none font-[inherit] placeholder:text-gray-text mobile:text-[15px] mobile:font-medium",this.DATA_ATTRIBUTES={buttonActive:"data-blok-link-tool-active",buttonUnlink:"data-blok-link-tool-unlink",inputOpened:"data-blok-link-tool-input-opened"},this.nodes={input:null,button:null},this.inputOpened=!1,this.unlinkAvailable=!1,this.handleButtonClick=t=>{!this.inputOpened||!this.unlinkAvailable||(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),this.restoreSelection(),this.unlink(),this.inlineToolbar.close())},this.toolbar=e.toolbar,this.inlineToolbar=e.inlineToolbar,this.notifier=e.notifier,this.i18n=e.i18n,this.selection=new O,this.nodes.input=this.createInput()}static get sanitize(){return{a:{href:!0,target:"_blank",rel:"nofollow"}}}render(){return{icon:cb,isActive:()=>!!this.selection.findParentTag("A"),children:{hideChevron:!0,items:[{type:ae.Html,element:this.nodes.input}],onOpen:()=>{this.openActions(!0)},onClose:()=>{this.closeActions()}}}}createInput(){const e=document.createElement("input");return e.placeholder=this.i18n.t("Add a link"),e.enterKeyHint="done",e.className=this.INPUT_BASE_CLASSES,e.setAttribute("data-blok-testid","inline-tool-input"),this.setBooleanStateAttribute(e,this.DATA_ATTRIBUTES.inputOpened,!1),e.addEventListener("keydown",t=>{t.key==="Enter"&&this.enterPressed(t)}),e}get shortcut(){return"CMD+K"}openActions(e=!1){if(!this.nodes.input)return;const t=this.selection.findParentTag("A"),o=!!t;if(this.updateButtonStateAttributes(o),this.unlinkAvailable=o,t){const n=t.getAttribute("href");this.nodes.input.value=n!==null?n:""}else this.nodes.input.value="";this.nodes.input.className=$(this.INPUT_BASE_CLASSES,"block"),this.setBooleanStateAttribute(this.nodes.input,this.DATA_ATTRIBUTES.inputOpened,!0),this.selection.save(),e&&this.focusInputWithRetry(),this.inputOpened=!0}focusInputWithRetry(){this.nodes.input&&(this.nodes.input.focus(),!(typeof window=="undefined"||typeof document=="undefined")&&window.setTimeout(()=>{var e;document.activeElement!==this.nodes.input&&((e=this.nodes.input)==null||e.focus())},0))}getButtonElement(){if(this.nodes.button&&document.contains(this.nodes.button))return this.nodes.button;const e=document.querySelector(`${iu} [data-blok-item-name="link"]`);return e&&e.addEventListener("click",this.handleButtonClick,!0),this.nodes.button=e!=null?e:null,this.nodes.button}updateButtonStateAttributes(e){const t=this.getButtonElement();if(!t)return;const o=typeof e=="boolean"?e:!!this.selection.findParentTag("A");this.setBooleanStateAttribute(t,this.DATA_ATTRIBUTES.buttonActive,o),this.setBooleanStateAttribute(t,this.DATA_ATTRIBUTES.buttonUnlink,o)}closeActions(e=!0){(this.selection.isFakeBackgroundEnabled||e&&this.selection.savedSelectionRange)&&this.restoreSelection(),this.nodes.input&&(this.nodes.input.className=this.INPUT_BASE_CLASSES,this.setBooleanStateAttribute(this.nodes.input,this.DATA_ATTRIBUTES.inputOpened,!1),this.nodes.input.value="",this.updateButtonStateAttributes(!1),this.unlinkAvailable=!1,e&&this.selection.clearSaved(),this.inputOpened=!1)}restoreSelection(){const e=new O,t=O.isAtBlok;if(t&&e.save(),this.selection.removeFakeBackground(),this.selection.restore(),!t&&this.selection.savedSelectionRange){const i=this.selection.savedSelectionRange.commonAncestorContainer,s=i.nodeType===Node.ELEMENT_NODE?i:i.parentElement;s==null||s.focus()}if(!t)return;e.restore();const o=e.savedSelectionRange;if(o){const n=o.commonAncestorContainer,i=n.nodeType===Node.ELEMENT_NODE?n:n.parentElement;i==null||i.focus()}}enterPressed(e){if(!this.nodes.input)return;const t=this.nodes.input.value||"";if(!t.trim()){this.selection.restore(),this.unlink(),e.preventDefault(),this.closeActions(),this.inlineToolbar.close();return}if(!this.validateURL(t)){this.notifier.show({message:"Pasted link is not valid.",style:"error"}),j("Incorrect Link pasted","warn",t);return}const o=this.prepareLink(t);this.selection.removeFakeBackground(),this.selection.restore(),this.insertLink(o),e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),this.selection.collapseToEnd(),this.inlineToolbar.close()}validateURL(e){return!/\s/.test(e)}prepareLink(e){return this.addProtocol(e.trim())}addProtocol(e){if(/^(\w+):(\/\/)?/.test(e))return e;const t=/^\/[^/\s]/.test(e),o=e.substring(0,1)==="#",n=/^\/\/[^/\s]/.test(e);return!t&&!o&&!n?"http://"+e:e}insertLink(e){const t=this.selection.findParentTag("A");if(t){this.selection.expandToTag(t),t.href=e,t.target="_blank",t.rel="nofollow";return}const o=O.range;if(!o)return;const n=document.createElement("a");n.href=e,n.target="_blank",n.rel="nofollow",n.appendChild(o.extractContents()),o.insertNode(n),this.selection.expandToTag(n)}unlink(){const e=this.selection.findParentTag("A");e&&(this.unwrap(e),this.updateButtonStateAttributes(!1),this.unlinkAvailable=!1)}unwrap(e){var o;const t=document.createDocumentFragment();for(;e.firstChild;)t.appendChild(e.firstChild);(o=e.parentNode)==null||o.replaceChild(t,e)}setBooleanStateAttribute(e,t,o){e&&e.setAttribute(t,o?"true":"false")}},Ct.isInline=!0,Ct.title="Link",Ct),ga=class ga{constructor({api:e}){this.i18nAPI=e.i18n,this.blocksAPI=e.blocks,this.selectionAPI=e.selection,this.toolsAPI=e.tools,this.caretAPI=e.caret}async render(){var c;const e=O.get();if(e===null)return[];const t=this.blocksAPI.getBlockByElement(e.anchorNode);if(t===void 0)return[];const o=this.toolsAPI.getBlockTools(),n=await pu(t,o);if(n.length===0)return[];const i=n.reduce((d,u)=>{var h;return(h=u.toolbox)==null||h.forEach(p=>{p.title!==void 0&&d.push({icon:p.icon,title:ie.t(pe.toolNames,p.title),name:u.name,closeOnActivate:!0,onActivate:async()=>{const f=await this.blocksAPI.convert(t.id,u.name,p.data);this.caretAPI.setToBlock(f,"end")}})}),d},[]),s=await t.getActiveToolboxEntry(),a=(c=s==null?void 0:s.title)!=null?c:t.name,l=!rt();return{name:"convert-to",title:ie.t(pe.toolNames,a),hint:{title:ie.ui(pe.ui.inlineToolbar.converter,"Convert to")},children:{items:i,onOpen:()=>{l&&(this.selectionAPI.setFakeBackground(),this.selectionAPI.save())},onClose:()=>{l&&(this.selectionAPI.restore(),this.selectionAPI.removeFakeBackground())}}}}};ga.isInline=!0;let la=ga;const ma=class ma{constructor({data:e,api:t}){this.api=t,this.title=e.title||this.api.i18n.t("Error"),this.subtitle=this.api.i18n.t("The block can not be displayed correctly."),this.savedData=e.savedData,this.wrapper=this.make()}render(){return this.wrapper}save(){return this.savedData}make(){const e=v.make("div","flex items-center py-3 px-[18px] my-2.5 rounded-[10px] bg-bg-light border border-line-gray text-gray-text text-sm [&_svg]:size-icon"),t=xb,o=v.make("div","ml-3.5"),n=v.make("div","font-medium capitalize",{textContent:this.title}),i=v.make("div","",{textContent:this.subtitle});return e.setAttribute(us,"stub"),e.setAttribute(im,""),o.setAttribute(sm,""),n.setAttribute(am,""),i.setAttribute(lm,""),e.innerHTML=t,o.appendChild(n),o.appendChild(i),e.appendChild(o),e}};ma.isReadOnlySupported=!0;let ca=ma;class Av extends Ms{constructor(){super(...arguments),this.type=vt.Inline}getMissingMethods(e){const t=this.constructable,o=t==null?void 0:t.prototype;return o?e.filter(n=>typeof o[n]!="function"):[...e]}create(){const e=this.constructable;return new e({api:this.api,config:this.settings})}get isReadOnlySupported(){var t;const e=this.constructable;return(t=e==null?void 0:e.isReadOnlySupported)!=null?t:!1}get title(){return this.constructable.title||""}}class Iv extends Ms{constructor(){super(...arguments),this.type=vt.Tune}create(e,t){const o=this.constructable;return new o({api:this.api,config:this.settings,block:t,data:e})}}class ke extends Map{get blockTools(){const e=Array.from(this.entries()).filter(([,t])=>t.isBlock());return new ke(e)}get inlineTools(){const e=Array.from(this.entries()).filter(([,t])=>t.isInline());return new ke(e)}get blockTunes(){const e=Array.from(this.entries()).filter(([,t])=>t.isTune());return new ke(e)}get internalTools(){const e=Array.from(this.entries()).filter(([,t])=>t.isInternal);return new ke(e)}get externalTools(){const e=Array.from(this.entries()).filter(([,t])=>!t.isInternal);return new ke(e)}}class Rv extends Ms{constructor(){super(...arguments),this.type=vt.Block,this.inlineTools=new ke,this.tunes=new ke}create(e,t,o){return new this.constructable({data:e,block:t,readOnly:o,api:this.api,config:this.settings})}get isReadOnlySupported(){return this.constructable[Lt.IsReadOnlySupported]===!0}get isLineBreaksEnabled(){var e;return(e=this.constructable[Lt.IsEnabledLineBreaks])!=null?e:!1}get toolbox(){const e=this.constructable[Lt.Toolbox],t=this.config[qo.Toolbox];if(!(!e||le(e))&&t!==!1)return t==null?Array.isArray(e)?e:[e]:!Array.isArray(t)&&Array.isArray(e)?[t]:Array.isArray(t)?Array.isArray(e)?t.map((o,n)=>{const i=e[n];return i?K(K({},i),o):o}):t:[K(K({},e),t)]}get conversionConfig(){return this.constructable[Lt.ConversionConfig]}get enabledInlineTools(){return this.config[qo.EnabledInlineTools]||!1}get enabledBlockTunes(){return this.config[qo.EnabledBlockTunes]}get pasteConfig(){var e;return(e=this.constructable[Lt.PasteConfig])!=null?e:{}}get hasOnPasteHandler(){var t;const e=(t=this.constructable)==null?void 0:t.prototype;return typeof(e==null?void 0:e.onPaste)=="function"}get sanitizeConfig(){if(this._sanitizeConfig)return this._sanitizeConfig;const e=super.sanitizeConfig,t=this.baseSanitizeConfig;if(le(e))return this._sanitizeConfig=t,t;const o={};for(const n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;const i=e[n];Z(i)?o[n]=Object.assign({},t,i):o[n]=i}return this._sanitizeConfig=o,o}get baseSanitizeConfig(){if(this._baseSanitizeConfig)return this._baseSanitizeConfig;const e={};return Array.from(this.inlineTools.values()).forEach(t=>Object.assign(e,t.sanitizeConfig)),Array.from(this.tunes.values()).forEach(t=>Object.assign(e,t.sanitizeConfig)),this._baseSanitizeConfig=e,e}}class Nv{constructor(e,t,o){this.api=o,this.config=e,this.blokConfig=t}get(e){const l=this.config[e],{class:t,isInternal:o=!1}=l,n=vh(l,["class","isInternal"]),i=t;if(i===void 0)throw new Error(`Tool "${e}" does not provide a class.`);const s=this.getConstructor(i),a=!!Reflect.get(i,Ds.IsTune);return new s({name:e,constructable:i,config:n,api:this.api.getMethodsForTool(e,a),isDefault:e===this.blokConfig.defaultBlock,defaultPlaceholder:this.blokConfig.placeholder,isInternal:o})}getConstructor(e){switch(!0){case!!Reflect.get(e,Ru.IsInline):return Av;case!!Reflect.get(e,Ds.IsTune):return Iv;default:return Rv}}}const ba=class ba{constructor({api:e}){this.api=e}render(){return{icon:sb,title:this.api.i18n.t("Delete"),name:"delete",confirmation:{title:this.api.i18n.t("Click to delete"),onActivate:()=>this.handleClick()}}}handleClick(){this.api.blocks.delete()}};ba.isTune=!0;let da=ba;const Tt=r=>{if(!V(r))throw new Error("Tool constructable must be a function");return r};class Ov extends z{constructor(){super(...arguments),this.stubTool="stub",this.factory=null,this.toolsAvailable=new ke,this.toolsUnavailable=new ke,this.inlineToolsSanitizeConfigCache=null}get available(){return this.toolsAvailable}get unavailable(){return this.toolsUnavailable}get inlineTools(){return this.available.inlineTools}get blockTools(){return this.available.blockTools}get blockTunes(){return this.available.blockTunes}get defaultTool(){const e=this.config.defaultBlock;if(!e)throw new Error("Default block tool name is not configured");const t=this.blockTools.get(e);if(!t)throw new Error(`Default block tool "${e}" not found in available block tools`);return t}get internal(){return this.available.internalTools}async prepare(){var l;const e=(l=this.config.tools)!=null?l:{};this.config.tools=$t({},this.internalTools,e),this.validateTools();const t=this.config.tools;if(!t||Object.keys(t).length===0)throw Error("Can't start without tools");const o=this.prepareConfig(t);this.factory=new Nv(o,this.config,this.Blok.API);const n=this.getListOfPrepareFunctions(o);if(n.length===0)return Promise.resolve();const i=c=>{this.isToolPrepareData(c)&&this.toolPrepareMethodSuccess({toolName:c.toolName})},s=c=>{this.isToolPrepareData(c)&&this.toolPrepareMethodFallback({toolName:c.toolName})},a=new lh;n.forEach(c=>{a.add(async()=>{const d=Gp(c.data)?{}:c.data;try{await c.function(c.data),i(d)}catch(u){s(d)}})}),await a.completed,this.prepareBlockTools()}getAllInlineToolsSanitizeConfig(){if(this.inlineToolsSanitizeConfigCache)return this.inlineToolsSanitizeConfigCache;const e={};return Array.from(this.inlineTools.values()).forEach(t=>{Object.assign(e,t.sanitizeConfig)}),this.inlineToolsSanitizeConfigCache=e,e}destroy(){for(const e of this.available.values()){const t=(()=>{try{return e.reset()}catch(o){j(`Tool "${e.name}" reset failed`,"warn",o);return}})();t instanceof Promise&&t.catch(o=>{j(`Tool "${e.name}" reset failed`,"warn",o)})}}get internalTools(){return{convertTo:{class:Tt(la),isInternal:!0},link:{class:Tt(Sv),isInternal:!0},bold:{class:Tt(sa),isInternal:!0},italic:{class:Tt(aa),isInternal:!0},paragraph:{class:Tt(sn),inlineToolbar:!0,config:{preserveBlank:!0},isInternal:!0},stub:{class:Tt(ca),isInternal:!0},delete:{class:Tt(da),isInternal:!0}}}toolPrepareMethodSuccess(e){const t=this.getFactory().get(e.toolName);if(!t.isInline()){this.toolsAvailable.set(t.name,t);return}const o=["render"],n=t.getMissingMethods(o);if(n.length){j(`Incorrect Inline Tool: ${t.name}. Some of required methods is not implemented %o`,"warn",n),this.toolsUnavailable.set(t.name,t);return}this.toolsAvailable.set(t.name,t)}toolPrepareMethodFallback(e){const t=this.getFactory();this.toolsUnavailable.set(e.toolName,t.get(e.toolName))}getListOfPrepareFunctions(e){return Object.entries(e).map(([t,o])=>{var s;const n={toolName:t,config:(s=o.config)!=null?s:{}};return{function:async a=>{const l=o.class;if(!l||!V(l.prepare))return;const c=a!=null?a:n;return l.prepare.call(l,c)},data:n}})}prepareBlockTools(){Array.from(this.blockTools.values()).forEach(e=>{this.assignInlineToolsToBlockTool(e),this.assignBlockTunesToBlockTool(e)})}assignInlineToolsToBlockTool(e){const t=e;if(this.config.inlineToolbar!==!1){if(t.enabledInlineTools===!0){const o=Array.isArray(this.config.inlineToolbar)?this.createInlineToolsCollection(this.config.inlineToolbar):new ke(Array.from(this.inlineTools.entries()));t.inlineTools=o;return}if(Array.isArray(t.enabledInlineTools)){const o=this.createInlineToolsCollection(["convertTo",...t.enabledInlineTools]);t.inlineTools=o}}}assignBlockTunesToBlockTool(e){const t=e;if(t.enabledBlockTunes!==!1){if(Array.isArray(t.enabledBlockTunes)){const o=this.createBlockTunesCollection(t.enabledBlockTunes),n=[...Array.from(o.entries()),...Array.from(this.blockTunes.internalTools.entries())];t.tunes=new ke(n);return}if(Array.isArray(this.config.tunes)){const o=this.createBlockTunesCollection(this.config.tunes),n=[...Array.from(o.entries()),...Array.from(this.blockTunes.internalTools.entries())];t.tunes=new ke(n);return}t.tunes=new ke(Array.from(this.blockTunes.internalTools.entries()))}}validateTools(){const e=this.config.tools;if(!e)return;const t=this.internalTools;for(const o in e){if(!Object.prototype.hasOwnProperty.call(e,o)||o in t)continue;const n=e[o],i=V(n),a=V(n.class);if(!i&&!a)throw new Vt(`Tool «${o}» must be a constructor function or an object with function in the «class» property`)}}prepareConfig(e){const t={};for(const o in e){if(!Object.prototype.hasOwnProperty.call(e,o))continue;const n=e[o];if(Z(n)){t[o]=n;continue}t[o]={class:n}}return t}isToolPrepareData(e){const t=e;return typeof(t==null?void 0:t.toolName)=="string"}getFactory(){if(this.factory===null)throw new Error("Tools factory is not initialized");return this.factory}createInlineToolsCollection(e){const t=[];for(const o of e){const n=this.inlineTools.get(o);if(!n){j(`Inline tool "${o}" is not available and will be skipped`,"warn");continue}t.push([o,n])}return new ke(t)}createBlockTunesCollection(e){const t=[];for(const o of e){const n=this.blockTunes.get(o);if(!n){j(`Block tune "${o}" is not available and will be skipped`,"warn");continue}t.push([o,n])}return new ke(t)}}const _v=`*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:PT Mono,Menlo,Monaco,Consolas,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.\\!container{width:100%!important}.container{width:100%}@media(min-width:640px){.\\!container{max-width:640px!important}.container{max-width:640px}}@media(min-width:651px){.\\!container{max-width:651px!important}.container{max-width:651px}}@media(min-width:768px){.\\!container{max-width:768px!important}.container{max-width:768px}}@media(min-width:1024px){.\\!container{max-width:1024px!important}.container{max-width:1024px}}@media(min-width:1280px){.\\!container{max-width:1280px!important}.container{max-width:1280px}}@media(min-width:1536px){.\\!container{max-width:1536px!important}.container{max-width:1536px}}.blok-block{padding:.4em 0}.blok-block::-webkit-input-placeholder{line-height:1.5!important}.blok-inline-tool-button{display:flex;height:100%;width:1.75rem;cursor:pointer;align-items:center;justify-content:center;border-radius:.25rem;border-width:0px;background-color:transparent;padding:0;line-height:1.5;--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.blok-inline-tool-button--active{background-color:#388ae51a;--tw-text-opacity: 1;color:rgb(56 138 229 / var(--tw-text-opacity, 1))}.blok-input{width:100%;border-radius:3px;border-width:1px;--tw-border-opacity: 1;border-color:rgb(239 240 241 / var(--tw-border-opacity, 1));padding:.625rem .75rem;--tw-shadow: inset 0 1px 2px 0 rgba(35, 44, 72, .06);--tw-shadow-colored: inset 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow);outline:2px solid transparent;outline-offset:2px}.blok-input[data-blok-placeholder]:before{pointer-events:none;position:static!important;display:inline-block;width:0px;content:var(--tw-content);white-space:nowrap}.blok-loader{position:relative;border-width:1px;--tw-border-opacity: 1;border-color:rgb(239 240 241 / var(--tw-border-opacity, 1))}.blok-loader:before{position:absolute;left:50%;top:50%;margin-left:-11px;margin-top:-11px;height:18px;content:var(--tw-content);width:18px}@keyframes rotation{0%{content:var(--tw-content);transform:rotate(0)}to{content:var(--tw-content);transform:rotate(360deg)}}.blok-loader:before{animation:rotation 1.2s infinite linear;border-radius:9999px;border-width:2px;border-color:rgb(239 240 241 / var(--tw-border-opacity, 1));--tw-border-opacity: 1;border-left-color:rgb(56 138 229 / var(--tw-border-opacity, 1));--tw-content: "";content:var(--tw-content)}.blok-button{cursor:pointer;border-radius:3px;border-width:1px;--tw-border-opacity: 1;border-color:rgb(239 240 241 / var(--tw-border-opacity, 1));--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:13px;text-align:center;font-size:14.9px;--tw-text-opacity: 1;color:rgb(112 118 132 / var(--tw-text-opacity, 1));--tw-shadow: 0 2px 2px 0 rgba(18, 30, 57, .04);--tw-shadow-colored: 0 2px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.blok-button:hover{--tw-bg-opacity: 1;background-color:rgb(251 252 254 / var(--tw-bg-opacity, 1));--tw-shadow: 0 1px 3px 0 rgba(18, 30, 57, .08);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.blok-button svg{margin-right:.2em;margin-top:-.125rem;height:1.25rem}.blok-settings-button{margin:0;display:inline-flex;min-height:26px;min-width:26px;cursor:pointer;align-items:center;justify-content:center;border-radius:3px;border-width:0px;background-color:transparent;vertical-align:bottom;color:inherit;outline:2px solid transparent;outline-offset:2px}@media(max-width:650px){.blok-settings-button{height:36px;width:36px;border-radius:.5rem}}@media(hover:hover){.blok-settings-button:hover{--tw-bg-opacity: 1;background-color:rgb(239 242 245 / var(--tw-bg-opacity, 1))}}.blok-settings-button svg{height:auto;width:auto}@media(max-width:650px){.blok-settings-button svg{height:28px;width:28px}}.blok-settings-button--active{--tw-text-opacity: 1;color:rgb(56 138 229 / var(--tw-text-opacity, 1))}.blok-settings-button--focused{background-color:#22baff14;--tw-shadow: inset 0 0 0 1px rgba(7, 161, 227, .08);--tw-shadow-colored: inset 0 0 0 1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}@keyframes buttonClicked{0%{transform:scale3d(.95,.95,.95)}60%{transform:scale3d(1.02,1.02,1.02)}80%,to{transform:scaleZ(1)}}.blok-settings-button--focused-animated{animation:buttonClicked .75s cubic-bezier(.215,.61,.355,1) forwards}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.invisible{visibility:hidden}.collapse{visibility:collapse}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.inset-\\[auto_var\\(--offset\\)_calc\\(var\\(--offset\\)\\+env\\(safe-area-inset-bottom\\)\\)_var\\(--offset\\)\\]{inset:auto var(--offset) calc(var(--offset) + env(safe-area-inset-bottom)) var(--offset)}.bottom-0{bottom:0}.bottom-5{bottom:1.25rem}.left-0{left:0}.left-5{left:1.25rem}.left-\\[var\\(--popover-left\\)\\]{left:var(--popover-left)}.right-0{right:0}.right-\\[15px\\]{right:15px}.right-full{right:100%}.top-0{top:0}.top-\\[7px\\]{top:7px}.top-\\[var\\(--popover-top\\)\\]{top:var(--popover-top)}.z-0{z-index:0}.z-\\[1\\]{z-index:1}.z-\\[2\\]{z-index:2}.z-\\[3\\]{z-index:3}.z-\\[4\\]{z-index:4}.z-overlay{z-index:999}.m-0{margin:0}.mx-auto{margin-left:auto;margin-right:auto}.my-2\\.5{margin-top:.625rem;margin-bottom:.625rem}.my-4{margin-top:1rem;margin-bottom:1rem}.\\!mr-0{margin-right:0!important}.\\!mr-2{margin-right:.5rem!important}.mb-1\\.5{margin-bottom:.375rem}.mb-2{margin-bottom:.5rem}.mb-\\[30px\\]{margin-bottom:30px}.mb-px{margin-bottom:1px}.ml-3\\.5{margin-left:.875rem}.mr-2{margin-right:.5rem}.mr-auto{margin-right:auto}.mt-1{margin-top:.25rem}.mt-\\[15px\\]{margin-top:15px}.mt-\\[3px\\]{margin-top:3px}.mt-\\[5px\\]{margin-top:5px}.box-border{box-sizing:border-box}.\\!block{display:block!important}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.contents{display:contents}.\\!hidden{display:none!important}.hidden{display:none}.h-2\\.5{height:.625rem}.h-9{height:2.25rem}.h-\\[26px\\]{height:26px}.h-\\[50px\\]{height:50px}.h-auto{height:auto}.h-fit{height:-moz-fit-content;height:fit-content}.h-full{height:100%}.h-px{height:1px}.h-toolbox-btn{height:26px}.max-h-0{max-height:0px}.max-h-\\[var\\(--max-height\\)\\]{max-height:var(--max-height)}.w-2\\.5{width:.625rem}.w-9{width:2.25rem}.w-\\[230px\\]{width:230px}.w-\\[26px\\]{width:26px}.w-\\[var\\(--width\\)\\]{width:var(--width)}.w-auto{width:auto}.w-full{width:100%}.w-max{width:-moz-max-content;width:max-content}.w-px{width:1px}.w-toolbox-btn{width:26px}.min-w-\\[calc\\(100\\%-theme\\(\\'spacing\\.6\\'\\)-10px\\)\\]{min-width:calc(100% - 1.5rem - 10px)}.min-w-\\[calc\\(100\\%-var\\(--offset\\)\\*2\\)\\]{min-width:calc(100% - var(--offset) * 2)}.min-w-\\[var\\(--width\\)\\]{min-width:var(--width)}.min-w-max{min-width:-moz-max-content;min-width:max-content}.max-w-\\[1100px\\]{max-width:1100px}.max-w-\\[130px\\]{max-width:130px}.max-w-content{max-width:650px}.max-w-none{max-width:none}.shrink-0{flex-shrink:0}.-translate-x-\\[5px\\]{--tw-translate-x: -5px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-\\[5px\\]{--tw-translate-y: -5px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\\[5px\\]{--tw-translate-x: 5px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\\[5px\\]{--tw-translate-y: 5px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-90{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform-none{transform:none}@keyframes panelShowingMobile{0%{opacity:0;transform:translateY(14px) scale(.98)}70%{opacity:1;transform:translateY(-4px)}to{transform:translateY(0)}}.animate-\\[panelShowingMobile_250ms_ease\\]{animation:panelShowingMobile .25s ease}@keyframes panelShowing{0%{opacity:0;transform:translateY(-8px) scale(.9)}70%{opacity:1;transform:translateY(2px)}to{transform:translateY(0)}}.animate-\\[panelShowing_100ms_ease\\]{animation:panelShowing .1s ease}@keyframes fade-in{0%{opacity:0}to{opacity:1}}.animate-fade-in{animation:fade-in .3s ease forwards}.animate-none{animation:none}@keyframes notifyBounceIn{0%{opacity:0;transform:scale(.3)}50%{opacity:1;transform:scale(1.05)}70%{transform:scale(.9)}to{transform:scale(1)}}.animate-notify-bounce-in{animation:notifyBounceIn .6s 1}@keyframes wobble{0%{transform:translateZ(0)}15%{transform:translate3d(-9%,0,0)}30%{transform:translate3d(9%,0,0)}45%{transform:translate3d(-4%,0,0)}60%{transform:translate3d(4%,0,0)}75%{transform:translate3d(-1%,0,0)}to{transform:translateZ(0)}}.animate-wobble{animation:wobble .4s}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.select-all{-webkit-user-select:all;-moz-user-select:all;user-select:all}.resize{resize:both}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-\\[auto_auto_1fr\\]{grid-template-columns:auto auto 1fr}.grid-rows-\\[auto\\]{grid-template-rows:auto}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.flex-nowrap{flex-wrap:nowrap}.items-center{align-items:center}.justify-center{justify-content:center}.gap-2{gap:.5rem}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.overscroll-contain{overscroll-behavior:contain}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.break-words{overflow-wrap:break-word}.rounded{border-radius:.25rem}.rounded-\\[10px\\]{border-radius:10px}.rounded-\\[3px\\]{border-radius:3px}.rounded-\\[5px\\]{border-radius:5px}.rounded-\\[7px\\]{border-radius:7px}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-t-lg{border-top-left-radius:.5rem;border-top-right-radius:.5rem}.border{border-width:1px}.border-0{border-width:0px}.border-b{border-bottom-width:1px}.border-t{border-top-width:1px}.border-none{border-style:none}.border-\\[\\#e8e8eb\\]{--tw-border-opacity: 1;border-color:rgb(232 232 235 / var(--tw-border-opacity, 1))}.border-\\[rgba\\(226\\,226\\,229\\,0\\.2\\)\\],.border-\\[rgba\\(226\\,226\\,229\\,0\\.20\\)\\]{border-color:#e2e2e533}.border-line-gray,.border-popover-border{--tw-border-opacity: 1;border-color:rgb(239 240 241 / var(--tw-border-opacity, 1))}.border-transparent{border-color:transparent}.\\!bg-\\[\\#fafffe\\]{--tw-bg-opacity: 1 !important;background-color:rgb(250 255 254 / var(--tw-bg-opacity, 1))!important}.\\!bg-\\[\\#fffbfb\\]{--tw-bg-opacity: 1 !important;background-color:rgb(255 251 251 / var(--tw-bg-opacity, 1))!important}.\\!bg-item-confirm-bg{--tw-bg-opacity: 1 !important;background-color:rgb(226 74 74 / var(--tw-bg-opacity, 1))!important}.\\!bg-item-focus-bg{background-color:#22baff14!important}.bg-\\[\\#34c992\\]{--tw-bg-opacity: 1;background-color:rgb(52 201 146 / var(--tw-bg-opacity, 1))}.bg-\\[\\#F8F8F8\\]{--tw-bg-opacity: 1;background-color:rgb(248 248 248 / var(--tw-bg-opacity, 1))}.bg-\\[\\#eff1f4\\]{--tw-bg-opacity: 1;background-color:rgb(239 241 244 / var(--tw-bg-opacity, 1))}.bg-\\[\\#f2f5f7\\]{--tw-bg-opacity: 1;background-color:rgb(242 245 247 / var(--tw-bg-opacity, 1))}.bg-\\[\\#f7f7f7\\]{--tw-bg-opacity: 1;background-color:rgb(247 247 247 / var(--tw-bg-opacity, 1))}.bg-bg-light{--tw-bg-opacity: 1;background-color:rgb(239 242 245 / var(--tw-bg-opacity, 1))}.bg-dark{--tw-bg-opacity: 1;background-color:rgb(29 32 43 / var(--tw-bg-opacity, 1))}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-icon-active-bg{background-color:#388ae51a}.bg-item-hover-bg{--tw-bg-opacity: 1;background-color:rgb(248 248 248 / var(--tw-bg-opacity, 1))}.bg-popover-bg{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-popover-border{--tw-bg-opacity: 1;background-color:rgb(239 240 241 / var(--tw-bg-opacity, 1))}.bg-selection{--tw-bg-opacity: 1;background-color:rgb(225 242 255 / var(--tw-bg-opacity, 1))}.bg-selection-highlight{background-color:#2eaadc33}.bg-tooltip-bg{--tw-bg-opacity: 1;background-color:rgb(29 32 43 / var(--tw-bg-opacity, 1))}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.p-0{padding:0}.p-0\\.5{padding:.125rem}.p-1{padding:.25rem}.p-1\\.5{padding:.375rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-\\[3px\\]{padding:3px}.p-\\[5px\\]{padding:5px}.p-\\[var\\(--item-padding\\)\\]{padding:var(--item-padding)}.px-0{padding-left:0;padding-right:0}.px-1{padding-left:.25rem;padding-right:.25rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-\\[18px\\]{padding-left:18px;padding-right:18px}.px-\\[30px\\]{padding-left:30px;padding-right:30px}.px-\\[3px\\]{padding-left:3px;padding-right:3px}.py-0{padding-top:0;padding-bottom:0}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-\\[0\\.6em\\]{padding-top:.6em;padding-bottom:.6em}.py-\\[13px\\]{padding-top:13px;padding-bottom:13px}.py-\\[3px\\]{padding-top:3px;padding-bottom:3px}.py-\\[5px\\]{padding-top:5px;padding-bottom:5px}.pb-\\[3px\\]{padding-bottom:3px}.pr-1\\.5{padding-right:.375rem}.pr-\\[5px\\]{padding-right:5px}.text-center{text-align:center}.text-start{text-align:start}.font-\\[-apple-system\\,BlinkMacSystemFont\\,\\"Segoe_UI\\"\\,\\"Roboto\\"\\,\\"Oxygen\\"\\,\\"Ubuntu\\"\\,\\"Cantarell\\"\\,\\"Fira_Sans\\"\\,\\"Droid_Sans\\"\\,\\"Helvetica_Neue\\"\\,sans-serif\\]{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif}.font-\\[inherit\\]{font-family:inherit}.font-sans{font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"}.text-\\[1\\.25em\\]{font-size:1.25em}.text-\\[1\\.5em\\]{font-size:1.5em}.text-\\[1\\.75em\\]{font-size:1.75em}.text-\\[13px\\]{font-size:13px}.text-\\[2\\.5em\\]{font-size:2.5em}.text-\\[2em\\]{font-size:2em}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.capitalize{text-transform:capitalize}.italic{font-style:italic}.leading-5{line-height:1.25rem}.leading-\\[1\\.25em\\]{line-height:1.25em}.leading-\\[1\\.4em\\]{line-height:1.4em}.leading-\\[1\\.6em\\]{line-height:1.6em}.leading-\\[1em\\]{line-height:1em}.leading-\\[22px\\]{line-height:22px}.leading-\\[50px\\]{line-height:50px}.leading-relaxed{line-height:1.625}.leading-tight{line-height:1.25}.-tracking-widest{letter-spacing:-.1em}.tracking-\\[0\\.02em\\]{letter-spacing:.02em}.\\!text-white{--tw-text-opacity: 1 !important;color:rgb(255 255 255 / var(--tw-text-opacity, 1))!important}.text-\\[\\#656b7c\\]{--tw-text-opacity: 1;color:rgb(101 107 124 / var(--tw-text-opacity, 1))}.text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-dark{--tw-text-opacity: 1;color:rgb(29 32 43 / var(--tw-text-opacity, 1))}.text-gray-text{--tw-text-opacity: 1;color:rgb(112 118 132 / var(--tw-text-opacity, 1))}.text-icon-active-text{--tw-text-opacity: 1;color:rgb(56 138 229 / var(--tw-text-opacity, 1))}.text-inherit{color:inherit}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-text-primary{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.text-text-secondary{--tw-text-opacity: 1;color:rgb(112 118 132 / var(--tw-text-opacity, 1))}.text-tooltip-font{--tw-text-opacity: 1;color:rgb(205 209 224 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.no-underline{text-decoration-line:none}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-50{opacity:.5}.opacity-55{opacity:.55}.opacity-60{opacity:.6}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\\[0_11px_17px_0_rgba\\(23\\,32\\,61\\,0\\.13\\)\\]{--tw-shadow: 0 11px 17px 0 rgba(23,32,61,.13);--tw-shadow-colored: 0 11px 17px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\\[0_1px_1px_0_rgba\\(18\\,49\\,35\\,0\\.05\\)\\]{--tw-shadow: 0 1px 1px 0 rgba(18,49,35,.05);--tw-shadow-colored: 0 1px 1px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\\[0_2px_1px_0_rgba\\(16\\,19\\,29\\,0\\)\\]{--tw-shadow: 0 2px 1px 0 rgba(16,19,29,0);--tw-shadow-colored: 0 2px 1px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\\[0_3px_15px_-3px_theme\\(colors\\.popover-shadow\\)\\]{--tw-shadow: 0 3px 15px -3px rgba(13, 20, 33, .1);--tw-shadow-colored: 0 3px 15px -3px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-tooltip{--tw-shadow: 0 8px 12px 0 rgba(29, 32, 43, .17), 0 4px 5px -3px rgba(5, 6, 12, .49);--tw-shadow-colored: 0 8px 12px 0 var(--tw-shadow-color), 0 4px 5px -3px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\\[opacity\\,transform\\]{transition-property:opacity,transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-100{transition-duration:.1s}.duration-150{transition-duration:.15s}.duration-\\[120ms\\]{transition-duration:.12s}.duration-\\[250ms\\]{transition-duration:.25s}.duration-\\[50ms\\,70ms\\]{transition-duration:50ms,70ms}.ease-in{transition-timing-function:cubic-bezier(.4,0,1,1)}.ease-linear{transition-timing-function:linear}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.will-change-\\[opacity\\,left\\,top\\]{will-change:opacity,left,top}.will-change-\\[opacity\\,top\\,left\\]{will-change:opacity,top,left}.will-change-\\[opacity\\,top\\]{will-change:opacity,top}.will-change-\\[opacity\\]{will-change:opacity}.\\[direction\\:rtl\\]{direction:rtl}.placeholder\\:font-medium::-moz-placeholder{font-weight:500}.placeholder\\:font-medium::placeholder{font-weight:500}.placeholder\\:text-\\[\\#656b7c\\]::-moz-placeholder{--tw-text-opacity: 1;color:rgb(101 107 124 / var(--tw-text-opacity, 1))}.placeholder\\:text-\\[\\#656b7c\\]::placeholder{--tw-text-opacity: 1;color:rgb(101 107 124 / var(--tw-text-opacity, 1))}.placeholder\\:text-gray-text::-moz-placeholder{--tw-text-opacity: 1;color:rgb(112 118 132 / var(--tw-text-opacity, 1))}.placeholder\\:text-gray-text::placeholder{--tw-text-opacity: 1;color:rgb(112 118 132 / var(--tw-text-opacity, 1))}.before\\:absolute:before{content:var(--tw-content);position:absolute}.before\\:inset-0:before{content:var(--tw-content);inset:0}.before\\:left-0:before{content:var(--tw-content);left:0}.before\\:left-\\[9px\\]:before{content:var(--tw-content);left:9px}.before\\:top-0:before{content:var(--tw-content);top:0}.before\\:top-\\[5px\\]:before{content:var(--tw-content);top:5px}.before\\:-z-10:before{content:var(--tw-content);z-index:-10}.before\\:m-\\[3px\\]:before{content:var(--tw-content);margin:3px}.before\\:block:before{content:var(--tw-content);display:block}.before\\:h-3:before{content:var(--tw-content);height:.75rem}.before\\:h-\\[calc\\(100\\%-6px\\)\\]:before{content:var(--tw-content);height:calc(100% - 6px)}.before\\:w-0\\.5:before{content:var(--tw-content);width:.125rem}.before\\:w-\\[3px\\]:before{content:var(--tw-content);width:3px}.before\\:rotate-\\[-45deg\\]:before{content:var(--tw-content);--tw-rotate: -45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.before\\:rounded-\\[5px\\]:before{content:var(--tw-content);border-radius:5px}.before\\:rounded-lg:before{content:var(--tw-content);border-radius:.5rem}.before\\:\\!bg-\\[\\#41ffb1\\]:before{content:var(--tw-content);--tw-bg-opacity: 1 !important;background-color:rgb(65 255 177 / var(--tw-bg-opacity, 1))!important}.before\\:\\!bg-\\[\\#fb5d5d\\]:before{content:var(--tw-content);--tw-bg-opacity: 1 !important;background-color:rgb(251 93 93 / var(--tw-bg-opacity, 1))!important}.before\\:bg-\\[\\#575d67\\]:before{content:var(--tw-content);--tw-bg-opacity: 1;background-color:rgb(87 93 103 / var(--tw-bg-opacity, 1))}.before\\:bg-tooltip-bg:before{content:var(--tw-content);--tw-bg-opacity: 1;background-color:rgb(29 32 43 / var(--tw-bg-opacity, 1))}.before\\:bg-transparent:before{content:var(--tw-content);background-color:transparent}.before\\:content-\\[\\"\\"\\]:before{--tw-content: "";content:var(--tw-content)}.before\\:content-\\[\\\\\\'\\\\\\'\\]:before{--tw-content: \\'\\';content:var(--tw-content)}.after\\:absolute:after{content:var(--tw-content);position:absolute}.after\\:left-\\[9px\\]:after{content:var(--tw-content);left:9px}.after\\:top-\\[5px\\]:after{content:var(--tw-content);top:5px}.after\\:mx-3:after{content:var(--tw-content);margin-left:.75rem;margin-right:.75rem}.after\\:h-3:after{content:var(--tw-content);height:.75rem}.after\\:w-0\\.5:after{content:var(--tw-content);width:.125rem}.after\\:rotate-45:after{content:var(--tw-content);--tw-rotate: 45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.after\\:bg-\\[\\#575d67\\]:after{content:var(--tw-content);--tw-bg-opacity: 1;background-color:rgb(87 93 103 / var(--tw-bg-opacity, 1))}.after\\:text-\\[\\#ddd\\]:after{content:var(--tw-content);--tw-text-opacity: 1;color:rgb(221 221 221 / var(--tw-text-opacity, 1))}.after\\:content-\\[\\"\\"\\]:after{--tw-content: "";content:var(--tw-content)}.after\\:content-\\[\\'\\|\\'\\]:after{--tw-content: "|";content:var(--tw-content)}.first\\:mt-0:first-child{margin-top:0}.last\\:ml-2\\.5:last-child{margin-left:.625rem}.empty\\:before\\:pointer-events-none:empty:before{content:var(--tw-content);pointer-events:none}.empty\\:before\\:cursor-text:empty:before{content:var(--tw-content);cursor:text}.empty\\:before\\:text-gray-text:empty:before{content:var(--tw-content);--tw-text-opacity: 1;color:rgb(112 118 132 / var(--tw-text-opacity, 1))}.empty\\:before\\:content-\\[attr\\(data-blok-placeholder\\)\\]:empty:before{--tw-content: attr(data-blok-placeholder);content:var(--tw-content)}.empty\\:before\\:content-\\[attr\\(data-placeholder-active\\)\\]:empty:before{--tw-content: attr(data-placeholder-active);content:var(--tw-content)}.hover\\:bg-\\[\\#2db583\\]:hover{--tw-bg-opacity: 1;background-color:rgb(45 181 131 / var(--tw-bg-opacity, 1))}.hover\\:bg-\\[\\#e0e4eb\\]:hover{--tw-bg-opacity: 1;background-color:rgb(224 228 235 / var(--tw-bg-opacity, 1))}.hover\\:bg-\\[\\#e9ecee\\]:hover{--tw-bg-opacity: 1;background-color:rgb(233 236 238 / var(--tw-bg-opacity, 1))}.hover\\:opacity-100:hover{opacity:1}.focus\\:placeholder\\:text-\\[rgba\\(101\\,107\\,124\\,0\\.3\\)\\]:focus::-moz-placeholder{color:#656b7c4d}.focus\\:placeholder\\:text-\\[rgba\\(101\\,107\\,124\\,0\\.3\\)\\]:focus::placeholder{color:#656b7c4d}.active\\:cursor-grabbing:active{cursor:grabbing}.group[data-blok-dragging=true] .group-data-\\[blok-dragging\\=true\\]\\:pointer-events-none{pointer-events:none}.group[data-blok-rtl=true] .group-data-\\[blok-rtl\\=true\\]\\:left-\\[calc\\(-1\\*theme\\(width\\.toolbox-btn\\)\\)\\]{left:-26px}.group[data-blok-rtl=true] .group-data-\\[blok-rtl\\=true\\]\\:left-auto{left:auto}.group[data-blok-rtl=true] .group-data-\\[blok-rtl\\=true\\]\\:right-\\[calc\\(-1\\*theme\\(width\\.toolbox-btn\\)\\)\\]{right:-26px}.group[data-blok-rtl=true] .group-data-\\[blok-rtl\\=true\\]\\:right-auto{right:auto}.group[data-blok-dragging=true] .group-data-\\[blok-dragging\\=true\\]\\:cursor-grabbing{cursor:grabbing}@media(max-width:650px){.mobile\\:absolute{position:absolute}.mobile\\:right-auto{right:auto}.mobile\\:z-\\[2\\]{z-index:2}.mobile\\:hidden{display:none}.mobile\\:h-toolbox-btn-mobile{height:36px}.mobile\\:w-toolbox-btn-mobile{width:36px}.mobile\\:rounded-\\[6px\\]{border-radius:6px}.mobile\\:border{border-width:1px}.mobile\\:border-\\[\\#e8e8eb\\]{--tw-border-opacity: 1;border-color:rgb(232 232 235 / var(--tw-border-opacity, 1))}.mobile\\:bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.mobile\\:p-1{padding:.25rem}.mobile\\:text-\\[15px\\]{font-size:15px}.mobile\\:font-medium{font-weight:500}.mobile\\:shadow-overlay-pane{--tw-shadow: 0 3px 15px -3px rgba(13, 20, 33, .13);--tw-shadow-colored: 0 3px 15px -3px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.group[data-blok-rtl=true] .mobile\\:group-data-\\[blok-rtl\\=true\\]\\:ml-0{margin-left:0}.group[data-blok-rtl=true] .mobile\\:group-data-\\[blok-rtl\\=true\\]\\:mr-auto{margin-right:auto}.group[data-blok-rtl=true] .mobile\\:group-data-\\[blok-rtl\\=true\\]\\:pl-\\[10px\\]{padding-left:10px}.group[data-blok-rtl=true] .mobile\\:group-data-\\[blok-rtl\\=true\\]\\:pr-0{padding-right:0}}@media(min-width:651px){.not-mobile\\:w-6{width:1.5rem}.group[data-blok-narrow=true][data-blok-rtl=true] .not-mobile\\:group-data-\\[blok-narrow\\=true\\]\\:group-data-\\[blok-rtl\\=true\\]\\:left-0{left:0}.group[data-blok-narrow=true][data-blok-rtl=true] .not-mobile\\:group-data-\\[blok-narrow\\=true\\]\\:group-data-\\[blok-rtl\\=true\\]\\:left-\\[-5px\\]{left:-5px}.group[data-blok-narrow=true][data-blok-rtl=true] .not-mobile\\:group-data-\\[blok-narrow\\=true\\]\\:group-data-\\[blok-rtl\\=true\\]\\:left-\\[calc\\(-1\\*theme\\(spacing\\.narrow-mode-right-padding\\)-5px\\)\\]{left:-55px}.group[data-blok-narrow=true][data-blok-rtl=true] .not-mobile\\:group-data-\\[blok-narrow\\=true\\]\\:group-data-\\[blok-rtl\\=true\\]\\:right-\\[5px\\]{right:5px}.group[data-blok-narrow=true][data-blok-rtl=true] .not-mobile\\:group-data-\\[blok-narrow\\=true\\]\\:group-data-\\[blok-rtl\\=true\\]\\:right-auto{right:auto}.group[data-blok-narrow=true] .not-mobile\\:group-data-\\[blok-narrow\\=true\\]\\:left-\\[5px\\]{left:5px}.group[data-blok-narrow=true] .not-mobile\\:group-data-\\[blok-narrow\\=true\\]\\:right-\\[calc\\(-1\\*theme\\(spacing\\.narrow-mode-right-padding\\)-5px\\)\\]{right:-55px}.group[data-blok-narrow=true][data-blok-rtl=true] .not-mobile\\:group-data-\\[blok-narrow\\=true\\]\\:group-data-\\[blok-rtl\\=true\\]\\:ml-\\[theme\\(spacing\\.narrow-mode-right-padding\\)\\]{margin-left:50px}.group[data-blok-narrow=true][data-blok-rtl=true] .not-mobile\\:group-data-\\[blok-narrow\\=true\\]\\:group-data-\\[blok-rtl\\=true\\]\\:mr-0{margin-right:0}.group[data-blok-narrow=true] .not-mobile\\:group-data-\\[blok-narrow\\=true\\]\\:mr-\\[theme\\(spacing\\.narrow-mode-right-padding\\)\\]{margin-right:50px}}@media(hover:hover){.can-hover\\:hover\\:cursor-grab:hover{cursor:grab}.can-hover\\:hover\\:cursor-pointer:hover{cursor:pointer}.can-hover\\:hover\\:bg-bg-light:hover{--tw-bg-opacity: 1;background-color:rgb(239 242 245 / var(--tw-bg-opacity, 1))}.can-hover\\:hover\\:bg-item-hover-bg:hover{--tw-bg-opacity: 1;background-color:rgb(248 248 248 / var(--tw-bg-opacity, 1))}.group[data-blok-toolbox-opened=true] .group-data-\\[blok-toolbox-opened\\=true\\]\\:can-hover\\:hover\\:cursor-pointer:hover{cursor:pointer}}.\\[\\&\\>p\\:first-of-type\\]\\:mt-0>p:first-of-type{margin-top:0}.\\[\\&\\>p\\:last-of-type\\]\\:mb-0>p:last-of-type{margin-bottom:0}.\\[\\&\\[data-blok-dragging\\=true\\]\\]\\:cursor-grabbing[data-blok-dragging=true]{cursor:grabbing}.\\[\\&\\[data-blok-empty\\=true\\]\\]\\:before\\:pointer-events-none[data-blok-empty=true]:before{content:var(--tw-content);pointer-events:none}.\\[\\&\\[data-blok-empty\\=true\\]\\]\\:before\\:cursor-text[data-blok-empty=true]:before{content:var(--tw-content);cursor:text}.\\[\\&\\[data-blok-empty\\=true\\]\\]\\:before\\:text-gray-text[data-blok-empty=true]:before{content:var(--tw-content);--tw-text-opacity: 1;color:rgb(112 118 132 / var(--tw-text-opacity, 1))}.\\[\\&\\[data-blok-empty\\=true\\]\\]\\:before\\:content-\\[attr\\(data-blok-placeholder\\)\\][data-blok-empty=true]:before{--tw-content: attr(data-blok-placeholder);content:var(--tw-content)}.\\[\\&\\[data-blok-focused\\=\\"true\\"\\]\\]\\:bg-item-focus-bg[data-blok-focused=true]{background-color:#22baff14}.\\[\\&\\[data-blok-force-hover\\]\\]\\:cursor-pointer[data-blok-force-hover]{cursor:pointer}.\\[\\&\\[data-blok-force-hover\\]\\]\\:bg-item-hover-bg[data-blok-force-hover]{--tw-bg-opacity: 1;background-color:rgb(248 248 248 / var(--tw-bg-opacity, 1))}.\\[\\&\\[data-blok-popover-item-no-hover\\]\\]\\:cursor-default[data-blok-popover-item-no-hover]{cursor:default}.\\[\\&\\[data-blok-popover-item-no-hover\\]\\]\\:hover\\:bg-transparent:hover[data-blok-popover-item-no-hover]{background-color:transparent}.\\[\\&\\[data-blok-toolbox-opened\\=true\\]_\\[contentEditable\\=true\\]\\[data-blok-placeholder\\]\\:focus\\]\\:before\\:\\!opacity-0[data-blok-toolbox-opened=true] [contentEditable=true][data-blok-placeholder]:focus:before{content:var(--tw-content);opacity:0!important}.\\[\\&\\[data-empty\\=true\\]\\]\\:before\\:pointer-events-none[data-empty=true]:before{content:var(--tw-content);pointer-events:none}.\\[\\&\\[data-empty\\=true\\]\\]\\:before\\:cursor-text[data-empty=true]:before{content:var(--tw-content);cursor:text}.\\[\\&\\[data-empty\\=true\\]\\]\\:before\\:text-gray-text[data-empty=true]:before{content:var(--tw-content);--tw-text-opacity: 1;color:rgb(112 118 132 / var(--tw-text-opacity, 1))}.\\[\\&\\[data-empty\\=true\\]\\]\\:before\\:content-\\[attr\\(data-placeholder-active\\)\\][data-empty=true]:before{--tw-content: attr(data-placeholder-active);content:var(--tw-content)}.\\[\\&_\\:\\:selection\\]\\:bg-selection-inline ::-moz-selection{--tw-bg-opacity: 1;background-color:rgb(212 236 255 / var(--tw-bg-opacity, 1))}.\\[\\&_\\:\\:selection\\]\\:bg-selection-inline ::selection{--tw-bg-opacity: 1;background-color:rgb(212 236 255 / var(--tw-bg-opacity, 1))}.\\[\\&_\\[contenteditable\\]\\:empty\\]\\:after\\:content-\\[\\"\\\\\\\\feff_\\"\\] [contenteditable]:empty:after{--tw-content: "\\\\feff ";content:var(--tw-content)}.\\[\\&_\\[contenteditable\\]\\]\\:select-none [contenteditable]{-webkit-user-select:none;-moz-user-select:none;user-select:none}.\\[\\&_\\[data-blok-tool\\=stub\\]\\]\\:opacity-55 [data-blok-tool=stub]{opacity:.55}.\\[\\&_\\[hidden\\]\\]\\:\\!hidden [hidden]{display:none!important}.\\[\\&_a\\]\\:cursor-pointer a{cursor:pointer}.\\[\\&_a\\]\\:text-link a{--tw-text-opacity: 1;color:rgb(56 138 229 / var(--tw-text-opacity, 1))}.\\[\\&_a\\]\\:underline a{text-decoration-line:underline}.\\[\\&_b\\]\\:font-bold b{font-weight:700}.\\[\\&_div\\]\\:\\!m-0 div{margin:0!important}.\\[\\&_div\\]\\:\\!p-0 div{padding:0!important}.\\[\\&_i\\]\\:italic i{font-style:italic}.\\[\\&_img\\]\\:opacity-55 img{opacity:.55}.\\[\\&_p\\]\\:\\!m-0 p{margin:0!important}.\\[\\&_p\\]\\:\\!p-0 p{padding:0!important}.\\[\\&_path\\]\\:stroke-current path{stroke:currentColor}.\\[\\&_svg\\]\\:block svg{display:block}.\\[\\&_svg\\]\\:size-icon svg{width:20px;height:20px}.\\[\\&_svg\\]\\:h-6 svg{height:1.5rem}.\\[\\&_svg\\]\\:h-7 svg{height:1.75rem}.\\[\\&_svg\\]\\:h-icon svg{height:20px}.\\[\\&_svg\\]\\:max-h-full svg{max-height:100%}.\\[\\&_svg\\]\\:w-6 svg{width:1.5rem}.\\[\\&_svg\\]\\:w-7 svg{width:1.75rem}.\\[\\&_svg\\]\\:w-icon svg{width:20px}.\\[\\&_svg\\]\\:text-gray-text svg{--tw-text-opacity: 1;color:rgb(112 118 132 / var(--tw-text-opacity, 1))}@media(max-width:650px){.mobile\\:\\[\\&_svg\\]\\:h-icon-mobile svg{height:28px}.mobile\\:\\[\\&_svg\\]\\:w-icon-mobile svg{width:28px}}`;class Lv extends z{constructor(){super(...arguments),this.isMobile=!1,this.contentRectCache=null,this.resizeDebouncer=Ld(()=>{this.windowResize()},200),this.selectionChangeDebounced=Ld(()=>{this.selectionChanged()},zg),this.documentTouchedListener=e=>{this.documentTouched(e)}}get contentRect(){if(this.contentRectCache!==null)return this.contentRectCache;const e=this.nodes.wrapper.querySelector('[data-blok-testid="block-content"]');return e?(this.contentRectCache=e.getBoundingClientRect(),this.contentRectCache):{width:650,left:0,right:0}}async prepare(){this.setIsMobile(),this.make(),this.loadStyles()}toggleReadOnly(e){if(e){this.unbindReadOnlySensitiveListeners();return}const t=()=>{this.bindReadOnlySensitiveListeners()};t();const o=window.requestIdleCallback;typeof o=="function"&&o(t,{timeout:2e3})}checkEmptiness(){const{BlockManager:e}=this.Blok;this.nodes.wrapper.setAttribute(cm,e.isBlokEmpty?"true":"false")}get someToolbarOpened(){const{Toolbar:e,BlockSettings:t,InlineToolbar:o}=this.Blok;return!!(t.opened||o.opened||e.toolbox.opened)}get someFlipperButtonFocused(){return this.Blok.Toolbar.toolbox.hasFocus()?!0:Object.entries(this.Blok).filter(([e,t])=>t.flipper instanceof st).some(([e,t])=>t.flipper.hasFocus())}destroy(){this.nodes.holder.innerHTML="",this.unbindReadOnlyInsensitiveListeners()}closeAllToolbars(){const{Toolbar:e,BlockSettings:t,InlineToolbar:o}=this.Blok;t.close(),o.close(),e.toolbox.close()}setIsMobile(){const e=window.innerWidth<Pd;e!==this.isMobile&&this.eventsDispatcher.emit(Jt,{isEnabled:this.isMobile}),this.isMobile=e}make(){const e=this.config.holder;if(!e)throw new Error("Blok holder is not specified in the configuration.");this.nodes.holder=v.getHolder(e),this.nodes.wrapper=v.make("div",["group","relative","box-border","z-[1]","[&[data-blok-dragging=true]]:cursor-grabbing","[&_svg]:max-h-full","[&_path]:stroke-current","[&_::selection]:bg-selection-inline","[&[data-blok-toolbox-opened=true]_[contentEditable=true][data-blok-placeholder]:focus]:before:!opacity-0",...this.isRtl?["[direction:rtl]"]:[]]),this.nodes.wrapper.setAttribute(Ot,Ug),this.nodes.wrapper.setAttribute($g,""),this.nodes.wrapper.setAttribute("data-blok-testid","blok-editor"),this.isRtl&&this.nodes.wrapper.setAttribute(Yg,"true"),this.nodes.redactor=v.make("div",["not-mobile:group-data-[blok-narrow=true]:mr-[theme(spacing.narrow-mode-right-padding)]","not-mobile:group-data-[blok-narrow=true]:group-data-[blok-rtl=true]:ml-[theme(spacing.narrow-mode-right-padding)]","not-mobile:group-data-[blok-narrow=true]:group-data-[blok-rtl=true]:mr-0",'[&_[contenteditable]:empty]:after:content-["\\feff_"]']),this.nodes.redactor.setAttribute(Vg,""),this.nodes.redactor.setAttribute("data-blok-testid","redactor"),this.nodes.holder.offsetWidth<this.contentRect.width&&this.nodes.wrapper.setAttribute(Xg,"true"),this.nodes.redactor.style.paddingBottom=this.config.minHeight+"px",this.nodes.wrapper.appendChild(this.nodes.redactor),this.nodes.holder.appendChild(this.nodes.wrapper),this.bindReadOnlyInsensitiveListeners()}loadStyles(){const e="blok-styles";if(v.get(e))return;const t=v.make("style",null,{id:e,textContent:_v.toString()});this.config.style&&!le(this.config.style)&&this.config.style.nonce&&t.setAttribute("nonce",this.config.style.nonce),v.prepend(document.head,t)}bindReadOnlyInsensitiveListeners(){this.listeners.on(document,"selectionchange",this.selectionChangeDebounced),this.listeners.on(window,"resize",this.resizeDebouncer,{passive:!0}),this.listeners.on(this.nodes.redactor,"mousedown",this.documentTouchedListener,{capture:!0,passive:!0}),this.listeners.on(this.nodes.redactor,"touchstart",this.documentTouchedListener,{capture:!0,passive:!0})}unbindReadOnlyInsensitiveListeners(){this.listeners.off(document,"selectionchange",this.selectionChangeDebounced),this.listeners.off(window,"resize",this.resizeDebouncer),this.listeners.off(this.nodes.redactor,"mousedown",this.documentTouchedListener),this.listeners.off(this.nodes.redactor,"touchstart",this.documentTouchedListener)}bindReadOnlySensitiveListeners(){this.readOnlyMutableListeners.on(this.nodes.redactor,"click",e=>{e instanceof MouseEvent&&this.redactorClicked(e)},!1),this.readOnlyMutableListeners.on(document,"keydown",e=>{e instanceof KeyboardEvent&&this.documentKeydown(e)},!0),this.readOnlyMutableListeners.on(document,"mousedown",e=>{e instanceof MouseEvent&&this.documentClicked(e)},!0),this.watchBlockHoveredEvents(),this.enableInputsEmptyMark()}watchBlockHoveredEvents(){const e={lastHovered:null},o=ts(n=>{var c;const i=typeof MouseEvent!="undefined"&&n instanceof MouseEvent,s=typeof TouchEvent!="undefined"&&n instanceof TouchEvent;if(!i&&!s)return;const a=(c=n.target)==null?void 0:c.closest('[data-blok-testid="block-wrapper"]');if(this.Blok.BlockSelection.anyBlockSelected||!a||e.lastHovered===a)return;e.lastHovered=a;const l=this.Blok.BlockManager.getBlockByChildNode(a);l&&this.eventsDispatcher.emit(Su,{block:l})},20);this.readOnlyMutableListeners.on(this.nodes.redactor,"mousemove",n=>{o(n)},{passive:!0})}unbindReadOnlySensitiveListeners(){this.readOnlyMutableListeners.clearAll()}windowResize(){this.contentRectCache=null,this.setIsMobile()}documentKeydown(e){var o;switch((o=e.key)!=null?o:""){case"Enter":this.enterPressed(e);break;case"Backspace":case"Delete":this.backspacePressed(e);break;case"Escape":this.escapePressed(e);break;default:this.defaultBehaviour(e);break}}defaultBehaviour(e){const{currentBlock:t}=this.Blok.BlockManager,o=e.target.closest('[data-blok-testid="blok-editor"]'),n=e.altKey||e.ctrlKey||e.metaKey||e.shiftKey;if(!this.Blok.BlockSettings.contains(e.target)){if(t!==void 0&&o===null){this.Blok.BlockEvents.keydown(e);return}o||t&&n||(this.Blok.BlockManager.unsetCurrentBlock(),this.Blok.Toolbar.close())}}backspacePressed(e){if(this.Blok.BlockSettings.contains(e.target))return;const{BlockManager:t,BlockSelection:o,Caret:n}=this.Blok,i=O.isSelectionExists,s=O.isCollapsed;if(!(o.anyBlockSelected&&(!i||s===!0||this.Blok.CrossBlockSelection.isCrossBlockSelectionStarted)))return;const l=t.removeSelectedBlocks();if(l===void 0)return;const c=t.insertDefaultBlockAtIndex(l,!0);n.setToBlock(c,n.positions.START),o.clearSelection(e),e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation()}escapePressed(e){if(this.Blok.BlockSelection.clearSelection(e),this.Blok.Toolbar.toolbox.opened){this.Blok.Toolbar.toolbox.close(),this.Blok.BlockManager.currentBlock&&this.Blok.Caret.setToBlock(this.Blok.BlockManager.currentBlock,this.Blok.Caret.positions.END);return}if(this.Blok.BlockSettings.opened){this.Blok.BlockSettings.close();return}if(this.Blok.InlineToolbar.opened){this.Blok.InlineToolbar.close();return}this.Blok.Toolbar.close()}enterPressed(e){const{BlockManager:t,BlockSelection:o}=this.Blok;if(this.someToolbarOpened)return;const n=t.currentBlockIndex>=0,i=O.isSelectionExists,s=O.isCollapsed;if(o.anyBlockSelected&&(!i||s===!0)){o.clearSelection(e),e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation();return}if(!this.someToolbarOpened&&n&&e.target.tagName==="BODY"){const a=this.Blok.BlockManager.insert();e.preventDefault(),this.Blok.Caret.setToBlock(a),this.Blok.Toolbar.moveAndOpen(a)}this.Blok.BlockSelection.clearSelection(e)}documentClicked(e){var p,f;if(!e.isTrusted)return;const t=e.target,o=this.nodes.holder.contains(t)||O.isAtBlok,n=this.nodes.redactor.contains(t),i=this.Blok.Toolbar.contains(t);(!(o||i)||!n&&!i)&&(this.Blok.BlockManager.unsetCurrentBlock(),this.Blok.Toolbar.close());const l=this.Blok.BlockSettings.contains(t),c=(p=this.Blok.Toolbar.nodes.settingsToggler)==null?void 0:p.contains(t),d=(f=this.Blok.Toolbar.nodes.plusButton)==null?void 0:f.contains(t),u=l||c||d,h=this.Blok.BlockSettings.opened&&!u;if(h&&this.Blok.BlockSettings.close(),h&&n){const g=this.Blok.BlockManager.getBlockByChildNode(t);this.Blok.Toolbar.moveAndOpen(g)}this.Blok.BlockSelection.clearSelection(e)}documentTouched(e){const t=e.target,o=(()=>{if(t!==this.nodes.redactor)return t;if(e instanceof MouseEvent){const n=document.elementFromPoint(e.clientX,e.clientY);return n!=null?n:t}if(e instanceof TouchEvent&&e.touches.length>0){const{clientX:n,clientY:i}=e.touches[0],s=document.elementFromPoint(n,i);return s!=null?s:t}return t})();try{this.Blok.BlockManager.setCurrentBlockByChildNode(o)}catch(n){this.Blok.RectangleSelection.isRectActivated()||this.Blok.Caret.setToTheLastBlock()}!this.Blok.ReadOnly.isEnabled&&!this.Blok.Toolbar.contains(t)&&this.Blok.Toolbar.moveAndOpen()}redactorClicked(e){if(!O.isCollapsed)return;const t=e.target,o=e.metaKey||e.ctrlKey;if(!(v.isAnchor(t)&&o)){this.processBottomZoneClick(e);return}e.stopImmediatePropagation(),e.stopPropagation();const i=t.getAttribute("href");if(!i)return;const s=Yp(i);Jp(s)}processBottomZoneClick(e){var d,u;const t=this.Blok.BlockManager.getBlockByIndex(-1),o=v.offset(t.holder).bottom,n=e.pageY,{BlockSelection:i}=this.Blok;if(!(e.target instanceof Element&&e.target.isEqualNode(this.nodes.redactor)&&!i.anyBlockSelected&&o<n))return;e.stopImmediatePropagation(),e.stopPropagation();const{BlockManager:a,Caret:l,Toolbar:c}=this.Blok;(!((d=a.lastBlock)!=null&&d.tool.isDefault)||!((u=a.lastBlock)!=null&&u.isEmpty))&&a.insertAtEnd(),l.setToTheLastBlock(),c.moveAndOpen(a.lastBlock)}selectionChanged(){var c,d,u;const{CrossBlockSelection:e,BlockSelection:t}=this.Blok,o=O.anchorElement;if(e.isCrossBlockSelectionStarted&&t.anyBlockSelected&&((c=O.get())==null||c.removeAllRanges()),document.querySelector('[data-blok-fake-background="true"]')!==null&&((u=(d=this.Blok)==null?void 0:d.InlineToolbar)!=null&&u.opened)||(!o&&!O.range&&this.Blok.InlineToolbar.close(),!o))return;const i=o.closest('[data-blok-testid="block-content"]'),s=i===null||i.closest('[data-blok-testid="blok-editor"]')!==this.nodes.wrapper,a=o.getAttribute("data-blok-inline-toolbar")==="true";s&&!this.Blok.InlineToolbar.containsNode(o)&&this.Blok.InlineToolbar.close(),!(s&&!a)&&(this.Blok.BlockManager.currentBlock||this.Blok.BlockManager.setCurrentBlockByChildNode(o),this.Blok.InlineToolbar.tryToShow(!0))}enableInputsEmptyMark(){const e=t=>{const o=t.target;Fd(o)};this.readOnlyMutableListeners.on(this.nodes.wrapper,"input",e),this.readOnlyMutableListeners.on(this.nodes.wrapper,"focusin",e),this.readOnlyMutableListeners.on(this.nodes.wrapper,"focusout",e)}}const Dv=30,Mv=200,Pv=100,Et=class Et extends z{constructor(){super(...arguments),this.undoStack=[],this.redoStack=[],this.registeredShortcuts=[],this.debounceTimeout=null,this.isPerformingUndoRedo=!1,this.initialStateCaptured=!1}get maxHistoryLength(){var e;return(e=this.config.maxHistoryLength)!=null?e:Dv}get debounceTime(){var e;return(e=this.config.historyDebounceTime)!=null?e:Mv}get globalUndoRedo(){var e;return(e=this.config.globalUndoRedo)!=null?e:!0}async prepare(){this.setupEventListeners(),this.setupKeyboardShortcuts()}async captureInitialState(){if(this.initialStateCaptured)return;const e=await this.getCurrentState();if(e){const t=this.getCaretPosition();this.undoStack=[{state:e,timestamp:Date.now(),caretPosition:t}],this.initialStateCaptured=!0,this.emitStateChanged()}}async undo(){if(this.undoStack.length<2)return this.preserveCaretPosition(),!1;if(this.isPerformingUndoRedo)return!1;this.isPerformingUndoRedo=!0,this.clearDebounce();try{const e=this.undoStack.pop();e&&this.redoStack.push(e);const t=this.undoStack[this.undoStack.length-1];if(t){const o=e!=null&&e.caretPosition?Math.max(0,e.caretPosition.blockIndex-1):void 0;return await this.restoreState(t.state,t.caretPosition,o),this.emitStateChanged(),await this.cooldown(),!0}return!1}finally{this.isPerformingUndoRedo=!1}}async redo(){if(this.redoStack.length===0||this.isPerformingUndoRedo)return!1;this.isPerformingUndoRedo=!0,this.clearDebounce();try{const e=this.undoStack[this.undoStack.length-1],t=this.redoStack.pop();if(t){this.undoStack.push(t);const o=e!=null&&e.caretPosition?Math.max(0,e.caretPosition.blockIndex-1):void 0;return await this.restoreState(t.state,t.caretPosition,o),this.emitStateChanged(),await this.cooldown(),!0}return!1}finally{this.isPerformingUndoRedo=!1}}canUndo(){return this.undoStack.length>1}canRedo(){return this.redoStack.length>0}clear(){this.clearDebounce(),this.undoStack=[],this.redoStack=[],this.initialStateCaptured=!1,this.emitStateChanged()}setupEventListeners(){this.eventsDispatcher.on(gs,e=>{this.handleBlockMutation(e.event)})}setupKeyboardShortcuts(){setTimeout(()=>{var n,i;const e=(i=(n=this.Blok.UI)==null?void 0:n.nodes)==null?void 0:i.redactor;if(!e)return;const t=this.globalUndoRedo?document:e;["CMD+Z","CMD+SHIFT+Z","CMD+Y"].forEach(s=>ze.remove(t,s)),ze.add({name:"CMD+Z",on:t,handler:s=>{this.shouldHandleShortcut(s)&&(s.preventDefault(),this.undo())}}),this.registeredShortcuts.push({name:"CMD+Z",element:t}),ze.add({name:"CMD+SHIFT+Z",on:t,handler:s=>{this.shouldHandleShortcut(s)&&(s.preventDefault(),this.redo())}}),this.registeredShortcuts.push({name:"CMD+SHIFT+Z",element:t}),ze.add({name:"CMD+Y",on:t,handler:s=>{this.shouldHandleShortcut(s)&&(s.preventDefault(),this.redo())}}),this.registeredShortcuts.push({name:"CMD+Y",element:t})},0)}shouldHandleShortcut(e){return!(this.globalUndoRedo&&Et.activeInstance!==this||this.isNativeFormControl(e.target))}isNativeFormControl(e){var o,n;if(!(e instanceof HTMLElement))return!1;const t=(n=(o=this.Blok.UI)==null?void 0:o.nodes)==null?void 0:n.wrapper;return t!=null&&t.contains(e)?!1:!!(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e.isContentEditable)}handleBlockMutation(e){if(Et.activeInstance=this,!this.isPerformingUndoRedo){if(!this.initialStateCaptured){this.captureInitialState();return}this.clearDebounce(),this.debounceTimeout=setTimeout(()=>{this.recordState()},this.debounceTime)}}async recordState(){if(this.isPerformingUndoRedo)return;const e=await this.getCurrentState();if(!e)return;const t=this.getCaretPosition();for(this.redoStack=[],this.undoStack.push({state:e,timestamp:Date.now(),caretPosition:t});this.undoStack.length>this.maxHistoryLength;)this.undoStack.shift();this.emitStateChanged()}async getCurrentState(){try{const{BlockManager:e}=this.Blok,t=e.blocks;if(t.length===1&&t[0].isEmpty)return{time:Date.now(),blocks:[],version:""};const o=t.map(async s=>{const a=await s.save();return!a||a.data===void 0||!await s.validate(a.data)?null:K({id:a.id,type:a.tool,data:a.data},a.tunes&&Object.keys(a.tunes).length>0&&{tunes:a.tunes})}),i=(await Promise.all(o)).filter(s=>s!==null);return{time:Date.now(),blocks:i,version:""}}catch(e){return null}}async restoreState(e,t,o){this.Blok.ModificationsObserver.disable();try{await this.applyStateDiff(e)}finally{this.Blok.ModificationsObserver.enable()}this.restoreCaretPosition(t,o)}async applyStateDiff(e){const{BlockManager:t,Renderer:o}=this.Blok,n=t.blocks,i=e.blocks,s=new Map;n.forEach((p,f)=>{s.set(p.id,{block:p,index:f})});const a=new Map;i.forEach((p,f)=>{p.id&&a.set(p.id,{data:p,index:f})});const l=[];for(const p of n)a.has(p.id)||l.push(p);const c=[];for(const[p,{data:f,index:g}]of a)s.has(p)||c.push({data:f,index:g});const d=[];for(const[p,{data:f,index:g}]of a){const b=s.get(p);b&&d.push({block:b.block,data:f,targetIndex:g})}const u=l.length+c.length;if(u>n.length/2||u>5||n.length===0){await t.clear(),await o.render(i);return}for(const p of l)await t.removeBlock(p);for(const{block:p,data:f}of d){const g=await p.data;if(!(JSON.stringify(g)!==JSON.stringify(f.data)))continue;await p.setData(f.data)||await t.update(p,f.data,f.tunes)}for(const{data:p,index:f}of c)t.insert({id:p.id,tool:p.type,data:p.data,index:f,needToFocus:!1});await this.reorderBlocks(i)}async reorderBlocks(e){const{BlockManager:t}=this.Blok,o=new Map;e.forEach((s,a)=>{s.id&&o.set(s.id,a)}),t.blocks.some((s,a)=>{const l=o.get(s.id);return l!==void 0&&l!==a})&&e.forEach((s,a)=>{const l=s.id;if(!l)return;const c=t.blocks.findIndex(d=>d.id===l);c!==-1&&c!==a&&t.move(a,c)})}cooldown(){return new Promise(e=>setTimeout(e,Pv))}getCaretPosition(){const{BlockManager:e}=this.Blok,t=e.currentBlock;if(!t)return;const o=t.currentInput;if(!o)return;const n=t.inputs.indexOf(o),i=this.getCaretOffset(o),s=e.currentBlockIndex;return{blockId:t.id,blockIndex:s>=0?s:0,inputIndex:n>=0?n:0,offset:i}}getCaretOffset(e){var n;const t=window.getSelection();if(!t||t.rangeCount===0)return 0;const o=t.getRangeAt(0);if(!e.contains(o.startContainer))return 0;if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)return(n=e.selectionStart)!=null?n:0;try{const i=document.createRange();return i.selectNodeContents(e),i.setEnd(o.startContainer,o.startOffset),i.toString().length}catch(i){return 0}}restoreCaretPosition(e,t){if(!e&&t!==void 0){this.focusBlockAtIndex(t);return}if(!e){this.focusFirstAvailableBlock();return}const{BlockManager:o}=this.Blok,n=o.getBlockById(e.blockId);if(!n){const i=t!==void 0?t:e.blockIndex;this.focusBlockAtIndex(i);return}n.ready.then(()=>{this.setCaretToBlockInput(n,e)})}focusFirstAvailableBlock(){const{BlockManager:e,Caret:t}=this.Blok,o=e.firstBlock;o!=null&&o.focusable&&t.setToBlock(o,t.positions.END)}focusBlockAtIndex(e){const{BlockManager:t,Caret:o}=this.Blok,n=t.blocks.length;if(n===0)return;const i=Math.min(e,n-1),s=t.getBlockByIndex(i);if(s!=null&&s.focusable){o.setToBlock(s,o.positions.END);return}const a=t.lastBlock;a!=null&&a.focusable&&o.setToBlock(a,o.positions.END)}setCaretToBlockInput(e,t){const{BlockManager:o,Caret:n}=this.Blok,i=e.inputs,s=Math.min(t.inputIndex,i.length-1),a=i[s];if(!a){n.setToBlock(e,n.positions.END);return}o.currentBlock=e;try{n.setToInput(a,n.positions.DEFAULT,t.offset)}catch(l){n.setToInput(a,n.positions.END)}}clearDebounce(){this.debounceTimeout&&(clearTimeout(this.debounceTimeout),this.debounceTimeout=null)}preserveCaretPosition(){const{BlockManager:e,Caret:t}=this.Blok,o=e.currentBlock;if(!(o!=null&&o.focusable))return;const n=o.currentInput;n?n.focus():t.setToBlock(o,t.positions.END)}emitStateChanged(){this.eventsDispatcher.emit(um,{canUndo:this.canUndo(),canRedo:this.canRedo()})}destroy(){this.clearDebounce();for(const{name:e,element:t}of this.registeredShortcuts)ze.remove(t,e);this.registeredShortcuts=[],Et.activeInstance===this&&(Et.activeInstance=null),this.undoStack=[],this.redoStack=[],this.initialStateCaptured=!1}};Et.activeInstance=null;let ua=Et;const Fv={BlocksAPI:fm,CaretAPI:gm,EventsAPI:mm,I18nAPI:ks,API:bm,InlineToolbarAPI:vm,ListenersAPI:km,NotifierAPI:wm,ReadOnlyAPI:Tm,SanitizerAPI:Hm,SaverAPI:qm,SelectionAPI:zm,ToolsAPI:jm,StylesAPI:Um,ToolbarAPI:Km,TooltipAPI:eb,UiAPI:tb,HistoryAPI:ob,BlockSettings:Nb,Toolbar:Pb,InlineToolbar:Fb,BlockEvents:jb,BlockManager:mv,BlockSelection:bv,Caret:ra,CrossBlockSelection:yv,ModificationsObserver:wv,Paste:ia,ReadOnly:Tv,RectangleSelection:Bv,Renderer:xv,Saver:Cv,Tools:Ov,UI:Lv,History:ua};class Hv{constructor(e){this.moduleInstances={},this.eventsDispatcher=new Xt,this.config={},this.isReady=new Promise((t,o)=>{Promise.resolve().then(async()=>{this.configuration=e,this.validate(),this.init(),await this.start(),await this.render();const{BlockManager:n,Caret:i,UI:s,ModificationsObserver:a,History:l}=this.moduleInstances;s.checkEmptiness(),a.enable(),await l.captureInitialState(),this.configuration.autofocus===!0&&this.configuration.readOnly!==!0&&i.setToBlock(n.blocks[0],i.positions.START),t()}).catch(n=>{j(`Blok is not ready because of ${n}`,"error"),o(n)})})}set configuration(e){var l,c,d,u,h,p;Z(e)?this.config=K({},e):this.config={holder:e},this.config.holder==null&&(this.config.holder="blok"),this.config.logLevel==null&&(this.config.logLevel=Id.VERBOSE),Wp(this.config.logLevel),this.config.defaultBlock=(l=this.config.defaultBlock)!=null?l:"paragraph";const t=this.config.tools,o=this.config.defaultBlock,n=t!=null&&Object.prototype.hasOwnProperty.call(t,o!=null?o:""),i=(c=this.config.data)==null?void 0:c.blocks,s=Array.isArray(i)&&i.length>0;if(o&&o!=="paragraph"&&!n&&!s){j(`Default block "${o}" is not configured. Falling back to "paragraph" tool.`,"warn"),this.config.defaultBlock="paragraph";const f=this.config.tools,g=K({},f!=null?f:{}),b=g.paragraph;g.paragraph=this.createParagraphToolConfig(b),this.config.tools=g}this.config.minHeight=this.config.minHeight!==void 0?this.config.minHeight:300;const a={type:this.config.defaultBlock,data:{}};this.config.placeholder===void 0&&(this.config.placeholder=!1),this.config.sanitizer=(d=this.config.sanitizer)!=null?d:{},this.config.hideToolbar=(u=this.config.hideToolbar)!=null?u:!1,this.config.tools=this.config.tools||{},this.config.i18n=this.config.i18n||{},this.config.data=this.config.data||{blocks:[]},this.config.onReady=this.config.onReady||(()=>{}),this.config.onChange=this.config.onChange||(()=>{}),this.config.inlineToolbar=this.config.inlineToolbar!==void 0?this.config.inlineToolbar:!0,(le(this.config.data)||!this.config.data.blocks||this.config.data.blocks.length===0)&&(this.config.data={blocks:[a]}),this.config.readOnly=this.config.readOnly||!1,(h=this.config.i18n)!=null&&h.messages&&ie.setDictionary(this.config.i18n.messages),this.config.i18n.direction=((p=this.config.i18n)==null?void 0:p.direction)||"ltr"}get configuration(){return this.config}validate(){const{holder:e}=this.config;if(qe(e)&&!v.get(e))throw Error(`element with ID «${e}» is missing. Pass correct holder's ID.`);if(e&&Z(e)&&!v.isElement(e))throw Error("«holder» value must be an Element node")}init(){this.constructModules(),this.configureModules()}async start(){await["Tools","UI","BlockManager","Paste","BlockSelection","RectangleSelection","CrossBlockSelection","ReadOnly","History"].reduce((t,o)=>t.then(async()=>{try{await this.moduleInstances[o].prepare()}catch(n){if(n instanceof Vt)throw new Error(n.message);j(`Module ${o} was skipped because of %o`,"warn",n)}}),Promise.resolve())}render(){const e=this.moduleInstances.Renderer;if(!e)throw new Vt("Renderer module is not initialized");if(!this.config.data)throw new Vt("Blok data is not initialized");return e.render(this.config.data.blocks)}constructModules(){Object.entries(Fv).forEach(([e,t])=>{try{this.moduleInstances[e]=new t({config:this.configuration,eventsDispatcher:this.eventsDispatcher})}catch(o){j(`[constructModules] Module ${e} skipped because`,"error",o)}})}configureModules(){for(const e in this.moduleInstances)Object.prototype.hasOwnProperty.call(this.moduleInstances,e)&&(this.moduleInstances[e].state=this.getModulesDiff(e))}createParagraphToolConfig(e){if(e===void 0)return{config:{preserveBlank:!0}};if(V(e))return{class:e,config:{preserveBlank:!0}};if(Z(e)){const t=e,o=t.config;return Re(K({},t),{config:Re(K({},Z(o)?o:{}),{preserveBlank:!0})})}return{config:{preserveBlank:!0}}}getModulesDiff(e){const t={};for(const o in this.moduleInstances)o!==e&&(t[o]=this.moduleInstances[o]);return t}}const cn=class cn{constructor({data:e,config:t,api:o,readOnly:n}){this.api=o,this.readOnly=n,this._settings=t||{},this._data=this.normalizeData(e),this._element=this.getTag()}get _CSS(){return{block:this.api.styles.block,wrapper:""}}isHeaderData(e){return typeof e=="object"&&e!==null&&"text"in e}normalizeData(e){if(!this.isHeaderData(e))return{text:"",level:this.defaultLevel.number};const t=parseInt(String(e.level)),o=e.level!==void 0&&!isNaN(t);return{text:e.text||"",level:o?t:this.defaultLevel.number}}render(){return this._element}renderSettings(){return this.levels.map(e=>({icon:e.svg,label:this.api.i18n.t(`Heading ${e.number}`),onActivate:()=>this.setLevel(e.number),closeOnActivate:!0,isActive:this.currentLevel.number===e.number,dataset:{"blok-header-level":String(e.number)}}))}setLevel(e){this.data={level:e,text:this.data.text}}merge(e){this._element.insertAdjacentHTML("beforeend",e.text)}validate(e){return e.text.trim()!==""}save(e){return{text:e.innerHTML,level:this.currentLevel.number}}static get conversionConfig(){return{export:"text",import:"text"}}static get sanitize(){return{level:!1,text:{}}}static get isReadOnlySupported(){return!0}get data(){return this._data.text=this._element.innerHTML,this._data.level=this.currentLevel.number,this._data}set data(e){if(this._data=this.normalizeData(e),e.level!==void 0&&this._element.parentNode){const t=this.getTag();t.innerHTML=this._element.innerHTML,this._element.parentNode.replaceChild(t,this._element),this._element=t}e.text!==void 0&&(this._element.innerHTML=this._data.text||"")}getTag(){const e=document.createElement(this.currentLevel.tag);return e.innerHTML=this._data.text||"",e.className=$(cn.BASE_STYLES,this.currentLevel.styles),e.setAttribute(us,"header"),e.contentEditable=this.readOnly?"false":"true",e.setAttribute("data-placeholder",this.api.i18n.t(this._settings.placeholder||"")),e}get currentLevel(){const e=this.levels.find(t=>t.number===this._data.level);return e!=null?e:this.defaultLevel}get defaultLevel(){if(!this._settings.defaultLevel)return this.levels[1];const e=this.levels.find(t=>t.number===this._settings.defaultLevel);return e||(console.warn("(ง'̀-'́)ง Heading Tool: the default level specified was not found in available levels"),this.levels[1])}get levels(){const e=[{number:1,tag:"H1",svg:mb,styles:"text-[2.5em] leading-tight font-bold"},{number:2,tag:"H2",svg:bb,styles:"text-[2em] leading-tight font-semibold"},{number:3,tag:"H3",svg:vb,styles:"text-[1.75em] leading-tight font-semibold"},{number:4,tag:"H4",svg:kb,styles:"text-[1.5em] leading-tight font-semibold"},{number:5,tag:"H5",svg:yb,styles:"text-[1.25em] leading-tight font-semibold"},{number:6,tag:"H6",svg:wb,styles:"text-base leading-tight font-semibold"}];return this._settings.levels?e.filter(t=>this._settings.levels.includes(t.number)):e}onPaste(e){var a;const t=e.detail;if(!("data"in t))return;const o=t.data,i=(a={H1:1,H2:2,H3:3,H4:4,H5:5,H6:6}[o.tagName])!=null?a:this.defaultLevel.number,s=this._settings.levels?this._settings.levels.reduce((l,c)=>Math.abs(c-i)<Math.abs(l-i)?c:l):i;this.data={level:s,text:o.innerHTML}}static get pasteConfig(){return{tags:["H1","H2","H3","H4","H5","H6"]}}static get toolbox(){return{icon:Tb,title:"Heading"}}};cn.BASE_STYLES="py-[0.6em] pb-[3px] px-0 m-0 leading-[1.25em] outline-none [&_p]:!p-0 [&_p]:!m-0 [&_div]:!p-0 [&_div]:!m-0";let ha=cn;const zt=class zt{static get version(){return Eo()}constructor(e){this.initialConfiguration=Z(e)?K({},e):e;const t=Z(e)&&V(e.onReady)?e.onReady:()=>{},o=new Hv(e);this.destroy=()=>{},this.isReady=o.isReady.then(()=>{this.exportAPI(o),t()})}exportAPI(e){var f,g;const t=["configuration"],o=()=>{Object.values(e.moduleInstances).forEach(b=>{if(b==null)return;V(b.destroy)&&b.destroy();const k=b.listeners;k&&V(k.removeAll)&&k.removeAll()}),Qm();for(const b in this)Object.prototype.hasOwnProperty.call(this,b)&&delete this[b];Object.setPrototypeOf(this,null)};t.forEach(b=>{if(b!=="configuration"){this[b]=e[b];return}const k=e.configuration,y=Z(this.initialConfiguration)?this.initialConfiguration:k!=null?k:this.initialConfiguration;y!==void 0&&(this[b]=y)}),this.destroy=o;const n=e.moduleInstances.API.methods,i=(g=(f=e.moduleInstances.EventsAPI)==null?void 0:f.methods)!=null?g:n.events;if(i!==void 0){const b=k=>{Object.prototype.hasOwnProperty.call(k,"eventsDispatcher")||Object.defineProperty(k,"eventsDispatcher",{value:i,configurable:!0,enumerable:!0,writable:!1})};b(n),b(this)}Object.getPrototypeOf(n)!==zt.prototype&&Object.setPrototypeOf(n,zt.prototype),Object.setPrototypeOf(this,n);const s=Object.create(null),a=e.moduleInstances,l=a,c=b=>/^[A-Z]+$/.test(b)?b.toLowerCase():b.charAt(0).toLowerCase()+b.slice(1);Object.keys(l).forEach(b=>{const k=c(b);Object.defineProperty(s,k,{configurable:!0,enumerable:!0,get:()=>l[b]})});const d=a.Toolbar,u=a.BlockSettings;d!==void 0&&u!==void 0&&d.blockSettings===void 0&&(d.blockSettings=u);const h=a.InlineToolbar;d!==void 0&&h!==void 0&&d.inlineToolbar===void 0&&(d.inlineToolbar=h),Object.defineProperty(this,"module",{value:s,configurable:!0,enumerable:!1,writable:!1}),delete this.exportAPI,Object.entries({blocks:{clear:"clear",render:"render"},caret:{focus:"focus"},events:{on:"on",off:"off",emit:"emit"},saver:{save:"save"}}).forEach(([b,k])=>{Object.entries(k).forEach(([y,x])=>{const T=b,R=e.moduleInstances.API.methods[T];this[x]=R[y]})})}};zt.Header=ha,zt.Paragraph=sn;let fa=zt;const Ce={wrapper:me("fixed z-[2] bottom-5 left-5",'font-[-apple-system,BlinkMacSystemFont,"Segoe_UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira_Sans","Droid_Sans","Helvetica_Neue",sans-serif]'),notification:me("relative w-[230px] mt-[15px] py-[13px] px-4","bg-white shadow-[0_11px_17px_0_rgba(23,32,61,0.13)] rounded-[5px]","text-sm leading-[1.4em] break-words",'before:content-[""] before:absolute before:block before:top-0 before:left-0',"before:w-[3px] before:h-[calc(100%-6px)] before:m-[3px] before:rounded-[5px] before:bg-transparent"),crossBtn:me("absolute top-[7px] right-[15px] w-2.5 h-2.5 p-[5px] opacity-55 cursor-pointer",'before:content-[""] before:absolute before:left-[9px] before:top-[5px] before:h-3 before:w-0.5 before:bg-[#575d67] before:rotate-[-45deg]','after:content-[""] after:absolute after:left-[9px] after:top-[5px] after:h-3 after:w-0.5 after:bg-[#575d67] after:rotate-45',"hover:opacity-100"),btnsWrapper:"flex flex-row flex-nowrap mt-[5px]",btn:"border-none rounded-[3px] text-[13px] py-[5px] px-2.5 cursor-pointer last:ml-2.5",okBtn:"bg-[#34c992] shadow-[0_1px_1px_0_rgba(18,49,35,0.05)] text-white hover:bg-[#2db583]",cancelBtn:"bg-[#f2f5f7] shadow-[0_2px_1px_0_rgba(16,19,29,0)] text-[#656b7c] hover:bg-[#e9ecee]",input:me("max-w-[130px] py-[5px] px-2.5 bg-[#f7f7f7] border-0 rounded-[3px]","text-[13px] text-[#656b7c] outline-none","placeholder:text-[#656b7c] focus:placeholder:text-[rgba(101,107,124,0.3)]"),successNotification:me("!bg-[#fafffe]","before:!bg-[#41ffb1]"),errorNotification:me("!bg-[#fffbfb]","before:!bg-[#fb5d5d]")},pa=r=>{const e=document.createElement("DIV"),t=document.createElement("DIV"),o=r.message,n=r.style,i=()=>n==="success"?Ce.successNotification:n==="error"?Ce.errorNotification:"";return e.className=$(Ce.notification,i()),n?e.setAttribute("data-blok-testid",`notification-${n}`):e.setAttribute("data-blok-testid","notification"),e.innerHTML=o,t.className=Ce.crossBtn,t.setAttribute("data-blok-testid","notification-cross"),t.addEventListener("click",()=>e.remove()),e.appendChild(t),e},qv=r=>{const e=pa(r),t=document.createElement("div"),o=document.createElement("button"),n=document.createElement("button"),i=e.querySelector('[data-blok-testid="notification-cross"]'),s=r.cancelHandler,a=r.okHandler;return t.className=Ce.btnsWrapper,t.setAttribute("data-blok-testid","notification-buttons-wrapper"),o.innerHTML=r.okText||"Confirm",n.innerHTML=r.cancelText||"Cancel",o.className=me(Ce.btn,Ce.okBtn),n.className=me(Ce.btn,Ce.cancelBtn),o.setAttribute("data-blok-testid","notification-confirm-button"),n.setAttribute("data-blok-testid","notification-cancel-button"),s&&typeof s=="function"&&n.addEventListener("click",s),s&&typeof s=="function"&&i&&i.addEventListener("click",s),a&&typeof a=="function"&&o.addEventListener("click",a),o.addEventListener("click",()=>e.remove()),n.addEventListener("click",()=>e.remove()),t.appendChild(o),t.appendChild(n),e.appendChild(t),e},zv=r=>{const e=pa(r),t=document.createElement("div"),o=document.createElement("button"),n=document.createElement("input"),i=e.querySelector('[data-blok-testid="notification-cross"]'),s=r.cancelHandler,a=r.okHandler;return t.className=Ce.btnsWrapper,o.innerHTML=r.okText||"Ok",o.className=me(Ce.btn,Ce.okBtn),n.className=Ce.input,n.setAttribute("data-blok-testid","notification-input"),r.placeholder&&n.setAttribute("placeholder",r.placeholder),r.default&&(n.value=r.default),r.inputType&&(n.type=r.inputType),s&&typeof s=="function"&&i&&i.addEventListener("click",s),a&&typeof a=="function"&&o.addEventListener("click",()=>{a(n.value)}),o.addEventListener("click",()=>e.remove()),t.appendChild(n),t.appendChild(o),e.appendChild(t),e},jv=()=>{const r=document.createElement("DIV");return r.className=Ce.wrapper,r.setAttribute("data-blok-testid","notifier-container"),r},Uv=8e3,Kv=()=>{const r=document.querySelector('[data-blok-testid="notifier-container"]');if(r)return r;const e=jv();return document.body.appendChild(e),e},hh=r=>{if(!r.message)return;const e=Kv(),t=r.time||Uv,o=(()=>{switch(r.type){case"confirm":return qv(r);case"prompt":return zv(r);default:{const n=pa(r);return window.setTimeout(()=>{n.remove()},t),n}}})();e&&o&&(e.appendChild(o),o.className=`${o.className} animate-notify-bounce-in`,o.setAttribute("data-blok-bounce-in","true"))},Wv=Object.freeze(Object.defineProperty({__proto__:null,default:{show:hh},show:hh},Symbol.toStringTag,{value:"Module"}));return fa}));