useblocks 1.1.45 → 1.1.49

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