@terminals-tech/sdk 1.0.0-rc.1 → 1.0.0-rc.2

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 (79) hide show
  1. package/dist/WebContainerManager-SHXC5VKI.js +22 -0
  2. package/dist/browser-http-client-ZQLDWZMU.js +317 -0
  3. package/dist/cache-VKYSQRXX.js +45 -0
  4. package/dist/capabilities-MIPUMBLL.js +96 -0
  5. package/dist/chunk-2ESYSVXG.js +48 -0
  6. package/dist/chunk-2WTYE4SW.js +190 -0
  7. package/dist/chunk-3CEM77QZ.js +474 -0
  8. package/dist/chunk-3LFMIVJM.js +40 -0
  9. package/dist/chunk-ABCK4FWN.js +136 -0
  10. package/dist/chunk-AFDUOYHD.js +2060 -0
  11. package/dist/chunk-BCOQMFKT.js +265 -0
  12. package/dist/chunk-BKB3MD5Y.js +723 -0
  13. package/dist/chunk-BYXBJQAS.js +0 -0
  14. package/dist/chunk-DKFJIILR.js +9798 -0
  15. package/dist/chunk-EXI3LJVJ.js +51 -0
  16. package/dist/chunk-FOXUEYWK.js +42 -0
  17. package/dist/chunk-GJWAJAX3.js +173 -0
  18. package/dist/chunk-H3POJCFA.js +333 -0
  19. package/dist/chunk-KHR7ZYCX.js +4034 -0
  20. package/dist/chunk-NTMBOESX.js +152 -0
  21. package/dist/chunk-OSSRZOGC.js +190 -0
  22. package/dist/chunk-PUZ2S62E.js +977 -0
  23. package/dist/chunk-PWAHFID5.js +381 -0
  24. package/dist/chunk-Q2VI6ICE.js +188 -0
  25. package/dist/chunk-Q4B7YS7T.js +557 -0
  26. package/dist/chunk-QJFKEQHF.js +6460 -0
  27. package/dist/chunk-QWXPVB2L.js +320 -0
  28. package/dist/chunk-QWZRZKLZ.js +896 -0
  29. package/dist/chunk-SHPGIVDH.js +5521 -0
  30. package/dist/chunk-TSQ3BGLA.js +11945 -0
  31. package/dist/chunk-UJDUQNE2.js +79 -0
  32. package/dist/chunk-UKVUPKZP.js +296 -0
  33. package/dist/chunk-VZA2NUH3.js +118 -0
  34. package/dist/chunk-WGBCRNMB.js +1817 -0
  35. package/dist/chunk-WU4OTGJE.js +752 -0
  36. package/dist/chunk-XPJ63Y6T.js +70 -0
  37. package/dist/chunk-Y2EULKA2.js +172 -0
  38. package/dist/chunk-YJEZWCYV.js +94 -0
  39. package/dist/chunk-ZVO47SQV.js +150 -0
  40. package/dist/container-lite-KQX3NMPY.js +327 -0
  41. package/dist/core-H2UUDATO.js +146 -0
  42. package/dist/crypto-D4LMI2RN.js +45 -0
  43. package/dist/db-BWC2GGBN.js +50 -0
  44. package/dist/demo-VXMGMJNK.js +87 -0
  45. package/dist/diagnostics-6RQTBR6I.js +113 -0
  46. package/dist/dist-OPDCWARF.js +727 -0
  47. package/dist/dist-VXJEKX3T.js +2441 -0
  48. package/dist/dist-VYGJXGUS.js +1008 -0
  49. package/dist/embeddings-7QXTXUMC.js +15 -0
  50. package/dist/embeddings-MAEWWUHW.js +9 -0
  51. package/dist/graph-RKMNE2X5.js +36 -0
  52. package/dist/hvm-DRQK2MUT.js +126 -0
  53. package/dist/index.cjs +11706 -4004
  54. package/dist/index.d.cts +1299 -1339
  55. package/dist/index.d.ts +1299 -1339
  56. package/dist/index.js +189 -7938
  57. package/dist/mcp-NK34ZNM5.js +101 -0
  58. package/dist/mcp-client-service-browser-SGB2K3VZ.js +14 -0
  59. package/dist/neuro-state-XHRGIRVO.js +498 -0
  60. package/dist/nodes-DXKYDTVO.js +224 -0
  61. package/dist/package-EXUIU2RL.js +93 -0
  62. package/dist/package-VGL7HYTO.js +106 -0
  63. package/dist/package-XHMLOAQ4.js +98 -0
  64. package/dist/pg-events-QJAM2HIP.js +15 -0
  65. package/dist/pgliteService-IUGNNOVU.js +258 -0
  66. package/dist/policy-IRJCM6FS.js +13 -0
  67. package/dist/registry-BL3TDQDB.js +26 -0
  68. package/dist/registry-FW63E7FE.js +16 -0
  69. package/dist/registry-ZQ2IBLF6.js +9 -0
  70. package/dist/scheduler-H6Q53IMI.js +122 -0
  71. package/dist/secret-store-H7273UIT.js +18 -0
  72. package/dist/server-7DM74VFW.js +18 -0
  73. package/dist/skills-KLTTT2RM.js +6375 -0
  74. package/dist/stack-CHDAFU2S.js +103 -0
  75. package/dist/storage-L7MWNSPG.js +13 -0
  76. package/dist/supabaseService-6AYP2VY3.js +476 -0
  77. package/dist/topology-CIWWNVAN.js +13 -0
  78. package/dist/webcontainer-3LDJVIIL.js +281 -0
  79. package/package.json +2 -2
