useblocks 1.1.71 → 1.1.81

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/CHANGELOG.md +426 -0
  2. package/README.md +38 -0
  3. package/iframe/js/amp.Da_6yDxX.js +1 -0
  4. package/iframe/js/iframe-eblock.js +1 -1
  5. package/iframe/js/iframe.js +1 -1
  6. package/iframe/js/rules.4N5s3OV-.js +1 -1
  7. package/package.json +30 -9
  8. package/static/core/1ab52017.js +2134 -0
  9. package/static/core/4296ff4b.js +3280 -0
  10. package/static/core/{63206e112.js → 496a28e52.js} +2682 -2421
  11. package/static/core/{9ab1c444.js → 5cc21a00.js} +2302 -2432
  12. package/static/core/{b9b92e01.js → 6a3ea43c.js} +15 -15
  13. package/static/core/{e02024fb2.js → 6fc5508e2.js} +69 -69
  14. package/static/core/{ea6c5c93.js → 7cff1d56.js} +3327 -2997
  15. package/static/core/87de8255.js +1098 -0
  16. package/static/core/{3f22a9d32.js → 909c874d2.js} +1196 -1123
  17. package/static/core/{c3b45fb6.js → ace7c2d1.js} +7 -7
  18. package/static/core/{5e082e16.js → c287f8b6.js} +38 -38
  19. package/static/core/{585259872.js → cc4c61c42.js} +108 -108
  20. package/static/core/{222d29d9.js → d2293148.js} +272 -248
  21. package/static/core/{e4d01015.js → d70b5c31.js} +22367 -19437
  22. package/static/core/{68ec11c8.js → dfbad00e.js} +4 -4
  23. package/static/core/{ce9be2ec2.js → f2b0c97b2.js} +2138 -2086
  24. package/static/core/{d3bbb05e.js → f7e3905a.js} +3 -3
  25. package/static/core/{513594a8.js → fc514220.js} +34 -34
  26. package/static/umd-runtime/ui-kit.js +1171 -1103
  27. package/ui-kit/index.js +1541 -1469
  28. package/{useblocks-core.77131b3d.js → useblocks-core.0a682f7d.js} +6 -6
  29. package/useblocks-esm.js +4 -4
  30. package/{useblocks-po.77131b3d.js → useblocks-po.0a682f7d.js} +1 -1
  31. package/useblocks.d.ts +66 -0
  32. package/useblocks.js +3 -3
  33. package/favicon-b.ico +0 -0
  34. package/favicon.ico +0 -0
  35. package/fonts/SegoeUI-Bold.woff2 +0 -0
  36. package/fonts/SegoeUI-Semibold.woff2 +0 -0
  37. package/fonts/SegoeUI.woff2 +0 -0
  38. package/iframe/js/amp.DllX-Im0.js +0 -1
  39. package/js/amplitude.min.js +0 -10859
  40. package/js/sourcebuster.min.js +0 -672
  41. package/manifest.json +0 -17
  42. package/npm-publish.manifest.json +0 -51
  43. package/static/core/23546a64.js +0 -925
  44. package/static/core/35ad3ae5.js +0 -3150
  45. package/static/core/36bf6931.js +0 -2119
  46. package/static/media/image-editor/images/samples/large_sample.jpg +0 -0
  47. package/static/media/image-editor/images/samples/sample1.jpg +0 -0
  48. package/static/media/image-editor/images/samples/sample1_thumbnail.jpg +0 -0
  49. package/static/media/image-editor/images/samples/sample2.jpg +0 -0
  50. package/static/media/image-editor/images/samples/sample2_thumbnail.jpg +0 -0
  51. package/static/media/image-editor/images/samples/sample3.jpg +0 -0
  52. package/static/media/image-editor/images/samples/sample3_thumbnail.jpg +0 -0
  53. package/static/media/image-editor/images/samples/sample4.json +0 -871
  54. package/static/media/image-editor/images/samples/sample4_preview.jpg +0 -0
  55. package/test-font.otf +0 -0
  56. package/test-font.ttf +0 -0
  57. package/test-font.woff2 +0 -0
  58. package/tsconfig.json +0 -14
  59. package/two_step_headless_plugin.html +0 -558
  60. /package/iframe/{iframe-eblock.77131b3d.html → iframe-eblock.0a682f7d.html} +0 -0
  61. /package/iframe/{iframe.77131b3d.html → iframe.0a682f7d.html} +0 -0
