useblocks 1.1.64 → 1.1.70

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 (196) hide show
  1. package/README.md +2 -0
  2. package/assets/images/project-settings-inbox-envelope.png +0 -0
  3. package/assets/images/project-settings-plugin-support-avatar.png +0 -0
  4. package/fileManager.d.ts +519 -0
  5. package/iframe/css/sandbox-dark.css +1 -1
  6. package/iframe/css/sandbox-darktheme.css +1 -1
  7. package/iframe/css/sandbox-light.css +1 -1
  8. package/iframe/css/sandbox.css +112 -89
  9. package/iframe/js/amp.DllX-Im0.js +1 -0
  10. package/iframe/js/iframe-eblock.js +1 -1
  11. package/iframe/js/iframe.js +1 -1
  12. package/iframe/js/rules.4N5s3OV-.js +1 -1
  13. package/npm-publish.manifest.json +7 -7
  14. package/package.json +4 -1
  15. package/runtime/THIRD_PARTY_LICENSES.txt +1 -1
  16. package/static/core/{d2f93451.js → 0e53b7b5.js} +3 -3
  17. package/static/core/0fe242f22.js +3251 -0
  18. package/static/core/{e9ff66762.js → 10f0dad9.js} +3 -3
  19. package/static/core/{a79573972.js → 115218a42.js} +3 -3
  20. package/static/core/{d6b377d3.js → 1202bfdd.js} +3 -3
  21. package/static/core/{8d4aa933.js → 16c2d0e42.js} +6 -6
  22. package/static/core/{8aa09f022.js → 1ae75b972.js} +3 -3
  23. package/static/core/{e7c982c02.js → 2011fc95.js} +3 -3
  24. package/static/core/{925a1cfd2.js → 211482892.js} +3 -3
  25. package/static/core/222d29d9.js +468 -0
  26. package/static/core/{6c0b4555.js → 23546a64.js} +238 -257
  27. package/static/core/{6e177eb6.js → 26a1af95.js} +3 -3
  28. package/static/core/{9d8297c7.js → 27f62a39.js} +3 -3
  29. package/static/core/{fb834fb22.js → 288ca9522.js} +6 -6
  30. package/static/core/{45da436c.js → 28e9d3ff.js} +3 -3
  31. package/static/core/{1c82c2d52.js → 2bd2da322.js} +3 -3
  32. package/static/core/{712b11ba.js → 2c65c059.js} +3 -3
  33. package/static/core/{1d2a32d02.js → 2f216fd4.js} +4 -4
  34. package/static/core/{45fcca4f2.js → 2fd502bd2.js} +3 -3
  35. package/static/core/{b303b2a4.js → 34e0b0dc.js} +3 -3
  36. package/static/core/{b0712bbb.js → 35ad3ae5.js} +173 -173
  37. package/static/core/{8e6e6aaa2.js → 35e0d55e.js} +3 -3
  38. package/static/core/36bf6931.js +2119 -0
  39. package/static/core/{a953bf24.js → 375e98282.js} +3 -3
  40. package/static/core/{40d6d494.js → 38302247.js} +3 -3
  41. package/static/core/{99fd0b342.js → 38e879e9.js} +3 -3
  42. package/static/core/{b283b340.js → 39a68c91.js} +3 -3
  43. package/static/core/{68edd344.js → 3bbe4800.js} +3 -3
  44. package/static/core/{43108a122.js → 3bda5ccf2.js} +4 -4
  45. package/static/core/{220b2c2a.js → 3c1ef117.js} +7 -7
  46. package/static/core/{411c06d9.js → 3f22a9d32.js} +2018 -1808
  47. package/static/core/{8b8811812.js → 412f0d1c.js} +3 -3
  48. package/static/core/{601b4e7b.js → 46959096.js} +3 -3
  49. package/static/core/{9d1a7a182.js → 46abec11.js} +3 -3
  50. package/static/core/{292fe55d2.js → 4740c91e2.js} +3 -3
  51. package/static/core/{c7588e5f.js → 48560c89.js} +387 -385
  52. package/static/core/{1d173e97.js → 48d0a8bd2.js} +3 -3
  53. package/static/core/{af691d1f.js → 490f59592.js} +21 -21
  54. package/static/core/{205266672.js → 4953bced.js} +3 -3
  55. package/static/core/{668ae858.js → 4b59ab9f.js} +3 -3
  56. package/static/core/{664c38f8.js → 4bc74a4f.js} +3 -3
  57. package/static/core/{8b28b024.js → 508bcaba.js} +5 -5
  58. package/static/core/513594a8.js +583 -0
  59. package/static/core/54eadcf42.js +39 -0
  60. package/static/core/{da4b0874.js → 578fcc88.js} +3 -3
  61. package/static/core/{43764f5b.js → 585259872.js} +189 -181
  62. package/static/core/{cee370ea.js → 5b64d3ce2.js} +8 -8
  63. package/static/core/{b450a16a.js → 5e082e16.js} +59 -59
  64. package/static/core/{bc1a9cb2.js → 5e7c6c9c.js} +4 -4
  65. package/static/core/{bc557d9c.js → 60dcae06.js} +6 -6
  66. package/static/core/{fa23ae7b.js → 616e99a4.js} +3 -3
  67. package/static/core/{66f4dea3.js → 62c13c96.js} +3 -3
  68. package/static/core/{d892d2c82.js → 62f33dda.js} +3 -3
  69. package/static/core/{9c236031.js → 62fd385b.js} +3 -3
  70. package/static/core/{958e85b5.js → 6313868b.js} +3 -3
  71. package/static/core/63206e112.js +8956 -0
  72. package/static/core/{9e889fa1.js → 68ec11c8.js} +640 -638
  73. package/static/core/{951b9e3d.js → 6ca6133e.js} +9 -9
  74. package/static/core/6e2a0152.js +61 -0
  75. package/static/core/{656a0edc2.js → 6ee1838f2.js} +3 -3
  76. package/static/core/{b09300472.js → 7527fdc92.js} +3 -3
  77. package/static/core/{d8df6d5a.js → 75c2f232.js} +8 -8
  78. package/static/core/{49a037b02.js → 76c0586a2.js} +3 -3
  79. package/static/core/{2d8a7133.js → 76ea88d3.js} +5 -5
  80. package/static/core/{42e9eb802.js → 77c2efbb.js} +3 -3
  81. package/static/core/{5d0c727e.js → 7d07bfac.js} +3 -3
  82. package/static/core/{d46cb9672.js → 7d19dd28.js} +4 -4
  83. package/static/core/{2d13936a.js → 7ec8e1fc.js} +3 -3
  84. package/static/core/{9954153b2.js → 84326fa6.js} +3 -3
  85. package/static/core/{c52e08d6.js → 86515d932.js} +4 -4
  86. package/static/core/{a97bdbc8.js → 879bd3b1.js} +3 -3
  87. package/static/core/{e47711662.js → 8a061db42.js} +5 -5
  88. package/static/core/{4b0f73af.js → 8ed78147.js} +3 -3
  89. package/static/core/{1cbab2af2.js → 8ef06b232.js} +10 -10
  90. package/static/core/{75e8d4672.js → 8fafd12f2.js} +3 -3
  91. package/static/core/{a898230f.js → 8fbde229.js} +3 -3
  92. package/static/core/{f61e3e55.js → 92871f5a2.js} +7 -7
  93. package/static/core/{a83b01cb2.js → 92d1a0c9.js} +519 -523
  94. package/static/core/9355751a.js +126 -0
  95. package/static/core/{95d1d1aa2.js → 93b3c668.js} +3 -3
  96. package/static/core/{873142eb.js → 9933d0ff2.js} +3 -3
  97. package/static/core/{96417e98.js → 9a0c05f1.js} +4 -4
  98. package/static/core/9ab1c444.js +11452 -0
  99. package/static/core/{c8cb5d88.js → 9c09ec92.js} +7 -7
  100. package/static/core/{31ba662c2.js → 9df9c5262.js} +5 -5
  101. package/static/core/{85ea16112.js → a061a37c2.js} +3 -3
  102. package/static/core/{fff1a8622.js → a64e6cce2.js} +3 -3
  103. package/static/core/{f5d4906d2.js → a6d92d0b2.js} +5 -5
  104. package/static/core/{2e9906f7.js → a7518d2c.js} +3 -3
  105. package/static/core/{3c6f1d122.js → a8bed12d2.js} +3 -3
  106. package/static/core/{72e2612a2.js → a8f08cb22.js} +3 -3
  107. package/static/core/{6eb316fe2.js → ac70dfae2.js} +6 -6
  108. package/static/core/{7dd91b5f.js → b3ee36b6.js} +34713 -38523
  109. package/static/core/{89e7cc57.js → b8cecec8.js} +17 -17
  110. package/static/core/{a35fd8d22.js → b8ed4fd62.js} +13 -13
  111. package/static/core/{7735c90f.js → b9b92e01.js} +15 -15
  112. package/static/core/{b57c9e1f.js → bc703487.js} +3 -3
  113. package/static/core/{b165c6f6.js → bc9faec1.js} +134 -134
  114. package/static/core/{54e7728d.js → bf3a9be2.js} +5 -5
  115. package/static/core/c370a46c.js +683 -0
  116. package/static/core/{e96aadfa.js → c3b45fb6.js} +1846 -1847
  117. package/static/core/{d54353e72.js → c56eaffd.js} +3 -3
  118. package/static/core/{f562fb51.js → c5cf470c.js} +3 -3
  119. package/static/core/{ceffb8322.js → c8a41267.js} +3 -3
  120. package/static/core/{19572306.js → cc251d11.js} +3 -3
  121. package/static/core/{84df1edd2.js → cce631ad.js} +3 -3
  122. package/static/core/{a88996b3.js → ce9be2ec2.js} +4965 -4753
  123. package/static/core/cf655a1a.js +33627 -0
  124. package/static/core/{261ad211.js → d3bbb05e.js} +3 -3
  125. package/static/core/{4a9bd173.js → d43babb9.js} +3 -3
  126. package/static/core/{1a415abd2.js → d46d10f12.js} +12 -12
  127. package/static/core/{7ad0031e2.js → d684b4ef2.js} +38 -38
  128. package/static/core/{affffdf2.js → d8835f5f.js} +7 -7
  129. package/static/core/{b04145ff2.js → db5fa769.js} +10 -10
  130. package/static/core/{d32841a32.js → dbc6f1e52.js} +3 -3
  131. package/static/core/{db4e60fa2.js → dc256ccd2.js} +3 -3
  132. package/static/core/{eaa635532.js → dc6fa7c1.js} +3 -3
  133. package/static/core/{4b9709dc.js → dcc518ef2.js} +3 -3
  134. package/static/core/df237243.js +56 -0
  135. package/static/core/{5ea0fc40.js → e02024fb2.js} +97 -97
  136. package/static/core/e199fd0a.js +49 -0
  137. package/static/core/{678594cd.js → e3a541ab.js} +3 -3
  138. package/static/core/{6f0d961a2.js → e4c6d91e2.js} +7 -7
  139. package/static/core/e57e8a80.js +22 -0
  140. package/static/core/{d7a9fd822.js → e6ac2e652.js} +3 -3
  141. package/static/core/{de2e2a02.js → e6c7e14f.js} +3 -3
  142. package/static/core/{81a5ffb92.js → e83c0b482.js} +3 -3
  143. package/static/core/{2515c6a52.js → e923d1aa2.js} +3 -3
  144. package/static/core/{bcee99d6.js → ea6c5c93.js} +3596 -3422
  145. package/static/core/{d85e34c42.js → ebd51d83.js} +3 -3
  146. package/static/core/{b54ad117.js → ec4f2d562.js} +3 -3
  147. package/static/core/{da25e8fc.js → f0364bbd2.js} +4 -4
  148. package/static/core/{b1b3186f.js → f51ccb57.js} +7 -7
  149. package/static/core/{7fd85aa0.js → f73bbe35.js} +5 -5
  150. package/static/core/{211ca90b.js → f85b09cb.js} +3 -3
  151. package/static/core/{3ab5d1a4.js → f9aaa4b7.js} +7 -7
  152. package/static/core/{4c5c889d.js → fc962c9a2.js} +5 -5
  153. package/static/core/{fd9034a2.js → fd7386aa2.js} +37 -37
  154. package/static/core/{62dd04ca2.js → fe4feb362.js} +3 -3
  155. package/static/core/{f3b4a3102.js → ffcf92522.js} +3 -3
  156. package/static/media/image-editor/fonts/Rubik-Black.woff2 +0 -0
  157. package/static/media/image-editor/fonts/Rubik-Bold.woff2 +0 -0
  158. package/static/media/image-editor/fonts/Rubik-Light.woff2 +0 -0
  159. package/static/media/image-editor/fonts/Rubik-Regular.woff2 +0 -0
  160. package/static/media/image-editor/fonts/caveat-v23-cyrillic_latin-regular.woff2 +0 -0
  161. package/static/media/image-editor/fonts/commissioner-v24-cyrillic_latin-regular.woff2 +0 -0
  162. package/static/media/image-editor/fonts/inter-v20-cyrillic_latin-regular.woff2 +0 -0
  163. package/static/media/image-editor/fonts/oswald-v57-cyrillic_latin-regular.woff2 +0 -0
  164. package/static/media/image-editor/fonts/pacifico-v23-cyrillic_latin-regular.woff2 +0 -0
  165. package/static/media/image-editor/fonts/playfair-display-v40-cyrillic_latin-regular.woff2 +0 -0
  166. package/static/umd-runtime/ui-kit.js +1638 -1416
  167. package/test-font.otf +0 -0
  168. package/test-font.ttf +0 -0
  169. package/test-font.woff2 +0 -0
  170. package/two_step_headless_plugin.html +1 -1
  171. package/ui-kit/index.js +1317 -1104
  172. package/{useblocks-core.d874510b.js → useblocks-core.d9c7d790.js} +8 -8
  173. package/useblocks-esm.js +6 -3
  174. package/useblocks-po.d9c7d790.js +5945 -0
  175. package/useblocks.d.ts +36 -525
  176. package/useblocks.js +3 -3
  177. package/vite/index.cjs +4 -4
  178. package/vite/index.d.ts +4 -4
  179. package/vite/index.js +4 -4
  180. package/vite/pluginDev/index.cjs +2 -2
  181. package/vite/pluginDev/index.d.ts +12 -12
  182. package/vite/pluginDev/index.js +2 -2
  183. package/webpack/pluginDev/index.d.ts +12 -12
  184. package/iframe/js/amp.BP7EklKo.js +0 -1
  185. package/singlepage_headless_plugin.html +0 -592
  186. package/static/core/40f1c391.js +0 -43109
  187. package/static/core/47513981.js +0 -465
  188. package/static/core/63b7b25e.js +0 -68
  189. package/static/core/8460710a.js +0 -27
  190. package/static/core/86577bae.js +0 -666
  191. package/static/core/90f16a4b.js +0 -2089
  192. package/static/core/a44b0f6c.js +0 -12282
  193. package/static/core/aa783b9b.js +0 -124
  194. package/static/core/dc19c4fa.js +0 -93052
  195. /package/iframe/{iframe-eblock.d874510b.html → iframe-eblock.d9c7d790.html} +0 -0
  196. /package/iframe/{iframe.d874510b.html → iframe.d9c7d790.html} +0 -0