@@ -0,0 +1,896 @@
1
+ import {
2
+ createClient,
3
+ init_dist
4
+ } from "./chunk-TSQ3BGLA.js";
5
+ import {
6
+ __commonJS,
7
+ __toESM
8
+ } from "./chunk-2ESYSVXG.js";
9
+
10
+ // ../../node_modules/cookie/dist/index.js
11
+ var require_dist = __commonJS({
12
+ "../../node_modules/cookie/dist/index.js"(exports) {
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.parseCookie = parseCookie;
16
+ exports.parse = parseCookie;
17
+ exports.stringifyCookie = stringifyCookie;
18
+ exports.stringifySetCookie = stringifySetCookie;
19
+ exports.serialize = stringifySetCookie;
20
+ exports.parseSetCookie = parseSetCookie;
21
+ exports.stringifySetCookie = stringifySetCookie;
22
+ exports.serialize = stringifySetCookie;
23
+ var cookieNameRegExp = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/;
24
+ var cookieValueRegExp = /^[\u0021-\u003A\u003C-\u007E]*$/;
25
+ var domainValueRegExp = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i;
26
+ var pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/;
27
+ var maxAgeRegExp = /^-?\d+$/;
28
+ var __toString = Object.prototype.toString;
29
+ var NullObject = /* @__PURE__ */ (() => {
30
+ const C = function() {
31
+ };
32
+ C.prototype = /* @__PURE__ */ Object.create(null);
33
+ return C;
34
+ })();
35
+ function parseCookie(str, options) {
36
+ const obj = new NullObject();
37
+ const len = str.length;
38
+ if (len < 2)
39
+ return obj;
40
+ const dec = options?.decode || decode;
41
+ let index = 0;
42
+ do {
43
+ const eqIdx = eqIndex(str, index, len);
44
+ if (eqIdx === -1)
45
+ break;
46
+ const endIdx = endIndex(str, index, len);
47
+ if (eqIdx > endIdx) {
48
+ index = str.lastIndexOf(";", eqIdx - 1) + 1;
49
+ continue;
50
+ }
51
+ const key = valueSlice(str, index, eqIdx);
52
+ if (obj[key] === void 0) {
53
+ obj[key] = dec(valueSlice(str, eqIdx + 1, endIdx));
54
+ }
55
+ index = endIdx + 1;
56
+ } while (index < len);
57
+ return obj;
58
+ }
59
+ function stringifyCookie(cookie, options) {
60
+ const enc = options?.encode || encodeURIComponent;
61
+ const cookieStrings = [];
62
+ for (const name of Object.keys(cookie)) {
63
+ const val = cookie[name];
64
+ if (val === void 0)
65
+ continue;
66
+ if (!cookieNameRegExp.test(name)) {
67
+ throw new TypeError(`cookie name is invalid: ${name}`);
68
+ }
69
+ const value = enc(val);
70
+ if (!cookieValueRegExp.test(value)) {
71
+ throw new TypeError(`cookie val is invalid: ${val}`);
72
+ }
73
+ cookieStrings.push(`${name}=${value}`);
74
+ }
75
+ return cookieStrings.join("; ");
76
+ }
77
+ function stringifySetCookie(_name, _val, _opts) {
78
+ const cookie = typeof _name === "object" ? _name : { ..._opts, name: _name, value: String(_val) };
79
+ const options = typeof _val === "object" ? _val : _opts;
80
+ const enc = options?.encode || encodeURIComponent;
81
+ if (!cookieNameRegExp.test(cookie.name)) {
82
+ throw new TypeError(`argument name is invalid: ${cookie.name}`);
83
+ }
84
+ const value = cookie.value ? enc(cookie.value) : "";
85
+ if (!cookieValueRegExp.test(value)) {
86
+ throw new TypeError(`argument val is invalid: ${cookie.value}`);
87
+ }
88
+ let str = cookie.name + "=" + value;
89
+ if (cookie.maxAge !== void 0) {
90
+ if (!Number.isInteger(cookie.maxAge)) {
91
+ throw new TypeError(`option maxAge is invalid: ${cookie.maxAge}`);
92
+ }
93
+ str += "; Max-Age=" + cookie.maxAge;
94
+ }
95
+ if (cookie.domain) {
96
+ if (!domainValueRegExp.test(cookie.domain)) {
97
+ throw new TypeError(`option domain is invalid: ${cookie.domain}`);
98
+ }
99
+ str += "; Domain=" + cookie.domain;
100
+ }
101
+ if (cookie.path) {
102
+ if (!pathValueRegExp.test(cookie.path)) {
103
+ throw new TypeError(`option path is invalid: ${cookie.path}`);
104
+ }
105
+ str += "; Path=" + cookie.path;
106
+ }
107
+ if (cookie.expires) {
108
+ if (!isDate(cookie.expires) || !Number.isFinite(cookie.expires.valueOf())) {
109
+ throw new TypeError(`option expires is invalid: ${cookie.expires}`);
110
+ }
111
+ str += "; Expires=" + cookie.expires.toUTCString();
112
+ }
113
+ if (cookie.httpOnly) {
114
+ str += "; HttpOnly";
115
+ }
116
+ if (cookie.secure) {
117
+ str += "; Secure";
118
+ }
119
+ if (cookie.partitioned) {
120
+ str += "; Partitioned";
121
+ }
122
+ if (cookie.priority) {
123
+ const priority = typeof cookie.priority === "string" ? cookie.priority.toLowerCase() : void 0;
124
+ switch (priority) {
125
+ case "low":
126
+ str += "; Priority=Low";
127
+ break;
128
+ case "medium":
129
+ str += "; Priority=Medium";
130
+ break;
131
+ case "high":
132
+ str += "; Priority=High";
133
+ break;
134
+ default:
135
+ throw new TypeError(`option priority is invalid: ${cookie.priority}`);
136
+ }
137
+ }
138
+ if (cookie.sameSite) {
139
+ const sameSite = typeof cookie.sameSite === "string" ? cookie.sameSite.toLowerCase() : cookie.sameSite;
140
+ switch (sameSite) {
141
+ case true:
142
+ case "strict":
143
+ str += "; SameSite=Strict";
144
+ break;
145
+ case "lax":
146
+ str += "; SameSite=Lax";
147
+ break;
148
+ case "none":
149
+ str += "; SameSite=None";
150
+ break;
151
+ default:
152
+ throw new TypeError(`option sameSite is invalid: ${cookie.sameSite}`);
153
+ }
154
+ }
155
+ return str;
156
+ }
157
+ function parseSetCookie(str, options) {
158
+ const dec = options?.decode || decode;
159
+ const len = str.length;
160
+ const endIdx = endIndex(str, 0, len);
161
+ const eqIdx = eqIndex(str, 0, endIdx);
162
+ const setCookie = eqIdx === -1 ? { name: "", value: dec(valueSlice(str, 0, endIdx)) } : {
163
+ name: valueSlice(str, 0, eqIdx),
164
+ value: dec(valueSlice(str, eqIdx + 1, endIdx))
165
+ };
166
+ let index = endIdx + 1;
167
+ while (index < len) {
168
+ const endIdx2 = endIndex(str, index, len);
169
+ const eqIdx2 = eqIndex(str, index, endIdx2);
170
+ const attr = eqIdx2 === -1 ? valueSlice(str, index, endIdx2) : valueSlice(str, index, eqIdx2);
171
+ const val = eqIdx2 === -1 ? void 0 : valueSlice(str, eqIdx2 + 1, endIdx2);
172
+ switch (attr.toLowerCase()) {
173
+ case "httponly":
174
+ setCookie.httpOnly = true;
175
+ break;
176
+ case "secure":
177
+ setCookie.secure = true;
178
+ break;
179
+ case "partitioned":
180
+ setCookie.partitioned = true;
181
+ break;
182
+ case "domain":
183
+ setCookie.domain = val;
184
+ break;
185
+ case "path":
186
+ setCookie.path = val;
187
+ break;
188
+ case "max-age":
189
+ if (val && maxAgeRegExp.test(val))
190
+ setCookie.maxAge = Number(val);
191
+ break;
192
+ case "expires":
193
+ if (!val)
194
+ break;
195
+ const date = new Date(val);
196
+ if (Number.isFinite(date.valueOf()))
197
+ setCookie.expires = date;
198
+ break;
199
+ case "priority":
200
+ if (!val)
201
+ break;
202
+ const priority = val.toLowerCase();
203
+ if (priority === "low" || priority === "medium" || priority === "high") {
204
+ setCookie.priority = priority;
205
+ }
206
+ break;
207
+ case "samesite":
208
+ if (!val)
209
+ break;
210
+ const sameSite = val.toLowerCase();
211
+ if (sameSite === "lax" || sameSite === "strict" || sameSite === "none") {
212
+ setCookie.sameSite = sameSite;
213
+ }
214
+ break;
215
+ }
216
+ index = endIdx2 + 1;
217
+ }
218
+ return setCookie;
219
+ }
220
+ function endIndex(str, min, len) {
221
+ const index = str.indexOf(";", min);
222
+ return index === -1 ? len : index;
223
+ }
224
+ function eqIndex(str, min, max) {
225
+ const index = str.indexOf("=", min);
226
+ return index < max ? index : -1;
227
+ }
228
+ function valueSlice(str, min, max) {
229
+ let start = min;
230
+ let end = max;
231
+ do {
232
+ const code = str.charCodeAt(start);
233
+ if (code !== 32 && code !== 9)
234
+ break;
235
+ } while (++start < end);
236
+ while (end > start) {
237
+ const code = str.charCodeAt(end - 1);
238
+ if (code !== 32 && code !== 9)
239
+ break;
240
+ end--;
241
+ }
242
+ return str.slice(start, end);
243
+ }
244
+ function decode(str) {
245
+ if (str.indexOf("%") === -1)
246
+ return str;
247
+ try {
248
+ return decodeURIComponent(str);
249
+ } catch (e) {
250
+ return str;
251
+ }
252
+ }
253
+ function isDate(val) {
254
+ return __toString.call(val) === "[object Date]";
255
+ }
256
+ }
257
+ });
258
+
259
+ // ../../node_modules/@supabase/ssr/dist/module/createBrowserClient.js
260
+ init_dist();
261
+
262
+ // ../../node_modules/@supabase/ssr/dist/module/version.js
263
+ var VERSION = "0.8.0";
264
+
265
+ // ../../node_modules/@supabase/ssr/dist/module/utils/helpers.js
266
+ function isBrowser() {
267
+ return typeof window !== "undefined" && typeof window.document !== "undefined";
268
+ }
269
+
270
+ // ../../node_modules/@supabase/ssr/dist/module/utils/constants.js
271
+ var DEFAULT_COOKIE_OPTIONS = {
272
+ path: "/",
273
+ sameSite: "lax",
274
+ httpOnly: false,
275
+ // https://developer.chrome.com/blog/cookie-max-age-expires
276
+ // https://httpwg.org/http-extensions/draft-ietf-httpbis-rfc6265bis.html#name-cookie-lifetime-limits
277
+ maxAge: 400 * 24 * 60 * 60
278
+ };
279
+
280
+ // ../../node_modules/@supabase/ssr/dist/module/utils/chunker.js
281
+ var MAX_CHUNK_SIZE = 3180;
282
+ var CHUNK_LIKE_REGEX = /^(.*)[.](0|[1-9][0-9]*)$/;
283
+ function isChunkLike(cookieName, key) {
284
+ if (cookieName === key) {
285
+ return true;
286
+ }
287
+ const chunkLike = cookieName.match(CHUNK_LIKE_REGEX);
288
+ if (chunkLike && chunkLike[1] === key) {
289
+ return true;
290
+ }
291
+ return false;
292
+ }
293
+ function createChunks(key, value, chunkSize) {
294
+ const resolvedChunkSize = chunkSize ?? MAX_CHUNK_SIZE;
295
+ let encodedValue = encodeURIComponent(value);
296
+ if (encodedValue.length <= resolvedChunkSize) {
297
+ return [{ name: key, value }];
298
+ }
299
+ const chunks = [];
300
+ while (encodedValue.length > 0) {
301
+ let encodedChunkHead = encodedValue.slice(0, resolvedChunkSize);
302
+ const lastEscapePos = encodedChunkHead.lastIndexOf("%");
303
+ if (lastEscapePos > resolvedChunkSize - 3) {
304
+ encodedChunkHead = encodedChunkHead.slice(0, lastEscapePos);
305
+ }
306
+ let valueHead = "";
307
+ while (encodedChunkHead.length > 0) {
308
+ try {
309
+ valueHead = decodeURIComponent(encodedChunkHead);
310
+ break;
311
+ } catch (error) {
312
+ if (error instanceof URIError && encodedChunkHead.at(-3) === "%" && encodedChunkHead.length > 3) {
313
+ encodedChunkHead = encodedChunkHead.slice(0, encodedChunkHead.length - 3);
314
+ } else {
315
+ throw error;
316
+ }
317
+ }
318
+ }
319
+ chunks.push(valueHead);
320
+ encodedValue = encodedValue.slice(encodedChunkHead.length);
321
+ }
322
+ return chunks.map((value2, i) => ({ name: `${key}.${i}`, value: value2 }));
323
+ }
324
+ async function combineChunks(key, retrieveChunk) {
325
+ const value = await retrieveChunk(key);
326
+ if (value) {
327
+ return value;
328
+ }
329
+ let values = [];
330
+ for (let i = 0; ; i++) {
331
+ const chunkName = `${key}.${i}`;
332
+ const chunk = await retrieveChunk(chunkName);
333
+ if (!chunk) {
334
+ break;
335
+ }
336
+ values.push(chunk);
337
+ }
338
+ if (values.length > 0) {
339
+ return values.join("");
340
+ }
341
+ return null;
342
+ }
343
+
344
+ // ../../node_modules/@supabase/ssr/dist/module/utils/base64url.js
345
+ var TO_BASE64URL = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split("");
346
+ var IGNORE_BASE64URL = " \n\r=".split("");
347
+ var FROM_BASE64URL = (() => {
348
+ const charMap = new Array(128);
349
+ for (let i = 0; i < charMap.length; i += 1) {
350
+ charMap[i] = -1;
351
+ }
352
+ for (let i = 0; i < IGNORE_BASE64URL.length; i += 1) {
353
+ charMap[IGNORE_BASE64URL[i].charCodeAt(0)] = -2;
354
+ }
355
+ for (let i = 0; i < TO_BASE64URL.length; i += 1) {
356
+ charMap[TO_BASE64URL[i].charCodeAt(0)] = i;
357
+ }
358
+ return charMap;
359
+ })();
360
+ function stringToBase64URL(str) {
361
+ const base64 = [];
362
+ let queue = 0;
363
+ let queuedBits = 0;
364
+ const emitter = (byte) => {
365
+ queue = queue << 8 | byte;
366
+ queuedBits += 8;
367
+ while (queuedBits >= 6) {
368
+ const pos = queue >> queuedBits - 6 & 63;
369
+ base64.push(TO_BASE64URL[pos]);
370
+ queuedBits -= 6;
371
+ }
372
+ };
373
+ stringToUTF8(str, emitter);
374
+ if (queuedBits > 0) {
375
+ queue = queue << 6 - queuedBits;
376
+ queuedBits = 6;
377
+ while (queuedBits >= 6) {
378
+ const pos = queue >> queuedBits - 6 & 63;
379
+ base64.push(TO_BASE64URL[pos]);
380
+ queuedBits -= 6;
381
+ }
382
+ }
383
+ return base64.join("");
384
+ }
385
+ function stringFromBase64URL(str) {
386
+ const conv = [];
387
+ const emit = (codepoint) => {
388
+ conv.push(String.fromCodePoint(codepoint));
389
+ };
390
+ const state = {
391
+ utf8seq: 0,
392
+ codepoint: 0
393
+ };
394
+ let queue = 0;
395
+ let queuedBits = 0;
396
+ for (let i = 0; i < str.length; i += 1) {
397
+ const codepoint = str.charCodeAt(i);
398
+ const bits = FROM_BASE64URL[codepoint];
399
+ if (bits > -1) {
400
+ queue = queue << 6 | bits;
401
+ queuedBits += 6;
402
+ while (queuedBits >= 8) {
403
+ stringFromUTF8(queue >> queuedBits - 8 & 255, state, emit);
404
+ queuedBits -= 8;
405
+ }
406
+ } else if (bits === -2) {
407
+ continue;
408
+ } else {
409
+ throw new Error(`Invalid Base64-URL character "${str.at(i)}" at position ${i}`);
410
+ }
411
+ }
412
+ return conv.join("");
413
+ }
414
+ function codepointToUTF8(codepoint, emit) {
415
+ if (codepoint <= 127) {
416
+ emit(codepoint);
417
+ return;
418
+ } else if (codepoint <= 2047) {
419
+ emit(192 | codepoint >> 6);
420
+ emit(128 | codepoint & 63);
421
+ return;
422
+ } else if (codepoint <= 65535) {
423
+ emit(224 | codepoint >> 12);
424
+ emit(128 | codepoint >> 6 & 63);
425
+ emit(128 | codepoint & 63);
426
+ return;
427
+ } else if (codepoint <= 1114111) {
428
+ emit(240 | codepoint >> 18);
429
+ emit(128 | codepoint >> 12 & 63);
430
+ emit(128 | codepoint >> 6 & 63);
431
+ emit(128 | codepoint & 63);
432
+ return;
433
+ }
434
+ throw new Error(`Unrecognized Unicode codepoint: ${codepoint.toString(16)}`);
435
+ }
436
+ function stringToUTF8(str, emit) {
437
+ for (let i = 0; i < str.length; i += 1) {
438
+ let codepoint = str.charCodeAt(i);
439
+ if (codepoint > 55295 && codepoint <= 56319) {
440
+ const highSurrogate = (codepoint - 55296) * 1024 & 65535;
441
+ const lowSurrogate = str.charCodeAt(i + 1) - 56320 & 65535;
442
+ codepoint = (lowSurrogate | highSurrogate) + 65536;
443
+ i += 1;
444
+ }
445
+ codepointToUTF8(codepoint, emit);
446
+ }
447
+ }
448
+ function stringFromUTF8(byte, state, emit) {
449
+ if (state.utf8seq === 0) {
450
+ if (byte <= 127) {
451
+ emit(byte);
452
+ return;
453
+ }
454
+ for (let leadingBit = 1; leadingBit < 6; leadingBit += 1) {
455
+ if ((byte >> 7 - leadingBit & 1) === 0) {
456
+ state.utf8seq = leadingBit;
457
+ break;
458
+ }
459
+ }
460
+ if (state.utf8seq === 2) {
461
+ state.codepoint = byte & 31;
462
+ } else if (state.utf8seq === 3) {
463
+ state.codepoint = byte & 15;
464
+ } else if (state.utf8seq === 4) {
465
+ state.codepoint = byte & 7;
466
+ } else {
467
+ throw new Error("Invalid UTF-8 sequence");
468
+ }
469
+ state.utf8seq -= 1;
470
+ } else if (state.utf8seq > 0) {
471
+ if (byte <= 127) {
472
+ throw new Error("Invalid UTF-8 sequence");
473
+ }
474
+ state.codepoint = state.codepoint << 6 | byte & 63;
475
+ state.utf8seq -= 1;
476
+ if (state.utf8seq === 0) {
477
+ emit(state.codepoint);
478
+ }
479
+ }
480
+ }
481
+
482
+ // ../../node_modules/@supabase/ssr/dist/module/cookies.js
483
+ var import_cookie = __toESM(require_dist());
484
+ var BASE64_PREFIX = "base64-";
485
+ function createStorageFromOptions(options, isServerClient) {
486
+ const cookies = options.cookies ?? null;
487
+ const cookieEncoding = options.cookieEncoding;
488
+ const setItems = {};
489
+ const removedItems = {};
490
+ let getAll;
491
+ let setAll;
492
+ if (cookies) {
493
+ if ("get" in cookies) {
494
+ const getWithHints = async (keyHints) => {
495
+ const chunkNames = keyHints.flatMap((keyHint) => [
496
+ keyHint,
497
+ ...Array.from({ length: 5 }).map((_, i) => `${keyHint}.${i}`)
498
+ ]);
499
+ const chunks = [];
500
+ for (let i = 0; i < chunkNames.length; i += 1) {
501
+ const value = await cookies.get(chunkNames[i]);
502
+ if (!value && typeof value !== "string") {
503
+ continue;
504
+ }
505
+ chunks.push({ name: chunkNames[i], value });
506
+ }
507
+ return chunks;
508
+ };
509
+ getAll = async (keyHints) => await getWithHints(keyHints);
510
+ if ("set" in cookies && "remove" in cookies) {
511
+ setAll = async (setCookies) => {
512
+ for (let i = 0; i < setCookies.length; i += 1) {
513
+ const { name, value, options: options2 } = setCookies[i];
514
+ if (value) {
515
+ await cookies.set(name, value, options2);
516
+ } else {
517
+ await cookies.remove(name, options2);
518
+ }
519
+ }
520
+ };
521
+ } else if (isServerClient) {
522
+ setAll = async () => {
523
+ console.warn("@supabase/ssr: createServerClient was configured without set and remove cookie methods, but the client needs to set cookies. This can lead to issues such as random logouts, early session termination or increased token refresh requests. If in NextJS, check your middleware.ts file, route handlers and server actions for correctness. Consider switching to the getAll and setAll cookie methods instead of get, set and remove which are deprecated and can be difficult to use correctly.");
524
+ };
525
+ } else {
526
+ throw new Error("@supabase/ssr: createBrowserClient requires configuring a getAll and setAll cookie method (deprecated: alternatively both get, set and remove can be used)");
527
+ }
528
+ } else if ("getAll" in cookies) {
529
+ getAll = async () => await cookies.getAll();
530
+ if ("setAll" in cookies) {
531
+ setAll = cookies.setAll;
532
+ } else if (isServerClient) {
533
+ setAll = async () => {
534
+ console.warn("@supabase/ssr: createServerClient was configured without the setAll cookie method, but the client needs to set cookies. This can lead to issues such as random logouts, early session termination or increased token refresh requests. If in NextJS, check your middleware.ts file, route handlers and server actions for correctness.");
535
+ };
536
+ } else {
537
+ throw new Error("@supabase/ssr: createBrowserClient requires configuring both getAll and setAll cookie methods (deprecated: alternatively both get, set and remove can be used)");
538
+ }
539
+ } else {
540
+ throw new Error(`@supabase/ssr: ${isServerClient ? "createServerClient" : "createBrowserClient"} requires configuring getAll and setAll cookie methods (deprecated: alternatively use get, set and remove).${isBrowser() ? " As this is called in a browser runtime, consider removing the cookies option object to use the document.cookie API automatically." : ""}`);
541
+ }
542
+ } else if (!isServerClient && isBrowser()) {
543
+ const noHintGetAll = () => {
544
+ const parsed = (0, import_cookie.parse)(document.cookie);
545
+ return Object.keys(parsed).map((name) => ({
546
+ name,
547
+ value: parsed[name] ?? ""
548
+ }));
549
+ };
550
+ getAll = () => noHintGetAll();
551
+ setAll = (setCookies) => {
552
+ setCookies.forEach(({ name, value, options: options2 }) => {
553
+ document.cookie = (0, import_cookie.serialize)(name, value, options2);
554
+ });
555
+ };
556
+ } else if (isServerClient) {
557
+ throw new Error("@supabase/ssr: createServerClient must be initialized with cookie options that specify getAll and setAll functions (deprecated, not recommended: alternatively use get, set and remove)");
558
+ } else {
559
+ getAll = () => {
560
+ return [];
561
+ };
562
+ setAll = () => {
563
+ throw new Error("@supabase/ssr: createBrowserClient in non-browser runtimes (including Next.js pre-rendering mode) was not initialized cookie options that specify getAll and setAll functions (deprecated: alternatively use get, set and remove), but they were needed");
564
+ };
565
+ }
566
+ if (!isServerClient) {
567
+ return {
568
+ getAll,
569
+ // for type consistency
570
+ setAll,
571
+ // for type consistency
572
+ setItems,
573
+ // for type consistency
574
+ removedItems,
575
+ // for type consistency
576
+ storage: {
577
+ isServer: false,
578
+ getItem: async (key) => {
579
+ const allCookies = await getAll([key]);
580
+ const chunkedCookie = await combineChunks(key, async (chunkName) => {
581
+ const cookie = allCookies?.find(({ name }) => name === chunkName) || null;
582
+ if (!cookie) {
583
+ return null;
584
+ }
585
+ return cookie.value;
586
+ });
587
+ if (!chunkedCookie) {
588
+ return null;
589
+ }
590
+ let decoded = chunkedCookie;
591
+ if (chunkedCookie.startsWith(BASE64_PREFIX)) {
592
+ decoded = stringFromBase64URL(chunkedCookie.substring(BASE64_PREFIX.length));
593
+ }
594
+ return decoded;
595
+ },
596
+ setItem: async (key, value) => {
597
+ const allCookies = await getAll([key]);
598
+ const cookieNames = allCookies?.map(({ name }) => name) || [];
599
+ const removeCookies = new Set(cookieNames.filter((name) => isChunkLike(name, key)));
600
+ let encoded = value;
601
+ if (cookieEncoding === "base64url") {
602
+ encoded = BASE64_PREFIX + stringToBase64URL(value);
603
+ }
604
+ const setCookies = createChunks(key, encoded);
605
+ setCookies.forEach(({ name }) => {
606
+ removeCookies.delete(name);
607
+ });
608
+ const removeCookieOptions = {
609
+ ...DEFAULT_COOKIE_OPTIONS,
610
+ ...options?.cookieOptions,
611
+ maxAge: 0
612
+ };
613
+ const setCookieOptions = {
614
+ ...DEFAULT_COOKIE_OPTIONS,
615
+ ...options?.cookieOptions,
616
+ maxAge: DEFAULT_COOKIE_OPTIONS.maxAge
617
+ };
618
+ delete removeCookieOptions.name;
619
+ delete setCookieOptions.name;
620
+ const allToSet = [
621
+ ...[...removeCookies].map((name) => ({
622
+ name,
623
+ value: "",
624
+ options: removeCookieOptions
625
+ })),
626
+ ...setCookies.map(({ name, value: value2 }) => ({
627
+ name,
628
+ value: value2,
629
+ options: setCookieOptions
630
+ }))
631
+ ];
632
+ if (allToSet.length > 0) {
633
+ await setAll(allToSet);
634
+ }
635
+ },
636
+ removeItem: async (key) => {
637
+ const allCookies = await getAll([key]);
638
+ const cookieNames = allCookies?.map(({ name }) => name) || [];
639
+ const removeCookies = cookieNames.filter((name) => isChunkLike(name, key));
640
+ const removeCookieOptions = {
641
+ ...DEFAULT_COOKIE_OPTIONS,
642
+ ...options?.cookieOptions,
643
+ maxAge: 0
644
+ };
645
+ delete removeCookieOptions.name;
646
+ if (removeCookies.length > 0) {
647
+ await setAll(removeCookies.map((name) => ({
648
+ name,
649
+ value: "",
650
+ options: removeCookieOptions
651
+ })));
652
+ }
653
+ }
654
+ }
655
+ };
656
+ }
657
+ return {
658
+ getAll,
659
+ setAll,
660
+ setItems,
661
+ removedItems,
662
+ storage: {
663
+ // to signal to the libraries that these cookies are
664
+ // coming from a server environment and their value
665
+ // should not be trusted
666
+ isServer: true,
667
+ getItem: async (key) => {
668
+ if (typeof setItems[key] === "string") {
669
+ return setItems[key];
670
+ }
671
+ if (removedItems[key]) {
672
+ return null;
673
+ }
674
+ const allCookies = await getAll([key]);
675
+ const chunkedCookie = await combineChunks(key, async (chunkName) => {
676
+ const cookie = allCookies?.find(({ name }) => name === chunkName) || null;
677
+ if (!cookie) {
678
+ return null;
679
+ }
680
+ return cookie.value;
681
+ });
682
+ if (!chunkedCookie) {
683
+ return null;
684
+ }
685
+ let decoded = chunkedCookie;
686
+ if (typeof chunkedCookie === "string" && chunkedCookie.startsWith(BASE64_PREFIX)) {
687
+ decoded = stringFromBase64URL(chunkedCookie.substring(BASE64_PREFIX.length));
688
+ }
689
+ return decoded;
690
+ },
691
+ setItem: async (key, value) => {
692
+ if (key.endsWith("-code-verifier")) {
693
+ await applyServerStorage({
694
+ getAll,
695
+ setAll,
696
+ // pretend only that the code verifier was set
697
+ setItems: { [key]: value },
698
+ // pretend that nothing was removed
699
+ removedItems: {}
700
+ }, {
701
+ cookieOptions: options?.cookieOptions ?? null,
702
+ cookieEncoding
703
+ });
704
+ }
705
+ setItems[key] = value;
706
+ delete removedItems[key];
707
+ },
708
+ removeItem: async (key) => {
709
+ delete setItems[key];
710
+ removedItems[key] = true;
711
+ }
712
+ }
713
+ };
714
+ }
715
+ async function applyServerStorage({ getAll, setAll, setItems, removedItems }, options) {
716
+ const cookieEncoding = options.cookieEncoding;
717
+ const cookieOptions = options.cookieOptions ?? null;
718
+ const allCookies = await getAll([
719
+ ...setItems ? Object.keys(setItems) : [],
720
+ ...removedItems ? Object.keys(removedItems) : []
721
+ ]);
722
+ const cookieNames = allCookies?.map(({ name }) => name) || [];
723
+ const removeCookies = Object.keys(removedItems).flatMap((itemName) => {
724
+ return cookieNames.filter((name) => isChunkLike(name, itemName));
725
+ });
726
+ const setCookies = Object.keys(setItems).flatMap((itemName) => {
727
+ const removeExistingCookiesForItem = new Set(cookieNames.filter((name) => isChunkLike(name, itemName)));
728
+ let encoded = setItems[itemName];
729
+ if (cookieEncoding === "base64url") {
730
+ encoded = BASE64_PREFIX + stringToBase64URL(encoded);
731
+ }
732
+ const chunks = createChunks(itemName, encoded);
733
+ chunks.forEach((chunk) => {
734
+ removeExistingCookiesForItem.delete(chunk.name);
735
+ });
736
+ removeCookies.push(...removeExistingCookiesForItem);
737
+ return chunks;
738
+ });
739
+ const removeCookieOptions = {
740
+ ...DEFAULT_COOKIE_OPTIONS,
741
+ ...cookieOptions,
742
+ maxAge: 0
743
+ };
744
+ const setCookieOptions = {
745
+ ...DEFAULT_COOKIE_OPTIONS,
746
+ ...cookieOptions,
747
+ maxAge: DEFAULT_COOKIE_OPTIONS.maxAge
748
+ };
749
+ delete removeCookieOptions.name;
750
+ delete setCookieOptions.name;
751
+ await setAll([
752
+ ...removeCookies.map((name) => ({
753
+ name,
754
+ value: "",
755
+ options: removeCookieOptions
756
+ })),
757
+ ...setCookies.map(({ name, value }) => ({
758
+ name,
759
+ value,
760
+ options: setCookieOptions
761
+ }))
762
+ ]);
763
+ }
764
+
765
+ // ../../node_modules/@supabase/ssr/dist/module/createBrowserClient.js
766
+ var cachedBrowserClient;
767
+ function createBrowserClient(supabaseUrl, supabaseKey, options) {
768
+ const shouldUseSingleton = options?.isSingleton === true || (!options || !("isSingleton" in options)) && isBrowser();
769
+ if (shouldUseSingleton && cachedBrowserClient) {
770
+ return cachedBrowserClient;
771
+ }
772
+ if (!supabaseUrl || !supabaseKey) {
773
+ throw new Error(`@supabase/ssr: Your project's URL and API key are required to create a Supabase client!
774
+
775
+ Check your Supabase project's API settings to find these values
776
+
777
+ https://supabase.com/dashboard/project/_/settings/api`);
778
+ }
779
+ const { storage } = createStorageFromOptions({
780
+ ...options,
781
+ cookieEncoding: options?.cookieEncoding ?? "base64url"
782
+ }, false);
783
+ const client = createClient(supabaseUrl, supabaseKey, {
784
+ // TODO: resolve type error
785
+ ...options,
786
+ global: {
787
+ ...options?.global,
788
+ headers: {
789
+ ...options?.global?.headers,
790
+ "X-Client-Info": `supabase-ssr/${VERSION} createBrowserClient`
791
+ }
792
+ },
793
+ auth: {
794
+ ...options?.auth,
795
+ ...options?.cookieOptions?.name ? { storageKey: options.cookieOptions.name } : null,
796
+ flowType: "pkce",
797
+ autoRefreshToken: isBrowser(),
798
+ detectSessionInUrl: isBrowser(),
799
+ persistSession: true,
800
+ storage,
801
+ ...options?.cookies && "encode" in options.cookies && options.cookies.encode === "tokens-only" ? {
802
+ userStorage: options?.auth?.userStorage ?? window.localStorage
803
+ } : null
804
+ }
805
+ });
806
+ if (shouldUseSingleton) {
807
+ cachedBrowserClient = client;
808
+ }
809
+ return client;
810
+ }
811
+
812
+ // ../../node_modules/@supabase/ssr/dist/module/index.js
813
+ if (typeof process !== "undefined" && process.env?.npm_package_name) {
814
+ const packageName = process.env.npm_package_name;
815
+ const deprecatedPackages = [
816
+ "@supabase/auth-helpers-nextjs",
817
+ "@supabase/auth-helpers-react",
818
+ "@supabase/auth-helpers-remix",
819
+ "@supabase/auth-helpers-sveltekit"
820
+ ];
821
+ if (deprecatedPackages.includes(packageName)) {
822
+ console.warn(`
823
+ \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557
824
+ \u2551 \u26A0\uFE0F IMPORTANT: Package Consolidation Notice \u2551
825
+ \u2551 \u2551
826
+ \u2551 The ${packageName.padEnd(35)} package name is deprecated. \u2551
827
+ \u2551 \u2551
828
+ \u2551 You are now using @supabase/ssr - a unified solution for all frameworks. \u2551
829
+ \u2551 \u2551
830
+ \u2551 The auth-helpers packages have been consolidated into @supabase/ssr \u2551
831
+ \u2551 to provide better maintenance and consistent APIs across frameworks. \u2551
832
+ \u2551 \u2551
833
+ \u2551 Please update your package.json to use @supabase/ssr directly: \u2551
834
+ \u2551 npm uninstall ${packageName.padEnd(42)} \u2551
835
+ \u2551 npm install @supabase/ssr \u2551
836
+ \u2551 \u2551
837
+ \u2551 For more information, visit: \u2551
838
+ \u2551 https://supabase.com/docs/guides/auth/server-side \u2551
839
+ \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D
840
+ `);
841
+ }
842
+ }
843
+
844
+ // ../../lib/supabase/client.ts
845
+ var cached = null;
846
+ var hasKnownSession = false;
847
+ function requireBrowserEnv() {
848
+ const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL;
849
+ const supabaseAnonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY;
850
+ if (!supabaseUrl || !supabaseAnonKey) {
851
+ throw new Error("[supabase] Missing NEXT_PUBLIC_SUPABASE_URL or NEXT_PUBLIC_SUPABASE_ANON_KEY");
852
+ }
853
+ return { supabaseUrl, supabaseAnonKey };
854
+ }
855
+ function createSupabaseClientComponentClient() {
856
+ if (typeof window !== "undefined") {
857
+ const w = window;
858
+ if (w.__tn_supabase__) return w.__tn_supabase__;
859
+ }
860
+ if (typeof window !== "undefined" && cached) return cached;
861
+ if (typeof window === "undefined") {
862
+ return new Proxy({}, {
863
+ get: () => {
864
+ throw new Error(
865
+ "[supabase] Cannot use Supabase client in non-browser context. Ensure this function is only called in browser code."
866
+ );
867
+ }
868
+ });
869
+ }
870
+ const { supabaseUrl, supabaseAnonKey } = requireBrowserEnv();
871
+ cached = createBrowserClient(supabaseUrl, supabaseAnonKey, {
872
+ // isSingleton is auto-detected in browser, but being explicit for clarity
873
+ isSingleton: true,
874
+ cookieOptions: {
875
+ secure: process.env.NODE_ENV === "production"
876
+ }
877
+ });
878
+ if (typeof window !== "undefined") {
879
+ window.__tn_supabase__ = cached;
880
+ try {
881
+ const projectRef = new URL(supabaseUrl).hostname.split(".")[0];
882
+ const authCookie = document.cookie.split("; ").find((c) => c.startsWith(`sb-${projectRef}-auth-token`));
883
+ hasKnownSession = !!authCookie;
884
+ } catch {
885
+ }
886
+ }
887
+ return cached;
888
+ }
889
+ function getHasKnownSession() {
890
+ return hasKnownSession;
891
+ }
892
+
893
+ export {
894
+ createSupabaseClientComponentClient,
895
+ getHasKnownSession
896
+ };