@@ -1,925 +0,0 @@
1
- __useblocks__.define("static/core/23546a64.js", [
2
- "require",
3
- "exports",
4
- "module",
5
- "static/core/df237243.js",
6
- "static/core/ea6c5c93.js"
7
- ], function(Ee, y, Bt) {
8
- const xe = Ee("./df237243.js"), v = Ee("./ea6c5c93.js");
9
- function Pe(t) {
10
- return function(r) {
11
- return {
12
- setOptions: () => {},
13
- instance: {},
14
- dispose: () => {},
15
- ...t(r) || {}
16
- };
17
- };
18
- }
19
- function Xe(t) {
20
- return (r) => {
21
- const o = {}, s = [];
22
- for (const m of t) s.push(m(r));
23
- for (const m of s) Object.assign(o, m.instance);
24
- return {
25
- instance: o,
26
- setOptions: async (m) => {
27
- for (const S of s) await S.setOptions(m);
28
- },
29
- dispose: () => {
30
- for (const m of s) m.dispose();
31
- }
32
- };
33
- };
34
- }
35
- function $e(t) {
36
- const r = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), o = atob(r), s = new Uint8Array(o.length);
37
- for (let c = 0; c < o.length; c++) s[c] = o.charCodeAt(c);
38
- return new TextDecoder().decode(s);
39
- }
40
- function Ae(t) {
41
- const [r, o, s] = t.split("."), c = JSON.parse($e(o));
42
- return {
43
- exp: c.exp,
44
- createdAt: c.iat,
45
- data: c
46
- };
47
- }
48
- var ce = v.createIdentifier$1(), Ie = new WeakMap(), Je = 3e4;
49
- function Ve(t) {
50
- let r;
51
- try {
52
- r = Ae(t).exp;
53
- } catch {
54
- return !0;
55
- }
56
- return typeof r != "number" || !Number.isFinite(r) ? !0 : r * 1e3 <= Date.now() + Je;
57
- }
58
- function _e(t, r, o, s) {
59
- const c = Ie.get(t);
60
- c && (c.stale = !0);
61
- const d = { stale: !1 };
62
- Ie.set(t, d), t.injectFactory(ce, async (m, S) => {
63
- if (d.stale) return "";
64
- try {
65
- let P = await S || void 0;
66
- if (!P) {
67
- const I = t.getInstance(v.STANDALONE_BOOTSTRAP_TOKEN_ID);
68
- I && (P = await I);
69
- }
70
- return r ? !P || Ve(P) ? await r(o, s, P) : P : "";
71
- } catch {
72
- return "";
73
- }
74
- }, !0);
75
- }
76
- var Ye = Pe((t) => {
77
- let r, o, s;
78
- return t.addService(v.REQUEST_HANDLER_ID, { execute: async (c) => {
79
- if (r) {
80
- const d = await t.getInstanceAsync(ce);
81
- d && c.headers.append("authorization", `Bearer ${d}`);
82
- }
83
- } }), { setOptions(c) {
84
- const d = !v.deepEqual(o, c.user), m = s !== c.project;
85
- (r !== c.getAuthToken || d || m) && (r = c.getAuthToken, o = c.user, s = c.project, _e(t, r, c.user, c.project));
86
- } };
87
- }), Oe = xe.__commonJSMin(((t, r) => {
88
- (function(o) {
89
- "use strict";
90
- var s = o.setTimeout, c = o.clearTimeout, d = o.XMLHttpRequest, m = o.XDomainRequest, S = o.ActiveXObject, P = o.EventSource, I = o.document, k = o.Promise, Q = o.fetch, N = o.Response, D = o.TextDecoder, V = o.TextEncoder, X = o.AbortController;
91
- if (typeof window < "u" && typeof I < "u" && !("readyState" in I) && I.body == null && (I.readyState = "loading", window.addEventListener("load", function(e) {
92
- I.readyState = "complete";
93
- }, !1)), d == null && S != null && (d = function() {
94
- return new S("Microsoft.XMLHTTP");
95
- }), Object.create == null && (Object.create = function(e) {
96
- function a() {}
97
- return a.prototype = e, new a();
98
- }), Date.now || (Date.now = function() {
99
- return new Date().getTime();
100
- }), X == null) {
101
- var Y = Q;
102
- Q = function(e, a) {
103
- var i = a.signal;
104
- return Y(e, {
105
- headers: a.headers,
106
- credentials: a.credentials,
107
- cache: a.cache
108
- }).then(function(n) {
109
- var l = n.body.getReader();
110
- return i._reader = l, i._aborted && i._reader.cancel(), {
111
- status: n.status,
112
- statusText: n.statusText,
113
- headers: n.headers,
114
- body: { getReader: function() {
115
- return l;
116
- } }
117
- };
118
- });
119
- }, X = function() {
120
- this.signal = {
121
- _reader: null,
122
- _aborted: !1
123
- }, this.abort = function() {
124
- this.signal._reader != null && this.signal._reader.cancel(), this.signal._aborted = !0;
125
- };
126
- };
127
- }
128
- function le() {
129
- this.bitsNeeded = 0, this.codePoint = 0;
130
- }
131
- le.prototype.decode = function(e) {
132
- function a(g, w, f) {
133
- if (f === 1) return g >= 128 >> w && g << w <= 2047;
134
- if (f === 2) return g >= 2048 >> w && g << w <= 55295 || g >= 57344 >> w && g << w <= 65535;
135
- if (f === 3) return g >= 65536 >> w && g << w <= 1114111;
136
- throw new Error();
137
- }
138
- function i(g, w) {
139
- if (g === 6) return w >> 6 > 15 ? 3 : w > 31 ? 2 : 1;
140
- if (g === 12) return w > 15 ? 3 : 2;
141
- if (g === 18) return 3;
142
- throw new Error();
143
- }
144
- for (var n = 65533, l = "", u = this.bitsNeeded, p = this.codePoint, T = 0; T < e.length; T += 1) {
145
- var h = e[T];
146
- u !== 0 && (h < 128 || h > 191 || !a(p << 6 | h & 63, u - 6, i(u, p))) && (u = 0, p = n, l += String.fromCharCode(p)), u === 0 ? (h >= 0 && h <= 127 ? (u = 0, p = h) : h >= 192 && h <= 223 ? (u = 6, p = h & 31) : h >= 224 && h <= 239 ? (u = 12, p = h & 15) : h >= 240 && h <= 247 ? (u = 18, p = h & 7) : (u = 0, p = n), u !== 0 && !a(p, u, i(u, p)) && (u = 0, p = n)) : (u -= 6, p = p << 6 | h & 63), u === 0 && (p <= 65535 ? l += String.fromCharCode(p) : (l += String.fromCharCode(55296 + (p - 65535 - 1 >> 10)), l += String.fromCharCode(56320 + (p - 65535 - 1 & 1023))));
147
- }
148
- return this.bitsNeeded = u, this.codePoint = p, l;
149
- };
150
- var jt = function() {
151
- try {
152
- return new D().decode(new V().encode("test"), { stream: !0 }) === "test";
153
- } catch {}
154
- return !1;
155
- };
156
- (D == null || V == null || !jt()) && (D = le);
157
- var q = function() {};
158
- function $(e) {
159
- this.withCredentials = !1, this.readyState = 0, this.status = 0, this.statusText = "", this.responseText = "", this.onprogress = q, this.onload = q, this.onerror = q, this.onreadystatechange = q, this._contentType = "", this._xhr = e, this._sendTimeout = 0, this._abort = q;
160
- }
161
- $.prototype.open = function(e, a) {
162
- this._abort(!0);
163
- var i = this, n = this._xhr, l = 1, u = 0;
164
- this._abort = function(f) {
165
- i._sendTimeout !== 0 && (c(i._sendTimeout), i._sendTimeout = 0), (l === 1 || l === 2 || l === 3) && (l = 4, n.onload = q, n.onerror = q, n.onabort = q, n.onprogress = q, n.onreadystatechange = q, n.abort(), u !== 0 && (c(u), u = 0), f || (i.readyState = 4, i.onabort(null), i.onreadystatechange())), l = 0;
166
- };
167
- var p = function() {
168
- if (l === 1) {
169
- var f = 0, b = "", F = void 0;
170
- if ("contentType" in n) f = 200, b = "OK", F = n.contentType;
171
- else try {
172
- f = n.status, b = n.statusText, F = n.getResponseHeader("Content-Type");
173
- } catch {
174
- f = 0, b = "", F = void 0;
175
- }
176
- f !== 0 && (l = 2, i.readyState = 2, i.status = f, i.statusText = b, i._contentType = F, i.onreadystatechange());
177
- }
178
- }, T = function() {
179
- if (p(), l === 2 || l === 3) {
180
- l = 3;
181
- var f = "";
182
- try {
183
- f = n.responseText;
184
- } catch {}
185
- i.readyState = 3, i.responseText = f, i.onprogress();
186
- }
187
- }, h = function(f, b) {
188
- if ((b == null || b.preventDefault == null) && (b = { preventDefault: q }), T(), l === 1 || l === 2 || l === 3) {
189
- if (l = 4, u !== 0 && (c(u), u = 0), i.readyState = 4, f === "load") i.onload(b);
190
- else if (f === "error") i.onerror(b);
191
- else if (f === "abort") i.onabort(b);
192
- else throw new TypeError();
193
- i.onreadystatechange();
194
- }
195
- }, g = function(f) {
196
- n != null && (n.readyState === 4 ? (!("onload" in n) || !("onerror" in n) || !("onabort" in n)) && h(n.responseText === "" ? "error" : "load", f) : n.readyState === 3 ? "onprogress" in n || T() : n.readyState === 2 && p());
197
- }, w = function() {
198
- u = s(function() {
199
- w();
200
- }, 500), n.readyState === 3 && T();
201
- };
202
- "onload" in n && (n.onload = function(f) {
203
- h("load", f);
204
- }), "onerror" in n && (n.onerror = function(f) {
205
- h("error", f);
206
- }), "onabort" in n && (n.onabort = function(f) {
207
- h("abort", f);
208
- }), "onprogress" in n && (n.onprogress = T), "onreadystatechange" in n && (n.onreadystatechange = function(f) {
209
- g(f);
210
- }), ("contentType" in n || !("ontimeout" in d.prototype)) && (a += (a.indexOf("?") === -1 ? "?" : "&") + "padding=true"), n.open(e, a, !0), "readyState" in n && (u = s(function() {
211
- w();
212
- }, 0));
213
- }, $.prototype.abort = function() {
214
- this._abort(!1);
215
- }, $.prototype.getResponseHeader = function(e) {
216
- return this._contentType;
217
- }, $.prototype.setRequestHeader = function(e, a) {
218
- var i = this._xhr;
219
- "setRequestHeader" in i && i.setRequestHeader(e, a);
220
- }, $.prototype.getAllResponseHeaders = function() {
221
- return this._xhr.getAllResponseHeaders != null && this._xhr.getAllResponseHeaders() || "";
222
- }, $.prototype.send = function() {
223
- if ((!("ontimeout" in d.prototype) || !("sendAsBinary" in d.prototype) && !("mozAnon" in d.prototype)) && I != null && I.readyState != null && I.readyState !== "complete") {
224
- var e = this;
225
- e._sendTimeout = s(function() {
226
- e._sendTimeout = 0, e.send();
227
- }, 4);
228
- return;
229
- }
230
- var a = this._xhr;
231
- "withCredentials" in a && (a.withCredentials = this.withCredentials);
232
- try {
233
- a.send(void 0);
234
- } catch (i) {
235
- throw i;
236
- }
237
- };
238
- function De(e) {
239
- return e.replace(/[A-Z]/g, function(a) {
240
- return String.fromCharCode(a.charCodeAt(0) + 32);
241
- });
242
- }
243
- function qe(e) {
244
- for (var a = Object.create(null), i = e.split(`\r
245
- `), n = 0; n < i.length; n += 1) {
246
- var l = i[n].split(": "), u = l.shift(), p = l.join(": ");
247
- a[De(u)] = p;
248
- }
249
- this._map = a;
250
- }
251
- qe.prototype.get = function(e) {
252
- return this._map[De(e)];
253
- }, d != null && d.HEADERS_RECEIVED == null && (d.HEADERS_RECEIVED = 2);
254
- function Ue() {}
255
- Ue.prototype.open = function(e, a, i, n, l, u, p) {
256
- e.open("GET", l);
257
- var T = 0;
258
- e.onprogress = function() {
259
- var g = e.responseText.slice(T);
260
- T += g.length, i(g);
261
- }, e.onerror = function(g) {
262
- g.preventDefault(), n(new Error("NetworkError"));
263
- }, e.onload = function() {
264
- n(null);
265
- }, e.onabort = function() {
266
- n(null);
267
- }, e.onreadystatechange = function() {
268
- if (e.readyState === d.HEADERS_RECEIVED) {
269
- var g = e.status, w = e.statusText;
270
- a(g, w, e.getResponseHeader("Content-Type"), new qe(e.getAllResponseHeaders()));
271
- }
272
- }, e.withCredentials = u;
273
- for (var h in p) Object.prototype.hasOwnProperty.call(p, h) && e.setRequestHeader(h, p[h]);
274
- return e.send(), e;
275
- };
276
- function Ge(e) {
277
- this._headers = e;
278
- }
279
- Ge.prototype.get = function(e) {
280
- return this._headers.get(e);
281
- };
282
- function Qe() {}
283
- Qe.prototype.open = function(e, a, i, n, l, u, p) {
284
- var T = null, h = new X(), g = h.signal, w = new D();
285
- return Q(l, {
286
- headers: p,
287
- credentials: u ? "include" : "same-origin",
288
- signal: g,
289
- cache: "no-store"
290
- }).then(function(f) {
291
- return T = f.body.getReader(), a(f.status, f.statusText, f.headers.get("Content-Type"), new Ge(f.headers)), new k(function(b, F) {
292
- var ie = function() {
293
- T.read().then(function(R) {
294
- R.done ? b(void 0) : (i(w.decode(R.value, { stream: !0 })), ie());
295
- }).catch(function(R) {
296
- F(R);
297
- });
298
- };
299
- ie();
300
- });
301
- }).catch(function(f) {
302
- if (f.name !== "AbortError") return f;
303
- }).then(function(f) {
304
- n(f);
305
- }), { abort: function() {
306
- T?.cancel(), h.abort();
307
- } };
308
- };
309
- function ae() {
310
- this._listeners = Object.create(null);
311
- }
312
- function Fe(e) {
313
- s(function() {
314
- throw e;
315
- }, 0);
316
- }
317
- ae.prototype.dispatchEvent = function(e) {
318
- e.target = this;
319
- var a = this._listeners[e.type];
320
- if (a != null) for (var i = a.length, n = 0; n < i; n += 1) {
321
- var l = a[n];
322
- try {
323
- typeof l.handleEvent == "function" ? l.handleEvent(e) : l.call(this, e);
324
- } catch (u) {
325
- Fe(u);
326
- }
327
- }
328
- }, ae.prototype.addEventListener = function(e, a) {
329
- e = String(e);
330
- var i = this._listeners, n = i[e];
331
- n == null && (n = [], i[e] = n);
332
- for (var l = !1, u = 0; u < n.length; u += 1) n[u] === a && (l = !0);
333
- l || n.push(a);
334
- }, ae.prototype.removeEventListener = function(e, a) {
335
- e = String(e);
336
- var i = this._listeners, n = i[e];
337
- if (n != null) {
338
- for (var l = [], u = 0; u < n.length; u += 1) n[u] !== a && l.push(n[u]);
339
- l.length === 0 ? delete i[e] : i[e] = l;
340
- }
341
- };
342
- function K(e) {
343
- this.type = e, this.target = void 0;
344
- }
345
- function Be(e, a) {
346
- K.call(this, e), this.data = a.data, this.lastEventId = a.lastEventId;
347
- }
348
- Be.prototype = Object.create(K.prototype);
349
- function he(e, a) {
350
- K.call(this, e), this.status = a.status, this.statusText = a.statusText, this.headers = a.headers;
351
- }
352
- he.prototype = Object.create(K.prototype);
353
- function ze(e, a) {
354
- K.call(this, e), this.error = a.error;
355
- }
356
- ze.prototype = Object.create(K.prototype);
357
- var ye = -1, W = 0, Z = 1, oe = 2, ge = -1, x = 0, me = 1, He = 2, Lt = 3, Mt = /^text\/event\-stream(;.*)?$/i, Nt = 1e3, Dt = 18e6, Se = function(e, a) {
358
- var i = e == null ? a : parseInt(e, 10);
359
- return i !== i && (i = a), we(i);
360
- }, we = function(e) {
361
- return Math.min(Math.max(e, Nt), Dt);
362
- }, ee = function(e, a, i) {
363
- try {
364
- typeof a == "function" && a.call(e, i);
365
- } catch (n) {
366
- Fe(n);
367
- }
368
- };
369
- function U(e, a) {
370
- ae.call(this), a = a || {}, this.onopen = void 0, this.onmessage = void 0, this.onerror = void 0, this.url = void 0, this.readyState = void 0, this.withCredentials = void 0, this.headers = void 0, this._close = void 0, Gt(this, e, a);
371
- }
372
- function qt() {
373
- return d != null && "withCredentials" in d.prototype || m == null ? new d() : new m();
374
- }
375
- var Ut = Q != null && N != null && "body" in N.prototype;
376
- function Gt(e, a, i) {
377
- a = String(a);
378
- var n = !!i.withCredentials, l = i.lastEventIdQueryParameterName || "lastEventId", u = we(1e3), p = Se(i.heartbeatTimeout, 45e3), T = "", h = u, g = !1, w = 0, f = i.headers || {}, b = i.Transport, F = Ut && b == null ? void 0 : new $(b != null ? new b() : qt()), ie = b != null && typeof b != "string" ? new b() : F == null ? new Qe() : new Ue(), R = void 0, j = 0, G = ye, te = "", fe = "", B = "", pe = "", O = x, Te = 0, J = 0, Qt = function(A, E, L, M) {
379
- if (G === W) if (A === 200 && L != null && Mt.test(L)) {
380
- G = Z, g = Date.now(), h = u, e.readyState = Z;
381
- var C = new he("open", {
382
- status: A,
383
- statusText: E,
384
- headers: M
385
- });
386
- e.dispatchEvent(C), ee(e, e.onopen, C);
387
- } else {
388
- A !== 200 ? (E && (E = E.replace(/\s+/g, " ")), "" + A + E) : "" + (L == null ? "-" : L.replace(/\s+/g, " ")), be();
389
- var C = new he("error", {
390
- status: A,
391
- statusText: E,
392
- headers: M
393
- });
394
- e.dispatchEvent(C), ee(e, e.onerror, C);
395
- }
396
- }, Ft = function(A) {
397
- if (G === Z) {
398
- for (var E = -1, L = 0; L < A.length; L += 1) {
399
- var M = A.charCodeAt(L);
400
- (M === 10 || M === 13) && (E = L);
401
- }
402
- var C = (E !== -1 ? pe : "") + A.slice(0, E + 1);
403
- pe = (E === -1 ? pe : "") + A.slice(E + 1), A !== "" && (g = Date.now(), w += A.length);
404
- for (var _ = 0; _ < C.length; _ += 1) {
405
- var M = C.charCodeAt(_);
406
- if (O === ge && M === 10) O = x;
407
- else if (O === ge && (O = x), M === 13 || M === 10) {
408
- if (O !== x) {
409
- O === me && (J = _ + 1);
410
- var z = C.slice(Te, J - 1), H = C.slice(J + (J < _ && C.charCodeAt(J) === 32 ? 1 : 0), _);
411
- z === "data" ? (te += `
412
- `, te += H) : z === "id" ? fe = H : z === "event" ? B = H : z === "retry" ? (u = Se(H, u), h = u) : z === "heartbeatTimeout" && (p = Se(H, p), j !== 0 && (c(j), j = s(function() {
413
- se();
414
- }, p)));
415
- }
416
- if (O === x) {
417
- if (te !== "") {
418
- T = fe, B === "" && (B = "message");
419
- var re = new Be(B, {
420
- data: te.slice(1),
421
- lastEventId: fe
422
- });
423
- if (e.dispatchEvent(re), B === "open" ? ee(e, e.onopen, re) : B === "message" ? ee(e, e.onmessage, re) : B === "error" && ee(e, e.onerror, re), G === oe) return;
424
- }
425
- te = "", B = "";
426
- }
427
- O = M === 13 ? ge : x;
428
- } else O === x && (Te = _, O = me), O === me ? M === 58 && (J = _ + 1, O = He) : O === He && (O = Lt);
429
- }
430
- }
431
- }, We = function(A) {
432
- if (G === Z || G === W) {
433
- G = ye, j !== 0 && (c(j), j = 0), j = s(function() {
434
- se();
435
- }, h), h = we(Math.min(u * 16, h * 2)), e.readyState = W;
436
- var E = new ze("error", { error: A });
437
- e.dispatchEvent(E), ee(e, e.onerror, E);
438
- }
439
- }, be = function() {
440
- G = oe, R != null && (R.abort(), R = void 0), j !== 0 && (c(j), j = 0), e.readyState = oe;
441
- }, se = function() {
442
- if (j = 0, G !== ye) {
443
- if (!g && R != null) We(new Error("No activity within " + p + " milliseconds. " + (G === W ? "No response received." : w + " chars received.") + " Reconnecting.")), R != null && (R.abort(), R = void 0);
444
- else {
445
- var A = Math.max((g || Date.now()) + p - Date.now(), 1);
446
- g = !1, j = s(function() {
447
- se();
448
- }, A);
449
- }
450
- return;
451
- }
452
- g = !1, w = 0, j = s(function() {
453
- se();
454
- }, p), G = W, te = "", B = "", fe = T, pe = "", Te = 0, J = 0, O = x;
455
- var E = a;
456
- if (a.slice(0, 5) !== "data:" && a.slice(0, 5) !== "blob:" && T !== "") {
457
- var L = a.indexOf("?");
458
- E = L === -1 ? a : a.slice(0, L + 1) + a.slice(L + 1).replace(/(?:^|&)([^=&]*)(?:=[^&]*)?/g, function(H, re) {
459
- return re === l ? "" : H;
460
- }), E += (a.indexOf("?") === -1 ? "?" : "&") + l + "=" + encodeURIComponent(T);
461
- }
462
- var M = e.withCredentials, C = {};
463
- C.Accept = "text/event-stream";
464
- var _ = e.headers;
465
- if (_ != null) for (var z in _) Object.prototype.hasOwnProperty.call(_, z) && (C[z] = _[z]);
466
- try {
467
- R = ie.open(F, Qt, Ft, We, E, M, C);
468
- } catch (H) {
469
- throw be(), H;
470
- }
471
- };
472
- e.url = a, e.readyState = W, e.withCredentials = n, e.headers = f, e._close = be, se();
473
- }
474
- U.prototype = Object.create(ae.prototype), U.prototype.CONNECTING = W, U.prototype.OPEN = Z, U.prototype.CLOSED = oe, U.prototype.close = function() {
475
- this._close();
476
- }, U.CONNECTING = W, U.OPEN = Z, U.CLOSED = oe, U.prototype.withCredentials = void 0;
477
- var ke = P;
478
- d != null && (P == null || !("withCredentials" in P.prototype)) && (ke = U), (function(e) {
479
- if (typeof r == "object" && typeof r.exports == "object") {
480
- var a = e(t);
481
- a !== void 0 && (r.exports = a);
482
- } else typeof define == "function" && define.amd ? define(["exports"], e) : e(o);
483
- })(function(e) {
484
- e.EventSourcePolyfill = U, e.NativeEventSource = P, e.EventSource = ke;
485
- });
486
- })(typeof globalThis > "u" ? typeof window < "u" ? window : typeof self < "u" ? self : t : globalThis);
487
- })), Ke = Oe();
488
- function Ze({ candidates: t, headers: r, createEventSource: o, onMessage: s, onError: c }) {
489
- const d = t.filter(Boolean);
490
- let m = !1, S = null;
491
- const P = () => {
492
- S?.close(), S = null;
493
- }, I = (k) => {
494
- if (m) return;
495
- const Q = d[k];
496
- if (!Q) {
497
- c?.(new Error("Failed to connect to EventSource through proxy chain"));
498
- return;
499
- }
500
- P();
501
- const N = o(Q, { headers: r });
502
- S = N, N.onmessage = (D) => {
503
- m || S !== N || s(D);
504
- }, N.onerror = (D) => {
505
- if (!(m || S !== N)) {
506
- if (P(), k + 1 < d.length) {
507
- I(k + 1);
508
- return;
509
- }
510
- c?.(D);
511
- }
512
- };
513
- };
514
- return I(0), { close() {
515
- m = !0, P();
516
- } };
517
- }
518
- var et = "https://api.unsplash.com", tt = "https://api.giphy.com/v1/gifs";
519
- function ne(t) {
520
- return { error: t instanceof Error ? t : new Error(String(t)) };
521
- }
522
- async function ue(t) {
523
- if (!t.ok) throw new Error(`Request failed with status ${t.status}`);
524
- const r = await t.text();
525
- try {
526
- return r ? JSON.parse(r) : null;
527
- } catch (o) {
528
- throw o;
529
- }
530
- }
531
- function rt(t) {
532
- return t && Array.isArray(t.results) ? t : t?.data && Array.isArray(t.data.results) ? t.data : t?.response && Array.isArray(t.response.results) ? t.response : {
533
- ...t || {},
534
- results: []
535
- };
536
- }
537
- var Ce = v.createApi({
538
- reducerPath: "imageApi",
539
- baseQuery: void 0,
540
- endpoints: (t) => ({
541
- getImageInfo: t.query({ queryFn: async function(r, o) {
542
- try {
543
- const s = o.getState().configSlice?.config?.imageInfoToolUrl || "https://scr.useblocks.io/imageinfo";
544
- return { data: await ue(await fetch(`${s}?url=${encodeURIComponent(r)}`)) };
545
- } catch (s) {
546
- return ne(s);
547
- }
548
- } }),
549
- getSearchImage: t.query({ queryFn: async function({ query: r, page: o }, s) {
550
- const c = r.keywords.replace(/[^\w\d\sа-яёА-ЯЁ]|_/g, "").replace(/[\s_-]+/g, " ");
551
- try {
552
- const d = s.getState().configSlice?.config, m = v.di.getInstance(s, v.SECURITY_MODULE_ID) !== void 0, S = new URL(`${et}/search/photos`);
553
- return S.searchParams.set("client_id", "S5iNcLqYgRBIOLQdluHdTsCJnjCvahzhG7JfYQOrV7o"), S.searchParams.set("lang", "ru"), S.searchParams.set("per_page", "18"), S.searchParams.set("query", c), S.searchParams.set("page", String(o)), r.color !== "" && S.searchParams.set("color", r.color), r.orientation !== "" && S.searchParams.set("orientation", r.orientation), { data: rt(await ue(await v.fetchWithResourceProxy(S.toString(), {
554
- config: d,
555
- standalone: m,
556
- resourceType: "stockImages",
557
- intent: "metadata"
558
- }))) };
559
- } catch (d) {
560
- return ne(d);
561
- }
562
- } }),
563
- getUnsplashImage: t.query({ queryFn: async function(r, o) {
564
- try {
565
- const s = o.getState().configSlice?.config, c = v.di.getInstance(o, v.SECURITY_MODULE_ID) !== void 0, d = new URL(r);
566
- return d.searchParams.set("client_id", "S5iNcLqYgRBIOLQdluHdTsCJnjCvahzhG7JfYQOrV7o"), { data: await ue(await v.fetchWithResourceProxy(d.toString(), {
567
- config: s,
568
- standalone: c,
569
- resourceType: "stockImages",
570
- intent: "metadata"
571
- })) };
572
- } catch (s) {
573
- return ne(s);
574
- }
575
- } }),
576
- sendAiImageRequest: t.query({ queryFn: async function({ body: r }, o) {
577
- try {
578
- return await v.getClient(o).aiGenerator.ai_create(r);
579
- } catch (s) {
580
- throw new Error(s);
581
- }
582
- } }),
583
- getAiImage: t.query({ queryFn: async function(r, o) {
584
- try {
585
- return await v.getClient(o).aiGenerator.ai_status_list(r);
586
- } catch (s) {
587
- return ne(s);
588
- }
589
- } }),
590
- getAiImageSSE: t.query({
591
- queryFn: (r) => ({ data: [] }),
592
- async onCacheEntryAdded({ task_id: r, entity_id: o, setError: s }, c) {
593
- const { updateCachedData: d, cacheEntryRemoved: m } = c, S = v.getClient(c).baseUrl || v.normalizeBaseUrl("https://app.useblocks.io/api"), P = c.getState().configSlice?.config, I = v.di.getInstance(c, v.SECURITY_MODULE_ID) !== void 0, k = v.PLUGIN.isPlugin ? await v.di.getInstance(c, ce) : v.api.get(v.APP_COOKIES.em_token), Q = k ? { Authorization: `Bearer ${k}` } : {}, N = `${S}/ai-generator/v1/ai-status?entity_id=${o}&stream=1&task_id=${r}`, D = v.resolveBackendProxyRequestCandidates(N, {
594
- config: P,
595
- method: "GET",
596
- requestType: "ai",
597
- standalone: I
598
- }), V = Ze({
599
- candidates: D.length > 0 ? D : [N],
600
- headers: Q,
601
- createEventSource: (X, Y) => new Ke.EventSourcePolyfill(X, Y),
602
- onMessage: (X) => {
603
- const Y = JSON.parse(X.data);
604
- d((le) => {
605
- le.push(Y);
606
- }), Y.progress === 100 && V.close();
607
- },
608
- onError: () => {
609
- V.close();
610
- }
611
- });
612
- await m, V.close();
613
- }
614
- }),
615
- getSearchGif: t.query({ queryFn: async function({ query: r, page: o }, s) {
616
- const c = r.keywords.replace(/[^\w\d\sа-яёА-ЯЁ]|_/g, "").replace(/[\s_-]+/g, " ");
617
- try {
618
- const d = s.getState().configSlice?.config, m = v.di.getInstance(s, v.SECURITY_MODULE_ID) !== void 0;
619
- return { data: await ue(await v.fetchWithResourceProxy(`${tt}/search?api_key=Nh77eBlPeMn1ed9MBAvL542NUGeNO26F&q=${encodeURIComponent(c)}&limit=25&offset=${o}&lang=en`, {
620
- config: d,
621
- standalone: m,
622
- resourceType: "generic",
623
- intent: "metadata"
624
- })) };
625
- } catch (d) {
626
- return ne(d);
627
- }
628
- } })
629
- })
630
- }), { useLazyGetImageInfoQuery: nt, useGetImageInfoQuery: zt, useGetSearchImageQuery: Ht, useLazyGetSearchImageQuery: at, useSendAiImageRequestQuery: kt, useLazySendAiImageRequestQuery: ot, useGetAiImageQuery: Wt, useLazyGetAiImageQuery: xt, useGetUnsplashImageQuery: Xt, useLazyGetUnsplashImageQuery: it, useGetSearchGifQuery: $t, useLazyGetSearchGifQuery: st, useGetAiImageSSEQuery: Jt, useLazyGetAiImageSSEQuery: ct } = Ce, ut = "https://app.useblocks.io/api".replaceAll(/[\\/]$/g, ""), ve = "wp-json/limits/v1", dt = "wp-json/subscription/v2", Re = v.createApi({
631
- reducerPath: "limitsApi",
632
- baseQuery: v.fetchBaseQueryApp({ baseUrl: ut }),
633
- tagTypes: [
634
- "LimitsStats",
635
- "LimitsWarnings",
636
- "SubscriptionMe"
637
- ],
638
- endpoints: (t) => ({
639
- getLimitsStats: t.query({
640
- query: () => ({
641
- url: `${ve}/stats`,
642
- method: "GET"
643
- }),
644
- providesTags: ["LimitsStats"]
645
- }),
646
- getLimitsStatsByType: t.query({
647
- query: (r) => ({
648
- url: `${ve}/stats/${r}`,
649
- method: "GET"
650
- }),
651
- providesTags: (r, o, s) => [{
652
- type: "LimitsStats",
653
- id: s
654
- }]
655
- }),
656
- getLimitsWarnings: t.query({
657
- query: () => ({
658
- url: `${ve}/warnings`,
659
- method: "GET"
660
- }),
661
- providesTags: ["LimitsWarnings"]
662
- }),
663
- getSubscriptionMeV2: t.query({
664
- query: () => ({
665
- url: `${dt}/me`,
666
- method: "GET"
667
- }),
668
- providesTags: ["SubscriptionMe"]
669
- }),
670
- invalidatePlanCache: t.mutation({ queryFn: async (r, o) => v.v2ResultOf(await v.getClientV2(o).billing.planInvalidateCreate()) })
671
- })
672
- }), { useGetLimitsStatsQuery: lt, useLazyGetLimitsStatsQuery: Vt, useGetLimitsStatsByTypeQuery: Yt, useLazyGetLimitsStatsByTypeQuery: ft, useGetLimitsWarningsQuery: pt, useLazyGetLimitsWarningsQuery: Kt, useGetSubscriptionMeV2Query: Zt, useLazyGetSubscriptionMeV2Query: er, useInvalidatePlanCacheMutation: vt } = Re, je = new URLSearchParams(window.location.search), Le = je.get("tag"), ht = je.get("folder"), yt = v.createState({
673
- activeModal: "",
674
- switchToPlanRequestTitle: "",
675
- secondModal: "",
676
- projectsTotal: "",
677
- projectsTotalPages: "",
678
- folders: [],
679
- activeTagId: Le || null,
680
- activeFolderId: ht || (Le ? null : "all"),
681
- activeIntegration: null,
682
- addNewProjectInitialTitle: null
683
- }), de = "projectsPageSlice", Me = v.createSlice({
684
- name: de,
685
- initialState: yt,
686
- reducers: {
687
- openModal(t, r) {
688
- t.activeModal = r.payload;
689
- },
690
- openAddNewProjectModal(t, r) {
691
- t.activeModal = v.MODALS.ADD_NEW_PROJECT_MODAL, t.addNewProjectInitialTitle = r.payload ?? null;
692
- },
693
- setSwitchToPlanRequestTitle(t, r) {
694
- t.switchToPlanRequestTitle = typeof r.payload == "string" ? r.payload : "";
695
- },
696
- closeModal(t) {
697
- t.activeModal = "", t.activeIntegration = null, t.addNewProjectInitialTitle = null, t.switchToPlanRequestTitle = "";
698
- },
699
- openSecondModal(t, r) {
700
- t.secondModal = r.payload;
701
- },
702
- closeSecondModal(t) {
703
- t.secondModal = "";
704
- },
705
- setFolders(t, { payload: r }) {
706
- t.folders = r;
707
- },
708
- setActiveTagId(t, { payload: r }) {
709
- t.activeTagId = r;
710
- },
711
- setActiveIntegration(t, r) {
712
- t.activeIntegration = r.payload;
713
- }
714
- },
715
- extraReducers: (t) => {
716
- t.addMatcher(v.projectsApi.endpoints.getProjects.matchFulfilled, (r, o) => {
717
- const s = o.meta, c = s.baseQueryMeta, d = s.projectsListPagination ?? c?.projectsListPagination;
718
- if (d != null && typeof d.total == "number" && Number.isFinite(d.total) && d.total >= 0) {
719
- r.projectsTotal = String(d.total), r.projectsTotalPages = String(typeof d.totalPages == "number" && Number.isFinite(d.totalPages) ? d.totalPages : "");
720
- return;
721
- }
722
- const m = c?.response?.headers?.get?.("X-WP-Total"), S = c?.response?.headers?.get?.("X-WP-TotalPages");
723
- r.projectsTotal = m ?? "", r.projectsTotalPages = S ?? "";
724
- }), t.addMatcher(v.taxonomiesApi.endpoints.getTerms.matchFulfilled, (r, { meta: o, payload: s }) => {
725
- const c = o.arg.originalArgs?.kind;
726
- (c === "folder" || c === "blockfolder") && (r.folders = s);
727
- });
728
- }
729
- }), { openModal: gt, openAddNewProjectModal: tr, setSwitchToPlanRequestTitle: mt, closeModal: St, openSecondModal: wt, closeSecondModal: Tt, setFolders: rr, setActiveTagId: nr, setActiveIntegration: ar } = Me.actions, bt = (t) => t[de].activeModal, Et = (t) => t[de].secondModal, Pt = (t) => t[de].projectsTotal, At = 3, It = /^(.+\.[a-zA-Z0-9]{1,8})\?[^?#]*$/;
730
- function _t(t) {
731
- let r = t;
732
- for (let o = 0; o < At; o++) try {
733
- const s = decodeURIComponent(r);
734
- if (s === r) break;
735
- r = s;
736
- } catch {
737
- break;
738
- }
739
- return r.normalize("NFC");
740
- }
741
- function Ot(t) {
742
- const r = t.match(It);
743
- return r ? r[1] : t;
744
- }
745
- function Ct(t) {
746
- if (/^https?:\/\//i.test(t)) return new URL(t).pathname.split("/").filter(Boolean).pop();
747
- if (t.startsWith("//")) return new URL(t, "https://placeholder.invalid").pathname.split("/").filter(Boolean).pop();
748
- }
749
- function Ne(t) {
750
- const r = t.replaceAll("\\", "/").trim();
751
- if (!r) return r;
752
- let o;
753
- try {
754
- o = Ct(r);
755
- } catch {}
756
- if (!o) {
757
- o = Ot(r.split("/").pop() ?? "");
758
- const s = o.indexOf("#");
759
- s >= 0 && (o = o.slice(0, s));
760
- }
761
- return _t(o);
762
- }
763
- function Rt(t) {
764
- const r = t.trim();
765
- if (r) {
766
- if (!(/^https?:\/\//i.test(r) || r.startsWith("//"))) try {
767
- new URL(r);
768
- } catch {
769
- return;
770
- }
771
- return Ne(r) || void 0;
772
- }
773
- }
774
- Object.defineProperty(y, "OAuthMixin", {
775
- enumerable: !0,
776
- get: function() {
777
- return Ye;
778
- }
779
- }), Object.defineProperty(y, "TOKEN_ID", {
780
- enumerable: !0,
781
- get: function() {
782
- return ce;
783
- }
784
- }), Object.defineProperty(y, "closeModal", {
785
- enumerable: !0,
786
- get: function() {
787
- return St;
788
- }
789
- }), Object.defineProperty(y, "closeSecondModal", {
790
- enumerable: !0,
791
- get: function() {
792
- return Tt;
793
- }
794
- }), Object.defineProperty(y, "combineMixins", {
795
- enumerable: !0,
796
- get: function() {
797
- return Xe;
798
- }
799
- }), Object.defineProperty(y, "decodeFileNameFromPath", {
800
- enumerable: !0,
801
- get: function() {
802
- return Ne;
803
- }
804
- }), Object.defineProperty(y, "decodeFileNameFromUrl", {
805
- enumerable: !0,
806
- get: function() {
807
- return Rt;
808
- }
809
- }), Object.defineProperty(y, "decodeJwt", {
810
- enumerable: !0,
811
- get: function() {
812
- return Ae;
813
- }
814
- }), Object.defineProperty(y, "defineMixin", {
815
- enumerable: !0,
816
- get: function() {
817
- return Pe;
818
- }
819
- }), Object.defineProperty(y, "imageApi", {
820
- enumerable: !0,
821
- get: function() {
822
- return Ce;
823
- }
824
- }), Object.defineProperty(y, "limitsApi", {
825
- enumerable: !0,
826
- get: function() {
827
- return Re;
828
- }
829
- }), Object.defineProperty(y, "openModal", {
830
- enumerable: !0,
831
- get: function() {
832
- return gt;
833
- }
834
- }), Object.defineProperty(y, "openSecondModal", {
835
- enumerable: !0,
836
- get: function() {
837
- return wt;
838
- }
839
- }), Object.defineProperty(y, "projectsPageSlice", {
840
- enumerable: !0,
841
- get: function() {
842
- return Me;
843
- }
844
- }), Object.defineProperty(y, "recreateTokenProvider", {
845
- enumerable: !0,
846
- get: function() {
847
- return _e;
848
- }
849
- }), Object.defineProperty(y, "require_eventsource", {
850
- enumerable: !0,
851
- get: function() {
852
- return Oe;
853
- }
854
- }), Object.defineProperty(y, "selectActiveModal", {
855
- enumerable: !0,
856
- get: function() {
857
- return bt;
858
- }
859
- }), Object.defineProperty(y, "selectProjectsTotal", {
860
- enumerable: !0,
861
- get: function() {
862
- return Pt;
863
- }
864
- }), Object.defineProperty(y, "selectSecondModal", {
865
- enumerable: !0,
866
- get: function() {
867
- return Et;
868
- }
869
- }), Object.defineProperty(y, "setSwitchToPlanRequestTitle", {
870
- enumerable: !0,
871
- get: function() {
872
- return mt;
873
- }
874
- }), Object.defineProperty(y, "useGetLimitsStatsQuery", {
875
- enumerable: !0,
876
- get: function() {
877
- return lt;
878
- }
879
- }), Object.defineProperty(y, "useGetLimitsWarningsQuery", {
880
- enumerable: !0,
881
- get: function() {
882
- return pt;
883
- }
884
- }), Object.defineProperty(y, "useInvalidatePlanCacheMutation", {
885
- enumerable: !0,
886
- get: function() {
887
- return vt;
888
- }
889
- }), Object.defineProperty(y, "useLazyGetAiImageSSEQuery", {
890
- enumerable: !0,
891
- get: function() {
892
- return ct;
893
- }
894
- }), Object.defineProperty(y, "useLazyGetImageInfoQuery", {
895
- enumerable: !0,
896
- get: function() {
897
- return nt;
898
- }
899
- }), Object.defineProperty(y, "useLazyGetLimitsStatsByTypeQuery", {
900
- enumerable: !0,
901
- get: function() {
902
- return ft;
903
- }
904
- }), Object.defineProperty(y, "useLazyGetSearchGifQuery", {
905
- enumerable: !0,
906
- get: function() {
907
- return st;
908
- }
909
- }), Object.defineProperty(y, "useLazyGetSearchImageQuery", {
910
- enumerable: !0,
911
- get: function() {
912
- return at;
913
- }
914
- }), Object.defineProperty(y, "useLazyGetUnsplashImageQuery", {
915
- enumerable: !0,
916
- get: function() {
917
- return it;
918
- }
919
- }), Object.defineProperty(y, "useLazySendAiImageRequestQuery", {
920
- enumerable: !0,
921
- get: function() {
922
- return ot;
923
- }
924
- });
925
- });