@@ -1,2089 +0,0 @@
1
- (function(){try{if(typeof document<"u"){var o=document.createElement("style");o.setAttribute("data-useblocks","true"),o.appendChild(document.createTextNode(".blocks-app .image-preview{text-align:center;min-height:100px;position:relative}.blocks-app .image-preview .image-editor-modal{border:1px solid red}.blocks-app .image-preview__edit-button{position:absolute;bottom:10px;left:50%;transform:translate(-50%)}.blocks-app .image-preview img{border:1px solid var(--colorBorder);border-radius:6px;max-width:100%;max-height:500px}.blocks-app .image-editor-modal .ant-modal-container{flex-direction:column;min-height:100vh;display:flex;border-radius:0!important}.blocks-app .image-editor-modal .ant-modal-body{flex-grow:1;display:flex}.blocks-app .image-editor-modal .ant-modal-body #pixie-editor{flex-grow:1;height:calc(100vh - 70px);min-height:calc(100vh - 70px);overflow:hidden}.blocks-app .image-editor-modal .pi .text-on-primary{background:var(--colorPrimary);border-color:var(--colorPrimary)}.blocks-app .image-editor-modal .pi .text-on-primary:hover{background:var(--colorPrimaryHover);border-color:var(--colorPrimaryHover)}.blocks-app .image-editor-modal .pi .text-on-primary.rounded-full{border-radius:calc(var(--borderRadius) * 1px)}.blocks-app .image-editor-modal .pi .shadow-xl{box-shadow:none}.blocks-app .image-editor-modal .w-\\[4ch\\].text-sm.text-center{width:5ch}.blocks-app .image-editor-modal .pi .border-white{border-color:var(--colorPrimary)}.blocks-app .image-editor-modal .pi .bg-white\\/50{background-color:var(--colorPrimary)}.blocks-app .image-editor-modal .pi .text-on-primary{color:var(--colorWhite)}.blocks-app .serach-results .ant-row{align-items:center}.blocks-app .serach-results .blocks-search__divider-wrapper{margin-top:12px;position:relative}.blocks-app .serach-results .blocks-search__divider-wrapper .ant-divider-horizontal{border-top:1px solid var(--colorBorderSecondary);background:0 0;width:100%;height:1px;min-height:0;margin:0;position:static}.blocks-app .slideshow-container{width:524px;height:350px;margin:auto;position:relative;overflow:hidden}.blocks-app .slideshow-image{opacity:0;width:100%;height:100%;position:absolute;top:0;left:0}.blocks-app .image-ai .slideshow-image{width:auto;height:auto}.blocks-app .image-ai__image-item{text-align:center;border-radius:6px;justify-content:center;align-items:center;min-height:100px;display:flex;position:relative}.blocks-app .image-ai__image-item .buttons{justify-content:space-between;display:flex;position:absolute;bottom:10px;left:50%;transform:translate(-50%)}.blocks-app .image-ai .text-area-input-hybrid{border:none;outline:none;min-height:0;padding:0 0 0 1px}.blocks-app .image-ai .text-area-input-hybrid textarea{height:32px;min-height:32px;padding:3px 11px;line-height:26px}.blocks-app .image-ai__loading{justify-content:center;align-items:center;min-height:150px;display:flex}.blocks-app .image-ai__loading .spin{flex-direction:column;justify-content:center;align-items:center;height:150px;display:flex}.blocks-app .image-ai__loading .status{margin:3px 0 0}.blocks-app .image-ai__preview{border-radius:6px;margin-top:24px;overflow:hidden}.blocks-app .image-ai__preview .image-ai__image-item img{border-radius:calc(var(--borderRadius) * 1px);object-fit:contain;max-height:100%;transition:height 1s;top:50%;left:50%;overflow:hidden;transform:translate(-50%,-50%)}.blocks-app .image-ai .small{width:302px;height:202px}.blocks-app .image-ai .large{width:524px;height:350px}.blocks-app .image-ai .image-ai__row{padding:0 2px}.blocks-app .image-ai .image-ai__input-affix-wrapper{border-style:solid;border-width:calc(var(--borderWidth) * 1px);border-color:var(--colorFillSecondaryDarken);border-radius:calc(var(--borderRadius) * 1px);width:100%;padding-left:0;display:inline-flex}.blocks-app .image-ai .image-ai__input-affix-wrapper:hover{border-color:var(--borderColorHover)}.blocks-app .image-ai .image-ai__input-affix-wrapper.ant-input-affix-wrapper-focused{border-color:var(--colorPrimaryBorder)}.blocks-app .image-ai .image-ai__textarea{font-size:16px}.blocks-app .image-ai .image-ai__input-icon{font-size:16px;top:0;right:0}.dark .blocks-app .image-ai .image-ai__preview .image-ai__image-item img{background:#2b2b2b;border:1px solid #434343}.dark .blocks-app .image-ai .ant-btn{background:#1f1f1f}.dark .blocks-app .image-ai .ant-btn:hover{color:var(--colorPrimary)}.blocks-app .stock-tab img{border-radius:0;max-width:none;max-height:none}.blocks-app .stock-tab .stock-search-input{padding:0 2px}.blocks-app .stock-tab .my-masonry-grid{text-align:center;width:auto;display:flex}.blocks-app .stock-tab .my-masonry-grid_column{background-clip:padding-box}.blocks-app .stock-tab .list-item{cursor:pointer;background:#f0f2f5;border:1px solid #f0f2f5;border-radius:6px;min-height:100px;max-height:100px;margin-bottom:20px;transition:all .3s;display:inline-block;position:relative;overflow:hidden}.blocks-app .stock-tab .list-item .overlay-image{opacity:0;background-size:cover;width:110px;height:40px;transition:opacity .5s;position:absolute;bottom:10px;right:10px}.blocks-app .stock-tab .list-item .ant-spin{color:#f0f2f5;font-size:20px;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.blocks-app .stock-tab .list-item img{object-fit:cover;opacity:0;border-radius:6px;height:auto;transition:opacity .5s ease-in-out;display:block}.blocks-app .stock-tab .list-item.loaded{border:1px solid #d9d9d9;max-height:1000px}.blocks-app .stock-tab .list-item.loaded img{opacity:1;height:100%}.blocks-app .stock-tab .list-item.loaded .loaded-image{opacity:.5}.blocks-app .stock-tab .list-item:hover{box-shadow:0 1px 2px -2px #00000029,0 3px 6px #0000001f,0 5px 12px 4px #00000017}.blocks-app .stock-tab .list-item:hover p.creator-info,.blocks-app .stock-tab .list-item:hover .overlay-image{opacity:1}.blocks-app .stock-tab .list-item p.creator-info{color:#fff;opacity:0;background-color:#00000080;border-radius:0 0 6px;margin:0;padding:5px;font-size:10px;line-height:1.2;position:absolute;bottom:0;right:0}.blocks-app .stock-tab .list-item p.creator-info:hover a{color:#fff;text-decoration:underline}.blocks-app .stock-tab .list-item p.creator-info a{color:#fff;text-decoration:none}.blocks-app .stock-color-filter{display:flex}.blocks-app .stock-color-filter label{border-width:1px;width:24px;height:24px;margin:4px;padding:0;font-size:0;border-radius:6px!important}.blocks-app .stock-color-filter label.all-colors{background-image:linear-gradient(135deg,red,#ff7f00,#ff0,#0f0,#00f,#8b00ff)}.blocks-app .stock-color-filter label.black-color{background:#222}.blocks-app .stock-color-filter label.bw-color{background-image:linear-gradient(135deg,#222 50%,#fff 50%)}.blocks-app .stock-color-filter label.white-color{background:#fff}.blocks-app .stock-color-filter label.orange-color{background:#fa8c16}.blocks-app .stock-color-filter label.red-color{background:#f5222d}.blocks-app .stock-color-filter label.purple-color{background:#722ed1}.blocks-app .stock-color-filter label.magenta-color{background:#eb2f96}.blocks-app .stock-color-filter label.green-color{background:#52c41a}.blocks-app .stock-color-filter label.teal-color{background:#43c3c3}.blocks-app .stock-color-filter label.blue-color{background:#1677ff}.blocks-app .stock-color-filter .ant-radio-button-wrapper:not(:first-child):before{display:none}.blocks-app .serach-results{padding-top:6px}.blocks-app .serach-results .stock-search-input{width:322px;padding:0 2px}.blocks-app .serach-results .blocks-search__divider-wrapper{width:calc(100% + 48px);margin-top:12px;margin-left:-24px;margin-right:-24px;position:relative}.blocks-app .serach-results .blocks-search__divider-wrapper .ant-divider-horizontal{pointer-events:none;border-top:1px solid var(--colorBorderSecondary);background:linear-gradient(180deg, var(--colorBgContainerDisabled), transparent 40%);border-bottom:none;width:100%;height:20px;min-height:20px;margin:0;position:relative;bottom:auto;left:auto;right:auto}.dark .blocks-app .image-center .stock-tab .serach-results .blocks-search__divider-wrapper .ant-divider-horizontal{background:linear-gradient(180deg, var(--colorBgBase), transparent 40%)}.dark .blocks-app .stock-tab .list-item{background:#2b2b2b;border:1px solid #2b2b2b}.dark .blocks-app .stock-tab .list-item.loaded{border:1px solid #434343}.blocks-app .image-center .image-center-image-preview{justify-content:center;align-items:center;display:flex}.blocks-app .image-center .ant-divider-horizontal{pointer-events:none;z-index:1;background:linear-gradient(180deg, var(--colorBgContainerDisabled), transparent 40%);width:calc(100% + 48px);height:20px;margin:24px -24px 0;position:absolute;bottom:-19px}.dark .blocks-app .image-center .ant-divider-horizontal{background:linear-gradient(180deg, var(--colorBgBase), transparent 40%)}.blocks-app .image-center .ant-divider-horizontal.ant-divider-with-text{background:0 0;width:calc(100% + 38px);margin:0 -24px 20px;position:relative;top:0}.blocks-app .image-center img{border-radius:4px;max-width:524px;max-height:352px}.blocks-app .image-center .image-size{justify-content:center;margin-top:6px;font-size:14px;line-height:22px;display:flex}.blocks-app .image-center .ant-upload.ant-upload-drag{border-radius:6px}.blocks-app .image-center .ant-modal-body .stock-search-input{margin-bottom:0}.blocks-app .image-center .ant-modal-body .serach-results .stock-search-input{margin-bottom:10px}.blocks-app .image-center .ant-modal-body .ant-form:not(.serach-results) .ant-form-item:last-child{margin-bottom:0}.blocks-app .image-center .ant-modal-body .ant-tabs{transition:all .7s cubic-bezier(.075,.82,.165,1)}.blocks-app .image-center .ant-modal-body .ant-tabs .ant-tabs-content-holder{overflow-y:clip}.blocks-app .ant-modal{transition:width .7s ease-in-out}")),document.head.appendChild(o)}}catch(a){console.error("vite-plugin-css-injected-by-js",a)}})();
2
- __useblocks__.define("static/core/90f16a4b.js", [
3
- "require",
4
- "exports",
5
- "module",
6
- "static/core/63b7b25e.js",
7
- "static/core/bcee99d6.js",
8
- "static/core/6c0b4555.js",
9
- "static/core/b0712bbb.js",
10
- "static/core/411c06d9.js",
11
- "static/core/40f1c391.js",
12
- "react",
13
- "react/jsx-runtime"
14
- ], function(ge, gt, on) {
15
- const Ze = ge("./63b7b25e.js"), u = ge("./bcee99d6.js"), Z = ge("./6c0b4555.js"), ne = ge("./b0712bbb.js"), m = ge("./411c06d9.js"), P = ge("./40f1c391.js");
16
- let n = ge("react");
17
- n = Ze.__toESM(n);
18
- let r = ge("react/jsx-runtime");
19
- var ht = Ze.__toESM(ne.require_prop_types());
20
- function yt(t, e) {
21
- return { [t]: {
22
- Filter: e("Filter"),
23
- filter: e("filter"),
24
- Resize: e("Resize"),
25
- resize: e("resize"),
26
- Crop: e("Crop"),
27
- Width: e("Width"),
28
- width: e("width"),
29
- Height: e("Height"),
30
- height: e("height"),
31
- "Background color": e("Background color"),
32
- Cancel: e("Cancel"),
33
- Create: e("Create"),
34
- Objects: e("Objects"),
35
- Quality: e("Quality"),
36
- Save: e("Save"),
37
- "Loading Canvas": e("Loading Canvas"),
38
- "Loading Image": e("Loading Image"),
39
- "Loading State": e("Loading State"),
40
- "Processing Image": e("Processing Image"),
41
- Close: e("Close"),
42
- Apply: e("Apply"),
43
- Font: e("Font"),
44
- Color: e("Color"),
45
- Background: e("Background"),
46
- Image: e("Image"),
47
- Opacity: e("Opacity"),
48
- Outline: e("Outline"),
49
- Shadow: e("Shadow"),
50
- Gradient: e("Gradient"),
51
- Texture: e("Texture"),
52
- "Replace Image": e("Replace Image"),
53
- "Outline Color": e("Outline Color"),
54
- "Shadow Color": e("Shadow Color"),
55
- "Font Size": e("Font Size"),
56
- Radius: e("Radius"),
57
- "Brush Color": e("Brush Color"),
58
- "Brush Type": e("Brush Type"),
59
- "Brush Size": e("Brush Size"),
60
- History: e("History"),
61
- "Maintain aspect ratio": e("Maintain aspect ratio"),
62
- "New Text": e("New Text"),
63
- Size: e("Size"),
64
- Draw: e("Draw"),
65
- Text: e("Text"),
66
- Stickers: e("Stickers"),
67
- Frame: e("Frame"),
68
- Shapes: e("Shapes"),
69
- Corners: e("Corners"),
70
- corners: e("corners"),
71
- Done: e("Done"),
72
- "Applied Filters": e("Applied Filters"),
73
- "Resized Image": e("Resized Image"),
74
- "Cropped Image": e("Cropped Image"),
75
- "Added Drawing": e("Added Drawing"),
76
- "Added Text": e("Added Text"),
77
- "Added Shape": e("Added Shape"),
78
- "Added Sticker": e("Added Sticker"),
79
- "Added Frame": e("Added Frame"),
80
- "Merged Objects": e("Merged Objects"),
81
- "Rounded Corner": e("Rounded Corner"),
82
- "Replaced Background Image": e("Replaced Background Image"),
83
- "Added Image": e("Added Image"),
84
- Initial: e("Initial"),
85
- "Loaded State": e("Loaded State"),
86
- "Changed Style": e("Changed Style"),
87
- "Deleted object": e("Deleted object"),
88
- Merge: e("Merge"),
89
- Emoticons: e("Emoticons"),
90
- Doodles: e("Doodles"),
91
- Landmarks: e("Landmarks"),
92
- Bubbles: e("Bubbles"),
93
- Transportation: e("Transportation"),
94
- Beach: e("Beach"),
95
- PencilBrush: e("PencilBrush"),
96
- SprayBrush: e("SprayBrush"),
97
- CircleBrush: e("CircleBrush"),
98
- DiamondBrush: e("DiamondBrush"),
99
- VLineBrush: e("VLineBrush"),
100
- HLineBrush: e("HLineBrush"),
101
- SquareBrush: e("SquareBrush"),
102
- Square: e("Square"),
103
- square: e("square")
104
- } };
105
- }
106
- function Xe(t, e = "application/octet-stream") {
107
- let o = t.trim(), a = e?.trim() || "application/octet-stream";
108
- const i = o.indexOf(",");
109
- if (o.startsWith("data:") && i >= 0) {
110
- const d = o.slice(5, i).split(";")[0]?.trim();
111
- d && (a = d), o = o.slice(i + 1);
112
- }
113
- const l = o.replace(/\s/g, ""), b = atob(l), p = new Uint8Array(b.length);
114
- for (let d = 0; d < b.length; d++) p[d] = b.charCodeAt(d);
115
- return new Blob([p], { type: a });
116
- }
117
- var vt = "static/media/image-editor", Ct = { text: {
118
- replaceDefaultItems: !0,
119
- defaultText: "Handwriting",
120
- items: [
121
- {
122
- family: "Inter",
123
- src: "fonts/inter-v20-cyrillic_latin-regular.woff2"
124
- },
125
- {
126
- family: "Commissioner",
127
- src: "fonts/commissioner-v24-cyrillic_latin-regular.woff2"
128
- },
129
- {
130
- family: "Montserrat Light",
131
- src: "fonts/Montserrat-Light.woff2"
132
- },
133
- {
134
- family: "Montserrat Regular",
135
- src: "fonts/Montserrat-Regular.woff2"
136
- },
137
- {
138
- family: "Montserrat Bold",
139
- src: "fonts/Montserrat-Bold.woff2"
140
- },
141
- {
142
- family: "Montserrat Black",
143
- src: "fonts/Montserrat-Black.woff2"
144
- },
145
- {
146
- family: "Roboto Light",
147
- src: "fonts/Roboto-Light.woff2"
148
- },
149
- {
150
- family: "Roboto Regular",
151
- src: "fonts/Roboto-Regular.woff2"
152
- },
153
- {
154
- family: "Roboto Bold",
155
- src: "fonts/Roboto-Bold.woff2"
156
- },
157
- {
158
- family: "Roboto Black",
159
- src: "fonts/Roboto-Black.woff2"
160
- },
161
- {
162
- family: "Lato Light",
163
- src: "fonts/Lato-Light.woff2"
164
- },
165
- {
166
- family: "Lato Regular",
167
- src: "fonts/Lato-Regular.woff2"
168
- },
169
- {
170
- family: "Lato Bold",
171
- src: "fonts/Lato-Bold.woff2"
172
- },
173
- {
174
- family: "Lato Black",
175
- src: "fonts/Lato-Black.woff2"
176
- },
177
- {
178
- family: "Rubik Light",
179
- src: "fonts/Rubik-Light.woff2"
180
- },
181
- {
182
- family: "Rubik Regular",
183
- src: "fonts/Rubik-Regular.woff2"
184
- },
185
- {
186
- family: "Rubik Bold",
187
- src: "fonts/Rubik-Bold.woff2"
188
- },
189
- {
190
- family: "Rubik Black",
191
- src: "fonts/Rubik-Black.woff2"
192
- },
193
- {
194
- family: "Bebas Neue Light",
195
- src: "fonts/BebasNeueLight.woff2"
196
- },
197
- {
198
- family: "Bebas Neue Regular",
199
- src: "fonts/BebasNeueRegular.woff2"
200
- },
201
- {
202
- family: "Bebas Neue Book",
203
- src: "fonts/BebasNeueBook.woff2"
204
- },
205
- {
206
- family: "Bebas Neue Bold",
207
- src: "fonts/BebasNeueBold.woff2"
208
- },
209
- {
210
- family: "Fira Sans",
211
- src: "fonts/fira-sans-v11-latin-ext_latin_cyrillic-regular.woff2"
212
- },
213
- {
214
- family: "Lobster",
215
- src: "fonts/Lobster.woff2"
216
- },
217
- {
218
- family: "Pacifico",
219
- src: "fonts/pacifico-v23-cyrillic_latin-regular.woff2"
220
- },
221
- {
222
- family: "Playfair Display",
223
- src: "fonts/playfair-display-v40-cyrillic_latin-regular.woff2"
224
- },
225
- {
226
- family: "Oswald",
227
- src: "fonts/oswald-v57-cyrillic_latin-regular.woff2"
228
- },
229
- {
230
- family: "Caveat",
231
- src: "fonts/caveat-v23-cyrillic_latin-regular.woff2"
232
- }
233
- ]
234
- } };
235
- function bt(t, e) {
236
- if (t === "json") return new Blob([e], { type: "application/json" });
237
- if (t === "svg") return new Blob([e], { type: "image/svg+xml" });
238
- const o = `image/${t}`;
239
- return Xe(e.replace(/data:image\/([a-z]*)?;base64,/, ""), o);
240
- }
241
- var wt = ({ currentImageLink: t, prefetchedBlob: e, resolveImageBlob: o, onSave: a, uploadImageResultIsLoading: i }) => {
242
- const l = P.useCookieManager(), [b, p] = (0, n.useState)(), [d, v] = (0, n.useState)(), { __: I } = m.useI18n();
243
- let w = u.useDispatch();
244
- const C = u.useStore(), R = u.useAppConfig(), y = u.useSelector(u.selectedCurrentUser), L = u.useSelector(Z.selectSecondModal), A = u.useSelector(u.selectProject), F = (0, n.useMemo)(() => {
245
- if (!R?.icons) return;
246
- const j = {};
247
- for (const [T, E] of Object.entries(R.icons)) typeof E == "string" && (j[T] = P.sanitizeHtml(E));
248
- return Object.keys(j).length > 0 ? j : void 0;
249
- }, [R?.icons]), O = (0, n.useRef)(!1), [D, H] = (0, n.useState)(), B = u.useEventEmitter(u.events.FILE_PROXY_EVENT_ID);
250
- (0, n.useEffect)(() => {
251
- let j = !1;
252
- return (async () => {
253
- const E = t;
254
- if (!E && !e) return;
255
- let x = e;
256
- if (!x && E) try {
257
- typeof o == "function" ? x = await o(E) : x = await (await fetch(E)).blob();
258
- } catch {
259
- if (j) return;
260
- if (x = await B.fire({
261
- url: E,
262
- project: A
263
- }).filter((U) => U instanceof Blob)[0], !x) {
264
- const U = l.get(u.APP_COOKIES.em_token) || await u.di.getInstance(C, Z.TOKEN_ID);
265
- x = await (await fetch(`https://app.useblocks.io/api/wp-json/cors-proxy/v1/get?url=${encodeURIComponent(E)}`, { headers: { authorization: `Bearer ${U}` } })).blob();
266
- }
267
- }
268
- if (j || !x) return;
269
- const S = new FileReader();
270
- S.onload = () => {
271
- if (j) return;
272
- const U = S.result;
273
- typeof U == "string" && (p(U), v(x.type), D?.tools.import.openBackgroundImage(U));
274
- }, S.onerror = () => {}, S.readAsDataURL(x);
275
- })().catch((E) => {}), () => {
276
- j = !0;
277
- };
278
- }, [
279
- t,
280
- e,
281
- o,
282
- l,
283
- D,
284
- B,
285
- A,
286
- C
287
- ]);
288
- const z = (0, n.useCallback)(() => {
289
- p(null), v(null), w(Z.closeSecondModal()), w(Z.closeModal(u.MODALS.UPLOAD_IMAGE_MODAL));
290
- }, [w]), V = (0, n.useRef)();
291
- V.current = async function(j, T, E) {
292
- try {
293
- const x = bt(E, j);
294
- a && await a(new File([x], T, {
295
- lastModified: Date.now(),
296
- type: x.type
297
- }));
298
- } catch (x) {
299
- throw x;
300
- }
301
- };
302
- const ee = (0, n.useCallback)((j) => {
303
- if (j && !(O.current && D)) {
304
- O.current = !0;
305
- const T = y.locale ? y.locale.replace("_", "-") : "en-US", E = y.theme === "system" ? matchMedia("(prefers-color-scheme: dark)").matches ? u.DARK : u.LIGHT : y.theme;
306
- P.Tf.init({
307
- selector: "#pixie-editor",
308
- baseUrl: m.getBundledHostAssetUrl(vt),
309
- image: b,
310
- activeLanguage: T,
311
- languages: yt(T, I),
312
- tools: Ct,
313
- ui: {
314
- menubar: {
315
- replaceDefaultItems: !0,
316
- items: [
317
- {
318
- type: "undoWidget",
319
- align: "left"
320
- },
321
- {
322
- type: "zoomWidget",
323
- align: "center",
324
- desktopOnly: !0
325
- },
326
- {
327
- type: "button",
328
- icon: (0, r.jsx)(m.EmIcons, {
329
- icon: "HistoryOutlined",
330
- configIcons: F,
331
- style: { fontSize: 20 }
332
- }),
333
- align: "right",
334
- desktopOnly: !0,
335
- action: (x) => {
336
- x.togglePanel("history");
337
- }
338
- },
339
- {
340
- type: "button",
341
- icon: (0, r.jsx)(m.EmIcons, {
342
- icon: "CloseOutlined",
343
- configIcons: F,
344
- style: { fontSize: 20 }
345
- }),
346
- align: "right",
347
- desktopOnly: !0,
348
- action: () => z()
349
- }
350
- ]
351
- },
352
- nav: { position: "top" },
353
- activeTheme: E,
354
- mode: "inline",
355
- forceOverlayModeOnMobile: !1
356
- },
357
- onSave: async function(x, S, U) {
358
- try {
359
- await V.current(x, S, U);
360
- } catch {}
361
- }
362
- }).then((x) => {
363
- H(x);
364
- }).catch((x) => {});
365
- }
366
- }, [
367
- y.theme,
368
- b,
369
- D,
370
- H,
371
- y.locale,
372
- I,
373
- z,
374
- F
375
- ]), q = (0, n.useCallback)(() => {
376
- D?.tools.export.save(t?.split("/").pop().split(".")[0], d?.split("/")[1]);
377
- }, [
378
- D,
379
- t,
380
- d
381
- ]);
382
- return (0, r.jsxs)(m.Modal, {
383
- afterOpenChange: ee,
384
- width: "100%",
385
- style: {
386
- maxWidth: "100%",
387
- minHeight: "100vh"
388
- },
389
- className: "image-editor-modal",
390
- centered: !0,
391
- closable: !1,
392
- zIndex: 1100,
393
- mask: !1,
394
- open: L,
395
- footer: [(0, r.jsx)(m.Button, {
396
- className: "em-analytics__profile-cancel",
397
- onClick: z,
398
- children: I("Cancel")
399
- }, "Cancel"), (0, r.jsx)(m.Button, {
400
- className: "em-analytics__profile-updapixiete",
401
- id: "save",
402
- type: "primary",
403
- onClick: q,
404
- children: I("Update")
405
- }, "Ok")],
406
- children: [i && (0, r.jsx)("div", {
407
- style: {
408
- position: "absolute",
409
- height: "100%",
410
- width: "100%",
411
- display: "flex",
412
- alignItems: "center",
413
- justifyContent: "center",
414
- background: "var(--colorBgLayout)",
415
- zIndex: 10,
416
- opacity: .7
417
- },
418
- children: (0, r.jsx)(m.Spin, { size: "large" })
419
- }), (0, r.jsx)("div", { id: "pixie-editor" })]
420
- });
421
- }, At = ({ currentImageLink: t, newLink: e, previewDisplayUrl: o, resolvedPreviewObjectUrl: a, resolvedPreviewBlob: i, resolveImageBlob: l, onSave: b, uploadImageResultIsLoading: p }) => {
422
- const d = o || a;
423
- return (0, r.jsxs)(r.Fragment, { children: [(0, r.jsx)("div", { children: (0, r.jsxs)("div", {
424
- className: "image-preview",
425
- children: [p && (0, r.jsx)("div", {
426
- style: {
427
- position: "absolute",
428
- height: "100%",
429
- width: "100%",
430
- display: "flex",
431
- alignItems: "center",
432
- justifyContent: "center",
433
- background: "var(--colorBgLayout)",
434
- zIndex: 10,
435
- opacity: .7
436
- },
437
- children: (0, r.jsx)(m.Spin, { size: "large" })
438
- }), d && (0, r.jsx)("img", {
439
- alt: "uploadedImage",
440
- src: d
441
- })]
442
- }) }), (0, r.jsx)(wt, {
443
- currentImageLink: t,
444
- prefetchedBlob: i,
445
- resolveImageBlob: l,
446
- newLink: e,
447
- onSave: b,
448
- uploadImageResultIsLoading: p
449
- })] });
450
- }, Re = {
451
- Pixel: "Pixel",
452
- Percent: "Percent"
453
- }, Je = {
454
- unit: Re.Percent,
455
- value: 80
456
- };
457
- function It(t) {
458
- return typeof t == "number" ? {
459
- unit: Re.Percent,
460
- value: t * 100
461
- } : typeof t == "string" ? /^(\d*(\.\d+)?)px$/.exec(t) ? {
462
- unit: Re.Pixel,
463
- value: parseFloat(t)
464
- } : /^(\d*(\.\d+)?)%$/.exec(t) ? {
465
- unit: Re.Percent,
466
- value: parseFloat(t)
467
- } : Je : Je;
468
- }
469
- function xt(t, e) {
470
- const o = It(t);
471
- let a;
472
- return o.unit === Re.Pixel ? a = `${o.value}px` : a = `${100 - o.value}%`, e ? `${a} 0px 0px 0px` : `0px 0px ${a} 0px`;
473
- }
474
- function $e({ next: t, hasMore: e, children: o, loader: a, scrollThreshold: i = .8, endMessage: l, style: b, height: p, scrollableTarget: d, hasChildren: v, inverse: I = !1, pullDownToRefresh: w = !1, pullDownToRefreshContent: C, releaseToRefreshContent: R, pullDownToRefreshThreshold: y = 100, refreshFunction: L, onScroll: A, dataLength: F, initialScrollY: O, className: D = "", role: H, tabIndex: B, id: z, ...V }) {
475
- const [ee, q] = (0, n.useState)(!1), [j, T] = (0, n.useState)(!1), [E, x] = (0, n.useState)(0), S = (0, n.useRef)(null), U = (0, n.useRef)(null), Y = (0, n.useRef)(null), K = (0, n.useRef)(t);
476
- K.current = t;
477
- const s = (0, n.useRef)(L);
478
- s.current = L;
479
- const h = (0, n.useRef)(y);
480
- h.current = y;
481
- const W = (0, n.useRef)(!1), fe = (0, n.useRef)(!1), N = (0, n.useRef)(0), J = (0, n.useRef)(0), $ = (0, n.useRef)(0), G = (0, n.useCallback)(() => d instanceof HTMLElement ? d : typeof d == "string" ? document.getElementById(d) : null, [d]);
482
- (0, n.useEffect)(() => {
483
- if (typeof F > "u") throw new Error("mandatory prop \"dataLength\" is missing. The prop is needed when loading more content. Check README.md for usage");
484
- if (w && typeof L != "function") throw new Error(`Mandatory prop "refreshFunction" missing.
485
- Pull Down To Refresh functionality will not work
486
- as expected. Check README.md for usage'`);
487
- if (typeof O == "number") {
488
- const _ = p ? S.current : G();
489
- _ && _.scrollHeight > O && _.scrollTo(0, O);
490
- }
491
- }, []), (0, n.useEffect)(() => {
492
- W.current = !1, q(!1);
493
- }, [F]), (0, n.useEffect)(() => {
494
- if (!e || typeof IntersectionObserver > "u") return;
495
- const _ = U.current;
496
- if (!_) return;
497
- const re = p ? S.current : G(), M = new IntersectionObserver(([ae]) => {
498
- !ae.isIntersecting || W.current || (W.current = !0, q(!0), K.current());
499
- }, {
500
- root: re,
501
- rootMargin: xt(i, I),
502
- threshold: 0
503
- });
504
- return M.observe(_), () => M.disconnect();
505
- }, [
506
- e,
507
- i,
508
- I,
509
- p,
510
- G
511
- ]), (0, n.useEffect)(() => {
512
- var _;
513
- if (!A) return;
514
- const re = (_ = p ? S.current : G()) !== null && _ !== void 0 ? _ : typeof window < "u" ? window : null;
515
- if (!re) return;
516
- const M = (ae) => {
517
- setTimeout(() => A(ae), 0);
518
- };
519
- return re.addEventListener("scroll", M), () => re.removeEventListener("scroll", M);
520
- }, [
521
- A,
522
- p,
523
- G
524
- ]), (0, n.useEffect)(() => {
525
- var _, re;
526
- if (!w) return;
527
- const M = (_ = p ? S.current : G()) !== null && _ !== void 0 ? _ : typeof window < "u" ? window : null;
528
- if (!M) return;
529
- if (!((re = Y.current) === null || re === void 0) && re.firstChild) {
530
- const X = Y.current.firstChild.getBoundingClientRect().height;
531
- $.current = X, x(X);
532
- }
533
- const ae = (X) => {
534
- (M instanceof HTMLElement ? M.scrollTop : document.documentElement.scrollTop) > 0 || (fe.current = !0, X instanceof MouseEvent ? N.current = X.pageY : X instanceof TouchEvent && (N.current = X.touches[0].pageY), J.current = N.current, S.current && (S.current.style.willChange = "transform", S.current.style.transition = "transform 0.2s cubic-bezier(0,0,0.31,1)"));
535
- }, g = (X) => {
536
- if (!fe.current || (X instanceof MouseEvent ? J.current = X.pageY : X instanceof TouchEvent && (J.current = X.touches[0].pageY), J.current < N.current)) return;
537
- const ce = J.current - N.current;
538
- ce >= h.current && T(!0), !(ce > $.current * 1.5) && S.current && (S.current.style.overflow = "visible", S.current.style.transform = `translate3d(0px, ${ce}px, 0px)`);
539
- }, te = () => {
540
- N.current = 0, J.current = 0, fe.current = !1, T((X) => {
541
- var ce;
542
- return X && ((ce = s.current) === null || ce === void 0 || ce.call(s)), !1;
543
- }), requestAnimationFrame(() => {
544
- S.current && (S.current.style.overflow = "auto", S.current.style.transform = "none", S.current.style.willChange = "unset");
545
- });
546
- };
547
- return M.addEventListener("touchstart", ae), M.addEventListener("touchmove", g), M.addEventListener("touchend", te), M.addEventListener("mousedown", ae), M.addEventListener("mousemove", g), M.addEventListener("mouseup", te), () => {
548
- M.removeEventListener("touchstart", ae), M.removeEventListener("touchmove", g), M.removeEventListener("touchend", te), M.removeEventListener("mousedown", ae), M.removeEventListener("mousemove", g), M.removeEventListener("mouseup", te);
549
- };
550
- }, [
551
- w,
552
- p,
553
- G
554
- ]);
555
- const he = {
556
- height: p ?? "auto",
557
- overflow: "auto",
558
- WebkitOverflowScrolling: "touch",
559
- ...b
560
- }, ie = v || !!(o && o instanceof Array && o.length), me = w && p ? { overflow: "auto" } : {}, Ae = e ? (0, r.jsx)("div", {
561
- ref: U,
562
- style: { height: 1 }
563
- }) : null;
564
- return (0, r.jsx)("div", {
565
- style: me,
566
- className: "infinite-scroll-component__outerdiv",
567
- children: (0, r.jsxs)("div", {
568
- ...V,
569
- role: H,
570
- tabIndex: B,
571
- id: z,
572
- className: ["infinite-scroll-component", D].filter(Boolean).join(" "),
573
- ref: S,
574
- style: he,
575
- children: [
576
- w && (0, r.jsx)("div", {
577
- style: { position: "relative" },
578
- ref: Y,
579
- children: (0, r.jsx)("div", {
580
- style: {
581
- position: "absolute",
582
- left: 0,
583
- right: 0,
584
- top: -1 * E
585
- },
586
- children: j ? R : C
587
- })
588
- }),
589
- o,
590
- !ee && !ie && e && a,
591
- ee && e && a,
592
- Ae,
593
- !e && l
594
- ]
595
- })
596
- });
597
- }
598
- function St(t, e) {
599
- if (t == null) return {};
600
- var o = Rt(t, e), a, i;
601
- if (Object.getOwnPropertySymbols) {
602
- var l = Object.getOwnPropertySymbols(t);
603
- for (i = 0; i < l.length; i++) a = l[i], !(e.indexOf(a) >= 0) && Object.prototype.propertyIsEnumerable.call(t, a) && (o[a] = t[a]);
604
- }
605
- return o;
606
- }
607
- function Rt(t, e) {
608
- if (t == null) return {};
609
- var o = {}, a = Object.keys(t), i, l;
610
- for (l = 0; l < a.length; l++) i = a[l], !(e.indexOf(i) >= 0) && (o[i] = t[i]);
611
- return o;
612
- }
613
- function De() {
614
- return De = Object.assign || function(t) {
615
- for (var e = 1; e < arguments.length; e++) {
616
- var o = arguments[e];
617
- for (var a in o) Object.prototype.hasOwnProperty.call(o, a) && (t[a] = o[a]);
618
- }
619
- return t;
620
- }, De.apply(this, arguments);
621
- }
622
- function et(t, e) {
623
- var o = Object.keys(t);
624
- if (Object.getOwnPropertySymbols) {
625
- var a = Object.getOwnPropertySymbols(t);
626
- e && (a = a.filter(function(i) {
627
- return Object.getOwnPropertyDescriptor(t, i).enumerable;
628
- })), o.push.apply(o, a);
629
- }
630
- return o;
631
- }
632
- function ke(t) {
633
- for (var e = 1; e < arguments.length; e++) {
634
- var o = arguments[e] != null ? arguments[e] : {};
635
- e % 2 ? et(Object(o), !0).forEach(function(a) {
636
- kt(t, a, o[a]);
637
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(o)) : et(Object(o)).forEach(function(a) {
638
- Object.defineProperty(t, a, Object.getOwnPropertyDescriptor(o, a));
639
- });
640
- }
641
- return t;
642
- }
643
- function kt(t, e, o) {
644
- return e in t ? Object.defineProperty(t, e, {
645
- value: o,
646
- enumerable: !0,
647
- configurable: !0,
648
- writable: !0
649
- }) : t[e] = o, t;
650
- }
651
- var Et = {
652
- breakpointCols: void 0,
653
- className: void 0,
654
- columnClassName: void 0,
655
- children: void 0,
656
- columnAttrs: void 0,
657
- column: void 0
658
- }, Te = 2, Ne = class extends n.default.Component {
659
- constructor(t) {
660
- super(t), this.reCalculateColumnCount = this.reCalculateColumnCount.bind(this), this.reCalculateColumnCountDebounce = this.reCalculateColumnCountDebounce.bind(this);
661
- let e;
662
- this.props.breakpointCols && this.props.breakpointCols.default ? e = this.props.breakpointCols.default : e = parseInt(this.props.breakpointCols) || Te, this.state = { columnCount: e };
663
- }
664
- componentDidMount() {
665
- this.reCalculateColumnCount(), window && window.addEventListener("resize", this.reCalculateColumnCountDebounce);
666
- }
667
- componentDidUpdate() {
668
- this.reCalculateColumnCount();
669
- }
670
- componentWillUnmount() {
671
- window && window.removeEventListener("resize", this.reCalculateColumnCountDebounce);
672
- }
673
- reCalculateColumnCountDebounce() {
674
- if (!window || !window.requestAnimationFrame) {
675
- this.reCalculateColumnCount();
676
- return;
677
- }
678
- window.cancelAnimationFrame && window.cancelAnimationFrame(this._lastRecalculateAnimationFrame), this._lastRecalculateAnimationFrame = window.requestAnimationFrame(() => {
679
- this.reCalculateColumnCount();
680
- });
681
- }
682
- reCalculateColumnCount() {
683
- const t = window && window.innerWidth || Infinity;
684
- let e = this.props.breakpointCols;
685
- typeof e != "object" && (e = { default: parseInt(e) || Te });
686
- let o = Infinity, a = e.default || Te;
687
- for (let i in e) {
688
- const l = parseInt(i);
689
- l > 0 && t <= l && l < o && (o = l, a = e[i]);
690
- }
691
- a = Math.max(1, parseInt(a) || 1), this.state.columnCount !== a && this.setState({ columnCount: a });
692
- }
693
- itemsInColumns() {
694
- const t = this.state.columnCount, e = new Array(t), o = n.default.Children.toArray(this.props.children);
695
- for (let a = 0; a < o.length; a++) {
696
- const i = a % t;
697
- e[i] || (e[i] = []), e[i].push(o[a]);
698
- }
699
- return e;
700
- }
701
- renderColumns() {
702
- const { column: t, columnAttrs: e = {}, columnClassName: o } = this.props, a = this.itemsInColumns(), i = `${100 / a.length}%`;
703
- let l = o;
704
- l && typeof l != "string" && (this.logDeprecated("The property \"columnClassName\" requires a string"), typeof l > "u" && (l = "my-masonry-grid_column"));
705
- const b = ke(ke(ke({}, t), e), {}, {
706
- style: ke(ke({}, e.style), {}, { width: i }),
707
- className: l
708
- });
709
- return a.map((p, d) => n.default.createElement("div", De({}, b, { key: d }), p));
710
- }
711
- logDeprecated(t) {}
712
- render() {
713
- const t = this.props, { children: e, breakpointCols: o, columnClassName: a, columnAttrs: i, column: l, className: b } = t, p = St(t, [
714
- "children",
715
- "breakpointCols",
716
- "columnClassName",
717
- "columnAttrs",
718
- "column",
719
- "className"
720
- ]);
721
- let d = b;
722
- return typeof b != "string" && (this.logDeprecated("The property \"className\" requires a string"), typeof b > "u" && (d = "my-masonry-grid")), n.default.createElement("div", De({}, p, { className: d }), this.renderColumns());
723
- }
724
- };
725
- Ne.defaultProps = Et;
726
- function Fe(t, e) {
727
- return t ? t.exhausted ? {
728
- ...t,
729
- src: null
730
- } : {
731
- ...t,
732
- src: t.src || e || null
733
- } : null;
734
- }
735
- function tt({ items: t, getItemId: e, getRequestUrl: o, createController: a }) {
736
- const [i, l] = (0, n.useState)({}), b = (0, n.useRef)(new Map()), p = (0, n.useCallback)((d) => {
737
- const v = e(d), I = o(d), w = `${v}:${I}`;
738
- if (b.current.has(w)) return {
739
- itemId: v,
740
- requestUrl: I,
741
- cacheKey: w,
742
- controller: b.current.get(w)
743
- };
744
- const C = a(I);
745
- return b.current.set(w, C), {
746
- itemId: v,
747
- requestUrl: I,
748
- cacheKey: w,
749
- controller: C
750
- };
751
- }, [
752
- a,
753
- e,
754
- o
755
- ]);
756
- return (0, n.useEffect)(() => {
757
- const d = new Set(), v = {}, I = t.map((w) => {
758
- const { itemId: C, cacheKey: R, controller: y } = p(w);
759
- d.add(R), v[C] = y.src;
760
- const L = Fe(y.handleChangeSrc?.(), y.src);
761
- return L?.changed && L.src && (v[C] = L.src), y.subscribeToSrcChange?.((A) => {
762
- const F = Fe(A, y.src);
763
- !F?.changed || !F.src || l((O) => O[C] === F.src ? O : {
764
- ...O,
765
- [C]: F.src
766
- });
767
- });
768
- }).filter(Boolean);
769
- return b.current.forEach((w, C) => {
770
- d.has(C) || b.current.delete(C);
771
- }), l(v), () => {
772
- I.forEach((w) => w?.());
773
- };
774
- }, [p, t]), {
775
- getDisplaySrc: (0, n.useCallback)((d) => {
776
- const { itemId: v, requestUrl: I, controller: w } = p(d);
777
- return i[v] || w.src || I;
778
- }, [i, p]),
779
- handleLoad: (0, n.useCallback)((d) => {
780
- p(d).controller.handleSuccess();
781
- }, [p]),
782
- handleError: (0, n.useCallback)((d) => {
783
- const { itemId: v, controller: I } = p(d), w = Fe(I.handleError(), I.src);
784
- w?.changed && w.src && l((C) => ({
785
- ...C,
786
- [v]: w.src
787
- }));
788
- }, [p])
789
- };
790
- }
791
- var nt = "blocks", jt = ({ setCurrentImageLink: t, setModalHeight: e, setModalWidth: o, setImageStockList: a, imageStockList: i, currentReq: l, setCurrentReq: b, inputRef: p, setStockLink: d, customRequest: v }) => {
792
- const I = u.useAppConfig(), w = u.useIsStandalone(), [C, R] = (0, n.useState)(!1), [y, L] = (0, n.useState)(2), { __: A } = m.useI18n(), F = m.useNotification(), [O] = Z.useLazyGetUnsplashImageQuery(), [D] = Z.useLazyGetSearchImageQuery(), H = (0, n.useCallback)((s) => s instanceof Error || typeof s?.message == "string" && s.message ? s.message : typeof s?.error?.message == "string" && s.error.message ? s.error.message : A("Failed to load stock images through the configured proxy chain."), [A]), B = (0, n.useCallback)((s) => {
793
- F.error({
794
- id: "STOCK_IMAGES_SEARCH_FAILED",
795
- title: A("Failed to load stock images"),
796
- description: H(s)
797
- });
798
- }, [
799
- A,
800
- H,
801
- F
802
- ]), z = async () => {
803
- C || (R(!0), D({
804
- query: l,
805
- page: y
806
- }).then((s) => {
807
- if (s?.error) {
808
- B(s.error), R(!1);
809
- return;
810
- }
811
- const h = s?.data?.results || [];
812
- a((W) => [...W, ...h]), R(!1), L((W) => W + 1);
813
- }).catch(() => {
814
- R(!1);
815
- }));
816
- };
817
- (0, n.useEffect)(() => {
818
- l.keywords !== "" && V();
819
- }, [l.color, l.orientation]);
820
- const V = async () => {
821
- const s = await D({
822
- query: l,
823
- page: 1
824
- });
825
- if (s?.error) {
826
- B(s.error), a([]);
827
- return;
828
- }
829
- const h = s?.data?.results || [];
830
- h.length > 0 ? (a(h), setTimeout(() => {
831
- o(1060), e("84vh");
832
- }, 0)) : a([]);
833
- }, [ee, q] = (0, n.useState)(null), j = (0, n.useCallback)((s, h, W) => `${s}${s.includes("?") ? "&" : "?"}w=${h}&q=${W}`, []), T = (0, n.useCallback)((s) => u.getProxiedUrl(s, {
834
- config: I,
835
- standalone: w,
836
- resourceType: "stockImages",
837
- intent: "display"
838
- }), [I, w]), { getDisplaySrc: E, handleLoad: x, handleError: S } = tt({
839
- items: i,
840
- getItemId: (0, n.useCallback)((s) => s.id, []),
841
- getRequestUrl: (0, n.useCallback)((s) => j(s.urls.raw, 644, 96), [j]),
842
- createController: T
843
- }), U = (s) => (h) => {
844
- x(s), h.target.parentNode.classList.add("loaded");
845
- }, Y = (s) => () => {
846
- S(s);
847
- }, K = (s, h, W) => {
848
- O(h.download_location), q(W), setTimeout(() => q(null), 2e3), d(`${s.raw}&w=1200&q=96`), t(`${s.raw}&w=1200&q=96`), v(`${s.raw}&w=1200&q=96`);
849
- };
850
- return (0, r.jsxs)("div", {
851
- className: "stock-tab",
852
- children: [(0, r.jsxs)(m.Form, {
853
- onValuesChange: V,
854
- className: i.length > 0 ? "serach-results" : "",
855
- children: [(0, r.jsxs)(m.Row, {
856
- gutter: 24,
857
- children: [(0, r.jsx)(m.Col, {
858
- span: i.length > 0 ? "" : 24,
859
- children: (0, r.jsx)(m.Form.Item, {
860
- className: "stock-search-input",
861
- children: (0, r.jsx)(m.SearchInput, {
862
- onSearch: V,
863
- allowClear: !0,
864
- size: i.length > 0 ? "medium" : "large",
865
- placeholder: A("Search image"),
866
- value: l.keywords,
867
- onChange: (s) => b((h) => ({
868
- ...h,
869
- keywords: s.target.value
870
- })),
871
- ref: p,
872
- spellCheck: "false",
873
- enterButton: !1
874
- })
875
- })
876
- }), i.length > 0 && (0, r.jsxs)(r.Fragment, { children: [(0, r.jsx)(m.Col, { children: (0, r.jsxs)(m.Radio.Group, {
877
- defaultValue: "",
878
- onChange: (s) => b((h) => ({
879
- ...h,
880
- orientation: s.target.value
881
- })),
882
- children: [
883
- (0, r.jsx)(m.Tooltip, {
884
- title: A("All"),
885
- placement: "top",
886
- children: (0, r.jsx)(m.Radio.Button, {
887
- value: "",
888
- children: (0, r.jsx)(P.EmIcons, { icon: "MixedView" })
889
- })
890
- }),
891
- (0, r.jsx)(m.Tooltip, {
892
- title: A("Landscape"),
893
- placement: "top",
894
- children: (0, r.jsx)(m.Radio.Button, {
895
- value: "landscape",
896
- children: (0, r.jsx)(P.EmIcons, { icon: "LandscapeView" })
897
- })
898
- }),
899
- (0, r.jsx)(m.Tooltip, {
900
- title: A("Portrait"),
901
- placement: "top",
902
- children: (0, r.jsx)(m.Radio.Button, {
903
- value: "portrait",
904
- children: (0, r.jsx)(P.EmIcons, { icon: "PortraitView" })
905
- })
906
- }),
907
- (0, r.jsx)(m.Tooltip, {
908
- title: A("Squarish"),
909
- placement: "top",
910
- children: (0, r.jsx)(m.Radio.Button, {
911
- value: "squarish",
912
- children: (0, r.jsx)(P.EmIcons, { icon: "SquareView" })
913
- })
914
- })
915
- ]
916
- }) }), (0, r.jsx)(m.Col, { children: (0, r.jsx)(m.RadioColorFilter, {
917
- defaultValue: "",
918
- onChange: (s) => b((h) => ({
919
- ...h,
920
- color: s.target.value
921
- })),
922
- options: [
923
- {
924
- value: "",
925
- colorClass: "all-colors",
926
- label: A("All")
927
- },
928
- {
929
- value: "black",
930
- colorClass: "black-color",
931
- label: A("Black")
932
- },
933
- {
934
- value: "black_and_white",
935
- colorClass: "bw-color",
936
- label: A("Black and White")
937
- },
938
- {
939
- value: "white",
940
- colorClass: "white-color",
941
- label: A("White")
942
- },
943
- {
944
- value: "orange",
945
- colorClass: "orange-color",
946
- label: A("Orange")
947
- },
948
- {
949
- value: "red",
950
- colorClass: "red-color",
951
- label: A("Red")
952
- },
953
- {
954
- value: "purple",
955
- colorClass: "purple-color",
956
- label: A("Purple")
957
- },
958
- {
959
- value: "magenta",
960
- colorClass: "magenta-color",
961
- label: A("Magenta")
962
- },
963
- {
964
- value: "green",
965
- colorClass: "green-color",
966
- label: A("Green")
967
- },
968
- {
969
- value: "teal",
970
- colorClass: "teal-color",
971
- label: A("Teal")
972
- },
973
- {
974
- value: "blue",
975
- colorClass: "blue-color",
976
- label: A("Blue")
977
- }
978
- ],
979
- tooltipPlacement: "top"
980
- }) })] })]
981
- }), i.length > 0 && (0, r.jsx)("div", {
982
- className: "blocks-search__divider-wrapper",
983
- children: (0, r.jsx)("div", {
984
- className: "ant-divider ant-divider-horizontal",
985
- role: "separator"
986
- })
987
- })]
988
- }), (0, r.jsx)("div", {
989
- className: "serach-output-wrapper",
990
- style: { marginRight: -10 },
991
- children: i.length > 0 && (0, r.jsx)("div", {
992
- id: "scrollableDiv",
993
- style: {
994
- width: "100%",
995
- height: "calc(84vh - 148px)",
996
- overflow: "auto",
997
- paddingTop: 24,
998
- paddingRight: 14,
999
- paddingLeft: 24,
1000
- marginLeft: -24,
1001
- lineHeight: "0",
1002
- boxSizing: "unset"
1003
- },
1004
- children: (0, r.jsx)($e, {
1005
- dataLength: i && i.length,
1006
- next: z,
1007
- hasMore: i,
1008
- endMessage: (0, r.jsxs)(m.Divider, {
1009
- plain: !0,
1010
- children: [A("That`s all we could find."), " 🤐"]
1011
- }),
1012
- scrollableTarget: "scrollableDiv",
1013
- style: { overflow: "visible" },
1014
- loader: null,
1015
- children: (0, r.jsx)(Ne, {
1016
- breakpointCols: { default: 3 },
1017
- className: "my-masonry-grid",
1018
- columnClassName: "my-masonry-grid_column",
1019
- children: i.map((s) => (0, r.jsxs)("div", {
1020
- className: "list-item",
1021
- onClick: () => K(s.urls, s.links, s.id),
1022
- children: [
1023
- (0, r.jsx)("img", {
1024
- className: ee === s.id ? "loaded-image" : "",
1025
- width: "322px",
1026
- src: E(s),
1027
- alt: s.description,
1028
- onLoad: U(s),
1029
- onError: Y(s)
1030
- }),
1031
- (0, r.jsxs)("p", {
1032
- className: "creator-info",
1033
- onClick: (h) => h.stopPropagation(),
1034
- children: [
1035
- "Photo by",
1036
- " ",
1037
- (0, r.jsx)("a", {
1038
- target: "_blank",
1039
- href: `${s.user.links.html}?utm_source=${nt}&utm_medium=referral`,
1040
- rel: "noreferrer",
1041
- children: s.user.name
1042
- }),
1043
- " ",
1044
- "on",
1045
- " ",
1046
- (0, r.jsx)("a", {
1047
- target: "_blank",
1048
- href: `https://unsplash.com/?utm_source=${nt}&utm_medium=referral`,
1049
- rel: "noreferrer",
1050
- children: "Unsplash"
1051
- })
1052
- ]
1053
- }),
1054
- ee === s.id && (0, r.jsx)(m.Spin, {
1055
- className: "ant-spin",
1056
- size: "small"
1057
- })
1058
- ]
1059
- }, s.id))
1060
- })
1061
- })
1062
- })
1063
- })]
1064
- });
1065
- };
1066
- function rt(t) {
1067
- return /^(https?:)?\/\//i.test(t.trim());
1068
- }
1069
- function Ot(t) {
1070
- const e = t.trim();
1071
- return rt(e) || /^data:/i.test(e) ? e : `data:image/jpeg;base64, ${t}`;
1072
- }
1073
- var Lt = ({ images: t, transitionDuration: e = 1e3 }) => {
1074
- const [o, a] = (0, n.useState)([]);
1075
- return (0, n.useEffect)(() => {
1076
- if (t.length > 0) {
1077
- const i = t[t.length - 1];
1078
- a((l) => [...l, {
1079
- src: i,
1080
- opacity: 0
1081
- }]), setTimeout(() => {
1082
- a((l) => l.map((b, p) => p === l.length - 1 ? {
1083
- ...b,
1084
- opacity: 1
1085
- } : b));
1086
- }, 1e3);
1087
- }
1088
- }, [t]), (0, r.jsx)("div", {
1089
- className: "slideshow-container",
1090
- children: o.map((i, l) => (0, r.jsx)("img", {
1091
- src: Ot(i.src),
1092
- alt: `Slide ${l + 1}`,
1093
- className: "slideshow-image",
1094
- style: {
1095
- opacity: i.opacity,
1096
- transition: `opacity ${e}ms linear`
1097
- }
1098
- }, l))
1099
- });
1100
- };
1101
- function Dt({ setModalHeight: t, customRequest: e, aiTabRef: o, isImageUploaded: a, setIsImageUploaded: i, aiImageRequest: l, imageAiList: b, setImageAiList: p, isLoadingAi: d, setIsLoadingAi: v, onPluginAiImageLimitExceeded: I, onImageGenerateLimitExceeded: w }) {
1102
- const { __: C } = m.useI18n(), R = u.useAppConfig(), y = m.useNotification(), L = u.usePushToDataLayer(), { emailId: A, blockId: F, projectId: O } = u.useParams(), [D] = Z.useLazySendAiImageRequestQuery(), [H, { data: B = [] }] = Z.useLazyGetAiImageSSEQuery(), [z] = Z.useLazyGetLimitsStatsByTypeQuery(), V = R?.sendAIImageRequest || D, ee = R?.trigger || H, q = R?.handleLimitUsageEmitter || u.useEventEmitter(u.events.ON_LIMIT_ID), [j, T] = (0, n.useState)(0), [E, x] = (0, n.useState)(null), [S, U] = (0, n.useState)(!1), [Y, K] = (0, n.useState)(C("Evaluating the task")), [s, h] = (0, n.useState)(!1), W = A || F, { limits: fe } = R?.limits ? R : { limits: { ai_img_limit: 0 } }, { ai_img_limit: N } = fe, J = !!(R.limits && R.counters) && u.PLUGIN.isPlugin, $ = u.useEventEmitter(u.events.AI_IMAGE_REQUEST_ID).hasListeners(), G = ne.shouldCountAiUsage({
1103
- limitsInPlugin: J,
1104
- hostedAiActive: $
1105
- }), he = !$ && N > 0 && j >= N, ie = (0, n.useCallback)(() => {
1106
- q.fire({
1107
- name: "AiImgCount",
1108
- count: j + 1
1109
- });
1110
- }, [q, j]), me = (0, n.useMemo)(() => !he && (!G || N === 0 || j < N), [
1111
- he,
1112
- G,
1113
- j,
1114
- N
1115
- ]), Ae = (0, n.useCallback)(async () => {
1116
- K(C("Evaluating the task")), l !== "" && !d && (v(!0), h(!0), p([]), L({
1117
- event: "submit_form",
1118
- action: "ai_image_generation",
1119
- entity_id: A,
1120
- project_id: O
1121
- }), V({ body: {
1122
- project_id: O,
1123
- request: "create-image",
1124
- connection: "midjourney",
1125
- message: l
1126
- } }).then(({ data: g, error: te }) => {
1127
- if (te) throw te;
1128
- if (g.data.status === 401) throw new Error(u.ERROR);
1129
- if (g?.data?._eventResult) {
1130
- p(g.data.task.images), v(!1), h(!1), K(C("Evaluating the task"));
1131
- return;
1132
- }
1133
- g?.data.status === 200 ? (g?.data.task.id && (K(g.data.task.message), x(g.data.task.id)), g.message && y.success({
1134
- id: "AI_IMAGE_SEND_SUCCESS",
1135
- title: g.message,
1136
- placement: "bottomRight",
1137
- data: l
1138
- }), ee({
1139
- task_id: g?.data.task.id,
1140
- entity_id: W
1141
- })) : (v(!1), h(!1), y.error({
1142
- id: "AI_IMAGE_SEND_ERROR",
1143
- title: g?.message || C("Something went wrong, please try again"),
1144
- placement: "bottomRight",
1145
- data: l,
1146
- innerException: g
1147
- }));
1148
- }).catch((g) => {
1149
- v(!1), h(!1), (g?.error || g?.data) && y.fromError("AI_IMAGE_SEND_ERROR", l, g.error || g);
1150
- }));
1151
- }, [
1152
- l,
1153
- d,
1154
- v,
1155
- h,
1156
- p,
1157
- L,
1158
- A,
1159
- O,
1160
- V,
1161
- y,
1162
- ee,
1163
- W,
1164
- C
1165
- ]), _ = (0, n.useCallback)(async () => {
1166
- if (me) {
1167
- if (!u.PLUGIN.isPlugin && !$) {
1168
- const g = P.resolveLimitActionPreflightExceededForType("image_generate", (await z("image_generate")).data?.stats);
1169
- if (g) {
1170
- w?.(g);
1171
- return;
1172
- }
1173
- }
1174
- G && (T((g) => g + 1), ie()), Ae();
1175
- } else J && (I ? I() : y.error({
1176
- title: C("The usage limit has been exceeded"),
1177
- description: C(`The maximum number of requests for the current subscription period has been reached.
1178
- Select the appropriate plan to fulfil more requests`),
1179
- placement: "bottomRight"
1180
- }));
1181
- }, [
1182
- me,
1183
- J,
1184
- $,
1185
- G,
1186
- z,
1187
- w,
1188
- T,
1189
- ie,
1190
- Ae,
1191
- y,
1192
- C,
1193
- I
1194
- ]);
1195
- (0, n.useEffect)(() => {
1196
- J && T(R?.counters?.ai_img_counter || 0);
1197
- }, [R, J]);
1198
- const re = u.useEventEmitter(u.events.AI_IMAGE_PROGRESS_ID);
1199
- (0, n.useEffect)(() => {
1200
- const g = re.event(({ progress: te, status: X }) => {
1201
- K(X || `${Math.round(te)}%`);
1202
- });
1203
- return () => g.dispose();
1204
- }, [re]);
1205
- const M = (0, n.useCallback)(async (g) => {
1206
- if (!a) {
1207
- i(!0);
1208
- try {
1209
- const te = rt(g) ? await (await fetch(g)).blob() : Xe(g);
1210
- e({ file: new File([te], "image.jpeg", { type: te.type || "image/jpeg" }) });
1211
- } catch {
1212
- i(!1);
1213
- }
1214
- }
1215
- }, [
1216
- a,
1217
- i,
1218
- e
1219
- ]), ae = (0, n.useCallback)((g) => {
1220
- g.status !== "error" && g.status !== "Canceled" ? g.images ? (K(g.status), g.progress === 100 && (p(g.images), K(C("Evaluating the task")), x(null), h(!1))) : (p([g.data]), v(!1)) : (v(!1), h(!1), y.error({
1221
- id: "AI_IMAGE_GET_ERROR",
1222
- title: C("Something went wrong, please try again"),
1223
- placement: "bottomRight",
1224
- data: E
1225
- }));
1226
- }, [
1227
- p,
1228
- K,
1229
- C,
1230
- v,
1231
- t,
1232
- E,
1233
- y,
1234
- h
1235
- ]);
1236
- return (0, n.useEffect)(() => {
1237
- B.length > 1 && ae(B[B.length - 1]);
1238
- }, [B, ae]), (0, n.useEffect)(() => {
1239
- (d || b.length > 0) && setTimeout(() => {
1240
- let g = 550;
1241
- o.current && (g = o.current.offsetHeight + 68), t(g);
1242
- }, 0);
1243
- }, [
1244
- o,
1245
- B,
1246
- b.length,
1247
- d,
1248
- t
1249
- ]), {
1250
- aiImageCounter: j,
1251
- setAiImageCounter: T,
1252
- currentAiImgLimits: N,
1253
- isFieldsDisabled: he,
1254
- canGenerateImage: me,
1255
- aiImageRequest: l,
1256
- imageAiList: b,
1257
- setImageAiList: p,
1258
- isLoadingAi: d,
1259
- setIsLoadingAi: v,
1260
- loadingDuringGeneration: s,
1261
- setLoadingDuringGeneration: h,
1262
- requestStatus: Y,
1263
- setRequestStatus: K,
1264
- handleGenerate: _,
1265
- handleLimitAiImgCount: ie,
1266
- convertBase64ToFile: M,
1267
- isShiftPressed: S,
1268
- setIsShiftPressed: U,
1269
- currentReqId: E,
1270
- setCurrentReqId: x,
1271
- limitsInPlugin: J
1272
- };
1273
- }
1274
- var Bt = ({ setModalHeight: t, customRequest: e, aiTabRef: o, inputAiRef: a, isImageUploaded: i, setIsImageUploaded: l, aiImageRequest: b, setAiImageRequest: p, imageAiList: d, setImageAiList: v, isLoadingAi: I, setIsLoadingAi: w }) => {
1275
- const C = u.useNavigate(), R = u.useDispatch(), { __: y, _n: L } = m.useI18n(), A = u.useAppConfig(), [F, O] = (0, n.useState)(!1), [D, H] = (0, n.useState)(null), { aiImageCounter: B, currentAiImgLimits: z, loadingDuringGeneration: V, requestStatus: ee, handleGenerate: q, convertBase64ToFile: j, isShiftPressed: T, setIsShiftPressed: E, limitsInPlugin: x } = Dt({
1276
- setModalHeight: t,
1277
- customRequest: e,
1278
- aiTabRef: o,
1279
- isImageUploaded: i,
1280
- setIsImageUploaded: l,
1281
- aiImageRequest: b,
1282
- imageAiList: d,
1283
- setImageAiList: v,
1284
- isLoadingAi: I,
1285
- setIsLoadingAi: w,
1286
- onPluginAiImageLimitExceeded: () => O(!0),
1287
- onImageGenerateLimitExceeded: H
1288
- }), S = F && z > 0 ? ne.getAiTariffUpgradeStep(z) : null, U = S ? P.getLimitUpgradePresetDefinition(S.presetId) : null, Y = D ? P.getLimitUpgradePresetDefinition(D.presetId) : null, [K, s] = (0, n.useState)(!1), h = (0, n.useCallback)(() => s(!0), []), W = (0, n.useCallback)(() => s(!1), []), fe = (0, n.useCallback)((G) => p(G.target.value), [p]), N = (0, n.useCallback)((G) => {
1289
- G.key === "Shift" ? E(!0) : G.key === "Enter" && !T && (G.preventDefault(), q());
1290
- }, [
1291
- T,
1292
- q,
1293
- E
1294
- ]), J = (0, n.useCallback)((G) => {
1295
- G.key === "Shift" && E(!1);
1296
- }, [E]), $ = d[d.length - 1];
1297
- return (0, r.jsxs)("div", {
1298
- className: "image-ai",
1299
- children: [
1300
- U && S ? (0, r.jsx)(P.LimitUpgradeModal, {
1301
- open: !0,
1302
- onClose: () => O(!1),
1303
- title: y(U.titleKey),
1304
- subtitle: y(U.subtitleKey),
1305
- usageResource: U.usageResource,
1306
- previousDisplay: P.presetLimitDisplay(S.previousLimit),
1307
- nextDisplay: P.presetLimitDisplay(S.nextLimit),
1308
- onChangePlan: () => {
1309
- O(!1), document.body.classList.remove("editor"), C("/billing"), R(Z.openModal(u.MODALS.SWITCH_TO_PLAN_MODAL));
1310
- }
1311
- }) : null,
1312
- Y && D ? (0, r.jsx)(P.LimitUpgradeModal, {
1313
- open: !0,
1314
- onClose: () => H(null),
1315
- title: y(Y.titleKey),
1316
- subtitle: y(Y.subtitleKey),
1317
- usageResource: Y.usageResource,
1318
- previousDisplay: P.presetLimitDisplay(D.previousLimit),
1319
- nextDisplay: P.presetLimitDisplay(D.nextLimit),
1320
- onChangePlan: () => {
1321
- H(null), document.body.classList.remove("editor"), C("/billing"), R(Z.openModal(u.MODALS.SWITCH_TO_PLAN_MODAL));
1322
- }
1323
- }) : null,
1324
- x && (0, r.jsx)(m.LimitsCounter, {
1325
- text: `${B} ${y("of")} ${z > 0 ? z : "∞"} images ${L("was used", "were used", B)}`,
1326
- exceeded: z > 0 && B >= z,
1327
- style: { marginTop: -25 },
1328
- extra: (0, r.jsx)("span", {
1329
- style: {
1330
- textDecoration: "underline",
1331
- cursor: "pointer"
1332
- },
1333
- onClick: () => C(A.billingPageUrl || u.APP_ROUTES.billing),
1334
- children: y("Need more?")
1335
- })
1336
- }),
1337
- (0, r.jsx)(m.Row, {
1338
- gutter: 24,
1339
- className: "image-ai__row",
1340
- children: (0, r.jsx)(m.Col, {
1341
- span: 24,
1342
- children: (0, r.jsx)(m.Form.Item, {
1343
- style: { margin: 0 },
1344
- children: (0, r.jsxs)("span", {
1345
- className: `ant-input-affix-wrapper ant-input-affix-wrapper-lg image-ai__input-affix-wrapper${K ? " ant-input-affix-wrapper-focused" : ""}`,
1346
- children: [(0, r.jsx)(m.TextArea, {
1347
- ref: a,
1348
- onKeyDown: N,
1349
- onKeyUp: J,
1350
- onFocus: h,
1351
- onBlur: W,
1352
- autoSize: !0,
1353
- allowClear: !0,
1354
- className: "text-area-input-hybrid image-ai__textarea",
1355
- placeholder: y("Generate image"),
1356
- value: b,
1357
- onChange: fe,
1358
- spellCheck: "false"
1359
- }), (0, r.jsx)("span", {
1360
- className: "ant-input-suffix image-ai__input-suffix",
1361
- children: I || V ? (0, r.jsx)(P.EmIcons, {
1362
- icon: "LoadingOutlined",
1363
- className: "input-icon image-ai__input-icon",
1364
- spin: !0
1365
- }) : (0, r.jsx)(P.EmIcons, {
1366
- icon: "AI",
1367
- className: "input-icon image-ai__input-icon",
1368
- onClick: q
1369
- })
1370
- })]
1371
- })
1372
- })
1373
- })
1374
- }),
1375
- (I || d.length > 0) && (0, r.jsxs)("div", {
1376
- className: "image-ai__preview",
1377
- children: [I && d.length === 0 && (0, r.jsx)("div", {
1378
- className: "image-ai__loading",
1379
- children: (0, r.jsxs)("div", {
1380
- className: "spin",
1381
- children: [(0, r.jsx)(P.EmIcons, {
1382
- icon: "LoadingOutlined",
1383
- style: { fontSize: 48 },
1384
- spin: !0
1385
- }), (0, r.jsx)("p", {
1386
- className: "status",
1387
- children: ee
1388
- })]
1389
- })
1390
- }), d.length > 0 && (0, r.jsxs)("div", {
1391
- className: "image-ai__image-item",
1392
- children: [(0, r.jsx)(Lt, { images: d }), (0, r.jsx)("div", {
1393
- className: "buttons",
1394
- children: (0, r.jsx)(m.Button, {
1395
- onClick: () => j($),
1396
- icon: (0, r.jsx)(P.EmIcons, { icon: "CheckOutlined" }),
1397
- children: y("Use this one")
1398
- })
1399
- })]
1400
- })]
1401
- })
1402
- ]
1403
- });
1404
- }, Ut = ({ setNewLink: t, setCurrentImageLink: e, setModalHeight: o, setModalWidth: a, setImageGifList: i, imageGifList: l, currentReqGif: b, setCurrentReqGif: p, inputRef: d, setStockLink: v, customRequest: I }) => {
1405
- const { __: w } = m.useI18n(), C = u.useAppConfig(), R = u.useIsStandalone(), y = m.useNotification(), [L, A] = (0, n.useState)(null), [F, O] = (0, n.useState)(!1), [D, H] = (0, n.useState)(25), [B] = Z.useLazyGetSearchGifQuery(), z = (0, n.useCallback)((s) => s instanceof Error || typeof s?.message == "string" && s.message ? s.message : typeof s?.error?.message == "string" && s.error.message ? s.error.message : w("Failed to load GIFs through the configured proxy chain."), [w]), V = (0, n.useCallback)((s) => {
1406
- y.error({
1407
- id: "STOCK_GIFS_SEARCH_FAILED",
1408
- title: w("Failed to load GIFs"),
1409
- description: z(s)
1410
- });
1411
- }, [
1412
- w,
1413
- z,
1414
- y
1415
- ]), ee = async () => {
1416
- F || (O(!0), B({
1417
- query: b,
1418
- page: D
1419
- }).then((s) => {
1420
- if (s?.error) {
1421
- V(s.error), O(!1);
1422
- return;
1423
- }
1424
- i((h) => [...h, ...s.data.data]), O(!1), H((h) => h + 25);
1425
- }).catch(() => {
1426
- O(!1);
1427
- }));
1428
- }, q = async () => {
1429
- const s = await B({
1430
- query: b,
1431
- page: 0
1432
- });
1433
- if (s?.error) {
1434
- V(s.error), i([]);
1435
- return;
1436
- }
1437
- s?.data?.data?.length > 0 && (i(s.data.data), setTimeout(() => {
1438
- o("84vh"), a(1060);
1439
- }, 0));
1440
- }, j = (s, h) => {
1441
- A(h), setTimeout(() => {
1442
- A(null);
1443
- }, 2e3), v(`${s}`), e(`${s}`), I(`${s}`);
1444
- }, T = { default: 3 }, E = (0, n.useCallback)((s) => u.getProxiedUrl(s, {
1445
- config: C,
1446
- standalone: R,
1447
- resourceType: "generic",
1448
- intent: "display"
1449
- }), [C, R]), { getDisplaySrc: x, handleLoad: S, handleError: U } = tt({
1450
- items: l,
1451
- getItemId: (0, n.useCallback)((s) => s.id, []),
1452
- getRequestUrl: (0, n.useCallback)((s) => s.images.downsized.url, []),
1453
- createController: E
1454
- }), Y = (s) => (h) => {
1455
- S(s), h.target.parentNode.classList.add("loaded");
1456
- }, K = (s) => () => {
1457
- U(s);
1458
- };
1459
- return (0, r.jsxs)("div", {
1460
- className: "stock-tab",
1461
- children: [(0, r.jsxs)(m.Form, {
1462
- onValuesChange: q,
1463
- className: l.length > 0 ? "serach-results" : "",
1464
- children: [(0, r.jsx)(m.Row, {
1465
- gutter: 24,
1466
- children: (0, r.jsx)(m.Col, {
1467
- span: l.length > 0 ? "" : 24,
1468
- children: (0, r.jsx)(m.Form.Item, {
1469
- className: "stock-search-input",
1470
- children: (0, r.jsx)(m.SearchInput, {
1471
- onSearch: q,
1472
- allowClear: !0,
1473
- size: l.length > 0 ? "medium" : "large",
1474
- placeholder: w("Search GIFs"),
1475
- value: b.keywords,
1476
- onChange: (s) => p((h) => ({
1477
- ...h,
1478
- keywords: s.target.value
1479
- })),
1480
- ref: d,
1481
- spellCheck: "false",
1482
- enterButton: !1
1483
- })
1484
- })
1485
- })
1486
- }), l.length > 0 && (0, r.jsx)("div", {
1487
- className: "blocks-search__divider-wrapper",
1488
- children: (0, r.jsx)("div", {
1489
- className: "ant-divider ant-divider-horizontal",
1490
- role: "separator"
1491
- })
1492
- })]
1493
- }), (0, r.jsx)("div", {
1494
- className: "serach-output-wrapper",
1495
- style: { marginRight: -10 },
1496
- children: l.length > 0 && (0, r.jsx)("div", {
1497
- id: "scrollableDiv",
1498
- style: {
1499
- width: "100%",
1500
- height: "calc(84vh - 148px)",
1501
- overflow: "auto",
1502
- paddingTop: 24,
1503
- paddingRight: 14,
1504
- paddingLeft: 24,
1505
- marginLeft: -24,
1506
- lineHeight: "0",
1507
- boxSizing: "unset"
1508
- },
1509
- children: (0, r.jsx)($e, {
1510
- dataLength: l && l.length,
1511
- next: ee,
1512
- hasMore: l,
1513
- endMessage: (0, r.jsxs)(m.Divider, {
1514
- plain: !0,
1515
- children: [w("That`s all we could find."), " 🤐"]
1516
- }),
1517
- scrollableTarget: "scrollableDiv",
1518
- style: { overflow: "visible" },
1519
- loader: (0, r.jsx)(m.Spin, { size: "small" }),
1520
- children: (0, r.jsx)(Ne, {
1521
- breakpointCols: T,
1522
- className: "my-masonry-grid",
1523
- columnClassName: "my-masonry-grid_column",
1524
- children: l.map((s, h) => (0, r.jsxs)("div", {
1525
- className: "list-item",
1526
- onClick: () => j(s.images.downsized.url, s.id),
1527
- children: [
1528
- (0, r.jsx)("img", {
1529
- className: L === s.id ? "loaded-image" : "",
1530
- width: "322px",
1531
- src: x(s),
1532
- alt: s.title,
1533
- onLoad: Y(s),
1534
- onError: K(s)
1535
- }),
1536
- (0, r.jsx)("a", {
1537
- rel: "noreferrer",
1538
- href: "https://giphy.com/",
1539
- target: "_blank",
1540
- onClick: (W) => W.stopPropagation(),
1541
- children: (0, r.jsx)("div", {
1542
- className: "overlay-image",
1543
- style: { backgroundImage: "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAAkCAYAAAB/up84AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABSBJREFUeNrsWjFv2zoQVoMW8BZ18xaN3qLRW9QtW9OtW92to98vaPoP3K1b1S1b3c2jvWlUNm3lw1s8Mpu3PAo4Iocr70jKlp0COuCQlpKPx/t43x1pv3h8fEwGeT5yNoTgeclLZvza6NgxXoNaGRktjE6MpjC2NVqh92bwt4HxBI1ro0s0dgN2tvD5a8a/9vkq0M+xYKdG81A7Gp6pyBjZddrnO6N36Hkbqyn8u4L3vYC0hjLHeAbPVhC4TwAK/ewNvLsEhyxgFXLK2l/D4tvnOVrUiPEh1k/JjvLYyWENdeTcKazBBr6AdY4AqBTmbkIzhO4gvMumYLxAYKzgPTvhBBajYNwCksHYhOyYiow1KONaKYlfO8bPEWyGEfi5Iu+Vjizg7EzB3xvwWTMxWkHG4mDnMF6BnSnYncLzHWGG4BqiwZkKQMC7I0cOVTCJhvRUKNgNCmCOxhNmrBEWzwGi0Y6rIihbsnOH/JgE2hshKrLZv4Px9yhj1twafRlid/UIGWvlFdlVLirIkIM12nETGLeO2tTPECBUZuT/a7JBMpSxUybYLjulUCN2iEpHQoyuGWZJUCa8R/VGSZvGB0iOdjAO9n8EtC2zUxICSIoW0ICTmA53DCDKQzWZg89XAXZ2B2iMavBnjDKpBX6B1tnAM5aqQgGhnU2D6GmHuqw7AkaOPmP/bsHpFC1kTLqVhglS6fFNgX1MCXUHO1zR1h5AFOoSc1jjmKx/An/1PoBQasBSoZZ3hpyaOrg0IW2sRkG8JsU8CaCaLckAhfi6AG0cmeuzkyMQMtL+SiySkY3oA/EgGeICK0UOZYQKVsQpDAjm2BpsaAGQLMKnMdok3yLtpKS70yT7OUBcm7UTHb5grk5y1Csrj40MqUbUpgW7NXo+RunckODkQvdXM37iwm7b1VA7lAaVB4jUUZOUIzNxfOougAwy3GUN0qWG2IJJ09V2NcvIFE8c54nQelEHFM6C6chUhI+WZjjffDQkrenPhqmlrAC9Naof/aLhXZeNNfMZOk+MtPOVRjNmTpfcCut0+biGZ3PBj1ywWTOfqV3v+yjLFuDPRs8Ddu05vLtmsuHQ0s73wehvR0t7aGkPevfCM5fcGr0MbOW9NSSFwF52cP5KcLIv+X4EUGbCemcOqpoz73/haE4CZNkRjAR20vwENXHRc2bWEMyQuUuGVe4hc6K6rBmg7pKN0XdGX7dts9E3Rr8afUATFl1PqgLAG6T3AoX1nSVtMP9l5r5FVyiu+D14/YssRHOheGVQYNMeinrhsMcV2WVPRR1rIRT4QmiA5r4G6oxp0y6ZzFh4LvhmB84MHz1xta9vWQMrcFR/3iF+7DmEu2YoyTshRbuMvGE9hnwGPQR1tdR04aCueKrqAIgiu/AqcCf1JXPhfuoYosGHn4Hgqa6AnCK4IfSkCa1eCJRxLGnn+mX0rfDOJok4AsQAUpwQlND2++HIgNiOVO1LVRIgtXDPs0bpunEU08vktHLMpoJS1/d9qEo6h6gAzq7RRaPV+QmBeICzUUh2fIHzk0s3HedXwkEy2ReQmjn4XDzDjqkN4D/J04/y/np5KbSrrtbwAyx+kTxdf9tfpvSZIW9O3FScHJAF8PEFc5F2lQzSi5wJheoG3U/t0xYOcgBAcOHuAkr7mY9ditoAiCz2q8uvEcD8gJpSDuGNl5hfnaTJ0/fpheMUr4CitHCO6fqdesj359xh1tWiqggfdUCmcz9ZivZ7+BnQM5P/BRgABx8sJWqTxoYAAAAASUVORK5CYII=)" }
1544
- })
1545
- }),
1546
- L === s.id && (0, r.jsx)(m.Spin, {
1547
- className: "ant-spin",
1548
- size: "small"
1549
- })
1550
- ]
1551
- }, s.id + h))
1552
- })
1553
- })
1554
- })
1555
- })]
1556
- });
1557
- };
1558
- function Mt(t) {
1559
- if (!(t == null || t === "")) return t;
1560
- }
1561
- async function Pt(t, e) {
1562
- if (t) {
1563
- if (t.url) return t.url;
1564
- if (typeof e.getFileById == "function" && t.id) {
1565
- const o = await e.getFileById(t.id);
1566
- if (o?.url) return o.url;
1567
- if (o?.thumbnailUrl) return o.thumbnailUrl;
1568
- if (o?.thumbnail) return o.thumbnail;
1569
- }
1570
- if (typeof e.getFileUrl == "function" && t.folderId !== void 0 && t.name) {
1571
- const o = await e.getFileUrl(t.folderId || "", t.name);
1572
- if (o) return o;
1573
- }
1574
- if (typeof e.getUrl == "function" && t.name) {
1575
- const o = await e.getUrl(t);
1576
- if (o) return o;
1577
- }
1578
- return t.thumbnail || t.thumbnailUrl;
1579
- }
1580
- }
1581
- function Tt(t) {
1582
- if (!(!t?.success || !Array.isArray(t.detailed))) return t.detailed.find((e) => e?.success && e.data)?.data;
1583
- }
1584
- function Nt(t, e, o) {
1585
- if (t) return {
1586
- id: t.id,
1587
- name: t.name || e.name,
1588
- size: t.size ?? e.size,
1589
- type: t.type || e.type,
1590
- folderId: t.folderId ?? o ?? "",
1591
- url: t.url,
1592
- thumbnail: t.thumbnail,
1593
- thumbnailUrl: t.thumbnailUrl,
1594
- date: t.date,
1595
- dimensions: t.dimensions,
1596
- aspectRatio: t.aspectRatio,
1597
- extension: t.extension,
1598
- selected: t.selected,
1599
- isFolder: t.isFolder,
1600
- lastEdited: t.lastEdited,
1601
- childrenCount: t.childrenCount
1602
- };
1603
- }
1604
- async function Ft(t, e, o) {
1605
- if (!e) return;
1606
- const a = Mt(o ?? e.rootId);
1607
- let i;
1608
- typeof e.uploadFiles == "function" ? i = Tt(await e.uploadFiles({
1609
- folderId: a,
1610
- items: [{
1611
- name: t.name,
1612
- size: t.size,
1613
- type: t.type,
1614
- folderId: a,
1615
- data: t
1616
- }]
1617
- })) : typeof e.uploadFile == "function" && (i = Nt(await e.uploadFile({
1618
- name: t.name,
1619
- size: t.size,
1620
- type: t.type,
1621
- folderId: a,
1622
- data: t
1623
- }), t, a));
1624
- const l = await Pt(i, e);
1625
- return l ? {
1626
- item: i,
1627
- url: l
1628
- } : void 0;
1629
- }
1630
- var st = "IMG", at = "BACKGROUND", Gt = "GALLERY", we = "EDITOR", de = "UPLOAD", Ge = "STOCK", ze = "GIF", Ke = "AI", zt = { mode: "select" }, Kt = { mode: "save" }, { Dragger: Wt } = m.Upload, Ht = (t, e = "image") => Z.decodeFileNameFromUrl(t) ?? e, Ee = ne.normalizeImageFormatForDisplay, Vt = (t, e) => {
1631
- const o = Ee(e);
1632
- return !o || t.includes(".") ? t : `${t}.${o}`;
1633
- }, qt = (t, e) => new File([t], Vt(Ht(e), t.type), { type: t.type || "application/octet-stream" }), ot = ({ dataProvider: t }) => {
1634
- const e = u.useAppConfig(), o = u.useIsStandalone(), { __: a } = m.useI18n(), i = u.useDispatch(), { projectId: l } = u.useParams(), [b] = Z.useLazyGetImageInfoQuery(), { modal: p } = m.App.useApp(), d = m.useNotification(), v = u.useSelector(Z.selectActiveModal), { request: I, resolveImagePicker: w } = P.useImagePicker(), [C, R] = (0, n.useState)(""), [y, L] = (0, n.useState)(""), [A, F] = (0, n.useState)(""), [O, D] = (0, n.useState)(""), [H, B] = (0, n.useState)(de), [z, V] = (0, n.useState)({
1635
- width: "",
1636
- height: "",
1637
- size: "",
1638
- format: ""
1639
- }), [ee, q] = (0, n.useState)("success"), [j, T] = (0, n.useState)(!1), E = n.default.useRef(null), x = n.default.useRef(null), S = n.default.useRef(null), U = n.default.useRef(null), Y = n.default.useRef(null), K = n.default.useRef(null), s = n.default.useRef(null), h = n.default.useRef(null), W = n.default.useRef(null), [fe, N] = (0, n.useState)("auto"), [J, $] = (0, n.useState)(572), [G, he] = (0, n.useState)(!1), [ie, me] = (0, n.useState)({
1640
- keywords: "",
1641
- color: "",
1642
- orientation: ""
1643
- }), [Ae, _] = (0, n.useState)({ keywords: "" }), [re, M] = (0, n.useState)([]), [ae, g] = (0, n.useState)([]), [te, X] = (0, n.useState)([]), [ce, it] = (0, n.useState)(!1), [lt, We] = (0, n.useState)(""), [Qt, je] = (0, n.useState)(!1), [Yt, Be] = (0, n.useState)(0), He = u.useSelector(u.selectProject), ct = He?.id !== void 0 ? String(He.id) : l || "", ut = u.useEventEmitter(u.events.UPLOAD_EVENT_ID), Ie = n.default.useRef(ne.createImageUrlBlobResolver()), Ve = n.default.useRef(""), Ce = n.default.useRef(0), xe = n.default.useRef(""), [_t, dt] = (0, n.useState)(""), [Zt, ft] = (0, n.useState)(null), [Xt, qe] = (0, n.useState)(""), Ue = (0, n.useCallback)((c) => {
1644
- if (!(c instanceof Blob)) return;
1645
- xe.current && URL.revokeObjectURL(xe.current);
1646
- const f = URL.createObjectURL(c);
1647
- xe.current = f, dt(f), ft(c);
1648
- }, []), pe = (0, n.useCallback)(() => {
1649
- xe.current && (URL.revokeObjectURL(xe.current), xe.current = ""), dt(""), ft(null);
1650
- }, []), le = (0, n.useCallback)(() => {
1651
- qe("");
1652
- }, []), ye = P.isEditorLockedByPlan(He, { isPlugin: u.PLUGIN.isPlugin }), Jt = (c) => {
1653
- L(c.target.value);
1654
- }, Me = (0, n.useCallback)((c, f, k = a("The image could not be uploaded.")) => {
1655
- const Q = f instanceof Error ? f.message : k;
1656
- d.error({
1657
- id: "IMAGE_UPLOAD_ERROR",
1658
- data: c,
1659
- title: a("Upload failed"),
1660
- description: Q
1661
- });
1662
- }, [a, d]), $t = (0, n.useCallback)(async (c) => P.pickUploadImageUrlFromFireResults(await ut.fire({
1663
- file: c,
1664
- project: ct
1665
- })), [ct, ut]), be = ne.useImageBlobFetch(), en = (0, n.useCallback)((c) => Ie.current.resolve(ne.canonicalImageUrlKey(c), void 0, be), [be]), Pe = async (c) => {
1666
- if (c) try {
1667
- const f = await tn(c);
1668
- f && Ye(f) ? await Oe({ file: f }) : f || Me({ url: c }, null, a("Failed to download image from URL."));
1669
- } catch (f) {
1670
- Me({ url: c }, f, a("Failed to process image URL."));
1671
- }
1672
- }, mt = n.default.useRef(Pe);
1673
- mt.current = Pe, n.default.useEffect(() => {
1674
- if (H !== de || !O) return;
1675
- const c = y.trim();
1676
- if (!c || !c.toLowerCase().startsWith("http")) return;
1677
- const f = setTimeout(() => {
1678
- mt.current(c);
1679
- }, 1e3);
1680
- return () => {
1681
- clearTimeout(f);
1682
- };
1683
- }, [
1684
- y,
1685
- H,
1686
- O
1687
- ]);
1688
- const tn = async (c) => {
1689
- try {
1690
- const f = ne.canonicalImageUrlKey(c);
1691
- return qt(await Ie.current.resolve(f, void 0, be), f);
1692
- } catch {}
1693
- };
1694
- document.onpaste = function(c) {
1695
- const f = c.clipboardData?.items?.[0];
1696
- if (H === de && O) {
1697
- if (f?.type?.indexOf("image") === 0 && e.imageCenterLocalUploadEnabled !== !1) {
1698
- const Q = f.getAsFile();
1699
- Ye(Q);
1700
- const oe = { file: Q };
1701
- L(""), Oe(oe);
1702
- return;
1703
- }
1704
- const k = c.clipboardData?.getData("text/plain");
1705
- if (k && k.trim().toLowerCase().startsWith("http")) {
1706
- c.preventDefault(), c.stopPropagation(), L(k.trim());
1707
- return;
1708
- }
1709
- f?.type?.indexOf("text") === 0 && f.getAsString((Q) => {
1710
- if (Q.trim().toLowerCase().startsWith("http")) L(Q.trim());
1711
- else if (Q.toString().slice(1, 5) === "meta") {
1712
- const oe = Q.toString().split("\"")[1];
1713
- oe && L(oe);
1714
- }
1715
- });
1716
- }
1717
- }, (0, n.useEffect)(() => {
1718
- const c = (f) => {
1719
- let k = null;
1720
- I?.kind === "background" ? (k = at, D(at)) : I?.kind === "img" && (D(st), k = st), I?.currentUrl && k && (R(I.currentUrl), B(f));
1721
- };
1722
- v === u.MODALS.UPLOAD_IMAGE_MODAL || v === u.MODALS.UPLOAD_BACKGROUND_MODAL ? c(we) : v === u.MODALS.UPLOAD_IMAGE_MODAL_AI || v === u.MODALS.UPLOAD_BACKGROUND_MODAL_AI ? (ye ? (je(!0), Be(2)) : c(Ke), setTimeout(() => W.current?.focus({ cursor: "start" }), 100)) : v === u.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD || v === u.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD ? (c(de), setTimeout(() => K.current?.focus({ cursor: "start" }), 100)) : v === u.MODALS.UPLOAD_IMAGE_MODAL_STOCK || v === u.MODALS.UPLOAD_BACKGROUND_MODAL_STOCK ? (ye ? (je(!0), Be(3)) : c(Ge), setTimeout(() => h.current?.focus({ cursor: "start" }), 100)) : v === u.MODALS.UPLOAD_IMAGE_MODAL_GIF || v === u.MODALS.UPLOAD_BACKGROUND_MODAL_GIF ? (ye ? (je(!0), Be(3)) : c(ze), setTimeout(() => s.current?.focus({ cursor: "start" }), 100)) : v === u.MODALS.UPLOAD_IMAGE_MODAL_EDIT || v === u.MODALS.UPLOAD_BACKGROUND_MODAL_EDIT ? (ye ? (je(!0), Be(5)) : c(we), i(Z.openSecondModal(u.MODALS.IMAGE_EDITOR_MODAL))) : D("");
1723
- }, [
1724
- v,
1725
- i,
1726
- ye,
1727
- I
1728
- ]);
1729
- const Qe = (0, n.useCallback)(({ url: c = C || "", meta: f = zt }) => {
1730
- R(c), w({
1731
- url: c,
1732
- meta: f
1733
- }), setTimeout(() => {
1734
- le(), pe(), me({
1735
- keywords: "",
1736
- color: "",
1737
- orientation: ""
1738
- }), _({ keywords: "" }), g([]), M([]), D(""), We(""), it(!1), F(""), L(""), B(de);
1739
- }, 200), i(Z.closeModal()), i(Z.closeSecondModal());
1740
- }, [
1741
- C,
1742
- le,
1743
- i,
1744
- w,
1745
- pe
1746
- ]), pt = (0, n.useCallback)((c, f) => (N("auto"), T(!1), Qe({
1747
- url: c,
1748
- meta: Kt
1749
- }), d.success({
1750
- id: "IMAGE_UPLOAD_SUCCESS",
1751
- data: f,
1752
- title: a("The image was successfully uploaded.")
1753
- }), c), [
1754
- a,
1755
- Qe,
1756
- d
1757
- ]);
1758
- (0, n.useEffect)(() => {
1759
- const c = y || A, f = ne.canonicalImageUrlKey(c);
1760
- if (!c || !f) {
1761
- q(""), Ve.current = "", le(), pe(), Ie.current.invalidateAll();
1762
- return;
1763
- }
1764
- const k = Ve.current;
1765
- k && k !== f && (Ie.current.abandonKey(k), le(), pe()), Ve.current = f;
1766
- const Q = new AbortController(), oe = y ? 800 : 0, se = ++Ce.current, _e = setTimeout(async () => {
1767
- try {
1768
- const Se = async () => {
1769
- const ue = await Ie.current.resolve(f, Q.signal, be);
1770
- if (se !== Ce.current) return;
1771
- const { width: ve, height: an } = await ne.getImageDimensionsFromBlob(ue);
1772
- se === Ce.current && (V({
1773
- width: ve,
1774
- height: an,
1775
- size: (ue.size / 1024).toFixed(2),
1776
- format: Ee(ue.type)
1777
- }), le(), Ue(ue));
1778
- };
1779
- if (o) await Se();
1780
- else {
1781
- const ue = await ne.resolveDataProviderPreview(t, f);
1782
- if (ue?.previewUrl && se === Ce.current) {
1783
- qe(ue.previewUrl), pe();
1784
- try {
1785
- const { data: ve } = await b(f);
1786
- if (se !== Ce.current) return;
1787
- ve ? V({
1788
- width: ve?.width,
1789
- height: ve?.height,
1790
- size: ve?.fileSize != null ? (ve.fileSize / 1024).toFixed(2) : "",
1791
- format: Ee(ve?.format)
1792
- }) : await Se();
1793
- } catch {
1794
- await Se();
1795
- }
1796
- } else await Se();
1797
- }
1798
- if (se !== Ce.current) return;
1799
- q("success"), R(c), $(572), setTimeout(() => {
1800
- let ue = 0;
1801
- x.current && (ue = x.current.offsetHeight + 62), N(ue);
1802
- }, 0);
1803
- } catch (Se) {
1804
- if (Se?.name === "AbortError" || Q.signal.aborted || se !== Ce.current) return;
1805
- le(), pe(), q("error");
1806
- }
1807
- }, oe);
1808
- return () => {
1809
- clearTimeout(_e), Q.abort();
1810
- };
1811
- }, [
1812
- y,
1813
- A,
1814
- o,
1815
- le,
1816
- be,
1817
- b,
1818
- pe,
1819
- t,
1820
- Ue
1821
- ]), (0, n.useEffect)(() => {
1822
- if (!C || y || A) return;
1823
- const c = ne.canonicalImageUrlKey(C), f = new AbortController();
1824
- let k = !1;
1825
- const Q = async () => {
1826
- const oe = await Ie.current.resolve(c, f.signal, be);
1827
- if (k) return;
1828
- const { width: se, height: _e } = await ne.getImageDimensionsFromBlob(oe);
1829
- k || (le(), Ue(oe), V({
1830
- width: se,
1831
- height: _e,
1832
- size: (oe.size / 1024).toFixed(2),
1833
- format: Ee(oe.type)
1834
- }));
1835
- };
1836
- return (async () => {
1837
- try {
1838
- if (!o) {
1839
- const oe = await ne.resolveDataProviderPreview(t, c);
1840
- if (oe?.previewUrl && !k) {
1841
- qe(oe.previewUrl), pe();
1842
- try {
1843
- const { data: se } = await b(c);
1844
- if (k) return;
1845
- se ? V({
1846
- width: se?.width,
1847
- height: se?.height,
1848
- size: se?.fileSize != null ? (se.fileSize / 1024).toFixed(2) : "",
1849
- format: Ee(se?.format)
1850
- }) : await Q();
1851
- return;
1852
- } catch {
1853
- await Q();
1854
- }
1855
- }
1856
- }
1857
- await Q();
1858
- } catch {
1859
- k || le();
1860
- }
1861
- })(), () => {
1862
- k = !0, f.abort();
1863
- };
1864
- }, [
1865
- o,
1866
- le,
1867
- C,
1868
- be,
1869
- b,
1870
- t,
1871
- y,
1872
- A,
1873
- Ue
1874
- ]);
1875
- const nn = () => {
1876
- i(Z.closeModal()), setTimeout(() => {
1877
- le(), pe(), R(""), L(""), g([]), g([]), me({
1878
- keywords: "",
1879
- color: "",
1880
- orientation: ""
1881
- }), _({ keywords: "" }), N("auto"), !ce && We(""), $(572), B(de);
1882
- }, 200);
1883
- }, rn = (c) => {
1884
- c === Gt ? p.success({
1885
- mask: { closable: !0 },
1886
- centered: !0,
1887
- title: a("Coming soon"),
1888
- content: a("The feature is under development."),
1889
- okText: a("Ok. I'll be waiting"),
1890
- onOk: () => {}
1891
- }) : c === we && C === "" ? p.warning({
1892
- mask: { closable: !0 },
1893
- centered: !0,
1894
- title: a(""),
1895
- content: a("To preview and edit the uploaded image"),
1896
- okText: a("Upload Image"),
1897
- onOk: () => {
1898
- B(de);
1899
- }
1900
- }) : (setTimeout(() => {
1901
- let f = 0, k = 0;
1902
- c === de && E.current ? (ie.keywords === "" && K.current?.focus({ cursor: "start" }), f = 300, k = 572) : c === we && x.current ? (f = x.current.offsetHeight + 62, k = 572) : c === Ge && S.current ? (ie.keywords === "" && h.current?.focus({ cursor: "start" }), f = 130, k = 572, ae.length > 0 && (k = 1060, f = "84vh")) : c === ze && U.current ? (ie.keywords === "" && s.current?.focus({ cursor: "start" }), f = 130, k = 572, re.length > 0 && (k = 1060, f = "84vh")) : c === Ke && Y.current && (lt === "" && te.length === 0 ? (W.current?.focus({ cursor: "start" }), f = 130) : f = Y.current.offsetHeight + 82, k = 572), N(f), $(k);
1903
- }, 0), B(c));
1904
- };
1905
- (0, n.useEffect)(() => {
1906
- ie.keywords === "" && (K?.current?.focus({ cursor: "start" }), g([]), setTimeout(() => {
1907
- N("auto"), $(572);
1908
- }, 0));
1909
- }, [
1910
- ie,
1911
- g,
1912
- N,
1913
- $
1914
- ]);
1915
- const Ye = (c) => {
1916
- const f = c.type === "image/jpeg" || c.type === "image/png" || c.type === "image/jpg" || c.type === "image/webp" || c.type === "image/gif" || c.type === "image/svg+xml";
1917
- return f || d.error({
1918
- id: "IMAGE_UPLOAD_WRONG_FORMAT",
1919
- data: c,
1920
- title: "Upload",
1921
- description: "You can only upload JPG/JPEG/PNG/WEBP/GIF/SVG file!"
1922
- }), f;
1923
- }, Oe = async ({ file: c }) => {
1924
- try {
1925
- he(!0);
1926
- const f = await ne.prepareImageForEditorUpload(c, e), k = await $t(f);
1927
- if (k) return pt(k, f), k;
1928
- const Q = await Ft(f, t);
1929
- if (Q?.url) return pt(Q.url, f), Q.url;
1930
- Me(f, null);
1931
- return;
1932
- } catch (f) {
1933
- Me(c, f);
1934
- return;
1935
- } finally {
1936
- he(!1);
1937
- }
1938
- }, sn = (c) => Oe({ file: c });
1939
- let Le = [{
1940
- label: a("Upload"),
1941
- key: de,
1942
- children: (0, r.jsxs)("div", {
1943
- ref: E,
1944
- style: { paddingBottom: 24 },
1945
- children: [e.imageCenterLocalUploadEnabled !== !1 && (0, r.jsxs)(Wt, {
1946
- showUploadList: !1,
1947
- name: "Image",
1948
- beforeUpload: Ye,
1949
- customRequest: Oe,
1950
- style: { marginBottom: 10 },
1951
- multiple: !1,
1952
- accept: "image/png, image/jpeg, image/jpg, image/webp, image/gif, image/svg+xml",
1953
- children: [
1954
- (0, r.jsx)("p", {
1955
- className: "ant-upload-drag-icon",
1956
- children: (0, r.jsx)(P.EmIcons, { icon: "InboxOutlined" })
1957
- }),
1958
- (0, r.jsx)("p", {
1959
- className: "ant-upload-text",
1960
- children: a("Click to select, paste from the clipboard, or drag and drop")
1961
- }),
1962
- (0, r.jsx)("p", {
1963
- className: "ant-upload-hint",
1964
- children: a("Accepted formats: PNG, JPG, WEBP, SVG or GIF.")
1965
- })
1966
- ]
1967
- }), (0, r.jsx)(m.Form, {
1968
- style: { padding: "0 2px 0 2px" },
1969
- children: (0, r.jsx)(m.Form.Item, {
1970
- validateStatus: ee,
1971
- children: (0, r.jsx)(m.Input, {
1972
- ref: K,
1973
- allowClear: !0,
1974
- size: "large",
1975
- placeholder: a("Paste image URL here"),
1976
- value: y,
1977
- onChange: Jt,
1978
- spellCheck: "false"
1979
- })
1980
- })
1981
- })]
1982
- })
1983
- }];
1984
- return e.imageCenterStockEnabled && !ye && Le.push({
1985
- label: a("Stock"),
1986
- key: Ge,
1987
- children: (0, r.jsx)("div", {
1988
- ref: S,
1989
- style: { paddingBottom: 24 },
1990
- children: (0, r.jsx)(jt, {
1991
- currentReq: ie,
1992
- setCurrentReq: me,
1993
- imageStockList: ae,
1994
- setImageStockList: g,
1995
- setModalWidth: $,
1996
- setModalHeight: N,
1997
- setStockLink: F,
1998
- setCurrentImageLink: R,
1999
- inputRef: h,
2000
- customRequest: Pe
2001
- })
2002
- })
2003
- }), e.imageCenterGifEnabled && !ye && Le.push({
2004
- label: a("GIF"),
2005
- key: ze,
2006
- children: (0, r.jsx)("div", {
2007
- ref: U,
2008
- style: { paddingBottom: 24 },
2009
- children: (0, r.jsx)(Ut, {
2010
- currentReqGif: Ae,
2011
- setCurrentReqGif: _,
2012
- imageGifList: re,
2013
- setImageGifList: M,
2014
- setModalWidth: $,
2015
- setModalHeight: N,
2016
- setStockLink: F,
2017
- setCurrentImageLink: R,
2018
- inputRef: s,
2019
- customRequest: Pe
2020
- })
2021
- })
2022
- }), e.elementAIimageEnabled && !ye && Le.push({
2023
- label: a("AI"),
2024
- key: Ke,
2025
- children: (0, r.jsx)("div", {
2026
- ref: Y,
2027
- style: { paddingBottom: 24 },
2028
- children: (0, r.jsx)(Bt, {
2029
- setModalHeight: N,
2030
- customRequest: Oe,
2031
- aiImageRequest: lt,
2032
- setAiImageRequest: We,
2033
- imageAiList: te,
2034
- setImageAiList: X,
2035
- isLoadingAi: ce,
2036
- setIsLoadingAi: it,
2037
- aiTabRef: Y,
2038
- inputAiRef: W,
2039
- isImageUploaded: j,
2040
- setIsImageUploaded: T
2041
- })
2042
- })
2043
- }), e.imageCenterEditorEnabled && Le.push({
2044
- label: "",
2045
- key: we,
2046
- children: (0, r.jsx)("div", {
2047
- ref: x,
2048
- children: (0, r.jsx)(At, {
2049
- currentImageLink: C,
2050
- newLink: y,
2051
- previewDisplayUrl: Xt,
2052
- resolvedPreviewObjectUrl: _t,
2053
- resolvedPreviewBlob: Zt,
2054
- resolveImageBlob: en,
2055
- imageSize: z,
2056
- onSave: sn,
2057
- uploadImageResultIsLoading: G || !1
2058
- })
2059
- })
2060
- }), (0, r.jsxs)(r.Fragment, { children: [(0, r.jsx)(m.Modal, {
2061
- width: J,
2062
- className: "image-center",
2063
- title: a("Image Center"),
2064
- style: { minHeight: 390 },
2065
- open: !!O,
2066
- onOk: Qe,
2067
- onCancel: nn,
2068
- footer: H === we ? (0, r.jsx)(r.Fragment, {}) : null,
2069
- children: (0, r.jsx)(m.Spin, {
2070
- spinning: G,
2071
- children: (0, r.jsx)(m.Tabs, {
2072
- activeKey: H,
2073
- onChange: rn,
2074
- items: Le,
2075
- className: "modal-tabs",
2076
- style: {
2077
- height: fe,
2078
- minHeight: 130
2079
- }
2080
- })
2081
- })
2082
- }), (0, r.jsx)(P.PlanUpgradePrompt, {
2083
- open: Qt,
2084
- onCancel: () => je(!1),
2085
- initialSlide: Yt
2086
- })] });
2087
- };
2088
- ot.propTypes = { dataProvider: ht.default.object }, gt.default = ot;
2089
- });