@jive-ai/cli 0.0.44 → 0.0.45

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 (2) hide show
  1. package/dist/index.mjs +231 -1687
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -10,11 +10,11 @@ import os from "os";
10
10
  import { existsSync, mkdirSync, promises, readFileSync } from "fs";
11
11
  import { exec, spawn } from "child_process";
12
12
  import { promisify } from "util";
13
+ import { GraphQLClient } from "graphql-request";
13
14
  import crypto from "crypto";
14
15
  import "gray-matter";
15
16
  import WebSocket from "ws";
16
17
  import { decode, encode } from "js-base64";
17
- import { GraphQLClient } from "graphql-request";
18
18
  import { createSdkMcpServer, query, tool } from "@anthropic-ai/claude-agent-sdk";
19
19
  import yaml from "js-yaml";
20
20
  import { z } from "zod";
@@ -280,18 +280,18 @@ var e = {
280
280
  NON_NULL_TYPE: "NonNullType"
281
281
  };
282
282
  var GraphQLError = class extends Error {
283
- constructor(e$3, r$1, i$2, n$1, t$2, a$2, o$1) {
284
- if (super(e$3), this.name = "GraphQLError", this.message = e$3, t$2) this.path = t$2;
285
- if (r$1) this.nodes = Array.isArray(r$1) ? r$1 : [r$1];
286
- if (i$2) this.source = i$2;
283
+ constructor(e$2, r, i$1, n$1, t$2, a$2, o$1) {
284
+ if (super(e$2), this.name = "GraphQLError", this.message = e$2, t$2) this.path = t$2;
285
+ if (r) this.nodes = Array.isArray(r) ? r : [r];
286
+ if (i$1) this.source = i$1;
287
287
  if (n$1) this.positions = n$1;
288
288
  if (a$2) this.originalError = a$2;
289
- var l$1 = o$1;
290
- if (!l$1 && a$2) {
291
- var d$2 = a$2.extensions;
292
- if (d$2 && "object" == typeof d$2) l$1 = d$2;
289
+ var l = o$1;
290
+ if (!l && a$2) {
291
+ var d = a$2.extensions;
292
+ if (d && "object" == typeof d) l = d;
293
293
  }
294
- this.extensions = l$1 || {};
294
+ this.extensions = l || {};
295
295
  }
296
296
  toJSON() {
297
297
  return {
@@ -306,40 +306,40 @@ var GraphQLError = class extends Error {
306
306
  return "GraphQLError";
307
307
  }
308
308
  };
309
- var i$1;
309
+ var i;
310
310
  var n;
311
- function error(e$3) {
312
- return new GraphQLError(`Syntax Error: Unexpected token at ${n} in ${e$3}`);
311
+ function error(e$2) {
312
+ return new GraphQLError(`Syntax Error: Unexpected token at ${n} in ${e$2}`);
313
313
  }
314
- function advance(e$3) {
315
- if (e$3.lastIndex = n, e$3.test(i$1)) return i$1.slice(n, n = e$3.lastIndex);
314
+ function advance(e$2) {
315
+ if (e$2.lastIndex = n, e$2.test(i)) return i.slice(n, n = e$2.lastIndex);
316
316
  }
317
317
  var t$1 = / +(?=[^\s])/y;
318
- function blockString(e$3) {
319
- var r$1 = e$3.split("\n");
320
- var i$2 = "";
318
+ function blockString(e$2) {
319
+ var r = e$2.split("\n");
320
+ var i$1 = "";
321
321
  var n$1 = 0;
322
322
  var a$2 = 0;
323
- var o$1 = r$1.length - 1;
324
- for (var l$1 = 0; l$1 < r$1.length; l$1++) if (t$1.lastIndex = 0, t$1.test(r$1[l$1])) {
325
- if (l$1 && (!n$1 || t$1.lastIndex < n$1)) n$1 = t$1.lastIndex;
326
- a$2 = a$2 || l$1, o$1 = l$1;
323
+ var o$1 = r.length - 1;
324
+ for (var l = 0; l < r.length; l++) if (t$1.lastIndex = 0, t$1.test(r[l])) {
325
+ if (l && (!n$1 || t$1.lastIndex < n$1)) n$1 = t$1.lastIndex;
326
+ a$2 = a$2 || l, o$1 = l;
327
327
  }
328
- for (var d$2 = a$2; d$2 <= o$1; d$2++) {
329
- if (d$2 !== a$2) i$2 += "\n";
330
- i$2 += r$1[d$2].slice(n$1).replace(/\\"""/g, "\"\"\"");
328
+ for (var d = a$2; d <= o$1; d++) {
329
+ if (d !== a$2) i$1 += "\n";
330
+ i$1 += r[d].slice(n$1).replace(/\\"""/g, "\"\"\"");
331
331
  }
332
- return i$2;
332
+ return i$1;
333
333
  }
334
334
  function ignored() {
335
- for (var e$3 = 0 | i$1.charCodeAt(n++); 9 === e$3 || 10 === e$3 || 13 === e$3 || 32 === e$3 || 35 === e$3 || 44 === e$3 || 65279 === e$3; e$3 = 0 | i$1.charCodeAt(n++)) if (35 === e$3) for (; (e$3 = 0 | i$1.charCodeAt(n++)) && 10 !== e$3 && 13 !== e$3;);
335
+ for (var e$2 = 0 | i.charCodeAt(n++); 9 === e$2 || 10 === e$2 || 13 === e$2 || 32 === e$2 || 35 === e$2 || 44 === e$2 || 65279 === e$2; e$2 = 0 | i.charCodeAt(n++)) if (35 === e$2) for (; (e$2 = 0 | i.charCodeAt(n++)) && 10 !== e$2 && 13 !== e$2;);
336
336
  n--;
337
337
  }
338
338
  function name() {
339
- var e$3 = n;
340
- for (var r$1 = 0 | i$1.charCodeAt(n++); r$1 >= 48 && r$1 <= 57 || r$1 >= 65 && r$1 <= 90 || 95 === r$1 || r$1 >= 97 && r$1 <= 122; r$1 = 0 | i$1.charCodeAt(n++));
341
- if (e$3 === n - 1) throw error("Name");
342
- var t$2 = i$1.slice(e$3, --n);
339
+ var e$2 = n;
340
+ for (var r = 0 | i.charCodeAt(n++); r >= 48 && r <= 57 || r >= 65 && r <= 90 || 95 === r || r >= 97 && r <= 122; r = 0 | i.charCodeAt(n++));
341
+ if (e$2 === n - 1) throw error("Name");
342
+ var t$2 = i.slice(e$2, --n);
343
343
  return ignored(), t$2;
344
344
  }
345
345
  function nameNode() {
@@ -350,56 +350,56 @@ function nameNode() {
350
350
  }
351
351
  var a$1 = /(?:"""|(?:[\s\S]*?[^\\])""")/y;
352
352
  var o = /(?:(?:\.\d+)?[eE][+-]?\d+|\.\d+)/y;
353
- function value(e$3) {
354
- var r$1;
355
- switch (i$1.charCodeAt(n)) {
353
+ function value(e$2) {
354
+ var r;
355
+ switch (i.charCodeAt(n)) {
356
356
  case 91:
357
357
  n++, ignored();
358
358
  var t$2 = [];
359
- for (; 93 !== i$1.charCodeAt(n);) t$2.push(value(e$3));
359
+ for (; 93 !== i.charCodeAt(n);) t$2.push(value(e$2));
360
360
  return n++, ignored(), {
361
361
  kind: "ListValue",
362
362
  values: t$2
363
363
  };
364
364
  case 123:
365
365
  n++, ignored();
366
- var l$1 = [];
367
- for (; 125 !== i$1.charCodeAt(n);) {
368
- var d$2 = nameNode();
369
- if (58 !== i$1.charCodeAt(n++)) throw error("ObjectField");
370
- ignored(), l$1.push({
366
+ var l = [];
367
+ for (; 125 !== i.charCodeAt(n);) {
368
+ var d = nameNode();
369
+ if (58 !== i.charCodeAt(n++)) throw error("ObjectField");
370
+ ignored(), l.push({
371
371
  kind: "ObjectField",
372
- name: d$2,
373
- value: value(e$3)
372
+ name: d,
373
+ value: value(e$2)
374
374
  });
375
375
  }
376
376
  return n++, ignored(), {
377
377
  kind: "ObjectValue",
378
- fields: l$1
378
+ fields: l
379
379
  };
380
380
  case 36:
381
- if (e$3) throw error("Variable");
381
+ if (e$2) throw error("Variable");
382
382
  return n++, {
383
383
  kind: "Variable",
384
384
  name: nameNode()
385
385
  };
386
- case 34: if (34 === i$1.charCodeAt(n + 1) && 34 === i$1.charCodeAt(n + 2)) {
387
- if (n += 3, null == (r$1 = advance(a$1))) throw error("StringValue");
386
+ case 34: if (34 === i.charCodeAt(n + 1) && 34 === i.charCodeAt(n + 2)) {
387
+ if (n += 3, null == (r = advance(a$1))) throw error("StringValue");
388
388
  return ignored(), {
389
389
  kind: "StringValue",
390
- value: blockString(r$1.slice(0, -3)),
390
+ value: blockString(r.slice(0, -3)),
391
391
  block: !0
392
392
  };
393
393
  } else {
394
- var u$2 = n;
394
+ var u = n;
395
395
  var s;
396
396
  n++;
397
- var c$1 = !1;
398
- for (s = 0 | i$1.charCodeAt(n++); 92 === s && (n++, c$1 = !0) || 10 !== s && 13 !== s && 34 !== s && s; s = 0 | i$1.charCodeAt(n++));
397
+ var c = !1;
398
+ for (s = 0 | i.charCodeAt(n++); 92 === s && (n++, c = !0) || 10 !== s && 13 !== s && 34 !== s && s; s = 0 | i.charCodeAt(n++));
399
399
  if (34 !== s) throw error("StringValue");
400
- return r$1 = i$1.slice(u$2, n), ignored(), {
400
+ return r = i.slice(u, n), ignored(), {
401
401
  kind: "StringValue",
402
- value: c$1 ? JSON.parse(r$1) : r$1.slice(1, -1),
402
+ value: c ? JSON.parse(r) : r.slice(1, -1),
403
403
  block: !1
404
404
  };
405
405
  }
@@ -414,28 +414,28 @@ function value(e$3) {
414
414
  case 55:
415
415
  case 56:
416
416
  case 57:
417
- var v$1 = n++;
418
- var f$1;
419
- for (; (f$1 = 0 | i$1.charCodeAt(n++)) >= 48 && f$1 <= 57;);
420
- var m = i$1.slice(v$1, --n);
421
- if (46 === (f$1 = i$1.charCodeAt(n)) || 69 === f$1 || 101 === f$1) {
422
- if (null == (r$1 = advance(o))) throw error("FloatValue");
417
+ var v = n++;
418
+ var f;
419
+ for (; (f = 0 | i.charCodeAt(n++)) >= 48 && f <= 57;);
420
+ var m = i.slice(v, --n);
421
+ if (46 === (f = i.charCodeAt(n)) || 69 === f || 101 === f) {
422
+ if (null == (r = advance(o))) throw error("FloatValue");
423
423
  return ignored(), {
424
424
  kind: "FloatValue",
425
- value: m + r$1
425
+ value: m + r
426
426
  };
427
427
  } else return ignored(), {
428
428
  kind: "IntValue",
429
429
  value: m
430
430
  };
431
- case 110: if (117 === i$1.charCodeAt(n + 1) && 108 === i$1.charCodeAt(n + 2) && 108 === i$1.charCodeAt(n + 3)) return n += 4, ignored(), { kind: "NullValue" };
431
+ case 110: if (117 === i.charCodeAt(n + 1) && 108 === i.charCodeAt(n + 2) && 108 === i.charCodeAt(n + 3)) return n += 4, ignored(), { kind: "NullValue" };
432
432
  else break;
433
- case 116: if (114 === i$1.charCodeAt(n + 1) && 117 === i$1.charCodeAt(n + 2) && 101 === i$1.charCodeAt(n + 3)) return n += 4, ignored(), {
433
+ case 116: if (114 === i.charCodeAt(n + 1) && 117 === i.charCodeAt(n + 2) && 101 === i.charCodeAt(n + 3)) return n += 4, ignored(), {
434
434
  kind: "BooleanValue",
435
435
  value: !0
436
436
  };
437
437
  else break;
438
- case 102: if (97 === i$1.charCodeAt(n + 1) && 108 === i$1.charCodeAt(n + 2) && 115 === i$1.charCodeAt(n + 3) && 101 === i$1.charCodeAt(n + 4)) return n += 5, ignored(), {
438
+ case 102: if (97 === i.charCodeAt(n + 1) && 108 === i.charCodeAt(n + 2) && 115 === i.charCodeAt(n + 3) && 101 === i.charCodeAt(n + 4)) return n += 5, ignored(), {
439
439
  kind: "BooleanValue",
440
440
  value: !1
441
441
  };
@@ -446,69 +446,69 @@ function value(e$3) {
446
446
  value: name()
447
447
  };
448
448
  }
449
- function arguments_(e$3) {
450
- if (40 === i$1.charCodeAt(n)) {
451
- var r$1 = [];
449
+ function arguments_(e$2) {
450
+ if (40 === i.charCodeAt(n)) {
451
+ var r = [];
452
452
  n++, ignored();
453
453
  do {
454
454
  var t$2 = nameNode();
455
- if (58 !== i$1.charCodeAt(n++)) throw error("Argument");
456
- ignored(), r$1.push({
455
+ if (58 !== i.charCodeAt(n++)) throw error("Argument");
456
+ ignored(), r.push({
457
457
  kind: "Argument",
458
458
  name: t$2,
459
- value: value(e$3)
459
+ value: value(e$2)
460
460
  });
461
- } while (41 !== i$1.charCodeAt(n));
462
- return n++, ignored(), r$1;
461
+ } while (41 !== i.charCodeAt(n));
462
+ return n++, ignored(), r;
463
463
  }
464
464
  }
465
- function directives(e$3) {
466
- if (64 === i$1.charCodeAt(n)) {
467
- var r$1 = [];
465
+ function directives(e$2) {
466
+ if (64 === i.charCodeAt(n)) {
467
+ var r = [];
468
468
  do
469
- n++, r$1.push({
469
+ n++, r.push({
470
470
  kind: "Directive",
471
471
  name: nameNode(),
472
- arguments: arguments_(e$3)
472
+ arguments: arguments_(e$2)
473
473
  });
474
- while (64 === i$1.charCodeAt(n));
475
- return r$1;
474
+ while (64 === i.charCodeAt(n));
475
+ return r;
476
476
  }
477
477
  }
478
478
  function type() {
479
- var e$3 = 0;
480
- for (; 91 === i$1.charCodeAt(n);) e$3++, n++, ignored();
481
- var r$1 = {
479
+ var e$2 = 0;
480
+ for (; 91 === i.charCodeAt(n);) e$2++, n++, ignored();
481
+ var r = {
482
482
  kind: "NamedType",
483
483
  name: nameNode()
484
484
  };
485
485
  do {
486
- if (33 === i$1.charCodeAt(n)) n++, ignored(), r$1 = {
486
+ if (33 === i.charCodeAt(n)) n++, ignored(), r = {
487
487
  kind: "NonNullType",
488
- type: r$1
488
+ type: r
489
489
  };
490
- if (e$3) {
491
- if (93 !== i$1.charCodeAt(n++)) throw error("NamedType");
492
- ignored(), r$1 = {
490
+ if (e$2) {
491
+ if (93 !== i.charCodeAt(n++)) throw error("NamedType");
492
+ ignored(), r = {
493
493
  kind: "ListType",
494
- type: r$1
494
+ type: r
495
495
  };
496
496
  }
497
- } while (e$3--);
498
- return r$1;
497
+ } while (e$2--);
498
+ return r;
499
499
  }
500
500
  function selectionSetStart() {
501
- if (123 !== i$1.charCodeAt(n++)) throw error("SelectionSet");
501
+ if (123 !== i.charCodeAt(n++)) throw error("SelectionSet");
502
502
  return ignored(), selectionSet();
503
503
  }
504
504
  function selectionSet() {
505
- var e$3 = [];
505
+ var e$2 = [];
506
506
  do
507
- if (46 === i$1.charCodeAt(n)) {
508
- if (46 !== i$1.charCodeAt(++n) || 46 !== i$1.charCodeAt(++n)) throw error("SelectionSet");
509
- switch (n++, ignored(), i$1.charCodeAt(n)) {
507
+ if (46 === i.charCodeAt(n)) {
508
+ if (46 !== i.charCodeAt(++n) || 46 !== i.charCodeAt(++n)) throw error("SelectionSet");
509
+ switch (n++, ignored(), i.charCodeAt(n)) {
510
510
  case 64:
511
- e$3.push({
511
+ e$2.push({
512
512
  kind: "InlineFragment",
513
513
  typeCondition: void 0,
514
514
  directives: directives(!1),
@@ -516,7 +516,7 @@ function selectionSet() {
516
516
  });
517
517
  break;
518
518
  case 111:
519
- if (110 === i$1.charCodeAt(n + 1)) n += 2, ignored(), e$3.push({
519
+ if (110 === i.charCodeAt(n + 1)) n += 2, ignored(), e$2.push({
520
520
  kind: "InlineFragment",
521
521
  typeCondition: {
522
522
  kind: "NamedType",
@@ -525,65 +525,65 @@ function selectionSet() {
525
525
  directives: directives(!1),
526
526
  selectionSet: selectionSetStart()
527
527
  });
528
- else e$3.push({
528
+ else e$2.push({
529
529
  kind: "FragmentSpread",
530
530
  name: nameNode(),
531
531
  directives: directives(!1)
532
532
  });
533
533
  break;
534
534
  case 123:
535
- n++, ignored(), e$3.push({
535
+ n++, ignored(), e$2.push({
536
536
  kind: "InlineFragment",
537
537
  typeCondition: void 0,
538
538
  directives: void 0,
539
539
  selectionSet: selectionSet()
540
540
  });
541
541
  break;
542
- default: e$3.push({
542
+ default: e$2.push({
543
543
  kind: "FragmentSpread",
544
544
  name: nameNode(),
545
545
  directives: directives(!1)
546
546
  });
547
547
  }
548
548
  } else {
549
- var r$1 = nameNode();
549
+ var r = nameNode();
550
550
  var t$2 = void 0;
551
- if (58 === i$1.charCodeAt(n)) n++, ignored(), t$2 = r$1, r$1 = nameNode();
551
+ if (58 === i.charCodeAt(n)) n++, ignored(), t$2 = r, r = nameNode();
552
552
  var a$2 = arguments_(!1);
553
553
  var o$1 = directives(!1);
554
- var l$1 = void 0;
555
- if (123 === i$1.charCodeAt(n)) n++, ignored(), l$1 = selectionSet();
556
- e$3.push({
554
+ var l = void 0;
555
+ if (123 === i.charCodeAt(n)) n++, ignored(), l = selectionSet();
556
+ e$2.push({
557
557
  kind: "Field",
558
558
  alias: t$2,
559
- name: r$1,
559
+ name: r,
560
560
  arguments: a$2,
561
561
  directives: o$1,
562
- selectionSet: l$1
562
+ selectionSet: l
563
563
  });
564
564
  }
565
- while (125 !== i$1.charCodeAt(n));
565
+ while (125 !== i.charCodeAt(n));
566
566
  return n++, ignored(), {
567
567
  kind: "SelectionSet",
568
- selections: e$3
568
+ selections: e$2
569
569
  };
570
570
  }
571
571
  function variableDefinitions() {
572
- if (ignored(), 40 === i$1.charCodeAt(n)) {
573
- var e$3 = [];
572
+ if (ignored(), 40 === i.charCodeAt(n)) {
573
+ var e$2 = [];
574
574
  n++, ignored();
575
575
  do {
576
- var r$1 = void 0;
577
- if (34 === i$1.charCodeAt(n)) r$1 = value(!0);
578
- if (36 !== i$1.charCodeAt(n++)) throw error("Variable");
576
+ var r = void 0;
577
+ if (34 === i.charCodeAt(n)) r = value(!0);
578
+ if (36 !== i.charCodeAt(n++)) throw error("Variable");
579
579
  var t$2 = nameNode();
580
- if (58 !== i$1.charCodeAt(n++)) throw error("VariableDefinition");
580
+ if (58 !== i.charCodeAt(n++)) throw error("VariableDefinition");
581
581
  ignored();
582
582
  var a$2 = type();
583
583
  var o$1 = void 0;
584
- if (61 === i$1.charCodeAt(n)) n++, ignored(), o$1 = value(!0);
584
+ if (61 === i.charCodeAt(n)) n++, ignored(), o$1 = value(!0);
585
585
  ignored();
586
- var l$1 = {
586
+ var l = {
587
587
  kind: "VariableDefinition",
588
588
  variable: {
589
589
  kind: "Variable",
@@ -593,19 +593,19 @@ function variableDefinitions() {
593
593
  defaultValue: o$1,
594
594
  directives: directives(!0)
595
595
  };
596
- if (r$1) l$1.description = r$1;
597
- e$3.push(l$1);
598
- } while (41 !== i$1.charCodeAt(n));
599
- return n++, ignored(), e$3;
596
+ if (r) l.description = r;
597
+ e$2.push(l);
598
+ } while (41 !== i.charCodeAt(n));
599
+ return n++, ignored(), e$2;
600
600
  }
601
601
  }
602
- function fragmentDefinition(e$3) {
603
- var r$1 = nameNode();
604
- if (111 !== i$1.charCodeAt(n++) || 110 !== i$1.charCodeAt(n++)) throw error("FragmentDefinition");
602
+ function fragmentDefinition(e$2) {
603
+ var r = nameNode();
604
+ if (111 !== i.charCodeAt(n++) || 110 !== i.charCodeAt(n++)) throw error("FragmentDefinition");
605
605
  ignored();
606
606
  var t$2 = {
607
607
  kind: "FragmentDefinition",
608
- name: r$1,
608
+ name: r,
609
609
  typeCondition: {
610
610
  kind: "NamedType",
611
611
  name: nameNode()
@@ -613,17 +613,17 @@ function fragmentDefinition(e$3) {
613
613
  directives: directives(!1),
614
614
  selectionSet: selectionSetStart()
615
615
  };
616
- if (e$3) t$2.description = e$3;
616
+ if (e$2) t$2.description = e$2;
617
617
  return t$2;
618
618
  }
619
619
  function definitions() {
620
- var e$3 = [];
620
+ var e$2 = [];
621
621
  do {
622
- var r$1 = void 0;
623
- if (34 === i$1.charCodeAt(n)) r$1 = value(!0);
624
- if (123 === i$1.charCodeAt(n)) {
625
- if (r$1) throw error("Document");
626
- n++, ignored(), e$3.push({
622
+ var r = void 0;
623
+ if (34 === i.charCodeAt(n)) r = value(!0);
624
+ if (123 === i.charCodeAt(n)) {
625
+ if (r) throw error("Document");
626
+ n++, ignored(), e$2.push({
627
627
  kind: "OperationDefinition",
628
628
  operation: "query",
629
629
  name: void 0,
@@ -635,15 +635,15 @@ function definitions() {
635
635
  var t$2 = name();
636
636
  switch (t$2) {
637
637
  case "fragment":
638
- e$3.push(fragmentDefinition(r$1));
638
+ e$2.push(fragmentDefinition(r));
639
639
  break;
640
640
  case "query":
641
641
  case "mutation":
642
642
  case "subscription":
643
643
  var a$2;
644
644
  var o$1 = void 0;
645
- if (40 !== (a$2 = i$1.charCodeAt(n)) && 64 !== a$2 && 123 !== a$2) o$1 = nameNode();
646
- var l$1 = {
645
+ if (40 !== (a$2 = i.charCodeAt(n)) && 64 !== a$2 && 123 !== a$2) o$1 = nameNode();
646
+ var l = {
647
647
  kind: "OperationDefinition",
648
648
  operation: t$2,
649
649
  name: o$1,
@@ -651,17 +651,17 @@ function definitions() {
651
651
  directives: directives(!1),
652
652
  selectionSet: selectionSetStart()
653
653
  };
654
- if (r$1) l$1.description = r$1;
655
- e$3.push(l$1);
654
+ if (r) l.description = r;
655
+ e$2.push(l);
656
656
  break;
657
657
  default: throw error("Document");
658
658
  }
659
659
  }
660
- } while (n < i$1.length);
661
- return e$3;
660
+ } while (n < i.length);
661
+ return e$2;
662
662
  }
663
- function parse(e$3, r$1) {
664
- if (i$1 = e$3.body ? e$3.body : e$3, n = 0, ignored(), r$1 && r$1.noLocation) return {
663
+ function parse(e$2, r) {
664
+ if (i = e$2.body ? e$2.body : e$2, n = 0, ignored(), r && r.noLocation) return {
665
665
  kind: "Document",
666
666
  definitions: definitions()
667
667
  };
@@ -670,11 +670,11 @@ function parse(e$3, r$1) {
670
670
  definitions: definitions(),
671
671
  loc: {
672
672
  start: 0,
673
- end: i$1.length,
673
+ end: i.length,
674
674
  startToken: void 0,
675
675
  endToken: void 0,
676
676
  source: {
677
- body: i$1,
677
+ body: i,
678
678
  name: "graphql.web",
679
679
  locationOffset: {
680
680
  line: 1,
@@ -684,142 +684,46 @@ function parse(e$3, r$1) {
684
684
  }
685
685
  };
686
686
  }
687
- function mapJoin(e$3, r$1, i$2) {
688
- var n$1 = "";
689
- for (var t$2 = 0; t$2 < e$3.length; t$2++) {
690
- if (t$2) n$1 += r$1;
691
- n$1 += i$2(e$3[t$2]);
692
- }
693
- return n$1;
694
- }
695
- function printString(e$3) {
696
- return JSON.stringify(e$3);
697
- }
698
- function printBlockString(e$3) {
699
- return "\"\"\"\n" + e$3.replace(/"""/g, "\\\"\"\"") + "\n\"\"\"";
700
- }
701
- var d$1 = "\n";
702
- var u$1 = {
703
- OperationDefinition(e$3) {
704
- var r$1 = "";
705
- if (e$3.description) r$1 += u$1.StringValue(e$3.description) + "\n";
706
- if (r$1 += e$3.operation, e$3.name) r$1 += " " + e$3.name.value;
707
- if (e$3.variableDefinitions && e$3.variableDefinitions.length) {
708
- if (!e$3.name) r$1 += " ";
709
- r$1 += "(" + mapJoin(e$3.variableDefinitions, ", ", u$1.VariableDefinition) + ")";
710
- }
711
- if (e$3.directives && e$3.directives.length) r$1 += " " + mapJoin(e$3.directives, " ", u$1.Directive);
712
- var i$2 = u$1.SelectionSet(e$3.selectionSet);
713
- return "query" !== r$1 ? r$1 + " " + i$2 : i$2;
714
- },
715
- VariableDefinition(e$3) {
716
- var r$1 = "";
717
- if (e$3.description) r$1 += u$1.StringValue(e$3.description) + " ";
718
- if (r$1 += u$1.Variable(e$3.variable) + ": " + _print(e$3.type), e$3.defaultValue) r$1 += " = " + _print(e$3.defaultValue);
719
- if (e$3.directives && e$3.directives.length) r$1 += " " + mapJoin(e$3.directives, " ", u$1.Directive);
720
- return r$1;
721
- },
722
- Field(e$3) {
723
- var r$1 = e$3.alias ? e$3.alias.value + ": " + e$3.name.value : e$3.name.value;
724
- if (e$3.arguments && e$3.arguments.length) {
725
- var i$2 = mapJoin(e$3.arguments, ", ", u$1.Argument);
726
- if (r$1.length + i$2.length + 2 > 80) r$1 += "(" + (d$1 += " ") + mapJoin(e$3.arguments, d$1, u$1.Argument) + (d$1 = d$1.slice(0, -2)) + ")";
727
- else r$1 += "(" + i$2 + ")";
728
- }
729
- if (e$3.directives && e$3.directives.length) r$1 += " " + mapJoin(e$3.directives, " ", u$1.Directive);
730
- if (e$3.selectionSet && e$3.selectionSet.selections.length) r$1 += " " + u$1.SelectionSet(e$3.selectionSet);
731
- return r$1;
732
- },
733
- StringValue(e$3) {
734
- if (e$3.block) return printBlockString(e$3.value).replace(/\n/g, d$1);
735
- else return printString(e$3.value);
736
- },
737
- BooleanValue: (e$3) => "" + e$3.value,
738
- NullValue: (e$3) => "null",
739
- IntValue: (e$3) => e$3.value,
740
- FloatValue: (e$3) => e$3.value,
741
- EnumValue: (e$3) => e$3.value,
742
- Name: (e$3) => e$3.value,
743
- Variable: (e$3) => "$" + e$3.name.value,
744
- ListValue: (e$3) => "[" + mapJoin(e$3.values, ", ", _print) + "]",
745
- ObjectValue: (e$3) => "{" + mapJoin(e$3.fields, ", ", u$1.ObjectField) + "}",
746
- ObjectField: (e$3) => e$3.name.value + ": " + _print(e$3.value),
747
- Document(e$3) {
748
- if (!e$3.definitions || !e$3.definitions.length) return "";
749
- else return mapJoin(e$3.definitions, "\n\n", _print);
750
- },
751
- SelectionSet: (e$3) => "{" + (d$1 += " ") + mapJoin(e$3.selections, d$1, _print) + (d$1 = d$1.slice(0, -2)) + "}",
752
- Argument: (e$3) => e$3.name.value + ": " + _print(e$3.value),
753
- FragmentSpread(e$3) {
754
- var r$1 = "..." + e$3.name.value;
755
- if (e$3.directives && e$3.directives.length) r$1 += " " + mapJoin(e$3.directives, " ", u$1.Directive);
756
- return r$1;
757
- },
758
- InlineFragment(e$3) {
759
- var r$1 = "...";
760
- if (e$3.typeCondition) r$1 += " on " + e$3.typeCondition.name.value;
761
- if (e$3.directives && e$3.directives.length) r$1 += " " + mapJoin(e$3.directives, " ", u$1.Directive);
762
- return r$1 += " " + u$1.SelectionSet(e$3.selectionSet);
763
- },
764
- FragmentDefinition(e$3) {
765
- var r$1 = "";
766
- if (e$3.description) r$1 += u$1.StringValue(e$3.description) + "\n";
767
- if (r$1 += "fragment " + e$3.name.value, r$1 += " on " + e$3.typeCondition.name.value, e$3.directives && e$3.directives.length) r$1 += " " + mapJoin(e$3.directives, " ", u$1.Directive);
768
- return r$1 + " " + u$1.SelectionSet(e$3.selectionSet);
769
- },
770
- Directive(e$3) {
771
- var r$1 = "@" + e$3.name.value;
772
- if (e$3.arguments && e$3.arguments.length) r$1 += "(" + mapJoin(e$3.arguments, ", ", u$1.Argument) + ")";
773
- return r$1;
774
- },
775
- NamedType: (e$3) => e$3.name.value,
776
- ListType: (e$3) => "[" + _print(e$3.type) + "]",
777
- NonNullType: (e$3) => _print(e$3.type) + "!"
778
- };
779
- var _print = (e$3) => u$1[e$3.kind](e$3);
780
- function print(e$3) {
781
- return d$1 = "\n", u$1[e$3.kind] ? u$1[e$3.kind](e$3) : "";
782
- }
783
687
 
784
688
  //#endregion
785
689
  //#region ../node_modules/gql.tada/dist/gql-tada.mjs
786
690
  var a = 0;
787
- var e$2 = /* @__PURE__ */ new Set();
691
+ var e$1 = /* @__PURE__ */ new Set();
788
692
  function initGraphQLTada() {
789
- function graphql$1(t$2, i$2) {
693
+ function graphql$1(t$2, i$1) {
790
694
  var o$1 = parse(t$2).definitions;
791
695
  var s = /* @__PURE__ */ new Set();
792
- for (var f$1 of i$2 || []) for (var u$2 of f$1.definitions) if (u$2.kind === e.FRAGMENT_DEFINITION && !s.has(u$2)) {
793
- o$1.push(u$2);
794
- s.add(u$2);
696
+ for (var f of i$1 || []) for (var u of f.definitions) if (u.kind === e.FRAGMENT_DEFINITION && !s.has(u)) {
697
+ o$1.push(u);
698
+ s.add(u);
795
699
  }
796
- var d$2;
797
- if ((d$2 = o$1[0].kind === e.FRAGMENT_DEFINITION) && o$1[0].directives) o$1[0].directives = o$1[0].directives.filter(((r$1) => "_unmask" !== r$1.name.value));
798
- var c$1;
700
+ var d;
701
+ if ((d = o$1[0].kind === e.FRAGMENT_DEFINITION) && o$1[0].directives) o$1[0].directives = o$1[0].directives.filter(((r) => "_unmask" !== r.name.value));
702
+ var c;
799
703
  return {
800
704
  kind: e.DOCUMENT,
801
705
  definitions: o$1,
802
706
  get loc() {
803
- if (!c$1 && d$2) {
804
- var r$1 = t$2 + function concatLocSources(r$2) {
707
+ if (!c && d) {
708
+ var r = t$2 + function concatLocSources(r$1) {
805
709
  try {
806
710
  a++;
807
711
  var n$1 = "";
808
- for (var t$3 of r$2) if (!e$2.has(t$3)) {
809
- e$2.add(t$3);
810
- var { loc: i$3 } = t$3;
811
- if (i$3) n$1 += i$3.source.body;
712
+ for (var t$3 of r$1) if (!e$1.has(t$3)) {
713
+ e$1.add(t$3);
714
+ var { loc: i$2 } = t$3;
715
+ if (i$2) n$1 += i$2.source.body;
812
716
  }
813
717
  return n$1;
814
718
  } finally {
815
- if (0 == --a) e$2.clear();
719
+ if (0 == --a) e$1.clear();
816
720
  }
817
- }(i$2 || []);
721
+ }(i$1 || []);
818
722
  return {
819
723
  start: 0,
820
- end: r$1.length,
724
+ end: r.length,
821
725
  source: {
822
- body: r$1,
726
+ body: r,
823
727
  name: "GraphQLTada",
824
728
  locationOffset: {
825
729
  line: 1,
@@ -828,14 +732,14 @@ function initGraphQLTada() {
828
732
  }
829
733
  };
830
734
  }
831
- return c$1;
735
+ return c;
832
736
  },
833
- set loc(r$1) {
834
- c$1 = r$1;
737
+ set loc(r) {
738
+ c = r;
835
739
  }
836
740
  };
837
741
  }
838
- graphql$1.scalar = function scalar(r$1, n$1) {
742
+ graphql$1.scalar = function scalar(r, n$1) {
839
743
  return n$1;
840
744
  };
841
745
  graphql$1.persisted = function persisted(n$1, a$2) {
@@ -849,1403 +753,9 @@ function initGraphQLTada() {
849
753
  }
850
754
  var t = initGraphQLTada();
851
755
 
852
- //#endregion
853
- //#region ../node_modules/wonka/dist/wonka.mjs
854
- var teardownPlaceholder = () => {};
855
- var e$1 = teardownPlaceholder;
856
- function start(e$3) {
857
- return {
858
- tag: 0,
859
- 0: e$3
860
- };
861
- }
862
- function push(e$3) {
863
- return {
864
- tag: 1,
865
- 0: e$3
866
- };
867
- }
868
- var asyncIteratorSymbol = () => "function" == typeof Symbol && Symbol.asyncIterator || "@@asyncIterator";
869
- var identity = (e$3) => e$3;
870
- function filter(r$1) {
871
- return (t$2) => (i$2) => {
872
- var a$2 = e$1;
873
- t$2(((e$3) => {
874
- if (0 === e$3) i$2(0);
875
- else if (0 === e$3.tag) {
876
- a$2 = e$3[0];
877
- i$2(e$3);
878
- } else if (!r$1(e$3[0])) a$2(0);
879
- else i$2(e$3);
880
- }));
881
- };
882
- }
883
- function map(e$3) {
884
- return (r$1) => (t$2) => r$1(((r$2) => {
885
- if (0 === r$2 || 0 === r$2.tag) t$2(r$2);
886
- else t$2(push(e$3(r$2[0])));
887
- }));
888
- }
889
- function mergeMap(r$1) {
890
- return (t$2) => (i$2) => {
891
- var a$2 = [];
892
- var f$1 = e$1;
893
- var n$1 = !1;
894
- var s = !1;
895
- t$2(((t$3) => {
896
- if (s) {} else if (0 === t$3) {
897
- s = !0;
898
- if (!a$2.length) i$2(0);
899
- } else if (0 === t$3.tag) f$1 = t$3[0];
900
- else {
901
- n$1 = !1;
902
- (function applyInnerSource(r$2) {
903
- var t$4 = e$1;
904
- r$2(((e$3) => {
905
- if (0 === e$3) {
906
- if (a$2.length) {
907
- var r$3 = a$2.indexOf(t$4);
908
- if (r$3 > -1) (a$2 = a$2.slice()).splice(r$3, 1);
909
- if (!a$2.length) {
910
- if (s) i$2(0);
911
- else if (!n$1) {
912
- n$1 = !0;
913
- f$1(0);
914
- }
915
- }
916
- }
917
- } else if (0 === e$3.tag) {
918
- a$2.push(t$4 = e$3[0]);
919
- t$4(0);
920
- } else if (a$2.length) {
921
- i$2(e$3);
922
- t$4(0);
923
- }
924
- }));
925
- })(r$1(t$3[0]));
926
- if (!n$1) {
927
- n$1 = !0;
928
- f$1(0);
929
- }
930
- }
931
- }));
932
- i$2(start(((e$3) => {
933
- if (1 === e$3) {
934
- if (!s) {
935
- s = !0;
936
- f$1(1);
937
- }
938
- for (var r$2 = 0, t$3 = a$2, i$3 = a$2.length; r$2 < i$3; r$2++) t$3[r$2](1);
939
- a$2.length = 0;
940
- } else {
941
- if (!s && !n$1) {
942
- n$1 = !0;
943
- f$1(0);
944
- } else n$1 = !1;
945
- for (var l$1 = 0, u$2 = a$2, o$1 = a$2.length; l$1 < o$1; l$1++) u$2[l$1](0);
946
- }
947
- })));
948
- };
949
- }
950
- function mergeAll(e$3) {
951
- return mergeMap(identity)(e$3);
952
- }
953
- function merge(e$3) {
954
- return mergeAll(r(e$3));
955
- }
956
- function onEnd(e$3) {
957
- return (r$1) => (t$2) => {
958
- var i$2 = !1;
959
- r$1(((r$2) => {
960
- if (i$2) {} else if (0 === r$2) {
961
- i$2 = !0;
962
- t$2(0);
963
- e$3();
964
- } else if (0 === r$2.tag) {
965
- var a$2 = r$2[0];
966
- t$2(start(((r$3) => {
967
- if (1 === r$3) {
968
- i$2 = !0;
969
- a$2(1);
970
- e$3();
971
- } else a$2(r$3);
972
- })));
973
- } else t$2(r$2);
974
- }));
975
- };
976
- }
977
- function onPush(e$3) {
978
- return (r$1) => (t$2) => {
979
- var i$2 = !1;
980
- r$1(((r$2) => {
981
- if (i$2) {} else if (0 === r$2) {
982
- i$2 = !0;
983
- t$2(0);
984
- } else if (0 === r$2.tag) {
985
- var a$2 = r$2[0];
986
- t$2(start(((e$4) => {
987
- if (1 === e$4) i$2 = !0;
988
- a$2(e$4);
989
- })));
990
- } else {
991
- e$3(r$2[0]);
992
- t$2(r$2);
993
- }
994
- }));
995
- };
996
- }
997
- function onStart(e$3) {
998
- return (r$1) => (t$2) => r$1(((r$2) => {
999
- if (0 === r$2) t$2(0);
1000
- else if (0 === r$2.tag) {
1001
- t$2(r$2);
1002
- e$3();
1003
- } else t$2(r$2);
1004
- }));
1005
- }
1006
- function share(r$1) {
1007
- var t$2 = [];
1008
- var i$2 = e$1;
1009
- var a$2 = !1;
1010
- return (e$3) => {
1011
- t$2.push(e$3);
1012
- if (1 === t$2.length) r$1(((e$4) => {
1013
- if (0 === e$4) {
1014
- for (var r$2 = 0, f$1 = t$2, n$1 = t$2.length; r$2 < n$1; r$2++) f$1[r$2](0);
1015
- t$2.length = 0;
1016
- } else if (0 === e$4.tag) i$2 = e$4[0];
1017
- else {
1018
- a$2 = !1;
1019
- for (var s = 0, l$1 = t$2, u$2 = t$2.length; s < u$2; s++) l$1[s](e$4);
1020
- }
1021
- }));
1022
- e$3(start(((r$2) => {
1023
- if (1 === r$2) {
1024
- var f$1 = t$2.indexOf(e$3);
1025
- if (f$1 > -1) (t$2 = t$2.slice()).splice(f$1, 1);
1026
- if (!t$2.length) i$2(1);
1027
- } else if (!a$2) {
1028
- a$2 = !0;
1029
- i$2(0);
1030
- }
1031
- })));
1032
- };
1033
- }
1034
- function switchMap(r$1) {
1035
- return (t$2) => (i$2) => {
1036
- var a$2 = e$1;
1037
- var f$1 = e$1;
1038
- var n$1 = !1;
1039
- var s = !1;
1040
- var l$1 = !1;
1041
- var u$2 = !1;
1042
- t$2(((t$3) => {
1043
- if (u$2) {} else if (0 === t$3) {
1044
- u$2 = !0;
1045
- if (!l$1) i$2(0);
1046
- } else if (0 === t$3.tag) a$2 = t$3[0];
1047
- else {
1048
- if (l$1) {
1049
- f$1(1);
1050
- f$1 = e$1;
1051
- }
1052
- if (!n$1) {
1053
- n$1 = !0;
1054
- a$2(0);
1055
- } else n$1 = !1;
1056
- (function applyInnerSource(e$3) {
1057
- l$1 = !0;
1058
- e$3(((e$4) => {
1059
- if (!l$1) {} else if (0 === e$4) {
1060
- l$1 = !1;
1061
- if (u$2) i$2(0);
1062
- else if (!n$1) {
1063
- n$1 = !0;
1064
- a$2(0);
1065
- }
1066
- } else if (0 === e$4.tag) {
1067
- s = !1;
1068
- (f$1 = e$4[0])(0);
1069
- } else {
1070
- i$2(e$4);
1071
- if (!s) f$1(0);
1072
- else s = !1;
1073
- }
1074
- }));
1075
- })(r$1(t$3[0]));
1076
- }
1077
- }));
1078
- i$2(start(((e$3) => {
1079
- if (1 === e$3) {
1080
- if (!u$2) {
1081
- u$2 = !0;
1082
- a$2(1);
1083
- }
1084
- if (l$1) {
1085
- l$1 = !1;
1086
- f$1(1);
1087
- }
1088
- } else {
1089
- if (!u$2 && !n$1) {
1090
- n$1 = !0;
1091
- a$2(0);
1092
- }
1093
- if (l$1 && !s) {
1094
- s = !0;
1095
- f$1(0);
1096
- }
1097
- }
1098
- })));
1099
- };
1100
- }
1101
- function take(r$1) {
1102
- return (t$2) => (i$2) => {
1103
- var a$2 = e$1;
1104
- var f$1 = !1;
1105
- var n$1 = 0;
1106
- t$2(((e$3) => {
1107
- if (f$1) {} else if (0 === e$3) {
1108
- f$1 = !0;
1109
- i$2(0);
1110
- } else if (0 === e$3.tag) if (r$1 <= 0) {
1111
- f$1 = !0;
1112
- i$2(0);
1113
- e$3[0](1);
1114
- } else a$2 = e$3[0];
1115
- else if (n$1++ < r$1) {
1116
- i$2(e$3);
1117
- if (!f$1 && n$1 >= r$1) {
1118
- f$1 = !0;
1119
- i$2(0);
1120
- a$2(1);
1121
- }
1122
- } else i$2(e$3);
1123
- }));
1124
- i$2(start(((e$3) => {
1125
- if (1 === e$3 && !f$1) {
1126
- f$1 = !0;
1127
- a$2(1);
1128
- } else if (0 === e$3 && !f$1 && n$1 < r$1) a$2(0);
1129
- })));
1130
- };
1131
- }
1132
- function takeUntil(r$1) {
1133
- return (t$2) => (i$2) => {
1134
- var a$2 = e$1;
1135
- var f$1 = e$1;
1136
- var n$1 = !1;
1137
- t$2(((e$3) => {
1138
- if (n$1) {} else if (0 === e$3) {
1139
- n$1 = !0;
1140
- f$1(1);
1141
- i$2(0);
1142
- } else if (0 === e$3.tag) {
1143
- a$2 = e$3[0];
1144
- r$1(((e$4) => {
1145
- if (0 === e$4) {} else if (0 === e$4.tag) (f$1 = e$4[0])(0);
1146
- else {
1147
- n$1 = !0;
1148
- f$1(1);
1149
- a$2(1);
1150
- i$2(0);
1151
- }
1152
- }));
1153
- } else i$2(e$3);
1154
- }));
1155
- i$2(start(((e$3) => {
1156
- if (1 === e$3 && !n$1) {
1157
- n$1 = !0;
1158
- a$2(1);
1159
- f$1(1);
1160
- } else if (!n$1) a$2(0);
1161
- })));
1162
- };
1163
- }
1164
- function takeWhile(r$1, t$2) {
1165
- return (i$2) => (a$2) => {
1166
- var f$1 = e$1;
1167
- var n$1 = !1;
1168
- i$2(((e$3) => {
1169
- if (n$1) {} else if (0 === e$3) {
1170
- n$1 = !0;
1171
- a$2(0);
1172
- } else if (0 === e$3.tag) {
1173
- f$1 = e$3[0];
1174
- a$2(e$3);
1175
- } else if (!r$1(e$3[0])) {
1176
- n$1 = !0;
1177
- if (t$2) a$2(e$3);
1178
- a$2(0);
1179
- f$1(1);
1180
- } else a$2(e$3);
1181
- }));
1182
- };
1183
- }
1184
- function lazy(e$3) {
1185
- return (r$1) => e$3()(r$1);
1186
- }
1187
- function fromAsyncIterable(e$3) {
1188
- return (r$1) => {
1189
- var t$2 = e$3[asyncIteratorSymbol()] && e$3[asyncIteratorSymbol()]() || e$3;
1190
- var i$2 = !1;
1191
- var a$2 = !1;
1192
- var f$1 = !1;
1193
- var n$1;
1194
- r$1(start((async (e$4) => {
1195
- if (1 === e$4) {
1196
- i$2 = !0;
1197
- if (t$2.return) t$2.return();
1198
- } else if (a$2) f$1 = !0;
1199
- else {
1200
- for (f$1 = a$2 = !0; f$1 && !i$2;) if ((n$1 = await t$2.next()).done) {
1201
- i$2 = !0;
1202
- if (t$2.return) await t$2.return();
1203
- r$1(0);
1204
- } else try {
1205
- f$1 = !1;
1206
- r$1(push(n$1.value));
1207
- } catch (e$5) {
1208
- if (t$2.throw) {
1209
- if (i$2 = !!(await t$2.throw(e$5)).done) r$1(0);
1210
- } else throw e$5;
1211
- }
1212
- a$2 = !1;
1213
- }
1214
- })));
1215
- };
1216
- }
1217
- function fromIterable(e$3) {
1218
- if (e$3[Symbol.asyncIterator]) return fromAsyncIterable(e$3);
1219
- return (r$1) => {
1220
- var t$2 = e$3[Symbol.iterator]();
1221
- var i$2 = !1;
1222
- var a$2 = !1;
1223
- var f$1 = !1;
1224
- var n$1;
1225
- r$1(start(((e$4) => {
1226
- if (1 === e$4) {
1227
- i$2 = !0;
1228
- if (t$2.return) t$2.return();
1229
- } else if (a$2) f$1 = !0;
1230
- else {
1231
- for (f$1 = a$2 = !0; f$1 && !i$2;) if ((n$1 = t$2.next()).done) {
1232
- i$2 = !0;
1233
- if (t$2.return) t$2.return();
1234
- r$1(0);
1235
- } else try {
1236
- f$1 = !1;
1237
- r$1(push(n$1.value));
1238
- } catch (e$5) {
1239
- if (t$2.throw) {
1240
- if (i$2 = !!t$2.throw(e$5).done) r$1(0);
1241
- } else throw e$5;
1242
- }
1243
- a$2 = !1;
1244
- }
1245
- })));
1246
- };
1247
- }
1248
- var r = fromIterable;
1249
- function fromValue(e$3) {
1250
- return (r$1) => {
1251
- var t$2 = !1;
1252
- r$1(start(((i$2) => {
1253
- if (1 === i$2) t$2 = !0;
1254
- else if (!t$2) {
1255
- t$2 = !0;
1256
- r$1(push(e$3));
1257
- r$1(0);
1258
- }
1259
- })));
1260
- };
1261
- }
1262
- function make(e$3) {
1263
- return (r$1) => {
1264
- var t$2 = !1;
1265
- var i$2 = e$3({
1266
- next(e$4) {
1267
- if (!t$2) r$1(push(e$4));
1268
- },
1269
- complete() {
1270
- if (!t$2) {
1271
- t$2 = !0;
1272
- r$1(0);
1273
- }
1274
- }
1275
- });
1276
- r$1(start(((e$4) => {
1277
- if (1 === e$4 && !t$2) {
1278
- t$2 = !0;
1279
- i$2();
1280
- }
1281
- })));
1282
- };
1283
- }
1284
- function makeSubject() {
1285
- var e$3;
1286
- var r$1;
1287
- return {
1288
- source: share(make(((t$2) => {
1289
- e$3 = t$2.next;
1290
- r$1 = t$2.complete;
1291
- return teardownPlaceholder;
1292
- }))),
1293
- next(r$2) {
1294
- if (e$3) e$3(r$2);
1295
- },
1296
- complete() {
1297
- if (r$1) r$1();
1298
- }
1299
- };
1300
- }
1301
- function subscribe(r$1) {
1302
- return (t$2) => {
1303
- var i$2 = e$1;
1304
- var a$2 = !1;
1305
- t$2(((e$3) => {
1306
- if (0 === e$3) a$2 = !0;
1307
- else if (0 === e$3.tag) (i$2 = e$3[0])(0);
1308
- else if (!a$2) {
1309
- r$1(e$3[0]);
1310
- i$2(0);
1311
- }
1312
- }));
1313
- return { unsubscribe() {
1314
- if (!a$2) {
1315
- a$2 = !0;
1316
- i$2(1);
1317
- }
1318
- } };
1319
- };
1320
- }
1321
- function publish(e$3) {
1322
- subscribe(((e$4) => {}))(e$3);
1323
- }
1324
- function toPromise(r$1) {
1325
- return new Promise(((t$2) => {
1326
- var i$2 = e$1;
1327
- var a$2;
1328
- r$1(((e$3) => {
1329
- if (0 === e$3) Promise.resolve(a$2).then(t$2);
1330
- else if (0 === e$3.tag) (i$2 = e$3[0])(0);
1331
- else {
1332
- a$2 = e$3[0];
1333
- i$2(0);
1334
- }
1335
- }));
1336
- }));
1337
- }
1338
-
1339
- //#endregion
1340
- //#region ../node_modules/@urql/core/dist/urql-core-chunk.mjs
1341
- var rehydrateGraphQlError = (r$1) => {
1342
- if (r$1 && "string" == typeof r$1.message && (r$1.extensions || "GraphQLError" === r$1.name)) return r$1;
1343
- else if ("object" == typeof r$1 && "string" == typeof r$1.message) return new GraphQLError(r$1.message, r$1.nodes, r$1.source, r$1.positions, r$1.path, r$1, r$1.extensions || {});
1344
- else return new GraphQLError(r$1);
1345
- };
1346
- var CombinedError = class extends Error {
1347
- constructor(e$3) {
1348
- var r$1 = (e$3.graphQLErrors || []).map(rehydrateGraphQlError);
1349
- var t$2 = ((e$4, r$2) => {
1350
- var t$3 = "";
1351
- if (e$4) return `[Network] ${e$4.message}`;
1352
- if (r$2) for (var a$2 = 0, n$1 = r$2.length; a$2 < n$1; a$2++) {
1353
- if (t$3) t$3 += "\n";
1354
- t$3 += `[GraphQL] ${r$2[a$2].message}`;
1355
- }
1356
- return t$3;
1357
- })(e$3.networkError, r$1);
1358
- super(t$2);
1359
- this.name = "CombinedError";
1360
- this.message = t$2;
1361
- this.graphQLErrors = r$1;
1362
- this.networkError = e$3.networkError;
1363
- this.response = e$3.response;
1364
- }
1365
- toString() {
1366
- return this.message;
1367
- }
1368
- };
1369
- var phash = (e$3, r$1) => {
1370
- var t$2 = 0 | (r$1 || 5381);
1371
- for (var a$2 = 0, n$1 = 0 | e$3.length; a$2 < n$1; a$2++) t$2 = (t$2 << 5) + t$2 + e$3.charCodeAt(a$2);
1372
- return t$2;
1373
- };
1374
- var i = /* @__PURE__ */ new Set();
1375
- var f = /* @__PURE__ */ new WeakMap();
1376
- var stringify = (e$3, r$1) => {
1377
- if (null === e$3 || i.has(e$3)) return "null";
1378
- else if ("object" != typeof e$3) return JSON.stringify(e$3) || "";
1379
- else if (e$3.toJSON) return stringify(e$3.toJSON(), r$1);
1380
- else if (Array.isArray(e$3)) {
1381
- var t$2 = "[";
1382
- for (var a$2 = 0, n$1 = e$3.length; a$2 < n$1; a$2++) {
1383
- if (t$2.length > 1) t$2 += ",";
1384
- t$2 += stringify(e$3[a$2], r$1) || "null";
1385
- }
1386
- return t$2 += "]";
1387
- } else if (!r$1 && (d !== NoopConstructor && e$3 instanceof d || l !== NoopConstructor && e$3 instanceof l)) return "null";
1388
- var o$1 = Object.keys(e$3).sort();
1389
- if (!o$1.length && e$3.constructor && Object.getPrototypeOf(e$3).constructor !== Object.prototype.constructor) {
1390
- var s = f.get(e$3) || Math.random().toString(36).slice(2);
1391
- f.set(e$3, s);
1392
- return stringify({ __key: s }, r$1);
1393
- }
1394
- i.add(e$3);
1395
- var c$1 = "{";
1396
- for (var v$1 = 0, u$2 = o$1.length; v$1 < u$2; v$1++) {
1397
- var p$1 = stringify(e$3[o$1[v$1]], r$1);
1398
- if (p$1) {
1399
- if (c$1.length > 1) c$1 += ",";
1400
- c$1 += stringify(o$1[v$1], r$1) + ":" + p$1;
1401
- }
1402
- }
1403
- i.delete(e$3);
1404
- return c$1 += "}";
1405
- };
1406
- var extract = (e$3, r$1, t$2) => {
1407
- if (null == t$2 || "object" != typeof t$2 || t$2.toJSON || i.has(t$2)) {} else if (Array.isArray(t$2)) for (var a$2 = 0, n$1 = t$2.length; a$2 < n$1; a$2++) extract(e$3, `${r$1}.${a$2}`, t$2[a$2]);
1408
- else if (t$2 instanceof d || t$2 instanceof l) e$3.set(r$1, t$2);
1409
- else {
1410
- i.add(t$2);
1411
- for (var o$1 in t$2) extract(e$3, `${r$1}.${o$1}`, t$2[o$1]);
1412
- }
1413
- };
1414
- var stringifyVariables = (e$3, r$1) => {
1415
- i.clear();
1416
- return stringify(e$3, r$1 || !1);
1417
- };
1418
- var NoopConstructor = class {};
1419
- var d = "undefined" != typeof File ? File : NoopConstructor;
1420
- var l = "undefined" != typeof Blob ? Blob : NoopConstructor;
1421
- var c = /("{3}[\s\S]*"{3}|"(?:\\.|[^"])*")/g;
1422
- var v = /(?:#[^\n\r]+)?(?:[\r\n]+|$)/g;
1423
- var replaceOutsideStrings = (e$3, r$1) => r$1 % 2 == 0 ? e$3.replace(v, "\n") : e$3;
1424
- var sanitizeDocument = (e$3) => e$3.split(c).map(replaceOutsideStrings).join("").trim();
1425
- var u = /* @__PURE__ */ new Map();
1426
- var p = /* @__PURE__ */ new Map();
1427
- var stringifyDocument = (e$3) => {
1428
- var t$2;
1429
- if ("string" == typeof e$3) t$2 = sanitizeDocument(e$3);
1430
- else if (e$3.loc && p.get(e$3.__key) === e$3) t$2 = e$3.loc.source.body;
1431
- else {
1432
- t$2 = u.get(e$3) || sanitizeDocument(print(e$3));
1433
- u.set(e$3, t$2);
1434
- }
1435
- if ("string" != typeof e$3 && !e$3.loc) e$3.loc = {
1436
- start: 0,
1437
- end: t$2.length,
1438
- source: {
1439
- body: t$2,
1440
- name: "gql",
1441
- locationOffset: {
1442
- line: 1,
1443
- column: 1
1444
- }
1445
- }
1446
- };
1447
- return t$2;
1448
- };
1449
- var hashDocument = (e$3) => {
1450
- var r$1;
1451
- if (e$3.documentId) r$1 = phash(e$3.documentId);
1452
- else {
1453
- r$1 = phash(stringifyDocument(e$3));
1454
- if (e$3.definitions) {
1455
- var t$2 = getOperationName(e$3);
1456
- if (t$2) r$1 = phash(`\n# ${t$2}`, r$1);
1457
- }
1458
- }
1459
- return r$1;
1460
- };
1461
- var keyDocument = (e$3) => {
1462
- var r$1;
1463
- var t$2;
1464
- if ("string" == typeof e$3) {
1465
- r$1 = hashDocument(e$3);
1466
- t$2 = p.get(r$1) || parse(e$3, { noLocation: !0 });
1467
- } else {
1468
- r$1 = e$3.__key || hashDocument(e$3);
1469
- t$2 = p.get(r$1) || e$3;
1470
- }
1471
- if (!t$2.loc) stringifyDocument(t$2);
1472
- t$2.__key = r$1;
1473
- p.set(r$1, t$2);
1474
- return t$2;
1475
- };
1476
- var createRequest = (e$3, r$1, t$2) => {
1477
- var a$2 = r$1 || {};
1478
- var n$1 = keyDocument(e$3);
1479
- var o$1 = stringifyVariables(a$2, !0);
1480
- var s = n$1.__key;
1481
- if ("{}" !== o$1) s = phash(o$1, s);
1482
- return {
1483
- key: s,
1484
- query: n$1,
1485
- variables: a$2,
1486
- extensions: t$2
1487
- };
1488
- };
1489
- var getOperationName = (e$3) => {
1490
- for (var r$1 = 0, a$2 = e$3.definitions.length; r$1 < a$2; r$1++) {
1491
- var n$1 = e$3.definitions[r$1];
1492
- if (n$1.kind === e.OPERATION_DEFINITION) return n$1.name ? n$1.name.value : void 0;
1493
- }
1494
- };
1495
- var getOperationType = (e$3) => {
1496
- for (var r$1 = 0, a$2 = e$3.definitions.length; r$1 < a$2; r$1++) {
1497
- var n$1 = e$3.definitions[r$1];
1498
- if (n$1.kind === e.OPERATION_DEFINITION) return n$1.operation;
1499
- }
1500
- };
1501
- var makeResult = (e$3, r$1, t$2) => {
1502
- if (!("data" in r$1 || "errors" in r$1 && Array.isArray(r$1.errors))) throw new Error("No Content");
1503
- var a$2 = "subscription" === e$3.kind;
1504
- return {
1505
- operation: e$3,
1506
- data: r$1.data,
1507
- error: Array.isArray(r$1.errors) ? new CombinedError({
1508
- graphQLErrors: r$1.errors,
1509
- response: t$2
1510
- }) : void 0,
1511
- extensions: r$1.extensions ? { ...r$1.extensions } : void 0,
1512
- hasNext: null == r$1.hasNext ? a$2 : r$1.hasNext,
1513
- stale: !1
1514
- };
1515
- };
1516
- var deepMerge = (e$3, r$1) => {
1517
- if ("object" == typeof e$3 && null != e$3) {
1518
- if (Array.isArray(e$3)) {
1519
- e$3 = [...e$3];
1520
- for (var t$2 = 0, a$2 = r$1.length; t$2 < a$2; t$2++) e$3[t$2] = deepMerge(e$3[t$2], r$1[t$2]);
1521
- return e$3;
1522
- }
1523
- if (!e$3.constructor || e$3.constructor === Object) {
1524
- e$3 = { ...e$3 };
1525
- for (var n$1 in r$1) e$3[n$1] = deepMerge(e$3[n$1], r$1[n$1]);
1526
- return e$3;
1527
- }
1528
- }
1529
- return r$1;
1530
- };
1531
- var mergeResultPatch = (e$3, r$1, t$2, a$2) => {
1532
- var n$1 = e$3.error ? e$3.error.graphQLErrors : [];
1533
- var o$1 = !!e$3.extensions || !!(r$1.payload || r$1).extensions;
1534
- var s = {
1535
- ...e$3.extensions,
1536
- ...(r$1.payload || r$1).extensions
1537
- };
1538
- var i$2 = r$1.incremental;
1539
- if ("path" in r$1) i$2 = [r$1];
1540
- var f$1 = { data: e$3.data };
1541
- if (i$2) {
1542
- var _loop = function() {
1543
- var e$4 = i$2[d$2];
1544
- if (Array.isArray(e$4.errors)) n$1.push(...e$4.errors);
1545
- if (e$4.extensions) {
1546
- Object.assign(s, e$4.extensions);
1547
- o$1 = !0;
1548
- }
1549
- var r$2 = "data";
1550
- var t$3 = f$1;
1551
- var l$2 = [];
1552
- if (e$4.path) l$2 = e$4.path;
1553
- else if (a$2) {
1554
- var c$1 = a$2.find(((r$3) => r$3.id === e$4.id));
1555
- if (e$4.subPath) l$2 = [...c$1.path, ...e$4.subPath];
1556
- else l$2 = c$1.path;
1557
- }
1558
- for (var v$1 = 0, u$2 = l$2.length; v$1 < u$2; r$2 = l$2[v$1++]) t$3 = t$3[r$2] = Array.isArray(t$3[r$2]) ? [...t$3[r$2]] : { ...t$3[r$2] };
1559
- if (e$4.items) {
1560
- var p$1 = +r$2 >= 0 ? r$2 : 0;
1561
- for (var h$1 = 0, y$1 = e$4.items.length; h$1 < y$1; h$1++) t$3[p$1 + h$1] = deepMerge(t$3[p$1 + h$1], e$4.items[h$1]);
1562
- } else if (void 0 !== e$4.data) t$3[r$2] = deepMerge(t$3[r$2], e$4.data);
1563
- };
1564
- for (var d$2 = 0, l$1 = i$2.length; d$2 < l$1; d$2++) _loop();
1565
- } else {
1566
- f$1.data = (r$1.payload || r$1).data || e$3.data;
1567
- n$1 = r$1.errors || r$1.payload && r$1.payload.errors || n$1;
1568
- }
1569
- return {
1570
- operation: e$3.operation,
1571
- data: f$1.data,
1572
- error: n$1.length ? new CombinedError({
1573
- graphQLErrors: n$1,
1574
- response: t$2
1575
- }) : void 0,
1576
- extensions: o$1 ? s : void 0,
1577
- hasNext: null != r$1.hasNext ? r$1.hasNext : e$3.hasNext,
1578
- stale: !1
1579
- };
1580
- };
1581
- var makeErrorResult = (e$3, r$1, t$2) => ({
1582
- operation: e$3,
1583
- data: void 0,
1584
- error: new CombinedError({
1585
- networkError: r$1,
1586
- response: t$2
1587
- }),
1588
- extensions: void 0,
1589
- hasNext: !1,
1590
- stale: !1
1591
- });
1592
- function makeFetchBody(e$3) {
1593
- var r$1 = {
1594
- query: void 0,
1595
- documentId: void 0,
1596
- operationName: getOperationName(e$3.query),
1597
- variables: e$3.variables || void 0,
1598
- extensions: e$3.extensions
1599
- };
1600
- if ("documentId" in e$3.query && e$3.query.documentId && (!e$3.query.definitions || !e$3.query.definitions.length)) r$1.documentId = e$3.query.documentId;
1601
- else if (!e$3.extensions || !e$3.extensions.persistedQuery || e$3.extensions.persistedQuery.miss) r$1.query = stringifyDocument(e$3.query);
1602
- return r$1;
1603
- }
1604
- var makeFetchURL = (e$3, r$1) => {
1605
- var t$2 = "query" === e$3.kind && e$3.context.preferGetMethod;
1606
- if (!t$2 || !r$1) return e$3.context.url;
1607
- var a$2 = splitOutSearchParams(e$3.context.url);
1608
- for (var n$1 in r$1) {
1609
- var o$1 = r$1[n$1];
1610
- if (o$1) a$2[1].set(n$1, "object" == typeof o$1 ? stringifyVariables(o$1) : o$1);
1611
- }
1612
- var s = a$2.join("?");
1613
- if (s.length > 2047 && "force" !== t$2) {
1614
- e$3.context.preferGetMethod = !1;
1615
- return e$3.context.url;
1616
- }
1617
- return s;
1618
- };
1619
- var splitOutSearchParams = (e$3) => {
1620
- var r$1 = e$3.indexOf("?");
1621
- return r$1 > -1 ? [e$3.slice(0, r$1), new URLSearchParams(e$3.slice(r$1 + 1))] : [e$3, new URLSearchParams()];
1622
- };
1623
- var serializeBody = (e$3, r$1) => {
1624
- if (r$1 && !("query" === e$3.kind && !!e$3.context.preferGetMethod)) {
1625
- var t$2 = stringifyVariables(r$1);
1626
- var a$2 = ((e$4) => {
1627
- var r$2 = /* @__PURE__ */ new Map();
1628
- if (d !== NoopConstructor || l !== NoopConstructor) {
1629
- i.clear();
1630
- extract(r$2, "variables", e$4);
1631
- }
1632
- return r$2;
1633
- })(r$1.variables);
1634
- if (a$2.size) {
1635
- var n$1 = new FormData();
1636
- n$1.append("operations", t$2);
1637
- n$1.append("map", stringifyVariables({ ...[...a$2.keys()].map(((e$4) => [e$4])) }));
1638
- var o$1 = 0;
1639
- for (var s of a$2.values()) n$1.append("" + o$1++, s);
1640
- return n$1;
1641
- }
1642
- return t$2;
1643
- }
1644
- };
1645
- var makeFetchOptions = (e$3, r$1) => {
1646
- var t$2 = { accept: "subscription" === e$3.kind ? "text/event-stream, multipart/mixed" : "application/graphql-response+json, application/graphql+json, application/json, text/event-stream, multipart/mixed" };
1647
- var a$2 = ("function" == typeof e$3.context.fetchOptions ? e$3.context.fetchOptions() : e$3.context.fetchOptions) || {};
1648
- if (a$2.headers) if (((e$4) => "has" in e$4 && !Object.keys(e$4).length)(a$2.headers)) a$2.headers.forEach(((e$4, r$2) => {
1649
- t$2[r$2] = e$4;
1650
- }));
1651
- else if (Array.isArray(a$2.headers)) a$2.headers.forEach(((e$4, r$2) => {
1652
- if (Array.isArray(e$4)) if (t$2[e$4[0]]) t$2[e$4[0]] = `${t$2[e$4[0]]},${e$4[1]}`;
1653
- else t$2[e$4[0]] = e$4[1];
1654
- else t$2[r$2] = e$4;
1655
- }));
1656
- else for (var n$1 in a$2.headers) t$2[n$1.toLowerCase()] = a$2.headers[n$1];
1657
- var o$1 = serializeBody(e$3, r$1);
1658
- if ("string" == typeof o$1 && !t$2["content-type"]) t$2["content-type"] = "application/json";
1659
- return {
1660
- ...a$2,
1661
- method: o$1 ? "POST" : "GET",
1662
- body: o$1,
1663
- headers: t$2
1664
- };
1665
- };
1666
- var h = /boundary="?([^=";]+)"?/i;
1667
- var y = /data: ?([^\n]+)/;
1668
- async function* streamBody(e$3) {
1669
- if (e$3.body[Symbol.asyncIterator]) for await (var r$1 of e$3.body) yield r$1;
1670
- else {
1671
- var t$2 = e$3.body.getReader();
1672
- var a$2;
1673
- try {
1674
- while (!(a$2 = await t$2.read()).done) yield a$2.value;
1675
- } finally {
1676
- t$2.cancel();
1677
- }
1678
- }
1679
- }
1680
- async function* streamToBoundedChunks(e$3, r$1) {
1681
- var t$2 = "undefined" != typeof TextDecoder ? new TextDecoder() : null;
1682
- var a$2 = "";
1683
- var n$1;
1684
- for await (var o$1 of e$3) {
1685
- a$2 += "Buffer" === o$1.constructor.name ? o$1.toString() : t$2.decode(o$1, { stream: !0 });
1686
- while ((n$1 = a$2.indexOf(r$1)) > -1) {
1687
- yield a$2.slice(0, n$1);
1688
- a$2 = a$2.slice(n$1 + r$1.length);
1689
- }
1690
- }
1691
- }
1692
- async function* fetchOperation(e$3, r$1, t$2) {
1693
- var a$2 = !0;
1694
- var n$1 = null;
1695
- var o$1;
1696
- try {
1697
- yield await Promise.resolve();
1698
- var s = (o$1 = await (e$3.context.fetch || fetch)(r$1, t$2)).headers.get("Content-Type") || "";
1699
- var i$2;
1700
- if (/multipart\/mixed/i.test(s)) i$2 = async function* parseMultipartMixed(e$4, r$2) {
1701
- var t$3 = e$4.match(h);
1702
- var a$3 = "--" + (t$3 ? t$3[1] : "-");
1703
- var n$2 = !0;
1704
- var o$2;
1705
- for await (var s$1 of streamToBoundedChunks(streamBody(r$2), "\r\n" + a$3)) {
1706
- if (n$2) {
1707
- n$2 = !1;
1708
- var i$3 = s$1.indexOf(a$3);
1709
- if (i$3 > -1) s$1 = s$1.slice(i$3 + a$3.length);
1710
- else continue;
1711
- }
1712
- try {
1713
- yield o$2 = JSON.parse(s$1.slice(s$1.indexOf("\r\n\r\n") + 4));
1714
- } catch (e$5) {
1715
- if (!o$2) throw e$5;
1716
- }
1717
- if (o$2 && !1 === o$2.hasNext) break;
1718
- }
1719
- if (o$2 && !1 !== o$2.hasNext) yield { hasNext: !1 };
1720
- }(s, o$1);
1721
- else if (/text\/event-stream/i.test(s)) i$2 = async function* parseEventStream(e$4) {
1722
- var r$2;
1723
- for await (var t$3 of streamToBoundedChunks(streamBody(e$4), "\n\n")) {
1724
- var a$3 = t$3.match(y);
1725
- if (a$3) {
1726
- var n$2 = a$3[1];
1727
- try {
1728
- yield r$2 = JSON.parse(n$2);
1729
- } catch (e$5) {
1730
- if (!r$2) throw e$5;
1731
- }
1732
- if (r$2 && !1 === r$2.hasNext) break;
1733
- }
1734
- }
1735
- if (r$2 && !1 !== r$2.hasNext) yield { hasNext: !1 };
1736
- }(o$1);
1737
- else if (!/text\//i.test(s)) i$2 = async function* parseJSON(e$4) {
1738
- yield JSON.parse(await e$4.text());
1739
- }(o$1);
1740
- else i$2 = async function* parseMaybeJSON(e$4) {
1741
- var r$2 = await e$4.text();
1742
- try {
1743
- var t$3 = JSON.parse(r$2);
1744
- if ("production" !== process.env.NODE_ENV) console.warn("Found response with content-type \"text/plain\" but it had a valid \"application/json\" response.");
1745
- yield t$3;
1746
- } catch (e$5) {
1747
- throw new Error(r$2);
1748
- }
1749
- }(o$1);
1750
- var f$1;
1751
- for await (var d$2 of i$2) {
1752
- if (d$2.pending && !n$1) f$1 = d$2.pending;
1753
- else if (d$2.pending) f$1 = [...f$1, ...d$2.pending];
1754
- n$1 = n$1 ? mergeResultPatch(n$1, d$2, o$1, f$1) : makeResult(e$3, d$2, o$1);
1755
- a$2 = !1;
1756
- yield n$1;
1757
- a$2 = !0;
1758
- }
1759
- if (!n$1) yield n$1 = makeResult(e$3, {}, o$1);
1760
- } catch (r$2) {
1761
- if (!a$2) throw r$2;
1762
- yield makeErrorResult(e$3, o$1 && (o$1.status < 200 || o$1.status >= 300) && o$1.statusText ? new Error(o$1.statusText) : r$2, o$1);
1763
- }
1764
- }
1765
- function makeFetchSource(e$3, r$1, t$2) {
1766
- var a$2;
1767
- if ("undefined" != typeof AbortController) t$2.signal = (a$2 = new AbortController()).signal;
1768
- return onEnd((() => {
1769
- if (a$2) a$2.abort();
1770
- }))(filter(((e$4) => !!e$4))(fromAsyncIterable(fetchOperation(e$3, r$1, t$2))));
1771
- }
1772
-
1773
- //#endregion
1774
- //#region ../node_modules/@urql/core/dist/urql-core.mjs
1775
- var collectTypes = (e$3, r$1) => {
1776
- if (Array.isArray(e$3)) for (var t$2 = 0, n$1 = e$3.length; t$2 < n$1; t$2++) collectTypes(e$3[t$2], r$1);
1777
- else if ("object" == typeof e$3 && null !== e$3) for (var a$2 in e$3) if ("__typename" === a$2 && "string" == typeof e$3[a$2]) r$1.add(e$3[a$2]);
1778
- else collectTypes(e$3[a$2], r$1);
1779
- return r$1;
1780
- };
1781
- var formatNode = (r$1) => {
1782
- if ("definitions" in r$1) {
1783
- var t$2 = [];
1784
- for (var n$1 = 0, a$2 = r$1.definitions.length; n$1 < a$2; n$1++) {
1785
- var i$2 = formatNode(r$1.definitions[n$1]);
1786
- t$2.push(i$2);
1787
- }
1788
- return {
1789
- ...r$1,
1790
- definitions: t$2
1791
- };
1792
- }
1793
- if ("directives" in r$1 && r$1.directives && r$1.directives.length) {
1794
- var o$1 = [];
1795
- var s = {};
1796
- for (var c$1 = 0, u$2 = r$1.directives.length; c$1 < u$2; c$1++) {
1797
- var p$1 = r$1.directives[c$1];
1798
- var d$2 = p$1.name.value;
1799
- if ("_" !== d$2[0]) o$1.push(p$1);
1800
- else d$2 = d$2.slice(1);
1801
- s[d$2] = p$1;
1802
- }
1803
- r$1 = {
1804
- ...r$1,
1805
- directives: o$1,
1806
- _directives: s
1807
- };
1808
- }
1809
- if ("selectionSet" in r$1) {
1810
- var l$1 = [];
1811
- var v$1 = r$1.kind === e.OPERATION_DEFINITION;
1812
- if (r$1.selectionSet) {
1813
- for (var f$1 = 0, h$1 = r$1.selectionSet.selections.length; f$1 < h$1; f$1++) {
1814
- var k = r$1.selectionSet.selections[f$1];
1815
- v$1 = v$1 || k.kind === e.FIELD && "__typename" === k.name.value && !k.alias;
1816
- var y$1 = formatNode(k);
1817
- l$1.push(y$1);
1818
- }
1819
- if (!v$1) l$1.push({
1820
- kind: e.FIELD,
1821
- name: {
1822
- kind: e.NAME,
1823
- value: "__typename"
1824
- },
1825
- _generated: !0
1826
- });
1827
- return {
1828
- ...r$1,
1829
- selectionSet: {
1830
- ...r$1.selectionSet,
1831
- selections: l$1
1832
- }
1833
- };
1834
- }
1835
- }
1836
- return r$1;
1837
- };
1838
- var I = /* @__PURE__ */ new Map();
1839
- var formatDocument = (e$3) => {
1840
- var t$2 = keyDocument(e$3);
1841
- var n$1 = I.get(t$2.__key);
1842
- if (!n$1) {
1843
- I.set(t$2.__key, n$1 = formatNode(t$2));
1844
- Object.defineProperty(n$1, "__key", {
1845
- value: t$2.__key,
1846
- enumerable: !1
1847
- });
1848
- }
1849
- return n$1;
1850
- };
1851
- function withPromise(e$3) {
1852
- var source$ = (r$1) => e$3(r$1);
1853
- source$.toPromise = () => toPromise(take(1)(filter(((e$4) => !e$4.stale && !e$4.hasNext))(source$)));
1854
- source$.then = (e$4, r$1) => source$.toPromise().then(e$4, r$1);
1855
- source$.subscribe = (e$4) => subscribe(e$4)(source$);
1856
- return source$;
1857
- }
1858
- function makeOperation(e$3, r$1, t$2) {
1859
- return {
1860
- ...r$1,
1861
- kind: e$3,
1862
- context: r$1.context ? {
1863
- ...r$1.context,
1864
- ...t$2
1865
- } : t$2 || r$1.context
1866
- };
1867
- }
1868
- var addMetadata = (e$3, r$1) => makeOperation(e$3.kind, e$3, { meta: {
1869
- ...e$3.context.meta,
1870
- ...r$1
1871
- } });
1872
- var noop = () => {};
1873
- var shouldSkip = ({ kind: e$3 }) => "mutation" !== e$3 && "query" !== e$3;
1874
- var mapTypeNames = (e$3) => {
1875
- var r$1 = formatDocument(e$3.query);
1876
- if (r$1 !== e$3.query) {
1877
- var t$2 = makeOperation(e$3.kind, e$3);
1878
- t$2.query = r$1;
1879
- return t$2;
1880
- } else return e$3;
1881
- };
1882
- var cacheExchange = ({ forward: e$3, client: r$1, dispatchDebug: t$2 }) => {
1883
- var a$2 = /* @__PURE__ */ new Map();
1884
- var i$2 = /* @__PURE__ */ new Map();
1885
- var isOperationCached = (e$4) => "query" === e$4.kind && "network-only" !== e$4.context.requestPolicy && ("cache-only" === e$4.context.requestPolicy || a$2.has(e$4.key));
1886
- return (o$1) => {
1887
- return merge([map(((e$4) => {
1888
- var i$3 = a$2.get(e$4.key);
1889
- "production" !== process.env.NODE_ENV && t$2({
1890
- operation: e$4,
1891
- ...i$3 ? {
1892
- type: "cacheHit",
1893
- message: "The result was successfully retrieved from the cache"
1894
- } : {
1895
- type: "cacheMiss",
1896
- message: "The result could not be retrieved from the cache"
1897
- },
1898
- source: "cacheExchange"
1899
- });
1900
- var o$2 = i$3 || makeResult(e$4, { data: null });
1901
- o$2 = {
1902
- ...o$2,
1903
- operation: addMetadata(e$4, { cacheOutcome: i$3 ? "hit" : "miss" })
1904
- };
1905
- if ("cache-and-network" === e$4.context.requestPolicy) {
1906
- o$2.stale = !0;
1907
- reexecuteOperation(r$1, e$4);
1908
- }
1909
- return o$2;
1910
- }))(filter(((e$4) => !shouldSkip(e$4) && isOperationCached(e$4)))(o$1)), onPush(((e$4) => {
1911
- var { operation: n$1 } = e$4;
1912
- if (!n$1) return;
1913
- var o$2 = n$1.context.additionalTypenames || [];
1914
- if ("subscription" !== e$4.operation.kind) o$2 = ((e$5) => [...collectTypes(e$5, /* @__PURE__ */ new Set())])(e$4.data).concat(o$2);
1915
- if ("mutation" === e$4.operation.kind || "subscription" === e$4.operation.kind) {
1916
- var s = /* @__PURE__ */ new Set();
1917
- "production" !== process.env.NODE_ENV && t$2({
1918
- type: "cacheInvalidation",
1919
- message: `The following typenames have been invalidated: ${o$2}`,
1920
- operation: n$1,
1921
- data: {
1922
- typenames: o$2,
1923
- response: e$4
1924
- },
1925
- source: "cacheExchange"
1926
- });
1927
- for (var c$1 = 0; c$1 < o$2.length; c$1++) {
1928
- var u$2 = o$2[c$1];
1929
- var p$1 = i$2.get(u$2);
1930
- if (!p$1) i$2.set(u$2, p$1 = /* @__PURE__ */ new Set());
1931
- for (var d$2 of p$1.values()) s.add(d$2);
1932
- p$1.clear();
1933
- }
1934
- for (var l$1 of s.values()) if (a$2.has(l$1)) {
1935
- n$1 = a$2.get(l$1).operation;
1936
- a$2.delete(l$1);
1937
- reexecuteOperation(r$1, n$1);
1938
- }
1939
- } else if ("query" === n$1.kind && e$4.data) {
1940
- a$2.set(n$1.key, e$4);
1941
- for (var v$1 = 0; v$1 < o$2.length; v$1++) {
1942
- var f$1 = o$2[v$1];
1943
- var h$1 = i$2.get(f$1);
1944
- if (!h$1) i$2.set(f$1, h$1 = /* @__PURE__ */ new Set());
1945
- h$1.add(n$1.key);
1946
- }
1947
- }
1948
- }))(e$3(filter(((e$4) => "query" !== e$4.kind || "cache-only" !== e$4.context.requestPolicy))(map(((e$4) => addMetadata(e$4, { cacheOutcome: "miss" })))(merge([map(mapTypeNames)(filter(((e$4) => !shouldSkip(e$4) && !isOperationCached(e$4)))(o$1)), filter(((e$4) => shouldSkip(e$4)))(o$1)])))))]);
1949
- };
1950
- };
1951
- var reexecuteOperation = (e$3, r$1) => e$3.reexecuteOperation(makeOperation(r$1.kind, r$1, { requestPolicy: "network-only" }));
1952
- var fetchExchange = ({ forward: e$3, dispatchDebug: r$1 }) => (t$2) => {
1953
- return merge([mergeMap(((e$4) => {
1954
- var n$1 = makeFetchBody(e$4);
1955
- var a$2 = makeFetchURL(e$4, n$1);
1956
- var i$2 = makeFetchOptions(e$4, n$1);
1957
- "production" !== process.env.NODE_ENV && r$1({
1958
- type: "fetchRequest",
1959
- message: "A fetch request is being executed.",
1960
- operation: e$4,
1961
- data: {
1962
- url: a$2,
1963
- fetchOptions: i$2
1964
- },
1965
- source: "fetchExchange"
1966
- });
1967
- var s = takeUntil(filter(((r$2) => "teardown" === r$2.kind && r$2.key === e$4.key))(t$2))(makeFetchSource(e$4, a$2, i$2));
1968
- if ("production" !== process.env.NODE_ENV) return onPush(((t$3) => {
1969
- var n$2 = !t$3.data ? t$3.error : void 0;
1970
- "production" !== process.env.NODE_ENV && r$1({
1971
- type: n$2 ? "fetchError" : "fetchSuccess",
1972
- message: `A ${n$2 ? "failed" : "successful"} fetch response has been returned.`,
1973
- operation: e$4,
1974
- data: {
1975
- url: a$2,
1976
- fetchOptions: i$2,
1977
- value: n$2 || t$3
1978
- },
1979
- source: "fetchExchange"
1980
- });
1981
- }))(s);
1982
- return s;
1983
- }))(filter(((e$4) => "teardown" !== e$4.kind && ("subscription" !== e$4.kind || !!e$4.context.fetchSubscriptions)))(t$2)), e$3(filter(((e$4) => "teardown" === e$4.kind || "subscription" === e$4.kind && !e$4.context.fetchSubscriptions))(t$2))]);
1984
- };
1985
- var composeExchanges = (e$3) => ({ client: r$1, forward: t$2, dispatchDebug: n$1 }) => e$3.reduceRight(((e$4, t$3) => {
1986
- var a$2 = !1;
1987
- return t$3({
1988
- client: r$1,
1989
- forward(r$2) {
1990
- if ("production" !== process.env.NODE_ENV) {
1991
- if (a$2) throw new Error("forward() must only be called once in each Exchange.");
1992
- a$2 = !0;
1993
- }
1994
- return share(e$4(share(r$2)));
1995
- },
1996
- dispatchDebug(e$5) {
1997
- "production" !== process.env.NODE_ENV && n$1({
1998
- timestamp: Date.now(),
1999
- source: t$3.name,
2000
- ...e$5
2001
- });
2002
- }
2003
- });
2004
- }), t$2);
2005
- var fallbackExchange = ({ dispatchDebug: e$3 }) => (r$1) => {
2006
- if ("production" !== process.env.NODE_ENV) r$1 = onPush(((r$2) => {
2007
- if ("teardown" !== r$2.kind && "production" !== process.env.NODE_ENV) {
2008
- var t$2 = `No exchange has handled operations of kind "${r$2.kind}". Check whether you've added an exchange responsible for these operations.`;
2009
- "production" !== process.env.NODE_ENV && e$3({
2010
- type: "fallbackCatch",
2011
- message: t$2,
2012
- operation: r$2,
2013
- source: "fallbackExchange"
2014
- });
2015
- console.warn(t$2);
2016
- }
2017
- }))(r$1);
2018
- return filter(((e$4) => !1))(r$1);
2019
- };
2020
- var C = function Client(e$3) {
2021
- if ("production" !== process.env.NODE_ENV && !e$3.url) throw new Error("You are creating an urql-client without a url.");
2022
- var r$1 = 0;
2023
- var t$2 = /* @__PURE__ */ new Map();
2024
- var n$1 = /* @__PURE__ */ new Map();
2025
- var a$2 = /* @__PURE__ */ new Set();
2026
- var i$2 = [];
2027
- var o$1 = {
2028
- url: e$3.url,
2029
- fetchSubscriptions: e$3.fetchSubscriptions,
2030
- fetchOptions: e$3.fetchOptions,
2031
- fetch: e$3.fetch,
2032
- preferGetMethod: null != e$3.preferGetMethod ? e$3.preferGetMethod : "within-url-limit",
2033
- requestPolicy: e$3.requestPolicy || "cache-first"
2034
- };
2035
- var s = makeSubject();
2036
- function nextOperation(e$4) {
2037
- if ("mutation" === e$4.kind || "teardown" === e$4.kind || !a$2.has(e$4.key)) {
2038
- if ("teardown" === e$4.kind) a$2.delete(e$4.key);
2039
- else if ("mutation" !== e$4.kind) a$2.add(e$4.key);
2040
- s.next(e$4);
2041
- }
2042
- }
2043
- var c$1 = !1;
2044
- function dispatchOperation(e$4) {
2045
- if (e$4) nextOperation(e$4);
2046
- if (!c$1) {
2047
- c$1 = !0;
2048
- while (c$1 && (e$4 = i$2.shift())) nextOperation(e$4);
2049
- c$1 = !1;
2050
- }
2051
- }
2052
- var makeResultSource = (e$4) => {
2053
- var r$2 = takeUntil(filter(((r$3) => "teardown" === r$3.kind && r$3.key === e$4.key))(s.source))(filter(((r$3) => r$3.operation.kind === e$4.kind && r$3.operation.key === e$4.key && (!r$3.operation.context._instance || r$3.operation.context._instance === e$4.context._instance)))(E));
2054
- if ("query" !== e$4.kind) r$2 = takeWhile(((e$5) => !!e$5.hasNext), !0)(r$2);
2055
- else r$2 = switchMap(((r$3) => {
2056
- var t$3 = fromValue(r$3);
2057
- return r$3.stale || r$3.hasNext ? t$3 : merge([t$3, map((() => {
2058
- r$3.stale = !0;
2059
- return r$3;
2060
- }))(take(1)(filter(((r$4) => r$4.key === e$4.key))(s.source)))]);
2061
- }))(r$2);
2062
- if ("mutation" !== e$4.kind) r$2 = onEnd((() => {
2063
- a$2.delete(e$4.key);
2064
- t$2.delete(e$4.key);
2065
- n$1.delete(e$4.key);
2066
- c$1 = !1;
2067
- for (var r$3 = i$2.length - 1; r$3 >= 0; r$3--) if (i$2[r$3].key === e$4.key) i$2.splice(r$3, 1);
2068
- nextOperation(makeOperation("teardown", e$4, e$4.context));
2069
- }))(onPush(((r$3) => {
2070
- if (r$3.stale) if (!r$3.hasNext) a$2.delete(e$4.key);
2071
- else for (var n$2 = 0; n$2 < i$2.length; n$2++) {
2072
- var o$2 = i$2[n$2];
2073
- if (o$2.key === r$3.operation.key) {
2074
- a$2.delete(o$2.key);
2075
- break;
2076
- }
2077
- }
2078
- else if (!r$3.hasNext) a$2.delete(e$4.key);
2079
- t$2.set(e$4.key, r$3);
2080
- }))(r$2));
2081
- else r$2 = onStart((() => {
2082
- nextOperation(e$4);
2083
- }))(r$2);
2084
- return share(r$2);
2085
- };
2086
- var u$2 = this instanceof Client ? this : Object.create(Client.prototype);
2087
- var p$1 = Object.assign(u$2, {
2088
- suspense: !!e$3.suspense,
2089
- operations$: s.source,
2090
- reexecuteOperation(e$4) {
2091
- if ("teardown" === e$4.kind) dispatchOperation(e$4);
2092
- else if ("mutation" === e$4.kind) {
2093
- i$2.push(e$4);
2094
- Promise.resolve().then(dispatchOperation);
2095
- } else if (n$1.has(e$4.key)) {
2096
- var r$2 = !1;
2097
- for (var t$3 = 0; t$3 < i$2.length; t$3++) if (i$2[t$3].key === e$4.key) {
2098
- i$2[t$3] = e$4;
2099
- r$2 = !0;
2100
- }
2101
- if (!(r$2 || a$2.has(e$4.key) && "network-only" !== e$4.context.requestPolicy)) {
2102
- i$2.push(e$4);
2103
- Promise.resolve().then(dispatchOperation);
2104
- } else {
2105
- a$2.delete(e$4.key);
2106
- Promise.resolve().then(dispatchOperation);
2107
- }
2108
- }
2109
- },
2110
- createRequestOperation(e$4, t$3, n$2) {
2111
- if (!n$2) n$2 = {};
2112
- var a$3;
2113
- if ("production" !== process.env.NODE_ENV && "teardown" !== e$4 && (a$3 = getOperationType(t$3.query)) !== e$4) throw new Error(`Expected operation of type "${e$4}" but found "${a$3}"`);
2114
- return makeOperation(e$4, t$3, {
2115
- _instance: "mutation" === e$4 ? r$1 = r$1 + 1 | 0 : void 0,
2116
- ...o$1,
2117
- ...n$2,
2118
- requestPolicy: n$2.requestPolicy || o$1.requestPolicy,
2119
- suspense: n$2.suspense || !1 !== n$2.suspense && p$1.suspense
2120
- });
2121
- },
2122
- executeRequestOperation(e$4) {
2123
- if ("mutation" === e$4.kind) return withPromise(makeResultSource(e$4));
2124
- return withPromise(lazy((() => {
2125
- var r$2 = n$1.get(e$4.key);
2126
- if (!r$2) n$1.set(e$4.key, r$2 = makeResultSource(e$4));
2127
- r$2 = onStart((() => {
2128
- dispatchOperation(e$4);
2129
- }))(r$2);
2130
- var a$3 = t$2.get(e$4.key);
2131
- if ("query" === e$4.kind && a$3 && (a$3.stale || a$3.hasNext)) return switchMap(fromValue)(merge([r$2, filter(((r$3) => r$3 === t$2.get(e$4.key)))(fromValue(a$3))]));
2132
- else return r$2;
2133
- })));
2134
- },
2135
- executeQuery(e$4, r$2) {
2136
- var t$3 = p$1.createRequestOperation("query", e$4, r$2);
2137
- return p$1.executeRequestOperation(t$3);
2138
- },
2139
- executeSubscription(e$4, r$2) {
2140
- var t$3 = p$1.createRequestOperation("subscription", e$4, r$2);
2141
- return p$1.executeRequestOperation(t$3);
2142
- },
2143
- executeMutation(e$4, r$2) {
2144
- var t$3 = p$1.createRequestOperation("mutation", e$4, r$2);
2145
- return p$1.executeRequestOperation(t$3);
2146
- },
2147
- readQuery(e$4, r$2, t$3) {
2148
- var n$2 = null;
2149
- subscribe(((e$5) => {
2150
- n$2 = e$5;
2151
- }))(p$1.query(e$4, r$2, t$3)).unsubscribe();
2152
- return n$2;
2153
- },
2154
- query: (e$4, r$2, t$3) => p$1.executeQuery(createRequest(e$4, r$2), t$3),
2155
- subscription: (e$4, r$2, t$3) => p$1.executeSubscription(createRequest(e$4, r$2), t$3),
2156
- mutation: (e$4, r$2, t$3) => p$1.executeMutation(createRequest(e$4, r$2), t$3)
2157
- });
2158
- var d$2 = noop;
2159
- if ("production" !== process.env.NODE_ENV) {
2160
- var { next: f$1, source: x } = makeSubject();
2161
- p$1.subscribeToDebugTarget = (e$4) => subscribe(e$4)(x);
2162
- d$2 = f$1;
2163
- }
2164
- var E = share(composeExchanges(e$3.exchanges)({
2165
- client: p$1,
2166
- dispatchDebug: d$2,
2167
- forward: fallbackExchange({ dispatchDebug: d$2 })
2168
- })(s.source));
2169
- publish(E);
2170
- return p$1;
2171
- };
2172
-
2173
756
  //#endregion
2174
757
  //#region ../graphql/src/client/index.ts
2175
758
  const graphql = initGraphQLTada();
2176
- /**
2177
- * Create a type-safe Jive GraphQL client using urql
2178
- *
2179
- * @example
2180
- * ```typescript
2181
- * import { createJiveGraphqlClient, graphql } from '@jive-ai/graphql/client';
2182
- *
2183
- * const client = createJiveGraphqlClient({
2184
- * url: 'http://localhost:4000/graphql',
2185
- * apiKey: 'jive_xxx',
2186
- * });
2187
- *
2188
- * const GetTaskQuery = graphql(`
2189
- * query GetTask($id: ID!) {
2190
- * task(id: $id) {
2191
- * id
2192
- * title
2193
- * status
2194
- * }
2195
- * }
2196
- * `);
2197
- *
2198
- * const result = await client.request(GetTaskQuery, { id: '1' });
2199
- * // result.task is fully typed!
2200
- * ```
2201
- */
2202
- function createJiveGraphqlClient(config$2) {
2203
- const { url, apiKey, bearerToken, headers: customHeaders = {} } = config$2;
2204
- const urqlClient = new C({
2205
- url,
2206
- exchanges: [cacheExchange, fetchExchange],
2207
- fetchOptions: () => {
2208
- const headers = { ...customHeaders };
2209
- if (apiKey) headers["X-API-Key"] = apiKey;
2210
- if (bearerToken) headers["Authorization"] = `Bearer ${bearerToken}`;
2211
- return { headers };
2212
- }
2213
- });
2214
- return {
2215
- urql: urqlClient,
2216
- async request(document, variables) {
2217
- const result = await urqlClient.query(document, variables ?? {}).toPromise();
2218
- if (result.error) {
2219
- if (result.error.networkError) {
2220
- const cause = result.error.networkError.cause || result.error.networkError;
2221
- throw new Error(`GraphQL network error: ${cause?.message || cause}`, { cause });
2222
- }
2223
- throw new Error(`GraphQL error: ${result.error.message}`);
2224
- }
2225
- if (!result.data) throw new Error("No data returned from GraphQL");
2226
- return result.data;
2227
- },
2228
- async mutate(document, variables) {
2229
- const result = await urqlClient.mutation(document, variables ?? {}).toPromise();
2230
- if (result.error) {
2231
- console.error(result.error);
2232
- throw new Error(`GraphQL error: ${result.error.message}`);
2233
- }
2234
- if (!result.data) throw new Error("No data returned from GraphQL");
2235
- return result.data;
2236
- },
2237
- async requestWithErrors(document, variables) {
2238
- const result = await urqlClient.query(document, variables ?? {}).toPromise();
2239
- return {
2240
- data: result.data,
2241
- errors: result.error?.graphQLErrors?.map((e$3) => ({
2242
- message: e$3.message,
2243
- path: e$3.path
2244
- }))
2245
- };
2246
- }
2247
- };
2248
- }
2249
759
  const queries = {
2250
760
  GetTask: graphql(`
2251
761
  query GetTask($id: ID!) {
@@ -2782,11 +1292,18 @@ const cliMutations = {
2782
1292
  //#endregion
2783
1293
  //#region src/lib/graphql-client.ts
2784
1294
  let graphqlClient = null;
1295
+ function createGraphQLClient$1(apiKey) {
1296
+ const client = new GraphQLClient(GRAPHQL_API_URL, { headers: { "X-API-Key": apiKey } });
1297
+ return { async request(document, variables) {
1298
+ return client.request(document, variables);
1299
+ } };
1300
+ }
2785
1301
  async function getGraphQLClient() {
2786
- if (!graphqlClient) graphqlClient = createJiveGraphqlClient({
2787
- url: GRAPHQL_API_URL,
2788
- apiKey: (await getCredentials())?.token
2789
- });
1302
+ if (!graphqlClient) {
1303
+ const credentials = await getCredentials();
1304
+ if (!credentials?.token) throw new Error("No credentials found, run `jive login` first");
1305
+ graphqlClient = createGraphQLClient$1(credentials.token);
1306
+ }
2790
1307
  return graphqlClient;
2791
1308
  }
2792
1309
 
@@ -2839,14 +1356,14 @@ var ApiClient = class {
2839
1356
  })) };
2840
1357
  }
2841
1358
  async getProjects(teamId) {
2842
- return { projects: (await (await getGraphQLClient()).request(cliQueries.Projects, { teamId: String(teamId) })).projects.map((p$1) => ({
2843
- id: parseInt(p$1.id, 10),
2844
- name: p$1.name,
2845
- createdAt: new Date(p$1.createdAt)
1359
+ return { projects: (await (await getGraphQLClient()).request(cliQueries.Projects, { teamId: String(teamId) })).projects.map((p) => ({
1360
+ id: parseInt(p.id, 10),
1361
+ name: p.name,
1362
+ createdAt: new Date(p.createdAt)
2846
1363
  })) };
2847
1364
  }
2848
1365
  async createProject(teamId, data) {
2849
- const result = await (await getGraphQLClient()).mutate(cliMutations.CreateProject, { input: {
1366
+ const result = await (await getGraphQLClient()).request(cliMutations.CreateProject, { input: {
2850
1367
  teamId: String(teamId),
2851
1368
  name: data.name,
2852
1369
  description: data.description,
@@ -2862,7 +1379,7 @@ var ApiClient = class {
2862
1379
  };
2863
1380
  }
2864
1381
  async createTeam(name$1, description) {
2865
- const result = await (await getGraphQLClient()).mutate(cliMutations.CreateTeam, { input: {
1382
+ const result = await (await getGraphQLClient()).request(cliMutations.CreateTeam, { input: {
2866
1383
  name: name$1,
2867
1384
  description
2868
1385
  } });
@@ -2876,14 +1393,14 @@ var ApiClient = class {
2876
1393
  };
2877
1394
  }
2878
1395
  async inviteToTeam(teamId, email) {
2879
- const result = await (await getGraphQLClient()).mutate(cliMutations.InviteToTeam, { input: {
1396
+ const result = await (await getGraphQLClient()).request(cliMutations.InviteToTeam, { input: {
2880
1397
  teamId,
2881
1398
  email
2882
1399
  } });
2883
1400
  if (result.inviteToTeam.errors?.length) throw this.formatError({ message: result.inviteToTeam.errors[0].message });
2884
1401
  }
2885
1402
  async registerRunner(data) {
2886
- const result = await (await getGraphQLClient()).mutate(mutations.RegisterRunner, { input: {
1403
+ const result = await (await getGraphQLClient()).request(mutations.RegisterRunner, { input: {
2887
1404
  teamId: String(data.teamId),
2888
1405
  name: data.name,
2889
1406
  type: data.type.toUpperCase(),
@@ -2899,12 +1416,12 @@ var ApiClient = class {
2899
1416
  };
2900
1417
  }
2901
1418
  async getRunners(teamId) {
2902
- return (await (await getGraphQLClient()).request(cliQueries.Runners, { teamId })).runners.map((r$1) => ({
2903
- id: parseInt(r$1.id, 10),
2904
- name: r$1.name,
2905
- type: r$1.type.toLowerCase(),
2906
- status: r$1.status.toLowerCase(),
2907
- lastHeartbeat: r$1.lastHeartbeat || void 0
1419
+ return (await (await getGraphQLClient()).request(cliQueries.Runners, { teamId })).runners.map((r) => ({
1420
+ id: parseInt(r.id, 10),
1421
+ name: r.name,
1422
+ type: r.type.toLowerCase(),
1423
+ status: r.status.toLowerCase(),
1424
+ lastHeartbeat: r.lastHeartbeat || void 0
2908
1425
  }));
2909
1426
  }
2910
1427
  async getRunner(runnerId) {
@@ -2919,7 +1436,7 @@ var ApiClient = class {
2919
1436
  };
2920
1437
  }
2921
1438
  async updateRunnerStatus(runnerId, data) {
2922
- const result = await (await getGraphQLClient()).mutate(mutations.UpdateRunner, {
1439
+ const result = await (await getGraphQLClient()).request(mutations.UpdateRunner, {
2923
1440
  runnerId: String(runnerId),
2924
1441
  input: {
2925
1442
  status: data.status ? mapRunnerStatusToGraphQL(data.status) : void 0,
@@ -2931,7 +1448,7 @@ var ApiClient = class {
2931
1448
  if (result.updateRunner.errors?.length) throw this.formatError({ message: result.updateRunner.errors[0].message });
2932
1449
  }
2933
1450
  async deleteRunner(runnerId) {
2934
- const result = await (await getGraphQLClient()).mutate(cliMutations.DeleteRunner, { runnerId: String(runnerId) });
1451
+ const result = await (await getGraphQLClient()).request(cliMutations.DeleteRunner, { runnerId: String(runnerId) });
2935
1452
  if (result.deleteRunner.errors?.length) throw this.formatError({ message: result.deleteRunner.errors[0].message });
2936
1453
  }
2937
1454
  async getInterruptedTasks(runnerId, limit = 5) {
@@ -3021,7 +1538,7 @@ var ApiClient = class {
3021
1538
  }));
3022
1539
  }
3023
1540
  async updateTask(taskId, data) {
3024
- const result = await (await getGraphQLClient()).mutate(mutations.UpdateTask, {
1541
+ const result = await (await getGraphQLClient()).request(mutations.UpdateTask, {
3025
1542
  id: String(taskId),
3026
1543
  input: {
3027
1544
  status: data.status ? mapStatusToGraphQL(data.status) : void 0,
@@ -3031,7 +1548,7 @@ var ApiClient = class {
3031
1548
  if (result.updateTask.errors?.length) throw this.formatError({ message: result.updateTask.errors[0].message });
3032
1549
  }
3033
1550
  async createPullRequest(taskId, data) {
3034
- const result = await (await getGraphQLClient()).mutate(mutations.CreatePullRequest, { input: {
1551
+ const result = await (await getGraphQLClient()).request(mutations.CreatePullRequest, { input: {
3035
1552
  taskId: String(taskId),
3036
1553
  title: data.title,
3037
1554
  description: data.description
@@ -3082,7 +1599,7 @@ var ApiClient = class {
3082
1599
  };
3083
1600
  }
3084
1601
  async updateStep(taskId, stepId, data) {
3085
- const result = await (await getGraphQLClient()).mutate(mutations.UpdateStep, {
1602
+ const result = await (await getGraphQLClient()).request(mutations.UpdateStep, {
3086
1603
  taskId: String(taskId),
3087
1604
  stepId: String(stepId),
3088
1605
  input: {
@@ -3109,7 +1626,7 @@ var ApiClient = class {
3109
1626
  };
3110
1627
  }
3111
1628
  async createPlan(taskId, plan) {
3112
- const result = await (await getGraphQLClient()).mutate(mutations.CreatePlan, { input: {
1629
+ const result = await (await getGraphQLClient()).request(mutations.CreatePlan, { input: {
3113
1630
  taskId: String(taskId),
3114
1631
  title: plan.title,
3115
1632
  steps: plan.steps.map((s) => ({
@@ -3444,7 +1961,7 @@ async function createGraphQLClient() {
3444
1961
 
3445
1962
  //#endregion
3446
1963
  //#region package.json
3447
- var version = "0.0.44";
1964
+ var version = "0.0.45";
3448
1965
 
3449
1966
  //#endregion
3450
1967
  //#region src/runner/index.ts
@@ -3606,7 +2123,7 @@ var TaskRunner = class {
3606
2123
  async fetchTaskProcess(taskId) {
3607
2124
  const existingProcess = this.taskProcesses[taskId.toString()];
3608
2125
  if (existingProcess) return existingProcess;
3609
- if (Object.values(this.taskProcesses).filter((p$1) => p$1 !== null).length >= this.maxConcurrentTasks) {
2126
+ if (Object.values(this.taskProcesses).filter((p) => p !== null).length >= this.maxConcurrentTasks) {
3610
2127
  console.warn(chalk.yellow(`Maximum concurrent tasks reached (${this.maxConcurrentTasks})`));
3611
2128
  return null;
3612
2129
  }
@@ -3644,6 +2161,22 @@ var TaskRunner = class {
3644
2161
  }
3645
2162
  result.process.stdin?.write(JSON.stringify(message) + "\n");
3646
2163
  }
2164
+ async restartTask(taskId) {
2165
+ const existingPromise = this.taskProcesses[taskId.toString()];
2166
+ if (!existingPromise) console.log(chalk.dim(`No existing process for task ${taskId}, nothing to restart`));
2167
+ else try {
2168
+ const result = await existingPromise;
2169
+ if (result?.process) {
2170
+ console.log(chalk.yellow(`Killing task ${taskId} process for restart...`));
2171
+ result.process.kill("SIGTERM");
2172
+ }
2173
+ } catch (error$1) {
2174
+ console.warn(chalk.yellow(`Error stopping task ${taskId} for restart: ${error$1.message}`));
2175
+ }
2176
+ this.taskProcesses[taskId.toString()] = null;
2177
+ console.log(chalk.green(`Task ${taskId} cleared for restart`));
2178
+ await this.fetchTaskProcess(taskId);
2179
+ }
3647
2180
  async connect() {
3648
2181
  console.log(chalk.dim(`Connecting to ${WS_URL}...`));
3649
2182
  const jiveApiKey = (await getCredentials())?.token || "";
@@ -3704,7 +2237,7 @@ var TaskRunner = class {
3704
2237
  return null;
3705
2238
  }
3706
2239
  }
3707
- handleMessage(data) {
2240
+ async handleMessage(data) {
3708
2241
  console.log(chalk.dim(`(CLI WS) Received message: ${data.toString()}`));
3709
2242
  try {
3710
2243
  const message = JSON.parse(data.toString());
@@ -3719,7 +2252,18 @@ var TaskRunner = class {
3719
2252
  case "task_message":
3720
2253
  const { taskId, message: taskMsg } = message.payload;
3721
2254
  const messageId = message.payload.messageId;
3722
- const activeCount = Object.values(this.taskProcesses).filter((p$1) => p$1 !== null).length;
2255
+ if (taskMsg.type === "restart") {
2256
+ await this.restartTask(taskId);
2257
+ if (messageId) this.send({
2258
+ type: "task_ack",
2259
+ payload: {
2260
+ messageId,
2261
+ accepted: true
2262
+ }
2263
+ });
2264
+ break;
2265
+ }
2266
+ const activeCount = Object.values(this.taskProcesses).filter((p) => p !== null).length;
3723
2267
  const accepted = activeCount < this.maxConcurrentTasks;
3724
2268
  if (messageId) this.send({
3725
2269
  type: "task_ack",
@@ -3776,7 +2320,7 @@ var TaskRunner = class {
3776
2320
  }
3777
2321
  }
3778
2322
  async pollForPendingTasks() {
3779
- const activeCount = Object.values(this.taskProcesses).filter((p$1) => p$1 !== null).length;
2323
+ const activeCount = Object.values(this.taskProcesses).filter((p) => p !== null).length;
3780
2324
  if (activeCount >= this.maxConcurrentTasks) {
3781
2325
  console.log(chalk.dim(`At capacity (${activeCount}/${this.maxConcurrentTasks}), skipping poll`));
3782
2326
  return;
@@ -3801,7 +2345,7 @@ var TaskRunner = class {
3801
2345
  }
3802
2346
  }
3803
2347
  `);
3804
- const pendingTasks = (await client.request(query$1, { limit: availableSlots })).tasks.edges.map((e$3) => e$3.node);
2348
+ const pendingTasks = (await client.request(query$1, { limit: availableSlots })).tasks.edges.map((e$2) => e$2.node);
3805
2349
  if (pendingTasks.length > 0) console.log(chalk.yellow(`Found ${pendingTasks.length} pending task(s) to pick up`));
3806
2350
  for (const task of pendingTasks) await this.pickupPendingTask(parseInt(task.id));
3807
2351
  } catch (error$1) {
@@ -3929,9 +2473,9 @@ async function publishPlan(plan) {
3929
2473
  if (!context) throw new Error("Task context not initialized");
3930
2474
  if (!plan.title || typeof plan.title !== "string") throw new Error("Plan must have a title");
3931
2475
  if (!plan.steps || !Array.isArray(plan.steps) || plan.steps.length === 0) throw new Error("Plan must have at least one step");
3932
- for (let i$2 = 0; i$2 < plan.steps.length; i$2++) {
3933
- const step = plan.steps[i$2];
3934
- if (!step.title || !step.prompt || !step.outputPrompt) throw new Error(`Step ${i$2 + 1} is missing required fields (title, prompt, outputPrompt)`);
2476
+ for (let i$1 = 0; i$1 < plan.steps.length; i$1++) {
2477
+ const step = plan.steps[i$1];
2478
+ if (!step.title || !step.prompt || !step.outputPrompt) throw new Error(`Step ${i$1 + 1} is missing required fields (title, prompt, outputPrompt)`);
3935
2479
  }
3936
2480
  return await getApiClient().createPlan(context.taskId, plan);
3937
2481
  }
@@ -5104,7 +3648,7 @@ Host gitlab.com
5104
3648
  if (!await exists(this.claudeSessionFilePath)) await mkdir(path$1.dirname(this.claudeSessionFilePath), { recursive: true });
5105
3649
  const messages = await getApiClient().getSessionLines(this.ctx.taskId, this.ctx.sessionId, true);
5106
3650
  const sessionLines = [...messages.length === 0 ? makeInitialLines(this.ctx.claudeSessionId) : [], ...messages.map((m) => m.payload)];
5107
- this.sentLineIds = new Set(sessionLines.map((l$1) => l$1.uuid ?? null));
3651
+ this.sentLineIds = new Set(sessionLines.map((l) => l.uuid ?? null));
5108
3652
  const jsonlContent = sessionLines.map((m) => JSON.stringify(m)).join("\n");
5109
3653
  await writeFile(this.claudeSessionFilePath, jsonlContent + "\n");
5110
3654
  this.debugLog(`✓ Saved session file to ${this.claudeSessionFilePath}`);