@emailmaker/emailmaker 1.0.90 → 1.0.92

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 (69) hide show
  1. package/README.md +33 -2
  2. package/asset-manifest.json +31 -26
  3. package/emailmaker-esm.js +1 -1
  4. package/emailmaker.js +1 -1
  5. package/iframe/429.js +1 -1
  6. package/iframe/766.js +1 -1
  7. package/iframe/iframe-eblock.bd2a2a73469f802abf17.html +1 -0
  8. package/iframe/iframe.bd2a2a73469f802abf17.html +1 -0
  9. package/iframe/js/826.c1a995fb.js +1 -0
  10. package/iframe/sandbox-eblock.js +1 -1
  11. package/iframe/sandbox.js +1 -1
  12. package/package.json +1 -1
  13. package/plugin.html +1 -1
  14. package/plugin_blocks_test.html +1 -1
  15. package/plugin_default.html +1 -1
  16. package/plugin_idigital.html +1 -1
  17. package/plugin_nota.html +1 -1
  18. package/plugin_s.html +1 -1
  19. package/static/css/2458.05166c0a.chunk.css +1 -0
  20. package/static/css/6501.e131603e.chunk.css +1 -0
  21. package/static/css/9272.a4e58dd0.chunk.css +1 -0
  22. package/static/js/1390.87d39fe1.js +2 -0
  23. package/static/js/{1538.c37b25fc.chunk.js → 1538.06811304.chunk.js} +2 -2
  24. package/static/js/241.9aaa5790.js +2 -0
  25. package/static/js/{6498.bfe18798.js.LICENSE.txt → 241.9aaa5790.js.LICENSE.txt} +1 -1
  26. package/static/js/2458.504bef1c.chunk.js +2 -0
  27. package/static/js/3017.2e1f6413.chunk.js +1 -0
  28. package/static/js/3085.b9d27236.chunk.js +2 -0
  29. package/static/js/4560.b03bbb3f.chunk.js +2 -0
  30. package/static/js/4560.b03bbb3f.chunk.js.LICENSE.txt +101 -0
  31. package/static/js/6501.616f4dec.chunk.js +1 -0
  32. package/static/js/7091.d1a56e4b.js +1 -0
  33. package/static/js/7729.13361a78.js +1 -0
  34. package/static/js/8285.c8bdf11b.js +2 -0
  35. package/static/js/{1302.39ea1b43.js.LICENSE.txt → 8285.c8bdf11b.js.LICENSE.txt} +1 -14
  36. package/static/js/8408.459779d0.js +2 -0
  37. package/static/js/8408.459779d0.js.LICENSE.txt +9 -0
  38. package/static/js/898.2dcef4f3.js +2 -0
  39. package/static/js/9272.d5a35d82.chunk.js +1 -0
  40. package/static/js/9960.6dcf66f0.chunk.js +2 -0
  41. package/static/js/9960.6dcf66f0.chunk.js.LICENSE.txt +30 -0
  42. package/static/js/emailmaker_core.1c694217.js +2 -0
  43. package/static/media/project-email-back.0ce470def19ce7c063e0.svg +29 -0
  44. package/translations.pot +109 -69
  45. package/emailmaker.d.ts +0 -1290
  46. package/iframe/iframe-eblock.2da62676cd51ab369172.html +0 -1
  47. package/iframe/iframe.2da62676cd51ab369172.html +0 -1
  48. package/iframe/js/826.203f82ea.js +0 -1
  49. package/static/css/3397.fc69a1a6.chunk.css +0 -1
  50. package/static/js/1302.39ea1b43.js +0 -2
  51. package/static/js/3017.1bbeda89.chunk.js +0 -1
  52. package/static/js/3085.59662838.chunk.js +0 -2
  53. package/static/js/3273.6cedb8e0.js +0 -2
  54. package/static/js/3397.c4e8daad.chunk.js +0 -2
  55. package/static/js/3758.c4bda075.js +0 -2
  56. package/static/js/3927.53e3058b.js +0 -1
  57. package/static/js/4138.7f4f36d7.js +0 -1
  58. package/static/js/6498.bfe18798.js +0 -2
  59. package/static/js/985.35d145ce.js +0 -1
  60. package/static/js/9880.74dc5e4f.chunk.js +0 -2
  61. package/static/js/9880.74dc5e4f.chunk.js.LICENSE.txt +0 -9
  62. package/static/js/emailmaker_core.b4c43c8c.js +0 -2
  63. /package/iframe/js/{826.203f82ea.js.LICENSE.txt → 826.c1a995fb.js.LICENSE.txt} +0 -0
  64. /package/static/js/{3273.6cedb8e0.js.LICENSE.txt → 1390.87d39fe1.js.LICENSE.txt} +0 -0
  65. /package/static/js/{1538.c37b25fc.chunk.js.LICENSE.txt → 1538.06811304.chunk.js.LICENSE.txt} +0 -0
  66. /package/static/js/{3397.c4e8daad.chunk.js.LICENSE.txt → 2458.504bef1c.chunk.js.LICENSE.txt} +0 -0
  67. /package/static/js/{3085.59662838.chunk.js.LICENSE.txt → 3085.b9d27236.chunk.js.LICENSE.txt} +0 -0
  68. /package/static/js/{3758.c4bda075.js.LICENSE.txt → 898.2dcef4f3.js.LICENSE.txt} +0 -0
  69. /package/static/js/{emailmaker_core.b4c43c8c.js.LICENSE.txt → emailmaker_core.1c694217.js.LICENSE.txt} +0 -0
