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