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