@@ -0,0 +1,101 @@
1
+ /*! *****************************************************************************
2
+ Copyright (c) Microsoft Corporation. All rights reserved.
3
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4
+ this file except in compliance with the License. You may obtain a copy of the
5
+ License at http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10
+ MERCHANTABLITY OR NON-INFRINGEMENT.
11
+
12
+ See the Apache Version 2.0 License for specific language governing permissions
13
+ and limitations under the License.
14
+ ***************************************************************************** */
15
+
16
+ /*! Fabric.js Copyright 2008-2015, Printio (Juriy Zaytsev, Maxim Chernyak) */
17
+
18
+ /**
19
+ * @license
20
+ * Lodash <https://lodash.com/>
21
+ * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
22
+ * Released under MIT license <https://lodash.com/license>
23
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
24
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
25
+ */
26
+
27
+ /**
28
+ * @license React
29
+ * react-jsx-runtime.production.min.js
30
+ *
31
+ * Copyright (c) Facebook, Inc. and its affiliates.
32
+ *
33
+ * This source code is licensed under the MIT license found in the
34
+ * LICENSE file in the root directory of this source tree.
35
+ */
36
+
37
+ /**
38
+ * @license React
39
+ * use-sync-external-store-shim.production.min.js
40
+ *
41
+ * Copyright (c) Facebook, Inc. and its affiliates.
42
+ *
43
+ * This source code is licensed under the MIT license found in the
44
+ * LICENSE file in the root directory of this source tree.
45
+ */
46
+
47
+ /**
48
+ * @license React
49
+ * use-sync-external-store-shim/with-selector.production.min.js
50
+ *
51
+ * Copyright (c) Facebook, Inc. and its affiliates.
52
+ *
53
+ * This source code is licensed under the MIT license found in the
54
+ * LICENSE file in the root directory of this source tree.
55
+ */
56
+
57
+ /**
58
+ * @remix-run/router v1.0.1
59
+ *
60
+ * Copyright (c) Remix Software Inc.
61
+ *
62
+ * This source code is licensed under the MIT license found in the
63
+ * LICENSE.md file in the root directory of this source tree.
64
+ *
65
+ * @license MIT
66
+ */
67
+
68
+ /**
69
+ * React Router DOM v6.4.1
70
+ *
71
+ * Copyright (c) Remix Software Inc.
72
+ *
73
+ * This source code is licensed under the MIT license found in the
74
+ * LICENSE.md file in the root directory of this source tree.
75
+ *
76
+ * @license MIT
77
+ */
78
+
79
+ /**
80
+ * react-virtual
81
+ *
82
+ * Copyright (c) TanStack
83
+ *
84
+ * This source code is licensed under the MIT license found in the
85
+ * LICENSE.md file in the root directory of this source tree.
86
+ *
87
+ * @license MIT
88
+ */
89
+
90
+ /**
91
+ * virtual-core
92
+ *
93
+ * Copyright (c) TanStack
94
+ *
95
+ * This source code is licensed under the MIT license found in the
96
+ * LICENSE.md file in the root directory of this source tree.
97
+ *
98
+ * @license MIT
99
+ */
100
+
101
+ /**![picture](data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAiIGhlaWdodD0iNTAiIGZpbGw9IiNjYWNhY2EiIHZpZXdCb3g9IjY0IDY0IDg5NiA4OTYiIGZvY3VzYWJsZT0iZmFsc2UiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTkyOCAxNjBIOTZjLTE3LjcgMC0zMiAxNC4zLTMyIDMydjY0MGMwIDE3LjcgMTQuMyAzMiAzMiAzMmg4MzJjMTcuNyAwIDMyLTE0LjMgMzItMzJWMTkyYzAtMTcuNy0xNC4zLTMyLTMyLTMyem0tNDAgNjMySDEzNnYtMzkuOWwxMzguNS0xNjQuMyAxNTAuMSAxNzhMNjU4LjEgNDg5IDg4OCA3NjEuNlY3OTJ6bTAtMTI5LjhMNjY0LjIgMzk2LjhjLTMuMi0zLjgtOS0zLjgtMTIuMiAwTDQyNC42IDY2Ni40bC0xNDQtMTcwLjdjLTMuMi0zLjgtOS0zLjgtMTIuMiAwTDEzNiA2NTIuN1YyMzJoNzUydjQzMC4yek0zMDQgNDU2YTg4IDg4IDAgMTAwLTE3NiA4OCA4OCAwIDAwMCAxNzZ6bTAtMTE2YzE1LjUgMCAyOCAxMi41IDI4IDI4cy0xMi41IDI4LTI4IDI4LTI4LTEyLjUtMjgtMjggMTIuNS0yOCAyOC0yOHoiIC8+PC9zdmc+) */
@@ -0,0 +1 @@
1
+ "use strict";(globalThis.webpackChunkemail_maker=globalThis.webpackChunkemail_maker||[]).push([[6501],{36501:(e,t,a)=>{a.r(t),a.d(t,{default:()=>ye});var l=a(98173),i=a(2604),n=a(55415),r=a(75576),s=a(27499),o=a(8218),c=a(48753),m=a(98447),u=a(93511),d=a(64909),g=a(5889),p=a(38826),h=a(12543),f=a(62272),A=a(8122),E=a(40835),v=a(871),y=a(47014),k=a(23424),w=a(80772),I=a(84572),b=a(32947);function L(e,t){return{[e]:{Filter:t("Filter"),filter:t("filter"),Resize:t("Resize"),resize:t("resize"),Crop:t("Crop"),Width:t("Width"),width:t("width"),Height:t("Height"),height:t("height"),"Background color":t("Background color"),Cancel:t("Cancel"),Create:t("Create"),Objects:t("Objects"),Quality:t("Quality"),Save:t("Save"),"Loading Canvas":t("Loading Canvas"),"Loading Image":t("Loading Image"),"Loading State":t("Loading State"),"Processing Image":t("Processing Image"),Close:t("Close"),Apply:t("Apply"),Font:t("Font"),Color:t("Color"),Background:t("Background"),Image:t("Image"),Opacity:t("Opacity"),Outline:t("Outline"),Shadow:t("Shadow"),Gradient:t("Gradient"),Texture:t("Texture"),"Replace Image":t("Replace Image"),"Outline Color":t("Outline Color"),"Shadow Color":t("Shadow Color"),"Font Size":t("Font Size"),Radius:t("Radius"),"Brush Color":t("Brush Color"),"Brush Type":t("Brush Type"),"Brush Size":t("Brush Size"),History:t("History"),"Maintain aspect ratio":t("Maintain aspect ratio"),"New Text":t("New Text"),Size:t("Size"),Draw:t("Draw"),Text:t("Text"),Stickers:t("Stickers"),Frame:t("Frame"),Shapes:t("Shapes"),Corners:t("Corners"),corners:t("corners"),Done:t("Done"),"Applied Filters":t("Applied Filters"),"Resized Image":t("Resized Image"),"Cropped Image":t("Cropped Image"),"Added Drawing":t("Added Drawing"),"Added Text":t("Added Text"),"Added Shape":t("Added Shape"),"Added Sticker":t("Added Sticker"),"Added Frame":t("Added Frame"),"Merged Objects":t("Merged Objects"),"Rounded Corner":t("Rounded Corner"),"Replaced Background Image":t("Replaced Background Image"),"Added Image":t("Added Image"),Initial:t("Initial"),"Loaded State":t("Loaded State"),"Changed Style":t("Changed Style"),"Deleted object":t("Deleted object"),Merge:t("Merge"),Emoticons:t("Emoticons"),Doodles:t("Doodles"),Landmarks:t("Landmarks"),Bubbles:t("Bubbles"),Transportation:t("Transportation"),Beach:t("Beach"),PencilBrush:t("PencilBrush"),SprayBrush:t("SprayBrush"),CircleBrush:t("CircleBrush"),DiamondBrush:t("DiamondBrush"),VLineBrush:t("VLineBrush"),HLineBrush:t("HLineBrush"),SquareBrush:t("SquareBrush"),Square:t("Square"),square:t("square")}}}var R=a(85466),C=a(37969),S=a(76293),_=a(80320),B=a(96734),N=a(90614),O=a(3792),M=a(15626),D=a(12352);const x={text:{replaceDefault:!0,defaultCategory:"handwriting",items:[{family:"Montserrat Light",src:"customFonts/Montserrat-Light.woff2"},{family:"Montserrat Regular",src:"customFonts/Montserrat-Regular.woff2"},{family:"Montserrat Bold",src:"customFonts/Montserrat-Bold.woff2"},{family:"Montserrat Black",src:"customFonts/Montserrat-Black.woff2"},{family:"Roboto Light",src:"customFonts/Roboto-Light.woff2"},{family:"Roboto Regular",src:"customFonts/Roboto-Regular.woff2"},{family:"Roboto Bold",src:"customFonts/Roboto-Bold.woff2"},{family:"Roboto Black",src:"customFonts/Roboto-Black.woff2"},{family:"Lato Light",src:"customFonts/Lato-Light.woff2"},{family:"Lato Regular",src:"customFonts/Lato-Regular.woff2"},{family:"Lato Bold",src:"customFonts/Lato-Bold.woff2"},{family:"Lato Black",src:"customFonts/Lato-Black.woff2"},{family:"Rubik Light",src:"customFonts/Rubik-Light.woff2"},{family:"Rubik Regular",src:"customFonts/Rubik-Regular.woff2"},{family:"Rubik Bold",src:"customFonts/Rubik-Bold.woff2"},{family:"Rubik Black",src:"customFonts/Rubik-Black.woff2"},{family:"Bebas Neue Light",src:"customFonts/BebasNeueLight.woff2"},{family:"Bebas Neue Regular",src:"customFonts/BebasNeueRegular.woff2"},{family:"Bebas Neue Book",src:"customFonts/BebasNeueBook.woff2"},{family:"Bebas Neue Bold",src:"customFonts/BebasNeueBold.woff2"},{family:"Arial",src:"customFonts/ArialMT.woff2"},{family:"Arial Bold",src:"customFonts/Arial-BoldMT.woff2"}]}};function G(e,t){if("json"===e)return new Blob([t],{type:"application/json"});if("svg"===e)return new Blob([t],{type:"image/svg+xml"});const a=`image/${e}`;return((e,t="application/octet-stream")=>fetch(`data:${t};base64,${e}`).then((e=>e.blob())))(t=t.replace(/data:image\/([a-z]*)?;base64,/,""),a)}const U=l.createElement(p.A,{style:{fontSize:48},spin:!0}),T=({currentImageLink:e,newLink:t,onSave:a,uploadImageResultIsLoading:n})=>{const r=(0,B.p)(),[s,o]=(0,l.useState)(),[u,d]=(0,l.useState)(),{__:g}=(0,h.s9)();let p=(0,i.wA)();const f=(0,i.Pj)(),A=(0,i.d4)(y.C1),E=(0,i.d4)(k.sK),v=(0,i.d4)(I.yN),T=(0,l.useRef)(!1),[F,P]=(0,l.useState)(),q=(0,N.ml)(M.AZ.FILE_PROXY_EVENT_ID);(0,l.useEffect)((()=>{(async()=>{let t;try{const a=await fetch(e);t=await a.blob()}catch{if(t=await q.fire({url:e,project:v}).filter((e=>e instanceof Blob))[0],!t){const a=r.get(b.A9.em_token)||await O.di.getInstance(f,D.Y),l=await fetch(`https://app.emailmaker.ru/api/wp-json/cors-proxy/v1/get?url=${encodeURIComponent(e)}`,{headers:{authorization:`Bearer ${a}`}});t=await l.blob()}}if(t){let e=new FileReader;e.onload=()=>{null===F||void 0===F||F.tools.import.openBackgroundImage(s),e.result!==s&&(o(e.result),d(t.type))},e.readAsDataURL(t)}})().catch((e=>{}))}),[e,t,o,r,s,F,q,v,f]);const z=(0,l.useCallback)((()=>{o(null),d(null),p((0,w.BK)()),p((0,k.Os)()),p((0,k.Oo)(b.lx.UPLOAD_IMAGE_MODAL))}),[p]),j=(0,l.useRef)();j.current=async function(e,t,l){const i=await G(l,e);a&&a(new File([i],t,{lastModified:(new Date).getTime(),type:i.type}))};const H=(0,l.useCallback)((e=>{if(e)if(T.current&&F);else{T.current=!0;const e=A.locale?A.locale.replace("_","-"):"ru-RU",t=A.theme===b.IJ?matchMedia(b.F3).matches?b.nd:b.T:A.theme;R.A.init({selector:"#pixie-editor",baseUrl:"https://emailmaker.ru/assets/pixie",image:s,activeLanguage:e,languages:L(e,g),tools:x,ui:{menubar:{replaceDefaultItems:!0,items:[{type:"undoWidget",align:"left"},{type:"zoomWidget",align:"center",desktopOnly:!0},{type:"button",icon:l.createElement(S.A,{style:{fontSize:20}}),align:"right",desktopOnly:!0,action:e=>{e.togglePanel("history")}},{type:"button",icon:l.createElement(_.A,{style:{fontSize:20}}),align:"right",desktopOnly:!0,action:()=>z()}]},nav:{position:"top"},activeTheme:t,mode:"inline",forceOverlayModeOnMobile:!1},onSave:async function(e,t,a){j.current(e,t,a)}}).then((e=>{P(e)})).catch((e=>{}))}}),[A.theme,s,F,P,A.locale,g,z]),W=(0,l.useCallback)((()=>{null===F||void 0===F||F.tools.export.save(null===e||void 0===e?void 0:e.split("/").pop().split(".")[0],null===u||void 0===u?void 0:u.split("/")[1])}),[F,e,u]);return l.createElement(c.A,{afterOpenChange:H,width:"100%",style:{maxWidth:"100%",minHeight:"100vh"},className:"image-editor-modal blocks-modal",centered:!0,closable:!1,zIndex:1100,mask:!1,open:E,footer:[l.createElement(C.Ay,{key:"Cancel",className:"em-analytics__profile-cancel",onClick:z},g("Cancel")),l.createElement(C.Ay,{key:"Ok",className:"em-analytics__profile-updapixiete",id:"save",type:"primary",onClick:W},g("Update"))]},n&&l.createElement("div",{style:{position:"absolute",height:"100%",width:"100%",display:"flex",alignItems:"center",justifyContent:"center",background:"var(--colorBgLayout)",zIndex:10,opacity:.7}},l.createElement(m.A,{size:"large",indicator:U})),l.createElement("div",{id:"pixie-editor"}))},F=l.createElement(p.A,{style:{fontSize:48},spin:!0}),P=({currentImageLink:e,newLink:t,onSave:a,uploadImageResultIsLoading:i})=>l.createElement(l.Fragment,null,l.createElement("div",null,l.createElement("div",{className:"image-preview"},i&&l.createElement("div",{style:{position:"absolute",height:"100%",width:"100%",display:"flex",alignItems:"center",justifyContent:"center",background:"var(--colorBgLayout)",zIndex:10,opacity:.7}},l.createElement(m.A,{size:"large",indicator:F})),(t||e)&&l.createElement("img",{alt:"uploadedImage",src:t||e}))),l.createElement(T,{currentImageLink:e,newLink:t,onSave:a,uploadImageResultIsLoading:i}));var q=a(201),z=a(66964),j=a(50483),H=a(13785),W=a(94674),K=a(20127),V=a(21867),Q=a(80293),Z=a(8807);const Y="blocks",$=({setCurrentImageLink:e,setModalHeight:t,setModalWidth:a,setImageStockList:i,imageStockList:n,currentReq:r,setCurrentReq:c,inputRef:u,setStockLink:d,customRequest:g})=>{const[f,A]=(0,l.useState)(!1),[E,y]=(0,l.useState)(2),{__:k}=(0,h.s9)(),[w]=(0,v.Jg)(),[I]=(0,v.h4)();(0,l.useEffect)((()=>{""!==r.keywords&&b()}),[r.color,r.orientation]);const b=async()=>{const e=await I({query:r,page:1});e.data.results.length>0&&(i(e.data.results),setTimeout((()=>{a(1060),t("84vh")}),0))},[L,R]=(0,l.useState)(null);return l.createElement("div",{className:"stock-tab"},l.createElement(s.A,{onValuesChange:b,className:n.length>0?"serach-results":""},l.createElement(q.A,{gutter:24},l.createElement(z.A,{span:n.length>0?"":24},l.createElement(s.A.Item,{className:"stock-search-input"},l.createElement(o.A,{onKeyDown:e=>"Space"===e.code&&b(),onPressEnter:e=>b(),allowClear:!0,size:n.length>0?"medium":"large",placeholder:k("Search image"),value:r.keywords,onChange:e=>c((t=>({...t,keywords:e.target.value}))),ref:u,spellCheck:"false",suffix:l.createElement(Q.A,{onClick:b,className:"cards-search__search-icon, input-icon",style:{fontSize:"16px",cursor:"pointer"}})}))),n.length>0&&l.createElement(l.Fragment,null,l.createElement(z.A,null,l.createElement(j.Ay.Group,{defaultValue:"",onChange:e=>c((t=>({...t,orientation:e.target.value})))},l.createElement(H.A,{title:k("All"),placement:"top"},l.createElement(j.Ay.Button,{value:""},l.createElement(Z.A,{icon:"MixedView"}))),l.createElement(H.A,{title:k("Landscape"),placement:"top"},l.createElement(j.Ay.Button,{value:"landscape"},l.createElement(Z.A,{icon:"LandscapeView"}))),l.createElement(H.A,{title:k("Portrait"),placement:"top"},l.createElement(j.Ay.Button,{value:"portrait"},l.createElement(Z.A,{icon:"PortraitView"}))),l.createElement(H.A,{title:k("Squarish"),placement:"top"},l.createElement(j.Ay.Button,{value:"squarish"},l.createElement(Z.A,{icon:"SquareView"}))))),l.createElement(z.A,null,l.createElement(j.Ay.Group,{defaultValue:"",className:"stock-color-filter",onChange:e=>c((t=>({...t,color:e.target.value})))},l.createElement(H.A,{title:k("All"),placement:"top"},l.createElement(j.Ay.Button,{className:"all-colors",value:""},"All")),l.createElement(H.A,{title:k("Black"),placement:"top"},l.createElement(j.Ay.Button,{className:"black-color",value:"black"},"B")),l.createElement(H.A,{title:k("Black and White"),placement:"top"},l.createElement(j.Ay.Button,{className:"bw-color",value:"black_and_white"},"B&\xa7W")),l.createElement(H.A,{title:k("White"),placement:"top"},l.createElement(j.Ay.Button,{className:"white-color",value:"white"},"W")),l.createElement(H.A,{title:k("Orange"),placement:"top"},l.createElement(j.Ay.Button,{className:"orange-color",value:"orange"},"O")),l.createElement(H.A,{title:k("Red"),placement:"top"},l.createElement(j.Ay.Button,{className:"red-color",value:"red"},"R")),l.createElement(H.A,{title:k("Purple"),placement:"top"},l.createElement(j.Ay.Button,{className:"purple-color",value:"purple"},"P")),l.createElement(H.A,{title:k("Magenta"),placement:"top"},l.createElement(j.Ay.Button,{className:"magenta-color",value:"magenta"},"M")),l.createElement(H.A,{title:k("Green"),placement:"top"},l.createElement(j.Ay.Button,{className:"green-color",value:"green"},"G")),l.createElement(H.A,{title:k("Teal"),placement:"top"},l.createElement(j.Ay.Button,{className:"teal-color",value:"teal"},"T")),l.createElement(H.A,{title:k("Blue"),placement:"top"},l.createElement(j.Ay.Button,{className:"blue-color",value:"blue"},"Blue")))))),n.length>0&&l.createElement("div",{className:"blocks-search__divider-wrapper"},l.createElement("div",{className:"ant-divider ant-divider-horizontal",role:"separator"}))),l.createElement("div",{className:"serach-output-wrapper",style:{marginRight:-10}},n.length>0&&l.createElement("div",{id:"scrollableDiv",style:{width:"100%",height:"calc(84vh - 148px)",overflow:"auto",paddingTop:24,paddingRight:14,paddingLeft:24,marginLeft:-24,lineHeight:"0",boxSizing:"unset"}},l.createElement(K.A,{dataLength:n&&n.length,next:async()=>{f||(A(!0),I({query:r,page:E}).then((e=>{i((t=>[...t,...e.data.results])),A(!1),y((e=>e+1))})).catch((()=>{A(!1)})))},hasMore:n,endMessage:l.createElement(W.A,{plain:!0},k("That`s all we could find.")," \ud83e\udd10"),scrollableTarget:"scrollableDiv",style:{overflow:"visible"},loader:null},l.createElement(V.A,{breakpointCols:{default:3},className:"my-masonry-grid",columnClassName:"my-masonry-grid_column"},n.map((t=>l.createElement("div",{className:"list-item",key:t.id,onClick:()=>{return a=t.urls,l=t.links,i=t.id,w(l.download_location),R(i),setTimeout((()=>R(null)),2e3),d(`${a.raw}&w=1200&q=96`),e(`${a.raw}&w=1200&q=96`),void g(`${a.raw}&w=1200&q=96`);var a,l,i}},l.createElement("img",{className:L===t.id?"loaded-image":"",width:"322px",src:`${t.urls.raw}&w=644&q=96`,alt:t.description,onLoad:e=>e.target.parentNode.classList.add("loaded")}),l.createElement("p",{className:"creator-info",onClick:e=>e.stopPropagation()},"Photo by"," ",l.createElement("a",{target:"_blank",href:`${t.user.links.html}?utm_source=${Y}&utm_medium=referral`,rel:"noreferrer"},t.user.name)," ","on"," ",l.createElement("a",{target:"_blank",href:`https://unsplash.com/?utm_source=${Y}&utm_medium=referral`,rel:"noreferrer"},"Unsplash")),L===t.id&&l.createElement(m.A,{className:"ant-spin",indicator:l.createElement(p.A,{spin:!0})})))))))))};var J=a(82021),X=a(35850),ee=a(50078),te=a(36236);const ae=({images:e,transitionDuration:t=1e3})=>{const[a,i]=(0,l.useState)([]);return(0,l.useEffect)((()=>{if(e.length>0){const t=e[e.length-1];i((e=>[...e,{src:t,opacity:0}])),setTimeout((()=>{i((e=>e.map(((t,a)=>a===e.length-1?{...t,opacity:1}:t))))}),1e3)}}),[e]),l.createElement("div",{className:"slideshow-container"},a.map(((e,a)=>l.createElement("img",{key:a,src:`data:image/jpeg;base64, ${e.src}`,alt:`Slide ${a+1}`,className:"slideshow-image",style:{opacity:e.opacity,transition:`opacity ${t}ms linear`}}))))};var le=a(30753),ie=a(27941),ne=a(89613);const re=(0,l.memo)((({className:e,onClick:t})=>l.createElement("div",{className:`image-ai__arrow image-ai__arrow--next ${e||""}`,onClick:t},l.createElement(C.Ay,{className:"image-ai__arrow-btn image-ai__arrow-btn--next",size:"large",icon:l.createElement(X.A,null)}))));re.displayName="SampleNextArrow";const se=(0,l.memo)((({className:e,onClick:t})=>l.createElement("div",{className:`image-ai__arrow image-ai__arrow--prev ${e||""}`,onClick:t},l.createElement(C.Ay,{className:"image-ai__arrow-btn image-ai__arrow-btn--prev",size:"large",icon:l.createElement(ee.A,null)}))));se.displayName="SamplePrevArrow";const oe=({setModalHeight:e,customRequest:t,aiTabRef:a,inputAiRef:i,isImageUploaded:n,setIsImageUploaded:r,aiImageRequest:c,setAiImageRequest:m,imageAiList:u,setImageAiList:g,isLoadingAi:A,setIsLoadingAi:E})=>{const{aiImageCounter:y,currentAiImgLimits:k,loadingDuringGeneration:w,requestStatus:I,handleGenerate:L,convertBase64ToFile:R,isShiftPressed:S,setIsShiftPressed:_,limitsInPlugin:B}=function({setModalHeight:e,customRequest:t,aiTabRef:a,isImageUploaded:i,setIsImageUploaded:n,aiImageRequest:r,imageAiList:s,setImageAiList:o,isLoadingAi:c,setIsLoadingAi:m}){const{__:u}=(0,h.s9)(),g=(0,ie.rD)(),p=(0,d.hN)(),A=(0,ne.u)(),{emailId:E,blockId:y,projectId:k}=(0,f.g)(),[w]=(0,v.Mv)(),[I,{data:L=[]}]=(0,v.gg)(),R=(null===g||void 0===g?void 0:g.sendAIImageRequest)||w,C=(null===g||void 0===g?void 0:g.trigger)||I,S=(null===g||void 0===g?void 0:g.handleLimitUsageEmitter)||(0,N.ml)(M.AZ.ON_LIMIT_ID),[_,B]=(0,l.useState)(0),[O,D]=(0,l.useState)(null),[x,G]=(0,l.useState)(!1),[U,T]=(0,l.useState)(u("Evaluating the task")),[F,P]=(0,l.useState)(!1),q=E||y,{limits:z}=null!==g&&void 0!==g&&g.limits?g:{limits:{ai_img_limit:0}},{ai_img_limit:j}=z,H=j>0&&_>=j,W=!(!g.limits||!g.counters)&&b.EW.isPlugin,K=(0,l.useCallback)((()=>{S.fire({name:"AiImgCount",count:_+1})}),[S,_]),V=(0,l.useMemo)((()=>!H&&(!W||0===j||_<j)),[H,W,_,j]),Q=(0,l.useCallback)((async()=>{T(u("Evaluating the task")),""===r||c||(m(!0),P(!0),o([]),A({event:"submit_form",action:"ai_image_generation",entity_id:E,project_id:k}),R({body:{project_id:k,request:"create-image",connection:"midjourney",message:r}}).then((({data:e,error:t})=>{if(t)throw t;if(401===e.data.status)throw new Error(b.ff);200===(null===e||void 0===e?void 0:e.data.status)?(null!==e&&void 0!==e&&e.data.task.id&&(T(e.data.task.message),D(e.data.task.id)),e.message&&p.success({id:"AI_IMAGE_SEND_SUCCESS",message:e.message,placement:"bottomRight",data:r}),C({task_id:null===e||void 0===e?void 0:e.data.task.id,entity_id:q})):(m(!1),P(!1),p.error({id:"AI_IMAGE_SEND_ERROR",message:(null===e||void 0===e?void 0:e.message)||u("Something went wrong, please try again"),placement:"bottomRight",data:r,innerException:e}))})).catch((e=>{m(!1),P(!1),(null!==e&&void 0!==e&&e.error||null!==e&&void 0!==e&&e.data)&&p.fromError("AI_IMAGE_SEND_ERROR",r,e.error||e)})))}),[r,c,m,P,o,A,E,k,R,p,C,q,u]),Z=(0,l.useCallback)((()=>{V?(W&&(B((e=>e+1)),K()),Q()):W&&p.error({message:u("The usage limit has been exceeded"),description:u("The maximum number of requests for the current subscription period has been reached.\nSelect the appropriate plan to fulfil more requests"),placement:"bottomRight"})}),[V,W,B,K,Q,p,u]);(0,l.useEffect)((()=>{var e;W&&B((null===g||void 0===g||null===(e=g.counters)||void 0===e?void 0:e.ai_img_counter)||0)}),[g,W]);const Y=(0,l.useCallback)((e=>{if(!i){n(!0);const a=e.match(/^data:image\/([A-Za-z-+/]+);base64,(.+)$/);if(!a)return;const l=a[1],i=a[2],r=atob(i),s=new Array(r.length);for(let e=0;e<r.length;e++)s[e]=r.charCodeAt(e);const o=new Uint8Array(s),c=new Blob([o],{type:`image/${l}`}),m=new File([c],"image.jpeg",{type:c.type});t({file:m})}}),[i,n,t]),$=(0,l.useCallback)((e=>{"error"!==e.status&&"Canceled"!==e.status?e.images?(T(e.status),100===e.progress&&(o(e.images),T(u("Evaluating the task")),D(null),P(!1))):(o([e.data]),m(!1)):(m(!1),P(!1),p.error({id:"AI_IMAGE_GET_ERROR",message:u("Something went wrong, please try again"),placement:"bottomRight",data:O}))}),[o,T,u,m,e,O,p,P]);return(0,l.useEffect)((()=>{L.length>1&&$(L[L.length-1])}),[L,$]),(0,l.useEffect)((()=>{(c||s.length>0)&&setTimeout((()=>{let t=550;a.current&&(t=a.current.offsetHeight+68),e(t)}),0)}),[a,L,s.length,c,e]),{aiImageCounter:_,setAiImageCounter:B,currentAiImgLimits:j,isFieldsDisabled:H,canGenerateImage:V,aiImageRequest:r,imageAiList:s,setImageAiList:o,isLoadingAi:c,setIsLoadingAi:m,loadingDuringGeneration:F,setLoadingDuringGeneration:P,requestStatus:U,setRequestStatus:T,handleGenerate:Z,handleLimitAiImgCount:K,convertBase64ToFile:Y,isShiftPressed:x,setIsShiftPressed:G,currentReqId:O,setCurrentReqId:D,limitsInPlugin:W}}({setModalHeight:e,customRequest:t,aiTabRef:a,isImageUploaded:n,setIsImageUploaded:r,aiImageRequest:c,imageAiList:u,setImageAiList:g,isLoadingAi:A,setIsLoadingAi:E}),{__:O}=(0,h.s9)(),[D,x]=(0,l.useState)(!1),G=(0,l.useCallback)((()=>x(!0)),[]),U=(0,l.useCallback)((()=>x(!1)),[]),T=(0,l.useCallback)((e=>m(e.target.value)),[m]),F=(0,l.useCallback)((e=>{"Shift"===e.key?_(!0):"Enter"!==e.key||S||(e.preventDefault(),L())}),[S,L,_]),P=(0,l.useCallback)((e=>{"Shift"===e.key&&_(!1)}),[_]);return l.createElement("div",{className:"image-ai"},B&&l.createElement(le.A,{text:"images",counter:y,limits:k,wrapperStyles:{marginTop:-25}}),l.createElement(q.A,{gutter:24,className:"image-ai__row"},l.createElement(z.A,{span:24},l.createElement(s.A.Item,{style:{margin:0}},l.createElement("span",{className:"ant-input-affix-wrapper ant-input-affix-wrapper-lg image-ai__input-affix-wrapper"+(D?" ant-input-affix-wrapper-focused":"")},l.createElement(o.A.TextArea,{ref:i,onKeyDown:F,onKeyUp:P,onFocus:G,onBlur:U,autoSize:!0,allowClear:!0,className:"text-area-input-hybrid image-ai__textarea",placeholder:O("Generate image"),value:c,onChange:T,spellCheck:"false"}),l.createElement("span",{className:"ant-input-suffix image-ai__input-suffix"},A||w?l.createElement(p.A,{className:"input-icon image-ai__input-icon",spin:!0}):l.createElement(Z.A,{icon:"AI",className:"input-icon image-ai__input-icon",onClick:L})))))),(A||u.length>0)&&l.createElement(J.A,{dotPosition:"top",arrows:!0,nextArrow:l.createElement(re,null),prevArrow:l.createElement(se,null),className:"image-ai__carousel"},A&&l.createElement("div",{className:"image-ai__loading"},l.createElement("div",{className:"spin"},l.createElement(p.A,{style:{fontSize:48},spin:!0}),l.createElement("p",{className:"status"},I))),u.length>0&&u.map(((e,t)=>l.createElement("div",{key:t,className:"image-ai__image-item"},l.createElement(ae,{images:u}),l.createElement("div",{className:"buttons"},u.length>0&&l.createElement(C.Ay,{onClick:()=>R(`data:image/jpeg;base64, ${e}`),icon:l.createElement(te.A,null)},O("Use this one"))))))))},ce=({setNewLink:e,setCurrentImageLink:t,setModalHeight:a,setModalWidth:i,setImageGifList:n,imageGifList:r,currentReqGif:c,setCurrentReqGif:u,inputRef:d,setStockLink:g,customRequest:f})=>{const{__:A}=(0,h.s9)(),[E,y]=(0,l.useState)(null),[k,w]=(0,l.useState)(!1),[I,b]=(0,l.useState)(25),[L]=(0,v.eo)(),R=async()=>{var e,t;const l=await L({query:c,page:0});(null===l||void 0===l||null===(e=l.data)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.length)>0&&(n(l.data.data),setTimeout((()=>{a("84vh"),i(1060)}),0))},C=l.createElement(p.A,{style:{fontSize:20},spin:!0});return l.createElement("div",{className:"stock-tab"},l.createElement(s.A,{onValuesChange:R,className:r.length>0?"serach-results":""},l.createElement(q.A,{gutter:24},l.createElement(z.A,{span:r.length>0?"":24},l.createElement(s.A.Item,{className:"stock-search-input"},l.createElement(o.A,{onKeyDown:e=>"Space"===e.code&&R(),onPressEnter:e=>R(),allowClear:!0,size:r.length>0?"medium":"large",placeholder:A("Search GIFs"),value:c.keywords,onChange:e=>u((t=>({...t,keywords:e.target.value}))),ref:d,spellCheck:"false",suffix:l.createElement(Q.A,{onClick:R,className:"cards-search__search-icon, input-icon",style:{fontSize:"16px",cursor:"pointer"}})})))),r.length>0&&l.createElement("div",{className:"blocks-search__divider-wrapper"},l.createElement("div",{className:"ant-divider ant-divider-horizontal blocks-search__divider",role:"separator"}))),l.createElement("div",{className:"serach-output-wrapper",style:{marginRight:-10}},r.length>0&&l.createElement("div",{id:"scrollableDiv",style:{width:"100%",height:"calc(84vh - 148px)",overflow:"auto",paddingTop:24,paddingRight:14,paddingLeft:24,marginLeft:-24,lineHeight:"0",boxSizing:"unset"}},l.createElement(K.A,{dataLength:r&&r.length,next:async()=>{k||(w(!0),L({query:c,page:I}).then((e=>{n((t=>[...t,...e.data.data])),w(!1),b((e=>e+25))})).catch((()=>{w(!1)})))},hasMore:r,endMessage:l.createElement(W.A,{plain:!0},A("That`s all we could find.")," \ud83e\udd10"),scrollableTarget:"scrollableDiv",style:{overflow:"visible"},loader:l.createElement(m.A,{indicator:C})},l.createElement(V.A,{breakpointCols:{default:3},className:"my-masonry-grid",columnClassName:"my-masonry-grid_column"},r.map(((e,a)=>l.createElement("div",{className:"list-item",key:e.id+a,onClick:()=>{return a=e.images.downsized.url,l=e.id,y(l),setTimeout((()=>{y(null)}),2e3),g(`${a}`),t(`${a}`),void f(`${a}`);var a,l}},l.createElement("img",{className:E===e.id?"loaded-image":"",width:"322px",src:`${e.images.downsized.url}`,alt:e.title,onLoad:e=>e.target.parentNode.classList.add("loaded")}),l.createElement("a",{rel:"noreferrer",href:"https://giphy.com/",target:"_blank",onClick:e=>e.stopPropagation()},l.createElement("div",{className:"overlay-image",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=)"}})),E===e.id&&l.createElement(m.A,{className:"ant-spin",indicator:l.createElement(p.A,{spin:!0})})))))))))};var me=a(48956),ue=a(40277);const de="IMG",ge="BACKGROUND",pe="EDITOR",he="UPLOAD",fe="STOCK",Ae="GIF",Ee="AI",{Dragger:ve}=n.A,ye=()=>{var e,t;const a=(0,ie.rD)(),{__:n}=(0,h.s9)(),L=(0,i.wA)(),{projectId:R}=(0,f.g)(),[C,S]=(0,E.dS)(),[_]=(0,v.FQ)(),{modal:B}=r.A.useApp(),O=(0,d.hN)(),D=(0,i.d4)(y.B$),x=(0,i.d4)(y.C1),G=(0,i.d4)(k.cL),U=(0,i.d4)(w.js),T=(0,i.d4)(w.Ac),[F,q]=(0,l.useState)(""),[z,j]=(0,l.useState)(""),[H,W]=(0,l.useState)(""),[K,V]=(0,l.useState)(""),[Q,Z]=(0,l.useState)(he),[Y,J]=(0,l.useState)({width:"",height:"",size:"",format:""}),[X,ee]=(0,l.useState)("success"),[te,ae]=(0,l.useState)(!1),le=l.useRef(null),ne=l.useRef(null),re=l.useRef(null),se=l.useRef(null),ye=l.useRef(null),ke=l.useRef(null),we=l.useRef(null),Ie=l.useRef(null),be=l.useRef(null),[Le,Re]=(0,l.useState)("auto"),[Ce,Se]=(0,l.useState)(572),[_e,Be]=(0,l.useState)(null),[Ne,Oe]=(0,l.useState)(!1),[Me,De]=(0,l.useState)({keywords:"",color:"",orientation:""}),[xe,Ge]=(0,l.useState)({keywords:""}),[Ue,Te]=(0,l.useState)([]),[Fe,Pe]=(0,l.useState)([]),[qe,ze]=(0,l.useState)([]),[je,He]=(0,l.useState)(!1),[We,Ke]=(0,l.useState)(""),[Ve,Qe]=(0,l.useState)(!1),[Ze,Ye]=(0,l.useState)(0),$e=(0,i.d4)(I.yN),Je=(0,N.ml)(M.AZ.FILE_PROXY_EVENT_ID);let Xe=!(D||(null===(e=x.id)||void 0===e?void 0:e.toString())!==(null===$e||void 0===$e||null===(t=$e.members)||void 0===t?void 0:t.owner.ID))&&!0;const et=async e=>{if(e)try{const t=await tt(e);lt({url:e}),t&&it(t)&&nt({file:t})}catch(t){}},tt=async e=>{try{const t=(await Je.fire({url:e,project:$e})).filter((e=>e instanceof Blob))[0];if(t)return t;const a=`https://api.emailmaker.ru/tools/file-proxy.php?url=${encodeURIComponent(e)}`,l=await fetch(a);if(!l.ok)throw new Error(`Server returned ${l.status}`);const i=await l.blob();return new File([i],e.split("/").pop(),{type:i.type})}catch(t){}};document.onpaste=function(e){const t=e.clipboardData.items[0];if(Q===he&&K){if(0===t.type.indexOf("image")){const e=t.getAsFile();it(e);const a={file:e};j(""),nt(a)}0===t.type.indexOf("text")&&t.getAsString((e=>{"http"===e.slice(0,4)?(j(""),q(e),lt({url:e})):"meta"===e.toString().slice(1,5)&&(j(""),q(e.toString().split('"')[1]),lt({url:e.toString().split('"')[1]}))}))}};const at=(0,l.useMemo)((()=>({IMG:U,BACKGROUND:T})),[U,T]);(0,l.useEffect)((()=>{const e=e=>{let t=null;G.includes("UPLOAD_BACKGROUND_MODAL")?(t=ge,V(ge)):G.includes("UPLOAD_IMAGE_MODAL")&&(V(de),t=de),at[t]&&(q(at[t]),Z(e))};G===b.lx.UPLOAD_IMAGE_MODAL||G===b.lx.UPLOAD_BACKGROUND_MODAL?e(pe):G===b.lx.UPLOAD_IMAGE_MODAL_AI||G===b.lx.UPLOAD_BACKGROUND_MODAL_AI?(Xe?(Qe(!0),Ye(2)):e(Ee),setTimeout((()=>{var e;return null===(e=be.current)||void 0===e?void 0:e.focus({cursor:"start"})}),100)):G===b.lx.UPLOAD_IMAGE_MODAL_UPLOAD||G===b.lx.UPLOAD_BACKGROUND_MODAL_UPLOAD?(e(he),setTimeout((()=>{var e;return null===(e=ke.current)||void 0===e?void 0:e.focus({cursor:"start"})}),100)):G===b.lx.UPLOAD_IMAGE_MODAL_STOCK||G===b.lx.UPLOAD_BACKGROUND_MODAL_STOCK?(Xe?(Qe(!0),Ye(3)):e(fe),setTimeout((()=>{var e;return null===(e=Ie.current)||void 0===e?void 0:e.focus({cursor:"start"})}),100)):G===b.lx.UPLOAD_IMAGE_MODAL_GIF||G===b.lx.UPLOAD_BACKGROUND_MODAL_GIF?(Xe?(Qe(!0),Ye(3)):e(Ae),setTimeout((()=>{var e;return null===(e=we.current)||void 0===e?void 0:e.focus({cursor:"start"})}),100)):G===b.lx.UPLOAD_IMAGE_MODAL_EDIT||G===b.lx.UPLOAD_BACKGROUND_MODAL_EDIT?(Xe?(Qe(!0),Ye(5)):e(pe),L((0,k.Wz)(b.lx.IMAGE_EDITOR_MODAL))):V("")}),[G,L,Xe,at]);const lt=(0,l.useCallback)((({url:e=F||""})=>{q(e),K===de&&L((0,w.tm)(e)),K===ge&&L((0,w.e_)(e)),setTimeout((()=>{De({keywords:"",color:"",orientation:""}),Ge({keywords:""}),Pe([]),Te([]),V(""),Ke(""),He(!1),W(""),j(""),Z(he)}),200),L((0,k.Oo)()),L((0,k.Os)())}),[F,L,K]);(0,l.useEffect)((()=>{const e=z||H;e?(0,ue.DI)(e).then((t=>{ee(t),Se(572),setTimeout((()=>{let e=0;ne.current&&(e=ne.current.offsetHeight+62),Re(e)}),0),lt(e)})).catch((e=>{ee(e)})):ee("")}),[z,H,lt]),(0,l.useEffect)((()=>{F&&_(F).then((({data:e})=>{J({width:null===e||void 0===e?void 0:e.width,height:null===e||void 0===e?void 0:e.height,size:((null===e||void 0===e?void 0:e.fileSize)/1024).toFixed(2),format:null===e||void 0===e?void 0:e.format})}))}),[F,_]);(0,l.useEffect)((()=>{var e;""===Me.keywords&&(null===ke||void 0===ke||null===(e=ke.current)||void 0===e||e.focus({cursor:"start"}),Pe([]),setTimeout((()=>{Re("auto"),Se(572)}),0))}),[Me,Pe,Re,Se]);const it=e=>{const t="image/jpeg"===e.type||"image/png"===e.type||"image/jpg"===e.type||"image/webp"===e.type||"image/gif"===e.type||"image/svg+xml"===e.type;return t||O.error({id:"IMAGE_UPLOAD_WRONG_FORMAT",data:e,message:"Upload",description:"You can only upload JPG/JPEG/PNG/WEBP/GIF/SVG file!",placement:"bottomRight"}),t},nt=({file:e})=>{const t="image/svg+xml"===e.type,i="image/webp"===e.type,r=e=>{const t=new Image;t.src=URL.createObjectURL(e),t.onload=()=>{(async e=>{Oe(!0);const t=e.file;try{"image/gif"!==t.type&&(e.file=await(0,A.A)(t,{maxSizeMB:a.compressMaxSize||.45,maxWidthOrHeight:a.compressMaxWidthOrHeight||2e3})),C(e).then((({error:e,data:a})=>{var i;if(e)O.fromError("IMAGE_UPLOAD_ERROR",t,e);else if(400===(null===a||void 0===a||null===(i=a.data)||void 0===i?void 0:i.status))O.error({id:"IMAGE_UPLOAD_ERROR",data:t,innerException:null===a||void 0===a?void 0:a.data,message:l.createElement("div",{dangerouslySetInnerHTML:{__html:a.code}}),description:l.createElement("div",{dangerouslySetInnerHTML:{__html:a.message}}),placement:"bottomRight"});else{var r;const e=null===a||void 0===a||null===(r=a[0])||void 0===r?void 0:r.file_url;e&&(Re("auto"),ae(!1),lt({url:e})),O.success({id:"IMAGE_UPLOAD_SUCCESS",data:t,message:n("The image was successfully uploaded.")})}})).catch((e=>{})).finally((()=>{Oe(!1)}))}catch(i){Oe(!1)}})({user_id:x.id,folder:R,file:e})}};t?((e,t)=>{const a=new FileReader;a.onload=function(a){const l=a.target.result,i=new Blob([l],{type:"image/svg+xml;charset=utf-8"}),n=URL.createObjectURL(i),r=new Image;r.onload=function(){const a=document.createElement("canvas");a.width=2*r.width,a.height=2*r.height,a.getContext("2d").drawImage(r,0,0,a.width,a.height),a.toBlob((a=>{const l=new File([a],e.name.replace(".svg",".png"),{type:"image/png"});t(l),URL.revokeObjectURL(n)}),"image/png")},r.src=n},a.readAsText(e)})(e,(e=>r(e))):i?((e,t,a=90)=>{const l=new Image;l.src=URL.createObjectURL(e),l.onload=()=>{const e=document.createElement("canvas");e.width=l.width,e.height=l.height;const i=e.getContext("2d");i.imageSmoothingEnabled=!0,i.imageSmoothingQuality="high",i.drawImage(l,0,0,e.width,e.height),e.toBlob((e=>{const a=new File([e],"converted.jpg",{type:"image/jpeg"});t(a)}),"image/jpeg",a/100)},l.onerror=e=>{t(null)}})(e,(e=>r(e))):r(e)},rt=e=>nt({file:e});let st=[{label:n("Upload"),key:he,children:l.createElement("div",{ref:le,style:{paddingBottom:24}},l.createElement(ve,{showUploadList:!1,name:"Image",beforeUpload:it,customRequest:nt,style:{marginBottom:10},multiple:!1,accept:"image/png, image/jpeg, image/jpg, image/webp, image/gif, image/svg+xml"},l.createElement("p",{className:"ant-upload-drag-icon"},l.createElement(g.A,null)),l.createElement("p",{className:"ant-upload-text"},n("Click to select, paste from the clipboard, or drag and drop")),l.createElement("p",{className:"ant-upload-hint"},n("Accepted formats: PNG, JPG, WEBP, SVG or GIF."))),l.createElement(s.A,{style:{padding:"0 2px 0 2px"}},l.createElement(s.A.Item,{validateStatus:X},l.createElement(o.A,{ref:ke,allowClear:!0,size:"large",placeholder:n("Paste image URL here"),value:z,onChange:e=>{const t=e.target.value;j(t),_e&&clearTimeout(_e);const a=setTimeout((()=>et(t)),1e3);Be(a)},spellCheck:"false"}))))}];a.imageCenterStockEnabled&&!Xe&&st.push({label:n("Stock"),key:fe,children:l.createElement("div",{ref:re,style:{paddingBottom:24}},l.createElement($,{currentReq:Me,setCurrentReq:De,imageStockList:Fe,setImageStockList:Pe,setModalWidth:Se,setModalHeight:Re,setStockLink:W,setCurrentImageLink:q,inputRef:Ie,customRequest:et}))}),a.imageCenterGifEnabled&&!Xe&&st.push({label:n("GIF"),key:Ae,children:l.createElement("div",{ref:se,style:{paddingBottom:24}},l.createElement(ce,{currentReqGif:xe,setCurrentReqGif:Ge,imageGifList:Ue,setImageGifList:Te,setModalWidth:Se,setModalHeight:Re,setStockLink:W,setCurrentImageLink:q,inputRef:we,customRequest:et}))}),a.elementAIimageEnabled&&!Xe&&st.push({label:n("AI"),key:Ee,children:l.createElement("div",{ref:ye,style:{paddingBottom:24}},l.createElement(oe,{setModalHeight:Re,customRequest:nt,aiImageRequest:We,setAiImageRequest:Ke,imageAiList:qe,setImageAiList:ze,isLoadingAi:je,setIsLoadingAi:He,aiTabRef:ye,inputAiRef:be,isImageUploaded:te,setIsImageUploaded:ae}))}),a.imageCenterEditorEnabled&&st.push({label:"",key:pe,children:l.createElement("div",{ref:ne},l.createElement(P,{currentImageLink:F,newLink:z,imageSize:Y,onSave:rt,uploadImageResultIsLoading:S.isLoading||!1}))});const ot=l.createElement(p.A,{style:{fontSize:32,margin:-16},spin:!0});return l.createElement(l.Fragment,null,l.createElement(c.A,{width:Ce,className:"image-center blocks-modal",title:n("Image Center"),centered:!0,style:{minHeight:390},open:!!K,onOk:lt,onCancel:()=>{L((0,k.Oo)()),setTimeout((()=>{q(""),j(""),Pe([]),Pe([]),De({keywords:"",color:"",orientation:""}),Ge({keywords:""}),Re("auto"),!je&&Ke(""),Se(572),Z(he)}),200)},footer:Q===pe?l.createElement(l.Fragment,null):null},l.createElement(m.A,{spinning:Ne,indicator:ot},l.createElement(u.A,{activeKey:Q,onChange:e=>{"GALLERY"===e?B.success({maskClosable:!0,centered:!0,title:n("Coming soon"),content:n("The feature is under development."),okText:n("Ok. I'll be waiting"),onOk:()=>{}}):e===pe&&""===F?B.warning({maskClosable:!0,centered:!0,title:n(""),content:n("To preview and edit the uploaded image"),okText:n("Upload Image"),onOk:()=>{Z(he)}}):(setTimeout((()=>{let t=0,a=0;var l;if(e===he&&le.current)""===Me.keywords&&(null===(l=ke.current)||void 0===l||l.focus({cursor:"start"})),t=300,a=572;else if(e===pe&&ne.current)t=ne.current.offsetHeight+62,a=572;else if(e===fe&&re.current){var i;""===Me.keywords&&(null===(i=Ie.current)||void 0===i||i.focus({cursor:"start"})),t=130,a=572,Fe.length>0&&(a=1060,t="84vh")}else if(e===Ae&&se.current){var n;""===Me.keywords&&(null===(n=we.current)||void 0===n||n.focus({cursor:"start"})),t=130,a=572,Ue.length>0&&(a=1060,t="84vh")}else if(e===Ee&&ye.current){var r;if(""===We&&0===qe.length)null===(r=be.current)||void 0===r||r.focus({cursor:"start"}),t=130;else t=ye.current.offsetHeight+82;a=572}Re(t),Se(a)}),0),Z(e))},items:st,style:{height:Le,minHeight:130}}))),l.createElement(me.A,{open:Ve,onCancel:()=>Qe(!1),initialSlide:Ze}))}}}]);